2 Copyright (C) 2000 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #include "pbd/stacktrace.h"
27 #include "ardour/audioplaylist.h"
28 #include "ardour/audioregion.h"
29 #include "ardour/region_factory.h"
30 #include "ardour/midi_region.h"
34 #include "public_editor.h"
35 #include "audio_region_view.h"
36 #include "audio_streamview.h"
37 #include "canvas-noevent-text.h"
38 #include "crossfade_view.h"
39 #include "audio_time_axis.h"
40 #include "region_gain_line.h"
41 #include "automation_line.h"
42 #include "automation_time_axis.h"
43 #include "automation_line.h"
44 #include "control_point.h"
45 #include "canvas_impl.h"
46 #include "simplerect.h"
47 #include "editor_drag.h"
48 #include "midi_time_axis.h"
49 #include "editor_regions.h"
54 using namespace ARDOUR
;
57 using namespace ArdourCanvas
;
59 using Gtkmm2ext::Keyboard
;
62 Editor::track_canvas_scroll (GdkEventScroll
* ev
)
65 int direction
= ev
->direction
;
70 if (Keyboard::modifier_state_equals (ev
->state
, Keyboard::PrimaryModifier
)) {
71 temporal_zoom_step (false);
73 } else if (Keyboard::modifier_state_equals (ev
->state
, Keyboard::SecondaryModifier
)) {
74 direction
= GDK_SCROLL_LEFT
;
76 } else if (Keyboard::modifier_state_equals (ev
->state
, Keyboard::TertiaryModifier
)) {
77 if (!current_stepping_trackview
) {
78 step_timeout
= Glib::signal_timeout().connect (sigc::mem_fun(*this, &Editor::track_height_step_timeout
), 500);
79 std::pair
<TimeAxisView
*, int> const p
= trackview_by_y_position (ev
->y
+ vertical_adjustment
.get_value() - canvas_timebars_vsize
);
80 current_stepping_trackview
= p
.first
;
81 if (!current_stepping_trackview
) {
85 last_track_height_step_timestamp
= get_microseconds();
86 current_stepping_trackview
->step_height (true);
89 scroll_tracks_up_line ();
95 if (Keyboard::modifier_state_equals (ev
->state
, Keyboard::PrimaryModifier
)) {
96 temporal_zoom_step (true);
98 } else if (Keyboard::modifier_state_equals (ev
->state
, Keyboard::SecondaryModifier
)) {
99 direction
= GDK_SCROLL_RIGHT
;
101 } else if (Keyboard::modifier_state_equals (ev
->state
, Keyboard::TertiaryModifier
)) {
102 if (!current_stepping_trackview
) {
103 step_timeout
= Glib::signal_timeout().connect (sigc::mem_fun(*this, &Editor::track_height_step_timeout
), 500);
104 std::pair
<TimeAxisView
*, int> const p
= trackview_by_y_position (ev
->y
+ vertical_adjustment
.get_value() - canvas_timebars_vsize
);
105 current_stepping_trackview
= p
.first
;
106 if (!current_stepping_trackview
) {
110 last_track_height_step_timestamp
= get_microseconds();
111 current_stepping_trackview
->step_height (false);
114 scroll_tracks_down_line ();
119 case GDK_SCROLL_LEFT
:
120 xdelta
= (current_page_frames() / 8);
121 if (leftmost_frame
> xdelta
) {
122 reset_x_origin (leftmost_frame
- xdelta
);
128 case GDK_SCROLL_RIGHT
:
129 xdelta
= (current_page_frames() / 8);
130 if (max_frames
- xdelta
> leftmost_frame
) {
131 reset_x_origin (leftmost_frame
+ xdelta
);
133 reset_x_origin (max_frames
- current_page_frames());
146 Editor::track_canvas_scroll_event (GdkEventScroll
*event
)
148 track_canvas
->grab_focus();
149 return track_canvas_scroll (event
);
153 Editor::track_canvas_button_press_event (GdkEventButton */
*event*/
)
156 track_canvas
->grab_focus();
161 Editor::track_canvas_button_release_event (GdkEventButton
*event
)
163 if (_drags
->active ()) {
164 _drags
->end_grab ((GdkEvent
*) event
);
170 Editor::track_canvas_motion_notify_event (GdkEventMotion */
*event*/
)
173 /* keep those motion events coming */
174 track_canvas
->get_pointer (x
, y
);
179 Editor::track_canvas_motion (GdkEvent
*ev
)
181 if (verbose_cursor_visible
) {
182 verbose_canvas_cursor
->property_x() = clamp_verbose_cursor_x (ev
->motion
.x
+ 10);
183 verbose_canvas_cursor
->property_y() = clamp_verbose_cursor_y (ev
->motion
.y
+ 10);
190 Editor::typed_event (ArdourCanvas::Item
* item
, GdkEvent
*event
, ItemType type
)
194 switch (event
->type
) {
195 case GDK_BUTTON_PRESS
:
196 case GDK_2BUTTON_PRESS
:
197 case GDK_3BUTTON_PRESS
:
198 ret
= button_press_handler (item
, event
, type
);
200 case GDK_BUTTON_RELEASE
:
201 ret
= button_release_handler (item
, event
, type
);
203 case GDK_MOTION_NOTIFY
:
204 ret
= motion_handler (item
, event
);
207 case GDK_ENTER_NOTIFY
:
208 ret
= enter_handler (item
, event
, type
);
211 case GDK_LEAVE_NOTIFY
:
212 ret
= leave_handler (item
, event
, type
);
222 Editor::canvas_region_view_event (GdkEvent
*event
, ArdourCanvas::Item
* item
, RegionView
*rv
)
226 if (!rv
->sensitive ()) {
230 switch (event
->type
) {
231 case GDK_BUTTON_PRESS
:
232 case GDK_2BUTTON_PRESS
:
233 case GDK_3BUTTON_PRESS
:
234 clicked_regionview
= rv
;
235 clicked_control_point
= 0;
236 clicked_axisview
= &rv
->get_time_axis_view();
237 clicked_routeview
= dynamic_cast<RouteTimeAxisView
*>(clicked_axisview
);
238 ret
= button_press_handler (item
, event
, RegionItem
);
241 case GDK_BUTTON_RELEASE
:
242 ret
= button_release_handler (item
, event
, RegionItem
);
245 case GDK_MOTION_NOTIFY
:
246 ret
= motion_handler (item
, event
);
249 case GDK_ENTER_NOTIFY
:
250 set_entered_track (&rv
->get_time_axis_view ());
251 set_entered_regionview (rv
);
254 case GDK_LEAVE_NOTIFY
:
255 set_entered_track (0);
256 set_entered_regionview (0);
267 Editor::canvas_stream_view_event (GdkEvent
*event
, ArdourCanvas::Item
* item
, RouteTimeAxisView
*tv
)
271 switch (event
->type
) {
272 case GDK_BUTTON_PRESS
:
273 case GDK_2BUTTON_PRESS
:
274 case GDK_3BUTTON_PRESS
:
275 clicked_regionview
= 0;
276 clicked_control_point
= 0;
277 clicked_axisview
= tv
;
278 clicked_routeview
= dynamic_cast<RouteTimeAxisView
*>(tv
);
279 ret
= button_press_handler (item
, event
, StreamItem
);
282 case GDK_BUTTON_RELEASE
:
283 ret
= button_release_handler (item
, event
, StreamItem
);
286 case GDK_MOTION_NOTIFY
:
287 ret
= motion_handler (item
, event
);
290 case GDK_ENTER_NOTIFY
:
291 set_entered_track (tv
);
294 case GDK_LEAVE_NOTIFY
:
295 set_entered_track (0);
306 Editor::canvas_automation_track_event (GdkEvent
*event
, ArdourCanvas::Item
* item
, AutomationTimeAxisView
*atv
)
310 switch (event
->type
) {
311 case GDK_BUTTON_PRESS
:
312 case GDK_2BUTTON_PRESS
:
313 case GDK_3BUTTON_PRESS
:
314 clicked_regionview
= 0;
315 clicked_control_point
= 0;
316 clicked_axisview
= atv
;
317 clicked_routeview
= 0;
318 ret
= button_press_handler (item
, event
, AutomationTrackItem
);
321 case GDK_BUTTON_RELEASE
:
322 ret
= button_release_handler (item
, event
, AutomationTrackItem
);
325 case GDK_MOTION_NOTIFY
:
326 ret
= motion_handler (item
, event
);
329 case GDK_ENTER_NOTIFY
:
330 ret
= enter_handler (item
, event
, AutomationTrackItem
);
333 case GDK_LEAVE_NOTIFY
:
334 ret
= leave_handler (item
, event
, AutomationTrackItem
);
345 Editor::canvas_fade_in_event (GdkEvent
*event
, ArdourCanvas::Item
* item
, AudioRegionView
*rv
)
347 /* we handle only button 3 press/release events */
349 if (!rv
->sensitive()) {
353 switch (event
->type
) {
354 case GDK_BUTTON_PRESS
:
355 clicked_regionview
= rv
;
356 clicked_control_point
= 0;
357 clicked_axisview
= &rv
->get_time_axis_view();
358 clicked_routeview
= dynamic_cast<RouteTimeAxisView
*>(clicked_axisview
);
359 if (event
->button
.button
== 3) {
360 return button_press_handler (item
, event
, FadeInItem
);
364 case GDK_BUTTON_RELEASE
:
365 if (event
->button
.button
== 3) {
366 return button_release_handler (item
, event
, FadeInItem
);
375 /* proxy for the regionview */
377 return canvas_region_view_event (event
, rv
->get_canvas_group(), rv
);
381 Editor::canvas_fade_in_handle_event (GdkEvent
*event
, ArdourCanvas::Item
* item
, AudioRegionView
*rv
)
385 if (!rv
->sensitive()) {
389 switch (event
->type
) {
390 case GDK_BUTTON_PRESS
:
391 case GDK_2BUTTON_PRESS
:
392 case GDK_3BUTTON_PRESS
:
393 clicked_regionview
= rv
;
394 clicked_control_point
= 0;
395 clicked_axisview
= &rv
->get_time_axis_view();
396 clicked_routeview
= dynamic_cast<RouteTimeAxisView
*>(clicked_axisview
);
397 ret
= button_press_handler (item
, event
, FadeInHandleItem
);
400 case GDK_BUTTON_RELEASE
:
401 ret
= button_release_handler (item
, event
, FadeInHandleItem
);
404 case GDK_MOTION_NOTIFY
:
405 ret
= motion_handler (item
, event
);
408 case GDK_ENTER_NOTIFY
:
409 set_entered_regionview (rv
);
410 ret
= enter_handler (item
, event
, FadeInHandleItem
);
413 case GDK_LEAVE_NOTIFY
:
414 set_entered_regionview (0);
415 ret
= leave_handler (item
, event
, FadeInHandleItem
);
426 Editor::canvas_fade_out_event (GdkEvent
*event
, ArdourCanvas::Item
* item
, AudioRegionView
*rv
)
428 /* we handle only button 3 press/release events */
430 if (!rv
->sensitive()) {
434 switch (event
->type
) {
435 case GDK_BUTTON_PRESS
:
436 clicked_regionview
= rv
;
437 clicked_control_point
= 0;
438 clicked_axisview
= &rv
->get_time_axis_view();
439 clicked_routeview
= dynamic_cast<RouteTimeAxisView
*>(clicked_axisview
);
440 if (event
->button
.button
== 3) {
441 return button_press_handler (item
, event
, FadeOutItem
);
445 case GDK_BUTTON_RELEASE
:
446 if (event
->button
.button
== 3) {
447 return button_release_handler (item
, event
, FadeOutItem
);
456 /* proxy for the regionview */
458 return canvas_region_view_event (event
, rv
->get_canvas_group(), rv
);
462 Editor::canvas_fade_out_handle_event (GdkEvent
*event
, ArdourCanvas::Item
* item
, AudioRegionView
*rv
)
466 if (!rv
->sensitive()) {
470 switch (event
->type
) {
471 case GDK_BUTTON_PRESS
:
472 case GDK_2BUTTON_PRESS
:
473 case GDK_3BUTTON_PRESS
:
474 clicked_regionview
= rv
;
475 clicked_control_point
= 0;
476 clicked_axisview
= &rv
->get_time_axis_view();
477 clicked_routeview
= dynamic_cast<RouteTimeAxisView
*>(clicked_axisview
);
478 ret
= button_press_handler (item
, event
, FadeOutHandleItem
);
481 case GDK_BUTTON_RELEASE
:
482 ret
= button_release_handler (item
, event
, FadeOutHandleItem
);
485 case GDK_MOTION_NOTIFY
:
486 ret
= motion_handler (item
, event
);
489 case GDK_ENTER_NOTIFY
:
490 set_entered_regionview (rv
);
491 ret
= enter_handler (item
, event
, FadeOutHandleItem
);
494 case GDK_LEAVE_NOTIFY
:
495 set_entered_regionview (0);
496 ret
= leave_handler (item
, event
, FadeOutHandleItem
);
506 struct DescendingRegionLayerSorter
{
507 bool operator()(boost::shared_ptr
<Region
> a
, boost::shared_ptr
<Region
> b
) {
508 return a
->layer() > b
->layer();
513 Editor::canvas_crossfade_view_event (GdkEvent
* event
, ArdourCanvas::Item
* item
, CrossfadeView
* xfv
)
515 /* we handle only button 3 press/release events */
517 switch (event
->type
) {
518 case GDK_BUTTON_PRESS
:
519 clicked_crossfadeview
= xfv
;
520 clicked_axisview
= &clicked_crossfadeview
->get_time_axis_view();
521 if (event
->button
.button
== 3) {
522 return button_press_handler (item
, event
, CrossfadeViewItem
);
526 case GDK_BUTTON_RELEASE
:
527 if (event
->button
.button
== 3) {
528 bool ret
= button_release_handler (item
, event
, CrossfadeViewItem
);
538 /* XXX do not forward double clicks */
540 if (event
->type
== GDK_2BUTTON_PRESS
) {
544 /* proxy for an underlying regionview */
546 /* XXX really need to check if we are in the name highlight,
547 and proxy to that when required.
550 TimeAxisView
& tv (xfv
->get_time_axis_view());
551 AudioTimeAxisView
* atv
;
553 if ((atv
= dynamic_cast<AudioTimeAxisView
*>(&tv
)) != 0) {
555 if (atv
->is_audio_track()) {
557 boost::shared_ptr
<AudioPlaylist
> pl
;
558 if ((pl
= boost::dynamic_pointer_cast
<AudioPlaylist
> (atv
->track()->playlist())) != 0) {
560 Playlist::RegionList
* rl
= pl
->regions_at (event_frame (event
));
563 if (atv
->layer_display() == Overlaid
) {
565 /* we're in overlaid mode; proxy to the uppermost region view */
567 DescendingRegionLayerSorter cmp
;
570 RegionView
* rv
= atv
->view()->find_view (rl
->front());
575 return canvas_region_view_event (event
, rv
->get_canvas_group(), rv
);
579 /* we're in stacked mode; proxy to the region view under the mouse */
581 /* XXX: FIXME: this is an evil hack; it assumes that any event for which
582 this proxy is being used has its GdkEvent laid out such that the y
583 member is in the same place as that for a GdkEventButton */
585 /* position of the event within the track */
586 double cx
= event
->button
.x
;
587 double cy
= event
->button
.y
;
588 atv
->view()->canvas_item()->w2i (cx
, cy
);
590 /* hence layer that we're over */
591 double const c
= atv
->view()->child_height ();
592 layer_t
const l
= pl
->top_layer () + 1 - (cy
/ c
);
595 Playlist::RegionList::iterator i
= rl
->begin();
596 while (i
!= rl
->end() && (*i
)->layer() != l
) {
600 if (i
!= rl
->end()) {
601 RegionView
* rv
= atv
->view()->find_view (*i
);
605 return canvas_region_view_event (event
, rv
->get_canvas_group(), rv
);
619 Editor::canvas_control_point_event (GdkEvent
*event
, ArdourCanvas::Item
* item
, ControlPoint
* cp
)
621 switch (event
->type
) {
622 case GDK_BUTTON_PRESS
:
623 case GDK_2BUTTON_PRESS
:
624 case GDK_3BUTTON_PRESS
:
625 clicked_control_point
= cp
;
626 clicked_axisview
= &cp
->line().trackview
;
627 clicked_routeview
= dynamic_cast<RouteTimeAxisView
*>(clicked_axisview
);
628 clicked_regionview
= 0;
634 case GDK_SCROLL_DOWN
:
641 return typed_event (item
, event
, ControlPointItem
);
645 Editor::canvas_line_event (GdkEvent
*event
, ArdourCanvas::Item
* item
, AutomationLine
* al
)
649 if (dynamic_cast<AudioRegionGainLine
*> (al
) != 0) {
652 type
= AutomationLineItem
;
655 return typed_event (item
, event
, type
);
659 Editor::canvas_selection_rect_event (GdkEvent
*event
, ArdourCanvas::Item
* item
, SelectionRect
* rect
)
663 switch (event
->type
) {
664 case GDK_BUTTON_PRESS
:
665 case GDK_2BUTTON_PRESS
:
666 case GDK_3BUTTON_PRESS
:
667 clicked_selection
= rect
->id
;
668 ret
= button_press_handler (item
, event
, SelectionItem
);
670 case GDK_BUTTON_RELEASE
:
671 ret
= button_release_handler (item
, event
, SelectionItem
);
673 case GDK_MOTION_NOTIFY
:
674 ret
= motion_handler (item
, event
);
676 /* Don't need these at the moment. */
677 case GDK_ENTER_NOTIFY
:
678 ret
= enter_handler (item
, event
, SelectionItem
);
681 case GDK_LEAVE_NOTIFY
:
682 ret
= leave_handler (item
, event
, SelectionItem
);
693 Editor::canvas_selection_start_trim_event (GdkEvent
*event
, ArdourCanvas::Item
* item
, SelectionRect
* rect
)
697 switch (event
->type
) {
698 case GDK_BUTTON_PRESS
:
699 case GDK_2BUTTON_PRESS
:
700 case GDK_3BUTTON_PRESS
:
701 clicked_selection
= rect
->id
;
702 ret
= button_press_handler (item
, event
, StartSelectionTrimItem
);
704 case GDK_BUTTON_RELEASE
:
705 ret
= button_release_handler (item
, event
, StartSelectionTrimItem
);
707 case GDK_MOTION_NOTIFY
:
708 ret
= motion_handler (item
, event
);
710 case GDK_ENTER_NOTIFY
:
711 ret
= enter_handler (item
, event
, StartSelectionTrimItem
);
714 case GDK_LEAVE_NOTIFY
:
715 ret
= leave_handler (item
, event
, StartSelectionTrimItem
);
726 Editor::canvas_selection_end_trim_event (GdkEvent
*event
, ArdourCanvas::Item
* item
, SelectionRect
* rect
)
730 switch (event
->type
) {
731 case GDK_BUTTON_PRESS
:
732 case GDK_2BUTTON_PRESS
:
733 case GDK_3BUTTON_PRESS
:
734 clicked_selection
= rect
->id
;
735 ret
= button_press_handler (item
, event
, EndSelectionTrimItem
);
737 case GDK_BUTTON_RELEASE
:
738 ret
= button_release_handler (item
, event
, EndSelectionTrimItem
);
740 case GDK_MOTION_NOTIFY
:
741 ret
= motion_handler (item
, event
);
743 case GDK_ENTER_NOTIFY
:
744 ret
= enter_handler (item
, event
, EndSelectionTrimItem
);
747 case GDK_LEAVE_NOTIFY
:
748 ret
= leave_handler (item
, event
, EndSelectionTrimItem
);
759 Editor::canvas_frame_handle_event (GdkEvent
* event
, ArdourCanvas::Item
* item
, RegionView
* rv
)
763 /* frame handles are not active when in internal edit mode, because actual notes
764 might be in the area occupied by the handle - we want them to be editable as normal.
767 if (internal_editing() || !rv
->sensitive()) {
771 /* NOTE: frame handles pretend to be the colored trim bar from an event handling
772 perspective. XXX change this ??
777 if (item
->get_data ("isleft")) {
778 type
= LeftFrameHandle
;
780 type
= RightFrameHandle
;
783 switch (event
->type
) {
784 case GDK_BUTTON_PRESS
:
785 case GDK_2BUTTON_PRESS
:
786 case GDK_3BUTTON_PRESS
:
787 clicked_regionview
= rv
;
788 clicked_control_point
= 0;
789 clicked_axisview
= &clicked_regionview
->get_time_axis_view();
790 clicked_routeview
= dynamic_cast<RouteTimeAxisView
*>(clicked_axisview
);
791 ret
= button_press_handler (item
, event
, type
);
793 case GDK_BUTTON_RELEASE
:
794 ret
= button_release_handler (item
, event
, type
);
796 case GDK_MOTION_NOTIFY
:
797 ret
= motion_handler (item
, event
);
799 case GDK_ENTER_NOTIFY
:
800 set_entered_regionview (rv
);
801 ret
= enter_handler (item
, event
, type
);
804 case GDK_LEAVE_NOTIFY
:
805 set_entered_regionview (0);
806 ret
= leave_handler (item
, event
, type
);
818 Editor::canvas_region_view_name_highlight_event (GdkEvent
* event
, ArdourCanvas::Item
* item
, RegionView
* rv
)
822 if (!rv
->sensitive()) {
826 switch (event
->type
) {
827 case GDK_BUTTON_PRESS
:
828 case GDK_2BUTTON_PRESS
:
829 case GDK_3BUTTON_PRESS
:
830 clicked_regionview
= rv
;
831 clicked_control_point
= 0;
832 clicked_axisview
= &clicked_regionview
->get_time_axis_view();
833 clicked_routeview
= dynamic_cast<RouteTimeAxisView
*>(clicked_axisview
);
834 ret
= button_press_handler (item
, event
, RegionViewNameHighlight
);
836 case GDK_BUTTON_RELEASE
:
837 ret
= button_release_handler (item
, event
, RegionViewNameHighlight
);
839 case GDK_MOTION_NOTIFY
:
840 motion_handler (item
, event
);
841 ret
= true; // force this to avoid progagating the event into the regionview
843 case GDK_ENTER_NOTIFY
:
844 set_entered_regionview (rv
);
845 ret
= enter_handler (item
, event
, RegionViewNameHighlight
);
848 case GDK_LEAVE_NOTIFY
:
849 set_entered_regionview (0);
850 ret
= leave_handler (item
, event
, RegionViewNameHighlight
);
861 Editor::canvas_region_view_name_event (GdkEvent
*event
, ArdourCanvas::Item
* item
, RegionView
* rv
)
865 if (!rv
->sensitive()) {
869 switch (event
->type
) {
870 case GDK_BUTTON_PRESS
:
871 case GDK_2BUTTON_PRESS
:
872 case GDK_3BUTTON_PRESS
:
873 clicked_regionview
= rv
;
874 clicked_control_point
= 0;
875 clicked_axisview
= &clicked_regionview
->get_time_axis_view();
876 clicked_routeview
= dynamic_cast<RouteTimeAxisView
*>(clicked_axisview
);
877 ret
= button_press_handler (item
, event
, RegionViewName
);
879 case GDK_BUTTON_RELEASE
:
880 ret
= button_release_handler (item
, event
, RegionViewName
);
882 case GDK_MOTION_NOTIFY
:
883 ret
= motion_handler (item
, event
);
885 case GDK_ENTER_NOTIFY
:
886 set_entered_regionview (rv
);
887 ret
= enter_handler (item
, event
, RegionViewName
);
890 case GDK_LEAVE_NOTIFY
:
891 set_entered_regionview (0);
892 ret
= leave_handler (item
, event
, RegionViewName
);
903 Editor::canvas_feature_line_event (GdkEvent
*event
, ArdourCanvas::Item
* item
, RegionView
*rv
)
907 switch (event
->type
) {
908 case GDK_BUTTON_PRESS
:
909 case GDK_2BUTTON_PRESS
:
910 case GDK_3BUTTON_PRESS
:
911 clicked_regionview
= 0;
912 clicked_control_point
= 0;
913 clicked_axisview
= 0;
914 clicked_routeview
= 0; //dynamic_cast<RouteTimeAxisView*>(clicked_axisview);
915 ret
= button_press_handler (item
, event
, FeatureLineItem
);
918 case GDK_BUTTON_RELEASE
:
919 ret
= button_release_handler (item
, event
, FeatureLineItem
);
922 case GDK_MOTION_NOTIFY
:
923 ret
= motion_handler (item
, event
);
926 case GDK_ENTER_NOTIFY
:
927 ret
= enter_handler (item
, event
, FeatureLineItem
);
930 case GDK_LEAVE_NOTIFY
:
931 ret
= leave_handler (item
, event
, FeatureLineItem
);
942 Editor::canvas_marker_event (GdkEvent
*event
, ArdourCanvas::Item
* item
, Marker
* /*marker*/)
944 return typed_event (item
, event
, MarkerItem
);
948 Editor::canvas_marker_bar_event (GdkEvent
*event
, ArdourCanvas::Item
* item
)
950 return typed_event (item
, event
, MarkerBarItem
);
954 Editor::canvas_range_marker_bar_event (GdkEvent
*event
, ArdourCanvas::Item
* item
)
956 return typed_event (item
, event
, RangeMarkerBarItem
);
960 Editor::canvas_transport_marker_bar_event (GdkEvent
*event
, ArdourCanvas::Item
* item
)
962 return typed_event (item
, event
, TransportMarkerBarItem
);
966 Editor::canvas_cd_marker_bar_event (GdkEvent
*event
, ArdourCanvas::Item
* item
)
968 return typed_event (item
, event
, CdMarkerBarItem
);
972 Editor::canvas_tempo_marker_event (GdkEvent
*event
, ArdourCanvas::Item
* item
, TempoMarker
* /*marker*/)
974 return typed_event (item
, event
, TempoMarkerItem
);
978 Editor::canvas_meter_marker_event (GdkEvent
*event
, ArdourCanvas::Item
* item
, MeterMarker
* /*marker*/)
980 return typed_event (item
, event
, MeterMarkerItem
);
984 Editor::canvas_tempo_bar_event (GdkEvent
*event
, ArdourCanvas::Item
* item
)
986 return typed_event (item
, event
, TempoBarItem
);
990 Editor::canvas_meter_bar_event (GdkEvent
*event
, ArdourCanvas::Item
* item
)
992 return typed_event (item
, event
, MeterBarItem
);
996 Editor::canvas_playhead_cursor_event (GdkEvent
*event
, ArdourCanvas::Item
* item
)
998 return typed_event (item
, event
, PlayheadCursorItem
);
1002 Editor::canvas_zoom_rect_event (GdkEvent
*event
, ArdourCanvas::Item
* item
)
1004 return typed_event (item
, event
, NoItem
);
1008 Editor::canvas_note_event (GdkEvent
*event
, ArdourCanvas::Item
* item
)
1010 if (!internal_editing()) {
1014 return typed_event (item
, event
, NoteItem
);
1018 Editor::track_canvas_drag_motion (Glib::RefPtr
<Gdk::DragContext
> const & /*c*/, int x
, int y
, guint
/*time*/)
1022 track_canvas
->window_to_world (x
, y
, wx
, wy
);
1025 event
.type
= GDK_MOTION_NOTIFY
;
1026 event
.button
.x
= wx
;
1027 event
.button
.y
= wy
;
1028 /* assume we're dragging with button 1 */
1029 event
.motion
.state
= Gdk::BUTTON1_MASK
;
1031 if (!_drags
->active ()) {
1035 nframes64_t
const pos
= event_frame (&event
, &px
, &py
);
1037 std::pair
<TimeAxisView
*, int> const tv
= trackview_by_y_position (py
);
1038 if (tv
.first
== 0) {
1042 RouteTimeAxisView
* rtav
= dynamic_cast<RouteTimeAxisView
*> (tv
.first
);
1043 if (rtav
== 0 || !rtav
->is_track ()) {
1047 boost::shared_ptr
<Region
> region
= _regions
->get_dragged_region ();
1053 boost::shared_ptr
<Region
> region_copy
= RegionFactory::create (region
);
1055 if (boost::dynamic_pointer_cast
<AudioRegion
> (region_copy
) != 0 &&
1056 dynamic_cast<AudioTimeAxisView
*> (tv
.first
) == 0) {
1058 /* audio -> non-audio */
1062 if (boost::dynamic_pointer_cast
<MidiRegion
> (region_copy
) == 0 &&
1063 dynamic_cast<MidiTimeAxisView
*> (tv
.first
) != 0) {
1065 /* MIDI -> non-MIDI */
1069 _drags
->set (new RegionInsertDrag (this, region_copy
, rtav
, pos
), &event
);
1072 _drags
->motion_handler (&event
, false);