Refactor color definitions to make them easier exchangable
This commit is contained in:
parent
36b970ebcb
commit
35c01b9382
|
@ -45,3 +45,5 @@ int Cfg::tickRate;
|
|||
|
||||
const int Cfg::m_playZoneEarly = 25; // Was 25
|
||||
const int Cfg::m_playZoneLate = 25;
|
||||
|
||||
ColorTheme Cfg::m_colorTheme = ColorTheme();
|
||||
|
|
41
src/Cfg.h
41
src/Cfg.h
|
@ -74,6 +74,28 @@ public:
|
|||
float red, green, blue;
|
||||
};
|
||||
|
||||
struct ColorTheme
|
||||
{
|
||||
constexpr ColorTheme() = default;
|
||||
|
||||
CColor menuColor = CColor(0.1, 0.6, 0.6);
|
||||
CColor menuSelectedColor = CColor(0.7, 0.7, 0.1);
|
||||
|
||||
CColor staveColor = CColor(0.1, 0.7, 0.1); // green
|
||||
CColor staveColorDim = CColor(0.15, 0.40, 0.15); // grey
|
||||
CColor noteColor = CColor(0.1, 0.9, 0.1); // green
|
||||
CColor noteColorDim = CColor(0.25, 0.45, 0.25); // green
|
||||
CColor playedGoodColor = CColor(0.5, 0.6, 1.0); // purple
|
||||
CColor playedBadColor = CColor(0.8, 0.3, 0.8); // orange
|
||||
CColor playedStoppedColor = CColor(1.0, 0.8, 0.0); // bright orange
|
||||
CColor backgroundColor = CColor(0.0, 0.0, 0.0); // black
|
||||
CColor barMarkerColor = CColor(0.3, 0.25, 0.25); // grey
|
||||
CColor beatMarkerColor = CColor(0.25, 0.2, 0.2); // grey
|
||||
CColor pianoGoodColor = playedGoodColor;
|
||||
CColor pianoBadColor = CColor(1.0, 0.0, 0.0);
|
||||
CColor noteNameColor = CColor(1.0, 1.0, 1.0);
|
||||
};
|
||||
|
||||
/*!
|
||||
* @brief Contains all the configuration Information.
|
||||
*/
|
||||
|
@ -97,23 +119,7 @@ public:
|
|||
static int chordNoteGap() {return 10;} // all notes in a cord must be spaced less than this a gap
|
||||
static int chordMaxLength() {return 20;} // the max time between the start and end of a cord
|
||||
|
||||
static CColor menuColor() {return CColor(0.1, 0.6, 0.6);}
|
||||
static CColor menuSelectedColor(){return CColor(0.7, 0.7, 0.1);}
|
||||
|
||||
static CColor staveColor() {return CColor(0.1, 0.7, 0.1);} // green
|
||||
static CColor staveColorDim() {return CColor(0.15, 0.40, 0.15);} // grey
|
||||
static CColor noteColor() {return CColor(0.1, 0.9, 0.1);} // green
|
||||
static CColor noteColorDim() {return CColor(0.25, 0.45, 0.25);} // green
|
||||
//static CColor playedGoodColor() {return CColor(0.6, 0.6, 1.0);} // grey
|
||||
static CColor playedGoodColor() {return CColor(0.5, 0.6, 1.0);} // purple 0.6, 0.6, 1.0
|
||||
static CColor playedBadColor() {return CColor(0.8, 0.3, 0.8);} // orange 0.7, 0.0, 0.0
|
||||
static CColor playedStoppedColor() {return CColor(1.0, 0.8, 0.0);} // bright orange
|
||||
static CColor backgroundColor() {return CColor(0.0, 0.0, 0.0);} // black
|
||||
static CColor barMarkerColor() {return CColor(0.3, 0.25, 0.25);} // grey
|
||||
static CColor beatMarkerColor() {return CColor(0.25, 0.2, 0.2);} // grey
|
||||
static CColor pianoGoodColor() {return playedGoodColor();}
|
||||
static CColor pianoBadColor() {return CColor(1.0, 0.0, 0.0);}
|
||||
static CColor noteNameColor() {return CColor(1.0, 1.0, 1.0);}
|
||||
static const ColorTheme &colorTheme() { return m_colorTheme; }
|
||||
|
||||
static void setDefaults() {
|
||||
#ifdef _WIN32
|
||||
|
@ -156,6 +162,7 @@ private:
|
|||
static int m_appX, m_appY, m_appWidth, m_appHeight;
|
||||
static const int m_playZoneEarly;
|
||||
static const int m_playZoneLate;
|
||||
static ColorTheme m_colorTheme;
|
||||
};
|
||||
|
||||
#endif //__CFG_H__
|
||||
|
|
|
@ -647,7 +647,7 @@ void CConductor::pianistInput(CMidiEvent inputNote)
|
|||
else
|
||||
pianistTiming = NOT_USED;
|
||||
m_scoreWin->setPlayedNoteColor(inputNote.note(),
|
||||
(!m_followPlayingTimeOut)? Cfg::playedGoodColor():Cfg::playedBadColor(),
|
||||
(!m_followPlayingTimeOut)? Cfg::colorTheme().playedGoodColor : Cfg::colorTheme().playedBadColor,
|
||||
m_chordDeltaTime, pianistTiming);
|
||||
|
||||
if (validatePianistChord() == true)
|
||||
|
@ -688,7 +688,7 @@ void CConductor::pianistInput(CMidiEvent inputNote)
|
|||
else // Hitting bad notes within the zone (so register them)
|
||||
{
|
||||
// Register the wrong note in the ratings calculation (if not as missed notes, I don't believe it's factored in)
|
||||
missedNotesColor(Cfg::pianoBadColor());
|
||||
missedNotesColor(Cfg::colorTheme().pianoBadColor);
|
||||
m_rating.lateNotes(m_wantedChord.length() - m_goodPlayedNotes.length());
|
||||
setEventBits(EVENT_BITS_forceRatingRedraw);
|
||||
fetchNextChord(); // Skip through the wrong note and continue to the next
|
||||
|
@ -704,7 +704,7 @@ void CConductor::pianistInput(CMidiEvent inputNote)
|
|||
else
|
||||
pianistTiming = NOT_USED;
|
||||
m_scoreWin->setPlayedNoteColor(inputNote.note(),
|
||||
(!m_followPlayingTimeOut)? Cfg::playedGoodColor():Cfg::playedBadColor(),
|
||||
(!m_followPlayingTimeOut)? Cfg::colorTheme().playedGoodColor : Cfg::colorTheme().playedBadColor,
|
||||
m_chordDeltaTime, pianistTiming);
|
||||
|
||||
if (validatePianistChord() == true)
|
||||
|
@ -747,7 +747,7 @@ void CConductor::pianistInput(CMidiEvent inputNote)
|
|||
|
||||
if (hasNote)
|
||||
m_scoreWin->setPlayedNoteColor(inputNote.note(),
|
||||
(!m_followPlayingTimeOut)? Cfg::noteColor():Cfg::playedStoppedColor(),
|
||||
(!m_followPlayingTimeOut)? Cfg::colorTheme().noteColor:Cfg::colorTheme().playedStoppedColor,
|
||||
m_chordDeltaTime);
|
||||
|
||||
outputSavedNotesOff();
|
||||
|
@ -852,7 +852,7 @@ void CConductor::followPlaying()
|
|||
{
|
||||
if (m_chordDeltaTime > m_cfg_playZoneLate )
|
||||
{
|
||||
missedNotesColor(Cfg::playedStoppedColor());
|
||||
missedNotesColor(Cfg::colorTheme().playedStoppedColor);
|
||||
fetchNextChord();
|
||||
m_rating.lateNotes(m_wantedChord.length() - m_goodPlayedNotes.length());
|
||||
setEventBits( EVENT_BITS_forceRatingRedraw);
|
||||
|
@ -932,7 +932,7 @@ void CConductor::realTimeEngine(qint64 mSecTicks)
|
|||
m_rating.lateNotes(m_wantedChord.length() - m_goodPlayedNotes.length());
|
||||
setEventBits( EVENT_BITS_forceRatingRedraw);
|
||||
|
||||
missedNotesColor(Cfg::playedStoppedColor());
|
||||
missedNotesColor(Cfg::colorTheme().playedStoppedColor);
|
||||
findImminentNotesOff();
|
||||
// Don't keep any saved notes off if there are no notes down
|
||||
if (m_piano->pianistAllNotesDown() == 0)
|
||||
|
|
47
src/Draw.cpp
47
src/Draw.cpp
|
@ -93,9 +93,9 @@ void CDraw::drawStaveExtentsion(CSymbol symbol, float x, int noteWidth, bool pl
|
|||
whichPart_t hand = symbol.getStavePos().getHand();
|
||||
|
||||
if (playable)
|
||||
drColor(Cfg::staveColor());
|
||||
drColor(Cfg::colorTheme().staveColor);
|
||||
else
|
||||
drColor(Cfg::staveColorDim());
|
||||
drColor(Cfg::colorTheme().staveColorDim);
|
||||
|
||||
glLineWidth (Cfg::staveThickness());
|
||||
glBegin(GL_LINES);
|
||||
|
@ -135,7 +135,7 @@ void CDraw::drawNoteName(int midiNote, float x, float y, int type)
|
|||
|
||||
staveLookup_t item = CStavePos::midiNote2Name(midiNote);
|
||||
|
||||
drColor(Cfg::noteNameColor());
|
||||
drColor(Cfg::colorTheme().noteNameColor);
|
||||
|
||||
glLineWidth (1.0);
|
||||
|
||||
|
@ -365,7 +365,7 @@ void CDraw::checkAccidental(CSymbol symbol, float x, float y)
|
|||
|
||||
if (accidental != 0)
|
||||
{
|
||||
//drColor (Cfg::lineColor());
|
||||
//drColor (Cfg::colorTheme().lineColor);
|
||||
if (accidental == 1)
|
||||
drawSymbol(CSymbol(PB_SYMBOL_sharp, symbol.getStavePos()), x - xGap, y);
|
||||
else if (accidental == -1)
|
||||
|
@ -384,7 +384,7 @@ bool CDraw::drawNote(CSymbol* symbol, float x, float y, CSlot* slot, CColor colo
|
|||
//ppLogTrace("PB_SYMBOL_noteHead x %f y %f", x, y);
|
||||
if (!CChord::isNotePlayable(symbol->getNote(), 0))
|
||||
{
|
||||
color = Cfg::noteColorDim();
|
||||
color = Cfg::colorTheme().noteColorDim;
|
||||
playable = false;
|
||||
}
|
||||
drawStaveExtentsion(*symbol, x, 16, playable);
|
||||
|
@ -471,15 +471,16 @@ bool CDraw::drawNote(CSymbol* symbol, float x, float y, CSlot* slot, CColor colo
|
|||
|
||||
void CDraw::drawSymbol(CSymbol symbol, float x, float y, CSlot* slot)
|
||||
{
|
||||
const auto &colorTheme = Cfg::colorTheme();
|
||||
CColor color = symbol.getColor();
|
||||
bool playable = true;
|
||||
|
||||
if (m_displayHand != symbol.getHand() && m_displayHand != PB_PART_both)
|
||||
{
|
||||
if (color == Cfg::noteColor())
|
||||
color = Cfg::noteColorDim();
|
||||
if (color == Cfg::staveColor())
|
||||
color = Cfg::staveColorDim();
|
||||
if (color == colorTheme.noteColor)
|
||||
color = colorTheme.noteColorDim;
|
||||
if (color == colorTheme.staveColor)
|
||||
color = colorTheme.staveColorDim;
|
||||
playable = false;
|
||||
}
|
||||
|
||||
|
@ -597,7 +598,7 @@ void CDraw::drawSymbol(CSymbol symbol, float x, float y, CSlot* slot)
|
|||
//ppLogTrace("PB_SYMBOL_noteHead x %f y %f", x, y);
|
||||
if (!CChord::isNotePlayable(symbol.getNote(), 0))
|
||||
{
|
||||
color = Cfg::noteColorDim();
|
||||
color = Cfg::colorTheme().noteColorDim;
|
||||
playable = false;
|
||||
}
|
||||
drawStaveExtentsion(symbol, x, 16, playable);
|
||||
|
@ -605,7 +606,7 @@ void CDraw::drawSymbol(CSymbol symbol, float x, float y, CSlot* slot)
|
|||
// See forum post at link below from PianoBooster forum user Kory.
|
||||
// http://piano-booster.2625608.n2.nabble.com/Pianobooster-port-to-arm-linux-or-Android-td7572459.html
|
||||
// http://piano-booster.2625608.n2.nabble.com/Pianobooster-port-to-arm-linux-or-Android-td7572459.html#a7572676
|
||||
if (m_settings->coloredNotes() && color == Cfg::noteColor()) //KORY added
|
||||
if (m_settings->coloredNotes() && color == colorTheme.noteColor) //KORY added
|
||||
{
|
||||
int note = symbol.getNote() % MIDI_OCTAVE;
|
||||
switch (note)
|
||||
|
@ -681,7 +682,7 @@ void CDraw::drawSymbol(CSymbol symbol, float x, float y, CSlot* slot)
|
|||
|
||||
case PB_SYMBOL_drum:
|
||||
if (!CChord::isNotePlayable(symbol.getNote(), 0))
|
||||
color = Cfg::noteColorDim();
|
||||
color = colorTheme.noteColorDim;
|
||||
drColor(color);
|
||||
glLineWidth (3.0f);
|
||||
glBegin(GL_LINES);
|
||||
|
@ -744,16 +745,16 @@ void CDraw::drawSymbol(CSymbol symbol, float x, float y, CSlot* slot)
|
|||
case PB_SYMBOL_barLine:
|
||||
x += BEAT_MARKER_OFFSET * HORIZONTAL_SPACING_FACTOR; // the beat markers where entered early so now move them correctly
|
||||
glLineWidth (4.0f);
|
||||
drColor ((m_displayHand == PB_PART_left) ? Cfg::staveColorDim() : Cfg::staveColor());
|
||||
drColor ((m_displayHand == PB_PART_left) ? colorTheme.staveColorDim : colorTheme.staveColor);
|
||||
oneLine(x, CStavePos(PB_PART_right, 4).getPosYRelative(), x, CStavePos(PB_PART_right, -4).getPosYRelative());
|
||||
drColor ((m_displayHand == PB_PART_right) ? Cfg::staveColorDim() : Cfg::staveColor());
|
||||
drColor ((m_displayHand == PB_PART_right) ? colorTheme.staveColorDim : colorTheme.staveColor);
|
||||
oneLine(x, CStavePos(PB_PART_left, 4).getPosYRelative(), x, CStavePos(PB_PART_left, -4).getPosYRelative());
|
||||
break;
|
||||
|
||||
case PB_SYMBOL_barMarker:
|
||||
x += BEAT_MARKER_OFFSET * HORIZONTAL_SPACING_FACTOR; // the beat markers where entered early so now move them correctly
|
||||
glLineWidth (5.0f);
|
||||
drColor(Cfg::barMarkerColor());
|
||||
drColor(colorTheme.barMarkerColor);
|
||||
oneLine(x, CStavePos(PB_PART_right, m_beatMarkerHeight).getPosYRelative(), x, CStavePos(PB_PART_left, -m_beatMarkerHeight).getPosYRelative());
|
||||
glDisable (GL_LINE_STIPPLE);
|
||||
break;
|
||||
|
@ -761,7 +762,7 @@ void CDraw::drawSymbol(CSymbol symbol, float x, float y, CSlot* slot)
|
|||
case PB_SYMBOL_beatMarker:
|
||||
x += BEAT_MARKER_OFFSET * HORIZONTAL_SPACING_FACTOR; // the beat markers where entered early so now move them correctly
|
||||
glLineWidth (4.0);
|
||||
drColor(Cfg::beatMarkerColor());
|
||||
drColor(colorTheme.beatMarkerColor);
|
||||
oneLine(x, CStavePos(PB_PART_right, m_beatMarkerHeight).getPosYRelative(), x, CStavePos(PB_PART_left, -m_beatMarkerHeight).getPosYRelative());
|
||||
glDisable (GL_LINE_STIPPLE);
|
||||
break;
|
||||
|
@ -840,7 +841,8 @@ void CDraw::drawStaves(float startX, float endX)
|
|||
glLineWidth (Cfg::staveThickness());
|
||||
|
||||
/* select color for all lines */
|
||||
drColor ((m_displayHand != PB_PART_left) ? Cfg::staveColor() : Cfg::staveColorDim());
|
||||
const auto &colorTheme = Cfg::colorTheme();
|
||||
drColor ((m_displayHand != PB_PART_left) ? colorTheme.staveColor : colorTheme.staveColorDim);
|
||||
glBegin(GL_LINES);
|
||||
|
||||
for (i = -4; i <= 4; i+=2 )
|
||||
|
@ -849,7 +851,7 @@ void CDraw::drawStaves(float startX, float endX)
|
|||
glVertex2f (startX, pos.getPosY());
|
||||
glVertex2f (endX, pos.getPosY());
|
||||
}
|
||||
drColor ((m_displayHand != PB_PART_right) ? Cfg::staveColor() : Cfg::staveColorDim());
|
||||
drColor ((m_displayHand != PB_PART_right) ? colorTheme.staveColor : colorTheme.staveColorDim);
|
||||
for (i = -4; i <= 4; i+=2 )
|
||||
{
|
||||
CStavePos pos = CStavePos(PB_PART_left, i);
|
||||
|
@ -866,6 +868,7 @@ void CDraw::drawKeySignature(int key)
|
|||
static constexpr int flatLookUpRight[] = { 0, 3,-1, 2,-2, 1,-3};
|
||||
static constexpr int flatLookUpLeft[] = {-2, 1,-3, 0,-4,-1,-5};
|
||||
static constexpr float gapX = 11.0f;
|
||||
const auto &colorTheme = Cfg::colorTheme();
|
||||
CStavePos pos;
|
||||
|
||||
if (key == NOT_USED)
|
||||
|
@ -878,13 +881,13 @@ void CDraw::drawKeySignature(int key)
|
|||
{
|
||||
if (i < arraySize(sharpLookUpRight))
|
||||
{
|
||||
drColor ((m_displayHand != PB_PART_left) ? Cfg::noteColor() : Cfg::noteColorDim());
|
||||
drColor ((m_displayHand != PB_PART_left) ? colorTheme.noteColor : colorTheme.noteColorDim);
|
||||
pos = CStavePos(PB_PART_right, sharpLookUpRight[i]);
|
||||
drawSymbol( CSymbol(PB_SYMBOL_sharp, pos), Cfg::keySignatureX() + gapX * static_cast<float>(i) );
|
||||
}
|
||||
if (i < arraySize(sharpLookUpLeft))
|
||||
{
|
||||
drColor ((m_displayHand != PB_PART_right) ? Cfg::noteColor() : Cfg::noteColorDim());
|
||||
drColor ((m_displayHand != PB_PART_right) ? colorTheme.noteColor : colorTheme.noteColorDim);
|
||||
pos = CStavePos(PB_PART_left, sharpLookUpLeft[i]);
|
||||
drawSymbol( CSymbol(PB_SYMBOL_sharp, pos), Cfg::keySignatureX() + gapX * static_cast<float>(i) );
|
||||
}
|
||||
|
@ -894,13 +897,13 @@ void CDraw::drawKeySignature(int key)
|
|||
{
|
||||
if (i < arraySize(flatLookUpRight))
|
||||
{
|
||||
drColor ((m_displayHand != PB_PART_left) ? Cfg::noteColor() : Cfg::noteColorDim());
|
||||
drColor ((m_displayHand != PB_PART_left) ? colorTheme.noteColor : colorTheme.noteColorDim);
|
||||
pos = CStavePos(PB_PART_right, flatLookUpRight[i]);
|
||||
drawSymbol( CSymbol(PB_SYMBOL_flat, pos), Cfg::keySignatureX() + gapX * static_cast<float>(i) );
|
||||
}
|
||||
if (i < arraySize(flatLookUpLeft))
|
||||
{
|
||||
drColor ((m_displayHand != PB_PART_right) ? Cfg::noteColor() : Cfg::noteColorDim());
|
||||
drColor ((m_displayHand != PB_PART_right) ? colorTheme.noteColor : colorTheme.noteColorDim);
|
||||
pos = CStavePos(PB_PART_left, flatLookUpLeft[i]);
|
||||
drawSymbol( CSymbol(PB_SYMBOL_flat, pos), Cfg::keySignatureX() + gapX * static_cast<float>(i) );
|
||||
}
|
||||
|
|
|
@ -153,14 +153,14 @@ void CGLView::drawTimeSignature()
|
|||
|
||||
x = Cfg::timeSignatureX();
|
||||
|
||||
CDraw::drColor ((CDraw::getDisplayHand() != PB_PART_left) ? Cfg::noteColor() : Cfg::noteColorDim());
|
||||
CDraw::drColor ((CDraw::getDisplayHand() != PB_PART_left) ? Cfg::colorTheme().noteColor : Cfg::colorTheme().noteColorDim);
|
||||
|
||||
y = CStavePos(PB_PART_right, 0).getPosY() + 5;
|
||||
renderText(x,y, 0, bufferTop, m_timeSigFont);
|
||||
y = CStavePos(PB_PART_right, -3).getPosY() - 2;
|
||||
renderText(x,y, 0, bufferBottom, m_timeSigFont);
|
||||
|
||||
CDraw::drColor ((CDraw::getDisplayHand() != PB_PART_right) ? Cfg::noteColor() : Cfg::noteColorDim());
|
||||
CDraw::drColor ((CDraw::getDisplayHand() != PB_PART_right) ? Cfg::colorTheme().noteColor : Cfg::colorTheme().noteColorDim);
|
||||
|
||||
y = CStavePos(PB_PART_left, 0).getPosY() + 5;
|
||||
renderText(x,y, 0, bufferTop, m_timeSigFont);
|
||||
|
@ -191,7 +191,7 @@ void CGLView::drawAccurracyBar()
|
|||
color = m_rating->getAccuracyColor();
|
||||
CDraw::drColor (color);
|
||||
glRectf(x, y - lineWidth, x + width * accuracy, y + lineWidth);
|
||||
CDraw::drColor (Cfg::backgroundColor());
|
||||
CDraw::drColor (Cfg::colorTheme().backgroundColor);
|
||||
glRectf(x + width * accuracy, y - lineWidth, x + width, y + lineWidth);
|
||||
|
||||
glLineWidth (1);
|
||||
|
@ -260,8 +260,8 @@ void CGLView::drawBarNumber()
|
|||
const auto y = static_cast<float>(Cfg::getAppHeight() - m_titleHeight - 34);
|
||||
const auto x = static_cast<float>(TEXT_LEFT_MARGIN);
|
||||
|
||||
//CDraw::drColor (Cfg::backgroundColor());
|
||||
//CDraw::drColor (Cfg::noteColorDim());
|
||||
//CDraw::drColor (Cfg::colorTheme().backgroundColor);
|
||||
//CDraw::drColor (Cfg::colorTheme().noteColorDim);
|
||||
//glRectf(x+30+10, y-2, x + 80, y + 16);
|
||||
glColor3f(1.0f,1.0f,1.0f);
|
||||
renderText(x, y, 0, tr("Bar:") + " " + QString::number(m_song->getBarNumber()), m_timeRatingFont);
|
||||
|
@ -325,7 +325,7 @@ void CGLView::mouseMoveEvent(QMouseEvent *event)
|
|||
|
||||
void CGLView::initializeGL()
|
||||
{
|
||||
CColor color = Cfg::backgroundColor();
|
||||
CColor color = Cfg::colorTheme().backgroundColor;
|
||||
glClearColor (color.red, color.green, color.blue, 0.0);
|
||||
glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
|
||||
glShadeModel (GL_FLAT);
|
||||
|
|
|
@ -282,7 +282,7 @@ void CNotation::findNoteSlots()
|
|||
else
|
||||
symbolType = PB_SYMBOL_noteHead;
|
||||
CSymbol symbol(symbolType, hand, midi.note());
|
||||
symbol.setColor(Cfg::noteColor());
|
||||
symbol.setColor(Cfg::colorTheme().noteColor);
|
||||
symbol.setMidiDuration(midi.getDuration());
|
||||
|
||||
// check if this note has occurred in this bar before
|
||||
|
|
|
@ -282,12 +282,13 @@ void CPiano::drawPianoInput()
|
|||
{
|
||||
bool showNoteName = m_settings->showNoteNames();
|
||||
int lineLength = (showNoteName) ? PIANO_LINE_LENGTH_SHORT : PIANO_LINE_LENGTH_LONG;
|
||||
const auto &colorTheme = Cfg::colorTheme();
|
||||
|
||||
if (m_goodChord.length() > 0)
|
||||
drawPianoInputLines(&m_goodChord, Cfg::pianoGoodColor(), lineLength);
|
||||
drawPianoInputLines(&m_goodChord, colorTheme.pianoGoodColor, lineLength);
|
||||
|
||||
if (m_badChord.length() > 0)
|
||||
drawPianoInputLines(&m_badChord, Cfg::pianoBadColor(), lineLength);
|
||||
drawPianoInputLines(&m_badChord, colorTheme.pianoBadColor, lineLength);
|
||||
|
||||
if (showNoteName)
|
||||
drawPianoInputNoteNames();
|
||||
|
|
|
@ -70,7 +70,7 @@ void CScore::drawScroll(bool refresh)
|
|||
{
|
||||
float topY = CStavePos(PB_PART_right, MAX_STAVE_INDEX).getPosY();
|
||||
float bottomY = CStavePos(PB_PART_left, MIN_STAVE_INDEX).getPosY();
|
||||
drColor (Cfg::backgroundColor());
|
||||
drColor (Cfg::colorTheme().backgroundColor);
|
||||
glRectf(Cfg::scrollStartX(), topY, static_cast<float>(Cfg::getAppWidth()), bottomY);
|
||||
}
|
||||
|
||||
|
@ -133,8 +133,8 @@ void CScore::drawPianoKeyboard(){
|
|||
float xKeySize = this->xKeySize / 1.5f;
|
||||
|
||||
CDraw::drColor (CColor(0.0, 0.0, 0.0));
|
||||
if(state[k]==1) CDraw::drColor(stopped ? Cfg::playedStoppedColor() : Cfg::noteColor());
|
||||
if(state[k]==2) CDraw::drColor(Cfg::playedBadColor());
|
||||
if(state[k]==1) CDraw::drColor(stopped ? Cfg::colorTheme().playedStoppedColor : Cfg::colorTheme().noteColor);
|
||||
if(state[k]==2) CDraw::drColor(Cfg::colorTheme().playedBadColor);
|
||||
glBegin(GL_QUADS);
|
||||
glVertex2f(0, yBlackSize);
|
||||
glVertex2f(xKeySize, yBlackSize);
|
||||
|
@ -152,8 +152,8 @@ void CScore::drawPianoKeyboard(){
|
|||
glTranslatef(Cfg::staveStartX() + xPlaceSize * static_cast<float>(i++), yStart, 0.0f);
|
||||
|
||||
CDraw::drColor (CColor(1.0, 1.0, 1.0));
|
||||
if(state[k]==1) CDraw::drColor(stopped ? Cfg::playedStoppedColor() : Cfg::noteColor());
|
||||
if(state[k]==2) CDraw::drColor(Cfg::playedBadColor());
|
||||
if(state[k]==1) CDraw::drColor(stopped ? Cfg::colorTheme().playedStoppedColor : Cfg::colorTheme().noteColor);
|
||||
if(state[k]==2) CDraw::drColor(Cfg::colorTheme().playedBadColor);
|
||||
glBegin(GL_QUADS);
|
||||
glVertex2f(0, ySize);
|
||||
glVertex2f(xKeySize, ySize);
|
||||
|
@ -228,7 +228,7 @@ void CScore::drawScore()
|
|||
m_scoreDisplayListId = glGenLists (1);
|
||||
|
||||
glNewList (m_scoreDisplayListId, GL_COMPILE_AND_EXECUTE);
|
||||
drColor (Cfg::staveColor());
|
||||
drColor (Cfg::colorTheme().staveColor);
|
||||
|
||||
drawSymbol(CSymbol(PB_SYMBOL_gClef, CStavePos(PB_PART_right, -1)), Cfg::clefX()); // The Treble Clef
|
||||
drawSymbol(CSymbol(PB_SYMBOL_fClef, CStavePos(PB_PART_left, 1)), Cfg::clefX());
|
||||
|
|
|
@ -207,7 +207,7 @@ bool CScroll::validPianistChord(int index)
|
|||
int CScroll::findWantedChord(int note, CColor color, qint64 wantedDelta)
|
||||
{
|
||||
Q_UNUSED(note)
|
||||
if (color == Cfg::playedBadColor()) // fixme should be an enum
|
||||
if (color == Cfg::colorTheme().playedBadColor) // fixme should be an enum
|
||||
return m_wantedIndex;
|
||||
{
|
||||
while ( m_wantedIndex + 1 < m_scrollQueue->length())
|
||||
|
@ -254,6 +254,7 @@ void CScroll::refresh()
|
|||
bool CScroll::getKeyboardInfo(int *notes)
|
||||
{
|
||||
int stoppedScrollIdx = -1;
|
||||
const auto &colorTheme = Cfg::colorTheme();
|
||||
for(int i=0; i<m_scrollQueue->length(); ++i) {
|
||||
CSlotDisplayList &info = *m_scrollQueue->indexPtr(i);
|
||||
if(m_show == false || info.m_displayListId == 0) continue;
|
||||
|
@ -261,7 +262,7 @@ bool CScroll::getKeyboardInfo(int *notes)
|
|||
CSlot* slot = &info;
|
||||
for(int j=0; j<slot->length(); ++j) {
|
||||
if(slot->getSymbol(j).getType() < PB_SYMBOL_noteHead) continue;
|
||||
if(slot->getSymbol(j).getColor() == Cfg::playedStoppedColor()) {
|
||||
if(slot->getSymbol(j).getColor() == colorTheme.playedStoppedColor) {
|
||||
stoppedScrollIdx = i;
|
||||
break;
|
||||
}
|
||||
|
@ -276,7 +277,7 @@ bool CScroll::getKeyboardInfo(int *notes)
|
|||
CSlot* slot = &info;
|
||||
for(int j=0; j<slot->length(); ++j) {
|
||||
if(slot->getSymbol(j).getType() < PB_SYMBOL_noteHead) continue;
|
||||
slot->getSymbolPtr(j)->setColor(Cfg::playedGoodColor());
|
||||
slot->getSymbolPtr(j)->setColor(colorTheme.playedGoodColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -291,10 +292,10 @@ bool CScroll::getKeyboardInfo(int *notes)
|
|||
for(int j=0; j<slot->length(); ++j) {
|
||||
if(slot->getSymbol(j).getType() < PB_SYMBOL_noteHead) continue;
|
||||
|
||||
if(slot->getSymbol(j).getColor() == Cfg::noteColor() ||
|
||||
slot->getSymbol(j).getColor() == Cfg::playedStoppedColor())
|
||||
if(slot->getSymbol(j).getColor() == colorTheme.noteColor ||
|
||||
slot->getSymbol(j).getColor() == colorTheme.playedStoppedColor)
|
||||
*(note++) = slot->getSymbol(j).getNote();
|
||||
if(slot->getSymbol(j).getColor() == Cfg::playedStoppedColor()) stopped = true;
|
||||
if(slot->getSymbol(j).getColor() == colorTheme.playedStoppedColor) stopped = true;
|
||||
}
|
||||
if(note != notes) return stopped;
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ public:
|
|||
init();
|
||||
}
|
||||
|
||||
CSymbol(musicalSymbol_t type, CStavePos stavePos, CColor color = Cfg::noteColor())
|
||||
CSymbol(musicalSymbol_t type, CStavePos stavePos, CColor color = Cfg::colorTheme().noteColor)
|
||||
{
|
||||
init();
|
||||
m_symbolType = type;
|
||||
|
|
Loading…
Reference in New Issue