Search in sources :

Example 1 with ScoreTopComponent

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);
}
Also used : ScoreTopComponent(blue.ui.core.score.ScoreTopComponent) AudioClip(blue.score.layers.audio.core.AudioClip)

Example 2 with ScoreTopComponent

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;
    }
}
Also used : ScoreTopComponent(blue.ui.core.score.ScoreTopComponent) Action(javax.swing.Action) Point(java.awt.Point) JPopupMenu(javax.swing.JPopupMenu)

Example 3 with ScoreTopComponent

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;
}
Also used : ScoreTopComponent(blue.ui.core.score.ScoreTopComponent) ContextAwareAction(org.openide.util.ContextAwareAction) Action(javax.swing.Action) AbstractAction(javax.swing.AbstractAction) ContextAwareAction(org.openide.util.ContextAwareAction) JMenuItem(javax.swing.JMenuItem) JMenu(javax.swing.JMenu)

Example 4 with ScoreTopComponent

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();
}
Also used : ScoreTopComponent(blue.ui.core.score.ScoreTopComponent)

Example 5 with ScoreTopComponent

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);
    }
}
Also used : ScoreTopComponent(blue.ui.core.score.ScoreTopComponent)

Aggregations

ScoreTopComponent (blue.ui.core.score.ScoreTopComponent)11 SoundObject (blue.soundObject.SoundObject)2 Point (java.awt.Point)2 Action (javax.swing.Action)2 TimeState (blue.score.TimeState)1 AudioClip (blue.score.layers.audio.core.AudioClip)1 PolyObject (blue.soundObject.PolyObject)1 ScoreTimeCanvas (blue.ui.core.score.layers.soundObject.ScoreTimeCanvas)1 AddScoreObjectEdit (blue.ui.core.score.undo.AddScoreObjectEdit)1 LazyPlugin (blue.ui.nbutilities.lazyplugin.LazyPlugin)1 AbstractAction (javax.swing.AbstractAction)1 JMenu (javax.swing.JMenu)1 JMenuItem (javax.swing.JMenuItem)1 JPopupMenu (javax.swing.JPopupMenu)1 ContextAwareAction (org.openide.util.ContextAwareAction)1