editor2 hotkey tweaks

This commit is contained in:
Tomasz Śniatowski 2008-08-17 14:17:19 +01:00
parent 0218bd8e54
commit fc09ac19ad
6 changed files with 38 additions and 5 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-fill,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-select-none,editor-selection-fill,editor-selection-rotate,editor-selection-flip,editor-selection-generate,editor-selection-randomize
rect="+2,=,+100,="
xanchor=fixed
yanchor=fixed

View file

@ -248,6 +248,21 @@ void editor_action_select_all::perform_without_undo(map_context& mc) const
mc.set_everything_changed();
}
editor_action_select_xor* editor_action_select_none::perform(map_context& mc) const
{
std::set<gamemap::location> current = mc.get_map().selection();
mc.get_map().clear_selection();
mc.set_everything_changed();
return new editor_action_select_xor(current);
}
void editor_action_select_none::perform_without_undo(map_context& mc) const
{
mc.get_map().clear_selection();
mc.set_everything_changed();
}
editor_action_select_inverse* editor_action_select_inverse::perform(map_context& mc) const
{
perform_without_undo(mc);

View file

@ -250,6 +250,19 @@ class editor_action_select_all : public editor_action
void perform_without_undo(map_context& mc) const;
};
/**
* Clear selection
*/
class editor_action_select_none : public editor_action
{
public:
editor_action_select_none()
{
}
editor_action_select_xor* perform(map_context& mc) const;
void perform_without_undo(map_context& mc) const;
};
/**
* Invert the selection
*/

View file

@ -101,7 +101,7 @@ editor_controller::editor_controller(const config &game_config, CVideo& video)
}
}
hotkey_set_mouse_action(hotkey::HOTKEY_EDITOR_TOOL_PAINT);
hotkey::get_hotkey(hotkey::HOTKEY_QUIT_GAME).set_description(_("Quit Editor"));
background_terrain_ = t_translation::GRASS_LAND;
foreground_terrain_ = t_translation::MOUNTAIN;
set_mouseover_overlay();
@ -459,17 +459,18 @@ bool editor_controller::can_execute_command(hotkey::HOTKEY_COMMAND command, int
return true; //tool selection always possible
case HOTKEY_EDITOR_CUT:
case HOTKEY_EDITOR_COPY:
case HOTKEY_EDITOR_SELECTION_ROTATE:
case HOTKEY_EDITOR_SELECTION_FLIP:
case HOTKEY_EDITOR_SELECTION_FILL:
case HOTKEY_EDITOR_SELECTION_RANDOMIZE:
return !get_map().selection().empty();
case HOTKEY_EDITOR_SELECTION_ROTATE:
case HOTKEY_EDITOR_SELECTION_FLIP:
case HOTKEY_EDITOR_SELECTION_GENERATE:
return false; //not implemented
case HOTKEY_EDITOR_PASTE:
return !clipboard_.empty();
case HOTKEY_EDITOR_SELECT_ALL:
case HOTKEY_EDITOR_SELECT_INVERSE:
case HOTKEY_EDITOR_SELECT_NONE:
case HOTKEY_EDITOR_MAP_RESIZE:
case HOTKEY_EDITOR_MAP_FLIP_X:
case HOTKEY_EDITOR_MAP_FLIP_Y:
@ -514,6 +515,7 @@ bool editor_controller::execute_command(hotkey::HOTKEY_COMMAND command, int inde
return true;
case HOTKEY_EDITOR_TERRAIN_PALETTE_SWAP:
palette_->swap();
if (get_mouse_action()->uses_terrains()) set_mouseover_overlay();
return true;
case HOTKEY_EDITOR_TOOL_PAINT:
case HOTKEY_EDITOR_TOOL_FILL:
@ -541,6 +543,8 @@ 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_SELECT_NONE:
perform_refresh(editor_action_select_none());
case HOTKEY_EDITOR_SELECTION_FILL:
fill_selection();
return true;

View file

@ -137,6 +137,7 @@ const struct {
{ hotkey::HOTKEY_EDITOR_MAP_SAVE, "editor-map-save", N_("Save Map"), false, hotkey::SCOPE_EDITOR },
{ hotkey::HOTKEY_EDITOR_MAP_SAVE_AS, "editor-map-save-as", N_("Save Map As"), false, hotkey::SCOPE_EDITOR },
{ hotkey::HOTKEY_EDITOR_MAP_REVERT, "editor-map-revert", N_("Revert All Changes"), false, hotkey::SCOPE_EDITOR },
{ hotkey::HOTKEY_EDITOR_MAP_INFO, "editor-map-info", N_("Map Information"), false, hotkey::SCOPE_EDITOR },
{ hotkey::HOTKEY_EDITOR_TERRAIN_PALETTE_SWAP, "editor-terrain-palette-swap",
N_("Swap fore- and background terrains"), false, hotkey::SCOPE_EDITOR },
{ hotkey::HOTKEY_EDITOR_TOOL_NEXT, "editor-tool-next", N_("Next Tool"), false, hotkey::SCOPE_EDITOR },

View file

@ -73,7 +73,7 @@ enum HOTKEY_COMMAND {
#ifdef USE_EDITOR2
HOTKEY_EDITOR_QUIT_TO_DESKTOP,
HOTKEY_EDITOR_MAP_NEW, HOTKEY_EDITOR_MAP_LOAD, HOTKEY_EDITOR_MAP_SAVE,
HOTKEY_EDITOR_MAP_SAVE_AS, HOTKEY_EDITOR_MAP_REVERT,
HOTKEY_EDITOR_MAP_SAVE_AS, HOTKEY_EDITOR_MAP_REVERT, HOTKEY_EDITOR_MAP_INFO,
HOTKEY_EDITOR_TERRAIN_PALETTE_SWAP,
HOTKEY_EDITOR_TOOL_NEXT, HOTKEY_EDITOR_TOOL_PAINT, HOTKEY_EDITOR_TOOL_FILL,
HOTKEY_EDITOR_TOOL_SELECT, HOTKEY_EDITOR_TOOL_STARTING_POSITION,