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..813824b 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
@@ -126,24 +126,17 @@ public class ArrowPainter implements IPainter {
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 +153,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..7a3fef9 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
@@ -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