]> git.saurik.com Git - wxWidgets.git/commitdiff
applied (part of) Alexey Leko's patch
authorVáclav Slavík <vslavik@fastmail.fm>
Sat, 25 Nov 2000 23:13:06 +0000 (23:13 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sat, 25 Nov 2000 23:13:06 +0000 (23:13 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8819 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/log.cpp
src/generic/logg.cpp
src/msw/control.cpp
src/msw/font.cpp
src/msw/gdiimage.cpp
src/msw/icon.cpp

index e7669a12e9c1fbaec5432b50d7aebd200dc6ccee..18428e6d0c72b492488370e2aba1d93070b0ab0b 100644 (file)
@@ -50,6 +50,8 @@
 #include  "wx/log.h"
 #include  "wx/thread.h"
 
+#if wxUSE_LOG
+
 // other standard headers
 #include  <errno.h>
 #include  <stdlib.h>
@@ -790,3 +792,4 @@ void wxOnAssert(const wxChar *szFile, int nLine, const wxChar *szMsg)
 
 #endif  //WXDEBUG
 
+#endif //wxUSE_LOG
index d52e34447d332cbd732b280d2c8ff32b6a8b9ac1..0891c8de9ae09341e3d794ad8600001365f78e3b 100644 (file)
@@ -50,6 +50,8 @@
 #include "wx/textfile.h"
 #include "wx/statline.h"
 
+#if wxUSE_LOG
+
 #ifdef  __WXMSW__
   // for OutputDebugString()
   #include  "wx/msw/private.h"
@@ -60,7 +62,6 @@
 #define wxUSE_LOG_DIALOG 1
 
 #if wxUSE_LOG_DIALOG
-    #include "wx/datetime.h"
     #include "wx/listctrl.h"
     #include "wx/imaglist.h"
     #include "wx/image.h"
 
 #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
 {
 public:
@@ -861,7 +876,7 @@ void wxLogDialog::CreateDetailsControls()
             m_listctrl->InsertItem(n, m_messages[n]);
 
         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
@@ -917,7 +932,7 @@ void wxLogDialog::OnSave(wxCommandEvent& WXUNUSED(event))
     for ( size_t n = 0; ok && (n < count); n++ )
     {
         wxString line;
-        line << wxDateTime((time_t)m_times[n]).Format(fmt)
+        line << TimeStamp(fmt, (time_t)m_times[n])
              << _T(": ")
              << m_messages[n]
              << wxTextFile::GetEOL();
@@ -1056,3 +1071,4 @@ static int OpenLogFile(wxFile& file, wxString *pFilename)
 
 #endif // wxUSE_FILE
 
+#endif // wxUSE_LOG
index 656d3f45c284c6b88d3b0326b77f3c5a3a9188c2..1bea290c7e3b6466590f4049dee98025ba9bcd7e 100644 (file)
@@ -24,6 +24,7 @@
 #include "wx/event.h"
 #include "wx/app.h"
 #include "wx/dcclient.h"
+#include "wx/log.h"
 #endif
 
 #include "wx/control.h"
index 472b6168844a2c911f9fda952e73b7bd3ebf4eb8..acb3be04c59d3d989da7a0dd06d77f76f8cbbfd1 100644 (file)
@@ -35,6 +35,7 @@
     #include "wx/utils.h"
     #include "wx/app.h"
     #include "wx/font.h"
+    #include "wx/log.h"
 #endif // WX_PRECOMP
 
 #include "wx/msw/private.h"
index d880396fdb7fb834d97010b6fab0dd2a6600bea6..4123b7d4f6b563d2b25b6e11eb88fb526178bafc 100644 (file)
@@ -30,6 +30,7 @@
 
 #ifndef WX_PRECOMP
     #include "wx/string.h"
+    #include "wx/log.h"
 #endif // WX_PRECOMP
 
 #include "wx/msw/private.h"
index a7e1fcad9dc95ab7979fd27857664783b7003201..fa2c11ffaf175c81eb77ea5c4f8f64e9e3356dc4 100644 (file)
@@ -35,6 +35,7 @@
     #include "wx/app.h"
     #include "wx/icon.h"
     #include "wx/bitmap.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/msw/private.h"