editor2: fill seelction feature

This commit is contained in:
Tomasz Śniatowski 2008-08-12 23:22:51 +01:00
parent 1120f6b44a
commit 1e20cfe385
5 changed files with 21 additions and 3 deletions

View file

@ -130,7 +130,7 @@
id=menu-editor-edit
title= _ "Edit"
image=lite
items=undo,redo,editor-cut,editor-copy,editor-paste,editor-select-all,editor-select-inverse,editor-selection-rotate,editor-selection-flip,editor-selection-generate,editor-selection-randomize
items=undo,redo,editor-cut,editor-copy,editor-paste,editor-select-all,editor-select-inverse,editor-selection-fill,editor-selection-rotate,editor-selection-flip,editor-selection-generate,editor-selection-randomize
rect="+2,=,+100,="
xanchor=fixed
yanchor=fixed
@ -159,7 +159,7 @@
[menu]
id=menu-editor-selection
is_context_menu=true
items=menu-editor-starting-position,undo,redo,editor-cut,editor-copy,editor-paste,editor-selection-rotate,editor-selection-flip,editor-selection-generate,editor-selection-randomize
items=menu-editor-starting-position,undo,redo,editor-cut,editor-copy,editor-paste,editor-selection-fill,editor-selection-rotate,editor-selection-flip,editor-selection-generate,editor-selection-randomize
[/menu]
[mini_map]

View file

@ -448,6 +448,7 @@ bool editor_controller::can_execute_command(hotkey::HOTKEY_COMMAND command, int
case HOTKEY_EDITOR_COPY:
case HOTKEY_EDITOR_SELECTION_ROTATE:
case HOTKEY_EDITOR_SELECTION_FLIP:
case HOTKEY_EDITOR_SELECTION_FILL:
case HOTKEY_EDITOR_SELECTION_GENERATE:
case HOTKEY_EDITOR_SELECTION_RANDOMIZE:
return !get_map().selection().empty();
@ -525,6 +526,9 @@ bool editor_controller::execute_command(hotkey::HOTKEY_COMMAND command, int inde
case HOTKEY_EDITOR_SELECT_INVERSE:
perform_refresh(editor_action_select_inverse());
return true;
case HOTKEY_EDITOR_SELECTION_FILL:
fill_selection();
return true;
case HOTKEY_EDITOR_MAP_FLIP_X:
perform_refresh(editor_action_flip_x());
return true;
@ -670,6 +674,13 @@ void editor_controller::cut_selection()
perform_refresh(a);
}
void editor_controller::fill_selection()
{
editor_action_paint_area a(get_map().selection(), foreground_terrain_);
perform_refresh(a);
}
void editor_controller::hotkey_set_mouse_action(hotkey::HOTKEY_COMMAND command)
{
std::map<hotkey::HOTKEY_COMMAND, mouse_action*>::iterator i = mouse_actions_.find(command);

View file

@ -92,6 +92,7 @@ class editor_controller : public controller_base,
void toggle_grid();
void copy_selection();
void cut_selection();
void fill_selection();
void hotkey_set_mouse_action(hotkey::HOTKEY_COMMAND command);
bool is_mouse_action_set(hotkey::HOTKEY_COMMAND command) const;

View file

@ -153,11 +153,15 @@ const struct {
{ hotkey::HOTKEY_EDITOR_SELECT_ALL, "editor-select-all",
N_("Select All"), false, hotkey::SCOPE_EDITOR },
{ hotkey::HOTKEY_EDITOR_SELECT_INVERSE, "editor-select-inverse",
N_("Invert Selection"), false, hotkey::SCOPE_EDITOR },
N_("Select Inverse"), false, hotkey::SCOPE_EDITOR },
{ hotkey::HOTKEY_EDITOR_SELECT_NONE, "editor-select-none",
N_("Select None"), false, hotkey::SCOPE_EDITOR },
{ hotkey::HOTKEY_EDITOR_SELECTION_ROTATE, "editor-selection-rotate",
N_("Rotate Selection"), false, hotkey::SCOPE_EDITOR },
{ hotkey::HOTKEY_EDITOR_SELECTION_FLIP, "editor-selection-flip",
N_("Flip Selection"), false, hotkey::SCOPE_EDITOR },
{ hotkey::HOTKEY_EDITOR_SELECTION_FILL, "editor-selection-fill",
N_("Fill Selection"), false, hotkey::SCOPE_EDITOR },
{ hotkey::HOTKEY_EDITOR_SELECTION_GENERATE, "editor-selection-generate",
N_("Generate Tiles In Selection"), false, hotkey::SCOPE_EDITOR },
{ hotkey::HOTKEY_EDITOR_SELECTION_RANDOMIZE, "editor-selection-randomize",

View file

@ -80,7 +80,9 @@ enum HOTKEY_COMMAND {
HOTKEY_EDITOR_BRUSH_NEXT, HOTKEY_EDITOR_BRUSH_DEFAULT,
HOTKEY_EDITOR_CUT, HOTKEY_EDITOR_COPY, HOTKEY_EDITOR_PASTE,
HOTKEY_EDITOR_SELECT_ALL, HOTKEY_EDITOR_SELECT_INVERSE,
HOTKEY_EDITOR_SELECT_NONE,
HOTKEY_EDITOR_SELECTION_ROTATE, HOTKEY_EDITOR_SELECTION_FLIP,
HOTKEY_EDITOR_SELECTION_FILL,
HOTKEY_EDITOR_SELECTION_GENERATE, HOTKEY_EDITOR_SELECTION_RANDOMIZE,
HOTKEY_EDITOR_MAP_RESIZE, HOTKEY_EDITOR_MAP_ROTATE,
HOTKEY_EDITOR_MAP_FLIP_X, HOTKEY_EDITOR_MAP_FLIP_Y,