From 88d5e0f10a83da393361d1626b474f091b3ef0f5 Mon Sep 17 00:00:00 2001 From: Richard Powell Date: Sun, 15 Mar 2026 21:30:13 -0700 Subject: [PATCH 1/2] Issue #823: Update wxUI to 0.4.0 --- LATEST_RELEASE_NOTES.md | 1 + cmake/dependencies.cmake | 2 +- src/AnimationErrorsPanel.cpp | 7 ++++--- src/AnimationErrorsPanel.h | 2 +- src/ConfigurationDebugDialog.cpp | 5 +++-- src/ContinuityBrowser.cpp | 13 +++++++------ src/ContinuityComposerDialog.cpp | 12 +++++++----- src/HelpDialog.cpp | 19 ++++++++++--------- src/HelpDialog.hpp | 2 +- src/ModeSetupDialog.cpp | 4 ++-- src/ModeSetupDialog.h | 2 +- src/PreferencesPrintContinuitySetup.cpp | 4 ++-- src/PreferencesPrintContinuitySetup.h | 4 ++-- src/PreferencesPrintingSetup.cpp | 5 +++-- src/PreferencesPrintingSetup.hpp | 2 +- src/PrintContinuityEditor.cpp | 4 ++-- src/PrintContinuityEditor.h | 4 ++-- src/SetupInstruments.cpp | 18 ++++++++---------- src/StackDrawPlayground.cpp | 8 ++++---- src/StackDrawPlayground.h | 4 ++-- 20 files changed, 64 insertions(+), 58 deletions(-) diff --git a/LATEST_RELEASE_NOTES.md b/LATEST_RELEASE_NOTES.md index 91e008a1..d5fd3bda 100644 --- a/LATEST_RELEASE_NOTES.md +++ b/LATEST_RELEASE_NOTES.md @@ -12,4 +12,5 @@ Other changes: * [#812](../../issues/812) Make it easier to read xbm files. * [#814](../../issues/814) Add the ability to dump when the beats occur with calchart_tool * [#815](../../issues/815) We can probably improve the way animation panel timer works by using one-shot +* [#823](../../issues/823) Update wxUI to 0.4.0 diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index a196fc52..e51c25c7 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -75,7 +75,7 @@ FetchContent_MakeAvailable(docopt) FetchContent_Declare( wxUI GIT_REPOSITORY https://github.com/rmpowell77/wxUI.git - GIT_TAG aea5c52fb5d5525c2770954574acacaae24f9b3b # v0.2.2 + GIT_TAG 1b2cf2ca7db7c22474b43c3eca01563ffd91e832 # v0.4.0 ) FetchContent_MakeAvailable(wxUI) diff --git a/src/AnimationErrorsPanel.cpp b/src/AnimationErrorsPanel.cpp index 1780a628..febd9c3c 100644 --- a/src/AnimationErrorsPanel.cpp +++ b/src/AnimationErrorsPanel.cpp @@ -51,7 +51,7 @@ void AnimationErrorsPanel::CreateControls() // create a sizer and populate wxUI::VSizer{ ExpandSizerFlags(), - mTreeCtrl = wxUI::Generic{ [](wxWindow* window) { + wxUI::Factory{ [](wxWindow* window) { auto* treeList = new wxTreeListCtrl(window, wxID_ANY, wxDefaultPosition, wxDefaultSize); treeList->AppendColumn("Errors", wxCOL_WIDTH_AUTOSIZE, wxALIGN_LEFT, wxCOL_RESIZABLE | wxCOL_SORTABLE); wxSize iconSize = wxArtProvider::GetSizeHint(wxART_LIST); @@ -62,8 +62,9 @@ void AnimationErrorsPanel::CreateControls() imageList->Add(wxArtProvider::GetIcon(wxART_ERROR, wxART_LIST, iconSize)); treeList->SetImageList(imageList); return treeList; - } } - }.fitTo(this); + } }.withProxy(mTreeCtrl), + } + .fitTo(this); } void AnimationErrorsPanel::OnUpdate() diff --git a/src/AnimationErrorsPanel.h b/src/AnimationErrorsPanel.h index cb3ab7fc..fbd6dae3 100644 --- a/src/AnimationErrorsPanel.h +++ b/src/AnimationErrorsPanel.h @@ -54,7 +54,7 @@ class AnimationErrorsPanel : public wxPanel { void UpdateErrors(std::vector const& errors, std::map const& collisions); CalChartView* mView{}; - wxUI::Generic::Proxy mTreeCtrl{}; + wxUI::Factory::Proxy mTreeCtrl{}; std::vector mCurrentErrors{}; std::map> mErrorLookup{}; }; diff --git a/src/ConfigurationDebugDialog.cpp b/src/ConfigurationDebugDialog.cpp index 4ff87252..ace8d781 100644 --- a/src/ConfigurationDebugDialog.cpp +++ b/src/ConfigurationDebugDialog.cpp @@ -211,7 +211,7 @@ ConfigurationDebug::ConfigurationDebug(wxWindow* parent, wxConfigBase* config) std::cout << mConfig << "\n"; wxUI::VSizer{ BasicSizerFlags(), - mTreeCtrl = wxUI::Generic{ + wxUI::Generic{ ExpandSizerFlags(), [this] { auto* tree = new wxTreeListCtrl(this, wxID_ANY, wxDefaultPosition, { 400, 400 }); @@ -226,7 +226,8 @@ ConfigurationDebug::ConfigurationDebug(wxWindow* parent, wxConfigBase* config) wxCOL_RESIZABLE | wxCOL_SORTABLE); ConstructConfig(mConfig, *tree); return tree; - }() }, + }() } + .withProxy(mTreeCtrl), wxUI::HSizer{ wxUI::Button{ wxID_OK }, } diff --git a/src/ContinuityBrowser.cpp b/src/ContinuityBrowser.cpp index 5f5f28e8..5843d092 100644 --- a/src/ContinuityBrowser.cpp +++ b/src/ContinuityBrowser.cpp @@ -55,7 +55,7 @@ class ContinuityBrowserPerCont : public wxPanel { // Internals CalChartView* mView{}; - wxUI::Generic::Proxy mCanvas{}; + wxUI::Factory::Proxy mCanvas{}; CalChart::SYMBOL_TYPE mSym{}; }; @@ -81,11 +81,12 @@ void ContinuityBrowserPerCont::CreateControls(CalChart::Configuration const& con }) .withFlags(BasicSizerFlags()) }, // here's a canvas - mCanvas = wxUI::Generic{ + wxUI::Factory{ ExpandSizerFlags(), [this, &config](wxWindow* parent) { return new ContinuityBrowserPanel(mSym, config, parent); - } }, + } } + .withProxy(mCanvas), } .fitTo(this); } @@ -124,17 +125,17 @@ void ContinuityBrowser::CreateControls(CalChart::Configuration const& config) { wxUI::VSizer{ wxUI::Line{}.withStyle(wxLI_HORIZONTAL), - wxUI::ForEach{ + wxUI::VForEach( wxSizerFlags{ 1 }.Border(wxALL, 2).Expand(), CalChart::k_symbols, - [this, &config](auto eachcont) { return wxUI::Generic{ + [this, &config](auto eachcont) { return wxUI::Factory{ [this, eachcont, &config](wxWindow* parent) { auto perCont = new ContinuityBrowserPerCont(parent, eachcont, config); perCont->Show(false); mPerCont.push_back(perCont); return perCont; } - }; } }, + }; }), wxUI::HSizer{ wxUI::Button{ wxID_HELP, "&Help" } diff --git a/src/ContinuityComposerDialog.cpp b/src/ContinuityComposerDialog.cpp index 1ff53c0f..6da270bc 100644 --- a/src/ContinuityComposerDialog.cpp +++ b/src/ContinuityComposerDialog.cpp @@ -86,7 +86,7 @@ class ContinuityComposerPanel : public wxPanel { std::unique_ptr mCont; CalChart::Cont::Drawable mDrawableCont; - wxUI::Generic::Proxy mCanvas{}; + wxUI::Factory::Proxy mCanvas{}; wxUI::ComboBox::Proxy mComboSelection{}; CalChart::Cont::Token const* mCurrentSelected = nullptr; CalChart::Cont::Token* mCurrentParent = nullptr; @@ -146,12 +146,13 @@ void ContinuityComposerPanel::Init() void ContinuityComposerPanel::CreateControls() { wxUI::VSizer{ - mCanvas = wxUI::Generic{ + wxUI::Factory{ wxSizerFlags(1).Expand(), [this](wxWindow* parent) { return new ContinuityComposerCanvas(mConfig, parent); }, - }, + } + .withProxy(mCanvas), wxUI::ComboBox{}.withStyle(wxTE_PROCESS_ENTER).bind(wxEVT_TEXT_ENTER, [this](auto const& event) { OnCmdTextEnterKeyPressed(event); }) @@ -678,9 +679,10 @@ ContinuityComposerDialog::ContinuityComposerDialog(std::unique_ptr{ + wxUI::Generic{ wxSizerFlags{ 0 }.Expand().Border(wxALL, 5), - panel }, + panel } + .withProxy(mPanel), wxUI::VSizer{ sRightBasicSizerFlags, wxUI::HSizer{ diff --git a/src/HelpDialog.cpp b/src/HelpDialog.cpp index a2383a92..7218ca57 100644 --- a/src/HelpDialog.cpp +++ b/src/HelpDialog.cpp @@ -57,7 +57,7 @@ HelpDialog::HelpDialog(wxWindow* parent, HelpManager& helpManager) .bind(wxEVT_TEXT_ENTER, [this](auto const& event) { OnSearchEnter(const_cast(event)); }), }, // WebView for displaying help content - mWebView = wxUI::Generic{ + wxUI::Factory{ wxSizerFlags(1).Expand(), [this](wxWindow* parent) { auto* webView = wxWebView::New(parent, wxID_ANY); @@ -67,7 +67,8 @@ HelpDialog::HelpDialog(wxWindow* parent, HelpManager& helpManager) webView->Bind(wxEVT_WEBVIEW_LOADED, &HelpDialog::OnWebViewLoaded, this); return webView; }, - }, + } + .withProxy(mWebView), } .fitTo(this); @@ -101,7 +102,7 @@ void HelpDialog::LoadTopic(const std::string& topicId) // Get the file path for the topic std::string filePath = mHelpManager.GetHelpTopicPath(topicId); - + if (filePath.empty()) { wxLogWarning("Could not find file path for topic: %s", topicId); // Fallback to SetPage with error message @@ -110,9 +111,9 @@ void HelpDialog::LoadTopic(const std::string& topicId) // Convert file path to file:// URL wxString fileUrl = "file:///" + wxString(filePath); fileUrl.Replace("\\", "/"); - + wxLogInfo("LoadTopic: topicId='%s', loading URL='%s'", topicId, fileUrl); - + // Use LoadURL instead of SetPage - more reliable on Windows mWebView->LoadURL(fileUrl); } @@ -133,9 +134,9 @@ void HelpDialog::OnBack(wxCommandEvent&) // Get and display the previous topic std::string topicId = mBackStack.top(); mBackStack.pop(); - + mCurrentTopicId = topicId; - + std::string filePath = mHelpManager.GetHelpTopicPath(topicId); if (!filePath.empty()) { wxString fileUrl = "file:///" + wxString(filePath); @@ -159,9 +160,9 @@ void HelpDialog::OnForward(wxCommandEvent&) // Get and display the next topic std::string topicId = mForwardStack.top(); mForwardStack.pop(); - + mCurrentTopicId = topicId; - + std::string filePath = mHelpManager.GetHelpTopicPath(topicId); if (!filePath.empty()) { wxString fileUrl = "file:///" + wxString(filePath); diff --git a/src/HelpDialog.hpp b/src/HelpDialog.hpp index 6baa52c9..30acd10d 100644 --- a/src/HelpDialog.hpp +++ b/src/HelpDialog.hpp @@ -97,7 +97,7 @@ class HelpDialog : public wxFrame { // Member variables HelpManager& mHelpManager; - wxUI::Generic::Proxy mWebView{}; + wxUI::Factory::Proxy mWebView{}; wxUI::TextCtrl::Proxy mSearchBox{}; wxUI::Button::Proxy mBackButton{}; wxUI::Button::Proxy mForwardButton{}; diff --git a/src/ModeSetupDialog.cpp b/src/ModeSetupDialog.cpp index 1ab0b549..cda5d3bd 100644 --- a/src/ModeSetupDialog.cpp +++ b/src/ModeSetupDialog.cpp @@ -251,9 +251,9 @@ ModeSetupDialog::ModeSetupDialog(wxWindow* parent, CalChart::ShowMode const& cur { wxUI::VSizer{ BasicSizerFlags(), - m_setup = [current_mode, &config](wxWindow* parent) { + wxUI::Factory{ [current_mode, &config](wxWindow* parent) { return ShowModeDialogSetup::CreateDialog(parent, current_mode, config); - }, + } }.withProxy(m_setup), wxUI::HSizer{ wxUI::Button{ wxID_CANCEL }, wxUI::Button{ wxID_OK }, diff --git a/src/ModeSetupDialog.h b/src/ModeSetupDialog.h index 19858023..60de1323 100644 --- a/src/ModeSetupDialog.h +++ b/src/ModeSetupDialog.h @@ -42,5 +42,5 @@ class ModeSetupDialog : public wxDialog { CalChart::ShowMode GetShowMode() const; private: - wxUI::Generic::Proxy m_setup; + wxUI::Factory::Proxy m_setup; }; diff --git a/src/PreferencesPrintContinuitySetup.cpp b/src/PreferencesPrintContinuitySetup.cpp index 51f872f5..7ed04852 100644 --- a/src/PreferencesPrintContinuitySetup.cpp +++ b/src/PreferencesPrintContinuitySetup.cpp @@ -101,8 +101,8 @@ void PrintContinuitySetup::CreateControls() .withProxy(mMaxFontSize)), }, wxUI::HSplitter{ - mPrintContDisplay = [this](wxWindow* parent) { return new PrintContinuityPreview(parent, mConfig); }, - mUserInput = [](wxWindow* parent) { return new FancyTextWin(parent, PrintContinuitySetup_KeyPress); } } + wxUI::Factory{ [this](wxWindow* parent) { return new PrintContinuityPreview(parent, mConfig); } }.withProxy(mPrintContDisplay), + wxUI::Factory{ [](wxWindow* parent) { return new FancyTextWin(parent, PrintContinuitySetup_KeyPress); } }.withProxy(mUserInput) } .withStashGravity(0.5) .withFlags(wxSizerFlags{ 1 }.Expand()), } diff --git a/src/PreferencesPrintContinuitySetup.h b/src/PreferencesPrintContinuitySetup.h index fe83a17a..edbae65b 100644 --- a/src/PreferencesPrintContinuitySetup.h +++ b/src/PreferencesPrintContinuitySetup.h @@ -64,8 +64,8 @@ class PrintContinuitySetup : public PreferencePage { auto ClearValuesToDefault() -> bool override; private: - wxUI::Generic::Proxy mUserInput{}; - wxUI::Generic::Proxy mPrintContDisplay{}; + wxUI::Factory::Proxy mUserInput{}; + wxUI::Factory::Proxy mPrintContDisplay{}; wxUI::CheckBox::Proxy mLandscape{}; wxUI::CheckBox::Proxy mUseNewDraw{}; wxUI::TextCtrl::Proxy mDotRatio{}; diff --git a/src/PreferencesPrintingSetup.cpp b/src/PreferencesPrintingSetup.cpp index 4572dbaf..762047b0 100644 --- a/src/PreferencesPrintingSetup.cpp +++ b/src/PreferencesPrintingSetup.cpp @@ -78,9 +78,10 @@ void PrintingSetup::CreateControls() }) .withProxy(mMaxFontSize)), }, - mPrintingDisplay = wxUI::Generic{ + wxUI::Factory{ wxSizerFlags{ 1 }.Expand(), - [this](wxWindow* parent) { return new PrintingPreview(parent, mConfig); } }, + [this](wxWindow* parent) { return new PrintingPreview(parent, mConfig); } } + .withProxy(mPrintingDisplay), } .fitTo(this); diff --git a/src/PreferencesPrintingSetup.hpp b/src/PreferencesPrintingSetup.hpp index 27e107fd..9ed7494c 100644 --- a/src/PreferencesPrintingSetup.hpp +++ b/src/PreferencesPrintingSetup.hpp @@ -65,7 +65,7 @@ class PrintingSetup : public PreferencePage { private: wxUI::Generic::Proxy mUserInput{}; - wxUI::Generic::Proxy mPrintingDisplay{}; + wxUI::Factory::Proxy mPrintingDisplay{}; wxUI::CheckBox::Proxy mLandscape{}; wxUI::TextCtrl::Proxy mDotRatio{}; wxUI::TextCtrl::Proxy mPLineRatio{}; diff --git a/src/PrintContinuityEditor.cpp b/src/PrintContinuityEditor.cpp index 8fabad05..0cd73708 100644 --- a/src/PrintContinuityEditor.cpp +++ b/src/PrintContinuityEditor.cpp @@ -110,8 +110,8 @@ void PrintContinuityEditor::CreateControls() wxUI::Button{ wxID_HELP, "&Help" }, }, wxUI::HSplitter{ - mPrintContDisplay = [this](wxWindow* parent) { return new PrintContinuityPreview(parent, mConfig); }, - mUserInput = [](wxWindow* parent) { return new FancyTextWin(parent, PrintContinuityEditor_KeyPress); } } + wxUI::Factory{ [this](wxWindow* parent) { return new PrintContinuityPreview(parent, mConfig); } }.withProxy(mPrintContDisplay), + wxUI::Factory{ [](wxWindow* parent) { return new FancyTextWin(parent, PrintContinuityEditor_KeyPress); } }.withProxy(mUserInput) } .withStashGravity(0.5) .withFlags(wxSizerFlags{ 1 }.Expand()), } diff --git a/src/PrintContinuityEditor.h b/src/PrintContinuityEditor.h index d842b688..88378b6c 100644 --- a/src/PrintContinuityEditor.h +++ b/src/PrintContinuityEditor.h @@ -91,8 +91,8 @@ class PrintContinuityEditor : public wxPanel { void OnSizeEvent(wxSizeEvent& event); CalChartView* mView{}; - wxUI::Generic::Proxy mUserInput{}; - wxUI::Generic::Proxy mPrintContDisplay{}; + wxUI::Factory::Proxy mUserInput{}; + wxUI::Factory::Proxy mPrintContDisplay{}; wxTimer* mTimer{}; wxString mPreviousText{}; diff --git a/src/SetupInstruments.cpp b/src/SetupInstruments.cpp index dc2a19b9..704905d9 100644 --- a/src/SetupInstruments.cpp +++ b/src/SetupInstruments.cpp @@ -182,16 +182,14 @@ void SetupInstruments::CreateControls() wxUI::Button{ "&None" } .bind([this] { SelectNone(); }), }, - wxUI::HSizer{ - wxUI::ForEach{ - enumerate(GetSymbolsBitmap()) | std::views::filter([this](auto bitmap) { - return std::count(mSymbols.begin(), mSymbols.end(), static_cast(std::get<0>(bitmap))); - }), - [this](auto bitmap) { - return wxUI::BitmapButton{ std::get<1>(bitmap) } - .bind([this, which = static_cast(std::get<0>(bitmap))] { SelectSymbol(which); }); - } }, - }, + wxUI::HForEach( + enumerate(GetSymbolsBitmap()) | std::views::filter([this](auto bitmap) { + return std::count(mSymbols.begin(), mSymbols.end(), static_cast(std::get<0>(bitmap))); + }), + [this](auto bitmap) { + return wxUI::BitmapButton{ std::get<1>(bitmap) } + .bind([this, which = static_cast(std::get<0>(bitmap))] { SelectSymbol(which); }); + }), wxUI::HSizer{ wxUI::Text{ "Select Instrument" }, wxUI::Choice{ std::set(mInstruments.begin(), mInstruments.end()) } diff --git a/src/StackDrawPlayground.cpp b/src/StackDrawPlayground.cpp index aa4f520b..562bfd4d 100644 --- a/src/StackDrawPlayground.cpp +++ b/src/StackDrawPlayground.cpp @@ -301,9 +301,9 @@ StackDrawPlayground::StackDrawPlayground(wxWindow* parent) VSizer{ wxSizerFlags{}.Border(wxALL, 2).Left().Proportion(0), HSplitter{ - mPreview = [](wxWindow* parent) { + wxUI::Factory{ [](wxWindow* parent) { return new StackDrawPreview(parent); - }, + } }.withProxy(mPreview), TextCtrl{}.bind([this] { try { mPreview->SetDrawCommand(ParseString(*mUserInput)); @@ -324,9 +324,9 @@ StackDrawPlayground::StackDrawPlayground(wxWindow* parent) }) .withProxy(mUseOffset) }, Generic{ CreateStdDialogButtonSizer(wxOK) }, - mStatus = Generic{ [](wxWindow* parent) { + Factory{ [](wxWindow* parent) { return new wxStatusBar(parent); - } }, + } }.withProxy(mStatus), } .fitTo(this); diff --git a/src/StackDrawPlayground.h b/src/StackDrawPlayground.h index edbc80b0..02c4bc76 100644 --- a/src/StackDrawPlayground.h +++ b/src/StackDrawPlayground.h @@ -38,6 +38,6 @@ class StackDrawPlayground : public wxDialog { private: wxUI::CheckBox::Proxy mUseOffset{}; wxUI::TextCtrl::Proxy mUserInput{}; - wxUI::Generic::Proxy mPreview{}; - wxUI::Generic::Proxy mStatus{}; + wxUI::Factory::Proxy mPreview{}; + wxUI::Factory::Proxy mStatus{}; }; From 2f2bea5fdb2a09f30a36738d46c90b0abe8092b9 Mon Sep 17 00:00:00 2001 From: Richard Powell Date: Sun, 19 Apr 2026 20:13:12 -0700 Subject: [PATCH 2/2] Does this fix the build --- src/AnimationErrorsPanel.cpp | 2 +- src/HelpDialog.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AnimationErrorsPanel.cpp b/src/AnimationErrorsPanel.cpp index febd9c3c..72f017a5 100644 --- a/src/AnimationErrorsPanel.cpp +++ b/src/AnimationErrorsPanel.cpp @@ -51,7 +51,7 @@ void AnimationErrorsPanel::CreateControls() // create a sizer and populate wxUI::VSizer{ ExpandSizerFlags(), - wxUI::Factory{ [](wxWindow* window) { + wxUI::Factory{ [](wxWindow* window) { auto* treeList = new wxTreeListCtrl(window, wxID_ANY, wxDefaultPosition, wxDefaultSize); treeList->AppendColumn("Errors", wxCOL_WIDTH_AUTOSIZE, wxALIGN_LEFT, wxCOL_RESIZABLE | wxCOL_SORTABLE); wxSize iconSize = wxArtProvider::GetSizeHint(wxART_LIST); diff --git a/src/HelpDialog.cpp b/src/HelpDialog.cpp index 7218ca57..170ce729 100644 --- a/src/HelpDialog.cpp +++ b/src/HelpDialog.cpp @@ -57,7 +57,7 @@ HelpDialog::HelpDialog(wxWindow* parent, HelpManager& helpManager) .bind(wxEVT_TEXT_ENTER, [this](auto const& event) { OnSearchEnter(const_cast(event)); }), }, // WebView for displaying help content - wxUI::Factory{ + wxUI::Factory{ wxSizerFlags(1).Expand(), [this](wxWindow* parent) { auto* webView = wxWebView::New(parent, wxID_ANY);