1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
/*
Copyright (C) 20002-2013 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <algorithm>
#include <string>
#include <vector>
#include "ardour_ui.h"
#include "audio_clock.h"
#include "big_clock_window.h"
#include "public_editor.h"
#include "utils.h"
#include "i18n.h"
using std::min;
using std::string;
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));
clock.set_corner_radius (0.0);
set_keep_above (true);
set_border_width (0);
add (clock);
clock.show_all ();
}
void
BigClockWindow::on_unmap ()
{
ArdourWindow::on_unmap ();
PublicEditor::instance().reset_focus ();
}
bool
BigClockWindow::on_key_press_event (GdkEventKey* ev)
{
return relay_key_press (ev, this);
}
void
BigClockWindow::on_realize ()
{
ArdourWindow::on_realize ();
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)
{
ArdourWindow::on_size_allocate (alloc);
if (original_width) {
clock.set_scale ((double) alloc.get_width() / original_width,
(double) alloc.get_height() / original_height);
std::cerr << "Rescale to "
<< (double) alloc.get_width() / original_width
<< " x "
<< (double) alloc.get_height() / original_height
<< " using " << alloc.get_width() << " vs. " << original_width
<< " and " << alloc.get_height() << " vs. " << original_height
<< std::endl;
}
}
|