The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Public Attributes | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
editor::editor_controller Class Reference

The editor_controller class contains the mouse and keyboard event handling routines for the editor. More...

#include <editor_controller.hpp>

Inheritance diagram for editor::editor_controller:
Inheritance graph

Public Member Functions

 editor_controller (const config &game_config, CVideo &video)
 The constructor. More...
 
 ~editor_controller ()
 
EXIT_STATUS main_loop ()
 Editor main loop. More...
 
void do_screenshot (const std::string &screenshot_filename="map_screenshot.bmp")
 Takes a screenshot. More...
 
void hotkey_quit ()
 Process a hotkey quit command. More...
 
bool quit_confirm ()
 Show a quit confirmation dialog and returns true if the user pressed 'yes'. More...
 
void custom_tods_dialog ()
 Display the settings dialog, used to control e.g. More...
 
void save_map ()
 Save the map, open dialog if not named yet. More...
 
bool can_execute_command (const hotkey::hotkey_command &command, int index=-1) const
 command_executor override More...
 
hotkey::ACTION_STATE get_action_state (hotkey::HOTKEY_COMMAND command, int index) const
 command_executor override More...
 
bool execute_command (const hotkey::hotkey_command &command, int index=-1, bool press=true)
 command_executor override More...
 
void show_menu (const std::vector< std::string > &items_arg, int xloc, int yloc, bool context_menu, display &disp)
 controller_base override More...
 
void show_help ()
 
void status_table ()
 
void preferences ()
 Show the preferences dialog. More...
 
void scroll_up (bool on)
 Handle hotkeys to scroll map. More...
 
void scroll_down (bool on)
 
void scroll_left (bool on)
 
void scroll_right (bool on)
 
void toggle_grid ()
 Grid toggle. More...
 
void terrain_description ()
 
void unit_description ()
 
void change_unit_id ()
 
void rename_unit ()
 
void unit_list ()
 
void copy_selection ()
 Copy the selection on the current map to the clipboard. More...
 
void cut_selection ()
 Cut the selection from the current map to the clipboard. More...
 
void export_selection_coords ()
 Export the WML-compatible list of selected tiles to the system clipboard. More...
 
void update_mouse_action_highlights ()
 
void save_area ()
 Save the current selection to the active area. More...
 
void add_area ()
 Add a new area to the current context, filled with the selection if any. More...
 
void mouse_motion (int x, int y, const bool browse, bool update, map_location new_loc=map_location::null_location())
 Called when a mouse motion event takes place. More...
 
editor_displaygui ()
 Reference to the used display objects. More...
 
const editor_displaygui () const
 Const version. More...
 
bool allow_mouse_wheel_scroll (int x, int y)
 Derived classes can override this to disable mousewheel scrolling under some circumstances, e.g. More...
 
bool right_click_show_menu (int x, int y, const bool browse)
 Called in the default right_click when the context menu is about to be shown, can be used for preprocessing and preventing the menu from being displayed without rewriting the right click function. More...
 
bool left_click (int x, int y, const bool browse)
 Overridden in derived classes, called on a left click (mousedown). More...
 
void left_drag_end (int x, int y, const bool browse)
 Called whenever the left mouse drag has "ended". More...
 
void left_mouse_up (int x, int y, const bool browse)
 Called when the left mouse button is up. More...
 
bool right_click (int x, int y, const bool browse)
 Overridden in derived classes, called on a right click (mousedown). More...
 
void right_drag_end (int x, int y, const bool browse)
 Called whenever the right mouse drag has "ended". More...
 
void right_mouse_up (int x, int y, const bool browse)
 Called when the right mouse button is up. More...
 
virtual hotkey::command_executorget_hotkey_command_executor ()
 Get (optionally) a command executor to handle context menu events. More...
 
- Public Member Functions inherited from controller_base
 controller_base (const config &game_config, CVideo &video)
 
virtual ~controller_base ()
 
void play_slice (bool is_delay_enabled=true)
 
void apply_keyboard_scroll (int x, int y)
 
void set_scroll_up (bool on)
 
void set_scroll_down (bool on)
 
void set_scroll_left (bool on)
 
void set_scroll_right (bool on)
 
- Public Member Functions inherited from events::sdl_handler
virtual void process_event ()
 
virtual void draw ()
 
virtual void volatile_draw ()
 
virtual void volatile_undraw ()
 
virtual bool requires_event_focus (const SDL_Event *=nullptr) const
 
virtual void process_help_string (int, int)
 
virtual void process_tooltip_string (int, int)
 
virtual void join ()
 
virtual void join (context &c)
 
virtual void join_same (sdl_handler *parent)
 
virtual void leave ()
 
virtual void join_global ()
 
virtual void leave_global ()
 
- Public Member Functions inherited from hotkey::command_executor_default
CVideoget_video ()
 
void set_button_state ()
 
void recalculate_minimap ()
 
void lua_console ()
 
void zoom_in ()
 
void zoom_out ()
 
void zoom_default ()
 
void map_screenshot ()
 
void quit_to_main_menu ()
 
- Public Member Functions inherited from hotkey::command_executor
virtual void cycle_units ()
 
virtual void cycle_back_units ()
 
virtual void end_turn ()
 
virtual void goto_leader ()
 
virtual void unit_hold_position ()
 
virtual void end_unit_turn ()
 
virtual void save_game ()
 
virtual void save_replay ()
 
virtual void load_game ()
 
virtual void toggle_ellipses ()
 
virtual void recall ()
 
virtual void recruit ()
 
virtual void repeat_recruit ()
 
virtual void speak ()
 
virtual void whisper ()
 
virtual void shout ()
 
virtual void create_unit ()
 
virtual void change_side ()
 
virtual void kill_unit ()
 
virtual void objectives ()
 
virtual void show_statistics ()
 
virtual void stop_network ()
 
virtual void start_network ()
 
virtual void label_terrain (bool)
 
virtual void clear_labels ()
 
virtual void label_settings ()
 
virtual void show_enemy_moves (bool)
 
virtual void toggle_shroud_updates ()
 
virtual void update_shroud_now ()
 
virtual void continue_move ()
 
virtual void search ()
 
virtual void show_chat_log ()
 
virtual void user_command ()
 
virtual void custom_command ()
 
