diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-03-05 15:43:58 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-03-05 15:43:58 +0000 |
commit | 2d3e8ac20bcbbdc405f891fd32bc3bcd170fc30a (patch) | |
tree | 95ea3d9621043527eb8975e04f75936a1b76478a /gtk2_ardour/ardour_ui_ed.cc | |
parent | cd12fdf447936b6998901cde5cd5946bca2c9cfc (diff) |
working big clock resizing, i think; still needs removal of global vars to ardour_ui.h
git-svn-id: svn://localhost/ardour2/branches/3.0@6737 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/ardour_ui_ed.cc')
-rw-r--r-- | gtk2_ardour/ardour_ui_ed.cc | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index deb2cfc3dd..04365fe414 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -577,11 +577,12 @@ ARDOUR_UI::big_clock_size_allocate (Gtk::Allocation& allocation) big_clock_resize_in_progress = true; } - big_clock_window->set_size_request (allocation.get_width() - 2, allocation.get_height() - 1); + // big_clock_window->set_size_request (allocation.get_width() - 2, allocation.get_height() - 1); } static int old_big_clock_width = -1; static int old_big_clock_height = -1; +static double big_clock_precise_font_size = 0; bool ARDOUR_UI::idle_big_clock_text_resizer (int win_w, int win_h) @@ -589,41 +590,37 @@ ARDOUR_UI::idle_big_clock_text_resizer (int win_w, int win_h) big_clock_resize_in_progress = false; Glib::RefPtr<Gdk::Window> win = big_clock_window->get_window(); + Pango::FontDescription fd (big_clock.get_style()->get_font()); + int size = fd.get_size (); + bool absolute = fd.get_size_is_absolute (); + int original_size; + int x, y, winw, winh, d; - int x, y, winw, winh, d; + if (!absolute) { + size /= PANGO_SCALE; + } win->get_geometry (x, y, winw, winh, d); if (old_big_clock_width < 0 || old_big_clock_height < 0) { old_big_clock_height = winh; old_big_clock_width = winw; + big_clock_precise_font_size = size; return false; } double scale; - - scale = min (((double) winw / (double)old_big_clock_width), + + scale = min (((double) winw / (double) old_big_clock_width), ((double) winh / (double) old_big_clock_height)); - cerr << "Window scaled by " << scale << endl; - - Pango::FontDescription fd (big_clock.get_style()->get_font()); string family = fd.get_family(); - int size = fd.get_size (); - bool absolute = fd.get_size_is_absolute (); - int original_size; - - if (!absolute) { - size /= PANGO_SCALE; - } original_size = size; - size = lrintf (size * scale); - size -= 2; - if (size != original_size) { + size = (int) lrintf (big_clock_precise_font_size * scale); - cerr << "new font size = " << size << endl; + if (size != original_size) { char buf[family.length()+16]; snprintf (buf, family.length()+16, "%s %d", family.c_str(), size); |