34 #include <wx/artprov.h>
35 #include <wx/imaglist.h>
36 #include <wx/textbuf.h>
47 #include <wx/settings.h>
69 : m_Filter(eShowAll), m_Cache(500)
87 if (!wxListCtrl::Create(parent,
id, pos,
size, style|wxLC_REPORT|wxLC_VIRTUAL))
90 #ifdef __WXOSX_COCOA__
91 SetBackgroundStyle(wxBG_STYLE_COLOUR);
92 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
95 this->InsertColumn(0,
wxT(
"Message"));
96 this->InsertColumn(1,
wxT(
"Time"));
97 this->InsertColumn(2,
wxT(
"Source"));
99 this->SetColumnWidth(0, 320);
100 this->SetColumnWidth(1, 64);
101 this->SetColumnWidth(2, 400);
120 return 1 + std::count(
tmp.begin(),
tmp.end(), wxChar(
'\n'));
123 static wxString
s_GetLine(
const wxString& msg,
size_t line)
126 for (
size_t pos = 0, pos2;; pos = pos2 + 1) {
127 pos2 = msg.find_first_of(wxChar(
'\n'), pos);
129 return msg.substr(pos, pos2 - pos);
132 if (pos2 == wxString::npos)
137 for (
i = 0;
i <
str.Length(); ++
i) {
138 if (
str[
i] == wxChar(
'\t'))
140 else if (
str[
i] == wxChar(
' '))
156 if (item < 0 || (
size_t)item >=
m_Items.size())
157 return wxEmptyString;
162 if (get<1>(index) > 0)
170 retVal =
wxT(
"Error: ") +
str;
173 retVal =
wxT(
"Warning: ") +
str;
176 retVal =
wxT(
"Info: ") +
str;
179 retVal =
wxT(
"Other: ") +
str;
188 void* data = anEvt.GetClientData();
189 unique_ptr<wxMenu> menu(data ? (wxMenu*)data :
new wxMenu());
194 anEvt.SetClientData(menu.get());
199 anEvt.SetClientData(
NULL);
202 PopupMenu(menu.get());
207 aMenu.Append( wxID_SEPARATOR,
wxT(
"Edit") );
214 if (item < 0 || (
size_t)item >=
m_Items.size())
223 if (item < 0 || (
size_t)item >=
m_Items.size())
224 return wxEmptyString;
234 return wxEmptyString;
243 size_t i, total, buffered;
248 for (
i = total - buffered;
i < total; ++
i) {
279 SetItemCount((
long)
m_Items.size());
280 SetColumnWidth(1, wxLIST_AUTOSIZE);
282 EnsureVisible((
long)(
m_Items.size()-1));
289 size_t i, total, buffered;
303 for (;
i < total; ++
i) {
336 SetItemCount((
long)
m_Items.size());
337 SetColumnWidth(1, wxLIST_AUTOSIZE);
339 EnsureVisible((
long)(
m_Items.size()-1));
406 if (it->second.m_AccessTime < it_erase->second.m_AccessTime)
417 if (log_handler.
GetMessage(index, msg, total)) {
418 wxString
text = wxString::FromUTF8(msg.
message.c_str());
440 item.
m_Message =
wxT(
"Wrong item requested (problem with the console view).");
444 return m_Data[index] = item;
CEvent - generic event implementation TODO TODO - Attachments.
void ConnectToControl(wxListCtrl &listCtrl)
CRegistryWriteView GetWriteView(const string §ion)
get a read-write view at a particular level.
static CGuiRegistry & GetInstance()
access the application-wide singleton
CRegistryReadView GetReadView(const string §ion) const
get a read-only view at a particular level.
class CRegistryReadView provides a nested hierarchical view at a particular key.
int GetInt(const string &key, int default_val=0) const
access a named key at this level, with no recursion
void Set(const string &key, int val)
access a named key at this level, with no recursion
static CUICommandRegistry & GetInstance()
the main instance associated with the application
wxMenuItem * AppendMenuItem(wxMenu &menu, TCmdID cmd_id) const
an event for child notification
CwxLogDiagHandler - provides a centralized logging facility that integrates both with C++ Toolkit (CD...
bool GetMessage(size_t index, SMessage &msg, size_t &total) const
void GetMsgCount(size_t &total, size_t &buffered)
static CwxLogDiagHandler * GetInstance()
container_type::iterator iterator
const_iterator begin() const
const_iterator end() const
const_iterator find(const key_type &key) const
static size_t s_CountLines(const wxString &msg)
static wxString s_GetLine(const wxString &msg, size_t line)
static const char * kFilterTag
@ eDiag_Info
Informational message.
@ eDiag_Error
Error message.
@ eDiag_Warning
Warning message.
const CItem & x_GetItem(size_t index)
virtual wxString OnGetItemText(long item, long column) const
wxString GetItemRawMsg(long item) const
void OnContextMenu(wxContextMenuEvent &event)
CDiagConsoleCache m_Cache
virtual ~CDiagConsoleList()
void x_OnNewItem(CEvent *)
virtual void AppendMenuItems(wxMenu &aMenu)
int GetItemImage(size_t index)
CDiagConsoleCache.
wxString GetItemMessage(size_t index)
bool ShouldPropagateContextMenu() const
virtual void LoadSettings()
CFixGenericListCtrl m_FixGenericListCtrl
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxBORDER_NONE)
Creation.
wxString GetItemTime(size_t index)
virtual int OnGetItemImage(long item) const
unsigned long m_AccessTime
void SetFilter(size_t filter)
virtual void SaveSettings() const
wxString GetItemSource(size_t index)
tuple< size_t, size_t > x_GetIndex(long item) const
virtual void RemoveListener(CEventHandler *listener)
Remove a listener.
#define ON_EVENT(type, id, handler)
#define END_EVENT_MAP()
Ends definition of Command Map.
#define BEGIN_EVENT_MAP(thisClass, baseClass)
Begins definition of Command Map for CEventHandler-derived class.
virtual void AddListener(CEventHandler *listener, int pool_name=ePool_Default)
Add a listener.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
string AsString(const CTimeFormat &format=kEmptyStr, TSeconds out_tz=eCurrentTimeZone) const
Transform time to string.
static void text(MDB_val *v)
const struct ncbi::grid::netcache::search::fields::SIZE size
static const char * str(char *buf, int n)
static const char * column
wxString ToWxString(const string &s)
void CleanupSeparators(wxMenu &menu)
Removes extra separators (in the begining or at the end of the menu, ot those that precede other sepa...