diff options
author | B. Watson <urchlay@slackware.uk> | 2024-01-10 09:38:27 -0500 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2024-01-10 09:38:27 -0500 |
commit | b4c06fc38ae74e1c58cd2bf9866e65a26a412696 (patch) | |
tree | 12c60e3dac2f40b679e0f0853178183a63e28971 /input.c | |
parent | de4dffd8bb02dbd2969edc44e4915decb75e9b1d (diff) | |
download | hcalc-b4c06fc38ae74e1c58cd2bf9866e65a26a412696.tar.gz |
Add twos complement, center-click anywhere to paste.
Diffstat (limited to 'input.c')
-rw-r--r-- | input.c | 33 |
1 files changed, 26 insertions, 7 deletions
@@ -403,6 +403,16 @@ key(char c) show_value(); break; + case '@': /* Two's complement */ + end_number(); + { + unsigned int i = ((unsigned int)value) & 0xffffffff; + value = ~i + 1; + } + saved = value; + show_value(); + break; + case '<': /* SHL by one bit only */ /* Modified by Keith Meehl to fix bit shift bug*/ end_number(); @@ -525,6 +535,13 @@ complete_paste(unsigned char *s, int n) void button(int b, int x, int y) { + char k; + + if(b == 2) { + paste(); + return; + } + x = (x-2)/(24 * scale_factor); if (x < 0) x = 0; if (x > 4) x = 4; @@ -532,17 +549,19 @@ button(int b, int x, int y) if (y < 0) y = 0; if (y > 8) y = 8; - if (bmap[y][x] == 27 && b == 3) + k = bmap[y][x]; + + if (k == 27 && b == 3) exit(0); - if (bmap[y][x] == 'P' && b == 1) + if (k == 'P' && b == 1) copy(); - if (bmap[y][x] == 'P' && b != 1) + else if (k == 'P' && b != 1) paste(); - - if(bmap[y][x] == '/' && b != 1) + else if(k == '/' && b != 1) key('%'); + else if(k == '~' && b != 1) + key('@'); else - key(bmap[y][x]); - /* printf("bmap[%i][%i] and b=%i\n", y, x, b); */ + key(k); } |