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