View Issue Details

IDProjectCategoryView StatusLast Update
0005166ardourfeaturespublic2013-08-15 16:02
Reportertom_ Assigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionwon't fix 
Summary0005166: New Select Operation For Regions AT Edit Point or Playhead
DescriptionWished Operation:
-Playhead is set as Edit Point
-Playhead is moved to a position in time
-Operation ~'Select Regions At Edit Point' will select all regions of all selected routes which have a duration that includes the playhead position.

-Optionally, 'Select Control Points at Edit Point' to select only Control Points (which have no duration but can be at the same position as the Edit Point)
TagsNo tags attached.

Activities

tom_

2012-11-12 16:46

reporter   ~0014208

the wished feature can be seen as an addition to existing functions

'select all before playhead' and
'select all after playhead'

but applying only to regions

2013-08-06 19:53

 

add_editor_action_select-all-at-playhead.patch (7,130 bytes)   
From 7a6918e2ff023c2468c5bea17c514161ca781a24 Mon Sep 17 00:00:00 2001
From: Thomas Brand <tom@trellis.ch>
Date: Tue, 6 Aug 2013 21:51:16 +0200
Subject: [PATCH] add select-all-at-playhead editor action

---
 gtk2_ardour/ardour.menus.in     |    1 +
 gtk2_ardour/editor.cc           |    4 +++-
 gtk2_ardour/editor.h            |    1 +
 gtk2_ardour/editor_actions.cc   |    4 +++-
 gtk2_ardour/editor_selection.cc |   37 +++++++++++++++++++++++++++++++++++++
 5 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/gtk2_ardour/ardour.menus.in b/gtk2_ardour/ardour.menus.in
index 15f1bde..6b38970 100644
--- a/gtk2_ardour/ardour.menus.in
+++ b/gtk2_ardour/ardour.menus.in
@@ -173,6 +173,7 @@
         <menuitem action='deselect-all'/>
         <menuitem action='invert-selection'/>
         <menuitem action='select-all-after-edit-cursor'/>
+        <menuitem action='select-all-at-playhead'/>
         <menuitem action='select-all-before-edit-cursor'/>
         <menuitem action='select-all-between-cursors'/>
         <menuitem action='select-all-within-cursors'/>
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index 300e317..53ad7bc 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -1950,6 +1950,7 @@ Editor::add_dstream_context_items (Menu_Helpers::MenuList& edit_items)
 	select_items.push_back (MenuElem (_("Select All Before Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_edit), false)));
 	select_items.push_back (MenuElem (_("Select All After Playhead"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, true)));
 	select_items.push_back (MenuElem (_("Select All Before Playhead"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, false)));
+	select_items.push_back (MenuElem (_("Select All At Playhead"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_at_cursor), playhead_cursor)));
 	select_items.push_back (MenuElem (_("Select All Between Playhead and Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_between), false)));
 	select_items.push_back (MenuElem (_("Select All Within Playhead and Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_between), true)));
 	select_items.push_back (MenuElem (_("Select Range Between Playhead and Edit Point"), sigc::mem_fun(*this, &Editor::select_range_between)));
@@ -2022,8 +2023,9 @@ Editor::add_bus_context_items (Menu_Helpers::MenuList& edit_items)
 	select_items.push_back (SeparatorElem());
 	select_items.push_back (MenuElem (_("Select All After Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_edit), true)));
 	select_items.push_back (MenuElem (_("Select All Before Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_edit), false)));
-	select_items.push_back (MenuElem (_("Select All After Playhead"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, true)));
 	select_items.push_back (MenuElem (_("Select All Before Playhead"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, false)));
+	select_items.push_back (MenuElem (_("Select All At Playhead"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_at_cursor), playhead_cursor)));
+	select_items.push_back (MenuElem (_("Select All After Playhead"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_cursor), playhead_cursor, true)));
 
 	edit_items.push_back (MenuElem (_("Select"), *select_menu));
 
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 033888c..bf79b30 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -956,6 +956,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
 	void    selected_marker_to_selection_end   ();
 
 	void    select_all_selectables_using_cursor (EditorCursor *, bool);
+	void    select_all_selectables_at_cursor (EditorCursor *);
 	void    select_all_selectables_using_edit (bool);
 	void    select_all_selectables_between (bool within);
 	void    select_range_between ();
diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc
index a5e2e8a..d406655 100644
--- a/gtk2_ardour/editor_actions.cc
+++ b/gtk2_ardour/editor_actions.cc
@@ -185,8 +185,10 @@ Editor::register_actions ()
 	reg_sens (editor_actions, "select-all", _("Select All"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all), Selection::Set));
 	reg_sens (editor_actions, "deselect-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-after-edit-cursor", _("Select All After Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_edit), true));
 	reg_sens (editor_actions, "select-all-before-edit-cursor", _("Select All Before Edit Point"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_using_edit), false));
+	reg_sens (editor_actions, "select-all-at-playhead", _("Select All At Playhead"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_at_cursor), playhead_cursor));
+	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));
+
 
 	reg_sens (editor_actions, "select-all-between-cursors", _("Select All Overlapping Edit Range"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_between), false));
 	reg_sens (editor_actions, "select-all-within-cursors", _("Select All Inside Edit Range"), sigc::bind (sigc::mem_fun(*this, &Editor::select_all_selectables_between), true));
diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc
index e19afe3..c664aa5 100644
--- a/gtk2_ardour/editor_selection.cc
+++ b/gtk2_ardour/editor_selection.cc
@@ -1723,6 +1723,43 @@ Editor::select_all_selectables_using_cursor (EditorCursor *cursor, bool after)
 }
 
 void
+Editor::select_all_selectables_at_cursor (EditorCursor *cursor)
+{
+	framepos_t start;
+	framepos_t end;
+	list<Selectable *> touched;
+
+	start = cursor->current_frame;
+	end = cursor->current_frame+1;
+
+	if (_internal_editing) {
+		for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) {
+			MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(*i);
+			if (mrv) {
+				mrv->select_range (start, end);
+			}
+		}
+		return;
+	}
+
+	TrackViewList* ts;
+
+	if (selection->tracks.empty()) {
+		ts = &track_views;
+	} else {
+		ts = &selection->tracks;
+	}
+
+	for (TrackViewList::iterator iter = ts->begin(); iter != ts->end(); ++iter) {
+		if ((*iter)->hidden()) {
+			continue;
+		}
+		(*iter)->get_selectables (start, end, 0, DBL_MAX, touched);
+	}
+	selection->set (touched);
+}
+
+void
 Editor::select_all_selectables_using_edit (bool after)
 {
 	framepos_t start;
-- 
1.7.9.5

tom_

2013-08-06 19:59

reporter   ~0015236

the attached patch will add an new action, accessible in the menu:
- Edit / Select / Select All At Playhead

tom_

2013-08-15 16:02

reporter   ~0015265

handling via github / pull requests to keep current

Issue History

Date Modified Username Field Change
2012-11-12 16:42 tom_ New Issue
2012-11-12 16:46 tom_ Note Added: 0014208
2013-08-06 19:53 tom_ File Added: add_editor_action_select-all-at-playhead.patch
2013-08-06 19:59 tom_ Note Added: 0015236
2013-08-15 16:02 tom_ Note Added: 0015265
2013-08-15 16:02 tom_ Status new => closed
2013-08-15 16:02 tom_ Resolution open => won't fix