mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-15 22:08:43 +00:00
Separate window displayer message stringify
This commit is contained in:
parent
8d0111f8c3
commit
7a3de546f6
2 changed files with 26 additions and 13 deletions
|
@ -64,6 +64,8 @@ public:
|
|||
|
||||
virtual void getWindowPos (uint32 &x, uint32 &y, uint32 &w, uint32 &h) { x=y=w=h=0; }
|
||||
|
||||
static std::string stringifyMessage(const NLMISC::CLog::TDisplayInfo &args, const char *message, bool needSlashR = false);
|
||||
|
||||
protected:
|
||||
|
||||
// display a string (MT)
|
||||
|
|
|
@ -116,21 +116,15 @@ void CWindowDisplayer::create (string windowNameEx, bool iconified, sint x, sint
|
|||
_Thread->start ();
|
||||
}
|
||||
|
||||
void CWindowDisplayer::doDisplay (const NLMISC::CLog::TDisplayInfo &args, const char *message)
|
||||
std::string CWindowDisplayer::stringifyMessage(const NLMISC::CLog::TDisplayInfo &args, const char *message, bool needSlashR)
|
||||
{
|
||||
bool needSpace = false;
|
||||
//stringstream ss;
|
||||
string str;
|
||||
|
||||
uint32 color = 0xFF000000;
|
||||
|
||||
if (args.LogType != CLog::LOG_NO)
|
||||
{
|
||||
str += logTypeToString(args.LogType);
|
||||
if (args.LogType == CLog::LOG_ERROR || args.LogType == CLog::LOG_ASSERT) color = 0x00FF0000;
|
||||
else if (args.LogType == CLog::LOG_WARNING) color = 0x00800000;
|
||||
else if (args.LogType == CLog::LOG_DEBUG) color = 0x00808080;
|
||||
else color = 0;
|
||||
str += CWindowDisplayer::logTypeToString(args.LogType);
|
||||
needSpace = true;
|
||||
}
|
||||
|
||||
|
@ -200,6 +194,23 @@ void CWindowDisplayer::doDisplay (const NLMISC::CLog::TDisplayInfo &args, const
|
|||
}
|
||||
str += pos;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
void CWindowDisplayer::doDisplay (const NLMISC::CLog::TDisplayInfo &args, const char *message)
|
||||
{
|
||||
uint32 color = 0xFF000000;
|
||||
|
||||
if (args.LogType != CLog::LOG_NO)
|
||||
{
|
||||
if (args.LogType == CLog::LOG_ERROR || args.LogType == CLog::LOG_ASSERT) color = 0x00FF0000;
|
||||
else if (args.LogType == CLog::LOG_WARNING) color = 0x00800000;
|
||||
else if (args.LogType == CLog::LOG_DEBUG) color = 0x00808080;
|
||||
else color = 0;
|
||||
}
|
||||
|
||||
std::string str = stringifyMessage(args, message, needSlashR);
|
||||
|
||||
{
|
||||
CSynchronized<std::list<std::pair<uint32, std::string> > >::CAccessor access (&_Buffer);
|
||||
if (_HistorySize > 0 && access.value().size() >= (uint)_HistorySize)
|
||||
|
|
Loading…
Reference in a new issue