diff options
author | Florian Jung <flo@windfisch.org> | 2011-05-20 13:54:45 +0000 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2011-05-20 13:54:45 +0000 |
commit | c64f27112000bc26f94510c885ea433aca115fbe (patch) | |
tree | ed73e172e8024a8b6b924d0c44566fa2b3585516 /muse2 | |
parent | 5d531cd32eb2053f10a349ee9a7d542bc550815c (diff) |
added "reorder list" function to drum roll
Diffstat (limited to 'muse2')
-rw-r--r-- | muse2/muse/midiedit/dcanvas.cpp | 29 | ||||
-rw-r--r-- | muse2/muse/midiedit/dcanvas.h | 3 | ||||
-rw-r--r-- | muse2/muse/midiedit/drumedit.cpp | 8 | ||||
-rw-r--r-- | muse2/muse/midiedit/scoreedit.cpp | 8 |
4 files changed, 45 insertions, 3 deletions
diff --git a/muse2/muse/midiedit/dcanvas.cpp b/muse2/muse/midiedit/dcanvas.cpp index 18463eb0..eea29b46 100644 --- a/muse2/muse/midiedit/dcanvas.cpp +++ b/muse2/muse/midiedit/dcanvas.cpp @@ -19,6 +19,7 @@ #include <stdio.h> #include <values.h> #include <errno.h> +#include <set> //#include <sys/stat.h> //#include <sys/mman.h> @@ -1474,3 +1475,31 @@ void DrumCanvas::selectCursorEvent(Event *ev) } updateSelection(); } + + +void DrumCanvas::moveAwayUnused() +{ + using std::set; + + set<int> used; + for (iCItem it=items.begin(); it!=items.end(); it++) + { + const Event& ev=it->second->event(); + + if (ev.type()==Note) + used.insert(ev.pitch()); + } + + int count=0; + for (set<int>::iterator it=used.begin(); it!=used.end();) + { + while ((*it != count) && (used.find(count)!=used.end())) count++; + + if (*it != count) + mapChanged(*it, count); + + count++; + + used.erase(it++); + } +} diff --git a/muse2/muse/midiedit/dcanvas.h b/muse2/muse/midiedit/dcanvas.h index cf653648..b86bc2d7 100644 --- a/muse2/muse/midiedit/dcanvas.h +++ b/muse2/muse/midiedit/dcanvas.h @@ -84,6 +84,7 @@ class DrumCanvas : public EventCanvas { void setTool2(int); void setCurDrumInstrument(int); virtual void setStep(int); + void moveAwayUnused(); public: enum { @@ -91,7 +92,7 @@ class DrumCanvas : public EventCanvas { CMD_SELECT_ALL, CMD_SELECT_NONE, CMD_SELECT_INVERT, CMD_SELECT_ILOOP, CMD_SELECT_OLOOP, CMD_SELECT_PREV_PART, CMD_SELECT_NEXT_PART, CMD_DEL, CMD_FIXED_LEN, CMD_RIGHT, CMD_LEFT, CMD_RIGHT_NOSNAP, CMD_LEFT_NOSNAP, CMD_MODIFY_VELOCITY, CMD_CRESCENDO, - CMD_QUANTIZE, CMD_ERASE_EVENT, CMD_NOTE_SHIFT, CMD_DELETE_OVERLAPS + CMD_QUANTIZE, CMD_ERASE_EVENT, CMD_NOTE_SHIFT, CMD_DELETE_OVERLAPS, CMD_REORDER_LIST }; DrumCanvas(MidiEditor*, QWidget*, int, int, const char* name = 0); diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp index f95ee4f6..9e64d7a7 100644 --- a/muse2/muse/midiedit/drumedit.cpp +++ b/muse2/muse/midiedit/drumedit.cpp @@ -233,14 +233,17 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini menuFunctions->setTearOffEnabled(true); + QAction* reorderListAction = menuFunctions->addAction(tr("Re-order list")); + menuFunctions->addSeparator(); fixedAction = menuFunctions->addAction(tr("Set Fixed Length")); veloAction = menuFunctions->addAction(tr("Modify Velocity")); crescAction = menuFunctions->addAction(tr("Crescendo/Decrescendo")); quantizeAction = menuFunctions->addAction(tr("Quantize")); QAction* eraseEventAction = menuFunctions->addAction(tr("Erase Event")); - QAction* noteShiftAction = menuFunctions->addAction(tr("Note Shift")); + QAction* noteShiftAction = menuFunctions->addAction(tr("Move Notes")); QAction* delOverlapsAction = menuFunctions->addAction(tr("Delete Overlaps")); + connect(reorderListAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(fixedAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(veloAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(crescAction, SIGNAL(triggered()), signalMapper, SLOT(map())); @@ -249,6 +252,7 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini connect(noteShiftAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(delOverlapsAction, SIGNAL(triggered()), signalMapper, SLOT(map())); + signalMapper->setMapping(reorderListAction, DrumCanvas::CMD_REORDER_LIST); signalMapper->setMapping(fixedAction, DrumCanvas::CMD_FIXED_LEN); signalMapper->setMapping(veloAction, DrumCanvas::CMD_MODIFY_VELOCITY); signalMapper->setMapping(crescAction, DrumCanvas::CMD_CRESCENDO); @@ -904,10 +908,12 @@ void DrumEdit::cmd(int cmd) case DrumCanvas::CMD_RESET: reset(); break; case DrumCanvas::CMD_MODIFY_VELOCITY: modify_velocity(partlist_to_set(parts())); break; case DrumCanvas::CMD_CRESCENDO: crescendo(partlist_to_set(parts())); break; + case DrumCanvas::CMD_QUANTIZE: quantize_notes(partlist_to_set(parts())); break; case DrumCanvas::CMD_ERASE_EVENT: erase_notes(partlist_to_set(parts())); break; case DrumCanvas::CMD_DEL: erase_notes(partlist_to_set(parts()),1); break; //delete selected events case DrumCanvas::CMD_DELETE_OVERLAPS: delete_overlaps(partlist_to_set(parts())); break; case DrumCanvas::CMD_NOTE_SHIFT: move_notes(partlist_to_set(parts())); break; + case DrumCanvas::CMD_REORDER_LIST: ((DrumCanvas*)(canvas))->moveAwayUnused(); break; //case DrumCanvas::CMD_FIXED_LEN: // this must be handled by the drum canvas, due to its // special nature (each drum has its own length) diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index dccac615..bbdd3d6f 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -4211,13 +4211,14 @@ void staff_t::apply_lasso(QRect rect, set<Event*>& already_processed) /* BUGS and potential bugs + * o quantize always quantizes length. make this selectable! * o when the keymap is not used, this will probably lead to a bug * same when mastertrack is disabled * o tied notes don't work properly when there's a key-change in * between, for example, when a cis is tied to a des * * CURRENT TODO - * x nothing atm + * o drum list: scroll while dragging * * IMPORTANT TODO * o add a select-clef-toolbox for tracks @@ -4226,6 +4227,11 @@ void staff_t::apply_lasso(QRect rect, set<Event*>& already_processed) * (0,5 sec) when displaying a whole song in scores * o transpose etc. must also transpose key-pressure events * o transpose: support in-key-transpose + * o legato: extend length to next note + * o delete: add velo and len threshold + * o thin out: remove unneeded ctrl messages + * o in drum roll: changing the list causes undo to be triggered, WTF? + * o changing list is dead slow * * less important stuff * o controller view in score editor |