From c95feff1f178ec0d89ea21abf5d7e6294c0d0132 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Sun, 7 Aug 2011 15:15:12 +0000 Subject: moved the arranger out to its own window --- muse2/muse/app.cpp | 830 +++------------------------------ muse2/muse/app.h | 93 ++-- muse2/muse/arranger/CMakeLists.txt | 2 + muse2/muse/arranger/arranger.cpp | 5 +- muse2/muse/arranger/arranger.h | 5 +- muse2/muse/arranger/arrangerview.cpp | 875 +++++++++++++++++++++++++++++++++++ muse2/muse/arranger/arrangerview.h | 131 ++++++ muse2/muse/arranger/pcanvas.cpp | 14 +- muse2/muse/arranger/pcanvas.h | 2 - muse2/muse/cobject.h | 2 +- muse2/muse/gconfig.cpp | 1 + muse2/muse/gconfig.h | 1 + muse2/muse/midiedit/scoreedit.cpp | 9 +- muse2/muse/structure.cpp | 20 +- 14 files changed, 1131 insertions(+), 859 deletions(-) create mode 100644 muse2/muse/arranger/arrangerview.cpp create mode 100644 muse2/muse/arranger/arrangerview.h (limited to 'muse2') diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp index 3abb116f..53078d44 100644 --- a/muse2/muse/app.cpp +++ b/muse2/muse/app.cpp @@ -21,6 +21,7 @@ #include "amixer.h" #include "appearance.h" #include "arranger.h" +#include "arrangerview.h" #include "audio.h" #include "audiodev.h" #include "audioprefetch.h" @@ -52,17 +53,9 @@ #include "widgets/projectcreateimpl.h" #include "widgets/menutitleitem.h" #include "tools.h" -#include "visibletracks.h" #include "widgets/unusedwavefiles.h" #include "functions.h" -#ifdef DSSI_SUPPORT -#include "dssihost.h" -#endif - -#ifdef VST_SUPPORT -#include "vst.h" -#endif //extern void cacheJackRouteNames(); @@ -107,17 +100,6 @@ pthread_t splashThread; -void MusE::clearScoreMenuMappers() -{ - delete scoreOneStaffPerTrackMapper; - delete scoreAllInOneMapper; - - scoreOneStaffPerTrackMapper = new QSignalMapper(this); - scoreAllInOneMapper = new QSignalMapper(this); - - connect(scoreOneStaffPerTrackMapper, SIGNAL(mapped(QWidget*)), this, SLOT(openInScoreEdit_oneStaffPerTrack(QWidget*))); - connect(scoreAllInOneMapper, SIGNAL(mapped(QWidget*)), this, SLOT(openInScoreEdit_allInOne(QWidget*))); -} //--------------------------------------------------------- @@ -303,235 +285,6 @@ void addProject(const QString& name) projectList[0] = new QString(name); } -//--------------------------------------------------------- -// populateAddSynth -//--------------------------------------------------------- - -// ORCAN - CHECK -QMenu* populateAddSynth(QWidget* parent) -{ - QMenu* synp = new QMenu(parent); - - //typedef std::multimap asmap; - typedef std::multimap asmap; - - //typedef std::multimap::iterator imap; - typedef std::multimap::iterator imap; - - MessSynth* synMESS = 0; - QMenu* synpMESS = 0; - asmap mapMESS; - - #ifdef DSSI_SUPPORT - DssiSynth* synDSSI = 0; - QMenu* synpDSSI = 0; - asmap mapDSSI; - #endif - - #ifdef VST_SUPPORT - VstSynth* synVST = 0; - QMenu* synpVST = 0; - asmap mapVST; - #endif - - // Not necessary, but what the heck. - QMenu* synpOther = 0; - asmap mapOther; - - //const int synth_base_id = 0x1000; - int ii = 0; - for(std::vector::iterator i = synthis.begin(); i != synthis.end(); ++i) - { - synMESS = dynamic_cast(*i); - if(synMESS) - { - mapMESS.insert( std::pair (std::string(synMESS->description().toLower().toLatin1().constData()), ii) ); - } - else - { - - #ifdef DSSI_SUPPORT - synDSSI = dynamic_cast(*i); - if(synDSSI) - { - mapDSSI.insert( std::pair (std::string(synDSSI->description().toLower().toLatin1().constData()), ii) ); - } - else - #endif - - { - #ifdef VST_SUPPORT - synVST = dynamic_cast(*i); - if(synVST) - { - mapVST.insert( std::pair (std::string(synVST->description().toLower().toLatin1().constData()), ii) ); - } - else - #endif - - { - mapOther.insert( std::pair (std::string((*i)->description().toLower().toLatin1().constData()), ii) ); - } - } - } - - ++ii; - } - - int sz = synthis.size(); - for(imap i = mapMESS.begin(); i != mapMESS.end(); ++i) - { - int idx = i->second; - if(idx > sz) // Sanity check - continue; - Synth* s = synthis[idx]; - if(s) - { - // No MESS sub-menu yet? Create it now. - if(!synpMESS) - synpMESS = new QMenu(parent); - QAction* sM = synpMESS->addAction(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">"); - sM->setData(MENU_ADD_SYNTH_ID_BASE + idx); - } - } - - #ifdef DSSI_SUPPORT - for(imap i = mapDSSI.begin(); i != mapDSSI.end(); ++i) - { - int idx = i->second; - if(idx > sz) - continue; - Synth* s = synthis[idx]; - if(s) - { - // No DSSI sub-menu yet? Create it now. - if(!synpDSSI) - synpDSSI = new QMenu(parent); - //synpDSSI->insertItem(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">", MENU_ADD_SYNTH_ID_BASE + idx); - QAction* sD = synpDSSI->addAction(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">"); - sD->setData(MENU_ADD_SYNTH_ID_BASE + idx); - } - } - #endif - - #ifdef VST_SUPPORT - for(imap i = mapVST.begin(); i != mapVST.end(); ++i) - { - int idx = i->second; - if(idx > sz) - continue; - Synth* s = synthis[idx]; - if(s) - { - // No VST sub-menu yet? Create it now. - if(!synpVST) - synpVST = new QMenu(parent); - QAction* sV = synpVST->addAction(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">"); - sV->setData(MENU_ADD_SYNTH_ID_BASE + idx); - } - } - #endif - - for(imap i = mapOther.begin(); i != mapOther.end(); ++i) - { - int idx = i->second; - if(idx > sz) - continue; - Synth* s = synthis[idx]; - // No Other sub-menu yet? Create it now. - if(!synpOther) - synpOther = new QMenu(parent); - //synpOther->insertItem(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">", MENU_ADD_SYNTH_ID_BASE + idx); - QAction* sO = synpOther->addAction(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">"); - sO->setData(MENU_ADD_SYNTH_ID_BASE + idx); - } - - if(synpMESS) - { - synpMESS->setIcon(*synthIcon); - synpMESS->setTitle(QT_TRANSLATE_NOOP("@default", "MESS")); - synp->addMenu(synpMESS); - } - - #ifdef DSSI_SUPPORT - if(synpDSSI) - { - synpDSSI->setIcon(*synthIcon); - synpDSSI->setTitle(QT_TRANSLATE_NOOP("@default", "DSSI")); - synp->addMenu(synpDSSI); - } - #endif - - #ifdef VST_SUPPORT - if(synpVST) - { - synpVST->setIcon(*synthIcon); - synpVST->setTitle(QT_TRANSLATE_NOOP("@default", "FST")); - synp->addMenu(synpVST); - } - #endif - - if(synpOther) - { - synpOther->setIcon(*synthIcon); - synpOther->setTitle(QObject::tr("Other")); - synp->addMenu(synpOther); - } - - return synp; -} - -//--------------------------------------------------------- -// populateAddTrack -// this is also used in "mixer" -//--------------------------------------------------------- - -QActionGroup* populateAddTrack(QMenu* addTrack) - { - QActionGroup* grp = new QActionGroup(addTrack); - - QAction* midi = addTrack->addAction(QIcon(*addtrack_addmiditrackIcon), - QT_TRANSLATE_NOOP("@default", "Add Midi Track")); - midi->setData(Track::MIDI); - grp->addAction(midi); - QAction* drum = addTrack->addAction(QIcon(*addtrack_drumtrackIcon), - QT_TRANSLATE_NOOP("@default", "Add Drum Track")); - drum->setData(Track::DRUM); - grp->addAction(drum); - QAction* wave = addTrack->addAction(QIcon(*addtrack_wavetrackIcon), - QT_TRANSLATE_NOOP("@default", "Add Wave Track")); - wave->setData(Track::WAVE); - grp->addAction(wave); - QAction* aoutput = addTrack->addAction(QIcon(*addtrack_audiooutputIcon), - QT_TRANSLATE_NOOP("@default", "Add Audio Output")); - aoutput->setData(Track::AUDIO_OUTPUT); - grp->addAction(aoutput); - QAction* agroup = addTrack->addAction(QIcon(*addtrack_audiogroupIcon), - QT_TRANSLATE_NOOP("@default", "Add Audio Group")); - agroup->setData(Track::AUDIO_GROUP); - grp->addAction(agroup); - QAction* ainput = addTrack->addAction(QIcon(*addtrack_audioinputIcon), - QT_TRANSLATE_NOOP("@default", "Add Audio Input")); - ainput->setData(Track::AUDIO_INPUT); - grp->addAction(ainput); - QAction* aaux = addTrack->addAction(QIcon(*addtrack_auxsendIcon), - QT_TRANSLATE_NOOP("@default", "Add Aux Send")); - aaux->setData(Track::AUDIO_AUX); - grp->addAction(aaux); - - // Create a sub-menu and fill it with found synth types. Make addTrack the owner. - QMenu* synp = populateAddSynth(addTrack); - synp->setIcon(*synthIcon); - synp->setTitle(QT_TRANSLATE_NOOP("@default", "Add Synth")); - - // Add the sub-menu to the given menu. - addTrack->addMenu(synp); - - QObject::connect(addTrack, SIGNAL(triggered(QAction *)), song, SLOT(addNewTrack(QAction *))); - - return grp; - } - //--------------------------------------------------------- // MusE //--------------------------------------------------------- @@ -558,6 +311,7 @@ MusE::MusE(int argc, char** argv) : QMainWindow() midiRhythmGenerator = 0; globalSettingsConfig = 0; markerView = 0; + arrangerView = 0; softSynthesizerConfig = 0; midiTransformerDialog = 0; shortcutConfig = 0; @@ -572,11 +326,8 @@ MusE::MusE(int argc, char** argv) : QMainWindow() appName = QString("MusE"); setWindowTitle(appName); - editSignalMapper = new QSignalMapper(this); midiPluginSignalMapper = new QSignalMapper(this); followSignalMapper = new QSignalMapper(this); - scoreOneStaffPerTrackMapper = new QSignalMapper(this); - scoreAllInOneMapper = new QSignalMapper(this); song = new Song("song"); song->blockSignals(true); @@ -728,61 +479,6 @@ MusE::MusE(int argc, char** argv) : QMainWindow() quitAction = new QAction(tr("&Quit"), this); - //-------- Edit Actions - editCutAction = new QAction(QIcon(*editcutIconSet), tr("C&ut"), this); - editCopyAction = new QAction(QIcon(*editcopyIconSet), tr("&Copy"), this); - editPasteAction = new QAction(QIcon(*editpasteIconSet), tr("&Paste"), this); - editInsertAction = new QAction(QIcon(*editpasteIconSet), tr("&Insert"), this); - editInsertEMAction = new QAction(QIcon(*editpasteIconSet), tr("&Insert Empty Measure"), this); - editPasteCloneAction = new QAction(QIcon(*editpasteCloneIconSet), tr("Paste c&lone"), this); - editPaste2TrackAction = new QAction(QIcon(*editpaste2TrackIconSet), tr("Paste to &track"), this); - editPasteC2TAction = new QAction(QIcon(*editpasteClone2TrackIconSet), tr("Paste clone to trac&k"), this); - editDeleteSelectedAction = new QAction(QIcon(*edit_track_delIcon), tr("Delete Selected Tracks"), this); - - editShrinkPartsAction = new QAction(tr("Shrink selected parts"), this); //FINDMICH TODO tooltips! - editExpandPartsAction = new QAction(tr("Expand selected parts"), this); - editCleanPartsAction = new QAction(tr("Clean selected parts"), this); - - - addTrack = new QMenu(tr("Add Track"), this); - addTrack->setIcon(QIcon(*edit_track_addIcon)); - select = new QMenu(tr("Select"), this); - select->setIcon(QIcon(*selectIcon)); - - editSelectAllAction = new QAction(QIcon(*select_allIcon), tr("Select &All"), this); - editDeselectAllAction = new QAction(QIcon(*select_deselect_allIcon), tr("&Deselect All"), this); - editInvertSelectionAction = new QAction(QIcon(*select_invert_selectionIcon), tr("Invert &Selection"), this); - editInsideLoopAction = new QAction(QIcon(*select_inside_loopIcon), tr("&Inside Loop"), this); - editOutsideLoopAction = new QAction(QIcon(*select_outside_loopIcon), tr("&Outside Loop"), this); - editAllPartsAction = new QAction( QIcon(*select_all_parts_on_trackIcon), tr("All &Parts on Track"), this); - - - scoreSubmenu = new QMenu(tr("Score"), this); - scoreSubmenu->setIcon(QIcon(*scoreIconSet)); - - scoreAllInOneSubsubmenu = new QMenu(tr("all parts in one staff"), this); - scoreOneStaffPerTrackSubsubmenu = new QMenu(tr("one staff per part"), this); - - scoreSubmenu->addMenu(scoreAllInOneSubsubmenu); - scoreSubmenu->addMenu(scoreOneStaffPerTrackSubsubmenu); - updateScoreMenus(); - - startScoreEditAction = new QAction(*scoreIconSet, tr("New score window"), this); - startPianoEditAction = new QAction(*pianoIconSet, tr("Pianoroll"), this); - startDrumEditAction = new QAction(QIcon(*edit_drummsIcon), tr("Drums"), this); - startListEditAction = new QAction(QIcon(*edit_listIcon), tr("List"), this); - startWaveEditAction = new QAction(QIcon(*edit_waveIcon), tr("Wave"), this); - - master = new QMenu(tr("Mastertrack"), this); - master->setIcon(QIcon(*edit_mastertrackIcon)); - masterGraphicAction = new QAction(QIcon(*mastertrack_graphicIcon),tr("Graphic"), this); - masterListAction = new QAction(QIcon(*mastertrack_listIcon),tr("List"), this); - - midiEdit = new QMenu(tr("Midi"), this); - midiEdit->setIcon(QIcon(*edit_midiIcon)); - - midiTransformerAction = new QAction(QIcon(*midi_transformIcon), tr("Midi &Transform"), this); - editSongInfoAction = new QAction(QIcon(*edit_listIcon), tr("Song Info"), this); //-------- View Actions @@ -798,15 +494,8 @@ MusE::MusE(int argc, char** argv) : QMainWindow() viewCliplistAction->setCheckable(true); viewMarkerAction = new QAction(QIcon(*view_markerIcon), tr("Marker View"), this); viewMarkerAction->setCheckable(true); - - //-------- Structure Actions - strGlobalCutAction = new QAction(tr("Global Cut"), this); - strGlobalInsertAction = new QAction(tr("Global Insert"), this); - strGlobalSplitAction = new QAction(tr("Global Split"), this); - strCopyRangeAction = new QAction(tr("Copy Range"), this); - strCopyRangeAction->setEnabled(false); - strCutEventsAction = new QAction(tr("Cut Events"), this); - strCutEventsAction->setEnabled(false); + viewArrangerAction = new QAction(tr("Arranger View"), this); + viewArrangerAction->setCheckable(true); //-------- Midi Actions menuScriptPlugins = new QMenu(tr("&Plugins"), this); @@ -881,63 +570,6 @@ MusE::MusE(int argc, char** argv) : QMainWindow() connect(fileMoveWaveFiles, SIGNAL(activated()), SLOT(findUnusedWaveFiles())); connect(quitAction, SIGNAL(activated()), SLOT(quitDoc())); - //-------- Edit connections - connect(editCutAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); - connect(editCopyAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); - connect(editPasteAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); - connect(editInsertAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); - connect(editInsertEMAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); - connect(editPasteCloneAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); - connect(editPaste2TrackAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); - connect(editPasteC2TAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); - connect(editDeleteSelectedAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); - - connect(editShrinkPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); - connect(editExpandPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); - connect(editCleanPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); - - connect(editSelectAllAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); - connect(editDeselectAllAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); - connect(editInvertSelectionAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); - connect(editInsideLoopAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); - connect(editOutsideLoopAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); - connect(editAllPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); - - editSignalMapper->setMapping(editCutAction, CMD_CUT); - editSignalMapper->setMapping(editCopyAction, CMD_COPY); - editSignalMapper->setMapping(editPasteAction, CMD_PASTE); - editSignalMapper->setMapping(editInsertAction, CMD_INSERT); - editSignalMapper->setMapping(editPasteCloneAction, CMD_PASTE_CLONE); - editSignalMapper->setMapping(editPaste2TrackAction, CMD_PASTE_TO_TRACK); - editSignalMapper->setMapping(editPasteC2TAction, CMD_PASTE_CLONE_TO_TRACK); - editSignalMapper->setMapping(editInsertEMAction, CMD_INSERTMEAS); - editSignalMapper->setMapping(editDeleteSelectedAction, CMD_DELETE_TRACK); - editSignalMapper->setMapping(editShrinkPartsAction, CMD_SHRINK_PART); - editSignalMapper->setMapping(editExpandPartsAction, CMD_EXPAND_PART); - editSignalMapper->setMapping(editCleanPartsAction, CMD_CLEAN_PART); - editSignalMapper->setMapping(editSelectAllAction, CMD_SELECT_ALL); - editSignalMapper->setMapping(editDeselectAllAction, CMD_SELECT_NONE); - editSignalMapper->setMapping(editInvertSelectionAction, CMD_SELECT_INVERT); - editSignalMapper->setMapping(editInsideLoopAction, CMD_SELECT_ILOOP); - editSignalMapper->setMapping(editOutsideLoopAction, CMD_SELECT_OLOOP); - editSignalMapper->setMapping(editAllPartsAction, CMD_SELECT_PARTS); - - connect(editSignalMapper, SIGNAL(mapped(int)), this, SLOT(cmd(int))); - - connect(startPianoEditAction, SIGNAL(activated()), SLOT(startPianoroll())); - connect(startScoreEditAction, SIGNAL(activated()), SLOT(startScoreQuickly())); - connect(startDrumEditAction, SIGNAL(activated()), SLOT(startDrumEditor())); - connect(startListEditAction, SIGNAL(activated()), SLOT(startListEditor())); - connect(startWaveEditAction, SIGNAL(activated()), SLOT(startWaveEditor())); - connect(scoreOneStaffPerTrackMapper, SIGNAL(mapped(QWidget*)), this, SLOT(openInScoreEdit_oneStaffPerTrack(QWidget*))); - connect(scoreAllInOneMapper, SIGNAL(mapped(QWidget*)), this, SLOT(openInScoreEdit_allInOne(QWidget*))); - - - connect(masterGraphicAction, SIGNAL(activated()), SLOT(startMasterEditor())); - connect(masterListAction, SIGNAL(activated()), SLOT(startLMasterEditor())); - - connect(midiTransformerAction, SIGNAL(activated()), SLOT(startMidiTransformer())); - connect(editSongInfoAction, SIGNAL(activated()), SLOT(startSongInfo())); //-------- View connections @@ -947,13 +579,7 @@ MusE::MusE(int argc, char** argv) : QMainWindow() connect(viewMixerBAction, SIGNAL(toggled(bool)), SLOT(toggleMixer2(bool))); connect(viewCliplistAction, SIGNAL(toggled(bool)), SLOT(startClipList(bool))); connect(viewMarkerAction, SIGNAL(toggled(bool)), SLOT(toggleMarker(bool))); - - //-------- Structure connections - connect(strGlobalCutAction, SIGNAL(activated()), SLOT(globalCut())); - connect(strGlobalInsertAction, SIGNAL(activated()), SLOT(globalInsert())); - connect(strGlobalSplitAction, SIGNAL(activated()), SLOT(globalSplit())); - connect(strCopyRangeAction, SIGNAL(activated()), SLOT(copyRange())); - connect(strCutEventsAction, SIGNAL(activated()), SLOT(cutEvents())); + connect(viewArrangerAction, SIGNAL(toggled(bool)), SLOT(toggleArranger(bool))); //-------- Midi connections connect(midiEditInstAction, SIGNAL(activated()), SLOT(startEditInstrument())); @@ -1013,15 +639,6 @@ MusE::MusE(int argc, char** argv) : QMainWindow() connect(helpReportAction, SIGNAL(activated()), SLOT(startBugBrowser())); connect(helpAboutAction, SIGNAL(activated()), SLOT(about())); - //-------------------------------------------------- - // Miscellaneous shortcuts - //-------------------------------------------------- - - QShortcut* sc = new QShortcut(shortcuts[SHRT_DELETE].key, this); - sc->setContext(Qt::WindowShortcut); - connect(sc, SIGNAL(activated()), editSignalMapper, SLOT(map())); - editSignalMapper->setMapping(sc, CMD_DELETE); - //-------------------------------------------------- // Toolbar //-------------------------------------------------- @@ -1041,10 +658,6 @@ MusE::MusE(int argc, char** argv) : QMainWindow() tools->addSeparator(); tools->addActions(undoRedo->actions()); - tools1 = new EditToolBar(this, arrangerTools); - addToolBar(tools1); - tools1->setObjectName("arrangerTools"); - QToolBar* transportToolbar = addToolBar(tr("Transport")); transportToolbar->setObjectName("Transport"); transportToolbar->addActions(transportAction->actions()); @@ -1053,8 +666,6 @@ MusE::MusE(int argc, char** argv) : QMainWindow() panicToolbar->setObjectName("Panic"); panicToolbar->addAction(panicAction); - visTracks = new VisibleTracks(this); - addToolBar(visTracks); //rlimit lim; @@ -1099,6 +710,8 @@ MusE::MusE(int argc, char** argv) : QMainWindow() menu_file->addAction(fileSaveAction); menu_file->addAction(fileSaveAsAction); menu_file->addSeparator(); + menu_file->addAction(editSongInfoAction); + menu_file->addSeparator(); menu_file->addAction(fileImportMidiAction); menu_file->addAction(fileExportMidiAction); menu_file->addAction(fileImportPartAction); @@ -1110,66 +723,7 @@ MusE::MusE(int argc, char** argv) : QMainWindow() menu_file->addAction(quitAction); menu_file->addSeparator(); - //------------------------------------------------------------- - // popup Edit - //------------------------------------------------------------- - menuEdit = menuBar()->addMenu(tr("&Edit")); - menuEdit->addActions(undoRedo->actions()); - menuEdit->addSeparator(); - - menuEdit->addAction(editCutAction); - menuEdit->addAction(editCopyAction); - menuEdit->addAction(editPasteAction); - menuEdit->addAction(editInsertAction); - menuEdit->addAction(editInsertEMAction); - menuEdit->addAction(editPasteCloneAction); - menuEdit->addAction(editPaste2TrackAction); - menuEdit->addAction(editPasteC2TAction); - menuEdit->addSeparator(); - menuEdit->addAction(editShrinkPartsAction); - menuEdit->addAction(editExpandPartsAction); - menuEdit->addAction(editCleanPartsAction); - menuEdit->addSeparator(); - menuEdit->addAction(editDeleteSelectedAction); - - // Moved below. Have to wait until synths are available... - //populateAddTrack(addTrack); - menuEdit->addMenu(addTrack); - menuEdit->addMenu(select); - select->addAction(editSelectAllAction); - select->addAction(editDeselectAllAction); - select->addAction(editInvertSelectionAction); - select->addAction(editInsideLoopAction); - select->addAction(editOutsideLoopAction); - select->addAction(editAllPartsAction); - menuEdit->addSeparator(); - - menuEdit->addAction(startPianoEditAction); - menuEdit->addMenu(scoreSubmenu); - menuEdit->addAction(startScoreEditAction); - menuEdit->addAction(startDrumEditAction); - menuEdit->addAction(startListEditAction); - menuEdit->addAction(startWaveEditAction); - - menuEdit->addMenu(master); - master->addAction(masterGraphicAction); - master->addAction(masterListAction); - menuEdit->addSeparator(); - - - menuEdit->addMenu(midiEdit); -/* commented out by flo: these are not implemented, - but maybe will be in future (state: revision 988) - midiEdit->insertItem(tr("Copy Measure"), this, SLOT(copyMeasure())); - midiEdit->insertItem(tr("Erase Measure"), this, SLOT(eraseMeasure())); - midiEdit->insertItem(tr("Delete Measure"), this, SLOT(deleteMeasure())); - midiEdit->insertItem(tr("Create Measure"), this, SLOT(createMeasure())); - midiEdit->insertItem(tr("Mix Track"), this, SLOT(mixTrack())); -*/ - midiEdit->addAction(midiTransformerAction); - - menuEdit->addAction(editSongInfoAction); //------------------------------------------------------------- // popup View @@ -1183,20 +737,9 @@ MusE::MusE(int argc, char** argv) : QMainWindow() menuView->addAction(viewMixerBAction); menuView->addAction(viewCliplistAction); menuView->addAction(viewMarkerAction); + menuView->addAction(viewArrangerAction); - //------------------------------------------------------------- - // popup Structure - //------------------------------------------------------------- - - menuStructure = menuBar()->addMenu(tr("&Structure")); - menuStructure->addAction(strGlobalCutAction); - menuStructure->addAction(strGlobalInsertAction); - menuStructure->addAction(strGlobalSplitAction); - menuStructure->addAction(strCopyRangeAction); - menuStructure->addSeparator(); - menuStructure->addAction(strCutEventsAction); - //------------------------------------------------------------- // popup Midi //------------------------------------------------------------- @@ -1280,24 +823,19 @@ MusE::MusE(int argc, char** argv) : QMainWindow() //menu_help->addSeparator(); //menu_ids[CMD_START_WHATSTHIS] = menu_help->insertItem(tr("What's &This?"), this, SLOT(whatsThis()), 0); + + arrangerView = new ArrangerView(this); + connect(arrangerView, SIGNAL(closed()), SLOT(arrangerClosed())); + toplevels.push_back(Toplevel(Toplevel::ARRANGER, (unsigned long)(arrangerView), arrangerView)); + arrangerView->hide(); + arranger=arrangerView->getArranger(); + + //--------------------------------------------------- // Central Widget //--------------------------------------------------- - arranger = new Arranger(this, "arranger"); - setCentralWidget(arranger); - - connect(tools1, SIGNAL(toolChanged(int)), arranger, SLOT(setTool(int))); - connect(visTracks, SIGNAL(visibilityChanged()), song, SLOT(update()) ); - connect(arranger, SIGNAL(editPart(Track*)), SLOT(startEditor(Track*))); - connect(arranger, SIGNAL(dropSongFile(const QString&)), SLOT(loadProjectFile(const QString&))); - connect(arranger, SIGNAL(dropMidiFile(const QString&)), SLOT(importMidi(const QString&))); - connect(arranger, SIGNAL(startEditor(PartList*,int)), SLOT(startEditor(PartList*,int))); - connect(arranger, SIGNAL(toolChanged(int)), tools1, SLOT(set(int))); - connect(this, SIGNAL(configChanged()), arranger, SLOT(configChanged())); - - connect(arranger, SIGNAL(setUsedTool(int)), SLOT(setUsedTool(int))); - + //TODO FINDMICHJETZT mdiarea erstellen und als central widget setzen! //--------------------------------------------------- // read list of "Recent Projects" //--------------------------------------------------- @@ -1327,24 +865,12 @@ MusE::MusE(int argc, char** argv) : QMainWindow() initMidiSynth(); - QActionGroup *grp = populateAddTrack(addTrack); - - trackMidiAction = grp->actions()[0]; - trackDrumAction = grp->actions()[1]; - trackWaveAction = grp->actions()[2]; - trackAOutputAction = grp->actions()[3]; - trackAGroupAction = grp->actions()[4]; - trackAInputAction = grp->actions()[5]; - trackAAuxAction = grp->actions()[6]; + arrangerView->populateAddTrack(); + arrangerView->updateShortcuts(); transport = new Transport(this, "transport"); bigtime = 0; - QClipboard* cb = QApplication::clipboard(); - connect(cb, SIGNAL(dataChanged()), SLOT(clipboardChanged())); - connect(cb, SIGNAL(selectionChanged()), SLOT(clipboardChanged())); - connect(arranger, SIGNAL(selectionChanged()), SLOT(selectionChanged())); - //--------------------------------------------------- // load project // if no songname entered on command line: @@ -1495,7 +1021,7 @@ void MusE::loadProjectFile(const QString& name, bool songTemplate, bool loadAll) if (restartSequencer) seqStart(); - visTracks->updateVisibleTracksButtons(); + //visTracks->updateVisibleTracksButtons(); //TODO FINDMICHJETZT progress->setValue(100); delete progress; progress=0; @@ -1604,6 +1130,7 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll viewTransportAction->setChecked(config.transportVisible); viewBigtimeAction->setChecked(config.bigTimeVisible); viewMarkerAction->setChecked(config.markerVisible); + viewArrangerAction->setChecked(config.arrangerVisible); autoMixerAction->setChecked(automation); @@ -1649,9 +1176,9 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll loopAction->setChecked(song->loop()); song->update(); song->updatePos(); - clipboardChanged(); // enable/disable "Paste" - selectionChanged(); // enable/disable "Copy" & "Paste" - scoreNamingChanged(); // inform the score menus about the new scores and their names + arrangerView->clipboardChanged(); // enable/disable "Paste" + arrangerView->selectionChanged(); // enable/disable "Copy" & "Paste" + arrangerView->scoreNamingChanged(); // inform the score menus about the new scores and their names progress->setValue(50); // p3.3.53 Try this AFTER the song update above which does a mixer update... Tested OK - mixers resize properly now. @@ -1975,10 +1502,6 @@ void MusE::showMarker(bool flag) if (markerView == 0) { markerView = new MarkerView(this); - // Removed p3.3.43 - // Song::addMarker() already emits a 'markerChanged'. - //connect(arranger, SIGNAL(addMarker(int)), markerView, SLOT(addMarker(int))); - connect(markerView, SIGNAL(closed()), SLOT(markerClosed())); toplevels.push_back(Toplevel(Toplevel::MARKER, (unsigned long)(markerView), markerView)); markerView->show(); @@ -1996,6 +1519,34 @@ void MusE::markerClosed() viewMarkerAction->setChecked(false); } +//--------------------------------------------------------- +// toggleArranger +//--------------------------------------------------------- + +void MusE::toggleArranger(bool checked) + { + showArranger(checked); + } + +//--------------------------------------------------------- +// showArranger +//--------------------------------------------------------- + +void MusE::showArranger(bool flag) + { + arrangerView->setVisible(flag); + viewArrangerAction->setChecked(flag); + } + +//--------------------------------------------------------- +// arrangerClosed +//--------------------------------------------------------- + +void MusE::arrangerClosed() + { + viewArrangerAction->setChecked(false); + } + //--------------------------------------------------------- // toggleTransport //--------------------------------------------------------- @@ -2121,48 +1672,6 @@ PartList* MusE::getMidiPartsToEdit() return pl; } -void MusE::scoreNamingChanged() -{ - updateScoreMenus(); -} - -void MusE::updateScoreMenus() -{ - QAction* action; - - - scoreOneStaffPerTrackSubsubmenu->clear(); - scoreAllInOneSubsubmenu->clear(); - - - action=new QAction(tr("New"), this); - connect(action, SIGNAL(activated()), scoreOneStaffPerTrackMapper, SLOT(map())); - scoreOneStaffPerTrackMapper->setMapping(action, (QWidget*)NULL); - scoreOneStaffPerTrackSubsubmenu->addAction(action); - - - action=new QAction(tr("New"), this); //the above action may NOT be reused! - connect(action, SIGNAL(activated()), scoreAllInOneMapper, SLOT(map())); - scoreAllInOneMapper->setMapping(action, (QWidget*)NULL); - scoreAllInOneSubsubmenu->addAction(action); - - for (ToplevelList::iterator it=toplevels.begin(); it!=toplevels.end(); it++) - if (it->type()==Toplevel::SCORE) - { - ScoreEdit* score = (ScoreEdit*) it->cobject(); - - action=new QAction(score->get_name(), this); - connect(action, SIGNAL(activated()), scoreOneStaffPerTrackMapper, SLOT(map())); - scoreOneStaffPerTrackMapper->setMapping(action, (QWidget*)score); - scoreOneStaffPerTrackSubsubmenu->addAction(action); - - - action=new QAction(score->get_name(), this); //the above action may NOT be reused! - connect(action, SIGNAL(activated()), scoreAllInOneMapper, SLOT(map())); - scoreAllInOneMapper->setMapping(action, (QWidget*)score); - scoreAllInOneSubsubmenu->addAction(action); - } -} //--------------------------------------------------------- // startScoreEdit @@ -2194,12 +1703,12 @@ void MusE::openInScoreEdit(ScoreEdit* destination, PartList* pl, bool allInOne) destination->show(); toplevels.push_back(Toplevel(Toplevel::SCORE, (unsigned long)(destination), destination)); connect(destination, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long))); - connect(destination, SIGNAL(name_changed()), SLOT(scoreNamingChanged())); + connect(destination, SIGNAL(name_changed()), arrangerView, SLOT(scoreNamingChanged())); //connect(muse, SIGNAL(configChanged()), destination, SLOT(config_changed())); //commented out by flo, because the ScoreEditor connects to all //relevant signals on his own - updateScoreMenus(); + arrangerView->updateScoreMenus(); } destination->add_parts(pl, allInOne); @@ -2436,6 +1945,7 @@ void MusE::toplevelDeleted(unsigned long tl) bool mustUpdateScoreMenus=false; switch(i->type()) { case Toplevel::MARKER: + case Toplevel::ARRANGER: break; case Toplevel::CLIPLIST: // ORCAN: This needs to be verified. aid2 used to correspond to Cliplist: @@ -2457,7 +1967,7 @@ void MusE::toplevelDeleted(unsigned long tl) } toplevels.erase(i); if (mustUpdateScoreMenus) - updateScoreMenus(); + arrangerView->updateScoreMenus(); return; } } @@ -2465,27 +1975,7 @@ void MusE::toplevelDeleted(unsigned long tl) //assert(false); } -//--------------------------------------------------------- -// ctrlChanged -// midi ctrl value changed -//--------------------------------------------------------- -#if 0 -void MusE::ctrlChanged() - { - arranger->updateInspector(); - } -#endif - -//--------------------------------------------------------- -// keyPressEvent -//--------------------------------------------------------- - -void MusE::keyPressEvent(QKeyEvent* event) - { - // Pass it on to arranger part canvas. - arranger->getCanvas()->redirKeypress(event); - } //--------------------------------------------------------- // kbAccel @@ -2633,137 +2123,14 @@ static void catchSignal(int sig) } #endif -#if 0 -//--------------------------------------------------------- -// configPart -//--------------------------------------------------------- - -void MusE::configPart(int id) - { - if (id < 3) { - partConfig->setItemChecked(0, id == 0); - partConfig->setItemChecked(1, id == 1); - partConfig->setItemChecked(2, id == 2); - arranger->setShowPartType(id); - for (int i = 3; i < 10; ++i) { - partConfig->setItemEnabled(i, id == 2); - } - } - else { - bool flag = !partConfig->isItemChecked(id); - partConfig->setItemChecked(id, flag); - int val = arranger->showPartEvent(); - if (flag) { - val |= 1 << (id-3); - } - else { - val &= ~(1 << (id-3)); - } - arranger->setShowPartEvent(val); - } - } -#endif - //--------------------------------------------------------- // cmd // some cmd's from pulldown menu //--------------------------------------------------------- -void MusE::cmd(int cmd) +void MusE::cmd(int cmd) //FINDMICHJETZT { - TrackList* tracks = song->tracks(); - int l = song->lpos(); - int r = song->rpos(); - switch(cmd) { - case CMD_CUT: - arranger->cmd(Arranger::CMD_CUT_PART); - break; - case CMD_COPY: - arranger->cmd(Arranger::CMD_COPY_PART); - break; - case CMD_PASTE: - arranger->cmd(Arranger::CMD_PASTE_PART); - break; - case CMD_PASTE_CLONE: - arranger->cmd(Arranger::CMD_PASTE_CLONE_PART); - break; - case CMD_PASTE_TO_TRACK: - arranger->cmd(Arranger::CMD_PASTE_PART_TO_TRACK); - break; - case CMD_PASTE_CLONE_TO_TRACK: - arranger->cmd(Arranger::CMD_PASTE_CLONE_PART_TO_TRACK); - break; - case CMD_INSERT: - arranger->cmd(Arranger::CMD_INSERT_PART); - break; - case CMD_INSERTMEAS: - arranger->cmd(Arranger::CMD_INSERT_EMPTYMEAS); - break; - case CMD_DELETE: - if (!song->msgRemoveParts()) //automatically does undo if neccessary and returns true then - { - //msgRemoveParts() returned false -> no parts to remove? - song->startUndo(); - audio->msgRemoveTracks(); //TODO FINDME this could still be speeded up! - song->endUndo(SC_TRACK_REMOVED); - } - break; - case CMD_DELETE_TRACK: - song->startUndo(); - audio->msgRemoveTracks(); - song->endUndo(SC_TRACK_REMOVED); - audio->msgUpdateSoloStates(); - break; - - case CMD_SELECT_ALL: - case CMD_SELECT_NONE: - case CMD_SELECT_INVERT: - case CMD_SELECT_ILOOP: - case CMD_SELECT_OLOOP: - for (iTrack i = tracks->begin(); i != tracks->end(); ++i) { - PartList* parts = (*i)->parts(); - for (iPart p = parts->begin(); p != parts->end(); ++p) { - bool f = false; - int t1 = p->second->tick(); - int t2 = t1 + p->second->lenTick(); - bool inside = - ((t1 >= l) && (t1 < r)) - || ((t2 > l) && (t2 < r)) - || ((t1 <= l) && (t2 > r)); - switch(cmd) { - case CMD_SELECT_INVERT: - f = !p->second->selected(); - break; - case CMD_SELECT_NONE: - f = false; - break; - case CMD_SELECT_ALL: - f = true; - break; - case CMD_SELECT_ILOOP: - f = inside; - break; - case CMD_SELECT_OLOOP: - f = !inside; - break; - } - p->second->setSelected(f); - } - } - song->update(); - break; - - case CMD_SELECT_PARTS: - for (iTrack i = tracks->begin(); i != tracks->end(); ++i) { - if (!(*i)->selected()) - continue; - PartList* parts = (*i)->parts(); - for (iPart p = parts->begin(); p != parts->end(); ++p) - p->second->setSelected(true); - } - song->update(); - break; case CMD_FOLLOW_NO: song->setFollow(Song::NO); setFollow(); @@ -2776,43 +2143,10 @@ void MusE::cmd(int cmd) song->setFollow(Song::CONTINUOUS); setFollow(); break; - - case CMD_SHRINK_PART: shrink_parts(); break; - case CMD_EXPAND_PART: expand_parts(); break; - case CMD_CLEAN_PART: clean_parts(); break; } } -//--------------------------------------------------------- -// clipboardChanged -//--------------------------------------------------------- -void MusE::clipboardChanged() - { - bool flag = false; - if(QApplication::clipboard()->mimeData()->hasFormat(QString("text/x-muse-midipartlist")) || - QApplication::clipboard()->mimeData()->hasFormat(QString("text/x-muse-wavepartlist")) || - QApplication::clipboard()->mimeData()->hasFormat(QString("text/x-muse-mixedpartlist"))) - flag = true; - - editPasteAction->setEnabled(flag); - editInsertAction->setEnabled(flag); - editPasteCloneAction->setEnabled(flag); - editPaste2TrackAction->setEnabled(flag); - editPasteC2TAction->setEnabled(flag); - } - -//--------------------------------------------------------- -// selectionChanged -//--------------------------------------------------------- - -void MusE::selectionChanged() - { - //bool flag = arranger->isSingleSelection(); // -- Hmm, why only single? - bool flag = arranger->selectionSize() > 0; // -- Test OK cut and copy. For muse2. Tim. - editCutAction->setEnabled(flag); - editCopyAction->setEnabled(flag); - } @@ -3240,6 +2574,7 @@ again: switch (tl.type()) { case Toplevel::CLIPLIST: case Toplevel::MARKER: + case Toplevel::ARRANGER: break; case Toplevel::PIANO_ROLL: case Toplevel::SCORE: @@ -3346,41 +2681,7 @@ void MusE::updateConfiguration() undoAction->setShortcut(shortcuts[SHRT_UNDO].key); redoAction->setShortcut(shortcuts[SHRT_REDO].key); - editCutAction->setShortcut(shortcuts[SHRT_CUT].key); - editCopyAction->setShortcut(shortcuts[SHRT_COPY].key); - editPasteAction->setShortcut(shortcuts[SHRT_PASTE].key); - editInsertAction->setShortcut(shortcuts[SHRT_INSERT].key); - editInsertEMAction->setShortcut(shortcuts[SHRT_INSERTMEAS].key); - editPasteCloneAction->setShortcut(shortcuts[SHRT_PASTE_CLONE].key); - editPaste2TrackAction->setShortcut(shortcuts[SHRT_PASTE_TO_TRACK].key); - editPasteC2TAction->setShortcut(shortcuts[SHRT_PASTE_CLONE_TO_TRACK].key); - //editDeleteSelectedAction has no acceleration - - trackMidiAction->setShortcut(shortcuts[SHRT_ADD_MIDI_TRACK].key); - trackDrumAction->setShortcut(shortcuts[SHRT_ADD_DRUM_TRACK].key); - trackWaveAction->setShortcut(shortcuts[SHRT_ADD_WAVE_TRACK].key); - trackAOutputAction->setShortcut(shortcuts[SHRT_ADD_AUDIO_OUTPUT].key); - trackAGroupAction->setShortcut(shortcuts[SHRT_ADD_AUDIO_GROUP].key); - trackAInputAction->setShortcut(shortcuts[SHRT_ADD_AUDIO_INPUT].key); - trackAAuxAction->setShortcut(shortcuts[SHRT_ADD_AUDIO_AUX].key); - - editSelectAllAction->setShortcut(shortcuts[SHRT_SELECT_ALL].key); - editDeselectAllAction->setShortcut(shortcuts[SHRT_SELECT_NONE].key); - editInvertSelectionAction->setShortcut(shortcuts[SHRT_SELECT_INVERT].key); - editInsideLoopAction->setShortcut(shortcuts[SHRT_SELECT_OLOOP].key); - editOutsideLoopAction->setShortcut(shortcuts[SHRT_SELECT_OLOOP].key); - editAllPartsAction->setShortcut(shortcuts[SHRT_SELECT_PRTSTRACK].key); - - startPianoEditAction->setShortcut(shortcuts[SHRT_OPEN_PIANO].key); - startDrumEditAction->setShortcut(shortcuts[SHRT_OPEN_DRUMS].key); - startListEditAction->setShortcut(shortcuts[SHRT_OPEN_LIST].key); - startWaveEditAction->setShortcut(shortcuts[SHRT_OPEN_WAVE].key); - - masterGraphicAction->setShortcut(shortcuts[SHRT_OPEN_GRAPHIC_MASTER].key); - masterListAction->setShortcut(shortcuts[SHRT_OPEN_LIST_MASTER].key); - - midiTransformerAction->setShortcut(shortcuts[SHRT_OPEN_MIDI_TRANSFORM].key); //editSongInfoAction has no acceleration viewTransportAction->setShortcut(shortcuts[SHRT_OPEN_TRANSPORT].key); @@ -3390,11 +2691,6 @@ void MusE::updateConfiguration() //viewCliplistAction has no acceleration viewMarkerAction->setShortcut(shortcuts[SHRT_OPEN_MARKER].key); - strGlobalCutAction->setShortcut(shortcuts[SHRT_GLOBAL_CUT].key); - strGlobalInsertAction->setShortcut(shortcuts[SHRT_GLOBAL_INSERT].key); - strGlobalSplitAction->setShortcut(shortcuts[SHRT_GLOBAL_SPLIT].key); - strCopyRangeAction->setShortcut(shortcuts[SHRT_COPY_RANGE].key); - strCutEventsAction->setShortcut(shortcuts[SHRT_CUT_EVENTS].key); // midiEditInstAction does not have acceleration midiResetInstAction->setShortcut(shortcuts[SHRT_MIDI_RESET].key); @@ -3435,6 +2731,8 @@ void MusE::updateConfiguration() //menuSettings->setAccel(shortcuts[SHRT_CONFIG_AUDIO_PORTS].key, menu_ids[CMD_CONFIG_AUDIO_PORTS]); //menu_help->setAccel(menu_ids[CMD_START_WHATSTHIS], shortcuts[SHRT_START_WHATSTHIS].key); + //arrangerView->updateShortcuts(); //FINDMICHJETZT is done via signal + } //--------------------------------------------------------- @@ -3569,14 +2867,6 @@ void MusE::focusInEvent(QFocusEvent* ev) QMainWindow::focusInEvent(ev); } -//--------------------------------------------------------- -// setUsedTool -//--------------------------------------------------------- - -void MusE::setUsedTool(int tool) - { - tools1->set(tool); - } //--------------------------------------------------------- diff --git a/muse2/muse/app.h b/muse2/muse/app.h index ccf3706b..9b46d6f7 100644 --- a/muse2/muse/app.h +++ b/muse2/muse/app.h @@ -26,7 +26,6 @@ class QString; class QToolBar; class QToolButton; class QProgressDialog; -class VisibleTracks; class EditToolBar; class Part; @@ -49,6 +48,7 @@ class AudioRecord; class MidiFileConfig; class MidiFilterConfig; class MarkerView; +class ArrangerView; class GlobalSettingsConfig; class MidiControllerEditDialog; class MidiInputTransformDialog; @@ -75,13 +75,7 @@ class Undo; class MusE : public QMainWindow { Q_OBJECT - enum {CMD_CUT, CMD_COPY, CMD_PASTE, CMD_INSERT, CMD_INSERTMEAS, CMD_PASTE_CLONE, - CMD_PASTE_TO_TRACK, CMD_PASTE_CLONE_TO_TRACK, CMD_DELETE, - CMD_SELECT_ALL, CMD_SELECT_NONE, CMD_SELECT_INVERT, - CMD_SELECT_ILOOP, CMD_SELECT_OLOOP, CMD_SELECT_PARTS, - CMD_FOLLOW_NO, CMD_FOLLOW_JUMP, CMD_FOLLOW_CONTINUOUS , - CMD_DELETE_TRACK, CMD_EXPAND_PART, CMD_SHRINK_PART, CMD_CLEAN_PART - }; + enum {CMD_FOLLOW_NO, CMD_FOLLOW_JUMP, CMD_FOLLOW_CONTINUOUS }; //File menu items: enum { CMD_OPEN_RECENT=0, CMD_LOAD_TEMPLATE, CMD_SAVE_AS, CMD_IMPORT_MIDI, @@ -101,26 +95,11 @@ class MusE : public QMainWindow QAction *fileSaveAction, *fileOpenAction, *fileNewAction, *testAction; QAction *fileSaveAsAction, *fileImportMidiAction, *fileExportMidiAction; QAction *fileImportPartAction, *fileImportWaveAction, *fileMoveWaveFiles, *quitAction; - - // Edit Menu actions - QAction *editCutAction, *editCopyAction, *editPasteAction, *editInsertAction, *editPasteCloneAction, *editPaste2TrackAction; - QAction *editInsertEMAction, *editPasteC2TAction, *editDeleteSelectedAction, *editSelectAllAction, *editDeselectAllAction; - QAction *editInvertSelectionAction, *editInsideLoopAction, *editOutsideLoopAction, *editAllPartsAction; - QAction *trackMidiAction, *trackDrumAction, *trackWaveAction, *trackAOutputAction, *trackAGroupAction; - QAction *trackAInputAction, *trackAAuxAction; - QAction *masterGraphicAction, *masterListAction; - QAction *midiTransformerAction; QAction *editSongInfoAction; - QAction *editCleanPartsAction, *editShrinkPartsAction, *editExpandPartsAction; - public: - QAction *startScoreEditAction, *startPianoEditAction, *startDrumEditAction, *startListEditAction, *startWaveEditAction; - QMenu *scoreSubmenu, *scoreOneStaffPerTrackSubsubmenu, *scoreAllInOneSubsubmenu; + private: // View Menu actions - QAction *viewTransportAction, *viewBigtimeAction, *viewMixerAAction, *viewMixerBAction, *viewCliplistAction, *viewMarkerAction; - - // Structure Menu actions - QAction *strGlobalCutAction, *strGlobalInsertAction, *strGlobalSplitAction, *strCopyRangeAction, *strCutEventsAction; + QAction *viewTransportAction, *viewBigtimeAction, *viewMixerAAction, *viewMixerBAction, *viewCliplistAction, *viewMarkerAction, *viewArrangerAction; // Midi Menu Actions QAction *midiEditInstAction, *midiResetInstAction, *midiInitInstActions, *midiLocalOffAction; @@ -147,18 +126,14 @@ class MusE : public QMainWindow QFileInfo project; QToolBar *tools; - EditToolBar *tools1; - VisibleTracks *visTracks; Transport* transport; BigTime* bigtime; EditInstrument* editInstrument; QMenu *menu_file, *menuView, *menuSettings, *menu_help; - QMenu *menuEdit, *menuStructure; QMenu* menu_audio, *menuAutomation, *menuUtils; QMenu* menu_functions, *menuScriptPlugins; - QMenu* select, *master, *midiEdit, *addTrack; // Special common menu for routes. Used (so far) by audio and midi strip, and midi trackinfo. RoutePopupMenu* routingPopupMenu; @@ -185,6 +160,7 @@ class MusE : public QMainWindow ToplevelList toplevels; ClipListEdit* clipListEdit; MarkerView* markerView; + ArrangerView* arrangerView; MidiTransformerDialog* midiTransformerDialog; QMenu* openRecent; @@ -214,13 +190,9 @@ class MusE : public QMainWindow void updateConfiguration(); virtual void focusInEvent(QFocusEvent*); - virtual void keyPressEvent(QKeyEvent*); // p4.0.10 Tim. - QSignalMapper *editSignalMapper; QSignalMapper *midiPluginSignalMapper; QSignalMapper *followSignalMapper; - QSignalMapper *scoreOneStaffPerTrackMapper; - QSignalMapper *scoreAllInOneMapper; signals: void configChanged(); @@ -244,6 +216,7 @@ class MusE : public QMainWindow void toggleTransport(bool); void toggleMarker(bool); + void toggleArranger(bool); void toggleBigTime(bool); void toggleMixer1(bool); void toggleMixer2(bool); @@ -253,30 +226,9 @@ class MusE : public QMainWindow void configShortCuts(); void configMetronome(); void configAppearance(); - void startEditor(PartList*, int); - void startMasterEditor(); - void startLMasterEditor(); - void startListEditor(); - void startListEditor(PartList*); - void startDrumEditor(); - void startDrumEditor(PartList* /*pl*/, bool /*showDefaultCtrls*/ = false); - void startEditor(Track*); - void openInScoreEdit(ScoreEdit* destination, PartList* pl, bool allInOne=false); - void openInScoreEdit(ScoreEdit* destination, bool allInOne=false); - void openInScoreEdit_allInOne(QWidget* destination); - void openInScoreEdit_oneStaffPerTrack(QWidget* destination); - void clearScoreMenuMappers(); - void updateScoreMenus(); - void scoreNamingChanged(); - void startScoreQuickly(); - void startPianoroll(); - void startPianoroll(PartList* /*pl*/, bool /*showDefaultCtrls*/ = false); - void startWaveEditor(); - void startWaveEditor(PartList*); void startSongInfo(bool editable=true); - void startMidiTransformer(); void writeGlobalConfiguration() const; //void startEditInstrument(); void startClipList(bool); @@ -284,8 +236,6 @@ class MusE : public QMainWindow void openRecentMenu(); void selectProject(QAction* act); void cmd(int); - void clipboardChanged(); - void selectionChanged(); /* void copyMeasure(); // commented out by flo: these are not implemented, void eraseMeasure(); // but maybe will be in future (state: revision 988) void deleteMeasure(); @@ -300,11 +250,6 @@ class MusE : public QMainWindow #ifdef BUILD_EXPERIMENTAL void hideMidiRhythmGenerator(); #endif - void globalCut(); - void globalInsert(); - void globalSplit(); - void copyRange(); - void cutEvents(); void bounceToTrack(); void resetMidiDevices(); void initMidiDevices(); @@ -316,11 +261,10 @@ class MusE : public QMainWindow void mixer1Closed(); void mixer2Closed(); void markerClosed(); + void arrangerClosed(); void execDeliveredScript(int); void execUserScript(int); - private: - void adjustGlobalLists(Undo& operations, int startPos, int diff); public slots: bool saveAs(); @@ -337,12 +281,31 @@ class MusE : public QMainWindow void showMixer1(bool); void showMixer2(bool); void showMarker(bool); + void showArranger(bool); void importMidi(const QString &file); - void setUsedTool(int); void showDidYouKnowDialog(); void startEditInstrument(); void configMidiPorts(); + void startEditor(PartList*, int); + void startScoreQuickly(); + void startPianoroll(); + void startPianoroll(PartList* /*pl*/, bool /*showDefaultCtrls*/ = false); + void startWaveEditor(); + void startWaveEditor(PartList*); + void openInScoreEdit(ScoreEdit* destination, PartList* pl, bool allInOne=false); + void openInScoreEdit(ScoreEdit* destination, bool allInOne=false); + void openInScoreEdit_allInOne(QWidget* destination); + void openInScoreEdit_oneStaffPerTrack(QWidget* destination); + void startMasterEditor(); + void startLMasterEditor(); + void startListEditor(); + void startListEditor(PartList*); + void startDrumEditor(); + void startDrumEditor(PartList* /*pl*/, bool /*showDefaultCtrls*/ = false); + void startEditor(Track*); + void startMidiTransformer(); + public: MusE(int argc, char** argv); ~MusE(); @@ -366,6 +329,8 @@ class MusE : public QMainWindow void showTransport(bool flag); RoutePopupMenu* getRoutingPopupMenu(); + const ToplevelList* getToplevels() { return &toplevels; } + #ifdef HAVE_LASH void lash_idle_cb (); #endif diff --git a/muse2/muse/arranger/CMakeLists.txt b/muse2/muse/arranger/CMakeLists.txt index c681245e..b679a37a 100644 --- a/muse2/muse/arranger/CMakeLists.txt +++ b/muse2/muse/arranger/CMakeLists.txt @@ -24,6 +24,7 @@ QT4_WRAP_CPP (arranger_mocs alayout.h arranger.h + arrangerview.h pcanvas.h tlist.h ) @@ -34,6 +35,7 @@ QT4_WRAP_CPP (arranger_mocs file (GLOB arranger_source_files alayout.cpp arranger.cpp + arrangerview.cpp pcanvas.cpp tlist.cpp ) diff --git a/muse2/muse/arranger/arranger.cpp b/muse2/muse/arranger/arranger.cpp index e1205d6f..0ca0b66d 100644 --- a/muse2/muse/arranger/arranger.cpp +++ b/muse2/muse/arranger/arranger.cpp @@ -23,6 +23,7 @@ #include #include //#include +#include "arrangerview.h" #include "arranger.h" #include "song.h" @@ -96,7 +97,7 @@ void Arranger::setHeaderWhatsThis() // is the central widget in app //--------------------------------------------------------- -Arranger::Arranger(QMainWindow* parent, const char* name) +Arranger::Arranger(ArrangerView* parent, const char* name) : QWidget(parent) { setObjectName(name); @@ -112,6 +113,8 @@ Arranger::Arranger(QMainWindow* parent, const char* name) cursVal = MAXINT; + parentWin=parent; + //setFocusPolicy(Qt::StrongFocus); //--------------------------------------------------- diff --git a/muse2/muse/arranger/arranger.h b/muse2/muse/arranger/arranger.h index 262d7464..433cf28f 100644 --- a/muse2/muse/arranger/arranger.h +++ b/muse2/muse/arranger/arranger.h @@ -38,6 +38,7 @@ class TLLayout; class WidgetStack; class AudioStrip; class SpinBox; +class ArrangerView; //--------------------------------------------------------- // WidgetStack @@ -152,7 +153,7 @@ class Arranger : public QWidget { enum { CMD_CUT_PART, CMD_COPY_PART, CMD_PASTE_PART, CMD_PASTE_CLONE_PART, CMD_PASTE_PART_TO_TRACK, CMD_PASTE_CLONE_PART_TO_TRACK, CMD_INSERT_PART, CMD_INSERT_EMPTYMEAS }; - Arranger(QMainWindow* parent, const char* name = 0); + Arranger(ArrangerView* parent, const char* name = 0); PartCanvas* getCanvas() { return canvas; } void setMode(int); @@ -169,6 +170,8 @@ class Arranger : public QWidget { void clear(); unsigned cursorValue() { return cursVal; } + + ArrangerView* parentWin; }; #endif diff --git a/muse2/muse/arranger/arrangerview.cpp b/muse2/muse/arranger/arrangerview.cpp new file mode 100644 index 00000000..46685ce6 --- /dev/null +++ b/muse2/muse/arranger/arrangerview.cpp @@ -0,0 +1,875 @@ +//========================================================= +// MusE +// Linux Music Editor +// arrangerview.cpp +// (C) Copyright 2011 Florian Jung (flo93@users.sourceforge.net) +//========================================================= + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "arrangerview.h" +#include "visibletracks.h" + + +#include +#include +using namespace std; + +#include "app.h" +#include "xml.h" +#include "mtscale.h" +#include "al/sig.h" +#include "scoreedit.h" +#include "tools.h" +#include "ttoolbar.h" +#include "tb1.h" +#include "globals.h" +#include "gconfig.h" +#include "icons.h" +#include "audio.h" +#include "functions.h" +#include "helper.h" +#include "sig.h" +#include "song.h" +#include "shortcuts.h" +#include "synth.h" + +#ifdef DSSI_SUPPORT +#include "dssihost.h" +#endif + +#ifdef VST_SUPPORT +#include "vst.h" +#endif + + +//--------------------------------------------------------- +// populateAddSynth +//--------------------------------------------------------- + +// ORCAN - CHECK +QMenu* populateAddSynth(QWidget* parent) +{ + QMenu* synp = new QMenu(parent); + + //typedef std::multimap asmap; + typedef std::multimap asmap; + + //typedef std::multimap::iterator imap; + typedef std::multimap::iterator imap; + + MessSynth* synMESS = 0; + QMenu* synpMESS = 0; + asmap mapMESS; + + #ifdef DSSI_SUPPORT + DssiSynth* synDSSI = 0; + QMenu* synpDSSI = 0; + asmap mapDSSI; + #endif + + #ifdef VST_SUPPORT + VstSynth* synVST = 0; + QMenu* synpVST = 0; + asmap mapVST; + #endif + + // Not necessary, but what the heck. + QMenu* synpOther = 0; + asmap mapOther; + + //const int synth_base_id = 0x1000; + int ii = 0; + for(std::vector::iterator i = synthis.begin(); i != synthis.end(); ++i) + { + synMESS = dynamic_cast(*i); + if(synMESS) + { + mapMESS.insert( std::pair (std::string(synMESS->description().toLower().toLatin1().constData()), ii) ); + } + else + { + + #ifdef DSSI_SUPPORT + synDSSI = dynamic_cast(*i); + if(synDSSI) + { + mapDSSI.insert( std::pair (std::string(synDSSI->description().toLower().toLatin1().constData()), ii) ); + } + else + #endif + + { + #ifdef VST_SUPPORT + synVST = dynamic_cast(*i); + if(synVST) + { + mapVST.insert( std::pair (std::string(synVST->description().toLower().toLatin1().constData()), ii) ); + } + else + #endif + + { + mapOther.insert( std::pair (std::string((*i)->description().toLower().toLatin1().constData()), ii) ); + } + } + } + + ++ii; + } + + int sz = synthis.size(); + for(imap i = mapMESS.begin(); i != mapMESS.end(); ++i) + { + int idx = i->second; + if(idx > sz) // Sanity check + continue; + Synth* s = synthis[idx]; + if(s) + { + // No MESS sub-menu yet? Create it now. + if(!synpMESS) + synpMESS = new QMenu(parent); + QAction* sM = synpMESS->addAction(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">"); + sM->setData(MENU_ADD_SYNTH_ID_BASE + idx); + } + } + + #ifdef DSSI_SUPPORT + for(imap i = mapDSSI.begin(); i != mapDSSI.end(); ++i) + { + int idx = i->second; + if(idx > sz) + continue; + Synth* s = synthis[idx]; + if(s) + { + // No DSSI sub-menu yet? Create it now. + if(!synpDSSI) + synpDSSI = new QMenu(parent); + //synpDSSI->insertItem(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">", MENU_ADD_SYNTH_ID_BASE + idx); + QAction* sD = synpDSSI->addAction(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">"); + sD->setData(MENU_ADD_SYNTH_ID_BASE + idx); + } + } + #endif + + #ifdef VST_SUPPORT + for(imap i = mapVST.begin(); i != mapVST.end(); ++i) + { + int idx = i->second; + if(idx > sz) + continue; + Synth* s = synthis[idx]; + if(s) + { + // No VST sub-menu yet? Create it now. + if(!synpVST) + synpVST = new QMenu(parent); + QAction* sV = synpVST->addAction(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">"); + sV->setData(MENU_ADD_SYNTH_ID_BASE + idx); + } + } + #endif + + for(imap i = mapOther.begin(); i != mapOther.end(); ++i) + { + int idx = i->second; + if(idx > sz) + continue; + Synth* s = synthis[idx]; + // No Other sub-menu yet? Create it now. + if(!synpOther) + synpOther = new QMenu(parent); + //synpOther->insertItem(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">", MENU_ADD_SYNTH_ID_BASE + idx); + QAction* sO = synpOther->addAction(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">"); + sO->setData(MENU_ADD_SYNTH_ID_BASE + idx); + } + + if(synpMESS) + { + synpMESS->setIcon(*synthIcon); + synpMESS->setTitle(QT_TRANSLATE_NOOP("@default", "MESS")); + synp->addMenu(synpMESS); + } + + #ifdef DSSI_SUPPORT + if(synpDSSI) + { + synpDSSI->setIcon(*synthIcon); + synpDSSI->setTitle(QT_TRANSLATE_NOOP("@default", "DSSI")); + synp->addMenu(synpDSSI); + } + #endif + + #ifdef VST_SUPPORT + if(synpVST) + { + synpVST->setIcon(*synthIcon); + synpVST->setTitle(QT_TRANSLATE_NOOP("@default", "FST")); + synp->addMenu(synpVST); + } + #endif + + if(synpOther) + { + synpOther->setIcon(*synthIcon); + synpOther->setTitle(QObject::tr("Other")); + synp->addMenu(synpOther); + } + + return synp; +} + + +//--------------------------------------------------------- +// populateAddTrack +// this is also used in "mixer" +//--------------------------------------------------------- + +QActionGroup* populateAddTrack(QMenu* addTrack) + { + QActionGroup* grp = new QActionGroup(addTrack); + + QAction* midi = addTrack->addAction(QIcon(*addtrack_addmiditrackIcon), + QT_TRANSLATE_NOOP("@default", "Add Midi Track")); + midi->setData(Track::MIDI); + grp->addAction(midi); + QAction* drum = addTrack->addAction(QIcon(*addtrack_drumtrackIcon), + QT_TRANSLATE_NOOP("@default", "Add Drum Track")); + drum->setData(Track::DRUM); + grp->addAction(drum); + QAction* wave = addTrack->addAction(QIcon(*addtrack_wavetrackIcon), + QT_TRANSLATE_NOOP("@default", "Add Wave Track")); + wave->setData(Track::WAVE); + grp->addAction(wave); + QAction* aoutput = addTrack->addAction(QIcon(*addtrack_audiooutputIcon), + QT_TRANSLATE_NOOP("@default", "Add Audio Output")); + aoutput->setData(Track::AUDIO_OUTPUT); + grp->addAction(aoutput); + QAction* agroup = addTrack->addAction(QIcon(*addtrack_audiogroupIcon), + QT_TRANSLATE_NOOP("@default", "Add Audio Group")); + agroup->setData(Track::AUDIO_GROUP); + grp->addAction(agroup); + QAction* ainput = addTrack->addAction(QIcon(*addtrack_audioinputIcon), + QT_TRANSLATE_NOOP("@default", "Add Audio Input")); + ainput->setData(Track::AUDIO_INPUT); + grp->addAction(ainput); + QAction* aaux = addTrack->addAction(QIcon(*addtrack_auxsendIcon), + QT_TRANSLATE_NOOP("@default", "Add Aux Send")); + aaux->setData(Track::AUDIO_AUX); + grp->addAction(aaux); + + // Create a sub-menu and fill it with found synth types. Make addTrack the owner. + QMenu* synp = populateAddSynth(addTrack); + synp->setIcon(*synthIcon); + synp->setTitle(QT_TRANSLATE_NOOP("@default", "Add Synth")); + + // Add the sub-menu to the given menu. + addTrack->addMenu(synp); + + QObject::connect(addTrack, SIGNAL(triggered(QAction *)), song, SLOT(addNewTrack(QAction *))); + + return grp; + } + + + + + +//--------------------------------------------------------- +// ArrangerView +//--------------------------------------------------------- + +ArrangerView::ArrangerView(QWidget* parent) + : TopWin(parent, "arrangerview", Qt::Window) +{ + //setAttribute(Qt::WA_DeleteOnClose); + setWindowTitle(tr("MusE: Arranger")); + setFocusPolicy(Qt::StrongFocus); + + + arranger = new Arranger(this, "arranger"); + setCentralWidget(arranger); + + scoreOneStaffPerTrackMapper = new QSignalMapper(this); + scoreAllInOneMapper = new QSignalMapper(this); + + editSignalMapper = new QSignalMapper(this); + QShortcut* sc = new QShortcut(shortcuts[SHRT_DELETE].key, this); + sc->setContext(Qt::WindowShortcut); + connect(sc, SIGNAL(activated()), editSignalMapper, SLOT(map())); + editSignalMapper->setMapping(sc, CMD_DELETE); + + // Toolbars --------------------------------------------------------- + QToolBar* undo_tools=addToolBar(tr("Undo/Redo tools")); + undo_tools->setObjectName("Undo/Redo tools"); + undo_tools->addActions(undoRedo->actions()); + addToolBar(undo_tools); + + + QToolBar* panic_toolbar = addToolBar(tr("panic")); + panic_toolbar->setObjectName("panic"); + panic_toolbar->addAction(panicAction); + + QToolBar* transport_toolbar = addToolBar(tr("transport")); + transport_toolbar->setObjectName("transport"); + transport_toolbar->addActions(transportAction->actions()); + + editTools = new EditToolBar(this, arrangerTools); + addToolBar(editTools); + editTools->setObjectName("arrangerTools"); + + visTracks = new VisibleTracks(this); + addToolBar(visTracks); + + + + connect(editTools, SIGNAL(toolChanged(int)), arranger, SLOT(setTool(int))); + connect(visTracks, SIGNAL(visibilityChanged()), song, SLOT(update()) ); + connect(arranger, SIGNAL(editPart(Track*)), muse, SLOT(startEditor(Track*))); + connect(arranger, SIGNAL(dropSongFile(const QString&)), muse, SLOT(loadProjectFile(const QString&))); + connect(arranger, SIGNAL(dropMidiFile(const QString&)), muse, SLOT(importMidi(const QString&))); + connect(arranger, SIGNAL(startEditor(PartList*,int)), muse, SLOT(startEditor(PartList*,int))); + connect(arranger, SIGNAL(toolChanged(int)), editTools, SLOT(set(int))); + connect(muse, SIGNAL(configChanged()), arranger, SLOT(configChanged())); + connect(arranger, SIGNAL(setUsedTool(int)), editTools, SLOT(set(int))); + connect(arranger, SIGNAL(selectionChanged()), SLOT(selectionChanged())); + + + + + + + //-------- Edit Actions + editCutAction = new QAction(QIcon(*editcutIconSet), tr("C&ut"), this); + editCopyAction = new QAction(QIcon(*editcopyIconSet), tr("&Copy"), this); + editPasteAction = new QAction(QIcon(*editpasteIconSet), tr("&Paste"), this); + editInsertAction = new QAction(QIcon(*editpasteIconSet), tr("&Insert"), this); + editInsertEMAction = new QAction(QIcon(*editpasteIconSet), tr("&Insert Empty Measure"), this); + editPasteCloneAction = new QAction(QIcon(*editpasteCloneIconSet), tr("Paste c&lone"), this); + editPaste2TrackAction = new QAction(QIcon(*editpaste2TrackIconSet), tr("Paste to &track"), this); + editPasteC2TAction = new QAction(QIcon(*editpasteClone2TrackIconSet), tr("Paste clone to trac&k"), this); + editDeleteSelectedAction = new QAction(QIcon(*edit_track_delIcon), tr("Delete Selected Tracks"), this); + + editShrinkPartsAction = new QAction(tr("Shrink selected parts"), this); //FINDMICH TODO tooltips! + editExpandPartsAction = new QAction(tr("Expand selected parts"), this); + editCleanPartsAction = new QAction(tr("Clean selected parts"), this); + + + addTrack = new QMenu(tr("Add Track"), this); + addTrack->setIcon(QIcon(*edit_track_addIcon)); + select = new QMenu(tr("Select"), this); + select->setIcon(QIcon(*selectIcon)); + + editSelectAllAction = new QAction(QIcon(*select_allIcon), tr("Select &All"), this); + editDeselectAllAction = new QAction(QIcon(*select_deselect_allIcon), tr("&Deselect All"), this); + editInvertSelectionAction = new QAction(QIcon(*select_invert_selectionIcon), tr("Invert &Selection"), this); + editInsideLoopAction = new QAction(QIcon(*select_inside_loopIcon), tr("&Inside Loop"), this); + editOutsideLoopAction = new QAction(QIcon(*select_outside_loopIcon), tr("&Outside Loop"), this); + editAllPartsAction = new QAction( QIcon(*select_all_parts_on_trackIcon), tr("All &Parts on Track"), this); + + + scoreSubmenu = new QMenu(tr("Score"), this); + scoreSubmenu->setIcon(QIcon(*scoreIconSet)); + + scoreAllInOneSubsubmenu = new QMenu(tr("all parts in one staff"), this); + scoreOneStaffPerTrackSubsubmenu = new QMenu(tr("one staff per part"), this); + + scoreSubmenu->addMenu(scoreAllInOneSubsubmenu); + scoreSubmenu->addMenu(scoreOneStaffPerTrackSubsubmenu); + updateScoreMenus(); + + startScoreEditAction = new QAction(*scoreIconSet, tr("New score window"), this); + startPianoEditAction = new QAction(*pianoIconSet, tr("Pianoroll"), this); + startDrumEditAction = new QAction(QIcon(*edit_drummsIcon), tr("Drums"), this); + startListEditAction = new QAction(QIcon(*edit_listIcon), tr("List"), this); + startWaveEditAction = new QAction(QIcon(*edit_waveIcon), tr("Wave"), this); + + master = new QMenu(tr("Mastertrack"), this); + master->setIcon(QIcon(*edit_mastertrackIcon)); + masterGraphicAction = new QAction(QIcon(*mastertrack_graphicIcon),tr("Graphic"), this); + masterListAction = new QAction(QIcon(*mastertrack_listIcon),tr("List"), this); + + midiTransformerAction = new QAction(QIcon(*midi_transformIcon), tr("Midi &Transform"), this); + + + //-------- Structure Actions + strGlobalCutAction = new QAction(tr("Global Cut"), this); + strGlobalInsertAction = new QAction(tr("Global Insert"), this); + strGlobalSplitAction = new QAction(tr("Global Split"), this); + strCopyRangeAction = new QAction(tr("Copy Range"), this); + strCopyRangeAction->setEnabled(false); + strCutEventsAction = new QAction(tr("Cut Events"), this); + strCutEventsAction->setEnabled(false); + + + + //------------------------------------------------------------- + // popup Edit + //------------------------------------------------------------- + + QMenu* menuEdit = menuBar()->addMenu(tr("&Edit")); + menuEdit->addActions(undoRedo->actions()); + menuEdit->addSeparator(); + + menuEdit->addAction(editCutAction); + menuEdit->addAction(editCopyAction); + menuEdit->addAction(editPasteAction); + menuEdit->addAction(editInsertAction); + menuEdit->addAction(editInsertEMAction); + menuEdit->addAction(editPasteCloneAction); + menuEdit->addAction(editPaste2TrackAction); + menuEdit->addAction(editPasteC2TAction); + menuEdit->addSeparator(); + menuEdit->addAction(editShrinkPartsAction); + menuEdit->addAction(editExpandPartsAction); + menuEdit->addAction(editCleanPartsAction); + menuEdit->addSeparator(); + menuEdit->addAction(editDeleteSelectedAction); + + menuEdit->addMenu(addTrack); + menuEdit->addMenu(select); + select->addAction(editSelectAllAction); + select->addAction(editDeselectAllAction); + select->addAction(editInvertSelectionAction); + select->addAction(editInsideLoopAction); + select->addAction(editOutsideLoopAction); + select->addAction(editAllPartsAction); + menuEdit->addSeparator(); + + menuEdit->addAction(startPianoEditAction); + menuEdit->addMenu(scoreSubmenu); + menuEdit->addAction(startScoreEditAction); + menuEdit->addAction(startDrumEditAction); + menuEdit->addAction(startListEditAction); + menuEdit->addAction(startWaveEditAction); + + menuEdit->addMenu(master); + master->addAction(masterGraphicAction); + master->addAction(masterListAction); + menuEdit->addSeparator(); + + menuEdit->addAction(midiTransformerAction); + + QMenu* menuStructure = menuEdit->addMenu(tr("&Structure")); + menuStructure->addAction(strGlobalCutAction); + menuStructure->addAction(strGlobalInsertAction); + menuStructure->addAction(strGlobalSplitAction); + menuStructure->addAction(strCopyRangeAction); + menuStructure->addSeparator(); + menuStructure->addAction(strCutEventsAction); + + + + //-------- Edit connections + connect(editCutAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + connect(editCopyAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + connect(editPasteAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + connect(editInsertAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + connect(editInsertEMAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + connect(editPasteCloneAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + connect(editPaste2TrackAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + connect(editPasteC2TAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + connect(editDeleteSelectedAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + + connect(editShrinkPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + connect(editExpandPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + connect(editCleanPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + + connect(editSelectAllAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + connect(editDeselectAllAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + connect(editInvertSelectionAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + connect(editInsideLoopAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + connect(editOutsideLoopAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + connect(editAllPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + + editSignalMapper->setMapping(editCutAction, CMD_CUT); + editSignalMapper->setMapping(editCopyAction, CMD_COPY); + editSignalMapper->setMapping(editPasteAction, CMD_PASTE); + editSignalMapper->setMapping(editInsertAction, CMD_INSERT); + editSignalMapper->setMapping(editPasteCloneAction, CMD_PASTE_CLONE); + editSignalMapper->setMapping(editPaste2TrackAction, CMD_PASTE_TO_TRACK); + editSignalMapper->setMapping(editPasteC2TAction, CMD_PASTE_CLONE_TO_TRACK); + editSignalMapper->setMapping(editInsertEMAction, CMD_INSERTMEAS); + editSignalMapper->setMapping(editDeleteSelectedAction, CMD_DELETE_TRACK); + editSignalMapper->setMapping(editShrinkPartsAction, CMD_SHRINK_PART); + editSignalMapper->setMapping(editExpandPartsAction, CMD_EXPAND_PART); + editSignalMapper->setMapping(editCleanPartsAction, CMD_CLEAN_PART); + editSignalMapper->setMapping(editSelectAllAction, CMD_SELECT_ALL); + editSignalMapper->setMapping(editDeselectAllAction, CMD_SELECT_NONE); + editSignalMapper->setMapping(editInvertSelectionAction, CMD_SELECT_INVERT); + editSignalMapper->setMapping(editInsideLoopAction, CMD_SELECT_ILOOP); + editSignalMapper->setMapping(editOutsideLoopAction, CMD_SELECT_OLOOP); + editSignalMapper->setMapping(editAllPartsAction, CMD_SELECT_PARTS); + + connect(editSignalMapper, SIGNAL(mapped(int)), this, SLOT(cmd(int))); + + connect(startPianoEditAction, SIGNAL(activated()), muse, SLOT(startPianoroll())); + connect(startScoreEditAction, SIGNAL(activated()), muse, SLOT(startScoreQuickly())); + connect(startDrumEditAction, SIGNAL(activated()), muse, SLOT(startDrumEditor())); + connect(startListEditAction, SIGNAL(activated()), muse, SLOT(startListEditor())); + connect(startWaveEditAction, SIGNAL(activated()), muse, SLOT(startWaveEditor())); + connect(scoreOneStaffPerTrackMapper, SIGNAL(mapped(QWidget*)), muse, SLOT(openInScoreEdit_oneStaffPerTrack(QWidget*))); + connect(scoreAllInOneMapper, SIGNAL(mapped(QWidget*)), muse, SLOT(openInScoreEdit_allInOne(QWidget*))); + + + connect(masterGraphicAction, SIGNAL(activated()), muse, SLOT(startMasterEditor())); + connect(masterListAction, SIGNAL(activated()), muse, SLOT(startLMasterEditor())); + + connect(midiTransformerAction, SIGNAL(activated()), muse, SLOT(startMidiTransformer())); + + + //-------- Structure connections + connect(strGlobalCutAction, SIGNAL(activated()), SLOT(globalCut())); + connect(strGlobalInsertAction, SIGNAL(activated()), SLOT(globalInsert())); + connect(strGlobalSplitAction, SIGNAL(activated()), SLOT(globalSplit())); + connect(strCopyRangeAction, SIGNAL(activated()), SLOT(copyRange())); + connect(strCutEventsAction, SIGNAL(activated()), SLOT(cutEvents())); + + + + connect(muse, SIGNAL(configChanged()), SLOT(updateShortcuts())); + + + QClipboard* cb = QApplication::clipboard(); + connect(cb, SIGNAL(dataChanged()), SLOT(clipboardChanged())); + connect(cb, SIGNAL(selectionChanged()), SLOT(clipboardChanged())); + + + + // work around for probable QT/WM interaction bug. + // for certain window managers, e.g xfce, this window is + // is displayed although not specifically set to show(); + // bug: 2811156 Softsynth GUI unclosable with XFCE4 (and a few others) + show(); + hide(); +} + +ArrangerView::~ArrangerView() +{ + +} + +void ArrangerView::closeEvent(QCloseEvent* e) +{ + emit deleted((unsigned long)this); + emit closed(); + e->accept(); +} + + + +void ArrangerView::writeStatus(int level, Xml& xml) const +{ + xml.tag(level++, "arrangerview"); + TopWin::writeStatus(level, xml); + + xml.intTag(level, "tool", editTools->curTool()); + xml.tag(level, "/arrangerview"); +} + +void ArrangerView::readStatus(Xml& xml) +{ + for (;;) + { + Xml::Token token = xml.parse(); + if (token == Xml::Error || token == Xml::End) + break; + + const QString& tag = xml.s1(); + switch (token) + { + case Xml::TagStart: + if (tag == "tool") + editTools->set(xml.parseInt()); + else + xml.unknown("ArrangerView"); + break; + + case Xml::TagEnd: + if (tag == "arrangerview") + return; + + default: + break; + } + } +} + + +void ArrangerView::cmd(int cmd) //FINDMICHJETZT + { + TrackList* tracks = song->tracks(); + int l = song->lpos(); + int r = song->rpos(); + + switch(cmd) { + case CMD_CUT: + arranger->cmd(Arranger::CMD_CUT_PART); + break; + case CMD_COPY: + arranger->cmd(Arranger::CMD_COPY_PART); + break; + case CMD_PASTE: + arranger->cmd(Arranger::CMD_PASTE_PART); + break; + case CMD_PASTE_CLONE: + arranger->cmd(Arranger::CMD_PASTE_CLONE_PART); + break; + case CMD_PASTE_TO_TRACK: + arranger->cmd(Arranger::CMD_PASTE_PART_TO_TRACK); + break; + case CMD_PASTE_CLONE_TO_TRACK: + arranger->cmd(Arranger::CMD_PASTE_CLONE_PART_TO_TRACK); + break; + case CMD_INSERT: + arranger->cmd(Arranger::CMD_INSERT_PART); + break; + case CMD_INSERTMEAS: + arranger->cmd(Arranger::CMD_INSERT_EMPTYMEAS); + break; + case CMD_DELETE: + if (!song->msgRemoveParts()) //automatically does undo if neccessary and returns true then + { + //msgRemoveParts() returned false -> no parts to remove? + song->startUndo(); + audio->msgRemoveTracks(); //TODO FINDME this could still be speeded up! + song->endUndo(SC_TRACK_REMOVED); + } + break; + case CMD_DELETE_TRACK: + song->startUndo(); + audio->msgRemoveTracks(); + song->endUndo(SC_TRACK_REMOVED); + audio->msgUpdateSoloStates(); + break; + + case CMD_SELECT_ALL: + case CMD_SELECT_NONE: + case CMD_SELECT_INVERT: + case CMD_SELECT_ILOOP: + case CMD_SELECT_OLOOP: + for (iTrack i = tracks->begin(); i != tracks->end(); ++i) { + PartList* parts = (*i)->parts(); + for (iPart p = parts->begin(); p != parts->end(); ++p) { + bool f = false; + int t1 = p->second->tick(); + int t2 = t1 + p->second->lenTick(); + bool inside = + ((t1 >= l) && (t1 < r)) + || ((t2 > l) && (t2 < r)) + || ((t1 <= l) && (t2 > r)); + switch(cmd) { + case CMD_SELECT_INVERT: + f = !p->second->selected(); + break; + case CMD_SELECT_NONE: + f = false; + break; + case CMD_SELECT_ALL: + f = true; + break; + case CMD_SELECT_ILOOP: + f = inside; + break; + case CMD_SELECT_OLOOP: + f = !inside; + break; + } + p->second->setSelected(f); + } + } + song->update(); + break; + + case CMD_SELECT_PARTS: + for (iTrack i = tracks->begin(); i != tracks->end(); ++i) { + if (!(*i)->selected()) + continue; + PartList* parts = (*i)->parts(); + for (iPart p = parts->begin(); p != parts->end(); ++p) + p->second->setSelected(true); + } + song->update(); + break; + + case CMD_SHRINK_PART: shrink_parts(); break; + case CMD_EXPAND_PART: expand_parts(); break; + case CMD_CLEAN_PART: clean_parts(); break; + + } + } + +void ArrangerView::scoreNamingChanged() +{ + updateScoreMenus(); +} + +void ArrangerView::updateScoreMenus() +{ + QAction* action; + + + scoreOneStaffPerTrackSubsubmenu->clear(); + scoreAllInOneSubsubmenu->clear(); + + + action=new QAction(tr("New"), this); + connect(action, SIGNAL(activated()), scoreOneStaffPerTrackMapper, SLOT(map())); + scoreOneStaffPerTrackMapper->setMapping(action, (QWidget*)NULL); + scoreOneStaffPerTrackSubsubmenu->addAction(action); + + + action=new QAction(tr("New"), this); //the above action may NOT be reused! + connect(action, SIGNAL(activated()), scoreAllInOneMapper, SLOT(map())); + scoreAllInOneMapper->setMapping(action, (QWidget*)NULL); + scoreAllInOneSubsubmenu->addAction(action); + + const ToplevelList* toplevels=muse->getToplevels(); + + for (ToplevelList::const_iterator it=toplevels->begin(); it!=toplevels->end(); it++) + if (it->type()==Toplevel::SCORE) + { + ScoreEdit* score = (ScoreEdit*) it->cobject(); + + action=new QAction(score->get_name(), this); + connect(action, SIGNAL(activated()), scoreOneStaffPerTrackMapper, SLOT(map())); + scoreOneStaffPerTrackMapper->setMapping(action, (QWidget*)score); + scoreOneStaffPerTrackSubsubmenu->addAction(action); + + + action=new QAction(score->get_name(), this); //the above action may NOT be reused! + connect(action, SIGNAL(activated()), scoreAllInOneMapper, SLOT(map())); + scoreAllInOneMapper->setMapping(action, (QWidget*)score); + scoreAllInOneSubsubmenu->addAction(action); + } +} + +void ArrangerView::clearScoreMenuMappers() +{ + delete scoreOneStaffPerTrackMapper; + delete scoreAllInOneMapper; + + scoreOneStaffPerTrackMapper = new QSignalMapper(this); + scoreAllInOneMapper = new QSignalMapper(this); + + connect(scoreOneStaffPerTrackMapper, SIGNAL(mapped(QWidget*)), this, SLOT(openInScoreEdit_oneStaffPerTrack(QWidget*))); + connect(scoreAllInOneMapper, SIGNAL(mapped(QWidget*)), this, SLOT(openInScoreEdit_allInOne(QWidget*))); +} + +void ArrangerView::populateAddTrack() +{ + QActionGroup *grp = ::populateAddTrack(addTrack); + + trackMidiAction = grp->actions()[0]; + trackDrumAction = grp->actions()[1]; + trackWaveAction = grp->actions()[2]; + trackAOutputAction = grp->actions()[3]; + trackAGroupAction = grp->actions()[4]; + trackAInputAction = grp->actions()[5]; + trackAAuxAction = grp->actions()[6]; +} + +void ArrangerView::updateShortcuts() +{ + editCutAction->setShortcut(shortcuts[SHRT_CUT].key); + editCopyAction->setShortcut(shortcuts[SHRT_COPY].key); + editPasteAction->setShortcut(shortcuts[SHRT_PASTE].key); + editInsertAction->setShortcut(shortcuts[SHRT_INSERT].key); + editInsertEMAction->setShortcut(shortcuts[SHRT_INSERTMEAS].key); + editPasteCloneAction->setShortcut(shortcuts[SHRT_PASTE_CLONE].key); + editPaste2TrackAction->setShortcut(shortcuts[SHRT_PASTE_TO_TRACK].key); + editPasteC2TAction->setShortcut(shortcuts[SHRT_PASTE_CLONE_TO_TRACK].key); + + //editDeleteSelectedAction has no acceleration + + trackMidiAction->setShortcut(shortcuts[SHRT_ADD_MIDI_TRACK].key); + trackDrumAction->setShortcut(shortcuts[SHRT_ADD_DRUM_TRACK].key); + trackWaveAction->setShortcut(shortcuts[SHRT_ADD_WAVE_TRACK].key); + trackAOutputAction->setShortcut(shortcuts[SHRT_ADD_AUDIO_OUTPUT].key); + trackAGroupAction->setShortcut(shortcuts[SHRT_ADD_AUDIO_GROUP].key); + trackAInputAction->setShortcut(shortcuts[SHRT_ADD_AUDIO_INPUT].key); + trackAAuxAction->setShortcut(shortcuts[SHRT_ADD_AUDIO_AUX].key); + + editSelectAllAction->setShortcut(shortcuts[SHRT_SELECT_ALL].key); + editDeselectAllAction->setShortcut(shortcuts[SHRT_SELECT_NONE].key); + editInvertSelectionAction->setShortcut(shortcuts[SHRT_SELECT_INVERT].key); + editInsideLoopAction->setShortcut(shortcuts[SHRT_SELECT_OLOOP].key); + editOutsideLoopAction->setShortcut(shortcuts[SHRT_SELECT_OLOOP].key); + editAllPartsAction->setShortcut(shortcuts[SHRT_SELECT_PRTSTRACK].key); + + startPianoEditAction->setShortcut(shortcuts[SHRT_OPEN_PIANO].key); + startDrumEditAction->setShortcut(shortcuts[SHRT_OPEN_DRUMS].key); + startListEditAction->setShortcut(shortcuts[SHRT_OPEN_LIST].key); + startWaveEditAction->setShortcut(shortcuts[SHRT_OPEN_WAVE].key); + + masterGraphicAction->setShortcut(shortcuts[SHRT_OPEN_GRAPHIC_MASTER].key); + masterListAction->setShortcut(shortcuts[SHRT_OPEN_LIST_MASTER].key); + + midiTransformerAction->setShortcut(shortcuts[SHRT_OPEN_MIDI_TRANSFORM].key); + strGlobalCutAction->setShortcut(shortcuts[SHRT_GLOBAL_CUT].key); + strGlobalInsertAction->setShortcut(shortcuts[SHRT_GLOBAL_INSERT].key); + strGlobalSplitAction->setShortcut(shortcuts[SHRT_GLOBAL_SPLIT].key); + strCopyRangeAction->setShortcut(shortcuts[SHRT_COPY_RANGE].key); + strCutEventsAction->setShortcut(shortcuts[SHRT_CUT_EVENTS].key); +} + +//--------------------------------------------------------- +// clipboardChanged +//--------------------------------------------------------- + +void ArrangerView::clipboardChanged() + { + bool flag = false; + if(QApplication::clipboard()->mimeData()->hasFormat(QString("text/x-muse-midipartlist")) || + QApplication::clipboard()->mimeData()->hasFormat(QString("text/x-muse-wavepartlist")) || + QApplication::clipboard()->mimeData()->hasFormat(QString("text/x-muse-mixedpartlist"))) + flag = true; + + editPasteAction->setEnabled(flag); + editInsertAction->setEnabled(flag); + editPasteCloneAction->setEnabled(flag); + editPaste2TrackAction->setEnabled(flag); + editPasteC2TAction->setEnabled(flag); + } + +//--------------------------------------------------------- +// selectionChanged +//--------------------------------------------------------- + +void ArrangerView::selectionChanged() //FINDMICHJETZT + { + //bool flag = arranger->isSingleSelection(); // -- Hmm, why only single? + bool flag = arranger->selectionSize() > 0; // -- Test OK cut and copy. For muse2. Tim. + editCutAction->setEnabled(flag); + editCopyAction->setEnabled(flag); + } diff --git a/muse2/muse/arranger/arrangerview.h b/muse2/muse/arranger/arrangerview.h new file mode 100644 index 00000000..9c19a731 --- /dev/null +++ b/muse2/muse/arranger/arrangerview.h @@ -0,0 +1,131 @@ +//========================================================= +// MusE +// Linux Music Editor +// arrangerview.h +// (C) Copyright 2011 Florian Jung (flo93@users.sourceforge.net) +//========================================================= + +#ifndef __ARRANGERVIEW_H__ +#define __ARRANGERVIEW_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "noteinfo.h" +#include "cobject.h" +#include "event.h" +#include "view.h" +#include "gconfig.h" +#include "part.h" +#include "keyevent.h" +#include "mtscale_flo.h" +#include "steprec.h" +#include "cleftypes.h" +#include "helper.h" +#include "arranger.h" + +class VisibleTracks; + + +class ArrangerView : public TopWin +{ + Q_OBJECT + + enum cmd_enum + {CMD_CUT, CMD_COPY, CMD_PASTE, CMD_INSERT, CMD_INSERTMEAS, CMD_PASTE_CLONE, + CMD_PASTE_TO_TRACK, CMD_PASTE_CLONE_TO_TRACK, CMD_DELETE, + CMD_SELECT_ALL, CMD_SELECT_NONE, CMD_SELECT_INVERT, + CMD_SELECT_ILOOP, CMD_SELECT_OLOOP, CMD_SELECT_PARTS, + CMD_DELETE_TRACK, CMD_EXPAND_PART, CMD_SHRINK_PART, CMD_CLEAN_PART }; + + private: + virtual void closeEvent(QCloseEvent*); + + void adjustGlobalLists(Undo& operations, int startPos, int diff); + + QGridLayout* mainGrid; + QWidget* mainw; + + EditToolBar *editTools; + VisibleTracks *visTracks; + + Arranger* arranger; + + // Edit Menu actions + QMenu* select; + QMenu* addTrack; + QMenu* master; + + // Structure Menu actions + QAction *strGlobalCutAction, *strGlobalInsertAction, *strGlobalSplitAction, *strCopyRangeAction, *strCutEventsAction; + + + QAction *trackMidiAction, *trackDrumAction, *trackWaveAction, *trackAOutputAction, *trackAGroupAction; + QAction *trackAInputAction, *trackAAuxAction; + QAction *editCutAction, *editCopyAction, *editPasteAction, *editInsertAction, *editPasteCloneAction, *editPaste2TrackAction; + QAction *editInsertEMAction, *editPasteC2TAction, *editDeleteSelectedAction, *editSelectAllAction, *editDeselectAllAction; + QAction *editInvertSelectionAction, *editInsideLoopAction, *editOutsideLoopAction, *editAllPartsAction; + QAction *masterGraphicAction, *masterListAction; + QAction *midiTransformerAction; + QAction *editCleanPartsAction, *editShrinkPartsAction, *editExpandPartsAction; + + QSignalMapper *editSignalMapper; + QSignalMapper *scoreOneStaffPerTrackMapper; + QSignalMapper *scoreAllInOneMapper; + + public: + QAction *startScoreEditAction, *startPianoEditAction, *startDrumEditAction, *startListEditAction, *startWaveEditAction; + QMenu *scoreSubmenu, *scoreOneStaffPerTrackSubsubmenu, *scoreAllInOneSubsubmenu; + + private slots: + void clearScoreMenuMappers(); + void globalCut(); + void globalInsert(); + void globalSplit(); + void copyRange(); + void cutEvents(); + + void cmd(int); + + signals: + void deleted(unsigned long); + void closed(); + + public: + ArrangerView(QWidget* parent = 0); + ~ArrangerView(); + + void writeStatus(int level, Xml& xml) const; + void readStatus(Xml& xml); + + void populateAddTrack(); + + Arranger* getArranger() {return arranger;} + + public slots: + void scoreNamingChanged(); + void updateScoreMenus(); + void clipboardChanged(); + void selectionChanged(); + void updateShortcuts(); +}; + + + + +#endif + diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp index 7298194c..d223321b 100644 --- a/muse2/muse/arranger/pcanvas.cpp +++ b/muse2/muse/arranger/pcanvas.cpp @@ -24,6 +24,8 @@ #include "fastlog.h" #include "widgets/tools.h" +#include "arranger.h" +#include "arrangerview.h" #include "pcanvas.h" #include "midieditor.h" #include "globals.h" @@ -619,17 +621,17 @@ QMenu* PartCanvas::genItemPopup(CItem* item) partPopup->addSeparator(); switch(trackType) { case Track::MIDI: { - partPopup->addAction(muse->startPianoEditAction); - partPopup->addMenu(muse->scoreSubmenu); - partPopup->addAction(muse->startScoreEditAction); - partPopup->addAction(muse->startListEditAction); + partPopup->addAction(muse->arranger->parentWin->startPianoEditAction); + partPopup->addMenu(muse->arranger->parentWin->scoreSubmenu); + partPopup->addAction(muse->arranger->parentWin->startScoreEditAction); + partPopup->addAction(muse->arranger->parentWin->startListEditAction); QAction *act_mexport = partPopup->addAction(tr("save part to disk")); act_mexport->setData(16); } break; case Track::DRUM: { - partPopup->addAction(muse->startDrumEditAction); - partPopup->addAction(muse->startListEditAction); + partPopup->addAction(muse->arranger->parentWin->startDrumEditAction); + partPopup->addAction(muse->arranger->parentWin->startListEditAction); QAction *act_dexport = partPopup->addAction(tr("save part to disk")); act_dexport->setData(16); } diff --git a/muse2/muse/arranger/pcanvas.h b/muse2/muse/arranger/pcanvas.h index ccfb1fcc..a0c25f6e 100644 --- a/muse2/muse/arranger/pcanvas.h +++ b/muse2/muse/arranger/pcanvas.h @@ -118,8 +118,6 @@ class PartCanvas : public Canvas { double dbToVal(double inDb); double valToDb(double inV); - - protected: virtual void drawCanvas(QPainter&, const QRect&); virtual void endMoveItems(const QPoint&, DragType, int dir); diff --git a/muse2/muse/cobject.h b/muse2/muse/cobject.h index 9a80b2b1..0ab509e8 100644 --- a/muse2/muse/cobject.h +++ b/muse2/muse/cobject.h @@ -38,7 +38,7 @@ class TopWin : public QMainWindow class Toplevel { public: enum ToplevelType { PIANO_ROLL, LISTE, DRUM, MASTER, WAVE, - LMASTER, CLIPLIST, MARKER, SCORE + LMASTER, CLIPLIST, MARKER, SCORE, ARRANGER #ifdef PATCHBAY , M_PATCHBAY #endif /* PATCHBAY */ diff --git a/muse2/muse/gconfig.cpp b/muse2/muse/gconfig.cpp index 49a6d572..6583dae4 100644 --- a/muse2/muse/gconfig.cpp +++ b/muse2/muse/gconfig.cpp @@ -148,6 +148,7 @@ GlobalConfigValues config = { false, // mixer2Visible; false, // markerVisible; + true, // arrangerVisible; true, // showSplashScreen 1, // canvasShowPartType 1 - names, 2 events 5, // canvasShowPartEvent diff --git a/muse2/muse/gconfig.h b/muse2/muse/gconfig.h index acf39782..5b8e9585 100644 --- a/muse2/muse/gconfig.h +++ b/muse2/muse/gconfig.h @@ -120,6 +120,7 @@ struct GlobalConfigValues { bool mixer1Visible; bool mixer2Visible; bool markerVisible; + bool arrangerVisible; bool showSplashScreen; int canvasShowPartType; // 1 - names, 2 events diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index 785ac7a5..93bf2e95 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -4469,18 +4469,19 @@ void staff_t::update_part_indices() * because after A (and B) got resized, the B-resize is invalid! * * CURRENT TODO + * o IMPORTANT: check new windowed arranger! + * - do all signal connections work? + * - are there any segfaults? + * + * IMPORTANT TODO * o redo transport menu: offer "one beat" and "one bar" steps * maybe also offer scrollbar * o quick "set left/right marker", "select between markers" * or even "set marker and select between immediately" * o support partially selected parts. when moving, automatically split * - * o speed up structural operations * o maybe remove "insert empty measure"? - * o structural OPs: don't erase note which begins at "end of cut" * o add "move other notes" or "overwrite notes" or "mix with notes" to paste - * - * IMPORTANT TODO * o draw the edge of parts hiding notes "jagged" (hasHiddenNotes() is interesting for this) * o shrink a part from its beginning as well! watch out for clones! * o insert empty measure should also work inside parts, that is, diff --git a/muse2/muse/structure.cpp b/muse2/muse/structure.cpp index f8d92497..87f37c1c 100644 --- a/muse2/muse/structure.cpp +++ b/muse2/muse/structure.cpp @@ -1,7 +1,7 @@ //========================================================= // MusE // Linux Music Editor -// $Id: app.cpp,v 1.113.2.68 2009/12/21 14:51:51 spamatica Exp $ +// $Id: structure.cpp,v 1.113.2.68 2009/12/21 14:51:51 spamatica Exp $ // // (C) Copyright 1999-2004 Werner Schweer (ws@seh.de) // (C) Copyright 2011 Robert Jonsson (rj@spamatica.se) @@ -16,7 +16,7 @@ #include "keyevent.h" #include "audio.h" #include "marker/marker.h" - +#include "arrangerview.h" //--------------------------------------------------------- // adjustGlobalLists @@ -25,7 +25,7 @@ // 'diff' number of ticks. //--------------------------------------------------------- -void MusE::adjustGlobalLists(Undo& operations, int startPos, int diff) +void ArrangerView::adjustGlobalLists(Undo& operations, int startPos, int diff) { const TempoList* t = &tempomap; const AL::SigList* s = &AL::sigmap; @@ -116,7 +116,7 @@ void MusE::adjustGlobalLists(Undo& operations, int startPos, int diff) // - cut master track //--------------------------------------------------------- -void MusE::globalCut() +void ArrangerView::globalCut() { int lpos = song->lpos(); int rpos = song->rpos(); @@ -218,7 +218,7 @@ void MusE::globalCut() // - insert in master track //--------------------------------------------------------- -void MusE::globalInsert() +void ArrangerView::globalInsert() { unsigned lpos = song->lpos(); unsigned rpos = song->rpos(); @@ -275,7 +275,7 @@ void MusE::globalInsert() // - split all parts at the song position pointer //--------------------------------------------------------- -void MusE::globalSplit() +void ArrangerView::globalSplit() { int pos = song->cpos(); Undo operations; @@ -317,10 +317,10 @@ void MusE::globalSplit() // copied events //--------------------------------------------------------- -void MusE::copyRange() +void ArrangerView::copyRange() { QMessageBox::critical(this, - tr("MusE: Copy Range"), + tr("ArrangerView: Copy Range"), tr("not implemented") ); } @@ -332,10 +332,10 @@ void MusE::copyRange() // - process only marked parts //--------------------------------------------------------- -void MusE::cutEvents() +void ArrangerView::cutEvents() { QMessageBox::critical(this, - tr("MusE: Cut Events"), + tr("ArrangerView: Cut Events"), tr("not implemented") ); } -- cgit v1.2.3