mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 21:06:59 -04:00
Fixed: failed to re-prepare text after content dependent script changed
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@482 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -72,6 +72,6 @@ void ChoiceValueViewer::draw(RotatedDC& dc) {
|
||||
}
|
||||
}
|
||||
|
||||
void ChoiceValueViewer::onStyleChange() {
|
||||
viewer.redraw(*this);
|
||||
void ChoiceValueViewer::onStyleChange(bool already_prepared) {
|
||||
if (!already_prepared) viewer.redraw(*this);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ class ChoiceValueViewer : public ValueViewer {
|
||||
DECLARE_VALUE_VIEWER(Choice) : ValueViewer(parent,style) {}
|
||||
|
||||
virtual void draw(RotatedDC& dc);
|
||||
virtual void onStyleChange();
|
||||
virtual void onStyleChange(bool);
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
|
||||
@@ -86,9 +86,9 @@ bool ColorValueViewer::containsPoint(const RealPoint& p) const {
|
||||
}
|
||||
}
|
||||
|
||||
void ColorValueViewer::onStyleChange() {
|
||||
void ColorValueViewer::onStyleChange(bool already_prepared) {
|
||||
alpha_mask = AlphaMaskP();
|
||||
viewer.redraw(*this);
|
||||
if (!already_prepared) viewer.redraw(*this);
|
||||
}
|
||||
|
||||
void ColorValueViewer::loadMask(const Rotation& rot) const {
|
||||
|
||||
@@ -25,7 +25,7 @@ class ColorValueViewer : public ValueViewer {
|
||||
virtual void draw(RotatedDC& dc);
|
||||
virtual bool containsPoint(const RealPoint& p) const;
|
||||
|
||||
virtual void onStyleChange();
|
||||
virtual void onStyleChange(bool);
|
||||
|
||||
private:
|
||||
mutable AlphaMaskP alpha_mask;
|
||||
|
||||
@@ -77,10 +77,10 @@ void ImageValueViewer::onValueChange() {
|
||||
bitmap = Bitmap();
|
||||
}
|
||||
|
||||
void ImageValueViewer::onStyleChange() {
|
||||
void ImageValueViewer::onStyleChange(bool already_prepared) {
|
||||
bitmap = Bitmap();
|
||||
alpha_mask = AlphaMaskP(); // TODO: only reload whatever has changed
|
||||
viewer.redraw(*this);
|
||||
if (!already_prepared) viewer.redraw(*this);
|
||||
}
|
||||
|
||||
void ImageValueViewer::loadMask(const Rotation& rot) const {
|
||||
|
||||
@@ -27,7 +27,7 @@ class ImageValueViewer : public ValueViewer {
|
||||
virtual bool containsPoint(const RealPoint& p) const;
|
||||
|
||||
virtual void onValueChange();
|
||||
virtual void onStyleChange();
|
||||
virtual void onStyleChange(bool);
|
||||
|
||||
private:
|
||||
Bitmap bitmap;
|
||||
|
||||
@@ -21,12 +21,14 @@ bool TextValueViewer::prepare(RotatedDC& dc) {
|
||||
style().mask.load(image);
|
||||
}
|
||||
}
|
||||
v.prepare(dc, value().value(), style(), viewer.getContext());
|
||||
return true;
|
||||
return v.prepare(dc, value().value(), style(), viewer.getContext());
|
||||
}
|
||||
|
||||
void TextValueViewer::draw(RotatedDC& dc) {
|
||||
drawFieldBorder(dc);
|
||||
if (!v.prepared()) {
|
||||
v.prepare(dc, value().value(), style(), viewer.getContext());
|
||||
}
|
||||
v.draw(dc, style(), (DrawWhat)(
|
||||
DRAW_NORMAL
|
||||
| (viewer.drawBorders() ? DRAW_BORDERS : 0)
|
||||
@@ -38,7 +40,7 @@ void TextValueViewer::onValueChange() {
|
||||
v.reset();
|
||||
}
|
||||
|
||||
void TextValueViewer::onStyleChange() {
|
||||
void TextValueViewer::onStyleChange(bool already_prepared) {
|
||||
v.reset();
|
||||
viewer.redraw(*this);
|
||||
if (!already_prepared) viewer.redraw(*this);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class TextValueViewer : public ValueViewer {
|
||||
virtual bool prepare(RotatedDC& dc);
|
||||
virtual void draw(RotatedDC& dc);
|
||||
virtual void onValueChange();
|
||||
virtual void onStyleChange();
|
||||
virtual void onStyleChange(bool);
|
||||
|
||||
protected:
|
||||
TextViewer v;
|
||||
|
||||
@@ -57,7 +57,8 @@ class ValueViewer : public StyleListener {
|
||||
*/
|
||||
virtual void onValueChange() {}
|
||||
/// Called when a (scripted) property of the associated style has changed
|
||||
virtual void onStyleChange() {}
|
||||
/** If alread_prepared, should make sure the viewer stays in a state similair to that after prepare() */
|
||||
virtual void onStyleChange(bool already_prepared) {}
|
||||
/// Called when an action is performed on the associated value
|
||||
virtual void onAction(const Action&, bool undone) { onValueChange(); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user