diff --git a/src/data/field/choice.cpp b/src/data/field/choice.cpp index 9ed4f313..71fe6ba0 100644 --- a/src/data/field/choice.cpp +++ b/src/data/field/choice.cpp @@ -214,11 +214,8 @@ void ChoiceStyle::initImage() { int ChoiceStyle::update(Context& ctx) { // Don't update the choice images, leave that to invalidate() int change = Style ::update(ctx) - | font .update(ctx) * CHANGE_OTHER; - if (mask_filename.update(ctx)) { - change |= CHANGE_MASK; - mask = Image(); - } + | font .update(ctx) * CHANGE_OTHER + | mask .update(ctx) * CHANGE_MASK; if (!choice_images_initialized) { // we only want to do this once because it is rather slow, other updates are handled by dependencies choice_images_initialized = true; @@ -255,13 +252,6 @@ void ChoiceStyle::invalidate() { tellListeners(CHANGE_OTHER); } -void ChoiceStyle::loadMask(Package& pkg) { - if (mask.Ok() || mask_filename().empty()) return; - // load file - InputStreamP image_file = pkg.openIn(mask_filename); - mask.LoadFile(*image_file); -} - IMPLEMENT_REFLECTION_ENUM(ChoicePopupStyle) { VALUE_N("dropdown", POPUP_DROPDOWN); VALUE_N("menu", POPUP_MENU); @@ -293,7 +283,7 @@ IMPLEMENT_REFLECTION(ChoiceStyle) { REFLECT_BASE(Style); REFLECT(popup_style); REFLECT(render_style); - REFLECT_N("mask",mask_filename); + REFLECT(mask); REFLECT(combine); REFLECT(alignment); REFLECT(font); diff --git a/src/data/field/choice.hpp b/src/data/field/choice.hpp index b8299b3f..1b5bc007 100644 --- a/src/data/field/choice.hpp +++ b/src/data/field/choice.hpp @@ -143,20 +143,17 @@ class ChoiceStyle : public Style { ChoicePopupStyle popup_style; ///< Style of popups/menus ChoiceRenderStyle render_style; ///< Style of rendering Font font; ///< Font for drawing text (when RENDER_TEXT) - CachedScriptableImage image; ///< Image to draw (when RENDER_IMAGE) + CachedScriptableImage image; ///< Image to draw (when RENDER_IMAGE) map choice_images; ///< Images for the various choices (when RENDER_IMAGE) bool choice_images_initialized; - Scriptable mask_filename; ///< Filename of an additional mask over the images + CachedScriptableMask mask; ///< Mask image ImageCombine combine; ///< Combining mode for drawing the images Alignment alignment; ///< Alignment of images - Image mask; ///< The actual mask image wxImageList* thumbnails; ///< Thumbnails for the choices - vector thumbnails_status; ///< Which thumbnails are up to date? + vector thumbnails_status; ///< Which thumbnails are up to date? // information from image rendering double content_width, content_height; ///< Size of the rendered image/text - /// Load the mask image, if it's not already done - void loadMask(Package& pkg); /// Initialize image from choice_images void initImage(); diff --git a/src/data/field/color.cpp b/src/data/field/color.cpp index b17b9386..c916cd1b 100644 --- a/src/data/field/color.cpp +++ b/src/data/field/color.cpp @@ -62,13 +62,13 @@ IMPLEMENT_REFLECTION(ColorStyle) { REFLECT(right_width); REFLECT(top_width); REFLECT(bottom_width); - REFLECT_N("mask", mask_filename); + REFLECT(mask); REFLECT(combine); } int ColorStyle::update(Context& ctx) { - return Style ::update(ctx) - | mask_filename.update(ctx) * CHANGE_MASK; + return Style::update(ctx) + | mask.update(ctx) * CHANGE_MASK; } // ----------------------------------------------------------------------------- : ColorValue diff --git a/src/data/field/color.hpp b/src/data/field/color.hpp index 37942fde..bf0244e7 100644 --- a/src/data/field/color.hpp +++ b/src/data/field/color.hpp @@ -13,6 +13,7 @@ #include #include #include