From 502df7d9c1156ed81222bd1dd2cd8fba95240b4f Mon Sep 17 00:00:00 2001 From: David Cernat Date: Fri, 5 Jan 2018 00:03:05 +0200 Subject: [PATCH] [Client] Clean up GUIChat slightly --- apps/openmw/mwmp/GUI/GUIChat.cpp | 28 ++++++++++++++-------------- apps/openmw/mwmp/GUI/GUIChat.hpp | 4 ++-- apps/openmw/mwmp/GUIController.cpp | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/apps/openmw/mwmp/GUI/GUIChat.cpp b/apps/openmw/mwmp/GUI/GUIChat.cpp index aae62e020..c02350883 100644 --- a/apps/openmw/mwmp/GUI/GUIChat.cpp +++ b/apps/openmw/mwmp/GUI/GUIChat.cpp @@ -52,7 +52,7 @@ namespace mwmp { // Give keyboard focus to the combo box whenever the console is // turned on - SetEditState(0); + setEditState(0); windowState = CHAT_ENABLED; } @@ -61,7 +61,7 @@ namespace mwmp // Apparently, hidden widgets can retain key focus // Remove for MyGUI 3.2.2 windowState = CHAT_DISABLED; - SetEditState(0); + setEditState(0); } bool GUIChat::exit() @@ -79,7 +79,7 @@ namespace mwmp if (cm.empty()) { mCommandLine->setCaption(""); - SetEditState(0); + setEditState(0); return; } @@ -96,7 +96,7 @@ namespace mwmp // It prevents the re-triggering of the acceptCommand() event for the same command // during the actual command execution mCommandLine->setCaption(""); - SetEditState(0); + setEditState(0); send (cm); } @@ -173,7 +173,7 @@ namespace mwmp { case CHAT_DISABLED: this->mMainWidget->setVisible(false); - SetEditState(0); + setEditState(0); break; case CHAT_ENABLED: this->mMainWidget->setVisible(true); @@ -184,7 +184,7 @@ namespace mwmp } } - void GUIChat::SetEditState(bool state) + void GUIChat::setEditState(bool state) { editState = state; mCommandLine->setVisible(editState); @@ -195,17 +195,17 @@ namespace mwmp { if (windowState == CHAT_DISABLED) return; - else if (windowState == CHAT_HIDDENMODE) + + if (!mCommandLine->getVisible()) + LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Opening chat."); + + if (windowState == CHAT_HIDDENMODE) { setVisible(true); curTime = 0; - editState = true; } - else // CHAT_ENABLED - editState = true; - LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Opening chat."); - SetEditState(editState); + setEditState(true); } void GUIChat::keyPress(MyGUI::Widget *_sender, MyGUI::KeyCode key, MyGUI::Char _char) @@ -241,14 +241,14 @@ namespace mwmp } - void GUIChat::Update(float dt) + void GUIChat::update(float dt) { if (windowState == CHAT_HIDDENMODE && !editState && isVisible()) { curTime += dt; if (curTime >= delay) { - SetEditState(false); + setEditState(false); this->mMainWidget->setVisible(false); } } diff --git a/apps/openmw/mwmp/GUI/GUIChat.hpp b/apps/openmw/mwmp/GUI/GUIChat.hpp index 059882561..cc2a1491d 100644 --- a/apps/openmw/mwmp/GUI/GUIChat.hpp +++ b/apps/openmw/mwmp/GUI/GUIChat.hpp @@ -41,7 +41,7 @@ namespace mwmp void pressedSay(); // switch chat focus (if chat mode != CHAT_DISABLED) void setDelay(float delay); - void Update(float dt); + void update(float dt); virtual void onOpen(); virtual void onClose(); @@ -78,7 +78,7 @@ namespace mwmp void acceptCommand(MyGUI::EditBox* _sender); - void SetEditState(bool state); + void setEditState(bool state); int windowState; bool editState; diff --git a/apps/openmw/mwmp/GUIController.cpp b/apps/openmw/mwmp/GUIController.cpp index cff86664a..c601221ec 100644 --- a/apps/openmw/mwmp/GUIController.cpp +++ b/apps/openmw/mwmp/GUIController.cpp @@ -198,7 +198,7 @@ bool mwmp::GUIController::hasFocusedElement() void mwmp::GUIController::update(float dt) { if (mChat != nullptr) - mChat->Update(dt); + mChat->update(dt); // Make sure we read the pressed button without resetting it, because it may also get // checked somewhere else