diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index 48c9b5d12d..5c25377a35 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -1555,6 +1555,7 @@ AudioRegionView::redraw_start_xfade () start_xfade_rect->property_fill() = true;; start_xfade_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_ActiveCrossfade.get(); start_xfade_rect->property_outline_pixels() = 0; + start_xfade_rect->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_start_xfade_event), start_xfade_rect, this)); } Points* points = get_canvas_points ("xfade edit redraw", npoints); @@ -1642,6 +1643,8 @@ AudioRegionView::redraw_end_xfade () end_xfade_rect->property_fill() = true;; end_xfade_rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_ActiveCrossfade.get(); end_xfade_rect->property_outline_pixels() = 0; + + end_xfade_rect->signal_event().connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_end_xfade_event), end_xfade_rect, this)); } Points* points = get_canvas_points ("xfade edit redraw", npoints); diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index f6450a91e9..1bee0719ed 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -1358,6 +1358,9 @@ Editor::popup_fade_context_menu (int button, int32_t time, ArdourCanvas::Item* i items.clear (); switch (item_type) { + case StartCrossFadeItem: + case EndCrossFadeItem: + break; case FadeInItem: case FadeInHandleItem: if (arv->audio_region()->fade_in_active()) { diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 589b0ead6c..82fa3c41af 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1374,6 +1374,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD bool canvas_selection_rect_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*); bool canvas_selection_start_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*); bool canvas_selection_end_trim_event (GdkEvent* event,ArdourCanvas::Item*, SelectionRect*); + bool canvas_start_xfade_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*); + bool canvas_end_xfade_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*); bool canvas_fade_in_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*); bool canvas_fade_in_handle_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*); bool canvas_fade_out_event (GdkEvent* event,ArdourCanvas::Item*, AudioRegionView*); diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc index 72de353500..a123ea1e9c 100644 --- a/gtk2_ardour/editor_canvas_events.cc +++ b/gtk2_ardour/editor_canvas_events.cc @@ -348,6 +348,74 @@ Editor::canvas_automation_track_event (GdkEvent *event, ArdourCanvas::Item* item return ret; } +bool +Editor::canvas_start_xfade_event (GdkEvent *event, ArdourCanvas::Item* item, AudioRegionView *rv) +{ + if (!rv->sensitive()) { + return false; + } + + switch (event->type) { + case GDK_BUTTON_PRESS: + clicked_regionview = rv; + clicked_control_point = 0; + clicked_axisview = &rv->get_time_axis_view(); + clicked_routeview = dynamic_cast(clicked_axisview); + if (event->button.button == 3) { + return button_press_handler (item, event, StartCrossFadeItem); + } + break; + + case GDK_BUTTON_RELEASE: + if (event->button.button == 3) { + return button_release_handler (item, event, StartCrossFadeItem); + } + break; + + default: + break; + + } + + /* proxy for the regionview */ + + return canvas_region_view_event (event, rv->get_canvas_group(), rv); +} + +bool +Editor::canvas_end_xfade_event (GdkEvent *event, ArdourCanvas::Item* item, AudioRegionView *rv) +{ + if (!rv->sensitive()) { + return false; + } + + switch (event->type) { + case GDK_BUTTON_PRESS: + clicked_regionview = rv; + clicked_control_point = 0; + clicked_axisview = &rv->get_time_axis_view(); + clicked_routeview = dynamic_cast(clicked_axisview); + if (event->button.button == 3) { + return button_press_handler (item, event, EndCrossFadeItem); + } + break; + + case GDK_BUTTON_RELEASE: + if (event->button.button == 3) { + return button_release_handler (item, event, EndCrossFadeItem); + } + break; + + default: + break; + + } + + /* proxy for the regionview */ + + return canvas_region_view_event (event, rv->get_canvas_group(), rv); +} + bool Editor::canvas_fade_in_event (GdkEvent *event, ArdourCanvas::Item* item, AudioRegionView *rv) { diff --git a/gtk2_ardour/editor_items.h b/gtk2_ardour/editor_items.h index 36a5a9e36f..51db6dbc87 100644 --- a/gtk2_ardour/editor_items.h +++ b/gtk2_ardour/editor_items.h @@ -50,6 +50,8 @@ enum ItemType { FeatureLineItem, LeftFrameHandle, RightFrameHandle, + StartCrossFadeItem, + EndCrossFadeItem, #ifdef WITH_CMT MarkerViewItem, diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index bd5cdd3f8f..351ed82e64 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -641,6 +641,10 @@ Editor::button_selection (ArdourCanvas::Item* /*item*/, GdkEvent* event, ItemTyp break; + case StartCrossFadeItem: + case EndCrossFadeItem: + break; + case FadeInHandleItem: case FadeInItem: case FadeOutHandleItem: diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index ee4c7162cb..ce625e1889 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -314,6 +314,8 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible { virtual bool canvas_selection_rect_event (GdkEvent* event, ArdourCanvas::Item*, SelectionRect*) = 0; virtual bool canvas_selection_start_trim_event (GdkEvent* event, ArdourCanvas::Item*, SelectionRect*) = 0; virtual bool canvas_selection_end_trim_event (GdkEvent* event, ArdourCanvas::Item*, SelectionRect*) = 0; + virtual bool canvas_start_xfade_event (GdkEvent* event, ArdourCanvas::Item*, AudioRegionView*) = 0; + virtual bool canvas_end_xfade_event (GdkEvent* event, ArdourCanvas::Item*, AudioRegionView*) = 0; virtual bool canvas_fade_in_event (GdkEvent* event, ArdourCanvas::Item*, AudioRegionView*) = 0; virtual bool canvas_fade_in_handle_event (GdkEvent* event, ArdourCanvas::Item*, AudioRegionView*) = 0; virtual bool canvas_fade_out_event (GdkEvent* event, ArdourCanvas::Item*, AudioRegionView*) = 0;