Skip to content

Commit 2794700

Browse files
committed
Implement user defined runtime zoom factor
Add a mechanism to apply a custom zoom factor for the runtime window. The desired zoom factor can be set in settings.ini as: org.csstudio.display.builder.runtime.app/default_zoom_factor=1.23
1 parent 596e165 commit 2794700

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

app/display/runtime/src/main/java/org/csstudio/display/builder/runtime/app/ZoomAction.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
package org.csstudio.display.builder.runtime.app;
99

1010
import org.csstudio.display.builder.representation.javafx.JFXRepresentation;
11+
import org.phoebus.framework.preferences.AnnotatedPreferences;
12+
import org.phoebus.framework.preferences.PreferencesReader;
13+
import org.phoebus.framework.preferences.Preference;
1114

1215
import javafx.application.Platform;
1316
import javafx.scene.control.ComboBox;
@@ -19,20 +22,33 @@ public class ZoomAction extends ComboBox<String>
1922
{
2023
private boolean updating = false;
2124

25+
@Preference public static double default_zoom_factor;
26+
27+
static
28+
{
29+
AnnotatedPreferences.initialize(ZoomAction.class, "/zoom_preferences.properties");
30+
}
31+
2232
/** @param instance {@link DisplayRuntimeInstance} */
2333
public ZoomAction(final DisplayRuntimeInstance instance)
2434
{
2535
setEditable(true);
2636
setPrefWidth(100.0);
2737
getItems().addAll(JFXRepresentation.ZOOM_LEVELS);
28-
setValue(JFXRepresentation.DEFAULT_ZOOM_LEVEL);
2938
// For Ctrl-Wheel zoom gesture
3039
instance.getRepresentation().setZoomListener(txt ->
3140
{
3241
getSelectionModel().clearSelection();
3342
getEditor().setText(txt);
3443
});
3544
setOnAction(event -> zoom(instance.getRepresentation()));
45+
46+
// Add the zoom action into a queue
47+
Platform.runLater(() ->
48+
{
49+
String zoom = String.format("%d %%", (int)(default_zoom_factor * 100));
50+
setValue(zoom);
51+
});
3652
}
3753

3854
private void zoom(final JFXRepresentation representation)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# ----------------------
2+
# Package org.csstudio.display.builder.runtime.app
3+
# ----------------------
4+
5+
# Defualt zoom factor(double) of display runtime window
6+
default_zoom_factor=1.00

0 commit comments

Comments
 (0)