|
hydrogen 1.1.1
|
Song editor. More...
#include <SongEditor.h>
Data Structures | |
| struct | GridCell |
Public Slots | |
| void | selectAll () |
| void | selectNone () |
| void | deleteSelection () |
| void | copy () |
| Copy a selection of cells to an XML representation in the clipboard. More... | |
| void | paste () |
| void | cut () |
Public Member Functions | |
| SongEditor (QWidget *parent, QScrollArea *pScrollView, SongEditorPanel *pSongEditorPanel) | |
| ~SongEditor () | |
| void | createBackground () |
| void | cleanUp () |
| int | getGridWidth () |
| void | setGridWidth (uint width) |
| int | getGridHeight () |
| int | getCursorRow () const |
| int | getCursorColumn () const |
| void | addPattern (int nColumn, int nRow) |
| Add or delete pattern in the sequence grid. More... | |
| void | deletePattern (int nColumn, int nRow) |
| void | modifyPatternCellsAction (std::vector< QPoint > &addCells, std::vector< QPoint > &deleteCells, std::vector< QPoint > &selectCells) |
| Modify many pattern cells at once, for use in a single efficient undo/redo action. More... | |
| void | clearThePatternSequenceVector (QString filename) |
| void | updateEditorandSetTrue () |
Selection interfaces | |
see Selection.h for details. | |
| virtual std::vector< SelectionIndex > | elementsIntersecting (QRect r) override |
| Find list of elements which intersect a rectangular area. More... | |
| virtual QRect | getKeyboardCursorRect () override |
| Calculate screen space occupied by keyboard cursor. More... | |
| virtual void | validateSelection () override |
| Ensure that the Selection contains only valid elements. More... | |
| virtual void | updateWidget () override |
| Selection or selection-related visual elements have changed, widget needs to be updated. More... | |
| virtual void | mouseClickEvent (QMouseEvent *ev) override |
| virtual void | mouseDragStartEvent (QMouseEvent *ev) override |
| virtual void | mouseDragUpdateEvent (QMouseEvent *ev) override |
| virtual void | mouseDragEndEvent (QMouseEvent *ev) override |
| virtual void | selectionMoveEndEvent (QInputEvent *ev) override |
| virtual void | updateModifiers (QInputEvent *ev) |
| virtual bool | canDragElements () override |
| Can elements be dragged as well as being selected? This may change to suit widget's current state. More... | |
Public Member Functions inherited from Object | |
| ~Object () | |
| destructor More... | |
| Object (const Object &obj) | |
| copy constructor More... | |
| Object (const char *class_name) | |
| constructor More... | |
| const char * | class_name () const |
| return the class name More... | |
| virtual QString | toQString (const QString &sPrefix, bool bShort=true) const |
| Formatted string version for debugging purposes. More... | |
| void | Print (bool bShort=true) const |
| Prints content of toQString() via DEBUGLOG. More... | |
Public Member Functions inherited from SelectionWidget< QPoint > | |
| virtual std::vector< SelectionIndex > | elementsIntersecting (QRect r)=0 |
| Find list of elements which intersect a rectangular area. More... | |
| virtual bool | canDragElements () |
| Can elements be dragged as well as being selected? This may change to suit widget's current state. More... | |
| virtual QRect | getKeyboardCursorRect ()=0 |
| Calculate screen space occupied by keyboard cursor. More... | |
| virtual void | validateSelection ()=0 |
| Ensure that the Selection contains only valid elements. More... | |
| virtual void | updateWidget ()=0 |
| Selection or selection-related visual elements have changed, widget needs to be updated. More... | |
| virtual bool | checkDeselectElements (std::vector< SelectionIndex > &elements) |
| Inform the client that we're deselecting elements. More... | |
| virtual QScrollArea * | findScrollArea () |
| Find the QScrollArea, if any, which contains the widget. More... | |
| virtual void | selectionMoveUpdateEvent (QMouseEvent *ev) |
| virtual void | selectionMoveCancelEvent () |
| virtual void | startMouseMove (QMouseEvent *ev) |
Private Member Functions | |
| QPoint | movingGridOffset () const |
| Quantise the selection move offset to the sequence grid. More... | |
| bool | togglePatternActive (int nColumn, int nRow) |
| void | setPatternActive (int nColumn, int nRow, bool value) |
| void | drawSequence () |
| void | drawPattern (int pos, int number, bool invertColour, double width) |
| void | updateGridCells () |
Conversion between sequence grid coordinates and screen (widget) coordinates. | |
| QPoint | xyToColumnRow (QPoint p) |
| QPoint | columnRowToXy (QPoint p) |
Change the mouse cursor during mouse gestures | |
| virtual void | startMouseLasso (QMouseEvent *ev) override |
| virtual void | endMouseGesture () override |
System events | |
| virtual void | mousePressEvent (QMouseEvent *ev) override |
| virtual void | mouseReleaseEvent (QMouseEvent *ev) override |
| virtual void | mouseMoveEvent (QMouseEvent *ev) override |
| virtual void | keyPressEvent (QKeyEvent *ev) override |
| virtual void | keyReleaseEvent (QKeyEvent *ev) override |
| virtual void | paintEvent (QPaintEvent *ev) override |
| virtual void | focusInEvent (QFocusEvent *ev) override |
Private Attributes | |
| Selection< QPoint > | m_selection |
| QScrollArea * | m_pScrollView |
| SongEditorPanel * | m_pSongEditorPanel |
| QMenu * | m_pPopupMenu |
| unsigned | m_nGridHeight |
| unsigned | m_nGridWidth |
| unsigned | m_nMaxPatternSequence |
| bool | m_bCopyNotMove |
| bool | m_bSequenceChanged |
| Pattern sequence or selection has changed, so must be redrawn. More... | |
| bool | m_bDrawingActiveCell |
| In "draw" mode, whether we're activating pattern cells ("drawing") or deactivating ("erasing") is set at the start of the draw gesture. More... | |
| const int | m_nMargin = 10 |
| QPoint | m_previousMousePosition |
| Mouse position during selection gestures (used to detect crossing cell boundaries) More... | |
| QPoint | m_currentMousePosition |
| std::map< QPoint, GridCell > | m_gridCells |
Background pixmap caching | |
To make painting the song editor sequence grid more efficient, the drawing uses multiple levels of lazy painting.
| |
| QPixmap * | m_pBackgroundPixmap |
| QPixmap * | m_pSequencePixmap |
Position of the keyboard input cursor | |
| int | m_nCursorRow |
| int | m_nCursorColumn |
Additional Inherited Members | |
Public Types inherited from SelectionWidget< QPoint > | |
| typedef QPoint | SelectionIndex |
Static Public Member Functions inherited from Object | |
| static void | set_count (bool flag) |
| enable/disable class instances counting More... | |
| static bool | count_active () |
| return true if class instances counting is enabled More... | |
| static unsigned | objects_count () |
| return the number of objects More... | |
| static void | write_objects_map_to (std::ostream &out) |
| output the full objects map to a given ostream More... | |
| static void | write_objects_map_to_cerr () |
| output objects map to stderr More... | |
| static int | bootstrap (Logger *logger, bool count=false) |
| must be called before any Object instantiation ! More... | |
| static Logger * | logger () |
| return the logger instance More... | |
Static Public Attributes inherited from Object | |
| static QString | sPrintIndention = " " |
| String used to format the debugging string output of some core classes. More... | |
Static Protected Attributes inherited from Object | |
| static Logger * | __logger = nullptr |
| logger instance pointer More... | |
Song editor.
The main widget of SongEditorPanel, responsible for altering the sequence of patterns.
It supports mouse and keyboard based activation of patterns in timeslots, as well as visual editing of multiple pattern+timeslot cells using a 2-dimensional visual representation, with copy, paste, move, delete, duplicate etc.
| SongEditor | ( | QWidget * | parent, |
| QScrollArea * | pScrollView, | ||
| SongEditorPanel * | pSongEditorPanel | ||
| ) |
| ~SongEditor | ( | ) |
| void addPattern | ( | int | nColumn, |
| int | nRow | ||
| ) |
Add or delete pattern in the sequence grid.
|
inlineoverridevirtual |
Can elements be dragged as well as being selected? This may change to suit widget's current state.
Reimplemented from SelectionWidget< QPoint >.
| void cleanUp | ( | ) |
| void clearThePatternSequenceVector | ( | QString | filename | ) |
|
private |
|
slot |
Copy a selection of cells to an XML representation in the clipboard.
| void createBackground | ( | ) |
|
slot |
| void deletePattern | ( | int | nColumn, |
| int | nRow | ||
| ) |
|
slot |
|
private |
|
private |
|
overridevirtual |
Find list of elements which intersect a rectangular area.
This may be a selection lasso rectangle, or a single point such as a mouse click. This should concern itself only with the geometry.
Implements SelectionWidget< QPoint >.
|
inlineoverrideprivatevirtual |
Reimplemented from SelectionWidget< QPoint >.
|
overrideprivatevirtual |
|
inline |
|
inline |
|
inline |
| int getGridWidth | ( | ) |
|
overridevirtual |
Calculate screen space occupied by keyboard cursor.
Implements SelectionWidget< QPoint >.
|
overrideprivatevirtual |
|
overrideprivatevirtual |
| void modifyPatternCellsAction | ( | std::vector< QPoint > & | addCells, |
| std::vector< QPoint > & | deleteCells, | ||
| std::vector< QPoint > & | selectCells | ||
| ) |
Modify many pattern cells at once, for use in a single efficient undo/redo action.
Modify pattern cells by first deleting some, then adding some.
deleteCells and addCells may safely overlap
|
overridevirtual |
Implements SelectionWidget< QPoint >.
|
overridevirtual |
Implements SelectionWidget< QPoint >.
|
overridevirtual |
Implements SelectionWidget< QPoint >.
|
overridevirtual |
Implements SelectionWidget< QPoint >.
|
overrideprivatevirtual |
|
overrideprivatevirtual |
|
overrideprivatevirtual |
|
private |
Quantise the selection move offset to the sequence grid.
|
overrideprivatevirtual |
|
slot |
|
slot |
|
overridevirtual |
Implements SelectionWidget< QPoint >.
|
slot |
| void setGridWidth | ( | uint | width | ) |
|
private |
|
inlineoverrideprivatevirtual |
Reimplemented from SelectionWidget< QPoint >.
|
private |
| void updateEditorandSetTrue | ( | ) |
|
private |
|
virtual |
|
overridevirtual |
Selection or selection-related visual elements have changed, widget needs to be updated.
At a minimum, the widget's own update() method should be called.
Implements SelectionWidget< QPoint >.
|
inlineoverridevirtual |
Ensure that the Selection contains only valid elements.
Implements SelectionWidget< QPoint >.
|
private |
|
private |
|
private |
In "draw" mode, whether we're activating pattern cells ("drawing") or deactivating ("erasing") is set at the start of the draw gesture.
|
private |
Pattern sequence or selection has changed, so must be redrawn.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Mouse position during selection gestures (used to detect crossing cell boundaries)
|
private |
|
private |
|
private |
|
private |