uadds and pdates some graphics and menu items

This commit is contained in:
Eyck Jentzsch 2023-06-27 16:00:57 +02:00
parent d1808ec1cf
commit be87792dad
22 changed files with 203 additions and 30 deletions

View File

@ -131,11 +131,11 @@ public class FstDbLoader implements IWaveformDbLoader, IFstDatabaseBuilder {
* @see com.minres.scviewer.database.vcd.ITraceBuilder#newNet(java.lang.String, int, int) * @see com.minres.scviewer.database.vcd.ITraceBuilder#newNet(java.lang.String, int, int)
*/ */
@Override @Override
public void newNet(String name, int handle, int width, boolean alias) { public void newNet(String name, int handle, int width, int direction, boolean alias) {
String netName = moduleStack.isEmpty()? name: moduleStack.peek()+"."+name; String netName = moduleStack.isEmpty()? name: moduleStack.peek()+"."+name;
IWaveform signal = width==0? IWaveform signal = width==0?
new FstSignal<DoubleVal>(this, handle, netName, width): new FstSignal<DoubleVal>(this, handle, netName, width, direction):
new FstSignal<BitVector>(this, handle, netName, width); new FstSignal<BitVector>(this, handle, netName, direction, width);
signals.add(signal); signals.add(signal);
pcs.firePropertyChange(IWaveformDbLoader.SIGNAL_ADDED, null, Iterables.getLast(signals)); pcs.firePropertyChange(IWaveformDbLoader.SIGNAL_ADDED, null, Iterables.getLast(signals));
} }
@ -150,6 +150,7 @@ public class FstDbLoader implements IWaveformDbLoader, IFstDatabaseBuilder {
} }
public void setMaxTime(long maxTime, int timeScale) { public void setMaxTime(long maxTime, int timeScale) {
if(timeScale>0) timeScale=-timeScale;
long eff_time_scale=timeScale-IWaveformDb.databaseTimeScale; long eff_time_scale=timeScale-IWaveformDb.databaseTimeScale;
this.timeScaleFactor = calculateTimescaleMultipierPower(eff_time_scale); this.timeScaleFactor = calculateTimescaleMultipierPower(eff_time_scale);
this.maxTime = maxTime*timeScaleFactor; this.maxTime = maxTime*timeScaleFactor;

View File

@ -54,7 +54,7 @@ class FstFileParser {
case HT_VAR: case HT_VAR:
HierVar v = new HierVar(); HierVar v = new HierVar();
FstLibrary.getHierVar(p, v); FstLibrary.getHierVar(p, v);
builder.newNet(v.name, v.handle, v.length, v.is_alias!=0); builder.newNet(v.name, v.handle, v.length, v.direction, v.is_alias!=0);
break; break;
case HT_ATTRBEGIN: case HT_ATTRBEGIN:
HierAttr attr = new HierAttr(); HierAttr attr = new HierAttr();

View File

@ -95,6 +95,19 @@ public class FstLibrary {
this.varType = varType; this.varType = varType;
} }
}; };
public static enum VarDir {
FST_VD_IMPLICIT (0),
FST_VD_INPUT (1),
FST_VD_OUTPUT (2),
FST_VD_INOUT (3),
FST_VD_BUFFER (4),
FST_VD_LINKAGE (5);
public final int varDir;
private VarDir(int varDir) {
this.varDir = varDir;
}
};
public static enum AttrType { public static enum AttrType {
FST_AT_MISC ( 0), /* self-contained: does not need matching FST_HT_ATTREND */ FST_AT_MISC ( 0), /* self-contained: does not need matching FST_HT_ATTREND */

View File

@ -10,6 +10,7 @@
*******************************************************************************/ *******************************************************************************/
package com.minres.scviewer.database.fst; package com.minres.scviewer.database.fst;
import com.minres.scviewer.database.DirectionType;
import com.minres.scviewer.database.EventEntry; import com.minres.scviewer.database.EventEntry;
import com.minres.scviewer.database.EventList; import com.minres.scviewer.database.EventList;
import com.minres.scviewer.database.HierNode; import com.minres.scviewer.database.HierNode;
@ -21,7 +22,9 @@ import com.minres.scviewer.database.WaveformType;
public class FstSignal<T extends IEvent> extends HierNode implements IWaveform { public class FstSignal<T extends IEvent> extends HierNode implements IWaveform {
private final FstDbLoader loader; private final FstDbLoader loader;
private final int direction;
private final int id; private final int id;
private final String fullName; private final String fullName;
@ -29,20 +32,21 @@ public class FstSignal<T extends IEvent> extends HierNode implements IWaveform {
private final int width; private final int width;
private final IEventList values; private final IEventList values;
public FstSignal(FstDbLoader loader, String name) { public FstSignal(FstDbLoader loader, String name) {
this(loader, 0, name, 1); this(loader, 0, name, 0, 1);
} }
public FstSignal(FstDbLoader loader, int id, String name) { public FstSignal(FstDbLoader loader, int id, String name) {
this(loader, id,name,1); this(loader, id,name, 0,1);
} }
public FstSignal(FstDbLoader loader, int id, String name, int width) { public FstSignal(FstDbLoader loader, int id, String name, int direction, int width) {
super(name); super(name);
fullName=name; fullName=name;
this.loader=loader; this.loader=loader;
this.id=id; this.id=id;
this.direction = direction;
this.width=width; this.width=width;
this.values=new EventList(); this.values=new EventList();
} }
@ -52,6 +56,7 @@ public class FstSignal<T extends IEvent> extends HierNode implements IWaveform {
fullName=name; fullName=name;
this.loader=o.loader; this.loader=o.loader;
this.id=id; this.id=id;
this.direction = 0;
this.width=o.width; this.width=o.width;
this.values=o.values; this.values=o.values;
} }
@ -78,14 +83,14 @@ public class FstSignal<T extends IEvent> extends HierNode implements IWaveform {
return getEvents().get(time); return getEvents().get(time);
} }
@Override @Override
public IEvent[] getEventsBeforeTime(long time) { public IEvent[] getEventsBeforeTime(long time) {
EventEntry e = getEvents().floorEntry(time); EventEntry e = getEvents().floorEntry(time);
if(e==null) if(e==null)
return new IEvent[] {}; return new IEvent[] {};
else else
return getEvents().floorEntry(time).events; return getEvents().floorEntry(time).events;
} }
@Override @Override
public boolean isSame(IWaveform other) { public boolean isSame(IWaveform other) {
@ -112,4 +117,15 @@ public class FstSignal<T extends IEvent> extends HierNode implements IWaveform {
return "signal"; return "signal";
} }
@Override
public DirectionType getDirection() {
switch(direction) {
case 1: return DirectionType.INPUT;
case 2: return DirectionType.OUTPUT;
case 3: return DirectionType.INOUT;
case 4: return DirectionType.BUFFER;
case 5: return DirectionType.LINKAGE;
}
return DirectionType.IMPLICIT;
}
} }

View File

@ -35,7 +35,7 @@ public interface IFstDatabaseBuilder {
* @param width the width, -1 equals real, 0... is a bit vector * @param width the width, -1 equals real, 0... is a bit vector
* @return the net id * @return the net id
*/ */
public void newNet(String netName, int handle, int width, boolean alias) ; public void newNet(String netName, int handle, int width, int direction, boolean alias) ;
/** /**
* Gets the net width. * Gets the net width.

View File

@ -14,6 +14,7 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.minres.scviewer.database.DirectionType;
import com.minres.scviewer.database.IEventList; import com.minres.scviewer.database.IEventList;
import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.InputFormatException; import com.minres.scviewer.database.InputFormatException;
@ -119,4 +120,8 @@ class TxGenerator extends AbstractTxStream {
return ((AbstractTxStream)parent).getFullName()+"."+name; return ((AbstractTxStream)parent).getFullName()+"."+name;
} }
@Override
public DirectionType getDirection() {
return DirectionType.IMPLICIT;
}
} }

View File

@ -14,6 +14,7 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.minres.scviewer.database.DirectionType;
import com.minres.scviewer.database.IEventList; import com.minres.scviewer.database.IEventList;
import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.InputFormatException; import com.minres.scviewer.database.InputFormatException;
@ -96,4 +97,8 @@ class TxStream extends AbstractTxStream {
return events; return events;
} }
@Override
public DirectionType getDirection() {
return DirectionType.IMPLICIT;
}
} }

View File

@ -16,6 +16,7 @@ import java.sql.SQLException;
import java.util.Map; import java.util.Map;
import java.util.TreeMap; import java.util.TreeMap;
import com.minres.scviewer.database.DirectionType;
import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.sqlite.db.IDatabase; import com.minres.scviewer.database.sqlite.db.IDatabase;
import com.minres.scviewer.database.sqlite.db.SQLiteDatabaseSelectHandler; import com.minres.scviewer.database.sqlite.db.SQLiteDatabaseSelectHandler;
@ -76,4 +77,8 @@ public class TxGenerator extends AbstractTxStream {
return transactions; return transactions;
} }
@Override
public DirectionType getDirection() {
return DirectionType.IMPLICIT;
}
} }

View File

@ -18,6 +18,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.TreeMap; import java.util.TreeMap;
import com.minres.scviewer.database.DirectionType;
import com.minres.scviewer.database.IEvent; import com.minres.scviewer.database.IEvent;
import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.sqlite.db.IDatabase; import com.minres.scviewer.database.sqlite.db.IDatabase;
@ -102,4 +103,9 @@ public class TxStream extends AbstractTxStream {
public String getKind() { public String getKind() {
return scvStream.getKind(); return scvStream.getKind();
} }
@Override
public DirectionType getDirection() {
return DirectionType.IMPLICIT;
}
} }

View File

@ -14,6 +14,7 @@ package com.minres.scviewer.database.text;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.minres.scviewer.database.DirectionType;
import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.IWaveform;
/** /**
@ -93,4 +94,8 @@ class TxGenerator extends AbstractTxStream {
return ((AbstractTxStream)parent).getFullName()+"."+name; return ((AbstractTxStream)parent).getFullName()+"."+name;
} }
@Override
public DirectionType getDirection() {
return DirectionType.IMPLICIT;
}
} }

View File

@ -11,6 +11,7 @@
*******************************************************************************/ *******************************************************************************/
package com.minres.scviewer.database.text; package com.minres.scviewer.database.text;
import com.minres.scviewer.database.DirectionType;
import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.IWaveform;
/** /**
@ -55,4 +56,8 @@ class TxStream extends AbstractTxStream {
return kind; return kind;
} }
@Override
public DirectionType getDirection() {
return DirectionType.IMPLICIT;
}
} }

View File

@ -651,7 +651,7 @@ public class WaveformView implements IWaveformView {
private void updateValueList() { private void updateValueList() {
final Long time = getCursorTime(); final Long time = getCursorTime();
for (TrackEntry entry : streams) { streams.stream()/*.parallel()*/.forEach(entry -> {
if (entry.waveform.getType() == WaveformType.SIGNAL) { if (entry.waveform.getType() == WaveformType.SIGNAL) {
IEvent[] value = entry.waveform.getEventsBeforeTime(time); IEvent[] value = entry.waveform.getEventsBeforeTime(time);
if (value[0] instanceof BitVector) { if (value[0] instanceof BitVector) {
@ -710,7 +710,7 @@ public class WaveformView implements IWaveformView {
} }
} }
} });
int width = calculateValueWidth(); int width = calculateValueWidth();
valueList.setSize(width, tracksVerticalHeight); valueList.setSize(width, tracksVerticalHeight);
valueListScrolled.setMinSize(width, tracksVerticalHeight); valueListScrolled.setMinSize(width, tracksVerticalHeight);

View File

@ -10,6 +10,7 @@
*******************************************************************************/ *******************************************************************************/
package com.minres.scviewer.database.vcd; package com.minres.scviewer.database.vcd;
import com.minres.scviewer.database.DirectionType;
import com.minres.scviewer.database.EventEntry; import com.minres.scviewer.database.EventEntry;
import com.minres.scviewer.database.EventList; import com.minres.scviewer.database.EventList;
import com.minres.scviewer.database.HierNode; import com.minres.scviewer.database.HierNode;
@ -113,4 +114,8 @@ public class VCDSignal<T extends IEvent> extends HierNode implements IWaveform {
return "signal"; return "signal";
} }
@Override
public DirectionType getDirection() {
return DirectionType.IMPLICIT;
}
} }

