summaryrefslogtreecommitdiff
path: root/gtk2_ardour/automation_region_view.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-08-04 15:41:55 +0000
committerCarl Hetherington <carl@carlh.net>2010-08-04 15:41:55 +0000
commitcc6016400bbd903e5d2a1720708ecde8d71f44d3 (patch)
tree41166df0d8ac89193d4b6bc3c45897267d86e36e /gtk2_ardour/automation_region_view.cc
parentaa72da4f9ffc2f7011c2e7f801fb5c04ecbfa58f (diff)
Allow rubberband selection of MIDI automation points. Fixes
git-svn-id: svn://localhost/ardour2/branches/3.0@7535 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/automation_region_view.cc')
-rw-r--r--gtk2_ardour/automation_region_view.cc17
1 files changed, 14 insertions, 3 deletions
diff --git a/gtk2_ardour/automation_region_view.cc b/gtk2_ardour/automation_region_view.cc
index 21ee6ca38a..a576101048 100644
--- a/gtk2_ardour/automation_region_view.cc
+++ b/gtk2_ardour/automation_region_view.cc
@@ -29,6 +29,8 @@
#include "gui_thread.h"
#include "public_editor.h"
#include "midi_automation_line.h"
+#include "editor_drag.h"
+#include "editor.h"
#include "i18n.h"
@@ -89,18 +91,27 @@ AutomationRegionView::create_line (boost::shared_ptr<ARDOUR::AutomationList> lis
bool
AutomationRegionView::canvas_event(GdkEvent* ev)
{
- if (ev->type == GDK_BUTTON_RELEASE) {
+ if (ev->type == GDK_BUTTON_PRESS) {
+ /* XXX: icky dcast to Editor */
+ trackview.editor().drags()->set (new RubberbandSelectDrag (dynamic_cast<Editor*> (&trackview.editor()), group), ev);
+
+ } else if (ev->type == GDK_BUTTON_RELEASE) {
+
+ if (trackview.editor().drags()->active() && trackview.editor().drags()->end_grab (ev)) {
+ return true;
+ }
+
double x = ev->button.x;
double y = ev->button.y;
-
+
/* convert to item coordinates in the time axis view */
automation_view()->canvas_display()->w2i (x, y);
/* clamp y */
y = max (y, 0.0);
y = min (y, _height - NAME_HIGHLIGHT_SIZE);
-
+
add_automation_event (ev, trackview.editor().pixel_to_frame (x) - _region->position(), y);
}