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