update key bindings

This commit is contained in:
Eyck Jentzsch 2021-11-15 14:16:46 +01:00
parent d6805f383b
commit 59987f262d
5 changed files with 77 additions and 11 deletions

View File

@ -22,10 +22,35 @@ To build the plugins the Eclipse SDK or PDE can be used. In both cases the Groov
eclipse plugin (http://groovy.codehaus.org/Eclipse+Plugin or Market) has to be eclipse plugin (http://groovy.codehaus.org/Eclipse+Plugin or Market) has to be
installed. installed.
TODO Key Shortcuts
==== =============
- add more tests
- move to feature based product to allow automatic updates Legend:
- improve graphics
- catch-up e3 plugin to functionality of e4 product * Left Mouse Button: LMB
- add calculated traces * Middle Mouse Button: MMB
* 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 |

View File

@ -27,10 +27,14 @@ import com.minres.scviewer.database.tx.ITx;
public interface IWaveformView extends PropertyChangeListener, ISelectionProvider{ public interface IWaveformView extends PropertyChangeListener, ISelectionProvider{
String CURSOR_PROPERTY = "cursor_time"; static final String CURSOR_PROPERTY = "cursor_time";
String MARKER_PROPERTY = "marker_time"; static final String MARKER_PROPERTY = "marker_time";
static final int CURSOR_POS = 0;
static final int MARKER_POS = 1;
public static final RelationType NEXT_PREV_IN_STREAM = RelationTypeFactory.create("Prev/Next in stream"); public static final RelationType NEXT_PREV_IN_STREAM = RelationTypeFactory.create("Prev/Next in stream");
public void addSelectionChangedListener(ISelectionChangedListener listener); public void addSelectionChangedListener(ISelectionChangedListener listener);
@ -113,6 +117,8 @@ public interface IWaveformView extends PropertyChangeListener, ISelectionProvide
public void scrollHorizontal(int percent); public void scrollHorizontal(int percent);
public void scrollTo(int pos);
public void addDisposeListener( DisposeListener listener ); public void addDisposeListener( DisposeListener listener );
public void deleteSelectedTracks(); public void deleteSelectedTracks();

View File

@ -496,6 +496,12 @@ public class WaveformCanvas extends Canvas {
} }
} }
public void centerAt(long time) {
int scaledTime = (int) (time / scaleFactor);
int newX = -scaledTime+getWidth()/2;
setOrigin(newX>0?0:newX, origin.y);
}
public int getRulerHeight() { public int getRulerHeight() {
return rulerHeight; return rulerHeight;
} }

View File

@ -292,8 +292,8 @@ public class WaveformView implements IWaveformView {
@Override @Override
public void handleEvent(Event e) { public void handleEvent(Event e) {
switch (e.type) { switch (e.type) {
// case SWT.MouseWheel: // case SWT.MouseWheel:
// break; // break;
case SWT.MouseDown: case SWT.MouseDown:
start = new Point(e.x, e.y); start = new Point(e.x, e.y);
end = new Point(e.x, e.y); end = new Point(e.x, e.y);
@ -1509,6 +1509,22 @@ public class WaveformView implements IWaveformView {
waveformCanvas.redraw(); waveformCanvas.redraw();
} }
@Override
public void scrollTo(int pos) {
long time = 0;
switch(pos) {
case IWaveformView.CURSOR_POS:
time = getCursorTime();
break;
case IWaveformView.MARKER_POS:
time = getMarkerTime(selectedMarker);
break;
default:
break;
}
waveformCanvas.centerAt(time);
}
public void asyncUpdate(Widget widget) { public void asyncUpdate(Widget widget) {
widget.getDisplay().asyncExec(() -> { widget.getDisplay().asyncExec(() -> {
waveformCanvas.redraw(); waveformCanvas.redraw();
@ -1539,4 +1555,13 @@ public class WaveformView implements IWaveformView {
return e; return e;
} }
} }

View File

@ -357,9 +357,13 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
waveformPane.moveSelection(GotoDirection.DOWN); waveformPane.moveSelection(GotoDirection.DOWN);
return; return;
case SWT.HOME: case SWT.HOME:
waveformPane.scrollTo(IWaveformView.MARKER_POS);
return; return;
case SWT.END: case SWT.END:
waveformPane.scrollTo(IWaveformView.CURSOR_POS);
return; return;
case SWT.DEL:
waveformPane.deleteSelectedTracks();
default: default:
break; break;
} }