13
0

framework for handling events on the xfade rects

git-svn-id: svn://localhost/ardour2/branches/3.0@12213 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-05-08 17:13:59 +00:00
parent 365658e734
commit 7bc425fd0d
7 changed files with 84 additions and 0 deletions

View File

@ -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);

View File

@ -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()) {

View File

@ -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*);

View File

@ -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<RouteTimeAxisView*>(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<RouteTimeAxisView*>(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)
{

View File

@ -50,6 +50,8 @@ enum ItemType {
FeatureLineItem,
LeftFrameHandle,
RightFrameHandle,
StartCrossFadeItem,
EndCrossFadeItem,
#ifdef WITH_CMT
MarkerViewItem,

View File

@ -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:

View File

@ -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;