mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-24 15:37:48 +01:00
[Summary] Implemented features "Select All" and "Inverst Selection" for regions
[Reviewed by QA] MKosharniy
This commit is contained in:
parent
14b9b99044
commit
2ca303480f
7 changed files with 78 additions and 4 deletions
|
|
@ -3829,7 +3829,8 @@ Editor::set_stationary_playhead (bool yn)
|
|||
}
|
||||
}
|
||||
|
||||
void Editor::toggle_enable_group_edit ()
|
||||
void
|
||||
Editor::toggle_enable_group_edit ()
|
||||
{
|
||||
RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-enable-group-edit"));
|
||||
if (act) {
|
||||
|
|
|
|||
|
|
@ -263,6 +263,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
|||
void play_with_preroll ();
|
||||
void select_all_in_track (Selection::Operation op);
|
||||
void select_all_objects (Selection::Operation op);
|
||||
void select_all_regions ();
|
||||
void invert_region_selection ();
|
||||
void invert_selection_in_track ();
|
||||
void invert_selection ();
|
||||
void deselect_all ();
|
||||
|
|
|
|||
|
|
@ -197,8 +197,8 @@ Editor::register_actions ()
|
|||
|
||||
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-tracks", _("Select All Tracks"), sigc::mem_fun(*this, &Editor::select_all_tracks));
|
||||
reg_sens (editor_actions, "deselect-all", _("Select All/Deselect All"), sigc::mem_fun(*this, &Editor::deselect_all));
|
||||
reg_sens (editor_actions, "invert-selection", _("Invert Selection"), sigc::mem_fun(*this, &Editor::invert_selection));
|
||||
reg_sens (editor_actions, "select-all", _("Select All"), sigc::mem_fun(*this, &Editor::select_all_regions ));
|
||||
reg_sens (editor_actions, "invert-selection", _("Invert Selection"), sigc::mem_fun(*this, &Editor::invert_selection ));
|
||||
toggle_reg_sens (editor_actions, "toggle-enable-group-edit", _("Enable Group Edit"), sigc::mem_fun (*this, &Editor::toggle_enable_group_edit));
|
||||
|
||||
reg_sens (editor_actions, "select-all-after-edit-cursor", _("Select All After Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_edit), true));
|
||||
|
|
|
|||
|
|
@ -1596,6 +1596,48 @@ Editor::select_all_objects (Selection::Operation op)
|
|||
commit_reversible_command ();
|
||||
}
|
||||
|
||||
void
|
||||
Editor::select_all_regions ()
|
||||
{
|
||||
list<Selectable *> touched;
|
||||
TrackViewList ts = track_views;
|
||||
|
||||
begin_reversible_command (_("select all"));
|
||||
|
||||
for (TrackViewList::iterator iter = ts.begin(); iter != ts.end(); ++iter) {
|
||||
if ((*iter)->hidden()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(*iter);
|
||||
rtv->get_selectable_regionviews (0, max_framepos, 0, DBL_MAX, touched);
|
||||
}
|
||||
selection->set (touched);
|
||||
|
||||
commit_reversible_command ();
|
||||
}
|
||||
|
||||
void
|
||||
Editor::invert_region_selection ()
|
||||
{
|
||||
list<Selectable *> touched;
|
||||
TrackViewList ts = track_views;
|
||||
|
||||
begin_reversible_command (_("invert selection"));
|
||||
|
||||
for (TrackViewList::iterator iter = ts.begin(); iter != ts.end(); ++iter) {
|
||||
if ((*iter)->hidden()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
RouteTimeAxisView* rtv = dynamic_cast<RouteTimeAxisView*>(*iter);
|
||||
rtv->get_inverted_selectable_regionviews (*selection, touched);
|
||||
}
|
||||
selection->set (touched);
|
||||
|
||||
commit_reversible_command ();
|
||||
}
|
||||
|
||||
void
|
||||
Editor::invert_selection_in_track ()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1373,6 +1373,31 @@ RouteTimeAxisView::get_inverted_selectables (Selection& sel, list<Selectable*>&
|
|||
return;
|
||||
}
|
||||
|
||||
void
|
||||
RouteTimeAxisView::get_selectable_regionviews (framepos_t start, framepos_t end, double top, double bot, list<Selectable*>& results)
|
||||
{
|
||||
double speed = 1.0;
|
||||
|
||||
if (track() != 0) {
|
||||
speed = track()->speed();
|
||||
}
|
||||
|
||||
framepos_t const start_adjusted = session_frame_to_track_frame(start, speed);
|
||||
framepos_t const end_adjusted = session_frame_to_track_frame(end, speed);
|
||||
|
||||
if ((_view && ((top < 0.0 && bot < 0.0))) || touched (top, bot)) {
|
||||
_view->get_selectables (start_adjusted, end_adjusted, top, bot, results);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RouteTimeAxisView::get_inverted_selectable_regionviews (Selection& sel, list<Selectable*>& results)
|
||||
{
|
||||
if (_view) {
|
||||
_view->get_inverted_selectables (sel, results);
|
||||
}
|
||||
}
|
||||
|
||||
RouteGroup*
|
||||
RouteTimeAxisView::route_group () const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -97,6 +97,10 @@ public:
|
|||
void set_selected_regionviews (RegionSelection&);
|
||||
void get_selectables (ARDOUR::framepos_t start, ARDOUR::framepos_t end, double top, double bot, std::list<Selectable *>&);
|
||||
void get_inverted_selectables (Selection&, std::list<Selectable*>&);
|
||||
|
||||
void get_selectable_regionviews (framepos_t start, framepos_t end, double top, double bot, std::list<Selectable*>& results);
|
||||
void get_inverted_selectable_regionviews (Selection& sel, std::list<Selectable*>& results);
|
||||
|
||||
void set_layer_display (LayerDisplay d, bool apply_to_selection = false);
|
||||
LayerDisplay layer_display () const;
|
||||
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@
|
|||
<menuitem action='split-region'/>
|
||||
<menuitem action='split-on-playhead'/>
|
||||
<menu action="SelectMenu">
|
||||
<menuitem action='deselect-all'/>
|
||||
<menuitem action='select-all'/>
|
||||
<menuitem action='invert-selection'/>
|
||||
</menu>
|
||||
<separator/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue