fix display bug
This commit is contained in:
parent
5adeae15a9
commit
d38016a03f
|
@ -8,4 +8,5 @@ SCViewer.xcf
|
|||
SCViewer_1.png
|
||||
copyrightLog.txt
|
||||
/workspace
|
||||
?*.launch
|
||||
?*.launch
|
||||
/.settings/
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
|
@ -38,7 +38,7 @@ public class ArrowPainter implements IPainter {
|
|||
|
||||
private int yCtrlOffset = 30;
|
||||
|
||||
private WaveformCanvas waveCanvas;
|
||||
private final WaveformCanvas waveCanvas;
|
||||
|
||||
private ITx tx;
|
||||
|
||||
|
@ -54,8 +54,6 @@ public class ArrowPainter implements IPainter {
|
|||
|
||||
long scaleFactor;
|
||||
|
||||
boolean deferUpdate;
|
||||
|
||||
public ArrowPainter(WaveformCanvas waveCanvas, RelationType relationType) {
|
||||
this.waveCanvas = waveCanvas;
|
||||
highlightType=relationType;
|
||||
|
@ -90,15 +88,15 @@ public class ArrowPainter implements IPainter {
|
|||
return res.isPresent()? res.get():0;
|
||||
}
|
||||
|
||||
protected void calculateGeometries() {
|
||||
deferUpdate = false;
|
||||
protected boolean calculateGeometries() {
|
||||
iRect.clear();
|
||||
oRect.clear();
|
||||
IWaveformPainter painter = waveCanvas.wave2painterMap.get(tx.getStream());
|
||||
if(painter == null)
|
||||
painter = waveCanvas.wave2painterMap.get(tx.getGenerator());
|
||||
if (painter == null) { // stream has been added but painter not yet
|
||||
// created
|
||||
deferUpdate = true;
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
int laneHeight = painter.getHeight() / tx.getStream().getRowCount();
|
||||
txRectangle = new Rectangle((int) (tx.getBeginTime() / scaleFactor),
|
||||
|
@ -106,6 +104,7 @@ public class ArrowPainter implements IPainter {
|
|||
(int) ((tx.getEndTime() - tx.getBeginTime()) / scaleFactor), laneHeight);
|
||||
deriveGeom(tx.getIncomingRelations(), iRect, false);
|
||||
deriveGeom(tx.getOutgoingRelations(), oRect, true);
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void deriveGeom(Collection<ITxRelation> relations, List<LinkEntry> res, boolean useTarget) {
|
||||
|
@ -160,11 +159,9 @@ public class ArrowPainter implements IPainter {
|
|||
Color highliteColor = waveCanvas.styleProvider.getColor(WaveformColors.REL_ARROW_HIGHLITE);
|
||||
|
||||
if(tx==null) return;
|
||||
if (!deferUpdate) {
|
||||
scaleFactor = waveCanvas.getScaleFactor();
|
||||
calculateGeometries();
|
||||
}
|
||||
if(deferUpdate) return;
|
||||
scaleFactor = waveCanvas.getScaleFactor();
|
||||
if(calculateGeometries())
|
||||
return;
|
||||
int correctionValue = (int)(selectionOffset);
|
||||
Rectangle correctedTargetRectangle = new Rectangle(txRectangle.x+correctionValue, txRectangle.y, txRectangle.width, txRectangle.height);
|
||||
for (LinkEntry entry : iRect) {
|
||||
|
|
|
@ -19,7 +19,7 @@ import org.eclipse.swt.graphics.Rectangle;
|
|||
import org.eclipse.wb.swt.SWTResourceManager;
|
||||
|
||||
public class RulerPainter implements IPainter {
|
||||
protected WaveformCanvas waveCanvas;
|
||||
protected final WaveformCanvas waveCanvas;
|
||||
|
||||
static final int RULER_TICK_MINOR = 10;
|
||||
static final int RULER_TICK_MAJOR = 100;
|
||||
|
|
|
@ -46,8 +46,16 @@ public class StreamPainter extends TrackPainter{
|
|||
}
|
||||
|
||||
public void paintArea(Projection proj, Rectangle area) {
|
||||
if(stream.getEvents().size()==0) return;
|
||||
int trackHeight=trackEntry.height/stream.getRowCount();
|
||||
if(stream.getEvents().size()==0) {
|
||||
proj.setFillRule(SWT.FILL_EVEN_ODD);
|
||||
proj.setLineStyle(SWT.LINE_SOLID);
|
||||
proj.setLineWidth(1);
|
||||
proj.setForeground(this.waveCanvas.styleProvider.getColor(WaveformColors.LINE));
|
||||
for( int y1=area.y+trackHeight/2; y1<area.y+trackEntry.height; y1+=trackHeight)
|
||||
proj.drawLine(area.x, y1, area.x+area.width, y1);
|
||||
return;
|
||||
}
|
||||
txBase=trackHeight/5;
|
||||
txHeight=trackHeight*3/5;
|
||||
if(trackEntry.selected) {
|
||||
|
|
|
@ -179,10 +179,10 @@ public class WaveformCanvas extends Canvas {
|
|||
|
||||
public void setZoomLevel(int level, long centerTime) {
|
||||
//FIXME: keep center if zoom-out and cursor is not in view
|
||||
long oldScaleFactor=scaleFactor;
|
||||
if(level<0) level = 0;
|
||||
long xc=centerTime/this.scaleFactor; // cursor total x-offset
|
||||
if(level<Constants.UNIT_MULTIPLIER.length*Constants.UNIT_STRING.length){
|
||||
this.scaleFactor = (long) Math.pow(10, level/2d);
|
||||
this.scaleFactor = (long) Math.pow(10, level>>1);
|
||||
if(level%2==1) this.scaleFactor*=3;
|
||||
ITx tx = arrowPainter.getTx();
|
||||
arrowPainter.setTx(null);
|
||||
|
@ -192,7 +192,6 @@ public class WaveformCanvas extends Canvas {
|
|||
* xcn = tc/newScaleFactor
|
||||
* t0n = (xcn-xoffs)*scaleFactor
|
||||
*/
|
||||
long xc=centerTime/oldScaleFactor; // cursor total x-offset
|
||||
long xoffs=xc+origin.x; // cursor offset relative to left border
|
||||
long xcn=centerTime/scaleFactor; // new total x-offset
|
||||
long originX=xcn-xoffs;
|
||||
|
|
|
@ -337,7 +337,11 @@ public class FileBrowserDialog extends TrayDialog {
|
|||
if(f instanceof File) {
|
||||
if(matchers.isEmpty()) return true;
|
||||
for (PathMatcher m : matchers) {
|
||||
try {
|
||||
if(m.matches(((File)f).toPath())) return true;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue