#include "wx/datetime.h"
// the suffix we add to the button to show that the dialog can be expanded
-#define EXPAND_SUFFIX _T(" >>")
+#define EXPAND_SUFFIX wxT(" >>")
#define CAN_SAVE_FILES (wxUSE_FILE && wxUSE_FILEDLG)
if ( !wxStrftime(buf, WXSIZEOF(buf), format, wxLocaltime_r(&t, &tm)) )
{
// buffer is too small?
- wxFAIL_MSG(_T("strftime() failed"));
+ wxFAIL_MSG(wxT("strftime() failed"));
}
return wxString(buf);
#else // !wxUSE_DATETIME
wxFrame *pFrame = NULL;
// check if the frame was passed to us explicitly
- wxUIntPtr ptr = NULL;
+ wxUIntPtr ptr = 0;
if ( info.GetNumValue(wxLOG_KEY_FRAME, &ptr) )
{
pFrame = static_cast<wxFrame *>(wxUIntToPtr(ptr));
m_bHasMessages = true;
break;
- default:
- // let the base class deal with debug/trace messages as well as any
- // custom levels
+ case wxLOG_Debug:
+ case wxLOG_Trace:
+ // let the base class deal with debug/trace messages
wxLog::DoLogRecord(level, msg, info);
+ break;
+
+ case wxLOG_FatalError:
+ case wxLOG_Max:
+ // fatal errors are shown immediately and terminate the program so
+ // we should never see them here
+ wxFAIL_MSG("unexpected log level");
+ break;
+
+ case wxLOG_Progress:
+ case wxLOG_User:
+ // just ignore those: passing them to the base class would result
+ // in asserts from DoLogText() because DoLogTextAtLevel() would
+ // call it as it doesn't know how to handle these levels otherwise
+ break;
}
}
bool bShow,
bool bDoPass)
{
+ // Initialize it to NULL to ensure that we don't crash if any log messages
+ // are generated before the frame is fully created (while this doesn't
+ // happen normally, it might, in principle).
+ m_pLogFrame = NULL;
+
PassMessages(bDoPass);
m_pLogFrame = new wxLogFrame(pParent, this, szTitle);
void wxLogWindow::DoLogTextAtLevel(wxLogLevel level, const wxString& msg)
{
- // first let the previous logger show it
- wxLogPassThrough::DoLogTextAtLevel(level, msg);
-
if ( !m_pLogFrame )
return;
bool isPda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA);
// create the controls which are always shown and layout them: we use
- // sizers even though our window is not resizeable to calculate the size of
+ // sizers even though our window is not resizable to calculate the size of
// the dialog properly
wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *sizerAll = new wxBoxSizer(isPda ? wxVERTICAL : wxHORIZONTAL);
// create the list ctrl now
m_listctrl = new wxListCtrl(parent, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
- wxSUNKEN_BORDER |
+ wxBORDER_SIMPLE |
wxLC_REPORT |
wxLC_NO_HEADER |
wxLC_SINGLE_SEL);
// no need to translate these strings as they're not shown to the
// user anyhow (we use wxLC_NO_HEADER style)
- m_listctrl->InsertColumn(0, _T("Message"));
+ m_listctrl->InsertColumn(0, wxT("Message"));
if (hasTimeStamp)
- m_listctrl->InsertColumn(1, _T("Time"));
+ m_listctrl->InsertColumn(1, wxT("Time"));
// prepare the imagelist
static const int ICON_SIZE = 16;
wxImageList *imageList = new wxImageList(ICON_SIZE, ICON_SIZE);
// order should be the same as in the switch below!
- static const wxChar* icons[] =
+ static const char* const icons[] =
{
wxART_ERROR,
wxART_WARNING,