From 024d5dc64d6e3a829aa04e9c5c4f500ee34fab3a Mon Sep 17 00:00:00 2001 From: SoftFever Date: Tue, 24 Mar 2026 20:44:32 +0800 Subject: [PATCH] Remove wxCHECK_VERSION(3,1,x) guards and legacy wxinit.h macros Since we now target wxWidgets 3.3, all wxCHECK_VERSION(3,1,N) checks are always true. Remove the guards keeping only the true branches: - I18N.hpp: Remove version guard around _wxGetTranslation_ctx macro - ExtraRenderers.hpp, GUI_App.hpp: Simplify SUPPORTS_MARKUP to check only wxUSE_MARKUP (version check always true) - ConfigWizard.cpp: Remove manual wxArrayInt comparison fallback - SendSystemInfoDialog.cpp: Simplify display scaling guard to _WIN32 only - GUI_Utils.cpp: Remove IsDark() fallback using luma approximation - wxinit.h: Remove legacy wxEVT_BUTTON and wxEVT_HTML_LINK_CLICKED compat macros (these event names exist natively in wx 3.3) --- src/slic3r/GUI/ConfigWizard.cpp | 13 ------------- src/slic3r/GUI/ExtraRenderers.hpp | 2 +- src/slic3r/GUI/GUI_App.hpp | 2 +- src/slic3r/GUI/GUI_Utils.cpp | 5 ----- src/slic3r/GUI/I18N.hpp | 6 +----- src/slic3r/GUI/SendSystemInfoDialog.cpp | 2 +- src/slic3r/GUI/wxinit.h | 10 ---------- 7 files changed, 4 insertions(+), 36 deletions(-) diff --git a/src/slic3r/GUI/ConfigWizard.cpp b/src/slic3r/GUI/ConfigWizard.cpp index 58df5b1c09..e9767fd866 100644 --- a/src/slic3r/GUI/ConfigWizard.cpp +++ b/src/slic3r/GUI/ConfigWizard.cpp @@ -902,20 +902,7 @@ void PageMaterials::update_lists(int sel_type, int sel_vendor, int last_selected wxArrayInt sel_printers; int sel_printers_count = list_printer->GetSelections(sel_printers); - // Does our wxWidgets version support operator== for wxArrayInt ? -#if wxCHECK_VERSION(3, 1, 1) if (sel_printers != sel_printers_prev) { -#else - auto are_equal = [](const wxArrayInt& arr_first, const wxArrayInt& arr_second) { - if (arr_first.GetCount() != arr_second.GetCount()) - return false; - for (size_t i = 0; i < arr_first.GetCount(); i++) - if (arr_first[i] != arr_second[i]) - return false; - return true; - }; - if (!are_equal(sel_printers, sel_printers_prev)) { -#endif // Refresh type list list_type->Clear(); diff --git a/src/slic3r/GUI/ExtraRenderers.hpp b/src/slic3r/GUI/ExtraRenderers.hpp index b778df4c49..f7be8040b7 100644 --- a/src/slic3r/GUI/ExtraRenderers.hpp +++ b/src/slic3r/GUI/ExtraRenderers.hpp @@ -5,7 +5,7 @@ #include -#if wxUSE_MARKUP && wxCHECK_VERSION(3, 1, 1) +#if wxUSE_MARKUP #define SUPPORTS_MARKUP #endif diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index f89f583873..e89ac33cae 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -147,7 +147,7 @@ class GizmoObjectManipulation; static wxString dots("...", wxConvUTF8); // Does our wxWidgets version support markup? -#if wxUSE_MARKUP && wxCHECK_VERSION(3, 1, 1) +#if wxUSE_MARKUP #define SUPPORTS_MARKUP #endif diff --git a/src/slic3r/GUI/GUI_Utils.cpp b/src/slic3r/GUI/GUI_Utils.cpp index 9eeea88597..5d7dde4d93 100644 --- a/src/slic3r/GUI/GUI_Utils.cpp +++ b/src/slic3r/GUI/GUI_Utils.cpp @@ -243,12 +243,7 @@ bool check_dark_mode() { return value <= 0; } #endif -#if wxCHECK_VERSION(3,1,3) return wxSystemSettings::GetAppearance().IsDark(); -#else - const unsigned luma = wxGetApp().get_colour_approx_luma(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); - return luma < 128; -#endif } diff --git a/src/slic3r/GUI/I18N.hpp b/src/slic3r/GUI/I18N.hpp index c80c9a1659..4c71649408 100644 --- a/src/slic3r/GUI/I18N.hpp +++ b/src/slic3r/GUI/I18N.hpp @@ -64,11 +64,7 @@ namespace I18N { inline std::string translate_utf8(const std::wstring &s, const std::wstring &plural, unsigned int n) { return translate(s, plural, n).ToUTF8().data(); } inline std::string translate_utf8(const wxString &s, const wxString &plural, unsigned int n) { return translate(s, plural, n).ToUTF8().data(); } -#if wxCHECK_VERSION(3, 1, 1) - #define _wxGetTranslation_ctx(S, CTX) wxGetTranslation((S), wxEmptyString, (CTX)) -#else - #define _wxGetTranslation_ctx(S, CTX) ((void)(CTX), wxGetTranslation((S))) -#endif +#define _wxGetTranslation_ctx(S, CTX) wxGetTranslation((S), wxEmptyString, (CTX)) inline wxString translate(const char *s, const char* ctx) { return _wxGetTranslation_ctx(wxString(s, wxConvUTF8), ctx); } inline wxString translate(const wchar_t *s, const char* ctx) { return _wxGetTranslation_ctx(s, ctx); } diff --git a/src/slic3r/GUI/SendSystemInfoDialog.cpp b/src/slic3r/GUI/SendSystemInfoDialog.cpp index cb8228ba28..a47119e429 100644 --- a/src/slic3r/GUI/SendSystemInfoDialog.cpp +++ b/src/slic3r/GUI/SendSystemInfoDialog.cpp @@ -481,7 +481,7 @@ static std::string generate_system_info_json() monitor_node.put("height", display.GetGeometry().GetHeight()); // Only get the scaling on Win, it is not reliable on other platforms. - #if defined(_WIN32) && wxCHECK_VERSION(3, 1, 2) + #if defined(_WIN32) double scaling = display.GetPPI().GetWidth() / 96.; std::stringstream ss; ss << std::setprecision(3) << scaling; diff --git a/src/slic3r/GUI/wxinit.h b/src/slic3r/GUI/wxinit.h index b55681b92d..4c5ab9fb36 100644 --- a/src/slic3r/GUI/wxinit.h +++ b/src/slic3r/GUI/wxinit.h @@ -12,14 +12,4 @@ // later when we no longer need to undef _ #define __(s) wxGetTranslation((s)) -// legacy macros -// https://wiki.wxwidgets.org/EventTypes_and_Event-Table_Macros -#ifndef wxEVT_BUTTON -#define wxEVT_BUTTON wxEVT_COMMAND_BUTTON_CLICKED -#endif - -#ifndef wxEVT_HTML_LINK_CLICKED -#define wxEVT_HTML_LINK_CLICKED wxEVT_COMMAND_HTML_LINK_CLICKED -#endif - #endif