2 * Copyright (C) 2013-2016 Paul Davis <paul@linuxaudiosystems.com>
3 * Copyright (C) 2014-2017 Robin Gareus <robin@gareus.org>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #include "gtkmm2ext/utils.h"
26 #include "ardour_ui.h"
27 #include "audio_clock.h"
28 #include "big_clock_window.h"
29 #include "public_editor.h"
36 using namespace ARDOUR_UI_UTILS;
38 BigClockWindow::BigClockWindow (AudioClock& c)
39 : ArdourWindow (_("Big Clock"))
42 ARDOUR_UI::Clock.connect (sigc::bind (sigc::mem_fun (clock, &AudioClock::set), false, 0));
44 clock.set_corner_radius (0.0);
46 set_keep_above (true);
51 clock.size_request (default_size);
53 clock.signal_size_allocate().connect (sigc::mem_fun (*this, &BigClockWindow::clock_size_reallocated));
57 BigClockWindow::on_unmap ()
59 ArdourWindow::on_unmap ();
60 ARDOUR_UI::instance()->reset_focus (this);
64 BigClockWindow::on_key_press_event (GdkEventKey* ev)
66 return relay_key_press (ev, this);
70 BigClockWindow::on_realize ()
72 ArdourWindow::on_realize ();
73 /* (try to) ensure that resizing is possible and the window can be moved (and closed) */
74 get_window()->set_decorations (Gdk::DECOR_BORDER | Gdk::DECOR_RESIZEH | Gdk::DECOR_TITLE | Gdk::DECOR_MENU);
76 /* try to force a fixed aspect ratio so that we don't distort the font */
77 float aspect = default_size.width/(float)default_size.height;
80 geom.min_aspect = aspect;
81 geom.max_aspect = aspect;
82 geom.min_width = -1; /* use requisition */
83 geom.min_height = -1; /* use requisition */
85 get_window()->set_geometry_hints (geom, Gdk::WindowHints (Gdk::HINT_ASPECT|Gdk::HINT_MIN_SIZE));
89 BigClockWindow::clock_size_reallocated (Gtk::Allocation& alloc)
91 clock.set_scale ((double) alloc.get_width() / default_size.width,
92 (double) alloc.get_height() / default_size.height);