diff options
author | Florian Jung <flo@windfisch.org> | 2011-08-14 20:55:27 +0000 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2011-08-14 20:55:27 +0000 |
commit | 078e927639369928a6fa0483c82867dae6cbf9a2 (patch) | |
tree | a4a2ede9fab58a3a284af9ec1ca1096de64995f2 | |
parent | 01d2680f0d18f7783ca1e1f48098590cd0317284 (diff) |
added "As subwindow" menu entries and made them work
-rw-r--r-- | muse2/muse/app.cpp | 25 | ||||
-rw-r--r-- | muse2/muse/app.h | 2 | ||||
-rw-r--r-- | muse2/muse/arranger/arrangerview.cpp | 2 | ||||
-rw-r--r-- | muse2/muse/cliplist/cliplist.cpp | 5 | ||||
-rw-r--r-- | muse2/muse/cobject.cpp | 51 | ||||
-rw-r--r-- | muse2/muse/cobject.h | 11 | ||||
-rw-r--r-- | muse2/muse/liste/listedit.cpp | 4 | ||||
-rw-r--r-- | muse2/muse/marker/markerview.cpp | 7 | ||||
-rw-r--r-- | muse2/muse/master/lmaster.cpp | 4 | ||||
-rw-r--r-- | muse2/muse/master/masteredit.cpp | 5 | ||||
-rw-r--r-- | muse2/muse/midiedit/drumedit.cpp | 3 | ||||
-rw-r--r-- | muse2/muse/midiedit/pianoroll.cpp | 5 | ||||
-rw-r--r-- | muse2/muse/midiedit/scoreedit.cpp | 6 | ||||
-rw-r--r-- | muse2/muse/waveedit/waveedit.cpp | 4 |
14 files changed, 113 insertions, 21 deletions
diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp index cb1b9363..29f2dbc1 100644 --- a/muse2/muse/app.cpp +++ b/muse2/muse/app.cpp @@ -878,10 +878,9 @@ MusE::MusE(int argc, char** argv) : QMainWindow() arrangerView->hide(); arranger=arrangerView->getArranger(); - //QMdiSubWindow* subwin=new QMdiSubWindow(this); //FINDMICHJETZT - //subwin->setWidget(arrangerView); - //mdiArea->addSubWindow(subwin); - mdiArea->addSubWindow(arrangerView->createMdiWrapper()); + //mdiArea->addSubWindow(arrangerView->createMdiWrapper()); + arrangerView->setIsMdiWin(true); + //--------------------------------------------------- // read list of "Recent Projects" @@ -3075,11 +3074,11 @@ void MusE::setCurrentMenuSharingTopwin(TopWin* win) + for (list<QMenu*>::iterator it = leadingMenus.begin(); it!=leadingMenus.end(); it++) + menuBar()->addMenu(*it); + if (win) { - for (list<QMenu*>::iterator it = leadingMenus.begin(); it!=leadingMenus.end(); it++) - menuBar()->addMenu(*it); - const QList<QAction*>& actions=win->menuBar()->actions(); for (QList<QAction*>::const_iterator it=actions.begin(); it!=actions.end(); it++) { @@ -3088,9 +3087,6 @@ void MusE::setCurrentMenuSharingTopwin(TopWin* win) menuBar()->addAction(*it); } - for (list<QMenu*>::iterator it = trailingMenus.begin(); it!=trailingMenus.end(); it++) - menuBar()->addMenu(*it); - const list<QToolBar*>& toolbars=win->toolbars(); @@ -3111,6 +3107,13 @@ void MusE::setCurrentMenuSharingTopwin(TopWin* win) foreignToolbars.push_back(NULL); } } - //TODO FINDMICHJETZT + + for (list<QMenu*>::iterator it = trailingMenus.begin(); it!=trailingMenus.end(); it++) + menuBar()->addMenu(*it); } } + +void MusE::addMdiSubWindow(QMdiSubWindow* win) +{ + mdiArea->addSubWindow(win); +} diff --git a/muse2/muse/app.h b/muse2/muse/app.h index a070c864..d71d947b 100644 --- a/muse2/muse/app.h +++ b/muse2/muse/app.h @@ -329,6 +329,8 @@ class MusE : public QMainWindow void startMidiTransformer(); void focusChanged(QWidget* old, QWidget* now); + + void addMdiSubWindow(QMdiSubWindow*); public: MusE(int argc, char** argv); diff --git a/muse2/muse/arranger/arrangerview.cpp b/muse2/muse/arranger/arrangerview.cpp index 8c0627b4..576cd7eb 100644 --- a/muse2/muse/arranger/arrangerview.cpp +++ b/muse2/muse/arranger/arrangerview.cpp @@ -488,6 +488,8 @@ ArrangerView::ArrangerView(QWidget* parent) menuStructure->addSeparator(); menuStructure->addAction(strCutEventsAction); + QMenu* menuSettings = menuBar()->addMenu(tr("&Settings")); + menuSettings->addAction(subwinAction); //-------- Edit connections diff --git a/muse2/muse/cliplist/cliplist.cpp b/muse2/muse/cliplist/cliplist.cpp index 35d38b3d..e0008ba1 100644 --- a/muse2/muse/cliplist/cliplist.cpp +++ b/muse2/muse/cliplist/cliplist.cpp @@ -7,6 +7,8 @@ //========================================================= #include <QCloseEvent> +#include <QMenuBar> +#include <QMenu> #include "cliplist.h" #include "song.h" @@ -107,6 +109,9 @@ ClipListEdit::ClipListEdit(QWidget* parent) //editor->view->setColumnAlignment(COL_REFS, Qt::AlignRight); + QMenu* settingsMenu = menuBar()->addMenu(tr("&Settings")); + settingsMenu->addAction(subwinAction); + 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; diff --git a/muse2/muse/cobject.cpp b/muse2/muse/cobject.cpp index c8ab1b08..8091db4b 100644 --- a/muse2/muse/cobject.cpp +++ b/muse2/muse/cobject.cpp @@ -9,10 +9,13 @@ #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; @@ -27,6 +30,11 @@ TopWin::TopWin(QWidget* parent, const char* name, Qt::WindowFlags f) mdisubwin=NULL; _sharesToolsAndMenu=false; + + subwinAction=new QAction(tr("As subwindow"), this); + subwinAction->setCheckable(true); + subwinAction->setChecked(isMdiWin()); + connect(subwinAction, SIGNAL(toggled(bool)), SLOT(setIsMdiWin(bool))); } @@ -123,13 +131,45 @@ QMdiSubWindow* TopWin::createMdiWrapper() return mdisubwin; } -void TopWin::setFree() +void TopWin::setIsMdiWin(bool val) { - if (mdisubwin) + if (val) + { + if (!isMdiWin()) + { + bool vis=isVisible(); + QMdiSubWindow* subwin = createMdiWrapper(); + muse->addMdiSubWindow(subwin); + subwin->setVisible(vis); + + subwinAction->setChecked(true); + } + else + { + if (debugMsg) printf("TopWin::setIsMdiWin(true) called, but window is already a MDI win\n"); + } + } + else { - setParent(0); - mdisubwin->hide(); - delete mdisubwin; + 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("unMDIfied, visible is %i\n",vis); + setVisible(vis); + + subwinAction->setChecked(false); + } + else + { + if (debugMsg) printf("TopWin::setIsMdiWin(false) called, but window is not a MDI win\n"); + } } } @@ -185,3 +225,4 @@ void TopWin::shareToolsAndMenu(bool val) emit toolsAndMenuSharingChanged(val); } + diff --git a/muse2/muse/cobject.h b/muse2/muse/cobject.h index 48653f4b..f02aa4dc 100644 --- a/muse2/muse/cobject.h +++ b/muse2/muse/cobject.h @@ -18,6 +18,7 @@ class QMdiSubWindow; class QFocusEvent; class QToolBar; class Xml; +class QAction; //--------------------------------------------------------- // TopWin @@ -31,9 +32,7 @@ class TopWin : public QMainWindow virtual void readStatus(Xml&); virtual void writeStatus(int, Xml&) const; - virtual QMdiSubWindow* createMdiWrapper(); bool isMdiWin(); - void setFree(); TopWin(QWidget* parent=0, const char* name=0, Qt::WindowFlags f = Qt::Window); @@ -49,17 +48,23 @@ class TopWin : public QMainWindow 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; + public slots: virtual void hide(); virtual void show(); virtual void setVisible(bool); + void setIsMdiWin(bool); signals: void toolsAndMenuSharingChanged(bool); diff --git a/muse2/muse/liste/listedit.cpp b/muse2/muse/liste/listedit.cpp index 887fc4f7..1c7e70da 100644 --- a/muse2/muse/liste/listedit.cpp +++ b/muse2/muse/liste/listedit.cpp @@ -496,6 +496,10 @@ ListEdit::ListEdit(PartList* pl) connect(editSignalMapper, SIGNAL(mapped(int)), SLOT(cmd(int))); + QMenu* settingsMenu = menuBar()->addMenu(tr("&Settings")); + settingsMenu->addAction(subwinAction); + + //---------ToolBar---------------------------------- listTools = addToolBar(tr("List tools")); diff --git a/muse2/muse/marker/markerview.cpp b/muse2/muse/marker/markerview.cpp index 8a13e118..ff7c8c07 100644 --- a/muse2/muse/marker/markerview.cpp +++ b/muse2/muse/marker/markerview.cpp @@ -172,7 +172,12 @@ MarkerView::MarkerView(QWidget* parent) editMenu->addAction(markerAdd); editMenu->addAction(markerDelete); - + + + QMenu* settingsMenu = menuBar()->addMenu(tr("&Settings")); + settingsMenu->addAction(subwinAction); + + //---------ToolBar---------------------------------- tools = addToolBar(tr("marker-tools")); tools->addActions(undoRedo->actions()); diff --git a/muse2/muse/master/lmaster.cpp b/muse2/muse/master/lmaster.cpp index 9d61311e..79762673 100644 --- a/muse2/muse/master/lmaster.cpp +++ b/muse2/muse/master/lmaster.cpp @@ -140,6 +140,10 @@ LMaster::LMaster() delAction = menuEdit->addAction(tr("Delete Event")); delAction->setShortcut(Qt::Key_Delete); + QMenu* settingsMenu = menuBar()->addMenu(tr("&Settings")); + settingsMenu->addAction(subwinAction); + + connect(tempoAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(signAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(keyAction, SIGNAL(triggered()), signalMapper, SLOT(map())); diff --git a/muse2/muse/master/masteredit.cpp b/muse2/muse/master/masteredit.cpp index 8d41e37a..edc1a702 100644 --- a/muse2/muse/master/masteredit.cpp +++ b/muse2/muse/master/masteredit.cpp @@ -31,6 +31,8 @@ #include <QLabel> #include <QToolBar> #include <QToolButton> +#include <QMenuBar> +#include <QMenu> int MasterEdit::_rasterInit = 0; int MasterEdit::_widthInit = 600; @@ -91,6 +93,9 @@ MasterEdit::MasterEdit() // QPopupMenu* file = new QPopupMenu(this); // menuBar()->insertItem("&File", file); + QMenu* settingsMenu = menuBar()->addMenu(tr("&Settings")); + settingsMenu->addAction(subwinAction); + //---------ToolBar---------------------------------- tools = addToolBar(tr("Master tools")); diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp index fde698ce..4b4910dd 100644 --- a/muse2/muse/midiedit/drumedit.cpp +++ b/muse2/muse/midiedit/drumedit.cpp @@ -264,6 +264,9 @@ 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); connect(signalMapper, SIGNAL(mapped(int)), SLOT(cmd(int))); diff --git a/muse2/muse/midiedit/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp index 46c59f2f..1f20bf52 100644 --- a/muse2/muse/midiedit/pianoroll.cpp +++ b/muse2/muse/midiedit/pianoroll.cpp @@ -174,6 +174,11 @@ 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); + + + menuFunctions = menuBar()->addMenu(tr("&Functions")); menuFunctions->setTearOffEnabled(true); diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index 99ce2844..1297c395 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -403,7 +403,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")); @@ -418,6 +418,10 @@ 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); + QMenu* functions_menu = menuBar()->addMenu(tr("&Functions")); diff --git a/muse2/muse/waveedit/waveedit.cpp b/muse2/muse/waveedit/waveedit.cpp index cf0d2fc9..6ad50c1c 100644 --- a/muse2/muse/waveedit/waveedit.cpp +++ b/muse2/muse/waveedit/waveedit.cpp @@ -154,6 +154,10 @@ 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); + //---------ToolBar---------------------------------- tools = addToolBar(tr("Wave edit tools")); tools->setObjectName("Wave edit tools"); |