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:
twanvl
2007-05-10 00:47:27 +00:00
parent 71adbf8545
commit 00b3e3a3cd
28 changed files with 282 additions and 531 deletions
+4 -3
View File
@@ -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);