--- nono/wx/wxstatuspanel.h 2026/04/29 17:05:08 1.1.1.4 +++ nono/wx/wxstatuspanel.h 2026/04/29 17:05:44 1.1.1.10 @@ -11,121 +11,85 @@ #pragma once #include "wxtextpanel.h" -#include "scsibus.h" +#include "fdd.h" +#include class Indicator; -class HostNetDevice; +class PowerDevice; +class Syncer; +class Status; class WXStatusPanel; -// インジケータ情報 (基本クラス) -// クラス継承の構造をとっているが、基本的には (関数ポインタを持つ) 構造体 -// テイストで扱うほうがここでは都合がよさそう。 -class Indicator -{ - protected: - using dispfunc_t = void (WXStatusPanel::*)(const Indicator *); - using eventfunc_t = void (WXStatusPanel::*)(const Indicator *); - public: - Indicator() { } - Indicator(const std::string& text_, dispfunc_t draw_) { - text = text_; - draw = draw_; - } - virtual ~Indicator() = default; - - // 表示する文字列。 - // 描画関数はこの文字列を使っても使わなくてもよいが、InitIndicators() が - // この文字数に応じた大きさの枠を用意するため、使わない場合でも文字数 - // だけは揃えておくこと。 - std::string text {}; - - // 描画関数 (必須) - dispfunc_t draw {}; - - // ダブルクリックの処理関数 (必要なら) - eventfunc_t dclick {}; - - // 枠の位置と大きさは panel.GetRect() で取得できる (実行時に計算する) - Rect rect {}; -}; - -// インジケータ情報 (SCSI) -class SCSIIndicator : public Indicator -{ - using inherited = Indicator; - public: - // SCSI ID - int GetId() const { return id; } - int id {}; - - // 対応するデバイス - SCSIDevice *dev {}; - - // ToolTip を表示するためのダミーパネル - wxPanel *panel {}; - - // コンテキストメニューの処理関数 (必要なら) - eventfunc_t contextmenu {}; -}; - // ステータスパネル class WXStatusPanel : public WXTextPanel { using inherited = WXTextPanel; + public: - WXStatusPanel(wxWindow *parent); - virtual ~WXStatusPanel() override; + explicit WXStatusPanel(wxWindow *parent); + ~WXStatusPanel() override; void FontChanged() override; + void Fit() override; + bool Layout() override; private: void OnClose(wxCloseEvent&); void OnShow(wxShowEvent&); - void OnSize(wxSizeEvent&); void OnTimer(wxTimerEvent&); void OnLeftDClick(wxMouseEvent&); void OnContextMenu(wxContextMenuEvent&); void OnSCSIMediaChanged(wxCommandEvent&); + void OnFDDMediaChanged(wxCommandEvent&); + void OnLEDChanged(wxCommandEvent&); bool UpdateStat(); void Draw() override; void InitIndicators(); - void LayoutIndicators(); + wxSize LayoutIndicators(); void DrawPerf(const Indicator *); void DrawSCSI(const Indicator *); + void DrawVBlk(const Indicator *); void DrawNet(const Indicator *); + void DrawFD(const Indicator *); + void DrawNewsLED1(const Indicator *); + void DrawNewsLED2(const Indicator *); void DrawPower(const Indicator *); void DrawTextLED(const Indicator *, Color fg, Color bg); void DClickPerf(const Indicator *); void ContextMenuCD(const Indicator *); + void ContextMenuFD(const Indicator *); + + // 状態 + std::vector stats {}; // インジケータ情報 std::vector indicators {}; // インジケータ表示用 bool ispower {}; - int perf_mode {}; - int perf_rate {}; - std::shared_ptr scsibus {}; - uint8 scsi_bsy {}; - bool scsi_out {}; - uint8 scsi_loaded {}; - enum { - NOT_AVAILABLE = -1, // 存在しない (Nereid なし X68k とか) - DISABLE = 0, // 存在してホスト側が無効 (driver = none) - ENABLE = 1, // 存在してホスト側が有効 - } net_ok {}; - HostNetDevice *hostnet {}; - uint64 net_tx_pkts {}; - uint64 net_rx_pkts {}; - bool net_tx_active {}; - bool net_rx_active {}; + bool powerled {}; + uint perf_mode {}; + uint perf_rate {}; + std::array scsi_loaded {}; + std::array fd_loaded {}; + + // 丸いアクセスマーク (X68k FD 用) + std::unique_ptr accmark /*{}*/; + + // 背景再描画 + bool refresh_background {}; + + PowerDevice *power {}; + Syncer *syncer {}; // タイマー wxTimer timer {}; // イベントテーブル wxDECLARE_EVENT_TABLE(); -}; -extern WXStatusPanel *gStatusPanel; + static const uint8 AccessMark12[]; + static const uint8 AccessMark16[]; + static const uint8 AccessMark24[]; +};