Keep location lists ordered by start-time
This commit is contained in:
parent
1da5c7f389
commit
7ee5a3f24d
@ -890,7 +890,6 @@ LocationUI::location_remove_requested (ARDOUR::Location *loc)
|
|||||||
Glib::signal_idle().connect (sigc::bind (sigc::mem_fun(*this, &LocationUI::do_location_remove), loc));
|
Glib::signal_idle().connect (sigc::bind (sigc::mem_fun(*this, &LocationUI::do_location_remove), loc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
LocationUI::location_redraw_ranges ()
|
LocationUI::location_redraw_ranges ()
|
||||||
{
|
{
|
||||||
@ -979,6 +978,35 @@ LocationUI::location_removed (Location* location)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
LocationUI::start_changed (Location *location)
|
||||||
|
{
|
||||||
|
Gtk::VBox& box = location->is_range_marker() ? range_rows : location_rows;
|
||||||
|
LocationEditRow* r = NULL;
|
||||||
|
for (auto const& i : box.children ()) {
|
||||||
|
r = dynamic_cast<LocationEditRow*> (i.get_widget());
|
||||||
|
if (r && r->get_location() == location) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assert (r);
|
||||||
|
|
||||||
|
int pos = 0;
|
||||||
|
Locations::LocationList loc = _session->locations()->list ();
|
||||||
|
loc.sort (LocationSortByStart ());
|
||||||
|
for (auto const& l : loc) {
|
||||||
|
if (location->is_range_marker() != l->is_range_marker()) {
|
||||||
|
/* Skip locations in the session list that aren't of the right type */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (l == location) {
|
||||||
|
box.reorder_child (*r, pos);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
++pos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
LocationUI::map_locations (const Locations::LocationList& locations)
|
LocationUI::map_locations (const Locations::LocationList& locations)
|
||||||
{
|
{
|
||||||
@ -1097,6 +1125,7 @@ LocationUI::set_session(ARDOUR::Session* s)
|
|||||||
_session->locations()->added.connect (_session_connections, invalidator (*this), boost::bind (&LocationUI::location_added, this, _1), gui_context());
|
_session->locations()->added.connect (_session_connections, invalidator (*this), boost::bind (&LocationUI::location_added, this, _1), gui_context());
|
||||||
_session->locations()->removed.connect (_session_connections, invalidator (*this), boost::bind (&LocationUI::location_removed, this, _1), gui_context());
|
_session->locations()->removed.connect (_session_connections, invalidator (*this), boost::bind (&LocationUI::location_removed, this, _1), gui_context());
|
||||||
_session->locations()->changed.connect (_session_connections, invalidator (*this), boost::bind (&LocationUI::refresh_location_list, this), gui_context());
|
_session->locations()->changed.connect (_session_connections, invalidator (*this), boost::bind (&LocationUI::refresh_location_list, this), gui_context());
|
||||||
|
Location::start_changed.connect (_session_connections, invalidator (*this), boost::bind (&LocationUI::start_changed, this, _1), gui_context());
|
||||||
|
|
||||||
_clock_group->set_clock_mode (clock_mode_from_session_instant_xml ());
|
_clock_group->set_clock_mode (clock_mode_from_session_instant_xml ());
|
||||||
} else {
|
} else {
|
||||||
|
@ -203,6 +203,8 @@ private:
|
|||||||
|
|
||||||
void location_redraw_ranges ();
|
void location_redraw_ranges ();
|
||||||
|
|
||||||
|
void start_changed (ARDOUR::Location*);
|
||||||
|
|
||||||
gint do_location_remove (ARDOUR::Location *);
|
gint do_location_remove (ARDOUR::Location *);
|
||||||
|
|
||||||
guint32 i_am_the_modifier;
|
guint32 i_am_the_modifier;
|
||||||
|
Loading…
Reference in New Issue
Block a user