Automatic conversion of keyword parameter to number;

Made alignment scriptable

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@386 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-05-17 00:46:57 +00:00
parent d2fe3b6ba0
commit ee8f14c2ed
6 changed files with 21 additions and 3 deletions
+3 -1
View File
@@ -59,7 +59,9 @@ TextStyle::TextStyle(const TextFieldP& field)
bool TextStyle::update(Context& ctx) {
return Style ::update(ctx)
| font .update(ctx)
| symbol_font.update(ctx);
| symbol_font.update(ctx)
| alignment .update(ctx)
| angle .update(ctx);
}
void TextStyle::initDependencies(Context& ctx, const Dependency& dep) const {
Style ::initDependencies(ctx, dep);
+2 -2
View File
@@ -66,8 +66,8 @@ class TextStyle : public Style {
SymbolFontRef symbol_font; ///< Symbol font for symbols in the text
bool always_symbol; ///< Should everything be drawn as symbols?
bool allow_formating; ///< Is formating (bold/italic/..) allowed?
Alignment alignment; ///< Alignment inside the box
int angle; ///< Angle of the text inside the box
Scriptable<Alignment> alignment; ///< Alignment inside the box
Scriptable<int> angle; ///< Angle of the text inside the box
double padding_left, padding_left_min; ///< Padding
double padding_right, padding_right_min; ///< Padding
double padding_top, padding_top_min; ///< Padding
+7
View File
@@ -637,6 +637,7 @@ String KeywordDatabase::expand(const String& text,
ScriptType KeywordParamValue::type() const { return SCRIPT_STRING; }
String KeywordParamValue::typeName() const { return _("keyword parameter"); }
KeywordParamValue::operator String() const {
String safe_type = replace_all(replace_all(replace_all(type_name,
_("("),_("-")),
@@ -644,6 +645,12 @@ KeywordParamValue::operator String() const {
_(" "),_("-"));
return _("<param-") + safe_type + _(">") + value + _("</param-") + safe_type + _(">");
}
KeywordParamValue::operator int() const { return *to_script(value); } // a bit of a hack
KeywordParamValue::operator double() const { return *to_script(value); }
KeywordParamValue::operator Color() const { return *to_script(value); }
int KeywordParamValue::itemCount() const { return to_script(value)->itemCount(); }
ScriptValueP KeywordParamValue::getMember(const String& name) const {
if (name == _("type")) return to_script(type_name);
if (name == _("separator before")) return to_script(separator_before);
+4
View File
@@ -163,6 +163,10 @@ class KeywordParamValue : public ScriptValue {
virtual ScriptType type() const;
virtual String typeName() const;
virtual operator String() const;
virtual operator int() const;
virtual operator double() const;
virtual operator Color() const;
virtual int itemCount() const;
virtual ScriptValueP getMember(const String& name) const;
};