mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-13 05:57:00 -04:00
Consistent order of style property updates.
See #4 (which is mostly fixed by this commit)
This commit is contained in:
+10
-10
@@ -139,16 +139,16 @@ inline bool is_setw(const Scriptable<double>& x) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Style::update(Context& ctx) {
|
int Style::update(Context& ctx) {
|
||||||
int changed =
|
int changed = 0;
|
||||||
( left .update(ctx)
|
changed |= left .update(ctx) * CHANGE_SIZE;
|
||||||
| width .update(ctx)
|
changed |= width .update(ctx) * CHANGE_SIZE;
|
||||||
| right .update(ctx)
|
changed |= right .update(ctx) * CHANGE_SIZE;
|
||||||
| top .update(ctx)
|
changed |= top .update(ctx) * CHANGE_SIZE;
|
||||||
| height .update(ctx)
|
changed |= height .update(ctx) * CHANGE_SIZE;
|
||||||
| bottom .update(ctx)
|
changed |= bottom .update(ctx) * CHANGE_SIZE;
|
||||||
| angle .update(ctx) ) * CHANGE_SIZE
|
changed |= angle .update(ctx) * CHANGE_SIZE;
|
||||||
| visible.update(ctx) * CHANGE_OTHER
|
changed |= visible.update(ctx) * CHANGE_OTHER;
|
||||||
| mask .update(ctx) * CHANGE_MASK;
|
changed |= mask .update(ctx) * CHANGE_MASK;
|
||||||
// determine automatic_side and attachment of rotation point
|
// determine automatic_side and attachment of rotation point
|
||||||
if (automatic_side == AUTO_UNKNOWN) {
|
if (automatic_side == AUTO_UNKNOWN) {
|
||||||
if (!is_set (right)) automatic_side = (AutomaticSide)(automatic_side | AUTO_RIGHT);
|
if (!is_set (right)) automatic_side = (AutomaticSide)(automatic_side | AUTO_RIGHT);
|
||||||
|
|||||||
@@ -199,19 +199,19 @@ void ChoiceStyle::initImage() {
|
|||||||
|
|
||||||
int ChoiceStyle::update(Context& ctx) {
|
int ChoiceStyle::update(Context& ctx) {
|
||||||
// Don't update the choice images, leave that to invalidate()
|
// Don't update the choice images, leave that to invalidate()
|
||||||
int change = Style::update(ctx)
|
int changes = Style::update(ctx);
|
||||||
| font .update(ctx) * CHANGE_OTHER;
|
changes |= font.update(ctx) * CHANGE_OTHER;
|
||||||
if (!choice_images_initialized) {
|
if (!choice_images_initialized) {
|
||||||
// we only want to do this once because it is rather slow, other updates are handled by dependencies
|
// we only want to do this once because it is rather slow, other updates are handled by dependencies
|
||||||
choice_images_initialized = true;
|
choice_images_initialized = true;
|
||||||
FOR_EACH(ci, choice_images) {
|
FOR_EACH(ci, choice_images) {
|
||||||
if (ci.second.update(ctx)) {
|
if (ci.second.update(ctx)) {
|
||||||
change |= CHANGE_OTHER;
|
changes |= CHANGE_OTHER;
|
||||||
// TODO : remove this thumbnail
|
// TODO : remove this thumbnail
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return change;
|
return changes;
|
||||||
}
|
}
|
||||||
void ChoiceStyle::initDependencies(Context& ctx, const Dependency& dep) const {
|
void ChoiceStyle::initDependencies(Context& ctx, const Dependency& dep) const {
|
||||||
Style::initDependencies(ctx, dep);
|
Style::initDependencies(ctx, dep);
|
||||||
|
|||||||
@@ -27,8 +27,9 @@ IMPLEMENT_REFLECTION(ImageStyle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ImageStyle::update(Context& ctx) {
|
int ImageStyle::update(Context& ctx) {
|
||||||
return Style ::update(ctx)
|
int changes = Style::update(ctx);
|
||||||
| default_image.update(ctx) * CHANGE_DEFAULT;
|
changes |= default_image.update(ctx) * CHANGE_DEFAULT;
|
||||||
|
return changes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------- : ImageValue
|
// ----------------------------------------------------------------------------- : ImageValue
|
||||||
|
|||||||
@@ -38,8 +38,9 @@ InfoStyle::InfoStyle(const InfoFieldP& field)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
int InfoStyle::update(Context& ctx) {
|
int InfoStyle::update(Context& ctx) {
|
||||||
return Style ::update(ctx)
|
int changes = Style::update(ctx);
|
||||||
| font .update(ctx) * CHANGE_OTHER;
|
changes |= font.update(ctx) * CHANGE_OTHER;
|
||||||
|
return changes;
|
||||||
}
|
}
|
||||||
void InfoStyle::initDependencies(Context& ctx, const Dependency& dep) const {
|
void InfoStyle::initDependencies(Context& ctx, const Dependency& dep) const {
|
||||||
Style ::initDependencies(ctx, dep);
|
Style ::initDependencies(ctx, dep);
|
||||||
|
|||||||
@@ -40,9 +40,10 @@ IMPLEMENT_REFLECTION(MultipleChoiceStyle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int MultipleChoiceStyle::update(Context& ctx) {
|
int MultipleChoiceStyle::update(Context& ctx) {
|
||||||
return ChoiceStyle::update(ctx)
|
int changes = ChoiceStyle::update(ctx);
|
||||||
| direction.update(ctx) * CHANGE_OTHER
|
changes |= direction.update(ctx) * CHANGE_OTHER;
|
||||||
| spacing.update(ctx) * CHANGE_OTHER;
|
changes |= spacing.update(ctx) * CHANGE_OTHER;
|
||||||
|
return changes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------- : MultipleChoiceValue
|
// ----------------------------------------------------------------------------- : MultipleChoiceValue
|
||||||
|
|||||||
@@ -35,8 +35,9 @@ PackageChoiceStyle::PackageChoiceStyle(const PackageChoiceFieldP& field)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
int PackageChoiceStyle::update(Context& ctx) {
|
int PackageChoiceStyle::update(Context& ctx) {
|
||||||
return Style ::update(ctx)
|
int changes = Style::update(ctx);
|
||||||
| font .update(ctx) * CHANGE_OTHER;
|
changes |= font.update(ctx) * CHANGE_OTHER;
|
||||||
|
return changes;
|
||||||
}
|
}
|
||||||
/*void PackageChoiceStyle::initDependencies(Context& ctx, const Dependency& dep) const {
|
/*void PackageChoiceStyle::initDependencies(Context& ctx, const Dependency& dep) const {
|
||||||
Style ::initDependencies(ctx, dep);
|
Style ::initDependencies(ctx, dep);
|
||||||
|
|||||||
+19
-19
@@ -67,25 +67,25 @@ double TextStyle::getStretch() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int TextStyle::update(Context& ctx) {
|
int TextStyle::update(Context& ctx) {
|
||||||
return Style ::update(ctx)
|
int changes = Style::update(ctx);
|
||||||
| font .update(ctx) * CHANGE_OTHER
|
changes |= font .update(ctx) * CHANGE_OTHER;
|
||||||
| symbol_font.update(ctx) * CHANGE_OTHER
|
changes |= symbol_font.update(ctx) * CHANGE_OTHER;
|
||||||
| alignment .update(ctx) * CHANGE_OTHER
|
changes |= alignment .update(ctx) * CHANGE_OTHER;
|
||||||
| ( padding_left .update(ctx)
|
changes |= padding_left .update(ctx) * CHANGE_OTHER;
|
||||||
| padding_left_min .update(ctx)
|
changes |= padding_left_min .update(ctx) * CHANGE_OTHER;
|
||||||
| padding_right .update(ctx)
|
changes |= padding_right .update(ctx) * CHANGE_OTHER;
|
||||||
| padding_right_min .update(ctx)
|
changes |= padding_right_min .update(ctx) * CHANGE_OTHER;
|
||||||
| padding_top .update(ctx)
|
changes |= padding_top .update(ctx) * CHANGE_OTHER;
|
||||||
| padding_top_min .update(ctx)
|
changes |= padding_top_min .update(ctx) * CHANGE_OTHER;
|
||||||
| padding_bottom .update(ctx)
|
changes |= padding_bottom .update(ctx) * CHANGE_OTHER;
|
||||||
| padding_bottom_min .update(ctx)
|
changes |= padding_bottom_min .update(ctx) * CHANGE_OTHER;
|
||||||
| line_height_soft .update(ctx)
|
changes |= line_height_soft .update(ctx) * CHANGE_OTHER;
|
||||||
| line_height_hard .update(ctx)
|
changes |= line_height_hard .update(ctx) * CHANGE_OTHER;
|
||||||
| line_height_line .update(ctx)
|
changes |= line_height_line .update(ctx) * CHANGE_OTHER;
|
||||||
| line_height_soft_max.update(ctx)
|
changes |= line_height_soft_max.update(ctx) * CHANGE_OTHER;
|
||||||
| line_height_hard_max.update(ctx)
|
changes |= line_height_hard_max.update(ctx) * CHANGE_OTHER;
|
||||||
| line_height_line_max.update(ctx)
|
changes |= line_height_line_max.update(ctx) * CHANGE_OTHER;
|
||||||
) * CHANGE_OTHER;
|
return changes;
|
||||||
}
|
}
|
||||||
void TextStyle::initDependencies(Context& ctx, const Dependency& dep) const {
|
void TextStyle::initDependencies(Context& ctx, const Dependency& dep) const {
|
||||||
Style ::initDependencies(ctx, dep);
|
Style ::initDependencies(ctx, dep);
|
||||||
|
|||||||
+9
-9
@@ -25,15 +25,15 @@ Font::Font()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
bool Font::update(Context& ctx) {
|
bool Font::update(Context& ctx) {
|
||||||
bool changes
|
bool changes = false;
|
||||||
= name .update(ctx)
|
changes |= name .update(ctx);
|
||||||
| italic_name .update(ctx)
|
changes |= italic_name .update(ctx);
|
||||||
| size .update(ctx)
|
changes |= size .update(ctx);
|
||||||
| weight .update(ctx)
|
changes |= weight .update(ctx);
|
||||||
| style .update(ctx)
|
changes |= style .update(ctx);
|
||||||
| underline .update(ctx)
|
changes |= underline .update(ctx);
|
||||||
| color .update(ctx)
|
changes |= color .update(ctx);
|
||||||
| shadow_color.update(ctx);
|
changes |= shadow_color.update(ctx);
|
||||||
flags = (flags & ~FONT_BOLD & ~FONT_ITALIC)
|
flags = (flags & ~FONT_BOLD & ~FONT_ITALIC)
|
||||||
| (weight() == _("bold") ? FONT_BOLD : FONT_NORMAL)
|
| (weight() == _("bold") ? FONT_BOLD : FONT_NORMAL)
|
||||||
| (style() == _("italic") ? FONT_ITALIC : FONT_NORMAL);
|
| (style() == _("italic") ? FONT_ITALIC : FONT_NORMAL);
|
||||||
|
|||||||
Reference in New Issue
Block a user