summaryrefslogtreecommitdiff
path: root/muse2/muse
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-10-10 12:22:40 +0000
committerFlorian Jung <flo@windfisch.org>2011-10-10 12:22:40 +0000
commite4bedb86763c85a637921d566cd445cfa2c07444 (patch)
treed3097c2edf5eb3bd62cd0bad88c13d662013ea12 /muse2/muse
parent182474fce42414f8f8c5545c4ce822aa5ce73c2c (diff)
added "show all" and "hide unused" menu entries
Diffstat (limited to 'muse2/muse')
-rw-r--r--muse2/muse/midiedit/dcanvas.cpp2
-rw-r--r--muse2/muse/midiedit/drumedit.cpp61
-rw-r--r--muse2/muse/midiedit/drumedit.h2
-rw-r--r--muse2/muse/midiedit/scoreedit.cpp1
4 files changed, 64 insertions, 2 deletions
diff --git a/muse2/muse/midiedit/dcanvas.cpp b/muse2/muse/midiedit/dcanvas.cpp
index 3431eabf..03432bbd 100644
--- a/muse2/muse/midiedit/dcanvas.cpp
+++ b/muse2/muse/midiedit/dcanvas.cpp
@@ -1318,7 +1318,7 @@ int DrumCanvas::pitch_and_track_to_instrument(int pitch, MusECore::Track* track)
if (instrument_map[i].tracks.contains(track) && instrument_map[i].pitch==pitch)
return i;
- printf("ERROR: DrumCanvas::pitch_and_track_to_instrument() called with invalid arguments!\n");
+ if (heavyDebugMsg) printf("DrumCanvas::pitch_and_track_to_instrument() called with invalid arguments.\n");
return -1;
}
diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp
index 3a75e32d..e46e2504 100644
--- a/muse2/muse/midiedit/drumedit.cpp
+++ b/muse2/muse/midiedit/drumedit.cpp
@@ -289,7 +289,11 @@ DrumEdit::DrumEdit(MusECore::PartList* pl, QWidget* parent, const char* name, un
groupNoneAction = menuGrouping->addAction(tr("Don't group"));
groupChanAction = menuGrouping->addAction(tr("Group by channel"));
groupMaxAction = menuGrouping->addAction(tr("Group maximally"));
- QAction* ignoreHideAction = settingsMenu->addAction(tr("Also show hidden events"));
+ QMenu* menuShowHide=settingsMenu->addMenu(tr("Show/Hide"));
+ QAction* ignoreHideAction = menuShowHide->addAction(tr("Also show hidden instruments"));
+ menuShowHide->addSeparator();
+ QAction* showAllAction = menuShowHide->addAction(tr("Show all instruments"));
+ QAction* hideUnusedAction = menuShowHide->addAction(tr("Only show used instruments"));
settingsMenu->addSeparator();
groupNoneAction->setCheckable(true);
@@ -302,6 +306,8 @@ DrumEdit::DrumEdit(MusECore::PartList* pl, QWidget* parent, const char* name, un
connect(groupChanAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
connect(groupMaxAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
connect(ignoreHideAction, SIGNAL(toggled(bool)), SLOT(set_ignore_hide(bool)));
+ connect(showAllAction, SIGNAL(triggered()), this, SLOT(showAllInstruments()));
+ connect(hideUnusedAction, SIGNAL(triggered()), this, SLOT(hideUnusedInstruments()));
signalMapper->setMapping(groupNoneAction, DrumCanvas::CMD_GROUP_NONE);
signalMapper->setMapping(groupChanAction, DrumCanvas::CMD_GROUP_CHAN);
@@ -1427,4 +1433,57 @@ void DrumEdit::set_ignore_hide(bool val)
((DrumCanvas*)(canvas))->rebuildOurDrumMap();
}
+void DrumEdit::showAllInstruments()
+{
+ using MusECore::MidiTrack;
+
+ QSet<MidiTrack*> tracks;
+ for (MusECore::ciPart p = parts()->begin(); p != parts()->end(); ++p)
+ tracks.insert((MidiTrack*)p->second->track());
+
+ for (QSet<MidiTrack*>::iterator it=tracks.begin(); it!=tracks.end(); it++)
+ {
+ MidiTrack* track=*it;
+
+ for (int i=0;i<128;i++)
+ track->drummap_hidden()[i]=false;
+ }
+
+ ((DrumCanvas*)(canvas))->rebuildOurDrumMap();
+}
+
+void DrumEdit::hideUnusedInstruments()
+{
+ using MusECore::MidiTrack;
+ using MusECore::ciEvent;
+ using MusECore::EventList;
+ using MusECore::ciPart;
+
+ QSet<MidiTrack*> tracks;
+ for (MusECore::ciPart p = parts()->begin(); p != parts()->end(); ++p)
+ tracks.insert((MidiTrack*)p->second->track());
+
+ for (QSet<MidiTrack*>::iterator it=tracks.begin(); it!=tracks.end(); it++)
+ {
+ MidiTrack* track=*it;
+
+ bool hide[128];
+ for (int i=0;i<128;i++) hide[i]=true;
+
+ for (MusECore::ciPart p = parts()->begin(); p != parts()->end(); ++p)
+ if (p->second->track() == track)
+ {
+ const EventList* el = p->second->cevents();
+ for (ciEvent ev=el->begin(); ev!=el->end(); ev++)
+ hide[ev->second.pitch()]=false;
+ }
+
+ for (int i=0;i<128;i++)
+ track->drummap_hidden()[i]=hide[i];
+ }
+
+ ((DrumCanvas*)(canvas))->rebuildOurDrumMap();
+}
+
+
} // namespace MusEGui
diff --git a/muse2/muse/midiedit/drumedit.h b/muse2/muse/midiedit/drumedit.h
index 5603e449..b08812f3 100644
--- a/muse2/muse/midiedit/drumedit.h
+++ b/muse2/muse/midiedit/drumedit.h
@@ -154,6 +154,8 @@ class DrumEdit : public MidiEditor {
void setStep(QString);
void updateGroupingActions();
void set_ignore_hide(bool);
+ void showAllInstruments();
+ void hideUnusedInstruments();
public slots:
void setSelection(int, MusECore::Event&, MusECore::Part*);
diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp
index 5fa117f5..2b391461 100644
--- a/muse2/muse/midiedit/scoreedit.cpp
+++ b/muse2/muse/midiedit/scoreedit.cpp
@@ -4596,6 +4596,7 @@ void ScoreCanvas::add_new_parts(const std::map< MusECore::Part*, std::set<MusECo
* CURRENT TODO
* o don't record muted/hidden instr.s
* o offer menu entry for hiding all unused / empty drum instruments
+ * o my record flag handling
*
* o in appearance.cpp: add the new stuff for drumTrackLabelBg and drumTrackBg
* o find and fix FINDMICHJETZT