mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
implemented 'default set style', so that doesn't have to be duplicated for each style
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@224 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
+8
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user