Skip to content

Commit

Permalink
fix #24414
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Jun 19, 2014
1 parent 5fc08d0 commit 8aede97
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 90 deletions.
66 changes: 0 additions & 66 deletions libmscore/cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2133,72 +2133,6 @@ void Score::cmd(const QAction* a)
else
upDown(false, UpDownMode::OCTAVE);
}
else if (cmd == "pitch-up-diatonic")
upDown(true, UpDownMode::DIATONIC);
else if (cmd == "pitch-down-diatonic")
upDown(false, UpDownMode::DIATONIC);
else if (cmd == "move-up") {
setLayoutAll(false);
if (el && el->type() == ElementType::NOTE) {
Note* note = static_cast<Note*>(el);
moveUp(note->chord());
}
}
else if (cmd == "move-down") {
setLayoutAll(false);
if (el && el->type() == ElementType::NOTE) {
Note* note = static_cast<Note*>(el);
moveDown(note->chord());
}
}
else if (cmd == "up-chord") {
if (el && (el->type() == ElementType::NOTE || el->type() == ElementType::REST)) {
Element* e = upAlt(el);
if (e) {
if (e->type() == ElementType::NOTE) {
_playNote = true;
}
select(e, SelectType::SINGLE, 0);
}
}
setLayoutAll(false);
}
else if (cmd == "down-chord") {
if (el && (el->type() == ElementType::NOTE || el->type() == ElementType::REST)) {
Element* e = downAlt(el);
if (e) {
if (e->type() == ElementType::NOTE) {
_playNote = true;
}
select(e, SelectType::SINGLE, 0);
}
}
setLayoutAll(false);
}
else if (cmd == "top-chord" ) {
if (el && el->type() == ElementType::NOTE) {
Element* e = upAltCtrl(static_cast<Note*>(el));
if (e) {
if (e->type() == ElementType::NOTE) {
_playNote = true;
}
select(e, SelectType::SINGLE, 0);
}
}
setLayoutAll(false);
}
else if (cmd == "bottom-chord") {
if (el && el->type() == ElementType::NOTE) {
Element* e = downAltCtrl(static_cast<Note*>(el));
if (e) {
if (e->type() == ElementType::NOTE) {
_playNote = true;
}
select(e, SelectType::SINGLE, 0);
}
}
setLayoutAll(false);
}
else if (cmd == "note-longa" || cmd == "note-longa-TAB")
padToggle(Pad::NOTE00);
else if (cmd == "note-breve" || cmd == "note-breve-TAB")
Expand Down
28 changes: 12 additions & 16 deletions libmscore/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,18 @@ class Score;

class InputState {
Score* _score;
TDuration _duration = TDuration::DurationType::V_INVALID; // currently duration
int _drumNote = -1;
#if 0 // yet(?) unused
Drumset* _drumset = 0;
#endif
int _track = 0;
Segment* _lastSegment = 0;
Segment* _segment = 0; // current segment
int _string = VISUAL_STRING_NONE; // visual string selected for input (TAB staves only)
bool _repitchMode = false;

bool _rest = false; // rest mode
NoteType _noteType = NoteType::NORMAL;
BeamMode _beamMode = BeamMode::AUTO;
bool _noteEntryMode = false;
Slur* _slur = 0;
TDuration _duration { TDuration::DurationType::V_INVALID }; // currently duration
int _drumNote { -1 };
int _track { 0 };
Segment* _lastSegment { 0 };
Segment* _segment { 0 }; // current segment
int _string { VISUAL_STRING_NONE }; // visual string selected for input (TAB staves only)
bool _repitchMode { false };
bool _rest { false }; // rest mode
NoteType _noteType { NoteType::NORMAL };
BeamMode _beamMode { BeamMode::AUTO };
bool _noteEntryMode { false };
Slur* _slur { 0 };

Segment* nextInputPos() const;

Expand Down
13 changes: 7 additions & 6 deletions libmscore/score.h
Original file line number Diff line number Diff line change
Expand Up @@ -375,16 +375,10 @@ class Score : public QObject {
void cmdSetBeamMode(BeamMode);
void cmdFlip();
Note* getSelectedNote();
Element* upAlt(Element*);
Note* upAltCtrl(Note*) const;
Element* downAlt(Element*);
Note* downAltCtrl(Note*) const;
ChordRest* upStaff(ChordRest* cr);
ChordRest* downStaff(ChordRest* cr);
ChordRest* nextTrack(ChordRest* cr);
ChordRest* prevTrack(ChordRest* cr);
void moveUp(Chord*);
void moveDown(Chord*);

void padToggle(Pad n);
void addTempo();
Expand Down Expand Up @@ -966,6 +960,13 @@ class Score : public QObject {
QList<int> uniqueStaves() const;
void transpositionChanged(Part*);

void moveUp(Chord*);
void moveDown(Chord*);
Element* upAlt(Element*);
Note* upAltCtrl(Note*) const;
Element* downAlt(Element*);
Note* downAltCtrl(Note*) const;

friend class ChangeSynthesizerState;
friend class Chord;
};
Expand Down
56 changes: 54 additions & 2 deletions mscore/scoreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2065,8 +2065,7 @@ void ScoreView::wheelEvent(QWheelEvent* event)

void ScoreView::constraintCanvas (int* dxx, int* dyy)
{
return;

#if 0
const qreal margin = 50.0; //move to preferences?
int dx = *dxx;
int dy = *dyy;
Expand Down Expand Up @@ -2135,6 +2134,7 @@ void ScoreView::constraintCanvas (int* dxx, int* dyy)
}
*dxx = dx;
*dyy = dy;
#endif
}

//---------------------------------------------------------
Expand Down Expand Up @@ -2414,6 +2414,20 @@ void ScoreView::normalPaste()
mscore->endCmd();
}

//---------------------------------------------------------
// cmdGotoElement
//---------------------------------------------------------

void ScoreView::cmdGotoElement(Element* e)
{
if (e) {
if (e->type() == ElementType::NOTE)
score()->setPlayNote(true);
score()->select(e, SelectType::SINGLE, 0);
moveCursor();
}
}

//---------------------------------------------------------
// cmd
//---------------------------------------------------------
Expand Down Expand Up @@ -2576,6 +2590,44 @@ void ScoreView::cmd(const QAction* a)
updateAll();
}
}
else if (cmd == "pitch-up-diatonic")
score()->upDown(true, UpDownMode::DIATONIC);
else if (cmd == "pitch-down-diatonic")
score()->upDown(false, UpDownMode::DIATONIC);
else if (cmd == "move-up") {
Element* el = score()->selection().element();
if (el && el->type() == ElementType::NOTE) {
Note* note = static_cast<Note*>(el);
score()->moveUp(note->chord());
}
}
else if (cmd == "move-down") {
Element* el = score()->selection().element();
if (el && el->type() == ElementType::NOTE) {
Note* note = static_cast<Note*>(el);
score()->moveDown(note->chord());
}
}
else if (cmd == "up-chord") {
Element* el = score()->selection().element();
if (el && (el->type() == ElementType::NOTE || el->type() == ElementType::REST))
cmdGotoElement(score()->upAlt(el));
}
else if (cmd == "down-chord") {
Element* el = score()->selection().element();
if (el && (el->type() == ElementType::NOTE || el->type() == ElementType::REST))
cmdGotoElement(score()->downAlt(el));
}
else if (cmd == "top-chord" ) {
Element* el = score()->selection().element();
if (el && el->type() == ElementType::NOTE)
cmdGotoElement(score()->upAltCtrl(static_cast<Note*>(el)));
}
else if (cmd == "bottom-chord") {
Element* el = score()->selection().element();
if (el && el->type() == ElementType::NOTE)
cmdGotoElement(score()->downAltCtrl(static_cast<Note*>(el)));
}
else if (cmd == "rest" || cmd == "rest-TAB")
cmdEnterRest();
else if (cmd == "rest-1")
Expand Down
1 change: 1 addition & 0 deletions mscore/scoreview.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ class ScoreView : public QWidget, public MuseScoreView {
void editCmd(const QString&);
void setLoopCursor(PositionCursor* curLoop, int tick, bool isInPos);
void cmdMoveCR(bool left);
void cmdGotoElement(Element*);

private slots:
void enterState();
Expand Down

0 comments on commit 8aede97

Please sign in to comment.