Message: Some of these can be traced back to version 10.23 which was the last to not use Date: 2022-06-26 Version: 11.22 Author: bgstack15 diff -x '*.rej' -x '*.orig' -x '*.git*' -Naur 10.24-0/wx+/choice_enum.h 10.24-1/wx+/choice_enum.h --- 10.24-0/wx+/choice_enum.h 2020-05-17 18:30:59.441499418 -0400 +++ 10.24-1/wx+/choice_enum.h 2020-05-17 18:53:59.893685507 -0400 @@ -7,7 +7,6 @@ #ifndef CHOICE_ENUM_H_132413545345687 #define CHOICE_ENUM_H_132413545345687 -#include #include #include @@ -47,8 +46,6 @@ using DescrList = std::vector>>; DescrList descrList; - - std::unordered_map> labelsSetLast; }; template void setEnumVal(const EnumDescrList& mapping, wxChoice& ctrl, Enum value); template Enum getEnumVal(const EnumDescrList& mapping, const wxChoice& ctrl); @@ -71,32 +68,24 @@ template void setEnumVal(EnumDescrList& mapping, wxChoice& ctrl, Enum value) { - auto& labelsSetLast = mapping.labelsSetLast[&ctrl]; - - std::vector labels; - for (const auto& [val, texts] : mapping.descrList) - labels.push_back(texts.first); + ctrl.Clear(); - if (labels != labelsSetLast) + int selectedPos = 0; + for (auto it = mapping.descrList.begin(); it != mapping.descrList.end(); ++it) { - ctrl.Set(labels); //expensive as fuck! => only call when absolutely needed! - labelsSetLast = std::move(labels); + ctrl.Append(it->second.first); + if (it->first == value) + { + selectedPos = it - mapping.descrList.begin(); + + if (it->second.second.empty()) + ctrl.UnsetToolTip(); + else + ctrl.SetToolTip(it->second.second); + } } - //----------------------------------------------------------------- - const auto it = std::find_if(mapping.descrList.begin(), mapping.descrList.end(), [&](const auto& mapItem) { return mapItem.first == value; }); - if (it != mapping.descrList.end()) - { - if (const wxString& tooltip = it->second.second; - !tooltip.empty()) - ctrl.SetToolTip(tooltip); - else - ctrl.UnsetToolTip(); - - const int selectedPos = it - mapping.descrList.begin(); - ctrl.SetSelection(selectedPos); - } - else assert(false); + ctrl.SetSelection(selectedPos); } template @@ -115,17 +103,11 @@ template void updateTooltipEnumVal(const EnumDescrList& mapping, wxChoice& ctrl) { - const int selectedPos = ctrl.GetSelection(); + const Enum currentValue = getEnumVal(mapping, ctrl); - if (0 <= selectedPos && selectedPos < std::ssize(mapping.descrList)) - { - if (const auto& [text, tooltip] = mapping.descrList[selectedPos].second; - !tooltip.empty()) - ctrl.SetToolTip(tooltip); - else - ctrl.UnsetToolTip(); - } - else assert(false); + for (const auto& [enumValue, textAndTooltip] : mapping.descrList) + if (currentValue == enumValue) + ctrl.SetToolTip(textAndTooltip.second); } } Message: Now have to revert wxWidgets 3.1.4 upstreamisms cd 11.1-0 ; git diff HEAD~1 -- $( grep -l -rIE 'wxASCII_STR' ) > ~/foo1 ; ( cd ../11.1-2 ; vi ~/foo1 $( grep -l -rIE 'wxASCII_STR' ) ; ) cd 11.1-0 ; git diff HEAD~1 -- $( grep -l -rIE 'wxDD_SHOW_HIDDEN' ) > ~/foo1 ; ( cd ../11.1-2 ; vi ~/foo1 $( grep -l -rIE 'wxDD_SHOW_HIDDEN' ) ; ) diff -x '*.orig' -x '*.rej' -aur 11.2-0/FreeFileSync/Source/RealTimeSync/folder_selector2.cpp 11.2-1/FreeFileSync/Source/RealTimeSync/folder_selector2.cpp --- 11.2-0/FreeFileSync/Source/RealTimeSync/folder_selector2.cpp 2020-10-02 14:39:05.273463072 -0400 +++ 11.2-1/FreeFileSync/Source/RealTimeSync/folder_selector2.cpp 2020-10-02 15:06:56.670070620 -0400 @@ -158,7 +158,7 @@ } Zstring newFolderPath; - wxDirDialog folderSelector(parent_, _("Select a folder"), utfTo(defaultFolderPath), wxDD_DEFAULT_STYLE | wxDD_SHOW_HIDDEN); + wxDirDialog folderSelector(parent_, _("Select a folder"), utfTo(defaultFolderPath)); if (folderSelector.ShowModal() != wxID_OK) return; newFolderPath = utfTo(folderSelector.GetPath()); diff -x '*.orig' -x '*.rej' -aur 11.1-1/FreeFileSync/Source/ui/command_box.h 11.1-2/FreeFileSync/Source/ui/command_box.h --- 11.1-1/FreeFileSync/Source/ui/command_box.h 2020-09-01 19:07:43.719122215 -0400 +++ 11.1-2/FreeFileSync/Source/ui/command_box.h 2020-09-01 20:09:56.840929352 -0400 @@ -30,7 +30,7 @@ const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxASCII_STR(wxComboBoxNameStr)); + const wxString& name = wxComboBoxNameStr); void setHistory(const std::vector& history, size_t historyMax) { history_ = history; historyMax_ = historyMax; } std::vector getHistory() const { return history_; } diff -x '*.orig' -x '*.rej' -aur 11.1-1/FreeFileSync/Source/ui/folder_history_box.h 11.1-2/FreeFileSync/Source/ui/folder_history_box.h --- 11.1-1/FreeFileSync/Source/ui/folder_history_box.h 2020-09-01 19:07:43.719122215 -0400 +++ 11.1-2/FreeFileSync/Source/ui/folder_history_box.h 2020-09-01 20:09:50.624849989 -0400 @@ -68,7 +68,7 @@ const wxString choices[] = nullptr, long style = 0, const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxASCII_STR(wxComboBoxNameStr)); + const wxString& name = wxComboBoxNameStr); void setHistory(std::shared_ptr sharedHistory) { sharedHistory_ = std::move(sharedHistory); } std::shared_ptr getHistory() { return sharedHistory_; } diff -x '*.orig' -x '*.rej' -aur 11.2-0/FreeFileSync/Source/ui/folder_selector.cpp 11.2-1/FreeFileSync/Source/ui/folder_selector.cpp --- 11.2-0/FreeFileSync/Source/ui/folder_selector.cpp 2020-10-02 14:39:05.297463367 -0400 +++ 11.2-1/FreeFileSync/Source/ui/folder_selector.cpp 2020-10-02 15:08:07.066935749 -0400 @@ -232,7 +232,7 @@ Zstring shellItemPath; //default size? Windows: not implemented, Linux(GTK2): not implemented, macOS: not implemented => wxWidgets, what is this shit!? - wxDirDialog folderSelector(parent_, _("Select a folder"), utfTo(defaultFolderNative), wxDD_DEFAULT_STYLE | wxDD_SHOW_HIDDEN); + wxDirDialog folderSelector(parent_, _("Select a folder"), utfTo(defaultFolderNative)); //GTK2: "Show hidden" is also available as a context menu option in the folder picker! //It looks like wxDD_SHOW_HIDDEN only sets the default when opening for the first time!? if (folderSelector.ShowModal() != wxID_OK) diff -x '*.orig' -x '*.rej' -aur 11.1-1/wx+/bitmap_button.h 11.1-2/wx+/bitmap_button.h --- 11.22-0/wx+/bitmap_button.h 2022-06-26 12:01:15.638291465 -0400 +++ 11.22-1/wx+/bitmap_button.h 2022-06-26 12:51:34.527830821 -0400 @@ -28,7 +28,7 @@ const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxASCII_STR(wxButtonNameStr)) : + const wxString& name = wxButtonNameStr) : wxBitmapButton(parent, id, wxNullBitmap, pos, size, style, validator, name) { SetLabel(label); @@ -104,7 +104,6 @@ wxBitmap renderSelectedButton(const wxSize& sz) { wxBitmap bmp(sz); //seems we don't need to pass 24-bit depth here even for high-contrast color schemes - bmp.SetScaleFactor(getDisplayScaleFactor()); { wxMemoryDC dc(bmp); @@ -120,7 +119,6 @@ wxBitmap renderPressedButton(const wxSize& sz) { wxBitmap bmp(sz); //seems we don't need to pass 24-bit depth here even for high-contrast color schemes - bmp.SetScaleFactor(getDisplayScaleFactor()); { //draw rectangle border with gradient const wxColor colFrom = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE); diff -aur -x '*.git*' -x '.*.swp' -x '*.orig' -x '*.rej' 11.6-0/wx+/dc.h 11.6-1/wx+/dc.h --- 11.21-0/wx+/dc.h 2022-05-22 17:09:32.250809701 -0400 +++ 11.21-1/wx+/dc.h 2022-05-22 20:28:53.788193992 -0400 @@ -12,7 +12,7 @@ #include #include //for macro: wxALWAYS_NATIVE_DOUBLE_BUFFER #include -#include +//#include #include @@ -92,9 +92,6 @@ inline int getDPI() { -#ifndef wxHAS_DPI_INDEPENDENT_PIXELS -#error why is wxHAS_DPI_INDEPENDENT_PIXELS not defined? -#endif //GTK2 doesn't properly support high DPI: https://freefilesync.org/forum/viewtopic.php?t=6114 //=> requires general fix at wxWidgets-level @@ -126,11 +123,10 @@ inline -wxBitmapBundle toBitmapBundle(const wxImage& img /*expected to be DPI-scaled!*/) +wxBitmap toBitmapBundle(const wxImage& img /*expected to be DPI-scaled!*/) { //return wxBitmap(img, -1 /*depth*/, static_cast(getDPI()) / defaultDpi); implementation just ignores scale parameter! WTF! wxBitmap bmpScaled(img); - bmpScaled.SetScaleFactor(getDisplayScaleFactor()); return bmpScaled; } diff -x '*.orig' -x '*.rej' -aur 11.1-1/wx+/graph.h 11.1-2/wx+/graph.h --- 11.1-1/wx+/graph.h 2020-09-01 19:07:43.731122359 -0400 +++ 11.1-2/wx+/graph.h 2020-09-01 20:10:36.541429649 -0400 @@ -153,7 +153,7 @@ const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL | wxNO_BORDER, - const wxString& name = wxASCII_STR(wxPanelNameStr)); + const wxString& name = wxPanelNameStr); class CurveAttributes { diff -x '*.orig' -x '*.rej' -aur 11.1-1/wx+/grid.cpp 11.1-2/wx+/grid.cpp --- 11.1-1/wx+/grid.cpp 2020-09-01 20:07:24.418981662 -0400 +++ 11.1-2/wx+/grid.cpp 2020-09-01 20:10:23.745268393 -0400 @@ -268,7 +268,7 @@ { public: SubWindow(Grid& parent) : - wxWindow(&parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS | wxBORDER_NONE, wxASCII_STR(wxPanelNameStr)), + wxWindow(&parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS | wxBORDER_NONE, wxPanelNameStr), parent_(parent) { Bind(wxEVT_PAINT, [this](wxPaintEvent& event) { onPaintEvent(event); }); diff -x '*.orig' -x '*.rej' -aur 11.1-1/wx+/grid.h 11.1-2/wx+/grid.h --- 11.1-1/wx+/grid.h 2020-09-01 19:07:43.731122359 -0400 +++ 11.1-2/wx+/grid.h 2020-09-01 20:10:48.817584344 -0400 @@ -149,7 +149,7 @@ const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL | wxNO_BORDER, - const wxString& name = wxASCII_STR(wxPanelNameStr)); + const wxString& name = wxPanelNameStr); size_t getRowCount() const; diff -x '*.orig' -x '*.rej' -aur 11.1-1/wx+/toggle_button.h 11.1-2/wx+/toggle_button.h --- 11.1-1/wx+/toggle_button.h 2020-09-01 19:07:43.731122359 -0400 +++ 11.1-2/wx+/toggle_button.h 2020-09-01 20:10:44.629531569 -0400 @@ -24,7 +24,7 @@ const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxASCII_STR(wxButtonNameStr)) : + const wxString& name = wxButtonNameStr) : wxBitmapButton(parent, id, bitmap, pos, size, style, validator, name) {} //wxButton constructor @@ -35,7 +35,7 @@ const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxASCII_STR(wxButtonNameStr)) : + const wxString& name = wxButtonNameStr) : wxBitmapButton(parent, id, wxNullBitmap, pos, size, style, validator, name) { SetLabel(label); Version: 11.1 Message: Had to revert gui_status_handler.cpp and .h entirely to version 11.0 to avoid the wx 3.1.4-isms here. diff --git a/FreeFileSync/Source/ui/gui_status_handler.cpp b/FreeFileSync/Source/ui/gui_status_handler.cpp index 3cb6aaaa..9484af2c 100644 --- a/FreeFileSync/Source/ui/gui_status_handler.cpp +++ b/FreeFileSync/Source/ui/gui_status_handler.cpp @@ -43,8 +43,8 @@ StatusHandlerTemporaryPanel::StatusHandlerTemporaryPanel(MainDialog& dlg, mainDlg_.Update(); //don't wait until idle event! //register keys - mainDlg_. Bind(wxEVT_CHAR_HOOK, &StatusHandlerTemporaryPanel::onLocalKeyEvent, this); - mainDlg_.m_buttonCancel->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &StatusHandlerTemporaryPanel::onAbortCompare, this); + mainDlg_.Connect(wxEVT_CHAR_HOOK, wxKeyEventHandler(StatusHandlerTemporaryPanel::OnKeyPressed), nullptr, this); + mainDlg_.m_buttonCancel->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusHandlerTemporaryPanel::OnAbortCompare), nullptr, this); } @@ -128,9 +128,8 @@ StatusHandlerTemporaryPanel::~StatusHandlerTemporaryPanel() mainDlg_.auiMgr_.Update(); //unregister keys - [[maybe_unused]] bool ubOk1 = mainDlg_. Unbind(wxEVT_CHAR_HOOK, &StatusHandlerTemporaryPanel::onLocalKeyEvent, this); - [[maybe_unused]] bool ubOk2 = mainDlg_.m_buttonCancel->Unbind(wxEVT_COMMAND_BUTTON_CLICKED, &StatusHandlerTemporaryPanel::onAbortCompare, this); - assert(ubOk1 && ubOk2); + mainDlg_.Disconnect(wxEVT_CHAR_HOOK, wxKeyEventHandler(StatusHandlerTemporaryPanel::OnKeyPressed), nullptr, this); + mainDlg_.m_buttonCancel->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusHandlerTemporaryPanel::OnAbortCompare), nullptr, this); mainDlg_.compareStatus_->teardown(); @@ -314,20 +313,20 @@ void StatusHandlerTemporaryPanel::forceUiUpdateNoThrow() } -void StatusHandlerTemporaryPanel::onLocalKeyEvent(wxKeyEvent& event) +void StatusHandlerTemporaryPanel::OnKeyPressed(wxKeyEvent& event) { const int keyCode = event.GetKeyCode(); if (keyCode == WXK_ESCAPE) { wxCommandEvent dummy; - onAbortCompare(dummy); + OnAbortCompare(dummy); } event.Skip(); } -void StatusHandlerTemporaryPanel::onAbortCompare(wxCommandEvent& event) +void StatusHandlerTemporaryPanel::OnAbortCompare(wxCommandEvent& event) { userRequestAbort(); } diff --git a/FreeFileSync/Source/ui/gui_status_handler.h b/FreeFileSync/Source/ui/gui_status_handler.h index e8ed01e4..2a9e00d2 100644 --- a/FreeFileSync/Source/ui/gui_status_handler.h +++ b/FreeFileSync/Source/ui/gui_status_handler.h @@ -41,8 +41,8 @@ public: Result reportResults(); //noexcept!! private: - void onLocalKeyEvent(wxKeyEvent& event); - void onAbortCompare(wxCommandEvent& event); //handle abort button click + void OnKeyPressed(wxKeyEvent& event); + void OnAbortCompare(wxCommandEvent& event); //handle abort button click void showStatsPanel(); MainDialog& mainDlg_; diff -Naur -x '*.orig' -x '*.rej' -x '*.git*' 11.4-1/wx+/no_flicker.h 11.4-2/wx+/no_flicker.h --- 11.4-1/wx+/no_flicker.h 2020-12-08 08:15:29.436156549 -0500 +++ 11.4-2/wx+/no_flicker.h 2020-12-08 20:11:25.066820270 -0500 @@ -70,7 +70,7 @@ ZEN_ON_SCOPE_EXIT(richCtrl.EndSuppressUndo()); //fix mouse scroll speed: why the FUCK is this even necessary! - richCtrl.SetLineHeight(richCtrl.GetCharHeight()); + //richCtrl.SetLineHeight(richCtrl.GetCharHeight()); // this is not even documented in wxWidgets 3.1.5! //get rid of margins and space between text blocks/"paragraphs" richCtrl.SetMargins({0, 0}); --- 11.20-0/FreeFileSync/Source/ui/progress_indicator.cpp 2022-04-18 09:49:31.917386558 -0400 +++ 11.20-1/FreeFileSync/Source/ui/progress_indicator.cpp 2022-04-18 11:02:10.988781908 -0400 @@ -878,12 +881,10 @@ auto generateSquareBitmap = [&](const wxColor& fillCol, const wxColor& borderCol) { wxBitmap bmpSquare(this->GetCharHeight(), this->GetCharHeight()); //seems we don't need to pass 24-bit depth here even for high-contrast color schemes - bmpSquare.SetScaleFactor(getDisplayScaleFactor()); { wxMemoryDC dc(bmpSquare); drawInsetRectangle(dc, wxRect(bmpSquare.GetSize()), fastFromDIP(1), borderCol, fillCol); } - bmpSquare.SetScaleFactor(static_cast(getDPI()) / defaultDpi); return bmpSquare; }; pnl_.m_bitmapGraphKeyBytes->SetBitmap(generateSquareBitmap(getColorBytes(), getColorBytesRim())); --- 11.22-0/wx+/rtl.h 2022-06-26 12:01:15.642291514 -0400 +++ 11.22-1/wx+/rtl.h 2022-06-26 12:58:17.248838575 -0400 @@ -69,9 +69,6 @@ if (!buffer || buffer->GetSize() != rect.GetSize()) //[!] since we do a mirror, width needs to match exactly! buffer.emplace(rect.GetSize()); - if (buffer->GetScaleFactor() != dc.GetContentScaleFactor()) //needed here? - buffer->SetScaleFactor(dc.GetContentScaleFactor()); // - wxMemoryDC memDc(*buffer); //copies scale factor from wxBitmap memDc.Blit(wxPoint(0, 0), rect.GetSize(), &dc, rect.GetTopLeft()); //blit in: background is mirrored due to memDc, dc having different layout direction! --- 11.22-0/FreeFileSync/Source/ui/main_dlg.cpp 2022-06-26 12:01:15.634291415 -0400 +++ 11.22-1/FreeFileSync/Source/ui/main_dlg.cpp 2022-06-26 14:44:38.556188935 -0400 @@ -3595,7 +3590,6 @@ }; wxBitmap bmpSquare(this->GetCharHeight(), this->GetCharHeight()); //seems we don't need to pass 24-bit depth here even for high-contrast color schemes - bmpSquare.SetScaleFactor(getDisplayScaleFactor()); { wxMemoryDC dc(bmpSquare); const wxColor borderCol(0xdd, 0xdd, 0xdd); //light grey