From 0ae9cda51d8c807e5c49bdee6c90457f31e58669 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 6 Aug 2017 18:37:15 +0200 Subject: Allow to select VCAs --- gtk2_ardour/clearlooks.rc.in | 1 + gtk2_ardour/editor.h | 4 ++-- gtk2_ardour/editor_actions.cc | 7 +++++-- gtk2_ardour/editor_ops.cc | 26 ++++++++++++++++++-------- gtk2_ardour/editor_routes.cc | 3 --- gtk2_ardour/mixer_ui.cc | 33 ++++++++++++++++++++++++++++++++- gtk2_ardour/mixer_ui.h | 1 + gtk2_ardour/selection.cc | 16 ---------------- gtk2_ardour/vca_master_strip.cc | 5 +++-- gtk2_ardour/vca_time_axis.cc | 8 ++++++-- gtk2_ardour/vca_time_axis.h | 1 - 11 files changed, 68 insertions(+), 37 deletions(-) diff --git a/gtk2_ardour/clearlooks.rc.in b/gtk2_ardour/clearlooks.rc.in index 9792028f0d..11f39ca67c 100644 --- a/gtk2_ardour/clearlooks.rc.in +++ b/gtk2_ardour/clearlooks.rc.in @@ -1152,6 +1152,7 @@ widget "*MidiTrackControlsBaseSelected" style:highest "track_header_selected" widget "*BusControlsBaseSelected" style:highest "track_header_selected" widget "*AutomationTrackControlsBase" style:highest "automation_track_header" widget "*AutomationTrackControlsBaseSelected" style:highest "track_header_selected" +widget "*ControlMasterBaseSelected" style:highest "track_header_selected" widget "*PluginParameterLabel" style:highest "medium_text" widget "*ParameterValueDisplay" style:highest "medium_bold_entry" widget "*PluginUIClickBox*" style:highest "medium_bold_entry" diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index e5b231aa0f..a2e3aacfa2 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -2175,8 +2175,8 @@ private: void stop_updating_meters (); bool meters_running; - void select_next_route (); - void select_prev_route (); + void select_next_stripable (bool routes_only = true); + void select_prev_stripable (bool routes_only = true); void snap_to_internal (ARDOUR::MusicFrame& first, ARDOUR::RoundMode direction = ARDOUR::RoundNearest, diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 9fc9361bd2..67ccd86eee 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -237,8 +237,11 @@ Editor::register_actions () reg_sens (editor_actions, "select-all-in-punch-range", _("Select All in Punch Range"), sigc::mem_fun(*this, &Editor::select_all_selectables_using_punch)); reg_sens (editor_actions, "select-all-in-loop-range", _("Select All in Loop Range"), sigc::mem_fun(*this, &Editor::select_all_selectables_using_loop)); - reg_sens (editor_actions, "select-next-route", _("Select Next Track or Bus"), sigc::mem_fun(*this, &Editor::select_next_route)); - reg_sens (editor_actions, "select-prev-route", _("Select Previous Track or Bus"), sigc::mem_fun(*this, &Editor::select_prev_route)); + reg_sens (editor_actions, "select-next-route", _("Select Next Track or Bus"), sigc::bind (sigc::mem_fun(*this, &Editor::select_next_stripable), true)); + reg_sens (editor_actions, "select-prev-route", _("Select Previous Track or Bus"), sigc::bind (sigc::mem_fun(*this, &Editor::select_prev_stripable), true)); + + reg_sens (editor_actions, "select-next-stripable", _("Select Next Strip"), sigc::bind (sigc::mem_fun(*this, &Editor::select_next_stripable), false)); + reg_sens (editor_actions, "select-prev-stripable", _("Select Previous Strip"), sigc::bind (sigc::mem_fun(*this, &Editor::select_prev_stripable), false)); act = reg_sens (editor_actions, "track-record-enable-toggle", _("Toggle Record Enable"), sigc::mem_fun(*this, &Editor::toggle_record_enable)); ActionManager::track_selection_sensitive_actions.push_back (act); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 414768f2f1..9737d2cc3d 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -6375,7 +6375,7 @@ Editor::split_region () } void -Editor::select_next_route() +Editor::select_next_stripable (bool routes_only) { if (selection->tracks.empty()) { selection->set (track_views.front()); @@ -6384,7 +6384,7 @@ Editor::select_next_route() TimeAxisView* current = selection->tracks.front(); - RouteUI *rui; + bool valid; do { for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) { @@ -6400,9 +6400,14 @@ Editor::select_next_route() } } - rui = dynamic_cast(current); + if (routes_only) { + RouteUI* rui = dynamic_cast(current); + valid = rui && rui->route()->active(); + } else { + valid = 0 != current->stripable ().get(); + } - } while (current->hidden() || (rui == NULL) || !rui->route()->active()); + } while (current->hidden() || !valid); selection->set (current); @@ -6410,7 +6415,7 @@ Editor::select_next_route() } void -Editor::select_prev_route() +Editor::select_prev_stripable (bool routes_only) { if (selection->tracks.empty()) { selection->set (track_views.front()); @@ -6419,7 +6424,7 @@ Editor::select_prev_route() TimeAxisView* current = selection->tracks.front(); - RouteUI *rui; + bool valid; do { for (TrackViewList::reverse_iterator i = track_views.rbegin(); i != track_views.rend(); ++i) { @@ -6433,9 +6438,14 @@ Editor::select_prev_route() break; } } - rui = dynamic_cast(current); + if (routes_only) { + RouteUI* rui = dynamic_cast(current); + valid = rui && rui->route()->active(); + } else { + valid = 0 != current->stripable ().get(); + } - } while (current->hidden() || (rui == NULL) || !rui->route()->active()); + } while (current->hidden() || !valid); selection->set (current); diff --git a/gtk2_ardour/editor_routes.cc b/gtk2_ardour/editor_routes.cc index c64683c341..dee4ef8002 100644 --- a/gtk2_ardour/editor_routes.cc +++ b/gtk2_ardour/editor_routes.cc @@ -1463,9 +1463,6 @@ EditorRoutes::selection_filter (Glib::RefPtr const& model, TreeModel: TreeModel::iterator iter = model->get_iter (path); if (iter) { boost::shared_ptr stripable = (*iter)[_columns.stripable]; - if (boost::dynamic_pointer_cast (stripable)) { - return false; - } } return true; diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index d982e5a301..047104ac71 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -349,6 +349,7 @@ Mixer_UI::Mixer_UI () favorite_plugins_display.show(); MixerStrip::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::remove_strip, this, _1), gui_context()); + VCAMasterStrip::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::remove_master, this, _1), gui_context()); /* handle escape */ @@ -535,7 +536,7 @@ Mixer_UI::add_stripables (StripableList& slist) row[stripable_columns.strip] = vms; row[stripable_columns.stripable] = vca; - vms->CatchDeletion.connect (*this, invalidator (*this), boost::bind (&Mixer_UI::remove_master, this, _1), gui_context()); + vms->signal_button_release_event().connect (sigc::bind (sigc::mem_fun(*this, &Mixer_UI::vca_button_release_event), vms)); } else if ((route = boost::dynamic_pointer_cast (*s))) { @@ -828,6 +829,20 @@ Mixer_UI::sync_treeview_from_presentation_info (PropertyChange const & what_chan if (!_selection.axes.empty() && !PublicEditor::instance().track_selection_change_without_scroll ()) { move_stripable_into_view ((*_selection.axes.begin())->stripable()); } + + TreeModel::Children rows = track_model->children(); + for (TreeModel::Children::const_iterator i = rows.begin(); i != rows.end(); ++i) { + AxisView* av = (*i)[stripable_columns.strip]; + VCAMasterStrip* vms = dynamic_cast (av); + if (!vms) { + continue; + } + if (vms->vca() && vms->vca()->is_selected()) { + _selection.add (vms); + } else { + _selection.remove (vms); + } + } } redisplay_track_list (); @@ -867,6 +882,15 @@ Mixer_UI::axis_view_by_stripable (boost::shared_ptr s) const } } + TreeModel::Children rows = track_model->children(); + for (TreeModel::Children::const_iterator i = rows.begin(); i != rows.end(); ++i) { + AxisView* av = (*i)[stripable_columns.strip]; + VCAMasterStrip* vms = dynamic_cast (av); + if (vms && vms->stripable () == s) { + return av; + } + } + return 0; } @@ -972,6 +996,13 @@ Mixer_UI::strip_button_release_event (GdkEventButton *ev, MixerStrip *strip) return true; } +bool +Mixer_UI::vca_button_release_event (GdkEventButton *ev, VCAMasterStrip *strip) +{ + _selection.set (strip); + return true; +} + void Mixer_UI::set_session (Session* sess) { diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h index 9485ea252f..d0a051dfce 100644 --- a/gtk2_ardour/mixer_ui.h +++ b/gtk2_ardour/mixer_ui.h @@ -328,6 +328,7 @@ private: void group_display_selection_changed (); bool strip_button_release_event (GdkEventButton*, MixerStrip*); + bool vca_button_release_event (GdkEventButton*, VCAMasterStrip*); Width _strip_width; diff --git a/gtk2_ardour/selection.cc b/gtk2_ardour/selection.cc index 7a9e0e3ad8..1e89e08879 100644 --- a/gtk2_ardour/selection.cc +++ b/gtk2_ardour/selection.cc @@ -1462,10 +1462,6 @@ Selection::toggle (const TrackViewList& track_list) void Selection::toggle (TimeAxisView* track) { - if (dynamic_cast (track)) { - return; - } - TrackViewList tr; tr.push_back (track); toggle (tr); @@ -1489,10 +1485,6 @@ Selection::add (TrackViewList const & track_list) void Selection::add (TimeAxisView* track) { - if (dynamic_cast (track)) { - return; - } - TrackViewList tr; tr.push_back (track); add (tr); @@ -1501,10 +1493,6 @@ Selection::add (TimeAxisView* track) void Selection::remove (TimeAxisView* track) { - if (dynamic_cast (track)) { - return; - } - TrackViewList tvl; tvl.push_back (track); remove (tvl); @@ -1526,10 +1514,6 @@ Selection::remove (const TrackViewList& t) void Selection::set (TimeAxisView* track) { - if (dynamic_cast (track)) { - return; - } - TrackViewList tvl; tvl.push_back (track); set (tvl); diff --git a/gtk2_ardour/vca_master_strip.cc b/gtk2_ardour/vca_master_strip.cc index 4c72b0b624..eacc1a0ecd 100644 --- a/gtk2_ardour/vca_master_strip.cc +++ b/gtk2_ardour/vca_master_strip.cc @@ -97,7 +97,7 @@ VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr v) number_label.set_alignment (.5, .5); number_label.set_fallthrough_to_parent (true); number_label.set_inactive_color (_vca->presentation_info().color ()); - number_label.signal_button_release_event().connect (sigc::mem_fun (*this, &VCAMasterStrip::number_button_press)); + number_label.signal_button_release_event().connect (sigc::mem_fun (*this, &VCAMasterStrip::number_button_press), false); update_bottom_padding (); @@ -407,8 +407,9 @@ VCAMasterStrip::number_button_press (GdkEventButton* ev) build_context_menu (); } context_menu->popup (1, ev->time); + return true; } - return true; + return false; } void diff --git a/gtk2_ardour/vca_time_axis.cc b/gtk2_ardour/vca_time_axis.cc index e0e2175496..31bcdf6222 100644 --- a/gtk2_ardour/vca_time_axis.cc +++ b/gtk2_ardour/vca_time_axis.cc @@ -50,6 +50,10 @@ VCATimeAxisView::VCATimeAxisView (PublicEditor& ed, Session* s, ArdourCanvas::Ca , gain_meter (s, true, 75, 14) // XXX stupid magic numbers, match sizes in RouteTimeAxisView , automation_action_menu (0) { + + controls_base_selected_name = X_("ControlMasterBaseSelected"); + controls_base_unselected_name = X_("ControlMasterBaseUnselected"); + solo_button.set_name ("solo button"); set_tooltip (solo_button, _("Solo slaves")); solo_button.signal_button_release_event().connect (sigc::mem_fun (*this, &VCATimeAxisView::solo_release), false); @@ -105,8 +109,8 @@ VCATimeAxisView::VCATimeAxisView (PublicEditor& ed, Session* s, ArdourCanvas::Ca automation_button.show (); gain_meter.get_gain_slider().show (); - controls_ebox.set_name ("ControlMasterBaseUnselected"); - time_axis_frame.set_name ("ControlMasterBaseUnselected"); + controls_ebox.set_name (controls_base_unselected_name); + time_axis_frame.set_name (controls_base_unselected_name); s->config.ParameterChanged.connect (*this, invalidator (*this), boost::bind (&VCATimeAxisView::parameter_changed, this, _1), gui_context()); Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&VCATimeAxisView::parameter_changed, this, _1), gui_context()); diff --git a/gtk2_ardour/vca_time_axis.h b/gtk2_ardour/vca_time_axis.h index 550b29b6ce..e7ea4a52de 100644 --- a/gtk2_ardour/vca_time_axis.h +++ b/gtk2_ardour/vca_time_axis.h @@ -52,7 +52,6 @@ public: void set_height (uint32_t h, TrackHeightMode m = OnlySelf); - bool selectable() const { return false; } bool marked_for_display () const; bool set_marked_for_display (bool); -- cgit v1.2.3