Skip to content

Commit 4477191

Browse files
arunjose696ptziegler
authored andcommitted
Prevent FigureCanvas from propagating autoscale disablement to children
FigureCanvas may contain SWT widgets as children. While FigureCanvas itself is autoscale disabled (scaling handled by GEF), child SWT widgets like cell editors should remain auto-scale enabled. This behavior is achieved by setting a flag on the control that prevents autoscale disablement from being propagated to its children. Fixes #837
1 parent 4167458 commit 4477191

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

org.eclipse.draw2d/src/org/eclipse/draw2d/FigureCanvas.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.eclipse.draw2d.geometry.Dimension;
2626
import org.eclipse.draw2d.geometry.Point;
2727
import org.eclipse.draw2d.geometry.Rectangle;
28+
import org.eclipse.draw2d.internal.InternalDraw2dUtils;
2829

2930
/**
3031
* A scrolling Canvas that contains {@link Figure Figures} viewed through a
@@ -160,6 +161,7 @@ public FigureCanvas(int style, Composite parent, LightweightSystem lws) {
160161
this.lws = lws;
161162
lws.setControl(this);
162163
hook();
164+
InternalDraw2dUtils.setPropagateAutoScaleDisabled(this, false);
163165
}
164166

165167
/**

org.eclipse.draw2d/src/org/eclipse/draw2d/internal/InternalDraw2dUtils.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ public class InternalDraw2dUtils {
4444
*/
4545
private static final String DATA_AUTOSCALE_DISABLED = "AUTOSCALE_DISABLED"; //$NON-NLS-1$
4646

47+
/**
48+
* Data that can be set to make a control not propagate autoScale disabling to
49+
* children.
50+
*/
51+
private static final String DATA_PROPOGATE_AUTOSCALE_DISABLED = "PROPOGATE_AUTOSCALE_DISABLED"; //$NON-NLS-1$
52+
4753
private static final boolean enableAutoScale = "win32".equals(SWT.getPlatform()) //$NON-NLS-1$
4854
&& Boolean.parseBoolean(System.getProperty(DRAW2D_ENABLE_AUTOSCALE, Boolean.TRUE.toString()))
4955
&& SWT.getVersion() >= 4971; // SWT 2025-12 release or higher
@@ -61,6 +67,13 @@ public static void configureForAutoscalingMode(Control control, Consumer<Double>
6167
zoomConsumer.accept(InternalDraw2dUtils.calculateScale(control));
6268
}
6369

70+
public static void setPropagateAutoScaleDisabled(Control control, boolean propagate) {
71+
if (control == null || !isAutoScaleEnabled()) {
72+
return;
73+
}
74+
control.setData(DATA_PROPOGATE_AUTOSCALE_DISABLED, propagate);
75+
}
76+
6477
private static double calculateScale(Control control) {
6578
int shellZoom;
6679
try {

0 commit comments

Comments
 (0)