--- nono/wx/wxstatuspanel.h 2026/04/29 17:05:16 1.1.1.6 +++ nono/wx/wxstatuspanel.h 2026/04/29 17:05:27 1.1.1.9 @@ -12,107 +12,22 @@ #include "wxtextpanel.h" #include "fdd.h" -#include "scsibus.h" #include -class HostNetDevice; class Indicator; -class NewsCtlrDevice; class PowerDevice; class Syncer; +class Status; class WXStatusPanel; -// インジケータ情報 (ほぼ構造体) -class Indicator -{ - public: - // インジケータの識別子 - enum { - NONE = 0, - PERF, - POWER, - SCSI0, - SCSI1, - SCSI2, - SCSI3, - SCSI4, - SCSI5, - SCSI6, - SCSI7, - LAN, - FDD0, - FDD1, - FDD2, - FDD3, - NEWSLED1, - NEWSLED2, - }; - protected: - using dispfunc_t = void (WXStatusPanel::*)(const Indicator *); - using eventfunc_t = void (WXStatusPanel::*)(const Indicator *); - public: - Indicator() { } - Indicator(int id_, int minlen_, dispfunc_t draw_) { - id = id_; - minlen = minlen_; - draw = draw_; - } - Indicator(int id_, int minlen_, dispfunc_t draw_, const std::string& text_) - : Indicator(id_, minlen_, draw_) - { - text = text_; - } - virtual ~Indicator() = default; - - // インジケータ識別子 - int id {}; - - // 枠内の最小文字列長。 - // 枠の大きさはこの文字列長と text.length() の長いほうで描画される。 - int minlen {}; - - // 表示する文字列。 - std::string text {}; - - // 描画関数 (必須) - dispfunc_t draw {}; - - // ダブルクリックの処理関数 (必要なら) - eventfunc_t dclick {}; - - // コンテキストメニューの処理関数 (必要なら) - eventfunc_t contextmenu {}; - - // 対応するデバイス (必要なら) - Device *dev {}; - - // ToolTip を表示するためのダミーパネル - wxPanel *panel {}; - - // 枠の位置と大きさは panel.GetRect() で取得できる (実行時に計算する) - Rect rect {}; - - public: - // SCSI なら SCSI ID を返す。そうでなければ -1 を返す。 - int GetSCSIID() const; - - // FDD ならユニット番号を返す。そうでなければ -1 を返す。 - int GetFDUnit() const; -}; - // ステータスパネル class WXStatusPanel : public WXTextPanel { using inherited = WXTextPanel; - struct FDstat { - bool loaded {}; - FDDDevice::LED access_led {}; - bool eject_led {}; - }; public: - WXStatusPanel(wxWindow *parent); - virtual ~WXStatusPanel() override; + explicit WXStatusPanel(wxWindow *parent); + ~WXStatusPanel() override; void FontChanged() override; @@ -133,6 +48,7 @@ class WXStatusPanel : public WXTextPanel void 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 *); @@ -143,34 +59,19 @@ class WXStatusPanel : public WXTextPanel void ContextMenuCD(const Indicator *); void ContextMenuFD(const Indicator *); + // 状態 + std::vector stats {}; + // インジケータ情報 std::vector indicators {}; // インジケータ表示用 - PowerDevice *power {}; bool ispower {}; bool powerled {}; - Syncer *syncer {}; - 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 {}; - std::vector fdd_vector {}; // 存在するドライブのリスト - std::array fdstat {}; // こっちは穴空き配列 - NewsCtlrDevice *newsctlr {}; - int newsled {}; + uint perf_mode {}; + uint perf_rate {}; + std::array scsi_loaded {}; + std::array fd_loaded {}; // 丸いアクセスマーク (X68k FD 用) std::unique_ptr accmark /*{}*/; @@ -178,6 +79,9 @@ class WXStatusPanel : public WXTextPanel // 背景再描画 bool refresh_background {}; + PowerDevice *power {}; + Syncer *syncer {}; + // タイマー wxTimer timer {};