summaryrefslogtreecommitdiff
path: root/muse2
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2012-03-15 16:56:45 +0000
committerFlorian Jung <flo@windfisch.org>2012-03-15 16:56:45 +0000
commit2d6f113a10eb485694e20a78500f650776d701e3 (patch)
tree5f87ba98126da1027c0e3ebc362192c32c9f7a4e /muse2
parenta5ced1d15d584b2c4f7489f181224582c38da0f4 (diff)
custom program column now opens its menu with a single click
Diffstat (limited to 'muse2')
-rw-r--r--muse2/muse/arranger/tlist.cpp86
1 files changed, 47 insertions, 39 deletions
diff --git a/muse2/muse/arranger/tlist.cpp b/muse2/muse/arranger/tlist.cpp
index 212948c7..0ed201bf 100644
--- a/muse2/muse/arranger/tlist.cpp
+++ b/muse2/muse/arranger/tlist.cpp
@@ -833,37 +833,7 @@ void TList::mouseDoubleClickEvent(QMouseEvent* ev)
ctrl_edit->show();
ctrl_edit->setFocus();
}
- else
- {
- MusECore::MidiInstrument* instr = mp->instrument();
-
- PopupMenu* pup = new PopupMenu(true);
- instr->populatePatchPopup(pup, mt->outChannel(), MusEGlobal::song->mtype(), mt->isDrumTrack());
-
- if(pup->actions().count() == 0)
- {
- delete pup;
- return;
- }
-
- connect(pup, SIGNAL(triggered(QAction*)), SLOT(instrPopupActivated(QAction*)));
-
- QAction *act = pup->exec(ev->globalPos());
- if(act)
- {
- int val = act->data().toInt();
- if(val != -1)
- {
- MusECore::Event a(MusECore::Controller);
- a.setTick(0);
- a.setA(MusECore::CTRL_PROGRAM);
- a.setB(val);
- MusEGlobal::song->recordEvent(mt, a);
- }
- }
-
- delete pup;
- }
+ // else: the CTRL_PROGRAM popup is displayed with a single click
ev->accept();
}
}
@@ -1923,17 +1893,16 @@ void TList::mousePressEvent(QMouseEvent* ev)
break;
default:
- if (col>=COL_CUSTOM_MIDICTRL_OFFSET)
+ mode = START_DRAG;
+ if (col>=COL_CUSTOM_MIDICTRL_OFFSET && t->isMidiTrack())
{
- mode = START_DRAG;
-
int delta = 0;
if (button == Qt::RightButton)
delta = 1;
else if (button == Qt::MidButton)
delta = -1;
- if (delta!=0 && t->isMidiTrack())
+ if (delta!=0)
{
MusECore::MidiTrack* mt = dynamic_cast<MusECore::MidiTrack*>(t);
if (mt == 0)
@@ -1998,12 +1967,51 @@ void TList::mousePressEvent(QMouseEvent* ev)
}
}
}
+ else // if (delta==0)
+ {
+ ctrl_num=Arranger::custom_columns[col-COL_CUSTOM_MIDICTRL_OFFSET].ctrl;
+
+ if (ctrl_num==MusECore::CTRL_PROGRAM)
+ {
+ editTrack=t;
+
+ MusECore::MidiTrack* mt=(MusECore::MidiTrack*)t;
+ MusECore::MidiPort* mp = &MusEGlobal::midiPorts[mt->outPort()];
+ MusECore::MidiController* mctl = mp->midiController(ctrl_num);
+ MusECore::MidiInstrument* instr = mp->instrument();
+
+ PopupMenu* pup = new PopupMenu(true);
+ instr->populatePatchPopup(pup, mt->outChannel(), MusEGlobal::song->mtype(), mt->isDrumTrack());
+
+ if(pup->actions().count() == 0)
+ {
+ delete pup;
+ return;
+ }
+
+ connect(pup, SIGNAL(triggered(QAction*)), SLOT(instrPopupActivated(QAction*)));
+
+ QAction *act = pup->exec(ev->globalPos());
+ if(act)
+ {
+ int val = act->data().toInt();
+ if(val != -1)
+ {
+ MusECore::Event a(MusECore::Controller);
+ a.setTick(0);
+ a.setA(MusECore::CTRL_PROGRAM);
+ a.setB(val);
+ MusEGlobal::song->recordEvent(mt, a);
+ }
+ }
+
+ delete pup;
+ }
+ }
}
- else
- mode = START_DRAG;
- }
+ } //end of "switch"
redraw();
- }
+}
void TList::loadTrackDrummap(MusECore::MidiTrack* t, const char* fn_)
{