1 /*
2    Copyright (C) 2007 - 2018 by Mark de Wever <koraq@xs4all.nl>
3    Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4 
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.
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY.
11 
12    See the COPYING file for more details.
13 */
14 
15 #include "gui/widgets/settings.hpp"
16 
17 #include "display.hpp"
18 
19 namespace gui2
20 {
21 bool new_widgets = false;
22 
23 namespace settings
24 {
25 unsigned screen_width = 0;
26 unsigned screen_height = 0;
27 
28 unsigned gamemap_x_offset = 0;
29 
30 unsigned gamemap_width = 0;
31 unsigned gamemap_height = 0;
32 
33 unsigned popup_show_delay = 0;
34 unsigned popup_show_time = 0;
35 unsigned help_show_time = 0;
36 unsigned double_click_time = 0;
37 unsigned repeat_button_repeat_time = 0;
38 
39 std::string sound_button_click = "";
40 std::string sound_toggle_button_click = "";
41 std::string sound_toggle_panel_click = "";
42 std::string sound_slider_adjust = "";
43 
44 t_string has_helptip_message;
45 
46 std::vector<game_tip> tips;
47 
update_screen_size_variables()48 void update_screen_size_variables()
49 {
50 	const SDL_Rect rect = CVideo::get_singleton().screen_area();
51 
52 	screen_width = rect.w;
53 	screen_height = rect.h;
54 
55 	gamemap_width = screen_width;
56 	gamemap_height = screen_height;
57 
58 	if(display* display = display::get_singleton()) {
59 		const SDL_Rect rect_gm = display->map_outside_area();
60 
61 		if(rect_gm.w && rect_gm.h) {
62 			gamemap_width = rect_gm.w;
63 			gamemap_height = rect_gm.h;
64 			gamemap_x_offset = rect_gm.x;
65 		}
66 	}
67 }
68 
69 } // namespace settings
70 
71 } // namespace gui2
72