diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-01-15 14:42:19 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-01-15 14:42:19 +0000 |
commit | 11edfd035e19c90544bf10ff3845e8d7f7e80c5b (patch) | |
tree | 8f50a2da5bced3b15508581a7273f6b5606b2582 /gtk2_ardour/audio_clock.cc | |
parent | 81fd8dd960c4ad681c9278b0921756e473956479 (diff) |
dynamically resize text in the big clock, first version
git-svn-id: svn://localhost/ardour2/branches/3.0@6494 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/audio_clock.cc')
-rw-r--r-- | gtk2_ardour/audio_clock.cc | 68 |
1 files changed, 56 insertions, 12 deletions
diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index 86497709c6..bdf0ceda33 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -2044,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: @@ -2082,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 (); +} |