// Created: 20.09.99 (extracted from src/common/log.cpp)
// RCS-ID: $Id$
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
-// Licence: wxWindows license
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
// 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"
#pragma hdrstop
#endif
-#if !wxUSE_GUI
- #error "This file can't be compiled without GUI!"
-#endif
-
#ifndef WX_PRECOMP
#include "wx/app.h"
#include "wx/button.h"
#include "wx/msgdlg.h"
#endif // wxUSE_LOG_DIALOG/!wxUSE_LOG_DIALOG
+#if defined(__MWERKS__) && wxUSE_UNICODE
+ #include <wtime.h>
+#endif
+
// the suffix we add to the button to show that the dialog can be expanded
#define EXPAND_SUFFIX _T(" >>")
// 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)) )
{
wxFAIL_MSG(_T("strftime() failed"));
}
return wxString(buf);
+#endif
}
static wxString ms_details;
DECLARE_EVENT_TABLE()
+ DECLARE_NO_COPY_CLASS(wxLogDialog)
};
BEGIN_EVENT_TABLE(wxLogDialog, wxDialog)
// 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
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;
}
}
// wxLogGui implementation (FIXME MT-unsafe)
// ----------------------------------------------------------------------------
+#if wxUSE_LOGGUI
+
wxLogGui::wxLogGui()
{
Clear();
}
}
+#endif // wxUSE_LOGGUI
+
// ----------------------------------------------------------------------------
// wxLogWindow and wxLogFrame implementation
// ----------------------------------------------------------------------------
#endif // wxUSE_FILE
void OnClear(wxCommandEvent& event);
- void OnIdle(wxIdleEvent&);
-
// accessors
wxTextCtrl *TextCtrl() const { return m_pTextCtrl; }
wxLogWindow *m_log;
DECLARE_EVENT_TABLE()
+ DECLARE_NO_COPY_CLASS(wxLogFrame)
};
BEGIN_EVENT_TABLE(wxLogFrame, wxFrame)
#if wxUSE_FILEDLG
wxString filename;
wxFile file;
- int rc = OpenLogFile(file, &filename);
+ int rc = OpenLogFile(file, &filename, this);
if ( rc == -1 )
{
// cancelled
wxLog::DoLog(level, szString, t);
}
}
-
- m_bHasMessages = TRUE;
}
void wxLogWindow::DoLogString(const wxChar *szString, time_t WXUNUSED(t))
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 )
{
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,
bool loadedIcons = TRUE;
-#ifndef __WIN16__
for ( size_t icon = 0; icon < WXSIZEOF(icons); icon++ )
{
wxBitmap bmp = wxArtProvider::GetBitmap(icons[icon], wxART_MESSAGE_BOX,
}
m_listctrl->SetImageList(imageList, wxIMAGE_LIST_SMALL);
-#endif // !Win16
// and fill it
wxString fmt = wxLog::GetTimestamp();
{
int image;
-#ifndef __WIN16__
if ( loadedIcons )
{
switch ( m_severity[n] )
}
}
else // failed to load images
-#endif // !Win16
{
image = -1;
}
{
#if wxUSE_FILEDLG
wxFile file;
- int rc = OpenLogFile(file);
+ int rc = OpenLogFile(file, NULL, this);
if ( rc == -1 )
{
// cancelled
{
m_btnDetails->SetLabel(ms_details + EXPAND_SUFFIX);
- sizer->Remove(m_listctrl);
+ sizer->Detach( m_listctrl );
#if wxUSE_STATLINE
- sizer->Remove(m_statline);
+ sizer->Detach( m_statline );
#endif // wxUSE_STATLINE
#if wxUSE_FILE
- sizer->Remove(m_btnSave);
+ sizer->Detach( m_btnSave );
#endif // wxUSE_FILE
}
else // show details now
// 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;
// open file
// ---------
- bool bOk = FALSE;
+ bool bOk;
if ( wxFile::Exists(filename) ) {
bool bAppend = FALSE;
wxString strMsg;
#endif // !(wxUSE_LOGGUI || wxUSE_LOGWINDOW)
-#if wxUSE_TEXTCTRL
+#if wxUSE_LOG && wxUSE_TEXTCTRL
// ----------------------------------------------------------------------------
// wxLogTextCtrl implementation
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);
}
-#endif // wxUSE_TEXTCTRL
+#endif // wxUSE_LOG && wxUSE_TEXTCTRL
-// vi:sts=4:sw=4:et