Skip to content

Commit

Permalink
Merge pull request #4006 from dmitrio95/timewise-input-ui
Browse files Browse the repository at this point in the history
fix #276689: Add a timewise note input mode to MuseScore UI
  • Loading branch information
anatoly-os committed Oct 27, 2018
2 parents c86314d + f4590ef commit f2804b3
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 5 deletions.
1 change: 1 addition & 0 deletions libmscore/cmd.cpp
Expand Up @@ -3398,6 +3398,7 @@ void Score::cmdAddPitch(const EditData& ed, int note, bool addFlag, bool insert)

void Score::cmdAddPitch(int step, bool addFlag, bool insert)
{
insert = insert || inputState().usingNoteEntryMethod(NoteEntryMethod::TIMEWISE);
Position pos;
if (addFlag) {
Element* el = selection().element();
Expand Down
2 changes: 1 addition & 1 deletion libmscore/input.h
Expand Up @@ -31,7 +31,7 @@ class Score;
//---------------------------------------------------------

enum class NoteEntryMethod : char {
STEPTIME, REPITCH, RHYTHM, REALTIME_AUTO, REALTIME_MANUAL
STEPTIME, REPITCH, RHYTHM, REALTIME_AUTO, REALTIME_MANUAL, TIMEWISE
};

//---------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion libmscore/noteentry.cpp
Expand Up @@ -295,7 +295,8 @@ void Score::putNote(const QPointF& pos, bool replace, bool insert)
if (score->inputState().usingNoteEntryMethod(NoteEntryMethod::REPITCH) && !isTablature)
score->repitchNote(p, replace);
else {
if (insert)
if (insert
|| score->inputState().usingNoteEntryMethod(NoteEntryMethod::TIMEWISE))
score->insertChord(p);
else
score->putNote(p, replace);
Expand Down
3 changes: 2 additions & 1 deletion libmscore/score.h
Expand Up @@ -511,6 +511,8 @@ class Score : public QObject, public ScoreElement {
void cmdAddFret(int fret);
void cmdToggleVisible();

void putNote(const Position&, bool replace);

void resetSystems(bool layoutAll, LayoutContext& lc);
void collectLinearSystem(LayoutContext& lc);
void resetTempo();
Expand Down Expand Up @@ -680,7 +682,6 @@ class Score : public QObject, public ScoreElement {
void cmdFullMeasureRest();

void putNote(const QPointF&, bool replace, bool insert);
void putNote(const Position&, bool replace);
void insertChord(const Position&);
void localInsertChord(const Position&);
void globalInsertChord(const Position&);
Expand Down
1 change: 1 addition & 0 deletions mscore/data/icons/note_timewise.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion mscore/globals.h
Expand Up @@ -70,14 +70,16 @@ enum ScoreState {
STATE_PLAY = 1 << 13,
STATE_FOTO = 1 << 14,
STATE_LOCK = 1 << 15,
STATE_NOTE_ENTRY_METHOD_TIMEWISE = 1 << 16,

STATE_NEVER = 1 << 31,

STATE_NOTE_ENTRY_STAFF_PITCHED = STATE_NOTE_ENTRY_METHOD_STEPTIME
| STATE_NOTE_ENTRY_METHOD_REPITCH
| STATE_NOTE_ENTRY_METHOD_RHYTHM
| STATE_NOTE_ENTRY_METHOD_REALTIME_AUTO
| STATE_NOTE_ENTRY_METHOD_REALTIME_MANUAL,
| STATE_NOTE_ENTRY_METHOD_REALTIME_MANUAL
| STATE_NOTE_ENTRY_METHOD_TIMEWISE,
STATE_NOTE_ENTRY = STATE_NOTE_ENTRY_STAFF_PITCHED | STATE_NOTE_ENTRY_STAFF_DRUM | STATE_NOTE_ENTRY_STAFF_TAB,
STATE_ALLTEXTUAL_EDIT = STATE_TEXT_EDIT | STATE_LYRICS_EDIT | STATE_HARMONY_FIGBASS_EDIT,
STATE_ALL = -1
Expand Down
3 changes: 2 additions & 1 deletion mscore/icons.cpp
Expand Up @@ -157,7 +157,8 @@ static const char* iconNames[] = {
"arrow_up.svg",
"arrow_down.svg",
"mail.svg",
"bug.svg"
"bug.svg",
"note_timewise.svg"
};

//---------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions mscore/icons.h
Expand Up @@ -58,6 +58,7 @@ enum class Icons : signed char { Invalid_ICON = -1,
timesig_prolatio08_ICON, timesig_prolatio10_ICON, timesig_prolatio11_ICON, edit_ICON, reset_ICON, close_ICON,
arrowUp_ICON, arrowDown_ICON,
mail_ICON, bug_ICON,
noteTimewise_ICON,
voice1_ICON, voice2_ICON, voice3_ICON, voice4_ICON,
ICONS
};
Expand Down
6 changes: 6 additions & 0 deletions mscore/musescore.cpp
Expand Up @@ -589,6 +589,7 @@ void MuseScore::populateNoteInputMenu()
noteEntryMethods->addAction(getAction("note-input-rhythm"));
noteEntryMethods->addAction(getAction("note-input-realtime-auto"));
noteEntryMethods->addAction(getAction("note-input-realtime-manual"));
noteEntryMethods->addAction(getAction("note-input-timewise"));

connect(noteEntryMethods, SIGNAL(triggered(QAction*)), this, SLOT(cmd(QAction*)));

Expand Down Expand Up @@ -3699,6 +3700,11 @@ void MuseScore::changeState(ScoreState val)
cs->setNoteEntryMethod(NoteEntryMethod::REALTIME_MANUAL);
val = STATE_NOTE_ENTRY_METHOD_REALTIME_MANUAL;
}
else if (getAction("note-input-timewise")->isChecked()) {
showModeText(tr("Timewise input mode"));
cs->setNoteEntryMethod(NoteEntryMethod::TIMEWISE);
val = STATE_NOTE_ENTRY_METHOD_TIMEWISE;
}
else {
showModeText(tr("Steptime note input mode"));
cs->setNoteEntryMethod(NoteEntryMethod::STEPTIME);
Expand Down
1 change: 1 addition & 0 deletions mscore/musescore.qrc
Expand Up @@ -164,5 +164,6 @@
<file>data/icons/edit-swap.svg</file>
<file>data/icons/mail.svg</file>
<file>data/icons/bug.svg</file>
<file>data/icons/note_timewise.svg</file>
</qresource>
</RCC>
11 changes: 11 additions & 0 deletions mscore/shortcut.cpp
Expand Up @@ -298,6 +298,17 @@ Shortcut Shortcut::_sc[] = {
Qt::WindowShortcut,
ShortcutFlags::A_CHECKABLE
},
{
MsWidget::MAIN_WINDOW,
STATE_NORMAL | STATE_NOTE_ENTRY,
"note-input-timewise",
QT_TRANSLATE_NOOP("action","Timewise"),
QT_TRANSLATE_NOOP("action","Insert notes increasing measure duration"),
0,
Icons::noteTimewise_ICON,
Qt::WindowShortcut,
ShortcutFlags::A_CHECKABLE
},
{
MsWidget::MAIN_WINDOW,
STATE_NORMAL | STATE_NOTE_ENTRY,
Expand Down

0 comments on commit f2804b3

Please sign in to comment.