From 50e1ec05dd9034a7d328a5f3f27979a3d32c7706 Mon Sep 17 00:00:00 2001 From: Robert Jonsson Date: Mon, 10 Jan 2011 22:11:46 +0000 Subject: automation view fixes --- muse2/ChangeLog | 1 + muse2/muse/arranger/tlist.cpp | 29 ++++++++++++++++++----------- muse2/muse/arranger/tlist.h | 1 + muse2/muse/ctrl.cpp | 17 +++++++---------- 4 files changed, 27 insertions(+), 21 deletions(-) (limited to 'muse2') diff --git a/muse2/ChangeLog b/muse2/ChangeLog index b4293af5..5e9bf356 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -6,6 +6,7 @@ Click on audio strip iR, or midi strip oR, or midi track info oR buttons to see new additions. Tested thoroughly, but of course this major change needs wider testing. TODO TODO: Fix trackinfo width (a minor button placement gui issue). + * Some tweaks for automation viewing, more to do. (rj) 04.01.2011: - Added saving and restoring of pianoroll trackinfo h-splitter state. (Tim) - Fixed multiple velocity controllers appearing on song reload. Tested OK. (Tim) 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); } //--------------------------------------------------------- -- cgit v1.2.3