kaetemi 4 years ago
parent 079f9dff25
commit 0b191bc6db

@ -96,8 +96,10 @@ namespace NLGUI
bool getTextModulateGlobalColorOver() const {return _TextModulateGlobalColorOver;} bool getTextModulateGlobalColorOver() const {return _TextModulateGlobalColorOver;}
void setTextModulateGlobalColorOver(bool v) {_TextModulateGlobalColorOver= v;} void setTextModulateGlobalColorOver(bool v) {_TextModulateGlobalColorOver= v;}
// Set text (noop if text id) // Set text (noop if text id)
void setText (const ucstring &text); void setText (const std::string &text);
ucstring getText () const; std::string getText () const;
void setTextAsUtf16 (const ucstring &text);
ucstring getTextAsUtf16 () const;
void setHardText (const std::string &text); void setHardText (const std::string &text);
std::string getHardText () const; std::string getHardText () const;
@ -130,7 +132,7 @@ namespace NLGUI
int luaGetViewText(CLuaState &ls); int luaGetViewText(CLuaState &ls);
REFLECT_EXPORT_START(CCtrlTextButton, CCtrlBaseButton) REFLECT_EXPORT_START(CCtrlTextButton, CCtrlBaseButton)
REFLECT_UCSTRING("uc_hardtext", getText, setText); REFLECT_UCSTRING("uc_hardtext", getTextAsUtf16, setTextAsUtf16);
REFLECT_STRING("hardtext", getHardText, setHardText); REFLECT_STRING("hardtext", getHardText, setHardText);
REFLECT_SINT32("text_x", getTextX, setTextX) REFLECT_SINT32("text_x", getTextX, setTextX)
REFLECT_SINT32("wmargin", getWMargin, setWMargin) REFLECT_SINT32("wmargin", getWMargin, setWMargin)

@ -477,8 +477,8 @@ namespace NLGUI
float _CurrentRolloverAlphaContainer; float _CurrentRolloverAlphaContainer;
float _CurrentRolloverAlphaContent; float _CurrentRolloverAlphaContent;
sint32 _LayerSetup; sint32 _LayerSetup;
ucstring _TitleTextOpened; std::string _TitleTextOpened;
ucstring _TitleTextClosed; std::string _TitleTextClosed;
CViewText *_TitleOpened; CViewText *_TitleOpened;
CViewText *_TitleClosed; CViewText *_TitleClosed;
sint32 _TitleDeltaMaxW; sint32 _TitleDeltaMaxW;

@ -67,13 +67,13 @@ namespace NLGUI
* \param line : text to be added * \param line : text to be added
* \param color : text color * \param color : text color
*/ */
void addTextChild (const ucstring& line,const NLMISC::CRGBA &textColor, bool multiLine = true); void addTextChild (const std::string& line,const NLMISC::CRGBA &textColor, bool multiLine = true);
/** /**
* add a text child element to the group, using the text template * add a text child element to the group, using the text template
* \param line : text to be added * \param line : text to be added
*/ */
void addTextChild (const ucstring& line, bool multiLine = true); void addTextChild (const std::string& line, bool multiLine = true);
/// Same as adding a text child but the text will be taken from the string manager /// Same as adding a text child but the text will be taken from the string manager
void addTextChildID (uint32 id, bool multiLine = true); void addTextChildID (uint32 id, bool multiLine = true);

@ -122,12 +122,12 @@ namespace NLGUI
// retrieve the index of a line from its id (-1 if not found) // retrieve the index of a line from its id (-1 if not found)
sint getLineFromId(const std::string &id); sint getLineFromId(const std::string &id);
CViewTextMenu* addLine (const ucstring &name, const std::string &ah, CViewTextMenu* addLine (const std::string &name, const std::string &ah,
const std::string &params, const std::string &id="", const std::string &params, const std::string &id="",
const std::string &cond = std::string(), const std::string &texture="", const std::string &cond = std::string(), const std::string &texture="",
bool checkable = false, bool checked = false, bool formatted = false bool checkable = false, bool checked = false, bool formatted = false
); );
CViewTextMenu* addLineAtIndex(uint index, const ucstring &name, const std::string &ah, CViewTextMenu* addLineAtIndex(uint index, const std::string &name, const std::string &ah,
const std::string &params, const std::string &id="", const std::string &params, const std::string &id="",
const std::string &cond = std::string(), const std::string &texture="", const std::string &cond = std::string(), const std::string &texture="",
bool checkable = false, bool checked = false, bool formatted = false bool checkable = false, bool checked = false, bool formatted = false
@ -333,11 +333,6 @@ namespace NLGUI
virtual bool isWindowUnder (sint32 x, sint32 y); virtual bool isWindowUnder (sint32 x, sint32 y);
// add line with a string, for backward compatibility
void addLine (const std::string &name, const std::string &ah, const std::string &params,
const std::string &id = std::string(),
const std::string &cond = std::string(), const std::string &texture="",
bool checkable = false, bool checked = false);
uint getNumLine() const; uint getNumLine() const;
void deleteLine(uint index); void deleteLine(uint index);
const std::string getActionHandler(uint lineIndex) const; const std::string getActionHandler(uint lineIndex) const;
@ -350,12 +345,12 @@ namespace NLGUI
void setRightClickHandler(uint lineIndex, const std::string &ah = ""); void setRightClickHandler(uint lineIndex, const std::string &ah = "");
void setRightClickHandlerParam(uint lineIndex, const std::string &params = ""); void setRightClickHandlerParam(uint lineIndex, const std::string &params = "");
void addLine (const ucstring &name, const std::string &ah = "", const std::string &params = "", void addLine (const std::string &name, const std::string &ah = "", const std::string &params = "",
const std::string &id = std::string(), const std::string &id = std::string(),
const std::string &cond = std::string(), const std::string &texture="", const std::string &cond = std::string(), const std::string &texture="",
bool checkable = false, bool checked = false bool checkable = false, bool checked = false
); );
void addLineAtIndex (uint index, const ucstring &name, const std::string &ah = "", const std::string &params = "", void addLineAtIndex (uint index, const std::string &name, const std::string &ah = "", const std::string &params = "",
const std::string &id = std::string(), const std::string &id = std::string(),
const std::string &cond = std::string(), const std::string &texture="", const std::string &cond = std::string(), const std::string &texture="",
bool checkable = false, bool checked = false bool checkable = false, bool checked = false

@ -84,13 +84,13 @@ namespace NLGUI
* \param line : text to be added * \param line : text to be added
* \param color : text color * \param color : text color
*/ */
void addTextChild (const ucstring& line,const NLMISC::CRGBA &textColor, bool multiLine = true); void addTextChild (const std::string& line,const NLMISC::CRGBA &textColor, bool multiLine = true);
/** /**
* add a text child element to the group, using the text template * add a text child element to the group, using the text template
* \param line : text to be added * \param line : text to be added
*/ */
void addTextChild (const ucstring& line, bool multiLine = true); void addTextChild (const std::string& line, bool multiLine = true);
/// Same as adding a text child but the text will be taken from the string manager /// Same as adding a text child but the text will be taken from the string manager
void addTextChildID (uint32 id, bool multiLine = true); void addTextChildID (uint32 id, bool multiLine = true);

@ -60,7 +60,7 @@ namespace NLGUI
bool Show; // If false, the node is not displayed (true default, Root ignored) bool Show; // If false, the node is not displayed (true default, Root ignored)
sint32 YDecal; sint32 YDecal;
// Text // Text
ucstring Text; // Internationalized displayed text std::string Text; // Internationalized displayed text
sint32 FontSize; // If -1 (default), then take the groupTree one sint32 FontSize; // If -1 (default), then take the groupTree one
NLMISC::CRGBA Color; NLMISC::CRGBA Color;
// Template // Template
@ -112,8 +112,10 @@ namespace NLGUI
std::string getBitmap() const { return Bitmap; } std::string getBitmap() const { return Bitmap; }
void setOpened(bool opened) { Opened = opened; } void setOpened(bool opened) { Opened = opened; }
bool getOpened() const { return Opened; } bool getOpened() const { return Opened; }
void setText(const ucstring &text) { Text = text; } void setText(const std::string &text) { Text = text; }
const ucstring& getText() const { return Text; } const std::string& getText() const { return Text; }
void setTextAsUtf16(const ucstring &text) { Text = text.toUtf8(); }
ucstring getTextAsUtf16() const { return ucstring::makeFromUtf8(Text); }
sint32 getFontSize() const { return FontSize; } sint32 getFontSize() const { return FontSize; }
void setFontSize(sint32 value) { FontSize = value; } void setFontSize(sint32 value) { FontSize = value; }
sint32 getYDecal() const { return YDecal; } sint32 getYDecal() const { return YDecal; }
@ -181,7 +183,7 @@ namespace NLGUI
REFLECT_STRING("AHParamsClose", getAHParamsClose, setAHParamsClose); REFLECT_STRING("AHParamsClose", getAHParamsClose, setAHParamsClose);
REFLECT_BOOL("Opened", getOpened, setOpened); REFLECT_BOOL("Opened", getOpened, setOpened);
REFLECT_BOOL("Show", getShow, setShow); REFLECT_BOOL("Show", getShow, setShow);
REFLECT_UCSTRING_REF("Text", getText, setText); REFLECT_UCSTRING("Text", getTextAsUtf16, setTextAsUtf16); // FIXME: Lua UTF-8
// lua // lua
REFLECT_LUA_METHOD("getNumChildren", luaGetNumChildren); REFLECT_LUA_METHOD("getNumChildren", luaGetNumChildren);
REFLECT_LUA_METHOD("getChild", luaGetChild); REFLECT_LUA_METHOD("getChild", luaGetChild);

@ -59,16 +59,14 @@ namespace NLGUI
bool getBool() const; bool getBool() const;
sint64 getInteger() const; sint64 getInteger() const;
double getDouble() const; double getDouble() const;
std::string getString() const; const std::string &getString() const;
NLMISC::CRGBA getRGBA() const; NLMISC::CRGBA getRGBA() const;
const ucstring &getUCString() const;
CInterfaceExprUserType *getUserType() const; CInterfaceExprUserType *getUserType() const;
// set // set
void setBool(bool value) { clean(); _Type = Boolean; _BoolValue = value; } void setBool(bool value) { clean(); _Type = Boolean; _BoolValue = value; }
void setInteger(sint64 value) { clean(); _Type = Integer; _IntegerValue = value; } void setInteger(sint64 value) { clean(); _Type = Integer; _IntegerValue = value; }
void setDouble(double value) { clean(); _Type = Double; _DoubleValue = value; } void setDouble(double value) { clean(); _Type = Double; _DoubleValue = value; }
void setString(const std::string &value) { clean(); _Type = String; _StringValue = value; } void setString(const std::string &value) { clean(); _Type = String; _StringValue = value; }
void setUCString(const ucstring &value) { clean(); _Type = String; _StringValue = value; }
void setRGBA(NLMISC::CRGBA value) { clean(); _Type = RGBA; _RGBAValue = (uint32)(value.R+(value.G<<8)+(value.B<<16)+(value.A<<24)); } void setRGBA(NLMISC::CRGBA value) { clean(); _Type = RGBA; _RGBAValue = (uint32)(value.R+(value.G<<8)+(value.B<<16)+(value.A<<24)); }
void setUserType(CInterfaceExprUserType *value); void setUserType(CInterfaceExprUserType *value);
// reset this object to initial state (no type) // reset this object to initial state (no type)
@ -99,7 +97,7 @@ namespace NLGUI
CInterfaceExprUserType *_UserTypeValue; CInterfaceExprUserType *_UserTypeValue;
uint32 _RGBAValue; uint32 _RGBAValue;
}; };
ucstring _StringValue; // well, can't fit in union, unless we do some horrible hack.. std::string _StringValue; // well, can't fit in union, unless we do some horrible hack..
private: private:
const char *evalBoolean(const char *expr); const char *evalBoolean(const char *expr);
const char *evalNumber(const char *expr); const char *evalNumber(const char *expr);

@ -55,7 +55,7 @@ namespace NLGUI
bool getStringMode() const {return _StringMode;} bool getStringMode() const {return _StringMode;}
// Set cursor string // Set cursor string
void setString (const ucstring &str); void setString (const std::string &str);
// TEMP PATCH // TEMP PATCH
void setCursor (const std::string &name) void setCursor (const std::string &name)
@ -126,14 +126,14 @@ namespace NLGUI
bool _ForceStringMode; bool _ForceStringMode;
CInterfaceGroup *_StringCursor; CInterfaceGroup *_StringCursor;
CInterfaceGroup *_StringCursorHardware; CInterfaceGroup *_StringCursorHardware;
ucstring _ContextString; std::string _ContextString;
// draw current cursor with the given texture, or, if in hardware mode, change the hardware cursor shape // draw current cursor with the given texture, or, if in hardware mode, change the hardware cursor shape
void drawCursor(sint32 texId, NLMISC::CRGBA col, uint8 rot); void drawCursor(sint32 texId, NLMISC::CRGBA col, uint8 rot);
private: private:
// set the string into frame for software or hardware version // set the string into frame for software or hardware version
void setString (const ucstring &str, CInterfaceGroup *target); void setString(const std::string &str, CInterfaceGroup *target);
static bool hwMouse; static bool hwMouse;

@ -465,7 +465,7 @@ namespace NLGUI
void addDontClipWordLine(std::vector<CWord> &currLine); void addDontClipWordLine(std::vector<CWord> &currLine);
// FormatTag build. // FormatTag build.
static void buildFormatTagText(const std::string &text, std::string &textBuild, std::vector<CFormatTag> &formatTags, std::vector<ucstring> &tooltips); static void buildFormatTagText(const std::string &text, std::string &textBuild, std::vector<CFormatTag> &formatTags, std::vector<std::string> &tooltips);
// FormatTag parsing. // FormatTag parsing.
bool isFormatTagChange(uint textIndex, uint ctIndex) const; bool isFormatTagChange(uint textIndex, uint ctIndex) const;
void getFormatTagChange(uint textIndex, uint &ctIndex, CFormatInfo &wordFormat) const; void getFormatTagChange(uint textIndex, uint &ctIndex, CFormatInfo &wordFormat) const;

@ -45,7 +45,7 @@ namespace NLGUI
{ {
public: public:
virtual ~IViewTextFormatter(){} virtual ~IViewTextFormatter(){}
virtual ucstring formatString( const ucstring &inputString, const ucstring &paramString ) = 0; virtual std::string formatString( const std::string &inputString, const std::string &paramString ) = 0;
}; };
CViewTextFormated (const TCtorParam &param) : CViewText(param) CViewTextFormated (const TCtorParam &param) : CViewText(param)
@ -55,15 +55,15 @@ namespace NLGUI
xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const; xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const;
virtual bool parse(xmlNodePtr cur, CInterfaceGroup * parentGroup); virtual bool parse(xmlNodePtr cur, CInterfaceGroup * parentGroup);
virtual void checkCoords(); virtual void checkCoords();
const ucstring &getFormatString() const { return _FormatString; } const std::string &getFormatString() const { return _FormatString; }
void setFormatString(const ucstring &format); void setFormatString(const std::string &format);
static ucstring formatString(const ucstring &inputString, const ucstring &paramString); static std::string formatString(const std::string &inputString, const std::string &paramString);
static void setFormatter( IViewTextFormatter *formatter ){ textFormatter = formatter; } static void setFormatter( IViewTextFormatter *formatter ){ textFormatter = formatter; }
private: private:
ucstring _FormatString; std::string _FormatString;
static IViewTextFormatter *textFormatter; static IViewTextFormatter *textFormatter;
}; };

@ -58,8 +58,10 @@ namespace NLGUI
{ {
public: public:
virtual ~IViewTextProvider(){} virtual ~IViewTextProvider(){}
virtual bool getString( uint32 stringId, ucstring &result ) = 0; bool getString(uint32 stringId, std::string &result) { ucstring temp; bool res = getString(stringId, temp); result = temp.toUtf8(); return res; }
virtual bool getDynString( uint32 dynStringId, ucstring &result ) = 0; bool getDynString(uint32 dynStringId, std::string &result) { ucstring temp; bool res = getDynString(dynStringId, temp); result = temp.toUtf8(); return res; }
virtual bool getString( uint32 stringId, ucstring &result ) = 0; // TODO: UTF-8
virtual bool getDynString( uint32 dynStringId, ucstring &result ) = 0; // TODO: UTF-8
}; };
CViewTextID(const TCtorParam &param) : CViewText(param) CViewTextID(const TCtorParam &param) : CViewText(param)

@ -49,10 +49,10 @@ namespace NLGUI
xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const; xmlNodePtr serialize( xmlNodePtr parentNode, const char *type ) const;
virtual bool parse(xmlNodePtr cur, CInterfaceGroup * parentGroup); virtual bool parse(xmlNodePtr cur, CInterfaceGroup * parentGroup);
virtual void checkCoords(); virtual void checkCoords();
const ucstring &getFormatString() const { return _FormatString; } const std::string &getFormatString() const { return _FormatString; }
void setFormatString(const ucstring &format); void setFormatString(const std::string &format);
private: private:
ucstring _FormatString; std::string _FormatString;
}; };
} }

@ -1041,14 +1041,29 @@ namespace NLGUI
// *************************************************************************** // ***************************************************************************
void CCtrlTextButton::setText (const ucstring &text) void CCtrlTextButton::setText (const std::string &text)
{
if (_ViewText && !_IsViewTextId)
_ViewText->setText(text);
}
// ***************************************************************************
std::string CCtrlTextButton::getText () const
{
if (_ViewText && !_IsViewTextId)
return _ViewText->getText();
return std::string();
}
// ***************************************************************************
void CCtrlTextButton::setTextAsUtf16 (const ucstring &text)
{ {
if (_ViewText && !_IsViewTextId) if (_ViewText && !_IsViewTextId)
_ViewText->setText(text.toUtf8()); _ViewText->setText(text.toUtf8());
} }
// *************************************************************************** // ***************************************************************************
ucstring CCtrlTextButton::getText () const ucstring CCtrlTextButton::getTextAsUtf16 () const
{ {
if (_ViewText && !_IsViewTextId) if (_ViewText && !_IsViewTextId)
return CUtfStringView(_ViewText->getText()).toUtf16(); return CUtfStringView(_ViewText->getText()).toUtf16();

@ -668,7 +668,7 @@ namespace NLGUI
{ {
checkable = true; checkable = true;
} }
groupMenu->addLine(ucstring::makeFromUtf8(getText(i)), "combo_box_select_end", toString(i), groupMenu->addLine(getText(i), "combo_box_select_end", toString(i),
"", std::string(), getTexture(i), checkable); "", std::string(), getTexture(i), checkable);
groupMenu->setGrayedLine(i, getGrayed(i)); groupMenu->setGrayedLine(i, getGrayed(i));
} }

