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.
20 #include <cstdio> // for sprintf
23 #include <pbd/convert.h>
24 #include <pbd/enumwriter.h>
26 #include <gtkmm2ext/utils.h>
28 #include <ardour/ardour.h>
29 #include <ardour/session.h>
30 #include <ardour/tempo.h>
31 #include <ardour/profile.h>
32 #include <sigc++/bind.h>
34 #include "ardour_ui.h"
35 #include "audio_clock.h"
40 using namespace ARDOUR;
49 sigc::signal<void> AudioClock::ModeChanged;
50 vector<AudioClock*> AudioClock::clocks;
52 const uint32_t AudioClock::field_length[(int) AudioClock::AudioFrames+1] = {
54 2, /* SMPTE_Minutes */
55 2, /* SMPTE_Seconds */
66 AudioClock::AudioClock (std::string clock_name, bool transient, std::string widget_name, bool allow_edit, bool duration, bool with_info)
68 is_transient (transient),
69 is_duration (duration),
70 editable (allow_edit),
88 frames_upper_info_label = manage (new Label);
89 frames_lower_info_label = manage (new Label);
90 smpte_upper_info_label = manage (new Label);
91 smpte_lower_info_label = manage (new Label);
92 bbt_upper_info_label = manage (new Label);
93 bbt_lower_info_label = manage (new Label);
95 frames_upper_info_label->set_name ("AudioClockFramesUpperInfo");
96 frames_lower_info_label->set_name ("AudioClockFramesLowerInfo");
97 smpte_upper_info_label->set_name ("AudioClockSMPTEUpperInfo");
98 smpte_lower_info_label->set_name ("AudioClockSMPTELowerInfo");
99 bbt_upper_info_label->set_name ("AudioClockBBTUpperInfo");
100 bbt_lower_info_label->set_name ("AudioClockBBTLowerInfo");
102 Gtkmm2ext::set_size_request_to_display_given_text(*smpte_upper_info_label, "23.98",0,0);
103 Gtkmm2ext::set_size_request_to_display_given_text(*smpte_lower_info_label, "NDF",0,0);
105 frames_info_box.pack_start (*frames_upper_info_label, true, true);
106 frames_info_box.pack_start (*frames_lower_info_label, true, true);
107 smpte_info_box.pack_start (*smpte_upper_info_label, true, true);
108 smpte_info_box.pack_start (*smpte_lower_info_label, true, true);
109 bbt_info_box.pack_start (*bbt_upper_info_label, true, true);
110 bbt_info_box.pack_start (*bbt_lower_info_label, true, true);
113 frames_upper_info_label = 0;
114 frames_lower_info_label = 0;
115 smpte_upper_info_label = 0;
116 smpte_lower_info_label = 0;
117 bbt_upper_info_label = 0;
118 bbt_lower_info_label = 0;
121 audio_frames_ebox.add (audio_frames_label);
123 frames_packer.set_homogeneous (false);
124 frames_packer.set_border_width (2);
125 frames_packer.pack_start (audio_frames_ebox, false, false);
128 frames_packer.pack_start (frames_info_box, false, false, 5);
131 frames_packer_hbox.pack_start (frames_packer, true, false);
133 hours_ebox.add (hours_label);
134 minutes_ebox.add (minutes_label);
135 seconds_ebox.add (seconds_label);
136 frames_ebox.add (frames_label);
137 bars_ebox.add (bars_label);
138 beats_ebox.add (beats_label);
139 ticks_ebox.add (ticks_label);
140 ms_hours_ebox.add (ms_hours_label);
141 ms_minutes_ebox.add (ms_minutes_label);
142 ms_seconds_ebox.add (ms_seconds_label);
144 smpte_packer.set_homogeneous (false);
145 smpte_packer.set_border_width (2);
146 smpte_packer.pack_start (hours_ebox, false, false);
147 smpte_packer.pack_start (colon1, false, false);
148 smpte_packer.pack_start (minutes_ebox, false, false);
149 smpte_packer.pack_start (colon2, false, false);
150 smpte_packer.pack_start (seconds_ebox, false, false);
151 smpte_packer.pack_start (colon3, false, false);
152 smpte_packer.pack_start (frames_ebox, false, false);
155 smpte_packer.pack_start (smpte_info_box, false, false, 5);
158 smpte_packer_hbox.pack_start (smpte_packer, true, false);
160 bbt_packer.set_homogeneous (false);
161 bbt_packer.set_border_width (2);
162 bbt_packer.pack_start (bars_ebox, false, false);
163 bbt_packer.pack_start (b1, false, false);
164 bbt_packer.pack_start (beats_ebox, false, false);
165 bbt_packer.pack_start (b2, false, false);
166 bbt_packer.pack_start (ticks_ebox, false, false);
169 bbt_packer.pack_start (bbt_info_box, false, false, 5);
172 bbt_packer_hbox.pack_start (bbt_packer, true, false);
174 minsec_packer.set_homogeneous (false);
175 minsec_packer.set_border_width (2);
176 minsec_packer.pack_start (ms_hours_ebox, false, false);
177 minsec_packer.pack_start (colon4, false, false);
178 minsec_packer.pack_start (ms_minutes_ebox, false, false);
179 minsec_packer.pack_start (colon5, false, false);
180 minsec_packer.pack_start (ms_seconds_ebox, false, false);
182 minsec_packer_hbox.pack_start (minsec_packer, true, false);
184 clock_frame.set_shadow_type (Gtk::SHADOW_IN);
185 clock_frame.set_name ("BaseFrame");
187 clock_frame.add (clock_base);
189 set_widget_name (widget_name);
191 _mode = BBT; /* lie to force mode switch */
194 pack_start (clock_frame, true, true);
196 /* the clock base handles button releases for menu popup regardless of
197 editable status. if the clock is editable, the clock base is where
198 we pass focus to after leaving the last editable "field", which
199 will then shutdown editing till the user starts it up again.
201 it does this because the focus out event on the field disables
202 keyboard event handling, and we don't connect anything up to
203 notice focus in on the clock base. hence, keyboard event handling
207 clock_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::SCROLL_MASK);
208 clock_base.signal_button_release_event().connect (bind (mem_fun (*this, &AudioClock::field_button_release_event), SMPTE_Hours));
210 Session::SMPTEOffsetChanged.connect (mem_fun (*this, &AudioClock::smpte_offset_changed));
216 set (last_when, true);
219 clocks.push_back (this);
224 AudioClock::set_widget_name (string name)
226 Widget::set_name (name);
228 clock_base.set_name (name);
230 audio_frames_label.set_name (name);
231 hours_label.set_name (name);
232 minutes_label.set_name (name);
233 seconds_label.set_name (name);
234 frames_label.set_name (name);
235 bars_label.set_name (name);
236 beats_label.set_name (name);
237 ticks_label.set_name (name);
238 ms_hours_label.set_name (name);
239 ms_minutes_label.set_name (name);
240 ms_seconds_label.set_name (name);
241 hours_ebox.set_name (name);
242 minutes_ebox.set_name (name);
243 seconds_ebox.set_name (name);
244 frames_ebox.set_name (name);
245 audio_frames_ebox.set_name (name);
246 bars_ebox.set_name (name);
247 beats_ebox.set_name (name);
248 ticks_ebox.set_name (name);
249 ms_hours_ebox.set_name (name);
250 ms_minutes_ebox.set_name (name);
251 ms_seconds_ebox.set_name (name);
253 colon1.set_name (name);
254 colon2.set_name (name);
255 colon3.set_name (name);
256 colon4.set_name (name);
257 colon5.set_name (name);
265 AudioClock::setup_events ()
267 clock_base.set_flags (Gtk::CAN_FOCUS);
269 hours_ebox.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK);
270 minutes_ebox.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK);
271 seconds_ebox.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK);
272 frames_ebox.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK);
273 bars_ebox.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK);
274 beats_ebox.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK);
275 ticks_ebox.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK);
276 ms_hours_ebox.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK);
277 ms_minutes_ebox.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK);
278 ms_seconds_ebox.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK);
279 audio_frames_ebox.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK|Gdk::FOCUS_CHANGE_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK);
281 hours_ebox.set_flags (Gtk::CAN_FOCUS);
282 minutes_ebox.set_flags (Gtk::CAN_FOCUS);
283 seconds_ebox.set_flags (Gtk::CAN_FOCUS);
284 frames_ebox.set_flags (Gtk::CAN_FOCUS);
285 audio_frames_ebox.set_flags (Gtk::CAN_FOCUS);
286 bars_ebox.set_flags (Gtk::CAN_FOCUS);
287 beats_ebox.set_flags (Gtk::CAN_FOCUS);
288 ticks_ebox.set_flags (Gtk::CAN_FOCUS);
289 ms_hours_ebox.set_flags (Gtk::CAN_FOCUS);
290 ms_minutes_ebox.set_flags (Gtk::CAN_FOCUS);
291 ms_seconds_ebox.set_flags (Gtk::CAN_FOCUS);
293 hours_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), SMPTE_Hours));
294 minutes_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), SMPTE_Minutes));
295 seconds_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), SMPTE_Seconds));
296 frames_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), SMPTE_Frames));
297 audio_frames_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), AudioFrames));
298 bars_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), Bars));
299 beats_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), Beats));
300 ticks_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), Ticks));
301 ms_hours_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), MS_Hours));
302 ms_minutes_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), MS_Minutes));
303 ms_seconds_ebox.signal_motion_notify_event().connect (bind (mem_fun(*this, &AudioClock::field_motion_notify_event), MS_Seconds));
305 hours_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), SMPTE_Hours));
306 minutes_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), SMPTE_Minutes));
307 seconds_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), SMPTE_Seconds));
308 frames_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), SMPTE_Frames));
309 audio_frames_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), AudioFrames));
310 bars_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), Bars));
311 beats_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), Beats));
312 ticks_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), Ticks));
313 ms_hours_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), MS_Hours));
314 ms_minutes_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), MS_Minutes));
315 ms_seconds_ebox.signal_button_press_event().connect (bind (mem_fun(*this, &AudioClock::field_button_press_event), MS_Seconds));
317 hours_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), SMPTE_Hours));
318 minutes_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), SMPTE_Minutes));
319 seconds_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), SMPTE_Seconds));
320 frames_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), SMPTE_Frames));
321 audio_frames_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), AudioFrames));
322 bars_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), Bars));
323 beats_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), Beats));
324 ticks_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), Ticks));
325 ms_hours_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), MS_Hours));
326 ms_minutes_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), MS_Minutes));
327 ms_seconds_ebox.signal_button_release_event().connect (bind (mem_fun(*this, &AudioClock::field_button_release_event), MS_Seconds));
329 hours_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), SMPTE_Hours));
330 minutes_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), SMPTE_Minutes));
331 seconds_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), SMPTE_Seconds));
332 frames_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), SMPTE_Frames));
333 audio_frames_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), AudioFrames));
334 bars_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), Bars));
335 beats_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), Beats));
336 ticks_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), Ticks));
337 ms_hours_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), MS_Hours));
338 ms_minutes_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), MS_Minutes));
339 ms_seconds_ebox.signal_scroll_event().connect (bind (mem_fun(*this, &AudioClock::field_button_scroll_event), MS_Seconds));
341 hours_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), SMPTE_Hours));
342 minutes_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), SMPTE_Minutes));
343 seconds_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), SMPTE_Seconds));
344 frames_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), SMPTE_Frames));
345 audio_frames_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), AudioFrames));
346 bars_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), Bars));
347 beats_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), Beats));
348 ticks_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), Ticks));
349 ms_hours_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), MS_Hours));
350 ms_minutes_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), MS_Minutes));
351 ms_seconds_ebox.signal_key_press_event().connect (bind (mem_fun(*this, &AudioClock::field_key_press_event), MS_Seconds));
353 hours_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), SMPTE_Hours));
354 minutes_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), SMPTE_Minutes));
355 seconds_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), SMPTE_Seconds));
356 frames_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), SMPTE_Frames));
357 audio_frames_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), AudioFrames));
358 bars_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), Bars));
359 beats_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), Beats));
360 ticks_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), Ticks));
361 ms_hours_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), MS_Hours));
362 ms_minutes_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), MS_Minutes));
363 ms_seconds_ebox.signal_key_release_event().connect (bind (mem_fun(*this, &AudioClock::field_key_release_event), MS_Seconds));
365 hours_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), SMPTE_Hours));
366 minutes_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), SMPTE_Minutes));
367 seconds_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), SMPTE_Seconds));
368 frames_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), SMPTE_Frames));
369 audio_frames_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), AudioFrames));
370 bars_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), Bars));
371 beats_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), Beats));
372 ticks_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), Ticks));
373 ms_hours_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), MS_Hours));
374 ms_minutes_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), MS_Minutes));
375 ms_seconds_ebox.signal_focus_in_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_in_event), MS_Seconds));
377 hours_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), SMPTE_Hours));
378 minutes_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), SMPTE_Minutes));
379 seconds_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), SMPTE_Seconds));
380 frames_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), SMPTE_Frames));
381 audio_frames_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), AudioFrames));
382 bars_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), Bars));
383 beats_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), Beats));
384 ticks_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), Ticks));
385 ms_hours_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), MS_Hours));
386 ms_minutes_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), MS_Minutes));
387 ms_seconds_ebox.signal_focus_out_event().connect (bind (mem_fun(*this, &AudioClock::field_focus_out_event), MS_Seconds));
389 clock_base.signal_focus_in_event().connect (mem_fun (*this, &AudioClock::drop_focus_handler));
393 AudioClock::drop_focus_handler (GdkEventFocus* ignored)
395 Keyboard::magic_widget_drop_focus ();
400 AudioClock::on_realize ()
404 /* styles are not available until the widgets are bound to a window */
406 set_size_requests ();
410 AudioClock::set (nframes_t when, bool force, nframes_t offset, int which)
413 if ((!force && !is_visible()) || session == 0) {
417 if (when == last_when && !offset && !force) {
421 bool pdelta = Config->get_primary_clock_delta_edit_cursor();
422 bool sdelta = Config->get_secondary_clock_delta_edit_cursor();
424 if (offset && which == 1 && pdelta) {
425 when = (when > offset) ? when - offset : offset - when;
426 } else if (offset && which == 2 && sdelta) {
427 when = (when > offset) ? when - offset : offset - when;
430 if (which == 1 && pdelta && !last_pdelta) {
431 cout << "set_widget_name() called" << endl;
432 set_widget_name("TransportClockDisplayDelta");
434 } else if (which == 1 && !pdelta && last_pdelta) {
435 set_widget_name("TransportClockDisplay");
437 } else if (which == 2 && sdelta && !last_sdelta) {
438 set_widget_name("SecondaryClockDisplayDelta");
440 } else if (which == 2 && !sdelta && last_sdelta) {
441 set_widget_name("SecondaryClockDisplay");
447 set_smpte (when, force);
451 set_bbt (when, force);
455 set_minsec (when, force);
459 set_frames (when, force);
470 AudioClock::smpte_offset_changed ()
477 current = current_duration();
479 current = current_time ();
489 AudioClock::set_frames (nframes_t when, bool force)
492 snprintf (buf, sizeof (buf), "%u", when);
493 audio_frames_label.set_text (buf);
495 if (frames_upper_info_label) {
496 nframes_t rate = session->frame_rate();
498 if (fmod (rate, 1000.0) == 0.000) {
499 sprintf (buf, "%uK", rate/1000);
501 sprintf (buf, "%.3fK", rate/1000.0f);
504 if (frames_upper_info_label->get_text() != buf) {
505 frames_upper_info_label->set_text (buf);
508 float vid_pullup = Config->get_video_pullup();
510 if (vid_pullup == 0.0) {
511 if (frames_lower_info_label->get_text () != _("none")) {
512 frames_lower_info_label->set_text(_("none"));
515 sprintf (buf, "%-6.4f", vid_pullup);
516 if (frames_lower_info_label->get_text() != buf) {
517 frames_lower_info_label->set_text (buf);
524 AudioClock::set_minsec (nframes_t when, bool force)
533 hrs = (int) floor (left / (session->frame_rate() * 60.0f * 60.0f));
534 left -= (nframes_t) floor (hrs * session->frame_rate() * 60.0f * 60.0f);
535 mins = (int) floor (left / (session->frame_rate() * 60.0f));
536 left -= (nframes_t) floor (mins * session->frame_rate() * 60.0f);
537 secs = left / (float) session->frame_rate();
539 if (force || hrs != ms_last_hrs) {
540 sprintf (buf, "%02d", hrs);
541 ms_hours_label.set_text (buf);
545 if (force || mins != ms_last_mins) {
546 sprintf (buf, "%02d", mins);
547 ms_minutes_label.set_text (buf);
551 if (force || secs != ms_last_secs) {
552 sprintf (buf, "%06.3f", secs);
553 ms_seconds_label.set_text (buf);
559 AudioClock::set_smpte (nframes_t when, bool force)
565 session->smpte_duration (when, smpte);
567 session->smpte_time (when, smpte);
570 if (force || smpte.hours != last_hrs || smpte.negative != last_negative) {
571 if (smpte.negative) {
572 sprintf (buf, "-%02" PRIu32, smpte.hours);
574 sprintf (buf, " %02" PRIu32, smpte.hours);
576 hours_label.set_text (buf);
577 last_hrs = smpte.hours;
578 last_negative = smpte.negative;
581 if (force || smpte.minutes != last_mins) {
582 sprintf (buf, "%02" PRIu32, smpte.minutes);
583 minutes_label.set_text (buf);
584 last_mins = smpte.minutes;
587 if (force || smpte.seconds != last_secs) {
588 sprintf (buf, "%02" PRIu32, smpte.seconds);
589 seconds_label.set_text (buf);
590 last_secs = smpte.seconds;
593 if (force || smpte.frames != last_frames) {
594 sprintf (buf, "%02" PRIu32, smpte.frames);
595 frames_label.set_text (buf);
596 last_frames = smpte.frames;
599 if (smpte_upper_info_label) {
600 double smpte_frames = session->smpte_frames_per_second();
602 if ( fmod(smpte_frames, 1.0) == 0.0) {
603 sprintf (buf, "%u", int (smpte_frames));
605 sprintf (buf, "%.2f", smpte_frames);
608 if (smpte_upper_info_label->get_text() != buf) {
609 smpte_upper_info_label->set_text (buf);
612 if ((fabs(smpte_frames - 29.97) < 0.0001) || smpte_frames == 30) {
613 if (session->smpte_drop_frames()) {
616 sprintf (buf, "NDF");
619 // there is no drop frame alternative
623 if (smpte_lower_info_label->get_text() != buf) {
624 smpte_lower_info_label->set_text (buf);
630 AudioClock::set_bbt (nframes_t when, bool force)
635 session->tempo_map().bbt_time (when, bbt);
636 sprintf (buf, "%03" PRIu32, bbt.bars);
637 bars_label.set_text (buf);
638 sprintf (buf, "%02" PRIu32, bbt.beats);
639 beats_label.set_text (buf);
640 sprintf (buf, "%04" PRIu32, bbt.ticks);
641 ticks_label.set_text (buf);
643 if (bbt_upper_info_label) {
644 TempoMap::Metric m (session->tempo_map().metric_at (when));
645 sprintf (buf, "%-5.2f", m.tempo().beats_per_minute());
646 if (bbt_lower_info_label->get_text() != buf) {
647 bbt_lower_info_label->set_text (buf);
649 sprintf (buf, "%g|%g", m.meter().beats_per_bar(), m.meter().note_divisor());
650 if (bbt_upper_info_label->get_text() != buf) {
651 bbt_upper_info_label->set_text (buf);
657 AudioClock::set_session (Session *s)
664 XMLNode* node = session->extra_xml (X_("ClockModes"));
665 AudioClock::Mode amode;
668 if ((prop = node->property (_name)) != 0) {
669 amode = AudioClock::Mode (string_2_enum (prop->value(), amode));
674 set (last_when, true);
683 hours_ebox.grab_focus ();
687 bars_ebox.grab_focus ();
691 ms_hours_ebox.grab_focus ();
695 frames_ebox.grab_focus ();
705 AudioClock::field_key_press_event (GdkEventKey *ev, Field field)
707 /* all key activity is handled on key release */
712 AudioClock::field_key_release_event (GdkEventKey *ev, Field field)
717 bool move_on = false;
721 label = &hours_label;
724 label = &minutes_label;
727 label = &seconds_label;
730 label = &frames_label;
734 label = &audio_frames_label;
738 label = &ms_hours_label;
741 label = &ms_minutes_label;
744 label = &ms_seconds_label;
751 label = &beats_label;
754 label = &ticks_label;
760 switch (ev->keyval) {
804 if (_mode == MinSec && field == MS_Seconds) {
818 clock_base.grab_focus ();
827 if (key_entry_state == 0) {
829 /* initialize with a fresh new string */
831 if (field != AudioFrames) {
832 for (uint32_t xn = 0; xn < field_length[field] - 1; ++xn) {
841 string existing = label->get_text();
842 if (existing.length() >= field_length[field]) {
843 new_text = existing.substr (1, field_length[field] - 1);
845 new_text = existing.substr (0, field_length[field] - 1);
849 new_text += new_char;
850 label->set_text (new_text);
854 if (key_entry_state == field_length[field]) {
860 if (key_entry_state) {
867 // Check SMPTE fields for sanity (may also adjust fields)
868 smpte_sanitize_display();
873 // Bars should never be, unless this clock is for a duration
874 if (atoi(bars_label.get_text()) == 0 && !is_duration) {
875 bars_label.set_text("001");
877 // beats should never be 0, unless this clock is for a duration
878 if (atoi(beats_label.get_text()) == 0 && !is_duration) {
879 beats_label.set_text("01");
886 ValueChanged(); /* EMIT_SIGNAL */
889 /* move on to the next field.
897 minutes_ebox.grab_focus ();
900 seconds_ebox.grab_focus ();
903 frames_ebox.grab_focus ();
906 clock_base.grab_focus ();
911 clock_base.grab_focus ();
917 ms_minutes_ebox.grab_focus ();
920 ms_seconds_ebox.grab_focus ();
923 clock_base.grab_focus ();
929 beats_ebox.grab_focus ();
932 ticks_ebox.grab_focus ();
935 clock_base.grab_focus ();
948 AudioClock::field_focus_in_event (GdkEventFocus *ev, Field field)
952 Keyboard::magic_widget_grab_focus ();
956 hours_ebox.set_flags (Gtk::HAS_FOCUS);
957 hours_ebox.set_state (Gtk::STATE_ACTIVE);
960 minutes_ebox.set_flags (Gtk::HAS_FOCUS);
961 minutes_ebox.set_state (Gtk::STATE_ACTIVE);
964 seconds_ebox.set_flags (Gtk::HAS_FOCUS);
965 seconds_ebox.set_state (Gtk::STATE_ACTIVE);
968 frames_ebox.set_flags (Gtk::HAS_FOCUS);
969 frames_ebox.set_state (Gtk::STATE_ACTIVE);
973 audio_frames_ebox.set_flags (Gtk::HAS_FOCUS);
974 audio_frames_ebox.set_state (Gtk::STATE_ACTIVE);
978 ms_hours_ebox.set_flags (Gtk::HAS_FOCUS);
979 ms_hours_ebox.set_state (Gtk::STATE_ACTIVE);
982 ms_minutes_ebox.set_flags (Gtk::HAS_FOCUS);
983 ms_minutes_ebox.set_state (Gtk::STATE_ACTIVE);
986 ms_seconds_ebox.set_flags (Gtk::HAS_FOCUS);
987 ms_seconds_ebox.set_state (Gtk::STATE_ACTIVE);
990 bars_ebox.set_flags (Gtk::HAS_FOCUS);
991 bars_ebox.set_state (Gtk::STATE_ACTIVE);
994 beats_ebox.set_flags (Gtk::HAS_FOCUS);
995 beats_ebox.set_state (Gtk::STATE_ACTIVE);
998 ticks_ebox.set_flags (Gtk::HAS_FOCUS);
999 ticks_ebox.set_state (Gtk::STATE_ACTIVE);
1007 AudioClock::field_focus_out_event (GdkEventFocus *ev, Field field)
1012 hours_ebox.unset_flags (Gtk::HAS_FOCUS);
1013 hours_ebox.set_state (Gtk::STATE_NORMAL);
1016 minutes_ebox.unset_flags (Gtk::HAS_FOCUS);
1017 minutes_ebox.set_state (Gtk::STATE_NORMAL);
1020 seconds_ebox.unset_flags (Gtk::HAS_FOCUS);
1021 seconds_ebox.set_state (Gtk::STATE_NORMAL);
1024 frames_ebox.unset_flags (Gtk::HAS_FOCUS);
1025 frames_ebox.set_state (Gtk::STATE_NORMAL);
1029 audio_frames_ebox.unset_flags (Gtk::HAS_FOCUS);
1030 audio_frames_ebox.set_state (Gtk::STATE_NORMAL);
1034 ms_hours_ebox.unset_flags (Gtk::HAS_FOCUS);
1035 ms_hours_ebox.set_state (Gtk::STATE_NORMAL);
1038 ms_minutes_ebox.unset_flags (Gtk::HAS_FOCUS);
1039 ms_minutes_ebox.set_state (Gtk::STATE_NORMAL);
1042 ms_seconds_ebox.unset_flags (Gtk::HAS_FOCUS);
1043 ms_seconds_ebox.set_state (Gtk::STATE_NORMAL);
1047 bars_ebox.unset_flags (Gtk::HAS_FOCUS);
1048 bars_ebox.set_state (Gtk::STATE_NORMAL);
1051 beats_ebox.unset_flags (Gtk::HAS_FOCUS);
1052 beats_ebox.set_state (Gtk::STATE_NORMAL);
1055 ticks_ebox.unset_flags (Gtk::HAS_FOCUS);
1056 ticks_ebox.set_state (Gtk::STATE_NORMAL);
1060 Keyboard::magic_widget_drop_focus ();
1066 AudioClock::field_button_release_event (GdkEventButton *ev, Field field)
1069 gdk_pointer_ungrab (GDK_CURRENT_TIME);
1071 if (ev->y > drag_start_y+1 || ev->y < drag_start_y-1 || Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)){
1072 // we actually dragged so return without setting editing focus, or we shift clicked
1078 if (ops_menu == 0) {
1081 ops_menu->popup (1, ev->time);
1085 if (Keyboard::is_context_menu_event (ev)) {
1086 if (ops_menu == 0) {
1089 ops_menu->popup (1, ev->time);
1093 switch (ev->button) {
1097 hours_ebox.grab_focus();
1100 minutes_ebox.grab_focus();
1103 seconds_ebox.grab_focus();
1106 frames_ebox.grab_focus();
1110 audio_frames_ebox.grab_focus();
1114 ms_hours_ebox.grab_focus();
1117 ms_minutes_ebox.grab_focus();
1120 ms_seconds_ebox.grab_focus();
1124 bars_ebox.grab_focus ();
1127 beats_ebox.grab_focus ();
1130 ticks_ebox.grab_focus ();
1143 AudioClock::field_button_press_event (GdkEventButton *ev, Field field)
1145 if (session == 0) return false;
1147 nframes_t frames = 0;
1149 switch (ev->button) {
1151 if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
1153 ValueChanged (); /* EMIT_SIGNAL */
1156 /* make absolutely sure that the pointer is grabbed */
1157 gdk_pointer_grab(ev->window,false ,
1158 GdkEventMask( Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK |Gdk::BUTTON_RELEASE_MASK),
1159 NULL,NULL,ev->time);
1162 drag_start_y = ev->y;
1167 if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
1169 ValueChanged (); /* EMIT_SIGNAL */
1174 /* used for context sensitive menu */
1187 AudioClock::field_button_scroll_event (GdkEventScroll *ev, Field field)
1193 nframes_t frames = 0;
1195 switch (ev->direction) {
1198 frames = get_frames (field);
1200 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
1203 set (current_time() + frames, true);
1204 ValueChanged (); /* EMIT_SIGNAL */
1208 case GDK_SCROLL_DOWN:
1209 frames = get_frames (field);
1211 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
1215 if ((double)current_time() - (double)frames < 0.0) {
1218 set (current_time() - frames, true);
1221 ValueChanged (); /* EMIT_SIGNAL */
1234 AudioClock::field_motion_notify_event (GdkEventMotion *ev, Field field)
1236 if (session == 0 || !dragging) {
1240 float pixel_frame_scale_factor = 0.2f;
1243 if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
1244 pixel_frame_scale_factor = 0.1f;
1248 if (Keyboard::modifier_state_contains (ev->state,
1249 Keyboard::PrimaryModifier|Keyboard::SecondaryModifier)) {
1251 pixel_frame_scale_factor = 0.025f;
1254 double y_delta = ev->y - drag_y;
1256 drag_accum += y_delta*pixel_frame_scale_factor;
1260 if (trunc(drag_accum) != 0) {
1265 dir = (drag_accum < 0 ? 1:-1);
1266 pos = current_time();
1267 frames = get_frames (field,pos,dir);
1269 if (frames != 0 && frames * drag_accum < current_time()) {
1271 set ((nframes_t) floor (pos - drag_accum * frames), false); // minus because up is negative in computer-land
1279 ValueChanged(); /* EMIT_SIGNAL */
1288 AudioClock::get_frames (Field field,nframes_t pos,int dir)
1291 nframes_t frames = 0;
1295 frames = (nframes_t) floor (3600.0 * session->frame_rate());
1298 frames = (nframes_t) floor (60.0 * session->frame_rate());
1301 frames = session->frame_rate();
1304 frames = (nframes_t) floor (session->frame_rate() / session->smpte_frames_per_second());
1312 frames = (nframes_t) floor (3600.0 * session->frame_rate());
1315 frames = (nframes_t) floor (60.0 * session->frame_rate());
1318 frames = session->frame_rate();
1325 frames = session->tempo_map().bbt_duration_at(pos,bbt,dir);
1331 frames = session->tempo_map().bbt_duration_at(pos,bbt,dir);
1337 frames = session->tempo_map().bbt_duration_at(pos,bbt,dir);
1345 AudioClock::current_time (nframes_t pos) const
1351 ret = smpte_frame_from_display ();
1354 ret = bbt_frame_from_display (pos);
1358 ret = minsec_frame_from_display ();
1362 ret = audio_frame_from_display ();
1373 AudioClock::current_duration (nframes_t pos) const
1379 ret = smpte_frame_from_display ();
1382 ret = bbt_frame_duration_from_display (pos);
1386 ret = minsec_frame_from_display ();
1390 ret = audio_frame_from_display ();
1401 AudioClock::smpte_sanitize_display()
1403 // Check SMPTE fields for sanity, possibly adjusting values
1404 if (atoi(minutes_label.get_text()) > 59) {
1405 minutes_label.set_text("59");
1408 if (atoi(seconds_label.get_text()) > 59) {
1409 seconds_label.set_text("59");
1412 switch ((long)rint(session->smpte_frames_per_second())) {
1414 if (atoi(frames_label.get_text()) > 23) {
1415 frames_label.set_text("23");
1419 if (atoi(frames_label.get_text()) > 24) {
1420 frames_label.set_text("24");
1424 if (atoi(frames_label.get_text()) > 29) {
1425 frames_label.set_text("29");
1432 if (session->smpte_drop_frames()) {
1433 if ((atoi(minutes_label.get_text()) % 10) && (atoi(seconds_label.get_text()) == 0) && (atoi(frames_label.get_text()) < 2)) {
1434 frames_label.set_text("02");
1440 AudioClock::smpte_frame_from_display () const
1449 smpte.hours = atoi (hours_label.get_text());
1450 smpte.minutes = atoi (minutes_label.get_text());
1451 smpte.seconds = atoi (seconds_label.get_text());
1452 smpte.frames = atoi (frames_label.get_text());
1453 smpte.rate = session->smpte_frames_per_second();
1454 smpte.drop= session->smpte_drop_frames();
1456 session->smpte_to_sample( smpte, sample, false /* use_offset */, false /* use_subframes */ );
1460 #define SMPTE_SAMPLE_TEST_1
1461 #define SMPTE_SAMPLE_TEST_2
1462 #define SMPTE_SAMPLE_TEST_3
1463 #define SMPTE_SAMPLE_TEST_4
1464 #define SMPTE_SAMPLE_TEST_5
1465 #define SMPTE_SAMPLE_TEST_6
1466 #define SMPTE_SAMPLE_TEST_7
1468 // Testcode for smpte<->sample conversions (P.S.)
1471 nframes_t oldsample = 0;
1473 nframes_t sample_increment;
1475 sample_increment = (long)rint(session->frame_rate() / session->smpte_frames_per_second);
1477 #ifdef SMPTE_SAMPLE_TEST_1
1478 // Test 1: use_offset = false, use_subframes = false
1479 cout << "use_offset = false, use_subframes = false" << endl;
1480 for (int i = 0; i < 108003; i++) {
1481 session->smpte_to_sample( smpte1, sample1, false /* use_offset */, false /* use_subframes */ );
1482 session->sample_to_smpte( sample1, smpte2, false /* use_offset */, false /* use_subframes */ );
1484 if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) {
1485 cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1486 cout << "smpte1: " << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1487 cout << "sample: " << sample1 << endl;
1488 cout << "sample: " << sample1 << " -> ";
1489 cout << "smpte2: " << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1493 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1494 cout << "ERROR: smpte2 not equal smpte1" << endl;
1495 cout << "smpte1: " << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1496 cout << "sample: " << sample1 << endl;
1497 cout << "sample: " << sample1 << " -> ";
1498 cout << "smpte2: " << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1501 oldsample = sample1;
1502 session->smpte_increment( smpte1 );
1505 cout << "sample_increment: " << sample_increment << endl;
1506 cout << "sample: " << sample1 << " -> ";
1507 cout << "smpte: " << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1510 #ifdef SMPTE_SAMPLE_TEST_2
1511 // Test 2: use_offset = true, use_subframes = false
1512 cout << "use_offset = true, use_subframes = false" << endl;
1518 smpte1.subframes = 0;
1519 sample1 = oldsample = 0;
1521 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
1522 cout << "Starting at sample: " << sample1 << " -> ";
1523 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1525 for (int i = 0; i < 108003; i++) {
1526 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
1527 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
1529 // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1530 // cout << "sample: " << sample1 << endl;
1531 // cout << "sample: " << sample1 << " -> ";
1532 // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1534 if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) {
1535 cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1536 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1537 cout << "sample: " << sample1 << endl;
1538 cout << "sample: " << sample1 << " -> ";
1539 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1543 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1544 cout << "ERROR: smpte2 not equal smpte1" << endl;
1545 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1546 cout << "sample: " << sample1 << endl;
1547 cout << "sample: " << sample1 << " -> ";
1548 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1551 oldsample = sample1;
1552 session->smpte_increment( smpte1 );
1555 cout << "sample_increment: " << sample_increment << endl;
1556 cout << "sample: " << sample1 << " -> ";
1557 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1560 #ifdef SMPTE_SAMPLE_TEST_3
1561 // Test 3: use_offset = true, use_subframes = false, decrement
1562 cout << "use_offset = true, use_subframes = false, decrement" << endl;
1564 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
1565 cout << "Starting at sample: " << sample1 << " -> ";
1566 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1568 for (int i = 0; i < 108003; i++) {
1569 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
1570 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
1572 // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1573 // cout << "sample: " << sample1 << endl;
1574 // cout << "sample: " << sample1 << " -> ";
1575 // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1577 if ((i > 0) && ( ((oldsample - sample1) != sample_increment) && ((oldsample - sample1) != (sample_increment + 1)) && ((oldsample - sample1) != (sample_increment - 1)))) {
1578 cout << "ERROR: sample increment not right: " << (oldsample - sample1) << " != " << sample_increment << endl;
1579 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1580 cout << "sample: " << sample1 << endl;
1581 cout << "sample: " << sample1 << " -> ";
1582 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1586 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1587 cout << "ERROR: smpte2 not equal smpte1" << endl;
1588 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1589 cout << "sample: " << sample1 << endl;
1590 cout << "sample: " << sample1 << " -> ";
1591 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1594 oldsample = sample1;
1595 session->smpte_decrement( smpte1 );
1598 cout << "sample_decrement: " << sample_increment << endl;
1599 cout << "sample: " << sample1 << " -> ";
1600 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1604 #ifdef SMPTE_SAMPLE_TEST_4
1605 // Test 4: use_offset = true, use_subframes = true
1606 cout << "use_offset = true, use_subframes = true" << endl;
1608 for (long sub = 5; sub < 80; sub += 5) {
1613 smpte1.subframes = 0;
1614 sample1 = oldsample = (sample_increment * sub) / 80;
1616 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, true /* use_subframes */ );
1618 cout << "starting at sample: " << sample1 << " -> ";
1619 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1621 for (int i = 0; i < 108003; i++) {
1622 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, true /* use_subframes */ );
1623 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, true /* use_subframes */ );
1625 if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1)))) {
1626 cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1627 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1628 cout << "sample: " << sample1 << endl;
1629 cout << "sample: " << sample1 << " -> ";
1630 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1634 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames || smpte2.subframes != smpte1.subframes) {
1635 cout << "ERROR: smpte2 not equal smpte1" << endl;
1636 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1637 cout << "sample: " << sample1 << endl;
1638 cout << "sample: " << sample1 << " -> ";
1639 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1642 oldsample = sample1;
1643 session->smpte_increment( smpte1 );
1646 cout << "sample_increment: " << sample_increment << endl;
1647 cout << "sample: " << sample1 << " -> ";
1648 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1650 for (int i = 0; i < 108003; i++) {
1651 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, true /* use_subframes */ );
1652 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, true /* use_subframes */ );
1654 if ((i > 0) && ( ((oldsample - sample1) != sample_increment) && ((oldsample - sample1) != (sample_increment + 1)) && ((oldsample - sample1) != (sample_increment - 1)))) {
1655 cout << "ERROR: sample increment not right: " << (oldsample - sample1) << " != " << sample_increment << endl;
1656 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1657 cout << "sample: " << sample1 << endl;
1658 cout << "sample: " << sample1 << " -> ";
1659 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1663 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames || smpte2.subframes != smpte1.subframes) {
1664 cout << "ERROR: smpte2 not equal smpte1" << endl;
1665 cout << "smpte1: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1666 cout << "sample: " << sample1 << endl;
1667 cout << "sample: " << sample1 << " -> ";
1668 cout << "smpte2: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1671 oldsample = sample1;
1672 session->smpte_decrement( smpte1 );
1675 cout << "sample_decrement: " << sample_increment << endl;
1676 cout << "sample: " << sample1 << " -> ";
1677 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1682 #ifdef SMPTE_SAMPLE_TEST_5
1683 // Test 5: use_offset = true, use_subframes = false, increment seconds
1684 cout << "use_offset = true, use_subframes = false, increment seconds" << endl;
1690 smpte1.subframes = 0;
1691 sample1 = oldsample = 0;
1692 sample_increment = session->frame_rate();
1694 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
1695 cout << "Starting at sample: " << sample1 << " -> ";
1696 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1698 for (int i = 0; i < 3600; i++) {
1699 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
1700 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
1702 // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1703 // cout << "sample: " << sample1 << endl;
1704 // cout << "sample: " << sample1 << " -> ";
1705 // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1707 // if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1))))
1709 // cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1713 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1714 cout << "ERROR: smpte2 not equal smpte1" << endl;
1715 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1716 cout << "sample: " << sample1 << endl;
1717 cout << "sample: " << sample1 << " -> ";
1718 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1721 oldsample = sample1;
1722 session->smpte_increment_seconds( smpte1 );
1725 cout << "sample_increment: " << sample_increment << endl;
1726 cout << "sample: " << sample1 << " -> ";
1727 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1731 #ifdef SMPTE_SAMPLE_TEST_6
1732 // Test 6: use_offset = true, use_subframes = false, increment minutes
1733 cout << "use_offset = true, use_subframes = false, increment minutes" << endl;
1739 smpte1.subframes = 0;
1740 sample1 = oldsample = 0;
1741 sample_increment = session->frame_rate() * 60;
1743 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
1744 cout << "Starting at sample: " << sample1 << " -> ";
1745 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1747 for (int i = 0; i < 60; i++) {
1748 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
1749 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
1751 // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1752 // cout << "sample: " << sample1 << endl;
1753 // cout << "sample: " << sample1 << " -> ";
1754 // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1756 // if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1))))
1758 // cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1762 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1763 cout << "ERROR: smpte2 not equal smpte1" << endl;
1764 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1765 cout << "sample: " << sample1 << endl;
1766 cout << "sample: " << sample1 << " -> ";
1767 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1770 oldsample = sample1;
1771 session->smpte_increment_minutes( smpte1 );
1774 cout << "sample_increment: " << sample_increment << endl;
1775 cout << "sample: " << sample1 << " -> ";
1776 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1779 #ifdef SMPTE_SAMPLE_TEST_7
1780 // Test 7: use_offset = true, use_subframes = false, increment hours
1781 cout << "use_offset = true, use_subframes = false, increment hours" << endl;
1787 smpte1.subframes = 0;
1788 sample1 = oldsample = 0;
1789 sample_increment = session->frame_rate() * 60 * 60;
1791 session->sample_to_smpte( sample1, smpte1, true /* use_offset */, false /* use_subframes */ );
1792 cout << "Starting at sample: " << sample1 << " -> ";
1793 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << endl;
1795 for (int i = 0; i < 10; i++) {
1796 session->smpte_to_sample( smpte1, sample1, true /* use_offset */, false /* use_subframes */ );
1797 session->sample_to_smpte( sample1, smpte2, true /* use_offset */, false /* use_subframes */ );
1799 // cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1800 // cout << "sample: " << sample1 << endl;
1801 // cout << "sample: " << sample1 << " -> ";
1802 // cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1804 // if ((i > 0) && ( ((sample1 - oldsample) != sample_increment) && ((sample1 - oldsample) != (sample_increment + 1)) && ((sample1 - oldsample) != (sample_increment - 1))))
1806 // cout << "ERROR: sample increment not right: " << (sample1 - oldsample) << " != " << sample_increment << endl;
1810 if (smpte2.hours != smpte1.hours || smpte2.minutes != smpte1.minutes || smpte2.seconds != smpte2.seconds || smpte2.frames != smpte1.frames) {
1811 cout << "ERROR: smpte2 not equal smpte1" << endl;
1812 cout << "smpte: " << (smpte1.negative ? "-" : "") << smpte1.hours << ":" << smpte1.minutes << ":" << smpte1.seconds << ":" << smpte1.frames << "::" << smpte1.subframes << " -> ";
1813 cout << "sample: " << sample1 << endl;
1814 cout << "sample: " << sample1 << " -> ";
1815 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1818 oldsample = sample1;
1819 session->smpte_increment_hours( smpte1 );
1822 cout << "sample_increment: " << sample_increment << endl;
1823 cout << "sample: " << sample1 << " -> ";
1824 cout << "smpte: " << (smpte2.negative ? "-" : "") << smpte2.hours << ":" << smpte2.minutes << ":" << smpte2.seconds << ":" << smpte2.frames << "::" << smpte2.subframes << endl;
1833 AudioClock::minsec_frame_from_display () const
1839 int hrs = atoi (ms_hours_label.get_text());
1840 int mins = atoi (ms_minutes_label.get_text());
1841 float secs = atof (ms_seconds_label.get_text());
1843 nframes_t sr = session->frame_rate();
1845 return (nframes_t) floor ((hrs * 60.0f * 60.0f * sr) + (mins * 60.0f * sr) + (secs * sr));
1849 AudioClock::bbt_frame_from_display (nframes_t pos) const
1852 error << "AudioClock::current_time() called with BBT mode but without session!" << endmsg;
1857 any.type = AnyTime::BBT;
1859 any.bbt.bars = atoi (bars_label.get_text());
1860 any.bbt.beats = atoi (beats_label.get_text());
1861 any.bbt.ticks = atoi (ticks_label.get_text());
1863 nframes_t ret = session->convert_to_frames_at (pos, any);
1870 AudioClock::bbt_frame_duration_from_display (nframes_t pos) const
1873 error << "AudioClock::current_time() called with BBT mode but without session!" << endmsg;
1880 bbt.bars = atoi (bars_label.get_text());
1881 bbt.beats = atoi (beats_label.get_text());
1882 bbt.ticks = atoi (ticks_label.get_text());
1884 return session->tempo_map().bbt_duration_at(pos,bbt,1);
1888 AudioClock::audio_frame_from_display () const
1890 return (nframes_t) atoi (audio_frames_label.get_text());
1894 AudioClock::build_ops_menu ()
1896 using namespace Menu_Helpers;
1897 ops_menu = new Menu;
1898 MenuList& ops_items = ops_menu->items();
1899 ops_menu->set_name ("ArdourContextMenu");
1901 if (!Profile->get_sae()) {
1902 ops_items.push_back (MenuElem (_("Timecode"), bind (mem_fun(*this, &AudioClock::set_mode), SMPTE)));
1904 ops_items.push_back (MenuElem (_("Bars:Beats"), bind (mem_fun(*this, &AudioClock::set_mode), BBT)));
1905 ops_items.push_back (MenuElem (_("Minutes:Seconds"), bind (mem_fun(*this, &AudioClock::set_mode), MinSec)));
1906 ops_items.push_back (MenuElem (_("Samples"), bind (mem_fun(*this, &AudioClock::set_mode), Frames)));
1907 ops_items.push_back (MenuElem (_("Off"), bind (mem_fun(*this, &AudioClock::set_mode), Off)));
1911 AudioClock::set_mode (Mode m)
1913 /* slightly tricky: this is called from within the ARDOUR_UI
1914 constructor by some of its clock members. at that time
1915 the instance pointer is unset, so we have to be careful.
1916 the main idea is to drop keyboard focus in case we had
1917 started editing the clock and then we switch clock mode.
1920 clock_base.grab_focus ();
1926 clock_base.remove ();
1932 clock_base.add (smpte_packer_hbox);
1936 clock_base.add (bbt_packer_hbox);
1940 clock_base.add (minsec_packer_hbox);
1944 clock_base.add (frames_packer_hbox);
1948 clock_base.add (off_hbox);
1952 set_size_requests ();
1954 set (last_when, true);
1955 clock_base.show_all ();
1956 key_entry_state = 0;
1958 if (!is_transient) {
1959 ModeChanged (); /* EMIT SIGNAL */
1964 AudioClock::set_size_requests ()
1966 /* note that in some fonts, "88" is narrower than "00", hence the 2 pixel padding */
1970 Gtkmm2ext::set_size_request_to_display_given_text (hours_label, "-00", 5, 5);
1971 Gtkmm2ext::set_size_request_to_display_given_text (minutes_label, "00", 5, 5);
1972 Gtkmm2ext::set_size_request_to_display_given_text (seconds_label, "00", 5, 5);
1973 Gtkmm2ext::set_size_request_to_display_given_text (frames_label, "00", 5, 5);
1977 Gtkmm2ext::set_size_request_to_display_given_text (bars_label, "-000", 5, 5);
1978 Gtkmm2ext::set_size_request_to_display_given_text (beats_label, "00", 5, 5);
1979 Gtkmm2ext::set_size_request_to_display_given_text (ticks_label, "0000", 5, 5);
1983 Gtkmm2ext::set_size_request_to_display_given_text (ms_hours_label, "00", 5, 5);
1984 Gtkmm2ext::set_size_request_to_display_given_text (ms_minutes_label, "00", 5, 5);
1985 Gtkmm2ext::set_size_request_to_display_given_text (ms_seconds_label, "00.000", 5, 5);
1989 Gtkmm2ext::set_size_request_to_display_given_text (audio_frames_label, "0000000000", 5, 5);
1993 Gtkmm2ext::set_size_request_to_display_given_text (off_hbox, "00000", 5, 5);