summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-07-19 22:35:43 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-07-19 22:35:43 +0000
commite43d91949be2fedf09eaf61cb5b9e4778a505dc0 (patch)
treec8e73694329fa2345245d50536adba0eff9449db /gtk2_ardour
parentdd440c22c17b0ccbb3db330779fd81e76035e1a6 (diff)
more work on RID and editor/mixer order matching; when a track/bus is hidden in the GUI controlling RID, it gets a extremely large RID to prevent it showing up on a control surface (but ... for now ... is still visible in the other GUI, even if "sync order between mixer + editor" is enabled); change font in editor route list
git-svn-id: svn://localhost/ardour2/branches/3.0@13054 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/editor_actions.cc4
-rw-r--r--gtk2_ardour/editor_group_tabs.cc2
-rw-r--r--gtk2_ardour/editor_routes.cc107
-rw-r--r--gtk2_ardour/editor_routes.h7
-rw-r--r--gtk2_ardour/mixer_group_tabs.cc2
-rw-r--r--gtk2_ardour/mixer_ui.cc186
-rw-r--r--gtk2_ardour/mixer_ui.h9
7 files changed, 245 insertions, 72 deletions
diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc
index 5412a6a8c2..e274170982 100644
--- a/gtk2_ardour/editor_actions.cc
+++ b/gtk2_ardour/editor_actions.cc
@@ -1482,6 +1482,10 @@ Editor::parameter_changed (std::string p)
}
} else if (p == "show-region-gain") {
set_gain_envelope_visibility ();
+ } else if (p == "remote-model") {
+ if (_routes) {
+ _routes->reset_remote_control_ids ();
+ }
}
}
diff --git a/gtk2_ardour/editor_group_tabs.cc b/gtk2_ardour/editor_group_tabs.cc
index cb85544669..f9e2bc3a19 100644
--- a/gtk2_ardour/editor_group_tabs.cc
+++ b/gtk2_ardour/editor_group_tabs.cc
@@ -201,5 +201,5 @@ EditorGroupTabs::selected_routes () const
void
EditorGroupTabs::sync_order_keys ()
{
- _editor->_routes->sync_order_keys_from_model ();
+ _editor->_routes->sync_order_keys_from_treeview ();
}
diff --git a/gtk2_ardour/editor_routes.cc b/gtk2_ardour/editor_routes.cc
index 39e31f59d4..242a013583 100644
--- a/gtk2_ardour/editor_routes.cc
+++ b/gtk2_ardour/editor_routes.cc
@@ -221,6 +221,7 @@ EditorRoutes::EditorRoutes (Editor* e)
_display.get_selection()->set_mode (SELECTION_SINGLE);
_display.get_selection()->set_select_function (sigc::mem_fun (*this, &EditorRoutes::selection_filter));
_display.set_reorderable (true);
+ _display.set_name (X_("MixerTrackDisplayList"));
_display.set_rules_hint (true);
_display.set_size_request (100, -1);
_display.add_object_drag (_columns.route.index(), "routes");
@@ -281,7 +282,7 @@ EditorRoutes::EditorRoutes (Editor* e)
_display.set_enable_search (false);
- Route::SyncOrderKeys.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::sync_model_from_order_keys, this, _1), gui_context());
+ Route::SyncOrderKeys.connect (*this, MISSING_INVALIDATOR, boost::bind (&EditorRoutes::sync_treeview_from_order_keys, this, _1), gui_context());
}
bool
@@ -550,14 +551,14 @@ EditorRoutes::route_deleted (Gtk::TreeModel::Path const &)
as when a row/route is actually deleted.
*/
DEBUG_TRACE (DEBUG::OrderKeys, "editor routes treeview row deleted\n");
- sync_order_keys_from_model ();
+ sync_order_keys_from_treeview ();
}
void
EditorRoutes::reordered (TreeModel::Path const &, TreeModel::iterator const &, int* /*what*/)
{
DEBUG_TRACE (DEBUG::OrderKeys, "editor routes treeview reordered\n");
- sync_order_keys_from_model ();
+ sync_order_keys_from_treeview ();
}
void
@@ -664,7 +665,7 @@ EditorRoutes::routes_added (list<RouteTimeAxisView*> routes)
/* now update route order keys from the treeview/track display order */
- sync_order_keys_from_model ();
+ sync_order_keys_from_treeview ();
}
void
@@ -760,7 +761,7 @@ EditorRoutes::update_visibility ()
/* force route order keys catch up with visibility changes
*/
- sync_order_keys_from_model ();
+ sync_order_keys_from_treeview ();
resume_redisplay ();
}
@@ -799,7 +800,57 @@ EditorRoutes::show_track_in_display (TimeAxisView& tv)
}
void
-EditorRoutes::sync_order_keys_from_model ()
+EditorRoutes::reset_remote_control_ids ()
+{
+ if (Config->get_remote_model() != EditorOrdered || !_session || _session->deletion_in_progress()) {
+ return;
+ }
+
+ TreeModel::Children rows = _model->children();
+
+ if (rows.empty()) {
+ return;
+ }
+
+
+ DEBUG_TRACE (DEBUG::OrderKeys, "editor reset remote control ids\n");
+
+ TreeModel::Children::iterator ri;
+ bool rid_change = false;
+ uint32_t rid = 1;
+ uint32_t invisible_key = UINT32_MAX;
+
+ for (ri = rows.begin(); ri != rows.end(); ++ri) {
+
+ boost::shared_ptr<Route> route = (*ri)[_columns.route];
+ bool visible = (*ri)[_columns.visible];
+
+
+ if (!route->is_master() && !route->is_monitor()) {
+
+ uint32_t new_rid = (visible ? rid : invisible_key--);
+
+ if (new_rid != route->remote_control_id()) {
+ route->set_remote_control_id_from_order_key (EditorSort, new_rid);
+ rid_change = true;
+ }
+
+ if (visible) {
+ rid++;
+ }
+
+ }
+ }
+
+ if (rid_change) {
+ /* tell the world that we changed the remote control IDs */
+ _session->notify_remote_id_change ();
+ }
+}
+
+
+void
+EditorRoutes::sync_order_keys_from_treeview ()
{
if (_ignore_reorder || !_session || _session->deletion_in_progress()) {
return;
@@ -811,30 +862,60 @@ EditorRoutes::sync_order_keys_from_model ()
return;
}
- DEBUG_TRACE (DEBUG::OrderKeys, "editor sync order keys from model\n");
+
+ DEBUG_TRACE (DEBUG::OrderKeys, "editor sync order keys from treeview\n");
TreeModel::Children::iterator ri;
bool changed = false;
+ bool rid_change = false;
uint32_t order = 0;
+ uint32_t rid = 1;
+ uint32_t invisible_key = UINT32_MAX;
+
+ for (ri = rows.begin(); ri != rows.end(); ++ri) {
- for (ri = rows.begin(); ri != rows.end(); ++ri, ++order) {
boost::shared_ptr<Route> route = (*ri)[_columns.route];
+ bool visible = (*ri)[_columns.visible];
+
uint32_t old_key = route->order_key (EditorSort);
if (order != old_key) {
route->set_order_key (EditorSort, order);
+
changed = true;
}
+
+ if ((Config->get_remote_model() == EditorOrdered) && !route->is_master() && !route->is_monitor()) {
+
+ uint32_t new_rid = (visible ? rid : invisible_key--);
+
+ if (new_rid != route->remote_control_id()) {
+ route->set_remote_control_id_from_order_key (EditorSort, new_rid);
+ rid_change = true;
+ }
+
+ if (visible) {
+ rid++;
+ }
+
+ }
+
+ ++order;
}
if (changed) {
/* tell the world that we changed the editor sort keys */
_session->sync_order_keys (EditorSort);
}
+
+ if (rid_change) {
+ /* tell the world that we changed the remote control IDs */
+ _session->notify_remote_id_change ();
+ }
}
void
-EditorRoutes::sync_model_from_order_keys (RouteSortOrderKey src)
+EditorRoutes::sync_treeview_from_order_keys (RouteSortOrderKey src)
{
/* Some route order key(s) for `src' has been changed, make sure that
we update out tree/list model and GUI to reflect the change.
@@ -886,9 +967,9 @@ EditorRoutes::sync_model_from_order_keys (RouteSortOrderKey src)
boost::shared_ptr<Route> route = (*ri)[_columns.route];
uint32_t new_order = route->order_key (EditorSort);
- DEBUG_TRACE (DEBUG::OrderKeys, string_compose ("editor change order for %1 from %2 to %3\n",
+ DEBUG_TRACE (DEBUG::OrderKeys, string_compose ("EDITOR change order for %1 from %2 to %3\n",
route->name(), old_order, new_order));
-
+
neworder[new_order] = old_order;
if (old_order != new_order) {
@@ -957,7 +1038,7 @@ EditorRoutes::set_all_tracks_visibility (bool yn)
/* force route order keys catch up with visibility changes
*/
- sync_order_keys_from_model ();
+ sync_order_keys_from_treeview ();
resume_redisplay ();
}
@@ -1019,7 +1100,7 @@ EditorRoutes::set_all_audio_midi_visibility (int tracks, bool yn)
/* force route order keys catch up with visibility changes
*/
- sync_order_keys_from_model ();
+ sync_order_keys_from_treeview ();
resume_redisplay ();
}
diff --git a/gtk2_ardour/editor_routes.h b/gtk2_ardour/editor_routes.h
index 008304303f..4933a9496f 100644
--- a/gtk2_ardour/editor_routes.h
+++ b/gtk2_ardour/editor_routes.h
@@ -59,9 +59,10 @@ public:
std::list<TimeAxisView*> views () const;
void hide_all_tracks (bool);
void clear ();
- void sync_order_keys_from_model ();
-private:
+ void sync_order_keys_from_treeview ();
+ void reset_remote_control_ids ();
+private:
void initial_display ();
void on_input_active_changed (std::string const &);
void on_tv_rec_enable_changed (std::string const &);
@@ -71,7 +72,7 @@ private:
void on_tv_solo_safe_toggled (std::string const &);
void build_menu ();
void show_menu ();
- void sync_model_from_order_keys (ARDOUR::RouteSortOrderKey);
+ void sync_treeview_from_order_keys (ARDOUR::RouteSortOrderKey);
void route_deleted (Gtk::TreeModel::Path const &);
void visible_changed (std::string const &);
void active_changed (std::string const &);
diff --git a/gtk2_ardour/mixer_group_tabs.cc b/gtk2_ardour/mixer_group_tabs.cc
index f3121a5ca9..4a56b01fcd 100644
--- a/gtk2_ardour/mixer_group_tabs.cc
+++ b/gtk2_ardour/mixer_group_tabs.cc
@@ -192,5 +192,5 @@ MixerGroupTabs::selected_routes () const
void
MixerGroupTabs::sync_order_keys ()
{
- _mixer->sync_order_keys_from_model ();
+ _mixer->sync_order_keys_from_treeview ();
}
diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc
index b83be455d0..a4175e7d91 100644
--- a/gtk2_ardour/mixer_ui.cc
+++ b/gtk2_ardour/mixer_ui.cc
@@ -28,7 +28,6 @@
#include <gtkmm/accelmap.h>
#include "pbd/convert.h"
-#include "pbd/stacktrace.h"
#include "pbd/unwind.h"
#include <glibmm/thread.h>
@@ -94,7 +93,7 @@ Mixer_UI::Mixer_UI ()
/* allow this window to become the key focus window */
set_flags (CAN_FOCUS);
- Route::SyncOrderKeys.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::sync_model_from_order_keys, this, _1), gui_context());
+ Route::SyncOrderKeys.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::sync_treeview_from_order_keys, this, _1), gui_context());
scroller_base.set_flags (Gtk::CAN_FOCUS);
scroller_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
@@ -366,7 +365,7 @@ Mixer_UI::add_strips (RouteList& routes)
}
}
- sync_order_keys_from_model ();
+ sync_order_keys_from_treeview ();
redisplay_track_list ();
}
@@ -395,7 +394,52 @@ Mixer_UI::remove_strip (MixerStrip* strip)
}
void
-Mixer_UI::sync_order_keys_from_model ()
+Mixer_UI::reset_remote_control_ids ()
+{
+ if (Config->get_remote_model() != MixerOrdered || !_session || _session->deletion_in_progress()) {
+ return;
+ }
+
+ TreeModel::Children rows = track_model->children();
+
+ if (rows.empty()) {
+ return;
+ }
+
+ DEBUG_TRACE (DEBUG::OrderKeys, "mixer resets remote control ids after remote model change\n");
+
+ TreeModel::Children::iterator ri;
+ bool rid_change = false;
+ uint32_t rid = 1;
+ uint32_t invisible_key = UINT32_MAX;
+
+ for (ri = rows.begin(); ri != rows.end(); ++ri) {
+ boost::shared_ptr<Route> route = (*ri)[track_columns.route];
+ bool visible = (*ri)[track_columns.visible];
+
+ if (!route->is_master() && !route->is_monitor()) {
+
+ uint32_t new_rid = (visible ? rid : invisible_key--);
+
+ if (new_rid != route->remote_control_id()) {
+ route->set_remote_control_id_from_order_key (MixerSort, new_rid);
+ rid_change = true;
+ }
+
+ if (visible) {
+ rid++;
+ }
+ }
+ }
+
+ if (rid_change) {
+ /* tell the world that we changed the remote control IDs */
+ _session->notify_remote_id_change ();
+ }
+}
+
+void
+Mixer_UI::sync_order_keys_from_treeview ()
{
if (ignore_reorder || !_session || _session->deletion_in_progress()) {
return;
@@ -411,26 +455,53 @@ Mixer_UI::sync_order_keys_from_model ()
TreeModel::Children::iterator ri;
bool changed = false;
+ bool rid_change = false;
uint32_t order = 0;
+ uint32_t rid = 1;
+ uint32_t invisible_key = UINT32_MAX;
- for (ri = rows.begin(); ri != rows.end(); ++ri, ++order) {
+ for (ri = rows.begin(); ri != rows.end(); ++ri) {
boost::shared_ptr<Route> route = (*ri)[track_columns.route];
+ bool visible = (*ri)[track_columns.visible];
+
uint32_t old_key = route->order_key (MixerSort);
- if (old_key != order) {
+ if (order != old_key) {
route->set_order_key (MixerSort, order);
changed = true;
}
+
+ if ((Config->get_remote_model() == MixerOrdered) && !route->is_master() && !route->is_monitor()) {
+
+ uint32_t new_rid = (visible ? rid : invisible_key--);
+
+ if (new_rid != route->remote_control_id()) {
+ route->set_remote_control_id_from_order_key (MixerSort, new_rid);
+ rid_change = true;
+ }
+
+ if (visible) {
+ rid++;
+ }
+
+ }
+
+ ++order;
}
-
+
if (changed) {
/* tell everyone that we changed the mixer sort keys */
_session->sync_order_keys (MixerSort);
}
+
+ if (rid_change) {
+ /* tell the world that we changed the remote control IDs */
+ _session->notify_remote_id_change ();
+ }
}
void
-Mixer_UI::sync_model_from_order_keys (RouteSortOrderKey src)
+Mixer_UI::sync_treeview_from_order_keys (RouteSortOrderKey src)
{
if (!_session || _session->deletion_in_progress()) {
return;
@@ -465,7 +536,7 @@ Mixer_UI::sync_model_from_order_keys (RouteSortOrderKey src)
vector<int> neworder;
TreeModel::Children rows = track_model->children();
- uint32_t n = 0;
+ uint32_t old_order = 0;
bool changed = false;
if (rows.empty()) {
@@ -474,18 +545,18 @@ Mixer_UI::sync_model_from_order_keys (RouteSortOrderKey src)
neworder.assign (rows.size(), 0);
- for (TreeModel::Children::iterator ri = rows.begin(); ri != rows.end(); ++ri, ++n) {
+ for (TreeModel::Children::iterator ri = rows.begin(); ri != rows.end(); ++ri, ++old_order) {
boost::shared_ptr<Route> route = (*ri)[track_columns.route];
- uint32_t o = route->order_key (MixerSort);
+ uint32_t new_order = route->order_key (MixerSort);
- neworder[o] = n;
+ neworder[new_order] = old_order;
- if (o != n) {
+ if (old_order != new_order) {
changed = true;
}
- DEBUG_TRACE (DEBUG::OrderKeys, string_compose ("mixer change order for %1 to %2\n",
- route->name(), route->order_key (MixerSort)));
+ DEBUG_TRACE (DEBUG::OrderKeys, string_compose ("MIXER change order for %1 from %2 to %3\n",
+ route->name(), old_order, new_order));
}
if (changed) {
@@ -680,6 +751,50 @@ Mixer_UI::session_going_away ()
}
void
+Mixer_UI::track_visibility_changed (std::string const & path)
+{
+ if (_session && _session->deletion_in_progress()) {
+ return;
+ }
+
+ TreeIter iter;
+
+ if ((iter = track_model->get_iter (path))) {
+ MixerStrip* strip = (*iter)[track_columns.strip];
+ if (strip) {
+ bool visible = (*iter)[track_columns.visible];
+
+ if (strip->set_marked_for_display (!visible)) {
+ update_track_visibility ();
+ }
+ }
+ }
+}
+
+void
+Mixer_UI::update_track_visibility ()
+{
+ TreeModel::Children rows = track_model->children();
+ TreeModel::Children::iterator i;
+
+ {
+ Unwinder<bool> uw (no_track_list_redisplay, true);
+
+ for (i = rows.begin(); i != rows.end(); ++i) {
+ MixerStrip *strip = (*i)[track_columns.strip];
+ (*i)[track_columns.visible] = strip->marked_for_display ();
+ }
+
+ /* force route order keys catch up with visibility changes
+ */
+
+ sync_order_keys_from_treeview ();
+ }
+
+ redisplay_track_list ();
+}
+
+void
Mixer_UI::show_strip (MixerStrip* ms)
{
TreeModel::Children rows = track_model->children();
@@ -851,7 +966,7 @@ void
Mixer_UI::track_list_reorder (const TreeModel::Path&, const TreeModel::iterator&, int* /*new_order*/)
{
DEBUG_TRACE (DEBUG::OrderKeys, "mixer UI treeview reordered\n");
- sync_order_keys_from_model ();
+ sync_order_keys_from_treeview ();
}
void
@@ -861,7 +976,7 @@ Mixer_UI::track_list_delete (const Gtk::TreeModel::Path&)
as when a row/route is actually deleted.
*/
DEBUG_TRACE (DEBUG::OrderKeys, "mixer UI treeview row deleted\n");
- sync_order_keys_from_model ();
+ sync_order_keys_from_treeview ();
}
void
@@ -1008,43 +1123,9 @@ Mixer_UI::track_display_button_press (GdkEventButton* ev)
return true;
}
- TreeIter iter;
- TreeModel::Path path;
- TreeViewColumn* column;
- int cellx;
- int celly;
-
- if (!track_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) {
- return false;
- }
-
- switch (GPOINTER_TO_UINT (column->get_data (X_("colnum")))) {
- case 0:
- /* allow normal processing to occur */
- return false;
-
- case 1: /* visibility */
- if ((iter = track_model->get_iter (path))) {
- MixerStrip* strip = (*iter)[track_columns.strip];
- if (strip) {
-
- if (!strip->route()->is_master() && !strip->route()->is_monitor()) {
- bool visible = (*iter)[track_columns.visible];
- (*iter)[track_columns.visible] = !visible;
- redisplay_track_list ();
- }
- }
- }
- return true;
-
- default:
- break;
- }
-
return false;
}
-
void
Mixer_UI::build_track_menu ()
{
@@ -1659,6 +1740,8 @@ Mixer_UI::parameter_changed (string const & p)
for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
(*i)->set_width_enum (s ? Narrow : Wide, this);
}
+ } else if (p == "remote-model") {
+ reset_remote_control_ids ();
}
}
@@ -1701,6 +1784,7 @@ Mixer_UI::setup_track_display ()
CellRendererToggle* track_list_visible_cell = dynamic_cast<CellRendererToggle*>(track_display.get_column_cell_renderer (1));
track_list_visible_cell->property_activatable() = true;
track_list_visible_cell->property_radio() = false;
+ track_list_visible_cell->signal_toggled().connect (sigc::mem_fun (*this, &Mixer_UI::track_visibility_changed));
track_display.signal_button_press_event().connect (sigc::mem_fun (*this, &Mixer_UI::track_display_button_press), false);
diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h
index ab0223aa4d..90af35822b 100644
--- a/gtk2_ardour/mixer_ui.h
+++ b/gtk2_ardour/mixer_ui.h
@@ -166,9 +166,11 @@ class Mixer_UI : public Gtk::Window, public PBD::ScopedConnectionList, public AR
void initial_track_display ();
void show_track_list_menu ();
-
+
void set_all_strips_visibility (bool yn);
void set_all_audio_visibility (int tracks, bool yn);
+ void track_visibility_changed (std::string const & path);
+ void update_track_visibility ();
void hide_all_routes ();
void show_all_routes ();
@@ -244,8 +246,9 @@ class Mixer_UI : public Gtk::Window, public PBD::ScopedConnectionList, public AR
Width _strip_width;
- void sync_order_keys_from_model ();
- void sync_model_from_order_keys (ARDOUR::RouteSortOrderKey);
+ void sync_order_keys_from_treeview ();
+ void sync_treeview_from_order_keys (ARDOUR::RouteSortOrderKey);
+ void reset_remote_control_ids ();
bool ignore_reorder;
void parameter_changed (std::string const &);