//================================================================================= CViewBase *CChatTextManager::createMsgText(const ucstring &cstMsg, NLMISC::CRGBA col, bool justified /*=false*/) { ucstring msg = cstMsg; CInterfaceGroup *commandGroup = parseCommandTag(msg); CViewText *vt = new CViewText(CViewText::TCtorParam()); // get parameters from config.xml vt->setShadow(isTextShadowed()); vt->setFontSize(getTextFontSize()); vt->setMultiLine(true); vt->setTextMode(justified ? CViewText::Justified : CViewText::DontClipWord); vt->setMultiLineSpace(getTextMultiLineSpace()); vt->setModulateGlobalColor(false); ucstring cur_time; if (showTimestamps()) { cur_time = CInterfaceManager::getTimestampHuman(); } // if text contain any color code, set the text formated and white, // otherwise, set text normal and apply global color size_t codePos = msg.find(ucstring("@{")); if (codePos != ucstring::npos) { // Prepend the current time (do it after the color if the color at first position. if (codePos == 0) { codePos = msg.find(ucstring("}")); msg = msg.substr(0, codePos + 1) + cur_time + msg.substr(codePos + 1, msg.length() - codePos); } else { msg = cur_time + msg; } vt->setTextFormatTaged(msg); vt->setColor(NLMISC::CRGBA::White); } else { msg = cur_time + msg; vt->setText(msg); vt->setColor(col); } if (!commandGroup) { return vt; } else { return buildLineWithCommand(commandGroup, vt); } }