summaryrefslogtreecommitdiff
path: root/muse2
diff options
context:
space:
mode:
Diffstat (limited to 'muse2')
-rw-r--r--muse2/muse/app.cpp94
-rw-r--r--muse2/muse/app.h2
-rw-r--r--muse2/muse/arranger/arrangerview.cpp4
-rw-r--r--muse2/muse/cliplist/cliplist.cpp2
-rw-r--r--muse2/muse/cobject.cpp109
-rw-r--r--muse2/muse/cobject.h28
-rw-r--r--muse2/muse/liste/listedit.cpp1
-rw-r--r--muse2/muse/marker/markerview.cpp5
-rw-r--r--muse2/muse/master/lmaster.cpp1
-rw-r--r--muse2/muse/master/masteredit.cpp52
-rw-r--r--muse2/muse/master/masteredit.h6
-rw-r--r--muse2/muse/midiedit/drumedit.cpp59
-rw-r--r--muse2/muse/midiedit/drumedit.h6
-rw-r--r--muse2/muse/midiedit/pianoroll.cpp59
-rw-r--r--muse2/muse/midiedit/pianoroll.h6
-rw-r--r--muse2/muse/midiedit/scoreedit.cpp44
-rw-r--r--muse2/muse/midiedit/scoreedit.h6
-rw-r--r--muse2/muse/waveedit/waveedit.cpp60
-rw-r--r--muse2/muse/waveedit/waveedit.h5
19 files changed, 217 insertions, 332 deletions
diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp
index fe3b987e..d3ad0e64 100644
--- a/muse2/muse/app.cpp
+++ b/muse2/muse/app.cpp
@@ -1746,6 +1746,7 @@ 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*)));
@@ -2018,7 +2019,7 @@ void MusE::toplevelDeleted(TopWin* tl)
case TopWin::SCORE:
mustUpdateScoreMenus=true;
- case TopWin::LAST_ENTRY: //to avoid a warning
+ case TopWin::TOPLEVELTYPE_LAST_ENTRY: //to avoid a warning
break;
}
toplevels.erase(i);
@@ -2641,7 +2642,7 @@ again:
tl->close();
goto again;
- case TopWin::LAST_ENTRY: //to avoid a warning
+ case TopWin::TOPLEVELTYPE_LAST_ENTRY: //to avoid a warning
break;
}
}
@@ -2956,7 +2957,15 @@ void MusE::findUnusedWaveFiles()
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
@@ -2966,21 +2975,6 @@ void MusE::focusChanged(QWidget*, QWidget* now)
}
// ptr is either NULL, this or the pointer to a TopWin
- /*if (ptr==this) FINDMICHJETZT
- {
- QMdiSubWindow* subwin=mdiArea->currentSubWindow();
- if (subwin)
- {
- ptr=subwin->widget();
- if (dynamic_cast<TopWin*>(ptr)==NULL)
- {
- printf("ERROR: THIS SHOULD NEVER HAPPEN: The currently active MdiSubWindow (%s) does not wrap a TopWin but a %s\n",subwin->windowTitle().toAscii().data(),typeid(*ptr).name());
- ptr=NULL;
- }
- }
- else
- ptr=NULL;
- }*/
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);
@@ -2994,28 +2988,6 @@ void MusE::focusChanged(QWidget*, QWidget* now)
}
}
-/* FINDMICHJETZT
-void MusE::focusChanged(QWidget* old, QWidget* now)
-{
- if (now)
- {
- QWidget* ptr=now;
- while (ptr)
- {
- if (dynamic_cast<QMainWindow*>(ptr)!=0) break;
- ptr=dynamic_cast<QWidget*>(ptr->parent()); //in the unlikely case that ptr is a QObject, this returns NULL, which stops the loop
- }
-
- if (ptr)
- printf("focus changed to MainWin %p (%s)\n",ptr,ptr->windowTitle().toAscii().data());
- else
- printf("focus changed to something which has no MainWin: %p (%s)\n",now, typeid(*now).name());
- }
- else
- printf("focus lost\n");
-}
-*/
-
void MusE::activeTopWinChangedSlot(TopWin* win)
{
@@ -3026,19 +2998,6 @@ void MusE::activeTopWinChangedSlot(TopWin* win)
if (debugMsg) printf(" that's out of the MDI area\n");
menuBar()->setFocus(Qt::MenuBarFocusReason);
}
- if (win && false) //FINDMICHJETZT
- {
- if (win->isMdiWin())
- {
- if (debugMsg) printf(" that's a mdiSubWin\n");
- }
- else
- {
- if (debugMsg) printf(" that's a free floating window\n");
- mdiArea->setActiveSubWindow(NULL);
- mdiArea->clearFocus();
- }
- }
if (win && (win->sharesToolsAndMenu()))
setCurrentMenuSharingTopwin(win);
@@ -3056,27 +3015,38 @@ void MusE::setCurrentMenuSharingTopwin(TopWin* win)
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 (currentMenuSharingTopwin)
+ if (previousMenuSharingTopwin)
{
for (list<QToolBar*>::iterator it = foreignToolbars.begin(); it!=foreignToolbars.end(); it++)
- if (*it) removeToolBar(*it); // this does not delete *it, which is good
+ 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) removeToolBar(*it); // this does not delete *it, which is good
+ 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();
-
- currentMenuSharingTopwin=win;
-
+
@@ -3116,6 +3086,14 @@ void MusE::setCurrentMenuSharingTopwin(TopWin* win)
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
}
}
diff --git a/muse2/muse/app.h b/muse2/muse/app.h
index d71d947b..c491a2de 100644
--- a/muse2/muse/app.h
+++ b/muse2/muse/app.h
@@ -357,6 +357,8 @@ class MusE : public QMainWindow
const ToplevelList* getToplevels() { return &toplevels; }
+ TopWin* getCurrentMenuSharingTopwin() { return currentMenuSharingTopwin; }
+
#ifdef HAVE_LASH
void lash_idle_cb ();
#endif
diff --git a/muse2/muse/arranger/arrangerview.cpp b/muse2/muse/arranger/arrangerview.cpp
index 9e6b5c11..b6a48608 100644
--- a/muse2/muse/arranger/arrangerview.cpp
+++ b/muse2/muse/arranger/arrangerview.cpp
@@ -335,7 +335,7 @@ ArrangerView::ArrangerView(QWidget* parent)
undo_tools->addActions(undoRedo->actions());
- QToolBar* panic_toolbar = addToolBar(tr("panic"));
+ QToolBar* panic_toolbar = addToolBar(tr("panic"));
panic_toolbar->setObjectName("panic");
panic_toolbar->addAction(panicAction);
@@ -573,6 +573,8 @@ ArrangerView::ArrangerView(QWidget* parent)
// bug: 2811156 Softsynth GUI unclosable with XFCE4 (and a few others)
show();
hide();
+
+ initalizing=false;
}
ArrangerView::~ArrangerView()
diff --git a/muse2/muse/cliplist/cliplist.cpp b/muse2/muse/cliplist/cliplist.cpp
index afd843ef..e49b315d 100644
--- a/muse2/muse/cliplist/cliplist.cpp
+++ b/muse2/muse/cliplist/cliplist.cpp
@@ -143,6 +143,8 @@ ClipListEdit::ClipListEdit(QWidget* parent)
connect(editor->len, SIGNAL(valueChanged(const Pos&)), SLOT(lenChanged(const Pos&)));
updateList();
+
+ initalizing=false;
}
ClipListEdit::~ClipListEdit()
diff --git a/muse2/muse/cobject.cpp b/muse2/muse/cobject.cpp
index 8f3932ec..a97a29a1 100644
--- a/muse2/muse/cobject.cpp
+++ b/muse2/muse/cobject.cpp
@@ -19,9 +19,28 @@
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::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;
+ }
+
+ initInited=true;
+ }
+
+ initalizing=true;
+
_type=t;
setObjectName(QString(name));
@@ -228,3 +247,93 @@ void TopWin::shareToolsAndMenu(bool val)
emit toolsAndMenuSharingChanged(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 a106702a..ba731d1e 100644
--- a/muse2/muse/cobject.h
+++ b/muse2/muse/cobject.h
@@ -13,6 +13,7 @@
#include <QMainWindow>
#include <list>
+#include <QByteArray>
class QMdiSubWindow;
class QFocusEvent;
@@ -29,12 +30,12 @@ class TopWin : public QMainWindow
Q_OBJECT
public:
- enum ToplevelType { PIANO_ROLL, LISTE, DRUM, MASTER, WAVE,
- LMASTER, CLIPLIST, MARKER, SCORE, ARRANGER,
+ 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,
#endif /* PATCHBAY */
- LAST_ENTRY
+ TOPLEVELTYPE_LAST_ENTRY //this has to be always the last entry
};
ToplevelType type() const { return _type; }
@@ -42,6 +43,10 @@ class TopWin : public QMainWindow
virtual void readStatus(Xml&);
virtual void writeStatus(int, Xml&) const;
+
+ static void readConfiguration(ToplevelType, Xml&);
+ static void writeConfiguration(ToplevelType, int, Xml&);
+
bool isMdiWin();
@@ -55,8 +60,6 @@ class TopWin : public QMainWindow
QToolBar* addToolBar(const QString& title);
private:
- ToplevelType _type;
-
QMdiSubWindow* mdisubwin;
bool _sharesToolsAndMenu;
std::list<QToolBar*> _toolbars;
@@ -68,15 +71,30 @@ class TopWin : public QMainWindow
void addToolBar(Qt::ToolBarArea, QToolBar*);
virtual QMdiSubWindow* createMdiWrapper();
+
protected:
QAction* subwinAction;
+
+ ToplevelType _type;
+
+ 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 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 restoreMainwinState();
+ void storeInitialState();
signals:
void toolsAndMenuSharingChanged(bool);
diff --git a/muse2/muse/liste/listedit.cpp b/muse2/muse/liste/listedit.cpp
index d37d80bd..cd3d165e 100644
--- a/muse2/muse/liste/listedit.cpp
+++ b/muse2/muse/liste/listedit.cpp
@@ -587,6 +587,7 @@ ListEdit::ListEdit(PartList* pl)
}
initShortcuts();
+ initalizing=false;
}
//---------------------------------------------------------
diff --git a/muse2/muse/marker/markerview.cpp b/muse2/muse/marker/markerview.cpp
index ad1e49d2..3c0f2267 100644
--- a/muse2/muse/marker/markerview.cpp
+++ b/muse2/muse/marker/markerview.cpp
@@ -188,7 +188,7 @@ MarkerView::MarkerView(QWidget* parent)
edit->addAction(markerAdd);
edit->addAction(markerDelete);
- QToolBar* panic_toolbar = addToolBar(tr("panic"));
+ QToolBar* panic_toolbar = addToolBar(tr("panic"));
panic_toolbar->setObjectName("panic");
panic_toolbar->addAction(panicAction);
@@ -284,7 +284,8 @@ MarkerView::MarkerView(QWidget* parent)
// bug: 2811156 Softsynth GUI unclosable with XFCE4 (and a few others)
show();
hide();
-
+
+ initalizing=false;
}
//---------------------------------------------------------
diff --git a/muse2/muse/master/lmaster.cpp b/muse2/muse/master/lmaster.cpp
index 538a20c7..f434e99a 100644
--- a/muse2/muse/master/lmaster.cpp
+++ b/muse2/muse/master/lmaster.cpp
@@ -245,6 +245,7 @@ LMaster::LMaster()
connect(keyButton, SIGNAL(clicked()), SLOT(insertKey()));
initShortcuts();
+ initalizing=false;
}
//---------------------------------------------------------
diff --git a/muse2/muse/master/masteredit.cpp b/muse2/muse/master/masteredit.cpp
index 30e95dbd..f484e935 100644
--- a/muse2/muse/master/masteredit.cpp
+++ b/muse2/muse/master/masteredit.cpp
@@ -35,9 +35,6 @@
#include <QMenu>
int MasterEdit::_rasterInit = 0;
-int MasterEdit::_widthInit = 600;
-int MasterEdit::_heightInit = 400;
-QByteArray MasterEdit::_toolbarInit;
//---------------------------------------------------------
// closeEvent
@@ -86,8 +83,8 @@ MasterEdit::MasterEdit()
{
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);
@@ -247,8 +244,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);
+ initTopwinState();
+ initalizing=false;
}
//---------------------------------------------------------
@@ -337,12 +334,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;
@@ -363,9 +356,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");
}
@@ -434,34 +425,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 011ea302..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);
diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp
index bf9744b6..8c02dbeb 100644
--- a/muse2/muse/midiedit/drumedit.cpp
+++ b/muse2/muse/midiedit/drumedit.cpp
@@ -62,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;
@@ -159,8 +156,9 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini
: 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);
@@ -485,9 +483,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()));
@@ -510,10 +505,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;
}
//---------------------------------------------------------
@@ -764,16 +759,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;
@@ -795,11 +786,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");
}
@@ -1048,37 +1037,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 a9ec4d06..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();
diff --git a/muse2/muse/midiedit/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp
index 7b095713..ac15f9cd 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;
@@ -72,11 +69,12 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i
: 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);
@@ -473,9 +471,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()));
@@ -503,10 +498,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;
}
//---------------------------------------------------------
@@ -814,12 +807,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;
@@ -840,10 +829,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");
}
@@ -1211,38 +1198,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 2677d530..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*);
diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp
index 378a7ad3..4623bca7 100644
--- a/muse2/muse/midiedit/scoreedit.cpp
+++ b/muse2/muse/midiedit/scoreedit.cpp
@@ -141,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;
//---------------------------------------------------------
@@ -156,7 +153,7 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos)
setAttribute(Qt::WA_DeleteOnClose);
setFocusPolicy(Qt::StrongFocus);
- resize(width_init, height_init);
+ resize(_widthInit[_type], _heightInit[_type]);
mainw = new QWidget(this);
@@ -457,9 +454,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();
@@ -472,6 +466,9 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos)
apply_velo=true;
+
+ initTopwinState();
+ initalizing=false;
}
void ScoreEdit::init_shortcuts()
@@ -644,26 +641,6 @@ void ScoreEdit::closeEvent(QCloseEvent* e)
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)
{
@@ -1034,12 +1011,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;
@@ -1058,9 +1031,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");
}
@@ -4477,6 +4448,7 @@ void staff_t::update_part_indices()
* 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 for arranger, probably also for other stuff
*
* IMPORTANT TODO
diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h
index 65990df5..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;
diff --git a/muse2/muse/waveedit/waveedit.cpp b/muse2/muse/waveedit/waveedit.cpp
index d4b692fe..9674af5a 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
//---------------------------------------------------------
@@ -64,8 +60,8 @@ void WaveEdit::closeEvent(QCloseEvent* e)
WaveEdit::WaveEdit(PartList* pl)
: MidiEditor(TopWin::WAVE, 1, pl)
{
- resize(_widthInit, _heightInit);
setFocusPolicy(Qt::StrongFocus);
+ resize(_widthInit[_type], _heightInit[_type]);
QSignalMapper* mapper = new QSignalMapper(this);
QAction* act;
@@ -207,7 +203,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;
@@ -260,9 +256,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();
@@ -273,10 +266,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()
@@ -363,12 +355,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;
@@ -392,9 +380,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");
}
@@ -446,38 +432,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 2bfffcc1..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;