mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
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:
@@ -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()), _("")));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user