The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
settings.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2007 - 2016 by Mark de Wever <[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 /**
16  * @file
17  * Implementation of settings.hpp.
18  */
19 
20 #define GETTEXT_DOMAIN "wesnoth-lib"
21 
22 #include "gui/widgets/settings.hpp"
23 
24 #include "asserts.hpp"
25 #include "config_cache.hpp"
26 #include "filesystem.hpp"
27 #include "gettext.hpp"
28 #include "gui/core/log.hpp"
29 #include "gui/core/tips.hpp"
30 #include "gui/widgets/window.hpp"
31 #include "serialization/parser.hpp"
34 #include "formula/string_utils.hpp"
35 #include "wml_exception.hpp"
36 
37 namespace gui2
38 {
39 
40 bool new_widgets = false;
41 
42 namespace settings
43 {
44 unsigned screen_width = 0;
45 unsigned screen_height = 0;
46 
47 unsigned gamemap_x_offset = 0;
48 
49 unsigned gamemap_width = 0;
50 unsigned gamemap_height = 0;
51 
52 unsigned popup_show_delay = 0;
53 unsigned popup_show_time = 0;
54 unsigned help_show_time = 0;
55 unsigned double_click_time = 0;
57 
62 
64 
65 static std::vector<ttip> tips;
66 
67 std::vector<ttip> get_tips()
68 {
69  return tips::shuffle(tips);
70 }
71 
72 } // namespace settings
73 
74 /**
75  * Returns the list of registered windows.
76  *
77  * The function can be used the look for registered windows or to add them.
78  */
79 static std::vector<std::string>& registered_window_types()
80 {
81  static std::vector<std::string> result;
82  return result;
83 }
84 
85 typedef std::map<std::string,
86  std::function<void(tgui_definition&,
87  const std::string&,
88  const config&,
89  const char* key)> >
91 
93 {
95  return result;
96 }
97 
99 {
101  : id()
102  , description()
104  , windows()
105  , window_types()
106  , popup_show_delay_(0)
107  , popup_show_time_(0)
108  , help_show_time_(0)
109  , double_click_time_(0)
116  , tips_()
117  {
118  }
119 
120  std::string id;
122 
123  const std::string& read(const config& cfg);
124 
125  /** Activates a gui. */
126  void activate() const;
127 
128  typedef std::map<std::string /*control type*/,
129  std::map<std::string /*id*/, tcontrol_definition_ptr> >
131 
133 
134  std::map<std::string, twindow_definition> windows;
135 
136  std::map<std::string, twindow_builder> window_types;
137 
139  const std::string& definition_type,
140  const std::vector<tcontrol_definition_ptr>& definitions);
141 
142 private:
145  unsigned help_show_time_;
148 
149  std::string sound_button_click_;
152  std::string sound_slider_adjust_;
153 
155 
156  std::vector<ttip> tips_;
157 };
158 
159 /*WIKI
160  * @page = GUIToolkitWML
161  * @order = 1
162  *
163  * {{Autogenerated}}
164  *
165  * = GUI =
166  *
167  * The gui class contains the definitions of all widgets and windows used in
168  * the game. This can be seen as a skin and it allows the user to define the
169  * visual aspect of the various items. The visual aspect can be determined
170  * depending on the size of the game window.
171  *
172  * Widgets have a definition and an instance, the definition contains the
173  * general info/looks of a widget and the instance the actual looks. Eg the
174  * where the button text is placed is the same for every button, but the
175  * text of every button might differ.
176  *
177  * The default gui has the id ''default'' and must exist, in the default gui
178  * there must a definition of every widget with the id ''default'' and every
179  * window needs to be defined. If the definition of a widget with a certain
180  * id doesn't exist it will fall back to default in the current gui, if it's
181  * not defined there either it will fall back to the default widget in the
182  * default theme. That way it's possible to slowly create your own gui and
183  * test it.
184  *
185  * @begin{parent}{name="/"}
186  * @begin{tag}{name="gui"}{min="0"}{max="1"}
187  * The gui has the following data:
188  * @begin{table}{config}
189  * id & string & & Unique id for this gui (theme). $
190  * description & t_string & & Unique translatable name for this gui. $
191  *
192  * widget_definitions & section & & The definitions of all
193  * [[#widget_list|widgets]]. $
194  * window & section & & The definitions of all
195  * [[#window_list|windows]]. $
196  * settings & section & & The settings for the gui. $
197  * @end{table}
198  *
199  * <span id="widget_list"></span>List of available widgets:
200  * @begin{table}{widget_overview}
201  * Button & @macro = button_description $
202  * Image & @macro = image_description $
203  * Horizontal_listbox & @macro = horizontal_listbox_description $
204  * Horizontal_scrollbar & @macro = horizontal_scrollbar_description $
205  * Label & @macro = label_description $
206  * Listbox & @macro = listbox_description $
207  * Minimap & @macro = minimap_description $
208  * Multi_page & @macro = multi_page_description $
209  * Panel & @macro = panel_description $
210  * Password_box & A text box masking it's content by asterisks.
211  * $
212  * Repeating_button & @macro = repeating_button_description $
213  * Scroll_label & @macro = scroll_label_description $
214  * Slider & @macro = slider_description $
215  * Spacer & @macro = spacer_description $
216  * Stacked_widget &
217  * A stacked widget is a control several widgets can be stacked on top of
218  * each other in the same space. This is mainly intended for over- and
219  * underlays. (The widget is still experimental.) $
220  *
221  * Text_box & A single line text box. $
222  * Tree_view & @macro = tree_view_description $
223  * Toggle_button &
224  * A kind of button with two 'states' normal and selected. This is a more
225  * generic widget which is used for eg checkboxes and radioboxes. $
226  *
227  * Toggle_panel &
228  * Like a toggle button but then as panel so can hold multiple items in a
229  * grid. $
230  *
231  * Tooltip & A small tooltip with help. $
232  * Tree_view & A tree view widget. $
233  * Vertical_scrollbar & A vertical scrollbar. $
234  * Window & A window. $
235  * @end{table}
236  *
237  * <span id="window_list"></span>List of available windows:
238  * @begin{table}{window_overview}
239  * Addon_connect & The dialog to connect to the addon server
240  * and maintain locally installed addons. $
241  * Addon_list & Shows the list of the addons to install or
242  * update. $
243  * Campaign_selection & Shows the list of campaigns, to select one
244  * to play. $
245  * Language_selection & The dialog to select the primary language.
246  * $
247  * WML_message_left & The ingame message dialog with a portrait
248  * on the left side. (Used for the WML
249  * messages.) $
250  * WML_message_right & The ingame message dialog with a portrait
251  * on the right side. (Used for the WML
252  * messages.) $
253  * Message & A generic message dialog. $
254  * MP_connect & The dialog to connect to the MP server. $
255  * MP_method_selection & The dialog to select the kind of MP game
256  * to play. Official server, local etc. $
257  * MP_server_list & List of the 'official' MP servers. $
258  * MP_login & The dialog to provide a password for
259  * registered usernames, request a password
260  * reminder or choose a different username. $
261  * MP_cmd_wrapper & Perform various actions on the selected
262  * user (e.g. whispering or kicking). $
263  * MP_create_game & The dialog to select and create an MP
264  * game. $
265  * Title_screen & The title screen. $
266  * Editor_new_map & Creates a new map in the editor. $
267  * Editor_generate_map & Generates a random map in the editor. $
268  * Editor_resize_map & Resizes a map in the editor. $
269  * Editor_custom_tod & Creates new ToD schedules for the editor.
270  * $
271  * @end{table}
272  * @end{tag}{name=gui}
273  * @end{parent}{name="/"}
274  */
275 
276 /*WIKI
277  * @page = GUIToolkitWML
278  * @order = 1
279  *
280  * @begin{parent}{name="gui/"}
281  * @begin{tag}{name="settings"}{min="0"}{max="1"}
282  * A setting section has the following variables:
283  * @begin{table}{config}
284  * popup_show_delay & unsigned & 0 & The time it take before the popup shows
285  * if the mouse moves over the widget. 0
286  * means show directly. $
287  * popup_show_time & unsigned & 0 &
288  * The time a shown popup remains visible.
289  * 0 means until the mouse leaves the
290  * widget. $
291  * help_show_time & unsigned & 0 & The time a shown help remains visible.
292  * 0 means until the mouse leaves the
293  * widget. $
294  * double_click_time & unsigned & &
295  * The time between two clicks to still be
296  * a double click. $
297  * repeat_button_repeat_time & unsigned & 0 &
298  * The time a repeating button waits before
299  * the next event is issued if the button
300  * is still pressed down. $
301  *
302  * sound_button_click & string & "" &
303  * The sound played if a button is
304  * clicked. $
305  * sound_toggle_button_click & string & "" &
306  * The sound played if a toggle button is
307  * clicked. $
308  * sound_toggle_panel_click & string & "" &
309  * The sound played if a toggle panel is
310  * clicked. Normally the toggle panels
311  * are the items in a listbox. If a
312  * toggle button is in the listbox it's
313  * sound is played. $
314  * sound_slider_adjust & string & "" &
315  * The sound played if a slider is
316  * adjusted. $
317  *
318  * has_helptip_message & t_string & &
319  * The string used to append the tooltip
320  * if there is also a helptip. The WML
321  * variable @$hotkey can be used to get show
322  * the name of the hotkey for the help. $
323  * @end{table}
324  * @end{tag}{name="settings"}
325  */
326 
327 /*WIKI
328  * @begin{tag}{name="tip"}{min="0"}{max="-1"}
329  * @begin{table}{config}
330  * source & t_string & & Author
331  * text & t_string & & Text of the tip.
332  * @end{table}
333  * @end{tag}{name="tip"}
334  * @end{parent}{name="gui/"}
335  */
336 const std::string& tgui_definition::read(const config& cfg)
337 {
338  id = cfg["id"].str();
339  description = cfg["description"];
340 
341  VALIDATE(!id.empty(), missing_mandatory_wml_key("gui", "id"));
343  missing_mandatory_wml_key("gui", "description"));
344 
345  DBG_GUI_P << "Parsing gui " << id << '\n';
346 
347  /***** Control definitions *****/
348 
349  for(auto & widget_type : registred_widget_type())
350  {
351  widget_type.second(*this, widget_type.first, cfg, nullptr);
352  }
353 
354  /***** Window types *****/
355  for(const auto & w : cfg.child_range("window"))
356  {
357  std::pair<std::string, twindow_builder> child;
358  child.first = child.second.read(w);
359  window_types.insert(child);
360  }
361 
362  if(id == "default") {
363  // The default gui needs to define all window types since we're the
364  // fallback in case another gui doesn't define the window type.
365  for(std::vector<std::string>::const_iterator itor
366  = registered_window_types().begin();
367  itor != registered_window_types().end();
368  ++itor) {
369 
370  const std::string error_msg(
371  "Window not defined in WML: '" + *itor
372  + "'. Perhaps a mismatch between data and source versions."
373  " Try --data-dir <trunk-dir>");
374  VALIDATE(window_types.find(*itor) != window_types.end(), error_msg);
375  }
376  }
377 
378  /***** settings *****/
379 
380  /**
381  * @todo Regarding sounds:
382  * Need to evaluate but probably we want the widget definition be able to:
383  * - Override the default (and clear it). This will allow toggle buttons in
384  * a
385  * listbox to sound like a toggle panel.
386  * - Override the default and above per instance of the widget, some buttons
387  * can give a different sound.
388  */
389  const config& settings = cfg.child("settings");
390 
391  popup_show_delay_ = settings["popup_show_delay"];
392  popup_show_time_ = settings["popup_show_time"];
393  help_show_time_ = settings["help_show_time"];
394  double_click_time_ = settings["double_click_time"];
395 
396  repeat_button_repeat_time_ = settings["repeat_button_repeat_time"];
397 
399  missing_mandatory_wml_key("settings", "double_click_time"));
400 
401  sound_button_click_ = settings["sound_button_click"].str();
402  sound_toggle_button_click_ = settings["sound_toggle_button_click"].str();
403  sound_toggle_panel_click_ = settings["sound_toggle_panel_click"].str();
404  sound_slider_adjust_ = settings["sound_slider_adjust"].str();
405 
406  has_helptip_message_ = settings["has_helptip_message"];
407 
409  missing_mandatory_wml_key("[settings]", "has_helptip_message"));
410 
411  tips_ = tips::load(cfg);
412 
413  return id;
414 }
415 
417 {
429 }
430 
432  const std::string& definition_type,
433  const std::vector<tcontrol_definition_ptr>& definitions)
434 {
435  for(const auto & def : definitions)
436  {
437 
438  // We assume all definitions are unique if not we would leak memory.
439  assert(control_definition[definition_type].find(def->id)
440  == control_definition[definition_type].end());
441 
442  control_definition[definition_type]
443  .insert(std::make_pair(def->id, def));
444  }
445 
446  utils::string_map symbols;
447  symbols["definition"] = definition_type;
448  symbols["id"] = "default";
449  t_string msg(vgettext("Widget definition '$definition' "
450  "doesn't contain the definition for '$id'.",
451  symbols));
452 
453  VALIDATE(control_definition[definition_type].find("default")
454  != control_definition[definition_type].end(),
455  msg);
456 }
457 
458 /** Map with all known windows, (the builder class builds a window). */
459 static std::map<std::string, twindow_builder> windows;
460 
461 /** Map with all known guis. */
462 static std::map<std::string, tgui_definition> guis;
463 
464 /** Points to the current gui. */
465 static std::map<std::string, tgui_definition>::const_iterator current_gui = guis.end();
466 
467 void register_window(const std::string& id)
468 {
472  id);
473 
474  if(itor == registered_window_types().end()) {
475  registered_window_types().push_back(id);
476  }
477 }
478 
480 {
482 }
483 
485 {
486  LOG_GUI_G << "Setting: init gui.\n";
487 
488  // Init.
490 
491  // Read file.
492  config cfg;
493  try
494  {
496  filesystem::get_wml_location("gui/schema.cfg"));
497  preproc_map preproc(
498  game_config::config_cache::instance().get_preproc_map());
500  filesystem::get_wml_location("gui/default.cfg"), &preproc);
501 
502  read(cfg, *stream, &validator);
503  }
504  catch(config::error& e)
505  {
506  ERR_GUI_P << e.what() << '\n';
507  ERR_GUI_P << "Setting: could not read file 'data/gui/default.cfg'."
508  << std::endl;
509  }
510  catch(const abstract_validator::error& e)
511  {
512  ERR_GUI_P << "Setting: could not read file 'data/gui/schema.cfg'."
513  << std::endl;
514  ERR_GUI_P << e.message;
515  }
516  // Parse guis
517  for(const auto & g : cfg.child_range("gui"))
518  {
519  std::pair<std::string, tgui_definition> child;
520  child.first = child.second.read(g);
521  guis.insert(child);
522  }
523 
524  VALIDATE(guis.find("default") != guis.end(), _("No default gui defined."));
525 
526  current_gui = guis.find("default");
527  current_gui->second.activate();
528 }
529 
530 /*WIKI
531  * @page = GUIToolkitWML
532  * @order = 1_widget
533  *
534  * == State ==
535  *
536  * @begin{parent}{name="generic/"}
537  * @begin{tag}{name="state"}{min=0}{max=1}
538  * Definition of a state. A state contains the info what to do in a state.
539  * Atm this is rather focused on the drawing part, might change later.
540  * Keys:
541  * @begin{table}{config}
542  * draw & section & & Section with drawing directions for a
543  *canvas. $
544  * @end{table}
545  * @end{tag}{name="state"}
546  * @end{parent}{name="generic/"}
547  *
548  */
550 {
551  const config& draw = *(cfg ? &cfg.child("draw") : &cfg);
552 
553  VALIDATE(draw, _("No state or draw section defined."));
554 
555  canvas.set_cfg(draw);
556 }
557 
558 void register_widget(const std::string& id,
559  std::function<void(tgui_definition& gui_definition,
560  const std::string& definition_type,
561  const config& cfg,
562  const char* key)> functor)
563 {
564  registred_widget_type().insert(std::make_pair(id, functor));
565 }
566 
567 void
569  const std::string& definition_type,
570  const std::vector<tcontrol_definition_ptr>& definitions)
571 {
572  DBG_GUI_P << "Load definition '" << definition_type << "'.\n";
573  gui_definition.load_widget_definitions(definition_type, definitions);
574 }
575 
576 tresolution_definition_ptr get_control(const std::string& control_type,
577  const std::string& definition)
578 {
579  const tgui_definition::tcontrol_definition_map::const_iterator
580 #ifdef GUI2_EXPERIMENTAL_LISTBOX
581  control_definition
582  = (control_type == "list")
583  ? current_gui->second.control_definition.find("listbox")
584  : current_gui->second.control_definition.find(
585  control_type);
586 #else
587  control_definition
588  = current_gui->second.control_definition.find(control_type);
589 #endif
590 
591  ASSERT_LOG(control_definition
592  != current_gui->second.control_definition.end(),
593  "Type '" << control_type << "' is unknown.");
594 
595  std::map<std::string, tcontrol_definition_ptr>::const_iterator control
596  = control_definition->second.find(definition);
597 
598  if(control == control_definition->second.end()) {
599  LOG_GUI_G << "Control: type '" << control_type << "' definition '"
600  << definition << "' not found, falling back to 'default'.\n";
601  control = control_definition->second.find("default");
602  assert(control != control_definition->second.end());
603  }
604 
605  for(std::vector<tresolution_definition_ptr>::const_iterator itor
606  = (*control->second).resolutions.begin(),
607  end = (*control->second).resolutions.end();
608  itor != end;
609  ++itor) {
610 
611  if(settings::screen_width <= (**itor).window_width
612  && settings::screen_height <= (**itor).window_height) {
613 
614  return *itor;
615  } else if(itor == end - 1) {
616  return *itor;
617  }
618  }
619 
620  ERROR_LOG(false);
621 }
622 
623 std::vector<twindow_builder::tresolution>::const_iterator
624 get_window_builder(const std::string& type)
625 {
627 
628  std::map<std::string, twindow_builder>::const_iterator window
629  = current_gui->second.window_types.find(type);
630 
631  if(true) { // FIXME Test for default gui.
632  if(window == current_gui->second.window_types.end()) {
634  }
635  } else {
636  // FIXME Get the definition in the default gui and do an assertion test.
637  }
638 
639  for(std::vector<twindow_builder::tresolution>::const_iterator itor
640  = window->second.resolutions.begin(),
641  end = window->second.resolutions.end();
642  itor != end;
643  ++itor) {
644 
645  if(settings::screen_width <= itor->window_width
646  && settings::screen_height <= itor->window_height) {
647 
648  return itor;
649  } else if(itor == end - 1) {
650  return itor;
651  }
652  }
653 
654  ERROR_LOG(false);
655 }
656 
657 /*WIKI
658  * @page = GUIWidgetDefinitionWML
659  * @order = ZZZZZZ_footer
660  *
661  * [[Category: WML Reference]]
662  * [[Category: GUI WML Reference]]
663  *
664  */
665 
666 } // namespace gui2
Define the common log macros for the gui toolkit.
std::map< std::string, twindow_builder > window_types
Definition: settings.cpp:136
bool new_widgets
Do we wish to use the new library or not.
Definition: settings.cpp:40
#define DBG_GUI_P
Definition: log.hpp:69
child_itors child_range(const std::string &key)
Definition: config.cpp:613
std::string sound_button_click_
Definition: settings.cpp:149
static config_cache & instance()
Get reference to the singleton object.
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
Definition: glew.h:1806
unsigned double_click_time
Definition: settings.cpp:55
const char * what() const
Definition: exceptions.hpp:35
void register_window(const std::string &id)
Registers a window.
Definition: settings.cpp:467
unsigned help_show_time_
Definition: settings.cpp:145
std::string sound_toggle_button_click_
Definition: settings.cpp:150
Add a special kind of assert to validate whether the input from WML doesn't contain any problems that...
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1221
itor second functor(surf, f[1])
This file contains the window object, this object is a top level container which has the event manage...
std::vector< ttip > load(const config &cfg)
Loads the tips from a config.
Definition: tips.cpp:36
std::string sound_button_click
Definition: settings.cpp:58
static std::map< std::string, twindow_builder > windows
Map with all known windows, (the builder class builds a window).
Definition: settings.cpp:459
tcontrol_definition_map control_definition
Definition: settings.cpp:132
static void update_screen_size()
Update the size of the screen variables in settings.
Definition: window.cpp:459
tstate_definition(const config &cfg)
Definition: settings.cpp:549
std::string sound_toggle_panel_click_
Definition: settings.cpp:151
t_string has_helptip_message_
Definition: settings.cpp:154
#define ERROR_LOG(a)
Definition: asserts.hpp:42
GLboolean GLboolean g
Definition: glew.h:7319
static std::vector< std::string > get_registered_window_list()
Returns a copy of the list of registered windows.
Definition: settings.cpp:479
void activate() const
Activates a gui.
Definition: settings.cpp:416
unsigned gamemap_width
The size of the map area, if not available equal to the screen size.
Definition: settings.cpp:49
static tregistered_widget_type & registred_widget_type()
Definition: settings.cpp:92
std::map< std::string, twindow_definition > windows
Definition: settings.cpp:134
std::string sound_slider_adjust
Definition: settings.cpp:61
Helper struct to signal that get_window_builder failed.
Definition: settings.hpp:142
std::map< std::string, preproc_define > preproc_map
std::string missing_mandatory_wml_key(const std::string &section, const std::string &key, const std::string &primary_key, const std::string &primary_value)
Returns a standard message for a missing wml key.
#define ERR_GUI_P
Definition: log.hpp:72
std::map< std::string, std::function< void(tgui_definition &, const std::string &, const config &, const char *key)> > tregistered_widget_type
Definition: settings.cpp:90
void load_widget_definitions(tgui_definition &gui_definition, const std::string &definition_type, const std::vector< tcontrol_definition_ptr > &definitions)
Loads the definitions of a widget.
Definition: settings.cpp:568
A class inherited from ttext_box that displays its input as stars.
Definition: field-fwd.hpp:23
static std::vector< std::string > & registered_window_types()
Returns the list of registered windows.
Definition: settings.cpp:79
GLuint GLuint stream
Definition: glew.h:5239
One of the realizations of serialization/validator.hpp abstract validator.
void set_cfg(const config &cfg)
Sets the config.
Definition: canvas.hpp:105
unsigned repeat_button_repeat_time
Definition: settings.cpp:56
void register_widget(const std::string &id, std::function< void(tgui_definition &gui_definition, const std::string &definition_type, const config &cfg, const char *key)> functor)
Registers a widgets.
Definition: settings.cpp:558
unsigned double_click_time_
Definition: settings.cpp:146
static UNUSEDNOWARN std::string _(const char *str)
Definition: gettext.hpp:82
void load_widget_definitions(const std::string &definition_type, const std::vector< tcontrol_definition_ptr > &definitions)
Definition: settings.cpp:431
GLuint GLuint end
Definition: glew.h:1221
static std::map< std::string, tgui_definition > guis
Map with all known guis.
Definition: settings.cpp:462
GLuint64EXT * result
Definition: glew.h:10727
std::map< std::string, t_string > string_map
GLuint id
Definition: glew.h:1647
#define VALIDATE(cond, message)
The macro to use for the validation of WML.
This file contains the settings handling of the widget library.
t_string has_helptip_message
Definition: settings.cpp:63
Used to manage with not initialized validators Supposed to be thrown from the constructor.
Definition: validator.hpp:92
std::vector< ttip > shuffle(const std::vector< ttip > &tips)
Shuffles the tips.
Definition: tips.cpp:49
GLubyte GLubyte GLubyte GLubyte w
Definition: glew.h:1858
unsigned gamemap_height
Definition: settings.cpp:50
std::string sound_slider_adjust_
Definition: settings.cpp:152
std::vector< twindow_builder::tresolution >::const_iterator get_window_builder(const std::string &type)
Returns an interator to the requested builder.
Definition: settings.cpp:624
void draw(surface screen)
unsigned popup_show_delay_
Definition: settings.cpp:143
tresolution_definition_ptr get_control(const std::string &control_type, const std::string &definition)
Definition: settings.cpp:576
static std::map< std::string, tgui_definition >::const_iterator current_gui
Points to the current gui.
Definition: settings.cpp:465
const std::string & read(const config &cfg)
Definition: settings.cpp:336
#define ASSERT_LOG(a, b)
Definition: asserts.hpp:49
std::map< std::string, tfilter >::iterator itor
Definition: filter.cpp:199
#define LOG_GUI_G
Definition: log.hpp:42
std::string get_wml_location(const std::string &filename, const std::string &current_dir=std::string())
Returns a complete path to the actual WML file or directory or an empty string if the file isn't pres...
Contains the general settings which have a default.
Definition: settings.cpp:27
unsigned gamemap_x_offset
The offset between the left edge of the screen and the gamemap.
Definition: settings.cpp:47
unsigned popup_show_time
Definition: settings.cpp:53
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
Definition: debugger.cpp:112
std::vector< ttip > tips_
Definition: settings.cpp:156
unsigned screen_width
The screen resolution should be available for all widgets since their drawing method will depend on i...
Definition: settings.cpp:44
Declarations for File-IO.
void read(config &cfg, std::istream &in, abstract_validator *validator)
Definition: parser.cpp:400
std::string sound_toggle_panel_click
Definition: settings.cpp:60
std::string vgettext(const char *msgid, const utils::string_map &symbols)
std::istream * preprocess_file(std::string const &fname, preproc_map *defines)
void load_settings()
Loads the setting for the theme.
Definition: settings.cpp:484
unsigned popup_show_delay
These are copied from the active gui.
Definition: settings.cpp:52
unsigned screen_height
Definition: settings.cpp:45
bool find(E event, F functor)
Tests whether an event handler is available.
config & child(const std::string &key, int n=0)
Returns the nth child with the given key, or a reference to an invalid config if there is none...
Definition: config.cpp:658
unsigned repeat_button_repeat_time_
Definition: settings.cpp:147
std::string message
Definition: exceptions.hpp:29
unsigned popup_show_time_
Definition: settings.cpp:144
#define e
Realization of serialization/validator.hpp abstract validator.
std::string::const_iterator iterator
Definition: tokenizer.hpp:21
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
std::string sound_toggle_button_click
Definition: settings.cpp:59
std::vector< ttip > get_tips()
Definition: settings.cpp:67
std::map< std::string, std::map< std::string, tcontrol_definition_ptr > > tcontrol_definition_map
Definition: settings.cpp:130
GLsizei const GLcharARB ** string
Definition: glew.h:4503
bool empty() const
Definition: tstring.hpp:166
static std::vector< ttip > tips
Definition: settings.cpp:65
unsigned help_show_time
Definition: settings.cpp:54