diff options
Diffstat (limited to 'muse2/muse/midiedit/scoreedit.cpp')
-rw-r--r-- | muse2/muse/midiedit/scoreedit.cpp | 126 |
1 files changed, 57 insertions, 69 deletions
diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp index 4b2db2fc..9e16bb21 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,13 +148,11 @@ 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); - mainw = new QWidget(this); mainGrid = new QGridLayout(); @@ -383,7 +379,31 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) connect(select_oloop_action, SIGNAL(triggered()), menu_mapper, SLOT(map())); - QMenu* settings_menu = menuBar()->addMenu(tr("&Settings")); + QMenu* functions_menu = menuBar()->addMenu(tr("Fu&nctions")); + + func_quantize_action = functions_menu->addAction(tr("&Quantize"), menu_mapper, SLOT(map())); + func_notelen_action = functions_menu->addAction(tr("Change note &length"), menu_mapper, SLOT(map())); + func_velocity_action = functions_menu->addAction(tr("Change note &velocity"), menu_mapper, SLOT(map())); + func_cresc_action = functions_menu->addAction(tr("Crescendo/Decrescendo"), menu_mapper, SLOT(map())); + func_transpose_action = functions_menu->addAction(tr("Transpose"), menu_mapper, SLOT(map())); + func_erase_action = functions_menu->addAction(tr("Erase Events"), menu_mapper, SLOT(map())); + func_move_action = functions_menu->addAction(tr("Move Notes"), menu_mapper, SLOT(map())); + func_fixed_len_action = functions_menu->addAction(tr("Set Fixed Length"), menu_mapper, SLOT(map())); + func_del_overlaps_action = functions_menu->addAction(tr("Delete Overlaps"), menu_mapper, SLOT(map())); + func_legato_action = functions_menu->addAction(tr("Legato"), menu_mapper, SLOT(map())); + menu_mapper->setMapping(func_quantize_action, CMD_QUANTIZE); + menu_mapper->setMapping(func_notelen_action, CMD_NOTELEN); + menu_mapper->setMapping(func_velocity_action, CMD_VELOCITY); + menu_mapper->setMapping(func_cresc_action, CMD_CRESCENDO); + menu_mapper->setMapping(func_transpose_action, CMD_TRANSPOSE); + menu_mapper->setMapping(func_erase_action, CMD_ERASE); + menu_mapper->setMapping(func_move_action, CMD_MOVE); + menu_mapper->setMapping(func_fixed_len_action, CMD_FIXED_LEN); + menu_mapper->setMapping(func_del_overlaps_action, CMD_DELETE_OVERLAPS); + menu_mapper->setMapping(func_legato_action, CMD_LEGATO); + + + QMenu* settings_menu = menuBar()->addMenu(tr("Window &Config")); color_menu = settings_menu->addMenu(tr("Note head &colors")); color_actions = new QActionGroup(this); @@ -402,7 +422,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,31 +437,13 @@ 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); + settings_menu->addAction(fullscreenAction); - QMenu* functions_menu = menuBar()->addMenu(tr("Fu&nctions")); - - func_quantize_action = functions_menu->addAction(tr("&Quantize"), menu_mapper, SLOT(map())); - func_notelen_action = functions_menu->addAction(tr("Change note &length"), menu_mapper, SLOT(map())); - func_velocity_action = functions_menu->addAction(tr("Change note &velocity"), menu_mapper, SLOT(map())); - func_cresc_action = functions_menu->addAction(tr("Crescendo/Decrescendo"), menu_mapper, SLOT(map())); - func_transpose_action = functions_menu->addAction(tr("Transpose"), menu_mapper, SLOT(map())); - func_erase_action = functions_menu->addAction(tr("Erase Events"), menu_mapper, SLOT(map())); - func_move_action = functions_menu->addAction(tr("Move Notes"), menu_mapper, SLOT(map())); - func_fixed_len_action = functions_menu->addAction(tr("Set Fixed Length"), menu_mapper, SLOT(map())); - func_del_overlaps_action = functions_menu->addAction(tr("Delete Overlaps"), menu_mapper, SLOT(map())); - func_legato_action = functions_menu->addAction(tr("Legato"), menu_mapper, SLOT(map())); - menu_mapper->setMapping(func_quantize_action, CMD_QUANTIZE); - menu_mapper->setMapping(func_notelen_action, CMD_NOTELEN); - menu_mapper->setMapping(func_velocity_action, CMD_VELOCITY); - menu_mapper->setMapping(func_cresc_action, CMD_CRESCENDO); - menu_mapper->setMapping(func_transpose_action, CMD_TRANSPOSE); - menu_mapper->setMapping(func_erase_action, CMD_ERASE); - menu_mapper->setMapping(func_move_action, CMD_MOVE); - menu_mapper->setMapping(func_fixed_len_action, CMD_FIXED_LEN); - menu_mapper->setMapping(func_del_overlaps_action, CMD_DELETE_OVERLAPS); - menu_mapper->setMapping(func_legato_action, CMD_LEGATO); - init_shortcuts(); connect(muse, SIGNAL(configChanged()), SLOT(init_shortcuts())); @@ -452,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(); @@ -467,6 +466,9 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos) apply_velo=true; + + initTopwinState(); + initalizing=false; } void ScoreEdit::init_shortcuts() @@ -635,30 +637,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 +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; @@ -1053,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"); } @@ -3931,7 +3907,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; @@ -4461,26 +4437,38 @@ void staff_t::update_part_indices() /* BUGS and potential bugs + * o THIS SHOULD NEVER HAPPEN: could not split note (found by tim) + * o when moving or resizing notes in score edit while list edit is open + * only one movement is possible + * * o tied notes don't work properly when there's a key-change in * between, for example, when a cis is tied to a des * o schedule_all_same_len_parts: if there are two clones A and B, * and both A and B get scheduled to be expanded (because we * have one event from A and one event from B), this causes a bug, * because after A (and B) got resized, the B-resize is invalid! + * o when changing toolbarstate when sharing and immediately after that + * changing "share" status, the changed state isn't stored * * CURRENT TODO + * M o remove that ugly "bool initalizing" stuff. it's probably unneeded (watch out for the FINDMICH message) + * m o shortcuts, especially for fullscreen + * o fix saving muse main win settings in global config dialog + * o strange sizes of toolbars oO? + * o mirror most menus to an additional right-click context menu to avoid the long mouse pointer + * journey to the menu bar. try to find a way which does not involve duplicate code! + * o shortcuts for "pencil" etc don't work when only mdiwin has focus and not the mainwin inside + * o implement borland-style maximize: free windows do not cover the main menu, even when maximized + * + * 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, |