Skip to content

Commit

Permalink
Less invasive solution for StepRecorder
Browse files Browse the repository at this point in the history
  • Loading branch information
zonkmachine committed Jun 11, 2024
1 parent 083277e commit b043a2f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 8 deletions.
5 changes: 4 additions & 1 deletion data/themes/classic/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,16 @@ lmms--gui--PositionLine {
qproperty-lineColor: rgb(255, 255, 255);
}

lmms--gui--StepRecorder {
qproperty-curStepNoteColor: rgb(245, 3, 139);
}

lmms--gui--PianoRoll {
background-color: rgb(0, 0, 0);
qproperty-backgroundShade: rgba( 255, 255, 255, 10 );
qproperty-noteModeColor: rgb( 255, 255, 255 );
qproperty-noteColor: rgb( 119, 199, 216 );
qproperty-stepNoteColor: #9b1313;
qproperty-curStepNoteColor: rgb(245, 3, 139);
qproperty-noteTextColor: rgb( 255, 255, 255 );
qproperty-noteOpacity: 128;
qproperty-noteBorders: true; /* boolean property, set false to have borderless notes */
Expand Down
5 changes: 4 additions & 1 deletion data/themes/default/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,16 @@ lmms--gui--PositionLine {
qproperty-lineColor: rgb(255, 255, 255);
}

lmms--gui--StepRecorder {
qproperty-curStepNoteColor: rgb(245, 3, 139);
}

lmms--gui--PianoRoll {
background-color: #141616;
qproperty-backgroundShade: rgba(255, 255, 255, 10);
qproperty-noteModeColor: #0bd556;
qproperty-noteColor: #0bd556;
qproperty-stepNoteColor: #9b1313;
qproperty-curStepNoteColor: rgb(245, 3, 139);
qproperty-noteTextColor: #ffffff;
qproperty-noteOpacity: 165;
qproperty-noteBorders: false; /* boolean property, set false to have borderless notes */
Expand Down
2 changes: 0 additions & 2 deletions include/PianoRoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ class PianoRoll : public QWidget
Q_PROPERTY(QColor noteModeColor MEMBER m_noteModeColor)
Q_PROPERTY(QColor noteColor MEMBER m_noteColor)
Q_PROPERTY(QColor stepNoteColor MEMBER m_stepNoteColor)
Q_PROPERTY(QColor curStepNoteColor MEMBER m_curStepNoteColor)
Q_PROPERTY(QColor ghostNoteColor MEMBER m_ghostNoteColor)
Q_PROPERTY(QColor noteTextColor MEMBER m_noteTextColor)
Q_PROPERTY(QColor ghostNoteTextColor MEMBER m_ghostNoteTextColor)
Expand Down Expand Up @@ -470,7 +469,6 @@ protected slots:
QColor m_noteModeColor;
QColor m_noteColor;
QColor m_stepNoteColor;
QColor m_curStepNoteColor;
QColor m_noteTextColor;
QColor m_ghostNoteColor;
QColor m_ghostNoteTextColor;
Expand Down
7 changes: 7 additions & 0 deletions include/StepRecorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class StepRecorderWidget;
class StepRecorder : public QObject
{
Q_OBJECT
Q_PROPERTY(QColor curStepNoteColor MEMBER m_curStepNoteColor)

public:
StepRecorder(gui::PianoRoll& pianoRoll, gui::StepRecorderWidget& stepRecorderWidget);
Expand All @@ -66,6 +67,11 @@ class StepRecorder : public QObject
return m_isRecording;
}

QColor curStepNoteColor() const
{
return m_curStepNoteColor;
}

private slots:
void removeNotesReleasedForTooLong();

Expand Down Expand Up @@ -140,6 +146,7 @@ class StepRecorder : public QObject
std::vector<StepNote*> m_curStepNotes; // contains the current recorded step notes (i.e. while user still press the notes; before they are applied to the clip)

StepNote* findCurStepNote(const int key);
QColor m_curStepNoteColor;

bool m_isStepInProgress = false;
};
Expand Down
5 changes: 3 additions & 2 deletions src/core/StepRecorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ const int REMOVE_RELEASED_NOTE_TIME_THRESHOLD_MS = 70;
StepRecorder::StepRecorder(gui::PianoRoll& pianoRoll, gui::StepRecorderWidget& stepRecorderWidget):
m_pianoRoll(pianoRoll),
m_stepRecorderWidget(stepRecorderWidget),
m_midiClip(nullptr)
m_midiClip(nullptr),
m_curStepNoteColor(245, 3, 139)
{
m_stepRecorderWidget.hide();
}
Expand Down Expand Up @@ -378,4 +379,4 @@ StepRecorder::StepNote* StepRecorder::findCurStepNote(const int key)
return nullptr;
}

} // namespace lmms
} // namespace lmms
3 changes: 1 addition & 2 deletions src/gui/editors/PianoRoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ PianoRoll::PianoRoll() :
m_noteModeColor( 0, 0, 0 ),
m_noteColor( 0, 0, 0 ),
m_stepNoteColor(0, 0, 0),
m_curStepNoteColor(245, 3, 139),
m_noteTextColor(0, 0, 0),
m_ghostNoteColor( 0, 0, 0 ),
m_ghostNoteTextColor( 0, 0, 0 ),
Expand Down Expand Up @@ -3599,7 +3598,7 @@ void PianoRoll::paintEvent(QPaintEvent * pe )
// we've done and checked all, let's draw the note
drawNoteRect(
p, x + m_whiteKeyWidth, noteYPos(note->key()), note_width,
note, m_curStepNoteColor, m_noteTextColor, m_selectedNoteColor,
note, m_stepRecorder.curStepNoteColor(), m_noteTextColor, m_selectedNoteColor,
m_noteOpacity, m_noteBorders, drawNoteNames);
}
}
Expand Down

0 comments on commit b043a2f

Please sign in to comment.