mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Conversion to new ScriptableImage complete, this affected quite a bit, including the evil thumbnail thread;
Added StyleListener, so style changes are only propagated to interested viewers. git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@329 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -75,7 +75,7 @@ Context& SetScriptContext::getContext(const CardP& card) {
|
||||
if (card) {
|
||||
ctx.setVariable(_("card"), to_script(card));
|
||||
} else {
|
||||
ctx.setVariable(_("card"), script_nil);
|
||||
ctx.setVariable(_("card"), ScriptValueP());
|
||||
}
|
||||
return ctx;
|
||||
}
|
||||
@@ -190,8 +190,9 @@ void SetScriptManager::updateStyles(const CardP& card) {
|
||||
// update all styles
|
||||
FOR_EACH(s, stylesheet->card_style) {
|
||||
if (s->update(ctx)) {
|
||||
s->tellListeners();
|
||||
// style has changed, tell listeners
|
||||
// ScriptStyleEvent change(s.get());
|
||||
//%% ScriptStyleEvent change(stylesheet.get(), s.get());
|
||||
// set->actions.tellListeners(change);
|
||||
}
|
||||
}
|
||||
@@ -298,7 +299,7 @@ void SetScriptManager::alsoUpdate(deque<ToUpdate>& to_update, const vector<Depen
|
||||
// because the index is not exact enough, it only gives the field
|
||||
StyleSheet* stylesheet = reinterpret_cast<StyleSheet*>(d.data);
|
||||
StyleP style = stylesheet->card_style.at(d.index);
|
||||
style->invalidate();
|
||||
style->invalidate(getContext(card));
|
||||
// something changed, send event
|
||||
ScriptStyleEvent change(stylesheet, style.get());
|
||||
set.actions.tellListeners(change, false);
|
||||
|
||||
Reference in New Issue
Block a user