X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fexport_timespan_selector.cc;h=83f8a8f4aaa780ad98fd140965b8dbc5c70a54ab;hb=528ad3416affba88adef19e7f8db71504772e057;hp=d6ca02fe0387ab91e5d4395ad2a415608eff5d1a;hpb=a882e96db1367c26660fd3d3079e9e3e19b1e149;p=ardour.git diff --git a/gtk2_ardour/export_timespan_selector.cc b/gtk2_ardour/export_timespan_selector.cc index d6ca02fe03..83f8a8f4aa 100644 --- a/gtk2_ardour/export_timespan_selector.cc +++ b/gtk2_ardour/export_timespan_selector.cc @@ -20,8 +20,6 @@ #include "export_timespan_selector.h" -#include "ardour_ui.h" - #include "ardour/location.h" #include "ardour/types.h" #include "ardour/session.h" @@ -57,7 +55,7 @@ ExportTimespanSelector::ExportTimespanSelector (ARDOUR::Session * session, Profi ) ); option_hbox.pack_start (*b, false, false, 6); - + b = Gtk::manage (new Gtk::Button (_("Deselect All"))); b->signal_clicked().connect ( sigc::bind ( @@ -105,6 +103,9 @@ ExportTimespanSelector::ExportTimespanSelector (ARDOUR::Session * session, Profi /* Range view */ range_list = Gtk::ListStore::create (range_cols); + // order by location start times + range_list->set_sort_column(range_cols.location, Gtk::SORT_ASCENDING); + range_list->set_sort_func(range_cols.location, sigc::mem_fun(*this, &ExportTimespanSelector::location_sorter)); range_view.set_model (range_list); range_view.set_headers_visible (true); } @@ -114,6 +115,22 @@ ExportTimespanSelector::~ExportTimespanSelector () } +int +ExportTimespanSelector::location_sorter(Gtk::TreeModel::iterator a, Gtk::TreeModel::iterator b) +{ + Location *l1 = (*a)[range_cols.location]; + Location *l2 = (*b)[range_cols.location]; + const Location *ls = _session->locations()->session_range_location(); + + // always sort session range first + if (l1 == ls) + return -1; + if (l2 == ls) + return +1; + + return l1->start() - l2->start(); +} + void ExportTimespanSelector::add_range_to_selection (ARDOUR::Location const * loc) {