13
0

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
This commit is contained in:
Paul Davis 2024-08-01 22:58:22 -06:00
parent 0f4fb04344
commit af5c99dd05
18 changed files with 123 additions and 120 deletions

View File

@ -2041,8 +2041,8 @@ Editor::add_dstream_context_items (Menu_Helpers::MenuList& edit_items)
MenuList& select_items = select_menu->items(); MenuList& select_items = select_menu->items();
select_menu->set_name ("ArdourContextMenu"); 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 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), Selection::Set))); 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 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 (MenuElem (_("Invert Selection"), sigc::mem_fun(*this, &Editor::invert_selection)));
select_items.push_back (SeparatorElem()); 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(); MenuList& select_items = select_menu->items();
select_menu->set_name ("ArdourContextMenu"); 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 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), Selection::Set))); 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 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 (MenuElem (_("Invert Selection"), sigc::mem_fun(*this, &Editor::invert_selection)));
select_items.push_back (SeparatorElem()); select_items.push_back (SeparatorElem());
@ -7073,7 +7073,7 @@ Editor::mid_track_drag (GdkEventMotion* ev, Gtk::Widget& w)
} }
if (!track_drag->track->selected()) { 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) { if (!track_drag->have_predrag_cursor) {

View File

@ -288,7 +288,7 @@ public:
void get_regionviews_at_or_after (Temporal::timepos_t const &, RegionSelection&); void get_regionviews_at_or_after (Temporal::timepos_t const &, RegionSelection&);
void set_selection (std::list<Selectable*>, Selection::Operation); void set_selection (std::list<Selectable*>, ARDOUR::SelectionOperation);
void set_selected_midi_region_view (MidiRegionView&); void set_selected_midi_region_view (MidiRegionView&);
std::shared_ptr<ARDOUR::Route> current_mixer_stripable () const; std::shared_ptr<ARDOUR::Route> current_mixer_stripable () const;
@ -300,14 +300,14 @@ public:
void play_with_preroll (); void play_with_preroll ();
void rec_with_preroll (); void rec_with_preroll ();
void rec_with_count_in (); void rec_with_count_in ();
void select_all_in_track (Selection::Operation op); void select_all_in_track (ARDOUR::SelectionOperation op);
void select_all_objects (Selection::Operation op); void select_all_objects (ARDOUR::SelectionOperation op);
void invert_selection_in_track (); void invert_selection_in_track ();
void invert_selection (); void invert_selection ();
void deselect_all (); void deselect_all ();
long select_range (Temporal::timepos_t const & , Temporal::timepos_t const &); long select_range (Temporal::timepos_t const & , Temporal::timepos_t const &);
void set_selected_regionview_from_region_list (std::shared_ptr<ARDOUR::Region> region, Selection::Operation op = Selection::Set); void set_selected_regionview_from_region_list (std::shared_ptr<ARDOUR::Region> region, ARDOUR::SelectionOperation op = ARDOUR::SelectionSet);
void remove_tracks (); void remove_tracks ();
@ -844,15 +844,15 @@ private:
void catch_vanishing_regionview (RegionView*); 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_visible_lanes ();
void select_all_tracks (); 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); bool set_selected_control_point_from_click (bool press, ARDOUR::SelectionOperation op = ARDOUR::SelectionSet);
void set_selected_track_from_click (bool press, Selection::Operation op = Selection::Set, bool no_remove=false); void set_selected_track_from_click (bool press, ARDOUR::SelectionOperation op = ARDOUR::SelectionSet, bool no_remove=false);
void set_selected_track_as_side_effect (Selection::Operation op, PBD::Controllable::GroupControlDisposition gcd = PBD::Controllable::UseGroup); 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, Selection::Operation op = Selection::Set); 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<ARDOUR::Region>); bool set_selected_regionview_from_map_event (GdkEventAny*, StreamView*, std::weak_ptr<ARDOUR::Region>);
void collect_new_region_view (RegionView*); void collect_new_region_view (RegionView*);
@ -2171,7 +2171,7 @@ private:
/* object rubberband select process */ /* 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; ArdourCanvas::Rectangle* rubberband_rect;

View File

@ -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-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, "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-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)); reg_sens (editor_actions, "select-punch-range", _("Set Range to Punch Range"), sigc::mem_fun(*this, &Editor::set_selection_from_punch));

View File

@ -4387,19 +4387,19 @@ MarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
show_view_preview ((is_start ? location->start () : location->end ()) + _video_offset); show_view_preview ((is_start ? location->start () : location->end ()) + _video_offset);
setup_snap_delta (timepos_t (is_start ? location->start () : location->end ())); 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) { switch (op) {
case Selection::Toggle: case SelectionToggle:
/* we toggle on the button release */ /* we toggle on the button release */
break; break;
case Selection::Set: case SelectionSet:
if (!_editor->selection->selected (_marker)) { if (!_editor->selection->selected (_marker)) {
_editor->selection->set (_marker); _editor->selection->set (_marker);
_selection_changed = true; _selection_changed = true;
} }
break; break;
case Selection::Extend: { case SelectionExtend: {
Locations::LocationList ll; Locations::LocationList ll;
list<ArdourMarker*> to_add; list<ArdourMarker*> to_add;
timepos_t s, e; timepos_t s, e;
@ -4429,7 +4429,7 @@ MarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
} }
break; break;
} }
case Selection::Add: case SelectionAdd:
_editor->selection->add (_marker); _editor->selection->add (_marker);
_selection_changed = true; _selection_changed = true;
@ -4643,24 +4643,24 @@ MarkerDrag::finished (GdkEvent* event, bool movement_occurred)
off the selection process (and locate if appropriate) 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) { switch (op) {
case Selection::Set: case SelectionSet:
if (_editor->selection->selected (_marker) && _editor->selection->markers.size () > 1) { if (_editor->selection->selected (_marker) && _editor->selection->markers.size () > 1) {
_editor->selection->set (_marker); _editor->selection->set (_marker);
_selection_changed = true; _selection_changed = true;
} }
break; break;
case Selection::Toggle: case SelectionToggle:
/* we toggle on the button release, click only */ /* we toggle on the button release, click only */
_editor->selection->toggle (_marker); _editor->selection->toggle (_marker);
_selection_changed = true; _selection_changed = true;
break; break;
case Selection::Extend: case SelectionExtend:
case Selection::Add: case SelectionAdd:
break; break;
} }
@ -5595,14 +5595,14 @@ SelectionDrag::motion (GdkEvent* event, bool first_move)
if (first_move) { if (first_move) {
if (_add) { if (_add) {
/* adding to the selection */ /* 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); _editor->clicked_selection = _editor->selection->add (start, end);
_add = false; _add = false;
} else { } else {
/* new selection */ /* new selection */
if (_editor->clicked_axisview && !_editor->selection->selected (_editor->clicked_axisview)) { 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); _editor->clicked_selection = _editor->selection->set (start, end);
@ -6099,7 +6099,7 @@ RangeMarkerBarDrag::finished (GdkEvent* event, bool movement_occurred)
switch (_editor->mouse_mode) { switch (_editor->mouse_mode) {
case MouseObject: case MouseObject:
/* find the two markers on either side and then make the selection from it */ /* 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; break;
case MouseRange: case MouseRange:
@ -6782,7 +6782,7 @@ EditorRubberbandSelectDrag::select_things (int button_state, timepos_t const& x1
return; return;
} }
Selection::Operation op = ArdourKeyboard::selection_type (button_state); SelectionOperation op = ArdourKeyboard::selection_type (button_state);
_editor->begin_reversible_selection_op (X_("rubberband selection")); _editor->begin_reversible_selection_op (X_("rubberband selection"));

View File

@ -1367,7 +1367,7 @@ Editor::marker_menu_select_all_selectables_using_range ()
bool is_start; bool is_start;
if (((l = find_location_from_marker (marker, is_start)) != 0) && (l->end() > l->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);
} }
} }

View File

@ -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); bool press = (event->type == GDK_BUTTON_PRESS);
if (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 * so, "collapse" the selection to just this track
*/ */
if (!selection->selected (clicked_axisview)) { if (!selection->selected (clicked_axisview)) {
set_selected_track_as_side_effect (Selection::Set); set_selected_track_as_side_effect (SelectionSet);
} }
} }
} else { } else {
@ -611,7 +611,7 @@ Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType it
if (event->button.button != 3) { if (event->button.button != 3) {
_mouse_changed_selection |= set_selected_control_point_from_click (press, op); _mouse_changed_selection |= set_selected_control_point_from_click (press, op);
} else { } 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; break;
@ -632,26 +632,26 @@ Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType it
selectables.push_back (argl->nth (after)); selectables.push_back (argl->nth (after));
switch (op) { switch (op) {
case Selection::Set: case SelectionSet:
if (press) { if (press) {
selection->set (selectables); selection->set (selectables);
_mouse_changed_selection = true; _mouse_changed_selection = true;
} }
break; break;
case Selection::Add: case SelectionAdd:
if (press) { if (press) {
selection->add (selectables); selection->add (selectables);
_mouse_changed_selection = true; _mouse_changed_selection = true;
} }
break; break;
case Selection::Toggle: case SelectionToggle:
if (press) { if (press) {
selection->toggle (selectables); selection->toggle (selectables);
_mouse_changed_selection = true; _mouse_changed_selection = true;
} }
break; break;
case Selection::Extend: case SelectionExtend:
/* XXX */ /* XXX */
break; break;
} }
@ -678,26 +678,26 @@ Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType it
selectables.push_back (al->nth (after)); selectables.push_back (al->nth (after));
switch (op) { switch (op) {
case Selection::Set: case SelectionSet:
if (press) { if (press) {
selection->set (selectables); selection->set (selectables);
_mouse_changed_selection = true; _mouse_changed_selection = true;
} }
break; break;
case Selection::Add: case SelectionAdd:
if (press) { if (press) {
selection->add (selectables); selection->add (selectables);
_mouse_changed_selection = true; _mouse_changed_selection = true;
} }
break; break;
case Selection::Toggle: case SelectionToggle:
if (press) { if (press) {
selection->toggle (selectables); selection->toggle (selectables);
_mouse_changed_selection = true; _mouse_changed_selection = true;
} }
break; break;
case Selection::Extend: case SelectionExtend:
/* XXX */ /* XXX */
break; break;
} }
@ -717,7 +717,7 @@ Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType it
break; break;
case AutomationTrackItem: case AutomationTrackItem:
if (eff_mouse_mode != MouseDraw && op == Selection::Set) { if (eff_mouse_mode != MouseDraw && op == SelectionSet) {
set_selected_track_as_side_effect (op); set_selected_track_as_side_effect (op);
} }
break; break;

View File

@ -8028,7 +8028,7 @@ Editor::split_region_at_points (std::shared_ptr<Region> r, AnalysisFeatureList&
if (select_new) { if (select_new) {
for (list<std::shared_ptr<Region> >::iterator i = new_regions.begin(); i != new_regions.end(); ++i){ for (list<std::shared_ptr<Region> >::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);
} }
} }
} }

View File

@ -124,7 +124,7 @@ EditorRegions::selection_changed ()
if (region) { if (region) {
_change_connection.block (true); _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); _change_connection.block (false);
} }
} }