@ -1338,19 +1338,19 @@ namespace NLGUI
if( name == "title" ) if( name == "title" )
{ {
if( _TitleTextOpened == _TitleTextClosed ) if( _TitleTextOpened == _TitleTextClosed )
return _TitleTextOpened.toString(); return _TitleTextOpened;
else else
return ""; return "";
} }
else else
if( name == "title_opened" ) if( name == "title_opened" )
{ {
return _TitleTextOpened.toString(); return _TitleTextOpened;
} }
else else
if( name == "title_closed" ) if( name == "title_closed" )
{ {
return _TitleTextClosed.toString(); return _TitleTextClosed;
} }
else else
if( name == "header_active" ) if( name == "header_active" )
@ -1997,12 +1997,12 @@ namespace NLGUI
xmlSetProp( node, BAD_CAST "content_y_offset", BAD_CAST toString( _ContentYOffset ).c_str() ); xmlSetProp( node, BAD_CAST "content_y_offset", BAD_CAST toString( _ContentYOffset ).c_str() );
if( _TitleTextOpened == _TitleTextClosed ) if( _TitleTextOpened == _TitleTextClosed )
xmlSetProp( node, BAD_CAST "title", BAD_CAST _TitleTextOpened.toString().c_str() ); xmlSetProp( node, BAD_CAST "title", BAD_CAST _TitleTextOpened.c_str() );
else else
xmlSetProp( node, BAD_CAST "title", BAD_CAST "" ); xmlSetProp( node, BAD_CAST "title", BAD_CAST "" );
xmlSetProp( node, BAD_CAST "title_opened", BAD_CAST _TitleTextOpened.toString().c_str() ); xmlSetProp( node, BAD_CAST "title_opened", BAD_CAST _TitleTextOpened.c_str() );
xmlSetProp( node, BAD_CAST "title_closed", BAD_CAST _TitleTextClosed.toString().c_str() ); xmlSetProp( node, BAD_CAST "title_closed", BAD_CAST _TitleTextClosed.c_str() );
xmlSetProp( node, BAD_CAST "header_active", BAD_CAST toString( _HeaderActive ).c_str() ); xmlSetProp( node, BAD_CAST "header_active", BAD_CAST toString( _HeaderActive ).c_str() );
if( _HeaderColor.getNodePtr() != NULL ) if( _HeaderColor.getNodePtr() != NULL )
@ -3712,7 +3712,7 @@ namespace NLGUI
{ {
CViewTextID *vti= new CViewTextID(CViewBase::TCtorParam()); CViewTextID *vti= new CViewTextID(CViewBase::TCtorParam());
// the title here is actually the DB path // the title here is actually the DB path
vti->setDBTextID(_TitleTextOpened.toString()); vti->setDBTextID(_TitleTextOpened);
vti->setDynamicString(_TitleClass==TitleTextDynString); vti->setDynamicString(_TitleClass==TitleTextDynString);
_TitleOpened = vti; _TitleOpened = vti;
} }
@ -3744,7 +3744,7 @@ namespace NLGUI
_TitleOpened->setY (pLayer->getValSInt32 ("title_offset_y")); _TitleOpened->setY (pLayer->getValSInt32 ("title_offset_y"));
} }
_TitleOpened->setFontSize (pLayer->getValSInt32 ("title_font_size")); _TitleOpened->setFontSize (pLayer->getValSInt32 ("title_font_size"));
if (_TitleClass==TitleText) _TitleOpened->setText (_TitleTextOpened.toUtf8()); if (_TitleClass==TitleText) _TitleOpened->setText (_TitleTextOpened);
_TitleOpened->setActive (_Opened); _TitleOpened->setActive (_Opened);
// Title when the container is closed // Title when the container is closed
@ -3764,7 +3764,7 @@ namespace NLGUI
{ {
CViewTextID *vti= new CViewTextID(CViewBase::TCtorParam()); CViewTextID *vti= new CViewTextID(CViewBase::TCtorParam());
// the title here is actually the DB path // the title here is actually the DB path
vti->setDBTextID(_TitleTextClosed.toString()); vti->setDBTextID(_TitleTextClosed);
vti->setDynamicString(_TitleClass==TitleTextDynString); vti->setDynamicString(_TitleClass==TitleTextDynString);
_TitleClosed = vti; _TitleClosed = vti;
} }
@ -3796,7 +3796,7 @@ namespace NLGUI
_TitleClosed->setY (pLayer->getValSInt32 ("title_offset_y")); _TitleClosed->setY (pLayer->getValSInt32 ("title_offset_y"));
} }
_TitleClosed->setFontSize (pLayer->getValSInt32 ("title_font_size")); _TitleClosed->setFontSize (pLayer->getValSInt32 ("title_font_size"));
if (_TitleClass==TitleText) _TitleClosed->setText (_TitleTextClosed.toUtf8()); if (_TitleClass==TitleText) _TitleClosed->setText (_TitleTextClosed);
_TitleClosed->setActive(!_Opened); _TitleClosed->setActive(!_Opened);
@ -3949,7 +3949,7 @@ namespace NLGUI
// *************************************************************************** // ***************************************************************************
std::string CGroupContainer::getTitle () const std::string CGroupContainer::getTitle () const
{ {
return _TitleTextOpened.toString(); return _TitleTextOpened;
} }
// *************************************************************************** // ***************************************************************************
@ -3962,7 +3962,7 @@ namespace NLGUI
// *************************************************************************** // ***************************************************************************
std::string CGroupContainer::getTitleOpened () const std::string CGroupContainer::getTitleOpened () const
{ {
return _TitleTextOpened.toString(); return _TitleTextOpened;
} }
// *************************************************************************** // ***************************************************************************
@ -3975,7 +3975,7 @@ namespace NLGUI
// *************************************************************************** // ***************************************************************************
std::string CGroupContainer::getTitleClosed () const std::string CGroupContainer::getTitleClosed () const
{ {
return _TitleTextClosed.toString(); return _TitleTextClosed;
} }
// *************************************************************************** // ***************************************************************************
@ -3988,7 +3988,7 @@ namespace NLGUI
// *************************************************************************** // ***************************************************************************
void CGroupContainer::setUCTitleOpened(const ucstring &title) void CGroupContainer::setUCTitleOpened(const ucstring &title)
{ {
_TitleTextOpened = title; _TitleTextOpened = title.toUtf8();
if (_TitleOpened != NULL) if (_TitleOpened != NULL)
_TitleOpened->setText (title.toUtf8()); _TitleOpened->setText (title.toUtf8());
invalidateCoords(); invalidateCoords();
@ -3997,9 +3997,9 @@ namespace NLGUI
// *************************************************************************** // ***************************************************************************
void CGroupContainer::setUCTitleClosed(const ucstring &title) void CGroupContainer::setUCTitleClosed(const ucstring &title)
{ {
_TitleTextClosed = title; _TitleTextClosed = title.toUtf8();
if (_TitleClosed != NULL) if (_TitleClosed != NULL)
_TitleClosed->setText (_TitleTextClosed.toUtf8()); _TitleClosed->setText (_TitleTextClosed);
invalidateCoords(); invalidateCoords();
} }

@ -2755,11 +2755,11 @@ namespace NLGUI
void CGroupHTML::addString(const ucstring &str) void CGroupHTML::addString(const ucstring &str)
{ {
ucstring tmpStr = str; string tmpStr = str.toUtf8();
if (_Localize) if (_Localize)
{ {
string _str = tmpStr.toString(); string _str = tmpStr;
string::size_type p = _str.find('#'); string::size_type p = _str.find('#');
if (p == string::npos) if (p == string::npos)
{ {
@ -2800,7 +2800,7 @@ namespace NLGUI
} }
else if (_Object) else if (_Object)
{ {
_ObjectScript += tmpStr.toString(); _ObjectScript += tmpStr;
} }
else if (_SelectOption) else if (_SelectOption)
{ {
@ -2853,7 +2853,7 @@ namespace NLGUI
(style.GlobalColor == _CurrentViewLink->getModulateGlobalColor())) (style.GlobalColor == _CurrentViewLink->getModulateGlobalColor()))
{ {
// Concat the text // Concat the text
_CurrentViewLink->setText(_CurrentViewLink->getText()+tmpStr.toUtf8()); _CurrentViewLink->setText(_CurrentViewLink->getText()+tmpStr);
_CurrentViewLink->invalidateContent(); _CurrentViewLink->invalidateContent();
added = true; added = true;
} }
@ -2916,7 +2916,7 @@ namespace NLGUI
newLink->setParamsOnLeftClick("name=" + getId() + "|url=" + newLink->Link); newLink->setParamsOnLeftClick("name=" + getId() + "|url=" + newLink->Link);
} }
} }
newLink->setText(tmpStr.toUtf8()); newLink->setText(tmpStr);
newLink->setMultiLineSpace((uint)((float)(style.FontSize)*LineSpaceFontFactor)); newLink->setMultiLineSpace((uint)((float)(style.FontSize)*LineSpaceFontFactor));
newLink->setMultiLine(true); newLink->setMultiLine(true);
newLink->setModulateGlobalColor(style.GlobalColor); newLink->setModulateGlobalColor(style.GlobalColor);
@ -5475,7 +5475,7 @@ namespace NLGUI
} }
} }
ctrlButton->setText(ucstring::makeFromUtf8(value)); ctrlButton->setText(value);
setTextButtonStyle(ctrlButton, _Style.Current); setTextButtonStyle(ctrlButton, _Style.Current);
} }
@ -6449,7 +6449,7 @@ namespace NLGUI
if (sb) if (sb)
{ {
uint lineIndex = sb->getNumLine(); uint lineIndex = sb->getNumLine();
sb->addLine(_SelectOptionStr, "", ""); sb->addLine(_SelectOptionStr.toUtf8(), "", "");
if (_Forms.back().Entries.back().sbOptionDisabled == lineIndex) if (_Forms.back().Entries.back().sbOptionDisabled == lineIndex)
{ {

@ -521,7 +521,7 @@ namespace NLGUI
if (NLMISC::startsWith(propPtr, "ui")) if (NLMISC::startsWith(propPtr, "ui"))
addTextChild(CI18N::get(propPtr)); addTextChild(CI18N::get(propPtr));
else else
addTextChild(ucstring::makeFromUtf8(propPtr)); addTextChild(propPtr);
} }
else else
{ {
@ -539,7 +539,7 @@ namespace NLGUI
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void CGroupList::addTextChild(const ucstring& line, bool multiLine /*= true*/) void CGroupList::addTextChild(const std::string& line, bool multiLine /*= true*/)
{ {
const string elid = _Id + ":el" + toString(_IdCounter); ++_IdCounter; const string elid = _Id + ":el" + toString(_IdCounter); ++_IdCounter;
CViewText *view= new CViewText (elid, string(""), _Templ.getFontSize(), _Templ.getColor(), _Templ.getShadow()); CViewText *view= new CViewText (elid, string(""), _Templ.getFontSize(), _Templ.getColor(), _Templ.getShadow());
@ -548,7 +548,7 @@ namespace NLGUI
view->setMultiLine (multiLine); view->setMultiLine (multiLine);
view->setTextMode(_Templ.getTextMode()); view->setTextMode(_Templ.getTextMode());
if (multiLine) view->setMultiLineSpace (_Space); if (multiLine) view->setMultiLineSpace (_Space);
view->setText (line.toUtf8()); view->setText (line);
// Herit global-coloring // Herit global-coloring
view->setModulateGlobalColor(getModulateGlobalColor()); view->setModulateGlobalColor(getModulateGlobalColor());
addChild(view); addChild(view);
@ -558,7 +558,7 @@ namespace NLGUI
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void CGroupList::addTextChild(const ucstring& line, const CRGBA& textColor, bool multiLine /*= true*/) void CGroupList::addTextChild(const std::string& line, const CRGBA& textColor, bool multiLine /*= true*/)
{ {
const string elid = _Id + ":el" + toString(_IdCounter); ++_IdCounter; const string elid = _Id + ":el" + toString(_IdCounter); ++_IdCounter;
CViewText *view= new CViewText (elid, string(""), _Templ.getFontSize(), _Templ.getColor(), _Templ.getShadow()); CViewText *view= new CViewText (elid, string(""), _Templ.getFontSize(), _Templ.getColor(), _Templ.getShadow());
@ -566,7 +566,7 @@ namespace NLGUI
view->_Parent = this; view->_Parent = this;
view->setMultiLine (multiLine); view->setMultiLine (multiLine);
if (multiLine) view->setMultiLineSpace (_Space); if (multiLine) view->setMultiLineSpace (_Space);
view->setText (line.toUtf8()); view->setText (line);
view->setColor (textColor); view->setColor (textColor);
// Herit global-coloring // Herit global-coloring
view->setModulateGlobalColor(getModulateGlobalColor()); view->setModulateGlobalColor(getModulateGlobalColor());
@ -1289,7 +1289,7 @@ namespace NLGUI
ucstring text; ucstring text;
if(CLuaIHM::pop(ls, text)) if(CLuaIHM::pop(ls, text))
{ {
addTextChild(text); addTextChild(text.toUtf8()); // FIXME: Lua UTF-8
} }
return 0; return 0;
} }
@ -1313,7 +1313,7 @@ namespace NLGUI
uint b = (uint) ls.toInteger(4); uint b = (uint) ls.toInteger(4);
uint a = (uint) ls.toInteger(5); uint a = (uint) ls.toInteger(5);
addTextChild(ucText, CRGBA(r, g, b, a)); addTextChild(ucText.toUtf8(), CRGBA(r, g, b, a)); // FIXME: Lua UTF-8
return 0; return 0;
} }

@ -275,7 +275,7 @@ namespace NLGUI
if (stricmp((char*)cur->name, "action") == 0) if (stricmp((char*)cur->name, "action") == 0)
{ {
string strId, strAh, strParams, strCond, strTexture; string strId, strAh, strParams, strCond, strTexture;
ucstring ucstrName; string ucstrName;
if (id) strId = (const char*)id; if (id) strId = (const char*)id;
CXMLAutoPtr name((const char*) xmlGetProp (cur, (xmlChar*)"name")); CXMLAutoPtr name((const char*) xmlGetProp (cur, (xmlChar*)"name"));
@ -286,7 +286,7 @@ namespace NLGUI
if (NLMISC::startsWith(ptrName, "ui")) if (NLMISC::startsWith(ptrName, "ui"))
ucstrName = CI18N::get(ptrName); ucstrName = CI18N::get(ptrName);
else else
ucstrName.fromUtf8(ptrName); ucstrName = ptrName;
} }
CXMLAutoPtr ah((const char*) xmlGetProp (cur, (xmlChar*)"handler")); CXMLAutoPtr ah((const char*) xmlGetProp (cur, (xmlChar*)"handler"));
@ -1215,7 +1215,7 @@ namespace NLGUI
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
CViewTextMenu* CGroupSubMenu::addLine (const ucstring &name, const std::string &ah, CViewTextMenu* CGroupSubMenu::addLine (const std::string &name, const std::string &ah,
const std::string &params, const std::string &id, const std::string &params, const std::string &id,
const std::string &cond, const std::string &texture, const std::string &cond, const std::string &texture,
bool checkable /*= false*/, bool checked /*= false*/, bool formatted /*= false */ bool checkable /*= false*/, bool checked /*= false*/, bool formatted /*= false */
@ -1231,11 +1231,11 @@ namespace NLGUI
{ {
pV->setMultiLine (true); pV->setMultiLine (true);
pV->setMultiLineMaxWOnly (true); pV->setMultiLineMaxWOnly (true);
pV->setTextFormatTaged (name.toUtf8()); pV->setTextFormatTaged (name);
} }
else else
{ {
pV->setText (name.toUtf8()); pV->setText (name);
} }
pV->setColor (_GroupMenu->_Color); pV->setColor (_GroupMenu->_Color);
pV->setFontSize (_GroupMenu->_FontSize, _GroupMenu->_FontSizeCoef); pV->setFontSize (_GroupMenu->_FontSize, _GroupMenu->_FontSizeCoef);
@ -1296,7 +1296,7 @@ namespace NLGUI
return pV; return pV;
} }
CViewTextMenu* CGroupSubMenu::addLineAtIndex(uint index, const ucstring &name, const std::string &ah, CViewTextMenu* CGroupSubMenu::addLineAtIndex(uint index, const std::string &name, const std::string &ah,
const std::string &params, const std::string &id /*=""*/, const std::string &params, const std::string &id /*=""*/,
const std::string &cond /*=std::string()*/, const std::string &texture, const std::string &cond /*=std::string()*/, const std::string &texture,
bool checkable /*= false*/, bool checked /*= false*/, bool formatted /*= false */ bool checkable /*= false*/, bool checked /*= false*/, bool formatted /*= false */
@ -1319,11 +1319,11 @@ namespace NLGUI
{ {
pV->setMultiLine (true); pV->setMultiLine (true);
pV->setMultiLineMaxWOnly (true); pV->setMultiLineMaxWOnly (true);
pV->setTextFormatTaged (name.toUtf8()); pV->setTextFormatTaged (name);
} }
else else
{ {
pV->setText (name.toUtf8()); pV->setText (name);
} }
pV->setColor (_GroupMenu->_Color); pV->setColor (_GroupMenu->_Color);
@ -1602,7 +1602,7 @@ namespace NLGUI
texture = _Lines[k].ViewText->getCheckBox()->getTexture(); texture = _Lines[k].ViewText->getCheckBox()->getTexture();
} }
CViewTextMenu *pV = NULL; CViewTextMenu *pV = NULL;
pV = copyMenu->addLine (CUtfStringView(_Lines[k].ViewText->getText()).toUtf16(), _Lines[k].AHName, _Lines[k].AHParams, _Lines[k].Id, _Lines[k].Cond, pV = copyMenu->addLine (_Lines[k].ViewText->getText(), _Lines[k].AHName, _Lines[k].AHParams, _Lines[k].Id, _Lines[k].Cond,
texture, _Lines[k].ViewText->getCheckable(), _Lines[k].ViewText->getChecked(), _Lines[k].ViewText->getFormatted ()); texture, _Lines[k].ViewText->getCheckable(), _Lines[k].ViewText->getChecked(), _Lines[k].ViewText->getFormatted ());
copyMenu->_Lines[k].Selectable = _Lines[k].Selectable; copyMenu->_Lines[k].Selectable = _Lines[k].Selectable;
pV->setGrayed(_Lines[k].ViewText->getGrayed()); pV->setGrayed(_Lines[k].ViewText->getGrayed());
@ -1858,8 +1858,8 @@ namespace NLGUI
CLuaIHM::checkArgType(ls, funcName, 3, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 3, LUA_TSTRING);
CLuaIHM::checkArgType(ls, funcName, 4, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 4, LUA_TSTRING);
ucstring arg1; ucstring arg1;
nlverify(CLuaIHM::getUCStringOnStack(ls, 1, arg1)); nlverify(CLuaIHM::getUCStringOnStack(ls, 1, arg1)); // FIXME: Lua UTF-8
addLine(arg1, ls.toString(2), ls.toString(3), ls.toString(4)); addLine(arg1.toUtf8(), ls.toString(2), ls.toString(3), ls.toString(4));
return 0; return 0;
} }
@ -1874,8 +1874,8 @@ namespace NLGUI
CLuaIHM::checkArgType(ls, funcName, 4, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 4, LUA_TSTRING);
CLuaIHM::checkArgType(ls, funcName, 5, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 5, LUA_TSTRING);
ucstring arg1; ucstring arg1;
nlverify(CLuaIHM::getUCStringOnStack(ls, 1, arg1)); nlverify(CLuaIHM::getUCStringOnStack(ls, 1, arg1)); // FIXME: Lua UTF-8
addLine(arg1, ls.toString(2), ls.toString(3), ls.toString(4), string(), ls.toString(5)); addLine(arg1.toUtf8(), ls.toString(2), ls.toString(3), ls.toString(4), string(), ls.toString(5));
return 0; return 0;
} }
@ -1890,8 +1890,8 @@ namespace NLGUI
CLuaIHM::checkArgType(ls, funcName, 4, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 4, LUA_TSTRING);
CLuaIHM::checkArgType(ls, funcName, 5, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 5, LUA_TSTRING);
ucstring arg2; ucstring arg2;
nlverify(CLuaIHM::getUCStringOnStack(ls, 2, arg2)); nlverify(CLuaIHM::getUCStringOnStack(ls, 2, arg2)); // FIXME: Lua UTF-8
addLineAtIndex((uint) ls.toInteger(1), arg2, ls.toString(3), ls.toString(4), ls.toString(5)); addLineAtIndex((uint) ls.toInteger(1), arg2.toUtf8(), ls.toString(3), ls.toString(4), ls.toString(5));
return 0; return 0;
} }
@ -2532,25 +2532,7 @@ namespace NLGUI
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void CGroupMenu::addLine (const string &name, const string &ah, const string &params, void CGroupMenu::addLine(const std::string &name, const std::string &ah, const std::string &params,
const std::string &id/*=std::string()*/,
const std::string &cond /*= std::string()*/, const std::string &texture,
bool checkable /*= false*/, bool checked /*= false*/
)
{
if (_RootMenu == NULL)
{
_RootMenu = new CGroupSubMenu(CViewText::TCtorParam());
_RootMenu->_GroupMenu = this;
_RootMenu->setSerializable( false );
addGroup (_RootMenu);
}
_RootMenu->addLine (name, ah, params, id, cond, texture, checkable, checked, _Formatted);
}
// ------------------------------------------------------------------------------------------------
void CGroupMenu::addLine(const ucstring &name, const std::string &ah, const std::string &params,
const std::string &id /* = std::string()*/, const std::string &id /* = std::string()*/,
const std::string &cond /*= std::string()*/, const std::string &texture, const std::string &cond /*= std::string()*/, const std::string &texture,
bool checkable /*= false*/, bool checked /*= false*/ bool checkable /*= false*/, bool checked /*= false*/
@ -2566,7 +2548,7 @@ namespace NLGUI
_RootMenu->addLine (name, ah, params, id, cond, texture, checkable, checked, _Formatted); _RootMenu->addLine (name, ah, params, id, cond, texture, checkable, checked, _Formatted);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void CGroupMenu::addLineAtIndex(uint index, const ucstring &name, const std::string &ah, void CGroupMenu::addLineAtIndex(uint index, const std::string &name, const std::string &ah,
const std::string &params, const std::string &id /*=std::string()*/, const std::string &params, const std::string &id /*=std::string()*/,
const std::string &cond /*=std::string()*/, const std::string &texture, const std::string &cond /*=std::string()*/, const std::string &texture,
bool checkable /*=false*/, bool checked /*=false*/) bool checkable /*=false*/, bool checked /*=false*/)

@ -479,7 +479,7 @@ namespace NLGUI
if (NLMISC::startsWith(propPtr, "ui")) if (NLMISC::startsWith(propPtr, "ui"))
addTextChild(CI18N::get(propPtr)); addTextChild(CI18N::get(propPtr));
else else
addTextChild(ucstring::makeFromUtf8(propPtr)); addTextChild(propPtr);
} }
else else
{ {
@ -495,7 +495,7 @@ namespace NLGUI
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void CGroupParagraph::addTextChild(const ucstring& line, bool multiLine /*= true*/) void CGroupParagraph::addTextChild(const std::string& line, bool multiLine /*= true*/)
{ {
const string elid = _Id + ":el" + toString(_IdCounter); ++_IdCounter; const string elid = _Id + ":el" + toString(_IdCounter); ++_IdCounter;
CViewText *view= new CViewText (elid, string(""), _Templ.getFontSize(), _Templ.getColor(), _Templ.getShadow()); CViewText *view= new CViewText (elid, string(""), _Templ.getFontSize(), _Templ.getColor(), _Templ.getShadow());
@ -503,7 +503,7 @@ namespace NLGUI
view->setMultiLine (multiLine); view->setMultiLine (multiLine);
view->setTextMode(_Templ.getTextMode()); view->setTextMode(_Templ.getTextMode());
if (multiLine) view->setMultiLineSpace (_Space); if (multiLine) view->setMultiLineSpace (_Space);
view->setText (line.toUtf8()); view->setText (line);
// Herit global-coloring // Herit global-coloring
view->setModulateGlobalColor(getModulateGlobalColor()); view->setModulateGlobalColor(getModulateGlobalColor());
addChild (view); addChild (view);
@ -513,14 +513,14 @@ namespace NLGUI
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void CGroupParagraph::addTextChild(const ucstring& line, const CRGBA& textColor, bool multiLine /*= true*/) void CGroupParagraph::addTextChild(const std::string& line, const CRGBA& textColor, bool multiLine /*= true*/)
{ {
const string elid = _Id + ":el" + toString(_IdCounter); ++_IdCounter; const string elid = _Id + ":el" + toString(_IdCounter); ++_IdCounter;
CViewText *view= new CViewText (elid, string(""), _Templ.getFontSize(), _Templ.getColor(), _Templ.getShadow()); CViewText *view= new CViewText (elid, string(""), _Templ.getFontSize(), _Templ.getColor(), _Templ.getShadow());
view->_Parent = this; view->_Parent = this;
view->setMultiLine (multiLine); view->setMultiLine (multiLine);
if (multiLine) view->setMultiLineSpace (_Space); if (multiLine) view->setMultiLineSpace (_Space);
view->setText (line.toUtf8()); view->setText (line);
view->setColor (textColor); view->setColor (textColor);
// Herit global-coloring // Herit global-coloring
view->setModulateGlobalColor(getModulateGlobalColor()); view->setModulateGlobalColor(getModulateGlobalColor());

@ -309,7 +309,7 @@ namespace NLGUI
if (NLMISC::startsWith(ptrName, "ui")) if (NLMISC::startsWith(ptrName, "ui"))
Text = CI18N::get(ptrName); Text = CI18N::get(ptrName);
else else
ucstring::makeFromUtf8(ptrName); Text = ptrName;
} }
CXMLAutoPtr color((const char*) xmlGetProp (cur, (xmlChar*)"color")); CXMLAutoPtr color((const char*) xmlGetProp (cur, (xmlChar*)"color"));
@ -1292,7 +1292,7 @@ namespace NLGUI
CViewText *pVT = new CViewText(TCtorParam()); CViewText *pVT = new CViewText(TCtorParam());
line.TextOrTemplate = pVT; line.TextOrTemplate = pVT;
pVT->setId("t"+toString(_Lines.size())); pVT->setId("t"+toString(_Lines.size()));
pVT->setText(pNode->Text.toUtf8()); pVT->setText(pNode->Text);
pVT->setColor(pNode->Color); pVT->setColor(pNode->Color);
if(pNode->FontSize==-1) if(pNode->FontSize==-1)
pVT->setFontSize(_FontSize); pVT->setFontSize(_FontSize);

@ -548,7 +548,7 @@ namespace NLGUI
case Boolean: return true; case Boolean: return true;
case Integer: setBool(_IntegerValue != 0); return true; case Integer: setBool(_IntegerValue != 0); return true;
case Double: setBool(_DoubleValue != 0); return true; case Double: setBool(_DoubleValue != 0); return true;
case String: return evalBoolean(_StringValue.toString().c_str()) != NULL; case String: return evalBoolean(_StringValue.c_str()) != NULL;
default: break; default: break;
} }
return false; return false;
@ -564,7 +564,7 @@ namespace NLGUI
case Integer: return true; case Integer: return true;
case Double: setInteger((sint64) _DoubleValue); return true; case Double: setInteger((sint64) _DoubleValue); return true;
case String: case String:
if (evalNumber(_StringValue.toString().c_str())) return toInteger(); if (evalNumber(_StringValue.c_str())) return toInteger();
return false; return false;
case RGBA: setInteger((sint64) _RGBAValue); return true; case RGBA: setInteger((sint64) _RGBAValue); return true;
default: break; default: break;
@ -581,7 +581,7 @@ namespace NLGUI
case Integer: setDouble((double) _IntegerValue); return true; case Integer: setDouble((double) _IntegerValue); return true;
case Double: return true; case Double: return true;
case String: case String:
if (evalNumber(_StringValue.toString().c_str())) return toBool(); if (evalNumber(_StringValue.c_str())) return toBool();
return false; return false;
case RGBA: setDouble((double) _RGBAValue); return true; case RGBA: setDouble((double) _RGBAValue); return true;
default: break; default: break;
@ -627,7 +627,7 @@ namespace NLGUI
return true; return true;
case String: case String:
setRGBA( NLMISC::CRGBA::stringToRGBA(_StringValue.toString().c_str())); setRGBA( NLMISC::CRGBA::stringToRGBA(_StringValue.c_str()));
return true; return true;
default: default:
@ -869,14 +869,15 @@ namespace NLGUI
} }
//================================================================== //==================================================================
std::string CInterfaceExprValue::getString() const const std::string &CInterfaceExprValue::getString() const
{ {
if (_Type != String) if (_Type != String)
{ {
nlwarning("<CInterfaceExprValue::getString> bad type!"); nlwarning("<CInterfaceExprValue::getString> bad type!");
return ""; static const std::string empty;
return empty;
} }
return _StringValue.toString(); return _StringValue;
} }
//================================================================== //==================================================================
@ -895,19 +896,6 @@ namespace NLGUI
return col; return col;
} }
//==================================================================
const ucstring &CInterfaceExprValue::getUCString() const
{
if (_Type != String)
{
nlwarning("<CInterfaceExprValue::getString> bad type!");
static ucstring emptyString;
return emptyString;
}
return _StringValue;
}
//================================================================== //==================================================================
CInterfaceExprUserType *CInterfaceExprValue::getUserType() const CInterfaceExprUserType *CInterfaceExprValue::getUserType() const
{ {

@ -359,13 +359,13 @@ namespace NLGUI
{ {
if (!args.empty()) if (!args.empty())
{ {
ucstring res; string res;
for (uint32 i = 0; i < args.size(); ++i) for (uint32 i = 0; i < args.size(); ++i)
{ {
args[i].toString(); args[i].toString();
res += args[i].getUCString(); res += args[i].getString();
} }
result.setUCString (res); result.setString (res);
return true; return true;
} }
@ -553,13 +553,13 @@ namespace NLGUI
result.setString ((elem->*(pRP->GetMethod.GetString))()); result.setString ((elem->*(pRP->GetMethod.GetString))());
break; break;
case CReflectedProperty::UCString: case CReflectedProperty::UCString:
result.setUCString ((elem->*(pRP->GetMethod.GetUCString))()); result.setString ((elem->*(pRP->GetMethod.GetUCString))().toUtf8());
break; break;
case CReflectedProperty::StringRef: case CReflectedProperty::StringRef:
result.setString ((elem->*(pRP->GetMethod.GetStringRef))()); result.setString ((elem->*(pRP->GetMethod.GetStringRef))());
break; break;
case CReflectedProperty::UCStringRef: case CReflectedProperty::UCStringRef:
result.setUCString ((elem->*(pRP->GetMethod.GetUCStringRef))()); result.setString ((elem->*(pRP->GetMethod.GetUCStringRef))().toUtf8());
break; break;
case CReflectedProperty::RGBA: case CReflectedProperty::RGBA:
result.setRGBA ((elem->*(pRP->GetMethod.GetRGBA))()); result.setRGBA ((elem->*(pRP->GetMethod.GetRGBA))());
@ -1072,7 +1072,7 @@ namespace NLGUI
} }
sint64 nVal = args[0].getInteger(); sint64 nVal = args[0].getInteger();
ucstring sTmp; string sTmp;
if (nVal < 0) nVal = 0; if (nVal < 0) nVal = 0;
@ -1099,7 +1099,7 @@ namespace NLGUI
} }
} }
result.setUCString(sTmp); result.setString(sTmp);
return true; return true;
} }
@ -1121,7 +1121,7 @@ namespace NLGUI
} }
sint64 nVal = args[0].getInteger(); sint64 nVal = args[0].getInteger();
ucstring sTmp; string sTmp;
if (nVal < 0) nVal = 0; if (nVal < 0) nVal = 0;
@ -1150,7 +1150,7 @@ namespace NLGUI
} }
} }
result.setUCString(sTmp); result.setString(sTmp);
return true; return true;
} }
@ -1186,7 +1186,7 @@ namespace NLGUI
nlwarning("localize : 1 arg required"); nlwarning("localize : 1 arg required");
return false; return false;
} }
result.setUCString(CI18N::get(args[0].getString())); result.setString(CI18N::get(args[0].getString()));
return true; return true;
} }
REGISTER_INTERFACE_USER_FCT("localize", localize); REGISTER_INTERFACE_USER_FCT("localize", localize);

@ -121,7 +121,7 @@ namespace NLGUI
case CReflectedProperty::UCStringRef: case CReflectedProperty::UCStringRef:
if (valueToAffect.toString()) if (valueToAffect.toString())
{ {
(destElem.*(property.SetMethod.SetUCString))(valueToAffect.getUCString()); (destElem.*(property.SetMethod.SetUCString))(ucstring::makeFromUtf8(valueToAffect.getString()));
} }
else else
{ {

@ -1145,34 +1145,8 @@ namespace NLGUI
ls.push(value.getDouble()); ls.push(value.getDouble());
break; break;
case CInterfaceExprValue::String: case CInterfaceExprValue::String:
{ ls.push(value.getString());
ucstring ucstr= value.getUCString();
// Yoyo: dynamically decide whether must return a string or a ucstring
bool mustUseUCString= false;
for (uint i = 0; i < ucstr.size (); i++)
{
if (ucstr[i] > 255)
{
mustUseUCString= true;
break;
}
}
// push a ucstring?
if(mustUseUCString)
{
#if LUABIND_VERSION > 600
luabind::detail::push(ls.getStatePointer(), ucstr);
#else
luabind::object obj(ls.getStatePointer(), ucstr);
obj.pushvalue();
#endif
}
else
{
ls.push(ucstr.toString());
}
break; break;
}
case CInterfaceExprValue::RGBA: case CInterfaceExprValue::RGBA:
{ {
CRGBA color = value.getRGBA(); CRGBA color = value.getRGBA();

@ -250,7 +250,7 @@ namespace NLGUI
if (vLink->getMouseOverShape(tooltip, rot, col)) if (vLink->getMouseOverShape(tooltip, rot, col))
{ {
setString(ucstring::makeFromUtf8(tooltip)); setString(tooltip);
sint32 texId = rVR.getTextureIdFromName ("curs_pick.tga"); sint32 texId = rVR.getTextureIdFromName ("curs_pick.tga");
CInterfaceGroup *stringCursor = hwMouse ? _StringCursorHardware : _StringCursor; CInterfaceGroup *stringCursor = hwMouse ? _StringCursorHardware : _StringCursor;
@ -406,7 +406,7 @@ namespace NLGUI
splitString(tooltipInfos, "@", tooltipInfosList); splitString(tooltipInfos, "@", tooltipInfosList);
texName = tooltipInfosList[0]; texName = tooltipInfosList[0];
tooltip = tooltipInfosList[1]; tooltip = tooltipInfosList[1];
setString(ucstring::makeFromUtf8(tooltip)); setString(tooltip);
CViewRenderer &rVR = *CViewRenderer::getInstance(); CViewRenderer &rVR = *CViewRenderer::getInstance();
sint32 texId = rVR.getTextureIdFromName (texName); sint32 texId = rVR.getTextureIdFromName (texName);
@ -449,7 +449,7 @@ namespace NLGUI
} }
// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------
void CViewPointer::setString (const ucstring &str, CInterfaceGroup *target) void CViewPointer::setString(const std::string &str, CInterfaceGroup *target)
{ {
if (target) if (target)
{ {
@ -458,14 +458,14 @@ namespace NLGUI
{ {
CViewText *text = dynamic_cast<CViewText*> (element); CViewText *text = dynamic_cast<CViewText*> (element);
if (text) if (text)
text->setText(str.toUtf8()); text->setText(str);
} }
element = target->getView ("real_txt"); element = target->getView ("real_txt");
if (element) if (element)
{ {
CViewText *text = dynamic_cast<CViewText*> (element); CViewText *text = dynamic_cast<CViewText*> (element);
if (text) if (text)
text->setText(str.toUtf8()); text->setText(str);
} }
target->updateCoords(); target->updateCoords();
target->updateCoords(); target->updateCoords();
@ -475,7 +475,7 @@ namespace NLGUI
// -------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------
void CViewPointer::setString (const ucstring &str) void CViewPointer::setString (const std::string &str)
{ {
if (_ContextString != str) if (_ContextString != str)
{ {

@ -3207,7 +3207,7 @@ namespace NLGUI
// *************************************************************************** // ***************************************************************************
void CViewText::buildFormatTagText(const std::string &text, std::string &textBuild, std::vector<CViewText::CFormatTag> &formatTags, std::vector<ucstring> &tooltips) void CViewText::buildFormatTagText(const std::string &text, std::string &textBuild, std::vector<CViewText::CFormatTag> &formatTags, std::vector<std::string> &tooltips)
{ {
formatTags.clear(); formatTags.clear();
tooltips.clear(); tooltips.clear();
@ -3243,7 +3243,7 @@ namespace NLGUI
// get old tag. // get old tag.
CViewText::CFormatTag ct= precTag; CViewText::CFormatTag ct= precTag;
// get new Tab and skip tag. // get new Tab and skip tag.
ucstring uitt = getTooltipTag(text, i); string uitt = getTooltipTag(text, i);
if (uitt.empty()) if (uitt.empty())
{ {
ct.IndexTt= -1; ct.IndexTt= -1;
@ -3296,7 +3296,7 @@ namespace NLGUI
std::string tempText; std::string tempText;
// static to avoid reallocation // static to avoid reallocation
static std::vector<CFormatTag> tempFormatTags; static std::vector<CFormatTag> tempFormatTags;
static std::vector<ucstring> tempTooltips; static std::vector<std::string> tempTooltips;
buildFormatTagText(text, tempText, tempFormatTags, tempTooltips); buildFormatTagText(text, tempText, tempFormatTags, tempTooltips);
setCase (tempText, _CaseMode); setCase (tempText, _CaseMode);
@ -3344,7 +3344,7 @@ namespace NLGUI
pTooltip->setId(_Id+"_tt"+toString(i)); pTooltip->setId(_Id+"_tt"+toString(i));
pTooltip->setAvoidResizeParent(avoidResizeParent()); pTooltip->setAvoidResizeParent(avoidResizeParent());
pTooltip->setRenderLayer(getRenderLayer()); pTooltip->setRenderLayer(getRenderLayer());
std::string tempTooltipStr = tempTooltips[i].toUtf8(); std::string tempTooltipStr = tempTooltips[i];
bool isI18N = NLMISC::startsWith(tempTooltipStr, "ui"); bool isI18N = NLMISC::startsWith(tempTooltipStr, "ui");
pTooltip->setDefaultContextHelp(isI18N ? CI18N::get(tempTooltipStr) : tempTooltipStr); pTooltip->setDefaultContextHelp(isI18N ? CI18N::get(tempTooltipStr) : tempTooltipStr);
pTooltip->setParentPos(this); pTooltip->setParentPos(this);
@ -3390,7 +3390,7 @@ namespace NLGUI
// to allow cache (avoid infinite recurse in updateCoords() in some case), compute in temp // to allow cache (avoid infinite recurse in updateCoords() in some case), compute in temp
std::string tempText; std::string tempText;
static std::vector<CFormatTag> tempLetterColors; static std::vector<CFormatTag> tempLetterColors;
static std::vector<ucstring> tempTooltips; static std::vector<std::string> tempTooltips;
// parse text // parse text
buildFormatTagText(text, tempText, tempLetterColors, tempTooltips); buildFormatTagText(text, tempText, tempLetterColors, tempTooltips);

@ -38,7 +38,7 @@ namespace NLGUI
{ {
if (name == "format") if (name == "format")
{ {
return getFormatString().toUtf8(); return getFormatString();
} }
else else
return CViewText::getProperty(name); return CViewText::getProperty(name);
@ -48,7 +48,7 @@ namespace NLGUI
{ {
if (name == "format") if (name == "format")
{ {
setFormatString(ucstring::makeFromUtf8(value)); setFormatString(value);
return; return;
} }
else else
@ -62,7 +62,7 @@ namespace NLGUI
return NULL; return NULL;
xmlSetProp( node, BAD_CAST "type", BAD_CAST "text_formated" ); xmlSetProp( node, BAD_CAST "type", BAD_CAST "text_formated" );
xmlSetProp( node, BAD_CAST "format", BAD_CAST getFormatString().toUtf8().c_str() ); xmlSetProp( node, BAD_CAST "format", BAD_CAST getFormatString().c_str() );
return NULL; return NULL;
} }
@ -73,9 +73,9 @@ namespace NLGUI
if (!CViewText::parse(cur, parentGroup)) return false; if (!CViewText::parse(cur, parentGroup)) return false;
CXMLAutoPtr prop((const char*) xmlGetProp( cur, (xmlChar*)"format" )); CXMLAutoPtr prop((const char*) xmlGetProp( cur, (xmlChar*)"format" ));
if (prop) if (prop)
setFormatString(ucstring::makeFromUtf8((const char *)prop)); setFormatString((const char *)prop);
else else
setFormatString(ucstring("$t")); setFormatString("$t");
return true; return true;
} }
@ -83,26 +83,27 @@ namespace NLGUI
void CViewTextFormated::checkCoords() void CViewTextFormated::checkCoords()
{ {
if (!getActive()) return; if (!getActive()) return;
ucstring formatedResult; std::string formatedResult;
formatedResult = formatString(_FormatString, ucstring("")); formatedResult = formatString(_FormatString, std::string());
// //
setText (formatedResult.toUtf8()); setText (formatedResult);
CViewText::checkCoords(); CViewText::checkCoords();
} }
// **************************************************************************** // ****************************************************************************
void CViewTextFormated::setFormatString(const ucstring &format) void CViewTextFormated::setFormatString(const std::string &format)
{ {
if (NLMISC::startsWith(format, "ui"))
_FormatString = NLMISC::CI18N::get(format);
else
_FormatString = format; _FormatString = format;
if ( (_FormatString.size()>2) && (_FormatString[0] == 'u') && (_FormatString[1] == 'i'))
_FormatString = NLMISC::CI18N::get (format.toString());
} }
// **************************************************************************** // ****************************************************************************
ucstring CViewTextFormated::formatString(const ucstring &inputString, const ucstring &paramString) std::string CViewTextFormated::formatString(const std::string &inputString, const std::string &paramString)
{ {
ucstring formatedResult; std::string formatedResult;
if( textFormatter == NULL ) if( textFormatter == NULL )
formatedResult = inputString; formatedResult = inputString;

@ -204,7 +204,7 @@ namespace NLGUI
if (!_Initialized) if (!_Initialized)
{ {
// String result // String result
ucstring result; string result;
if( textProvider != NULL ) if( textProvider != NULL )
{ {
@ -218,8 +218,8 @@ namespace NLGUI
// Remove all {break} // Remove all {break}
for(;;) for(;;)
{ {
ucstring::size_type index = result.find (ucstring("{break}")); string::size_type index = result.find("{break}");
if (index == ucstring::npos) break; if (index == string::npos) break;
result = result.substr (0, index) + result.substr(index+7, result.size()); result = result.substr (0, index) + result.substr(index+7, result.size());
} }
@ -229,13 +229,13 @@ namespace NLGUI
// Modify the text? // Modify the text?
if(_StringModifier) if(_StringModifier)
_StringModifier->onReceiveTextId(result); _StringModifier->onReceiveTextId(ucstring::makeFromUtf8(result));
// Set the Text // Set the Text
if(_IsTextFormatTaged) if(_IsTextFormatTaged)
setTextFormatTaged(result.toUtf8()); setTextFormatTaged(result);
else else
setText (result.toUtf8()); setText(result);
} }
CViewText::checkCoords(); CViewText::checkCoords();
} }

@ -37,7 +37,7 @@ namespace NLGUI
{ {
if (name == "format") if (name == "format")
{ {
return getFormatString().toUtf8(); return getFormatString();
} }
else else
return CViewTextID::getProperty(name); return CViewTextID::getProperty(name);
@ -47,7 +47,7 @@ namespace NLGUI
{ {
if (name == "format") if (name == "format")
{ {
setFormatString(ucstring::makeFromUtf8(value)); setFormatString(value);
return; return;
} }
else else
@ -61,7 +61,7 @@ namespace NLGUI
return NULL; return NULL;
xmlSetProp( node, BAD_CAST "type", BAD_CAST "text_id_formated" ); xmlSetProp( node, BAD_CAST "type", BAD_CAST "text_id_formated" );
xmlSetProp( node, BAD_CAST "format", BAD_CAST getFormatString().toUtf8().c_str() ); xmlSetProp( node, BAD_CAST "format", BAD_CAST getFormatString().c_str() );
return node; return node;
} }
@ -72,9 +72,9 @@ namespace NLGUI
if (!CViewTextID::parse(cur, parentGroup)) return false; if (!CViewTextID::parse(cur, parentGroup)) return false;
CXMLAutoPtr prop((const char*) xmlGetProp( cur, (xmlChar*)"format" )); CXMLAutoPtr prop((const char*) xmlGetProp( cur, (xmlChar*)"format" ));
if (prop) if (prop)
setFormatString(ucstring::makeFromUtf8((const char *)prop)); setFormatString((const char *)prop);
else else
setFormatString(ucstring("$t")); setFormatString("$t");
return true; return true;
} }
@ -89,15 +89,15 @@ namespace NLGUI
if (!_Initialized) if (!_Initialized)
{ {
ucstring result, formatedResult; std::string result, formatedResult;
bool bValid; bool bValid;
if( CViewTextID::getTextProvider() == NULL ) if( CViewTextID::getTextProvider() == NULL )
{ {
if(!_DBPath.empty()) if(!_DBPath.empty())
result = ucstring(_DBPath); result = _DBPath;
else else
result = ucstring("Text ID = " + NLMISC::toString(_TextId)); result = "Text ID = " + NLMISC::toString(_TextId);
bValid = true; bValid = true;
} }
else else
@ -106,7 +106,7 @@ namespace NLGUI
} }
formatedResult = CViewTextFormated::formatString(_FormatString, result); formatedResult = CViewTextFormated::formatString(_FormatString, result);
// //
setText (formatedResult.toUtf8()); setText (formatedResult);
// //
if (bValid) if (bValid)
{ {
@ -117,12 +117,13 @@ namespace NLGUI
} }
// **************************************************************************** // ****************************************************************************
void CViewTextIDFormated::setFormatString(const ucstring &format) void CViewTextIDFormated::setFormatString(const std::string &format)
{ {
_Initialized = false; _Initialized = false;
if (NLMISC::startsWith(format, "ui"))
_FormatString = NLMISC::CI18N::get(format);
else
_FormatString = format; _FormatString = format;
if ( (_FormatString.size()>2) && (_FormatString[0] == 'u') && (_FormatString[1] == 'i'))
_FormatString = NLMISC::CI18N::get (format.toString());
} }
} }

@ -1350,7 +1350,7 @@ void setTarget(CCtrlBase *ctrl, const string &targetName, ucstring &value)
if (ig) if (ig)
{ {
CInterfaceExprValue exprValue; CInterfaceExprValue exprValue;
exprValue.setUCString(value); exprValue.setString(value.toUtf8());
CInterfaceLink::splitLinkTargets(targetName, ig, targets); CInterfaceLink::splitLinkTargets(targetName, ig, targets);
for(uint k = 0; k < targets.size(); ++k) for(uint k = 0; k < targets.size(); ++k)

@ -162,7 +162,7 @@ bool CContextualCursor::context(const std::string &contextName, float dist, cons
if(cursName.empty()) if(cursName.empty())
cursor->setString(CI18N::get(functions.cursor)); cursor->setString(CI18N::get(functions.cursor));
else else
cursor->setString(cursName); cursor->setString(cursName.toUtf8());
} }
} }
} }

@ -2074,9 +2074,9 @@ class CActionHandlerSetTargetName : public IActionHandler
// Set to target // Set to target
CInterfaceExprValue evUCStr; CInterfaceExprValue evUCStr;
TargetName = STRING_MANAGER::CStringManagerClient::getLocalizedName(TargetName); TargetName = STRING_MANAGER::CStringManagerClient::getLocalizedName(TargetName);
evUCStr.setUCString(TargetName); evUCStr.setString(TargetName.toUtf8());
CInterfaceLink::setTargetProperty(sNameTarget, evUCStr); CInterfaceLink::setTargetProperty(sNameTarget, evUCStr);
evUCStr.setUCString(TargetTitle); evUCStr.setString(TargetTitle.toUtf8());
CInterfaceLink::setTargetProperty(sTitleTarget, evUCStr); CInterfaceLink::setTargetProperty(sTitleTarget, evUCStr);
} }
} }

@ -2046,9 +2046,7 @@ class CHandlerItemMenuCheck : public IActionHandler
std::string name = groupNames[i]; std::string name = groupNames[i];
std::string ahParams = "name=" + name; std::string ahParams = "name=" + name;
//Use ucstring because group name can contain accentued characters (and stuff like that) //Use ucstring because group name can contain accentued characters (and stuff like that)
ucstring nameUC; pGroupMenu->addLine(name, "", "", name);
nameUC.fromUtf8(name);
pGroupMenu->addLine(nameUC, "", "", name);
CGroupSubMenu* pNewSubMenu = new CGroupSubMenu(CViewBase::TCtorParam()); CGroupSubMenu* pNewSubMenu = new CGroupSubMenu(CViewBase::TCtorParam());
pGroupMenu->setSubMenu(pGroupMenu->getNumLine()-1, pNewSubMenu); pGroupMenu->setSubMenu(pGroupMenu->getNumLine()-1, pNewSubMenu);
if(pNewSubMenu) if(pNewSubMenu)
@ -2074,7 +2072,7 @@ class CHandlerItemMenuCheck : public IActionHandler
{ {
//there is an offset of 1 because TInventory names are pet_animal1/2/3/4 //there is an offset of 1 because TInventory names are pet_animal1/2/3/4
std::string dst = toString("destination=pet_animal%d|", j + 1); std::string dst = toString("destination=pet_animal%d|", j + 1);
CViewTextMenu* tmp = pNewSubMenu->addLine(ucstring(pMoveToPa[j]->getHardText()),"item_group_move", dst + ahParams, name + toString("_pa%d", j + 1)); CViewTextMenu* tmp = pNewSubMenu->addLine(pMoveToPa[j]->getHardText(),"item_group_move", dst + ahParams, name + toString("_pa%d", j + 1));
if(tmp) tmp->setGrayed(pMoveToPa[j]->getGrayed()); if(tmp) tmp->setGrayed(pMoveToPa[j]->getGrayed());
} }
} }

@ -1668,7 +1668,7 @@ static DECLARE_INTERFACE_USER_FCT(getSPhraseName)
return false; return false;
sint sphraseId= (sint)args[0].getInteger(); sint sphraseId= (sint)args[0].getInteger();
CSPhraseManager *pPM= CSPhraseManager::getInstance(); CSPhraseManager *pPM= CSPhraseManager::getInstance();
result.setUCString(pPM->getPhrase(sphraseId).Name); result.setString(pPM->getPhrase(sphraseId).Name.toUtf8());
return true; return true;
} }
else else

@ -2575,11 +2575,11 @@ static DECLARE_INTERFACE_USER_FCT(getPriceWithFame)
sint value= (sint)args[0].getInteger(); sint value= (sint)args[0].getInteger();
sint valueFame= (sint)args[1].getInteger(); sint valueFame= (sint)args[1].getInteger();
if(value==-1) if(value==-1)
result.setUCString(CI18N::get("uiBadPrice")); result.setString(CI18N::get("uiBadPrice"));
else if(value==valueFame) else if(value==valueFame)
result.setUCString(NLMISC::formatThousands(toString(value))); result.setString(NLMISC::formatThousands(toString(value)));
else else
result.setUCString(NLMISC::formatThousands(toString(valueFame)) + " (" + NLMISC::formatThousands(toString(value)) + ")"); result.setString(NLMISC::formatThousands(toString(valueFame)) + " (" + NLMISC::formatThousands(toString(value)) + ")");
return true; return true;
} }
@ -2595,7 +2595,7 @@ static DECLARE_INTERFACE_USER_FCT(getBonusOnResale)
sint valueHigh= (sint)args[0].getInteger(); sint valueHigh= (sint)args[0].getInteger();
sint valueLow= (sint)args[1].getInteger(); sint valueLow= (sint)args[1].getInteger();
sint diff = valueHigh - valueLow; sint diff = valueHigh - valueLow;
result.setUCString("+" + NLMISC::formatThousands(toString(diff))); result.setString("+" + NLMISC::formatThousands(toString(diff)));
return true; return true;
} }

@ -56,7 +56,7 @@ CViewText *CDBGroupListSheetMission::CSheetChildMission::createViewText() const
CViewTextIDFormated *vti = new CViewTextIDFormated(CViewBase::TCtorParam()); CViewTextIDFormated *vti = new CViewTextIDFormated(CViewBase::TCtorParam());
if (Ctrl) vti->setDBLeaf(dynamic_cast<CCDBNodeLeaf *>(Ctrl->getRootBranch()->getNode(ICDBNode::CTextId("TEXT")))); if (Ctrl) vti->setDBLeaf(dynamic_cast<CCDBNodeLeaf *>(Ctrl->getRootBranch()->getNode(ICDBNode::CTextId("TEXT"))));
else vti->setDBLeaf(NULL); else vti->setDBLeaf(NULL);
vti->setFormatString(ucstring("$t")); vti->setFormatString("$t");
return vti; return vti;
} }

@ -205,7 +205,7 @@ void CEncyclopediaManager::rebuildAlbumList()
if (_Albums[i].Name == _AlbumNameSelected) if (_Albums[i].Name == _AlbumNameSelected)
pAlb->Opened = true; pAlb->Opened = true;
if (pSMC->getDynString(_Albums[i].Name, res)) if (pSMC->getDynString(_Albums[i].Name, res))
pAlb->Text = res; pAlb->Text = res.toUtf8();
else else
nlwarning("try to construct album without name"); nlwarning("try to construct album without name");
@ -217,7 +217,7 @@ void CEncyclopediaManager::rebuildAlbumList()
pThm->AHName = "ency_click_thema"; pThm->AHName = "ency_click_thema";
pThm->AHParams = toString(_Albums[i].Themas[j].Name); pThm->AHParams = toString(_Albums[i].Themas[j].Name);
if (pSMC->getDynString(_Albums[i].Themas[j].Name, res)) if (pSMC->getDynString(_Albums[i].Themas[j].Name, res))
pThm->Text = res; pThm->Text = res.toUtf8();
else else
nlwarning("try to construct thema without name"); nlwarning("try to construct thema without name");

@ -710,7 +710,7 @@ void CGroupCompasMenu::setActive (bool state)
ct.setType(CCompassTarget::North); ct.setType(CCompassTarget::North);
ct.Name = CI18N::get("uiNorth"); ct.Name = CI18N::get("uiNorth");
Targets.push_back(ct); Targets.push_back(ct);
getRootMenu()->addLineAtIndex(lineIndex ++, ct.Name, "set_compas", toString ("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); getRootMenu()->addLineAtIndex(lineIndex ++, ct.Name.toUtf8(), "set_compas", toString ("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str()));
// Home // Home
CCDBNodeLeaf *pos = NLGUI::CDBManager::getInstance()->getDbProp(COMPASS_DB_PATH ":HOME_POINT"); CCDBNodeLeaf *pos = NLGUI::CDBManager::getInstance()->getDbProp(COMPASS_DB_PATH ":HOME_POINT");
sint32 px = (sint32) (pos->getValue64() >> 32); sint32 px = (sint32) (pos->getValue64() >> 32);
@ -720,7 +720,7 @@ void CGroupCompasMenu::setActive (bool state)
ct.setType(CCompassTarget::Home); ct.setType(CCompassTarget::Home);
ct.Name = CI18N::get("uiHome"); ct.Name = CI18N::get("uiHome");
Targets.push_back(ct); Targets.push_back(ct);
getRootMenu()->addLineAtIndex(lineIndex ++, ct.Name, "set_compas", toString ("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); getRootMenu()->addLineAtIndex(lineIndex ++, ct.Name.toUtf8(), "set_compas", toString ("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str()));
} }
// Respawn // Respawn
pos = NLGUI::CDBManager::getInstance()->getDbProp(COMPASS_DB_PATH ":BIND_POINT"); pos = NLGUI::CDBManager::getInstance()->getDbProp(COMPASS_DB_PATH ":BIND_POINT");
@ -731,7 +731,7 @@ void CGroupCompasMenu::setActive (bool state)
ct.setType(CCompassTarget::Respawn); ct.setType(CCompassTarget::Respawn);
ct.Name = CI18N::get("uiRespawn"); ct.Name = CI18N::get("uiRespawn");
Targets.push_back(ct); Targets.push_back(ct);
getRootMenu()->addLineAtIndex(lineIndex ++, ct.Name, "set_compas", toString ("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); getRootMenu()->addLineAtIndex(lineIndex ++, ct.Name.toUtf8(), "set_compas", toString ("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str()));
} }
// As of 6/5/2007 : The option to point the selection is always proposed even if no slot is currently targeted // As of 6/5/2007 : The option to point the selection is always proposed even if no slot is currently targeted
@ -741,7 +741,7 @@ void CGroupCompasMenu::setActive (bool state)
if (entity != NULL) if (entity != NULL)
{*/ {*/
//ucstring targetName = CI18N::get("uiTargetTwoPoint") + entity->removeTitleAndShardFromName(entity->getEntityName()); //ucstring targetName = CI18N::get("uiTargetTwoPoint") + entity->removeTitleAndShardFromName(entity->getEntityName());
ucstring targetName = CI18N::get("uiTarget"); std::string targetName = CI18N::get("uiTarget");
ct.setType(CCompassTarget::Selection); ct.setType(CCompassTarget::Selection);
ct.Name = targetName; ct.Name = targetName;
Targets.push_back(ct); Targets.push_back(ct);
@ -789,7 +789,7 @@ void CGroupCompasMenu::setActive (bool state)
ct.setPositionState(tracker); ct.setPositionState(tracker);
ct.Name = name; ct.Name = name;
Targets.push_back(ct); Targets.push_back(ct);
missionSubMenu->addLine(ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); missionSubMenu->addLine(ct.Name.toUtf8(), "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str()));
selectable= true; selectable= true;
} }
} }
@ -846,7 +846,7 @@ void CGroupCompasMenu::setActive (bool state)
ct.Pos = currCont->ContLandMarks[k].Pos; ct.Pos = currCont->ContLandMarks[k].Pos;
ct.Name = CStringManagerClient::getPlaceLocalizedName(currCont->ContLandMarks[k].TitleTextID); ct.Name = CStringManagerClient::getPlaceLocalizedName(currCont->ContLandMarks[k].TitleTextID);
Targets.push_back(ct); Targets.push_back(ct);
landMarkSubMenu->addLineAtIndex(contLandMarkIndex++, ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); landMarkSubMenu->addLineAtIndex(contLandMarkIndex++, ct.Name.toUtf8(), "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str()));
selectable= true; selectable= true;
} }
// separator? // separator?
@ -869,7 +869,7 @@ void CGroupCompasMenu::setActive (bool state)
ct.Pos = sortedLandmarks[k].Pos; ct.Pos = sortedLandmarks[k].Pos;
ct.Name = sortedLandmarks[k].Title; ct.Name = sortedLandmarks[k].Title;
Targets.push_back(ct); Targets.push_back(ct);
landMarkSubMenus[sortedLandmarks[k].Type]->addLine(ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); landMarkSubMenus[sortedLandmarks[k].Type]->addLine(ct.Name.toUtf8(), "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str()));
selectable= true; selectable= true;
} }
} }
@ -900,7 +900,7 @@ void CGroupCompasMenu::setActive (bool state)
if (buildCompassTargetFromTeamMember(ct, k)) if (buildCompassTargetFromTeamMember(ct, k))
{ {
Targets.push_back(ct); Targets.push_back(ct);
teamSubMenu->addLine(ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); teamSubMenu->addLine(ct.Name.toUtf8(), "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str()));
selectable= true; selectable= true;
} }
} }
@ -923,7 +923,7 @@ void CGroupCompasMenu::setActive (bool state)
if (buildCompassTargetFromAnimalMember(ct, k)) if (buildCompassTargetFromAnimalMember(ct, k))
{ {
Targets.push_back(ct); Targets.push_back(ct);
animalSubMenu->addLine(ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); animalSubMenu->addLine(ct.Name.toUtf8(), "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str()));
selectable= true; selectable= true;
} }
} }
@ -951,7 +951,7 @@ void CGroupCompasMenu::setActive (bool state)
CSmartPtr<CDialogEntityPositionState> tracker = new CDialogEntityPositionState( i ); CSmartPtr<CDialogEntityPositionState> tracker = new CDialogEntityPositionState( i );
ct.setPositionState(tracker); ct.setPositionState(tracker);
Targets.push_back(ct); Targets.push_back(ct);
dialogsSubMenu->addLine(ct.Name, "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str())); dialogsSubMenu->addLine(ct.Name.toUtf8(), "set_compas", toString("compass=%s|id=%d|menu=%s", _TargetCompass.c_str(), (int) Targets.size() - 1, _Id.c_str()));
selectable= true; selectable= true;
} }
} }

