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
|
Author: Ben Stack <bgstack15@gmail.com>
Date: 2020-05-17 14:11 -0400
Message: Use the following command to get this old contents. Zenju must be using some newer definition of -std=c++2a than what Devuan Ceres provides as of 2020-05-17, and probably wxwidgets. This is the 10.23 code for these files.
git checkout b4ecf755 zen/legacy_compiler.h zen/string_base.h wx+/choice_enum.h
Unfortunately with the removal of the wxWidgets-gtk2 code from Debian, we are stuck using all available at approximately November 1, 2019 snapshot of Debian: https://snapshot.debian.org/archive/debian/20191101T211023Z/pool/main/w/wxwidgets3.0/
libwxbase3.0-0v5_3.0.4+dfsg-14_amd64.deb
libwxbase3.0-0v5_3.0.4+dfsg-14_i386.deb
libwxbase3.0-dev_3.0.4+dfsg-14_amd64.deb
libwxbase3.0-dev_3.0.4+dfsg-14_i386.deb
libwxgtk3.0-0v5_3.0.4+dfsg-14_amd64.deb
libwxgtk3.0-0v5_3.0.4+dfsg-14_i386.deb
libwxgtk3.0-dev_3.0.4+dfsg-14_amd64.deb
libwxgtk3.0-dev_3.0.4+dfsg-14_i386.deb
wx3.0-headers_3.0.4+dfsg-14_all.deb
wx-common_3.0.4+dfsg-14_amd64.deb
wx-common_3.0.4+dfsg-14_i386.deb
diff -x '*.rej' -x '*.orig' -Naur 10.25-0/zen/legacy_compiler.h 10.25-1/zen/legacy_compiler.h
--- 10.25-0/zen/legacy_compiler.h 2020-06-19 16:17:16.000000000 -0400
+++ 10.25-1/zen/legacy_compiler.h 2020-06-20 21:05:15.159166242 -0400
@@ -7,7 +7,6 @@
#ifndef LEGACY_COMPILER_H_839567308565656789
#define LEGACY_COMPILER_H_839567308565656789
- #include <numbers> //C++20
@@ -20,6 +19,53 @@
//---------------------------------------------------------------------------------
+#if __cpp_lib_span
+ #error get rid of workaround:
+#endif
+
+template <class T>
+class span
+{
+public:
+ template <class Iterator>
+ span(Iterator first, Iterator last) : size_(last - first), data_(first != last ? &*first : nullptr) {}
+
+ template <class Container>
+ span(Container& cont) : span(cont.begin(), cont.end()) {}
+
+ using iterator = T*;
+ using const_iterator = const T*;
+
+ iterator begin() { return data_; }
+ iterator end () { return data_ + size_; }
+
+ const_iterator begin() const { return data_; }
+ const_iterator end () const { return data_ + size_; }
+
+ const_iterator cbegin() const { return begin(); }
+ const_iterator cend () const { return end (); }
+
+ T* data() const { return data_; }
+ size_t size() const { return size_; }
+ bool empty() const { return size_ == 0; }
+
+private:
+ const size_t size_;
+ T* const data_;
+};
+
+
+#if __cpp_lib_math_constants
+ #error get rid of workaround:
+#endif
+
+namespace numbers
+{
+const double pi = 3.14159265358979323846;
+const double e = 2.71828182845904523536;
+const double sqrt2 = 1.41421356237309504880;
+const double ln2 = 0.693147180559945309417;
+}
}
diff -x '*.rej' -x '*.orig' -Naur 10.25-0/zen/string_base.h 10.25-1/zen/string_base.h
--- 10.25-0/zen/string_base.h 2020-06-19 16:17:16.000000000 -0400
+++ 10.25-1/zen/string_base.h 2020-06-20 21:06:05.705698462 -0400
@@ -11,7 +11,9 @@
#include <cassert>
#include <cstdint>
#include <atomic>
+#if __cpp_impl_three_way_comparison && __cpp_lib_three_way_comparison
#include <compare>
+#endif
#include "string_tools.h"
@@ -293,15 +295,29 @@
};
+#if __cpp_impl_three_way_comparison && __cpp_lib_three_way_comparison
+ #error implement!
+#endif
+
template <class Char, template <class> class SP> bool operator==(const Zbase<Char, SP>& lhs, const Zbase<Char, SP>& rhs);
template <class Char, template <class> class SP> bool operator==(const Zbase<Char, SP>& lhs, const Char* rhs);
template <class Char, template <class> class SP> inline bool operator==(const Char* lhs, const Zbase<Char, SP>& rhs) { return operator==(rhs, lhs); }
+#if __cpp_impl_three_way_comparison && __cpp_lib_three_way_comparison
template <class Char, template <class> class SP> std::strong_ordering operator<=>(const Zbase<Char, SP>& lhs, const Zbase<Char, SP>& rhs);
template <class Char, template <class> class SP> std::strong_ordering operator<=>(const Zbase<Char, SP>& lhs, const Char* rhs);
template <class Char, template <class> class SP> std::strong_ordering operator<=>(const Char* lhs, const Zbase<Char, SP>& rhs);
+#else
+template <class Char, template <class> class SP> inline bool operator!=(const Zbase<Char, SP>& lhs, const Zbase<Char, SP>& rhs) { return !operator==(lhs, rhs); }
+template <class Char, template <class> class SP> inline bool operator!=(const Zbase<Char, SP>& lhs, const Char* rhs) { return !operator==(lhs, rhs); }
+template <class Char, template <class> class SP> inline bool operator!=(const Char* lhs, const Zbase<Char, SP>& rhs) { return !operator==(lhs, rhs); }
+
+template <class Char, template <class> class SP> bool operator<(const Zbase<Char, SP>& lhs, const Zbase<Char, SP>& rhs);
+template <class Char, template <class> class SP> bool operator<(const Zbase<Char, SP>& lhs, const Char* rhs);
+template <class Char, template <class> class SP> bool operator<(const Char* lhs, const Zbase<Char, SP>& rhs);
+#endif
template <class Char, template <class> class SP> inline Zbase<Char, SP> operator+(const Zbase<Char, SP>& lhs, const Zbase<Char, SP>& rhs) { return Zbase<Char, SP>(lhs) += rhs; }
template <class Char, template <class> class SP> inline Zbase<Char, SP> operator+(const Zbase<Char, SP>& lhs, const Char* rhs) { return Zbase<Char, SP>(lhs) += rhs; }
@@ -482,11 +498,12 @@
}
+#if __cpp_impl_three_way_comparison && __cpp_lib_three_way_comparison
template <class Char, template <class> class SP> inline
std::strong_ordering operator<=>(const Zbase<Char, SP>& lhs, const Zbase<Char, SP>& rhs)
{
- return std::lexicographical_compare_three_way(lhs.begin(), lhs.end(), //respect embedded 0
- rhs.begin(), rhs.end()); //
+ return std::lexicographical_compare_three_way(lhs.begin(), lhs.end(), //respect embedded 0
+ rhs.begin(), rhs.end());
}
@@ -501,11 +518,35 @@
template <class Char, template <class> class SP> inline
std::strong_ordering operator<=>(const Char* lhs, const Zbase<Char, SP>& rhs)
{
- return std::lexicographical_compare_three_way(lhs, lhs + strLength(lhs),
- rhs.begin(), rhs.end()); //respect embedded 0
+ return std::lexicographical_compare_three_way(lhs, lhs + strLength(lhs), //respect embedded 0
+ rhs.begin(), rhs.end());
+}
+
+#else
+template <class Char, template <class> class SP> inline
+bool operator<(const Zbase<Char, SP>& lhs, const Zbase<Char, SP>& rhs)
+{
+ return std::lexicographical_compare(lhs.begin(), lhs.end(), //respect embedded 0
+ rhs.begin(), rhs.end());
}
+template <class Char, template <class> class SP> inline
+bool operator<(const Zbase<Char, SP>& lhs, const Char* rhs)
+{
+ return std::lexicographical_compare(lhs.begin(), lhs.end(), //respect embedded 0
+ rhs, rhs + strLength(rhs));
+}
+
+
+template <class Char, template <class> class SP> inline
+bool operator<(const Char* lhs, const Zbase<Char, SP>& rhs)
+{
+ return std::lexicographical_compare(lhs, lhs + strLength(lhs), //respect embedded 0
+ rhs.begin(), rhs.end());
+}
+#endif
+
template <class Char, template <class> class SP> inline
size_t Zbase<Char, SP>::length() const
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>
@@ -44,11 +43,8 @@
descrList.push_back({ value, { text, tooltip } });
return *this;
}
-
using DescrList = std::vector<std::pair<Enum, std::pair<wxString, wxString>>>;
DescrList descrList;
-
- std::unordered_map<const wxChoice*, std::vector<wxString>> itemsSetLast;
};
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);
@@ -69,34 +65,26 @@
//--------------- impelementation -------------------------------------------
template <class Enum>
-void setEnumVal(EnumDescrList<Enum>& mapping, wxChoice& ctrl, Enum value)
+void setEnumVal(const EnumDescrList<Enum>& mapping, wxChoice& ctrl, Enum value)
{
- auto& itemsSetLast = mapping.itemsSetLast[&ctrl];
+ ctrl.Clear();
- std::vector<wxString> items;
+ int selectedPos = 0;
for (auto it = mapping.descrList.begin(); it != mapping.descrList.end(); ++it)
- items.push_back(it->second.first);
-
- if (items != itemsSetLast)
{
- ctrl.Set(items); //expensive as fuck! => only call when absolutely needed!
- itemsSetLast = std::move(items);
+ 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 < static_cast<int>(mapping.descrList.size()))
- {
- 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);
}
}
|