Class SS_Editor

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, org.openide.util.Lookup.Provider

public abstract class SS_Editor extends JPanel implements org.openide.util.Lookup.Provider
A SongStructure editor.

Its Lookup must contain :
- editor's ActionMap
- edited SongStructure
- edited Song (container of the SongStructure if there is one)
- the selected SongParts or RhythmParameters.

See Also:
  • Field Details

    • PROP_EDITOR_VIEW_MODE

      public static final String PROP_EDITOR_VIEW_MODE
      oldValue=old mode, newValue=new mode.
      See Also:
    • PROP_COMPACT_VIEW_MODE_VISIBLE_RPS

      public static final String PROP_COMPACT_VIEW_MODE_VISIBLE_RPS
      oldValue=rhythm, newValue=list of visible RPs in compact view mode
      See Also:
    • PROP_RHYHM_VISIBLE_RPS

      public static final String PROP_RHYHM_VISIBLE_RPS
      oldValue=rhythm, newValue=list of currently visible RPs
      See Also:
  • Constructor Details

    • SS_Editor

      public SS_Editor()
  • Method Details

    • getModel

      public abstract SongStructure getModel()
    • getSongModel

      public abstract Song getSongModel()
      Returns:
      The Song which contains the SongStructure model. Can be null.
    • getUndoManager

      public abstract org.openide.awt.UndoRedo getUndoManager()
      Returns:
      The UndoManager used but this editor.
    • getSettings

      public abstract SS_EditorSettings getSettings()
    • getSptViewerRendererFactory

      public abstract SptViewerFactory getSptViewerRendererFactory()
    • setController

      public abstract void setController(SS_EditorMouseListener controller)
    • cleanup

      public abstract void cleanup()
      Clean up everything so component can be garbaged.
    • setZoomHFactor

      public abstract void setZoomHFactor(int hfactor)
      Set the horizontal zoom factor.
      Parameters:
      hfactor - An int value between 0 and 100.
    • getZoomHFactor

      public abstract int getZoomHFactor()
    • setZoomHFactorToFitWidth

      public abstract void setZoomHFactorToFitWidth(int width)
      Adjust the horizontal zoom factor to try to fit all the SongParts in the specified width.
      Parameters:
      width -
    • setZoomVFactor

      public abstract void setZoomVFactor(int vfactor)
      Set the vertical zoom factor.
      Parameters:
      vfactor - An int value between 0 and 100.
    • getZoomVFactor

      public abstract int getZoomVFactor()
    • selectSongPart

      public abstract void selectSongPart(SongPart spt, boolean b)
      Select a songpart.
      Parameters:
      spt -
      b -
    • selectRhythmParameter

      public abstract void selectRhythmParameter(SongPart spt, RhythmParameter<?> rp, boolean b)
      Select a specific RhythmParameter.
      Parameters:
      spt -
      rp -
      b - True to select, False to unselect.
    • setFocusOnSongPart

      public abstract void setFocusOnSongPart(SongPart spt)
      Set the focus on a specific SongPart.
      Parameters:
      spt - The SongPart to be focused.
    • setFocusOnRhythmParameter

      public abstract void setFocusOnRhythmParameter(SongPart spt, RhythmParameter<?> rp)
      Set the focus on a specific RhythmParameter.
      Parameters:
      spt -
      rp -
    • showSptInsertionMark

      public abstract void showSptInsertionMark(boolean b, int sptIndex, boolean copyMode)
      Show an insertion mark in the editor for SongPart copy/move operations.
      Parameters:
      b - Show/hide the insertion point.
      sptIndex - The SongPart index where insertion will be made.
      copyMode - If true insertion point is shown for a copy operation, otherwise it's a move operation.
    • showPlaybackPoint

      public abstract void showPlaybackPoint(boolean b, Position pos)
      Show a playback point in the editor at specified position.
      Parameters:
      b - Show/hide the playback point.
      pos - The position in the SongStructure model.
    • getSongPartParameterFromPoint

      public abstract SongPartParameter getSongPartParameterFromPoint(Point editorPoint, AtomicBoolean sptLeft)
      Return the SongPart/RhythmParameter corresponding to a graphical point.

      If we're not on a RhythmParameter, only the x coordinate is evaluated to find the right SongPart. If we're on the right of the last SongPart we return the last SongPart (with sptLeft false). If there is no SongPart, return null values for both spt and rp.

      Parameters:
      editorPoint -
      sptLeft - Used to return an indicator if point was on the left or right side of the songpart
      Returns:
    • getSptViewerRectangle

      public abstract Rectangle getSptViewerRectangle(SongPart spt)
      Get the bounds of the component representing the specified SongPart.
      Parameters:
      spt -
      Returns:
      The bounds in the screen coordinates space.
    • getRpViewerRectangle

      public abstract Rectangle getRpViewerRectangle(SongPart spt, RhythmParameter<?> rp)
      Get the bounds of the component representing the specified RhythmParameter.
      Parameters:
      spt -
      rp -
      Returns:
      The bounds in the screen coordinates space.
    • makeSptViewerVisible

      public abstract void makeSptViewerVisible(SongPart spt)
      Try to scroll so that the specified song part becomes visible.
      Parameters:
      spt -
    • getViewMode

      public abstract SS_Editor.ViewMode getViewMode()
      Get the view mode.
      Returns:
      Can't be null
    • setViewMode

      public abstract void setViewMode(SS_Editor.ViewMode mode)
      Set view mode.

      Fire a PROP_EDITOR_VIEW_MODE change event.

      Parameters:
      mode -
    • getCompactViewRPs

      public abstract List<RhythmParameter<?>> getCompactViewRPs(Rhythm r)
      Get visible RPs in compact view mode for the specified rhythm.

      Fire a PROP_VISIBLE_RPS change event.

      Parameters:
      r -
      Returns:
    • setCompactViewRPs

      public abstract void setCompactViewRPs(Rhythm r, List<RhythmParameter<?>> rps)
      Set visible RPs in compact view mode for the specified rhythm.

      Fire a PROP_COMPACT_VISIBLE_RPS change event.

      Parameters:
      r -
      rps -
    • getVisibleRps

      public abstract List<RhythmParameter<?>> getVisibleRps(Rhythm r)
      The rhythm parameters effectively displayed in the editor for a specific rhythm.

      Parameters:
      r -
      Returns:
      A non-empty list.
    • getFocusedSongPart

      public abstract SongPart getFocusedSongPart(boolean includeFocusedRhythmParameter)
      Get the focused SongPart, if any.
      Parameters:
      includeFocusedRhythmParameter - If true and focus is on a RhythmParameter editor, return the SongPart for this RhythmParameter editor.
      Returns:
      Can be null. The SongPart corresponding to the SongPart editor.
    • unselectAll

      public void unselectAll()
      Clear selection.