--- nono/wx/wxmonitor.cpp 2026/04/29 17:04:37 1.1.1.2 +++ nono/wx/wxmonitor.cpp 2026/04/29 17:05:08 1.1.1.6 @@ -4,68 +4,24 @@ // Licensed under nono-license.txt // -#include "wxmonitor.h" -#include "wxtextscreen.h" - // // モニターウィンドウ // -// イベントテーブル -wxBEGIN_EVENT_TABLE(WXMonitorWindow, inherited) - EVT_TIMER(wxID_ANY, WXMonitorWindow::OnTimer) -wxEND_EVENT_TABLE() +#include "wxmonitor.h" +#include "wxtextscreen.h" // コンストラクタ -WXMonitorWindow::WXMonitorWindow(wxWindow *parent, wxWindowID id, - const wxString& name, Object *obj) - : inherited(parent, id, name) +WXMonitorWindow::WXMonitorWindow(wxWindow *parent, const wxString& name, + Monitor& monitor_) + : inherited(parent, wxID_ANY, name) { - object = obj; - assert(object); - - wxBoxSizer *topsizer = new wxBoxSizer(wxVERTICAL); - // テキストスクリーン - TextScreen& monitor = object->monitor; - int col = monitor.GetCol(); - int row = monitor.GetRow(); - const uint16 *textbuf = monitor.GetBuf(); - screen = new WXTextScreen(this, col, row, textbuf); - topsizer->Add(screen, BorderFlags); - - SetSizer(topsizer); - - // 大きさをそれに固定 - Layout(); - Fit(); - - // 更新タイマーは適当な短さにしておく - timer.SetOwner(this); - timer.Start(10); + screen = new WXTextScreen(this, monitor_); + DoSize(); } // デストラクタ WXMonitorWindow::~WXMonitorWindow() { } - -// タイマーイベント -void -WXMonitorWindow::OnTimer(wxTimerEvent& event) -{ - // モニタースクリーンを更新して再描画。 - bool avail = object->MonitorUpdate(); - assert(avail); - screen->Refresh(); -} - -// フォントサイズ変更 -void -WXMonitorWindow::SetFontSize(fontsize_t fontsize) -{ - screen->SetFontSize(fontsize); - // 大きさを変更 - Layout(); - Fit(); -}