mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
Support for extra card fields in stylesheets;
Fixed some bugs: - Missing choice images can crash mse. - The wrong style is used for making preview choice images on style panel. FOR_EACH(x, *y.z) should now work without parentheses on linux as well. git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@389 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -34,6 +34,9 @@ class Card : public IntrusivePtrVirtualBase {
|
||||
/// The values on the fields of the card.
|
||||
/** The indices should correspond to the card_fields in the Game */
|
||||
IndexMap<FieldP, ValueP> data;
|
||||
/// The values on the extra fields of the card.
|
||||
/** The indices should correspond to the extra_card_fields in the StyleSheet */
|
||||
IndexMap<FieldP, ValueP> extra_data;
|
||||
/// Notes for this card
|
||||
String notes;
|
||||
/// Alternative style to use for this card
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ Context& Set::getContext(const CardP& card) {
|
||||
assert(wxThread::IsMain());
|
||||
return script_manager->getContext(card);
|
||||
}
|
||||
void Set::updateFor(const CardP& card) {
|
||||
void Set::updateStyles(const CardP& card) {
|
||||
script_manager->updateStyles(card);
|
||||
}
|
||||
void Set::updateDelayed() {
|
||||
|
||||
+2
-2
@@ -66,8 +66,8 @@ class Set : public Packaged {
|
||||
/// A context for performing scripts on a particular card
|
||||
/** Should only be used from the main thread! */
|
||||
Context& getContext(const CardP& card);
|
||||
/// Update styles for a card
|
||||
void updateFor(const CardP& card);
|
||||
/// Update styles and extra_card_fields for a card
|
||||
void updateStyles(const CardP& card);
|
||||
/// Update scripts that were delayed
|
||||
void updateDelayed();
|
||||
/// A context for performing scripts
|
||||
|
||||
+19
-5
@@ -12,6 +12,7 @@
|
||||
#include <util/io/package_manager.hpp>
|
||||
|
||||
DECLARE_TYPEOF_COLLECTION(StyleSheet*);
|
||||
DECLARE_TYPEOF_COLLECTION(FieldP);
|
||||
|
||||
// ----------------------------------------------------------------------------- : StyleSheet
|
||||
|
||||
@@ -62,22 +63,35 @@ IMPLEMENT_REFLECTION(StyleSheet) {
|
||||
|
||||
REFLECT(game);
|
||||
REFLECT_BASE(Packaged);
|
||||
REFLECT(init_script);
|
||||
REFLECT(card_width);
|
||||
REFLECT(card_height);
|
||||
REFLECT(card_dpi);
|
||||
REFLECT(card_background);
|
||||
REFLECT(init_script);
|
||||
// styling
|
||||
REFLECT(styling_fields);
|
||||
REFLECT_IF_READING styling_style.init(styling_fields);
|
||||
REFLECT(styling_style);
|
||||
// style of game fields
|
||||
if (game) {
|
||||
REFLECT_IF_READING {
|
||||
card_style.init(game->card_fields);
|
||||
set_info_style.cloneFrom(game->default_set_style);
|
||||
}
|
||||
REFLECT(card_style);
|
||||
REFLECT(set_info_style);
|
||||
REFLECT(card_style);
|
||||
}
|
||||
REFLECT(styling_fields);
|
||||
REFLECT_IF_READING styling_style.init(styling_fields);
|
||||
REFLECT(styling_style);
|
||||
// extra card fields
|
||||
REFLECT(extra_card_fields);
|
||||
REFLECT_IF_READING {
|
||||
if (extra_card_style.init(extra_card_fields)) {
|
||||
// make sure the extra_card_fields are not editable and savable
|
||||
FOR_EACH(f, extra_card_fields) {
|
||||
f->editable = f->save_value = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
REFLECT(extra_card_style);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -38,7 +38,10 @@ class StyleSheet : public Packaged {
|
||||
/// The styling for set info fields
|
||||
/** The indices should correspond to the set_fields in the Game */
|
||||
IndexMap<FieldP, StyleP> set_info_style;
|
||||
/// Extra fields for styling
|
||||
/// Extra card fields for boxes and borders
|
||||
vector<FieldP> extra_card_fields;
|
||||
IndexMap<FieldP, StyleP> extra_card_style;
|
||||
/// Extra fields for styling options
|
||||
vector<FieldP> styling_fields;
|
||||
/// The styling for the extra set fields
|
||||
/** The indices should correspond to the styling_fields */
|
||||
|
||||
Reference in New Issue
Block a user