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 button_varispeed (bool fwd);
67 	void rewind ();
68 	void ffwd ();
69 	void transport_stop ();
70 	void transport_play (bool jump_back = false);
71 	void set_transport_speed (double speed);
72 
73 	double get_transport_speed () const;
74 	double transport_rolling () const;
75 
76 	void jump_by_seconds (double sec, ARDOUR::LocateTransportDisposition ltd = ARDOUR::RollIfAppropriate);
77 	void jump_by_bars (double bars, ARDOUR::LocateTransportDisposition ltd = ARDOUR::RollIfAppropriate);
78 	void jump_by_beats (double beats, ARDOUR::LocateTransportDisposition ltd = ARDOUR::RollIfAppropriate);
79 
80 	ARDOUR::samplepos_t transport_sample ();
81 	void locate (ARDOUR::samplepos_t sample, ARDOUR::LocateTransportDisposition ltd);
82 	void locate (ARDOUR::samplepos_t sample, bool);
83 	bool locating ();
84 	bool locked ();
85 
86 	void save_state ();
87 	void prev_marker ();
88 	void next_marker ();
89 	void undo ();
90 	void redo ();
91 	void toggle_punch_in ();
92 	void toggle_punch_out ();
93 
94 	void mark_in();
95 	void mark_out();
96 
97 	void toggle_click();
98 	void midi_panic();
99 
100 	void toggle_monitor_mute();
101 	void toggle_monitor_dim();
102 	void toggle_monitor_mono();
103 
104 	void cancel_all_solo ();
105 
106 	void quick_snapshot_stay ();
107 	void quick_snapshot_switch ();
108 
109 	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".
110 
111 	void stop_forget();
112 
113 	void set_punch_range();
114 	void set_loop_range();
115 	void set_session_range();
116 
117 	void set_record_enable (bool yn);
118 	bool get_record_enabled ();
119 
120 	//editor visibility stuff  (why do we have to make explicit numbers here?  because "gui actions" don't accept args
121 	void fit_1_track();
122 	void fit_2_tracks();
123 	void fit_4_tracks();
124 	void fit_8_tracks();
125 	void fit_16_tracks();
126 	void fit_32_tracks();
127 	void fit_all_tracks();
128 	void zoom_10_ms();
129 	void zoom_100_ms();
130 	void zoom_1_sec();
131 	void zoom_10_sec();
132 	void zoom_1_min();
133 	void zoom_5_min();
134 	void zoom_10_min();
135 	void zoom_to_session();
136 	void temporal_zoom_in();
137 	void temporal_zoom_out();
138 
139 	void scroll_up_1_track();
140 	void scroll_dn_1_track();
141 	void scroll_up_1_page();
142 	void scroll_dn_1_page();
143 
144 	void rec_enable_toggle ();
145 	void toggle_all_rec_enables ();
146 
147 	void all_tracks_rec_in ();
148 	void all_tracks_rec_out ();
149 
150 	void goto_nth_marker (int n);
151 
152 	ARDOUR::samplecnt_t timecode_frames_per_hour ();
153 
154 	void timecode_time (samplepos_t where, Timecode::Time&);
155 	void timecode_to_sample (Timecode::Time& timecode, samplepos_t & sample, bool use_offset, bool use_subframes) const;
156 	void sample_to_timecode (samplepos_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const;
157 
158 	bool stop_button_onoff() const;
159 	bool play_button_onoff() const;
160 	bool ffwd_button_onoff() const;
161 	bool rewind_button_onoff() const;
162 	bool loop_button_onoff() const;
163 
164   protected:
165 	BasicUI ();
166 	ARDOUR::Session* session;
167 };
168 
169 #endif /* __ardour_basic_ui_h__ */
170