label various spinners in the step editor
[ardour.git] / gtk2_ardour / audio_clock.cc
index 0847031df4afb84673d655679e4440c5095674b6..be1bb97713b763e5d9e97cc5facda2a2e7b4ac90 100644 (file)
@@ -35,6 +35,7 @@
 #include "audio_clock.h"
 #include "utils.h"
 #include "keyboard.h"
+#include "gui_thread.h"
 #include "i18n.h"
 
 using namespace ARDOUR;
@@ -64,7 +65,7 @@ const uint32_t AudioClock::field_length[(int) AudioClock::AudioFrames+1] = {
        10   /* Audio Frame */
 };
 
-AudioClock::AudioClock (std::string clock_name, bool transient, std::string widget_name, 
+AudioClock::AudioClock (const string& clock_name, bool transient, const string& widget_name, 
                        bool allow_edit, bool follows_playhead, bool duration, bool with_info)
        : _name (clock_name),
          is_transient (transient),
@@ -214,7 +215,7 @@ AudioClock::AudioClock (std::string clock_name, bool transient, std::string widg
        clock_base.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::SCROLL_MASK);
        clock_base.signal_button_release_event().connect (sigc::bind (sigc::mem_fun (*this, &AudioClock::field_button_release_event), Timecode_Hours));
 
-       Session::TimecodeOffsetChanged.connect (_session_connections, sigc::mem_fun (*this, &AudioClock::timecode_offset_changed));
+       Session::TimecodeOffsetChanged.connect (_session_connections, invalidator (*this), boost::bind (&AudioClock::timecode_offset_changed, this), gui_context());
 
        if (editable) {
                setup_events ();
@@ -2043,30 +2044,30 @@ AudioClock::set_mode (Mode m)
 void
 AudioClock::set_size_requests ()
 {
-       /* note that in some fonts, "88" is narrower than "00", hence the 2 pixel padding */
+       /* note that in some fonts, "88" is narrower than "00" */
 
        switch (_mode) {
        case Timecode:
-               Gtkmm2ext::set_size_request_to_display_given_text (hours_label, "-00", 5, 5);
-               Gtkmm2ext::set_size_request_to_display_given_text (minutes_label, "00", 5, 5);
-               Gtkmm2ext::set_size_request_to_display_given_text (seconds_label, "00", 5, 5);
-               Gtkmm2ext::set_size_request_to_display_given_text (frames_label, "00", 5, 5);
+               Gtkmm2ext::set_size_request_to_display_given_text (hours_label, "-88", 5, 5);
+               Gtkmm2ext::set_size_request_to_display_given_text (minutes_label, "88", 5, 5);
+               Gtkmm2ext::set_size_request_to_display_given_text (seconds_label, "88", 5, 5);
+               Gtkmm2ext::set_size_request_to_display_given_text (frames_label, "88", 5, 5);
                break;
 
        case BBT:
-               Gtkmm2ext::set_size_request_to_display_given_text (bars_label, "-000", 5, 5);
-               Gtkmm2ext::set_size_request_to_display_given_text (beats_label, "00", 5, 5);
-               Gtkmm2ext::set_size_request_to_display_given_text (ticks_label, "0000", 5, 5);
+               Gtkmm2ext::set_size_request_to_display_given_text (bars_label, "-888", 5, 5);
+               Gtkmm2ext::set_size_request_to_display_given_text (beats_label, "88", 5, 5);
+               Gtkmm2ext::set_size_request_to_display_given_text (ticks_label, "8888", 5, 5);
                break;
 
        case MinSec:
-               Gtkmm2ext::set_size_request_to_display_given_text (ms_hours_label, "00", 5, 5);
-               Gtkmm2ext::set_size_request_to_display_given_text (ms_minutes_label, "00", 5, 5);
-               Gtkmm2ext::set_size_request_to_display_given_text (ms_seconds_label, "00.000", 5, 5);
+               Gtkmm2ext::set_size_request_to_display_given_text (ms_hours_label, "88", 5, 5);
+               Gtkmm2ext::set_size_request_to_display_given_text (ms_minutes_label, "88", 5, 5);
+               Gtkmm2ext::set_size_request_to_display_given_text (ms_seconds_label, "88.888", 5, 5);
                break;
 
        case Frames:
-               Gtkmm2ext::set_size_request_to_display_given_text (audio_frames_label, "0000000000", 5, 5);
+               Gtkmm2ext::set_size_request_to_display_given_text (audio_frames_label, "8888888888", 5, 5);
                break;
 
        case Off:
@@ -2081,3 +2082,47 @@ AudioClock::set_bbt_reference (nframes64_t pos)
 {
        bbt_reference_time = pos;
 }
+
+void
+AudioClock::on_style_changed (const Glib::RefPtr<Style>& old_style)
+{
+       HBox::on_style_changed (old_style);
+
+       /* propagate style changes to all component widgets that should inherit the main one */
+
+       Glib::RefPtr<RcStyle> rcstyle = get_modifier_style();
+
+       clock_base.modify_style (rcstyle);
+       audio_frames_label.modify_style (rcstyle);
+       hours_label.modify_style (rcstyle);
+       minutes_label.modify_style (rcstyle);
+       seconds_label.modify_style (rcstyle);
+       frames_label.modify_style (rcstyle);
+       bars_label.modify_style (rcstyle);
+       beats_label.modify_style (rcstyle);
+       ticks_label.modify_style (rcstyle);
+       ms_hours_label.modify_style (rcstyle);
+       ms_minutes_label.modify_style (rcstyle);
+       ms_seconds_label.modify_style (rcstyle);
+       hours_ebox.modify_style (rcstyle);
+       minutes_ebox.modify_style (rcstyle);
+       seconds_ebox.modify_style (rcstyle);
+       frames_ebox.modify_style (rcstyle);
+       audio_frames_ebox.modify_style (rcstyle);
+       bars_ebox.modify_style (rcstyle);
+       beats_ebox.modify_style (rcstyle);
+       ticks_ebox.modify_style (rcstyle);
+       ms_hours_ebox.modify_style (rcstyle);
+       ms_minutes_ebox.modify_style (rcstyle);
+       ms_seconds_ebox.modify_style (rcstyle);
+
+       colon1.modify_style (rcstyle);
+       colon2.modify_style (rcstyle);
+       colon3.modify_style (rcstyle);
+       colon4.modify_style (rcstyle);
+       colon5.modify_style (rcstyle);
+       b1.modify_style (rcstyle);
+       b2.modify_style (rcstyle);
+
+       set_size_requests ();
+}