Added <color:???> and <size:???> tags for changing text color/size

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@831 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-03-24 14:52:42 +00:00
parent 451158820a
commit 4defac43ff
7 changed files with 53 additions and 11 deletions
+7 -4
View File
@@ -368,12 +368,15 @@ template <> void Reader::handle(Vector2D& vec) {
}
template <> void Reader::handle(Color& col) {
col = parse_color(getValue());
if (!col.Ok()) col = *wxBLACK;
}
Color parse_color(const String& v) {
UInt r,g,b;
if (wxSscanf(getValue().c_str(),_("rgb(%u,%u,%u)"),&r,&g,&b)) {
col.Set(r, g, b);
if (wxSscanf(v.c_str(),_("rgb(%u,%u,%u)"),&r,&g,&b)) {
return Color(r, g, b);
} else {
col = Color(previous_value);
if (!col.Ok()) col = *wxBLACK;
return Color(v);
}
}
+3
View File
@@ -251,6 +251,9 @@ void Reader::handle(IndexMap<K,V>& m) {
// ----------------------------------------------------------------------------- : Reflection for enumerations
/// Parse a color
Color parse_color(const String& value);
/// Implement enum reflection as used by Reader
#define REFLECT_ENUM_READER(Enum) \
template<> void Reader::handle<Enum>(Enum& enum_) { \