fixup auto-connection of new MIDI tracks and MIDI tracks with newly-added audio ports
[ardour2.git] / gtk2_ardour / editor_keys.cc
blob2da3122d48d8c324acc4b767477d97543bf20aff
1 /*
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.
20 #include <cstdlib>
21 #include <cmath>
22 #include <string>
24 #include "pbd/error.h"
26 #include "ardour/session.h"
27 #include "ardour/region.h"
28 #include <gtkmm/treeview.h>
30 #include "ardour_ui.h"
31 #include "editor.h"
32 #include "time_axis_view.h"
33 #include "region_view.h"
34 #include "selection.h"
36 #include "i18n.h"
38 using namespace ARDOUR;
39 using namespace PBD;
41 void
42 Editor::keyboard_selection_finish (bool add)
44 if (_session && have_pending_keyboard_selection) {
46 framepos_t end;
47 bool ignored;
49 if (_session->transport_rolling()) {
50 end = _session->audible_frame();
51 } else {
52 if (!mouse_frame (end, ignored)) {
53 return;
57 if (add) {
58 selection->add (pending_keyboard_selection_start, end);
59 } else {
60 selection->set (pending_keyboard_selection_start, end);
63 have_pending_keyboard_selection = false;
67 void
68 Editor::keyboard_selection_begin ()
70 if (_session) {
71 if (_session->transport_rolling()) {
72 pending_keyboard_selection_start = _session->audible_frame();
73 have_pending_keyboard_selection = true;
74 } else {
75 bool ignored;
76 framepos_t where; // XXX fix me
78 if (mouse_frame (where, ignored)) {
79 pending_keyboard_selection_start = where;
80 have_pending_keyboard_selection = true;
87 void
88 Editor::keyboard_paste ()
90 ensure_entered_track_selected (true);
91 paste (1);