Skip to content

Commit

Permalink
fix #309192: Add advanced preference to remove letters from piano key…
Browse files Browse the repository at this point in the history
…board

also for the one in pianorol editor
  • Loading branch information
Jojo-Schmitz authored and vpereverzev committed Nov 18, 2020
1 parent c8a9dd7 commit 2496e6c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions global/settings/types/preferencekeys.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
#define PREF_UI_APP_SHOWSTATUSBAR "ui/application/showStatusBar"
#define PREF_UI_APP_USENATIVEDIALOGS "ui/application/useNativeDialogs"
#define PREF_UI_PIANO_HIGHLIGHTCOLOR "ui/piano/highlightColor"
#define PREF_UI_PIANO_SHOWPITCHHELP "ui/piano/showPitchHelp"
#define PREF_UI_SCORE_NOTE_DROPCOLOR "ui/score/note/dropColor"
#define PREF_UI_SCORE_DEFAULTCOLOR "ui/score/defaultColor"
#define PREF_UI_SCORE_FRAMEMARGINCOLOR "ui/score/frameMarginColor"
Expand Down
5 changes: 3 additions & 2 deletions mscore/pianoroll/pianokeyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "libmscore/staff.h"
#include "libmscore/part.h"
#include "libmscore/drumset.h"
#include "preferences.h"


namespace Ms {
Expand Down Expand Up @@ -116,7 +117,7 @@ void PianoKeyboard::paintEvent(QPaintEvent* /*event*/)
QRectF rect(-_ypos + off2, 0, off2 - off1, height());
p.drawRect(rect);

if (degree == 0 && noteHeight > fontSize + 2) {
if (preferences.getBool(PREF_UI_PIANO_SHOWPITCHHELP) && degree == 0 && noteHeight > fontSize + 2) {
QRectF rectText(rect.x() + 1, rect.y(), rect.height() - 2, rect.width() - 2);
QTransform xform = p.transform();
p.rotate(90);
Expand All @@ -138,7 +139,7 @@ void PianoKeyboard::paintEvent(QPaintEvent* /*event*/)

p.drawText(rectText, Qt::AlignBottom | Qt::AlignLeft, noteName);
}
else if (degree == 0) {
else if (preferences.getBool(PREF_UI_PIANO_SHOWPITCHHELP) && degree == 0) {
QRectF rectText(rect.x(), rect.y(), rect.width() - 4, rect.height() - 1);
p.drawText(rectText, Qt::AlignRight | Qt::AlignBottom, noteName);
}
Expand Down
2 changes: 1 addition & 1 deletion mscore/pianotools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ void PianoKeyItem::paint(QPainter* p, const QStyleOptionGraphicsItem* /*o*/, QWi
else
p->setBrush(type >= 7 ? Qt::black : Qt::white);
p->drawPath(path());
if (_pitch % 12 == 0) {
if (preferences.getBool(PREF_UI_PIANO_SHOWPITCHHELP) && _pitch % 12 == 0) {
QFont f("Edwin", 6);
p->setFont(f);
QString text = "C" + QString::number((_pitch / 12) - 1);
Expand Down
2 changes: 2 additions & 0 deletions mscore/preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ void Preferences::init(bool storeInMemoryOnly)
{PREF_UI_APP_SHOWSTATUSBAR, new BoolPreference(true)},
{PREF_UI_APP_USENATIVEDIALOGS, new BoolPreference(true)},
{PREF_UI_PIANO_HIGHLIGHTCOLOR, new ColorPreference(QColor(0x0065BF))},
{PREF_UI_PIANO_SHOWPITCHHELP, new BoolPreference(true)},
{PREF_UI_SCORE_NOTE_DROPCOLOR, new ColorPreference(QColor(0x0065BF))},
{PREF_UI_SCORE_DEFAULTCOLOR, new ColorPreference(QColor(Qt::black))}, //"#000000"
{PREF_UI_SCORE_FRAMEMARGINCOLOR, new ColorPreference(QColor(0xA0A0A4))},
Expand Down Expand Up @@ -600,6 +601,7 @@ QMap<QString, QVariant> Preferences::getDefaultLocalPreferences() {
PREF_UI_APP_SHOWSTATUSBAR,
PREF_UI_APP_USENATIVEDIALOGS,
PREF_UI_PIANO_HIGHLIGHTCOLOR,
PREF_UI_PIANO_SHOWPITCHHELP,
PREF_UI_SCORE_NOTE_DROPCOLOR,
PREF_UI_SCORE_DEFAULTCOLOR,
PREF_UI_SCORE_FRAMEMARGINCOLOR,
Expand Down

0 comments on commit 2496e6c

Please sign in to comment.