The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
preferences.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2016 by David White <[email protected]>
3  Part of the Battle for Wesnoth Project http://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 /** @file */
16 
17 #ifndef PREFERENCES_HPP_INCLUDED
18 #define PREFERENCES_HPP_INCLUDED
19 
20 class config;
21 class display;
22 
23 #include "terrain/translation.hpp"
24 
25 #include <SDL.h>
26 
27 #include <utility>
28 
29 namespace hotkey {
30  class hotkey_item;
31 }
32 
33 
34 namespace preferences {
35 
36  struct base_manager
37  {
38  base_manager();
39  ~base_manager();
40  };
41 
42  void write_preferences();
43 
44  void set(const std::string& key, const std::string &value);
45  void set(const std::string& key, char const *value);
46  void set(const std::string &key, bool value);
47  void set(const std::string &key, int value);
48  void clear(const std::string& key);
49  void set_child(const std::string& key, const config& val);
50  const config &get_child(const std::string &key);
51  std::string get(const std::string& key);
52  std::string get(const std::string& key, const std::string& def);
53  bool get(const std::string &key, bool def);
54  void erase(const std::string& key);
55  bool have_setting(const std::string& key);
56 
58 
59  config* get_prefs();
60 
62  void set_core_id(const std::string& root);
63 
64  bool scroll_to_action();
65  void set_scroll_to_action(bool ison);
66 
67  int min_allowed_width();
68  int min_allowed_height();
69 
70  std::pair<int,int> resolution();
71  void _set_resolution(const std::pair<int,int>& res);
72 
73  bool maximized();
74  void _set_maximized(bool ison);
75 
76  bool fullscreen();
77  void _set_fullscreen(bool ison);
78 
79  bool turbo();
80  void _set_turbo(bool ison);
81 
82  double turbo_speed();
83  void save_turbo_speed(const double speed);
84 
85  int font_scaling();
86  void set_font_scaling(int scale);
87  int font_scaled(int size);
88 
89  bool idle_anim();
90  void _set_idle_anim(const bool ison);
91 
92  int idle_anim_rate();
93  void _set_idle_anim_rate(const int rate);
94 
96  void set_language(const std::string& s);
97 
98  // Don't rename it to sound() because of a gcc-3.3 branch bug,
99  // which will cause it to conflict with the sound namespace.
100  bool sound_on();
101  bool set_sound(bool ison);
102 
103  unsigned int sample_rate();
104  void save_sample_rate(const unsigned int rate);
105 
106  size_t sound_buffer_size();
107  void save_sound_buffer_size(const size_t size);
108 
109  int sound_volume();
110  void set_sound_volume(int vol);
111 
112  int bell_volume();
113  void set_bell_volume(int vol);
114 
115  int UI_volume();
116  void set_UI_volume(int vol);
117 
118  bool music_on();
119  bool set_music(bool ison);
120 
121  int music_volume();
122  void set_music_volume(int vol);
123 
124  bool turn_bell();
125  bool set_turn_bell(bool ison);
126 
127  bool UI_sound_on();
128  bool set_UI_sound(bool ison);
129 
130  bool message_bell();
131 
132  // Proxies for preferences_dialog
133  void load_hotkeys();
134  void save_hotkeys();
135  void clear_hotkeys();
136 
137  void add_alias(const std::string& alias, const std::string& command);
138  const config &get_alias();
139 
140 
142  void set_allied_color(const std::string& color_id);
143 
145  void set_enemy_color(const std::string& color_id);
146 
148  void set_unmoved_color(const std::string& color_id);
149 
151  void set_partial_color(const std::string& color_id);
152 
154  void set_moved_color(const std::string& color_id);
155 
156 
157  bool show_allied_orb();
158  void set_show_allied_orb(bool show_orb);
159 
160  bool show_enemy_orb();
161  void set_show_enemy_orb(bool show_orb);
162 
163  bool show_moved_orb();
164  void set_show_moved_orb(bool show_orb);
165 
166  bool show_unmoved_orb();
167  void set_show_unmoved_orb(bool show_orb);
168 
169  bool show_partial_orb();
170  void set_show_partial_orb(bool show_orb);
171 
172 
173  bool use_color_cursors();
174  void _set_color_cursors(bool value);
175 
182 
188 
195 
199 
203 
204  int scroll_speed();
205  void set_scroll_speed(const int scroll);
206 
207  bool middle_click_scrolls();
208  bool mouse_scroll_enabled();
209  void enable_mouse_scroll(bool value);
210 
211  /**
212  * Gets the threshold for when to scroll.
213  *
214  * This scrolling happens when the mouse is in the application and near
215  * the border.
216  */
218 
219  int draw_delay();
220  void set_draw_delay(int value);
221 
222  bool animate_map();
223  void set_animate_map(bool value);
224 
225  bool animate_water();
226  void set_animate_water(bool value);
227 
230 
231  bool minimap_terrain_coding();
233 
234  bool minimap_draw_units();
236 
237  bool minimap_draw_villages();
239 
240  bool minimap_draw_terrain();
242 
245 
246  bool show_fps();
247  void set_show_fps(bool value);
248 
249  bool ellipses();
250  void set_ellipses(bool ison);
251 
252  bool grid();
253  void _set_grid(bool ison);
254 
256 
259 
260  bool disable_auto_moves();
261  void set_disable_auto_moves(bool value);
262 
265 
266 } // end namespace preferences
267 
268 #endif
int joystick_mouse_xaxis_num()
bool disable_auto_moves()
void _set_turbo(bool ison)
int joystick_thrustb_axis_num()
bool set_sound(bool ison)
void set_show_enemy_orb(bool show_orb)
std::string unmoved_color()
void _set_fullscreen(bool ison)
int bell_volume()
bool turn_bell()
int joystick_mouse_yaxis_num()
void _set_grid(bool ison)
void _set_resolution(const std::pair< int, int > &res)
void set_moved_color(const std::string &color_id)
int joystick_num_mouse_xaxis()
void save_hotkeys()
bool minimap_draw_units()
void set_allied_color(const std::string &color_id)
bool show_fps()
void set_unmoved_color(const std::string &color_id)
void set_show_standing_animations(bool value)
void write_preferences()
GLenum GLenum GLenum GLenum GLenum scale
Definition: glew.h:10669
void _set_maximized(bool ison)
int mouse_scroll_threshold()
Gets the threshold for when to scroll.
void disable_preferences_save()
void set_show_unmoved_orb(bool show_orb)
int joystick_thrusta_axis_num()
void _set_color_cursors(bool value)
void set_disable_loadingscreen_animation(bool value)
int draw_delay()
void set_scroll_speed(const int new_speed)
bool minimap_movement_coding()
int joystick_num_cursor_yaxis()
bool show_enemy_orb()
int scroll_speed()
void save_turbo_speed(const double speed)
void enable_mouse_scroll(bool value)
bool show_allied_orb()
void clear(const std::string &key)
int joystick_thrustb_deadzone()
bool idle_anim()
GLuint const GLfloat * val
Definition: glew.h:2614
bool message_bell()
int joystick_num_mouse_yaxis()
void set(const std::string &key, bool value)
int joystick_num_thrustb_axis()
unsigned int sample_rate()
double turbo_speed()
bool confirm_load_save_from_different_version()
bool animate_water()
void set_sound_volume(int vol)
int joystick_num_scroll_xaxis()
int joystick_num_cursor_xaxis()
bool ellipses()
bool sound_on()
void save_sound_buffer_size(const size_t size)
Keyboard shortcuts for game actions.
bool maximized()
void set_use_twelve_hour_clock_format(bool value)
int joystick_cursor_yaxis_num()
bool minimap_draw_villages()
int joystick_thrusta_deadzone()
bool joystick_support_enabled()
void set_enemy_color(const std::string &color_id)
void load_hotkeys()
void toggle_minimap_draw_units()
int joystick_scroll_yaxis_num()
bool fullscreen()
GLsizei const GLfloat * value
Definition: glew.h:1817
void set_font_scaling(int scale)
void set_music_volume(int vol)
int font_scaled(int size)
void set_show_fps(bool value)
void set_partial_color(const std::string &color_id)
void erase(const std::string &key)
std::pair< int, int > resolution()
void set_show_partial_orb(bool show_orb)
void set_core_id(const std::string &core_id)
Modify, read and display user preferences.
void toggle_minimap_draw_terrain()
bool UI_sound_on()
void set_bell_volume(int vol)
bool animate_map()
bool show_standing_animations()
void set_animate_map(bool value)
int joystick_scroll_xaxis_num()
void _set_idle_anim(const bool ison)
void set_show_moved_orb(bool show_orb)
bool show_moved_orb()
void set_draw_delay(int value)
void toggle_minimap_draw_villages()
int idle_anim_rate()
int joystick_num_thrusta_axis()
void set_UI_volume(int vol)
void set_child(const std::string &key, const config &val)
GLuint res
Definition: glew.h:9258
void save_sample_rate(const unsigned int rate)
size_t sound_buffer_size()
std::string allied_color()
void add_alias(const std::string &alias, const std::string &command)
void clear_hotkeys()
std::string moved_color()
void toggle_minimap_terrain_coding()
bool middle_click_scrolls()
bool music_on()
bool use_color_cursors()
void toggle_minimap_movement_coding()
bool set_UI_sound(bool ison)
std::string language()
config * get_prefs()
void set_scroll_to_action(bool ison)
void set_ellipses(bool ison)
const config & get_child(const std::string &key)
int joystick_cursor_xaxis_num()
int joystick_cursor_threshold()
std::string core_id()
void set_language(const std::string &s)
GLsizeiptr size
Definition: glew.h:1649
bool mouse_scroll_enabled()
bool disable_loadingscreen_animation()
std::string partial_color()
int sound_volume()
int min_allowed_width()
bool have_setting(const std::string &key)
int font_scaling()
bool minimap_draw_terrain()
bool set_music(bool ison)
int joystick_scroll_deadzone()
bool set_turn_bell(bool ison)
bool scroll_to_action()
int min_allowed_height()
int joystick_mouse_deadzone()
int joystick_cursor_deadzone()
bool show_unmoved_orb()
bool show_partial_orb()
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
const config & get_alias()
GLdouble s
Definition: glew.h:1358
int joystick_num_scroll_yaxis()
void set_animate_water(bool value)
void _set_idle_anim_rate(const int rate)
GLsizei const GLcharARB ** string
Definition: glew.h:4503
bool use_twelve_hour_clock_format()
void set_show_allied_orb(bool show_orb)
std::string enemy_color()
int music_volume()
bool minimap_terrain_coding()
void set_disable_auto_moves(bool value)