prepare GUI notifications for plugin scan
[ardour.git] / gtk2_ardour / audio_clock.cc
index 18153ac78574ccfadbac7358c873858324616ae4..7bbc00c2678b6c2e8ee68b7c715d9a89eabe3548 100644 (file)
@@ -53,13 +53,14 @@ using Gtkmm2ext::Keyboard;
 
 sigc::signal<void> AudioClock::ModeChanged;
 vector<AudioClock*> AudioClock::clocks;
-const double AudioClock::info_font_scale_factor = 0.5;
+const double AudioClock::info_font_scale_factor = 0.50;
 const double AudioClock::separator_height = 0.0;
 const double AudioClock::x_leading_padding = 6.0;
 
 #define BBT_BAR_CHAR "|"
 #define BBT_SCANF_FORMAT "%" PRIu32 "%*c%" PRIu32 "%*c%" PRIu32
-#define INFO_FONT_SIZE ((int)round(font_size * info_font_scale_factor))
+#define INFO_FONT_SIZE ((int)lrint(font_size * info_font_scale_factor))
+#define TXTSPAN "<span font-family=\"Sans\" foreground=\"white\">"
 
 AudioClock::AudioClock (const string& clock_name, bool transient, const string& widget_name,
                        bool allow_edit, bool follows_playhead, bool duration, bool with_info)
@@ -70,8 +71,6 @@ AudioClock::AudioClock (const string& clock_name, bool transient, const string&
        , editable (allow_edit)
        , _follows_playhead (follows_playhead)
        , _off (false)
-       , _fixed_width (true)
-       , layout_x_offset (0)
        , em_width (0)
        , _edit_by_click_field (false)
        , _negative_allowed (false)
@@ -80,6 +79,7 @@ AudioClock::AudioClock (const string& clock_name, bool transient, const string&
        , foreground_attr (0)
        , first_height (0)
        , first_width (0)
+       , style_resets_first (true)
        , layout_height (0)
        , layout_width (0)
        , info_height (0)
@@ -143,7 +143,15 @@ AudioClock::set_widget_name (const string& str)
 void
 AudioClock::on_realize ()
 {
+       Gtk::Requisition req;
+
        CairoWidget::on_realize ();
+       
+       set_clock_dimensions (req);
+
+       first_width = req.width;
+       first_height = req.height;
+
        set_font ();
        set_colors ();
 }
@@ -171,7 +179,7 @@ AudioClock::set_font ()
        /* now a smaller version of the same font */
 
        delete font_attr;
-       font.set_size ((int) lrint (font_size * info_font_scale_factor));
+       font.set_size (INFO_FONT_SIZE);
        font.set_weight (Pango::WEIGHT_NORMAL);
        font_attr = new Pango::AttrFontDesc (Pango::Attribute::create_attr_font_desc (font));
 
@@ -292,12 +300,7 @@ AudioClock::render (cairo_t* cr)
                cairo_fill (cr);
        }
 
-       if (!_fixed_width) {
-               cairo_move_to (cr, layout_x_offset, 0);
-       } else {
-               int xcenter = layout_x_offset > 0 ? 0 : (get_width() - _mode_width[_mode]) /2;
-               cairo_move_to (cr, layout_x_offset + xcenter, (upper_height - layout_height) / 2.0);
-       }
+       cairo_move_to (cr, (get_width() - layout_width) / 2.0, (upper_height - layout_height) / 2.0);
 
        pango_cairo_show_layout (cr, _layout->gobj());
 
@@ -379,7 +382,7 @@ AudioClock::render (cairo_t* cr)
        if (editing) {
                if (!insert_map.empty()) {
 
-                       int xcenter = layout_x_offset > 0 ? 0 : (get_width() - _mode_width[_mode]) /2;
+                       int xcenter = (get_width() - layout_width) /2;
 
                        if (input_string.length() < insert_map.size()) {
                                Pango::Rectangle cursor;
@@ -394,18 +397,11 @@ AudioClock::render (cairo_t* cr)
                                }
 
                                cairo_set_source_rgba (cr, cursor_r, cursor_g, cursor_b, cursor_a);
-                               if (!_fixed_width) {
-                                       cairo_rectangle (cr,
-                                                        min (get_width() - 2.0,
-                                                             (double) cursor.get_x()/PANGO_SCALE + layout_x_offset + xcenter + em_width), 0,
-                                                        2.0, cursor.get_height()/PANGO_SCALE);
-                               } else {
-                                       cairo_rectangle (cr,
-                                                        min (get_width() - 2.0,
-                                                             (double) layout_x_offset + xcenter + cursor.get_x()/PANGO_SCALE + em_width),
-                                                        (upper_height - layout_height)/2.0,
-                                                        2.0, cursor.get_height()/PANGO_SCALE);
-                               }
+                               cairo_rectangle (cr,
+                                                min (get_width() - 2.0,
+                                                     (double) xcenter + cursor.get_x()/PANGO_SCALE + em_width),
+                                                (upper_height - layout_height)/2.0,
+                                                2.0, cursor.get_height()/PANGO_SCALE);
                                cairo_fill (cr);
                        } else {
                                /* we've entered all possible digits, no cursor */
@@ -414,17 +410,10 @@ AudioClock::render (cairo_t* cr)
                } else {
                        if (input_string.empty()) {
                                cairo_set_source_rgba (cr, cursor_r, cursor_g, cursor_b, cursor_a);
-                               if (!_fixed_width) {
-                                       cairo_rectangle (cr,
-                                                        (get_width()/2.0),
-                                                        0,
-                                                        2.0, upper_height);
-                               } else {
-                                       cairo_rectangle (cr,
-                                                        (get_width()/2.0),
-                                                        (upper_height - layout_height)/2.0,
-                                                        2.0, upper_height);
-                               }
+                               cairo_rectangle (cr,
+                                                (get_width()/2.0),
+                                                (upper_height - layout_height)/2.0,
+                                                2.0, upper_height);
                                cairo_fill (cr);
                        }
                }
@@ -441,33 +430,11 @@ AudioClock::on_size_allocate (Gtk::Allocation& alloc)
        } else {
                upper_height = get_height();
        }
-
-       if (_fixed_width) {
-               /* center display in available space
-                * NB. this only works if the containing widget is not the
-                * layout itself (eg. the session->property dialog)
-                */
-               layout_x_offset = (get_width() - layout_width)/2.0;
-       } else {
-               /* left justify */
-               layout_x_offset = 0;
-       }
 }
 
 void
-AudioClock::on_size_request (Gtk::Requisition* req)
+AudioClock::set_clock_dimensions (Gtk::Requisition& req)
 {
-       /* even for non fixed width clocks, the size we *ask* for never changes,
-          even though the size we receive might. so once we've computed it,
-          just return it.
-       */
-
-       if (first_width) {
-               req->width = first_width;
-               req->height = first_height;
-               return;
-       }
-
        Glib::RefPtr<Pango::Layout> tmp;
        Glib::RefPtr<Gtk::Style> style = get_style ();
        Pango::FontDescription font;
@@ -482,46 +449,29 @@ AudioClock::on_size_request (Gtk::Requisition* req)
 
        tmp->set_font_description (font);
 
-       if (_fixed_width) {
-               int ignored;
-               tmp->set_text ("-88:88:88:88");
-               tmp->get_pixel_size (_mode_width[Timecode], ignored);
-               tmp->set_text (" 88888|88|8888");
-               tmp->get_pixel_size (_mode_width[BBT], ignored);
-               tmp->set_text (" 88:88:88,888");
-               tmp->get_pixel_size (_mode_width[MinSec], ignored);
-               tmp->set_text (" 8888888888");
-               tmp->get_pixel_size (_mode_width[Frames], ignored);
-
-               /* this string is the longest thing we will ever display,
-                  it does not include the BBT bar char that may descend
-                        below the baseline.
-                        note; depending on BPM setting this may actually
-                        not be sufficient for 24h worth of BBT
-               */
+       /* this string is the longest thing we will ever display */
+       tmp->set_text (" 88:88:88,888");
+       tmp->get_pixel_size (req.width, req.height);
 
-               tmp->set_text (" 88888888888::,");
-       } else {
-               switch (_mode) {
-               case Timecode:
-                       tmp->set_text ("-88:88:88:88");
-                       break;
-               case BBT:
-                       tmp->set_text (" 88888|88|8888");
-                       break;
-               case MinSec:
-                       tmp->set_text (" 88:88:88,888");
-                       break;
-               case Frames:
-                       tmp->set_text (" 8888888888");
-                       break;
-               }
-       }
+       layout_height = req.height;
+       layout_width = req.width;
+}
 
