diff --git a/src/data/format/image.cpp b/src/data/format/image.cpp index 696956e9..1794ac61 100644 --- a/src/data/format/image.cpp +++ b/src/data/format/image.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -175,7 +176,7 @@ Image export_image(const SetP& set, const CardP& card, const bool write_metadata if (write_metadata) { String metadata = _("["); IndexMap& card_data = card->data; - boost::json::object& cardv = mse_to_json(card, set.get()); + boost::json::object cardv = mse_to_json(card, set.get()); boost::json::object& cardv_data = cardv["data"].as_object(); StyleSheetP stylesheet = set->stylesheetForP(card); if (!settings.stylesheetSettingsFor(*stylesheet).card_notes_export()) cardv["notes"] = ""; @@ -259,7 +260,7 @@ Image export_image( const SetP& set, const vector& cards, if (i > 0) metadata += _(","); CardP card = cards[i]; IndexMap& card_data = card->data; - boost::json::object& cardv = mse_to_json(card, set.get()); + boost::json::object cardv = mse_to_json(card, set.get()); boost::json::object& cardv_data = cardv["data"].as_object(); StyleSheetP stylesheet = set->stylesheetForP(card); if (!settings.stylesheetSettingsFor(*stylesheet).card_notes_export()) cardv["notes"] = ""; diff --git a/src/gui/bulk_modification_window.cpp b/src/gui/bulk_modification_window.cpp index edeb71d4..f2773cba 100644 --- a/src/gui/bulk_modification_window.cpp +++ b/src/gui/bulk_modification_window.cpp @@ -205,7 +205,7 @@ void BulkModificationWindow::onOk(wxCommandEvent&) { } // get the new script values vector> actions; - String& field_name = field_type->GetString(field_type->GetSelection()); + String field_name = field_type->GetString(field_type->GetSelection()); // stylesheet, notes or id change if (field_name == _("stylesheet") || field_name == _("notes") || field_name == _("id")) { vector new_values; diff --git a/src/gui/control/card_list.cpp b/src/gui/control/card_list.cpp index 20d13d19..3650fd10 100644 --- a/src/gui/control/card_list.cpp +++ b/src/gui/control/card_list.cpp @@ -296,7 +296,8 @@ bool CardListBase::parseFiles(wxArrayString& filenames, vector& out) { bool CardListBase::parseImage(Image& image, vector& out) { size_t j = out.size(); if (image.HasOption(wxIMAGE_OPTION_PNG_DESCRIPTION)) { - parseText(image.GetOption(wxIMAGE_OPTION_PNG_DESCRIPTION), out); + auto text = image.GetOption(wxIMAGE_OPTION_PNG_DESCRIPTION); + parseText(text, out); // crop image rects to populate image fields for (; j < out.size(); j++) { CardP& card = out[j]; @@ -307,7 +308,7 @@ bool CardListBase::parseImage(Image& image, vector& out) { int degrees = 0; value->filename.getExternalRect(rect, degrees); if (rect.width > 0 && rect.height > 0) { - Image& img = image.GetSubImage(rect); + Image img = image.GetSubImage(rect); img = rotate_image(img, deg_to_rad(360-degrees)); LocalFileName filename = set->newFileName((*it)->fieldP->name, settings.internal_image_extension ? _(".png") : _("")); // a new unique name in the package img.SaveFile(set->nameOut(filename), wxBITMAP_TYPE_PNG); @@ -326,7 +327,7 @@ bool CardListBase::parseText(String& text, vector& out) { text = text.substr(pos + 14, text.find("") - pos - 14); } try { - ScriptValueP& sv = json_to_mse(text, set.get()); + ScriptValueP sv = json_to_mse(text, set.get()); if (sv->type() == SCRIPT_COLLECTION) { if (ScriptCustomCollection* custom = dynamic_cast(sv.get())) { for (size_t i = 0; i < custom->value.size(); i++) { diff --git a/src/gui/drop_down_list.cpp b/src/gui/drop_down_list.cpp index b530e7ce..a63b641d 100644 --- a/src/gui/drop_down_list.cpp +++ b/src/gui/drop_down_list.cpp @@ -42,8 +42,11 @@ private: || t == wxEVT_LEFT_DOWN || t == wxEVT_RIGHT_DOWN || t == wxEVT_MOVE || t == wxEVT_MENU_HIGHLIGHT || t == wxEVT_MENU_OPEN - || t == wxEVT_CLOSE_WINDOW || t == wxEVT_KILL_FOCUS + || t == wxEVT_CLOSE_WINDOW +#if defined(_WIN32) + || t == wxEVT_KILL_FOCUS //|| t == wxEVT_ACTIVATE +#endif || t == wxEVT_COMMAND_TOOL_CLICKED) { // close the list, and pass on the event diff --git a/src/script/functions/json.cpp b/src/script/functions/json.cpp new file mode 100644 index 00000000..db0eb272 --- /dev/null +++ b/src/script/functions/json.cpp @@ -0,0 +1,595 @@ +//+----------------------------------------------------------------------------+ +//| Description: Magic Set Editor - Program to make Magic (tm) cards | +//| Copyright: (C) Twan van Laarhoven and the other MSE developers | +//| License: GNU General Public License 2 or later (see file COPYING) | +//+----------------------------------------------------------------------------+ + + +// ----------------------------------------------------------------------------- : Includes + +#include