Merged with trunk revision 610
[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     $Id$
20 */
21
22 #ifndef __ardour_basic_ui_h__
23 #define __ardour_basic_ui_h__
24
25 #include <string>
26
27 #include <jack/types.h>
28 #include <control_protocol/smpte.h>
29
30 namespace ARDOUR {
31         class Session;
32 }
33
34 class BasicUI {
35   public:
36         BasicUI (ARDOUR::Session&);
37         virtual ~BasicUI ();
38         
39         void add_marker ();
40
41         void register_thread (std::string name);
42
43         /* transport control */
44
45         void loop_toggle ();
46         void goto_start ();
47         void goto_end ();
48         void rewind ();
49         void ffwd ();
50         void transport_stop ();
51         void transport_play (bool jump_back = true);
52         void set_transport_speed (float speed);
53         float get_transport_speed ();
54
55         jack_nframes_t transport_frame ();
56         void locate (jack_nframes_t frame, bool play = false);
57         bool locating ();
58         bool locked ();
59
60         void save_state ();
61         void prev_marker ();
62         void next_marker ();
63         void undo ();
64         void redo ();
65         void toggle_punch_in ();
66         void toggle_punch_out ();
67
68         void set_record_enable (bool yn);
69         bool get_record_enabled ();
70
71         void rec_enable_toggle ();
72         void toggle_all_rec_enables ();
73
74         jack_nframes_t smpte_frames_per_hour ();
75
76         void smpte_time (jack_nframes_t where, SMPTE::Time&);
77         void smpte_to_sample (SMPTE::Time& smpte, jack_nframes_t& sample, bool use_offset, bool use_subframes) const;
78         void sample_to_smpte (jack_nframes_t sample, SMPTE::Time& smpte, bool use_offset, bool use_subframes) const;
79
80   protected:
81         BasicUI ();
82         ARDOUR::Session* session;
83 };
84
85 #endif /* __ardour_basic_ui_h__ */