X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f561a4e09c7e0fbdd7228a7bc3f8024163d44a85..4224f059750329cc68964eeb7b2633206e245e0d:/src/generic/logg.cpp diff --git a/src/generic/logg.cpp b/src/generic/logg.cpp index fb942ab149..6dafd5d079 100644 --- a/src/generic/logg.cpp +++ b/src/generic/logg.cpp @@ -18,7 +18,9 @@ // headers // ---------------------------------------------------------------------------- -// no #pragma implementation "log.h" because it's already in src/common/log.cpp +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) + #pragma implementation "logg.h" +#endif // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -84,6 +86,10 @@ // allows to exclude the usage of wxDateTime static wxString TimeStamp(const wxChar *format, time_t t) { +#ifdef __WXWINCE__ + // FIXME + return wxEmptyString; +#else wxChar buf[4096]; if ( !wxStrftime(buf, WXSIZEOF(buf), format, localtime(&t)) ) { @@ -91,6 +97,7 @@ static wxString TimeStamp(const wxChar *format, time_t t) wxFAIL_MSG(_T("strftime() failed")); } return wxString(buf); +#endif } @@ -164,7 +171,7 @@ END_EVENT_TABLE() // filename and try to open it, returns TRUE on success (file was opened), // FALSE if file couldn't be opened/created and -1 if the file selection // dialog was cancelled -static int OpenLogFile(wxFile& file, wxString *filename = NULL); +static int OpenLogFile(wxFile& file, wxString *filename = NULL, wxWindow *parent = NULL); #endif // wxUSE_FILE @@ -196,7 +203,11 @@ void wxVLogStatus(wxFrame *pFrame, const wxChar *szFormat, va_list argptr) wxASSERT( gs_pFrame == NULL ); // should be reset! gs_pFrame = pFrame; +#ifdef __WXWINCE__ + wxLog::OnLog(wxLOG_Status, msg, 0); +#else wxLog::OnLog(wxLOG_Status, msg, time(NULL)); +#endif gs_pFrame = (wxFrame *) NULL; } } @@ -213,6 +224,8 @@ void wxLogStatus(wxFrame *pFrame, const wxChar *szFormat, ...) // wxLogGui implementation (FIXME MT-unsafe) // ---------------------------------------------------------------------------- +#if wxUSE_LOGGUI + wxLogGui::wxLogGui() { Clear(); @@ -409,6 +422,8 @@ void wxLogGui::DoLog(wxLogLevel level, const wxChar *szString, time_t t) } } +#endif // wxUSE_LOGGUI + // ---------------------------------------------------------------------------- // wxLogWindow and wxLogFrame implementation // ---------------------------------------------------------------------------- @@ -430,8 +445,6 @@ public: #endif // wxUSE_FILE void OnClear(wxCommandEvent& event); - void OnIdle(wxIdleEvent&); - // accessors wxTextCtrl *TextCtrl() const { return m_pTextCtrl; } @@ -529,7 +542,7 @@ void wxLogFrame::OnSave(wxCommandEvent& WXUNUSED(event)) #if wxUSE_FILEDLG wxString filename; wxFile file; - int rc = OpenLogFile(file, &filename); + int rc = OpenLogFile(file, &filename, this); if ( rc == -1 ) { // cancelled @@ -741,7 +754,6 @@ wxLogDialog::wxLogDialog(wxWindow *parent, m_btnDetails = new wxButton(this, wxID_MORE, ms_details + EXPAND_SUFFIX); sizerButtons->Add(m_btnDetails, 0, wxCENTRE | wxTOP, MARGIN/2 - 1); -#ifndef __WIN16__ wxBitmap bitmap; switch ( style & wxICON_MASK ) { @@ -770,7 +782,6 @@ wxLogDialog::wxLogDialog(wxWindow *parent, wxFAIL_MSG(_T("incorrect log style")); } sizerAll->Add(new wxStaticBitmap(this, -1, bitmap), 0); -#endif // !Win16 const wxString& message = messages.Last(); sizerAll->Add(CreateTextSizer(message), 1, @@ -849,7 +860,6 @@ void wxLogDialog::CreateDetailsControls() bool loadedIcons = TRUE; -#ifndef __WIN16__ for ( size_t icon = 0; icon < WXSIZEOF(icons); icon++ ) { wxBitmap bmp = wxArtProvider::GetBitmap(icons[icon], wxART_MESSAGE_BOX, @@ -868,7 +878,6 @@ void wxLogDialog::CreateDetailsControls() } m_listctrl->SetImageList(imageList, wxIMAGE_LIST_SMALL); -#endif // !Win16 // and fill it wxString fmt = wxLog::GetTimestamp(); @@ -883,7 +892,6 @@ void wxLogDialog::CreateDetailsControls() { int image; -#ifndef __WIN16__ if ( loadedIcons ) { switch ( m_severity[n] ) @@ -901,7 +909,6 @@ void wxLogDialog::CreateDetailsControls() } } else // failed to load images -#endif // !Win16 { image = -1; } @@ -950,7 +957,7 @@ void wxLogDialog::OnSave(wxCommandEvent& WXUNUSED(event)) { #if wxUSE_FILEDLG wxFile file; - int rc = OpenLogFile(file); + int rc = OpenLogFile(file, NULL, this); if ( rc == -1 ) { // cancelled @@ -1090,11 +1097,11 @@ wxLogDialog::~wxLogDialog() // filename and try to open it, returns TRUE on success (file was opened), // FALSE if file couldn't be opened/created and -1 if the file selection // dialog was cancelled -static int OpenLogFile(wxFile& file, wxString *pFilename) +static int OpenLogFile(wxFile& file, wxString *pFilename, wxWindow *parent) { // get the file name // ----------------- - wxString filename = wxSaveFileSelector(wxT("log"), wxT("txt"), wxT("log.txt")); + wxString filename = wxSaveFileSelector(wxT("log"), wxT("txt"), wxT("log.txt"), parent); if ( !filename ) { // cancelled return -1; @@ -1102,7 +1109,7 @@ static int OpenLogFile(wxFile& file, wxString *pFilename) // open file // --------- - bool bOk = FALSE; + bool bOk; if ( wxFile::Exists(filename) ) { bool bAppend = FALSE; wxString strMsg; @@ -1162,14 +1169,7 @@ void wxLogTextCtrl::DoLogString(const wxChar *szString, time_t WXUNUSED(t)) wxString msg; TimeStamp(&msg); -#if defined(__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); }