From 9ef350cb909e82f855df83b4084b2490810ee49e Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 2 Jan 2015 08:23:56 -0500 Subject: [PATCH] remember big clock window scaling, or rather, recompute it accurately --- gtk2_ardour/big_clock_window.cc | 20 ++++++++------------ gtk2_ardour/big_clock_window.h | 5 ++--- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/gtk2_ardour/big_clock_window.cc b/gtk2_ardour/big_clock_window.cc index 173cc77fc0..70bad5c046 100644 --- a/gtk2_ardour/big_clock_window.cc +++ b/gtk2_ardour/big_clock_window.cc @@ -36,8 +36,6 @@ using namespace ARDOUR_UI_UTILS; BigClockWindow::BigClockWindow (AudioClock& c) : ArdourWindow (_("Big Clock")) , clock (c) - , original_height (0) - , original_width (0) { ARDOUR_UI::Clock.connect (sigc::mem_fun (clock, &AudioClock::set)); @@ -47,6 +45,9 @@ BigClockWindow::BigClockWindow (AudioClock& c) set_border_width (0); add (clock); clock.show_all (); + + clock.size_request (default_size); + clock.signal_size_allocate().connect (sigc::mem_fun (*this, &BigClockWindow::clock_size_reallocated)); } void @@ -67,21 +68,16 @@ void BigClockWindow::on_realize () { ArdourWindow::on_realize (); + /* (try to) ensure that resizing is possible. + */ get_window()->set_decorations (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH); - - int x, y, d; - get_window()->get_geometry (x, y, original_width, original_height, d); } void -BigClockWindow::on_size_allocate (Gtk::Allocation& alloc) +BigClockWindow::clock_size_reallocated (Gtk::Allocation& alloc) { - ArdourWindow::on_size_allocate (alloc); - - if (original_width) { - clock.set_scale ((double) alloc.get_width() / original_width, - (double) alloc.get_height() / original_height); - } + clock.set_scale ((double) alloc.get_width() / default_size.width, + (double) alloc.get_height() / default_size.height); } diff --git a/gtk2_ardour/big_clock_window.h b/gtk2_ardour/big_clock_window.h index c83f61b054..1f723d1b59 100644 --- a/gtk2_ardour/big_clock_window.h +++ b/gtk2_ardour/big_clock_window.h @@ -31,10 +31,9 @@ class BigClockWindow : public ArdourWindow private: AudioClock& clock; - int original_height; - int original_width; + Gtk::Requisition default_size; - void on_size_allocate (Gtk::Allocation&); + void clock_size_reallocated (Gtk::Allocation&); void on_realize (); void on_unmap (); bool on_key_press_event (GdkEventKey*);