summaryrefslogtreecommitdiff
path: root/muse2
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-10-10 13:29:37 +0000
committerFlorian Jung <flo@windfisch.org>2011-10-10 13:29:37 +0000
commit0b3e41f1bc7140de590d57f40df52412855c9099 (patch)
treed70440b4ded0aaaa478863d902e31489fd7e436f /muse2
parent068ed02a48ffb6b06d87d858ee04022da5062914 (diff)
small drum-map-hide-menu-entry additions
Diffstat (limited to 'muse2')
-rw-r--r--muse2/muse/midiedit/drumedit.cpp56
-rw-r--r--muse2/muse/midiedit/drumedit.h2
-rw-r--r--muse2/muse/midiedit/scoreedit.cpp9
3 files changed, 58 insertions, 9 deletions
diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp
index e46e2504..5c8f2c23 100644
--- a/muse2/muse/midiedit/drumedit.cpp
+++ b/muse2/muse/midiedit/drumedit.cpp
@@ -293,7 +293,9 @@ DrumEdit::DrumEdit(MusECore::PartList* pl, QWidget* parent, const char* name, un
QAction* ignoreHideAction = menuShowHide->addAction(tr("Also show hidden instruments"));
menuShowHide->addSeparator();
QAction* showAllAction = menuShowHide->addAction(tr("Show all instruments"));
+ QAction* hideAllAction = menuShowHide->addAction(tr("Hide all instruments"));
QAction* hideUnusedAction = menuShowHide->addAction(tr("Only show used instruments"));
+ QAction* hideEmptyAction = menuShowHide->addAction(tr("Only show instruments with non-empty name or used instruments"));
settingsMenu->addSeparator();
groupNoneAction->setCheckable(true);
@@ -307,7 +309,9 @@ DrumEdit::DrumEdit(MusECore::PartList* pl, QWidget* parent, const char* name, un
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(hideAllAction, SIGNAL(triggered()), this, SLOT(hideAllInstruments()));
connect(hideUnusedAction, SIGNAL(triggered()), this, SLOT(hideUnusedInstruments()));
+ connect(hideEmptyAction, SIGNAL(triggered()), this, SLOT(hideEmptyInstruments()));
signalMapper->setMapping(groupNoneAction, DrumCanvas::CMD_GROUP_NONE);
signalMapper->setMapping(groupChanAction, DrumCanvas::CMD_GROUP_CHAN);
@@ -1452,6 +1456,25 @@ void DrumEdit::showAllInstruments()
((DrumCanvas*)(canvas))->rebuildOurDrumMap();
}
+void DrumEdit::hideAllInstruments()
+{
+ 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]=true;
+ }
+
+ ((DrumCanvas*)(canvas))->rebuildOurDrumMap();
+}
+
void DrumEdit::hideUnusedInstruments()
{
using MusECore::MidiTrack;
@@ -1485,5 +1508,38 @@ void DrumEdit::hideUnusedInstruments()
((DrumCanvas*)(canvas))->rebuildOurDrumMap();
}
+void DrumEdit::hideEmptyInstruments()
+{
+ 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]=track->drummap()[i].name.isEmpty();
+
+ 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 b08812f3..2c1f3060 100644
--- a/muse2/muse/midiedit/drumedit.h
+++ b/muse2/muse/midiedit/drumedit.h
@@ -155,7 +155,9 @@ class DrumEdit : public MidiEditor {
void updateGroupingActions();
void set_ignore_hide(bool);
void showAllInstruments();
+ void hideAllInstruments();
void hideUnusedInstruments();
+ void hideEmptyInstruments();
public slots:
void setSelection(int, MusECore::Event&, MusECore::Part*);
diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp
index 93a24129..9965fd99 100644
--- a/muse2/muse/midiedit/scoreedit.cpp
+++ b/muse2/muse/midiedit/scoreedit.cpp
@@ -4594,9 +4594,7 @@ void ScoreCanvas::add_new_parts(const std::map< MusECore::Part*, std::set<MusECo
* from clipboard failed. ignoring this one... ) [ not reproducible ]
*
* CURRENT TODO
- * x offer menu entry for hiding all unused / empty drum instruments
* o my record flag handling
- * x don't record muted/hidden instr.s
*
* o in appearance.cpp: add the new stuff for drumTrackLabelBg and drumTrackBg
* o find and fix FINDMICHJETZT
@@ -4620,13 +4618,6 @@ void ScoreCanvas::add_new_parts(const std::map< MusECore::Part*, std::set<MusECo
* ask the user if he wants to proceed, and then set maintained_automatically to false
* o offer some way to set maintained_automatically to true again
* o move generation and deletion of ourDrumMap from DCanvas to DrumEditor and remove ugly wrapper functions
- * x save hide, ordering, track's drumlists
- *
- * x when playing back a flo-drum-track: treat as a MIDI track,
- * EXCEPT that the drum list's mute entries are respected!
- * x when recording or echoing a flo-drum-track: watch out for In-Notes!
- * * update [midi]track::read/write, readproperties, writeprop... (drumlist etc), operator=
- * _should_ be okay, but i'm not sure
*
* IMPORTANT TODO
* o allow steprec-insert-rest-note to be set to "off" / "unused"