Fixed increment value method when in compare mode

git-svn-id: http://svn.3splooges.com/romraider-arch/trunk@136 d2e2e1cd-ba16-0410-be16-b7c4453c7c2d
This commit is contained in:
Jared Gould 2006-07-10 17:09:39 +00:00
parent 32ada19326
commit 4c95275a69
1 changed files with 10 additions and 2 deletions

View File

@ -18,6 +18,7 @@ public class DataCell extends JLabel implements MouseListener, Serializable {
private double originalValue = 0;
private Scale scale = new Scale();
private String displayValue = "";
private double realValue = 0;
private Color scaledColor = new Color(0,0,0);
private Color highlightColor = new Color(155,155,255);
private Color increaseBorder = Color.RED;
@ -165,12 +166,16 @@ public class DataCell extends JLabel implements MouseListener, Serializable {
double oldValue = Double.parseDouble(getText());
if (table.getScale().getCoarseIncrement() < 0) increment = 0 - increment;
setRealValue((Double.parseDouble(displayValue) + increment) + "");
setRealValue((calcDisplayValue(binValue,
scale.getExpression()) + increment) + "");
// make sure table is incremented if change isnt great enough
if (oldValue == Double.parseDouble(getText()) &&
table.getStorageType() != Table.STORAGE_TYPE_FLOAT) {
table.getStorageType() != Table.STORAGE_TYPE_FLOAT) {
setBinValue(binValue + (increment / Math.abs(increment)));
}
table.colorize();
@ -216,10 +221,13 @@ public class DataCell extends JLabel implements MouseListener, Serializable {
parser.initSymTab(); // clear the contents of the symbol table
parser.addVariable("x", Double.parseDouble(input));
parser.parseExpression(table.getScale().getByteExpression());
if (table.getStorageType() == Table.STORAGE_TYPE_FLOAT) {
this.setBinValue(parser.getValue());
} else {
this.setBinValue((int)Math.round(parser.getValue()));
}
}
}