@ -3811,7 +3811,7 @@ void CGroupMap::updateClosestLandMarkMenu(const std::string &menu, const NLMISC:
std::string lineId = toString("%s:lmcosest%d", menu.c_str(), i); std::string lineId = toString("%s:lmcosest%d", menu.c_str(), i);
std::string ahParams = toString("type=user|map=%s|index=%d", _Id.c_str(), index); std::string ahParams = toString("type=user|map=%s|index=%d", _Id.c_str(), index);
CViewTextMenu* vt = rootMenu->addLine(ucstring(""), "map_landmark_by_index", ahParams, lineId.c_str(), "", "", false, false, false); CViewTextMenu* vt = rootMenu->addLine(std::string(), "map_landmark_by_index", ahParams, lineId.c_str(), "", "", false, false, false);
if (!vt) break; if (!vt) break;
vt->setSingleLineTextFormatTaged(name.toUtf8()); vt->setSingleLineTextFormatTaged(name.toUtf8());

@ -224,7 +224,7 @@ void CGroupPhraseSkillFilter::rebuild()
// just text // just text
pNode->DisplayText = true; pNode->DisplayText = true;
pNode->Template = NULL; pNode->Template = NULL;
pNode->Text= STRING_MANAGER::CStringManagerClient::getSkillLocalizedName((SKILLS::ESkills)i);; pNode->Text = CUtfStringView(STRING_MANAGER::CStringManagerClient::getSkillLocalizedName((SKILLS::ESkills)i)).toUtf8();
// Action handler? // Action handler?
if(!_AHCtrlNode.empty()) if(!_AHCtrlNode.empty())

@ -245,11 +245,11 @@ static DECLARE_INTERFACE_USER_FCT(getSkillBaseText)
if(skillValue!=skillBase) if(skillValue!=skillBase)
{ {
result.setUCString( toString("(%d)", skillBase) ); result.setString( toString("(%d)", skillBase) );
} }
else else
{ {
result.setUCString( ucstring() ); result.setString( std::string() );
} }
return true; return true;
@ -335,7 +335,7 @@ void CGroupSkills::createAllTreeNodes()
// local variable (avoid realloc in loop) // local variable (avoid realloc in loop)
vector< pair<string, string> > tempVec(2); vector< pair<string, string> > tempVec(2);
ucstring sSkillName; string sSkillName;
while ((!bQuit) && (nCounter < 32)) // Counter is used to not infinitly loop while ((!bQuit) && (nCounter < 32)) // Counter is used to not infinitly loop
{ {
@ -365,7 +365,7 @@ void CGroupSkills::createAllTreeNodes()
pNode->Id = NLMISC::toString(i); pNode->Id = NLMISC::toString(i);
// get Skill Name // get Skill Name
sSkillName = STRING_MANAGER::CStringManagerClient::getSkillLocalizedName((SKILLS::ESkills)i); sSkillName = CUtfStringView(STRING_MANAGER::CStringManagerClient::getSkillLocalizedName((SKILLS::ESkills)i)).toUtf8();
// just text or template? // just text or template?
if(_TemplateSkill.empty()) if(_TemplateSkill.empty())
@ -387,7 +387,7 @@ void CGroupSkills::createAllTreeNodes()
// Set Skill Name // Set Skill Name
CViewText *pViewSkillName = dynamic_cast<CViewText*>(pIG->getView("name")); CViewText *pViewSkillName = dynamic_cast<CViewText*>(pIG->getView("name"));
if (pViewSkillName != NULL) if (pViewSkillName != NULL)
pViewSkillName->setText (sSkillName.toUtf8()); pViewSkillName->setText (sSkillName);
// Set Skill Max Value // Set Skill Max Value
CViewText *pViewSkillMax = dynamic_cast<CViewText*>(pIG->getView("max")); CViewText *pViewSkillMax = dynamic_cast<CViewText*>(pIG->getView("max"));
if (pViewSkillMax != NULL) if (pViewSkillMax != NULL)

@ -176,7 +176,7 @@ static DECLARE_INTERFACE_USER_FCT(getCompassText)
"uiWNW", "uiWNW",
}; };
result.setUCString( CI18N::get(txts[direction]) ); result.setString( CI18N::get(txts[direction]) );
return true; return true;
} }
REGISTER_INTERFACE_USER_FCT("getCompassText", getCompassText); REGISTER_INTERFACE_USER_FCT("getCompassText", getCompassText);
@ -251,7 +251,7 @@ static DECLARE_INTERFACE_USER_FCT(getDifficultyText)
} }
SENTENCE_APPRAISAL::ESentenceAppraisal sa = (SENTENCE_APPRAISAL::ESentenceAppraisal)args[0].getInteger(); SENTENCE_APPRAISAL::ESentenceAppraisal sa = (SENTENCE_APPRAISAL::ESentenceAppraisal)args[0].getInteger();
result.setUCString (CI18N::get(SENTENCE_APPRAISAL::toString(sa))); result.setString (CI18N::get(SENTENCE_APPRAISAL::toString(sa)));
return true; return true;
} }
@ -665,14 +665,14 @@ static DECLARE_INTERFACE_USER_FCT(getKey)
CActionsManager::TActionComboMap::const_iterator it = acmap.find(CAction::CName(name.c_str(),param.c_str())); CActionsManager::TActionComboMap::const_iterator it = acmap.find(CAction::CName(name.c_str(),param.c_str()));
if (it != acmap.end()) if (it != acmap.end())
{ {
result.setUCString (it->second.toUCString()); result.setString (it->second.toUCString().toUtf8());
} }
else else
{ {
if (notna) if (notna)
result.setUCString (ucstring("")); result.setString (std::string());
else else
result.setUCString (CI18N::get("uiNotAssigned")); result.setString (CI18N::get("uiNotAssigned"));
} }
return true; return true;
@ -1025,9 +1025,9 @@ static DECLARE_INTERFACE_USER_FCT(getBotChatBuyFilterMPText)
RM_FABER_TYPE::TRMFType faberType= (RM_FABER_TYPE::TRMFType)args[0].getInteger(); RM_FABER_TYPE::TRMFType faberType= (RM_FABER_TYPE::TRMFType)args[0].getInteger();
if(faberType>=RM_FABER_TYPE::Unknown) if(faberType>=RM_FABER_TYPE::Unknown)
result.setUCString(CI18N::get("uittBCNoItemPartFilter")); result.setString(CI18N::get("uittBCNoItemPartFilter"));
else else
result.setUCString(RM_FABER_TYPE::toLocalString(faberType)); result.setString(RM_FABER_TYPE::toLocalString(faberType));
return true; return true;
} }
@ -1076,15 +1076,15 @@ static DECLARE_INTERFACE_USER_FCT(getOutpostName)
uint32 nSheet = (uint32)args[0].getInteger(); uint32 nSheet = (uint32)args[0].getInteger();
if (nSheet == 0) if (nSheet == 0)
{ {
result.setUCString(string("")); result.setString(string());
return true; return true;
} }
// get sheet name // get sheet name
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
const ucstring name(pSMC->getOutpostLocalizedName(CSheetId(nSheet))); const std::string name = CUtfStringView(pSMC->getOutpostLocalizedName(CSheetId(nSheet))).toUtf8();
result.setUCString(name); result.setString(name);
return true; return true;
} }
@ -1103,15 +1103,15 @@ static DECLARE_INTERFACE_USER_FCT(getOutpostDesc)
uint32 nSheet = (uint32)args[0].getInteger(); uint32 nSheet = (uint32)args[0].getInteger();
if (nSheet == 0) if (nSheet == 0)
{ {
result.setUCString(string("")); result.setString(string());
return true; return true;
} }
// get sheet name // get sheet name
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
const ucstring name(pSMC->getOutpostLocalizedDescription(CSheetId(nSheet))); const string name = CUtfStringView(pSMC->getOutpostLocalizedDescription(CSheetId(nSheet))).toUtf8();
result.setUCString(name); result.setString(name);
return true; return true;
} }
@ -1130,15 +1130,15 @@ static DECLARE_INTERFACE_USER_FCT(getOutpostBuildingName)
uint32 nSheet = (uint32)args[0].getInteger(); uint32 nSheet = (uint32)args[0].getInteger();
if (nSheet == 0) if (nSheet == 0)
{ {
result.setUCString(string("")); result.setString(string());
return true; return true;
} }
// get sheet name // get sheet name
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
const ucstring name(pSMC->getOutpostBuildingLocalizedName(CSheetId(nSheet))); const string name = CUtfStringView(pSMC->getOutpostBuildingLocalizedName(CSheetId(nSheet))).toUtf8();
result.setUCString(name); result.setString(name);
return true; return true;
} }
@ -1157,12 +1157,12 @@ static DECLARE_INTERFACE_USER_FCT(getOutpostBuildingDesc)
uint32 nSheet = (uint32)args[0].getInteger(); uint32 nSheet = (uint32)args[0].getInteger();
if (nSheet == 0) if (nSheet == 0)
{ {
result.setUCString(string("")); result.setString(string());
return true; return true;
} }
// get sheet name // get sheet name
ucstring name; string name;
CEntitySheet *pSheet= SheetMngr.get(CSheetId(nSheet)); CEntitySheet *pSheet= SheetMngr.get(CSheetId(nSheet));
COutpostBuildingSheet *pOBS = dynamic_cast<COutpostBuildingSheet*>(pSheet); COutpostBuildingSheet *pOBS = dynamic_cast<COutpostBuildingSheet*>(pSheet);
if (pOBS && pOBS->OBType == COutpostBuildingSheet::OB_Empty) if (pOBS && pOBS->OBType == COutpostBuildingSheet::OB_Empty)
@ -1173,11 +1173,11 @@ static DECLARE_INTERFACE_USER_FCT(getOutpostBuildingDesc)
else else
{ {
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
name = pSMC->getOutpostBuildingLocalizedDescription(CSheetId(nSheet)); name = CUtfStringView(pSMC->getOutpostBuildingLocalizedDescription(CSheetId(nSheet))).toUtf8();
} }
result.setUCString(name); result.setString(name);
return true; return true;
} }
@ -1196,15 +1196,15 @@ static DECLARE_INTERFACE_USER_FCT(getSquadName)
uint32 nSheet = (uint32)args[0].getInteger(); uint32 nSheet = (uint32)args[0].getInteger();
if (nSheet == 0) if (nSheet == 0)
{ {
result.setUCString(string("")); result.setString(string());
return true; return true;
} }
// get sheet name // get sheet name
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
const ucstring name(pSMC->getSquadLocalizedName(CSheetId(nSheet))); const string name = CUtfStringView(pSMC->getSquadLocalizedName(CSheetId(nSheet))).toUtf8();
result.setUCString(name); result.setString(name);
return true; return true;
} }
@ -1223,15 +1223,15 @@ static DECLARE_INTERFACE_USER_FCT(getSquadDesc)
uint32 nSheet = (uint32)args[0].getInteger(); uint32 nSheet = (uint32)args[0].getInteger();
if (nSheet == 0) if (nSheet == 0)
{ {
result.setUCString(string("")); result.setString(string());
return true; return true;
} }
// get sheet name // get sheet name
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
const ucstring name(pSMC->getSquadLocalizedDescription(CSheetId(nSheet))); const string name = CUtfStringView(pSMC->getSquadLocalizedDescription(CSheetId(nSheet))).toUtf8();
result.setUCString(name); result.setString(name);
return true; return true;
} }
@ -1284,7 +1284,7 @@ static DECLARE_INTERFACE_USER_FCT(getOutpostPeriod)
// if status wanted is peace or unknow, then "N/A", because there is no attack period in peace mode // if status wanted is peace or unknow, then "N/A", because there is no attack period in peace mode
if( status==OUTPOSTENUMS::Peace || status==OUTPOSTENUMS::UnknownOutpostState ) if( status==OUTPOSTENUMS::Peace || status==OUTPOSTENUMS::UnknownOutpostState )
{ {
result.setUCString(string(" - ")); result.setString(string(" - "));
return true; return true;
} }
@ -1292,7 +1292,7 @@ static DECLARE_INTERFACE_USER_FCT(getOutpostPeriod)
if( (isAttackPeriod && status>OUTPOSTENUMS::AttackRound) || if( (isAttackPeriod && status>OUTPOSTENUMS::AttackRound) ||
(!isAttackPeriod && status>OUTPOSTENUMS::DefenseRound) ) (!isAttackPeriod && status>OUTPOSTENUMS::DefenseRound) )
{ {
result.setUCString(CI18N::get("uiOutpostPeriodEnded")); result.setString(CI18N::get("uiOutpostPeriodEnded"));
return true; return true;
} }
@ -1312,7 +1312,7 @@ static DECLARE_INTERFACE_USER_FCT(getOutpostPeriod)
tstruct= gmtime(&tval); tstruct= gmtime(&tval);
if(!tstruct) if(!tstruct)
{ {
result.setUCString(string("Bad Date Received")); result.setString(string("Bad Date Received"));
return true; return true;
} }
dname= tstruct->tm_wday; // 0-6 (Sunday==0!!) dname= tstruct->tm_wday; // 0-6 (Sunday==0!!)
@ -1325,21 +1325,21 @@ static DECLARE_INTERFACE_USER_FCT(getOutpostPeriod)
tstruct= gmtime(&tval); tstruct= gmtime(&tval);
if(!tstruct) if(!tstruct)
{ {
result.setUCString(string("Bad Date Received")); result.setString(string("Bad Date Received"));
return true; return true;
} }
hend= tstruct->tm_hour; // 0-23 hend= tstruct->tm_hour; // 0-23
mend= tstruct->tm_min; // 0-59 mend= tstruct->tm_min; // 0-59
// translate // translate
ucstring res= CI18N::get("uiOutpostPeriodFormat"); string res= CI18N::get("uiOutpostPeriodFormat");
strFindReplace( res, "%dayname", CI18N::get(toString("uiDay%d", dname)) ); strFindReplace( res, "%dayname", CI18N::get(toString("uiDay%d", dname)) );
strFindReplace( res, "%daynumber", toString(dnumber) ); strFindReplace( res, "%daynumber", toString(dnumber) );
strFindReplace( res, "%month", CI18N::get(toString("uiMonth%02d", month+1)) ); strFindReplace( res, "%month", CI18N::get(toString("uiMonth%02d", month+1)) );
strFindReplace( res, "%timestart", toString("%02d:%02d", hstart, mstart) ); strFindReplace( res, "%timestart", toString("%02d:%02d", hstart, mstart) );
strFindReplace( res, "%timeend", toString("%02d:%02d", hend, mend) ); strFindReplace( res, "%timeend", toString("%02d:%02d", hend, mend) );
result.setUCString(res); result.setString(res);
return true; return true;
} }
REGISTER_INTERFACE_USER_FCT("getOutpostPeriod", getOutpostPeriod) REGISTER_INTERFACE_USER_FCT("getOutpostPeriod", getOutpostPeriod)

