mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-22 17:18:39 +00:00
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)
This commit is contained in:
parent
12d1e4ff04
commit
473d81f2e2
3 changed files with 75 additions and 103 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue