diff options
-rw-r--r-- | muse2/ChangeLog | 1 | ||||
-rw-r--r-- | muse2/muse/arranger/tlist.cpp | 36 | ||||
-rw-r--r-- | muse2/muse/arranger/tlist.h | 4 |
3 files changed, 40 insertions, 1 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog index 5e2b578f..41bfbb73 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -2,6 +2,7 @@ - implemented cut,copy'n'paste and the "select foo" entries in the score editor (flo93) - added select_foo() functions to functions.cpp (flo93) - removed "midi in" button from score editor (flo93) + - added a spinbox to the arranger's "Ch:" column (flo93) 29.05.2011: - moved cut,copy'n'paste to functions.cpp, removed unneccessary duplication (flo93) - changed behaviour of paste: now the pasted, not the original notes are selected (flo93) diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp index bd58ad88..4f050c46 100644 --- a/muse2/muse/arranger/tlist.cpp +++ b/muse2/muse/arranger/tlist.cpp @@ -21,6 +21,7 @@ #include <QScrollBar> #include <QWheelEvent> #include <QIcon> +#include <QSpinBox> #include "popupmenu.h" #include "globals.h" @@ -438,6 +439,20 @@ void TList::returnPressed() setFocus(); } +void TList::chanValueChanged(int val) +{ + Track* track = editTrack->clone(false); + ((MidiTrack*)editTrack)->setOutChannel(val-1); + audio->msgChangeTrack(track, editTrack); +} + +void TList::chanValueFinished() +{ + editTrack = 0; + chan_edit->hide(); + setFocus(); +} + //--------------------------------------------------------- // adjustScrollbar //--------------------------------------------------------- @@ -491,7 +506,7 @@ void TList::mouseDoubleClickEvent(QMouseEvent* ev) if (section == COL_NAME) { editTrack = t; if (editor == 0) { - editor = new QLineEdit(this); + editor = new QLineEdit(this); /*connect(editor, SIGNAL(returnPressed()), SLOT(returnPressed()));*/ editor->setFrame(true); @@ -502,6 +517,25 @@ void TList::mouseDoubleClickEvent(QMouseEvent* ev) editMode = true; editor->show(); } + else if (section == COL_OCHANNEL) { + if (t->isMidiTrack() && t->type() != Track::DRUM) + { + editTrack=t; + if (chan_edit==0) { + chan_edit=new QSpinBox(this); + chan_edit->setMinimum(1); + chan_edit->setMaximum(16); + connect(chan_edit, SIGNAL(valueChanged(int)), SLOT(chanValueChanged(int))); + connect(chan_edit, SIGNAL(editingFinished()), SLOT(chanValueFinished())); + } + chan_edit->setValue(((MidiTrack*)editTrack)->outChannel()+1); + int w=colw; + if (w < chan_edit->sizeHint().width()) w=chan_edit->sizeHint().width(); + chan_edit->setGeometry(colx, coly, w, colh); + chan_edit->show(); + chan_edit->setFocus(); + } + } else mousePressEvent(ev); } diff --git a/muse2/muse/arranger/tlist.h b/muse2/muse/arranger/tlist.h index 15be450a..607ca8c0 100644 --- a/muse2/muse/arranger/tlist.h +++ b/muse2/muse/arranger/tlist.h @@ -14,6 +14,7 @@ class QKeyEvent; class QLineEdit; +class QSpinBox; class QMouseEvent; class QPaintEvent; class QResizeEvent; @@ -57,6 +58,7 @@ class TList : public QWidget { Header* header; QScrollBar* _scroll; QLineEdit* editor; + QSpinBox* chan_edit; Track* editTrack; Track* editAutomation; @@ -92,6 +94,8 @@ class TList : public QWidget { private slots: void returnPressed(); + void chanValueChanged(int); + void chanValueFinished(); void songChanged(int flags); void changeAutomation(QAction*); void changeAutomationColor(QAction*); |