ConsoleTitle::ConsoleTitle(const wchar_t *title) { CriticalSectionLock Lock(TitleCS); Console.GetTitle(strOldTitle); if (title) SetFarTitle(title, true); }
void ConsoleTitle::Set(const wchar_t *fmt, ...) { CriticalSectionLock Lock(TitleCS); wchar_t msg[2048]; va_list argptr; va_start(argptr, fmt); vswprintf(msg, ARRAYSIZE(msg)-1, fmt, argptr); va_end(argptr); SetFarTitle(msg); }
ConsoleTitle::~ConsoleTitle() { CriticalSectionLock Lock(TitleCS); const string &strTitleAddons = GetFarTitleAddons(); size_t OldLen = strOldTitle.GetLength(); size_t AddonsLen = strTitleAddons.GetLength(); if (AddonsLen <= OldLen) { if (!StrCmpI(strOldTitle.CPtr()+OldLen-AddonsLen, strTitleAddons)) strOldTitle.SetLength(OldLen-AddonsLen); } SetFarTitle(strOldTitle, true); }
ConsoleTitle::~ConsoleTitle() { SCOPED_ACTION(CriticalSectionLock)(TitleCS); const string &strTitleAddons = GetFarTitleAddons(); size_t OldLen = strOldTitle.size(); size_t AddonsLen = strTitleAddons.size(); if (AddonsLen <= OldLen) { if (!StrCmpI(strOldTitle.data()+OldLen-AddonsLen, strTitleAddons.data())) strOldTitle.resize(OldLen-AddonsLen); } SetFarTitle(strOldTitle); }
BaseFormat& ConsoleTitle::Flush() { SetFarTitle(*this); Clear(); return *this; }
ConsoleTitle::ConsoleTitle(const string& title) { SCOPED_ACTION(CriticalSectionLock)(TitleCS); Global->Console->GetTitle(strOldTitle); SetFarTitle(title); }