adapt painter
This commit is contained in:
parent
68918689e7
commit
5df91dbaa8
@ -101,20 +101,15 @@ public class SignalPainter extends TrackPainter {
|
||||
long endTime = beginTime + area.width*scaleFactor;
|
||||
|
||||
EventEntry first = signal.getEvents().floorEntry(beginTime);
|
||||
EventEntry last = signal.getEvents().floorEntry(endTime);
|
||||
if (first == null) {
|
||||
if (last == null)
|
||||
return;
|
||||
if (first == null)
|
||||
first = signal.getEvents().firstEntry();
|
||||
} else if (last == null) {
|
||||
last = signal.getEvents().lastEntry();
|
||||
}
|
||||
beginTime = first.timestamp;
|
||||
proj.setForeground(this.waveCanvas.styleProvider.getColor(WaveformColors.LINE));
|
||||
proj.setLineStyle(SWT.LINE_SOLID);
|
||||
proj.setLineWidth(1);
|
||||
IEventList entries = signal.getEvents().subMap(first.timestamp, false, last.timestamp);
|
||||
SignalChange left = new SignalChange(first);
|
||||
SignalChange right = new SignalChange(entries.size() > 0 ? entries.firstEntry() : first);
|
||||
IEventList entries = signal.getEvents().subMap(beginTime, true, endTime);
|
||||
SignalChange left = new SignalChange(entries.firstEntry());
|
||||
SignalChange right = new SignalChange(entries.size() > 1 ? entries.higherEntry(left.time) : entries.firstEntry());
|
||||
maxPosX = area.x + area.width;
|
||||
yOffsetT = this.waveCanvas.styleProvider.getTrackHeight() / 5 + area.y;
|
||||
yOffsetM = this.waveCanvas.styleProvider.getTrackHeight() / 2 + area.y;
|
||||
|
@ -19,7 +19,9 @@ import org.eclipse.swt.graphics.Rectangle;
|
||||
|
||||
import com.minres.scviewer.database.EventEntry;
|
||||
import com.minres.scviewer.database.EventKind;
|
||||
import com.minres.scviewer.database.EventList;
|
||||
import com.minres.scviewer.database.IEvent;
|
||||
import com.minres.scviewer.database.IEventList;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.tx.ITx;
|
||||
import com.minres.scviewer.database.tx.ITxEvent;
|
||||
@ -71,10 +73,11 @@ public class StreamPainter extends TrackPainter{
|
||||
long beginTime = beginPos*scaleFactor;
|
||||
long endTime = beginTime + area.width*scaleFactor;
|
||||
|
||||
EventEntry firstTx=stream.getEvents().floorEntry(beginTime);
|
||||
EventEntry lastTx=stream.getEvents().ceilingEntry(endTime);
|
||||
if(firstTx==null) firstTx = stream.getEvents().firstEntry();
|
||||
if(lastTx==null) lastTx=stream.getEvents().lastEntry();
|
||||
IEventList events = stream.getEvents();
|
||||
EventEntry firstTx = events.floorEntry(beginTime);
|
||||
EventEntry lastTx = events.ceilingEntry(endTime);
|
||||
if(firstTx==null) firstTx = events.firstEntry();
|
||||
if(lastTx==null) lastTx = events.lastEntry();
|
||||
proj.setFillRule(SWT.FILL_EVEN_ODD);
|
||||
proj.setLineStyle(SWT.LINE_SOLID);
|
||||
proj.setLineWidth(1);
|
||||
@ -90,7 +93,7 @@ public class StreamPainter extends TrackPainter{
|
||||
ITxEvent highlighed=null;
|
||||
proj.setForeground(this.waveCanvas.styleProvider.getColor(WaveformColors.LINE));
|
||||
long selectedId=waveCanvas.currentSelection!=null? waveCanvas.currentSelection.getId():-1;
|
||||
for(EventEntry entry: stream.getEvents().subMap(firstTx.timestamp, true, lastTx.timestamp))
|
||||
for(EventEntry entry: events.subMap(firstTx.timestamp, true, lastTx.timestamp))
|
||||
for(IEvent e:entry.events){
|
||||
ITxEvent evt = (ITxEvent) e;
|
||||
ITx tx = evt.getTransaction();
|
||||
|
@ -113,7 +113,8 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
||||
moduleStack=null;
|
||||
throw new InputFormatException(e.toString());
|
||||
}
|
||||
if(!res) throw new InputFormatException("Could not parse VCD file");
|
||||
if(!res)
|
||||
throw new InputFormatException("Could not parse VCD file");
|
||||
// calculate max time of this database
|
||||
for(IWaveform waveform:signals) {
|
||||
IEventList events =waveform.getEvents();
|
||||
|
Loading…
Reference in New Issue
Block a user