--- nono/wx/wxdumpmonitor.cpp 2026/04/29 17:05:44 1.1.1.16 +++ nono/wx/wxdumpmonitor.cpp 2026/04/29 17:05:48 1.1.1.17 @@ -141,6 +141,9 @@ WXMemdumpWindow::WXMemdumpWindow(wxWindo SetSizer(topsizer); + // 自前レイアウト。 + SetMyLayout(); + // ウィンドウサイズを確定させる FontChanged(); @@ -196,49 +199,9 @@ WXMemdumpWindow::FontChanged() Fit(); } -void -WXMemdumpWindow::Fit() -{ - // inherited::Fit() は呼ばずに自力で行う。 - - wxSize newsize = DoSizeHints(); - SetClientSize(newsize); -} - bool -WXMemdumpWindow::Layout() -{ - // wxmonitor.cpp の WXScrollMonitorWindow::Layout() のコメント参照。 - wxSize client = GetClientSize(); - const wxSize win = GetSize(); - const wxSize margin = win - client; - const wxSize ctrlsize = ctrlbox->GetSize(); - const wxSize monsize = screen->GetSize(); - - if (oldmargin != margin) { - layout_pass2 = true; - oldmargin = margin; - CallAfter([this]() { - DoSizeHints(); - }); - return true; - } else if (layout_pass2) { - layout_pass2 = false; - client.y = ctrlsize.y + monsize.y; - SetClientSize(client); - Hide(); - Show(); - return true; - } - - // Sizer 使ってるのでその処理は任せる。 - return inherited::Layout(); -} - -// クライアントサイズと最大/最小サイズを計算する。 -// SetSizeHints() を実行し、設定すべきクライアントサイズを返す。 -wxSize -WXMemdumpWindow::DoSizeHints() +WXMemdumpWindow::GetMySizeHints(wxSize *newp, wxSize *minp, wxSize *maxp, + wxSize *incp) { // この後の Fit() でリサイズに使われる大きさを取得。 wxSize fitsize = GetSizer()->ComputeFittingClientSize(this); @@ -247,13 +210,26 @@ WXMemdumpWindow::DoSizeHints() // 高さの最小は (コントロールパネル分と) TextScreen 1行分にしておく。 int min_y = ctrlsize.y + screen->GetScreenHeight(1); int new_y = ctrlsize.y + screen->GetSize().y; + wxSize newsize(fitsize.x, new_y); wxSize minsize(fitsize.x, min_y); wxSize maxsize(fitsize.x, GetMaxClientSize().y); wxSize incsize(0, screen->GetFontHeight()); - SetSizeHints(ClientToWindowSize(minsize), ClientToWindowSize(maxsize), - incsize); - return wxSize(fitsize.x, new_y); + if (newp) *newp = newsize; + if (minp) *minp = minsize; + if (maxp) *maxp = maxsize; + if (incp) *incp = incsize; + return true; +} + +bool +WXMemdumpWindow::Layout() +{ + if (MyLayout() == false) { + // Sizer 使ってるのでその処理は(さらに親に)任せる。 + BaseLayout(); + } + return true; } // テキスト入力イベント