summaryrefslogtreecommitdiff
path: root/muse2/muse
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-08-18 16:03:23 +0000
committerFlorian Jung <flo@windfisch.org>2011-08-18 16:03:23 +0000
commit3513555193d44fe99bc30dd3bf04701278a797a1 (patch)
treeec45e3a03dc8d60fe5cf2fccee52d1e9de4257bf /muse2/muse
parent1ff745b082d03e56f831cc8e2ada6a1943a45bcd (diff)
"share tools and menu" can be set at runtime
added global settings for "default isMDI state" and "share..." (one default for Subwins, one for free wins) TODO: read and save them into configuration, add settings dialog for it
Diffstat (limited to 'muse2/muse')
-rw-r--r--muse2/muse/app.cpp21
-rw-r--r--muse2/muse/app.h1
-rw-r--r--muse2/muse/arranger/arrangerview.cpp1
-rw-r--r--muse2/muse/cliplist/cliplist.cpp1
-rw-r--r--muse2/muse/cobject.cpp50
-rw-r--r--muse2/muse/cobject.h8
-rw-r--r--muse2/muse/liste/listedit.cpp1
-rw-r--r--muse2/muse/marker/markerview.cpp1
-rw-r--r--muse2/muse/master/lmaster.cpp1
-rw-r--r--muse2/muse/master/masteredit.cpp1
-rw-r--r--muse2/muse/midiedit/drumedit.cpp1
-rw-r--r--muse2/muse/midiedit/pianoroll.cpp1
-rw-r--r--muse2/muse/midiedit/scoreedit.cpp5
-rw-r--r--muse2/muse/waveedit/waveedit.cpp1
14 files changed, 78 insertions, 16 deletions
diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp
index d3ad0e64..e48425d7 100644
--- a/muse2/muse/app.cpp
+++ b/muse2/muse/app.cpp
@@ -1746,7 +1746,6 @@ void MusE::openInScoreEdit(ScoreEdit* destination, PartList* pl, bool allInOne)
if (destination==NULL) // if no destination given, create a new one
{
destination = new ScoreEdit(this, 0, arranger->cursorValue());
- destination->shareToolsAndMenu(true); //FINDMICHJETZT
destination->show();
toplevels.push_back(destination);
connect(destination, SIGNAL(deleted(TopWin*)), SLOT(toplevelDeleted(TopWin*)));
@@ -1782,7 +1781,6 @@ void MusE::startPianoroll(PartList* pl, bool showDefaultCtrls)
{
PianoRoll* pianoroll = new PianoRoll(pl, this, 0, arranger->cursorValue());
- pianoroll->shareToolsAndMenu(true); //FINDMICHJETZT
if(showDefaultCtrls) // p4.0.12
pianoroll->addCtrl();
pianoroll->show();
@@ -3101,3 +3099,22 @@ 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 c491a2de..7e47101a 100644
--- a/muse2/muse/app.h
+++ b/muse2/muse/app.h
@@ -331,6 +331,7 @@ class MusE : public QMainWindow
void focusChanged(QWidget* old, QWidget* now);
void addMdiSubWindow(QMdiSubWindow*);
+ void shareMenuAndToolbarChanged(TopWin*, bool);
public:
MusE(int argc, char** argv);
diff --git a/muse2/muse/arranger/arrangerview.cpp b/muse2/muse/arranger/arrangerview.cpp
index af4c59e0..6ec47375 100644
--- a/muse2/muse/arranger/arrangerview.cpp
+++ b/muse2/muse/arranger/arrangerview.cpp
@@ -489,6 +489,7 @@ ArrangerView::ArrangerView(QWidget* parent)
QMenu* menuSettings = menuBar()->addMenu(tr("&Settings"));
menuSettings->addAction(subwinAction);
+ menuSettings->addAction(shareAction);
//-------- Edit connections
diff --git a/muse2/muse/cliplist/cliplist.cpp b/muse2/muse/cliplist/cliplist.cpp
index 1172919a..6ee9c7fe 100644
--- a/muse2/muse/cliplist/cliplist.cpp
+++ b/muse2/muse/cliplist/cliplist.cpp
@@ -126,6 +126,7 @@ ClipListEdit::ClipListEdit(QWidget* parent)
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
diff --git a/muse2/muse/cobject.cpp b/muse2/muse/cobject.cpp
index a97a29a1..5e007fe3 100644
--- a/muse2/muse/cobject.cpp
+++ b/muse2/muse/cobject.cpp
@@ -23,6 +23,9 @@ 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)
@@ -34,8 +37,16 @@ TopWin::TopWin(ToplevelType t, QWidget* parent, const char* name, Qt::WindowFlag
{
_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;
}
@@ -43,19 +54,29 @@ TopWin::TopWin(ToplevelType t, QWidget* parent, const char* name, Qt::WindowFlag
_type=t;
+
+
setObjectName(QString(name));
- //setAttribute(Qt::WA_DeleteOnClose);
// Allow multiple rows. Tim.
//setDockNestingEnabled(true);
setIconSize(ICON_SIZE);
- 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)));
+
+ 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);
}
@@ -163,6 +184,9 @@ void TopWin::setIsMdiWin(bool val)
muse->addMdiSubWindow(subwin);
subwin->setVisible(vis);
+ if (_sharesToolsAndMenu == _sharesWhenFree[_type])
+ shareToolsAndMenu(_sharesWhenSubwin[_type]);
+
subwinAction->setChecked(true);
}
else
@@ -182,9 +206,12 @@ void TopWin::setIsMdiWin(bool val)
//TODO FINDMICH evtl noch ein signal emitten oder sowas?
delete mdisubwin_temp;
- printf("unMDIfied, visible is %i\n",vis);
+ printf("FINDMICH unMDIfied, visible is %i\n",vis);
setVisible(vis);
-
+
+ if (_sharesToolsAndMenu == _sharesWhenSubwin[_type])
+ shareToolsAndMenu(_sharesWhenFree[_type]);
+
subwinAction->setChecked(false);
}
else
@@ -227,6 +254,8 @@ void TopWin::shareToolsAndMenu(bool val)
if (!val)
{
+ muse->shareMenuAndToolbarChanged(this, false);
+
for (list<QToolBar*>::iterator it=_toolbars.begin(); it!=_toolbars.end(); it++)
if (*it != NULL)
QMainWindow::addToolBar(*it);
@@ -239,12 +268,17 @@ void TopWin::shareToolsAndMenu(bool val)
{
for (list<QToolBar*>::iterator it=_toolbars.begin(); it!=_toolbars.end(); it++)
if (*it != NULL)
+ {
QMainWindow::removeToolBar(*it); // this does NOT delete the toolbar, which is good
+ (*it)->setParent(NULL);
+ }
menuBar()->hide();
+
+ muse->shareMenuAndToolbarChanged(this, true);
}
- emit toolsAndMenuSharingChanged(val);
+ shareAction->setChecked(val);
}
diff --git a/muse2/muse/cobject.h b/muse2/muse/cobject.h
index ba731d1e..f76f6f61 100644
--- a/muse2/muse/cobject.h
+++ b/muse2/muse/cobject.h
@@ -53,7 +53,6 @@ class TopWin : public QMainWindow
TopWin(ToplevelType t, QWidget* parent=0, const char* name=0, Qt::WindowFlags f = Qt::Window);
bool sharesToolsAndMenu() { return _sharesToolsAndMenu; }
- void shareToolsAndMenu(bool);
const std::list<QToolBar*>& toolbars() { return _toolbars; }
void addToolBar(QToolBar* toolbar);
@@ -75,6 +74,7 @@ class TopWin : public QMainWindow
protected:
QAction* subwinAction;
+ QAction* shareAction;
ToplevelType _type;
@@ -82,6 +82,9 @@ class TopWin : public QMainWindow
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();
@@ -93,11 +96,10 @@ class TopWin : public QMainWindow
virtual void show();
virtual void setVisible(bool);
void setIsMdiWin(bool);
+ void shareToolsAndMenu(bool);
void restoreMainwinState();
void storeInitialState();
- signals:
- void toolsAndMenuSharingChanged(bool);
};
diff --git a/muse2/muse/liste/listedit.cpp b/muse2/muse/liste/listedit.cpp
index d0a7d83c..c0580e3b 100644
--- a/muse2/muse/liste/listedit.cpp
+++ b/muse2/muse/liste/listedit.cpp
@@ -498,6 +498,7 @@ ListEdit::ListEdit(PartList* pl)
QMenu* settingsMenu = menuBar()->addMenu(tr("&Settings"));
settingsMenu->addAction(subwinAction);
+ settingsMenu->addAction(shareAction);
// Toolbars ---------------------------------------------------------
diff --git a/muse2/muse/marker/markerview.cpp b/muse2/muse/marker/markerview.cpp
index 8def5714..89011b2b 100644
--- a/muse2/muse/marker/markerview.cpp
+++ b/muse2/muse/marker/markerview.cpp
@@ -176,6 +176,7 @@ MarkerView::MarkerView(QWidget* parent)
QMenu* settingsMenu = menuBar()->addMenu(tr("&Settings"));
settingsMenu->addAction(subwinAction);
+ settingsMenu->addAction(shareAction);
// Toolbars ---------------------------------------------------------
diff --git a/muse2/muse/master/lmaster.cpp b/muse2/muse/master/lmaster.cpp
index 7f5e6f75..d1aad157 100644
--- a/muse2/muse/master/lmaster.cpp
+++ b/muse2/muse/master/lmaster.cpp
@@ -145,6 +145,7 @@ LMaster::LMaster()
QMenu* settingsMenu = menuBar()->addMenu(tr("&Settings"));
settingsMenu->addAction(subwinAction);
+ settingsMenu->addAction(shareAction);
connect(tempoAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
diff --git a/muse2/muse/master/masteredit.cpp b/muse2/muse/master/masteredit.cpp
index f484e935..68e8a3b2 100644
--- a/muse2/muse/master/masteredit.cpp
+++ b/muse2/muse/master/masteredit.cpp
@@ -92,6 +92,7 @@ MasterEdit::MasterEdit()
QMenu* settingsMenu = menuBar()->addMenu(tr("&Settings"));
settingsMenu->addAction(subwinAction);
+ settingsMenu->addAction(shareAction);
// Toolbars ---------------------------------------------------------
QToolBar* undo_tools=addToolBar(tr("Undo/Redo tools"));
diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp
index 8c02dbeb..5477752d 100644
--- a/muse2/muse/midiedit/drumedit.cpp
+++ b/muse2/muse/midiedit/drumedit.cpp
@@ -265,6 +265,7 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini
QMenu* settingsMenu = menuBar()->addMenu(tr("&Settings"));
settingsMenu->addAction(subwinAction);
+ settingsMenu->addAction(shareAction);
connect(signalMapper, SIGNAL(mapped(int)), SLOT(cmd(int)));
diff --git a/muse2/muse/midiedit/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp
index ac15f9cd..d8fdc34d 100644
--- a/muse2/muse/midiedit/pianoroll.cpp
+++ b/muse2/muse/midiedit/pianoroll.cpp
@@ -174,6 +174,7 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i
menuConfig->addSeparator();
menuConfig->addAction(subwinAction);
+ menuConfig->addAction(shareAction);
diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp
index 29c25937..2f077365 100644
--- a/muse2/muse/midiedit/scoreedit.cpp
+++ b/muse2/muse/midiedit/scoreedit.cpp
@@ -418,6 +418,7 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos)
settings_menu->addSeparator();
settings_menu->addAction(subwinAction);
+ settings_menu->addAction(shareAction);
@@ -4445,13 +4446,11 @@ void staff_t::update_part_indices()
* because after A (and B) got resized, the B-resize is invalid!
*
* CURRENT TODO
- * o IMPORTANT: check new windowed arranger!
- * - do all signal connections work?
- * - are there any segfaults?
* 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
diff --git a/muse2/muse/waveedit/waveedit.cpp b/muse2/muse/waveedit/waveedit.cpp
index 9674af5a..f54e23c3 100644
--- a/muse2/muse/waveedit/waveedit.cpp
+++ b/muse2/muse/waveedit/waveedit.cpp
@@ -153,6 +153,7 @@ WaveEdit::WaveEdit(PartList* pl)
QMenu* settingsMenu = menuBar()->addMenu(tr("&Settings"));
settingsMenu->addAction(subwinAction);
+ settingsMenu->addAction(shareAction);
//---------ToolBar----------------------------------
tools = addToolBar(tr("Wave edit tools"));