wxUSE_LOG fixes.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28338 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -47,7 +47,9 @@ private:
|
|||||||
// event handlers (these functions should _not_ be virtual)
|
// event handlers (these functions should _not_ be virtual)
|
||||||
void OnQuit(wxCommandEvent& event);
|
void OnQuit(wxCommandEvent& event);
|
||||||
void OnAbout(wxCommandEvent& event);
|
void OnAbout(wxCommandEvent& event);
|
||||||
|
#if wxUSE_LOG
|
||||||
void OnLogs(wxCommandEvent& event);
|
void OnLogs(wxCommandEvent& event);
|
||||||
|
#endif // wxUSE_LOG
|
||||||
void OnBrowser(wxCommandEvent& event);
|
void OnBrowser(wxCommandEvent& event);
|
||||||
void OnPlugProvider(wxCommandEvent& event);
|
void OnPlugProvider(wxCommandEvent& event);
|
||||||
|
|
||||||
@@ -73,7 +75,9 @@ enum
|
|||||||
|
|
||||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||||
EVT_MENU(ID_Quit, MyFrame::OnQuit)
|
EVT_MENU(ID_Quit, MyFrame::OnQuit)
|
||||||
|
#if wxUSE_LOG
|
||||||
EVT_MENU(ID_Logs, MyFrame::OnLogs)
|
EVT_MENU(ID_Logs, MyFrame::OnLogs)
|
||||||
|
#endif // wxUSE_LOG
|
||||||
EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
|
EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
|
||||||
EVT_MENU(ID_Browser, MyFrame::OnBrowser)
|
EVT_MENU(ID_Browser, MyFrame::OnBrowser)
|
||||||
EVT_MENU(ID_PlugProvider, MyFrame::OnPlugProvider)
|
EVT_MENU(ID_PlugProvider, MyFrame::OnPlugProvider)
|
||||||
@@ -155,7 +159,9 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
|
|||||||
menuFile->AppendCheckItem(ID_PlugProvider, _T("&Plug-in art provider"), _T("Enable custom art provider"));
|
menuFile->AppendCheckItem(ID_PlugProvider, _T("&Plug-in art provider"), _T("Enable custom art provider"));
|
||||||
menuFile->AppendSeparator();
|
menuFile->AppendSeparator();
|
||||||
|
|
||||||
|
#if wxUSE_LOG
|
||||||
menuFile->Append(ID_Logs, _T("&Logging test"), _T("Show some logging output"));
|
menuFile->Append(ID_Logs, _T("&Logging test"), _T("Show some logging output"));
|
||||||
|
#endif // wxUSE_LOG
|
||||||
menuFile->Append(ID_Browser, _T("&Resources browser"), _T("Browse all available icons"));
|
menuFile->Append(ID_Browser, _T("&Resources browser"), _T("Browse all available icons"));
|
||||||
menuFile->AppendSeparator();
|
menuFile->AppendSeparator();
|
||||||
|
|
||||||
@@ -179,6 +185,7 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
|||||||
Close(true);
|
Close(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if wxUSE_LOG
|
||||||
void MyFrame::OnLogs(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnLogs(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxLogMessage(_T("Some information."));
|
wxLogMessage(_T("Some information."));
|
||||||
@@ -188,6 +195,7 @@ void MyFrame::OnLogs(wxCommandEvent& WXUNUSED(event))
|
|||||||
wxLog::GetActiveTarget()->Flush();
|
wxLog::GetActiveTarget()->Flush();
|
||||||
wxLogMessage(_T("Check/uncheck 'File/Plug-in art provider' and try again."));
|
wxLogMessage(_T("Check/uncheck 'File/Plug-in art provider' and try again."));
|
||||||
}
|
}
|
||||||
|
#endif // wxUSE_LOG
|
||||||
|
|
||||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
|
@@ -839,13 +839,17 @@ DatabaseDemoFrame::DatabaseDemoFrame(wxFrame *frame, const wxString& title,
|
|||||||
pEditorDlg = NULL;
|
pEditorDlg = NULL;
|
||||||
pParamDlg = NULL;
|
pParamDlg = NULL;
|
||||||
|
|
||||||
|
#if wxUSE_LOG
|
||||||
delete wxLog::SetActiveTarget(new wxLogStderr);
|
delete wxLog::SetActiveTarget(new wxLogStderr);
|
||||||
|
#endif // wxUSE_LOG
|
||||||
|
|
||||||
} // DatabaseDemoFrame constructor
|
} // DatabaseDemoFrame constructor
|
||||||
|
|
||||||
DatabaseDemoFrame::~DatabaseDemoFrame()
|
DatabaseDemoFrame::~DatabaseDemoFrame()
|
||||||
{
|
{
|
||||||
|
#if wxUSE_LOG
|
||||||
delete wxLog::SetActiveTarget(NULL);
|
delete wxLog::SetActiveTarget(NULL);
|
||||||
|
#endif // wxUSE_LOG
|
||||||
} // DatabaseDemoFrame destructor
|
} // DatabaseDemoFrame destructor
|
||||||
|
|
||||||
|
|
||||||
|
@@ -170,7 +170,9 @@ bool MyApp::OnInit()
|
|||||||
{
|
{
|
||||||
wxLogError(wxT("The sample can't run on this system."));
|
wxLogError(wxT("The sample can't run on this system."));
|
||||||
|
|
||||||
|
#if wxUSE_LOG
|
||||||
wxLog::GetActiveTarget()->Flush();
|
wxLog::GetActiveTarget()->Flush();
|
||||||
|
#endif // wxUSE_LOG
|
||||||
|
|
||||||
// do it here, OnExit() won't be called
|
// do it here, OnExit() won't be called
|
||||||
delete m_dial;
|
delete m_dial;
|
||||||
|
@@ -135,9 +135,6 @@ GridFrame::GridFrame()
|
|||||||
wxDefaultPosition,
|
wxDefaultPosition,
|
||||||
wxDefaultSize )
|
wxDefaultSize )
|
||||||
{
|
{
|
||||||
int gridW = 600, gridH = 300;
|
|
||||||
int logW = gridW, logH = 100;
|
|
||||||
|
|
||||||
wxMenu *fileMenu = new wxMenu;
|
wxMenu *fileMenu = new wxMenu;
|
||||||
fileMenu->Append( ID_VTABLE, _T("&Virtual table test\tCtrl-V"));
|
fileMenu->Append( ID_VTABLE, _T("&Virtual table test\tCtrl-V"));
|
||||||
fileMenu->Append( ID_BUGS_TABLE, _T("&Bugs table test\tCtrl-B"));
|
fileMenu->Append( ID_BUGS_TABLE, _T("&Bugs table test\tCtrl-B"));
|
||||||
@@ -234,6 +231,10 @@ GridFrame::GridFrame()
|
|||||||
wxPoint( 0, 0 ),
|
wxPoint( 0, 0 ),
|
||||||
wxSize( 400, 300 ) );
|
wxSize( 400, 300 ) );
|
||||||
|
|
||||||
|
#if wxUSE_LOG
|
||||||
|
int gridW = 600, gridH = 300;
|
||||||
|
int logW = gridW, logH = 100;
|
||||||
|
|
||||||
logWin = new wxTextCtrl( this,
|
logWin = new wxTextCtrl( this,
|
||||||
wxID_ANY,
|
wxID_ANY,
|
||||||
wxEmptyString,
|
wxEmptyString,
|
||||||
@@ -244,6 +245,7 @@ GridFrame::GridFrame()
|
|||||||
logger = new wxLogTextCtrl( logWin );
|
logger = new wxLogTextCtrl( logWin );
|
||||||
m_logOld = logger->SetActiveTarget( logger );
|
m_logOld = logger->SetActiveTarget( logger );
|
||||||
logger->SetTimestamp( NULL );
|
logger->SetTimestamp( NULL );
|
||||||
|
#endif // wxUSE_LOG
|
||||||
|
|
||||||
// this will create a grid and, by default, an associated grid
|
// this will create a grid and, by default, an associated grid
|
||||||
// table for strings
|
// table for strings
|
||||||
@@ -340,9 +342,11 @@ GridFrame::GridFrame()
|
|||||||
1,
|
1,
|
||||||
wxEXPAND );
|
wxEXPAND );
|
||||||
|
|
||||||
|
#if wxUSE_LOG
|
||||||
topSizer->Add( logWin,
|
topSizer->Add( logWin,
|
||||||
0,
|
0,
|
||||||
wxEXPAND );
|
wxEXPAND );
|
||||||
|
#endif // wxUSE_LOG
|
||||||
|
|
||||||
SetSizer( topSizer );
|
SetSizer( topSizer );
|
||||||
|
|
||||||
@@ -355,7 +359,9 @@ GridFrame::GridFrame()
|
|||||||
|
|
||||||
GridFrame::~GridFrame()
|
GridFrame::~GridFrame()
|
||||||
{
|
{
|
||||||
|
#if wxUSE_LOG
|
||||||
delete wxLog::SetActiveTarget(m_logOld);
|
delete wxLog::SetActiveTarget(m_logOld);
|
||||||
|
#endif // wxUSE_LOG
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -24,8 +24,10 @@ public:
|
|||||||
class GridFrame : public wxFrame
|
class GridFrame : public wxFrame
|
||||||
{
|
{
|
||||||
wxGrid *grid;
|
wxGrid *grid;
|
||||||
|
#if wxUSE_LOG
|
||||||
wxTextCtrl *logWin;
|
wxTextCtrl *logWin;
|
||||||
wxLogTextCtrl *logger;
|
wxLogTextCtrl *logger;
|
||||||
|
#endif // wxUSE_LOG
|
||||||
wxString logBuf;
|
wxString logBuf;
|
||||||
|
|
||||||
void SetDefaults();
|
void SetDefaults();
|
||||||
@@ -148,7 +150,9 @@ public:
|
|||||||
ID_TESTFUNC
|
ID_TESTFUNC
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if wxUSE_LOG
|
||||||
wxLog *m_logOld;
|
wxLog *m_logOld;
|
||||||
|
#endif // wxUSE_LOG
|
||||||
|
|
||||||
// add the cells to selection when using commands from select menu?
|
// add the cells to selection when using commands from select menu?
|
||||||
bool m_addToSel;
|
bool m_addToSel;
|
||||||
|
@@ -275,10 +275,12 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
|
|||||||
m_btnExit = new wxButton( m_panel, wxID_OK, wxT("&Exit") );
|
m_btnExit = new wxButton( m_panel, wxID_OK, wxT("&Exit") );
|
||||||
m_btnExit->SetDefault();
|
m_btnExit->SetDefault();
|
||||||
|
|
||||||
|
#if wxUSE_LOG
|
||||||
m_text = new wxTextCtrl(m_panel, wxID_ANY, wxEmptyString,
|
m_text = new wxTextCtrl(m_panel, wxID_ANY, wxEmptyString,
|
||||||
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY);
|
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY);
|
||||||
|
|
||||||
m_logTargetOld = wxLog::SetActiveTarget( new wxLogTextCtrl(m_text) );
|
m_logTargetOld = wxLog::SetActiveTarget( new wxLogTextCtrl(m_text) );
|
||||||
|
#endif // wxUSE_LOG
|
||||||
|
|
||||||
// Set sizers
|
// Set sizers
|
||||||
m_sizerFrame = new wxBoxSizer(wxVERTICAL);
|
m_sizerFrame = new wxBoxSizer(wxVERTICAL);
|
||||||
@@ -308,7 +310,9 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
|
|||||||
|
|
||||||
|
|
||||||
m_sizerFrame->Add(m_sizerTop, 1, wxEXPAND);
|
m_sizerFrame->Add(m_sizerTop, 1, wxEXPAND);
|
||||||
|
#if wxUSE_LOG
|
||||||
m_sizerFrame->Add(m_text, 0, wxEXPAND);
|
m_sizerFrame->Add(m_text, 0, wxEXPAND);
|
||||||
|
#endif // wxUSE_LOG
|
||||||
|
|
||||||
ReInitNotebook();
|
ReInitNotebook();
|
||||||
m_notebook->CreateInitialPages();
|
m_notebook->CreateInitialPages();
|
||||||
@@ -324,7 +328,9 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
|
|||||||
|
|
||||||
MyFrame::~MyFrame()
|
MyFrame::~MyFrame()
|
||||||
{
|
{
|
||||||
|
#if wxUSE_LOG
|
||||||
delete wxLog::SetActiveTarget(m_logTargetOld);
|
delete wxLog::SetActiveTarget(m_logTargetOld);
|
||||||
|
#endif // wxUSE_LOG
|
||||||
|
|
||||||
if (m_imageList)
|
if (m_imageList)
|
||||||
{
|
{
|
||||||
@@ -530,7 +536,9 @@ void MyFrame::OnNotebook(wxNotebookEvent& event)
|
|||||||
wxLogMessage(wxT("Notebook event #%d: %s (%d)"),
|
wxLogMessage(wxT("Notebook event #%d: %s (%d)"),
|
||||||
s_numNotebookEvents++, str.c_str(), eventType);
|
s_numNotebookEvents++, str.c_str(), eventType);
|
||||||
|
|
||||||
|
#if wxUSE_LOG
|
||||||
m_text->SetInsertionPointEnd();
|
m_text->SetInsertionPointEnd();
|
||||||
|
#endif // wxUSE_LOG
|
||||||
|
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
@@ -117,9 +117,10 @@ private:
|
|||||||
|
|
||||||
MyNotebook *m_notebook;
|
MyNotebook *m_notebook;
|
||||||
|
|
||||||
|
#if wxUSE_LOG
|
||||||
// Log window
|
// Log window
|
||||||
wxTextCtrl *m_text;
|
wxTextCtrl *m_text;
|
||||||
|
#endif // wxUSE_LOG
|
||||||
|
|
||||||
// Sizers
|
// Sizers
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user