--- nono/wx/wxtextscreen.h 2026/04/29 17:04:37 1.1.1.2 +++ nono/wx/wxtextscreen.h 2026/04/29 17:04:56 1.1.1.6 @@ -7,46 +7,60 @@ #pragma once #include "wxtextpanel.h" +#include "wxbitmapbuf.h" +#include "monitor.h" // -// テキストスクリーン風コントロール +// テキストスクリーンを表示するパネル // // wxPanel // ↓ // WXTextPanel テキストフォントを管理するクラス // ↓ -// WXTextScreen テキストフォントを使ったテキストスクリーン +// WXTextScreen テキストスクリーンを表示するパネル // class WXTextScreen : public WXTextPanel { using inherited = WXTextPanel; public: - WXTextScreen(wxWindow *parent, int col, int row, const uint16 *textbuf); - virtual ~WXTextScreen(); + WXTextScreen(wxWindow *parent, Monitor& monitor); + virtual ~WXTextScreen() override; - // XXX - void SetTextSize(int col, int row); - - void OnPaint(wxPaintEvent&); - void OnSize(wxSizeEvent&); + // 画面を更新して再描画する。 + void DoRefresh(); // フォントサイズ変更 - void SetFontSize(fontsize_t fontsize); + void SetFontSize(FontId fontid) override; + + // 更新頻度設定 + void SetRate(int hz); + + // 桁数、行数を取得する + int GetCol() const { return ts.GetCol(); } + int GetRow() const { return ts.GetRow(); } + + // TextScreen のユーザデータ取得、設定 + uint64 GetUserData() const { return ts.userdata; } + void SetUserData(uint64 value) { ts.userdata = value; } private: + void OnPaint(wxPaintEvent&); + void OnSize(wxSizeEvent&); + void OnTimer(wxTimerEvent&); + + void Init(int col, int row); void Draw(wxDC& dc); - const uint16 *textbuf {}; - std::unique_ptr prevbuf {}; - std::unique_ptr bmpbuf {}; - std::unique_ptr image {}; - std::unique_ptr bitmap {}; - - int col = 0; - int row = 0; - int view_width = 0; - int view_height = 0; + // コントロール全域のビットマップ + WXBitmapBuf bitmap {}; + + std::vector prevbuf {}; + + Monitor& monitor; + TextScreen ts {}; + + wxTimer timer {}; wxDECLARE_EVENT_TABLE(); };