2 Copyright (C) 2004 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include <ardour/audioregion.h>
24 #include "regionview.h"
25 #include "selection.h"
28 Editor::kbd_driver (sigc::slot<void,GdkEvent*> theslot, bool use_track_canvas, bool use_time_canvas, bool can_select)
33 Gdk::ModifierType mask;
34 Glib::RefPtr<Gdk::Window> evw = track_canvas.get_window()->get_pointer (x, y, mask);
37 if (use_track_canvas && track_canvas_event_box.get_window()->get_pointer(x, y, mask) != 0) {
40 } else if (use_time_canvas && time_canvas_event_box.get_window()->get_pointer(x, y, mask)!= 0) {
46 if (entered_regionview && can_select) {
47 selection->set (entered_regionview);
50 track_canvas.c2w(x, y, dx, dy);
51 ev.type = GDK_BUTTON_PRESS;
54 ev.button.state = 0; /* XXX correct? */
61 Editor::kbd_set_playhead_cursor ()
63 kbd_driver (mem_fun(*this, &Editor::set_playhead_cursor), true, true, false);
67 Editor::kbd_set_edit_cursor ()
69 kbd_driver (mem_fun(*this, &Editor::set_edit_cursor), true, true, false);
74 Editor::kbd_do_split (GdkEvent* ev)
76 jack_nframes_t where = event_frame (ev);
78 if (entered_regionview) {
79 if (selection->audio_regions.find (entered_regionview) != selection->audio_regions.end()) {
80 split_regions_at (where, selection->audio_regions);
82 AudioRegionSelection s;
83 s.add (entered_regionview);
84 split_regions_at (where, s);
92 kbd_driver (mem_fun(*this, &Editor::kbd_do_split), true, true, false);
96 Editor::kbd_do_align (GdkEvent* ev, ARDOUR::RegionPoint what)
102 Editor::kbd_align (ARDOUR::RegionPoint what)
104 kbd_driver (bind (mem_fun(*this, &Editor::kbd_do_align), what));
108 Editor::kbd_do_align_relative (GdkEvent* ev, ARDOUR::RegionPoint what)
114 Editor::kbd_align_relative (ARDOUR::RegionPoint what)
116 kbd_driver (bind (mem_fun(*this, &Editor::kbd_do_align), what), true, true, false);
120 Editor::kbd_do_brush (GdkEvent *ev)
122 brush (event_frame (ev, 0, 0));
128 kbd_driver (mem_fun(*this, &Editor::kbd_do_brush), true, true, false);
132 Editor::kbd_do_audition (GdkEvent *ignored)
134 audition_selected_region ();
138 Editor::kbd_audition ()
140 kbd_driver (mem_fun(*this, &Editor::kbd_do_audition), true, false, true);