virtual void ai_formula ()
 
virtual void clear_messages ()
 
virtual void change_language ()
 
virtual void play_replay ()
 
virtual void reset_replay ()
 
virtual void stop_replay ()
 
virtual void replay_next_turn ()
 
virtual void replay_next_side ()
 
virtual void replay_next_move ()
 
virtual void replay_show_everything ()
 
virtual void replay_show_each ()
 
virtual void replay_show_team1 ()
 
virtual void replay_skip_animation ()
 
virtual void replay_exit ()
 
virtual void whiteboard_toggle ()
 
virtual void whiteboard_execute_action ()
 
virtual void whiteboard_execute_all_actions ()
 
virtual void whiteboard_delete_action ()
 
virtual void whiteboard_bump_up_action ()
 
virtual void whiteboard_bump_down_action ()
 
virtual void whiteboard_suppose_dead ()
 
virtual void select_hex ()
 
virtual void deselect_hex ()
 
virtual void move_action ()
 
virtual void select_and_action ()
 
virtual void left_mouse_click ()
 
virtual void right_mouse_click ()
 
virtual void toggle_accelerated_speed ()
 
virtual std::string get_action_image (hotkey::HOTKEY_COMMAND, int) const
 
std::string get_menu_image (display &disp, const std::string &command, int index=-1) const
 
std::vector< std::stringget_menu_images (display &, const std::vector< std::string > &items_arg)
 
void execute_action (const std::vector< std::string > &items_arg, int xloc, int yloc, bool context_menu, display &gui)
 
- Public Member Functions inherited from events::mouse_handler_base
 mouse_handler_base ()
 
virtual ~mouse_handler_base ()
 
bool is_dragging () const
 
virtual int drag_threshold () const
 
void mouse_motion_event (const SDL_MouseMotionEvent &event, const bool browse)
 
void mouse_update (const bool browse, map_location loc)
 update the mouse with a fake mouse motion More...
 
bool get_show_menu () const
 
bool mouse_motion_default (int x, int y, bool update)
 This handles minimap scrolling and click-drag. More...
 
virtual void mouse_press (const SDL_MouseButtonEvent &event, const bool browse)
 
bool is_left_click (const SDL_MouseButtonEvent &event) const
 
bool is_middle_click (const SDL_MouseButtonEvent &event) const
 
bool is_right_click (const SDL_MouseButtonEvent &event) const
 
virtual void mouse_wheel (int xscroll, int yscroll, bool browse)
 Called when scrolling with the mouse wheel. More...
 
virtual void move_action (bool browse)
 Overridden in derived class. More...
 
virtual void mouse_wheel_up (int x, int y, const bool browse)
 Called when the mouse wheel is scrolled up. More...
 
virtual void mouse_wheel_down (int x, int y, const bool browse)
 Called when the mouse wheel is scrolled down. More...
 
virtual void mouse_wheel_left (int x, int y, const bool browse)
 Called when the mouse wheel is scrolled left. More...
 
virtual void mouse_wheel_right (int x, int y, const bool browse)
 Called when the mouse wheel is scrolled right. More...
 
void set_scroll_start (int x, int y)
 Called when the middle click scrolling. More...
 
const map_location get_scroll_start ()
 
bool scroll_started ()
 

Public Attributes

boost::scoped_ptr
< context_manager
context_manager_
 

Protected Member Functions

void process_keyup_event (const SDL_Event &event)
 Process keyup (always). More...
 
mouse_handler_baseget_mouse_handler_base ()
 Get a reference to a mouse handler member a derived class uses. More...
 
editor_displayget_display ()
 Get a reference to a display member a derived class uses. More...
 
mouse_actionget_mouse_action ()
 Get the current mouse action. More...
 
void perform_delete (editor_action *action)
 Perform an action, then delete the action object. More...
 
void perform_refresh_delete (editor_action *action, bool drag_part=false)
 Peform an action on the current map_context, then refresh the display and delete the pointer. More...
 
virtual std::vector< std::stringadditional_actions_pressed () override
 
- Protected Member Functions inherited from controller_base
virtual bool is_browsing () const
 
virtual soundsource::managerget_soundsource_man ()
 Get (optionally) a soundsources manager a derived class uses. More...
 
virtual plugins_contextget_plugins_context ()
 Get (optionally) a plugins context a derived class uses. More...
 
virtual bool have_keyboard_focus ()
 Derived classes should override this to return false when arrow keys should not scroll the map, hotkeys not processed etc, for example when a textbox is active. More...
 
bool handle_scroll (int mousex, int mousey, int mouse_flags, double joystickx, double joysticky)
 Handle scrolling by keyboard, joystick and moving mouse near map edges. More...
 
void handle_event (const SDL_Event &event)
 Process mouse- and keypress-events from SDL. More...
 
void handle_window_event (const SDL_Event &)
 
virtual void process_focus_keydown_event (const SDL_Event &event)
 Process keydown (only when the general map display does not have focus). More...
 
virtual void process_keydown_event (const SDL_Event &event)
 Process keydown (always). More...
 
virtual void execute_action (const std::vector< std::string > &items_arg, int xloc, int yloc, bool context_menu)
 
virtual bool in_context_menu (hotkey::HOTKEY_COMMAND command) const
 
- Protected Member Functions inherited from video2::draw_layering
 draw_layering (const bool auto_join=true)
 
virtual ~draw_layering ()
 
- Protected Member Functions inherited from events::sdl_handler
 sdl_handler (const bool auto_join=true)
 
virtual ~sdl_handler ()
 
virtual std::vector
< sdl_handler * > 
handler_members ()
 
- Protected Member Functions inherited from hotkey::command_executor
virtual ~command_executor ()
 
- Protected Member Functions inherited from events::mouse_handler_base
void cancel_dragging ()
 
void clear_dragging (const SDL_MouseButtonEvent &event, bool browse)
 
void init_dragging (bool &dragging_flag)
 

Private Types

typedef std::map< std::string,
std::pair< std::string,std::vector
< time_of_day > > > 
tods_map
 Pre-defined time of day lighting settings for the settings dialog. More...
 

Private Member Functions

void init_gui ()
 init the display object and general set-up More...
 
void init_tods (const config &game_config)
 init the available time-of-day settings More...
 
