This commit is contained in:
ws 2014-06-19 11:34:15 +02:00
parent 5fc08d094b
commit 8aede97585
5 changed files with 74 additions and 90 deletions

View file

@ -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")

View file

@ -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;

View file

@ -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();
@ -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;
};

View file

@ -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;
@ -2135,6 +2134,7 @@ void ScoreView::constraintCanvas (int* dxx, int* dyy)
}
*dxx = dx;
*dyy = dy;
#endif
}
//---------------------------------------------------------
@ -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
//---------------------------------------------------------
@ -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")

View file

@ -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();