summaryrefslogtreecommitdiff
path: root/gtk2_ardour/export_timespan_selector.cc
diff options
context:
space:
mode:
authorColin Fletcher <colin.m.fletcher@googlemail.com>2013-06-16 18:50:23 +0100
committerColin Fletcher <colin.m.fletcher@googlemail.com>2013-10-07 10:48:48 +0100
commit1d282f316f08c0704d1083df40a6871900a1fb3d (patch)
tree4f920c0caf28fb7e53a9846a20033d3cc0bc6919 /gtk2_ardour/export_timespan_selector.cc
parentaced854ce7017de47eca618f0bf649ee8bdec56b (diff)
Show ranges in more sensible order in export dialog.
Show ranges in order in which they appear on the timeline in export dialog, but always show the session range first.
Diffstat (limited to 'gtk2_ardour/export_timespan_selector.cc')
-rw-r--r--gtk2_ardour/export_timespan_selector.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/gtk2_ardour/export_timespan_selector.cc b/gtk2_ardour/export_timespan_selector.cc
index f239ab194b..53b7dc9fe0 100644
--- a/gtk2_ardour/export_timespan_selector.cc
+++ b/gtk2_ardour/export_timespan_selector.cc
@@ -105,6 +105,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 +117,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)
{