70f40f97b8308818b04eca3495cc0350dfddafbc
[ardour.git] / libs / surfaces / control_protocol / control_protocol / basic_ui.h
1 /*
2  * Copyright (C) 2006-2010 David Robillard <d@drobilla.net>
3  * Copyright (C) 2007-2017 Paul Davis <paul@linuxaudiosystems.com>
4  * Copyright (C) 2010 Carl Hetherington <carl@carlh.net>
5  * Copyright (C) 2015 Robin Gareus <robin@gareus.org>
6  * Copyright (C) 2016 Ben Loftis <ben@harrisonconsoles.com>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program; if not, write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22
23 #ifndef __ardour_basic_ui_h__
24 #define __ardour_basic_ui_h__
25
26 #include <string>
27 #include <stdint.h>
28
29 #include "pbd/signals.h"
30
31 #include "ardour/types.h"
32 #include "ardour/presentation_info.h"
33
34 #include "temporal/time.h"
35
36 #include "control_protocol/visibility.h"
37
38 namespace ARDOUR {
39         class Session;
40         class SessionEvent;
41         class Stripable;
42 }
43
44 class LIBCONTROLCP_API BasicUI {
45   public:
46         BasicUI (ARDOUR::Session&);
47         virtual ~BasicUI ();
48
49         void add_marker (const std::string& = std::string());
50         void remove_marker_at_playhead ();
51
52 //      void mark_in();
53 //      void mark_out();
54
55         void register_thread (std::string name);
56
57         /* transport control */
58
59         void loop_toggle ();
60         void loop_location (samplepos_t start, samplepos_t end);
61         void access_action ( std::string action_path );
62         static PBD::Signal2<void,std::string,std::string> AccessAction;
63         void goto_zero ();
64         void goto_start (bool and_roll = false);
65         void goto_end ();
66         void rewind ();
67         void ffwd ();
68         void transport_stop ();
69         void transport_play (bool jump_back = false);
70         void set_transport_speed (double speed);
71         double get_transport_speed ();
72
73         void jump_by_seconds (double sec, ARDOUR::LocateTransportDisposition ltd = ARDOUR::DoTheRightThing);
74         void jump_by_bars (double bars, ARDOUR::LocateTransportDisposition ltd = ARDOUR::DoTheRightThing);
75         void jump_by_beats (double beats, ARDOUR::LocateTransportDisposition ltd = ARDOUR::DoTheRightThing);
76
77         ARDOUR::samplepos_t transport_sample ();
78         void locate (ARDOUR::samplepos_t sample, ARDOUR::LocateTransportDisposition ltd);
79         void locate (ARDOUR::samplepos_t sample, bool);
80         bool locating ();
81         bool locked ();
82
83         void save_state ();
84         void prev_marker ();
85         void next_marker ();
86         void undo ();
87         void redo ();
88         void toggle_punch_in ();
89         void toggle_punch_out ();
90
91         void mark_in();
92         void mark_out();
93
94         void toggle_click();
95         void midi_panic();
96
97         void toggle_monitor_mute();
98         void toggle_monitor_dim();
99         void toggle_monitor_mono();
100
101         void cancel_all_solo ();
102
103         void quick_snapshot_stay ();
104         void quick_snapshot_switch ();
105
106         void toggle_roll(bool roll_out_of_bounded_mode=true);  //this provides the same operation as the "spacebar", it's a lot smarter than "play".
107
108         void stop_forget();
109
110         void set_punch_range();
111         void set_loop_range();
112         void set_session_range();
113
114         void set_record_enable (bool yn);
115         bool get_record_enabled ();
116
117         //editor visibility stuff  (why do we have to make explicit numbers here?  because "gui actions" don't accept args
118         void fit_1_track();
119         void fit_2_tracks();
120         void fit_4_tracks();
121         void fit_8_tracks();
122         void fit_16_tracks();
123         void fit_32_tracks();
124         void fit_all_tracks();
125         void zoom_10_ms();
126         void zoom_100_ms();
127         void zoom_1_sec();
128         void zoom_10_sec();
129         void zoom_1_min();
130         void zoom_5_min();
131         void zoom_10_min();
132         void zoom_to_session();
133         void temporal_zoom_in();
134         void temporal_zoom_out();
135
136         void scroll_up_1_track();
137         void scroll_dn_1_track();
138         void scroll_up_1_page();
139         void scroll_dn_1_page();
140
141         void rec_enable_toggle ();
142         void toggle_all_rec_enables ();
143
144         void all_tracks_rec_in ();
145         void all_tracks_rec_out ();
146
147         void goto_nth_marker (int n);
148
149         ARDOUR::samplecnt_t timecode_frames_per_hour ();
150
151         void timecode_time (samplepos_t where, Timecode::Time&);
152         void timecode_to_sample (Timecode::Time& timecode, samplepos_t & sample, bool use_offset, bool use_subframes) const;
153         void sample_to_timecode (samplepos_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const;
154
155         bool stop_button_onoff() const;
156         bool play_button_onoff() const;
157         bool ffwd_button_onoff() const;
158         bool rewind_button_onoff() const;
159         bool loop_button_onoff() const;
160
161   protected:
162         BasicUI ();
163         ARDOUR::Session* session;
164 };
165
166 #endif /* __ardour_basic_ui_h__ */