try to keep editor+mixer treemodels in sync
This commit is contained in:
parent
6a622d86dc
commit
a0f0bdc063
|
@ -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) {
|
||||
|
||||
|
|
|
@ -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 ();
|
||||
}
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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__ */
|
||||
|
|
Loading…
Reference in New Issue
Block a user