--- nono/wx/wxmonitor.cpp 2026/04/29 17:04:37 1.1.1.2 +++ nono/wx/wxmonitor.cpp 2026/04/29 17:04:53 1.1.1.4 @@ -11,61 +11,49 @@ // モニターウィンドウ // -// イベントテーブル -wxBEGIN_EVENT_TABLE(WXMonitorWindow, inherited) - EVT_TIMER(wxID_ANY, WXMonitorWindow::OnTimer) -wxEND_EVENT_TABLE() - // コンストラクタ WXMonitorWindow::WXMonitorWindow(wxWindow *parent, wxWindowID id, - const wxString& name, Object *obj) + const wxString& name, IMonitor& monitor_) : inherited(parent, id, name) { - object = obj; - assert(object); + // top + // | +----------------------------+ + // v | 上余白 | + // |+------+------------+------+| + // ||左余白| TextScreen |右余白|| + // |+------+------------+------+| + // | 下余白 | + // +----------------------------+ wxBoxSizer *topsizer = new wxBoxSizer(wxVERTICAL); + // 上余白 + topsizer->Add(new WXPaddingPanel(this), 0, wxEXPAND); + + // 中段(横sizer) + wxBoxSizer *hbox = new wxBoxSizer(wxHORIZONTAL); + topsizer->Add(hbox, 0, wxEXPAND); + + // 左余白 + hbox->Add(new WXPaddingPanel(this), 0, wxEXPAND); + // テキストスクリーン - 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); + screen = new WXTextScreen(this, monitor_); + hbox->Add(screen, 0, wxEXPAND); + + // 右余白 + hbox->Add(new WXPaddingPanel(this), 0, wxEXPAND); + + // 下余白 + topsizer->Add(new WXPaddingPanel(this), 0, wxEXPAND); SetSizer(topsizer); // 大きさをそれに固定 - Layout(); Fit(); - - // 更新タイマーは適当な短さにしておく - timer.SetOwner(this); - timer.Start(10); } // デストラクタ 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(); -}