View File

@ -206,7 +206,7 @@ Editor::select_all_visible_lanes ()
* tracks, in which case nothing will happen unless `force' is true. * tracks, in which case nothing will happen unless `force' is true.
*/ */
void 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) { if (!clicked_axisview) {
return; return;
@ -220,7 +220,7 @@ Editor::set_selected_track_as_side_effect (Selection::Operation op, Controllable
} }
switch (op) { switch (op) {
case Selection::Toggle: case SelectionToggle:
if (selection->selected (clicked_axisview)) { if (selection->selected (clicked_axisview)) {
if (group && group->is_active() && group->enabled_property(ARDOUR::Properties::group_select.property_id)) { 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) { 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; break;
case Selection::Add: case SelectionAdd:
if (group && group->is_active() && group->enabled_property(ARDOUR::Properties::group_select.property_id)) { 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) { for (TrackViewList::iterator i = track_views.begin(); i != track_views.end (); ++i) {
if ((*i)->route_group() == group && gcd != Controllable::NoGroup) { if ((*i)->route_group() == group && gcd != Controllable::NoGroup) {
@ -256,7 +256,7 @@ Editor::set_selected_track_as_side_effect (Selection::Operation op, Controllable
} }
break; break;
case Selection::Set: case SelectionSet:
selection->clear(); selection->clear();
if (group && group->is_active() && group->enabled_property(ARDOUR::Properties::group_select.property_id)) { 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) { 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; break;
case Selection::Extend: case SelectionExtend:
selection->clear(); selection->clear();
break; break;
} }
} }
void 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")); begin_reversible_selection_op (X_("Set Selected Track"));
switch (op) { switch (op) {
case Selection::Toggle: case SelectionToggle:
if (selection->selected (&view)) { if (selection->selected (&view)) {
if (!no_remove) { if (!no_remove) {
selection->remove (&view); selection->remove (&view);
@ -291,15 +291,15 @@ Editor::set_selected_track (TimeAxisView& view, Selection::Operation op, bool no
} }
break; break;
case Selection::Add: case SelectionAdd:
selection->add (&view); selection->add (&view);
break; break;
case Selection::Set: case SelectionSet:
selection->set (&view); selection->set (&view);
break; break;
case Selection::Extend: case SelectionExtend:
extend_selection_to_track (view); extend_selection_to_track (view);
break; break;
} }
@ -308,7 +308,7 @@ Editor::set_selected_track (TimeAxisView& view, Selection::Operation op, bool no
} }
void 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) { if (!clicked_routeview) {
return; return;
@ -322,7 +322,7 @@ Editor::set_selected_track_from_click (bool press, Selection::Operation op, bool
} }
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) { if (!clicked_control_point) {
return false; return false;
@ -331,7 +331,7 @@ Editor::set_selected_control_point_from_click (bool press, Selection::Operation
bool ret = false; bool ret = false;
switch (op) { switch (op) {
case Selection::Set: case SelectionSet:
if (!selection->selected (clicked_control_point)) { if (!selection->selected (clicked_control_point)) {
selection->set (clicked_control_point); selection->set (clicked_control_point);
ret = true; ret = true;
@ -348,13 +348,13 @@ Editor::set_selected_control_point_from_click (bool press, Selection::Operation
} }
break; break;
case Selection::Add: case SelectionAdd:
if (press) { if (press) {
selection->add (clicked_control_point); selection->add (clicked_control_point);
ret = true; ret = true;
} }
break; break;
case Selection::Toggle: case SelectionToggle:
/* This is a bit of a hack; if we Primary-Click-Drag a control /* 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 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; _control_point_toggled_on_press = false;
} }
break; break;
case Selection::Extend: case SelectionExtend:
/* XXX */ /* XXX */
break; break;
} }
@ -657,7 +657,7 @@ Editor::get_equivalent_regions (RegionSelection & basis, PBD::PropertyID prop) c
} }
bool bool
Editor::set_selected_regionview_from_click (bool press, Selection::Operation op) Editor::set_selected_regionview_from_click (bool press, SelectionOperation op)
{ {
vector<RegionView*> all_equivalent_regions; vector<RegionView*> all_equivalent_regions;
bool commit = false; bool commit = false;
@ -670,10 +670,10 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op)
button_release_can_deselect = false; button_release_can_deselect = false;
} }
if (op == Selection::Toggle || op == Selection::Set) { if (op == SelectionToggle || op == SelectionSet) {
switch (op) { switch (op) {
case Selection::Toggle: case SelectionToggle:
if (selection->selected (clicked_regionview)) { if (selection->selected (clicked_regionview)) {
if (press) { if (press) {
@ -733,7 +733,7 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op)
} }
break; break;
case Selection::Set: case SelectionSet:
if (!selection->selected (clicked_regionview)) { if (!selection->selected (clicked_regionview)) {
if (should_ripple_all()) { if (should_ripple_all()) {
get_all_equivalent_regions (clicked_regionview, all_equivalent_regions); 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; break;
} }
} else if (op == Selection::Extend) { } else if (op == SelectionExtend) {
list<Selectable*> results; list<Selectable*> results;
timepos_t last_pos; timepos_t last_pos;
@ -1020,23 +1020,23 @@ Editor::set_selected_midi_region_view (MidiRegionView& mrv)
} }
void void
Editor::set_selection (std::list<Selectable*> s, Selection::Operation op) Editor::set_selection (std::list<Selectable*> s, SelectionOperation op)
{ {
if (s.empty()) { if (s.empty()) {
return; return;
} }
begin_reversible_selection_op (X_("set selection")); begin_reversible_selection_op (X_("set selection"));
switch (op) { switch (op) {
case Selection::Toggle: case SelectionToggle:
selection->toggle (s); selection->toggle (s);
break; break;
case Selection::Set: case SelectionSet:
selection->set (s); selection->set (s);
break; break;
case Selection::Extend: case SelectionExtend:
selection->add (s); selection->add (s);
break; break;
case Selection::Add: case SelectionAdd:
selection->add (s); selection->add (s);
break; break;
} }
@ -1045,7 +1045,7 @@ Editor::set_selection (std::list<Selectable*> s, Selection::Operation op)
} }
void void
Editor::set_selected_regionview_from_region_list (std::shared_ptr<Region> region, Selection::Operation op) Editor::set_selected_regionview_from_region_list (std::shared_ptr<Region> region, SelectionOperation op)
{ {
vector<RegionView*> regionviews; vector<RegionView*> regionviews;
@ -1058,17 +1058,17 @@ Editor::set_selected_regionview_from_region_list (std::shared_ptr<Region> region
begin_reversible_selection_op (X_("set selected regions")); begin_reversible_selection_op (X_("set selected regions"));
switch (op) { switch (op) {
case Selection::Toggle: case SelectionToggle:
/* XXX this is not correct */ /* XXX this is not correct */
selection->toggle (regionviews); selection->toggle (regionviews);
break; break;
case Selection::Set: case SelectionSet:
selection->set (regionviews); selection->set (regionviews);
break; break;
case Selection::Extend: case SelectionExtend:
selection->add (regionviews); selection->add (regionviews);
break; break;
case Selection::Add: case SelectionAdd:
selection->add (regionviews); selection->add (regionviews);
break; break;
} }
@ -1754,7 +1754,7 @@ Editor::point_selection_changed ()
} }
void void
Editor::select_all_in_track (Selection::Operation op) Editor::select_all_in_track (SelectionOperation op)
{ {
list<Selectable *> touched; list<Selectable *> 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); clicked_routeview->get_selectables (timepos_t(), timepos_t::max (Temporal::AudioTime), 0, DBL_MAX, touched);
switch (op) { switch (op) {
case Selection::Toggle: case SelectionToggle:
selection->add (touched); selection->add (touched);
break; break;
case Selection::Set: case SelectionSet:
selection->set (touched); selection->set (touched);
break; break;
case Selection::Extend: case SelectionExtend:
/* meaningless, because we're selecting everything */ /* meaningless, because we're selecting everything */
break; break;
case Selection::Add: case SelectionAdd:
selection->add (touched); selection->add (touched);
break; break;
} }
@ -1785,7 +1785,7 @@ Editor::select_all_in_track (Selection::Operation op)
} }
bool bool
Editor::select_all_internal_edit (Selection::Operation) Editor::select_all_internal_edit (SelectionOperation)
{ {
bool selected = false; bool selected = false;
@ -1809,7 +1809,7 @@ Editor::select_all_internal_edit (Selection::Operation)
} }
void void
Editor::select_all_objects (Selection::Operation op) Editor::select_all_objects (SelectionOperation op)
{ {
list<Selectable *> touched; list<Selectable *> touched;
@ -1834,16 +1834,16 @@ Editor::select_all_objects (Selection::Operation op)
begin_reversible_selection_op (X_("select all")); begin_reversible_selection_op (X_("select all"));
switch (op) { switch (op) {
case Selection::Add: case SelectionAdd:
selection->add (touched); selection->add (touched);
break; break;
case Selection::Toggle: case SelectionToggle:
selection->toggle (touched); selection->toggle (touched);
break; break;
case Selection::Set: case SelectionSet:
selection->set (touched); selection->set (touched);
break; break;
case Selection::Extend: case SelectionExtend:
/* meaningless, because we're selecting everything */ /* meaningless, because we're selecting everything */
break; break;
} }
@ -1919,7 +1919,7 @@ Editor::invert_selection ()
* within the region are already selected. * within the region are already selected.
*/ */
void 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<Selectable*> found; list<Selectable*> found;
@ -1938,7 +1938,7 @@ Editor::select_all_within (timepos_t const & start, timepos_t const & end, doubl
return; return;
} }
if (preserve_if_selected && op != Selection::Toggle) { if (preserve_if_selected && op != SelectionToggle) {
list<Selectable*>::iterator i = found.begin(); list<Selectable*>::iterator i = found.begin();
while (i != found.end() && (*i)->selected()) { while (i != found.end() && (*i)->selected()) {
++i; ++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")); begin_reversible_selection_op (X_("select all within"));
switch (op) { switch (op) {
case Selection::Add: case SelectionAdd:
selection->add (found); selection->add (found);
break; break;
case Selection::Toggle: case SelectionToggle:
selection->toggle (found); selection->toggle (found);
break; break;
case Selection::Set: case SelectionSet:
selection->set (found); selection->set (found);
break; break;
case Selection::Extend: case SelectionExtend:
/* not defined yet */ /* not defined yet */
break; break;
} }

View File

@ -125,7 +125,7 @@ EditorSources::selection_changed ()
for (set<std::shared_ptr<Region>>::iterator region = regions.begin (); region != regions.end (); region++) { for (set<std::shared_ptr<Region>>::iterator region = regions.begin (); region != regions.end (); region++) {
_change_connection.block (true); _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); _change_connection.block (false);
} }
} }
@ -228,7 +228,7 @@ EditorSources::remove_selected_sources ()
* (Source::drop_references -> Region::source_deleted, * (Source::drop_references -> Region::source_deleted,
* -> Region::drop_references). see f58f5bef55a5aa1 * -> 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); _change_connection.block (false);
} }

View File

@ -361,16 +361,16 @@ ArdourKeyboard::set_note_size_relative_modifier (guint mod)
the_keyboard().reset_relevant_modifier_key_mask(); the_keyboard().reset_relevant_modifier_key_mask();
} }
Selection::Operation SelectionOperation
ArdourKeyboard::selection_type (guint state) ArdourKeyboard::selection_type (guint state)
{ {
/* note that there is no modifier for "Add" */ /* note that there is no modifier for "Add" */
if (modifier_state_equals (state, RangeSelectModifier)) { if (modifier_state_equals (state, RangeSelectModifier)) {
return Selection::Extend; return SelectionExtend;
} else if (modifier_state_equals (state, PrimaryModifier)) { } else if (modifier_state_equals (state, PrimaryModifier)) {
return Selection::Toggle; return SelectionToggle;
} else { } else {
return Selection::Set; return SelectionSet;
} }
} }

View File

@ -43,7 +43,7 @@ public:
void setup_keybindings (); void setup_keybindings ();
static Selection::Operation selection_type (guint state); static ARDOUR::SelectionOperation selection_type (guint state);
ARDOUR_UI& ui; ARDOUR_UI& ui;

View File

@ -1082,10 +1082,10 @@ LuaInstance::register_classes (lua_State* L, bool sandbox)
.endNamespace () .endNamespace ()
.beginNamespace ("SelectionOp") .beginNamespace ("SelectionOp")
.addConst ("Toggle", Selection::Operation(Selection::Toggle)) .addConst ("Toggle", SelectionOperation(SelectionToggle))
.addConst ("Set", Selection::Operation(Selection::Set)) .addConst ("Set", SelectionOperation(SelectionSet))
.addConst ("Extend", Selection::Operation(Selection::Extend)) .addConst ("Extend", SelectionOperation(SelectionExtend))
.addConst ("Add", Selection::Operation(Selection::Add)) .addConst ("Add", SelectionOperation(SelectionAdd))
.endNamespace () .endNamespace ()
.beginNamespace ("TrackHeightMode") .beginNamespace ("TrackHeightMode")

View File

@ -239,7 +239,7 @@ public:
virtual bool get_selection_extents (Temporal::timepos_t &start, Temporal::timepos_t &end) const = 0; virtual bool get_selection_extents (Temporal::timepos_t &start, Temporal::timepos_t &end) const = 0;
virtual Selection& get_cut_buffer () const = 0; virtual Selection& get_cut_buffer () const = 0;
virtual void set_selection (std::list<Selectable*>, Selection::Operation) = 0; virtual void set_selection (std::list<Selectable*>, ARDOUR::SelectionOperation) = 0;
virtual void set_selected_midi_region_view (MidiRegionView&) = 0; virtual void set_selected_midi_region_view (MidiRegionView&) = 0;
virtual std::shared_ptr<ARDOUR::Route> current_mixer_stripable () const = 0; virtual std::shared_ptr<ARDOUR::Route> current_mixer_stripable () const = 0;
@ -349,7 +349,7 @@ public:
virtual void select_all_tracks () = 0; virtual void select_all_tracks () = 0;
virtual void deselect_all () = 0; virtual void deselect_all () = 0;
virtual void invert_selection () = 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 set_selected_mixer_strip (TimeAxisView&) = 0;
virtual void hide_track_in_display (TimeAxisView* tv, bool apply_to_selection = false) = 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; virtual void show_track_in_display (TimeAxisView* tv, bool move_into_view = false) = 0;

View File

@ -1145,19 +1145,19 @@ RouteTimeAxisView::selection_click (GdkEventButton* ev)
_editor.begin_reversible_selection_op (X_("Selection Click")); _editor.begin_reversible_selection_op (X_("Selection Click"));
switch (ArdourKeyboard::selection_type (ev->state)) { switch (ArdourKeyboard::selection_type (ev->state)) {
case Selection::Toggle: case SelectionToggle:
_editor.get_selection().toggle (this); _editor.get_selection().toggle (this);
break; break;
case Selection::Set: case SelectionSet:
_editor.get_selection().set (this); _editor.get_selection().set (this);
break; break;
case Selection::Extend: case SelectionExtend:
_editor.extend_selection_to_track (*this); _editor.extend_selection_to_track (*this);
break; break;
case Selection::Add: case SelectionAdd:
_editor.get_selection().add (this); _editor.get_selection().add (this);
break; break;
} }

View File

@ -34,6 +34,8 @@
#include "pbd/signals.h" #include "pbd/signals.h"
#include "ardour/types.h"
#include "time_selection.h" #include "time_selection.h"
#include "region_selection.h" #include "region_selection.h"
#include "track_selection.h" #include "track_selection.h"
@ -78,13 +80,6 @@ public:
Range = 0x2 Range = 0x2
}; };
enum Operation {
Set,
Add,
Toggle,
Extend
};
TrackSelection tracks; TrackSelection tracks;
RegionSelection regions; RegionSelection regions;
TimeSelection time; TimeSelection time;

View File

@ -597,7 +597,7 @@ TimeAxisView::controls_ebox_button_release (GdkEventButton* ev)
void void
TimeAxisView::selection_click (GdkEventButton* ev) 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); _editor.set_selected_track (*this, op, false);
} }
@ -805,7 +805,7 @@ TimeAxisView::conditionally_add_to_selection ()
Selection& s (_editor.get_selection ()); Selection& s (_editor.get_selection ());
if (!s.selected (this)) { if (!s.selected (this)) {
_editor.set_selected_track (*this, Selection::Set); _editor.set_selected_track (*this, SelectionSet);
} }
} }

View File

@ -975,6 +975,14 @@ struct ProcessedRanges {
ProcessedRanges() : start { 0, 0 }, end { 0, 0 }, cnt (0) {} ProcessedRanges() : start { 0, 0 }, end { 0, 0 }, cnt (0) {}
}; };
enum SelectionOperation {
SelectionSet,
SelectionAdd,
SelectionToggle,
SelectionExtend
};
} // namespace ARDOUR } // namespace ARDOUR
/* for now, break the rules and use "using" to make this "global" */ /* for now, break the rules and use "using" to make this "global" */