X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fbig_clock_window.cc;h=6c18ced98b9d33c025276e15a589aa167a137113;hb=b2aaffadc51ad38939e52d5f792e3e9a098ff2d7;hp=173cc77fc02fffc90588fa12e5a60f9cb5a8e720;hpb=03833e4376a763b0055e80fa75b680547dedb966;p=ardour.git diff --git a/gtk2_ardour/big_clock_window.cc b/gtk2_ardour/big_clock_window.cc index 173cc77fc0..6c18ced98b 100644 --- a/gtk2_ardour/big_clock_window.cc +++ b/gtk2_ardour/big_clock_window.cc @@ -21,23 +21,23 @@ #include #include +#include "gtkmm2ext/utils.h" + #include "ardour_ui.h" #include "audio_clock.h" #include "big_clock_window.h" #include "public_editor.h" #include "utils.h" -#include "i18n.h" +#include "pbd/i18n.h" using std::min; using std::string; using namespace ARDOUR_UI_UTILS; -BigClockWindow::BigClockWindow (AudioClock& c) +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,14 +47,17 @@ 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 BigClockWindow::on_unmap () { ArdourWindow::on_unmap (); - - PublicEditor::instance().reset_focus (); + ARDOUR_UI::instance()->reset_focus (this); } bool @@ -67,21 +70,26 @@ void BigClockWindow::on_realize () { ArdourWindow::on_realize (); - get_window()->set_decorations (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH); + /* (try to) ensure that resizing is possible and the window can be moved (and closed) */ + get_window()->set_decorations (Gdk::DECOR_BORDER | Gdk::DECOR_RESIZEH | Gdk::DECOR_TITLE | Gdk::DECOR_MENU); - int x, y, d; - get_window()->get_geometry (x, y, original_width, original_height, d); + /* try to force a fixed aspect ratio so that we don't distort the font */ + float aspect = default_size.width/(float)default_size.height; + Gdk::Geometry geom; + + geom.min_aspect = aspect; + geom.max_aspect = aspect; + geom.min_width = -1; /* use requisition */ + geom.min_height = -1; /* use requisition */ + + get_window()->set_geometry_hints (geom, Gdk::WindowHints (Gdk::HINT_ASPECT|Gdk::HINT_MIN_SIZE)); } 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); }