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"
30 #include "ardour_ui.h"
32 #include "region_view.h"
33 #include "selection.h"
34 #include "time_axis_view.h"
38 using namespace ARDOUR;
40 using namespace Editing;
43 Editor::keyboard_selection_finish (bool add)
47 framepos_t start = selection->time.start();
50 if ((_edit_point == EditAtPlayhead) && _session->transport_rolling()) {
51 end = _session->audible_frame();
53 end = get_preferred_edit_position();
56 //snap the selection start/end
59 //if no tracks are selected and we're working from the keyboard, enable all tracks (_something_ has to be selected for any range selection)
60 if ( (_edit_point == EditAtPlayhead) && selection->tracks.empty() )
63 selection->set (start, end);
65 //if session is playing a range, cancel that
66 // if (_session->get_play_range())
67 // _session->request_cancel_play_range();
73 Editor::keyboard_selection_begin ()
78 framepos_t end = selection->time.end_frame(); //0 if no current selection
80 if ((_edit_point == EditAtPlayhead) && _session->transport_rolling()) {
81 start = _session->audible_frame();
83 start = get_preferred_edit_position();
86 //snap the selection start/end
89 //if there's not already a sensible selection endpoint, go "forever"
94 //if no tracks are selected and we're working from the keyboard, enable all tracks (_something_ has to be selected for any range selection)
95 if ( selection->tracks.empty() )
98 selection->set (start, end);
100 //if session is playing a range, cancel that
101 if (_session->get_play_range())
102 _session->request_transport_speed ( 1.0 );
104 //if join playhead, locate to the newly selected start
105 // if ( !_session->transport_rolling() && Config->get_join_play_range() )
106 // _session->request_cancel_play_range();
112 Editor::keyboard_selection_finish (bool add)
114 if (_session && have_pending_keyboard_selection) {
119 if (_session->transport_rolling()) {
120 end = _session->audible_frame();
122 if (!mouse_frame (end, ignored)) {
128 selection->add (pending_keyboard_selection_start, end);
130 selection->set (pending_keyboard_selection_start, end);
133 have_pending_keyboard_selection = false;
138 Editor::keyboard_selection_begin ()
141 if (_session->transport_rolling()) {
142 pending_keyboard_selection_start = _session->audible_frame();
143 have_pending_keyboard_selection = true;
146 framepos_t where; // XXX fix me
148 if (mouse_frame (where, ignored)) {
149 pending_keyboard_selection_start = where;
150 have_pending_keyboard_selection = true;
158 Editor::keyboard_paste ()