diff options
author | Florian Jung <flo@windfisch.org> | 2011-09-14 19:33:40 +0000 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2011-09-14 19:33:40 +0000 |
commit | 58033553a3e7d529a27a2b3d9ccc721d1e2dcc17 (patch) | |
tree | 160bd9993bca91b68475d4ad4249cc07b89692dd /muse2/muse | |
parent | 42269af2e0cc7a8c7b70d89ffa270184acde3dec (diff) | |
parent | 2529ef06d1227b457af051a494ddb579ef590fe3 (diff) |
merged experimental into trunk
new features:
- MDI user interface
- improved pasting (dialogs etc)
- some fixes
Diffstat (limited to 'muse2/muse')
99 files changed, 6122 insertions, 4375 deletions
diff --git a/muse2/muse/CMakeLists.txt b/muse2/muse/CMakeLists.txt index 71baed5d..b26100f9 100644 --- a/muse2/muse/CMakeLists.txt +++ b/muse2/muse/CMakeLists.txt @@ -88,6 +88,7 @@ file (GLOB core_source_files confmport.cpp controlfifo.cpp ctrl.cpp + dialogs.cpp dssihost.cpp event.cpp eventlist.cpp diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp index aab80a2c..773e550f 100644 --- a/muse2/muse/app.cpp +++ b/muse2/muse/app.cpp @@ -21,6 +21,8 @@ // //========================================================= +#include <typeinfo> + #include <QClipboard> #include <QMessageBox> #include <QShortcut> @@ -29,6 +31,8 @@ #include <QWhatsThis> #include <QSettings> #include <QProgressDialog> +#include <QMdiArea> +#include <QMdiSubWindow> #include <iostream> @@ -38,6 +42,7 @@ #include "amixer.h" #include "appearance.h" #include "arranger.h" +#include "arrangerview.h" #include "audio.h" #include "audiodev.h" #include "audioprefetch.h" @@ -69,17 +74,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 namespace MusEApp { @@ -127,17 +124,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*))); -} //--------------------------------------------------------- @@ -324,235 +310,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 //--------------------------------------------------------- @@ -561,7 +318,6 @@ MusE::MusE(int argc, char** argv) : QMainWindow() { // By T356. For LADSPA plugins in plugin.cpp // QWidgetFactory::addWidgetFactory( new PluginWidgetFactory ); ddskrjo - setIconSize(ICON_SIZE); setFocusPolicy(Qt::WheelFocus); //setFocusPolicy(Qt::NoFocus); @@ -578,6 +334,7 @@ MusE::MusE(int argc, char** argv) : QMainWindow() midiRhythmGenerator = 0; globalSettingsConfig = 0; markerView = 0; + arrangerView = 0; softSynthesizerConfig = 0; midiTransformerDialog = 0; shortcutConfig = 0; @@ -589,21 +346,25 @@ MusE::MusE(int argc, char** argv) : QMainWindow() editInstrument = 0; routingPopupMenu = 0; progress = 0; + activeTopWin = NULL; + currentMenuSharingTopwin = NULL; 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); + windowsMapper = new QSignalMapper(this); + connect(windowsMapper, SIGNAL(mapped(QWidget*)), SLOT(bringToFront(QWidget*))); song = new Song("song"); song->blockSignals(true); MusEGlobal::heartBeatTimer = new QTimer(this); MusEGlobal::heartBeatTimer->setObjectName("timer"); connect(MusEGlobal::heartBeatTimer, SIGNAL(timeout()), song, SLOT(beat())); - + + + connect(this, SIGNAL(activeTopWinChanged(TopWin*)), SLOT(activeTopWinChangedSlot(TopWin*))); + #ifdef ENABLE_PYTHON //--------------------------------------------------- // Python bridge @@ -748,61 +509,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 @@ -818,15 +524,11 @@ 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); + fullscreenAction=new QAction(tr("Fullscreen"), this); + fullscreenAction->setCheckable(true); + fullscreenAction->setChecked(false); //-------- Midi Actions menuScriptPlugins = new QMenu(tr("&Plugins"), this); @@ -855,8 +557,15 @@ MusE::MusE(int argc, char** argv) : QMainWindow() autoSnapshotAction = new QAction(QIcon(*automation_take_snapshotIcon), tr("Take Snapshot"), this); autoClearAction = new QAction(QIcon(*automation_clear_dataIcon), tr("Clear Automation Data"), this); autoClearAction->setEnabled(false); + - + //-------- Windows Actions + windowsCascadeAction = new QAction(tr("Cascade"), this); + windowsTileAction = new QAction(tr("Tile"), this); + windowsRowsAction = new QAction(tr("In rows"), this); + windowsColumnsAction = new QAction(tr("In columns"), this); + + //-------- Settings Actions settingsGlobalAction = new QAction(QIcon(*settings_globalsettingsIcon), tr("Global Settings"), this); settingsShortcutsAction = new QAction(QIcon(*settings_configureshortcutsIcon), tr("Configure Shortcuts"), this); @@ -901,63 +610,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 @@ -967,13 +619,8 @@ 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))); + connect(fullscreenAction, SIGNAL(toggled(bool)), SLOT(setFullscreen(bool))); //-------- Midi connections connect(midiEditInstAction, SIGNAL(activated()), SLOT(startEditInstrument())); @@ -1034,47 +681,35 @@ 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 //-------------------------------------------------- + // when adding a toolbar to the main window, remember adding it to + // either the requiredToolbars or optionalToolbars list! + tools = addToolBar(tr("File Buttons")); tools->setObjectName("File Buttons"); tools->addAction(fileNewAction); tools->addAction(fileOpenAction); tools->addAction(fileSaveAction); - - - // - // Whats This - // tools->addAction(QWhatsThis::createAction(this)); - tools->addSeparator(); - tools->addActions(MusEGlobal::undoRedo->actions()); - - tools1 = new MusEWidget::EditToolBar(this, MusEWidget::arrangerTools); - addToolBar(tools1); - tools1->setObjectName("arrangerTools"); + QToolBar* undoToolbar = addToolBar(tr("Undo/Redo")); + undoToolbar->setObjectName("Undo/Redo (global)"); + undoToolbar->addActions(MusEGlobal::undoRedo->actions()); QToolBar* transportToolbar = addToolBar(tr("Transport")); - transportToolbar->setObjectName("Transport"); + transportToolbar->setObjectName("Transport (global)"); transportToolbar->addActions(MusEGlobal::transportAction->actions()); QToolBar* panicToolbar = addToolBar(tr("Panic")); - panicToolbar->setObjectName("Panic"); + panicToolbar->setObjectName("Panic (global)"); panicToolbar->addAction(MusEGlobal::panicAction); - visTracks = new MusEWidget::VisibleTracks(this); - addToolBar(visTracks); + requiredToolbars.push_back(tools); + optionalToolbars.push_back(undoToolbar); + optionalToolbars.push_back(transportToolbar); + optionalToolbars.push_back(panicToolbar); //rlimit lim; @@ -1107,11 +742,20 @@ MusE::MusE(int argc, char** argv) : QMainWindow() //--------------------------------------------------- + // when adding a menu to the main window, remember adding it to + // either the leadingMenus or trailingMenus list! + // also do NOT use menuBar()->addMenu(QString&), but ALWAYS + // create the menu with new QMenu and add it afterwards. + // the menu's owner must be this and not this->menuBar()! + + //------------------------------------------------------------- // popup File //------------------------------------------------------------- - menu_file = menuBar()->addMenu(tr("&File")); + menu_file = new QMenu(tr("&File"), this); + menuBar()->addMenu(menu_file); + leadingMenus.push_back(menu_file); menu_file->addAction(fileNewAction); menu_file->addAction(fileOpenAction); menu_file->addMenu(openRecent); @@ -1119,6 +763,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); @@ -1130,72 +776,15 @@ MusE::MusE(int argc, char** argv) : QMainWindow() menu_file->addAction(quitAction); menu_file->addSeparator(); - //------------------------------------------------------------- - // popup Edit - //------------------------------------------------------------- - menuEdit = menuBar()->addMenu(tr("&Edit")); - menuEdit->addActions(MusEGlobal::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 //------------------------------------------------------------- - menuView = menuBar()->addMenu(tr("&View")); + menuView = new QMenu(tr("&View"), this); + menuBar()->addMenu(menuView); + trailingMenus.push_back(menuView); menuView->addAction(viewTransportAction); menuView->addAction(viewBigtimeAction); @@ -1203,25 +792,19 @@ MusE::MusE(int argc, char** argv) : QMainWindow() menuView->addAction(viewMixerBAction); menuView->addAction(viewCliplistAction); menuView->addAction(viewMarkerAction); + menuView->addAction(viewArrangerAction); + menuView->addSeparator(); + menuView->addAction(fullscreenAction); //------------------------------------------------------------- - // 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 //------------------------------------------------------------- - menu_functions = menuBar()->addMenu(tr("&Midi")); + menu_functions = new QMenu(tr("&Midi"), this); + menuBar()->addMenu(menu_functions); + trailingMenus.push_back(menu_functions); + song->populateScriptMenu(menuScriptPlugins, this); menu_functions->addMenu(menuScriptPlugins); menu_functions->addAction(midiEditInstAction); @@ -1247,7 +830,10 @@ MusE::MusE(int argc, char** argv) : QMainWindow() // popup Audio //------------------------------------------------------------- - menu_audio = menuBar()->addMenu(tr("&Audio")); + menu_audio = new QMenu(tr("&Audio"), this); + menuBar()->addMenu(menu_audio); + trailingMenus.push_back(menu_audio); + menu_audio->addAction(audioBounce2TrackAction); menu_audio->addAction(audioBounce2FileAction); menu_audio->addSeparator(); @@ -1258,17 +844,36 @@ MusE::MusE(int argc, char** argv) : QMainWindow() // popup Automation //------------------------------------------------------------- - menuAutomation = menuBar()->addMenu(tr("A&utomation")); + menuAutomation = new QMenu(tr("A&utomation"), this); + menuBar()->addMenu(menuAutomation); + trailingMenus.push_back(menuAutomation); + menuAutomation->addAction(autoMixerAction); menuAutomation->addSeparator(); menuAutomation->addAction(autoSnapshotAction); menuAutomation->addAction(autoClearAction); //------------------------------------------------------------- + // popup Windows + //------------------------------------------------------------- + + menuWindows = new QMenu(tr("&Windows"), this); + menuBar()->addMenu(menuWindows); + trailingMenus.push_back(menuWindows); + + menuWindows->addAction(windowsCascadeAction); + menuWindows->addAction(windowsTileAction); + menuWindows->addAction(windowsRowsAction); + menuWindows->addAction(windowsColumnsAction); + + //------------------------------------------------------------- // popup Settings //------------------------------------------------------------- - menuSettings = menuBar()->addMenu(tr("Se&ttings")); + menuSettings = new QMenu(tr("MusE Se&ttings"), this); + menuBar()->addMenu(menuSettings); + trailingMenus.push_back(menuSettings); + menuSettings->addAction(settingsGlobalAction); menuSettings->addAction(settingsShortcutsAction); menuSettings->addMenu(follow); @@ -1288,7 +893,10 @@ MusE::MusE(int argc, char** argv) : QMainWindow() // popup Help //--------------------------------------------------- - menu_help = menuBar()->addMenu(tr("&Help")); + menu_help = new QMenu(tr("&Help"), this); + menuBar()->addMenu(menu_help); + trailingMenus.push_back(menu_help); + menu_help->addAction(helpManualAction); menu_help->addAction(helpHomepageAction); menu_help->addSeparator(); @@ -1300,24 +908,33 @@ 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); + //--------------------------------------------------- // 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())); + mdiArea=new QMdiArea(this); + mdiArea->setOption(QMdiArea::DontMaximizeSubWindowOnActivation); + mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + mdiArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + setCentralWidget(mdiArea); + connect(windowsTileAction, SIGNAL(activated()), this, SLOT(tileSubWindows())); + connect(windowsRowsAction, SIGNAL(activated()), this, SLOT(arrangeSubWindowsRows())); + connect(windowsColumnsAction, SIGNAL(activated()), this, SLOT(arrangeSubWindowsColumns())); + connect(windowsCascadeAction, SIGNAL(activated()), mdiArea, SLOT(cascadeSubWindows())); - connect(arranger, SIGNAL(setUsedTool(int)), SLOT(setUsedTool(int))); + arrangerView = new ArrangerView(this); + arrangerView->shareToolsAndMenu(true); + connect(arrangerView, SIGNAL(closed()), SLOT(arrangerClosed())); + toplevels.push_back(arrangerView); + arrangerView->hide(); + _arranger=arrangerView->getArranger(); + + arrangerView->setIsMdiWin(true); + + //--------------------------------------------------- // read list of "Recent Projects" //--------------------------------------------------- @@ -1347,24 +964,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: @@ -1398,10 +1003,12 @@ MusE::MusE(int argc, char** argv) : QMainWindow() changeConfig(false); QSettings settings("MusE", "MusE-qt"); - //restoreGeometry(settings.value("MusE/geometry").toByteArray()); - restoreState(settings.value("MusE/windowState").toByteArray()); + restoreGeometry(settings.value("MusE/geometry").toByteArray()); + //restoreState(settings.value("MusE/windowState").toByteArray()); song->update(); + + updateWindowMenu(); } MusE::~MusE() @@ -1515,7 +1122,7 @@ void MusE::loadProjectFile(const QString& name, bool songTemplate, bool loadAll) if (restartSequencer) seqStart(); - visTracks->updateVisibleTracksButtons(); + arrangerView->updateVisibleTracksButtons(); progress->setValue(100); delete progress; progress=0; @@ -1544,7 +1151,7 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll mixer1->clear(); if (mixer2) mixer2->clear(); - arranger->clear(); // clear track info + _arranger->clear(); // clear track info //if (clearSong()) if (clearSong(loadAll)) // Allow not touching things like midi ports. p4.0.17 TESTING: Maybe some problems... return; @@ -1624,6 +1231,7 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll viewTransportAction->setChecked(MusEConfig::config.transportVisible); viewBigtimeAction->setChecked(MusEConfig::config.bigTimeVisible); viewMarkerAction->setChecked(MusEConfig::config.markerVisible); + viewArrangerAction->setChecked(MusEConfig::config.arrangerVisible); autoMixerAction->setChecked(MusEGlobal::automation); @@ -1669,9 +1277,9 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll MusEGlobal::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. @@ -1707,6 +1315,27 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll showMarker(MusEConfig::config.markerVisible); } + if (songTemplate) + { + // maximize the arranger in traditional SDI mode + if (TopWin::_defaultSubwin[TopWin::ARRANGER]) + { + bool maximizeArranger=true; + for (int i=0; i<TopWin::TOPLEVELTYPE_LAST_ENTRY; i++) + if ((i!=TopWin::ARRANGER) && TopWin::_defaultSubwin[i]) + { + maximizeArranger=false; + break; + } + + if (maximizeArranger) + { + arrangerView->showMaximized(); + bringToFront(arrangerView); + } + } + } + } //--------------------------------------------------------- @@ -1896,8 +1525,10 @@ void MusE::closeEvent(QCloseEvent* event) } QSettings settings("MusE", "MusE-qt"); - //settings.setValue("MusE/geometry", saveGeometry()); - settings.setValue("MusE/windowState", saveState()); + settings.setValue("MusE/geometry", saveGeometry()); + //settings.setValue("MusE/windowState", saveState()); + + writeGlobalConfiguration(); // save "Open Recent" list QString prjPath(MusEGlobal::configPath); @@ -1995,16 +1626,17 @@ 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)); + toplevels.push_back(markerView); markerView->show(); } markerView->setVisible(flag); viewMarkerAction->setChecked(flag); + if (!flag) + if (currentMenuSharingTopwin == markerView) + setCurrentMenuSharingTopwin(NULL); + + updateWindowMenu(); } //--------------------------------------------------------- @@ -2014,6 +1646,43 @@ void MusE::showMarker(bool flag) void MusE::markerClosed() { viewMarkerAction->setChecked(false); + if (currentMenuSharingTopwin == markerView) + setCurrentMenuSharingTopwin(NULL); + + updateWindowMenu(); + } + +//--------------------------------------------------------- +// toggleArranger +//--------------------------------------------------------- + +void MusE::toggleArranger(bool checked) + { + showArranger(checked); + } + +//--------------------------------------------------------- +// showArranger +//--------------------------------------------------------- + +void MusE::showArranger(bool flag) + { + arrangerView->setVisible(flag); + viewArrangerAction->setChecked(flag); + if (!flag) + if (currentMenuSharingTopwin == arrangerView) + setCurrentMenuSharingTopwin(NULL); + updateWindowMenu(); + } + +//--------------------------------------------------------- +// arrangerClosed +//--------------------------------------------------------- + +void MusE::arrangerClosed() + { + viewArrangerAction->setChecked(false); + updateWindowMenu(); } //--------------------------------------------------------- @@ -2141,48 +1810,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 @@ -2210,16 +1837,17 @@ void MusE::openInScoreEdit(ScoreEdit* destination, PartList* pl, bool allInOne) { if (destination==NULL) // if no destination given, create a new one { - destination = new ScoreEdit(this, 0, arranger->cursorValue()); + destination = new ScoreEdit(this, 0, _arranger->cursorValue()); 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())); + toplevels.push_back(destination); + connect(destination, SIGNAL(deleted(TopWin*)), SLOT(toplevelDeleted(TopWin*))); + 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(); + updateWindowMenu(); } destination->add_parts(pl, allInOne); @@ -2245,13 +1873,14 @@ void MusE::startPianoroll() void MusE::startPianoroll(PartList* pl, bool showDefaultCtrls) { - PianoRoll* pianoroll = new PianoRoll(pl, this, 0, arranger->cursorValue()); + PianoRoll* pianoroll = new PianoRoll(pl, this, 0, _arranger->cursorValue()); if(showDefaultCtrls) // p4.0.12 pianoroll->addCtrl(); pianoroll->show(); - toplevels.push_back(Toplevel(Toplevel::PIANO_ROLL, (unsigned long)(pianoroll), pianoroll)); - connect(pianoroll, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long))); + toplevels.push_back(pianoroll); + connect(pianoroll, SIGNAL(deleted(TopWin*)), SLOT(toplevelDeleted(TopWin*))); connect(MusEGlobal::muse, SIGNAL(configChanged()), pianoroll, SLOT(configChanged())); + updateWindowMenu(); } //--------------------------------------------------------- @@ -2270,9 +1899,10 @@ void MusE::startListEditor(PartList* pl) { ListEdit* listEditor = new ListEdit(pl); listEditor->show(); - toplevels.push_back(Toplevel(Toplevel::LISTE, (unsigned long)(listEditor), listEditor)); - connect(listEditor, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long))); + toplevels.push_back(listEditor); + connect(listEditor, SIGNAL(deleted(TopWin*)), SLOT(toplevelDeleted(TopWin*))); connect(MusEGlobal::muse,SIGNAL(configChanged()), listEditor, SLOT(configChanged())); + updateWindowMenu(); } //--------------------------------------------------------- @@ -2283,8 +1913,9 @@ void MusE::startMasterEditor() { MasterEdit* masterEditor = new MasterEdit(); masterEditor->show(); - toplevels.push_back(Toplevel(Toplevel::MASTER, (unsigned long)(masterEditor), masterEditor)); - connect(masterEditor, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long))); + toplevels.push_back(masterEditor); + connect(masterEditor, SIGNAL(deleted(TopWin*)), SLOT(toplevelDeleted(TopWin*))); + updateWindowMenu(); } //--------------------------------------------------------- @@ -2295,9 +1926,10 @@ void MusE::startLMasterEditor() { LMaster* lmaster = new LMaster(); lmaster->show(); - toplevels.push_back(Toplevel(Toplevel::LMASTER, (unsigned long)(lmaster), lmaster)); - connect(lmaster, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long))); + toplevels.push_back(lmaster); + connect(lmaster, SIGNAL(deleted(TopWin*)), SLOT(toplevelDeleted(TopWin*))); connect(MusEGlobal::muse, SIGNAL(configChanged()), lmaster, SLOT(configChanged())); + updateWindowMenu(); } //--------------------------------------------------------- @@ -2315,13 +1947,14 @@ void MusE::startDrumEditor() void MusE::startDrumEditor(PartList* pl, bool showDefaultCtrls) { - DrumEdit* drumEditor = new DrumEdit(pl, this, 0, arranger->cursorValue()); + DrumEdit* drumEditor = new DrumEdit(pl, this, 0, _arranger->cursorValue()); if(showDefaultCtrls) // p4.0.12 drumEditor->addCtrl(); drumEditor->show(); - toplevels.push_back(Toplevel(Toplevel::DRUM, (unsigned long)(drumEditor), drumEditor)); - connect(drumEditor, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long))); + toplevels.push_back(drumEditor); + connect(drumEditor, SIGNAL(deleted(TopWin*)), SLOT(toplevelDeleted(TopWin*))); connect(MusEGlobal::muse, SIGNAL(configChanged()), drumEditor, SLOT(configChanged())); + updateWindowMenu(); } //--------------------------------------------------------- @@ -2343,8 +1976,9 @@ void MusE::startWaveEditor(PartList* pl) WaveEdit* waveEditor = new WaveEdit(pl); waveEditor->show(); connect(MusEGlobal::muse, SIGNAL(configChanged()), waveEditor, SLOT(configChanged())); - toplevels.push_back(Toplevel(Toplevel::WAVE, (unsigned long)(waveEditor), waveEditor)); - connect(waveEditor, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long))); + toplevels.push_back(waveEditor); + connect(waveEditor, SIGNAL(deleted(TopWin*)), SLOT(toplevelDeleted(TopWin*))); + updateWindowMenu(); } @@ -2400,11 +2034,12 @@ void MusE::startClipList(bool checked) if (clipListEdit == 0) { //clipListEdit = new ClipListEdit(); clipListEdit = new ClipListEdit(this); - toplevels.push_back(Toplevel(Toplevel::CLIPLIST, (unsigned long)(clipListEdit), clipListEdit)); - connect(clipListEdit, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long))); + toplevels.push_back(clipListEdit); + connect(clipListEdit, SIGNAL(deleted(TopWin*)), SLOT(toplevelDeleted(TopWin*))); } clipListEdit->show(); viewCliplistAction->setChecked(checked); + updateWindowMenu(); } //--------------------------------------------------------- @@ -2449,63 +2084,57 @@ void MusE::selectProject(QAction* act) // toplevelDeleted //--------------------------------------------------------- -void MusE::toplevelDeleted(unsigned long tl) +void MusE::toplevelDeleted(TopWin* tl) { for (iToplevel i = toplevels.begin(); i != toplevels.end(); ++i) { - if (i->object() == tl) { + if (*i == tl) { + + if (tl == currentMenuSharingTopwin) + setCurrentMenuSharingTopwin(NULL); + + bool mustUpdateScoreMenus=false; - switch(i->type()) { - case Toplevel::MARKER: + switch(tl->type()) { + case TopWin::MARKER: + case TopWin::ARRANGER: break; - case Toplevel::CLIPLIST: + case TopWin::CLIPLIST: // ORCAN: This needs to be verified. aid2 used to correspond to Cliplist: //menu_audio->setItemChecked(aid2, false); - viewCliplistAction->setChecked(false); + viewCliplistAction->setChecked(false); + if (currentMenuSharingTopwin == clipListEdit) + setCurrentMenuSharingTopwin(NULL); + updateWindowMenu(); return; //break; - // the followin editors can exist in more than + + // the following editors can exist in more than // one instantiation: - case Toplevel::PIANO_ROLL: - case Toplevel::LISTE: - case Toplevel::DRUM: - case Toplevel::MASTER: - case Toplevel::WAVE: - case Toplevel::LMASTER: + case TopWin::PIANO_ROLL: + case TopWin::LISTE: + case TopWin::DRUM: + case TopWin::MASTER: + case TopWin::WAVE: + case TopWin::LMASTER: break; - case Toplevel::SCORE: + case TopWin::SCORE: mustUpdateScoreMenus=true; + + case TopWin::TOPLEVELTYPE_LAST_ENTRY: //to avoid a warning + break; } toplevels.erase(i); if (mustUpdateScoreMenus) - updateScoreMenus(); + arrangerView->updateScoreMenus(); + updateWindowMenu(); return; } } - printf("topLevelDeleted: top level %lx not found\n", tl); + printf("topLevelDeleted: top level %p not found\n", 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 @@ -2653,37 +2282,6 @@ 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 @@ -2691,99 +2289,7 @@ void MusE::configPart(int id) void MusE::cmd(int cmd) { - 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(); @@ -2796,43 +2302,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); - } @@ -2843,7 +2316,7 @@ void MusE::selectionChanged() void MusE::configAppearance() { if (!appearance) - appearance = new Appearance(arranger); + appearance = new Appearance(_arranger); appearance->resetValues(); if(appearance->isVisible()) { appearance->raise(); @@ -3255,21 +2728,24 @@ bool MusE::clearSong(bool clear_all) again: for (iToplevel i = toplevels.begin(); i != toplevels.end(); ++i) { - Toplevel tl = *i; - unsigned long obj = tl.object(); - switch (tl.type()) { - case Toplevel::CLIPLIST: - case Toplevel::MARKER: + TopWin* tl = *i; + switch (tl->type()) { + case TopWin::CLIPLIST: + case TopWin::MARKER: + case TopWin::ARRANGER: break; - case Toplevel::PIANO_ROLL: - case Toplevel::SCORE: - case Toplevel::LISTE: - case Toplevel::DRUM: - case Toplevel::MASTER: - case Toplevel::WAVE: - case Toplevel::LMASTER: - ((QWidget*)(obj))->close(); + case TopWin::PIANO_ROLL: + case TopWin::SCORE: + case TopWin::LISTE: + case TopWin::DRUM: + case TopWin::MASTER: + case TopWin::WAVE: + case TopWin::LMASTER: + tl->close(); goto again; + + case TopWin::TOPLEVELTYPE_LAST_ENTRY: //to avoid a warning + break; } } microSleep(100000); @@ -3366,41 +2842,7 @@ void MusE::updateConfiguration() MusEGlobal::undoAction->setShortcut(shortcuts[SHRT_UNDO].key); MusEGlobal::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); @@ -3410,11 +2852,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); @@ -3450,11 +2887,14 @@ void MusE::updateConfiguration() followCtsAction->setShortcut(shortcuts[SHRT_FOLLOW_CONTINUOUS].key); helpManualAction->setShortcut(shortcuts[SHRT_OPEN_HELP].key); + fullscreenAction->setShortcut(shortcuts[SHRT_FULLSCREEN].key); // Orcan: Old stuff, needs to be converted. These aren't used anywhere so I commented them out //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(); //commented out by flo: is done via signal + } //--------------------------------------------------------- @@ -3589,14 +3029,6 @@ void MusE::focusInEvent(QFocusEvent* ev) QMainWindow::focusInEvent(ev); } -//--------------------------------------------------------- -// setUsedTool -//--------------------------------------------------------- - -void MusE::setUsedTool(int tool) - { - tools1->set(tool); - } //--------------------------------------------------------- @@ -3625,4 +3057,384 @@ void MusE::findUnusedWaveFiles() unused.exec(); } +void MusE::focusChanged(QWidget*, QWidget* now) +{ + QWidget* ptr=now; + + if (activeTopWin) + activeTopWin->storeInitialState(); + + if (currentMenuSharingTopwin && (currentMenuSharingTopwin!=activeTopWin)) + currentMenuSharingTopwin->storeInitialState(); + + + + while (ptr) + { + if ( (dynamic_cast<TopWin*>(ptr)!=0) || // *ptr is a TopWin or a derived class + (ptr==this) ) // the main window is selected + break; + ptr=dynamic_cast<QWidget*>(ptr->parent()); //in the unlikely case that ptr is a QObject, this returns NULL, which stops the loop + } + + // ptr is either NULL, this or the pointer to a TopWin + if (ptr!=this) // if the main win is selected, don't treat that as "none", but also don't handle it + { + TopWin* win=dynamic_cast<TopWin*>(ptr); + + // now 'win' is either NULL or the pointer to the active TopWin + if (win!=activeTopWin) + { + activeTopWin=win; + emit activeTopWinChanged(activeTopWin); + } + } +} + + +void MusE::activeTopWinChangedSlot(TopWin* win) +{ + if (MusEGlobal::debugMsg) printf("ACTIVE TOPWIN CHANGED to '%s' (%p)\n", win ? win->windowTitle().toAscii().data() : "<None>", win); + + if ((win==NULL) || (win->isMdiWin()==false)) + { + if (MusEGlobal::debugMsg) printf(" that's out of the MDI area\n"); + menuBar()->setFocus(Qt::MenuBarFocusReason); + } + + if (win && (win->sharesToolsAndMenu())) + setCurrentMenuSharingTopwin(win); +} + + + +void MusE::setCurrentMenuSharingTopwin(TopWin* win) +{ + if (win && (win->sharesToolsAndMenu()==false)) + { + printf("WARNING: THIS SHOULD NEVER HAPPEN: MusE::setCurrentMenuSharingTopwin() called with a win which does not share (%s)! ignoring...\n", win->windowTitle().toAscii().data()); + return; + } + + if (win!=currentMenuSharingTopwin) + { + TopWin* previousMenuSharingTopwin = currentMenuSharingTopwin; + currentMenuSharingTopwin = NULL; + + if (MusEGlobal::debugMsg) printf("MENU SHARING TOPWIN CHANGED to '%s' (%p)\n", win ? win->windowTitle().toAscii().data() : "<None>", win); + + // empty our toolbars + if (previousMenuSharingTopwin) + { + for (list<QToolBar*>::iterator it = foreignToolbars.begin(); it!=foreignToolbars.end(); it++) + if (*it) + { + if (MusEGlobal::debugMsg) printf(" removing sharer's toolbar '%s'\n", (*it)->windowTitle().toAscii().data()); + removeToolBar(*it); // this does not delete *it, which is good + (*it)->setParent(NULL); + } + + foreignToolbars.clear(); + } + else + { + for (list<QToolBar*>::iterator it = optionalToolbars.begin(); it!=optionalToolbars.end(); it++) + if (*it) + { + if (MusEGlobal::debugMsg) printf(" removing optional toolbar '%s'\n", (*it)->windowTitle().toAscii().data()); + removeToolBar(*it); // this does not delete *it, which is good + (*it)->setParent(NULL); + } + } + + //empty our menu + menuBar()->clear(); + + + + + for (list<QMenu*>::iterator it = leadingMenus.begin(); it!=leadingMenus.end(); it++) + menuBar()->addMenu(*it); + + if (win) + { + const QList<QAction*>& actions=win->menuBar()->actions(); + for (QList<QAction*>::const_iterator it=actions.begin(); it!=actions.end(); it++) + { + if (MusEGlobal::debugMsg) printf(" menu entry '%s'\n", (*it)->text().toAscii().data()); + + menuBar()->addAction(*it); + } + + + + const list<QToolBar*>& toolbars=win->toolbars(); + for (list<QToolBar*>::const_iterator it=toolbars.begin(); it!=toolbars.end(); it++) + if (*it) + { + if (MusEGlobal::debugMsg) printf(" toolbar '%s'\n", (*it)->windowTitle().toAscii().data()); + + addToolBar(*it); + foreignToolbars.push_back(*it); + (*it)->show(); + } + else + { + if (MusEGlobal::debugMsg) printf(" toolbar break\n"); + + addToolBarBreak(); + foreignToolbars.push_back(NULL); + } + } + + for (list<QMenu*>::iterator it = trailingMenus.begin(); it!=trailingMenus.end(); it++) + menuBar()->addMenu(*it); + + + currentMenuSharingTopwin=win; + + if (win) + win->restoreMainwinState(); //restore toolbar positions in main window + } +} + +void MusE::addMdiSubWindow(QMdiSubWindow* win) +{ + mdiArea->addSubWindow(win); +} + +void MusE::shareMenuAndToolbarChanged(TopWin* win, bool val) +{ + if (val) + { + if ((win == activeTopWin) && (win != currentMenuSharingTopwin)) + setCurrentMenuSharingTopwin(win); + } + else + { + if (win == currentMenuSharingTopwin) + { + if (activeTopWin && (win != activeTopWin) && (activeTopWin->sharesToolsAndMenu())) + setCurrentMenuSharingTopwin(activeTopWin); + else + setCurrentMenuSharingTopwin(NULL); + } + } +} + +void MusE::updateWindowMenu() +{ + bool sep; + bool there_are_subwins=false; + + menuWindows->clear(); // frees memory automatically + + menuWindows->addAction(windowsCascadeAction); + menuWindows->addAction(windowsTileAction); + menuWindows->addAction(windowsRowsAction); + menuWindows->addAction(windowsColumnsAction); + + sep=false; + for (iToplevel it=toplevels.begin(); it!=toplevels.end(); it++) + if (((*it)->isVisible() || (*it)->isVisibleTo(this)) && (*it)->isMdiWin()) + // the isVisibleTo check is neccessary because isVisible returns false if a + // MdiSubWin is actually visible, but the muse main window is hidden for some reason + { + if (!sep) + { + menuWindows->addSeparator(); + sep=true; + } + QAction* temp=menuWindows->addAction((*it)->windowTitle()); + connect(temp, SIGNAL(activated()), windowsMapper, SLOT(map())); + windowsMapper->setMapping(temp, static_cast<QWidget*>(*it)); + + there_are_subwins=true; + } + + sep=false; + for (iToplevel it=toplevels.begin(); it!=toplevels.end(); it++) + if (((*it)->isVisible() || (*it)->isVisibleTo(this)) && !(*it)->isMdiWin()) + { + if (!sep) + { + menuWindows->addSeparator(); + sep=true; + } + QAction* temp=menuWindows->addAction((*it)->windowTitle()); + connect(temp, SIGNAL(activated()), windowsMapper, SLOT(map())); + windowsMapper->setMapping(temp, static_cast<QWidget*>(*it)); + } + + windowsCascadeAction->setEnabled(there_are_subwins); + windowsTileAction->setEnabled(there_are_subwins); + windowsRowsAction->setEnabled(there_are_subwins); + windowsColumnsAction->setEnabled(there_are_subwins); +} + +void MusE::bringToFront(QWidget* widget) +{ + TopWin* win=dynamic_cast<TopWin*>(widget); + if (win->isMdiWin()) + { + win->show(); + mdiArea->setActiveSubWindow(win->getMdiWin()); + } + else + { + win->activateWindow(); + win->raise(); + } + + activeTopWinChangedSlot(win); +} + +void MusE::setFullscreen(bool val) +{ + if (val) + showFullScreen(); + else + showNormal(); +} + + + +list<QMdiSubWindow*> get_all_visible_subwins(QMdiArea* mdiarea) +{ + QList<QMdiSubWindow*> wins = mdiarea->subWindowList(); + list<QMdiSubWindow*> result; + + // always put the arranger at the top of the list, if visible + + for (QList<QMdiSubWindow*>::iterator it=wins.begin(); it!=wins.end(); it++) + if ((*it)->isVisible() && ((*it)->isMinimized()==false)) + if (dynamic_cast<TopWin*>((*it)->widget())->type()==TopWin::ARRANGER) + result.push_back(*it); + + for (QList<QMdiSubWindow*>::iterator it=wins.begin(); it!=wins.end(); it++) + if ((*it)->isVisible() && ((*it)->isMinimized()==false)) + if (dynamic_cast<TopWin*>((*it)->widget())->type()!=TopWin::ARRANGER) + result.push_back(*it); + + return result; +} + +void MusE::arrangeSubWindowsColumns() +{ + list<QMdiSubWindow*> wins=get_all_visible_subwins(mdiArea); + int n=wins.size(); + + if (n==0) + return; + //else if (n==1) + // (*wins.begin())->showMaximized(); // commented out by flo. i like it better that way. + else + { + int width = mdiArea->width(); + int height = mdiArea->height(); + int x_add = (*wins.begin())->frameGeometry().width() - (*wins.begin())->geometry().width(); + int y_add = (*wins.begin())->frameGeometry().height() - (*wins.begin())->geometry().height(); + int width_per_win = width/n; + + if (x_add >= width_per_win) + { + printf("ERROR: tried to arrange subwins in columns, but there's too few space.\n"); + return; + } + + int i=0; + for (list<QMdiSubWindow*>::iterator it=wins.begin(); it!=wins.end(); it++, i++) + { + int left = (float) width*i/n; + int right = (float) width*(i+1.0)/n; + + (*it)->move(left,0); + (*it)->resize(right-left-x_add, height-y_add); + } + } +} + +void MusE::arrangeSubWindowsRows() +{ + list<QMdiSubWindow*> wins=get_all_visible_subwins(mdiArea); + int n=wins.size(); + + if (n==0) + return; + //else if (n==1) + // (*wins.begin())->showMaximized(); // commented out by flo. i like it better that way. + else + { + int width = mdiArea->width(); + int height = mdiArea->height(); + int x_add = (*wins.begin())->frameGeometry().width() - (*wins.begin())->geometry().width(); + int y_add = (*wins.begin())->frameGeometry().height() - (*wins.begin())->geometry().height(); + int height_per_win = height/n; + + if (y_add >= height_per_win) + { + printf("ERROR: tried to arrange subwins in rows, but there's too few space.\n"); + return; + } + + int i=0; + for (list<QMdiSubWindow*>::iterator it=wins.begin(); it!=wins.end(); it++, i++) + { + int top = (float) height*i/n; + int bottom = (float) height*(i+1.0)/n; + + (*it)->move(0,top); + (*it)->resize(width-x_add, bottom-top-y_add); + } + } +} + +void MusE::tileSubWindows() +{ + list<QMdiSubWindow*> wins=get_all_visible_subwins(mdiArea); + int n=wins.size(); + + if (n==0) + return; + //else if (n==1) + // (*wins.begin())->showMaximized(); // commented out by flo. i like it better that way. + else + { + int nx,ny; + nx=ceil(sqrt(n)); + ny=ceil((double)n/nx); + + int width = mdiArea->width(); + int height = mdiArea->height(); + int x_add = (*wins.begin())->frameGeometry().width() - (*wins.begin())->geometry().width(); + int y_add = (*wins.begin())->frameGeometry().height() - (*wins.begin())->geometry().height(); + int height_per_win = height/ny; + int width_per_win = height/nx; + + if ((x_add >= width_per_win) || (y_add >= height_per_win)) + { + printf("ERROR: tried to tile subwins, but there's too few space.\n"); + return; + } + + int i=0, j=0; + for (list<QMdiSubWindow*>::iterator it=wins.begin(); it!=wins.end(); it++, i++) + { + if (i>=nx) + { + i=0; + j++; + } + + int top = (float) height*j/ny; + int bottom = (float) height*(j+1.0)/ny; + int left = (float) width*i/nx; + int right = (float) width*(i+1.0)/nx; + + (*it)->move(left,top); + (*it)->resize(right-left-x_add, bottom-top-y_add); + } + } +} + } //namespace MusEApp diff --git a/muse2/muse/app.h b/muse2/muse/app.h index 4b0d4195..3bde68e1 100644 --- a/muse2/muse/app.h +++ b/muse2/muse/app.h @@ -28,7 +28,9 @@ #include "cobject.h" #include <QFileInfo> +#include <list> +class TopWin; class QCloseEvent; class QFocusEvent; class QMainWindow; @@ -41,6 +43,7 @@ class QString; class QToolBar; class QToolButton; class QProgressDialog; +class QMdiArea; namespace MusEWidget { class BigTime; @@ -69,6 +72,8 @@ class AudioRecord; class MidiFileConfig; class MidiFilterConfig; class MarkerView; +class ArrangerView; +class GlobalSettingsConfig; class MidiControllerEditDialog; class MidiInputTransformDialog; class MidiTransformerDialog; @@ -96,13 +101,7 @@ namespace MusEApp { 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, @@ -122,26 +121,23 @@ 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: + QMdiArea* mdiArea; + + TopWin* activeTopWin; + TopWin* currentMenuSharingTopwin; + + std::list<QToolBar*> requiredToolbars; //always displayed + std::list<QToolBar*> optionalToolbars; //only displayed when no toolbar-sharing window is active + std::list<QToolBar*> foreignToolbars; //holds a temporary list of the toolbars of a toolbar-sharer + std::list<QMenu*> leadingMenus; + std::list<QMenu*> trailingMenus; + // 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; + QAction* fullscreenAction; // Midi Menu Actions QAction *midiEditInstAction, *midiResetInstAction, *midiInitInstActions, *midiLocalOffAction; @@ -156,6 +152,12 @@ class MusE : public QMainWindow // Automation Menu Actions QAction *autoMixerAction, *autoSnapshotAction, *autoClearAction; + // Window Menu Actions + QAction* windowsCascadeAction; + QAction* windowsTileAction; + QAction* windowsRowsAction; + QAction* windowsColumnsAction; + // Settings Menu Actions QAction *settingsGlobalAction, *settingsShortcutsAction, *settingsMetronomeAction, *settingsMidiSyncAction; QAction *settingsMidiIOAction, *settingsAppearanceAction, *settingsMidiPortAction; @@ -168,18 +170,18 @@ class MusE : public QMainWindow QFileInfo project; QToolBar *tools; - MusEWidget::EditToolBar *tools1; - MusEWidget::VisibleTracks *visTracks; + // when adding a toolbar to the main window, remember adding it to + // either the requiredToolbars or optionalToolbars list! Transport* transport; MusEWidget::BigTime* bigtime; EditInstrument* editInstrument; - QMenu *menu_file, *menuView, *menuSettings, *menu_help; - QMenu *menuEdit, *menuStructure; + // when adding a menu to the main window, remember adding it to + // either the leadingMenus or trailingMenus list! + QMenu *menu_file, *menuView, *menuSettings, *menuWindows, *menu_help; 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. MusEWidget::RoutePopupMenu* routingPopupMenu; @@ -203,9 +205,11 @@ class MusE : public QMainWindow AudioMixerApp* mixer1; AudioMixerApp* mixer2; + Arranger* _arranger; ToplevelList toplevels; ClipListEdit* clipListEdit; MarkerView* markerView; + ArrangerView* arrangerView; MidiTransformerDialog* midiTransformerDialog; QMenu* openRecent; @@ -235,16 +239,14 @@ 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; + QSignalMapper *windowsMapper; signals: void configChanged(); + void activeTopWinChanged(TopWin*); private slots: void loadProject(); @@ -265,6 +267,7 @@ class MusE : public QMainWindow void toggleTransport(bool); void toggleMarker(bool); + void toggleArranger(bool); void toggleBigTime(bool); void toggleMixer1(bool); void toggleMixer2(bool); @@ -274,30 +277,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); @@ -305,8 +287,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(); @@ -321,11 +301,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(); @@ -337,11 +312,20 @@ 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); + + void activeTopWinChangedSlot(TopWin*); + void setCurrentMenuSharingTopwin(TopWin*); + + void bringToFront(QWidget* win); + void setFullscreen(bool); + + void arrangeSubWindowsRows(); + void arrangeSubWindowsColumns(); + void tileSubWindows(); public slots: bool saveAs(); @@ -349,7 +333,7 @@ class MusE : public QMainWindow void closeEvent(QCloseEvent*e); void loadProjectFile(const QString&); void loadProjectFile(const QString&, bool songTemplate, bool loadAll); - void toplevelDeleted(unsigned long tl); + void toplevelDeleted(TopWin* tl); void loadTheme(const QString&); void loadStyleSheetFile(const QString&); bool seqRestart(); @@ -358,16 +342,42 @@ 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(); + + void focusChanged(QWidget* old, QWidget* now); + + void addMdiSubWindow(QMdiSubWindow*); + void shareMenuAndToolbarChanged(TopWin*, bool); + + void updateWindowMenu(); + public: MusE(int argc, char** argv); ~MusE(); - Arranger* arranger; + Arranger* arranger() { return _arranger; } QRect configGeometryMain; QProgressDialog *progress; bool importMidi(const QString name, bool merge); @@ -387,6 +397,10 @@ class MusE : public QMainWindow void showTransport(bool flag); MusEWidget::RoutePopupMenu* getRoutingPopupMenu(); + const ToplevelList* getToplevels() { return &toplevels; } + + TopWin* getCurrentMenuSharingTopwin() { return currentMenuSharingTopwin; } + #ifdef HAVE_LASH void lash_idle_cb (); #endif diff --git a/muse2/muse/appearance.cpp b/muse2/muse/appearance.cpp index c26f9542..835ced81 100644 --- a/muse2/muse/appearance.cpp +++ b/muse2/muse/appearance.cpp @@ -550,7 +550,7 @@ void Appearance::bgSelectionChanged(QTreeWidgetItem* item) removeBgButton->setEnabled(true); lastSelectedBgItem = item; - MusEGlobal::muse->arranger->getCanvas()->setBg(QPixmap(item->data(0, Qt::UserRole).toString())); + MusEGlobal::muse->arranger()->getCanvas()->setBg(QPixmap(item->data(0, Qt::UserRole).toString())); } //--------------------------------------------------------- @@ -741,7 +741,7 @@ void Appearance::ok() void Appearance::cancel() { - MusEGlobal::muse->arranger->getCanvas()->setBg(QPixmap(config->canvasBgPixmap)); + MusEGlobal::muse->arranger()->getCanvas()->setBg(QPixmap(config->canvasBgPixmap)); close(); } @@ -752,7 +752,7 @@ void Appearance::cancel() void Appearance::removeBackground() { QTreeWidgetItem* item = backgroundTree->currentItem(); - MusEGlobal::muse->arranger->getCanvas()->setBg(QPixmap()); + MusEGlobal::muse->arranger()->getCanvas()->setBg(QPixmap()); user_bg->takeChild(user_bg->indexOfChild(item)); backgroundTree->setCurrentItem (0); removeBgButton->setEnabled(false); @@ -791,7 +791,7 @@ void Appearance::addBackground() void Appearance::clearBackground() { - MusEGlobal::muse->arranger->getCanvas()->setBg(QPixmap()); + MusEGlobal::muse->arranger()->getCanvas()->setBg(QPixmap()); backgroundTree->setCurrentItem (0); removeBgButton->setEnabled(false); } diff --git a/muse2/muse/arranger/CMakeLists.txt b/muse2/muse/arranger/CMakeLists.txt index af6a30b5..d81d92c6 100644 --- a/muse2/muse/arranger/CMakeLists.txt +++ b/muse2/muse/arranger/CMakeLists.txt @@ -27,6 +27,7 @@ QT4_WRAP_CPP (arranger_mocs alayout.h arranger.h + arrangerview.h pcanvas.h tlist.h ) @@ -37,6 +38,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 3052d7d4..09e67151 100644 --- a/muse2/muse/arranger/arranger.cpp +++ b/muse2/muse/arranger/arranger.cpp @@ -38,6 +38,7 @@ #include <QWheelEvent> #include <QPainter> //#include <QStackedWidget> +#include "arrangerview.h" #include "arranger.h" #include "song.h" @@ -111,7 +112,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); @@ -122,11 +123,12 @@ Arranger::Arranger(QMainWindow* parent, const char* name) ///program = CTRL_VAL_UNKNOWN; ///pan = -65; ///volume = -1; - setMinimumSize(600, 50); showTrackinfoFlag = true; cursVal = MAXINT; + parentWin=parent; + //setFocusPolicy(Qt::StrongFocus); //--------------------------------------------------- @@ -396,7 +398,7 @@ Arranger::Arranger(QMainWindow* parent, const char* name) canvas->setCanvasTools(MusEWidget::arrangerTools); canvas->setOrigin(-offset, 0); canvas->setFocus(); - //parent->setFocusProxy(canvas); // Tim. + setFocusProxy(canvas); // once removed by Tim (r735), added by flo again connect(canvas, SIGNAL(setUsedTool(int)), this, SIGNAL(setUsedTool(int))); connect(canvas, SIGNAL(trackChanged(Track*)), list, SLOT(selectTrack(Track*))); @@ -761,20 +763,20 @@ void Arranger::cmd(int cmd) case CMD_COPY_PART: ncmd = PartCanvas::CMD_COPY_PART; break; + case CMD_COPY_PART_IN_RANGE: + ncmd = PartCanvas::CMD_COPY_PART_IN_RANGE; + break; case CMD_PASTE_PART: ncmd = PartCanvas::CMD_PASTE_PART; break; case CMD_PASTE_CLONE_PART: ncmd = PartCanvas::CMD_PASTE_CLONE_PART; break; - case CMD_PASTE_PART_TO_TRACK: - ncmd = PartCanvas::CMD_PASTE_PART_TO_TRACK; - break; - case CMD_PASTE_CLONE_PART_TO_TRACK: - ncmd = PartCanvas::CMD_PASTE_CLONE_PART_TO_TRACK; + case CMD_PASTE_DIALOG: + ncmd = PartCanvas::CMD_PASTE_DIALOG; break; - case CMD_INSERT_PART: - ncmd = PartCanvas::CMD_INSERT_PART; + case CMD_PASTE_CLONE_DIALOG: + ncmd = PartCanvas::CMD_PASTE_CLONE_DIALOG; break; case CMD_INSERT_EMPTYMEAS: ncmd = PartCanvas::CMD_INSERT_EMPTYMEAS; diff --git a/muse2/muse/arranger/arranger.h b/muse2/muse/arranger/arranger.h index 77299ef6..1e3943be 100644 --- a/muse2/muse/arranger/arranger.h +++ b/muse2/muse/arranger/arranger.h @@ -57,6 +57,8 @@ class Splitter; class SpinBox; } +class ArrangerView; + //--------------------------------------------------------- // WidgetStack //--------------------------------------------------------- @@ -167,10 +169,10 @@ class Arranger : public QWidget { void controllerChanged(Track *t); public: - 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 }; + enum { CMD_CUT_PART, CMD_COPY_PART, CMD_COPY_PART_IN_RANGE, CMD_PASTE_PART, CMD_PASTE_CLONE_PART, + CMD_PASTE_DIALOG, CMD_PASTE_CLONE_DIALOG, CMD_INSERT_EMPTYMEAS }; - Arranger(QMainWindow* parent, const char* name = 0); + Arranger(ArrangerView* parent, const char* name = 0); PartCanvas* getCanvas() { return canvas; } void setMode(int); @@ -187,6 +189,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..0cc75db9 --- /dev/null +++ b/muse2/muse/arranger/arrangerview.cpp @@ -0,0 +1,726 @@ +//========================================================= +// MusE +// Linux Music Editor +// arrangerview.cpp +// (C) Copyright 2011 Florian Jung (flo93@users.sourceforge.net) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; version 2 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//========================================================= + + +#include <QApplication> +#include <QClipboard> +#include <QCloseEvent> +#include <QDir> +#include <QGridLayout> +#include <QImage> +#include <QInputDialog> +#include <QKeyEvent> +#include <QKeySequence> +#include <QLabel> +#include <QLayout> +#include <QMenu> +#include <QMenuBar> +#include <QMessageBox> +#include <QMimeData> +#include <QPushButton> +#include <QResizeEvent> +#include <QScrollArea> +#include <QScrollBar> +#include <QSettings> +#include <QShortcut> +#include <QSignalMapper> +#include <QSizeGrip> +#include <QToolButton> +#include <QToolTip> + +#include "al/sig.h" +#include "app.h" +#include "arrangerview.h" +#include "audio.h" +#include "functions.h" +#include "gconfig.h" +#include "globals.h" +#include "helper.h" +#include "icons.h" +#include "mtscale.h" +#include "scoreedit.h" +#include "shortcuts.h" +#include "sig.h" +#include "song.h" +#include "structure.h" +#include "tb1.h" +#include "tools.h" +#include "ttoolbar.h" +#include "visibletracks.h" +#include "xml.h" + + +//--------------------------------------------------------- +// ArrangerView +//--------------------------------------------------------- + +ArrangerView::ArrangerView(QWidget* parent) + : TopWin(TopWin::ARRANGER, parent, "arrangerview", Qt::Window) +{ + using MusEGlobal::muse; + + //setAttribute(Qt::WA_DeleteOnClose); + setWindowTitle(tr("MusE: Arranger")); + setFocusPolicy(Qt::StrongFocus); + + arranger = new Arranger(this, "arranger"); + setCentralWidget(arranger); + setFocusProxy(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(MusEGlobal::undoRedo->actions()); + + + QToolBar* panic_toolbar = addToolBar(tr("panic")); + panic_toolbar->setObjectName("panic"); + panic_toolbar->addAction(MusEGlobal::panicAction); + + QToolBar* transport_toolbar = addToolBar(tr("transport")); + transport_toolbar->setObjectName("transport"); + transport_toolbar->addActions(MusEGlobal::transportAction->actions()); + + editTools = new MusEWidget::EditToolBar(this, MusEWidget::arrangerTools); + addToolBar(editTools); + editTools->setObjectName("arrangerTools"); + + visTracks = new MusEWidget::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); + editCopyRangeAction = new QAction(QIcon(*editcopyIconSet), tr("&Copy in range"), this); + editPasteAction = new QAction(QIcon(*editpasteIconSet), tr("&Paste"), this); + editPasteDialogAction = new QAction(QIcon(*editpasteIconSet), tr("Paste (show dialog)"), this); + editPasteCloneAction = new QAction(QIcon(*editpasteCloneIconSet), tr("Paste c&lone"), this); + editPasteCloneDialogAction = new QAction(QIcon(*editpasteCloneIconSet), tr("Paste clone (show dialog)"), this); + editInsertEMAction = new QAction(QIcon(*editpasteIconSet), tr("&Insert Empty Measure"), 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); + + + + //------------------------------------------------------------- + // popup Edit + //------------------------------------------------------------- + + QMenu* menuEdit = menuBar()->addMenu(tr("&Edit")); + menuEdit->addActions(MusEGlobal::undoRedo->actions()); + menuEdit->addSeparator(); + + menuEdit->addAction(editCutAction); + menuEdit->addAction(editCopyAction); + menuEdit->addAction(editCopyRangeAction); + menuEdit->addAction(editPasteAction); + menuEdit->addAction(editPasteDialogAction); + menuEdit->addAction(editPasteCloneAction); + menuEdit->addAction(editPasteCloneDialogAction); + menuEdit->addAction(editInsertEMAction); + 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); + + + + QMenu* functions_menu = menuBar()->addMenu(tr("Functions")); + QAction* func_quantize_action = functions_menu->addAction(tr("&Quantize Notes"), editSignalMapper, SLOT(map())); + QAction* func_notelen_action = functions_menu->addAction(tr("Change note &length"), editSignalMapper, SLOT(map())); + QAction* func_velocity_action = functions_menu->addAction(tr("Change note &velocity"), editSignalMapper, SLOT(map())); + QAction* func_cresc_action = functions_menu->addAction(tr("Crescendo/Decrescendo"), editSignalMapper, SLOT(map())); + QAction* func_transpose_action = functions_menu->addAction(tr("Transpose"), editSignalMapper, SLOT(map())); + QAction* func_erase_action = functions_menu->addAction(tr("Erase Events (Not Parts)"), editSignalMapper, SLOT(map())); + QAction* func_move_action = functions_menu->addAction(tr("Move Events (Not Parts)"), editSignalMapper, SLOT(map())); + QAction* func_fixed_len_action = functions_menu->addAction(tr("Set Fixed Note Length"), editSignalMapper, SLOT(map())); + QAction* func_del_overlaps_action = functions_menu->addAction(tr("Delete Overlapping Notes"), editSignalMapper, SLOT(map())); + QAction* func_legato_action = functions_menu->addAction(tr("Legato"), editSignalMapper, SLOT(map())); + editSignalMapper->setMapping(func_quantize_action, CMD_QUANTIZE); + editSignalMapper->setMapping(func_notelen_action, CMD_NOTELEN); + editSignalMapper->setMapping(func_velocity_action, CMD_VELOCITY); + editSignalMapper->setMapping(func_cresc_action, CMD_CRESCENDO); + editSignalMapper->setMapping(func_transpose_action, CMD_TRANSPOSE); + editSignalMapper->setMapping(func_erase_action, CMD_ERASE); + editSignalMapper->setMapping(func_move_action, CMD_MOVE); + editSignalMapper->setMapping(func_fixed_len_action, CMD_FIXED_LEN); + editSignalMapper->setMapping(func_del_overlaps_action, CMD_DELETE_OVERLAPS); + editSignalMapper->setMapping(func_legato_action, CMD_LEGATO); + + + + QMenu* menuSettings = menuBar()->addMenu(tr("Window &Config")); + menuSettings->addAction(subwinAction); + menuSettings->addAction(shareAction); + menuSettings->addAction(fullscreenAction); + + + //-------- Edit connections + connect(editCutAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + connect(editCopyAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + connect(editCopyRangeAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + connect(editPasteAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + connect(editPasteCloneAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + connect(editPasteDialogAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + connect(editPasteCloneDialogAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); + connect(editInsertEMAction, 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(editCopyRangeAction, CMD_COPY_RANGE); + editSignalMapper->setMapping(editPasteAction, CMD_PASTE); + editSignalMapper->setMapping(editPasteCloneAction, CMD_PASTE_CLONE); + editSignalMapper->setMapping(editPasteDialogAction, CMD_PASTE_DIALOG); + editSignalMapper->setMapping(editPasteCloneDialogAction, CMD_PASTE_CLONE_DIALOG); + 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(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(static_cast<TopWin*>(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 if (tag == "topwin") + TopWin::readStatus(xml); + else + xml.unknown("ArrangerView"); + break; + + case Xml::TagEnd: + if (tag == "arrangerview") + return; + + default: + break; + } + } +} + +//--------------------------------------------------------- +// readConfiguration +//--------------------------------------------------------- + +void ArrangerView::readConfiguration(Xml& xml) + { + for (;;) { + Xml::Token token = xml.parse(); + const QString& tag = xml.s1(); + switch (token) { + case Xml::Error: + case Xml::End: + return; + case Xml::TagStart: + if (tag == "topwin") + TopWin::readConfiguration(ARRANGER, xml); + else + xml.unknown("ArrangerView"); + break; + case Xml::TagEnd: + if (tag == "arrangerview") + return; + default: + break; + } + } + } + +//--------------------------------------------------------- +// writeConfiguration +//--------------------------------------------------------- + +void ArrangerView::writeConfiguration(int level, Xml& xml) + { + xml.tag(level++, "arrangerview"); + TopWin::writeConfiguration(ARRANGER, level, xml); + xml.tag(level, "/arrangerview"); + } + + +void ArrangerView::cmd(int cmd) + { + 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_COPY_RANGE: + arranger->cmd(Arranger::CMD_COPY_PART_IN_RANGE); + 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_DIALOG: + arranger->cmd(Arranger::CMD_PASTE_DIALOG); + break; + case CMD_PASTE_CLONE_DIALOG: + arranger->cmd(Arranger::CMD_PASTE_CLONE_DIALOG); + 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; + + case CMD_QUANTIZE: quantize_notes(); break; + case CMD_VELOCITY: modify_velocity(); break; + case CMD_CRESCENDO: crescendo(); break; + case CMD_NOTELEN: modify_notelen(); break; + case CMD_TRANSPOSE: transpose_notes(); break; + case CMD_ERASE: erase_notes(); break; + case CMD_MOVE: move_notes(); break; + case CMD_FIXED_LEN: set_notelen(); break; + case CMD_DELETE_OVERLAPS: delete_overlaps(); break; + case CMD_LEGATO: legato(); 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=MusEGlobal::muse->getToplevels(); + + for (ToplevelList::const_iterator it=toplevels->begin(); it!=toplevels->end(); it++) + if ((*it)->type()==TopWin::SCORE) + { + ScoreEdit* score = dynamic_cast<ScoreEdit*>(*it); + + 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 = MusEUtil::populateAddTrack(addTrack); + connect(addTrack, SIGNAL(triggered(QAction *)), SLOT(addNewTrack(QAction *))); + + 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::addNewTrack(QAction* action) +{ + song->addNewTrack(action, MusEGlobal::muse->arranger()->curTrack()); // Insert at current selected track. + //song->addNewTrack(action); // Add at end. +} + +void ArrangerView::updateShortcuts() +{ + editCutAction->setShortcut(shortcuts[SHRT_CUT].key); + editCopyAction->setShortcut(shortcuts[SHRT_COPY].key); + editCopyRangeAction->setShortcut(shortcuts[SHRT_COPY_RANGE].key); + editPasteAction->setShortcut(shortcuts[SHRT_PASTE].key); + editPasteCloneAction->setShortcut(shortcuts[SHRT_PASTE_CLONE].key); + editPasteDialogAction->setShortcut(shortcuts[SHRT_PASTE_DIALOG].key); + editPasteCloneDialogAction->setShortcut(shortcuts[SHRT_PASTE_CLONE_DIALOG].key); + editInsertEMAction->setShortcut(shortcuts[SHRT_INSERTMEAS].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); +} + +//--------------------------------------------------------- +// 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); + editPasteCloneAction->setEnabled(flag); + editPasteDialogAction->setEnabled(flag); + editPasteCloneDialogAction->setEnabled(flag); + } + +//--------------------------------------------------------- +// selectionChanged +//--------------------------------------------------------- + +void ArrangerView::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); + } + + +void ArrangerView::updateVisibleTracksButtons() +{ + visTracks->updateVisibleTracksButtons(); +} + +void ArrangerView::globalCut() { ::globalCut(); } +void ArrangerView::globalInsert() { ::globalInsert(); } +void ArrangerView::globalSplit() { ::globalSplit(); } diff --git a/muse2/muse/arranger/arrangerview.h b/muse2/muse/arranger/arrangerview.h new file mode 100644 index 00000000..bdb450ae --- /dev/null +++ b/muse2/muse/arranger/arrangerview.h @@ -0,0 +1,156 @@ +//========================================================= +// MusE +// Linux Music Editor +// arrangerview.h +// (C) Copyright 2011 Florian Jung (flo93@users.sourceforge.net) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; version 2 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//========================================================= + +#ifndef __ARRANGERVIEW_H__ +#define __ARRANGERVIEW_H__ + +#include <QCloseEvent> +#include <QResizeEvent> +#include <QLabel> +#include <QKeyEvent> +#include <QPainter> +#include <QPixmap> +#include <QTimer> +#include <QScrollBar> +#include <QComboBox> +#include <QSignalMapper> +#include <QAction> +#include <QActionGroup> +#include <QGridLayout> +#include <QByteArray> +#include <QToolButton> + +#include <values.h> +#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" + +namespace MusEWidget { class VisibleTracks; } + + +class ArrangerView : public TopWin +{ + Q_OBJECT + + private: + + enum cmd_enum + {CMD_CUT, CMD_COPY, CMD_COPY_RANGE, CMD_PASTE, CMD_INSERTMEAS, CMD_PASTE_CLONE, + CMD_PASTE_DIALOG, CMD_PASTE_CLONE_DIALOG, 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, + CMD_QUANTIZE, CMD_VELOCITY, CMD_CRESCENDO, CMD_NOTELEN, CMD_TRANSPOSE, + CMD_ERASE, CMD_MOVE, CMD_FIXED_LEN, CMD_DELETE_OVERLAPS, CMD_LEGATO }; + + virtual void closeEvent(QCloseEvent*); + + QGridLayout* mainGrid; + QWidget* mainw; + + MusEWidget::EditToolBar* editTools; + MusEWidget::VisibleTracks* visTracks; + + Arranger* arranger; + + // Edit Menu actions + QMenu* select; + QMenu* addTrack; + QMenu* master; + + QAction *strGlobalCutAction, *strGlobalInsertAction, *strGlobalSplitAction; + QAction *trackMidiAction, *trackDrumAction, *trackWaveAction, *trackAOutputAction, *trackAGroupAction; + QAction *trackAInputAction, *trackAAuxAction; + QAction *editCutAction, *editCopyAction, *editCopyRangeAction; + QAction *editPasteAction, *editPasteCloneAction, *editPasteDialogAction, *editPasteCloneDialogAction; + QAction *editInsertEMAction, *editPasteC2TAction, *editDeleteSelectedAction, *editSelectAllAction, *editDeselectAllAction; + QAction *editInvertSelectionAction, *editInsideLoopAction, *editOutsideLoopAction, *editAllPartsAction; + QAction *masterGraphicAction, *masterListAction; + QAction *midiTransformerAction; + QAction *editCleanPartsAction, *editShrinkPartsAction, *editExpandPartsAction; + + QAction* func_quantize_action; + QAction* func_notelen_action; + QAction* func_velocity_action; + QAction* func_cresc_action; + QAction* func_transpose_action; + QAction* func_erase_action; + QAction* func_move_action; + QAction* func_fixed_len_action; + QAction* func_del_overlaps_action; + QAction* func_legato_action; + + QSignalMapper *editSignalMapper; + QSignalMapper *scoreOneStaffPerTrackMapper; + QSignalMapper *scoreAllInOneMapper; + + private slots: + void clearScoreMenuMappers(); + void globalCut(); + void globalInsert(); + void globalSplit(); + void cmd(int); + void addNewTrack(QAction* action); + + signals: + void deleted(TopWin*); + void closed(); + + public slots: + void scoreNamingChanged(); + void updateScoreMenus(); + void clipboardChanged(); + void selectionChanged(); + void updateShortcuts(); + void updateVisibleTracksButtons(); + + public: + ArrangerView(QWidget* parent = 0); + ~ArrangerView(); + + QAction *startScoreEditAction, *startPianoEditAction, *startDrumEditAction, *startListEditAction, *startWaveEditAction; + QMenu *scoreSubmenu, *scoreOneStaffPerTrackSubsubmenu, *scoreAllInOneSubsubmenu; + + void populateAddTrack(); + + Arranger* getArranger() {return arranger;} + + void writeStatus(int level, Xml& xml) const; + void readStatus(Xml& xml); + static void readConfiguration(Xml&); + static void writeConfiguration(int, Xml&); +}; + + + + +#endif + diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp index 0d73ace6..056dcce7 100644 --- a/muse2/muse/arranger/pcanvas.cpp +++ b/muse2/muse/arranger/pcanvas.cpp @@ -40,6 +40,9 @@ #include "fastlog.h" #include "widgets/tools.h" +#include "arranger.h" +#include "arrangerview.h" +#include "structure.h" #include "pcanvas.h" #include "midieditor.h" #include "globals.h" @@ -58,11 +61,17 @@ #include "midi.h" #include "midictrl.h" #include "utils.h" +#include "dialogs.h" +#include "widgets/pastedialog.h" //#define ABS(x) ((x) < 0) ? -(x) : (x)) //#define ABS(x) (x>=0?x:-x) #define ABS(x) (abs(x)) +using std::set; + +int get_paste_len(); + //--------------------------------------------------------- // colorRect // paints a rectangular icon with a given color @@ -172,15 +181,19 @@ void PartCanvas::leaveEvent(QEvent*) void PartCanvas::returnPressed() { lineEditor->hide(); - Part* oldPart = editPart->part(); - Part* newPart = oldPart->clone(); - //printf("PartCanvas::returnPressed before msgChangePart oldPart refs:%d Arefs:%d newPart refs:%d Arefs:%d\n", oldPart->events()->refCount(), oldPart->events()->arefCount(), newPart->events()->refCount(), newPart->events()->arefCount()); - - newPart->setName(lineEditor->text()); - // Indicate do undo, and do port controller values but not clone parts. - audio->msgChangePart(oldPart, newPart, true, true, false); - - editMode = false; + if (editMode) { + //this check is neccessary, because it returnPressed may be called + //twice. the second call would cause a crash, however! + Part* oldPart = editPart->part(); + Part* newPart = oldPart->clone(); + //printf("PartCanvas::returnPressed before msgChangePart oldPart refs:%d Arefs:%d newPart refs:%d Arefs:%d\n", oldPart->events()->refCount(), oldPart->events()->arefCount(), newPart->events()->refCount(), newPart->events()->arefCount()); + + newPart->setName(lineEditor->text()); + // Indicate do undo, and do port controller values but not clone parts. + audio->msgChangePart(oldPart, newPart, true, true, false); + + editMode = false; + } } //--------------------------------------------------------- @@ -203,6 +216,7 @@ void PartCanvas::viewMouseDoubleClickEvent(QMouseEvent* event) if (lineEditor == 0) { lineEditor = new QLineEdit(this); lineEditor->setFrame(true); + connect(lineEditor, SIGNAL(editingFinished()),SLOT(returnPressed())); } editMode = true; lineEditor->setGeometry(r); @@ -335,7 +349,7 @@ UndoOp PartCanvas::moveItem(MusEWidget::CItem* item, const QPoint& newpos, DragT ntrack = tracks->size(); if (MusEGlobal::debugMsg) printf("PartCanvas::moveItem - add new track\n"); - Track* newTrack = song->addTrack(int(type)); + Track* newTrack = song->addTrack(type, false); // Add at end of list. if (type == Track::WAVE) { WaveTrack* st = (WaveTrack*) track; WaveTrack* dt = (WaveTrack*) newTrack; @@ -648,17 +662,17 @@ QMenu* PartCanvas::genItemPopup(MusEWidget::CItem* item) partPopup->addSeparator(); switch(trackType) { case Track::MIDI: { - partPopup->addAction(MusEGlobal::muse->startPianoEditAction); - partPopup->addMenu(MusEGlobal::muse->scoreSubmenu); - partPopup->addAction(MusEGlobal::muse->startScoreEditAction); - partPopup->addAction(MusEGlobal::muse->startListEditAction); + partPopup->addAction(MusEGlobal::muse->arranger()->parentWin->startPianoEditAction); + partPopup->addMenu(MusEGlobal::muse->arranger()->parentWin->scoreSubmenu); + partPopup->addAction(MusEGlobal::muse->arranger()->parentWin->startScoreEditAction); + partPopup->addAction(MusEGlobal::muse->arranger()->parentWin->startListEditAction); QAction *act_mexport = partPopup->addAction(tr("save part to disk")); act_mexport->setData(16); } break; case Track::DRUM: { - partPopup->addAction(MusEGlobal::muse->startDrumEditAction); - partPopup->addAction(MusEGlobal::muse->startListEditAction); + partPopup->addAction(MusEGlobal::muse->arranger()->parentWin->startDrumEditAction); + partPopup->addAction(MusEGlobal::muse->arranger()->parentWin->startListEditAction); QAction *act_dexport = partPopup->addAction(tr("save part to disk")); act_dexport->setData(16); } @@ -705,6 +719,7 @@ void PartCanvas::itemPopup(MusEWidget::CItem* item, int n, const QPoint& pt) if (lineEditor == 0) { lineEditor = new QLineEdit(this); lineEditor->setFrame(true); + connect(lineEditor, SIGNAL(editingFinished()),SLOT(returnPressed())); } lineEditor->setText(editPart->name()); lineEditor->setFocus(); @@ -846,25 +861,32 @@ void PartCanvas::mousePress(QMouseEvent* event) } QPoint pt = event->pos(); MusEWidget::CItem* item = items.find(pt); - if (item == 0 && _tool!=MusEWidget::AutomationTool) - return; + + //if (item == 0 && _tool!=MusEWidget::AutomationTool) // FINDMICHJETZT. neccessary? (flo93) + // return; + switch (_tool) { default: - emit trackChanged(item->part()->track()); + if (item) + emit trackChanged(item->part()->track()); + else + emit trackChanged(NULL); break; case MusEWidget::CutTool: - splitItem(item, pt); + if (item) splitItem(item, pt); break; case MusEWidget::GlueTool: - glueItem(item); + if (item) glueItem(item); break; case MusEWidget::MuteTool: { - NPart* np = (NPart*) item; - Part* p = np->part(); - p->setMute(!p->mute()); - redraw(); - break; + if (item) { + NPart* np = (NPart*) item; + Part* p = np->part(); + p->setMute(!p->mute()); + redraw(); + break; + } } case MusEWidget::AutomationTool: if (automation.controllerState != doNothing) @@ -943,7 +965,7 @@ void PartCanvas::keyPress(QKeyEvent* event) { if ( key == Qt::Key_Return || key == Qt::Key_Enter ) { - returnPressed(); + //returnPressed(); commented out by flo return; } else if ( key == Qt::Key_Escape ) @@ -2588,21 +2610,39 @@ void PartCanvas::cmd(int cmd) case CMD_COPY_PART: copy(&pl); break; - case CMD_PASTE_PART: - paste(false, false); - break; - case CMD_PASTE_CLONE_PART: - paste(true, false); + case CMD_COPY_PART_IN_RANGE: + copy_in_range(&pl); break; - case CMD_PASTE_PART_TO_TRACK: + case CMD_PASTE_PART: paste(); break; - case CMD_PASTE_CLONE_PART_TO_TRACK: + case CMD_PASTE_CLONE_PART: paste(true); break; - case CMD_INSERT_PART: - paste(false, false, true); + case CMD_PASTE_DIALOG: + case CMD_PASTE_CLONE_DIALOG: + { + unsigned temp_begin = AL::sigmap.raster1(song->vcpos(),0); + unsigned temp_end = AL::sigmap.raster2(temp_begin + get_paste_len(), 0); + paste_dialog->raster = temp_end - temp_begin; + paste_dialog->clone = (cmd == CMD_PASTE_CLONE_DIALOG); + + if (paste_dialog->exec()) + { + paste_mode_t paste_mode; + switch (paste_dialog->insert_method) + { + case 0: paste_mode=PASTEMODE_MIX; break; + case 1: paste_mode=PASTEMODE_MOVEALL; break; + case 2: paste_mode=PASTEMODE_MOVESOME; break; + } + + paste(paste_dialog->clone, paste_mode, paste_dialog->all_in_one_track, + paste_dialog->number, paste_dialog->raster); + } + break; + } case CMD_INSERT_EMPTYMEAS: int startPos=song->vcpos(); int oneMeas=AL::sigmap.ticksMeasure(startPos); @@ -2617,6 +2657,70 @@ void PartCanvas::cmd(int cmd) // cut copy paste //--------------------------------------------------------- +void PartCanvas::copy_in_range(PartList* pl_) +{ + PartList pl; + PartList result_pl; + unsigned int lpos = song->lpos(); + unsigned int rpos = song->rpos(); + + if (pl_->empty()) + { + for (MusEWidget::iCItem i = items.begin(); i != items.end(); ++i) + { + Part* part=static_cast<NPart*>(i->second)->part(); + if ( (part->track()->isMidiTrack()) || (part->track()->type() == Track::WAVE) ) + pl.add(part); + } + } + else + { + for(ciPart p = pl_->begin(); p != pl_->end(); ++p) + if ( (p->second->track()->isMidiTrack()) || (p->second->track()->type() == Track::WAVE) ) + pl.add(p->second); + } + + if (!pl.empty() && (rpos>lpos)) + { + for(ciPart p = pl.begin(); p != pl.end(); ++p) + { + Part* part=p->second; + Track* track=part->track(); + + if ((part->tick() < rpos) && (part->endTick() > lpos)) //is the part in the range? + { + if ((lpos > part->tick()) && (lpos < part->endTick())) + { + Part* p1; + Part* p2; + + track->splitPart(part, lpos, p1, p2); + p1->events()->incARef(-1); + p2->events()->incARef(-1); + + part=p2; + } + + if ((rpos > part->tick()) && (rpos < part->endTick())) + { + Part* p1; + Part* p2; + + track->splitPart(part, rpos, p1, p2); + p1->events()->incARef(-1); + p2->events()->incARef(-1); + + part=p1; + } + + result_pl.add(part); + } + } + + copy(&result_pl); + } +} + void PartCanvas::copy(PartList* pl) { if (pl->empty()) @@ -2700,11 +2804,88 @@ void PartCanvas::copy(PartList* pl) fclose(tmp); } -//--------------------------------------------------------- -// pasteAt -//--------------------------------------------------------- -Undo PartCanvas::pasteAt(const QString& pt, Track* track, unsigned int pos, bool clone, bool toTrack, int* finalPosPtr) + +int get_paste_len() +{ + QClipboard* cb = QApplication::clipboard(); + const QMimeData* md = cb->mimeData(QClipboard::Clipboard); + + QString pfx("text/"); + QString mdpl("x-muse-midipartlist"); + QString wvpl("x-muse-wavepartlist"); + QString mxpl("x-muse-mixedpartlist"); + QString txt; + + if(md->hasFormat(pfx + mdpl)) + txt = cb->text(mdpl, QClipboard::Clipboard); + else if(md->hasFormat(pfx + wvpl)) + txt = cb->text(wvpl, QClipboard::Clipboard); + else if(md->hasFormat(pfx + mxpl)) + txt = cb->text(mxpl, QClipboard::Clipboard); + else + return 0; + + + QByteArray ba = txt.toLatin1(); + const char* ptxt = ba.constData(); + Xml xml(ptxt); + bool end = false; + + unsigned begin_tick=-1; //this uses the greatest possible begin_tick + unsigned end_tick=0; + + for (;;) + { + Xml::Token token = xml.parse(); + const QString& tag = xml.s1(); + switch (token) + { + case Xml::Error: + case Xml::End: + end = true; + break; + + case Xml::TagStart: + if (tag == "part") + { + Part* p = 0; + p = readXmlPart(xml, NULL, false, false); + + if (p) + { + if (p->tick() < begin_tick) + begin_tick=p->tick(); + + if (p->endTick() > end_tick) + end_tick=p->endTick(); + + delete p; + } + } + else + xml.unknown("PartCanvas::get_paste_len"); + break; + + case Xml::TagEnd: + break; + + default: + end = true; + break; + } + if(end) + break; + } + + if (begin_tick > end_tick) + return 0; + else + return end_tick - begin_tick; +} + + +Undo PartCanvas::pasteAt(const QString& pt, Track* track, unsigned int pos, bool clone, bool toTrack, int* finalPosPtr, set<Track*>* affected_tracks) { Undo operations; @@ -2754,7 +2935,10 @@ Undo PartCanvas::pasteAt(const QString& pt, Track* track, unsigned int pos, bool if (p->tick()+p->lenTick()>finalPos) { finalPos=p->tick()+p->lenTick(); } + p->setSelected(true); operations.push_back(UndoOp(UndoOp::AddPart,p)); + if (affected_tracks) + affected_tracks->insert(p->track()); } else xml.unknown("PartCanvas::pasteAt"); @@ -2789,16 +2973,12 @@ Undo PartCanvas::pasteAt(const QString& pt, Track* track, unsigned int pos, bool // paste part to current selected track at cpos //--------------------------------------------------------- -void PartCanvas::paste(bool clone, bool toTrack, bool doInsert) +void PartCanvas::paste(bool clone, paste_mode_t paste_mode, bool to_single_track, int amount, int raster) { Track* track = 0; - - if (doInsert) // logic depends on keeping track of newly selected tracks - deselectAll(); - - + // If we want to paste to a selected track... - if(toTrack) + if (to_single_track) { TrackList* tl = song->tracks(); for (iTrack i = tl->begin(); i != tl->end(); ++i) { @@ -2831,7 +3011,7 @@ void PartCanvas::paste(bool clone, bool toTrack, bool doInsert) if(md->hasFormat(pfx + mdpl)) { // If we want to paste to a selected track... - if(toTrack && !track->isMidiTrack()) + if(to_single_track && !track->isMidiTrack()) { QMessageBox::critical(this, QString("MusE"), tr("Can only paste to midi/drum track")); @@ -2839,11 +3019,10 @@ void PartCanvas::paste(bool clone, bool toTrack, bool doInsert) } txt = cb->text(mdpl, QClipboard::Clipboard); } - else - if(md->hasFormat(pfx + wvpl)) + else if(md->hasFormat(pfx + wvpl)) { // If we want to paste to a selected track... - if(toTrack && track->type() != Track::WAVE) + if(to_single_track && track->type() != Track::WAVE) { QMessageBox::critical(this, QString("MusE"), tr("Can only paste to wave track")); @@ -2851,11 +3030,10 @@ void PartCanvas::paste(bool clone, bool toTrack, bool doInsert) } txt = cb->text(wvpl, QClipboard::Clipboard); } - else - if(md->hasFormat(pfx + mxpl)) + else if(md->hasFormat(pfx + mxpl)) { // If we want to paste to a selected track... - if(toTrack && !track->isMidiTrack() && track->type() != Track::WAVE) + if(to_single_track && !track->isMidiTrack() && track->type() != Track::WAVE) { QMessageBox::critical(this, QString("MusE"), tr("Can only paste to midi or wave track")); @@ -2874,54 +3052,41 @@ void PartCanvas::paste(bool clone, bool toTrack, bool doInsert) { int endPos=0; unsigned int startPos=song->vcpos(); - Undo operations=pasteAt(txt, track, startPos, clone, toTrack, &endPos); + set<Track*> affected_tracks; + + deselectAll(); + + Undo operations; + for (int i=0;i<amount;i++) + { + Undo temp = pasteAt(txt, track, startPos + i*raster, clone, to_single_track, &endPos, &affected_tracks); + operations.insert(operations.end(), temp.begin(), temp.end()); + } + Pos p(endPos, true); song->setPos(0, p); - if (doInsert) { - int offset = endPos-startPos; - Undo temp=movePartsTotheRight(startPos, offset); + + if (paste_mode != PASTEMODE_MIX) + { + int offset; + if (amount==1) offset = endPos-startPos; + else offset = amount*raster; + + Undo temp; + if (paste_mode==PASTEMODE_MOVESOME) + temp=movePartsTotheRight(startPos, offset, false, &affected_tracks); + else + temp=movePartsTotheRight(startPos, offset); + operations.insert(operations.end(), temp.begin(), temp.end()); } + song->applyOperationGroup(operations); } } //--------------------------------------------------------- -// movePartsToTheRight -//--------------------------------------------------------- -Undo PartCanvas::movePartsTotheRight(unsigned int startTicks, int length) -{ - Undo operations; - - // all parts that start after the pasted parts will be moved the entire length of the pasted parts - for (MusEWidget::iCItem i = items.begin(); i != items.end(); ++i) { - if (!i->second->isSelected()) { - Part* part = i->second->part(); - if (part->tick() >= startTicks) { - Part *newPart = part->clone(); - newPart->setTick(newPart->tick()+length); - - operations.push_back(UndoOp(UndoOp::ModifyPart,part,newPart,false,false)); - } - } - } - // perhaps ask if markers should be moved? - MarkerList *markerlist = song->marker(); - for(iMarker i = markerlist->begin(); i != markerlist->end(); ++i) - { - Marker* m = &i->second; - if (m->tick() >= startTicks) { - Marker *oldMarker = new Marker(); - *oldMarker = *m; - m->setTick(m->tick()+length); - operations.push_back(UndoOp(UndoOp::ModifyMarker,oldMarker, m)); - } - } - - return operations; -} -//--------------------------------------------------------- // startDrag //--------------------------------------------------------- @@ -3044,6 +3209,7 @@ void PartCanvas::viewDropEvent(QDropEvent* event) track = tracks->index(trackNo); if (track) { + deselectAll(); Undo temp=pasteAt(text, track, x); song->applyOperationGroup(temp); } @@ -3070,9 +3236,9 @@ void PartCanvas::viewDropEvent(QDropEvent* event) if (!track) { // we need to create a track for this drop if (text.endsWith(".mpt", Qt::CaseInsensitive)) { - track = song->addTrack((Track::MIDI)); + track = song->addTrack(Track::MIDI, false); // Add at end of list. } else { - track = song->addTrack((Track::WAVE)); + track = song->addTrack(Track::WAVE, false); // Add at end of list. } } if (track->type() == Track::WAVE && diff --git a/muse2/muse/arranger/pcanvas.h b/muse2/muse/arranger/pcanvas.h index 927a64e1..2bce9035 100644 --- a/muse2/muse/arranger/pcanvas.h +++ b/muse2/muse/arranger/pcanvas.h @@ -25,6 +25,7 @@ #define __PCANVAS_H__ #include <QVector> +#include <set> #include "song.h" #include "canvas.h" @@ -124,9 +125,10 @@ class PartCanvas : public MusEWidget::Canvas { void splitItem(MusEWidget::CItem* item, const QPoint&); void copy(PartList*); - void paste(bool clone = false, bool toTrack = true, bool doInsert=false); - Undo pasteAt(const QString&, Track*, unsigned int, bool clone = false, bool toTrack = true, int* finalPosPtr = NULL); - Undo movePartsTotheRight(unsigned int startTick, int length); + void copy_in_range(PartList*); + enum paste_mode_t { PASTEMODE_MIX, PASTEMODE_MOVEALL, PASTEMODE_MOVESOME }; + void paste(bool clone = false, paste_mode_t paste_mode = PASTEMODE_MIX, bool to_single_track=false, int amount=1, int raster=1536); + Undo pasteAt(const QString&, Track*, unsigned int, bool clone = false, bool toTrack = true, int* finalPosPtr = NULL, std::set<Track*>* affected_tracks = NULL); //Part* readClone(Xml&, Track*, bool toTrack = true); void drawWavePart(QPainter&, const QRect&, WavePart*, const QRect&); //void drawMidiPart(QPainter&, const QRect& rect, EventList* events, MidiTrack*mt, const QRect& r, int pTick, int from, int to); @@ -141,8 +143,6 @@ class PartCanvas : public MusEWidget::Canvas { double dbToVal(double inDb); double valToDb(double inV); - - protected: virtual void drawCanvas(QPainter&, const QRect&); virtual void endMoveItems(const QPoint&, DragType, int dir); @@ -165,8 +165,8 @@ class PartCanvas : public MusEWidget::Canvas { void returnPressed(); public: - 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 }; + enum { CMD_CUT_PART, CMD_COPY_PART, CMD_COPY_PART_IN_RANGE, CMD_PASTE_PART, CMD_PASTE_CLONE_PART, + CMD_PASTE_DIALOG, CMD_PASTE_CLONE_DIALOG, CMD_INSERT_EMPTYMEAS }; PartCanvas(int* raster, QWidget* parent, int, int); void partsChanged(); diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp index 87f5acde..28b12fdc 100644 --- a/muse2/muse/arranger/tlist.cpp +++ b/muse2/muse/arranger/tlist.cpp @@ -55,6 +55,7 @@ #include "audio.h" #include "instruments/minstrument.h" #include "app.h" +#include "helper.h" #include "gconfig.h" #include "event.h" #include "midiedit/drummap.h" @@ -66,10 +67,6 @@ #include "dssihost.h" #endif -namespace MusEApp { -extern QMenu* populateAddSynth(QWidget* parent); -} - static const int MIN_TRACKHEIGHT = 20; static const int WHEEL_DELTA = 120; QColor collist[] = { Qt::red, Qt::yellow, Qt::blue , Qt::black, Qt::white, Qt::green }; @@ -993,105 +990,44 @@ void TList::mousePressEvent(QMouseEvent* ev) Track* t = y2Track(y + ypos); + // FIXME Observed: Ancient bug: Track Info doesn't change if selecting multiple tracks in reverse order. + // Will need to be fixed if/when adding 'multiple track global editing'. + TrackColumn col = TrackColumn(header->logicalIndexAt(x)); if (t == 0) { if (button == Qt::RightButton) { QMenu* p = new QMenu; - //p->clear(); - QAction* midi = p->addAction(*addtrack_addmiditrackIcon, - tr("Add Midi Track")); - midi->setData(Track::MIDI); - QAction* drum = p->addAction(*addtrack_drumtrackIcon, - tr("Add Drum Track")); - drum->setData(Track::DRUM); - QAction* wave = p->addAction(*addtrack_wavetrackIcon, - tr("Add Wave Track")); - wave->setData(Track::WAVE); - QAction* aoutput = p->addAction(*addtrack_audiooutputIcon, - tr("Add Output")); - aoutput->setData(Track::AUDIO_OUTPUT); - QAction* agroup = p->addAction(*addtrack_audiogroupIcon, - tr("Add Group")); - agroup->setData(Track::AUDIO_GROUP); - QAction* ainput = p->addAction(*addtrack_audioinputIcon, - tr("Add Input")); - ainput->setData(Track::AUDIO_INPUT); - QAction* aaux = p->addAction(*addtrack_auxsendIcon, - tr("Add Aux Send")); - aaux->setData(Track::AUDIO_AUX); + MusEUtil::populateAddTrack(p); - // Create a sub-menu and fill it with found synth types. Make p the owner. - QMenu* synp = MusEApp::populateAddSynth(p); - synp->setIcon(*synthIcon); - synp->setTitle(QT_TRANSLATE_NOOP("@default", "Add Synth")); - - // Add the 'Add Synth' sub-menu to the menu. - p->addMenu(synp); - // Show the menu QAction* act = p->exec(ev->globalPos(), 0); // Valid click? if(act) { - int n = act->data().toInt(); - // Valid item? - if((n >= 0) && ((Track::TrackType)n != Track::AUDIO_SOFTSYNTH)) + t = song->addNewTrack(act); // Add at end of list. + if(t) { - // Synth sub-menu id? - if(n >= MENU_ADD_SYNTH_ID_BASE) - { - n -= MENU_ADD_SYNTH_ID_BASE; - //if(n < synthis.size()) - // t = song->createSynthI(synthis[n]->baseName()); - //if((n - MENU_ADD_SYNTH_ID_BASE) < (int)synthis.size()) - if(n < (int)synthis.size()) - { - //t = song->createSynthI(synp->text(n)); - //t = song->createSynthI(synthis[n]->name()); - t = song->createSynthI(synthis[n]->baseName(), synthis[n]->name()); - - if(t) - { - // Add instance last in midi device list. - for (int i = 0; i < MIDI_PORTS; ++i) - { - MidiPort* port = &midiPorts[i]; - MidiDevice* dev = port->device(); - if (dev==0) - { - midiSeq->msgSetMidiDevice(port, (SynthI*)t); - MusEGlobal::muse->changeConfig(true); // save configuration file - song->update(); - break; - } - } - } - } - } - // Normal track. - else - t = song->addTrack((Track::TrackType)n); - - if(t) - { - song->deselectTracks(); - t->setSelected(true); - - ///emit selectionChanged(); - emit selectionChanged(t); - adjustScrollbar(); - } - } + song->deselectTracks(); + t->setSelected(true); + + ///emit selectionChanged(); + emit selectionChanged(t); + adjustScrollbar(); + } } // Just delete p, and all its children will go too, right? //delete synp; delete p; - } + } else if (button == Qt::LeftButton) { - if (!ctrl) song->deselectTracks(); - } + if (!ctrl) + { + song->deselectTracks(); + emit selectionChanged(0); + } + } return; } @@ -1297,18 +1233,28 @@ void TList::mousePressEvent(QMouseEvent* ev) mode = NORMAL; QMenu* p = new QMenu; //p->clear(); - p->addAction(QIcon(*automation_clear_dataIcon), tr("Delete Track"))->setData(0); - p->addAction(QIcon(*track_commentIcon), tr("Track Comment"))->setData(1); + // Leave room for normal track IDs - base these at AUDIO_SOFTSYNTH. + p->addAction(QIcon(*automation_clear_dataIcon), tr("Delete Track"))->setData(Track::AUDIO_SOFTSYNTH + 1); + p->addAction(QIcon(*track_commentIcon), tr("Track Comment"))->setData(Track::AUDIO_SOFTSYNTH + 2); + p->addSeparator(); + QMenu* pnew = new QMenu(p); + pnew->setTitle(tr("Insert Track")); + pnew->setIcon(QIcon(*edit_track_addIcon)); + MusEUtil::populateAddTrack(pnew); + p->addMenu(pnew); QAction* act = p->exec(ev->globalPos(), 0); if (act) { int n = act->data().toInt(); - switch (n) { - case 0: // delete track + if(n >= Track::AUDIO_SOFTSYNTH && n < MENU_ADD_SYNTH_ID_BASE) + { + n -= Track::AUDIO_SOFTSYNTH; + switch (n) { + case 1: // delete track song->removeTrack0(t); audio->msgUpdateSoloStates(); break; - case 1: // show track comment + case 2: // show track comment { MusEWidget::TrackComment* tc = new MusEWidget::TrackComment(t, 0); tc->show(); @@ -1320,8 +1266,19 @@ void TList::mousePressEvent(QMouseEvent* ev) printf("action %d\n", n); break; } - } + else + { + t = song->addNewTrack(act, t); // Let addNewTrack handle it. Insert before clicked-on track 't'. + if(t) + { + song->deselectTracks(); + t->setSelected(true); + emit selectionChanged(t); + adjustScrollbar(); + } + } + } delete p; } break; @@ -1405,24 +1362,24 @@ void TList::mousePressEvent(QMouseEvent* ev) // selectTrack //--------------------------------------------------------- void TList::selectTrack(Track* tr) - { - song->deselectTracks(); - tr->setSelected(true); - +{ + song->deselectTracks(); - // rec enable track if expected - TrackList recd = getRecEnabledTracks(); - if (recd.size() == 1 && MusEConfig::config.moveArmedCheckBox) { // one rec enabled track, move rec enabled with selection - song->setRecordFlag((Track*)recd.front(),false); - song->setRecordFlag(tr,true); - } + if (tr) { + tr->setSelected(true); - // By T356. Force a redraw for wave tracks, since it does not seem to happen. - //if(!tr->isMidiTrack()) - redraw(); - ///emit selectionChanged(); - emit selectionChanged(tr); - } + + // rec enable track if expected + TrackList recd = getRecEnabledTracks(); + if (recd.size() == 1 && MusEConfig::config.moveArmedCheckBox) { // one rec enabled track, move rec enabled with selection + song->setRecordFlag((Track*)recd.front(),false); + song->setRecordFlag(tr,true); + } + } + + redraw(); + emit selectionChanged(tr); +} //--------------------------------------------------------- // selectTrackAbove diff --git a/muse2/muse/cliplist/cliplist.cpp b/muse2/muse/cliplist/cliplist.cpp index 4e957db2..95f58f80 100644 --- a/muse2/muse/cliplist/cliplist.cpp +++ b/muse2/muse/cliplist/cliplist.cpp @@ -22,6 +22,9 @@ //========================================================= #include <QCloseEvent> +#include <QMenuBar> +#include <QMenu> +#include <QToolBar> #include "cliplist.h" #include "song.h" @@ -118,7 +121,7 @@ QString ClipItem::text(int col) const //--------------------------------------------------------- ClipListEdit::ClipListEdit(QWidget* parent) - : TopWin(parent, "cliplist", Qt::Window) + : TopWin(TopWin::CLIPLIST, parent, "cliplist", Qt::Window) { //setAttribute(Qt::WA_DeleteOnClose); setWindowTitle(tr("MusE: Clip List Editor")); @@ -128,6 +131,25 @@ ClipListEdit::ClipListEdit(QWidget* parent) //editor->view->setColumnAlignment(COL_REFS, Qt::AlignRight); + // Toolbars --------------------------------------------------------- + QToolBar* undo_tools=addToolBar(tr("Undo/Redo tools")); + undo_tools->setObjectName("Undo/Redo tools"); + undo_tools->addActions(MusEGlobal::undoRedo->actions()); + + + QToolBar* panic_toolbar = addToolBar(tr("panic")); + panic_toolbar->setObjectName("panic"); + panic_toolbar->addAction(MusEGlobal::panicAction); + + QToolBar* transport_toolbar = addToolBar(tr("transport")); + transport_toolbar->setObjectName("transport"); + transport_toolbar->addActions(MusEGlobal::transportAction->actions()); + + QMenu* settingsMenu = menuBar()->addMenu(tr("Window &Config")); + settingsMenu->addAction(subwinAction); + settingsMenu->addAction(shareAction); + settingsMenu->addAction(fullscreenAction); + QFontMetrics fm(editor->view->font()); int fw = style()->pixelMetric(QStyle::PM_DefaultFrameWidth,0, this); // ddskrjo 0 int w = 2 + fm.width('9') * 9 + fm.width(':') * 3 + fw * 4; @@ -170,7 +192,7 @@ void ClipListEdit::updateList() void ClipListEdit::closeEvent(QCloseEvent* e) { - emit deleted((unsigned long)this); + emit deleted(static_cast<TopWin*>(this)); e->accept(); } @@ -226,6 +248,45 @@ void ClipListEdit::writeStatus(int level, Xml& xml) const } //--------------------------------------------------------- +// readConfiguration +//--------------------------------------------------------- + +void ClipListEdit::readConfiguration(Xml& xml) + { + for (;;) { + Xml::Token token = xml.parse(); + const QString& tag = xml.s1(); + switch (token) { + case Xml::Error: + case Xml::End: + return; + case Xml::TagStart: + if (tag == "topwin") + TopWin::readConfiguration(CLIPLIST, xml); + else + xml.unknown("ClipListEdit"); + break; + case Xml::TagEnd: + if (tag == "cliplistedit") + return; + default: + break; + } + } + } + +//--------------------------------------------------------- +// writeConfiguration +//--------------------------------------------------------- + +void ClipListEdit::writeConfiguration(int level, Xml& xml) + { + xml.tag(level++, "cliplistedit"); + TopWin::writeConfiguration(CLIPLIST, level, xml); + xml.tag(level, "/cliplistedit"); + } + +//--------------------------------------------------------- // startChanged //--------------------------------------------------------- diff --git a/muse2/muse/cliplist/cliplist.h b/muse2/muse/cliplist/cliplist.h index 39ff9f5a..e4c8503b 100644 --- a/muse2/muse/cliplist/cliplist.h +++ b/muse2/muse/cliplist/cliplist.h @@ -69,13 +69,15 @@ class ClipListEdit : public TopWin { void clicked(QTreeWidgetItem*, int); signals: - void deleted(unsigned long); + void deleted(TopWin*); public: ClipListEdit(QWidget* parent); ~ClipListEdit(); virtual void readStatus(Xml&); virtual void writeStatus(int, Xml&) const; + static void readConfiguration(Xml&); + static void writeConfiguration(int, Xml&); }; #endif diff --git a/muse2/muse/cobject.cpp b/muse2/muse/cobject.cpp index 2ce39075..8940bb3b 100644 --- a/muse2/muse/cobject.cpp +++ b/muse2/muse/cobject.cpp @@ -1,9 +1,24 @@ //========================================================= -// MusE -// Linux Music Editor -// $Id: cobject.cpp,v 1.4 2004/02/02 12:10:09 wschweer Exp $ +// MusE +// Linux Music Editor +// $Id: cobject.cpp,v 1.4 2004/02/02 12:10:09 wschweer Exp $ +// +// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; version 2 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // -// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de) // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -24,67 +39,495 @@ #include "cobject.h" #include "xml.h" #include "gui.h" +#include "globals.h" +#include "app.h" +#include "shortcuts.h" + +#include <QMdiSubWindow> +#include <QToolBar> +#include <QMenuBar> +#include <QAction> + +using std::list; +using MusEGlobal::muse; + +int TopWin::_widthInit[TOPLEVELTYPE_LAST_ENTRY]; +int TopWin::_heightInit[TOPLEVELTYPE_LAST_ENTRY]; +QByteArray TopWin::_toolbarSharedInit[TOPLEVELTYPE_LAST_ENTRY]; +QByteArray TopWin::_toolbarNonsharedInit[TOPLEVELTYPE_LAST_ENTRY]; +bool TopWin::_sharesWhenFree[TOPLEVELTYPE_LAST_ENTRY]; +bool TopWin::_sharesWhenSubwin[TOPLEVELTYPE_LAST_ENTRY]; +bool TopWin::_defaultSubwin[TOPLEVELTYPE_LAST_ENTRY]; +bool TopWin::initInited=false; + +TopWin::TopWin(ToplevelType t, QWidget* parent, const char* name, Qt::WindowFlags f) + : QMainWindow(parent, f) +{ + if (initInited==false) + initConfiguration(); + + _type=t; + + setObjectName(QString(name)); + // Allow multiple rows. Tim. + //setDockNestingEnabled(true); + setIconSize(ICON_SIZE); + + subwinAction=new QAction(tr("As subwindow"), this); + subwinAction->setCheckable(true); + connect(subwinAction, SIGNAL(toggled(bool)), SLOT(setIsMdiWin(bool))); + + shareAction=new QAction(tr("Shares tools and menu"), this); + shareAction->setCheckable(true); + connect(shareAction, SIGNAL(toggled(bool)), SLOT(shareToolsAndMenu(bool))); + + fullscreenAction=new QAction(tr("Fullscreen"), this); + fullscreenAction->setCheckable(true); + fullscreenAction->setChecked(false); + fullscreenAction->setShortcut(shortcuts[SHRT_FULLSCREEN].key); + connect(fullscreenAction, SIGNAL(toggled(bool)), SLOT(setFullscreen(bool))); + + mdisubwin=NULL; + _sharesToolsAndMenu=_defaultSubwin[_type] ? _sharesWhenSubwin[_type] : _sharesWhenFree[_type]; + if (_defaultSubwin[_type]) + setIsMdiWin(true); + + if (_sharesToolsAndMenu) + menuBar()->hide(); + + subwinAction->setChecked(isMdiWin()); + shareAction->setChecked(_sharesToolsAndMenu); + fullscreenAction->setEnabled(!isMdiWin()); + + resize(_widthInit[_type], _heightInit[_type]); +} + //--------------------------------------------------------- -// readStatus +// readStatus //--------------------------------------------------------- void TopWin::readStatus(Xml& xml) - { - for (;;) { - Xml::Token token = xml.parse(); - if (token == Xml::Error || token == Xml::End) - break; - QString tag = xml.s1(); - switch (token) { - case Xml::TagStart: - if (tag == "geometry") { - QRect r(readGeometry(xml, tag)); - resize(r.size()); - move(r.topLeft()); - } - else if (tag == "toolbars") { - if (!restoreState(QByteArray::fromHex(xml.parse1().toAscii()))) - fprintf(stderr,"ERROR: couldn't restore toolbars. however, this is not really a problem.\n"); - } - else - xml.unknown("TopWin"); - break; - case Xml::TagEnd: - if (tag == "topwin") - return; - default: - break; - } - } - } +{ + for (;;) + { + Xml::Token token = xml.parse(); + if (token == Xml::Error || token == Xml::End) + break; + + QString tag = xml.s1(); + switch (token) + { + case Xml::TagStart: + if (tag == "geometry_state") + { + if (!restoreGeometry(QByteArray::fromHex(xml.parse1().toAscii()))) + fprintf(stderr,"ERROR: couldn't restore geometry. however, this is probably not really a problem.\n"); + } + else if (tag == "toolbars") + { + if (!sharesToolsAndMenu()) + { + if (!restoreState(QByteArray::fromHex(xml.parse1().toAscii()))) + fprintf(stderr,"ERROR: couldn't restore toolbars. however, this is not really a problem.\n"); + } + else + { + _savedToolbarState=QByteArray::fromHex(xml.parse1().toAscii()); + if (_savedToolbarState.isEmpty()) + _savedToolbarState=_toolbarNonsharedInit[_type]; + } + } + else if (tag == "shares_menu") + { + shareToolsAndMenu(xml.parseInt()); + } + else if (tag == "is_subwin") + { + setIsMdiWin(xml.parseInt()); + } + else + xml.unknown("TopWin"); + break; + + case Xml::TagEnd: + if (tag == "topwin") + return; + + default: + break; + } + } +} //--------------------------------------------------------- -// writeStatus +// writeStatus //--------------------------------------------------------- void TopWin::writeStatus(int level, Xml& xml) const - { - xml.tag(level++, "topwin"); - xml.tag(level++, "geometry x=\"%d\" y=\"%d\" w=\"%d\" h=\"%d\"", - geometry().x(), - geometry().y(), - geometry().width(), - geometry().height()); - xml.tag(level--, "/geometry"); - - xml.strTag(level, "toolbars", saveState().toHex().data()); - - xml.tag(level, "/topwin"); - } - -TopWin::TopWin(QWidget* parent, const char* name, - Qt::WindowFlags f) : QMainWindow(parent, f) - { - setObjectName(QString(name)); - //setAttribute(Qt::WA_DeleteOnClose); - // Allow multiple rows. Tim. - //setDockNestingEnabled(true); - setIconSize(ICON_SIZE); - } +{ + xml.tag(level++, "topwin"); + + // the order of these tags has a certain sense + // changing it won't break muse, but it may break proper + // restoring of the positions + xml.intTag(level, "is_subwin", isMdiWin()); + xml.strTag(level, "geometry_state", saveGeometry().toHex().data()); + xml.intTag(level, "shares_menu", sharesToolsAndMenu()); + + if (!sharesToolsAndMenu()) + xml.strTag(level, "toolbars", saveState().toHex().data()); + else + xml.strTag(level, "toolbars", _savedToolbarState.toHex().data()); + + xml.tag(level, "/topwin"); +} + +void TopWin::hide() +{ + if (mdisubwin) + mdisubwin->close(); + + QMainWindow::hide(); +} + +void TopWin::show() +{ + if (mdisubwin) + mdisubwin->show(); + + QMainWindow::show(); +} + +void TopWin::setVisible(bool param) +{ + if (mdisubwin) + { + if (param) + mdisubwin->show(); + else + mdisubwin->close(); + } + QMainWindow::setVisible(param); +} + +QMdiSubWindow* TopWin::createMdiWrapper() +{ + if (mdisubwin==NULL) + { + mdisubwin = new QMdiSubWindow(); + mdisubwin->setWidget(this); + } + + return mdisubwin; +} + +void TopWin::setIsMdiWin(bool val) +{ + if (val) + { + if (!isMdiWin()) + { + _savedToolbarState = saveState(); + int width_temp=width(); + int height_temp=height(); + bool vis=isVisible(); + + QMdiSubWindow* subwin = createMdiWrapper(); + muse->addMdiSubWindow(subwin); + subwin->resize(width_temp, height_temp); + subwin->move(0,0); + subwin->setVisible(vis); + this->QMainWindow::show(); //bypass the delegation to the subwin + + if (_sharesToolsAndMenu == _sharesWhenFree[_type]) + shareToolsAndMenu(_sharesWhenSubwin[_type]); + + fullscreenAction->setEnabled(false); + fullscreenAction->setChecked(false); + subwinAction->setChecked(true); + muse->updateWindowMenu(); + } + else + { + if (MusEGlobal::debugMsg) printf("TopWin::setIsMdiWin(true) called, but window is already a MDI win\n"); + } + } + else + { + if (isMdiWin()) + { + int width_temp=width(); + int height_temp=height(); + bool vis=isVisible(); + + QMdiSubWindow* mdisubwin_temp=mdisubwin; + mdisubwin=NULL; + setParent(NULL); + mdisubwin_temp->hide(); + delete mdisubwin_temp; + + resize(width_temp, height_temp); + setVisible(vis); + + if (_sharesToolsAndMenu == _sharesWhenSubwin[_type]) + shareToolsAndMenu(_sharesWhenFree[_type]); + + fullscreenAction->setEnabled(true); + subwinAction->setChecked(false); + muse->updateWindowMenu(); + } + else + { + if (MusEGlobal::debugMsg) printf("TopWin::setIsMdiWin(false) called, but window is not a MDI win\n"); + } + } +} + +bool TopWin::isMdiWin() const +{ + return (mdisubwin!=NULL); +} + +void TopWin::insertToolBar(QToolBar*, QToolBar*) { printf("ERROR: THIS SHOULD NEVER HAPPEN: TopWin::insertToolBar called, but it's not implemented! ignoring it\n"); } +void TopWin::insertToolBarBreak(QToolBar*) { printf("ERROR: THIS SHOULD NEVER HAPPEN: TopWin::insertToolBarBreak called, but it's not implemented! ignoring it\n"); } +void TopWin::removeToolBar(QToolBar*) { printf("ERROR: THIS SHOULD NEVER HAPPEN: TopWin::removeToolBar called, but it's not implemented! ignoring it\n"); } +void TopWin::removeToolBarBreak(QToolBar*) { printf("ERROR: THIS SHOULD NEVER HAPPEN: TopWin::removeToolBarBreak called, but it's not implemented! ignoring it\n"); } +void TopWin::addToolBar(Qt::ToolBarArea, QToolBar* tb) { printf("ERROR: THIS SHOULD NEVER HAPPEN: TopWin::addToolBar(Qt::ToolBarArea, QToolBar*) called, but it's not implemented!\nusing addToolBar(QToolBar*) instead\n"); addToolBar(tb);} + +void TopWin::addToolBar(QToolBar* toolbar) +{ + _toolbars.push_back(toolbar); + + if (!_sharesToolsAndMenu) + QMainWindow::addToolBar(toolbar); + else + toolbar->hide(); + + toolbar->setIconSize(ICON_SIZE); +} + +QToolBar* TopWin::addToolBar(const QString& title) +{ + QToolBar* toolbar = new QToolBar(title, this); + addToolBar(toolbar); + return toolbar; +} + + +void TopWin::shareToolsAndMenu(bool val) +{ + if (_sharesToolsAndMenu == val) + { + if (MusEGlobal::debugMsg) printf("TopWin::shareToolsAndMenu() called but has no effect\n"); + return; + } + + + _sharesToolsAndMenu = val; + + if (!val) + { + muse->shareMenuAndToolbarChanged(this, false); + + for (list<QToolBar*>::iterator it=_toolbars.begin(); it!=_toolbars.end(); it++) + if (*it != NULL) + { + QMainWindow::addToolBar(*it); + (*it)->show(); + } + else + QMainWindow::addToolBarBreak(); + + restoreState(_savedToolbarState); + _savedToolbarState.clear(); + + menuBar()->show(); + } + else + { + if (_savedToolbarState.isEmpty()) // this check avoids overwriting a previously saved state + _savedToolbarState = saveState(); // (by setIsMdiWin) with a now incorrect (empty) state + + for (list<QToolBar*>::iterator it=_toolbars.begin(); it!=_toolbars.end(); it++) + if (*it != NULL) + { + QMainWindow::removeToolBar(*it); // this does NOT delete the toolbar, which is good + (*it)->setParent(NULL); + } + + menuBar()->hide(); + + muse->shareMenuAndToolbarChanged(this, true); + } + + shareAction->setChecked(val); +} + + + +//--------------------------------------------------------- +// storeInitialState +//--------------------------------------------------------- + +void TopWin::storeInitialState() const +{ + _widthInit[_type] = width(); + _heightInit[_type] = height(); + if (sharesToolsAndMenu()) + { + if (muse->getCurrentMenuSharingTopwin() == this) + _toolbarSharedInit[_type] = muse->saveState(); + } + else + _toolbarNonsharedInit[_type] = saveState(); +} + + + +//initConfiguration() restores default "traditional muse" configuration +void TopWin::initConfiguration() +{ + if (initInited==false) + { + for (int i=0;i<TOPLEVELTYPE_LAST_ENTRY;i++) + { + _widthInit[i]=800; + _heightInit[i]=600; + _sharesWhenFree[i]=false; + _sharesWhenSubwin[i]=true; + _defaultSubwin[i]=false; + } + + _defaultSubwin[ARRANGER]=true; + + initInited=true; + } +} + +//--------------------------------------------------------- +// readConfiguration +//--------------------------------------------------------- + +void TopWin::readConfiguration(ToplevelType t, Xml& xml) +{ +if (initInited==false) + initConfiguration(); + + 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 == "width") + _widthInit[t] = xml.parseInt(); + else if (tag == "height") + _heightInit[t] = xml.parseInt(); + else if (tag == "nonshared_toolbars") + _toolbarNonsharedInit[t] = QByteArray::fromHex(xml.parse1().toAscii()); + else if (tag == "shared_toolbars") + _toolbarSharedInit[t] = QByteArray::fromHex(xml.parse1().toAscii()); + else if (tag == "shares_when_free") + _sharesWhenFree[t] = xml.parseInt(); + else if (tag == "shares_when_subwin") + _sharesWhenSubwin[t] = xml.parseInt(); + else if (tag == "default_subwin") + _defaultSubwin[t] = xml.parseInt(); + else + xml.unknown("TopWin"); + break; + + case Xml::TagEnd: + if (tag == "topwin") + return; + + default: + break; + } + } +} + + +//--------------------------------------------------------- +// writeConfiguration +//--------------------------------------------------------- + +void TopWin::writeConfiguration(ToplevelType t, int level, Xml& xml) +{ + if (!initInited) + { + printf ("WARNING: TopWin::writeConfiguration() called although the config hasn't been\n" + " initalized! writing default configuration\n"); + initConfiguration(); + } + xml.tag(level++, "topwin"); + xml.intTag(level, "width", _widthInit[t]); + xml.intTag(level, "height", _heightInit[t]); + xml.strTag(level, "nonshared_toolbars", _toolbarNonsharedInit[t].toHex().data()); + xml.strTag(level, "shared_toolbars", _toolbarSharedInit[t].toHex().data()); + xml.intTag(level, "shares_when_free", _sharesWhenFree[t]); + xml.intTag(level, "shares_when_subwin", _sharesWhenSubwin[t]); + xml.intTag(level, "default_subwin", _defaultSubwin[t]); + xml.etag(level, "topwin"); +} + +void TopWin::initTopwinState() +{ + if (sharesToolsAndMenu()) + { + if (this == muse->getCurrentMenuSharingTopwin()) + muse->restoreState(_toolbarSharedInit[_type]); + } + else + restoreState(_toolbarNonsharedInit[_type]); +} + +void TopWin::restoreMainwinState() +{ + if (sharesToolsAndMenu()) + initTopwinState(); +} + +QString TopWin::typeName(ToplevelType t) +{ + switch (t) + { + case PIANO_ROLL: return tr("Piano roll"); + case LISTE: return tr("List editor"); + case DRUM: return tr("Drum editor"); + case MASTER: return tr("Master track editor"); + case LMASTER: return tr("Master track list editor"); + case WAVE: return tr("Wave editor"); + case CLIPLIST: return tr("Clip list"); + case MARKER: return tr("Marker view"); + case SCORE: return tr("Score editor"); + case ARRANGER: return tr("Arranger"); + default: return tr("<unknown toplevel type>"); + } +} + +void TopWin::setFullscreen(bool val) +{ + if (val) + showFullScreen(); + else + showNormal(); +} + +void TopWin::resize(int w, int h) +{ + QMainWindow::resize(w,h); + + if (isMdiWin()) + mdisubwin->resize(w,h); +} +void TopWin::resize(const QSize& s) +{ + resize(s.width(), s.height()); +} diff --git a/muse2/muse/cobject.h b/muse2/muse/cobject.h index 4b7b6e3c..1ee2b581 100644 --- a/muse2/muse/cobject.h +++ b/muse2/muse/cobject.h @@ -28,8 +28,14 @@ #include <QMainWindow> #include <list> +#include <QByteArray> +#include <QString> +class QMdiSubWindow; +class QFocusEvent; +class QToolBar; class Xml; +class QAction; //--------------------------------------------------------- // TopWin @@ -40,40 +46,91 @@ class TopWin : public QMainWindow Q_OBJECT public: - virtual void readStatus(Xml&); - virtual void writeStatus(int, Xml&) const; - TopWin(QWidget* parent=0, const char* name=0, - Qt::WindowFlags f = Qt::Window); - }; - -//--------------------------------------------------------- -// Toplevel -//--------------------------------------------------------- - -class Toplevel { - public: - enum ToplevelType { PIANO_ROLL, LISTE, DRUM, MASTER, WAVE, - LMASTER, CLIPLIST, MARKER, SCORE + enum ToplevelType { PIANO_ROLL=0, LISTE, DRUM, MASTER, WAVE, //there shall be no + LMASTER, CLIPLIST, MARKER, SCORE, ARRANGER, //gaps in the enum! #ifdef PATCHBAY - , M_PATCHBAY + M_PATCHBAY, #endif /* PATCHBAY */ + TOPLEVELTYPE_LAST_ENTRY //this has to be always the last entry }; - Toplevel(ToplevelType t, unsigned long obj, TopWin* cobj) { - _type = t; - _object = obj; - _cobject = cobj; - } + ToplevelType type() const { return _type; } - unsigned long object() const { return _object; } - TopWin* cobject() const { return _cobject; } + static QString typeName(ToplevelType t); + + + virtual void readStatus(Xml&); + virtual void writeStatus(int, Xml&) const; + + static void readConfiguration(ToplevelType, Xml&); + static void writeConfiguration(ToplevelType, int, Xml&); + + + bool isMdiWin() const; + QMdiSubWindow* getMdiWin() const { return mdisubwin; } + + TopWin(ToplevelType t, QWidget* parent=0, const char* name=0, Qt::WindowFlags f = Qt::Window); + + bool sharesToolsAndMenu() const { return _sharesToolsAndMenu; } + const std::list<QToolBar*>& toolbars() { return _toolbars; } + + void addToolBar(QToolBar* toolbar); + QToolBar* addToolBar(const QString& title); + + void resize(int w, int h); + void resize(const QSize&); + + static bool _sharesWhenFree[TOPLEVELTYPE_LAST_ENTRY]; + static bool _sharesWhenSubwin[TOPLEVELTYPE_LAST_ENTRY]; + static bool _defaultSubwin[TOPLEVELTYPE_LAST_ENTRY]; + + private: + QMdiSubWindow* mdisubwin; + bool _sharesToolsAndMenu; + std::list<QToolBar*> _toolbars; + + void insertToolBar(QToolBar*, QToolBar*); + void insertToolBarBreak(QToolBar*); + void removeToolBar(QToolBar*); + void removeToolBarBreak(QToolBar*); + void addToolBar(Qt::ToolBarArea, QToolBar*); + + virtual QMdiSubWindow* createMdiWrapper(); + + static void initConfiguration(); + + protected: + QAction* subwinAction; + QAction* shareAction; + QAction* fullscreenAction; - private: ToplevelType _type; - unsigned long _object; - TopWin* _cobject; + + static int _widthInit[TOPLEVELTYPE_LAST_ENTRY]; + static int _heightInit[TOPLEVELTYPE_LAST_ENTRY]; + static QByteArray _toolbarNonsharedInit[TOPLEVELTYPE_LAST_ENTRY]; + static QByteArray _toolbarSharedInit[TOPLEVELTYPE_LAST_ENTRY]; + static bool initInited; + + QByteArray _savedToolbarState; + + void initTopwinState(); + + private slots: + void setFullscreen(bool); + + public slots: + virtual void hide(); + virtual void show(); + virtual void setVisible(bool); + void setIsMdiWin(bool); + void shareToolsAndMenu(bool); + void restoreMainwinState(); + void storeInitialState() const; + }; -typedef std::list <Toplevel> ToplevelList; + +typedef std::list <TopWin*> ToplevelList; typedef ToplevelList::iterator iToplevel; typedef ToplevelList::const_iterator ciToplevel; diff --git a/muse2/muse/conf.cpp b/muse2/muse/conf.cpp index 35829657..6ba4d47d 100644 --- a/muse2/muse/conf.cpp +++ b/muse2/muse/conf.cpp @@ -34,6 +34,11 @@ #include "pianoroll.h" #include "scoreedit.h" #include "master/masteredit.h" +#include "listedit.h" +#include "cliplist/cliplist.h" +#include "arrangerview.h" +#include "marker/markerview.h" +#include "master/lmaster.h" ///#include "transport.h" #include "bigtime.h" #include "arranger.h" @@ -893,12 +898,6 @@ void readConfiguration(Xml& xml, bool readOnlySequencer) } //else if (tag == "midiSyncInfo") // readConfigMidiSyncInfo(xml); - else if (tag == "arranger") { - if (MusEGlobal::muse && MusEGlobal::muse->arranger) - MusEGlobal::muse->arranger->readStatus(xml); - else - xml.skip(tag); - } else if (tag == "drumedit") DrumEdit::readConfiguration(xml); else if (tag == "pianoroll") @@ -909,6 +908,22 @@ void readConfiguration(Xml& xml, bool readOnlySequencer) MasterEdit::readConfiguration(xml); else if (tag == "waveedit") WaveEdit::readConfiguration(xml); + else if (tag == "listedit") + ListEdit::readConfiguration(xml); + else if (tag == "cliplistedit") + ClipListEdit::readConfiguration(xml); + else if (tag == "lmaster") + LMaster::readConfiguration(xml); + else if (tag == "marker") + MarkerView::readConfiguration(xml); + else if (tag == "arrangerview") + ArrangerView::readConfiguration(xml); + else if (tag == "arranger") { + if (MusEGlobal::muse && MusEGlobal::muse->arranger()) + MusEGlobal::muse->arranger()->readStatus(xml); + else + xml.skip(tag); + } else if (tag == "dialogs") read_function_dialog_config(xml); else if (tag == "shortcuts") @@ -1354,6 +1369,11 @@ void MusE::writeGlobalConfiguration(int level, Xml& xml) const ScoreEdit::write_configuration(level, xml); MasterEdit::writeConfiguration(level, xml); WaveEdit::writeConfiguration(level, xml); + ListEdit::writeConfiguration(level, xml); + ClipListEdit::writeConfiguration(level, xml); + LMaster::writeConfiguration(level, xml); + MarkerView::writeConfiguration(level, xml); + ArrangerView::writeConfiguration(level, xml); write_function_dialog_config(level, xml); @@ -1463,7 +1483,7 @@ void MusE::writeConfiguration(int level, Xml& xml) const //mixer2->write(level, xml, "mixer2"); mixer2->write(level, xml); - arranger->writeStatus(level, xml); + _arranger->writeStatus(level, xml); writeSeqConfiguration(level, xml, true); DrumEdit::writeConfiguration(level, xml); diff --git a/muse2/muse/confmport.cpp b/muse2/muse/confmport.cpp index ce59b673..6e371d0e 100644 --- a/muse2/muse/confmport.cpp +++ b/muse2/muse/confmport.cpp @@ -1341,8 +1341,7 @@ void MPConfig::addInstanceClicked() QTreeWidgetItem* item = synthList->currentItem(); if (item == 0) return; - //SynthI *si = song->createSynthI(item->text(2)); - SynthI *si = song->createSynthI(item->text(0), item->text(2)); + SynthI *si = song->createSynthI(item->text(0), item->text(2), false); // Add at end of list. if(!si) return; diff --git a/muse2/muse/dialogs.cpp b/muse2/muse/dialogs.cpp new file mode 100644 index 00000000..b63d86d3 --- /dev/null +++ b/muse2/muse/dialogs.cpp @@ -0,0 +1,147 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: functions.cpp,v 1.20.2.19 2011/05/05 20:10 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; version 2 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//========================================================= + +#include "dialogs.h" +#include "widgets/function_dialogs/velocity.h" +#include "widgets/function_dialogs/quantize.h" +#include "widgets/function_dialogs/crescendo.h" +#include "widgets/function_dialogs/gatetime.h" +#include "widgets/function_dialogs/remove.h" +#include "widgets/function_dialogs/transpose.h" +#include "widgets/function_dialogs/setlen.h" +#include "widgets/function_dialogs/move.h" +#include "widgets/function_dialogs/deloverlaps.h" +#include "widgets/function_dialogs/legato.h" +#include "widgets/pastedialog.h" +#include "widgets/pasteeventsdialog.h" + +#include "xml.h" + +#include <iostream> + +using namespace std; + +MusEDialog::GateTime* gatetime_dialog=NULL; +MusEDialog::Velocity* velocity_dialog=NULL; +MusEDialog::Quantize* quantize_dialog=NULL; +MusEDialog::Remove* erase_dialog=NULL; +MusEDialog::DelOverlaps* del_overlaps_dialog=NULL; +MusEDialog::Setlen* set_notelen_dialog=NULL; +MusEDialog::Move* move_notes_dialog=NULL; +MusEDialog::Transpose* transpose_dialog=NULL; +MusEDialog::Crescendo* crescendo_dialog=NULL; +MusEDialog::Legato* legato_dialog=NULL; +MusEDialog::PasteDialog* paste_dialog=NULL; +MusEDialog::PasteEventsDialog* paste_events_dialog=NULL; + +void init_function_dialogs(QWidget* parent) +{ + gatetime_dialog = new MusEDialog::GateTime(parent); + velocity_dialog = new MusEDialog::Velocity(parent); + quantize_dialog = new MusEDialog::Quantize(parent); + erase_dialog = new MusEDialog::Remove(parent); + del_overlaps_dialog = new MusEDialog::DelOverlaps(parent); + set_notelen_dialog = new MusEDialog::Setlen(parent); + move_notes_dialog = new MusEDialog::Move(parent); + transpose_dialog = new MusEDialog::Transpose(parent); + crescendo_dialog = new MusEDialog::Crescendo(parent); + legato_dialog = new MusEDialog::Legato(parent); + paste_dialog = new MusEDialog::PasteDialog(parent); + paste_events_dialog = new MusEDialog::PasteEventsDialog(parent); +} + +void read_function_dialog_config(Xml& xml) +{ + if (erase_dialog==NULL) + { + cout << "ERROR: THIS SHOULD NEVER HAPPEN: read_function_dialog_config() called, but\n" + " dialogs are still uninitalized (NULL)!"<<endl; + return; + } + + 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 == "mod_len") + gatetime_dialog->read_configuration(xml); + else if (tag == "mod_velo") + velocity_dialog->read_configuration(xml); + else if (tag == "quantize") + quantize_dialog->read_configuration(xml); + else if (tag == "erase") + erase_dialog->read_configuration(xml); + else if (tag == "del_overlaps") + del_overlaps_dialog->read_configuration(xml); + else if (tag == "setlen") + set_notelen_dialog->read_configuration(xml); + else if (tag == "move") + move_notes_dialog->read_configuration(xml); + else if (tag == "transpose") + transpose_dialog->read_configuration(xml); + else if (tag == "crescendo") + crescendo_dialog->read_configuration(xml); + else if (tag == "legato") + legato_dialog->read_configuration(xml); + else if (tag == "pastedialog") + paste_dialog->read_configuration(xml); + else if (tag == "pasteeventsdialog") + paste_events_dialog->read_configuration(xml); + else + xml.unknown("dialogs"); + break; + + case Xml::TagEnd: + if (tag == "dialogs") + return; + + default: + break; + } + } +} + +void write_function_dialog_config(int level, Xml& xml) +{ + xml.tag(level++, "dialogs"); + + gatetime_dialog->write_configuration(level, xml); + velocity_dialog->write_configuration(level, xml); + quantize_dialog->write_configuration(level, xml); + erase_dialog->write_configuration(level, xml); + del_overlaps_dialog->write_configuration(level, xml); + set_notelen_dialog->write_configuration(level, xml); + move_notes_dialog->write_configuration(level, xml); + transpose_dialog->write_configuration(level, xml); + crescendo_dialog->write_configuration(level, xml); + legato_dialog->write_configuration(level, xml); + paste_dialog->write_configuration(level, xml); + paste_events_dialog->write_configuration(level, xml); + + xml.tag(level, "/dialogs"); +} diff --git a/muse2/muse/dialogs.h b/muse2/muse/dialogs.h new file mode 100644 index 00000000..0cb5107a --- /dev/null +++ b/muse2/muse/dialogs.h @@ -0,0 +1,62 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: dialogs.h,v 1.20.2.19 2011/05/05 20:10 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; version 2 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//========================================================= + +#ifndef __DIALOGS_H__ +#define __DIALOGS_H__ + +class QWidget; +namespace MusEDialog +{ + class GateTime; + class Velocity; + class Quantize; + class Remove; + class DelOverlaps; + class Setlen; + class Move; + class Transpose; + class Crescendo; + class Legato; + class PasteDialog; + class PasteEventsDialog; +} + +class Xml; + +extern MusEDialog::GateTime* gatetime_dialog; +extern MusEDialog::Velocity* velocity_dialog; +extern MusEDialog::Quantize* quantize_dialog; +extern MusEDialog::Remove* erase_dialog; +extern MusEDialog::DelOverlaps* del_overlaps_dialog; +extern MusEDialog::Setlen* set_notelen_dialog; +extern MusEDialog::Move* move_notes_dialog; +extern MusEDialog::Transpose* transpose_dialog; +extern MusEDialog::Crescendo* crescendo_dialog; +extern MusEDialog::Legato* legato_dialog; +extern MusEDialog::PasteDialog* paste_dialog; +extern MusEDialog::PasteEventsDialog* paste_events_dialog; + +void init_function_dialogs(QWidget* parent); +void read_function_dialog_config(Xml& xml); +void write_function_dialog_config(int level, Xml& xml); + +#endif diff --git a/muse2/muse/functions.cpp b/muse2/muse/functions.cpp index b178bcb6..8e9a7cd5 100644 --- a/muse2/muse/functions.cpp +++ b/muse2/muse/functions.cpp @@ -23,11 +23,24 @@ #include "functions.h" #include "song.h" #include "undo.h" +#include "helper.h" #include "event.h" #include "audio.h" #include "gconfig.h" +#include "widgets/function_dialogs/velocity.h" +#include "widgets/function_dialogs/quantize.h" +#include "widgets/function_dialogs/crescendo.h" +#include "widgets/function_dialogs/gatetime.h" +#include "widgets/function_dialogs/remove.h" +#include "widgets/function_dialogs/transpose.h" +#include "widgets/function_dialogs/setlen.h" +#include "widgets/function_dialogs/move.h" +#include "widgets/function_dialogs/deloverlaps.h" +#include "widgets/function_dialogs/legato.h" +#include "widgets/pasteeventsdialog.h" + #include <values.h> #include <iostream> #include <errno.h> @@ -43,32 +56,20 @@ #include <QMessageBox> #include <QClipboard> + + using namespace std; -MusEDialog::GateTime* gatetime_dialog=NULL; -MusEDialog::Velocity* velocity_dialog=NULL; -MusEDialog::Quantize* quantize_dialog=NULL; -MusEDialog::Remove* erase_dialog=NULL; -MusEDialog::DelOverlaps* del_overlaps_dialog=NULL; -MusEDialog::Setlen* set_notelen_dialog=NULL; -MusEDialog::Move* move_notes_dialog=NULL; -MusEDialog::Transpose* transpose_dialog=NULL; -MusEDialog::Crescendo* crescendo_dialog=NULL; -MusEDialog::Legato* legato_dialog=NULL; - -void init_function_dialogs(QWidget* parent) -{ - gatetime_dialog = new MusEDialog::GateTime(parent); - velocity_dialog = new MusEDialog::Velocity(parent); - quantize_dialog = new MusEDialog::Quantize(parent); - erase_dialog = new MusEDialog::Remove(parent); - del_overlaps_dialog = new MusEDialog::DelOverlaps(parent); - set_notelen_dialog = new MusEDialog::Setlen(parent); - move_notes_dialog = new MusEDialog::Move(parent); - transpose_dialog = new MusEDialog::Transpose(parent); - crescendo_dialog = new MusEDialog::Crescendo(parent); - legato_dialog = new MusEDialog::Legato(parent); -} +using MusEConfig::config; + + +// unit private functions: + +bool read_eventlist_and_part(Xml& xml, EventList* el, int* part_id); + +// ----------------------- + + set<Part*> partlist_to_set(PartList* pl) { @@ -87,6 +88,37 @@ set<Part*> part_to_set(Part* p) return result; } +set<Part*> get_all_parts() +{ + set<Part*> result; + + TrackList* tracks=song->tracks(); + for (TrackList::const_iterator t_it=tracks->begin(); t_it!=tracks->end(); t_it++) + { + const PartList* parts=(*t_it)->cparts(); + for (ciPart p_it=parts->begin(); p_it!=parts->end(); p_it++) + result.insert(p_it->second); + } + + return result; +} + +set<Part*> get_all_selected_parts() +{ + set<Part*> result; + + TrackList* tracks=song->tracks(); + for (TrackList::const_iterator t_it=tracks->begin(); t_it!=tracks->end(); t_it++) + { + const PartList* parts=(*t_it)->cparts(); + for (ciPart p_it=parts->begin(); p_it!=parts->end(); p_it++) + if (p_it->second->selected()) + result.insert(p_it->second); + } + + return result; +} + bool is_relevant(const Event& event, const Part* part, int range) { unsigned tick; @@ -118,6 +150,8 @@ map<Event*, Part*> get_events(const set<Part*>& parts, int range) } + + bool modify_notelen(const set<Part*>& parts) { if (!gatetime_dialog->exec()) @@ -229,6 +263,180 @@ bool legato(const set<Part*>& parts) +bool modify_notelen() +{ + if (!gatetime_dialog->exec()) + return false; + + set<Part*> parts; + if (gatetime_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) + parts=get_all_selected_parts(); + else + parts=get_all_parts(); + + modify_notelen(parts,gatetime_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS, gatetime_dialog->rateVal,gatetime_dialog->offsetVal); + + return true; +} + +bool modify_velocity() +{ + if (!velocity_dialog->exec()) + return false; + + set<Part*> parts; + if (velocity_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) + parts=get_all_selected_parts(); + else + parts=get_all_parts(); + + modify_velocity(parts,velocity_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS,velocity_dialog->rateVal,velocity_dialog->offsetVal); + + return true; +} + +bool quantize_notes() +{ + if (!quantize_dialog->exec()) + return false; + + set<Part*> parts; + if (quantize_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) + parts=get_all_selected_parts(); + else + parts=get_all_parts(); + + quantize_notes(parts, quantize_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS, (config.division*4)/(1<<quantize_dialog->raster_power2), + quantize_dialog->quant_len, quantize_dialog->strength, quantize_dialog->swing, + quantize_dialog->threshold); + + return true; +} + +bool erase_notes() +{ + if (!erase_dialog->exec()) + return false; + + set<Part*> parts; + if (erase_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) + parts=get_all_selected_parts(); + else + parts=get_all_parts(); + + erase_notes(parts,erase_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS, erase_dialog->velo_threshold, erase_dialog->velo_thres_used, + erase_dialog->len_threshold, erase_dialog->len_thres_used ); + + return true; +} + +bool delete_overlaps() +{ + if (!del_overlaps_dialog->exec()) + return false; + + set<Part*> parts; + if (del_overlaps_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) + parts=get_all_selected_parts(); + else + parts=get_all_parts(); + + delete_overlaps(parts,erase_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS); + + return true; +} + +bool set_notelen() +{ + if (!set_notelen_dialog->exec()) + return false; + + set<Part*> parts; + if (set_notelen_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) + parts=get_all_selected_parts(); + else + parts=get_all_parts(); + + set_notelen(parts,set_notelen_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS, set_notelen_dialog->len); + + return true; +} + +bool move_notes() +{ + if (!move_notes_dialog->exec()) + return false; + + set<Part*> parts; + if (move_notes_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) + parts=get_all_selected_parts(); + else + parts=get_all_parts(); + + move_notes(parts,move_notes_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS, move_notes_dialog->amount); + + return true; +} + +bool transpose_notes() +{ + if (!transpose_dialog->exec()) + return false; + + set<Part*> parts; + if (transpose_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) + parts=get_all_selected_parts(); + else + parts=get_all_parts(); + + transpose_notes(parts,transpose_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS, transpose_dialog->amount); + + return true; +} + +bool crescendo() +{ + if (song->rpos() <= song->lpos()) + { + QMessageBox::warning(NULL, QObject::tr("Error"), QObject::tr("Please first select the range for crescendo with the loop markers.")); + return false; + } + + if (!crescendo_dialog->exec()) + return false; + + set<Part*> parts; + if (crescendo_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) + parts=get_all_selected_parts(); + else + parts=get_all_parts(); + + crescendo(parts,crescendo_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS, crescendo_dialog->start_val,crescendo_dialog->end_val,crescendo_dialog->absolute); + + return true; +} + +bool legato() +{ + if (!legato_dialog->exec()) + return false; + + set<Part*> parts; + if (legato_dialog->range & FUNCTION_RANGE_ONLY_SELECTED) + parts=get_all_selected_parts(); + else + parts=get_all_parts(); + + legato(parts,legato_dialog->range & FUNCTION_RANGE_ONLY_BETWEEN_MARKERS, legato_dialog->min_len, !legato_dialog->allow_shortening); + + return true; +} + + + + + + bool modify_velocity(const set<Part*>& parts, int range, int rate, int offset) { map<Event*, Part*> events = get_events(parts, range); @@ -667,34 +875,93 @@ void copy_notes(const set<Part*>& parts, int range) QApplication::clipboard()->setMimeData(drag, QClipboard::Clipboard); } -void paste_notes(Part* dest_part) +unsigned get_groupedevents_len(const QString& pt) { - QString tmp="x-muse-eventlist"; // QClipboard::text() expects a QString&, not a QString :( - QString s = QApplication::clipboard()->text(tmp, QClipboard::Clipboard); // TODO CHECK Tim. - paste_at(dest_part, s, song->cpos()); + unsigned maxlen=0; + + Xml xml(pt.toLatin1().constData()); + for (;;) + { + Xml::Token token = xml.parse(); + const QString& tag = xml.s1(); + switch (token) + { + case Xml::Error: + case Xml::End: + return maxlen; + + case Xml::TagStart: + if (tag == "eventlist") + { + EventList el; + int part_id; + if (read_eventlist_and_part(xml, &el, &part_id)) + { + unsigned len = el.rbegin()->first; + if (len > maxlen) maxlen=len; + } + } + else + xml.unknown("get_clipboard_len"); + break; + + case Xml::Attribut: + case Xml::TagEnd: + default: + break; + } + } + + return maxlen; // see also the return statement above! } -QMimeData* selected_events_to_mime(const set<Part*>& parts, int range) +unsigned get_clipboard_len() { - map<Event*, Part*> events=get_events(parts,range); + QString tmp="x-muse-groupedeventlists"; // QClipboard::text() expects a QString&, not a QString :( + QString s = QApplication::clipboard()->text(tmp, QClipboard::Clipboard); // TODO CHECK Tim. + + return get_groupedevents_len(s); +} - //--------------------------------------------------- - // generate event list from selected events - //--------------------------------------------------- +bool paste_notes(Part* paste_into_part) +{ + unsigned temp_begin = AL::sigmap.raster1(song->cpos(),0); + unsigned temp_end = AL::sigmap.raster2(temp_begin + get_clipboard_len(), 0); + paste_events_dialog->raster = temp_end - temp_begin; + paste_events_dialog->into_single_part_allowed = (paste_into_part!=NULL); + + if (!paste_events_dialog->exec()) + return false; + + paste_notes(paste_events_dialog->max_distance, paste_events_dialog->always_new_part, + paste_events_dialog->never_new_part, paste_events_dialog->into_single_part ? paste_into_part : NULL, + paste_events_dialog->number, paste_events_dialog->raster); + + return true; +} - EventList el; - unsigned startTick = MAXINT; //will be the tick of the first event or MAXINT if no events are there +void paste_notes(int max_distance, bool always_new_part, bool never_new_part, Part* paste_into_part, int amount, int raster) +{ + QString tmp="x-muse-groupedeventlists"; // QClipboard::text() expects a QString&, not a QString :( + QString s = QApplication::clipboard()->text(tmp, QClipboard::Clipboard); // TODO CHECK Tim. + paste_at(s, song->cpos(), max_distance, always_new_part, never_new_part, paste_into_part, amount, raster); +} - for (map<Event*, Part*>::iterator it=events.begin(); it!=events.end(); it++) - { - Event& e = *it->first; - - if (e.tick() < startTick) - startTick = e.tick(); - - el.add(e); - } +// if nothing is selected/relevant, this function returns NULL +QMimeData* selected_events_to_mime(const set<Part*>& parts, int range) +{ + unsigned start_tick = MAXINT; //will be the tick of the first event or MAXINT if no events are there + + for (set<Part*>::iterator part=parts.begin(); part!=parts.end(); part++) + for (iEvent ev=(*part)->events()->begin(); ev!=(*part)->events()->end(); ev++) + if (is_relevant(ev->second, *part, range)) + if (ev->second.tick() < start_tick) + start_tick=ev->second.tick(); + + if (start_tick == MAXINT) + return NULL; + //--------------------------------------------------- // write events as XML into tmp file //--------------------------------------------------- @@ -709,10 +976,14 @@ QMimeData* selected_events_to_mime(const set<Part*>& parts, int range) Xml xml(tmp); int level = 0; - xml.tag(level++, "eventlist"); - for (ciEvent e = el.begin(); e != el.end(); ++e) - e->second.write(level, xml, -startTick); - xml.etag(--level, "eventlist"); + for (set<Part*>::iterator part=parts.begin(); part!=parts.end(); part++) + { + xml.tag(level++, "eventlist part_id=\"%d\"", (*part)->sn()); + for (iEvent ev=(*part)->events()->begin(); ev!=(*part)->events()->end(); ev++) + if (is_relevant(ev->second, *part, range)) + ev->second.write(level, xml, -start_tick); + xml.etag(--level, "eventlist"); + } //--------------------------------------------------- // read tmp file into drag Object @@ -722,7 +993,7 @@ QMimeData* selected_events_to_mime(const set<Part*>& parts, int range) struct stat f_stat; if (fstat(fileno(tmp), &f_stat) == -1) { - fprintf(stderr, "PianoCanvas::copy() fstat failed:<%s>\n", + fprintf(stderr, "copy_notes() fstat failed:<%s>\n", strerror(errno)); fclose(tmp); return 0; @@ -735,7 +1006,7 @@ QMimeData* selected_events_to_mime(const set<Part*>& parts, int range) QByteArray data(fbuf); QMimeData* md = new QMimeData(); - md->setData("text/x-muse-eventlist", data); + md->setData("text/x-muse-groupedeventlists", data); munmap(fbuf, n); fclose(tmp); @@ -743,10 +1014,53 @@ QMimeData* selected_events_to_mime(const set<Part*>& parts, int range) return md; } -void paste_at(Part* dest_part, const QString& pt, int pos) +bool read_eventlist_and_part(Xml& xml, EventList* el, int* part_id) // true on success, false on failure +{ + *part_id = -1; + + for (;;) + { + Xml::Token token = xml.parse(); + const QString& tag = xml.s1(); + switch (token) + { + case Xml::Error: + case Xml::End: + return false; + + case Xml::Attribut: + if (tag == "part_id") + *part_id = xml.s2().toInt(); + else + printf("unknown attribute '%s' in read_eventlist_and_part(), ignoring it...\n", tag.toAscii().data()); + break; + + case Xml::TagStart: + if (tag == "event") + { + Event e(Note); + e.read(xml); + el->add(e); + } + else + xml.unknown("read_eventlist_and_part"); + break; + + case Xml::TagEnd: + if (tag == "eventlist") + return true; + + default: + break; + } + } +} + +void paste_at(const QString& pt, int pos, int max_distance, bool always_new_part, bool never_new_part, Part* paste_into_part, int amount, int raster) { Undo operations; - unsigned newpartlen=dest_part->lenTick(); + map<Part*, unsigned> expand_map; + map<Part*, set<Part*> > new_part_map; Xml xml(pt.toLatin1().constData()); for (;;) @@ -757,53 +1071,95 @@ void paste_at(Part* dest_part, const QString& pt, int pos) { case Xml::Error: case Xml::End: - goto end_of_paste_at; + goto out_of_paste_at_for; case Xml::TagStart: if (tag == "eventlist") { EventList el; - el.read(xml, "eventlist", true); - for (iEvent i = el.begin(); i != el.end(); ++i) + int part_id; + + if (read_eventlist_and_part(xml, &el, &part_id)) { - Event e = i->second; - int tick = e.tick() + pos - dest_part->tick(); - if (tick<0) + Part* dest_part; + Track* dest_track; + Part* old_dest_part; + + if (paste_into_part == NULL) + dest_part = MusEUtil::partFromSerialNumber(part_id); + else + dest_part=paste_into_part; + + if (dest_part == NULL) { - printf("ERROR: trying to add event before current part!\n"); - goto end_of_paste_at; + printf("ERROR: destination part wasn't found. ignoring these events\n"); } - - e.setTick(tick); - e.setSelected(true); - - if (e.endTick() > dest_part->lenTick()) // event exceeds part? + else { - if (dest_part->hasHiddenEvents()) // auto-expanding is forbidden? - { - if (e.tick() < dest_part->lenTick()) - e.setLenTick(dest_part->lenTick() - e.tick()); // clip - else - e.setLenTick(0); // don't insert that note at all - } - else + dest_track=dest_part->track(); + old_dest_part=dest_part; + unsigned first_paste_tick = el.begin()->first + pos; + bool create_new_part = ( (dest_part->tick() > first_paste_tick) || // dest_part begins too late + ( ( (dest_part->endTick() + max_distance < first_paste_tick) || // dest_part is too far away + always_new_part ) && !never_new_part ) ); // respect function arguments + + for (int i=0;i<amount;i++) { - if (e.endTick() > newpartlen) - newpartlen=e.endTick(); + unsigned curr_pos = pos + i*raster; + first_paste_tick = el.begin()->first + curr_pos; + + if (create_new_part) + { + dest_part = dest_track->newPart(); + dest_part->events()->incARef(-1); // the later song->applyOperationGroup() will increment it + // so we must decrement it first :/ + dest_part->setTick(AL::sigmap.raster1(first_paste_tick, config.division)); + + new_part_map[old_dest_part].insert(dest_part); + operations.push_back(UndoOp(UndoOp::AddPart, dest_part)); + } + + for (iEvent i = el.begin(); i != el.end(); ++i) + { + Event e = i->second.clone(); + int tick = e.tick() + curr_pos - dest_part->tick(); + if (tick<0) + { + printf("ERROR: trying to add event before current part! ignoring this event\n"); + continue; + } + + e.setTick(tick); + e.setSelected(true); + + if (e.endTick() > dest_part->lenTick()) // event exceeds part? + { + if (dest_part->hasHiddenEvents()) // auto-expanding is forbidden? + { + if (e.tick() < dest_part->lenTick()) + e.setLenTick(dest_part->lenTick() - e.tick()); // clip + else + e.setLenTick(0); // don't insert that note at all + } + else + { + if (e.endTick() > expand_map[dest_part]) + expand_map[dest_part]=e.endTick(); + } + } + + if (e.lenTick() != 0) operations.push_back(UndoOp(UndoOp::AddEvent,e, dest_part, false, false)); + } } } - - if (e.lenTick() != 0) operations.push_back(UndoOp(UndoOp::AddEvent,e, dest_part, false, false)); } - - if (newpartlen != dest_part->lenTick()) - schedule_resize_all_same_len_clone_parts(dest_part, newpartlen, operations); - - song->applyOperationGroup(operations); - goto end_of_paste_at; + else + { + printf("ERROR: reading eventlist from clipboard failed. ignoring this one...\n"); + } } else - xml.unknown("paste_at"); + xml.unknown("paste_at"); break; case Xml::Attribut: @@ -813,7 +1169,15 @@ void paste_at(Part* dest_part, const QString& pt, int pos) } } - end_of_paste_at: + out_of_paste_at_for: + + for (map<Part*, unsigned>::iterator it = expand_map.begin(); it!=expand_map.end(); it++) + if (it->second != it->first->lenTick()) + schedule_resize_all_same_len_clone_parts(it->first, it->second, operations); + + song->informAboutNewParts(new_part_map); // must be called before apply. otherwise + // pointer changes (by resize) screw it up + song->applyOperationGroup(operations); song->update(SC_SELECTION); } @@ -1026,74 +1390,3 @@ void clean_parts() song->applyOperationGroup(operations); } - -void read_function_dialog_config(Xml& xml) -{ - if (erase_dialog==NULL) - { - cout << "ERROR: THIS SHOULD NEVER HAPPEN: read_function_dialog_config() called, but\n" - " dialogs are still uninitalized (NULL)!"<<endl; - return; - } - - 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 == "mod_len") - gatetime_dialog->read_configuration(xml); - else if (tag == "mod_velo") - velocity_dialog->read_configuration(xml); - else if (tag == "quantize") - quantize_dialog->read_configuration(xml); - else if (tag == "erase") - erase_dialog->read_configuration(xml); - else if (tag == "del_overlaps") - del_overlaps_dialog->read_configuration(xml); - else if (tag == "setlen") - set_notelen_dialog->read_configuration(xml); - else if (tag == "move") - move_notes_dialog->read_configuration(xml); - else if (tag == "transpose") - transpose_dialog->read_configuration(xml); - else if (tag == "crescendo") - crescendo_dialog->read_configuration(xml); - else if (tag == "legato") - legato_dialog->read_configuration(xml); - else - xml.unknown("function_dialogs"); - break; - - case Xml::TagEnd: - if (tag == "dialogs") - return; - - default: - break; - } - } -} - -void write_function_dialog_config(int level, Xml& xml) -{ - xml.tag(level++, "dialogs"); - - gatetime_dialog->write_configuration(level, xml); - velocity_dialog->write_configuration(level, xml); - quantize_dialog->write_configuration(level, xml); - erase_dialog->write_configuration(level, xml); - del_overlaps_dialog->write_configuration(level, xml); - set_notelen_dialog->write_configuration(level, xml); - move_notes_dialog->write_configuration(level, xml); - transpose_dialog->write_configuration(level, xml); - crescendo_dialog->write_configuration(level, xml); - legato_dialog->write_configuration(level, xml); - - xml.tag(level, "/dialogs"); -} diff --git a/muse2/muse/functions.h b/muse2/muse/functions.h index 6a74b21d..77777f04 100644 --- a/muse2/muse/functions.h +++ b/muse2/muse/functions.h @@ -23,37 +23,19 @@ #ifndef __FUNCTIONS_H__ #define __FUNCTIONS_H__ -#include "widgets/function_dialogs/velocity.h" -#include "widgets/function_dialogs/quantize.h" -#include "widgets/function_dialogs/crescendo.h" -#include "widgets/function_dialogs/gatetime.h" -#include "widgets/function_dialogs/remove.h" -#include "widgets/function_dialogs/transpose.h" -#include "widgets/function_dialogs/setlen.h" -#include "widgets/function_dialogs/move.h" -#include "widgets/function_dialogs/deloverlaps.h" -#include "widgets/function_dialogs/legato.h" - #include <set> #include "part.h" +#include "dialogs.h" +#include <QWidget> class QString; class QMimeData; class Undo; -extern MusEDialog::GateTime* gatetime_dialog; -extern MusEDialog::Velocity* velocity_dialog; -extern MusEDialog::Quantize* quantize_dialog; -extern MusEDialog::Remove* erase_dialog; -extern MusEDialog::DelOverlaps* del_overlaps_dialog; -extern MusEDialog::Setlen* set_notelen_dialog; -extern MusEDialog::Move* move_notes_dialog; -extern MusEDialog::Transpose* transpose_dialog; -extern MusEDialog::Crescendo* crescendo_dialog; -extern MusEDialog::Legato* legato_dialog; +#define FUNCTION_RANGE_ONLY_SELECTED 1 +#define FUNCTION_RANGE_ONLY_BETWEEN_MARKERS 2 -void init_function_dialogs(QWidget* parent); std::set<Part*> partlist_to_set(PartList* pl); @@ -87,12 +69,25 @@ bool erase_notes(const std::set<Part*>& parts); bool delete_overlaps(const std::set<Part*>& parts); bool legato(const std::set<Part*>& parts); +//the below functions operate on selected parts +bool modify_velocity(); +bool modify_notelen(); +bool quantize_notes(); +bool set_notelen(); +bool move_notes(); +bool transpose_notes(); +bool crescendo(); +bool erase_notes(); +bool delete_overlaps(); +bool legato(); + //functions for copy'n'paste void copy_notes(const std::set<Part*>& parts, int range); -void paste_notes(Part* dest_part); +bool paste_notes(Part* paste_into_part=NULL); // shows a dialog +void paste_notes(int max_distance=3072, bool always_new_part=false, bool never_new_part=false, Part* paste_into_part=NULL, int amount=1, int raster=3072); QMimeData* selected_events_to_mime(const std::set<Part*>& parts, int range); -void paste_at(Part* dest_part, const QString& pt, int pos); +void paste_at(const QString& pt, int pos, int max_distance=3072, bool always_new_part=false, bool never_new_part=false, Part* paste_into_part=NULL, int amount=1, int raster=3072); //functions for selections void select_all(const std::set<Part*>& parts); @@ -107,9 +102,4 @@ void expand_parts(int raster=-1); void schedule_resize_all_same_len_clone_parts(Part* part, unsigned new_len, Undo& operations); void clean_parts(); -//functions for reading and writing default values -class Xml; -void read_function_dialog_config(Xml& xml); -void write_function_dialog_config(int level, Xml& xml); - #endif diff --git a/muse2/muse/gconfig.cpp b/muse2/muse/gconfig.cpp index b47a4773..deed36b3 100644 --- a/muse2/muse/gconfig.cpp +++ b/muse2/muse/gconfig.cpp @@ -165,6 +165,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 9b4099a6..1801df5f 100644 --- a/muse2/muse/gconfig.h +++ b/muse2/muse/gconfig.h @@ -137,6 +137,7 @@ struct GlobalConfigValues { bool mixer1Visible; bool mixer2Visible; bool markerVisible; + bool arrangerVisible; bool showSplashScreen; int canvasShowPartType; // 1 - names, 2 events diff --git a/muse2/muse/helper.cpp b/muse2/muse/helper.cpp index fad9959f..1a223bb3 100644 --- a/muse2/muse/helper.cpp +++ b/muse2/muse/helper.cpp @@ -24,11 +24,27 @@ #include "part.h" #include "track.h" #include "song.h" +#include "app.h" +#include "icons.h" +#include "synth.h" +#include "functions.h" + +#ifdef DSSI_SUPPORT +#include "dssihost.h" +#endif + +#ifdef VST_SUPPORT +#include "vst.h" +#endif + +using std::set; namespace MusEGlobal { extern bool hIsB; } +namespace MusEUtil { + static const char* vall[] = { "c","c#","d","d#","e","f","f#","g","g#","a","a#","h" }; @@ -76,3 +92,240 @@ Part* partFromSerialNumber(int serial) printf("ERROR: partFromSerialNumber(%i) wasn't able to find an appropriate part!\n",serial); return NULL; } + + +//--------------------------------------------------------- +// populateAddSynth +//--------------------------------------------------------- + +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; + } + +bool any_event_selected(const set<Part*>& parts, bool in_range) +{ + return !get_events(parts, in_range ? 3 : 1).empty(); +} + +} // namespace MusEUtil diff --git a/muse2/muse/helper.h b/muse2/muse/helper.h index fe4d018f..e86a8949 100644 --- a/muse2/muse/helper.h +++ b/muse2/muse/helper.h @@ -23,13 +23,26 @@ #ifndef __HELPER_H__ #define __HELPER_H__ -#include <QString> +#include <set> + +class QActionGroup; +class QString; +class QMenu; +class QWidget; class Part; -extern QString pitch2string(int v); +namespace MusEUtil { + +QString pitch2string(int v); Part* partFromSerialNumber(int serial); +bool any_event_selected(const std::set<Part*>&, bool in_range=false); + +QMenu* populateAddSynth(QWidget* parent); +QActionGroup* populateAddTrack(QMenu* addTrack); + +} #endif diff --git a/muse2/muse/importmidi.cpp b/muse2/muse/importmidi.cpp index c7c02253..fd690671 100644 --- a/muse2/muse/importmidi.cpp +++ b/muse2/muse/importmidi.cpp @@ -268,8 +268,8 @@ bool MusE::importMidi(const QString name, bool merge) song->updatePos(); - arranger->reset(); - ///arranger->setMode(int(song->mtype())); // p4.0.7 Tim + _arranger->reset(); + ///_arranger->setMode(int(song->mtype())); // p4.0.7 Tim } else { song->initLen(); diff --git a/muse2/muse/keyevent.cpp b/muse2/muse/keyevent.cpp index 63bcdbe8..1dfe09dc 100644 --- a/muse2/muse/keyevent.cpp +++ b/muse2/muse/keyevent.cpp @@ -167,6 +167,7 @@ void KeyList::delKey(unsigned tick) void KeyList::write(int level, Xml& xml) const { + xml.tag(level, "keylist"); for (ciKeyEvent i = begin(); i != end(); ++i) i->second.write(level, xml, i->first); xml.tag(level, "/keylist"); diff --git a/muse2/muse/liste/listedit.cpp b/muse2/muse/liste/listedit.cpp index 37989ca9..9766ba71 100644 --- a/muse2/muse/liste/listedit.cpp +++ b/muse2/muse/liste/listedit.cpp @@ -33,6 +33,7 @@ #include "listedit.h" #include "mtscale.h" #include "globals.h" +#include "helper.h" #include "icons.h" #include "editevent.h" #include "xml.h" @@ -180,7 +181,7 @@ static QString midiMetaComment(const Event& ev) void ListEdit::closeEvent(QCloseEvent* e) { - emit deleted((unsigned long)this); + emit deleted(static_cast<TopWin*>(this)); e->accept(); } @@ -381,7 +382,7 @@ QString EventListItem::text(int col) const break; case 4: if (event.isNote() || event.type() == PAfter) - s = pitch2string(event.dataA()); + s = MusEUtil::pitch2string(event.dataA()); else if (event.type() == Controller) s.setNum(event.dataA() & 0xffff); // mask off type bits else @@ -460,7 +461,7 @@ QString EventListItem::text(int col) const //--------------------------------------------------------- ListEdit::ListEdit(PartList* pl) - : MidiEditor(0, pl) + : MidiEditor(TopWin::LISTE, 0, pl) { insertItems = new QActionGroup(this); insertItems->setExclusive(false); @@ -511,14 +512,29 @@ ListEdit::ListEdit(PartList* pl) connect(editSignalMapper, SIGNAL(mapped(int)), SLOT(cmd(int))); - //---------ToolBar---------------------------------- - - listTools = addToolBar(tr("List tools")); - listTools->addActions(MusEGlobal::undoRedo->actions()); - + QMenu* settingsMenu = menuBar()->addMenu(tr("Window &Config")); + settingsMenu->addAction(subwinAction); + settingsMenu->addAction(shareAction); + settingsMenu->addAction(fullscreenAction); + + + // Toolbars --------------------------------------------------------- + QToolBar* undo_tools=addToolBar(tr("Undo/Redo tools")); + undo_tools->setObjectName("Undo/Redo tools"); + undo_tools->addActions(MusEGlobal::undoRedo->actions()); + QToolBar* insertTools = addToolBar(tr("Insert tools")); + insertTools->setObjectName("list insert tools"); insertTools->addActions(insertItems->actions()); + QToolBar* panic_toolbar = addToolBar(tr("panic")); + panic_toolbar->setObjectName("panic"); + panic_toolbar->addAction(MusEGlobal::panicAction); + + QToolBar* transport_toolbar = addToolBar(tr("transport")); + transport_toolbar->setObjectName("transport"); + transport_toolbar->addActions(MusEGlobal::transportAction->actions()); + // //--------------------------------------------------- // liste @@ -589,6 +605,8 @@ ListEdit::ListEdit(PartList* pl) } initShortcuts(); + + setWindowTitle("MusE: List Editor"); } //--------------------------------------------------------- @@ -828,6 +846,45 @@ void ListEdit::writeStatus(int level, Xml& xml) const } //--------------------------------------------------------- +// readConfiguration +//--------------------------------------------------------- + +void ListEdit::readConfiguration(Xml& xml) + { + for (;;) { + Xml::Token token = xml.parse(); + const QString& tag = xml.s1(); + switch (token) { + case Xml::Error: + case Xml::End: + return; + case Xml::TagStart: + if (tag == "topwin") + TopWin::readConfiguration(LISTE, xml); + else + xml.unknown("ListEdit"); + break; + case Xml::TagEnd: + if (tag == "listedit") + return; + default: + break; + } + } + } + +//--------------------------------------------------------- +// writeConfiguration +//--------------------------------------------------------- + +void ListEdit::writeConfiguration(int level, Xml& xml) + { + xml.tag(level++, "listedit"); + TopWin::writeConfiguration(LISTE, level, xml); + xml.tag(level, "/listedit"); + } + +//--------------------------------------------------------- // selectionChanged //--------------------------------------------------------- diff --git a/muse2/muse/liste/listedit.h b/muse2/muse/liste/listedit.h index 5d522812..ba26b6b6 100644 --- a/muse2/muse/liste/listedit.h +++ b/muse2/muse/liste/listedit.h @@ -83,13 +83,15 @@ class ListEdit : public MidiEditor { void songChanged(int); signals: - void deleted(unsigned long); + void deleted(TopWin*); public: ListEdit(PartList*); ~ListEdit(); virtual void readStatus(Xml&); virtual void writeStatus(int, Xml&) const; + static void readConfiguration(Xml&); + static void writeConfiguration(int, Xml&); }; #endif diff --git a/muse2/muse/main.cpp b/muse2/muse/main.cpp index b30c3ef5..11644e2f 100644 --- a/muse2/muse/main.cpp +++ b/muse2/muse/main.cpp @@ -23,6 +23,7 @@ #include <QApplication> #include <QDir> +#include <QFile> #include <QKeyEvent> #include <QMessageBox> #include <QLocale> @@ -118,6 +119,8 @@ class MuseApplication : public QApplication { void setMuse(MusEApp::MusE* m) { muse = m; + + connect(this,SIGNAL(focusChanged(QWidget*,QWidget*)),muse,SLOT(focusChanged(QWidget*,QWidget*))); #ifdef HAVE_LASH if(MusEGlobal::useLASH) startTimer (300); @@ -258,6 +261,28 @@ int main(int argc, char* argv[]) QDir cPath = QDir(MusEGlobal::configPath); if (! cPath.exists()) cPath.mkpath("."); + + QFile cConf (MusEGlobal::configName); + QFile cConfTempl (MusEGlobal::museGlobalShare + QString("/templates/MusE.cfg")); + if (! cConf.exists()) + { + printf ("creating new config...\n"); + if (cConfTempl.copy(MusEGlobal::configName)) + printf (" success.\n"); + else + printf (" FAILED!\n"); + } + + QFile cConfQt (MusEGlobal::configPath + QString("/MusE-qt.conf")); + QFile cConfTemplQt (MusEGlobal::museGlobalShare + QString("/templates/MusE-qt.conf")); + if (! cConfQt.exists()) + { + printf ("creating new qt config...\n"); + if (cConfTemplQt.copy(cConfQt.fileName())) + printf (" success.\n"); + else + printf (" FAILED!\n"); + } #ifdef HAVE_LASH lash_args_t * lash_args = 0; diff --git a/muse2/muse/marker/markerview.cpp b/muse2/muse/marker/markerview.cpp index 9e0b5b27..3aa1908c 100644 --- a/muse2/muse/marker/markerview.cpp +++ b/muse2/muse/marker/markerview.cpp @@ -156,7 +156,7 @@ void MarkerItem::setTick(unsigned v) void MarkerView::closeEvent(QCloseEvent* e) { - emit deleted((unsigned long)this); + emit deleted(static_cast<TopWin*>(this)); emit closed(); e->accept(); } @@ -166,7 +166,7 @@ void MarkerView::closeEvent(QCloseEvent* e) //--------------------------------------------------------- MarkerView::MarkerView(QWidget* parent) - : TopWin(parent, "markerview", Qt::Window /*| WDestructiveClose*/) + : TopWin(TopWin::MARKER, parent, "markerview", Qt::Window /*| WDestructiveClose*/) { //setAttribute(Qt::WA_DeleteOnClose); @@ -187,15 +187,32 @@ MarkerView::MarkerView(QWidget* parent) editMenu->addAction(markerAdd); editMenu->addAction(markerDelete); - - //---------ToolBar---------------------------------- - tools = addToolBar(tr("marker-tools")); - tools->addActions(MusEGlobal::undoRedo->actions()); + + + QMenu* settingsMenu = menuBar()->addMenu(tr("Window &Config")); + settingsMenu->addAction(subwinAction); + settingsMenu->addAction(shareAction); + settingsMenu->addAction(fullscreenAction); + + + // Toolbars --------------------------------------------------------- + QToolBar* undo_tools=addToolBar(tr("Undo/Redo tools")); + undo_tools->setObjectName("Undo/Redo tools"); + undo_tools->addActions(MusEGlobal::undoRedo->actions()); QToolBar* edit = addToolBar(tr("edit tools")); + edit->setObjectName("marker edit tools"); edit->addAction(markerAdd); edit->addAction(markerDelete); + QToolBar* panic_toolbar = addToolBar(tr("panic")); + panic_toolbar->setObjectName("panic"); + panic_toolbar->addAction(MusEGlobal::panicAction); + + QToolBar* transport_toolbar = addToolBar(tr("transport")); + transport_toolbar->setObjectName("transport"); + transport_toolbar->addActions(MusEGlobal::transportAction->actions()); + //--------------------------------------------------- // master //--------------------------------------------------- @@ -284,7 +301,6 @@ MarkerView::MarkerView(QWidget* parent) // bug: 2811156 Softsynth GUI unclosable with XFCE4 (and a few others) show(); hide(); - } //--------------------------------------------------------- @@ -311,7 +327,10 @@ void MarkerView::readStatus(Xml& xml) break; switch (token) { case Xml::TagStart: - xml.unknown("Marker"); + if (tag=="topwin") + TopWin::readStatus(xml); + else + xml.unknown("Marker"); break; case Xml::TagEnd: if (tag == "marker") @@ -329,6 +348,46 @@ void MarkerView::readStatus(Xml& xml) void MarkerView::writeStatus(int level, Xml& xml) const { xml.tag(level++, "marker"); + TopWin::writeStatus(level, xml); + xml.tag(level, "/marker"); + } + +//--------------------------------------------------------- +// readConfiguration +//--------------------------------------------------------- + +void MarkerView::readConfiguration(Xml& xml) + { + for (;;) { + Xml::Token token = xml.parse(); + const QString& tag = xml.s1(); + switch (token) { + case Xml::Error: + case Xml::End: + return; + case Xml::TagStart: + if (tag == "topwin") + TopWin::readConfiguration(MARKER, xml); + else + xml.unknown("MarkerView"); + break; + case Xml::TagEnd: + if (tag == "marker") + return; + default: + break; + } + } + } + +//--------------------------------------------------------- +// writeConfiguration +//--------------------------------------------------------- + +void MarkerView::writeConfiguration(int level, Xml& xml) + { + xml.tag(level++, "marker"); + TopWin::writeConfiguration(MARKER, level, xml); xml.tag(level, "/marker"); } diff --git a/muse2/muse/marker/markerview.h b/muse2/muse/marker/markerview.h index f904a2c7..48d4901a 100644 --- a/muse2/muse/marker/markerview.h +++ b/muse2/muse/marker/markerview.h @@ -92,7 +92,7 @@ class MarkerView : public TopWin { void songChanged(int); signals: - void deleted(unsigned long); + void deleted(TopWin*); void closed(); public: @@ -100,6 +100,8 @@ class MarkerView : public TopWin { ~MarkerView(); virtual void readStatus(Xml&); virtual void writeStatus(int, Xml&) const; + static void readConfiguration(Xml&); + static void writeConfiguration(int, Xml&); void nextMarker(); void prevMarker(); }; diff --git a/muse2/muse/master/lmaster.cpp b/muse2/muse/master/lmaster.cpp index 46d1d446..a2cc8538 100644 --- a/muse2/muse/master/lmaster.cpp +++ b/muse2/muse/master/lmaster.cpp @@ -55,6 +55,7 @@ #define LMASTER_MSGBOX_STRING "MusE: List Editor" + //don't remove or insert new elements in keyStrs. //only renaming (keeping the semantic sense) is allowed! (flo) QStringList keyStrs = QStringList() @@ -116,7 +117,7 @@ QString keyToString(key_enum key) void LMaster::closeEvent(QCloseEvent* e) { - emit deleted((unsigned long)this); + emit deleted(static_cast<TopWin*>(this)); e->accept(); } @@ -135,7 +136,7 @@ void LMaster::songChanged(int type) //--------------------------------------------------------- LMaster::LMaster() - : MidiEditor(0, 0, 0) + : MidiEditor(TopWin::LMASTER, 0, 0, 0) { pos_editor = 0; tempo_editor = 0; @@ -168,6 +169,12 @@ LMaster::LMaster() delAction = menuEdit->addAction(tr("Delete Event")); delAction->setShortcut(Qt::Key_Delete); + QMenu* settingsMenu = menuBar()->addMenu(tr("Window &Config")); + settingsMenu->addAction(subwinAction); + settingsMenu->addAction(shareAction); + settingsMenu->addAction(fullscreenAction); + + connect(tempoAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(signAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(keyAction, SIGNAL(triggered()), signalMapper, SLOT(map())); @@ -184,11 +191,13 @@ LMaster::LMaster() connect(signalMapper, SIGNAL(mapped(int)), SLOT(cmd(int))); - //---------ToolBar---------------------------------- - tools = addToolBar(tr("Master tools")); - tools->addActions(MusEGlobal::undoRedo->actions()); + // Toolbars --------------------------------------------------------- + QToolBar* undo_tools=addToolBar(tr("Undo/Redo tools")); + undo_tools->setObjectName("Undo/Redo tools"); + undo_tools->addActions(MusEGlobal::undoRedo->actions()); QToolBar* edit = addToolBar(tr("Edit tools")); + edit->setObjectName("Master List Edit Tools"); QToolButton* tempoButton = new QToolButton(); QToolButton* timeSigButton = new QToolButton(); QToolButton* keyButton = new QToolButton(); @@ -202,6 +211,14 @@ LMaster::LMaster() edit->addWidget(timeSigButton); edit->addWidget(keyButton); + QToolBar* panic_toolbar = addToolBar(tr("panic")); + panic_toolbar->setObjectName("panic"); + panic_toolbar->addAction(MusEGlobal::panicAction); + + QToolBar* transport_toolbar = addToolBar(tr("transport")); + transport_toolbar->setObjectName("transport"); + transport_toolbar->addActions(MusEGlobal::transportAction->actions()); + ///Q3Accel* qa = new Q3Accel(this); ///qa->connectItem(qa->insertItem(Qt::CTRL+Qt::Key_Z), song, SLOT(undo())); ///qa->connectItem(qa->insertItem(Qt::CTRL+Qt::Key_Y), song, SLOT(redo())); @@ -420,6 +437,45 @@ void LMaster::writeStatus(int level, Xml& xml) const } //--------------------------------------------------------- +// readConfiguration +//--------------------------------------------------------- + +void LMaster::readConfiguration(Xml& xml) + { + for (;;) { + Xml::Token token = xml.parse(); + const QString& tag = xml.s1(); + switch (token) { + case Xml::Error: + case Xml::End: + return; + case Xml::TagStart: + if (tag == "topwin") + TopWin::readConfiguration(LMASTER, xml); + else + xml.unknown("LMaster"); + break; + case Xml::TagEnd: + if (tag == "lmaster") + return; + default: + break; + } + } + } + +//--------------------------------------------------------- +// writeConfiguration +//--------------------------------------------------------- + +void LMaster::writeConfiguration(int level, Xml& xml) + { + xml.tag(level++, "lmaster"); + TopWin::writeConfiguration(LMASTER, level, xml); + xml.tag(level, "/lmaster"); + } + +//--------------------------------------------------------- // select //--------------------------------------------------------- diff --git a/muse2/muse/master/lmaster.h b/muse2/muse/master/lmaster.h index 54ec0281..4d2c03e9 100644 --- a/muse2/muse/master/lmaster.h +++ b/muse2/muse/master/lmaster.h @@ -29,15 +29,10 @@ #include "tempo.h" #include "keyevent.h" ///#include "sig.h" -//#include "al/sig.h" +#include "al/sig.h" #include <QTreeWidgetItem> -namespace AL { - class SigEvent; - }; -using AL::SigEvent; - namespace Awl { class PosEdit; class SigEdit; @@ -112,12 +107,12 @@ class LMasterKeyEventItem : public LMasterLViewItem { class LMasterSigEventItem : public LMasterLViewItem { private: - const SigEvent* sigEvent; + const AL::SigEvent* sigEvent; public: - LMasterSigEventItem(QTreeWidget* parent, const SigEvent* s); + LMasterSigEventItem(QTreeWidget* parent, const AL::SigEvent* s); virtual LMASTER_LVTYPE getType() { return LMASTER_SIGEVENT; } - const SigEvent* getEvent() { return sigEvent; } + const AL::SigEvent* getEvent() { return sigEvent; } virtual unsigned tick() { return sigEvent->tick; } int z() { return sigEvent->sig.z; } int n() { return sigEvent->sig.n; } @@ -142,7 +137,7 @@ class LMaster : public MidiEditor { virtual void closeEvent(QCloseEvent*); void updateList(); void insertTempo(const TEvent*); - void insertSig(const SigEvent*); + void insertSig(const AL::SigEvent*); void insertKey(const KeyEvent&); LMasterLViewItem* getItemAtPos(unsigned tick, LMASTER_LVTYPE t); void initShortcuts(); @@ -173,7 +168,7 @@ class LMaster : public MidiEditor { void configChanged(); signals: - void deleted(unsigned long); + void deleted(TopWin*); void seekTo(int tick); public: @@ -181,6 +176,8 @@ class LMaster : public MidiEditor { ~LMaster(); virtual void readStatus(Xml&); virtual void writeStatus(int, Xml&) const; + static void readConfiguration(Xml&); + static void writeConfiguration(int, Xml&); LMasterLViewItem* getLastOfType(LMASTER_LVTYPE t); }; diff --git a/muse2/muse/master/masteredit.cpp b/muse2/muse/master/masteredit.cpp index 1a737476..c3fde313 100644 --- a/muse2/muse/master/masteredit.cpp +++ b/muse2/muse/master/masteredit.cpp @@ -46,12 +46,10 @@ #include <QLabel> #include <QToolBar> #include <QToolButton> -#include <QSettings> +#include <QMenuBar> +#include <QMenu> int MasterEdit::_rasterInit = 0; -int MasterEdit::_widthInit = 600; -int MasterEdit::_heightInit = 400; -QByteArray MasterEdit::_toolbarInit; //--------------------------------------------------------- // closeEvent @@ -59,11 +57,7 @@ QByteArray MasterEdit::_toolbarInit; void MasterEdit::closeEvent(QCloseEvent* e) { - QSettings settings("MusE", "MusE-qt"); - //settings.setValue("MasterEdit/geometry", saveGeometry()); - settings.setValue("MasterEdit/windowState", saveState()); - - emit deleted((unsigned long)this); + emit deleted(static_cast<TopWin*>(this)); e->accept(); } @@ -100,22 +94,33 @@ void MasterEdit::songChanged(int type) //--------------------------------------------------------- MasterEdit::MasterEdit() - : MidiEditor(_rasterInit, 0) + : MidiEditor(TopWin::MASTER, _rasterInit, 0) { setWindowTitle(tr("MusE: Mastertrack")); _raster = 0; // measure - setMinimumSize(400, 300); - resize(_widthInit, _heightInit); //---------Pulldown Menu---------------------------- // QPopupMenu* file = new QPopupMenu(this); // menuBar()->insertItem("&File", file); - //---------ToolBar---------------------------------- - - tools = addToolBar(tr("Master tools")); - tools->setObjectName("Master tools"); - tools->addActions(MusEGlobal::undoRedo->actions()); + QMenu* settingsMenu = menuBar()->addMenu(tr("Window &Config")); + settingsMenu->addAction(subwinAction); + settingsMenu->addAction(shareAction); + settingsMenu->addAction(fullscreenAction); + + // Toolbars --------------------------------------------------------- + QToolBar* undo_tools=addToolBar(tr("Undo/Redo tools")); + undo_tools->setObjectName("Undo/Redo tools"); + undo_tools->addActions(MusEGlobal::undoRedo->actions()); + + + QToolBar* panic_toolbar = addToolBar(tr("panic")); + panic_toolbar->setObjectName("panic"); + panic_toolbar->addAction(MusEGlobal::panicAction); + + QToolBar* transport_toolbar = addToolBar(tr("transport")); + transport_toolbar->setObjectName("transport"); + transport_toolbar->addActions(MusEGlobal::transportAction->actions()); MusEWidget::EditToolBar* tools2 = new MusEWidget::EditToolBar(this, MusEWidget::PointerTool | MusEWidget::PencilTool | MusEWidget::RubberTool); addToolBar(tools2); @@ -256,12 +261,7 @@ MasterEdit::MasterEdit() connect(canvas, SIGNAL(followEvent(int)), hscroll, SLOT(setOffset(int))); connect(canvas, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned))); - if (!_toolbarInit.isEmpty()) - restoreState(_toolbarInit); - - QSettings settings("MusE", "MusE-qt"); - //restoreGeometry(settings.value("MasterEdit/geometry").toByteArray()); - restoreState(settings.value("MasterEdit/windowState").toByteArray()); + initTopwinState(); } //--------------------------------------------------------- @@ -350,12 +350,8 @@ void MasterEdit::readConfiguration(Xml& xml) case Xml::TagStart: if (tag == "raster") _rasterInit = xml.parseInt(); - else if (tag == "width") - _widthInit = xml.parseInt(); - else if (tag == "height") - _heightInit = xml.parseInt(); - else if (tag == "toolbars") - _toolbarInit = QByteArray::fromHex(xml.parse1().toAscii()); + else if (tag == "topwin") + TopWin::readConfiguration(MASTER, xml); else xml.unknown("MasterEdit"); break; @@ -376,9 +372,7 @@ void MasterEdit::writeConfiguration(int level, Xml& xml) { xml.tag(level++, "masteredit"); xml.intTag(level, "raster", _rasterInit); - xml.intTag(level, "width", _widthInit); - xml.intTag(level, "height", _heightInit); - xml.strTag(level, "toolbars", _toolbarInit.toHex().data()); + TopWin::writeConfiguration(MASTER, level, xml); xml.tag(level, "/masteredit"); } @@ -447,34 +441,3 @@ void MasterEdit::setTempo(int val) } -//--------------------------------------------------------- -// resizeEvent -//--------------------------------------------------------- - -void MasterEdit::resizeEvent(QResizeEvent* ev) - { - QWidget::resizeEvent(ev); - storeInitialState(); - } - -//--------------------------------------------------------- -// focusOutEvent -//--------------------------------------------------------- - -void MasterEdit::focusOutEvent(QFocusEvent* ev) - { - QWidget::focusOutEvent(ev); - storeInitialState(); - } - - -//--------------------------------------------------------- -// storeInitialState -//--------------------------------------------------------- - -void MasterEdit::storeInitialState() - { - _widthInit = width(); - _heightInit = height(); - _toolbarInit=saveState(); - } diff --git a/muse2/muse/master/masteredit.h b/muse2/muse/master/masteredit.h index c4846f78..4f188813 100644 --- a/muse2/muse/master/masteredit.h +++ b/muse2/muse/master/masteredit.h @@ -79,14 +79,8 @@ class MasterEdit : public MidiEditor { QToolButton* enableButton; static int _rasterInit; - static int _widthInit, _heightInit; - static QByteArray _toolbarInit; - virtual void closeEvent(QCloseEvent*); - virtual void resizeEvent(QResizeEvent*); - virtual void focusOutEvent(QFocusEvent*); - void storeInitialState(); private slots: void _setRaster(int); @@ -99,7 +93,7 @@ class MasterEdit : public MidiEditor { // void tempoChanged(double); signals: - void deleted(unsigned long); + void deleted(TopWin*); public: MasterEdit(); diff --git a/muse2/muse/midiedit/dcanvas.cpp b/muse2/muse/midiedit/dcanvas.cpp index 11d8958e..783a72f5 100644 --- a/muse2/muse/midiedit/dcanvas.cpp +++ b/muse2/muse/midiedit/dcanvas.cpp @@ -173,8 +173,6 @@ Undo DrumCanvas::moveCanvasItems(MusEWidget::CItemList& items, int dp, int dx, D for(iPartToChange ip2c = parts2change.begin(); ip2c != parts2change.end(); ++ip2c) { Part* opart = ip2c->first; - //int diff = ip2c->second.xdiff; - if (opart->hasHiddenEvents()) { forbidden=true; diff --git a/muse2/muse/midiedit/dcanvas.h b/muse2/muse/midiedit/dcanvas.h index 0256de01..c25f71ca 100644 --- a/muse2/muse/midiedit/dcanvas.h +++ b/muse2/muse/midiedit/dcanvas.h @@ -106,7 +106,7 @@ class DrumCanvas : public EventCanvas { public: enum { - CMD_CUT, CMD_COPY, CMD_PASTE, CMD_SAVE, CMD_LOAD, CMD_RESET, + CMD_CUT, CMD_COPY, CMD_COPY_RANGE, CMD_PASTE, CMD_PASTE_DIALOG, CMD_SAVE, CMD_LOAD, CMD_RESET, CMD_SELECT_ALL, CMD_SELECT_NONE, CMD_SELECT_INVERT, CMD_SELECT_ILOOP, CMD_SELECT_OLOOP, CMD_SELECT_PREV_PART, CMD_SELECT_NEXT_PART, CMD_DEL, CMD_FIXED_LEN, CMD_RIGHT, CMD_LEFT, CMD_RIGHT_NOSNAP, CMD_LEFT_NOSNAP, CMD_MODIFY_VELOCITY, CMD_CRESCENDO, diff --git a/muse2/muse/midiedit/dlist.cpp b/muse2/muse/midiedit/dlist.cpp index 165bb4cb..8e9633c0 100644 --- a/muse2/muse/midiedit/dlist.cpp +++ b/muse2/muse/midiedit/dlist.cpp @@ -33,6 +33,7 @@ #include "pitchedit.h" #include "midiport.h" #include "drummap.h" +#include "helper.h" #include "icons.h" #include "dlist.h" #include "song.h" @@ -90,10 +91,10 @@ void DList::draw(QPainter& p, const QRect& rect) s.setNum(dm->len); break; case COL_ANOTE: - s = pitch2string(dm->anote); + s = MusEUtil::pitch2string(dm->anote); break; case COL_ENOTE: - s = pitch2string(dm->enote); + s = MusEUtil::pitch2string(dm->enote); break; case COL_LV1: s.setNum(dm->lv1); diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp index 592df7fb..8821d0d8 100644 --- a/muse2/muse/midiedit/drumedit.cpp +++ b/muse2/muse/midiedit/drumedit.cpp @@ -59,6 +59,8 @@ #include "audio.h" #include "gconfig.h" #include "functions.h" +#include "helper.h" +#include "widgets/function_dialogs/quantize.h" /* static const char* map_file_pattern[] = { @@ -76,11 +78,8 @@ static const char* map_file_save_pattern[] = { */ int DrumEdit::_rasterInit = 96; -int DrumEdit::_widthInit = 600; -int DrumEdit::_heightInit = 400; int DrumEdit::_dlistWidthInit = 50; int DrumEdit::_dcanvasWidthInit = 300; -QByteArray DrumEdit::_toolbarInit; static const int xscale = -10; static const int yscale = 1; @@ -161,7 +160,7 @@ void DrumEdit::closeEvent(QCloseEvent* e) _dlistWidthInit = *it; //There are only 2 values stored in the sizelist, size of dlist widget and dcanvas widget it++; _dcanvasWidthInit = *it; - emit deleted((unsigned long)this); + emit deleted(static_cast<TopWin*>(this)); e->accept(); } @@ -170,11 +169,11 @@ void DrumEdit::closeEvent(QCloseEvent* e) //--------------------------------------------------------- DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned initPos) - : MidiEditor(_rasterInit, pl, parent, name) + : MidiEditor(TopWin::DRUM, _rasterInit, pl, parent, name) { setFocusPolicy(Qt::StrongFocus); + split1w1 = 0; - resize(_widthInit, _heightInit); selPart = 0; QSignalMapper *signalMapper = new QSignalMapper(this); @@ -199,18 +198,24 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini menuEdit->addSeparator(); cutAction = menuEdit->addAction(QIcon(*editcutIconSet), tr("Cut")); copyAction = menuEdit->addAction(QIcon(*editcopyIconSet), tr("Copy")); + copyRangeAction = menuEdit->addAction(QIcon(*editcopyIconSet), tr("Copy events in range")); pasteAction = menuEdit->addAction(QIcon(*editpasteIconSet), tr("Paste")); + pasteDialogAction = menuEdit->addAction(QIcon(*editpasteIconSet), tr("Paste (with Dialog)")); menuEdit->addSeparator(); deleteAction = menuEdit->addAction(tr("Delete Events")); connect(cutAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(copyAction, SIGNAL(triggered()), signalMapper, SLOT(map())); + connect(copyRangeAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(pasteAction, SIGNAL(triggered()), signalMapper, SLOT(map())); + connect(pasteDialogAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(deleteAction, SIGNAL(triggered()), signalMapper, SLOT(map())); signalMapper->setMapping(cutAction, DrumCanvas::CMD_CUT); signalMapper->setMapping(copyAction, DrumCanvas::CMD_COPY); + signalMapper->setMapping(copyRangeAction, DrumCanvas::CMD_COPY_RANGE); signalMapper->setMapping(pasteAction, DrumCanvas::CMD_PASTE); + signalMapper->setMapping(pasteDialogAction, DrumCanvas::CMD_PASTE_DIALOG); signalMapper->setMapping(deleteAction, DrumCanvas::CMD_DEL); menuSelect = menuEdit->addMenu(QIcon(*selectIcon), tr("&Select")); @@ -278,6 +283,11 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini QMenu* menuScriptPlugins = menuBar()->addMenu(tr("&Plugins")); song->populateScriptMenu(menuScriptPlugins, this); + + QMenu* settingsMenu = menuBar()->addMenu(tr("Window &Config")); + settingsMenu->addAction(subwinAction); + settingsMenu->addAction(shareAction); + settingsMenu->addAction(fullscreenAction); connect(signalMapper, SIGNAL(mapped(int)), SLOT(cmd(int))); @@ -496,9 +506,6 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini connect(ctrl, SIGNAL(clicked()), SLOT(addCtrl())); - if (!_toolbarInit.isEmpty()) - restoreState(_toolbarInit); - QClipboard* cb = QApplication::clipboard(); connect(cb, SIGNAL(dataChanged()), SLOT(clipboardChanged())); @@ -521,10 +528,9 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini if(canvas->track()) toolbar->setSolo(canvas->track()->solo()); - - QSettings settings("MusE", "MusE-qt"); - //restoreGeometry(settings.value("Drumedit/geometry").toByteArray()); - restoreState(settings.value("Drumedit/windowState").toByteArray()); + + + initTopwinState(); } //--------------------------------------------------------- @@ -775,16 +781,12 @@ void DrumEdit::readConfiguration(Xml& xml) case Xml::TagStart: if (tag == "raster") _rasterInit = xml.parseInt(); - else if (tag == "width") - _widthInit = xml.parseInt(); - else if (tag == "height") - _heightInit = xml.parseInt(); else if (tag == "dcanvaswidth") _dcanvasWidthInit = xml.parseInt(); else if (tag == "dlistwidth") _dlistWidthInit = xml.parseInt(); - else if (tag == "toolbars") - _toolbarInit = QByteArray::fromHex(xml.parse1().toAscii()); + else if (tag == "topwin") + TopWin::readConfiguration(DRUM, xml); else xml.unknown("DrumEdit"); break; @@ -806,11 +808,9 @@ void DrumEdit::writeConfiguration(int level, Xml& xml) { xml.tag(level++, "drumedit"); xml.intTag(level, "raster", _rasterInit); - xml.intTag(level, "width", _widthInit); - xml.intTag(level, "height", _heightInit); xml.intTag(level, "dlistwidth", _dlistWidthInit); xml.intTag(level, "dcanvaswidth", _dcanvasWidthInit); - xml.strTag(level, "toolbars", _toolbarInit.toHex().data()); + TopWin::writeConfiguration(DRUM, level,xml); xml.tag(level, "/drumedit"); } @@ -923,9 +923,14 @@ void DrumEdit::cmd(int cmd) erase_notes(partlist_to_set(parts()), 1); break; case DrumCanvas::CMD_COPY: copy_notes(partlist_to_set(parts()), 1); break; + case DrumCanvas::CMD_COPY_RANGE: copy_notes(partlist_to_set(parts()), MusEUtil::any_event_selected(partlist_to_set(parts())) ? 3 : 2); break; case DrumCanvas::CMD_PASTE: ((DrumCanvas*)canvas)->cmd(DrumCanvas::CMD_SELECT_NONE); - paste_notes(canvas->part()); + paste_notes(3072); + break; + case DrumCanvas::CMD_PASTE_DIALOG: + ((DrumCanvas*)canvas)->cmd(DrumCanvas::CMD_SELECT_NONE); + paste_notes((canvas->part())); break; case DrumCanvas::CMD_LOAD: load(); break; case DrumCanvas::CMD_SAVE: save(); break; @@ -957,7 +962,8 @@ void DrumEdit::cmd(int cmd) void DrumEdit::clipboardChanged() { - pasteAction->setEnabled(QApplication::clipboard()->mimeData()->hasFormat(QString("text/x-muse-eventlist"))); + pasteAction->setEnabled(QApplication::clipboard()->mimeData()->hasFormat(QString("text/x-muse-groupedeventlists"))); + pasteDialogAction->setEnabled(QApplication::clipboard()->mimeData()->hasFormat(QString("text/x-muse-groupedeventlists"))); } //--------------------------------------------------------- @@ -1059,37 +1065,7 @@ void DrumEdit::newCanvasWidth(int w) updateHScrollRange(); } -//--------------------------------------------------------- -// resizeEvent -//--------------------------------------------------------- - -void DrumEdit::resizeEvent(QResizeEvent* ev) - { - QWidget::resizeEvent(ev); - storeInitialState(); //TODO: Make the dlist not expand/shrink, but the canvas instead - } - -//--------------------------------------------------------- -// focusOutEvent -//--------------------------------------------------------- - -void DrumEdit::focusOutEvent(QFocusEvent* ev) - { - QWidget::focusOutEvent(ev); - storeInitialState(); - } - -//--------------------------------------------------------- -// storeInitialState -//--------------------------------------------------------- - -void DrumEdit::storeInitialState() - { - _widthInit = width(); - _heightInit = height(); - _toolbarInit=saveState(); - } //--------------------------------------------------------- @@ -1303,7 +1279,9 @@ void DrumEdit::initShortcuts() cutAction->setShortcut(shortcuts[SHRT_CUT].key); copyAction->setShortcut(shortcuts[SHRT_COPY].key); + copyRangeAction->setShortcut(shortcuts[SHRT_COPY_RANGE].key); pasteAction->setShortcut(shortcuts[SHRT_PASTE].key); + pasteDialogAction->setShortcut(shortcuts[SHRT_PASTE_DIALOG].key); deleteAction->setShortcut(shortcuts[SHRT_DELETE].key); fixedAction->setShortcut(shortcuts[SHRT_FIXED_LEN].key); diff --git a/muse2/muse/midiedit/drumedit.h b/muse2/muse/midiedit/drumedit.h index d9812ebc..06f7e131 100644 --- a/muse2/muse/midiedit/drumedit.h +++ b/muse2/muse/midiedit/drumedit.h @@ -88,12 +88,10 @@ class DrumEdit : public MidiEditor { QComboBox *stepLenWidget; static int _rasterInit; - static int _widthInit, _heightInit; static int _dlistWidthInit, _dcanvasWidthInit; - static QByteArray _toolbarInit; QAction *loadAction, *saveAction, *resetAction; - QAction *cutAction, *copyAction, *pasteAction, *deleteAction; + QAction *cutAction, *copyAction, *copyRangeAction, *pasteAction, *pasteDialogAction, *deleteAction; QAction *fixedAction, *veloAction, *crescAction, *quantizeAction; QAction *sallAction, *snoneAction, *invAction, *inAction , *outAction; QAction *prevAction, *nextAction; @@ -105,10 +103,6 @@ class DrumEdit : public MidiEditor { QWidget* genToolbar(QWidget* parent); virtual void keyPressEvent(QKeyEvent*); - virtual void resizeEvent(QResizeEvent*); - virtual void focusOutEvent(QFocusEvent*); - void storeInitialState(); - void setHeaderToolTips(); void setHeaderWhatsThis(); @@ -139,7 +133,7 @@ class DrumEdit : public MidiEditor { virtual void updateHScrollRange(); signals: - void deleted(unsigned long); + void deleted(TopWin*); public: DrumEdit(PartList*, QWidget* parent = 0, const char* name = 0, unsigned initPos = MAXINT); diff --git a/muse2/muse/midiedit/ecanvas.cpp b/muse2/muse/midiedit/ecanvas.cpp index e15256ac..cb96118f 100644 --- a/muse2/muse/midiedit/ecanvas.cpp +++ b/muse2/muse/midiedit/ecanvas.cpp @@ -394,13 +394,13 @@ void EventCanvas::viewDropEvent(QDropEvent* event) //event->ignore(); // TODO CHECK Tim. return; } - if (event->mimeData()->hasFormat("text/x-muse-eventlist")) { - text = QString(event->mimeData()->data("text/x-muse-eventlist")); + if (event->mimeData()->hasFormat("text/x-muse-groupedeventlists")) { + text = QString(event->mimeData()->data("text/x-muse-groupedeventlists")); int x = editor->rasterVal(event->pos().x()); if (x < 0) x = 0; - paste_at(curPart, text, x); + paste_at(text,x,3072,false,false,curPart); //event->accept(); // TODO } else { diff --git a/muse2/muse/midiedit/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp index e07d95bb..178b5c46 100644 --- a/muse2/muse/midiedit/pianoroll.cpp +++ b/muse2/muse/midiedit/pianoroll.cpp @@ -60,6 +60,7 @@ #include "icons.h" #include "audio.h" #include "functions.h" +#include "helper.h" #include "cmd.h" @@ -68,10 +69,7 @@ #include "mtrackinfo.h" int PianoRoll::_rasterInit = 96; -int PianoRoll::_widthInit = 600; -int PianoRoll::_heightInit = 400; int PianoRoll::colorModeInit = 0; -QByteArray PianoRoll::_toolbarInit; static const int xscale = -10; static const int yscale = 1; @@ -84,10 +82,9 @@ static int pianorollTools = MusEWidget::PointerTool | MusEWidget::PencilTool | M //--------------------------------------------------------- PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned initPos) - : MidiEditor(_rasterInit, pl, parent, name) + : MidiEditor(TopWin::PIANO_ROLL, _rasterInit, pl, parent, name) { deltaMode = false; - resize(_widthInit, _heightInit); selPart = 0; _playEvents = false; colorMode = colorModeInit; @@ -111,10 +108,18 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i mapper->setMapping(editCopyAction, PianoCanvas::CMD_COPY); connect(editCopyAction, SIGNAL(triggered()), mapper, SLOT(map())); + editCopyRangeAction = menuEdit->addAction(QIcon(*editcopyIconSet), tr("Copy events in range")); + mapper->setMapping(editCopyRangeAction, PianoCanvas::CMD_COPY_RANGE); + connect(editCopyRangeAction, SIGNAL(triggered()), mapper, SLOT(map())); + editPasteAction = menuEdit->addAction(QIcon(*editpasteIconSet), tr("&Paste")); mapper->setMapping(editPasteAction, PianoCanvas::CMD_PASTE); connect(editPasteAction, SIGNAL(triggered()), mapper, SLOT(map())); + editPasteDialogAction = menuEdit->addAction(QIcon(*editpasteIconSet), tr("&Paste (with dialog)")); + mapper->setMapping(editPasteDialogAction, PianoCanvas::CMD_PASTE_DIALOG); + connect(editPasteDialogAction, SIGNAL(triggered()), mapper, SLOT(map())); + menuEdit->addSeparator(); editDelEventsAction = menuEdit->addAction(tr("Delete &Events")); @@ -159,36 +164,10 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i mapper->setMapping(selectNextPartAction, PianoCanvas::CMD_SELECT_NEXT_PART); connect(selectNextPartAction, SIGNAL(triggered()), mapper, SLOT(map())); - menuConfig = menuBar()->addMenu(tr("&Config")); - - eventColor = menuConfig->addMenu(tr("&Event Color")); - - QActionGroup* actgrp = new QActionGroup(this); - actgrp->setExclusive(true); - - //evColorBlueAction = eventColor->addAction(tr("&Blue")); - evColorBlueAction = actgrp->addAction(tr("&Blue")); - evColorBlueAction->setCheckable(true); - colorMapper->setMapping(evColorBlueAction, 0); - - //evColorPitchAction = eventColor->addAction(tr("&Pitch colors")); - evColorPitchAction = actgrp->addAction(tr("&Pitch colors")); - evColorPitchAction->setCheckable(true); - colorMapper->setMapping(evColorPitchAction, 1); - - //evColorVelAction = eventColor->addAction(tr("&Velocity colors")); - evColorVelAction = actgrp->addAction(tr("&Velocity colors")); - evColorVelAction->setCheckable(true); - colorMapper->setMapping(evColorVelAction, 2); - - connect(evColorBlueAction, SIGNAL(triggered()), colorMapper, SLOT(map())); - connect(evColorPitchAction, SIGNAL(triggered()), colorMapper, SLOT(map())); - connect(evColorVelAction, SIGNAL(triggered()), colorMapper, SLOT(map())); - - eventColor->addActions(actgrp->actions()); - - connect(colorMapper, SIGNAL(mapped(int)), this, SLOT(eventColorModeChanged(int))); - + + + + menuFunctions = menuBar()->addMenu(tr("Fu&nctions")); menuFunctions->setTearOffEnabled(true); @@ -239,6 +218,46 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i connect(mapper, SIGNAL(mapped(int)), this, SLOT(cmd(int))); + + + + + menuConfig = menuBar()->addMenu(tr("Window &Config")); + + eventColor = menuConfig->addMenu(tr("&Event Color")); + + QActionGroup* actgrp = new QActionGroup(this); + actgrp->setExclusive(true); + + //evColorBlueAction = eventColor->addAction(tr("&Blue")); + evColorBlueAction = actgrp->addAction(tr("&Blue")); + evColorBlueAction->setCheckable(true); + colorMapper->setMapping(evColorBlueAction, 0); + + //evColorPitchAction = eventColor->addAction(tr("&Pitch colors")); + evColorPitchAction = actgrp->addAction(tr("&Pitch colors")); + evColorPitchAction->setCheckable(true); + colorMapper->setMapping(evColorPitchAction, 1); + + //evColorVelAction = eventColor->addAction(tr("&Velocity colors")); + evColorVelAction = actgrp->addAction(tr("&Velocity colors")); + evColorVelAction->setCheckable(true); + colorMapper->setMapping(evColorVelAction, 2); + + connect(evColorBlueAction, SIGNAL(triggered()), colorMapper, SLOT(map())); + connect(evColorPitchAction, SIGNAL(triggered()), colorMapper, SLOT(map())); + connect(evColorVelAction, SIGNAL(triggered()), colorMapper, SLOT(map())); + + eventColor->addActions(actgrp->actions()); + + connect(colorMapper, SIGNAL(mapped(int)), this, SLOT(eventColorModeChanged(int))); + + menuConfig->addSeparator(); + menuConfig->addAction(subwinAction); + menuConfig->addAction(shareAction); + menuConfig->addAction(fullscreenAction); + + //---------ToolBar---------------------------------- tools = addToolBar(tr("Pianoroll tools")); tools->setObjectName("Pianoroll tools"); @@ -483,9 +502,6 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i setFocusPolicy(Qt::StrongFocus); setEventColorMode(colorMode); - if (!_toolbarInit.isEmpty()) - restoreState(_toolbarInit); - QClipboard* cb = QApplication::clipboard(); connect(cb, SIGNAL(dataChanged()), SLOT(clipboardChanged())); @@ -513,10 +529,7 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i toolbar->setSolo(canvas->track()->solo()); } - QSettings settings("MusE", "MusE-qt"); - //restoreGeometry(settings.value("Pianoroll/geometry").toByteArray()); - restoreState(settings.value("Pianoroll/windowState").toByteArray()); - + initTopwinState(); } //--------------------------------------------------------- @@ -625,9 +638,14 @@ void PianoRoll::cmd(int cmd) erase_notes(partlist_to_set(parts()), 1); break; case PianoCanvas::CMD_COPY: copy_notes(partlist_to_set(parts()), 1); break; + case PianoCanvas::CMD_COPY_RANGE: copy_notes(partlist_to_set(parts()), MusEUtil::any_event_selected(partlist_to_set(parts())) ? 3 : 2); break; case PianoCanvas::CMD_PASTE: ((PianoCanvas*)canvas)->cmd(PianoCanvas::CMD_SELECT_NONE); - paste_notes(canvas->part()); + paste_notes(3072); + break; + case PianoCanvas::CMD_PASTE_DIALOG: + ((PianoCanvas*)canvas)->cmd(PianoCanvas::CMD_SELECT_NONE); + paste_notes((canvas->part())); break; case PianoCanvas::CMD_MODIFY_GATE_TIME: modify_notelen(partlist_to_set(parts())); break; case PianoCanvas::CMD_MODIFY_VELOCITY: modify_velocity(partlist_to_set(parts())); break; @@ -803,7 +821,7 @@ void PianoRoll::closeEvent(QCloseEvent* e) //settings.setValue("Pianoroll/geometry", saveGeometry()); settings.setValue("Pianoroll/windowState", saveState()); - emit deleted((unsigned long)this); + emit deleted(static_cast<TopWin*>(this)); e->accept(); } @@ -824,12 +842,8 @@ void PianoRoll::readConfiguration(Xml& xml) _rasterInit = xml.parseInt(); else if (tag == "colormode") colorModeInit = xml.parseInt(); - else if (tag == "width") - _widthInit = xml.parseInt(); - else if (tag == "height") - _heightInit = xml.parseInt(); - else if (tag == "toolbars") - _toolbarInit = QByteArray::fromHex(xml.parse1().toAscii()); + else if (tag == "topwin") + TopWin::readConfiguration(PIANO_ROLL,xml); else xml.unknown("PianoRoll"); break; @@ -850,10 +864,8 @@ void PianoRoll::writeConfiguration(int level, Xml& xml) { xml.tag(level++, "pianoroll"); xml.intTag(level, "raster", _rasterInit); - xml.intTag(level, "width", _widthInit); - xml.intTag(level, "height", _heightInit); xml.intTag(level, "colormode", colorModeInit); - xml.strTag(level, "toolbars", _toolbarInit.toHex().data()); + TopWin::writeConfiguration(PIANO_ROLL, level, xml); xml.etag(level, "pianoroll"); } @@ -1196,7 +1208,8 @@ void PianoRoll::setEventColorMode(int mode) void PianoRoll::clipboardChanged() { - editPasteAction->setEnabled(QApplication::clipboard()->mimeData()->hasFormat(QString("text/x-muse-eventlist"))); + editPasteAction->setEnabled(QApplication::clipboard()->mimeData()->hasFormat(QString("text/x-muse-groupedeventlists"))); + editPasteDialogAction->setEnabled(QApplication::clipboard()->mimeData()->hasFormat(QString("text/x-muse-groupedeventlists"))); } //--------------------------------------------------------- @@ -1221,38 +1234,6 @@ void PianoRoll::setSpeaker(bool val) canvas->playEvents(_playEvents); } -//--------------------------------------------------------- -// resizeEvent -//--------------------------------------------------------- - -void PianoRoll::resizeEvent(QResizeEvent* ev) - { - QWidget::resizeEvent(ev); - storeInitialState(); - } - - -//--------------------------------------------------------- -// focusOutEvent -//--------------------------------------------------------- - -void PianoRoll::focusOutEvent(QFocusEvent* ev) - { - QWidget::focusOutEvent(ev); - storeInitialState(); - } - - -//--------------------------------------------------------- -// storeInitialState -//--------------------------------------------------------- - -void PianoRoll::storeInitialState() - { - _widthInit = width(); - _heightInit = height(); - _toolbarInit=saveState(); - } /* @@ -1275,7 +1256,9 @@ void PianoRoll::initShortcuts() { editCutAction->setShortcut(shortcuts[SHRT_CUT].key); editCopyAction->setShortcut(shortcuts[SHRT_COPY].key); + editCopyRangeAction->setShortcut(shortcuts[SHRT_COPY_RANGE].key); editPasteAction->setShortcut(shortcuts[SHRT_PASTE].key); + editPasteDialogAction->setShortcut(shortcuts[SHRT_PASTE_DIALOG].key); editDelEventsAction->setShortcut(shortcuts[SHRT_DELETE].key); selectAllAction->setShortcut(shortcuts[SHRT_SELECT_ALL].key); diff --git a/muse2/muse/midiedit/pianoroll.h b/muse2/muse/midiedit/pianoroll.h index 9a6eb655..1a87d407 100644 --- a/muse2/muse/midiedit/pianoroll.h +++ b/muse2/muse/midiedit/pianoroll.h @@ -27,7 +27,6 @@ #include <QResizeEvent> #include <QLabel> #include <QKeyEvent> -#include <QByteArray> #include <values.h> #include "noteinfo.h" @@ -86,7 +85,9 @@ class PianoRoll : public MidiEditor { QAction* editCutAction; QAction* editCopyAction; + QAction* editCopyRangeAction; QAction* editPasteAction; + QAction* editPasteDialogAction; QAction* editDelEventsAction; QAction* selectAllAction; @@ -135,8 +136,6 @@ class PianoRoll : public MidiEditor { int colorMode; static int _rasterInit; - static int _widthInit, _heightInit; - static QByteArray _toolbarInit; static int colorModeInit; @@ -151,9 +150,6 @@ class PianoRoll : public MidiEditor { QWidget* genToolbar(QWidget* parent); virtual void closeEvent(QCloseEvent*); virtual void keyPressEvent(QKeyEvent*); - virtual void resizeEvent(QResizeEvent*); - virtual void focusOutEvent(QFocusEvent*); - void storeInitialState(); private slots: void setSelection(int, Event&, Part*); @@ -178,7 +174,7 @@ class PianoRoll : public MidiEditor { void updateTrackInfo(); signals: - void deleted(unsigned long); + void deleted(TopWin*); public slots: virtual void updateHScrollRange(); diff --git a/muse2/muse/midiedit/prcanvas.cpp b/muse2/muse/midiedit/prcanvas.cpp index 55d51ad0..b96cb47f 100644 --- a/muse2/muse/midiedit/prcanvas.cpp +++ b/muse2/muse/midiedit/prcanvas.cpp @@ -384,8 +384,6 @@ Undo PianoCanvas::moveCanvasItems(MusEWidget::CItemList& items, int dp, int dx, for(iPartToChange ip2c = parts2change.begin(); ip2c != parts2change.end(); ++ip2c) { Part* opart = ip2c->first; - //int diff = ip2c->second.xdiff; - if (opart->hasHiddenEvents()) { forbidden=true; diff --git a/muse2/muse/midiedit/prcanvas.h b/muse2/muse/midiedit/prcanvas.h index d239994e..a44a9a4a 100644 --- a/muse2/muse/midiedit/prcanvas.h +++ b/muse2/muse/midiedit/prcanvas.h @@ -105,7 +105,7 @@ class PianoCanvas : public EventCanvas { public: enum { - CMD_CUT, CMD_COPY, CMD_PASTE, CMD_DEL, + CMD_CUT, CMD_COPY, CMD_COPY_RANGE, CMD_PASTE, CMD_PASTE_DIALOG, CMD_DEL, CMD_QUANTIZE, CMD_SELECT_ALL, CMD_SELECT_NONE, CMD_SELECT_INVERT, CMD_SELECT_ILOOP, CMD_SELECT_OLOOP, CMD_SELECT_PREV_PART, CMD_SELECT_NEXT_PART, diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index 8847c105..ad55b33f 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -45,6 +45,7 @@ #include <QImage> #include <QInputDialog> #include <QMessageBox> +#include <QSpinBox> #include <stdio.h> #include <math.h> @@ -74,6 +75,9 @@ using namespace std; //#include "../ctrl/ctrledit.h" +using MusEGlobal::debugMsg; +using MusEGlobal::heavyDebugMsg; + string IntToStr(int i); QString IntToQStr(int i); @@ -161,9 +165,6 @@ QColor* mycolors; // array [NUM_MYCOLORS] set<QString> ScoreEdit::names; -int ScoreEdit::width_init = 600; -int ScoreEdit::height_init = 400; -QByteArray ScoreEdit::default_toolbar_state; //--------------------------------------------------------- @@ -171,13 +172,11 @@ QByteArray ScoreEdit::default_toolbar_state; //--------------------------------------------------------- ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) - : TopWin(parent, name) + : TopWin(TopWin::SCORE, parent, name) { setAttribute(Qt::WA_DeleteOnClose); setFocusPolicy(Qt::StrongFocus); - resize(width_init, height_init); - mainw = new QWidget(this); mainGrid = new QGridLayout(); @@ -367,10 +366,18 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) menu_mapper->setMapping(copy_action, CMD_COPY); connect(copy_action, SIGNAL(triggered()), menu_mapper, SLOT(map())); + copy_range_action = edit_menu->addAction(QIcon(*editcopyIconSet), tr("Copy events in range")); + menu_mapper->setMapping(copy_range_action, CMD_COPY_RANGE); + connect(copy_range_action, SIGNAL(triggered()), menu_mapper, SLOT(map())); + paste_action = edit_menu->addAction(QIcon(*editpasteIconSet), tr("&Paste")); menu_mapper->setMapping(paste_action, CMD_PASTE); connect(paste_action, SIGNAL(triggered()), menu_mapper, SLOT(map())); + paste_dialog_action = edit_menu->addAction(QIcon(*editpasteIconSet), tr("Paste (with dialog)")); + menu_mapper->setMapping(paste_dialog_action, CMD_PASTE_DIALOG); + connect(paste_dialog_action, SIGNAL(triggered()), menu_mapper, SLOT(map())); + edit_menu->addSeparator(); del_action = edit_menu->addAction(tr("Delete &Events")); @@ -404,7 +411,31 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) connect(select_oloop_action, SIGNAL(triggered()), menu_mapper, SLOT(map())); - QMenu* settings_menu = menuBar()->addMenu(tr("&Settings")); + QMenu* functions_menu = menuBar()->addMenu(tr("Fu&nctions")); + + func_quantize_action = functions_menu->addAction(tr("&Quantize"), menu_mapper, SLOT(map())); + func_notelen_action = functions_menu->addAction(tr("Change note &length"), menu_mapper, SLOT(map())); + func_velocity_action = functions_menu->addAction(tr("Change note &velocity"), menu_mapper, SLOT(map())); + func_cresc_action = functions_menu->addAction(tr("Crescendo/Decrescendo"), menu_mapper, SLOT(map())); + func_transpose_action = functions_menu->addAction(tr("Transpose"), menu_mapper, SLOT(map())); + func_erase_action = functions_menu->addAction(tr("Erase Events"), menu_mapper, SLOT(map())); + func_move_action = functions_menu->addAction(tr("Move Notes"), menu_mapper, SLOT(map())); + func_fixed_len_action = functions_menu->addAction(tr("Set Fixed Length"), menu_mapper, SLOT(map())); + func_del_overlaps_action = functions_menu->addAction(tr("Delete Overlaps"), menu_mapper, SLOT(map())); + func_legato_action = functions_menu->addAction(tr("Legato"), menu_mapper, SLOT(map())); + menu_mapper->setMapping(func_quantize_action, CMD_QUANTIZE); + menu_mapper->setMapping(func_notelen_action, CMD_NOTELEN); + menu_mapper->setMapping(func_velocity_action, CMD_VELOCITY); + menu_mapper->setMapping(func_cresc_action, CMD_CRESCENDO); + menu_mapper->setMapping(func_transpose_action, CMD_TRANSPOSE); + menu_mapper->setMapping(func_erase_action, CMD_ERASE); + menu_mapper->setMapping(func_move_action, CMD_MOVE); + menu_mapper->setMapping(func_fixed_len_action, CMD_FIXED_LEN); + menu_mapper->setMapping(func_del_overlaps_action, CMD_DELETE_OVERLAPS); + menu_mapper->setMapping(func_legato_action, CMD_LEGATO); + + + QMenu* settings_menu = menuBar()->addMenu(tr("Window &Config")); color_menu = settings_menu->addMenu(tr("Note head &colors")); color_actions = new QActionGroup(this); @@ -423,7 +454,7 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) color_black_action->setChecked(true); menu_command(CMD_COLOR_BLACK); - + QMenu* preamble_menu = settings_menu->addMenu(tr("Set up &preamble")); preamble_keysig_action = preamble_menu->addAction(tr("Display &key signature")); preamble_timesig_action = preamble_menu->addAction(tr("Display &time signature")); @@ -438,31 +469,13 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) QAction* set_name_action = settings_menu->addAction(tr("Set Score &name"), menu_mapper, SLOT(map())); menu_mapper->setMapping(set_name_action, CMD_SET_NAME); + + settings_menu->addSeparator(); + settings_menu->addAction(subwinAction); + settings_menu->addAction(shareAction); + settings_menu->addAction(fullscreenAction); - QMenu* functions_menu = menuBar()->addMenu(tr("Fu&nctions")); - - func_quantize_action = functions_menu->addAction(tr("&Quantize"), menu_mapper, SLOT(map())); - func_notelen_action = functions_menu->addAction(tr("Change note &length"), menu_mapper, SLOT(map())); - func_velocity_action = functions_menu->addAction(tr("Change note &velocity"), menu_mapper, SLOT(map())); - func_cresc_action = functions_menu->addAction(tr("Crescendo/Decrescendo"), menu_mapper, SLOT(map())); - func_transpose_action = functions_menu->addAction(tr("Transpose"), menu_mapper, SLOT(map())); - func_erase_action = functions_menu->addAction(tr("Erase Events"), menu_mapper, SLOT(map())); - func_move_action = functions_menu->addAction(tr("Move Notes"), menu_mapper, SLOT(map())); - func_fixed_len_action = functions_menu->addAction(tr("Set Fixed Length"), menu_mapper, SLOT(map())); - func_del_overlaps_action = functions_menu->addAction(tr("Delete Overlaps"), menu_mapper, SLOT(map())); - func_legato_action = functions_menu->addAction(tr("Legato"), menu_mapper, SLOT(map())); - menu_mapper->setMapping(func_quantize_action, CMD_QUANTIZE); - menu_mapper->setMapping(func_notelen_action, CMD_NOTELEN); - menu_mapper->setMapping(func_velocity_action, CMD_VELOCITY); - menu_mapper->setMapping(func_cresc_action, CMD_CRESCENDO); - menu_mapper->setMapping(func_transpose_action, CMD_TRANSPOSE); - menu_mapper->setMapping(func_erase_action, CMD_ERASE); - menu_mapper->setMapping(func_move_action, CMD_MOVE); - menu_mapper->setMapping(func_fixed_len_action, CMD_FIXED_LEN); - menu_mapper->setMapping(func_del_overlaps_action, CMD_DELETE_OVERLAPS); - menu_mapper->setMapping(func_legato_action, CMD_LEGATO); - init_shortcuts(); connect(MusEGlobal::muse, SIGNAL(configChanged()), SLOT(init_shortcuts())); @@ -473,10 +486,8 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) clipboard_changed(); selection_changed(); - if (!default_toolbar_state.isEmpty()) - restoreState(default_toolbar_state); - connect(song, SIGNAL(songChanged(int)), SLOT(song_changed(int))); + connect(song, SIGNAL(newPartsCreated(const std::map< Part*, std::set<Part*> >&)), score_canvas, SLOT(add_new_parts(const std::map< Part*, std::set<Part*> >&))); score_canvas->fully_recalculate(); score_canvas->goto_tick(initPos,true); @@ -488,13 +499,17 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) apply_velo=true; + + initTopwinState(); } void ScoreEdit::init_shortcuts() { cut_action->setShortcut(shortcuts[SHRT_CUT].key); copy_action->setShortcut(shortcuts[SHRT_COPY].key); + copy_range_action->setShortcut(shortcuts[SHRT_COPY_RANGE].key); paste_action->setShortcut(shortcuts[SHRT_PASTE].key); + paste_dialog_action->setShortcut(shortcuts[SHRT_PASTE_DIALOG].key); del_action->setShortcut(shortcuts[SHRT_DELETE].key); select_all_action->setShortcut(shortcuts[SHRT_SELECT_ALL].key); @@ -656,30 +671,10 @@ void ScoreEdit::closeEvent(QCloseEvent* e) //settings.setValue("ScoreEdit/geometry", saveGeometry()); settings.setValue("ScoreEdit/windowState", saveState()); - emit deleted((unsigned long)this); + emit deleted(static_cast<TopWin*>(this)); e->accept(); } -void ScoreEdit::resizeEvent(QResizeEvent* ev) -{ - QWidget::resizeEvent(ev); - - store_initial_state(); -} - -void ScoreEdit::focusOutEvent(QFocusEvent* ev) -{ - QMainWindow::focusOutEvent(ev); - - store_initial_state(); -} - -void ScoreEdit::store_initial_state() -{ - width_init=width(); - height_init=height(); - default_toolbar_state=saveState(); -} void ScoreEdit::menu_command(int cmd) { @@ -710,8 +705,13 @@ void ScoreEdit::menu_command(int cmd) erase_notes(score_canvas->get_all_parts(), 1); break; case CMD_COPY: copy_notes(score_canvas->get_all_parts(), 1); break; + case CMD_COPY_RANGE: copy_notes(score_canvas->get_all_parts(), MusEUtil::any_event_selected(score_canvas->get_all_parts()) ? 3 : 2); break; case CMD_PASTE: menu_command(CMD_SELECT_NONE); + paste_notes(3072); + break; + case CMD_PASTE_DIALOG: + menu_command(CMD_SELECT_NONE); paste_notes(score_canvas->get_selected_part()); break; case CMD_QUANTIZE: quantize_notes(score_canvas->get_all_parts()); break; @@ -733,7 +733,8 @@ void ScoreEdit::menu_command(int cmd) void ScoreEdit::clipboard_changed() { - paste_action->setEnabled(QApplication::clipboard()->mimeData()->hasFormat(QString("text/x-muse-eventlist"))); + paste_action->setEnabled(QApplication::clipboard()->mimeData()->hasFormat(QString("text/x-muse-groupedeventlists"))); + paste_dialog_action->setEnabled(QApplication::clipboard()->mimeData()->hasFormat(QString("text/x-muse-groupedeventlists"))); } void ScoreEdit::selection_changed() @@ -770,11 +771,11 @@ Part* read_part(Xml& xml, QString tag_name="part") else { sscanf(tag.toLatin1().constData(), "%d:%d", &trackIdx, &partIdx); - if (MusEGlobal::debugMsg) cout << "read_part: trackIdx="<<trackIdx<<", partIdx="<<partIdx; + if (debugMsg) cout << "read_part: trackIdx="<<trackIdx<<", partIdx="<<partIdx; Track* track = song->tracks()->index(trackIdx); if (track) part = track->parts()->find(partIdx); - if (MusEGlobal::debugMsg) cout << ", track="<<track<<", part="<<part<<endl; + if (debugMsg) cout << ", track="<<track<<", part="<<part<<endl; } } break; @@ -1050,12 +1051,8 @@ void ScoreEdit::read_configuration(Xml& xml) switch (token) { case Xml::TagStart: - if (tag == "height") - height_init = xml.parseInt(); - else if (tag == "width") - width_init = xml.parseInt(); - else if (tag == "toolbars") - default_toolbar_state = QByteArray::fromHex(xml.parse1().toAscii()); + if (tag == "topwin") + TopWin::readConfiguration(SCORE, xml); else xml.unknown("ScoreEdit"); break; @@ -1074,9 +1071,7 @@ void ScoreEdit::read_configuration(Xml& xml) void ScoreEdit::write_configuration(int level, Xml& xml) { xml.tag(level++, "scoreedit"); - xml.intTag(level, "width", width_init); - xml.intTag(level, "height", height_init); - xml.strTag(level, "toolbars", default_toolbar_state.toHex().data()); + TopWin::writeConfiguration(SCORE, level, xml); xml.etag(level, "scoreedit"); } @@ -1558,7 +1553,7 @@ void ScoreCanvas::init_pixmaps() { if (!pixmaps_initalized) { - if (MusEGlobal::debugMsg) cout << "initalizing colors..." << endl; + if (debugMsg) cout << "initalizing colors..." << endl; mycolors=new QColor[NUM_MYCOLORS]; @@ -1575,7 +1570,7 @@ void ScoreCanvas::init_pixmaps() mycolors[i+VELO_PIXMAP_BEGIN]=QColor(0xff,0,(127-i)*4); - if (MusEGlobal::debugMsg) cout << "loading pixmaps..." << endl; + if (debugMsg) cout << "loading pixmaps..." << endl; pix_whole=new QPixmap[NUM_MYCOLORS]; pix_half=new QPixmap[NUM_MYCOLORS]; @@ -1633,7 +1628,7 @@ void ScoreCanvas::init_pixmaps() pixmaps_initalized=true; - if (MusEGlobal::debugMsg) cout << "done" << endl; + if (debugMsg) cout << "done" << endl; } } @@ -1715,11 +1710,11 @@ void staff_t::create_appropriate_eventlist() end=flo_quantize(event.endTick()+part->tick(), parent->quant_ticks()); if (end==begin) { - if (MusEGlobal::heavyDebugMsg) cout << "note len would be quantized to zero. using minimal possible length" << endl; + if (heavyDebugMsg) cout << "note len would be quantized to zero. using minimal possible length" << endl; end=begin+parent->quant_ticks(); } - if (MusEGlobal::heavyDebugMsg) cout << "inserting note on at "<<begin<<" with pitch="<<event.pitch()<<" and len="<<end-begin<<endl; + if (heavyDebugMsg) cout << "inserting note on at "<<begin<<" with pitch="<<event.pitch()<<" and len="<<end-begin<<endl; eventlist.insert(pair<unsigned, FloEvent>(begin, FloEvent(begin,event.pitch(), event.velo(),end-begin,FloEvent::NOTE_ON,part,&it->second))); } //else ignore it @@ -1736,7 +1731,7 @@ void staff_t::create_appropriate_eventlist() if (to > unsigned(SONG_LENGTH)) to=SONG_LENGTH; - if (MusEGlobal::heavyDebugMsg) cout << "new signature from tick "<<from<<" to " << to << ": "<<it->second->sig.z<<"/"<<it->second->sig.n<<"; ticks per measure = "<<ticks_per_measure<<endl; + if (heavyDebugMsg) cout << "new signature from tick "<<from<<" to " << to << ": "<<it->second->sig.z<<"/"<<it->second->sig.n<<"; ticks per measure = "<<ticks_per_measure<<endl; eventlist.insert(pair<unsigned, FloEvent>(from, FloEvent(from, FloEvent::TIME_SIG, it->second->sig.z, it->second->sig.n) ) ); for (unsigned t=from; t<to; t+=ticks_per_measure) eventlist.insert(pair<unsigned, FloEvent>(t, FloEvent(t,0,0,ticks_per_measure,FloEvent::BAR) ) ); @@ -1913,7 +1908,7 @@ int calc_measure_len(const list<int>& nums, int denom) vector<int> create_emphasize_list(const list<int>& nums, int denom) { - if (MusEGlobal::heavyDebugMsg) + if (heavyDebugMsg) { cout << "creating emphasize list for "; for (list<int>::const_iterator it=nums.begin(); it!=nums.end(); it++) @@ -1941,7 +1936,7 @@ vector<int> create_emphasize_list(const list<int>& nums, int denom) result[0]=0; - if (MusEGlobal::heavyDebugMsg) + if (heavyDebugMsg) { for (int i=0;i<len;i++) { @@ -2023,7 +2018,7 @@ list<note_len_t> parse_note_len(int len_ticks, int begin_tick, vector<int>& foo, len_now=len_now*TICKS_PER_WHOLE/64; - if (MusEGlobal::heavyDebugMsg) cout << "add " << len_now << " ticks" << endl; + if (heavyDebugMsg) cout << "add " << len_now << " ticks" << endl; if (allow_dots) { for (int i=0;i<=MAX_QUANT_POWER;i++) @@ -2166,7 +2161,7 @@ void staff_t::create_itemlist() note_pos_t notepos=note_pos(pitch,tmp_key,clef); - if (MusEGlobal::heavyDebugMsg) + if (heavyDebugMsg) { printf("FLO: t=%i\ttype=%i\tpitch=%i\tvel=%i\tlen=%i\n",it->first, it->second.type, it->second.pitch, it->second.vel, it->second.len); cout << "\tline="<<notepos.height<<"\tvorzeichen="<<notepos.vorzeichen << endl; @@ -2179,7 +2174,7 @@ void staff_t::create_itemlist() if (lastevent==last_measure) //there was no note? { unsigned tmppos=(last_measure+t-parent->quant_ticks())/2; - if (MusEGlobal::heavyDebugMsg) cout << "\tend-of-measure: this was an empty measure. inserting rest in between at t="<<tmppos << endl; + if (heavyDebugMsg) cout << "\tend-of-measure: this was an empty measure. inserting rest in between at t="<<tmppos << endl; itemlist[tmppos].insert( FloItem(FloItem::REST,notepos,0,0) ); itemlist[t].insert( FloItem(FloItem::REST_END,notepos,0,0) ); } @@ -2189,13 +2184,13 @@ void staff_t::create_itemlist() int rest=t-lastevent; if (rest) { - if (MusEGlobal::heavyDebugMsg) printf("\tend-of-measure: set rest at %i with len %i\n",lastevent,rest); + if (heavyDebugMsg) printf("\tend-of-measure: set rest at %i with len %i\n",lastevent,rest); list<note_len_t> lens=parse_note_len(rest,lastevent-last_measure,emphasize_list,DOTTED_RESTS,UNSPLIT_RESTS); unsigned tmppos=lastevent; for (list<note_len_t>::iterator x=lens.begin(); x!=lens.end(); x++) { - if (MusEGlobal::heavyDebugMsg) cout << "\t\tpartial rest with len="<<x->len<<", dots="<<x->dots<<endl; + if (heavyDebugMsg) cout << "\t\tpartial rest with len="<<x->len<<", dots="<<x->dots<<endl; itemlist[tmppos].insert( FloItem(FloItem::REST,notepos,x->len,x->dots) ); tmppos+=calc_len(x->len,x->dots); itemlist[tmppos].insert( FloItem(FloItem::REST_END,notepos,0,0) ); @@ -2215,7 +2210,7 @@ void staff_t::create_itemlist() int rest=t-lastevent; if (rest) { - if (MusEGlobal::heavyDebugMsg) printf("\tset rest at %i with len %i\n",lastevent,rest); + if (heavyDebugMsg) printf("\tset rest at %i with len %i\n",lastevent,rest); // no need to check if the rest crosses measure boundaries; // it can't. @@ -2223,7 +2218,7 @@ void staff_t::create_itemlist() unsigned tmppos=lastevent; for (list<note_len_t>::iterator x=lens.begin(); x!=lens.end(); x++) { - if (MusEGlobal::heavyDebugMsg) cout << "\t\tpartial rest with len="<<x->len<<", dots="<<x->dots<<endl; + if (heavyDebugMsg) cout << "\t\tpartial rest with len="<<x->len<<", dots="<<x->dots<<endl; itemlist[tmppos].insert( FloItem(FloItem::REST,notepos,x->len,x->dots) ); tmppos+=calc_len(x->len,x->dots); itemlist[tmppos].insert( FloItem(FloItem::REST_END,notepos,0,0) ); @@ -2232,7 +2227,7 @@ void staff_t::create_itemlist() - if (MusEGlobal::heavyDebugMsg) printf("\tset note at %i with len=%i\n", t, len); + if (heavyDebugMsg) printf("\tset note at %i with len=%i\n", t, len); int tmplen; bool tied_note; @@ -2249,14 +2244,14 @@ void staff_t::create_itemlist() eventlist.insert(pair<unsigned, FloEvent>(next_measure, FloEvent(actual_tick,pitch, velo,0,FloEvent::NOTE_OFF, it->second.source_part, it->second.source_event))); eventlist.insert(pair<unsigned, FloEvent>(next_measure, FloEvent(actual_tick,pitch, velo,newlen,FloEvent::NOTE_ON, it->second.source_part, it->second.source_event))); - if (MusEGlobal::heavyDebugMsg) cout << "\t\tnote was split to length "<<tmplen<<" + " << newlen<<endl; + if (heavyDebugMsg) cout << "\t\tnote was split to length "<<tmplen<<" + " << newlen<<endl; } else { tmplen=len; tied_note=false; - if (MusEGlobal::heavyDebugMsg) cout << "\t\tinserting NOTE OFF at "<<t+len<<endl; + if (heavyDebugMsg) cout << "\t\tinserting NOTE OFF at "<<t+len<<endl; eventlist.insert(pair<unsigned, FloEvent>(t+len, FloEvent(t+len,pitch, velo,0,FloEvent::NOTE_OFF,it->second.source_part, it->second.source_event))); } @@ -2266,7 +2261,7 @@ void staff_t::create_itemlist() int count=0; for (list<note_len_t>::iterator x=lens.begin(); x!=lens.end(); x++) { - if (MusEGlobal::heavyDebugMsg) cout << "\t\tpartial note with len="<<x->len<<", dots="<<x->dots<<endl; + if (heavyDebugMsg) cout << "\t\tpartial note with len="<<x->len<<", dots="<<x->dots<<endl; count++; bool tie; @@ -2287,14 +2282,14 @@ void staff_t::create_itemlist() } else if (type==FloEvent::TIME_SIG) { - if (MusEGlobal::heavyDebugMsg) cout << "inserting TIME SIGNATURE "<<it->second.num<<"/"<<it->second.denom<<" at "<<t<<endl; + if (heavyDebugMsg) cout << "inserting TIME SIGNATURE "<<it->second.num<<"/"<<it->second.denom<<" at "<<t<<endl; itemlist[t].insert( FloItem(FloItem::TIME_SIG, it->second.num, it->second.denom) ); emphasize_list=create_emphasize_list(it->second.num, it->second.denom); } else if (type==FloEvent::KEY_CHANGE) { - if (MusEGlobal::heavyDebugMsg) cout << "inserting KEY CHANGE ("<<it->second.key<<") at "<<t<<endl; + if (heavyDebugMsg) cout << "inserting KEY CHANGE ("<<it->second.key<<") at "<<t<<endl; itemlist[t].insert( FloItem(FloItem::KEY_CHANGE, it->second.key) ); tmp_key=it->second.key; } @@ -2312,7 +2307,7 @@ void staff_t::process_itemlist() { set<FloItem, floComp>& curr_items=it2->second; - if (MusEGlobal::heavyDebugMsg) cout << "at t="<<it2->first<<endl; + if (heavyDebugMsg) cout << "at t="<<it2->first<<endl; // phase 0: keep track of active notes, rests ------------------- // (and occupied lines) and the last measure @@ -2329,7 +2324,7 @@ void staff_t::process_itemlist() emphasize_list=create_emphasize_list(it->num, it->denom); } - if (MusEGlobal::heavyDebugMsg) + if (heavyDebugMsg) { cout << "occupied: "; for (map<int,int>::iterator i=occupied.begin(); i!=occupied.end(); i++) @@ -2355,7 +2350,7 @@ void staff_t::process_itemlist() //(can be seen on already_grouped) if ((it->type==FloItem::REST) && (it->already_grouped==false)) { - if (MusEGlobal::heavyDebugMsg) cout << "trying to group" << endl; + if (heavyDebugMsg) cout << "trying to group" << endl; int lastheight; int height_cumulative=0; @@ -2366,12 +2361,12 @@ void staff_t::process_itemlist() set<FloItem, floComp>::iterator tmp; for (tmp=it; tmp!=curr_items.end();) { - if (MusEGlobal::heavyDebugMsg) cout << "checking if we can proceed with an item at height="<<tmp->pos.height<<endl; + if (heavyDebugMsg) cout << "checking if we can proceed with an item at height="<<tmp->pos.height<<endl; for (int i=lastheight+1; i<=tmp->pos.height-1; i++) if (occupied[i]!=0) { - if (MusEGlobal::heavyDebugMsg) cout << "we can NOT, because occ["<<i<<"] != 0" << endl; + if (heavyDebugMsg) cout << "we can NOT, because occ["<<i<<"] != 0" << endl; //stop grouping that rest goto get_out_here; } @@ -2383,7 +2378,7 @@ void staff_t::process_itemlist() { // füge diese pause zur gruppe dazu und entferne sie von diesem set hier // entfernen aber nur, wenn sie nicht it, also die erste pause ist, die brauchen wir noch! - if (MusEGlobal::heavyDebugMsg) cout << "\tgrouping rest at height="<<tmp->pos.height<<endl; + if (heavyDebugMsg) cout << "\tgrouping rest at height="<<tmp->pos.height<<endl; height_cumulative+=tmp->pos.height; counter++; if (tmp!=it) @@ -2393,12 +2388,12 @@ void staff_t::process_itemlist() } else //it's something else? well, we can stop grouping that rest then { - if (MusEGlobal::heavyDebugMsg) cout << "we can NOT, because that item is not a rest" << endl; + if (heavyDebugMsg) cout << "we can NOT, because that item is not a rest" << endl; //stop grouping that rest goto get_out_here; } } - if (MusEGlobal::heavyDebugMsg) cout << "no items to proceed on left, continuing" << endl; + if (heavyDebugMsg) cout << "no items to proceed on left, continuing" << endl; get_out_here: n_groups++; @@ -2413,7 +2408,7 @@ void staff_t::process_itemlist() // have we grouped all available rests into one single? if ( (n_groups==1) && (tmp==curr_items.end()) && !dont_group) { - if (MusEGlobal::heavyDebugMsg) cout << "wow, we were able to group all rests into one single" << endl; + if (heavyDebugMsg) cout << "wow, we were able to group all rests into one single" << endl; if (temp.len==0) //the whole rest is shifted one line (one space and one line) temp.pos.height=DEFAULT_REST_HEIGHT+2; else @@ -2421,7 +2416,7 @@ void staff_t::process_itemlist() } else { - if (MusEGlobal::heavyDebugMsg) cout << "creating group #"<<n_groups<<endl; + if (heavyDebugMsg) cout << "creating group #"<<n_groups<<endl; temp.pos.height=nearbyint((float)height_cumulative/counter); } @@ -2432,7 +2427,7 @@ void staff_t::process_itemlist() // the item. effect: you don't have the rest at all curr_items.erase(it++); - if (MusEGlobal::heavyDebugMsg) cout << "replacing all grouped rests with a rest at height="<<temp.pos.height<<endl; + if (heavyDebugMsg) cout << "replacing all grouped rests with a rest at height="<<temp.pos.height<<endl; curr_items.insert(temp); } @@ -2523,7 +2518,7 @@ group_them_again: if (it->type==FloItem::NOTE) lengths[it->len].add(it->pos.height); - if (MusEGlobal::heavyDebugMsg) + if (heavyDebugMsg) { cout << "note lengths at that time are:"; for (map<int, cumulative_t>::iterator it=lengths.begin(); it!=lengths.end(); it++) @@ -2536,14 +2531,14 @@ group_them_again: if (lengths.size()==0) { - if (MusEGlobal::heavyDebugMsg) cout << "no notes other than wholes, or no notes at all. we can relax" << endl; + if (heavyDebugMsg) cout << "no notes other than wholes, or no notes at all. we can relax" << endl; } else if (lengths.size()==1) { pair<const int, cumulative_t>& group=*(lengths.begin()); stem_t stem; int shift=0; - if (MusEGlobal::heavyDebugMsg) cout << "only one non-whole note group (len="<<group.first<<") at height="<<group.second.mean()<< endl; + if (heavyDebugMsg) cout << "only one non-whole note group (len="<<group.first<<") at height="<<group.second.mean()<< endl; if (group.second.mean()>=6) { @@ -2574,7 +2569,7 @@ group_them_again: pair<const int, cumulative_t>& group2=*it; stem_t stem1, stem2; int shift1=0, shift2=0; - if (MusEGlobal::heavyDebugMsg) cout << "two non-whole note group: len="<<group1.first<<" at height="<<group1.second.mean()<<" and len="<<group2.first<<" at height="<<group2.second.mean()<< endl; + if (heavyDebugMsg) cout << "two non-whole note group: len="<<group1.first<<" at height="<<group1.second.mean()<<" and len="<<group2.first<<" at height="<<group2.second.mean()<< endl; if (group1.second.mean()<group2.second.mean()) { @@ -2632,17 +2627,17 @@ group_them_again: group1_len_ticks=calc_len(group1_len,0); group2_len_ticks=calc_len(group2_len,0); - if (MusEGlobal::heavyDebugMsg) cout << "we have "<<lengths.size()<<" groups. putting the "<<group1_n<<" longest and the "<<group2_n<<"shortest groups together"<<endl << + if (heavyDebugMsg) cout << "we have "<<lengths.size()<<" groups. putting the "<<group1_n<<" longest and the "<<group2_n<<"shortest groups together"<<endl << "\tgroup1 will have len="<<group1_len<<" ("<<group1_len_ticks<<" ticks), group2 will have len="<<group2_len<<" ("<<group2_len_ticks<<" ticks)"<<endl; for (set<FloItem, floComp>::iterator it=curr_items.begin(); it!=curr_items.end();) if (it->type==FloItem::NOTE) { //if *it belongs to group1 and has not already its destination length - if (MusEGlobal::heavyDebugMsg) cout << "\tprocessing note-item with len="<<it->len<<endl; + if (heavyDebugMsg) cout << "\tprocessing note-item with len="<<it->len<<endl; if (it->len<group1_len) { - if (MusEGlobal::heavyDebugMsg) cout << "\t\thas to be changed to fit into group 1" << endl; + if (heavyDebugMsg) cout << "\t\thas to be changed to fit into group 1" << endl; FloItem tmp=*it; curr_items.erase(it++); @@ -2667,7 +2662,7 @@ group_them_again: int count=0; for (list<note_len_t>::iterator x=lens.begin(); x!=lens.end(); x++) { - if (MusEGlobal::heavyDebugMsg) cout << "\t\twhile regrouping: partial note with len="<<x->len<<", dots="<<x->dots<<endl; + if (heavyDebugMsg) cout << "\t\twhile regrouping: partial note with len="<<x->len<<", dots="<<x->dots<<endl; count++; bool tie; @@ -2686,7 +2681,7 @@ group_them_again: //else if *it belongs to group2 and has not already its destination length else if ((it->len<group2_len) && (it->len>group1_len)) { - if (MusEGlobal::heavyDebugMsg) cout << "\t\thas to be changed to fit into group 2" << endl; + if (heavyDebugMsg) cout << "\t\thas to be changed to fit into group 2" << endl; FloItem tmp=*it; curr_items.erase(it++); @@ -2712,7 +2707,7 @@ group_them_again: int count=0; for (list<note_len_t>::iterator x=lens.begin(); x!=lens.end(); x++) { - if (MusEGlobal::heavyDebugMsg) cout << "\t\twhile regrouping: partial note with len="<<x->len<<", dots="<<x->dots<<endl; + if (heavyDebugMsg) cout << "\t\twhile regrouping: partial note with len="<<x->len<<", dots="<<x->dots<<endl; count++; bool tie; @@ -2730,7 +2725,7 @@ group_them_again: } else //nothing to do? { - if (MusEGlobal::heavyDebugMsg) cout << "\t\tnothing to do" << endl; + if (heavyDebugMsg) cout << "\t\tnothing to do" << endl; it++; } } @@ -2746,7 +2741,7 @@ group_them_again: //draw a pixmap centered void ScoreCanvas::draw_pixmap(QPainter& p, int x, int y, const QPixmap& pm) { - if (MusEGlobal::heavyDebugMsg) cout << "drawing pixmap with size="<<pm.width()<<"/"<<pm.height()<<" at "<<x<<"/"<<y<<endl; + if (heavyDebugMsg) cout << "drawing pixmap with size="<<pm.width()<<"/"<<pm.height()<<" at "<<x<<"/"<<y<<endl; p.drawPixmap(x-pm.width()/2,y-pm.height()/2,pm); } @@ -2963,7 +2958,7 @@ void ScoreCanvas::draw_items(QPainter& p, int y_offset, staff_t& staff, ScoreIte for (ScoreItemList::iterator it2=from_it; it2!=to_it; it2++) { - if (MusEGlobal::heavyDebugMsg) cout << "at t="<<it2->first << endl; + if (heavyDebugMsg) cout << "at t="<<it2->first << endl; int upstem_y1 = -1, upstem_y2=-1, upstem_x=-1, upflag=-1; int downstem_y1 = -1, downstem_y2=-1, downstem_x=-1, downflag=-1; @@ -2972,7 +2967,7 @@ void ScoreCanvas::draw_items(QPainter& p, int y_offset, staff_t& staff, ScoreIte { if (it->type==FloItem::NOTE) { - if (MusEGlobal::heavyDebugMsg) + if (heavyDebugMsg) { cout << "\tNOTE at line"<<it->pos.height<<" with acc.="<<it->pos.vorzeichen<<", len="<<pow(2,it->len); for (int i=0;i<it->dots;i++) cout << "."; @@ -3106,7 +3101,7 @@ void ScoreCanvas::draw_items(QPainter& p, int y_offset, staff_t& staff, ScoreIte //if needed, draw tie if (it->is_tie_dest) { - if (MusEGlobal::heavyDebugMsg) cout << "drawing tie" << endl; + if (heavyDebugMsg) cout << "drawing tie" << endl; draw_tie(p,it->tie_from_x-x_pos+x_left,it->x -x_pos+x_left,y_offset + it->y, (it->len==0) ? true : (it->stem==DOWNWARDS) , mycolors[color_index]); // in english: "if it's a whole note, tie is upwards (true). if not, tie is upwards if // stem is downwards and vice versa" @@ -3114,7 +3109,7 @@ void ScoreCanvas::draw_items(QPainter& p, int y_offset, staff_t& staff, ScoreIte } else if (it->type==FloItem::REST) { - if (MusEGlobal::heavyDebugMsg) + if (heavyDebugMsg) { cout << "\tREST at line"<<it->pos.height<<" with len="<<pow(2,it->len); for (int i=0;i<it->dots;i++) cout << "."; @@ -3144,7 +3139,7 @@ void ScoreCanvas::draw_items(QPainter& p, int y_offset, staff_t& staff, ScoreIte } else if (it->type==FloItem::BAR) { - if (MusEGlobal::heavyDebugMsg) cout << "\tBAR" << endl; + if (heavyDebugMsg) cout << "\tBAR" << endl; p.setPen(Qt::black); p.drawLine(it->x -x_pos+x_left,y_offset -2*YLEN,it->x -x_pos+x_left,y_offset +2*YLEN); @@ -3154,14 +3149,14 @@ void ScoreCanvas::draw_items(QPainter& p, int y_offset, staff_t& staff, ScoreIte } else if (it->type==FloItem::TIME_SIG) { - if (MusEGlobal::heavyDebugMsg) cout << "\tTIME SIGNATURE: "<<it->num<<"/"<<it->denom<<endl; + if (heavyDebugMsg) cout << "\tTIME SIGNATURE: "<<it->num<<"/"<<it->denom<<endl; draw_timesig(p, it->x - x_pos+x_left, y_offset, it->num, it->denom); } else if (it->type==FloItem::KEY_CHANGE) { key_enum new_key=it->key; - if (MusEGlobal::heavyDebugMsg) cout << "\tKEY CHANGE: from "<<curr_key<<" to "<<new_key<<endl; + if (heavyDebugMsg) cout << "\tKEY CHANGE: from "<<curr_key<<" to "<<new_key<<endl; list<int> aufloes_list=calc_accidentials(curr_key, staff.clef, new_key); list<int> new_acc_list=calc_accidentials(new_key, staff.clef); @@ -3372,7 +3367,7 @@ void ScoreCanvas::draw_number(QPainter& p, int x, int y, int n) void ScoreCanvas::draw(QPainter& p, const QRect&) { - if (MusEGlobal::debugMsg) cout <<"now in ScoreCanvas::draw"<<endl; + if (debugMsg) cout <<"now in ScoreCanvas::draw"<<endl; @@ -3395,7 +3390,7 @@ void ScoreCanvas::draw(QPainter& p, const QRect&) p.drawRect(lasso); } - if (MusEGlobal::debugMsg) cout << "drawing done." << endl; + if (debugMsg) cout << "drawing done." << endl; } @@ -3578,7 +3573,7 @@ void ScoreCanvas::mousePressEvent (QMouseEvent* event) { ScoreItemList& itemlist=staff_it->itemlist; - if (MusEGlobal::debugMsg) cout << "mousePressEvent at "<<x<<"/"<<y<<"; tick="<<tick<<endl; + if (debugMsg) cout << "mousePressEvent at "<<x<<"/"<<y<<"; tick="<<tick<<endl; set<FloItem, floComp>::iterator set_it; for (set_it=itemlist[tick].begin(); set_it!=itemlist[tick].end(); set_it++) if (set_it->type==FloItem::NOTE) @@ -3634,7 +3629,7 @@ void ScoreCanvas::mousePressEvent (QMouseEvent* event) mouse_x_drag_operation=NO_OP; } - if (MusEGlobal::debugMsg) + if (debugMsg) cout << "you clicked at a note with begin at "<<set_it->begin_tick<<" and end at "<<t<<endl << "x-drag-operation will be "<<mouse_x_drag_operation<<endl << "pointer to part is "<<set_it->source_part << endl; @@ -3702,13 +3697,13 @@ void ScoreCanvas::mousePressEvent (QMouseEvent* event) if (flo_quantize(newevent.lenTick(), quant_ticks()) <= 0) { newevent.setLenTick(quant_ticks()); - if (MusEGlobal::debugMsg) cout << "inserted note's length would be invisible after quantisation (too short)." << endl << + if (debugMsg) cout << "inserted note's length would be invisible after quantisation (too short)." << endl << " setting it to " << newevent.lenTick() << endl; } if (newevent.endTick() > curr_part->lenTick()) { - if (MusEGlobal::debugMsg) cout << "clipping inserted note from len="<<newevent.endTick()<<" to len="<<(curr_part->lenTick() - newevent.tick())<<endl; + if (debugMsg) cout << "clipping inserted note from len="<<newevent.endTick()<<" to len="<<(curr_part->lenTick() - newevent.tick())<<endl; newevent.setLenTick(curr_part->lenTick() - newevent.tick()); } @@ -3757,7 +3752,7 @@ void ScoreCanvas::mouseReleaseEvent (QMouseEvent* event) { if (flo_quantize(dragged_event.lenTick(), quant_ticks()) <= 0) { - if (MusEGlobal::debugMsg) cout << "new length <= 0, erasing item" << endl; + if (debugMsg) cout << "new length <= 0, erasing item" << endl; if (undo_started) song->undo(); audio->msgDeleteEvent(dragged_event, dragged_event_part, true, false, false); } @@ -3857,13 +3852,13 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event) { if ((abs(dx)>DRAG_INIT_DISTANCE) && (mouse_x_drag_operation!=NO_OP)) { - if (MusEGlobal::debugMsg) cout << "mouse-operation is now "<<mouse_x_drag_operation<<endl; + if (debugMsg) cout << "mouse-operation is now "<<mouse_x_drag_operation<<endl; mouse_operation=mouse_x_drag_operation; setCursor(Qt::SizeHorCursor); } else if (abs(dy)>DRAG_INIT_DISTANCE) { - if (MusEGlobal::debugMsg) cout << "mouse-operation is now PITCH" << endl; + if (debugMsg) cout << "mouse-operation is now PITCH" << endl; mouse_operation=PITCH; setCursor(Qt::SizeVerCursor); } @@ -3894,7 +3889,7 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event) break; case PITCH: - if (MusEGlobal::heavyDebugMsg) cout << "trying to change pitch, delta="<<-nearbyint((float)dy/PITCH_DELTA)<<endl; + if (heavyDebugMsg) cout << "trying to change pitch, delta="<<-nearbyint((float)dy/PITCH_DELTA)<<endl; new_pitch=original_dragged_event.pitch() - nearbyint((float)dy/PITCH_DELTA); if (new_pitch < 0) new_pitch=0; @@ -3902,7 +3897,7 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event) if (new_pitch != old_pitch) { - if (MusEGlobal::debugMsg) cout << "changing pitch, delta="<<new_pitch-original_dragged_event.pitch()<<endl; + if (debugMsg) cout << "changing pitch, delta="<<new_pitch-original_dragged_event.pitch()<<endl; if (undo_started) song->undo(); undo_started=transpose_notes(part_to_set(dragged_event_part),1, new_pitch-original_dragged_event.pitch()); old_pitch=new_pitch; @@ -3920,7 +3915,7 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event) else { dest_tick=0; - if (MusEGlobal::debugMsg) cout << "not moving note before begin of part; setting it directly to the begin" << endl; + if (debugMsg) cout << "not moving note before begin of part; setting it directly to the begin" << endl; } if (dest_tick != old_dest_tick) @@ -3946,21 +3941,21 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event) else { tmp.setLenTick(0); - if (MusEGlobal::debugMsg) cout << "not setting len to a negative value. using 0 instead" << endl; + if (debugMsg) cout << "not setting len to a negative value. using 0 instead" << endl; } unsigned newpartlen=dragged_event_part->lenTick(); if (tmp.endTick() > dragged_event_part->lenTick()) { - if (dragged_event_part->hasHiddenEvents()) // do not allow autoexpand + if (dragged_event_part->hasHiddenEvents()) // do not allow autoexpand { tmp.setLenTick(dragged_event_part->lenTick() - tmp.tick()); - if (MusEGlobal::debugMsg) cout << "resized note would exceed its part; limiting length to " << tmp.lenTick() << endl; + if (debugMsg) cout << "resized note would exceed its part; limiting length to " << tmp.lenTick() << endl; } else { newpartlen=tmp.endTick(); - if (MusEGlobal::debugMsg) cout << "resized note would exceeds its part; expanding the part..." << endl; + if (debugMsg) cout << "resized note would exceeds its part; expanding the part..." << endl; } } @@ -4067,14 +4062,14 @@ void ScoreCanvas::heartbeat_timer_event() void ScoreCanvas::x_scroll_event(int x) { - if (MusEGlobal::debugMsg) cout << "SCROLL EVENT: x="<<x<<endl; + if (debugMsg) cout << "SCROLL EVENT: x="<<x<<endl; x_pos=x; redraw(); } void ScoreCanvas::y_scroll_event(int y) { - if (MusEGlobal::debugMsg) cout << "SCROLL EVENT: y="<<y<<endl; + if (debugMsg) cout << "SCROLL EVENT: y="<<y<<endl; y_pos=y; redraw(); } @@ -4278,7 +4273,7 @@ void ScoreCanvas::set_quant(int val) void ScoreCanvas::set_pixels_per_whole(int val) { - if (MusEGlobal::debugMsg) cout << "setting px per whole to " << val << endl; + if (debugMsg) cout << "setting px per whole to " << val << endl; int tick; int old_xpos=x_pos; @@ -4300,7 +4295,7 @@ void ScoreCanvas::set_pixels_per_whole(int val) if (old_xpos!=0) { x_pos=tick_to_x(tick); - if (MusEGlobal::debugMsg) cout << "x_pos was not zero, readjusting to " << x_pos << endl; + if (debugMsg) cout << "x_pos was not zero, readjusting to " << x_pos << endl; emit xscroll_changed(x_pos); } @@ -4438,10 +4433,10 @@ void ScoreCanvas::midi_note(int pitch, int velo) void ScoreCanvas::update_parts() { if (selected_part!=NULL) //if it's null, let it be null - selected_part=partFromSerialNumber(selected_part_index); + selected_part=MusEUtil::partFromSerialNumber(selected_part_index); if (dragged_event_part!=NULL) //same thing here - dragged_event_part=partFromSerialNumber(dragged_event_part_index); + dragged_event_part=MusEUtil::partFromSerialNumber(dragged_event_part_index); for (list<staff_t>::iterator it=staves.begin(); it!=staves.end(); it++) it->update_parts(); @@ -4452,7 +4447,7 @@ void staff_t::update_parts() parts.clear(); for (set<int>::iterator it=part_indices.begin(); it!=part_indices.end(); it++) - parts.insert(partFromSerialNumber(*it)); + parts.insert(MusEUtil::partFromSerialNumber(*it)); } void staff_t::update_part_indices() @@ -4463,6 +4458,55 @@ void staff_t::update_part_indices() part_indices.insert((*it)->sn()); } + +void ScoreEdit::keyPressEvent(QKeyEvent* event) +{ + int key = event->key(); + + if (key == Qt::Key_Escape) + { + close(); + return; + } + else if (key == shortcuts[SHRT_TOOL_POINTER].key) + { + edit_tools->set(MusEWidget::PointerTool); + return; + } + else if (key == shortcuts[SHRT_TOOL_PENCIL].key) + { + edit_tools->set(MusEWidget::PencilTool); + return; + } + else if (key == shortcuts[SHRT_TOOL_RUBBER].key) + { + edit_tools->set(MusEWidget::RubberTool); + return; + } + else //Default: + { + event->ignore(); + return; + } +} + + +void ScoreCanvas::add_new_parts(const std::map< Part*, std::set<Part*> >& param) +{ + for (list<staff_t>::iterator staff=staves.begin(); staff!=staves.end(); staff++) + { + for (std::map< Part*, set<Part*> >::const_iterator it = param.begin(); it!=param.end(); it++) + if (staff->parts.find(it->first)!=staff->parts.end()) + staff->parts.insert(it->second.begin(), it->second.end()); + + //staff->cleanup_parts(); // don't cleanup here, because at this point, the parts may only exist + // in the operation group. cleanup could remove them immediately + staff->update_part_indices(); + } + + fully_recalculate(); +} + //the following assertions are made: // pix_quarter.width() == pix_half.width() @@ -4488,33 +4532,39 @@ void staff_t::update_part_indices() * and both A and B get scheduled to be expanded (because we * have one event from A and one event from B), this causes a bug, * because after A (and B) got resized, the B-resize is invalid! + * o when changing toolbarstate when sharing and immediately after that + * changing "share" status, the changed state isn't stored + * ? pasting in editors sometimes fails oO? ( ERROR: reading eventlist + * from clipboard failed. ignoring this one... ) [ not reproducible ] * * CURRENT TODO + * ! o fix sigedit boxes (see also "important todo") + * o ticks-to-quarter spinboxes + * o newly created windows have to be focussed! + * o mirror most menus to an additional right-click context menu to avoid the long mouse pointer + * journey to the menu bar. try to find a way which does not involve duplicate code! + * o implement borland-style maximize: free windows do not cover the main menu, even when maximized + * o smart range selection: if range markers have been used recently (that is, a dialog with + * "range" setting, or they've been modified), default to "in range" or "selected in range" + * + * IMPORTANT TODO + * ! o fix sigedit boxes (see also "current todo") + * o add "dotted quarter" quantize option (for 6/8 beat) + * + * o rename stuff with F2 key * 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 add "dotted quarter" quantize option (for 6/8 beat) - * o draw the edge of parts hiding notes "jagged" (hasHiddenEvents() is interesting for this) - Done. Tim. * o shrink a part from its beginning as well! watch out for clones! - * o insert empty measure should also work inside parts, that is, - * move notes _within_ parts * * o canvas editor: create clone via "alt+drag" moves window instead * o investigate with valgrind * o controller view in score editor - * o fix sigedit boxes * o solo button * o grand staff brace - * o mastertrack editor: key-combobox is buggy * o drum editor: channel-stuff * o do partial recalculating; recalculating can take pretty long * (0,5 sec) when displaying a whole song in scores @@ -4537,7 +4587,6 @@ void staff_t::update_part_indices() * keeping its own pos_add variable (which is only an optimisation) * o support edge-scrolling when opening a lasso * o save more configuration stuff (quant, color) - * o drum list: scroll while dragging (not important due to "reorder list") * * really unimportant nice-to-haves * o support in-song clef-changes @@ -4545,7 +4594,7 @@ void staff_t::update_part_indices() * o use timesig_t in all timesig-stuff * o refuse to resize so that width gets smaller or equal than x_left * o draw a margin around notes which are in a bright color - * o support drum tracks (x-note-heads etc.) + * o support drum tracks in the score editor (x-note-heads etc.) * o drum list: scroll while dragging: probably unneccessary with the "reorder list" function * * @@ -4556,8 +4605,6 @@ void staff_t::update_part_indices() * * o process accurate timesignatures from muse's list (has to be implemented first in muse) * ( (2+2+3)/4 or (3+2+2)/4 instead of 7/4 ) - * o maybe do expanding parts inside the msgChangeEvent or - * msgNewEvent functions (see my e-mail) */ diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h index 4d553e82..709a26ee 100644 --- a/muse2/muse/midiedit/scoreedit.h +++ b/muse2/muse/midiedit/scoreedit.h @@ -79,7 +79,7 @@ enum {CMD_COLOR_BLACK, CMD_COLOR_VELO, CMD_COLOR_PART, CMD_QUANTIZE, CMD_VELOCITY, CMD_CRESCENDO, CMD_NOTELEN, CMD_TRANSPOSE, CMD_ERASE, CMD_MOVE, CMD_FIXED_LEN, CMD_DELETE_OVERLAPS, CMD_LEGATO, - CMD_CUT, CMD_COPY, CMD_PASTE, CMD_DEL, + CMD_CUT, CMD_COPY, CMD_COPY_RANGE, CMD_PASTE, CMD_PASTE_DIALOG, CMD_DEL, CMD_SELECT_ALL, CMD_SELECT_NONE, CMD_SELECT_INVERT, CMD_SELECT_ILOOP, CMD_SELECT_OLOOP}; @@ -99,10 +99,6 @@ class ScoreEdit : public TopWin Q_OBJECT private: virtual void closeEvent(QCloseEvent*); - virtual void resizeEvent(QResizeEvent*); - virtual void focusOutEvent(QFocusEvent*); - - void store_initial_state(); void init_name(); @@ -137,7 +133,9 @@ class ScoreEdit : public TopWin QAction* cut_action; QAction* copy_action; + QAction* copy_range_action; QAction* paste_action; + QAction* paste_dialog_action; QAction* del_action; QAction* select_all_action; @@ -168,14 +166,14 @@ class ScoreEdit : public TopWin bool apply_velo; static set<QString> names; - static int width_init, height_init; - static QByteArray default_toolbar_state; QString name; QSignalMapper* menu_mapper; bool set_name(QString newname, bool emit_signal=true, bool emergency_name=false); + + virtual void keyPressEvent(QKeyEvent*); private slots: void menu_command(int); @@ -186,7 +184,7 @@ class ScoreEdit : public TopWin void clipboard_changed(); signals: - void deleted(unsigned long); + void deleted(TopWin*); void name_changed(); void velo_changed(int); void velo_off_changed(int); @@ -765,6 +763,8 @@ class ScoreCanvas : public MusEWidget::View void deselect_all(); void midi_note(int pitch, int velo); + + void add_new_parts(const std::map< Part*, std::set<Part*> >&); public slots: void x_scroll_event(int); diff --git a/muse2/muse/midieditor.cpp b/muse2/muse/midieditor.cpp index 71d8e97f..d4a16eda 100644 --- a/muse2/muse/midieditor.cpp +++ b/muse2/muse/midieditor.cpp @@ -38,14 +38,14 @@ // MidiEditor //--------------------------------------------------------- -MidiEditor::MidiEditor(int r, PartList* pl, - QWidget* parent, const char* name) : TopWin(parent, name) +MidiEditor::MidiEditor(ToplevelType t, int r, PartList* pl, + QWidget* parent, const char* name) : TopWin(t, parent, name) { setAttribute(Qt::WA_DeleteOnClose); _pl = pl; if (_pl) for (iPart i = _pl->begin(); i != _pl->end(); ++i) - _parts.push_back(i->second->sn()); + _parts.insert(i->second->sn()); _raster = r; canvas = 0; wview = 0; @@ -59,6 +59,8 @@ MidiEditor::MidiEditor(int r, PartList* pl, mainGrid->setContentsMargins(0, 0, 0, 0); mainGrid->setSpacing(0); setCentralWidget(mainw); + + connect(song, SIGNAL(newPartsCreated(const std::map< Part*, std::set<Part*> >&)), SLOT(addNewParts(const std::map< Part*, std::set<Part*> >&))); } //--------------------------------------------------------- @@ -68,7 +70,7 @@ MidiEditor::MidiEditor(int r, PartList* pl, void MidiEditor::genPartlist() { _pl->clear(); - for (std::list<int>::iterator i = _parts.begin(); i != _parts.end(); ++i) { + for (std::set<int>::iterator i = _parts.begin(); i != _parts.end(); ++i) { TrackList* tl = song->tracks(); for (iTrack it = tl->begin(); it != tl->end(); ++it) { PartList* pl = (*it)->parts(); @@ -86,6 +88,17 @@ void MidiEditor::genPartlist() } //--------------------------------------------------------- +// addPart +//--------------------------------------------------------- + +void MidiEditor::addPart(Part* p) +{ + _pl->add(p); + _parts.insert(p->sn()); +} + + +//--------------------------------------------------------- // MidiEditor //--------------------------------------------------------- @@ -266,3 +279,14 @@ void MidiEditor::horizontalZoomOut() hscroll->setMag(newmag); } + +void MidiEditor::addNewParts(const std::map< Part*, std::set<Part*> >& param) +{ + using std::map; + using std::set; + + for (map< Part*, set<Part*> >::const_iterator it = param.begin(); it!=param.end(); it++) + if (_pl->index(it->first) != -1) + for (set<Part*>::const_iterator it2=it->second.begin(); it2!=it->second.end(); it2++) + addPart(*it2); +} diff --git a/muse2/muse/midieditor.h b/muse2/muse/midieditor.h index abfe8e8d..84597cd3 100644 --- a/muse2/muse/midieditor.h +++ b/muse2/muse/midieditor.h @@ -27,6 +27,9 @@ #include "al/sig.h" #include "cobject.h" + +#include <set> + class QGridLayout; class QWidget; @@ -51,7 +54,7 @@ class MidiEditor : public TopWin { Q_OBJECT PartList* _pl; - std::list<int> _parts; + std::set<int> _parts; int _curDrumInstrument; // currently selected instrument if drum // editor protected: @@ -70,6 +73,9 @@ class MidiEditor : public TopWin { void writePartList(int, Xml&) const; void genPartlist(); + private slots: + void addNewParts(const std::map< Part*, std::set<Part*> >&); + public slots: void songChanged(int type); void setCurDrumInstrument(int instr); @@ -81,7 +87,7 @@ class MidiEditor : public TopWin { void curDrumInstrumentChanged(int); public: - MidiEditor(int, PartList*, + MidiEditor(ToplevelType t, int, PartList*, QWidget* parent = 0, const char* name = 0); ~MidiEditor(); @@ -100,6 +106,7 @@ class MidiEditor : public TopWin { Part* curCanvasPart(); WavePart* curWavePart(); void setCurCanvasPart(Part*); + void addPart(Part*); }; #endif diff --git a/muse2/muse/miditransform.cpp b/muse2/muse/miditransform.cpp index 76a39306..8d25fdfc 100644 --- a/muse2/muse/miditransform.cpp +++ b/muse2/muse/miditransform.cpp @@ -1502,7 +1502,7 @@ void MidiTransformerDialog::selVal1aChanged(int val) data->cmt->selVal1a = val; if ((data->cmt->selEventOp != All) && (data->cmt->selType == Note)) { - selVal1a->setSuffix(" - " + pitch2string(val)); + selVal1a->setSuffix(" - " + MusEUtil::pitch2string(val)); } else { @@ -1520,7 +1520,7 @@ void MidiTransformerDialog::selVal1bChanged(int val) data->cmt->selVal1b = val; if ((data->cmt->selEventOp != All) && (data->cmt->selType == Note)) { - selVal1b->setSuffix(" - " + pitch2string(val)); + selVal1b->setSuffix(" - " + MusEUtil::pitch2string(val)); } else { @@ -1595,7 +1595,7 @@ void MidiTransformerDialog::procVal1aChanged(int val) (data->cmt->procVal1 == Fix || data->cmt->procVal1 == ScaleMap || data->cmt->procVal1 == Dynamic || data->cmt->procVal1 == Random || data->cmt->procVal1 == Flip)) { - procVal1a->setSuffix(" - " + pitch2string(val)); + procVal1a->setSuffix(" - " + MusEUtil::pitch2string(val)); } else { @@ -1617,7 +1617,7 @@ void MidiTransformerDialog::procVal1bChanged(int val) (data->cmt->procVal1 == Fix || data->cmt->procVal1 == ScaleMap || data->cmt->procVal1 == Dynamic || data->cmt->procVal1 == Random || data->cmt->procVal1 == Flip)) { - procVal1b->setSuffix(" - " + pitch2string(val)); + procVal1b->setSuffix(" - " + MusEUtil::pitch2string(val)); } else { diff --git a/muse2/muse/mixer/amixer.cpp b/muse2/muse/mixer/amixer.cpp index 0aa246a2..e30524ae 100644 --- a/muse2/muse/mixer/amixer.cpp +++ b/muse2/muse/mixer/amixer.cpp @@ -35,6 +35,7 @@ #include <QAction> #include "app.h" +#include "helper.h" #include "icons.h" #include "amixer.h" #include "song.h" @@ -45,10 +46,6 @@ #include "gconfig.h" #include "xml.h" -namespace MusEApp { -extern QActionGroup* populateAddTrack(QMenu* addTrack); -} - #define __WIDTH_COMPENSATION 4 //typedef std::list<Strip*> StripList; @@ -171,7 +168,8 @@ AudioMixerApp::AudioMixerApp(QWidget* parent, MusEConfig::MixerConfig* c) setWindowIcon(*museIcon); QMenu* menuConfig = menuBar()->addMenu(tr("&Create")); - MusEApp::populateAddTrack(menuConfig); + MusEUtil::populateAddTrack(menuConfig); + connect(menuConfig, SIGNAL(triggered(QAction *)), song, SLOT(addNewTrack(QAction *))); QMenu* menuView = menuBar()->addMenu(tr("&View")); routingId = menuView->addAction(tr("Routing"), this, SLOT(toggleRouteDialog())); @@ -255,6 +253,12 @@ bool AudioMixerApp::event(QEvent* event) } */ +//void AudioMixerApp::addNewTrack(QAction* action) +//{ + //song->addNewTrack(action, MusEGlobal::muse->arranger()->curTrack()); // Insert at current selected track. +// song->addNewTrack(action); // Add at end. +//} + void AudioMixerApp::setSizing() { int w = 0; diff --git a/muse2/muse/mixer/amixer.h b/muse2/muse/mixer/amixer.h index 1726ba7b..41f1e5e1 100644 --- a/muse2/muse/mixer/amixer.h +++ b/muse2/muse/mixer/amixer.h @@ -122,6 +122,7 @@ class AudioMixerApp : public QMainWindow { void songChanged(int); //void configChanged() { songChanged(-1); } void configChanged(); + //void addNewTrack(QAction*); void setSizing(); void toggleRouteDialog(); void routingDialogClosed(); diff --git a/muse2/muse/mpevent.cpp b/muse2/muse/mpevent.cpp index 11c85704..67ba968c 100644 --- a/muse2/muse/mpevent.cpp +++ b/muse2/muse/mpevent.cpp @@ -88,7 +88,7 @@ void MEvent::dump() const { printf("time:%d port:%d chan:%d ", _time, _port, _channel+1); if (_type == 0x90) { // NoteOn - QString s = pitch2string(_a); + QString s = MusEUtil::pitch2string(_a); printf("NoteOn %s(0x%x) %d\n", s.toLatin1().constData(), _a, _b); } else if (_type == 0xf0) { diff --git a/muse2/muse/mplugins/midiitransform.cpp b/muse2/muse/mplugins/midiitransform.cpp index 8cc881ff..b5b4d3c8 100644 --- a/muse2/muse/mplugins/midiitransform.cpp +++ b/muse2/muse/mplugins/midiitransform.cpp @@ -1273,7 +1273,7 @@ void MidiInputTransformDialog::selVal1aChanged(int val) cmt->selVal1a = val; if ((cmt->selEventOp != All) && (cmt->selType == MIDITRANSFORM_NOTE)) { - selVal1a->setSuffix(" - " + pitch2string(val)); + selVal1a->setSuffix(" - " + MusEUtil::pitch2string(val)); } else { @@ -1291,7 +1291,7 @@ void MidiInputTransformDialog::selVal1bChanged(int val) cmt->selVal1b = val; if ((cmt->selEventOp != All) && (cmt->selType == MIDITRANSFORM_NOTE)) { - selVal1b->setSuffix(" - " + pitch2string(val)); + selVal1b->setSuffix(" - " + MusEUtil::pitch2string(val)); } else { @@ -1330,7 +1330,7 @@ void MidiInputTransformDialog::procVal1aChanged(int val) (cmt->procVal1 == Fix || cmt->procVal1 == ScaleMap || cmt->procVal1 == Dynamic || cmt->procVal1 == Random || cmt->procVal1 == Flip)) { - procVal1a->setSuffix(" - " + pitch2string(val)); + procVal1a->setSuffix(" - " + MusEUtil::pitch2string(val)); } else { @@ -1351,7 +1351,7 @@ void MidiInputTransformDialog::procVal1bChanged(int val) (cmt->procVal1 == Fix || cmt->procVal1 == ScaleMap || cmt->procVal1 == Dynamic || cmt->procVal1 == Random || cmt->procVal1 == Flip)) { - procVal1b->setSuffix(" - " + pitch2string(val)); + procVal1b->setSuffix(" - " + MusEUtil::pitch2string(val)); } else { diff --git a/muse2/muse/muse.log b/muse2/muse/muse.log deleted file mode 100644 index 887f40d5..00000000 --- a/muse2/muse/muse.log +++ /dev/null @@ -1,1875 +0,0 @@ - -*** Beginning merge of project muse - -User: ws -Date: Mon, 11 Aug 2003 15:03:52 +0200 -Common version: 0.2 -Selected version: 0.4 -Working version: 0.2(w) - -*** Action on file `m4/alsa.m4' -No prompt for file `m4/alsa.m4' - -*** Action on file `m4/docbook.m4' -No prompt for file `m4/docbook.m4' - -*** Action on file `m4/Makefile.am' -No prompt for file `m4/Makefile.am' - -*** Action on file `m4/aclocal-include.m4' -No prompt for file `m4/aclocal-include.m4' - -*** Action on file `m4/qt.m4' -No prompt for file `m4/qt.m4' - -*** Action on file [symlink:COPYING] -No prompt for file [symlink:COPYING] - -*** Action on file [symlink:INSTALL] -No prompt for file [symlink:INSTALL] - -*** Action on file [symlink:depcomp] -No prompt for file [symlink:depcomp] - -*** Action on file [symlink:mkinstalldirs] -No prompt for file [symlink:mkinstalldirs] - -*** Action on file [symlink:missing] -No prompt for file [symlink:missing] - -*** Action on file [symlink:config.sub] -No prompt for file [symlink:config.sub] - -*** Action on file [symlink:install-sh] -No prompt for file [symlink:install-sh] - -*** Action on file [symlink:config.guess] -No prompt for file [symlink:config.guess] - -*** Action on file [symlink:ltmain.sh] -No prompt for file [symlink:ltmain.sh] - -*** Action on file `configure.ac' -No prompt for file `configure.ac' - -*** Action on file `Doxyfile.in' -No prompt for file `Doxyfile.in' - -*** Action on file `common.am' -No prompt for file `common.am' - -*** Action on file `aclocal.m4' -No prompt for file `aclocal.m4' - -*** Action on file `ChangeLog' -No prompt for file `ChangeLog' - -*** Action on file `README.ladspaguis' -No prompt for file `README.ladspaguis' - -*** Action on file `README.instruments' -No prompt for file `README.instruments' - -*** Action on file `README.translate' -No prompt for file `README.translate' - -*** Action on file `README' -No prompt for file `README' - -*** Action on file `README.de' -No prompt for file `README.de' - -*** Action on file `AUTHORS' -No prompt for file `AUTHORS' - -*** Action on file `README.shortcuts' -No prompt for file `README.shortcuts' - -*** Action on file `README.CVS' -No prompt for file `README.CVS' - -*** Action on file `NEWS' -No prompt for file `NEWS' - -*** Action on file `README.softsynth' -No prompt for file `README.softsynth' - -*** Action on file `SECURITY' -No prompt for file `SECURITY' - -*** Action on file `.cvsignore' -No prompt for file `.cvsignore' - -*** Action on file `Makefile.am' -No prompt for file `Makefile.am' - -*** Action on file `pos.h' -No prompt for file `pos.h' - -*** Action on file `mtc.h' -No prompt for file `mtc.h' - -*** Action on file `cfprint.cpp' -No prompt for file `cfprint.cpp' - -*** Action on file `key.h' -No prompt for file `key.h' - -*** Action on file `app.h' -No prompt for file `app.h' - -*** Action on file `song.cpp' -No prompt for file `song.cpp' - -*** Action on file `key.cpp' -No prompt for file `key.cpp' - -*** Action on file `memory.cpp' -No prompt for file `memory.cpp' - -*** Action on file `midiport.h' -No prompt for file `midiport.h' - -*** Action on file `xml.cpp' -No prompt for file `xml.cpp' - -*** Action on file `undo.cpp' -No prompt for file `undo.cpp' - -*** Action on file `debug.h' -No prompt for file `debug.h' - -*** Action on file `app.cpp' -No prompt for file `app.cpp' - -*** Action on file `thread.h' -No prompt for file `thread.h' - -*** Action on file `icons.h' -No prompt for file `icons.h' - -*** Action on file `midithread.cpp' -Copied working file `midithread.cpp' to `obsolete/midithread.cpp.v0' -Merge file `midithread.cpp' by rule 2 - -*** Action on file `device.h' -No prompt for file `device.h' - -*** Action on file `icons.cpp' -No prompt for file `icons.cpp' - -*** Action on file `wave.h' -No prompt for file `wave.h' - -*** Action on file `ladspa.h' -No prompt for file `ladspa.h' - -*** Action on file `undo.h' -No prompt for file `undo.h' - -*** Action on file `sync.h' -No prompt for file `sync.h' - -*** Action on file `song.h' -No prompt for file `song.h' - -*** Action on file `value.cpp' -No prompt for file `value.cpp' - -*** Action on file `midiport.cpp' -No prompt for file `midiport.cpp' - -*** Action on file `givertcap.c' -No prompt for file `givertcap.c' - -*** Action on file `value.h' -No prompt for file `value.h' - -*** Action on file `part.h' -No prompt for file `part.h' - -*** Action on file `node.h' -No prompt for file `node.h' - -*** Action on file `cobject.cpp' -No prompt for file `cobject.cpp' - -*** Action on file `midithread.h' -No prompt for file `midithread.h' - -*** Action on file `tempo.cpp' -No prompt for file `tempo.cpp' - -*** Action on file `memory.h' -Copied working file `memory.h' to `obsolete/memory.h.v0' -Merge file `memory.h' by rule 2, conflicts created - -*** Action on file `help.cpp' -No prompt for file `help.cpp' - -*** Action on file `audiomix.h' -No prompt for file `audiomix.h' - -*** Action on file `thread.cpp' -No prompt for file `thread.cpp' - -*** Action on file `mrecord.cpp' -No prompt for file `mrecord.cpp' - -*** Action on file `globals.cpp' -No prompt for file `globals.cpp' - -*** Action on file `pos.cpp' -No prompt for file `pos.cpp' - -*** Action on file `track.cpp' -No prompt for file `track.cpp' - -*** Action on file `midictrl.h' -No prompt for file `midictrl.h' - -*** Action on file `node.cpp' -No prompt for file `node.cpp' - -*** Action on file `audiomix.cpp' -No prompt for file `audiomix.cpp' - -*** Action on file `transport.h' -No prompt for file `transport.h' - -*** Action on file `transpose.h' -No prompt for file `transpose.h' - -*** Action on file `seqmsg.cpp' -No prompt for file `seqmsg.cpp' - -*** Action on file `audionode.h' -No prompt for file `audionode.h' - -*** Action on file `audio.h' -No prompt for file `audio.h' - -*** Action on file `grepmidi.cpp' -No prompt for file `grepmidi.cpp' - -*** Action on file `globals.h' -No prompt for file `globals.h' - -*** Action on file `midieditor.cpp' -No prompt for file `midieditor.cpp' - -*** Action on file `wave.cpp' -No prompt for file `wave.cpp' - -*** Action on file `midi.h' -No prompt for file `midi.h' - -*** Action on file `mess.h' -No prompt for file `mess.h' - -*** Action on file `sync.cpp' -No prompt for file `sync.cpp' - -*** Action on file `config.h.in' -No prompt for file `config.h.in' - -*** Action on file `track.h' -No prompt for file `track.h' - -*** Action on file `mtc.cpp' -No prompt for file `mtc.cpp' - -*** Action on file `minstrument.h' -No prompt for file `minstrument.h' - -*** Action on file `cobject.h' -No prompt for file `cobject.h' - -*** Action on file `synth.h' -No prompt for file `synth.h' - -*** Action on file `songfile.cpp' -No prompt for file `songfile.cpp' - -*** Action on file `midictrl.cpp' -No prompt for file `midictrl.cpp' - -*** Action on file `mpevent.h' -No prompt for file `mpevent.h' - -*** Action on file `font.h' -No prompt for file `font.h' - -*** Action on file `conf.cpp' -No prompt for file `conf.cpp' - -*** Action on file `conf.h' -No prompt for file `conf.h' - -*** Action on file `event.cpp' -No prompt for file `event.cpp' - -*** Action on file `midi.cpp' -No prompt for file `midi.cpp' - -*** Action on file `event.h' -No prompt for file `event.h' - -*** Action on file `audioprefetch.h' -No prompt for file `audioprefetch.h' - -*** Action on file `mpevent.cpp' -No prompt for file `mpevent.cpp' - -*** Action on file `appearance.cpp' -No prompt for file `appearance.cpp' - -*** Action on file `autogen.sh' -No prompt for file `autogen.sh' - -*** Action on file `tempo.h' -No prompt for file `tempo.h' - -*** Action on file `muse.pro' -No prompt for file `muse.pro' - -*** Action on file `part.cpp' -No prompt for file `part.cpp' - -*** Action on file `make.inc' -No prompt for file `make.inc' - -*** Action on file `confmport.h' -No prompt for file `confmport.h' - -*** Action on file `audio.cpp' -No prompt for file `audio.cpp' - -*** Action on file `confmport.cpp' -No prompt for file `confmport.cpp' - -*** Action on file `cfprint.h' -No prompt for file `cfprint.h' - -*** Action on file `sig.cpp' -No prompt for file `sig.cpp' - -*** Action on file `font.cpp' -No prompt for file `font.cpp' - -*** Action on file `midieditor.h' -No prompt for file `midieditor.h' - -*** Action on file `appearance.h' -No prompt for file `appearance.h' - -*** Action on file `globaldefs.h' -No prompt for file `globaldefs.h' - -*** Action on file `seq.cpp' -No prompt for file `seq.cpp' - -*** Action on file `miditransform.cpp' -No prompt for file `miditransform.cpp' - -*** Action on file `miditransform.h' -No prompt for file `miditransform.h' - -*** Action on file `minstrument.cpp' -Copied working file `minstrument.cpp' to `obsolete/minstrument.cpp.v0' -Merge file `minstrument.cpp' by rule 2 - -*** Action on file `audioprefetch.cpp' -No prompt for file `audioprefetch.cpp' - -*** Action on file `transport.cpp' -No prompt for file `transport.cpp' - -*** Action on file `transpose.cpp' -No prompt for file `transpose.cpp' - -*** Action on file `xml.h' -No prompt for file `xml.h' - -*** Action on file `sig.h' -No prompt for file `sig.h' - -*** Action on file `seq.h' -No prompt for file `seq.h' - -*** Action on file `demos/Makefile.am' -No prompt for file `demos/Makefile.am' - -*** Action on file `demos/rasen.med' -No prompt for file `demos/rasen.med' - -*** Action on file `widgets/.cvsignore' -No prompt for file `widgets/.cvsignore' - -*** Action on file `widgets/mmath.cpp' -No prompt for file `widgets/mmath.cpp' - -*** Action on file `widgets/dimap.cpp' -No prompt for file `widgets/dimap.cpp' - -*** Action on file `widgets/utils.cpp' -No prompt for file `widgets/utils.cpp' - -*** Action on file `widgets/sclif.cpp' -No prompt for file `widgets/sclif.cpp' - -*** Action on file `widgets/filedialog.cpp' -No prompt for file `widgets/filedialog.cpp' - -*** Action on file `widgets/citem.h' -No prompt for file `widgets/citem.h' - -*** Action on file `widgets/bigtime.cpp' -No prompt for file `widgets/bigtime.cpp' - -*** Action on file `widgets/view.cpp' -No prompt for file `widgets/view.cpp' - -*** Action on file `widgets/scldraw.h' -No prompt for file `widgets/scldraw.h' - -*** Action on file `widgets/sliderbase.h' -No prompt for file `widgets/sliderbase.h' - -*** Action on file `widgets/hitscale.cpp' -No prompt for file `widgets/hitscale.cpp' - -*** Action on file `widgets/itransformbase.ui' -No prompt for file `widgets/itransformbase.ui' - -*** Action on file `widgets/header.cpp' -No prompt for file `widgets/header.cpp' - -*** Action on file `widgets/tempolabel.h' -No prompt for file `widgets/tempolabel.h' - -*** Action on file `widgets/velocity.cpp' -No prompt for file `widgets/velocity.cpp' - -*** Action on file `widgets/midirawbase.ui' -No prompt for file `widgets/midirawbase.ui' - -*** Action on file `widgets/drange.cpp' -No prompt for file `widgets/drange.cpp' - -*** Action on file `widgets/header.h' -No prompt for file `widgets/header.h' - -*** Action on file `widgets/mlabel.h' -No prompt for file `widgets/mlabel.h' - -*** Action on file `widgets/spinboxFP.cpp' -No prompt for file `widgets/spinboxFP.cpp' - -*** Action on file `widgets/mlabel.cpp' -No prompt for file `widgets/mlabel.cpp' - -*** Action on file `widgets/metronome.cpp' -No prompt for file `widgets/metronome.cpp' - -*** Action on file `widgets/ctrlcombo.cw' -No prompt for file `widgets/ctrlcombo.cw' - -*** Action on file `widgets/sigedit.h' -No prompt for file `widgets/sigedit.h' - -*** Action on file `widgets/intlabel.h' -No prompt for file `widgets/intlabel.h' - -*** Action on file `widgets/comment.cpp' -No prompt for file `widgets/comment.cpp' - -*** Action on file `widgets/ctrlcombo.cpp' -No prompt for file `widgets/ctrlcombo.cpp' - -*** Action on file `widgets/mixdowndialog.cpp' -No prompt for file `widgets/mixdowndialog.cpp' - -*** Action on file `widgets/fontsel.cpp' -No prompt for file `widgets/fontsel.cpp' - -*** Action on file `widgets/hitscale.h' -No prompt for file `widgets/hitscale.h' - -*** Action on file `widgets/posedit.cpp' -No prompt for file `widgets/posedit.cpp' - -*** Action on file `widgets/audioconfbase.ui' -No prompt for file `widgets/audioconfbase.ui' - -*** Action on file `widgets/utils.h' -No prompt for file `widgets/utils.h' - -*** Action on file `widgets/splitter.cpp' -No prompt for file `widgets/splitter.cpp' - -*** Action on file `widgets/editctrl7dialogbase.ui' -No prompt for file `widgets/editctrl7dialogbase.ui' - -*** Action on file `widgets/doublelabel.h' -No prompt for file `widgets/doublelabel.h' - -*** Action on file `widgets/noteinfo.h' -No prompt for file `widgets/noteinfo.h' - -*** Action on file `widgets/sigscale.h' -No prompt for file `widgets/sigscale.h' - -*** Action on file `widgets/canvas.cpp' -No prompt for file `widgets/canvas.cpp' - -*** Action on file `widgets/view.h' -No prompt for file `widgets/view.h' - -*** Action on file `widgets/audioconf.h' -No prompt for file `widgets/audioconf.h' - -*** Action on file `widgets/ccontrolbase.ui' -No prompt for file `widgets/ccontrolbase.ui' - -*** Action on file `widgets/transposebase.ui' -No prompt for file `widgets/transposebase.ui' - -*** Action on file `widgets/spinboxFP.h' -No prompt for file `widgets/spinboxFP.h' - -*** Action on file `widgets/mtscale.h' -No prompt for file `widgets/mtscale.h' - -*** Action on file `widgets/nentry.cpp' -No prompt for file `widgets/nentry.cpp' - -*** Action on file `widgets/siglabel.h' -No prompt for file `widgets/siglabel.h' - -*** Action on file `widgets/transformbase.ui' -No prompt for file `widgets/transformbase.ui' - -*** Action on file `widgets/mittransposebase.ui' -No prompt for file `widgets/mittransposebase.ui' - -*** Action on file `widgets/dentry.h' -No prompt for file `widgets/dentry.h' - -*** Action on file `widgets/slider.h' -No prompt for file `widgets/slider.h' - -*** Action on file `widgets/wtscale.cpp' -No prompt for file `widgets/wtscale.cpp' - -*** Action on file `widgets/action.h' -No prompt for file `widgets/action.h' - -*** Action on file `widgets/nentry.h' -No prompt for file `widgets/nentry.h' - -*** Action on file `widgets/ttoolbar.h' -No prompt for file `widgets/ttoolbar.h' - -*** Action on file `widgets/comboQuant.cpp' -No prompt for file `widgets/comboQuant.cpp' - -*** Action on file `widgets/midisyncimpl.h' -No prompt for file `widgets/midisyncimpl.h' - -*** Action on file `widgets/sliderbase.cpp' -No prompt for file `widgets/sliderbase.cpp' - -*** Action on file `widgets/genset.cpp' -No prompt for file `widgets/genset.cpp' - -*** Action on file `widgets/velocity.h' -No prompt for file `widgets/velocity.h' - -*** Action on file `widgets/poslabel.h' -No prompt for file `widgets/poslabel.h' - -*** Action on file `widgets/knob.h' -No prompt for file `widgets/knob.h' - -*** Action on file `widgets/cliplisteditorbase.ui' -No prompt for file `widgets/cliplisteditorbase.ui' - -*** Action on file `widgets/splitter.h' -No prompt for file `widgets/splitter.h' - -*** Action on file `widgets/sigedit.cpp' -No prompt for file `widgets/sigedit.cpp' - -*** Action on file `widgets/audioconf.cpp' -No prompt for file `widgets/audioconf.cpp' - -*** Action on file `widgets/swidget.h' -No prompt for file `widgets/swidget.h' - -*** Action on file `widgets/tools.h' -No prompt for file `widgets/tools.h' - -*** Action on file `widgets/pitchlabel.h' -No prompt for file `widgets/pitchlabel.h' - -*** Action on file `widgets/Makefile.am' -No prompt for file `widgets/Makefile.am' - -*** Action on file `widgets/moc_ttoolbar.cpp' -No prompt for file `widgets/moc_ttoolbar.cpp' - -*** Action on file `widgets/intlabel.cpp' -No prompt for file `widgets/intlabel.cpp' - -*** Action on file `widgets/citem.cpp' -No prompt for file `widgets/citem.cpp' - -*** Action on file `widgets/canvas.h' -No prompt for file `widgets/canvas.h' - -*** Action on file `widgets/doublelabel.cpp' -No prompt for file `widgets/doublelabel.cpp' - -*** Action on file `widgets/slider.cpp' -No prompt for file `widgets/slider.cpp' - -*** Action on file `widgets/mmath.h' -No prompt for file `widgets/mmath.h' - -*** Action on file `widgets/wtscale.h' -No prompt for file `widgets/wtscale.h' - -*** Action on file `widgets/genset.h' -No prompt for file `widgets/genset.h' - -*** Action on file `widgets/posedit.h' -No prompt for file `widgets/posedit.h' - -*** Action on file `widgets/velocitybase.ui' -No prompt for file `widgets/velocitybase.ui' - -*** Action on file `widgets/ttoolbar.cpp' -No prompt for file `widgets/ttoolbar.cpp' - -*** Action on file `widgets/scrollscale.cpp' -No prompt for file `widgets/scrollscale.cpp' - -*** Action on file `widgets/mtscale.cpp' -No prompt for file `widgets/mtscale.cpp' - -*** Action on file `widgets/noteinfo.cpp' -No prompt for file `widgets/noteinfo.cpp' - -*** Action on file `widgets/lcombo.cpp' -No prompt for file `widgets/lcombo.cpp' - -*** Action on file `widgets/appearancebase.ui' -No prompt for file `widgets/appearancebase.ui' - -*** Action on file `widgets/vscale.h' -No prompt for file `widgets/vscale.h' - -*** Action on file `widgets/scldiv.h' -No prompt for file `widgets/scldiv.h' - -*** Action on file `widgets/drange.h' -No prompt for file `widgets/drange.h' - -*** Action on file `widgets/midisync.ui' -No prompt for file `widgets/midisync.ui' - -*** Action on file `widgets/wtrackinfobase.ui' -No prompt for file `widgets/wtrackinfobase.ui' - -*** Action on file `widgets/vscale.cpp' -No prompt for file `widgets/vscale.cpp' - -*** Action on file `widgets/editsysexdialogbase.ui' -No prompt for file `widgets/editsysexdialogbase.ui' - -*** Action on file `widgets/gatetimebase.ui' -No prompt for file `widgets/gatetimebase.ui' - -*** Action on file `widgets/editmetadialogbase.ui' -No prompt for file `widgets/editmetadialogbase.ui' - -*** Action on file `widgets/sigscale.cpp' -No prompt for file `widgets/sigscale.cpp' - -*** Action on file `widgets/mtrackinfobase.ui' -No prompt for file `widgets/mtrackinfobase.ui' - -*** Action on file `widgets/metronome.h' -No prompt for file `widgets/metronome.h' - -*** Action on file `widgets/gatetime.cpp' -No prompt for file `widgets/gatetime.cpp' - -*** Action on file `widgets/tb1.cpp' -No prompt for file `widgets/tb1.cpp' - -*** Action on file `widgets/gensetbase.ui' -No prompt for file `widgets/gensetbase.ui' - -*** Action on file `widgets/scldraw.cpp' -No prompt for file `widgets/scldraw.cpp' - -*** Action on file `widgets/bigtime.h' -No prompt for file `widgets/bigtime.h' - -*** Action on file `widgets/poslabel.cpp' -No prompt for file `widgets/poslabel.cpp' - -*** Action on file `widgets/metronomebase.ui' -No prompt for file `widgets/metronomebase.ui' - -*** Action on file `widgets/scrollscale.h' -No prompt for file `widgets/scrollscale.h' - -*** Action on file `widgets/fdialogbuttons.ui' -No prompt for file `widgets/fdialogbuttons.ui' - -*** Action on file `widgets/sclif.h' -No prompt for file `widgets/sclif.h' - -*** Action on file `widgets/tools.cpp' -No prompt for file `widgets/tools.cpp' - -*** Action on file `widgets/filedialog.h' -No prompt for file `widgets/filedialog.h' - -*** Action on file `widgets/pitchlabel.cpp' -No prompt for file `widgets/pitchlabel.cpp' - -*** Action on file `widgets/scldiv.cpp' -No prompt for file `widgets/scldiv.cpp' - -*** Action on file `widgets/musewidgetsplug.cpp' -No prompt for file `widgets/musewidgetsplug.cpp' - -*** Action on file `widgets/midisyncimpl.cpp' -No prompt for file `widgets/midisyncimpl.cpp' - -*** Action on file `widgets/commentbase.ui' -No prompt for file `widgets/commentbase.ui' - -*** Action on file `widgets/dentry.cpp' -No prompt for file `widgets/dentry.cpp' - -*** Action on file `widgets/comment.h' -No prompt for file `widgets/comment.h' - -*** Action on file `widgets/ctrlcombo.h' -No prompt for file `widgets/ctrlcombo.h' - -*** Action on file `widgets/comboQuant.h' -No prompt for file `widgets/comboQuant.h' - -*** Action on file `widgets/gatetime.h' -No prompt for file `widgets/gatetime.h' - -*** Action on file `widgets/tb1.h' -No prompt for file `widgets/tb1.h' - -*** Action on file `widgets/editnotedialogbase.ui' -No prompt for file `widgets/editnotedialogbase.ui' - -*** Action on file `widgets/pitchedit.h' -No prompt for file `widgets/pitchedit.h' - -*** Action on file `widgets/lcombo.h' -No prompt for file `widgets/lcombo.h' - -*** Action on file `widgets/fontsel.h' -No prompt for file `widgets/fontsel.h' - -*** Action on file `widgets/tempolabel.cpp' -No prompt for file `widgets/tempolabel.cpp' - -*** Action on file `widgets/knob.cpp' -No prompt for file `widgets/knob.cpp' - -*** Action on file `widgets/dimap.h' -No prompt for file `widgets/dimap.h' - -*** Action on file `widgets/pitchedit.cpp' -No prompt for file `widgets/pitchedit.cpp' - -*** Action on file `widgets/siglabel.cpp' -No prompt for file `widgets/siglabel.cpp' - -*** Action on file `widgets/mixdowndialog.h' -No prompt for file `widgets/mixdowndialog.h' - -*** Action on file `widgets/mixdowndialogbase.ui' -No prompt for file `widgets/mixdowndialogbase.ui' - -*** Action on file `widgets/synthconfigbase.ui' -No prompt for file `widgets/synthconfigbase.ui' - -*** Action on file `widgets/swidget.cpp' -No prompt for file `widgets/swidget.cpp' - -*** Action on file `widgets/section.h' -No prompt for file `widgets/section.h' - -*** Action on file `arranger/pcanvas.h' -No prompt for file `arranger/pcanvas.h' - -*** Action on file `arranger/alayout.h' -No prompt for file `arranger/alayout.h' - -*** Action on file `arranger/tlist.cpp' -No prompt for file `arranger/tlist.cpp' - -*** Action on file `arranger/arranger.h' -No prompt for file `arranger/arranger.h' - -*** Action on file `arranger/alayout.cpp' -No prompt for file `arranger/alayout.cpp' - -*** Action on file `arranger/Makefile.am' -No prompt for file `arranger/Makefile.am' - -*** Action on file `arranger/tlist.h' -No prompt for file `arranger/tlist.h' - -*** Action on file `arranger/pcanvas.cpp' -No prompt for file `arranger/pcanvas.cpp' - -*** Action on file `arranger/arranger.cpp' -No prompt for file `arranger/arranger.cpp' - -*** Action on file `mplugins/Makefile.am' -No prompt for file `mplugins/Makefile.am' - -*** Action on file `mplugins/.cvsignore' -No prompt for file `mplugins/.cvsignore' - -*** Action on file `mplugins/midifilterimpl.cpp' -No prompt for file `mplugins/midifilterimpl.cpp' - -*** Action on file `mplugins/rhythm.cpp' -No prompt for file `mplugins/rhythm.cpp' - -*** Action on file `mplugins/rhythmbase.ui' -No prompt for file `mplugins/rhythmbase.ui' - -*** Action on file `mplugins/midifilter.ui' -No prompt for file `mplugins/midifilter.ui' - -*** Action on file `mplugins/mitplugin.h' -No prompt for file `mplugins/mitplugin.h' - -*** Action on file `mplugins/rhythm.h' -No prompt for file `mplugins/rhythm.h' - -*** Action on file `mplugins/midiitransform.h' -No prompt for file `mplugins/midiitransform.h' - -*** Action on file `mplugins/mittranspose.cpp' -No prompt for file `mplugins/mittranspose.cpp' - -*** Action on file `mplugins/mrconfigbase.ui' -No prompt for file `mplugins/mrconfigbase.ui' - -*** Action on file `mplugins/mrconfig.cpp' -No prompt for file `mplugins/mrconfig.cpp' - -*** Action on file `mplugins/mrconfig.h' -No prompt for file `mplugins/mrconfig.h' - -*** Action on file `mplugins/random.h' -No prompt for file `mplugins/random.h' - -*** Action on file `mplugins/midiitransform.cpp' -No prompt for file `mplugins/midiitransform.cpp' - -*** Action on file `mplugins/mittranspose.h' -No prompt for file `mplugins/mittranspose.h' - -*** Action on file `mplugins/mitplugin.cpp' -No prompt for file `mplugins/mitplugin.cpp' - -*** Action on file `mplugins/midifilterimpl.h' -No prompt for file `mplugins/midifilterimpl.h' - -*** Action on file `mplugins/random.cpp' -No prompt for file `mplugins/random.cpp' - -*** Action on file `waveedit/Makefile.am' -No prompt for file `waveedit/Makefile.am' - -*** Action on file `waveedit/waveview.h' -No prompt for file `waveedit/waveview.h' - -*** Action on file `waveedit/waveedit.cpp' -No prompt for file `waveedit/waveedit.cpp' - -*** Action on file `waveedit/waveedit.h' -No prompt for file `waveedit/waveedit.h' - -*** Action on file `waveedit/waveview.cpp' -No prompt for file `waveedit/waveview.cpp' - -*** Action on file `master/masteredit.cpp' -No prompt for file `master/masteredit.cpp' - -*** Action on file `master/lmaster.cpp' -No prompt for file `master/lmaster.cpp' - -*** Action on file `master/tscale.cpp' -No prompt for file `master/tscale.cpp' - -*** Action on file `master/Makefile.am' -No prompt for file `master/Makefile.am' - -*** Action on file `master/master.h' -No prompt for file `master/master.h' - -*** Action on file `master/masteredit.h' -No prompt for file `master/masteredit.h' - -*** Action on file `master/lmaster.h' -No prompt for file `master/lmaster.h' - -*** Action on file `master/tscale.h' -No prompt for file `master/tscale.h' - -*** Action on file `master/master.cpp' -No prompt for file `master/master.cpp' - -*** Action on file `marker/Makefile.am' -No prompt for file `marker/Makefile.am' - -*** Action on file `marker/marker.h' -No prompt for file `marker/marker.h' - -*** Action on file `marker/markerview.cpp' -No prompt for file `marker/markerview.cpp' - -*** Action on file `marker/markerview.h' -No prompt for file `marker/markerview.h' - -*** Action on file `marker/marker.cpp' -No prompt for file `marker/marker.cpp' - -*** Action on file `driver/audiodev.h' -No prompt for file `driver/audiodev.h' - -*** Action on file `driver/midiserial.h' -No prompt for file `driver/midiserial.h' - -*** Action on file `driver/mididev.h' -No prompt for file `driver/mididev.h' - -*** Action on file `driver/mididev.cpp' -No prompt for file `driver/mididev.cpp' - -*** Action on file `driver/midirawin.h' -No prompt for file `driver/midirawin.h' - -*** Action on file `driver/midirawdev.h' -No prompt for file `driver/midirawdev.h' - -*** Action on file `driver/alsamidi.cpp' -No prompt for file `driver/alsamidi.cpp' - -*** Action on file `driver/alsamidi.h' -No prompt for file `driver/alsamidi.h' - -*** Action on file `driver/Makefile.am' -No prompt for file `driver/Makefile.am' - -*** Action on file `driver/jack.cpp' -No prompt for file `driver/jack.cpp' - -*** Action on file `driver/midirawin.cpp' -No prompt for file `driver/midirawin.cpp' - -*** Action on file `driver/alsaaudio.h' -No prompt for file `driver/alsaaudio.h' - -*** Action on file `driver/midiserial.cpp' -No prompt for file `driver/midiserial.cpp' - -*** Action on file `driver/alsaaudio.cpp' -No prompt for file `driver/alsaaudio.cpp' - -*** Action on file `driver/midirawdev.cpp' -No prompt for file `driver/midirawdev.cpp' - -*** Action on file `driver/jackaudio.h' -No prompt for file `driver/jackaudio.h' - -*** Action on file `driver/mess.cpp' -No prompt for file `driver/mess.cpp' - -*** Action on file `midiedit/drummap.cpp' -No prompt for file `midiedit/drummap.cpp' - -*** Action on file `midiedit/dcanvas.h' -No prompt for file `midiedit/dcanvas.h' - -*** Action on file `midiedit/piano.h' -No prompt for file `midiedit/piano.h' - -*** Action on file `midiedit/drummap.h' -No prompt for file `midiedit/drummap.h' - -*** Action on file `midiedit/drumedit.h' -No prompt for file `midiedit/drumedit.h' - -*** Action on file `midiedit/prcanvas.cpp' -No prompt for file `midiedit/prcanvas.cpp' - -*** Action on file `midiedit/dcanvas.cpp' -No prompt for file `midiedit/dcanvas.cpp' - -*** Action on file `midiedit/Makefile.am' -No prompt for file `midiedit/Makefile.am' - -*** Action on file `midiedit/dlist.cpp' -No prompt for file `midiedit/dlist.cpp' - -*** Action on file `midiedit/pianoroll.cpp' -No prompt for file `midiedit/pianoroll.cpp' - -*** Action on file `midiedit/ecanvas.h' -No prompt for file `midiedit/ecanvas.h' - -*** Action on file `midiedit/quantconfig.h' -No prompt for file `midiedit/quantconfig.h' - -*** Action on file `midiedit/quantconfig.cpp' -No prompt for file `midiedit/quantconfig.cpp' - -*** Action on file `midiedit/ecanvas.cpp' -No prompt for file `midiedit/ecanvas.cpp' - -*** Action on file `midiedit/piano.cpp' -No prompt for file `midiedit/piano.cpp' - -*** Action on file `midiedit/prcanvas.h' -No prompt for file `midiedit/prcanvas.h' - -*** Action on file `midiedit/drumedit.cpp' -No prompt for file `midiedit/drumedit.cpp' - -*** Action on file `midiedit/dlist.h' -No prompt for file `midiedit/dlist.h' - -*** Action on file `midiedit/cmd.h' -No prompt for file `midiedit/cmd.h' - -*** Action on file `midiedit/pianoroll.h' -No prompt for file `midiedit/pianoroll.h' - -*** Action on file `patchbay/Makefile.am' -No prompt for file `patchbay/Makefile.am' - -*** Action on file `patchbay/patchbay.cpp' -No prompt for file `patchbay/patchbay.cpp' - -*** Action on file `patchbay/patchbaybase.ui' -No prompt for file `patchbay/patchbaybase.ui' - -*** Action on file `patchbay/patchbay.h' -No prompt for file `patchbay/patchbay.h' - -*** Action on file `synti/synth.cpp' -No prompt for file `synti/synth.cpp' - -*** Action on file `synti/synthconfig.h' -No prompt for file `synti/synthconfig.h' - -*** Action on file `synti/Makefile.am' -No prompt for file `synti/Makefile.am' - -*** Action on file `synti/synti-install.am' -No prompt for file `synti/synti-install.am' - -*** Action on file `synti/synthconfig.cpp' -No prompt for file `synti/synthconfig.cpp' - -*** Action on file `synti/organ/.cvsignore' -No prompt for file `synti/organ/.cvsignore' - -*** Action on file `synti/organ/organ.cpp' -No prompt for file `synti/organ/organ.cpp' - -*** Action on file `synti/organ/organ.h' -No prompt for file `synti/organ/organ.h' - -*** Action on file `synti/organ/organguibase.ui' -No prompt for file `synti/organ/organguibase.ui' - -*** Action on file `synti/organ/Makefile.am' -No prompt for file `synti/organ/Makefile.am' - -*** Action on file `synti/organ/organgui.h' -No prompt for file `synti/organ/organgui.h' - -*** Action on file `synti/organ/fdialogbuttons.ui' -No prompt for file `synti/organ/fdialogbuttons.ui' - -*** Action on file `synti/organ/organgui.cpp' -No prompt for file `synti/organ/organgui.cpp' - -*** Action on file `synti/fluid/fluidgui.cpp' -No prompt for file `synti/fluid/fluidgui.cpp' - -*** Action on file `synti/fluid/fluidguibase.ui' -No prompt for file `synti/fluid/fluidguibase.ui' - -*** Action on file `synti/fluid/synth.cpp' -No prompt for file `synti/fluid/synth.cpp' - -*** Action on file `synti/fluid/Makefile.am' -No prompt for file `synti/fluid/Makefile.am' - -*** Action on file `synti/fluid/synth.h' -No prompt for file `synti/fluid/synth.h' - -*** Action on file `synti/fluid/fluid.cpp' -No prompt for file `synti/fluid/fluid.cpp' - -*** Action on file `synti/fluid/fluidgui.h' -No prompt for file `synti/fluid/fluidgui.h' - -*** Action on file `synti/fluidsynth/fluidsynthgui.h' -No prompt for file `synti/fluidsynth/fluidsynthgui.h' - -*** Action on file `synti/fluidsynth/fluidsynti.h' -No prompt for file `synti/fluidsynth/fluidsynti.h' - -*** Action on file `synti/fluidsynth/fluidsynti.cpp' -No prompt for file `synti/fluidsynth/fluidsynti.cpp' - -*** Action on file `synti/fluidsynth/fluidsynthguibase.ui' -No prompt for file `synti/fluidsynth/fluidsynthguibase.ui' - -*** Action on file `synti/fluidsynth/Makefile.am' -No prompt for file `synti/fluidsynth/Makefile.am' - -*** Action on file `synti/fluidsynth/fluidsynthgui.cpp' -No prompt for file `synti/fluidsynth/fluidsynthgui.cpp' - -*** Action on file `synti/fluidsynth/TODO' -No prompt for file `synti/fluidsynth/TODO' - -*** Action on file `synti/vam/vamgui.cpp' -No prompt for file `synti/vam/vamgui.cpp' - -*** Action on file `synti/vam/COPYING' -No prompt for file `synti/vam/COPYING' - -*** Action on file `synti/vam/ChangeLog' -No prompt for file `synti/vam/ChangeLog' - -*** Action on file `synti/vam/vamgui.h' -No prompt for file `synti/vam/vamgui.h' - -*** Action on file `synti/vam/vam.cpp' -No prompt for file `synti/vam/vam.cpp' - -*** Action on file `synti/vam/Makefile.am' -No prompt for file `synti/vam/Makefile.am' - -*** Action on file `synti/vam/fdialogbuttons.ui' -No prompt for file `synti/vam/fdialogbuttons.ui' - -*** Action on file `synti/vam/README' -No prompt for file `synti/vam/README' - -*** Action on file `synti/vam/vam.h' -No prompt for file `synti/vam/vam.h' - -*** Action on file `synti/vam/vamguibase.ui' -No prompt for file `synti/vam/vamguibase.ui' - -*** Action on file `synti/vam/TODO' -No prompt for file `synti/vam/TODO' - -*** Action on file `synti/s1/s1.cpp' -No prompt for file `synti/s1/s1.cpp' - -*** Action on file `synti/s1/Makefile.am' -No prompt for file `synti/s1/Makefile.am' - -*** Action on file `share/Makefile.am' -No prompt for file `share/Makefile.am' - -*** Action on file `share/plugins/1050.ui' -No prompt for file `share/plugins/1050.ui' - -*** Action on file `share/plugins/Makefile.am' -No prompt for file `share/plugins/Makefile.am' - -*** Action on file `share/instruments/Yamaha-P50m.idf' -No prompt for file `share/instruments/Yamaha-P50m.idf' - -*** Action on file `share/instruments/ns5r.idf' -No prompt for file `share/instruments/ns5r.idf' - -*** Action on file `share/instruments/Roland-XP30.idf' -No prompt for file `share/instruments/Roland-XP30.idf' - -*** Action on file `share/instruments/MC303.idf' -No prompt for file `share/instruments/MC303.idf' - -*** Action on file `share/instruments/Makefile.am' -No prompt for file `share/instruments/Makefile.am' - -*** Action on file `share/instruments/gm.idf' -No prompt for file `share/instruments/gm.idf' - -*** Action on file `share/instruments/Yamaha-S90.idf' -No prompt for file `share/instruments/Yamaha-S90.idf' - -*** Action on file `share/instruments/AlesisQS6.idf' -No prompt for file `share/instruments/AlesisQS6.idf' - -*** Action on file `share/drummaps/Makefile.am' -No prompt for file `share/drummaps/Makefile.am' - -*** Action on file `share/drummaps/sc88-pc1.map' -No prompt for file `share/drummaps/sc88-pc1.map' - -*** Action on file `share/locale/Makefile.am' -No prompt for file `share/locale/Makefile.am' - -*** Action on file `share/locale/muse_sv_SE.ts' -No prompt for file `share/locale/muse_sv_SE.ts' - -*** Action on file `share/locale/muse_ru.ts' -No prompt for file `share/locale/muse_ru.ts' - -*** Action on file `share/locale/muse_fr.ts' -No prompt for file `share/locale/muse_fr.ts' - -*** Action on file `share/locale/muse_es.ts' -No prompt for file `share/locale/muse_es.ts' - -*** Action on file `share/locale/muse_de.ts' -No prompt for file `share/locale/muse_de.ts' - -*** Action on file `share/locale/muse_sv_SE.qm' -No prompt for file `share/locale/muse_sv_SE.qm' - -*** Action on file `share/locale/muse_ru.qm' -No prompt for file `share/locale/muse_ru.qm' - -*** Action on file `share/locale/muse_fr.qm' -No prompt for file `share/locale/muse_fr.qm' - -*** Action on file `share/locale/muse_es.qm' -No prompt for file `share/locale/muse_es.qm' - -*** Action on file `share/locale/muse_de.qm' -No prompt for file `share/locale/muse_de.qm' - -*** Action on file `share/wallpapers/paper1.jpg' -No prompt for file `share/wallpapers/paper1.jpg' - -*** Action on file `share/wallpapers/Makefile.am' -No prompt for file `share/wallpapers/Makefile.am' - -*** Action on file `share/wallpapers/gray_rock.gif' -No prompt for file `share/wallpapers/gray_rock.gif' - -*** Action on file `share/wallpapers/gray.gif' -No prompt for file `share/wallpapers/gray.gif' - -*** Action on file `share/wallpapers/gray_stucco.gif' -No prompt for file `share/wallpapers/gray_stucco.gif' - -*** Action on file `share/wallpapers/stone1.gif' -No prompt for file `share/wallpapers/stone1.gif' - -*** Action on file `share/html/invocation.html' -No prompt for file `share/html/invocation.html' - -*** Action on file `share/html/left_pane.jpg' -No prompt for file `share/html/left_pane.jpg' - -*** Action on file `share/html/styles.css' -No prompt for file `share/html/styles.css' - -*** Action on file `share/html/button_bar.jpg' -No prompt for file `share/html/button_bar.jpg' - -*** Action on file `share/html/COPYING.html' -No prompt for file `share/html/COPYING.html' - -*** Action on file `share/html/main_window.jpg' -No prompt for file `share/html/main_window.jpg' - -*** Action on file `share/html/toc_.txt' -No prompt for file `share/html/toc_.txt' - -*** Action on file `share/html/Makefile.am' -No prompt for file `share/html/Makefile.am' - -*** Action on file `share/html/track_info.jpg' -No prompt for file `share/html/track_info.jpg' - -*** Action on file `share/html/getting_started.html' -No prompt for file `share/html/getting_started.html' - -*** Action on file `share/html/index.html' -No prompt for file `share/html/index.html' - -*** Action on file `share/html/window_ref.html' -No prompt for file `share/html/window_ref.html' - -*** Action on file `share/html/installation.html' -No prompt for file `share/html/installation.html' - -*** Action on file `share/html/main_window_track_info.jpg' -No prompt for file `share/html/main_window_track_info.jpg' - -*** Action on file `share/html/right_pane.jpg' -No prompt for file `share/html/right_pane.jpg' - -*** Action on file `score/Makefile.am' -No prompt for file `score/Makefile.am' - -*** Action on file `score/ncanvas.cpp' -No prompt for file `score/ncanvas.cpp' - -*** Action on file `score/print.cpp' -No prompt for file `score/print.cpp' - -*** Action on file `score/print.h' -No prompt for file `score/print.h' - -*** Action on file `score/layout.h' -No prompt for file `score/layout.h' - -*** Action on file `score/items.h' -No prompt for file `score/items.h' - -*** Action on file `score/papersize.cpp' -No prompt for file `score/papersize.cpp' - -*** Action on file `score/symbols.cpp' -No prompt for file `score/symbols.cpp' - -*** Action on file `score/layout.cpp' -No prompt for file `score/layout.cpp' - -*** Action on file `score/glyphs.cpp' -No prompt for file `score/glyphs.cpp' - -*** Action on file `score/papersize.h' -No prompt for file `score/papersize.h' - -*** Action on file `score/palettes.h' -No prompt for file `score/palettes.h' - -*** Action on file `score/glyphs.h' -No prompt for file `score/glyphs.h' - -*** Action on file `score/ncanvas.h' -No prompt for file `score/ncanvas.h' - -*** Action on file `score/score.doc' -No prompt for file `score/score.doc' - -*** Action on file `score/score.cpp' -No prompt for file `score/score.cpp' - -*** Action on file `score/items.cpp' -No prompt for file `score/items.cpp' - -*** Action on file `score/sconfig.h' -No prompt for file `score/sconfig.h' - -*** Action on file `score/symbols.h' -No prompt for file `score/symbols.h' - -*** Action on file `score/font.cpp' -No prompt for file `score/font.cpp' - -*** Action on file `score/sconfig.cpp' -No prompt for file `score/sconfig.cpp' - -*** Action on file `score/score.h' -No prompt for file `score/score.h' - -*** Action on file `score/palettes.cpp' -No prompt for file `score/palettes.cpp' - -*** Action on file `score/quant.cpp' -No prompt for file `score/quant.cpp' - -*** Action on file `score/quant.h' -No prompt for file `score/quant.h' - -*** Action on file `score/note.cpp' -No prompt for file `score/note.cpp' - -*** Action on file `mixer/Makefile.am' -No prompt for file `mixer/Makefile.am' - -*** Action on file `mixer/amixer.h' -No prompt for file `mixer/amixer.h' - -*** Action on file `mixer/meter.cpp' -No prompt for file `mixer/meter.cpp' - -*** Action on file `mixer/mixer.cpp' -No prompt for file `mixer/mixer.cpp' - -*** Action on file `mixer/routecombo.cpp' -No prompt for file `mixer/routecombo.cpp' - -*** Action on file `mixer/volslider.h' -No prompt for file `mixer/volslider.h' - -*** Action on file `mixer/rack.h' -No prompt for file `mixer/rack.h' - -*** Action on file `mixer/mixer.h' -No prompt for file `mixer/mixer.h' - -*** Action on file `mixer/panknob.h' -No prompt for file `mixer/panknob.h' - -*** Action on file `mixer/panknob.cpp' -No prompt for file `mixer/panknob.cpp' - -*** Action on file `mixer/amixer.cpp' -No prompt for file `mixer/amixer.cpp' - -*** Action on file `mixer/meter.h' -No prompt for file `mixer/meter.h' - -*** Action on file `mixer/rack.cpp' -No prompt for file `mixer/rack.cpp' - -*** Action on file `mixer/routecombo.h' -No prompt for file `mixer/routecombo.h' - -*** Action on file `mixer/audionodebutton.h' -No prompt for file `mixer/audionodebutton.h' - -*** Action on file `mixer/dot.xpm' -No prompt for file `mixer/dot.xpm' - -*** Action on file `mixer/volslider.cpp' -No prompt for file `mixer/volslider.cpp' - -*** Action on file `mixer/audionodebutton.cpp' -No prompt for file `mixer/audionodebutton.cpp' - -*** Action on file `liste/editevent.cpp' -No prompt for file `liste/editevent.cpp' - -*** Action on file `liste/editevent.h' -No prompt for file `liste/editevent.h' - -*** Action on file `liste/Makefile.am' -No prompt for file `liste/Makefile.am' - -*** Action on file `liste/listedit.h' -No prompt for file `liste/listedit.h' - -*** Action on file `liste/listedit.cpp' -No prompt for file `liste/listedit.cpp' - -*** Action on file `ctrl/Makefile.am' -No prompt for file `ctrl/Makefile.am' - -*** Action on file `ctrl/ctrlcanvas.cpp' -No prompt for file `ctrl/ctrlcanvas.cpp' - -*** Action on file `ctrl/ctrlpanel.h' -No prompt for file `ctrl/ctrlpanel.h' - -*** Action on file `ctrl/ctrlcanvas.h' -No prompt for file `ctrl/ctrlcanvas.h' - -*** Action on file `ctrl/ctrledit.h' -No prompt for file `ctrl/ctrledit.h' - -*** Action on file `ctrl/ctrledit.cpp' -No prompt for file `ctrl/ctrledit.cpp' - -*** Action on file `ctrl/ctrlpanel.cpp' -No prompt for file `ctrl/ctrlpanel.cpp' - -*** Action on file `xpm/darkreddot.xpm' -No prompt for file `xpm/darkreddot.xpm' - -*** Action on file `xpm/editmuteS.xpm' -No prompt for file `xpm/editmuteS.xpm' - -*** Action on file `xpm/midiin.xpm' -No prompt for file `xpm/midiin.xpm' - -*** Action on file `xpm/editpasteS.xpm' -No prompt for file `xpm/editpasteS.xpm' - -*** Action on file `xpm/pitch.xpm' -No prompt for file `xpm/pitch.xpm' - -*** Action on file `xpm/italic.xpm' -No prompt for file `xpm/italic.xpm' - -*** Action on file `xpm/redo.xpm' -No prompt for file `xpm/redo.xpm' - -*** Action on file `xpm/filesaveS.xpm' -No prompt for file `xpm/filesaveS.xpm' - -*** Action on file `xpm/scoreS.xpm' -No prompt for file `xpm/scoreS.xpm' - -*** Action on file `xpm/exit.xpm' -No prompt for file `xpm/exit.xpm' - -*** Action on file `xpm/rmark.xpm' -No prompt for file `xpm/rmark.xpm' - -*** Action on file `xpm/frewind.xpm' -No prompt for file `xpm/frewind.xpm' - -*** Action on file `xpm/stop.xpm' -No prompt for file `xpm/stop.xpm' - -*** Action on file `xpm/graydot.xpm' -No prompt for file `xpm/graydot.xpm' - -*** Action on file `xpm/loop.xpm' -No prompt for file `xpm/loop.xpm' - -*** Action on file `xpm/steprec.xpm' -No prompt for file `xpm/steprec.xpm' - -*** Action on file `xpm/recordoffbutton.xpm' -No prompt for file `xpm/recordoffbutton.xpm' - -*** Action on file `xpm/filenewS.xpm' -No prompt for file `xpm/filenewS.xpm' - -*** Action on file `xpm/bold.xpm' -No prompt for file `xpm/bold.xpm' - -*** Action on file `xpm/fileopen.xpm' -No prompt for file `xpm/fileopen.xpm' - -*** Action on file `xpm/editpaste.xpm' -No prompt for file `xpm/editpaste.xpm' - -*** Action on file `xpm/speaker.xpm' -No prompt for file `xpm/speaker.xpm' - -*** Action on file `xpm/delete.xpm' -No prompt for file `xpm/delete.xpm' - -*** Action on file `xpm/pianoS.xpm' -No prompt for file `xpm/pianoS.xpm' - -*** Action on file `xpm/start.xpm' -No prompt for file `xpm/start.xpm' - -*** Action on file `xpm/punchin.xpm' -No prompt for file `xpm/punchin.xpm' - -*** Action on file `xpm/fileprint.xpm' -No prompt for file `xpm/fileprint.xpm' - -*** Action on file `xpm/editcopy.xpm' -No prompt for file `xpm/editcopy.xpm' - -*** Action on file `xpm/play.xpm' -No prompt for file `xpm/play.xpm' - -*** Action on file `xpm/filesaveasS.xpm' -No prompt for file `xpm/filesaveasS.xpm' - -*** Action on file `xpm/stick.xpm' -No prompt for file `xpm/stick.xpm' - -*** Action on file `xpm/fforward.xpm' -No prompt for file `xpm/fforward.xpm' - -*** Action on file `xpm/lock.xpm' -No prompt for file `xpm/lock.xpm' - -*** Action on file `xpm/back.xpm' -No prompt for file `xpm/back.xpm' - -*** Action on file `xpm/up.xpm' -No prompt for file `xpm/up.xpm' - -*** Action on file `xpm/cafter.xpm' -No prompt for file `xpm/cafter.xpm' - -*** Action on file `xpm/recordonbutton.xpm' -No prompt for file `xpm/recordonbutton.xpm' - -*** Action on file `xpm/flag.xpm' -No prompt for file `xpm/flag.xpm' - -*** Action on file `xpm/off.xpm' -No prompt for file `xpm/off.xpm' - -*** Action on file `xpm/editcutS.xpm' -No prompt for file `xpm/editcutS.xpm' - -*** Action on file `xpm/editmute.xpm' -No prompt for file `xpm/editmute.xpm' - -*** Action on file `xpm/pencil.xpm' -No prompt for file `xpm/pencil.xpm' - -*** Action on file `xpm/pointer.xpm' -No prompt for file `xpm/pointer.xpm' - -*** Action on file `xpm/wave.xpm' -No prompt for file `xpm/wave.xpm' - -*** Action on file `xpm/undoS.xpm' -No prompt for file `xpm/undoS.xpm' - -*** Action on file `xpm/loop1.xpm' -No prompt for file `xpm/loop1.xpm' - -*** Action on file `xpm/score.xpm' -No prompt for file `xpm/score.xpm' - -*** Action on file `xpm/glue.xpm' -No prompt for file `xpm/glue.xpm' - -*** Action on file `xpm/Makefile.am' -No prompt for file `xpm/Makefile.am' - -*** Action on file `xpm/gv.xpm' -No prompt for file `xpm/gv.xpm' - -*** Action on file `xpm/redoS.xpm' -No prompt for file `xpm/redoS.xpm' - -*** Action on file `xpm/toc.xpm' -No prompt for file `xpm/toc.xpm' - -*** Action on file `xpm/greendot.xpm' -No prompt for file `xpm/greendot.xpm' - -*** Action on file `xpm/configure.xpm' -No prompt for file `xpm/configure.xpm' - -*** Action on file `xpm/forward.xpm' -No prompt for file `xpm/forward.xpm' - -*** Action on file `xpm/underlined.xpm' -No prompt for file `xpm/underlined.xpm' - -*** Action on file `xpm/home.xpm' -No prompt for file `xpm/home.xpm' - -*** Action on file `xpm/record1.xpm' -No prompt for file `xpm/record1.xpm' - -*** Action on file `xpm/lmark.xpm' -No prompt for file `xpm/lmark.xpm' - -*** Action on file `xpm/record.xpm' -No prompt for file `xpm/record.xpm' - -*** Action on file `xpm/mute.xpm' -No prompt for file `xpm/mute.xpm' - -*** Action on file `xpm/darkgreendot.xpm' -No prompt for file `xpm/darkgreendot.xpm' - -*** Action on file `xpm/find.xpm' -No prompt for file `xpm/find.xpm' - -*** Action on file `xpm/reddot.xpm' -No prompt for file `xpm/reddot.xpm' - -*** Action on file `xpm/punchout.xpm' -No prompt for file `xpm/punchout.xpm' - -*** Action on file `xpm/panic.xpm' -No prompt for file `xpm/panic.xpm' - -*** Action on file `xpm/fileprintS.xpm' -No prompt for file `xpm/fileprintS.xpm' - -*** Action on file `xpm/draw.xpm' -No prompt for file `xpm/draw.xpm' - -*** Action on file `xpm/filesave.xpm' -No prompt for file `xpm/filesave.xpm' - -*** Action on file `xpm/filenew.xpm' -No prompt for file `xpm/filenew.xpm' - -*** Action on file `xpm/piano.xpm' -No prompt for file `xpm/piano.xpm' - -*** Action on file `xpm/solobutton.xpm' -No prompt for file `xpm/solobutton.xpm' - -*** Action on file `xpm/punchin1.xpm' -No prompt for file `xpm/punchin1.xpm' - -*** Action on file `xpm/idea.xpm' -No prompt for file `xpm/idea.xpm' - -*** Action on file `xpm/editcut.xpm' -No prompt for file `xpm/editcut.xpm' - -*** Action on file `xpm/editcopyS.xpm' -No prompt for file `xpm/editcopyS.xpm' - -*** Action on file `xpm/cmark.xpm' -No prompt for file `xpm/cmark.xpm' - -*** Action on file `xpm/fileopenS.xpm' -No prompt for file `xpm/fileopenS.xpm' - -*** Action on file `xpm/ctrl.xpm' -No prompt for file `xpm/ctrl.xpm' - -*** Action on file `xpm/note1.xpm' -No prompt for file `xpm/note1.xpm' - -*** Action on file `xpm/context_help.xpm' -No prompt for file `xpm/context_help.xpm' - -*** Action on file `xpm/exitS.xpm' -No prompt for file `xpm/exitS.xpm' - -*** Action on file `xpm/flagS.xpm' -No prompt for file `xpm/flagS.xpm' - -*** Action on file `xpm/iiwusynth.xpm' -No prompt for file `xpm/iiwusynth.xpm' - -*** Action on file `xpm/sysex.xpm' -No prompt for file `xpm/sysex.xpm' - -*** Action on file `xpm/down.xpm' -No prompt for file `xpm/down.xpm' - -*** Action on file `xpm/dot.xpm' -No prompt for file `xpm/dot.xpm' - -*** Action on file `xpm/quant.xpm' -No prompt for file `xpm/quant.xpm' - -*** Action on file `xpm/doth.xpm' -No prompt for file `xpm/doth.xpm' - -*** Action on file `xpm/punchout1.xpm' -No prompt for file `xpm/punchout1.xpm' - -*** Action on file `xpm/cut.xpm' -No prompt for file `xpm/cut.xpm' - -*** Action on file `xpm/note.xpm' -No prompt for file `xpm/note.xpm' - -*** Action on file `xpm/buttondown.xpm' -No prompt for file `xpm/buttondown.xpm' - -*** Action on file `xpm/dot1.xpm' -No prompt for file `xpm/dot1.xpm' - -*** Action on file `xpm/meta.xpm' -No prompt for file `xpm/meta.xpm' - -*** Action on file `xpm/undo.xpm' -No prompt for file `xpm/undo.xpm' - -*** Action on file `xpm/master.xpm' -No prompt for file `xpm/master.xpm' - -*** Action on file `xpm/bluedot.xpm' -No prompt for file `xpm/bluedot.xpm' - -*** Action on file `xpm/newmutebutton.xpm' -No prompt for file `xpm/newmutebutton.xpm' - -*** Action on file `xpm/pafter.xpm' -No prompt for file `xpm/pafter.xpm' - -*** Action on file `lib/plugins/Makefile.am' -No prompt for file `lib/plugins/Makefile.am' - -*** Action on file `lib/synthi/Makefile.am' -No prompt for file `lib/synthi/Makefile.am' - -*** Action on file `lib/Makefile.am' -No prompt for file `lib/Makefile.am' - -*** Action on file `cliplist/cliplist.cpp' -No prompt for file `cliplist/cliplist.cpp' - -*** Action on file `cliplist/Makefile.am' -No prompt for file `cliplist/Makefile.am' - -*** Action on file `cliplist/cliplist.h' -No prompt for file `cliplist/cliplist.h' - -*** Action on file `doc/midieditfunctions.png' -No prompt for file `doc/midieditfunctions.png' - -*** Action on file `doc/Makefile.am' -No prompt for file `doc/Makefile.am' - -*** Action on file `doc/muse.sgm' -No prompt for file `doc/muse.sgm' - -*** Action on file `plugins/Makefile.am' -No prompt for file `plugins/Makefile.am' - -*** Action on file `plugins/plugin.h' -No prompt for file `plugins/plugin.h' - -*** Action on file `plugins/plugin.cpp' -No prompt for file `plugins/plugin.cpp' - -*** Action on file `plugins/plugins-install.am' -No prompt for file `plugins/plugins-install.am' - -*** Action on file `plugins/freeverb/denormals.h' -No prompt for file `plugins/freeverb/denormals.h' - -*** Action on file `plugins/freeverb/tuning.h' -No prompt for file `plugins/freeverb/tuning.h' - -*** Action on file `plugins/freeverb/readme.txt' -No prompt for file `plugins/freeverb/readme.txt' - -*** Action on file `plugins/freeverb/revmodel.h' -No prompt for file `plugins/freeverb/revmodel.h' - -*** Action on file `plugins/freeverb/Makefile.am' -No prompt for file `plugins/freeverb/Makefile.am' - -*** Action on file `plugins/freeverb/comb.h' -No prompt for file `plugins/freeverb/comb.h' - -*** Action on file `plugins/freeverb/freeverb.cpp' -No prompt for file `plugins/freeverb/freeverb.cpp' - -*** Action on file `plugins/freeverb/allpass.h' -No prompt for file `plugins/freeverb/allpass.h' - -*** Action on file `plugins/freeverb/revmodel.cpp' -No prompt for file `plugins/freeverb/revmodel.cpp' - -*** Action on file `midictrledit.h' -No prompt for file `midictrledit.h' - - -*** Merge complete - diff --git a/muse2/muse/muse.pro b/muse2/muse/muse.pro deleted file mode 100644 index 2931e82d..00000000 --- a/muse2/muse/muse.pro +++ /dev/null @@ -1,370 +0,0 @@ -HEADERS = \ - ./ctrl/ctrledit.h \ - ./ctrl/ctrlcanvas.h \ - ./ctrl/ctrlpanel.h \ - ./debug.h \ - ./midiport.h \ - ./app.h \ - ./eventbase.h \ - ./key.h \ - ./liste/listedit.h \ - ./liste/editevent.h \ - ./mixer/mstrip.h \ - ./mixer/auxknob.h \ - ./mixer/meter.h \ - ./mixer/panknob.h \ - ./mixer/strip.h \ - ./mixer/rack.h \ - ./mixer/routedialog.h \ - ./mixer/amixer.h \ - ./mixer/astrip.h \ - ./mtc.h \ - ./pos.h \ - ./sig.h \ - ./xml.h \ - ./miditransform.h \ - ./route.h \ - ./globaldefs.h \ - ./appearance.h \ - ./midievent.h \ - ./midieditor.h \ - ./confmport.h \ - ./patchbay/patchbay.h \ - ./tempo.h \ - ./audioprefetch.h \ - ./event.h \ - ./waveevent.h \ - ./midiedit/pianoroll.h \ - ./midiedit/cmd.h \ - ./midiedit/dlist.h \ - ./midiedit/prcanvas.h \ - ./midiedit/quantconfig.h \ - ./midiedit/ecanvas.h \ - ./midiedit/drumedit.h \ - ./midiedit/drummap.h \ - ./midiedit/piano.h \ - ./midiedit/dcanvas.h \ - ./conf.h \ - ./ctrl.h \ - ./driver/jackaudio.h \ - ./driver/alsamidi.h \ - ./driver/audiodev.h \ - ./fastlog.h \ - ./mpevent.h \ - ./synth.h \ - ./cobject.h \ - ./track.h \ - ./evdata.h \ - ./marker/markerview.h \ - ./marker/marker.h \ - ./master/tscale.h \ - ./master/lmaster.h \ - ./master/masteredit.h \ - ./master/master.h \ - ./gconfig.h \ - ./midi.h \ - ./waveedit/waveedit.h \ - ./waveedit/waveview.h \ - ./mplugins/midifilterimpl.h \ - ./mplugins/mittranspose.h \ - ./mplugins/random.h \ - ./mplugins/mrconfig.h \ - ./mplugins/midiitransform.h \ - ./mplugins/rhythm.h \ - ./mplugins/mitplugin.h \ - ./node.h \ - ./part.h \ - ./value.h \ - ./song.h \ - ./sync.h \ - ./undo.h \ - ./ladspa.h \ - ./wave.h \ - ./device.h \ - ./instruments/midictrledit.h \ - ./instruments/minstrument.h \ - ./instruments/editinstrument.h \ - ./icons.h \ - ./thread.h \ - ./arranger/tlist.h \ - ./arranger/arranger.h \ - ./arranger/alayout.h \ - ./arranger/pcanvas.h \ - ./globals.h \ - ./audio.h \ - ./transpose.h \ - ./transport.h \ - ./widgets/section.h \ - ./widgets/mixdowndialog.h \ - ./widgets/dimap.h \ - ./widgets/fontsel.h \ - ./widgets/lcombo.h \ - ./widgets/pitchedit.h \ - ./widgets/tb1.h \ - ./widgets/gatetime.h \ - ./widgets/comboQuant.h \ - ./widgets/ctrlcombo.h \ - ./widgets/comment.h \ - ./widgets/filedialog.h \ - ./widgets/sclif.h \ - ./widgets/scrollscale.h \ - ./widgets/bigtime.h \ - ./widgets/metronome.h \ - ./widgets/combobox.h \ - ./widgets/ttoolbutton.h \ - ./widgets/drange.h \ - ./widgets/scldiv.h \ - ./widgets/vscale.h \ - ./widgets/posedit.h \ - ./widgets/genset.h \ - ./widgets/shortcutcapturedialog.h \ - ./widgets/wtscale.h \ - ./widgets/mmath.h \ - ./widgets/canvas.h \ - ./widgets/shortcutconfig.h \ - ./widgets/pitchlabel.h \ - ./widgets/tools.h \ - ./widgets/swidget.h \ - ./widgets/splitter.h \ - ./widgets/knob.h \ - ./widgets/poslabel.h \ - ./widgets/velocity.h \ - ./widgets/midisyncimpl.h \ - ./widgets/ttoolbar.h \ - ./widgets/nentry.h \ - ./widgets/action.h \ - ./widgets/slider.h \ - ./widgets/dentry.h \ - ./widgets/siglabel.h \ - ./widgets/checkbox.h \ - ./widgets/mtscale.h \ - ./widgets/spinboxFP.h \ - ./widgets/view.h \ - ./widgets/sigscale.h \ - ./widgets/noteinfo.h \ - ./widgets/doublelabel.h \ - ./widgets/utils.h \ - ./widgets/hitscale.h \ - ./widgets/intlabel.h \ - ./widgets/sigedit.h \ - ./widgets/mlabel.h \ - ./widgets/header.h \ - ./widgets/tempolabel.h \ - ./widgets/sliderbase.h \ - ./widgets/scldraw.h \ - ./widgets/citem.h \ - ./widgets/songinfo.h \ - ./mididev.h \ - ./midictrl.h \ - ./midiseq.h \ - ./midifile.h \ - ./shortcuts.h \ - ./memory.h \ - ./helper.h \ - ./plugin.h - -SOURCES = \ - ./ctrl/ctrlpanel.cpp \ - ./ctrl/ctrledit.cpp \ - ./ctrl/ctrlcanvas.cpp \ - ./route.cpp \ - ./undo.cpp \ - ./midievent.cpp \ - ./xml.cpp \ - ./memory.cpp \ - ./key.cpp \ - ./midiseq.cpp \ - ./song.cpp \ - ./liste/listedit.cpp \ - ./liste/editevent.cpp \ - ./mixer/strip.cpp \ - ./mixer/auxknob.cpp \ - ./mixer/rack.cpp \ - ./mixer/amixer.cpp \ - ./mixer/routedialog.cpp \ - ./mixer/panknob.cpp \ - ./mixer/mstrip.cpp \ - ./mixer/astrip.cpp \ - ./mixer/meter.cpp \ - ./transpose.cpp \ - ./eventlist.cpp \ - ./transport.cpp \ - ./wavetrack.cpp \ - ./audioprefetch.cpp \ - ./helper.cpp \ - ./miditransform.cpp \ - ./ctrl.cpp \ - ./sig.cpp \ - ./confmport.cpp \ - ./shortcuts.cpp \ - ./audio.cpp \ - ./part.cpp \ - ./patchbay/patchbay.cpp \ - ./appearance.cpp \ - ./mpevent.cpp \ - ./midi.cpp \ - ./event.cpp \ - ./midiedit/drumedit.cpp \ - ./midiedit/piano.cpp \ - ./midiedit/ecanvas.cpp \ - ./midiedit/quantconfig.cpp \ - ./midiedit/pianoroll.cpp \ - ./midiedit/dlist.cpp \ - ./midiedit/dcanvas.cpp \ - ./midiedit/prcanvas.cpp \ - ./midiedit/drummap.cpp \ - ./plugin.cpp \ - ./conf.cpp \ - ./driver/jack.cpp \ - ./driver/alsamidi.cpp \ - ./driver/dummyaudio.cpp \ - ./midictrl.cpp \ - ./songfile.cpp \ - ./gconfig.cpp \ - ./mtc.cpp \ - ./marker/marker.cpp \ - ./marker/markerview.cpp \ - ./master/master.cpp \ - ./master/tscale.cpp \ - ./master/lmaster.cpp \ - ./master/masteredit.cpp \ - ./sync.cpp \ - ./wave.cpp \ - ./midieditor.cpp \ - ./waveedit/waveview.cpp \ - ./waveedit/waveedit.cpp \ - ./mplugins/mitplugin.cpp \ - ./mplugins/midiitransform.cpp \ - ./mplugins/mrconfig.cpp \ - ./mplugins/mittranspose.cpp \ - ./mplugins/midifilterimpl.cpp \ - ./cobject.cpp \ - ./midifile.cpp \ - ./midiport.cpp \ - ./exportmidi.cpp \ - ./value.cpp \ - ./synth.cpp \ - ./waveevent.cpp \ - ./icons.cpp \ - ./instruments/minstrument.cpp \ - ./instruments/editinstrument.cpp \ - ./instruments/midictrledit.cpp \ - ./app.cpp \ - ./arranger/arranger.cpp \ - ./arranger/trackinfo.cpp \ - ./arranger/pcanvas.cpp \ - ./arranger/alayout.cpp \ - ./arranger/tlist.cpp \ - ./audiotrack.cpp \ - ./seqmsg.cpp \ - ./widgets/swidget.cpp \ - ./widgets/ttoolbutton.cpp \ - ./widgets/siglabel.cpp \ - ./widgets/pitchedit.cpp \ - ./widgets/knob.cpp \ - ./widgets/tempolabel.cpp \ - ./widgets/dentry.cpp \ - ./widgets/midisyncimpl.cpp \ - ./widgets/musewidgetsplug.cpp \ - ./widgets/scldiv.cpp \ - ./widgets/pitchlabel.cpp \ - ./widgets/tools.cpp \ - ./widgets/poslabel.cpp \ - ./widgets/scldraw.cpp \ - ./widgets/tb1.cpp \ - ./widgets/gatetime.cpp \ - ./widgets/sigscale.cpp \ - ./widgets/vscale.cpp \ - ./widgets/lcombo.cpp \ - ./widgets/noteinfo.cpp \ - ./widgets/mtscale.cpp \ - ./widgets/scrollscale.cpp \ - ./widgets/ttoolbar.cpp \ - ./widgets/slider.cpp \ - ./widgets/doublelabel.cpp \ - ./widgets/citem.cpp \ - ./widgets/intlabel.cpp \ - ./widgets/sigedit.cpp \ - ./widgets/combobox.cpp \ - ./widgets/genset.cpp \ - ./widgets/checkbox.cpp \ - ./widgets/sliderbase.cpp \ - ./widgets/comboQuant.cpp \ - ./widgets/wtscale.cpp \ - ./widgets/nentry.cpp \ - ./widgets/canvas.cpp \ - ./widgets/splitter.cpp \ - ./widgets/posedit.cpp \ - ./widgets/fontsel.cpp \ - ./widgets/mixdowndialog.cpp \ - ./widgets/ctrlcombo.cpp \ - ./widgets/comment.cpp \ - ./widgets/metronome.cpp \ - ./widgets/mlabel.cpp \ - ./widgets/spinboxFP.cpp \ - ./widgets/drange.cpp \ - ./widgets/velocity.cpp \ - ./widgets/shortcutconfig.cpp \ - ./widgets/header.cpp \ - ./widgets/hitscale.cpp \ - ./widgets/view.cpp \ - ./widgets/bigtime.cpp \ - ./widgets/filedialog.cpp \ - ./widgets/sclif.cpp \ - ./widgets/utils.cpp \ - ./widgets/dimap.cpp \ - ./widgets/mmath.cpp \ - ./mididev.cpp \ - ./node.cpp \ - ./track.cpp \ - ./pos.cpp \ - ./globals.cpp \ - ./importmidi.cpp \ - ./thread.cpp \ - ./help.cpp \ - ./tempo.cpp - -FORMS = \ - ./liste/editctrlbase.ui \ - ./mixer/midiportroutebase.ui \ - ./mixer/routedialogbase.ui \ - ./patchbay/patchbaybase.ui \ - ./mplugins/mrconfigbase.ui \ - ./mplugins/midifilter.ui \ - ./mplugins/rhythmbase.ui \ - ./instruments/editinstrumentbase.ui \ - ./instruments/ccontrolbase.ui \ - ./widgets/synthconfigbase.ui \ - ./widgets/mixdowndialogbase.ui \ - ./widgets/aboutbox.ui \ - ./widgets/editnotedialogbase.ui \ - ./widgets/commentbase.ui \ - ./widgets/fdialogbuttons.ui \ - ./widgets/metronomebase.ui \ - ./widgets/gensetbase.ui \ - ./widgets/shortcutcapturedialogbase.ui \ - ./widgets/mtrackinfobase.ui \ - ./widgets/editmetadialogbase.ui \ - ./widgets/gatetimebase.ui \ - ./widgets/configmidifilebase.ui \ - ./widgets/editsysexdialogbase.ui \ - ./widgets/wtrackinfobase.ui \ - ./widgets/midisync.ui \ - ./widgets/appearancebase.ui \ - ./widgets/velocitybase.ui \ - ./widgets/cliplisteditorbase.ui \ - ./widgets/mittransposebase.ui \ - ./widgets/transformbase.ui \ - ./widgets/transposebase.ui \ - ./widgets/editctrl7dialogbase.ui \ - ./widgets/shortcutconfigbase.ui \ - ./widgets/itransformbase.ui - -TRANSLATIONS = \ - ../share/locale/muse_de.ts \ - ../share/locale/muse_fr.ts \ - ../share/locale/muse_sv_SE.ts \ - ../share/locale/muse_es.ts \ - ../share/locale/muse_ru.ts \ - ../share/locale/muse_pl.ts - diff --git a/muse2/muse/part.cpp b/muse2/muse/part.cpp index 51478928..6d273c82 100644 --- a/muse2/muse/part.cpp +++ b/muse2/muse/part.cpp @@ -648,8 +648,8 @@ int PartList::index(Part* part) } if(MusEGlobal::debugMsg) printf("PartList::index(): not found!\n"); - //return 0; - return -1; + //return 0; // don't comment this in again + return -1; // don't change that value. at least MidiEditor::addNewParts relies on this } //--------------------------------------------------------- @@ -1044,6 +1044,9 @@ void Song::cmdSplitPart(Track* track, Part* part, int tick) Part* p1; Part* p2; track->splitPart(part, tick, p1, p2); + + //song->informAboutNewParts(part, p1); // is unneccessary because of ChangePart below + song->informAboutNewParts(part, p2); startUndo(); // Indicate no undo, and do port controller values but not clone parts. diff --git a/muse2/muse/remote/pyapi.cpp b/muse2/muse/remote/pyapi.cpp index 2143faf0..c9f9470f 100644 --- a/muse2/muse/remote/pyapi.cpp +++ b/muse2/muse/remote/pyapi.cpp @@ -1127,7 +1127,7 @@ bool Song::event(QEvent* _e) break; } case QPybridgeEvent::SONG_ADD_TRACK: - song->addTrack(e->getP1()); + song->addTrack((Track::TrackType)e->getP1(), false); // Add at end of list. break; case QPybridgeEvent::SONG_CHANGE_TRACKNAME: { Track* t = this->findTrack(e->getS1()); diff --git a/muse2/muse/shortcuts.cpp b/muse2/muse/shortcuts.cpp index 24861c92..2270befa 100644 --- a/muse2/muse/shortcuts.cpp +++ b/muse2/muse/shortcuts.cpp @@ -60,12 +60,15 @@ void initShortCuts() defShrt(SHRT_TOGGLE_LOOP, Qt::Key_Slash, "Transport: Toggle Loop section", GLOBAL_SHRT, "toggle_loop"); defShrt(SHRT_START_REC, Qt::Key_Asterisk, "Transport: Toggle Record", GLOBAL_SHRT, "toggle_rec"); defShrt(SHRT_REC_CLEAR, Qt::Key_Backspace, "Transport: Clear all rec enabled tracks", GLOBAL_SHRT, "rec_clear"); - + defShrt(SHRT_FULLSCREEN, Qt::CTRL + Qt::Key_F, "Toggle fullscreen", GLOBAL_SHRT, "fullscreen"); + defShrt(SHRT_COPY, Qt::CTRL + Qt::Key_C, "Edit: Copy", INVIS_SHRT, "copy"); + defShrt(SHRT_COPY_RANGE, Qt::CTRL + Qt::SHIFT + Qt::Key_C, "Edit: Copy in range", GLOBAL_SHRT, "copy_range"); defShrt(SHRT_UNDO, Qt::CTRL + Qt::Key_Z, "Edit: Undo", INVIS_SHRT, "undo"); defShrt(SHRT_REDO, Qt::CTRL + Qt::Key_Y, "Edit: Redo", INVIS_SHRT, "redo"); defShrt(SHRT_CUT, Qt::CTRL + Qt::Key_X, "Edit: Cut", INVIS_SHRT, "cut"); defShrt(SHRT_PASTE, Qt::CTRL + Qt::Key_V, "Edit: Paste", INVIS_SHRT, "paste"); + defShrt(SHRT_PASTE_DIALOG, Qt::CTRL + Qt::SHIFT + Qt::Key_V, "Edit: Paste (with dialog)", GLOBAL_SHRT, "paste_dialog"); defShrt(SHRT_DELETE, Qt::Key_Delete, "Edit: Delete", INVIS_SHRT, "delete"); //----------------------------------------------------------- @@ -103,7 +106,6 @@ void initShortCuts() defShrt(SHRT_GLOBAL_CUT, 0, "Structure: Global cut", ARRANG_SHRT, "global_cut"); defShrt(SHRT_GLOBAL_INSERT, 0, "Structure: Global insert", ARRANG_SHRT, "global_insert"); defShrt(SHRT_GLOBAL_SPLIT, 0, "Structure: Global split", ARRANG_SHRT, "global_split"); - defShrt(SHRT_COPY_RANGE, 0, "Structure: Copy range", ARRANG_SHRT, "copy_range"); defShrt(SHRT_CUT_EVENTS, 0, "Structure: Cut events", ARRANG_SHRT, "cut_events"); //defShrt(SHRT_OPEN_MIXER, Qt::Key_F10, "View: Open mixer window", ARRANG_SHRT, "toggle_mixer"); defShrt(SHRT_OPEN_MIXER, Qt::Key_F10, "View: Open mixer #1 window", ARRANG_SHRT, "toggle_mixer"); @@ -156,12 +158,10 @@ void initShortCuts() defShrt(SHRT_SEL_BELOW, Qt::Key_Down, "Edit: Select nearest part on track below", ARRANG_SHRT, "sel_part_below"); defShrt(SHRT_SEL_BELOW_ADD, Qt::SHIFT + Qt::Key_Down, "Edit: Add nearest part on track below", ARRANG_SHRT, "sel_part_below_add"); - defShrt(SHRT_INSERT, Qt::CTRL+Qt::SHIFT+ Qt::Key_I, "Edit: Insert parts, moving time", ARRANG_SHRT, "insert_parts"); defShrt(SHRT_INSERTMEAS, Qt::CTRL+Qt::SHIFT+ Qt::Key_O, "Edit: Insert empty measure", ARRANG_SHRT, "insert_measure"); - defShrt(SHRT_PASTE_CLONE, Qt::CTRL+Qt::SHIFT+Qt::Key_V, "Edit: Paste clone", ARRANG_SHRT, "paste_clone"); - defShrt(SHRT_PASTE_TO_TRACK, Qt::CTRL+Qt::Key_B, "Edit: Paste to track", ARRANG_SHRT, "paste_to_track"); - defShrt(SHRT_PASTE_CLONE_TO_TRACK, Qt::CTRL+Qt::SHIFT+Qt::Key_B, "Edit: Paste clone to track", ARRANG_SHRT, "paste_clone_to_track"); + defShrt(SHRT_PASTE_CLONE, Qt::CTRL+Qt::Key_B, "Edit: Paste as clones", ARRANG_SHRT, "paste_as_clone"); // i changed "paste_clone" to "paste_as_clone" intendedly. otherwise muse would keep its old, conflicting definition (ctrl+shift+v instead of ctrl+b) (flo) + defShrt(SHRT_PASTE_CLONE_DIALOG, Qt::CTRL+Qt::SHIFT+Qt::Key_B, "Edit: Paste as clones (with dialog)", ARRANG_SHRT, "paste_as_clone_dialog"); defShrt(SHRT_SEL_TRACK_ABOVE, Qt::CTRL + Qt::Key_Up, "Select track above", ARRANG_SHRT, "sel_track_above"); defShrt(SHRT_SEL_TRACK_BELOW, Qt::CTRL + Qt::Key_Down, "Select track below", ARRANG_SHRT, "sel_track_below"); diff --git a/muse2/muse/shortcuts.h b/muse2/muse/shortcuts.h index 159a6084..451c4ec3 100644 --- a/muse2/muse/shortcuts.h +++ b/muse2/muse/shortcuts.h @@ -86,6 +86,7 @@ enum { SHRT_TOGGLE_METRO, // C SHRT_START_REC, // *(keypad) SHRT_REC_CLEAR, // *(keypad) + SHRT_FULLSCREEN, //Main + Drumeditor SHRT_NEW, //Ctrl+N @@ -96,8 +97,10 @@ enum { SHRT_UNDO, //Ctrl+Z SHRT_REDO, //Ctrl+Y SHRT_COPY, //Ctrl+C + SHRT_COPY_RANGE, //Ctrl+Shift+C SHRT_CUT, //Ctrl+X SHRT_PASTE, //Ctrl+V + SHRT_PASTE_DIALOG, //Ctrl+Shift+V SHRT_DELETE,//Delete @@ -126,7 +129,6 @@ enum { SHRT_GLOBAL_CUT, //Default: undefined SHRT_GLOBAL_INSERT, //Default: undefined SHRT_GLOBAL_SPLIT, //Default: undefined - SHRT_COPY_RANGE, //Default: undefined SHRT_CUT_EVENTS, //Default: undefined SHRT_OPEN_TRANSPORT, //F11 @@ -187,12 +189,10 @@ enum { SHRT_SEL_BELOW, //Down SHRT_SEL_BELOW_ADD, //move down and add to selection - SHRT_INSERT, //Ctrl+Shift+I - insert parts instead of pasting SHRT_INSERTMEAS, //Ctrl+Shift+M - insert measures - SHRT_PASTE_CLONE, //CTRL+SHIFT+Key_V - SHRT_PASTE_TO_TRACK, //CTRL+Key_B - SHRT_PASTE_CLONE_TO_TRACK, //CTRL+SHIFT+Key_B + SHRT_PASTE_CLONE, //CTRL+B + SHRT_PASTE_CLONE_DIALOG, //CTRL+SHIFT+B //Arranger tracks SHRT_SEL_TRACK_BELOW, diff --git a/muse2/muse/song.cpp b/muse2/muse/song.cpp index e5381884..7adc37f3 100644 --- a/muse2/muse/song.cpp +++ b/muse2/muse/song.cpp @@ -162,12 +162,13 @@ void Song::setSig(const AL::TimeSignature& sig) //--------------------------------------------------------- // addNewTrack // Called from GUI context +// If insertAt is valid, inserts before insertAt. Else at the end after all tracks. // Besides normal track types, n includes synth menu ids from populateAddTrack() //--------------------------------------------------------- -Track* Song::addNewTrack(QAction* action) +Track* Song::addNewTrack(QAction* action, Track* insertAt) { - int n = action->data().toInt(); + int n = action->data().toInt(); // Ignore negative numbers since this slot could be called by a menu or list etc. passing -1. if(n < 0) return 0; @@ -176,45 +177,42 @@ Track* Song::addNewTrack(QAction* action) if(n >= MENU_ADD_SYNTH_ID_BASE) { n -= MENU_ADD_SYNTH_ID_BASE; - if(n < (int)synthis.size()) - { - //SynthI* si = createSynthI(synthis[n]->baseName()); - //SynthI* si = createSynthI(synthis[n]->name()); - SynthI* si = createSynthI(synthis[n]->baseName(), synthis[n]->name()); - if(!si) - return 0; + if(n >= (int)synthis.size()) + return 0; - // Add instance last in midi device list. - for (int i = 0; i < MIDI_PORTS; ++i) + SynthI* si = createSynthI(synthis[n]->baseName(), synthis[n]->name(), insertAt); + if(!si) + return 0; + + // Add instance last in midi device list. + for (int i = 0; i < MIDI_PORTS; ++i) + { + MidiPort* port = &midiPorts[i]; + MidiDevice* dev = port->device(); + if (dev==0) { - MidiPort* port = &midiPorts[i]; - MidiDevice* dev = port->device(); - if (dev==0) - { - midiSeq->msgSetMidiDevice(port, si); - MusEGlobal::muse->changeConfig(true); // save configuration file - deselectTracks(); - si->setSelected(true); - update(); - return si; - } + midiSeq->msgSetMidiDevice(port, si); + MusEGlobal::muse->changeConfig(true); // save configuration file + deselectTracks(); + si->setSelected(true); + update(); + return si; } - deselectTracks(); - si->setSelected(true); - update(SC_SELECTION); - return si; - } - else - return 0; + } + deselectTracks(); + si->setSelected(true); + update(SC_SELECTION); + return si; } // Normal track. else { - // Ignore AUDIO_SOFTSYNTH, now that we have it as the synth menu id, since addTrack doesn't like it. - if((Track::TrackType)n == Track::AUDIO_SOFTSYNTH) + // Ignore AUDIO_SOFTSYNTH (or anything greater, to allow for other entries in some menu), + // now that we have it as the synth menu id, since addTrack doesn't like it. + if((Track::TrackType)n >= Track::AUDIO_SOFTSYNTH) return 0; - Track* t = addTrack((Track::TrackType)n); + Track* t = addTrack((Track::TrackType)n, insertAt); deselectTracks(); t->setSelected(true); update(SC_SELECTION); @@ -226,11 +224,12 @@ Track* Song::addNewTrack(QAction* action) //--------------------------------------------------------- // addTrack // called from GUI context +// type is track type +// If insertAt is valid, inserts before insertAt. Else at the end after all tracks. //--------------------------------------------------------- -Track* Song::addTrack(int t) +Track* Song::addTrack(Track::TrackType type, Track* insertAt) { - Track::TrackType type = (Track::TrackType) t; Track* track = 0; int lastAuxIdx = _auxs.size(); switch(type) { @@ -270,9 +269,12 @@ Track* Song::addTrack(int t) abort(); } track->setDefaultName(); - insertTrack1(track, -1); - msgInsertTrack(track, -1, true); - insertTrack3(track, -1); + + int idx = insertAt ? _tracks.index(insertAt) : -1; + + insertTrack1(track, idx); + msgInsertTrack(track, idx, true); + insertTrack3(track, idx); // Add default track <-> midiport routes. if(track->isMidiTrack()) @@ -3927,3 +3929,26 @@ QString Song::getScriptPath(int id, bool isdelivered) return path; } +void Song::informAboutNewParts(const std::map< Part*, std::set<Part*> >& param) +{ + emit newPartsCreated(param); +} + +void Song::informAboutNewParts(Part* orig, Part* p1, Part* p2, Part* p3, Part* p4, Part* p5, Part* p6, Part* p7, Part* p8, Part* p9) +{ + std::map< Part*, std::set<Part*> > temp; + + temp[orig].insert(p1); + temp[orig].insert(p2); + temp[orig].insert(p3); + temp[orig].insert(p4); + temp[orig].insert(p5); + temp[orig].insert(p6); + temp[orig].insert(p7); + temp[orig].insert(p8); + temp[orig].insert(p9); + temp[orig].erase(static_cast<Part*>(NULL)); + temp[orig].erase(orig); + + informAboutNewParts(temp); +} diff --git a/muse2/muse/song.h b/muse2/muse/song.h index 872993e5..79e5521f 100644 --- a/muse2/muse/song.h +++ b/muse2/muse/song.h @@ -27,6 +27,9 @@ #include <QObject> #include <QStringList> +#include <map> +#include <set> + #include "pos.h" #include "globaldefs.h" #include "tempo.h" @@ -163,6 +166,8 @@ class Song : public QObject { ~Song(); bool applyOperationGroup(Undo& group, bool doUndo=true); + void informAboutNewParts(const std::map< Part*, std::set<Part*> >&); + void informAboutNewParts(Part* orig, Part* p1, Part* p2=NULL, Part* p3=NULL, Part* p4=NULL, Part* p5=NULL, Part* p6=NULL, Part* p7=NULL, Part* p8=NULL, Part* p9=NULL); void putEvent(int pv); void endMsgCmd(); @@ -353,8 +358,7 @@ class Song : public QObject { // Configuration //----------------------------------------- - //SynthI* createSynthI(const QString& sclass); - SynthI* createSynthI(const QString& sclass, const QString& label = QString()); + SynthI* createSynthI(const QString& sclass, const QString& label = QString(), Track* insertAt = 0); void rescanAlsaPorts(); @@ -402,8 +406,8 @@ class Song : public QObject { void setQuantize(bool val); void panic(); void seqSignal(int fd); - Track* addTrack(int); - Track* addNewTrack(QAction* action); + Track* addTrack(Track::TrackType type, Track* insertAt = 0); + Track* addNewTrack(QAction* action, Track* insertAt = 0); QString getScriptPath(int id, bool delivered); void populateScriptMenu(QMenu* menuPlugins, QObject* receiver); @@ -421,6 +425,7 @@ class Song : public QObject { void midiPortsChanged(); void midiNote(int pitch, int velo); void controllerChanged(Track* t); + void newPartsCreated(const std::map< Part*, std::set<Part*> >&); }; extern Song* song; diff --git a/muse2/muse/songfile.cpp b/muse2/muse/songfile.cpp index 9678b99b..2763f1b6 100644 --- a/muse2/muse/songfile.cpp +++ b/muse2/muse/songfile.cpp @@ -1028,15 +1028,15 @@ void MusE::readToplevels(Xml& xml) if(!pl->empty()) { startPianoroll(pl); - toplevels.back().cobject()->readStatus(xml); + toplevels.back()->readStatus(xml); pl = new PartList; } } else if (tag == "scoreedit") { - ScoreEdit* score = new ScoreEdit(this, 0, arranger->cursorValue()); + ScoreEdit* score = new ScoreEdit(this, 0, _arranger->cursorValue()); score->show(); - toplevels.push_back(Toplevel(Toplevel::SCORE, (unsigned long)(score), score)); - connect(score, SIGNAL(deleted(unsigned long)), SLOT(toplevelDeleted(unsigned long))); + toplevels.push_back(score); + connect(score, SIGNAL(deleted(TopWin*)), SLOT(toplevelDeleted(TopWin*))); connect(score, SIGNAL(name_changed()), SLOT(scoreNamingChanged())); score->readStatus(xml); } @@ -1044,7 +1044,7 @@ void MusE::readToplevels(Xml& xml) if(!pl->empty()) { startDrumEditor(pl); - toplevels.back().cobject()->readStatus(xml); + toplevels.back()->readStatus(xml); pl = new PartList; } } @@ -1052,33 +1052,40 @@ void MusE::readToplevels(Xml& xml) if(!pl->empty()) { startListEditor(pl); - toplevels.back().cobject()->readStatus(xml); + toplevels.back()->readStatus(xml); pl = new PartList; } } else if (tag == "master") { startMasterEditor(); - toplevels.back().cobject()->readStatus(xml); + toplevels.back()->readStatus(xml); } else if (tag == "lmaster") { startLMasterEditor(); - toplevels.back().cobject()->readStatus(xml); + toplevels.back()->readStatus(xml); } else if (tag == "marker") { showMarker(true); - toplevels.back().cobject()->readStatus(xml); + if (toplevels.back()->type()==TopWin::MARKER) + toplevels.back()->readStatus(xml); + } + else if (tag == "arrangerview") { + showArranger(true); + if (toplevels.back()->type()==TopWin::ARRANGER) + toplevels.back()->readStatus(xml); } else if (tag == "waveedit") { if(!pl->empty()) { startWaveEditor(pl); - toplevels.back().cobject()->readStatus(xml); + toplevels.back()->readStatus(xml); pl = new PartList; } } else if (tag == "cliplist") { startClipList(true); - toplevels.back().cobject()->readStatus(xml); + if (toplevels.back()->type()==TopWin::CLIPLIST) + toplevels.back()->readStatus(xml); } else xml.unknown("MusE"); @@ -1299,8 +1306,8 @@ void MusE::write(Xml& xml) const if (!toplevels.empty()) { xml.tag(level++, "toplevels"); for (ciToplevel i = toplevels.begin(); i != toplevels.end(); ++i) { - if (i->cobject()->isVisible()) - i->cobject()->writeStatus(level, xml); + if ((*i)->isVisible()) + (*i)->writeStatus(level, xml); } xml.tag(level--, "/toplevels"); } diff --git a/muse2/muse/structure.cpp b/muse2/muse/structure.cpp index 665dac68..6c9d25dd 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) @@ -31,8 +31,11 @@ #include "keyevent.h" #include "audio.h" #include "marker/marker.h" +#include "structure.h" +#include "globals.h" -namespace MusEApp { +#include <set> +using std::set; //--------------------------------------------------------- // adjustGlobalLists @@ -41,7 +44,7 @@ namespace MusEApp { // 'diff' number of ticks. //--------------------------------------------------------- -void MusE::adjustGlobalLists(Undo& operations, int startPos, int diff) +void adjustGlobalLists(Undo& operations, int startPos, int diff) { const TempoList* t = &tempomap; const AL::SigList* s = &AL::sigmap; @@ -132,7 +135,7 @@ void MusE::adjustGlobalLists(Undo& operations, int startPos, int diff) // - cut master track //--------------------------------------------------------- -void MusE::globalCut() +void globalCut() { int lpos = song->lpos(); int rpos = song->rpos(); @@ -141,10 +144,17 @@ void MusE::globalCut() Undo operations; TrackList* tracks = song->tracks(); + bool at_least_one_selected=false; + + for (iTrack it = tracks->begin(); it != tracks->end(); ++it) + if ( (*it)->selected() ) { + at_least_one_selected=true; + break; + } for (iTrack it = tracks->begin(); it != tracks->end(); ++it) { MidiTrack* track = dynamic_cast<MidiTrack*>(*it); - if (track == 0 || track->mute()) + if (track == 0 || (at_least_one_selected && !track->selected())) continue; PartList* pl = track->parts(); for (iPart p = pl->begin(); p != pl->end(); ++p) { @@ -234,55 +244,69 @@ void MusE::globalCut() // - insert in master track //--------------------------------------------------------- -void MusE::globalInsert() +void globalInsert() { - unsigned lpos = song->lpos(); - unsigned rpos = song->rpos(); - if (lpos >= rpos) - return; + Undo operations=movePartsTotheRight(song->lpos(), song->rpos()-song->lpos(), true); + song->applyOperationGroup(operations); + } + + +Undo movePartsTotheRight(unsigned int startTicks, int moveTicks, bool only_selected, set<Track*>* tracklist) + { + if (moveTicks<=0) + return Undo(); Undo operations; TrackList* tracks = song->tracks(); + bool at_least_one_selected=false; + + for (iTrack it = tracks->begin(); it != tracks->end(); ++it) + if ( (*it)->selected() ) { + at_least_one_selected=true; + break; + } + for (iTrack it = tracks->begin(); it != tracks->end(); ++it) { MidiTrack* track = dynamic_cast<MidiTrack*>(*it); - if (track == 0 || track->mute()) + if ( (track == 0) || + (only_selected && at_least_one_selected && !track->selected()) || + (tracklist && tracklist->find(track)==tracklist->end()) ) continue; PartList* pl = track->parts(); for (riPart p = pl->rbegin(); p != pl->rend(); ++p) { Part* part = p->second; unsigned t = part->tick(); int l = part->lenTick(); - if (t + l <= lpos) + if (t + l <= startTicks) continue; - if (lpos >= t && lpos < (t+l)) { + if (startTicks > t && startTicks < (t+l)) { MidiPart* nPart = new MidiPart(*(MidiPart*)part); - nPart->setLenTick(l + (rpos-lpos)); + nPart->setLenTick(l + moveTicks); EventList* el = nPart->events(); for (riEvent i = el->rbegin(); i!=el->rend(); ++i) { - if (i->first < lpos-t) + if (i->first < startTicks-t) break; Event event = i->second; Event nEvent = i->second.clone(); - nEvent.setTick(nEvent.tick() + (rpos-lpos)); + nEvent.setTick(nEvent.tick() + moveTicks); operations.push_back(UndoOp(UndoOp::ModifyEvent, nEvent, event, nPart, false, false)); } operations.push_back(UndoOp(UndoOp::ModifyPart, part, nPart, true, true)); } - else if (t > lpos) { + else if (t >= startTicks) { MidiPart* nPart = new MidiPart(*(MidiPart*)part); - nPart->setTick(t + (rpos -lpos)); + nPart->setTick(t + moveTicks); operations.push_back(UndoOp(UndoOp::ModifyPart, part, nPart, true, false)); } } } - int diff = rpos - lpos; - adjustGlobalLists(operations, lpos, diff); + adjustGlobalLists(operations, startTicks, moveTicks); - song->applyOperationGroup(operations); + return operations; } @@ -291,15 +315,23 @@ void MusE::globalInsert() // - split all parts at the song position pointer //--------------------------------------------------------- -void MusE::globalSplit() +void globalSplit() { int pos = song->cpos(); Undo operations; TrackList* tracks = song->tracks(); + bool at_least_one_selected=false; + + for (iTrack it = tracks->begin(); it != tracks->end(); ++it) + if ( (*it)->selected() ) { + at_least_one_selected=true; + break; + } + for (iTrack it = tracks->begin(); it != tracks->end(); ++it) { Track* track = *it; - if (track == 0 || track->mute()) + if (track == 0 || (at_least_one_selected && !track->selected())) continue; PartList* pl = track->parts(); @@ -315,6 +347,8 @@ void MusE::globalSplit() p1->events()->incARef(-1); // the later song->applyOperationGroup() will increment it p2->events()->incARef(-1); // so we must decrement it first :/ + //song->informAboutNewParts(part, p1); // is unneccessary because of ModifyPart + song->informAboutNewParts(part, p2); operations.push_back(UndoOp(UndoOp::ModifyPart,part, p1, true, false)); operations.push_back(UndoOp(UndoOp::AddPart,p2)); break; @@ -324,35 +358,3 @@ void MusE::globalSplit() song->applyOperationGroup(operations); } -//--------------------------------------------------------- -// copyRange -// - copy space between left and right locator position -// to song position pointer -// - dont process muted tracks -// - create a new part for every track containing the -// copied events -//--------------------------------------------------------- - -void MusE::copyRange() - { - QMessageBox::critical(this, - tr("MusE: Copy Range"), - tr("not implemented") - ); - } - -//--------------------------------------------------------- -// cutEvents -// - make sure that all events in a part end where the -// part ends -// - process only marked parts -//--------------------------------------------------------- - -void MusE::cutEvents() - { - QMessageBox::critical(this, - tr("MusE: Cut Events"), - tr("not implemented") - ); - } -} // namespace MusEApp diff --git a/muse2/muse/structure.h b/muse2/muse/structure.h new file mode 100644 index 00000000..38be034b --- /dev/null +++ b/muse2/muse/structure.h @@ -0,0 +1,34 @@ +//========================================================= +// MusE +// Linux Music Editor +// structure.h +// (C) Copyright 2011 Florian Jung (flo93@users.sourceforge.net) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; version 2 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//========================================================= + +#ifndef __STRUCTURE_H__ +#define __STRUCTURE_H__ + +#include "undo.h" +#include <set> + +Undo movePartsTotheRight(unsigned int startTick, int moveTick, bool only_selected=false, std::set<Track*>* tracklist=NULL); +void adjustGlobalLists(Undo& operations, int startPos, int diff); +void globalCut(); +void globalInsert(); +void globalSplit(); +#endif diff --git a/muse2/muse/synth.cpp b/muse2/muse/synth.cpp index ae54cd15..62da5e1d 100644 --- a/muse2/muse/synth.cpp +++ b/muse2/muse/synth.cpp @@ -35,13 +35,13 @@ //#include <QMenu> #include "app.h" +#include "arranger.h" #include "synth.h" #include "xml.h" #include "midi.h" #include "midiport.h" #include "mididev.h" -//#include "libsynti/mess.h" -#include "synti/libsynti/mess.h" // p4.0.2 +#include "synti/libsynti/mess.h" #include "song.h" #include "audio.h" #include "event.h" @@ -162,7 +162,6 @@ static Synth* findSynth(const QString& sclass, const QString& label) // create a synthesizer instance of class "label" //--------------------------------------------------------- -//static SynthI* createSynthI(const QString& sclass) static SynthI* createSynthInstance(const QString& sclass, const QString& label) { //Synth* s = findSynth(sclass); @@ -648,10 +647,10 @@ void initMidiSynth() //--------------------------------------------------------- // createSynthI // create a synthesizer instance of class "label" +// If insertAt is valid, inserts before insertAt. Else at the end after all tracks. //--------------------------------------------------------- -//SynthI* Song::createSynthI(const QString& sclass) -SynthI* Song::createSynthI(const QString& sclass, const QString& label) +SynthI* Song::createSynthI(const QString& sclass, const QString& label, Track* insertAt) { //printf("Song::createSynthI calling ::createSynthI class:%s\n", sclass.toLatin1().constData()); @@ -662,13 +661,15 @@ SynthI* Song::createSynthI(const QString& sclass, const QString& label) return 0; //printf("Song::createSynthI created SynthI. Before insertTrack1...\n"); - insertTrack1(si, -1); + int idx = insertAt ? _tracks.index(insertAt) : -1; + + insertTrack1(si, idx); //printf("Song::createSynthI after insertTrack1. Before msgInsertTrack...\n"); - msgInsertTrack(si, -1, true); // add to instance list + msgInsertTrack(si, idx, true); // add to instance list //printf("Song::createSynthI after msgInsertTrack. Before insertTrack3...\n"); - insertTrack3(si, -1); + insertTrack3(si, idx); //printf("Song::createSynthI after insertTrack3. Adding default routes...\n"); diff --git a/muse2/muse/wave.cpp b/muse2/muse/wave.cpp index 6f97a3f0..731606d3 100644 --- a/muse2/muse/wave.cpp +++ b/muse2/muse/wave.cpp @@ -815,7 +815,7 @@ namespace MusEApp { void MusE::importWave() { - Track* track = arranger->curTrack(); + Track* track = _arranger->curTrack(); if (track == 0 || track->type() != Track::WAVE) { QMessageBox::critical(this, QString("MusE"), tr("to import an audio file you have first to select" @@ -838,7 +838,7 @@ void MusE::importWave() bool MusE::importWaveToTrack(QString& name, unsigned tick, Track* track) { if (track==NULL) - track = (WaveTrack*)(arranger->curTrack()); + track = (WaveTrack*)(_arranger->curTrack()); SndFile* f = getWave(name, true); diff --git a/muse2/muse/waveedit/waveedit.cpp b/muse2/muse/waveedit/waveedit.cpp index 00c68cef..a2167a50 100644 --- a/muse2/muse/waveedit/waveedit.cpp +++ b/muse2/muse/waveedit/waveedit.cpp @@ -55,10 +55,6 @@ extern QColor readColor(Xml& xml); -int WaveEdit::_widthInit = 600; -int WaveEdit::_heightInit = 400; -QByteArray WaveEdit::_toolbarInit; - //--------------------------------------------------------- // closeEvent //--------------------------------------------------------- @@ -68,7 +64,7 @@ void WaveEdit::closeEvent(QCloseEvent* e) QSettings settings("MusE", "MusE-qt"); //settings.setValue("Waveedit/geometry", saveGeometry()); settings.setValue("Waveedit/windowState", saveState()); - emit deleted((unsigned long)this); + emit deleted(static_cast<TopWin*>(this)); e->accept(); } @@ -77,9 +73,8 @@ void WaveEdit::closeEvent(QCloseEvent* e) //--------------------------------------------------------- WaveEdit::WaveEdit(PartList* pl) - : MidiEditor(1, pl) + : MidiEditor(TopWin::WAVE, 1, pl) { - resize(_widthInit, _heightInit); setFocusPolicy(Qt::StrongFocus); QSignalMapper* mapper = new QSignalMapper(this); @@ -169,6 +164,12 @@ WaveEdit::WaveEdit(PartList* pl) mapper->setMapping(selectNoneAction, CMD_SELECT_NONE); connect(selectNoneAction, SIGNAL(triggered()), mapper, SLOT(map())); + + QMenu* settingsMenu = menuBar()->addMenu(tr("Window &Config")); + settingsMenu->addAction(subwinAction); + settingsMenu->addAction(shareAction); + settingsMenu->addAction(fullscreenAction); + //---------ToolBar---------------------------------- tools = addToolBar(tr("Wave edit tools")); tools->setObjectName("Wave edit tools"); @@ -218,7 +219,7 @@ WaveEdit::WaveEdit(PartList* pl) if (!parts()->empty()) { // Roughly match total size of part Part* firstPart = parts()->begin()->second; - xscale = 0 - firstPart->lenFrame()/_widthInit; + xscale = 0 - firstPart->lenFrame()/_widthInit[_type]; } else { xscale = -8000; @@ -271,9 +272,6 @@ WaveEdit::WaveEdit(PartList* pl) connect(hscroll, SIGNAL(scaleChanged(int)), SLOT(updateHScrollRange())); connect(song, SIGNAL(songChanged(int)), SLOT(songChanged1(int))); - if (!_toolbarInit.isEmpty()) - restoreState(_toolbarInit); - initShortcuts(); updateHScrollRange(); @@ -284,10 +282,8 @@ WaveEdit::WaveEdit(PartList* pl) WavePart* part = (WavePart*)(parts()->begin()->second); solo->setChecked(part->track()->solo()); } - QSettings settings("MusE", "MusE-qt"); - //restoreGeometry(settings.value("Waveedit/geometry").toByteArray()); - restoreState(settings.value("Waveedit/windowState").toByteArray()); + initTopwinState(); } void WaveEdit::initShortcuts() @@ -374,12 +370,8 @@ void WaveEdit::readConfiguration(Xml& xml) case Xml::TagStart: if (tag == "bgcolor") MusEConfig::config.waveEditBackgroundColor = readColor(xml); - else if (tag == "width") - _widthInit = xml.parseInt(); - else if (tag == "height") - _heightInit = xml.parseInt(); - else if (tag == "toolbars") - _toolbarInit = QByteArray::fromHex(xml.parse1().toAscii()); + else if (tag == "topwin") + TopWin::readConfiguration(WAVE, xml); else xml.unknown("WaveEdit"); break; @@ -403,9 +395,7 @@ void WaveEdit::writeConfiguration(int level, Xml& xml) { xml.tag(level++, "waveedit"); xml.colorTag(level, "bgcolor", MusEConfig::config.waveEditBackgroundColor); - xml.intTag(level, "width", _widthInit); - xml.intTag(level, "height", _heightInit); - xml.strTag(level, "toolbars", _toolbarInit.toHex().data()); + TopWin::writeConfiguration(WAVE, level,xml); xml.tag(level, "/waveedit"); } @@ -457,38 +447,6 @@ void WaveEdit::readStatus(Xml& xml) } } -//--------------------------------------------------------- -// resizeEvent -//--------------------------------------------------------- - -void WaveEdit::resizeEvent(QResizeEvent* ev) - { - QWidget::resizeEvent(ev); - storeInitialState(); - } - -//--------------------------------------------------------- -// focusOutEvent -//--------------------------------------------------------- - -void WaveEdit::focusOutEvent(QFocusEvent* ev) - { - QWidget::focusOutEvent(ev); - storeInitialState(); - } - - -//--------------------------------------------------------- -// storeInitialState -//--------------------------------------------------------- - -void WaveEdit::storeInitialState() - { - _widthInit = width(); - _heightInit = height(); - _toolbarInit=saveState(); - } - //--------------------------------------------------------- // songChanged1 diff --git a/muse2/muse/waveedit/waveedit.h b/muse2/muse/waveedit/waveedit.h index 3e5a5a61..64929555 100644 --- a/muse2/muse/waveedit/waveedit.h +++ b/muse2/muse/waveedit/waveedit.h @@ -66,15 +66,10 @@ class WaveEdit : public MidiEditor { QAction* copyAction; QAction* pasteAction; - static int _widthInit, _heightInit; - static QByteArray _toolbarInit; virtual void closeEvent(QCloseEvent*); virtual void keyPressEvent(QKeyEvent*); - virtual void resizeEvent(QResizeEvent* ev); - virtual void focusOutEvent(QFocusEvent*); - void storeInitialState(); QMenu* menuFunctions, *select, *menuGain; @@ -96,7 +91,7 @@ class WaveEdit : public MidiEditor { signals: - void deleted(unsigned long); + void deleted(TopWin*); public: WaveEdit(PartList*); diff --git a/muse2/muse/widgets/CMakeLists.txt b/muse2/muse/widgets/CMakeLists.txt index 48299f4a..e5353465 100644 --- a/muse2/muse/widgets/CMakeLists.txt +++ b/muse2/muse/widgets/CMakeLists.txt @@ -45,6 +45,7 @@ QT4_WRAP_CPP (widget_mocs doublelabel.h filedialog.h genset.h + mdisettings.h header.h hitscale.h intlabel.h @@ -61,6 +62,8 @@ QT4_WRAP_CPP (widget_mocs mtrackinfo.h nentry.h noteinfo.h + pastedialog.h + pasteeventsdialog.h pitchedit.h pitchlabel.h popupmenu.h @@ -107,12 +110,15 @@ file (GLOB widgets_ui_files editsysexdialogbase.ui fdialogbuttons.ui gensetbase.ui + mdisettings_base.ui itransformbase.ui metronomebase.ui midisync.ui mittransposebase.ui mixdowndialogbase.ui mtrackinfobase.ui + pastedialogbase.ui + pasteeventsdialogbase.ui projectcreate.ui shortcutcapturedialogbase.ui shortcutconfigbase.ui @@ -142,6 +148,7 @@ file (GLOB widgets_source_files drange.cpp filedialog.cpp genset.cpp + mdisettings.cpp header.cpp hitscale.cpp intlabel.cpp @@ -159,6 +166,8 @@ file (GLOB widgets_source_files mtscale_flo.cpp nentry.cpp noteinfo.cpp + pastedialog.cpp + pasteeventsdialog.cpp pitchedit.cpp pitchlabel.cpp popupmenu.cpp diff --git a/muse2/muse/widgets/function_dialogs/crescendobase.ui b/muse2/muse/widgets/function_dialogs/crescendobase.ui index 5f4ec1f4..e98b7bc3 100644 --- a/muse2/muse/widgets/function_dialogs/crescendobase.ui +++ b/muse2/muse/widgets/function_dialogs/crescendobase.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>275</width> - <height>293</height> + <height>299</height> </rect> </property> <property name="windowTitle"> @@ -140,6 +140,19 @@ </widget> </item> <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> <layout class="QHBoxLayout" name="horizontalLayout"> <property name="spacing"> <number>6</number> diff --git a/muse2/muse/widgets/function_dialogs/deloverlapsbase.ui b/muse2/muse/widgets/function_dialogs/deloverlapsbase.ui index 7484bf97..7f94f83b 100644 --- a/muse2/muse/widgets/function_dialogs/deloverlapsbase.ui +++ b/muse2/muse/widgets/function_dialogs/deloverlapsbase.ui @@ -10,7 +10,7 @@ <x>0</x> <y>0</y> <width>275</width> - <height>195</height> + <height>201</height> </rect> </property> <property name="windowTitle"> @@ -70,6 +70,19 @@ </widget> </item> <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> <layout class="QHBoxLayout" name="horizontalLayout"> <property name="spacing"> <number>6</number> diff --git a/muse2/muse/widgets/function_dialogs/gatetimebase.ui b/muse2/muse/widgets/function_dialogs/gatetimebase.ui index e804de17..3f7ede4b 100644 --- a/muse2/muse/widgets/function_dialogs/gatetimebase.ui +++ b/muse2/muse/widgets/function_dialogs/gatetimebase.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>275</width> - <height>316</height> + <height>320</height> </rect> </property> <property name="windowTitle"> @@ -135,6 +135,19 @@ </widget> </item> <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> <layout class="QHBoxLayout"> <property name="spacing"> <number>6</number> diff --git a/muse2/muse/widgets/function_dialogs/legatobase.ui b/muse2/muse/widgets/function_dialogs/legatobase.ui index 7bc406df..2593f3f5 100644 --- a/muse2/muse/widgets/function_dialogs/legatobase.ui +++ b/muse2/muse/widgets/function_dialogs/legatobase.ui @@ -10,7 +10,7 @@ <x>0</x> <y>0</y> <width>275</width> - <height>289</height> + <height>295</height> </rect> </property> <property name="windowTitle"> @@ -150,6 +150,19 @@ </widget> </item> <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> <layout class="QHBoxLayout" name="horizontalLayout"> <property name="spacing"> <number>6</number> diff --git a/muse2/muse/widgets/function_dialogs/movebase.ui b/muse2/muse/widgets/function_dialogs/movebase.ui index a8825dd5..17a3aff6 100644 --- a/muse2/muse/widgets/function_dialogs/movebase.ui +++ b/muse2/muse/widgets/function_dialogs/movebase.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>275</width> - <height>264</height> + <height>270</height> </rect> </property> <property name="windowTitle"> @@ -120,6 +120,19 @@ </widget> </item> <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> <layout class="QHBoxLayout" name="horizontalLayout"> <property name="spacing"> <number>6</number> diff --git a/muse2/muse/widgets/function_dialogs/quantbase.ui b/muse2/muse/widgets/function_dialogs/quantbase.ui index 6a88c86f..973be7b8 100644 --- a/muse2/muse/widgets/function_dialogs/quantbase.ui +++ b/muse2/muse/widgets/function_dialogs/quantbase.ui @@ -10,7 +10,7 @@ <x>0</x> <y>0</y> <width>279</width> - <height>486</height> + <height>475</height> </rect> </property> <property name="windowTitle"> @@ -210,11 +210,18 @@ </item> <item row="5" column="0" colspan="2"> <widget class="QLabel" name="label_4"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="text"> <string>If the proposed change in tick or length is smaller than threshold, nothing is done. If swing=0, this is normal If swing is 33, you get a 2:1-rhythm. -If swing is -33, you get a 1:2-rhythm.</string> +If swing is -33, you get a 1:2-rhythm. +</string> </property> <property name="wordWrap"> <bool>true</bool> @@ -225,6 +232,19 @@ If swing is -33, you get a 1:2-rhythm.</string> </widget> </item> <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> <layout class="QHBoxLayout" name="horizontalLayout"> <property name="spacing"> <number>6</number> diff --git a/muse2/muse/widgets/function_dialogs/removebase.ui b/muse2/muse/widgets/function_dialogs/removebase.ui index 79d541cc..a01f0c8b 100644 --- a/muse2/muse/widgets/function_dialogs/removebase.ui +++ b/muse2/muse/widgets/function_dialogs/removebase.ui @@ -10,7 +10,7 @@ <x>0</x> <y>0</y> <width>275</width> - <height>443</height> + <height>424</height> </rect> </property> <property name="windowTitle"> @@ -144,6 +144,12 @@ </item> <item row="2" column="0" colspan="2"> <widget class="QLabel" name="label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="text"> <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> @@ -165,6 +171,19 @@ p, li { white-space: pre-wrap; } </widget> </item> <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> <layout class="QHBoxLayout" name="horizontalLayout"> <property name="spacing"> <number>6</number> diff --git a/muse2/muse/widgets/function_dialogs/setlenbase.ui b/muse2/muse/widgets/function_dialogs/setlenbase.ui index 7d929716..39a87789 100644 --- a/muse2/muse/widgets/function_dialogs/setlenbase.ui +++ b/muse2/muse/widgets/function_dialogs/setlenbase.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>275</width> - <height>264</height> + <height>270</height> </rect> </property> <property name="windowTitle"> @@ -114,6 +114,19 @@ </widget> </item> <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> <layout class="QHBoxLayout" name="horizontalLayout"> <property name="spacing"> <number>6</number> diff --git a/muse2/muse/widgets/function_dialogs/transposebase.ui b/muse2/muse/widgets/function_dialogs/transposebase.ui index c26f2ef9..e1447690 100644 --- a/muse2/muse/widgets/function_dialogs/transposebase.ui +++ b/muse2/muse/widgets/function_dialogs/transposebase.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>275</width> - <height>264</height> + <height>270</height> </rect> </property> <property name="windowTitle"> @@ -120,6 +120,19 @@ </widget> </item> <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> <layout class="QHBoxLayout" name="horizontalLayout"> <property name="spacing"> <number>6</number> diff --git a/muse2/muse/widgets/function_dialogs/velocitybase.ui b/muse2/muse/widgets/function_dialogs/velocitybase.ui index 40fe625f..70e838f5 100644 --- a/muse2/muse/widgets/function_dialogs/velocitybase.ui +++ b/muse2/muse/widgets/function_dialogs/velocitybase.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>275</width> - <height>316</height> + <height>320</height> </rect> </property> <property name="windowTitle"> @@ -138,6 +138,19 @@ </widget> </item> <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> <layout class="QHBoxLayout" name="horizontalLayout"> <property name="spacing"> <number>6</number> diff --git a/muse2/muse/widgets/genset.cpp b/muse2/muse/widgets/genset.cpp index b8a93089..c6761a07 100644 --- a/muse2/muse/widgets/genset.cpp +++ b/muse2/muse/widgets/genset.cpp @@ -129,10 +129,10 @@ Shorter periods are desirable.</string> showMixer->setChecked(MusEConfig::config.mixer1Visible); showMixer2->setChecked(MusEConfig::config.mixer2Visible); - arrangerX->setValue(MusEConfig::config.geometryMain.x()); - arrangerY->setValue(MusEConfig::config.geometryMain.y()); - arrangerW->setValue(MusEConfig::config.geometryMain.width()); - arrangerH->setValue(MusEConfig::config.geometryMain.height()); + mainX->setValue(MusEConfig::config.geometryMain.x()); + mainY->setValue(MusEConfig::config.geometryMain.y()); + mainW->setValue(MusEConfig::config.geometryMain.width()); + mainH->setValue(MusEConfig::config.geometryMain.height()); transportX->setValue(MusEConfig::config.geometryTransport.x()); transportY->setValue(MusEConfig::config.geometryTransport.y()); @@ -178,10 +178,33 @@ Shorter periods are desirable.</string> connect(setMixerCurrent, SIGNAL(clicked()), SLOT(mixerCurrent())); connect(setMixer2Current, SIGNAL(clicked()), SLOT(mixer2Current())); connect(setBigtimeCurrent, SIGNAL(clicked()), SLOT(bigtimeCurrent())); - connect(setArrangerCurrent, SIGNAL(clicked()), SLOT(arrangerCurrent())); + connect(setMainCurrent, SIGNAL(clicked()), SLOT(mainCurrent())); connect(setTransportCurrent, SIGNAL(clicked()), SLOT(transportCurrent())); + + connect(buttonTraditionalPreset, SIGNAL(clicked()), SLOT(traditionalPreset())); + connect(buttonMDIPreset, SIGNAL(clicked()), SLOT(mdiPreset())); + connect(buttonBorlandPreset, SIGNAL(clicked()), SLOT(borlandPreset())); + + addMdiSettings(TopWin::ARRANGER); + addMdiSettings(TopWin::SCORE); + addMdiSettings(TopWin::PIANO_ROLL); + addMdiSettings(TopWin::DRUM); + addMdiSettings(TopWin::LISTE); + addMdiSettings(TopWin::WAVE); + addMdiSettings(TopWin::MASTER); + addMdiSettings(TopWin::LMASTER); + addMdiSettings(TopWin::CLIPLIST); + addMdiSettings(TopWin::MARKER); + } +void GlobalSettingsConfig::addMdiSettings(TopWin::ToplevelType t) +{ + MdiSettings* temp = new MdiSettings(t, this); + layoutMdiSettings->addWidget(temp); + mdisettings.push_back(temp); +} + //--------------------------------------------------------- // updateSettings //--------------------------------------------------------- @@ -242,10 +265,10 @@ void GlobalSettingsConfig::updateSettings() showMixer->setChecked(MusEConfig::config.mixer1Visible); showMixer2->setChecked(MusEConfig::config.mixer2Visible); - arrangerX->setValue(MusEConfig::config.geometryMain.x()); - arrangerY->setValue(MusEConfig::config.geometryMain.y()); - arrangerW->setValue(MusEConfig::config.geometryMain.width()); - arrangerH->setValue(MusEConfig::config.geometryMain.height()); + mainX->setValue(MusEConfig::config.geometryMain.x()); + mainY->setValue(MusEConfig::config.geometryMain.y()); + mainW->setValue(MusEConfig::config.geometryMain.width()); + mainH->setValue(MusEConfig::config.geometryMain.height()); transportX->setValue(MusEConfig::config.geometryTransport.x()); transportY->setValue(MusEConfig::config.geometryTransport.y()); @@ -282,6 +305,20 @@ void GlobalSettingsConfig::updateSettings() moveArmedCheckBox->setChecked(MusEConfig::config.moveArmedCheckBox); projectSaveCheckBox->setChecked(MusEConfig::config.useProjectSaveDialog); popsDefStayOpenCheckBox->setChecked(MusEConfig::config.popupsDefaultStayOpen); + + updateMdiSettings(); +} + +void GlobalSettingsConfig::updateMdiSettings() +{ + for (std::list<MdiSettings*>::iterator it = mdisettings.begin(); it!=mdisettings.end(); it++) + (*it)->update_settings(); +} + +void GlobalSettingsConfig::applyMdiSettings() +{ + for (std::list<MdiSettings*>::iterator it = mdisettings.begin(); it!=mdisettings.end(); it++) + (*it)->apply_settings(); } //--------------------------------------------------------- @@ -329,10 +366,10 @@ void GlobalSettingsConfig::apply() MusEConfig::config.mixer1Visible = showMixer->isChecked(); MusEConfig::config.mixer2Visible = showMixer2->isChecked(); - MusEConfig::config.geometryMain.setX(arrangerX->value()); - MusEConfig::config.geometryMain.setY(arrangerY->value()); - MusEConfig::config.geometryMain.setWidth(arrangerW->value()); - MusEConfig::config.geometryMain.setHeight(arrangerH->value()); + MusEConfig::config.geometryMain.setX(mainX->value()); + MusEConfig::config.geometryMain.setY(mainY->value()); + MusEConfig::config.geometryMain.setWidth(mainW->value()); + MusEConfig::config.geometryMain.setHeight(mainH->value()); MusEConfig::config.geometryTransport.setX(transportX->value()); MusEConfig::config.geometryTransport.setY(transportY->value()); @@ -403,6 +440,9 @@ void GlobalSettingsConfig::apply() MusEGlobal::muse->setHeartBeat(); // set guiRefresh midiSeq->msgSetRtc(); // set midi tick rate + + applyMdiSettings(); + MusEGlobal::muse->changeConfig(true); // save settings } @@ -437,8 +477,8 @@ void GlobalSettingsConfig::mixerCurrent() QRect r(w->frameGeometry()); mixerX->setValue(r.x()); mixerY->setValue(r.y()); - mixerW->setValue(r.width()); - mixerH->setValue(r.height()); + mixerW->setValue(w->width()); + mixerH->setValue(w->height()); } //--------------------------------------------------------- @@ -453,8 +493,8 @@ void GlobalSettingsConfig::mixer2Current() QRect r(w->frameGeometry()); mixer2X->setValue(r.x()); mixer2Y->setValue(r.y()); - mixer2W->setValue(r.width()); - mixer2H->setValue(r.height()); + mixer2W->setValue(w->width()); + mixer2H->setValue(w->height()); } //--------------------------------------------------------- @@ -469,21 +509,21 @@ void GlobalSettingsConfig::bigtimeCurrent() QRect r(w->frameGeometry()); bigtimeX->setValue(r.x()); bigtimeY->setValue(r.y()); - bigtimeW->setValue(r.width()); - bigtimeH->setValue(r.height()); + bigtimeW->setValue(w->width()); + bigtimeH->setValue(w->height()); } //--------------------------------------------------------- -// arrangerCurrent +// mainCurrent //--------------------------------------------------------- -void GlobalSettingsConfig::arrangerCurrent() +void GlobalSettingsConfig::mainCurrent() { QRect r(MusEGlobal::muse->frameGeometry()); - arrangerX->setValue(r.x()); - arrangerY->setValue(r.y()); - arrangerW->setValue(r.width()); - arrangerH->setValue(r.height()); + mainX->setValue(r.x()); + mainY->setValue(r.y()); + mainW->setValue(MusEGlobal::muse->width()); //this is intendedly not the frameGeometry, but + mainH->setValue(MusEGlobal::muse->height()); //the "non-frame-geom." to avoid a sizing bug } //--------------------------------------------------------- @@ -514,4 +554,43 @@ void GlobalSettingsConfig::defaultInstrumentsPath() userInstrumentsPath->setText(dir); } + +void GlobalSettingsConfig::traditionalPreset() +{ + for (std::list<MdiSettings*>::iterator it = mdisettings.begin(); it!=mdisettings.end(); it++) + { + TopWin::ToplevelType type = (*it)->type(); + TopWin::_sharesWhenFree[type]=false; + TopWin::_defaultSubwin[type]=false; + } + TopWin::_defaultSubwin[TopWin::ARRANGER]=true; + + updateMdiSettings(); +} + +void GlobalSettingsConfig::mdiPreset() +{ + for (std::list<MdiSettings*>::iterator it = mdisettings.begin(); it!=mdisettings.end(); it++) + { + TopWin::ToplevelType type = (*it)->type(); + TopWin::_sharesWhenSubwin[type]=true; + TopWin::_defaultSubwin[type]=true; + } + + updateMdiSettings(); +} + +void GlobalSettingsConfig::borlandPreset() +{ + for (std::list<MdiSettings*>::iterator it = mdisettings.begin(); it!=mdisettings.end(); it++) + { + TopWin::ToplevelType type = (*it)->type(); + TopWin::_sharesWhenFree[type]=true; + TopWin::_defaultSubwin[type]=false; + } + + updateMdiSettings(); +} + } // namespace MusEWidget + diff --git a/muse2/muse/widgets/genset.h b/muse2/muse/widgets/genset.h index 3a2c6354..6068c429 100644 --- a/muse2/muse/widgets/genset.h +++ b/muse2/muse/widgets/genset.h @@ -25,8 +25,11 @@ #define __GENSET_H__ #include "ui_gensetbase.h" +#include "cobject.h" +#include "mdisettings.h" #include <QShowEvent> +#include <list> namespace MusEWidget { @@ -39,20 +42,27 @@ class GlobalSettingsConfig : public QDialog, public Ui::GlobalSettingsDialogBase private slots: void updateSettings(); + void updateMdiSettings(); + void addMdiSettings(TopWin::ToplevelType t); + void applyMdiSettings(); void apply(); void ok(); void cancel(); void mixerCurrent(); void mixer2Current(); void bigtimeCurrent(); - void arrangerCurrent(); + void mainCurrent(); void transportCurrent(); void selectInstrumentsPath(); void defaultInstrumentsPath(); + void traditionalPreset(); + void mdiPreset(); + void borlandPreset(); protected: void showEvent(QShowEvent*); QButtonGroup *startSongGroup; + std::list<MdiSettings*> mdisettings; public: GlobalSettingsConfig(QWidget* parent=0); diff --git a/muse2/muse/widgets/gensetbase.ui b/muse2/muse/widgets/gensetbase.ui index 68f3ebb5..b5fb56b6 100644 --- a/muse2/muse/widgets/gensetbase.ui +++ b/muse2/muse/widgets/gensetbase.ui @@ -6,7 +6,7 @@ <rect> <x>0</x> <y>0</y> - <width>526</width> + <width>556</width> <height>506</height> </rect> </property> @@ -70,7 +70,7 @@ </widget> </item> <item row="0" column="5"> - <widget class="QSpinBox" name="arrangerH"> + <widget class="QSpinBox" name="mainH"> <property name="toolTip"> <string>height</string> </property> @@ -80,7 +80,7 @@ </widget> </item> <item row="0" column="4"> - <widget class="QSpinBox" name="arrangerW"> + <widget class="QSpinBox" name="mainW"> <property name="toolTip"> <string>width</string> </property> @@ -90,7 +90,7 @@ </widget> </item> <item row="0" column="3"> - <widget class="QSpinBox" name="arrangerY"> + <widget class="QSpinBox" name="mainY"> <property name="toolTip"> <string>y-pos</string> </property> @@ -100,7 +100,7 @@ </widget> </item> <item row="0" column="2"> - <widget class="QSpinBox" name="arrangerX"> + <widget class="QSpinBox" name="mainX"> <property name="toolTip"> <string>x-pos</string> </property> @@ -227,7 +227,7 @@ </sizepolicy> </property> <property name="text"> - <string>Arranger</string> + <string>Main Window</string> </property> <property name="wordWrap"> <bool>false</bool> @@ -379,7 +379,7 @@ </widget> </item> <item row="0" column="6"> - <widget class="QPushButton" name="setArrangerCurrent"> + <widget class="QPushButton" name="setMainCurrent"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -1333,19 +1333,6 @@ Adjusts responsiveness of audio controls and </property> </widget> </item> - <item row="5" column="0"> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> <item row="4" column="0"> <widget class="QLabel" name="TextLabel1_3"> <property name="toolTip"> @@ -1370,6 +1357,72 @@ Otherwise, hold Ctrl to keep them open.</string> </layout> </widget> </item> + <item> + <widget class="QGroupBox" name="groupBox_2"> + <property name="title"> + <string>MDI-subwindowness and sharing menus</string> + </property> + <property name="checkable"> + <bool>false</bool> + </property> + <layout class="QVBoxLayout" name="verticalLayout_9"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Presets:</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="buttonTraditionalPreset"> + <property name="text"> + <string>traditional MusE SDI</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="buttonMDIPreset"> + <property name="text"> + <string>Cakewalk-like MDI</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="buttonBorlandPreset"> + <property name="text"> + <string>Borland-/Mac-like MDI</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QScrollArea" name="scrollArea"> + <property name="widgetResizable"> + <bool>true</bool> + </property> + <widget class="QWidget" name="scrollAreaWidgetContents_2"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>482</width> + <height>168</height> + </rect> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <layout class="QVBoxLayout" name="layoutMdiSettings"/> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </widget> + </item> </layout> </widget> </widget> diff --git a/muse2/muse/widgets/mdisettings.cpp b/muse2/muse/widgets/mdisettings.cpp new file mode 100644 index 00000000..24bf7c7c --- /dev/null +++ b/muse2/muse/widgets/mdisettings.cpp @@ -0,0 +1,59 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: genset.cpp,v 1.7.2.8 2009/12/01 03:52:40 terminator356 Exp $ +// +// (C) Copyright 2001-2004 Werner Schweer (ws@seh.de) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; version 2 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//========================================================= + +#include <stdio.h> + +#include <QFileDialog> +#include <QRect> +#include <QShowEvent> + +#include "mdisettings.h" +#include "app.h" +#include "gconfig.h" +#include "midiseq.h" +#include "globals.h" +#include "icons.h" + +MdiSettings::MdiSettings(TopWin::ToplevelType t, QWidget* parent) : QWidget(parent) +{ + _type=t; + setupUi(this); + + groupBox->setTitle(TopWin::typeName(t)); + update_settings(); +} + + +void MdiSettings::update_settings() +{ + isSubwinCheckbox->setChecked(TopWin::_defaultSubwin[_type]); + shareSubwinCheckbox->setChecked(TopWin::_sharesWhenSubwin[_type]); + shareFreeCheckbox->setChecked(TopWin::_sharesWhenFree[_type]); +} + +void MdiSettings::apply_settings() +{ + TopWin::_defaultSubwin[_type] = isSubwinCheckbox->isChecked(); + TopWin::_sharesWhenSubwin[_type] = shareSubwinCheckbox->isChecked(); + TopWin::_sharesWhenFree[_type] = shareFreeCheckbox->isChecked(); +} diff --git a/muse2/muse/widgets/mdisettings.h b/muse2/muse/widgets/mdisettings.h new file mode 100644 index 00000000..482f9f49 --- /dev/null +++ b/muse2/muse/widgets/mdisettings.h @@ -0,0 +1,49 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: genset.h,v 1.3 2004/01/25 09:55:17 wschweer Exp $ +// +// (C) Copyright 2001 Werner Schweer (ws@seh.de) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; version 2 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//========================================================= + +#ifndef __MDISETTINGS_H__ +#define __MDISETTINGS_H__ + +#include <QWidget> +#include "ui_mdisettings_base.h" +#include "cobject.h" + +//--------------------------------------------------------- +// GlobalSettingsConfig +//--------------------------------------------------------- + +class MdiSettings : public QWidget, private Ui::MdiSettingsBase +{ + Q_OBJECT + + private: + TopWin::ToplevelType _type; + + public: + MdiSettings(TopWin::ToplevelType t, QWidget* parent=0); + void update_settings(); + void apply_settings(); + TopWin::ToplevelType type() { return _type; } +}; + +#endif diff --git a/muse2/muse/widgets/mdisettings_base.ui b/muse2/muse/widgets/mdisettings_base.ui new file mode 100644 index 00000000..af32f174 --- /dev/null +++ b/muse2/muse/widgets/mdisettings_base.ui @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>MdiSettingsBase</class> + <widget class="QWidget" name="MdiSettingsBase"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>338</width> + <height>100</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QGroupBox" name="groupBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>GroupBox</string> + </property> + <property name="flat"> + <bool>true</bool> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="2" column="0"> + <widget class="QCheckBox" name="isSubwinCheckbox"> + <property name="text"> + <string>MDI subwin</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QCheckBox" name="shareSubwinCheckbox"> + <property name="text"> + <string>Shares menu when subwin</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QCheckBox" name="shareFreeCheckbox"> + <property name="text"> + <string>Shares menu when free</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/muse2/muse/widgets/midisyncimpl.cpp b/muse2/muse/widgets/midisyncimpl.cpp index 89075af9..3829ca43 100644 --- a/muse2/muse/widgets/midisyncimpl.cpp +++ b/muse2/muse/widgets/midisyncimpl.cpp @@ -690,8 +690,6 @@ void MidiSyncConfig::closeEvent(QCloseEvent* e) apply(); } - //emit deleted((unsigned long)this); - disconnect(MusEGlobal::heartBeatTimer, SIGNAL(timeout()), this, SLOT(heartBeat())); disconnect(song, SIGNAL(songChanged(int)), this, SLOT(songChanged(int))); diff --git a/muse2/muse/widgets/midisyncimpl.h b/muse2/muse/widgets/midisyncimpl.h index ddccf7c9..50df186e 100644 --- a/muse2/muse/widgets/midisyncimpl.h +++ b/muse2/muse/widgets/midisyncimpl.h @@ -121,9 +121,6 @@ class MidiSyncConfig : public QDialog, public Ui::MidiSyncConfigBase { //void renameOk(QListViewItem*, int, const QString&); void songChanged(int); - //signals: - // void deleted(unsigned long); - public: MidiSyncConfig(QWidget* parent=0); //MidiSyncConfig(); diff --git a/muse2/muse/widgets/pastedialog.cpp b/muse2/muse/widgets/pastedialog.cpp new file mode 100644 index 00000000..7c9c2248 --- /dev/null +++ b/muse2/muse/widgets/pastedialog.cpp @@ -0,0 +1,153 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: pastedialog.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; version 2 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//========================================================= + +#include <QButtonGroup> +#include "pastedialog.h" +#include "xml.h" +#include "gconfig.h" + +using MusEConfig::config; + +namespace MusEDialog { + +PasteDialog::PasteDialog(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + button_group = new QButtonGroup; + button_group->addButton(merge_button,0); + button_group->addButton(move_all_button,1); + button_group->addButton(move_some_button,2); + + raster_spinbox->setSingleStep(config.division); + + connect(raster_spinbox, SIGNAL(valueChanged(int)), this, SLOT(raster_changed(int))); + connect(n_spinbox, SIGNAL(valueChanged(int)), this, SLOT(number_changed(int))); + + pull_values(); +} + +void PasteDialog::pull_values() +{ + insert_method = button_group->checkedId(); + number = n_spinbox->value(); + raster = raster_spinbox->value(); + all_in_one_track = all_in_one_track_checkbox->isChecked(); + clone = clone_checkbox->isChecked(); +} + +void PasteDialog::accept() +{ + pull_values(); + QDialog::accept(); +} + +int PasteDialog::exec() +{ + if ((insert_method < 0) || (insert_method > 2)) insert_method=0; + + button_group->button(insert_method)->setChecked(true); + n_spinbox->setValue(number); + raster_spinbox->setValue(raster); + all_in_one_track_checkbox->setChecked(all_in_one_track); + clone_checkbox->setChecked(clone); + + return QDialog::exec(); +} + +QString PasteDialog::ticks_to_quarter_string(int ticks) +{ + if (ticks % config.division == 0) + { + return tr("%n quarter(s)", "", ticks/config.division); + } + else + { + double quarters = (double) ticks/config.division; + bool one = ( quarters > 0.995 && quarters < 1.005 ); + if (one) + return QString::number(quarters, 'f', 2) + " " + tr("quarter"); + else + return QString::number(quarters, 'f', 2) + " " + tr("quarters"); + } +} + +void PasteDialog::raster_changed(int r) +{ + raster_quarters->setText(ticks_to_quarter_string(r)); + insert_quarters->setText(ticks_to_quarter_string(r*n_spinbox->value())); +} + +void PasteDialog::number_changed(int n) +{ + insert_quarters->setText(ticks_to_quarter_string(n*raster_spinbox->value())); +} + + +void PasteDialog::read_configuration(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 == "insert_method") + insert_method=xml.parseInt(); + else if (tag == "number") + number=xml.parseInt(); + else if (tag == "raster") + raster=xml.parseInt(); + else if (tag == "clone") + clone=xml.parseInt(); + else if (tag == "all_in_one_track") + all_in_one_track=xml.parseInt(); + else + xml.unknown("PasteDialog"); + break; + + case Xml::TagEnd: + if (tag == "pastedialog") + return; + + default: + break; + } + } +} + +void PasteDialog::write_configuration(int level, Xml& xml) +{ + xml.tag(level++, "pastedialog"); + xml.intTag(level, "insert_method", insert_method); + xml.intTag(level, "number", number); + xml.intTag(level, "raster", raster); + xml.intTag(level, "clone", clone); + xml.intTag(level, "all_in_one_track", all_in_one_track); + xml.tag(level, "/pastedialog"); +} + +} // namespace MusEDialog diff --git a/muse2/muse/widgets/pastedialog.h b/muse2/muse/widgets/pastedialog.h new file mode 100644 index 00000000..39121964 --- /dev/null +++ b/muse2/muse/widgets/pastedialog.h @@ -0,0 +1,67 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: pastedialog.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; version 2 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//========================================================= + +#ifndef __PASTEDIALOG_H__ +#define __PASTEDIALOG_H__ + +#include "ui_pastedialogbase.h" +#include <QString> + +class Xml; + +namespace MusEDialog { + +class PasteDialog : public QDialog, public Ui::PasteDialogBase +{ + Q_OBJECT + protected: + QButtonGroup* button_group; + QString ticks_to_quarter_string(int ticks); + + protected slots: + void accept(); + void pull_values(); + + void raster_changed(int); + void number_changed(int); + + public: + PasteDialog(QWidget* parent = 0); + + int insert_method; + int number; + int raster; + bool all_in_one_track; + bool clone; + + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + + public slots: + int exec(); +}; + +} // namespace MusEDialog + +#endif + diff --git a/muse2/muse/widgets/pastedialogbase.ui b/muse2/muse/widgets/pastedialogbase.ui new file mode 100644 index 00000000..e47f5d2b --- /dev/null +++ b/muse2/muse/widgets/pastedialogbase.ui @@ -0,0 +1,291 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>PasteDialogBase</class> + <widget class="QDialog" name="PasteDialogBase"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>307</width> + <height>349</height> + </rect> + </property> + <property name="windowTitle"> + <string>MusE: Paste Parts</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QGroupBox" name="rangeBox"> + <property name="title"> + <string>Number and raster</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>insert</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="n_spinbox"> + <property name="suffix"> + <string> times</string> + </property> + <property name="prefix"> + <string/> + </property> + <property name="minimum"> + <number>1</number> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>raster</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="raster_spinbox"> + <property name="suffix"> + <string> ticks</string> + </property> + <property name="minimum"> + <number>0</number> + </property> + <property name="maximum"> + <number>999999</number> + </property> + <property name="singleStep"> + <number>384</number> + </property> + <property name="value"> + <number>384</number> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QLabel" name="insert_quarters"> + <property name="text"> + <string notr="true">1 quarter</string> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QLabel" name="raster_quarters"> + <property name="text"> + <string notr="true">1 quarter</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="2"> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_2"> + <property name="title"> + <string>Move, Merge, Clone</string> + </property> + <property name="flat"> + <bool>false</bool> + </property> + <property name="checkable"> + <bool>false</bool> + </property> + <layout class="QGridLayout" name="gridLayout"> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <item row="2" column="0"> + <widget class="QRadioButton" name="move_all_button"> + <property name="text"> + <string>Move everything to the right</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QRadioButton" name="move_some_button"> + <property name="text"> + <string>Move only affected parts to the right</string> + </property> + </widget> + </item> + <item row="5" column="0"> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="6" column="0"> + <widget class="QCheckBox" name="all_in_one_track_checkbox"> + <property name="text"> + <string>Put everything into a single track</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QRadioButton" name="merge_button"> + <property name="text"> + <string>Merge with existing parts</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="7" column="0"> + <widget class="QCheckBox" name="clone_checkbox"> + <property name="text"> + <string>Insert as clones (where possible)</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <item> + <spacer name="Spacer1"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="okButton"> + <property name="text"> + <string>OK</string> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="cancelButton"> + <property name="text"> + <string>Cancel</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11"/> + <resources/> + <connections> + <connection> + <sender>okButton</sender> + <signal>clicked()</signal> + <receiver>PasteDialogBase</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>20</x> + <y>20</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + <connection> + <sender>cancelButton</sender> + <signal>clicked()</signal> + <receiver>PasteDialogBase</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>20</x> + <y>20</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/muse2/muse/widgets/pasteeventsdialog.cpp b/muse2/muse/widgets/pasteeventsdialog.cpp new file mode 100644 index 00000000..04b7cbd7 --- /dev/null +++ b/muse2/muse/widgets/pasteeventsdialog.cpp @@ -0,0 +1,175 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: pasteeventsdialog.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; version 2 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//========================================================= + +#include <QButtonGroup> +#include "pasteeventsdialog.h" +#include "xml.h" +#include "gconfig.h" + +using MusEConfig::config; + +namespace MusEDialog { + +PasteEventsDialog::PasteEventsDialog(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + + raster_spinbox->setSingleStep(config.division); + + connect(raster_spinbox, SIGNAL(valueChanged(int)), this, SLOT(raster_changed(int))); + connect(n_spinbox, SIGNAL(valueChanged(int)), this, SLOT(number_changed(int))); + connect(max_distance_spinbox, SIGNAL(valueChanged(int)), this, SLOT(max_distance_changed(int))); + + into_single_part_allowed=true; + + pull_values(); +} + +void PasteEventsDialog::pull_values() +{ + into_single_part = all_into_selected_part_checkbox->isChecked(); + always_new_part = always_new_button->isChecked(); + never_new_part = never_new_button->isChecked(); + + int temp = max_distance_spinbox->value(); + if (temp < 0) + max_distance = 0; + else + max_distance = unsigned(temp); + + number = n_spinbox->value(); + raster = raster_spinbox->value(); +} + +void PasteEventsDialog::accept() +{ + pull_values(); + QDialog::accept(); +} + +int PasteEventsDialog::exec() +{ + all_into_selected_part_checkbox->setChecked(into_single_part && into_single_part_allowed); + all_into_selected_part_checkbox->setEnabled(into_single_part_allowed); + into_single_part_allowed=true; + + if (always_new_part) + always_new_button->setChecked(true); + else if (never_new_part) + never_new_button->setChecked(true); + else + sometimes_into_new_button->setChecked(true); + + max_distance_spinbox->setValue(max_distance); + + n_spinbox->setValue(number); + raster_spinbox->setValue(raster); + + return QDialog::exec(); +} + +QString PasteEventsDialog::ticks_to_quarter_string(int ticks) +{ + if (ticks % config.division == 0) + { + return tr("%n quarter(s)", "", ticks/config.division); + } + else + { + double quarters = (double) ticks/config.division; + bool one = ( quarters > 0.995 && quarters < 1.005 ); + if (one) + return QString::number(quarters, 'f', 2) + " " + tr("quarter"); + else + return QString::number(quarters, 'f', 2) + " " + tr("quarters"); + } +} + +void PasteEventsDialog::max_distance_changed(int d) +{ + max_distance_quarters->setText(ticks_to_quarter_string(d)); +} + +void PasteEventsDialog::raster_changed(int r) +{ + raster_quarters->setText(ticks_to_quarter_string(r)); + insert_quarters->setText(ticks_to_quarter_string(r*n_spinbox->value())); +} + +void PasteEventsDialog::number_changed(int n) +{ + insert_quarters->setText(ticks_to_quarter_string(n*raster_spinbox->value())); +} + + +void PasteEventsDialog::read_configuration(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 == "number") + number=xml.parseInt(); + else if (tag == "raster") + raster=xml.parseInt(); + else if (tag == "always_new_part") + always_new_part=xml.parseInt(); + else if (tag == "never_new_part") + never_new_part=xml.parseInt(); + else if (tag == "max_distance") + max_distance=xml.parseInt(); + else if (tag == "into_single_part") + into_single_part=xml.parseInt(); + else + xml.unknown("PasteEventsDialog"); + break; + + case Xml::TagEnd: + if (tag == "pasteeventsdialog") + return; + + default: + break; + } + } +} + +void PasteEventsDialog::write_configuration(int level, Xml& xml) +{ + xml.tag(level++, "pasteeventsdialog"); + xml.intTag(level, "number", number); + xml.intTag(level, "raster", raster); + xml.intTag(level, "always_new_part", always_new_part); + xml.intTag(level, "never_new_part", never_new_part); + xml.intTag(level, "max_distance", max_distance); + xml.intTag(level, "into_single_part", into_single_part); + xml.tag(level, "/pasteeventsdialog"); +} + +} // namespace MusEDialog diff --git a/muse2/muse/widgets/pasteeventsdialog.h b/muse2/muse/widgets/pasteeventsdialog.h new file mode 100644 index 00000000..59e6f52b --- /dev/null +++ b/muse2/muse/widgets/pasteeventsdialog.h @@ -0,0 +1,69 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: pasteeventsdialog.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; version 2 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//========================================================= + +#ifndef __PASTEEVENTSDIALOG_H__ +#define __PASTEEVENTSDIALOG_H__ + +#include "ui_pasteeventsdialogbase.h" +#include <QString> + +class Xml; + +namespace MusEDialog { + +class PasteEventsDialog : public QDialog, public Ui::PasteEventsDialogBase +{ + Q_OBJECT + protected: + QString ticks_to_quarter_string(int ticks); + + protected slots: + void accept(); + void pull_values(); + + void max_distance_changed(int); + void raster_changed(int); + void number_changed(int); + + public: + PasteEventsDialog(QWidget* parent = 0); + + int number; + int raster; + bool always_new_part; + bool never_new_part; + unsigned max_distance; + bool into_single_part; + bool into_single_part_allowed; + + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + + public slots: + int exec(); +}; + +} // namespace MusEDialog + +#endif + diff --git a/muse2/muse/widgets/pasteeventsdialogbase.ui b/muse2/muse/widgets/pasteeventsdialogbase.ui new file mode 100644 index 00000000..d1436ded --- /dev/null +++ b/muse2/muse/widgets/pasteeventsdialogbase.ui @@ -0,0 +1,383 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>PasteEventsDialogBase</class> + <widget class="QDialog" name="PasteEventsDialogBase"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>315</width> + <height>360</height> + </rect> + </property> + <property name="windowTitle"> + <string>MusE: Paste Events</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QGroupBox" name="rangeBox"> + <property name="title"> + <string>Number and raster</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>insert</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="n_spinbox"> + <property name="suffix"> + <string> times</string> + </property> + <property name="prefix"> + <string/> + </property> + <property name="minimum"> + <number>1</number> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>raster</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="raster_spinbox"> + <property name="suffix"> + <string> ticks</string> + </property> + <property name="minimum"> + <number>0</number> + </property> + <property name="maximum"> + <number>999999</number> + </property> + <property name="singleStep"> + <number>384</number> + </property> + <property name="value"> + <number>384</number> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QLabel" name="insert_quarters"> + <property name="text"> + <string notr="true">1 quarter</string> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QLabel" name="raster_quarters"> + <property name="text"> + <string notr="true">1 quarter</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="2"> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_2"> + <property name="title"> + <string>Paste options</string> + </property> + <property name="flat"> + <bool>false</bool> + </property> + <property name="checkable"> + <bool>false</bool> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QRadioButton" name="never_new_button"> + <property name="text"> + <string>Always into existing parts</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="checked"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="always_new_button"> + <property name="text"> + <string>Never into existing parts</string> + </property> + </widget> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <property name="spacing"> + <number>0</number> + </property> + <item> + <widget class="QRadioButton" name="sometimes_into_new_button"> + <property name="text"> + <string>Into existing parts if part has not +to be expanded by more than </string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <spacer name="horizontalSpacer_4"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QSpinBox" name="max_distance_spinbox"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="suffix"> + <string> ticks</string> + </property> + <property name="maximum"> + <number>999999</number> + </property> + <property name="singleStep"> + <number>384</number> + </property> + <property name="value"> + <number>3072</number> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_5"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="max_distance_quarters"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string notr="true"> 1 quarter</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QCheckBox" name="all_into_selected_part_checkbox"> + <property name="text"> + <string>Put everything into the (selected) part</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <item> + <spacer name="Spacer1"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="okButton"> + <property name="text"> + <string>OK</string> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="cancelButton"> + <property name="text"> + <string>Cancel</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11"/> + <resources/> + <connections> + <connection> + <sender>okButton</sender> + <signal>clicked()</signal> + <receiver>PasteEventsDialogBase</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>20</x> + <y>20</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + <connection> + <sender>cancelButton</sender> + <signal>clicked()</signal> + <receiver>PasteEventsDialogBase</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>20</x> + <y>20</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + <connection> + <sender>sometimes_into_new_button</sender> + <signal>toggled(bool)</signal> + <receiver>max_distance_quarters</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>161</x> + <y>201</y> + </hint> + <hint type="destinationlabel"> + <x>260</x> + <y>231</y> + </hint> + </hints> + </connection> + <connection> + <sender>sometimes_into_new_button</sender> + <signal>toggled(bool)</signal> + <receiver>max_distance_spinbox</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>161</x> + <y>201</y> + </hint> + <hint type="destinationlabel"> + <x>107</x> + <y>231</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/muse2/muse/widgets/pitchedit.cpp b/muse2/muse/widgets/pitchedit.cpp index 7d637d01..4b937237 100644 --- a/muse2/muse/widgets/pitchedit.cpp +++ b/muse2/muse/widgets/pitchedit.cpp @@ -51,7 +51,7 @@ QString PitchEdit::mapValueToText(int v) return s; } else - return pitch2string(v); + return MusEUtil::pitch2string(v); } //--------------------------------------------------------- diff --git a/muse2/muse/widgets/pitchedit.h b/muse2/muse/widgets/pitchedit.h index 0c334d22..d5bb7654 100644 --- a/muse2/muse/widgets/pitchedit.h +++ b/muse2/muse/widgets/pitchedit.h @@ -25,8 +25,6 @@ #include <QSpinBox> -extern QString pitch2string(int v); - namespace MusEWidget { //--------------------------------------------------------- diff --git a/muse2/muse/widgets/pitchlabel.cpp b/muse2/muse/widgets/pitchlabel.cpp index b1f062a8..b1b9c1f1 100644 --- a/muse2/muse/widgets/pitchlabel.cpp +++ b/muse2/muse/widgets/pitchlabel.cpp @@ -83,7 +83,7 @@ void PitchLabel::setValue(int val) _value = val; QString s; if (_pitchMode) - s = pitch2string(_value); + s = MusEUtil::pitch2string(_value); else s.sprintf("%d", _value); setText(s); |