summaryrefslogtreecommitdiff
path: root/muse2
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-12-25 20:02:44 +0000
committerFlorian Jung <flo@windfisch.org>2011-12-25 20:02:44 +0000
commit6d181986beeacc4508aa6c3df71b8b56f6acfd0a (patch)
treea0e6c6b036dcfa256be9809697d6440e7771af4c /muse2
parentc836582af5661f1ca0e7d93c2674c947462faeb0 (diff)
disallowed mixing old-style and new-style drum tracks in one editor
Diffstat (limited to 'muse2')
-rw-r--r--muse2/muse/midiedit/drumedit.cpp56
-rw-r--r--muse2/muse/midiedit/drumedit.h7
-rw-r--r--muse2/muse/midiedit/scoreedit.cpp6
3 files changed, 54 insertions, 15 deletions
diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp
index 8f6d09ee..3bb48705 100644
--- a/muse2/muse/midiedit/drumedit.cpp
+++ b/muse2/muse/midiedit/drumedit.cpp
@@ -233,6 +233,48 @@ DrumEdit::DrumEdit(MusECore::PartList* pl, QWidget* parent, const char* name, un
menuFunctions = menuBar()->addMenu(tr("Fu&nctions"));
menuFunctions->setTearOffEnabled(true);
+
+
+
+ // throw out new-style and midi tracks if there are old-style tracks present
+ bool has_old_style_tracks=false;
+ for (MusECore::ciPart p = parts()->begin(); p != parts()->end(); ++p)
+ if (p->second->track()->type()==MusECore::Track::DRUM)
+ {
+ has_old_style_tracks=true;
+ break;
+ }
+
+ if (has_old_style_tracks)
+ {
+ bool thrown_out=false;
+ bool again;
+ do
+ {
+ again=false;
+ for (MusECore::ciPart p = parts()->begin(); p != parts()->end();p++)
+ if (p->second->track()->type()!=MusECore::Track::DRUM)
+ {
+ parts()->remove(p->second);
+ thrown_out=true;
+ again=true;
+ break;
+ }
+ } while (again);
+
+ if (thrown_out)
+ {
+ QTimer* timer = new QTimer(this);
+ timer->setSingleShot(true);
+ connect(timer,SIGNAL(timeout()), this, SLOT(display_old_new_conflict_message()));
+ timer->start(10);
+ }
+ }
+
+ _old_style_drummap_mode=has_old_style_tracks;
+
+
+
if (old_style_drummap_mode())
{
@@ -1407,15 +1449,6 @@ void DrumEdit::setStep(QString v)
canvas->setFocus();
}
-bool DrumEdit::old_style_drummap_mode()
-{
- for (MusECore::ciPart p = parts()->begin(); p != parts()->end(); ++p)
- if (p->second->track()->type()==MusECore::Track::DRUM)
- return true;
-
- return false;
-}
-
void DrumEdit::ourDrumMapChanged(bool instrMapChanged)
{
if (instrMapChanged)
@@ -1559,4 +1592,9 @@ void DrumEdit::hideEmptyInstruments()
}
+void DrumEdit::display_old_new_conflict_message()
+{
+ QMessageBox::information(this, tr("Not all parts are displayed"), tr("You selected both old-style-drumtracks and others (that is: new-style or midi tracks), but they cannot displayed in the same drum edit.\nI'll only display the old-style drumtracks in this editor, dropping the others."));
+}
+
} // namespace MusEGui
diff --git a/muse2/muse/midiedit/drumedit.h b/muse2/muse/midiedit/drumedit.h
index 59590d34..5bdd54a8 100644
--- a/muse2/muse/midiedit/drumedit.h
+++ b/muse2/muse/midiedit/drumedit.h
@@ -96,6 +96,7 @@ class DrumEdit : public MidiEditor {
private:
group_mode_t _group_mode;
bool _ignore_hide;
+ bool _old_style_drummap_mode;
MusECore::Event selEvent;
MusECore::MidiPart* selPart;
@@ -135,7 +136,7 @@ class DrumEdit : public MidiEditor {
void setHeaderToolTips();
void setHeaderWhatsThis();
-
+
private slots:
void setRaster(int);
void noteinfoChanged(MusEGui::NoteInfo::ValType type, int val);
@@ -159,6 +160,8 @@ class DrumEdit : public MidiEditor {
void hideAllInstruments();
void hideUnusedInstruments();
void hideEmptyInstruments();
+
+ void display_old_new_conflict_message();
public slots:
void setSelection(int, MusECore::Event&, MusECore::Part*);
@@ -180,7 +183,7 @@ class DrumEdit : public MidiEditor {
static void readConfiguration(MusECore::Xml& xml);
static void writeConfiguration(int, MusECore::Xml&);
- bool old_style_drummap_mode();
+ bool old_style_drummap_mode() { return _old_style_drummap_mode; }
group_mode_t group_mode() { return _group_mode; }
bool ignore_hide() { return _ignore_hide; }
diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp
index 716ac65d..f17ea6f8 100644
--- a/muse2/muse/midiedit/scoreedit.cpp
+++ b/muse2/muse/midiedit/scoreedit.cpp
@@ -4684,12 +4684,10 @@ void ScoreCanvas::add_new_parts(const std::map< MusECore::Part*, std::set<MusECo
* test!
* * drum editor is buggy. propagate_drum_map may operate on old values
* ("BUGGY! problem is: while changing entries, ourDrumMap
- may be reallocated which causes abort()s and/or bugs.")
- [ seems to work, needs further testing! ]
- * o don't mix DRUM and NEW_DRUM in drumeditor!
+ * may be reallocated which causes abort()s and/or bugs.")
+ * [ seems to work, needs further testing! ]
* o quantize must round UP, not down when at 0.5
* o my record flag handling
- * o option for disabling old-style / new-style drum tracks?
* ! o once, using super glue while a score editor displaying the glued
* parts is open let muse segfault. this may or may not be fixed
* now. check!