void init_music (const config &game_config)
 init background music for the editor More...
 
void load_tooltips ()
 Load editor-specific tooltips. More...
 
void refresh_image_cache ()
 Reload images. More...
 
void display_redraw_callback (display &)
 Callback function passed to display to be called on each redraw_everything run. More...
 
void undo ()
 Undos an action in the current map context. More...
 
void redo ()
 Redos an action in the current map context. More...
 
- Private Member Functions inherited from quit_confirmation
 quit_confirmation (const std::function< bool()> &prompt=&quit_confirmation::default_prompt)
 
 ~quit_confirmation ()
 

Private Attributes

editor::menu_type active_menu_
 
boost::scoped_ptr< reportsreports_
 Reports object. More...
 
boost::scoped_ptr< editor_displaygui_
 The display object used and owned by the editor. More...
 
tods_map tods_
 
boost::scoped_ptr< editor_toolkittoolkit_
 
tooltips::manager tooltip_manager_
 
boost::scoped_ptr
< font::floating_label_context
floating_label_manager_
 
boost::scoped_ptr
< help::help_manager
help_manager_
 
bool do_quit_
 Quit main loop flag. More...
 
EXIT_STATUS quit_mode_
 
std::vector< sound::music_trackmusic_tracks_
 

Additional Inherited Members

- Static Public Member Functions inherited from controller_base
static const configget_theme (const config &game_config, std::string theme_name)
 
- Protected Attributes inherited from controller_base
const configgame_config_
 
CKey key_
 
bool scrolling_
 
bool scroll_up_
 
bool scroll_down_
 
bool scroll_left_
 
bool scroll_right_
 
joystick_manager joystick_manager_
 
- Protected Attributes inherited from events::mouse_handler_base
bool simple_warp_
 MMB click (on game map) state flag. More...
 
bool minimap_scrolling_
 minimap scrolling (scroll-drag) state flag More...
 
bool dragging_left_
 LMB drag init flag. More...
 
bool dragging_started_
 Actual drag flag. More...
 
bool dragging_right_
 RMB drag init flag. More...
 
int drag_from_x_
 Drag start position x. More...
 
int drag_from_y_
 Drag start position y. More...
 
map_location drag_from_hex_
 Drag start map location. More...
 
map_location last_hex_
 last highlighted hex More...
 
bool show_menu_
 Show context menu flag. More...
 
int scroll_start_x_
 Relative to middle click scrolling. More...
 
int scroll_start_y_
 
bool scroll_started_
 
- Static Protected Attributes inherited from hotkey::command_executor_default
static const int zoom_amount = 4
 
- Static Private Member Functions inherited from quit_confirmation
static bool quit ()
 Shows the quit confirmation if needed. More...
 
static void quit_to_title ()
 
static void quit_to_desktop ()
 
static bool show_prompt (const std::string &message)
 
static bool default_prompt ()
 

Detailed Description

The editor_controller class contains the mouse and keyboard event handling routines for the editor.

It also serves as the main editor class with the general logic.

Definition at line 68 of file editor_controller.hpp.

Member Typedef Documentation

typedef std::map<std::string, std::pair<std::string ,std::vector<time_of_day> > > editor::editor_controller::tods_map
private

Pre-defined time of day lighting settings for the settings dialog.

Definition at line 235 of file editor_controller.hpp.

Constructor & Destructor Documentation

editor::editor_controller::editor_controller ( const config game_config,
CVideo video 
)

The constructor.

A initial map context can be specified here, the controller will assume ownership and delete the pointer during destruction, but changes to the map can be retrieved between the main loop's end and the controller's destruction.

Definition at line 64 of file editor_controller.cpp.

References context_manager_, display::create_buttons(), controller_base::game_config_, gui(), gui_, help_manager_, init_gui(), init_music(), init_tods(), controller_base::key_, cursor::NORMAL, events::raise_draw_event(), display::redraw_everything(), cursor::set(), and toolkit_.

editor::editor_controller::~editor_controller ( )

Member Function Documentation

void editor::editor_controller::add_area ( )

Add a new area to the current context, filled with the selection if any.

Definition at line 1175 of file editor_controller.cpp.

References context_manager_.

Referenced by execute_command().

std::vector< std::string > editor::editor_controller::additional_actions_pressed ( )
overrideprotectedvirtual

Reimplemented from controller_base.

Definition at line 1396 of file editor_controller.cpp.

References toolkit_.

bool editor::editor_controller::allow_mouse_wheel_scroll ( int  x,
int  y 
)
virtual

Derived classes can override this to disable mousewheel scrolling under some circumstances, e.g.

when the mouse wheel controls something else, but the event is also received by this class

Reimplemented from events::mouse_handler_base.

Definition at line 1274 of file editor_controller.cpp.

References context_manager_, and gui().

bool editor::editor_controller::can_execute_command ( const hotkey::hotkey_command command,
int  index = -1 
) const
virtual

command_executor override

Implements hotkey::command_executor.

Definition at line 239 of file editor_controller.cpp.

