Choice rendering now uses "style.image()" instead of "style.choice_images[value]";

Added script functions for working with multiple choice values;
Added in_context support for filter_rule;
Optimized toUpper/toLower because they are slow on windows (they use thread local storage and mutexes)

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@427 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-06-17 13:13:56 +00:00
parent 59d0aee4e7
commit 97e0e8d6d6
16 changed files with 325 additions and 49 deletions
+27 -3
View File
@@ -41,6 +41,30 @@ void writeUTF8(wxTextOutputStream& stream, const String& str) {
#endif
}
// ----------------------------------------------------------------------------- : Char functions
#ifdef CHAR_FUNCTIONS_ARE_SLOW
Char toLower(Char c) {
if (c <= 128) {
if (c >= _('A') && c <= _('Z')) return c + (_('a') - _('A'));
else return c;
} else {
return IF_UNICODE( towlower(c) , tolower(c) );
}
}
Char toUpper(Char c) {
if (c <= 128) {
if (c >= _('a') && c <= _('z')) return c + (_('A') - _('a'));
else return c;
} else {
return IF_UNICODE( towupper(c) , toupper(c) );
}
}
#endif
// ----------------------------------------------------------------------------- : String utilities
String trim(const String& s){
@@ -180,7 +204,6 @@ bool smart_less(const String& as, const String& bs) {
bool eq = true; // so far is everything equal?
FOR_EACH_2_CONST(a, as, b, bs) {
bool na = isDigit(a), nb = isDigit(b);
Char la = toLower(a), lb = toLower(b);
if (na && nb) {
// compare numbers
in_num = true;
@@ -198,8 +221,9 @@ bool smart_less(const String& as, const String& bs) {
return lt;
} else {
// compare characters
if (la < lb) return true;
if (la > lb) return false;
Char la = toLower(a), lb = toLower(b);
if (la < lb) return true;
if (la > lb) return false;
}
in_num = na && nb;
}