@ -312,16 +312,16 @@ static DECLARE_INTERFACE_USER_FCT(getSheetName)
// if from ctrlSheet, then take the correct ACTUAL name (ie from NAMEID if not 0) // if from ctrlSheet, then take the correct ACTUAL name (ie from NAMEID if not 0)
if(ctrlSheet) if(ctrlSheet)
{ {
result.setUCString(ctrlSheet->getItemActualName()); result.setString(ctrlSheet->getItemActualName().toUtf8());
return true; return true;
} }
// Standard (but less accurate) way // Standard (but less accurate) way
else else
{ {
const CItemSheet *itemSheet = getItemSheet(args); const CItemSheet *itemSheet = getItemSheet(args);
ucstring tmp; string tmp;
if (itemSheet != NULL) tmp = STRING_MANAGER::CStringManagerClient::getItemLocalizedName(itemSheet->Id); if (itemSheet != NULL) tmp = CUtfStringView(STRING_MANAGER::CStringManagerClient::getItemLocalizedName(itemSheet->Id)).toUtf8();
result.setUCString(tmp); result.setString(tmp);
return true; return true;
} }
} }
@ -345,9 +345,9 @@ static DECLARE_INTERFACE_USER_FCT(getItemTranslatedName)
return false; return false;
} }
ucstring tmp; string tmp;
tmp = STRING_MANAGER::CStringManagerClient::getItemLocalizedName(sheet); tmp = CUtfStringView(STRING_MANAGER::CStringManagerClient::getItemLocalizedName(sheet)).toUtf8();
result.setUCString(tmp); result.setString(tmp);
return true; return true;
} }
REGISTER_INTERFACE_USER_FCT("getItemTranslatedName", getItemTranslatedName) REGISTER_INTERFACE_USER_FCT("getItemTranslatedName", getItemTranslatedName)

@ -324,12 +324,12 @@ class CStringManagerTextProvider : public CViewTextID::IViewTextProvider
class CRyzomTextFormatter : public CViewTextFormated::IViewTextFormatter class CRyzomTextFormatter : public CViewTextFormated::IViewTextFormatter
{ {
public: public:
ucstring formatString( const ucstring &inputString, const ucstring &paramString ) std::string formatString( const std::string &inputString, const std::string &paramString )
{ {
ucstring formatedResult; std::string formatedResult;
// Apply the format // Apply the format
for(ucstring::const_iterator it = inputString.begin(); it != inputString.end();) for(std::string::const_iterator it = inputString.begin(); it != inputString.end();)
{ {
if (*it == '$') if (*it == '$')
{ {
@ -347,13 +347,14 @@ public:
case 'p': // add player name case 'p': // add player name
if (ClientCfg.Local) if (ClientCfg.Local)
{ {
formatedResult += ucstring("player"); if (*it == 'P') formatedResult += "PLAYER";
else formatedResult += "Player";
} }
else else
{ {
if(UserEntity) if(UserEntity)
{ {
ucstring name = UserEntity->getEntityName(); std::string name = UserEntity->getEntityName().toUtf8();
if (*it == 'P') name = toUpper(name); if (*it == 'P') name = toUpper(name);
formatedResult += name; formatedResult += name;
} }
@ -363,11 +364,11 @@ public:
case 's': case 's':
case 'b': // add bot name case 'b': // add bot name
{ {
ucstring botName; string botName;
bool womanTitle = false; bool womanTitle = false;
if (ClientCfg.Local) if (ClientCfg.Local)
{ {
botName = ucstring("NPC"); botName = "NPC";
} }
else else
{ {
@ -387,7 +388,7 @@ public:
} }
else else
{ {
botName = entity->getDisplayName(); botName = entity->getDisplayName().toUtf8();
} }
CCharacterCL *pChar = dynamic_cast<CCharacterCL*>(entity); CCharacterCL *pChar = dynamic_cast<CCharacterCL*>(entity);
if (pChar != NULL) if (pChar != NULL)
@ -396,40 +397,40 @@ public:
} }
} }
// get the title translated // get the title translated
ucstring sTitleTranslated = botName; ucstring sTitleTranslated = botName; // FIXME: UTF-8
CStringPostProcessRemoveName spprn; CStringPostProcessRemoveName spprn;
spprn.Woman = womanTitle; spprn.Woman = womanTitle;
spprn.cbIDStringReceived(sTitleTranslated); spprn.cbIDStringReceived(sTitleTranslated);
botName = CEntityCL::removeTitleAndShardFromName(botName); botName = CEntityCL::removeTitleAndShardFromName(botName).toUtf8();
// short name (with no title such as 'guard', 'merchant' ...) // short name (with no title such as 'guard', 'merchant' ...)
if (*it == 's') if (*it == 's')
{ {
// But if there is no name, display only the title // But if there is no name, display only the title
if (botName.empty()) if (botName.empty())
botName = sTitleTranslated; botName = sTitleTranslated.toUtf8();
} }
else else
{ {
// Else we want the title ! // Else we want the title !
if (!botName.empty()) if (!botName.empty())
botName += " "; botName += " ";
botName += sTitleTranslated; botName += sTitleTranslated.toUtf8();
} }
formatedResult += botName; formatedResult += botName;
} }
break; break;
default: default:
formatedResult += (ucchar) '$'; formatedResult += '$';
break; break;
} }
++it; ++it;
} }
else else
{ {
formatedResult += (ucchar) *it; formatedResult += *it;
++it; ++it;
} }
} }
@ -2302,7 +2303,7 @@ void CInterfaceManager::addServerString (const std::string &sTarget, uint32 id,
if (id == 0) if (id == 0)
{ {
CInterfaceExprValue val; CInterfaceExprValue val;
val.setUCString (ucstring("")); val.setString (std::string());
CInterfaceLink::setTargetProperty (sTarget, val); CInterfaceLink::setTargetProperty (sTarget, val);
return; return;
} }
@ -2320,7 +2321,7 @@ void CInterfaceManager::addServerID (const std::string &sTarget, uint32 id, IStr
if (id == 0) if (id == 0)
{ {
CInterfaceExprValue val; CInterfaceExprValue val;
val.setUCString (ucstring("")); val.setString (std::string());
CInterfaceLink::setTargetProperty (sTarget, val); CInterfaceLink::setTargetProperty (sTarget, val);
return; return;
} }
@ -2367,7 +2368,7 @@ void CInterfaceManager::processServerIDString()
if (bValid) if (bValid)
{ {
ucstrToAffect = STRING_MANAGER::CStringManagerClient::getLocalizedName(ucstrToAffect); ucstrToAffect = STRING_MANAGER::CStringManagerClient::getLocalizedName(ucstrToAffect);
val.setUCString (ucstrToAffect); val.setString (ucstrToAffect.toUtf8());
CInterfaceLink::setTargetProperty (pISW->Target, val); CInterfaceLink::setTargetProperty (pISW->Target, val);
} }
@ -3336,7 +3337,7 @@ void CInterfaceManager::initEmotes()
translateEmote(sTmp, sTranslatedName, sCommandName, sCommandNameAlt); translateEmote(sTmp, sTranslatedName, sCommandName, sCommandNameAlt);
// Create a line // Create a line
pMenu->addLine (sTranslatedName + " (/" + ucstring::makeFromUtf8(sCommandName) + ")", "emote", pMenu->addLine (sTranslatedName.toUtf8() + " (/" + sCommandName + ")", "emote",
"nb="+toString(nEmoteNb)+"|behav="+toString(nBehav), sTmp); "nb="+toString(nEmoteNb)+"|behav="+toString(nBehav), sTmp);
} }
} }
@ -3392,7 +3393,7 @@ void CInterfaceManager::initEmotes()
{ {
// Yeah that's a quick emote too; set command // Yeah that's a quick emote too; set command
pMenu->addLineAtIndex (i, pMenu->addLineAtIndex (i,
"@{FFFF}/" + ucstring::makeFromUtf8(sCommandName), "@{FFFF}/" + sCommandName,
"emote", "nb="+toString(nEmoteNb)+"|behav="+toString(nBehav), "emote", "nb="+toString(nEmoteNb)+"|behav="+toString(nBehav),
"", "", "", false, false, true); "", "", "", false, false, true);

@ -269,7 +269,7 @@ static DECLARE_INTERFACE_USER_FCT(lua)
if (CLuaIHM::pop(ls, ucstrVal)) if (CLuaIHM::pop(ls, ucstrVal))
{ {
result.setUCString(ucstrVal); result.setString(ucstrVal.toUtf8());
ok = true; ok = true;
} }

@ -2593,7 +2593,7 @@ public:
{ {
for(uint l = 0; l < pl.PartyChats.size(); ++l) for(uint l = 0; l < pl.PartyChats.size(); ++l)
{ {
menu->addLineAtIndex(insertionIndex, pl.PartyChats[l].Window->getTitle(), "chat_target_selected", toString(pl.PartyChats[l].ID)); menu->addLineAtIndex(insertionIndex, pl.PartyChats[l].Window->getTitle().toUtf8(), "chat_target_selected", toString(pl.PartyChats[l].ID));
++ insertionIndex; ++ insertionIndex;
} }
} }
@ -2640,8 +2640,8 @@ public:
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
// replace dynamic channel name and shortcut // replace dynamic channel name and shortcut
ucstring res = CI18N::get("uiFilterMenuDynamic"); string res = CI18N::get("uiFilterMenuDynamic");
strFindReplace(res, "%channel", title); strFindReplace(res, "%channel", title.toUtf8());
strFindReplace(res, "%shortcut", s); strFindReplace(res, "%shortcut", s);
pMenu->addLineAtIndex(5 + insertion_index, res, "chat_target_selected", "dyn"+s, "dyn"+s); pMenu->addLineAtIndex(5 + insertion_index, res, "chat_target_selected", "dyn"+s, "dyn"+s);
@ -2940,7 +2940,7 @@ class CHandlerSelectChatSource : public IActionHandler
{ {
if (pc[l].Filter != NULL) if (pc[l].Filter != NULL)
{ {
menu->addLineAtIndex(insertionIndex, pc[l].Window->getTitle(), FILTER_TOGGLE, toString(pc[l].ID)); menu->addLineAtIndex(insertionIndex, pc[l].Window->getTitle().toUtf8(), FILTER_TOGGLE, toString(pc[l].ID));
menu->setUserGroupLeft(insertionIndex, createMenuCheckBox(FILTER_TOGGLE, toString(pc[l].ID), pc[l].Filter->isListeningWindow(cw))); menu->setUserGroupLeft(insertionIndex, createMenuCheckBox(FILTER_TOGGLE, toString(pc[l].ID), pc[l].Filter->isListeningWindow(cw)));
++ insertionIndex; ++ insertionIndex;
} }
@ -2956,7 +2956,7 @@ class CHandlerSelectChatSource : public IActionHandler
{ {
ucstring title; ucstring title;
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
menu->addLineAtIndex(insertionIndex, "["+s+"] " + title, FILTER_TOGGLE, "dyn"+s); menu->addLineAtIndex(insertionIndex, "["+s+"] " + title.toUtf8(), FILTER_TOGGLE, "dyn"+s);
menu->setUserGroupLeft(insertionIndex, createMenuCheckBox(FILTER_TOGGLE, "dyn"+s, pi.ChatInput.DynamicChat[i].isListeningWindow(cw))); menu->setUserGroupLeft(insertionIndex, createMenuCheckBox(FILTER_TOGGLE, "dyn"+s, pi.ChatInput.DynamicChat[i].isListeningWindow(cw)));
++insertionIndex; ++insertionIndex;
} }

@ -60,6 +60,7 @@ public:
// Force the cache to be saved // Force the cache to be saved
void flushStringCache(); void flushStringCache();
bool getString(uint32 stringId, std::string &result) { ucstring temp; getString(stringId, temp); result = temp.toUtf8(); } // FIXME: UTF-8
bool getString(uint32 stringId, ucstring &result); bool getString(uint32 stringId, ucstring &result);
void waitString(uint32 stringId, const IStringWaiterRemover *premover, ucstring *result); void waitString(uint32 stringId, const IStringWaiterRemover *premover, ucstring *result);
void waitString(uint32 stringId, IStringWaitCallback *pcallback); void waitString(uint32 stringId, IStringWaitCallback *pcallback);

Loading…
Cancel
Save