From af5c99dd0544b89147622b3a6af59d609b156036 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 1 Aug 2024 22:58:22 -0600 Subject: [PATCH] move definition of selection operations in to ARDOUR namespace This is a rare commit that I think should be done for GUI and libs at the same time --- gtk2_ardour/editor.cc | 10 ++-- gtk2_ardour/editor.h | 22 ++++---- gtk2_ardour/editor_actions.cc | 2 +- gtk2_ardour/editor_drag.cc | 28 +++++----- gtk2_ardour/editor_markers.cc | 2 +- gtk2_ardour/editor_mouse.cc | 24 ++++----- gtk2_ardour/editor_ops.cc | 2 +- gtk2_ardour/editor_regions.cc | 2 +- gtk2_ardour/editor_selection.cc | 96 ++++++++++++++++----------------- gtk2_ardour/editor_sources.cc | 4 +- gtk2_ardour/keyboard.cc | 8 +-- gtk2_ardour/keyboard.h | 2 +- gtk2_ardour/luainstance.cc | 8 +-- gtk2_ardour/public_editor.h | 4 +- gtk2_ardour/route_time_axis.cc | 8 +-- gtk2_ardour/selection.h | 9 +--- gtk2_ardour/time_axis_view.cc | 4 +- libs/ardour/ardour/types.h | 8 +++ 18 files changed, 123 insertions(+), 120 deletions(-) diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 2b6b8a573a..27354b9769 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -2041,8 +2041,8 @@ Editor::add_dstream_context_items (Menu_Helpers::MenuList& edit_items) MenuList& select_items = select_menu->items(); select_menu->set_name ("ArdourContextMenu"); - select_items.push_back (MenuElem (_("Select All in Track"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_in_track), Selection::Set))); - select_items.push_back (MenuElem (_("Select All Objects"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_objects), Selection::Set))); + select_items.push_back (MenuElem (_("Select All in Track"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_in_track), SelectionSet))); + select_items.push_back (MenuElem (_("Select All Objects"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_objects), SelectionSet))); select_items.push_back (MenuElem (_("Invert Selection in Track"), sigc::mem_fun(*this, &Editor::invert_selection_in_track))); select_items.push_back (MenuElem (_("Invert Selection"), sigc::mem_fun(*this, &Editor::invert_selection))); select_items.push_back (SeparatorElem()); @@ -2122,8 +2122,8 @@ Editor::add_bus_context_items (Menu_Helpers::MenuList& edit_items) MenuList& select_items = select_menu->items(); select_menu->set_name ("ArdourContextMenu"); - select_items.push_back (MenuElem (_("Select All in Track"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_in_track), Selection::Set))); - select_items.push_back (MenuElem (_("Select All Objects"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_objects), Selection::Set))); + select_items.push_back (MenuElem (_("Select All in Track"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_in_track), SelectionSet))); + select_items.push_back (MenuElem (_("Select All Objects"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_objects), SelectionSet))); select_items.push_back (MenuElem (_("Invert Selection in Track"), sigc::mem_fun(*this, &Editor::invert_selection_in_track))); select_items.push_back (MenuElem (_("Invert Selection"), sigc::mem_fun(*this, &Editor::invert_selection))); select_items.push_back (SeparatorElem()); @@ -7073,7 +7073,7 @@ Editor::mid_track_drag (GdkEventMotion* ev, Gtk::Widget& w) } if (!track_drag->track->selected()) { - set_selected_track (*track_drag->track, Selection::Set, false); + set_selected_track (*track_drag->track, SelectionSet, false); } if (!track_drag->have_predrag_cursor) { diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index bbf24a82a4..06ed3e193d 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -288,7 +288,7 @@ public: void get_regionviews_at_or_after (Temporal::timepos_t const &, RegionSelection&); - void set_selection (std::list, Selection::Operation); + void set_selection (std::list, ARDOUR::SelectionOperation); void set_selected_midi_region_view (MidiRegionView&); std::shared_ptr current_mixer_stripable () const; @@ -300,14 +300,14 @@ public: void play_with_preroll (); void rec_with_preroll (); void rec_with_count_in (); - void select_all_in_track (Selection::Operation op); - void select_all_objects (Selection::Operation op); + void select_all_in_track (ARDOUR::SelectionOperation op); + void select_all_objects (ARDOUR::SelectionOperation op); void invert_selection_in_track (); void invert_selection (); void deselect_all (); long select_range (Temporal::timepos_t const & , Temporal::timepos_t const &); - void set_selected_regionview_from_region_list (std::shared_ptr region, Selection::Operation op = Selection::Set); + void set_selected_regionview_from_region_list (std::shared_ptr region, ARDOUR::SelectionOperation op = ARDOUR::SelectionSet); void remove_tracks (); @@ -844,15 +844,15 @@ private: void catch_vanishing_regionview (RegionView*); - void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove=false); + void set_selected_track (TimeAxisView&, ARDOUR::SelectionOperation op = ARDOUR::SelectionSet, bool no_remove=false); void select_all_visible_lanes (); void select_all_tracks (); - bool select_all_internal_edit (Selection::Operation); + bool select_all_internal_edit (ARDOUR::SelectionOperation); - bool set_selected_control_point_from_click (bool press, Selection::Operation op = Selection::Set); - void set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false); - void set_selected_track_as_side_effect (Selection::Operation op, PBD::Controllable::GroupControlDisposition gcd = PBD::Controllable::UseGroup); - bool set_selected_regionview_from_click (bool press, Selection::Operation op = Selection::Set); + bool set_selected_control_point_from_click (bool press, ARDOUR::SelectionOperation op = ARDOUR::SelectionSet); + void set_selected_track_from_click (bool press, ARDOUR::SelectionOperation op = ARDOUR::SelectionSet, bool no_remove=false); + void set_selected_track_as_side_effect (ARDOUR::SelectionOperation op, PBD::Controllable::GroupControlDisposition gcd = PBD::Controllable::UseGroup); + bool set_selected_regionview_from_click (bool press, ARDOUR::SelectionOperation op = ARDOUR::SelectionSet); bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, std::weak_ptr); void collect_new_region_view (RegionView*); @@ -2171,7 +2171,7 @@ private: /* object rubberband select process */ - void select_all_within (Temporal::timepos_t const &, Temporal::timepos_t const &, double, double, TrackViewList const &, Selection::Operation, bool); + void select_all_within (Temporal::timepos_t const &, Temporal::timepos_t const &, double, double, TrackViewList const &, ARDOUR::SelectionOperation, bool); ArdourCanvas::Rectangle* rubberband_rect; diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 16ad1ab137..54675ee018 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -242,7 +242,7 @@ Editor::register_actions () reg_sens (editor_actions, "playhead-to-range-start", _("Playhead to Range Start"), sigc::bind (sigc::mem_fun(*this, &Editor::cursor_to_selection_start), _playhead_cursor)); reg_sens (editor_actions, "playhead-to-range-end", _("Playhead to Range End"), sigc::bind (sigc::mem_fun(*this, &Editor::cursor_to_selection_end), _playhead_cursor)); - reg_sens (editor_actions, "select-all-objects", _("Select All Objects"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_objects), Selection::Set)); + reg_sens (editor_actions, "select-all-objects", _("Select All Objects"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_objects), SelectionSet)); reg_sens (editor_actions, "select-loop-range", _("Set Range to Loop Range"), sigc::mem_fun(*this, &Editor::set_selection_from_loop)); reg_sens (editor_actions, "select-punch-range", _("Set Range to Punch Range"), sigc::mem_fun(*this, &Editor::set_selection_from_punch)); diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 5ea7bf8dfc..766cfc8b4c 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -4387,19 +4387,19 @@ MarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) show_view_preview ((is_start ? location->start () : location->end ()) + _video_offset); setup_snap_delta (timepos_t (is_start ? location->start () : location->end ())); - Selection::Operation op = ArdourKeyboard::selection_type (event->button.state); + SelectionOperation op = ArdourKeyboard::selection_type (event->button.state); switch (op) { - case Selection::Toggle: + case SelectionToggle: /* we toggle on the button release */ break; - case Selection::Set: + case SelectionSet: if (!_editor->selection->selected (_marker)) { _editor->selection->set (_marker); _selection_changed = true; } break; - case Selection::Extend: { + case SelectionExtend: { Locations::LocationList ll; list to_add; timepos_t s, e; @@ -4429,7 +4429,7 @@ MarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) } break; } - case Selection::Add: + case SelectionAdd: _editor->selection->add (_marker); _selection_changed = true; @@ -4643,24 +4643,24 @@ MarkerDrag::finished (GdkEvent* event, bool movement_occurred) off the selection process (and locate if appropriate) */ - Selection::Operation op = ArdourKeyboard::selection_type (event->button.state); + SelectionOperation op = ArdourKeyboard::selection_type (event->button.state); switch (op) { - case Selection::Set: + case SelectionSet: if (_editor->selection->selected (_marker) && _editor->selection->markers.size () > 1) { _editor->selection->set (_marker); _selection_changed = true; } break; - case Selection::Toggle: + case SelectionToggle: /* we toggle on the button release, click only */ _editor->selection->toggle (_marker); _selection_changed = true; break; - case Selection::Extend: - case Selection::Add: + case SelectionExtend: + case SelectionAdd: break; } @@ -5595,14 +5595,14 @@ SelectionDrag::motion (GdkEvent* event, bool first_move) if (first_move) { if (_add) { /* adding to the selection */ - _editor->set_selected_track_as_side_effect (Selection::Add, gcd); + _editor->set_selected_track_as_side_effect (SelectionAdd, gcd); _editor->clicked_selection = _editor->selection->add (start, end); _add = false; } else { /* new selection */ if (_editor->clicked_axisview && !_editor->selection->selected (_editor->clicked_axisview)) { - _editor->set_selected_track_as_side_effect (Selection::Set, gcd); + _editor->set_selected_track_as_side_effect (SelectionSet, gcd); } _editor->clicked_selection = _editor->selection->set (start, end); @@ -6099,7 +6099,7 @@ RangeMarkerBarDrag::finished (GdkEvent* event, bool movement_occurred) switch (_editor->mouse_mode) { case MouseObject: /* find the two markers on either side and then make the selection from it */ - _editor->select_all_within (start, end, 0.0f, FLT_MAX, _editor->track_views, Selection::Set, false); + _editor->select_all_within (start, end, 0.0f, FLT_MAX, _editor->track_views, SelectionSet, false); break; case MouseRange: @@ -6782,7 +6782,7 @@ EditorRubberbandSelectDrag::select_things (int button_state, timepos_t const& x1 return; } - Selection::Operation op = ArdourKeyboard::selection_type (button_state); + SelectionOperation op = ArdourKeyboard::selection_type (button_state); _editor->begin_reversible_selection_op (X_("rubberband selection")); diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index 571135dc0f..2d51b0165c 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -1367,7 +1367,7 @@ Editor::marker_menu_select_all_selectables_using_range () bool is_start; if (((l = find_location_from_marker (marker, is_start)) != 0) && (l->end() > l->start())) { - select_all_within (l->start(), l->end(), 0, DBL_MAX, track_views, Selection::Set, false); + select_all_within (l->start(), l->end(), 0, DBL_MAX, track_views, SelectionSet, false); } } diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 493e0c6a37..050e670ed5 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -554,7 +554,7 @@ Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType it } } - Selection::Operation op = ArdourKeyboard::selection_type (event->button.state); + SelectionOperation op = ArdourKeyboard::selection_type (event->button.state); bool press = (event->type == GDK_BUTTON_PRESS); if (press) { @@ -575,7 +575,7 @@ Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType it * so, "collapse" the selection to just this track */ if (!selection->selected (clicked_axisview)) { - set_selected_track_as_side_effect (Selection::Set); + set_selected_track_as_side_effect (SelectionSet); } } } else { @@ -611,7 +611,7 @@ Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType it if (event->button.button != 3) { _mouse_changed_selection |= set_selected_control_point_from_click (press, op); } else { - _mouse_changed_selection |= set_selected_control_point_from_click (press, Selection::Set); + _mouse_changed_selection |= set_selected_control_point_from_click (press, SelectionSet); } } break; @@ -632,26 +632,26 @@ Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType it selectables.push_back (argl->nth (after)); switch (op) { - case Selection::Set: + case SelectionSet: if (press) { selection->set (selectables); _mouse_changed_selection = true; } break; - case Selection::Add: + case SelectionAdd: if (press) { selection->add (selectables); _mouse_changed_selection = true; } break; - case Selection::Toggle: + case SelectionToggle: if (press) { selection->toggle (selectables); _mouse_changed_selection = true; } break; - case Selection::Extend: + case SelectionExtend: /* XXX */ break; } @@ -678,26 +678,26 @@ Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType it selectables.push_back (al->nth (after)); switch (op) { - case Selection::Set: + case SelectionSet: if (press) { selection->set (selectables); _mouse_changed_selection = true; } break; - case Selection::Add: + case SelectionAdd: if (press) { selection->add (selectables); _mouse_changed_selection = true; } break; - case Selection::Toggle: + case SelectionToggle: if (press) { selection->toggle (selectables); _mouse_changed_selection = true; } break; - case Selection::Extend: + case SelectionExtend: /* XXX */ break; } @@ -717,7 +717,7 @@ Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType it break; case AutomationTrackItem: - if (eff_mouse_mode != MouseDraw && op == Selection::Set) { + if (eff_mouse_mode != MouseDraw && op == SelectionSet) { set_selected_track_as_side_effect (op); } break; diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 2c0293e662..a0d7684457 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -8028,7 +8028,7 @@ Editor::split_region_at_points (std::shared_ptr r, AnalysisFeatureList& if (select_new) { for (list >::iterator i = new_regions.begin(); i != new_regions.end(); ++i){ - set_selected_regionview_from_region_list ((*i), Selection::Add); + set_selected_regionview_from_region_list ((*i), SelectionAdd); } } } diff --git a/gtk2_ardour/editor_regions.cc b/gtk2_ardour/editor_regions.cc index 21d6c10ac0..e069daf6af 100644 --- a/gtk2_ardour/editor_regions.cc +++ b/gtk2_ardour/editor_regions.cc @@ -124,7 +124,7 @@ EditorRegions::selection_changed () if (region) { _change_connection.block (true); - _editor->set_selected_regionview_from_region_list (region, Selection::Add); + _editor->set_selected_regionview_from_region_list (region, SelectionAdd); _change_connection.block (false); } } diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc index b52c8ca716..33852d60a9 100644 --- a/gtk2_ardour/editor_selection.cc +++ b/gtk2_ardour/editor_selection.cc @@ -206,7 +206,7 @@ Editor::select_all_visible_lanes () * tracks, in which case nothing will happen unless `force' is true. */ void -Editor::set_selected_track_as_side_effect (Selection::Operation op, Controllable::GroupControlDisposition gcd) +Editor::set_selected_track_as_side_effect (SelectionOperation op, Controllable::GroupControlDisposition gcd) { if (!clicked_axisview) { return; @@ -220,7 +220,7 @@ Editor::set_selected_track_as_side_effect (Selection::Operation op, Controllable } switch (op) { - case Selection::Toggle: + case SelectionToggle: if (selection->selected (clicked_axisview)) { if (group && group->is_active() && group->enabled_property(ARDOUR::Properties::group_select.property_id)) { for (TrackViewList::iterator i = track_views.begin(); i != track_views.end (); ++i) { @@ -244,7 +244,7 @@ Editor::set_selected_track_as_side_effect (Selection::Operation op, Controllable } break; - case Selection::Add: + case SelectionAdd: if (group && group->is_active() && group->enabled_property(ARDOUR::Properties::group_select.property_id)) { for (TrackViewList::iterator i = track_views.begin(); i != track_views.end (); ++i) { if ((*i)->route_group() == group && gcd != Controllable::NoGroup) { @@ -256,7 +256,7 @@ Editor::set_selected_track_as_side_effect (Selection::Operation op, Controllable } break; - case Selection::Set: + case SelectionSet: selection->clear(); if (group && group->is_active() && group->enabled_property(ARDOUR::Properties::group_select.property_id)) { for (TrackViewList::iterator i = track_views.begin(); i != track_views.end (); ++i) { @@ -269,19 +269,19 @@ Editor::set_selected_track_as_side_effect (Selection::Operation op, Controllable } break; - case Selection::Extend: + case SelectionExtend: selection->clear(); break; } } void -Editor::set_selected_track (TimeAxisView& view, Selection::Operation op, bool no_remove) +Editor::set_selected_track (TimeAxisView& view, SelectionOperation op, bool no_remove) { begin_reversible_selection_op (X_("Set Selected Track")); switch (op) { - case Selection::Toggle: + case SelectionToggle: if (selection->selected (&view)) { if (!no_remove) { selection->remove (&view); @@ -291,15 +291,15 @@ Editor::set_selected_track (TimeAxisView& view, Selection::Operation op, bool no } break; - case Selection::Add: + case SelectionAdd: selection->add (&view); break; - case Selection::Set: + case SelectionSet: selection->set (&view); break; - case Selection::Extend: + case SelectionExtend: extend_selection_to_track (view); break; } @@ -308,7 +308,7 @@ Editor::set_selected_track (TimeAxisView& view, Selection::Operation op, bool no } void -Editor::set_selected_track_from_click (bool press, Selection::Operation op, bool no_remove) +Editor::set_selected_track_from_click (bool press, SelectionOperation op, bool no_remove) { if (!clicked_routeview) { return; @@ -322,7 +322,7 @@ Editor::set_selected_track_from_click (bool press, Selection::Operation op, bool } bool -Editor::set_selected_control_point_from_click (bool press, Selection::Operation op) +Editor::set_selected_control_point_from_click (bool press, SelectionOperation op) { if (!clicked_control_point) { return false; @@ -331,7 +331,7 @@ Editor::set_selected_control_point_from_click (bool press, Selection::Operation bool ret = false; switch (op) { - case Selection::Set: + case SelectionSet: if (!selection->selected (clicked_control_point)) { selection->set (clicked_control_point); ret = true; @@ -348,13 +348,13 @@ Editor::set_selected_control_point_from_click (bool press, Selection::Operation } break; - case Selection::Add: + case SelectionAdd: if (press) { selection->add (clicked_control_point); ret = true; } break; - case Selection::Toggle: + case SelectionToggle: /* This is a bit of a hack; if we Primary-Click-Drag a control point (for push drag) we want the point we clicked on to be @@ -380,7 +380,7 @@ Editor::set_selected_control_point_from_click (bool press, Selection::Operation _control_point_toggled_on_press = false; } break; - case Selection::Extend: + case SelectionExtend: /* XXX */ break; } @@ -657,7 +657,7 @@ Editor::get_equivalent_regions (RegionSelection & basis, PBD::PropertyID prop) c } bool -Editor::set_selected_regionview_from_click (bool press, Selection::Operation op) +Editor::set_selected_regionview_from_click (bool press, SelectionOperation op) { vector all_equivalent_regions; bool commit = false; @@ -670,10 +670,10 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op) button_release_can_deselect = false; } - if (op == Selection::Toggle || op == Selection::Set) { + if (op == SelectionToggle || op == SelectionSet) { switch (op) { - case Selection::Toggle: + case SelectionToggle: if (selection->selected (clicked_regionview)) { if (press) { @@ -733,7 +733,7 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op) } break; - case Selection::Set: + case SelectionSet: if (!selection->selected (clicked_regionview)) { if (should_ripple_all()) { get_all_equivalent_regions (clicked_regionview, all_equivalent_regions); @@ -766,7 +766,7 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op) break; } - } else if (op == Selection::Extend) { + } else if (op == SelectionExtend) { list results; timepos_t last_pos; @@ -1020,23 +1020,23 @@ Editor::set_selected_midi_region_view (MidiRegionView& mrv) } void -Editor::set_selection (std::list s, Selection::Operation op) +Editor::set_selection (std::list s, SelectionOperation op) { if (s.empty()) { return; } begin_reversible_selection_op (X_("set selection")); switch (op) { - case Selection::Toggle: + case SelectionToggle: selection->toggle (s); break; - case Selection::Set: + case SelectionSet: selection->set (s); break; - case Selection::Extend: + case SelectionExtend: selection->add (s); break; - case Selection::Add: + case SelectionAdd: selection->add (s); break; } @@ -1045,7 +1045,7 @@ Editor::set_selection (std::list s, Selection::Operation op) } void -Editor::set_selected_regionview_from_region_list (std::shared_ptr region, Selection::Operation op) +Editor::set_selected_regionview_from_region_list (std::shared_ptr region, SelectionOperation op) { vector regionviews; @@ -1058,17 +1058,17 @@ Editor::set_selected_regionview_from_region_list (std::shared_ptr region begin_reversible_selection_op (X_("set selected regions")); switch (op) { - case Selection::Toggle: + case SelectionToggle: /* XXX this is not correct */ selection->toggle (regionviews); break; - case Selection::Set: + case SelectionSet: selection->set (regionviews); break; - case Selection::Extend: + case SelectionExtend: selection->add (regionviews); break; - case Selection::Add: + case SelectionAdd: selection->add (regionviews); break; } @@ -1754,7 +1754,7 @@ Editor::point_selection_changed () } void -Editor::select_all_in_track (Selection::Operation op) +Editor::select_all_in_track (SelectionOperation op) { list touched; @@ -1767,16 +1767,16 @@ Editor::select_all_in_track (Selection::Operation op) clicked_routeview->get_selectables (timepos_t(), timepos_t::max (Temporal::AudioTime), 0, DBL_MAX, touched); switch (op) { - case Selection::Toggle: + case SelectionToggle: selection->add (touched); break; - case Selection::Set: + case SelectionSet: selection->set (touched); break; - case Selection::Extend: + case SelectionExtend: /* meaningless, because we're selecting everything */ break; - case Selection::Add: + case SelectionAdd: selection->add (touched); break; } @@ -1785,7 +1785,7 @@ Editor::select_all_in_track (Selection::Operation op) } bool -Editor::select_all_internal_edit (Selection::Operation) +Editor::select_all_internal_edit (SelectionOperation) { bool selected = false; @@ -1809,7 +1809,7 @@ Editor::select_all_internal_edit (Selection::Operation) } void -Editor::select_all_objects (Selection::Operation op) +Editor::select_all_objects (SelectionOperation op) { list touched; @@ -1834,16 +1834,16 @@ Editor::select_all_objects (Selection::Operation op) begin_reversible_selection_op (X_("select all")); switch (op) { - case Selection::Add: + case SelectionAdd: selection->add (touched); break; - case Selection::Toggle: + case SelectionToggle: selection->toggle (touched); break; - case Selection::Set: + case SelectionSet: selection->set (touched); break; - case Selection::Extend: + case SelectionExtend: /* meaningless, because we're selecting everything */ break; } @@ -1919,7 +1919,7 @@ Editor::invert_selection () * within the region are already selected. */ void -Editor::select_all_within (timepos_t const & start, timepos_t const & end, double top, double bot, const TrackViewList& tracklist, Selection::Operation op, bool preserve_if_selected) +Editor::select_all_within (timepos_t const & start, timepos_t const & end, double top, double bot, const TrackViewList& tracklist, SelectionOperation op, bool preserve_if_selected) { list found; @@ -1938,7 +1938,7 @@ Editor::select_all_within (timepos_t const & start, timepos_t const & end, doubl return; } - if (preserve_if_selected && op != Selection::Toggle) { + if (preserve_if_selected && op != SelectionToggle) { list::iterator i = found.begin(); while (i != found.end() && (*i)->selected()) { ++i; @@ -1951,16 +1951,16 @@ Editor::select_all_within (timepos_t const & start, timepos_t const & end, doubl begin_reversible_selection_op (X_("select all within")); switch (op) { - case Selection::Add: + case SelectionAdd: selection->add (found); break; - case Selection::Toggle: + case SelectionToggle: selection->toggle (found); break; - case Selection::Set: + case SelectionSet: selection->set (found); break; - case Selection::Extend: + case SelectionExtend: /* not defined yet */ break; } diff --git a/gtk2_ardour/editor_sources.cc b/gtk2_ardour/editor_sources.cc index 901c24bd24..dfeebc1a86 100644 --- a/gtk2_ardour/editor_sources.cc +++ b/gtk2_ardour/editor_sources.cc @@ -125,7 +125,7 @@ EditorSources::selection_changed () for (set>::iterator region = regions.begin (); region != regions.end (); region++) { _change_connection.block (true); - _editor->set_selected_regionview_from_region_list (*region, Selection::Add); + _editor->set_selected_regionview_from_region_list (*region, SelectionAdd); _change_connection.block (false); } } @@ -228,7 +228,7 @@ EditorSources::remove_selected_sources () * (Source::drop_references -> Region::source_deleted, * -> Region::drop_references). see f58f5bef55a5aa1 */ - _editor->set_selected_regionview_from_region_list (region, Selection::Add); + _editor->set_selected_regionview_from_region_list (region, SelectionAdd); _change_connection.block (false); } diff --git a/gtk2_ardour/keyboard.cc b/gtk2_ardour/keyboard.cc index 7ba165ab95..b323fabb1c 100644 --- a/gtk2_ardour/keyboard.cc +++ b/gtk2_ardour/keyboard.cc @@ -361,16 +361,16 @@ ArdourKeyboard::set_note_size_relative_modifier (guint mod) the_keyboard().reset_relevant_modifier_key_mask(); } -Selection::Operation +SelectionOperation ArdourKeyboard::selection_type (guint state) { /* note that there is no modifier for "Add" */ if (modifier_state_equals (state, RangeSelectModifier)) { - return Selection::Extend; + return SelectionExtend; } else if (modifier_state_equals (state, PrimaryModifier)) { - return Selection::Toggle; + return SelectionToggle; } else { - return Selection::Set; + return SelectionSet; } } diff --git a/gtk2_ardour/keyboard.h b/gtk2_ardour/keyboard.h index 53aaff721b..8b5d6ac0fb 100644 --- a/gtk2_ardour/keyboard.h +++ b/gtk2_ardour/keyboard.h @@ -43,7 +43,7 @@ public: void setup_keybindings (); - static Selection::Operation selection_type (guint state); + static ARDOUR::SelectionOperation selection_type (guint state); ARDOUR_UI& ui; diff --git a/gtk2_ardour/luainstance.cc b/gtk2_ardour/luainstance.cc index f9ffb3c363..b1301d8ef9 100644 --- a/gtk2_ardour/luainstance.cc +++ b/gtk2_ardour/luainstance.cc @@ -1082,10 +1082,10 @@ LuaInstance::register_classes (lua_State* L, bool sandbox) .endNamespace () .beginNamespace ("SelectionOp") - .addConst ("Toggle", Selection::Operation(Selection::Toggle)) - .addConst ("Set", Selection::Operation(Selection::Set)) - .addConst ("Extend", Selection::Operation(Selection::Extend)) - .addConst ("Add", Selection::Operation(Selection::Add)) + .addConst ("Toggle", SelectionOperation(SelectionToggle)) + .addConst ("Set", SelectionOperation(SelectionSet)) + .addConst ("Extend", SelectionOperation(SelectionExtend)) + .addConst ("Add", SelectionOperation(SelectionAdd)) .endNamespace () .beginNamespace ("TrackHeightMode") diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index 028047ccac..f41d5b1e9a 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -239,7 +239,7 @@ public: virtual bool get_selection_extents (Temporal::timepos_t &start, Temporal::timepos_t &end) const = 0; virtual Selection& get_cut_buffer () const = 0; - virtual void set_selection (std::list, Selection::Operation) = 0; + virtual void set_selection (std::list, ARDOUR::SelectionOperation) = 0; virtual void set_selected_midi_region_view (MidiRegionView&) = 0; virtual std::shared_ptr current_mixer_stripable () const = 0; @@ -349,7 +349,7 @@ public: virtual void select_all_tracks () = 0; virtual void deselect_all () = 0; virtual void invert_selection () = 0; - virtual void set_selected_track (TimeAxisView&, Selection::Operation op = Selection::Set, bool no_remove = false) = 0; + virtual void set_selected_track (TimeAxisView&, ARDOUR::SelectionOperation op = ARDOUR::SelectionSet, bool no_remove = false) = 0; virtual void set_selected_mixer_strip (TimeAxisView&) = 0; virtual void hide_track_in_display (TimeAxisView* tv, bool apply_to_selection = false) = 0; virtual void show_track_in_display (TimeAxisView* tv, bool move_into_view = false) = 0; diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 57eb44a0f4..91230ac859 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -1145,19 +1145,19 @@ RouteTimeAxisView::selection_click (GdkEventButton* ev) _editor.begin_reversible_selection_op (X_("Selection Click")); switch (ArdourKeyboard::selection_type (ev->state)) { - case Selection::Toggle: + case SelectionToggle: _editor.get_selection().toggle (this); break; - case Selection::Set: + case SelectionSet: _editor.get_selection().set (this); break; - case Selection::Extend: + case SelectionExtend: _editor.extend_selection_to_track (*this); break; - case Selection::Add: + case SelectionAdd: _editor.get_selection().add (this); break; } diff --git a/gtk2_ardour/selection.h b/gtk2_ardour/selection.h index c1a76b143c..eb55615869 100644 --- a/gtk2_ardour/selection.h +++ b/gtk2_ardour/selection.h @@ -34,6 +34,8 @@ #include "pbd/signals.h" +#include "ardour/types.h" + #include "time_selection.h" #include "region_selection.h" #include "track_selection.h" @@ -78,13 +80,6 @@ public: Range = 0x2 }; - enum Operation { - Set, - Add, - Toggle, - Extend - }; - TrackSelection tracks; RegionSelection regions; TimeSelection time; diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index a7f066a53f..ef56e368d0 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -597,7 +597,7 @@ TimeAxisView::controls_ebox_button_release (GdkEventButton* ev) void TimeAxisView::selection_click (GdkEventButton* ev) { - Selection::Operation op = ArdourKeyboard::selection_type (ev->state); + SelectionOperation op = ArdourKeyboard::selection_type (ev->state); _editor.set_selected_track (*this, op, false); } @@ -805,7 +805,7 @@ TimeAxisView::conditionally_add_to_selection () Selection& s (_editor.get_selection ()); if (!s.selected (this)) { - _editor.set_selected_track (*this, Selection::Set); + _editor.set_selected_track (*this, SelectionSet); } } diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index 1a617cffa8..c050bac05c 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -975,6 +975,14 @@ struct ProcessedRanges { ProcessedRanges() : start { 0, 0 }, end { 0, 0 }, cnt (0) {} }; +enum SelectionOperation { + SelectionSet, + SelectionAdd, + SelectionToggle, + SelectionExtend +}; + + } // namespace ARDOUR /* for now, break the rules and use "using" to make this "global" */