mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
Added 'symbol_variation' script function
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@101 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -45,6 +45,19 @@ InputStreamP StyleSheet::openIconFile() {
|
||||
}
|
||||
}
|
||||
|
||||
StyleP StyleSheet::styleFor(const FieldP& field) {
|
||||
if (card_style.containsKey(field)) {
|
||||
return card_style[field];
|
||||
} else if (set_info_style.containsKey(field)) {
|
||||
return set_info_style[field];
|
||||
} else if (styling_style.containsKey(field)) {
|
||||
return styling_style[field];
|
||||
} else {
|
||||
throw InternalError(_("Can not find styling for field '")+field->name+_("'in stylesheet"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IMPLEMENT_REFLECTION(StyleSheet) {
|
||||
// < 0.3.0 didn't use card_ prefix
|
||||
tag.addAlias(300, _("width"), _("card width"));
|
||||
|
||||
@@ -50,6 +50,9 @@ class StyleSheet : public Packaged {
|
||||
|
||||
inline RealRect getCardRect() const { return RealRect(0, 0, card_width, card_height); }
|
||||
|
||||
/// Return the style for a given field, it is not specified what type of field this is.
|
||||
StyleP styleFor(const FieldP& field);
|
||||
|
||||
/// Load a StyleSheet, given a Game and the name of the StyleSheet
|
||||
static StyleSheetP byGameAndName(const Game& game, const String& name);
|
||||
/// name of the package without the game name
|
||||
|
||||
@@ -163,6 +163,26 @@ IMPLEMENT_REFLECTION(Symbol) {
|
||||
REFLECT(parts);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Default symbol
|
||||
|
||||
// A default symbol part, a square, moved by d
|
||||
SymbolPartP default_symbol_part(double d) {
|
||||
SymbolPartP part = new_shared<SymbolPart>();
|
||||
part->points.push_back(new_shared2<ControlPoint>(d + .2, d + .2));
|
||||
part->points.push_back(new_shared2<ControlPoint>(d + .2, d + .8));
|
||||
part->points.push_back(new_shared2<ControlPoint>(d + .8, d + .8));
|
||||
part->points.push_back(new_shared2<ControlPoint>(d + .8, d + .2));
|
||||
part->name = _("Square");
|
||||
return part;
|
||||
}
|
||||
|
||||
// A default symbol, a square
|
||||
SymbolP default_symbol() {
|
||||
SymbolP symbol = new_shared<Symbol>();
|
||||
symbol->parts.push_back(default_symbol_part(0));
|
||||
return symbol;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : SymbolView
|
||||
|
||||
SymbolView::SymbolView() {}
|
||||
|
||||
@@ -162,6 +162,8 @@ class Symbol {
|
||||
DECLARE_REFLECTION();
|
||||
};
|
||||
|
||||
/// A default symbol: a square
|
||||
SymbolP default_symbol();
|
||||
|
||||
// ----------------------------------------------------------------------------- : SymbolView
|
||||
|
||||
|
||||
Reference in New Issue
Block a user