diff options
Diffstat (limited to 'muse2/muse/liste')
-rw-r--r-- | muse2/muse/liste/CMakeLists.txt | 23 | ||||
-rw-r--r-- | muse2/muse/liste/editctrlbase.ui | 845 | ||||
-rw-r--r-- | muse2/muse/liste/editevent.cpp | 913 | ||||
-rw-r--r-- | muse2/muse/liste/editevent.h | 170 | ||||
-rw-r--r-- | muse2/muse/liste/listedit.cpp | 109 |
5 files changed, 69 insertions, 1991 deletions
diff --git a/muse2/muse/liste/CMakeLists.txt b/muse2/muse/liste/CMakeLists.txt index c846d665..fce9974b 100644 --- a/muse2/muse/liste/CMakeLists.txt +++ b/muse2/muse/liste/CMakeLists.txt @@ -25,33 +25,13 @@ ## Expand Qt macros in source files ## QT4_WRAP_CPP ( liste_mocs - # listedit.h - # ctrllistedit.h - # tracklistedit.h - # partlistedit.h - # ieventdialog.h - editevent.h listedit.h ) ## -## UI files -## -file (GLOB liste_ui_files - editctrlbase.ui - ) -QT4_WRAP_UI ( liste_uis ${liste_ui_files} ) - -## ## List of source files to compile ## file (GLOB liste_source_files - # listedit.cpp - # ctrllistedit.cpp - # partlistedit.cpp - # tracklistedit.cpp - # ieventdialog.cpp - editevent.cpp listedit.cpp ) @@ -61,7 +41,6 @@ file (GLOB liste_source_files add_library ( liste ${MODULES_BUILD} ${liste_source_files} ${liste_mocs} - ${liste_uis} ) ## @@ -70,7 +49,6 @@ add_library ( liste ${MODULES_BUILD} set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${liste_source_files} - ${liste_ui_files} CACHE INTERNAL "" ) @@ -88,7 +66,6 @@ set_target_properties( liste target_link_libraries ( liste ${QT_LIBRARIES} awl - widgets ) ## diff --git a/muse2/muse/liste/editctrlbase.ui b/muse2/muse/liste/editctrlbase.ui deleted file mode 100644 index c63e1c22..00000000 --- a/muse2/muse/liste/editctrlbase.ui +++ /dev/null @@ -1,845 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>EditCtrlBase</class> - <widget class="QDialog" name="EditCtrlBase"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>601</width> - <height>413</height> - </rect> - </property> - <property name="windowTitle"> - <string>MusE: Edit Controller Event</string> - </property> - <property name="sizeGripEnabled"> - <bool>true</bool> - </property> - <layout class="QGridLayout"> - <item row="0" column="3"> - <widget class="QLabel" name="textLabel1"> - <property name="text"> - <string>Time Position</string> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="0" column="0" colspan="2"> - <widget class="QLabel" name="textLabel1_2"> - <property name="text"> - <string>Available Controller:</string> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QPushButton" name="buttonNewController"> - <property name="text"> - <string>Create New Controller</string> - </property> - <property name="shortcut"> - <string/> - </property> - <property name="autoDefault"> - <bool>true</bool> - </property> - <property name="default"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="0" column="4"> - <widget class="Awl::PosEdit" name="timePos"/> - </item> - <item row="1" column="3" rowspan="2" colspan="2"> - <widget class="QStackedWidget" name="widgetStack"> - <property name="palette"> - <palette> - <active> - <colorrole role="WindowText"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - </brush> - </colorrole> - <colorrole role="Button"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>238</red> - <green>234</green> - <blue>222</blue> - </color> - </brush> - </colorrole> - <colorrole role="Light"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - </brush> - </colorrole> - <colorrole role="Midlight"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>246</red> - <green>244</green> - <blue>238</blue> - </color> - </brush> - </colorrole> - <colorrole role="Dark"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>119</red> - <green>117</green> - <blue>111</blue> - </color> - </brush> - </colorrole> - <colorrole role="Mid"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>158</red> - <green>155</green> - <blue>147</blue> - </color> - </brush> - </colorrole> - <colorrole role="Text"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - </brush> - </colorrole> - <colorrole role="BrightText"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - </brush> - </colorrole> - <colorrole role="ButtonText"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - </brush> - </colorrole> - <colorrole role="Base"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - </brush> - </colorrole> - <colorrole role="Window"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>104</red> - <green>137</green> - <blue>236</blue> - </color> - </brush> - </colorrole> - <colorrole role="Shadow"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - </brush> - </colorrole> - <colorrole role="Highlight"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>0</red> - <green>0</green> - <blue>128</blue> - </color> - </brush> - </colorrole> - <colorrole role="HighlightedText"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - </brush> - </colorrole> - <colorrole role="Link"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - </brush> - </colorrole> - <colorrole role="LinkVisited"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - </brush> - </colorrole> - </active> - <inactive> - <colorrole role="WindowText"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - </brush> - </colorrole> - <colorrole role="Button"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>238</red> - <green>234</green> - <blue>222</blue> - </color> - </brush> - </colorrole> - <colorrole role="Light"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - </brush> - </colorrole> - <colorrole role="Midlight"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - </brush> - </colorrole> - <colorrole role="Dark"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>119</red> - <green>117</green> - <blue>111</blue> - </color> - </brush> - </colorrole> - <colorrole role="Mid"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>158</red> - <green>155</green> - <blue>147</blue> - </color> - </brush> - </colorrole> - <colorrole role="Text"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - </brush> - </colorrole> - <colorrole role="BrightText"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - </brush> - </colorrole> - <colorrole role="ButtonText"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - </brush> - </colorrole> - <colorrole role="Base"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - </brush> - </colorrole> - <colorrole role="Window"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>104</red> - <green>137</green> - <blue>236</blue> - </color> - </brush> - </colorrole> - <colorrole role="Shadow"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - </brush> - </colorrole> - <colorrole role="Highlight"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>0</red> - <green>0</green> - <blue>128</blue> - </color> - </brush> - </colorrole> - <colorrole role="HighlightedText"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - </brush> - </colorrole> - <colorrole role="Link"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>0</red> - <green>0</green> - <blue>192</blue> - </color> - </brush> - </colorrole> - <colorrole role="LinkVisited"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>128</red> - <green>0</green> - <blue>128</blue> - </color> - </brush> - </colorrole> - </inactive> - <disabled> - <colorrole role="WindowText"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>128</red> - <green>128</green> - <blue>128</blue> - </color> - </brush> - </colorrole> - <colorrole role="Button"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>238</red> - <green>234</green> - <blue>222</blue> - </color> - </brush> - </colorrole> - <colorrole role="Light"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - </brush> - </colorrole> - <colorrole role="Midlight"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - </brush> - </colorrole> - <colorrole role="Dark"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>119</red> - <green>117</green> - <blue>111</blue> - </color> - </brush> - </colorrole> - <colorrole role="Mid"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>158</red> - <green>155</green> - <blue>147</blue> - </color> - </brush> - </colorrole> - <colorrole role="Text"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>128</red> - <green>128</green> - <blue>128</blue> - </color> - </brush> - </colorrole> - <colorrole role="BrightText"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - </brush> - </colorrole> - <colorrole role="ButtonText"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>128</red> - <green>128</green> - <blue>128</blue> - </color> - </brush> - </colorrole> - <colorrole role="Base"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - </brush> - </colorrole> - <colorrole role="Window"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>104</red> - <green>137</green> - <blue>236</blue> - </color> - </brush> - </colorrole> - <colorrole role="Shadow"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>0</red> - <green>0</green> - <blue>0</blue> - </color> - </brush> - </colorrole> - <colorrole role="Highlight"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>0</red> - <green>0</green> - <blue>128</blue> - </color> - </brush> - </colorrole> - <colorrole role="HighlightedText"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>255</red> - <green>255</green> - <blue>255</blue> - </color> - </brush> - </colorrole> - <colorrole role="Link"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>0</red> - <green>0</green> - <blue>192</blue> - </color> - </brush> - </colorrole> - <colorrole role="LinkVisited"> - <brush brushstyle="SolidPattern"> - <color alpha="255"> - <red>128</red> - <green>0</green> - <blue>128</blue> - </color> - </brush> - </colorrole> - </disabled> - </palette> - </property> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="WStackPage"> - <layout class="QGridLayout" name="gridLayout1"> - <item row="0" column="1"> - <spacer name="spacer2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Expanding</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="textLabel2"> - <property name="text"> - <string>Controller</string> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLabel" name="controllerName"> - <property name="frameShadow"> - <enum>QFrame::Sunken</enum> - </property> - <property name="text"> - <string>textLabel3</string> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="noteLabel"> - <property name="text"> - <string>Note</string> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QSpinBox" name="noteSpinBox"> - <property name="maximum"> - <number>127</number> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="textLabel4"> - <property name="text"> - <string>Value</string> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QSpinBox" name="valSpinBox"> - <property name="maximum"> - <number>127</number> - </property> - </widget> - </item> - <item row="4" column="0" colspan="2"> - <widget class="QSlider" name="valSlider"> - <property name="maximum"> - <number>127</number> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="WStackPage2"> - <layout class="QGridLayout"> - <item row="2" column="0"> - <widget class="QLabel" name="textLabel2_2"> - <property name="text"> - <string>H-Bank</string> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="textLabel3"> - <property name="text"> - <string>L-Bank</string> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="textLabel4_2"> - <property name="text"> - <string>Program</string> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QSpinBox" name="hbank"> - <property name="specialValueText"> - <string>off</string> - </property> - <property name="minimum"> - <number>0</number> - </property> - <property name="maximum"> - <number>128</number> - </property> - <property name="value"> - <number>0</number> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QSpinBox" name="lbank"> - <property name="specialValueText"> - <string>off</string> - </property> - <property name="minimum"> - <number>0</number> - </property> - <property name="maximum"> - <number>128</number> - </property> - <property name="value"> - <number>0</number> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QSpinBox" name="program"> - <property name="minimum"> - <number>1</number> - </property> - <property name="maximum"> - <number>128</number> - </property> - </widget> - </item> - <item row="0" column="0" colspan="2"> - <spacer name="spacer4"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Expanding</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>140</height> - </size> - </property> - </spacer> - </item> - <item row="1" column="0" colspan="2"> - <widget class="QPushButton" name="patchName"> - <property name="text"> - <string>pushButton4</string> - </property> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - <item row="4" column="0" colspan="5"> - <layout class="QHBoxLayout"> - <property name="spacing"> - <number>6</number> - </property> - <property name="margin"> - <number>0</number> - </property> - <item> - <spacer name="Horizontal Spacing2"> - <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="buttonOk"> - <property name="text"> - <string>&OK</string> - </property> - <property name="shortcut"> - <string/> - </property> - <property name="autoDefault"> - <bool>true</bool> - </property> - <property name="default"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="buttonCancel"> - <property name="text"> - <string>&Cancel</string> - </property> - <property name="shortcut"> - <string/> - </property> - <property name="autoDefault"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </item> - <item row="3" column="0" colspan="5"> - <widget class="Line" name="line1"> - <property name="frameShape"> - <enum>QFrame::HLine</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="lineWidth"> - <number>3</number> - </property> - <property name="midLineWidth"> - <number>2</number> - </property> - </widget> - </item> - <item row="1" column="0" colspan="2"> - <widget class="QListWidget" name="ctrlList"/> - </item> - <item row="2" column="1"> - <spacer name="spacer3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Expanding</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>60</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="0" column="2" rowspan="3"> - <widget class="Line" name="line2"> - <property name="frameShape"> - <enum>QFrame::VLine</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="lineWidth"> - <number>3</number> - </property> - <property name="midLineWidth"> - <number>2</number> - </property> - </widget> - </item> - </layout> - </widget> - <layoutdefault spacing="6" margin="11"/> - <customwidgets> - <customwidget> - <class>Awl::PosEdit</class> - <extends>QWidget</extends> - <header>awl/posedit.h</header> - </customwidget> - </customwidgets> - <resources/> - <connections> - <connection> - <sender>valSlider</sender> - <signal>valueChanged(int)</signal> - <receiver>valSpinBox</receiver> - <slot>setValue(int)</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>valSpinBox</sender> - <signal>valueChanged(int)</signal> - <receiver>valSlider</receiver> - <slot>setValue(int)</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/liste/editevent.cpp b/muse2/muse/liste/editevent.cpp deleted file mode 100644 index 14bd0d8a..00000000 --- a/muse2/muse/liste/editevent.cpp +++ /dev/null @@ -1,913 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: editevent.cpp,v 1.12.2.6 2009/02/02 21:38:00 terminator356 Exp $ -// (C) Copyright 1999-2004 Werner Schweer (ws@seh.de) -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; version 2 of -// the License, or (at your option) any later version. -// -// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -//========================================================= - -#include <stdio.h> - -#include <QBoxLayout> -#include <QHBoxLayout> -#include <QGridLayout> -#include <QLabel> -#include <QListWidget> -#include <QListWidgetItem> -#include <QMessageBox> -#include <QPushButton> -#include <QRadioButton> -#include <QSlider> -#include <QSpinBox> -#include <QTextEdit> -#include <QVBoxLayout> - -#include "awl/posedit.h" - -#include "song.h" -#include "event.h" -#include "midictrl.h" -#include "editevent.h" -#include "pitchedit.h" -#include "intlabel.h" -#include "globals.h" -#include "gconfig.h" -#include "midiport.h" -#include "midiedit/drummap.h" -#include "instruments/minstrument.h" -#include "midi.h" -#include "popupmenu.h" - -namespace MusEGui { - -//--------------------------------------------------------- -// string2qhex -//--------------------------------------------------------- - -QString string2hex(const unsigned char* data, int len) - { - QString d; - QString s; - for (int i = 0; i < len; ++i) { - if ((i > 0) && ((i % 8)==0)) { - d += "\n"; - } - else if (i) - d += " "; - d += s.sprintf("%02x", data[i]); - } - return d; - } - -//--------------------------------------------------------- -// hex2string -//--------------------------------------------------------- - -char* hex2string(QWidget* parent, const char* src, int& len) - { - char buffer[2048]; - char* dst = buffer; - - while (*src) { - while (*src == ' ' || *src == '\n') - ++src; - char* ep; - long val = strtol(src, &ep, 16); - if (ep == src) { - QMessageBox::information(parent, - QString("MusE"), - QWidget::tr("Cannot convert sysex string")); - return 0; - } - src = ep; - *dst++ = val; - if (dst - buffer >= 2048) { - QMessageBox::information(parent, - QString("MusE"), - QWidget::tr("Hex String too long (2048 bytes limit)")); - return 0; - } - } - len = dst - buffer; - if(len == 0) - return 0; - char* b = new char[len+1]; - memcpy(b, buffer, len); - b[len] = 0; - return b; - } - -//--------------------------------------------------------- -// getEvent -//--------------------------------------------------------- - -MusECore::Event EditNoteDialog::getEvent(int tick, const MusECore::Event& event, QWidget* parent) - { - EditNoteDialog* dlg = new EditNoteDialog(tick, event, parent); - MusECore::Event nevent; - if (dlg->exec() == QDialog::Accepted) { - nevent = dlg->event(); - } - delete dlg; - return nevent; - } - -MusECore::Event EditSysexDialog::getEvent(int tick, const MusECore::Event& event, QWidget* parent) - { - EditSysexDialog* dlg = new EditSysexDialog(tick, event, parent); - MusECore::Event nevent; - if (dlg->exec() == QDialog::Accepted) { - nevent = dlg->event(); - } - delete dlg; - return nevent; - } - -MusECore::Event EditMetaDialog::getEvent(int tick, const MusECore::Event& event, QWidget* parent) - { - EditEventDialog* dlg = new EditMetaDialog(tick, event, parent); - MusECore::Event nevent; - if (dlg->exec() == QDialog::Accepted) { - nevent = dlg->event(); - } - delete dlg; - return nevent; - } - -//--------------------------------------------------------- -// EditEventDialog -//--------------------------------------------------------- - -EditEventDialog::EditEventDialog(QWidget* parent) - : QDialog(parent) - { - QVBoxLayout* xlayout = new QVBoxLayout; - layout1 = new QGridLayout; // ddskrjo this - xlayout->addLayout(layout1); - - //--------------------------------------------------- - // Ok, Cancel - //--------------------------------------------------- - - QBoxLayout* w5 = new QHBoxLayout; // ddskrjo this - QPushButton* okB = new QPushButton(tr("Ok")); - okB->setDefault(true); - QPushButton* cancelB = new QPushButton(tr("Cancel")); - okB->setFixedWidth(80); - cancelB->setFixedWidth(80); - w5->addWidget(okB); - w5->addSpacing(12); - w5->addWidget(cancelB); - w5->addStretch(1); - xlayout->addLayout(w5); - setLayout(xlayout); - connect(cancelB, SIGNAL(clicked()), SLOT(reject())); - connect(okB, SIGNAL(clicked()), SLOT(accept())); - } - -//--------------------------------------------------------- -// EditNoteDialog -//--------------------------------------------------------- - -EditNoteDialog::EditNoteDialog(int tick, const MusECore::Event& event, - QWidget* parent) - : QDialog(parent) - { - setupUi(this); - if (!event.empty()) { - epos->setValue(tick); - il1->setValue(event.lenTick()); - pl->setValue(event.pitch()); - il2->setValue(event.velo()); - il3->setValue(event.veloOff()); - } - else { - epos->setValue(tick); - il1->setValue(96); - pl->setValue(64); - il2->setValue(100); - il3->setValue(0); - } - } - -//--------------------------------------------------------- -// EditNoteDialog::event -//--------------------------------------------------------- - -MusECore::Event EditNoteDialog::event() - { - MusECore::Event event(MusECore::Note); - event.setTick(epos->pos().tick()); - event.setA(pl->value()); - event.setB(il2->value()); - event.setC(il3->value()); - event.setLenTick(il1->value()); - return event; - } - -//--------------------------------------------------------- -// EditSysExDialog -//--------------------------------------------------------- - -EditSysexDialog::EditSysexDialog(int tick, const MusECore::Event& event, - QWidget* parent) - : QDialog(parent) - { - setupUi(this); - sysex = 0; - if (!event.empty()) { - epos->setValue(tick); - edit->setText(string2hex(event.data(), event.dataLen())); - } - else { - epos->setValue(tick); - } - } - -//--------------------------------------------------------- -// ~EditSysexDialog -//--------------------------------------------------------- - -EditSysexDialog::~EditSysexDialog() - { - if (sysex) - delete sysex; - } - -//--------------------------------------------------------- -// EditSysExDialog::event -//--------------------------------------------------------- - -MusECore::Event EditSysexDialog::event() - { - MusECore::Event event(MusECore::Sysex); - event.setTick(epos->pos().tick()); - event.setData(sysex, len); - return event; - } - -//--------------------------------------------------------- -// accept -//--------------------------------------------------------- - -void EditSysexDialog::accept() - { - QString qsrc = edit->toPlainText(); - QByteArray ba = qsrc.toLatin1(); - const char* src = ba.constData(); - - sysex = (unsigned char*)hex2string(this, src, len); - if (sysex) - QDialog::accept(); - } - -//--------------------------------------------------------- -// EditMetaDialog -//--------------------------------------------------------- - -EditMetaDialog::EditMetaDialog(int tick, const MusECore::Event& ev, - QWidget* parent) - : EditEventDialog(parent) - { - meta = 0; - setWindowTitle(tr("MusE: Enter Meta Event")); - - QLabel* l1 = new QLabel(tr("Time Position")); - ///epos = new PosEdit; - epos = new Awl::PosEdit; - - QLabel* l2 = new QLabel(tr("Meta Type")); - il2 = new MusEGui::IntLabel(-1, 0, 127, this, -1); - il2->setFixedWidth(100); - il2->setFrame(true); - il2->setDark(); - typeLabel = new QLabel; - typeLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); - QHBoxLayout* typeLayout = new QHBoxLayout; - typeLayout->addWidget(il2); - typeLayout->addWidget(typeLabel); - typeLayout->addStretch(); - - hexButton = new QRadioButton(tr("Enter Hex")); - hexButton->setChecked(true); - connect(hexButton, SIGNAL(toggled(bool)), SLOT(toggled(bool))); - - edit = new QTextEdit; - edit->setFont(MusEGlobal::config.fonts[0]); - - if (!ev.empty()) { - epos->setValue(tick); - il2->setValue(ev.dataA()); - toggled(true); - edit->setText(string2hex(ev.data(), ev.dataLen())); - } - else { - epos->setValue(tick); - il2->setValue(0); - } - - typeChanged(il2->value()); - connect(il2, SIGNAL(valueChanged(int)), SLOT(typeChanged(int))); - - layout1->addWidget(l1, 0, 0); - layout1->addWidget(epos, 0, 1, Qt::AlignLeft); - layout1->addWidget(l2, 1, 0); - - //layout1->addWidget(il2, 1, 1, AlignLeft); - layout1->addLayout(typeLayout, 1, 1); - - //layout1->addMultiCellWidget(hexButton, 2, 2, 0, 1); - //layout1->addMultiCellWidget(edit, 3, 3, 0, 1); - layout1->addWidget(hexButton, 2, 0, 1, 2); - layout1->addWidget(edit, 3, 0, 1, 2); - } - -//--------------------------------------------------------- -// typeChanged -//--------------------------------------------------------- - -void EditMetaDialog::typeChanged(int val) -{ - typeLabel->setText(MusECore::midiMetaName(val)); -} - -//--------------------------------------------------------- -// toggled -//--------------------------------------------------------- - -void EditMetaDialog::toggled(bool flag) - { - QString qsrc = edit->toPlainText(); - QByteArray ba = qsrc.toLatin1(); - const char* src = ba.constData(); - edit->clear(); - - QString dst; - if (flag) { // convert to hex - dst = string2hex((unsigned char*)src, ba.length()); - } - else { // convert to string - int len; - dst = hex2string(this, src, len); - } - edit->setText(dst); - } - -//--------------------------------------------------------- -// ~EditMetaDialog -//--------------------------------------------------------- - -EditMetaDialog::~EditMetaDialog() - { - if (meta) - delete meta; - } - -//--------------------------------------------------------- -// EditMetaDialog::event -//--------------------------------------------------------- - -MusECore::Event EditMetaDialog::event() - { - MusECore::Event event(MusECore::Meta); - event.setTick(epos->pos().tick()); - event.setA(il2->value()); - event.setData(meta, len); // TODO ?? - return event; - } - -//--------------------------------------------------------- -// accept -//--------------------------------------------------------- - -void EditMetaDialog::accept() - { - QString qsrc = edit->toPlainText(); - QByteArray ba = qsrc.toLatin1(); - const char* src = ba.constData(); - if (!hexButton->isChecked()) { - meta = (unsigned char*)strdup(src); - len = ba.length(); - QDialog::accept(); - return; - } - - meta = (unsigned char*)hex2string(this, src, len); - if (meta) - QDialog::accept(); - } - -//--------------------------------------------------------- -// getEvent -//--------------------------------------------------------- - -MusECore::Event EditCtrlDialog::getEvent(int tick, const MusECore::Event& event, - const MusECore::MidiPart* part, QWidget* parent) - { - EditCtrlDialog* dlg = new EditCtrlDialog(tick, event, part, parent); - MusECore::Event nevent; - if (dlg->exec() == QDialog::Accepted) { - nevent = dlg->event(); - } - delete dlg; - return nevent; - } - -//--------------------------------------------------------- -// EditCtrlDialog::event -//--------------------------------------------------------- - -MusECore::Event EditCtrlDialog::event() - { - MusECore::Event event(MusECore::Controller); - event.setTick(timePos->pos().tick()); - - int cnum = 0; - QListWidgetItem* item = ctrlList->currentItem(); - if(item != 0) - cnum = item->data(Qt::UserRole).toInt(); - - MusECore::MidiTrack* track = part->track(); - bool isDrum = track->type() == MusECore::Track::DRUM; - MusECore::MidiPort* port = &MusEGlobal::midiPorts[track->outPort()]; - int channel = track->outChannel(); - - int evnum = cnum; - int num = cnum; - if((cnum & 0xff) == 0xff) - { - evnum = (cnum & ~0xff) | (noteSpinBox->value() & 0x7f); - num = evnum; - if(isDrum) - { - MusECore::DrumMap* dm = &MusEGlobal::drumMap[noteSpinBox->value() & 0x7f]; - num = (cnum & ~0xff) | dm->anote; - // Default to track port if -1 and track channel if -1. - if(dm->port != -1) - port = &MusEGlobal::midiPorts[dm->port]; - if(dm->channel != -1) - channel = dm->channel; - } - } - - MusECore::MidiController* c = port->midiController(cnum); - MusECore::MidiCtrlValListList* cll = port->controller(); - - if(cll->find(channel, num) == cll->end()) - { - MusECore::MidiCtrlValList* vl = new MusECore::MidiCtrlValList(num); - cll->add(channel, vl); - } - - event.setA(evnum); - if(cnum == MusECore::CTRL_PROGRAM) - { - int hb = hbank->value(); - int lb = lbank->value(); - int prog = program->value(); - if (hb > 0 && hb < 129) - hb -= 1; - else - hb = 0xff; - if (lb > 0 && lb < 129) - lb -= 1; - else - lb = 0xff; - if (prog > 0 && prog < 129) - prog -= 1; - else - prog = 0xff; - int val = (hb << 16) + (lb << 8) + prog; - event.setB(val); - } - else - event.setB(valSlider->value() + c->bias()); - return event; - } - -//--------------------------------------------------------- -// EditCtrlDialog -// PosEdit* timePos; -// QSlider* valSlider; -// QSpinBox* valSpinBox; -// QLabel* controllerName; -// QListWidget* ctrlList; -// QPushButton* buttonNewController; -//--------------------------------------------------------- - -struct CI { - int num; - QString s; - bool used; - bool off; - bool instrument; - CI(int n, const QString& ss, bool u, bool o, bool i) : num(n), s(ss), used(u), off(o), instrument(i) {} - }; - -EditCtrlDialog::EditCtrlDialog(int tick, const MusECore::Event& event, - const MusECore::MidiPart* p, QWidget* parent) - : QDialog(parent), part(p) - { - setupUi(this); - widgetStack->setAutoFillBackground(true); - - MusECore::MidiTrack* track = part->track(); - MusECore::MidiPort* port = &MusEGlobal::midiPorts[track->outPort()]; - bool isDrum = track->type() == MusECore::Track::DRUM; - bool isNewDrum = track->type() == MusECore::Track::NEW_DRUM; - bool isMidi = track->type() == MusECore::Track::MIDI; - MusECore::MidiCtrlValListList* cll = port->controller(); - int channel = track->outChannel(); - MusECore::MidiInstrument* instr = port->instrument(); - MusECore::MidiControllerList* mcl = instr->controller(); - int val = 0; - int ev_num = 0; - int num = 0; - int ev_cnum = 0; - int ev_note = -1; - if (!event.empty()) { - ev_num = event.dataA(); - num = ev_num; - ev_cnum = ev_num; - val = event.dataB(); - if(port->drumController(ev_num)) - { - ev_cnum |= 0xff; - if(isDrum) - num = (ev_num & ~0xff) | MusEGlobal::drumMap[ev_num & 0xff].anote; - ev_note = ev_num & 0xff; - } - } - - MusECore::MidiController* mc = port->midiController(ev_num); - - ctrlList->clear(); - ctrlList->setSelectionMode(QAbstractItemView::SingleSelection); - - //--------------------------------------------------- - // build list of midi controllers for current - // MusECore::MidiPort/channel - //--------------------------------------------------- - - std::list<CI> sList; - typedef std::list<CI>::iterator isList; - std::set<int> already_added_nums; - - for (MusECore::iMidiCtrlValList it = cll->begin(); it != cll->end(); ++it) { - MusECore::MidiCtrlValList* cl = it->second; - int ch = it->first >> 24; - if(ch != channel) - continue; - MusECore::MidiController* c = port->midiController(cl->num()); - bool isDrumCtrl = (c->isPerNoteController()); - int show = c->showInTracks(); - int cnum = c->num(); - int clnum = cl->num(); - isList i = sList.begin(); - for (; i != sList.end(); ++i) { - if (i->num == cnum) - break; - } - - if (i == sList.end()) { - bool used = (clnum == num); - bool off = cl->hwVal() == MusECore::CTRL_VAL_UNKNOWN; // Does it have a value or is it 'off'? - // Filter if not used and off. But if there's something there, we must show it. - //if(!used && off && - if(!used && //off && - (((isDrumCtrl || isNewDrum) && !(show & MusECore::MidiController::ShowInDrum)) || - (isMidi && !(show & MusECore::MidiController::ShowInMidi)))) - continue; - bool isinstr = mcl->find(cnum) != mcl->end(); - // Need to distinguish between global default controllers and - // instrument defined controllers. Instrument takes priority over global - // ie they 'overtake' definition of a global controller such that the - // global def is no longer available. - //sList.push_back(CI(num, - sList.push_back(CI(cnum, - isinstr ? MusECore::midiCtrlNumString(cnum, true) + c->name() : MusECore::midiCtrlName(cnum, true), - used, off, isinstr)); - already_added_nums.insert(num); - } - } - - // Add instrument-defined controllers: - QListWidgetItem* sel_item = 0; - for (isList i = sList.begin(); i != sList.end(); ++i) - { - // Filter if not used and off. But if there's something there, we must show it. - if(!i->instrument && !i->used && i->off) - continue; - QListWidgetItem* item = new QListWidgetItem(i->s, ctrlList); - item->setData(Qt::UserRole, i->num); - if(i->num == ev_cnum) - sel_item = item; - } - if(sel_item) - ctrlList->setCurrentItem(sel_item); - - valSlider->setRange(mc->minVal(), mc->maxVal()); - valSpinBox->setRange(mc->minVal(), mc->maxVal()); - - controllerName->setText(mc->name()); - - if(!event.empty()) - { - if(ev_num == MusECore::CTRL_PROGRAM) - { - widgetStack->setCurrentIndex(1); - updatePatch(val); - } - else - { - widgetStack->setCurrentIndex(0); - valSlider->setValue(val - mc->bias()); - - if(mc->isPerNoteController()) - { - noteSpinBox->setVisible(true); - noteSpinBox->setEnabled(true); - noteLabel->setVisible(true); - noteLabel->setEnabled(true); - if(ev_note != -1) - noteSpinBox->setValue(ev_note); - } - else - { - noteSpinBox->setEnabled(false); - noteSpinBox->setVisible(false); - noteLabel->setEnabled(false); - noteLabel->setVisible(false); - } - } - } - else - { - noteSpinBox->setEnabled(false); - noteSpinBox->setVisible(false); - noteLabel->setEnabled(false); - noteLabel->setVisible(false); - if(sel_item) - ctrlListClicked(sel_item); - } - connect(ctrlList, SIGNAL(itemClicked(QListWidgetItem*)), SLOT(ctrlListClicked(QListWidgetItem*))); - connect(buttonNewController, SIGNAL(clicked()), SLOT(newController())); - connect(hbank, SIGNAL(valueChanged(int)), SLOT(programChanged())); - connect(lbank, SIGNAL(valueChanged(int)), SLOT(programChanged())); - connect(program, SIGNAL(valueChanged(int)), SLOT(programChanged())); - connect(patchName, SIGNAL(released()), SLOT(instrPopup())); - connect(buttonCancel, SIGNAL(clicked()), SLOT(reject())); - connect(buttonOk, SIGNAL(clicked()), SLOT(accept())); - timePos->setValue(tick); - - } -//--------------------------------------------------------- -// newController -//--------------------------------------------------------- - -void EditCtrlDialog::newController() - { - MusEGui::PopupMenu* pup = new MusEGui::PopupMenu(this); - - // populate popup with all controllers available for - // current instrument - - MusECore::MidiTrack* track = part->track(); - int portn = track->outPort(); - MusECore::MidiPort* port = &MusEGlobal::midiPorts[portn]; - bool isDrum = track->type() == MusECore::Track::DRUM; - bool isNewDrum = track->type() == MusECore::Track::NEW_DRUM; - bool isMidi = track->type() == MusECore::Track::MIDI; - MusECore::MidiInstrument* instr = port->instrument(); - MusECore::MidiControllerList* mcl = instr->controller(); - - MusECore::MidiCtrlValListList* cll = port->controller(); - int channel = track->outChannel(); - for (MusECore::iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) - { - MusECore::MidiController* c = ci->second; - int cnum = c->num(); - int show = c->showInTracks(); - if(((isDrum || isNewDrum) && !(show & MusECore::MidiController::ShowInDrum)) || - (isMidi && !(show & MusECore::MidiController::ShowInMidi))) - continue; - // If it's not already in the parent menu... - int idx = 0; - for(; idx < ctrlList->count(); ++idx) { - if(ctrlList->item(idx)->data(Qt::UserRole).toInt() == cnum) - break; - } - if(idx >= ctrlList->count()) { - QAction* act = pup->addAction(MusECore::midiCtrlNumString(cnum, true) + c->name()); - act->setData(cnum); - } - } - - QAction* act = pup->exec(buttonNewController->mapToGlobal(QPoint(0,0))); - if (act && act->data().toInt() != -1) { - int rv = act->data().toInt(); - int cnum = rv; - for (MusECore::iMidiController ci = mcl->begin(); ci != mcl->end(); ++ci) { - MusECore::MidiController* mc = ci->second; - if (mc->num() == cnum) { - // Create a new controller list if it does not exist. - // FIXME: Sorry no per-pitch controller lists created here - // (meaning you should only create one 'new' one at a time) - // because the user has not had a chance to choose a pitch yet. - // They are handled in accept(), where there are more checks and creations. - if(!mc->isPerNoteController() && cll->find(channel, rv) == cll->end()) - { - MusECore::MidiCtrlValList* vl = new MusECore::MidiCtrlValList(rv); - cll->add(channel, vl); - } - int idx = 0; - for (; idx < ctrlList->count() ;++idx) { - QListWidgetItem* item = ctrlList->item(idx); - int item_data = item->data(Qt::UserRole).toInt(); - if(item_data == cnum) - { - ctrlList->setCurrentItem(item); - ctrlListClicked(item); - break; - } - } - if (idx >= ctrlList->count()) { - QListWidgetItem* new_item = new QListWidgetItem(act->text(), ctrlList); - new_item->setData(Qt::UserRole, cnum); - ctrlList->setCurrentItem(new_item); - ctrlListClicked(new_item); - break; - } - break; - } - } - } - delete pup; - } -//--------------------------------------------------------- -// ctrlListClicked -//--------------------------------------------------------- - -void EditCtrlDialog::ctrlListClicked(QListWidgetItem* item) - { - if(item == 0) - return; - int cnum = item->data(Qt::UserRole).toInt(); - MusECore::MidiTrack* track = part->track(); - int portn = track->outPort(); - MusECore::MidiPort* port = &MusEGlobal::midiPorts[portn]; - MusECore::MidiController* c = port->midiController(cnum); - int val; - if (cnum == MusECore::CTRL_PROGRAM) { - widgetStack->setCurrentIndex(1); - - val = c->initVal(); - if(val == MusECore::CTRL_VAL_UNKNOWN) - val = 0; - updatePatch(val); - } - else { - widgetStack->setCurrentIndex(0); - if(c->isPerNoteController()) - { - noteSpinBox->setEnabled(true); - noteSpinBox->setVisible(true); - noteLabel->setEnabled(true); - noteLabel->setVisible(true); - } - else - { - noteSpinBox->setEnabled(false); - noteSpinBox->setVisible(false); - noteLabel->setEnabled(false); - noteLabel->setVisible(false); - } - valSlider->setRange(c->minVal(), c->maxVal()); - valSpinBox->setRange(c->minVal(), c->maxVal()); - controllerName->setText(c->name()); - val = c->initVal(); - - if(val == MusECore::CTRL_VAL_UNKNOWN || val == 0) - { - switch(cnum) - { - case MusECore::CTRL_PANPOT: - val = 64 - c->bias(); - break; - case MusECore::CTRL_VOLUME: - val = 100; - break; - default: - val = 0; - break; - } - } - valSlider->setValue(val); - } - } - -//--------------------------------------------------------- -// updatePatch -//--------------------------------------------------------- - -void EditCtrlDialog::updatePatch(int val) - { - MusECore::MidiTrack* track = part->track(); - int port = track->outPort(); - int channel = track->outChannel(); - MusECore::MidiInstrument* instr = MusEGlobal::midiPorts[port].instrument(); - patchName->setText(instr->getPatchName(channel, val, track->isDrumTrack())); - - int hb = ((val >> 16) & 0xff) + 1; - if (hb == 0x100) - hb = 0; - int lb = ((val >> 8) & 0xff) + 1; - if (lb == 0x100) - lb = 0; - int pr = (val & 0xff) + 1; - if (pr == 0x100) - pr = 0; - - hbank->blockSignals(true); - lbank->blockSignals(true); - program->blockSignals(true); - - hbank->setValue(hb); - lbank->setValue(lb); - program->setValue(pr); - - hbank->blockSignals(false); - lbank->blockSignals(false); - program->blockSignals(false); - } - -//--------------------------------------------------------- -// instrPopup -//--------------------------------------------------------- - -void EditCtrlDialog::instrPopup() - { - MusECore::MidiTrack* track = part->track(); - int channel = track->outChannel(); - int port = track->outPort(); - MusECore::MidiInstrument* instr = MusEGlobal::midiPorts[port].instrument(); - - MusEGui::PopupMenu* pup = new MusEGui::PopupMenu(this); - instr->populatePatchPopup(pup, channel, track->isDrumTrack()); - - if(pup->actions().count() == 0) - { - delete pup; - return; - } - - QAction* rv = pup->exec(patchName->mapToGlobal(QPoint(10,5))); - if (rv) { - updatePatch(rv->data().toInt()); - } - - delete pup; - } - -//--------------------------------------------------------- -// programChanged -//--------------------------------------------------------- - -void EditCtrlDialog::programChanged() - { - int hb = hbank->value(); - int lb = lbank->value(); - int prog = program->value(); - - if (hb > 0 && hb < 129) - hb -= 1; - else - hb = 0xff; - if (lb > 0 && lb < 129) - lb -= 1; - else - lb = 0xff; - if (prog > 0 && prog < 129) - prog -= 1; - else - prog = 0xff; - - int val = (hb << 16) + (lb << 8) + prog; - updatePatch(val); - } - -} // namespace MusEGui diff --git a/muse2/muse/liste/editevent.h b/muse2/muse/liste/editevent.h deleted file mode 100644 index 0674fe30..00000000 --- a/muse2/muse/liste/editevent.h +++ /dev/null @@ -1,170 +0,0 @@ -//========================================================= -// MusE -// Linux Music Editor -// $Id: editevent.h,v 1.6.2.1 2008/05/21 00:28:53 terminator356 Exp $ -// (C) Copyright 1999 Werner Schweer (ws@seh.de) -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; version 2 of -// the License, or (at your option) any later version. -// -// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -//========================================================= - -#ifndef __EDIT_EVENT_H__ -#define __EDIT_EVENT_H__ - -#include "ui_editnotedialogbase.h" -#include "ui_editsysexdialogbase.h" -#include "ui_editctrlbase.h" -#include "event.h" - -class QDialog; -class QLabel; -class QGridLayout; -class QTextEdit; -class QRadioButton; -class QListWidgetItem; -class QMenu; - -namespace Awl { - class PosEdit; - }; - -namespace MusECore { -class MidiPart; -} - -namespace MusEGui { - -class IntLabel; -class PitchEdit; - - -//--------------------------------------------------------- -// EditEventDialog -//--------------------------------------------------------- - -class EditEventDialog : public QDialog { - Q_OBJECT - - protected: - QGridLayout* layout1; - - public: - EditEventDialog(QWidget* parent=0); - virtual MusECore::Event event() = 0; - }; - -//--------------------------------------------------------- -// EditNoteDialog -//--------------------------------------------------------- - -class EditNoteDialog : public QDialog, public Ui::EditNoteDialogBase { - Q_OBJECT - - public: - EditNoteDialog(int tick, const MusECore::Event&, - QWidget* parent=0); - static MusECore::Event getEvent(int tick, const MusECore::Event&, - QWidget* parent = 0); - virtual MusECore::Event event(); - }; - -//--------------------------------------------------------- -// EditSysExDialog -//--------------------------------------------------------- - -class EditSysexDialog : public QDialog, public Ui::EditSysexDialogBase { - Q_OBJECT - - unsigned char* sysex; - int len; - - protected: - QGridLayout* layout; - - private slots: - virtual void accept(); - - public: - EditSysexDialog(int tick, const MusECore::Event&, - QWidget* parent=0); - ~EditSysexDialog(); - static MusECore::Event getEvent(int tick, const MusECore::Event&, - QWidget* parent = 0); - virtual MusECore::Event event(); - }; - -//--------------------------------------------------------- -// EditCtrlDialog -//--------------------------------------------------------- - -class EditCtrlDialog : public QDialog, public Ui::EditCtrlBase { - Q_OBJECT - - const MusECore::MidiPart* part; - void updatePatch(int val); - - private slots: - void ctrlListClicked(QListWidgetItem*); - void newController(); - void programChanged(); - void instrPopup(); - - protected: - QGridLayout* layout; - - public: - EditCtrlDialog(int tick, const MusECore::Event&, - const MusECore::MidiPart*, QWidget* parent=0); - static MusECore::Event getEvent(int tick, const MusECore::Event&, const MusECore::MidiPart*, - QWidget* parent = 0); - virtual MusECore::Event event(); - }; - -//--------------------------------------------------------- -// EditMetaDialog -//--------------------------------------------------------- - -class EditMetaDialog : public EditEventDialog { - Q_OBJECT - - unsigned char* meta; - int len; - Awl::PosEdit* epos; - QTextEdit* edit; - MusEGui::IntLabel* il2; - QRadioButton* hexButton; - QLabel* typeLabel; - - protected: - QGridLayout* layout; - - private slots: - virtual void accept(); - void toggled(bool); - void typeChanged(int); - - public: - EditMetaDialog(int tick, const MusECore::Event&, - QWidget* parent=0); - ~EditMetaDialog(); - static MusECore::Event getEvent(int tick, const MusECore::Event&, - QWidget* parent = 0); - virtual MusECore::Event event(); - }; - -} // namespace MusEGui - -#endif - diff --git a/muse2/muse/liste/listedit.cpp b/muse2/muse/liste/listedit.cpp index 730ab5d8..79f10b4b 100644 --- a/muse2/muse/liste/listedit.cpp +++ b/muse2/muse/liste/listedit.cpp @@ -45,6 +45,7 @@ #include "event.h" #include "midiport.h" #include "midictrl.h" +#include "minstrument.h" #include "app.h" #include "gconfig.h" @@ -201,7 +202,8 @@ void ListEdit::songChanged(MusECore::SongChangedFlags_t type) if (type == 0) return; - if (type & (SC_PART_REMOVED | SC_PART_MODIFIED + if (type & (// SC_MIDI_TRACK_PROP FIXME Needed, but might make it slow! + SC_PART_REMOVED | SC_PART_MODIFIED | SC_PART_INSERTED | SC_EVENT_REMOVED | SC_EVENT_MODIFIED | SC_EVENT_INSERTED | SC_SELECTION)) { if (type & (SC_PART_REMOVED | SC_PART_INSERTED | SC_PART_MODIFIED)) @@ -285,7 +287,6 @@ void ListEdit::songChanged(MusECore::SongChangedFlags_t type) QString EventListItem::text(int col) const { QString s; - QString commentLabel; switch(col) { case 0: s.setNum(event.tick()); @@ -324,30 +325,9 @@ QString EventListItem::text(int col) const } break; case MusECore::Sysex: - { - commentLabel = QString("len "); - QString k; - k.setNum(event.dataLen()); - commentLabel += k; - commentLabel += QString(" "); - - commentLabel += MusECore::nameSysex(event.dataLen(), event.data()); - int i; - for (i = 0; i < 10; ++i) { - if (i >= event.dataLen()) - break; - commentLabel += QString(" 0x"); - QString k; - k.setNum(event.data()[i] & 0xff, 16); - commentLabel += k; - } - if (i == 10) - commentLabel += QString("..."); - } s = QString("SysEx"); break; case MusECore::Meta: - commentLabel = midiMetaComment(event); s = QString("Meta"); break; case MusECore::Wave: @@ -357,7 +337,14 @@ QString EventListItem::text(int col) const } break; case 3: - s.setNum(part->track()->outChannel() + 1); + switch(event.type()) { + case MusECore::Sysex: + case MusECore::Meta: + break; + + default: + s.setNum(part->track()->outChannel() + 1); + } break; case 4: if (event.isNote()) @@ -365,7 +352,16 @@ QString EventListItem::text(int col) const else if (event.type() == MusECore::Controller) s.setNum(event.dataA() & 0xffff); // mask off type bits else - s.setNum(event.dataA()); + { + switch(event.type()) { + case MusECore::Sysex: + case MusECore::Meta: + break; + + default: + s.setNum(event.dataA()); + } + } break; case 5: if(event.type() == MusECore::Controller && @@ -384,13 +380,41 @@ QString EventListItem::text(int col) const s.sprintf("%d-%d-%d", hb, lb, pr); } else - s.setNum(event.dataB()); + { + switch(event.type()) { + case MusECore::Sysex: + case MusECore::Meta: + break; + + default: + s.setNum(event.dataB()); + } + } break; case 6: - s.setNum(event.dataC()); + switch(event.type()) { + case MusECore::Sysex: + case MusECore::Meta: + break; + + default: + s.setNum(event.dataC()); + } break; case 7: - s.setNum(event.lenTick()); + switch(event.type()) { + case MusECore::Sysex: + case MusECore::Meta: + s.setNum(event.dataLen()); + break; + + case MusECore::Controller: + break; + + default: + s.setNum(event.lenTick()); + break; + } break; case 8: switch(event.type()) { @@ -402,14 +426,13 @@ QString EventListItem::text(int col) const } break; case MusECore::Sysex: + case MusECore::Meta: { - s = QString("len "); - QString k; - k.setNum(event.dataLen()); - s += k; - s += QString(" "); - - commentLabel += MusECore::nameSysex(event.dataLen(), event.data()); + if(event.type() == MusECore::Sysex) + s = MusECore::nameSysex(event.dataLen(), event.data(), + MusEGlobal::midiPorts[part->track()->outPort()].instrument()) + QString(" "); + else if(event.type() == MusECore::Meta) + s = midiMetaComment(event) + QString(" "); int i; for (i = 0; i < 10; ++i) { if (i >= event.dataLen()) @@ -421,11 +444,9 @@ QString EventListItem::text(int col) const } if (i == 10) s += QString("..."); + } break; - case MusECore::Meta: - s = midiMetaComment(event); - break; default: break; } @@ -623,7 +644,10 @@ void ListEdit::editInsertSysEx() if(!curPart) return; - MusECore::Event event = EditSysexDialog::getEvent(curPart->tick(), MusECore::Event(), this); + MusECore::MidiInstrument* minstr = NULL; + if(curPart->track()) + minstr = MusEGlobal::midiPorts[curPart->track()->outPort()].instrument(); + MusECore::Event event = EditSysexDialog::getEvent(curPart->tick(), MusECore::Event(), this, minstr); if (!event.empty()) { //No events before beginning of part + take Part offset into consideration unsigned tick = event.tick(); @@ -699,7 +723,12 @@ void ListEdit::editEvent(MusECore::Event& event, MusECore::MidiPart* part) nevent = EditCtrlDialog::getEvent(tick, event, part, this); break; case MusECore::Sysex: - nevent = EditSysexDialog::getEvent(tick, event, this); + { + MusECore::MidiInstrument* minstr = NULL; + if(part->track()) + minstr = MusEGlobal::midiPorts[part->track()->outPort()].instrument(); + nevent = EditSysexDialog::getEvent(tick, event, this, minstr); + } break; case MusECore::Meta: nevent = EditMetaDialog::getEvent(tick, event, this); |