diff options
author | Robert Jonsson <spamatica@gmail.com> | 2011-01-04 19:16:13 +0000 |
---|---|---|
committer | Robert Jonsson <spamatica@gmail.com> | 2011-01-04 19:16:13 +0000 |
commit | 217b37620cb47a9a6d9ae6c4027638d763e9df1b (patch) | |
tree | cac9681fa81489f57cbb29f9ae62da4fcbaa1665 /muse2/muse/arranger/tlist.cpp | |
parent | 212f604407e4a712563ca71eb281161ffcc91d85 (diff) |
automation viewable in arranger and rec changes
Diffstat (limited to 'muse2/muse/arranger/tlist.cpp')
-rw-r--r-- | muse2/muse/arranger/tlist.cpp | 125 |
1 files changed, 97 insertions, 28 deletions
diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp index 4c104e0b..02f742f7 100644 --- a/muse2/muse/arranger/tlist.cpp +++ b/muse2/muse/arranger/tlist.cpp @@ -21,6 +21,7 @@ #include <QScrollBar> #include <QWheelEvent> +#include "popupmenu.h" #include "globals.h" #include "icons.h" #include "scrollscale.h" @@ -329,19 +330,19 @@ void TList::paint(const QRect& r) p.drawText(r, Qt::AlignVCenter|Qt::AlignLeft, s); } break; -// case COL_AUTOMATION: -// { -// QString s="-"; -// -// if (!track->isMidiTrack()) { -// int count = ((AudioTrack*)track)->controller()->size(); -// s.sprintf("%d", count); -// } -// -// -// p.drawText(r, Qt::AlignVCenter|Qt::AlignLeft, s); -// } -// break; + case COL_AUTOMATION: + { + QString s="-"; + + if (!track->isMidiTrack()) { + int count = ((AudioTrack*)track)->controller()->size(); + s.sprintf("%d viewed", count); + } + + + p.drawText(r, Qt::AlignVCenter|Qt::AlignLeft, s); + } + break; default: break; } @@ -774,6 +775,25 @@ TrackList TList::getRecEnabledTracks() // mousePressEvent //--------------------------------------------------------- +void TList::changeAutomation(QAction* act) +{ + printf("changeAutomation!\n"); + if (editTrack->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; + 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()); + } + } + song->update(SC_TRACK_MODIFIED); +} + void TList::mousePressEvent(QMouseEvent* ev) { int x = ev->x(); @@ -919,24 +939,73 @@ void TList::mousePressEvent(QMouseEvent* ev) mode = START_DRAG; switch (col) { + case COL_AUTOMATION: + { + if (t->type() != Track::MIDI) { + editTrack = 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; + if (cl->dontShow()) + continue; + act = p->addAction(cl->name()); + act->setCheckable(true); + act->setChecked(cl->isVisible()); + act->setData(index++); + } + connect(p, SIGNAL(triggered(QAction*)), SLOT(changeAutomation(QAction*))); + //connect(p, SIGNAL(aboutToHide()), muse, SLOT(routingPopupMenuAboutToHide())); + //p->popup(QCursor::pos()); + p->exec(QCursor::pos()); + + delete p; + } + break; + } + case COL_RECORD: { - bool val = !(t->recordFlag()); - if (!t->isMidiTrack()) { - if (t->type() == Track::AUDIO_OUTPUT) { - if (val && t->recordFlag() == false) { - muse->bounceToFile((AudioOutput*)t); + bool val = !(t->recordFlag()); + if (button == Qt::LeftButton) { + if (!t->isMidiTrack()) { + if (t->type() == Track::AUDIO_OUTPUT) { + if (val && t->recordFlag() == false) { + muse->bounceToFile((AudioOutput*)t); + } + audio->msgSetRecord((AudioOutput*)t, val); + if (!((AudioOutput*)t)->recFile()) + val = false; + else + return; } - audio->msgSetRecord((AudioOutput*)t, val); - if (!((AudioOutput*)t)->recFile()) - val = false; - else + song->setRecordFlag(t, val); + } + else + song->setRecordFlag(t, val); + } else if (button == Qt::RightButton) { + // enable or disable ALL tracks of this type + if (!t->isMidiTrack()) { + if (t->type() == Track::AUDIO_OUTPUT) { return; + } + WaveTrackList* wtl = song->waves(); + foreach (WaveTrack *wt, *wtl) { + song->setRecordFlag(wt, val); + } } - song->setRecordFlag(t, val); + else { + MidiTrackList* mtl = song->midis(); + foreach (MidiTrack *mt, *mtl) { + song->setRecordFlag(mt, val); + } } - else - song->setRecordFlag(t, val); + } } break; case COL_NONE: @@ -1001,7 +1070,7 @@ void TList::mousePressEvent(QMouseEvent* ev) mode = NORMAL; QMenu* p = new QMenu; //p->clear(); - p->addAction(QIcon(*automation_clear_dataIcon), tr("Delete Track"))->setData(0); // ddskrjo + p->addAction(QIcon(*automation_clear_dataIcon), tr("Delete Track"))->setData(0); p->addAction(QIcon(*track_commentIcon), tr("Track Comment"))->setData(1); QAction* act = p->exec(ev->globalPos(), 0); if (act) { @@ -1238,7 +1307,7 @@ void TList::mouseReleaseEvent(QMouseEvent* ev) setCursor(QCursor(Qt::ArrowCursor)); redraw(); } - if (editTrack) + if (editTrack && editor && editor->isVisible()) editor->setFocus(); adjustScrollbar(); } @@ -1265,7 +1334,7 @@ void TList::wheelEvent(QWheelEvent* ev) case COL_NONE: case COL_CLASS: case COL_NAME: - //case COL_AUTOMATION: + case COL_AUTOMATION: break; case COL_MUTE: // p3.3.29 |