GNOME Bugzilla – Bug 157961
gcalctool-ng - Bitcalculating extension for gcalctool
Last modified: 2006-09-22 15:31:06 UTC
Bitcalculating extension for (g)calctool just as already said in the mail to Rich I've done an extension for calctool-2.4pl13 which may also a nice to have feature for successor gcalctool. The patch in the attachment implemenst a further window for displaying the bitvalue of the current displayed number with buttons for every bit. In other words: if the window is pop up, any typed number regardless of its basic is shown with highlighted buttons representing the bit value. The user is able to change directly the bit values which is also visible in the changed value in the number display. For an impression see http://www.suse.de/~werner/bitcalc1.png http://www.suse.de/~werner/bitcalc2.png ... In the patch the cpp macro USE_BITCALC is used to switch the feature on or off at compile time. Maybe some lines of the code can be used for implementing the Bitcalculating extension in the scientific format.
Created attachment 33677 [details] Image showing feature applied to very old calctool.
Created attachment 33678 [details] Another image showing feature.
Created attachment 33679 [details] Patch for this feature to very old version of calctool. Note that this patch would have to be reworked to make it applicable for gcalctool.
The latest version of the calculator in Mac OS X (Tiger) has this for the Programmer View, and it's very nice. The only thing that's preventing this in gcalctool is how to handle it in arithmetic operator precedence mode where there is an expression being built up in the display area. The Mac calculator doesn't have this problem because it only ever displays the latest number being entered (and it correctly does arithmetic operator precedence). If anybody has any idea how to implement the bit calculation display for arithmetic operator precedence mode with our current setup, please let me know.
Created attachment 52573 [details] Patch to implement this functionality for non-arithmetic operator precedence mode. Two changes: * Adjusted the mpcmim() routine in mp.c. The fix for Sun bug #4006391 needed to also preserve v->toclear and v->pointed. * Implemented the bit panel for non-arithmetic precedence mode. It's automatically displayed when in Scientific mode. It is only sensitive when integer (upto 64 bit integers) are being displayed.
Changes to implement this functionality for non-arithmetic operator precedence mode have been checked into CVS HEAD. I've bumped the version number in configure.in to 5.7.6. Transferring to Sami now, to see if he can implement similar functionality for arithmetic operator precedence mode.
*** Bug 310902 has been marked as a duplicate of this bug. ***
Adjusting summary to reflect that this enhancement still needs to be implemented for the arithmetic operator precedence mode.
Created attachment 73174 [details] [review] A preview of bitcalculation extension for arithmetic precedence mode. A preview of bitcalculation extension for arithmetic precedence mode. The existing bitcalculating extension don't seem to be able to handle negative numbers. Rich, are you able to modify the printing in such a way that the negative numbers are also handled?
I've checked in your changes (thanks!). It should be able to handle negative numbers with the big calculating extension. I've opened a new enhancement request to cover this. See bug #357208. As we now have a par for this feature in both arithmetic modes, I'm closing this bug as FIXED. I'll also update the documentation bug #309210 with the suggested changes needed to the gcalctool documentation.