major design changes: use glib event loop for MIDI thread/UI; rework design of BaseUI...
[ardour.git] / libs / surfaces / control_protocol / control_protocol / basic_ui.h
1 /*
2     Copyright (C) 2006 Paul Davis 
3
4     This program is free software; you can redistribute it
5     and/or modify it under the terms of the GNU Lesser
6     General Public License as published by the Free Software
7     Foundation; either version 2 of the License, or (at your
8     option) any later version.
9
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13     GNU General Public License for more details.
14
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
19 */
20
21 #ifndef __ardour_basic_ui_h__
22 #define __ardour_basic_ui_h__
23
24 #include <string>
25
26
27 #include <jack/types.h>
28
29 #include "control_protocol/timecode.h"
30
31 namespace ARDOUR {
32         class Session;
33 }
34
35 class BasicUI {
36   public:
37         BasicUI (ARDOUR::Session&);
38         virtual ~BasicUI ();
39         
40         void add_marker ();
41
42         void register_thread (std::string name);
43
44         /* transport control */
45
46         void loop_toggle ();
47         void access_action ( std::string action_path );
48         static sigc::signal<void,std::string,std::string> AccessAction;
49         void goto_start ();
50         void goto_end ();
51         void rewind ();
52         void ffwd ();
53         void transport_stop ();
54         void transport_play (bool jump_back = true);
55         void set_transport_speed (double speed);
56         double get_transport_speed ();
57
58         jack_nframes_t transport_frame ();
59         void locate (jack_nframes_t frame, bool play = false);
60         bool locating ();
61         bool locked ();
62
63         void save_state ();
64         void prev_marker ();
65         void next_marker ();
66         void undo ();
67         void redo ();
68         void toggle_punch_in ();
69         void toggle_punch_out ();
70
71         void set_record_enable (bool yn);
72         bool get_record_enabled ();
73
74         void rec_enable_toggle ();
75         void toggle_all_rec_enables ();
76
77         jack_nframes_t timecode_frames_per_hour ();
78
79         void timecode_time (jack_nframes_t where, Timecode::Time&);
80         void timecode_to_sample (Timecode::Time& timecode, jack_nframes_t& sample, bool use_offset, bool use_subframes) const;
81         void sample_to_timecode (jack_nframes_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const;
82
83   protected:
84         BasicUI ();
85         ARDOUR::Session* session;
86 };
87
88 #endif /* __ardour_basic_ui_h__ */