summaryrefslogtreecommitdiff
path: root/muse2/muse/cobject.cpp
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-09-14 17:17:31 +0000
committerFlorian Jung <flo@windfisch.org>2011-09-14 17:17:31 +0000
commit2529ef06d1227b457af051a494ddb579ef590fe3 (patch)
treee4f3d3c77d39a5395fc3fa6806af85bb3ea77392 /muse2/muse/cobject.cpp
parent187665d84e56b63f569731550c652a89cb650309 (diff)
parent42269af2e0cc7a8c7b70d89ffa270184acde3dec (diff)
merged with trunk
tiny fix: removed bool initalizing completely reindented cobject.cpp
Diffstat (limited to 'muse2/muse/cobject.cpp')
-rw-r--r--muse2/muse/cobject.cpp748
1 files changed, 382 insertions, 366 deletions
diff --git a/muse2/muse/cobject.cpp b/muse2/muse/cobject.cpp
index eff6d9af..42c3cad2 100644
--- a/muse2/muse/cobject.cpp
+++ b/muse2/muse/cobject.cpp
@@ -1,23 +1,23 @@
//=========================================================
-// MusE
-// Linux Music Editor
-// $Id: cobject.cpp,v 1.4 2004/02/02 12:10:09 wschweer Exp $
+// MusE
+// Linux Music Editor
+// $Id: cobject.cpp,v 1.4 2004/02/02 12:10:09 wschweer Exp $
//
-// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
+// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; version 2 of
-// the License, or (at your option) any later version.
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; version 2 of
+// the License, or (at your option) any later version.
//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
//=========================================================
@@ -46,221 +46,232 @@ bool TopWin::_defaultSubwin[TOPLEVELTYPE_LAST_ENTRY];
bool TopWin::initInited=false;
TopWin::TopWin(ToplevelType t, QWidget* parent, const char* name, Qt::WindowFlags f)
- : QMainWindow(parent, f)
- {
- if (initInited==false)
- initConfiguration();
-
- _type=t;
-
- setObjectName(QString(name));
- // Allow multiple rows. Tim.
- //setDockNestingEnabled(true);
- setIconSize(ICON_SIZE);
-
- subwinAction=new QAction(tr("As subwindow"), this);
- subwinAction->setCheckable(true);
- connect(subwinAction, SIGNAL(toggled(bool)), SLOT(setIsMdiWin(bool)));
-
- shareAction=new QAction(tr("Shares tools and menu"), this);
- shareAction->setCheckable(true);
- connect(shareAction, SIGNAL(toggled(bool)), SLOT(shareToolsAndMenu(bool)));
-
- fullscreenAction=new QAction(tr("Fullscreen"), this);
- fullscreenAction->setCheckable(true);
- fullscreenAction->setChecked(false);
- fullscreenAction->setShortcut(shortcuts[SHRT_FULLSCREEN].key);
- connect(fullscreenAction, SIGNAL(toggled(bool)), SLOT(setFullscreen(bool)));
-
- mdisubwin=NULL;
- _sharesToolsAndMenu=_defaultSubwin[_type] ? _sharesWhenSubwin[_type] : _sharesWhenFree[_type];
- if (_defaultSubwin[_type])
- setIsMdiWin(true);
-
- if (_sharesToolsAndMenu)
- menuBar()->hide();
-
- subwinAction->setChecked(isMdiWin());
- shareAction->setChecked(_sharesToolsAndMenu);
- fullscreenAction->setEnabled(!isMdiWin());
-
- resize(_widthInit[_type], _heightInit[_type]);
- }
+ : QMainWindow(parent, f)
+{
+ if (initInited==false)
+ initConfiguration();
+
+ _type=t;
+
+ setObjectName(QString(name));
+ // Allow multiple rows. Tim.
+ //setDockNestingEnabled(true);
+ setIconSize(ICON_SIZE);
+
+ subwinAction=new QAction(tr("As subwindow"), this);
+ subwinAction->setCheckable(true);
+ connect(subwinAction, SIGNAL(toggled(bool)), SLOT(setIsMdiWin(bool)));
+
+ shareAction=new QAction(tr("Shares tools and menu"), this);
+ shareAction->setCheckable(true);
+ connect(shareAction, SIGNAL(toggled(bool)), SLOT(shareToolsAndMenu(bool)));
+
+ fullscreenAction=new QAction(tr("Fullscreen"), this);
+ fullscreenAction->setCheckable(true);
+ fullscreenAction->setChecked(false);
+ fullscreenAction->setShortcut(shortcuts[SHRT_FULLSCREEN].key);
+ connect(fullscreenAction, SIGNAL(toggled(bool)), SLOT(setFullscreen(bool)));
+
+ mdisubwin=NULL;
+ _sharesToolsAndMenu=_defaultSubwin[_type] ? _sharesWhenSubwin[_type] : _sharesWhenFree[_type];
+ if (_defaultSubwin[_type])
+ setIsMdiWin(true);
+
+ if (_sharesToolsAndMenu)
+ menuBar()->hide();
+
+ subwinAction->setChecked(isMdiWin());
+ shareAction->setChecked(_sharesToolsAndMenu);
+ fullscreenAction->setEnabled(!isMdiWin());
+
+ resize(_widthInit[_type], _heightInit[_type]);
+}
//---------------------------------------------------------
-// readStatus
+// readStatus
//---------------------------------------------------------
void TopWin::readStatus(Xml& xml)
- {
- for (;;) {
- Xml::Token token = xml.parse();
- if (token == Xml::Error || token == Xml::End)
- break;
- QString tag = xml.s1();
- switch (token) {
- case Xml::TagStart:
- if (tag == "geometry_state") {
- if (!restoreGeometry(QByteArray::fromHex(xml.parse1().toAscii())))
- fprintf(stderr,"ERROR: couldn't restore geometry. however, this is probably not really a problem.\n");
- }
- else if (tag == "toolbars") {
- if (!sharesToolsAndMenu()) {
- if (!restoreState(QByteArray::fromHex(xml.parse1().toAscii())))
- fprintf(stderr,"ERROR: couldn't restore toolbars. however, this is not really a problem.\n");
- }
- else {
- _savedToolbarState=QByteArray::fromHex(xml.parse1().toAscii());
- if (_savedToolbarState.isEmpty())
- _savedToolbarState=_toolbarNonsharedInit[_type];
- }
- }
- else if (tag == "shares_menu") {
- shareToolsAndMenu(xml.parseInt());
- }
- else if (tag == "is_subwin") {
- setIsMdiWin(xml.parseInt());
- }
- else
- xml.unknown("TopWin");
- break;
- case Xml::TagEnd:
- if (tag == "topwin")
- return;
- default:
- break;
- }
- }
- }
+{
+ for (;;)
+ {
+ Xml::Token token = xml.parse();
+ if (token == Xml::Error || token == Xml::End)
+ break;
+
+ QString tag = xml.s1();
+ switch (token)
+ {
+ case Xml::TagStart:
+ if (tag == "geometry_state")
+ {
+ if (!restoreGeometry(QByteArray::fromHex(xml.parse1().toAscii())))
+ fprintf(stderr,"ERROR: couldn't restore geometry. however, this is probably not really a problem.\n");
+ }
+ else if (tag == "toolbars")
+ {
+ if (!sharesToolsAndMenu())
+ {
+ if (!restoreState(QByteArray::fromHex(xml.parse1().toAscii())))
+ fprintf(stderr,"ERROR: couldn't restore toolbars. however, this is not really a problem.\n");
+ }
+ else
+ {
+ _savedToolbarState=QByteArray::fromHex(xml.parse1().toAscii());
+ if (_savedToolbarState.isEmpty())
+ _savedToolbarState=_toolbarNonsharedInit[_type];
+ }
+ }
+ else if (tag == "shares_menu")
+ {
+ shareToolsAndMenu(xml.parseInt());
+ }
+ else if (tag == "is_subwin")
+ {
+ setIsMdiWin(xml.parseInt());
+ }
+ else
+ xml.unknown("TopWin");
+ break;
+
+ case Xml::TagEnd:
+ if (tag == "topwin")
+ return;
+
+ default:
+ break;
+ }
+ }
+}
//---------------------------------------------------------
-// writeStatus
+// writeStatus
//---------------------------------------------------------
void TopWin::writeStatus(int level, Xml& xml) const
- {
- xml.tag(level++, "topwin");
-
- // the order of these tags has a certain sense
- // changing it won't break muse, but it may break proper
- // restoring of the positions
- xml.intTag(level, "is_subwin", isMdiWin());
- xml.strTag(level, "geometry_state", saveGeometry().toHex().data());
- xml.intTag(level, "shares_menu", sharesToolsAndMenu());
-
- if (!sharesToolsAndMenu())
- xml.strTag(level, "toolbars", saveState().toHex().data());
- else
- xml.strTag(level, "toolbars", _savedToolbarState.toHex().data());
-
- xml.tag(level, "/topwin");
- }
+{
+ xml.tag(level++, "topwin");
+
+ // the order of these tags has a certain sense
+ // changing it won't break muse, but it may break proper
+ // restoring of the positions
+ xml.intTag(level, "is_subwin", isMdiWin());
+ xml.strTag(level, "geometry_state", saveGeometry().toHex().data());
+ xml.intTag(level, "shares_menu", sharesToolsAndMenu());
+
+ if (!sharesToolsAndMenu())
+ xml.strTag(level, "toolbars", saveState().toHex().data());
+ else
+ xml.strTag(level, "toolbars", _savedToolbarState.toHex().data());
+
+ xml.tag(level, "/topwin");
+}
void TopWin::hide()
{
- if (mdisubwin)
- mdisubwin->close();
-
- QMainWindow::hide();
+ if (mdisubwin)
+ mdisubwin->close();
+
+ QMainWindow::hide();
}
void TopWin::show()
{
- if (mdisubwin)
- mdisubwin->show();
-
- QMainWindow::show();
+ if (mdisubwin)
+ mdisubwin->show();
+
+ QMainWindow::show();
}
void TopWin::setVisible(bool param)
{
- if (mdisubwin)
- {
- if (param)
- mdisubwin->show();
- else
- mdisubwin->close();
- }
- QMainWindow::setVisible(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;
+ if (mdisubwin==NULL)
+ {
+ mdisubwin = new QMdiSubWindow();
+ mdisubwin->setWidget(this);
+ }
+
+ return mdisubwin;
}
void TopWin::setIsMdiWin(bool val)
{
- if (val)
- {
- if (!isMdiWin())
- {
- _savedToolbarState = saveState();
- int width_temp=width();
- int height_temp=height();
- bool vis=isVisible();
-
- QMdiSubWindow* subwin = createMdiWrapper();
- muse->addMdiSubWindow(subwin);
- subwin->resize(width_temp, height_temp);
- subwin->move(0,0);
- subwin->setVisible(vis);
- this->QMainWindow::show(); //bypass the delegation to the subwin
-
- if (_sharesToolsAndMenu == _sharesWhenFree[_type])
- shareToolsAndMenu(_sharesWhenSubwin[_type]);
-
- fullscreenAction->setEnabled(false);
- fullscreenAction->setChecked(false);
- subwinAction->setChecked(true);
- muse->updateWindowMenu();
- }
- else
- {
- if (MusEGlobal::debugMsg) printf("TopWin::setIsMdiWin(true) called, but window is already a MDI win\n");
- }
- }
- else
- {
- if (isMdiWin())
- {
- int width_temp=width();
- int height_temp=height();
- bool vis=isVisible();
-
- QMdiSubWindow* mdisubwin_temp=mdisubwin;
- mdisubwin=NULL;
- setParent(NULL);
- mdisubwin_temp->hide();
- delete mdisubwin_temp;
-
- resize(width_temp, height_temp);
- setVisible(vis);
-
- if (_sharesToolsAndMenu == _sharesWhenSubwin[_type])
- shareToolsAndMenu(_sharesWhenFree[_type]);
-
- fullscreenAction->setEnabled(true);
- subwinAction->setChecked(false);
- muse->updateWindowMenu();
- }
- else
- {
- if (MusEGlobal::debugMsg) printf("TopWin::setIsMdiWin(false) called, but window is not a MDI win\n");
- }
- }
+ if (val)
+ {
+ if (!isMdiWin())
+ {
+ _savedToolbarState = saveState();
+ int width_temp=width();
+ int height_temp=height();
+ bool vis=isVisible();
+
+ QMdiSubWindow* subwin = createMdiWrapper();
+ muse->addMdiSubWindow(subwin);
+ subwin->resize(width_temp, height_temp);
+ subwin->move(0,0);
+ subwin->setVisible(vis);
+ this->QMainWindow::show(); //bypass the delegation to the subwin
+
+ if (_sharesToolsAndMenu == _sharesWhenFree[_type])
+ shareToolsAndMenu(_sharesWhenSubwin[_type]);
+
+ fullscreenAction->setEnabled(false);
+ fullscreenAction->setChecked(false);
+ subwinAction->setChecked(true);
+ muse->updateWindowMenu();
+ }
+ else
+ {
+ if (MusEGlobal::debugMsg) printf("TopWin::setIsMdiWin(true) called, but window is already a MDI win\n");
+ }
+ }
+ else
+ {
+ if (isMdiWin())
+ {
+ int width_temp=width();
+ int height_temp=height();
+ bool vis=isVisible();
+
+ QMdiSubWindow* mdisubwin_temp=mdisubwin;
+ mdisubwin=NULL;
+ setParent(NULL);
+ mdisubwin_temp->hide();
+ delete mdisubwin_temp;
+
+ resize(width_temp, height_temp);
+ setVisible(vis);
+
+ if (_sharesToolsAndMenu == _sharesWhenSubwin[_type])
+ shareToolsAndMenu(_sharesWhenFree[_type]);
+
+ fullscreenAction->setEnabled(true);
+ subwinAction->setChecked(false);
+ muse->updateWindowMenu();
+ }
+ else
+ {
+ if (MusEGlobal::debugMsg) printf("TopWin::setIsMdiWin(false) called, but window is not a MDI win\n");
+ }
+ }
}
bool TopWin::isMdiWin() const
{
- return (mdisubwin!=NULL);
+ 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"); }
@@ -271,232 +282,237 @@ void TopWin::addToolBar(Qt::ToolBarArea, QToolBar* tb) { printf("ERROR: THIS SHO
void TopWin::addToolBar(QToolBar* toolbar)
{
- _toolbars.push_back(toolbar);
-
- if (!_sharesToolsAndMenu)
- QMainWindow::addToolBar(toolbar);
- else
- toolbar->hide();
-
- toolbar->setIconSize(ICON_SIZE);
+ _toolbars.push_back(toolbar);
+
+ if (!_sharesToolsAndMenu)
+ QMainWindow::addToolBar(toolbar);
+ else
+ toolbar->hide();
+
+ toolbar->setIconSize(ICON_SIZE);
}
QToolBar* TopWin::addToolBar(const QString& title)
{
- QToolBar* toolbar = new QToolBar(title, this);
- addToolBar(toolbar);
- return toolbar;
+ QToolBar* toolbar = new QToolBar(title, this);
+ addToolBar(toolbar);
+ return toolbar;
}
void TopWin::shareToolsAndMenu(bool val)
{
- if (_sharesToolsAndMenu == val)
- {
- if (MusEGlobal::debugMsg) printf("TopWin::shareToolsAndMenu() called but has no effect\n");
- return;
- }
-
-
- _sharesToolsAndMenu = val;
-
- if (!val)
- {
- muse->shareMenuAndToolbarChanged(this, false);
-
- for (list<QToolBar*>::iterator it=_toolbars.begin(); it!=_toolbars.end(); it++)
- if (*it != NULL)
- {
- QMainWindow::addToolBar(*it);
- (*it)->show();
- }
- else
- QMainWindow::addToolBarBreak();
-
- restoreState(_savedToolbarState);
- _savedToolbarState.clear();
-
- menuBar()->show();
- }
- else
- {
- if (_savedToolbarState.isEmpty()) // this check avoids overwriting a previously saved state
- _savedToolbarState = saveState(); // (by setIsMdiWin) with a now incorrect (empty) state
-
- for (list<QToolBar*>::iterator it=_toolbars.begin(); it!=_toolbars.end(); it++)
- if (*it != NULL)
- {
- QMainWindow::removeToolBar(*it); // this does NOT delete the toolbar, which is good
- (*it)->setParent(NULL);
- }
-
- menuBar()->hide();
-
- muse->shareMenuAndToolbarChanged(this, true);
- }
-
- shareAction->setChecked(val);
+ if (_sharesToolsAndMenu == val)
+ {
+ if (MusEGlobal::debugMsg) printf("TopWin::shareToolsAndMenu() called but has no effect\n");
+ return;
+ }
+
+
+ _sharesToolsAndMenu = val;
+
+ if (!val)
+ {
+ muse->shareMenuAndToolbarChanged(this, false);
+
+ for (list<QToolBar*>::iterator it=_toolbars.begin(); it!=_toolbars.end(); it++)
+ if (*it != NULL)
+ {
+ QMainWindow::addToolBar(*it);
+ (*it)->show();
+ }
+ else
+ QMainWindow::addToolBarBreak();
+
+ restoreState(_savedToolbarState);
+ _savedToolbarState.clear();
+
+ menuBar()->show();
+ }
+ else
+ {
+ if (_savedToolbarState.isEmpty()) // this check avoids overwriting a previously saved state
+ _savedToolbarState = saveState(); // (by setIsMdiWin) with a now incorrect (empty) state
+
+ for (list<QToolBar*>::iterator it=_toolbars.begin(); it!=_toolbars.end(); it++)
+ if (*it != NULL)
+ {
+ QMainWindow::removeToolBar(*it); // this does NOT delete the toolbar, which is good
+ (*it)->setParent(NULL);
+ }
+
+ menuBar()->hide();
+
+ muse->shareMenuAndToolbarChanged(this, true);
+ }
+
+ shareAction->setChecked(val);
}
//---------------------------------------------------------
-// storeInitialState
+// storeInitialState
//---------------------------------------------------------
void TopWin::storeInitialState() const
- {
- _widthInit[_type] = width();
- _heightInit[_type] = height();
- if (sharesToolsAndMenu())
- {
- if (muse->getCurrentMenuSharingTopwin() == this)
- _toolbarSharedInit[_type] = muse->saveState();
- }
- else
- _toolbarNonsharedInit[_type] = saveState();
- }
+{
+ _widthInit[_type] = width();
+ _heightInit[_type] = height();
+ if (sharesToolsAndMenu())
+ {
+ if (muse->getCurrentMenuSharingTopwin() == this)
+ _toolbarSharedInit[_type] = muse->saveState();
+ }
+ else
+ _toolbarNonsharedInit[_type] = saveState();
+}
//initConfiguration() restores default "traditional muse" configuration
void TopWin::initConfiguration()
{
- if (initInited==false)
- {
- for (int i=0;i<TOPLEVELTYPE_LAST_ENTRY;i++)
- {
- _widthInit[i]=800;
- _heightInit[i]=600;
- _sharesWhenFree[i]=false;
- _sharesWhenSubwin[i]=true;
- _defaultSubwin[i]=false;
- }
-
- _defaultSubwin[ARRANGER]=true;
-
- initInited=true;
- }
+ if (initInited==false)
+ {
+ for (int i=0;i<TOPLEVELTYPE_LAST_ENTRY;i++)
+ {
+ _widthInit[i]=800;
+ _heightInit[i]=600;
+ _sharesWhenFree[i]=false;
+ _sharesWhenSubwin[i]=true;
+ _defaultSubwin[i]=false;
+ }
+
+ _defaultSubwin[ARRANGER]=true;
+
+ initInited=true;
+ }
}
//---------------------------------------------------------
-// readConfiguration
+// readConfiguration
//---------------------------------------------------------
void TopWin::readConfiguration(ToplevelType t, Xml& xml)
- {
- if (initInited==false)
- initConfiguration();
-
- for (;;) {
- Xml::Token token = xml.parse();
- if (token == Xml::Error || token == Xml::End)
- break;
- const QString& tag = xml.s1();
- switch (token) {
- case Xml::TagStart:
- if (tag == "width")
- _widthInit[t] = xml.parseInt();
- else if (tag == "height")
- _heightInit[t] = xml.parseInt();
- else if (tag == "nonshared_toolbars")
- _toolbarNonsharedInit[t] = QByteArray::fromHex(xml.parse1().toAscii());
- else if (tag == "shared_toolbars")
- _toolbarSharedInit[t] = QByteArray::fromHex(xml.parse1().toAscii());
- else if (tag == "shares_when_free")
- _sharesWhenFree[t] = xml.parseInt();
- else if (tag == "shares_when_subwin")
- _sharesWhenSubwin[t] = xml.parseInt();
- else if (tag == "default_subwin")
- _defaultSubwin[t] = xml.parseInt();
- else
- xml.unknown("TopWin");
- break;
- case Xml::TagEnd:
- if (tag == "topwin")
- return;
- default:
- break;
- }
- }
- }
+{
+if (initInited==false)
+ initConfiguration();
+
+ for (;;)
+ {
+ Xml::Token token = xml.parse();
+ if (token == Xml::Error || token == Xml::End)
+ break;
+
+ const QString& tag = xml.s1();
+ switch (token)
+ {
+ case Xml::TagStart:
+ if (tag == "width")
+ _widthInit[t] = xml.parseInt();
+ else if (tag == "height")
+ _heightInit[t] = xml.parseInt();
+ else if (tag == "nonshared_toolbars")
+ _toolbarNonsharedInit[t] = QByteArray::fromHex(xml.parse1().toAscii());
+ else if (tag == "shared_toolbars")
+ _toolbarSharedInit[t] = QByteArray::fromHex(xml.parse1().toAscii());
+ else if (tag == "shares_when_free")
+ _sharesWhenFree[t] = xml.parseInt();
+ else if (tag == "shares_when_subwin")
+ _sharesWhenSubwin[t] = xml.parseInt();
+ else if (tag == "default_subwin")
+ _defaultSubwin[t] = xml.parseInt();
+ else
+ xml.unknown("TopWin");
+ break;
+
+ case Xml::TagEnd:
+ if (tag == "topwin")
+ return;
+
+ default:
+ break;
+ }
+ }
+}
//---------------------------------------------------------
-// writeConfiguration
+// writeConfiguration
//---------------------------------------------------------
void TopWin::writeConfiguration(ToplevelType t, int level, Xml& xml)
- {
- if (!initInited)
- {
- printf ("WARNING: TopWin::writeConfiguration() called although the config hasn't been\n"
- " initalized! writing default configuration\n");
- initConfiguration();
- }
- xml.tag(level++, "topwin");
- xml.intTag(level, "width", _widthInit[t]);
- xml.intTag(level, "height", _heightInit[t]);
- xml.strTag(level, "nonshared_toolbars", _toolbarNonsharedInit[t].toHex().data());
- xml.strTag(level, "shared_toolbars", _toolbarSharedInit[t].toHex().data());
- xml.intTag(level, "shares_when_free", _sharesWhenFree[t]);
- xml.intTag(level, "shares_when_subwin", _sharesWhenSubwin[t]);
- xml.intTag(level, "default_subwin", _defaultSubwin[t]);
- xml.etag(level, "topwin");
- }
+{
+ if (!initInited)
+ {
+ printf ("WARNING: TopWin::writeConfiguration() called although the config hasn't been\n"
+ " initalized! writing default configuration\n");
+ initConfiguration();
+ }
+ xml.tag(level++, "topwin");
+ xml.intTag(level, "width", _widthInit[t]);
+ xml.intTag(level, "height", _heightInit[t]);
+ xml.strTag(level, "nonshared_toolbars", _toolbarNonsharedInit[t].toHex().data());
+ xml.strTag(level, "shared_toolbars", _toolbarSharedInit[t].toHex().data());
+ xml.intTag(level, "shares_when_free", _sharesWhenFree[t]);
+ xml.intTag(level, "shares_when_subwin", _sharesWhenSubwin[t]);
+ xml.intTag(level, "default_subwin", _defaultSubwin[t]);
+ xml.etag(level, "topwin");
+}
void TopWin::initTopwinState()
{
- if (sharesToolsAndMenu())
- {
- if (this == muse->getCurrentMenuSharingTopwin())
- muse->restoreState(_toolbarSharedInit[_type]);
- }
- else
- restoreState(_toolbarNonsharedInit[_type]);
+ if (sharesToolsAndMenu())
+ {
+ if (this == muse->getCurrentMenuSharingTopwin())
+ muse->restoreState(_toolbarSharedInit[_type]);
+ }
+ else
+ restoreState(_toolbarNonsharedInit[_type]);
}
void TopWin::restoreMainwinState()
{
- if (sharesToolsAndMenu())
- initTopwinState();
+ if (sharesToolsAndMenu())
+ initTopwinState();
}
QString TopWin::typeName(ToplevelType t)
{
- switch (t)
- {
- case PIANO_ROLL: return tr("Piano roll");
- case LISTE: return tr("List editor");
- case DRUM: return tr("Drum editor");
- case MASTER: return tr("Master track editor");
- case LMASTER: return tr("Master track list editor");
- case WAVE: return tr("Wave editor");
- case CLIPLIST: return tr("Clip list");
- case MARKER: return tr("Marker view");
- case SCORE: return tr("Score editor");
- case ARRANGER: return tr("Arranger");
- default: return tr("<unknown toplevel type>");
- }
+ switch (t)
+ {
+ case PIANO_ROLL: return tr("Piano roll");
+ case LISTE: return tr("List editor");
+ case DRUM: return tr("Drum editor");
+ case MASTER: return tr("Master track editor");
+ case LMASTER: return tr("Master track list editor");
+ case WAVE: return tr("Wave editor");
+ case CLIPLIST: return tr("Clip list");
+ case MARKER: return tr("Marker view");
+ case SCORE: return tr("Score editor");
+ case ARRANGER: return tr("Arranger");
+ default: return tr("<unknown toplevel type>");
+ }
}
void TopWin::setFullscreen(bool val)
{
- if (val)
- showFullScreen();
- else
- showNormal();
+ if (val)
+ showFullScreen();
+ else
+ showNormal();
}
void TopWin::resize(int w, int h)
{
- QMainWindow::resize(w,h);
-
- if (isMdiWin())
- mdisubwin->resize(w,h);
+ QMainWindow::resize(w,h);
+
+ if (isMdiWin())
+ mdisubwin->resize(w,h);
}
void TopWin::resize(const QSize& s)
{
- resize(s.width(), s.height());
+ resize(s.width(), s.height());
}