summaryrefslogtreecommitdiff
path: root/muse2
diff options
context:
space:
mode:
Diffstat (limited to 'muse2')
-rw-r--r--muse2/muse/app.cpp1170
-rw-r--r--muse2/muse/app.h124
-rw-r--r--muse2/muse/arranger/CMakeLists.txt2
-rw-r--r--muse2/muse/arranger/arranger.cpp5
-rw-r--r--muse2/muse/arranger/arranger.h5
-rw-r--r--muse2/muse/arranger/arrangerview.cpp925
-rw-r--r--muse2/muse/arranger/arrangerview.h130
-rw-r--r--muse2/muse/arranger/pcanvas.cpp14
-rw-r--r--muse2/muse/arranger/pcanvas.h2
-rw-r--r--muse2/muse/cliplist/cliplist.cpp66
-rw-r--r--muse2/muse/cliplist/cliplist.h4
-rw-r--r--muse2/muse/cobject.cpp312
-rw-r--r--muse2/muse/cobject.h97
-rw-r--r--muse2/muse/conf.cpp20
-rw-r--r--muse2/muse/functions.cpp12
-rw-r--r--muse2/muse/functions.h23
-rw-r--r--muse2/muse/gconfig.cpp1
-rw-r--r--muse2/muse/gconfig.h1
-rw-r--r--muse2/muse/liste/listedit.cpp68
-rw-r--r--muse2/muse/liste/listedit.h4
-rw-r--r--muse2/muse/main.cpp2
-rw-r--r--muse2/muse/marker/markerview.cpp76
-rw-r--r--muse2/muse/marker/markerview.h4
-rw-r--r--muse2/muse/master/lmaster.cpp68
-rw-r--r--muse2/muse/master/lmaster.h19
-rw-r--r--muse2/muse/master/masteredit.cpp89
-rw-r--r--muse2/muse/master/masteredit.h8
-rw-r--r--muse2/muse/midiedit/dcanvas.cpp2
-rw-r--r--muse2/muse/midiedit/drumedit.cpp68
-rw-r--r--muse2/muse/midiedit/drumedit.h8
-rw-r--r--muse2/muse/midiedit/pianoroll.cpp69
-rw-r--r--muse2/muse/midiedit/pianoroll.h8
-rw-r--r--muse2/muse/midiedit/prcanvas.cpp2
-rw-r--r--muse2/muse/midiedit/scoreedit.cpp68
-rw-r--r--muse2/muse/midiedit/scoreedit.h8
-rw-r--r--muse2/muse/midieditor.cpp4
-rw-r--r--muse2/muse/midieditor.h2
-rw-r--r--muse2/muse/songfile.cpp31
-rw-r--r--muse2/muse/structure.cpp20
-rw-r--r--muse2/muse/waveedit/waveedit.cpp69
-rw-r--r--muse2/muse/waveedit/waveedit.h7
-rw-r--r--muse2/muse/widgets/midisyncimpl.cpp2
-rw-r--r--muse2/muse/widgets/midisyncimpl.h3
43 files changed, 2304 insertions, 1318 deletions
diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp
index 2227e7b0..8f059c73 100644
--- a/muse2/muse/app.cpp
+++ b/muse2/muse/app.cpp
@@ -6,6 +6,8 @@
// (C) Copyright 1999-2004 Werner Schweer (ws@seh.de)
//=========================================================
+#include <typeinfo>
+
#include <QClipboard>
#include <QMessageBox>
#include <QShortcut>
@@ -14,6 +16,8 @@
#include <QWhatsThis>
#include <QSettings>
#include <QProgressDialog>
+#include <QMdiArea>
+#include <QMdiSubWindow>
#include "app.h"
#include "master/lmaster.h"
@@ -21,6 +25,7 @@
#include "amixer.h"
#include "appearance.h"
#include "arranger.h"
+#include "arrangerview.h"
#include "audio.h"
#include "audiodev.h"
#include "audioprefetch.h"
@@ -52,17 +57,9 @@
#include "widgets/projectcreateimpl.h"
#include "widgets/menutitleitem.h"
#include "tools.h"
-#include "visibletracks.h"
#include "widgets/unusedwavefiles.h"
#include "functions.h"
-#ifdef DSSI_SUPPORT
-#include "dssihost.h"
-#endif
-
-#ifdef VST_SUPPORT
-#include "vst.h"
-#endif
//extern void cacheJackRouteNames();
@@ -107,17 +104,6 @@ pthread_t splashThread;
-void MusE::clearScoreMenuMappers()
-{
- delete scoreOneStaffPerTrackMapper;
- delete scoreAllInOneMapper;
-
- scoreOneStaffPerTrackMapper = new QSignalMapper(this);
- scoreAllInOneMapper = new QSignalMapper(this);
-
- connect(scoreOneStaffPerTrackMapper, SIGNAL(mapped(QWidget*)), this, SLOT(openInScoreEdit_oneStaffPerTrack(QWidget*)));
- connect(scoreAllInOneMapper, SIGNAL(mapped(QWidget*)), this, SLOT(openInScoreEdit_allInOne(QWidget*)));
-}
//---------------------------------------------------------
@@ -304,235 +290,6 @@ void addProject(const QString& name)
}
//---------------------------------------------------------
-// populateAddSynth
-//---------------------------------------------------------
-
-// ORCAN - CHECK
-QMenu* populateAddSynth(QWidget* parent)
-{
- QMenu* synp = new QMenu(parent);
-
- //typedef std::multimap<std::string, int, addSynth_cmp_str > asmap;
- typedef std::multimap<std::string, int > asmap;
-
- //typedef std::multimap<std::string, int, addSynth_cmp_str >::iterator imap;
- typedef std::multimap<std::string, int >::iterator imap;
-
- MessSynth* synMESS = 0;
- QMenu* synpMESS = 0;
- asmap mapMESS;
-
- #ifdef DSSI_SUPPORT
- DssiSynth* synDSSI = 0;
- QMenu* synpDSSI = 0;
- asmap mapDSSI;
- #endif
-
- #ifdef VST_SUPPORT
- VstSynth* synVST = 0;
- QMenu* synpVST = 0;
- asmap mapVST;
- #endif
-
- // Not necessary, but what the heck.
- QMenu* synpOther = 0;
- asmap mapOther;
-
- //const int synth_base_id = 0x1000;
- int ii = 0;
- for(std::vector<Synth*>::iterator i = synthis.begin(); i != synthis.end(); ++i)
- {
- synMESS = dynamic_cast<MessSynth*>(*i);
- if(synMESS)
- {
- mapMESS.insert( std::pair<std::string, int> (std::string(synMESS->description().toLower().toLatin1().constData()), ii) );
- }
- else
- {
-
- #ifdef DSSI_SUPPORT
- synDSSI = dynamic_cast<DssiSynth*>(*i);
- if(synDSSI)
- {
- mapDSSI.insert( std::pair<std::string, int> (std::string(synDSSI->description().toLower().toLatin1().constData()), ii) );
- }
- else
- #endif
-
- {
- #ifdef VST_SUPPORT
- synVST = dynamic_cast<VstSynth*>(*i);
- if(synVST)
- {
- mapVST.insert( std::pair<std::string, int> (std::string(synVST->description().toLower().toLatin1().constData()), ii) );
- }
- else
- #endif
-
- {
- mapOther.insert( std::pair<std::string, int> (std::string((*i)->description().toLower().toLatin1().constData()), ii) );
- }
- }
- }
-
- ++ii;
- }
-
- int sz = synthis.size();
- for(imap i = mapMESS.begin(); i != mapMESS.end(); ++i)
- {
- int idx = i->second;
- if(idx > sz) // Sanity check
- continue;
- Synth* s = synthis[idx];
- if(s)
- {
- // No MESS sub-menu yet? Create it now.
- if(!synpMESS)
- synpMESS = new QMenu(parent);
- QAction* sM = synpMESS->addAction(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">");
- sM->setData(MENU_ADD_SYNTH_ID_BASE + idx);
- }
- }
-
- #ifdef DSSI_SUPPORT
- for(imap i = mapDSSI.begin(); i != mapDSSI.end(); ++i)
- {
- int idx = i->second;
- if(idx > sz)
- continue;
- Synth* s = synthis[idx];
- if(s)
- {
- // No DSSI sub-menu yet? Create it now.
- if(!synpDSSI)
- synpDSSI = new QMenu(parent);
- //synpDSSI->insertItem(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">", MENU_ADD_SYNTH_ID_BASE + idx);
- QAction* sD = synpDSSI->addAction(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">");
- sD->setData(MENU_ADD_SYNTH_ID_BASE + idx);
- }
- }
- #endif
-
- #ifdef VST_SUPPORT
- for(imap i = mapVST.begin(); i != mapVST.end(); ++i)
- {
- int idx = i->second;
- if(idx > sz)
- continue;
- Synth* s = synthis[idx];
- if(s)
- {
- // No VST sub-menu yet? Create it now.
- if(!synpVST)
- synpVST = new QMenu(parent);
- QAction* sV = synpVST->addAction(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">");
- sV->setData(MENU_ADD_SYNTH_ID_BASE + idx);
- }
- }
- #endif
-
- for(imap i = mapOther.begin(); i != mapOther.end(); ++i)
- {
- int idx = i->second;
- if(idx > sz)
- continue;
- Synth* s = synthis[idx];
- // No Other sub-menu yet? Create it now.
- if(!synpOther)
- synpOther = new QMenu(parent);
- //synpOther->insertItem(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">", MENU_ADD_SYNTH_ID_BASE + idx);
- QAction* sO = synpOther->addAction(QT_TRANSLATE_NOOP("@default", s->description()) + " <" + QT_TRANSLATE_NOOP("@default", s->name()) + ">");
- sO->setData(MENU_ADD_SYNTH_ID_BASE + idx);
- }
-
- if(synpMESS)
- {
- synpMESS->setIcon(*synthIcon);
- synpMESS->setTitle(QT_TRANSLATE_NOOP("@default", "MESS"));
- synp->addMenu(synpMESS);
- }
-
- #ifdef DSSI_SUPPORT
- if(synpDSSI)
- {
- synpDSSI->setIcon(*synthIcon);
- synpDSSI->setTitle(QT_TRANSLATE_NOOP("@default", "DSSI"));
- synp->addMenu(synpDSSI);
- }
- #endif
-
- #ifdef VST_SUPPORT
- if(synpVST)
- {
- synpVST->setIcon(*synthIcon);
- synpVST->setTitle(QT_TRANSLATE_NOOP("@default", "FST"));
- synp->addMenu(synpVST);
- }
- #endif
-
- if(synpOther)
- {
- synpOther->setIcon(*synthIcon);
- synpOther->setTitle(QObject::tr("Other"));
- synp->addMenu(synpOther);
- }
-
- return synp;
-}
-
-//---------------------------------------------------------
-// populateAddTrack
-// this is also used in "mixer"
-//---------------------------------------------------------
-
-QActionGroup* populateAddTrack(QMenu* addTrack)
- {
- QActionGroup* grp = new QActionGroup(addTrack);
-
- QAction* midi = addTrack->addAction(QIcon(*addtrack_addmiditrackIcon),
- QT_TRANSLATE_NOOP("@default", "Add Midi Track"));
- midi->setData(Track::MIDI);
- grp->addAction(midi);
- QAction* drum = addTrack->addAction(QIcon(*addtrack_drumtrackIcon),
- QT_TRANSLATE_NOOP("@default", "Add Drum Track"));
- drum->setData(Track::DRUM);
- grp->addAction(drum);
- QAction* wave = addTrack->addAction(QIcon(*addtrack_wavetrackIcon),
- QT_TRANSLATE_NOOP("@default", "Add Wave Track"));
- wave->setData(Track::WAVE);
- grp->addAction(wave);
- QAction* aoutput = addTrack->addAction(QIcon(*addtrack_audiooutputIcon),
- QT_TRANSLATE_NOOP("@default", "Add Audio Output"));
- aoutput->setData(Track::AUDIO_OUTPUT);
- grp->addAction(aoutput);
- QAction* agroup = addTrack->addAction(QIcon(*addtrack_audiogroupIcon),
- QT_TRANSLATE_NOOP("@default", "Add Audio Group"));
- agroup->setData(Track::AUDIO_GROUP);
- grp->addAction(agroup);
- QAction* ainput = addTrack->addAction(QIcon(*addtrack_audioinputIcon),
- QT_TRANSLATE_NOOP("@default", "Add Audio Input"));
- ainput->setData(Track::AUDIO_INPUT);
- grp->addAction(ainput);
- QAction* aaux = addTrack->addAction(QIcon(*addtrack_auxsendIcon),
- QT_TRANSLATE_NOOP("@default", "Add Aux Send"));
- aaux->setData(Track::AUDIO_AUX);
- grp->addAction(aaux);
-
- // Create a sub-menu and fill it with found synth types. Make addTrack the owner.
- QMenu* synp = populateAddSynth(addTrack);
- synp->setIcon(*synthIcon);
- synp->setTitle(QT_TRANSLATE_NOOP("@default", "Add Synth"));
-
- // Add the sub-menu to the given menu.
- addTrack->addMenu(synp);
-
- QObject::connect(addTrack, SIGNAL(triggered(QAction *)), song, SLOT(addNewTrack(QAction *)));
-
- return grp;
- }
-
-//---------------------------------------------------------
// MusE
//---------------------------------------------------------
@@ -558,6 +315,7 @@ MusE::MusE(int argc, char** argv) : QMainWindow()
midiRhythmGenerator = 0;
globalSettingsConfig = 0;
markerView = 0;
+ arrangerView = 0;
softSynthesizerConfig = 0;
midiTransformerDialog = 0;
shortcutConfig = 0;
@@ -569,21 +327,23 @@ 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);
song = new Song("song");
song->blockSignals(true);
heartBeatTimer = new QTimer(this);
heartBeatTimer->setObjectName("timer");
connect(heartBeatTimer, SIGNAL(timeout()), song, SLOT(beat()));
-
+
+
+ connect(this, SIGNAL(activeTopWinChanged(TopWin*)), SLOT(activeTopWinChangedSlot(TopWin*)));
+
#ifdef ENABLE_PYTHON
//---------------------------------------------------
// Python bridge
@@ -728,61 +488,6 @@ MusE::MusE(int argc, char** argv) : QMainWindow()
quitAction = new QAction(tr("&Quit"), this);
- //-------- Edit Actions
- editCutAction = new QAction(QIcon(*editcutIconSet), tr("C&ut"), this);
- editCopyAction = new QAction(QIcon(*editcopyIconSet), tr("&Copy"), this);
- editPasteAction = new QAction(QIcon(*editpasteIconSet), tr("&Paste"), this);
- editInsertAction = new QAction(QIcon(*editpasteIconSet), tr("&Insert"), this);
- editInsertEMAction = new QAction(QIcon(*editpasteIconSet), tr("&Insert Empty Measure"), this);
- editPasteCloneAction = new QAction(QIcon(*editpasteCloneIconSet), tr("Paste c&lone"), this);
- editPaste2TrackAction = new QAction(QIcon(*editpaste2TrackIconSet), tr("Paste to &track"), this);
- editPasteC2TAction = new QAction(QIcon(*editpasteClone2TrackIconSet), tr("Paste clone to trac&k"), this);
- editDeleteSelectedAction = new QAction(QIcon(*edit_track_delIcon), tr("Delete Selected Tracks"), this);
-
- editShrinkPartsAction = new QAction(tr("Shrink selected parts"), this); //FINDMICH TODO tooltips!
- editExpandPartsAction = new QAction(tr("Expand selected parts"), this);
- editCleanPartsAction = new QAction(tr("Clean selected parts"), this);
-
-
- addTrack = new QMenu(tr("Add Track"), this);
- addTrack->setIcon(QIcon(*edit_track_addIcon));
- select = new QMenu(tr("Select"), this);
- select->setIcon(QIcon(*selectIcon));
-
- editSelectAllAction = new QAction(QIcon(*select_allIcon), tr("Select &All"), this);
- editDeselectAllAction = new QAction(QIcon(*select_deselect_allIcon), tr("&Deselect All"), this);
- editInvertSelectionAction = new QAction(QIcon(*select_invert_selectionIcon), tr("Invert &Selection"), this);
- editInsideLoopAction = new QAction(QIcon(*select_inside_loopIcon), tr("&Inside Loop"), this);
- editOutsideLoopAction = new QAction(QIcon(*select_outside_loopIcon), tr("&Outside Loop"), this);
- editAllPartsAction = new QAction( QIcon(*select_all_parts_on_trackIcon), tr("All &Parts on Track"), this);
-
-
- scoreSubmenu = new QMenu(tr("Score"), this);
- scoreSubmenu->setIcon(QIcon(*scoreIconSet));
-
- scoreAllInOneSubsubmenu = new QMenu(tr("all parts in one staff"), this);
- scoreOneStaffPerTrackSubsubmenu = new QMenu(tr("one staff per part"), this);
-
- scoreSubmenu->addMenu(scoreAllInOneSubsubmenu);
- scoreSubmenu->addMenu(scoreOneStaffPerTrackSubsubmenu);
- updateScoreMenus();
-
- startScoreEditAction = new QAction(*scoreIconSet, tr("New score window"), this);
- startPianoEditAction = new QAction(*pianoIconSet, tr("Pianoroll"), this);
- startDrumEditAction = new QAction(QIcon(*edit_drummsIcon), tr("Drums"), this);
- startListEditAction = new QAction(QIcon(*edit_listIcon), tr("List"), this);
- startWaveEditAction = new QAction(QIcon(*edit_waveIcon), tr("Wave"), this);
-
- master = new QMenu(tr("Mastertrack"), this);
- master->setIcon(QIcon(*edit_mastertrackIcon));
- masterGraphicAction = new QAction(QIcon(*mastertrack_graphicIcon),tr("Graphic"), this);
- masterListAction = new QAction(QIcon(*mastertrack_listIcon),tr("List"), this);
-
- midiEdit = new QMenu(tr("Midi"), this);
- midiEdit->setIcon(QIcon(*edit_midiIcon));
-
- midiTransformerAction = new QAction(QIcon(*midi_transformIcon), tr("Midi &Transform"), this);
-
editSongInfoAction = new QAction(QIcon(*edit_listIcon), tr("Song Info"), this);
//-------- View Actions
@@ -798,15 +503,8 @@ MusE::MusE(int argc, char** argv) : QMainWindow()
viewCliplistAction->setCheckable(true);
viewMarkerAction = new QAction(QIcon(*view_markerIcon), tr("Marker View"), this);
viewMarkerAction->setCheckable(true);
-
- //-------- Structure Actions
- strGlobalCutAction = new QAction(tr("Global Cut"), this);
- strGlobalInsertAction = new QAction(tr("Global Insert"), this);
- strGlobalSplitAction = new QAction(tr("Global Split"), this);
- strCopyRangeAction = new QAction(tr("Copy Range"), this);
- strCopyRangeAction->setEnabled(false);
- strCutEventsAction = new QAction(tr("Cut Events"), this);
- strCutEventsAction->setEnabled(false);
+ viewArrangerAction = new QAction(tr("Arranger View"), this);
+ viewArrangerAction->setCheckable(true);
//-------- Midi Actions
menuScriptPlugins = new QMenu(tr("&Plugins"), this);
@@ -881,63 +579,6 @@ MusE::MusE(int argc, char** argv) : QMainWindow()
connect(fileMoveWaveFiles, SIGNAL(activated()), SLOT(findUnusedWaveFiles()));
connect(quitAction, SIGNAL(activated()), SLOT(quitDoc()));
- //-------- Edit connections
- connect(editCutAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
- connect(editCopyAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
- connect(editPasteAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
- connect(editInsertAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
- connect(editInsertEMAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
- connect(editPasteCloneAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
- connect(editPaste2TrackAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
- connect(editPasteC2TAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
- connect(editDeleteSelectedAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
-
- connect(editShrinkPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
- connect(editExpandPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
- connect(editCleanPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
-
- connect(editSelectAllAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
- connect(editDeselectAllAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
- connect(editInvertSelectionAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
- connect(editInsideLoopAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
- connect(editOutsideLoopAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
- connect(editAllPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
-
- editSignalMapper->setMapping(editCutAction, CMD_CUT);
- editSignalMapper->setMapping(editCopyAction, CMD_COPY);
- editSignalMapper->setMapping(editPasteAction, CMD_PASTE);
- editSignalMapper->setMapping(editInsertAction, CMD_INSERT);
- editSignalMapper->setMapping(editPasteCloneAction, CMD_PASTE_CLONE);
- editSignalMapper->setMapping(editPaste2TrackAction, CMD_PASTE_TO_TRACK);
- editSignalMapper->setMapping(editPasteC2TAction, CMD_PASTE_CLONE_TO_TRACK);
- editSignalMapper->setMapping(editInsertEMAction, CMD_INSERTMEAS);
- editSignalMapper->setMapping(editDeleteSelectedAction, CMD_DELETE_TRACK);
- editSignalMapper->setMapping(editShrinkPartsAction, CMD_SHRINK_PART);
- editSignalMapper->setMapping(editExpandPartsAction, CMD_EXPAND_PART);
- editSignalMapper->setMapping(editCleanPartsAction, CMD_CLEAN_PART);
- editSignalMapper->setMapping(editSelectAllAction, CMD_SELECT_ALL);
- editSignalMapper->setMapping(editDeselectAllAction, CMD_SELECT_NONE);
- editSignalMapper->setMapping(editInvertSelectionAction, CMD_SELECT_INVERT);
- editSignalMapper->setMapping(editInsideLoopAction, CMD_SELECT_ILOOP);
- editSignalMapper->setMapping(editOutsideLoopAction, CMD_SELECT_OLOOP);
- editSignalMapper->setMapping(editAllPartsAction, CMD_SELECT_PARTS);
-
- connect(editSignalMapper, SIGNAL(mapped(int)), this, SLOT(cmd(int)));
-
- connect(startPianoEditAction, SIGNAL(activated()), SLOT(startPianoroll()));
- connect(startScoreEditAction, SIGNAL(activated()), SLOT(startScoreQuickly()));
- connect(startDrumEditAction, SIGNAL(activated()), SLOT(startDrumEditor()));
- connect(startListEditAction, SIGNAL(activated()), SLOT(startListEditor()));
- connect(startWaveEditAction, SIGNAL(activated()), SLOT(startWaveEditor()));
- connect(scoreOneStaffPerTrackMapper, SIGNAL(mapped(QWidget*)), this, SLOT(openInScoreEdit_oneStaffPerTrack(QWidget*)));
- connect(scoreAllInOneMapper, SIGNAL(mapped(QWidget*)), this, SLOT(openInScoreEdit_allInOne(QWidget*)));
-
-
- connect(masterGraphicAction, SIGNAL(activated()), SLOT(startMasterEditor()));
- connect(masterListAction, SIGNAL(activated()), SLOT(startLMasterEditor()));
-
- connect(midiTransformerAction, SIGNAL(activated()), SLOT(startMidiTransformer()));
-
connect(editSongInfoAction, SIGNAL(activated()), SLOT(startSongInfo()));
//-------- View connections
@@ -947,13 +588,7 @@ MusE::MusE(int argc, char** argv) : QMainWindow()
connect(viewMixerBAction, SIGNAL(toggled(bool)), SLOT(toggleMixer2(bool)));
connect(viewCliplistAction, SIGNAL(toggled(bool)), SLOT(startClipList(bool)));
connect(viewMarkerAction, SIGNAL(toggled(bool)), SLOT(toggleMarker(bool)));
-
- //-------- Structure connections
- connect(strGlobalCutAction, SIGNAL(activated()), SLOT(globalCut()));
- connect(strGlobalInsertAction, SIGNAL(activated()), SLOT(globalInsert()));
- connect(strGlobalSplitAction, SIGNAL(activated()), SLOT(globalSplit()));
- connect(strCopyRangeAction, SIGNAL(activated()), SLOT(copyRange()));
- connect(strCutEventsAction, SIGNAL(activated()), SLOT(cutEvents()));
+ connect(viewArrangerAction, SIGNAL(toggled(bool)), SLOT(toggleArranger(bool)));
//-------- Midi connections
connect(midiEditInstAction, SIGNAL(activated()), SLOT(startEditInstrument()));
@@ -1014,47 +649,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(undoRedo->actions());
-
- tools1 = new EditToolBar(this, arrangerTools);
- addToolBar(tools1);
- tools1->setObjectName("arrangerTools");
+ QToolBar* undoToolbar = addToolBar(tr("Undo/Redo"));
+ undoToolbar->setObjectName("Undo/Redo (global)");
+ undoToolbar->addActions(undoRedo->actions());
QToolBar* transportToolbar = addToolBar(tr("Transport"));
- transportToolbar->setObjectName("Transport");
+ transportToolbar->setObjectName("Transport (global)");
transportToolbar->addActions(transportAction->actions());
QToolBar* panicToolbar = addToolBar(tr("Panic"));
- panicToolbar->setObjectName("Panic");
+ panicToolbar->setObjectName("Panic (global)");
panicToolbar->addAction(panicAction);
- visTracks = new VisibleTracks(this);
- addToolBar(visTracks);
+ requiredToolbars.push_back(tools);
+ optionalToolbars.push_back(undoToolbar);
+ optionalToolbars.push_back(transportToolbar);
+ optionalToolbars.push_back(panicToolbar);
//rlimit lim;
@@ -1087,11 +710,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);
@@ -1099,6 +731,8 @@ MusE::MusE(int argc, char** argv) : QMainWindow()
menu_file->addAction(fileSaveAction);
menu_file->addAction(fileSaveAsAction);
menu_file->addSeparator();
+ menu_file->addAction(editSongInfoAction);
+ menu_file->addSeparator();
menu_file->addAction(fileImportMidiAction);
menu_file->addAction(fileExportMidiAction);
menu_file->addAction(fileImportPartAction);
@@ -1110,72 +744,15 @@ MusE::MusE(int argc, char** argv) : QMainWindow()
menu_file->addAction(quitAction);
menu_file->addSeparator();
- //-------------------------------------------------------------
- // popup Edit
- //-------------------------------------------------------------
- menuEdit = menuBar()->addMenu(tr("&Edit"));
- menuEdit->addActions(undoRedo->actions());
- menuEdit->addSeparator();
-
- menuEdit->addAction(editCutAction);
- menuEdit->addAction(editCopyAction);
- menuEdit->addAction(editPasteAction);
- menuEdit->addAction(editInsertAction);
- menuEdit->addAction(editInsertEMAction);
- menuEdit->addAction(editPasteCloneAction);
- menuEdit->addAction(editPaste2TrackAction);
- menuEdit->addAction(editPasteC2TAction);
- menuEdit->addSeparator();
- menuEdit->addAction(editShrinkPartsAction);
- menuEdit->addAction(editExpandPartsAction);
- menuEdit->addAction(editCleanPartsAction);
- menuEdit->addSeparator();
- menuEdit->addAction(editDeleteSelectedAction);
-
- // Moved below. Have to wait until synths are available...
- //populateAddTrack(addTrack);
- menuEdit->addMenu(addTrack);
- menuEdit->addMenu(select);
- select->addAction(editSelectAllAction);
- select->addAction(editDeselectAllAction);
- select->addAction(editInvertSelectionAction);
- select->addAction(editInsideLoopAction);
- select->addAction(editOutsideLoopAction);
- select->addAction(editAllPartsAction);
- menuEdit->addSeparator();
-
- menuEdit->addAction(startPianoEditAction);
- menuEdit->addMenu(scoreSubmenu);
- menuEdit->addAction(startScoreEditAction);
- menuEdit->addAction(startDrumEditAction);
- menuEdit->addAction(startListEditAction);
- menuEdit->addAction(startWaveEditAction);
-
- menuEdit->addMenu(master);
- master->addAction(masterGraphicAction);
- master->addAction(masterListAction);
- menuEdit->addSeparator();
-
-
- menuEdit->addMenu(midiEdit);
-/* commented out by flo: these are not implemented,
- but maybe will be in future (state: revision 988)
- midiEdit->insertItem(tr("Copy Measure"), this, SLOT(copyMeasure()));
- midiEdit->insertItem(tr("Erase Measure"), this, SLOT(eraseMeasure()));
- midiEdit->insertItem(tr("Delete Measure"), this, SLOT(deleteMeasure()));
- midiEdit->insertItem(tr("Create Measure"), this, SLOT(createMeasure()));
- midiEdit->insertItem(tr("Mix Track"), this, SLOT(mixTrack()));
-*/
- midiEdit->addAction(midiTransformerAction);
-
- menuEdit->addAction(editSongInfoAction);
//-------------------------------------------------------------
// popup View
//-------------------------------------------------------------
- menuView = menuBar()->addMenu(tr("&View"));
+ menuView = new QMenu(tr("&View"), this);
+ menuBar()->addMenu(menuView);
+ trailingMenus.push_back(menuView);
menuView->addAction(viewTransportAction);
menuView->addAction(viewBigtimeAction);
@@ -1183,25 +760,17 @@ MusE::MusE(int argc, char** argv) : QMainWindow()
menuView->addAction(viewMixerBAction);
menuView->addAction(viewCliplistAction);
menuView->addAction(viewMarkerAction);
+ menuView->addAction(viewArrangerAction);
//-------------------------------------------------------------
- // popup Structure
- //-------------------------------------------------------------
-
- menuStructure = menuBar()->addMenu(tr("&Structure"));
- menuStructure->addAction(strGlobalCutAction);
- menuStructure->addAction(strGlobalInsertAction);
- menuStructure->addAction(strGlobalSplitAction);
- menuStructure->addAction(strCopyRangeAction);
- menuStructure->addSeparator();
- menuStructure->addAction(strCutEventsAction);
-
- //-------------------------------------------------------------
// popup Midi
//-------------------------------------------------------------
- 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);
@@ -1227,7 +796,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();
@@ -1238,7 +810,10 @@ 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);
@@ -1248,7 +823,10 @@ MusE::MusE(int argc, char** argv) : QMainWindow()
// popup Settings
//-------------------------------------------------------------
- menuSettings = menuBar()->addMenu(tr("Se&ttings"));
+ menuSettings = new QMenu(tr("Se&ttings"), this);
+ menuBar()->addMenu(menuSettings);
+ trailingMenus.push_back(menuSettings);
+
menuSettings->addAction(settingsGlobalAction);
menuSettings->addAction(settingsShortcutsAction);
menuSettings->addMenu(follow);
@@ -1268,7 +846,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();
@@ -1280,24 +861,27 @@ 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);
+ setCentralWidget(mdiArea);
- 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();
+
+ //mdiArea->addSubWindow(arrangerView->createMdiWrapper());
+ arrangerView->setIsMdiWin(true);
+
+
//---------------------------------------------------
// read list of "Recent Projects"
//---------------------------------------------------
@@ -1327,24 +911,12 @@ MusE::MusE(int argc, char** argv) : QMainWindow()
initMidiSynth();
- QActionGroup *grp = populateAddTrack(addTrack);
-
- trackMidiAction = grp->actions()[0];
- trackDrumAction = grp->actions()[1];
- trackWaveAction = grp->actions()[2];
- trackAOutputAction = grp->actions()[3];
- trackAGroupAction = grp->actions()[4];
- trackAInputAction = grp->actions()[5];
- trackAAuxAction = grp->actions()[6];
+ arrangerView->populateAddTrack();
+ arrangerView->updateShortcuts();
transport = new Transport(this, "transport");
bigtime = 0;
- QClipboard* cb = QApplication::clipboard();
- connect(cb, SIGNAL(dataChanged()), SLOT(clipboardChanged()));
- connect(cb, SIGNAL(selectionChanged()), SLOT(clipboardChanged()));
- connect(arranger, SIGNAL(selectionChanged()), SLOT(selectionChanged()));
-
//---------------------------------------------------
// load project
// if no songname entered on command line:
@@ -1495,7 +1067,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;
@@ -1604,6 +1176,7 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll
viewTransportAction->setChecked(config.transportVisible);
viewBigtimeAction->setChecked(config.bigTimeVisible);
viewMarkerAction->setChecked(config.markerVisible);
+ viewArrangerAction->setChecked(config.arrangerVisible);
autoMixerAction->setChecked(automation);
@@ -1649,9 +1222,9 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll
loopAction->setChecked(song->loop());
song->update();
song->updatePos();
- clipboardChanged(); // enable/disable "Paste"
- selectionChanged(); // enable/disable "Copy" & "Paste"
- scoreNamingChanged(); // inform the score menus about the new scores and their names
+ arrangerView->clipboardChanged(); // enable/disable "Paste"
+ arrangerView->selectionChanged(); // enable/disable "Copy" & "Paste"
+ arrangerView->scoreNamingChanged(); // inform the score menus about the new scores and their names
progress->setValue(50);
// p3.3.53 Try this AFTER the song update above which does a mixer update... Tested OK - mixers resize properly now.
@@ -1975,12 +1548,8 @@ 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);
@@ -1997,6 +1566,34 @@ void MusE::markerClosed()
}
//---------------------------------------------------------
+// toggleArranger
+//---------------------------------------------------------
+
+void MusE::toggleArranger(bool checked)
+ {
+ showArranger(checked);
+ }
+
+//---------------------------------------------------------
+// showArranger
+//---------------------------------------------------------
+
+void MusE::showArranger(bool flag)
+ {
+ arrangerView->setVisible(flag);
+ viewArrangerAction->setChecked(flag);
+ }
+
+//---------------------------------------------------------
+// arrangerClosed
+//---------------------------------------------------------
+
+void MusE::arrangerClosed()
+ {
+ viewArrangerAction->setChecked(false);
+ }
+
+//---------------------------------------------------------
// toggleTransport
//---------------------------------------------------------
@@ -2121,48 +1718,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
@@ -2192,14 +1747,14 @@ void MusE::openInScoreEdit(ScoreEdit* destination, PartList* pl, bool allInOne)
{
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();
}
destination->add_parts(pl, allInOne);
@@ -2229,8 +1784,8 @@ void MusE::startPianoroll(PartList* pl, bool showDefaultCtrls)
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(muse, SIGNAL(configChanged()), pianoroll, SLOT(configChanged()));
}
@@ -2250,8 +1805,8 @@ 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(muse,SIGNAL(configChanged()), listEditor, SLOT(configChanged()));
}
@@ -2263,8 +1818,8 @@ 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*)));
}
//---------------------------------------------------------
@@ -2275,8 +1830,8 @@ 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(muse, SIGNAL(configChanged()), lmaster, SLOT(configChanged()));
}
@@ -2299,8 +1854,8 @@ void MusE::startDrumEditor(PartList* pl, bool showDefaultCtrls)
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(muse, SIGNAL(configChanged()), drumEditor, SLOT(configChanged()));
}
@@ -2323,8 +1878,8 @@ void MusE::startWaveEditor(PartList* pl)
WaveEdit* waveEditor = new WaveEdit(pl);
waveEditor->show();
connect(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*)));
}
@@ -2380,8 +1935,8 @@ 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);
@@ -2429,63 +1984,53 @@ 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);
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();
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
@@ -2633,37 +2178,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
@@ -2671,99 +2185,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();
@@ -2776,43 +2198,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);
- }
@@ -3235,21 +2624,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);
@@ -3346,41 +2738,7 @@ void MusE::updateConfiguration()
undoAction->setShortcut(shortcuts[SHRT_UNDO].key);
redoAction->setShortcut(shortcuts[SHRT_REDO].key);
- editCutAction->setShortcut(shortcuts[SHRT_CUT].key);
- editCopyAction->setShortcut(shortcuts[SHRT_COPY].key);
- editPasteAction->setShortcut(shortcuts[SHRT_PASTE].key);
- editInsertAction->setShortcut(shortcuts[SHRT_INSERT].key);
- editInsertEMAction->setShortcut(shortcuts[SHRT_INSERTMEAS].key);
- editPasteCloneAction->setShortcut(shortcuts[SHRT_PASTE_CLONE].key);
- editPaste2TrackAction->setShortcut(shortcuts[SHRT_PASTE_TO_TRACK].key);
- editPasteC2TAction->setShortcut(shortcuts[SHRT_PASTE_CLONE_TO_TRACK].key);
-
- //editDeleteSelectedAction has no acceleration
-
- trackMidiAction->setShortcut(shortcuts[SHRT_ADD_MIDI_TRACK].key);
- trackDrumAction->setShortcut(shortcuts[SHRT_ADD_DRUM_TRACK].key);
- trackWaveAction->setShortcut(shortcuts[SHRT_ADD_WAVE_TRACK].key);
- trackAOutputAction->setShortcut(shortcuts[SHRT_ADD_AUDIO_OUTPUT].key);
- trackAGroupAction->setShortcut(shortcuts[SHRT_ADD_AUDIO_GROUP].key);
- trackAInputAction->setShortcut(shortcuts[SHRT_ADD_AUDIO_INPUT].key);
- trackAAuxAction->setShortcut(shortcuts[SHRT_ADD_AUDIO_AUX].key);
-
- editSelectAllAction->setShortcut(shortcuts[SHRT_SELECT_ALL].key);
- editDeselectAllAction->setShortcut(shortcuts[SHRT_SELECT_NONE].key);
- editInvertSelectionAction->setShortcut(shortcuts[SHRT_SELECT_INVERT].key);
- editInsideLoopAction->setShortcut(shortcuts[SHRT_SELECT_OLOOP].key);
- editOutsideLoopAction->setShortcut(shortcuts[SHRT_SELECT_OLOOP].key);
- editAllPartsAction->setShortcut(shortcuts[SHRT_SELECT_PRTSTRACK].key);
-
- startPianoEditAction->setShortcut(shortcuts[SHRT_OPEN_PIANO].key);
- startDrumEditAction->setShortcut(shortcuts[SHRT_OPEN_DRUMS].key);
- startListEditAction->setShortcut(shortcuts[SHRT_OPEN_LIST].key);
- startWaveEditAction->setShortcut(shortcuts[SHRT_OPEN_WAVE].key);
-
- masterGraphicAction->setShortcut(shortcuts[SHRT_OPEN_GRAPHIC_MASTER].key);
- masterListAction->setShortcut(shortcuts[SHRT_OPEN_LIST_MASTER].key);
-
- midiTransformerAction->setShortcut(shortcuts[SHRT_OPEN_MIDI_TRANSFORM].key);
+
//editSongInfoAction has no acceleration
viewTransportAction->setShortcut(shortcuts[SHRT_OPEN_TRANSPORT].key);
@@ -3390,11 +2748,6 @@ void MusE::updateConfiguration()
//viewCliplistAction has no acceleration
viewMarkerAction->setShortcut(shortcuts[SHRT_OPEN_MARKER].key);
- strGlobalCutAction->setShortcut(shortcuts[SHRT_GLOBAL_CUT].key);
- strGlobalInsertAction->setShortcut(shortcuts[SHRT_GLOBAL_INSERT].key);
- strGlobalSplitAction->setShortcut(shortcuts[SHRT_GLOBAL_SPLIT].key);
- strCopyRangeAction->setShortcut(shortcuts[SHRT_COPY_RANGE].key);
- strCutEventsAction->setShortcut(shortcuts[SHRT_CUT_EVENTS].key);
// midiEditInstAction does not have acceleration
midiResetInstAction->setShortcut(shortcuts[SHRT_MIDI_RESET].key);
@@ -3435,6 +2788,8 @@ void MusE::updateConfiguration()
//menuSettings->setAccel(shortcuts[SHRT_CONFIG_AUDIO_PORTS].key, menu_ids[CMD_CONFIG_AUDIO_PORTS]);
//menu_help->setAccel(menu_ids[CMD_START_WHATSTHIS], shortcuts[SHRT_START_WHATSTHIS].key);
+ //arrangerView->updateShortcuts(); //commented out by flo: is done via signal
+
}
//---------------------------------------------------------
@@ -3569,14 +2924,6 @@ void MusE::focusInEvent(QFocusEvent* ev)
QMainWindow::focusInEvent(ev);
}
-//---------------------------------------------------------
-// setUsedTool
-//---------------------------------------------------------
-
-void MusE::setUsedTool(int tool)
- {
- tools1->set(tool);
- }
//---------------------------------------------------------
@@ -3604,3 +2951,170 @@ void MusE::findUnusedWaveFiles()
UnusedWaveFiles unused(muse);
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 (debugMsg) printf("ACTIVE TOPWIN CHANGED to '%s' (%p)\n", win ? win->windowTitle().toAscii().data() : "<None>", win);
+
+ if ((win==NULL) || (win->isMdiWin()==false))
+ {
+ if (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 (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 (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 (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 (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 (debugMsg) printf(" toolbar '%s'\n", (*it)->windowTitle().toAscii().data());
+
+ addToolBar(*it);
+ foreignToolbars.push_back(*it);
+ (*it)->show(); //FINDMICHJETZT
+ }
+ else
+ {
+ if (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;
+
+ printf ("FINDMICH: changing sharing win DONE.\n");
+
+ 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 (win != activeTopWin)
+ setCurrentMenuSharingTopwin(activeTopWin);
+ else
+ setCurrentMenuSharingTopwin(NULL);
+ }
+ }
+}
diff --git a/muse2/muse/app.h b/muse2/muse/app.h
index ccf3706b..7e47101a 100644
--- a/muse2/muse/app.h
+++ b/muse2/muse/app.h
@@ -13,7 +13,9 @@
#include "cobject.h"
#include <QFileInfo>
+#include <list>
+class TopWin;
class QCloseEvent;
class QFocusEvent;
class QMainWindow;
@@ -26,8 +28,8 @@ class QString;
class QToolBar;
class QToolButton;
class QProgressDialog;
-class VisibleTracks;
class EditToolBar;
+class QMdiArea;
class Part;
class PartList;
@@ -49,6 +51,7 @@ class AudioRecord;
class MidiFileConfig;
class MidiFilterConfig;
class MarkerView;
+class ArrangerView;
class GlobalSettingsConfig;
class MidiControllerEditDialog;
class MidiInputTransformDialog;
@@ -75,13 +78,7 @@ class Undo;
class MusE : public QMainWindow
{
Q_OBJECT
- enum {CMD_CUT, CMD_COPY, CMD_PASTE, CMD_INSERT, CMD_INSERTMEAS, CMD_PASTE_CLONE,
- CMD_PASTE_TO_TRACK, CMD_PASTE_CLONE_TO_TRACK, CMD_DELETE,
- CMD_SELECT_ALL, CMD_SELECT_NONE, CMD_SELECT_INVERT,
- CMD_SELECT_ILOOP, CMD_SELECT_OLOOP, CMD_SELECT_PARTS,
- CMD_FOLLOW_NO, CMD_FOLLOW_JUMP, CMD_FOLLOW_CONTINUOUS ,
- CMD_DELETE_TRACK, CMD_EXPAND_PART, CMD_SHRINK_PART, CMD_CLEAN_PART
- };
+ enum {CMD_FOLLOW_NO, CMD_FOLLOW_JUMP, CMD_FOLLOW_CONTINUOUS };
//File menu items:
enum { CMD_OPEN_RECENT=0, CMD_LOAD_TEMPLATE, CMD_SAVE_AS, CMD_IMPORT_MIDI,
@@ -101,26 +98,22 @@ 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;
// Midi Menu Actions
QAction *midiEditInstAction, *midiResetInstAction, *midiInitInstActions, *midiLocalOffAction;
@@ -147,18 +140,18 @@ class MusE : public QMainWindow
QFileInfo project;
QToolBar *tools;
- EditToolBar *tools1;
- VisibleTracks *visTracks;
+ // when adding a toolbar to the main window, remember adding it to
+ // either the requiredToolbars or optionalToolbars list!
Transport* transport;
BigTime* bigtime;
EditInstrument* editInstrument;
+ // when adding a menu to the main window, remember adding it to
+ // either the leadingMenus or trailingMenus list!
QMenu *menu_file, *menuView, *menuSettings, *menu_help;
- QMenu *menuEdit, *menuStructure;
QMenu* menu_audio, *menuAutomation, *menuUtils;
QMenu* menu_functions, *menuScriptPlugins;
- QMenu* select, *master, *midiEdit, *addTrack;
// Special common menu for routes. Used (so far) by audio and midi strip, and midi trackinfo.
RoutePopupMenu* routingPopupMenu;
@@ -185,6 +178,7 @@ class MusE : public QMainWindow
ToplevelList toplevels;
ClipListEdit* clipListEdit;
MarkerView* markerView;
+ ArrangerView* arrangerView;
MidiTransformerDialog* midiTransformerDialog;
QMenu* openRecent;
@@ -214,16 +208,13 @@ class MusE : public QMainWindow
void updateConfiguration();
virtual void focusInEvent(QFocusEvent*);
- virtual void keyPressEvent(QKeyEvent*); // p4.0.10 Tim.
- QSignalMapper *editSignalMapper;
QSignalMapper *midiPluginSignalMapper;
QSignalMapper *followSignalMapper;
- QSignalMapper *scoreOneStaffPerTrackMapper;
- QSignalMapper *scoreAllInOneMapper;
signals:
void configChanged();
+ void activeTopWinChanged(TopWin*);
private slots:
void loadProject();
@@ -244,6 +235,7 @@ class MusE : public QMainWindow
void toggleTransport(bool);
void toggleMarker(bool);
+ void toggleArranger(bool);
void toggleBigTime(bool);
void toggleMixer1(bool);
void toggleMixer2(bool);
@@ -253,30 +245,9 @@ class MusE : public QMainWindow
void configShortCuts();
void configMetronome();
void configAppearance();
- void startEditor(PartList*, int);
- void startMasterEditor();
- void startLMasterEditor();
- void startListEditor();
- void startListEditor(PartList*);
- void startDrumEditor();
- void startDrumEditor(PartList* /*pl*/, bool /*showDefaultCtrls*/ = false);
- void startEditor(Track*);
- void openInScoreEdit(ScoreEdit* destination, PartList* pl, bool allInOne=false);
- void openInScoreEdit(ScoreEdit* destination, bool allInOne=false);
- void openInScoreEdit_allInOne(QWidget* destination);
- void openInScoreEdit_oneStaffPerTrack(QWidget* destination);
- void clearScoreMenuMappers();
- void updateScoreMenus();
- void scoreNamingChanged();
- void startScoreQuickly();
- void startPianoroll();
- void startPianoroll(PartList* /*pl*/, bool /*showDefaultCtrls*/ = false);
- void startWaveEditor();
- void startWaveEditor(PartList*);
void startSongInfo(bool editable=true);
- void startMidiTransformer();
void writeGlobalConfiguration() const;
//void startEditInstrument();
void startClipList(bool);
@@ -284,8 +255,6 @@ class MusE : public QMainWindow
void openRecentMenu();
void selectProject(QAction* act);
void cmd(int);
- void clipboardChanged();
- void selectionChanged();
/* void copyMeasure(); // commented out by flo: these are not implemented,
void eraseMeasure(); // but maybe will be in future (state: revision 988)
void deleteMeasure();
@@ -300,11 +269,6 @@ class MusE : public QMainWindow
#ifdef BUILD_EXPERIMENTAL
void hideMidiRhythmGenerator();
#endif
- void globalCut();
- void globalInsert();
- void globalSplit();
- void copyRange();
- void cutEvents();
void bounceToTrack();
void resetMidiDevices();
void initMidiDevices();
@@ -316,11 +280,13 @@ 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*);
public slots:
bool saveAs();
@@ -328,7 +294,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();
@@ -337,12 +303,36 @@ 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);
+
public:
MusE(int argc, char** argv);
~MusE();
@@ -366,6 +356,10 @@ class MusE : public QMainWindow
void showTransport(bool flag);
RoutePopupMenu* getRoutingPopupMenu();
+ const ToplevelList* getToplevels() { return &toplevels; }
+
+ TopWin* getCurrentMenuSharingTopwin() { return currentMenuSharingTopwin; }
+
#ifdef HAVE_LASH
void lash_idle_cb ();
#endif
diff --git a/muse2/muse/arranger/CMakeLists.txt b/muse2/muse/arranger/CMakeLists.txt
index c681245e..b679a37a 100644
--- a/muse2/muse/arranger/CMakeLists.txt
+++ b/muse2/muse/arranger/CMakeLists.txt
@@ -24,6 +24,7 @@
QT4_WRAP_CPP (arranger_mocs
alayout.h
arranger.h
+ arrangerview.h
pcanvas.h
tlist.h
)
@@ -34,6 +35,7 @@ QT4_WRAP_CPP (arranger_mocs
file (GLOB arranger_source_files
alayout.cpp
arranger.cpp
+ arrangerview.cpp
pcanvas.cpp
tlist.cpp
)
diff --git a/muse2/muse/arranger/arranger.cpp b/muse2/muse/arranger/arranger.cpp
index e1205d6f..0ca0b66d 100644
--- a/muse2/muse/arranger/arranger.cpp
+++ b/muse2/muse/arranger/arranger.cpp
@@ -23,6 +23,7 @@
#include <QWheelEvent>
#include <QPainter>
//#include <QStackedWidget>
+#include "arrangerview.h"
#include "arranger.h"
#include "song.h"
@@ -96,7 +97,7 @@ void Arranger::setHeaderWhatsThis()
// is the central widget in app
//---------------------------------------------------------
-Arranger::Arranger(QMainWindow* parent, const char* name)
+Arranger::Arranger(ArrangerView* parent, const char* name)
: QWidget(parent)
{
setObjectName(name);
@@ -112,6 +113,8 @@ Arranger::Arranger(QMainWindow* parent, const char* name)
cursVal = MAXINT;
+ parentWin=parent;
+
//setFocusPolicy(Qt::StrongFocus);
//---------------------------------------------------
diff --git a/muse2/muse/arranger/arranger.h b/muse2/muse/arranger/arranger.h
index 262d7464..433cf28f 100644
--- a/muse2/muse/arranger/arranger.h
+++ b/muse2/muse/arranger/arranger.h
@@ -38,6 +38,7 @@ class TLLayout;
class WidgetStack;
class AudioStrip;
class SpinBox;
+class ArrangerView;
//---------------------------------------------------------
// WidgetStack
@@ -152,7 +153,7 @@ class Arranger : public QWidget {
enum { CMD_CUT_PART, CMD_COPY_PART, CMD_PASTE_PART, CMD_PASTE_CLONE_PART, CMD_PASTE_PART_TO_TRACK, CMD_PASTE_CLONE_PART_TO_TRACK,
CMD_INSERT_PART, CMD_INSERT_EMPTYMEAS };
- Arranger(QMainWindow* parent, const char* name = 0);
+ Arranger(ArrangerView* parent, const char* name = 0);
PartCanvas* getCanvas() { return canvas; }
void setMode(int);
@@ -169,6 +170,8 @@ class Arranger : public QWidget {
void clear();
unsigned cursorValue() { return cursVal; }
+
+ ArrangerView* parentWin;
};
#endif
diff --git a/muse2/muse/arranger/arrangerview.cpp b/muse2/muse/arranger/arrangerview.cpp
new file mode 100644
index 00000000..6ec47375
--- /dev/null
+++ b/muse2/muse/arranger/arrangerview.cpp
@@ -0,0 +1,925 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// arrangerview.cpp
+// (C) Copyright 2011 Florian Jung (flo93@users.sourceforge.net)
+//=========================================================
+
+
+#include <QLayout>
+#include <QSizeGrip>
+#include <QLabel>
+#include <QScrollBar>
+#include <QPushButton>
+#include <QToolButton>
+#include <QToolTip>
+#include <QMenu>
+#include <QSignalMapper>
+#include <QMenuBar>
+#include <QApplication>
+#include <QClipboard>
+#include <QDir>
+#include <QKeySequence>
+#include <QKeyEvent>
+#include <QGridLayout>
+#include <QResizeEvent>
+#include <QCloseEvent>
+#include <QMimeData>
+#include <QScrollArea>
+#include <QSettings>
+#include <QImage>
+#include <QInputDialog>
+#include <QMessageBox>
+#include <QShortcut>
+
+#include <stdio.h>
+#include <math.h>
+
+#include "arrangerview.h"
+#include "visibletracks.h"
+
+
+#include <iostream>
+#include <sstream>
+using namespace std;
+
+#include "app.h"
+#include "xml.h"
+#include "mtscale.h"
+#include "al/sig.h"
+#include "scoreedit.h"
+#include "tools.h"
+#include "ttoolbar.h"
+#include "tb1.h"
+#include "globals.h"
+#include "gconfig.h"
+#include "icons.h"
+#include "audio.h"
+#include "functions.h"
+#include "helper.h"
+#include "sig.h"
+#include "song.h"
+#include "shortcuts.h"
+#include "synth.h"
+
+#ifdef DSSI_SUPPORT
+#include "dssihost.h"
+#endif
+
+#ifdef VST_SUPPORT
+#include "vst.h"
+#endif
+
+
+//---------------------------------------------------------
+// populateAddSynth
+//---------------------------------------------------------
+
+// ORCAN - CHECK
+QMenu* populateAddSynth(QWidget* parent)
+{
+ QMenu* synp = new QMenu(parent);
+
+ //typedef std::multimap<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;
+ }
+
+
+
+
+
+//---------------------------------------------------------
+// ArrangerView
+//---------------------------------------------------------
+
+ArrangerView::ArrangerView(QWidget* parent)
+ : TopWin(TopWin::ARRANGER, parent, "arrangerview", Qt::Window)
+{
+ //setAttribute(Qt::WA_DeleteOnClose);
+ setWindowTitle(tr("MusE: Arranger"));
+ setFocusPolicy(Qt::StrongFocus);
+
+
+ arranger = new Arranger(this, "arranger");
+ setCentralWidget(arranger);
+
+ scoreOneStaffPerTrackMapper = new QSignalMapper(this);
+ scoreAllInOneMapper = new QSignalMapper(this);
+
+ editSignalMapper = new QSignalMapper(this);
+ QShortcut* sc = new QShortcut(shortcuts[SHRT_DELETE].key, this);
+ sc->setContext(Qt::WindowShortcut);
+ connect(sc, SIGNAL(activated()), editSignalMapper, SLOT(map()));
+ editSignalMapper->setMapping(sc, CMD_DELETE);
+
+ // Toolbars ---------------------------------------------------------
+ QToolBar* undo_tools=addToolBar(tr("Undo/Redo tools"));
+ undo_tools->setObjectName("Undo/Redo tools");
+ undo_tools->addActions(undoRedo->actions());
+
+
+ QToolBar* panic_toolbar = addToolBar(tr("panic"));
+ panic_toolbar->setObjectName("panic");
+ panic_toolbar->addAction(panicAction);
+
+ QToolBar* transport_toolbar = addToolBar(tr("transport"));
+ transport_toolbar->setObjectName("transport");
+ transport_toolbar->addActions(transportAction->actions());
+
+ editTools = new EditToolBar(this, arrangerTools);
+ addToolBar(editTools);
+ editTools->setObjectName("arrangerTools");
+
+ visTracks = new VisibleTracks(this);
+ addToolBar(visTracks);
+
+
+
+ connect(editTools, SIGNAL(toolChanged(int)), arranger, SLOT(setTool(int)));
+ connect(visTracks, SIGNAL(visibilityChanged()), song, SLOT(update()) );
+ connect(arranger, SIGNAL(editPart(Track*)), muse, SLOT(startEditor(Track*)));
+ connect(arranger, SIGNAL(dropSongFile(const QString&)), muse, SLOT(loadProjectFile(const QString&)));
+ connect(arranger, SIGNAL(dropMidiFile(const QString&)), muse, SLOT(importMidi(const QString&)));
+ connect(arranger, SIGNAL(startEditor(PartList*,int)), muse, SLOT(startEditor(PartList*,int)));
+ connect(arranger, SIGNAL(toolChanged(int)), editTools, SLOT(set(int)));
+ connect(muse, SIGNAL(configChanged()), arranger, SLOT(configChanged()));
+ connect(arranger, SIGNAL(setUsedTool(int)), editTools, SLOT(set(int)));
+ connect(arranger, SIGNAL(selectionChanged()), SLOT(selectionChanged()));
+
+
+
+
+
+
+ //-------- Edit Actions
+ editCutAction = new QAction(QIcon(*editcutIconSet), tr("C&ut"), this);
+ editCopyAction = new QAction(QIcon(*editcopyIconSet), tr("&Copy"), this);
+ editPasteAction = new QAction(QIcon(*editpasteIconSet), tr("&Paste"), this);
+ editInsertAction = new QAction(QIcon(*editpasteIconSet), tr("&Insert"), this);
+ editInsertEMAction = new QAction(QIcon(*editpasteIconSet), tr("&Insert Empty Measure"), this);
+ editPasteCloneAction = new QAction(QIcon(*editpasteCloneIconSet), tr("Paste c&lone"), this);
+ editPaste2TrackAction = new QAction(QIcon(*editpaste2TrackIconSet), tr("Paste to &track"), this);
+ editPasteC2TAction = new QAction(QIcon(*editpasteClone2TrackIconSet), tr("Paste clone to trac&k"), this);
+ editDeleteSelectedAction = new QAction(QIcon(*edit_track_delIcon), tr("Delete Selected Tracks"), this);
+
+ editShrinkPartsAction = new QAction(tr("Shrink selected parts"), this); //FINDMICH TODO tooltips!
+ editExpandPartsAction = new QAction(tr("Expand selected parts"), this);
+ editCleanPartsAction = new QAction(tr("Clean selected parts"), this);
+
+
+ addTrack = new QMenu(tr("Add Track"), this);
+ addTrack->setIcon(QIcon(*edit_track_addIcon));
+ select = new QMenu(tr("Select"), this);
+ select->setIcon(QIcon(*selectIcon));
+
+ editSelectAllAction = new QAction(QIcon(*select_allIcon), tr("Select &All"), this);
+ editDeselectAllAction = new QAction(QIcon(*select_deselect_allIcon), tr("&Deselect All"), this);
+ editInvertSelectionAction = new QAction(QIcon(*select_invert_selectionIcon), tr("Invert &Selection"), this);
+ editInsideLoopAction = new QAction(QIcon(*select_inside_loopIcon), tr("&Inside Loop"), this);
+ editOutsideLoopAction = new QAction(QIcon(*select_outside_loopIcon), tr("&Outside Loop"), this);
+ editAllPartsAction = new QAction( QIcon(*select_all_parts_on_trackIcon), tr("All &Parts on Track"), this);
+
+
+ scoreSubmenu = new QMenu(tr("Score"), this);
+ scoreSubmenu->setIcon(QIcon(*scoreIconSet));
+
+ scoreAllInOneSubsubmenu = new QMenu(tr("all parts in one staff"), this);
+ scoreOneStaffPerTrackSubsubmenu = new QMenu(tr("one staff per part"), this);
+
+ scoreSubmenu->addMenu(scoreAllInOneSubsubmenu);
+ scoreSubmenu->addMenu(scoreOneStaffPerTrackSubsubmenu);
+ updateScoreMenus();
+
+ startScoreEditAction = new QAction(*scoreIconSet, tr("New score window"), this);
+ startPianoEditAction = new QAction(*pianoIconSet, tr("Pianoroll"), this);
+ startDrumEditAction = new QAction(QIcon(*edit_drummsIcon), tr("Drums"), this);
+ startListEditAction = new QAction(QIcon(*edit_listIcon), tr("List"), this);
+ startWaveEditAction = new QAction(QIcon(*edit_waveIcon), tr("Wave"), this);
+
+ master = new QMenu(tr("Mastertrack"), this);
+ master->setIcon(QIcon(*edit_mastertrackIcon));
+ masterGraphicAction = new QAction(QIcon(*mastertrack_graphicIcon),tr("Graphic"), this);
+ masterListAction = new QAction(QIcon(*mastertrack_listIcon),tr("List"), this);
+
+ midiTransformerAction = new QAction(QIcon(*midi_transformIcon), tr("Midi &Transform"), this);
+
+
+ //-------- Structure Actions
+ strGlobalCutAction = new QAction(tr("Global Cut"), this);
+ strGlobalInsertAction = new QAction(tr("Global Insert"), this);
+ strGlobalSplitAction = new QAction(tr("Global Split"), this);
+ strCopyRangeAction = new QAction(tr("Copy Range"), this);
+ strCopyRangeAction->setEnabled(false);
+ strCutEventsAction = new QAction(tr("Cut Events"), this);
+ strCutEventsAction->setEnabled(false);
+
+
+
+ //-------------------------------------------------------------
+ // popup Edit
+ //-------------------------------------------------------------
+
+ QMenu* menuEdit = menuBar()->addMenu(tr("&Edit"));
+ menuEdit->addActions(undoRedo->actions());
+ menuEdit->addSeparator();
+
+ menuEdit->addAction(editCutAction);
+ menuEdit->addAction(editCopyAction);
+ menuEdit->addAction(editPasteAction);
+ menuEdit->addAction(editInsertAction);
+ menuEdit->addAction(editInsertEMAction);
+ menuEdit->addAction(editPasteCloneAction);
+ menuEdit->addAction(editPaste2TrackAction);
+ menuEdit->addAction(editPasteC2TAction);
+ menuEdit->addSeparator();
+ menuEdit->addAction(editShrinkPartsAction);
+ menuEdit->addAction(editExpandPartsAction);
+ menuEdit->addAction(editCleanPartsAction);
+ menuEdit->addSeparator();
+ menuEdit->addAction(editDeleteSelectedAction);
+
+ menuEdit->addMenu(addTrack);
+ menuEdit->addMenu(select);
+ select->addAction(editSelectAllAction);
+ select->addAction(editDeselectAllAction);
+ select->addAction(editInvertSelectionAction);
+ select->addAction(editInsideLoopAction);
+ select->addAction(editOutsideLoopAction);
+ select->addAction(editAllPartsAction);
+ menuEdit->addSeparator();
+
+ menuEdit->addAction(startPianoEditAction);
+ menuEdit->addMenu(scoreSubmenu);
+ menuEdit->addAction(startScoreEditAction);
+ menuEdit->addAction(startDrumEditAction);
+ menuEdit->addAction(startListEditAction);
+ menuEdit->addAction(startWaveEditAction);
+
+ menuEdit->addMenu(master);
+ master->addAction(masterGraphicAction);
+ master->addAction(masterListAction);
+ menuEdit->addSeparator();
+
+ menuEdit->addAction(midiTransformerAction);
+
+ QMenu* menuStructure = menuEdit->addMenu(tr("&Structure"));
+ menuStructure->addAction(strGlobalCutAction);
+ menuStructure->addAction(strGlobalInsertAction);
+ menuStructure->addAction(strGlobalSplitAction);
+ menuStructure->addAction(strCopyRangeAction);
+ menuStructure->addSeparator();
+ menuStructure->addAction(strCutEventsAction);
+
+ QMenu* menuSettings = menuBar()->addMenu(tr("&Settings"));
+ menuSettings->addAction(subwinAction);
+ menuSettings->addAction(shareAction);
+
+
+ //-------- Edit connections
+ connect(editCutAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
+ connect(editCopyAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
+ connect(editPasteAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
+ connect(editInsertAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
+ connect(editInsertEMAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
+ connect(editPasteCloneAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
+ connect(editPaste2TrackAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
+ connect(editPasteC2TAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
+ connect(editDeleteSelectedAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
+
+ connect(editShrinkPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
+ connect(editExpandPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
+ connect(editCleanPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
+
+ connect(editSelectAllAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
+ connect(editDeselectAllAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
+ connect(editInvertSelectionAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
+ connect(editInsideLoopAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
+ connect(editOutsideLoopAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
+ connect(editAllPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
+
+ editSignalMapper->setMapping(editCutAction, CMD_CUT);
+ editSignalMapper->setMapping(editCopyAction, CMD_COPY);
+ editSignalMapper->setMapping(editPasteAction, CMD_PASTE);
+ editSignalMapper->setMapping(editInsertAction, CMD_INSERT);
+ editSignalMapper->setMapping(editPasteCloneAction, CMD_PASTE_CLONE);
+ editSignalMapper->setMapping(editPaste2TrackAction, CMD_PASTE_TO_TRACK);
+ editSignalMapper->setMapping(editPasteC2TAction, CMD_PASTE_CLONE_TO_TRACK);
+ editSignalMapper->setMapping(editInsertEMAction, CMD_INSERTMEAS);
+ editSignalMapper->setMapping(editDeleteSelectedAction, CMD_DELETE_TRACK);
+ editSignalMapper->setMapping(editShrinkPartsAction, CMD_SHRINK_PART);
+ editSignalMapper->setMapping(editExpandPartsAction, CMD_EXPAND_PART);
+ editSignalMapper->setMapping(editCleanPartsAction, CMD_CLEAN_PART);
+ editSignalMapper->setMapping(editSelectAllAction, CMD_SELECT_ALL);
+ editSignalMapper->setMapping(editDeselectAllAction, CMD_SELECT_NONE);
+ editSignalMapper->setMapping(editInvertSelectionAction, CMD_SELECT_INVERT);
+ editSignalMapper->setMapping(editInsideLoopAction, CMD_SELECT_ILOOP);
+ editSignalMapper->setMapping(editOutsideLoopAction, CMD_SELECT_OLOOP);
+ editSignalMapper->setMapping(editAllPartsAction, CMD_SELECT_PARTS);
+
+ connect(editSignalMapper, SIGNAL(mapped(int)), this, SLOT(cmd(int)));
+
+ connect(startPianoEditAction, SIGNAL(activated()), muse, SLOT(startPianoroll()));
+ connect(startScoreEditAction, SIGNAL(activated()), muse, SLOT(startScoreQuickly()));
+ connect(startDrumEditAction, SIGNAL(activated()), muse, SLOT(startDrumEditor()));
+ connect(startListEditAction, SIGNAL(activated()), muse, SLOT(startListEditor()));
+ connect(startWaveEditAction, SIGNAL(activated()), muse, SLOT(startWaveEditor()));
+ connect(scoreOneStaffPerTrackMapper, SIGNAL(mapped(QWidget*)), muse, SLOT(openInScoreEdit_oneStaffPerTrack(QWidget*)));
+ connect(scoreAllInOneMapper, SIGNAL(mapped(QWidget*)), muse, SLOT(openInScoreEdit_allInOne(QWidget*)));
+
+
+ connect(masterGraphicAction, SIGNAL(activated()), muse, SLOT(startMasterEditor()));
+ connect(masterListAction, SIGNAL(activated()), muse, SLOT(startLMasterEditor()));
+
+ connect(midiTransformerAction, SIGNAL(activated()), muse, SLOT(startMidiTransformer()));
+
+
+ //-------- Structure connections
+ connect(strGlobalCutAction, SIGNAL(activated()), SLOT(globalCut()));
+ connect(strGlobalInsertAction, SIGNAL(activated()), SLOT(globalInsert()));
+ connect(strGlobalSplitAction, SIGNAL(activated()), SLOT(globalSplit()));
+ connect(strCopyRangeAction, SIGNAL(activated()), SLOT(copyRange()));
+ connect(strCutEventsAction, SIGNAL(activated()), SLOT(cutEvents()));
+
+
+
+ connect(muse, SIGNAL(configChanged()), SLOT(updateShortcuts()));
+
+
+ QClipboard* cb = QApplication::clipboard();
+ connect(cb, SIGNAL(dataChanged()), SLOT(clipboardChanged()));
+ connect(cb, SIGNAL(selectionChanged()), SLOT(clipboardChanged()));
+
+
+
+ // work around for probable QT/WM interaction bug.
+ // for certain window managers, e.g xfce, this window is
+ // is displayed although not specifically set to show();
+ // bug: 2811156 Softsynth GUI unclosable with XFCE4 (and a few others)
+ show();
+ hide();
+
+ initalizing=false;
+}
+
+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 == "arranger")
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// writeConfiguration
+//---------------------------------------------------------
+
+void ArrangerView::writeConfiguration(int level, Xml& xml)
+ {
+ xml.tag(level++, "arranger");
+ TopWin::writeConfiguration(ARRANGER, level, xml);
+ xml.tag(level, "/arranger");
+ }
+
+
+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_PASTE:
+ arranger->cmd(Arranger::CMD_PASTE_PART);
+ break;
+ case CMD_PASTE_CLONE:
+ arranger->cmd(Arranger::CMD_PASTE_CLONE_PART);
+ break;
+ case CMD_PASTE_TO_TRACK:
+ arranger->cmd(Arranger::CMD_PASTE_PART_TO_TRACK);
+ break;
+ case CMD_PASTE_CLONE_TO_TRACK:
+ arranger->cmd(Arranger::CMD_PASTE_CLONE_PART_TO_TRACK);
+ break;
+ case CMD_INSERT:
+ arranger->cmd(Arranger::CMD_INSERT_PART);
+ break;
+ case CMD_INSERTMEAS:
+ arranger->cmd(Arranger::CMD_INSERT_EMPTYMEAS);
+ break;
+ case CMD_DELETE:
+ if (!song->msgRemoveParts()) //automatically does undo if neccessary and returns true then
+ {
+ //msgRemoveParts() returned false -> no parts to remove?
+ song->startUndo();
+ audio->msgRemoveTracks(); //TODO FINDME this could still be speeded up!
+ song->endUndo(SC_TRACK_REMOVED);
+ }
+ break;
+ case CMD_DELETE_TRACK:
+ song->startUndo();
+ audio->msgRemoveTracks();
+ song->endUndo(SC_TRACK_REMOVED);
+ audio->msgUpdateSoloStates();
+ break;
+
+ case CMD_SELECT_ALL:
+ case CMD_SELECT_NONE:
+ case CMD_SELECT_INVERT:
+ case CMD_SELECT_ILOOP:
+ case CMD_SELECT_OLOOP:
+ for (iTrack i = tracks->begin(); i != tracks->end(); ++i) {
+ PartList* parts = (*i)->parts();
+ for (iPart p = parts->begin(); p != parts->end(); ++p) {
+ bool f = false;
+ int t1 = p->second->tick();
+ int t2 = t1 + p->second->lenTick();
+ bool inside =
+ ((t1 >= l) && (t1 < r))
+ || ((t2 > l) && (t2 < r))
+ || ((t1 <= l) && (t2 > r));
+ switch(cmd) {
+ case CMD_SELECT_INVERT:
+ f = !p->second->selected();
+ break;
+ case CMD_SELECT_NONE:
+ f = false;
+ break;
+ case CMD_SELECT_ALL:
+ f = true;
+ break;
+ case CMD_SELECT_ILOOP:
+ f = inside;
+ break;
+ case CMD_SELECT_OLOOP:
+ f = !inside;
+ break;
+ }
+ p->second->setSelected(f);
+ }
+ }
+ song->update();
+ break;
+
+ case CMD_SELECT_PARTS:
+ for (iTrack i = tracks->begin(); i != tracks->end(); ++i) {
+ if (!(*i)->selected())
+ continue;
+ PartList* parts = (*i)->parts();
+ for (iPart p = parts->begin(); p != parts->end(); ++p)
+ p->second->setSelected(true);
+ }
+ song->update();
+ break;
+
+ case CMD_SHRINK_PART: shrink_parts(); break;
+ case CMD_EXPAND_PART: expand_parts(); break;
+ case CMD_CLEAN_PART: clean_parts(); break;
+
+ }
+ }
+
+void ArrangerView::scoreNamingChanged()
+{
+ updateScoreMenus();
+}
+
+void ArrangerView::updateScoreMenus()
+{
+ QAction* action;
+
+
+ scoreOneStaffPerTrackSubsubmenu->clear();
+ scoreAllInOneSubsubmenu->clear();
+
+
+ action=new QAction(tr("New"), this);
+ connect(action, SIGNAL(activated()), scoreOneStaffPerTrackMapper, SLOT(map()));
+ scoreOneStaffPerTrackMapper->setMapping(action, (QWidget*)NULL);
+ scoreOneStaffPerTrackSubsubmenu->addAction(action);
+
+
+ action=new QAction(tr("New"), this); //the above action may NOT be reused!
+ connect(action, SIGNAL(activated()), scoreAllInOneMapper, SLOT(map()));
+ scoreAllInOneMapper->setMapping(action, (QWidget*)NULL);
+ scoreAllInOneSubsubmenu->addAction(action);
+
+ const ToplevelList* toplevels=muse->getToplevels();
+
+ for (ToplevelList::const_iterator it=toplevels->begin(); it!=toplevels->end(); it++)
+ if ((*it)->type()==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 = ::populateAddTrack(addTrack);
+
+ trackMidiAction = grp->actions()[0];
+ trackDrumAction = grp->actions()[1];
+ trackWaveAction = grp->actions()[2];
+ trackAOutputAction = grp->actions()[3];
+ trackAGroupAction = grp->actions()[4];
+ trackAInputAction = grp->actions()[5];
+ trackAAuxAction = grp->actions()[6];
+}
+
+void ArrangerView::updateShortcuts()
+{
+ editCutAction->setShortcut(shortcuts[SHRT_CUT].key);
+ editCopyAction->setShortcut(shortcuts[SHRT_COPY].key);
+ editPasteAction->setShortcut(shortcuts[SHRT_PASTE].key);
+ editInsertAction->setShortcut(shortcuts[SHRT_INSERT].key);
+ editInsertEMAction->setShortcut(shortcuts[SHRT_INSERTMEAS].key);
+ editPasteCloneAction->setShortcut(shortcuts[SHRT_PASTE_CLONE].key);
+ editPaste2TrackAction->setShortcut(shortcuts[SHRT_PASTE_TO_TRACK].key);
+ editPasteC2TAction->setShortcut(shortcuts[SHRT_PASTE_CLONE_TO_TRACK].key);
+
+ //editDeleteSelectedAction has no acceleration
+
+ trackMidiAction->setShortcut(shortcuts[SHRT_ADD_MIDI_TRACK].key);
+ trackDrumAction->setShortcut(shortcuts[SHRT_ADD_DRUM_TRACK].key);
+ trackWaveAction->setShortcut(shortcuts[SHRT_ADD_WAVE_TRACK].key);
+ trackAOutputAction->setShortcut(shortcuts[SHRT_ADD_AUDIO_OUTPUT].key);
+ trackAGroupAction->setShortcut(shortcuts[SHRT_ADD_AUDIO_GROUP].key);
+ trackAInputAction->setShortcut(shortcuts[SHRT_ADD_AUDIO_INPUT].key);
+ trackAAuxAction->setShortcut(shortcuts[SHRT_ADD_AUDIO_AUX].key);
+
+ editSelectAllAction->setShortcut(shortcuts[SHRT_SELECT_ALL].key);
+ editDeselectAllAction->setShortcut(shortcuts[SHRT_SELECT_NONE].key);
+ editInvertSelectionAction->setShortcut(shortcuts[SHRT_SELECT_INVERT].key);
+ editInsideLoopAction->setShortcut(shortcuts[SHRT_SELECT_OLOOP].key);
+ editOutsideLoopAction->setShortcut(shortcuts[SHRT_SELECT_OLOOP].key);
+ editAllPartsAction->setShortcut(shortcuts[SHRT_SELECT_PRTSTRACK].key);
+
+ startPianoEditAction->setShortcut(shortcuts[SHRT_OPEN_PIANO].key);
+ startDrumEditAction->setShortcut(shortcuts[SHRT_OPEN_DRUMS].key);
+ startListEditAction->setShortcut(shortcuts[SHRT_OPEN_LIST].key);
+ startWaveEditAction->setShortcut(shortcuts[SHRT_OPEN_WAVE].key);
+
+ masterGraphicAction->setShortcut(shortcuts[SHRT_OPEN_GRAPHIC_MASTER].key);
+ masterListAction->setShortcut(shortcuts[SHRT_OPEN_LIST_MASTER].key);
+
+ midiTransformerAction->setShortcut(shortcuts[SHRT_OPEN_MIDI_TRANSFORM].key);
+ strGlobalCutAction->setShortcut(shortcuts[SHRT_GLOBAL_CUT].key);
+ strGlobalInsertAction->setShortcut(shortcuts[SHRT_GLOBAL_INSERT].key);
+ strGlobalSplitAction->setShortcut(shortcuts[SHRT_GLOBAL_SPLIT].key);
+ strCopyRangeAction->setShortcut(shortcuts[SHRT_COPY_RANGE].key);
+ strCutEventsAction->setShortcut(shortcuts[SHRT_CUT_EVENTS].key);
+}
+
+//---------------------------------------------------------
+// clipboardChanged
+//---------------------------------------------------------
+
+void ArrangerView::clipboardChanged()
+ {
+ bool flag = false;
+ if(QApplication::clipboard()->mimeData()->hasFormat(QString("text/x-muse-midipartlist")) ||
+ QApplication::clipboard()->mimeData()->hasFormat(QString("text/x-muse-wavepartlist")) ||
+ QApplication::clipboard()->mimeData()->hasFormat(QString("text/x-muse-mixedpartlist")))
+ flag = true;
+
+ editPasteAction->setEnabled(flag);
+ editInsertAction->setEnabled(flag);
+ editPasteCloneAction->setEnabled(flag);
+ editPaste2TrackAction->setEnabled(flag);
+ editPasteC2TAction->setEnabled(flag);
+ }
+
+//---------------------------------------------------------
+// selectionChanged
+//---------------------------------------------------------
+
+void ArrangerView::selectionChanged()
+ {
+ //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();
+}
diff --git a/muse2/muse/arranger/arrangerview.h b/muse2/muse/arranger/arrangerview.h
new file mode 100644
index 00000000..47edf6d3
--- /dev/null
+++ b/muse2/muse/arranger/arrangerview.h
@@ -0,0 +1,130 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// arrangerview.h
+// (C) Copyright 2011 Florian Jung (flo93@users.sourceforge.net)
+//=========================================================
+
+#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"
+
+class VisibleTracks;
+
+
+class ArrangerView : public TopWin
+{
+ Q_OBJECT
+
+ private:
+
+ enum cmd_enum
+ {CMD_CUT, CMD_COPY, CMD_PASTE, CMD_INSERT, CMD_INSERTMEAS, CMD_PASTE_CLONE,
+ CMD_PASTE_TO_TRACK, CMD_PASTE_CLONE_TO_TRACK, CMD_DELETE,
+ CMD_SELECT_ALL, CMD_SELECT_NONE, CMD_SELECT_INVERT,
+ CMD_SELECT_ILOOP, CMD_SELECT_OLOOP, CMD_SELECT_PARTS,
+ CMD_DELETE_TRACK, CMD_EXPAND_PART, CMD_SHRINK_PART, CMD_CLEAN_PART };
+
+ virtual void closeEvent(QCloseEvent*);
+
+ void adjustGlobalLists(Undo& operations, int startPos, int diff);
+
+ QGridLayout* mainGrid;
+ QWidget* mainw;
+
+ EditToolBar *editTools;
+ VisibleTracks *visTracks;
+
+ Arranger* arranger;
+
+ // Edit Menu actions
+ QMenu* select;
+ QMenu* addTrack;
+ QMenu* master;
+
+ QAction *strGlobalCutAction, *strGlobalInsertAction, *strGlobalSplitAction, *strCopyRangeAction, *strCutEventsAction;
+ QAction *trackMidiAction, *trackDrumAction, *trackWaveAction, *trackAOutputAction, *trackAGroupAction;
+ QAction *trackAInputAction, *trackAAuxAction;
+ QAction *editCutAction, *editCopyAction, *editPasteAction, *editInsertAction, *editPasteCloneAction, *editPaste2TrackAction;
+ QAction *editInsertEMAction, *editPasteC2TAction, *editDeleteSelectedAction, *editSelectAllAction, *editDeselectAllAction;
+ QAction *editInvertSelectionAction, *editInsideLoopAction, *editOutsideLoopAction, *editAllPartsAction;
+ QAction *masterGraphicAction, *masterListAction;
+ QAction *midiTransformerAction;
+ QAction *editCleanPartsAction, *editShrinkPartsAction, *editExpandPartsAction;
+
+ QSignalMapper *editSignalMapper;
+ QSignalMapper *scoreOneStaffPerTrackMapper;
+ QSignalMapper *scoreAllInOneMapper;
+
+ private slots:
+ void clearScoreMenuMappers();
+ void globalCut();
+ void globalInsert();
+ void globalSplit();
+ void copyRange();
+ void cutEvents();
+ void cmd(int);
+
+ 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 82f2de45..cf376042 100644
--- a/muse2/muse/arranger/pcanvas.cpp
+++ b/muse2/muse/arranger/pcanvas.cpp
@@ -25,6 +25,8 @@
#include "fastlog.h"
#include "widgets/tools.h"
+#include "arranger.h"
+#include "arrangerview.h"
#include "pcanvas.h"
#include "midieditor.h"
#include "globals.h"
@@ -628,17 +630,17 @@ QMenu* PartCanvas::genItemPopup(CItem* item)
partPopup->addSeparator();
switch(trackType) {
case Track::MIDI: {
- partPopup->addAction(muse->startPianoEditAction);
- partPopup->addMenu(muse->scoreSubmenu);
- partPopup->addAction(muse->startScoreEditAction);
- partPopup->addAction(muse->startListEditAction);
+ partPopup->addAction(muse->arranger->parentWin->startPianoEditAction);
+ partPopup->addMenu(muse->arranger->parentWin->scoreSubmenu);
+ partPopup->addAction(muse->arranger->parentWin->startScoreEditAction);
+ partPopup->addAction(muse->arranger->parentWin->startListEditAction);
QAction *act_mexport = partPopup->addAction(tr("save part to disk"));
act_mexport->setData(16);
}
break;
case Track::DRUM: {
- partPopup->addAction(muse->startDrumEditAction);
- partPopup->addAction(muse->startListEditAction);
+ partPopup->addAction(muse->arranger->parentWin->startDrumEditAction);
+ partPopup->addAction(muse->arranger->parentWin->startListEditAction);
QAction *act_dexport = partPopup->addAction(tr("save part to disk"));
act_dexport->setData(16);
}
diff --git a/muse2/muse/arranger/pcanvas.h b/muse2/muse/arranger/pcanvas.h
index 05f380e6..71a0129c 100644
--- a/muse2/muse/arranger/pcanvas.h
+++ b/muse2/muse/arranger/pcanvas.h
@@ -124,8 +124,6 @@ class PartCanvas : public Canvas {
double dbToVal(double inDb);
double valToDb(double inV);
-
-
protected:
virtual void drawCanvas(QPainter&, const QRect&);
virtual void endMoveItems(const QPoint&, DragType, int dir);
diff --git a/muse2/muse/cliplist/cliplist.cpp b/muse2/muse/cliplist/cliplist.cpp
index 96636463..6ee9c7fe 100644
--- a/muse2/muse/cliplist/cliplist.cpp
+++ b/muse2/muse/cliplist/cliplist.cpp
@@ -7,6 +7,9 @@
//=========================================================
#include <QCloseEvent>
+#include <QMenuBar>
+#include <QMenu>
+#include <QToolBar>
#include "cliplist.h"
#include "song.h"
@@ -97,7 +100,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"));
@@ -107,6 +110,24 @@ 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(undoRedo->actions());
+
+
+ QToolBar* panic_toolbar = addToolBar(tr("panic"));
+ panic_toolbar->setObjectName("panic");
+ panic_toolbar->addAction(panicAction);
+
+ QToolBar* transport_toolbar = addToolBar(tr("transport"));
+ transport_toolbar->setObjectName("transport");
+ transport_toolbar->addActions(transportAction->actions());
+
+ QMenu* settingsMenu = menuBar()->addMenu(tr("&Settings"));
+ settingsMenu->addAction(subwinAction);
+ settingsMenu->addAction(shareAction);
+
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;
@@ -123,6 +144,8 @@ ClipListEdit::ClipListEdit(QWidget* parent)
connect(editor->len, SIGNAL(valueChanged(const Pos&)), SLOT(lenChanged(const Pos&)));
updateList();
+
+ initalizing=false;
}
ClipListEdit::~ClipListEdit()
@@ -149,7 +172,7 @@ void ClipListEdit::updateList()
void ClipListEdit::closeEvent(QCloseEvent* e)
{
- emit deleted((unsigned long)this);
+ emit deleted(static_cast<TopWin*>(this));
e->accept();
}
@@ -205,6 +228,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 d440aec3..1932e975 100644
--- a/muse2/muse/cliplist/cliplist.h
+++ b/muse2/muse/cliplist/cliplist.h
@@ -54,13 +54,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 22f675a3..5e007fe3 100644
--- a/muse2/muse/cobject.cpp
+++ b/muse2/muse/cobject.cpp
@@ -9,6 +9,77 @@
#include "cobject.h"
#include "xml.h"
#include "gui.h"
+#include "globals.h"
+#include "app.h"
+
+#include <QMdiSubWindow>
+#include <QToolBar>
+#include <QMenuBar>
+#include <QAction>
+
+using std::list;
+
+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)
+ {
+ 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;
+
+ _defaultSubwin[SCORE]=true; //FINDMICH
+ _sharesWhenFree[SCORE]=true;
+
+ initInited=true;
+ }
+
+ initalizing=true;
+
+ _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)));
+
+ mdisubwin=NULL;
+ _sharesToolsAndMenu=_defaultSubwin[_type] ? _sharesWhenSubwin[_type] : _sharesWhenFree[_type];
+ if (_defaultSubwin[_type])
+ setIsMdiWin(true);
+
+
+ subwinAction->setChecked(isMdiWin());
+ shareAction->setChecked(_sharesToolsAndMenu);
+ }
+
+
//---------------------------------------------------------
// readStatus
@@ -63,13 +134,240 @@ void TopWin::writeStatus(int level, Xml& xml) const
xml.tag(level, "/topwin");
}
-TopWin::TopWin(QWidget* parent, const char* name,
- Qt::WindowFlags f) : QMainWindow(parent, f)
+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())
+ {
+ bool vis=isVisible();
+ QMdiSubWindow* subwin = createMdiWrapper();
+ muse->addMdiSubWindow(subwin);
+ subwin->setVisible(vis);
+
+ if (_sharesToolsAndMenu == _sharesWhenFree[_type])
+ shareToolsAndMenu(_sharesWhenSubwin[_type]);
+
+ subwinAction->setChecked(true);
+ }
+ else
+ {
+ if (debugMsg) printf("TopWin::setIsMdiWin(true) called, but window is already a MDI win\n");
+ }
+ }
+ else
+ {
+ if (isMdiWin())
+ {
+ bool vis=isVisible();
+ QMdiSubWindow* mdisubwin_temp=mdisubwin;
+ mdisubwin=NULL;
+ setParent(NULL);
+ mdisubwin_temp->hide();
+ //TODO FINDMICH evtl noch ein signal emitten oder sowas?
+ delete mdisubwin_temp;
+
+ printf("FINDMICH unMDIfied, visible is %i\n",vis);
+ setVisible(vis);
+
+ if (_sharesToolsAndMenu == _sharesWhenSubwin[_type])
+ shareToolsAndMenu(_sharesWhenFree[_type]);
+
+ subwinAction->setChecked(false);
+ }
+ else
+ {
+ if (debugMsg) printf("TopWin::setIsMdiWin(false) called, but window is not a MDI win\n");
+ }
+ }
+}
+
+bool TopWin::isMdiWin()
+{
+ 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);
+}
+
+QToolBar* TopWin::addToolBar(const QString& title)
+{
+ QToolBar* toolbar = new QToolBar(title, this);
+ addToolBar(toolbar);
+ return toolbar;
+}
+
+
+void TopWin::shareToolsAndMenu(bool val)
+{
+ _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);
+ else
+ QMainWindow::addToolBarBreak();
+
+ menuBar()->show();
+ }
+ else
+ {
+ for (list<QToolBar*>::iterator it=_toolbars.begin(); it!=_toolbars.end(); it++)
+ if (*it != NULL)
{
- setObjectName(QString(name));
- //setAttribute(Qt::WA_DeleteOnClose);
- // Allow multiple rows. Tim.
- //setDockNestingEnabled(true);
- setIconSize(ICON_SIZE);
+ 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()
+ {
+ if (initalizing)
+ printf("THIS SHOULD NEVER HAPPEN: STORE INIT STATE CALLED WHILE INITING! please IMMEDIATELY report that to flo!\n");
+
+ _widthInit[_type] = width();
+ _heightInit[_type] = height();
+ if (sharesToolsAndMenu())
+ {
+ if (muse->getCurrentMenuSharingTopwin() == this)
+ _toolbarSharedInit[_type] = muse->saveState();
+ }
+ else
+ _toolbarNonsharedInit[_type] = saveState();
+ }
+
+//---------------------------------------------------------
+// readConfiguration
+//---------------------------------------------------------
+
+void TopWin::readConfiguration(ToplevelType t, 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 == "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
+ xml.unknown("TopWin");
+ break;
+ case Xml::TagEnd:
+ if (tag == "topwin")
+ return;
+ default:
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// writeConfiguration
+//---------------------------------------------------------
+
+void TopWin::writeConfiguration(ToplevelType t, int level, Xml& xml)
+ {
+ 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.etag(level, "topwin");
}
+void TopWin::initTopwinState()
+{
+ printf("FINDMICH: in initTopwinState()\n");
+
+ if (sharesToolsAndMenu())
+ {
+ if (this == muse->getCurrentMenuSharingTopwin())
+ {
+ printf("FINDMICH RESTORING for %s...\n",windowTitle().toAscii().data());
+ muse->restoreState(_toolbarSharedInit[_type]);
+ }
+ }
+ else
+ restoreState(_toolbarNonsharedInit[_type]);
+}
+
+void TopWin::restoreMainwinState()
+{
+ if (sharesToolsAndMenu())
+ initTopwinState();
+}
diff --git a/muse2/muse/cobject.h b/muse2/muse/cobject.h
index 9a80b2b1..f76f6f61 100644
--- a/muse2/muse/cobject.h
+++ b/muse2/muse/cobject.h
@@ -13,8 +13,13 @@
#include <QMainWindow>
#include <list>
+#include <QByteArray>
+class QMdiSubWindow;
+class QFocusEvent;
+class QToolBar;
class Xml;
+class QAction;
//---------------------------------------------------------
// TopWin
@@ -25,40 +30,80 @@ 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; }
- private:
+
+ virtual void readStatus(Xml&);
+ virtual void writeStatus(int, Xml&) const;
+
+ static void readConfiguration(ToplevelType, Xml&);
+ static void writeConfiguration(ToplevelType, int, Xml&);
+
+
+ bool isMdiWin();
+
+ TopWin(ToplevelType t, QWidget* parent=0, const char* name=0, Qt::WindowFlags f = Qt::Window);
+
+ bool sharesToolsAndMenu() { return _sharesToolsAndMenu; }
+ const std::list<QToolBar*>& toolbars() { return _toolbars; }
+
+ void addToolBar(QToolBar* toolbar);
+ QToolBar* addToolBar(const QString& title);
+
+ 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();
+
+
+ protected:
+ QAction* subwinAction;
+ QAction* shareAction;
+
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 _sharesWhenFree[TOPLEVELTYPE_LAST_ENTRY];
+ static bool _sharesWhenSubwin[TOPLEVELTYPE_LAST_ENTRY];
+ static bool _defaultSubwin[TOPLEVELTYPE_LAST_ENTRY];
+ static bool initInited;
+
+ void initTopwinState();
+
+ bool initalizing; //if true, no state is saved
+
+ public slots:
+ virtual void hide();
+ virtual void show();
+ virtual void setVisible(bool);
+ void setIsMdiWin(bool);
+ void shareToolsAndMenu(bool);
+ void restoreMainwinState();
+ void storeInitialState();
+
};
-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 89cdd04d..7451e22c 100644
--- a/muse2/muse/conf.cpp
+++ b/muse2/muse/conf.cpp
@@ -19,6 +19,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"
@@ -894,6 +899,16 @@ 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 == "arranger")
+ ArrangerView::readConfiguration(xml);
else if (tag == "dialogs")
read_function_dialog_config(xml);
else if (tag == "shortcuts")
@@ -1338,6 +1353,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);
diff --git a/muse2/muse/functions.cpp b/muse2/muse/functions.cpp
index 2568899a..5861ca9e 100644
--- a/muse2/muse/functions.cpp
+++ b/muse2/muse/functions.cpp
@@ -28,6 +28,18 @@
#include <QMessageBox>
#include <QClipboard>
+#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"
+
+
using namespace std;
GateTime* gatetime_dialog=NULL;
diff --git a/muse2/muse/functions.h b/muse2/muse/functions.h
index 90fc64e9..3b8a23f3 100644
--- a/muse2/muse/functions.h
+++ b/muse2/muse/functions.h
@@ -8,24 +8,25 @@
#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 <QWidget>
class QString;
class QMimeData;
class Undo;
+class GateTime;
+class Velocity;
+class Quantize;
+class Remove;
+class DelOverlaps;
+class Setlen;
+class Move;
+class Transpose;
+class Crescendo;
+class Legato;
+
extern GateTime* gatetime_dialog;
extern Velocity* velocity_dialog;
extern Quantize* quantize_dialog;
diff --git a/muse2/muse/gconfig.cpp b/muse2/muse/gconfig.cpp
index 49a6d572..6583dae4 100644
--- a/muse2/muse/gconfig.cpp
+++ b/muse2/muse/gconfig.cpp
@@ -148,6 +148,7 @@ GlobalConfigValues config = {
false, // mixer2Visible;
false, // markerVisible;
+ true, // arrangerVisible;
true, // showSplashScreen
1, // canvasShowPartType 1 - names, 2 events
5, // canvasShowPartEvent
diff --git a/muse2/muse/gconfig.h b/muse2/muse/gconfig.h
index acf39782..5b8e9585 100644
--- a/muse2/muse/gconfig.h
+++ b/muse2/muse/gconfig.h
@@ -120,6 +120,7 @@ struct GlobalConfigValues {
bool mixer1Visible;
bool mixer2Visible;
bool markerVisible;
+ bool arrangerVisible;
bool showSplashScreen;
int canvasShowPartType; // 1 - names, 2 events
diff --git a/muse2/muse/liste/listedit.cpp b/muse2/muse/liste/listedit.cpp
index 5f73a3ba..c0580e3b 100644
--- a/muse2/muse/liste/listedit.cpp
+++ b/muse2/muse/liste/listedit.cpp
@@ -165,7 +165,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();
}
@@ -445,7 +445,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);
@@ -496,14 +496,28 @@ ListEdit::ListEdit(PartList* pl)
connect(editSignalMapper, SIGNAL(mapped(int)), SLOT(cmd(int)));
- //---------ToolBar----------------------------------
-
- listTools = addToolBar(tr("List tools"));
- listTools->addActions(undoRedo->actions());
-
+ QMenu* settingsMenu = menuBar()->addMenu(tr("&Settings"));
+ settingsMenu->addAction(subwinAction);
+ settingsMenu->addAction(shareAction);
+
+
+ // Toolbars ---------------------------------------------------------
+ QToolBar* undo_tools=addToolBar(tr("Undo/Redo tools"));
+ undo_tools->setObjectName("Undo/Redo tools");
+ undo_tools->addActions(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(panicAction);
+
+ QToolBar* transport_toolbar = addToolBar(tr("transport"));
+ transport_toolbar->setObjectName("transport");
+ transport_toolbar->addActions(transportAction->actions());
+
//
//---------------------------------------------------
// liste
@@ -574,6 +588,7 @@ ListEdit::ListEdit(PartList* pl)
}
initShortcuts();
+ initalizing=false;
}
//---------------------------------------------------------
@@ -813,6 +828,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 397a5e08..1b1a8ece 100644
--- a/muse2/muse/liste/listedit.h
+++ b/muse2/muse/liste/listedit.h
@@ -68,13 +68,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 192c0bd3..ebdf7b5d 100644
--- a/muse2/muse/main.cpp
+++ b/muse2/muse/main.cpp
@@ -101,6 +101,8 @@ class MuseApplication : public QApplication {
void setMuse(MusE* m) {
muse = m;
+
+ connect(this,SIGNAL(focusChanged(QWidget*,QWidget*)),muse,SLOT(focusChanged(QWidget*,QWidget*)));
#ifdef HAVE_LASH
if(useLASH)
startTimer (300);
diff --git a/muse2/muse/marker/markerview.cpp b/muse2/muse/marker/markerview.cpp
index d22807b6..89011b2b 100644
--- a/muse2/muse/marker/markerview.cpp
+++ b/muse2/muse/marker/markerview.cpp
@@ -141,7 +141,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();
}
@@ -151,7 +151,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);
@@ -172,15 +172,31 @@ MarkerView::MarkerView(QWidget* parent)
editMenu->addAction(markerAdd);
editMenu->addAction(markerDelete);
-
- //---------ToolBar----------------------------------
- tools = addToolBar(tr("marker-tools"));
- tools->addActions(undoRedo->actions());
+
+
+ QMenu* settingsMenu = menuBar()->addMenu(tr("&Settings"));
+ settingsMenu->addAction(subwinAction);
+ settingsMenu->addAction(shareAction);
+
+
+ // Toolbars ---------------------------------------------------------
+ QToolBar* undo_tools=addToolBar(tr("Undo/Redo tools"));
+ undo_tools->setObjectName("Undo/Redo tools");
+ undo_tools->addActions(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(panicAction);
+
+ QToolBar* transport_toolbar = addToolBar(tr("transport"));
+ transport_toolbar->setObjectName("transport");
+ transport_toolbar->addActions(transportAction->actions());
+
//---------------------------------------------------
// master
//---------------------------------------------------
@@ -269,7 +285,8 @@ MarkerView::MarkerView(QWidget* parent)
// bug: 2811156 Softsynth GUI unclosable with XFCE4 (and a few others)
show();
hide();
-
+
+ initalizing=false;
}
//---------------------------------------------------------
@@ -296,7 +313,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")
@@ -314,6 +334,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 5ad4f4bd..bab0f6e3 100644
--- a/muse2/muse/marker/markerview.h
+++ b/muse2/muse/marker/markerview.h
@@ -77,7 +77,7 @@ class MarkerView : public TopWin {
void songChanged(int);
signals:
- void deleted(unsigned long);
+ void deleted(TopWin*);
void closed();
public:
@@ -85,6 +85,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 9083c024..d1aad157 100644
--- a/muse2/muse/master/lmaster.cpp
+++ b/muse2/muse/master/lmaster.cpp
@@ -39,6 +39,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()
@@ -89,13 +90,15 @@ QString keyToString(key_enum key) //flo
return keyStrs[index];
}
+
+
//---------------------------------------------------------
// closeEvent
//---------------------------------------------------------
void LMaster::closeEvent(QCloseEvent* e)
{
- emit deleted((unsigned long)this);
+ emit deleted(static_cast<TopWin*>(this));
e->accept();
}
@@ -114,7 +117,7 @@ void LMaster::songChanged(int type)
//---------------------------------------------------------
LMaster::LMaster()
- : MidiEditor(0, 0, 0)
+ : MidiEditor(TopWin::LMASTER, 0, 0, 0)
{
pos_editor = 0;
tempo_editor = 0;
@@ -140,6 +143,11 @@ LMaster::LMaster()
delAction = menuEdit->addAction(tr("Delete Event"));
delAction->setShortcut(Qt::Key_Delete);
+ QMenu* settingsMenu = menuBar()->addMenu(tr("&Settings"));
+ settingsMenu->addAction(subwinAction);
+ settingsMenu->addAction(shareAction);
+
+
connect(tempoAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
connect(signAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
connect(keyAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
@@ -156,11 +164,13 @@ LMaster::LMaster()
connect(signalMapper, SIGNAL(mapped(int)), SLOT(cmd(int)));
- //---------ToolBar----------------------------------
- tools = addToolBar(tr("Master tools"));
- tools->addActions(undoRedo->actions());
+ // Toolbars ---------------------------------------------------------
+ QToolBar* undo_tools=addToolBar(tr("Undo/Redo tools"));
+ undo_tools->setObjectName("Undo/Redo tools");
+ undo_tools->addActions(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();
@@ -174,6 +184,14 @@ LMaster::LMaster()
edit->addWidget(timeSigButton);
edit->addWidget(keyButton);
+ QToolBar* panic_toolbar = addToolBar(tr("panic"));
+ panic_toolbar->setObjectName("panic");
+ panic_toolbar->addAction(panicAction);
+
+ QToolBar* transport_toolbar = addToolBar(tr("transport"));
+ transport_toolbar->setObjectName("transport");
+ transport_toolbar->addActions(transportAction->actions());
+
///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()));
@@ -231,6 +249,7 @@ LMaster::LMaster()
connect(keyButton, SIGNAL(clicked()), SLOT(insertKey()));
initShortcuts();
+ initalizing=false;
}
//---------------------------------------------------------
@@ -392,6 +411,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 b2919b23..d79fee4d 100644
--- a/muse2/muse/master/lmaster.h
+++ b/muse2/muse/master/lmaster.h
@@ -14,15 +14,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;
@@ -97,12 +92,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; }
@@ -126,7 +121,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();
@@ -156,7 +151,7 @@ class LMaster : public MidiEditor {
void configChanged();
signals:
- void deleted(unsigned long);
+ void deleted(TopWin*);
void seekTo(int tick);
public:
@@ -164,6 +159,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 fafa3b4f..777e6066 100644
--- a/muse2/muse/master/masteredit.cpp
+++ b/muse2/muse/master/masteredit.cpp
@@ -31,12 +31,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
@@ -44,11 +42,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();
}
@@ -85,22 +79,34 @@ void MasterEdit::songChanged(int type)
//---------------------------------------------------------
MasterEdit::MasterEdit()
- : MidiEditor(_rasterInit, 0)
+ : MidiEditor(TopWin::MASTER, _rasterInit, 0)
{
setWindowTitle(tr("MusE: Mastertrack"));
_raster = 0; // measure
+ resize(_widthInit[_type], _heightInit[_type]);
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(undoRedo->actions());
+ QMenu* settingsMenu = menuBar()->addMenu(tr("&Settings"));
+ settingsMenu->addAction(subwinAction);
+ settingsMenu->addAction(shareAction);
+
+ // Toolbars ---------------------------------------------------------
+ QToolBar* undo_tools=addToolBar(tr("Undo/Redo tools"));
+ undo_tools->setObjectName("Undo/Redo tools");
+ undo_tools->addActions(undoRedo->actions());
+
+
+ QToolBar* panic_toolbar = addToolBar(tr("panic"));
+ panic_toolbar->setObjectName("panic");
+ panic_toolbar->addAction(panicAction);
+
+ QToolBar* transport_toolbar = addToolBar(tr("transport"));
+ transport_toolbar->setObjectName("transport");
+ transport_toolbar->addActions(transportAction->actions());
EditToolBar* tools2 = new EditToolBar(this, PointerTool | PencilTool | RubberTool);
addToolBar(tools2);
@@ -241,12 +247,8 @@ 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();
+ initalizing=false;
}
//---------------------------------------------------------
@@ -335,12 +337,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;
@@ -361,9 +359,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");
}
@@ -432,34 +428,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 b2b06291..4e66f70e 100644
--- a/muse2/muse/master/masteredit.h
+++ b/muse2/muse/master/masteredit.h
@@ -61,14 +61,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);
@@ -81,7 +75,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 d4ee9999..615653b3 100644
--- a/muse2/muse/midiedit/dcanvas.cpp
+++ b/muse2/muse/midiedit/dcanvas.cpp
@@ -158,8 +158,6 @@ Undo DrumCanvas::moveCanvasItems(CItemList& items, int dp, int dx, DragType dtyp
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/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp
index ee610683..f8061c06 100644
--- a/muse2/muse/midiedit/drumedit.cpp
+++ b/muse2/muse/midiedit/drumedit.cpp
@@ -44,6 +44,7 @@
#include "audio.h"
#include "gconfig.h"
#include "functions.h"
+#include "widgets/function_dialogs/quantize.h"
/*
static const char* map_file_pattern[] = {
@@ -61,11 +62,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;
@@ -146,7 +144,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();
}
@@ -155,11 +153,12 @@ 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);
+ resize(_widthInit[_type], _heightInit[_type]);
+
split1w1 = 0;
- resize(_widthInit, _heightInit);
selPart = 0;
QSignalMapper *signalMapper = new QSignalMapper(this);
@@ -263,6 +262,10 @@ 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("&Settings"));
+ settingsMenu->addAction(subwinAction);
+ settingsMenu->addAction(shareAction);
connect(signalMapper, SIGNAL(mapped(int)), SLOT(cmd(int)));
@@ -481,9 +484,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()));
@@ -506,10 +506,10 @@ 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();
+ initalizing=false;
}
//---------------------------------------------------------
@@ -760,16 +760,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;
@@ -791,11 +787,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");
}
@@ -1044,37 +1038,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();
- }
//---------------------------------------------------------
diff --git a/muse2/muse/midiedit/drumedit.h b/muse2/muse/midiedit/drumedit.h
index 64390cd9..a242eda8 100644
--- a/muse2/muse/midiedit/drumedit.h
+++ b/muse2/muse/midiedit/drumedit.h
@@ -71,9 +71,7 @@ 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;
@@ -88,10 +86,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();
@@ -122,7 +116,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/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp
index 9ab5e063..c98657ea 100644
--- a/muse2/muse/midiedit/pianoroll.cpp
+++ b/muse2/muse/midiedit/pianoroll.cpp
@@ -53,10 +53,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;
@@ -69,14 +66,15 @@ static int pianorollTools = PointerTool | PencilTool | RubberTool | DrawTool;
//---------------------------------------------------------
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;
+ resize(_widthInit[_type], _heightInit[_type]);
+
QSignalMapper* mapper = new QSignalMapper(this);
QSignalMapper* colorMapper = new QSignalMapper(this);
@@ -174,6 +172,12 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i
connect(colorMapper, SIGNAL(mapped(int)), this, SLOT(eventColorModeChanged(int)));
+ menuConfig->addSeparator();
+ menuConfig->addAction(subwinAction);
+ menuConfig->addAction(shareAction);
+
+
+
menuFunctions = menuBar()->addMenu(tr("Fu&nctions"));
menuFunctions->setTearOffEnabled(true);
@@ -468,9 +472,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()));
@@ -498,10 +499,8 @@ 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();
+ initalizing=false;
}
//---------------------------------------------------------
@@ -788,7 +787,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();
}
@@ -809,12 +808,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;
@@ -835,10 +830,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");
}
@@ -1206,38 +1199,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();
- }
/*
diff --git a/muse2/muse/midiedit/pianoroll.h b/muse2/muse/midiedit/pianoroll.h
index 1f53254d..b55d7689 100644
--- a/muse2/muse/midiedit/pianoroll.h
+++ b/muse2/muse/midiedit/pianoroll.h
@@ -12,7 +12,6 @@
#include <QResizeEvent>
#include <QLabel>
#include <QKeyEvent>
-#include <QByteArray>
#include <values.h>
#include "noteinfo.h"
@@ -117,8 +116,6 @@ class PianoRoll : public MidiEditor {
int colorMode;
static int _rasterInit;
- static int _widthInit, _heightInit;
- static QByteArray _toolbarInit;
static int colorModeInit;
@@ -133,9 +130,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*);
@@ -160,7 +154,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 9e99f24d..82a6a215 100644
--- a/muse2/muse/midiedit/prcanvas.cpp
+++ b/muse2/muse/midiedit/prcanvas.cpp
@@ -369,8 +369,6 @@ Undo PianoCanvas::moveCanvasItems(CItemList& items, int dp, int dx, DragType dty
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/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp
index 4b2db2fc..157a6845 100644
--- a/muse2/muse/midiedit/scoreedit.cpp
+++ b/muse2/muse/midiedit/scoreedit.cpp
@@ -30,6 +30,7 @@
#include <QImage>
#include <QInputDialog>
#include <QMessageBox>
+#include <QSpinBox>
#include <stdio.h>
#include <math.h>
@@ -140,9 +141,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;
//---------------------------------------------------------
@@ -150,12 +148,12 @@ 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);
+ resize(_widthInit[_type], _heightInit[_type]);
mainw = new QWidget(this);
@@ -402,7 +400,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"));
@@ -417,6 +415,11 @@ 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);
+
QMenu* functions_menu = menuBar()->addMenu(tr("Fu&nctions"));
@@ -452,9 +455,6 @@ 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)));
score_canvas->fully_recalculate();
@@ -467,6 +467,9 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos)
apply_velo=true;
+
+ initTopwinState();
+ initalizing=false;
}
void ScoreEdit::init_shortcuts()
@@ -635,30 +638,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)
{
@@ -1029,12 +1012,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;
@@ -1053,9 +1032,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");
}
@@ -3931,7 +3908,7 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event)
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 (debugMsg) cout << "resized note would exceed its part; limiting length to " << tmp.lenTick() << endl;
@@ -4469,18 +4446,21 @@ void staff_t::update_part_indices()
* because after A (and B) got resized, the B-resize is invalid!
*
* CURRENT TODO
+ * o remove that ugly "bool initalizing" stuff. it's probably unneeded (watch out for the FINDMICH message)
+ * o store window state: does this really work? arranger seems to be buggy. maybe also marker etc?
+ * o always store marker, arranger etc state, not only when window shown!
+ * o setup for "share","don't share" etc.
+ * o arranger: shortcuts for "pencil" etc don't work
+ *
+ * IMPORTANT TODO
* o redo transport menu: offer "one beat" and "one bar" steps
* maybe also offer scrollbar
* o quick "set left/right marker", "select between markers"
* or even "set marker and select between immediately"
* o support partially selected parts. when moving, automatically split
*
- * o speed up structural operations
* o maybe remove "insert empty measure"?
- * o structural OPs: don't erase note which begins at "end of cut"
* o add "move other notes" or "overwrite notes" or "mix with notes" to paste
- *
- * IMPORTANT TODO
* o draw the edge of parts hiding notes "jagged" (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,
diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h
index 6a5dd63a..0d4ce522 100644
--- a/muse2/muse/midiedit/scoreedit.h
+++ b/muse2/muse/midiedit/scoreedit.h
@@ -81,10 +81,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();
@@ -150,8 +146,6 @@ class ScoreEdit : public TopWin
bool apply_velo;
static set<QString> names;
- static int width_init, height_init;
- static QByteArray default_toolbar_state;
QString name;
@@ -168,7 +162,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);
diff --git a/muse2/muse/midieditor.cpp b/muse2/muse/midieditor.cpp
index f4d21320..97b22ad6 100644
--- a/muse2/muse/midieditor.cpp
+++ b/muse2/muse/midieditor.cpp
@@ -23,8 +23,8 @@
// 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;
diff --git a/muse2/muse/midieditor.h b/muse2/muse/midieditor.h
index 78873a6a..41967f9c 100644
--- a/muse2/muse/midieditor.h
+++ b/muse2/muse/midieditor.h
@@ -63,7 +63,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();
diff --git a/muse2/muse/songfile.cpp b/muse2/muse/songfile.cpp
index 72cacfaa..fb279e92 100644
--- a/muse2/muse/songfile.cpp
+++ b/muse2/muse/songfile.cpp
@@ -1011,15 +1011,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());
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);
}
@@ -1027,7 +1027,7 @@ void MusE::readToplevels(Xml& xml)
if(!pl->empty())
{
startDrumEditor(pl);
- toplevels.back().cobject()->readStatus(xml);
+ toplevels.back()->readStatus(xml);
pl = new PartList;
}
}
@@ -1035,33 +1035,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");
@@ -1531,8 +1538,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 f8d92497..87f37c1c 100644
--- a/muse2/muse/structure.cpp
+++ b/muse2/muse/structure.cpp
@@ -1,7 +1,7 @@
//=========================================================
// MusE
// Linux Music Editor
-// $Id: app.cpp,v 1.113.2.68 2009/12/21 14:51:51 spamatica Exp $
+// $Id: structure.cpp,v 1.113.2.68 2009/12/21 14:51:51 spamatica Exp $
//
// (C) Copyright 1999-2004 Werner Schweer (ws@seh.de)
// (C) Copyright 2011 Robert Jonsson (rj@spamatica.se)
@@ -16,7 +16,7 @@
#include "keyevent.h"
#include "audio.h"
#include "marker/marker.h"
-
+#include "arrangerview.h"
//---------------------------------------------------------
// adjustGlobalLists
@@ -25,7 +25,7 @@
// 'diff' number of ticks.
//---------------------------------------------------------
-void MusE::adjustGlobalLists(Undo& operations, int startPos, int diff)
+void ArrangerView::adjustGlobalLists(Undo& operations, int startPos, int diff)
{
const TempoList* t = &tempomap;
const AL::SigList* s = &AL::sigmap;
@@ -116,7 +116,7 @@ void MusE::adjustGlobalLists(Undo& operations, int startPos, int diff)
// - cut master track
//---------------------------------------------------------
-void MusE::globalCut()
+void ArrangerView::globalCut()
{
int lpos = song->lpos();
int rpos = song->rpos();
@@ -218,7 +218,7 @@ void MusE::globalCut()
// - insert in master track
//---------------------------------------------------------
-void MusE::globalInsert()
+void ArrangerView::globalInsert()
{
unsigned lpos = song->lpos();
unsigned rpos = song->rpos();
@@ -275,7 +275,7 @@ void MusE::globalInsert()
// - split all parts at the song position pointer
//---------------------------------------------------------
-void MusE::globalSplit()
+void ArrangerView::globalSplit()
{
int pos = song->cpos();
Undo operations;
@@ -317,10 +317,10 @@ void MusE::globalSplit()
// copied events
//---------------------------------------------------------
-void MusE::copyRange()
+void ArrangerView::copyRange()
{
QMessageBox::critical(this,
- tr("MusE: Copy Range"),
+ tr("ArrangerView: Copy Range"),
tr("not implemented")
);
}
@@ -332,10 +332,10 @@ void MusE::copyRange()
// - process only marked parts
//---------------------------------------------------------
-void MusE::cutEvents()
+void ArrangerView::cutEvents()
{
QMessageBox::critical(this,
- tr("MusE: Cut Events"),
+ tr("ArrangerView: Cut Events"),
tr("not implemented")
);
}
diff --git a/muse2/muse/waveedit/waveedit.cpp b/muse2/muse/waveedit/waveedit.cpp
index 7a5ad815..f54e23c3 100644
--- a/muse2/muse/waveedit/waveedit.cpp
+++ b/muse2/muse/waveedit/waveedit.cpp
@@ -40,10 +40,6 @@
extern QColor readColor(Xml& xml);
-int WaveEdit::_widthInit = 600;
-int WaveEdit::_heightInit = 400;
-QByteArray WaveEdit::_toolbarInit;
-
//---------------------------------------------------------
// closeEvent
//---------------------------------------------------------
@@ -53,7 +49,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();
}
@@ -62,10 +58,10 @@ void WaveEdit::closeEvent(QCloseEvent* e)
//---------------------------------------------------------
WaveEdit::WaveEdit(PartList* pl)
- : MidiEditor(1, pl)
+ : MidiEditor(TopWin::WAVE, 1, pl)
{
- resize(_widthInit, _heightInit);
setFocusPolicy(Qt::StrongFocus);
+ resize(_widthInit[_type], _heightInit[_type]);
QSignalMapper* mapper = new QSignalMapper(this);
QAction* act;
@@ -154,6 +150,11 @@ WaveEdit::WaveEdit(PartList* pl)
mapper->setMapping(selectNoneAction, CMD_SELECT_NONE);
connect(selectNoneAction, SIGNAL(triggered()), mapper, SLOT(map()));
+
+ QMenu* settingsMenu = menuBar()->addMenu(tr("&Settings"));
+ settingsMenu->addAction(subwinAction);
+ settingsMenu->addAction(shareAction);
+
//---------ToolBar----------------------------------
tools = addToolBar(tr("Wave edit tools"));
tools->setObjectName("Wave edit tools");
@@ -203,7 +204,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;
@@ -256,9 +257,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();
@@ -269,10 +267,9 @@ 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();
+ initalizing=false;
}
void WaveEdit::initShortcuts()
@@ -359,12 +356,8 @@ void WaveEdit::readConfiguration(Xml& xml)
case Xml::TagStart:
if (tag == "bgcolor")
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;
@@ -388,9 +381,7 @@ void WaveEdit::writeConfiguration(int level, Xml& xml)
{
xml.tag(level++, "waveedit");
xml.colorTag(level, "bgcolor", 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");
}
@@ -442,38 +433,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 1ff8a65b..4f040d6e 100644
--- a/muse2/muse/waveedit/waveedit.h
+++ b/muse2/muse/waveedit/waveedit.h
@@ -48,15 +48,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;
@@ -78,7 +73,7 @@ class WaveEdit : public MidiEditor {
signals:
- void deleted(unsigned long);
+ void deleted(TopWin*);
public:
WaveEdit(PartList*);
diff --git a/muse2/muse/widgets/midisyncimpl.cpp b/muse2/muse/widgets/midisyncimpl.cpp
index c70cb79f..07527973 100644
--- a/muse2/muse/widgets/midisyncimpl.cpp
+++ b/muse2/muse/widgets/midisyncimpl.cpp
@@ -673,8 +673,6 @@ void MidiSyncConfig::closeEvent(QCloseEvent* e)
apply();
}
- //emit deleted((unsigned long)this);
-
disconnect(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 3eb33451..9b133af2 100644
--- a/muse2/muse/widgets/midisyncimpl.h
+++ b/muse2/muse/widgets/midisyncimpl.h
@@ -104,9 +104,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();