References active_menu_, editor::AREA, context_manager_, unit_map::end(), unit_map::find(), gui(), gui_, hotkey::HOTKEY_ANIMATE_MAP, hotkey::HOTKEY_DELETE_UNIT, hotkey::HOTKEY_EDITOR_AREA_ADD, hotkey::HOTKEY_EDITOR_AREA_REMOVE, hotkey::HOTKEY_EDITOR_AREA_RENAME, hotkey::HOTKEY_EDITOR_AREA_SAVE, hotkey::HOTKEY_EDITOR_AUTO_UPDATE_TRANSITIONS, hotkey::HOTKEY_EDITOR_BRUSH_1, hotkey::HOTKEY_EDITOR_BRUSH_2, hotkey::HOTKEY_EDITOR_BRUSH_3, hotkey::HOTKEY_EDITOR_BRUSH_NEXT, hotkey::HOTKEY_EDITOR_BRUSH_NW_SE, hotkey::HOTKEY_EDITOR_BRUSH_SW_NE, hotkey::HOTKEY_EDITOR_CLIPBOARD_FLIP_HORIZONTAL, hotkey::HOTKEY_EDITOR_CLIPBOARD_FLIP_VERTICAL, hotkey::HOTKEY_EDITOR_CLIPBOARD_PASTE, hotkey::HOTKEY_EDITOR_CLIPBOARD_ROTATE_CCW, hotkey::HOTKEY_EDITOR_CLIPBOARD_ROTATE_CW, hotkey::HOTKEY_EDITOR_CUSTOM_TODS, hotkey::HOTKEY_EDITOR_DRAW_COORDINATES, hotkey::HOTKEY_EDITOR_DRAW_TERRAIN_CODES, hotkey::HOTKEY_EDITOR_LOCAL_TIME, hotkey::HOTKEY_EDITOR_MAP_APPLY_MASK, hotkey::HOTKEY_EDITOR_MAP_CLOSE, hotkey::HOTKEY_EDITOR_MAP_CREATE_MASK_TO, hotkey::HOTKEY_EDITOR_MAP_GENERATE, hotkey::HOTKEY_EDITOR_MAP_LOAD, hotkey::HOTKEY_EDITOR_MAP_NEW, hotkey::HOTKEY_EDITOR_MAP_RESIZE, hotkey::HOTKEY_EDITOR_MAP_REVERT, hotkey::HOTKEY_EDITOR_MAP_ROTATE, hotkey::HOTKEY_EDITOR_MAP_SAVE, hotkey::HOTKEY_EDITOR_MAP_SAVE_ALL, hotkey::HOTKEY_EDITOR_MAP_SAVE_AS, hotkey::HOTKEY_EDITOR_MAP_SWITCH, hotkey::HOTKEY_EDITOR_NO_UPDATE_TRANSITIONS, hotkey::HOTKEY_EDITOR_PALETTE_DOWNSCROLL, hotkey::HOTKEY_EDITOR_PALETTE_GROUPS, hotkey::HOTKEY_EDITOR_PALETTE_ITEM_SWAP, hotkey::HOTKEY_EDITOR_PALETTE_UPSCROLL, hotkey::HOTKEY_EDITOR_PARTIAL_UNDO, hotkey::HOTKEY_EDITOR_PARTIAL_UPDATE_TRANSITIONS, hotkey::HOTKEY_EDITOR_PLAYLIST, hotkey::HOTKEY_EDITOR_REFRESH, hotkey::HOTKEY_EDITOR_REFRESH_IMAGE_CACHE, hotkey::HOTKEY_EDITOR_REMOVE_LOCATION, hotkey::HOTKEY_EDITOR_SCENARIO_EDIT, hotkey::HOTKEY_EDITOR_SCENARIO_NEW, hotkey::HOTKEY_EDITOR_SCENARIO_SAVE_AS, hotkey::HOTKEY_EDITOR_SCHEDULE, hotkey::HOTKEY_EDITOR_SELECT_ALL, hotkey::HOTKEY_EDITOR_SELECT_INVERSE, hotkey::HOTKEY_EDITOR_SELECT_NONE, hotkey::HOTKEY_EDITOR_SELECTION_COPY, hotkey::HOTKEY_EDITOR_SELECTION_CUT, hotkey::HOTKEY_EDITOR_SELECTION_EXPORT, hotkey::HOTKEY_EDITOR_SELECTION_FILL, hotkey::HOTKEY_EDITOR_SELECTION_FLIP, hotkey::HOTKEY_EDITOR_SELECTION_GENERATE, hotkey::HOTKEY_EDITOR_SELECTION_RANDOMIZE, hotkey::HOTKEY_EDITOR_SELECTION_ROTATE, hotkey::HOTKEY_EDITOR_SIDE_EDIT, hotkey::HOTKEY_EDITOR_SIDE_NEW, hotkey::HOTKEY_EDITOR_SIDE_REMOVE, hotkey::HOTKEY_EDITOR_TOOL_FILL, hotkey::HOTKEY_EDITOR_TOOL_ITEM, hotkey::HOTKEY_EDITOR_TOOL_LABEL, hotkey::HOTKEY_EDITOR_TOOL_NEXT, hotkey::HOTKEY_EDITOR_TOOL_PAINT, hotkey::HOTKEY_EDITOR_TOOL_SELECT, hotkey::HOTKEY_EDITOR_TOOL_STARTING_POSITION, hotkey::HOTKEY_EDITOR_TOOL_UNIT, hotkey::HOTKEY_EDITOR_TOOL_VILLAGE, hotkey::HOTKEY_EDITOR_UNIT_CHANGE_ID, hotkey::HOTKEY_EDITOR_UNIT_FACING, hotkey::HOTKEY_EDITOR_UNIT_RECRUIT_ASSIGN, hotkey::HOTKEY_EDITOR_UNIT_TOGGLE_CANRECRUIT, hotkey::HOTKEY_EDITOR_UNIT_TOGGLE_LOYAL, hotkey::HOTKEY_EDITOR_UNIT_TOGGLE_RENAMEABLE, hotkey::HOTKEY_EDITOR_UPDATE_TRANSITIONS, hotkey::HOTKEY_FULLSCREEN, hotkey::HOTKEY_HELP, hotkey::HOTKEY_MAP_SCREENSHOT, hotkey::HOTKEY_MINIMAP_CODING_TERRAIN, hotkey::HOTKEY_MINIMAP_CODING_UNIT, hotkey::HOTKEY_MINIMAP_DRAW_TERRAIN, hotkey::HOTKEY_MINIMAP_DRAW_UNITS, hotkey::HOTKEY_MINIMAP_DRAW_VILLAGES, hotkey::HOTKEY_MOUSE_SCROLL, hotkey::HOTKEY_MUTE, hotkey::HOTKEY_NULL, hotkey::HOTKEY_PREFERENCES, hotkey::HOTKEY_QUIT_GAME, hotkey::HOTKEY_QUIT_TO_DESKTOP, hotkey::HOTKEY_REDO, hotkey::HOTKEY_RENAME_UNIT, hotkey::HOTKEY_SCREENSHOT, hotkey::HOTKEY_SCROLL_DOWN, hotkey::HOTKEY_SCROLL_LEFT, hotkey::HOTKEY_SCROLL_RIGHT, hotkey::HOTKEY_SCROLL_UP, hotkey::HOTKEY_STATUS_TABLE, hotkey::HOTKEY_TERRAIN_DESCRIPTION, hotkey::HOTKEY_TOGGLE_GRID, hotkey::HOTKEY_UNDO, hotkey::HOTKEY_UNIT_DESCRIPTION, hotkey::HOTKEY_UNIT_LIST, hotkey::HOTKEY_ZOOM_DEFAULT, hotkey::HOTKEY_ZOOM_IN, hotkey::HOTKEY_ZOOM_OUT, i, hotkey::hotkey_command::id, editor::LOAD_MRU, editor::LOCAL_SCHEDULE, editor::LOCAL_TIME, editor::MAP, display::mouseover_hex(), editor::MUSIC, editor::PALETTE, editor::SCHEDULE, editor::SIDE, editor::TIME, hotkey::TITLE_SCREEN__RELOAD_WML, toolkit_, editor::UNIT_FACING, resources::units, and map_location::valid().

