mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-13 05:57:00 -04:00
Fixed crash when copying cards with has_styling
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@732 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -67,6 +67,8 @@ IMPLEMENT_REFLECTION(Card) {
|
|||||||
} else if (stylesheet_for_reading()) {
|
} else if (stylesheet_for_reading()) {
|
||||||
REFLECT_IF_READING styling_data.init(stylesheet_for_reading()->styling_fields);
|
REFLECT_IF_READING styling_data.init(stylesheet_for_reading()->styling_fields);
|
||||||
REFLECT(styling_data);
|
REFLECT(styling_data);
|
||||||
|
} else if (tag.reading()) {
|
||||||
|
has_styling = false; // We don't know the style, this can be because of copy/pasting
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
REFLECT(notes);
|
REFLECT(notes);
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include <data/card.hpp>
|
#include <data/card.hpp>
|
||||||
#include <data/set.hpp>
|
#include <data/set.hpp>
|
||||||
#include <data/game.hpp>
|
#include <data/game.hpp>
|
||||||
|
#include <data/stylesheet.hpp>
|
||||||
#include <data/keyword.hpp>
|
#include <data/keyword.hpp>
|
||||||
#include <util/io/package.hpp>
|
#include <util/io/package.hpp>
|
||||||
#include <script/scriptable.hpp>
|
#include <script/scriptable.hpp>
|
||||||
@@ -59,7 +60,15 @@ wxDataFormat CardDataObject::format = _("application/x-mse-card");
|
|||||||
|
|
||||||
CardDataObject::CardDataObject(const SetP& set, const CardP& card) {
|
CardDataObject::CardDataObject(const SetP& set, const CardP& card) {
|
||||||
WrappedCard data = { set->game.get(), set->game->name(), card };
|
WrappedCard data = { set->game.get(), set->game->name(), card };
|
||||||
|
bool has_styling = card->has_styling && !card->stylesheet;
|
||||||
|
if (has_styling) {
|
||||||
|
// set the stylsheet, so when deserializing we know whos style options we are reading
|
||||||
|
card->stylesheet = set->stylesheet;
|
||||||
|
}
|
||||||
SetText(serialize_for_clipboard(*set, data));
|
SetText(serialize_for_clipboard(*set, data));
|
||||||
|
if (has_styling) {
|
||||||
|
card->stylesheet = StyleSheetP(); // restore card
|
||||||
|
}
|
||||||
SetFormat(format);
|
SetFormat(format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user