summaryrefslogtreecommitdiff
path: root/muse2/muse
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-08-21 13:23:24 +0000
committerFlorian Jung <flo@windfisch.org>2011-08-21 13:23:24 +0000
commitedbe737895dacf8bf54813d7bc99c5e851dc8018 (patch)
tree1a8e7fb157879cff1b5db0bcab045244d10dc721 /muse2/muse
parentddd2a029be95206f1cd834cb76f6d5bb1859b890 (diff)
added "windows" menu
removed unneeded debugging messages ("FINDMICH")
Diffstat (limited to 'muse2/muse')
-rw-r--r--muse2/muse/app.cpp107
-rw-r--r--muse2/muse/app.h11
-rw-r--r--muse2/muse/cobject.cpp9
-rw-r--r--muse2/muse/cobject.h1
-rw-r--r--muse2/muse/midiedit/scoreedit.cpp13
5 files changed, 122 insertions, 19 deletions
diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp
index 8f059c73..60075a1a 100644
--- a/muse2/muse/app.cpp
+++ b/muse2/muse/app.cpp
@@ -298,7 +298,6 @@ MusE::MusE(int argc, char** argv) : QMainWindow()
{
// By T356. For LADSPA plugins in plugin.cpp
// QWidgetFactory::addWidgetFactory( new PluginWidgetFactory ); ddskrjo
-
setIconSize(ICON_SIZE);
setFocusPolicy(Qt::WheelFocus);
//setFocusPolicy(Qt::NoFocus);
@@ -334,6 +333,8 @@ MusE::MusE(int argc, char** argv) : QMainWindow()
setWindowTitle(appName);
midiPluginSignalMapper = new QSignalMapper(this);
followSignalMapper = new QSignalMapper(this);
+ windowsMapper = new QSignalMapper(this);
+ connect(windowsMapper, SIGNAL(mapped(QWidget*)), SLOT(bringToFront(QWidget*)));
song = new Song("song");
song->blockSignals(true);
@@ -533,8 +534,13 @@ MusE::MusE(int argc, char** argv) : QMainWindow()
autoSnapshotAction = new QAction(QIcon(*automation_take_snapshotIcon), tr("Take Snapshot"), this);
autoClearAction = new QAction(QIcon(*automation_clear_dataIcon), tr("Clear Automation Data"), this);
autoClearAction->setEnabled(false);
+
-
+ //-------- Windows Actions
+ windowsCascadeAction = new QAction(tr("Cascade"), this);
+ windowsTileAction = new QAction(tr("Tile"), this);
+
+
//-------- Settings Actions
settingsGlobalAction = new QAction(QIcon(*settings_globalsettingsIcon), tr("Global Settings"), this);
settingsShortcutsAction = new QAction(QIcon(*settings_configureshortcutsIcon), tr("Configure Shortcuts"), this);
@@ -820,6 +826,17 @@ MusE::MusE(int argc, char** argv) : QMainWindow()
menuAutomation->addAction(autoClearAction);
//-------------------------------------------------------------
+ // popup Windows
+ //-------------------------------------------------------------
+
+ menuWindows = new QMenu(tr("&Windows"), this);
+ menuBar()->addMenu(menuWindows);
+ trailingMenus.push_back(menuWindows);
+
+ menuWindows->addAction(windowsCascadeAction);
+ menuWindows->addAction(windowsTileAction);
+
+ //-------------------------------------------------------------
// popup Settings
//-------------------------------------------------------------
@@ -869,6 +886,8 @@ MusE::MusE(int argc, char** argv) : QMainWindow()
mdiArea=new QMdiArea(this);
setCentralWidget(mdiArea);
+ connect(windowsTileAction, SIGNAL(activated()), mdiArea, SLOT(tileSubWindows()));
+ connect(windowsCascadeAction, SIGNAL(activated()), mdiArea, SLOT(cascadeSubWindows()));
arrangerView = new ArrangerView(this);
@@ -878,7 +897,6 @@ MusE::MusE(int argc, char** argv) : QMainWindow()
arrangerView->hide();
arranger=arrangerView->getArranger();
- //mdiArea->addSubWindow(arrangerView->createMdiWrapper());
arrangerView->setIsMdiWin(true);
@@ -954,6 +972,8 @@ MusE::MusE(int argc, char** argv) : QMainWindow()
restoreState(settings.value("MusE/windowState").toByteArray());
song->update();
+
+ updateWindowMenu();
}
MusE::~MusE()
@@ -1554,6 +1574,7 @@ void MusE::showMarker(bool flag)
}
markerView->setVisible(flag);
viewMarkerAction->setChecked(flag);
+ updateWindowMenu();
}
//---------------------------------------------------------
@@ -1563,6 +1584,7 @@ void MusE::showMarker(bool flag)
void MusE::markerClosed()
{
viewMarkerAction->setChecked(false);
+ updateWindowMenu();
}
//---------------------------------------------------------
@@ -1582,6 +1604,7 @@ void MusE::showArranger(bool flag)
{
arrangerView->setVisible(flag);
viewArrangerAction->setChecked(flag);
+ updateWindowMenu();
}
//---------------------------------------------------------
@@ -1591,6 +1614,7 @@ void MusE::showArranger(bool flag)
void MusE::arrangerClosed()
{
viewArrangerAction->setChecked(false);
+ updateWindowMenu();
}
//---------------------------------------------------------
@@ -1755,6 +1779,7 @@ void MusE::openInScoreEdit(ScoreEdit* destination, PartList* pl, bool allInOne)
//relevant signals on his own
arrangerView->updateScoreMenus();
+ updateWindowMenu();
}
destination->add_parts(pl, allInOne);
@@ -1787,6 +1812,7 @@ void MusE::startPianoroll(PartList* pl, bool showDefaultCtrls)
toplevels.push_back(pianoroll);
connect(pianoroll, SIGNAL(deleted(TopWin*)), SLOT(toplevelDeleted(TopWin*)));
connect(muse, SIGNAL(configChanged()), pianoroll, SLOT(configChanged()));
+ updateWindowMenu();
}
//---------------------------------------------------------
@@ -1808,6 +1834,7 @@ void MusE::startListEditor(PartList* pl)
toplevels.push_back(listEditor);
connect(listEditor, SIGNAL(deleted(TopWin*)), SLOT(toplevelDeleted(TopWin*)));
connect(muse,SIGNAL(configChanged()), listEditor, SLOT(configChanged()));
+ updateWindowMenu();
}
//---------------------------------------------------------
@@ -1820,6 +1847,7 @@ void MusE::startMasterEditor()
masterEditor->show();
toplevels.push_back(masterEditor);
connect(masterEditor, SIGNAL(deleted(TopWin*)), SLOT(toplevelDeleted(TopWin*)));
+ updateWindowMenu();
}
//---------------------------------------------------------
@@ -1833,6 +1861,7 @@ void MusE::startLMasterEditor()
toplevels.push_back(lmaster);
connect(lmaster, SIGNAL(deleted(TopWin*)), SLOT(toplevelDeleted(TopWin*)));
connect(muse, SIGNAL(configChanged()), lmaster, SLOT(configChanged()));
+ updateWindowMenu();
}
//---------------------------------------------------------
@@ -1857,6 +1886,7 @@ void MusE::startDrumEditor(PartList* pl, bool showDefaultCtrls)
toplevels.push_back(drumEditor);
connect(drumEditor, SIGNAL(deleted(TopWin*)), SLOT(toplevelDeleted(TopWin*)));
connect(muse, SIGNAL(configChanged()), drumEditor, SLOT(configChanged()));
+ updateWindowMenu();
}
//---------------------------------------------------------
@@ -1880,6 +1910,7 @@ void MusE::startWaveEditor(PartList* pl)
connect(muse, SIGNAL(configChanged()), waveEditor, SLOT(configChanged()));
toplevels.push_back(waveEditor);
connect(waveEditor, SIGNAL(deleted(TopWin*)), SLOT(toplevelDeleted(TopWin*)));
+ updateWindowMenu();
}
@@ -1940,6 +1971,7 @@ void MusE::startClipList(bool checked)
}
clipListEdit->show();
viewCliplistAction->setChecked(checked);
+ updateWindowMenu();
}
//---------------------------------------------------------
@@ -2001,7 +2033,8 @@ void MusE::toplevelDeleted(TopWin* tl)
case TopWin::CLIPLIST:
// ORCAN: This needs to be verified. aid2 used to correspond to Cliplist:
//menu_audio->setItemChecked(aid2, false);
- viewCliplistAction->setChecked(false);
+ viewCliplistAction->setChecked(false);
+ updateWindowMenu();
return;
//break;
@@ -2023,6 +2056,7 @@ void MusE::toplevelDeleted(TopWin* tl)
toplevels.erase(i);
if (mustUpdateScoreMenus)
arrangerView->updateScoreMenus();
+ updateWindowMenu();
return;
}
}
@@ -3071,7 +3105,7 @@ void MusE::setCurrentMenuSharingTopwin(TopWin* win)
addToolBar(*it);
foreignToolbars.push_back(*it);
- (*it)->show(); //FINDMICHJETZT
+ (*it)->show();
}
else
{
@@ -3088,8 +3122,6 @@ void MusE::setCurrentMenuSharingTopwin(TopWin* win)
currentMenuSharingTopwin=win;
- printf ("FINDMICH: changing sharing win DONE.\n");
-
if (win)
win->restoreMainwinState(); //restore toolbar positions in main window
}
@@ -3118,3 +3150,64 @@ void MusE::shareMenuAndToolbarChanged(TopWin* win, bool val)
}
}
}
+
+void MusE::updateWindowMenu()
+{
+ bool sep;
+ bool there_are_subwins=false;
+
+ menuWindows->clear(); // frees memory automatically
+
+ menuWindows->addAction(windowsCascadeAction);
+ menuWindows->addAction(windowsTileAction);
+
+ sep=false;
+ for (iToplevel it=toplevels.begin(); it!=toplevels.end(); it++)
+ if (((*it)->isVisible() || (*it)->isVisibleTo(this)) && (*it)->isMdiWin())
+ // the isVisibleTo check is neccessary because isVisible returns false if a
+ // MdiSubWin is actually visible, but the muse main window is hidden for some reason
+ {
+ if (!sep)
+ {
+ menuWindows->addSeparator();
+ sep=true;
+ }
+ QAction* temp=menuWindows->addAction((*it)->windowTitle());
+ connect(temp, SIGNAL(activated()), windowsMapper, SLOT(map()));
+ windowsMapper->setMapping(temp, static_cast<QWidget*>(*it));
+
+ there_are_subwins=true;
+ }
+
+ sep=false;
+ for (iToplevel it=toplevels.begin(); it!=toplevels.end(); it++)
+ if (((*it)->isVisible() || (*it)->isVisibleTo(this)) && !(*it)->isMdiWin())
+ {
+ if (!sep)
+ {
+ menuWindows->addSeparator();
+ sep=true;
+ }
+ QAction* temp=menuWindows->addAction((*it)->windowTitle());
+ connect(temp, SIGNAL(activated()), windowsMapper, SLOT(map()));
+ windowsMapper->setMapping(temp, static_cast<QWidget*>(*it));
+ }
+
+ windowsCascadeAction->setEnabled(there_are_subwins);
+ windowsTileAction->setEnabled(there_are_subwins);
+}
+
+void MusE::bringToFront(QWidget* widget)
+{
+ TopWin* win=dynamic_cast<TopWin*>(widget);
+ if (win->isMdiWin())
+ {
+ win->show();
+ mdiArea->setActiveSubWindow(win->getMdiWin());
+ }
+ else
+ {
+ win->activateWindow();
+ win->raise();
+ }
+}
diff --git a/muse2/muse/app.h b/muse2/muse/app.h
index 7e47101a..52bccf64 100644
--- a/muse2/muse/app.h
+++ b/muse2/muse/app.h
@@ -128,6 +128,10 @@ class MusE : public QMainWindow
// Automation Menu Actions
QAction *autoMixerAction, *autoSnapshotAction, *autoClearAction;
+ // Window Menu Actions
+ QAction* windowsCascadeAction;
+ QAction* windowsTileAction;
+
// Settings Menu Actions
QAction *settingsGlobalAction, *settingsShortcutsAction, *settingsMetronomeAction, *settingsMidiSyncAction;
QAction *settingsMidiIOAction, *settingsAppearanceAction, *settingsMidiPortAction;
@@ -149,7 +153,7 @@ class MusE : public QMainWindow
// 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 *menu_file, *menuView, *menuSettings, *menuWindows, *menu_help;
QMenu* menu_audio, *menuAutomation, *menuUtils;
QMenu* menu_functions, *menuScriptPlugins;
@@ -211,6 +215,7 @@ class MusE : public QMainWindow
QSignalMapper *midiPluginSignalMapper;
QSignalMapper *followSignalMapper;
+ QSignalMapper *windowsMapper;
signals:
void configChanged();
@@ -287,6 +292,8 @@ class MusE : public QMainWindow
void activeTopWinChangedSlot(TopWin*);
void setCurrentMenuSharingTopwin(TopWin*);
+
+ void bringToFront(QWidget* win);
public slots:
bool saveAs();
@@ -333,6 +340,8 @@ class MusE : public QMainWindow
void addMdiSubWindow(QMdiSubWindow*);
void shareMenuAndToolbarChanged(TopWin*, bool);
+ void updateWindowMenu();
+
public:
MusE(int argc, char** argv);
~MusE();
diff --git a/muse2/muse/cobject.cpp b/muse2/muse/cobject.cpp
index 2c60a90c..02a7ca74 100644
--- a/muse2/muse/cobject.cpp
+++ b/muse2/muse/cobject.cpp
@@ -176,6 +176,7 @@ void TopWin::setIsMdiWin(bool val)
shareToolsAndMenu(_sharesWhenSubwin[_type]);
subwinAction->setChecked(true);
+ muse->updateWindowMenu();
}
else
{
@@ -191,16 +192,15 @@ void TopWin::setIsMdiWin(bool val)
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);
+ muse->updateWindowMenu();
}
else
{
@@ -381,15 +381,10 @@ void TopWin::writeConfiguration(ToplevelType t, int level, Xml& xml)
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]);
diff --git a/muse2/muse/cobject.h b/muse2/muse/cobject.h
index e934aff0..14a40a93 100644
--- a/muse2/muse/cobject.h
+++ b/muse2/muse/cobject.h
@@ -51,6 +51,7 @@ class TopWin : public QMainWindow
bool isMdiWin() const;
+ QMdiSubWindow* getMdiWin() const { return mdisubwin; }
TopWin(ToplevelType t, QWidget* parent=0, const char* name=0, Qt::WindowFlags f = Qt::Window);
diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp
index 157a6845..1b6c66e7 100644
--- a/muse2/muse/midiedit/scoreedit.cpp
+++ b/muse2/muse/midiedit/scoreedit.cpp
@@ -4438,6 +4438,8 @@ void staff_t::update_part_indices()
/* BUGS and potential bugs
+ * o THIS SHOULD NEVER HAPPEN: could not split note (found by tim)
+ *
* o tied notes don't work properly when there's a key-change in
* between, for example, when a cis is tied to a des
* o schedule_all_same_len_parts: if there are two clones A and B,
@@ -4447,10 +4449,13 @@ void staff_t::update_part_indices()
*
* 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
+ * o shortcuts for "pencil" etc don't work when only mdiwin has focus and not the mainwin inside
+ * o implement borland-style maximize: free windows do not cover the main menu, even when maximized
+ * o mirror most menus to an additional right-click context menu to avoid the long mouse pointer
+ * journey to the menu bar. try to find a way which does not involve duplicate code!
+ * o fix arranger config loading: problem: first arranger is displayed and inited from garbage, then
+ * the real config is loaded :/
+ * o restoreState(settings.value("MusE/windowState").toByteArray()); in app.cpp: unneccessary?
*
* IMPORTANT TODO
* o redo transport menu: offer "one beat" and "one bar" steps