diff --git a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformCanvas.java b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformCanvas.java index b55e1b9..966651b 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformCanvas.java +++ b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformCanvas.java @@ -179,6 +179,7 @@ public class WaveformCanvas extends Canvas { } public void setZoomLevel(int level, long centerTime) { + int maxLevel = findFitZoomLevel(maxTime); if(level<0) { if(level<-1) { long cTime = getCursorPainters().get(0).getTime(); @@ -186,11 +187,11 @@ public class WaveformCanvas extends Canvas { level = findFitZoomLevel(time_diff); centerTime = (centerTime>cTime?cTime:centerTime)+time_diff/2; } else - level = findFitZoomLevel(maxTime); + level=maxLevel; if(level<0) level = 0; } //FIXME: keep center if zoom-out and cursor is not in view - if(level streams; - private boolean waveformsContainTx=false; - - public boolean isWaveformsContainTx() { - return waveformsContainTx; - } - int selectedMarker = 0; private int tracksVerticalHeight; @@ -166,8 +160,7 @@ public class WaveformView implements IWaveformView { : streams.subList(firstIdx, lastIdx + 1); setSelection(new StructuredSelection(res), (e.stateMask & SWT.CTRL) != 0, false); } else - setSelection(new StructuredSelection(entry.getValue()), (e.stateMask & SWT.CTRL) != 0, - false); + setSelection(new StructuredSelection(entry.getValue()), (e.stateMask & SWT.CTRL) != 0, false); } else { setSelection(new StructuredSelection(entry.getValue()), (e.stateMask & SWT.CTRL) != 0, false); } @@ -295,8 +288,15 @@ public class WaveformView implements IWaveformView { @Override public void handleEvent(Event e) { switch (e.type) { - // case SWT.MouseWheel: - // break; + case SWT.MouseWheel: + if((e.stateMask & SWT.CTRL) != 0) { + int zoom = waveformCanvas.getZoomLevel(); + if(e.count<0) + waveformCanvas.setZoomLevel(zoom+1); + else + waveformCanvas.setZoomLevel(zoom-1); + } + break; case SWT.MouseDown: start = new Point(e.x, e.y); end = new Point(e.x, e.y); @@ -469,6 +469,17 @@ public class WaveformView implements IWaveformView { toolTipHandler = new ToolTipHandler(parent.getShell()); toolTipHandler.activateHoverHelp(waveformCanvas); + // This is the filter that prevents it + getControl().getDisplay().addFilter(SWT.MouseWheel, new Listener() { + @Override + public void handleEvent(Event e) { + // Check if it's the correct widget + if((e.widget.equals(waveformCanvas) || e.widget.equals(this)) && (e.stateMask & SWT.CTRL) != 0) { + waveformMouseListener.handleEvent(e); + e.doit = false; + } + } + }); } private void createTextPane(Composite namePane, String text) { @@ -518,7 +529,6 @@ public class WaveformView implements IWaveformView { boolean even = true; TextLayout tl = new TextLayout(waveformCanvas.getDisplay()); tl.setFont(styleProvider.getNameFont()); - waveformsContainTx=false; for (TrackEntry streamEntry : streams) { streamEntry.height = styleProvider.getTrackHeight(); streamEntry.vOffset = tracksVerticalHeight; @@ -526,7 +536,6 @@ public class WaveformView implements IWaveformView { streamEntry.currentValue = ""; streamEntry.height *= streamEntry.waveform.getRowCount(); painter = new StreamPainter(waveformCanvas, even, streamEntry); - waveformsContainTx=true; } else if (streamEntry.waveform.getType() == WaveformType.SIGNAL) { streamEntry.currentValue = "---"; painter = new SignalPainter(waveformCanvas, even, streamEntry); @@ -762,27 +771,30 @@ public class WaveformView implements IWaveformView { if (!add) currentWaveformSelection.clear(); List selList = sel.toList(); - if (selList.get(0) instanceof ITx) { - ITx txSel = (ITx) selList.get(0); - TrackEntry trackEntry = selList.size() == 2 && selList.get(1) instanceof TrackEntry - ? (TrackEntry) selList.get(1) - : null; - if (trackEntry == null) { - trackEntry = getEntryFor(txSel); - if (trackEntry == null && addIfNeeded) { - trackEntry = new TrackEntry(txSel.getStream(), styleProvider); - streams.add(trackEntry); + for(Object o: selList) { + if (o instanceof ITx) { + ITx txSel = (ITx) o; + TrackEntry trackEntry = selList.size() == 2 && selList.get(1) instanceof TrackEntry + ? (TrackEntry) selList.get(1) + : null; + if (trackEntry == null) { + trackEntry = getEntryFor(txSel); + if (trackEntry == null && addIfNeeded) { + trackEntry = new TrackEntry(txSel.getStream(), styleProvider); + streams.add(trackEntry); + } } + currentTxSelection = txSel; + currentWaveformSelection.clear(); + currentWaveformSelection.add(trackEntry); + selectionChanged = true; + } else if (o instanceof TrackEntry) { + TrackEntry e = (TrackEntry)o; + if(!currentWaveformSelection.contains(e)) + currentWaveformSelection.add(e); + selectionChanged = true; } - currentTxSelection = txSel; - currentWaveformSelection.clear(); - currentWaveformSelection.add(trackEntry); - selectionChanged = true; - } else if (selList.size() == 1 && selList.get(0) instanceof TrackEntry) { - currentWaveformSelection.add((TrackEntry) selList.get(0)); - if (currentTxSelection != null) - currentTxSelection = null; - selectionChanged = true; + } } } else { @@ -1563,4 +1575,9 @@ public class WaveformView implements IWaveformView { getStreamList().add(idx, e); return e; } + + public boolean waveformsContainsTx() { + return streams.stream().filter(e -> e.waveform.getType() == WaveformType.TRANSACTION).findFirst().isPresent(); + } + } diff --git a/plugins/com.minres.scviewer.e4.application/Application.e4xmi b/plugins/com.minres.scviewer.e4.application/Application.e4xmi index c289e0d..17138a9 100644 --- a/plugins/com.minres.scviewer.e4.application/Application.e4xmi +++ b/plugins/com.minres.scviewer.e4.application/Application.e4xmi @@ -12,18 +12,19 @@ - - + + - + - + + @@ -109,10 +110,10 @@ - + - + @@ -157,16 +158,6 @@ type:user - - - type:user - - - - type:user - - - type:user @@ -182,20 +173,22 @@ type:user - - - + + type:user + + + type:user + + + - - - - + - + categoryTag:General diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/SelectAllHandler.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/SelectAllHandler.java index 3a09ac7..636adff 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/SelectAllHandler.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/handlers/SelectAllHandler.java @@ -19,25 +19,15 @@ import org.eclipse.e4.ui.model.application.ui.basic.MPart; import org.eclipse.e4.ui.workbench.modeling.EPartService; import com.minres.scviewer.e4.application.parts.DesignBrowser; +import com.minres.scviewer.e4.application.parts.WaveformViewer; public class SelectAllHandler { - @Inject @Optional DesignBrowser designBrowser; - @Execute public void execute(EPartService partService) { - if(designBrowser==null) designBrowser = getListPart(partService); - if(designBrowser!=null){ - designBrowser.selectAllWaveforms(); - } + MPart part = partService.getActivePart(); + if(part.getObject() instanceof WaveformViewer) + ((WaveformViewer) part.getObject()).selectAll(); } - protected DesignBrowser getListPart(EPartService partService){ - MPart part = partService.getActivePart(); - if(part.getObject() instanceof DesignBrowser) - return (DesignBrowser) part.getObject(); - else - return null; - } - } \ No newline at end of file diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties index 9651d86..4768167 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/messages.properties @@ -85,7 +85,7 @@ HelpDialog_2=Stop HelpDialog_3=Refresh HelpDialog_4=Go HelpDialog_5=Address -HelpDialog_6=https://git.minres.com/VP-Tools/SCViewer/src/branch/master/README.md\#key-shortcuts +HelpDialog_6=https://minres.github.io/SCViewer#key-shortcuts HelpDialog_7=Could not instantiate Browser: marker=Marker marker_text=Marker TExt diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/DesignBrowser.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/DesignBrowser.java index 22314cd..b01b1da 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/DesignBrowser.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/DesignBrowser.java @@ -226,6 +226,10 @@ public class DesignBrowser { } }); } + + public Control getControl() { + return top; + } /** * Creates the table composite. diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewer.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewer.java index c35fc5b..b31fc01 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewer.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewer.java @@ -337,6 +337,8 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis case SWT.ARROW_DOWN: waveformPane.moveSelectedTrack(1); return; + case 'a': + selectAll(); default: break; } @@ -1269,4 +1271,11 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis } catch (BackingStoreException e) {} } } + + public void selectAll() { + List entries = waveformPane.getStreamList(); + ISelection sel = new StructuredSelection(entries); + waveformPane.setSelection(sel); + designBrowser.selectAllWaveforms(); + } } \ No newline at end of file