|
hydrogen 1.2.3
|
Pattern Editor. More...
#include <PatternEditor.h>
Public Types | |
| enum class | Editor { DrumPattern = 0 , PianoRoll = 1 , NotePropertiesRuler = 2 , None = 3 } |
| enum class | Mode { Velocity = 0 , Pan = 1 , LeadLag = 2 , NoteKey = 3 , Probability = 4 , None = 5 } |
Public Types inherited from SelectionWidget< H2Core::Note * > | |
| typedef H2Core::Note * | SelectionIndex |
Public Slots | |
| virtual void | copy () |
| Copy selection to clipboard in XML. | |
| virtual void | cut () |
| virtual void | deleteSelection ()=0 |
| void | onPreferencesChanged (H2Core::Preferences::Changes changes) |
| virtual void | paste ()=0 |
| void | scrolled (int nValue) |
| virtual void | selectAll ()=0 |
| virtual void | selectInstrumentNotes (int nInstrument) |
| virtual void | selectNone () |
| void | setCurrentInstrument (int nInstrument) |
| virtual void | updateEditor (bool bPatternOnly=false)=0 |
Public Member Functions | |
| PatternEditor (QWidget *pParent, PatternEditorPanel *panel) | |
| ~PatternEditor () | |
| virtual bool | checkDeselectElements (std::vector< SelectionIndex > &elements) override |
| Deselecting notes. | |
| void | clearSelection () |
| Clear the pattern editor selection. | |
| void | deselectAndOverwriteNotes (std::vector< H2Core::Note * > &selected, std::vector< H2Core::Note * > &overwritten) |
| Deselect some notes, and "overwrite" some others. | |
| void | editNoteLengthAction (int nColumn, int nRealColumn, int nRow, int nLength, int nSelectedPatternNumber, int nSelectedInstrumentnumber, Editor editor) |
| void | editNotePropertiesAction (int nColumn, int nRealColumn, int nRow, int nSelectedPatternNumber, int nSelectedInstrumentNumber, Mode mode, Editor editor, float fVelocity, float fPan, float fLeadLag, float fProbability) |
| virtual void | endMouseGesture () override |
| unsigned | getGridHeight () const |
| float | getGridWidth () const |
| uint | getResolution () const |
| bool | isUsingTriplets () const |
| int | lineToPitch (int nLine) |
| void | mergeSelectionGroups (PatternEditor *pPatternEditor) |
| Merge together the selection groups of two PatternEditor objects to share a common selection. | |
| virtual void | mouseDragEndEvent (QMouseEvent *ev) override |
| virtual void | mouseDragStartEvent (QMouseEvent *ev) override |
| virtual void | mouseDragUpdateEvent (QMouseEvent *ev) override |
| virtual void | mouseMoveEvent (QMouseEvent *ev) override |
| virtual void | mousePressEvent (QMouseEvent *ev) override |
| Raw Qt mouse events are passed to the Selection. | |
| virtual void | mouseReleaseEvent (QMouseEvent *ev) override |
| bool | notesMatchExactly (H2Core::Note *pNoteA, H2Core::Note *pNoteB) const |
| Do two notes match exactly, from the pattern editor's point of view? They match if all user-editable properties are the same. | |
| int | pitchToLine (int nPitch) |
| void | setResolution (uint res, bool bUseTriplets) |
Set the editor grid resolution, dividing a whole note into res subdivisions. | |
| virtual void | songModeActivationEvent () override |
| virtual void | stackedModeActivationEvent (int nValue) override |
| virtual void | startMouseLasso (QMouseEvent *ev) override |
| Change the mouse cursor during mouse gestures. | |
| virtual void | startMouseMove (QMouseEvent *ev) override |
| void | undoDeselectAndOverwriteNotes (std::vector< H2Core::Note * > &selected, std::vector< H2Core::Note * > &overwritten) |
| virtual void | updateModifiers (QInputEvent *ev) |
| Update the status of modifier keys in response to input events. | |
| void | updatePosition (float fTick) |
| Caches the AudioEngine::m_nPatternTickPosition in the member variable m_nTick and triggers an update(). | |
| virtual void | updateWidget () override |
| Update a widget in response to a change in selection. | |
| virtual void | validateSelection () override |
| Ensure that the Selection contains only valid elements. | |
| void | zoomIn () |
| Zoom in / out on the time axis. | |
| void | zoomOut () |
Public Member Functions inherited from EventListener | |
| virtual | ~EventListener () |
| virtual void | actionModeChangeEvent (int nValue) |
| virtual void | bbtChangedEvent () |
| virtual void | driverChangedEvent () |
| virtual void | drumkitLoadedEvent () |
| virtual void | errorEvent (int nErrorCode) |
| virtual void | gridCellToggledEvent () |
| virtual void | instrumentParametersChangedEvent (int nInstrumentNumber) |
| virtual void | jacksessionEvent (int nValue) |
| virtual void | jackTimebaseStateChangedEvent () |
| virtual void | jackTransportActivationEvent () |
| virtual void | loopModeActivationEvent () |
| virtual void | metronomeEvent (int nValue) |
| virtual void | midiActivityEvent () |
| virtual void | midiMapChangedEvent () |
| virtual void | nextPatternsChangedEvent () |
| virtual void | nextShotEvent () |
| virtual void | noteOnEvent (int nInstrument) |
| virtual void | patternEditorLockedEvent () |
| virtual void | patternModifiedEvent () |
| virtual void | playbackTrackChangedEvent () |
| virtual void | playingPatternsChangedEvent () |
| virtual void | playlistLoadSongEvent (int nIndex) |
| virtual void | progressEvent (int nValue) |
| virtual void | quitEvent (int nValue) |
| virtual void | relocationEvent () |
| virtual void | selectedInstrumentChangedEvent () |
| virtual void | selectedPatternChangedEvent () |
| virtual void | songModifiedEvent () |
| virtual void | songSizeChangedEvent () |
| virtual void | soundLibraryChangedEvent () |
| virtual void | stateChangedEvent (H2Core::AudioEngine::State state) |
| virtual void | tempoChangedEvent (int nValue) |
| virtual void | timelineActivationEvent () |
| virtual void | timelineUpdateEvent (int nValue) |
| virtual void | undoRedoActionEvent (int nValue) |
| virtual void | updatePreferencesEvent (int nValue) |
| virtual void | updateSongEvent (int nValue) |
| virtual void | XRunEvent () |
Public Member Functions inherited from Object< PatternEditor > | |
| Object () | |
| Object (const Object< PatternEditor > &other) | |
Public Member Functions inherited from Base | |
| Base () | |
| Base (const Base &other) | |
| virtual const char * | class_name () const |
| void | Print (bool bShort=true) const |
| Prints content of toQString() via DEBUGLOG. | |
| virtual QString | toQString (const QString &sPrefix="", bool bShort=true) const |
| Formatted string version for debugging purposes. | |
Public Member Functions inherited from SelectionWidget< H2Core::Note * > | |
| virtual bool | canDragElements () |
| Can elements be dragged as well as being selected? This may change to suit widget's current state. | |
| virtual bool | checkDeselectElements (std::vector< SelectionIndex > &elements) |
| Inform the client that we're deselecting elements. | |
| virtual std::vector< SelectionIndex > | elementsIntersecting (QRect r)=0 |
| Find list of elements which intersect a rectangular area. | |
| virtual QScrollArea * | findScrollArea () |
| Find the QScrollArea, if any, which contains the widget. | |
| virtual QRect | getKeyboardCursorRect ()=0 |
| Calculate screen space occupied by keyboard cursor. | |
| virtual void | mouseClickEvent (QMouseEvent *ev)=0 |
| virtual void | selectionMoveUpdateEvent (QMouseEvent *ev) |
| virtual void | selectionMoveEndEvent (QInputEvent *ev)=0 |
| virtual void | selectionMoveCancelEvent () |
Static Public Member Functions | |
| static QColor | computeNoteColor (float velocity) |
| Calculate colour to use for note representation based on note velocity. | |
| static bool | isUsingAdditionalPatterns (const H2Core::Pattern *pPattern) |
| Determines whether to pattern editor should show further patterns (determined by getPattersToShow()) or just the currently selected one. | |
| static QString | modeToQString (Mode mode) |
| static void | triggerStatusMessage (H2Core::Note *pNote, Mode mode) |
Static Public Member Functions inherited from Base | |
| static const char * | _class_name () |
| return the class name | |
| static QString | base_clock (const QString &sMsg) |
| Measures the current time and stores it in __last_clock. | |
| static QString | base_clock_in (const QString &sMsg) |
| static int | bootstrap (Logger *logger, bool count=false) |
| must be called before any Object instantiation ! | |
| static bool | count_active () |
| static int | getAliveObjectCount () |
| static object_map_t | getObjectMap () |
| static Logger * | logger () |
| return the logger instance | |
| static int | objects_count () |
| static void | printObjectMapDiff (object_map_t map) |
| Creates the difference between a snapshot of the object map and its current state and prints it to std::cout. | |
| static void | set_count (bool flag) |
| enable/disable class instances counting | |
| static void | write_objects_map_to (std::ostream &out, object_map_t *map=nullptr) |
| output the full objects map to a given ostream | |
| static void | write_objects_map_to_cerr () |
| output objects map to stderr | |
Static Public Attributes | |
| static constexpr int | nMargin = 20 |
Static Public Attributes inherited from Base | |
| static QString | sPrintIndention = " " |
| String used to format the debugging string output of some core classes. | |
Protected Member Functions | |
| virtual void | createBackground () |
| Updates m_pBackgroundPixmap to show the latest content. | |
| void | drawGridLines (QPainter &p, Qt::PenStyle style=Qt::SolidLine) const |
| Draw lines for note grid. | |
| void | drawNoteSymbol (QPainter &p, QPoint pos, H2Core::Note *pNote, bool bIsForeground=true) const |
| Draw a note. | |
| virtual void | enterEvent (QEvent *ev) override |
| virtual void | focusInEvent (QFocusEvent *ev) override |
| virtual void | focusOutEvent (QFocusEvent *ev) override |
| int | getColumn (int x, bool bUseFineGrained=false) const |
| std::vector< H2Core::Pattern * > | getPatternsToShow (void) |
| Get notes to show in pattern editor. | |
| int | granularity () const |
| Granularity of grid positioning (in ticks) | |
| void | invalidateBackground () |
| virtual void | leaveEvent (QEvent *ev) override |
| QPoint | movingGridOffset () const |
| QColor | selectedNoteColor () const |
| Colour to use for outlining selected notes. | |
| void | storeNoteProperties (const H2Core::Note *pNote) |
| Stores the properties of pNote in member variables. | |
| void | updatePatternInfo () |
| Update current pattern information. | |
| void | updateWidth () |
| Adjusts m_nActiveWidth and m_nEditorWidth to the current state of the editor. | |
Protected Member Functions inherited from Object< PatternEditor > | |
| ~Object () | |
Protected Member Functions inherited from Base | |
| ~Base () | |
Additional Inherited Members | |
Static Protected Member Functions inherited from Base | |
| static void | registerClass (const char *name, const atomic_obj_cpt_t *counters) |
Static Protected Attributes inherited from Base | |
| static bool | __count = false |
| should we count class instances | |
| static timeval | __last_clock = { 0, 0 } |
| static Logger * | __logger = nullptr |
Pattern Editor.
The PatternEditor class is an abstract base class for functionality common to Pattern Editor components (DrumPatternEditor, PianoRollEditor, NotePropertiesRuler).
This covers common elements such as some selection handling, timebase functions, and drawing grid lines.
Definition at line 57 of file PatternEditor.h.
|
strong |
| Enumerator | |
|---|---|
| DrumPattern | |
| PianoRoll | |
| NotePropertiesRuler | |
| None | |
Definition at line 66 of file PatternEditor.h.
|
strong |
| Enumerator | |
|---|---|
| Velocity | |
| Pan | |
| LeadLag | |
| NoteKey | |
| Probability | |
| None | |
Definition at line 73 of file PatternEditor.h.
| PatternEditor | ( | QWidget * | pParent, |
| PatternEditorPanel * | panel ) |
Definition at line 54 of file PatternEditor.cpp.
| ~PatternEditor | ( | ) |
Definition at line 102 of file PatternEditor.cpp.
|
overridevirtual |
Deselecting notes.
Definition at line 518 of file PatternEditor.cpp.
|
inline |
Clear the pattern editor selection.
Definition at line 101 of file PatternEditor.h.
|
static |
Calculate colour to use for note representation based on note velocity.
Definition at line 150 of file PatternEditor.cpp.
|
virtualslot |
Copy selection to clipboard in XML.
Definition at line 381 of file PatternEditor.cpp.
|
protectedvirtual |
Updates m_pBackgroundPixmap to show the latest content.
Reimplemented in DrumPatternEditor, NotePropertiesRuler, and PianoRollEditor.
Definition at line 887 of file PatternEditor.cpp.
|
virtualslot |
Definition at line 429 of file PatternEditor.cpp.
|
pure virtualslot |
| void deselectAndOverwriteNotes | ( | std::vector< H2Core::Note * > & | selected, |
| std::vector< H2Core::Note * > & | overwritten ) |
Deselect some notes, and "overwrite" some others.
Definition at line 576 of file PatternEditor.cpp.
|
protected |
Draw lines for note grid.
Definition at line 680 of file PatternEditor.cpp.
|
protected |
Draw a note.
| p | Painting device |
| pos | Center of the note to draw |
| pNote | Particular note to draw |
| bIsForeground | Whether the pNote is contained in the pattern currently shown in the pattern editor (the one selected in the song editor) |
Definition at line 200 of file PatternEditor.cpp.
| void editNoteLengthAction | ( | int | nColumn, |
| int | nRealColumn, | ||
| int | nRow, | ||
| int | nLength, | ||
| int | nSelectedPatternNumber, | ||
| int | nSelectedInstrumentnumber, | ||
| Editor | editor ) |
Definition at line 1235 of file PatternEditor.cpp.
| void editNotePropertiesAction | ( | int | nColumn, |
| int | nRealColumn, | ||
| int | nRow, | ||
| int | nSelectedPatternNumber, | ||
| int | nSelectedInstrumentNumber, | ||
| Mode | mode, | ||
| Editor | editor, | ||
| float | fVelocity, | ||
| float | fPan, | ||
| float | fLeadLag, | ||
| float | fProbability ) |
Definition at line 1307 of file PatternEditor.cpp.
|
inlineoverridevirtual |
Reimplemented from SelectionWidget< H2Core::Note * >.
Definition at line 137 of file PatternEditor.h.
|
overrideprotectedvirtual |
Reimplemented in NotePropertiesRuler.
Definition at line 844 of file PatternEditor.cpp.
|
overrideprotectedvirtual |
Definition at line 856 of file PatternEditor.cpp.
|
overrideprotectedvirtual |
Definition at line 872 of file PatternEditor.cpp.
|
protected |
Definition at line 356 of file PatternEditor.cpp.
|
inline |
Definition at line 95 of file PatternEditor.h.
|
inline |
Definition at line 94 of file PatternEditor.h.
|
protected |
Get notes to show in pattern editor.
This may include "background" notes that are in currently-playing patterns rather than the current pattern.
Definition at line 893 of file PatternEditor.cpp.
|
inline |
Definition at line 91 of file PatternEditor.h.
|
inlineprotected |
Granularity of grid positioning (in ticks)
Definition at line 224 of file PatternEditor.h.
|
protected |
Definition at line 883 of file PatternEditor.cpp.
|
static |
Determines whether to pattern editor should show further patterns (determined by getPattersToShow()) or just the currently selected one.
Definition at line 947 of file PatternEditor.cpp.
|
inline |
Definition at line 92 of file PatternEditor.h.
|
overrideprotectedvirtual |
Reimplemented in NotePropertiesRuler.
Definition at line 850 of file PatternEditor.cpp.
|
inline |
Definition at line 190 of file PatternEditor.h.
|
inline |
Merge together the selection groups of two PatternEditor objects to share a common selection.
Definition at line 110 of file PatternEditor.h.
|
static |
Definition at line 1403 of file PatternEditor.cpp.
|
overridevirtual |
Implements SelectionWidget< H2Core::Note * >.
Reimplemented in NotePropertiesRuler.
Definition at line 1182 of file PatternEditor.cpp.
|
overridevirtual |
Implements SelectionWidget< H2Core::Note * >.
Reimplemented in DrumPatternEditor, NotePropertiesRuler, and PianoRollEditor.
Definition at line 1050 of file PatternEditor.cpp.
|
overridevirtual |
Implements SelectionWidget< H2Core::Note * >.
Reimplemented in DrumPatternEditor, NotePropertiesRuler, and PianoRollEditor.
Definition at line 1096 of file PatternEditor.cpp.
|
overridevirtual |
Reimplemented in NotePropertiesRuler.
Definition at line 465 of file PatternEditor.cpp.
|
overridevirtual |
Raw Qt mouse events are passed to the Selection.
Reimplemented in DrumPatternEditor, NotePropertiesRuler, and PianoRollEditor.
Definition at line 459 of file PatternEditor.cpp.
|
overridevirtual |
Definition at line 474 of file PatternEditor.cpp.
|
protected |
Definition at line 657 of file PatternEditor.cpp.
| bool notesMatchExactly | ( | H2Core::Note * | pNoteA, |
| H2Core::Note * | pNoteB ) const |
Do two notes match exactly, from the pattern editor's point of view? They match if all user-editable properties are the same.
Definition at line 509 of file PatternEditor.cpp.
|
slot |
Definition at line 109 of file PatternEditor.cpp.
|
pure virtualslot |
|
inline |
Definition at line 193 of file PatternEditor.h.
|
slot |
Definition at line 839 of file PatternEditor.cpp.
|
pure virtualslot |
|
protected |
Colour to use for outlining selected notes.
Definition at line 796 of file PatternEditor.cpp.
|
virtualslot |
Definition at line 436 of file PatternEditor.cpp.
|
virtualslot |
Definition at line 372 of file PatternEditor.cpp.
|
slot |
Definition at line 454 of file PatternEditor.cpp.
| void setResolution | ( | uint | res, |
| bool | bUseTriplets ) |
Set the editor grid resolution, dividing a whole note into res subdivisions.
Definition at line 118 of file PatternEditor.cpp.
|
overridevirtual |
Reimplemented from EventListener.
Reimplemented in DrumPatternEditor, NotePropertiesRuler, and PianoRollEditor.
Definition at line 995 of file PatternEditor.cpp.
|
overridevirtual |
Reimplemented from EventListener.
Definition at line 1001 of file PatternEditor.cpp.
|
inlineoverridevirtual |
Change the mouse cursor during mouse gestures.
Reimplemented from SelectionWidget< H2Core::Note * >.
Definition at line 129 of file PatternEditor.h.
|
inlineoverridevirtual |
Reimplemented from SelectionWidget< H2Core::Note * >.
Definition at line 133 of file PatternEditor.h.
|
protected |
Stores the properties of pNote in member variables.
Definition at line 1032 of file PatternEditor.cpp.
|
static |
Definition at line 1430 of file PatternEditor.cpp.
| void undoDeselectAndOverwriteNotes | ( | std::vector< H2Core::Note * > & | selected, |
| std::vector< H2Core::Note * > & | overwritten ) |
Definition at line 612 of file PatternEditor.cpp.
|
pure virtualslot |
|
virtual |
Update the status of modifier keys in response to input events.
Definition at line 480 of file PatternEditor.cpp.
|
protected |
Update current pattern information.
Definition at line 641 of file PatternEditor.cpp.
| void updatePosition | ( | float | fTick | ) |
Caches the AudioEngine::m_nPatternTickPosition in the member variable m_nTick and triggers an update().
Definition at line 1008 of file PatternEditor.cpp.
|
inlineoverridevirtual |
Update a widget in response to a change in selection.
Implements SelectionWidget< H2Core::Note * >.
Definition at line 121 of file PatternEditor.h.
|
protected |
Adjusts m_nActiveWidth and m_nEditorWidth to the current state of the editor.
Definition at line 960 of file PatternEditor.cpp.
|
overridevirtual |
Ensure that the Selection contains only valid elements.
Ensure selection only refers to valid notes, and does not contain any stale references to deleted notes.
Implements SelectionWidget< H2Core::Note * >.
Definition at line 813 of file PatternEditor.cpp.
| void zoomIn | ( | ) |
Zoom in / out on the time axis.
Definition at line 128 of file PatternEditor.cpp.
| void zoomOut | ( | ) |
Definition at line 138 of file PatternEditor.cpp.
|
protected |
Definition at line 293 of file PatternEditor.h.
|
protected |
Definition at line 250 of file PatternEditor.h.
|
protected |
Indicates whether the mouse pointer entered the widget.
Definition at line 302 of file PatternEditor.h.
|
protected |
Definition at line 249 of file PatternEditor.h.
|
protected |
Definition at line 252 of file PatternEditor.h.
|
protected |
Definition at line 248 of file PatternEditor.h.
|
protected |
Definition at line 334 of file PatternEditor.h.
|
protected |
Definition at line 241 of file PatternEditor.h.
|
protected |
Definition at line 330 of file PatternEditor.h.
|
protected |
Definition at line 331 of file PatternEditor.h.
|
protected |
Definition at line 329 of file PatternEditor.h.
|
protected |
Definition at line 333 of file PatternEditor.h.
|
protected |
Definition at line 327 of file PatternEditor.h.
|
protected |
Definition at line 328 of file PatternEditor.h.
|
protected |
Definition at line 332 of file PatternEditor.h.
|
protected |
Definition at line 326 of file PatternEditor.h.
|
protected |
Definition at line 335 of file PatternEditor.h.
|
protected |
Definition at line 239 of file PatternEditor.h.
|
protected |
Definition at line 320 of file PatternEditor.h.
|
protected |
Definition at line 235 of file PatternEditor.h.
|
protected |
Definition at line 236 of file PatternEditor.h.
|
protected |
Definition at line 242 of file PatternEditor.h.
|
protected |
Definition at line 310 of file PatternEditor.h.
|
protected |
Definition at line 325 of file PatternEditor.h.
|
protected |
Definition at line 323 of file PatternEditor.h.
|
protected |
Definition at line 322 of file PatternEditor.h.
|
protected |
Definition at line 319 of file PatternEditor.h.
|
protected |
Definition at line 247 of file PatternEditor.h.
|
protected |
Definition at line 321 of file PatternEditor.h.
|
protected |
Cached properties used when adjusting a note property via right-press mouse movement.
Definition at line 318 of file PatternEditor.h.
|
protected |
Definition at line 244 of file PatternEditor.h.
|
protected |
Definition at line 308 of file PatternEditor.h.
|
protected |
Definition at line 255 of file PatternEditor.h.
|
protected |
Definition at line 292 of file PatternEditor.h.
|
protected |
Definition at line 253 of file PatternEditor.h.
|
protected |
Definition at line 245 of file PatternEditor.h.
|
protected |
Definition at line 257 of file PatternEditor.h.
|
protected |
Definition at line 258 of file PatternEditor.h.
|
protected |
The Selection object.
Definition at line 206 of file PatternEditor.h.
|
staticconstexpr |
Definition at line 163 of file PatternEditor.h.