Feature: PianoRoll Knife (#5845)
* Initial PianoRoll razor feature * Restore PianoRoll edit mode after focusOut and in razor mode. * Show changes directly after cut. * Fix hanging note after adjusting vol/pan with razor action. * Extract the split action to a separate method This PR addresses some suggestions from a review, the most important ones being: - Extracting the note split action to a separate method, called Pattern::splitNotes - Removing getMouseTickPos method - Adding a variable that holds the current razor position and a method to update it (quantizing if CTRL is not pressed) - Using [this] to capture "this" on the lambda function instead of [=], since the latter doesn't work as intended from C++20 forward - Fixing some code style and adding comments * Removes an extra call to noteUnderMouse By removing "&& noteUnderMouse()" from the mousePressEvent conditional, we avoid an extra call to noteUnderMouse. The only difference in the behavior of the tool is that now clicking on a place that doesn't have a note will exit Razor mode. * Style change suggested by @russiankumar * Cancel razor action on SHIFT release. * Make razor cut-line (color) themable. * Add razor cut-line color to classic theme style.css * Rename razor to knife. * Change pixmap from razor to knife (from https://github.com/LMMS/lmms/pull/5524) * Remove SHIFT behavior. * Change knife shortcut to SHIFT+K Co-authored-by: CYBERDEViL <cyberdevil@notabug.org> Co-authored-by: Ian Caio <iancaio_dev@hotmail.com>
This commit is contained in:
@@ -76,6 +76,9 @@ public:
|
||||
Note * addStepNote( int step );
|
||||
void setStep( int step, bool enabled );
|
||||
|
||||
// Split the list of notes on the given position
|
||||
void splitNotes(NoteVector notes, TimePos pos);
|
||||
|
||||
// pattern-type stuff
|
||||
inline PatternTypes type() const
|
||||
{
|
||||
|
||||
@@ -70,6 +70,7 @@ class PianoRoll : public QWidget
|
||||
Q_PROPERTY(QColor textColorLight MEMBER m_textColorLight)
|
||||
Q_PROPERTY(QColor textShadow MEMBER m_textShadow)
|
||||
Q_PROPERTY(QColor markedSemitoneColor MEMBER m_markedSemitoneColor)
|
||||
Q_PROPERTY(QColor knifeCutLine MEMBER m_knifeCutLineColor)
|
||||
Q_PROPERTY(int noteOpacity MEMBER m_noteOpacity)
|
||||
Q_PROPERTY(bool noteBorders MEMBER m_noteBorders)
|
||||
Q_PROPERTY(int ghostNoteOpacity MEMBER m_ghostNoteOpacity)
|
||||
@@ -95,6 +96,7 @@ public:
|
||||
ModeErase,
|
||||
ModeSelect,
|
||||
ModeEditDetuning,
|
||||
ModeEditKnife
|
||||
};
|
||||
|
||||
/*! \brief Resets settings to default when e.g. creating a new project */
|
||||
@@ -226,7 +228,8 @@ private:
|
||||
ActionResizeNote,
|
||||
ActionSelectNotes,
|
||||
ActionChangeNoteProperty,
|
||||
ActionResizeNoteEditArea
|
||||
ActionResizeNoteEditArea,
|
||||
ActionKnife
|
||||
};
|
||||
|
||||
enum NoteEditMode
|
||||
@@ -282,6 +285,9 @@ private:
|
||||
void playChordNotes(int key, int velocity=-1);
|
||||
void pauseChordNotes(int key);
|
||||
|
||||
void setKnifeAction();
|
||||
void cancelKnifeAction();
|
||||
|
||||
void updateScrollbars();
|
||||
void updatePositionLineHeight();
|
||||
|
||||
@@ -304,6 +310,7 @@ private:
|
||||
static QPixmap * s_toolSelect;
|
||||
static QPixmap * s_toolMove;
|
||||
static QPixmap * s_toolOpen;
|
||||
static QPixmap* s_toolKnife;
|
||||
|
||||
static PianoRollKeyTypes prKeyOrder[];
|
||||
|
||||
@@ -389,6 +396,7 @@ private:
|
||||
|
||||
EditModes m_editMode;
|
||||
EditModes m_ctrlMode; // mode they were in before they hit ctrl
|
||||
EditModes m_knifeMode; // mode they where in before entering knife mode
|
||||
|
||||
bool m_mouseDownRight; //true if right click is being held down
|
||||
|
||||
@@ -408,6 +416,10 @@ private:
|
||||
// did we start a mouseclick with shift pressed
|
||||
bool m_startedWithShift;
|
||||
|
||||
// Variable that holds the position in ticks for the knife action
|
||||
int m_knifeTickPos;
|
||||
void updateKnifePos(QMouseEvent* me);
|
||||
|
||||
friend class PianoRollWindow;
|
||||
|
||||
StepRecorderWidget m_stepRecorderWidget;
|
||||
@@ -428,6 +440,7 @@ private:
|
||||
QColor m_textColorLight;
|
||||
QColor m_textShadow;
|
||||
QColor m_markedSemitoneColor;
|
||||
QColor m_knifeCutLineColor;
|
||||
int m_noteOpacity;
|
||||
int m_ghostNoteOpacity;
|
||||
bool m_noteBorders;
|
||||
|
||||
Reference in New Issue
Block a user