Fixed inconsitencies
This commit is contained in:
@@ -118,7 +118,8 @@ public class TxEditorPlugin extends AbstractUIPlugin {
|
||||
case trackBgLightColor:
|
||||
return SWTResourceManager.getColor(220, 220, 220);
|
||||
case trackBgDarkColor:
|
||||
return SWTResourceManager.getColor(200, 200, 200);
|
||||
// return SWTResourceManager.getColor(200, 200, 200);
|
||||
return SWTResourceManager.getColor(SWT.COLOR_BLACK);
|
||||
case headerBgColor:
|
||||
return SWTResourceManager.getColor(255, 255, 255);
|
||||
case headerFgColor:
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.minres.scviewer.ui.adapter;
|
||||
|
||||
import org.eclipse.core.runtime.IAdapterFactory;
|
||||
import org.eclipse.ui.views.properties.IPropertySource;
|
||||
|
||||
import com.minres.scviewer.database.ITx;
|
||||
|
||||
public class TxAdapterFactory implements IAdapterFactory {
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public Object getAdapter(Object adaptableObject, Class adapterType) {
|
||||
if (adapterType == IPropertySource.class)
|
||||
return new ITransactionPropertySource((ITx) adaptableObject);
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public Class[] getAdapterList() {
|
||||
return new Class[]{IPropertySource.class};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,7 +23,7 @@ import com.minres.scviewer.ui.TxEditorPlugin;
|
||||
public class SignalWidget extends Canvas implements IWaveformWidget{
|
||||
|
||||
static final int trackHeight = 50;
|
||||
static final int trackInset = 2;
|
||||
static final int trackInset = 1;
|
||||
static final int txHeight = trackHeight - 2 * trackInset;
|
||||
|
||||
static double zoomFactor = EventTime.NS;
|
||||
@@ -32,10 +32,8 @@ public class SignalWidget extends Canvas implements IWaveformWidget{
|
||||
private Color color0;
|
||||
private Color color1;
|
||||
private Color colorZ;
|
||||
private Color colorZdark;
|
||||
private Color colorX;
|
||||
private Color colorXdark;
|
||||
private Color colorC;
|
||||
private Color colorText;
|
||||
private long length;
|
||||
ISignal<ISignalChange> signal;
|
||||
|
||||
@@ -50,12 +48,10 @@ public class SignalWidget extends Canvas implements IWaveformWidget{
|
||||
lineColor=plugin.getColor(TxEditorPlugin.lineColor);
|
||||
trackBgColor=plugin.getColor(TxEditorPlugin.trackBgDarkColor);
|
||||
color0=SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
||||
color1=SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
||||
color1=SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
||||
colorZ=SWTResourceManager.getColor(SWT.COLOR_GRAY);
|
||||
colorX=SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||
colorZdark=SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY);
|
||||
colorXdark=SWTResourceManager.getColor(SWT.COLOR_DARK_RED);
|
||||
colorC=SWTResourceManager.getColor(SWT.COLOR_BLUE);
|
||||
colorText=SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||
}
|
||||
|
||||
public void setTransactions(ISignal<ISignalChange> signal) {
|
||||
@@ -97,11 +93,11 @@ public class SignalWidget extends Canvas implements IWaveformWidget{
|
||||
switch(((ISignalChangeSingle) lastChange).getValue()){
|
||||
case '1':
|
||||
color=color1;
|
||||
yOffset = trackHeight/3;
|
||||
yOffset = trackHeight/5;
|
||||
break;
|
||||
case '0':
|
||||
color=color0;
|
||||
yOffset = 2*trackHeight/3;
|
||||
yOffset = 4*trackHeight/5;
|
||||
break;
|
||||
case 'Z':
|
||||
color=colorZ;
|
||||
@@ -110,37 +106,33 @@ public class SignalWidget extends Canvas implements IWaveformWidget{
|
||||
}
|
||||
gc.setForeground(color);
|
||||
int endTime= (int)(actChange.getTime().getValue()/zoomFactor);
|
||||
gc.drawLine((int)(lastChange.getTime().getValue()/zoomFactor), yOffset,
|
||||
endTime, yOffset);
|
||||
gc.drawLine((int)(lastChange.getTime().getValue()/zoomFactor), yOffset, endTime, yOffset);
|
||||
int yNext = trackHeight/2;
|
||||
switch(((ISignalChangeSingle) actChange).getValue()){
|
||||
case '1':
|
||||
yNext = trackHeight/3;
|
||||
yNext = trackHeight/5;
|
||||
break;
|
||||
case '0':
|
||||
yNext = 2*trackHeight/3;
|
||||
yNext = 4*trackHeight/5;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
gc.setForeground(colorC);
|
||||
// gc.setForeground(colorC);
|
||||
if(yOffset<yNext)
|
||||
gc.drawLine(endTime, yOffset, endTime, yNext);
|
||||
else
|
||||
gc.drawLine(endTime, yNext, endTime, yOffset);
|
||||
|
||||
} else if(lastChange instanceof ISignalChangeMulti){
|
||||
int yOffsetT = trackHeight/3;
|
||||
int yOffsetT = trackHeight/5;
|
||||
int yOffsetM = trackHeight/2;
|
||||
int yOffsetB = 2*trackHeight/3;
|
||||
Color color = color1;
|
||||
int yOffsetB = 4*trackHeight/5;
|
||||
Color colorBorder = color0;
|
||||
ISignalChangeMulti last = (ISignalChangeMulti) lastChange;
|
||||
if(last.getValue().contains("X")){
|
||||
color=colorX;
|
||||
colorBorder=colorXdark;
|
||||
}else if(last.getValue().contains("Z")){
|
||||
color=colorZ;
|
||||
colorBorder=colorZdark;
|
||||
if(last.getValue().toString().contains("X")){
|
||||
colorBorder=colorX;
|
||||
}else if(last.getValue().toString().contains("Z")){
|
||||
colorBorder=colorZ;
|
||||
}
|
||||
int beginTime= (int)(lastChange.getTime().getValue()/zoomFactor);
|
||||
int endTime= (int)(actChange.getTime().getValue()/zoomFactor);
|
||||
@@ -152,11 +144,12 @@ public class SignalWidget extends Canvas implements IWaveformWidget{
|
||||
endTime-1,yOffsetB,
|
||||
beginTime+1,yOffsetB
|
||||
};
|
||||
gc.setBackground(color);
|
||||
gc.fillPolygon(points);
|
||||
gc.setForeground(colorBorder);
|
||||
gc.drawPolygon(points);
|
||||
gc.drawText(last.getValue(), beginTime+1, yOffsetT+1);
|
||||
gc.setForeground(colorText);
|
||||
int size = gc.getDevice().getDPI().y * gc.getFont().getFontData()[0].getHeight()/72;
|
||||
// gc.setClipping(beginTime+3,yOffsetM-size/2-1,endTime-beginTime-4, yOffsetM+size/2+1);
|
||||
gc.drawText("h'"+last.getValue().toHexString(), beginTime+3, yOffsetM-size/2-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.minres.scviewer.ui.swt;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.NavigableSet;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
@@ -27,7 +28,7 @@ import com.minres.scviewer.ui.TxEditorPlugin;
|
||||
public class Track extends Composite implements IWaveformWidget, MouseListener {
|
||||
|
||||
static final int trackHeight = 50;
|
||||
static final int trackInset = 2;
|
||||
static final int trackInset = 1;
|
||||
static final int txHeight = trackHeight - 2 * trackInset;
|
||||
|
||||
static double zoomFactor = EventTime.NS;
|
||||
@@ -101,7 +102,7 @@ public class Track extends Composite implements IWaveformWidget, MouseListener {
|
||||
});
|
||||
TxEditorPlugin plugin=TxEditorPlugin.getDefault();
|
||||
lineColor=plugin.getColor(TxEditorPlugin.lineColor);
|
||||
trackBgColor=plugin.getColor(TxEditorPlugin.trackBgLightColor);
|
||||
trackBgColor=plugin.getColor(TxEditorPlugin.trackBgDarkColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +122,7 @@ public class Track extends Composite implements IWaveformWidget, MouseListener {
|
||||
}
|
||||
|
||||
|
||||
public void setTransactions(List<ITx> transactions) {
|
||||
public void setTransactions(NavigableSet<ITx> transactions) {
|
||||
Vector<ITx> rowendtime = new Vector<ITx>();
|
||||
for (ITx tx : transactions) {
|
||||
int rowIdx = 0;
|
||||
@@ -188,7 +189,7 @@ public class Track extends Composite implements IWaveformWidget, MouseListener {
|
||||
}
|
||||
|
||||
public Transaction highlight(Object obj){
|
||||
if(obj instanceof ITx){
|
||||
if(obj==null || obj instanceof ITx){
|
||||
ITx tx = (ITx) obj;
|
||||
if(highlightedTx!=null){
|
||||
transactionMap.get(highlightedTx).highlight(false);
|
||||
|
||||
@@ -24,7 +24,7 @@ public class Transaction extends Composite {
|
||||
private boolean highlighted=false;
|
||||
|
||||
Transaction(Composite parent, int style, int lenght) {
|
||||
super(parent, style);
|
||||
super(parent, style|SWT.NO_BACKGROUND);
|
||||
this.length=lenght;
|
||||
addDisposeListener(new DisposeListener() {
|
||||
public void widgetDisposed(DisposeEvent e) {
|
||||
@@ -53,7 +53,7 @@ public class Transaction extends Composite {
|
||||
gc.setBackground(highlighted?txHighliteBgColor:txBgColor);
|
||||
gc.setLineWidth(1);
|
||||
gc.setLineStyle(SWT.LINE_SOLID);
|
||||
Rectangle bb = new Rectangle(0, 0, length-1, height-1);
|
||||
Rectangle bb = new Rectangle(0, height/5, length-1, 3*height/5);
|
||||
if(bb.width<8){
|
||||
gc.fillRectangle(bb);
|
||||
gc.drawRectangle(bb);
|
||||
|
||||
@@ -174,7 +174,7 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider, Mo
|
||||
|
||||
protected RowLayout createScrolledLayoutData(boolean center) {
|
||||
RowLayout nameListLayout = new RowLayout(SWT.VERTICAL);
|
||||
nameListLayout.spacing = 4;
|
||||
nameListLayout.spacing = 2;
|
||||
nameListLayout.marginTop = 0;
|
||||
nameListLayout.marginRight = 0;
|
||||
nameListLayout.marginLeft = 0;
|
||||
@@ -337,11 +337,11 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider, Mo
|
||||
Object sel =((IStructuredSelection)selection).getFirstElement();
|
||||
if(sel instanceof ITx && currentSelection!=sel){
|
||||
if(currentSelection!=null){
|
||||
ITxStream stream = currentSelection.getGenerator().getStream();
|
||||
ITxStream stream = currentSelection.getStream();
|
||||
if(trackMap.containsKey(stream)) trackMap.get(stream).highlight(null);
|
||||
}
|
||||
currentSelection=(ITx) sel;
|
||||
ITxStream stream = currentSelection.getGenerator().getStream();
|
||||
ITxStream stream = currentSelection.getStream();
|
||||
if(trackMap.containsKey(stream)){
|
||||
Transaction trans = trackMap.get(stream).highlight(sel);
|
||||
trackListScrolled.showControl(trans);
|
||||
|
||||
@@ -221,7 +221,7 @@ public class AttributeProperty extends AbstractPropertySection implements ISelec
|
||||
public void menuAboutToShow(IMenuManager mgr) {
|
||||
ISelection selection = treeViewer.getSelection();
|
||||
if (selection instanceof IStructuredSelection) {
|
||||
System.out.println(((IStructuredSelection)selection).getFirstElement().toString());
|
||||
// System.out.println(((IStructuredSelection)selection).getFirstElement().toString());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user