mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Scripts depending on content_something are re-updating after updating the content properties
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@480 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -139,6 +139,12 @@ void SetScriptManager::initDependencies(Context& ctx, StyleSheet& stylesheet) {
|
||||
s->checkContentDependencies(ctx, test);
|
||||
if (test.index) s->content_dependent = true;
|
||||
}
|
||||
FOR_EACH(s, stylesheet.extra_card_style) {
|
||||
// are there dependencies of this style on other style properties?
|
||||
Dependency test(DEP_DUMMY, false);
|
||||
s->checkContentDependencies(ctx, test);
|
||||
if (test.index) s->content_dependent = true;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : ScriptManager : updating
|
||||
@@ -199,21 +205,24 @@ void SetScriptManager::onAction(const Action& action, bool undone) {
|
||||
}
|
||||
}
|
||||
|
||||
void SetScriptManager::updateStyles(const CardP& card) {
|
||||
void SetScriptManager::updateStyles(const CardP& card, bool only_content_dependent) {
|
||||
assert(card);
|
||||
const StyleSheet& stylesheet = set.stylesheetFor(card);
|
||||
Context& ctx = getContext(card);
|
||||
// update extra card fields
|
||||
IndexMap<FieldP,ValueP>& extra_data = card->extraDataFor(stylesheet);
|
||||
FOR_EACH(v, extra_data) {
|
||||
v->update(ctx);
|
||||
if (!only_content_dependent) {
|
||||
// update extra card fields
|
||||
IndexMap<FieldP,ValueP>& extra_data = card->extraDataFor(stylesheet);
|
||||
FOR_EACH(v, extra_data) {
|
||||
v->update(ctx);
|
||||
}
|
||||
}
|
||||
// update all styles
|
||||
updateStyles(ctx, stylesheet.card_style);
|
||||
updateStyles(ctx, stylesheet.extra_card_style);
|
||||
updateStyles(ctx, stylesheet.card_style, only_content_dependent);
|
||||
updateStyles(ctx, stylesheet.extra_card_style, only_content_dependent);
|
||||
}
|
||||
void SetScriptManager::updateStyles(Context& ctx, const IndexMap<FieldP,StyleP>& styles) {
|
||||
void SetScriptManager::updateStyles(Context& ctx, const IndexMap<FieldP,StyleP>& styles, bool only_content_dependent) {
|
||||
FOR_EACH_CONST(s, styles) {
|
||||
if (only_content_dependent && !s->content_dependent) continue;
|
||||
try {
|
||||
if (s->update(ctx)) {
|
||||
// style has changed, tell listeners
|
||||
|
||||
Reference in New Issue
Block a user