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)
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
void OnAbout(wxCommandEvent& event);
|
||||
#if wxUSE_LOG
|
||||
void OnLogs(wxCommandEvent& event);
|
||||
#endif // wxUSE_LOG
|
||||
void OnBrowser(wxCommandEvent& event);
|
||||
void OnPlugProvider(wxCommandEvent& event);
|
||||
|
||||
@@ -73,7 +75,9 @@ enum
|
||||
|
||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_MENU(ID_Quit, MyFrame::OnQuit)
|
||||
#if wxUSE_LOG
|
||||
EVT_MENU(ID_Logs, MyFrame::OnLogs)
|
||||
#endif // wxUSE_LOG
|
||||
EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
|
||||
EVT_MENU(ID_Browser, MyFrame::OnBrowser)
|
||||
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->AppendSeparator();
|
||||
|
||||
#if wxUSE_LOG
|
||||
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->AppendSeparator();
|
||||
|
||||
@@ -179,6 +185,7 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
Close(true);
|
||||
}
|
||||
|
||||
#if wxUSE_LOG
|
||||
void MyFrame::OnLogs(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxLogMessage(_T("Some information."));
|
||||
@@ -188,6 +195,7 @@ void MyFrame::OnLogs(wxCommandEvent& WXUNUSED(event))
|
||||
wxLog::GetActiveTarget()->Flush();
|
||||
wxLogMessage(_T("Check/uncheck 'File/Plug-in art provider' and try again."));
|
||||
}
|
||||
#endif // wxUSE_LOG
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
|
@@ -839,13 +839,17 @@ DatabaseDemoFrame::DatabaseDemoFrame(wxFrame *frame, const wxString& title,
|
||||
pEditorDlg = NULL;
|
||||
pParamDlg = NULL;
|
||||
|
||||
#if wxUSE_LOG
|
||||
delete wxLog::SetActiveTarget(new wxLogStderr);
|
||||
#endif // wxUSE_LOG
|
||||
|
||||
} // DatabaseDemoFrame constructor
|
||||
|
||||
DatabaseDemoFrame::~DatabaseDemoFrame()
|
||||
{
|
||||
#if wxUSE_LOG
|
||||
delete wxLog::SetActiveTarget(NULL);
|
||||
#endif // wxUSE_LOG
|
||||
} // DatabaseDemoFrame destructor
|
||||
|
||||
|
||||
|
@@ -170,7 +170,9 @@ bool MyApp::OnInit()
|
||||
{
|
||||
wxLogError(wxT("The sample can't run on this system."));
|
||||
|
||||
#if wxUSE_LOG
|
||||
wxLog::GetActiveTarget()->Flush();
|
||||
#endif // wxUSE_LOG
|
||||
|
||||
// do it here, OnExit() won't be called
|
||||
delete m_dial;
|
||||
|
@@ -135,9 +135,6 @@ GridFrame::GridFrame()
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize )
|
||||
{
|
||||
int gridW = 600, gridH = 300;
|
||||
int logW = gridW, logH = 100;
|
||||
|
||||
wxMenu *fileMenu = new wxMenu;
|
||||
fileMenu->Append( ID_VTABLE, _T("&Virtual table test\tCtrl-V"));
|
||||
fileMenu->Append( ID_BUGS_TABLE, _T("&Bugs table test\tCtrl-B"));
|
||||
@@ -234,6 +231,10 @@ GridFrame::GridFrame()
|
||||
wxPoint( 0, 0 ),
|
||||
wxSize( 400, 300 ) );
|
||||
|
||||
#if wxUSE_LOG
|
||||
int gridW = 600, gridH = 300;
|
||||
int logW = gridW, logH = 100;
|
||||
|
||||
logWin = new wxTextCtrl( this,
|
||||
wxID_ANY,
|
||||
wxEmptyString,
|
||||
@@ -244,6 +245,7 @@ GridFrame::GridFrame()
|
||||
logger = new wxLogTextCtrl( logWin );
|
||||
m_logOld = logger->SetActiveTarget( logger );
|
||||
logger->SetTimestamp( NULL );
|
||||
#endif // wxUSE_LOG
|
||||
|
||||
// this will create a grid and, by default, an associated grid
|
||||
// table for strings
|
||||
@@ -340,9 +342,11 @@ GridFrame::GridFrame()
|
||||
1,
|
||||
wxEXPAND );
|
||||
|
||||
#if wxUSE_LOG
|
||||
topSizer->Add( logWin,
|
||||
0,
|
||||
wxEXPAND );
|
||||
#endif // wxUSE_LOG
|
||||
|
||||
SetSizer( topSizer );
|
||||
|
||||
@@ -355,7 +359,9 @@ GridFrame::GridFrame()
|
||||
|
||||
GridFrame::~GridFrame()
|
||||
{
|
||||
#if wxUSE_LOG
|
||||
delete wxLog::SetActiveTarget(m_logOld);
|
||||
#endif // wxUSE_LOG
|
||||
}
|
||||
|
||||
|
||||
|
@@ -24,8 +24,10 @@ public:
|
||||
class GridFrame : public wxFrame
|
||||
{
|
||||
wxGrid *grid;
|
||||
#if wxUSE_LOG
|
||||
wxTextCtrl *logWin;
|
||||
wxLogTextCtrl *logger;
|
||||
#endif // wxUSE_LOG
|
||||
wxString logBuf;
|
||||
|
||||
void SetDefaults();
|
||||
@@ -148,7 +150,9 @@ public:
|
||||
ID_TESTFUNC
|
||||
};
|
||||
|
||||
#if wxUSE_LOG
|
||||
wxLog *m_logOld;
|
||||
#endif // wxUSE_LOG
|
||||
|
||||
// add the cells to selection when using commands from select menu?
|
||||
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->SetDefault();
|
||||
|
||||
#if wxUSE_LOG
|
||||
m_text = new wxTextCtrl(m_panel, wxID_ANY, wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY);
|
||||
|
||||
m_logTargetOld = wxLog::SetActiveTarget( new wxLogTextCtrl(m_text) );
|
||||
#endif // wxUSE_LOG
|
||||
|
||||
// Set sizers
|
||||
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);
|
||||
#if wxUSE_LOG
|
||||
m_sizerFrame->Add(m_text, 0, wxEXPAND);
|
||||
#endif // wxUSE_LOG
|
||||
|
||||
ReInitNotebook();
|
||||
m_notebook->CreateInitialPages();
|
||||
@@ -324,7 +328,9 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
|
||||
|
||||
MyFrame::~MyFrame()
|
||||
{
|
||||
#if wxUSE_LOG
|
||||
delete wxLog::SetActiveTarget(m_logTargetOld);
|
||||
#endif // wxUSE_LOG
|
||||
|
||||
if (m_imageList)
|
||||
{
|
||||
@@ -530,7 +536,9 @@ void MyFrame::OnNotebook(wxNotebookEvent& event)
|
||||
wxLogMessage(wxT("Notebook event #%d: %s (%d)"),
|
||||
s_numNotebookEvents++, str.c_str(), eventType);
|
||||
|
||||
#if wxUSE_LOG
|
||||
m_text->SetInsertionPointEnd();
|
||||
#endif // wxUSE_LOG
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
@@ -117,9 +117,10 @@ private:
|
||||
|
||||
MyNotebook *m_notebook;
|
||||
|
||||
#if wxUSE_LOG
|
||||
// Log window
|
||||
wxTextCtrl *m_text;
|
||||
|
||||
#endif // wxUSE_LOG
|
||||
|
||||
// Sizers
|
||||
|
||||
|
Reference in New Issue
Block a user