wxUSE_LOG fixes.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28335 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
3b92f0e014
commit
fa0d344773
@ -69,7 +69,9 @@ public:
|
|||||||
void OnPlotDClick( wxPlotEvent &event );
|
void OnPlotDClick( wxPlotEvent &event );
|
||||||
|
|
||||||
wxPlotWindow *m_plot;
|
wxPlotWindow *m_plot;
|
||||||
|
#if wxUSE_LOG
|
||||||
wxTextCtrl *m_log;
|
wxTextCtrl *m_log;
|
||||||
|
#endif // wxUSE_LOG
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(MyFrame)
|
DECLARE_DYNAMIC_CLASS(MyFrame)
|
||||||
@ -134,22 +136,26 @@ MyFrame::MyFrame()
|
|||||||
oo->Add( 1000, 2000 );
|
oo->Add( 1000, 2000 );
|
||||||
m_plot->Add( oo );
|
m_plot->Add( oo );
|
||||||
|
|
||||||
|
#if wxUSE_LOG
|
||||||
m_log = new wxTextCtrl( this, -1, _T("This is the log window.\n"), wxPoint(0,0), wxSize(100,100), wxTE_MULTILINE );
|
m_log = new wxTextCtrl( this, -1, _T("This is the log window.\n"), wxPoint(0,0), wxSize(100,100), wxTE_MULTILINE );
|
||||||
wxLog *old_log = wxLog::SetActiveTarget( new wxLogTextCtrl( m_log ) );
|
wxLog *old_log = wxLog::SetActiveTarget( new wxLogTextCtrl( m_log ) );
|
||||||
delete old_log;
|
delete old_log;
|
||||||
|
#endif // wxUSE_LOG
|
||||||
|
|
||||||
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
|
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
topsizer->Add( m_plot, 1, wxEXPAND );
|
topsizer->Add( m_plot, 1, wxEXPAND );
|
||||||
|
#if wxUSE_LOG
|
||||||
topsizer->Add( m_log, 0, wxEXPAND );
|
topsizer->Add( m_log, 0, wxEXPAND );
|
||||||
|
#endif // wxUSE_LOG
|
||||||
|
|
||||||
SetAutoLayout( TRUE );
|
SetAutoLayout( true );
|
||||||
SetSizer( topsizer );
|
SetSizer( topsizer );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnQuit( wxCommandEvent &WXUNUSED(event) )
|
void MyFrame::OnQuit( wxCommandEvent &WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
Close( TRUE );
|
Close( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) )
|
void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) )
|
||||||
|
@ -84,11 +84,15 @@ PreviewFrame::PreviewFrame()
|
|||||||
wxSize(cfg->Read(_T("previewframe_w"), 400), cfg->Read(_T("previewframe_h"), 400))));
|
wxSize(cfg->Read(_T("previewframe_w"), 400), cfg->Read(_T("previewframe_h"), 400))));
|
||||||
|
|
||||||
m_Splitter = new wxSplitterWindow(this, wxID_ANY);
|
m_Splitter = new wxSplitterWindow(this, wxID_ANY);
|
||||||
|
#if wxUSE_LOG
|
||||||
m_LogCtrl = new wxTextCtrl(m_Splitter, wxID_ANY, wxEmptyString, wxDefaultPosition,
|
m_LogCtrl = new wxTextCtrl(m_Splitter, wxID_ANY, wxEmptyString, wxDefaultPosition,
|
||||||
wxDefaultSize, wxTE_MULTILINE);
|
wxDefaultSize, wxTE_MULTILINE);
|
||||||
|
#endif // wxUSE_LOG
|
||||||
m_ScrollWin = new wxScrolledWindow(m_Splitter, wxID_ANY);
|
m_ScrollWin = new wxScrolledWindow(m_Splitter, wxID_ANY);
|
||||||
m_ScrollWin->SetBackgroundColour(_T("light steel blue"));
|
m_ScrollWin->SetBackgroundColour(_T("light steel blue"));
|
||||||
|
#if wxUSE_LOG
|
||||||
m_Splitter->SplitHorizontally(m_ScrollWin, m_LogCtrl, cfg->Read(_T("previewframe_sash"), 300));
|
m_Splitter->SplitHorizontally(m_ScrollWin, m_LogCtrl, cfg->Read(_T("previewframe_sash"), 300));
|
||||||
|
#endif // wxUSE_LOG
|
||||||
|
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
CreateStatusBar();
|
CreateStatusBar();
|
||||||
@ -135,8 +139,10 @@ void PreviewFrame::MakeDirty()
|
|||||||
if (m_Node == NULL) return;
|
if (m_Node == NULL) return;
|
||||||
if (m_Dirty) return;
|
if (m_Dirty) return;
|
||||||
m_Dirty = true;
|
m_Dirty = true;
|
||||||
|
#if wxUSE_LOG
|
||||||
m_LogCtrl->Clear();
|
m_LogCtrl->Clear();
|
||||||
m_LogCtrl->SetValue(_("Resource modified.\nMove mouse cursor over the preview window to refresh it."));
|
m_LogCtrl->SetValue(_("Resource modified.\nMove mouse cursor over the preview window to refresh it."));
|
||||||
|
#endif // wxUSE_LOG
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -177,9 +183,11 @@ void PreviewFrame::Preview(wxXmlNode *node, wxXmlDocument *orig_doc)
|
|||||||
m_Node = node;
|
m_Node = node;
|
||||||
m_Doc = orig_doc;
|
m_Doc = orig_doc;
|
||||||
|
|
||||||
|
#if wxUSE_LOG
|
||||||
m_LogCtrl->Clear();
|
m_LogCtrl->Clear();
|
||||||
wxLogTextCtrl mylog(m_LogCtrl);
|
wxLogTextCtrl mylog(m_LogCtrl);
|
||||||
wxLog *oldlog = wxLog::SetActiveTarget(&mylog);
|
wxLog *oldlog = wxLog::SetActiveTarget(&mylog);
|
||||||
|
#endif // wxUSE_LOG
|
||||||
|
|
||||||
wxString oldcwd = wxGetCwd();
|
wxString oldcwd = wxGetCwd();
|
||||||
wxSetWorkingDirectory(wxPathOnly(EditorFrame::Get()->GetFileName()));
|
wxSetWorkingDirectory(wxPathOnly(EditorFrame::Get()->GetFileName()));
|
||||||
@ -194,7 +202,9 @@ void PreviewFrame::Preview(wxXmlNode *node, wxXmlDocument *orig_doc)
|
|||||||
PreviewWXFrame();
|
PreviewWXFrame();
|
||||||
|
|
||||||
wxSetWorkingDirectory(oldcwd);
|
wxSetWorkingDirectory(oldcwd);
|
||||||
|
#if wxUSE_LOG
|
||||||
wxLog::SetActiveTarget(oldlog);
|
wxLog::SetActiveTarget(oldlog);
|
||||||
|
#endif // wxUSE_LOG
|
||||||
|
|
||||||
m_Dirty = false;
|
m_Dirty = false;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,9 @@ class PreviewFrame : public wxFrame
|
|||||||
wxXmlNode *m_Node;
|
wxXmlNode *m_Node;
|
||||||
wxXmlDocument *m_Doc;
|
wxXmlDocument *m_Doc;
|
||||||
wxScrolledWindow *m_ScrollWin;
|
wxScrolledWindow *m_ScrollWin;
|
||||||
|
#if wxUSE_LOG
|
||||||
wxTextCtrl *m_LogCtrl;
|
wxTextCtrl *m_LogCtrl;
|
||||||
|
#endif // wxUSE_LOG
|
||||||
wxSplitterWindow *m_Splitter;
|
wxSplitterWindow *m_Splitter;
|
||||||
|
|
||||||
wxXmlResource *m_RC;
|
wxXmlResource *m_RC;
|
||||||
|
@ -370,11 +370,13 @@ bool wxAppConsole::OnCmdLineParsed(wxCmdLineParser& parser)
|
|||||||
#if wxUSE_LOG
|
#if wxUSE_LOG
|
||||||
if ( parser.Found(OPTION_VERBOSE) )
|
if ( parser.Found(OPTION_VERBOSE) )
|
||||||
{
|
{
|
||||||
wxLog::SetVerbose(TRUE);
|
wxLog::SetVerbose(true);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
wxUnusedVar(parser);
|
||||||
#endif // wxUSE_LOG
|
#endif // wxUSE_LOG
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxAppConsole::OnCmdLineHelp(wxCmdLineParser& parser)
|
bool wxAppConsole::OnCmdLineHelp(wxCmdLineParser& parser)
|
||||||
|
Loading…
Reference in New Issue
Block a user