- added second marker
- added zoom levels 1->3->10->30->... - added waveform identification icon
This commit is contained in:
parent
070c947ae6
commit
83fd7877f2
@ -93,7 +93,9 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
|
||||
|
||||
private PropertyChangeSupport pcs;
|
||||
|
||||
public static final String CURSOR_PROPERTY = "cursor time";
|
||||
public static final String CURSOR_PROPERTY = "cursor_time";
|
||||
|
||||
public static final String MARKER_PROPERTY = "marker_time";
|
||||
|
||||
private static final String SELECTION = "selection";
|
||||
|
||||
@ -117,6 +119,8 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
|
||||
|
||||
Vector<CursorPainter> cursorPainters;
|
||||
|
||||
int selectedMarker = 0;
|
||||
|
||||
private Composite trackPane;
|
||||
|
||||
private int trackVerticalHeight;
|
||||
@ -171,37 +175,8 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
|
||||
public void mouseUp(MouseEvent e) {
|
||||
if (e.button == 1) {
|
||||
if(Math.abs(e.x-start.x)<3 && Math.abs(e.y-start.y)<3){
|
||||
long time= waveformList.getTimeForOffset(e.x);
|
||||
long scaling=5*waveformList.getScaleFactor();
|
||||
for(Object o:waveformList.getClicked(start)){
|
||||
Entry<Long, ?> floorEntry=null, ceilEntry=null;
|
||||
if(o instanceof ISignal<?>){
|
||||
NavigableMap<Long, ?> map = ((ISignal<?>)o).getEvents();
|
||||
floorEntry = map.floorEntry(time);
|
||||
ceilEntry = map.ceilingEntry(time);
|
||||
} else if (o instanceof ITxStream<?>){
|
||||
NavigableMap<Long, ?> map = ((ITxStream<?>)o).getEvents();
|
||||
floorEntry = map.floorEntry(time);
|
||||
ceilEntry = map.ceilingEntry(time);
|
||||
} else if(o instanceof ITx){
|
||||
NavigableMap<Long, ?> map = ((ITx)o).getStream().getEvents();
|
||||
floorEntry = map.floorEntry(time);
|
||||
ceilEntry = map.ceilingEntry(time);
|
||||
}
|
||||
if(floorEntry!=null && time-floorEntry.getKey()>scaling)
|
||||
floorEntry=null;
|
||||
if(ceilEntry!=null && ceilEntry.getKey()-time>scaling)
|
||||
ceilEntry=null;
|
||||
if(ceilEntry==null && floorEntry!=null){
|
||||
time=floorEntry.getKey();
|
||||
}else if(ceilEntry!=null && floorEntry==null){
|
||||
time=ceilEntry.getKey();
|
||||
}else if(ceilEntry!=null && floorEntry!=null){
|
||||
time=time-floorEntry.getKey()<ceilEntry.getKey()-time?floorEntry.getKey(): ceilEntry.getKey();
|
||||
}
|
||||
}
|
||||
// first set time
|
||||
setCursorTime(time);
|
||||
setCursorTime(snapOffsetToEvent(e));
|
||||
// then set selection and reveal
|
||||
setSelection(new StructuredSelection(initialSelected));
|
||||
e.widget.getDisplay().asyncExec(new Runnable() {
|
||||
@ -212,8 +187,50 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
|
||||
}
|
||||
});
|
||||
}
|
||||
}else if (e.button == 2) {
|
||||
setMarkerTime(snapOffsetToEvent(e), selectedMarker);
|
||||
e.widget.getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
waveformList.redraw();
|
||||
updateValueList();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
protected long snapOffsetToEvent(MouseEvent e) {
|
||||
long time= waveformList.getTimeForOffset(e.x);
|
||||
long scaling=5*waveformList.getScaleFactor();
|
||||
for(Object o:waveformList.getClicked(start)){
|
||||
Entry<Long, ?> floorEntry=null, ceilEntry=null;
|
||||
if(o instanceof ISignal<?>){
|
||||
NavigableMap<Long, ?> map = ((ISignal<?>)o).getEvents();
|
||||
floorEntry = map.floorEntry(time);
|
||||
ceilEntry = map.ceilingEntry(time);
|
||||
} else if (o instanceof ITxStream<?>){
|
||||
NavigableMap<Long, ?> map = ((ITxStream<?>)o).getEvents();
|
||||
floorEntry = map.floorEntry(time);
|
||||
ceilEntry = map.ceilingEntry(time);
|
||||
} else if(o instanceof ITx){
|
||||
NavigableMap<Long, ?> map = ((ITx)o).getStream().getEvents();
|
||||
floorEntry = map.floorEntry(time);
|
||||
ceilEntry = map.ceilingEntry(time);
|
||||
}
|
||||
if(floorEntry!=null && time-floorEntry.getKey()>scaling)
|
||||
floorEntry=null;
|
||||
if(ceilEntry!=null && ceilEntry.getKey()-time>scaling)
|
||||
ceilEntry=null;
|
||||
if(ceilEntry==null && floorEntry!=null){
|
||||
time=floorEntry.getKey();
|
||||
}else if(ceilEntry!=null && floorEntry==null){
|
||||
time=ceilEntry.getKey();
|
||||
}else if(ceilEntry!=null && floorEntry!=null){
|
||||
time=time-floorEntry.getKey()<ceilEntry.getKey()-time?floorEntry.getKey(): ceilEntry.getKey();
|
||||
}
|
||||
}
|
||||
return time;
|
||||
}
|
||||
};
|
||||
|
||||
public TxDisplay(Composite parent) {
|
||||
@ -318,9 +335,12 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
|
||||
waveformList.addPainter(new TrackPainter(waveformList));
|
||||
waveformList.addPainter(new RulerPainter(
|
||||
waveformList, waveformList.getDisplay().getSystemColor(SWT.COLOR_BLACK), waveformList.getDisplay().getSystemColor(SWT.COLOR_WHITE)));
|
||||
CursorPainter cp = new CursorPainter(waveformList, waveformList.getScaleFactor() * 10);
|
||||
CursorPainter cp = new CursorPainter(waveformList, waveformList.getScaleFactor() * 10, cursorPainters.size()-1);
|
||||
waveformList.addPainter(cp);
|
||||
cursorPainters.add(cp);
|
||||
CursorPainter marker = new CursorPainter(waveformList, waveformList.getScaleFactor() * 100, cursorPainters.size()-1);
|
||||
waveformList.addPainter(marker);
|
||||
cursorPainters.add(marker);
|
||||
waveformList.setMaxTime(1);
|
||||
waveformList.addMouseListener(waveformMouseListener);
|
||||
|
||||
@ -780,6 +800,7 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
|
||||
|
||||
public void setZoomLevel(int scale) {
|
||||
waveformList.setZoomLevel(scale);
|
||||
waveformList.reveal(getCursorTime());
|
||||
}
|
||||
|
||||
public int getZoomLevel() {
|
||||
@ -792,10 +813,26 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
|
||||
pcs.firePropertyChange(CURSOR_PROPERTY, oldVal, time);
|
||||
}
|
||||
|
||||
public void setMarkerTime(long time, int index){
|
||||
if(cursorPainters.size()>index+1){
|
||||
final Long oldVal= cursorPainters.get(1+index).getTime();
|
||||
cursorPainters.get(1+index).setTime(time);
|
||||
pcs.firePropertyChange(MARKER_PROPERTY, oldVal, time);
|
||||
}
|
||||
}
|
||||
|
||||
public long getCursorTime(){
|
||||
return cursorPainters.get(0).getTime();
|
||||
}
|
||||
|
||||
public long getActMarkerTime(){
|
||||
return getMarkerTime(selectedMarker);
|
||||
}
|
||||
|
||||
public long getMarkerTime(int index){
|
||||
return cursorPainters.get(index+1).getTime();
|
||||
}
|
||||
|
||||
private void createStreamDragSource(final Canvas canvas) {
|
||||
Transfer[] types = new Transfer[] { LocalSelectionTransfer.getTransfer() };
|
||||
DragSource dragSource = new DragSource(canvas, DND.DROP_MOVE);
|
||||
@ -837,13 +874,6 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
|
||||
Object target = trackVerticalOffset.floorEntry(dropPoint.y).getValue();
|
||||
if(source instanceof IWaveform<?> && target instanceof IWaveform<?>){
|
||||
IWaveform<? extends IWaveformEvent> srcWave=(IWaveform<? extends IWaveformEvent>) source;
|
||||
// int srcIdx=streams.indexOf(source);
|
||||
// int tgtIdx=streams.indexOf(target);
|
||||
// if(srcIdx<tgtIdx){
|
||||
// streams.rotate(srcIdx, tgtIdx, -1);
|
||||
// } else {
|
||||
// streams.rotate(tgtIdx, srcIdx+1, 1);
|
||||
// }
|
||||
int srcIdx=streams.indexOf(srcWave);
|
||||
streams.remove(source);
|
||||
int tgtIdx=streams.indexOf(target);
|
||||
@ -878,8 +908,10 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
|
||||
dragSource.setTransfer(types);
|
||||
dragSource.addDragListener(new DragSourceAdapter() {
|
||||
public void dragStart(DragSourceEvent event) {
|
||||
System.out.println("dragStart");
|
||||
event.doit = false;
|
||||
for(Object o:waveformList.getClicked(new Point(event.x, event.y))){
|
||||
List<Object> clicked = waveformList.getClicked(new Point(event.x, event.y));
|
||||
for(Object o:clicked){
|
||||
if(o instanceof CursorPainter){
|
||||
LocalSelectionTransfer.getTransfer().setSelection(new StructuredSelection(o));
|
||||
((CursorPainter)o).setDragging(true);
|
||||
@ -907,8 +939,9 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
|
||||
ISelection sel = LocalSelectionTransfer.getTransfer().getSelection();
|
||||
if(sel!=null && sel instanceof IStructuredSelection &&
|
||||
((IStructuredSelection)sel).getFirstElement() instanceof CursorPainter){
|
||||
((CursorPainter)((IStructuredSelection)sel).getFirstElement()).setDragging(false);
|
||||
updateWaveform(canvas, event);
|
||||
CursorPainter painter = (CursorPainter)((IStructuredSelection)sel).getFirstElement();
|
||||
painter.setDragging(false);
|
||||
updateWaveform(canvas, event, painter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -924,13 +957,21 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
|
||||
ISelection sel = LocalSelectionTransfer.getTransfer().getSelection();
|
||||
if(sel!=null && sel instanceof IStructuredSelection &&
|
||||
((IStructuredSelection)sel).getFirstElement() instanceof CursorPainter){
|
||||
updateWaveform(canvas, event);
|
||||
updateWaveform(canvas, event, (CursorPainter) ((IStructuredSelection)sel).getFirstElement());
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateWaveform(final Canvas canvas, DropTargetEvent event) {
|
||||
protected void updateWaveform(final Canvas canvas, DropTargetEvent event, CursorPainter painter) {
|
||||
Point dropPoint = canvas.toControl(event.x, event.y);
|
||||
setCursorTime(waveformList.getTimeForOffset(dropPoint.x));
|
||||
long time = waveformList.getTimeForOffset(dropPoint.x);
|
||||
final Long oldVal= painter.getTime();
|
||||
painter.setTime(time);
|
||||
if(painter.id<0){
|
||||
pcs.firePropertyChange(CURSOR_PROPERTY, oldVal, time);
|
||||
}else{
|
||||
pcs.firePropertyChange(MARKER_PROPERTY, oldVal, time);
|
||||
pcs.firePropertyChange(MARKER_PROPERTY+painter.id, oldVal, time);
|
||||
}
|
||||
canvas.getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -973,9 +1014,20 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
|
||||
return this.pcs.hasListeners(propertyName);
|
||||
}
|
||||
|
||||
public String getScaledTime(Long time) {
|
||||
public String getScaledTime(long time) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
return sb.append(time/waveformList.getScaleFactor()).append(waveformList.getUnitStr()).toString();
|
||||
Double dTime=new Double(time);
|
||||
return sb.append(dTime/waveformList.getScaleFactorPow10()).append(waveformList.getUnitStr()).toString();
|
||||
}
|
||||
|
||||
public String[] getZoomLevels(){
|
||||
String[] res = new String[WaveformCanvas.unitMultiplier.length*WaveformCanvas.unitString.length];
|
||||
int index=0;
|
||||
for(String unit:WaveformCanvas.unitString){
|
||||
for(int factor:WaveformCanvas.unitMultiplier){
|
||||
res[index++]= new Integer(factor).toString()+unit;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
@ -10,27 +10,31 @@
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.swt.internal;
|
||||
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.GC;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
|
||||
public class CursorPainter implements IPainter {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private final WaveformCanvas waveCanvas;
|
||||
|
||||
private long time;
|
||||
|
||||
private boolean isDragging;
|
||||
private boolean drawTime;
|
||||
|
||||
public final int id;
|
||||
|
||||
/**
|
||||
* @param i
|
||||
* @param txDisplay
|
||||
*/
|
||||
public CursorPainter(WaveformCanvas txDisplay, long time) {
|
||||
public CursorPainter(WaveformCanvas txDisplay, long time, int id) {
|
||||
this.waveCanvas = txDisplay;
|
||||
this.time=time;
|
||||
drawTime=true;
|
||||
this.id=id;
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
@ -42,29 +46,30 @@ public class CursorPainter implements IPainter {
|
||||
}
|
||||
|
||||
public boolean isDragging() {
|
||||
return isDragging;
|
||||
}
|
||||
|
||||
public void setDragging(boolean isDragging) {
|
||||
this.isDragging = isDragging;
|
||||
}
|
||||
|
||||
public void paintArea(GC gc, Rectangle area) {
|
||||
if(this.waveCanvas.streams.size()>0){
|
||||
long scaleFactor=waveCanvas.getScaleFactor();
|
||||
int x = (int) (time/scaleFactor);
|
||||
if(x>=area.x && x<=(area.x+area.width)){
|
||||
gc.setForeground(
|
||||
waveCanvas.colors[isDragging?
|
||||
WaveformCanvas.Colors.CURSOR_DRAG.ordinal():
|
||||
WaveformCanvas.Colors.CURSOR.ordinal()]);
|
||||
gc.drawLine(x, area.y, x, area.y+area.height);
|
||||
if(drawTime){
|
||||
gc.setBackground(waveCanvas.colors[WaveformCanvas.Colors.CURSOR.ordinal()]);
|
||||
gc.setForeground(waveCanvas.colors[WaveformCanvas.Colors.CURSOR_TEXT.ordinal()]);
|
||||
gc.drawText(Double.toString(x*waveCanvas.getUnitMultiplier())+waveCanvas.getUnitStr(), x+1, area.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
return isDragging;
|
||||
}
|
||||
|
||||
public void setDragging(boolean isDragging) {
|
||||
this.isDragging = isDragging;
|
||||
}
|
||||
|
||||
public void paintArea(GC gc, Rectangle area) {
|
||||
if(this.waveCanvas.streams.size()>0){
|
||||
long scaleFactor=waveCanvas.getScaleFactor();
|
||||
int x = (int) (time/scaleFactor);
|
||||
int top = id<0?area.y:area.y+15;
|
||||
Color drawColor=waveCanvas.colors[id<0?WaveformCanvas.Colors.CURSOR.ordinal():WaveformCanvas.Colors.MARKER.ordinal()];
|
||||
Color dragColor = waveCanvas.colors[WaveformCanvas.Colors.CURSOR_DRAG.ordinal()];
|
||||
Color textColor=waveCanvas.colors[id<0?WaveformCanvas.Colors.CURSOR_TEXT.ordinal():WaveformCanvas.Colors.MARKER_TEXT.ordinal()];
|
||||
if(x>=area.x && x<=(area.x+area.width)){
|
||||
gc.setForeground(isDragging?dragColor:drawColor);
|
||||
gc.drawLine(x, top, x, area.y+area.height);
|
||||
gc.setBackground(drawColor);
|
||||
gc.setForeground(textColor);
|
||||
Double dTime=new Double(time);
|
||||
gc.drawText((dTime/waveCanvas.getScaleFactorPow10())+waveCanvas.getUnitStr(), x+1, top);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -35,11 +35,16 @@ public class RulerPainter implements IPainter {
|
||||
String unit=waveCanvas.getUnitStr();
|
||||
int unitMultiplier=waveCanvas.getUnitMultiplier();
|
||||
long scaleFactor=waveCanvas.getScaleFactor();
|
||||
long zoomLevel = waveCanvas.getZoomLevel();
|
||||
long start=area.x*scaleFactor;
|
||||
long end=start+area.width*scaleFactor;
|
||||
|
||||
long rulerTickMinor = rulerTickMinorC*scaleFactor;
|
||||
long rulerTickMajor = rulerTickMajorC*scaleFactor;
|
||||
if(zoomLevel%3==1){
|
||||
rulerTickMinor/=3;
|
||||
rulerTickMajor/=3;
|
||||
}
|
||||
int minorTickY = waveCanvas.rulerHeight-5;
|
||||
int majorTickY = waveCanvas.rulerHeight-15;
|
||||
int textY=waveCanvas.rulerHeight-20;
|
||||
|
@ -47,17 +47,18 @@ public class WaveformCanvas extends Canvas {
|
||||
TRACK_BG_EVEN, TRACK_BG_ODD, TRACK_BG_HIGHLITE,
|
||||
TX_BG, TX_BG_HIGHLITE, TX_BORDER,
|
||||
SIGNAL0, SIGNAL1, SIGNALZ, SIGNALX, SIGNAL_TEXT,
|
||||
CURSOR, CURSOR_DRAG, CURSOR_TEXT
|
||||
CURSOR, CURSOR_DRAG, CURSOR_TEXT,
|
||||
MARKER, MARKER_TEXT
|
||||
}
|
||||
|
||||
Color[] colors = new Color[Colors.values().length];
|
||||
|
||||
private int trackHeight = 50;
|
||||
private long scaleFactor = 1000000L;
|
||||
private long scaleFactor = 1000000L; // 1ns
|
||||
String unit="ns";
|
||||
private int level = 6;
|
||||
private final static String[] unitString={"fs", "ps", "ns", "µs", "ms", "s"};
|
||||
private final static int[] unitMultiplier={1, 10, 100};
|
||||
private int level = 12;
|
||||
public final static String[] unitString={"fs", "ps", "ns", "µs", "ms"};//, "s"};
|
||||
public final static int[] unitMultiplier={1, 3, 10, 30, 100, 300};
|
||||
private long maxTime;
|
||||
protected Point origin; /* original size */
|
||||
protected Transform transform;
|
||||
@ -127,6 +128,8 @@ public class WaveformCanvas extends Canvas {
|
||||
colors[Colors.CURSOR.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||
colors[Colors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
|
||||
colors[Colors.CURSOR_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||
colors[Colors.MARKER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY);
|
||||
colors[Colors.MARKER_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -180,23 +183,36 @@ public class WaveformCanvas extends Canvas {
|
||||
public int getZoomLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public int getMaxZoomLevel(){
|
||||
return unitMultiplier.length*unitString.length-1;
|
||||
}
|
||||
|
||||
public void setZoomLevel(int level) {
|
||||
this.level = level;
|
||||
this.scaleFactor = (long) Math.pow(10, level);
|
||||
syncScrollBars();
|
||||
if(level<unitMultiplier.length*unitString.length){
|
||||
this.level = level;
|
||||
this.scaleFactor = (long) Math.pow(10, level/2);
|
||||
if(level%2==1) this.scaleFactor*=3;
|
||||
syncScrollBars();
|
||||
}
|
||||
}
|
||||
|
||||
public long getScaleFactor() {
|
||||
return scaleFactor;
|
||||
}
|
||||
|
||||
public String getUnitStr(){
|
||||
return unitString[level/3];
|
||||
public long getScaleFactorPow10() {
|
||||
int scale = level/unitMultiplier.length;
|
||||
double res = Math.pow(1000, scale);
|
||||
return (long) res;
|
||||
}
|
||||
|
||||
|
||||
public String getUnitStr(){
|
||||
return unitString[level/unitMultiplier.length];
|
||||
}
|
||||
|
||||
public int getUnitMultiplier(){
|
||||
return unitMultiplier[level%3];
|
||||
return unitMultiplier[level%unitMultiplier.length];
|
||||
}
|
||||
|
||||
public long getTimeForOffset(int xOffset){
|
||||
|
@ -166,30 +166,22 @@
|
||||
</menus>
|
||||
<menus xsi:type="menu:PopupMenu" xmi:id="_CxJvAHXGEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.popupmenu.wavecontext" label="Wave Menu">
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_7HrlwHXREeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.moveup" label="Move up" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/up_blue.png" command="_N_sOkHXHEeWwZ-9vrAR2UQ">
|
||||
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_orHK4HsCEeWVM_sKoXvptg" coreExpressionId="com.minres.scviewer.e4.application.oneWaveSeleted"/>
|
||||
<parameters xmi:id="_snsmsHaYEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.2" name="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir" value="up"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_8MkxQHXREeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.movedown" label="Move down" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/down_blue.png" command="_N_sOkHXHEeWwZ-9vrAR2UQ">
|
||||
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_sSb24HsCEeWVM_sKoXvptg" coreExpressionId="com.minres.scviewer.e4.application.oneWaveSeleted"/>
|
||||
<parameters xmi:id="_uZBaYHaYEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.3" name="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir" value="down"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_7Hz3sHXIEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.remove" label="Remove" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/cross.png" command="_WUZ2wHXHEeWwZ-9vrAR2UQ">
|
||||
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_uusd8HsCEeWVM_sKoXvptg" coreExpressionId="com.minres.scviewer.e4.application.oneWaveSeleted"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_7Hz3sHXIEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.remove" label="Remove" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/cross.png" command="_WUZ2wHXHEeWwZ-9vrAR2UQ"/>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_h4B6YHcZEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.nextevent" label="Next event" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/play_blue.png" command="_79rx4HabEeWwZ-9vrAR2UQ">
|
||||
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_mDkrcHsDEeWVM_sKoXvptg" coreExpressionId="com.minres.scviewer.e4.application.oneWaveSeleted"/>
|
||||
<parameters xmi:id="_rKkcwHcZEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.6" name="com.minres.scviewer.e4.application.command.navigateEventCommand.parameter.dir" value="next"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_kU1UAHcZEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.previousevent" label="Previous event" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/reverse_blue.png" command="_79rx4HabEeWwZ-9vrAR2UQ">
|
||||
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_mdnjIHsDEeWVM_sKoXvptg" coreExpressionId="com.minres.scviewer.e4.application.oneWaveSeleted"/>
|
||||
<parameters xmi:id="_tJOh0HcZEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.7" name="com.minres.scviewer.e4.application.command.navigateEventCommand.parameter.dir" value="prev"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_33qXsHabEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.nextchange" label="Next Tx" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/play_green.png" command="_Gn3lEHXKEeWwZ-9vrAR2UQ">
|
||||
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_m2RTsHsDEeWVM_sKoXvptg" coreExpressionId="com.minres.scviewer.e4.application.oneTxSeleted"/>
|
||||
<parameters xmi:id="_33qXsXabEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.4" name="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir" value="next"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_4ZeEQHabEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.previouschange" label="Previous Tx" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/reverse_green.png" command="_Gn3lEHXKEeWwZ-9vrAR2UQ">
|
||||
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_nReB8HsDEeWVM_sKoXvptg" coreExpressionId="com.minres.scviewer.e4.application.oneTxSeleted"/>
|
||||
<parameters xmi:id="_4ZeEQXabEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.5" name="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir" value="prev"/>
|
||||
</children>
|
||||
</menus>
|
||||
|
@ -6,5 +6,6 @@ bin.includes = META-INF/,\
|
||||
Application.e4xmi,\
|
||||
icons/,\
|
||||
css/default.css,\
|
||||
OSGI-INF/l10n/bundle.properties
|
||||
OSGI-INF/l10n/bundle.properties,\
|
||||
OSGI-INF/
|
||||
source.. = src/
|
||||
|
BIN
com.minres.scviewer.e4.application/icons/wave.png
Normal file
BIN
com.minres.scviewer.e4.application/icons/wave.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
@ -35,8 +35,6 @@ import org.osgi.service.prefs.PreferencesService;
|
||||
public class StatusBarControl {
|
||||
|
||||
public static final String STATUS_UPDATE="StatusUpdate";
|
||||
public static final String ZOOM_LEVEL="ZoomLevelUpdate";
|
||||
public static final String CURSOR_TIME="CursorPosUpdate";
|
||||
|
||||
@Inject EModelService modelService;
|
||||
|
||||
|
@ -29,9 +29,10 @@ import org.eclipse.swt.widgets.Composite;
|
||||
|
||||
public class WaveStatusBarControl extends StatusBarControl {
|
||||
|
||||
public static final String STATUS_UPDATE="StatusUpdate";
|
||||
public static final String ZOOM_LEVEL="ZoomLevelUpdate";
|
||||
public static final String CURSOR_TIME="CursorPosUpdate";
|
||||
public static final String MARKER_TIME="MarkerPosUpdate";
|
||||
public static final String MARKER_DIFF="MarlerDiffUpdate";
|
||||
|
||||
@Inject
|
||||
EModelService modelService;
|
||||
@ -74,14 +75,18 @@ public class WaveStatusBarControl extends StatusBarControl {
|
||||
|
||||
}
|
||||
|
||||
TextContributionItem zoomContribution, cursorContribution;
|
||||
TextContributionItem cursorContribution, markerContribution, markerDiffContribution, zoomContribution;
|
||||
|
||||
@Inject
|
||||
public WaveStatusBarControl(UISynchronize sync) {
|
||||
super(sync);
|
||||
zoomContribution = new TextContributionItem("Z:", 150);
|
||||
cursorContribution = new TextContributionItem("C:", 120);
|
||||
manager.prependToGroup(StatusLineManager.BEGIN_GROUP,cursorContribution);
|
||||
cursorContribution = new TextContributionItem("C:", 80);
|
||||
markerContribution = new TextContributionItem("M:", 80);
|
||||
markerDiffContribution = new TextContributionItem("C-M:", 80);
|
||||
zoomContribution = new TextContributionItem("Z:", 80);
|
||||
manager.appendToGroup(StatusLineManager.BEGIN_GROUP,cursorContribution);
|
||||
manager.appendToGroup(StatusLineManager.BEGIN_GROUP,markerContribution);
|
||||
manager.appendToGroup(StatusLineManager.BEGIN_GROUP,markerDiffContribution);
|
||||
manager.appendToGroup(StatusLineManager.BEGIN_GROUP, zoomContribution);
|
||||
}
|
||||
|
||||
@ -112,4 +117,14 @@ public class WaveStatusBarControl extends StatusBarControl {
|
||||
cursorContribution.setText(text);
|
||||
}
|
||||
|
||||
@Inject @Optional
|
||||
public void getMarkerEvent(@UIEventTopic(MARKER_TIME) String text) {
|
||||
markerContribution.setText(text);
|
||||
}
|
||||
|
||||
@Inject @Optional
|
||||
public void getDiffEvent(@UIEventTopic(MARKER_DIFF) String text) {
|
||||
markerDiffContribution.setText(text);
|
||||
}
|
||||
|
||||
}
|
@ -41,17 +41,17 @@ public class DesignBrowser implements ISelectionChangedListener {
|
||||
|
||||
@Inject ESelectionService selectionService;
|
||||
|
||||
private TreeViewer contentOutlineViewer;
|
||||
private TreeViewer treeViewer;
|
||||
|
||||
|
||||
private PropertyChangeListener l = new PropertyChangeListener() {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
if("CHILDS".equals(evt.getPropertyName())){
|
||||
contentOutlineViewer.getTree().getDisplay().asyncExec(new Runnable() {
|
||||
treeViewer.getTree().getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
contentOutlineViewer.refresh();
|
||||
treeViewer.refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -62,18 +62,19 @@ public class DesignBrowser implements ISelectionChangedListener {
|
||||
@PostConstruct
|
||||
public void createComposite(Composite parent) {
|
||||
parent.setLayout(new GridLayout(1, false));
|
||||
contentOutlineViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
|
||||
contentOutlineViewer.addSelectionChangedListener(this);
|
||||
contentOutlineViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
contentOutlineViewer.setContentProvider(new TxDbContentProvider());
|
||||
contentOutlineViewer.setLabelProvider(new TxDbLabelProvider());
|
||||
contentOutlineViewer.setUseHashlookup(true);
|
||||
treeViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
|
||||
treeViewer.addSelectionChangedListener(this);
|
||||
treeViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
treeViewer.setContentProvider(new TxDbContentProvider());
|
||||
treeViewer.setLabelProvider(new TxDbLabelProvider());
|
||||
treeViewer.setUseHashlookup(true);
|
||||
treeViewer.setAutoExpandLevel(2);
|
||||
}
|
||||
|
||||
@Focus
|
||||
public void setFocus() {
|
||||
contentOutlineViewer.getTree().setFocus();
|
||||
selectionService.setSelection(contentOutlineViewer.getSelection());
|
||||
treeViewer.getTree().setFocus();
|
||||
selectionService.setSelection(treeViewer.getSelection());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -85,10 +86,10 @@ public class DesignBrowser implements ISelectionChangedListener {
|
||||
@Inject @Optional
|
||||
public void getStatusEvent(@UIEventTopic(WaveformViewerPart.ACTIVE_WAVEFORMVIEW) WaveformViewerPart waveformViewerPart) {
|
||||
IWaveformDb database = waveformViewerPart.getDatabase();
|
||||
Object input = contentOutlineViewer.getInput();
|
||||
Object input = treeViewer.getInput();
|
||||
if(input!=null && input instanceof List<?>)
|
||||
((List<IWaveformDb>)input).get(0).removePropertyChangeListener(l);
|
||||
contentOutlineViewer.setInput(database.isLoaded()?Arrays.asList(new IWaveformDb[]{database}):null);
|
||||
treeViewer.setInput(database.isLoaded()?Arrays.asList(new IWaveformDb[]{database}):null);
|
||||
// Set up the tree viewer
|
||||
database.addPropertyChangeListener(l);
|
||||
}
|
||||
|
@ -378,7 +378,7 @@ public class TransactionDetails {
|
||||
res.add(new Object[]{
|
||||
rel.getRelationType(),
|
||||
rel.getSource().getGenerator().getName(),
|
||||
txToString(rel.getSource())});
|
||||
rel.getSource()});
|
||||
}
|
||||
return res.toArray();
|
||||
} else if(propertyHolder.type == Type.OUT_REL){
|
||||
@ -387,7 +387,7 @@ public class TransactionDetails {
|
||||
res.add(new Object[]{
|
||||
rel.getRelationType(),
|
||||
rel.getTarget().getGenerator().getName(),
|
||||
txToString(rel.getTarget())});
|
||||
rel.getTarget()});
|
||||
}
|
||||
return res.toArray();
|
||||
}
|
||||
@ -447,6 +447,8 @@ public class TransactionDetails {
|
||||
}else if(element instanceof Object[]){
|
||||
Object[] elements = (Object[]) element;
|
||||
return new StyledString(elements[field].toString());
|
||||
} else if(element instanceof ITx){
|
||||
return new StyledString(txToString((ITx) element));
|
||||
}else
|
||||
return new StyledString("");
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ import com.minres.scviewer.database.IWaveformDbFactory;
|
||||
import com.minres.scviewer.database.IWaveformEvent;
|
||||
import com.minres.scviewer.database.swt.GotoDirection;
|
||||
import com.minres.scviewer.database.swt.TxDisplay;
|
||||
import com.minres.scviewer.e4.application.internal.StatusBarControl;
|
||||
import com.minres.scviewer.e4.application.internal.WaveStatusBarControl;
|
||||
|
||||
public class WaveformViewerPart {
|
||||
|
||||
@ -64,12 +64,7 @@ public class WaveformViewerPart {
|
||||
protected static final String DATABASE_FILE = "DATABASE_FILE";
|
||||
protected static final String SHOWN_WAVEFORM = "SHOWN_WAVEFORM";
|
||||
|
||||
private final static String[] zoomLevel={
|
||||
"1fs", "10fs", "100fs",
|
||||
"1ps", "10ps", "100ps",
|
||||
"1ns", "10ns", "100ns",
|
||||
"1µs", "10µs", "10µs",
|
||||
"1ms", "10ms", "100ms", "1s"};
|
||||
private String[] zoomLevel;
|
||||
|
||||
public static final String ID = "com.minres.scviewer.ui.TxEditorPart"; //$NON-NLS-1$
|
||||
|
||||
@ -115,10 +110,21 @@ public class WaveformViewerPart {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
Long time = (Long) evt.getNewValue();
|
||||
eventBroker.post(StatusBarControl.CURSOR_TIME, ""+ time/1000000+"ns");
|
||||
eventBroker.post(WaveStatusBarControl.CURSOR_TIME, txDisplay.getScaledTime(time));
|
||||
long marker=txDisplay.getActMarkerTime();
|
||||
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, txDisplay.getScaledTime(time-marker));
|
||||
|
||||
}
|
||||
});
|
||||
txDisplay.addPropertyChangeListener(TxDisplay.MARKER_PROPERTY, new PropertyChangeListener() {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
Long time = (Long) evt.getNewValue();
|
||||
eventBroker.post(WaveStatusBarControl.MARKER_TIME, txDisplay.getScaledTime(time));
|
||||
long cursor=txDisplay.getCursorTime();
|
||||
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, txDisplay.getScaledTime(cursor-time));
|
||||
}
|
||||
});
|
||||
txDisplay.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
@ -126,6 +132,7 @@ public class WaveformViewerPart {
|
||||
selectionService.setSelection(event.getSelection());
|
||||
}
|
||||
});
|
||||
zoomLevel=txDisplay.getZoomLevels();
|
||||
filesToLoad=new ArrayList<File>();
|
||||
persistedState = part.getPersistedState();
|
||||
Integer files = persistedState.containsKey(DATABASE_FILE+"S")?Integer.parseInt(persistedState.get(DATABASE_FILE+"S")):0;
|
||||
@ -134,7 +141,7 @@ public class WaveformViewerPart {
|
||||
}
|
||||
if(filesToLoad.size()>0)
|
||||
loadDatabase();
|
||||
eventBroker.post(StatusBarControl.ZOOM_LEVEL, zoomLevel[txDisplay.getZoomLevel()]);
|
||||
eventBroker.post(WaveStatusBarControl.ZOOM_LEVEL, zoomLevel[txDisplay.getZoomLevel()]);
|
||||
menuService.registerContextMenu(txDisplay.getNameControl(), "com.minres.scviewer.e4.application.popupmenu.namecontext");
|
||||
menuService.registerContextMenu(txDisplay.getValueControl(), "com.minres.scviewer.e4.application.popupmenu.namecontext");
|
||||
menuService.registerContextMenu(txDisplay.getWaveformControl(), "com.minres.scviewer.e4.application.popupmenu.wavecontext");
|
||||
@ -248,8 +255,12 @@ public class WaveformViewerPart {
|
||||
|
||||
private void updateAll() {
|
||||
eventBroker.post(ACTIVE_WAVEFORMVIEW, this);
|
||||
eventBroker.post(StatusBarControl.ZOOM_LEVEL, zoomLevel[txDisplay.getZoomLevel()]);
|
||||
eventBroker.post(StatusBarControl.CURSOR_TIME, Long.toString(txDisplay.getCursorTime()/1000000)+"ns");
|
||||
eventBroker.post(WaveStatusBarControl.ZOOM_LEVEL, zoomLevel[txDisplay.getZoomLevel()]);
|
||||
long cursor=txDisplay.getCursorTime();
|
||||
long marker=txDisplay.getActMarkerTime();
|
||||
eventBroker.post(WaveStatusBarControl.CURSOR_TIME, txDisplay.getScaledTime(cursor));
|
||||
eventBroker.post(WaveStatusBarControl.MARKER_TIME, txDisplay.getScaledTime(marker));
|
||||
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, txDisplay.getScaledTime(cursor-marker));
|
||||
}
|
||||
|
||||
@Inject @Optional
|
||||
@ -356,13 +367,11 @@ public class WaveformViewerPart {
|
||||
if(level<0) level=0;
|
||||
if(level>zoomLevel.length-1) level=zoomLevel.length-1;
|
||||
txDisplay.setZoomLevel(level);
|
||||
eventBroker.post(StatusBarControl.ZOOM_LEVEL, zoomLevel[txDisplay.getZoomLevel()]);
|
||||
}
|
||||
updateAll(); }
|
||||
|
||||
public void setZoomFit() {
|
||||
txDisplay.setZoomLevel(6);
|
||||
eventBroker.post(StatusBarControl.ZOOM_LEVEL, zoomLevel[txDisplay.getZoomLevel()]);
|
||||
}
|
||||
updateAll(); }
|
||||
|
||||
public int getZoomLevel() {
|
||||
return txDisplay.getZoomLevel();
|
||||
|
@ -20,6 +20,7 @@ import org.eclipse.wb.swt.ResourceManager;
|
||||
|
||||
import com.minres.scviewer.database.IHierNode;
|
||||
import com.minres.scviewer.database.ISignal;
|
||||
import com.minres.scviewer.database.ISignalChangeMulti;
|
||||
import com.minres.scviewer.database.ITxStream;
|
||||
import com.minres.scviewer.database.IWaveformDb;
|
||||
|
||||
@ -27,10 +28,7 @@ public class TxDbLabelProvider implements ILabelProvider {
|
||||
|
||||
private List<ILabelProviderListener> listeners = new ArrayList<ILabelProviderListener>();
|
||||
|
||||
private Image database;
|
||||
private Image stream;
|
||||
private Image signal;
|
||||
private Image folder;
|
||||
private Image database, stream, signal, folder, wave;
|
||||
|
||||
|
||||
public TxDbLabelProvider() {
|
||||
@ -39,6 +37,7 @@ public class TxDbLabelProvider implements ILabelProvider {
|
||||
stream=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/stream.png");
|
||||
folder=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/folder.png");
|
||||
signal=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/signal.png");
|
||||
wave=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/wave.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -52,6 +51,7 @@ public class TxDbLabelProvider implements ILabelProvider {
|
||||
if(stream!=null) stream.dispose();
|
||||
if(folder!=null) folder.dispose();
|
||||
if(signal!=null) signal.dispose();
|
||||
if(wave!=null) wave.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -71,7 +71,11 @@ public class TxDbLabelProvider implements ILabelProvider {
|
||||
}else if(element instanceof ITxStream){
|
||||
return stream;
|
||||
}else if(element instanceof ISignal<?>){
|
||||
return signal;
|
||||
Object o = ((ISignal<?>)element).getEvents().firstEntry().getValue();
|
||||
if(o instanceof ISignalChangeMulti)
|
||||
return wave;
|
||||
else
|
||||
return signal;
|
||||
}else if(element instanceof IHierNode){
|
||||
return folder;
|
||||
} else
|
||||
|
Binary file not shown.
@ -15,13 +15,11 @@
|
||||
|
||||
<windowImages i16="/com.minres.scviewer.e4.application/icons/SCViewer_16x32.png" i32="/com.minres.scviewer.e4.application/icons/SCViewer_32x32.png" i48="/com.minres.scviewer.e4.application/icons/SCViewer_48x32.png" i64="/com.minres.scviewer.e4.application/icons/SCViewer_64x32.png" i128="/com.minres.scviewer.e4.application/icons/SCViewer_128x32.png" i256="/com.minres.scviewer.e4.application/icons/SCViewer_256x32.png"/>
|
||||
|
||||
|
||||
<launcher name="scviewer">
|
||||
<linux icon="icons/SCViewer_512x512.xpm"/>
|
||||
<macosx icon="icons/SCViewer.icns"/>
|
||||
<solaris/>
|
||||
<win useIco="false">
|
||||
<ico path="icons/SCViewer.ico"/>
|
||||
<bmp
|
||||
winSmallHigh="icons/SCViewer_16x16@32.bmp"
|
||||
winSmallLow="icons/SCViewer_16x16@8.bmp"
|
||||
|
Loading…
Reference in New Issue
Block a user