summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-10-03 13:40:36 +0000
committerFlorian Jung <flo@windfisch.org>2011-10-03 13:40:36 +0000
commitd2427fa3b72eeb897ab214b38572009e6e4f4987 (patch)
tree30dfc21b0f8f556ebcdff9f34b42763e46e126a4
parent09e02c07130a56a992e919cf19d32f50d067d149 (diff)
added support for changing grouping mode
-rw-r--r--muse2/muse/midiedit/dcanvas.cpp4
-rw-r--r--muse2/muse/midiedit/dcanvas.h3
-rw-r--r--muse2/muse/midiedit/drumedit.cpp49
-rw-r--r--muse2/muse/midiedit/drumedit.h3
4 files changed, 56 insertions, 3 deletions
diff --git a/muse2/muse/midiedit/dcanvas.cpp b/muse2/muse/midiedit/dcanvas.cpp
index 07e5a430..8e2f284d 100644
--- a/muse2/muse/midiedit/dcanvas.cpp
+++ b/muse2/muse/midiedit/dcanvas.cpp
@@ -1424,6 +1424,10 @@ void DrumCanvas::rebuildOurDrumMap()
for (int i=0;i<size;i++)
ourDrumMap[i] = dynamic_cast<MidiTrack*>(*instrument_map[i].tracks.begin())->drummap()[instrument_map[i].pitch];
+ if (debugMsg) printf("rebuilt drummap, size is now %i\n",size);
+
+ songChanged(SC_EVENT_INSERTED); // force an update of the itemlist
+
emit ourDrumMapChanged();
}
}
diff --git a/muse2/muse/midiedit/dcanvas.h b/muse2/muse/midiedit/dcanvas.h
index 0f519b70..e06857a9 100644
--- a/muse2/muse/midiedit/dcanvas.h
+++ b/muse2/muse/midiedit/dcanvas.h
@@ -142,7 +142,8 @@ class DrumCanvas : public EventCanvas {
CMD_SELECT_ALL, CMD_SELECT_NONE, CMD_SELECT_INVERT,
CMD_SELECT_ILOOP, CMD_SELECT_OLOOP, CMD_SELECT_PREV_PART, CMD_SELECT_NEXT_PART,
CMD_DEL, CMD_FIXED_LEN, CMD_RIGHT, CMD_LEFT, CMD_RIGHT_NOSNAP, CMD_LEFT_NOSNAP, CMD_MODIFY_VELOCITY, CMD_CRESCENDO,
- CMD_QUANTIZE, CMD_ERASE_EVENT, CMD_NOTE_SHIFT, CMD_DELETE_OVERLAPS, CMD_REORDER_LIST
+ CMD_QUANTIZE, CMD_ERASE_EVENT, CMD_NOTE_SHIFT, CMD_DELETE_OVERLAPS, CMD_REORDER_LIST,
+ CMD_GROUP_NONE, CMD_GROUP_CHAN, CMD_GROUP_MAX
};
DrumCanvas(MidiEditor*, QWidget*, int, int,
const char* name = 0);
diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp
index 4cb6a7b1..ce261425 100644
--- a/muse2/muse/midiedit/drumedit.cpp
+++ b/muse2/muse/midiedit/drumedit.cpp
@@ -287,10 +287,40 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini
signalMapper->setMapping(noteShiftAction, DrumCanvas::CMD_NOTE_SHIFT);
signalMapper->setMapping(delOverlapsAction, DrumCanvas::CMD_DELETE_OVERLAPS);
+
+
QMenu* menuScriptPlugins = menuBar()->addMenu(tr("&Plugins"));
song->populateScriptMenu(menuScriptPlugins, this);
QMenu* settingsMenu = menuBar()->addMenu(tr("Window &Config"));
+ if (!old_style_drummap_mode())
+ {
+ QMenu* menuGrouping=settingsMenu->addMenu(tr("Group"));
+ groupNoneAction = menuGrouping->addAction(tr("Don't group"));
+ groupChanAction = menuGrouping->addAction(tr("Group by channel"));
+ groupMaxAction = menuGrouping->addAction(tr("Group maximally"));
+ settingsMenu->addSeparator();
+
+ groupNoneAction->setCheckable(true);
+ groupChanAction->setCheckable(true);
+ groupMaxAction ->setCheckable(true);
+
+ connect(groupNoneAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
+ connect(groupChanAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
+ connect(groupMaxAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
+
+ signalMapper->setMapping(groupNoneAction, DrumCanvas::CMD_GROUP_NONE);
+ signalMapper->setMapping(groupChanAction, DrumCanvas::CMD_GROUP_CHAN);
+ signalMapper->setMapping(groupMaxAction, DrumCanvas::CMD_GROUP_MAX);
+
+ updateGroupingActions();
+ }
+ else
+ {
+ groupNoneAction=NULL;
+ groupChanAction=NULL;
+ groupMaxAction =NULL;
+ }
settingsMenu->addAction(subwinAction);
settingsMenu->addAction(shareAction);
settingsMenu->addAction(fullscreenAction);
@@ -964,7 +994,11 @@ void DrumEdit::cmd(int cmd)
case DrumCanvas::CMD_REORDER_LIST: ((DrumCanvas*)(canvas))->moveAwayUnused(); break;
//case DrumCanvas::CMD_FIXED_LEN: // this must be handled by the drum canvas, due to its
// special nature (each drum has its own length)
-
+
+ case DrumCanvas::CMD_GROUP_NONE: _group_mode=DONT_GROUP; updateGroupingActions(); ((DrumCanvas*)(canvas))->rebuildOurDrumMap(); break;
+ case DrumCanvas::CMD_GROUP_CHAN: _group_mode=GROUP_SAME_CHANNEL; updateGroupingActions(); ((DrumCanvas*)(canvas))->rebuildOurDrumMap(); break;
+ case DrumCanvas::CMD_GROUP_MAX: _group_mode=GROUP_MAX; updateGroupingActions(); ((DrumCanvas*)(canvas))->rebuildOurDrumMap(); break;
+
default: ((DrumCanvas*)(canvas))->cmd(cmd);
}
}
@@ -1351,3 +1385,16 @@ void DrumEdit::ourDrumMapChanged()
vscroll->range(&vmin, &vmax);
vscroll->setRange(vmin, dynamic_cast<DrumCanvas*>(canvas)->getOurDrumMapSize()*TH);
}
+
+void DrumEdit::updateGroupingActions()
+{
+ if (groupNoneAction==NULL || groupChanAction==NULL || groupMaxAction==NULL)
+ {
+ printf("THIS SHOULD NEVER HAPPEN: DrumEdit::updateGroupingActions() called, but one of the actions is NULL!\n");
+ return;
+ }
+
+ groupNoneAction->setChecked(_group_mode==DONT_GROUP);
+ groupChanAction->setChecked(_group_mode==GROUP_SAME_CHANNEL);
+ groupMaxAction ->setChecked(_group_mode==GROUP_MAX);
+}
diff --git a/muse2/muse/midiedit/drumedit.h b/muse2/muse/midiedit/drumedit.h
index 7d85cb2f..743d6151 100644
--- a/muse2/muse/midiedit/drumedit.h
+++ b/muse2/muse/midiedit/drumedit.h
@@ -101,7 +101,7 @@ class DrumEdit : public MidiEditor {
QAction *fixedAction, *veloAction, *crescAction, *quantizeAction;
QAction *sallAction, *snoneAction, *invAction, *inAction , *outAction;
QAction *prevAction, *nextAction;
-
+ QAction *groupNoneAction, *groupChanAction, *groupMaxAction;
void initShortcuts();
@@ -129,6 +129,7 @@ class DrumEdit : public MidiEditor {
void configChanged();
void songChanged1(int);
void setStep(QString);
+ void updateGroupingActions();
public slots:
void setSelection(int, Event&, Part*);