summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-07-14 21:18:25 +0000
committerCarl Hetherington <carl@carlh.net>2010-07-14 21:18:25 +0000
commit960a841479ec90b92c7adfb63c261e761842289c (patch)
tree34ca1cc1f5aa93c730dd652b7746b283654a5bd8 /gtk2_ardour
parentfb256229440e0c578705d8c052da22f25a8857de (diff)
Insert new LocationEditRow on location add, rather than rebuilding the whole VBox. Fixes #3266.
git-svn-id: svn://localhost/ardour2/branches/3.0@7416 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/location_ui.cc47
1 files changed, 39 insertions, 8 deletions
diff --git a/gtk2_ardour/location_ui.cc b/gtk2_ardour/location_ui.cc
index 9613aaccb5..fda29be193 100644
--- a/gtk2_ardour/location_ui.cc
+++ b/gtk2_ardour/location_ui.cc
@@ -703,6 +703,12 @@ LocationUI::location_redraw_ranges ()
range_rows.show();
}
+struct LocationSortByStart {
+ bool operator() (Location *a, Location *b) {
+ return a->start() < b->start();
+ }
+};
+
void
LocationUI::location_added (Location* location)
{
@@ -712,8 +718,39 @@ LocationUI::location_added (Location* location)
punch_edit_row.set_location(location);
} else if (location->is_auto_loop()) {
loop_edit_row.set_location(location);
- } else {
- refresh_location_list ();
+ } else if (location->is_range_marker() || location->is_mark()) {
+ Locations::LocationList loc = _session->locations()->list ();
+ loc.sort (LocationSortByStart ());
+
+ LocationEditRow* erow = manage (new LocationEditRow (_session, location));
+ erow->remove_requested.connect (sigc::mem_fun (*this, &LocationUI::location_remove_requested));
+ Box_Helpers::BoxList & children = location->is_range_marker() ? range_rows.children () : location_rows.children ();
+
+ /* Step through the location list and the GUI list to find the place to insert */
+ Locations::LocationList::iterator i = loc.begin ();
+ Box_Helpers::BoxList::iterator j = children.begin ();
+ while (i != loc.end()) {
+
+ if (location->flags() != (*i)->flags()) {
+ /* Skip locations in the session list that aren't of the right type */
+ ++i;
+ continue;
+ }
+
+ if (*i == location) {
+ children.insert (j, Box_Helpers::Element (*erow, PACK_SHRINK, 1, PACK_START));
+ break;
+ }
+
+ ++i;
+
+ if (j != children.end()) {
+ ++j;
+ }
+ }
+
+ range_rows.show_all ();
+ location_rows.show_all ();
}
}
@@ -738,12 +775,6 @@ LocationUI::location_removed (Location* location)
}
}
-struct LocationSortByStart {
- bool operator() (Location *a, Location *b) {
- return a->start() < b->start();
- }
-};
-
void
LocationUI::map_locations (Locations::LocationList& locations)
{