Prefer UTF-8, cleanup, ryzom/ryzomcore#335

develop
kaetemi 4 years ago
parent 55d83c9486
commit 993c37f56d

@ -63,7 +63,7 @@ namespace NLGUI
virtual bool handleEvent (const NLGUI::CEventDescriptor& eventDesc); virtual bool handleEvent (const NLGUI::CEventDescriptor& eventDesc);
/// Accessors /// Accessors
u32string getInputString() const { return _InputString; } std::string getInputString() const;
const u32string &getInputStringRef() const { return _InputString; } const u32string &getInputStringRef() const { return _InputString; }
const ucstring &getPrompt() const { return _Prompt; } const ucstring &getPrompt() const { return _Prompt; }
@ -71,7 +71,7 @@ namespace NLGUI
* NB : line returns are encoded as '\n', not '\r\n' * NB : line returns are encoded as '\n', not '\r\n'
*/ */
void setPrompt(const ucstring &s) { _Prompt = s; } void setPrompt(const ucstring &s) { _Prompt = s; }
void setInputString(const u32string &str); void setInputString(const std::string &str);
void setInputStringRef(const u32string &str) {_InputString = str; }; void setInputStringRef(const u32string &str) {_InputString = str; };
void setInputStringAsInt(sint32 val); void setInputStringAsInt(sint32 val);
sint32 getInputStringAsInt() const; sint32 getInputStringAsInt() const;
@ -79,10 +79,10 @@ namespace NLGUI
sint64 getInputStringAsInt64() const; sint64 getInputStringAsInt64() const;
void setInputStringAsFloat(float val); void setInputStringAsFloat(float val);
float getInputStringAsFloat() const; float getInputStringAsFloat() const;
void setInputStringAsUtf8(const std::string &str);
std::string getInputStringAsUtf8() const;
void setInputStringAsUtf16(const ucstring &str); void setInputStringAsUtf16(const ucstring &str);
ucstring getInputStringAsUtf16() const; ucstring getInputStringAsUtf16() const;
void setInputStringAsUtf32(const u32string &str);
u32string getInputStringAsUtf32() const { return _InputString; }
void setColor(NLMISC::CRGBA col); void setColor(NLMISC::CRGBA col);
@ -189,7 +189,7 @@ namespace NLGUI
REFLECT_LUA_METHOD("setSelectionAll", luaSetSelectionAll); REFLECT_LUA_METHOD("setSelectionAll", luaSetSelectionAll);
REFLECT_LUA_METHOD("setFocusOnText", luaSetFocusOnText); REFLECT_LUA_METHOD("setFocusOnText", luaSetFocusOnText);
REFLECT_LUA_METHOD("cancelFocusOnText", luaCancelFocusOnText); REFLECT_LUA_METHOD("cancelFocusOnText", luaCancelFocusOnText);
REFLECT_STRING("input_string", getInputStringAsUtf8, setInputStringAsUtf8); REFLECT_STRING("input_string", getInputString, setInputString);
REFLECT_UCSTRING("uc_input_string", getInputStringAsUtf16, setInputStringAsUtf16); REFLECT_UCSTRING("uc_input_string", getInputStringAsUtf16, setInputStringAsUtf16);
REFLECT_EXPORT_END REFLECT_EXPORT_END

@ -1,8 +1,7 @@
FILE(GLOB SRC *.cpp *.h) FILE(GLOB SRC *.cpp *.h)
FILE(GLOB HEADERS ../../include/nel/gui/*.h) FILE(GLOB HEADERS ../../include/nel/gui/*.h)
SOURCE_GROUP("include" FILES ${HEADERS}) SOURCE_GROUP("" FILES ${HEADERS} ${SRC})
SOURCE_GROUP("src" FILES ${SRC})
NL_TARGET_LIB(nelgui ${SRC} ${HEADERS}) NL_TARGET_LIB(nelgui ${SRC} ${HEADERS})

@ -1015,7 +1015,7 @@ namespace NLGUI
_CursorAtPreviousLineEnd = false; _CursorAtPreviousLineEnd = false;
if (_ClearOnEscape) if (_ClearOnEscape)
{ {
setInputString(u32string()); setInputStringAsUtf32(u32string());
triggerOnChangeAH(); triggerOnChangeAH();
} }
CWidgetManager::getInstance()->setCaptureKeyboard(NULL); CWidgetManager::getInstance()->setCaptureKeyboard(NULL);
@ -1179,7 +1179,7 @@ namespace NLGUI
if (CWidgetManager::getInstance()->getCaptureKeyboard() != this) return false; if (CWidgetManager::getInstance()->getCaptureKeyboard() != this) return false;
if (!_CanUndo) return false; if (!_CanUndo) return false;
_ModifiedInputString = _InputString; _ModifiedInputString = _InputString;
setInputString(_StartInputString); setInputStringAsUtf32(_StartInputString);
_CanUndo = false; _CanUndo = false;
_CanRedo = true; _CanRedo = true;
setCursorPos((sint32)_InputString.length()); setCursorPos((sint32)_InputString.length());
@ -1192,7 +1192,7 @@ namespace NLGUI
{ {
if (CWidgetManager::getInstance()->getCaptureKeyboard() != this) return false; if (CWidgetManager::getInstance()->getCaptureKeyboard() != this) return false;
if (!_CanRedo) return false; if (!_CanRedo) return false;
setInputString(_ModifiedInputString); setInputStringAsUtf32(_ModifiedInputString);
_CanUndo = true; _CanUndo = true;
_CanRedo = false; _CanRedo = false;
setCursorPos((sint32)_InputString.length()); setCursorPos((sint32)_InputString.length());
@ -1303,7 +1303,7 @@ namespace NLGUI
default: break; default: break;
} }
// update the text // update the text
setInputString(_InputString); setInputStringAsUtf32(_InputString);
// if event of type char or string, consider handle all of them // if event of type char or string, consider handle all of them
if( rEDK.getKeyEventType()==NLGUI::CEventDescriptorKey::keychar || rEDK.getKeyEventType()==NLGUI::CEventDescriptorKey::keystring ) if( rEDK.getKeyEventType()==NLGUI::CEventDescriptorKey::keychar || rEDK.getKeyEventType()==NLGUI::CEventDescriptorKey::keystring )
@ -1624,8 +1624,13 @@ namespace NLGUI
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void CGroupEditBox::setInputString(const u32string &str) void CGroupEditBox::setInputString(const std::string &str)
{
setInputStringAsUtf32(CUtfStringView(str).toUtf32());
}
void CGroupEditBox::setInputStringAsUtf32(const u32string &str)
{ {
_InputString = str; _InputString = str;
if (_CursorPos > (sint32) str.length()) if (_CursorPos > (sint32) str.length())
@ -1644,43 +1649,42 @@ namespace NLGUI
void CGroupEditBox::setDefaultInputString(const ucstring &str) void CGroupEditBox::setDefaultInputString(const ucstring &str)
{ {
_DefaultInputString= true; _DefaultInputString= true;
setInputString(CUtfStringView(str).toUtf32()); setInputStringAsUtf32(CUtfStringView(str).toUtf32());
} }
// *************************************************************************** // ***************************************************************************
sint32 CGroupEditBox::getInputStringAsInt() const sint32 CGroupEditBox::getInputStringAsInt() const
{ {
sint32 value; sint32 value;
fromString(getInputStringAsUtf8(), value); fromString(getInputString(), value);
return value; return value;
} }
// *************************************************************************** // ***************************************************************************
void CGroupEditBox::setInputStringAsInt(sint32 val) void CGroupEditBox::setInputStringAsInt(sint32 val)
{ {
setInputStringAsUtf8(NLMISC::toString(val)); setInputString(NLMISC::toString(val));
} }
// *************************************************************************** // ***************************************************************************
sint64 CGroupEditBox::getInputStringAsInt64() const sint64 CGroupEditBox::getInputStringAsInt64() const
{ {
sint64 value; sint64 value;
fromString(getInputStringAsUtf8(), value); fromString(getInputString(), value);
return value; return value;
} }
// *************************************************************************** // ***************************************************************************
void CGroupEditBox::setInputStringAsInt64(sint64 val) void CGroupEditBox::setInputStringAsInt64(sint64 val)
{ {
setInputStringAsUtf8(NLMISC::toString(val)); setInputString(NLMISC::toString(val));
} }
// *************************************************************************** // ***************************************************************************
float CGroupEditBox::getInputStringAsFloat() const float CGroupEditBox::getInputStringAsFloat() const
{ {
float value; float value;
fromString(getInputStringAsUtf8(), value); fromString(getInputString(), value);
return value; return value;
} }
@ -1688,7 +1692,7 @@ namespace NLGUI
void CGroupEditBox::setInputStringAsFloat(float val) void CGroupEditBox::setInputStringAsFloat(float val)
{ {
string fmt= "%." + NLMISC::toString(_MaxFloatPrec) + "f"; string fmt= "%." + NLMISC::toString(_MaxFloatPrec) + "f";
setInputStringAsUtf8(NLMISC::toString(fmt.c_str(), val)); setInputString(NLMISC::toString(fmt.c_str(), val));
} }
// *************************************************************************** // ***************************************************************************
@ -1739,21 +1743,15 @@ namespace NLGUI
} }
// *************************************************************************** // ***************************************************************************
void CGroupEditBox::setInputStringAsUtf8(const std::string &str) std::string CGroupEditBox::getInputString() const
{
setInputString(CUtfStringView(str).toUtf32());
}
// ***************************************************************************
std::string CGroupEditBox::getInputStringAsUtf8() const
{ {
return CUtfStringView(_InputString).toUtf8(); return NLMISC::CUtfStringView(_InputString).toUtf8();
} }
// *************************************************************************** // ***************************************************************************
void CGroupEditBox::setInputStringAsUtf16(const ucstring &str) void CGroupEditBox::setInputStringAsUtf16(const ucstring &str)
{ {
setInputString(CUtfStringView(str).toUtf32()); setInputStringAsUtf32(CUtfStringView(str).toUtf32());
} }
// *************************************************************************** // ***************************************************************************
@ -1770,7 +1768,7 @@ namespace NLGUI
return; return;
// set the string and maybe execute // set the string and maybe execute
setInputString(CUtfStringView((ucchar) '/' + command).toUtf32()); setInputStringAsUtf16((ucchar) '/' + command);
if (execute) if (execute)
{ {
// stop selection // stop selection
@ -1853,7 +1851,7 @@ namespace NLGUI
f.serial(_PrevNumLine); f.serial(_PrevNumLine);
if (f.isReading()) if (f.isReading())
{ {
setInputString(_InputString); setInputStringAsUtf32(_InputString);
} }
// serial selection // serial selection
@ -1870,7 +1868,7 @@ namespace NLGUI
void CGroupEditBox::onQuit() void CGroupEditBox::onQuit()
{ {
// clear the text and restore backup pos before final save // clear the text and restore backup pos before final save
setInputString(u32string()); setInputStringAsUtf32(u32string());
_CurrSelection = NULL; _CurrSelection = NULL;
} }
@ -1878,7 +1876,7 @@ namespace NLGUI
void CGroupEditBox::onLoadConfig() void CGroupEditBox::onLoadConfig()
{ {
// config is not saved when there's an empty string, so restore that default state. // config is not saved when there's an empty string, so restore that default state.
setInputString(u32string()); setInputStringAsUtf32(u32string());
_CurrSelection = NULL; _CurrSelection = NULL;
_PrevNumLine = 1; _PrevNumLine = 1;
} }
@ -1893,7 +1891,7 @@ namespace NLGUI
if (_DefaultInputString) if (_DefaultInputString)
{ {
_DefaultInputString= false; _DefaultInputString= false;
setInputString(u32string()); setInputStringAsUtf32(u32string());
} }
_CanRedo = false; _CanRedo = false;
_CanUndo = false; _CanUndo = false;

@ -3024,7 +3024,7 @@ namespace NLGUI
CGroupEditBox *eb = dynamic_cast<CGroupEditBox*>(textArea->getGroup("eb")); CGroupEditBox *eb = dynamic_cast<CGroupEditBox*>(textArea->getGroup("eb"));
if (eb) if (eb)
{ {
eb->setInputString(CUtfStringView(decodeHTMLEntities(content)).toUtf32()); eb->setInputString(CUtfStringView(decodeHTMLEntities(content)).toUtf8());
if (style.hasStyle("background-color")) if (style.hasStyle("background-color"))
{ {
CViewBitmap *bg = dynamic_cast<CViewBitmap*>(eb->getView("bg")); CViewBitmap *bg = dynamic_cast<CViewBitmap*>(eb->getView("bg"));

@ -2977,7 +2977,7 @@ class CAHLoadScenario : public IActionHandler
{ {
CGroupEditBox* editBox = dynamic_cast<CGroupEditBox*>(result); CGroupEditBox* editBox = dynamic_cast<CGroupEditBox*>(result);
if(editBox) if(editBox)
description = editBox->getInputStringAsUtf8(); description = editBox->getInputString();
} }
// races // races

@ -639,8 +639,7 @@ class CAHEditExpandOrCycleTell : public CAHEdit
void actionPart () void actionPart ()
{ {
// If the line starts with '/tell ', do not try to expand // If the line starts with '/tell ', do not try to expand
static const u32string TELL_STR(CUtfStringView("/tell ").toUtf32()); if (!NLMISC::startsWith(_GroupEdit->getInputString(), "/tell "))
if (_GroupEdit->getInputString().substr(0, TELL_STR.length()) != TELL_STR)
{ {
if (_GroupEdit->expand()) return; if (_GroupEdit->expand()) return;
} }

@ -239,8 +239,8 @@ void CInterfaceItemEdition::CItemEditionWindow::begin()
closeButton->setActive(false); closeButton->setActive(false);
group->setActive(true); group->setActive(true);
editBoxShort->setInputString(u32string()); editBoxShort->setInputString(std::string());
editBoxLarge->setInputString(u32string()); editBoxLarge->setInputString(std::string());
display->setTextFormatTaged(ucstring()); display->setTextFormatTaged(ucstring());
@ -297,8 +297,8 @@ void CInterfaceItemEdition::CItemEditionWindow::begin()
closeButton->setActive(true); closeButton->setActive(true);
group->setActive(false); group->setActive(false);
editBoxShort->setInputString(u32string()); editBoxShort->setInputString(std::string());
editBoxLarge->setInputString(u32string()); editBoxLarge->setInputString(std::string());
display->setTextFormatTaged(ucstring()); display->setTextFormatTaged(ucstring());
// Finish the display or add the waiter // Finish the display or add the waiter

@ -718,7 +718,7 @@ void CActionPhraseFaber::startMpSelection(uint itemReqLine, uint mpSlot)
if (eb) if (eb)
{ {
CWidgetManager::getInstance()->setCaptureKeyboard(eb); CWidgetManager::getInstance()->setCaptureKeyboard(eb);
eb->setInputStringAsUtf8(toString(maxQuantity)); eb->setInputString(toString(maxQuantity));
eb->setSelectionAll(); eb->setSelectionAll();
} }
} }

@ -333,7 +333,7 @@ uint32 CBotChatPageTrade::getCurrItemQuantity() const
CGroupEditBox *ed = dynamic_cast<CGroupEditBox *>(ig->getGroup("header_opened:standard_price:quantity:edit:eb")); CGroupEditBox *ed = dynamic_cast<CGroupEditBox *>(ig->getGroup("header_opened:standard_price:quantity:edit:eb"));
if (!ed) return std::numeric_limits<uint32>::max(); if (!ed) return std::numeric_limits<uint32>::max();
uint32 intQuantity; uint32 intQuantity;
if (fromString(ed->getInputStringAsUtf8(), intQuantity)) if (fromString(ed->getInputString(), intQuantity))
{ {
return intQuantity; return intQuantity;
} }
@ -1465,7 +1465,7 @@ void CBotChatPageTrade::setupPriceGroupQuantity(CInterfaceGroup *priceGroup, sin
CGroupEditBox *eb = dynamic_cast<CGroupEditBox *>(quantityGroup->getGroup("edit:eb")); CGroupEditBox *eb = dynamic_cast<CGroupEditBox *>(quantityGroup->getGroup("edit:eb"));
if (eb) if (eb)
{ {
eb->setInputStringAsUtf8(toString(defaultQuantity)); eb->setInputString(toString(defaultQuantity));
} }
} }
} }
@ -1569,7 +1569,7 @@ void CBotChatPageTrade::setupResellGroup(bool sellMode, uint defaultQuantity, CI
{ {
sint32 resaleMargin= NLGUI::CDBManager::getInstance()->getDbProp( "UI:SAVE:TRADE_ITEM:RESALE_MARGIN" )->getValue32(); sint32 resaleMargin= NLGUI::CDBManager::getInstance()->getDbProp( "UI:SAVE:TRADE_ITEM:RESALE_MARGIN" )->getValue32();
clamp(resaleMargin, 0, (sint32)MaxResaleMargin); clamp(resaleMargin, 0, (sint32)MaxResaleMargin);
eb->setInputStringAsUtf8( toString( resaleMargin ) ); eb->setInputString( toString( resaleMargin ) );
eb->setPositiveIntegerMaxValue(MaxResaleMargin); eb->setPositiveIntegerMaxValue(MaxResaleMargin);
} }
} }
@ -1725,8 +1725,8 @@ void CBotChatPageTrade::startChangeBuyFilterDialog(const std::string &dbext, con
sint rangeMax= 0; sint rangeMax= 0;
if(dbRangeMin) rangeMin= dbRangeMin->getValue32(); if(dbRangeMin) rangeMin= dbRangeMin->getValue32();
if(dbRangeMax) rangeMax= dbRangeMax->getValue32(); if(dbRangeMax) rangeMax= dbRangeMax->getValue32();
if(edMin) edMin->setInputStringAsUtf8(toString(rangeMin)); if(edMin) edMin->setInputString(toString(rangeMin));
if(edMax) edMax->setInputStringAsUtf8(toString(rangeMax)); if(edMax) edMax->setInputString(toString(rangeMax));
if(edMin) edMin->setPositiveIntegerMaxValue(maxValue); if(edMin) edMin->setPositiveIntegerMaxValue(maxValue);
if(edMax) edMax->setPositiveIntegerMaxValue(maxValue); if(edMax) edMax->setPositiveIntegerMaxValue(maxValue);
@ -1754,8 +1754,8 @@ void CBotChatPageTrade::resetBuyFilterDialog()
sint rangeMin= 0; sint rangeMin= 0;
sint rangeMax= _FilterBuyDlgMaxValue; sint rangeMax= _FilterBuyDlgMaxValue;
// write result in EditBox, and in db // write result in EditBox, and in db
if(edMin) edMin->setInputStringAsUtf8(toString(rangeMin)); if(edMin) edMin->setInputString(toString(rangeMin));
if(edMax) edMax->setInputStringAsUtf8(toString(rangeMax)); if(edMax) edMax->setInputString(toString(rangeMax));
if(dbRangeMin) dbRangeMin->setValue32(rangeMin); if(dbRangeMin) dbRangeMin->setValue32(rangeMin);
if(dbRangeMax) dbRangeMax->setValue32(rangeMax); if(dbRangeMax) dbRangeMax->setValue32(rangeMax);

@ -1289,7 +1289,7 @@ public:
// Parse any tokens in the text // Parse any tokens in the text
if ( ! CInterfaceManager::parseTokens(text)) if ( ! CInterfaceManager::parseTokens(text))
{ {
pEB->setInputString (u32string()); pEB->setInputString(std::string());
return; return;
} }
@ -1329,7 +1329,7 @@ public:
} }
} }
// Clear input string // Clear input string
pEB->setInputString (u32string()); pEB->setInputString (std::string());
CGroupContainer *gc = static_cast< CGroupContainer* >( pEB->getEnclosingContainer() ); CGroupContainer *gc = static_cast< CGroupContainer* >( pEB->getEnclosingContainer() );
if (gc) if (gc)

@ -279,7 +279,7 @@ void CDBGroupBuildPhrase::clearBuildingPhrase()
// Empty the name // Empty the name
if(_UserSentenceName) if(_UserSentenceName)
{ {
_UserSentenceName->setInputString(u32string()); _UserSentenceName->setInputString(std::string());
} }
// update Display // update Display

@ -3882,7 +3882,7 @@ class CAHLandMarkFilter : public IActionHandler
CGroupEditBox* eb = dynamic_cast<CGroupEditBox*>(CWidgetManager::getInstance()->getElementFromId(group)); CGroupEditBox* eb = dynamic_cast<CGroupEditBox*>(CWidgetManager::getInstance()->getElementFromId(group));
if (!eb) return; if (!eb) return;
text = eb->getInputStringAsUtf8(); text = eb->getInputString();
} }
map->setLandmarkFilter(text); map->setLandmarkFilter(text);

@ -679,7 +679,7 @@ void CModalContainerEditCmd::activateFrom (const std::string &cmdName, const std
else sEditBox = WinName+WIN_EDITCMD_COMBO_SECOND_PARAM_EDITBOX; else sEditBox = WinName+WIN_EDITCMD_COMBO_SECOND_PARAM_EDITBOX;
CGroupEditBox *pEB = dynamic_cast<CGroupEditBox*>(CWidgetManager::getInstance()->getElementFromId(sEditBox)); CGroupEditBox *pEB = dynamic_cast<CGroupEditBox*>(CWidgetManager::getInstance()->getElementFromId(sEditBox));
// sTmp is utf8 // sTmp is utf8
pEB->setInputStringAsUtf8(sTmp); pEB->setInputString(sTmp);
} }
// Setup the param name if any // Setup the param name if any
@ -863,7 +863,7 @@ void CModalContainerEditCmd::validCurrentCommand()
CGroupEditBox *pEB= dynamic_cast<CGroupEditBox*>(CWidgetManager::getInstance()->getElementFromId( sWin )); CGroupEditBox *pEB= dynamic_cast<CGroupEditBox*>(CWidgetManager::getInstance()->getElementFromId( sWin ));
// convert to utf8 // convert to utf8
if (pEB != NULL) if (pEB != NULL)
CurrentEditCmdLine.ActionName.Argu += pEB->getInputStringAsUtf8(); CurrentEditCmdLine.ActionName.Argu += pEB->getInputString();
noParam++; noParam++;
} }
} }
@ -1148,7 +1148,7 @@ void CModalContainerEditCmd::onChangeAction()
CGroupEditBox *pEB= dynamic_cast<CGroupEditBox*>(CWidgetManager::getInstance()->getElementFromId( sWin )); CGroupEditBox *pEB= dynamic_cast<CGroupEditBox*>(CWidgetManager::getInstance()->getElementFromId( sWin ));
if( pEB ) if( pEB )
{ {
pEB->setInputString(u32string()); pEB->setInputString(std::string());
} }
NLGUI::CDBManager::getInstance()->getDbProp( sDB )->setValue32(1); NLGUI::CDBManager::getInstance()->getDbProp( sDB )->setValue32(1);
} }

@ -636,7 +636,7 @@ public:
CDBCtrlSheet *pCS = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(Params)); CDBCtrlSheet *pCS = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(Params));
if (pCS == NULL) return; if (pCS == NULL) return;
pCS->setMacroText(pEB->getInputStringAsUtf8()); pCS->setMacroText(pEB->getInputString());
} }
}; };
REGISTER_ACTION_HANDLER( CHandlerEBUpdateMacroText, "eb_update_macro_text"); REGISTER_ACTION_HANDLER( CHandlerEBUpdateMacroText, "eb_update_macro_text");
@ -703,10 +703,10 @@ public:
CGroupEditBox *pEB = dynamic_cast<CGroupEditBox*>(CWidgetManager::getInstance()->getElementFromId(CTRL_MACROICONCREATION_EDITTEXT)); CGroupEditBox *pEB = dynamic_cast<CGroupEditBox*>(CWidgetManager::getInstance()->getElementFromId(CTRL_MACROICONCREATION_EDITTEXT));
if (pEB != NULL) if (pEB != NULL)
{ {
pEB->setInputStringAsUtf8(pMCM->CurrentEditMacro.DispText); pEB->setInputString(pMCM->CurrentEditMacro.DispText);
CDBCtrlSheet *pCS = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_MACROICONCREATION_ICON)); CDBCtrlSheet *pCS = dynamic_cast<CDBCtrlSheet*>(CWidgetManager::getInstance()->getElementFromId(CTRL_MACROICONCREATION_ICON));
if (pCS != NULL) if (pCS != NULL)
pCS->setMacroText(pEB->getInputStringAsUtf8()); pCS->setMacroText(pEB->getInputString());
} }
CAHManager::getInstance()->runActionHandler("set_macro_back", NULL, string("target=")+CTRL_MACROICONCREATION_ICON+"|value="+toString(back)); CAHManager::getInstance()->runActionHandler("set_macro_back", NULL, string("target=")+CTRL_MACROICONCREATION_ICON+"|value="+toString(back));
@ -862,11 +862,11 @@ public:
if (pEB == NULL) return; if (pEB == NULL) return;
CMacroCmdManager *pMCM = CMacroCmdManager::getInstance(); CMacroCmdManager *pMCM = CMacroCmdManager::getInstance();
pMCM->CurrentEditMacro.Name = pEB->getInputStringAsUtf8(); pMCM->CurrentEditMacro.Name = pEB->getInputString();
if ((pMCM->CurrentEditMacro.Name.size() >= 2) && if ((pMCM->CurrentEditMacro.Name.size() >= 2) &&
(pMCM->CurrentEditMacro.Name[0] == 'u') && (pMCM->CurrentEditMacro.Name[1] == 'i')) (pMCM->CurrentEditMacro.Name[0] == 'u') && (pMCM->CurrentEditMacro.Name[1] == 'i'))
pMCM->CurrentEditMacro.Name[0] = 'U'; pMCM->CurrentEditMacro.Name[0] = 'U';
pEB->setInputStringAsUtf8(pMCM->CurrentEditMacro.Name); pEB->setInputString(pMCM->CurrentEditMacro.Name);
} }
}; };
REGISTER_ACTION_HANDLER( CHandlerNewMacroEnterName, "new_macro_enter_name"); REGISTER_ACTION_HANDLER( CHandlerNewMacroEnterName, "new_macro_enter_name");
@ -886,7 +886,7 @@ public:
if (pCS != NULL) pCS->readFromMacro(pMCM->CurrentEditMacro); if (pCS != NULL) pCS->readFromMacro(pMCM->CurrentEditMacro);
// Name // Name
CGroupEditBox *pEB = dynamic_cast<CGroupEditBox*>(CWidgetManager::getInstance()->getElementFromId(GROUP_NEWMACRO_EDIT_NAME)); CGroupEditBox *pEB = dynamic_cast<CGroupEditBox*>(CWidgetManager::getInstance()->getElementFromId(GROUP_NEWMACRO_EDIT_NAME));
if (pEB != NULL) pEB->setInputStringAsUtf8(pMCM->CurrentEditMacro.Name); if (pEB != NULL) pEB->setInputString(pMCM->CurrentEditMacro.Name);
// Commands // Commands
CGroupList *pList = dynamic_cast<CGroupList*>(CWidgetManager::getInstance()->getElementFromId(GROUP_NEWMACRO_COMMANDS)); CGroupList *pList = dynamic_cast<CGroupList*>(CWidgetManager::getInstance()->getElementFromId(GROUP_NEWMACRO_COMMANDS));
if (pList == NULL) return; if (pList == NULL) return;

@ -2199,7 +2199,7 @@ public:
if (gc) if (gc)
{ {
CGroupEditBox *geb = dynamic_cast<CGroupEditBox *>(gc->getGroup("add_contact_eb:eb")); CGroupEditBox *geb = dynamic_cast<CGroupEditBox *>(gc->getGroup("add_contact_eb:eb"));
geb->setInputString(u32string()); geb->setInputString(std::string());
} }
CAHManager::getInstance()->runActionHandler("enter_modal", pCaller, sParams); CAHManager::getInstance()->runActionHandler("enter_modal", pCaller, sParams);
} }
@ -2257,11 +2257,11 @@ public:
else else
{ {
PeopleInterraction.askAddContact(geb->getInputStringAsUtf16(), peopleList); PeopleInterraction.askAddContact(geb->getInputStringAsUtf16(), peopleList);
geb->setInputString(u32string()); geb->setInputString(std::string());
} }
} }
} }
geb->setInputString(u32string()); geb->setInputString(std::string());
} }
} }
} }
@ -2389,7 +2389,7 @@ public:
if (eb) if (eb)
{ {
CWidgetManager::getInstance()->setCaptureKeyboard(eb); CWidgetManager::getInstance()->setCaptureKeyboard(eb);
eb->setInputString(u32string()); eb->setInputString(std::string());
} }
// //
if (gc->getActive()) if (gc->getActive())

@ -884,7 +884,7 @@ class CHandlerContactEntry : public IActionHandler
// Parse any tokens in the text // Parse any tokens in the text
if ( ! CInterfaceManager::parseTokens(text)) if ( ! CInterfaceManager::parseTokens(text))
{ {
pEB->setInputString (u32string()); pEB->setInputString (std::string());
return; return;
} }
@ -895,7 +895,7 @@ class CHandlerContactEntry : public IActionHandler
// TODO : have NLMISC::ICommand accept unicode strings // TODO : have NLMISC::ICommand accept unicode strings
std::string str = text.toUtf8().substr(1); std::string str = text.toUtf8().substr(1);
NLMISC::ICommand::execute( str, g_log ); NLMISC::ICommand::execute( str, g_log );
pEB->setInputString (u32string()); pEB->setInputString (std::string());
return; return;
} }
// Well, we could have used CChatWindow class to handle this, but CPeopleList was written earlier, so for now // Well, we could have used CChatWindow class to handle this, but CPeopleList was written earlier, so for now
@ -908,7 +908,7 @@ class CHandlerContactEntry : public IActionHandler
// Simply do a tell on the player // Simply do a tell on the player
ChatMngr.tell(playerName.toString(), text); ChatMngr.tell(playerName.toString(), text);
pEB->setInputString (u32string()); pEB->setInputString (std::string());
if (gc) if (gc)
{ {
// Restore position of enclosing container if it hasn't been moved/scaled/poped by the user // Restore position of enclosing container if it hasn't been moved/scaled/poped by the user

@ -808,7 +808,7 @@ void initLoginScreen()
CGroupEditBox *pGEB = dynamic_cast<CGroupEditBox*>(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_LOGIN)); CGroupEditBox *pGEB = dynamic_cast<CGroupEditBox*>(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_LOGIN));
if (pGEB != NULL && (pGEB->getInputString().empty())) if (pGEB != NULL && (pGEB->getInputString().empty()))
{ {
pGEB->setInputStringAsUtf8(l); pGEB->setInputString(l);
} }
CAHManager::getInstance()->runActionHandler("set_keyboard_focus", NULL, "target=" CTRL_EDITBOX_PASSWORD "|select_all=false"); CAHManager::getInstance()->runActionHandler("set_keyboard_focus", NULL, "target=" CTRL_EDITBOX_PASSWORD "|select_all=false");
} }
@ -830,8 +830,8 @@ void initAutoLogin()
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
CGroupEditBox *pGEBLog = dynamic_cast<CGroupEditBox*>(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_LOGIN)); CGroupEditBox *pGEBLog = dynamic_cast<CGroupEditBox*>(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_LOGIN));
CGroupEditBox *pGEBPwd = dynamic_cast<CGroupEditBox*>(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_PASSWORD)); CGroupEditBox *pGEBPwd = dynamic_cast<CGroupEditBox*>(CWidgetManager::getInstance()->getElementFromId(CTRL_EDITBOX_PASSWORD));
pGEBLog->setInputStringAsUtf8(LoginLogin); pGEBLog->setInputString(LoginLogin);
pGEBPwd->setInputStringAsUtf8(LoginPassword); pGEBPwd->setInputString(LoginPassword);
CAHManager::getInstance()->runActionHandler("on_login", NULL, ""); CAHManager::getInstance()->runActionHandler("on_login", NULL, "");
if (ClientCfg.R2Mode) if (ClientCfg.R2Mode)
@ -1379,8 +1379,8 @@ class CAHOnLogin : public IActionHandler
return; return;
} }
LoginLogin = pGEBLog->getInputStringAsUtf8(); LoginLogin = pGEBLog->getInputString();
LoginPassword = pGEBPwd->getInputStringAsUtf8(); LoginPassword = pGEBPwd->getInputString();
onlogin(); onlogin();
} }
@ -2394,7 +2394,7 @@ bool initCreateAccount()
{ {
CGroupEditBox * eb = dynamic_cast<CGroupEditBox*>(createAccountUI->findFromShortId(editBoxes[i] + ":eb")); CGroupEditBox * eb = dynamic_cast<CGroupEditBox*>(createAccountUI->findFromShortId(editBoxes[i] + ":eb"));
if(eb) if(eb)
eb->setInputString(u32string()); eb->setInputString(std::string());
} }
// conditions button // conditions button
@ -2581,7 +2581,7 @@ class CAHOnCreateAccountSubmit : public IActionHandler
{ {
CGroupEditBox * eb = dynamic_cast<CGroupEditBox*>(createAccountUI->findFromShortId(editBoxes[i] + ":eb")); CGroupEditBox * eb = dynamic_cast<CGroupEditBox*>(createAccountUI->findFromShortId(editBoxes[i] + ":eb"));
if(eb) if(eb)
results[i] = eb->getInputStringAsUtf8(); results[i] = eb->getInputString();
} }
// text // text
@ -2735,11 +2735,11 @@ class CAHCreateAccountLogin : public IActionHandler
{ {
CGroupEditBox * eb = dynamic_cast<CGroupEditBox*>(createAccountUI->findFromShortId("eb_login:eb")); CGroupEditBox * eb = dynamic_cast<CGroupEditBox*>(createAccountUI->findFromShortId("eb_login:eb"));
if(eb) if(eb)
LoginLogin = eb->getInputStringAsUtf8(); LoginLogin = eb->getInputString();
eb = dynamic_cast<CGroupEditBox*>(createAccountUI->findFromShortId("eb_password:eb")); eb = dynamic_cast<CGroupEditBox*>(createAccountUI->findFromShortId("eb_password:eb"));
if(eb) if(eb)
LoginPassword = eb->getInputStringAsUtf8(); LoginPassword = eb->getInputString();
onlogin(false); onlogin(false);
} }

@ -7484,7 +7484,7 @@ class CAHInviteCharacter : public IActionHandler
CGroupEditBox *geb = dynamic_cast<CGroupEditBox *>(fatherGC->getGroup("add_contact_eb:eb")); CGroupEditBox *geb = dynamic_cast<CGroupEditBox *>(fatherGC->getGroup("add_contact_eb:eb"));
if (geb && !geb->getInputString().empty()) if (geb && !geb->getInputString().empty())
{ {
string charName = geb->getInputStringAsUtf8(); string charName = geb->getInputString();
CSessionBrowserImpl & sessionBrowser = CSessionBrowserImpl::getInstance(); CSessionBrowserImpl & sessionBrowser = CSessionBrowserImpl::getInstance();
sessionBrowser.inviteCharacterByName(sessionBrowser.getCharId(), charName); sessionBrowser.inviteCharacterByName(sessionBrowser.getCharId(), charName);
@ -7506,7 +7506,7 @@ class CAHInviteCharacter : public IActionHandler
CAHManager::getInstance()->runActionHandler("enter_modal", pCaller, "group=ui:interface:warning_newcomer"); CAHManager::getInstance()->runActionHandler("enter_modal", pCaller, "group=ui:interface:warning_newcomer");
} }
geb->setInputString(u32string()); geb->setInputString(std::string());
} }
} }
} }

Loading…
Cancel
Save