mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-07 22:03:42 -06:00
bazaar: LogCtrl is buffered now for performance reasons and threading
git-svn-id: svn://ultimatepp.org/upp/trunk@5406 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
527c96bc22
commit
870d64c46e
3 changed files with 18 additions and 16 deletions
|
|
@ -5,7 +5,9 @@ LoggerCtrl::LoggerCtrl() : maxlines(1000), ignore(false)
|
|||
NoInitFocus();
|
||||
NoWantFocus();
|
||||
SetReadOnly();
|
||||
//Reserve(maxlines*64);
|
||||
Reserve(512);
|
||||
|
||||
SetTimeCallback(-200, THISBACK(Flush));
|
||||
}
|
||||
|
||||
void LoggerCtrl::Save()
|
||||
|
|
@ -32,23 +34,24 @@ void LoggerCtrl::Updated()
|
|||
void LoggerCtrl::_Put(int w)
|
||||
{
|
||||
if(ignore) return;
|
||||
String d;
|
||||
d.Cat(w);
|
||||
//String s = EscapeCh((unsigned)w);
|
||||
GuiLock _;
|
||||
Insert(GetLength(), d);
|
||||
SetCursor(GetLength());
|
||||
StringStream::_Put(w);
|
||||
}
|
||||
|
||||
void LoggerCtrl::_Put(const void *data, dword size)
|
||||
{
|
||||
if(ignore) return;
|
||||
String d;
|
||||
d.Cat((const char*)data, size);
|
||||
//String s = EscapeCh(d);
|
||||
GuiLock _;
|
||||
Insert(GetLength(), d);
|
||||
SetCursor(GetLength());
|
||||
StringStream::_Put(data, size);
|
||||
}
|
||||
|
||||
void LoggerCtrl::Flush()
|
||||
{
|
||||
if(StringStream::GetSize() > 0)
|
||||
{
|
||||
Insert(GetLength(), GetResult());
|
||||
SetCursor(GetLength());
|
||||
StringStream::Create(); //empty
|
||||
Reserve(512);
|
||||
}
|
||||
}
|
||||
|
||||
LogCtrl::LogCtrl() : ps(NULL)
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ inline void LogLev(int l) { Single<LOGLEV>() = (LOGLEV)l;}
|
|||
|
||||
///
|
||||
|
||||
class LoggerCtrl : public DocEdit, public Stream
|
||||
class LoggerCtrl : public DocEdit, public StringStream
|
||||
{
|
||||
public:
|
||||
typedef LoggerCtrl CLASSNAME;
|
||||
|
|
@ -58,7 +58,7 @@ public:
|
|||
int GetMaxLines() const { return maxlines; }
|
||||
virtual void Updated();
|
||||
|
||||
virtual bool IsOpen() const { return true; }
|
||||
virtual void Flush();
|
||||
|
||||
protected:
|
||||
virtual void _Put(int w);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#ifndef _LogCtrl_icpp_init_stub
|
||||
#define _LogCtrl_icpp_init_stub
|
||||
#include "CtrlLib/init"
|
||||
#include "EscapeCh/init"
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue