Open up some gui elements to theming (#7314)

* Theming for current step note

* Theming for EnvelopeGraph

* Theming for LfoGraph

* curStepNoteColor - don't break old themes

* EnvelopeGraph - don't break old themes

* LfoGraph - don't break old themea

* currentStepNoteColor
This commit is contained in:
Oskar Wallgren
2024-11-30 14:54:45 +01:00
committed by GitHub
parent e311832ffb
commit 3562bbed3c
9 changed files with 67 additions and 19 deletions

View File

@@ -197,6 +197,9 @@ PianoRoll::PianoRoll() :
m_lineColor( 0, 0, 0 ),
m_noteModeColor( 0, 0, 0 ),
m_noteColor( 0, 0, 0 ),
m_stepNoteColor(0, 0, 0),
m_currentStepNoteColor(245, 3, 139),
m_noteTextColor(0, 0, 0),
m_ghostNoteColor( 0, 0, 0 ),
m_ghostNoteTextColor( 0, 0, 0 ),
m_barColor( 0, 0, 0 ),
@@ -3596,7 +3599,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_stepRecorder.curStepNoteColor(), m_noteTextColor, m_selectedNoteColor,
note, m_currentStepNoteColor, m_noteTextColor, m_selectedNoteColor,
m_noteOpacity, m_noteBorders, drawNoteNames);
}
}

View File

@@ -44,7 +44,11 @@ namespace gui
EnvelopeGraph::EnvelopeGraph(QWidget* parent) :
QWidget(parent),
ModelView(nullptr, this)
ModelView(nullptr, this),
m_noAmountColor(96, 91, 96),
m_fullAmountColor(0, 255, 128),
m_markerFillColor(153, 175, 255),
m_markerOutlineColor(0, 0, 0)
{
setMinimumSize(m_envGraph.size());
}
@@ -206,9 +210,7 @@ void EnvelopeGraph::paintEvent(QPaintEvent*)
// Compute the color of the lines based on the amount of the envelope
const float absAmount = std::abs(amount);
const QColor noAmountColor{96, 91, 96};
const QColor fullAmountColor{0, 255, 128};
const QColor lineColor{ColorHelper::interpolateInRgb(noAmountColor, fullAmountColor, absAmount)};
const QColor lineColor{ColorHelper::interpolateInRgb(m_noAmountColor, m_fullAmountColor, absAmount)};
// Determine the line width so that it scales with the widget
// Use the minimum value of the current width and height to compute it.
@@ -221,14 +223,11 @@ void EnvelopeGraph::paintEvent(QPaintEvent*)
p.drawPolyline(linePoly);
// Now draw all marker on top of the lines
const QColor markerFillColor{153, 175, 255};
const QColor markerOutlineColor{0, 0, 0};
QPen pen;
pen.setWidthF(lineWidth * 0.75);
pen.setBrush(markerOutlineColor);
pen.setBrush(m_markerOutlineColor);
p.setPen(pen);
p.setBrush(markerFillColor);
p.setBrush(m_markerFillColor);
// Compute the size of the circle we will draw based on the line width
const qreal baseRectSize = lineWidth * 3;

View File

@@ -44,7 +44,9 @@ namespace gui
LfoGraph::LfoGraph(QWidget* parent) :
QWidget(parent),
ModelView(nullptr, this)
ModelView(nullptr, this),
m_noAmountColor(96, 91, 96),
m_fullAmountColor(0, 255, 128)
{
setMinimumSize(m_lfoGraph.size());
}
@@ -143,9 +145,7 @@ void LfoGraph::paintEvent(QPaintEvent*)
// Compute the color of the lines based on the amount of the LFO
const float absAmount = std::abs(amount);
const QColor noAmountColor{96, 91, 96};
const QColor fullAmountColor{0, 255, 128};
const QColor lineColor{ColorHelper::interpolateInRgb(noAmountColor, fullAmountColor, absAmount)};
const QColor lineColor{ColorHelper::interpolateInRgb(m_noAmountColor, m_fullAmountColor, absAmount)};
p.setPen(QPen(lineColor, 1.5));