Allow to select VCAs
authorRobin Gareus <robin@gareus.org>
Sun, 6 Aug 2017 16:37:15 +0000 (18:37 +0200)
committerRobin Gareus <robin@gareus.org>
Sun, 6 Aug 2017 20:17:42 +0000 (22:17 +0200)
gtk2_ardour/clearlooks.rc.in
gtk2_ardour/editor.h
gtk2_ardour/editor_actions.cc
gtk2_ardour/editor_ops.cc
gtk2_ardour/editor_routes.cc
gtk2_ardour/mixer_ui.cc
gtk2_ardour/mixer_ui.h
gtk2_ardour/selection.cc
gtk2_ardour/vca_master_strip.cc
gtk2_ardour/vca_time_axis.cc
gtk2_ardour/vca_time_axis.h

index 9792028f0dc708aeaf347c48dbfd567e4cee1301..11f39ca67c3edfae2aa479bedf79f5e3762331c6 100644 (file)
@@ -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"
index e5b231aa0f1ffbac9449b455b9cdd92d2052730a..a2e3aacfa2cd0e99ae134f9674287a4b627d2573 100644 (file)
@@ -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,
index 9fc9361bd2cf1cc568d6b97bda98149a6d58285c..67ccd86eeec897c7d855ca68050b2366bc21fb8f 100644 (file)
@@ -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);
index 414768f2f1ee58c3c49a6e9d95e1bd1d8078b221..9737d2cc3d1843f0d7ecc12c81b9cf1531f33f4b 100644 (file)
@@ -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<RouteUI *>(current);
+               if (routes_only) {
+                       RouteUI* rui = dynamic_cast<RouteUI *>(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<RouteUI *>(current);
+               if (routes_only) {
+                       RouteUI* rui = dynamic_cast<RouteUI *>(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);
 
index c64683c341de566811b7e07b4c0f5266a5852a93..dee4ef80029b91eaf5675972a8ad50c12a3f075d 100644 (file)
@@ -1463,9 +1463,6 @@ EditorRoutes::selection_filter (Glib::RefPtr<TreeModel> const& model, TreeModel:
        TreeModel::iterator iter = model->get_iter (path);
        if (iter) {
                boost::shared_ptr<Stripable> stripable = (*iter)[_columns.stripable];
-               if (boost::dynamic_pointer_cast<VCA> (stripable)) {
-                       return false;
-               }
        }
 
        return true;
index d982e5a30142f72e57a88b08c14afbcfbcced823..047104ac71ee22c7e141f1c02f894ffa43754018 100644 (file)
@@ -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<Route> (*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<VCAMasterStrip*> (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<Stripable> 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<VCAMasterStrip*> (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)
 {
index 9485ea252fae12d8f634bb95d9e07895bbfdf5f6..d0a051dfce6603b6280f84614165b8b7a22af83f 100644 (file)
@@ -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;
 
index 7a9e0e3ad8e17671c9243ad627e1c9a02eaf3e75..1e89e0887983d2812fcd52a92439f14c674a5a5c 100644 (file)
@@ -1462,10 +1462,6 @@ Selection::toggle (const TrackViewList& track_list)
 void
 Selection::toggle (TimeAxisView* track)
 {
-       if (dynamic_cast<VCATimeAxisView*> (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<VCATimeAxisView*> (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<VCATimeAxisView*> (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<VCATimeAxisView*> (track)) {
-               return;
-       }
-
        TrackViewList tvl;
        tvl.push_back (track);
        set (tvl);
index 4c72b0b62477a1d4558a5d78bc593eb7dd0c16d8..eacc1a0ecd3844c63f7497e9a1d698cfbe9bada6 100644 (file)
@@ -97,7 +97,7 @@ VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr<VCA> 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
index e0e2175496fffe2db436b78ad7abe323d9a963c0..31bcdf62228aad50b801cf442097f1f7ff4baad9 100644 (file)
@@ -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());
index 550b29b6ce19314d710408c8eb5ff8ae8d0699e0..e7ea4a52de27f0a7e04766079729cd23df3801a3 100644 (file)
@@ -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);