-       tmp->get_pixel_size (req->width, req->height);
+void
+AudioClock::on_size_request (Gtk::Requisition* req)
+{
+       /* even for non fixed width clocks, the size we *ask* for never changes,
+          even though the size we receive might. so once we've computed it,
+          just return it.
+       */
+
+       if (first_width) {
+               req->width = first_width;
+               req->height = first_height;
+               return;
+       }
 
-       layout_height = req->height;
-       layout_width = req->width;
+       set_clock_dimensions (*req);
 
        /* now tackle height, for which we need to know the height of the lower
         * layout
@@ -529,9 +479,22 @@ AudioClock::on_size_request (Gtk::Requisition* req)
 
        if (_left_layout) {
 
+               Glib::RefPtr<Pango::Layout> tmp;
+               Glib::RefPtr<Gtk::Style> style = get_style ();
+               Pango::FontDescription font;
                int w;
+               
+               tmp = Pango::Layout::create (get_pango_context());
+               
+               if (!is_realized()) {
+                       font = get_font_for_style (get_name());
+               } else {
+                       font = style->get_font();
+               }
+               
+               tmp->set_font_description (font);
 
-               font.set_size ((int) lrint (font.get_size() * info_font_scale_factor));
+               font.set_size (INFO_FONT_SIZE);
                font.set_weight (Pango::WEIGHT_NORMAL);
                tmp->set_font_description (font);
 
@@ -549,9 +512,6 @@ AudioClock::on_size_request (Gtk::Requisition* req)
                req->height += info_height;
                req->height += separator_height;
        }
-
-       first_height = req->height;
-       first_width = req->width;
 }
 
 void
@@ -569,28 +529,30 @@ AudioClock::show_edit_status (int length)
 void
 AudioClock::start_edit (Field f)
 {
-       pre_edit_string = _layout->get_text ();
-       if (!insert_map.empty()) {
-               edit_string = pre_edit_string;
-       } else {
-               edit_string.clear ();
-               _layout->set_text ("");
-       }
-
-       input_string.clear ();
-       editing = true;
-       edit_is_negative = false;
+       if (!editing) {
+               pre_edit_string = _layout->get_text ();
+               if (!insert_map.empty()) {
+                       edit_string = pre_edit_string;
+               } else {
+                       edit_string.clear ();
+                       _layout->set_text ("");
+               }
+               
+               input_string.clear ();
+               editing = true;
+               edit_is_negative = false;
+               
+               if (f) {
+                       input_string = get_field (f);
+                       show_edit_status (merge_input_and_edit_string ());
+                       _layout->set_text (edit_string);
+               }
+               
+               queue_draw ();
 
-       if (f) {
-               input_string = get_field (f);
-               show_edit_status (merge_input_and_edit_string ());
-               _layout->set_text (edit_string);
+               Keyboard::magic_widget_grab_focus ();
+               grab_focus ();
        }
-
-       queue_draw ();
-
-       Keyboard::magic_widget_grab_focus ();
-       grab_focus ();
 }
 
 string
@@ -658,6 +620,9 @@ AudioClock::end_edit (bool modify)
                        break;
 
                case Frames:
+                       if (edit_string.length() < 1) {
+                               edit_string = pre_edit_string;
+                       }
                        break;
                }
 
@@ -929,7 +894,7 @@ AudioClock::end_edit_relative (bool add)
 }
 
 void
-AudioClock::session_property_changed (const PropertyChange& p)
+AudioClock::session_property_changed (const PropertyChange&)
 {
        set (last_when, true);
 }
@@ -1034,19 +999,19 @@ AudioClock::set_slave_info ()
                Slave* slave = _session->slave();
 
                switch (sync_src) {
-               case JACK:
-                       _left_layout->set_markup (string_compose ("<span size=\"%1\" foreground=\"white\">%2</span>",
+               case Engine:
+                       _left_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "%2</span></span>",
                                                INFO_FONT_SIZE, sync_source_to_string(sync_src, true)));
                        _right_layout->set_text ("");
                        break;
                case MIDIClock:
                        if (slave) {
-                               _left_layout->set_markup (string_compose ("<span size=\"%1\" foreground=\"white\">%2</span>",
+                               _left_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "%2</span></span>",
                                                        INFO_FONT_SIZE, sync_source_to_string(sync_src, true)));
-                               _right_layout->set_markup (string_compose ("<span size=\"%1\" foreground=\"white\">%2</span>",
+                               _right_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "%2</span></span>",
                                                        INFO_FONT_SIZE, slave->approximate_current_delta()));
                        } else {
-                               _left_layout->set_markup (string_compose ("<span size=\"%1\" foreground=\"white\">%2</span>",
+                               _left_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "%2</span></span>",
                                                        INFO_FONT_SIZE, _("--pending--")));
                                _right_layout->set_text ("");
                        }
@@ -1058,21 +1023,21 @@ AudioClock::set_slave_info ()
                                TimecodeSlave* tcslave;
                                if ((tcslave = dynamic_cast<TimecodeSlave*>(_session->slave())) != 0) {
                                        matching = (tcslave->apparent_timecode_format() == _session->config.get_timecode_format());
-                                       _left_layout->set_markup (string_compose ("<span size=\"%1\"><span foreground=\"white\">%2</span><span foreground=\"%3\">%4</span></span>",
+                                       _left_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "%2</span><span foreground=\"%3\">%4</span></span>",
                                                                                  INFO_FONT_SIZE, sync_source_to_string(sync_src, true)[0], (matching?"green":"red"),
                                                                                  dynamic_cast<TimecodeSlave*>(slave)->approximate_current_position()));
-                                       _right_layout->set_markup (string_compose ("<span size=\"%1\" foreground=\"white\">%2</span>",
+                                       _right_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "%2</span></span>",
                                                                                   INFO_FONT_SIZE, slave->approximate_current_delta()));
                                }
                        } else {
-                               _left_layout->set_markup (string_compose ("<span size=\"%1\" foreground=\"white\">%2</span>",
+                               _left_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "%2</span></span>",
                                                        INFO_FONT_SIZE, _("--pending--")));
                                _right_layout->set_text ("");
                        }
                        break;
                }
        } else {
-               _left_layout->set_markup (string_compose ("<span size=\"%1\" foreground=\"white\">INT/%2</span>",
+               _left_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "INT/%2</span></span>",
                                        INFO_FONT_SIZE, sync_source_to_string(sync_src, true)));
                _right_layout->set_text ("");
        }
@@ -1085,7 +1050,7 @@ AudioClock::set_frames (framepos_t when, bool /*force*/)
        bool negative = false;
 
        if (_off) {
-               _layout->set_text ("\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012\u2012");
+               _layout->set_text (" ----------");
 
                if (_left_layout) {
                        _left_layout->set_text ("");
@@ -1117,17 +1082,17 @@ AudioClock::set_frames (framepos_t when, bool /*force*/)
                        sprintf (buf, "%" PRId64 "Hz", rate);
                }
 
-               _left_layout->set_markup (string_compose ("<span size=\"%1\"><span foreground=\"white\">%2 </span><span foreground=\"green\">%3</span></span>",
+               _left_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "%2 </span><span foreground=\"green\">%3</span></span>",
                                INFO_FONT_SIZE, _("SR"), buf));
 
                float vid_pullup = _session->config.get_video_pullup();
 
                if (vid_pullup == 0.0) {
-                       _right_layout->set_markup (string_compose ("<span size=\"%1\"><span foreground=\"white\">%2 </span><span foreground=\"green\">off</span></span>",
+                       _right_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "%2 </span><span foreground=\"green\">off</span></span>",
                                        INFO_FONT_SIZE, _("Pull")));
                } else {
                        sprintf (buf, _("%+.4f%%"), vid_pullup);
-                       _right_layout->set_markup (string_compose ("<span size=\"%1\"><span foreground=\"white\">%2 </span><span foreground=\"green\">%3</span></span>",
+                       _right_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "%2 </span><span foreground=\"green\">%3</span></span>",
                                        INFO_FONT_SIZE, _("Pull"), buf));
                }
        }
