summaryrefslogtreecommitdiff
path: root/muse_qt4_evolution/muse/liste
diff options
context:
space:
mode:
authorRobert Jonsson <spamatica@gmail.com>2009-12-27 11:30:35 +0000
committerRobert Jonsson <spamatica@gmail.com>2009-12-27 11:30:35 +0000
commitb703eab295330e6f81564fbb39a10a1a2fdd2f54 (patch)
treee46b5c9a6bc22fd661c15d1d2123f5bf631cef80 /muse_qt4_evolution/muse/liste
parent5d5fa0fdf913907edbc3d2d29a7548f0cb658c94 (diff)
moved old qt4 branch
Diffstat (limited to 'muse_qt4_evolution/muse/liste')
-rw-r--r--muse_qt4_evolution/muse/liste/CMakeLists.txt48
-rw-r--r--muse_qt4_evolution/muse/liste/ctrllistedit.cpp569
-rw-r--r--muse_qt4_evolution/muse/liste/ctrllistedit.h96
-rw-r--r--muse_qt4_evolution/muse/liste/ctrllistedit.ui334
-rw-r--r--muse_qt4_evolution/muse/liste/ieventdialog.cpp428
-rw-r--r--muse_qt4_evolution/muse/liste/ieventdialog.h117
-rw-r--r--muse_qt4_evolution/muse/liste/listedit.cpp298
-rw-r--r--muse_qt4_evolution/muse/liste/listedit.h98
-rw-r--r--muse_qt4_evolution/muse/liste/partlistedit.cpp434
-rw-r--r--muse_qt4_evolution/muse/liste/partlistedit.h79
-rw-r--r--muse_qt4_evolution/muse/liste/partlistedit.ui166
-rw-r--r--muse_qt4_evolution/muse/liste/tracklistedit.cpp65
-rw-r--r--muse_qt4_evolution/muse/liste/tracklistedit.h50
-rw-r--r--muse_qt4_evolution/muse/liste/tracklistedit.ui146
14 files changed, 2928 insertions, 0 deletions
diff --git a/muse_qt4_evolution/muse/liste/CMakeLists.txt b/muse_qt4_evolution/muse/liste/CMakeLists.txt
new file mode 100644
index 00000000..988efaf8
--- /dev/null
+++ b/muse_qt4_evolution/muse/liste/CMakeLists.txt
@@ -0,0 +1,48 @@
+#=============================================================================
+# 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.
+#=============================================================================
+
+QT4_WRAP_CPP ( liste_mocs
+ listedit.h
+ ctrllistedit.h
+ tracklistedit.h
+ partlistedit.h
+ ieventdialog.h
+ )
+
+QT4_WRAP_UI ( liste_ui_headers
+ ctrllistedit.ui
+ partlistedit.ui
+ tracklistedit.ui
+ )
+
+add_library ( liste STATIC
+ listedit.cpp listedit.h
+ ctrllistedit.cpp ctrllistedit.h
+ partlistedit.cpp partlistedit.h
+ tracklistedit.cpp tracklistedit.h
+ ieventdialog.cpp ieventdialog.h
+ ${liste_mocs}
+ ${liste_ui_headers}
+ )
+set_target_properties( liste
+ PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h"
+ )
+
+
diff --git a/muse_qt4_evolution/muse/liste/ctrllistedit.cpp b/muse_qt4_evolution/muse/liste/ctrllistedit.cpp
new file mode 100644
index 00000000..ab9e66e3
--- /dev/null
+++ b/muse_qt4_evolution/muse/liste/ctrllistedit.cpp
@@ -0,0 +1,569 @@
+//=============================================================================
+// 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.
+//=============================================================================
+
+#include "ctrllistedit.h"
+#include "ctrl.h"
+#include "track.h"
+#include "song.h"
+#include "al/pos.h"
+#include "awl/posedit.h"
+
+//---------------------------------------------------------
+// CtrlListEditor
+//---------------------------------------------------------
+
+CtrlListEditor::CtrlListEditor(ListEdit* e, QWidget* parent)
+ : ListWidget(parent)
+ {
+ listEdit = e;
+ updateListDisabled = false;
+ QWidget* cew = new QWidget;
+ le.setupUi(cew);
+ QVBoxLayout* layout = new QVBoxLayout;
+ layout->addWidget(cew);
+ setLayout(layout);
+ le.minValue->setRange(-10000000.0, 100000000.0);
+ le.maxValue->setRange(-10000000.0, 100000000.0);
+ le.defaultValue->setRange(-10000000.0, 100000000.0);
+ le.minValue->setSingleStep(1.0);
+ le.maxValue->setSingleStep(1.0);
+ le.defaultValue->setSingleStep(1.0);
+
+ QFontMetrics fm(le.ctrlList->font());
+ int zW = fm.width("0");
+ le.ctrlList->setColumnWidth(TICK_COL, zW * 8);
+ le.ctrlList->setColumnWidth(TIME_COL, zW * 14);
+ CtrlDelegate* ctrlDelegate = new CtrlDelegate(this);
+ le.ctrlList->setItemDelegate(ctrlDelegate);
+
+ track = 0;
+ connect(le.ctrlList, SIGNAL(itemActivated(QTreeWidgetItem*, int)),
+ SLOT(itemActivated(QTreeWidgetItem*,int)));
+ connect(le.ctrlList, SIGNAL(itemChanged(QTreeWidgetItem*, int)),
+ SLOT(itemChanged(QTreeWidgetItem*, int)));
+ connect(le.ctrlList, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
+ SLOT(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)));
+ connect(le.insertButton, SIGNAL(clicked()), SLOT(insertClicked()));
+ connect(le.deleteButton, SIGNAL(clicked()), SLOT(deleteClicked()));
+ connect(le.controllerName, SIGNAL(textEdited(const QString&)),
+ SLOT(nameEdited(const QString&)));
+ connect(le.minValue, SIGNAL(valueChanged(double)), SLOT(minValChanged(double)));
+ connect(le.maxValue, SIGNAL(valueChanged(double)), SLOT(maxValChanged(double)));
+ connect(le.defaultValue, SIGNAL(valueChanged(double)), SLOT(defaultValChanged(double)));
+ EscapeFilter* ef = new EscapeFilter(this);
+ installEventFilter(ef);
+ }
+
+//---------------------------------------------------------
+// eventFilter
+//---------------------------------------------------------
+
+bool EscapeFilter::eventFilter(QObject* obj, QEvent* event)
+ {
+ if (event->type() == QEvent::KeyPress) {
+ if (((QKeyEvent*)event)->key() == Qt::Key_Escape) {
+ ((CtrlListEditor*)parent())->sendEscape();
+ return true;
+ }
+ }
+ return QObject::eventFilter(obj, event);
+ }
+
+//---------------------------------------------------------
+// setup
+//---------------------------------------------------------
+
+void CtrlListEditor::setup(const ListType& lt)
+ {
+ if (track)
+ disconnect(track, SIGNAL(controllerChanged(int)), this, SLOT(controllerChanged(int)));
+ track = lt.track;
+ connect(track, SIGNAL(controllerChanged(int)), SLOT(controllerChanged(int)));
+
+ c = lt.ctrl;
+ le.controllerName->setText(c->name());
+ le.discreteCheckBox->setChecked(c->type() & Ctrl::DISCRETE);
+ le.logarithmicCheckBox->setChecked(c->type() & Ctrl::LOG);
+ le.floatCheckBox->setChecked(!(c->type() & Ctrl::INT));
+ le.ctrlId->setValue(c->id());
+ if (c->type() & Ctrl::INT) {
+ le.minValue->setDecimals(0);
+ le.minValue->setValue(c->minVal().i);
+ le.maxValue->setDecimals(0);
+ le.maxValue->setValue(c->maxVal().i);
+ le.defaultValue->setDecimals(0);
+ le.defaultValue->setValue(c->getDefault().i);
+ }
+ else {
+ if (c->type() & Ctrl::LOG) {
+ le.minValue->setDecimals(0);
+ le.minValue->setValue(c->minVal().f * 20.0);
+ le.minValue->setSuffix(tr("dB"));
+ le.maxValue->setDecimals(0);
+ le.maxValue->setValue(c->maxVal().f * 20.0);
+ le.maxValue->setSuffix(tr("dB"));
+ le.defaultValue->setDecimals(0);
+ le.defaultValue->setValue(c->getDefault().f * 20.0);
+ le.defaultValue->setSuffix(tr("dB"));
+ }
+ else {
+ le.minValue->setDecimals(1);
+ le.minValue->setValue(c->minVal().f);
+ le.maxValue->setDecimals(1);
+ le.maxValue->setValue(c->maxVal().f);
+ le.defaultValue->setDecimals(1);
+ le.defaultValue->setValue(c->getDefault().f);
+ }
+ }
+ updateList();
+ }
+
+//---------------------------------------------------------
+// updateList
+//---------------------------------------------------------
+
+void CtrlListEditor::updateList()
+ {
+ if (updateListDisabled)
+ return;
+ le.ctrlList->clear();
+ int idx = 0;
+ bool curItemSet = false;
+ for (iCtrlVal i = c->begin(); i != c->end(); ++i, ++idx) {
+ CVal v = i.value();
+ QTreeWidgetItem* item = new QTreeWidgetItem;
+ item->setData(TICK_COL, Qt::TextAlignmentRole, int(Qt::AlignRight | Qt::AlignVCenter));
+ item->setData(TIME_COL, Qt::TextAlignmentRole, int(Qt::AlignRight | Qt::AlignVCenter));
+ item->setData(VAL_COL, Qt::TextAlignmentRole, int(Qt::AlignHCenter | Qt::AlignVCenter));
+
+ item->setData(TICK_COL, Qt::DisplayRole, i.key());
+ item->setData(TIME_COL, Qt::DisplayRole, i.key());
+ if (c->type() & Ctrl::INT)
+ item->setData(VAL_COL, Qt::DisplayRole, v.i);
+ else
+ item->setData(VAL_COL, Qt::DisplayRole, v.f);
+ le.ctrlList->insertTopLevelItem(idx, item);
+ if (!curItemSet && (i.key() >= listEdit->pos().tick())) {
+ le.ctrlList->setCurrentItem(item);
+ curItemSet = true;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// controllerChanged
+//---------------------------------------------------------
+
+void CtrlListEditor::controllerChanged(int id)
+ {
+ if (id != c->id())
+ return;
+ updateList();
+ }
+
+//---------------------------------------------------------
+// itemActivated
+//---------------------------------------------------------
+
+void CtrlListEditor::itemActivated(QTreeWidgetItem* item, int column)
+ {
+ le.ctrlList->openPersistentEditor(item, column);
+ }
+
+//---------------------------------------------------------
+// itemChanged
+//---------------------------------------------------------
+
+void CtrlListEditor::itemChanged(QTreeWidgetItem* item, int column)
+ {
+ CVal val;
+ if (c->type() & Ctrl::INT) {
+ val.i = item->data(VAL_COL, Qt::DisplayRole).toInt();
+ bool updateData = false;
+ if (val.i < c->minVal().i) {
+ val.i = c->minVal().i;
+ updateData = true;
+ }
+ else if (val.i > c->maxVal().i) {
+ val.i = c->maxVal().i;
+ updateData = true;
+ }
+ if (updateData)
+ item->setData(VAL_COL, Qt::DisplayRole, val.i);
+ }
+ else {
+ val.f = item->data(VAL_COL, Qt::DisplayRole).toDouble();
+ bool updateData = false;
+ if (val.f < c->minVal().f) {
+ val.f = c->minVal().f;
+ updateData = true;
+ }
+ else if (val.f > c->maxVal().f) {
+ val.f = c->maxVal().f;
+ updateData = true;
+ }
+ if (updateData)
+ item->setData(VAL_COL, Qt::DisplayRole, val.f);
+ }
+ le.ctrlList->closePersistentEditor(item, TICK_COL);
+ le.ctrlList->closePersistentEditor(item, TIME_COL);
+ le.ctrlList->closePersistentEditor(item, VAL_COL);
+ updateListDisabled = true;
+ switch(column) {
+ case TICK_COL:
+ {
+ int otick = item->data(TIME_COL, Qt::DisplayRole).toInt();
+ int tick = item->data(TICK_COL, Qt::DisplayRole).toInt();
+ item->setData(TIME_COL, Qt::DisplayRole, tick);
+ song->cmdRemoveControllerVal(track, c->id(), otick);
+ song->cmdAddControllerVal(track, c, tick, val);
+ }
+ break;
+ case TIME_COL:
+ {
+ int otick = item->data(TICK_COL, Qt::DisplayRole).toInt();
+ int tick = item->data(TIME_COL, Qt::DisplayRole).toInt();
+ item->setData(TICK_COL, Qt::DisplayRole, tick);
+ song->cmdRemoveControllerVal(track, c->id(), otick);
+ song->cmdAddControllerVal(track, c, tick, val);
+ }
+ break;
+ case VAL_COL:
+ song->cmdAddControllerVal(track, c, listEdit->pos(), val);
+ break;
+ }
+ updateListDisabled = false;
+ }
+
+//---------------------------------------------------------
+// sendEscape
+//---------------------------------------------------------
+
+void CtrlListEditor::sendEscape()
+ {
+ QTreeWidgetItem* cur = le.ctrlList->currentItem();
+ if (cur == 0)
+ return;
+ le.ctrlList->closePersistentEditor(cur, TICK_COL);
+ le.ctrlList->closePersistentEditor(cur, TIME_COL);
+ le.ctrlList->closePersistentEditor(cur, VAL_COL);
+ }
+
+//---------------------------------------------------------
+// currentItemChanged
+//---------------------------------------------------------
+
+void CtrlListEditor::currentItemChanged(QTreeWidgetItem* cur, QTreeWidgetItem* prev)
+ {
+ if (prev) {
+ le.ctrlList->closePersistentEditor(prev, TICK_COL);
+ le.ctrlList->closePersistentEditor(prev, TIME_COL);
+ le.ctrlList->closePersistentEditor(prev, VAL_COL);
+ }
+ if (cur) {
+ Pos pos(cur->data(TICK_COL, Qt::DisplayRole).toInt(), track->timeType());
+ listEdit->pos() = pos;
+ }
+ le.deleteButton->setEnabled(cur);
+ }
+
+//---------------------------------------------------------
+// insertClicked
+// insert one tick before current value
+//---------------------------------------------------------
+
+void CtrlListEditor::insertClicked()
+ {
+ CVal val = c->minVal();
+ QTreeWidgetItem* cur = le.ctrlList->currentItem();
+ if (cur) {
+ int tick = cur->data(TICK_COL, Qt::DisplayRole).toInt();
+ if (tick == 0) // cannot insert value at position < 0
+ return;
+ listEdit->pos().setTick(tick - 1);
+ if (c->type() & Ctrl::INT)
+ val.i = cur->data(VAL_COL, Qt::DisplayRole).toInt();
+ else
+ val.f = cur->data(VAL_COL, Qt::DisplayRole).toDouble();
+ }
+ song->cmdAddControllerVal(track, c, listEdit->pos(), val);
+ }
+
+//---------------------------------------------------------
+// deleteClicked
+//---------------------------------------------------------
+
+void CtrlListEditor::deleteClicked()
+ {
+ QTreeWidgetItem* cur = le.ctrlList->currentItem();
+ if (cur == 0)
+ return;
+ int tick = cur->data(TICK_COL, Qt::DisplayRole).toInt();
+ song->cmdRemoveControllerVal(track, c->id(), tick);
+ }
+
+//---------------------------------------------------------
+// nameEdited
+//---------------------------------------------------------
+
+void CtrlListEditor::nameEdited(const QString& s)
+ {
+ track->changeCtrlName(c, s);
+ }
+
+//---------------------------------------------------------
+// minValChanged
+//---------------------------------------------------------
+
+void CtrlListEditor::minValChanged(double v)
+ {
+ CVal val;
+ if (c->type() & Ctrl::INT)
+ val.i = int(v);
+ else {
+ if (c->type() & Ctrl::LOG)
+ v /= 20.0;
+ val.f = v;
+ }
+ c->setRange(val, c->maxVal());
+ }
+
+//---------------------------------------------------------
+// maxValChanged
+//---------------------------------------------------------
+
+void CtrlListEditor::maxValChanged(double v)
+ {
+ CVal val;
+ if (c->type() & Ctrl::INT)
+ val.i = int(v);
+ else {
+ if (c->type() & Ctrl::LOG)
+ v /= 20.0;
+ val.f = v;
+ }
+ c->setRange(c->minVal(), val);
+ }
+
+//---------------------------------------------------------
+// defaultValChanged
+//---------------------------------------------------------
+
+void CtrlListEditor::defaultValChanged(double v)
+ {
+ CVal val;
+ if (c->type() & Ctrl::INT)
+ val.i = int(v);
+ else
+ val.f = v;
+ c->setDefault(val);
+ }
+
+//---------------------------------------------------------
+// CtrlDelegate
+//---------------------------------------------------------
+
+CtrlDelegate::CtrlDelegate(QObject* parent)
+ : QItemDelegate(parent)
+ {
+ }
+
+//---------------------------------------------------------
+// createEditor
+//---------------------------------------------------------
+
+QWidget* CtrlDelegate::createEditor(QWidget* pw,
+ const QStyleOptionViewItem& option, const QModelIndex& index) const
+ {
+ switch(index.column()) {
+ case CtrlListEditor::TICK_COL:
+ break;
+ case CtrlListEditor::TIME_COL:
+ return new Awl::PosEdit(pw);
+ case CtrlListEditor::VAL_COL:
+ {
+ CtrlListEditor* ce = static_cast<CtrlListEditor*>(parent());
+ Ctrl* c = ce->ctrl();
+ if (c->type() & Ctrl::INT) {
+ QSpinBox* w = new QSpinBox(pw);
+ w->setRange(c->minVal().i, c->maxVal().i);
+ w->installEventFilter(const_cast<CtrlDelegate*>(this));
+ return w;
+ }
+ QDoubleSpinBox* w = new QDoubleSpinBox(pw);
+ if (c->type() & Ctrl::LOG)
+ w->setSuffix(tr("dB"));
+// w->setRange(c->minVal().f, c->maxVal().f);
+ w->installEventFilter(const_cast<CtrlDelegate*>(this));
+ return w;
+ }
+ }
+ return QItemDelegate::createEditor(pw, option, index);
+ }
+
+//---------------------------------------------------------
+// setEditorData
+//---------------------------------------------------------
+
+void CtrlDelegate::setEditorData(QWidget* editor,
+ const QModelIndex& index) const
+ {
+ switch(index.column()) {
+ case CtrlListEditor::TICK_COL:
+ break;
+ case CtrlListEditor::TIME_COL:
+ {
+ Awl::PosEdit* pe = static_cast<Awl::PosEdit*>(editor);
+ pe->setValue(AL::Pos(index.data().toInt()));
+ }
+ return;
+ case CtrlListEditor::VAL_COL:
+ {
+ CtrlListEditor* ce = static_cast<CtrlListEditor*>(parent());
+ Ctrl* c = ce->ctrl();
+ if (c->type() & Ctrl::INT) {
+ QSpinBox* w = static_cast<QSpinBox*>(editor);
+ w->setValue(index.data().toInt());
+ }
+ else {
+ QDoubleSpinBox* w = static_cast<QDoubleSpinBox*>(editor);
+ double v = index.data().toDouble();
+printf("type %x\n", c->type());
+ if (c->type() & Ctrl::LOG)
+ v *= 20.0;
+ w->setValue(v);
+ }
+ }
+ return;
+ }
+ QItemDelegate::setEditorData(editor, index);
+ }
+
+//---------------------------------------------------------
+// setModelData
+//---------------------------------------------------------
+
+void CtrlDelegate::setModelData(QWidget* editor, QAbstractItemModel* model,
+ const QModelIndex& index) const
+ {
+ switch(index.column()) {
+ case CtrlListEditor::TICK_COL:
+ break;
+ case CtrlListEditor::TIME_COL:
+ {
+ Awl::PosEdit* pe = static_cast<Awl::PosEdit*>(editor);
+ model->setData(index, pe->pos().tick(), Qt::DisplayRole);
+ }
+ return;
+ case CtrlListEditor::VAL_COL:
+ {
+ CtrlListEditor* ce = static_cast<CtrlListEditor*>(parent());
+ Ctrl* c = ce->ctrl();
+ if (c->type() & Ctrl::INT) {
+ QSpinBox* w = static_cast<QSpinBox*>(editor);
+ model->setData(index, w->value(), Qt::DisplayRole);
+ }
+ else {
+ QDoubleSpinBox* w = static_cast<QDoubleSpinBox*>(editor);
+ double v = w->value();
+ if (c->type() & Ctrl::LOG)
+ v /= 20.0;
+ model->setData(index, v, Qt::DisplayRole);
+ }
+ }
+ break;
+ }
+ QItemDelegate::setModelData(editor, model, index);
+ }
+
+//---------------------------------------------------------
+// paint
+//---------------------------------------------------------
+
+void CtrlDelegate::paint(QPainter* painter,
+ const QStyleOptionViewItem& option, const QModelIndex& index) const
+ {
+ QString text;
+ CtrlListEditor* ce = static_cast<CtrlListEditor*>(parent());
+
+ switch(index.column()) {
+ case CtrlListEditor::TICK_COL:
+ {
+ Track* track = ce->getTrack();
+ AL::Pos pos(index.data().toInt(), track->timeType());
+ text = QString("%1").arg(pos.tick());
+ }
+ break;
+ case CtrlListEditor::TIME_COL:
+ {
+ Track* track = ce->getTrack();
+ AL::Pos pos(index.data().toInt(), track->timeType());
+ int measure, beat, tick;
+ pos.mbt(&measure, &beat, &tick);
+ text.sprintf("%04d.%02d.%03u", measure+1, beat+1, tick);
+ }
+ break;
+ case CtrlListEditor::VAL_COL:
+ {
+ Ctrl* c = ce->ctrl();
+ if (c->type() & Ctrl::INT) {
+ text = QString("%1").arg(index.data().toInt());
+ }
+ else {
+ if (c->type() & Ctrl::LOG) {
+ double f = index.data().toDouble();
+ if (f <= -1000.0f)
+ text = tr("off");
+ else
+ text = QString("%1 dB").arg(f * 20.0);
+ }
+ else {
+ text = QString("%1").arg(index.data().toDouble());
+ }
+ }
+ }
+ break;
+ }
+
+ QStyleOptionViewItemV2 opt = setOptions(index, option);
+ const QStyleOptionViewItemV2 *v2 = qstyleoption_cast<const QStyleOptionViewItemV2 *>(&option);
+ opt.features = v2 ? v2->features : QStyleOptionViewItemV2::ViewItemFeatures(QStyleOptionViewItemV2::None);
+
+ painter->save();
+ QVariant value;
+ QRect displayRect;
+ displayRect = option.rect; // textRectangle(painter, d->textLayoutBounds(opt), opt.font, text);
+
+ QRect checkRect;
+ Qt::CheckState checkState = Qt::Unchecked;
+ value = index.data(Qt::CheckStateRole);
+ if (value.isValid()) {
+ checkState = static_cast<Qt::CheckState>(value.toInt());
+ checkRect = check(opt, opt.rect, value);
+ }
+
+ drawBackground(painter, opt, index);
+ drawCheck(painter, opt, checkRect, checkState);
+ drawDisplay(painter, opt, displayRect, text);
+ drawFocus(painter, opt, text.isEmpty() ? QRect() : displayRect);
+ painter->restore();
+ }
+
+
diff --git a/muse_qt4_evolution/muse/liste/ctrllistedit.h b/muse_qt4_evolution/muse/liste/ctrllistedit.h
new file mode 100644
index 00000000..75ed6008
--- /dev/null
+++ b/muse_qt4_evolution/muse/liste/ctrllistedit.h
@@ -0,0 +1,96 @@
+//=============================================================================
+// 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.
+//=============================================================================
+
+#ifndef __CTRLLISTEDIT_H__
+#define __CTRLLISTEDIT_H__
+
+#include "al/pos.h"
+#include "listedit.h"
+#include "ui_ctrllistedit.h"
+
+//---------------------------------------------------------
+// CtrlDelegate
+//---------------------------------------------------------
+
+class CtrlDelegate : public QItemDelegate {
+ Q_OBJECT
+
+ virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem&,
+ const QModelIndex& index) const;
+ virtual void setEditorData(QWidget* editor, const QModelIndex&) const;
+ virtual void setModelData(QWidget* editor, QAbstractItemModel*,
+ const QModelIndex&) const;
+ void paint(QPainter*, const QStyleOptionViewItem&,
+ const QModelIndex&) const;
+
+ public:
+ CtrlDelegate(QObject* parent = 0);
+ };
+
+//---------------------------------------------------------
+// EscapeFilter
+//---------------------------------------------------------
+
+class EscapeFilter : public QObject {
+ Q_OBJECT
+ protected:
+ bool eventFilter(QObject*, QEvent*);
+ public:
+ EscapeFilter(QObject* parent = 0): QObject(parent) {}
+ };
+
+//---------------------------------------------------------
+// CtrlListEditor
+//---------------------------------------------------------
+
+class CtrlListEditor : public ListWidget {
+ Q_OBJECT
+
+ Ui::CtrlListEdit le;
+ Track* track;
+ Ctrl* c;
+ bool updateListDisabled;
+ ListEdit* listEdit;
+
+ void updateList();
+
+ private slots:
+ void controllerChanged(int id);
+ void itemActivated(QTreeWidgetItem*,int);
+ void itemChanged(QTreeWidgetItem*,int);
+ void currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*);
+ void insertClicked();
+ void deleteClicked();
+ void nameEdited(const QString&);
+ void minValChanged(double);
+ void maxValChanged(double);
+ void defaultValChanged(double);
+
+ public:
+ CtrlListEditor(ListEdit*, QWidget* parent = 0);
+ virtual void setup(const ListType&);
+ void sendEscape();
+ Ctrl* ctrl() const { return c; }
+ Track* getTrack() const { return track; }
+ enum { TICK_COL, TIME_COL, VAL_COL };
+ };
+
+#endif
+
diff --git a/muse_qt4_evolution/muse/liste/ctrllistedit.ui b/muse_qt4_evolution/muse/liste/ctrllistedit.ui
new file mode 100644
index 00000000..27389b7c
--- /dev/null
+++ b/muse_qt4_evolution/muse/liste/ctrllistedit.ui
@@ -0,0 +1,334 @@
+<ui version="4.0" >
+ <class>CtrlListEdit</class>
+ <widget class="QWidget" name="CtrlListEdit" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>341</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font" >
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text" >
+ <string>Controller:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="controllerName" />
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label_3" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Id:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="ctrlId" >
+ <property name="readOnly" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="moveWithPart" >
+ <property name="text" >
+ <string>move with part</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QCheckBox" name="discreteCheckBox" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>discrete</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="logarithmicCheckBox" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>logarithmic</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="floatCheckBox" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>float</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label_2" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>min:</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDoubleSpinBox" name="minValue" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="l2" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>max:</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDoubleSpinBox" name="maxValue" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="l3" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>default:</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDoubleSpinBox" name="defaultValue" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QTreeWidget" name="ctrlList" >
+ <property name="alternatingRowColors" >
+ <bool>true</bool>
+ </property>
+ <property name="indentation" >
+ <number>0</number>
+ </property>
+ <property name="rootIsDecorated" >
+ <bool>false</bool>
+ </property>
+ <property name="uniformRowHeights" >
+ <bool>true</bool>
+ </property>
+ <property name="itemsExpandable" >
+ <bool>false</bool>
+ </property>
+ <column>
+ <property name="text" >
+ <string>Tick</string>
+ </property>
+ </column>
+ <column>
+ <property name="text" >
+ <string>Time</string>
+ </property>
+ </column>
+ <column>
+ <property name="text" >
+ <string>Value</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QToolButton" name="deleteButton" >
+ <property name="text" >
+ <string>Delete</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="insertButton" >
+ <property name="text" >
+ <string>Insert</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>231</width>
+ <height>29</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/muse_qt4_evolution/muse/liste/ieventdialog.cpp b/muse_qt4_evolution/muse/liste/ieventdialog.cpp
new file mode 100644
index 00000000..a2914ffc
--- /dev/null
+++ b/muse_qt4_evolution/muse/liste/ieventdialog.cpp
@@ -0,0 +1,428 @@
+//=============================================================================
+// MusE
+// Linux Music Editor
+// $Id:$
+//
+// Copyright (C) 2007 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.
+//=============================================================================
+
+#include <QColor>
+#include <QDialogButtonBox>
+#include "ieventdialog.h"
+
+InsertEventDialog::InsertEventDialog(const Pos& time, Part* part, Event* ev,
+ QWidget* parent, Qt::WindowFlags f)
+ : QDialog(parent, f) {
+ setWindowTitle("Insert Event Dialog");
+
+ _selectedType = -1;
+
+
+ _part = part;
+
+ _lastDir = QDir::currentPath();
+
+ _mainLayout = new QGridLayout(parent);
+ //event type
+ QLabel* eventTypeLabel = new QLabel("Event Type", parent);
+ _mainLayout->addWidget(eventTypeLabel, 0, 0);
+ _eventTypeComboBox = new QComboBox(parent);
+ for(unsigned i = 0; i < IED_TypeCount; i++) {
+ _typeWidget.push_back(new QWidget(parent));
+ QGridLayout* tLayout = new QGridLayout(_typeWidget[i]);
+ if(i == IED_Note) {
+ _eventTypeComboBox->addItem(NoteSTR);
+ //pitch
+ QLabel* pitchLabel = new QLabel("Pitch", _typeWidget[i]);
+ tLayout->addWidget(pitchLabel, 0, 0);
+ /*_noteLabel = new QLabel("C4", _typeWidget[i]);
+ _noteLabel->setFrameShape(QFrame::Panel);
+ _noteLabel->setFrameShadow(QFrame::Sunken);
+ tLayout->addWidget(_noteLabel, 0, 1);*/
+ _pitchSpinBox = new QSpinBox(_typeWidget[i]);
+ _pitchSpinBox->setMaximum(127);
+ _pitchSpinBox->setMinimum(0);
+ _pitchSpinBox->setValue(ev && ev->type()==Note?ev->pitch():72/*C4*/);
+ tLayout->addWidget(_pitchSpinBox, 0, 1);
+ //Velocity
+ QLabel* velocityLabel = new QLabel("Velocity", _typeWidget[i]);
+ tLayout->addWidget(velocityLabel, 1, 0);
+ _velocitySpinBox = new QSpinBox(_typeWidget[i]);
+ _velocitySpinBox->setMaximum(127);
+ _velocitySpinBox->setMinimum(0);
+ _velocitySpinBox->setValue(ev && ev->type()==Note?ev->velo():70);
+ tLayout->addWidget(_velocitySpinBox, 1, 1);
+ //Velocity Off
+ /*QLabel* veloOffLabel = new QLabel("Velocity Off", _typeWidget[i]);
+ tLayout->addWidget(veloOffLabel, 2, 0);
+ _veloOffSpinBox = new QSpinBox(_typeWidget[i]);
+ _veloOffSpinBox->setMaximum(127);
+ _veloOffSpinBox->setMinimum(0);
+ _veloOffSpinBox->setValue(0);
+ tLayout->addWidget(_veloOffSpinBox, 2, 1);*/
+ //Length
+ QLabel* lengthLabel = new QLabel("Length", _typeWidget[i]);
+ tLayout->addWidget(lengthLabel, 2, 0);
+ _lengthSpinBox = new QSpinBox(_typeWidget[i]);
+ _lengthSpinBox->setMaximum(32768);
+ _lengthSpinBox->setMinimum(1);
+ _lengthSpinBox->setValue(ev && ev->type()==Note?ev->lenTick():384);
+ tLayout->addWidget(_lengthSpinBox, 2, 1);
+ }
+ else if(i == IED_ProgramChange) {
+ _eventTypeComboBox->addItem(ProgramChangeSTR);
+ //TODO
+ QLabel* programChangeEventTODO =
+ new QLabel("TODO : Program change event", _typeWidget[i]);
+ tLayout->addWidget(programChangeEventTODO, 0, 0, 1, 2);
+ }
+ else if(i == IED_ControlChange) {
+ _eventTypeComboBox->addItem(ControlChangeSTR);
+ //TODO
+ QLabel* controlChangeEventTODO =
+ new QLabel("TODO : Control change event", _typeWidget[i]);
+ tLayout->addWidget(controlChangeEventTODO, 0, 0, 1, 2);
+ }
+ else if(i == IED_Sysex) {
+ _eventTypeComboBox->addItem(SysexSTR);
+ //number of sysex
+ QLabel* numOfSysexLabel = new QLabel("Number of Sysex", _typeWidget[i]);
+ tLayout->addWidget(numOfSysexLabel, 0, 0);
+ _sysexCountSpinBox = new QSpinBox(_typeWidget[i]);
+ _sysexCountSpinBox->setMaximum(1024);
+ _sysexCountSpinBox->setMinimum(1);
+ _sysexCountSpinBox->setValue(1);
+ tLayout->addWidget(_sysexCountSpinBox, 0, 1);
+ //current sysex
+ QLabel* curSysexLabel = new QLabel("Current Sysex", _typeWidget[i]);
+ tLayout->addWidget(curSysexLabel, 1, 0);
+ _curSysexSpinBox = new QSpinBox(_typeWidget[i]);
+ _curSysexSpinBox->setMaximum(0);
+ _curSysexSpinBox->setMinimum(0);
+ _curSysexSpinBox->setValue(0);
+ tLayout->addWidget(_curSysexSpinBox, 1, 1);
+ //select from the instrument
+ QPushButton* selectButton = new QPushButton("Select from instrument",
+ _typeWidget[i]);
+ tLayout->addWidget(selectButton, 2, 0, 1, 2);
+ //load
+ _loadButton = new QPushButton("Load...", _typeWidget[i]);
+ tLayout->addWidget(_loadButton, 3, 0);
+ //save
+ _saveButton = new QPushButton("Save...", _typeWidget[i]);
+ tLayout->addWidget(_saveButton, 3, 1);
+ //length
+ QLabel* lengthLabel = new QLabel("Length", _typeWidget[i]);
+ tLayout->addWidget(lengthLabel, 4, 0);
+ _lengthIntLabel = new QLabel(ev && ev->type()==Sysex?
+ QString::number(ev->dataLen()):"0",
+ _typeWidget[i]);
+ tLayout->addWidget(_lengthIntLabel, 4, 1);
+ //text edit
+ _sysexTextEdit = new QTextEdit(_typeWidget[i]);
+ _sysexCursorPos = 0;
+ _dataSysex.push_back(ev && ev->type()==Sysex?
+ QByteArray((const char*)ev->data(), ev->dataLen())
+ :QByteArray());
+ _lengthIntLabel->setText(QString::number(sysexLength()));
+ _dataSysexStr.push_back(ev && ev->type()==Sysex?
+ charArray2Str((const char*)ev->data(),
+ ev->dataLen()):
+ "F0 F7");
+ tLayout->addWidget(_sysexTextEdit, 5, 0, 3, 2);
+ setSysexTextEdit();
+ QString HEX = "(?!F7)([A-F]|\\d){1,2}";
+ QString SRE = QString("^F0(\\s+)(") + HEX + QString("(\\s+))*F7$");
+ _hexRegExp = new QRegExp(SRE, Qt::CaseInsensitive);
+ }
+ tLayout->setMargin(0);
+ _typeWidget[i]->setLayout(tLayout);
+ _mainLayout->addWidget(_typeWidget[i], 2, 0, 1, 2);
+ }
+ _mainLayout->addWidget(_eventTypeComboBox, 0, 1);
+ //time
+ QLabel* timeLabel = new QLabel("Time", parent);
+ _mainLayout->addWidget(timeLabel, 1, 0);
+ _timePosEdit = new PosEdit(parent);
+ _timePosEdit->setValue(time);
+ _mainLayout->addWidget(_timePosEdit, 1, 1);
+ //Ok, cancel
+ QDialogButtonBox* OkCancelBox =
+ new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
+ Qt::Horizontal, parent);
+ _mainLayout->addWidget(OkCancelBox, 3, 0, 1, 2);
+
+ if(ev)
+ if(ev->type()==Note) _eventTypeComboBox->setCurrentIndex(IED_Note);
+ else if(ev->type()==Sysex) _eventTypeComboBox->setCurrentIndex(IED_Sysex);
+ else _eventTypeComboBox->setCurrentIndex(IED_Note);
+ else _eventTypeComboBox->setCurrentIndex(IED_Note);
+
+ updateType(_eventTypeComboBox->currentIndex());
+
+ setLayout(_mainLayout);
+
+ //connection
+ connect(_sysexTextEdit, SIGNAL(textChanged()), this,
+ SLOT(updateSysexTextEdit()));
+ connect(_sysexTextEdit, SIGNAL(cursorPositionChanged()), this,
+ SLOT(updateSysexCursor()));
+ connect(_eventTypeComboBox, SIGNAL(currentIndexChanged(int)), this,
+ SLOT(updateType(int)));
+ connect(_sysexCountSpinBox, SIGNAL(valueChanged(int)), this,
+ SLOT(updateSysexCount(int)));
+ connect(_curSysexSpinBox, SIGNAL(valueChanged(int)), this,
+ SLOT(updateCurSysexSpinBox(int)));
+ connect(_loadButton, SIGNAL(clicked()), this, SLOT(updateSysexLoad()));
+ connect(_saveButton, SIGNAL(clicked()), this, SLOT(updateSysexSave()));
+ connect(OkCancelBox, SIGNAL(accepted()), this, SLOT(accept()));
+ connect(OkCancelBox, SIGNAL(rejected()), this, SLOT(reject()));
+}
+
+InsertEventDialog::~InsertEventDialog() {
+}
+
+EventList* InsertEventDialog::elResult() {
+ unsigned evTick;
+ evTick = (unsigned)IED_MAX(0, (int)_timePosEdit->pos().tick()
+ - (int)_part->tick());
+ Pos evPos(evTick);
+ EventList* res = new EventList;
+
+ int curType = _eventTypeComboBox->currentIndex();
+
+ if(curType == IED_Note) {
+ Event evNote(Note);
+ evNote.setPos(evPos);
+ evNote.setPitch(_pitchSpinBox->value());
+ evNote.setVelo(_velocitySpinBox->value());
+ //evNote.setVeloOff(_veloOffSpinBox->value());
+ evNote.setLenTick(_lengthSpinBox->value());
+ res->add(evNote);
+ return res;
+ }
+ else if(curType == IED_ProgramChange) {
+ //TODO
+ return NULL;
+ }
+ else if(curType == IED_ControlChange) {
+ //TODO
+ return NULL;
+ }
+ else if(curType == IED_Sysex) {
+ for(unsigned i = 0; (int)i < _sysexCountSpinBox->value(); i++) {
+ Event evSysex(Sysex);
+ evSysex.setPos(evPos);
+ evSysex.setData((const unsigned char*) _dataSysex[i].data(),
+ _dataSysex[i].size());
+ res->add(evSysex);
+ }
+ return res;
+ }
+ else return NULL;
+}
+
+int InsertEventDialog::sysexLength() {
+ return _dataSysex[_curSysexSpinBox->value()].size();
+}
+QString InsertEventDialog::charArray2Str(const char* s, int length) {
+ return ByteArray2Str(QByteArray(s, length));
+}
+QString InsertEventDialog::ByteArray2Str(const QByteArray& ba) {
+ QString res = "F0 ";
+ for(int i = 0; i < ba.size(); i++) {
+ res += QString::number((unsigned char)ba.at(i), 16);
+ res += " ";
+ }
+ res += "F7";
+ return res.toUpper();
+}
+QByteArray InsertEventDialog::Str2ByteArray(const QString& s) {
+ QByteArray ba;
+ QString simpli = s.simplified();
+ QStringList sl = simpli.split(" ");
+ bool ok;
+ for(int i = 1; i < sl.size() - 1; i++) {//i=1 and until size-1 to skip F0, F7
+ ba.push_back(sl[i].toInt(&ok, 16));
+ }
+ return ba;
+}
+char* InsertEventDialog::Str2CharArray(const QString& s) {
+ return Str2ByteArray(s).data();
+}
+
+void InsertEventDialog::setSysexTextEdit() {
+ QString s = _dataSysexStr[_curSysexSpinBox->value()].toUpper();
+ _sysexTextEdit->blockSignals(true);
+ //print in gray F0
+ _sysexTextEdit->setTextColor(Qt::darkGray);
+ _sysexTextEdit->setPlainText(s.left(2));
+ //move cursor at the end
+ QTextCursor tc1(_sysexTextEdit->document());
+ tc1.movePosition(QTextCursor::End);
+ _sysexTextEdit->setTextCursor(tc1);
+ //print in black the core
+ _sysexTextEdit->setTextColor(Qt::black);
+ _sysexTextEdit->insertPlainText(s.mid(2, s.size()-4));
+ //move cursor at the end
+ QTextCursor tc2(_sysexTextEdit->document());
+ tc2.movePosition(QTextCursor::End);
+ _sysexTextEdit->setTextCursor(tc2);
+ //print in gray F7
+ _sysexTextEdit->setTextColor(Qt::darkGray);
+ _sysexTextEdit->insertPlainText(s.right(2));
+ //relocate cursor
+ QTextCursor tc(_sysexTextEdit->document());
+ tc.setPosition(_sysexCursorPos);
+ _sysexTextEdit->setTextCursor(tc);
+ //update length label
+ _lengthIntLabel->setText(QString::number(sysexLength()));
+
+ _sysexTextEdit->blockSignals(false);
+}
+
+//SLOTS
+void InsertEventDialog::updateSysexTextEdit() {
+ int cur = _curSysexSpinBox->value();
+ int curCursor = _sysexTextEdit->textCursor().position();
+ QString data = _sysexTextEdit->toPlainText();
+ bool correctInput = _hexRegExp->exactMatch(data);
+
+ if(correctInput) {
+ _dataSysexStr[cur] = data;
+ _sysexCursorPos = curCursor;
+ }
+
+ //display text, relocate cursor and update length
+ setSysexTextEdit();
+ //update _dataSysex
+ _dataSysex[cur] = Str2ByteArray(_dataSysexStr[cur]);
+}
+void InsertEventDialog::updateSysexCursor() {
+ if(_dataSysexStr[_curSysexSpinBox->value()]
+ == _sysexTextEdit->toPlainText()) //only if the text hasn't changed
+ _sysexCursorPos = _sysexTextEdit->textCursor().position();
+}
+void InsertEventDialog::updateSysexCount(int c) {
+ while((int)_dataSysexStr.size() < c) {
+ _dataSysexStr.push_back(QString("F0 F7"));
+ QByteArray ba;
+ _dataSysex.push_back(ba);
+ }
+ if(c <= _curSysexSpinBox->value()) _curSysexSpinBox->setValue(c-1);
+ _curSysexSpinBox->setMaximum(c-1);
+}
+void InsertEventDialog::updateCurSysexSpinBox(int /*c*/) {
+ setSysexTextEdit();
+}
+void InsertEventDialog::updateSysexLoad() {
+ QByteArray ba;
+ QString fileName =
+ QFileDialog::getOpenFileName(this,
+ tr("Load Sysex dialog"),
+ _lastDir,
+ QString("*.syx;; *"));
+ if(!fileName.isEmpty()) {
+ QFileInfo fi(fileName);
+ _lastDir = fi.path();
+
+ QFile f(fileName);
+ if(f.open(QIODevice::ReadOnly)) {
+ ba = f.readAll();
+ bool sysexStart = false;
+ int sysexCount = 0;
+ for(int i = 0; i < ba.size(); i++) {
+ if((unsigned char)ba.at(i) == 0xF0) {
+ sysexStart = true;
+ sysexCount++;
+ while((int)_dataSysex.size() < sysexCount) {
+ QByteArray tempba;
+ _dataSysex.push_back(tempba);
+ _dataSysexStr.push_back(QString(""));
+ }
+ _dataSysex[sysexCount-1].clear();
+ }
+ else if((unsigned char)ba.at(i) == 0xF7) {
+ QByteArray endba(_dataSysex[sysexCount-1]);
+ sysexStart = false;
+ _dataSysexStr[sysexCount-1] = ByteArray2Str(endba);
+ }
+ else if(sysexStart) _dataSysex[sysexCount-1].push_back(ba.at(i));
+ }
+ _sysexCountSpinBox->setValue(sysexCount);
+ _curSysexSpinBox->setValue(0);
+ updateCurSysexSpinBox(0);
+ //Message dialog
+ if(sysexCount > 0) {
+ QMessageBox::information(this, tr("Sysex loaded"),
+ tr("MusE has successfully detected"
+ " and loaded ") +
+ QString::number(sysexCount) +
+ tr(" sysex messages."));
+ }
+ else {
+ QMessageBox::information(this, tr("No sysex"),
+ tr("No sysex in this file"));
+ }
+ }
+ else {
+ QMessageBox::critical(0,
+ tr("Critical Error"),
+ tr("Cannot open file %1").arg(fileName));
+ }
+ }
+}
+void InsertEventDialog::updateSysexSave() {
+ QString filename =
+ QFileDialog::getSaveFileName(
+ this,
+ tr("Save Sysex Dialog"),
+ _lastDir,
+ QString("*"));
+ if(!filename.isEmpty()) {
+ QFileInfo fi(filename);
+ _lastDir = fi.path();
+ QFile f(filename);
+ if(f.open(QIODevice::WriteOnly)) {
+ for(unsigned i = 0; i < _dataSysex.size(); i++) {
+ qint64 wok;
+ wok = f.write(QByteArray(1, 0xF0));
+ wok = f.write(_dataSysex[i]);
+ wok = f.write(QByteArray(1, 0xF7));
+ if(wok == -1) {
+ QMessageBox::critical(0,
+ tr("Critical Error"),
+ tr("Cannot write the sysex number %1")
+ .arg(i));
+ }
+ }
+ }
+ else {
+ QMessageBox::critical(0,
+ tr("Critical Error"),
+ tr("Cannot save file %1").arg(filename));
+ }
+ }
+}
+void InsertEventDialog::updateType(int type) {
+ if(_selectedType != type) {
+ for(unsigned i = 0; i < IED_TypeCount; i++) {
+ if(type == (int)i) _typeWidget[i]->show();
+ else _typeWidget[i]->hide();
+ }
+ _selectedType = type;
+ resize(1, 1);
+ }
+}
diff --git a/muse_qt4_evolution/muse/liste/ieventdialog.h b/muse_qt4_evolution/muse/liste/ieventdialog.h
new file mode 100644
index 00000000..7906f6c9
--- /dev/null
+++ b/muse_qt4_evolution/muse/liste/ieventdialog.h
@@ -0,0 +1,117 @@
+//=============================================================================
+// MusE
+// Linux Music Editor
+// $Id:$
+//
+// Copyright (C) 2007 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.
+//=============================================================================
+
+#ifndef __IEVENTDIALOG_H__
+#define __IEVENTDIALOG_H__
+
+#include <QDialog>
+#include <vector>
+#include <QStringList>
+#include <QLineEdit>
+#include <QTextEdit>
+#include <QRegExp>
+#include <QDir>
+#include "awl/posedit.h"
+#include "midievent.h"
+#include "al/pos.h"
+#include "muse/event.h"
+#include "muse/part.h"
+
+class QDialog;
+using Awl::PosEdit;
+using AL::Pos;
+
+#define NoteSTR "Note"
+#define ProgramChangeSTR "Program change"
+#define ControlChangeSTR "Control change"
+#define SysexSTR "Sysex"
+
+#define IED_MAX(x, y) (x > y? x : y)
+
+class InsertEventDialog : public QDialog {
+ Q_OBJECT
+
+ QGridLayout* _mainLayout;
+ std::vector<QWidget*> _typeWidget;
+ int _selectedType;
+
+ QString _lastDir;
+
+ Part* _part;
+
+
+ //event type
+ QComboBox* _eventTypeComboBox;
+
+ //time
+ PosEdit* _timePosEdit;
+
+ //Note
+ QSpinBox* _pitchSpinBox;
+ QSpinBox* _velocitySpinBox;
+ QSpinBox* _veloOffSpinBox;
+ QSpinBox* _lengthSpinBox;
+ //QLabel* _noteLabel;
+
+ //Sysex
+ QSpinBox* _sysexCountSpinBox;
+ QSpinBox* _curSysexSpinBox;
+ QLabel* _lengthIntLabel;
+ QTextEdit* _sysexTextEdit;
+ QRegExp* _hexRegExp;
+ int _sysexCursorPos;
+ QPushButton* _loadButton;
+ QPushButton* _saveButton;
+ std::vector<QByteArray> _dataSysex;
+ std::vector<QString> _dataSysexStr;
+
+ enum {
+ IED_Note,
+ IED_ProgramChange,
+ IED_ControlChange,
+ IED_Sysex,
+ IED_TypeCount };
+
+ int sysexLength(); //return the length of the current sysex
+ void setSysexTextEdit(); //set the display of sysexTextEdit
+
+ public:
+ InsertEventDialog(const Pos& time, Part* part, Event* ev = NULL,
+ QWidget* parent = 0, Qt::WindowFlags f = 0);
+ ~InsertEventDialog();
+
+ EventList* elResult();
+
+ static QString charArray2Str(const char* s, int length); //add F0 and F7
+ static QString ByteArray2Str(const QByteArray& ba); //add F0 and F7
+ static QByteArray Str2ByteArray(const QString& s); //skip F0 and F7
+ static char* Str2CharArray(const QString& s);
+
+ private slots:
+ void updateSysexTextEdit();
+ void updateSysexCursor();
+ void updateSysexCount(int c);
+ void updateCurSysexSpinBox(int c);
+ void updateSysexLoad();
+ void updateSysexSave();
+ void updateType(int type);
+};
+
+#endif
diff --git a/muse_qt4_evolution/muse/liste/listedit.cpp b/muse_qt4_evolution/muse/liste/listedit.cpp
new file mode 100644
index 00000000..1f6138a8
--- /dev/null
+++ b/muse_qt4_evolution/muse/liste/listedit.cpp
@@ -0,0 +1,298 @@
+//=============================================================================
+// 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.
+//=============================================================================
+
+#include "listedit.h"
+#include "ctrllistedit.h"
+#include "partlistedit.h"
+#include "tracklistedit.h"
+#include "song.h"
+#include "part.h"
+#include "ctrl.h"
+
+//---------------------------------------------------------
+// operator==
+//---------------------------------------------------------
+
+bool ListType::operator==(const ListType& t) const
+ {
+ return id == t.id && track == t.track
+ && part == t.part && (ctrl ? ctrl->id() == t.ctrl->id() : true);
+ }
+
+//---------------------------------------------------------
+// ListEdit
+//---------------------------------------------------------
+
+ListEdit::ListEdit(QWidget*)
+ : TopWin()
+ {
+ setWindowTitle(tr("MusE: List Edit"));
+
+ QSplitter* split = new QSplitter;
+ split->setOpaqueResize(true);
+ setCentralWidget(split);
+
+ list = new QTreeWidget;
+ list->setColumnCount(1);
+ list->setSelectionMode(QAbstractItemView::SingleSelection);
+ list->setRootIsDecorated(true);
+ list->setColumnCount(1);
+ list->setHeaderLabels(QStringList("Element"));
+ list->setSortingEnabled(false);
+ list->setUniformRowHeights(true);
+ split->addWidget(list);
+
+ stack = new QStackedWidget;
+ split->addWidget(stack);
+
+ ctrlPanel = new CtrlListEditor(this);
+ stack->addWidget(ctrlPanel);
+ partPanel = new PartListEditor(this);
+ stack->addWidget(partPanel);
+ trackPanel = new TrackListEditor(this);
+ stack->addWidget(trackPanel);
+
+ connect(list, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
+ SLOT(itemChanged(QTreeWidgetItem*,QTreeWidgetItem*)));
+ connect(list, SIGNAL(itemExpanded(QTreeWidgetItem*)), SLOT(itemExpanded(QTreeWidgetItem*)));
+ connect(list, SIGNAL(itemCollapsed(QTreeWidgetItem*)), SLOT(itemExpanded(QTreeWidgetItem*)));
+ connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
+ list->resizeColumnToContents(0);
+ resize(900, 400);
+ }
+
+//---------------------------------------------------------
+// itemExpanded
+//---------------------------------------------------------
+
+void ListEdit::itemExpanded(QTreeWidgetItem*)
+ {
+ list->resizeColumnToContents(0);
+ }
+
+//---------------------------------------------------------
+// itemChanged
+//---------------------------------------------------------
+
+void ListEdit::itemChanged(QTreeWidgetItem* i, QTreeWidgetItem*)
+ {
+ if (i == 0)
+ return;
+ ListWidget* ew = ctrlPanel;
+ lt = i->data(0, Qt::UserRole).value<ListType>();
+ switch(lt.id) {
+ case LIST_TRACK:
+ ew = trackPanel;
+ break;
+ case LIST_PART:
+ ew = partPanel;
+ break;
+ case LIST_CTRL:
+ ew = ctrlPanel;
+ break;
+ default:
+ return;
+ }
+ ew->setup(lt);
+ stack->setCurrentWidget(ew);
+ }
+
+//---------------------------------------------------------
+// buildList
+//---------------------------------------------------------
+
+void ListEdit::buildList()
+ {
+ list->clear();
+ TrackList* tl = song->tracks();
+ int idx = 0;
+ ListType lt;
+
+ for (iTrack i = tl->begin(); i != tl->end(); ++i,++idx) {
+ QTreeWidgetItem* item = new QTreeWidgetItem;
+ Track* t = *i;
+ item->setText(0, t->name());
+ lt.id = LIST_TRACK;
+ lt.track = t;
+ item->setData(0, Qt::UserRole, QVariant::fromValue(lt));
+ list->insertTopLevelItem(idx, item);
+
+ PartList* pl = t->parts();
+ if (!pl->empty()) {
+ QTreeWidgetItem* pitem = new QTreeWidgetItem(item);
+ pitem->setFlags(pitem->flags() & ~Qt::ItemIsSelectable);
+ pitem->setText(0, tr("Parts"));
+ lt.id = LIST_NONE;
+ pitem->setData(0, Qt::UserRole, QVariant::fromValue(lt));
+ for (iPart pi = pl->begin(); pi != pl->end(); ++pi) {
+ lt.id = LIST_PART;
+ lt.part = pi->second;
+ QTreeWidgetItem* ppitem = new QTreeWidgetItem(pitem);
+ ppitem->setData(0, Qt::UserRole, QVariant::fromValue(lt));
+ ppitem->setText(0, pi->second->name());
+ }
+ }
+
+ CtrlList* cl = t->controller();
+ lt.part = 0;
+ if (!cl->empty()) {
+ QTreeWidgetItem* citem = new QTreeWidgetItem(item);
+ citem->setText(0, tr("Controller"));
+ citem->setFlags(citem->flags() & ~Qt::ItemIsSelectable);
+ lt.id = LIST_NONE;
+ citem->setData(0, Qt::UserRole, QVariant::fromValue(lt));
+ for (iCtrl ci = cl->begin(); ci != cl->end(); ++ci) {
+ QTreeWidgetItem* ccitem = new QTreeWidgetItem(citem);
+ ccitem->setText(0, ci->second->name());
+ lt.id = LIST_CTRL;
+ lt.ctrl = ci->second;
+ ccitem->setData(0, Qt::UserRole, QVariant::fromValue(lt));
+ }
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// songChanged
+//---------------------------------------------------------
+
+void ListEdit::songChanged(int flags)
+ {
+ if (flags & (SC_TRACK_INSERTED | SC_TRACK_REMOVED | SC_PART_INSERTED
+ | SC_PART_REMOVED)) {
+ buildList();
+ selectItem();
+ }
+ }
+
+//---------------------------------------------------------
+// findItem
+//---------------------------------------------------------
+
+QTreeWidgetItem* ListEdit::findItem(const ListType& lt, QTreeWidgetItem* item)
+ {
+ if (item->flags() & Qt::ItemIsSelectable) {
+ if (lt == item->data(0, Qt::UserRole).value<ListType>())
+ return item;
+ }
+ for (int n = 0; n < item->childCount(); ++n) {
+ QTreeWidgetItem* i = findItem(lt, item->child(n));
+ if (i)
+ return i;
+ }
+ return 0;
+ }
+
+//---------------------------------------------------------
+// selectItem
+//---------------------------------------------------------
+
+void ListEdit::selectItem(const AL::Pos& p, Track* track, Part* part, Ctrl* ctrl)
+ {
+ _pos = p;
+ stack->setCurrentWidget(ctrlPanel);
+ if (ctrl)
+ lt.id = LIST_CTRL;
+ else if (part)
+ lt.id = LIST_PART;
+ else if (track)
+ lt.id = LIST_TRACK;
+ else
+ return;
+ lt.track = track;
+ lt.part = part;
+ lt.ctrl = ctrl;
+ selectItem();
+ }
+
+void ListEdit::selectItem()
+ {
+ stack->setCurrentWidget(ctrlPanel);
+ buildList();
+ for (int i = 0;; ++i) {
+ QTreeWidgetItem* item = list->topLevelItem(i);
+ if (item == 0) {
+ printf("MusE::ListEdit: Element not found\n");
+ break;
+ }
+ item = findItem(lt, item);
+ if (item) {
+ list->setItemExpanded(item, true);
+ list->setCurrentItem(item);
+ list->scrollToItem(item);
+ break;
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// readStatus
+//---------------------------------------------------------
+
+void ListEdit::read(QDomNode node)
+ {
+ QString trackName;
+ Track* track = 0;
+ Part* part = 0;
+ Ctrl* ctrl = 0;
+
+ for (node = node.firstChild(); !node.isNull(); node = node.nextSibling()) {
+ QDomElement e = node.toElement();
+ QString tag(e.tagName());
+ if (tag == "Track") {
+ track = song->findTrack(e.text());
+ if (track == 0) {
+ printf("MusE::ListEdit::read: track not found\n");
+ }
+ }
+ else if (tag == "Pos")
+ _pos.read(node);
+ else if (tag == "Ctrl") {
+ int ctrlId = e.text().toInt();
+ ctrl = track->getController(ctrlId);
+ if (ctrl == 0) {
+ printf("MusE::ListEdit::read: controller not found: track %p\n", track);
+ printf("MusE::ListEdit::read: controller %d not found\n", ctrlId);
+ return;
+ }
+ }
+ else
+ AL::readProperties(this, node);
+ }
+ selectItem(_pos, track, part, ctrl);
+ }
+
+//---------------------------------------------------------
+// write
+//---------------------------------------------------------
+
+void ListEdit::write(Xml& xml) const
+ {
+ xml.stag(metaObject()->className());
+ xml.writeProperties(this);
+
+ xml.tag("Track", lt.track->name());
+ if (lt.ctrl) {
+ xml.tag("Ctrl", lt.ctrl->id());
+ _pos.write(xml, "Pos");
+ }
+ xml.etag(metaObject()->className());
+ }
+
diff --git a/muse_qt4_evolution/muse/liste/listedit.h b/muse_qt4_evolution/muse/liste/listedit.h
new file mode 100644
index 00000000..b49e61c3
--- /dev/null
+++ b/muse_qt4_evolution/muse/liste/listedit.h
@@ -0,0 +1,98 @@
+//=============================================================================
+// 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.
+//=============================================================================
+
+#ifndef __LISTEDIT_H__
+#define __LISTEDIT_H__
+
+#include "al/pos.h"
+#include "cobject.h"
+
+class Track;
+class Part;
+class Ctrl;
+class CtrlListEditor;
+class PartListEditor;
+class TrackListEditor;
+
+//---------------------------------------------------------
+// ListType
+//---------------------------------------------------------
+
+enum { LIST_NONE, LIST_TRACK, LIST_PART, LIST_CTRL };
+
+struct ListType {
+ int id;
+ Track* track;
+ Part* part;
+ Ctrl* ctrl;
+
+ bool operator==(const ListType& t) const;
+ };
+
+Q_DECLARE_METATYPE(struct ListType);
+
+//---------------------------------------------------------
+// ListWidget
+// interface class
+//---------------------------------------------------------
+
+class ListWidget : public QWidget {
+ Q_OBJECT;
+
+ public:
+ ListWidget(QWidget* = 0) {}
+ virtual void setup(const ListType&) = 0;
+ };
+
+//---------------------------------------------------------
+// ListEdit
+//---------------------------------------------------------
+
+class ListEdit : public TopWin {
+ Q_OBJECT;
+
+ ListType lt;
+ AL::Pos _pos;
+
+ QStackedWidget* stack;
+ QTreeWidget* list;
+ CtrlListEditor* ctrlPanel;
+ PartListEditor* partPanel;
+ TrackListEditor* trackPanel;
+
+ void buildList();
+ QTreeWidgetItem* findItem(const ListType& lt, QTreeWidgetItem* item);
+ void selectItem();
+
+ private slots:
+ void itemChanged(QTreeWidgetItem*, QTreeWidgetItem*);
+ void itemExpanded(QTreeWidgetItem*);
+ void songChanged(int);
+
+ public:
+ ListEdit(QWidget* parent = 0);
+ void selectItem(const AL::Pos&, Track*, Part*, Ctrl*);
+ virtual void read(QDomNode);
+ virtual void write(Xml& xml) const;
+ AL::Pos& pos() { return _pos; }
+ };
+
+#endif
+
diff --git a/muse_qt4_evolution/muse/liste/partlistedit.cpp b/muse_qt4_evolution/muse/liste/partlistedit.cpp
new file mode 100644
index 00000000..d3db4de2
--- /dev/null
+++ b/muse_qt4_evolution/muse/liste/partlistedit.cpp
@@ -0,0 +1,434 @@
+//=============================================================================
+// 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.
+//=============================================================================
+
+#include "partlistedit.h"
+#include "track.h"
+#include "song.h"
+#include "al/pos.h"
+#include "awl/posedit.h"
+#include "part.h"
+
+//---------------------------------------------------------
+// PartListEditor
+//---------------------------------------------------------
+
+PartListEditor::PartListEditor(ListEdit* e, QWidget* parent)
+ : ListWidget(parent)
+ {
+ listEdit = e;
+ updateListDisabled = false;
+ curEvent = NULL;
+ QWidget* cew = new QWidget;
+ le.setupUi(cew);
+ QVBoxLayout* layout = new QVBoxLayout;
+ layout->addWidget(cew);
+ setLayout(layout);
+
+ QFontMetrics fm(le.eventList->font());
+ int zW = fm.width("0");
+ le.eventList->setColumnWidth(TICK_COL, zW * 8);
+ le.eventList->setColumnWidth(TIME_COL, zW * 14);
+ EventDelegate* eventDelegate = new EventDelegate(this);
+ le.eventList->setItemDelegate(eventDelegate);
+
+ part = 0;
+
+ connect(le.eventList, SIGNAL(itemActivated(QTreeWidgetItem*, int)),
+ SLOT(itemActivated(QTreeWidgetItem*,int)));
+ connect(le.eventList, SIGNAL(itemChanged(QTreeWidgetItem*, int)),
+ SLOT(itemChanged(QTreeWidgetItem*, int)));
+ connect(le.eventList,
+ SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
+ SLOT(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)));
+ connect(le.insertButton, SIGNAL(clicked()), SLOT(insertClicked()));
+ connect(le.deleteButton, SIGNAL(clicked()), SLOT(deleteClicked()));
+ }
+
+//---------------------------------------------------------
+// getTrack
+//---------------------------------------------------------
+
+Track* PartListEditor::getTrack() const
+ {
+ return part->track();
+ }
+
+//---------------------------------------------------------
+// setup
+//---------------------------------------------------------
+
+void PartListEditor::setup(const ListType& lt)
+ {
+ part = lt.part;
+ le.partName->setText(part->name());
+ updateList();
+ }
+
+//---------------------------------------------------------
+// updateList
+//---------------------------------------------------------
+
+void PartListEditor::updateList() {
+ if(updateListDisabled) {
+ updateListDisabled = false;
+ return;
+ }
+ EventList* el = part->events();
+ int idx = 0;
+ le.eventList->clear();
+ for (iEvent i = el->begin(); i != el->end(); ++i, ++idx) {
+ Event e = i->second;
+ QTreeWidgetItem* item = new QTreeWidgetItem;
+ item->setData(TICK_COL, Qt::TextAlignmentRole,
+ int(Qt::AlignRight | Qt::AlignVCenter));
+ item->setData(TIME_COL, Qt::TextAlignmentRole,
+ int(Qt::AlignRight | Qt::AlignVCenter));
+ item->setData(TICK_COL, Qt::DisplayRole, e.tick() + part->tick());
+ item->setData(TIME_COL, Qt::DisplayRole, e.tick() + part->tick());
+ item->setData(TYPE_COL, Qt::TextAlignmentRole,
+ int(Qt::AlignRight | Qt::AlignVCenter));
+ item->setData(TYPE_COL, Qt::DisplayRole, e.eventTypeName());
+ item->setData(A_COL, Qt::TextAlignmentRole,
+ int(Qt::AlignHCenter | Qt::AlignVCenter));
+ if(e.type()!=Sysex) item->setData(A_COL, Qt::DisplayRole, e.dataA());
+ item->setData(B_COL, Qt::TextAlignmentRole,
+ int(Qt::AlignHCenter | Qt::AlignVCenter));
+ if(e.type()!=Sysex) item->setData(B_COL, Qt::DisplayRole, e.dataB());
+ item->setData(C_COL, Qt::TextAlignmentRole,
+ int(Qt::AlignHCenter | Qt::AlignVCenter));
+ if(e.type()!=Sysex) item->setData(C_COL, Qt::DisplayRole, e.dataC());
+ item->setData(LEN_COL, Qt::TextAlignmentRole,
+ int(Qt::AlignHCenter | Qt::AlignVCenter));
+ item->setData(LEN_COL, Qt::DisplayRole,
+ (e.type()==Sysex?e.dataLen():e.lenTick()));
+ QString dataStr;
+ if(e.type()==Sysex)
+ dataStr = InsertEventDialog::charArray2Str((const char*)e.data(),
+ e.dataLen());
+ else dataStr = QString("");
+ item->setText(DATA_COL, dataStr);
+ le.eventList->insertTopLevelItem(idx, item);
+ }
+}
+
+//---------------------------------------------------------
+// item2Event
+//---------------------------------------------------------
+
+Event* PartListEditor::item2Event(QTreeWidgetItem* item, int time_col) {
+ if(item) {
+ int tick;
+ if(time_col == TICK_COL)
+ tick = item->data(TICK_COL, Qt::DisplayRole).toInt();
+ else tick = item->data(TIME_COL, Qt::DisplayRole).toInt();
+ int evTick = (unsigned)IED_MAX(0, (int)tick - (int)part->tick());
+ QString type = item->text(TYPE_COL);
+ if(type == "Note") {
+ Event* ev = new Event(Note);
+ int pitch = item->data(A_COL, Qt::DisplayRole).toInt();
+ int velo = item->data(B_COL, Qt::DisplayRole).toInt();
+ int len = item->data(LEN_COL, Qt::DisplayRole).toInt();
+ ev->setTick(evTick);
+ ev->setPitch(pitch);
+ ev->setVelo(velo);
+ ev->setLenTick(len);
+ return ev;
+ }
+ else if(type == "Sysex") {
+ Event* ev = new Event(Sysex);
+ QString dataStr = item->text(DATA_COL);
+ char* data = InsertEventDialog::Str2CharArray(dataStr);
+ int len = item->data(LEN_COL, Qt::DisplayRole).toInt();
+ ev->setTick(evTick);
+ ev->setData((const unsigned char*)data, len);
+ return ev;
+ }
+ else return NULL;
+ }
+ else return NULL;
+}
+
+//---------------------------------------------------------
+// itemActivated
+//---------------------------------------------------------
+
+void PartListEditor::itemActivated(QTreeWidgetItem* item, int column) {
+ AL::Pos time;
+ int tick = item->data(TIME_COL, Qt::DisplayRole).toInt();
+ time.setTick(tick);
+ Event* ev = item2Event(item);
+ EventList* el;
+
+ if(column == TYPE_COL) {
+ InsertEventDialog dialog(time, part, ev, this);
+ if(dialog.exec() == QDialog::Accepted) {
+ el = dialog.elResult();
+ if(el) {
+ if(ev) song->deleteEvent(*ev, part);
+ for(iEvent ie = el->begin(); ie != el->end(); ie++) {
+ Event e = ie->second;
+ song->addEvent(e, part);
+ }
+ }
+ }
+ }
+ else if((column==A_COL || column==B_COL || column==C_COL || column==LEN_COL)
+ && ev && ev->type()==Sysex) {
+ //DO NOTHING
+ }
+ else if(column == DATA_COL) {
+ if(ev && ev->type()==Sysex) {
+ InsertEventDialog dialog(time, part, ev, this);
+ if(dialog.exec() == QDialog::Accepted) {
+ el = dialog.elResult();
+ if(el) {
+ if(ev) song->deleteEvent(*ev, part);
+ for(iEvent ie = el->begin(); ie != el->end(); ie++) {
+ Event e = ie->second;
+ song->addEvent(e, part);
+ }
+ }
+ }
+ }
+ }
+ else le.eventList->openPersistentEditor(item, column);
+}
+
+//---------------------------------------------------------
+// itemChanged
+//---------------------------------------------------------
+
+void PartListEditor::itemChanged(QTreeWidgetItem* item, int column) {
+ updateListDisabled = (column != TICK_COL && column != TIME_COL);
+ if(item) {
+ Event* newEvent = item2Event(item, column);
+ song->changeEvent(*curEvent, *newEvent, part);
+ }
+}
+
+//---------------------------------------------------------
+// currentItemChanged
+//---------------------------------------------------------
+
+void PartListEditor::currentItemChanged(QTreeWidgetItem* cur,
+ QTreeWidgetItem* pre) {
+ if(pre) {
+ le.eventList->closePersistentEditor(pre, TICK_COL);
+ le.eventList->closePersistentEditor(pre, TIME_COL);
+ le.eventList->closePersistentEditor(pre, A_COL);
+ le.eventList->closePersistentEditor(pre, B_COL);
+ le.eventList->closePersistentEditor(pre, C_COL);
+ le.eventList->closePersistentEditor(pre, LEN_COL);
+ }
+ if(cur) {
+ curEvent = item2Event(cur);
+ }
+}
+
+//---------------------------------------------------------
+// insertClicked
+// insert one tick before current value
+//---------------------------------------------------------
+
+void PartListEditor::insertClicked()
+ {
+ QTreeWidgetItem* cur = le.eventList->currentItem();
+ AL::Pos time;
+ if(cur) {
+ int tick = cur->data(TIME_COL, Qt::DisplayRole).toInt();
+ time.setTick(tick);
+ }
+
+ EventList* el;
+
+ InsertEventDialog dialog(time, part, NULL, this);
+ if(dialog.exec() == QDialog::Accepted) {
+ el = dialog.elResult();
+ if(el) {
+ for(iEvent ie = el->begin(); ie != el->end(); ie++) {
+ Event e = ie->second;
+ song->addEvent(e, part);
+ }
+ }
+ }
+ }
+
+//---------------------------------------------------------
+// deleteClicked
+//---------------------------------------------------------
+
+void PartListEditor::deleteClicked()
+ {
+ QTreeWidgetItem* cur = le.eventList->currentItem();
+ if (cur == 0)
+ return;
+ Event* ev = item2Event(cur);
+ song->deleteEvent(*ev, part);
+ }
+
+//---------------------------------------------------------
+// EventDelegate
+//---------------------------------------------------------
+
+EventDelegate::EventDelegate(QObject* parent)
+ : QItemDelegate(parent)
+ {
+ }
+
+//---------------------------------------------------------
+// createEditor
+//---------------------------------------------------------
+
+QWidget* EventDelegate::createEditor(QWidget* pw,
+ const QStyleOptionViewItem& option, const QModelIndex& index) const
+ {
+ switch(index.column()) {
+ case PartListEditor::TICK_COL:
+ break;
+ case PartListEditor::TIME_COL:
+ return new Awl::PosEdit(pw);
+ case PartListEditor::TYPE_COL:
+ case PartListEditor::A_COL:
+ case PartListEditor::B_COL:
+ case PartListEditor::C_COL:
+ case PartListEditor::LEN_COL:
+ case PartListEditor::DATA_COL:
+ break;
+ }
+ return QItemDelegate::createEditor(pw, option, index);
+ }
+
+//---------------------------------------------------------
+// setEditorData
+//---------------------------------------------------------
+
+void EventDelegate::setEditorData(QWidget* editor,
+ const QModelIndex& index) const
+ {
+ switch(index.column()) {
+ case PartListEditor::TICK_COL:
+ break;
+ case PartListEditor::TIME_COL:
+ {
+ Awl::PosEdit* pe = static_cast<Awl::PosEdit*>(editor);
+ pe->setValue(AL::Pos(index.data().toInt()));
+ }
+ return;
+ case PartListEditor::TYPE_COL:
+ case PartListEditor::A_COL:
+ case PartListEditor::B_COL:
+ case PartListEditor::C_COL:
+ case PartListEditor::LEN_COL:
+ case PartListEditor::DATA_COL:
+ break;
+ }
+ QItemDelegate::setEditorData(editor, index);
+ }
+
+//---------------------------------------------------------
+// setModelData
+//---------------------------------------------------------
+
+void EventDelegate::setModelData(QWidget* editor, QAbstractItemModel* model,
+ const QModelIndex& index) const
+ {
+ switch(index.column()) {
+ case PartListEditor::TICK_COL:
+ break;
+ case PartListEditor::TIME_COL:
+ {
+ Awl::PosEdit* pe = static_cast<Awl::PosEdit*>(editor);
+ model->setData(index, pe->pos().tick(), Qt::DisplayRole);
+ }
+ return;
+ case PartListEditor::TYPE_COL:
+ case PartListEditor::A_COL:
+ case PartListEditor::B_COL:
+ case PartListEditor::C_COL:
+ case PartListEditor::LEN_COL:
+ case PartListEditor::DATA_COL:
+ break;
+ }
+ QItemDelegate::setModelData(editor, model, index);
+ }
+
+//---------------------------------------------------------
+// paint
+//---------------------------------------------------------
+
+void EventDelegate::paint(QPainter* painter,
+ const QStyleOptionViewItem& option, const QModelIndex& index) const
+ {
+ QString text;
+ PartListEditor* ce = static_cast<PartListEditor*>(parent());
+
+ switch(index.column()) {
+ case PartListEditor::TICK_COL:
+ {
+ Track* track = ce->getTrack();
+ AL::Pos pos(index.data().toInt(), track->timeType());
+ text = QString("%1").arg(pos.tick());
+ }
+ break;
+ case PartListEditor::TIME_COL:
+ {
+ Track* track = ce->getTrack();
+ AL::Pos pos(index.data().toInt(), track->timeType());
+ int measure, beat, tick;
+ pos.mbt(&measure, &beat, &tick);
+ text.sprintf("%04d.%02d.%03u", measure+1, beat+1, tick);
+ }
+ break;
+ case PartListEditor::TYPE_COL:
+ case PartListEditor::A_COL:
+ case PartListEditor::B_COL:
+ case PartListEditor::C_COL:
+ case PartListEditor::LEN_COL:
+ case PartListEditor::DATA_COL:
+ QItemDelegate::paint(painter, option, index);
+ return;
+ }
+
+ QStyleOptionViewItemV2 opt = setOptions(index, option);
+ const QStyleOptionViewItemV2 *v2 = qstyleoption_cast<const QStyleOptionViewItemV2 *>(&option);
+ opt.features = v2 ? v2->features : QStyleOptionViewItemV2::ViewItemFeatures(QStyleOptionViewItemV2::None);
+
+ painter->save();
+ QVariant value;
+ QRect displayRect;
+ displayRect = option.rect; // textRectangle(painter, d->textLayoutBounds(opt), opt.font, text);
+
+ QRect checkRect;
+ Qt::CheckState checkState = Qt::Unchecked;
+ value = index.data(Qt::CheckStateRole);
+ if (value.isValid()) {
+ checkState = static_cast<Qt::CheckState>(value.toInt());
+ checkRect = check(opt, opt.rect, value);
+ }
+
+ drawBackground(painter, opt, index);
+ drawCheck(painter, opt, checkRect, checkState);
+ drawDisplay(painter, opt, displayRect, text);
+ drawFocus(painter, opt, text.isEmpty() ? QRect() : displayRect);
+ painter->restore();
+ }
+
+
+
diff --git a/muse_qt4_evolution/muse/liste/partlistedit.h b/muse_qt4_evolution/muse/liste/partlistedit.h
new file mode 100644
index 00000000..10eda46a
--- /dev/null
+++ b/muse_qt4_evolution/muse/liste/partlistedit.h
@@ -0,0 +1,79 @@
+//=============================================================================
+// 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.
+//=============================================================================
+
+#ifndef __PARTLISTEDIT_H__
+#define __PARTLISTEDIT_H__
+
+#include "al/pos.h"
+#include "ieventdialog.h"
+#include "listedit.h"
+#include "ui_partlistedit.h"
+
+//---------------------------------------------------------
+// EventDelegate
+//---------------------------------------------------------
+
+class EventDelegate : public QItemDelegate {
+ Q_OBJECT
+
+ virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem&,
+ const QModelIndex& index) const;
+ virtual void setEditorData(QWidget* editor, const QModelIndex&) const;
+ virtual void setModelData(QWidget* editor, QAbstractItemModel*,
+ const QModelIndex&) const;
+ void paint(QPainter*, const QStyleOptionViewItem&,
+ const QModelIndex&) const;
+
+ public:
+ EventDelegate(QObject* parent = 0);
+ };
+
+//---------------------------------------------------------
+// PartListEditor
+//---------------------------------------------------------
+
+class PartListEditor : public ListWidget {
+ Q_OBJECT
+
+ ListEdit* listEdit;
+ Ui::PartListEdit le;
+ Part* part;
+ Event* curEvent;
+ bool updateListDisabled;
+
+ void updateList();
+ Event* item2Event(QTreeWidgetItem* item, int time_col = TICK_COL);
+
+ private slots:
+ void itemActivated(QTreeWidgetItem* item, int column);
+ void itemChanged(QTreeWidgetItem* item, int column);
+ void currentItemChanged(QTreeWidgetItem* cur, QTreeWidgetItem* pre);
+ void insertClicked();
+ void deleteClicked();
+
+ public:
+ PartListEditor(ListEdit*, QWidget* parent = 0);
+ virtual void setup(const ListType&);
+ Track* getTrack() const;
+ enum { TICK_COL, TIME_COL, TYPE_COL, A_COL, B_COL, C_COL, LEN_COL, DATA_COL};
+ };
+
+#endif
+
diff --git a/muse_qt4_evolution/muse/liste/partlistedit.ui b/muse_qt4_evolution/muse/liste/partlistedit.ui
new file mode 100644
index 00000000..c575ef03
--- /dev/null
+++ b/muse_qt4_evolution/muse/liste/partlistedit.ui
@@ -0,0 +1,166 @@
+<ui version="4.0" >
+ <class>PartListEdit</class>
+ <widget class="QWidget" name="PartListEdit" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>341</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font" >
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text" >
+ <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
+p, li { white-space: pre-wrap; }
+&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:600; font-style:normal; text-decoration:none;">
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-weight:400;">Part:&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="partName" />
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string>Eventlist:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QTreeWidget" name="eventList" >
+ <property name="alternatingRowColors" >
+ <bool>true</bool>
+ </property>
+ <property name="indentation" >
+ <number>0</number>
+ </property>
+ <property name="rootIsDecorated" >
+ <bool>false</bool>
+ </property>
+ <property name="uniformRowHeights" >
+ <bool>true</bool>
+ </property>
+ <property name="itemsExpandable" >
+ <bool>false</bool>
+ </property>
+ <column>
+ <property name="text" >
+ <string>Tick</string>
+ </property>
+ </column>
+ <column>
+ <property name="text" >
+ <string>Time</string>
+ </property>
+ </column>
+ <column>
+ <property name="text" >
+ <string>Type</string>
+ </property>
+ </column>
+ <column>
+ <property name="text" >
+ <string>Val A</string>
+ </property>
+ </column>
+ <column>
+ <property name="text" >
+ <string>Val B</string>
+ </property>
+ </column>
+ <column>
+ <property name="text" >
+ <string>Val C</string>
+ </property>
+ </column>
+ <column>
+ <property name="text" >
+ <string>Length</string>
+ </property>
+ </column>
+ <column>
+ <property name="text" >
+ <string>Data</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QToolButton" name="deleteButton" >
+ <property name="text" >
+ <string>Delete</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="insertButton" >
+ <property name="text" >
+ <string>Insert</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>231</width>
+ <height>29</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/muse_qt4_evolution/muse/liste/tracklistedit.cpp b/muse_qt4_evolution/muse/liste/tracklistedit.cpp
new file mode 100644
index 00000000..24fc4722
--- /dev/null
+++ b/muse_qt4_evolution/muse/liste/tracklistedit.cpp
@@ -0,0 +1,65 @@
+//=============================================================================
+// 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.
+//=============================================================================
+
+#include "tracklistedit.h"
+#include "track.h"
+#include "song.h"
+#include "al/pos.h"
+#include "awl/posedit.h"
+
+//---------------------------------------------------------
+// TrackListEditor
+//---------------------------------------------------------
+
+TrackListEditor::TrackListEditor(ListEdit* e, QWidget* parent)
+ : ListWidget(parent)
+ {
+ listEdit = e;
+ QWidget* cew = new QWidget;
+ le.setupUi(cew);
+ QVBoxLayout* layout = new QVBoxLayout;
+ layout->addWidget(cew);
+ setLayout(layout);
+
+ QFontMetrics fm(le.partList->font());
+ int zW = fm.width("0");
+ le.partList->setColumnWidth(TICK_COL, zW * 8);
+ le.partList->setColumnWidth(TIME_COL, zW * 14);
+ track = 0;
+ }
+
+//---------------------------------------------------------
+// setup
+//---------------------------------------------------------
+
+void TrackListEditor::setup(const ListType& lt)
+ {
+ track = lt.track;
+ le.trackName->setText(track->name());
+ updateList();
+ }
+
+//---------------------------------------------------------
+// updateList
+//---------------------------------------------------------
+
+void TrackListEditor::updateList()
+ {
+ }
diff --git a/muse_qt4_evolution/muse/liste/tracklistedit.h b/muse_qt4_evolution/muse/liste/tracklistedit.h
new file mode 100644
index 00000000..7d4b57f7
--- /dev/null
+++ b/muse_qt4_evolution/muse/liste/tracklistedit.h
@@ -0,0 +1,50 @@
+//=============================================================================
+// 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.
+//=============================================================================
+
+#ifndef __TRACKLISTEDIT_H__
+#define __TRACKLISTEDIT_H__
+
+#include "al/pos.h"
+#include "listedit.h"
+#include "ui_tracklistedit.h"
+
+//---------------------------------------------------------
+// TrackListEditor
+//---------------------------------------------------------
+
+class TrackListEditor : public ListWidget {
+ Q_OBJECT
+
+ ListEdit* listEdit;
+ Ui::TrackListEdit le;
+ Track* track;
+
+ void updateList();
+
+ private slots:
+
+ public:
+ TrackListEditor(ListEdit*, QWidget* parent = 0);
+ virtual void setup(const ListType&);
+ enum { TICK_COL, TIME_COL };
+ };
+
+#endif
+
diff --git a/muse_qt4_evolution/muse/liste/tracklistedit.ui b/muse_qt4_evolution/muse/liste/tracklistedit.ui
new file mode 100644
index 00000000..dfddf1c7
--- /dev/null
+++ b/muse_qt4_evolution/muse/liste/tracklistedit.ui
@@ -0,0 +1,146 @@
+<ui version="4.0" >
+ <class>TrackListEdit</class>
+ <widget class="QWidget" name="TrackListEdit" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>341</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="font" >
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text" >
+ <string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
+p, li { white-space: pre-wrap; }
+&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:600; font-style:normal; text-decoration:none;">
+&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-weight:400;">Track:&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="trackName" />
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string>Partlist:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QTreeWidget" name="partList" >
+ <property name="alternatingRowColors" >
+ <bool>true</bool>
+ </property>
+ <property name="indentation" >
+ <number>0</number>
+ </property>
+ <property name="rootIsDecorated" >
+ <bool>false</bool>
+ </property>
+ <property name="uniformRowHeights" >
+ <bool>true</bool>
+ </property>
+ <property name="itemsExpandable" >
+ <bool>false</bool>
+ </property>
+ <column>
+ <property name="text" >
+ <string>Tick</string>
+ </property>
+ </column>
+ <column>
+ <property name="text" >
+ <string>Time</string>
+ </property>
+ </column>
+ <column>
+ <property name="text" >
+ <string>Len</string>
+ </property>
+ </column>
+ <column>
+ <property name="text" >
+ <string>Name</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QToolButton" name="deleteButton" >
+ <property name="text" >
+ <string>Delete</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="insertButton" >
+ <property name="text" >
+ <string>Insert</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>231</width>
+ <height>29</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>