applied (part of) Alexey Leko's patch

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8819 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2000-11-25 23:13:06 +00:00
parent 4e00f54113
commit f94dfb3897
6 changed files with 26 additions and 3 deletions

View File

@@ -50,6 +50,8 @@
#include "wx/log.h" #include "wx/log.h"
#include "wx/thread.h" #include "wx/thread.h"
#if wxUSE_LOG
// other standard headers // other standard headers
#include <errno.h> #include <errno.h>
#include <stdlib.h> #include <stdlib.h>
@@ -790,3 +792,4 @@ void wxOnAssert(const wxChar *szFile, int nLine, const wxChar *szMsg)
#endif //WXDEBUG #endif //WXDEBUG
#endif //wxUSE_LOG

View File

@@ -50,6 +50,8 @@
#include "wx/textfile.h" #include "wx/textfile.h"
#include "wx/statline.h" #include "wx/statline.h"
#if wxUSE_LOG
#ifdef __WXMSW__ #ifdef __WXMSW__
// for OutputDebugString() // for OutputDebugString()
#include "wx/msw/private.h" #include "wx/msw/private.h"
@@ -60,7 +62,6 @@
#define wxUSE_LOG_DIALOG 1 #define wxUSE_LOG_DIALOG 1
#if wxUSE_LOG_DIALOG #if wxUSE_LOG_DIALOG
#include "wx/datetime.h"
#include "wx/listctrl.h" #include "wx/listctrl.h"
#include "wx/imaglist.h" #include "wx/imaglist.h"
#include "wx/image.h" #include "wx/image.h"
@@ -74,6 +75,20 @@
#if wxUSE_LOG_DIALOG #if wxUSE_LOG_DIALOG
// this function is a wrapper around strftime(3)
// allows to exclude the usage of wxDateTime
static wxString TimeStamp(const wxChar *format, time_t t)
{
wxChar buf[4096];
if ( !wxStrftime(buf, WXSIZEOF(buf), format, localtime(&t)) )
{
// buffer is too small?
wxFAIL_MSG(_T("strftime() failed"));
}
return wxString(buf);
}
class wxLogDialog : public wxDialog class wxLogDialog : public wxDialog
{ {
public: public:
@@ -861,7 +876,7 @@ void wxLogDialog::CreateDetailsControls()
m_listctrl->InsertItem(n, m_messages[n]); m_listctrl->InsertItem(n, m_messages[n]);
m_listctrl->SetItem(n, 1, m_listctrl->SetItem(n, 1,
wxDateTime((time_t)m_times[n]).Format(fmt)); TimeStamp(fmt, (time_t)m_times[n]));
} }
// let the columns size themselves // let the columns size themselves
@@ -917,7 +932,7 @@ void wxLogDialog::OnSave(wxCommandEvent& WXUNUSED(event))
for ( size_t n = 0; ok && (n < count); n++ ) for ( size_t n = 0; ok && (n < count); n++ )
{ {
wxString line; wxString line;
line << wxDateTime((time_t)m_times[n]).Format(fmt) line << TimeStamp(fmt, (time_t)m_times[n])
<< _T(": ") << _T(": ")
<< m_messages[n] << m_messages[n]
<< wxTextFile::GetEOL(); << wxTextFile::GetEOL();
@@ -1056,3 +1071,4 @@ static int OpenLogFile(wxFile& file, wxString *pFilename)
#endif // wxUSE_FILE #endif // wxUSE_FILE
#endif // wxUSE_LOG

View File

@@ -24,6 +24,7 @@
#include "wx/event.h" #include "wx/event.h"
#include "wx/app.h" #include "wx/app.h"
#include "wx/dcclient.h" #include "wx/dcclient.h"
#include "wx/log.h"
#endif #endif
#include "wx/control.h" #include "wx/control.h"

View File

@@ -35,6 +35,7 @@
#include "wx/utils.h" #include "wx/utils.h"
#include "wx/app.h" #include "wx/app.h"
#include "wx/font.h" #include "wx/font.h"
#include "wx/log.h"
#endif // WX_PRECOMP #endif // WX_PRECOMP
#include "wx/msw/private.h" #include "wx/msw/private.h"

View File

@@ -30,6 +30,7 @@
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/string.h" #include "wx/string.h"
#include "wx/log.h"
#endif // WX_PRECOMP #endif // WX_PRECOMP
#include "wx/msw/private.h" #include "wx/msw/private.h"

View File

@@ -35,6 +35,7 @@
#include "wx/app.h" #include "wx/app.h"
#include "wx/icon.h" #include "wx/icon.h"
#include "wx/bitmap.h" #include "wx/bitmap.h"
#include "wx/log.h"
#endif #endif
#include "wx/msw/private.h" #include "wx/msw/private.h"