summaryrefslogtreecommitdiff
path: root/muse2/muse
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-05-16 11:34:53 +0000
committerFlorian Jung <flo@windfisch.org>2011-05-16 11:34:53 +0000
commit4e1ca61b03bab50d5e71e6da433503ac3b4470c0 (patch)
tree4c002df0f12f916b8a30a5e115ea8fbd80c15480 /muse2/muse
parentc7d22c133d2d9a5e8494d0285af10da6a6dff9d9 (diff)
fixed saving window state
dialogs now also save and restore their state templates were updated and have now sane defaults for toolbars etc.
Diffstat (limited to 'muse2/muse')
-rw-r--r--muse2/muse/conf.cpp7
-rw-r--r--muse2/muse/functions.cpp67
-rw-r--r--muse2/muse/functions.h7
-rw-r--r--muse2/muse/main.cpp3
-rw-r--r--muse2/muse/master/masteredit.cpp16
-rw-r--r--muse2/muse/master/masteredit.h1
-rw-r--r--muse2/muse/midiedit/drumedit.cpp16
-rw-r--r--muse2/muse/midiedit/drumedit.h5
-rw-r--r--muse2/muse/midiedit/pianoroll.cpp15
-rw-r--r--muse2/muse/midiedit/pianoroll.h1
-rw-r--r--muse2/muse/midiedit/scoreedit.cpp23
-rw-r--r--muse2/muse/midiedit/scoreedit.h2
-rw-r--r--muse2/muse/waveedit/waveedit.cpp15
-rw-r--r--muse2/muse/waveedit/waveedit.h3
-rw-r--r--muse2/muse/widgets/deloverlaps.cpp35
-rw-r--r--muse2/muse/widgets/deloverlaps.h4
-rw-r--r--muse2/muse/widgets/gatetime.cpp43
-rw-r--r--muse2/muse/widgets/gatetime.h5
-rw-r--r--muse2/muse/widgets/move.cpp40
-rw-r--r--muse2/muse/widgets/move.h5
-rw-r--r--muse2/muse/widgets/quantize.cpp51
-rw-r--r--muse2/muse/widgets/quantize.h5
-rw-r--r--muse2/muse/widgets/remove.cpp36
-rw-r--r--muse2/muse/widgets/remove.h5
-rw-r--r--muse2/muse/widgets/setlen.cpp39
-rw-r--r--muse2/muse/widgets/setlen.h5
-rw-r--r--muse2/muse/widgets/transpose.cpp39
-rw-r--r--muse2/muse/widgets/transpose.h5
-rw-r--r--muse2/muse/widgets/velocity.cpp42
-rw-r--r--muse2/muse/widgets/velocity.h5
30 files changed, 518 insertions, 27 deletions
diff --git a/muse2/muse/conf.cpp b/muse2/muse/conf.cpp
index 2f391445..e7eef503 100644
--- a/muse2/muse/conf.cpp
+++ b/muse2/muse/conf.cpp
@@ -14,6 +14,7 @@
#include "transport.h"
#include "icons.h"
#include "globals.h"
+#include "functions.h"
#include "drumedit.h"
#include "pianoroll.h"
#include "scoreedit.h"
@@ -891,6 +892,8 @@ void readConfiguration(Xml& xml, bool readOnlySequencer)
MasterEdit::readConfiguration(xml);
else if (tag == "waveedit")
WaveEdit::readConfiguration(xml);
+ else if (tag == "dialogs")
+ read_function_dialog_config(xml);
else if (tag == "shortcuts")
readShortCuts(xml);
else if (tag == "division")
@@ -1360,6 +1363,8 @@ void MusE::writeGlobalConfiguration(int level, Xml& xml) const
ScoreEdit::write_configuration(level, xml);
MasterEdit::writeConfiguration(level, xml);
WaveEdit::writeConfiguration(level, xml);
+
+ write_function_dialog_config(level, xml);
writeShortCuts(level, xml);
xml.etag(level, "configuration");
@@ -1475,6 +1480,8 @@ void MusE::writeConfiguration(int level, Xml& xml) const
ScoreEdit::write_configuration(level, xml);
MasterEdit::writeConfiguration(level, xml);
WaveEdit::writeConfiguration(level, xml);
+
+ write_function_dialog_config(level, xml);
writeMidiTransforms(level, xml);
writeMidiInputTransforms(level, xml);
diff --git a/muse2/muse/functions.cpp b/muse2/muse/functions.cpp
index 65369b98..e14f32b8 100644
--- a/muse2/muse/functions.cpp
+++ b/muse2/muse/functions.cpp
@@ -436,3 +436,70 @@ void delete_overlaps(const set<Part*>& parts, int range)
if (undo_started) song->endUndo(SC_EVENT_MODIFIED);
}
}
+
+
+
+void read_function_dialog_config(Xml& xml)
+{
+ if (erase_dialog==NULL)
+ {
+ cout << "ERROR: THIS SHOULD NEVER HAPPEN: read_function_dialog_config() called, but\n"
+ " dialogs are still uninitalized (NULL)!"<<endl;
+ return;
+ }
+
+ 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 == "mod_len")
+ gatetime_dialog->read_configuration(xml);
+ else if (tag == "mod_velo")
+ velocity_dialog->read_configuration(xml);
+ else if (tag == "quantize")
+ quantize_dialog->read_configuration(xml);
+ else if (tag == "erase")
+ erase_dialog->read_configuration(xml);
+ else if (tag == "del_overlaps")
+ del_overlaps_dialog->read_configuration(xml);
+ else if (tag == "setlen")
+ set_notelen_dialog->read_configuration(xml);
+ else if (tag == "move")
+ move_notes_dialog->read_configuration(xml);
+ else if (tag == "transpose")
+ transpose_dialog->read_configuration(xml);
+ else
+ xml.unknown("function_dialogs");
+ break;
+
+ case Xml::TagEnd:
+ if (tag == "dialogs")
+ return;
+
+ default:
+ break;
+ }
+ }
+}
+
+void write_function_dialog_config(int level, Xml& xml)
+{
+ xml.tag(level++, "dialogs");
+
+ gatetime_dialog->write_configuration(level, xml);
+ velocity_dialog->write_configuration(level, xml);
+ quantize_dialog->write_configuration(level, xml);
+ erase_dialog->write_configuration(level, xml);
+ del_overlaps_dialog->write_configuration(level, xml);
+ set_notelen_dialog->write_configuration(level, xml);
+ move_notes_dialog->write_configuration(level, xml);
+ transpose_dialog->write_configuration(level, xml);
+
+ xml.tag(level, "/dialogs");
+}
diff --git a/muse2/muse/functions.h b/muse2/muse/functions.h
index afd5b559..14797a15 100644
--- a/muse2/muse/functions.h
+++ b/muse2/muse/functions.h
@@ -57,4 +57,11 @@ bool transpose_notes(const std::set<Part*>& parts);
bool erase_notes(const std::set<Part*>& parts);
bool delete_overlaps(const std::set<Part*>& parts);
+
+
+//functions for reading and writing default values
+class Xml;
+void read_function_dialog_config(Xml& xml);
+void write_function_dialog_config(int level, Xml& xml);
+
#endif
diff --git a/muse2/muse/main.cpp b/muse2/muse/main.cpp
index 6481f4cb..192c0bd3 100644
--- a/muse2/muse/main.cpp
+++ b/muse2/muse/main.cpp
@@ -254,6 +254,7 @@ int main(int argc, char* argv[])
QApplication::setColorSpec(QApplication::ManyColor);
MuseApplication app(argc, argv);
+ init_function_dialogs(muse);
initShortCuts();
readConfiguration();
@@ -471,8 +472,6 @@ int main(int argc, char* argv[])
muse = new MusE(argc, &argv[optind]);
app.setMuse(muse);
muse->setWindowIcon(*museIcon);
-
- init_function_dialogs(muse);
// Added by Tim. p3.3.22
diff --git a/muse2/muse/master/masteredit.cpp b/muse2/muse/master/masteredit.cpp
index fd7000dd..9053f3a8 100644
--- a/muse2/muse/master/masteredit.cpp
+++ b/muse2/muse/master/masteredit.cpp
@@ -427,11 +427,9 @@ void MasterEdit::setTempo(int val)
void MasterEdit::resizeEvent(QResizeEvent* ev)
{
QWidget::resizeEvent(ev);
- _widthInit = ev->size().width();
- _heightInit = ev->size().height();
+ storeInitialState();
}
-
//---------------------------------------------------------
// focusOutEvent
//---------------------------------------------------------
@@ -439,5 +437,17 @@ void MasterEdit::resizeEvent(QResizeEvent* ev)
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 5abcfc8d..59a5ab05 100644
--- a/muse2/muse/master/masteredit.h
+++ b/muse2/muse/master/masteredit.h
@@ -66,6 +66,7 @@ class MasterEdit : public MidiEditor {
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 b762d776..b5ff9447 100644
--- a/muse2/muse/midiedit/drumedit.cpp
+++ b/muse2/muse/midiedit/drumedit.cpp
@@ -1023,9 +1023,7 @@ void DrumEdit::newCanvasWidth(int w)
void DrumEdit::resizeEvent(QResizeEvent* ev)
{
QWidget::resizeEvent(ev);
- _widthInit = ev->size().width();
- _heightInit = ev->size().height();
-
+ storeInitialState();
//TODO: Make the dlist not expand/shrink, but the canvas instead
}
@@ -1036,9 +1034,21 @@ void DrumEdit::resizeEvent(QResizeEvent* ev)
void DrumEdit::focusOutEvent(QFocusEvent* ev)
{
QWidget::focusOutEvent(ev);
+ storeInitialState();
+ }
+
+//---------------------------------------------------------
+// storeInitialState
+//---------------------------------------------------------
+
+void DrumEdit::storeInitialState()
+ {
+ _widthInit = width();
+ _heightInit = height();
_toolbarInit=saveState();
}
+
//---------------------------------------------------------
// configChanged
//---------------------------------------------------------
diff --git a/muse2/muse/midiedit/drumedit.h b/muse2/muse/midiedit/drumedit.h
index ab6c6cb3..242ec963 100644
--- a/muse2/muse/midiedit/drumedit.h
+++ b/muse2/muse/midiedit/drumedit.h
@@ -84,9 +84,12 @@ class DrumEdit : public MidiEditor {
virtual void closeEvent(QCloseEvent*);
QWidget* genToolbar(QWidget* parent);
+ virtual void keyPressEvent(QKeyEvent*);
+
virtual void resizeEvent(QResizeEvent*);
virtual void focusOutEvent(QFocusEvent*);
- virtual void keyPressEvent(QKeyEvent*);
+ void storeInitialState();
+
void setHeaderToolTips();
void setHeaderWhatsThis();
diff --git a/muse2/muse/midiedit/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp
index 02fe7f5d..2a2bad5b 100644
--- a/muse2/muse/midiedit/pianoroll.cpp
+++ b/muse2/muse/midiedit/pianoroll.cpp
@@ -1191,8 +1191,7 @@ void PianoRoll::setSpeaker(bool val)
void PianoRoll::resizeEvent(QResizeEvent* ev)
{
QWidget::resizeEvent(ev);
- _widthInit = ev->size().width();
- _heightInit = ev->size().height();
+ storeInitialState();
}
@@ -1203,6 +1202,18 @@ void PianoRoll::resizeEvent(QResizeEvent* ev)
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 6090e34f..e157db10 100644
--- a/muse2/muse/midiedit/pianoroll.h
+++ b/muse2/muse/midiedit/pianoroll.h
@@ -132,6 +132,7 @@ class PianoRoll : public MidiEditor {
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 31203396..0b4111cd 100644
--- a/muse2/muse/midiedit/scoreedit.cpp
+++ b/muse2/muse/midiedit/scoreedit.cpp
@@ -358,12 +358,6 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos)
init_name();
}
-void ScoreEdit::focusOutEvent(QFocusEvent* ev)
-{
- default_toolbar_state=saveState();
- QMainWindow::focusOutEvent(ev);
-}
-
void ScoreEdit::add_parts(PartList* pl, bool all_in_one)
{
score_canvas->add_staves(pl, all_in_one);
@@ -470,8 +464,21 @@ void ScoreEdit::resizeEvent(QResizeEvent* ev)
{
QWidget::resizeEvent(ev);
- width_init=ev->size().width();
- height_init=ev->size().height();
+ 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)
diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h
index cfe6f34e..91d399e6 100644
--- a/muse2/muse/midiedit/scoreedit.h
+++ b/muse2/muse/midiedit/scoreedit.h
@@ -75,6 +75,8 @@ class ScoreEdit : public TopWin
virtual void resizeEvent(QResizeEvent*);
virtual void focusOutEvent(QFocusEvent*);
+ void store_initial_state();
+
void init_name();
QGridLayout* mainGrid;
diff --git a/muse2/muse/waveedit/waveedit.cpp b/muse2/muse/waveedit/waveedit.cpp
index f2d936f4..99dfd5f1 100644
--- a/muse2/muse/waveedit/waveedit.cpp
+++ b/muse2/muse/waveedit/waveedit.cpp
@@ -443,8 +443,7 @@ void WaveEdit::readStatus(Xml& xml)
void WaveEdit::resizeEvent(QResizeEvent* ev)
{
QWidget::resizeEvent(ev);
- _widthInit = ev->size().width();
- _heightInit = ev->size().height();
+ storeInitialState();
}
//---------------------------------------------------------
@@ -454,6 +453,18 @@ void WaveEdit::resizeEvent(QResizeEvent* ev)
void WaveEdit::focusOutEvent(QFocusEvent* ev)
{
QWidget::focusOutEvent(ev);
+ storeInitialState();
+ }
+
+
+//---------------------------------------------------------
+// storeInitialState
+//---------------------------------------------------------
+
+void WaveEdit::storeInitialState()
+ {
+ _widthInit = width();
+ _heightInit = height();
_toolbarInit=saveState();
}
diff --git a/muse2/muse/waveedit/waveedit.h b/muse2/muse/waveedit/waveedit.h
index 921b314c..5c06d37f 100644
--- a/muse2/muse/waveedit/waveedit.h
+++ b/muse2/muse/waveedit/waveedit.h
@@ -51,9 +51,10 @@ class WaveEdit : public MidiEditor {
Q_OBJECT
virtual void closeEvent(QCloseEvent*);
- virtual void resizeEvent(QResizeEvent* ev);
virtual void keyPressEvent(QKeyEvent*);
+ virtual void resizeEvent(QResizeEvent* ev);
virtual void focusOutEvent(QFocusEvent*);
+ void storeInitialState();
QMenu* menuFunctions, *select, *menuGain;
diff --git a/muse2/muse/widgets/deloverlaps.cpp b/muse2/muse/widgets/deloverlaps.cpp
index ed4fab83..76103d74 100644
--- a/muse2/muse/widgets/deloverlaps.cpp
+++ b/muse2/muse/widgets/deloverlaps.cpp
@@ -7,6 +7,7 @@
#include <QButtonGroup>
#include "deloverlaps.h"
+#include "xml.h"
DelOverlaps::DelOverlaps(QWidget* parent)
@@ -42,3 +43,37 @@ int DelOverlaps::exec()
return QDialog::exec();
}
+void DelOverlaps::read_configuration(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 == "range")
+ range=xml.parseInt();
+ else
+ xml.unknown("DelOverlaps");
+ break;
+
+ case Xml::TagEnd:
+ if (tag == "del_overlaps")
+ return;
+
+ default:
+ break;
+ }
+ }
+}
+
+void DelOverlaps::write_configuration(int level, Xml& xml)
+{
+ xml.tag(level++, "del_overlaps");
+ xml.intTag(level, "range", range);
+ xml.tag(level, "/del_overlaps");
+}
diff --git a/muse2/muse/widgets/deloverlaps.h b/muse2/muse/widgets/deloverlaps.h
index cb0cebe6..813192a6 100644
--- a/muse2/muse/widgets/deloverlaps.h
+++ b/muse2/muse/widgets/deloverlaps.h
@@ -11,6 +11,7 @@
#include "ui_deloverlapsbase.h"
class QButtonGroup;
+class Xml;
class DelOverlaps : public QDialog, public Ui::DelOverlapsBase
{
@@ -27,6 +28,9 @@ class DelOverlaps : public QDialog, public Ui::DelOverlapsBase
int range;
+ void read_configuration(Xml& xml);
+ void write_configuration(int level, Xml& xml);
+
public slots:
int exec();
};
diff --git a/muse2/muse/widgets/gatetime.cpp b/muse2/muse/widgets/gatetime.cpp
index c64411a0..9448ab1c 100644
--- a/muse2/muse/widgets/gatetime.cpp
+++ b/muse2/muse/widgets/gatetime.cpp
@@ -10,6 +10,7 @@
#include "gatetime.h"
+#include "xml.h"
#include "song.h"
//---------------------------------------------------------
@@ -63,3 +64,45 @@ int GateTime::exec()
return QDialog::exec();
}
+
+
+void GateTime::read_configuration(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 == "range")
+ range=xml.parseInt();
+ else if (tag == "rate")
+ rateVal=xml.parseInt();
+ else if (tag == "offset")
+ offsetVal=xml.parseInt();
+ else
+ xml.unknown("ModLen");
+ break;
+
+ case Xml::TagEnd:
+ if (tag == "mod_len")
+ return;
+
+ default:
+ break;
+ }
+ }
+}
+
+void GateTime::write_configuration(int level, Xml& xml)
+{
+ xml.tag(level++, "mod_len");
+ xml.intTag(level, "range", range);
+ xml.intTag(level, "offset", offsetVal);
+ xml.intTag(level, "rate", rateVal);
+ xml.tag(level, "/mod_len");
+}
diff --git a/muse2/muse/widgets/gatetime.h b/muse2/muse/widgets/gatetime.h
index 5585d6ad..d2555872 100644
--- a/muse2/muse/widgets/gatetime.h
+++ b/muse2/muse/widgets/gatetime.h
@@ -12,6 +12,7 @@
class QButtonGroup;
class QDialog;
+class Xml;
//---------------------------------------------------------
// GateTime
@@ -34,6 +35,10 @@ class GateTime : public QDialog, public Ui::GateTimeBase {
int rateVal;
int offsetVal;
+ void read_configuration(Xml& xml);
+ void write_configuration(int level, Xml& xml);
+
+
public slots:
int exec();
};
diff --git a/muse2/muse/widgets/move.cpp b/muse2/muse/widgets/move.cpp
index 116325c3..2ce6cb05 100644
--- a/muse2/muse/widgets/move.cpp
+++ b/muse2/muse/widgets/move.cpp
@@ -7,7 +7,7 @@
#include <QButtonGroup>
#include "move.h"
-
+#include "xml.h"
Move::Move(QWidget* parent)
: QDialog(parent)
@@ -44,3 +44,41 @@ int Move::exec()
return QDialog::exec();
}
+
+void Move::read_configuration(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 == "range")
+ range=xml.parseInt();
+ else if (tag == "amount")
+ amount=xml.parseInt();
+ else
+ xml.unknown("Move");
+ break;
+
+ case Xml::TagEnd:
+ if (tag == "move")
+ return;
+
+ default:
+ break;
+ }
+ }
+}
+
+void Move::write_configuration(int level, Xml& xml)
+{
+ xml.tag(level++, "move");
+ xml.intTag(level, "range", range);
+ xml.intTag(level, "amount", amount);
+ xml.tag(level, "/move");
+}
diff --git a/muse2/muse/widgets/move.h b/muse2/muse/widgets/move.h
index a69a72c5..4c90a922 100644
--- a/muse2/muse/widgets/move.h
+++ b/muse2/muse/widgets/move.h
@@ -11,6 +11,7 @@
#include "ui_movebase.h"
class QButtonGroup;
+class Xml;
class Move : public QDialog, public Ui::MoveBase
{
@@ -28,6 +29,10 @@ class Move : public QDialog, public Ui::MoveBase
int range;
int amount;
+ void read_configuration(Xml& xml);
+ void write_configuration(int level, Xml& xml);
+
+
public slots:
int exec();
};
diff --git a/muse2/muse/widgets/quantize.cpp b/muse2/muse/widgets/quantize.cpp
index 734f3d5d..111087c2 100644
--- a/muse2/muse/widgets/quantize.cpp
+++ b/muse2/muse/widgets/quantize.cpp
@@ -7,7 +7,7 @@
#include <QButtonGroup>
#include "quantize.h"
-
+#include "xml.h"
Quantize::Quantize(QWidget* parent)
: QDialog(parent)
@@ -52,3 +52,52 @@ int Quantize::exec()
return QDialog::exec();
}
+void Quantize::read_configuration(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 == "range")
+ range=xml.parseInt();
+ else if (tag == "strength")
+ strength=xml.parseInt();
+ else if (tag == "threshold")
+ threshold=xml.parseInt();
+ else if (tag == "raster")
+ raster_power2=xml.parseInt();
+ else if (tag == "swing")
+ swing=xml.parseInt();
+ else if (tag == "quant_len")
+ quant_len=xml.parseInt();
+ else
+ xml.unknown("Quantize");
+ break;
+
+ case Xml::TagEnd:
+ if (tag == "quantize")
+ return;
+
+ default:
+ break;
+ }
+ }
+}
+
+void Quantize::write_configuration(int level, Xml& xml)
+{
+ xml.tag(level++, "quantize");
+ xml.intTag(level, "range", range);
+ xml.intTag(level, "strength", strength);
+ xml.intTag(level, "threshold", threshold);
+ xml.intTag(level, "raster", raster_power2);
+ xml.intTag(level, "swing", swing);
+ xml.intTag(level, "quant_len", quant_len);
+ xml.tag(level, "/quantize");
+}
diff --git a/muse2/muse/widgets/quantize.h b/muse2/muse/widgets/quantize.h
index 3f54bc09..399e2545 100644
--- a/muse2/muse/widgets/quantize.h
+++ b/muse2/muse/widgets/quantize.h
@@ -11,6 +11,7 @@
#include "ui_quantbase.h"
class QButtonGroup;
+class Xml;
class Quantize : public QDialog, public Ui::QuantBase
{
@@ -32,6 +33,10 @@ class Quantize : public QDialog, public Ui::QuantBase
int swing;
bool quant_len;
+ void read_configuration(Xml& xml);
+ void write_configuration(int level, Xml& xml);
+
+
public slots:
int exec();
};
diff --git a/muse2/muse/widgets/remove.cpp b/muse2/muse/widgets/remove.cpp
index cb75aa21..5ad272ab 100644
--- a/muse2/muse/widgets/remove.cpp
+++ b/muse2/muse/widgets/remove.cpp
@@ -7,7 +7,7 @@
#include <QButtonGroup>
#include "remove.h"
-
+#include "xml.h"
Remove::Remove(QWidget* parent)
: QDialog(parent)
@@ -42,3 +42,37 @@ int Remove::exec()
return QDialog::exec();
}
+void Remove::read_configuration(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 == "range")
+ range=xml.parseInt();
+ else
+ xml.unknown("Erase");
+ break;
+
+ case Xml::TagEnd:
+ if (tag == "erase")
+ return;
+
+ default:
+ break;
+ }
+ }
+}
+
+void Remove::write_configuration(int level, Xml& xml)
+{
+ xml.tag(level++, "erase");
+ xml.intTag(level, "range", range);
+ xml.tag(level, "/erase");
+}
diff --git a/muse2/muse/widgets/remove.h b/muse2/muse/widgets/remove.h
index 7b749142..5615ed42 100644
--- a/muse2/muse/widgets/remove.h
+++ b/muse2/muse/widgets/remove.h
@@ -11,6 +11,7 @@
#include "ui_removebase.h"
class QButtonGroup;
+class Xml;
class Remove : public QDialog, public Ui::RemoveBase
{
@@ -27,6 +28,10 @@ class Remove : public QDialog, public Ui::RemoveBase
int range;
+ void read_configuration(Xml& xml);
+ void write_configuration(int level, Xml& xml);
+
+
public slots:
int exec();
};
diff --git a/muse2/muse/widgets/setlen.cpp b/muse2/muse/widgets/setlen.cpp
index a1de875a..024cdd35 100644
--- a/muse2/muse/widgets/setlen.cpp
+++ b/muse2/muse/widgets/setlen.cpp
@@ -7,7 +7,7 @@
#include <QButtonGroup>
#include "setlen.h"
-
+#include "xml.h"
Setlen::Setlen(QWidget* parent)
: QDialog(parent)
@@ -44,3 +44,40 @@ int Setlen::exec()
return QDialog::exec();
}
+void Setlen::read_configuration(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 == "range")
+ range=xml.parseInt();
+ else if (tag == "len")
+ len=xml.parseInt();
+ else
+ xml.unknown("SetLen");
+ break;
+
+ case Xml::TagEnd:
+ if (tag == "setlen")
+ return;
+
+ default:
+ break;
+ }
+ }
+}
+
+void Setlen::write_configuration(int level, Xml& xml)
+{
+ xml.tag(level++, "setlen");
+ xml.intTag(level, "range", range);
+ xml.intTag(level, "len", len);
+ xml.tag(level, "/setlen");
+}
diff --git a/muse2/muse/widgets/setlen.h b/muse2/muse/widgets/setlen.h
index 7dc54eb6..ad66a38b 100644
--- a/muse2/muse/widgets/setlen.h
+++ b/muse2/muse/widgets/setlen.h
@@ -11,6 +11,7 @@
#include "ui_setlenbase.h"
class QButtonGroup;
+class Xml;
class Setlen : public QDialog, public Ui::SetlenBase
{
@@ -28,6 +29,10 @@ class Setlen : public QDialog, public Ui::SetlenBase
int range;
int len;
+ void read_configuration(Xml& xml);
+ void write_configuration(int level, Xml& xml);
+
+
public slots:
int exec();
};
diff --git a/muse2/muse/widgets/transpose.cpp b/muse2/muse/widgets/transpose.cpp
index 66411829..b10c1249 100644
--- a/muse2/muse/widgets/transpose.cpp
+++ b/muse2/muse/widgets/transpose.cpp
@@ -7,7 +7,7 @@
#include <QButtonGroup>
#include "transpose.h"
-
+#include "xml.h"
Transpose::Transpose(QWidget* parent)
: QDialog(parent)
@@ -44,3 +44,40 @@ int Transpose::exec()
return QDialog::exec();
}
+void Transpose::read_configuration(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 == "range")
+ range=xml.parseInt();
+ else if (tag == "amount")
+ amount=xml.parseInt();
+ else
+ xml.unknown("Transpose");
+ break;
+
+ case Xml::TagEnd:
+ if (tag == "transpose")
+ return;
+
+ default:
+ break;
+ }
+ }
+}
+
+void Transpose::write_configuration(int level, Xml& xml)
+{
+ xml.tag(level++, "transpose");
+ xml.intTag(level, "range", range);
+ xml.intTag(level, "amount", amount);
+ xml.tag(level, "/transpose");
+}
diff --git a/muse2/muse/widgets/transpose.h b/muse2/muse/widgets/transpose.h
index 1ade8766..97dd443e 100644
--- a/muse2/muse/widgets/transpose.h
+++ b/muse2/muse/widgets/transpose.h
@@ -11,6 +11,7 @@
#include "ui_transposebase.h"
class QButtonGroup;
+class Xml;
class Transpose : public QDialog, public Ui::TransposeBase
{
@@ -28,6 +29,10 @@ class Transpose : public QDialog, public Ui::TransposeBase
int range;
int amount;
+ void read_configuration(Xml& xml);
+ void write_configuration(int level, Xml& xml);
+
+
public slots:
int exec();
};
diff --git a/muse2/muse/widgets/velocity.cpp b/muse2/muse/widgets/velocity.cpp
index ad9bbfe4..ec625489 100644
--- a/muse2/muse/widgets/velocity.cpp
+++ b/muse2/muse/widgets/velocity.cpp
@@ -7,6 +7,7 @@
#include <QButtonGroup>
#include "velocity.h"
+#include "xml.h"
//---------------------------------------------------------
// Velocity
@@ -58,3 +59,44 @@ int Velocity::exec()
return QDialog::exec();
}
+
+void Velocity::read_configuration(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 == "range")
+ range=xml.parseInt();
+ else if (tag == "rate")
+ rateVal=xml.parseInt();
+ else if (tag == "offset")
+ offsetVal=xml.parseInt();
+ else
+ xml.unknown("ModVelo");
+ break;
+
+ case Xml::TagEnd:
+ if (tag == "mod_velo")
+ return;
+
+ default:
+ break;
+ }
+ }
+}
+
+void Velocity::write_configuration(int level, Xml& xml)
+{
+ xml.tag(level++, "mod_velo");
+ xml.intTag(level, "range", range);
+ xml.intTag(level, "offset", offsetVal);
+ xml.intTag(level, "rate", rateVal);
+ xml.tag(level, "/mod_velo");
+}
diff --git a/muse2/muse/widgets/velocity.h b/muse2/muse/widgets/velocity.h
index 448b3e5b..cbea4e22 100644
--- a/muse2/muse/widgets/velocity.h
+++ b/muse2/muse/widgets/velocity.h
@@ -11,6 +11,7 @@
#include "ui_velocitybase.h"
class QButtonGroup;
+class Xml;
//---------------------------------------------------------
// Velocity
@@ -32,6 +33,10 @@ class Velocity : public QDialog, public Ui::VelocityBase {
int rateVal;
int offsetVal;
+ void read_configuration(Xml& xml);
+ void write_configuration(int level, Xml& xml);
+
+
public slots:
int exec();
};