diff --git a/.gitignore b/.gitignore
index c4a2686..33bbbd1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,4 @@ SCViewer.xcf
SCViewer_1.png
*.launch
copyrightLog.txt
+/workspace
diff --git a/plugins/com.minres.scviewer.database.sqlite/.settings/org.eclipse.jdt.core.prefs b/plugins/com.minres.scviewer.database.sqlite/.settings/org.eclipse.jdt.core.prefs
index 0c68a61..9f6ece8 100644
--- a/plugins/com.minres.scviewer.database.sqlite/.settings/org.eclipse.jdt.core.prefs
+++ b/plugins/com.minres.scviewer.database.sqlite/.settings/org.eclipse.jdt.core.prefs
@@ -4,4 +4,5 @@ org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
diff --git a/plugins/com.minres.scviewer.database.text/.classpath b/plugins/com.minres.scviewer.database.text/.classpath
index 564bae4..289f0a4 100644
--- a/plugins/com.minres.scviewer.database.text/.classpath
+++ b/plugins/com.minres.scviewer.database.text/.classpath
@@ -18,6 +18,5 @@
-
diff --git a/plugins/com.minres.scviewer.database.text/.settings/org.eclipse.jdt.groovy.core.prefs b/plugins/com.minres.scviewer.database.text/.settings/org.eclipse.jdt.groovy.core.prefs
index 1e68ed6..71b5e37 100644
--- a/plugins/com.minres.scviewer.database.text/.settings/org.eclipse.jdt.groovy.core.prefs
+++ b/plugins/com.minres.scviewer.database.text/.settings/org.eclipse.jdt.groovy.core.prefs
@@ -1,3 +1,3 @@
eclipse.preferences.version=1
-groovy.compiler.level=25
+groovy.compiler.level=-1
groovy.script.filters=**/*.dsld,y,**/*.gradle,n
diff --git a/plugins/com.minres.scviewer.database.ui.swt/.settings/org.eclipse.jdt.core.prefs b/plugins/com.minres.scviewer.database.ui.swt/.settings/org.eclipse.jdt.core.prefs
index ce96ddf..ddb046a 100644
--- a/plugins/com.minres.scviewer.database.ui.swt/.settings/org.eclipse.jdt.core.prefs
+++ b/plugins/com.minres.scviewer.database.ui.swt/.settings/org.eclipse.jdt.core.prefs
@@ -98,4 +98,5 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
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 966dc9f..0c58157 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
@@ -49,7 +49,7 @@ public class ArrowPainter implements IPainter {
long scaleFactor;
- boolean deferredUpdate;
+ boolean deferUpdate;
public ArrowPainter(WaveformCanvas waveCanvas, RelationType relationType) {
this.waveCanvas = waveCanvas;
@@ -80,12 +80,14 @@ public class ArrowPainter implements IPainter {
}
protected void calculateGeometries() {
- deferredUpdate = false;
+ deferUpdate = false;
+ iRect.clear();
+ oRect.clear();
ITxStream> stream = tx.getStream();
IWaveformPainter painter = waveCanvas.wave2painterMap.get(stream);
if (painter == null) { // stream has been added but painter not yet
// created
- deferredUpdate = true;
+ deferUpdate = true;
return;
}
int laneHeight = painter.getHeight() / stream.getMaxConcurrency();
@@ -117,33 +119,27 @@ public class ArrowPainter implements IPainter {
Color fgColor = waveCanvas.colors[WaveformColors.REL_ARROW.ordinal()];
Color highliteColor = waveCanvas.colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()];
- if (deferredUpdate || (tx != null && waveCanvas.getScaleFactor() != scaleFactor)) {
+ if(tx==null) return;
+ if (!deferUpdate) {
scaleFactor = waveCanvas.getScaleFactor();
calculateGeometries();
}
- if(txRectangle == null) return;
+ if(deferUpdate) return;
int correctionValue = (int)(selectionOffset);
Rectangle correctedTargetRectangle = new Rectangle(txRectangle.x+correctionValue, txRectangle.y, txRectangle.width, txRectangle.height);
for (LinkEntry entry : iRect) {
Rectangle correctedRectangle = new Rectangle(entry.rectangle.x+correctionValue, entry.rectangle.y, entry.rectangle.width, entry.rectangle.height);
- Point target = drawPath(proj, highlightType.equals(entry.relationType) ? highliteColor : fgColor,
+ drawArrow(proj, highlightType.equals(entry.relationType) ? highliteColor : fgColor,
correctedRectangle, correctedTargetRectangle);
- drawArrow(proj, target);
}
for (LinkEntry entry : oRect) {
Rectangle correctedRectangle = new Rectangle(entry.rectangle.x+correctionValue, entry.rectangle.y, entry.rectangle.width, entry.rectangle.height);
- Point target = drawPath(proj, highlightType.equals(entry.relationType) ? highliteColor : fgColor, correctedTargetRectangle,
+ drawArrow(proj, highlightType.equals(entry.relationType) ? highliteColor : fgColor, correctedTargetRectangle,
correctedRectangle);
- drawArrow(proj, target);
}
}
- protected void drawArrow(Projection proj, Point target) {
- proj.drawLine(target.x - 8, target.y - 5, target.x, target.y);
- proj.drawLine(target.x - 8, target.y + 5, target.x, target.y);
- }
-
- protected Point drawPath(Projection proj, Color fgColor, Rectangle srcRectangle, Rectangle tgtRectangle) {
+ protected void drawArrow(Projection proj, Color fgColor, Rectangle srcRectangle, Rectangle tgtRectangle) {
Point point1 = proj.project(new Point(srcRectangle.x, srcRectangle.y + srcRectangle.height / 2));
Point point2 = proj.project(new Point(tgtRectangle.x, tgtRectangle.y + tgtRectangle.height / 2));
@@ -160,11 +156,15 @@ public class ArrowPainter implements IPainter {
path.cubicTo(center.x + xCtrlOffset, center.y, point2.x - xCtrlOffset, point2.y, point2.x, point2.y);
} else
path.cubicTo(point1.x + xCtrlOffset, point1.y, point2.x - xCtrlOffset, point2.y, point2.x, point2.y);
+
proj.setAntialias(SWT.ON);
proj.setForeground(fgColor);
proj.getGC().drawPath(path);
path.dispose();
- return point2;
+ // now draw the arrow head
+ proj.getGC().drawLine(point2.x - 8, point2.y - 5, point2.x, point2.y);
+ proj.getGC().drawLine(point2.x - 8, point2.y + 5, point2.x, point2.y);
+
}
class LinkEntry {
diff --git a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/Projection.java b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/Projection.java
index d13aaca..a85db0a 100644
--- a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/Projection.java
+++ b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/Projection.java
@@ -44,10 +44,6 @@ public class Projection {
public void setFillRule(int rule) {
gc.setFillRule(rule);
}
- public void fillRectangle(Rectangle rect) {
- gc.fillRectangle(rect.x+translation.x, rect.y+translation.y, rect.width, rect.height);
- }
-
public void setLineStyle(int style) {
gc.setLineStyle(style);
}
@@ -69,6 +65,10 @@ public class Projection {
return gc;
}
+ public void fillRectangle(Rectangle rect) {
+ gc.fillRectangle(rect.x+translation.x, rect.y+translation.y, rect.width, rect.height);
+ }
+
public void drawRectangle(Rectangle rect) {
gc.drawRectangle(rect.x+translation.y, rect.y+translation.y, rect.width, rect.height);
}
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 289e1f8..a746fde 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
@@ -135,9 +135,6 @@ public class StreamPainter extends TrackPainter{
if(bb.x+bb.widtharea.x+area.width) return;
if(bb.width==0){
proj.drawLine(bb.x, bb.y, bb.x, bb.y+bb.height);
- } else if(bb.width<10){
- proj.fillRectangle(bb);
- proj.drawRectangle(bb);
} else {
if(bb.x < area.x) {
bb.width = bb.width-(area.x-bb.x)+5;
@@ -149,8 +146,9 @@ public class StreamPainter extends TrackPainter{
bb_x2=area_x2+5;
bb.width= bb_x2-bb.x;
}
- proj.fillRoundRectangle(bb.x, bb.y, bb.width, bb.height, 5, 5);
- proj.drawRoundRectangle(bb.x, bb.y, bb.width, bb.height, 5, 5);
+ int arc = bb.width<10?1:5;
+ proj.fillRoundRectangle(bb.x, bb.y, bb.width, bb.height, arc, arc);
+ proj.drawRoundRectangle(bb.x, bb.y, bb.width, bb.height, arc, arc);
}
}
diff --git a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformCanvas.java b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformCanvas.java
index 1a105e9..2d0f9cf 100644
--- a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformCanvas.java
+++ b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformCanvas.java
@@ -111,10 +111,10 @@ public class WaveformCanvas extends Canvas {
// order is important: it is bottom to top
trackAreaPainter=new TrackAreaPainter(this);
painterList.add(trackAreaPainter);
- rulerPainter=new RulerPainter(this);
- painterList.add(rulerPainter);
arrowPainter=new ArrowPainter(this, IWaveformView.NEXT_PREV_IN_STREAM);
painterList.add(arrowPainter);
+ rulerPainter=new RulerPainter(this);
+ painterList.add(rulerPainter);
CursorPainter cp = new CursorPainter(this, scaleFactor * 10, cursorPainters.size()-1);
painterList.add(cp);
cursorPainters.add(cp);
@@ -229,10 +229,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;
if(level0) {
- origin.x=(int) -originX; // new cursor time offset relative to left border
- }else {
- origin.x=0;
- }
+ 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;
+ if(originX>0) {
+ origin.x=(int) -originX; // new cursor time offset relative to left border
+ }else {
+ origin.x=0;
+ }
syncScrollBars();
arrowPainter.setTx(tx);
redraw();
+ this.level = level;
}
}
@@ -400,12 +401,13 @@ public class WaveformCanvas extends Canvas {
/* Paint function */
private void paint(GC gc) {
+ Point pt = getSize();
+ if(pt.x==0 || pt.y==0) return;
Rectangle clientRect = getClientArea(); /* Canvas' painting area */
GC thisGc = gc;
Image d_backingImg = null;
if(doubleBuffering) {
- Point p = getSize();
- d_backingImg = new Image(getDisplay(), p.x, p.y);
+ d_backingImg = new Image(getDisplay(), pt.x, pt.y);
thisGc = new GC(d_backingImg);
thisGc.setBackground(gc.getBackground());
thisGc.setForeground(gc.getForeground());
diff --git a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformView.java b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformView.java
index 68882c2..08e8c76 100644
--- a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformView.java
+++ b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/WaveformView.java
@@ -52,7 +52,6 @@ import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionAdapter;
@@ -170,37 +169,11 @@ public class WaveformView implements IWaveformView {
}
};
- class WaveformMouseListener implements MouseMoveListener, MouseListener, PaintListener {
+ class WaveformMouseListener implements PaintListener, Listener {
Point start, end;
List