summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim E. Real <termtech@rogers.com>2010-06-13 07:23:56 +0000
committerTim E. Real <termtech@rogers.com>2010-06-13 07:23:56 +0000
commit0001241ccb0bbdac031fa33137d3fa7f34addc60 (patch)
treee3829fcfe8c5487802b00d0aae3d3532871b6129
parent8f4603507399051ea568154450ac55a452aa9c93 (diff)
See ChangeLog
-rw-r--r--muse/ChangeLog2
-rw-r--r--muse/muse/marker/markerview.cpp68
-rw-r--r--muse/muse/marker/markerview.h1
3 files changed, 59 insertions, 12 deletions
diff --git a/muse/ChangeLog b/muse/ChangeLog
index bb156365..a49ca8dd 100644
--- a/muse/ChangeLog
+++ b/muse/ChangeLog
@@ -1,3 +1,5 @@
+13.06.2010
+ * Fixed: More fixes to marker list, selected item was still not right. (T356)
03.06.2010
* Fixed: Time signature editing problems in master track list and gui. (T356)
- Fixed SigEdit::outOfRange(). Added Sig::isValid(), and check it in LMaster::returnPressed() to fix crash with 0 n or z.
diff --git a/muse/muse/marker/markerview.cpp b/muse/muse/marker/markerview.cpp
index 1c9eee77..75ee1a06 100644
--- a/muse/muse/marker/markerview.cpp
+++ b/muse/muse/marker/markerview.cpp
@@ -241,7 +241,9 @@ MarkerView::MarkerView(QWidget* parent)
// Rest
//---------------------------------------------------
- connect(song, SIGNAL(songChanged(int)), SLOT(updateList()));
+ //connect(song, SIGNAL(songChanged(int)), SLOT(updateList()));
+ connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
+
updateList();
// work around for probable QT/WM interaction bug.
@@ -333,28 +335,70 @@ void MarkerView::deleteMarker()
}
//---------------------------------------------------------
+// songChanged
+//---------------------------------------------------------
+
+void MarkerView::songChanged(int flags)
+{
+ // Is it simply a midi controller value adjustment? Forget it.
+ if(flags == SC_MIDI_CONTROLLER)
+ return;
+
+ updateList();
+}
+
+//---------------------------------------------------------
// updateList
//---------------------------------------------------------
void MarkerView::updateList()
{
-
- // Added p3.3.43
- // Remember the next selected item, or else any new item added.
+ // Added p3.3.43 Manage selected item, due to clearing of table...
MarkerList* marker = song->marker();
- MarkerItem* item = (MarkerItem*)table->selectedItem();
- MarkerItem* nextitem = item ? (MarkerItem*)item->nextSibling() : 0;
- //Marker* selm = item->marker();
- //Marker* nextselm = nextitem->marker();
- Marker* selm = nextitem ? nextitem->marker() : 0;
- for (iMarker i = marker->begin(); i != marker->end(); ++i)
+ MarkerItem* selitem = (MarkerItem*)table->selectedItem();
+ Marker* selm = selitem ? selitem->marker() : 0;
+ // p3.3.44 Look for removed markers before added markers...
+ if(selitem)
+ {
+ MarkerItem* mitem = (MarkerItem*)table->firstChild();
+ while(mitem)
+ {
+ bool found = false;
+ for(iMarker i = marker->begin(); i != marker->end(); ++i)
+ {
+ Marker* m = &i->second;
+ if(m == mitem->marker())
+ {
+ found = true;
+ break;
+ }
+ }
+ // Anything removed from the marker list?
+ if(!found)
+ {
+ // If it is the current selected item, it no longer exists. Make the next item be selected.
+ if(mitem == selitem)
+ {
+ MarkerItem* mi = (MarkerItem*)selitem->nextSibling();
+ if(mi)
+ {
+ selitem = mi;
+ selm = selitem->marker();
+ }
+ }
+ }
+ mitem = (MarkerItem*)mitem->nextSibling();
+ }
+ }
+ // Look for added markers...
+ for(iMarker i = marker->begin(); i != marker->end(); ++i)
{
Marker* m = &i->second;
bool found = false;
MarkerItem* item = (MarkerItem*)table->firstChild();
- while (item)
+ while(item)
{
- if (item->marker() == m)
+ if(item->marker() == m)
{
found = true;
break;
diff --git a/muse/muse/marker/markerview.h b/muse/muse/marker/markerview.h
index 2252be48..f16471b8 100644
--- a/muse/muse/marker/markerview.h
+++ b/muse/muse/marker/markerview.h
@@ -63,6 +63,7 @@ class MarkerView : public TopWin {
void markerChanged(int);
void clicked(QListViewItem*);
void updateList();
+ void songChanged(int);
signals:
void deleted(unsigned long);