From de0de6ae5a9f6d9d422ff804cc3e346573efe9cf Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Tue, 29 Oct 2024 14:53:27 +0100 Subject: [PATCH 1/2] Revert "Wrap long status messages in progress dialog" This reverts commit 88cc98df9c3f12705f52a4046836366e9972dcce. --- src/dialog_progress.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/dialog_progress.cpp b/src/dialog_progress.cpp index 5914b0cf01..bcf4de96d6 100644 --- a/src/dialog_progress.cpp +++ b/src/dialog_progress.cpp @@ -79,15 +79,11 @@ class DialogProgressSink final : public agi::ProgressSink { DialogProgressSink(DialogProgress *dialog) : dialog(dialog) { } void SetTitle(std::string const& title) override { - Main().Async([=]{ dialog->title->SetLabelText(to_wx(title)); dialog->Layout(); }); + Main().Async([=]{ dialog->title->SetLabelText(to_wx(title)); }); } void SetMessage(std::string const& msg) override { - Main().Async([=]{ - dialog->text->SetLabelText(to_wx(msg)); - dialog->text->Wrap(dialog->GetMinWidth()); - dialog->Fit(); - }); + Main().Async([=]{ dialog->text->SetLabelText(to_wx(msg)); }); } void SetProgress(int64_t cur, int64_t max) override { @@ -121,7 +117,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); + text = new wxStaticText(this, -1, message, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE | wxST_NO_AUTORESIZE); cancel_button = new wxButton(this, wxID_CANCEL); log_output = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxSize(600, 240), wxTE_MULTILINE | wxTE_READONLY); From b78088dc3187d87c6c7e75a91af1af4e72436a9f Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Tue, 29 Oct 2024 15:40:15 +0100 Subject: [PATCH 2/2] 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);