diff options
author | Florian Jung <flo@windfisch.org> | 2011-05-23 20:04:52 +0000 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2011-05-23 20:04:52 +0000 |
commit | 5e04b219a6de8e41f132fcaec26876ecdb5ae9b5 (patch) | |
tree | 0380e5724d80c6ac91bd448868525d372de60e2b /muse2/muse/widgets | |
parent | b5bdb59699abd38a3aa90dfb4d9882b2be7f5be0 (diff) | |
parent | a16b4e2746309724086f55d7df8b15da40939b20 (diff) |
merged with deeper_changes. see changelog
Diffstat (limited to 'muse2/muse/widgets')
42 files changed, 3645 insertions, 346 deletions
diff --git a/muse2/muse/widgets/CMakeLists.txt b/muse2/muse/widgets/CMakeLists.txt index 9a3f993a..7589ddf0 100644 --- a/muse2/muse/widgets/CMakeLists.txt +++ b/muse2/muse/widgets/CMakeLists.txt @@ -18,6 +18,12 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #============================================================================= +set (SubDirs + function_dialogs + ) + +subdirs (${SubDirs}) + ## ## Expand Qt macros in source files ## @@ -35,7 +41,6 @@ QT4_WRAP_CPP (widget_mocs didyouknow.h doublelabel.h filedialog.h - gatetime.h genset.h header.h hitscale.h @@ -48,6 +53,7 @@ QT4_WRAP_CPP (widget_mocs mixdowndialog.h mlabel.h mtscale.h + mtscale_flo.h mtrackinfo.h nentry.h noteinfo.h @@ -76,7 +82,6 @@ QT4_WRAP_CPP (widget_mocs # ttoolbar.h ttoolbutton.h unusedwavefiles.h - velocity.h verticalmeter.h view.h vscale.h @@ -96,7 +101,6 @@ file (GLOB widgets_ui_files editnotedialogbase.ui editsysexdialogbase.ui fdialogbuttons.ui - gatetimebase.ui gensetbase.ui itransformbase.ui metronomebase.ui @@ -110,9 +114,7 @@ file (GLOB widgets_ui_files songinfo.ui synthconfigbase.ui transformbase.ui - transposebase.ui unusedwavefiles.ui - velocitybase.ui ) QT4_WRAP_UI (widget_ui_headers ${widgets_ui_files}) @@ -134,7 +136,6 @@ file (GLOB widgets_source_files doublelabel.cpp drange.cpp filedialog.cpp - gatetime.cpp genset.cpp header.cpp hitscale.cpp @@ -149,6 +150,7 @@ file (GLOB widgets_source_files mmath.cpp mtrackinfo.cpp mtscale.cpp + mtscale_flo.cpp nentry.cpp noteinfo.cpp pitchedit.cpp diff --git a/muse2/muse/widgets/appearancebase.ui b/muse2/muse/widgets/appearancebase.ui index 8cb8c08c..a3a80a96 100644 --- a/muse2/muse/widgets/appearancebase.ui +++ b/muse2/muse/widgets/appearancebase.ui @@ -6,7 +6,7 @@ <rect> <x>0</x> <y>0</y> - <width>538</width> + <width>558</width> <height>531</height> </rect> </property> @@ -69,6 +69,39 @@ </property> </widget> </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Maximum</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>30</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QCheckBox" name="partCakeStretch"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>y-stretch</string> + </property> + <property name="checked"> + <bool>false</bool> + </property> + </widget> + </item> + </layout> + </item> </layout> </widget> </item> @@ -156,6 +189,9 @@ <attribute name="headerVisible"> <bool>false</bool> </attribute> + <attribute name="headerVisible"> + <bool>false</bool> + </attribute> <column> <property name="text"> <string notr="true">1</string> @@ -1936,5 +1972,21 @@ </hint> </hints> </connection> + <connection> + <sender>partShowCakes</sender> + <signal>toggled(bool)</signal> + <receiver>partCakeStretch</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>141</x> + <y>137</y> + </hint> + <hint type="destinationlabel"> + <x>159</x> + <y>164</y> + </hint> + </hints> + </connection> </connections> </ui> diff --git a/muse2/muse/widgets/canvas.cpp b/muse2/muse/widgets/canvas.cpp index 07ad1d1f..18de985b 100644 --- a/muse2/muse/widgets/canvas.cpp +++ b/muse2/muse/widgets/canvas.cpp @@ -574,11 +574,11 @@ void Canvas::viewMousePressEvent(QMouseEvent* event) updateSelection(); redraw(); } - startDrag(curItem, shift); + startDrag(curItem, ctrl); } else if (event->button() == Qt::RightButton) { if (curItem) { - if (shift) { + if (ctrl) { drag = DRAG_RESIZE; setCursor(); int dx = start.x() - curItem->x(); @@ -622,15 +622,14 @@ void Canvas::viewMousePressEvent(QMouseEvent* event) // Changed by T356. Alt is default reserved for moving the whole window in KDE. Changed to Shift-Alt. // Hmm, nope, shift-alt is also reserved sometimes. Must find a way to bypass, // why make user turn off setting? Left alone for now... - if (shift && !ctrl) + if (ctrl && !shift) drag = DRAG_COPY_START; else if (alt) { drag = DRAG_CLONE_START; } - else if (ctrl) { //Select all on the same pitch (e.g. same y-value) - if (!shift) + else if (shift) { //Select all on the same pitch (e.g. same y-value) + if (!ctrl) deselectAll(); - //printf("Yes, ctrl and press\n"); for (iCItem i = items.begin(); i != items.end(); ++i) { if (i->second->y() == curItem->y() ) selectItem(i->second, true); @@ -1082,32 +1081,26 @@ void Canvas::viewMouseMoveEvent(QMouseEvent* event) void Canvas::viewMouseReleaseEvent(QMouseEvent* event) { -// printf("release %x %x\n", event->state(), event->button()); - doScroll = false; canScrollLeft = true; canScrollRight = true; canScrollUp = true; canScrollDown = true; - ///if (event->state() & (Qt::LeftButton|Qt::RightButton|Qt::MidButton) & ~(event->button())) { if (event->buttons() & (Qt::LeftButton|Qt::RightButton|Qt::MidButton) & ~(event->button())) { - ///printf("ignore %x %x\n", keyState, event->button()); - //printf("viewMouseReleaseEvent ignore buttons:%x mods:%x button:%x\n", (int)event->buttons(), (int)keyState, event->button()); return; } QPoint pos = event->pos(); - ///bool shift = event->state() & Qt::ShiftModifier; - bool shift = ((QInputEvent*)event)->modifiers() & Qt::ShiftModifier; + bool ctrl = ((QInputEvent*)event)->modifiers() & Qt::ControlModifier; bool redrawFlag = false; switch (drag) { case DRAG_MOVE_START: case DRAG_COPY_START: case DRAG_CLONE_START: - if (!shift) + if (!ctrl) deselectAll(); - selectItem(curItem, !(shift && curItem->isSelected())); + selectItem(curItem, !(ctrl && curItem->isSelected())); updateSelection(); redrawFlag = true; itemReleased(curItem, curItem->pos()); @@ -1150,17 +1143,17 @@ void Canvas::viewMouseReleaseEvent(QMouseEvent* event) break; case DRAG_LASSO_START: lasso.setRect(-1, -1, -1, -1); - if (!shift) + if (!ctrl) deselectAll(); updateSelection(); redrawFlag = true; break; case DRAG_LASSO: - if (!shift) + if (!ctrl) deselectAll(); lasso = lasso.normalized(); - selectLasso(shift); + selectLasso(ctrl); updateSelection(); redrawFlag = true; break; diff --git a/muse2/muse/widgets/function_dialogs/CMakeLists.txt b/muse2/muse/widgets/function_dialogs/CMakeLists.txt new file mode 100644 index 00000000..db1f3229 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/CMakeLists.txt @@ -0,0 +1,114 @@ +#============================================================================= +# MusE +# Linux Music Editor +# $Id:$ +# +# Copyright (C) 2002-2006 by Werner Schweer and others +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#============================================================================= + +## +## Expand Qt macros in source files +## +QT4_WRAP_CPP (widgets_functiondialogs_mocs + crescendo.h + deloverlaps.h + gatetime.h + move.h + quantize.h + remove.h + setlen.h + transpose.h + legato.h + velocity.h + ) + +## +## UI files +## +file (GLOB widgets_functiondialogs_ui_files + crescendobase.ui + deloverlapsbase.ui + gatetimebase.ui + movebase.ui + quantbase.ui + removebase.ui + setlenbase.ui + transposebase.ui + legatobase.ui + velocitybase.ui + ) + +QT4_WRAP_UI (widgets_functiondialogs_ui_headers ${widgets_functiondialogs_ui_files}) + +## +## List of source files to compile +## +file (GLOB widgets_functiondialogs_source_files + crescendo.cpp + deloverlaps.cpp + gatetime.cpp + move.cpp + quantize.cpp + remove.cpp + setlen.cpp + transpose.cpp + legato.cpp + velocity.cpp + ) + +## +## Define target +## +add_library ( widgets_functiondialogs ${MODULES_BUILD} + ${widgets_functiondialogs_ui_headers} + ${widgets_functiondialogs_mocs} + ${widgets_functiondialogs_source_files} + ) + +## +## Append to the list of translations +## +set (FILES_TO_TRANSLATE + ${FILES_TO_TRANSLATE} + ${widgets_functiondialogs_source_files} + ${widgets_functiondialogs_ui_files} + CACHE INTERNAL "" + ) + +## +## Compilation flags and target name +## +set_target_properties( widgets_functiondialogs + # PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h ${MUSECXXFLAGS} -I../ -I${PROJECT_SOURCE_DIR}/synti " + PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h ${MUSECXXFLAGS} -I../ -I${PROJECT_SOURCE_DIR}/synti" + OUTPUT_NAME muse_widgets_functiondialogs + ) + +## +## Linkage +## +target_link_libraries ( widgets_functiondialogs + ${QT_LIBRARIES} + icons + ) + +## +## Install location +## +if ( ${MODULES_BUILD} STREQUAL SHARED ) + install(TARGETS widgets_functiondialogs + DESTINATION ${MusE_MODULES_DIR} + ) +endif ( ${MODULES_BUILD} STREQUAL SHARED ) diff --git a/muse2/muse/widgets/function_dialogs/crescendo.cpp b/muse2/muse/widgets/function_dialogs/crescendo.cpp new file mode 100644 index 00000000..ef31c5ef --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/crescendo.cpp @@ -0,0 +1,112 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: crescendo.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include <QButtonGroup> +#include "crescendo.h" +#include "xml.h" + +Crescendo::Crescendo(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + range_group = new QButtonGroup; + range_group->addButton(looped_events_button,2); + range_group->addButton(selected_looped_button,3); + + connect(absolute_button, SIGNAL(toggled(bool)), SLOT(absolute_changed(bool))); + + pull_values(); +} + +void Crescendo::pull_values() +{ + range = range_group->checkedId(); + start_val = start_spinbox->value(); + end_val = end_spinbox->value(); + absolute = absolute_button->isChecked(); +} + +void Crescendo::accept() +{ + pull_values(); + QDialog::accept(); +} + +int Crescendo::exec() +{ + if ((range < 2) || (range > 3)) range=3; + + range_group->button(range)->setChecked(true); + start_spinbox->setValue(start_val); + end_spinbox->setValue(end_val); + absolute_button->setChecked(absolute); + absolute_changed(absolute); + + return QDialog::exec(); +} + +void Crescendo::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 == "start") + start_val=xml.parseInt(); + else if (tag == "end") + end_val=xml.parseInt(); + else if (tag == "absolute") + absolute=xml.parseInt(); + else + xml.unknown("Crescendo"); + break; + + case Xml::TagEnd: + if (tag == "crescendo") + return; + + default: + break; + } + } +} + +void Crescendo::write_configuration(int level, Xml& xml) +{ + xml.tag(level++, "crescendo"); + xml.intTag(level, "range", range); + xml.intTag(level, "start", start_val); + xml.intTag(level, "end", end_val); + xml.intTag(level, "absolute", absolute); + xml.tag(level, "/crescendo"); +} + +void Crescendo::absolute_changed(bool val) +{ + if (val) + { + start_spinbox->setMaximum(127); + start_spinbox->setSuffix(""); + end_spinbox->setMaximum(127); + end_spinbox->setSuffix(""); + } + else + { + start_spinbox->setMaximum(12700); + start_spinbox->setSuffix(" %"); + end_spinbox->setMaximum(12700); + end_spinbox->setSuffix(" %"); + } +} diff --git a/muse2/muse/widgets/function_dialogs/crescendo.h b/muse2/muse/widgets/function_dialogs/crescendo.h new file mode 100644 index 00000000..eb00e94f --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/crescendo.h @@ -0,0 +1,46 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: crescendo.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __CRESCENDO_H__ +#define __CRESCENDO_H__ + +#include "ui_crescendobase.h" + +class QButtonGroup; +class Xml; + +class Crescendo : public QDialog, public Ui::CrescendoBase +{ + private: + Q_OBJECT + QButtonGroup* range_group; + + protected slots: + void accept(); + void pull_values(); + + public: + Crescendo(QWidget* parent = 0); + + int range; + int start_val; + int end_val; + bool absolute; + + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + + public slots: + int exec(); + + private slots: + void absolute_changed(bool); +}; + +#endif + diff --git a/muse2/muse/widgets/function_dialogs/crescendobase.ui b/muse2/muse/widgets/function_dialogs/crescendobase.ui new file mode 100644 index 00000000..5f4ec1f4 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/crescendobase.ui @@ -0,0 +1,223 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>CrescendoBase</class> + <widget class="QDialog" name="CrescendoBase"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>275</width> + <height>293</height> + </rect> + </property> + <property name="windowTitle"> + <string>MusE: Crescendo/Decrescendo</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QGroupBox" name="rangeBox"> + <property name="title"> + <string>Range</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QRadioButton" name="looped_events_button"> + <property name="text"> + <string>Looped Events</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="selected_looped_button"> + <property name="text"> + <string>Selected Looped</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_2"> + <property name="title"> + <string>Values</string> + </property> + <property name="flat"> + <bool>false</bool> + </property> + <property name="checkable"> + <bool>false</bool> + </property> + <layout class="QGridLayout" name="gridLayout"> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="TextLabel3"> + <property name="text"> + <string>Start velocity</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="start_spinbox"> + <property name="suffix"> + <string> %</string> + </property> + <property name="minimum"> + <number>0</number> + </property> + <property name="maximum"> + <number>12700</number> + </property> + <property name="value"> + <number>80</number> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>End velocity</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QRadioButton" name="absolute_button"> + <property name="text"> + <string>Absolute</string> + </property> + <property name="checked"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QRadioButton" name="relative_button"> + <property name="text"> + <string>Relative</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="end_spinbox"> + <property name="suffix"> + <string> %</string> + </property> + <property name="maximum"> + <number>12700</number> + </property> + <property name="value"> + <number>130</number> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <item> + <spacer name="Spacer1"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="okButton"> + <property name="text"> + <string>OK</string> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="cancelButton"> + <property name="text"> + <string>Cancel</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11"/> + <resources/> + <connections> + <connection> + <sender>okButton</sender> + <signal>clicked()</signal> + <receiver>CrescendoBase</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>20</x> + <y>20</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + <connection> + <sender>cancelButton</sender> + <signal>clicked()</signal> + <receiver>CrescendoBase</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>20</x> + <y>20</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/muse2/muse/widgets/function_dialogs/deloverlaps.cpp b/muse2/muse/widgets/function_dialogs/deloverlaps.cpp new file mode 100644 index 00000000..76103d74 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/deloverlaps.cpp @@ -0,0 +1,79 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: deloverlaps.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include <QButtonGroup> +#include "deloverlaps.h" +#include "xml.h" + + +DelOverlaps::DelOverlaps(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + range_group = new QButtonGroup; + range_group->addButton(all_events_button,0); + range_group->addButton(selected_events_button,1); + range_group->addButton(looped_events_button,2); + range_group->addButton(selected_looped_button,3); + + pull_values(); +} + +void DelOverlaps::pull_values() +{ + range = range_group->checkedId(); +} + +void DelOverlaps::accept() +{ + pull_values(); + QDialog::accept(); +} + +int DelOverlaps::exec() +{ + if ((range < 0) || (range > 3)) range=0; + + range_group->button(range)->setChecked(true); + + 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/function_dialogs/deloverlaps.h b/muse2/muse/widgets/function_dialogs/deloverlaps.h new file mode 100644 index 00000000..813192a6 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/deloverlaps.h @@ -0,0 +1,39 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: deloverlaps.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __DELOVERLAPS_H__ +#define __DELOVERLAPS__H__ + +#include "ui_deloverlapsbase.h" + +class QButtonGroup; +class Xml; + +class DelOverlaps : public QDialog, public Ui::DelOverlapsBase +{ + private: + Q_OBJECT + QButtonGroup* range_group; + + protected slots: + void accept(); + void pull_values(); + + public: + DelOverlaps(QWidget* parent = 0); + + int range; + + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + public slots: + int exec(); +}; + +#endif + diff --git a/muse2/muse/widgets/function_dialogs/deloverlapsbase.ui b/muse2/muse/widgets/function_dialogs/deloverlapsbase.ui new file mode 100644 index 00000000..7484bf97 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/deloverlapsbase.ui @@ -0,0 +1,153 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>DelOverlapsBase</class> + <widget class="QDialog" name="DelOverlapsBase"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>275</width> + <height>195</height> + </rect> + </property> + <property name="windowTitle"> + <string>MusE: Delete Overlaps</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QGroupBox" name="rangeBox"> + <property name="title"> + <string>Range</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QRadioButton" name="all_events_button"> + <property name="text"> + <string>All Events</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="selected_events_button"> + <property name="text"> + <string>Selected Events</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="looped_events_button"> + <property name="text"> + <string>Looped Events</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="selected_looped_button"> + <property name="text"> + <string>Selected Looped</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <item> + <spacer name="Spacer1"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="okButton"> + <property name="text"> + <string>OK</string> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="cancelButton"> + <property name="text"> + <string>Cancel</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11"/> + <resources/> + <connections> + <connection> + <sender>okButton</sender> + <signal>clicked()</signal> + <receiver>DelOverlapsBase</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>20</x> + <y>20</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + <connection> + <sender>cancelButton</sender> + <signal>clicked()</signal> + <receiver>DelOverlapsBase</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>20</x> + <y>20</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/muse2/muse/widgets/function_dialogs/gatetime.cpp b/muse2/muse/widgets/function_dialogs/gatetime.cpp new file mode 100644 index 00000000..9448ab1c --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/gatetime.cpp @@ -0,0 +1,108 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: gatetime.cpp,v 1.1.1.1 2003/10/27 18:54:37 wschweer Exp $ +// (C) Copyright 2001 Werner Schweer (ws@seh.de) +//========================================================= + +#include <QButtonGroup> +#include <QDialog> + +#include "gatetime.h" + +#include "xml.h" +#include "song.h" + +//--------------------------------------------------------- +// GateTime +//--------------------------------------------------------- + +GateTime::GateTime(QWidget* parent) + : QDialog(parent) + { + setupUi(this); + rangeGroup = new QButtonGroup(rangeBox); + rangeGroup->addButton(allButton, 0); + rangeGroup->addButton(selButton, 1); + rangeGroup->addButton(loopButton, 2); + rangeGroup->addButton(sloopButton, 3); + rangeGroup->setExclusive(true); + + pullValues(); + } + +//--------------------------------------------------------- +// accept +//--------------------------------------------------------- + +void GateTime::accept() + { + pullValues(); + QDialog::accept(); + } + +//--------------------------------------------------------- +// pullValues +//--------------------------------------------------------- + +void GateTime::pullValues() + { + range = rangeGroup->checkedId(); + rateVal = rate->value(); + offsetVal = offset->value(); + } + +//--------------------------------------------------------- +// exec +//--------------------------------------------------------- + +int GateTime::exec() + { + rangeGroup->button(range)->setChecked(true); + rate->setValue(rateVal); + offset->setValue(offsetVal); + + 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/function_dialogs/gatetime.h index dcb1827c..d2555872 100644 --- a/muse2/muse/widgets/gatetime.h +++ b/muse2/muse/widgets/function_dialogs/gatetime.h @@ -12,28 +12,35 @@ class QButtonGroup; class QDialog; +class Xml; //--------------------------------------------------------- // GateTime //--------------------------------------------------------- class GateTime : public QDialog, public Ui::GateTimeBase { + private: Q_OBJECT - int _range; - int _rateVal; - int _offsetVal; QButtonGroup *rangeGroup; protected slots: void accept(); + void pullValues(); public: GateTime(QWidget* parent=0); - void setRange(int id); - int range() const { return _range; } - int rateVal() const { return _rateVal; } - int offsetVal() const { return _offsetVal; } + + int range; + int rateVal; + int offsetVal; + + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + + public slots: + int exec(); }; #endif diff --git a/muse2/muse/widgets/gatetimebase.ui b/muse2/muse/widgets/function_dialogs/gatetimebase.ui index babf5f02..e804de17 100644 --- a/muse2/muse/widgets/gatetimebase.ui +++ b/muse2/muse/widgets/function_dialogs/gatetimebase.ui @@ -11,7 +11,7 @@ </rect> </property> <property name="windowTitle"> - <string>MusE: Modify Gate Time</string> + <string>MusE: Modify Note Length</string> </property> <layout class="QVBoxLayout"> <property name="spacing"> @@ -59,7 +59,7 @@ <item> <widget class="QRadioButton" name="sloopButton"> <property name="text"> - <string>Selected & Looped</string> + <string>Selected Looped</string> </property> </widget> </item> @@ -104,7 +104,7 @@ <string>%</string> </property> <property name="maximum"> - <number>200</number> + <number>1000</number> </property> <property name="value"> <number>100</number> @@ -124,6 +124,13 @@ </property> </widget> </item> + <item row="2" column="0" colspan="2"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>lenNew = (lenOld * rate) + offset</string> + </property> + </widget> + </item> </layout> </widget> </item> diff --git a/muse2/muse/widgets/function_dialogs/legato.cpp b/muse2/muse/widgets/function_dialogs/legato.cpp new file mode 100644 index 00000000..0a181106 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/legato.cpp @@ -0,0 +1,88 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: legato.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include <QButtonGroup> +#include "legato.h" +#include "xml.h" + +Legato::Legato(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + range_group = new QButtonGroup; + range_group->addButton(all_events_button,0); + range_group->addButton(selected_events_button,1); + range_group->addButton(looped_events_button,2); + range_group->addButton(selected_looped_button,3); + + pull_values(); +} + +void Legato::pull_values() +{ + range = range_group->checkedId(); + min_len = len_spinbox->value(); + allow_shortening = allow_shorten_checkbox->isChecked(); +} + +void Legato::accept() +{ + pull_values(); + QDialog::accept(); +} + +int Legato::exec() +{ + if ((range < 0) || (range > 3)) range=0; + + range_group->button(range)->setChecked(true); + len_spinbox->setValue(min_len); + allow_shorten_checkbox->setChecked(allow_shortening); + + return QDialog::exec(); +} + +void Legato::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 == "min_len") + min_len=xml.parseInt(); + else if (tag == "allow_shortening") + allow_shortening=xml.parseInt(); + else + xml.unknown("Legato"); + break; + + case Xml::TagEnd: + if (tag == "legato") + return; + + default: + break; + } + } +} + +void Legato::write_configuration(int level, Xml& xml) +{ + xml.tag(level++, "legato"); + xml.intTag(level, "range", range); + xml.intTag(level, "min_len", min_len); + xml.intTag(level, "allow_shortening", allow_shortening); + xml.tag(level, "/legato"); +} diff --git a/muse2/muse/widgets/function_dialogs/legato.h b/muse2/muse/widgets/function_dialogs/legato.h new file mode 100644 index 00000000..80b371ca --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/legato.h @@ -0,0 +1,42 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: legato.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __LEGATO_H__ +#define __LEGATO_H__ + +#include "ui_legatobase.h" + +class QButtonGroup; +class Xml; + +class Legato : public QDialog, public Ui::LegatoBase +{ + private: + Q_OBJECT + QButtonGroup* range_group; + + protected slots: + void accept(); + void pull_values(); + + public: + Legato(QWidget* parent = 0); + + int range; + int min_len; + bool allow_shortening; + + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + + public slots: + int exec(); +}; + +#endif + diff --git a/muse2/muse/widgets/transposebase.ui b/muse2/muse/widgets/function_dialogs/legatobase.ui index 63ac74a6..7bc406df 100644 --- a/muse2/muse/widgets/transposebase.ui +++ b/muse2/muse/widgets/function_dialogs/legatobase.ui @@ -1,19 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>TransposeDialogBase</class> - <widget class="QDialog" name="TransposeDialogBase"> + <class>LegatoBase</class> + <widget class="QDialog" name="LegatoBase"> + <property name="enabled"> + <bool>true</bool> + </property> <property name="geometry"> <rect> <x>0</x> <y>0</y> - <width>289</width> - <height>340</height> + <width>275</width> + <height>289</height> </rect> </property> <property name="windowTitle"> - <string>MusE: Midi Transpose</string> + <string>MusE: Legato</string> </property> - <layout class="QVBoxLayout"> + <layout class="QVBoxLayout" name="verticalLayout_2"> <property name="spacing"> <number>6</number> </property> @@ -21,11 +24,11 @@ <number>11</number> </property> <item> - <widget class="QGroupBox" name="GroupBox1"> + <widget class="QGroupBox" name="rangeBox"> <property name="title"> - <string>Value</string> + <string>Range</string> </property> - <layout class="QVBoxLayout"> + <layout class="QVBoxLayout" name="verticalLayout"> <property name="spacing"> <number>6</number> </property> @@ -33,63 +36,16 @@ <number>11</number> </property> <item> - <layout class="QHBoxLayout"> - <property name="spacing"> - <number>6</number> - </property> - <property name="margin"> - <number>0</number> + <widget class="QRadioButton" name="all_events_button"> + <property name="text"> + <string>All Events</string> </property> - <item> - <widget class="QSpinBox" name="delta"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimum"> - <number>-99</number> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="TextLabel1"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>halftones</string> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - </layout> + </widget> </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="ButtonBox1"> - <property name="title"> - <string>Time</string> - </property> - <layout class="QVBoxLayout"> - <property name="spacing"> - <number>6</number> - </property> - <property name="margin"> - <number>11</number> - </property> <item> - <widget class="QRadioButton" name="time_all"> + <widget class="QRadioButton" name="selected_events_button"> <property name="text"> - <string>all</string> + <string>Selected Events</string> </property> <property name="checked"> <bool>true</bool> @@ -97,9 +53,16 @@ </widget> </item> <item> - <widget class="QRadioButton" name="time_selected"> + <widget class="QRadioButton" name="looped_events_button"> <property name="text"> - <string>between markers</string> + <string>Looped Events</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="selected_looped_button"> + <property name="text"> + <string>Selected Looped</string> </property> </widget> </item> @@ -107,48 +70,90 @@ </widget> </item> <item> - <widget class="QGroupBox" name="ButtonBox2"> + <widget class="QGroupBox" name="groupBox_2"> <property name="title"> - <string>Parts</string> + <string>Settings</string> </property> - <layout class="QVBoxLayout"> - <property name="spacing"> - <number>6</number> - </property> + <property name="flat"> + <bool>false</bool> + </property> + <property name="checkable"> + <bool>false</bool> + </property> + <layout class="QGridLayout" name="gridLayout"> <property name="margin"> <number>11</number> </property> - <item> - <widget class="QRadioButton" name="parts_all"> - <property name="text"> - <string>all</string> + <property name="spacing"> + <number>6</number> + </property> + <item row="0" column="1"> + <widget class="QSpinBox" name="len_spinbox"> + <property name="enabled"> + <bool>true</bool> </property> - <property name="checked"> + <property name="accelerated"> <bool>true</bool> </property> + <property name="suffix"> + <string> ticks</string> + </property> + <property name="minimum"> + <number>0</number> + </property> + <property name="maximum"> + <number>10000</number> + </property> + <property name="singleStep"> + <number>1</number> + </property> + <property name="value"> + <number>0</number> + </property> </widget> </item> - <item> - <widget class="QRadioButton" name="parts_selected"> - <property name="windowTitle"> - <string/> - </property> + <item row="0" column="0"> + <widget class="QLabel" name="label_2"> <property name="text"> - <string>all in selected tracks</string> + <string>Minimum Length</string> </property> </widget> </item> + <item row="1" column="0" colspan="2"> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QLabel" name="label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Allow shortening notes</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="allow_shorten_checkbox"> + <property name="layoutDirection"> + <enum>Qt::RightToLeft</enum> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> + </item> </layout> </widget> </item> <item> - <layout class="QHBoxLayout"> + <layout class="QHBoxLayout" name="horizontalLayout"> <property name="spacing"> <number>6</number> </property> - <property name="margin"> - <number>0</number> - </property> <item> <spacer name="Spacer1"> <property name="orientation"> @@ -195,7 +200,7 @@ <connection> <sender>okButton</sender> <signal>clicked()</signal> - <receiver>TransposeDialogBase</receiver> + <receiver>LegatoBase</receiver> <slot>accept()</slot> <hints> <hint type="sourcelabel"> @@ -211,7 +216,7 @@ <connection> <sender>cancelButton</sender> <signal>clicked()</signal> - <receiver>TransposeDialogBase</receiver> + <receiver>LegatoBase</receiver> <slot>reject()</slot> <hints> <hint type="sourcelabel"> diff --git a/muse2/muse/widgets/function_dialogs/move.cpp b/muse2/muse/widgets/function_dialogs/move.cpp new file mode 100644 index 00000000..2ce6cb05 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/move.cpp @@ -0,0 +1,84 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: move.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include <QButtonGroup> +#include "move.h" +#include "xml.h" + +Move::Move(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + range_group = new QButtonGroup; + range_group->addButton(all_events_button,0); + range_group->addButton(selected_events_button,1); + range_group->addButton(looped_events_button,2); + range_group->addButton(selected_looped_button,3); + + pull_values(); +} + +void Move::pull_values() +{ + range = range_group->checkedId(); + amount = amount_spinbox->value(); +} + +void Move::accept() +{ + pull_values(); + QDialog::accept(); +} + +int Move::exec() +{ + if ((range < 0) || (range > 3)) range=0; + + range_group->button(range)->setChecked(true); + amount_spinbox->setValue(amount); + + 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/function_dialogs/move.h b/muse2/muse/widgets/function_dialogs/move.h new file mode 100644 index 00000000..4c90a922 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/move.h @@ -0,0 +1,41 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: move.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __MOVE_H__ +#define __MOVE_H__ + +#include "ui_movebase.h" + +class QButtonGroup; +class Xml; + +class Move : public QDialog, public Ui::MoveBase +{ + private: + Q_OBJECT + QButtonGroup* range_group; + + protected slots: + void accept(); + void pull_values(); + + public: + Move(QWidget* parent = 0); + + int range; + int amount; + + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + + public slots: + int exec(); +}; + +#endif + diff --git a/muse2/muse/widgets/function_dialogs/movebase.ui b/muse2/muse/widgets/function_dialogs/movebase.ui new file mode 100644 index 00000000..a8825dd5 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/movebase.ui @@ -0,0 +1,203 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>MoveBase</class> + <widget class="QDialog" name="MoveBase"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>275</width> + <height>264</height> + </rect> + </property> + <property name="windowTitle"> + <string>MusE: Move Notes</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QGroupBox" name="rangeBox"> + <property name="title"> + <string>Range</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QRadioButton" name="all_events_button"> + <property name="text"> + <string>All Events</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="selected_events_button"> + <property name="text"> + <string>Selected Events</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="looped_events_button"> + <property name="text"> + <string>Looped Events</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="selected_looped_button"> + <property name="text"> + <string>Selected Looped</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_2"> + <property name="title"> + <string>Value</string> + </property> + <property name="flat"> + <bool>false</bool> + </property> + <property name="checkable"> + <bool>false</bool> + </property> + <layout class="QGridLayout" name="gridLayout"> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="TextLabel3"> + <property name="text"> + <string>Move by</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="amount_spinbox"> + <property name="accelerated"> + <bool>true</bool> + </property> + <property name="suffix"> + <string> ticks</string> + </property> + <property name="minimum"> + <number>-9999999</number> + </property> + <property name="maximum"> + <number>9999999</number> + </property> + <property name="singleStep"> + <number>386</number> + </property> + <property name="value"> + <number>0</number> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <item> + <spacer name="Spacer1"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="okButton"> + <property name="text"> + <string>OK</string> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="cancelButton"> + <property name="text"> + <string>Cancel</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11"/> + <resources/> + <connections> + <connection> + <sender>okButton</sender> + <signal>clicked()</signal> + <receiver>MoveBase</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>20</x> + <y>20</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + <connection> + <sender>cancelButton</sender> + <signal>clicked()</signal> + <receiver>MoveBase</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>20</x> + <y>20</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/muse2/muse/widgets/function_dialogs/quantbase.ui b/muse2/muse/widgets/function_dialogs/quantbase.ui new file mode 100644 index 00000000..6a88c86f --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/quantbase.ui @@ -0,0 +1,308 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>QuantBase</class> + <widget class="QDialog" name="QuantBase"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>279</width> + <height>486</height> + </rect> + </property> + <property name="windowTitle"> + <string>MusE: Quantize</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QGroupBox" name="rangeBox"> + <property name="title"> + <string>Range</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QRadioButton" name="all_events_button"> + <property name="text"> + <string>All Events</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="selected_events_button"> + <property name="text"> + <string>Selected Events</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="looped_events_button"> + <property name="text"> + <string>Looped Events</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="selected_looped_button"> + <property name="text"> + <string>Selected Looped</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_2"> + <property name="title"> + <string>Values</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <item row="1" column="0"> + <widget class="QLabel" name="TextLabel3"> + <property name="text"> + <string>Strength:</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="strength_spinbox"> + <property name="suffix"> + <string>%</string> + </property> + <property name="maximum"> + <number>100</number> + </property> + <property name="value"> + <number>80</number> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="TextLabel4"> + <property name="text"> + <string>Threshold (ticks):</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QSpinBox" name="threshold_spinbox"> + <property name="minimum"> + <number>0</number> + </property> + <property name="maximum"> + <number>10000</number> + </property> + <property name="singleStep"> + <number>1</number> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Quantize Len</string> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="QCheckBox" name="len_checkbox"> + <property name="text"> + <string/> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Raster</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="raster_combobox"> + <property name="editable"> + <bool>false</bool> + </property> + <property name="currentIndex"> + <number>3</number> + </property> + <property name="frame"> + <bool>true</bool> + </property> + <item> + <property name="text"> + <string>Whole</string> + </property> + </item> + <item> + <property name="text"> + <string>Half</string> + </property> + </item> + <item> + <property name="text"> + <string>Quarter</string> + </property> + </item> + <item> + <property name="text"> + <string>8th</string> + </property> + </item> + <item> + <property name="text"> + <string>16th</string> + </property> + </item> + <item> + <property name="text"> + <string>32th</string> + </property> + </item> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Swing:</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QSpinBox" name="swing_spinbox"> + <property name="minimum"> + <number>-99</number> + </property> + </widget> + </item> + <item row="5" column="0" colspan="2"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>If the proposed change in tick or length is smaller than threshold, nothing is done. +If swing=0, this is normal +If swing is 33, you get a 2:1-rhythm. +If swing is -33, you get a 1:2-rhythm.</string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <item> + <spacer name="Spacer1"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="ok_button"> + <property name="text"> + <string>OK</string> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="cancel_button"> + <property name="text"> + <string>Cancel</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11"/> + <resources/> + <connections> + <connection> + <sender>ok_button</sender> + <signal>clicked()</signal> + <receiver>QuantBase</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>20</x> + <y>20</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + <connection> + <sender>cancel_button</sender> + <signal>clicked()</signal> + <receiver>QuantBase</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>20</x> + <y>20</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/muse2/muse/widgets/function_dialogs/quantize.cpp b/muse2/muse/widgets/function_dialogs/quantize.cpp new file mode 100644 index 00000000..111087c2 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/quantize.cpp @@ -0,0 +1,103 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: quantize.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include <QButtonGroup> +#include "quantize.h" +#include "xml.h" + +Quantize::Quantize(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + range_group = new QButtonGroup; + range_group->addButton(all_events_button,0); + range_group->addButton(selected_events_button,1); + range_group->addButton(looped_events_button,2); + range_group->addButton(selected_looped_button,3); + + pull_values(); +} + +void Quantize::pull_values() +{ + range = range_group->checkedId(); + strength = strength_spinbox->value(); + threshold = threshold_spinbox->value(); + raster_power2 = raster_combobox->currentIndex(); + quant_len = len_checkbox->isChecked(); + swing = swing_spinbox->value(); +} + +void Quantize::accept() +{ + pull_values(); + QDialog::accept(); +} + +int Quantize::exec() +{ + if ((range < 0) || (range > 3)) range=0; + + range_group->button(range)->setChecked(true); + strength_spinbox->setValue(strength); + threshold_spinbox->setValue(threshold); + raster_combobox->setCurrentIndex(raster_power2); + len_checkbox->setChecked(quant_len); + swing_spinbox->setValue(swing); + + 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/function_dialogs/quantize.h b/muse2/muse/widgets/function_dialogs/quantize.h new file mode 100644 index 00000000..399e2545 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/quantize.h @@ -0,0 +1,45 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: quantize.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __QUANTIZE_H__ +#define __QUANTIZE_H__ + +#include "ui_quantbase.h" + +class QButtonGroup; +class Xml; + +class Quantize : public QDialog, public Ui::QuantBase +{ + private: + Q_OBJECT + QButtonGroup* range_group; + + protected slots: + void accept(); + void pull_values(); + + public: + Quantize(QWidget* parent = 0); + + int range; + int strength; + int threshold; + int raster_power2; + int swing; + bool quant_len; + + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + + public slots: + int exec(); +}; + +#endif + diff --git a/muse2/muse/widgets/function_dialogs/remove.cpp b/muse2/muse/widgets/function_dialogs/remove.cpp new file mode 100644 index 00000000..4a875135 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/remove.cpp @@ -0,0 +1,98 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: remove.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include <QButtonGroup> +#include "remove.h" +#include "xml.h" + +Remove::Remove(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + range_group = new QButtonGroup; + range_group->addButton(all_events_button,0); + range_group->addButton(selected_events_button,1); + range_group->addButton(looped_events_button,2); + range_group->addButton(selected_looped_button,3); + + pull_values(); +} + +void Remove::pull_values() +{ + range = range_group->checkedId(); + len_thres_used=len_checkbox->isChecked(); + len_threshold=len_spinbox->value(); + velo_thres_used=velo_checkbox->isChecked(); + velo_threshold=velo_spinbox->value(); +} + +void Remove::accept() +{ + pull_values(); + QDialog::accept(); +} + +int Remove::exec() +{ + if ((range < 0) || (range > 3)) range=0; + + range_group->button(range)->setChecked(true); + len_checkbox->setChecked(len_thres_used); + len_spinbox->setValue(len_threshold); + velo_checkbox->setChecked(velo_thres_used); + velo_spinbox->setValue(velo_threshold); + + 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 if (tag == "velo_threshold") + velo_threshold=xml.parseInt(); + else if (tag == "velo_thres_used") + velo_thres_used=xml.parseInt(); + else if (tag == "len_threshold") + len_threshold=xml.parseInt(); + else if (tag == "len_thres_used") + len_thres_used=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.intTag(level, "velo_threshold", velo_threshold); + xml.intTag(level, "velo_thres_used", velo_thres_used); + xml.intTag(level, "len_threshold", len_threshold); + xml.intTag(level, "len_thres_used", len_thres_used); + xml.tag(level, "/erase"); +} diff --git a/muse2/muse/widgets/function_dialogs/remove.h b/muse2/muse/widgets/function_dialogs/remove.h new file mode 100644 index 00000000..4c1a91e9 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/remove.h @@ -0,0 +1,44 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: remove.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __REMOVE_H__ +#define __REMOVE_H__ + +#include "ui_removebase.h" + +class QButtonGroup; +class Xml; + +class Remove : public QDialog, public Ui::RemoveBase +{ + private: + Q_OBJECT + QButtonGroup* range_group; + + protected slots: + void accept(); + void pull_values(); + + public: + Remove(QWidget* parent = 0); + + int range; + int velo_threshold; + bool velo_thres_used; + int len_threshold; + bool len_thres_used; + + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + + public slots: + int exec(); +}; + +#endif + diff --git a/muse2/muse/widgets/function_dialogs/removebase.ui b/muse2/muse/widgets/function_dialogs/removebase.ui new file mode 100644 index 00000000..79d541cc --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/removebase.ui @@ -0,0 +1,280 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>RemoveBase</class> + <widget class="QDialog" name="RemoveBase"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>275</width> + <height>443</height> + </rect> + </property> + <property name="windowTitle"> + <string>MusE: Erase Notes</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QGroupBox" name="rangeBox"> + <property name="title"> + <string>Range</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QRadioButton" name="all_events_button"> + <property name="text"> + <string>All Events</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="selected_events_button"> + <property name="text"> + <string>Selected Events</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="looped_events_button"> + <property name="text"> + <string>Looped Events</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="selected_looped_button"> + <property name="text"> + <string>Selected Looped</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_2"> + <property name="title"> + <string>Thresholds</string> + </property> + <property name="flat"> + <bool>false</bool> + </property> + <property name="checkable"> + <bool>false</bool> + </property> + <layout class="QGridLayout" name="gridLayout"> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <item row="0" column="1"> + <widget class="QSpinBox" name="velo_spinbox"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="accelerated"> + <bool>true</bool> + </property> + <property name="suffix"> + <string/> + </property> + <property name="minimum"> + <number>0</number> + </property> + <property name="maximum"> + <number>127</number> + </property> + <property name="singleStep"> + <number>1</number> + </property> + <property name="value"> + <number>16</number> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="len_spinbox"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="suffix"> + <string> ticks</string> + </property> + <property name="maximum"> + <number>10000</number> + </property> + <property name="value"> + <number>12</number> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QCheckBox" name="velo_checkbox"> + <property name="text"> + <string>Velocity</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QCheckBox" name="len_checkbox"> + <property name="text"> + <string>Length</string> + </property> + </widget> + </item> + <item row="2" column="0" colspan="2"> + <widget class="QLabel" name="label"> + <property name="text"> + <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:7px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If nothing is checked, everything is removed.</p> +<p style=" margin-top:0px; margin-bottom:7px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If velocity is checked, only notes with velo &lt; threshold are removed.</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If both are checked, notes with velo &lt; threshold OR with length &lt; threshold are removed.</p></body></html></string> + </property> + <property name="textFormat"> + <enum>Qt::AutoText</enum> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <item> + <spacer name="Spacer1"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="okButton"> + <property name="text"> + <string>OK</string> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="cancelButton"> + <property name="text"> + <string>Cancel</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11"/> + <resources/> + <connections> + <connection> + <sender>okButton</sender> + <signal>clicked()</signal> + <receiver>RemoveBase</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>20</x> + <y>20</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + <connection> + <sender>cancelButton</sender> + <signal>clicked()</signal> + <receiver>RemoveBase</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>20</x> + <y>20</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + <connection> + <sender>velo_checkbox</sender> + <signal>toggled(bool)</signal> + <receiver>velo_spinbox</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>83</x> + <y>192</y> + </hint> + <hint type="destinationlabel"> + <x>198</x> + <y>193</y> + </hint> + </hints> + </connection> + <connection> + <sender>len_checkbox</sender> + <signal>toggled(bool)</signal> + <receiver>len_spinbox</receiver> + <slot>setEnabled(bool)</slot> + <hints> + <hint type="sourcelabel"> + <x>83</x> + <y>221</y> + </hint> + <hint type="destinationlabel"> + <x>198</x> + <y>222</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/muse2/muse/widgets/function_dialogs/setlen.cpp b/muse2/muse/widgets/function_dialogs/setlen.cpp new file mode 100644 index 00000000..024cdd35 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/setlen.cpp @@ -0,0 +1,83 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: setlen.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include <QButtonGroup> +#include "setlen.h" +#include "xml.h" + +Setlen::Setlen(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + range_group = new QButtonGroup; + range_group->addButton(all_events_button,0); + range_group->addButton(selected_events_button,1); + range_group->addButton(looped_events_button,2); + range_group->addButton(selected_looped_button,3); + + pull_values(); +} + +void Setlen::pull_values() +{ + range = range_group->checkedId(); + len = len_spinbox->value(); +} + +void Setlen::accept() +{ + pull_values(); + QDialog::accept(); +} + +int Setlen::exec() +{ + if ((range < 0) || (range > 3)) range=0; + + range_group->button(range)->setChecked(true); + len_spinbox->setValue(len); + + 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/function_dialogs/setlen.h b/muse2/muse/widgets/function_dialogs/setlen.h new file mode 100644 index 00000000..ad66a38b --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/setlen.h @@ -0,0 +1,41 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: setlen.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __SETLEN_H__ +#define __SETLEN_H__ + +#include "ui_setlenbase.h" + +class QButtonGroup; +class Xml; + +class Setlen : public QDialog, public Ui::SetlenBase +{ + private: + Q_OBJECT + QButtonGroup* range_group; + + protected slots: + void accept(); + void pull_values(); + + public: + Setlen(QWidget* parent = 0); + + int range; + int len; + + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + + public slots: + int exec(); +}; + +#endif + diff --git a/muse2/muse/widgets/function_dialogs/setlenbase.ui b/muse2/muse/widgets/function_dialogs/setlenbase.ui new file mode 100644 index 00000000..7d929716 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/setlenbase.ui @@ -0,0 +1,197 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>SetlenBase</class> + <widget class="QDialog" name="SetlenBase"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>275</width> + <height>264</height> + </rect> + </property> + <property name="windowTitle"> + <string>MusE: Set Note Length</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QGroupBox" name="rangeBox"> + <property name="title"> + <string>Range</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QRadioButton" name="all_events_button"> + <property name="text"> + <string>All Events</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="selected_events_button"> + <property name="text"> + <string>Selected Events</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="looped_events_button"> + <property name="text"> + <string>Looped Events</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="selected_looped_button"> + <property name="text"> + <string>Selected Looped</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_2"> + <property name="title"> + <string>Value</string> + </property> + <property name="flat"> + <bool>false</bool> + </property> + <property name="checkable"> + <bool>false</bool> + </property> + <layout class="QGridLayout" name="gridLayout"> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="TextLabel3"> + <property name="text"> + <string>New length</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="len_spinbox"> + <property name="suffix"> + <string> ticks</string> + </property> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>10000</number> + </property> + <property name="value"> + <number>1</number> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <item> + <spacer name="Spacer1"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="okButton"> + <property name="text"> + <string>OK</string> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="cancelButton"> + <property name="text"> + <string>Cancel</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11"/> + <resources/> + <connections> + <connection> + <sender>okButton</sender> + <signal>clicked()</signal> + <receiver>SetlenBase</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>20</x> + <y>20</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + <connection> + <sender>cancelButton</sender> + <signal>clicked()</signal> + <receiver>SetlenBase</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>20</x> + <y>20</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/muse2/muse/widgets/function_dialogs/transpose.cpp b/muse2/muse/widgets/function_dialogs/transpose.cpp new file mode 100644 index 00000000..b10c1249 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/transpose.cpp @@ -0,0 +1,83 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: transpose.cpp,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#include <QButtonGroup> +#include "transpose.h" +#include "xml.h" + +Transpose::Transpose(QWidget* parent) + : QDialog(parent) +{ + setupUi(this); + range_group = new QButtonGroup; + range_group->addButton(all_events_button,0); + range_group->addButton(selected_events_button,1); + range_group->addButton(looped_events_button,2); + range_group->addButton(selected_looped_button,3); + + pull_values(); +} + +void Transpose::pull_values() +{ + range = range_group->checkedId(); + amount = amount_spinbox->value(); +} + +void Transpose::accept() +{ + pull_values(); + QDialog::accept(); +} + +int Transpose::exec() +{ + if ((range < 0) || (range > 3)) range=0; + + range_group->button(range)->setChecked(true); + amount_spinbox->setValue(amount); + + 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/function_dialogs/transpose.h b/muse2/muse/widgets/function_dialogs/transpose.h new file mode 100644 index 00000000..97dd443e --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/transpose.h @@ -0,0 +1,41 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: transpose.h,v 1.1.1.1 2011/05/05 18:51:04 flo93 Exp $ +// (C) Copyright 2011 Florian Jung (flo93@sourceforge.net) +//========================================================= + +#ifndef __TRANSPOSE_H__ +#define __TRANSPOSE_H__ + +#include "ui_transposebase.h" + +class QButtonGroup; +class Xml; + +class Transpose : public QDialog, public Ui::TransposeBase +{ + private: + Q_OBJECT + QButtonGroup* range_group; + + protected slots: + void accept(); + void pull_values(); + + public: + Transpose(QWidget* parent = 0); + + int range; + int amount; + + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + + public slots: + int exec(); +}; + +#endif + diff --git a/muse2/muse/widgets/function_dialogs/transposebase.ui b/muse2/muse/widgets/function_dialogs/transposebase.ui new file mode 100644 index 00000000..c26f2ef9 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/transposebase.ui @@ -0,0 +1,203 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>TransposeBase</class> + <widget class="QDialog" name="TransposeBase"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>275</width> + <height>264</height> + </rect> + </property> + <property name="windowTitle"> + <string>MusE: Transpose</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QGroupBox" name="rangeBox"> + <property name="title"> + <string>Range</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin"> + <number>11</number> + </property> + <item> + <widget class="QRadioButton" name="all_events_button"> + <property name="text"> + <string>All Events</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="selected_events_button"> + <property name="text"> + <string>Selected Events</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="looped_events_button"> + <property name="text"> + <string>Looped Events</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="selected_looped_button"> + <property name="text"> + <string>Selected Looped</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_2"> + <property name="title"> + <string>Value</string> + </property> + <property name="flat"> + <bool>false</bool> + </property> + <property name="checkable"> + <bool>false</bool> + </property> + <layout class="QGridLayout" name="gridLayout"> + <property name="margin"> + <number>11</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="TextLabel3"> + <property name="text"> + <string>Halftone-steps</string> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="amount_spinbox"> + <property name="accelerated"> + <bool>true</bool> + </property> + <property name="suffix"> + <string/> + </property> + <property name="minimum"> + <number>-127</number> + </property> + <property name="maximum"> + <number>127</number> + </property> + <property name="singleStep"> + <number>1</number> + </property> + <property name="value"> + <number>0</number> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>6</number> + </property> + <item> + <spacer name="Spacer1"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="okButton"> + <property name="text"> + <string>OK</string> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="cancelButton"> + <property name="text"> + <string>Cancel</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11"/> + <resources/> + <connections> + <connection> + <sender>okButton</sender> + <signal>clicked()</signal> + <receiver>TransposeBase</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>20</x> + <y>20</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + <connection> + <sender>cancelButton</sender> + <signal>clicked()</signal> + <receiver>TransposeBase</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>20</x> + <y>20</y> + </hint> + <hint type="destinationlabel"> + <x>20</x> + <y>20</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/muse2/muse/widgets/function_dialogs/velocity.cpp b/muse2/muse/widgets/function_dialogs/velocity.cpp new file mode 100644 index 00000000..ec625489 --- /dev/null +++ b/muse2/muse/widgets/function_dialogs/velocity.cpp @@ -0,0 +1,102 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: velocity.cpp,v 1.1.1.1 2003/10/27 18:55:04 wschweer Exp $ +// (C) Copyright 2001 Werner Schweer (ws@seh.de) +//========================================================= + +#include <QButtonGroup> +#include "velocity.h" +#include "xml.h" + +//--------------------------------------------------------- +// Velocity +//--------------------------------------------------------- + +Velocity::Velocity(QWidget* parent) + : QDialog(parent) + { + setupUi(this); + rangeGroup = new QButtonGroup; + rangeGroup->addButton(allEvents,0); + rangeGroup->addButton(selectedEvents,1); + rangeGroup->addButton(loopedEvents,2); + rangeGroup->addButton(selectedLooped,3); + + pullValues(); + } + +//--------------------------------------------------------- +// accept +//--------------------------------------------------------- + +void Velocity::accept() + { + pullValues(); + QDialog::accept(); + } + +//--------------------------------------------------------- +// pullValues +//--------------------------------------------------------- + +void Velocity::pullValues() + { + range = rangeGroup->checkedId(); + rateVal = rate->value(); + offsetVal = offset->value(); + } + +//--------------------------------------------------------- +// exec +//--------------------------------------------------------- + +int Velocity::exec() + { + rangeGroup->button(range)->setChecked(true); + rate->setValue(rateVal); + offset->setValue(offsetVal); + + 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/function_dialogs/velocity.h index cf5b2779..cbea4e22 100644 --- a/muse2/muse/widgets/velocity.h +++ b/muse2/muse/widgets/function_dialogs/velocity.h @@ -11,28 +11,34 @@ #include "ui_velocitybase.h" class QButtonGroup; +class Xml; //--------------------------------------------------------- // Velocity //--------------------------------------------------------- class Velocity : public QDialog, public Ui::VelocityBase { - int _range; - int _rateVal; - int _offsetVal; - + private: Q_OBJECT QButtonGroup* rangeGroup; protected slots: void accept(); + void pullValues(); public: - Velocity(QDialog* parent = 0); - void setRange(int id); - int range() const { return _range; } - int rateVal() const { return _rateVal; } - int offsetVal() const { return _offsetVal; } + Velocity(QWidget* parent = 0); + + int range; + int rateVal; + int offsetVal; + + void read_configuration(Xml& xml); + void write_configuration(int level, Xml& xml); + + + public slots: + int exec(); }; #endif diff --git a/muse2/muse/widgets/velocitybase.ui b/muse2/muse/widgets/function_dialogs/velocitybase.ui index 1e386e11..40fe625f 100644 --- a/muse2/muse/widgets/velocitybase.ui +++ b/muse2/muse/widgets/function_dialogs/velocitybase.ui @@ -59,7 +59,7 @@ <item> <widget class="QRadioButton" name="selectedLooped"> <property name="text"> - <string>Selected & Looped</string> + <string>Selected Looped</string> </property> </widget> </item> @@ -114,7 +114,7 @@ <item row="1" column="1"> <widget class="QSpinBox" name="offset"> <property name="minimum"> - <number>1</number> + <number>-127</number> </property> <property name="maximum"> <number>127</number> @@ -122,6 +122,16 @@ <property name="singleStep"> <number>1</number> </property> + <property name="value"> + <number>0</number> + </property> + </widget> + </item> + <item row="2" column="0" colspan="2"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>veloNew = (veloOld * rate) + offset</string> + </property> </widget> </item> </layout> diff --git a/muse2/muse/widgets/gatetime.cpp b/muse2/muse/widgets/gatetime.cpp deleted file mode 100644 index f1804c35..00000000 --- a/muse2/muse/widgets/gatetime.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: gatetime.cpp,v 1.1.1.1 2003/10/27 18:54:37 wschweer Exp $ -// (C) Copyright 2001 Werner Schweer (ws@seh.de) -//========================================================= - -#include <QButtonGroup> -#include <QDialog> - -#include "gatetime.h" - -#include "song.h" - -//--------------------------------------------------------- -// GateTime -//--------------------------------------------------------- - -GateTime::GateTime(QWidget* parent) - : QDialog(parent) - { - setupUi(this); - rangeGroup = new QButtonGroup(rangeBox); - rangeGroup->addButton(allButton, 0); - rangeGroup->addButton(selButton, 1); - rangeGroup->addButton(loopButton, 2); - rangeGroup->addButton(sloopButton, 3); - rangeGroup->setExclusive(true); - } - -//--------------------------------------------------------- -// accept -//--------------------------------------------------------- - -void GateTime::accept() - { - _range = rangeGroup->checkedId(); - _rateVal = rate->value(); - _offsetVal = offset->value(); - QDialog::accept(); - } - -//--------------------------------------------------------- -// setRange -//--------------------------------------------------------- - -void GateTime::setRange(int id) - { - rangeGroup->button(id)->setChecked(true); - } - diff --git a/muse2/muse/widgets/header.cpp b/muse2/muse/widgets/header.cpp index 16cc374b..00cbd29c 100644 --- a/muse2/muse/widgets/header.cpp +++ b/muse2/muse/widgets/header.cpp @@ -7,46 +7,56 @@ #include "header.h" #include "xml.h" +#include "popupmenu.h" #include <QStringList> #include <QStandardItemModel> +#include <QMouseEvent> //--------------------------------------------------------- // readStatus //--------------------------------------------------------- void Header::readStatus(Xml& xml) - { - for (;;) { - Xml::Token token = xml.parse(); - const QString& tag = xml.s1(); - switch (token) { - case Xml::Error: - case Xml::End: - return; - case Xml::Text: - { - //QStringList l = QStringList::split(QString(" "), tag); - QStringList l = tag.split(QString(" "), QString::SkipEmptyParts); - int index = count() -1; - for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { - int section = visualIndex((*it).toInt()); - moveSection(section, index); - --index; - } - } - break; - case Xml::TagStart: - xml.unknown("Header"); - break; - case Xml::TagEnd: - if (tag ==objectName()) - return; - default: - break; - } - } - } +{ + + for (;;) { + Xml::Token token = xml.parse(); + const QString& tag = xml.s1(); + switch (token) { + case Xml::Error: + case Xml::End: + return; + case Xml::Text: + { + //QStringList l = QStringList::split(QString(" "), tag); + QStringList l = tag.split(QString(" "), QString::SkipEmptyParts); + int index = count() -1; + for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { + int logialIdx=abs((*it).toInt()); + bool isHidden = (*it).toInt() < 0 ? true:false; + int section = visualIndex(logialIdx); + setMovable(true); + moveSection(section, index); + if (isHidden) + hideSection(logialIdx); + else + showSection(logialIdx); + --index; + } + } + break; + case Xml::TagStart: + xml.unknown("Header"); + break; + case Xml::TagEnd: + if (tag ==objectName()) + return; + default: + break; + } + } +} //--------------------------------------------------------- // writeStatus @@ -57,8 +67,12 @@ void Header::writeStatus(int level, Xml& xml) const //xml.nput(level, "<%s> ", name()); xml.nput(level, "<%s> ", Xml::xmlString(objectName()).toLatin1().constData()); int n = count() - 1; - for (int i = n; i >= 0; --i) - xml.nput("%d ", logicalIndex(i)); + for (int i = n; i >= 0; --i) { + if (isSectionHidden(logicalIndex(i))) + xml.nput("%d ", -logicalIndex(i)); // hidden is stored as negative value + else + xml.nput("%d ", logicalIndex(i)); + } //xml.put("</%s>", name()); xml.put("</%s>", Xml::xmlString(objectName()).toLatin1().constData()); } @@ -73,8 +87,9 @@ Header::Header(QWidget* parent, const char* name) setObjectName(name); itemModel = new QStandardItemModel; setModel(itemModel); - //setResizeMode(QHeaderView::ResizeToContents); setDefaultSectionSize(30); + setStretchLastSection(true); + } //--------------------------------------------------------- @@ -86,7 +101,7 @@ void Header::setColumnLabel(const QString & text, int col, int width ) QStandardItem *sitem = new QStandardItem(text ); itemModel->setHorizontalHeaderItem(col, sitem); if (width > -1) - resizeSection(col, width); + resizeSection(col, width); } //--------------------------------------------------------- @@ -109,3 +124,37 @@ void Header::setWhatsThis(int col, const QString &text) item->setWhatsThis(text); } +void Header::mousePressEvent ( QMouseEvent * e ) +{ + if (e->button() == Qt::RightButton) { + + PopupMenu* p = new PopupMenu(); + p->disconnect(); + p->clear(); + p->setTitle(tr("Track Info Columns")); + QAction* act = 0; + + for(int i=1; i < count(); i++) { + act = p->addAction(itemModel->horizontalHeaderItem(logicalIndex(i))->text() + + "\t - "+ itemModel->horizontalHeaderItem(logicalIndex(i))->toolTip()); + + act->setCheckable(true); + act->setChecked(!isSectionHidden(logicalIndex(i))); + int data = logicalIndex(i); + act->setData(data); + } + connect(p, SIGNAL(triggered(QAction*)), SLOT(changeColumns(QAction*))); + p->exec(QCursor::pos()); + + delete p; + + } +} +void Header::changeColumns(QAction *a) +{ + int section = a->data().toInt(); + if (isSectionHidden(section)) + showSection(section); + else + hideSection(section); +} diff --git a/muse2/muse/widgets/header.h b/muse2/muse/widgets/header.h index 83680f8a..3e7b73a4 100644 --- a/muse2/muse/widgets/header.h +++ b/muse2/muse/widgets/header.h @@ -9,6 +9,7 @@ #define __HEADER_H__ #include <QHeaderView> +#include <QAction> class QStandardItemModel; @@ -26,6 +27,9 @@ class Header : public QHeaderView { void setColumnLabel( const QString & s, int col, int width = -1 ); void setToolTip(int col, const QString &text); void setWhatsThis(int col, const QString &text); + void mousePressEvent ( QMouseEvent * e ); + private slots: + void changeColumns(QAction* a); }; #endif diff --git a/muse2/muse/widgets/mtscale_flo.cpp b/muse2/muse/widgets/mtscale_flo.cpp new file mode 100644 index 00000000..e18a7d11 --- /dev/null +++ b/muse2/muse/widgets/mtscale_flo.cpp @@ -0,0 +1,325 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: mtscale_flo.cpp,v 1.8.2.7 2011/05/19 04:14:01 flo Exp $ +// (C) Copyright 1999 Werner Schweer (ws@seh.de) +//========================================================= + +#include <values.h> + +#include <QMouseEvent> +#include <QPainter> + +#include "mtscale_flo.h" +#include "song.h" +#include "icons.h" +#include "gconfig.h" +#include "scoreedit.h" + +//--------------------------------------------------------- +// MTScale +// Midi Time Scale +//--------------------------------------------------------- + +MTScaleFlo::MTScaleFlo(ScoreCanvas* parent_editor, QWidget* parent_widget) + : View(parent_widget, 1, 1) + { + setToolTip(tr("bar scale")); + pos[0] = song->cpos(); + pos[1] = song->lpos(); + pos[2] = song->rpos(); + button = Qt::NoButton; + setMouseTracking(true); + connect(song, SIGNAL(posChanged(int, unsigned, bool)), SLOT(setPos(int, unsigned, bool))); + connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); + connect(song, SIGNAL(markerChanged(int)), SLOT(redraw())); + + parent=parent_editor; + + setFixedHeight(28); + setBg(QColor(0xe0, 0xe0, 0xe0)); + } + +//--------------------------------------------------------- +// songChanged +//--------------------------------------------------------- + +void MTScaleFlo::songChanged(int type) + { + if (type & (SC_SIG|SC_TEMPO)) + redraw(); + } + +//--------------------------------------------------------- +// setPos +//--------------------------------------------------------- + +void MTScaleFlo::setPos(int idx, unsigned val, bool) + { + if ((val == MAXINT) || (val == pos[idx])) + return; + + int opos = parent->tick_to_x(pos[idx] == MAXINT ? val : pos[idx]) + xoffset - xpos; + + pos[idx] = val; + +// if (isVisible()) +// redraw(); + if (isVisible()) { + + int tval = parent->tick_to_x(val) + xoffset - xpos; + int x = -9; + int w = 18; + + if (tval < 0) { // tval<0 occurs whenever the window is scrolled left, so I switched to signed int (ml) + redraw(); + } + else if (opos > tval) { + w += opos - tval; + x += tval; + } + else { + w += tval - opos; + x += opos; + } + redraw(QRect(x, 0, w, height())); + } + } + +//--------------------------------------------------------- +// mousePressEvent +//--------------------------------------------------------- + +void MTScaleFlo::mousePressEvent(QMouseEvent* event) + { + button = event->button(); + mouseMoveEvent(event); + } + +//--------------------------------------------------------- +// mouseReleaseEvent +//--------------------------------------------------------- + +void MTScaleFlo::mouseReleaseEvent(QMouseEvent*) + { + button = Qt::NoButton; + } + +//--------------------------------------------------------- +// mouseMoveEvent +//--------------------------------------------------------- + +void MTScaleFlo::mouseMoveEvent(QMouseEvent* event) + { + if (event->modifiers() & Qt::ShiftModifier ) + setCursor(QCursor(Qt::PointingHandCursor)); + else + setCursor(QCursor(Qt::ArrowCursor)); + + int tick = AL::sigmap.raster(parent->x_to_tick(event->x()-xoffset+xpos), parent->quant_ticks()); + if (tick<0) tick=0; + + int i; + switch (button) { + case Qt::LeftButton: + i = 0; + break; + case Qt::MidButton: + i = 1; + break; + case Qt::RightButton: + i = 2; + break; + default: + return; // if no button is pressed the function returns here + } + Pos p(tick, true); + + if(i== 0 && (event->modifiers() & Qt::ShiftModifier )) { // If shift +LMB we add a marker + Marker *alreadyExists = song->getMarkerAt(tick); + if (!alreadyExists) + song->addMarker(QString(""), tick, false); + } + else if (i== 2 && (event->modifiers() & Qt::ShiftModifier )) { // If shift +RMB we remove a marker + Marker *toRemove = song->getMarkerAt(tick); + if (toRemove) + song->removeMarker(toRemove); + else + printf("No marker to remove\n"); + } + else + song->setPos(i, p); // all other cases: relocating one of the locators + } + + + +//--------------------------------------------------------- +// draw +//--------------------------------------------------------- + +void MTScaleFlo::draw(QPainter& p, const QRect& r) + { + int x = r.x(); + int w = r.width(); + + x -= 20; + w += 40; // wg. Text + + //--------------------------------------------------- + // draw Marker + //--------------------------------------------------- + + int y = 12; + p.setPen(Qt::black); + p.setFont(config.fonts[4]); + p.drawLine(r.x(), y+1, r.x() + r.width(), y+1); + QRect tr(r); + tr.setHeight(12); + MarkerList* marker = song->marker(); + for (iMarker m = marker->begin(); m != marker->end(); ++m) { + + int xp = parent->tick_to_x(m->second.tick()) + xoffset - xpos; + if (xp > x+w) + break; + int xe = r.x() + r.width(); + iMarker mm = m; + ++mm; + if (mm != marker->end()) + xe = parent->tick_to_x(mm->first) + xoffset - xpos; + + QRect tr(xp, 0, xe-xp, 13); + + QRect wr = r.intersect(tr); + if(!wr.isEmpty()) + { + if (m->second.current()) + p.fillRect(wr, Qt::white); + + int x2; + if (mm != marker->end()) + x2 = parent->tick_to_x(mm->first) + xoffset - xpos; + else + x2 = xp+200; + + if(xp >= -32) + p.drawPixmap(xp, 0, *flagIconS); + + if(xp >= -1023) + { + QRect r = QRect(xp+10, 0, x2-xp, 12); + p.setPen(Qt::black); + p.drawText(r, Qt::AlignLeft|Qt::AlignVCenter, m->second.name()); + } + + if(xp >= 0) + { + p.setPen(Qt::green); + p.drawLine(xp, y, xp, height()); + } + } + } + + //--------------------------------------------------- + // draw location marker + //--------------------------------------------------- + + int h = height()-12; + + for (int i = 0; i < 3; ++i) { + int xp = parent->tick_to_x(pos[i]) + xoffset - xpos; + if (xp >= x && xp < x+w) { + QPixmap* pm = markIcon[i]; + p.drawPixmap(xp - pm->width()/2, y-1, *pm); + } + } + + + //--------------------------------------------------- + // draw beats + //--------------------------------------------------- + + + p.setPen(Qt::black); + + unsigned ctick; + int bar1, bar2, beat; + unsigned tick; + + ctick = parent->x_to_tick(x - xoffset + xpos); + AL::sigmap.tickValues(ctick, &bar1, &beat, &tick); + AL::sigmap.tickValues(parent->x_to_tick(x+w - xoffset + xpos), &bar2, &beat, &tick); + + + int stick = AL::sigmap.bar2tick(bar1, 0, 0); + int ntick; + for (int bar = bar1; bar <= bar2; bar++, stick = ntick) { + ntick = AL::sigmap.bar2tick(bar+1, 0, 0); + int tpix = parent->delta_tick_to_delta_x(ntick - stick); + if (tpix < 64) { + // don�t show beats if measure is this small + int n = 1; + if (tpix < 32) + n = 2; + if (tpix <= 16) + n = 4; + if (tpix < 8) + n = 8; + if (tpix <= 4) + n = 16; + if (tpix <= 2) + n = 32; + if (bar % n) + continue; + p.setFont(config.fonts[3]); + int x = parent->tick_to_x(stick) + xoffset - xpos; + QString s; + s.setNum(bar + 1); + p.drawLine(x, y+1, x, y+1+h); +// QRect r = QRect(x+2, y, 0, h); + QRect r = QRect(x+2, y, 1000, h); + p.drawText(r, Qt::AlignLeft|Qt::AlignVCenter|Qt::TextDontClip, s); + } + else { + int z, n; + AL::sigmap.timesig(stick, z, n); + for (int beat = 0; beat < z; beat++) { + int xp = parent->tick_to_x(AL::sigmap.bar2tick(bar, beat, 0)) + xoffset - xpos; + QString s; + QRect r(xp+2, y, 1000, h); + int y1; + int num; + if (beat == 0) { + num = bar + 1; + y1 = y + 1; + p.setFont(config.fonts[3]); + } + else { + num = beat + 1; + y1 = y + 7; + p.setFont(config.fonts[1]); + r.setY(y+3); + } + s.setNum(num); + p.drawLine(xp, y1, xp, y+1+h); + p.drawText(r, Qt::AlignLeft|Qt::AlignVCenter|Qt::TextDontClip, s); + } + } + } + } + +void MTScaleFlo::set_xpos(int pos) +{ + xpos=pos; + redraw(); +} + +void MTScaleFlo::set_xoffset(int o) +{ + xoffset=o; + redraw(); +} + +void MTScaleFlo::pos_add_changed() +{ + redraw(); +} diff --git a/muse2/muse/widgets/mtscale_flo.h b/muse2/muse/widgets/mtscale_flo.h new file mode 100644 index 00000000..b7856207 --- /dev/null +++ b/muse2/muse/widgets/mtscale_flo.h @@ -0,0 +1,51 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: mtscale_flo.h,v 1.3 2011/05/19 22:27:06 flo Exp $ +// (C) Copyright 1999 Werner Schweer (ws@seh.de) +//========================================================= + +#ifndef __MTSCALE_FLO_H__ +#define __MTSCALE_FLO_H__ + +#include "view.h" + + +class ScoreCanvas; + +//--------------------------------------------------------- +// MTScaleFlo +// scale for midi track +//--------------------------------------------------------- + +class MTScaleFlo : public View { + Q_OBJECT + unsigned pos[3]; + int button; + ScoreCanvas* parent; + int xpos; + int xoffset; + + private slots: + void songChanged(int); + + protected: + virtual void draw(QPainter&, const QRect&); + virtual void mousePressEvent(QMouseEvent* event); + virtual void mouseMoveEvent(QMouseEvent* event); + virtual void mouseReleaseEvent(QMouseEvent* event); + + signals: + void timeChanged(unsigned); + + public slots: + void setPos(int, unsigned, bool); + void set_xpos(int); + void pos_add_changed(); + void set_xoffset(int); + + public: + MTScaleFlo(ScoreCanvas* parent_editor, QWidget* parent_widget); + }; +#endif + diff --git a/muse2/muse/widgets/tb1.cpp b/muse2/muse/widgets/tb1.cpp index 917e6ae2..bd8e94a2 100644 --- a/muse2/muse/widgets/tb1.cpp +++ b/muse2/muse/widgets/tb1.cpp @@ -33,27 +33,16 @@ static const char* rasterStrings[] = { QT_TRANSLATE_NOOP("@default", "Off"), "4pp", "7pp", "64.", "32.", "16.", "8.", "4.", "2.", "1." }; -static int quantTable[] = { - 1, 16, 32, 64, 128, 256, 512, 1024, - 1, 24, 48, 96, 192, 384, 768, 1536, - 1, 36, 72, 144, 288, 576, 1152, 2304 - }; - -static const char* quantStrings[] = { - QT_TRANSLATE_NOOP("@default", "Off"), "64T", "32T", "16T", "8T", "4T", "2T", "1T", - QT_TRANSLATE_NOOP("@default", "Off"), "64", "32", "16", "8", "4", "2", "1", - QT_TRANSLATE_NOOP("@default", "Off"), "64.", "32.", "16.", "8.", "4.", "2.", "1." - }; //--------------------------------------------------------- // genToolbar -// solo time pitch raster quant +// solo time pitch raster //--------------------------------------------------------- -Toolbar1::Toolbar1(QWidget* parent, int r, int q, bool sp) - : QToolBar(QString("Quant'n'Snap-tools"), parent) +Toolbar1::Toolbar1(QWidget* parent, int r, bool sp) + : QToolBar(QString("Pos/Snap/Solo-tools"), parent) { - setObjectName("Quant'n'Snap-tools"); + setObjectName("Pos/Snap/Solo-tools"); pitch = 0; showPitch = sp; // ORCAN - FIXME: Check this: @@ -85,66 +74,34 @@ Toolbar1::Toolbar1(QWidget* parent, int r, int q, bool sp) } //--------------------------------------------------- - // Raster, Quant. + // Raster //--------------------------------------------------- raster = new LabelCombo(tr("Snap"), 0); - quant = new LabelCombo(tr("Quantize"), 0); rlist = new QTableWidget(10, 3); - qlist = new QTableWidget(8, 3); rlist->verticalHeader()->setDefaultSectionSize(22); rlist->horizontalHeader()->setDefaultSectionSize(32); rlist->setSelectionMode(QAbstractItemView::SingleSelection); rlist->verticalHeader()->hide(); rlist->horizontalHeader()->hide(); - qlist->verticalHeader()->setDefaultSectionSize(22); - qlist->horizontalHeader()->setDefaultSectionSize(32); - qlist->setSelectionMode(QAbstractItemView::SingleSelection); - qlist->verticalHeader()->hide(); - qlist->horizontalHeader()->hide(); rlist->setMinimumWidth(96); - qlist->setMinimumWidth(96); raster->setView(rlist); - quant->setView(qlist); for (int j = 0; j < 3; j++) for (int i = 0; i < 10; i++) rlist->setItem(i, j, new QTableWidgetItem(tr(rasterStrings[i + j * 10]))); - for (int j = 0; j < 3; j++) - for (int i = 0; i < 8; i++) - qlist->setItem(i, j, new QTableWidgetItem(tr(quantStrings[i + j * 8]))); setRaster(r); - setQuant(q); addWidget(raster); - addWidget(quant); // FIXME: Not working right. raster->setFixedHeight(38); - quant->setFixedHeight(38); - //--------------------------------------------------- - // To Menu - //--------------------------------------------------- - - addWidget(new QLabel(tr("To"))); - QComboBox* toList = new QComboBox; - toList->setFixedHeight(22); - toList->insertItem(0, tr("All Events")); - toList->insertItem(CMD_RANGE_LOOP, tr("Looped Ev.")); - toList->insertItem(CMD_RANGE_SELECTED, tr("Selected Ev.")); - toList->insertItem(CMD_RANGE_LOOP | CMD_RANGE_SELECTED, tr("Looped+Sel.")); - addWidget(toList); - connect(raster, SIGNAL(activated(int)), SLOT(_rasterChanged(int))); - connect(quant, SIGNAL(activated(int)), SLOT(_quantChanged(int))); - //connect(rlist, SIGNAL(cellClicked(int,int)), SLOT(_rasterChanged(int, int))); - //connect(qlist, SIGNAL(cellClicked(int,int)), SLOT(_quantChanged(int,int))); - connect(toList, SIGNAL(activated(int)), SIGNAL(toChanged(int))); connect(solo, SIGNAL(toggled(bool)), SIGNAL(soloChanged(bool))); pos->setEnabled(false); } @@ -160,16 +117,6 @@ void Toolbar1::_rasterChanged(int /*i*/) //emit rasterChanged(rasterTable[r + c * 10]); } -//--------------------------------------------------------- -// quantChanged -//--------------------------------------------------------- - -void Toolbar1::_quantChanged(int /*i*/) -//void Toolbar1::_quantChanged(int r, int c) - { - emit quantChanged(quantTable[qlist->currentRow() + qlist->currentColumn() * 8]); - //emit quantChanged(quantTable[r + c * 8]); - } //--------------------------------------------------------- // setPitch @@ -226,22 +173,6 @@ void Toolbar1::setRaster(int val) } //--------------------------------------------------------- -// setQuant -//--------------------------------------------------------- - -void Toolbar1::setQuant(int val) - { - for (unsigned i = 0; i < sizeof(quantTable)/sizeof(*quantTable); i++) { - if (val == quantTable[i]) { - quant->setCurrentIndex(i); - return; - } - } - printf("setQuant(%d) not defined\n", val); - quant->setCurrentIndex(0); - } - -//--------------------------------------------------------- // setSolo //--------------------------------------------------------- diff --git a/muse2/muse/widgets/tb1.h b/muse2/muse/widgets/tb1.h index fbed13b1..ff31593f 100644 --- a/muse2/muse/widgets/tb1.h +++ b/muse2/muse/widgets/tb1.h @@ -26,8 +26,6 @@ class Toolbar1 : public QToolBar { QToolButton* solo; PosLabel* pos; PitchLabel* pitch; - LabelCombo* quant; - QTableWidget* qlist; LabelCombo* raster; QTableWidget* rlist; bool showPitch; @@ -35,25 +33,21 @@ class Toolbar1 : public QToolBar { private slots: void _rasterChanged(int); - void _quantChanged(int); public slots: void setTime(unsigned); void setPitch(int); void setInt(int); void setRaster(int); - void setQuant(int); signals: void rasterChanged(int); - void quantChanged(int); void soloChanged(bool); - void toChanged(int); public: //Toolbar1(QMainWindow* parent = 0, int r=96, Toolbar1(QWidget* parent, int r=96, - int q=96, bool showPitch=true); + bool showPitch=true); void setSolo(bool val); void setPitchMode(bool flag); }; diff --git a/muse2/muse/widgets/velocity.cpp b/muse2/muse/widgets/velocity.cpp deleted file mode 100644 index 309beb4d..00000000 --- a/muse2/muse/widgets/velocity.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: velocity.cpp,v 1.1.1.1 2003/10/27 18:55:04 wschweer Exp $ -// (C) Copyright 2001 Werner Schweer (ws@seh.de) -//========================================================= - -#include <QButtonGroup> -#include "velocity.h" - -//--------------------------------------------------------- -// Velocity -//--------------------------------------------------------- - -Velocity::Velocity(QDialog* parent) - : QDialog(parent) - { - setupUi(this); - rangeGroup = new QButtonGroup; - rangeGroup->addButton(allEvents,0); - rangeGroup->addButton(selectedEvents,1); - rangeGroup->addButton(loopedEvents,2); - rangeGroup->addButton(selectedLooped,3); - } - -//--------------------------------------------------------- -// accept -//--------------------------------------------------------- - -void Velocity::accept() - { - _range = rangeGroup->checkedId(); - _rateVal = rate->value(); - _offsetVal = offset->value(); - QDialog::accept(); - } - -//--------------------------------------------------------- -// setRange -//--------------------------------------------------------- - -void Velocity::setRange(int id) - { - rangeGroup->button(id)->setChecked(true); - } - |