four digits shown in pen width

This commit is contained in:
Zeno Rogue 2017-12-22 21:58:09 +01:00
parent dd108cde6b
commit 04cc9300bf
2 changed files with 26 additions and 3 deletions

View File

@ -577,7 +577,7 @@ namespace dialog {
if(ne.positive && x <= 0) return;
*ne.editwhat = x;
}
if(kind == 'v') ne.s = fts(*ne.editwhat);
if(kind == 'v') ne.s = disp(*ne.editwhat);
}
if(reaction) reaction();
@ -758,7 +758,7 @@ namespace dialog {
double d = exp(shiftmul/10);
vid.alpha *= d;
vid.scale *= d;
ne.s = fts(vid.alpha);
ne.s = disp(vid.alpha);
}
else if(doexiton(sym, uni)) popScreen();
};
@ -815,7 +815,7 @@ namespace dialog {
void editNumber(ld& x, ld vmin, ld vmax, ld step, ld dft, string title, string help) {
ne.editwhat = &x;
ne.s = fts(x);
ne.s = disp(x);
ne.vmin = vmin;
ne.vmax = vmax;
ne.step = step;

View File

@ -16,6 +16,29 @@ string ftssmart(ld x) {
return buf;
}
/*
string fts_smartdisplay(ld x, int maxdisplay) {
string rv;
if(x > 1e9 || x < -1e9) retrun fts(x);
if(x<0) { rv = "-"; x = -x; }
int i = int(x);
rv += its(i);
x -= i;
bool nonzero = i;
if(x == 0) return rv;
if(x < 1e-9 && nonzero) return rv;
rv += ".";
while(maxdisplay > 0) {
x *= 10;
rv += '0' + int(x);
if(int(x)) nonzero = true;
x -= int(x);
if(x == 0) return rv;
if(x < 1e-9 && nonzero) return rv;
maxdisplay--;
}
} */
string cts(char c) { char buf[8]; buf[0] = c; buf[1] = 0; return buf; }
string llts(long long i) {
// sprintf does not work on Windows IIRC