fixes some SWT errors

This commit is contained in:
eyck committed 2026-11-14 17:55:00 +01:00
1 parent 883aeb600b
commit 2b913d0e94
3 files changed
+18 -6

No files matched your search

@@ -456,7 +456,8 @@ public class WaveformCanvas extends Canvas implements IWaveformZoom{
if (currentSelection != null) if (currentSelection != null)
reveal(currentSelection); reveal(currentSelection);
arrowPainter.setTx(currentSelection); arrowPainter.setTx(currentSelection);
redraw(); if(!isDisposed())
redraw();
} }
public void reveal(ITx tx) { public void reveal(ITx tx) {
@@ -601,7 +602,8 @@ public class WaveformCanvas extends Canvas implements IWaveformZoom{
public void setStyleProvider(IWaveformStyleProvider styleProvider) { public void setStyleProvider(IWaveformStyleProvider styleProvider) {
this.styleProvider=styleProvider; this.styleProvider=styleProvider;
redraw(); if(!isDisposed())
redraw();
} }
public int getScaleMagnitude() { public int getScaleMagnitude() {
@@ -531,6 +531,16 @@ public class WaveformView implements IWaveformView {
} }
} }
}); });
getControl().addListener(SWT.Resize, (evt) -> {
int y = waveformCanvas.getVerticalBar().getSelection();
nameListScrolled.setOrigin(nameListScrolled.getOrigin().x, y);
valueListScrolled.setOrigin(valueListScrolled.getOrigin().x, y);
});
getControl().addListener(SWT.Move, (evt) -> {
int y = waveformCanvas.getVerticalBar().getSelection();
nameListScrolled.setOrigin(nameListScrolled.getOrigin().x, y);
valueListScrolled.setOrigin(valueListScrolled.getOrigin().x, y);
});
} }
private Control createFill(Composite pane) { private Control createFill(Composite pane) {
@@ -21,7 +21,7 @@ enum Direction {
} }
private ComponentDistribution calculateComponentDistribution( FlatScrollBar scrollBar, int buttonLength ) { private ComponentDistribution calculateComponentDistribution( FlatScrollBar scrollBar, int buttonLength ) {
return calculateComponentDistribution( scrollBar, buttonLength, getControlBounds( scrollBar ).width ); return Direction.calculateComponentDistribution( scrollBar, buttonLength, getControlBounds( scrollBar ).width );
} }
private Rectangle[] calculateComponentBounds( ComponentDistribution distribution, FlatScrollBar scrollBar ) { private Rectangle[] calculateComponentBounds( ComponentDistribution distribution, FlatScrollBar scrollBar ) {
@@ -61,7 +61,7 @@ enum Direction {
@Override @Override
protected void expand( Control control, int maxExpansion ) { protected void expand( Control control, int maxExpansion ) {
Rectangle bounds = control.getBounds(); Rectangle bounds = control.getBounds();
int expand = expand( bounds.height, maxExpansion ); int expand = super.expand( bounds.height, maxExpansion );
control.setBounds( bounds.x, bounds.y - expand, bounds.width, bounds.height + expand ); control.setBounds( bounds.x, bounds.y - expand, bounds.width, bounds.height + expand );
} }
}, },
@@ -75,7 +75,7 @@ enum Direction {
} }
private ComponentDistribution calculateComponentDistribution( FlatScrollBar scrollBar, int buttonLength ) { private ComponentDistribution calculateComponentDistribution( FlatScrollBar scrollBar, int buttonLength ) {
return calculateComponentDistribution( scrollBar, buttonLength, getControlBounds( scrollBar ).height ); return Direction.calculateComponentDistribution( scrollBar, buttonLength, getControlBounds( scrollBar ).height );
} }
private Rectangle[] calculateComponentBounds( ComponentDistribution distribution, FlatScrollBar scrollBar ) { private Rectangle[] calculateComponentBounds( ComponentDistribution distribution, FlatScrollBar scrollBar ) {
@@ -115,7 +115,7 @@ enum Direction {
@Override @Override
protected void expand( Control control, int maxExpansion ) { protected void expand( Control control, int maxExpansion ) {
Rectangle bounds = control.getBounds(); Rectangle bounds = control.getBounds();
int expand = expand( bounds.width, maxExpansion ); int expand = super.expand( bounds.width, maxExpansion );
control.setBounds( bounds.x - expand, bounds.y, bounds.width + expand, bounds.height ); control.setBounds( bounds.x - expand, bounds.y, bounds.width + expand, bounds.height );
} }
}; };