Skip to content

Commit

Permalink
fix #102011: Change the highlight color for the piano notes
Browse files Browse the repository at this point in the history
  • Loading branch information
lasconic committed Mar 24, 2016
1 parent 17158f6 commit c6ab148
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mscore/pianotools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
//=============================================================================

#include "pianotools.h"
#include "preferences.h"

namespace Ms {

Expand Down Expand Up @@ -287,8 +288,11 @@ void PianoKeyItem::paint(QPainter* p, const QStyleOptionGraphicsItem* /*o*/, QWi
{
p->setRenderHint(QPainter::Antialiasing, true);
p->setPen(QPen(Qt::black, .8));
if (_pressed)
p->setBrush(QColor(255, 255, 128));
if (_pressed) {
QColor c(preferences.pianoHlColor);
c.setAlpha(180);
p->setBrush(c);
}
else
p->setBrush(type >= 7 ? Qt::black : Qt::white);
p->drawPath(path());
Expand Down
3 changes: 3 additions & 0 deletions mscore/preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ void Preferences::init()
bgWallpaper = QString();
fgWallpaper = ":/data/paper5.png";
fgColor.setNamedColor("#f9f9f9");
pianoHlColor.setNamedColor("#1259d0");
iconHeight = 24;
iconWidth = 28;

Expand Down Expand Up @@ -221,6 +222,7 @@ void Preferences::write()
s.setValue("selectColor4", MScore::selectColor[3]);
s.setValue("dropColor", MScore::dropColor);
s.setValue("defaultColor", MScore::defaultColor);
s.setValue("pianoHlColor", pianoHlColor);
s.setValue("enableMidiInput", enableMidiInput);
s.setValue("playNotes", playNotes);
s.setValue("playChordOnAddNote", playChordOnAddNote);
Expand Down Expand Up @@ -372,6 +374,7 @@ void Preferences::read()

MScore::defaultColor = s.value("defaultColor", MScore::defaultColor).value<QColor>();
MScore::dropColor = s.value("dropColor", MScore::dropColor).value<QColor>();
pianoHlColor = s.value("pianoHlColor", pianoHlColor).value<QColor>();

enableMidiInput = s.value("enableMidiInput", enableMidiInput).toBool();
playNotes = s.value("playNotes", playNotes).toBool();
Expand Down
1 change: 1 addition & 0 deletions mscore/preferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ struct Preferences {
QColor fgColor;
int iconHeight, iconWidth;
QColor dropColor;
QColor pianoHlColor;
bool enableMidiInput;
bool playNotes; // play notes on click
bool playChordOnAddNote;
Expand Down

0 comments on commit c6ab148

Please sign in to comment.