summaryrefslogtreecommitdiff
path: root/muse2
diff options
context:
space:
mode:
Diffstat (limited to 'muse2')
-rw-r--r--muse2/ChangeLog1
-rw-r--r--muse2/muse/helper.cpp11
-rw-r--r--muse2/muse/helper.h3
-rw-r--r--muse2/muse/midiedit/scoreedit.cpp10
-rw-r--r--muse2/muse/midiedit/scoreedit.h2
5 files changed, 12 insertions, 15 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index 92108489..aac27cc3 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,6 +1,7 @@
28.05.2011:
- fixed dragging and resizing of track header, also changed default index of new
sections, they should appear last now (rj)
+ - fixed the buggy bugfix of the "invalid Part*s" bug (flo93)
27.05.2011:
- fixed bug in scoreeditor: invalid Part*s are now not used any more (flo93)
- applied some hunks of the patch sent in by WillyFoobar (flo93)
diff --git a/muse2/muse/helper.cpp b/muse2/muse/helper.cpp
index d4a237ea..be45e048 100644
--- a/muse2/muse/helper.cpp
+++ b/muse2/muse/helper.cpp
@@ -43,12 +43,7 @@ QString pitch2string(int v)
-int partToIndex(Part* p)
-{
- return p->track()->parts()->index(p);
-}
-
-Part* partFromIndex(int index)
+Part* partFromSerialNumber(int serial)
{
TrackList* tl = song->tracks();
for (iTrack it = tl->begin(); it != tl->end(); ++it)
@@ -56,10 +51,10 @@ Part* partFromIndex(int index)
PartList* pl = (*it)->parts();
iPart ip;
for (ip = pl->begin(); ip != pl->end(); ++ip)
- if (ip->second->sn() == index)
+ if (ip->second->sn() == serial)
return ip->second;
}
- printf("ERROR: partFromIndex(%i) wasn't able to find an appropriate part!\n",index);
+ printf("ERROR: partFromSerialNumber(%i) wasn't able to find an appropriate part!\n",serial);
return NULL;
}
diff --git a/muse2/muse/helper.h b/muse2/muse/helper.h
index d88dcb94..109ecbee 100644
--- a/muse2/muse/helper.h
+++ b/muse2/muse/helper.h
@@ -14,8 +14,7 @@ class Part;
extern QString pitch2string(int v);
-int partToIndex(Part* p);
-Part* partFromIndex(int index);
+Part* partFromSerialNumber(int serial);
#endif
diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp
index b000dc5f..c2e901ad 100644
--- a/muse2/muse/midiedit/scoreedit.cpp
+++ b/muse2/muse/midiedit/scoreedit.cpp
@@ -4328,7 +4328,7 @@ void ScoreCanvas::midi_note(int pitch, int velo)
void ScoreCanvas::update_parts()
{
if (selected_part!=NULL) //if it's null, let it be null
- selected_part=partFromIndex(selected_part_index);
+ selected_part=partFromSerialNumber(selected_part_index);
for (list<staff_t>::iterator it=staves.begin(); it!=staves.end(); it++)
it->update_parts();
@@ -4339,7 +4339,7 @@ void staff_t::update_parts()
parts.clear();
for (set<int>::iterator it=part_indices.begin(); it!=part_indices.end(); it++)
- parts.insert(partFromIndex(*it));
+ parts.insert(partFromSerialNumber(*it));
}
void staff_t::update_part_indices()
@@ -4347,7 +4347,7 @@ void staff_t::update_part_indices()
part_indices.clear();
for (set<Part*>::iterator it=parts.begin(); it!=parts.end(); it++)
- part_indices.insert(partToIndex(*it));
+ part_indices.insert((*it)->sn());
}
//the following assertions are made:
@@ -4375,10 +4375,12 @@ void staff_t::update_part_indices()
* between, for example, when a cis is tied to a des
*
* CURRENT TODO
+ * o investigate with valgrind
+ * ! o paste to different tick !!
+ * o allow batch-movements in score editor
* o controller view in score editor
* o deal with expanding parts
* o in main win: make "Ch" column editable with a line edit
- * o paste to different tick
* o fix sigedit boxes
* o mid-click in pianoroll: change to "delete", or initiate drag and drop between windows?
*
diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h
index 0e61f066..3fd321b9 100644
--- a/muse2/muse/midiedit/scoreedit.h
+++ b/muse2/muse/midiedit/scoreedit.h
@@ -781,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; if (selected_part) selected_part_index=partToIndex(selected_part);}
+ void set_selected_part(Part* p) {selected_part=p; if (selected_part) selected_part_index=selected_part->sn();}
set<Part*> get_all_parts();