Referenced by show_menu().

void editor::editor_controller::change_unit_id ( )
void editor::editor_controller::copy_selection ( )

Copy the selection on the current map to the clipboard.

Definition at line 1115 of file editor_controller.cpp.

References context_manager_.

Referenced by cut_selection(), and execute_command().

void editor::editor_controller::custom_tods_dialog ( )

Display the settings dialog, used to control e.g.

the lighting settings

Definition at line 218 of file editor_controller.cpp.

References _(), context_manager_, gui2::tcustom_tod::execute(), gui(), image::color_adjustment_resetter::reset(), gui2::show_error_message(), and tods_.

Referenced by execute_command().

void editor::editor_controller::cut_selection ( )

Cut the selection from the current map to the clipboard.

Definition at line 1163 of file editor_controller.cpp.

References context_manager_, copy_selection(), and editor::get_selected_bg_terrain().

Referenced by execute_command().

void editor::editor_controller::display_redraw_callback ( display )
private

Callback function passed to display to be called on each redraw_everything run.

Redraws toolbar, brush bar and related items.

Definition at line 1221 of file editor_controller.cpp.

References context_manager_, hotkey::command_executor_default::set_button_state(), and toolkit_.

Referenced by init_gui().

void editor::editor_controller::do_screenshot ( const std::string screenshot_filename = "map_screenshot.bmp")

Takes a screenshot.

Definition at line 190 of file editor_controller.cpp.

References e, ERR_ED, gui(), and twml_exception::show().

Referenced by editor::start().

bool editor::editor_controller::execute_command ( const hotkey::hotkey_command command,
int  index = -1,
bool  press = true 
)
virtual

command_executor override

Reimplemented from hotkey::command_executor.

Definition at line 591 of file editor_controller.cpp.

References active_menu_, add_area(), editor::AREA, tod_color::b, change_unit_id(), context_manager_, copy_selection(), custom_tods_dialog(), cut_selection(), do_quit_, hotkey::command_executor::execute_command(), editor::EXIT_NORMAL, editor::EXIT_RELOAD_DATA, export_selection_coords(), unit_map::find(), tod_color::g, gui(), gui_, hotkey::HOTKEY_DELETE_UNIT, hotkey::HOTKEY_EDITOR_AREA_ADD, hotkey::HOTKEY_EDITOR_AREA_REMOVE, hotkey::HOTKEY_EDITOR_AREA_RENAME, hotkey::HOTKEY_EDITOR_AREA_SAVE, hotkey::HOTKEY_EDITOR_AUTO_UPDATE_TRANSITIONS, hotkey::HOTKEY_EDITOR_BRUSH_1, hotkey::HOTKEY_EDITOR_BRUSH_2, hotkey::HOTKEY_EDITOR_BRUSH_3, hotkey::HOTKEY_EDITOR_BRUSH_NEXT, hotkey::HOTKEY_EDITOR_BRUSH_NW_SE, hotkey::HOTKEY_EDITOR_BRUSH_SW_NE, hotkey::HOTKEY_EDITOR_CLIPBOARD_FLIP_HORIZONTAL, hotkey::HOTKEY_EDITOR_CLIPBOARD_FLIP_VERTICAL, hotkey::HOTKEY_EDITOR_CLIPBOARD_PASTE, hotkey::HOTKEY_EDITOR_CLIPBOARD_ROTATE_CCW, hotkey::HOTKEY_EDITOR_CLIPBOARD_ROTATE_CW, hotkey::HOTKEY_EDITOR_CUSTOM_TODS, hotkey::HOTKEY_EDITOR_DRAW_COORDINATES, hotkey::HOTKEY_EDITOR_DRAW_TERRAIN_CODES, hotkey::HOTKEY_EDITOR_MAP_APPLY_MASK, hotkey::HOTKEY_EDITOR_MAP_CLOSE, hotkey::HOTKEY_EDITOR_MAP_CREATE_MASK_TO, hotkey::HOTKEY_EDITOR_MAP_GENERATE, hotkey::HOTKEY_EDITOR_MAP_LOAD, hotkey::HOTKEY_EDITOR_MAP_NEW, hotkey::HOTKEY_EDITOR_MAP_RESIZE, hotkey::HOTKEY_EDITOR_MAP_REVERT, hotkey::HOTKEY_EDITOR_MAP_SAVE, hotkey::HOTKEY_EDITOR_MAP_SAVE_ALL, hotkey::HOTKEY_EDITOR_MAP_SAVE_AS, hotkey::HOTKEY_EDITOR_NO_UPDATE_TRANSITIONS, hotkey::HOTKEY_EDITOR_PALETTE_DOWNSCROLL, hotkey::HOTKEY_EDITOR_PALETTE_GROUPS, hotkey::HOTKEY_EDITOR_PALETTE_ITEM_SWAP, hotkey::HOTKEY_EDITOR_PALETTE_UPSCROLL, hotkey::HOTKEY_EDITOR_PARTIAL_UNDO, hotkey::HOTKEY_EDITOR_PARTIAL_UPDATE_TRANSITIONS, hotkey::HOTKEY_EDITOR_REFRESH, hotkey::HOTKEY_EDITOR_REFRESH_IMAGE_CACHE, hotkey::HOTKEY_EDITOR_REMOVE_LOCATION, hotkey::HOTKEY_EDITOR_SCENARIO_EDIT, hotkey::HOTKEY_EDITOR_SCENARIO_NEW, hotkey::HOTKEY_EDITOR_SCENARIO_SAVE_AS, hotkey::HOTKEY_EDITOR_SELECT_ALL, hotkey::HOTKEY_EDITOR_SELECT_INVERSE, hotkey::HOTKEY_EDITOR_SELECT_NONE, hotkey::HOTKEY_EDITOR_SELECTION_COPY, hotkey::HOTKEY_EDITOR_SELECTION_CUT, hotkey::HOTKEY_EDITOR_SELECTION_EXPORT, hotkey::HOTKEY_EDITOR_SELECTION_FILL, hotkey::HOTKEY_EDITOR_SELECTION_RANDOMIZE, hotkey::HOTKEY_EDITOR_SIDE_EDIT, hotkey::HOTKEY_EDITOR_SIDE_NEW, hotkey::HOTKEY_EDITOR_SIDE_REMOVE, hotkey::HOTKEY_EDITOR_TOGGLE_TRANSITIONS, hotkey::HOTKEY_EDITOR_TOOL_FILL, hotkey::HOTKEY_EDITOR_TOOL_ITEM, hotkey::HOTKEY_EDITOR_TOOL_LABEL, hotkey::HOTKEY_EDITOR_TOOL_PAINT, hotkey::HOTKEY_EDITOR_TOOL_SELECT, hotkey::HOTKEY_EDITOR_TOOL_STARTING_POSITION, hotkey::HOTKEY_EDITOR_TOOL_UNIT, hotkey::HOTKEY_EDITOR_TOOL_VILLAGE, hotkey::HOTKEY_EDITOR_UNIT_CHANGE_ID, hotkey::HOTKEY_EDITOR_UNIT_RECRUIT_ASSIGN, hotkey::HOTKEY_EDITOR_UNIT_TOGGLE_CANRECRUIT, hotkey::HOTKEY_EDITOR_UNIT_TOGGLE_RENAMEABLE, hotkey::HOTKEY_EDITOR_UPDATE_TRANSITIONS, hotkey::HOTKEY_NULL, hotkey::HOTKEY_QUIT_GAME, hotkey::HOTKEY_QUIT_TO_DESKTOP, hotkey::HOTKEY_ZOOM_DEFAULT, hotkey::HOTKEY_ZOOM_IN, hotkey::HOTKEY_ZOOM_OUT, i, hotkey::hotkey_command::id, display::invalidate_all(), mp_ui_alerts::items, editor::LOAD_MRU, editor::LOCAL_SCHEDULE, editor::LOCAL_TIME, editor::MAP, editor::MUSIC, music_tracks_, editor::PALETTE, perform_delete(), sound::play_music_once(), quit_confirmation::quit(), quit_mode_, quit_confirmation::quit_to_desktop(), tod_color::r, refresh_image_cache(), save_area(), save_map(), editor::SCHEDULE, SCOPE_ED, editor::location_palette::selected_item(), image::set_color_adjustment(), display::set_draw_coordinates(), preferences::editor::set_draw_hex_coordinates(), preferences::editor::set_draw_terrain_codes(), display::set_draw_terrain_codes(), show_menu(), editor::SIDE, editor::TIME, tod_manager::times(), hotkey::TITLE_SCREEN__RELOAD_WML, tods_, toolkit_, undo(), editor::UNIT_FACING, resources::units, and hotkey::command_executor_default::zoom_amount.

