Skip to content

Commit

Permalink
[Adv. Preference] Octave preference for next note-entry position (def…
Browse files Browse the repository at this point in the history
…ault is bottom note of chord)

More useful when building chords downwards, or just personal preference
  • Loading branch information
worldwideweary committed Sep 30, 2024
1 parent 1b2aa75 commit 1582131
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 8 deletions.
1 change: 1 addition & 0 deletions global/settings/types/preferencekeys.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
#define PREF_SCORE_NOTE_DEFAULTPLAYDURATION "score/note/defaultPlayDuration"
#define PREF_SCORE_NOTE_WARNPITCHRANGE "score/note/warnPitchRange"
#define PREF_SCORE_NOTE_INPUT_DISABLE_MOUSE_INPUT "ui/score/noteEntry/disableMouseEntry"
#define PREF_SCORE_NOTE_INPUT_OCTAVE_TENDENCY "ui/score/noteEntry/octaveTendencyIsTopNote"
#define PREF_SCORE_STYLE_DEFAULTSTYLEFILE "score/style/defaultStyleFile"
#define PREF_SCORE_STYLE_PARTSTYLEFILE "score/style/partStyleFile"
#define PREF_UI_CANVAS_BG_USECOLOR "ui/canvas/background/useColor"
Expand Down
16 changes: 8 additions & 8 deletions libmscore/cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4107,7 +4107,7 @@ void Score::cmdAddPitch(const EditData& ed, int note, bool addFlag, bool insert)
if (seg->isChordRestType()) {
Element* p = seg->element(is.track());
if (p && p->isChord()) {
Note* n = toChord(p)->downNote();
Note* n = useUpNote ? toChord(p)->upNote() : toChord(p)->downNote();
// forget any accidental and/or adjustment due to key signature
curPitch = n->epitch() - static_cast<int>(tpc2alter(n->tpc()));
break;
Expand Down Expand Up @@ -4469,13 +4469,13 @@ void Score::cmd(const QAction* a, EditData& ed)
};

static const std::vector<ScoreCmd> cmdList {
{ "note-c", [](Score* cs, EditData& ed){ cs->cmdAddPitch(ed, 0, false, false); }},
{ "note-d", [](Score* cs, EditData& ed){ cs->cmdAddPitch(ed, 1, false, false); }},
{ "note-e", [](Score* cs, EditData& ed){ cs->cmdAddPitch(ed, 2, false, false); }},
{ "note-f", [](Score* cs, EditData& ed){ cs->cmdAddPitch(ed, 3, false, false); }},
{ "note-g", [](Score* cs, EditData& ed){ cs->cmdAddPitch(ed, 4, false, false); }},
{ "note-a", [](Score* cs, EditData& ed){ cs->cmdAddPitch(ed, 5, false, false); }},
{ "note-b", [](Score* cs, EditData& ed){ cs->cmdAddPitch(ed, 6, false, false); }},
{ "note-c", [](Score* cs, EditData& ed){ cs->cmdAddPitch(ed, 0, false, false, MScore::noteInputOctaveTendencyIsTopNote); }},
{ "note-d", [](Score* cs, EditData& ed){ cs->cmdAddPitch(ed, 1, false, false, MScore::noteInputOctaveTendencyIsTopNote); }},
{ "note-e", [](Score* cs, EditData& ed){ cs->cmdAddPitch(ed, 2, false, false, MScore::noteInputOctaveTendencyIsTopNote); }},
{ "note-f", [](Score* cs, EditData& ed){ cs->cmdAddPitch(ed, 3, false, false, MScore::noteInputOctaveTendencyIsTopNote); }},
{ "note-g", [](Score* cs, EditData& ed){ cs->cmdAddPitch(ed, 4, false, false, MScore::noteInputOctaveTendencyIsTopNote); }},
{ "note-a", [](Score* cs, EditData& ed){ cs->cmdAddPitch(ed, 5, false, false, MScore::noteInputOctaveTendencyIsTopNote); }},
{ "note-b", [](Score* cs, EditData& ed){ cs->cmdAddPitch(ed, 6, false, false, MScore::noteInputOctaveTendencyIsTopNote); }},
{ "chord-c", [](Score* cs, EditData& ed){ cs->cmdAddPitch(ed, 0, true, false); }},
{ "chord-d", [](Score* cs, EditData& ed){ cs->cmdAddPitch(ed, 1, true, false); }},
{ "chord-e", [](Score* cs, EditData& ed){ cs->cmdAddPitch(ed, 2, true, false); }},
Expand Down
3 changes: 3 additions & 0 deletions libmscore/mscore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ qreal MScore::horizontalPageGapOdd = 50.0;
QColor MScore::selectColor[VOICES];
QColor MScore::cursorColor;
QColor MScore::defaultColor;

bool MScore::noteInputOctaveTendencyIsTopNote;

QColor MScore::layoutBreakColor;
QColor MScore::frameMarginColor;
QColor MScore::bgColor;
Expand Down
3 changes: 3 additions & 0 deletions libmscore/mscore.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,9 @@ class MScore {
static QColor selectColor[VOICES];
static QColor cursorColor;
static QColor defaultColor;

static bool noteInputOctaveTendencyIsTopNote;

static QColor dropColor;
static QColor layoutBreakColor;
static QColor frameMarginColor;
Expand Down
2 changes: 2 additions & 0 deletions mscore/musescore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,8 @@ void updateExternalValuesFromPreferences() {
MScore::bgColor = preferences.getColor(PREF_UI_CANVAS_BG_COLOR);
MScore::dropColor = preferences.getColor(PREF_UI_SCORE_NOTE_DROPCOLOR);
MScore::defaultColor = preferences.getColor(PREF_UI_SCORE_DEFAULTCOLOR);

MScore::noteInputOctaveTendencyIsTopNote = preferences.getBool(PREF_SCORE_NOTE_INPUT_OCTAVE_TENDENCY);
MScore::defaultPlayDuration = preferences.getInt(PREF_SCORE_NOTE_DEFAULTPLAYDURATION);
MScore::panPlayback = preferences.getBool(PREF_APP_PLAYBACK_PANPLAYBACK);
MScore::harmonyPlayDisableCompatibility = preferences.getBool(PREF_SCORE_HARMONY_PLAY_DISABLE_COMPATIBILITY);
Expand Down
1 change: 1 addition & 0 deletions mscore/preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ void Preferences::init(bool storeInMemoryOnly)
{PREF_SCORE_NOTE_DEFAULTPLAYDURATION, new IntPreference(300 /* ms */, false)},
{PREF_SCORE_NOTE_WARNPITCHRANGE, new BoolPreference(true, false)},
{PREF_SCORE_NOTE_INPUT_DISABLE_MOUSE_INPUT, new BoolPreference(false, true)},
{PREF_SCORE_NOTE_INPUT_OCTAVE_TENDENCY, new BoolPreference(false, true)},
{PREF_SCORE_STYLE_DEFAULTSTYLEFILE, new StringPreference("", false)},
{PREF_SCORE_STYLE_PARTSTYLEFILE, new StringPreference("", false)},
{PREF_UI_CANVAS_BG_USECOLOR, new BoolPreference(true, false)},
Expand Down

0 comments on commit 1582131

Please sign in to comment.