From b180581bf8fb26d137b5798a708b3eb7d19a3d30 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Wed, 20 Apr 2011 16:25:16 +0000 Subject: [PATCH] - bugfix for disabling hotkeys when in menu's and editing text in a field --- source/glest_game/menu/menu_state_connected_game.cpp | 5 +++++ source/glest_game/menu/menu_state_connected_game.h | 2 +- source/glest_game/menu/menu_state_custom_game.cpp | 5 +++++ source/glest_game/menu/menu_state_custom_game.h | 2 +- source/glest_game/menu/menu_state_options.cpp | 11 +++++++---- source/glest_game/menu/menu_state_options.h | 2 +- 6 files changed, 20 insertions(+), 7 deletions(-) diff --git a/source/glest_game/menu/menu_state_connected_game.cpp b/source/glest_game/menu/menu_state_connected_game.cpp index 6b14bfda..7a000c33 100644 --- a/source/glest_game/menu/menu_state_connected_game.cpp +++ b/source/glest_game/menu/menu_state_connected_game.cpp @@ -2387,6 +2387,11 @@ void MenuStateConnectedGame::cleanupMapPreviewTexture() { if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); } +bool MenuStateConnectedGame::isInSpecialKeyCaptureEvent() { + bool result = (chatManager.getEditEnabled() || activeInputLabel != NULL); + return result; +} + void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName, FTP_Client_CallbackType type, pair result, void *userdata) { if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); diff --git a/source/glest_game/menu/menu_state_connected_game.h b/source/glest_game/menu/menu_state_connected_game.h index 6bde050e..1fd694b7 100644 --- a/source/glest_game/menu/menu_state_connected_game.h +++ b/source/glest_game/menu/menu_state_connected_game.h @@ -183,7 +183,7 @@ public: virtual void keyPress(char c); virtual void keyUp(char key); - virtual bool isInSpecialKeyCaptureEvent() { return chatManager.getEditEnabled(); } + virtual bool isInSpecialKeyCaptureEvent(); private: diff --git a/source/glest_game/menu/menu_state_custom_game.cpp b/source/glest_game/menu/menu_state_custom_game.cpp index f895b2aa..bb2b844f 100644 --- a/source/glest_game/menu/menu_state_custom_game.cpp +++ b/source/glest_game/menu/menu_state_custom_game.cpp @@ -3108,4 +3108,9 @@ int32 MenuStateCustomGame::getNetworkPlayerStatus() { return result; } +bool MenuStateCustomGame::isInSpecialKeyCaptureEvent() { + bool result = (chatManager.getEditEnabled() || activeInputLabel != NULL); + return result; +} + }}//end namespace diff --git a/source/glest_game/menu/menu_state_custom_game.h b/source/glest_game/menu/menu_state_custom_game.h index 098ddeb2..54b97f21 100644 --- a/source/glest_game/menu/menu_state_custom_game.h +++ b/source/glest_game/menu/menu_state_custom_game.h @@ -173,7 +173,7 @@ public: virtual void simpleTask(BaseThread *callingThread); - virtual bool isInSpecialKeyCaptureEvent() { return chatManager.getEditEnabled(); } + virtual bool isInSpecialKeyCaptureEvent(); private: diff --git a/source/glest_game/menu/menu_state_options.cpp b/source/glest_game/menu/menu_state_options.cpp index d57f6d27..5543f3e1 100644 --- a/source/glest_game/menu/menu_state_options.cpp +++ b/source/glest_game/menu/menu_state_options.cpp @@ -663,12 +663,15 @@ void MenuStateOptions::mouseMove(int x, int y, const MouseState *ms){ checkBoxDisableScreenshotConsoleText.mouseMove(x, y); } +bool MenuStateOptions::isInSpecialKeyCaptureEvent() { + return (activeInputLabel != NULL); +} + void MenuStateOptions::keyDown(char key){ - if(activeInputLabel!=NULL) - { - if(key==vkBack){ + if(activeInputLabel != NULL) { + if(key == vkBack) { string text= activeInputLabel->getText(); - if(text.size()>1){ + if(text.size() > 1) { text.erase(text.end()-2); } activeInputLabel->setText(text); diff --git a/source/glest_game/menu/menu_state_options.h b/source/glest_game/menu/menu_state_options.h index 86b56522..9dc779b9 100644 --- a/source/glest_game/menu/menu_state_options.h +++ b/source/glest_game/menu/menu_state_options.h @@ -123,7 +123,7 @@ public: void render(); virtual void keyDown(char key); virtual void keyPress(char c); - + virtual bool isInSpecialKeyCaptureEvent(); private: void saveConfig();