summaryrefslogtreecommitdiff
path: root/muse2/muse/midiedit/scoreedit.h
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-05-27 13:20:58 +0000
committerFlorian Jung <flo@windfisch.org>2011-05-27 13:20:58 +0000
commit4b344cf08471bcfbce5814ddead384dddb9bb86b (patch)
tree12c3245f05008b21d51b6b29fb090ee8c43ee43f /muse2/muse/midiedit/scoreedit.h
parente8612708161b71b43d56ef47eede6cc58b035967 (diff)
fixed bug: score editor didn't react on part changes which invalidate
the Part*; it simply worked with the old, invalid pointers, which may lead to severe problems, and indeed leads to a bug when saving.
Diffstat (limited to 'muse2/muse/midiedit/scoreedit.h')
-rw-r--r--muse2/muse/midiedit/scoreedit.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h
index 71b672a9..0e61f066 100644
--- a/muse2/muse/midiedit/scoreedit.h
+++ b/muse2/muse/midiedit/scoreedit.h
@@ -35,6 +35,7 @@
#include "mtscale_flo.h"
#include "steprec.h"
#include "cleftypes.h"
+#include "helper.h"
#include <set>
#include <map>
@@ -489,6 +490,7 @@ enum staff_mode_t
struct staff_t
{
set<Part*> parts;
+ set<int> part_indices;
ScoreEventList eventlist;
ScoreItemList itemlist;
@@ -532,6 +534,7 @@ struct staff_t
clef=clef_;
parts=parts_;
parent=parent_;
+ update_part_indices();
}
bool cleanup_parts();
@@ -540,6 +543,9 @@ struct staff_t
void read_status(Xml& xml);
void write_status(int level, Xml& xml) const;
+
+ void update_parts(); //re-populates the set<Part*> from the set<int>
+ void update_part_indices(); //re-populates the set<int> from the set<Part*>
};
list<int> calc_accidentials(key_enum key, clef_t clef, key_enum next_key=KEY_C);
@@ -643,6 +649,8 @@ class ScoreCanvas : public View
float y_scroll_pos;
Part* selected_part;
+ int selected_part_index;
+
int last_len;
int new_len; //when zero or negative, last_len is used
@@ -728,7 +736,8 @@ class ScoreCanvas : public View
void set_steprec(bool);
void set_midiin(bool);
-
+
+ void update_parts(); //re-populates the set<Part*>s from the set<int>s
signals:
void xscroll_changed(int);
void yscroll_changed(int);
@@ -772,7 +781,7 @@ class ScoreCanvas : public View
void set_last_len(int l) {last_len=l;}
Part* get_selected_part() {return selected_part;}
- void set_selected_part(Part* p) {selected_part=p;}
+ void set_selected_part(Part* p) {selected_part=p; if (selected_part) selected_part_index=partToIndex(selected_part);}
set<Part*> get_all_parts();