use of blue.ui.core.score.ScoreTopComponent in project blue by kunstmusik.
the class AudioClipPanel method addNotify.
@Override
public void addNotify() {
super.addNotify();
audioClip.addScoreObjectListener(this);
audioClip.fileStartTimeProperty().addListener(this);
audioClip.fadeInProperty().addListener(fadeListener);
audioClip.fadeInTypeProperty().addListener(fadeTypeListener);
audioClip.fadeOutProperty().addListener(fadeListener);
audioClip.fadeOutTypeProperty().addListener(fadeTypeListener);
timeState.addPropertyChangeListener(this);
ScoreTopComponent scoreTopComponent = (ScoreTopComponent) WindowManager.getDefault().findTopComponent("ScoreTopComponent");
result = scoreTopComponent.getLookup().lookupResult(AudioClip.class);
result.addLookupListener(this);
Collection<? extends AudioClip> soundObjects = result.allInstances();
setSelected(soundObjects.contains(this.audioClip));
updateWaveformData();
this.addMouseListener(mouseAdapter);
this.addMouseMotionListener(mouseAdapter);
}
use of blue.ui.core.score.ScoreTopComponent in project blue by kunstmusik.
the class PopupMenuListener method showPopup.
protected static void showPopup(Component comp, MouseEvent e) {
Collection<? extends ScoreObject> soundObjects = Utilities.actionsGlobalContext().lookupAll(ScoreObject.class);
Point point = SwingUtilities.convertPoint(e.getComponent(), e.getPoint(), scoreTC.getScorePanel());
ScoreTopComponent scoreTopComponent = (ScoreTopComponent) WindowManager.getDefault().findTopComponent("ScoreTopComponent");
if (currentScoreObjectView != null) {
if (soundObjects.size() > 0) {
List<? extends Action> list = Utilities.actionsForPath("blue/score/actions");
content.add(currentLayerGroupPanel);
content.add(point);
content.add(scoreTC.getTimeState());
final JPopupMenu menu = Utilities.actionsToPopup(list.toArray(new Action[0]), scoreTopComponent.getLookup());
try {
menu.show(scoreTopComponent.getScorePanel(), point.x, point.y);
} finally {
content.remove(scoreTC.getTimeState());
content.remove(point);
content.remove(currentLayerGroupPanel);
}
}
} else if (currentLayerGroupPanel != null) {
Action[] actions = currentLayerGroupPanel.getLayerActions();
if (actions != null && actions.length > 0) {
Point p = e.getPoint();
content.add(currentLayerGroupPanel);
content.add(point);
content.add(scoreTC.getTimeState());
final JPopupMenu menu = Utilities.actionsToPopup(actions, scoreTopComponent.getLookup());
try {
menu.show(scoreTopComponent.getScorePanel(), point.x, point.y);
} finally {
content.remove(scoreTC.getTimeState());
content.remove(point);
content.remove(currentLayerGroupPanel);
}
}
// } else if (e.getY() < sCanvas.pObj.getTotalHeight()) {
// sCanvas.showSoundLayerPopup(getSoundLayerIndex(e.getY()), e.getX(),
// e.getY());
// }
// isPopupOpen = true;
// this.justSelected = true;
}
}
use of blue.ui.core.score.ScoreTopComponent in project blue by kunstmusik.
the class AlignActionsPresenter method getPopupPresenter.
@Override
public JMenuItem getPopupPresenter() {
JMenu menu = new JMenu(NbBundle.getMessage(AlignActionsPresenter.class, "CTL_AlignActionsPresenter"));
org.openide.awt.Mnemonics.setLocalizedText(menu, menu.getText());
ScoreTopComponent scoreTC = (ScoreTopComponent) WindowManager.getDefault().findTopComponent("ScoreTopComponent");
for (Action action : actions) {
Action temp = action;
if (action instanceof ContextAwareAction) {
temp = ((ContextAwareAction) action).createContextAwareInstance(scoreTC.getLookup());
}
menu.add(new JMenuItem(temp));
}
return menu;
}
use of blue.ui.core.score.ScoreTopComponent in project blue by kunstmusik.
the class LowerPixelSecondAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
ScoreTopComponent scoreTopComponent = (ScoreTopComponent) WindowManager.getDefault().findTopComponent("ScoreTopComponent");
scoreTopComponent.getTimeState().lowerPixelSecond();
}
use of blue.ui.core.score.ScoreTopComponent in project blue by kunstmusik.
the class NudgeLeftAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
Collection<? extends ScoreObject> scoreObjects = ScoreController.getInstance().getSelectedScoreObjects();
ScoreTopComponent scoreTopComponent = (ScoreTopComponent) WindowManager.getDefault().findTopComponent("ScoreTopComponent");
if (!scoreObjects.isEmpty()) {
float adjust = -1.0f / scoreTopComponent.getTimeState().getPixelSecond();
NudgeUtils.nudgeHorizontal(adjust, scoreObjects);
}
}
Aggregations