mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
made dependency analysis work without errors for magic-new (except for a few script functions); implemented the rest of the ScriptManager
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@71 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
#include <data/field/choice.hpp>
|
||||
|
||||
DECLARE_TYPEOF_COLLECTION(ChoiceField::ChoiceP);
|
||||
typedef map<String,ScriptableImage> map_String_ScriptableImage;
|
||||
DECLARE_TYPEOF(map_String_ScriptableImage);
|
||||
|
||||
// ----------------------------------------------------------------------------- : ChoiceField
|
||||
|
||||
@@ -23,6 +25,12 @@ String ChoiceField::typeName() const {
|
||||
return _("choice");
|
||||
}
|
||||
|
||||
void ChoiceField::initDependencies(Context& ctx, const Dependency& dep) const {
|
||||
Field ::initDependencies(ctx, dep);
|
||||
script .initDependencies(ctx, dep);
|
||||
default_script.initDependencies(ctx, dep);
|
||||
}
|
||||
|
||||
IMPLEMENT_REFLECTION(ChoiceField) {
|
||||
REFLECT_BASE(Field);
|
||||
REFLECT_N("choices", choices->choices);
|
||||
@@ -156,6 +164,24 @@ ChoiceStyle::ChoiceStyle(const ChoiceFieldP& field)
|
||||
, colors_card_list(false)
|
||||
{}
|
||||
|
||||
// TODO
|
||||
/*
|
||||
void ChoiceStyle::invalidate() {
|
||||
// rebuild choice images
|
||||
}
|
||||
}
|
||||
*/
|
||||
bool ChoiceStyle::update(Context& ctx) {
|
||||
// Don't update the choice images, leave that to invalidate()
|
||||
return Style::update(ctx);
|
||||
}
|
||||
void ChoiceStyle::initDependencies(Context& ctx, const Dependency& dep) const {
|
||||
Style::initDependencies(ctx, dep);
|
||||
FOR_EACH_CONST(ci, choice_images) {
|
||||
ci.second.initDependencies(ctx, dep);
|
||||
}
|
||||
}
|
||||
|
||||
IMPLEMENT_REFLECTION_ENUM(ChoicePopupStyle) {
|
||||
VALUE_N("dropdown", POPUP_DROPDOWN);
|
||||
VALUE_N("menu", POPUP_MENU);
|
||||
@@ -190,6 +216,11 @@ IMPLEMENT_REFLECTION(ChoiceStyle) {
|
||||
String ChoiceValue::toString() const {
|
||||
return value();
|
||||
}
|
||||
bool ChoiceValue::update(Context& ctx) {
|
||||
Value::update(ctx);
|
||||
return field().default_script.invokeOnDefault(ctx, value)
|
||||
| field(). script.invokeOn(ctx, value);
|
||||
}
|
||||
|
||||
IMPLEMENT_REFLECTION_NAMELESS(ChoiceValue) {
|
||||
REFLECT_NAMELESS(value);
|
||||
|
||||
Reference in New Issue
Block a user