Skip to content

Commit 5a25367

Browse files
committed
CSSTUDIO-2939 Add boolean preference option 'org.csstudio.display.builder.model/enable_svg_rendering_resolution_factor' to configure whether the "SVG Rendering Resolution Factor" widget property is available in the Picture and Symbol widgets.
1 parent 41f4bc2 commit 5a25367

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

app/display/model/src/main/java/org/csstudio/display/builder/model/Preferences.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ public class Preferences
3737
@Preference(name="macros") private static String macro_spec;
3838
/** Preference setting */
3939
@Preference public static boolean enable_saved_on_comments;
40+
/** Preference setting */
41+
@Preference public static boolean enable_svg_rendering_resolution_factor;
42+
4043
private static Macros macros;
4144

4245
static

app/display/model/src/main/java/org/csstudio/display/builder/model/widgets/PictureWidget.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import java.util.List;
1616

1717
import org.csstudio.display.builder.model.Messages;
18+
import org.csstudio.display.builder.model.Preferences;
1819
import org.csstudio.display.builder.model.Version;
1920
import org.csstudio.display.builder.model.Widget;
2021
import org.csstudio.display.builder.model.WidgetCategory;
@@ -134,7 +135,10 @@ protected void defineProperties(final List<WidgetProperty<?>> properties)
134135
properties.add(stretch_image = propStretch.createProperty(this, false));
135136
properties.add(rotation = propRotation.createProperty(this, 0.0));
136137
properties.add(opacity = propOpacity.createProperty(this, 1.0));
137-
properties.add(svgRenderingResolutionFactor = propSVGRenderingResolutionFactor.createProperty(this, 1.0));
138+
svgRenderingResolutionFactor = propSVGRenderingResolutionFactor.createProperty(this, 1.0);
139+
if (Preferences.enable_svg_rendering_resolution_factor) {
140+
properties.add(svgRenderingResolutionFactor);
141+
}
138142
}
139143

140144
/** @return 'rotation' property */

app/display/model/src/main/java/org/csstudio/display/builder/model/widgets/SymbolWidget.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
import org.csstudio.display.builder.model.ArrayWidgetProperty;
2727
import org.csstudio.display.builder.model.Messages;
28+
import org.csstudio.display.builder.model.Preferences;
2829
import org.csstudio.display.builder.model.Version;
2930
import org.csstudio.display.builder.model.Widget;
3031
import org.csstudio.display.builder.model.WidgetCategory;
@@ -252,7 +253,12 @@ protected void defineProperties ( final List<WidgetProperty<?>> properties ) {
252253
properties.add(enabled = propEnabled.createProperty(this, true));
253254
properties.add(preserve_ratio = propPreserveRatio.createProperty(this, true));
254255
properties.add(fallbackSymbol = propFallbackSymbol.createProperty(this, DEFAULT_SYMBOL));
255-
properties.add(svgRenderingResolutionFactor = propSVGRenderingResolutionFactor.createProperty(this, 1.0));
256+
257+
svgRenderingResolutionFactor = propSVGRenderingResolutionFactor.createProperty(this, 1.0);
258+
if (Preferences.enable_svg_rendering_resolution_factor) {
259+
properties.add(svgRenderingResolutionFactor);
260+
}
261+
256262
WidgetColor alarmInvalidColor =
257263
WidgetColorService.getColor(NamedWidgetColors.ALARM_INVALID);
258264
WidgetColor defaultDisconnectedOverlayColor =

app/display/model/src/main/resources/display_model_preferences.properties

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,10 @@ skip_defaults=true
8888

8989
# Add a comment containing the date, time, and username when saving an OPI in the Display Editor.
9090
enable_saved_on_comments=true
91+
92+
# Enable the "SVG Rendering Resolution Factor" widget property to the Symbol and Picture widgets.
93+
# This functionality can enable a sharper image when zooming in, at the expense of a quadratic
94+
# increase in memory consumption. E.g., by setting the SVG rendering resolution factor to 2.0, an
95+
# SVG can be rendered at twice the width and twice the height, but the memory required to
96+
# represent the image grows by a factor of four.
97+
org.csstudio.display.builder.model/enable_svg_rendering_resolution_factor=false

0 commit comments

Comments
 (0)