-
-
Notifications
You must be signed in to change notification settings - Fork 991
/
preferences_display.cpp
119 lines (92 loc) · 2.18 KB
/
preferences_display.cpp
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
Copyright (C) 2003 - 2016 by David White <dave@whitevine.net>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
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.
See the COPYING file for more details.
*/
#define GETTEXT_DOMAIN "wesnoth-lib"
/**
* @file
* Manage display-related preferences, e.g. screen-size, etc.
*/
#include "global.hpp"
#include "preferences_display.hpp"
#include "display.hpp"
#include "formatter.hpp"
#include "game_preferences.hpp"
#include "gettext.hpp"
#include "gui/dialogs/message.hpp"
#include "gui/dialogs/simple_item_selector.hpp"
#include "gui/dialogs/transient_message.hpp"
#include "gui/widgets/window.hpp"
#include "log.hpp"
#include <boost/foreach.hpp>
#include <boost/math/common_factor_rt.hpp>
namespace preferences {
static display* disp = NULL;
display_manager::display_manager(display* d)
{
disp = d;
load_hotkeys();
set_grid(grid());
set_turbo(turbo());
set_turbo_speed(turbo_speed());
set_scroll_to_action(scroll_to_action());
set_color_cursors(preferences::get("color_cursors", false));
}
display_manager::~display_manager()
{
disp = NULL;
}
void set_scroll_to_action(bool ison)
{
_set_scroll_to_action(ison);
}
void set_turbo(bool ison)
{
_set_turbo(ison);
if(disp != NULL) {
disp->set_turbo(ison);
}
}
void set_turbo_speed(double speed)
{
save_turbo_speed(speed);
if(disp != NULL) {
disp->set_turbo_speed(speed);
}
}
void set_ellipses(bool ison)
{
_set_ellipses(ison);
}
void set_grid(bool ison)
{
_set_grid(ison);
if(disp != NULL) {
disp->set_grid(ison);
}
}
void set_color_cursors(bool value)
{
_set_color_cursors(value);
cursor::set();
}
void set_idle_anim(bool ison) {
_set_idle_anim(ison);
if(disp != NULL) {
disp->set_idle_anim(ison);
}
}
void set_idle_anim_rate(int rate) {
_set_idle_anim_rate(rate);
if(disp != NULL) {
disp->set_idle_anim_rate(rate);
}
}
} // end namespace preferences