2005-09-25 14:42:24 -04:00
|
|
|
/*
|
|
|
|
Copyright (C) 2000 Paul Davis
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
$Id$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <cmath>
|
|
|
|
|
2006-06-14 17:17:32 -04:00
|
|
|
#include <ardour/audio_diskstream.h>
|
2005-09-25 14:42:24 -04:00
|
|
|
#include <ardour/audioplaylist.h>
|
|
|
|
|
|
|
|
#include "editor.h"
|
2007-02-08 22:36:00 -05:00
|
|
|
#include "keyboard.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "public_editor.h"
|
2006-07-31 23:23:35 -04:00
|
|
|
#include "audio_region_view.h"
|
|
|
|
#include "audio_streamview.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
#include "crossfade_view.h"
|
|
|
|
#include "audio_time_axis.h"
|
|
|
|
#include "region_gain_line.h"
|
|
|
|
#include "automation_gain_line.h"
|
|
|
|
#include "automation_pan_line.h"
|
|
|
|
#include "automation_time_axis.h"
|
|
|
|
#include "redirect_automation_line.h"
|
2005-11-14 11:24:21 -05:00
|
|
|
#include "canvas_impl.h"
|
|
|
|
#include "simplerect.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
#include "i18n.h"
|
|
|
|
|
2005-09-25 16:33:00 -04:00
|
|
|
using namespace sigc;
|
2005-09-25 14:42:24 -04:00
|
|
|
using namespace ARDOUR;
|
2006-06-21 19:01:03 -04:00
|
|
|
using namespace PBD;
|
2005-09-25 14:42:24 -04:00
|
|
|
using namespace Gtk;
|
|
|
|
|
2005-12-23 21:17:47 -05:00
|
|
|
bool
|
|
|
|
Editor::track_canvas_scroll (GdkEventScroll* ev)
|
|
|
|
{
|
2006-01-20 19:11:03 -05:00
|
|
|
int x, y;
|
|
|
|
double wx, wy;
|
2006-04-09 22:14:05 -04:00
|
|
|
|
2005-12-23 21:17:47 -05:00
|
|
|
switch (ev->direction) {
|
|
|
|
case GDK_SCROLL_UP:
|
2006-05-19 16:10:35 -04:00
|
|
|
if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) {
|
|
|
|
//if (ev->state == GDK_CONTROL_MASK) {
|
|
|
|
/* XXX
|
|
|
|
the ev->x will be out of step with the canvas
|
|
|
|
if we're in mid zoom, so we have to get the damn mouse
|
|
|
|
pointer again
|
|
|
|
*/
|
|
|
|
track_canvas.get_pointer (x, y);
|
|
|
|
track_canvas.window_to_world (x, y, wx, wy);
|
|
|
|
wx += horizontal_adjustment.get_value();
|
|
|
|
wy += vertical_adjustment.get_value();
|
|
|
|
|
|
|
|
GdkEvent event;
|
|
|
|
event.type = GDK_BUTTON_RELEASE;
|
|
|
|
event.button.x = wx;
|
|
|
|
event.button.y = wy;
|
|
|
|
|
2006-09-28 13:23:52 -04:00
|
|
|
nframes_t where = event_frame (&event, 0, 0);
|
2006-05-19 16:10:35 -04:00
|
|
|
temporal_zoom_to_frame (true, where);
|
|
|
|
return true;
|
|
|
|
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::Shift)) {
|
|
|
|
if (!current_stepping_trackview) {
|
|
|
|
step_timeout = Glib::signal_timeout().connect (mem_fun(*this, &Editor::track_height_step_timeout), 500);
|
2006-12-19 10:42:42 -05:00
|
|
|
if (!(current_stepping_trackview = trackview_by_y_position (ev->y))) {
|
2006-05-19 16:10:35 -04:00
|
|
|
return false;
|
|
|
|
}
|
2006-04-09 22:14:05 -04:00
|
|
|
}
|
2006-05-19 16:10:35 -04:00
|
|
|
gettimeofday (&last_track_height_step_timestamp, 0);
|
|
|
|
current_stepping_trackview->step_height (true);
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
scroll_tracks_up_line ();
|
|
|
|
return true;
|
2006-04-09 22:14:05 -04:00
|
|
|
}
|
2006-05-19 16:10:35 -04:00
|
|
|
break;
|
2005-12-23 21:17:47 -05:00
|
|
|
case GDK_SCROLL_DOWN:
|
2006-05-19 16:10:35 -04:00
|
|
|
if (Keyboard::modifier_state_equals (ev->state, Keyboard::Control)) {
|
|
|
|
//if (ev->state == GDK_CONTROL_MASK) {
|
|
|
|
track_canvas.get_pointer (x, y);
|
|
|
|
track_canvas.window_to_world (x, y, wx, wy);
|
|
|
|
wx += horizontal_adjustment.get_value();
|
|
|
|
wy += vertical_adjustment.get_value();
|
|
|
|
|
|
|
|
GdkEvent event;
|
|
|
|
event.type = GDK_BUTTON_RELEASE;
|
|
|
|
event.button.x = wx;
|
|
|
|
event.button.y = wy;
|
|
|
|
|
2006-09-28 13:23:52 -04:00
|
|
|
nframes_t where = event_frame (&event, 0, 0);
|
2006-05-19 16:10:35 -04:00
|
|
|
temporal_zoom_to_frame (false, where);
|
|
|
|
return true;
|
|
|
|
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::Shift)) {
|
|
|
|
if (!current_stepping_trackview) {
|
|
|
|
step_timeout = Glib::signal_timeout().connect (mem_fun(*this, &Editor::track_height_step_timeout), 500);
|
2006-12-19 10:42:42 -05:00
|
|
|
if (!(current_stepping_trackview = trackview_by_y_position (ev->y))) {
|
2006-05-19 16:10:35 -04:00
|
|
|
return false;
|
|
|
|
}
|
2006-04-09 22:14:05 -04:00
|
|
|
}
|
2006-05-19 16:10:35 -04:00
|
|
|
gettimeofday (&last_track_height_step_timestamp, 0);
|
|
|
|
current_stepping_trackview->step_height (false);
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
scroll_tracks_down_line ();
|
|
|
|
return true;
|
2006-01-20 19:11:03 -05:00
|
|
|
}
|
2006-05-19 16:10:35 -04:00
|
|
|
break;
|
|
|
|
|
2005-12-23 21:17:47 -05:00
|
|
|
default:
|
|
|
|
/* no left/right handling yet */
|
|
|
|
break;
|
|
|
|
}
|
2006-05-19 16:10:35 -04:00
|
|
|
|
2005-12-23 21:17:47 -05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
|
|
|
Editor::track_canvas_event (GdkEvent *event, ArdourCanvas::Item* item)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
gint x, y;
|
|
|
|
|
2005-12-23 21:17:47 -05:00
|
|
|
/* this is the handler for events that are not handled by
|
|
|
|
items.
|
|
|
|
*/
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
switch (event->type) {
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
/* keep those motion events coming */
|
2005-11-14 11:24:21 -05:00
|
|
|
track_canvas.get_pointer (x, y);
|
|
|
|
return track_canvas_motion (event);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-01-04 22:18:44 -05:00
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
track_canvas.grab_focus();
|
|
|
|
break;
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
switch (event->button.button) {
|
|
|
|
case 4:
|
|
|
|
case 5:
|
|
|
|
button_release_handler (item, event, NoItem);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2005-12-23 21:17:47 -05:00
|
|
|
case GDK_SCROLL:
|
2006-01-04 22:18:44 -05:00
|
|
|
track_canvas.grab_focus();
|
2005-12-23 21:17:47 -05:00
|
|
|
track_canvas_scroll (&event->scroll);
|
|
|
|
break;
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
|
|
|
Editor::track_canvas_motion (GdkEvent *ev)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
if (verbose_cursor_visible) {
|
2005-11-27 17:35:04 -05:00
|
|
|
verbose_canvas_cursor->property_x() = ev->motion.x + 20;
|
|
|
|
verbose_canvas_cursor->property_y() = ev->motion.y + 20;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
2005-11-14 11:24:21 -05:00
|
|
|
return false;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
|
|
|
Editor::typed_event (ArdourCanvas::Item* item, GdkEvent *event, ItemType type)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
gint ret = FALSE;
|
|
|
|
|
|
|
|
switch (event->type) {
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
case GDK_3BUTTON_PRESS:
|
|
|
|
ret = button_press_handler (item, event, type);
|
|
|
|
break;
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
ret = button_release_handler (item, event, type);
|
|
|
|
break;
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
ret = motion_handler (item, event, type);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
ret = enter_handler (item, event, type);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
|
|
|
ret = leave_handler (item, event, type);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
2006-07-31 23:23:35 -04:00
|
|
|
Editor::canvas_region_view_event (GdkEvent *event, ArdourCanvas::Item* item, RegionView *rv)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
gint ret = FALSE;
|
2005-12-29 19:34:21 -05:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
switch (event->type) {
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
case GDK_3BUTTON_PRESS:
|
|
|
|
clicked_regionview = rv;
|
|
|
|
clicked_control_point = 0;
|
|
|
|
clicked_trackview = &rv->get_time_axis_view();
|
|
|
|
clicked_audio_trackview = dynamic_cast<AudioTimeAxisView*>(clicked_trackview);
|
|
|
|
ret = button_press_handler (item, event, RegionItem);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
ret = button_release_handler (item, event, RegionItem);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
ret = motion_handler (item, event, RegionItem);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
set_entered_regionview (rv);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
|
|
|
set_entered_regionview (0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
2006-07-31 23:23:35 -04:00
|
|
|
Editor::canvas_stream_view_event (GdkEvent *event, ArdourCanvas::Item* item, RouteTimeAxisView *tv)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2005-11-14 11:24:21 -05:00
|
|
|
bool ret = FALSE;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
switch (event->type) {
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
case GDK_3BUTTON_PRESS:
|
|
|
|
clicked_regionview = 0;
|
|
|
|
clicked_control_point = 0;
|
|
|
|
clicked_trackview = tv;
|
2006-07-31 23:23:35 -04:00
|
|
|
clicked_audio_trackview = dynamic_cast<AudioTimeAxisView*>(tv);
|
2005-09-25 14:42:24 -04:00
|
|
|
ret = button_press_handler (item, event, StreamItem);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
ret = button_release_handler (item, event, StreamItem);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
ret = motion_handler (item, event, StreamItem);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_automation_track_event (GdkEvent *event, ArdourCanvas::Item* item, AutomationTimeAxisView *atv)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2005-11-14 11:24:21 -05:00
|
|
|
bool ret = false;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
switch (event->type) {
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
case GDK_3BUTTON_PRESS:
|
|
|
|
clicked_regionview = 0;
|
|
|
|
clicked_control_point = 0;
|
|
|
|
clicked_trackview = atv;
|
|
|
|
clicked_audio_trackview = 0;
|
|
|
|
ret = button_press_handler (item, event, AutomationTrackItem);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
ret = button_release_handler (item, event, AutomationTrackItem);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
ret = motion_handler (item, event, AutomationTrackItem);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
ret = enter_handler (item, event, AutomationTrackItem);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
|
|
|
ret = leave_handler (item, event, AutomationTrackItem);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_fade_in_event (GdkEvent *event, ArdourCanvas::Item* item, AudioRegionView *rv)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
/* we handle only button 3 press/release events */
|
|
|
|
|
|
|
|
switch (event->type) {
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
clicked_regionview = rv;
|
|
|
|
clicked_control_point = 0;
|
|
|
|
clicked_trackview = &rv->get_time_axis_view();
|
|
|
|
clicked_audio_trackview = dynamic_cast<AudioTimeAxisView*>(clicked_trackview);
|
|
|
|
if (event->button.button == 3) {
|
|
|
|
return button_press_handler (item, event, FadeInItem);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
if (event->button.button == 3) {
|
|
|
|
return button_release_handler (item, event, FadeInItem);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* proxy for the regionview */
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
return canvas_region_view_event (event, rv->get_canvas_group(), rv);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_fade_in_handle_event (GdkEvent *event, ArdourCanvas::Item* item, AudioRegionView *rv)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2005-11-14 11:24:21 -05:00
|
|
|
bool ret = false;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
switch (event->type) {
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
case GDK_3BUTTON_PRESS:
|
|
|
|
clicked_regionview = rv;
|
|
|
|
clicked_control_point = 0;
|
|
|
|
clicked_trackview = &rv->get_time_axis_view();
|
|
|
|
clicked_audio_trackview = dynamic_cast<AudioTimeAxisView*>(clicked_trackview);
|
|
|
|
ret = button_press_handler (item, event, FadeInHandleItem);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
ret = button_release_handler (item, event, FadeInHandleItem);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
ret = motion_handler (item, event, FadeInHandleItem);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
ret = enter_handler (item, event, FadeInHandleItem);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
|
|
|
ret = leave_handler (item, event, FadeInHandleItem);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_fade_out_event (GdkEvent *event, ArdourCanvas::Item* item, AudioRegionView *rv)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
/* we handle only button 3 press/release events */
|
|
|
|
|
|
|
|
switch (event->type) {
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
clicked_regionview = rv;
|
|
|
|
clicked_control_point = 0;
|
|
|
|
clicked_trackview = &rv->get_time_axis_view();
|
|
|
|
clicked_audio_trackview = dynamic_cast<AudioTimeAxisView*>(clicked_trackview);
|
|
|
|
if (event->button.button == 3) {
|
|
|
|
return button_press_handler (item, event, FadeOutItem);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
if (event->button.button == 3) {
|
|
|
|
return button_release_handler (item, event, FadeOutItem);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* proxy for the regionview */
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
return canvas_region_view_event (event, rv->get_canvas_group(), rv);
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_fade_out_handle_event (GdkEvent *event, ArdourCanvas::Item* item, AudioRegionView *rv)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2005-11-14 11:24:21 -05:00
|
|
|
bool ret = false;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
switch (event->type) {
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
case GDK_3BUTTON_PRESS:
|
|
|
|
clicked_regionview = rv;
|
|
|
|
clicked_control_point = 0;
|
|
|
|
clicked_trackview = &rv->get_time_axis_view();
|
|
|
|
clicked_audio_trackview = dynamic_cast<AudioTimeAxisView*>(clicked_trackview);
|
|
|
|
ret = button_press_handler (item, event, FadeOutHandleItem);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
ret = button_release_handler (item, event, FadeOutHandleItem);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
ret = motion_handler (item, event, FadeOutHandleItem);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
ret = enter_handler (item, event, FadeOutHandleItem);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
|
|
|
ret = leave_handler (item, event, FadeOutHandleItem);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct DescendingRegionLayerSorter {
|
2006-08-24 21:07:15 -04:00
|
|
|
bool operator()(boost::shared_ptr<Region> a, boost::shared_ptr<Region> b) {
|
2005-09-25 14:42:24 -04:00
|
|
|
return a->layer() > b->layer();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_crossfade_view_event (GdkEvent* event, ArdourCanvas::Item* item, CrossfadeView* xfv)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
/* we handle only button 3 press/release events */
|
|
|
|
|
|
|
|
switch (event->type) {
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
clicked_crossfadeview = xfv;
|
|
|
|
clicked_trackview = &clicked_crossfadeview->get_time_axis_view();
|
|
|
|
if (event->button.button == 3) {
|
|
|
|
return button_press_handler (item, event, CrossfadeViewItem);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
if (event->button.button == 3) {
|
2005-11-14 11:24:21 -05:00
|
|
|
bool ret = button_release_handler (item, event, CrossfadeViewItem);
|
2005-09-25 14:42:24 -04:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* proxy for the upper most regionview */
|
|
|
|
|
|
|
|
/* XXX really need to check if we are in the name highlight,
|
|
|
|
and proxy to that when required.
|
|
|
|
*/
|
|
|
|
|
|
|
|
TimeAxisView& tv (xfv->get_time_axis_view());
|
|
|
|
AudioTimeAxisView* atv;
|
|
|
|
|
|
|
|
if ((atv = dynamic_cast<AudioTimeAxisView*>(&tv)) != 0) {
|
|
|
|
|
|
|
|
if (atv->is_audio_track()) {
|
|
|
|
|
2006-12-14 09:15:43 -05:00
|
|
|
boost::shared_ptr<AudioPlaylist> pl;
|
|
|
|
if ((pl = boost::dynamic_pointer_cast<AudioPlaylist> (atv->get_diskstream()->playlist())) != 0) {
|
2006-07-31 23:23:35 -04:00
|
|
|
|
|
|
|
Playlist::RegionList* rl = pl->regions_at (event_frame (event));
|
|
|
|
|
|
|
|
if (!rl->empty()) {
|
|
|
|
DescendingRegionLayerSorter cmp;
|
|
|
|
rl->sort (cmp);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-08-24 21:07:15 -04:00
|
|
|
RegionView* rv = atv->view()->find_view (rl->front());
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-07-31 23:23:35 -04:00
|
|
|
/* proxy */
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-07-31 23:23:35 -04:00
|
|
|
delete rl;
|
|
|
|
|
|
|
|
return canvas_region_view_event (event, rv->get_canvas_group(), rv);
|
|
|
|
}
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_control_point_event (GdkEvent *event, ArdourCanvas::Item* item, ControlPoint* cp)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
ItemType type;
|
2005-11-14 11:24:21 -05:00
|
|
|
|
|
|
|
switch (event->type) {
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
case GDK_3BUTTON_PRESS:
|
|
|
|
clicked_control_point = cp;
|
|
|
|
clicked_trackview = &cp->line.trackview;
|
|
|
|
clicked_audio_trackview = dynamic_cast<AudioTimeAxisView*>(clicked_trackview);
|
|
|
|
clicked_regionview = 0;
|
|
|
|
break;
|
|
|
|
|
2006-05-19 16:10:35 -04:00
|
|
|
case GDK_SCROLL_UP:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_SCROLL_DOWN:
|
|
|
|
break;
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
default:
|
|
|
|
break;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (dynamic_cast<AudioRegionGainLine*> (&cp->line) != 0) {
|
|
|
|
type = GainControlPointItem;
|
|
|
|
} else if (dynamic_cast<AutomationGainLine*> (&cp->line) != 0) {
|
|
|
|
type = GainAutomationControlPointItem;
|
|
|
|
} else if (dynamic_cast<AutomationPanLine*> (&cp->line) != 0) {
|
|
|
|
type = PanAutomationControlPointItem;
|
|
|
|
} else if (dynamic_cast<RedirectAutomationLine*> (&cp->line) != 0) {
|
|
|
|
type = RedirectAutomationControlPointItem;
|
|
|
|
} else {
|
2005-11-14 11:24:21 -05:00
|
|
|
return false;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return typed_event (item, event, type);
|
|
|
|
}
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_line_event (GdkEvent *event, ArdourCanvas::Item* item, AutomationLine* al)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
ItemType type;
|
|
|
|
|
|
|
|
if (dynamic_cast<AudioRegionGainLine*> (al) != 0) {
|
|
|
|
type = GainLineItem;
|
|
|
|
} else if (dynamic_cast<AutomationGainLine*> (al) != 0) {
|
|
|
|
type = GainAutomationLineItem;
|
|
|
|
} else if (dynamic_cast<AutomationPanLine*> (al) != 0) {
|
|
|
|
type = PanAutomationLineItem;
|
|
|
|
} else if (dynamic_cast<RedirectAutomationLine*> (al) != 0) {
|
|
|
|
type = RedirectAutomationLineItem;
|
|
|
|
} else {
|
2005-11-14 11:24:21 -05:00
|
|
|
return false;
|
2005-09-25 14:42:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return typed_event (item, event, type);
|
|
|
|
}
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_selection_rect_event (GdkEvent *event, ArdourCanvas::Item* item, SelectionRect* rect)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2005-11-14 11:24:21 -05:00
|
|
|
bool ret = false;
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
switch (event->type) {
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
case GDK_3BUTTON_PRESS:
|
|
|
|
clicked_selection = rect->id;
|
|
|
|
ret = button_press_handler (item, event, SelectionItem);
|
|
|
|
break;
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
ret = button_release_handler (item, event, SelectionItem);
|
|
|
|
break;
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
ret = motion_handler (item, event, SelectionItem);
|
|
|
|
break;
|
|
|
|
/* Don't need these at the moment. */
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
ret = enter_handler (item, event, SelectionItem);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
|
|
|
ret = leave_handler (item, event, SelectionItem);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_selection_start_trim_event (GdkEvent *event, ArdourCanvas::Item* item, SelectionRect* rect)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2005-11-14 11:24:21 -05:00
|
|
|
bool ret = false;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
switch (event->type) {
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
case GDK_3BUTTON_PRESS:
|
|
|
|
clicked_selection = rect->id;
|
|
|
|
ret = button_press_handler (item, event, StartSelectionTrimItem);
|
|
|
|
break;
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
ret = button_release_handler (item, event, StartSelectionTrimItem);
|
|
|
|
break;
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
ret = motion_handler (item, event, StartSelectionTrimItem);
|
|
|
|
break;
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
ret = enter_handler (item, event, StartSelectionTrimItem);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
|
|
|
ret = leave_handler (item, event, StartSelectionTrimItem);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_selection_end_trim_event (GdkEvent *event, ArdourCanvas::Item* item, SelectionRect* rect)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2005-11-14 11:24:21 -05:00
|
|
|
bool ret = false;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
switch (event->type) {
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
case GDK_3BUTTON_PRESS:
|
|
|
|
clicked_selection = rect->id;
|
|
|
|
ret = button_press_handler (item, event, EndSelectionTrimItem);
|
|
|
|
break;
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
ret = button_release_handler (item, event, EndSelectionTrimItem);
|
|
|
|
break;
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
ret = motion_handler (item, event, EndSelectionTrimItem);
|
|
|
|
break;
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
ret = enter_handler (item, event, EndSelectionTrimItem);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
|
|
|
ret = leave_handler (item, event, EndSelectionTrimItem);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
2006-07-31 23:23:35 -04:00
|
|
|
Editor::canvas_region_view_name_highlight_event (GdkEvent* event, ArdourCanvas::Item* item, RegionView* rv)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2005-11-14 11:24:21 -05:00
|
|
|
bool ret = false;
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
switch (event->type) {
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
case GDK_3BUTTON_PRESS:
|
2005-11-14 11:24:21 -05:00
|
|
|
clicked_regionview = rv;
|
2005-09-25 14:42:24 -04:00
|
|
|
clicked_control_point = 0;
|
|
|
|
clicked_trackview = &clicked_regionview->get_time_axis_view();
|
|
|
|
clicked_audio_trackview = dynamic_cast<AudioTimeAxisView*>(clicked_trackview);
|
2006-07-31 23:23:35 -04:00
|
|
|
ret = button_press_handler (item, event, RegionViewNameHighlight);
|
2005-09-25 14:42:24 -04:00
|
|
|
break;
|
|
|
|
case GDK_BUTTON_RELEASE:
|
2006-07-31 23:23:35 -04:00
|
|
|
ret = button_release_handler (item, event, RegionViewNameHighlight);
|
2005-09-25 14:42:24 -04:00
|
|
|
break;
|
|
|
|
case GDK_MOTION_NOTIFY:
|
2006-07-31 23:23:35 -04:00
|
|
|
ret = motion_handler (item, event, RegionViewNameHighlight);
|
2005-09-25 14:42:24 -04:00
|
|
|
break;
|
|
|
|
case GDK_ENTER_NOTIFY:
|
2006-07-31 23:23:35 -04:00
|
|
|
ret = enter_handler (item, event, RegionViewNameHighlight);
|
2005-09-25 14:42:24 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
2006-07-31 23:23:35 -04:00
|
|
|
ret = leave_handler (item, event, RegionViewNameHighlight);
|
2005-09-25 14:42:24 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
2006-07-31 23:23:35 -04:00
|
|
|
Editor::canvas_region_view_name_event (GdkEvent *event, ArdourCanvas::Item* item, RegionView* rv)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
2005-11-14 11:24:21 -05:00
|
|
|
bool ret = false;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
switch (event->type) {
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
case GDK_3BUTTON_PRESS:
|
2005-11-14 11:24:21 -05:00
|
|
|
clicked_regionview = rv;
|
2005-09-25 14:42:24 -04:00
|
|
|
clicked_control_point = 0;
|
|
|
|
clicked_trackview = &clicked_regionview->get_time_axis_view();
|
|
|
|
clicked_audio_trackview = dynamic_cast<AudioTimeAxisView*>(clicked_trackview);
|
2006-07-31 23:23:35 -04:00
|
|
|
ret = button_press_handler (item, event, RegionViewName);
|
2005-09-25 14:42:24 -04:00
|
|
|
break;
|
|
|
|
case GDK_BUTTON_RELEASE:
|
2006-07-31 23:23:35 -04:00
|
|
|
ret = button_release_handler (item, event, RegionViewName);
|
2005-09-25 14:42:24 -04:00
|
|
|
break;
|
|
|
|
case GDK_MOTION_NOTIFY:
|
2006-07-31 23:23:35 -04:00
|
|
|
ret = motion_handler (item, event, RegionViewName);
|
2005-09-25 14:42:24 -04:00
|
|
|
break;
|
|
|
|
case GDK_ENTER_NOTIFY:
|
2006-07-31 23:23:35 -04:00
|
|
|
ret = enter_handler (item, event, RegionViewName);
|
2005-09-25 14:42:24 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
2006-07-31 23:23:35 -04:00
|
|
|
ret = leave_handler (item, event, RegionViewName);
|
2005-09-25 14:42:24 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_marker_event (GdkEvent *event, ArdourCanvas::Item* item, Marker* marker)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
return typed_event (item, event, MarkerItem);
|
|
|
|
}
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_marker_bar_event (GdkEvent *event, ArdourCanvas::Item* item)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
return typed_event (item, event, MarkerBarItem);
|
|
|
|
}
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_range_marker_bar_event (GdkEvent *event, ArdourCanvas::Item* item)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
return typed_event (item, event, RangeMarkerBarItem);
|
|
|
|
}
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_transport_marker_bar_event (GdkEvent *event, ArdourCanvas::Item* item)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
return typed_event (item, event, TransportMarkerBarItem);
|
|
|
|
}
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_tempo_marker_event (GdkEvent *event, ArdourCanvas::Item* item, TempoMarker* marker)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
return typed_event (item, event, TempoMarkerItem);
|
|
|
|
}
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_meter_marker_event (GdkEvent *event, ArdourCanvas::Item* item, MeterMarker* marker)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
return typed_event (item, event, MeterMarkerItem);
|
|
|
|
}
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_tempo_bar_event (GdkEvent *event, ArdourCanvas::Item* item)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
return typed_event (item, event, TempoBarItem);
|
|
|
|
}
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_meter_bar_event (GdkEvent *event, ArdourCanvas::Item* item)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
return typed_event (item, event, MeterBarItem);
|
|
|
|
}
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_playhead_cursor_event (GdkEvent *event, ArdourCanvas::Item* item)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
return typed_event (item, event, PlayheadCursorItem);
|
|
|
|
}
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_edit_cursor_event (GdkEvent *event, ArdourCanvas::Item* item)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
return typed_event (item, event, EditCursorItem);
|
|
|
|
}
|
|
|
|
|
2005-11-14 11:24:21 -05:00
|
|
|
bool
|
|
|
|
Editor::canvas_zoom_rect_event (GdkEvent *event, ArdourCanvas::Item* item)
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
return typed_event (item, event, NoItem);
|
|
|
|
}
|
|
|
|
|