#include "vca_time_axis.h"
#include "utils.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
using namespace std;
using namespace ARDOUR;
_display.set_enable_search (false);
Route::PluginSetup.connect_same_thread (*this, boost::bind (&EditorRoutes::plugin_setup, this, _1, _2, _3));
- Stripable::PresentationInfoChange.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::sync_treeview_from_presentation_info, this), gui_context());
+ PresentationInfo::Change.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::sync_treeview_from_presentation_info, this), gui_context());
}
bool
for (n = 0, position = 0, i = rows.begin(); i != rows.end(); ++i) {
TimeAxisView *tv = (*i)[_columns.tv];
- boost::shared_ptr<Stripable> route = (*i)[_columns.stripable];
if (tv == 0) {
// just a "title" row
boost::weak_ptr<Stripable> ws (stripable);
- if (rtav) {
- rtav->route()->gui_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::handle_gui_changes, this, _1, _2), gui_context());
- }
+ /* for now, we need both of these. PropertyChanged covers on
+ * pre-defined, "global" things of interest to a
+ * UI. gui_changed covers arbitrary, un-enumerated, un-typed
+ * changes that may only be of interest to a particular
+ * UI (e.g. track-height is not of any relevant to OSC)
+ */
+
+ stripable->gui_changed.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::handle_gui_changes, this, _1, _2), gui_context());
stripable->PropertyChanged.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::route_property_changed, this, _1, ws), gui_context());
+ stripable->presentation_info().PropertyChanged.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::route_property_changed, this, _1, ws), gui_context());
if (boost::dynamic_pointer_cast<Track> (stripable)) {
boost::shared_ptr<Track> t = boost::dynamic_pointer_cast<Track> (stripable);
_display.set_model (_model);
/* now update route order keys from the treeview/track display order */
+
if (!from_scratch) {
sync_presentation_info_from_treeview ();
}
+
+ redisplay ();
}
void
void
EditorRoutes::route_property_changed (const PropertyChange& what_changed, boost::weak_ptr<Stripable> s)
{
- if (!what_changed.contains (ARDOUR::Properties::name)) {
+ if (!what_changed.contains (ARDOUR::Properties::hidden) && !what_changed.contains (ARDOUR::Properties::name)) {
return;
}
- ENSURE_GUI_THREAD (*this, &EditorRoutes::route_name_changed, r)
+ if (_adding_routes) {
+ return;
+ }
boost::shared_ptr<Stripable> stripable = s.lock ();
TreeModel::Children::iterator i;
for (i = rows.begin(); i != rows.end(); ++i) {
+
boost::shared_ptr<Stripable> ss = (*i)[_columns.stripable];
+
if (ss == stripable) {
- (*i)[_columns.text] = stripable->name();
+
+ if (what_changed.contains (ARDOUR::Properties::name)) {
+ (*i)[_columns.text] = stripable->name();
+ break;
+ }
+
+ if (what_changed.contains (ARDOUR::Properties::hidden)) {
+ (*i)[_columns.visible] = !stripable->presentation_info().hidden();
+ cerr << stripable->name() << " visibility changed, redisplay\n";
+ redisplay ();
+
+ }
+
break;
}
}
}
}
-void
-EditorRoutes::reset_remote_control_ids ()
-{
- if (Config->get_remote_model() == UserOrdered || !_session || _session->deletion_in_progress()) {
- return;
- }
-
- sync_presentation_info_from_treeview ();
-}
void
EditorRoutes::sync_presentation_info_from_treeview ()
{
TreeModel::Children::iterator ri;
bool change = false;
PresentationInfo::order_t order = 0;
+ bool master_is_first = false;
+ uint32_t count = 0;
+
+ // special case master if it's got PI order 0 lets keep it there
+ if (_session->master_out() && (_session->master_out()->presentation_info().order() == 0)) {
+ order++;
+ master_is_first = true;
+ }
for (ri = rows.begin(); ri != rows.end(); ++ri) {
continue;
}
- if (!visible) {
- stripable->presentation_info().set_flag (PresentationInfo::Hidden);
- } else {
- stripable->presentation_info().unset_flag (PresentationInfo::Hidden);
+ stripable->presentation_info().set_hidden (!visible);
+
+ /* special case master if it's got PI order 0 lets keep it there
+ * but still allow master to move if first non-master route has
+ * presentation order 1
+ */
+ if ((count == 0) && master_is_first && (stripable->presentation_info().order() == 1)) {
+ master_is_first = false; // someone has moved master
+ order = 0;
}
- cerr << "Would change PI go for " << stripable->name() << " to " << order << " currently " << stripable->presentation_info().order() << endl;
+ if (stripable->is_master() && master_is_first) {
+ if (count) {
+ continue;
+ } else {
+ count++;
+ continue;
+ }
+ }
if (order != stripable->presentation_info().order()) {
- stripable->set_presentation_group_order_explicit (order);
+ stripable->set_presentation_order (order, false);
change = true;
}
++order;
+ ++count;
}
if (change) {
DEBUG_TRACE (DEBUG::OrderKeys, "... notify PI change from editor GUI\n");
_session->notify_presentation_info_change ();
+ _session->set_dirty();
}
}
}
};
-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 ();
- }
-};
-
struct PresentationInfoVCASorter
{
bool operator() (boost::shared_ptr<VCA> a, boost::shared_ptr<VCA> b) {
s.push_back (*ri);
}
- _editor->add_routes (r);
-
VCAList v (_session->vca_manager().vcas());
for (VCAList::iterator vi = v.begin(); vi != v.end(); ++vi) {
s.push_back (*vi);
}
- s.sort (PresentationInfoEditorSorter ());
- _editor->add_vcas (v);
+ _editor->add_stripables (s);
}
void
set<TimeAxisView*> show;
for (RouteList::const_iterator i = r->begin(); i != r->end(); ++i) {
- TimeAxisView* tav = _editor->axis_view_from_route (*i);
+ TimeAxisView* tav = _editor->axis_view_from_stripable (*i);
if (tav) {
show.insert (tav);
}