diff --git a/aegisub/src/command/app.cpp b/aegisub/src/command/app.cpp index a5e94893e..04b7b7853 100644 --- a/aegisub/src/command/app.cpp +++ b/aegisub/src/command/app.cpp @@ -44,6 +44,8 @@ #include "command.h" +#include + #include "../include/aegisub/context.h" #include "../main.h" diff --git a/aegisub/src/dialog_log.cpp b/aegisub/src/dialog_log.cpp index 89602c953..85f39811c 100644 --- a/aegisub/src/dialog_log.cpp +++ b/aegisub/src/dialog_log.cpp @@ -49,6 +49,8 @@ #include #endif +#include + class EmitLog : public agi::log::Emitter { wxTextCtrl *text_ctrl; public: @@ -73,7 +75,7 @@ public: sm->file, sm->func, sm->line, - std::string(sm->message, sm->len)); + wxString::FromUTF8(sm->message, sm->len)); #else wxString log = wxString::Format("%c %-6ld <%-25s> [%s:%s:%d] %s\n", agi::log::Severity_ID[sm->severity], @@ -82,7 +84,7 @@ public: sm->file, sm->func, sm->line, - std::string(sm->message, sm->len)); + wxString::FromUTF8(sm->message, sm->len)); #endif text_ctrl->AppendText(log); } @@ -99,8 +101,11 @@ LogWindow::LogWindow(wxWindow *parent) sizer->Add(new wxButton(this, wxID_OK), wxSizerFlags(0).Border().Right()); SetSizerAndFit(sizer); - emit_log.reset(new EmitLog(text_ctrl)); - emit_log->Enable(); + agi::log::log->Subscribe(emit_log = new EmitLog(text_ctrl)); Bind(wxEVT_CLOSE_WINDOW, std::tr1::bind(&wxDialog::Destroy, this)); } + +LogWindow::~LogWindow() { + agi::log::log->Unsubscribe(emit_log); +} diff --git a/aegisub/src/dialog_log.h b/aegisub/src/dialog_log.h index 09cb595ab..88a5bbe68 100644 --- a/aegisub/src/dialog_log.h +++ b/aegisub/src/dialog_log.h @@ -38,14 +38,14 @@ #include #endif -#include -#include +namespace agi { namespace log { class Emitter; } } class LogWindow: public wxDialog { - agi::scoped_ptr emit_log; + agi::log::Emitter *emit_log; public: /// @brief Constructor /// @param parent Parent frame. LogWindow(wxWindow *parent); + ~LogWindow(); };