Commit 1847fb7d authored by twanvl's avatar twanvl

implemented 'default set style', so that doesn't have to be duplicated for each style

parent 8667020f
......@@ -41,54 +41,6 @@ init script:
}
############################################################## Set info fields
info style:
title:
padding left: 2
font:
size: 16
symbol:
variation:
name: common
border radius: 0.10
fill type: solid
fill color: rgb(0,0,0)
border color: rgb(255,255,255)
variation:
name: uncommon
border radius: 0.05
fill type: linear gradient
fill color 1: rgb(224,224,224)
fill color 2: rgb(84, 84, 84)
border color 1: rgb(0, 0, 0)
border color 2: rgb(0, 0, 0)
variation:
name: rare
border radius: 0.05
fill type: linear gradient
fill color 1: rgb(214,196,94)
fill color 2: rgb(95, 84, 40)
border color 1: rgb(0, 0, 0)
border color 2: rgb(0, 0, 0)
variation:
name: special
border radius: 0.10
fill type: linear gradient
fill color 1: rgb(224,170,247)
fill color 2: rgb(58,7,80)
border color 1: rgb(255,255,255)
border color 2: rgb(255,255,255)
automatic reminder text:
render style: both
choice images:
yes: script: buildin_image("bool_yes")
no: script: buildin_image("bool_no")
use gradient multicolor:
render style: both
choice images:
yes: script: buildin_image("bool_yes")
no: script: buildin_image("bool_no")
############################################################## Extra style
......
......@@ -273,6 +273,15 @@ set field:
choice: only for custom keywords
choice: no
description: Should reminder text be added to keywords by default? Note: you can enable/disable reminder text by right clicking the keyword.
set field:
# TODO : RENAME
type: multiple choice
name: automatic reminder text2
choice: old keywords
choice: core set keywords
choice: expert level keywords
choice: custom keywords
description: Should reminder text be added to keywords by default? Note: you can enable/disable reminder text by right clicking the keyword.
set field:
type: boolean
name: automatic card numbers
......@@ -290,6 +299,58 @@ set field:
description: Use gradients on multicolor cards by default, you can always change it be clicking on the card border.
initial: no
############################# Default style
default set style:
title:
padding left: 2
font:
size: 16
symbol:
variation:
name: common
border radius: 0.10
fill type: solid
fill color: rgb(0,0,0)
border color: rgb(255,255,255)
variation:
name: uncommon
border radius: 0.05
fill type: linear gradient
fill color 1: rgb(224,224,224)
fill color 2: rgb(84, 84, 84)
border color 1: rgb(0, 0, 0)
border color 2: rgb(0, 0, 0)
variation:
name: rare
border radius: 0.05
fill type: linear gradient
fill color 1: rgb(214,196,94)
fill color 2: rgb(95, 84, 40)
border color 1: rgb(0, 0, 0)
border color 2: rgb(0, 0, 0)
variation:
name: special
border radius: 0.10
fill type: linear gradient
fill color 1: rgb(224,170,247)
fill color 2: rgb(58,7,80)
border color 1: rgb(255,255,255)
border color 2: rgb(255,255,255)
automatic reminder text:
render style: both
choice images:
yes: script: buildin_image("bool_yes")
no: script: buildin_image("bool_no")
automatic reminder text2:
render style: checklist
direction: vertical
use gradient multicolor:
render style: both
choice images:
yes: script: buildin_image("bool_yes")
no: script: buildin_image("bool_no")
############################################################## Card fields
############################# Background stuff
......@@ -719,10 +780,6 @@ statistics dimension:
numeric: true
icon: stats/casting_cost.png
statistics dimension:
name: rarity_twice
script: card.rarity + card.rarity
statistics category:
name: color / rarity
dimension: card_color
......@@ -805,6 +862,19 @@ statistics category:
has keywords: true
keyword mode:
name: old
description: Old keywords (Banding, Phasing, etc.)
keyword mode:
name: core
description: Core set keywords (Flying, Haste, etc.)
keyword mode:
name: expert
description: Expert level keywords (Cycling, Vanishing, etc.)
keyword mode:
name: custom
description: Custom keywords
keyword parameter type:
name: no parameter
keyword parameter type:
......
......@@ -92,6 +92,9 @@ class Style {
inline RealSize getSize() const { return RealSize ( width, height); }
inline RealRect getRect() const { return RealRect (left, top, width, height); }
/// Get a copy of this style
virtual StyleP clone() const = 0;
/// Make a viewer object for values using this style
/** thisP is a smart pointer to this */
virtual ValueViewerP makeViewer(DataViewer& parent, const StyleP& thisP) = 0;
......@@ -157,12 +160,16 @@ template <> ValueP read_new<Value>(Reader&);
ValueP Type ## Field::newValue(const FieldP& thisP) const { \
assert(thisP.get() == this); \
return new_shared1<Type ## Value>(static_pointer_cast<Type ## Field>(thisP)); \
} \
StyleP Type ## Style::clone() const { \
return new_shared1<Type ## Style>(*this); \
}
#define DECLARE_STYLE_TYPE(Type) \
DECLARE_HAS_FIELD(Type) \
virtual StyleP clone() const; \
virtual ValueViewerP makeViewer(DataViewer& parent, const StyleP& thisP); \
virtual ValueViewerP makeEditor(DataEditor& parent, const StyleP& thisP)
virtual ValueViewerP makeEditor(DataEditor& parent, const StyleP& thisP);
// implement field() which returns a field with the right (derived) type
#define DECLARE_HAS_FIELD(Type) \
......
......@@ -37,6 +37,7 @@ class BooleanStyle : public ChoiceStyle {
public:
BooleanStyle(const ChoiceFieldP& field);
DECLARE_HAS_FIELD(Boolean); // not DECLARE_STYLE_TYPE, because we use a normal ChoiceValueViewer/Editor
virtual StyleP clone() const;
// no extra data
......
......@@ -40,6 +40,9 @@ IMPLEMENT_REFLECTION(Game) {
REFLECT_BASE(Packaged);
REFLECT(init_script);
REFLECT(set_fields);
REFLECT_IF_READING {
default_set_style.init(set_fields);
}
REFLECT(default_set_style);
REFLECT(card_fields);
REFLECT(statistics_dimensions);
......
......@@ -69,8 +69,8 @@ IMPLEMENT_REFLECTION(StyleSheet) {
REFLECT(card_background);
if (game) {
REFLECT_IF_READING {
card_style .init(game->card_fields);
set_info_style.init(game->set_fields);
card_style.init(game->card_fields);
set_info_style.cloneFrom(game->default_set_style);
}
REFLECT(card_style);
REFLECT(set_info_style);
......
......@@ -53,6 +53,15 @@ class IndexMap : private vector<Value> {
init_object(key, (*this)[key->index]);
}
}
/// Initialize this map with cloned values from another list
void cloneFrom(const IndexMap<Key,Value>& values) {
if (this->size() == values.size()) return;
this->reserve(values.size());
for(size_t index = size() ; index < values.size() ; ++index) {
const Value& value = values[index];
push_back(value ? value->clone() : value);
}
}
/// Change this map by adding an additional key and value
void add(const Key& key, const Value& value) {
assert(get_key(value) == key);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment