From 156abe63cd1fc8130665bf4332877ffac216959a Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Wed, 17 Feb 2021 20:24:25 +0000 Subject: [PATCH 1/2] fix display bug --- .gitignore | 3 ++- .settings/org.eclipse.m2e.core.prefs | 4 ---- .../ui/swt/internal/ArrowPainter.java | 21 ++++++++----------- .../ui/swt/internal/RulerPainter.java | 2 +- .../ui/swt/internal/StreamPainter.java | 10 ++++++++- .../ui/swt/internal/WaveformCanvas.java | 5 ++--- .../application/parts/FileBrowserDialog.java | 4 ++++ 7 files changed, 27 insertions(+), 22 deletions(-) delete mode 100644 .settings/org.eclipse.m2e.core.prefs diff --git a/.gitignore b/.gitignore index 196589c..8beb988 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ SCViewer.xcf SCViewer_1.png copyrightLog.txt /workspace -?*.launch \ No newline at end of file +?*.launch +/.settings/ diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f..0000000 --- a/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/ArrowPainter.java b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/ArrowPainter.java index e5b6cc7..f867b70 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/ArrowPainter.java +++ b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/ArrowPainter.java @@ -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 relations, List 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) { diff --git a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/RulerPainter.java b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/RulerPainter.java index 8408294..275ed94 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/RulerPainter.java +++ b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/RulerPainter.java @@ -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; diff --git a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/StreamPainter.java b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/StreamPainter.java index ab5274e..1d451fe 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/StreamPainter.java +++ b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/StreamPainter.java @@ -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>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; diff --git a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/FileBrowserDialog.java b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/FileBrowserDialog.java index 24a1074..f3924fc 100644 --- a/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/FileBrowserDialog.java +++ b/plugins/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/FileBrowserDialog.java @@ -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; From 799f083a7427a8fdffb954c52cdc1bcacf0f28bf Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Wed, 17 Feb 2021 21:14:28 +0000 Subject: [PATCH 2/2] fix hierarchy display --- .../minres/scviewer/database/internal/WaveformDb.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/internal/WaveformDb.java b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/internal/WaveformDb.java index d74db46..c4d829f 100644 --- a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/internal/WaveformDb.java +++ b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/internal/WaveformDb.java @@ -226,14 +226,13 @@ public class WaveformDb extends HierNode implements IWaveformDb, PropertyChangeL break; } } - if (childNode != null) { + if (childNode == null) { + HierNode newNode = new HierNode(name, node); + node.addChild(newNode); + node = newNode; + } else { node = childNode; - break; } - HierNode newNode = new HierNode(name, node); - node.addChild(newNode); - node = newNode; - } node.addChild(waveform); waveform.setParent(node);