From 361a18b38e3de13a99dc84aefe274bc4df0893e1 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sun, 19 Mar 2023 11:23:25 +0100 Subject: [PATCH] changes value representation in waves --- .../database/ui/swt/internal/SignalPainter.java | 12 +++++++++--- .../src/com/minres/scviewer/database/BitVector.java | 5 ++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/SignalPainter.java b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/SignalPainter.java index 6cca4a1..a7a2d85 100644 --- a/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/SignalPainter.java +++ b/plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/SignalPainter.java @@ -224,17 +224,23 @@ public class SignalPainter extends TrackPainter { label=last.toString(); break; default: - label="h'"+last.toHexString(); + label=/*"h'"+*/last.toHexString(); } - Point bb = new Point(DUMMY_PANEL.getFontMetrics(tmpAwtFont).stringWidth(label), height); if (xBegin < area.x) { xBegin = area.x; width = xEnd - xBegin; } + Point bb = new Point(DUMMY_PANEL.getFontMetrics(tmpAwtFont).stringWidth(label), height); + String ext = ""; + while(width1) { + label = label.substring(0, label.length()-1); + ext="+"; + bb = new Point(DUMMY_PANEL.getFontMetrics(tmpAwtFont).stringWidth(label +ext), height); + } if (width > (bb.x+1)) { Rectangle old = proj.getClipping(); proj.setClipping(xBegin + 3, yOffsetT, xEnd - xBegin - 5, yOffsetB - yOffsetT); - proj.drawText(label, xBegin + 3, yOffsetM - bb.y / 2 - 1); + proj.drawText(label+ext, xBegin + 3, yOffsetM - bb.y / 2 - 1); proj.setClipping(old); } } else { diff --git a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/BitVector.java b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/BitVector.java index 79ab4a7..f34ca0a 100644 --- a/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/BitVector.java +++ b/plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/BitVector.java @@ -11,6 +11,7 @@ package com.minres.scviewer.database; import java.math.BigInteger; +import java.util.Arrays; /** * The Class BitVector. @@ -168,7 +169,9 @@ public class BitVector implements IEvent { } res[i] = Character.forDigit(digit, 16); // ((digit < 10) ? '0' + digit : 'a' + digit -10) } - return new String(res); + int idx=0; + while(res[idx]=='0' && idx<(res.length-1)) idx++; + return new String( Arrays.copyOfRange(res, idx, res.length)); } /**