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 * Mouse Scroll wheel: MScrl
* Context any means Name List, Value List or Waveform * Context any means Name List, Value List or Waveform
| Input | Modifier | Context | Action | | Input | Modifier | Context | Action |
|-----------|----------|----------|-----------------------------------| |------------|----------|----------|-----------------------------------|
| LMB klick | | any | select | | LMB click | | any | select |
| LMB klick | Shift | Waveform | move selected marker to position | | LMB click | Shift | Waveform | move selected marker to position |
| LMB klick | Control | Waveform | move cursor to position | | LMB click | Control | Waveform | move cursor to position |
| LMB drag | | Waveform | zoom to range | | LMB drag | | Waveform | zoom to range |
| MMB klick | | Waveform | move selected marker to position | | MMB click | | Waveform | move selected marker to position |
| MScrl | | any | scroll window up/down | | MScrl | | any | scroll window up/down |
| MScrl | Shift | any | scroll window left/right | | MScrl | Shift | any | scroll window left/right |
| Key left | | Waveform | scroll window to the left (slow) | | MScrl | Control | Waveform | zoom in/out |
| Key right | | Waveform | scroll window to the right (slow) | | Key left | | Waveform | scroll window to the left (slow) |
| Key left | Shift | Waveform | scroll window to the left (fast) | | Key right | | Waveform | scroll window to the right (slow) |
| Key right | Shift | Waveform | scroll window to the right (fast) | | Key left | Shift | Waveform | scroll window to the left (fast) |
| Key up | | Waveform | move selection up | | Key right | Shift | Waveform | scroll window to the right (fast) |
| Key down | | Waveform | move selection down | | Key up | | Waveform | move selection up |
| Key up | Control | Waveform | move selected track up | | Key down | | Waveform | move selection down |
| Key down | Control | Waveform | move selected track down | | Key up | Control | Waveform | move selected track up |
| Key + | Control | Waveform | zoom in | | Key down | Control | Waveform | move selected track down |
| Key - | Control | Waveform | zoom out | | Key + | Control | Waveform | zoom in |
| Key Pos1 | | Waveform | jump to selected marker | | Key - | Control | Waveform | zoom out |
| Key End | | Waveform | jump to cursor | | Key Pos1 | | Waveform | jump to selected marker |
| Key Del | | any | delete selected entries | | 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 Canvas valueList;
private final Control nameFill;
private final Control valueFill;
final WaveformCanvas waveformCanvas; final WaveformCanvas waveformCanvas;
final ToolTipHandler toolTipHandler; final ToolTipHandler toolTipHandler;
@ -379,7 +383,10 @@ public class WaveformView implements IWaveformView {
@Override @Override
public void controlResized(ControlEvent e) { public void controlResized(ControlEvent e) {
nameListScrolled.getVerticalBar().setVisible(false); nameListScrolled.getVerticalBar().setVisible(false);
if(nameListScrolled.getSize().y == nameList.getSize().y) {
((GridData)nameFill.getLayoutData()).heightHint=18;
namePane.layout();
}
} }
}); });
nameList = new Canvas(nameListScrolled, SWT.NONE) { nameList = new Canvas(nameListScrolled, SWT.NONE) {
@ -398,6 +405,7 @@ public class WaveformView implements IWaveformView {
}); });
nameList.addMouseListener(nameValueMouseListener); nameList.addMouseListener(nameValueMouseListener);
nameListScrolled.setContent(nameList); nameListScrolled.setContent(nameList);
nameFill = createFill(namePane);
createTextPane(valuePane, "Value"); createTextPane(valuePane, "Value");
@ -411,7 +419,10 @@ public class WaveformView implements IWaveformView {
@Override @Override
public void controlResized(ControlEvent e) { public void controlResized(ControlEvent e) {
valueListScrolled.getVerticalBar().setVisible(false); valueListScrolled.getVerticalBar().setVisible(false);
if(valueListScrolled.getSize().y == valueList.getSize().y) {
((GridData)valueFill.getLayoutData()).heightHint=18;
valuePane.layout();
}
} }
}); });
valueList = new Canvas(valueListScrolled, SWT.NONE) { valueList = new Canvas(valueListScrolled, SWT.NONE) {
@ -430,6 +441,7 @@ public class WaveformView implements IWaveformView {
}); });
valueList.addMouseListener(nameValueMouseListener); valueList.addMouseListener(nameValueMouseListener);
valueListScrolled.setContent(valueList); valueListScrolled.setContent(valueList);
valueFill = createFill(valuePane);
waveformCanvas.setMaxTime(1); waveformCanvas.setMaxTime(1);
waveformCanvas.addPaintListener(waveformMouseListener); 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) { private void createTextPane(Composite namePane, String text) {
GridLayout glNamePane = new GridLayout(1, false); GridLayout glNamePane = new GridLayout(1, false);
glNamePane.verticalSpacing = 0; glNamePane.verticalSpacing = 0;

View File

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