GNOME Bugzilla – Bug 505892
[PATCH] base 2 logarithm
Last modified: 2008-01-01 18:30:13 UTC
This patch adds support for base 2 logarithm. It doesn't handle button placement because I didn't know where you want it to be put.
Created attachment 101672 [details] [review] patch
Thanks Robert! Well we really should place the three log functions together, so I suggest the following rearrangement in the scientific view: ... [ Log ] [ Ln ] [ Lg2 ] [ Acc ] ... [ 10x ] [ xy ] [ x! ] [Rand ] ... [ Sin ] [ Tan ] [ Mod ] ... [ AND ] [ NOT ] [ XOR ] [XNOR ] ... ... ... ... ... So that just leaves the one blank (empty) area to the right of the Mod key. Robert (Ancell), if you are interested in making these changes to the Glade file and hooking up all the logic, then please go ahead. If you do, I'll update the online help and the manual pages when I return to work next Wednesday. Looks like there might be a slight change needed: + N_("Base 2 log [G]"), ... + { GDK_G, 0 }, needs to be: + N_("Base 2 log [H]"), ... + { GDK_H, 0 }, assuming "H" isn't already used as a keyboard accelerator elsewhere.
On second thoughts, let's make the new button label "log2" rather than "lg2". There are already some four character labels, so it shouldn't affect sizing.
Created attachment 101713 [details] [review] Adds log2 button Adds the log2 button required. I moved the buttons around a little more so the inverse operations (e^x/ln, 10^10/Log_10) are beside each other. Note we could do these operations through the inv mode (and add a 2^x button). I can't get the patch to apply to the svn head so I haven't linked up the new function. The button_widgets array in gtk.c needs to be updated to have a "logarithm2" entry.
Looking more closely this patch is for the 2.20 release. Robert, could you update the patch for 2.21 (svn head) please?
Created attachment 101727 [details] [review] log2 backend function Sorry, I didn't think trunk would be too different. Here's an update. I tested it in combination with Robert Ancell's GUI patch.
See also bug #336609, which suggests a more general function in line with Robert's suggestion in comment #4.
Created attachment 101944 [details] [review] Combined patch. Also adjusts the keyboard accelerator for the new button to "H" in gtk.c, adds in online help for this new button (plus a new screenshot of the scientific panel) and updates the gcalctool manual pages.
Patch has been committed. Closing as FIXED. Thanks!
Thanks to you! :-)