Merge branch 'master' into cairocanvas
[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 #include <stdint.h>
26
27 #include "pbd/signals.h"
28
29 #include "ardour/types.h"
30
31 #include <jack/types.h>
32
33 #include "timecode/time.h"
34
35 #include "control_protocol/visibility.h"
36
37 namespace ARDOUR {
38         class Session;
39         class SessionEvent;
40 }
41
42 class LIBCONTROLCP_API BasicUI {
43   public:
44         BasicUI (ARDOUR::Session&);
45         virtual ~BasicUI ();
46         
47         void add_marker (const std::string& = std::string());
48
49         void register_thread (std::string name);
50
51         /* transport control */
52
53         void loop_toggle ();
54         void access_action ( std::string action_path );
55         static PBD::Signal2<void,std::string,std::string> AccessAction;
56         void goto_start ();
57         void goto_end ();
58         void rewind ();
59         void ffwd ();
60         void transport_stop ();
61         void transport_play (bool jump_back = true);
62         void set_transport_speed (double speed);
63         double get_transport_speed ();
64
65         ARDOUR::framepos_t transport_frame ();
66         void locate (ARDOUR::framepos_t frame, bool play = false);
67         bool locating ();
68         bool locked ();
69
70         void save_state ();
71         void prev_marker ();
72         void next_marker ();
73         void undo ();
74         void redo ();
75         void toggle_punch_in ();
76         void toggle_punch_out ();
77
78         void set_record_enable (bool yn);
79         bool get_record_enabled ();
80
81         void rec_enable_toggle ();
82         void toggle_all_rec_enables ();
83
84         ARDOUR::framecnt_t timecode_frames_per_hour ();
85
86         void timecode_time (framepos_t where, Timecode::Time&);
87         void timecode_to_sample (Timecode::Time& timecode, framepos_t & sample, bool use_offset, bool use_subframes) const;
88         void sample_to_timecode (framepos_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const;
89
90   protected:
91         BasicUI ();
92         ARDOUR::Session* session;
93 };
94
95 #endif /* __ardour_basic_ui_h__ */