diff options
author | Florian Jung <flo@windfisch.org> | 2011-08-07 15:15:12 +0000 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2011-08-07 15:15:12 +0000 |
commit | c95feff1f178ec0d89ea21abf5d7e6294c0d0132 (patch) | |
tree | bd18c853f1036c4409de674800cc9782d543ebf8 /muse2/muse/app.cpp | |
parent | 5465be709dbf0aef02c8cac29b33180a130ef1a0 (diff) |
moved the arranger out to its own window
Diffstat (limited to 'muse2/muse/app.cpp')
-rw-r--r-- | muse2/muse/app.cpp | 830 |
1 files changed, 60 insertions, 770 deletions
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*))); -} //--------------------------------------------------------- @@ -304,235 +286,6 @@ void addProject(const QString& name) } //--------------------------------------------------------- -// populateAddSynth -//--------------------------------------------------------- - -// ORCAN - CHECK -QMenu* populateAddSynth(QWidget* parent) -{ - QMenu* synp = new QMenu(parent); - - //typedef std::multimap<std::string, int, addSynth_cmp_str > asmap; - typedef std::multimap<std::string, int > asmap; - - //typedef std::multimap<std::string, int, addSynth_cmp_str >::iterator imap; - typedef std::multimap<std::string, int >::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<Synth*>::iterator i = synthis.begin(); i != synthis.end(); ++i) - { - synMESS = dynamic_cast<MessSynth*>(*i); - if(synMESS) - { - mapMESS.insert( std::pair<std::string, int> (std::string(synMESS->description().toLower().toLatin1().constData()), ii) ); - } - else - { - - #ifdef DSSI_SUPPORT - synDSSI = dynamic_cast<DssiSynth*>(*i); - if(synDSSI) - { - mapDSSI.insert( std::pair<std::string, int> (std::string(synDSSI->description().toLower().toLatin1().constData()), ii) ); - } - else - #endif - - { - #ifdef VST_SUPPORT - synVST = dynamic_cast<VstSynth*>(*i); - if(synVST) - { - mapVST.insert( std::pair<std::string, int> (std::string(synVST->description().toLower().toLatin1().constData()), ii) ); - } - else - #endif - - { - mapOther.insert( std::pair<std::string, int> (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())); @@ -1014,15 +640,6 @@ MusE::MusE(int argc, char** argv) : QMainWindow() 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,21 +737,10 @@ 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(); @@ -1997,6 +1520,34 @@ void MusE::markerClosed() } //--------------------------------------------------------- +// 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); - } //--------------------------------------------------------- |