diff options
author | Robert Jonsson <spamatica@gmail.com> | 2011-01-10 22:11:46 +0000 |
---|---|---|
committer | Robert Jonsson <spamatica@gmail.com> | 2011-01-10 22:11:46 +0000 |
commit | 50e1ec05dd9034a7d328a5f3f27979a3d32c7706 (patch) | |
tree | e91255c2bdc95269db98b2c0392f393e352e376b /muse2/muse | |
parent | 66d7b789a154ca96a610ca1200a0e2e2817b82fa (diff) |
automation view fixes
Diffstat (limited to 'muse2/muse')
-rw-r--r-- | muse2/muse/arranger/tlist.cpp | 29 | ||||
-rw-r--r-- | muse2/muse/arranger/tlist.h | 1 | ||||
-rw-r--r-- | muse2/muse/ctrl.cpp | 17 |
3 files changed, 26 insertions, 21 deletions
diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp index e32d0010..542e64c8 100644 --- a/muse2/muse/arranger/tlist.cpp +++ b/muse2/muse/arranger/tlist.cpp @@ -335,8 +335,17 @@ void TList::paint(const QRect& r) QString s="-"; if (!track->isMidiTrack()) { + CtrlListList* cll = ((AudioTrack*)track)->controller(); + int countAll=0, countVisible=0; + for(CtrlListList::iterator icll =cll->begin();icll!=cll->end();++icll) { + CtrlList *cl = icll->second; + if (!cl->dontShow()) + countAll++; + if (cl->isVisible()) + countVisible++; + } int count = ((AudioTrack*)track)->controller()->size(); - s.sprintf("%d viewed", count); + s.sprintf(" %d(%d) visible",countVisible, countAll); } @@ -778,18 +787,16 @@ TrackList TList::getRecEnabledTracks() void TList::changeAutomation(QAction* act) { printf("changeAutomation!\n"); - if (editTrack->type() == Track::MIDI) { + if (editAutomation->type() == Track::MIDI) { printf("this is wrong, we can't edit automation for midi tracks from arranger yet!\n"); return; } - CtrlListList* cll = ((AudioTrack*)editTrack)->controller(); - int index=0; + CtrlListList* cll = ((AudioTrack*)editAutomation)->controller(); for(CtrlListList::iterator icll =cll->begin();icll!=cll->end();++icll) { - if (act->data() == index++) { // got it, change state - CtrlList *cl = icll->second; - cl->setVisible(!cl->isVisible()); - } + CtrlList *cl = icll->second; + if (act->data() == cl->id()) // got it, change state + cl->setVisible(!cl->isVisible()); } song->update(SC_TRACK_MODIFIED); } @@ -942,22 +949,22 @@ void TList::mousePressEvent(QMouseEvent* ev) case COL_AUTOMATION: { if (t->type() != Track::MIDI) { - editTrack = t; + editAutomation = t; PopupMenu* p = new PopupMenu(); p->disconnect(); p->clear(); p->setTitle(tr("Viewable automation")); CtrlListList* cll = ((AudioTrack*)t)->controller(); QAction* act = 0; - int index=0; for(CtrlListList::iterator icll =cll->begin();icll!=cll->end();++icll) { CtrlList *cl = icll->second; + printf("id = %d", cl->id()); if (cl->dontShow()) continue; act = p->addAction(cl->name()); act->setCheckable(true); act->setChecked(cl->isVisible()); - act->setData(index++); + act->setData(cl->id()); } connect(p, SIGNAL(triggered(QAction*)), SLOT(changeAutomation(QAction*))); //connect(p, SIGNAL(aboutToHide()), muse, SLOT(routingPopupMenuAboutToHide())); diff --git a/muse2/muse/arranger/tlist.h b/muse2/muse/arranger/tlist.h index 188685bc..9ecd5d57 100644 --- a/muse2/muse/arranger/tlist.h +++ b/muse2/muse/arranger/tlist.h @@ -55,6 +55,7 @@ class TList : public QWidget { QScrollBar* _scroll; QLineEdit* editor; Track* editTrack; + Track* editAutomation; int startY; int curY; diff --git a/muse2/muse/ctrl.cpp b/muse2/muse/ctrl.cpp index 42802829..2a6f7cb0 100644 --- a/muse2/muse/ctrl.cpp +++ b/muse2/muse/ctrl.cpp @@ -20,18 +20,13 @@ void CtrlList::initColor(int i) { - if (i == 0) - _displayColor = Qt::red; - else if (i == 1) - _displayColor = Qt::yellow; - else - _displayColor = Qt::black; + QColor collist[] = { Qt::red, Qt::yellow, Qt::blue , Qt::green, Qt::white, Qt::black }; - if (i < 2) - _visible = true; + if (i < 5) + _displayColor = collist[i%6]; else + _displayColor = Qt::gray; _visible = false; - } @@ -46,6 +41,7 @@ CtrlList::CtrlList(int id) _default = 0.0; _curVal = 0.0; _mode = INTERPOLATE; + _dontShow = false; initColor(id); } //--------------------------------------------------------- @@ -73,7 +69,8 @@ CtrlList::CtrlList() _default = 0.0; _curVal = 0.0; _mode = INTERPOLATE; - initColor(0); + _dontShow = false; + initColor(-1); } //--------------------------------------------------------- |