]>
git.saurik.com Git - wxWidgets.git/blob - src/generic/logg.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxLog-derived classes which need GUI support (the rest is in
5 // Author: Vadim Zeitlin
7 // Created: 20.09.99 (extracted from src/common/log.cpp)
9 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
13 // ============================================================================
15 // ============================================================================
17 // ----------------------------------------------------------------------------
19 // ----------------------------------------------------------------------------
21 // no #pragma implementation "log.h" because it's already in src/common/log.cpp
23 // For compilers that support precompilation, includes "wx.h".
24 #include "wx/wxprec.h"
31 #error "This file can't be compiled without GUI!"
36 #include "wx/button.h"
41 #include "wx/filedlg.h"
42 #include "wx/msgdlg.h"
43 #include "wx/textctrl.h"
45 #include "wx/statbmp.h"
46 #include "wx/button.h"
47 #include "wx/settings.h"
50 #if wxUSE_LOGGUI || wxUSE_LOGWINDOW
53 #include "wx/textfile.h"
54 #include "wx/statline.h"
57 // for OutputDebugString()
58 #include "wx/msw/private.h"
62 #include "wx/listctrl.h"
63 #include "wx/imaglist.h"
65 #else // !wxUSE_LOG_DIALOG
66 #include "wx/msgdlg.h"
67 #endif // wxUSE_LOG_DIALOG/!wxUSE_LOG_DIALOG
69 // ----------------------------------------------------------------------------
71 // ----------------------------------------------------------------------------
75 // this function is a wrapper around strftime(3)
76 // allows to exclude the usage of wxDateTime
77 static wxString
TimeStamp(const wxChar
*format
, time_t t
)
80 if ( !wxStrftime(buf
, WXSIZEOF(buf
), format
, localtime(&t
)) )
82 // buffer is too small?
83 wxFAIL_MSG(_T("strftime() failed"));
89 class wxLogDialog
: public wxDialog
92 wxLogDialog(wxWindow
*parent
,
93 const wxArrayString
& messages
,
94 const wxArrayInt
& severity
,
95 const wxArrayLong
& timess
,
96 const wxString
& caption
,
98 virtual ~wxLogDialog();
101 void OnOk(wxCommandEvent
& event
);
102 void OnDetails(wxCommandEvent
& event
);
104 void OnSave(wxCommandEvent
& event
);
106 void OnListSelect(wxListEvent
& event
);
109 // create controls needed for the details display
110 void CreateDetailsControls();
112 // the data for the listctrl
113 wxArrayString m_messages
;
114 wxArrayInt m_severity
;
117 // the "toggle" button and its state
118 wxButton
*m_btnDetails
;
119 bool m_showingDetails
;
121 // the controls which are not shown initially (but only when details
122 // button is pressed)
123 wxListCtrl
*m_listctrl
;
125 wxStaticLine
*m_statline
;
126 #endif // wxUSE_STATLINE
131 // the translated "Details" string
132 static wxString ms_details
;
134 DECLARE_EVENT_TABLE()
137 BEGIN_EVENT_TABLE(wxLogDialog
, wxDialog
)
138 EVT_BUTTON(wxID_CANCEL
, wxLogDialog::OnOk
)
139 EVT_BUTTON(wxID_MORE
, wxLogDialog::OnDetails
)
141 EVT_BUTTON(wxID_SAVE
, wxLogDialog::OnSave
)
143 EVT_LIST_ITEM_SELECTED(-1, wxLogDialog::OnListSelect
)
146 #endif // wxUSE_LOG_DIALOG
148 // ----------------------------------------------------------------------------
150 // ----------------------------------------------------------------------------
152 #if wxUSE_FILE && wxUSE_FILEDLG
154 // pass an uninitialized file object, the function will ask the user for the
155 // filename and try to open it, returns TRUE on success (file was opened),
156 // FALSE if file couldn't be opened/created and -1 if the file selection
157 // dialog was cancelled
158 static int OpenLogFile(wxFile
& file
, wxString
*filename
= NULL
);
162 // ----------------------------------------------------------------------------
164 // ----------------------------------------------------------------------------
166 // we use a global variable to store the frame pointer for wxLogStatus - bad,
167 // but it's the easiest way
168 static wxFrame
*gs_pFrame
= NULL
; // FIXME MT-unsafe
170 // ============================================================================
172 // ============================================================================
174 // ----------------------------------------------------------------------------
176 // ----------------------------------------------------------------------------
178 // accepts an additional argument which tells to which frame the output should
180 void wxLogStatus(wxFrame
*pFrame
, const wxChar
*szFormat
, ...)
184 wxLog
*pLog
= wxLog::GetActiveTarget();
185 if ( pLog
!= NULL
) {
187 va_start(argptr
, szFormat
);
188 msg
.PrintfV(szFormat
, argptr
);
191 wxASSERT( gs_pFrame
== NULL
); // should be reset!
193 wxLog::OnLog(wxLOG_Status
, msg
, time(NULL
));
194 gs_pFrame
= (wxFrame
*) NULL
;
198 // ----------------------------------------------------------------------------
199 // wxLogGui implementation (FIXME MT-unsafe)
200 // ----------------------------------------------------------------------------
207 void wxLogGui::Clear()
211 m_bHasMessages
= FALSE
;
218 void wxLogGui::Flush()
220 if ( !m_bHasMessages
)
223 // do it right now to block any new calls to Flush() while we're here
224 m_bHasMessages
= FALSE
;
226 wxString appName
= wxTheApp
->GetAppName();
228 appName
[0u] = wxToupper(appName
[0u]);
231 wxString titleFormat
;
233 titleFormat
= _("%s Error");
236 else if ( m_bWarnings
) {
237 titleFormat
= _("%s Warning");
238 style
= wxICON_EXCLAMATION
;
241 titleFormat
= _("%s Information");
242 style
= wxICON_INFORMATION
;
246 title
.Printf(titleFormat
, appName
.c_str());
248 size_t nMsgCount
= m_aMessages
.Count();
250 // avoid showing other log dialogs until we're done with the dialog we're
251 // showing right now: nested modal dialogs make for really bad UI!
255 if ( nMsgCount
== 1 )
257 str
= m_aMessages
[0];
259 else // more than one message
263 wxLogDialog
dlg(NULL
,
264 m_aMessages
, m_aSeverity
, m_aTimes
,
267 // clear the message list before showing the dialog because while it's
268 // shown some new messages may appear
271 (void)dlg
.ShowModal();
272 #else // !wxUSE_LOG_DIALOG
273 // concatenate all strings (but not too many to not overfill the msg box)
276 // start from the most recent message
277 for ( size_t n
= nMsgCount
; n
> 0; n
-- ) {
278 // for Windows strings longer than this value are wrapped (NT 4.0)
279 const size_t nMsgLineWidth
= 156;
281 nLines
+= (m_aMessages
[n
- 1].Len() + nMsgLineWidth
- 1) / nMsgLineWidth
;
283 if ( nLines
> 25 ) // don't put too many lines in message box
286 str
<< m_aMessages
[n
- 1] << wxT("\n");
288 #endif // wxUSE_LOG_DIALOG/!wxUSE_LOG_DIALOG
291 // this catches both cases of 1 message with wxUSE_LOG_DIALOG and any
292 // situation without it
295 wxMessageBox(str
, title
, wxOK
| style
);
297 // no undisplayed messages whatsoever
301 // allow flushing the logs again
305 // log all kinds of messages
306 void wxLogGui::DoLog(wxLogLevel level
, const wxChar
*szString
, time_t t
)
313 m_aMessages
.Add(szString
);
314 m_aSeverity
.Add(wxLOG_Message
);
315 m_aTimes
.Add((long)t
);
316 m_bHasMessages
= TRUE
;
323 // find the top window and set it's status text if it has any
324 wxFrame
*pFrame
= gs_pFrame
;
325 if ( pFrame
== NULL
) {
326 wxWindow
*pWin
= wxTheApp
->GetTopWindow();
327 if ( pWin
!= NULL
&& pWin
->IsKindOf(CLASSINFO(wxFrame
)) ) {
328 pFrame
= (wxFrame
*)pWin
;
332 if ( pFrame
&& pFrame
->GetStatusBar() )
333 pFrame
->SetStatusText(szString
);
335 #endif // wxUSE_STATUSBAR
346 #if defined(__WXMSW__) && !defined(__WXMICROWIN__)
347 // don't prepend debug/trace here: it goes to the
348 // debug window anyhow
350 OutputDebugString(str
);
352 // send them to stderr
353 wxFprintf(stderr
, wxT("[%s] %s\n"),
354 level
== wxLOG_Trace
? wxT("Trace")
360 #endif // __WXDEBUG__
364 case wxLOG_FatalError
:
365 // show this one immediately
366 wxMessageBox(szString
, _("Fatal error"), wxICON_HAND
);
372 #if !wxUSE_LOG_DIALOG
373 // discard earlier informational messages if this is the 1st
374 // error because they might not make sense any more and showing
375 // them in a message box might be confusing
379 #endif // wxUSE_LOG_DIALOG
386 // for the warning we don't discard the info messages
390 m_aMessages
.Add(szString
);
391 m_aSeverity
.Add((int)level
);
392 m_aTimes
.Add((long)t
);
393 m_bHasMessages
= TRUE
;
398 // ----------------------------------------------------------------------------
399 // wxLogWindow and wxLogFrame implementation
400 // ----------------------------------------------------------------------------
404 class wxLogFrame
: public wxFrame
408 wxLogFrame(wxFrame
*pParent
, wxLogWindow
*log
, const wxChar
*szTitle
);
409 virtual ~wxLogFrame();
412 void OnClose(wxCommandEvent
& event
);
413 void OnCloseWindow(wxCloseEvent
& event
);
415 void OnSave (wxCommandEvent
& event
);
417 void OnClear(wxCommandEvent
& event
);
419 void OnIdle(wxIdleEvent
&);
422 wxTextCtrl
*TextCtrl() const { return m_pTextCtrl
; }
425 // use standard ids for our commands!
428 Menu_Close
= wxID_CLOSE
,
429 Menu_Save
= wxID_SAVE
,
430 Menu_Clear
= wxID_CLEAR
433 // common part of OnClose() and OnCloseWindow()
436 wxTextCtrl
*m_pTextCtrl
;
439 DECLARE_EVENT_TABLE()
442 BEGIN_EVENT_TABLE(wxLogFrame
, wxFrame
)
443 // wxLogWindow menu events
444 EVT_MENU(Menu_Close
, wxLogFrame::OnClose
)
446 EVT_MENU(Menu_Save
, wxLogFrame::OnSave
)
448 EVT_MENU(Menu_Clear
, wxLogFrame::OnClear
)
450 EVT_CLOSE(wxLogFrame::OnCloseWindow
)
453 wxLogFrame::wxLogFrame(wxFrame
*pParent
, wxLogWindow
*log
, const wxChar
*szTitle
)
454 : wxFrame(pParent
, -1, szTitle
)
458 m_pTextCtrl
= new wxTextCtrl(this, -1, wxEmptyString
, wxDefaultPosition
,
466 wxMenuBar
*pMenuBar
= new wxMenuBar
;
467 wxMenu
*pMenu
= new wxMenu
;
469 pMenu
->Append(Menu_Save
, _("&Save..."), _("Save log contents to file"));
471 pMenu
->Append(Menu_Clear
, _("C&lear"), _("Clear the log contents"));
472 pMenu
->AppendSeparator();
473 pMenu
->Append(Menu_Close
, _("&Close"), _("Close this window"));
474 pMenuBar
->Append(pMenu
, _("&Log"));
475 SetMenuBar(pMenuBar
);
476 #endif // wxUSE_MENUS
479 // status bar for menu prompts
481 #endif // wxUSE_STATUSBAR
483 m_log
->OnFrameCreate(this);
486 void wxLogFrame::DoClose()
488 if ( m_log
->OnFrameClose(this) )
490 // instead of closing just hide the window to be able to Show() it
496 void wxLogFrame::OnClose(wxCommandEvent
& WXUNUSED(event
))
501 void wxLogFrame::OnCloseWindow(wxCloseEvent
& WXUNUSED(event
))
507 void wxLogFrame::OnSave(wxCommandEvent
& WXUNUSED(event
))
512 int rc
= OpenLogFile(file
, &filename
);
521 // retrieve text and save it
522 // -------------------------
523 int nLines
= m_pTextCtrl
->GetNumberOfLines();
524 for ( int nLine
= 0; bOk
&& nLine
< nLines
; nLine
++ ) {
525 bOk
= file
.Write(m_pTextCtrl
->GetLineText(nLine
) +
526 wxTextFile::GetEOL());
533 wxLogError(_("Can't save log contents to file."));
536 wxLogStatus(this, _("Log saved to the file '%s'."), filename
.c_str());
542 void wxLogFrame::OnClear(wxCommandEvent
& WXUNUSED(event
))
544 m_pTextCtrl
->Clear();
547 wxLogFrame::~wxLogFrame()
549 m_log
->OnFrameDelete(this);
555 wxLogWindow::wxLogWindow(wxFrame
*pParent
,
556 const wxChar
*szTitle
,
560 PassMessages(bDoPass
);
562 m_pLogFrame
= new wxLogFrame(pParent
, this, szTitle
);
565 m_pLogFrame
->Show(TRUE
);
568 void wxLogWindow::Show(bool bShow
)
570 m_pLogFrame
->Show(bShow
);
573 void wxLogWindow::DoLog(wxLogLevel level
, const wxChar
*szString
, time_t t
)
575 // first let the previous logger show it
576 wxLogPassThrough::DoLog(level
, szString
, t
);
581 // by default, these messages are ignored by wxLog, so process
583 if ( !wxIsEmpty(szString
) )
586 str
<< _("Status: ") << szString
;
591 // don't put trace messages in the text window for 2 reasons:
592 // 1) there are too many of them
593 // 2) they may provoke other trace messages thus sending a program
594 // into an infinite loop
599 // and this will format it nicely and call our DoLogString()
600 wxLog::DoLog(level
, szString
, t
);
604 m_bHasMessages
= TRUE
;
607 void wxLogWindow::DoLogString(const wxChar
*szString
, time_t WXUNUSED(t
))
609 // put the text into our window
610 wxTextCtrl
*pText
= m_pLogFrame
->TextCtrl();
612 // remove selection (WriteText is in fact ReplaceSelection)
614 long nLen
= pText
->GetLastPosition();
615 pText
->SetSelection(nLen
, nLen
);
620 msg
<< szString
<< wxT('\n');
622 pText
->AppendText(msg
);
624 // TODO ensure that the line can be seen
627 wxFrame
*wxLogWindow::GetFrame() const
632 void wxLogWindow::OnFrameCreate(wxFrame
* WXUNUSED(frame
))
636 bool wxLogWindow::OnFrameClose(wxFrame
* WXUNUSED(frame
))
642 void wxLogWindow::OnFrameDelete(wxFrame
* WXUNUSED(frame
))
644 m_pLogFrame
= (wxLogFrame
*)NULL
;
647 wxLogWindow::~wxLogWindow()
649 // may be NULL if log frame already auto destroyed itself
653 // ----------------------------------------------------------------------------
655 // ----------------------------------------------------------------------------
659 static const size_t MARGIN
= 10;
661 wxString
wxLogDialog::ms_details
;
663 wxLogDialog::wxLogDialog(wxWindow
*parent
,
664 const wxArrayString
& messages
,
665 const wxArrayInt
& severity
,
666 const wxArrayLong
& times
,
667 const wxString
& caption
,
669 : wxDialog(parent
, -1, caption
,
670 wxDefaultPosition
, wxDefaultSize
,
671 wxDEFAULT_DIALOG_STYLE
| wxRESIZE_BORDER
)
673 if ( ms_details
.IsEmpty() )
675 // ensure that we won't loop here if wxGetTranslation()
676 // happens to pop up a Log message while translating this :-)
677 ms_details
= wxTRANSLATE("&Details");
678 ms_details
= wxGetTranslation(ms_details
);
681 size_t count
= messages
.GetCount();
682 m_messages
.Alloc(count
);
683 m_severity
.Alloc(count
);
684 m_times
.Alloc(count
);
686 for ( size_t n
= 0; n
< count
; n
++ )
688 wxString msg
= messages
[n
];
691 m_messages
.Add(msg
.BeforeFirst(_T('\n')));
692 msg
= msg
.AfterFirst(_T('\n'));
694 m_severity
.Add(severity
[n
]);
695 m_times
.Add(times
[n
]);
700 m_showingDetails
= FALSE
; // not initially
701 m_listctrl
= (wxListCtrl
*)NULL
;
704 m_statline
= (wxStaticLine
*)NULL
;
705 #endif // wxUSE_STATLINE
708 m_btnSave
= (wxButton
*)NULL
;
711 // create the controls which are always shown and layout them: we use
712 // sizers even though our window is not resizeable to calculate the size of
713 // the dialog properly
714 wxBoxSizer
*sizerTop
= new wxBoxSizer(wxVERTICAL
);
715 wxBoxSizer
*sizerButtons
= new wxBoxSizer(wxVERTICAL
);
716 wxBoxSizer
*sizerAll
= new wxBoxSizer(wxHORIZONTAL
);
718 // this "Ok" button has wxID_CANCEL id - not very logical, but this allows
719 // to close the log dialog with <Esc> which wouldn't work otherwise (as it
720 // translates into click on cancel button)
721 wxButton
*btnOk
= new wxButton(this, wxID_CANCEL
, _("OK"));
722 sizerButtons
->Add(btnOk
, 0, wxCENTRE
| wxBOTTOM
, MARGIN
/2);
723 m_btnDetails
= new wxButton(this, wxID_MORE
, ms_details
+ _T(" >>"));
724 sizerButtons
->Add(m_btnDetails
, 0, wxCENTRE
| wxTOP
, MARGIN
/2 - 1);
727 wxIcon icon
= wxTheApp
->GetStdIcon((int)(style
& wxICON_MASK
));
728 sizerAll
->Add(new wxStaticBitmap(this, -1, icon
), 0);
731 const wxString
& message
= messages
.Last();
732 sizerAll
->Add(CreateTextSizer(message
), 1,
733 wxALIGN_CENTRE_VERTICAL
| wxLEFT
| wxRIGHT
, MARGIN
);
734 sizerAll
->Add(sizerButtons
, 0, wxALIGN_RIGHT
| wxLEFT
, MARGIN
);
736 sizerTop
->Add(sizerAll
, 0, wxALL
| wxEXPAND
, MARGIN
);
741 sizerTop
->SetSizeHints(this);
746 // this can't happen any more as we don't use this dialog in this case
750 // no details... it's easier to disable a button than to change the
751 // dialog layout depending on whether we have details or not
752 m_btnDetails
->Disable();
759 void wxLogDialog::CreateDetailsControls()
761 // create the save button and separator line if possible
763 m_btnSave
= new wxButton(this, wxID_SAVE
, _("&Save..."));
767 m_statline
= new wxStaticLine(this, -1);
768 #endif // wxUSE_STATLINE
770 // create the list ctrl now
771 m_listctrl
= new wxListCtrl(this, -1,
772 wxDefaultPosition
, wxDefaultSize
,
778 // no need to translate these strings as they're not shown to the
779 // user anyhow (we use wxLC_NO_HEADER style)
780 m_listctrl
->InsertColumn(0, _T("Message"));
781 m_listctrl
->InsertColumn(1, _T("Time"));
783 // prepare the imagelist
784 static const int ICON_SIZE
= 16;
785 wxImageList
*imageList
= new wxImageList(ICON_SIZE
, ICON_SIZE
);
787 // order should be the same as in the switch below!
788 static const int icons
[] =
795 bool loadedIcons
= TRUE
;
798 for ( size_t icon
= 0; icon
< WXSIZEOF(icons
); icon
++ )
800 wxBitmap bmp
= wxTheApp
->GetStdIcon(icons
[icon
]);
802 // This may very well fail if there are insufficient
803 // colours available. Degrade gracefully.
808 imageList
->Add(wxImage(bmp
).
809 Rescale(ICON_SIZE
, ICON_SIZE
).
813 m_listctrl
->SetImageList(imageList
, wxIMAGE_LIST_SMALL
);
817 wxString fmt
= wxLog::GetTimestamp();
824 size_t count
= m_messages
.GetCount();
825 for ( size_t n
= 0; n
< count
; n
++ )
829 switch ( m_severity
[n
] )
848 m_listctrl
->InsertItem(n
, m_messages
[n
], image
);
850 m_listctrl
->InsertItem(n
, m_messages
[n
]);
852 m_listctrl
->SetItem(n
, 1,
853 TimeStamp(fmt
, (time_t)m_times
[n
]));
856 // let the columns size themselves
857 m_listctrl
->SetColumnWidth(0, wxLIST_AUTOSIZE
);
858 m_listctrl
->SetColumnWidth(1, wxLIST_AUTOSIZE
);
860 // get the approx height of the listctrl
861 wxFont font
= GetFont();
863 font
= *wxSWISS_FONT
;
866 GetTextExtent(_T("H"), (int*)NULL
, &y
, (int*)NULL
, (int*)NULL
, &font
);
867 int height
= wxMax(y
*(count
+ 3), 100);
869 // if the height as computed from list items exceeds, together with the
870 // actual message & controls, the screen, make it smaller
872 (3*wxSystemSettings::GetSystemMetric(wxSYS_SCREEN_Y
))/5 - GetSize().y
;
874 m_listctrl
->SetSize(-1, wxMin(height
, heightMax
));
877 void wxLogDialog::OnListSelect(wxListEvent
& event
)
879 // we can't just disable the control because this looks ugly under Windows
880 // (wrong bg colour, no scrolling...), but we still want to disable
881 // selecting items - it makes no sense here
882 m_listctrl
->SetItemState(event
.GetIndex(), 0, wxLIST_STATE_SELECTED
);
885 void wxLogDialog::OnOk(wxCommandEvent
& WXUNUSED(event
))
892 void wxLogDialog::OnSave(wxCommandEvent
& WXUNUSED(event
))
896 int rc
= OpenLogFile(file
);
905 wxString fmt
= wxLog::GetTimestamp();
912 size_t count
= m_messages
.GetCount();
913 for ( size_t n
= 0; ok
&& (n
< count
); n
++ )
916 line
<< TimeStamp(fmt
, (time_t)m_times
[n
])
919 << wxTextFile::GetEOL();
921 ok
= file
.Write(line
);
928 wxLogError(_("Can't save log contents to file."));
934 void wxLogDialog::OnDetails(wxCommandEvent
& WXUNUSED(event
))
936 wxSizer
*sizer
= GetSizer();
938 if ( m_showingDetails
)
940 m_btnDetails
->SetLabel(ms_details
+ _T(">>"));
942 sizer
->Remove(m_listctrl
);
945 sizer
->Remove(m_statline
);
946 #endif // wxUSE_STATLINE
949 sizer
->Remove(m_btnSave
);
952 else // show details now
954 m_btnDetails
->SetLabel(wxString(_T("<< ")) + ms_details
);
958 CreateDetailsControls();
962 sizer
->Add(m_statline
, 0, wxEXPAND
| (wxALL
& ~wxTOP
), MARGIN
);
963 #endif // wxUSE_STATLINE
965 sizer
->Add(m_listctrl
, 1, wxEXPAND
| (wxALL
& ~wxTOP
), MARGIN
);
968 sizer
->Add(m_btnSave
, 0, wxALIGN_RIGHT
| (wxALL
& ~wxTOP
), MARGIN
);
972 m_showingDetails
= !m_showingDetails
;
974 // in any case, our size changed - update
975 sizer
->SetSizeHints(this);
979 // VS: this is neccessary in order to force frame redraw under
980 // WindowMaker or fvwm2 (and probably other broken WMs).
981 // Otherwise, detailed list wouldn't be displayed.
986 wxLogDialog::~wxLogDialog()
990 delete m_listctrl
->GetImageList(wxIMAGE_LIST_SMALL
);
994 #endif // wxUSE_LOG_DIALOG
996 #if wxUSE_FILE && wxUSE_FILEDLG
998 // pass an uninitialized file object, the function will ask the user for the
999 // filename and try to open it, returns TRUE on success (file was opened),
1000 // FALSE if file couldn't be opened/created and -1 if the file selection
1001 // dialog was cancelled
1002 static int OpenLogFile(wxFile
& file
, wxString
*pFilename
)
1004 // get the file name
1005 // -----------------
1006 wxString filename
= wxSaveFileSelector(wxT("log"), wxT("txt"), wxT("log.txt"));
1015 if ( wxFile::Exists(filename
) ) {
1016 bool bAppend
= FALSE
;
1018 strMsg
.Printf(_("Append log to file '%s' (choosing [No] will overwrite it)?"),
1020 switch ( wxMessageBox(strMsg
, _("Question"),
1021 wxICON_QUESTION
| wxYES_NO
| wxCANCEL
) ) {
1034 wxFAIL_MSG(_("invalid message box return value"));
1038 bOk
= file
.Open(filename
, wxFile::write_append
);
1041 bOk
= file
.Create(filename
, TRUE
/* overwrite */);
1045 bOk
= file
.Create(filename
);
1049 *pFilename
= filename
;
1054 #endif // wxUSE_FILE
1056 #endif // !(wxUSE_LOGGUI || wxUSE_LOGWINDOW)
1060 // ----------------------------------------------------------------------------
1061 // wxLogTextCtrl implementation
1062 // ----------------------------------------------------------------------------
1064 wxLogTextCtrl::wxLogTextCtrl(wxTextCtrl
*pTextCtrl
)
1066 m_pTextCtrl
= pTextCtrl
;
1069 void wxLogTextCtrl::DoLogString(const wxChar
*szString
, time_t WXUNUSED(t
))
1074 #if defined(__WXMAC__) && !defined(__DARWIN__)
1075 // VZ: this is a bug in wxMac, it *must* accept '\n' as new line, the
1076 // translation must be done in wxTextCtrl, not here! (FIXME)
1077 msg
<< szString
<< wxT('\r');
1079 msg
<< szString
<< wxT('\n');
1082 m_pTextCtrl
->AppendText(msg
);
1085 #endif // wxUSE_TEXTCTRL