Base class for editor actions.
Class that keeps track of all the keys on the keyboard.
A brush-drag mouse action base class which adds brush and drag processing to a basic mouse action.
std::unique_ptr< editor_action > click_left(editor_display &disp, int x, int y)
Calls click_perform_left()
std::unique_ptr< editor_action > drag_right(editor_display &disp, int x, int y, bool &partial, editor_action *last_undo)
Calls click_perform for every new hex the mouse is dragged into.
const brush *const *const brush_
Current brush handle.
virtual std::unique_ptr< editor_action > click_perform_right(editor_display &disp, const std::set< map_location > &hexes)=0
The actual action function which is called by click() and drag().
const brush & get_brush()
Brush accessor.
std::unique_ptr< editor_action > drag_left(editor_display &disp, int x, int y, bool &partial, editor_action *last_undo)
Calls click_perform() for every new hex the mouse is dragged into.
std::unique_ptr< editor_action > drag_end(editor_display &disp, int x, int y)
End of dragging.
std::unique_ptr< editor_action > drag_generic(editor_display &disp, int x, int y, bool &partial, editor_action *last_undo)
Template helper gathering actions common for both drag_right and drag_left.
map_location previous_drag_hex_
The previous hex dragged into.
std::set< map_location > affected_hexes(editor_display &disp, const map_location &hex)
The affected hexes of a brush action are the result of projecting the current brush on the mouseover ...
virtual std::unique_ptr< editor_action > click_perform_left(editor_display &disp, const std::set< map_location > &hexes)=0
The actual action function which is called by click() and drag().
brush_drag_mouse_action(common_palette &palette, const brush *const *const brush, const CKey &key)
std::unique_ptr< editor_action > click_right(editor_display &disp, int x, int y)
Calls click_perform_right()
The brush class represents a single brush – a set of relative locations around a "hotspot",...
Base class for all editor actions.
List of starting locations and location ids.
A map fragment – a collection of locations and information abut them.
terrain_palette & terrain_palette_
std::set< map_location > affected_hexes(editor_display &disp, const map_location &hex) override
Tiles that will be painted to, possibly use modifier keys here.
std::unique_ptr< editor_action > click_left(editor_display &disp, int x, int y) override
Left / right click fills with the respective terrain.
std::unique_ptr< editor_action > click_right(editor_display &disp, int x, int y) override
Left / right click fills with the respective terrain.
mouse_action_fill(const CKey &key, terrain_palette &terrain_palette)
virtual void set_mouse_overlay(editor_display &disp) override
Set the mouse overlay for this action.
Brush paint mouse action.
std::unique_ptr< editor_action > click_perform_right(editor_display &disp, const std::set< map_location > &hexes) override
Create an appropriate editor_action and return it.
virtual bool supports_brushes() const override
Whether we need the brush bar, is used to grey it out.
mouse_action_paint(const brush *const *const brush, const CKey &key, terrain_palette &palette)
std::unique_ptr< editor_action > click_right(editor_display &disp, int x, int y) override
Handle terrain sampling before calling generic handler.
terrain_palette & terrain_palette_
void set_mouse_overlay(editor_display &disp) override
Set the mouse overlay for this action.
std::unique_ptr< editor_action > click_left(editor_display &disp, int x, int y) override
Handle terrain sampling before calling generic handler.
std::unique_ptr< editor_action > click_perform_left(editor_display &disp, const std::set< map_location > &hexes) override
Create an appropriate editor_action and return it.
virtual bool has_context_menu() const override
std::set< map_location > affected_hexes(editor_display &disp, const map_location &hex) override
Show an outline of where the paste will go.
std::unique_ptr< editor_action > click_left(editor_display &disp, int x, int y) override
Return a paste with offset action.
virtual void set_mouse_overlay(editor_display &disp) override
Set the mouse overlay for this action.
std::unique_ptr< editor_action > click_right(editor_display &disp, int x, int y) override
Right click does nothing for now.
const map_fragment & paste_
Reference to the buffer used for pasting (e.g.
mouse_action_paste(const map_fragment &paste, const CKey &key, common_palette &palette)
Set starting position action.
std::unique_ptr< editor_action > up_right(editor_display &disp, int x, int y) override
Right click only erases the starting position if there is one.
std::unique_ptr< editor_action > up_left(editor_display &disp, int x, int y) override
Left click displays a player-number-selector dialog and then creates an action or returns nullptr if ...
std::unique_ptr< editor_action > click_right(editor_display &disp, int x, int y) override
A click, possibly the beginning of a drag.
std::unique_ptr< editor_action > click_left(editor_display &disp, int x, int y) override
A click, possibly the beginning of a drag.
virtual void set_mouse_overlay(editor_display &disp) override
Set the mouse overlay for this action.
mouse_action_starting_position(const CKey &key, location_palette &palette)
location_palette & location_palette_
A mouse action receives events from the controller, and responds to them by creating an appropriate e...
virtual std::unique_ptr< editor_action > click_left(editor_display &disp, int x, int y)=0
A click, possibly the beginning of a drag.
const theme::menu * toolbar_button_
Pointer to an associated menu/button, if such exists.
bool has_shift_modifier() const
virtual std::unique_ptr< editor_action > click_right(editor_display &disp, int x, int y)=0
A click, possibly the beginning of a drag.
void update_brush_highlights(editor_display &disp, const map_location &hex)
Unconditionally update the brush highlights for the current tool when hex is the center location.
virtual std::unique_ptr< editor_action > drag_end_right(editor_display &disp, int x, int y)
virtual bool has_context_menu() const
void set_terrain_mouse_overlay(editor_display &disp, const t_translation::terrain_code &fg, const t_translation::terrain_code &bg)
Helper function for derived classes that need a active-terrain mouse overlay.
mouse_action(common_palette &palette, const CKey &key)
virtual std::set< map_location > affected_hexes(editor_display &disp, const map_location &hex)
Locations that would be affected by a click, used by move to update highlights.
virtual std::unique_ptr< editor_action > up_left(editor_display &disp, int x, int y)
bool has_ctrl_modifier() const
const CKey & key_
Key presses, used for modifiers (alt, shift) in some operations.
map_location previous_move_hex_
The hex previously used in move operations.
void set_toolbar_button(const theme::menu *value)
Helper variable setter - pointer to a toolbar menu/button used for highlighting the current action.
virtual void move(editor_display &disp, const map_location &hex)
Mouse move (not a drag).
virtual std::unique_ptr< editor_action > up_right(editor_display &disp, int x, int y)
virtual std::unique_ptr< editor_action > key_event(editor_display &disp, const SDL_Event &e)
Function called by the controller on a key event for the current mouse action.
common_palette & palette_
Pointer to an associated palette, if such exists.
virtual std::unique_ptr< editor_action > drag_left(editor_display &disp, int x, int y, bool &partial, editor_action *last_undo)
Drag operation.
const theme::menu * toolbar_button() const
Getter for the (possibly nullptr) associated menu/button.
common_palette & get_palette()
Getter for the associated palette.
virtual std::unique_ptr< editor_action > drag_right(editor_display &disp, int x, int y, bool &partial, editor_action *last_undo)
Drag operation.
virtual void set_mouse_overlay(editor_display &disp)
Set the mouse overlay for this action.
virtual bool supports_brushes() const
Whether we need the brush bar, is used to grey it out.
bool has_alt_modifier() const
virtual std::unique_ptr< editor_action > drag_end_left(editor_display &disp, int x, int y)
The end of dragging.
Palette where the terrain to be drawn can be selected.
std::vector< color_t > palette(const color_range &cr)
Creates a reference color palette from a color range.
Manage the empty-palette in the editor.
Encapsulates the map of the game.
A terrain string which is converted to a terrain is a string with 1 or 2 layers the layers are separa...
Definitions related to theme-support.