CMake file

Update to C++ 11: std::shared_ptr, for each loops
Update to wxWidgets 3.0+
This commit is contained in:
Twan van Laarhoven
2020-04-08 00:18:14 +02:00
parent aa39a9bc71
commit 35a89676b4
53 changed files with 343 additions and 415 deletions
+2 -1
View File
@@ -146,7 +146,8 @@ void KeywordReminderTextValue::highlight(const String& code, const vector<Script
}
++pos;
} else if (c == _('\\') && in_string && pos + 1 < code.size()) {
new_value += c + code.GetChar(pos + 1); // escape code
new_value += c;
new_value += code.GetChar(pos + 1); // escape code
pos += 2;
} else if (is_substr(code, pos, _("if ")) && !in_string) {
new_value += _("<code-kw>if</code-kw> ");
+4 -2
View File
@@ -19,6 +19,7 @@
#include <data/card.hpp>
#include <util/tagged_string.hpp>
#include <data/set.hpp> // for ValueActionPerformer
#include <wx/imaglist.h>
// ----------------------------------------------------------------------------- : ValueAction
@@ -210,8 +211,9 @@ void TextToggleReminderAction::perform(bool to_undo) {
String& val = value.value.mutate();
assert(pos + 4 < val.size());
size_t end = match_close_tag(val, pos);
Char& c = val[pos + 4];
swap(c, old);
wxUniChar c = old;
old = val[pos + 4];
val[pos + 4] = c;
if (end != String::npos && end + 5 < val.size()) {
val[end + 5] = c; // </kw-c>
}
+1 -1
View File
@@ -105,7 +105,7 @@ class TextToggleReminderAction : public ValueAction {
private:
size_t pos; ///< Position of "<kw-"
bool enable; ///< Should the reminder text be turned on or off?
Char old; ///< Old value of the <kw- tag
wxUniChar old; ///< Old value of the <kw- tag
};
// ----------------------------------------------------------------------------- : Replace all
+1 -1
View File
@@ -28,7 +28,7 @@ void AddCardsScript::perform(Set& set, vector<CardP>& out) {
Context& ctx = set.getContext();
ScriptValueP result = script.invoke(ctx);
// Add cards to out
ScriptValueP it = result->makeIterator(result);
ScriptValueP it = result->makeIterator();
while (ScriptValueP item = it->next()) {
CardP card = from_script<CardP>(item);
// is this a new card?
+1
View File
@@ -17,6 +17,7 @@
#include <script/scriptable.hpp>
#include <script/image.hpp>
#include <wx/image.h>
class wxImageList;
// ----------------------------------------------------------------------------- : ChoiceField
+2 -2
View File
@@ -79,8 +79,8 @@ FontP Font::make(int add_flags, AColor* other_color, double* other_size) const {
static const String BOLD_STRING = _(" Bold");
wxFont Font::toWxFont(double scale) const {
int size_i = to_int(scale * size);
int weight_i = flags & FONT_BOLD ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL;
int style_i = flags & FONT_ITALIC ? wxFONTSTYLE_ITALIC : wxFONTSTYLE_NORMAL;
wxFontWeight weight_i = flags & FONT_BOLD ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL;
wxFontStyle style_i = flags & FONT_ITALIC ? wxFONTSTYLE_ITALIC : wxFONTSTYLE_NORMAL;
// make font
wxFont font;
+1 -1
View File
@@ -220,7 +220,7 @@ String MtgEditorFileFormat::filter1(const String& str) {
after = str.substr(pos + 1);
}
// filter
FOR_EACH(c, after) {
FOR_EACH_CONST(c, after) {
if (isAlnum(c)) ret += c;
else ret += _('_');
}
-1
View File
@@ -275,7 +275,6 @@ class KeywordTrie {
KeywordTrie::KeywordTrie()
: on_any_star(nullptr)
, finished(nullptr)
{}
KeywordTrie::~KeywordTrie() {
+1 -1
View File
@@ -201,7 +201,7 @@ int string_format_args(const String& str) {
InputStreamP load_resource_text(const String& name);
InputStreamP load_resource_text(const String& name) {
#if defined(__WXMSW__) && !defined(__GNUC__)
HRSRC hResource = ::FindResource(wxGetInstance(), name, _("TEXT"));
HRSRC hResource = ::FindResource(wxGetInstance(), name.wc_str(), _("TEXT"));
if ( hResource == 0 ) throw InternalError(String::Format(_("Resource not found: %s"), name));
HGLOBAL hData = ::LoadResource(wxGetInstance(), hResource);
if ( hData == 0 ) throw InternalError(String::Format(_("Resource not text: %s"), name));