Pianoroll: nudge/snap while dragging notes (#5848)
* pianoroll: nudge/snap while dragging notes combobox for switching behavior old behavior (nudge) is default * snap note start or note end to nearest grid line * fix member variable name * change default width of pianoroll * remove trailing white space * use mouse position instead of m_draggednote * Uses enum instead of text for GridMode selection To avoid problems with translations breaking the conditional, PianoRoll::changeSnapMode now uses the value of the ComboBox model, casted to the GridMode enum instead of the text. * Fixes last code style issues A few code style issues were left, those are fixed in this commit. * Removes forgotten comma on enum Since the last enum value was commented out, there's an unnecessary comma left that was removed. * Rewrites some of the grid logic Separates Nudge logic and Snap logic more explicitly. Avoids recalculation of mouse conversion to time line ticks. Disables shift resizing for Snap mode. Removes unnecessary range checks. Fixes bug with note key boundary checks (which is present in master). * Make noteOffset an int instead of TimePos Co-authored-by: Ian Caio <iancaio_dev@hotmail.com>
This commit is contained in:
@@ -214,6 +214,8 @@ protected slots:
|
||||
void fitNoteLengths(bool fill);
|
||||
void constrainNoteLengths(bool constrainMax);
|
||||
|
||||
void changeSnapMode();
|
||||
|
||||
|
||||
signals:
|
||||
void currentPatternChanged();
|
||||
@@ -258,6 +260,13 @@ private:
|
||||
PR_BLACK_KEY
|
||||
};
|
||||
|
||||
enum GridMode
|
||||
{
|
||||
gridNudge,
|
||||
gridSnap
|
||||
// gridFree
|
||||
};
|
||||
|
||||
PositionLine * m_positionLine;
|
||||
|
||||
QVector<QString> m_nemStr; // gui names of each edit mode
|
||||
@@ -302,7 +311,7 @@ private:
|
||||
int noteEditRight() const;
|
||||
int noteEditLeft() const;
|
||||
|
||||
void dragNotes( int x, int y, bool alt, bool shift, bool ctrl );
|
||||
void dragNotes(int x, int y, bool alt, bool shift, bool ctrl);
|
||||
|
||||
static const int cm_scrollAmtHoriz = 10;
|
||||
static const int cm_scrollAmtVert = 1;
|
||||
@@ -325,6 +334,7 @@ private:
|
||||
ComboBoxModel m_keyModel;
|
||||
ComboBoxModel m_scaleModel;
|
||||
ComboBoxModel m_chordModel;
|
||||
ComboBoxModel m_snapModel;
|
||||
|
||||
static const QVector<double> m_zoomLevels;
|
||||
static const QVector<double> m_zoomYLevels;
|
||||
@@ -347,6 +357,7 @@ private:
|
||||
Note * m_currentNote;
|
||||
Actions m_action;
|
||||
NoteEditMode m_noteEditMode;
|
||||
GridMode m_gridMode;
|
||||
|
||||
int m_selectStartTick;
|
||||
int m_selectedTick;
|
||||
@@ -528,6 +539,7 @@ private:
|
||||
ComboBox * m_keyComboBox;
|
||||
ComboBox * m_scaleComboBox;
|
||||
ComboBox * m_chordComboBox;
|
||||
ComboBox* m_snapComboBox;
|
||||
QPushButton * m_clearGhostButton;
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user