@@ -1145,7 +1110,7 @@ AudioClock::set_minsec (framepos_t when, bool /*force*/)
        bool negative = false;
 
        if (_off) {
-               _layout->set_text ("\u2012\u2012:\u2012\u2012:\u2012\u2012.\u2012\u2012\u2012");
+               _layout->set_text (" --:--:--.---");
 
                if (_left_layout) {
                        _left_layout->set_text ("");
@@ -1166,7 +1131,7 @@ AudioClock::set_minsec (framepos_t when, bool /*force*/)
        mins = (int) floor (left / (_session->frame_rate() * 60.0f));
        left -= (framecnt_t) floor (mins * _session->frame_rate() * 60.0f);
        secs = (int) floor (left / (float) _session->frame_rate());
-       left -= (framecnt_t) floor (secs * _session->frame_rate());
+       left -= (framecnt_t) floor ((double)(secs * _session->frame_rate()));
        millisecs = floor (left * 1000.0 / (float) _session->frame_rate());
 
        if (negative) {
@@ -1186,7 +1151,7 @@ AudioClock::set_timecode (framepos_t when, bool /*force*/)
        bool negative = false;
 
        if (_off) {
-               _layout->set_text ("\u2012\u2012:\u2012\u2012:\u2012\u2012:\u2012\u2012");
+               _layout->set_text (" --:--:--:--");
                if (_left_layout) {
                        _left_layout->set_text ("");
                        _right_layout->set_text ("");
@@ -1221,7 +1186,7 @@ AudioClock::set_bbt (framepos_t when, bool /*force*/)
        bool negative = false;
 
        if (_off) {
-               _layout->set_text ("\u2012\u2012\u2012|\u2012\u2012|\u2012\u2012\u2012\u2012");
+               _layout->set_text (" ---|--|----");
                if (_left_layout) {
                        _left_layout->set_text ("");
                        _right_layout->set_text ("");
@@ -1270,13 +1235,13 @@ AudioClock::set_bbt (framepos_t when, bool /*force*/)
 
                TempoMetric m (_session->tempo_map().metric_at (pos));
 
-               sprintf (buf, "%-5.2f", m.tempo().beats_per_minute());
-               _left_layout->set_markup (string_compose ("<span size=\"%1\" foreground=\"white\">Tempo <span foreground=\"green\">%2</span></span>",
-                                       INFO_FONT_SIZE, buf));
+               sprintf (buf, "%-5.1f", m.tempo().beats_per_minute());
+               _left_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "%3</span> <span foreground=\"green\">%2</span></span>",
+                                                         INFO_FONT_SIZE, buf, _("Tempo")));
 
                sprintf (buf, "%g/%g", m.meter().divisions_per_bar(), m.meter().note_divisor());
-               _right_layout->set_markup (string_compose ("<span size=\"%1\" foreground=\"white\">Meter <span foreground=\"green\">%2</span></span>",
-                                       INFO_FONT_SIZE, buf));
+               _right_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "%3</span> <span foreground=\"green\">%2</span></span>",
+                                                          INFO_FONT_SIZE, buf, _("Meter")));
        }
 }
 
@@ -1445,7 +1410,7 @@ AudioClock::on_key_press_event (GdkEventKey* ev)
        if (edit_is_negative) {
                edit_string.replace(0,1,"-");
        } else {
-               if (pre_edit_string.at(0) == '-') {
+               if (!pre_edit_string.empty() && (pre_edit_string.at(0) == '-')) {
                        edit_string.replace(0,1,"_");
                } else {
                        edit_string.replace(0,1," ");
@@ -1585,10 +1550,10 @@ AudioClock::on_button_press_event (GdkEventButton *ev)
                        /* the text has been centered vertically, so adjust
                         * x and y.
                         */
-                       int xcenter = !_fixed_width || layout_x_offset > 0 ? 0 : (get_width() - _mode_width[_mode]) /2;
+                       int xcenter = (get_width() - layout_width) /2;
 
                        y = ev->y - ((upper_height - layout_height)/2);
-                       x = ev->x - layout_x_offset - xcenter;
+                       x = ev->x - xcenter;
 
                        if (!_layout->xy_to_index (x * PANGO_SCALE, y * PANGO_SCALE, index, trailing)) {
                                /* pretend it is a character on the far right */
@@ -1630,11 +1595,11 @@ AudioClock::on_button_release_event (GdkEventButton *ev)
 
                                        if (_edit_by_click_field) {
 
-                                               int xcenter = !_fixed_width || layout_x_offset > 0 ? 0 : (get_width() - _mode_width[_mode]) /2;
+                                               int xcenter = (get_width() - layout_width) /2;
                                                int index = 0;
                                                int trailing;
                                                int y = ev->y - ((upper_height - layout_height)/2);
-                                               int x = ev->x - layout_x_offset - xcenter;
+                                               int x = ev->x - xcenter;
                                                Field f;
 
                                                if (!_layout->xy_to_index (x * PANGO_SCALE, y * PANGO_SCALE, index, trailing)) {
@@ -1701,9 +1666,9 @@ AudioClock::on_scroll_event (GdkEventScroll *ev)
         * x and y.
         */
 
-       int xcenter = !_fixed_width || layout_x_offset > 0 ? 0 : (get_width() - _mode_width[_mode]) /2;
+       int xcenter = (get_width() - layout_width) /2;
        y = ev->y - ((upper_height - layout_height)/2);
-       x = ev->x - layout_x_offset - xcenter;
+       x = ev->x - xcenter;
 
        if (!_layout->xy_to_index (x * PANGO_SCALE, y * PANGO_SCALE, index, trailing)) {
                /* not in the main layout */
@@ -1777,7 +1742,7 @@ AudioClock::on_motion_notify_event (GdkEventMotion *ev)
 
        drag_y = ev->y;
 
-       if (trunc (drag_accum) != 0) {
+       if (floor (drag_accum) != 0) {
 
                framepos_t frames;
                framepos_t pos;
@@ -2051,7 +2016,7 @@ framepos_t
 AudioClock::frame_duration_from_bbt_string (framepos_t pos, const string& str) const
 {
        if (_session == 0) {
-               error << "AudioClock::current_time() called with BBT mode but without session!" << endmsg;
+               error << "AudioClock::frame_duration_from_bbt_string() called with BBT mode but without session!" << endmsg;
                return 0;
        }
 
@@ -2143,7 +2108,7 @@ AudioClock::set_mode (Mode m)
 
        switch (_mode) {
        case Timecode:
-               mode_based_info_ratio = 0.5;
+               mode_based_info_ratio = 0.6;
                insert_map.push_back (11);
                insert_map.push_back (10);
                insert_map.push_back (8);
@@ -2168,7 +2133,7 @@ AudioClock::set_mode (Mode m)
                break;
 
        case MinSec:
-               mode_based_info_ratio = 0.5;
+               mode_based_info_ratio = 0.6;
                insert_map.push_back (12);
                insert_map.push_back (11);
                insert_map.push_back (10);
@@ -2181,7 +2146,7 @@ AudioClock::set_mode (Mode m)
                break;
 
        case Frames:
-               mode_based_info_ratio = 0.5;
+               mode_based_info_ratio = 0.45;
                break;
        }
 
@@ -2191,13 +2156,6 @@ AudioClock::set_mode (Mode m)
                 ModeChanged (); /* EMIT SIGNAL (the static one)*/
         }
 
-       if (!_fixed_width) {
-               /* display is different, allow us to resize */
-               first_width = 0;
-               first_height = 0;
-               queue_resize ();
-       }
-
         mode_changed (); /* EMIT SIGNAL (the member one) */
 }
 
@@ -2211,8 +2169,10 @@ void
 AudioClock::on_style_changed (const Glib::RefPtr<Gtk::Style>& old_style)
 {
        CairoWidget::on_style_changed (old_style);
-       first_width = 0;
-       first_height = 0;
+
+       Gtk::Requisition req;
+       set_clock_dimensions (req);
+
        set_font ();
        set_colors ();
 }
@@ -2265,12 +2225,6 @@ AudioClock::set_corner_radius (double r)
        queue_resize ();
 }
 
-void
-AudioClock::set_fixed_width (bool yn)
-{
-       _fixed_width = yn;
-}
-
 void
 AudioClock::dpi_reset ()
 {