--- nono/wx/wxtextscreen.h 2026/04/29 17:04:28 1.1 +++ nono/wx/wxtextscreen.h 2026/04/29 17:04:56 1.1.1.6 @@ -1,51 +1,66 @@ // // nono -// Copyright (C) 2018 isaki@NetBSD.org +// Copyright (C) 2020 nono project +// Licensed under nono-license.txt // #pragma once #include "wxtextpanel.h" +#include "wxbitmapbuf.h" +#include "monitor.h" // -// テキストスクリーン風コントロール +// テキストスクリーンを表示するパネル // // wxPanel // ↓ // WXTextPanel テキストフォントを管理するクラス // ↓ -// WXTextScreen テキストフォントを使ったテキストスクリーン +// WXTextScreen テキストスクリーンを表示するパネル // class WXTextScreen : public WXTextPanel { - typedef WXTextPanel inherited; + 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 = NULL; - uint16 *prevbuf = NULL; - uint8 *bmpbuf = NULL; - wxImage *image = NULL; - wxBitmap *bitmap = NULL; - - 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(); };