Compare commits

...

44 Commits

Author SHA1 Message Date
4c48fda5ad Merge branch 'release/2.15.0' 2021-11-27 16:49:01 +01:00
6a591f2dbc add gh-pages deployment steps 2021-11-27 16:48:09 +01:00
86c30ad948 update version numbers 2021-11-27 15:39:07 +01:00
0ae055b486 Merge branch 'feature/continous_zoom' into develop 2021-11-27 15:22:44 +01:00
efcd4f5ab8 update tool bar actions and icons 2021-11-27 15:21:17 +01:00
232d2d4275 move zomm/navigate toolbar to view 2021-11-27 14:31:39 +01:00
44f96e5383 cleanup imports 2021-11-27 14:04:25 +01:00
44812310b0 implement continous zoom and removed zoom level status control 2021-11-27 14:04:06 +01:00
6ef91bb5e7 Merge branch 'release/2.14.2' 2021-11-18 14:31:09 +01:00
aa459b0ea6 Merge branch 'release/2.14.2' into develop 2021-11-18 14:31:09 +01:00
a2adf66618 update version numbers 2021-11-18 14:30:54 +01:00
3405e90df9 fix behavior of help window 2021-11-18 14:24:08 +01:00
9a59947e67 fix handling of key short cuts 2021-11-18 12:55:23 +01:00
9384d3278c remove hierarchy in poms 2021-11-18 08:41:52 +01:00
1af3171b2e cleanup imports 2021-11-16 14:15:33 +01:00
03fd9e154b Merge branch 'master' into develop 2021-11-16 14:13:22 +01:00
3572f683e3 add zoom levels 2021-11-16 14:12:10 +01:00
524ffb189c fix MT race condition 2021-11-16 14:11:30 +01:00
7fac6c8f74 Merge branch 'release/2.14.1' into develop 2021-11-16 11:32:41 +01:00
037c645075 Merge branch 'release/2.14.1' 2021-11-16 11:32:41 +01:00
2f9bd29dc8 update version numbers 2021-11-16 11:32:34 +01:00
92662c546a fix zoom level calculation 2021-11-16 11:28:32 +01:00
efa6544623 cleanup 2021-11-16 11:27:58 +01:00
52cf9daeec unify time printing (#69) 2021-11-16 09:37:50 +01:00
4a315722b1 add help browser window instead of dialog 2021-11-16 09:33:09 +01:00
a52efd1a12 Merge branch 'master' into develop 2021-11-15 22:25:12 +01:00
535df30ada Merge branch 'release/2.14.0' into develop 2021-11-15 21:38:51 +01:00
bad34dd1d1 Merge branch 'release/2.14.0' 2021-11-15 21:38:51 +01:00
5ac7f05f57 Merge branch 'master' of https://git.minres.com/VP-Tools/SCViewer 2021-11-15 21:37:51 +01:00
8353b59a27 update version numbers for release
This release fixes the following tickets:
* #62: Instead of or in addition to the Restore Default Zoom button, add
Full Zoom Out button.
* #64: Load multiple trace files and enable the possibility to view
signals from different files in a single window.
* partial #66: key shortcuts for actions like zoom in/out, go to
next/prev event etc
* #70: add full zoom and zoom between markers (once we had markers)
* #75: marker is often hiding events underneath for highlighting and
getting transaction details
* #82: Implement help for keyboard shortcuts
2021-11-15 21:29:08 +01:00
2c6ca6c376 update version number to 2.14 2021-11-15 21:25:05 +01:00
f4b03cb0e6 extend zoom handling (#70) and hide tx property panes (#58) 2021-11-15 21:23:13 +01:00
c7858997c0 update README.md 2021-11-15 15:18:56 +01:00
bd99ab3992 corrected parent path im poms 2021-11-15 15:14:04 +01:00
66f365d38d externalize string in HelpDialog class 2021-11-15 15:14:04 +01:00
59987f262d update key bindings 2021-11-15 15:14:04 +01:00
452a28362e fix help link 2021-11-15 15:14:04 +01:00
d6805f383b add help dialog 2021-11-15 15:14:04 +01:00
076611eec7 allow multiple loading of same format 2021-11-15 15:14:04 +01:00
e0fa55e2c0 corrected parent path im poms 2021-11-15 14:32:55 +01:00
9ea1994228 update key bindings 2021-11-15 14:16:46 +01:00
36f628c365 add help dialog 2021-11-15 13:07:58 +01:00
ff87e72510 allow multiple loading of same format 2021-11-15 10:52:59 +01:00
aef1e29a53 Merge branch 'release/2.13.2' into develop 2021-07-11 14:22:41 +02:00
79 changed files with 2051 additions and 1264 deletions

View File

@ -12,7 +12,8 @@
<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
<stringAttribute key="M2_USER_SETTINGS" value=""/>
<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/AdoptOpenJDK 8 [1.8.0_232]"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${project_loc:com.minres.scviewer.parent}"/>
</launchConfiguration>

View File

@ -18,14 +18,37 @@ The viewer has the following features
- sqlite based
- visualization of transaction relations
To build the plugins the Eclipse SDK or PDE can be used. In both cases the Groovy
eclipse plugin (http://groovy.codehaus.org/Eclipse+Plugin or Market) has to be
installed.
To build the plugins the Eclipse SDK or PDE can be used.
TODO
====
- add more tests
- move to feature based product to allow automatic updates
- improve graphics
- catch-up e3 plugin to functionality of e4 product
- add calculated traces
Key Shortcuts
=============
Legend:
* Left Mouse Button: LMB
* 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,12 +27,12 @@ http://www.eclipse.org/legal/epl-v10.html
</url>
<requires>
<import plugin="org.codehaus.groovy" version="2.5.8" match="greaterOrEqual"/>
<import plugin="org.eclipse.osgi.services" version="3.4.0" match="greaterOrEqual"/>
<import plugin="com.google.guava" version="15.0.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.osgi"/>
<import plugin="com.minres.scviewer.database" version="1.0.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.core.runtime"/>
<import feature="org.eclipse.collections.feature" version="10.4.0.v20200820-2049"/>
</requires>
<plugin

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>2.13.2</version>
<version>2.15.0</version>
<relativePath>../..</relativePath>
</parent>
<version>3.0.0-SNAPSHOT</version>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>2.13.2</version>
<version>2.15.0</version>
<relativePath>../..</relativePath>
</parent>
<version>1.1.0-SNAPSHOT</version>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>2.13.2</version>
<version>2.15.0</version>
<relativePath>../..</relativePath>
</parent>
<version>1.0.0-SNAPSHOT</version>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>2.13.2</version>
<version>2.15.0</version>
<relativePath>../..</relativePath>
</parent>
<version>1.1.0-SNAPSHOT</version>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>2.13.2</version>
<version>2.15.0</version>
<relativePath>../..</relativePath>
</parent>
<version>1.1.0-SNAPSHOT</version>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>2.13.2</version>
<version>2.15.0</version>
<relativePath>../..</relativePath>
</parent>
<packaging>eclipse-plugin</packaging>

View File

@ -2,12 +2,12 @@
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/"/>
<classpathentry exported="true" kind="lib" path="lib/mapdb-3.0.7.jar" sourcepath="lib/mapdb-3.0.7-sources.jar">
<attributes>
<attribute name="javadoc_location" value="jar:platform:/resource/com.minres.scviewer.database.text/lib/mapdb-3.0.7-javadoc.jar!/"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry exported="true" kind="lib" path="lib/kotlin-stdlib-1.2.42.jar"/>
<classpathentry exported="true" kind="lib" path="lib/lz4-1.3.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/elsa-3.0.0-M5.jar"/>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="TextDbLoader">
<implementation class="com.minres.scviewer.database.text.TextDbLoader"/>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="TextDbLoaderFactory">
<implementation class="com.minres.scviewer.database.text.TextDbLoaderFactory"/>
<service>
<provide interface="com.minres.scviewer.database.IWaveformDbLoader"/>
<provide interface="com.minres.scviewer.database.IWaveformDbLoaderFactory"/>
</service>
</scr:component>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>2.13.2</version>
<version>2.15.0</version>
<relativePath>../..</relativePath>
</parent>
<packaging>eclipse-plugin</packaging>

View File

@ -0,0 +1,77 @@
/*******************************************************************************
* Copyright (c) 2012 IT Just working.
* Copyright (c) 2020 MINRES Technologies GmbH
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IT Just working - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.text;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.zip.GZIPInputStream;
import com.minres.scviewer.database.IWaveformDbLoader;
import com.minres.scviewer.database.IWaveformDbLoaderFactory;
/**
* The Class TextDbLoader.
*/
public class TextDbLoaderFactory implements IWaveformDbLoaderFactory {
/** The Constant x. */
static final byte[] x = "scv_tr_stream".getBytes();
/**
* Checks if f is gzipped.
*
* @param f the f
* @return true, if is gzipped
*/
private static boolean isGzipped(File f) {
try (InputStream is = new FileInputStream(f)) {
byte[] signature = new byte[2];
int nread = is.read(signature); // read the gzip signature
return nread == 2 && signature[0] == (byte) 0x1f && signature[1] == (byte) 0x8b;
} catch (IOException e) {
return false;
}
}
/**
* Can load.
*
* @param inputFile the input file
* @return true, if successful
*/
@Override
public boolean canLoad(File inputFile) {
if (!inputFile.isDirectory() && inputFile.exists()) {
boolean gzipped = isGzipped(inputFile);
try(InputStream stream = gzipped ? new GZIPInputStream(new FileInputStream(inputFile)) : new FileInputStream(inputFile)){
byte[] buffer = new byte[x.length];
int readCnt = stream.read(buffer, 0, x.length);
if (readCnt == x.length) {
for (int i = 0; i < x.length; i++)
if (buffer[i] != x[i])
return false;
}
return true;
} catch (Exception e) {
return false;
}
}
return false;
}
@Override
public IWaveformDbLoader getLoader() {
return new TextDbLoader();
}
}

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>2.13.2</version>
<version>2.15.0</version>
<relativePath>../..</relativePath>
</parent>
<version>4.0.0-SNAPSHOT</version>

View File

@ -27,10 +27,14 @@ import com.minres.scviewer.database.tx.ITx;
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 void addSelectionChangedListener(ISelectionChangedListener listener);
@ -75,23 +79,17 @@ public interface IWaveformView extends PropertyChangeListener, ISelectionProvide
public void setHighliteRelation(RelationType relationType);
public long getMaxTime();
public void setMaxTime(long maxTime);
public void setZoomLevel(int scale);
public int getZoomLevel();
public void setCursorTime(long time);
public void setMarkerTime(long time, int index);
public void setMarkerTime(int marker, long time);
public long getCursorTime();
public int getSelectedMarkerId();
public int getSelectedMarker();
public long getMarkerTime(int index);
public long getMarkerTime(int marker);
public void addPropertyChangeListener(PropertyChangeListener listener);
@ -101,21 +99,18 @@ public interface IWaveformView extends PropertyChangeListener, ISelectionProvide
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener);
public String getScaledTime(long time);
public String[] getZoomLevels();
public List<ICursor> getCursorList();
public long getBaselineTime();
public void setBaselineTime(Long scale);
public void scrollHorizontal(int percent);
public void scrollTo(int pos);
public void addDisposeListener( DisposeListener listener );
public void deleteSelectedTracks();
public TrackEntry addWaveform(IWaveform waveform, int pos);
public IWaveformZoom getWaveformZoom();
}

View File

@ -0,0 +1,24 @@
package com.minres.scviewer.database.ui;
public interface IWaveformZoom {
long getMaxVisibleTime();
long getMinVisibleTime();
void setMinVisibleTime(long scale);
long getMaxTime();
long getScale();
void setScale(long factor);
void setVisibleRange(long startTime, long endTime);
void centerAt(long time);
void zoom(ZoomKind kind);
String timeToString(long time);
}

View File

@ -0,0 +1,3 @@
package com.minres.scviewer.database.ui;
public enum ZoomKind {IN, OUT, FIT, FULL}

View File

@ -1,14 +1,49 @@
package com.minres.scviewer.database.ui.swt;
import java.text.DecimalFormat;
public class Constants {
public static final String[] UNIT_STRING={"fs", "ps", "ns", "us", "ms"};//, "s"};
public static final int[] UNIT_MULTIPLIER={1, 3, 10, 30, 100, 300};
public static final String[] UNIT_STRING={"fs", "ps", "ns", "us", "ms", "s"};
public static final long[] UNIT_MULTIPLIER={1l, 1000l, 1000l*1000, 1000l*1000*1000, 1000l*1000*1000*1000, 1000l*1000*1000*1000*1000 };
//public static final int[] UNIT_MULTIPLIER={1, 3, 10, 30, 100, 300};
public static final long[] SCALE_MULTIPLIER={1, 2, 5, 10, 20, 50, 100, 200, 500};
public static final String CONTENT_PROVIDER_TAG = "TOOLTIP_CONTENT_PROVIDER";
public static final String HELP_PROVIDER_TAG = "TOOLTIP_HELP_PROVIDER";
public static final DecimalFormat TIME_FORMAT_FS = new DecimalFormat("#");
public static final DecimalFormat TIME_FORMAT_PS = new DecimalFormat("#");
public static final DecimalFormat TIME_FORMAT_NS = new DecimalFormat("#.0##");
public static final DecimalFormat TIME_FORMAT_UMS = new DecimalFormat("#.0#####");
public static final long[] POWERS_OF_TEN = {
1L,
10L,
100L,
1_000L,
10_000L,
100_000L,
1_000_000L,
10_000_000L,
100_000_000L,
1_000_000_000L,
10_000_000_000L,
100_000_000_000L,
1_000_000_000_000L,
10_000_000_000_000L,
100_000_000_000_000L,
1_000_000_000_000_000L};
public static DecimalFormat getTimeFormatForLevel(int idx) {
switch(idx) {
case 0: return TIME_FORMAT_FS;
case 1: return TIME_FORMAT_PS;
case 2: return TIME_FORMAT_NS;
default:
return TIME_FORMAT_UMS;
}
}
private Constants() {}
}

View File

@ -24,7 +24,6 @@ import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display;
import com.minres.scviewer.database.IEvent;
import com.minres.scviewer.database.IHierNode;
import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.RelationType;
import com.minres.scviewer.database.tx.ITx;
@ -76,7 +75,7 @@ public class ArrowPainter implements IPainter {
this.tx = newTx;
iRect = new LinkedList<>();
oRect = new LinkedList<>();
scaleFactor = waveCanvas.getScaleFactor();
scaleFactor = waveCanvas.getScale();
if (tx != null) {
calculateGeometries();
}
@ -134,7 +133,7 @@ public class ArrowPainter implements IPainter {
Color highliteColor = waveCanvas.styleProvider.getColor(WaveformColors.REL_ARROW_HIGHLITE);
if(tx==null) return;
scaleFactor = waveCanvas.getScaleFactor();
scaleFactor = waveCanvas.getScale();
if(calculateGeometries())
return;
int correctionValue = (int)(selectionOffset);

View File

@ -65,7 +65,7 @@ public class CursorPainter implements IPainter, ICursor {
Rectangle area = proj.unProject(clientRect);
if(!waveCanvas.painterList.isEmpty()){
long scaleFactor=waveCanvas.getScaleFactor();
long scaleFactor=waveCanvas.getScale();
long beginPos = area.x;
maxPosX = area.x + area.width;
@ -83,8 +83,7 @@ public class CursorPainter implements IPainter, ICursor {
proj.drawLine(x, top, x, area.y+area.height);
proj.setBackground(drawColor);
proj.setForeground(textColor);
double dTime=time;
proj.drawText((dTime/waveCanvas.getScaleFactorPow10())+waveCanvas.getUnitStr(), x+1, top);
proj.drawText(waveCanvas.timeToString(time), x+1, top);
}
}
}

View File

@ -10,22 +10,21 @@
*******************************************************************************/
package com.minres.scviewer.database.ui.swt.internal;
import java.text.DecimalFormat;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.wb.swt.SWTResourceManager;
import com.minres.scviewer.database.ui.swt.Constants;
public class RulerPainter implements IPainter {
protected final WaveformCanvas waveCanvas;
static final int RULER_TICK_MINOR = 10;
static final int RULER_TICK_MAJOR = 100;
static final DecimalFormat df = new DecimalFormat("#.00####");
public RulerPainter(WaveformCanvas waveCanvas) {
this.waveCanvas=waveCanvas;
}
@ -39,26 +38,26 @@ public class RulerPainter implements IPainter {
Color headerBgColor = waveCanvas.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
if(headerBgColor.isDisposed())
headerBgColor=SWTResourceManager.getColor(255,255,255);
String unit=waveCanvas.getUnitStr();
int unitMultiplier=waveCanvas.getUnitMultiplier();
long scaleFactor=waveCanvas.getScaleFactor();
long startPos=area.x*scaleFactor;
long startVal=startPos - proj.getTranslation().x*scaleFactor;
long endPos=startPos+area.width*scaleFactor;
long rulerTickMinor = RULER_TICK_MINOR*scaleFactor;
long rulerTickMajor = RULER_TICK_MAJOR*scaleFactor;
long scaleFactor=waveCanvas.getScale();
long startTime=waveCanvas.getMinVisibleTime();
long endTime=waveCanvas.getMaxVisibleTime();
long multiplier = Constants.POWERS_OF_TEN[waveCanvas.getScaleMagnitude()];
long rulerTickMinor = RULER_TICK_MINOR*multiplier;
long rulerTickMajor = RULER_TICK_MAJOR*multiplier;
if((endTime-startTime)/rulerTickMinor>area.width/5) {
rulerTickMinor*=10;
rulerTickMajor*=10;
}
int minorTickY = waveCanvas.rulerHeight-5;
int majorTickY = waveCanvas.rulerHeight-15;
int textY=waveCanvas.rulerHeight-20;
int textY=waveCanvas.rulerHeight-30;
int baselineY=waveCanvas.rulerHeight - 1;
int bottom=waveCanvas.rulerHeight - 2;
long modulo = startVal % rulerTickMinor;
long startMinorIncrPos = startPos+rulerTickMinor-modulo;
long startMinorIncrVal = startVal+rulerTickMinor-modulo;
long startTickTime = startTime+rulerTickMinor-(startTime % rulerTickMinor);
long majorTickDist = rulerTickMajor/scaleFactor;
gc.setBackground(waveCanvas.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
gc.fillRectangle(new Rectangle(area.x, area.y, area.width, waveCanvas.rulerHeight));
@ -66,13 +65,22 @@ public class RulerPainter implements IPainter {
gc.fillRectangle(new Rectangle(area.x, area.y, area.width, baselineY));
gc.setForeground(headerFgColor);
gc.drawLine(area.x, area.y+bottom, area.x+area.width, area.y+bottom);
for (long pos = startMinorIncrPos, tick = startMinorIncrVal; pos < endPos; pos+= rulerTickMinor, tick += rulerTickMinor) {
int x0Pos = (int) (pos/scaleFactor);
long x0Val = tick/scaleFactor;
if ((tick % rulerTickMajor) == 0) {
gc.drawText(df.format(x0Val*unitMultiplier)+unit, x0Pos, area.y+textY);
int maxTextLength=0;
for (long tickTime = startTickTime; tickTime < endTime; tickTime+= rulerTickMinor) {
if ((tickTime % rulerTickMajor) == 0) {
Point textSize = gc.textExtent(waveCanvas.timeToString(tickTime));
maxTextLength=textSize.x>maxTextLength?textSize.x:maxTextLength;
}
}
boolean drawEvery = majorTickDist>maxTextLength;
boolean drawText=true;
for (long tickTime = startTickTime; tickTime < endTime; tickTime+= rulerTickMinor) {
int x0Pos = (int) (tickTime/scaleFactor) + proj.getTranslation().x;
if ((tickTime % rulerTickMajor) == 0) {
if(drawEvery || drawText)
gc.drawText(waveCanvas.timeToString(tickTime), x0Pos, area.y+textY);
gc.drawLine(x0Pos, area.y+majorTickY, x0Pos,area.y+ bottom);
drawText=!drawText;
} else {
gc.drawLine(x0Pos, area.y+minorTickY, x0Pos, area.y+bottom);
}

View File

@ -82,7 +82,7 @@ public class SignalPainter extends TrackPainter {
}
private int getXPosEnd(long time) {
long ltmp = time / this.waveCanvas.getScaleFactor();
long ltmp = time / this.waveCanvas.getScale();
return ltmp > maxPosX ? maxPosX : (int) ltmp;
}
@ -95,7 +95,7 @@ public class SignalPainter extends TrackPainter {
proj.setFillRule(SWT.FILL_EVEN_ODD);
proj.fillRectangle(area);
long scaleFactor = this.waveCanvas.getScaleFactor();
long scaleFactor = this.waveCanvas.getScale();
long beginPos = area.x;
long beginTime = beginPos*scaleFactor;
long endTime = beginTime + area.width*scaleFactor;
@ -114,7 +114,7 @@ public class SignalPainter extends TrackPainter {
yOffsetT = this.waveCanvas.styleProvider.getTrackHeight() / 5 + area.y;
yOffsetM = this.waveCanvas.styleProvider.getTrackHeight() / 2 + area.y;
yOffsetB = 4 * this.waveCanvas.styleProvider.getTrackHeight() / 5 + area.y;
int xSigChangeBeginVal = Math.max(area.x, (int) (left.time / this.waveCanvas.getScaleFactor()));
int xSigChangeBeginVal = Math.max(area.x, (int) (left.time / this.waveCanvas.getScale()));
int xSigChangeBeginPos = area.x;
int xSigChangeEndPos = Math.max(area.x, getXPosEnd(right.time));
@ -127,7 +127,7 @@ public class SignalPainter extends TrackPainter {
right.time = endTime;
} else {
multiple = true;
long eTime = (xSigChangeBeginVal + 1) * this.waveCanvas.getScaleFactor();
long eTime = (xSigChangeBeginVal + 1) * this.waveCanvas.getScale();
right.set(entries.floorEntry(eTime), endTime);
right.time = eTime;
}
@ -147,7 +147,7 @@ public class SignalPainter extends TrackPainter {
multiple = false;
if (xSigChangeEndPos == xSigChangeBeginPos) {
multiple = true;
long eTime = (xSigChangeBeginPos + 1) * this.waveCanvas.getScaleFactor();
long eTime = (xSigChangeBeginPos + 1) * this.waveCanvas.getScale();
EventEntry entry = entries.floorEntry(eTime);
if(entry!=null && entry.timestamp> right.time)
right.set(entry, endTime);

View File

@ -67,7 +67,7 @@ public class StreamPainter extends TrackPainter{
proj.setFillRule(SWT.FILL_EVEN_ODD);
proj.fillRectangle(area);
long scaleFactor = this.waveCanvas.getScaleFactor();
long scaleFactor = this.waveCanvas.getScale();
long beginPos = area.x;
long beginTime = beginPos*scaleFactor;
long endTime = beginTime + area.width*scaleFactor;
@ -130,8 +130,8 @@ public class StreamPainter extends TrackPainter{
int offset = concurrencyIndex*this.waveCanvas.styleProvider.getTrackHeight();
Rectangle bb = new Rectangle(
(int)(tx.getBeginTime()/this.waveCanvas.getScaleFactor()), area.y+offset+txBase,
(int)((tx.getEndTime()-tx.getBeginTime())/this.waveCanvas.getScaleFactor()), txHeight);
(int)(tx.getBeginTime()/this.waveCanvas.getScale()), area.y+offset+txBase,
(int)((tx.getEndTime()-tx.getBeginTime())/this.waveCanvas.getScale()), txHeight);
if(bb.x+bb.width<area.x || bb.x>area.x+area.width) return;
if(bb.width==0){
@ -155,7 +155,7 @@ public class StreamPainter extends TrackPainter{
public ITx getClicked(Point point) {
int lane=point.y/waveCanvas.styleProvider.getTrackHeight();
EventEntry firstTx=stream.getEvents().floorEntry(point.x*waveCanvas.getScaleFactor());
EventEntry firstTx=stream.getEvents().floorEntry(point.x*waveCanvas.getScale());
if(firstTx!=null){
do {
ITx tx = getTxFromEntry(lane, point.x, firstTx.events);
@ -175,9 +175,9 @@ public class StreamPainter extends TrackPainter{
}
protected ITx getTxFromEntry(int lane, int offset, IEvent[] firstTx) {
long timePoint=offset*waveCanvas.getScaleFactor();
long timePointLow=(offset-5)*waveCanvas.getScaleFactor();
long timePointHigh=(offset+5)*waveCanvas.getScaleFactor();
long timePoint=offset*waveCanvas.getScale();
long timePointLow=(offset-5)*waveCanvas.getScale();
long timePointHigh=(offset+5)*waveCanvas.getScale();
for(IEvent e:firstTx){
if(e instanceof ITxEvent) {
ITxEvent evt = (ITxEvent) e;

View File

@ -42,32 +42,36 @@ import com.minres.scviewer.database.tx.ITx;
import com.minres.scviewer.database.tx.ITxEvent;
import com.minres.scviewer.database.ui.IWaveformStyleProvider;
import com.minres.scviewer.database.ui.IWaveformView;
import com.minres.scviewer.database.ui.IWaveformZoom;
import com.minres.scviewer.database.ui.TrackEntry;
import com.minres.scviewer.database.ui.ZoomKind;
import com.minres.scviewer.database.ui.swt.Constants;
public class WaveformCanvas extends Canvas {
public class WaveformCanvas extends Canvas implements IWaveformZoom{
public static final long ZOOM_FIT = -2;
public static final long ZOOM_FULL = -1;
private boolean doubleBuffering = true;
IWaveformStyleProvider styleProvider;
private long scaleFactor = 1000000L; // 1ns
String unit="ns";
private int level = 12;
private long maxTime;
protected Point origin; /* original size */
protected int rulerHeight=40;
protected List<IPainter> painterList;
ITx currentSelection;
private List<SelectionAdapter> selectionListeners;
private boolean doubleBuffering = true;
IWaveformStyleProvider styleProvider;
private int scaleMagnitude = 6;
private long scaleFactor = Constants.POWERS_OF_TEN[scaleMagnitude];
private long maxTime;
protected Point origin; /* original size */
protected int rulerHeight=40;
protected List<IPainter> painterList;
ITx currentSelection;
private List<SelectionAdapter> selectionListeners;
private RulerPainter rulerPainter;
@ -78,38 +82,38 @@ public class WaveformCanvas extends Canvas {
private List<CursorPainter> cursorPainters;
HashMap<IWaveform, IWaveformPainter> wave2painterMap;
/**
* Constructor for ScrollableCanvas.
*
* @param parent
* the parent of this control.super(parent, style | SWT.DOUBLE_BUFFERED | SWT.NO_BACKGROUND | SWT.NO_REDRAW_RESIZE | SWT.V_SCROLL | SWT.H_SCROLL);
* @param style
* the style of this control.
*/
public WaveformCanvas(final Composite parent, int style, IWaveformStyleProvider styleProvider) {
super(parent, style | SWT.DOUBLE_BUFFERED | SWT.NO_BACKGROUND | SWT.V_SCROLL | SWT.H_SCROLL);
this.styleProvider=styleProvider;
addControlListener(new ControlAdapter() { /* resize listener. */
/**
* Constructor for ScrollableCanvas.
*
* @param parent
* the parent of this control.super(parent, style | SWT.DOUBLE_BUFFERED | SWT.NO_BACKGROUND | SWT.NO_REDRAW_RESIZE | SWT.V_SCROLL | SWT.H_SCROLL);
* @param style
* the style of this control.
*/
public WaveformCanvas(final Composite parent, int style, IWaveformStyleProvider styleProvider) {
super(parent, style | SWT.DOUBLE_BUFFERED | SWT.NO_BACKGROUND | SWT.V_SCROLL | SWT.H_SCROLL);
this.styleProvider=styleProvider;
addControlListener(new ControlAdapter() { /* resize listener. */
@Override
public void controlResized(ControlEvent event) {
syncScrollBars();
}
});
addPaintListener((final PaintEvent event) -> paint(event.gc));
painterList = new LinkedList<>();
origin = new Point(0, 0);
selectionListeners = new LinkedList<>();
cursorPainters= new ArrayList<>();
wave2painterMap=new HashMap<>();
initScrollBars();
syncScrollBars();
}
});
addPaintListener((final PaintEvent event) -> paint(event.gc));
painterList = new LinkedList<>();
origin = new Point(0, 0);
selectionListeners = new LinkedList<>();
cursorPainters= new ArrayList<>();
wave2painterMap=new HashMap<>();
initScrollBars();
// order is important: it is bottom to top
trackAreaPainter=new TrackAreaPainter(this);
painterList.add(trackAreaPainter);
arrowPainter=new ArrowPainter(this, IWaveformView.NEXT_PREV_IN_STREAM);
painterList.add(arrowPainter);
rulerPainter=new RulerPainter(this);
painterList.add(rulerPainter);
trackAreaPainter=new TrackAreaPainter(this);
painterList.add(trackAreaPainter);
arrowPainter=new ArrowPainter(this, IWaveformView.NEXT_PREV_IN_STREAM);
painterList.add(arrowPainter);
rulerPainter=new RulerPainter(this);
painterList.add(rulerPainter);
CursorPainter cp = new CursorPainter(this, scaleFactor * 10, cursorPainters.size()-1);
painterList.add(cp);
cursorPainters.add(cp);
@ -117,86 +121,109 @@ public class WaveformCanvas extends Canvas {
painterList.add(marker);
cursorPainters.add(marker);
wave2painterMap=new HashMap<>();
}
}
public void addCursoPainter(CursorPainter cursorPainter){
painterList.add(cursorPainter);
cursorPainters.add(cursorPainter);
}
public void setHighliteRelation(RelationType relationType){
if(arrowPainter!=null){
boolean redraw = arrowPainter.getHighlightType()!=relationType;
arrowPainter.setHighlightType(relationType);
if(redraw) redraw();
}
}
public Point getOrigin() {
return origin;
}
public int getWidth() {
return getClientArea().width;
}
public void setOrigin(Point origin) {
setOrigin(origin.x, origin.y);
}
public void setOrigin(int x, int y) {
checkWidget();
ScrollBar hBar = getHorizontalBar();
if(x<=0) hBar.setSelection(-x);
x = -hBar.getSelection();
ScrollBar vBar = getVerticalBar();
if(y<=0) vBar.setSelection(-y);
y = -vBar.getSelection();
origin.x = x;
origin.y = y;
syncScrollBars();
}
@Override
public long getMaxTime() {
return maxTime;
}
public void setMaxTime(long maxTime) {
this.maxTime = maxTime;
syncScrollBars();
}
@Override
public long getScale() {
return scaleFactor;
}
public void setHighliteRelation(RelationType relationType){
if(arrowPainter!=null){
boolean redraw = arrowPainter.getHighlightType()!=relationType;
arrowPainter.setHighlightType(relationType);
if(redraw) redraw();
}
}
public Point getOrigin() {
return origin;
}
@Override
public void setScale(long factor) {
setScalingFactor(factor, (getMaxVisibleTime()+getMinVisibleTime())/2);
}
public int getWidth() {
return getClientArea().width;
}
public void setOrigin(Point origin) {
setOrigin(origin.x, origin.y);
}
@Override
public void setVisibleRange(long startTime, long endTime) {
assert(startTime<endTime);
long time_diff = endTime-startTime;
long factor = (time_diff*11/10)/getClientArea().width;
setScalingFactor(factor, startTime+time_diff/2);
}
public void setOrigin(int x, int y) {
checkWidget();
ScrollBar hBar = getHorizontalBar();
hBar.setSelection(-x);
x = -hBar.getSelection();
ScrollBar vBar = getVerticalBar();
vBar.setSelection(-y);
y = -vBar.getSelection();
origin.x = x;
origin.y = y;
syncScrollBars();
}
public long getMaxTime() {
return maxTime;
}
public void setMaxTime(long maxTime) {
this.maxTime = maxTime;
syncScrollBars();
}
public int getZoomLevel() {
return level;
}
public int getMaxZoomLevel(){
return Constants.UNIT_MULTIPLIER.length*Constants.UNIT_STRING.length-1;
}
public void setZoomLevel(int level) {
long tc=cursorPainters.get(0).getTime(); // cursor time
setZoomLevel(level, tc);
}
public void setZoomLevel(int level, long centerTime) {
if(level<0) {
level = findFitZoomLevel();
if(level<0) level = 0;
}
//FIXME: keep center if zoom-out and cursor is not in view
long xc=centerTime/this.scaleFactor; // cursor total x-offset
if(level<Constants.UNIT_MULTIPLIER.length*Constants.UNIT_STRING.length){
this.scaleFactor = (long) Math.pow(10, level>>1);
if(level%2==1) this.scaleFactor*=3;
ITx tx = arrowPainter.getTx();
arrowPainter.setTx(null);
/*
* xc = tc/oldScaleFactor
* xoffs = xc+origin.x
* xcn = tc/newScaleFactor
* t0n = (xcn-xoffs)*scaleFactor
*/
long xoffs=xc+origin.x; // cursor offset relative to left border
//@Override
public void setScalingFactor(long factor, long centerTime) {
Rectangle clientArea = getClientArea();
long clientAreaWidth = clientArea.width;
long maxFactor=maxTime/clientAreaWidth;
if(factor<0) {
if(factor== ZOOM_FIT) {
long cTime = getCursorPainters().get(0).getTime();
long time_diff = centerTime>cTime?centerTime-cTime:cTime-centerTime;
centerTime = (centerTime>cTime?cTime:centerTime)+time_diff/2;
factor = (time_diff*11/10)/clientAreaWidth;
} else if(factor== ZOOM_FULL)
factor = maxFactor;
}
if(factor==0)
factor=1;
else if(factor>maxFactor)
factor=maxFactor;
if(factor!=scaleFactor || (getMaxVisibleTime()+getMinVisibleTime()/2) != centerTime) {
scaleFactor = factor;
scaleMagnitude = 0;
for(int i=Constants.POWERS_OF_TEN.length-1; i>0; i--) {
if(scaleFactor>=Constants.POWERS_OF_TEN[i]) {
scaleMagnitude = i;
break;
}
}
ITx tx = arrowPainter.getTx();
arrowPainter.setTx(null);
/*
* xc = tc/oldScaleFactor
* xoffs = xc+origin.x
* xcn = tc/newScaleFactor
* t0n = (xcn-xoffs)*scaleFactor
*/
long xoffs = clientAreaWidth/2;
long xcn=centerTime/scaleFactor; // new total x-offset
long originX=xcn-xoffs;
if(originX>0) {
@ -204,340 +231,356 @@ public class WaveformCanvas extends Canvas {
}else {
origin.x=0;
}
syncScrollBars();
arrowPainter.setTx(tx);
redraw();
this.level = level;
}
}
private int findFitZoomLevel() {
//get area actually capable of displaying data, i.e. area of the receiver which is capable of displaying data
Rectangle clientArea = getClientArea();
long clientAreaWidth = clientArea.width;
//try to find existing zoomlevel where scaleFactor*clientAreaWidth >= maxTime, if one is found set it as new zoomlevel
int magnitude_factor=1;
for(int magnitude=0; magnitude<Constants.UNIT_STRING.length; magnitude++) {
for (int multiplier=0; multiplier<Constants.UNIT_MULTIPLIER.length; multiplier++){
int tempLevel = magnitude*Constants.UNIT_MULTIPLIER.length+multiplier;
long scaleFactor = Constants.UNIT_MULTIPLIER[multiplier]*magnitude_factor;
if(scaleFactor*clientAreaWidth >= maxTime)
return tempLevel;
}
magnitude_factor*=1000;
syncScrollBars();
arrowPainter.setTx(tx);
redraw();
}
return -1;
}
public long getScaleFactor() {
return scaleFactor;
}
@Override
public String timeToString(long time) {
int idx = scaleMagnitude/3;
double fTime = (double)time/Constants.UNIT_MULTIPLIER[idx];
return Constants.getTimeFormatForLevel(idx).format(fTime)+Constants.UNIT_STRING[idx];
}
public long getScaleFactorPow10() {
int scale = level/Constants.UNIT_MULTIPLIER.length;
double res = Math.pow(1000, scale);
return (long) res;
}
public long getTimeForOffset(int xOffset){
return (xOffset-origin.x) * scaleFactor;
}
public String getUnitStr(){
return Constants.UNIT_STRING[level/Constants.UNIT_MULTIPLIER.length];
}
public int getUnitMultiplier(){
return Constants.UNIT_MULTIPLIER[level%Constants.UNIT_MULTIPLIER.length];
}
public long getTimeForOffset(int xOffset){
return (xOffset-origin.x) * scaleFactor;
}
public void addPainter(IPainter painter) {
painterList.add(painter);
redraw();
}
public void addPainter(IPainter painter) {
painterList.add(painter);
redraw();
}
public void removePainter(IPainter painter) {
painterList.remove(painter);
redraw();
}
public void removePainter(IPainter painter) {
painterList.remove(painter);
redraw();
}
public void clearAllWaveformPainter() {
clearAllWaveformPainter(true);
}
void clearAllWaveformPainter(boolean update) {
trackAreaPainter.trackVerticalOffset.clear();
wave2painterMap.clear();
if(update) syncScrollBars();
}
public void clearAllWaveformPainter() {
clearAllWaveformPainter(true);
}
public void addWaveformPainter(IWaveformPainter painter) {
addWaveformPainter(painter, true);
}
void addWaveformPainter(IWaveformPainter painter, boolean update) {
trackAreaPainter.addTrackPainter(painter);
wave2painterMap.put(painter.getTrackEntry().waveform, painter);
if(update) syncScrollBars();
}
void clearAllWaveformPainter(boolean update) {
trackAreaPainter.trackVerticalOffset.clear();
wave2painterMap.clear();
if(update) syncScrollBars();
}
public List<CursorPainter> getCursorPainters() {
public void addWaveformPainter(IWaveformPainter painter) {
addWaveformPainter(painter, true);
}
void addWaveformPainter(IWaveformPainter painter, boolean update) {
trackAreaPainter.addTrackPainter(painter);
wave2painterMap.put(painter.getTrackEntry().waveform, painter);
if(update) syncScrollBars();
}
public List<CursorPainter> getCursorPainters() {
return cursorPainters;
}
/* Initialize the scrollbar and register listeners. */
private void initScrollBars() {
ScrollBar horizontal = getHorizontalBar();
horizontal.setEnabled(false);
horizontal.setVisible(true);
horizontal.addSelectionListener(new SelectionAdapter() {
/* Initialize the scrollbar and register listeners. */
private void initScrollBars() {
ScrollBar horizontal = getHorizontalBar();
horizontal.setEnabled(false);
horizontal.setVisible(true);
horizontal.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
if (painterList.isEmpty())
return;
setOrigin(-((ScrollBar) event.widget).getSelection(), origin.y);
}
});
ScrollBar vertical = getVerticalBar();
vertical.setEnabled(false);
vertical.setVisible(true);
vertical.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (painterList.isEmpty())
return;
setOrigin(-((ScrollBar) event.widget).getSelection(), origin.y);
}
});
ScrollBar vertical = getVerticalBar();
vertical.setEnabled(false);
vertical.setVisible(true);
vertical.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
if (painterList.isEmpty())
return;
setOrigin(origin.x, -((ScrollBar) event.widget).getSelection());
}
});
}
/**
* Synchronize the scrollbar with the image. If the transform is out of
* range, it will correct it. This function considers only following factors
* :<b> transform, image size, client area</b>.
*/
public void syncScrollBars() {
if (painterList.isEmpty()) {
redraw();
return;
}
int height = trackAreaPainter.getHeight(); // incl. Ruler
long width = maxTime / scaleFactor;
Rectangle clientArea=getClientArea();
ScrollBar horizontal = getHorizontalBar();
horizontal.setIncrement(getClientArea().width / 100);
horizontal.setPageIncrement(getClientArea().width);
int clientWidthw = clientArea.width;
if (width > clientWidthw) { /* image is wider than client area */
horizontal.setMinimum(0);
horizontal.setMaximum((int)width);
horizontal.setEnabled(true);
if (-origin.x > horizontal.getMaximum() - clientWidthw) {
origin.x = -horizontal.getMaximum() + clientWidthw;
}
} else { /* image is narrower than client area */
horizontal.setEnabled(false);
}
horizontal.setThumb(clientWidthw);
horizontal.setSelection(-origin.x);
ScrollBar vertical = getVerticalBar();
vertical.setIncrement(getClientArea().height / 100);
vertical.setPageIncrement(getClientArea().height);
int clientHeighth = clientArea.height;
if (height > clientHeighth) { /* image is higher than client area */
vertical.setMinimum(0);
vertical.setMaximum(height);
vertical.setEnabled(true);
if ( -origin.y > vertical.getMaximum() - clientHeighth) {
origin.y = -vertical.getMaximum() + clientHeighth;
}
} else { /* image is less higher than client area */
vertical.setMaximum(clientHeighth);
vertical.setEnabled(false);
}
vertical.setThumb(clientHeighth);
vertical.setSelection(-origin.y);
redraw();
fireSelectionEvent();
}
/* Paint function */
private void paint(GC gc) {
Point pt = getSize();
if(pt.x==0 || pt.y==0) return;
Rectangle clientRect = getClientArea(); /* Canvas' painting area */
GC thisGc = gc;
Image dBackingImg = null;
if(doubleBuffering) {
dBackingImg = new Image(getDisplay(), pt.x, pt.y);
thisGc = new GC(dBackingImg);
thisGc.setBackground(gc.getBackground());
thisGc.setForeground(gc.getForeground());
thisGc.setFont(gc.getFont());
}
Projection p = new Projection(thisGc);
p.setTranslation(origin);
if (!painterList.isEmpty() ) {
for (IPainter painter : painterList)
painter.paintArea(p, clientRect);
} else {
gc.fillRectangle(clientRect);
initScrollBars();
}
if(doubleBuffering) {
gc.drawImage(dBackingImg, 0, 0);
if(dBackingImg!=null) dBackingImg.dispose();
thisGc.dispose();
}
}
public List<Object> getElementsAt(Point point) {
LinkedList<Object> result=new LinkedList<>();
for (IPainter p : Lists.reverse(painterList)) {
if (p instanceof TrackAreaPainter) {
int y = point.y - origin.y;
int x = point.x - origin.x;
Entry<Integer, IWaveformPainter> entry = trackAreaPainter.trackVerticalOffset.floorEntry(y);
if (entry != null) {
if (entry.getValue() instanceof StreamPainter) {
ITx tx = ((StreamPainter) entry.getValue()).getClicked(new Point(x, y - entry.getKey()));
if(tx!=null)
result.add(tx);
}
result.add(entry.getValue().getTrackEntry());
}
} else if (p instanceof CursorPainter) {
if (Math.abs(point.x - origin.x - ((CursorPainter) p).getTime()/scaleFactor) < 2) {
result.add(p);
}
}
}
return result;
}
public List<Object> getEntriesAtPosition(IWaveform iWaveform, int i) {
LinkedList<Object> result=new LinkedList<>();
int x = i - origin.x;
for(IWaveformPainter p: wave2painterMap.values()){
if (p instanceof StreamPainter && ((StreamPainter)p).getStream()==iWaveform) {
result.add(((StreamPainter) p).getClicked(new Point(x, styleProvider.getTrackHeight()/2)));
}
}
return result;
}
public void setSelected(ITx currentSelection) {
this.currentSelection = currentSelection;
if (currentSelection != null)
reveal(currentSelection);
arrowPainter.setTx(currentSelection);
redraw();
}
public void reveal(ITx tx) {
int lower = (int) (tx.getBeginTime() / scaleFactor);
int higher = (int) (tx.getEndTime() / scaleFactor);
Point size = getSize();
size.x -= getVerticalBar().getSize().x + 2;
size.y -= getHorizontalBar().getSize().y;
if (lower < -origin.x) {
setOrigin(-lower, origin.y);
} else if (higher > (size.x - origin.x)) {
setOrigin(size.x - higher, origin.y);
}
for (IWaveformPainter painter : wave2painterMap.values()) {
if (painter instanceof StreamPainter && ((StreamPainter) painter).getStream() == tx.getStream()) {
EventEntry entry = tx.getStream().getEvents().floorEntry(tx.getBeginTime());
Optional<IEvent> res = Arrays.stream(entry.events).filter(e -> ((ITxEvent)e).getTransaction().equals(tx)).findFirst();
if(res.isPresent()) {
int top = painter.getVerticalOffset() + styleProvider.getTrackHeight() * ((ITxEvent)res.get()).getRowIndex();
int bottom = top + styleProvider.getTrackHeight();
if (top < -origin.y) {
setOrigin(origin.x, -(top-styleProvider.getTrackHeight()));
} else if (bottom > (size.y - origin.y)) {
setOrigin(origin.x, size.y - bottom);
}
}
}
}
}
public void reveal(IWaveform waveform) {
for (IWaveformPainter painter : wave2painterMap.values()) {
TrackEntry te = painter.getTrackEntry();
if(te.waveform == waveform) {
Point size = getSize();
size.y -=+rulerHeight;
ScrollBar sb = getHorizontalBar();
if((sb.getStyle()&SWT.SCROLLBAR_OVERLAY)!=0 && sb.isVisible())
size.y-= getHorizontalBar().getSize().y;
int top = te.vOffset;
int bottom = top + styleProvider.getTrackHeight();
if (top < -origin.y) {
setOrigin(origin.x, -(top-styleProvider.getTrackHeight()));
} else if (bottom > (size.y - origin.y)) {
setOrigin(origin.x, size.y - bottom);
}
}
}
public void widgetSelected(SelectionEvent event) {
if (painterList.isEmpty())
return;
setOrigin(origin.x, -((ScrollBar) event.widget).getSelection());
}
});
}
public void reveal(long time) {
int scaledTime = (int) (time / scaleFactor);
Point size = getSize();
size.x -= getVerticalBar().getSize().x + 2;
size.y -= getHorizontalBar().getSize().y;
if (scaledTime < -origin.x) {
setOrigin(-scaledTime+10, origin.y);
} else if (scaledTime > (size.x - origin.x)) {
setOrigin(size.x - scaledTime-30, origin.y);
}
}
/**
* Synchronize the scrollbar with the image. If the transform is out of
* range, it will correct it. This function considers only following factors
* :<b> transform, image size, client area</b>.
*/
public void syncScrollBars() {
if (painterList.isEmpty()) {
redraw();
return;
}
int height = trackAreaPainter.getHeight(); // incl. Ruler
long width = maxTime / scaleFactor;
Rectangle clientArea=getClientArea();
ScrollBar horizontal = getHorizontalBar();
horizontal.setIncrement(getClientArea().width / 100);
horizontal.setPageIncrement(getClientArea().width);
int clientWidthw = clientArea.width;
if (width > clientWidthw) { /* image is wider than client area */
horizontal.setMinimum(0);
horizontal.setMaximum((int)width);
horizontal.setEnabled(true);
if (-origin.x > horizontal.getMaximum() - clientWidthw) {
origin.x = -horizontal.getMaximum() + clientWidthw;
}
} else { /* image is narrower than client area */
horizontal.setEnabled(false);
}
horizontal.setThumb(clientWidthw);
horizontal.setSelection(-origin.x);
public int getRulerHeight() {
return rulerHeight;
}
ScrollBar vertical = getVerticalBar();
vertical.setIncrement(getClientArea().height / 100);
vertical.setPageIncrement(getClientArea().height);
int clientHeighth = clientArea.height;
if (height > clientHeighth) { /* image is higher than client area */
vertical.setMinimum(0);
vertical.setMaximum(height);
vertical.setEnabled(true);
if ( -origin.y > vertical.getMaximum() - clientHeighth) {
origin.y = -vertical.getMaximum() + clientHeighth;
}
} else { /* image is less higher than client area */
vertical.setMaximum(clientHeighth);
vertical.setEnabled(false);
}
vertical.setThumb(clientHeighth);
vertical.setSelection(-origin.y);
redraw();
fireSelectionEvent();
}
public void setRulerHeight(int rulerHeight) {
this.rulerHeight = rulerHeight;
}
/* Paint function */
private void paint(GC gc) {
Point pt = getSize();
if(pt.x==0 || pt.y==0) return;
Rectangle clientRect = getClientArea(); /* Canvas' painting area */
GC thisGc = gc;
Image dBackingImg = null;
if(doubleBuffering) {
dBackingImg = new Image(getDisplay(), pt.x, pt.y);
thisGc = new GC(dBackingImg);
thisGc.setBackground(gc.getBackground());
thisGc.setForeground(gc.getForeground());
thisGc.setFont(gc.getFont());
public void addSelectionListener(SelectionAdapter selectionAdapter) {
selectionListeners.add(selectionAdapter);
}
}
Projection p = new Projection(thisGc);
p.setTranslation(origin);
if (!painterList.isEmpty() ) {
for (IPainter painter : painterList)
painter.paintArea(p, clientRect);
} else {
gc.fillRectangle(clientRect);
initScrollBars();
}
if(doubleBuffering) {
gc.drawImage(dBackingImg, 0, 0);
if(dBackingImg!=null) dBackingImg.dispose();
thisGc.dispose();
}
}
public void removeSelectionListener(SelectionAdapter selectionAdapter) {
selectionListeners.remove(selectionAdapter);
}
public List<Object> getElementsAt(Point point) {
LinkedList<Object> result=new LinkedList<>();
for (IPainter p : Lists.reverse(painterList)) {
if (p instanceof TrackAreaPainter) {
int y = point.y - origin.y;
int x = point.x - origin.x;
Entry<Integer, IWaveformPainter> entry = trackAreaPainter.trackVerticalOffset.floorEntry(y);
if (entry != null) {
if (entry.getValue() instanceof StreamPainter) {
ITx tx = ((StreamPainter) entry.getValue()).getClicked(new Point(x, y - entry.getKey()));
if(tx!=null)
result.add(tx);
}
result.add(entry.getValue().getTrackEntry());
}
} else if (p instanceof CursorPainter) {
if (Math.abs(point.x - origin.x - ((CursorPainter) p).getTime()/scaleFactor) < 2) {
result.add(p);
}
}
}
return result;
}
/**
*
*/
protected void fireSelectionEvent() {
Event e = new Event();
e.widget = this;
e.detail=SWT.SELECTED;
e.type=SWT.Selection;
SelectionEvent ev = new SelectionEvent(e);
ev.x = origin.x;
ev.y = origin.y;
for (SelectionAdapter a : selectionListeners) {
a.widgetSelected(ev);
}
}
public List<Object> getEntriesAtPosition(IWaveform iWaveform, int i) {
LinkedList<Object> result=new LinkedList<>();
int x = i - origin.x;
for(IWaveformPainter p: wave2painterMap.values()){
if (p instanceof StreamPainter && ((StreamPainter)p).getStream()==iWaveform) {
result.add(((StreamPainter) p).getClicked(new Point(x, styleProvider.getTrackHeight()/2)));
}
}
return result;
}
long getMaxVisibleTime() {
return (getClientArea().width+origin.x)*scaleFactor;
}
public void setSelected(ITx currentSelection) {
this.currentSelection = currentSelection;
if (currentSelection != null)
reveal(currentSelection);
arrowPainter.setTx(currentSelection);
redraw();
}
long getMinVisibleTime() {
return origin.x * scaleFactor;
}
public void reveal(ITx tx) {
int lower = (int) (tx.getBeginTime() / scaleFactor);
int higher = (int) (tx.getEndTime() / scaleFactor);
Point size = getSize();
size.x -= getVerticalBar().getSize().x + 2;
size.y -= getHorizontalBar().getSize().y;
if (lower < -origin.x) {
setOrigin(-lower, origin.y);
} else if (higher > (size.x - origin.x)) {
setOrigin(size.x - higher, origin.y);
}
for (IWaveformPainter painter : wave2painterMap.values()) {
if (painter instanceof StreamPainter && ((StreamPainter) painter).getStream() == tx.getStream()) {
EventEntry entry = tx.getStream().getEvents().floorEntry(tx.getBeginTime());
Optional<IEvent> res = Arrays.stream(entry.events).filter(e -> ((ITxEvent)e).getTransaction().equals(tx)).findFirst();
if(res.isPresent()) {
int top = painter.getVerticalOffset() + styleProvider.getTrackHeight() * ((ITxEvent)res.get()).getRowIndex();
int bottom = top + styleProvider.getTrackHeight();
if (top < -origin.y) {
setOrigin(origin.x, -(top-styleProvider.getTrackHeight()));
} else if (bottom > (size.y - origin.y)) {
setOrigin(origin.x, size.y - bottom);
}
}
}
}
}
public void reveal(IWaveform waveform) {
for (IWaveformPainter painter : wave2painterMap.values()) {
TrackEntry te = painter.getTrackEntry();
if(te.waveform == waveform) {
Point size = getSize();
size.y -=+rulerHeight;
ScrollBar sb = getHorizontalBar();
if((sb.getStyle()&SWT.SCROLLBAR_OVERLAY)!=0 && sb.isVisible())
size.y-= getHorizontalBar().getSize().y;
int top = te.vOffset;
int bottom = top + styleProvider.getTrackHeight();
if (top < -origin.y) {
setOrigin(origin.x, -(top-styleProvider.getTrackHeight()));
} else if (bottom > (size.y - origin.y)) {
setOrigin(origin.x, size.y - bottom);
}
}
}
}
public void reveal(long time) {
int scaledTime = (int) (time / scaleFactor);
Point size = getSize();
size.x -= getVerticalBar().getSize().x + 2;
size.y -= getHorizontalBar().getSize().y;
if (scaledTime < -origin.x) {
setOrigin(-scaledTime+10, origin.y);
} else if (scaledTime > (size.x - origin.x)) {
setOrigin(size.x - scaledTime-30, origin.y);
}
}
@Override
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() {
return rulerHeight;
}
public void setRulerHeight(int rulerHeight) {
this.rulerHeight = rulerHeight;
}
public void addSelectionListener(SelectionAdapter selectionAdapter) {
selectionListeners.add(selectionAdapter);
}
public void removeSelectionListener(SelectionAdapter selectionAdapter) {
selectionListeners.remove(selectionAdapter);
}
/**
*
*/
protected void fireSelectionEvent() {
Event e = new Event();
e.widget = this;
e.detail=SWT.SELECTED;
e.type=SWT.Selection;
SelectionEvent ev = new SelectionEvent(e);
ev.x = origin.x;
ev.y = origin.y;
for (SelectionAdapter a : selectionListeners) {
a.widgetSelected(ev);
}
}
@Override
public long getMaxVisibleTime() {
return (getClientArea().width-origin.x)*scaleFactor;
}
@Override
public long getMinVisibleTime() {
return -origin.x * scaleFactor;
}
@Override
public void setMinVisibleTime(long time) {
long duration = getMaxVisibleTime()-getMinVisibleTime();
if(time>0) {
if((time+duration)<getMaxTime()) {
int scaledTime = (int) (time / scaleFactor);
setOrigin(-scaledTime, origin.y);
}
} else {
setOrigin(0, origin.y);
}
}
@Override
public void zoom(ZoomKind kind) {
switch(kind) {
case IN:
setScale(getScale()/2);
break;
case OUT:
setScale(getScale()*2);
break;
case FIT:
setScalingFactor(WaveformCanvas.ZOOM_FIT, cursorPainters.get(1).getTime());
break;
case FULL:
setScale(WaveformCanvas.ZOOM_FULL);
break;
}
}
public void setStyleProvider(IWaveformStyleProvider styleProvider) {
this.styleProvider=styleProvider;
redraw();
}
public int getScaleMagnitude() {
return scaleMagnitude;
}
}

View File

@ -13,7 +13,6 @@ package com.minres.scviewer.database.ui.swt.internal;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@ -90,8 +89,8 @@ import com.minres.scviewer.database.ui.GotoDirection;
import com.minres.scviewer.database.ui.ICursor;
import com.minres.scviewer.database.ui.IWaveformStyleProvider;
import com.minres.scviewer.database.ui.IWaveformView;
import com.minres.scviewer.database.ui.IWaveformZoom;
import com.minres.scviewer.database.ui.TrackEntry;
import com.minres.scviewer.database.ui.swt.Constants;
public class WaveformView implements IWaveformView {
@ -99,8 +98,6 @@ public class WaveformView implements IWaveformView {
private PropertyChangeSupport pcs;
static final DecimalFormat df = new DecimalFormat("#0.00####");
private ITx currentTxSelection;
private ArrayList<TrackEntry> currentWaveformSelection = new ArrayList<>();
@ -163,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);
}
@ -197,64 +193,45 @@ public class WaveformView implements IWaveformView {
down = false;
if (start == null)
return;
if ((e.stateMask & SWT.MODIFIER_MASK & ~SWT.SHIFT) != 0)
return; // don't react on modifier except shift
if (e.button == 1 && Math.abs(e.x - start.x) > 3) {
asyncUpdate(e.widget);
long startTime = waveformCanvas.getTimeForOffset(start.x);
long endTime = waveformCanvas.getTimeForOffset(end.x);
long targetTimeRange = endTime - startTime;
long currentTimeRange = waveformCanvas.getMaxVisibleTime() - waveformCanvas.getMinVisibleTime();
if (targetTimeRange == 0)
return;
long relation = currentTimeRange / targetTimeRange;
long i = 1;
int level = 0;
do {
if (relation < 0) {
if (-relation < i) {
break;
}
level--;
if (-relation < i * 3) {
break;
}
level--;
} else {
if (relation < i) {
break;
}
level++;
if (relation < i * 3) {
break;
}
level++;
}
i = i * 10;
} while (i < 10000);
if (i < 10000) {
int curLevel = waveformCanvas.getZoomLevel();
waveformCanvas.setZoomLevel(curLevel - level, (startTime + endTime) / 2);
}
} else if (e.button == 1 && ((e.stateMask & SWT.SHIFT) == 0)) {
// set cursor (button 1 and no shift)
if (Math.abs(e.x - start.x) < 3 && Math.abs(e.y - start.y) < 3) {
// first set cursor time
setCursorTime(snapOffsetToEvent(start));
// then set selection and reveal
setSelection(new StructuredSelection(initialSelected));
if ((e.stateMask & SWT.MODIFIER_MASK & ~(SWT.SHIFT | SWT.CTRL)) != 0)
return; // don't react on modifier except shift and control
boolean isCtrl = (e.stateMask & SWT.CTRL)!=0;
boolean isShift = (e.stateMask & SWT.SHIFT)!=0;
if (e.button == 1) {
if (Math.abs(e.x - start.x) > 3) { // was drag event
asyncUpdate(e.widget);
long startTime = waveformCanvas.getTimeForOffset(start.x);
long endTime = waveformCanvas.getTimeForOffset(end.x);
if(startTime<endTime) {
waveformCanvas.setVisibleRange(startTime, endTime);
} else {
long targetTimeRange = startTime-endTime;
long currentTimeRange = waveformCanvas.getMaxVisibleTime() - waveformCanvas.getMinVisibleTime();
long factor = currentTimeRange/targetTimeRange *waveformCanvas.getScale();
waveformCanvas.setScalingFactor(factor, (startTime+endTime)/2);
}
} else if( isShift) { // set marker (button 1 and shift)
setMarkerTime(selectedMarker, snapOffsetToEvent(start));
} else if(isCtrl) { // set cursor (button 1 and ctrl)
setCursorTime(snapOffsetToEvent(start));
} else { // set cursor (button 1 only)
if (Math.abs(e.y - start.y) < 3) {
// first set cursor time
setCursorTime(snapOffsetToEvent(start));
// then set selection and reveal
setSelection(new StructuredSelection(initialSelected));
}
}
} else if (e.button == 2 || (e.button == 1 && (e.stateMask & SWT.SHIFT) != 0)) {
// set marker (button 1 and shift)
setMarkerTime(snapOffsetToEvent(start), selectedMarker);
asyncUpdate(e.widget);
} else if (e.button == 2) { // set marker (button 2)
setMarkerTime(selectedMarker, snapOffsetToEvent(start));
}
asyncUpdate(e.widget);
}
protected long snapOffsetToEvent(Point p) {
long time = waveformCanvas.getTimeForOffset(p.x);
long scaling = 5 * waveformCanvas.getScaleFactor();
long scaling = 5 * waveformCanvas.getScale();
for (Object o : waveformCanvas.getElementsAt(p)) {
EventEntry floorEntry = null;
EventEntry ceilEntry = null;
@ -288,6 +265,12 @@ public class WaveformView implements IWaveformView {
public void handleEvent(Event e) {
switch (e.type) {
case SWT.MouseWheel:
if((e.stateMask & SWT.CTRL) != 0) {
if(e.count<0)
waveformCanvas.setScale(waveformCanvas.getScale()*11/10);
else
waveformCanvas.setScale(waveformCanvas.getScale()*10/11);
}
break;
case SWT.MouseDown:
start = new Point(e.x, e.y);
@ -461,6 +444,17 @@ public class WaveformView implements IWaveformView {
toolTipHandler = new ToolTipHandler(parent.getShell());
toolTipHandler.activateHoverHelp(waveformCanvas);
// This is the filter that prevents the default handling of mouse wheel in waveformCanvas
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.stateMask & SWT.CTRL) != 0) {
waveformMouseListener.handleEvent(e);
e.doit = false;
}
}
});
}
private void createTextPane(Composite namePane, String text) {
@ -752,27 +746,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 {
@ -930,7 +927,7 @@ public class WaveformView implements IWaveformView {
return candidates.get(0);
default:
ArrayList<ITxRelation> visibleCandidates = candidates.stream().filter(this::streamsVisible)
.collect(Collectors.toCollection(ArrayList::new));
.collect(Collectors.toCollection(ArrayList::new));
if (visibleCandidates.isEmpty()) {
return new RelSelectionDialog(waveformCanvas.getShell(), candidates, target).open();
} else if (visibleCandidates.size() == 1) {
@ -1115,16 +1112,6 @@ public class WaveformView implements IWaveformView {
this.waveformCanvas.setHighliteRelation(relationType);
}
/*
* (non-Javadoc)
*
* @see com.minres.scviewer.database.swt.IWaveformPanel#getMaxTime()
*/
@Override
public long getMaxTime() {
return waveformCanvas.getMaxTime();
}
/*
* (non-Javadoc)
*
@ -1135,27 +1122,6 @@ public class WaveformView implements IWaveformView {
this.waveformCanvas.setMaxTime(maxTime);
}
/*
* (non-Javadoc)
*
* @see com.minres.scviewer.database.swt.IWaveformPanel#setZoomLevel(int)
*/
@Override
public void setZoomLevel(int scale) {
waveformCanvas.setZoomLevel(scale);
waveformCanvas.reveal(getCursorTime());
}
/*
* (non-Javadoc)
*
* @see com.minres.scviewer.database.swt.IWaveformPanel#getZoomLevel()
*/
@Override
public int getZoomLevel() {
return waveformCanvas.getZoomLevel();
}
/*
* (non-Javadoc)
*
@ -1174,10 +1140,10 @@ public class WaveformView implements IWaveformView {
* @see com.minres.scviewer.database.swt.IWaveformPanel#setMarkerTime(long, int)
*/
@Override
public void setMarkerTime(long time, int index) {
if (waveformCanvas.getCursorPainters().size() > index + 1) {
final Long oldVal = waveformCanvas.getCursorPainters().get(1 + index).getTime();
waveformCanvas.getCursorPainters().get(1 + index).setTime(time);
public void setMarkerTime(int marker, long time) {
if (waveformCanvas.getCursorPainters().size() > marker + 1) {
final Long oldVal = waveformCanvas.getCursorPainters().get(1 + marker).getTime();
waveformCanvas.getCursorPainters().get(1 + marker).setTime(time);
pcs.firePropertyChange(MARKER_PROPERTY, oldVal, time);
}
}
@ -1198,7 +1164,7 @@ public class WaveformView implements IWaveformView {
* @see com.minres.scviewer.database.swt.IWaveformPanel#getActMarkerTime()
*/
@Override
public int getSelectedMarkerId() {
public int getSelectedMarker() {
return selectedMarker;
}
@ -1230,7 +1196,7 @@ public class WaveformView implements IWaveformView {
if (event.y < tracksVerticalHeight) {
event.doit = true;
LocalSelectionTransfer.getTransfer()
.setSelection(new StructuredSelection(currentWaveformSelection));
.setSelection(new StructuredSelection(currentWaveformSelection));
}
}
@ -1450,58 +1416,32 @@ public class WaveformView implements IWaveformView {
return this.pcs.hasListeners(propertyName);
}
/*
* (non-Javadoc)
*
* @see com.minres.scviewer.database.swt.IWaveformPanel#getScaledTime(long)
*/
@Override
public String getScaledTime(long time) {
StringBuilder sb = new StringBuilder();
double dTime = time;
double scaledTime = dTime / waveformCanvas.getScaleFactorPow10();
return sb.append(df.format(scaledTime)).append(waveformCanvas.getUnitStr()).toString();
}
/*
* (non-Javadoc)
*
* @see com.minres.scviewer.database.swt.IWaveformPanel#getZoomLevels()
*/
@Override
public String[] getZoomLevels() {
String[] res = new String[Constants.UNIT_MULTIPLIER.length * Constants.UNIT_STRING.length];
int index = 0;
for (String unit : Constants.UNIT_STRING) {
for (int factor : Constants.UNIT_MULTIPLIER) {
res[index++] = Integer.toString(factor) + unit;
}
}
return res;
}
@Override
public long getBaselineTime() {
return -waveformCanvas.getScaleFactorPow10() * waveformCanvas.getOrigin().x;
}
@Override
public void setBaselineTime(Long time) {
Point origin = waveformCanvas.getOrigin();
origin.x = (int) (-time / waveformCanvas.getScaleFactorPow10());
waveformCanvas.setOrigin(origin);
}
@Override
public void scrollHorizontal(int percent) {
if (percent < -100)
percent = -100;
if (percent > 100)
percent = 100;
int diff = (waveformCanvas.getWidth() * percent) / 100;
Point o = waveformCanvas.getOrigin();
waveformCanvas.setOrigin(o.x - diff, o.y);
waveformCanvas.redraw();
long minTime = waveformCanvas.getMinVisibleTime();
long duration = waveformCanvas.getMaxVisibleTime()-minTime;
long diff = (duration * percent) / 100;
waveformCanvas.setMinVisibleTime(minTime+diff);
}
@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) {
@ -1533,5 +1473,13 @@ 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();
}
@Override
public IWaveformZoom getWaveformZoom() {
return waveformCanvas;
}
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="VCDDbLoader">
<implementation class="com.minres.scviewer.database.vcd.VCDDbLoader"/>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="VCDDbLoaderFactory">
<implementation class="com.minres.scviewer.database.vcd.VCDDbLoaderFactory"/>
<service>
<provide interface="com.minres.scviewer.database.IWaveformDbLoader"/>
<provide interface="com.minres.scviewer.database.IWaveformDbLoaderFactory"/>
</service>
</scr:component>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>2.13.2</version>
<version>2.15.0</version>
<relativePath>../..</relativePath>
</parent>
<packaging>eclipse-plugin</packaging>

View File

@ -164,7 +164,8 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
@Override
public void enterModule(String tokenString) {
if(moduleStack.isEmpty()) {
if("SystemC".compareTo(tokenString)!=0) moduleStack.push(tokenString);
if("SystemC".compareTo(tokenString)!=0)
moduleStack.push(tokenString);
} else
moduleStack.push(moduleStack.peek()+"."+tokenString);

View File

@ -0,0 +1,77 @@
/*******************************************************************************
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.vcd;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.zip.GZIPInputStream;
import com.minres.scviewer.database.IWaveformDbLoader;
import com.minres.scviewer.database.IWaveformDbLoaderFactory;
/**
* The Class VCDDb.
*/
public class VCDDbLoaderFactory implements IWaveformDbLoaderFactory {
/**
* Checks if is gzipped.
*
* @param f the f
* @return true, if is gzipped
*/
private static boolean isGzipped(File f) {
try (InputStream is = new FileInputStream(f)) {
byte [] signature = new byte[2];
int nread = is.read( signature ); //read the gzip signature
return nread == 2 && signature[ 0 ] == (byte) 0x1f && signature[ 1 ] == (byte) 0x8b;
}
catch (IOException e) {
return false;
}
}
/**
* Can load.
*
* @param inputFile the input file
* @return true, if successful
*/
@Override
public boolean canLoad(File inputFile) {
if(!inputFile.isDirectory() || inputFile.exists()) {
String name = inputFile.getName();
if(!(name.endsWith(".vcd") ||
name.endsWith(".vcdz") ||
name.endsWith(".vcdgz") ||
name.endsWith(".vcd.gz")) )
return false;
boolean gzipped = isGzipped(inputFile);
try(InputStream stream = gzipped ? new GZIPInputStream(new FileInputStream(inputFile)) : new FileInputStream(inputFile)){
byte[] buffer = new byte[8];
if (stream.read(buffer, 0, buffer.length) == buffer.length) {
return buffer[0]=='$';
}
} catch (Exception e) {
return false;
}
}
return false;
}
@Override
public IWaveformDbLoader getLoader() {
return new VCDDbLoader();
}
}

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="com.minres.scviewer.database.loader">
<implementation class="com.minres.scviewer.database.internal.WaveformDb"/>
<reference bind="bind" cardinality="1..n" interface="com.minres.scviewer.database.IWaveformDbLoader" name="IWaveformDbLoader" policy="dynamic" unbind="unbind"/>
<reference bind="bind" cardinality="1..n" interface="com.minres.scviewer.database.IWaveformDbLoaderFactory" name="IWaveformDbLoaderFactory" policy="dynamic" unbind="unbind"/>
</scr:component>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>2.13.2</version>
<version>2.15.0</version>
<relativePath>../..</relativePath>
</parent>
<packaging>eclipse-plugin</packaging>

View File

@ -0,0 +1,33 @@
/*******************************************************************************
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database;
import java.io.File;
/**
* A factory for creating IWaveformDb objects.
*/
public interface IWaveformDbLoaderFactory {
/**
* Check if the loader produced by this factory can load the given file.
*
* @param inputFile the input file
* @return true, if successful
*/
public boolean canLoad(File inputFile);
/**
* Gets the database.
*
* @return the database
*/
IWaveformDbLoader getLoader();
}

View File

@ -15,16 +15,17 @@ import java.beans.PropertyChangeListener;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.minres.scviewer.database.HierNode;
import com.minres.scviewer.database.IHierNode;
import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.IWaveformDb;
import com.minres.scviewer.database.IWaveformDbLoader;
import com.minres.scviewer.database.IWaveformDbLoaderFactory;
import com.minres.scviewer.database.RelationType;
/**
@ -33,7 +34,7 @@ import com.minres.scviewer.database.RelationType;
public class WaveformDb extends HierNode implements IWaveformDb, PropertyChangeListener {
/** The loaders. */
private static List<IWaveformDbLoader> loaders = new LinkedList<>();
private static List<IWaveformDbLoaderFactory> loaderFactories = new LinkedList<>();
/** The loaded. */
private boolean loaded;
@ -52,8 +53,8 @@ public class WaveformDb extends HierNode implements IWaveformDb, PropertyChangeL
*
* @param loader the loader
*/
public synchronized void bind(IWaveformDbLoader loader) {
loaders.add(loader);
public synchronized void bind(IWaveformDbLoaderFactory loader) {
loaderFactories.add(loader);
}
/**
@ -61,8 +62,8 @@ public class WaveformDb extends HierNode implements IWaveformDb, PropertyChangeL
*
* @param loader the loader
*/
public synchronized void unbind(IWaveformDbLoader loader) {
loaders.remove(loader);
public synchronized void unbind(IWaveformDbLoaderFactory loader) {
loaderFactories.remove(loader);
}
/**
@ -70,8 +71,8 @@ public class WaveformDb extends HierNode implements IWaveformDb, PropertyChangeL
*
* @return the loaders
*/
public static List<IWaveformDbLoader> getLoaders() {
return Collections.unmodifiableList(loaders);
public static List<IWaveformDbLoaderFactory> getLoaders() {
return Collections.unmodifiableList(loaderFactories);
}
/**
@ -79,7 +80,7 @@ public class WaveformDb extends HierNode implements IWaveformDb, PropertyChangeL
*/
public WaveformDb() {
super();
waveforms = new HashMap<>();
waveforms = new ConcurrentHashMap<>();
relationTypes = new ArrayList<>();
maxTime = 0L;
}
@ -124,8 +125,9 @@ public class WaveformDb extends HierNode implements IWaveformDb, PropertyChangeL
@Override
public boolean load(File inp) {
boolean retval = true;
for (IWaveformDbLoader loader : loaders) {
if (loader.canLoad(inp)) {
for (IWaveformDbLoaderFactory loaderFactory : loaderFactories) {
if (loaderFactory.canLoad(inp)) {
IWaveformDbLoader loader = loaderFactory.getLoader();
loader.addPropertyChangeListener(this);
try {
loader.load(this, inp);
@ -191,7 +193,7 @@ public class WaveformDb extends HierNode implements IWaveformDb, PropertyChangeL
/**
* Builds the hierarchy nodes.
*/
private void buildHierarchyNodes() {
private synchronized void buildHierarchyNodes() {
boolean needsSorting = false;
for (IWaveform stream : getAllWaves()) {
if (stream.getParent() == null) {

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<application:Application xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:advanced="http://www.eclipse.org/ui/2010/UIModel/application/ui/advanced" xmlns:application="http://www.eclipse.org/ui/2010/UIModel/application" xmlns:basic="http://www.eclipse.org/ui/2010/UIModel/application/ui/basic" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmlns:ui="http://www.eclipse.org/ui/2010/UIModel/application/ui" xmi:id="_95PfsHNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ide.application" bindingContexts="_95PfuXNmEeWBq8z1Dv39LA">
<children xsi:type="basic:TrimmedWindow" xmi:id="_95PfsXNmEeWBq8z1Dv39LA" label="SC Viewer" bindingContexts="_95PfunNmEeWBq8z1Dv39LA" width="1280" height="700">
<children xsi:type="basic:TrimmedWindow" xmi:id="_95PfsXNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.trimmedwindow.main" label="SC Viewer" bindingContexts="_95PfunNmEeWBq8z1Dv39LA" width="1280" height="700">
<children xsi:type="advanced:PerspectiveStack" xmi:id="_95QGxnNmEeWBq8z1Dv39LA">
<children xsi:type="advanced:Perspective" xmi:id="_95QGx3NmEeWBq8z1Dv39LA">
<children xsi:type="basic:PartStack" xmi:id="_95QGyXNmEeWBq8z1Dv39LA" elementId="org.eclipse.editorss" containerData="7500">
@ -9,20 +9,22 @@
</children>
</children>
<children xsi:type="basic:Part" xmi:id="__VNlAIytEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.dialog.aboutscviewer" toBeRendered="false" visible="false" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.AboutDialog" label="About SCViewer" bindingContexts="_95Pfu3NmEeWBq8z1Dv39LA"/>
<children xsi:type="basic:Part" xmi:id="_hXh-kEYFEeyPM8G0E2EYww" elementId="com.minres.scviewer.e4.application.dialog.onlinehelp" toBeRendered="false" visible="false" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.HelpDialog" label="SCViewer Online Help" bindingContexts="_95Pfu3NmEeWBq8z1Dv39LA" closeable="true"/>
<mainMenu xmi:id="_95PfyXNmEeWBq8z1Dv39LA" elementId="menu:org.eclipse.ui.main.menu">
<children xsi:type="menu:Menu" xmi:id="_95QGwHNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.menu.file" label="File">
<children xsi:type="menu:HandledMenuItem" xmi:id="_igsK0BkREeudD5MqrWoETQ" elementId="" label="Open Database" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/folder_database.png" mnemonics="M1+O" command="_95PfwHNmEeWBq8z1Dv39LA"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_VJG3YHgvEeWwZ-9vrAR2UQ" elementId="" label="Re-load Database" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/database_refresh.png" mnemonics="M1+R" command="_srACsBkREeudD5MqrWoETQ"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_igsK0BkREeudD5MqrWoETQ" elementId="" label="Open Database" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/folder_database.png" mnemonics="" command="_95PfwHNmEeWBq8z1Dv39LA"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_VJG3YHgvEeWwZ-9vrAR2UQ" elementId="" label="Re-load Database" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/database_refresh.png" mnemonics="" command="_srACsBkREeudD5MqrWoETQ"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_e7MOYJedEeW09eyIbHsdvg" elementId="" label="Load active tab settings" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/folder_page.png" command="_7-AIMJebEeW09eyIbHsdvg">
<parameters xmi:id="_4vtYgJehEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.parameter.30" name="com.minres.scviewer.e4.application.commandparameter.loadStore" value="load"/>
</children>
<children xsi:type="menu:HandledMenuItem" xmi:id="_95QGwnNmEeWBq8z1Dv39LA" label="Save active tab settings" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/script_save.png" command="_7-AIMJebEeW09eyIbHsdvg">
<children xsi:type="menu:HandledMenuItem" xmi:id="_95QGwnNmEeWBq8z1Dv39LA" label="Save active tab settings" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/script_save.png" mnemonics="" command="_7-AIMJebEeW09eyIbHsdvg">
<parameters xmi:id="_61QIsJehEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.parameter.31" name="com.minres.scviewer.e4.application.commandparameter.loadStore" value="store"/>
</children>
<children xsi:type="menu:HandledMenuItem" xmi:id="_95QGw3NmEeWBq8z1Dv39LA" label="Quit" command="_95PfvHNmEeWBq8z1Dv39LA"/>
</children>
<children xsi:type="menu:Menu" xmi:id="_ZyHC0HgvEeWwZ-9vrAR2UQ" elementId="" label="Edit">
<children xsi:type="menu:HandledMenuItem" xmi:id="_cPlx4HgvEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.delete" label="Delete" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/cross.png" command="_WUZ2wHXHEeWwZ-9vrAR2UQ"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_FiwZcEhdEeyp3vLifEzGbQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.delete" label="Delete" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/cross.png" command="_WUZ2wHXHEeWwZ-9vrAR2UQ"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_cPlx4HgvEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.delete" label="Select All" iconURI="" command="_bV-TMHXHEeWwZ-9vrAR2UQ"/>
</children>
<children xsi:type="menu:Menu" xmi:id="_XmZY4HchEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.menu.navigate" label="Navigate">
<children xsi:type="menu:Menu" xmi:id="_VCn_cHgwEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.menu.waveform" label="Waveform ...">
@ -55,7 +57,8 @@
</children>
<children xsi:type="menu:Menu" xmi:id="_95QGxHNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.menu.help" label="Help">
<children xsi:type="menu:HandledMenuItem" xmi:id="_UQRi0B07EeuiP60JNw0iiA" elementId="com.minres.scviewer.e4.application.handledmenuitem.checkforupdate" visible="false" label="Check for Update" enabled="false" command="_-9ED4B06EeuiP60JNw0iiA"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_95QGxXNmEeWBq8z1Dv39LA" label="About" command="_95PfxnNmEeWBq8z1Dv39LA"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_95QGxXNmEeWBq8z1Dv39LA" label="Online Help" command="_lqjIYEYEEeyPM8G0E2EYww"/>
<children xsi:type="menu:HandledMenuItem" xmi:id="_4xtmgEYEEeyPM8G0E2EYww" label="About" command="_95PfxnNmEeWBq8z1Dv39LA"/>
</children>
</mainMenu>
<trimBars xmi:id="_95QGy3NmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.main.toolbar">
@ -78,41 +81,12 @@
<children xsi:type="menu:HandledToolItem" xmi:id="_FrGmEHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.movestreamdown" label="Move Stream down" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/down_blue.png" tooltip="Move stream/waveform in list down" command="_N_sOkHXHEeWwZ-9vrAR2UQ">
<parameters xmi:id="_VA_yAHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.9" name="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir" value="down"/>
</children>
<children xsi:type="menu:ToolBarSeparator" xmi:id="_srcD0HgwEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.toolbarseparator.3"/>
<children xsi:type="menu:HandledToolItem" xmi:id="_GKi7IHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.previousevent" label="Previous Event" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/reverse_blue.png" tooltip="Navigate to previous event in stream/waveform" command="_79rx4HabEeWwZ-9vrAR2UQ">
<parameters xmi:id="_XS7YYHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.10" name="com.minres.scviewer.e4.application.command.navigateEventCommand.parameter.dir" value="prev"/>
</children>
<children xsi:type="menu:HandledToolItem" xmi:id="_GjlGMHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.nextevent" label="Next Event" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/play_blue.png" tooltip="Navigate to next event in stream/waveform" command="_79rx4HabEeWwZ-9vrAR2UQ">
<parameters xmi:id="_ZzTqcHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.11" name="com.minres.scviewer.e4.application.command.navigateEventCommand.parameter.dir" value="next"/>
</children>
<children xsi:type="menu:ToolBarSeparator" xmi:id="_tcxaIHgwEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.toolbarseparator.4"/>
<children xsi:type="menu:HandledToolItem" xmi:id="_HdKZkHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.previoustransaction" label="Previous Transaction" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/reverse_green.png" tooltip="Navigate to previous transaction" command="_Gn3lEHXKEeWwZ-9vrAR2UQ">
<parameters xmi:id="_cuGAkHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.12" name="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir" value="prev"/>
</children>
<children xsi:type="menu:ToolControl" xmi:id="_LtQhcIuKEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.toolcontrol.0" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.elements.RelationTypeToolControl"/>
<children xsi:type="menu:DirectToolItem" xmi:id="_Z7ZQkIuJEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.directtoolitem.nextprevinstream" toBeRendered="false" visible="false" label="Next/Prev in stream">
<menu xmi:id="_aPyMMIuJEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.menu.2">
<children xsi:type="menu:DynamicMenuContribution" xmi:id="_cnNWkIuJEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.dynamicmenucontribution.2" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.NavigateContribution"/>
</menu>
</children>
<children xsi:type="menu:HandledToolItem" xmi:id="_H7bp8HcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.nexttransaction" label="Next Transaction" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/play_green.png" tooltip="Navigate to next transaction" command="_Gn3lEHXKEeWwZ-9vrAR2UQ">
<parameters xmi:id="_fiO8IHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.13" name="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir" value="next"/>
</children>
</children>
<children xsi:type="menu:ToolBar" xmi:id="_oQdMUHcqEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.toolbar.1">
<children xsi:type="menu:HandledToolItem" xmi:id="_5DrGQHf4EeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.zoomfit" label="Zoom out" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/magnifier.png" tooltip="Restore default zoom level" command="_693GoHcqEeWwZ-9vrAR2UQ">
<parameters xmi:id="_5DrGQXf4EeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.14" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="fit"/>
</children>
<children xsi:type="menu:ToolBarSeparator" xmi:id="_p1AvUHcqEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.toolbarseparator.1"/>
<children xsi:type="menu:HandledToolItem" xmi:id="_XMQPAHcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.zoomin" label="Zoom in" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/magnifier_zoom_in.png" tooltip="Zoom in by a factor of 3" command="_693GoHcqEeWwZ-9vrAR2UQ">
<parameters xmi:id="_fi5w4HcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.15" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="in"/>
</children>
<children xsi:type="menu:HandledToolItem" xmi:id="_XqTc8HcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.zoomout" label="Zoom out" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/magifier_zoom_out.png" tooltip="Zoom out by a factor of 3" command="_693GoHcqEeWwZ-9vrAR2UQ">
<parameters xmi:id="_d7OBYHcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.14" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="out"/>
</children>
</children>
<children xsi:type="menu:ToolBar" xmi:id="_fwn8wGtTEeqmlpoaaMHoiw" elementId="com.minres.scviewer.e4.application.toolbar.2">
<children xsi:type="menu:HandledToolItem" xmi:id="_j-XIgGtTEeqmlpoaaMHoiw" elementId="com.minres.scviewer.e4.application.handledtoolitem.hover" label="Hover" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/lightbulb.png" tooltip="Enable hover window in waveform" selected="true" type="Check" command="_uyeyYGtTEeqmlpoaaMHoiw">
<children xsi:type="menu:HandledToolItem" xmi:id="_j-XIgGtTEeqmlpoaaMHoiw" elementId="com.minres.scviewer.e4.application.handledtoolitem.txdetails" label="TX Details" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/application_side_expand.png" tooltip="Show tx details parts" selected="true" type="Check" command="_Fj1gQEYoEeyKK_icsY7Xjg">
<tags>EnableTxDetails</tags>
</children>
<children xsi:type="menu:HandledToolItem" xmi:id="_33tugEYnEeyKK_icsY7Xjg" elementId="com.minres.scviewer.e4.application.handledtoolitem.hover" label="Hover" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/lightbulb.png" tooltip="Enable hover window in waveform" selected="true" type="Check" command="_uyeyYGtTEeqmlpoaaMHoiw">
<tags>EnableHover</tags>
</children>
</children>
@ -135,24 +109,17 @@
<handlers xmi:id="_UUnX8IoNEeWxJ_wPkM6yGQ" elementId="com.minres.scviewer.e4.application.handler.set_them" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.ThemeSetHandler" command="_KlGlsIoNEeWxJ_wPkM6yGQ"/>
<handlers xmi:id="_V4EscIuGEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handler.setreleationtype" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.SetRelationTypeHandler" command="_E9lUgIt2EeWid7xO48ZBXw"/>
<handlers xmi:id="__99WoJebEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.handler.loadStoreSettings" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.LoadStoreSettingsHandler" command="_7-AIMJebEeW09eyIbHsdvg"/>
<handlers xmi:id="_x4pSEGtTEeqmlpoaaMHoiw" elementId="com.minres.scviewer.e4.application.handler.0" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.EnableHover" command="_uyeyYGtTEeqmlpoaaMHoiw"/>
<handlers xmi:id="_x4pSEGtTEeqmlpoaaMHoiw" elementId="com.minres.scviewer.e4.application.handler.enablehover" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.EnableHover" command="_uyeyYGtTEeqmlpoaaMHoiw"/>
<handlers xmi:id="_h3jU8BkWEeudD5MqrWoETQ" elementId="com.minres.scviewer.e4.application.handler.reloadCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.ReloadHandler" command="_srACsBkREeudD5MqrWoETQ"/>
<handlers xmi:id="_gn_boBlEEeuiP60JNw0iiA" elementId="com.minres.scviewer.e4.application.handler.txSearch" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.SearchHandler" command="_XDxTYBlEEeuiP60JNw0iiA"/>
<handlers xmi:id="_CCEtAB07EeuiP60JNw0iiA" elementId="com.minres.scviewer.e4.application.handler.update" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.UpdateHandler" command="_-9ED4B06EeuiP60JNw0iiA"/>
<handlers xmi:id="_ru2NIEYEEeyPM8G0E2EYww" elementId="com.minres.scviewer.e4.application.handler.helpCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.HelpHandler" command="_lqjIYEYEEeyPM8G0E2EYww"/>
<handlers xmi:id="_TwU0IEYoEeyKK_icsY7Xjg" elementId="com.minres.scviewer.e4.application.handler.enabletxdetails" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.EnableTxDetails" command="_Fj1gQEYoEeyKK_icsY7Xjg"/>
<bindingTables xmi:id="_95PfvnNmEeWBq8z1Dv39LA" bindingContext="_95PfuXNmEeWBq8z1Dv39LA">
<bindings xmi:id="_95Pfv3NmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.keybinding.quit" keySequence="M1+Q" command="_95PfvHNmEeWBq8z1Dv39LA">
<tags>type:user</tags>
</bindings>
</bindingTables>
<bindingTables xmi:id="_zZFy0GVNEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.bindingtable.waveform" bindingContext="_q4VSsGVNEeqSQM-A6dw9ig">
<bindings xmi:id="_1o3dEGVNEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.keybinding.zoom_in" keySequence="M1++" command="_693GoHcqEeWwZ-9vrAR2UQ">
<tags>type:user</tags>
<parameters xmi:id="_53UagGVNEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.parameter.33" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="in"/>
</bindings>
<bindings xmi:id="_8i3awGVNEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.keybinding.zoom_out" keySequence="M1+-" command="_693GoHcqEeWwZ-9vrAR2UQ">
<tags>type:user</tags>
<parameters xmi:id="__UCh4GVNEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.parameter.34" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="out"/>
</bindings>
<bindings xmi:id="_2-008EhnEeyp3vLifEzGbQ" elementId="com.minres.scviewer.e4.application.keybinding.help" keySequence="F1" command="_lqjIYEYEEeyPM8G0E2EYww"/>
</bindingTables>
<bindingTables xmi:id="_XullMGVOEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.bindingtable.window" bindingContext="_95PfunNmEeWBq8z1Dv39LA">
<bindings xmi:id="_95PfwnNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.keybinding.load" keySequence="M1+L" command="_7-AIMJebEeW09eyIbHsdvg">
@ -169,20 +136,22 @@
<bindings xmi:id="_3PRIQGVPEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.keybinding.open" keySequence="M1+O" command="_95PfwHNmEeWBq8z1Dv39LA">
<tags>type:user</tags>
</bindings>
</bindingTables>
<bindingTables xmi:id="_mnMrUGVmEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.bindingtable.0" bindingContext="_iQ3kQGVmEeqSQM-A6dw9ig">
<bindings xmi:id="_n9yDwGVmEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.keybinding.0" keySequence="M1+A" command="_bV-TMHXHEeWwZ-9vrAR2UQ">
<bindings xmi:id="_QcOn8EheEeyp3vLifEzGbQ" elementId="com.minres.scviewer.e4.application.keybinding.1" keySequence="M1+A" command="_bV-TMHXHEeWwZ-9vrAR2UQ"/>
<bindings xmi:id="_1o3dEGVNEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.keybinding.zoom_in" keySequence="M1++" command="_693GoHcqEeWwZ-9vrAR2UQ">
<tags>type:user</tags>
<parameters xmi:id="_53UagGVNEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.parameter.33" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="in"/>
</bindings>
<bindings xmi:id="_8i3awGVNEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.keybinding.zoom_out" keySequence="M1+-" command="_693GoHcqEeWwZ-9vrAR2UQ">
<tags>type:user</tags>
<parameters xmi:id="__UCh4GVNEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.parameter.34" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="out"/>
</bindings>
<bindings xmi:id="_KjmnsEheEeyp3vLifEzGbQ" elementId="com.minres.scviewer.e4.application.keybinding.0" keySequence="M1+R" command="_srACsBkREeudD5MqrWoETQ"/>
</bindingTables>
<rootContext xmi:id="_95PfuXNmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.contexts.dialogAndWindow" name="In Dialog and Windows">
<children xmi:id="_95PfunNmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.contexts.window" name="In Windows">
<children xmi:id="_q4VSsGVNEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.bindingcontext.waveform" name="In Waveform Part"/>
<children xmi:id="_iQ3kQGVmEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.bindingcontext.indesignbrowser" name="In DesignBrowser"/>
</children>
<children xmi:id="_95PfunNmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.contexts.window" name="In Windows"/>
<children xmi:id="_95Pfu3NmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.contexts.dialog" name="In Dialogs"/>
</rootContext>
<descriptors xmi:id="_KicY0HRMEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.partdescriptor.waveformviewer" label="SCViewer" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/scviewer.png" bindingContexts="_q4VSsGVNEeqSQM-A6dw9ig" allowMultiple="true" category="General" closeable="true" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.WaveformViewer">
<descriptors xmi:id="_KicY0HRMEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.partdescriptor.waveformviewer" label="SCViewer" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/scviewer.png" allowMultiple="true" category="General" closeable="true" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.WaveformViewer">
<tags>categoryTag:General</tags>
<handlers xmi:id="_BSIuEHacEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.navigateEventCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.NavigateEvent" command="_79rx4HabEeWwZ-9vrAR2UQ"/>
<handlers xmi:id="_JpdGwHXKEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.navigateTransCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.NavigateTrans" command="_Gn3lEHXKEeWwZ-9vrAR2UQ"/>
@ -191,6 +160,7 @@
<handlers xmi:id="_Du1NAHcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.zoomCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.ZoomHandler" command="_693GoHcqEeWwZ-9vrAR2UQ"/>
<handlers xmi:id="_bxt4QM3rEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.handler.changeWaveDisplay" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.ChangeWaveformDisplay" command="_FZunYM2PEei6rfTGo88R-w"/>
<handlers xmi:id="_bxw7kM3rEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.handler.changeValueDisplay" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.ChangeValueDisplay" command="_4C_asM3ZEei6rfTGo88R-w"/>
<handlers xmi:id="_ZVHbYE-JEeyuGJbYVZjX8w" elementId="com.minres.scviewer.e4.application.handler.panCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.PanHandler" command="_y2BUsE-HEeyuGJbYVZjX8w"/>
<menus xsi:type="menu:PopupMenu" xmi:id="_TwzrsHWSEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.popupmenu.namecontext" label="Name Menu">
<children xsi:type="menu:HandledMenuItem" xmi:id="_Vco7YHWSEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.moveup" label="Move up" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/up_blue.png" tooltip="Move stream/waveform in list up" command="_N_sOkHXHEeWwZ-9vrAR2UQ">
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_elFdcHr_EeWVM_sKoXvptg" coreExpressionId="com.minres.scviewer.e4.application.oneWaveSeleted"/>
@ -237,7 +207,50 @@
<visibleWhen xsi:type="ui:ImperativeExpression" xmi:id="_Se1voBlEEeuiP60JNw0iiA" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.SearchHandler"/>
</children>
</menus>
<toolbar xmi:id="_ReeeAE-DEeyuGJbYVZjX8w" elementId="com.minres.scviewer.e4.application.toolbar.3">
<children xsi:type="menu:HandledToolItem" xmi:id="_GKi7IHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.previousevent" label="Previous Event" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/previous-green.png" tooltip="Navigate to previous event in stream/waveform" command="_79rx4HabEeWwZ-9vrAR2UQ">
<parameters xmi:id="_XS7YYHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.10" name="com.minres.scviewer.e4.application.command.navigateEventCommand.parameter.dir" value="prev"/>
</children>
<children xsi:type="menu:HandledToolItem" xmi:id="_GjlGMHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.nextevent" label="Next Event" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/next-green.png" tooltip="Navigate to next event in stream/waveform" command="_79rx4HabEeWwZ-9vrAR2UQ">
<parameters xmi:id="_ZzTqcHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.11" name="com.minres.scviewer.e4.application.command.navigateEventCommand.parameter.dir" value="next"/>
</children>
<children xsi:type="menu:ToolBarSeparator" xmi:id="_tcxaIHgwEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.toolbarseparator.4"/>
<children xsi:type="menu:HandledToolItem" xmi:id="_HdKZkHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.previoustransaction" label="Previous Transaction" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/reverse_green.png" tooltip="Navigate to previous transaction" command="_Gn3lEHXKEeWwZ-9vrAR2UQ">
<parameters xmi:id="_cuGAkHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.12" name="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir" value="prev"/>
</children>
<children xsi:type="menu:ToolControl" xmi:id="_LtQhcIuKEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.toolcontrol.0" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.elements.RelationTypeToolControl"/>
<children xsi:type="menu:HandledToolItem" xmi:id="_H7bp8HcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.nexttransaction" label="Next Transaction" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/play_green.png" tooltip="Navigate to next transaction" command="_Gn3lEHXKEeWwZ-9vrAR2UQ">
<parameters xmi:id="_fiO8IHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.13" name="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir" value="next"/>
</children>
<children xsi:type="menu:ToolBarSeparator" xmi:id="_dOLmYE-DEeyuGJbYVZjX8w" elementId="com.minres.scviewer.e4.application.toolbarseparator.0"/>
<children xsi:type="menu:HandledToolItem" xmi:id="_dPFBcE-HEeyuGJbYVZjX8w" elementId="com.minres.scviewer.e4.application.handledtoolitem.panleft" label="Pan left" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/reverse_blue.png" tooltip="Pan left" command="_y2BUsE-HEeyuGJbYVZjX8w">
<parameters xmi:id="_jkVBYE-JEeyuGJbYVZjX8w" elementId="com.minres.scviewer.e4.application.parameter.14" name="com.minres.scviewer.e4.application.command.pancommand.parameter.direction" value="left"/>
</children>
<children xsi:type="menu:HandledToolItem" xmi:id="_Z-blgE-GEeyuGJbYVZjX8w" elementId="com.minres.scviewer.e4.application.handledtoolitem.pancursor" label="Pan to cursor" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/center_blue.png" tooltip="Center on cursor" command="_y2BUsE-HEeyuGJbYVZjX8w">
<parameters xmi:id="_Z-blgU-GEeyuGJbYVZjX8w" elementId="com.minres.scviewer.e4.application.parameter.out" name="com.minres.scviewer.e4.application.command.pancommand.parameter.direction" value="cursor"/>
</children>
<children xsi:type="menu:HandledToolItem" xmi:id="_ejt5IE-HEeyuGJbYVZjX8w" elementId="com.minres.scviewer.e4.application.handledtoolitem.panright" label="Pan right" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/play_blue.png" tooltip="Pan right" command="_y2BUsE-HEeyuGJbYVZjX8w">
<parameters xmi:id="_f4awUE-JEeyuGJbYVZjX8w" elementId="com.minres.scviewer.e4.application.parameter.out" name="com.minres.scviewer.e4.application.command.pancommand.parameter.direction" value="right"/>
</children>
<children xsi:type="menu:ToolBarSeparator" xmi:id="_b7RFoE-GEeyuGJbYVZjX8w" elementId="com.minres.scviewer.e4.application.toolbarseparator.1"/>
<children xsi:type="menu:HandledToolItem" xmi:id="_qA5D4E-DEeyuGJbYVZjX8w" elementId="com.minres.scviewer.e4.application.handledtoolitem.zoomfull" label="Zoom full" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/zoom_full.png" tooltip="Zoom full range" command="_693GoHcqEeWwZ-9vrAR2UQ">
<parameters xmi:id="_qA5D4U-DEeyuGJbYVZjX8w" elementId="com.minres.scviewer.e4.application.parameter.full" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="full"/>
</children>
<children xsi:type="menu:HandledToolItem" xmi:id="_qA65EE-DEeyuGJbYVZjX8w" elementId="com.minres.scviewer.e4.application.handledtoolitem.zoomfit" label="Zoom fit" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/zoom_fit.png" tooltip="Zoom between cursor and marker" command="_693GoHcqEeWwZ-9vrAR2UQ">
<parameters xmi:id="_qA65EU-DEeyuGJbYVZjX8w" elementId="com.minres.scviewer.e4.application.parameter.fit" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="fit"/>
</children>
<children xsi:type="menu:ToolBarSeparator" xmi:id="_qA8HME-DEeyuGJbYVZjX8w" elementId="com.minres.scviewer.e4.application.toolbarseparator.1"/>
<children xsi:type="menu:HandledToolItem" xmi:id="_qA8uQE-DEeyuGJbYVZjX8w" elementId="com.minres.scviewer.e4.application.handledtoolitem.zoomin" label="Zoom in" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/magnifier_zoom_in.png" tooltip="Zoom in" command="_693GoHcqEeWwZ-9vrAR2UQ">
<parameters xmi:id="_qA8uQU-DEeyuGJbYVZjX8w" elementId="com.minres.scviewer.e4.application.parameter.in" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="in"/>
</children>
<children xsi:type="menu:HandledToolItem" xmi:id="_qA98YE-DEeyuGJbYVZjX8w" elementId="com.minres.scviewer.e4.application.handledtoolitem.zoomout" label="Zoom out" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/magifier_zoom_out.png" tooltip="Zoom out" command="_693GoHcqEeWwZ-9vrAR2UQ">
<parameters xmi:id="_qA98YU-DEeyuGJbYVZjX8w" elementId="com.minres.scviewer.e4.application.parameter.out" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="out"/>
</children>
</toolbar>
</descriptors>
<snippets xsi:type="basic:Window" xmi:id="_R8mJUEhwEeyp3vLifEzGbQ" elementId="com.minres.scviewer.e4.application.window.help" selectedElement="_R8mJUUhwEeyp3vLifEzGbQ" label="SC Viewer Help" width="800" height="600">
<children xsi:type="basic:Part" xmi:id="_R8mJUUhwEeyp3vLifEzGbQ" elementId="com.minres.scviewer.e4.application.part.container" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.help.HelpBrowser"/>
</snippets>
<commands xmi:id="_95PfvHNmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.file.exit" commandName="Quit Command"/>
<commands xmi:id="_95PfwHNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.open" commandName="Open Command"/>
<commands xmi:id="_95Pfw3NmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.file.save" commandName="Save Command"/>
@ -280,6 +293,11 @@
<commands xmi:id="_srACsBkREeudD5MqrWoETQ" elementId="com.minres.scviewer.e4.application.reload" commandName="Reload Command"/>
<commands xmi:id="_XDxTYBlEEeuiP60JNw0iiA" elementId="com.minres.scviewer.e4.application.txSearch" commandName="Search Command"/>
<commands xmi:id="_-9ED4B06EeuiP60JNw0iiA" elementId="com.minres.scviewer.e4.application.command.update" commandName="Update"/>
<commands xmi:id="_lqjIYEYEEeyPM8G0E2EYww" elementId="org.eclipse.ui.help.helpAction" commandName="Help Command"/>
<commands xmi:id="_Fj1gQEYoEeyKK_icsY7Xjg" elementId="com.minres.scviewer.e4.application.command.enabletxdetails" commandName="Enable Tx Details" description="Show tx details parts"/>
<commands xmi:id="_y2BUsE-HEeyuGJbYVZjX8w" elementId="com.minres.scviewer.e4.application.command.pancommand" commandName="Pan Command">
<parameters xmi:id="_y2BUsU-HEeyuGJbYVZjX8w" elementId="com.minres.scviewer.e4.application.command.pancommand.parameter.direction" name="direction" optional="false"/>
</commands>
<addons xmi:id="_95PfsnNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.core.commands.service" contributionURI="bundleclass://org.eclipse.e4.core.commands/org.eclipse.e4.core.commands.CommandServiceAddon"/>
<addons xmi:id="_95Pfs3NmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ui.contexts.service" contributionURI="bundleclass://org.eclipse.e4.ui.services/org.eclipse.e4.ui.services.ContextServiceAddon"/>
<addons xmi:id="_95PftHNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ui.bindings.service" contributionURI="bundleclass://org.eclipse.e4.ui.bindings/org.eclipse.e4.ui.bindings.BindingServiceAddon"/>

View File

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.minres.scviewer.e4.application;singleton:=true
Bundle-Version: 2.13.2
Bundle-Version: 2.15.0
Bundle-Vendor: %Bundle-Vendor
Require-Bundle: javax.inject;bundle-version="1.0.0",
org.eclipse.core.runtime;bundle-version="3.11.1",
@ -38,5 +38,6 @@ Require-Bundle: javax.inject;bundle-version="1.0.0",
org.eclipse.equinox.p2.metadata.repository;bundle-version="1.3.400"
Bundle-RequiredExecutionEnvironment: JavaSE-11
Import-Package: com.minres.scviewer.database,
javax.annotation;version="1.0.0";resolution:=optional,
javax.inject;version="1.0.0"
Automatic-Module-Name: com.minres.scviewer.e4.application

Binary file not shown.

After

Width:  |  Height:  |  Size: 781 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 547 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 581 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 685 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 519 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -6,8 +6,8 @@
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>2.13.2</version>
<version>2.15.0</version>
<relativePath>../..</relativePath>
</parent>
<packaging>eclipse-plugin</packaging>
</project>
</project>

View File

@ -24,6 +24,7 @@ public class Messages extends NLS {
public static String SCViewerPreferencesPage_0;
public static String SCViewerPreferencesPage_1;
public static String SCViewerPreferencesPage_2;
public static String SCViewerPreferencesPage_3;
public static String StatusBarControl_1;
public static String StatusBarControl_2;
public static String StatusBarControl_3;
@ -82,6 +83,16 @@ public class Messages extends NLS {
public static String cursor;
public static String cursor_drag;
public static String cursor_text;
public static String HelpBrowser_7;
public static String HelpBrowser_8;
public static String HelpDialog_0;
public static String HelpDialog_1;
public static String HelpDialog_2;
public static String HelpDialog_3;
public static String HelpDialog_4;
public static String HelpDialog_5;
public static String HelpDialog_6;
public static String HelpDialog_7;
public static String marker;
public static String marker_text;
public static String rel_arrow;

View File

@ -0,0 +1,57 @@
package com.minres.scviewer.e4.application.handlers;
import java.util.LinkedList;
import java.util.List;
import javax.inject.Inject;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.core.di.extensions.Preference;
import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem;
import org.eclipse.e4.ui.workbench.modeling.EModelService;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.osgi.service.prefs.BackingStoreException;
import com.minres.scviewer.e4.application.preferences.PreferenceConstants;
@SuppressWarnings("restriction")
public class EnableTxDetails {
static final String TAG_NAME = "EnableTxDetails"; //$NON-NLS-1$
static final String ICON_DISABLED = "platform:/plugin/com.minres.scviewer.e4.application/icons/application_side_expand.png"; //$NON-NLS-1$
static final String ICON_ENABLED = "platform:/plugin/com.minres.scviewer.e4.application/icons/application_side_contract.png"; //$NON-NLS-1$
static final String TOOLTIP_DISABLED = "Show tx details parts";
static final String TOOLTIP_ENABLED = "Hide tx details parts";
@Inject
MApplication application;
@Inject
EPartService partService;
@Inject
@Optional
public void reactOnShowHoverChange(EModelService modelService, @Preference(value = PreferenceConstants.SHOW_TX_DETAILS) Boolean show) {
List<String> tags = new LinkedList<>();
tags.add(TAG_NAME);
List<MHandledItem> elements = modelService.findElements(application, null, MHandledItem.class, tags );
for( MHandledItem hi : elements ){
hi.setSelected(show);
hi.setIconURI(show?ICON_ENABLED:ICON_DISABLED);
hi.setTooltip(show?TOOLTIP_ENABLED:TOOLTIP_DISABLED);
}
}
@Execute
public void execute(MHandledItem handledItem, @Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE) IEclipsePreferences prefs ) {
try {
prefs.putBoolean(PreferenceConstants.SHOW_TX_DETAILS, handledItem.isSelected());
prefs.flush();
} catch (BackingStoreException e) {}
}
}

View File

@ -0,0 +1,33 @@
/*******************************************************************************
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.e4.application.handlers;
import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
import org.eclipse.e4.ui.workbench.modeling.EModelService;
public class HelpHandler {
static final String WINDOW_ID="com.minres.scviewer.e4.application.window.help"; //$NON-NLS-1$
@CanExecute
public boolean canExecute(MApplication app) {
return !app.getChildren().stream().filter(e -> e.getElementId().equals(WINDOW_ID)).findFirst().isPresent();
}
@Execute
public void execute(MApplication app, MWindow window, EModelService modelService /*@Named("mdialog01.dialog.0") MDialog dialog*/) {
MWindow newWin = (MWindow)modelService.cloneSnippet(app, WINDOW_ID, null);
app.getChildren().add(newWin);
}
}

View File

@ -29,21 +29,25 @@ import com.minres.scviewer.e4.application.parts.WaveformViewer;
public class NavigateEvent {
final static String PARAMTER_ID="com.minres.scviewer.e4.application.command.navigateEventCommand.parameter.dir"; //$NON-NLS-1$
@CanExecute
public Boolean canExecute(ESelectionService selectionService){
Object sel = selectionService.getSelection();
if( sel instanceof IStructuredSelection) {
Object o= ((IStructuredSelection)sel).getFirstElement();
return o instanceof IWaveform || o instanceof ITx || o instanceof TrackEntry;
public Boolean canExecute(EPartService partService){
MPart part = partService.getActivePart();
if(part.getObject() instanceof WaveformViewer){
Object sel = ((WaveformViewer)part.getObject()).getSelection();
if( sel instanceof IStructuredSelection) {
if(((IStructuredSelection)sel).isEmpty()) return false;
Object o= ((IStructuredSelection)sel).getFirstElement();
return o instanceof IWaveform || o instanceof ITx || o instanceof TrackEntry;
}
}
return false;
}
@Execute
public void execute(@Named(PARAMTER_ID) String param, EPartService partService) {
// public void execute(EPartService partService) {
// String param="next";
// public void execute(EPartService partService) {
// String param="next";
MPart part = partService.getActivePart();
Object obj = part.getObject();
if(obj instanceof WaveformViewer){

View File

@ -0,0 +1,49 @@
/*******************************************************************************
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.e4.application.handlers;
import javax.inject.Named;
import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.core.di.annotations.Execute;
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.WaveformViewer;
public class PanHandler {
final static String PARAMTER_ID="com.minres.scviewer.e4.application.command.pancommand.parameter.direction"; //$NON-NLS-1$
@CanExecute
public boolean canExecute(EPartService partService) {
return true;
}
@Execute
public void execute(@Named(PARAMTER_ID) String level, EPartService partService) {
MPart part = partService.getActivePart();
Object obj = part.getObject();
if(obj instanceof WaveformViewer){
WaveformViewer waveformViewerPart = (WaveformViewer) obj;
if("left".equalsIgnoreCase(level)) //$NON-NLS-1$
waveformViewerPart.pan(-1);
else if("right".equalsIgnoreCase(level)) //$NON-NLS-1$
waveformViewerPart.pan(+1);
else if("cursor".equalsIgnoreCase(level)) //$NON-NLS-1$
waveformViewerPart.pan(0);
}
}
}

View File

@ -11,33 +11,26 @@
package com.minres.scviewer.e4.application.handlers;
import javax.inject.Inject;
import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.annotations.Optional;
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;
@CanExecute
public boolean canExecute(EPartService partService) {
MPart part = partService.getActivePart();
return part.getObject() instanceof WaveformViewer;
}
@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;
}
}

View File

@ -18,6 +18,7 @@ import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
import com.minres.scviewer.database.ui.ZoomKind;
import com.minres.scviewer.e4.application.parts.WaveformViewer;
public class ZoomHandler {
@ -35,13 +36,14 @@ public class ZoomHandler {
Object obj = part.getObject();
if(obj instanceof WaveformViewer){
WaveformViewer waveformViewerPart = (WaveformViewer) obj;
int zoomLevel = waveformViewerPart.getZoomLevel();
if("in".equalsIgnoreCase(level)) //$NON-NLS-1$
waveformViewerPart.setZoomLevel(zoomLevel-1);
waveformViewerPart.zoom(ZoomKind.IN);
else if("out".equalsIgnoreCase(level)) //$NON-NLS-1$
waveformViewerPart.setZoomLevel(zoomLevel+1);
waveformViewerPart.zoom(ZoomKind.OUT);
else if("fit".equalsIgnoreCase(level)) //$NON-NLS-1$
waveformViewerPart.setZoomFit();
waveformViewerPart.zoom(ZoomKind.FIT);
else if("full".equalsIgnoreCase(level)) //$NON-NLS-1$
waveformViewerPart.zoom(ZoomKind.FULL);
}
}

View File

@ -27,9 +27,6 @@ import com.minres.scviewer.e4.application.Messages;
*/
public class WaveStatusBarControl extends StatusBarControl {
/** The Constant ZOOM_LEVEL. */
public static final String ZOOM_LEVEL="ZoomLevelUpdate"; //$NON-NLS-1$
/** The Constant CURSOR_TIME. */
public static final String CURSOR_TIME="CursorPosUpdate"; //$NON-NLS-1$
@ -45,7 +42,7 @@ public class WaveStatusBarControl extends StatusBarControl {
/** The zoom contribution. */
StatusLineContributionItem cursorContribution, markerContribution, markerDiffContribution, zoomContribution;
StatusLineContributionItem cursorContribution, markerContribution, markerDiffContribution;
/**
* Instantiates a new wave status bar control.
@ -59,11 +56,9 @@ public class WaveStatusBarControl extends StatusBarControl {
cursorContribution = new StatusLineContributionItem(Messages.WaveStatusBarControl_5, true, 20);
markerContribution = new StatusLineContributionItem(Messages.WaveStatusBarControl_6, true, 20);
markerDiffContribution = new StatusLineContributionItem(Messages.WaveStatusBarControl_7, true, 20);
zoomContribution = new StatusLineContributionItem(Messages.WaveStatusBarControl_8, true, 8);
manager.appendToGroup(StatusLineManager.BEGIN_GROUP,cursorContribution);
manager.appendToGroup(StatusLineManager.BEGIN_GROUP,markerContribution);
manager.appendToGroup(StatusLineManager.BEGIN_GROUP,markerDiffContribution);
manager.appendToGroup(StatusLineManager.BEGIN_GROUP, zoomContribution);
}
/**
@ -88,17 +83,6 @@ public class WaveStatusBarControl extends StatusBarControl {
}
}
/**
* Gets the zoom event.
*
* @param text the text
* @return the zoom event
*/
@Inject @Optional
public void getZoomEvent(@UIEventTopic(ZOOM_LEVEL) String text) {
zoomContribution.setText(text);
}
/**
* Gets the cursor event.
*

View File

@ -18,6 +18,7 @@ ResourceManager_0=Wrong decorate corner
SCViewerPreferencesPage_0=Check for changed database
SCViewerPreferencesPage_1=Show hover window in waveform
SCViewerPreferencesPage_2=Waveform track height
SCViewerPreferencesPage_3=Show tx details in waveform
StatusBarControl_1=Currently running:
StatusBarControl_2=\nLast task:
StatusBarControl_3=Currently running:
@ -76,6 +77,16 @@ signal_nan=Signal NaN Value
cursor=Cursor
cursor_drag=dragged Cursor
cursor_text=Cursor Text
HelpBrowser_7=Error initializing help browser
HelpBrowser_8=An error occurred while initializing the help browser:
HelpDialog_0=Back
HelpDialog_1=Forward
HelpDialog_2=Stop
HelpDialog_3=Refresh
HelpDialog_4=Go
HelpDialog_5=Address
HelpDialog_6=https://minres.github.io/SCViewer/#key-shortcuts
HelpDialog_7=Could not instantiate Browser:
marker=Marker
marker_text=Marker TExt
rel_arrow=Relation arrow

View File

@ -131,7 +131,9 @@ public class AboutDialog extends Dialog {
if (style != null && style.underline && style.underlineStyle == SWT.UNDERLINE_LINK) {
Desktop.getDesktop().browse(new java.net.URI(style.data.toString()));
}
} catch (IOException | URISyntaxException | IllegalArgumentException e) {}
} catch (IOException | URISyntaxException | IllegalArgumentException e) {
} catch (UnsupportedOperationException e) {
}
});
styleRange.start = 0;

View File

@ -226,6 +226,10 @@ public class DesignBrowser {
}
});
}
public Control getControl() {
return top;
}
/**
* Creates the table composite.

View File

@ -0,0 +1,177 @@
package com.minres.scviewer.e4.application.parts;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTError;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.browser.LocationListener;
import org.eclipse.swt.browser.ProgressEvent;
import org.eclipse.swt.browser.ProgressListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.ProgressBar;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import com.minres.scviewer.e4.application.Messages;
public class HelpDialog extends Dialog {
/**
* Create the dialog.
*
* @param parentShell the parent shell
*/
@Inject
public HelpDialog(Shell parentShell) {
super(parentShell);
setShellStyle(getShellStyle() | SWT.MODELESS | SWT.MAX | SWT.BORDER | SWT.TITLE);
setBlockOnOpen(false);
}
@Override
protected boolean isResizable() {
return true;
}
@Override
protected Point getInitialSize() {
return new Point(800, 600);
}
/**
* Create contents of the dialog.
*
* @param parent the parent
* @return the control
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 3;
container.setLayout(gridLayout);
ToolBar toolbar = new ToolBar(container, SWT.NONE);
ToolItem itemBack = new ToolItem(toolbar, SWT.PUSH);
itemBack.setText(Messages.HelpDialog_0);
ToolItem itemForward = new ToolItem(toolbar, SWT.PUSH);
itemForward.setText(Messages.HelpDialog_1);
ToolItem itemStop = new ToolItem(toolbar, SWT.PUSH);
itemStop.setText(Messages.HelpDialog_2);
ToolItem itemRefresh = new ToolItem(toolbar, SWT.PUSH);
itemRefresh.setText(Messages.HelpDialog_3);
ToolItem itemGo = new ToolItem(toolbar, SWT.PUSH);
itemGo.setText(Messages.HelpDialog_4);
GridData data = new GridData();
data.horizontalSpan = 3;
toolbar.setLayoutData(data);
Label labelAddress = new Label(container, SWT.NONE);
labelAddress.setText(Messages.HelpDialog_5);
final Text location = new Text(container, SWT.BORDER);
data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.horizontalSpan = 2;
data.grabExcessHorizontalSpace = true;
location.setLayoutData(data);
final Browser browser;
try {
browser = new Browser(container, SWT.NONE);
data = new GridData();
// data.widthHint = 800;
// data.heightHint =600;
data.horizontalAlignment = GridData.FILL;
data.verticalAlignment = GridData.FILL;
data.horizontalSpan = 3;
data.grabExcessHorizontalSpace = true;
data.grabExcessVerticalSpace = true;
browser.setLayoutData(data);
final Label status = new Label(container, SWT.NONE);
data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 2;
status.setLayoutData(data);
final ProgressBar progressBar = new ProgressBar(container, SWT.NONE);
data = new GridData();
data.horizontalAlignment = GridData.END;
progressBar.setLayoutData(data);
/* event handling */
Listener listener = event -> {
ToolItem item = (ToolItem) event.widget;
String string = item.getText();
if (string.equals(Messages.HelpDialog_0))
browser.back();
else if (string.equals(Messages.HelpDialog_1))
browser.forward();
else if (string.equals(Messages.HelpDialog_2))
browser.stop();
else if (string.equals(Messages.HelpDialog_3))
browser.refresh();
else if (string.equals(Messages.HelpDialog_4))
browser.setUrl(location.getText());
};
browser.addProgressListener(new ProgressListener() {
@Override
public void changed(ProgressEvent event) {
if (event.total == 0) return;
int ratio = event.current * 100 / event.total;
progressBar.setSelection(ratio);
}
@Override
public void completed(ProgressEvent event) {
progressBar.setSelection(0);
}
});
browser.addStatusTextListener(event -> status.setText(event.text));
browser.addLocationListener(LocationListener.changedAdapter(event -> {
if (event.top) location.setText(event.location);
}
));
itemBack.addListener(SWT.Selection, listener);
itemForward.addListener(SWT.Selection, listener);
itemStop.addListener(SWT.Selection, listener);
itemRefresh.addListener(SWT.Selection, listener);
itemGo.addListener(SWT.Selection, listener);
location.addListener(SWT.DefaultSelection, e -> browser.setUrl(location.getText()));
browser.setUrl(Messages.HelpDialog_6);
} catch (SWTError e) {
System.out.println(Messages.HelpDialog_7 + e.getMessage());
}
return container;
}
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
*/
@Override
protected void createButtonsForButtonBar(Composite parent) {
// create OK button
createButton(parent, IDialogConstants.OK_ID, IDialogConstants.CLOSE_LABEL, true);
}
/**
* Open the dialog.
* @return the result
*/
@PostConstruct
@Override
public int open() {
return super.open();
}
}

View File

@ -74,6 +74,7 @@ import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Widget;
import org.osgi.service.prefs.BackingStoreException;
import com.minres.scviewer.database.DataType;
import com.minres.scviewer.database.IHierNode;
@ -82,6 +83,7 @@ import com.minres.scviewer.database.IWaveformDb;
import com.minres.scviewer.database.IWaveformDbFactory;
import com.minres.scviewer.database.RelationType;
import com.minres.scviewer.database.RelationTypeFactory;
import com.minres.scviewer.database.WaveformType;
import com.minres.scviewer.database.tx.ITx;
import com.minres.scviewer.database.tx.ITxAttribute;
import com.minres.scviewer.database.tx.ITxEvent;
@ -92,6 +94,7 @@ import com.minres.scviewer.database.ui.IWaveformView;
import com.minres.scviewer.database.ui.TrackEntry;
import com.minres.scviewer.database.ui.TrackEntry.ValueDisplay;
import com.minres.scviewer.database.ui.TrackEntry.WaveDisplay;
import com.minres.scviewer.database.ui.ZoomKind;
import com.minres.scviewer.database.ui.swt.Constants;
import com.minres.scviewer.database.ui.swt.IToolTipContentProvider;
import com.minres.scviewer.database.ui.swt.IToolTipHelpTextProvider;
@ -117,37 +120,37 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
/** The Constant DATABASE_FILE. */
protected static final String DATABASE_FILE = "DATABASE_FILE"; //$NON-NLS-1$
/** The Constant SHOWN_WAVEFORM. */
protected static final String SHOWN_WAVEFORM = "SHOWN_WAVEFORM"; //$NON-NLS-1$
protected static final String VALUE_DISPLAY = ".VALUE_DISPLAY"; //$NON-NLS-1$
protected static final String WAVE_DISPLAY = ".WAVE_DISPLAY"; //$NON-NLS-1$
/** The Constant SHOWN_CURSOR. */
protected static final String SHOWN_CURSOR = "SHOWN_CURSOR"; //$NON-NLS-1$
/** The Constant ZOOM_LEVEL. */
protected static final String ZOOM_LEVEL = "ZOOM_LEVEL"; //$NON-NLS-1$
protected static final String SCALING_FACTOR = "SCALING_FACTOR"; //$NON-NLS-1$
/** The Constant BASE_LINE_TIME. */
protected static final String BASE_LINE_TIME = "BASE_LINE_TIME"; //$NON-NLS-1$
/** The Constant SELECTED_TX_ID. */
protected static final String SELECTED_TX_ID = "SELECTED_TX_ID"; //$NON-NLS-1$
/** The Constant SELECTED_TRACKENTRY_NAME. */
protected static final String SELECTED_TRACKENTRY_NAME = "SELECTED_TRACKENTRY_NAME"; //$NON-NLS-1$
/** The Constant WAVEFORM_SELECTED. */
protected static final String WAVEFORM_SELECTED = ".WAVEFORM_SELECTED"; //$NON-NLS-1$
/** The Constant FILE_CHECK_INTERVAL. */
protected static final long FILE_CHECK_INTERVAL = 60000;
/** The zoom level. */
private String[] zoomLevel;
/** The Constant TX_DETAILS_SHOWN. */
protected static final String TX_DETAILS_SHOWN = "TX_DETAILS_SHOWN"; //$NON-NLS-1$
/** The Constant ID. */
public static final String ID = "com.minres.scviewer.ui.TxEditorPart"; //$NON-NLS-1$
@ -156,19 +159,19 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
public static final String WAVE_ACTION_ID = "com.minres.scviewer.ui.action.AddToWave"; //$NON-NLS-1$
private static final String MENU_CONTEXT = "com.minres.scviewer.e4.application.popupmenu.wavecontext"; //$NON-NLS-1$
/** The number of active DisposeListeners */
private int disposeListenerNumber = 0;
/** The factory. */
WaveformViewFactory factory = new WaveformViewFactory();
DesignBrowser browser = null;
TransactionDetails detailsView = null;
TransactionListView transactionList = null;
/** The waveform pane. */
private IWaveformView waveformPane;
@ -211,7 +214,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
ArrayList<File> filesToLoad = new ArrayList<>();
String partConfig = "";
/** The persisted state. */
Map<String, String> persistedState;
@ -231,10 +234,14 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
IModificationChecker fileChecker;
@Inject IWaveformDbFactory dbFactory;
@Inject Composite parent;
private boolean showHover;
private SashForm topSash = null;
private SashForm middleSash = null;
/**
* Creates the composite.
@ -246,7 +253,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
@PostConstruct
public void createComposite(MPart part, EMenuService menuService, @Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE) IEclipsePreferences prefs, @Preference(value = PreferenceConstants.SHOW_HOVER) Boolean hover) {
disposeListenerNumber += 1;
myPart = part;
myParent = parent;
store=prefs;
@ -258,14 +265,14 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
}
});
parent.setLayout(new FillLayout(SWT.HORIZONTAL));
IEclipseContext ctx = myPart.getContext();
ctx.set(WaveformViewer.class, this);
ctx.set(IWaveformDb.class, database);
SashForm topSash = new SashForm(parent, SWT.BORDER | SWT.SMOOTH | SWT.HORIZONTAL);
topSash = new SashForm(parent, SWT.BORDER | SWT.SMOOTH | SWT.HORIZONTAL);
Composite left = new Composite(topSash, SWT.NONE);
SashForm middleSash = new SashForm(topSash, SWT.BORDER | SWT.SMOOTH | SWT.VERTICAL);
middleSash = new SashForm(topSash, SWT.BORDER | SWT.SMOOTH | SWT.VERTICAL);
Composite right = new Composite(topSash, SWT.NONE);
topSash.setWeights(new int[] {20, 60, 20});
@ -275,98 +282,100 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
ctx.set(Composite.class, left);
browser = ContextInjectionFactory.make(DesignBrowser.class, ctx);
ctx.set(Composite.class, right);
detailsView = ContextInjectionFactory.make(TransactionDetails.class, ctx);
waveformPane = factory.createPanel(middleTop);
ctx.set(Composite.class, middleBottom);
transactionList = ContextInjectionFactory.make(TransactionListView.class, ctx);
waveformPane.setMaxTime(0);
//set selection to empty selection when opening a new waveformPane
selectionService.setSelection(new StructuredSelection());
waveformPane.addPropertyChangeListener(IWaveformView.CURSOR_PROPERTY, evt -> {
Long time = (Long) evt.getNewValue();
eventBroker.post(WaveStatusBarControl.CURSOR_TIME, waveformPane.getScaledTime(time));
long marker = waveformPane.getMarkerTime(waveformPane.getSelectedMarkerId());
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, waveformPane.getScaledTime(time - marker));
Long time = (Long) evt.getNewValue();
eventBroker.post(WaveStatusBarControl.CURSOR_TIME, waveformPane.getWaveformZoom().timeToString(time));
long marker = waveformPane.getMarkerTime(waveformPane.getSelectedMarker());
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, waveformPane.getWaveformZoom().timeToString(time - marker));
});
waveformPane.addPropertyChangeListener(IWaveformView.MARKER_PROPERTY, evt -> {
Long time = (Long) evt.getNewValue();
eventBroker.post(WaveStatusBarControl.MARKER_TIME, waveformPane.getScaledTime(time));
long cursor = waveformPane.getCursorTime();
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, waveformPane.getScaledTime(cursor - time));
Long time = (Long) evt.getNewValue();
eventBroker.post(WaveStatusBarControl.MARKER_TIME, waveformPane.getWaveformZoom().timeToString(time));
long cursor = waveformPane.getCursorTime();
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, waveformPane.getWaveformZoom().timeToString(cursor - time));
});
waveformPane.addSelectionChangedListener(event -> {
if (event.getSelection() instanceof IStructuredSelection) {
selectionService.setSelection(event.getSelection());
}
if (event.getSelection() instanceof IStructuredSelection) {
selectionService.setSelection(event.getSelection());
}
});
waveformPane.getWaveformControl().addListener(SWT.KeyDown, e -> {
if((e.stateMask&SWT.MOD3)!=0) { // Alt key
} else if((e.stateMask&SWT.MOD1)!=0) { //Ctrl/Cmd
int zoomlevel = waveformPane.getZoomLevel();
switch(e.keyCode) {
case '+':
case SWT.KEYPAD_ADD:
if(zoomlevel>0)
waveformPane.setZoomLevel(zoomlevel-1);
return;
case '-':
case SWT.KEYPAD_SUBTRACT:
if(zoomlevel<waveformPane.getZoomLevels().length-1)
waveformPane.setZoomLevel(zoomlevel+1);
return;
case SWT.ARROW_UP:
waveformPane.moveSelectedTrack(-1);
return;
case SWT.ARROW_DOWN:
waveformPane.moveSelectedTrack(1);
return;
default:
break;
}
} else if((e.stateMask&SWT.MOD2)!=0) { //Shift
switch(e.keyCode) {
case SWT.ARROW_LEFT:
waveformPane.scrollHorizontal(-100);
return;
case SWT.ARROW_RIGHT:
waveformPane.scrollHorizontal(100);
return;
default:
break;
}
} else {
switch(e.keyCode) {
case SWT.ARROW_LEFT:
waveformPane.scrollHorizontal(-10);
return;
case SWT.ARROW_RIGHT:
waveformPane.scrollHorizontal(10);
return;
case SWT.ARROW_UP:
waveformPane.moveSelection(GotoDirection.UP);
return;
case SWT.ARROW_DOWN:
waveformPane.moveSelection(GotoDirection.DOWN);
return;
case SWT.HOME:
return;
case SWT.END:
return;
default:
break;
}
if((e.stateMask&SWT.MOD3)!=0) { // Alt key
} else if((e.stateMask&SWT.MOD1)!=0) { //Ctrl/Cmd
switch(e.keyCode) {
case '+':
case SWT.KEYPAD_ADD:
waveformPane.getWaveformZoom().zoom(ZoomKind.IN);
return;
case '-':
case SWT.KEYPAD_SUBTRACT:
waveformPane.getWaveformZoom().zoom(ZoomKind.OUT);
return;
case SWT.ARROW_UP:
waveformPane.moveSelectedTrack(-1);
return;
case SWT.ARROW_DOWN:
waveformPane.moveSelectedTrack(1);
return;
case 'a':
selectAll();
default:
break;
}
} else if((e.stateMask&SWT.MOD2)!=0) { //Shift
switch(e.keyCode) {
case SWT.ARROW_LEFT:
waveformPane.scrollHorizontal(-100);
return;
case SWT.ARROW_RIGHT:
waveformPane.scrollHorizontal(100);
return;
default:
break;
}
} else {
switch(e.keyCode) {
case SWT.ARROW_LEFT:
waveformPane.scrollHorizontal(-10);
return;
case SWT.ARROW_RIGHT:
waveformPane.scrollHorizontal(10);
return;
case SWT.ARROW_UP:
waveformPane.moveSelection(GotoDirection.UP);
return;
case SWT.ARROW_DOWN:
waveformPane.moveSelection(GotoDirection.DOWN);
return;
case SWT.HOME:
waveformPane.scrollTo(IWaveformView.MARKER_POS);
return;
case SWT.END:
waveformPane.scrollTo(IWaveformView.CURSOR_POS);
return;
case SWT.DEL:
waveformPane.deleteSelectedTracks();
default:
break;
}
}
});
zoomLevel = waveformPane.getZoomLevels();
checkForUpdates = store.getBoolean(PreferenceConstants.DATABASE_RELOAD, true);
filesToLoad = new ArrayList<>();
persistedState = part.getPersistedState();
@ -377,7 +386,6 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
}
if (!filesToLoad.isEmpty())
loadDatabase(persistedState);
eventBroker.post(WaveStatusBarControl.ZOOM_LEVEL, zoomLevel[waveformPane.getZoomLevel()]);
menuService.registerContextMenu(waveformPane.getNameControl(), MENU_CONTEXT);
menuService.registerContextMenu(waveformPane.getValueControl(), MENU_CONTEXT);
menuService.registerContextMenu(waveformPane.getWaveformControl(), MENU_CONTEXT);
@ -457,8 +465,8 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
valueCol.pack();
table.setSize(table.computeSize(SWT.DEFAULT, SWT.DEFAULT));
parent.addPaintListener( e -> {
Rectangle area = parent.getClientArea();
valueCol.setWidth(area.width - nameCol.getWidth());
Rectangle area = parent.getClientArea();
valueCol.setWidth(area.width - nameCol.getWidth());
});
parent.addFocusListener(FocusListener.focusGainedAdapter(e -> table.setFocus()));
return true;
@ -480,21 +488,28 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
}
});
waveformPane.setStyleProvider(new WaveformStyleProvider(store));
showTxDetails(false);
}
@Inject
@Optional
public void reactOnPrefsChange(@Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE) IEclipsePreferences prefs) {
prefs.addPreferenceChangeListener(this);
}
@Inject
@Optional
public void reactOnShowHoverChange(@Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE, value = PreferenceConstants.SHOW_HOVER) Boolean hover) {
showHover=hover;
}
@Inject
@Optional
public void reactOnShowTxDetailsChange(@Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE, value = PreferenceConstants.SHOW_TX_DETAILS) Boolean show) {
showTxDetails(show);
}
@Inject
@Optional
public void reactOnReloadDatabaseChange(@Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE, value = PreferenceConstants.DATABASE_RELOAD) Boolean checkForUpdates) {
@ -564,7 +579,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
if (monitor.isCanceled())
throw new OperationCanceledException(Messages.WaveformViewer_14);
IStatus result = jobGroup.getResult();
if( (!result.isMultiStatus() && result.getCode() != Status.OK_STATUS.getCode() ) ||
(result.isMultiStatus() && result.getChildren().length > 0 && result.getChildren()[0].getCode() != Status.OK_STATUS.getCode() ) ){
@ -601,10 +616,10 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
public void fileChanged(List<File> file) {
final Display display = myParent.getDisplay();
display.asyncExec(() -> {
if (MessageDialog.openQuestion(display.getActiveShell(), Messages.WaveformViewer_17,
Messages.WaveformViewer_18)) {
reloadDatabase();
}
if (MessageDialog.openQuestion(display.getActiveShell(), Messages.WaveformViewer_17,
Messages.WaveformViewer_18)) {
reloadDatabase();
}
});
fileMonitor.removeFileChangeListener(this);
}
@ -680,14 +695,14 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
saveWaveformViewerState(persistingState);
Properties props = new Properties();
props.putAll(persistingState);
try (FileOutputStream out = new FileOutputStream(fileName)) {
props.store(out, "Written by SCViewer"); //$NON-NLS-1$
} catch (IOException e) {
e.printStackTrace();
}
}
public void loadState(String fileName){
//clear old streams before loading tab settings
if(!waveformPane.getStreamList().isEmpty()) {
@ -705,7 +720,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
e.printStackTrace();
}
}
/**
* Save waveform viewer state.
*
@ -728,9 +743,9 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
persistingState.put(SHOWN_CURSOR + index, Long.toString(cursor.getTime()));
index++;
}
persistingState.put(ZOOM_LEVEL, Integer.toString(waveformPane.getZoomLevel()));
persistingState.put(BASE_LINE_TIME, Long.toString(waveformPane.getBaselineTime()));
persistingState.put(SCALING_FACTOR, Long.toString(waveformPane.getWaveformZoom().getScale()));
persistingState.put(BASE_LINE_TIME, Long.toString(waveformPane.getWaveformZoom().getMinVisibleTime()));
// get selected transaction of a stream
ISelection selection = waveformPane.getSelection();
if (!selection.isEmpty()) {
@ -745,24 +760,25 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
persistingState.put(SELECTED_TRACKENTRY_NAME, name);
}
}
persistingState.put(TX_DETAILS_SHOWN, Boolean.toString(store.getBoolean(PreferenceConstants.SHOW_TX_DETAILS, false)));
}
protected List<Object> getISelection(ISelection selection){
List<Object> result = new LinkedList<> ();
List<Object> result = new LinkedList<> ();
if ( selection instanceof IStructuredSelection ) {
Iterator<?> i = ((IStructuredSelection)selection).iterator();
while (i.hasNext()){
Object o = i.next ();
if (o == null) {
continue;
}
result.add(o);
}
}
return result;
if ( selection instanceof IStructuredSelection ) {
Iterator<?> i = ((IStructuredSelection)selection).iterator();
while (i.hasNext()){
Object o = i.next ();
if (o == null) {
continue;
}
result.add(o);
}
}
return result;
}
/**
* Restore waveform viewer state.
*
@ -799,17 +815,17 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
cursors.get(i).setTime(time);
}
}
if (state.containsKey(ZOOM_LEVEL)) {
if (state.containsKey(SCALING_FACTOR)) {
try {
Integer scale = Integer.parseInt(state.get(ZOOM_LEVEL));
waveformPane.setZoomLevel(scale);
long scale = Long.parseLong(state.get(SCALING_FACTOR));
waveformPane.getWaveformZoom().setScale(scale);
} catch (NumberFormatException e) {
}
}
if (state.containsKey(BASE_LINE_TIME)) {
try {
Long scale = Long.parseLong(state.get(BASE_LINE_TIME));
waveformPane.setBaselineTime(scale);
waveformPane.getWaveformZoom().setMinVisibleTime(scale);
} catch (NumberFormatException e) {
}
}
@ -819,18 +835,24 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
String trackentryName = state.get(SELECTED_TRACKENTRY_NAME);
//get TrackEntry Object based on name and TX Object by id and put into selectionList
trackEntries.stream().filter(e->trackentryName.equals(e.waveform.getFullName())).forEach(trackEntry ->
trackEntry.waveform.getEvents().entrySet().stream()
.map(e->e.events)
.filter(Objects::nonNull)
.forEach(entries->
Arrays.stream(entries)
.filter(e->e instanceof ITxEvent && txId.equals(((ITxEvent)e).getTransaction().getId()))
.forEach(event ->
waveformPane.setSelection(new StructuredSelection(
new Object[] {((ITxEvent)event).getTransaction(), trackEntry}))
trackEntry.waveform.getEvents().entrySet().stream()
.map(e->e.events)
.filter(Objects::nonNull)
.forEach(entries->
Arrays.stream(entries)
.filter(e->e instanceof ITxEvent && txId.equals(((ITxEvent)e).getTransaction().getId()))
.forEach(event ->
waveformPane.setSelection(new StructuredSelection(
new Object[] {((ITxEvent)event).getTransaction(), trackEntry}))
)
)
);
)
);
} catch (NumberFormatException e) {
}
}
if (state.containsKey(TX_DETAILS_SHOWN)) {
try {
showTxDetails(Boolean.parseBoolean(state.get(TX_DETAILS_SHOWN)));
} catch (NumberFormatException e) {
}
}
@ -842,12 +864,11 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
*/
private void updateAll() {
eventBroker.post(ACTIVE_WAVEFORMVIEW, this);
eventBroker.post(WaveStatusBarControl.ZOOM_LEVEL, zoomLevel[waveformPane.getZoomLevel()]);
long cursor = waveformPane.getCursorTime();
long marker = waveformPane.getMarkerTime(waveformPane.getSelectedMarkerId());
eventBroker.post(WaveStatusBarControl.CURSOR_TIME, waveformPane.getScaledTime(cursor));
eventBroker.post(WaveStatusBarControl.MARKER_TIME, waveformPane.getScaledTime(marker));
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, waveformPane.getScaledTime(cursor - marker));
long marker = waveformPane.getMarkerTime(waveformPane.getSelectedMarker());
eventBroker.post(WaveStatusBarControl.CURSOR_TIME, waveformPane.getWaveformZoom().timeToString(cursor));
eventBroker.post(WaveStatusBarControl.MARKER_TIME, waveformPane.getWaveformZoom().timeToString(marker));
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, waveformPane.getWaveformZoom().timeToString(cursor - marker));
}
/**
@ -966,15 +987,18 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
}
}
showTxDetails(waveformPane.getStreamList().stream().filter(t -> t.waveform.getType() == WaveformType.TRANSACTION).findFirst().isPresent());
setFocus();
}
public void removeSelectedStreamsFromList() {
waveformPane.deleteSelectedTracks();
showTxDetails(waveformPane.getStreamList().stream().filter(t -> t.waveform.getType() == WaveformType.TRANSACTION).findFirst().isPresent());
}
public void removeSelectedStreamFromList() {
waveformPane.deleteSelectedTracks();
showTxDetails(waveformPane.getStreamList().stream().filter(t -> t.waveform.getType() == WaveformType.TRANSACTION).findFirst().isPresent());
}
/**
* Move selected.
@ -985,7 +1009,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
waveformPane.moveSelectedTrack(i);
}
/**
* Move selection.
*
@ -1015,36 +1039,35 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
}
/**
* Sets the zoom level.
*
* @param level the new zoom level
* Execute the zoom according to kind.
*
* @param kind the type of zoom to execute
*/
public void setZoomLevel(Integer level) {
if (level < 0)
level = 0;
if (level > zoomLevel.length - 1)
level = zoomLevel.length - 1;
waveformPane.setZoomLevel(level);
public void zoom(ZoomKind kind) {
waveformPane.getWaveformZoom().zoom(kind);
updateAll();
}
/**
* Sets the zoom fit.
* Execute the zoom kind.
*
* @param direction the direction of the pan (-1, 0, 1)
*/
public void setZoomFit() {
waveformPane.setZoomLevel(-1);
public void pan(int direction) {
switch(direction) {
case -1:
waveformPane.scrollHorizontal(-10);
return;
case 1:
waveformPane.scrollHorizontal(10);
return;
case 0:
waveformPane.scrollTo(IWaveformView.CURSOR_POS);
return;
}
updateAll();
}
/**
* Gets the zoom level.
*
* @return the zoom level
*/
public int getZoomLevel() {
return waveformPane.getZoomLevel();
}
/**
* Gets the selection.
*
@ -1073,7 +1096,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
* @return the scaled time
*/
public String getScaledTime(Long time) {
return waveformPane.getScaledTime(time);
return waveformPane.getWaveformZoom().timeToString(time);
}
/**
@ -1177,7 +1200,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
if(navigationRelationType!=relationType) waveformPane.setHighliteRelation(relationType);
navigationRelationType=relationType;
}
public void update() {
waveformPane.update();
}
@ -1196,17 +1219,45 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
*
* @param e
*/
public void widgetDisposed(DisposeEvent e) {
disposeListenerNumber -= 1;
if( disposeListenerNumber == 0) { //if the last tab is closed, reset statusbar
eventBroker.post(WaveStatusBarControl.ZOOM_LEVEL, null);
public void widgetDisposed(DisposeEvent e) {
disposeListenerNumber -= 1;
if( disposeListenerNumber == 0) { //if the last tab is closed, reset statusbar
eventBroker.post(WaveStatusBarControl.CURSOR_TIME, null);
eventBroker.post(WaveStatusBarControl.MARKER_TIME, null);
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, null);
}
}
}
}
public void search(String propName, DataType type, String propValue) {
transactionList.getControl().setSearchProps(propName, type, propValue);
}
public void showTxDetails(boolean show) {
if(middleSash==null || topSash==null || middleSash.isDisposed() || topSash.isDisposed())
return;
if(show) {
middleSash.setWeights(new int[] {75, 25});
topSash.setWeights(new int[] {20, 60, 20});
} else {
middleSash.setWeights(new int[] {100, 0});
topSash.setWeights(new int[] {20, 80, 0});
}
detailsView.getControl().setVisible(show);
transactionList.getControl().setVisible(show);
parent.requestLayout();
if(store.getBoolean(PreferenceConstants.SHOW_TX_DETAILS, false) != show) {
store.putBoolean(PreferenceConstants.SHOW_TX_DETAILS, show);
try {
store.flush();
} catch (BackingStoreException e) {}
}
}
public void selectAll() {
List<TrackEntry> entries = waveformPane.getStreamList();
ISelection sel = new StructuredSelection(entries);
waveformPane.setSelection(sel);
designBrowser.selectAllWaveforms();
}
}

View File

@ -0,0 +1,153 @@
package com.minres.scviewer.e4.application.parts.help;
import java.io.File;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ResourceLocator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTError;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.browser.LocationListener;
import org.eclipse.swt.browser.ProgressEvent;
import org.eclipse.swt.browser.ProgressListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.ProgressBar;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import com.minres.scviewer.e4.application.Messages;
public class HelpBrowser {
@Inject IEclipseContext ctx;
@Inject MUIElement element;
private static void decorateItem(ToolItem item, String label, String imageName) {
String fullpath = File.separator+"icons"+File.separator+imageName; //$NON-NLS-1$
ImageDescriptor descr = ResourceLocator.imageDescriptorFromBundle("com.minres.scviewer.e4.application", fullpath).orElse(null); //$NON-NLS-1$
if(descr == null) {
item.setText(label);
} else {
item.setImage(descr.createImage());
item.setToolTipText(label);
}
item.setData(label);
}
@PostConstruct
protected Control createComposite(Composite container) {
// container.getShell().addListener(SWT.Close, e -> {
// e.doit= false;
// element.setVisible(false);
// });
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 3;
container.setLayout(gridLayout);
ToolBar toolbar = new ToolBar(container, SWT.NONE);
ToolItem itemBack = new ToolItem(toolbar, SWT.PUSH);
decorateItem(itemBack, Messages.HelpDialog_0, "arrow_undo.png"); //$NON-NLS-1$
ToolItem itemForward = new ToolItem(toolbar, SWT.PUSH);
decorateItem(itemForward, Messages.HelpDialog_1, "arrow_redo.png"); //$NON-NLS-1$
ToolItem itemStop = new ToolItem(toolbar, SWT.PUSH);
decorateItem(itemStop, Messages.HelpDialog_2, "cross.png"); //$NON-NLS-1$
ToolItem itemRefresh = new ToolItem(toolbar, SWT.PUSH);
decorateItem(itemRefresh, Messages.HelpDialog_3, "arrow_refresh.png"); //$NON-NLS-1$
ToolItem itemGo = new ToolItem(toolbar, SWT.PUSH);
decorateItem(itemGo, Messages.HelpDialog_4, "accept.png"); //$NON-NLS-1$
GridData data = new GridData();
data.horizontalSpan = 3;
toolbar.setLayoutData(data);
Label labelAddress = new Label(container, SWT.NONE);
labelAddress.setText(Messages.HelpDialog_5);
final Text location = new Text(container, SWT.BORDER);
data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.horizontalSpan = 2;
data.grabExcessHorizontalSpace = true;
location.setLayoutData(data);
final Browser browser;
try {
browser = new Browser(container, SWT.NONE);
data = new GridData();
// data.widthHint = 800;
// data.heightHint =600;
data.horizontalAlignment = GridData.FILL;
data.verticalAlignment = GridData.FILL;
data.horizontalSpan = 3;
data.grabExcessHorizontalSpace = true;
data.grabExcessVerticalSpace = true;
browser.setLayoutData(data);
final Label status = new Label(container, SWT.NONE);
data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 2;
status.setLayoutData(data);
final ProgressBar progressBar = new ProgressBar(container, SWT.NONE);
data = new GridData();
data.horizontalAlignment = GridData.END;
progressBar.setLayoutData(data);
/* event handling */
Listener listener = event -> {
ToolItem item = (ToolItem) event.widget;
String string = (String) item.getData();
if (string.equals(Messages.HelpDialog_0))
browser.back();
else if (string.equals(Messages.HelpDialog_1))
browser.forward();
else if (string.equals(Messages.HelpDialog_2))
browser.stop();
else if (string.equals(Messages.HelpDialog_3))
browser.refresh();
else if (string.equals(Messages.HelpDialog_4))
browser.setUrl(location.getText());
};
browser.addProgressListener(new ProgressListener() {
@Override
public void changed(ProgressEvent event) {
if (event.total == 0) return;
int ratio = event.current * 100 / event.total;
progressBar.setSelection(ratio);
}
@Override
public void completed(ProgressEvent event) {
progressBar.setSelection(0);
}
});
browser.addStatusTextListener(event -> status.setText(event.text));
browser.addLocationListener(LocationListener.changedAdapter(event -> { if (event.top) location.setText(event.location); }));
itemBack.addListener(SWT.Selection, listener);
itemForward.addListener(SWT.Selection, listener);
itemStop.addListener(SWT.Selection, listener);
itemRefresh.addListener(SWT.Selection, listener);
itemGo.addListener(SWT.Selection, listener);
location.addListener(SWT.DefaultSelection, e -> browser.setUrl(location.getText()));
browser.setUrl(Messages.HelpDialog_6);
} catch (SWTError e) {
MessageDialog.openWarning(container.getDisplay().getActiveShell(), Messages.HelpBrowser_7,Messages.HelpBrowser_8+e.getMessage());
}
return container;
}
void handleShellCloseEvent(){
}
}

View File

@ -68,6 +68,7 @@ public class DefaultValuesInitializer extends AbstractPreferenceInitializer {
store.putBoolean(PreferenceConstants.DATABASE_RELOAD, true);
store.putBoolean(PreferenceConstants.SHOW_HOVER, true);
store.putBoolean(PreferenceConstants.SHOW_TX_DETAILS, false);
store.putInt(PreferenceConstants.TRACK_HEIGHT, 30);
for (WaveformColors c : WaveformColors.values()) {
store.put(c.name()+"_COLOR", StringConverter.asString(colors[c.ordinal()].getRGB())); //$NON-NLS-1$

View File

@ -23,9 +23,12 @@ public class PreferenceConstants {
/** The Constant DATABASE_RELOAD. */
public static final String DATABASE_RELOAD="databaseReload"; //$NON-NLS-1$
/** The Constant DATABASE_RELOAD. */
/** The Constant SHOW_HOVER. */
public static final String SHOW_HOVER="showWaveformHover"; //$NON-NLS-1$
/** The Constant SHOW_TX_DETAILS. */
public static final String SHOW_TX_DETAILS="showTxDetails"; //$NON-NLS-1$
/** The Constant TRACK_HEIGHT. */
public static final String TRACK_HEIGHT="trackHeigth"; //$NON-NLS-1$

View File

@ -39,6 +39,8 @@ public class SCViewerPreferencesPage extends FieldEditorPreferencePage {
getFieldEditorParent()));
addField(new BooleanFieldEditor(PreferenceConstants.SHOW_HOVER, Messages.SCViewerPreferencesPage_1,
getFieldEditorParent()));
addField(new BooleanFieldEditor(PreferenceConstants.SHOW_TX_DETAILS, Messages.SCViewerPreferencesPage_3,
getFieldEditorParent()));
addField(new IntegerFieldEditor(PreferenceConstants.TRACK_HEIGHT, Messages.SCViewerPreferencesPage_2,
getFieldEditorParent()));

View File

@ -19,7 +19,6 @@ import org.eclipse.jface.viewers.ITreeContentProvider;
import com.minres.scviewer.database.IHierNode;
import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.IWaveformDb;
/**
* The Class TxDbContentProvider providing the tree content of a database for the respective viewer.

View File

@ -139,19 +139,7 @@
</visibleWhen>
</command>
<command
commandId="com.minres.scviewer.ui.zoom"
id="com.minres.scviewer.ui.zoom.command"
style="pulldown"
tooltip="Set zoom level">
<visibleWhen
checkEnabled="false">
<reference
definitionId="com.minres.scviewer.ui.waveEditorActive">
</reference>
</visibleWhen>
</command>
<command
commandId="com.minres.scviewer.ui.zoomin"
commandId="com.minres.scviewer.ui.zoom.in"
label="Zoom in"
style="push"
tooltip="Zoom into">
@ -163,7 +151,7 @@
</visibleWhen>
</command>
<command
commandId="com.minres.scviewer.ui.zoomout"
commandId="com.minres.scviewer.ui.zoom.out"
label="Zoom out"
style="push"
tooltip="Zoom out of">
@ -176,119 +164,6 @@
</command>
</toolbar>
</menuContribution>
<menuContribution
locationURI="menu:com.minres.scviewer.ui.zoom.command">
<command
commandId="com.minres.scviewer.ui.zoom"
label="100ps"
style="push"
tooltip="Resolution 100ps">
<parameter
name="com.minres.scviewer.ui.zoom.level"
value="5">
</parameter>
</command>
<command
commandId="com.minres.scviewer.ui.zoom"
label="1ns"
style="push"
tooltip="Resolution 1ns">
<parameter
name="com.minres.scviewer.ui.zoom.level"
value="6">
</parameter>
</command>
<command
commandId="com.minres.scviewer.ui.zoom"
label="10ns"
style="push"
tooltip="Resolution 10ns">
<parameter
name="com.minres.scviewer.ui.zoom.level"
value="7">
</parameter>
</command>
<command
commandId="com.minres.scviewer.ui.zoom"
label="100ns"
style="push"
tooltip="Resolution 100ns">
<parameter
name="com.minres.scviewer.ui.zoom.level"
value="8">
</parameter>
</command>
<command
commandId="com.minres.scviewer.ui.zoom"
label="1µs"
style="push"
tooltip="Resolution 1us">
<parameter
name="com.minres.scviewer.ui.zoom.level"
value="9">
</parameter>
</command>
<command
commandId="com.minres.scviewer.ui.zoom"
label="10µs"
style="push"
tooltip="Resolution 10us">
<parameter
name="com.minres.scviewer.ui.zoom.level"
value="10">
</parameter>
</command>
<command
commandId="com.minres.scviewer.ui.zoom"
label="100µs"
style="push"
tooltip="Resolution 100us">
<parameter
name="com.minres.scviewer.ui.zoom.level"
value="11">
</parameter>
</command>
<command
commandId="com.minres.scviewer.ui.zoom"
label="1ms"
style="push"
tooltip="Resolution 1ms">
<parameter
name="com.minres.scviewer.ui.zoom.level"
value="12">
</parameter>
</command>
<command
commandId="com.minres.scviewer.ui.zoom"
label="10ms"
style="push"
tooltip="Resolution 10ms">
<parameter
name="com.minres.scviewer.ui.zoom.level"
value="13">
</parameter>
</command>
<command
commandId="com.minres.scviewer.ui.zoom"
label="100ms"
style="push"
tooltip="Resolution 100ms">
<parameter
name="com.minres.scviewer.ui.zoom.level"
value="14">
</parameter>
</command>
<command
commandId="com.minres.scviewer.ui.zoom"
label="1s"
style="push"
tooltip="Resolution 1s">
<parameter
name="com.minres.scviewer.ui.zoom.level"
value="15">
</parameter>
</command>
</menuContribution>
<menuContribution
allPopups="false"
locationURI="popup:com.minres.scviewer.ui.TxEditorPart">
@ -305,7 +180,7 @@
</visibleWhen>
</command>
<command
commandId="com.minres.scviewer.ui.zoomin"
commandId="com.minres.scviewer.ui.zoom.in"
label="Zoom in"
style="push"
tooltip="Zoom into">
@ -317,7 +192,7 @@
</visibleWhen>
</command>
<command
commandId="com.minres.scviewer.ui.zoomout"
commandId="com.minres.scviewer.ui.zoom.out"
label="Zoom out"
style="push"
tooltip="Zoom out of">
@ -367,24 +242,21 @@
name="Prev">
</command>
<command
defaultHandler="com.minres.scviewer.ui.handler.Zoom"
description="Set the zoom level"
id="com.minres.scviewer.ui.zoom"
name="Zoom">
<commandParameter
id="com.minres.scviewer.ui.zoom.level"
name="level"
optional="true">
</commandParameter>
</command>
<command
id="com.minres.scviewer.ui.zoomin"
id="com.minres.scviewer.ui.zoom.in"
name="Zoom in">
</command>
<command
id="com.minres.scviewer.ui.zoomout"
id="com.minres.scviewer.ui.zoom.out"
name="Zoom out">
</command>
<command
id="com.minres.scviewer.ui.zoom.fit"
name="Zoom fit">
</command>
<command
id="com.minres.scviewer.ui.zoom.full"
name="Zoom full">
</command>
<command
id="com.minres.scviewer.ui.removeWave"
name="Remove wave">
@ -411,8 +283,8 @@
</enabledWhen>
</handler>
<handler
class="com.minres.scviewer.ui.handler.ZoomInOut"
commandId="com.minres.scviewer.ui.zoomin">
class="com.minres.scviewer.ui.handler.Zoom"
commandId="com.minres.scviewer.ui.zoom.in">
<enabledWhen>
<reference
definitionId="com.minres.scviewer.ui.waveEditorActive">
@ -420,8 +292,8 @@
</enabledWhen>
</handler>
<handler
class="com.minres.scviewer.ui.handler.ZoomInOut"
commandId="com.minres.scviewer.ui.zoomout">
class="com.minres.scviewer.ui.handler.Zoom"
commandId="com.minres.scviewer.ui.zoom.out">
<enabledWhen>
<reference
definitionId="com.minres.scviewer.ui.waveEditorActive">
@ -493,15 +365,11 @@
icon="res/images/next-green.png">
</image>
<image
commandId="com.minres.scviewer.ui.zoom"
icon="res/images/zoom.png">
</image>
<image
commandId="com.minres.scviewer.ui.zoomin"
commandId="com.minres.scviewer.ui.zoom.in"
icon="res/images/zoom_in.png">
</image>
<image
commandId="com.minres.scviewer.ui.zoomout"
commandId="com.minres.scviewer.ui.zoom.out"
icon="res/images/zoom_out.png">
</image>
<image

View File

@ -4,7 +4,7 @@
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>2.13.2</version>
<version>2.15.0</version>
<relativePath>../..</relativePath>
</parent>
<packaging>eclipse-plugin</packaging>

View File

@ -50,6 +50,7 @@ import com.minres.scviewer.database.IWaveformDbFactory;
import com.minres.scviewer.database.ui.GotoDirection;
import com.minres.scviewer.database.ui.IWaveformView;
import com.minres.scviewer.database.ui.TrackEntry;
import com.minres.scviewer.database.ui.ZoomKind;
import com.minres.scviewer.database.ui.swt.WaveformViewFactory;
import com.minres.scviewer.ui.views.TxOutlinePage;
@ -66,13 +67,6 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage
waveformDbFactory=null;
}
private final static String[] zoomLevel={
"1fs", "10fs", "100fs",
"1ps", "10ps", "100ps",
"1ns", "10ns", "100ns",
"1µs", "10µs", "10µs",
"1ms", "10ms", "100ms", "1s"};
public static final String ID = "com.minres.scviewer.ui.TxEditorPart"; //$NON-NLS-1$
public static final String WAVE_ACTION_ID = "com.minres.scviewer.ui.action.AddToWave";
@ -85,7 +79,6 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage
private Composite myParent;
private StatusLineContributionItem cursorStatusLineItem;
private StatusLineContributionItem zoomStatusLineItem;
public TxEditorPart() {
}
@ -132,7 +125,6 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage
}
}
}).run();
zoomStatusLineItem.setText("Zoom level: "+zoomLevel[waveformView.getZoomLevel()]);
cursorStatusLineItem.setText("Cursor: "+ waveformView.getCursorTime()/1000000+"ns");
MenuManager menuMgr = new MenuManager("#PopupMenu");
// menuMgr.setRemoveAllWhenShown(true);
@ -306,11 +298,9 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage
// Initialize the editor part
setSite(site);
setInput(input);
zoomStatusLineItem = new StatusLineContributionItem("TxEditorZoomContributionItem");
cursorStatusLineItem = new StatusLineContributionItem("TxEditorCursorContributionItem");
IActionBars actionBars = getEditorSite().getActionBars();
IStatusLineManager manager = actionBars.getStatusLineManager();
manager.add(zoomStatusLineItem);
manager.add(cursorStatusLineItem);
actionBars.updateActionBars();
}
@ -388,16 +378,8 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage
waveformView.moveSelection( next);
}
public void setZoomLevel(Integer level) {
waveformView.setZoomLevel(level);
}
public void setZoomFit() {
waveformView.setZoomLevel(6);
}
public int getZoomLevel() {
return waveformView.getZoomLevel();
public void setZoom(ZoomKind kind) {
waveformView.getWaveformZoom().zoom(kind);
}
public void removeSelected() {

View File

@ -16,25 +16,30 @@ import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.handlers.HandlerUtil;
import com.minres.scviewer.database.ui.ZoomKind;
import com.minres.scviewer.ui.TxEditorPart;
public class Zoom extends AbstractHandler {
private static final String PARM_MSG = "com.minres.scviewer.ui.zoom.level";
private static final String ZOOMIN_ID = "com.minres.scviewer.ui.zoom.in";
private static final String ZOOMOUT_ID = "com.minres.scviewer.ui.zoom.out";
private static final String ZOOMFIT_ID = "com.minres.scviewer.ui.zoom.fit";
private static final String ZOOMFULL_ID = "com.minres.scviewer.ui.zoom.full";
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editor = HandlerUtil.getActiveEditor(event);
String msg = event.getParameter(PARM_MSG);
if (msg == null) {
if(editor instanceof TxEditorPart){
((TxEditorPart)editor).setZoomFit();
}
} else {
Integer level = Integer.parseInt(msg);
if(editor instanceof TxEditorPart){
((TxEditorPart)editor).setZoomLevel(level);
}
}
if(editor instanceof TxEditorPart){
String id = event.getCommand().getId();
TxEditorPart txEditor=(TxEditorPart) editor;
if (ZOOMIN_ID.compareTo(id) == 0)
txEditor.setZoom(ZoomKind.IN);
else if(ZOOMOUT_ID.compareTo(id) == 0)
txEditor.setZoom(ZoomKind.OUT);
else if(ZOOMFIT_ID.compareTo(id) == 0)
txEditor.setZoom(ZoomKind.FIT);
else if(ZOOMFULL_ID.compareTo(id) == 0)
txEditor.setZoom(ZoomKind.FULL);
}
return null;
}

View File

@ -1,39 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.ui.handler;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.handlers.HandlerUtil;
import com.minres.scviewer.ui.TxEditorPart;
public class ZoomInOut extends AbstractHandler {
private static final String ZOOMIN_ID = "com.minres.scviewer.ui.zoomin";
private static final String ZOOMOUT_ID= "com.minres.scviewer.ui.zoomout";
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editor = HandlerUtil.getActiveEditor(event);
if(editor instanceof TxEditorPart){
String id = event.getCommand().getId();
TxEditorPart txEditor=(TxEditorPart) editor;
if (ZOOMIN_ID.compareTo(id) == 0)
txEditor.setZoomLevel(txEditor.getZoomLevel()-1);
else if(ZOOMOUT_ID.compareTo(id) == 0)
txEditor.setZoomLevel(txEditor.getZoomLevel()+1);
}
return null;
}
}

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>2.13.2</version>
<version>2.15.0</version>
<packaging>pom</packaging>
<modules>
<module>releng/com.minres.scviewer.target</module>
@ -29,6 +29,8 @@
<tycho-version>1.5.0</tycho-version>
<groovy-eclipse-compiler-version>3.6.0-03</groovy-eclipse-compiler-version>
<groovy-eclipse-batch-version>3.0.3-01</groovy-eclipse-batch-version>
<!-- <software.download.area>${user.home}/deployment-work/${DEPLOY_WORK_DIRECTORY}</software.download.area> -->
<software.download.area>${project.build.directory}/../</software.download.area>
</properties>
<build>
@ -67,7 +69,7 @@
<artifact>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.target</artifactId>
<version>2.13.2</version>
<version>2.15.0</version>
</artifact>
</target>
<environments>
@ -125,7 +127,6 @@
<plugin id="org.hamcrest.core" />
<plugin id="org.junit" />
<plugin id="com.minres.scviewer.e4.product" />
<plugin id="com.minres.scviewer.e4.product_slim" />
<plugin id="org.eclipse.core.filesystem.linux.x86_64" />
<plugin id="org.eclipse.core.filesystem.win32.x86_64" />
<plugin id="com.opcoach.e4.preferences" />

View File

@ -6,11 +6,11 @@
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>2.13.2</version>
<version>2.15.0</version>
<relativePath>../..</relativePath>
</parent>
<artifactId>com.minres.scviewer.e4.product</artifactId>
<version>2.13.2</version>
<version>2.15.0</version>
<packaging>eclipse-repository</packaging>
<groupId>com.minres.scviewer</groupId>
<build>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?>
<product name="SCViewer" uid="product" id="com.minres.scviewer.e4.application.product" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="2.13.2" useFeatures="true" includeLaunchers="true">
<product name="SCViewer" uid="product" id="com.minres.scviewer.e4.application.product" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="2.15.0" useFeatures="true" includeLaunchers="true">
<configIni use="default">
</configIni>

View File

@ -12,7 +12,7 @@
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>2.13.2</version>
<version>2.15.0</version>
<relativePath>../..</relativePath>
</parent>

View File

@ -3,3 +3,4 @@
/artifacts.jar
/content.jar
/target/
/gh-pages/

View File

@ -0,0 +1,104 @@
<?xml version="1.0"?>
<project name="project">
<target name="getMajorMinorVersion">
<script language="javascript">
<![CDATA[
// getting the value
buildnumber = project.getProperty("unqualifiedVersion");
index = buildnumber.lastIndexOf(".");
counter = buildnumber.substring(0, index);
project.setProperty("majorMinorVersion",counter);
]]>
</script>
</target>
<target name="test_getMajorMinor" depends="getMajorMinorVersion">
<echo message="majorMinorVersion: ${majorMinorVersion}"/>
</target>
<!--
site.label The name/title/label of the created composite site
unqualifiedVersion The version without any qualifier replacement
buildQualifier The build qualifier
-->
<target name="compute.child.repository.data" depends="getMajorMinorVersion">
<property name="full.version" value="${unqualifiedVersion}" />
<property name="software.download.area" location="${user.home}/p2.repositories" />
<property name="updates.dir" value="updates" />
<property name="site.composite.name" value="${site.label} ${majorMinorVersion}" />
<property name="main.site.composite.name" value="${site.label} All Versions" />
<!--
<property name="main.composite.repository.directory" location="${software.download.area}/${updates.dir}" />
-->
<property name="main.composite.repository.directory" location="${software.download.area}" />
<property name="composite.repository.directory" value="${main.composite.repository.directory}/${majorMinorVersion}" />
<property name="child.repository" value="${full.version}" />
<property name="child.repository.directory" value="${composite.repository.directory}/${child.repository}/" />
</target>
<target name="p2.composite.add" depends="compute.child.repository.data">
<property name="source.repository" location="${project.build.directory}/repository"/>
<echo message=" " />
<echo message="Source repository path: ${source.repository}" />
<echo message="Copying to ${child.repository.directory}..." />
<mkdir dir="${child.repository.directory}"/>
<copy todir="${child.repository.directory}" overwrite="true">
<fileset dir="${source.repository}" />
</copy>
<add.composite.repository.internal
composite.repository.location="${composite.repository.directory}"
composite.repository.name="${site.composite.name}"
composite.repository.child="${child.repository}"
/>
<add.composite.repository.internal
composite.repository.location="${main.composite.repository.directory}"
composite.repository.name="${main.site.composite.name}"
composite.repository.child="${majorMinorVersion}"
/>
</target>
<!-- = = = = = = = = = = = = = = = = =
macrodef: add.composite.repository.internal
= = = = = = = = = = = = = = = = = -->
<macrodef name="add.composite.repository.internal">
<attribute name="composite.repository.location" />
<attribute name="composite.repository.name" />
<attribute name="composite.repository.child" />
<sequential>
<echo message=" " />
<echo message="Composite repository : @{composite.repository.location}" />
<echo message="Composite name : @{composite.repository.name}" />
<echo message="Adding child repository : @{composite.repository.child}" />
<p2.composite.repository>
<repository compressed="false" location="@{composite.repository.location}" name="@{composite.repository.name}" />
<add>
<repository location="@{composite.repository.child}" />
</add>
</p2.composite.repository>
<echo file="@{composite.repository.location}/p2.index">version=1
metadata.repository.factory.order=compositeContent.xml,\!
artifact.repository.factory.order=compositeArtifacts.xml,\!
</echo>
</sequential>
</macrodef>
</project>

View File

@ -7,22 +7,23 @@
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>2.13.2</version>
<version>2.15.0</version>
<relativePath>../..</relativePath>
</parent>
<build>
<plugins>
<!-- make sure that zipped p2 repositories have the fully qualified version -->
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-repository-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<finalName>${project.artifactId}-${qualifiedVersion}</finalName>
</configuration>
</plugin>
</plugins>
</build>
<build>
<plugins>
<!-- make sure that zipped p2 repositories have the fully qualified version -->
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-repository-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<finalName>${project.artifactId}-${qualifiedVersion}</finalName>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<!-- Activate this profile to perform the release to Bintray -->
@ -33,38 +34,78 @@
<build>
<plugins>
<plugin>
<groupId>com.carrotgarden.maven</groupId>
<artifactId>bintray-maven-plugin</artifactId>
<version>1.5.20191113165555</version>
<configuration>
<skip>false</skip>
<!-- Bintray organization name. -->
<subject>minres</subject>
<!-- Bintray target repository. -->
<repository>eclipse</repository>
<!-- Bintray package name -->
<bintrayPackage>SCViewer</bintrayPackage>
<!-- Bintray package version number -->
<bintrayVersion>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}</bintrayVersion>
<!-- remove any preexisting files -->
<performDestroy>true</performDestroy>
<!-- information used when creating the package -->
<packageVcsUrl>https://git.minres.com/VP-Tools/SCViewer.git</packageVcsUrl>
<packageLicenses>EPL-1.0</packageLicenses>
<!-- Local folder content to sync to the remote repo. -->
<sourceFolder>${project.build.directory}/repository</sourceFolder>
<!-- Remote folder for local content upload, relative path. -->
<targetFolder>SCViewer/${parsedVersion.majorVersion}.${parsedVersion.minorVersion}</targetFolder>
<!-- Bintray credentials in settings.xml. -->
<serverId>bintray-minres-deploy</serverId>
</configuration>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<!-- Activate "bintray:upload" during "package" -->
<execution>
<phase>package</phase>
<goals>
<goal>upload</goal>
</goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>bash</executable>
<!-- optional -->
<workingDirectory>${software.download.area}</workingDirectory>
<arguments>
<argument>-c</argument>
<argument>if [ -d gh-pages ]; then cd gh-pages; git pull; else git clone --branch gh-pages https://git.minres.com/VP-Tools/SCViewer.git gh-pages; fi</argument>
</arguments>
<environmentVariables>
<LANG>en_US</LANG>
</environmentVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-eclipserun-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<!-- IMPORTANT: DO NOT split the arg line -->
<appArgLine>-application org.eclipse.ant.core.antRunner -buildfile packaging-p2-composite.ant p2.composite.add -Dsite.label="SCViewer Software Repository" -Dproject.build.directory=${project.build.directory} -DunqualifiedVersion=${unqualifiedVersion} -Dsoftware.download.area="${software.download.area}/gh-pages/repository"</appArgLine>
<repositories>
<repository>
<id>2020-03</id>
<layout>p2</layout>
<url>http://download.eclipse.org/releases/2020-03/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<artifactId>org.eclipse.ant.core</artifactId>
<type>eclipse-plugin</type>
</dependency>
<dependency>
<artifactId>org.apache.ant</artifactId>
<type>eclipse-plugin</type>
</dependency>
<dependency>
<artifactId>org.eclipse.equinox.p2.repository.tools</artifactId>
<type>eclipse-plugin</type>
</dependency>
<dependency>
<artifactId>org.eclipse.equinox.p2.core.feature</artifactId>
<type>eclipse-feature</type>
</dependency>
<dependency>
<artifactId>org.eclipse.equinox.p2.extras.feature</artifactId>
<type>eclipse-feature</type>
</dependency>
<dependency>
<artifactId>org.eclipse.equinox.ds</artifactId>
<type>eclipse-plugin</type>
</dependency>
</dependencies>
</configuration>
<executions>
<execution>
<id>add-p2-composite-repository</id>
<phase>package</phase>
<goals>
<goal>eclipse-run</goal>
</goals>
</execution>
</executions>
</plugin>
@ -73,4 +114,4 @@
</profile>
</profiles>
</project>
</project>

View File

@ -10,3 +10,4 @@
/hw_cfg_2_nc.vcd
/test_05.txlog
/test_05.vcd
/tgc/

View File

@ -6,7 +6,7 @@
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>2.13.2</version>
<version>2.15.0</version>
<relativePath>../..</relativePath>
</parent>
<packaging>eclipse-test-plugin</packaging>