X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fmixer_ui.cc;h=d6ed651e48ae4b534dcde47a43e64c842a8e536f;hb=c9f9bb263fc3f96e383216d515c62ac6706b56da;hp=874f8feddf7ac119cb6bb3c85701cda842b24790;hpb=5399425f534e2d96d07cf29f427bfa0f39d904b7;p=ardour.git diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index 874f8feddf..d6ed651e48 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -41,6 +41,7 @@ #include "ardour/midi_track.h" #include "ardour/plugin_manager.h" #include "ardour/route_group.h" +#include "ardour/route_sorters.h" #include "ardour/session.h" #include "keyboard.h" @@ -56,10 +57,12 @@ #include "actions.h" #include "gui_thread.h" #include "mixer_group_tabs.h" +#include "timers.h" #include "i18n.h" using namespace ARDOUR; +using namespace ARDOUR_UI_UTILS; using namespace PBD; using namespace Gtk; using namespace Glib; @@ -89,9 +92,12 @@ Mixer_UI::Mixer_UI () , in_group_row_change (false) , track_menu (0) , _monitor_section (0) - , _strip_width (Config->get_default_narrow_ms() ? Narrow : Wide) + , _strip_width (ARDOUR_UI::config()->get_default_narrow_ms() ? Narrow : Wide) , ignore_reorder (false) + , _in_group_rebuild_or_clear (false) + , _route_deletion_in_progress (false) , _following_editor_selection (false) + , _maximised (false) { /* allow this window to become the key focus window */ set_flags (CAN_FOCUS); @@ -115,7 +121,7 @@ Mixer_UI::Mixer_UI () b->show_all (); scroller.add (*b); - scroller.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + scroller.set_policy (Gtk::POLICY_ALWAYS, Gtk::POLICY_AUTOMATIC); setup_track_display (); @@ -195,7 +201,7 @@ Mixer_UI::Mixer_UI () #else global_hpacker.pack_start (out_packer, false, false, 12); #endif - list_hpane.pack1(list_vpacker, true, true); + list_hpane.pack1(list_vpacker, false, false); list_hpane.pack2(global_hpacker, true, false); rhs_pane1.signal_size_allocate().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::pane_allocation_handler), @@ -239,13 +245,8 @@ Mixer_UI::Mixer_UI () list_hpane.show(); group_display.show(); - _in_group_rebuild_or_clear = false; - _maximised = false; - MixerStrip::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::remove_strip, this, _1), gui_context()); - MonitorSection::setup_knob_images (); - #ifndef DEFER_PLUGIN_SELECTOR_LOAD _plugin_selector = new PluginSelector (PluginManager::instance ()); #endif @@ -291,7 +292,7 @@ Mixer_UI::show_window () ms = (*ri)[track_columns.strip]; ms->set_width_enum (ms->get_width_enum (), ms->width_owner()); /* Fix visibility of mixer strip stuff */ - ms->parameter_changed (X_("mixer-strip-visibility")); + ms->parameter_changed (X_("mixer-element-visibility")); } } @@ -368,7 +369,7 @@ Mixer_UI::add_strips (RouteList& routes) strip = new MixerStrip (*this, _session, route); strips.push_back (strip); - Config->get_default_narrow_ms() ? _strip_width = Narrow : _strip_width = Wide; + ARDOUR_UI::config()->get_default_narrow_ms() ? _strip_width = Narrow : _strip_width = Wide; if (strip->width_owner() != strip) { strip->set_width_enum (_strip_width, this); @@ -402,6 +403,30 @@ Mixer_UI::add_strips (RouteList& routes) redisplay_track_list (); } +void +Mixer_UI::deselect_all_strip_processors () +{ + for (list::iterator i = strips.begin(); i != strips.end(); ++i) { + (*i)->deselect_all_processors(); + } +} + +void +Mixer_UI::select_none () +{ + _selection.clear_routes(); + deselect_all_strip_processors(); +} + +void +Mixer_UI::delete_processors () +{ + for (list::iterator i = strips.begin(); i != strips.end(); ++i) { + (*i)->delete_processors(); + } +} + + void Mixer_UI::remove_strip (MixerStrip* strip) { @@ -420,6 +445,7 @@ Mixer_UI::remove_strip (MixerStrip* strip) for (ri = rows.begin(); ri != rows.end(); ++ri) { if ((*ri)[track_columns.strip] == strip) { + PBD::Unwinder uw (_route_deletion_in_progress, true); track_model->erase (ri); break; } @@ -447,6 +473,17 @@ Mixer_UI::reset_remote_control_ids () uint32_t invisible_key = UINT32_MAX; for (ri = rows.begin(); ri != rows.end(); ++ri) { + + /* skip two special values */ + + if (rid == Route::MasterBusRemoteControlID) { + rid++; + } + + if (rid == Route::MonitorBusRemoteControlID) { + rid++; + } + boost::shared_ptr route = (*ri)[track_columns.route]; bool visible = (*ri)[track_columns.visible]; @@ -593,7 +630,7 @@ Mixer_UI::sync_treeview_from_order_keys () void Mixer_UI::follow_editor_selection () { - if (!Config->get_link_editor_and_mixer_selection() || _following_editor_selection) { + if (!ARDOUR_UI::config()->get_link_editor_and_mixer_selection() || _following_editor_selection) { return; } @@ -651,6 +688,7 @@ Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip) vector tmp; bool accumulate = false; + bool found_another = false; tmp.push_back (strip); @@ -669,6 +707,7 @@ Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip) /* hit selected strip. if currently accumulating others, we're done. if not accumulating others, start doing so. */ + found_another = true; if (accumulate) { /* done */ break; @@ -682,9 +721,12 @@ Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip) } } - for (vector::iterator i = tmp.begin(); i != tmp.end(); ++i) { - _selection.add (*i); - } + if (found_another) { + for (vector::iterator i = tmp.begin(); i != tmp.end(); ++i) { + _selection.add (*i); + } + } else + _selection.set (strip); //user wants to start a range selection, but there aren't any others selected yet } } else { @@ -854,7 +896,7 @@ Mixer_UI::hide_strip (MixerStrip* ms) gint Mixer_UI::start_updating () { - fast_screen_update_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect (sigc::mem_fun(*this, &Mixer_UI::fast_update_strips)); + fast_screen_update_connection = Timers::super_rapid_connect (sigc::mem_fun(*this, &Mixer_UI::fast_update_strips)); return 0; } @@ -997,9 +1039,17 @@ Mixer_UI::track_list_delete (const Gtk::TreeModel::Path&) { /* this happens as the second step of a DnD within the treeview as well as when a row/route is actually deleted. + + if it was a deletion then we have to force a redisplay because + order keys may not have changed. */ + DEBUG_TRACE (DEBUG::OrderKeys, "mixer UI treeview row deleted\n"); sync_order_keys_from_treeview (); + + if (_route_deletion_in_progress) { + redisplay_track_list (); + } } void @@ -1090,28 +1140,12 @@ Mixer_UI::strip_width_changed () } -struct SignalOrderRouteSorter { - bool operator() (boost::shared_ptr a, boost::shared_ptr b) { - if (a->is_master() || a->is_monitor()) { - /* "a" is a special route (master, monitor, etc), and comes - * last in the mixer ordering - */ - return false; - } else if (b->is_master() || b->is_monitor()) { - /* everything comes before b */ - return true; - } - return a->order_key () < b->order_key (); - - } -}; - void Mixer_UI::initial_track_display () { boost::shared_ptr routes = _session->get_routes(); RouteList copy (*routes); - SignalOrderRouteSorter sorter; + ARDOUR::SignalOrderRouteSorter sorter; copy.sort (sorter); @@ -1267,6 +1301,14 @@ Mixer_UI::route_groups_changed () group_model->clear (); +#if 0 + /* this is currently not used, + * Mixer_UI::group_display_button_press() has a case for it, + * and a commented edit_route_group() but that's n/a since 2011. + * + * This code is left as reminder that + * row[group_columns.group] = 0 has special meaning. + */ { TreeModel::Row row; row = *(group_model->append()); @@ -1274,6 +1316,7 @@ Mixer_UI::route_groups_changed () row[group_columns.text] = (_("-all-")); row[group_columns.group] = 0; } +#endif _session->foreach_route_group (sigc::mem_fun (*this, &Mixer_UI::add_route_group)); @@ -1776,7 +1819,7 @@ Mixer_UI::parameter_changed (string const & p) _group_tabs->hide (); } } else if (p == "default-narrow_ms") { - bool const s = Config->get_default_narrow_ms (); + bool const s = ARDOUR_UI::config()->get_default_narrow_ms (); for (list::iterator i = strips.begin(); i != strips.end(); ++i) { (*i)->set_width_enum (s ? Narrow : Wide, this); } @@ -1813,6 +1856,7 @@ Mixer_UI::setup_track_display () track_display.get_column (1)->set_data (X_("colnum"), GUINT_TO_POINTER(1)); track_display.get_column (0)->set_expand(true); track_display.get_column (1)->set_expand(false); + track_display.get_column (0)->set_sizing (Gtk::TREE_VIEW_COLUMN_FIXED); track_display.set_name (X_("EditGroupList")); track_display.get_selection()->set_mode (Gtk::SELECTION_NONE); track_display.set_reorderable (true); @@ -1917,16 +1961,8 @@ Mixer_UI::set_route_targets_for_operation () return; } - /* nothing selected ... try to get mixer strip at mouse */ +// removed "implicit" selections of strips, after discussion on IRC - int x, y; - get_pointer (x, y); - - MixerStrip* ms = strip_by_x (x); - - if (ms) { - _route_targets.insert (ms); - } } void