diff --git a/UmaUmaChecker/src/UI/MainFrame.cpp b/UmaUmaChecker/src/UI/MainFrame.cpp index 7fe6452..2ed8078 100644 --- a/UmaUmaChecker/src/UI/MainFrame.cpp +++ b/UmaUmaChecker/src/UI/MainFrame.cpp @@ -141,6 +141,7 @@ MainFrame::MainFrame(wxWindow* parent, const wxPoint& pos, const wxSize& size, l m_statusBar->PushStatusText(wxT("CPU: 100.0%"), 0); m_statusBar->PushStatusText(wxT("MEM: 0.0 MB"), 1); m_statusBar->PushStatusText(_("umamusume: Not detected"), 2); + if (!config->IsShowStatusBar) m_statusBar->Hide(); this->SetStatusBar(m_statusBar); m_comboPopup = new wxComboBoxPopup(this); @@ -179,8 +180,7 @@ MainFrame::MainFrame(wxWindow* parent, const wxPoint& pos, const wxSize& size, l this->Move(config->WindowX, config->WindowY); } - if (!config->IsShowStatusBar) m_statusBar->Hide(); - else timer.Start(1000); + if (config->IsShowStatusBar) timer.Start(1000); Init(); } diff --git a/UmaUmaChecker/src/UI/MainFrame.h b/UmaUmaChecker/src/UI/MainFrame.h index 26e4a56..a1676a4 100644 --- a/UmaUmaChecker/src/UI/MainFrame.h +++ b/UmaUmaChecker/src/UI/MainFrame.h @@ -47,8 +47,8 @@ class MainFrame : public ThemedWindowWrapper void AddToSystemMenu(); void OnClose(wxCloseEvent& event); - void OnSize(wxSizeEvent& event); - void OnSizing(wxSizeEvent& event); + //void OnSize(wxSizeEvent& event); + //void OnSizing(wxSizeEvent& event); void OnClickStart(wxCommandEvent& event); void OnClickScreenShot(wxCommandEvent& event); void OnRightClickScreenShot(wxMouseEvent& event); diff --git a/UmaUmaChecker/src/UI/wxUmaTextCtrl.cpp b/UmaUmaChecker/src/UI/wxUmaTextCtrl.cpp index 901f450..181faa7 100644 --- a/UmaUmaChecker/src/UI/wxUmaTextCtrl.cpp +++ b/UmaUmaChecker/src/UI/wxUmaTextCtrl.cpp @@ -7,16 +7,13 @@ wxUmaTextCtrl::wxUmaTextCtrl(wxWindow* parent, int line): wxTextCtrl(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxTE_RICH2 | wxTE_MULTILINE | wxTE_NO_VSCROLL | wxTE_DONTWRAP) { - Line = line; - DWORD dwOptions = SendMessage(this->GetHWND(), EM_GETLANGOPTIONS, 0, 0); dwOptions &= ~IMF_AUTOFONT; dwOptions |= IMF_UIFONTS; SendMessage(this->GetHWND(), EM_SETLANGOPTIONS, 0, (LPARAM)dwOptions); SendMessage(this->GetHWND(), EM_SHOWSCROLLBAR, SB_HORZ, FALSE); - SetHeightByLine(Line); - SetValue("+1\n2\n3\n4\n5\n6"); + SetHeightByLine(line); this->Refresh(); } @@ -128,17 +125,20 @@ bool wxUmaTextCtrl::SetFont(const wxFont& font) void wxUmaTextCtrl::SetHeightByLine(int line) { + if (Line == line) return; + Line = line; - wxClientDC dc(this); - wxTextAttr attr = this->GetDefaultStyle(); - wxFontMetrics metrics = dc.GetFontMetrics(); + wxSize size = wxSize(-1, GetHeightByLine(Line)); - wxSize size = wxSize(-1, metrics.height * line); - //this->SetMinClientSize(size); - - this->SetClientSize(size); - this->SetMaxClientSize(size); + this->SetMinClientSize(size); + + this->InvalidateBestSize(); +} + +wxSize wxUmaTextCtrl::DoGetBestClientSize() const +{ + return wxSize(-1, GetHeightByLine(Line)); } int wxUmaTextCtrl::GetHeightByLine(int line) const diff --git a/UmaUmaChecker/src/UI/wxUmaTextCtrl.h b/UmaUmaChecker/src/UI/wxUmaTextCtrl.h index 3d30048..6fffc3f 100644 --- a/UmaUmaChecker/src/UI/wxUmaTextCtrl.h +++ b/UmaUmaChecker/src/UI/wxUmaTextCtrl.h @@ -14,6 +14,9 @@ class wxUmaTextCtrl : public wxTextCtrl virtual bool SetFont(const wxFont& font); void SetHeightByLine(int line); +protected: + wxSize DoGetBestClientSize() const override; + private: int GetHeightByLine(int line) const;