summaryrefslogtreecommitdiff
path: root/muse2/muse/widgets/mtrackinfo.cpp
diff options
context:
space:
mode:
authorTim E. Real <termtech@rogers.com>2011-05-19 07:43:06 +0000
committerTim E. Real <termtech@rogers.com>2011-05-19 07:43:06 +0000
commit0f3ed66e83d6639452a5aa219b9a6bf2bfd54897 (patch)
tree950c324e7301f657cba543d8ccbb268ca40e418f /muse2/muse/widgets/mtrackinfo.cpp
parent0792c2ec66dacfff10899cbe171cb661871617f1 (diff)
Popup menus now auto-scroll if too large to fit on desktop.
Midi track info patch popup now stays open for auditioning patches. Editor 'ctrl' controller popups: Split instrument/other (+ common controls!) + show ctrl numbers.
Diffstat (limited to 'muse2/muse/widgets/mtrackinfo.cpp')
-rw-r--r--muse2/muse/widgets/mtrackinfo.cpp46
1 files changed, 39 insertions, 7 deletions
diff --git a/muse2/muse/widgets/mtrackinfo.cpp b/muse2/muse/widgets/mtrackinfo.cpp
index acdfb42f..47576823 100644
--- a/muse2/muse/widgets/mtrackinfo.cpp
+++ b/muse2/muse/widgets/mtrackinfo.cpp
@@ -1036,6 +1036,29 @@ void MidiTrackInfo::iPanChanged(int val)
}
//---------------------------------------------------------
+// instrPopupActivated
+//---------------------------------------------------------
+
+void MidiTrackInfo::instrPopupActivated(QAction* act)
+{
+ printf("MidiTrackInfo::instrPopupActivated\n"); // REMOVE Tim
+
+ if(act && selected)
+ {
+ int rv = act->data().toInt();
+ if(rv != -1)
+ {
+ MidiTrack* track = (MidiTrack*)selected;
+ int channel = track->outChannel();
+ int port = track->outPort();
+ MidiPlayEvent ev(0, port, channel, ME_CONTROLLER, CTRL_PROGRAM, rv);
+ audio->msgPlayMidiEvent(&ev);
+ updateTrackInfo(-1);
+ }
+ }
+}
+
+//---------------------------------------------------------
// instrPopup
//---------------------------------------------------------
@@ -1047,7 +1070,9 @@ void MidiTrackInfo::instrPopup()
int channel = track->outChannel();
int port = track->outPort();
MidiInstrument* instr = midiPorts[port].instrument();
- QMenu* pup = new QMenu;
+ //QMenu* pup = new QMenu;
+ PopupMenu* pup = new PopupMenu(true);
+
///instr->populatePatchPopup(pop, channel, song->mtype(), track->type() == Track::DRUM);
instr->populatePatchPopup(pup, channel, song->mtype(), track->type() == Track::DRUM);
@@ -1059,14 +1084,21 @@ void MidiTrackInfo::instrPopup()
return;
}
+ connect(pup, SIGNAL(triggered(QAction*)), SLOT(instrPopupActivated(QAction*)));
+ //connect(pup, SIGNAL(hovered(QAction*)), SLOT(instrPopupActivated(QAction*)));
+
///QAction *act = pop->exec(iPatch->mapToGlobal(QPoint(10,5)));
QAction *act = pup->exec(iPatch->mapToGlobal(QPoint(10,5)));
- if (act) {
- int rv = act->data().toInt();
- MidiPlayEvent ev(0, port, channel, ME_CONTROLLER, CTRL_PROGRAM, rv);
- audio->msgPlayMidiEvent(&ev);
- updateTrackInfo(-1);
- }
+ if(act)
+ {
+ int rv = act->data().toInt();
+ if(rv != -1)
+ {
+ MidiPlayEvent ev(0, port, channel, ME_CONTROLLER, CTRL_PROGRAM, rv);
+ audio->msgPlayMidiEvent(&ev);
+ updateTrackInfo(-1);
+ }
+ }
delete pup;
}