fix layout for auto-hiding scrollbar (e.g. GTK)

This commit is contained in:
Eyck Jentzsch 2022-01-07 21:25:01 +01:00
parent 20934a9f47
commit 7dbcffe95d
3 changed files with 67 additions and 28 deletions

View File

@ -30,25 +30,43 @@ Legend:
* Mouse Scroll wheel: MScrl
* Context any means Name List, Value List or Waveform
| Input | Modifier | Context | Action |
|-----------|----------|----------|-----------------------------------|
| LMB klick | | any | select |
| LMB klick | Shift | Waveform | move selected marker to position |
| LMB klick | Control | Waveform | move cursor to position |
| LMB drag | | Waveform | zoom to range |
| MMB klick | | Waveform | move selected marker to position |
| MScrl | | any | scroll window up/down |
| MScrl | Shift | any | scroll window left/right |
| Key left | | Waveform | scroll window to the left (slow) |
| Key right | | Waveform | scroll window to the right (slow) |
| Key left | Shift | Waveform | scroll window to the left (fast) |
| Key right | Shift | Waveform | scroll window to the right (fast) |
| Key up | | Waveform | move selection up |
| Key down | | Waveform | move selection down |
| Key up | Control | Waveform | move selected track up |
| Key down | Control | Waveform | move selected track down |
| Key + | Control | Waveform | zoom in |
| Key - | Control | Waveform | zoom out |
| Key Pos1 | | Waveform | jump to selected marker |
| Key End | | Waveform | jump to cursor |
| Key Del | | any | delete selected entries |
| Input | Modifier | Context | Action |
|------------|----------|----------|-----------------------------------|
| LMB click | | any | select |
| LMB click | Shift | Waveform | move selected marker to position |
| LMB click | Control | Waveform | move cursor to position |
| LMB drag | | Waveform | zoom to range |
| MMB click | | Waveform | move selected marker to position |
| MScrl | | any | scroll window up/down |
| MScrl | Shift | any | scroll window left/right |
| MScrl | Control | Waveform | zoom in/out |
| Key left | | Waveform | scroll window to the left (slow) |
| Key right | | Waveform | scroll window to the right (slow) |
| Key left | Shift | Waveform | scroll window to the left (fast) |
| Key right | Shift | Waveform | scroll window to the right (fast) |
| Key up | | Waveform | move selection up |
| Key down | | Waveform | move selection down |
| Key up | Control | Waveform | move selected track up |
| Key down | Control | Waveform | move selected track down |
| Key + | Control | Waveform | zoom in |
| Key - | Control | Waveform | zoom out |
| Key Pos1 | | Waveform | jump to selected marker |
| Key End | | Waveform | jump to cursor |
| Key Del | | any | delete selected entries |
| LMB click | | ZoomBar | increment/decrement 1 page |
| LMB drag | | ZoomBar | drag both markers (pan) |
| LMB drag | Control | ZoomBar | drag one marker (zoom) |
| MMB drag | | ZoomBar | drag one marker (zoom) |
| xMB dclick | | ZoomBar | pan to position |
| MScrl | | ZoomBar | scroll window left/right |
| MScrl | Shift | ZoomBar | scroll window left/right double speed |
| MScrl | Control | ZoomBar | zoom in/out |
| Key left | | ZoomBar | scroll window to the left (slow) |
| Key right | | ZoomBar | scroll window to the right (slow) |
| Key up | | ZoomBar | scroll window to the left (slow) |
| Key down | | ZoomBar | scroll window to the right (slow) |
| Key PgUp | | ZoomBar | scroll window to the left (fast) |
| Key PgDown | | ZoomBar | scroll window to the right (fast) |
| Key Pos1 | | ZoomBar | scroll to begin |
| Key End | | ZoomBar | scroll to end |

View File

@ -113,6 +113,10 @@ public class WaveformView implements IWaveformView {
private final Canvas valueList;
private final Control nameFill;
private final Control valueFill;
final WaveformCanvas waveformCanvas;
final ToolTipHandler toolTipHandler;
@ -379,7 +383,10 @@ public class WaveformView implements IWaveformView {
@Override
public void controlResized(ControlEvent e) {
nameListScrolled.getVerticalBar().setVisible(false);
if(nameListScrolled.getSize().y == nameList.getSize().y) {
((GridData)nameFill.getLayoutData()).heightHint=18;
namePane.layout();
}
}
});
nameList = new Canvas(nameListScrolled, SWT.NONE) {
@ -398,7 +405,8 @@ public class WaveformView implements IWaveformView {
});
nameList.addMouseListener(nameValueMouseListener);
nameListScrolled.setContent(nameList);
nameFill = createFill(namePane);
createTextPane(valuePane, "Value");
valuePane.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND));
@ -411,7 +419,10 @@ public class WaveformView implements IWaveformView {
@Override
public void controlResized(ControlEvent e) {
valueListScrolled.getVerticalBar().setVisible(false);
if(valueListScrolled.getSize().y == valueList.getSize().y) {
((GridData)valueFill.getLayoutData()).heightHint=18;
valuePane.layout();
}
}
});
valueList = new Canvas(valueListScrolled, SWT.NONE) {
@ -430,6 +441,7 @@ public class WaveformView implements IWaveformView {
});
valueList.addMouseListener(nameValueMouseListener);
valueListScrolled.setContent(valueList);
valueFill = createFill(valuePane);
waveformCanvas.setMaxTime(1);
waveformCanvas.addPaintListener(waveformMouseListener);
@ -489,6 +501,15 @@ public class WaveformView implements IWaveformView {
});
}
private Control createFill(Composite pane) {
Label cLabel = new Label(pane, SWT.NONE);
cLabel.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND));
GridData gd_cLabel = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
gd_cLabel.heightHint = 0;
cLabel.setLayoutData(gd_cLabel);
return cLabel;
}
private void createTextPane(Composite namePane, String text) {
GridLayout glNamePane = new GridLayout(1, false);
glNamePane.verticalSpacing = 0;

View File

@ -92,11 +92,11 @@ public class RangeSlider extends Canvas {
private void addMouseListeners() {
addListener(SWT.MouseDown, e -> {
if (e.button == 1) {
if (e.button == 1 || e.button == 2) {
selectKnobs(e);
selectedElement = (lowerHover ? LOWER : NONE) | (upperHover ? UPPER : NONE);
if (selectedElement!=NONE) {
if((e.stateMask & SWT.CTRL)==0)
if((e.stateMask & SWT.CTRL)==0 && e.button != 2)
selectedElement=BOTH;
startDragLowerValue = previousLowerValue = lowerValue;
startDragUpperValue = previousUpperValue = upperValue;
@ -112,7 +112,7 @@ public class RangeSlider extends Canvas {
super.setToolTipText(clientToolTipText);
selectedElement=NONE;
redraw();
} else {
} else if (e.button == 1) {
if(e.x<coordLower.x) {
translateValues(-pageIncrement);
validateNewValues(e);