]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/logg.cpp
Various wxUniversal/wxMicroWindows fixes
[wxWidgets.git] / src / generic / logg.cpp
index 0891c8de9ae09341e3d794ad8600001365f78e3b..99a4b4e7e62d81f8e054d7cec78658c0907684af 100644 (file)
     #include "wx/button.h"
 #endif // WX_PRECOMP
 
+#if wxUSE_LOGGUI || wxUSE_LOGWINDOW
+
 #include "wx/file.h"
 #include "wx/textfile.h"
 #include "wx/statline.h"
 
-#if wxUSE_LOG
-
 #ifdef  __WXMSW__
   // for OutputDebugString()
   #include  "wx/msw/private.h"
@@ -198,28 +198,6 @@ void wxLogStatus(wxFrame *pFrame, const wxChar *szFormat, ...)
   }
 }
 
-// ----------------------------------------------------------------------------
-// wxLogTextCtrl implementation
-// ----------------------------------------------------------------------------
-
-wxLogTextCtrl::wxLogTextCtrl(wxTextCtrl *pTextCtrl)
-{
-    m_pTextCtrl = pTextCtrl;
-}
-
-void wxLogTextCtrl::DoLogString(const wxChar *szString, time_t WXUNUSED(t))
-{
-    wxString msg;
-    TimeStamp(&msg);
-#ifdef __WXMAC__
-    msg << szString << wxT('\r');
-#else
-    msg << szString << wxT('\n');
-#endif
-
-    m_pTextCtrl->AppendText(msg);
-}
-
 // ----------------------------------------------------------------------------
 // wxLogGui implementation (FIXME MT-unsafe)
 // ----------------------------------------------------------------------------
@@ -266,7 +244,7 @@ void wxLogGui::Flush()
         titleFormat = _("%s Information");
         style = wxICON_INFORMATION;
     }
-    
+
     wxString title;
     title.Printf(titleFormat, appName.c_str());
 
@@ -1071,4 +1049,34 @@ static int OpenLogFile(wxFile& file, wxString *pFilename)
 
 #endif // wxUSE_FILE
 
-#endif // wxUSE_LOG
+#endif // !(wxUSE_LOGGUI || wxUSE_LOGWINDOW)
+
+#if wxUSE_TEXTCTRL
+
+// ----------------------------------------------------------------------------
+// wxLogTextCtrl implementation
+// ----------------------------------------------------------------------------
+
+wxLogTextCtrl::wxLogTextCtrl(wxTextCtrl *pTextCtrl)
+{
+    m_pTextCtrl = pTextCtrl;
+}
+
+void wxLogTextCtrl::DoLogString(const wxChar *szString, time_t WXUNUSED(t))
+{
+    wxString msg;
+    TimeStamp(&msg);
+
+#ifdef __WXMAC__
+    // VZ: this is a bug in wxMac, it *must* accept '\n' as new line, the
+    //     translation must be done in wxTextCtrl, not here! (FIXME)
+    msg << szString << wxT('\r');
+#else
+    msg << szString << wxT('\n');
+#endif
+
+    m_pTextCtrl->AppendText(msg);
+}
+
+#endif // wxUSE_TEXTCTRL
+