#17906 (Using MIDI input to input chords causes crash): Reworked moveToNextInput() logic in addPitch(). moveToNextInput() is called before actually inserting a new node, except if adding to a chord or if it is the first note inserted. A new flag InputState::moveBeforeAdding has been added just for this purpuse.
This commit is contained in:
parent
3e11d32aae
commit
e8159e18e8
4 changed files with 10 additions and 2 deletions
|
@ -384,9 +384,12 @@ qDebug("add pitch %d %d", pitch, addFlag);
|
|||
Note* n = addNote(chord, pitch);
|
||||
setLayoutAll(false);
|
||||
setLayout(chord->measure());
|
||||
moveToNextInputPos();
|
||||
return n;
|
||||
}
|
||||
if (_is.moveBeforeAdding())
|
||||
moveToNextInputPos();
|
||||
else
|
||||
_is.setMoveBeforeAdding(true);
|
||||
expandVoice();
|
||||
|
||||
// insert note
|
||||
|
@ -444,7 +447,6 @@ qDebug("add pitch %d %d", pitch, addFlag);
|
|||
qDebug("addPitch: cannot find slur note");
|
||||
setLayoutAll(true);
|
||||
}
|
||||
moveToNextInputPos();
|
||||
return note;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ InputState::InputState() :
|
|||
_segment(0),
|
||||
_string(VISUAL_STRING_NONE),
|
||||
_repitchMode(false),
|
||||
_moveBeforeAdding(false),
|
||||
rest(false),
|
||||
pitch(72),
|
||||
noteType(NOTE_NORMAL),
|
||||
|
|
|
@ -34,6 +34,7 @@ class InputState {
|
|||
Segment* _segment; // current segment
|
||||
int _string; // visual string selected for input (TAB staves only)
|
||||
bool _repitchMode;
|
||||
bool _moveBeforeAdding;
|
||||
|
||||
public:
|
||||
bool rest; // rest mode
|
||||
|
@ -70,6 +71,9 @@ class InputState {
|
|||
bool repitchMode() const { return _repitchMode; }
|
||||
void setRepitchMode(bool val) { _repitchMode = val; }
|
||||
|
||||
bool moveBeforeAdding() const { return _moveBeforeAdding; }
|
||||
void setMoveBeforeAdding(bool val) { _moveBeforeAdding = val; }
|
||||
|
||||
StaffGroup staffGroup() const;
|
||||
};
|
||||
|
||||
|
|
|
@ -2714,6 +2714,7 @@ void Score::setInputState(Element* e)
|
|||
e = static_cast<Chord*>(e)->upNote();
|
||||
|
||||
_is.setDrumNote(-1);
|
||||
_is.setMoveBeforeAdding(false);
|
||||
// _is.setDrumset(0);
|
||||
if (e->type() == Element::NOTE) {
|
||||
Note* note = static_cast<Note*>(e);
|
||||
|
|
Loading…
Reference in a new issue