diff data/model/SparseModel.h @ 432:113cf8781bd1

* Fix two problems reported by Matthias in the data editor window: - highlighted row was incorrect (it was highlighting the row for the next item after the current position, not the one before it as it should be) - making a row current moved the centre frame of the view, but did not change the playback position as it should do
author Chris Cannam
date Thu, 26 Jun 2008 12:41:23 +0000
parents 72ec275e458b
children 6441b31b37ac
line wrap: on
line diff
--- a/data/model/SparseModel.h	Thu Jun 19 15:11:28 2008 +0000
+++ b/data/model/SparseModel.h	Thu Jun 26 12:41:23 2008 +0000
@@ -286,7 +286,11 @@
         if (m_rows.empty()) rebuildRowVector();
         std::vector<long>::iterator i =
             std::lower_bound(m_rows.begin(), m_rows.end(), frame);
-        return std::distance(m_rows.begin(), i);
+        int row = std::distance(m_rows.begin(), i);
+        if (i != m_rows.begin() && (i == m_rows.end() || *i != frame)) {
+            --row;
+        }
+        return row;
     }
 
     virtual int getColumnCount() const { return 1; }