Merge branch 'feature/Extend-waveform-configurability' into develop
This commit is contained in:
commit
048fa93b53
|
@ -1622,7 +1622,7 @@ b1110100011010100101001010 aabdd
|
||||||
0aabdv
|
0aabdv
|
||||||
0aabdw
|
0aabdw
|
||||||
0aabdx
|
0aabdx
|
||||||
r1.0 bbbbb
|
r0.0 bbbbb
|
||||||
$end
|
$end
|
||||||
|
|
||||||
#10000
|
#10000
|
||||||
|
@ -1640,6 +1640,28 @@ $end
|
||||||
0aabcq
|
0aabcq
|
||||||
0aabcy
|
0aabcy
|
||||||
0aabde
|
0aabde
|
||||||
|
r1.0 bbbbb
|
||||||
|
|
||||||
|
#20000
|
||||||
|
r2.0 bbbbb
|
||||||
|
|
||||||
|
#30000
|
||||||
|
r2.5 bbbbb
|
||||||
|
|
||||||
|
#40000
|
||||||
|
r1.5 bbbbb
|
||||||
|
|
||||||
|
#50000
|
||||||
|
r-1.0 bbbbb
|
||||||
|
|
||||||
|
#60000
|
||||||
|
r-2.5 bbbbb
|
||||||
|
|
||||||
|
#70000
|
||||||
|
r-1.0 bbbbb
|
||||||
|
|
||||||
|
#80000
|
||||||
|
r0.0 bbbbb
|
||||||
|
|
||||||
#1287121272
|
#1287121272
|
||||||
b1000000000100000000000000000100 aabcr
|
b1000000000100000000000000000100 aabcr
|
||||||
|
|
|
@ -67,7 +67,6 @@ public class SignalPainter extends TrackPainter {
|
||||||
private static final JPanel DUMMY_PANEL = new JPanel();
|
private static final JPanel DUMMY_PANEL = new JPanel();
|
||||||
|
|
||||||
private final WaveformCanvas waveCanvas;
|
private final WaveformCanvas waveCanvas;
|
||||||
private ISignal<? extends ISignalChange> signal;
|
|
||||||
|
|
||||||
int yOffsetT;
|
int yOffsetT;
|
||||||
int yOffsetM;
|
int yOffsetM;
|
||||||
|
@ -77,7 +76,6 @@ public class SignalPainter extends TrackPainter {
|
||||||
public SignalPainter(WaveformCanvas txDisplay, boolean even, TrackEntry trackEntry) {
|
public SignalPainter(WaveformCanvas txDisplay, boolean even, TrackEntry trackEntry) {
|
||||||
super(trackEntry, even);
|
super(trackEntry, even);
|
||||||
this.waveCanvas = txDisplay;
|
this.waveCanvas = txDisplay;
|
||||||
this.signal = trackEntry.getSignal();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getXEnd(long time) {
|
private int getXEnd(long time) {
|
||||||
|
@ -86,6 +84,7 @@ public class SignalPainter extends TrackPainter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void paintArea(GC gc, Rectangle area) {
|
public void paintArea(GC gc, Rectangle area) {
|
||||||
|
ISignal<? extends ISignalChange> signal = trackEntry.getSignal();
|
||||||
if (trackEntry.selected)
|
if (trackEntry.selected)
|
||||||
gc.setBackground(this.waveCanvas.colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()]);
|
gc.setBackground(this.waveCanvas.colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()]);
|
||||||
else
|
else
|
||||||
|
@ -156,9 +155,14 @@ public class SignalPainter extends TrackPainter {
|
||||||
if(left.value instanceof ISignalChangeBit)
|
if(left.value instanceof ISignalChangeBit)
|
||||||
return new SingleBitStencil();
|
return new SingleBitStencil();
|
||||||
else if (left.value instanceof ISignalChangeBitVector)
|
else if (left.value instanceof ISignalChangeBitVector)
|
||||||
|
if(trackEntry.waveDisplay==TrackEntry.WaveDisplay.DEFAULT)
|
||||||
return new MultiBitStencil(gc);
|
return new MultiBitStencil(gc);
|
||||||
|
else
|
||||||
|
return new MultiBitStencilAnalog(entries, left.value,
|
||||||
|
trackEntry.waveDisplay==TrackEntry.WaveDisplay.CONTINOUS,
|
||||||
|
trackEntry.valueDisplay==TrackEntry.ValueDisplay.SIGNED);
|
||||||
else if (left.value instanceof ISignalChangeReal)
|
else if (left.value instanceof ISignalChangeReal)
|
||||||
return new RealStencil(entries, left.value);
|
return new RealStencil(entries, left.value, trackEntry.waveDisplay==TrackEntry.WaveDisplay.CONTINOUS);
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -200,7 +204,18 @@ public class SignalPainter extends TrackPainter {
|
||||||
gc.setForeground(colorBorder);
|
gc.setForeground(colorBorder);
|
||||||
gc.drawPolygon(points);
|
gc.drawPolygon(points);
|
||||||
gc.setForeground(waveCanvas.colors[WaveformColors.SIGNAL_TEXT.ordinal()]);
|
gc.setForeground(waveCanvas.colors[WaveformColors.SIGNAL_TEXT.ordinal()]);
|
||||||
String label = "h'" + last.getValue().toHexString();
|
//TODO: this code should be provided from a central location
|
||||||
|
String label = null;
|
||||||
|
switch(trackEntry.valueDisplay) {
|
||||||
|
case SIGNED:
|
||||||
|
label=Long.toString(last.getValue().toSignedValue());
|
||||||
|
break;
|
||||||
|
case UNSIGNED:
|
||||||
|
label=Long.toString(last.getValue().toUnsignedValue());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
label="h'"+last.getValue().toHexString();
|
||||||
|
}
|
||||||
Point bb = getBoxWidth(gc, label);
|
Point bb = getBoxWidth(gc, label);
|
||||||
if (xBegin < area.x) {
|
if (xBegin < area.x) {
|
||||||
xBegin = area.x;
|
xBegin = area.x;
|
||||||
|
@ -224,6 +239,62 @@ public class SignalPainter extends TrackPainter {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class MultiBitStencilAnalog implements SignalStencil {
|
||||||
|
|
||||||
|
final boolean continous;
|
||||||
|
final boolean signed;
|
||||||
|
private long minVal;
|
||||||
|
private long range;
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public MultiBitStencilAnalog(NavigableMap<Long, ? extends ISignalChange> entries, ISignalChange left, boolean continous, boolean signed) {
|
||||||
|
this.continous=continous;
|
||||||
|
this.signed=signed;
|
||||||
|
Collection<ISignalChangeBitVector> values = ((NavigableMap<Long, ISignalChangeBitVector>) entries).values();
|
||||||
|
minVal=((ISignalChangeBitVector) left).getValue().toUnsignedValue();
|
||||||
|
range=2;
|
||||||
|
if(!values.isEmpty()) {
|
||||||
|
long maxVal=minVal;
|
||||||
|
for (ISignalChange e : entries.values()) {
|
||||||
|
long v = ((ISignalChangeBitVector)e).getValue().toUnsignedValue();
|
||||||
|
maxVal=Math.max(maxVal, v);
|
||||||
|
minVal=Math.min(minVal, v);
|
||||||
|
}
|
||||||
|
if(maxVal==minVal) {
|
||||||
|
maxVal--;
|
||||||
|
minVal++;
|
||||||
|
}
|
||||||
|
range = maxVal-minVal;
|
||||||
|
} else
|
||||||
|
minVal--;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw(GC gc, Rectangle area, ISignalChange left, ISignalChange right, int xBegin, int xEnd, boolean multiple) {
|
||||||
|
long leftVal = ((ISignalChangeBitVector) left).getValue().toUnsignedValue();
|
||||||
|
long rightVal= ((ISignalChangeBitVector) right).getValue().toUnsignedValue();
|
||||||
|
gc.setForeground(waveCanvas.colors[WaveformColors.SIGNAL_REAL.ordinal()]);
|
||||||
|
int yOffsetLeft = (int) ((leftVal-minVal) / range * (yOffsetB-yOffsetT));
|
||||||
|
int yOffsetRight = (int) ((rightVal-minVal) / range * (yOffsetB-yOffsetT));
|
||||||
|
if(continous) {
|
||||||
|
if (xEnd > maxX) {
|
||||||
|
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, maxX, yOffsetB-yOffsetRight);
|
||||||
|
} else {
|
||||||
|
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetRight);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (xEnd > maxX) {
|
||||||
|
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, maxX, yOffsetB-yOffsetLeft);
|
||||||
|
} else {
|
||||||
|
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetLeft);
|
||||||
|
if(yOffsetRight!=yOffsetLeft) {
|
||||||
|
gc.drawLine(xEnd, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetRight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class SingleBitStencil implements SignalStencil {
|
private class SingleBitStencil implements SignalStencil {
|
||||||
public void draw(GC gc, Rectangle area, ISignalChange left, ISignalChange right, int xBegin, int xEnd, boolean multiple) {
|
public void draw(GC gc, Rectangle area, ISignalChange left, ISignalChange right, int xBegin, int xEnd, boolean multiple) {
|
||||||
if (multiple) {
|
if (multiple) {
|
||||||
|
@ -269,49 +340,47 @@ public class SignalPainter extends TrackPainter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
private class RealStencil implements SignalStencil {
|
|
||||||
double min;
|
|
||||||
double max;
|
|
||||||
double diff;
|
|
||||||
|
|
||||||
public RealStencil(ISignalChange value, NavigableMap<Long, ? extends ISignalChange> entries) {
|
private class RealStencil implements SignalStencil {
|
||||||
min=((ISignalChangeReal) value).getValue();
|
|
||||||
max=min;
|
double minVal, range;
|
||||||
|
|
||||||
|
final double scaleFactor = 1.05;
|
||||||
|
|
||||||
|
boolean continous=true;
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public RealStencil(NavigableMap<Long, ? extends ISignalChange> entries, ISignalChange left, boolean continous) {
|
||||||
|
this.continous=continous;
|
||||||
|
Collection<ISignalChangeReal> values = ((NavigableMap<Long, ISignalChangeReal>) entries).values();
|
||||||
|
minVal=((ISignalChangeReal) left).getValue();
|
||||||
|
range=2.0;
|
||||||
|
if(!values.isEmpty()) {
|
||||||
|
double maxVal=minVal;
|
||||||
for (ISignalChange e : entries.values()) {
|
for (ISignalChange e : entries.values()) {
|
||||||
double v = ((ISignalChangeReal)e).getValue();
|
double v = ((ISignalChangeReal)e).getValue();
|
||||||
max= Double.isNaN(max)? v : Math.max(max, v);
|
if(Double.isNaN(maxVal))
|
||||||
min= Double.isNaN(min)? v : Math.min(min, v);
|
maxVal=v;
|
||||||
|
else if(!Double.isNaN(v))
|
||||||
|
maxVal=Math.max(maxVal, v);
|
||||||
|
if(Double.isNaN(minVal))
|
||||||
|
minVal=v;
|
||||||
|
else if(!Double.isNaN(v))
|
||||||
|
minVal=Math.min(minVal, v);
|
||||||
}
|
}
|
||||||
int nans = (Double.isNaN(max)?2:0) + (Double.isNaN(max)?1:0);
|
if(Double.isNaN(maxVal)){
|
||||||
switch(nans) {
|
maxVal=minVal=0.0;
|
||||||
case 0:
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
max=min;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
min=max;
|
|
||||||
case 3:
|
|
||||||
max=min=0;
|
|
||||||
}
|
}
|
||||||
diff=max-min;
|
range = (maxVal-minVal)*scaleFactor;
|
||||||
if(diff==0.0) {
|
double avg = (maxVal+minVal)/2.0;
|
||||||
if(max>0)
|
minVal=avg-(avg-minVal)*scaleFactor;
|
||||||
min=0.0;
|
|
||||||
else if(min<0.0)
|
|
||||||
max=0.0;
|
|
||||||
else {
|
|
||||||
max=1.0;
|
|
||||||
min=0.0;
|
|
||||||
}
|
|
||||||
diff=max-min;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(GC gc, Rectangle area, ISignalChange left, ISignalChange right, int xBegin, int xEnd, boolean multiple) {
|
public void draw(GC gc, Rectangle area, ISignalChange left, ISignalChange right, int xBegin, int xEnd, boolean multiple) {
|
||||||
double value = ((ISignalChangeReal)left).getValue();
|
double leftVal = ((ISignalChangeReal) left).getValue();
|
||||||
if(Double.isNaN(value)) {
|
double rightVal= ((ISignalChangeReal) right).getValue();
|
||||||
|
if(Double.isNaN(leftVal)) {
|
||||||
Color color = waveCanvas.colors[WaveformColors.SIGNAL_NAN.ordinal()];
|
Color color = waveCanvas.colors[WaveformColors.SIGNAL_NAN.ordinal()];
|
||||||
int width = xEnd - xBegin;
|
int width = xEnd - xBegin;
|
||||||
if (width > 1) {
|
if (width > 1) {
|
||||||
|
@ -330,60 +399,16 @@ public class SignalPainter extends TrackPainter {
|
||||||
gc.drawLine(xEnd, yOffsetT, xEnd, yOffsetB);
|
gc.drawLine(xEnd, yOffsetT, xEnd, yOffsetB);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Color color = waveCanvas.colors[WaveformColors.SIGNAL_ANALOG.ordinal()];
|
|
||||||
int height=yOffsetT-yOffsetB;
|
|
||||||
double offset=value-min;
|
|
||||||
int yOffset=diff>0?(int)(height*(offset/diff)) + yOffsetB:yOffsetM;
|
|
||||||
gc.setForeground(color);
|
|
||||||
if (xEnd > maxX) {
|
|
||||||
gc.drawLine(xBegin, yOffset, maxX, yOffset);
|
|
||||||
} else {
|
|
||||||
gc.drawLine(xBegin, yOffset, xEnd, yOffset);
|
|
||||||
double nextOffset = ((ISignalChangeReal)right).getValue()-min;
|
|
||||||
int yNext = diff>0?(int)(height*(nextOffset/diff)) + yOffsetB:height/2;
|
|
||||||
if (yOffset != yNext)
|
|
||||||
gc.drawLine(xEnd, yOffset, xEnd, yNext);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
private class RealStencil implements SignalStencil {
|
|
||||||
|
|
||||||
double minVal, range;
|
|
||||||
|
|
||||||
final double scaleFactor = 1.05;
|
|
||||||
|
|
||||||
boolean stepWise=true;
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public RealStencil(NavigableMap<Long, ? extends ISignalChange> entries, ISignalChange left) {
|
|
||||||
Collection<ISignalChangeReal> values = ((NavigableMap<Long, ISignalChangeReal>) entries).values();
|
|
||||||
minVal=((ISignalChangeReal) left).getValue();
|
|
||||||
range=2.0;
|
|
||||||
if(!values.isEmpty()) {
|
|
||||||
double maxVal=minVal;
|
|
||||||
for(ISignalChangeReal v:values) {
|
|
||||||
minVal=Math.min(minVal, v.getValue());
|
|
||||||
maxVal=Math.max(maxVal, v.getValue());
|
|
||||||
}
|
|
||||||
range = (maxVal-minVal)*scaleFactor;
|
|
||||||
double avg = (maxVal+minVal)/2.0;
|
|
||||||
minVal=avg-(avg-minVal)*scaleFactor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void draw(GC gc, Rectangle area, ISignalChange left, ISignalChange right, int xBegin, int xEnd, boolean multiple) {
|
|
||||||
double leftVal = ((ISignalChangeReal) left).getValue();
|
|
||||||
double rightVal= ((ISignalChangeReal) right).getValue();
|
|
||||||
// if (multiple) {
|
|
||||||
// gc.setForeground(waveCanvas.colors[WaveformColors.SIGNALX.ordinal()]);
|
|
||||||
// } else {
|
|
||||||
gc.setForeground(waveCanvas.colors[WaveformColors.SIGNAL_REAL.ordinal()]);
|
gc.setForeground(waveCanvas.colors[WaveformColors.SIGNAL_REAL.ordinal()]);
|
||||||
// }
|
|
||||||
int yOffsetLeft = (int) ((leftVal-minVal) / range * (yOffsetB-yOffsetT));
|
int yOffsetLeft = (int) ((leftVal-minVal) / range * (yOffsetB-yOffsetT));
|
||||||
int yOffsetRight = (int) ((rightVal-minVal) / range * (yOffsetB-yOffsetT));
|
int yOffsetRight = Double.isNaN(rightVal)?yOffsetLeft:(int) ((rightVal-minVal) / range * (yOffsetB-yOffsetT));
|
||||||
if(stepWise) {
|
if(continous) {
|
||||||
|
if (xEnd > maxX) {
|
||||||
|
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, maxX, yOffsetB-yOffsetRight);
|
||||||
|
} else {
|
||||||
|
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetRight);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (xEnd > maxX) {
|
if (xEnd > maxX) {
|
||||||
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, maxX, yOffsetB-yOffsetLeft);
|
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, maxX, yOffsetB-yOffsetLeft);
|
||||||
} else {
|
} else {
|
||||||
|
@ -392,19 +417,9 @@ public class SignalPainter extends TrackPainter {
|
||||||
gc.drawLine(xEnd, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetRight);
|
gc.drawLine(xEnd, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetRight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
if (xEnd > maxX) {
|
|
||||||
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, maxX, yOffsetB-yOffsetRight);
|
|
||||||
} else {
|
|
||||||
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetRight);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ISignal<? extends ISignalChange> getSignal() {
|
|
||||||
return signal;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,8 +119,6 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
|
|
||||||
private TreeMap<Integer, TrackEntry> trackVerticalOffset;
|
private TreeMap<Integer, TrackEntry> trackVerticalOffset;
|
||||||
|
|
||||||
private HashMap<IWaveform<? extends IWaveformEvent>, String> actualValues;
|
|
||||||
|
|
||||||
private Font nameFont, nameFontB;
|
private Font nameFont, nameFontB;
|
||||||
|
|
||||||
protected MouseListener nameValueMouseListener = new MouseAdapter() {
|
protected MouseListener nameValueMouseListener = new MouseAdapter() {
|
||||||
|
@ -225,7 +223,6 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
|
|
||||||
trackVerticalOffset = new TreeMap<Integer, TrackEntry>();
|
trackVerticalOffset = new TreeMap<Integer, TrackEntry>();
|
||||||
trackVerticalHeight=0;
|
trackVerticalHeight=0;
|
||||||
actualValues = new HashMap<IWaveform<? extends IWaveformEvent>, String>();
|
|
||||||
|
|
||||||
nameFont = parent.getDisplay().getSystemFont();
|
nameFont = parent.getDisplay().getSystemFont();
|
||||||
nameFontB = SWTResourceManager.getBoldFont(nameFont);
|
nameFontB = SWTResourceManager.getBoldFont(nameFont);
|
||||||
|
@ -384,19 +381,18 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
waveformCanvas.getDisplay().asyncExec(new Runnable() {
|
waveformCanvas.getDisplay().asyncExec(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
updateTracklist();
|
update();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateTracklist() {
|
public void update() {
|
||||||
trackVerticalHeight = 0;
|
trackVerticalHeight = 0;
|
||||||
int nameMaxWidth = 0;
|
int nameMaxWidth = 0;
|
||||||
int previousHeight = trackVerticalOffset.size() == 0 ? 0 : trackVerticalOffset.lastKey();
|
int previousHeight = trackVerticalOffset.size() == 0 ? 0 : trackVerticalOffset.lastKey();
|
||||||
IWaveformPainter painter = null;
|
IWaveformPainter painter = null;
|
||||||
trackVerticalOffset.clear();
|
trackVerticalOffset.clear();
|
||||||
actualValues.clear();
|
|
||||||
waveformCanvas.clearAllWaveformPainter();
|
waveformCanvas.clearAllWaveformPainter();
|
||||||
boolean even = true;
|
boolean even = true;
|
||||||
boolean clearSelection = true;
|
boolean clearSelection = true;
|
||||||
|
@ -407,12 +403,12 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
streamEntry.vOffset=trackVerticalHeight;
|
streamEntry.vOffset=trackVerticalHeight;
|
||||||
clearSelection &= currentWaveformSelection!=null && (streamEntry.waveform != currentWaveformSelection.waveform);
|
clearSelection &= currentWaveformSelection!=null && (streamEntry.waveform != currentWaveformSelection.waveform);
|
||||||
if (streamEntry.isStream()) {
|
if (streamEntry.isStream()) {
|
||||||
|
streamEntry.currentValue="";
|
||||||
streamEntry.height *= streamEntry.getStream().getMaxConcurrency();
|
streamEntry.height *= streamEntry.getStream().getMaxConcurrency();
|
||||||
painter = new StreamPainter(waveformCanvas, even, streamEntry);
|
painter = new StreamPainter(waveformCanvas, even, streamEntry);
|
||||||
actualValues.put(streamEntry.waveform, "");
|
|
||||||
} else if (streamEntry.isSignal()) {
|
} else if (streamEntry.isSignal()) {
|
||||||
|
streamEntry.currentValue="---";
|
||||||
painter = new SignalPainter(waveformCanvas, even, streamEntry);
|
painter = new SignalPainter(waveformCanvas, even, streamEntry);
|
||||||
actualValues.put(streamEntry.waveform, "---");
|
|
||||||
}
|
}
|
||||||
waveformCanvas.addWaveformPainter(painter);
|
waveformCanvas.addWaveformPainter(painter);
|
||||||
trackVerticalOffset.put(trackVerticalHeight, streamEntry);
|
trackVerticalOffset.put(trackVerticalHeight, streamEntry);
|
||||||
|
@ -440,14 +436,15 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
for(Entry<Integer, IWaveform<? extends IWaveformEvent>> entry: trackVerticalOffset.entrySet()){
|
for(Entry<Integer, IWaveform<? extends IWaveformEvent>> entry: trackVerticalOffset.entrySet()){
|
||||||
System.out.println(" "+entry.getKey()+": " +entry.getValue().getFullName());
|
System.out.println(" "+entry.getKey()+": " +entry.getValue().getFullName());
|
||||||
}
|
}
|
||||||
*/ }
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
private int calculateValueWidth() {
|
private int calculateValueWidth() {
|
||||||
TextLayout tl = new TextLayout(waveformCanvas.getDisplay());
|
TextLayout tl = new TextLayout(waveformCanvas.getDisplay());
|
||||||
tl.setFont(nameFontB);
|
tl.setFont(nameFontB);
|
||||||
int valueMaxWidth = 0;
|
int valueMaxWidth = 0;
|
||||||
for (String v : actualValues.values()) {
|
for (TrackEntry v : streams) {
|
||||||
tl.setText(v);
|
tl.setText(v.currentValue);
|
||||||
valueMaxWidth = Math.max(valueMaxWidth, tl.getBounds().width);
|
valueMaxWidth = Math.max(valueMaxWidth, tl.getBounds().width);
|
||||||
}
|
}
|
||||||
return valueMaxWidth + 15;
|
return valueMaxWidth + 15;
|
||||||
|
@ -455,22 +452,32 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
|
|
||||||
private void updateValueList(){
|
private void updateValueList(){
|
||||||
final Long time = getCursorTime();
|
final Long time = getCursorTime();
|
||||||
for(Entry<IWaveform<? extends IWaveformEvent>, String> entry:actualValues.entrySet()){
|
for(TrackEntry entry:streams){
|
||||||
if(entry.getKey() instanceof ISignal){
|
if(entry.isSignal()){
|
||||||
ISignalChange event = ((ISignal<?>)entry.getKey()).getWaveformEventsBeforeTime(time);
|
ISignalChange event = ((ISignal<?>)entry.waveform).getWaveformEventsBeforeTime(time);
|
||||||
if(event instanceof ISignalChangeBit){
|
if(event instanceof ISignalChangeBit){
|
||||||
entry.setValue("b'"+((ISignalChangeBit)event).getValue());
|
entry.currentValue="b'"+((ISignalChangeBit)event).getValue();
|
||||||
} else if(event instanceof ISignalChangeBitVector){
|
} else if(event instanceof ISignalChangeBitVector){
|
||||||
entry.setValue("h'"+((ISignalChangeBitVector)event).getValue().toHexString());
|
// TODO: same code resides in SignalPainter, fix it
|
||||||
|
switch(entry.valueDisplay) {
|
||||||
|
case SIGNED:
|
||||||
|
entry.currentValue=Long.toString(((ISignalChangeBitVector)event).getValue().toSignedValue());
|
||||||
|
break;
|
||||||
|
case UNSIGNED:
|
||||||
|
entry.currentValue=Long.toString(((ISignalChangeBitVector)event).getValue().toUnsignedValue());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
entry.currentValue="h'"+((ISignalChangeBitVector)event).getValue().toHexString();
|
||||||
|
}
|
||||||
} else if(event instanceof ISignalChangeReal){
|
} else if(event instanceof ISignalChangeReal){
|
||||||
double val = ((ISignalChangeReal)event).getValue();
|
double val = ((ISignalChangeReal)event).getValue();
|
||||||
if(val>0.001)
|
if(val>0.001)
|
||||||
entry.setValue(String.format("%1$,.3f", val));
|
entry.currentValue=String.format("%1$,.3f", val);
|
||||||
else
|
else
|
||||||
entry.setValue(Double.toString(val));
|
entry.currentValue=Double.toString(val);
|
||||||
}
|
}
|
||||||
} else if(entry.getKey() instanceof ITxStream<?>){
|
} else if(entry.isStream()){
|
||||||
ITxStream<?> stream = (ITxStream<?>) entry.getKey();
|
ITxStream<?> stream = (ITxStream<?>) entry.waveform;
|
||||||
ITx[] resultsList = new ITx[stream.getMaxConcurrency()];
|
ITx[] resultsList = new ITx[stream.getMaxConcurrency()];
|
||||||
Entry<Long, List<ITxEvent>> firstTx=stream.getEvents().floorEntry(time);
|
Entry<Long, List<ITxEvent>> firstTx=stream.getEvents().floorEntry(time);
|
||||||
if(firstTx!=null){
|
if(firstTx!=null){
|
||||||
|
@ -492,7 +499,7 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
value+="|";
|
value+="|";
|
||||||
if(o!=null) value+=((ITx)o).getGenerator().getName();
|
if(o!=null) value+=((ITx)o).getGenerator().getName();
|
||||||
}
|
}
|
||||||
entry.setValue(value);
|
entry.currentValue=value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -775,7 +782,7 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
int newIdx=idx+i;
|
int newIdx=idx+i;
|
||||||
if(newIdx>=0 && newIdx<streams.size()){
|
if(newIdx>=0 && newIdx<streams.size()){
|
||||||
Collections.swap(streams,idx,newIdx);
|
Collections.swap(streams,idx,newIdx);
|
||||||
updateTracklist();
|
update();
|
||||||
if(selectedTx!=null){
|
if(selectedTx!=null){
|
||||||
setSelection(new StructuredSelection(new Object[]{selectedTx, selectedWaveform.waveform}));
|
setSelection(new StructuredSelection(new Object[]{selectedTx, selectedWaveform.waveform}));
|
||||||
} else
|
} else
|
||||||
|
@ -825,7 +832,7 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
IWaveform<? extends IWaveformEvent> w = trackEntry.waveform;
|
IWaveform<? extends IWaveformEvent> w = trackEntry.waveform;
|
||||||
if (w instanceof ITxStream<?>)
|
if (w instanceof ITxStream<?>)
|
||||||
subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
|
subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
|
||||||
drawValue(gc, subArea, firstKey, actualValues.get(w), trackEntry.selected);
|
drawValue(gc, subArea, firstKey, trackEntry.currentValue, trackEntry.selected);
|
||||||
} else {
|
} else {
|
||||||
for (Entry<Integer, TrackEntry> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true)
|
for (Entry<Integer, TrackEntry> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true)
|
||||||
.entrySet()) {
|
.entrySet()) {
|
||||||
|
@ -833,7 +840,7 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
subArea.height = waveformCanvas.getTrackHeight();
|
subArea.height = waveformCanvas.getTrackHeight();
|
||||||
if (w instanceof ITxStream<?>)
|
if (w instanceof ITxStream<?>)
|
||||||
subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
|
subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
|
||||||
drawValue(gc, subArea, entry.getKey(), actualValues.get(w), entry.getValue().selected);
|
drawValue(gc, subArea, entry.getKey(), entry.getValue().currentValue, entry.getValue().selected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch(NoSuchElementException e){}
|
}catch(NoSuchElementException e){}
|
||||||
|
@ -1001,7 +1008,7 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
else
|
else
|
||||||
streams.add(tgtIdx, srcWave);
|
streams.add(tgtIdx, srcWave);
|
||||||
currentWaveformSelection=srcWave;
|
currentWaveformSelection=srcWave;
|
||||||
updateTracklist();
|
update();
|
||||||
} else if(source instanceof CursorPainter){
|
} else if(source instanceof CursorPainter){
|
||||||
((CursorPainter)source).setTime(0);
|
((CursorPainter)source).setTime(0);
|
||||||
updateValueList();
|
updateValueList();
|
||||||
|
|
|
@ -35,6 +35,8 @@ public interface IWaveformViewer extends PropertyChangeListener, ISelectionProvi
|
||||||
|
|
||||||
public void removeSelectionChangedListener(ISelectionChangedListener listener);
|
public void removeSelectionChangedListener(ISelectionChangedListener listener);
|
||||||
|
|
||||||
|
public void update();
|
||||||
|
|
||||||
public Control getControl();
|
public Control getControl();
|
||||||
|
|
||||||
public Control getNameControl();
|
public Control getNameControl();
|
||||||
|
|
|
@ -17,7 +17,17 @@ import com.minres.scviewer.database.ITxStream;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
import com.minres.scviewer.database.IWaveformEvent;
|
||||||
|
|
||||||
|
|
||||||
public class TrackEntry {
|
public class TrackEntry {
|
||||||
|
public enum ValueDisplay {
|
||||||
|
DEFAULT, SIGNED, UNSIGNED
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum WaveDisplay {
|
||||||
|
DEFAULT, STEP_WISE, CONTINOUS
|
||||||
|
}
|
||||||
|
|
||||||
final public IWaveform<? extends IWaveformEvent> waveform;
|
final public IWaveform<? extends IWaveformEvent> waveform;
|
||||||
|
|
||||||
public int vOffset;
|
public int vOffset;
|
||||||
|
@ -26,6 +36,12 @@ public class TrackEntry {
|
||||||
|
|
||||||
public boolean selected;
|
public boolean selected;
|
||||||
|
|
||||||
|
public String currentValue="";
|
||||||
|
|
||||||
|
public ValueDisplay valueDisplay = ValueDisplay.DEFAULT;
|
||||||
|
|
||||||
|
public WaveDisplay waveDisplay = WaveDisplay.DEFAULT;
|
||||||
|
|
||||||
public TrackEntry(IWaveform<? extends IWaveformEvent> waveform) {
|
public TrackEntry(IWaveform<? extends IWaveformEvent> waveform) {
|
||||||
this.waveform = waveform;
|
this.waveform = waveform;
|
||||||
vOffset=0;
|
vOffset=0;
|
||||||
|
|
|
@ -63,4 +63,49 @@ public class BitVector {
|
||||||
}
|
}
|
||||||
return new String(res);
|
return new String(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long toUnsignedValue() {
|
||||||
|
long res = 0;
|
||||||
|
for(char c:value) {
|
||||||
|
res<<=1;
|
||||||
|
switch (c) {
|
||||||
|
case VALUE_1:
|
||||||
|
res++;
|
||||||
|
break;
|
||||||
|
case VALUE_X:
|
||||||
|
case VALUE_Z:
|
||||||
|
return 0;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long toSignedValue() {
|
||||||
|
Boolean negative=null;
|
||||||
|
long res = 0;
|
||||||
|
for(char c:value) {
|
||||||
|
if(negative == null) {
|
||||||
|
switch (c) {
|
||||||
|
case VALUE_1: negative=true; break;
|
||||||
|
case VALUE_0: negative=false; break;
|
||||||
|
case VALUE_X:
|
||||||
|
case VALUE_Z: return 0;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
res<<=1;
|
||||||
|
switch (c) {
|
||||||
|
case VALUE_1: if(!negative) res++; break;
|
||||||
|
case VALUE_0: if(negative) res++; break;
|
||||||
|
case VALUE_X:
|
||||||
|
case VALUE_Z: return 0;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return negative?-1*(res+1):res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,7 @@
|
||||||
<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"/>
|
<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>
|
||||||
<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: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" enabled="false">
|
<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">
|
<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"/>
|
<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>
|
</menu>
|
||||||
|
@ -142,7 +142,7 @@
|
||||||
</children>
|
</children>
|
||||||
</trimBars>
|
</trimBars>
|
||||||
</children>
|
</children>
|
||||||
<children xsi:type="basic:Dialog" xmi:id="_8BTkQIytEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.dialog.aboutscviewer" toBeRendered="false" visible="false" selectedElement="__VNlAIytEeWid7xO48ZBXw" label="About SCViewer" y="600">
|
<children xsi:type="basic:Dialog" xmi:id="_8BTkQIytEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.dialog.aboutscviewer" toBeRendered="false" visible="false" selectedElement="__VNlAIytEeWid7xO48ZBXw" label="About SCViewer" x="200" y="200">
|
||||||
<children xsi:type="basic:Part" xmi:id="__VNlAIytEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.part.0" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.AboutDialog"/>
|
<children xsi:type="basic:Part" xmi:id="__VNlAIytEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.part.0" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.AboutDialog"/>
|
||||||
</children>
|
</children>
|
||||||
<handlers xmi:id="_95PfvXNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.handler.quitCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.QuitHandler" command="_95PfvHNmEeWBq8z1Dv39LA"/>
|
<handlers xmi:id="_95PfvXNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.handler.quitCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.QuitHandler" command="_95PfvHNmEeWBq8z1Dv39LA"/>
|
||||||
|
@ -171,6 +171,8 @@
|
||||||
<handlers xmi:id="_297tsHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.deletewaveformCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.DeleteWaveformHandler" command="_WUZ2wHXHEeWwZ-9vrAR2UQ"/>
|
<handlers xmi:id="_297tsHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.deletewaveformCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.DeleteWaveformHandler" command="_WUZ2wHXHEeWwZ-9vrAR2UQ"/>
|
||||||
<handlers xmi:id="_2Ai4YHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.movewaveformupCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.MoveWaveformHandler" command="_N_sOkHXHEeWwZ-9vrAR2UQ"/>
|
<handlers xmi:id="_2Ai4YHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.movewaveformupCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.MoveWaveformHandler" command="_N_sOkHXHEeWwZ-9vrAR2UQ"/>
|
||||||
<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="_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"/>
|
||||||
<menus xsi:type="menu:PopupMenu" xmi:id="_TwzrsHWSEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.popupmenu.namecontext" label="Name Menu">
|
<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">
|
<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"/>
|
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_elFdcHr_EeWVM_sKoXvptg" coreExpressionId="com.minres.scviewer.e4.application.oneWaveSeleted"/>
|
||||||
|
@ -204,40 +206,51 @@
|
||||||
<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">
|
<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">
|
||||||
<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"/>
|
<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>
|
</children>
|
||||||
|
<children xsi:type="menu:MenuSeparator" xmi:id="__Ubd4M1eEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.menuseparator.0"/>
|
||||||
|
<children xsi:type="menu:Menu" xmi:id="_mAA6sM1bEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.menu.view" label="View">
|
||||||
|
<visibleWhen xsi:type="ui:ImperativeExpression" xmi:id="_psvR0M1gEei6rfTGo88R-w" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.elements.WaveformPopupMenuContribution"/>
|
||||||
|
<children xsi:type="menu:DynamicMenuContribution" xmi:id="_IQZZQM3hEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.dynamicmenucontribution.0" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.elements.WaveformPopupMenuContribution"/>
|
||||||
|
</children>
|
||||||
</menus>
|
</menus>
|
||||||
</descriptors>
|
</descriptors>
|
||||||
<commands xmi:id="_95PfvHNmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.file.exit" commandName="quitCommand"/>
|
<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="openCommand"/>
|
<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="saveCommand"/>
|
<commands xmi:id="_95Pfw3NmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.file.save" commandName="Save Command"/>
|
||||||
<commands xmi:id="_95PfxnNmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.help.aboutAction" commandName="aboutCommand"/>
|
<commands xmi:id="_95PfxnNmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.help.aboutAction" commandName="About Command"/>
|
||||||
<commands xmi:id="_N_sOkHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.movewaveformupCommand" commandName="moveWaveformCommand">
|
<commands xmi:id="_N_sOkHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.movewaveformupCommand" commandName="Move Waveform Command">
|
||||||
<parameters xmi:id="_lMv-EHZWEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir" name="direction" optional="false"/>
|
<parameters xmi:id="_lMv-EHZWEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir" name="direction" optional="false"/>
|
||||||
</commands>
|
</commands>
|
||||||
<commands xmi:id="_WUZ2wHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.deletewaveformCommand" commandName="deleteWaveformCommand"/>
|
<commands xmi:id="_WUZ2wHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.deletewaveformCommand" commandName="Delete Waveform Command"/>
|
||||||
<commands xmi:id="_bV-TMHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.selectallCommand" commandName="selectAllCommand"/>
|
<commands xmi:id="_bV-TMHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.selectallCommand" commandName="Select All Command"/>
|
||||||
<commands xmi:id="_Gn3lEHXKEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.navigateTransCommand" commandName="navigateTransCommand" description="Navigate to related transaction">
|
<commands xmi:id="_Gn3lEHXKEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.navigateTransCommand" commandName="Navigate Transaction Command" description="Navigate to related transaction">
|
||||||
<parameters xmi:id="_howw0HXQEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir" name="direction" optional="false"/>
|
<parameters xmi:id="_howw0HXQEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir" name="direction" optional="false"/>
|
||||||
</commands>
|
</commands>
|
||||||
<commands xmi:id="_79rx4HabEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.navigateEventCommand" commandName="navigateEventCommand">
|
<commands xmi:id="_79rx4HabEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.navigateEventCommand" commandName="Navigate Event Command">
|
||||||
<parameters xmi:id="_79rx4XabEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.navigateEventCommand.parameter.dir" name="direction" optional="false"/>
|
<parameters xmi:id="_79rx4XabEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.navigateEventCommand.parameter.dir" name="direction" optional="false"/>
|
||||||
</commands>
|
</commands>
|
||||||
<commands xmi:id="_693GoHcqEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.zoomcommand" commandName="zoomCommand">
|
<commands xmi:id="_693GoHcqEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.zoomcommand" commandName="Zoom Command">
|
||||||
<parameters xmi:id="_8tbm0HcqEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" name="level" optional="false"/>
|
<parameters xmi:id="_8tbm0HcqEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" name="level" optional="false"/>
|
||||||
</commands>
|
</commands>
|
||||||
<commands xmi:id="_2PehEHr9EeWVM_sKoXvptg" elementId="com.minres.scviewer.e4.application.command.addwaveform" commandName="addWaveformCommand">
|
<commands xmi:id="_2PehEHr9EeWVM_sKoXvptg" elementId="com.minres.scviewer.e4.application.command.addwaveform" commandName="Add Waveform Command">
|
||||||
<parameters xmi:id="_6KsZcHr9EeWVM_sKoXvptg" elementId="com.minres.scviewer.e4.application.command.addwaveform.where" name="where" optional="false"/>
|
<parameters xmi:id="_6KsZcHr9EeWVM_sKoXvptg" elementId="com.minres.scviewer.e4.application.command.addwaveform.where" name="where" optional="false"/>
|
||||||
<parameters xmi:id="_7T1TcHwIEeWv0Y5uF2QN5w" elementId="com.minres.scviewer.e4.application.command.addwaveform.all" name="all" typeId="" optional="false"/>
|
<parameters xmi:id="_7T1TcHwIEeWv0Y5uF2QN5w" elementId="com.minres.scviewer.e4.application.command.addwaveform.all" name="all" typeId="" optional="false"/>
|
||||||
</commands>
|
</commands>
|
||||||
<commands xmi:id="_AxH6sIl_EeWxJ_wPkM6yGQ" elementId="org.eclipse.ui.window.preferences" commandName="Preferences"/>
|
<commands xmi:id="_AxH6sIl_EeWxJ_wPkM6yGQ" elementId="org.eclipse.ui.window.preferences" commandName="Preferences"/>
|
||||||
<commands xmi:id="_KlGlsIoNEeWxJ_wPkM6yGQ" elementId="com.minres.scviewer.e4.application.command.set_them" commandName="Set Theme">
|
<commands xmi:id="_KlGlsIoNEeWxJ_wPkM6yGQ" elementId="com.minres.scviewer.e4.application.command.set_them" commandName="Set Theme Command">
|
||||||
<parameters xmi:id="_O8Z9IIoNEeWxJ_wPkM6yGQ" elementId="com.minres.scviewer.e4.application.command.theme.parameter.id" name="themeId" optional="false"/>
|
<parameters xmi:id="_O8Z9IIoNEeWxJ_wPkM6yGQ" elementId="com.minres.scviewer.e4.application.command.theme.parameter.id" name="themeId" optional="false"/>
|
||||||
</commands>
|
</commands>
|
||||||
<commands xmi:id="_E9lUgIt2EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.command.setrelationtype" commandName="SetRelationType">
|
<commands xmi:id="_E9lUgIt2EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.command.setrelationtype" commandName="Set Relation Type Command">
|
||||||
<parameters xmi:id="_xnW7IIt_EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.commandparameter.relationName" name="relationName" optional="false"/>
|
<parameters xmi:id="_xnW7IIt_EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.commandparameter.relationName" name="relationName" optional="false"/>
|
||||||
</commands>
|
</commands>
|
||||||
<commands xmi:id="_7-AIMJebEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.command.loadStoreSettings" commandName="loadStoreSettings">
|
<commands xmi:id="_7-AIMJebEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.command.loadStoreSettings" commandName="Load-Store Settings Command">
|
||||||
<parameters xmi:id="_wxY3EJehEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.commandparameter.loadStore" name="loadStore"/>
|
<parameters xmi:id="_wxY3EJehEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.commandparameter.loadStore" name="loadStore"/>
|
||||||
</commands>
|
</commands>
|
||||||
|
<commands xmi:id="_FZunYM2PEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.command.changewavedisplay" commandName="Change Waveform Display Command">
|
||||||
|
<parameters xmi:id="_P6PYwM2PEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.commandparameter.changewavedisplay" name="Type" optional="false"/>
|
||||||
|
</commands>
|
||||||
|
<commands xmi:id="_4C_asM3ZEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.command.changevaluedisplay" commandName="Change Value Display Command">
|
||||||
|
<parameters xmi:id="_4C_asc3ZEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.commandparameter.changevaluedisplay" name="Type" 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="_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="_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"/>
|
<addons xmi:id="_95PftHNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ui.bindings.service" contributionURI="bundleclass://org.eclipse.e4.ui.bindings/org.eclipse.e4.ui.bindings.BindingServiceAddon"/>
|
||||||
|
|
|
@ -32,7 +32,7 @@ import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||||
/**
|
/**
|
||||||
* The Class NavigateContribution. Currently not used in Application.e4xmi
|
* The Class NavigateContribution. Currently not used in Application.e4xmi
|
||||||
*/
|
*/
|
||||||
public class NavigateContribution {
|
public class NavigateToolbarContribution {
|
||||||
|
|
||||||
/** The part service. */
|
/** The part service. */
|
||||||
@Inject EPartService partService;
|
@Inject EPartService partService;
|
|
@ -0,0 +1,132 @@
|
||||||
|
|
||||||
|
package com.minres.scviewer.e4.application.elements;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import org.eclipse.e4.core.di.annotations.Evaluate;
|
||||||
|
import org.eclipse.e4.ui.di.AboutToHide;
|
||||||
|
import org.eclipse.e4.ui.di.AboutToShow;
|
||||||
|
import org.eclipse.e4.ui.model.application.MApplication;
|
||||||
|
import org.eclipse.e4.ui.model.application.commands.MCommand;
|
||||||
|
import org.eclipse.e4.ui.model.application.commands.MCommandsFactory;
|
||||||
|
import org.eclipse.e4.ui.model.application.commands.MParameter;
|
||||||
|
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||||
|
import org.eclipse.e4.ui.model.application.ui.menu.ItemType;
|
||||||
|
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
|
||||||
|
import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement;
|
||||||
|
import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory;
|
||||||
|
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
||||||
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.ISignal;
|
||||||
|
import com.minres.scviewer.database.ISignalChange;
|
||||||
|
import com.minres.scviewer.database.ISignalChangeBitVector;
|
||||||
|
import com.minres.scviewer.database.ISignalChangeReal;
|
||||||
|
import com.minres.scviewer.database.ui.TrackEntry;
|
||||||
|
import com.minres.scviewer.database.ui.TrackEntry.ValueDisplay;
|
||||||
|
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||||
|
|
||||||
|
public class WaveformPopupMenuContribution {
|
||||||
|
int counter=0;
|
||||||
|
|
||||||
|
@Inject MPart activePart;
|
||||||
|
|
||||||
|
final TrackEntry nullEntry = new TrackEntry(null);
|
||||||
|
|
||||||
|
@Evaluate
|
||||||
|
public boolean evaluate() {
|
||||||
|
Object obj = activePart.getObject();
|
||||||
|
if(obj instanceof WaveformViewer){
|
||||||
|
WaveformViewer wfv = (WaveformViewer)obj;
|
||||||
|
ISelection sel = wfv.getSelection();
|
||||||
|
if(!sel.isEmpty() && sel instanceof IStructuredSelection) {
|
||||||
|
Object selected = ((IStructuredSelection)sel).getFirstElement();
|
||||||
|
if(selected instanceof ISignal<?>) {
|
||||||
|
ISignalChange s = (ISignalChange) ((ISignal<?>) selected).getEvents().firstEntry().getValue();
|
||||||
|
if((s instanceof ISignalChangeReal) || (s instanceof ISignalChangeBitVector)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@AboutToShow
|
||||||
|
public void aboutToShow(List<MMenuElement> items, MApplication application, EModelService modelService) {
|
||||||
|
Object obj = activePart.getObject();
|
||||||
|
if(obj instanceof WaveformViewer){
|
||||||
|
WaveformViewer wfv = (WaveformViewer)obj;
|
||||||
|
ISelection sel = wfv.getSelection();
|
||||||
|
if(!sel.isEmpty() && sel instanceof IStructuredSelection) {
|
||||||
|
Iterator<?> it = ((IStructuredSelection)sel).iterator();
|
||||||
|
Object first = it.next();
|
||||||
|
Object second=null;
|
||||||
|
if(it.hasNext()) second=it.next();
|
||||||
|
if(first instanceof ISignal<?>) {
|
||||||
|
ISignalChange s = (ISignalChange) ((ISignal<?>) first).getEvents().firstEntry().getValue();
|
||||||
|
//com.minres.scviewer.e4.application.menu.mulitvaluesettings
|
||||||
|
if((s instanceof ISignalChangeReal) || (s instanceof ISignalChangeBitVector)) {
|
||||||
|
TrackEntry entry=nullEntry;
|
||||||
|
if(second instanceof TrackEntry)
|
||||||
|
entry=(TrackEntry)second;
|
||||||
|
if(s instanceof ISignalChangeBitVector) {
|
||||||
|
addValueMenuItem(items, application, modelService, "hex", TrackEntry.ValueDisplay.DEFAULT, entry.valueDisplay);
|
||||||
|
addValueMenuItem(items, application, modelService, "unsigned", TrackEntry.ValueDisplay.UNSIGNED, entry.valueDisplay);
|
||||||
|
addValueMenuItem(items, application, modelService, "signed", TrackEntry.ValueDisplay.SIGNED, entry.valueDisplay);
|
||||||
|
items.add(MMenuFactory.INSTANCE.createMenuSeparator());
|
||||||
|
addWaveMenuItem(items, application, modelService, "bit vector", TrackEntry.WaveDisplay.DEFAULT, entry.waveDisplay);
|
||||||
|
}
|
||||||
|
addWaveMenuItem(items, application, modelService, "analog step-wise", TrackEntry.WaveDisplay.STEP_WISE, entry.waveDisplay);
|
||||||
|
addWaveMenuItem(items, application, modelService, "analog continous", TrackEntry.WaveDisplay.CONTINOUS, entry.waveDisplay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addValueMenuItem(List<MMenuElement> items, MApplication application, EModelService modelService,
|
||||||
|
String label, TrackEntry.ValueDisplay value, TrackEntry.ValueDisplay actual) {
|
||||||
|
MHandledMenuItem item = MMenuFactory.INSTANCE.createHandledMenuItem();
|
||||||
|
item.setType(ItemType.RADIO);
|
||||||
|
item.setSelected(value==actual);
|
||||||
|
item.setLabel("Show as "+label);
|
||||||
|
item.setContributorURI("platform:/plugin/com.minres.scviewer.e4.application");
|
||||||
|
List<MCommand> cmds = modelService.findElements(application, "com.minres.scviewer.e4.application.command.changevaluedisplay", MCommand.class, null);
|
||||||
|
if(cmds.size()!=1) System.err.println("No command found!");
|
||||||
|
else item.setCommand(cmds.get(0));
|
||||||
|
MParameter param = MCommandsFactory.INSTANCE.createParameter();
|
||||||
|
param.setName("com.minres.scviewer.e4.application.commandparameter.changevaluedisplay");
|
||||||
|
param.setValue(value.toString());
|
||||||
|
item.getParameters().add(param);
|
||||||
|
items.add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addWaveMenuItem(List<MMenuElement> items, MApplication application, EModelService modelService,
|
||||||
|
String label, TrackEntry.WaveDisplay value, TrackEntry.WaveDisplay actual) {
|
||||||
|
MHandledMenuItem item = MMenuFactory.INSTANCE.createHandledMenuItem();
|
||||||
|
item.setType(ItemType.RADIO);
|
||||||
|
item.setSelected(value==actual);
|
||||||
|
item.setLabel("Render "+label);
|
||||||
|
item.setContributorURI("platform:/plugin/com.minres.scviewer.e4.application");
|
||||||
|
List<MCommand> cmds = modelService.findElements(application, "com.minres.scviewer.e4.application.command.changewavedisplay", MCommand.class, null);
|
||||||
|
if(cmds.size()!=1) System.err.println("No command found!");
|
||||||
|
else item.setCommand(cmds.get(0));
|
||||||
|
MParameter param = MCommandsFactory.INSTANCE.createParameter();
|
||||||
|
param.setName("com.minres.scviewer.e4.application.commandparameter.changewavedisplay");
|
||||||
|
param.setValue(value.toString());
|
||||||
|
item.getParameters().add(param);
|
||||||
|
items.add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@AboutToHide
|
||||||
|
public void aboutToHide(List<MMenuElement> items) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -10,6 +10,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.e4.application.handlers;
|
package com.minres.scviewer.e4.application.handlers;
|
||||||
|
|
||||||
|
import javax.inject.Named;
|
||||||
|
|
||||||
import org.eclipse.e4.core.di.annotations.Execute;
|
import org.eclipse.e4.core.di.annotations.Execute;
|
||||||
import org.eclipse.e4.ui.model.application.MApplication;
|
import org.eclipse.e4.ui.model.application.MApplication;
|
||||||
import org.eclipse.e4.ui.model.application.ui.basic.MDialog;
|
import org.eclipse.e4.ui.model.application.ui.basic.MDialog;
|
||||||
|
@ -19,9 +21,11 @@ import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
public class AboutHandler {
|
public class AboutHandler {
|
||||||
|
|
||||||
|
static final String DIALOG_ID="com.minres.scviewer.e4.application.dialog.aboutscviewer";
|
||||||
|
|
||||||
@Execute
|
@Execute
|
||||||
public void execute(Shell shell, MApplication app, MWindow window, EModelService ms /*@Named("mdialog01.dialog.0") MDialog dialog*/) {
|
public void execute(Shell shell, MApplication app, MWindow window, EModelService ms /*@Named("mdialog01.dialog.0") MDialog dialog*/) {
|
||||||
MDialog dialog = (MDialog) ms.find("com.minres.scviewer.e4.application.dialog.aboutscviewer", app); //$NON-NLS-1$
|
MDialog dialog = (MDialog) ms.find(DIALOG_ID, app); //$NON-NLS-1$
|
||||||
dialog.setToBeRendered(true);
|
dialog.setToBeRendered(true);
|
||||||
dialog.setToBeRendered(false);
|
dialog.setToBeRendered(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
|
||||||
|
package com.minres.scviewer.e4.application.handlers;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
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 org.eclipse.jface.viewers.ISelection;
|
||||||
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.ui.TrackEntry;
|
||||||
|
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||||
|
|
||||||
|
public class ChangeValueDisplay {
|
||||||
|
|
||||||
|
static final String PARAMETER_ID="com.minres.scviewer.e4.application.commandparameter.changevaluedisplay"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@CanExecute
|
||||||
|
public boolean canExecute(EPartService partService) {
|
||||||
|
MPart part = partService.getActivePart();
|
||||||
|
if(part==null) return false;
|
||||||
|
return (part.getObject() instanceof WaveformViewer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Execute
|
||||||
|
public void execute(@Named(PARAMETER_ID) String param, EPartService partService) {
|
||||||
|
MPart part = partService.getActivePart();
|
||||||
|
Object obj = part.getObject();
|
||||||
|
if(obj instanceof WaveformViewer){
|
||||||
|
WaveformViewer wfv = (WaveformViewer)obj;
|
||||||
|
ISelection sel = wfv.getSelection();
|
||||||
|
if(!sel.isEmpty() && sel instanceof IStructuredSelection) {
|
||||||
|
Iterator<?> it = ((IStructuredSelection)sel).iterator();
|
||||||
|
it.next();
|
||||||
|
if(it.hasNext()) {
|
||||||
|
Object second = it.next();
|
||||||
|
if(second instanceof TrackEntry) {
|
||||||
|
TrackEntry.ValueDisplay val = TrackEntry.ValueDisplay.valueOf(param);
|
||||||
|
((TrackEntry)second).valueDisplay=val;
|
||||||
|
wfv.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
|
||||||
|
package com.minres.scviewer.e4.application.handlers;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
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 org.eclipse.jface.viewers.ISelection;
|
||||||
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.ui.TrackEntry;
|
||||||
|
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||||
|
|
||||||
|
public class ChangeWaveformDisplay {
|
||||||
|
|
||||||
|
static final String PARAMETER_ID="com.minres.scviewer.e4.application.commandparameter.changewavedisplay"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@CanExecute
|
||||||
|
public boolean canExecute(EPartService partService) {
|
||||||
|
MPart part = partService.getActivePart();
|
||||||
|
if(part==null) return false;
|
||||||
|
return (part.getObject() instanceof WaveformViewer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Execute
|
||||||
|
public void execute(@Named(PARAMETER_ID) String param, EPartService partService) {
|
||||||
|
MPart part = partService.getActivePart();
|
||||||
|
Object obj = part.getObject();
|
||||||
|
if(obj instanceof WaveformViewer){
|
||||||
|
WaveformViewer wfv = (WaveformViewer)obj;
|
||||||
|
ISelection sel = wfv.getSelection();
|
||||||
|
if(!sel.isEmpty() && sel instanceof IStructuredSelection) {
|
||||||
|
Iterator<?> it = ((IStructuredSelection)sel).iterator();
|
||||||
|
it.next();
|
||||||
|
if(it.hasNext()) {
|
||||||
|
Object second = it.next();
|
||||||
|
if(second instanceof TrackEntry) {
|
||||||
|
TrackEntry.WaveDisplay val= TrackEntry.WaveDisplay.valueOf(param);
|
||||||
|
((TrackEntry)second).waveDisplay=val;
|
||||||
|
wfv.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -744,7 +744,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
//FIXME: need to use unitString and unitMultiplier from class WaveformCanvas which is located in >com.minres.scviewer.database.swt.internal.
|
//FIXME: need to use unitString and unitMultiplier from class WaveformCanvas which is located in >com.minres.scviewer.database.swt.internal.
|
||||||
//Trying to import com.minres.scviewer.database.swt.internal.WaveformCanvas results in the error:
|
//Trying to import com.minres.scviewer.database.swt.internal.WaveformCanvas results in the error:
|
||||||
//'Access restriction: The type 'WaveformCanvas' is not API (restriction on required project 'com.minres.scviewer.database.ui.swt')'.
|
//'Access restriction: The type 'WaveformCanvas' is not API (restriction on required project 'com.minres.scviewer.database.ui.swt')'.
|
||||||
public final static String[] unitString={"fs", "ps", "ns", "µs", "ms"};//, "s"};
|
public final static String[] unitString={"fs", "ps", "ns", "<EFBFBD>s", "ms"};//, "s"};
|
||||||
public final static int[] unitMultiplier={1, 3, 10, 30, 100, 300};
|
public final static int[] unitMultiplier={1, 3, 10, 30, 100, 300};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -920,4 +920,8 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
navigationRelationType=relationType;
|
navigationRelationType=relationType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void update() {
|
||||||
|
waveformPane.update();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -49,6 +49,7 @@ public class DefaultValuesInitializer extends AbstractPreferenceInitializer {
|
||||||
colors[WaveformColors.SIGNAL_REAL.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
|
colors[WaveformColors.SIGNAL_REAL.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
|
||||||
colors[WaveformColors.SIGNAL_NAN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
colors[WaveformColors.SIGNAL_NAN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||||
colors[WaveformColors.SIGNAL_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
colors[WaveformColors.SIGNAL_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||||
|
colors[WaveformColors.SIGNAL_REAL.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
|
||||||
colors[WaveformColors.CURSOR.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
colors[WaveformColors.CURSOR.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||||
colors[WaveformColors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
|
colors[WaveformColors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
|
||||||
colors[WaveformColors.CURSOR_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
colors[WaveformColors.CURSOR_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||||
|
|
Loading…
Reference in New Issue