diff options
author | Florian Jung <flo@windfisch.org> | 2011-06-07 18:45:32 +0000 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2011-06-07 18:45:32 +0000 |
commit | c6f2151b1589c91292563a1b319cdbd193834d67 (patch) | |
tree | b4df7786b2d03664fe45867ca8017b3f44233f8d /muse2/muse/midiedit | |
parent | 637498c87bf1ac780d8527d0596936fcdd2c6dfc (diff) |
modified behaviour for clones:
- resizing a clone in the arranger also resizes all clones with
the same length
- same for auto-expanding in the pianoroll
- auto-expanding in the pianoroll does NOT expand for parts
which already contain hidden notes; then inserting notes
is forbidden; buggy, see below
still TODO and BUGS:
- forbidding notes doesn't work properly. the pianoroll still displays
them until the next full song update.
- that stuff must be done in the drum canvas as well
- step-rec and the score editor need support for auto-expanding
Diffstat (limited to 'muse2/muse/midiedit')
-rw-r--r-- | muse2/muse/midiedit/dcanvas.cpp | 2 | ||||
-rw-r--r-- | muse2/muse/midiedit/dcanvas.h | 2 | ||||
-rw-r--r-- | muse2/muse/midiedit/prcanvas.cpp | 58 | ||||
-rw-r--r-- | muse2/muse/midiedit/prcanvas.h | 2 | ||||
-rw-r--r-- | muse2/muse/midiedit/scoreedit.cpp | 9 |
5 files changed, 38 insertions, 35 deletions
diff --git a/muse2/muse/midiedit/dcanvas.cpp b/muse2/muse/midiedit/dcanvas.cpp index 92e514af..b19831a0 100644 --- a/muse2/muse/midiedit/dcanvas.cpp +++ b/muse2/muse/midiedit/dcanvas.cpp @@ -308,7 +308,7 @@ CItem* DrumCanvas::newItem(int tick, int instrument, int velocity) // resizeItem //--------------------------------------------------------- -void DrumCanvas::resizeItem(CItem* item, bool) +void DrumCanvas::resizeItem(CItem* item, bool, bool) { DEvent* nevent = (DEvent*) item; Event ev = nevent->event(); diff --git a/muse2/muse/midiedit/dcanvas.h b/muse2/muse/midiedit/dcanvas.h index 868113a6..a2d0f7de 100644 --- a/muse2/muse/midiedit/dcanvas.h +++ b/muse2/muse/midiedit/dcanvas.h @@ -57,7 +57,7 @@ class DrumCanvas : public EventCanvas { virtual Undo moveCanvasItems(CItemList&, int, int, DragType); virtual UndoOp moveItem(CItem*, const QPoint&, DragType); virtual CItem* newItem(const QPoint&, int); - virtual void resizeItem(CItem*, bool); + virtual void resizeItem(CItem*, bool, bool); virtual void newItem(CItem*, bool); virtual void newItem(CItem*, bool, bool replace ); virtual bool deleteItem(CItem*); diff --git a/muse2/muse/midiedit/prcanvas.cpp b/muse2/muse/midiedit/prcanvas.cpp index 091582ef..db42be6c 100644 --- a/muse2/muse/midiedit/prcanvas.cpp +++ b/muse2/muse/midiedit/prcanvas.cpp @@ -479,28 +479,28 @@ void PianoCanvas::newItem(CItem* item, bool noSnap) event.setLenTick(w); event.setPitch(y2pitch(item->y())); - song->startUndo(); - int modified=SC_EVENT_MODIFIED; + Undo operations; int diff = event.endTick()-part->lenTick(); - if (diff > 0) {// too short part? extend it - //printf("extend Part!\n"); - Part* newPart = part->clone(); - newPart->setLenTick(newPart->lenTick()+diff); - // Indicate no undo, and do port controller values but not clone parts. - audio->msgChangePart(part, newPart, false, true, false); - modified=modified|SC_PART_MODIFIED; - part = newPart; // reassign + + if (! ((diff > 0) && part->hasHiddenNotes()) ) //operation is allowed + { + operations.push_back(UndoOp(UndoOp::AddEvent,event, part, false, false)); + + if (diff > 0)// part must be extended? + { + schedule_resize_all_same_len_clone_parts(part, event.endTick(), operations); + printf("newItem: extending\n"); } - // Indicate no undo, and do not do port controller values and clone parts. - audio->msgAddEvent(event, part, false, false, false); - song->endUndo(modified); + } + //FINDMICH TODO: forbid action! this is currently wrong! + song->applyOperationGroup(operations); } //--------------------------------------------------------- // resizeItem //--------------------------------------------------------- -void PianoCanvas::resizeItem(CItem* item, bool noSnap) // experimental changes to try dynamically extending parts +void PianoCanvas::resizeItem(CItem* item, bool noSnap, bool) // experimental changes to try dynamically extending parts { //printf("resizeItem!\n"); NEvent* nevent = (NEvent*) item; @@ -519,23 +519,23 @@ void PianoCanvas::resizeItem(CItem* item, bool noSnap) // experimental c if (len <= 0) len = editor->raster(); } - song->startUndo(); - int modified=SC_EVENT_MODIFIED; + + Undo operations; int diff = event.tick()+len-part->lenTick(); - if (diff > 0) {// too short part? extend it - //printf("extend Part!\n"); - Part* newPart = part->clone(); - newPart->setLenTick(newPart->lenTick()+diff); - // Indicate no undo, and do port controller values but not clone parts. - audio->msgChangePart(part, newPart, false, true, false); - modified=modified|SC_PART_MODIFIED; - part = newPart; // reassign - } + + if (! ((diff > 0) && part->hasHiddenNotes()) ) //operation is allowed + { + newEvent.setLenTick(len); + operations.push_back(UndoOp(UndoOp::ModifyEvent,newEvent, event, nevent->part(), false, false)); + + if (diff > 0)// part must be extended? + { + schedule_resize_all_same_len_clone_parts(part, event.tick()+len, operations); + printf("resizeItem: extending\n");} + } + //FINDMICH TODO: forbid action! this is currently wrong! + song->applyOperationGroup(operations); - newEvent.setLenTick(len); - // Indicate no undo, and do not do port controller values and clone parts. - audio->msgChangeEvent(event, newEvent, nevent->part(), false, false, false); - song->endUndo(modified); } //--------------------------------------------------------- diff --git a/muse2/muse/midiedit/prcanvas.h b/muse2/muse/midiedit/prcanvas.h index c6e47c9e..d96dd4df 100644 --- a/muse2/muse/midiedit/prcanvas.h +++ b/muse2/muse/midiedit/prcanvas.h @@ -57,7 +57,7 @@ class PianoCanvas : public EventCanvas { virtual Undo moveCanvasItems(CItemList&, int, int, DragType); virtual UndoOp moveItem(CItem*, const QPoint&, DragType); virtual CItem* newItem(const QPoint&, int); - virtual void resizeItem(CItem*, bool noSnap); + virtual void resizeItem(CItem*, bool noSnap, bool); virtual void newItem(CItem*, bool noSnap); virtual bool deleteItem(CItem*); virtual void startDrag(CItem* item, bool copymode); diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index 1a885d99..f7d9237b 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -4457,11 +4457,14 @@ void staff_t::update_part_indices() * between, for example, when a cis is tied to a des * * CURRENT TODO - * o clones should have same size - * o insert empty measure should also work inside parts, that is, - * move notes _within_ parts + * o do autoexpand correctly in prcanvas.cpp, then port that to + * dcanvas.cpp, steprec.cpp and scoreedit.cpp * * IMPORTANT TODO + * o shrink a part from its beginning as well! watch out for clones! + * o insert empty measure should also work inside parts, that is, + * move notes _within_ parts + * * o canvas editor: create clone via "alt+drag" moves window instead * o investigate with valgrind * o controller view in score editor |