diff options
Diffstat (limited to 'muse2')
31 files changed, 1434 insertions, 421 deletions
diff --git a/muse2/muse/CMakeLists.txt b/muse2/muse/CMakeLists.txt index d9ca7e3c..8705f914 100644 --- a/muse2/muse/CMakeLists.txt +++ b/muse2/muse/CMakeLists.txt @@ -62,7 +62,6 @@ QT4_WRAP_CPP ( muse_moc_headers plugin.h song.h transport.h - transpose.h value.h ) @@ -129,7 +128,6 @@ file (GLOB core_source_files ticksynth.cpp track.cpp transport.cpp - transpose.cpp undo.cpp value.cpp vst.cpp diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp index 62651cc9..4ec64edf 100644 --- a/muse2/muse/app.cpp +++ b/muse2/muse/app.cpp @@ -48,7 +48,6 @@ #include "songinfo.h" #include "ticksynth.h" #include "transport.h" -#include "transpose.h" #include "waveedit.h" #include "widgets/projectcreateimpl.h" #include "widgets/menutitleitem.h" @@ -1018,7 +1017,6 @@ MusE::MusE(int argc, char** argv) : QMainWindow() midiEdit = new QMenu(tr("Midi"), this); midiEdit->setIcon(QIcon(*edit_midiIcon)); - midiTransposeAction = new QAction(QIcon(*midi_transposeIcon), tr("Transpose"), this); midiTransformerAction = new QAction(QIcon(*midi_transformIcon), tr("Midi &Transform"), this); editSongInfoAction = new QAction(QIcon(*edit_listIcon), tr("Song Info"), this); @@ -1165,7 +1163,6 @@ MusE::MusE(int argc, char** argv) : QMainWindow() connect(masterGraphicAction, SIGNAL(activated()), SLOT(startMasterEditor())); connect(masterListAction, SIGNAL(activated()), SLOT(startLMasterEditor())); - connect(midiTransposeAction, SIGNAL(activated()), SLOT(transpose())); connect(midiTransformerAction, SIGNAL(activated()), SLOT(startMidiTransformer())); connect(editSongInfoAction, SIGNAL(activated()), SLOT(startSongInfo())); @@ -1393,7 +1390,6 @@ MusE::MusE(int argc, char** argv) : QMainWindow() midiEdit->insertItem(tr("Modify Gate Time"), this, SLOT(modifyGateTime())); midiEdit->insertItem(tr("Modify Velocity"), this, SLOT(modifyVelocity())); midiEdit->insertItem(tr("Crescendo"), this, SLOT(crescendo())); - midiEdit->insertItem(tr("Transpose"), this, SLOT(transpose())); midiEdit->insertItem(tr("Thin Out"), this, SLOT(thinOut())); midiEdit->insertItem(tr("Erase Event"), this, SLOT(eraseEvent())); midiEdit->insertItem(tr("Note Shift"), this, SLOT(noteShift())); @@ -1404,7 +1400,6 @@ MusE::MusE(int argc, char** argv) : QMainWindow() midiEdit->insertItem(tr("Create Measure"), this, SLOT(createMeasure())); midiEdit->insertItem(tr("Mix Track"), this, SLOT(mixTrack())); #endif - midiEdit->addAction(midiTransposeAction); midiEdit->addAction(midiTransformerAction); menuEdit->addAction(editSongInfoAction); @@ -4173,15 +4168,6 @@ void MusE::selectionChanged() editCopyAction->setEnabled(flag); } -//--------------------------------------------------------- -// transpose -//--------------------------------------------------------- - -void MusE::transpose() - { - Transpose *w = new Transpose(); - w->show(); - } //--------------------------------------------------------- // modifyGateTime @@ -4834,7 +4820,6 @@ void MusE::updateConfiguration() masterGraphicAction->setShortcut(shortcuts[SHRT_OPEN_GRAPHIC_MASTER].key); masterListAction->setShortcut(shortcuts[SHRT_OPEN_LIST_MASTER].key); - midiTransposeAction->setShortcut(shortcuts[SHRT_TRANSPOSE].key); midiTransformerAction->setShortcut(shortcuts[SHRT_OPEN_MIDI_TRANSFORM].key); //editSongInfoAction has no acceleration diff --git a/muse2/muse/app.h b/muse2/muse/app.h index 42aebf3b..0cca50b3 100644 --- a/muse2/muse/app.h +++ b/muse2/muse/app.h @@ -113,7 +113,6 @@ class MusE : public QMainWindow QAction *trackMidiAction, *trackDrumAction, *trackWaveAction, *trackAOutputAction, *trackAGroupAction; QAction *trackAInputAction, *trackAAuxAction; QAction *masterGraphicAction, *masterListAction; - QAction *midiTransposeAction; QAction *midiTransformerAction; QAction *editSongInfoAction; public: @@ -293,7 +292,6 @@ class MusE : public QMainWindow void cmd(int); void clipboardChanged(); void selectionChanged(); - void transpose(); void modifyGateTime(); void modifyVelocity(); void crescendo(); diff --git a/muse2/muse/functions.cpp b/muse2/muse/functions.cpp index 6a3af374..65369b98 100644 --- a/muse2/muse/functions.cpp +++ b/muse2/muse/functions.cpp @@ -19,12 +19,22 @@ using namespace std; GateTime* gatetime_dialog=NULL; Velocity* velocity_dialog=NULL; Quantize* quantize_dialog=NULL; +Remove* erase_dialog=NULL; +DelOverlaps* del_overlaps_dialog=NULL; +Setlen* set_notelen_dialog=NULL; +Move* move_notes_dialog=NULL; +Transpose* transpose_dialog=NULL; void init_function_dialogs(QWidget* parent) { gatetime_dialog = new GateTime(parent); velocity_dialog = new Velocity(parent); quantize_dialog = new Quantize(parent); + erase_dialog = new Remove(parent); + del_overlaps_dialog = new DelOverlaps(parent); + set_notelen_dialog = new Setlen(parent); + move_notes_dialog = new Move(parent); + transpose_dialog = new Transpose(parent); } set<Part*> partlist_to_set(PartList* pl) @@ -99,13 +109,63 @@ bool quantize_notes(const set<Part*>& parts) return true; } +bool erase_notes(const set<Part*>& parts) +{ + if (!erase_dialog->exec()) + return false; + + erase_notes(parts,erase_dialog->range); + + return true; +} + +bool delete_overlaps(const set<Part*>& parts) +{ + if (!del_overlaps_dialog->exec()) + return false; + + delete_overlaps(parts,erase_dialog->range); + + return true; +} + +bool set_notelen(const set<Part*>& parts) +{ + if (!set_notelen_dialog->exec()) + return false; + + set_notelen(parts,set_notelen_dialog->range,set_notelen_dialog->len); + + return true; +} + +bool move_notes(const set<Part*>& parts) +{ + if (!move_notes_dialog->exec()) + return false; + + move_notes(parts,move_notes_dialog->range,move_notes_dialog->amount); + + return true; +} + +bool transpose_notes(const set<Part*>& parts) +{ + if (!transpose_dialog->exec()) + return false; + + transpose_notes(parts,transpose_dialog->range,transpose_dialog->amount); + + return true; +} + void modify_velocity(const set<Part*>& parts, int range, int rate, int offset) { map<Event*, Part*> events = get_events(parts, range); - if (!events.empty()) + if ( (!events.empty()) && ((rate!=100) || (offset!=0)) ) { song->startUndo(); @@ -141,7 +201,7 @@ void modify_notelen(const set<Part*>& parts, int range, int rate, int offset) { map<Event*, Part*> events = get_events(parts, range); - if (!events.empty()) + if ( (!events.empty()) && ((rate!=100) || (offset!=0)) ) { song->startUndo(); @@ -171,6 +231,11 @@ void modify_notelen(const set<Part*>& parts, int range, int rate, int offset) } } +void set_notelen(const set<Part*>& parts, int range, int len) +{ + modify_notelen(parts, range, 0, len); +} + unsigned quantize_tick(unsigned tick, unsigned raster, int swing) { //find out the nearest tick and the distance to it: @@ -196,11 +261,10 @@ unsigned quantize_tick(unsigned tick, unsigned raster, int swing) void quantize_notes(const set<Part*>& parts, int range, int raster, int strength, int swing, int threshold) { map<Event*, Part*> events = get_events(parts, range); + bool undo_started=false; if (!events.empty()) { - song->startUndo(); - for (map<Event*, Part*>::iterator it=events.begin(); it!=events.end(); it++) { Event& event=*(it->first); @@ -227,6 +291,12 @@ void quantize_notes(const set<Part*>& parts, int range, int raster, int strength if ( (event.lenTick() != len) || (event.tick() + part->tick() != begin_tick) ) { + if (!undo_started) + { + song->startUndo(); + undo_started=true; + } + Event newEvent = event.clone(); newEvent.setTick(begin_tick - part->tick()); newEvent.setLenTick(len); @@ -235,7 +305,7 @@ void quantize_notes(const set<Part*>& parts, int range, int raster, int strength } } - song->endUndo(SC_EVENT_MODIFIED); + if (undo_started) song->endUndo(SC_EVENT_MODIFIED); } } @@ -259,4 +329,110 @@ void erase_notes(const set<Part*>& parts, int range) } } +void transpose_notes(const set<Part*>& parts, int range, signed int halftonesteps) +{ + map<Event*, Part*> events = get_events(parts, range); + + if ( (!events.empty()) && (halftonesteps!=0) ) + { + song->startUndo(); + + for (map<Event*, Part*>::iterator it=events.begin(); it!=events.end(); it++) + { + Event& event=*(it->first); + Part* part=it->second; + + Event newEvent = event.clone(); + int pitch = event.pitch()+halftonesteps; + if (pitch > 127) pitch=127; + if (pitch < 0) pitch=0; + newEvent.setPitch(pitch); + // Indicate no undo, and do not do port controller values and clone parts. + audio->msgChangeEvent(event, newEvent, part, false, false, false); + } + + song->endUndo(SC_EVENT_MODIFIED); + } +} + +void move_notes(const set<Part*>& parts, int range, signed int ticks) //TODO FINDMICH: safety checks +{ + map<Event*, Part*> events = get_events(parts, range); + + if ( (!events.empty()) && (ticks!=0) ) + { + song->startUndo(); + + for (map<Event*, Part*>::iterator it=events.begin(); it!=events.end(); it++) + { + Event& event=*(it->first); + Part* part=it->second; + + Event newEvent = event.clone(); + newEvent.setTick(event.tick()+ticks); + // Indicate no undo, and do not do port controller values and clone parts. + audio->msgChangeEvent(event, newEvent, part, false, false, false); + } + + song->endUndo(SC_EVENT_MODIFIED); + } +} +void delete_overlaps(const set<Part*>& parts, int range) +{ + map<Event*, Part*> events = get_events(parts, range); + bool undo_started=false; + + set<Event*> deleted_events; + + if (!events.empty()) + { + for (map<Event*, Part*>::iterator it1=events.begin(); it1!=events.end(); it1++) + { + Event& event1=*(it1->first); + Part* part1=it1->second; + + // we may NOT optimize by letting it2 start at (it1 +1); this optimisation + // is only allowed when events was sorted by time. it is, however, sorted + // randomly by pointer. + for (map<Event*, Part*>::iterator it2=events.begin(); it2!=events.end(); it2++) + { + Event& event2=*(it2->first); + Part* part2=it2->second; + + if ( (part1->events()==part2->events()) && // part1 and part2 are the same or are duplicates + (&event1 != &event2) && // and event1 and event2 aren't the same + (deleted_events.find(&event2) == deleted_events.end()) ) //and event2 hasn't been deleted before + { + if ( (event1.pitch() == event2.pitch()) && + (event1.tick() <= event2.tick()) && + (event1.endTick() > event2.tick()) ) //they overlap + { + if (undo_started==false) + { + song->startUndo(); + undo_started=true; + } + + int new_len = event2.tick() - event1.tick(); + + if (new_len==0) + { + audio->msgDeleteEvent(event1, part1, false, false, false); + deleted_events.insert(&event1); + } + else + { + Event new_event1 = event1.clone(); + new_event1.setLenTick(new_len); + + audio->msgChangeEvent(event1, new_event1, part1, false, false, false); + } + } + } + } + } + + if (undo_started) song->endUndo(SC_EVENT_MODIFIED); + } +} diff --git a/muse2/muse/functions.h b/muse2/muse/functions.h index 03d0ba88..afd5b559 100644 --- a/muse2/muse/functions.h +++ b/muse2/muse/functions.h @@ -11,6 +11,11 @@ #include "velocity.h" #include "quantize.h" #include "gatetime.h" +#include "remove.h" +#include "transpose.h" +#include "setlen.h" +#include "move.h" +#include "deloverlaps.h" #include <set> #include "part.h" @@ -19,6 +24,11 @@ extern GateTime* gatetime_dialog; extern Velocity* velocity_dialog; extern Quantize* quantize_dialog; +extern Remove* erase_dialog; +extern DelOverlaps* del_overlaps_dialog; +extern Setlen* set_notelen_dialog; +extern Move* move_notes_dialog; +extern Transpose* transpose_dialog; void init_function_dialogs(QWidget* parent); @@ -30,12 +40,21 @@ void modify_velocity(const std::set<Part*>& parts, int range, int rate, int offs void modify_notelen(const std::set<Part*>& parts, int range, int rate, int offset=0); void quantize_notes(const std::set<Part*>& parts, int range, int raster, int strength=100, int swing=0, int threshold=0); void erase_notes(const std::set<Part*>& parts, int range); +void delete_overlaps(const std::set<Part*>& parts, int range); +void set_notelen(const std::set<Part*>& parts, int range, int len); +void move_notes(const std::set<Part*>& parts, int range, signed int ticks); +void transpose_notes(const std::set<Part*>& parts, int range, signed int halftonesteps); + //the below functions automatically open the dialog //they return true if you click "ok" and false if "abort" bool modify_velocity(const std::set<Part*>& parts); bool modify_notelen(const std::set<Part*>& parts); bool quantize_notes(const std::set<Part*>& parts); - +bool set_notelen(const std::set<Part*>& parts); +bool move_notes(const std::set<Part*>& parts); +bool transpose_notes(const std::set<Part*>& parts); +bool erase_notes(const std::set<Part*>& parts); +bool delete_overlaps(const std::set<Part*>& parts); #endif diff --git a/muse2/muse/midiedit/cmd.h b/muse2/muse/midiedit/cmd.h index 8339b7ae..b72166b1 100644 --- a/muse2/muse/midiedit/cmd.h +++ b/muse2/muse/midiedit/cmd.h @@ -12,17 +12,18 @@ #define CMD_RIGHT 1 #define CMD_INSERT 2 #define CMD_DELETE 3 -#define CMD_1 4 -#define CMD_2 5 -#define CMD_3 6 -#define CMD_4 7 -#define CMD_5 8 -#define CMD_6 9 -#define CMD_7 10 -#define CMD_T 11 -#define CMD_period 12 -#define CMD_LEFT_NOSNAP 13 -#define CMD_RIGHT_NOSNAP 14 +#define CMD_BACKSPACE 4 +#define CMD_1 5 +#define CMD_2 6 +#define CMD_3 7 +#define CMD_4 8 +#define CMD_5 9 +#define CMD_6 10 +#define CMD_7 11 +#define CMD_T 12 +#define CMD_period 13 +#define CMD_LEFT_NOSNAP 14 +#define CMD_RIGHT_NOSNAP 15 #endif diff --git a/muse2/muse/midiedit/dcanvas.cpp b/muse2/muse/midiedit/dcanvas.cpp index a21f04c0..18463eb0 100644 --- a/muse2/muse/midiedit/dcanvas.cpp +++ b/muse2/muse/midiedit/dcanvas.cpp @@ -742,20 +742,6 @@ void DrumCanvas::cmd(int cmd) editor->setCurCanvasPart(newpt); } break; - case CMD_DEL: - if (selectionSize()) { - song->startUndo(); - for (iCItem i = items.begin(); i != items.end(); ++i) { - if (!i->second->isSelected()) - continue; - Event ev = i->second->event(); - // Indicate no undo, and do not do port controller values and clone parts. - //audio->msgDeleteEvent(ev, i->second->part(), false); - audio->msgDeleteEvent(ev, i->second->part(), false, false, false); - } - song->endUndo(SC_EVENT_REMOVED); - } - return; case CMD_SAVE: case CMD_LOAD: diff --git a/muse2/muse/midiedit/dcanvas.h b/muse2/muse/midiedit/dcanvas.h index deb3a096..8bd70d89 100644 --- a/muse2/muse/midiedit/dcanvas.h +++ b/muse2/muse/midiedit/dcanvas.h @@ -91,7 +91,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_QUANTIZE + CMD_QUANTIZE, CMD_ERASE_EVENT, CMD_NOTE_SHIFT, CMD_DELETE_OVERLAPS }; DrumCanvas(MidiEditor*, QWidget*, int, int, const char* name = 0); diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp index 84d4bf5b..617d3d1f 100644 --- a/muse2/muse/midiedit/drumedit.cpp +++ b/muse2/muse/midiedit/drumedit.cpp @@ -234,14 +234,23 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini fixedAction = menuFunctions->addAction(tr("Set Fixed Length")); veloAction = menuFunctions->addAction(tr("Modify Velocity")); quantizeAction = menuFunctions->addAction(tr("Quantize")); + QAction* eraseEventAction = menuFunctions->addAction(tr("Erase Event")); + QAction* noteShiftAction = menuFunctions->addAction(tr("Note Shift")); + QAction* delOverlapsAction = menuFunctions->addAction(tr("Delete Overlaps")); connect(fixedAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(veloAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(quantizeAction, SIGNAL(triggered()), signalMapper, SLOT(map())); + connect(eraseEventAction, SIGNAL(triggered()), signalMapper, SLOT(map())); + connect(noteShiftAction, SIGNAL(triggered()), signalMapper, SLOT(map())); + connect(delOverlapsAction, SIGNAL(triggered()), signalMapper, SLOT(map())); signalMapper->setMapping(fixedAction, DrumCanvas::CMD_FIXED_LEN); signalMapper->setMapping(veloAction, DrumCanvas::CMD_MODIFY_VELOCITY); signalMapper->setMapping(quantizeAction, DrumCanvas::CMD_QUANTIZE); + signalMapper->setMapping(eraseEventAction, DrumCanvas::CMD_ERASE_EVENT); + signalMapper->setMapping(noteShiftAction, DrumCanvas::CMD_NOTE_SHIFT); + signalMapper->setMapping(delOverlapsAction, DrumCanvas::CMD_DELETE_OVERLAPS); QMenu* menuScriptPlugins = menuBar()->addMenu(tr("&Plugins")); song->populateScriptMenu(menuScriptPlugins, this); @@ -877,21 +886,18 @@ void DrumEdit::reset() void DrumEdit::cmd(int cmd) { switch(cmd) { - case DrumCanvas::CMD_LOAD: - load(); - break; - case DrumCanvas::CMD_SAVE: - save(); - break; - case DrumCanvas::CMD_RESET: - reset(); - break; - case DrumCanvas::CMD_MODIFY_VELOCITY: - modify_velocity(partlist_to_set(parts())); - break; - default: - ((DrumCanvas*)(canvas))->cmd(cmd); - break; + case DrumCanvas::CMD_LOAD: load(); break; + case DrumCanvas::CMD_SAVE: save(); break; + case DrumCanvas::CMD_RESET: reset(); break; + case DrumCanvas::CMD_MODIFY_VELOCITY: modify_velocity(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_FIXED_LEN: // this must be handled by the drum canvas, due to its + // special nature (each drum has its own length) + + default: ((DrumCanvas*)(canvas))->cmd(cmd); } } diff --git a/muse2/muse/midiedit/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp index 153199cd..79699860 100644 --- a/muse2/muse/midiedit/pianoroll.cpp +++ b/muse2/muse/midiedit/pianoroll.cpp @@ -189,56 +189,18 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i mapper->setMapping(funcModVelAction, PianoCanvas::CMD_MODIFY_VELOCITY); connect(funcModVelAction, SIGNAL(triggered()), mapper, SLOT(map())); - funcCrescendoAction = menuFunctions->addAction(tr("Crescendo")); - mapper->setMapping(funcCrescendoAction, PianoCanvas::CMD_CRESCENDO); - funcCrescendoAction->setEnabled(false); - connect(funcCrescendoAction, SIGNAL(triggered()), mapper, SLOT(map())); - funcTransposeAction = menuFunctions->addAction(tr("Transpose")); mapper->setMapping(funcTransposeAction, PianoCanvas::CMD_TRANSPOSE); - funcTransposeAction->setEnabled(false); connect(funcTransposeAction, SIGNAL(triggered()), mapper, SLOT(map())); - - funcThinOutAction = menuFunctions->addAction(tr("Thin Out")); - mapper->setMapping(funcThinOutAction, PianoCanvas::CMD_THIN_OUT); - funcThinOutAction->setEnabled(false); - connect(funcThinOutAction, SIGNAL(triggered()), mapper, SLOT(map())); - + funcEraseEventAction = menuFunctions->addAction(tr("Erase Event")); mapper->setMapping(funcEraseEventAction, PianoCanvas::CMD_ERASE_EVENT); - funcEraseEventAction->setEnabled(false); connect(funcEraseEventAction, SIGNAL(triggered()), mapper, SLOT(map())); funcNoteShiftAction = menuFunctions->addAction(tr("Note Shift")); mapper->setMapping(funcNoteShiftAction, PianoCanvas::CMD_NOTE_SHIFT); - funcNoteShiftAction->setEnabled(false); connect(funcNoteShiftAction, SIGNAL(triggered()), mapper, SLOT(map())); - - funcMoveClockAction = menuFunctions->addAction(tr("Move Clock")); - mapper->setMapping(funcMoveClockAction, PianoCanvas::CMD_MOVE_CLOCK); - funcMoveClockAction->setEnabled(false); - connect(funcMoveClockAction, SIGNAL(triggered()), mapper, SLOT(map())); - - funcCopyMeasureAction = menuFunctions->addAction(tr("Copy Measure")); - mapper->setMapping(funcCopyMeasureAction, PianoCanvas::CMD_COPY_MEASURE); - funcCopyMeasureAction->setEnabled(false); - connect(funcCopyMeasureAction, SIGNAL(triggered()), mapper, SLOT(map())); - - funcEraseMeasureAction = menuFunctions->addAction(tr("Erase Measure")); - mapper->setMapping(funcEraseMeasureAction, PianoCanvas::CMD_ERASE_MEASURE); - funcEraseMeasureAction->setEnabled(false); - connect(funcEraseMeasureAction, SIGNAL(triggered()), mapper, SLOT(map())); - - funcDelMeasureAction = menuFunctions->addAction(tr("Delete Measure")); - mapper->setMapping(funcDelMeasureAction, PianoCanvas::CMD_DELETE_MEASURE); - funcDelMeasureAction->setEnabled(false); - connect(funcDelMeasureAction, SIGNAL(triggered()), mapper, SLOT(map())); - - funcCreateMeasureAction = menuFunctions->addAction(tr("Create Measure")); - mapper->setMapping(funcCreateMeasureAction, PianoCanvas::CMD_CREATE_MEASURE); - funcCreateMeasureAction->setEnabled(false); - connect(funcCreateMeasureAction, SIGNAL(triggered()), mapper, SLOT(map())); - + funcSetFixedLenAction = menuFunctions->addAction(tr("Set Fixed Length")); mapper->setMapping(funcSetFixedLenAction, PianoCanvas::CMD_FIXED_LEN); connect(funcSetFixedLenAction, SIGNAL(triggered()), mapper, SLOT(map())); @@ -630,6 +592,12 @@ void PianoRoll::cmd(int cmd) case PianoCanvas::CMD_MODIFY_GATE_TIME: modify_notelen(partlist_to_set(parts())); break; case PianoCanvas::CMD_MODIFY_VELOCITY: modify_velocity(partlist_to_set(parts())); break; case PianoCanvas::CMD_QUANTIZE: quantize_notes(partlist_to_set(parts())); break; + case PianoCanvas::CMD_TRANSPOSE: transpose_notes(partlist_to_set(parts())); break; + case PianoCanvas::CMD_ERASE_EVENT: erase_notes(partlist_to_set(parts())); break; + case PianoCanvas::CMD_DEL: erase_notes(partlist_to_set(parts()),1); break; + case PianoCanvas::CMD_NOTE_SHIFT: move_notes(partlist_to_set(parts())); break; + case PianoCanvas::CMD_FIXED_LEN: set_notelen(partlist_to_set(parts())); break; + case PianoCanvas::CMD_DELETE_OVERLAPS: delete_overlaps(partlist_to_set(parts())); break; default: ((PianoCanvas*)canvas)->cmd(cmd); } @@ -1044,8 +1012,8 @@ void PianoRoll::keyPressEvent(QKeyEvent* event) pc->pianoCmd(CMD_INSERT); return; } - else if (key == Qt::Key_Delete) { - pc->pianoCmd(CMD_DELETE); + else if (key == Qt::Key_Backspace) { + pc->pianoCmd(CMD_BACKSPACE); return; } else if (key == shortcuts[SHRT_ZOOM_IN].key) { @@ -1260,16 +1228,9 @@ void PianoRoll::initShortcuts() funcGateTimeAction->setShortcut(shortcuts[SHRT_MODIFY_GATE_TIME].key); funcModVelAction->setShortcut(shortcuts[SHRT_MODIFY_VELOCITY].key); - funcCrescendoAction->setShortcut(shortcuts[SHRT_CRESCENDO].key); funcTransposeAction->setShortcut(shortcuts[SHRT_TRANSPOSE].key); - funcThinOutAction->setShortcut(shortcuts[SHRT_THIN_OUT].key); funcEraseEventAction->setShortcut(shortcuts[SHRT_ERASE_EVENT].key); funcNoteShiftAction->setShortcut(shortcuts[SHRT_NOTE_SHIFT].key); - funcMoveClockAction->setShortcut(shortcuts[SHRT_MOVE_CLOCK].key); - funcCopyMeasureAction->setShortcut(shortcuts[SHRT_COPY_MEASURE].key); - funcEraseMeasureAction->setShortcut(shortcuts[SHRT_ERASE_MEASURE].key); - funcDelMeasureAction->setShortcut(shortcuts[SHRT_DELETE_MEASURE].key); - funcCreateMeasureAction->setShortcut(shortcuts[SHRT_CREATE_MEASURE].key); funcSetFixedLenAction->setShortcut(shortcuts[SHRT_FIXED_LEN].key); funcDelOverlapsAction->setShortcut(shortcuts[SHRT_DELETE_OVERLAPS].key); diff --git a/muse2/muse/midiedit/pianoroll.h b/muse2/muse/midiedit/pianoroll.h index 32be3bea..0c1066b4 100644 --- a/muse2/muse/midiedit/pianoroll.h +++ b/muse2/muse/midiedit/pianoroll.h @@ -83,16 +83,9 @@ class PianoRoll : public MidiEditor { QAction* funcQuantizeAction; QAction* funcGateTimeAction; QAction* funcModVelAction; - QAction* funcCrescendoAction; QAction* funcTransposeAction; - QAction* funcThinOutAction; QAction* funcEraseEventAction; QAction* funcNoteShiftAction; - QAction* funcMoveClockAction; - QAction* funcCopyMeasureAction; - QAction* funcEraseMeasureAction; - QAction* funcDelMeasureAction; - QAction* funcCreateMeasureAction; QAction* funcSetFixedLenAction; QAction* funcDelOverlapsAction; diff --git a/muse2/muse/midiedit/prcanvas.cpp b/muse2/muse/midiedit/prcanvas.cpp index 5f3def81..0da18e99 100644 --- a/muse2/muse/midiedit/prcanvas.cpp +++ b/muse2/muse/midiedit/prcanvas.cpp @@ -723,7 +723,7 @@ void PianoCanvas::pianoCmd(int cmd) song->setPos(0, p, true, false, true); } return; - case CMD_DELETE: + case CMD_BACKSPACE: if (pos[0] < start() || pos[0] >= end()) break; { @@ -927,21 +927,6 @@ void PianoCanvas::cmd(int cmd) case CMD_PASTE: paste(); break; - case CMD_DEL: - if (selectionSize()) { - song->startUndo(); - for (iCItem i = items.begin(); i != items.end(); ++i) { - if (!i->second->isSelected()) - continue; - Event ev = i->second->event(); - // Indicate no undo, and do not do port controller values and clone parts. - //audio->msgDeleteEvent(ev, i->second->part(), false); - audio->msgDeleteEvent(ev, i->second->part(), false, false, false); - } - song->endUndo(SC_EVENT_REMOVED); - } - return; - case CMD_SELECT_ALL: // select all for (iCItem k = items.begin(); k != items.end(); ++k) { if (!k->second->isSelected()) @@ -1035,76 +1020,6 @@ void PianoCanvas::cmd(int cmd) song->endUndo(SC_EVENT_MODIFIED); break; - case CMD_DELETE_OVERLAPS: - if (!selectionSize()) - break; - - song->startUndo(); - for (iCItem k = items.begin(); k != items.end(); k++) { - if (k->second->isSelected() == false) - continue; - - NEvent* e1 = (NEvent*) (k->second); // first note - NEvent* e2 = NULL; // ptr to next selected note (which will be checked for overlap) - Event ce1 = e1->event(); - Event ce2; - - if (ce1.type() != Note) - continue; - - // Find next selected item on the same pitch - iCItem l = k; l++; - for (; l != items.end(); l++) { - if (l->second->isSelected() == false) - continue; - - e2 = (NEvent*) l->second; - ce2 = e2->event(); - - // Same pitch? - if (ce1.dataA() == ce2.dataA()) - break; - - // If the note has the same len and place we treat it as a duplicate note and not a following note - // The best thing to do would probably be to delete the duplicate note, we just want to avoid - // matching against the same note - if ( ce1.tick() + e1->part()->tick() == ce2.tick() + e2->part()->tick() - && ce1.lenTick() + e1->part()->tick() == ce2.lenTick() + e2->part()->tick()) - { - e2 = NULL; // this wasn't what we were looking for - continue; - } - - } - - if (e2 == NULL) // None found - break; - - Part* part1 = e1->part(); - Part* part2 = e2->part(); - if (ce2.type() != Note) - continue; - - - unsigned event1pos = ce1.tick() + part1->tick(); - unsigned event1end = event1pos + ce1.lenTick(); - unsigned event2pos = ce2.tick() + part2->tick(); - - //printf("event1pos %u event1end %u event2pos %u\n", event1pos, event1end, event2pos); - if (event1end > event2pos) { - Event newEvent = ce1.clone(); - unsigned newlen = ce1.lenTick() - (event1end - event2pos); - //printf("newlen: %u\n", newlen); - newEvent.setLenTick(newlen); - // Indicate no undo, and do not do port controller values and clone parts. - //audio->msgChangeEvent(ce1, newEvent, e1->part(), false); - audio->msgChangeEvent(ce1, newEvent, e1->part(), false, false, false); - } - } - song->endUndo(SC_EVENT_MODIFIED); - break; - - case CMD_CRESCENDO: case CMD_TRANSPOSE: case CMD_THIN_OUT: diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index e70e5310..62519036 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -41,8 +41,9 @@ using namespace std; #include "app.h" #include "xml.h" #include "mtscale.h" -#include "prcanvas.h" +#include "al/sig.h" #include "scoreedit.h" +#include "tools.h" #include "ttoolbar.h" #include "tb1.h" #include "globals.h" diff --git a/muse2/muse/transpose.cpp b/muse2/muse/transpose.cpp deleted file mode 100644 index 9e99c471..00000000 --- a/muse2/muse/transpose.cpp +++ /dev/null @@ -1,100 +0,0 @@ - -#include <stdio.h> - -#include <QDialog> - -#include "transpose.h" -#include "track.h" -#include "song.h" -#include "event.h" -#include "audio.h" - -//--------------------------------------------------------- -// Transpose -//--------------------------------------------------------- - -Transpose::Transpose(QWidget* parent) - : QDialog(parent) - { - setupUi(this); - setAttribute(Qt::WA_DeleteOnClose); - buttonGroup1 = new QButtonGroup(this); - buttonGroup1->addButton(time_all); - buttonGroup1->addButton(time_selected); - buttonGroup2 = new QButtonGroup(this); - buttonGroup2->addButton(parts_all); - buttonGroup2->addButton(parts_selected); - - if (song->lpos() != song->rpos()) { - time_selected->setChecked(true); - } - else { -// time_all->setChecked(true); - ButtonBox1->setEnabled(false); - } -// parts_all->setSelected(true); - } - -//--------------------------------------------------------- -// accept -//--------------------------------------------------------- - -void Transpose::accept() - { - int left = 0, right = 0; - int dv = delta->value(); - - TrackList *tracks = song->tracks(); - - if (time_selected->isChecked()) { - left = song->lpos(); - right = song->rpos(); - } - else { - left = 0; - right = song->len(); - } - - std::vector< EventList* > doneList; - typedef std::vector< EventList* >::iterator iDoneList; - - song->startUndo(); - for (iTrack t = tracks->begin(); t != tracks->end(); ++t) { -// if (((*t)->type() == Track::MIDI || (*t)->type() == Track::DRUM) - if (((*t)->type() != Track::MIDI) - || !(parts_all->isChecked() || (*t)->selected())) - continue; - - PartList *pl = (*t)->parts(); - for (iPart p = pl->begin(); p != pl->end(); ++p) { - MidiPart *mp = (MidiPart *) p->second; - EventList* el = mp->events(); - - // Check if the event list has already been done. Skip repeated clones. - iDoneList idl; - for(idl = doneList.begin(); idl != doneList.end(); ++idl) - if(*idl == el) - break; - if(idl != doneList.end()) - break; - doneList.push_back(el); - - for (iEvent i = el->begin(); i != el->end(); ++i) { - Event oe = i->second; - int tick = oe.tick(); - if (tick > right) - break; - if (tick < left) - continue; - Event ne = oe.clone(); - ne.setA(oe.dataA() + dv ); - // Indicate no undo, and do not do port controller values and clone parts. - //audio->msgChangeEvent(oe, ne, mp, false); - audio->msgChangeEvent(oe, ne, mp, false, false, false); - } - } - } - song->endUndo(SC_EVENT_MODIFIED); - close(); - } - diff --git a/muse2/muse/transpose.h b/muse2/muse/transpose.h deleted file mode 100644 index a5d2a1bb..00000000 --- a/muse2/muse/transpose.h +++ /dev/null @@ -1,26 +0,0 @@ - -#ifndef __TRANSPOSE_H__ -#define __TRANSPOSE_H__ - -#include "ui_transposebase.h" - -class QButtonGroup; - -//--------------------------------------------------------- -// transpose widget -//--------------------------------------------------------- - -class Transpose : public QDialog, public Ui::TransposeDialogBase { - Q_OBJECT - - QButtonGroup* buttonGroup1; - QButtonGroup* buttonGroup2; - - private slots: - virtual void accept(); - - public: - Transpose(QWidget* parent=0); - }; - -#endif diff --git a/muse2/muse/widgets/CMakeLists.txt b/muse2/muse/widgets/CMakeLists.txt index ee4af793..feb86816 100644 --- a/muse2/muse/widgets/CMakeLists.txt +++ b/muse2/muse/widgets/CMakeLists.txt @@ -77,6 +77,11 @@ QT4_WRAP_CPP (widget_mocs ttoolbutton.h velocity.h quantize.h + move.h + remove.h + deloverlaps.h + setlen.h + transpose.h verticalmeter.h view.h vscale.h @@ -113,6 +118,11 @@ file (GLOB widgets_ui_files transposebase.ui velocitybase.ui quantbase.ui + movebase.ui + removebase.ui + deloverlapsbase.ui + transposebase.ui + setlenbase.ui ) QT4_WRAP_UI (widget_ui_headers ${widgets_ui_files}) @@ -180,6 +190,11 @@ file (GLOB widgets_source_files utils.cpp velocity.cpp quantize.cpp + move.cpp + remove.cpp + deloverlaps.cpp + setlen.cpp + transpose.cpp verticalmeter.cpp view.cpp vscale.cpp diff --git a/muse2/muse/widgets/deloverlaps.cpp b/muse2/muse/widgets/deloverlaps.cpp new file mode 100644 index 00000000..ed4fab83 --- /dev/null +++ b/muse2/muse/widgets/deloverlaps.cpp @@ -0,0 +1,44 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: deloverlaps.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include <QButtonGroup> +#include "deloverlaps.h" + + +DelOverlaps::DelOverlaps(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + range_group = new QButtonGroup; + range_group->addButton(all_events_button,0); + range_group->addButton(selected_events_button,1); + range_group->addButton(looped_events_button,2); + range_group->addButton(selected_looped_button,3); + + pull_values(); +} + +void DelOverlaps::pull_values() +{ + range = range_group->checkedId(); +} + +void DelOverlaps::accept() +{ + pull_values(); + QDialog::accept(); +} + +int DelOverlaps::exec() +{ + if ((range < 0) || (range > 3)) range=0; + + range_group->button(range)->setChecked(true); + + return QDialog::exec(); +} + diff --git a/muse2/muse/widgets/deloverlaps.h b/muse2/muse/widgets/deloverlaps.h new file mode 100644 index 00000000..cb0cebe6 --- /dev/null +++ b/muse2/muse/widgets/deloverlaps.h @@ -0,0 +1,35 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: deloverlaps.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __DELOVERLAPS_H__ +#define __DELOVERLAPS__H__ + +#include "ui_deloverlapsbase.h" + +class QButtonGroup; + +class DelOverlaps : public QDialog, public Ui::DelOverlapsBase +{ + private: + Q_OBJECT + QButtonGroup* range_group; + + protected slots: + void accept(); + void pull_values(); + + public: + DelOverlaps(QWidget* parent = 0); + + int range; + + public slots: + int exec(); +}; + +#endif + diff --git a/muse2/muse/widgets/deloverlapsbase.ui b/muse2/muse/widgets/deloverlapsbase.ui new file mode 100644 index 00000000..7484bf97 --- /dev/null +++ b/muse2/muse/widgets/deloverlapsbase.ui @@ -0,0 +1,153 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>DelOverlapsBase</class> + <widget class="QDialog" name="DelOverlapsBase"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>275</width> + <height>195</height> + </rect> + </property> + <property name="windowTitle"> + <string>MusE: Delete Overlaps</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QGroupBox" name="rangeBox"> + <property name="title"> + <string>Range</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QRadioButton" name="all_events_button"> + <property name="text"> + <string>All Events</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="selected_events_button"> + <property name="text"> + <string>Selected Events</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="looped_events_button"> + <property name="text"> + <string>Looped Events</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="selected_looped_button"> + <property name="text"> + <string>Selected Looped</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <item> + <spacer name="Spacer1"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="okButton"> + <property name="text"> + <string>OK</string> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="cancelButton"> + <property name="text"> + <string>Cancel</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11"/> + <resources/> + <connections> + <connection> + <sender>okButton</sender> + <signal>clicked()</signal> + <receiver>DelOverlapsBase</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>20</x> + <y>20</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + <connection> + <sender>cancelButton</sender> + <signal>clicked()</signal> + <receiver>DelOverlapsBase</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>20</x> + <y>20</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/muse2/muse/widgets/move.cpp b/muse2/muse/widgets/move.cpp new file mode 100644 index 00000000..116325c3 --- /dev/null +++ b/muse2/muse/widgets/move.cpp @@ -0,0 +1,46 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: move.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include <QButtonGroup> +#include "move.h" + + +Move::Move(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + range_group = new QButtonGroup; + range_group->addButton(all_events_button,0); + range_group->addButton(selected_events_button,1); + range_group->addButton(looped_events_button,2); + range_group->addButton(selected_looped_button,3); + + pull_values(); +} + +void Move::pull_values() +{ + range = range_group->checkedId(); + amount = amount_spinbox->value(); +} + +void Move::accept() +{ + pull_values(); + QDialog::accept(); +} + +int Move::exec() +{ + if ((range < 0) || (range > 3)) range=0; + + range_group->button(range)->setChecked(true); + amount_spinbox->setValue(amount); + + return QDialog::exec(); +} + diff --git a/muse2/muse/widgets/move.h b/muse2/muse/widgets/move.h new file mode 100644 index 00000000..a69a72c5 --- /dev/null +++ b/muse2/muse/widgets/move.h @@ -0,0 +1,36 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: move.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __MOVE_H__ +#define __MOVE_H__ + +#include "ui_movebase.h" + +class QButtonGroup; + +class Move : public QDialog, public Ui::MoveBase +{ + private: + Q_OBJECT + QButtonGroup* range_group; + + protected slots: + void accept(); + void pull_values(); + + public: + Move(QWidget* parent = 0); + + int range; + int amount; + + public slots: + int exec(); +}; + +#endif + diff --git a/muse2/muse/widgets/movebase.ui b/muse2/muse/widgets/movebase.ui new file mode 100644 index 00000000..a8825dd5 --- /dev/null +++ b/muse2/muse/widgets/movebase.ui @@ -0,0 +1,203 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>MoveBase</class> + <widget class="QDialog" name="MoveBase"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>275</width> + <height>264</height> + </rect> + </property> + <property name="windowTitle"> + <string>MusE: Move Notes</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QGroupBox" name="rangeBox"> + <property name="title"> + <string>Range</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QRadioButton" name="all_events_button"> + <property name="text"> + <string>All Events</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="selected_events_button"> + <property name="text"> + <string>Selected Events</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="looped_events_button"> + <property name="text"> + <string>Looped Events</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="selected_looped_button"> + <property name="text"> + <string>Selected Looped</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_2"> + <property name="title"> + <string>Value</string> + </property> + <property name="flat"> + <bool>false</bool> + </property> + <property name="checkable"> + <bool>false</bool> + </property> + <layout class="QGridLayout" name="gridLayout"> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="TextLabel3"> + <property name="text"> + <string>Move by</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="amount_spinbox"> + <property name="accelerated"> + <bool>true</bool> + </property> + <property name="suffix"> + <string> ticks</string> + </property> + <property name="minimum"> + <number>-9999999</number> + </property> + <property name="maximum"> + <number>9999999</number> + </property> + <property name="singleStep"> + <number>386</number> + </property> + <property name="value"> + <number>0</number> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <item> + <spacer name="Spacer1"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="okButton"> + <property name="text"> + <string>OK</string> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="cancelButton"> + <property name="text"> + <string>Cancel</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11"/> + <resources/> + <connections> + <connection> + <sender>okButton</sender> + <signal>clicked()</signal> + <receiver>MoveBase</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>20</x> + <y>20</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + <connection> + <sender>cancelButton</sender> + <signal>clicked()</signal> + <receiver>MoveBase</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>20</x> + <y>20</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/muse2/muse/widgets/remove.cpp b/muse2/muse/widgets/remove.cpp new file mode 100644 index 00000000..cb75aa21 --- /dev/null +++ b/muse2/muse/widgets/remove.cpp @@ -0,0 +1,44 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: remove.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include <QButtonGroup> +#include "remove.h" + + +Remove::Remove(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + range_group = new QButtonGroup; + range_group->addButton(all_events_button,0); + range_group->addButton(selected_events_button,1); + range_group->addButton(looped_events_button,2); + range_group->addButton(selected_looped_button,3); + + pull_values(); +} + +void Remove::pull_values() +{ + range = range_group->checkedId(); +} + +void Remove::accept() +{ + pull_values(); + QDialog::accept(); +} + +int Remove::exec() +{ + if ((range < 0) || (range > 3)) range=0; + + range_group->button(range)->setChecked(true); + + return QDialog::exec(); +} + diff --git a/muse2/muse/widgets/remove.h b/muse2/muse/widgets/remove.h new file mode 100644 index 00000000..7b749142 --- /dev/null +++ b/muse2/muse/widgets/remove.h @@ -0,0 +1,35 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: remove.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __REMOVE_H__ +#define __REMOVE_H__ + +#include "ui_removebase.h" + +class QButtonGroup; + +class Remove : public QDialog, public Ui::RemoveBase +{ + private: + Q_OBJECT + QButtonGroup* range_group; + + protected slots: + void accept(); + void pull_values(); + + public: + Remove(QWidget* parent = 0); + + int range; + + public slots: + int exec(); +}; + +#endif + diff --git a/muse2/muse/widgets/removebase.ui b/muse2/muse/widgets/removebase.ui new file mode 100644 index 00000000..3381795c --- /dev/null +++ b/muse2/muse/widgets/removebase.ui @@ -0,0 +1,153 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>RemoveBase</class> + <widget class="QDialog" name="RemoveBase"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>275</width> + <height>195</height> + </rect> + </property> + <property name="windowTitle"> + <string>MusE: Erase Notes</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QGroupBox" name="rangeBox"> + <property name="title"> + <string>Range</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QRadioButton" name="all_events_button"> + <property name="text"> + <string>All Events</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="selected_events_button"> + <property name="text"> + <string>Selected Events</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="looped_events_button"> + <property name="text"> + <string>Looped Events</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="selected_looped_button"> + <property name="text"> + <string>Selected Looped</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <item> + <spacer name="Spacer1"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="okButton"> + <property name="text"> + <string>OK</string> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="cancelButton"> + <property name="text"> + <string>Cancel</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11"/> + <resources/> + <connections> + <connection> + <sender>okButton</sender> + <signal>clicked()</signal> + <receiver>RemoveBase</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>20</x> + <y>20</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + <connection> + <sender>cancelButton</sender> + <signal>clicked()</signal> + <receiver>RemoveBase</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>20</x> + <y>20</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/muse2/muse/widgets/setlen.cpp b/muse2/muse/widgets/setlen.cpp new file mode 100644 index 00000000..a1de875a --- /dev/null +++ b/muse2/muse/widgets/setlen.cpp @@ -0,0 +1,46 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: setlen.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include <QButtonGroup> +#include "setlen.h" + + +Setlen::Setlen(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + range_group = new QButtonGroup; + range_group->addButton(all_events_button,0); + range_group->addButton(selected_events_button,1); + range_group->addButton(looped_events_button,2); + range_group->addButton(selected_looped_button,3); + + pull_values(); +} + +void Setlen::pull_values() +{ + range = range_group->checkedId(); + len = len_spinbox->value(); +} + +void Setlen::accept() +{ + pull_values(); + QDialog::accept(); +} + +int Setlen::exec() +{ + if ((range < 0) || (range > 3)) range=0; + + range_group->button(range)->setChecked(true); + len_spinbox->setValue(len); + + return QDialog::exec(); +} + diff --git a/muse2/muse/widgets/setlen.h b/muse2/muse/widgets/setlen.h new file mode 100644 index 00000000..7dc54eb6 --- /dev/null +++ b/muse2/muse/widgets/setlen.h @@ -0,0 +1,36 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: setlen.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __SETLEN_H__ +#define __SETLEN_H__ + +#include "ui_setlenbase.h" + +class QButtonGroup; + +class Setlen : public QDialog, public Ui::SetlenBase +{ + private: + Q_OBJECT + QButtonGroup* range_group; + + protected slots: + void accept(); + void pull_values(); + + public: + Setlen(QWidget* parent = 0); + + int range; + int len; + + public slots: + int exec(); +}; + +#endif + diff --git a/muse2/muse/widgets/setlenbase.ui b/muse2/muse/widgets/setlenbase.ui new file mode 100644 index 00000000..7d929716 --- /dev/null +++ b/muse2/muse/widgets/setlenbase.ui @@ -0,0 +1,197 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>SetlenBase</class> + <widget class="QDialog" name="SetlenBase"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>275</width> + <height>264</height> + </rect> + </property> + <property name="windowTitle"> + <string>MusE: Set Note Length</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QGroupBox" name="rangeBox"> + <property name="title"> + <string>Range</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QRadioButton" name="all_events_button"> + <property name="text"> + <string>All Events</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="selected_events_button"> + <property name="text"> + <string>Selected Events</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="looped_events_button"> + <property name="text"> + <string>Looped Events</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="selected_looped_button"> + <property name="text"> + <string>Selected Looped</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_2"> + <property name="title"> + <string>Value</string> + </property> + <property name="flat"> + <bool>false</bool> + </property> + <property name="checkable"> + <bool>false</bool> + </property> + <layout class="QGridLayout" name="gridLayout"> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="TextLabel3"> + <property name="text"> + <string>New length</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="len_spinbox"> + <property name="suffix"> + <string> ticks</string> + </property> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>10000</number> + </property> + <property name="value"> + <number>1</number> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <item> + <spacer name="Spacer1"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="okButton"> + <property name="text"> + <string>OK</string> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="cancelButton"> + <property name="text"> + <string>Cancel</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11"/> + <resources/> + <connections> + <connection> + <sender>okButton</sender> + <signal>clicked()</signal> + <receiver>SetlenBase</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>20</x> + <y>20</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + <connection> + <sender>cancelButton</sender> + <signal>clicked()</signal> + <receiver>SetlenBase</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>20</x> + <y>20</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/muse2/muse/widgets/transpose.cpp b/muse2/muse/widgets/transpose.cpp new file mode 100644 index 00000000..66411829 --- /dev/null +++ b/muse2/muse/widgets/transpose.cpp @@ -0,0 +1,46 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: transpose.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include <QButtonGroup> +#include "transpose.h" + + +Transpose::Transpose(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + range_group = new QButtonGroup; + range_group->addButton(all_events_button,0); + range_group->addButton(selected_events_button,1); + range_group->addButton(looped_events_button,2); + range_group->addButton(selected_looped_button,3); + + pull_values(); +} + +void Transpose::pull_values() +{ + range = range_group->checkedId(); + amount = amount_spinbox->value(); +} + +void Transpose::accept() +{ + pull_values(); + QDialog::accept(); +} + +int Transpose::exec() +{ + if ((range < 0) || (range > 3)) range=0; + + range_group->button(range)->setChecked(true); + amount_spinbox->setValue(amount); + + return QDialog::exec(); +} + diff --git a/muse2/muse/widgets/transpose.h b/muse2/muse/widgets/transpose.h new file mode 100644 index 00000000..1ade8766 --- /dev/null +++ b/muse2/muse/widgets/transpose.h @@ -0,0 +1,36 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: transpose.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __TRANSPOSE_H__ +#define __TRANSPOSE_H__ + +#include "ui_transposebase.h" + +class QButtonGroup; + +class Transpose : public QDialog, public Ui::TransposeBase +{ + private: + Q_OBJECT + QButtonGroup* range_group; + + protected slots: + void accept(); + void pull_values(); + + public: + Transpose(QWidget* parent = 0); + + int range; + int amount; + + public slots: + int exec(); +}; + +#endif + diff --git a/muse2/muse/widgets/transposebase.ui b/muse2/muse/widgets/transposebase.ui index 63ac74a6..c26f2ef9 100644 --- a/muse2/muse/widgets/transposebase.ui +++ b/muse2/muse/widgets/transposebase.ui @@ -1,19 +1,19 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>TransposeDialogBase</class> - <widget class="QDialog" name="TransposeDialogBase"> + <class>TransposeBase</class> + <widget class="QDialog" name="TransposeBase"> <property name="geometry"> <rect> <x>0</x> <y>0</y> - <width>289</width> - <height>340</height> + <width>275</width> + <height>264</height> </rect> </property> <property name="windowTitle"> - <string>MusE: Midi Transpose</string> + <string>MusE: Transpose</string> </property> - <layout class="QVBoxLayout"> + <layout class="QVBoxLayout" name="verticalLayout_2"> <property name="spacing"> <number>6</number> </property> @@ -21,11 +21,11 @@ <number>11</number> </property> <item> - <widget class="QGroupBox" name="GroupBox1"> + <widget class="QGroupBox" name="rangeBox"> <property name="title"> - <string>Value</string> + <string>Range</string> </property> - <layout class="QVBoxLayout"> + <layout class="QVBoxLayout" name="verticalLayout"> <property name="spacing"> <number>6</number> </property> @@ -33,63 +33,16 @@ <number>11</number> </property> <item> - <layout class="QHBoxLayout"> - <property name="spacing"> - <number>6</number> - </property> - <property name="margin"> - <number>0</number> + <widget class="QRadioButton" name="all_events_button"> + <property name="text"> + <string>All Events</string> </property> - <item> - <widget class="QSpinBox" name="delta"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimum"> - <number>-99</number> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="TextLabel1"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>halftones</string> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - </layout> + </widget> </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="ButtonBox1"> - <property name="title"> - <string>Time</string> - </property> - <layout class="QVBoxLayout"> - <property name="spacing"> - <number>6</number> - </property> - <property name="margin"> - <number>11</number> - </property> <item> - <widget class="QRadioButton" name="time_all"> + <widget class="QRadioButton" name="selected_events_button"> <property name="text"> - <string>all</string> + <string>Selected Events</string> </property> <property name="checked"> <bool>true</bool> @@ -97,9 +50,16 @@ </widget> </item> <item> - <widget class="QRadioButton" name="time_selected"> + <widget class="QRadioButton" name="looped_events_button"> + <property name="text"> + <string>Looped Events</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="selected_looped_button"> <property name="text"> - <string>between markers</string> + <string>Selected Looped</string> </property> </widget> </item> @@ -107,34 +67,52 @@ </widget> </item> <item> - <widget class="QGroupBox" name="ButtonBox2"> + <widget class="QGroupBox" name="groupBox_2"> <property name="title"> - <string>Parts</string> + <string>Value</string> </property> - <layout class="QVBoxLayout"> - <property name="spacing"> - <number>6</number> - </property> + <property name="flat"> + <bool>false</bool> + </property> + <property name="checkable"> + <bool>false</bool> + </property> + <layout class="QGridLayout" name="gridLayout"> <property name="margin"> <number>11</number> </property> - <item> - <widget class="QRadioButton" name="parts_all"> + <property name="spacing"> + <number>6</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="TextLabel3"> <property name="text"> - <string>all</string> + <string>Halftone-steps</string> </property> - <property name="checked"> - <bool>true</bool> + <property name="wordWrap"> + <bool>false</bool> </property> </widget> </item> - <item> - <widget class="QRadioButton" name="parts_selected"> - <property name="windowTitle"> + <item row="0" column="1"> + <widget class="QSpinBox" name="amount_spinbox"> + <property name="accelerated"> + <bool>true</bool> + </property> + <property name="suffix"> <string/> </property> - <property name="text"> - <string>all in selected tracks</string> + <property name="minimum"> + <number>-127</number> + </property> + <property name="maximum"> + <number>127</number> + </property> + <property name="singleStep"> + <number>1</number> + </property> + <property name="value"> + <number>0</number> </property> </widget> </item> @@ -142,13 +120,10 @@ </widget> </item> <item> - <layout class="QHBoxLayout"> + <layout class="QHBoxLayout" name="horizontalLayout"> <property name="spacing"> <number>6</number> </property> - <property name="margin"> - <number>0</number> - </property> <item> <spacer name="Spacer1"> <property name="orientation"> @@ -195,7 +170,7 @@ <connection> <sender>okButton</sender> <signal>clicked()</signal> - <receiver>TransposeDialogBase</receiver> + <receiver>TransposeBase</receiver> <slot>accept()</slot> <hints> <hint type="sourcelabel"> @@ -211,7 +186,7 @@ <connection> <sender>cancelButton</sender> <signal>clicked()</signal> - <receiver>TransposeDialogBase</receiver> + <receiver>TransposeBase</receiver> <slot>reject()</slot> <hints> <hint type="sourcelabel"> |