summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-06-06 12:52:48 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2016-06-06 12:58:48 -0400
commita0f0bdc063e81fd6f98fbcb1268538106cca753a (patch)
tree09f95a08247d17e37cf3c19e54fde12919d7ea7d /gtk2_ardour
parent6a622d86dca2c8af8993d85be8bd8a44debc5b8c (diff)
try to keep editor+mixer treemodels in sync
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/editor.cc18
-rw-r--r--gtk2_ardour/editor_routes.cc1
-rw-r--r--gtk2_ardour/mixer_ui.cc13
-rw-r--r--gtk2_ardour/route_sorter.h8
4 files changed, 22 insertions, 18 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index 972583d57d..8bca7211fe 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -126,6 +126,7 @@
#include "region_layering_order_editor.h"
#include "rgb_macros.h"
#include "rhythm_ferret.h"
+#include "route_sorter.h"
#include "selection.h"
#include "simple_progress_dialog.h"
#include "sfdb_ui.h"
@@ -5219,21 +5220,6 @@ Editor::add_routes (RouteList& rlist)
add_stripables (sl);
}
-struct PresentationInfoEditorSorter
-{
- bool operator() (boost::shared_ptr<Stripable> a, boost::shared_ptr<Stripable> b) {
- if (a->is_master()) {
- /* master before everything else */
- return true;
- } else if (b->is_master()) {
- /* everything else before master */
- return false;
- }
- return a->presentation_info().order () < b->presentation_info().order ();
- }
-};
-
-
void
Editor::add_stripables (StripableList& sl)
{
@@ -5243,7 +5229,7 @@ Editor::add_stripables (StripableList& sl)
TrackViewList new_selection;
bool from_scratch = (track_views.size() == 0);
- sl.sort (PresentationInfoEditorSorter());
+ sl.sort (StripablePresentationInfoSorter());
for (StripableList::iterator s = sl.begin(); s != sl.end(); ++s) {
diff --git a/gtk2_ardour/editor_routes.cc b/gtk2_ardour/editor_routes.cc
index 3c4766f79e..6141203827 100644
--- a/gtk2_ardour/editor_routes.cc
+++ b/gtk2_ardour/editor_routes.cc
@@ -839,6 +839,7 @@ EditorRoutes::time_axis_views_added (list<TimeAxisView*> tavs)
_display.set_model (_model);
/* now update route order keys from the treeview/track display order */
+
if (!from_scratch) {
sync_presentation_info_from_treeview ();
}
diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc
index ef3228375a..196a53647a 100644
--- a/gtk2_ardour/mixer_ui.cc
+++ b/gtk2_ardour/mixer_ui.cc
@@ -64,6 +64,7 @@
#include "actions.h"
#include "gui_thread.h"
#include "mixer_group_tabs.h"
+#include "route_sorter.h"
#include "timers.h"
#include "ui_config.h"
#include "vca_master_strip.h"
@@ -479,8 +480,11 @@ void
Mixer_UI::add_stripables (StripableList& slist)
{
Gtk::TreeModel::Children::iterator insert_iter = track_model->children().end();
+ bool from_scratch = (track_model->children().size() == 0);
uint32_t nroutes = 0;
+ slist.sort (StripablePresentationInfoSorter());
+
for (Gtk::TreeModel::Children::iterator it = track_model->children().begin(); it != track_model->children().end(); ++it) {
boost::shared_ptr<Stripable> s = (*it)[stripable_columns.stripable];
@@ -589,8 +593,9 @@ Mixer_UI::add_stripables (StripableList& slist)
no_track_list_redisplay = false;
track_display.set_model (track_model);
- sync_presentation_info_from_treeview ();
- redisplay_track_list ();
+ if (!from_scratch) {
+ sync_presentation_info_from_treeview ();
+ }
}
void
@@ -687,6 +692,10 @@ Mixer_UI::sync_presentation_info_from_treeview ()
continue;
}
+ /* Master also doesn't get set here but since the editor allows
+ * it to be reordered, we need to preserve its ordering.
+ */
+
stripable->presentation_info().set_hidden (!visible);
if (order != stripable->presentation_info().order()) {
diff --git a/gtk2_ardour/route_sorter.h b/gtk2_ardour/route_sorter.h
index 1450a2c09b..e84788243c 100644
--- a/gtk2_ardour/route_sorter.h
+++ b/gtk2_ardour/route_sorter.h
@@ -24,6 +24,8 @@
#include <stdint.h>
#include <vector>
+#include "ardour/stripable.h"
+
struct OrderKeys {
uint32_t old_display_order;
uint32_t new_display_order;
@@ -41,4 +43,10 @@ struct SortByNewDisplayOrder {
}
};
+struct StripablePresentationInfoSorter {
+ bool operator() (boost::shared_ptr<ARDOUR::Stripable> a, boost::shared_ptr<ARDOUR::Stripable> b) {
+ return a->presentation_info().order () < b->presentation_info().order ();
+ }
+};
+
#endif /* __gtk2_ardour_route_sorter_h__ */