Skip to content

Commit

Permalink
[fix] レイアウト調整
Browse files Browse the repository at this point in the history
選択肢の効果の余白が初期と設定変更後でずれる問題を修正
  • Loading branch information
Cilda committed Oct 6, 2024
1 parent 07bbec9 commit 86b6df5
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
4 changes: 2 additions & 2 deletions UmaUmaChecker/src/UI/MainFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
}
Expand Down
4 changes: 2 additions & 2 deletions UmaUmaChecker/src/UI/MainFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ class MainFrame : public ThemedWindowWrapper<wxFrame>
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);
Expand Down
24 changes: 12 additions & 12 deletions UmaUmaChecker/src/UI/wxUmaTextCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions UmaUmaChecker/src/UI/wxUmaTextCtrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 86b6df5

Please sign in to comment.