diff options
author | Florian Jung <flo@windfisch.org> | 2011-05-11 13:24:19 +0000 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2011-05-11 13:24:19 +0000 |
commit | 67a3e8f501f9df2646bfe6ad7aa3b08246e8f7ce (patch) | |
tree | d1362dfd9f9ee92a852ae737dd68b4a770bda5a7 /muse2 | |
parent | e9c43888de8601c940b428c3bc6012f2ffe9f68c (diff) |
not indicating undo any more when only clicking on a note
Diffstat (limited to 'muse2')
-rw-r--r-- | muse2/muse/midiedit/scoreedit.cpp | 31 | ||||
-rw-r--r-- | muse2/muse/midiedit/scoreedit.h | 5 |
2 files changed, 32 insertions, 4 deletions
diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index 02151227..a75c5b5b 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -882,6 +882,9 @@ ScoreCanvas::ScoreCanvas(ScoreEdit* pr, QWidget* parent_widget, drag_cursor_changed=false; mouse_erases_notes=false; mouse_inserts_notes=true; + + undo_started=false; + undo_flags=0; selected_part=NULL; @@ -3306,7 +3309,8 @@ void ScoreCanvas::mousePressEvent (QMouseEvent* event) setMouseTracking(true); dragging=true; drag_cursor_changed=false; - song->startUndo(); + undo_started=false; + undo_flags=SC_EVENT_MODIFIED; } } else //we found nothing? @@ -3338,6 +3342,8 @@ void ScoreCanvas::mousePressEvent (QMouseEvent* event) if (relative_tick<0) cerr << "ERROR: THIS SHOULD NEVER HAPPEN: relative_tick is negative!" << endl; song->startUndo(); + undo_started=true; + undo_flags=SC_EVENT_INSERTED | SC_EVENT_MODIFIED; //stopping undo at the end of this function is unneccessary //because we'll begin a drag right after it. finishing //this drag will stop undo as well (in mouseReleaseEvent) @@ -3412,7 +3418,9 @@ void ScoreCanvas::mouseReleaseEvent (QMouseEvent* event) } } - song->endUndo(SC_EVENT_MODIFIED); + if (undo_started) + song->endUndo(undo_flags); + setMouseTracking(false); unsetCursor(); dragging=false; @@ -3508,6 +3516,12 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event) if (dragged_event.pitch()!=new_pitch) { + if (!undo_started) + { + song->startUndo(); + undo_started=true; + } + Event tmp=dragged_event.clone(); tmp.setPitch(new_pitch); @@ -3522,6 +3536,12 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event) case BEGIN: if (dragged_event.tick()+dragged_event_part->tick() != unsigned(tick)) { + if (!undo_started) + { + song->startUndo(); + undo_started=true; + } + Event tmp=dragged_event.clone(); signed relative_tick=tick-signed(dragged_event_part->tick()); @@ -3560,6 +3580,12 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event) tick+=quant_ticks(); if (dragged_event.tick()+dragged_event.lenTick() + dragged_event_part->tick() != unsigned(tick)) { + if (!undo_started) + { + song->startUndo(); + undo_started=true; + } + Event tmp=dragged_event.clone(); signed relative_tick=tick-signed(dragged_event_part->tick()); signed new_len=relative_tick-dragged_event.tick(); @@ -4039,7 +4065,6 @@ void staff_t::apply_lasso(QRect rect, set<Event*>& already_processed) * CURRENT TODO * o let the user select the distance between staves, or do this * automatically? - * o don't indicate undo when only clicking on an item * * IMPORTANT TODO * o add a select-clef-toolbox for tracks diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h index e46f408a..920c150b 100644 --- a/muse2/muse/midiedit/scoreedit.h +++ b/muse2/muse/midiedit/scoreedit.h @@ -651,7 +651,10 @@ class ScoreCanvas : public View QPoint lasso_start; QRect lasso; - + bool undo_started; + int undo_flags; + + enum {COLOR_MODE_BLACK, COLOR_MODE_PART, COLOR_MODE_VELO} coloring_mode; bool preamble_contains_keysig; |