View File

@ -0,0 +1,34 @@
/*******************************************************************************
* Copyright (c) 2020 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database;
/**
* The Enum DirectionType.
*/
public enum DirectionType {
IMPLICIT,
INPUT,
OUTPUT,
INOUT,
BUFFER,
LINKAGE;
public String toString() {
switch(this) {
case INPUT: return "I";
case OUTPUT: return "O";
case INOUT: return "IO";
case BUFFER: return "B";
case LINKAGE: return "L";
default: return "";
}
}
}

View File

@ -123,4 +123,9 @@ public class EmptyWaveform implements IWaveform {
return 0; return 0;
} }
@Override
public DirectionType getDirection() {
return DirectionType.IMPLICIT;
}
} }

View File

@ -11,7 +11,7 @@
package com.minres.scviewer.database; package com.minres.scviewer.database;
// TODO: Auto-generated Javadoc
/** /**
* The Interface IWaveform. * The Interface IWaveform.
* *
@ -19,6 +19,7 @@ package com.minres.scviewer.database;
*/ */
public interface IWaveform extends IHierNode { public interface IWaveform extends IHierNode {
public DirectionType getDirection();
/** /**
* Gets the id. * Gets the id.
* *

View File

@ -206,6 +206,9 @@
<children xsi:type="menu:HandledMenuItem" xmi:id="_NFfK0LcyEe294PIiYLxpfA" elementId="com.minres.scviewer.e4.application.handledmenuitem.add_separator" label="Add separator above" command="_vYAOQLcxEe294PIiYLxpfA"> <children xsi:type="menu:HandledMenuItem" xmi:id="_NFfK0LcyEe294PIiYLxpfA" elementId="com.minres.scviewer.e4.application.handledmenuitem.add_separator" label="Add separator above" command="_vYAOQLcxEe294PIiYLxpfA">
<parameters xmi:id="_or7iYLcyEe294PIiYLxpfA" elementId="com.minres.scviewer.e4.application.parameter.15" name="com.minres.scviewer.e4.application.commandparameter.add_separator" value="before"/> <parameters xmi:id="_or7iYLcyEe294PIiYLxpfA" elementId="com.minres.scviewer.e4.application.parameter.15" name="com.minres.scviewer.e4.application.commandparameter.add_separator" value="before"/>
</children> </children>
<children xsi:type="menu:HandledMenuItem" xmi:id="_Dj-FUBTJEe6ZlJc8qY5-Zw" elementId="com.minres.scviewer.e4.application.handledmenuitem.add_separator" label="Add separator below" command="_vYAOQLcxEe294PIiYLxpfA">
<parameters xmi:id="_Dj-FURTJEe6ZlJc8qY5-Zw" elementId="com.minres.scviewer.e4.application.parameter.15" name="com.minres.scviewer.e4.application.commandparameter.add_separator" value="after"/>
</children>
<children xsi:type="menu:HandledMenuItem" xmi:id="_ecbWkLc0Ee294PIiYLxpfA" elementId="com.minres.scviewer.e4.application.handledmenuitem.add_separator" visible="false" label="Add blank below" enabled="false" command="_vYAOQLcxEe294PIiYLxpfA"> <children xsi:type="menu:HandledMenuItem" xmi:id="_ecbWkLc0Ee294PIiYLxpfA" elementId="com.minres.scviewer.e4.application.handledmenuitem.add_separator" visible="false" label="Add blank below" enabled="false" command="_vYAOQLcxEe294PIiYLxpfA">
<parameters xmi:id="_ecbWkbc0Ee294PIiYLxpfA" elementId="com.minres.scviewer.e4.application.parameter.15" name="com.minres.scviewer.e4.application.commandparameter.add_separator" value="after"/> <parameters xmi:id="_ecbWkbc0Ee294PIiYLxpfA" elementId="com.minres.scviewer.e4.application.parameter.15" name="com.minres.scviewer.e4.application.commandparameter.add_separator" value="after"/>
</children> </children>

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 B

View File

@ -61,9 +61,9 @@ public class AddWaveformHandler {
@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection) { @Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection) {
if(designBrowser==null) designBrowser = getListPart( partService); if(designBrowser==null) designBrowser = getListPart( partService);
if(designBrowser!=null && selection.size()>0){ if(designBrowser!=null && selection.size()>0){
List<?> sel=selection.toList(); @SuppressWarnings("unchecked")
designBrowser.getActiveWaveformViewerPart().addStreamsToList(sel.toArray(new IWaveform[]{}), IWaveform[] sel=(IWaveform[]) selection.toList().stream().filter(t -> t instanceof IWaveform).toArray(IWaveform[]::new);
"before".equalsIgnoreCase(where)); //$NON-NLS-1$ designBrowser.getActiveWaveformViewerPart().addStreamsToList(sel, "before".equalsIgnoreCase(where)); //$NON-NLS-1$
} }
} }

View File

@ -13,11 +13,16 @@ package com.minres.scviewer.e4.application.provider;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.DecorationOverlayIcon;
import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener; import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.wb.swt.ResourceManager; import org.eclipse.wb.swt.ResourceManager;
import com.minres.scviewer.database.DirectionType;
import com.minres.scviewer.database.IHierNode; import com.minres.scviewer.database.IHierNode;
import com.minres.scviewer.database.IWaveform; import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.IWaveformDb; import com.minres.scviewer.database.IWaveformDb;
@ -49,6 +54,32 @@ public class TxDbLabelProvider implements ILabelProvider {
/** The wave. */ /** The wave. */
private Image wave; private Image wave;
/** The wave. */
private Image input;
/** The wave. */
private Image output;
/** The wave. */
private Image inout;
/** The signal. */
private Image signal_in;
/** The wave. */
private Image wave_in;
/** The signal. */
private Image signal_out;
/** The wave. */
private Image wave_out;
/** The signal. */
private Image signal_inout;
/** The wave. */
private Image wave_inout;
/** /**
* Instantiates a new tx db label provider. * Instantiates a new tx db label provider.
*/ */
@ -64,7 +95,16 @@ public class TxDbLabelProvider implements ILabelProvider {
} }
signal=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/signal.png"); //$NON-NLS-1$ //$NON-NLS-2$ signal=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/signal.png"); //$NON-NLS-1$ //$NON-NLS-2$
wave=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/wave.png"); //$NON-NLS-1$ //$NON-NLS-2$ wave=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/wave.png"); //$NON-NLS-1$ //$NON-NLS-2$s
input=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/arrow_in.png"); //$NON-NLS-1$ //$NON-NLS-2$s
output=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/arrow_out.png"); //$NON-NLS-1$ //$NON-NLS-2$s
inout=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/arrow_inout.png"); //$NON-NLS-1$ //$NON-NLS-2$s
signal_in = new DecorationOverlayIcon(signal, new ImageDescriptor[]{ImageDescriptor.createFromImage(input)}).createImage();
wave_in = new DecorationOverlayIcon(wave, new ImageDescriptor[]{ImageDescriptor.createFromImage(input)}).createImage();
signal_out = new DecorationOverlayIcon(signal, new ImageDescriptor[]{ImageDescriptor.createFromImage(output)}).createImage();
wave_out = new DecorationOverlayIcon(wave, new ImageDescriptor[]{ImageDescriptor.createFromImage(output)}).createImage();
signal_inout = new DecorationOverlayIcon(signal, new ImageDescriptor[]{ImageDescriptor.createFromImage(inout)}).createImage();
wave_inout = new DecorationOverlayIcon(wave, new ImageDescriptor[]{ImageDescriptor.createFromImage(inout)}).createImage();
} }
/** /**
@ -88,7 +128,12 @@ public class TxDbLabelProvider implements ILabelProvider {
*/ */
@Override @Override
public void dispose() { public void dispose() {
// no resources to dispose signal_in.dispose();
wave_in.dispose();
signal_out.dispose();
wave_out.dispose();
signal_inout.dispose();
wave_inout.dispose();
} }
/** /**
@ -139,10 +184,29 @@ public class TxDbLabelProvider implements ILabelProvider {
case FILTER: case FILTER:
break; break;
case SIGNAL: case SIGNAL:
if(((IWaveform) element).getWidth()==1) IWaveform wf = (IWaveform) element;
return signal; switch(wf.getDirection()) {
else default:
return wave; if(((IWaveform) element).getWidth()==1)
return signal;
else
return wave;
case INPUT:
if(((IWaveform) element).getWidth()==1)
return signal_in;
else
return wave_in;
case OUTPUT:
if(((IWaveform) element).getWidth()==1)
return signal_out;
else
return wave_out;
case INOUT:
if(((IWaveform) element).getWidth()==1)
return signal_inout;
else
return wave_inout;
}
default: default:
break; break;
} }