summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2006-12-19 20:11:42 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2006-12-19 20:11:42 +0000
commit58c34fe805ddbe0d93c25a0eec1fe52106945743 (patch)
tree2f297e26adfb73e9de3ada7e36b725368312d1ef
parent4bbfb6bffd3ecdf41bb3c8b73a0ca2eb000d7feb (diff)
make shift-click (extend) selection operation on track headers etc. work
git-svn-id: svn://localhost/ardour2/trunk@1233 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/ardour.bindings3
-rw-r--r--gtk2_ardour/editor.cc117
-rw-r--r--gtk2_ardour/editor.h2
-rw-r--r--gtk2_ardour/editor_mouse.cc3
-rw-r--r--gtk2_ardour/public_editor.h1
-rw-r--r--gtk2_ardour/route_time_axis.cc8
-rw-r--r--svn_revision.h2
7 files changed, 130 insertions, 6 deletions
diff --git a/gtk2_ardour/ardour.bindings b/gtk2_ardour/ardour.bindings
index 86f50e139f..bf5df40e9e 100644
--- a/gtk2_ardour/ardour.bindings
+++ b/gtk2_ardour/ardour.bindings
@@ -121,6 +121,7 @@
; (gtk_accel_path "<Actions>/Editor/EditSelectRegionOptions" "")
(gtk_accel_path "<Actions>/Editor/crop" "c")
; (gtk_accel_path "<Actions>/redirectmenu/newsend" "")
+; (gtk_accel_path "<Actions>/Editor/ToggleGeneric MIDISurfaceSubMenu" "")
; (gtk_accel_path "<Actions>/Editor/MeterFalloff" "")
; (gtk_accel_path "<Actions>/RegionList/rlRemove" "")
(gtk_accel_path "<Actions>/Transport/GotoStart" "Home")
@@ -276,6 +277,7 @@
; (gtk_accel_path "<Actions>/Editor/Subframes80" "")
; (gtk_accel_path "<Actions>/options/FileHeaderFormatCAF" "")
(gtk_accel_path "<Actions>/Common/ToggleLocations" "<Alt>l")
+; (gtk_accel_path "<Actions>/Editor/ToggleGeneric MIDISurface" "")
(gtk_accel_path "<Actions>/Editor/editor-delete" "Delete")
; (gtk_accel_path "<Actions>/JACK/JACKLatency256" "")
(gtk_accel_path "<Actions>/Editor/select-all-between-cursors" "u")
@@ -298,6 +300,7 @@
; (gtk_accel_path "<Actions>/Snap/snap-to-region-sync" "")
(gtk_accel_path "<Actions>/Editor/edit-cursor-to-previous-region-sync" "apostrophe")
; (gtk_accel_path "<Actions>/redirectmenu/clear" "")
+; (gtk_accel_path "<Actions>/Editor/ToggleGeneric MIDISurfaceFeedback" "")
; (gtk_accel_path "<Actions>/Editor/PullupPlus4Minus1" "")
; (gtk_accel_path "<Actions>/JACK/JACKLatency512" "")
(gtk_accel_path "<Actions>/Editor/edit-cursor-to-next-region-end" "<Control>bracketright")
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index 23995529e4..27c2802180 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -2861,6 +2861,114 @@ Editor::commit_reversible_command ()
}
}
+struct TrackViewByPositionSorter
+{
+ bool operator() (const TimeAxisView* a, const TimeAxisView *b) {
+ return a->y_position < b->y_position;
+ }
+};
+
+bool
+Editor::extend_selection_to_track (TimeAxisView& view)
+{
+ if (selection->tracks.empty()) {
+
+ if (!selection->selected (&view)) {
+ selection->set (&view);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /* something is already selected, so figure out which range of things to add */
+
+ TrackViewList to_be_added;
+ TrackViewList sorted = track_views;
+ TrackViewByPositionSorter cmp;
+ bool passed_clicked = false;
+ bool forwards;
+
+ sorted.sort (cmp);
+
+ if (!selection->selected (&view)) {
+ to_be_added.push_back (&view);
+ }
+
+ /* figure out if we should go forward or backwards */
+
+ for (TrackViewList::iterator i = sorted.begin(); i != sorted.end(); ++i) {
+
+ if ((*i) == &view) {
+ passed_clicked = true;
+ }
+
+ if (selection->selected (*i)) {
+ if (passed_clicked) {
+ forwards = true;
+ } else {
+ forwards = false;
+ }
+ break;
+ }
+ }
+
+ passed_clicked = false;
+
+ if (forwards) {
+
+ for (TrackViewList::iterator i = sorted.begin(); i != sorted.end(); ++i) {
+
+ if ((*i) == &view) {
+ passed_clicked = true;
+ continue;
+ }
+
+ if (passed_clicked) {
+ if ((*i)->hidden()) {
+ continue;
+ }
+ if (selection->selected (*i)) {
+ break;
+ } else if (!(*i)->hidden()) {
+ to_be_added.push_back (*i);
+ }
+ }
+ }
+
+ } else {
+
+ for (TrackViewList::reverse_iterator r = sorted.rbegin(); r != sorted.rend(); ++r) {
+
+ if ((*r) == &view) {
+ passed_clicked = true;
+ continue;
+ }
+
+ if (passed_clicked) {
+
+ if ((*r)->hidden()) {
+ continue;
+ }
+
+ if (selection->selected (*r)) {
+ break;
+ } else if (!(*r)->hidden()) {
+ to_be_added.push_back (*r);
+ }
+ }
+ }
+ }
+
+ if (!to_be_added.empty()) {
+ selection->add (to_be_added);
+ return true;
+ }
+
+ return false;
+}
+
+
bool
Editor::set_selected_track (TimeAxisView& view, Selection::Operation op, bool no_remove)
{
@@ -2889,13 +2997,14 @@ Editor::set_selected_track (TimeAxisView& view, Selection::Operation op, bool no
case Selection::Set:
if (selection->selected (&view) && selection->tracks.size() == 1) {
/* no commit necessary */
- }
-
- selection->set (&view);
+ } else {
+ selection->set (&view);
+ commit = true;
+ }
break;
case Selection::Extend:
- /* not defined yet */
+ commit = extend_selection_to_track (view);
break;
}
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 2f435336ca..6e302b93d6 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -217,6 +217,8 @@ class Editor : public PublicEditor
Selection& get_selection() const { return *selection; }
Selection& get_cut_buffer() const { return *cut_buffer; }
+ bool extend_selection_to_track (TimeAxisView&);
+
void play_selection ();
void select_all_in_track (Selection::Operation op);
void select_all (Selection::Operation op);
diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc
index 1df4910d8c..4752ae16a2 100644
--- a/gtk2_ardour/editor_mouse.cc
+++ b/gtk2_ardour/editor_mouse.cc
@@ -316,6 +316,7 @@ Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType it
switch (item_type) {
case RegionItem:
+ /* XXX make tying track/region selection optional */
c1 = set_selected_track_from_click (op, true);
c2 = set_selected_regionview_from_click (press, op, true);
commit = (c1 || c2);
@@ -323,6 +324,7 @@ Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType it
case RegionViewNameHighlight:
case RegionViewName:
+ /* XXX make tying track/region selection optional */
c1 = set_selected_track_from_click (op, true);
c2 = set_selected_regionview_from_click (press, op, true);
commit = (c1 || c2);
@@ -331,6 +333,7 @@ Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType it
case GainAutomationControlPointItem:
case PanAutomationControlPointItem:
case RedirectAutomationControlPointItem:
+ /* XXX make tying track/region selection optional */
c1 = set_selected_track_from_click (op, true);
c2 = set_selected_control_point_from_click (op, false);
commit = (c1 || c2);
diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h
index 8a105cd0aa..1e93e17735 100644
--- a/gtk2_ardour/public_editor.h
+++ b/gtk2_ardour/public_editor.h
@@ -93,6 +93,7 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulThingWithGoingAway
virtual gulong frame_to_pixel (nframes_t frame) = 0;
virtual Selection& get_selection() const = 0;
virtual Selection& get_cut_buffer() const = 0;
+ virtual bool extend_selection_to_track (TimeAxisView&) = 0;
virtual void play_selection () = 0;
virtual void set_show_measures (bool yn) = 0;
virtual bool show_measures () const = 0;
diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc
index b3a95711f1..87f5e8e7cc 100644
--- a/gtk2_ardour/route_time_axis.cc
+++ b/gtk2_ardour/route_time_axis.cc
@@ -1012,7 +1012,13 @@ RouteTimeAxisView::selection_click (GdkEventButton* ev)
break;
case Selection::Extend:
- /* not defined yet */
+ if (tracks->size() > 1) {
+ /* add each one, do not "extend" */
+ editor.get_selection().add (*tracks);
+ } else {
+ /* extend to the single track */
+ editor.extend_selection_to_track (*tracks->front());
+ }
break;
case Selection::Add:
diff --git a/svn_revision.h b/svn_revision.h
index 89d7c9563a..7d354bf298 100644
--- a/svn_revision.h
+++ b/svn_revision.h
@@ -1,4 +1,4 @@
#ifndef __ardour_svn_revision_h__
#define __ardour_svn_revision_h__
-static const char* ardour_svn_revision = "1180";
+static const char* ardour_svn_revision = "1232";
#endif