2005-09-25 14:42:24 -04:00
/*
2019-08-02 17:26:43 -04:00
* Copyright ( C ) 2005 - 2018 Paul Davis < paul @ linuxaudiosystems . com >
* Copyright ( C ) 2005 Taybin Rutkin < taybin @ taybin . com >
* Copyright ( C ) 2006 - 2012 David Robillard < d @ drobilla . net >
* Copyright ( C ) 2008 Hans Baier < hansfbaier @ googlemail . com >
* Copyright ( C ) 2009 - 2012 Carl Hetherington < carl @ carlh . net >
* Copyright ( C ) 2013 - 2019 Robin Gareus < robin @ gareus . org >
* Copyright ( C ) 2015 - 2016 Tim Mayberry < mojofunk @ gmail . com >
* Copyright ( C ) 2015 - 2017 Nick Mainsbridge < mainsbridge @ gmail . com >
* Copyright ( C ) 2015 - 2019 Ben Loftis < ben @ harrisonconsoles . com >
*
* 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 . ,
* 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 USA .
*/
2005-09-25 14:42:24 -04:00
# include <cstdlib>
# include <cmath>
2008-02-02 12:22:04 -05:00
# include <algorithm>
2008-12-23 16:05:50 -05:00
# include <typeinfo>
2005-09-25 14:42:24 -04:00
2015-03-24 20:47:48 -04:00
# include "ardour/audio_track.h"
# include "ardour/midi_track.h"
2009-08-08 18:36:32 -04:00
# include "ardour/midi_region.h"
2013-03-21 16:33:02 -04:00
# include "ardour/profile.h"
2018-11-15 10:30:22 -05:00
# include "ardour/region_factory.h"
2005-09-25 14:42:24 -04:00
2013-04-04 00:32:52 -04:00
# include "canvas/canvas.h"
# include "canvas/text.h"
2014-06-26 15:04:59 -04:00
# include "canvas/scroll_group.h"
2013-04-04 00:32:52 -04:00
2005-09-25 14:42:24 -04:00
# include "editor.h"
2023-09-11 23:37:41 -04:00
# include "editor_sections.h"
2007-03-18 02:07:08 -04:00
# include "keyboard.h"
2005-09-25 14:42:24 -04:00
# include "public_editor.h"
2006-08-01 13:19:38 -04:00
# include "audio_region_view.h"
2006-07-23 08:03:19 -04:00
# include "audio_streamview.h"
2005-09-25 14:42:24 -04:00
# include "audio_time_axis.h"
# include "region_gain_line.h"
2007-06-30 14:41:50 -04:00
# include "automation_line.h"
2005-09-25 14:42:24 -04:00
# include "automation_time_axis.h"
2007-06-30 14:41:50 -04:00
# include "automation_line.h"
2007-07-06 23:19:04 -04:00
# include "control_point.h"
2009-05-30 14:25:59 -04:00
# include "editor_drag.h"
2009-06-08 15:28:51 -04:00
# include "midi_time_axis.h"
2009-07-03 18:42:22 -04:00
# include "editor_regions.h"
2018-11-15 10:24:37 -05:00
# include "editor_sources.h"
2015-01-02 09:44:54 -05:00
# include "ui_config.h"
2011-05-02 09:38:16 -04:00
# include "verbose_cursor.h"
2005-09-25 14:42:24 -04:00
2016-07-14 14:44:52 -04:00
# include "pbd/i18n.h"
2005-09-25 14:42:24 -04:00
2008-02-02 12:22:04 -05:00
using namespace std ;
2005-09-25 14:42:24 -04:00
using namespace ARDOUR ;
Large nasty commit in the form of a 5000 line patch chock-full of completely
unecessary changes. (Sorry, doing a "sprint" based thing, this is the end of the first one)
Achieved MIDI track and bus creation, associated Jack port and diskstream creation, and minimal GUI stuff for creating them. Should be set to start work on actually recording and playing midi to/from disk now.
Relevant (significant) changes:
- Creation of a Buffer class. Base class is type agnostic so things can point to a buffer but not care what kind it is (otherwise it'd be a template). Derived into AudioBuffer and MidiBuffer, with a type tag because checking type is necessary in parts of the code where dynamic_cast wouldn't be wise. Originally I considered this a hack, but passing around a type proved to be a very good solution to all the other problems (below). There is a 1:1 mapping between jack port data types and ardour Buffer types (with a conversion function), but that's easily removed if it ever becomes necessary. Having the type scoped in the Buffer class is maybe not the best spot for it, but whatever (this is proof of concept kinda stuff right now...)
- IO now has a "default" port type (passed to the constructor and stored as a member), used by ensure_io (and similar) to create n ports. IO::register_***_port has a type argument that defaults to the default type if not passed. Rationale: previous IO API is identical, no changes needed to existing code, but path is paved for multiple port types in one IO, which we will need for eg synth plugin inserts, among other things. This is not quite ideal (best would be to only have the two port register functions and have them take a type), but the alternative is a lot of work (namely destroying the 'ensure' functions and everything that uses them) for very little gain. (I am convinced after quite a few tries at the whiteboard that subclassing IO in any way is not a feasible option, look at it's inheritance diagram in Doxygen and you can see why)
- AudioEngine::register_audio_input_port is now register_input_port and takes a type argument. Ditto for output.
- (Most significant change) AudioDiskstream abstracted into Distream, and sibling MidiDiskstream created. Very much still a work in progress, but Diskstream is there to switch references over to (most already are), which is the important part. It is still unclear what the MIDI diskstream's relation to channels is, but I'm pretty sure they will be single channel only (so SMF Type 0) since noone can come up with a reason otherwise.
- MidiTrack creation. Same thing as AudioTrack but with a different default type basically. No big deal here.
- Random cleanups and variable renamings etc. because I have OCD and can't help myself. :)
Known broken: Loading of sessions containing MIDI tracks.
git-svn-id: svn://localhost/ardour2/branches/midi@641 d708f5d6-7413-0410-9779-e7cbd77b26cf
2006-06-26 12:01:34 -04:00
using namespace PBD ;
2005-09-25 14:42:24 -04:00
using namespace Gtk ;
2008-04-03 17:47:47 -04:00
using namespace ArdourCanvas ;
2005-09-25 14:42:24 -04:00
2009-12-04 17:51:32 -05:00
using Gtkmm2ext : : Keyboard ;
2005-12-23 21:17:47 -05:00
bool
Editor : : track_canvas_scroll ( GdkEventScroll * ev )
{
2008-01-10 16:20:59 -05:00
int direction = ev - > direction ;
2009-10-14 12:10:01 -04:00
2013-04-12 18:00:46 -04:00
/* this event arrives without transformation by the canvas, so we have
* to transform the coordinates to be able to look things up .
*/
Duple event_coords = _track_canvas - > window_to_canvas ( Duple ( ev - > x , ev - > y ) ) ;
2014-06-30 14:47:57 -04:00
2008-01-10 16:20:59 -05:00
switch ( direction ) {
2005-12-23 21:17:47 -05:00
case GDK_SCROLL_UP :
2013-06-21 15:13:44 -04:00
if ( Keyboard : : modifier_state_equals ( ev - > state , Keyboard : : ScrollZoomHorizontalModifier ) ) {
2020-04-17 14:51:25 -04:00
temporal_zoom_step_mouse_focus ( false ) ;
2006-05-19 16:10:35 -04:00
return true ;
2013-06-21 15:13:44 -04:00
} else if ( Keyboard : : modifier_state_equals ( ev - > state , Keyboard : : ScrollHorizontalModifier ) ) {
2016-01-07 00:44:24 -05:00
scroll_left_step ( ) ;
return true ;
2013-06-21 15:13:44 -04:00
} else if ( Keyboard : : modifier_state_equals ( ev - > state , Keyboard : : ScrollZoomVerticalModifier ) ) {
2006-05-19 16:10:35 -04:00
if ( ! current_stepping_trackview ) {
2009-12-11 18:29:48 -05:00
step_timeout = Glib : : signal_timeout ( ) . connect ( sigc : : mem_fun ( * this , & Editor : : track_height_step_timeout ) , 500 ) ;
2014-06-12 17:21:23 -04:00
std : : pair < TimeAxisView * , int > const p = trackview_by_y_position ( event_coords . y , false ) ;
2009-01-05 22:18:09 -05:00
current_stepping_trackview = p . first ;
if ( ! current_stepping_trackview ) {
2006-05-19 16:10:35 -04:00
return false ;
}
2006-04-09 22:14:05 -04:00
}
2008-09-10 11:03:30 -04:00
last_track_height_step_timestamp = get_microseconds ( ) ;
2011-02-17 17:35:42 -05:00
current_stepping_trackview - > step_height ( false ) ;
2006-05-19 16:10:35 -04:00
return true ;
} else {
2014-07-14 12:36:10 -04:00
scroll_up_one_track ( ) ;
2006-05-19 16:10:35 -04:00
return true ;
2006-04-09 22:14:05 -04:00
}
2006-05-19 16:10:35 -04:00
break ;
2008-01-10 16:20:59 -05:00
2005-12-23 21:17:47 -05:00
case GDK_SCROLL_DOWN :
2013-06-21 15:13:44 -04:00
if ( Keyboard : : modifier_state_equals ( ev - > state , Keyboard : : ScrollZoomHorizontalModifier ) ) {
2020-04-17 14:51:25 -04:00
temporal_zoom_step_mouse_focus ( true ) ;
2006-05-19 16:10:35 -04:00
return true ;
2013-06-21 15:13:44 -04:00
} else if ( Keyboard : : modifier_state_equals ( ev - > state , Keyboard : : ScrollHorizontalModifier ) ) {
2016-01-07 00:44:24 -05:00
scroll_right_step ( ) ;
return true ;
2013-06-21 15:13:44 -04:00
} else if ( Keyboard : : modifier_state_equals ( ev - > state , Keyboard : : ScrollZoomVerticalModifier ) ) {
2006-05-19 16:10:35 -04:00
if ( ! current_stepping_trackview ) {
2009-12-11 18:29:48 -05:00
step_timeout = Glib : : signal_timeout ( ) . connect ( sigc : : mem_fun ( * this , & Editor : : track_height_step_timeout ) , 500 ) ;
2014-06-12 17:21:23 -04:00
std : : pair < TimeAxisView * , int > const p = trackview_by_y_position ( event_coords . y , false ) ;
2009-01-05 22:18:09 -05:00
current_stepping_trackview = p . first ;
if ( ! current_stepping_trackview ) {
2006-05-19 16:10:35 -04:00
return false ;
}
2006-04-09 22:14:05 -04:00
}
2008-09-10 11:03:30 -04:00
last_track_height_step_timestamp = get_microseconds ( ) ;
2011-02-17 17:35:42 -05:00
current_stepping_trackview - > step_height ( true ) ;
2006-05-19 16:10:35 -04:00
return true ;
} else {
2014-07-14 12:36:10 -04:00
scroll_down_one_track ( ) ;
2006-05-19 16:10:35 -04:00
return true ;
2006-01-20 19:11:03 -05:00
}
2009-10-14 12:10:01 -04:00
break ;
2006-05-19 16:10:35 -04:00
2008-01-10 16:20:59 -05:00
case GDK_SCROLL_LEFT :
2016-01-06 19:30:29 -05:00
scroll_left_step ( ) ;
return true ;
2008-01-10 16:20:59 -05:00
break ;
case GDK_SCROLL_RIGHT :
2016-01-06 19:30:29 -05:00
scroll_right_step ( ) ;
return true ;
2008-01-10 16:20:59 -05:00
break ;
2005-12-23 21:17:47 -05:00
default :
2008-01-10 16:20:59 -05:00
/* what? */
2005-12-23 21:17:47 -05:00
break ;
}
2009-06-10 21:05:01 -04:00
2005-12-23 21:17:47 -05:00
return false ;
}
2005-11-14 11:24:21 -05:00
bool
2014-06-13 14:27:59 -04:00
Editor : : canvas_scroll_event ( GdkEventScroll * event , bool from_canvas )
2005-09-25 14:42:24 -04:00
{
2014-06-13 14:27:59 -04:00
if ( from_canvas ) {
2014-06-13 15:48:30 -04:00
boost : : optional < ArdourCanvas : : Rect > rulers = _time_markers_group - > bounding_box ( ) ;
2014-06-13 14:27:59 -04:00
if ( rulers & & rulers - > contains ( Duple ( event - > x , event - > y ) ) ) {
return canvas_ruler_event ( ( GdkEvent * ) event , timecode_ruler , TimecodeRulerItem ) ;
}
2014-06-12 15:58:05 -04:00
}
2013-04-04 00:32:52 -04:00
_track_canvas - > grab_focus ( ) ;
2010-05-28 12:37:04 -04:00
return track_canvas_scroll ( event ) ;
2007-04-12 19:20:37 -04:00
}
2005-09-25 14:42:24 -04:00
2007-04-12 19:20:37 -04:00
bool
2015-01-26 16:37:53 -05:00
Editor : : track_canvas_button_press_event ( GdkEventButton * event )
2007-04-12 19:20:37 -04:00
{
2013-04-04 00:32:52 -04:00
_track_canvas - > grab_focus ( ) ;
2020-05-05 16:10:36 -04:00
if ( ! internal_editing ( ) & & ! Keyboard : : is_context_menu_event ( event ) ) {
2015-03-25 08:31:23 -04:00
begin_reversible_selection_op ( X_ ( " Clear Selection Click (track canvas) " ) ) ;
2015-01-26 16:37:53 -05:00
selection - > clear ( ) ;
commit_reversible_selection_op ( ) ;
2017-07-01 12:42:24 -04:00
}
2007-04-12 19:20:37 -04:00
return false ;
}
2005-12-23 21:17:47 -05:00
2007-04-12 19:20:37 -04:00
bool
Editor : : track_canvas_button_release_event ( GdkEventButton * event )
{
2015-01-26 16:37:53 -05:00
if ( ! Keyboard : : is_context_menu_event ( event ) ) {
2017-07-01 12:42:24 -04:00
if ( _drags - > active ( ) ) {
2020-03-25 17:30:52 -04:00
GdkEvent copy = * ( ( GdkEvent * ) event ) ;
Duple winpos = Duple ( event - > x , event - > y ) ;
Duple where = _track_canvas - > window_to_canvas ( winpos ) ;
copy . button . x = where . x ;
copy . button . y = where . y ;
_drags - > end_grab ( & copy ) ;
2017-07-01 12:42:24 -04:00
}
}
2007-04-12 19:20:37 -04:00
return false ;
}
2005-09-25 14:42:24 -04:00
2007-04-12 19:20:37 -04:00
bool
2009-07-21 11:55:17 -04:00
Editor : : track_canvas_motion_notify_event ( GdkEventMotion */ * event */ )
2007-04-12 19:20:37 -04:00
{
int x , y ;
/* keep those motion events coming */
2013-04-04 00:32:52 -04:00
_track_canvas - > get_pointer ( x , y ) ;
2007-04-12 19:20:37 -04: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
{
2017-04-20 13:41:06 -04:00
if ( ! session ( ) | | session ( ) - > loading ( ) | | session ( ) - > deletion_in_progress ( ) ) {
return false ;
}
2005-09-25 14:42:24 -04:00
gint ret = FALSE ;
2009-10-14 12:10:01 -04:00
2005-09-25 14:42:24 -04:00
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 :
2009-05-30 14:25:59 -04:00
ret = motion_handler ( item , event ) ;
2005-09-25 14:42:24 -04:00
break ;
case GDK_ENTER_NOTIFY :
ret = enter_handler ( item , event , type ) ;
break ;
case GDK_LEAVE_NOTIFY :
ret = leave_handler ( item , event , type ) ;
break ;
2011-08-15 11:08:37 -04:00
case GDK_KEY_PRESS :
ret = key_press_handler ( item , event , type ) ;
break ;
case GDK_KEY_RELEASE :
ret = key_release_handler ( item , event , type ) ;
break ;
2005-09-25 14:42:24 -04:00
default :
break ;
}
return ret ;
}
2005-11-14 11:24:21 -05:00
bool
2006-07-23 08:03:19 -04:00
Editor : : canvas_region_view_event ( GdkEvent * event , ArdourCanvas : : Item * item , RegionView * rv )
2005-09-25 14:42:24 -04:00
{
2007-04-12 19:20:37 -04:00
bool ret = false ;
if ( ! rv - > sensitive ( ) ) {
return 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 ;
2009-07-09 13:58:13 -04:00
clicked_axisview = & rv - > get_time_axis_view ( ) ;
clicked_routeview = dynamic_cast < RouteTimeAxisView * > ( clicked_axisview ) ;
2005-09-25 14:42:24 -04:00
ret = button_press_handler ( item , event , RegionItem ) ;
break ;
case GDK_BUTTON_RELEASE :
ret = button_release_handler ( item , event , RegionItem ) ;
break ;
case GDK_MOTION_NOTIFY :
2009-05-30 14:25:59 -04:00
ret = motion_handler ( item , event ) ;
2005-09-25 14:42:24 -04:00
break ;
case GDK_ENTER_NOTIFY :
2014-06-18 10:24:59 -04:00
set_entered_regionview ( rv ) ;
ret = enter_handler ( item , event , RegionItem ) ;
2005-09-25 14:42:24 -04:00
break ;
case GDK_LEAVE_NOTIFY :
2013-12-12 20:44:28 -05:00
if ( event - > crossing . detail ! = GDK_NOTIFY_INFERIOR ) {
set_entered_regionview ( 0 ) ;
2014-06-18 10:24:59 -04:00
ret = leave_handler ( item , event , RegionItem ) ;
2013-12-12 20:44:28 -05:00
}
2005-09-25 14:42:24 -04:00
break ;
default :
break ;
}
return ret ;
}
2014-06-18 10:24:59 -04:00
bool
Editor : : canvas_wave_view_event ( GdkEvent * event , ArdourCanvas : : Item * item , RegionView * rv )
{
/* we only care about enter events here, required for mouse/cursor
* tracking . there is a non - linear ( non - child / non - parent ) relationship
* between various components of a regionview and so when we leave one
* of them ( e . g . a trim handle ) and enter another ( e . g . the waveview )
* no other items get notified . enter / leave handling does not propagate
* in the same way as other events , so we need to catch this because
* entering ( and leaving ) the waveview is equivalent to
* entering / leaving the regionview ( which is why it is passed in as a
* third argument ) .
*
* And in fact , we really only care about enter events .
*/
bool ret = false ;
if ( ! rv - > sensitive ( ) ) {
return false ;
}
switch ( event - > type ) {
case GDK_ENTER_NOTIFY :
set_entered_regionview ( rv ) ;
ret = enter_handler ( item , event , WaveItem ) ;
break ;
default :
break ;
}
return ret ;
2015-10-05 10:17:49 -04:00
}
2014-06-18 10:24:59 -04:00
2005-11-14 11:24:21 -05:00
bool
2009-07-09 13:58:13 -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 ;
2009-10-14 12:10:01 -04: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 = 0 ;
clicked_control_point = 0 ;
2006-08-16 16:36:14 -04:00
clicked_axisview = tv ;
2010-08-06 19:28:44 -04:00
clicked_routeview = dynamic_cast < RouteTimeAxisView * > ( clicked_axisview ) ;
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 :
2009-09-02 18:02:34 -04:00
ret = motion_handler ( item , event ) ;
2005-09-25 14:42:24 -04:00
break ;
case GDK_ENTER_NOTIFY :
2008-01-10 16:20:59 -05:00
set_entered_track ( tv ) ;
2014-06-18 10:24:59 -04:00
ret = enter_handler ( item , event , StreamItem ) ;
2008-01-10 16:20:59 -05:00
break ;
case GDK_LEAVE_NOTIFY :
2014-06-18 10:24:59 -04:00
if ( event - > crossing . detail ! = GDK_NOTIFY_INFERIOR ) {
set_entered_track ( 0 ) ;
}
ret = leave_handler ( item , event , StreamItem ) ;
2005-09-25 14:42:24 -04:00
break ;
2011-06-01 13:00:29 -04:00
2005-09-25 14:42:24 -04:00
default :
break ;
}
return ret ;
}
2005-11-14 11:24:21 -05:00
bool
2009-07-09 13:58:13 -04:00
Editor : : canvas_automation_track_event ( GdkEvent * event , ArdourCanvas : : Item * item , AutomationTimeAxisView * atv )
2005-09-25 14:42:24 -04:00
{
2023-06-27 11:42:14 -04:00
if ( atv - > parameter ( ) . type ( ) = = MidiVelocityAutomation ) {
/* no event handling for velocity tracks until we can make the
automation control affect note velocity .
*/
return false ;
}
2005-11-14 11:24:21 -05:00
bool ret = false ;
2007-04-12 19:20:37 -04: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 = 0 ;
clicked_control_point = 0 ;
2009-07-09 13:58:13 -04:00
clicked_axisview = atv ;
clicked_routeview = 0 ;
2005-09-25 14:42:24 -04:00
ret = button_press_handler ( item , event , AutomationTrackItem ) ;
break ;
case GDK_BUTTON_RELEASE :
ret = button_release_handler ( item , event , AutomationTrackItem ) ;
break ;
case GDK_MOTION_NOTIFY :
2009-05-30 14:25:59 -04:00
ret = motion_handler ( item , event ) ;
2005-09-25 14:42:24 -04:00
break ;
case GDK_ENTER_NOTIFY :
ret = enter_handler ( item , event , AutomationTrackItem ) ;
break ;
case GDK_LEAVE_NOTIFY :
ret = leave_handler ( item , event , AutomationTrackItem ) ;
break ;
2023-07-10 14:21:27 -04:00
case GDK_KEY_PRESS :
if ( _drags - > active ( ) ) {
return _drags - > mid_drag_key_event ( & event - > key ) ;
}
break ;
case GDK_KEY_RELEASE :
if ( _drags - > active ( ) ) {
return _drags - > mid_drag_key_event ( & event - > key ) ;
}
break ;
2005-09-25 14:42:24 -04:00
default :
break ;
}
return ret ;
}
2012-05-08 13:13:59 -04:00
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 ;
}
2012-12-13 11:42:05 -05:00
/* In Mixbus, the crossfade area is used to trim the region while leaving the fade anchor intact (see preserve_fade_anchor)*/
/* however in A3 this feature is unfinished, and it might be better to do it with a modifier-trim instead, anyway */
/* if we return RegionItem here then we avoid the issue until it is resolved later */
return typed_event ( item , event , RegionItem ) ; // StartCrossFadeItem);
2012-05-08 13:13:59 -04:00
}
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 ;
}
2012-12-14 12:02:36 -05:00
/* In Mixbus, the crossfade area is used to trim the region while leaving the fade anchor intact (see preserve_fade_anchor)*/
/* however in A3 this feature is unfinished, and it might be better to do it with a modifier-trim instead, anyway */
/* if we return RegionItem here then we avoid the issue until it is resolved later */
return typed_event ( item , event , RegionItem ) ; // EndCrossFadeItem);
2012-05-08 13:13:59 -04:00
}
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 */
2007-04-12 19:20:37 -04:00
if ( ! rv - > sensitive ( ) ) {
return false ;
}
2005-09-25 14:42:24 -04:00
switch ( event - > type ) {
case GDK_BUTTON_PRESS :
clicked_regionview = rv ;
clicked_control_point = 0 ;
2009-07-09 13:58:13 -04:00
clicked_axisview = & rv - > get_time_axis_view ( ) ;
clicked_routeview = dynamic_cast < RouteTimeAxisView * > ( clicked_axisview ) ;
2005-09-25 14:42:24 -04:00
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 ;
2009-10-14 12:10:01 -04:00
2005-09-25 14:42:24 -04:00
}
2013-10-30 23:36:30 -04:00
/* proxy for the regionview, except enter/leave events */
2009-10-14 12:10:01 -04:00
2013-10-30 23:36:30 -04:00
if ( event - > type = = GDK_ENTER_NOTIFY | | event - > type = = GDK_LEAVE_NOTIFY ) {
return true ;
} else {
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
2014-05-30 21:53:59 -04:00
Editor : : canvas_fade_in_handle_event ( GdkEvent * event , ArdourCanvas : : Item * item , AudioRegionView * rv , bool trim )
2005-09-25 14:42:24 -04:00
{
2005-11-14 11:24:21 -05:00
bool ret = false ;
2009-10-14 12:10:01 -04:00
2007-04-12 19:20:37 -04:00
if ( ! rv - > sensitive ( ) ) {
return 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 ;
2009-07-09 13:58:13 -04:00
clicked_axisview = & rv - > get_time_axis_view ( ) ;
clicked_routeview = dynamic_cast < RouteTimeAxisView * > ( clicked_axisview ) ;
2014-05-30 21:53:59 -04:00
ret = button_press_handler ( item , event , trim ? FadeInTrimHandleItem : FadeInHandleItem ) ;
2005-09-25 14:42:24 -04:00
break ;
case GDK_BUTTON_RELEASE :
2014-05-30 21:53:59 -04:00
ret = button_release_handler ( item , event , trim ? FadeInTrimHandleItem : FadeInHandleItem ) ;
2005-09-25 14:42:24 -04:00
break ;
case GDK_MOTION_NOTIFY :
2009-05-30 14:25:59 -04:00
ret = motion_handler ( item , event ) ;
2005-09-25 14:42:24 -04:00
break ;
case GDK_ENTER_NOTIFY :
2014-05-30 21:53:59 -04:00
ret = enter_handler ( item , event , trim ? FadeInTrimHandleItem : FadeInHandleItem ) ;
2005-09-25 14:42:24 -04:00
break ;
case GDK_LEAVE_NOTIFY :
2014-05-30 21:53:59 -04:00
ret = leave_handler ( item , event , trim ? FadeInTrimHandleItem : FadeInHandleItem ) ;
2005-09-25 14:42:24 -04:00
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 */
2007-04-12 19:20:37 -04:00
if ( ! rv - > sensitive ( ) ) {
return false ;
}
2005-09-25 14:42:24 -04:00
switch ( event - > type ) {
case GDK_BUTTON_PRESS :
clicked_regionview = rv ;
clicked_control_point = 0 ;
2009-07-09 13:58:13 -04:00
clicked_axisview = & rv - > get_time_axis_view ( ) ;
clicked_routeview = dynamic_cast < RouteTimeAxisView * > ( clicked_axisview ) ;
2005-09-25 14:42:24 -04:00
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 ;
2009-10-14 12:10:01 -04:00
2005-09-25 14:42:24 -04:00
}
2013-10-30 23:36:30 -04:00
/* proxy for the regionview, except enter/leave events */
2009-10-14 12:10:01 -04:00
2013-10-30 23:36:30 -04:00
if ( event - > type = = GDK_ENTER_NOTIFY | | event - > type = = GDK_LEAVE_NOTIFY ) {
return true ;
} else {
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
2014-05-30 21:53:59 -04:00
Editor : : canvas_fade_out_handle_event ( GdkEvent * event , ArdourCanvas : : Item * item , AudioRegionView * rv , bool trim )
2005-09-25 14:42:24 -04:00
{
2005-11-14 11:24:21 -05:00
bool ret = false ;
2009-10-14 12:10:01 -04:00
2007-04-12 19:20:37 -04:00
if ( ! rv - > sensitive ( ) ) {
return 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 ;
2009-07-09 13:58:13 -04:00
clicked_axisview = & rv - > get_time_axis_view ( ) ;
clicked_routeview = dynamic_cast < RouteTimeAxisView * > ( clicked_axisview ) ;
2014-05-30 21:53:59 -04:00
ret = button_press_handler ( item , event , trim ? FadeOutTrimHandleItem : FadeOutHandleItem ) ;
2005-09-25 14:42:24 -04:00
break ;
case GDK_BUTTON_RELEASE :
2014-05-30 21:53:59 -04:00
ret = button_release_handler ( item , event , trim ? FadeOutTrimHandleItem : FadeOutHandleItem ) ;
2005-09-25 14:42:24 -04:00
break ;
case GDK_MOTION_NOTIFY :
2009-05-30 14:25:59 -04:00
ret = motion_handler ( item , event ) ;
2005-09-25 14:42:24 -04:00
break ;
case GDK_ENTER_NOTIFY :
2014-05-30 21:53:59 -04:00
ret = enter_handler ( item , event , trim ? FadeOutTrimHandleItem : FadeOutHandleItem ) ;
2005-09-25 14:42:24 -04:00
break ;
case GDK_LEAVE_NOTIFY :
2014-05-30 21:53:59 -04:00
ret = leave_handler ( item , event , trim ? FadeOutTrimHandleItem : FadeOutHandleItem ) ;
2005-09-25 14:42:24 -04:00
break ;
default :
break ;
}
return ret ;
}
struct DescendingRegionLayerSorter {
2023-02-16 18:33:28 -05:00
bool operator ( ) ( std : : shared_ptr < Region > a , std : : shared_ptr < Region > b ) {
2017-07-01 12:42:24 -04:00
return a - > layer ( ) > b - > layer ( ) ;
}
2005-09-25 14:42:24 -04:00
} ;
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
{
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 ;
2009-07-09 13:58:13 -04:00
clicked_axisview = & cp - > line ( ) . trackview ;
clicked_routeview = dynamic_cast < RouteTimeAxisView * > ( clicked_axisview ) ;
2005-11-14 11:24:21 -05:00
clicked_regionview = 0 ;
break ;
default :
break ;
2005-09-25 14:42:24 -04:00
}
2007-06-30 14:41:50 -04:00
return typed_event ( item , event , ControlPointItem ) ;
2005-09-25 14:42:24 -04:00
}
2023-01-12 19:07:27 -05:00
bool
Editor : : canvas_velocity_event ( GdkEvent * event , ArdourCanvas : : Item * item )
{
return typed_event ( item , event , VelocityItem ) ;
}
2023-07-10 19:32:18 -04:00
bool
Editor : : canvas_velocity_base_event ( GdkEvent * event , ArdourCanvas : : Item * item )
{
return typed_event ( item , event , VelocityBaseItem ) ;
}
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 ;
2024-04-16 21:53:30 -04:00
RegionFxLine * rfl ;
if ( ( rfl = dynamic_cast < RegionFxLine * > ( al ) ) ! = 0 ) {
2005-09-25 14:42:24 -04:00
type = GainLineItem ;
2016-05-24 20:46:57 -04:00
if ( event - > type = = GDK_BUTTON_PRESS ) {
2024-04-16 21:53:30 -04:00
clicked_regionview = & rfl - > region_view ( ) ;
2016-05-24 20:46:57 -04:00
}
2005-09-25 14:42:24 -04:00
} else {
2007-06-30 14:41:50 -04:00
type = AutomationLineItem ;
2016-05-24 20:46:57 -04:00
if ( event - > type = = GDK_BUTTON_PRESS ) {
clicked_regionview = 0 ;
}
2005-09-25 14:42:24 -04:00
}
2015-06-21 10:53:31 -04:00
clicked_control_point = 0 ;
2015-06-21 10:47:08 -04:00
clicked_axisview = & al - > trackview ;
2015-06-21 10:53:31 -04:00
clicked_routeview = dynamic_cast < RouteTimeAxisView * > ( clicked_axisview ) ;
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 ;
2009-10-14 12:10:01 -04: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_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 :
2009-05-30 14:25:59 -04:00
ret = motion_handler ( item , event ) ;
2005-09-25 14:42:24 -04:00
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 ;
}
2009-10-14 12:10:01 -04:00
2005-09-25 14:42:24 -04:00
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 :
2009-05-30 14:25:59 -04:00
ret = motion_handler ( item , event ) ;
2005-09-25 14:42:24 -04:00
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 ;
}
2009-10-14 12:10:01 -04:00
2005-09-25 14:42:24 -04:00
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 :
2009-05-30 14:25:59 -04:00
ret = motion_handler ( item , event ) ;
2005-09-25 14:42:24 -04:00
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 ;
}
2009-10-14 12:10:01 -04:00
2005-09-25 14:42:24 -04:00
return ret ;
}
2009-08-28 12:06:08 -04:00
bool
2019-04-08 14:25:05 -04:00
Editor : : canvas_frame_handle_event ( GdkEvent * event , ArdourCanvas : : Item * item , RegionView * rv )
2009-08-28 12:06:08 -04:00
{
bool ret = false ;
2019-04-08 18:27:05 -04:00
/* frame handles are not active when in internal edit mode, because actual notes
2009-08-28 12:06:08 -04:00
might be in the area occupied by the handle - we want them to be editable as normal .
*/
if ( internal_editing ( ) | | ! rv - > sensitive ( ) ) {
return false ;
}
2019-04-08 18:27:05 -04:00
/* NOTE: frame handles pretend to be the colored trim bar from an event handling
2009-08-28 12:06:08 -04:00
perspective . XXX change this ? ?
*/
2010-11-25 15:37:39 -05:00
ItemType type ;
2010-06-17 08:45:51 -04:00
2010-11-25 15:37:39 -05:00
if ( item - > get_data ( " isleft " ) ) {
type = LeftFrameHandle ;
} else {
type = RightFrameHandle ;
}
2010-06-17 08:45:51 -04:00
2009-08-28 12:06:08 -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_axisview = & clicked_regionview - > get_time_axis_view ( ) ;
clicked_routeview = dynamic_cast < RouteTimeAxisView * > ( clicked_axisview ) ;
2010-06-17 08:45:51 -04:00
ret = button_press_handler ( item , event , type ) ;
2009-08-28 12:06:08 -04:00
break ;
case GDK_BUTTON_RELEASE :
2010-06-17 08:45:51 -04:00
ret = button_release_handler ( item , event , type ) ;
2009-08-28 12:06:08 -04:00
break ;
case GDK_MOTION_NOTIFY :
ret = motion_handler ( item , event ) ;
break ;
case GDK_ENTER_NOTIFY :
2010-06-17 08:45:51 -04:00
ret = enter_handler ( item , event , type ) ;
2009-08-28 12:06:08 -04:00
break ;
case GDK_LEAVE_NOTIFY :
2010-06-17 08:45:51 -04:00
ret = leave_handler ( item , event , type ) ;
2009-08-28 12:06:08 -04:00
break ;
default :
break ;
}
return ret ;
}
2005-09-25 14:42:24 -04:00
2005-11-14 11:24:21 -05:00
bool
2006-07-23 08:03:19 -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 ;
2009-08-28 12:06:08 -04:00
2007-04-12 19:20:37 -04:00
if ( ! rv - > sensitive ( ) ) {
return 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 ;
2009-07-09 13:58:13 -04:00
clicked_axisview = & clicked_regionview - > get_time_axis_view ( ) ;
clicked_routeview = dynamic_cast < RouteTimeAxisView * > ( clicked_axisview ) ;
2006-07-23 08:03:19 -04:00
ret = button_press_handler ( item , event , RegionViewNameHighlight ) ;
2005-09-25 14:42:24 -04:00
break ;
case GDK_BUTTON_RELEASE :
2006-07-23 08:03:19 -04:00
ret = button_release_handler ( item , event , RegionViewNameHighlight ) ;
2005-09-25 14:42:24 -04:00
break ;
case GDK_MOTION_NOTIFY :
2010-05-30 16:13:29 -04:00
motion_handler ( item , event ) ;
Fix typos in gtk2_ardour/ directory
Found via `codespell -q 3 -S *.po,./share/patchfiles,./libs -L ba,buss,busses,doubleclick,hsi,ontop,ro,seh,siz,sur,te,trough,ue`
2022-01-26 12:35:38 -05:00
ret = true ; // force this to avoid propagating the event into the regionview
2005-09-25 14:42:24 -04:00
break ;
case GDK_ENTER_NOTIFY :
2006-07-23 08:03:19 -04:00
ret = enter_handler ( item , event , RegionViewNameHighlight ) ;
2005-09-25 14:42:24 -04:00
break ;
case GDK_LEAVE_NOTIFY :
2006-07-23 08:03:19 -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-08-01 15:18:12 -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
2007-04-12 19:20:37 -04:00
if ( ! rv - > sensitive ( ) ) {
return 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 ;
2009-07-09 13:58:13 -04:00
clicked_axisview = & clicked_regionview - > get_time_axis_view ( ) ;
clicked_routeview = dynamic_cast < RouteTimeAxisView * > ( clicked_axisview ) ;
2006-07-23 08:03:19 -04:00
ret = button_press_handler ( item , event , RegionViewName ) ;
2005-09-25 14:42:24 -04:00
break ;
case GDK_BUTTON_RELEASE :
2006-07-23 08:03:19 -04:00
ret = button_release_handler ( item , event , RegionViewName ) ;
2005-09-25 14:42:24 -04:00
break ;
case GDK_MOTION_NOTIFY :
2009-05-30 14:25:59 -04:00
ret = motion_handler ( item , event ) ;
2005-09-25 14:42:24 -04:00
break ;
case GDK_ENTER_NOTIFY :
2006-07-23 08:03:19 -04:00
ret = enter_handler ( item , event , RegionViewName ) ;
2005-09-25 14:42:24 -04:00
break ;
case GDK_LEAVE_NOTIFY :
2006-07-23 08:03:19 -04:00
ret = leave_handler ( item , event , RegionViewName ) ;
2005-09-25 14:42:24 -04:00
break ;
default :
break ;
}
return ret ;
}
2010-07-06 07:33:27 -04:00
bool
2010-09-02 13:01:36 -04:00
Editor : : canvas_feature_line_event ( GdkEvent * event , ArdourCanvas : : Item * item , RegionView * )
2010-07-06 07:33:27 -04:00
{
bool ret = false ;
switch ( event - > type ) {
case GDK_BUTTON_PRESS :
case GDK_2BUTTON_PRESS :
case GDK_3BUTTON_PRESS :
clicked_regionview = 0 ;
clicked_control_point = 0 ;
clicked_axisview = 0 ;
clicked_routeview = 0 ; //dynamic_cast<RouteTimeAxisView*>(clicked_axisview);
ret = button_press_handler ( item , event , FeatureLineItem ) ;
break ;
case GDK_BUTTON_RELEASE :
ret = button_release_handler ( item , event , FeatureLineItem ) ;
break ;
case GDK_MOTION_NOTIFY :
ret = motion_handler ( item , event ) ;
break ;
case GDK_ENTER_NOTIFY :
ret = enter_handler ( item , event , FeatureLineItem ) ;
break ;
case GDK_LEAVE_NOTIFY :
ret = leave_handler ( item , event , FeatureLineItem ) ;
break ;
default :
break ;
}
return ret ;
}
2005-11-14 11:24:21 -05:00
bool
2015-07-23 07:23:47 -04:00
Editor : : canvas_marker_event ( GdkEvent * event , ArdourCanvas : : Item * item , ArdourMarker * /*marker*/ )
2005-09-25 14:42:24 -04:00
{
return typed_event ( item , event , MarkerItem ) ;
}
2023-05-16 19:44:26 -04:00
bool
Editor : : canvas_selection_marker_event ( GdkEvent * event , ArdourCanvas : : Item * item )
{
return typed_event ( item , event , SelectionMarkerItem ) ;
}
2013-03-12 17:00:09 -04:00
bool
Editor : : canvas_videotl_bar_event ( GdkEvent * event , ArdourCanvas : : Item * item )
{
return typed_event ( item , event , VideoBarItem ) ;
}
2005-11-14 11:24:21 -05:00
bool
2017-02-24 13:09:16 -05:00
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 ) ;
}
2016-05-07 13:03:12 -04:00
bool
Editor : : canvas_tempo_curve_event ( GdkEvent * event , ArdourCanvas : : Item * item , TempoCurve * /*marker*/ )
{
return typed_event ( item , event , TempoCurveItem ) ;
}
2005-11-14 11:24:21 -05:00
bool
2009-07-21 11:55:17 -04:00
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 ) ;
}
2021-02-10 16:34:30 -05:00
bool
Editor : : canvas_bbt_marker_event ( GdkEvent * event , ArdourCanvas : : Item * item , BBTMarker * /*marker*/ )
{
return typed_event ( item , event , BBTMarkerItem ) ;
}
2014-06-12 15:58:05 -04:00
bool
Editor : : canvas_ruler_event ( GdkEvent * event , ArdourCanvas : : Item * item , ItemType type )
{
bool handled = false ;
if ( event - > type = = GDK_SCROLL ) {
2015-10-05 10:17:49 -04:00
2014-06-12 15:58:05 -04:00
/* scroll events in the rulers are handled a little differently from
scrolling elsewhere in the canvas .
*/
switch ( event - > scroll . direction ) {
case GDK_SCROLL_UP :
2020-04-17 10:15:50 -04:00
if ( Keyboard : : modifier_state_equals ( event - > scroll . state , Keyboard : : ScrollHorizontalModifier ) ) {
2016-01-25 02:26:11 -05:00
scroll_left_step ( ) ;
2016-01-07 06:55:22 -05:00
} else if ( UIConfiguration : : instance ( ) . get_use_mouse_position_as_zoom_focus_on_scroll ( ) ) {
2016-01-07 06:19:09 -05:00
temporal_zoom_step_mouse_focus ( false ) ;
2020-04-17 10:15:50 -04:00
} else if ( Keyboard : : modifier_state_equals ( event - > scroll . state , Keyboard : : PrimaryModifier ) ) {
temporal_zoom_step_mouse_focus ( false ) ;
2015-01-29 12:23:49 -05:00
} else {
temporal_zoom_step ( false ) ;
}
2014-06-12 15:58:05 -04:00
handled = true ;
break ;
2015-10-05 10:17:49 -04:00
2014-06-12 15:58:05 -04:00
case GDK_SCROLL_DOWN :
2020-04-17 10:15:50 -04:00
if ( Keyboard : : modifier_state_equals ( event - > scroll . state , Keyboard : : ScrollHorizontalModifier ) ) {
2016-01-25 02:26:11 -05:00
scroll_right_step ( ) ;
2016-01-07 06:55:22 -05:00
} else if ( UIConfiguration : : instance ( ) . get_use_mouse_position_as_zoom_focus_on_scroll ( ) ) {
2016-01-07 06:19:09 -05:00
temporal_zoom_step_mouse_focus ( true ) ;
2020-04-17 10:15:50 -04:00
} else if ( Keyboard : : modifier_state_equals ( event - > scroll . state , Keyboard : : PrimaryModifier ) ) {
temporal_zoom_step_mouse_focus ( true ) ;
2015-01-29 12:23:49 -05:00
} else {
temporal_zoom_step ( true ) ;
}
2014-06-12 15:58:05 -04:00
handled = true ;
break ;
2015-10-05 10:17:49 -04:00
2014-06-12 15:58:05 -04:00
case GDK_SCROLL_LEFT :
2016-01-06 20:26:22 -05:00
scroll_left_half_page ( ) ;
2014-06-12 15:58:05 -04:00
handled = true ;
break ;
2015-10-05 10:17:49 -04:00
2014-06-12 15:58:05 -04:00
case GDK_SCROLL_RIGHT :
2016-01-06 20:26:22 -05:00
scroll_right_half_page ( ) ;
2014-06-12 15:58:05 -04:00
handled = true ;
break ;
2015-10-05 10:17:49 -04:00
2014-06-12 15:58:05 -04:00
default :
/* what? */
break ;
}
return handled ;
}
return typed_event ( item , event , type ) ;
}
2005-11-14 11:24:21 -05:00
bool
2022-12-09 23:45:16 -05:00
Editor : : canvas_ruler_bar_event ( GdkEvent * event , ArdourCanvas : : Item * item , ItemType type , std : : string const & color_name )
2005-09-25 14:42:24 -04:00
{
2022-12-09 23:45:16 -05:00
/* XXX consolidate with Editor::canvas_ruler_event ? */
2005-09-25 14:42:24 -04:00
2022-01-20 15:44:29 -05:00
switch ( event - > type ) {
2023-02-26 15:46:51 -05:00
case GDK_ENTER_NOTIFY :
if ( event - > crossing . detail ! = GDK_NOTIFY_INFERIOR ) {
item - > set_fill_color ( Gtkmm2ext : : HSV ( UIConfiguration : : instance ( ) . color_mod ( color_name , " marker bar " ) ) . lighter ( 0.20 ) . color ( ) ) ;
}
break ;
case GDK_LEAVE_NOTIFY :
if ( event - > crossing . detail ! = GDK_NOTIFY_INFERIOR ) {
item - > set_fill_color ( UIConfiguration : : instance ( ) . color_mod ( color_name , " marker bar " ) ) ;
}
break ;
default :
break ;
2022-01-20 15:44:29 -05:00
} ;
2022-12-09 23:45:16 -05:00
return typed_event ( item , event , type ) ;
2005-09-25 14:42:24 -04:00
}
2023-09-07 15:25:08 -04:00
bool
Editor : : section_rect_event ( GdkEvent * ev , Location * loc , ArdourCanvas : : Rectangle * rect , std : : string color )
{
switch ( ev - > type ) {
case GDK_ENTER_NOTIFY :
if ( UIConfiguration : : instance ( ) . get_widget_prelight ( ) ) {
2023-09-25 12:52:32 -04:00
rect - > set_fill_color ( Gtkmm2ext : : HSV ( UIConfiguration : : instance ( ) . color ( color ) ) . lighter ( 0.25 ) ) ;
2023-09-07 15:25:08 -04:00
return true ;
}
break ;
case GDK_LEAVE_NOTIFY :
if ( UIConfiguration : : instance ( ) . get_widget_prelight ( ) ) {
rect - > set_fill_color ( UIConfiguration : : instance ( ) . color ( color ) ) ;
return true ;
}
break ;
case GDK_BUTTON_PRESS :
if ( Keyboard : : modifier_state_equals ( ev - > button . state , Keyboard : : PrimaryModifier ) ) {
/* used to add markers */
return false ;
}
if ( ev - > button . button = = 1 ) {
_session - > request_locate ( loc - > start ( ) . samples ( ) ) ;
}
return true ;
case GDK_2BUTTON_PRESS :
case GDK_3BUTTON_PRESS :
if ( Keyboard : : modifier_state_equals ( ev - > button . state , Keyboard : : PrimaryModifier ) ) {
return false ;
}
if ( ev - > button . button = = 1 ) {
assert ( find_location_markers ( loc ) ) ;
rename_marker ( find_location_markers ( loc ) - > start ) ;
return true ;
}
break ;
case GDK_BUTTON_RELEASE :
if ( Keyboard : : is_context_menu_event ( & ev - > button ) ) {
2023-09-11 23:37:41 -04:00
using namespace Menu_Helpers ;
2023-09-07 15:25:08 -04:00
/* find section */
timepos_t start ( loc - > start ( ) ) ;
timepos_t end ;
Location * l = _session - > locations ( ) - > section_at ( start , start , end ) ;
assert ( l ) ;
2023-09-11 23:37:41 -04:00
timepos_t where ( canvas_event_time ( ev ) ) ;
2023-09-15 08:49:33 -04:00
snap_to ( where , Temporal : : RoundNearest ) ;
2023-09-11 23:37:41 -04:00
section_box_menu . set_name ( " ArdourContextMenu " ) ;
MenuList & items ( section_box_menu . items ( ) ) ;
items . clear ( ) ;
2024-05-21 10:21:02 -04:00
items . push_back ( MenuElem ( _ ( " New Arrangement Marker " ) , sigc : : bind ( sigc : : mem_fun ( * this , & Editor : : add_location_mark_with_flag ) , where , Location : : Flags ( Location : : IsMark | Location : : IsSection ) , 0 ) ) ) ;
2023-09-11 23:37:41 -04:00
items . push_back ( MenuElem ( _ ( " Select Arrangement Section " ) , sigc : : bind ( sigc : : mem_fun ( * _sections , & EditorSections : : select ) , l ) ) ) ;
2023-09-12 09:40:07 -04:00
#if 0
2023-09-11 23:37:41 -04:00
items . push_back ( SeparatorElem ( ) ) ;
2023-09-12 09:40:07 -04:00
add_section_context_items ( items ) ; //TODO: section_context_items needs to be modified to operate on the marker you clicked on, not the range selection (which might not exist)
# endif
2023-09-11 23:37:41 -04:00
section_box_menu . popup ( ev - > button . button , ev - > button . time ) ;
2023-09-07 15:25:08 -04:00
return true ;
}
break ;
default :
break ;
}
return false ;
}
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
{
2020-03-25 18:14:25 -04:00
return typed_event ( item , event , PlayheadCursorItem ) ;
2005-09-25 14:42:24 -04:00
}
2023-09-07 15:20:05 -04:00
bool
Editor : : canvas_section_box_event ( GdkEvent * event )
{
switch ( event - > type ) {
case GDK_BUTTON_PRESS :
if ( ! Keyboard : : modifier_state_equals ( event - > button . state , Keyboard : : PrimaryModifier )
& & event - > button . button = = 1 ) {
_drags - > set ( new CursorDrag ( this , * _playhead_cursor , false ) , event ) ;
}
/*fallthrough*/
case GDK_2BUTTON_PRESS :
/*fallthrough*/
case GDK_3BUTTON_PRESS :
return ! Keyboard : : modifier_state_equals ( event - > button . state , Keyboard : : PrimaryModifier ) ;
case GDK_BUTTON_RELEASE :
if ( Keyboard : : is_context_menu_event ( & event - > button ) ) {
2023-09-11 23:37:41 -04:00
section_box_menu . set_name ( " ArdourContextMenu " ) ;
Gtk : : Menu_Helpers : : MenuList & items ( section_box_menu . items ( ) ) ;
items . clear ( ) ;
add_section_context_items ( items ) ;
section_box_menu . popup ( event - > button . button , event - > button . time ) ;
2023-09-07 15:20:05 -04:00
return true ;
}
return false ;
default :
break ;
}
return false ;
}
2009-09-08 17:45:44 -04:00
bool
Editor : : canvas_note_event ( GdkEvent * event , ArdourCanvas : : Item * item )
{
if ( ! internal_editing ( ) ) {
return false ;
}
return typed_event ( item , event , NoteItem ) ;
}
2014-04-16 04:16:56 -04:00
bool
2014-06-22 15:24:11 -04:00
Editor : : canvas_drop_zone_event ( GdkEvent * event )
2014-04-16 04:16:56 -04:00
{
2015-10-05 10:17:49 -04:00
GdkEventScroll scroll ;
2014-06-30 14:47:57 -04:00
ArdourCanvas : : Duple winpos ;
2015-10-05 10:17:49 -04:00
2014-06-22 15:24:11 -04:00
switch ( event - > type ) {
case GDK_BUTTON_RELEASE :
if ( event - > button . button = = 1 ) {
2015-03-25 08:31:23 -04:00
begin_reversible_selection_op ( X_ ( " Nowhere Click " ) ) ;
2014-06-22 15:24:11 -04:00
selection - > clear_objects ( ) ;
selection - > clear_tracks ( ) ;
2015-01-10 12:07:31 -05:00
commit_reversible_selection_op ( ) ;
2014-06-22 15:24:11 -04:00
}
break ;
2014-06-30 14:47:57 -04:00
case GDK_SCROLL :
/* convert coordinates back into window space so that
2023-09-05 12:29:26 -04:00
* we can just call canvas_scroll_event ( ) .
*/
2014-06-30 14:47:57 -04:00
winpos = _track_canvas - > canvas_to_window ( Duple ( event - > scroll . x , event - > scroll . y ) ) ;
scroll = event - > scroll ;
scroll . x = winpos . x ;
scroll . y = winpos . y ;
return canvas_scroll_event ( & scroll , true ) ;
break ;
2014-07-01 11:41:16 -04:00
case GDK_ENTER_NOTIFY :
return typed_event ( _canvas_drop_zone , event , DropZoneItem ) ;
case GDK_LEAVE_NOTIFY :
return typed_event ( _canvas_drop_zone , event , DropZoneItem ) ;
2023-02-06 20:14:38 -05:00
case GDK_MOTION_NOTIFY :
return motion_handler ( _canvas_drop_zone , event ) ;
break ;
2014-06-22 15:24:11 -04:00
default :
break ;
}
2014-04-16 04:16:56 -04:00
return true ;
}
2023-09-05 12:29:26 -04:00
bool
Editor : : canvas_grid_zone_event ( GdkEvent * event )
{
GdkEventScroll scroll ;
ArdourCanvas : : Duple winpos ;
2023-10-03 18:00:35 -04:00
2023-09-05 12:29:26 -04:00
switch ( event - > type ) {
case GDK_BUTTON_PRESS :
2023-10-03 18:00:35 -04:00
if ( event - > button . button = = 1 ) {
choose_mapping_drag ( _canvas_grid_zone , event ) ;
}
2023-09-05 12:29:26 -04:00
break ;
case GDK_BUTTON_RELEASE :
return typed_event ( _canvas_grid_zone , event , GridZoneItem ) ;
break ;
case GDK_SCROLL :
/* convert coordinates back into window space so that
* we can just call canvas_scroll_event ( ) .
*/
winpos = _track_canvas - > canvas_to_window ( Duple ( event - > scroll . x , event - > scroll . y ) ) ;
scroll = event - > scroll ;
scroll . x = winpos . x ;
scroll . y = winpos . y ;
return canvas_scroll_event ( & scroll , true ) ;
break ;
case GDK_ENTER_NOTIFY :
return typed_event ( _canvas_grid_zone , event , GridZoneItem ) ;
case GDK_LEAVE_NOTIFY :
return typed_event ( _canvas_grid_zone , event , GridZoneItem ) ;
case GDK_MOTION_NOTIFY :
return motion_handler ( _canvas_grid_zone , event ) ;
break ;
default :
break ;
}
return true ;
}
2009-06-08 15:28:51 -04:00
bool
2013-03-20 17:33:25 -04:00
Editor : : track_canvas_drag_motion ( Glib : : RefPtr < Gdk : : DragContext > const & context , int x , int y , guint time )
2009-06-08 15:28:51 -04:00
{
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Region > region ;
std : : shared_ptr < Region > region_copy ;
2013-03-20 17:33:25 -04:00
RouteTimeAxisView * rtav ;
GdkEvent event ;
double px ;
double py ;
2013-04-04 18:45:27 -04:00
string target = _track_canvas - > drag_dest_find_target ( context , _track_canvas - > drag_dest_get_target_list ( ) ) ;
2013-03-20 17:33:25 -04:00
if ( target . empty ( ) ) {
return false ;
}
2009-06-08 15:28:51 -04:00
event . type = GDK_MOTION_NOTIFY ;
2013-04-12 11:09:49 -04:00
event . button . x = x ;
event . button . y = y ;
2009-06-08 15:28:51 -04:00
/* assume we're dragging with button 1 */
event . motion . state = Gdk : : BUTTON1_MASK ;
2014-02-26 08:43:53 -05:00
( void ) window_event_sample ( & event , & px , & py ) ;
2009-06-08 15:28:51 -04:00
2014-10-21 05:46:15 -04:00
std : : pair < TimeAxisView * , int > const tv = trackview_by_y_position ( py , false ) ;
2013-03-29 14:09:03 -04:00
bool can_drop = false ;
2015-10-05 10:17:49 -04:00
2013-03-20 17:33:25 -04:00
if ( tv . first ! = 0 ) {
2009-06-08 15:28:51 -04:00
2013-03-29 14:09:03 -04:00
/* over a time axis view of some kind */
2013-03-20 17:33:25 -04:00
rtav = dynamic_cast < RouteTimeAxisView * > ( tv . first ) ;
2015-10-05 10:17:49 -04:00
2013-03-20 17:33:25 -04:00
if ( rtav ! = 0 & & rtav - > is_track ( ) ) {
2013-03-29 14:09:03 -04:00
/* over a track, not a bus */
can_drop = true ;
}
2015-10-05 10:17:49 -04:00
2013-03-29 14:09:03 -04:00
} else {
/* not over a time axis view, so drop is possible */
can_drop = true ;
}
2009-06-08 15:28:51 -04:00
2013-03-29 14:09:03 -04:00
if ( can_drop ) {
2018-11-15 10:30:22 -05:00
2022-01-18 00:52:57 -05:00
if ( target = = " x-ardour/region.pbdid " ) {
2022-01-18 23:05:57 -05:00
if ( tv . first = = 0 & & pbdid_dragged_dt ! = DataType : : NIL ) {
2015-03-24 20:47:48 -04:00
/* drop to drop-zone */
2022-01-18 23:05:57 -05:00
context - > drag_status ( Gdk : : ACTION_COPY , time ) ;
2015-03-24 20:47:48 -04:00
return true ;
}
2015-10-05 10:17:49 -04:00
2022-01-18 23:05:57 -05:00
if ( ( pbdid_dragged_dt = = DataType : : AUDIO & & dynamic_cast < AudioTimeAxisView * > ( tv . first ) ! = 0 ) | |
( pbdid_dragged_dt = = DataType : : MIDI & & dynamic_cast < MidiTimeAxisView * > ( tv . first ) ! = 0 ) ) {
2022-01-18 00:52:57 -05:00
/* audio to audio OR MIDI to MIDI */
2022-01-18 23:05:57 -05:00
context - > drag_status ( Gdk : : ACTION_COPY , time ) ;
2013-03-29 14:09:03 -04:00
return true ;
}
} else {
/* DND originating from outside ardour
*
* TODO : check if file is audio / midi , allow drops on same track - type only ,
* currently : if audio is dropped on a midi - track , it is only added to the region - list
*/
2015-10-26 15:17:42 -04:00
if ( UIConfiguration : : instance ( ) . get_only_copy_imported_files ( ) ) {
2013-03-29 14:09:03 -04:00
context - > drag_status ( Gdk : : ACTION_COPY , time ) ;
2013-03-21 16:33:02 -04:00
} else {
2013-03-29 14:09:03 -04:00
if ( ( context - > get_actions ( ) & ( Gdk : : ACTION_COPY | Gdk : : ACTION_LINK | Gdk : : ACTION_MOVE ) ) = = Gdk : : ACTION_COPY ) {
2013-03-21 16:33:02 -04:00
context - > drag_status ( Gdk : : ACTION_COPY , time ) ;
} else {
2013-03-29 14:09:03 -04:00
context - > drag_status ( Gdk : : ACTION_LINK , time ) ;
2013-03-21 16:33:02 -04:00
}
2013-03-20 17:33:25 -04:00
}
2013-03-29 14:09:03 -04:00
return true ;
2010-05-05 18:09:07 -04:00
}
2013-03-20 17:33:25 -04:00
}
2010-05-05 18:09:07 -04:00
2013-03-20 17:33:25 -04:00
/* no drop here */
context - > drag_status ( Gdk : : DragAction ( 0 ) , time ) ;
return false ;
}
2009-06-08 15:28:51 -04:00
2013-03-20 17:33:25 -04:00
void
Editor : : drop_regions ( const Glib : : RefPtr < Gdk : : DragContext > & /*context*/ ,
2017-07-01 12:42:24 -04:00
int x , int y ,
2022-01-18 00:52:57 -05:00
const SelectionData & data ,
guint /*info*/ , guint /*time*/ )
2013-03-20 17:33:25 -04:00
{
GdkEvent event ;
double px ;
double py ;
2009-06-08 15:28:51 -04:00
2013-03-20 17:33:25 -04:00
event . type = GDK_MOTION_NOTIFY ;
2013-04-12 11:09:49 -04:00
event . button . x = x ;
event . button . y = y ;
2013-03-20 17:33:25 -04:00
/* assume we're dragging with button 1 */
event . motion . state = Gdk : : BUTTON1_MASK ;
2017-09-18 12:39:17 -04:00
samplepos_t const pos = window_event_sample ( & event , & px , & py ) ;
2009-10-14 12:10:01 -04:00
2022-01-18 00:52:57 -05:00
PBD : : ID rid ( data . get_data_as_string ( ) ) ;
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Region > region = RegionFactory : : region_by_id ( rid ) ;
2018-11-15 10:24:37 -05:00
2015-03-24 20:47:48 -04:00
if ( ! region ) { return ; }
RouteTimeAxisView * rtav = 0 ;
2014-06-25 12:39:52 -04:00
std : : pair < TimeAxisView * , int > const tv = trackview_by_y_position ( py , false ) ;
2009-06-08 15:28:51 -04:00
2013-03-20 17:33:25 -04:00
if ( tv . first ! = 0 ) {
rtav = dynamic_cast < RouteTimeAxisView * > ( tv . first ) ;
2015-03-24 20:47:48 -04:00
} else {
try {
2023-02-16 18:33:28 -05:00
if ( std : : dynamic_pointer_cast < AudioRegion > ( region ) ) {
2020-10-02 23:26:17 -04:00
uint32_t output_chan = region - > sources ( ) . size ( ) ;
2015-03-27 14:01:19 -04:00
if ( ( Config - > get_output_auto_connect ( ) & AutoConnectMaster ) & & session ( ) - > master_out ( ) ) {
output_chan = session ( ) - > master_out ( ) - > n_inputs ( ) . n_audio ( ) ;
}
2023-02-16 18:33:28 -05:00
list < std : : shared_ptr < AudioTrack > > audio_tracks ;
2020-10-02 23:26:17 -04:00
audio_tracks = session ( ) - > new_audio_track ( region - > sources ( ) . size ( ) , output_chan , 0 , 1 , region - > name ( ) , PresentationInfo : : max_order ) ;
2017-05-05 07:31:49 -04:00
rtav = dynamic_cast < RouteTimeAxisView * > ( time_axis_view_from_stripable ( audio_tracks . front ( ) ) ) ;
2023-02-16 18:33:28 -05:00
} else if ( std : : dynamic_pointer_cast < MidiRegion > ( region ) ) {
2015-03-24 20:47:48 -04:00
ChanCount one_midi_port ( DataType : : MIDI , 1 ) ;
2023-02-16 18:33:28 -05:00
list < std : : shared_ptr < MidiTrack > > midi_tracks ;
2017-01-20 15:47:09 -05:00
midi_tracks = session ( ) - > new_midi_track ( one_midi_port , one_midi_port ,
Config - > get_strict_io ( ) | | Profile - > get_mixbus ( ) ,
2023-02-16 18:33:28 -05:00
std : : shared_ptr < ARDOUR : : PluginInfo > ( ) ,
2016-05-17 08:21:05 -04:00
( ARDOUR : : Plugin : : PresetRecord * ) 0 ,
2021-07-17 17:46:18 -04:00
( ARDOUR : : RouteGroup * ) 0 , 1 , region - > name ( ) , PresentationInfo : : max_order , Normal , true ) ;
2017-05-05 07:31:49 -04:00
rtav = dynamic_cast < RouteTimeAxisView * > ( time_axis_view_from_stripable ( midi_tracks . front ( ) ) ) ;
2015-03-24 20:47:48 -04:00
} else {
return ;
}
} catch ( . . . ) {
error < < _ ( " Could not create new track after region placed in the drop zone " ) < < endmsg ;
return ;
}
}
2013-03-20 17:33:25 -04:00
2015-03-24 20:47:48 -04:00
if ( rtav ! = 0 & & rtav - > is_track ( ) ) {
2023-02-16 18:33:28 -05:00
std : : shared_ptr < Region > region_copy = RegionFactory : : create ( region , true ) ;
2013-03-20 17:33:25 -04:00
2023-02-16 18:33:28 -05:00
if ( ( std : : dynamic_pointer_cast < AudioRegion > ( region_copy ) ! = 0 & & dynamic_cast < AudioTimeAxisView * > ( rtav ) ! = 0 ) | |
( std : : dynamic_pointer_cast < MidiRegion > ( region_copy ) ! = 0 & & dynamic_cast < MidiTimeAxisView * > ( rtav ) ! = 0 ) ) {
2022-05-27 17:57:14 -04:00
_drags - > set ( new RegionInsertDrag ( this , region_copy , rtav , timepos_t ( pos ) , drag_time_domain ( region_copy . get ( ) ) ) , & event ) ;
2017-01-30 11:03:45 -05:00
_drags - > end_grab ( & event ) ;
2013-03-20 17:33:25 -04:00
}
}
2009-06-08 15:28:51 -04:00
}
2011-08-15 11:08:37 -04:00
bool
2011-09-30 13:55:14 -04:00
Editor : : key_press_handler ( ArdourCanvas : : Item * , GdkEvent * , ItemType )
2011-08-15 11:08:37 -04:00
{
return false ;
}
bool
Editor : : key_release_handler ( ArdourCanvas : : Item * item , GdkEvent * event , ItemType type )
{
bool handled = false ;
switch ( type ) {
case TempoMarkerItem :
switch ( event - > key . keyval ) {
case GDK_Delete :
remove_tempo_marker ( item ) ;
handled = true ;
break ;
default :
break ;
}
break ;
case MeterMarkerItem :
switch ( event - > key . keyval ) {
case GDK_Delete :
remove_meter_marker ( item ) ;
handled = true ;
break ;
default :
break ;
}
break ;
default :
break ;
}
return handled ;
}