Skip to content

Commit 361a18b

Browse files
committed
changes value representation in waves
1 parent 354c4a4 commit 361a18b

File tree

2 files changed

+13
-4
lines changed
  • plugins
    • com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal
    • com.minres.scviewer.database/src/com/minres/scviewer/database

2 files changed

+13
-4
lines changed

plugins/com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/ui/swt/internal/SignalPainter.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,17 +224,23 @@ public void draw(Projection proj, Rectangle area, IEvent left, IEvent right, int
224224
label=last.toString();
225225
break;
226226
default:
227-
label="h'"+last.toHexString();
227+
label=/*"h'"+*/last.toHexString();
228228
}
229-
Point bb = new Point(DUMMY_PANEL.getFontMetrics(tmpAwtFont).stringWidth(label), height);
230229
if (xBegin < area.x) {
231230
xBegin = area.x;
232231
width = xEnd - xBegin;
233232
}
233+
Point bb = new Point(DUMMY_PANEL.getFontMetrics(tmpAwtFont).stringWidth(label), height);
234+
String ext = "";
235+
while(width<bb.x && label.length()>1) {
236+
label = label.substring(0, label.length()-1);
237+
ext="+";
238+
bb = new Point(DUMMY_PANEL.getFontMetrics(tmpAwtFont).stringWidth(label +ext), height);
239+
}
234240
if (width > (bb.x+1)) {
235241
Rectangle old = proj.getClipping();
236242
proj.setClipping(xBegin + 3, yOffsetT, xEnd - xBegin - 5, yOffsetB - yOffsetT);
237-
proj.drawText(label, xBegin + 3, yOffsetM - bb.y / 2 - 1);
243+
proj.drawText(label+ext, xBegin + 3, yOffsetM - bb.y / 2 - 1);
238244
proj.setClipping(old);
239245
}
240246
} else {

plugins/com.minres.scviewer.database/src/com/minres/scviewer/database/BitVector.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
package com.minres.scviewer.database;
1212

1313
import java.math.BigInteger;
14+
import java.util.Arrays;
1415

1516
/**
1617
* The Class BitVector.
@@ -168,7 +169,9 @@ public String toHexString() {
168169
}
169170
res[i] = Character.forDigit(digit, 16); // ((digit < 10) ? '0' + digit : 'a' + digit -10)
170171
}
171-
return new String(res);
172+
int idx=0;
173+
while(res[idx]=='0' && idx<(res.length-1)) idx++;
174+
return new String( Arrays.copyOfRange(res, idx, res.length));
172175
}
173176

174177
/**

0 commit comments

Comments
 (0)