cleaned up magic keywords; correct drawing of placeholders

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@235 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-03-24 22:06:15 +00:00
parent f1c5a8b974
commit 7deecad835
9 changed files with 153 additions and 82 deletions
+5 -1
View File
@@ -27,7 +27,7 @@ void Font::initDependencies(Context& ctx, const Dependency& dep) const {
shadow_color.initDependencies(ctx, dep);
}
FontP Font::make(bool bold, bool italic) const {
FontP Font::make(bool bold, bool italic, bool placeholder_color) const {
FontP f(new Font(*this));
if (bold) f->font.SetWeight(wxBOLD);
if (italic) {
@@ -37,6 +37,10 @@ FontP Font::make(bool bold, bool italic) const {
f->font.SetWeight(wxBOLD);
}
}
if (placeholder_color) {
f->color = f->separator_color;
f->shadow_displacement = RealSize(0,0); // no shadow
}
return f;
}
+2 -2
View File
@@ -40,8 +40,8 @@ class Font {
/// Does this font have a shadow?
inline bool hasShadow() { return shadow_displacement.width != 0 || shadow_displacement.height != 0; }
/// Make a bold/italic version of this font
FontP make(bool bold, bool italic) const;
/// Make a bold/italic/placeholder version of this font
FontP make(bool bold, bool italic, bool placeholder_color) const;
private:
DECLARE_REFLECTION();
+3 -2
View File
@@ -360,14 +360,15 @@ String KeywordDatabase::expand(const String& text,
// j = even -> parameter #(j/2)
size_t start_u, len_u;
kw->matchRe.GetMatch(&start_u, &len_u, j);
size_t part_end = untagged_to_index(s, start_u + len_u, true);
// note: start_u can be (uint)-1 when len_u == 0
size_t part_end = len_u > 0 ? untagged_to_index(s, start_u + len_u, true) : start;
String part = s.substr(start, part_end - start);
if ((j % 2) == 0) {
// parameter
String param = untagged.substr(start_u, len_u); // untagged version
if (param.empty()) {
// placeholder
param = _("<atom-kwpph>") + kw->parameters[j/2-1]->name + _("</atom-kwpph>");
param = _("<atom-kwpph>") + kw->parameters[j/2-1]->name + _("</atom-kwpph>");
part = part + param; // keep tags
} else if (kw->parameters[j/2-1]->script) {
// apply parameter script