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
+8 -3
View File
@@ -35,8 +35,7 @@ DropDownMultipleChoiceList::DropDownMultipleChoiceList
void DropDownMultipleChoiceList::select(size_t item) {
MultipleChoiceValueEditor& mcve = dynamic_cast<MultipleChoiceValueEditor&>(cve);
if (isFieldDefault(item)) {
// make default
mcve.getSet().actions.add(value_action(mcve.valueP(), Defaultable<String>()));
mcve.toggleDefault();
} else {
ChoiceField::ChoiceP choice = getChoice(item);
mcve.toggle(choice->first_id);
@@ -143,6 +142,7 @@ void MultipleChoiceValueEditor::onValueChange() {
void MultipleChoiceValueEditor::toggle(int id) {
String new_value;
String toggled_choice;
// old selection
vector<String> selected;
value().get(selected);
@@ -157,7 +157,12 @@ void MultipleChoiceValueEditor::toggle(int id) {
if (!new_value.empty()) new_value += _(", ");
new_value += choice;
}
if (i == id) toggled_choice = choice;
}
// store value
getSet().actions.add(value_action(valueP(), new_value));
getSet().actions.add(value_action(valueP(), new_value, toggled_choice));
}
void MultipleChoiceValueEditor::toggleDefault() {
getSet().actions.add(value_action(valueP(), Defaultable<String>(value().value(), !value().value.isDefault()), _("")));
}