|
|
@ -347,155 +347,163 @@ void CGroupEditBox::paste()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cutSelection();
|
|
|
|
cutSelection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stopParentBlink();
|
|
|
|
|
|
|
|
makeTopWindow();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ucstring sString;
|
|
|
|
ucstring sString;
|
|
|
|
|
|
|
|
|
|
|
|
if (Driver->pasteTextFromClipboard(sString))
|
|
|
|
if (Driver->pasteTextFromClipboard(sString))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
sint length = (sint)sString.length();
|
|
|
|
// append string now
|
|
|
|
|
|
|
|
appendString(sString);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void CGroupEditBox::appendString(const ucstring &str)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
stopParentBlink();
|
|
|
|
|
|
|
|
makeTopWindow();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sint length = (sint)str.length();
|
|
|
|
|
|
|
|
|
|
|
|
ucstring toAppend;
|
|
|
|
ucstring toAppend;
|
|
|
|
// filter character depending on the netry type
|
|
|
|
// filter character depending on the entry type
|
|
|
|
switch (_EntryType)
|
|
|
|
switch (_EntryType)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
case Text:
|
|
|
|
|
|
|
|
case Password:
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case Text:
|
|
|
|
if (_NegativeFilter.empty())
|
|
|
|
case Password:
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (_NegativeFilter.empty())
|
|
|
|
toAppend = str;
|
|
|
|
{
|
|
|
|
}
|
|
|
|
toAppend = sString;
|
|
|
|
else
|
|
|
|
}
|
|
|
|
{
|
|
|
|
else
|
|
|
|
for (sint k = 0; k < length; ++k)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (sint k = 0; k < length; ++k)
|
|
|
|
if (!isFiltered(str[k]))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!isFiltered(sString[k]))
|
|
|
|
toAppend += str[k];
|
|
|
|
{
|
|
|
|
|
|
|
|
toAppend += sString[k];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// remove '\r' characters
|
|
|
|
|
|
|
|
toAppend.erase(std::remove(toAppend.begin(), toAppend.end(), (ucchar) '\r'), toAppend.end());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
// remove '\r' characters
|
|
|
|
case PositiveInteger:
|
|
|
|
toAppend.erase(std::remove(toAppend.begin(), toAppend.end(), (ucchar) '\r'), toAppend.end());
|
|
|
|
case PositiveFloat:
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PositiveInteger:
|
|
|
|
|
|
|
|
case PositiveFloat:
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
for (sint k = 0; k < length; ++k)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (sint k = 0; k < length; ++k)
|
|
|
|
if (isdigit(str[k]) || str[k]== ' ' ||
|
|
|
|
|
|
|
|
(_EntryType==PositiveFloat && str[k]=='.') )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (isdigit(sString[k]) || sString[k]== ' ' ||
|
|
|
|
if (!isFiltered(str[k]))
|
|
|
|
(_EntryType==PositiveFloat && sString[k]=='.') )
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!isFiltered(sString[k]))
|
|
|
|
toAppend += str[k];
|
|
|
|
{
|
|
|
|
|
|
|
|
toAppend += sString[k];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Integer:
|
|
|
|
break;
|
|
|
|
case Float:
|
|
|
|
case Integer:
|
|
|
|
|
|
|
|
case Float:
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
for (sint k = 0; k < length; ++k)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (sint k = 0; k < length; ++k)
|
|
|
|
if (isdigit(str[k]) || str[k]== ' ' || str[k]== '-' ||
|
|
|
|
|
|
|
|
(_EntryType==Float && str[k]=='.') )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (isdigit(sString[k]) || sString[k]== ' ' || sString[k]== '-' ||
|
|
|
|
if (!isFiltered(str[k]))
|
|
|
|
(_EntryType==Float && sString[k]=='.') )
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!isFiltered(sString[k]))
|
|
|
|
toAppend += str[k];
|
|
|
|
{
|
|
|
|
|
|
|
|
toAppend += sString[k];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AlphaNumSpace:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AlphaNumSpace:
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
for (sint k = 0; k < length; ++k)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (sint k = 0; k < length; ++k)
|
|
|
|
if (isValidAlphaNumSpace(str[k]))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (isValidAlphaNumSpace(sString[k]))
|
|
|
|
if (!isFiltered(str[k]))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!isFiltered(sString[k]))
|
|
|
|
toAppend += str[k];
|
|
|
|
{
|
|
|
|
|
|
|
|
toAppend += sString[k];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AlphaNum:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case AlphaNum:
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
for (sint k = 0; k < length; ++k)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (sint k = 0; k < length; ++k)
|
|
|
|
if (isValidAlphaNum(str[k]))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (isValidAlphaNum(sString[k]))
|
|
|
|
if (!isFiltered(str[k]))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!isFiltered(sString[k]))
|
|
|
|
toAppend += str[k];
|
|
|
|
{
|
|
|
|
|
|
|
|
toAppend += sString[k];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Alpha:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Alpha:
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
for (sint k = 0; k < length; ++k)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (sint k = 0; k < length; ++k)
|
|
|
|
if (isValidAlpha(str[k]))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (isValidAlpha(sString[k]))
|
|
|
|
if (!isFiltered(str[k]))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!isFiltered(sString[k]))
|
|
|
|
toAppend += str[k];
|
|
|
|
{
|
|
|
|
|
|
|
|
toAppend += sString[k];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Filename:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Filename:
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
for (sint k = 0; k < length; ++k)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (sint k = 0; k < length; ++k)
|
|
|
|
if (isValidFilenameChar(str[k]))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (isValidFilenameChar(sString[k]))
|
|
|
|
if (!isFiltered(str[k]))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!isFiltered(sString[k]))
|
|
|
|
toAppend += str[k];
|
|
|
|
{
|
|
|
|
|
|
|
|
toAppend += sString[k];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case PlayerName:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PlayerName:
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
for (sint k = 0; k < length; ++k)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (sint k = 0; k < length; ++k)
|
|
|
|
if (isValidPlayerNameChar(str[k]))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (isValidPlayerNameChar(sString[k]))
|
|
|
|
if (!isFiltered(str[k]))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!isFiltered(sString[k]))
|
|
|
|
toAppend += str[k];
|
|
|
|
{
|
|
|
|
|
|
|
|
toAppend += sString[k];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
length = (sint)toAppend.size();
|
|
|
|
|
|
|
|
if ((uint) (_InputString.length() + length) > _MaxNumChar)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
length = _MaxNumChar - (sint)_InputString.length();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ucstring toAdd = toAppend.substr(0, length);
|
|
|
|
|
|
|
|
_InputString = _InputString.substr(0, _CursorPos) + toAdd + _InputString.substr(_CursorPos);
|
|
|
|
|
|
|
|
_CursorPos += (sint32)toAdd.length();
|
|
|
|
|
|
|
|
nlinfo ("Chat input was pasted from the clipboard");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
triggerOnChangeAH();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
length = (sint)toAppend.size();
|
|
|
|
|
|
|
|
if ((uint) (_InputString.length() + length) > _MaxNumChar)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
length = _MaxNumChar - (sint)_InputString.length();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ucstring toAdd = toAppend.substr(0, length);
|
|
|
|
|
|
|
|
_InputString = _InputString.substr(0, _CursorPos) + toAdd + _InputString.substr(_CursorPos);
|
|
|
|
|
|
|
|
_CursorPos += (sint32)toAdd.length();
|
|
|
|
|
|
|
|
nlinfo ("Chat input was pasted from the clipboard");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
triggerOnChangeAH();
|
|
|
|
|
|
|
|
|
|
|
|
_CursorAtPreviousLineEnd = false;
|
|
|
|
_CursorAtPreviousLineEnd = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -610,6 +618,8 @@ void CGroupEditBox::handleEventChar(const CEventDescriptorKey &rEDK)
|
|
|
|
if (!isValidPlayerNameChar(c))
|
|
|
|
if (!isValidPlayerNameChar(c))
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// verify integer bounds
|
|
|
|
// verify integer bounds
|
|
|
|
if(_EntryType==Integer && (_IntegerMinValue!=INT_MIN || _IntegerMaxValue!=INT_MAX))
|
|
|
|
if(_EntryType==Integer && (_IntegerMinValue!=INT_MIN || _IntegerMaxValue!=INT_MAX))
|
|
|
@ -658,6 +668,11 @@ void CGroupEditBox::handleEventChar(const CEventDescriptorKey &rEDK)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void CGroupEditBox::handleEventString(const CEventDescriptorKey &rEDK)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
appendString(rEDK.getString());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
bool CGroupEditBox::undo()
|
|
|
|
bool CGroupEditBox::undo()
|
|
|
@ -720,7 +735,7 @@ bool CGroupEditBox::expand()
|
|
|
|
if (_InputString[0] == '/')
|
|
|
|
if (_InputString[0] == '/')
|
|
|
|
{
|
|
|
|
{
|
|
|
|
makeTopWindow();
|
|
|
|
makeTopWindow();
|
|
|
|
// for french or deutch, be aware of unicode
|
|
|
|
// for french, deutsch and russian, be aware of unicode
|
|
|
|
std::string command = ucstring(_InputString.substr(1)).toUtf8();
|
|
|
|
std::string command = ucstring(_InputString.substr(1)).toUtf8();
|
|
|
|
ICommand::expand(command);
|
|
|
|
ICommand::expand(command);
|
|
|
|
// then back to ucstring
|
|
|
|
// then back to ucstring
|
|
|
@ -788,12 +803,14 @@ bool CGroupEditBox::handleEvent (const CEventDescriptor& event)
|
|
|
|
switch(rEDK.getKeyEventType())
|
|
|
|
switch(rEDK.getKeyEventType())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case CEventDescriptorKey::keychar: handleEventChar(rEDK); break;
|
|
|
|
case CEventDescriptorKey::keychar: handleEventChar(rEDK); break;
|
|
|
|
|
|
|
|
case CEventDescriptorKey::keystring: handleEventString(rEDK); break;
|
|
|
|
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// update the text
|
|
|
|
// update the text
|
|
|
|
setInputString(_InputString);
|
|
|
|
setInputString(_InputString);
|
|
|
|
|
|
|
|
|
|
|
|
// if event of type char, consider handle all of them
|
|
|
|
// if event of type char or string, consider handle all of them
|
|
|
|
if( rEDK.getKeyEventType()==CEventDescriptorKey::keychar )
|
|
|
|
if( rEDK.getKeyEventType()==CEventDescriptorKey::keychar || rEDK.getKeyEventType()==CEventDescriptorKey::keystring )
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
// Else filter the EventKeyDown AND EventKeyUp.
|
|
|
|
// Else filter the EventKeyDown AND EventKeyUp.
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -1089,16 +1106,16 @@ void CGroupEditBox::setInputStringAsInt(sint32 val)
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
sint64 CGroupEditBox::getInputStringAsInt64() const
|
|
|
|
sint64 CGroupEditBox::getInputStringAsInt64() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
sint32 value;
|
|
|
|
sint64 value;
|
|
|
|
fromString(_InputString.toString(), value);
|
|
|
|
fromString(_InputString.toString(), value);
|
|
|
|
return value;
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
void CGroupEditBox::setInputStringAsInt64(sint64 val)
|
|
|
|
void CGroupEditBox::setInputStringAsInt64(sint64 val)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
setInputString(NLMISC::toString(val));
|
|
|
|
setInputString(NLMISC::toString(val));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|