2 Copyright (C) 1999 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef __audio_clock_h__
22 #define __audio_clock_h__
25 #include <ardour/ardour.h>
31 class AudioClock : public Gtk::HBox
42 AudioClock (const string& name, bool editable, bool is_duration = false, bool with_tempo_meter = false);
44 Mode mode() const { return _mode; }
46 void set (jack_nframes_t, bool force = false);
49 jack_nframes_t current_time (jack_nframes_t position = 0) const;
50 jack_nframes_t current_duration (jack_nframes_t position = 0) const;
51 void set_session (ARDOUR::Session *s);
53 sigc::signal<void> ValueChanged;
56 ARDOUR::Session *session;
58 uint32_t key_entry_state;
64 Gtk::HBox smpte_packer_hbox;
65 Gtk::HBox smpte_packer;
67 Gtk::HBox minsec_packer_hbox;
68 Gtk::HBox minsec_packer;
70 Gtk::HBox bbt_packer_hbox;
73 Gtk::HBox frames_packer_hbox;
89 Gtk::EventBox audio_frames_ebox;
90 Gtk::Label audio_frames_label;
92 Gtk::EventBox hours_ebox;
93 Gtk::EventBox minutes_ebox;
94 Gtk::EventBox seconds_ebox;
95 Gtk::EventBox frames_ebox;
97 Gtk::EventBox ms_hours_ebox;
98 Gtk::EventBox ms_minutes_ebox;
99 Gtk::EventBox ms_seconds_ebox;
101 Gtk::EventBox bars_ebox;
102 Gtk::EventBox beats_ebox;
103 Gtk::EventBox ticks_ebox;
105 Gtk::Label hours_label;
106 Gtk::Label minutes_label;
107 Gtk::Label seconds_label;
108 Gtk::Label frames_label;
109 Gtk::Label colon1, colon2, colon3;
111 Gtk::Label ms_hours_label;
112 Gtk::Label ms_minutes_label;
113 Gtk::Label ms_seconds_label;
114 Gtk::Label colon4, colon5;
116 Gtk::Label bars_label;
117 Gtk::Label beats_label;
118 Gtk::Label ticks_label;
122 Gtk::Label* tempo_label;
123 Gtk::Label* meter_label;
125 Gtk::VBox tempo_meter_box;
127 Gtk::EventBox clock_base;
128 Gtk::Frame clock_frame;
130 jack_nframes_t last_when;
147 void realize_impl ();
149 gint field_motion_notify_event (GdkEventMotion *ev, Field);
150 gint field_button_press_event (GdkEventButton *ev, Field);
151 gint field_button_release_event (GdkEventButton *ev, Field);
152 gint field_key_release_event (GdkEventKey *, Field);
153 gint field_focus_in_event (GdkEventFocus *, Field);
154 gint field_focus_out_event (GdkEventFocus *, Field);
156 void set_smpte (jack_nframes_t, bool);
157 void set_bbt (jack_nframes_t, bool);
158 void set_minsec (jack_nframes_t, bool);
159 void set_frames (jack_nframes_t, bool);
161 jack_nframes_t get_frames (Field,jack_nframes_t pos = 0,int dir=1);
163 void smpte_sanitize_display();
164 jack_nframes_t smpte_frame_from_display () const;
165 jack_nframes_t bbt_frame_from_display (jack_nframes_t) const;
166 jack_nframes_t bbt_frame_duration_from_display (jack_nframes_t) const;
167 jack_nframes_t minsec_frame_from_display () const;
168 jack_nframes_t audio_frame_from_display () const;
170 void build_ops_menu ();
171 void setup_events ();
173 static const uint32_t field_length[(int)AudioFrames+1];
176 #endif /* __audio_clock_h__ */