summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-05-02 14:57:23 +0000
committerFlorian Jung <flo@windfisch.org>2011-05-02 14:57:23 +0000
commitf02261afb2dd2ea116ff5c5efa037022cdff36d1 (patch)
treed93385584a540f27a4429437c9e9b77250d8f976
parente326245ae87c5d259c8e3cedb1e057b1842487c7 (diff)
score windows now have proper window titles
score windows now have a proper initial size, which is also saved fixed a bug when restoring scorewindow's state (name= instead of set_name())
-rw-r--r--muse2/muse/conf.cpp5
-rw-r--r--muse2/muse/midiedit/scoreedit.cpp69
-rw-r--r--muse2/muse/midiedit/scoreedit.h5
3 files changed, 71 insertions, 8 deletions
diff --git a/muse2/muse/conf.cpp b/muse2/muse/conf.cpp
index 514afaa4..c79c3928 100644
--- a/muse2/muse/conf.cpp
+++ b/muse2/muse/conf.cpp
@@ -16,6 +16,7 @@
#include "globals.h"
#include "drumedit.h"
#include "pianoroll.h"
+#include "scoreedit.h"
#include "master/masteredit.h"
///#include "transport.h"
#include "bigtime.h"
@@ -884,6 +885,8 @@ void readConfiguration(Xml& xml, bool readOnlySequencer)
DrumEdit::readConfiguration(xml);
else if (tag == "pianoroll")
PianoRoll::readConfiguration(xml);
+ else if (tag == "scoreedit")
+ ScoreEdit::read_configuration(xml);
else if (tag == "masteredit")
MasterEdit::readConfiguration(xml);
else if (tag == "waveedit")
@@ -1351,6 +1354,7 @@ void MusE::writeGlobalConfiguration(int level, Xml& xml) const
DrumEdit::writeConfiguration(level, xml);
PianoRoll::writeConfiguration(level, xml);
+ ScoreEdit::write_configuration(level, xml);
MasterEdit::writeConfiguration(level, xml);
WaveEdit::writeConfiguration(level, xml);
@@ -1465,6 +1469,7 @@ void MusE::writeConfiguration(int level, Xml& xml) const
DrumEdit::writeConfiguration(level, xml);
PianoRoll::writeConfiguration(level, xml);
+ ScoreEdit::write_configuration(level, xml);
MasterEdit::writeConfiguration(level, xml);
WaveEdit::writeConfiguration(level, xml);
diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp
index cb94c5ff..9f138bcf 100644
--- a/muse2/muse/midiedit/scoreedit.cpp
+++ b/muse2/muse/midiedit/scoreedit.cpp
@@ -139,6 +139,9 @@ QColor* mycolors; // array [NUM_MYCOLORS]
set<QString> ScoreEdit::names;
+int ScoreEdit::width_init = 600;
+int ScoreEdit::height_init = 400;
+
//---------------------------------------------------------
// ScoreEdit
@@ -149,6 +152,8 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos)
{
setAttribute(Qt::WA_DeleteOnClose);
+ resize(width_init, height_init);
+
mainw = new QWidget(this);
mainGrid = new QGridLayout();
@@ -370,6 +375,8 @@ bool ScoreEdit::set_name(QString newname, bool emit_signal, bool emergency_name)
name=newname;
+ setWindowTitle("MusE: Score \""+name+"\"");
+
if (emit_signal)
emit name_changed();
@@ -441,6 +448,14 @@ void ScoreEdit::closeEvent(QCloseEvent* e)
e->accept();
}
+void ScoreEdit::resizeEvent(QResizeEvent* ev)
+{
+ QWidget::resizeEvent(ev);
+
+ width_init=ev->size().width();
+ height_init=ev->size().height();
+}
+
void ScoreEdit::menu_command(int cmd)
{
switch (cmd)
@@ -668,7 +683,7 @@ void ScoreEdit::readStatus(Xml& xml)
{
case Xml::TagStart:
if (tag == "name")
- name = xml.parse1();
+ set_name(xml.parse1());
else if (tag == "tool")
edit_tools->set(xml.parseInt());
else if (tag == "quantPower")
@@ -740,12 +755,53 @@ void ScoreEdit::readStatus(Xml& xml)
case Xml::TagEnd:
if (tag == "scoreedit")
return;
- default:
+
+ default:
break;
}
}
}
+void ScoreEdit::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 == "width")
+ height_init = xml.parseInt();
+ else if (tag == "height")
+ width_init = xml.parseInt();
+ else
+ xml.unknown("ScoreEdit");
+ break;
+
+ case Xml::TagEnd:
+ if (tag == "scoreedit")
+ return;
+
+ default:
+ break;
+ }
+ }
+}
+
+
+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.etag(level, "scoreedit");
+}
+
+
void ScoreCanvas::add_staves(PartList* pl, bool all_in_one)
@@ -3519,7 +3575,7 @@ void ScoreCanvas::goto_tick(int tick, bool force)
void ScoreCanvas::resizeEvent(QResizeEvent* ev)
{
QWidget::resizeEvent(ev);
-
+
emit viewport_width_changed( viewport_width() );
emit viewport_height_changed( viewport_height() );
}
@@ -3771,11 +3827,7 @@ set<Part*> staff_t::parts_at_tick(unsigned tick)
* between, for example, when a cis is tied to a des
*
* CURRENT TODO
- * o save and restore window settings, automatically reopen windows
- * after loading file etc
- * o set window title properly
- * o set initial window size properly
- * o save and restore toolbar-position-settings
+ * x nothing atm
*
* IMPORTANT TODO
* o offer functions like in the pianoroll: quantize etc.
@@ -3794,6 +3846,7 @@ set<Part*> staff_t::parts_at_tick(unsigned tick)
* calc_pos_add_list must be called before calc_item_pos then,
* and calc_item_pos must respect the pos_add_list instead of
* keeping its own pos_add variable (which is only an optimisation)
+ * o save more configuration stuff (quant, color, to_init
*
* really unimportant nice-to-haves
* o clean up code (find TODOs)
diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h
index c0f51cc2..3210253d 100644
--- a/muse2/muse/midiedit/scoreedit.h
+++ b/muse2/muse/midiedit/scoreedit.h
@@ -69,6 +69,7 @@ class ScoreEdit : public TopWin
private:
virtual void closeEvent(QCloseEvent*);
+ virtual void resizeEvent(QResizeEvent*);
void init_name();
@@ -104,6 +105,7 @@ class ScoreEdit : public TopWin
ScoreCanvas* score_canvas;
static set<QString> names;
+ static int width_init, height_init;
QString name;
@@ -127,8 +129,11 @@ class ScoreEdit : public TopWin
public:
ScoreEdit(QWidget* parent = 0, const char* name = 0, unsigned initPos = MAXINT);
~ScoreEdit();
+
void writeStatus(int level, Xml& xml) const;
void readStatus(Xml& xml);
+ static void read_configuration(Xml&);
+ static void write_configuration(int, Xml&);
void add_parts(PartList* pl, bool all_in_one=false);
QString get_name() { return name; }