From d77502e453b6994a1035b77f1849f620d7c75027 Mon Sep 17 00:00:00 2001 From: Florian Jung Date: Thu, 18 Aug 2011 19:37:54 +0000 Subject: added GUI for MDI settings fixed loading of arranger settings --- muse2/muse/cobject.cpp | 78 ++++++++++++++++++++++++-------- muse2/muse/cobject.h | 11 +++-- muse2/muse/conf.cpp | 6 --- muse2/muse/widgets/CMakeLists.txt | 3 ++ muse2/muse/widgets/genset.cpp | 79 ++++++++++++++++++++++++++++++++ muse2/muse/widgets/genset.h | 10 ++++ muse2/muse/widgets/gensetbase.ui | 83 ++++++++++++++++++++++++++++------ muse2/muse/widgets/mdisettings.cpp | 44 ++++++++++++++++++ muse2/muse/widgets/mdisettings.h | 34 ++++++++++++++ muse2/muse/widgets/mdisettings_base.ui | 60 ++++++++++++++++++++++++ 10 files changed, 366 insertions(+), 42 deletions(-) create mode 100644 muse2/muse/widgets/mdisettings.cpp create mode 100644 muse2/muse/widgets/mdisettings.h create mode 100644 muse2/muse/widgets/mdisettings_base.ui diff --git a/muse2/muse/cobject.cpp b/muse2/muse/cobject.cpp index 5e007fe3..398f8be7 100644 --- a/muse2/muse/cobject.cpp +++ b/muse2/muse/cobject.cpp @@ -32,23 +32,7 @@ TopWin::TopWin(ToplevelType t, QWidget* parent, const char* name, Qt::WindowFlag : QMainWindow(parent, f) { if (initInited==false) - { - for (int i=0;i"); + } +} diff --git a/muse2/muse/cobject.h b/muse2/muse/cobject.h index f76f6f61..6b982747 100644 --- a/muse2/muse/cobject.h +++ b/muse2/muse/cobject.h @@ -14,6 +14,7 @@ #include #include #include +#include class QMdiSubWindow; class QFocusEvent; @@ -39,6 +40,7 @@ class TopWin : public QMainWindow }; ToplevelType type() const { return _type; } + static QString typeName(ToplevelType t); virtual void readStatus(Xml&); @@ -58,6 +60,11 @@ class TopWin : public QMainWindow void addToolBar(QToolBar* toolbar); QToolBar* addToolBar(const QString& title); + + static bool _sharesWhenFree[TOPLEVELTYPE_LAST_ENTRY]; + static bool _sharesWhenSubwin[TOPLEVELTYPE_LAST_ENTRY]; + static bool _defaultSubwin[TOPLEVELTYPE_LAST_ENTRY]; + private: QMdiSubWindow* mdisubwin; bool _sharesToolsAndMenu; @@ -71,6 +78,7 @@ class TopWin : public QMainWindow virtual QMdiSubWindow* createMdiWrapper(); + static void initConfiguration(); protected: QAction* subwinAction; @@ -82,9 +90,6 @@ 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(); diff --git a/muse2/muse/conf.cpp b/muse2/muse/conf.cpp index 7451e22c..5fea91a5 100644 --- a/muse2/muse/conf.cpp +++ b/muse2/muse/conf.cpp @@ -883,12 +883,6 @@ void readConfiguration(Xml& xml, bool readOnlySequencer) } //else if (tag == "midiSyncInfo") // readConfigMidiSyncInfo(xml); - else if (tag == "arranger") { - if (muse && muse->arranger) - muse->arranger->readStatus(xml); - else - xml.skip(tag); - } else if (tag == "drumedit") DrumEdit::readConfiguration(xml); else if (tag == "pianoroll") diff --git a/muse2/muse/widgets/CMakeLists.txt b/muse2/muse/widgets/CMakeLists.txt index a4da398f..b1eb888a 100644 --- a/muse2/muse/widgets/CMakeLists.txt +++ b/muse2/muse/widgets/CMakeLists.txt @@ -42,6 +42,7 @@ QT4_WRAP_CPP (widget_mocs doublelabel.h filedialog.h genset.h + mdisettings.h header.h hitscale.h intlabel.h @@ -104,6 +105,7 @@ file (GLOB widgets_ui_files editsysexdialogbase.ui fdialogbuttons.ui gensetbase.ui + mdisettings_base.ui itransformbase.ui metronomebase.ui midisync.ui @@ -139,6 +141,7 @@ file (GLOB widgets_source_files drange.cpp filedialog.cpp genset.cpp + mdisettings.cpp header.cpp hitscale.cpp intlabel.cpp diff --git a/muse2/muse/widgets/genset.cpp b/muse2/muse/widgets/genset.cpp index d8c76874..3aff8247 100644 --- a/muse2/muse/widgets/genset.cpp +++ b/muse2/muse/widgets/genset.cpp @@ -163,8 +163,31 @@ Shorter periods are desirable. connect(setBigtimeCurrent, SIGNAL(clicked()), SLOT(bigtimeCurrent())); connect(setArrangerCurrent, SIGNAL(clicked()), SLOT(arrangerCurrent())); connect(setTransportCurrent, SIGNAL(clicked()), SLOT(transportCurrent())); + + connect(buttonTraditionalPreset, SIGNAL(clicked()), SLOT(traditionalPreset())); + connect(buttonMDIPreset, SIGNAL(clicked()), SLOT(mdiPreset())); + connect(buttonBorlandPreset, SIGNAL(clicked()), SLOT(borlandPreset())); + + addMdiSettings(TopWin::ARRANGER); + addMdiSettings(TopWin::SCORE); + addMdiSettings(TopWin::PIANO_ROLL); + addMdiSettings(TopWin::DRUM); + addMdiSettings(TopWin::LISTE); + addMdiSettings(TopWin::WAVE); + addMdiSettings(TopWin::MASTER); + addMdiSettings(TopWin::LMASTER); + addMdiSettings(TopWin::CLIPLIST); + addMdiSettings(TopWin::MARKER); + } +void GlobalSettingsConfig::addMdiSettings(TopWin::ToplevelType t) +{ + MdiSettings* temp = new MdiSettings(t, this); + layoutMdiSettings->addWidget(temp); + mdisettings.push_back(temp); +} + //--------------------------------------------------------- // updateSettings //--------------------------------------------------------- @@ -265,6 +288,20 @@ void GlobalSettingsConfig::updateSettings() moveArmedCheckBox->setChecked(config.moveArmedCheckBox); projectSaveCheckBox->setChecked(config.useProjectSaveDialog); popsDefStayOpenCheckBox->setChecked(config.popupsDefaultStayOpen); + + updateMdiSettings(); +} + +void GlobalSettingsConfig::updateMdiSettings() +{ + for (std::list::iterator it = mdisettings.begin(); it!=mdisettings.end(); it++) + (*it)->update_settings(); +} + +void GlobalSettingsConfig::applyMdiSettings() +{ + for (std::list::iterator it = mdisettings.begin(); it!=mdisettings.end(); it++) + (*it)->apply_settings(); } //--------------------------------------------------------- @@ -386,6 +423,9 @@ void GlobalSettingsConfig::apply() muse->setHeartBeat(); // set guiRefresh midiSeq->msgSetRtc(); // set midi tick rate + + applyMdiSettings(); + muse->changeConfig(true); // save settings } @@ -496,3 +536,42 @@ void GlobalSettingsConfig::defaultInstrumentsPath() QString dir = configPath + "/instruments"; userInstrumentsPath->setText(dir); } + + +void GlobalSettingsConfig::traditionalPreset() +{ + for (std::list::iterator it = mdisettings.begin(); it!=mdisettings.end(); it++) + { + TopWin::ToplevelType type = (*it)->type(); + TopWin::_sharesWhenFree[type]=false; + TopWin::_defaultSubwin[type]=false; + } + TopWin::_defaultSubwin[TopWin::ARRANGER]=true; + + updateMdiSettings(); +} + +void GlobalSettingsConfig::mdiPreset() +{ + for (std::list::iterator it = mdisettings.begin(); it!=mdisettings.end(); it++) + { + TopWin::ToplevelType type = (*it)->type(); + TopWin::_sharesWhenSubwin[type]=true; + TopWin::_defaultSubwin[type]=true; + } + + updateMdiSettings(); +} + +void GlobalSettingsConfig::borlandPreset() +{ + for (std::list::iterator it = mdisettings.begin(); it!=mdisettings.end(); it++) + { + TopWin::ToplevelType type = (*it)->type(); + TopWin::_sharesWhenFree[type]=true; + TopWin::_defaultSubwin[type]=false; + } + + updateMdiSettings(); +} + diff --git a/muse2/muse/widgets/genset.h b/muse2/muse/widgets/genset.h index ea094296..bc9ed1dd 100644 --- a/muse2/muse/widgets/genset.h +++ b/muse2/muse/widgets/genset.h @@ -10,8 +10,11 @@ #define __GENSET_H__ #include "ui_gensetbase.h" +#include "cobject.h" +#include "mdisettings.h" #include +#include //--------------------------------------------------------- // GlobalSettingsConfig @@ -22,6 +25,9 @@ class GlobalSettingsConfig : public QDialog, public Ui::GlobalSettingsDialogBase private slots: void updateSettings(); + void updateMdiSettings(); + void addMdiSettings(TopWin::ToplevelType t); + void applyMdiSettings(); void apply(); void ok(); void cancel(); @@ -32,10 +38,14 @@ class GlobalSettingsConfig : public QDialog, public Ui::GlobalSettingsDialogBase void transportCurrent(); void selectInstrumentsPath(); void defaultInstrumentsPath(); + void traditionalPreset(); + void mdiPreset(); + void borlandPreset(); protected: void showEvent(QShowEvent*); QButtonGroup *startSongGroup; + std::list mdisettings; public: GlobalSettingsConfig(QWidget* parent=0); diff --git a/muse2/muse/widgets/gensetbase.ui b/muse2/muse/widgets/gensetbase.ui index 68f3ebb5..6b5ab8a8 100644 --- a/muse2/muse/widgets/gensetbase.ui +++ b/muse2/muse/widgets/gensetbase.ui @@ -6,7 +6,7 @@ 0 0 - 526 + 556 506 @@ -23,7 +23,7 @@ - 0 + 3 @@ -1333,19 +1333,6 @@ Adjusts responsiveness of audio controls and - - - - Qt::Vertical - - - - 20 - 40 - - - - @@ -1370,6 +1357,72 @@ Otherwise, hold Ctrl to keep them open. + + + + MDI-subwindowness and sharing menus + + + false + + + + + + + + Presets: + + + + + + + traditional MusE SDI + + + + + + + Cakewalk-like MDI + + + + + + + Borland-like MDI + + + + + + + + + true + + + + + 0 + 0 + 482 + 168 + + + + + + + + + + + + + diff --git a/muse2/muse/widgets/mdisettings.cpp b/muse2/muse/widgets/mdisettings.cpp new file mode 100644 index 00000000..127aa5c1 --- /dev/null +++ b/muse2/muse/widgets/mdisettings.cpp @@ -0,0 +1,44 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: genset.cpp,v 1.7.2.8 2009/12/01 03:52:40 terminator356 Exp $ +// +// (C) Copyright 2001-2004 Werner Schweer (ws@seh.de) +//========================================================= + +#include + +#include +#include +#include + +#include "mdisettings.h" +#include "app.h" +#include "gconfig.h" +#include "midiseq.h" +#include "globals.h" +#include "icons.h" + +MdiSettings::MdiSettings(TopWin::ToplevelType t, QWidget* parent) : QWidget(parent) +{ + _type=t; + setupUi(this); + + groupBox->setTitle(TopWin::typeName(t)); + update_settings(); +} + + +void MdiSettings::update_settings() +{ + isSubwinCheckbox->setChecked(TopWin::_defaultSubwin[_type]); + shareSubwinCheckbox->setChecked(TopWin::_sharesWhenSubwin[_type]); + shareFreeCheckbox->setChecked(TopWin::_sharesWhenFree[_type]); +} + +void MdiSettings::apply_settings() +{ + TopWin::_defaultSubwin[_type] = isSubwinCheckbox->isChecked(); + TopWin::_sharesWhenSubwin[_type] = shareSubwinCheckbox->isChecked(); + TopWin::_sharesWhenFree[_type] = shareFreeCheckbox->isChecked(); +} diff --git a/muse2/muse/widgets/mdisettings.h b/muse2/muse/widgets/mdisettings.h new file mode 100644 index 00000000..2f1bdf55 --- /dev/null +++ b/muse2/muse/widgets/mdisettings.h @@ -0,0 +1,34 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: genset.h,v 1.3 2004/01/25 09:55:17 wschweer Exp $ +// +// (C) Copyright 2001 Werner Schweer (ws@seh.de) +//========================================================= + +#ifndef __MDISETTINGS_H__ +#define __MDISETTINGS_H__ + +#include +#include "ui_mdisettings_base.h" +#include "cobject.h" + +//--------------------------------------------------------- +// GlobalSettingsConfig +//--------------------------------------------------------- + +class MdiSettings : public QWidget, private Ui::MdiSettingsBase +{ + Q_OBJECT + + private: + TopWin::ToplevelType _type; + + public: + MdiSettings(TopWin::ToplevelType t, QWidget* parent=0); + void update_settings(); + void apply_settings(); + TopWin::ToplevelType type() { return _type; } +}; + +#endif diff --git a/muse2/muse/widgets/mdisettings_base.ui b/muse2/muse/widgets/mdisettings_base.ui new file mode 100644 index 00000000..af32f174 --- /dev/null +++ b/muse2/muse/widgets/mdisettings_base.ui @@ -0,0 +1,60 @@ + + + MdiSettingsBase + + + + 0 + 0 + 338 + 100 + + + + Form + + + + + + + 0 + 0 + + + + GroupBox + + + true + + + + + + MDI subwin + + + + + + + Shares menu when subwin + + + + + + + Shares menu when free + + + + + + + + + + + -- cgit v1.2.3