2 Copyright (C) 2000 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.
24 #include <gtkmm/treeview.h>
26 #include "pbd/error.h"
28 #include "ardour/session.h"
31 #include "region_view.h"
32 #include "selection.h"
33 #include "time_axis_view.h"
37 using namespace ARDOUR;
39 using namespace Editing;
42 Editor::keyboard_selection_finish (bool /*add*/, Editing::EditIgnoreOption ign)
46 MusicSample start (selection->time.start(), 0);
48 if ((_edit_point == EditAtPlayhead) && _session->transport_rolling()) {
49 end = _session->audible_sample();
51 end = get_preferred_edit_position(ign);
54 //if no tracks are selected and we're working from the keyboard, enable all tracks (_something_ has to be selected for any range selection)
55 if ( (_edit_point == EditAtPlayhead) && selection->tracks.empty() )
58 selection->set (start.sample, end);
60 //if session is playing a range, cancel that
61 if (_session->get_play_range())
62 _session->request_cancel_play_range();
68 Editor::keyboard_selection_begin (Editing::EditIgnoreOption ign)
72 MusicSample start (0, 0);
73 MusicSample end (selection->time.end_sample(), 0);
74 if ((_edit_point == EditAtPlayhead) && _session->transport_rolling()) {
75 start.sample = _session->audible_sample();
77 start.sample = get_preferred_edit_position(ign);
80 //if there's not already a sensible selection endpoint, go "forever"
81 if (start.sample > end.sample) {
84 // This works around a visual glitch in red-bordered selection rect.
85 end.sample = start.sample + _session->nominal_sample_rate() * 60 * 60 * 4;
87 end.sample = max_samplepos;
91 //if no tracks are selected and we're working from the keyboard, enable all tracks (_something_ has to be selected for any range selection)
92 if ( selection->tracks.empty() )
95 selection->set (start.sample, end.sample);
97 //if session is playing a range, cancel that
98 if (_session->get_play_range())
99 _session->request_cancel_play_range();
104 Editor::keyboard_paste ()