2 Copyright (C) 2006 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/basic_ui.h>
22 #include <ardour/session.h>
23 #include <ardour/location.h>
27 using namespace ARDOUR;
29 BasicUI::BasicUI (Session& s)
40 BasicUI::loop_toggle ()
42 if (session.get_auto_loop()) {
43 session.request_auto_loop (false);
45 session.request_auto_loop (true);
46 if (!session.transport_rolling()) {
47 session.request_transport_speed (1.0);
53 BasicUI::goto_start ()
55 session.goto_start ();
65 BasicUI::add_marker ()
67 jack_nframes_t when = session.audible_frame();
68 session.locations()->add (new Location (when, when, _("unnamed"), Location::IsMark));
74 session.request_transport_speed (-2.0f);
80 session.request_transport_speed (2.0f);
84 BasicUI::transport_stop ()
86 session.request_transport_speed (0.0);
90 BasicUI::transport_play ()
92 bool rolling = session.transport_rolling ();
94 if (session.get_auto_loop()) {
95 session.request_auto_loop (false);
98 if (session.get_play_range ()) {
99 session.request_play_range (false);
103 session.request_locate (session.last_transport_start(), true);
107 session.request_transport_speed (1.0f);
111 BasicUI::rec_enable_toggle ()
113 switch (session.record_status()) {
114 case Session::Disabled:
115 if (session.ntracks() == 0) {
116 // string txt = _("Please create 1 or more track\nbefore trying to record.\nCheck the Session menu.");
117 // MessageDialog msg (*editor, txt);
121 session.maybe_enable_record ();
123 case Session::Recording:
124 case Session::Enabled:
125 session.disable_record (true);
130 BasicUI::save_state ()
132 session.save_state ("");
136 BasicUI::prev_marker ()
138 Location *location = session.locations()->first_location_before (session.transport_frame());
141 session.request_locate (location->start(), session.transport_rolling());
143 session.goto_start ();
148 BasicUI::next_marker ()
150 Location *location = session.locations()->first_location_after (session.transport_frame());
153 session.request_locate (location->start(), session.transport_rolling());
155 session.request_locate (session.current_end_frame());
160 BasicUI::move_at (float speed)
162 session.request_transport_speed (speed);
178 BasicUI::toggle_all_rec_enables ()
180 if (session.get_record_enabled()) {
181 session.record_disenable_all ();
183 session.record_enable_all ();