--- nono/wx/wxplanemonitor.h 2026/04/29 17:05:12 1.1.1.1 +++ nono/wx/wxplanemonitor.h 2026/04/29 17:05:19 1.1.1.3 @@ -12,8 +12,13 @@ #include "wxsubwindow.h" #include "wxscrollbar.h" +#include "wxtextscreen.h" #include +class BT45xDevice; +class PlaneVRAMDevice; +class VideoCtlrDevice; + // プレーン VRAM ビットマップパネル class WXPlaneVRAMBitmapPanel : public WXBitmapPanel { @@ -27,6 +32,8 @@ class WXPlaneVRAMBitmapPanel : public WX void EnablePalette(bool value); void SetScale(int scale_); + const wxPoint& GetCursor() const { return cursor; } + void OnScroll(wxScrollEvent& event); Rect view {}; // 表示矩形 @@ -36,7 +43,8 @@ class WXPlaneVRAMBitmapPanel : public WX private: void OnPaletteChanged(wxCommandEvent& event); void GenPalette(); - void Draw(); + void Draw() override; + void OnMouse(wxMouseEvent& event); std::array pal {}; uint32 planemask {}; @@ -45,25 +53,42 @@ class WXPlaneVRAMBitmapPanel : public WX int plane_width {}; // 拡大前のビットマップ幅 [pixel] int plane_height {}; // 拡大前のビットマップ高さ [pixel] + + // マウスカーソルがこのパネル上にあれば、(拡大前の)仮想画面での座標。 + // マウスカーソルがパネル外なら wxDefaultPosition = (-1, -1)。 + // ステータス表示用。 + wxPoint cursor {}; + + BT45xDevice *bt45x {}; + PlaneVRAMDevice *planevram {}; + VideoCtlrDevice *videoctlr {}; + + // イベントテーブル + wxDECLARE_EVENT_TABLE(); }; // ビットマップパネルとスクロールバーを持つ -class WXPlaneVRAMPanel : public wxPanel +class WXPlaneVRAMPanel : public WXTextPanel { - using inherited = wxPanel; + using inherited = WXTextPanel; public: WXPlaneVRAMPanel(wxWindow *parent); virtual ~WXPlaneVRAMPanel() override; bool Layout() override; + // スクロールバーの FontChanged() を呼ぶため(だけ)に + // これ自身も wxTextPanel を継承している。 + void FontChanged(); + void EnablePlane(int plane, bool value); void EnablePalette(bool value); void SetScale(int scale_); + const wxPoint& GetCursor() const { return viewctl->GetCursor(); } + private: void OnSize(wxSizeEvent& event); - void OnTimer(wxTimerEvent& event); void DoSize(wxSize); @@ -72,9 +97,6 @@ class WXPlaneVRAMPanel : public wxPanel WXScrollBar *hscroll {}; WXBitmapPanel *corner {}; // 右下の空き地 - // タイマー - wxTimer timer {}; - // イベントテーブル wxDECLARE_EVENT_TABLE(); }; @@ -85,8 +107,7 @@ class WXPlaneVRAMWindow : public WXSubWi using inherited = WXSubWindow; public: - // コントロールパネルに表示するプレーン数 - static const int NPLANES = 4; + static const int MAX_PLANES = 8; public: WXPlaneVRAMWindow(wxWindow *parent, const wxString& name); @@ -94,6 +115,9 @@ class WXPlaneVRAMWindow : public WXSubWi void FontChanged() override; + // ステータスパネル + WXTextScreen *statuspanel {}; + private: void OnPlane(wxCommandEvent& event); void DoPlane(int plane, bool value); @@ -102,15 +126,22 @@ class WXPlaneVRAMWindow : public WXSubWi void OnScale(wxCommandEvent& event); void DoScale(int value); + void OnTimer(wxTimerEvent& event); + // コントロールパネル - WXBitmapPanel *ctrlpanel {}; - std::array planesw {}; + wxPanel *ctrlpanel {}; + std::vector planesw {}; wxCheckBox *applysw {}; wxChoice *scalesw {}; // グラフィックパネル WXPlaneVRAMPanel *viewpanel {}; + // タイマー + wxTimer timer {}; + + PlaneVRAMDevice *planevram {}; + // イベントテーブル wxDECLARE_EVENT_TABLE(); @@ -119,7 +150,7 @@ class WXPlaneVRAMWindow : public WXSubWi // タイプだが、このウィンドウを閉じてまた開くとさっきの状態が継続して // いてほしいので、ここでその状況を真似する。 // ただしこっちはあくまで補助用で、コントロールの値のほうが一次情報。 - static std::array sticky_plane; + static std::array sticky_plane; static bool sticky_apply; static int sticky_scale;