void editor::editor_controller::export_selection_coords ( )

Export the WML-compatible list of selected tiles to the system clipboard.

Definition at line 1181 of file editor_controller.cpp.

References context_manager_, desktop::clipboard::copy_to_clipboard(), and i.

Referenced by execute_command().

hotkey::ACTION_STATE editor::editor_controller::get_action_state ( hotkey::HOTKEY_COMMAND  command,
int  index 
) const
virtual

command_executor override

Reimplemented from hotkey::command_executor.

Definition at line 455 of file editor_controller.cpp.

References hotkey::ACTION_DESELECTED, hotkey::ACTION_OFF, hotkey::ACTION_ON, hotkey::ACTION_SELECTED, hotkey::ACTION_STATELESS, active_menu_, editor::AREA, context_manager_, unit_map::find(), preferences::grid(), gui_, hotkey::HOTKEY_EDITOR_AUTO_UPDATE_TRANSITIONS, hotkey::HOTKEY_EDITOR_BRUSH_1, hotkey::HOTKEY_EDITOR_BRUSH_2, hotkey::HOTKEY_EDITOR_BRUSH_3, hotkey::HOTKEY_EDITOR_BRUSH_NW_SE, hotkey::HOTKEY_EDITOR_BRUSH_SW_NE, hotkey::HOTKEY_EDITOR_CLIPBOARD_PASTE, hotkey::HOTKEY_EDITOR_DRAW_COORDINATES, hotkey::HOTKEY_EDITOR_DRAW_TERRAIN_CODES, hotkey::HOTKEY_EDITOR_NO_UPDATE_TRANSITIONS, hotkey::HOTKEY_EDITOR_PARTIAL_UPDATE_TRANSITIONS, hotkey::HOTKEY_EDITOR_SELECT_ALL, hotkey::HOTKEY_EDITOR_SELECT_NONE, hotkey::HOTKEY_EDITOR_TOOL_FILL, hotkey::HOTKEY_EDITOR_TOOL_ITEM, hotkey::HOTKEY_EDITOR_TOOL_LABEL, hotkey::HOTKEY_EDITOR_TOOL_PAINT, hotkey::HOTKEY_EDITOR_TOOL_SELECT, hotkey::HOTKEY_EDITOR_TOOL_STARTING_POSITION, hotkey::HOTKEY_EDITOR_TOOL_UNIT, hotkey::HOTKEY_EDITOR_TOOL_VILLAGE, hotkey::HOTKEY_EDITOR_UNIT_TOGGLE_CANRECRUIT, hotkey::HOTKEY_EDITOR_UNIT_TOGGLE_LOYAL, hotkey::HOTKEY_EDITOR_UNIT_TOGGLE_RENAMEABLE, hotkey::HOTKEY_MINIMAP_CODING_TERRAIN, hotkey::HOTKEY_MINIMAP_CODING_UNIT, hotkey::HOTKEY_MINIMAP_DRAW_TERRAIN, hotkey::HOTKEY_MINIMAP_DRAW_UNITS, hotkey::HOTKEY_MINIMAP_DRAW_VILLAGES, hotkey::HOTKEY_NULL, hotkey::HOTKEY_TOGGLE_GRID, hotkey::HOTKEY_ZOOM_DEFAULT, editor::LOAD_MRU, editor::LOCAL_SCHEDULE, editor::LOCAL_TIME, editor::MAP, preferences::minimap_draw_terrain(), preferences::minimap_draw_units(), preferences::minimap_draw_villages(), preferences::minimap_movement_coding(), preferences::minimap_terrain_coding(), editor::MUSIC, music_tracks_, editor::PALETTE, editor::SCHEDULE, editor::SIDE, editor::TIME, tods_, toolkit_, editor::UNIT_FACING, and resources::units.

editor_display& editor::editor_controller::get_display ( )
inlineprotectedvirtual

Get a reference to a display member a derived class uses.

Implements controller_base.

Definition at line 173 of file editor_controller.hpp.

References gui_.

hotkey::command_executor * editor::editor_controller::get_hotkey_command_executor ( )
virtual

Get (optionally) a command executor to handle context menu events.

Reimplemented from controller_base.

Definition at line 1372 of file editor_controller.cpp.

mouse_action* editor::editor_controller::get_mouse_action ( )
protected

Get the current mouse action.

mouse_handler_base& editor::editor_controller::get_mouse_handler_base ( )
inlineprotectedvirtual

Get a reference to a mouse handler member a derived class uses.

Implements controller_base.

Definition at line 172 of file editor_controller.hpp.

editor_display& editor::editor_controller::gui ( )
inlinevirtual

Reference to the used display objects.

Derived classes should ensure this is always valid. Note the constructor of this class cannot use this.

Implements events::mouse_handler_base.

Definition at line 156 of file editor_controller.hpp.

References gui_.

Referenced by allow_mouse_wheel_scroll(), can_execute_command(), custom_tods_dialog(), do_screenshot(), editor_controller(), execute_command(), init_gui(), left_click(), main_loop(), mouse_motion(), process_keyup_event(), right_click(), show_menu(), and terrain_description().

const editor_display& editor::editor_controller::gui ( ) const
inlinevirtual

Const version.

Implements events::mouse_handler_base.

Definition at line 157 of file editor_controller.hpp.

References gui_.

void editor::editor_controller::hotkey_quit ( )

Process a hotkey quit command.

void editor::editor_controller::init_gui ( )
private
void editor::editor_controller::init_music ( const config game_config)
private

init background music for the editor

Definition at line 144 of file editor_controller.cpp.

References config::child_range(), ERR_ED, sound::music_track::file_path(), config::has_child(), sound::music_track::id(), music_tracks_, and WRN_ED.

Referenced by editor_controller().

void editor::editor_controller::init_tods ( const config game_config)
private

init the available time-of-day settings

Definition at line 111 of file editor_controller.cpp.

References config::child_range(), ERR_ED, and tods_.

Referenced by editor_controller().

bool editor::editor_controller::left_click ( int  x,
int  y,
const bool  browse 
)
virtual

Overridden in derived classes, called on a left click (mousedown).

Defaults to process (initiate) minimap scrolling.

Returns
true when the click should not process the event further. This means do not treat the call as a start of drag movement. FIXME: This return value is currently ignored

Reimplemented from events::mouse_handler_base.

Definition at line 1284 of file editor_controller.cpp.

References context_manager_, gui(), gui_, display::hex_clicked_on(), LOG_ED, perform_refresh_delete(), hotkey::command_executor_default::set_button_state(), toolkit_, map_location::x, and map_location::y.

void editor::editor_controller::left_drag_end ( int  x,
int  y,
const bool  browse 
)
virtual

Called whenever the left mouse drag has "ended".

Reimplemented from events::mouse_handler_base.

Definition at line 1303 of file editor_controller.cpp.

References gui_, perform_delete(), and toolkit_.

void editor::editor_controller::left_mouse_up ( int  x,
int  y,
const bool  browse 
)
virtual

Called when the left mouse button is up.

Reimplemented from events::mouse_handler_base.

Definition at line 1309 of file editor_controller.cpp.

References context_manager_, gui_, perform_delete(), hotkey::command_executor_default::set_button_state(), and toolkit_.

void editor::editor_controller::load_tooltips ( )
private

Load editor-specific tooltips.

EXIT_STATUS editor::editor_controller::main_loop ( )
void editor::editor_controller::mouse_motion ( int  x,
int  y,
const bool  browse,
bool  update,
map_location  new_loc = map_location::null_location() 
)
virtual
void editor::editor_controller::perform_delete ( editor_action action)
protected

Perform an action, then delete the action object.

The pointer can be nullptr, in which case nothing will happen.

Definition at line 1199 of file editor_controller.cpp.

References context_manager_.

Referenced by execute_command(), left_drag_end(), left_mouse_up(), right_drag_end(), and right_mouse_up().

void editor::editor_controller::perform_refresh_delete ( editor_action action,
bool  drag_part = false 
)
protected

Peform an action on the current map_context, then refresh the display and delete the pointer.

The pointer can be nullptr, in which case nothing will happen.

Definition at line 1207 of file editor_controller.cpp.

References context_manager_.

Referenced by left_click(), process_keyup_event(), and right_click().

void editor::editor_controller::preferences ( )
virtual

Show the preferences dialog.

Reimplemented from hotkey::command_executor.

Definition at line 1088 of file editor_controller.cpp.

References controller_base::game_config_, gui_, and preferences::show_preferences_dialog().

void editor::editor_controller::process_keyup_event ( const SDL_Event &  event)
protectedvirtual

Process keyup (always).

Overridden in derived classes

Reimplemented from controller_base.

Definition at line 1365 of file editor_controller.cpp.

References gui(), perform_refresh_delete(), and toolkit_.

bool editor::editor_controller::quit_confirm ( )

Show a quit confirmation dialog and returns true if the user pressed 'yes'.

Definition at line 201 of file editor_controller.cpp.

References _(), amount, context_manager_, and quit_confirmation::show_prompt().

void editor::editor_controller::redo ( )
privatevirtual

Redos an action in the current map context.

Reimplemented from hotkey::command_executor.

Definition at line 1234 of file editor_controller.cpp.

References context_manager_.

void editor::editor_controller::refresh_image_cache ( )
private

Reload images.

Definition at line 1215 of file editor_controller.cpp.

References context_manager_, and image::flush_cache().

Referenced by execute_command().

void editor::editor_controller::rename_unit ( )
virtual
bool editor::editor_controller::right_click ( int  x,
int  y,
const bool  browse 
)
virtual

Overridden in derived classes, called on a right click (mousedown).

Defaults to displaying the menu (by setting the appropriate flag) if right_click_show_menu returns true.

Returns
true when the click should not process the event further. This means do not treat the call as a start of drag movement.

Reimplemented from events::mouse_handler_base.

Definition at line 1326 of file editor_controller.cpp.

References context_manager_, gui(), gui_, display::hex_clicked_on(), LOG_ED, perform_refresh_delete(), hotkey::command_executor_default::set_button_state(), toolkit_, map_location::x, and map_location::y.

bool editor::editor_controller::right_click_show_menu ( int  x,
int  y,
const bool  browse 
)
virtual

Called in the default right_click when the context menu is about to be shown, can be used for preprocessing and preventing the menu from being displayed without rewriting the right click function.

Returns
true when the menu should be displayed and false otherwise FIXME: This return value is currently ignored

Reimplemented from events::mouse_handler_base.

Definition at line 1279 of file editor_controller.cpp.

References toolkit_.

void editor::editor_controller::right_drag_end ( int  x,
int  y,
const bool  browse 
)
virtual

Called whenever the right mouse drag has "ended".

Reimplemented from events::mouse_handler_base.

Definition at line 1340 of file editor_controller.cpp.

References gui_, perform_delete(), and toolkit_.

void editor::editor_controller::right_mouse_up ( int  x,
int  y,
const bool  browse 
)
virtual

Called when the right mouse button is up.

Reimplemented from events::mouse_handler_base.

Definition at line 1346 of file editor_controller.cpp.

References context_manager_, gui_, perform_delete(), hotkey::command_executor_default::set_button_state(), and toolkit_.

void editor::editor_controller::save_area ( )

Save the current selection to the active area.

Definition at line 1169 of file editor_controller.cpp.

References context_manager_.

Referenced by execute_command().

void editor::editor_controller::save_map ( )
inlinevirtual

Save the map, open dialog if not named yet.

Reimplemented from hotkey::command_executor.

Definition at line 101 of file editor_controller.hpp.

References context_manager_.

Referenced by execute_command().

void editor::editor_controller::scroll_down ( bool  on)
virtual

Reimplemented from hotkey::command_executor.

Definition at line 1381 of file editor_controller.cpp.

References controller_base::set_scroll_down().

void editor::editor_controller::scroll_left ( bool  on)
virtual

Reimplemented from hotkey::command_executor.

Definition at line 1386 of file editor_controller.cpp.

References controller_base::set_scroll_left().

void editor::editor_controller::scroll_right ( bool  on)
virtual

Reimplemented from hotkey::command_executor.

Definition at line 1391 of file editor_controller.cpp.

References controller_base::set_scroll_right().

void editor::editor_controller::scroll_up ( bool  on)
virtual

Handle hotkeys to scroll map.

Reimplemented from hotkey::command_executor.

Definition at line 1376 of file editor_controller.cpp.

References controller_base::set_scroll_up().

void editor::editor_controller::show_help ( )
virtual

Reimplemented from hotkey::command_executor.

Definition at line 996 of file editor_controller.cpp.

References gui_, and help::show_help().

void editor::editor_controller::show_menu ( const std::vector< std::string > &  items_arg,
int  xloc,
int  yloc,
bool  context_menu,
display disp 
)
virtual
void editor::editor_controller::status_table ( )
virtual

Reimplemented from hotkey::command_executor.

Definition at line 187 of file editor_controller.cpp.

void editor::editor_controller::terrain_description ( )
virtual
void editor::editor_controller::toggle_grid ( )
virtual

Grid toggle.

Reimplemented from hotkey::command_executor.

Definition at line 1096 of file editor_controller.cpp.

References preferences::grid(), gui_, and preferences::set_grid().

void editor::editor_controller::undo ( )
privatevirtual

Undos an action in the current map context.

Reimplemented from hotkey::command_executor.

Definition at line 1228 of file editor_controller.cpp.

References context_manager_.

Referenced by execute_command().

void editor::editor_controller::unit_description ( )
virtual
void editor::editor_controller::unit_list ( )
virtual

Reimplemented from hotkey::command_executor.

Definition at line 1158 of file editor_controller.cpp.

References gui_, and dialogs::show_unit_list().

void editor::editor_controller::update_mouse_action_highlights ( )

Member Data Documentation

editor::menu_type editor::editor_controller::active_menu_
private
boost::scoped_ptr<context_manager> editor::editor_controller::context_manager_
bool editor::editor_controller::do_quit_
private

Quit main loop flag.

Definition at line 249 of file editor_controller.hpp.

Referenced by execute_command(), and main_loop().

boost::scoped_ptr<font::floating_label_context> editor::editor_controller::floating_label_manager_
private

Definition at line 244 of file editor_controller.hpp.

Referenced by init_gui().

boost::scoped_ptr<editor_display> editor::editor_controller::gui_
private
boost::scoped_ptr<help::help_manager> editor::editor_controller::help_manager_
private

Definition at line 246 of file editor_controller.hpp.

Referenced by editor_controller().

std::vector<sound::music_track> editor::editor_controller::music_tracks_
private

Definition at line 252 of file editor_controller.hpp.

Referenced by execute_command(), get_action_state(), init_music(), and show_menu().

EXIT_STATUS editor::editor_controller::quit_mode_
private

Definition at line 250 of file editor_controller.hpp.

Referenced by execute_command(), and main_loop().

boost::scoped_ptr<reports> editor::editor_controller::reports_
private

Reports object.

Must be initialized before the gui_

Definition at line 229 of file editor_controller.hpp.

tods_map editor::editor_controller::tods_
private
boost::scoped_ptr<editor_toolkit> editor::editor_controller::toolkit_
private
tooltips::manager editor::editor_controller::tooltip_manager_
private

Definition at line 243 of file editor_controller.hpp.


The documentation for this class was generated from the following files: