Content dependent scripted images of (multiple) choice values are now updated correctly

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1064 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-08-05 17:04:03 +00:00
parent dd006b9eca
commit 08a913686c
5 changed files with 20 additions and 0 deletions
+6
View File
@@ -59,6 +59,12 @@ void draw_choice_viewer(RotatedDC& dc, ValueViewer& viewer, ChoiceStyle& style,
if (style.render_style & RENDER_IMAGE) {
// draw image
CachedScriptableImage& img = style.image;
if (style.content_dependent) {
// re run script
Context& ctx = viewer.viewer.getContext();
ctx.setVariable(SCRIPT_VAR_input, to_script(value));
img.update(ctx);
}
if (img.isReady()) {
GeneratedImage::Options img_options;
get_options(dc, viewer, style, img_options);
+5
View File
@@ -82,3 +82,8 @@ void MultipleChoiceValueViewer::drawChoice(RotatedDC& dc, RealPoint& pos, const
// next position
pos = move_in_direction(style().direction, pos, size, style().spacing);
}
void MultipleChoiceValueViewer::onStyleChange(int changes) {
if (changes & CHANGE_MASK) style().image.clearCache();
ValueViewer::onStyleChange(changes);
}
+1
View File
@@ -22,6 +22,7 @@ class MultipleChoiceValueViewer : public ValueViewer {
virtual bool prepare(RotatedDC& dc);
virtual void draw(RotatedDC& dc);
virtual void onStyleChange(int);
protected:
double item_height; ///< Height of a single item, or 0 if non uniform
private: