* Change wxID_CLOSE to wxID_OK
* Destroy the dialogue when closed * Don't delete *sink. Originally committed to SVN as r4413.
This commit is contained in:
parent
2e156b8c4f
commit
2d1bea39cf
2 changed files with 16 additions and 6 deletions
|
@ -66,7 +66,7 @@ LogWindow::LogWindow(wxWindow *parent)
|
|||
sizer_text->Add(text_ctrl, 1, wxEXPAND);
|
||||
|
||||
wxSizer *sizer_button = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizer_button->Add(new wxButton(this, wxID_CLOSE), 0, wxALIGN_RIGHT | wxALL, 2);
|
||||
sizer_button->Add(new wxButton(this, wxID_OK), 0, wxALIGN_RIGHT | wxALL, 2);
|
||||
|
||||
|
||||
wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
@ -86,17 +86,16 @@ LogWindow::~LogWindow() {
|
|||
delete emit_log;
|
||||
}
|
||||
|
||||
|
||||
LogWindow::EmitLog::EmitLog(wxTextCtrl *t): text_ctrl(t) {
|
||||
const agi::log::Sink *sink = agi::log::log->GetSink();
|
||||
|
||||
for (unsigned int i=0; i < sink->size(); i++) {
|
||||
Write((*sink)[i]);
|
||||
}
|
||||
delete sink;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void LogWindow::EmitLog::Write(agi::log::SinkMessage *sm) {
|
||||
#ifndef _WIN32
|
||||
tm tmtime;
|
||||
|
@ -121,13 +120,22 @@ void LogWindow::EmitLog::Write(agi::log::SinkMessage *sm) {
|
|||
sm->func,
|
||||
sm->line,
|
||||
sm->message);
|
||||
|
||||
#endif
|
||||
text_ctrl->AppendText(log);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void LogWindow::EmitLog::log(agi::log::SinkMessage *sm) {
|
||||
delete text_ctrl;
|
||||
Write(sm);
|
||||
}
|
||||
|
||||
|
||||
void LogWindow::OnClose(wxCloseEvent &WXUNUSED(event)) {
|
||||
Destroy();
|
||||
}
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE(LogWindow, wxDialog)
|
||||
EVT_CLOSE(LogWindow::OnClose)
|
||||
END_EVENT_TABLE()
|
||||
|
|
|
@ -65,7 +65,9 @@ public:
|
|||
|
||||
LogWindow(wxWindow *parent);
|
||||
~LogWindow();
|
||||
DECLARE_EVENT_TABLE()
|
||||
private:
|
||||
EmitLog *emit_log;
|
||||
void OnClose(wxCloseEvent &event);
|
||||
EmitLog *emit_log;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue