From 9de5536077107f36185c1132cd0cbcdbeefffabb Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 27 Aug 2014 15:21:32 +0300 Subject: Move chat command /disablehightlight into actions. --- src/actions/commands.cpp | 12 ++++++++++++ src/actions/commands.h | 1 + src/commands.cpp | 12 ------------ src/commands.h | 5 +---- src/gui/popups/popupmenu.cpp | 4 ++-- src/input/inputaction.h | 1 + src/input/inputactionmap.h | 11 ++++++++++- 7 files changed, 27 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index 779d09dce..9c34b9a5a 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -586,4 +586,16 @@ impHandler(enableHighlight) return false; } +impHandler(disableHighlight) +{ + if (event.tab) + { + event.tab->setAllowHighlight(false); + if (chatWindow) + chatWindow->saveState(); + return true; + } + return false; +} + } // namespace Actions diff --git a/src/actions/commands.h b/src/actions/commands.h index d95050520..e06663660 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -60,6 +60,7 @@ namespace Actions decHandler(openUrl); decHandler(execute); decHandler(enableHighlight); + decHandler(disableHighlight); } // namespace Actions #undef decHandler diff --git a/src/commands.cpp b/src/commands.cpp index 6c0abcd38..de2d03475 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -106,18 +106,6 @@ impHandler(hack) return true; } -impHandler(disableHighlight) -{ - if (event.tab) - { - event.tab->setAllowHighlight(false); - if (chatWindow) - chatWindow->saveState(); - return true; - } - return false; -} - impHandler(dontRemoveName) { if (event.tab) diff --git a/src/commands.h b/src/commands.h index 5cfbd55a1..c94d802f3 100644 --- a/src/commands.h +++ b/src/commands.h @@ -52,7 +52,6 @@ struct CommandInfo final namespace Commands { decHandler(hack); - decHandler(disableHighlight); decHandler(dontRemoveName); decHandler(removeName); decHandler(disableAway); @@ -72,8 +71,7 @@ namespace Commands enum { - COMMAND_DISABLEHIGHLIGHT = 0, - COMMAND_DONTREMOVENAME, + COMMAND_DONTREMOVENAME = 0, COMMAND_REMOVENAME, COMMAND_DISABLEAWAY, COMMAND_ENABLEAWAY, @@ -92,7 +90,6 @@ enum static const CommandInfo commands[] = { - {"disablehighlight", &Commands::disableHighlight, -1, false}, {"", &Commands::dontRemoveName, -1, false}, {"", &Commands::removeName, -1, false}, {"disableaway", &Commands::disableAway, -1, false}, diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 69a4e096b..501b1e0ff 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -1460,8 +1460,8 @@ void PopupMenu::handleLink(const std::string &link, } else if (link == "disable highlight" && mTab) { - if (commandHandler) - commandHandler->invokeCommand(COMMAND_DISABLEHIGHLIGHT, mTab); + inputManager.executeChatCommand(InputAction::DISABLE_HIGHLIGHT, + std::string(), mTab); } else if (link == "dont remove name" && mTab) { diff --git a/src/input/inputaction.h b/src/input/inputaction.h index 09f753117..510e42793 100644 --- a/src/input/inputaction.h +++ b/src/input/inputaction.h @@ -409,6 +409,7 @@ namespace InputAction EXECUTE, TEST_SDL_FONT, ENABLE_HIGHLIGHT, + DISABLE_HIGHLIGHT, TOTAL }; } // namespace InputAction diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 4a7f76c6b..d395d83b0 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -3458,7 +3458,16 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { InputAction::NO_VALUE, 50, InputCondition::INGAME, "enablehighlight", - true} + false}, + {"keyDisableHightlight", + InputType::UNKNOWN, InputAction::NO_VALUE, + InputType::UNKNOWN, InputAction::NO_VALUE, + Input::GRP_DEFAULT, + &Actions::disableHighlight, + InputAction::NO_VALUE, 50, + InputCondition::INGAME, + "disablehighlight", + false} }; #endif // INPUT_INPUTACTIONMAP_H -- cgit v1.2.3-60-g2f50