From 473d81f2e2ad4b8077c9cfe241032c67d6a795c3 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Sat, 10 Mar 2018 00:24:57 +0100 Subject: Formspecs: Unify textarea and field parsing functions, fix wrong fallback text * textarea[], field[]: Unify function, fix wrong fallback text * Remove apparently superflous mainmenumanager.h incldue * intlGUIEditBox.cpp: make read-only boxes really read-only * Use elseif (trivial) --- src/gui/intlGUIEditBox.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/gui/intlGUIEditBox.cpp') diff --git a/src/gui/intlGUIEditBox.cpp b/src/gui/intlGUIEditBox.cpp index 8b0f10721..8c661b9f3 100644 --- a/src/gui/intlGUIEditBox.cpp +++ b/src/gui/intlGUIEditBox.cpp @@ -354,8 +354,7 @@ bool intlGUIEditBox::processKey(const SEvent& event) break; case KEY_KEY_X: // cut to the clipboard - if (!PasswordBox && Operator && MarkBegin != MarkEnd) - { + if (!PasswordBox && Operator && MarkBegin != MarkEnd) { const s32 realmbgn = MarkBegin < MarkEnd ? MarkBegin : MarkEnd; const s32 realmend = MarkBegin < MarkEnd ? MarkEnd : MarkBegin; @@ -364,8 +363,7 @@ bool intlGUIEditBox::processKey(const SEvent& event) sc = Text.subString(realmbgn, realmend - realmbgn).c_str(); Operator->copyToClipboard(sc.c_str()); - if (IsEnabled) - { + if (IsEnabled && m_writable) { // delete core::stringw s; s = Text.subString(0, realmbgn); @@ -380,7 +378,7 @@ bool intlGUIEditBox::processKey(const SEvent& event) } break; case KEY_KEY_V: - if ( !IsEnabled ) + if (!IsEnabled || !m_writable) break; // paste from the clipboard @@ -636,7 +634,7 @@ bool intlGUIEditBox::processKey(const SEvent& event) break; case KEY_BACK: - if ( !this->IsEnabled ) + if (!this->IsEnabled || !m_writable) break; if (!Text.empty()) { @@ -675,7 +673,7 @@ bool intlGUIEditBox::processKey(const SEvent& event) } break; case KEY_DELETE: - if ( !this->IsEnabled ) + if (!this->IsEnabled || !m_writable) break; if (!Text.empty()) { @@ -1351,7 +1349,7 @@ s32 intlGUIEditBox::getLineFromPos(s32 pos) void intlGUIEditBox::inputChar(wchar_t c) { - if (!IsEnabled) + if (!IsEnabled || !m_writable) return; if (c != 0) -- cgit v1.2.3