From b78088dc3187d87c6c7e75a91af1af4e72436a9f Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Tue, 29 Oct 2024 15:40:15 +0100 Subject: [PATCH] Wrap long status messages in progress dialog I'm still fighting wxWidgets so I don't know if this is the best solution, but at least it works in all cases now. --- src/dialog_progress.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/dialog_progress.cpp b/src/dialog_progress.cpp index bcf4de96d6..ef9a2dcbef 100644 --- a/src/dialog_progress.cpp +++ b/src/dialog_progress.cpp @@ -83,7 +83,13 @@ class DialogProgressSink final : public agi::ProgressSink { } void SetMessage(std::string const& msg) override { - Main().Async([=]{ dialog->text->SetLabelText(to_wx(msg)); }); + Main().Async([=]{ + dialog->text->SetLabelText(to_wx(msg)); + dialog->text->Wrap(dialog->GetMinWidth()); + dialog->text->CenterOnParent(); + dialog->Fit(); + dialog->Layout(); + }); } void SetProgress(int64_t cur, int64_t max) override { @@ -117,7 +123,7 @@ DialogProgress::DialogProgress(wxWindow *parent, wxString const& title_text, wxS { title = new wxStaticText(this, -1, title_text, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE | wxST_NO_AUTORESIZE); gauge = new wxGauge(this, -1, 300, wxDefaultPosition, wxSize(300,20)); - text = new wxStaticText(this, -1, message, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE | wxST_NO_AUTORESIZE); + text = new wxStaticText(this, -1, message, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE); cancel_button = new wxButton(this, wxID_CANCEL); log_output = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxSize(600, 240), wxTE_MULTILINE | wxTE_READONLY);