summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-27 15:21:32 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-27 15:21:32 +0300
commit9de5536077107f36185c1132cd0cbcdbeefffabb (patch)
tree085c92fba0a9d835096ba4c736caf1cb4c9d01ee
parentfbf45af162f9a2eecd3c27c8729bd9c811dbe793 (diff)
downloadmanaplus-9de5536077107f36185c1132cd0cbcdbeefffabb.tar.gz
manaplus-9de5536077107f36185c1132cd0cbcdbeefffabb.tar.bz2
manaplus-9de5536077107f36185c1132cd0cbcdbeefffabb.tar.xz
manaplus-9de5536077107f36185c1132cd0cbcdbeefffabb.zip
Move chat command /disablehightlight into actions.
-rw-r--r--src/actions/commands.cpp12
-rw-r--r--src/actions/commands.h1
-rw-r--r--src/commands.cpp12
-rw-r--r--src/commands.h5
-rw-r--r--src/gui/popups/popupmenu.cpp4
-rw-r--r--src/input/inputaction.h1
-rw-r--r--src/input/inputactionmap.h11
7 files changed, 27 insertions, 19 deletions
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