Nicer colors for card list/stats panel;

Keywords updated so <name><cost> splits correctly

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@352 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-05-13 15:34:40 +00:00
parent 8d5fc6949f
commit 7bad8154e3
4 changed files with 163 additions and 19 deletions
+10
View File
@@ -359,6 +359,7 @@ void KeywordDatabase::add(const Keyword& kw) {
// Add to trie
String text; // normal text
size_t param = 0;
bool only_star = true;
for (size_t i = 0 ; i < kw.match.size() ;) {
Char c = kw.match.GetChar(i);
if (is_substr(kw.match, i, _("<atom-param"))) {
@@ -384,9 +385,18 @@ void KeywordDatabase::add(const Keyword& kw) {
cur = cur->insert(text);
text.clear();
cur = cur->insertAnyStar();
// enough?
if (!only_star) {
// If we have matched anything specific, this is a good time to stop
// it doesn't really matter how long we go on, since the trie is only used
// as an optimization to not have to match lots of regexes.
// As an added bonus, we get a better behaviour of matching earlier keywords first.
break;
}
} else {
text += c;
i++;
only_star = false;
}
}
cur = cur->insert(text);
+6 -2
View File
@@ -137,7 +137,11 @@ int KeywordList::OnGetItemImage(long pos) const {
wxListItemAttr* KeywordList::OnGetItemAttr(long pos) const {
// black for set keywords, grey for game keywords (uneditable)
const Keyword& kw = *getKeyword(pos);
if (!kw.fixed) return nullptr;
item_attr.SetTextColour(lerp(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW),wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT),0.5));
if (!kw.fixed && kw.valid) return nullptr;
if (!kw.valid) {
item_attr.SetTextColour(*wxRED);
} else if (kw.fixed) {
item_attr.SetTextColour(lerp(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW),wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT),0.5));
}
return &item_attr;
}