Skip to content

Commit

Permalink
Wrap long status messages in progress dialog
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
arch1t3cht committed Oct 29, 2024
1 parent de0de6a commit b78088d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/dialog_progress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit b78088d

Please sign in to comment.