summaryrefslogtreecommitdiff
path: root/freefilesync/debian/patches/revert_zenju_aggressive_upstreamisms.patch
blob: fda8cc29709c73073a8e23a4e88a615df448f79c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
Message: Some of these can be traced back to version 10.23 which was the last to not use <unordered_map>
Date: 2022-04-18
Version: 11.20
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 <unordered_map>
 #include <vector>
 #include <wx/choice.h>
 
@@ -47,8 +46,6 @@
 
     using DescrList = std::vector<std::pair<Enum, std::pair<wxString, wxString>>>;
     DescrList descrList;
-
-    std::unordered_map<const wxChoice*, std::vector<wxString>> labelsSetLast;
 };
 template <class Enum> void setEnumVal(const EnumDescrList<Enum>& mapping, wxChoice& ctrl, Enum value);
 template <class Enum> Enum getEnumVal(const EnumDescrList<Enum>& mapping, const wxChoice& ctrl);
@@ -71,32 +68,24 @@
 template <class Enum>
 void setEnumVal(EnumDescrList<Enum>& mapping, wxChoice& ctrl, Enum value)
 {
-    auto& labelsSetLast = mapping.labelsSetLast[&ctrl];
-
-    std::vector<wxString> 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 <class Enum>
@@ -115,17 +103,11 @@
 
 template <class Enum> void updateTooltipEnumVal(const EnumDescrList<Enum>& 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<wxString>(defaultFolderPath), wxDD_DEFAULT_STYLE | wxDD_SHOW_HIDDEN);
+    wxDirDialog folderSelector(parent_, _("Select a folder"), utfTo<wxString>(defaultFolderPath));
     if (folderSelector.ShowModal() != wxID_OK)
         return;
     newFolderPath = utfTo<Zstring>(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<Zstring>& history, size_t historyMax) { history_ = history; historyMax_ = historyMax; }
     std::vector<Zstring> 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<HistoryList> sharedHistory) { sharedHistory_ = std::move(sharedHistory); }
     std::shared_ptr<HistoryList> 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<wxString>(defaultFolderNative), wxDD_DEFAULT_STYLE | wxDD_SHOW_HIDDEN);
+    wxDirDialog folderSelector(parent_, _("Select a folder"), utfTo<wxString>(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.1-1/wx+/bitmap_button.h	2020-09-01 19:07:43.727122311 -0400
+++ 11.1-2/wx+/bitmap_button.h	2020-09-01 20:10:31.385364671 -0400
@@ -26,7 +26,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);
diff -aur -x '*.git*' -x '.*.swp' -x '*.orig' -x '*.rej' 11.6-0/wx+/dc.h 11.6-1/wx+/dc.h
--- 11.20-0/wx+/dc.h	2022-04-18 09:49:31.921386600 -0400
+++ 11.20-1/wx+/dc.h	2022-04-18 10:12:04.667907393 -0400
@@ -12,7 +12,7 @@
 #include <zen/basic_math.h>
 #include <wx/dcbuffer.h> //for macro: wxALWAYS_NATIVE_DOUBLE_BUFFER
 #include <wx/dcscreen.h>
-#include <wx/bmpbndl.h>
+//#include <wx/bmpbndl.h>
     #include <gtk/gtk.h>
 
 
@@ -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

@@ -119,11 +116,11 @@
 
 
 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<double>(getDPI()) / defaultDpi); not (yet) implemented
     wxBitmap bmpScaled(img);
-    bmpScaled.SetScaleFactor(static_cast<double>(getDPI()) / defaultDpi);
+    //bmpScaled.SetScaleFactor(static_cast<double>(getDPI()) / defaultDpi);
     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
@@ -882,7 +885,6 @@
             wxMemoryDC dc(bmpSquare);
             drawInsetRectangle(dc, wxRect(bmpSquare.GetSize()), fastFromDIP(1), borderCol, fillCol);
         }
-        bmpSquare.SetScaleFactor(static_cast<double>(getDPI()) / defaultDpi);
         return bmpSquare;
     };
     pnl_.m_bitmapGraphKeyBytes->SetBitmap(generateSquareBitmap(getColorBytes(), getColorBytesRim()));
bgstack15