--- nono/wx/wxlogmonitor.h 2026/04/29 17:04:36 1.1.1.2 +++ nono/wx/wxlogmonitor.h 2026/04/29 17:05:48 1.1.1.12 @@ -4,47 +4,65 @@ // Licensed under nono-license.txt // +// +// ログモニター +// + #pragma once #include "wxsubwindow.h" -#include "wxtextscreen.h" +#include "wxscrollbar.h" +#include "wxmonitor.h" -class WXLogMonitor : public WXSubWindow -{ - using inherited = WXSubWindow; +class Logger; +class WXLogMonitor; +// モニター部分 +class LogMonitorPanel : public WXMonitorPanel +{ + using inherited = WXMonitorPanel; public: - WXLogMonitor(wxWindow *, wxWindowID); - virtual ~WXLogMonitor(); + LogMonitorPanel(WXLogMonitor *parent_, Monitor *monitor_); + ~LogMonitorPanel() override; - virtual void SetFontSize(fontsize_t fontsize); + void DoRefresh() override; private: - void OnTimer(wxTimerEvent& event); + WXLogMonitor *parent {}; +}; - void Append(const char *); +// ログウィンドウ +class WXLogMonitor : public WXSubWindow +{ + using inherited = WXSubWindow; + friend class LogMonitor; - // テキストスクリーンコントロール - WXTextScreen *screen = NULL; + public: + explicit WXLogMonitor(wxWindow *); + ~WXLogMonitor() override; - // テキストスクリーン - TextScreen text; + void FontChanged() override; + bool Layout() override; + + // スクロールバー再設定 + void SetScroll(); + + private: + bool GetMySizeHints(wxSize *, wxSize *, wxSize *, wxSize *) override; - int col = 0; - int row = 0; + // マウスホイールイベント + void OnMouseWheel(wxMouseEvent&); - // ログバッファ - // ここは属性フィールドを持たないテキストによる循環バッファ - std::unique_ptr logbuf {}; + // スクロールイベント + void OnScroll(wxScrollEvent&); - // 書き込み位置 - int target = 0; + // スクロール処理 + void DoScroll(int pos); - // UTF-8 -> CP932 変換 - wxCSConv conv { "CP932" }; + LogMonitorPanel *screen {}; - wxTimer timer; + // スクロールバー + WXScrollBar *vscroll {}; - // イベントテーブル - wxDECLARE_EVENT_TABLE(); + Logger *logger {}; };