diff options
Diffstat (limited to 'muse2/muse/midiedit/scoreedit.cpp')
-rw-r--r-- | muse2/muse/midiedit/scoreedit.cpp | 68 |
1 files changed, 24 insertions, 44 deletions
diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index 4b2db2fc..157a6845 100644 --- a/muse2/muse/midiedit/scoreedit.cpp +++ b/muse2/muse/midiedit/scoreedit.cpp @@ -30,6 +30,7 @@ #include <QImage> #include <QInputDialog> #include <QMessageBox> +#include <QSpinBox> #include <stdio.h> #include <math.h> @@ -140,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; //--------------------------------------------------------- @@ -150,12 +148,12 @@ QByteArray ScoreEdit::default_toolbar_state; //--------------------------------------------------------- ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) - : TopWin(parent, name) + : TopWin(TopWin::SCORE, parent, name) { setAttribute(Qt::WA_DeleteOnClose); setFocusPolicy(Qt::StrongFocus); - resize(width_init, height_init); + resize(_widthInit[_type], _heightInit[_type]); mainw = new QWidget(this); @@ -402,7 +400,7 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) color_black_action->setChecked(true); menu_command(CMD_COLOR_BLACK); - + QMenu* preamble_menu = settings_menu->addMenu(tr("Set up &preamble")); preamble_keysig_action = preamble_menu->addAction(tr("Display &key signature")); preamble_timesig_action = preamble_menu->addAction(tr("Display &time signature")); @@ -417,6 +415,11 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) QAction* set_name_action = settings_menu->addAction(tr("Set Score &name"), menu_mapper, SLOT(map())); menu_mapper->setMapping(set_name_action, CMD_SET_NAME); + + settings_menu->addSeparator(); + settings_menu->addAction(subwinAction); + settings_menu->addAction(shareAction); + QMenu* functions_menu = menuBar()->addMenu(tr("Fu&nctions")); @@ -452,9 +455,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(); @@ -467,6 +467,9 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) apply_velo=true; + + initTopwinState(); + initalizing=false; } void ScoreEdit::init_shortcuts() @@ -635,30 +638,10 @@ void ScoreEdit::closeEvent(QCloseEvent* e) //settings.setValue("ScoreEdit/geometry", saveGeometry()); settings.setValue("ScoreEdit/windowState", saveState()); - emit deleted((unsigned long)this); + emit deleted(static_cast<TopWin*>(this)); 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) { @@ -1029,12 +1012,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; @@ -1053,9 +1032,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"); } @@ -3931,7 +3908,7 @@ void ScoreCanvas::mouseMoveEvent (QMouseEvent* event) unsigned newpartlen=dragged_event_part->lenTick(); if (tmp.endTick() > dragged_event_part->lenTick()) { - if (dragged_event_part->hasHiddenEvents()) // do not allow autoexpand + if (dragged_event_part->hasHiddenEvents()) // do not allow autoexpand { tmp.setLenTick(dragged_event_part->lenTick() - tmp.tick()); if (debugMsg) cout << "resized note would exceed its part; limiting length to " << tmp.lenTick() << endl; @@ -4469,18 +4446,21 @@ void staff_t::update_part_indices() * because after A (and B) got resized, the B-resize is invalid! * * CURRENT TODO + * o remove that ugly "bool initalizing" stuff. it's probably unneeded (watch out for the FINDMICH message) + * o store window state: does this really work? arranger seems to be buggy. maybe also marker etc? + * o always store marker, arranger etc state, not only when window shown! + * o setup for "share","don't share" etc. + * o arranger: shortcuts for "pencil" etc don't work + * + * IMPORTANT TODO * o redo transport menu: offer "one beat" and "one bar" steps * maybe also offer scrollbar * o quick "set left/right marker", "select between markers" * or even "set marker and select between immediately" * o support partially selected parts. when moving, automatically split * - * o speed up structural operations * o maybe remove "insert empty measure"? - * o structural OPs: don't erase note which begins at "end of cut" * o add "move other notes" or "overwrite notes" or "mix with notes" to paste - * - * IMPORTANT TODO * o draw the edge of parts hiding notes "jagged" (hasHiddenEvents() is interesting for this) - Done. Tim. * o shrink a part from its beginning as well! watch out for clones! * o insert empty measure should also work inside parts, that is, |