summaryrefslogtreecommitdiff
path: root/muse2/muse/midiedit/dlist.cpp
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-10-02 14:53:39 +0000
committerFlorian Jung <flo@windfisch.org>2011-10-02 14:53:39 +0000
commitfbb72c809a2e75e0d4b038056df80d60c09d62c5 (patch)
treecbedda97f821d3d926f144c0d6a92989cc8dc0e6 /muse2/muse/midiedit/dlist.cpp
parent0d93b9b7a99847b19b7f0863a694e5441727419e (diff)
drum list entry ordering is now remembered
bugfix in reordering drummap
Diffstat (limited to 'muse2/muse/midiedit/dlist.cpp')
-rw-r--r--muse2/muse/midiedit/dlist.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/muse2/muse/midiedit/dlist.cpp b/muse2/muse/midiedit/dlist.cpp
index 9f1d9b28..be7255b9 100644
--- a/muse2/muse/midiedit/dlist.cpp
+++ b/muse2/muse/midiedit/dlist.cpp
@@ -854,11 +854,21 @@ void DList::viewMouseReleaseEvent(QMouseEvent* ev)
{
if (drag == DRAG) {
int y = ev->y();
- unsigned dInstrument = y / TH;
+ int dInstrument;
+ if (old_style_drummap_mode)
+ dInstrument = y / TH;
+ else
+ dInstrument = (y+TH/2) / TH;
+
+ if (dInstrument < 0) dInstrument=0;
+ if (dInstrument >= ourDrumMapSize) dInstrument=ourDrumMapSize-1;
+
+ int cur_sel = (!old_style_drummap_mode && dInstrument>sInstrument) ? dInstrument-1 : dInstrument;
+
setCursor(QCursor(Qt::ArrowCursor));
- currentlySelected = &ourDrumMap[int(dInstrument)];
- emit curDrumInstrumentChanged(dInstrument);
- emit mapChanged(sInstrument, dInstrument); //Track instrument change done in canvas
+ currentlySelected = &ourDrumMap[cur_sel];
+ emit curDrumInstrumentChanged((unsigned)cur_sel);
+ emit mapChanged(sInstrument, (unsigned)dInstrument); //Track instrument change done in canvas
}
drag = NORMAL;
//?? redraw(); //commented out NOT by flo93; was already commented out