The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
command_executor.cpp
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 #include "command_executor.hpp"
16 #include "hotkey_item.hpp"
17 
19 #include "gui/dialogs/message.hpp"
22 #include "gui/widgets/window.hpp"
23 #include "wml_separators.hpp"
24 #include "filesystem.hpp"
25 #include "construct_dialog.hpp"
26 #include "gettext.hpp"
27 #include "log.hpp"
28 #include "preferences.hpp"
29 #include "game_end_exceptions.hpp"
30 #include "display.hpp"
31 #include "quit_confirmation.hpp"
32 
33 #include "utils/functional.hpp"
34 
35 #include <cassert>
36 
37 static lg::log_domain log_config("config");
38 #define ERR_G LOG_STREAM(err, lg::general())
39 #define WRN_G LOG_STREAM(warn, lg::general())
40 #define LOG_G LOG_STREAM(info, lg::general())
41 #define DBG_G LOG_STREAM(debug, lg::general())
42 #define ERR_CF LOG_STREAM(err, log_config)
43 
44 namespace {
45 
46 bool screenshot(const std::string& filename, CVideo& video)
47 {
48  return image::save_image(video.getSurface(), filename);
49 }
50 
51 template<typename TFunc>
52 void make_screenshot(const std::string& name, CVideo& video, const TFunc& func)
53 {
54  std::string filename = filesystem::get_screenshot_dir() + "/" + name + "_";
55 #ifdef HAVE_LIBPNG
56  const std::string ext = ".png";
57 #else
58  const std::string ext = ".bmp";
59 #endif
60  filename = filesystem::get_next_filename(filename, ext);
61  const bool res = func(filename, video);
62  if (res) {
64  } else {
66  _("Screenshot creation failed.\n\n"
67  "Make sure there is enough space on the drive holding Wesnoth’s player resource files and that file permissions are set up correctly."));
68  }
69 }
70 }
71 namespace hotkey {
72 
73 static void event_execute(const SDL_Event& event, command_executor* executor);
74 
75 bool command_executor::execute_command(const hotkey_command& cmd, int /*index*/, bool press)
76 {
77  // hotkey release handling
78  if (!press) {
79  switch(cmd.id) {
80  // release a scroll key, un-apply scrolling in the given direction
81  case HOTKEY_SCROLL_UP:
82  scroll_up(false);
83  break;
84  case HOTKEY_SCROLL_DOWN:
85  scroll_down(false);
86  break;
87  case HOTKEY_SCROLL_LEFT:
88  scroll_left(false);
89  break;
91  scroll_right(false);
92  break;
93  default:
94  return false; // nothing else handles a hotkey release
95  }
96 
97  return true;
98  }
99 
100  // hotkey press handling
101  switch(cmd.id) {
102  case HOTKEY_SCROLL_UP:
103  scroll_up(true);
104  break;
105  case HOTKEY_SCROLL_DOWN:
106  scroll_down(true);
107  break;
108  case HOTKEY_SCROLL_LEFT:
109  scroll_left(true);
110  break;
111  case HOTKEY_SCROLL_RIGHT:
112  scroll_right(true);
113  break;
114  case HOTKEY_CYCLE_UNITS:
115  cycle_units();
116  break;
119  break;
120  case HOTKEY_ENDTURN:
121  end_turn();
122  break;
125  break;
127  end_unit_turn();
128  break;
129  case HOTKEY_LEADER:
130  goto_leader();
131  break;
132  case HOTKEY_UNDO:
133  undo();
134  break;
135  case HOTKEY_REDO:
136  redo();
137  break;
140  break;
143  break;
144  case HOTKEY_RENAME_UNIT:
145  rename_unit();
146  break;
147  case HOTKEY_SAVE_GAME:
148  save_game();
149  break;
150  case HOTKEY_SAVE_REPLAY:
151  save_replay();
152  break;
153  case HOTKEY_SAVE_MAP:
154  save_map();
155  break;
156  case HOTKEY_LOAD_GAME:
157  load_game();
158  break;
160  toggle_ellipses();
161  break;
162  case HOTKEY_TOGGLE_GRID:
163  toggle_grid();
164  break;
165  case HOTKEY_STATUS_TABLE:
166  status_table();
167  break;
168  case HOTKEY_RECALL:
169  recall();
170  break;
172  label_settings();
173  break;
174  case HOTKEY_RECRUIT:
175  recruit();
176  break;
178  repeat_recruit();
179  break;
180  case HOTKEY_SPEAK:
181  speak();
182  break;
183  case HOTKEY_SPEAK_ALLY:
184  whisper();
185  break;
186  case HOTKEY_SPEAK_ALL:
187  shout();
188  break;
189  case HOTKEY_CREATE_UNIT:
190  create_unit();
191  break;
192  case HOTKEY_CHANGE_SIDE:
193  change_side();
194  break;
195  case HOTKEY_KILL_UNIT:
196  kill_unit();
197  break;
198  case HOTKEY_PREFERENCES:
199  preferences();
200  break;
201  case HOTKEY_OBJECTIVES:
202  objectives();
203  break;
204  case HOTKEY_UNIT_LIST:
205  unit_list();
206  break;
207  case HOTKEY_STATISTICS:
208  show_statistics();
209  break;
210  case HOTKEY_STOP_NETWORK:
211  stop_network();
212  break;
214  start_network();
215  break;
217  label_terrain(true);
218  break;
220  label_terrain(false);
221  break;
222  case HOTKEY_CLEAR_LABELS:
223  clear_labels();
224  break;
226  show_enemy_moves(false);
227  break;
229  show_enemy_moves(true);
230  break;
231  case HOTKEY_DELAY_SHROUD:
233  break;
236  break;
238  continue_move();
239  break;
240  case HOTKEY_SEARCH:
241  search();
242  break;
243  case HOTKEY_HELP:
244  show_help();
245  break;
246  case HOTKEY_CHAT_LOG:
247  show_chat_log();
248  break;
249  case HOTKEY_USER_CMD:
250  user_command();
251  break;
252  case HOTKEY_CUSTOM_CMD:
253  custom_command();
254  break;
255  case HOTKEY_AI_FORMULA:
256  ai_formula();
257  break;
258  case HOTKEY_CLEAR_MSG:
259  clear_messages();
260  break;
261  case HOTKEY_LANGUAGE:
262  change_language();
263  break;
264  case HOTKEY_REPLAY_PLAY:
265  play_replay();
266  break;
267  case HOTKEY_REPLAY_RESET:
268  reset_replay();
269  break;
270  case HOTKEY_REPLAY_STOP:
271  stop_replay();
272  break;
275  break;
278  break;
281  break;
284  break;
287  break;
290  break;
293  break;
294  case HOTKEY_REPLAY_EXIT:
295  replay_exit();
296  break;
297  case HOTKEY_WB_TOGGLE:
299  break;
302  break;
305  break;
308  break;
311  break;
314  break;
317  break;
318  case HOTKEY_SELECT_HEX:
319  select_hex();
320  break;
321  case HOTKEY_DESELECT_HEX:
322  deselect_hex();
323  break;
324  case HOTKEY_MOVE_ACTION:
325  move_action();
326  break;
329  break;
330  case HOTKEY_ACCELERATED:
332  break;
333  case LUA_CONSOLE:
334  lua_console();
335  break;
336  case HOTKEY_ZOOM_IN:
337  zoom_in();
338  break;
339  case HOTKEY_ZOOM_OUT:
340  zoom_out();
341  break;
342  case HOTKEY_ZOOM_DEFAULT:
343  zoom_default();
344  break;
346  map_screenshot();
347  break;
350  break;
351  case HOTKEY_QUIT_GAME:
353  break;
354  default:
355  return false;
356  }
357  return true;
358 }
359 
360 
361 void command_executor::show_menu(const std::vector<std::string>& items_arg, int xloc, int yloc, bool /*context_menu*/, display& gui)
362 {
363  std::vector<std::string> items = items_arg;
364  if (items.empty()) return;
365 
366  std::vector<std::string> menu = get_menu_images(gui, items);
367  int res = 0;
368  {
369  gui::dialog mmenu = gui::dialog(gui.video(),"","",
371  mmenu.set_menu(menu);
372  res = mmenu.show(xloc, yloc);
373  } // This will kill the dialog.
374  if (res < 0 || size_t(res) >= items.size()) return;
375 
376  const theme::menu* submenu = gui.get_theme().get_menu_item(items[res]);
377  if (submenu) {
378  int y,x;
379  SDL_GetMouseState(&x,&y);
380  this->show_menu(submenu->items(), x, y, submenu->is_context(), gui);
381  } else {
382  const hotkey::hotkey_command& cmd = hotkey::get_hotkey_command(items[res]);
383  hotkey::execute_command(cmd,this,res);
385  }
386 }
387 
388 void command_executor::execute_action(const std::vector<std::string>& items_arg, int /*xloc*/, int /*yloc*/, bool /*context_menu*/, display&)
389 {
390  std::vector<std::string> items = items_arg;
391  if (items.empty()) {
392  return;
393  }
394 
395  std::vector<std::string>::iterator i = items.begin();
396  while(i != items.end()) {
397  const hotkey_command &command = hotkey::get_hotkey_command(*i);
398  if (can_execute_command(command)) {
399  hotkey::execute_command(command, this);
401  }
402  ++i;
403  }
404 }
405 
407 
408  const std::string base_image_name = "icons/action/" + command + "_25.png";
409  const std::string pressed_image_name = "icons/action/" + command + "_25-pressed.png";
410 
411  const hotkey::HOTKEY_COMMAND hk = hotkey::get_id(command);
412  const hotkey::ACTION_STATE state = get_action_state(hk, index);
413 
414  const theme::menu* menu = disp.get_theme().get_menu_item(command);
415  if (menu) {
416  return "icons/arrows/short_arrow_right_25.png~CROP(3,3,18,18)"; // TODO should not be hardcoded
417  }
418 
419  if (filesystem::file_exists(game_config::path + "/images/" + base_image_name)) {
420  switch (state) {
421  case ACTION_ON:
422  case ACTION_SELECTED:
423  return pressed_image_name + "~CROP(3,3,18,18)";
424  default:
425  return base_image_name + "~CROP(3,3,18,18)";
426  }
427  }
428 
429  switch (get_action_state(hk, index)) {
430  case ACTION_ON:
432  case ACTION_OFF:
434  case ACTION_SELECTED:
436  case ACTION_DESELECTED:
438  default: return get_action_image(hk, index);
439  }
440 }
441 
442 std::vector<std::string> command_executor::get_menu_images(display& disp, const std::vector<std::string>& items) {
443  std::vector<std::string> result;
444  bool has_image = false;
445 
446  for (size_t i = 0; i < items.size(); ++i) {
447  std::string const& item = items[i];
448  const hotkey::HOTKEY_COMMAND hk = hotkey::get_id(item);
449 
450  std::stringstream str;
451  //see if this menu item has an associated image
452  std::string img(get_menu_image(disp, item, i));
453  if (img.empty() == false) {
454  has_image = true;
455  str << IMAGE_PREFIX << img << COLUMN_SEPARATOR;
456  }
457 
458  const theme::menu* menu = disp.get_theme().get_menu_item(item);
459  if (hk == hotkey::HOTKEY_NULL) {
460  if (menu)
461  str << menu->title();
462  else
463  str << item.substr(0, item.find_last_not_of(' ') + 1) << COLUMN_SEPARATOR;
464  } else {
465 
466  if (menu)
467  str << menu->title();
468  else {
470  if (hk == HOTKEY_ENDTURN) {
471  const theme::action *b = disp.get_theme().get_action_item("button-endturn");
472  if (b) {
473  desc = b->title();
474  }
475  }
476  str << desc << COLUMN_SEPARATOR << hotkey::get_names(item);
477  }
478  }
479 
480  result.push_back(str.str());
481  }
482  //If any of the menu items have an image, create an image column
483  if (has_image) {
484  for (std::vector<std::string>::iterator i = result.begin(); i != result.end(); ++i) {
485  if (*(i->begin()) != IMAGE_PREFIX) {
486  i->insert(i->begin(), COLUMN_SEPARATOR);
487  }
488  }
489  }
490  return result;
491 }
493 
494 void basic_handler::handle_event(const SDL_Event& event)
495 {
496 
497  switch (event.type) {
498  case SDL_KEYDOWN:
499  case SDL_KEYUP:
500  // If we're in a dialog we only want to handle items that are explicitly
501  // handled by the executor.
502  // If we're not in a dialog we can call the regular key event handler.
503  if (!gui::in_dialog()) {
504  key_event(event,exec_);
505  } else if (exec_ != nullptr) {
506  event_execute(event,exec_);
507  }
508  break;
509  case SDL_JOYBUTTONDOWN:
510  case SDL_JOYBUTTONUP:
511  if (!gui::in_dialog()) {
512  jbutton_event(event,exec_);
513  } else if (exec_ != nullptr) {
514  event_execute(event,exec_);
515  }
516  break;
517  case SDL_MOUSEBUTTONDOWN:
518  case SDL_MOUSEBUTTONUP:
519  if (!gui::in_dialog()) {
520  mbutton_event(event,exec_);
521  } else if (exec_ != nullptr) {
522  event_execute(event,exec_);
523  }
524  break;
525  }
526 }
527 
528 void mbutton_event(const SDL_Event& event, command_executor* executor)
529 {
530  event_execute(event, executor);
531 }
532 
533 void jbutton_event(const SDL_Event& event, command_executor* executor)
534 {
535  event_execute(event, executor);
536 }
537 
538 void jhat_event(const SDL_Event& event, command_executor* executor)
539 {
540  event_execute(event, executor);
541 }
542 
543 void key_event(const SDL_Event& event, command_executor* executor)
544 {
545  if (!executor) return;
546  event_execute(event,executor);
547 }
548 
549 static void event_execute( const SDL_Event& event, command_executor* executor)
550 {
551  if (!executor) return;
552  const hotkey_ptr hk = get_hotkey(event);
553  if (!hk->active() || hk->is_disabled()) {
554  return;
555  }
556 
557  bool press = event.type == SDL_KEYDOWN || event.type == SDL_JOYBUTTONDOWN || event.type == SDL_MOUSEBUTTONDOWN;
558 
559  execute_command(hotkey::get_hotkey_command(hk->get_command()), executor, -1, press);
560  executor->set_button_state();
561 }
562 
563 void execute_command(const hotkey_command& command, command_executor* executor, int index, bool press)
564 {
565  if (executor != nullptr) {
566  if (!executor->can_execute_command(command, index)
567  || executor->execute_command(command, index, press)) {
568  return;
569  }
570  }
571 
572  if (!press) {
573  return; // none of the commands here respond to a key release
574  }
575 
576  switch (command.id) {
577 
580  executor->recalculate_minimap();
581  break;
584  executor->recalculate_minimap();
585  break;
588  executor->recalculate_minimap();
589  break;
592  executor->recalculate_minimap();
593  break;
596  executor->recalculate_minimap();
597  break;
598  case HOTKEY_FULLSCREEN:
600  break;
601  case HOTKEY_SCREENSHOT:
602  make_screenshot(_("Screenshot"), executor->get_video(), &::screenshot);
603  break;
604  case HOTKEY_ANIMATE_MAP:
606  break;
607  case HOTKEY_MOUSE_SCROLL:
609  break;
610  case HOTKEY_MUTE:
611  {
612  // look if both is not playing
613  static struct before_muted_s
614  {
615  bool playing_sound,playing_music;
616  before_muted_s() : playing_sound(false),playing_music(false){}
617  } before_muted;
619  {
620  // then remember settings and mute both
621  before_muted.playing_sound = preferences::sound_on();
622  before_muted.playing_music = preferences::music_on();
623  preferences::set_sound(false);
624  preferences::set_music(false);
625  }
626  else
627  {
628  // then set settings before mute
629  preferences::set_sound(before_muted.playing_sound);
630  preferences::set_music(before_muted.playing_music);
631  }
632  }
633  break;
634  default:
635  DBG_G << "command_executor: unknown command number " << command.id << ", ignoring.\n";
636  break;
637  }
638 }
639 
641 {
642  display& disp = get_display();
643  for (const theme::menu& menu : disp.get_theme().menus()) {
644 
645  std::shared_ptr<gui::button> button = disp.find_menu_button(menu.get_id());
646  if (!button) continue;
647  bool enabled = false;
648  for (const std::string& command : menu.items()) {
649 
650  const hotkey::hotkey_command& command_obj = hotkey::get_hotkey_command(command);
651  bool can_execute = can_execute_command(command_obj);
652  if (can_execute) {
653  enabled = true;
654  break;
655  }
656  }
657  button->enable(enabled);
658  }
659 
660  for (const theme::action& action : disp.get_theme().actions()) {
661 
662  std::shared_ptr<gui::button> button = disp.find_action_button(action.get_id());
663  if (!button) continue;
664  bool enabled = false;
665  int i = 0;
666  for (const std::string& command : action.items()) {
667 
668  const hotkey::hotkey_command& command_obj = hotkey::get_hotkey_command(command);
669  std::string tooltip = action.tooltip(i);
670  if (filesystem::file_exists(game_config::path + "/images/icons/action/" + command + "_25.png" ))
671  button->set_overlay("icons/action/" + command);
672  if (!tooltip.empty())
673  button->set_tooltip_string(tooltip);
674 
675  bool can_execute = can_execute_command(command_obj);
676  i++;
677  if (!can_execute) continue;
678  enabled = true;
679 
680  ACTION_STATE state = get_action_state(command_obj.id, -1);
681  switch (state) {
682  case ACTION_SELECTED:
683  case ACTION_ON:
684  button->set_check(true);
685  break;
686  case ACTION_OFF:
687  case ACTION_DESELECTED:
688  button->set_check(false);
689  break;
690  case ACTION_STATELESS:
691  break;
692  default:
693  break;
694  }
695 
696  break;
697  }
698  button->enable(enabled);
699  }
700 }
701 
703 {
705 }
707 {
708  return get_display().video();
709 }
711 {
712  if (get_display().in_game()) {
714  } else {
716  }
717 
718 }
720 {
722 }
723 
725 {
727 }
729 {
731 }
733 {
735 }
737 {
738  make_screenshot(_("Map-Screenshot"), get_video(), boost::bind(&display::screenshot, &get_display(), _1, true));
739 }
740 }
std::shared_ptr< gui::button > find_action_button(const std::string &id)
Retrieves a pointer to a theme UI button.
Definition: display.cpp:826
bool set_sound(bool ison)
virtual void toggle_shroud_updates()
void show_error_message(CVideo &video, const std::string &message, bool message_use_markup)
Shows an error message to the user.
Definition: message.cpp:198
const std::string & title() const
Definition: theme.hpp:239
virtual ACTION_STATE get_action_state(hotkey::HOTKEY_COMMAND, int) const
std::string get_next_filename(const std::string &name, const std::string &extension)
Get the next free filename using "name + number (3 digits) + extension" maximum 1000 files then start...
GLenum GLsizei const GLuint GLboolean enabled
Definition: glew.h:2497
theme & get_theme()
Definition: display.hpp:385
static void display(CVideo &video, lua_kernel_base *lk)
Display a new console, using given video and lua kernel.
static void quit_to_title()
void handle_event(const SDL_Event &event)
void set_default_zoom()
Sets the zoom amount to the default.
Definition: display.cpp:2326
Definition: video.hpp:58
bool in_dialog()
Definition: show_dialog.cpp:57
This file contains the window object, this object is a top level container which has the event manage...
std::string selected_menu
General purpose widgets.
void enable_mouse_scroll(bool value)
Stores all information related to functions that can be bound to hotkeys.
virtual void terrain_description()
std::string get_screenshot_dir()
const std::vector< menu > & menus() const
Definition: theme.hpp:263
void mbutton_event(const SDL_Event &event, command_executor *executor)
std::string unchecked_menu
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1220
const std::vector< std::string > items
virtual void recalculate_minimap()
int show(int xloc, int yloc)
Contains the exception interfaces used to signal completion of a scenario, campaign or turn...
virtual void whiteboard_execute_action()
virtual void scroll_up(bool)
static void event_execute(const SDL_Event &event, command_executor *executor)
surface & getSurface()
Definition: dummy_video.cpp:22
bool sound_on()
virtual CVideo & get_video()=0
Keyboard shortcuts for game actions.
char const IMAGE_PREFIX
virtual void whiteboard_delete_action()
virtual bool can_execute_command(const hotkey_command &command, int index=-1) const =0
bool save_image(const locator &i_locator, const std::string &filename)
Definition: image.cpp:1249
virtual void whiteboard_bump_up_action()
virtual void label_terrain(bool)
std::vector< std::string > get_menu_images(display &, const std::vector< std::string > &items_arg)
static lg::log_domain log_config("config")
GLdouble GLdouble GLdouble b
Definition: glew.h:6966
static UNUSEDNOWARN std::string _(const char *str)
Definition: gettext.hpp:82
std::string deselected_menu
virtual display & get_display()=0
void execute_command(const hotkey_command &command, command_executor *executor, int index, bool press)
GLuint64EXT * result
Definition: glew.h:10727
virtual void replay_show_team1()
void jbutton_event(const SDL_Event &event, command_executor *executor)
void toggle_minimap_draw_units()
const hotkey_ptr get_hotkey(const SDL_Event &event)
Iterate through the list of hotkeys and return a hotkey that matches the SDL_Event and the current ke...
virtual void unit_hold_position()
void recalculate_minimap()
Schedule the minimap for recalculation.
Definition: display.hpp:623
bool fullscreen()
virtual void scroll_right(bool)
void set_menu(menu *const m)
virtual void show_enemy_moves(bool)
const menu * get_menu_item(const std::string &key) const
Definition: theme.cpp:945
std::string path
void toggle_minimap_draw_terrain()
map_display and display: classes which take care of displaying the map and game-data on the screen...
bool animate_map()
static const style hotkeys_style
void set_animate_map(bool value)
void jhat_event(const SDL_Event &event, command_executor *executor)
void toggle_minimap_draw_villages()
const std::string & title() const
Definition: theme.hpp:184
GLuint res
Definition: glew.h:9258
static void quit_to_desktop()
const std::vector< action > & actions() const
Definition: theme.hpp:265
virtual void scroll_left(bool)
virtual void update_shroud_now()
void toggle_minimap_terrain_coding()
void execute_action(const std::vector< std::string > &items_arg, int xloc, int yloc, bool context_menu, display &gui)
virtual void replay_show_everything()
GLuint index
Definition: glew.h:1782
std::string get_menu_image(display &disp, const std::string &command, int index=-1) const
bool music_on()
virtual void scroll_down(bool)
size_t i
Definition: function.cpp:1057
GLint GLint GLint GLint GLint x
Definition: glew.h:1220
void toggle_minimap_movement_coding()
void set_fullscreen(bool ison)
Definition: video.cpp:670
Declarations for File-IO.
std::string get_names(std::string id)
Returns a comma-separated string of hotkey names.
virtual void whiteboard_suppose_dead()
void key_event(const SDL_Event &event, command_executor *executor)
const action * get_action_item(const std::string &key) const
Definition: theme.cpp:953
const std::string & get_description(const std::string &command)
virtual void whiteboard_bump_down_action()
virtual bool execute_command(const hotkey_command &command, int index=-1, bool press=true)
command_executor * exec_
GLuint const GLchar * name
Definition: glew.h:1782
bool mouse_scroll_enabled()
const std::vector< std::string > & items() const
Definition: theme.hpp:247
char const COLUMN_SEPARATOR
cl_event event
Definition: glew.h:3070
const hotkey::HOTKEY_COMMAND id
the names are strange: the "hotkey::HOTKEY_COMMAND" is named id, and the string to identify the objec...
virtual void whiteboard_execute_all_actions()
virtual void show_menu(const std::vector< std::string > &items_arg, int xloc, int yloc, bool context_menu, display &gui)
GLint GLvoid * img
Definition: glew.h:1353
bool set_music(bool ison)
Standard logging facilities (interface).
CVideo & video()
Gets the underlying screen object.
Definition: display.hpp:202
#define DBG_G
bool is_context() const
Definition: theme.hpp:237
virtual std::string get_action_image(hotkey::HOTKEY_COMMAND, int) const
std::string checked_menu
std::string::const_iterator iterator
Definition: tokenizer.hpp:21
const hotkey_command & get_hotkey_command(const std::string &command)
returns the hotkey_command with the given name
bool file_exists(const std::string &name)
Returns true if a file or directory with such name already exists.
GLsizei const GLcharARB ** string
Definition: glew.h:4503
std::shared_ptr< gui::button > find_menu_button(const std::string &id)
Definition: display.cpp:836
HOTKEY_COMMAND get_id(const std::string &command)
returns get_hotkey_command(command).id
virtual void replay_skip_animation()
virtual void whiteboard_toggle()
bool set_zoom(int amount, bool absolute=false)
Zooms the display by the specified amount.
Definition: display.cpp:2285
static void display(const std::string &path, CVideo &video)
The display function.
basic_handler(command_executor *exec)
virtual void toggle_accelerated_speed()
bool screenshot(const std::string &filename, bool map_screenshot=false)
Save a (map-)screenshot and return whether the operation succeeded.
Definition: display.cpp:753