After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 505892 - [PATCH] base 2 logarithm
[PATCH] base 2 logarithm
Status: RESOLVED FIXED
Product: gnome-calculator
Classification: Core
Component: general
5.20.x
Other All
: Normal enhancement
: ---
Assigned To: gcalctool maintainers
gcalctool maintainers
Depends on:
Blocks:
 
 
Reported: 2007-12-27 13:29 UTC by Robert Millan
Modified: 2008-01-01 18:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (5.32 KB, patch)
2007-12-27 13:30 UTC, Robert Millan
none Details | Review
Adds log2 button (13.23 KB, patch)
2007-12-28 00:30 UTC, Robert Ancell
none Details | Review
log2 backend function (4.55 KB, patch)
2007-12-28 13:28 UTC, Robert Millan
none Details | Review
Combined patch. (21.89 KB, patch)
2008-01-01 17:33 UTC, Rich Burridge
committed Details | Review

Description Robert Millan 2007-12-27 13:29:37 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.
Comment 1 Robert Millan 2007-12-27 13:30:22 UTC
Created attachment 101672 [details] [review]
patch
Comment 2 Rich Burridge 2007-12-27 16:37:04 UTC
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.
Comment 3 Rich Burridge 2007-12-27 16:48:20 UTC
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.
Comment 4 Robert Ancell 2007-12-28 00:30:04 UTC
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.
Comment 5 Robert Ancell 2007-12-28 00:33:15 UTC
Looking more closely this patch is for the 2.20 release. Robert, could you update the patch for 2.21 (svn head) please?
Comment 6 Robert Millan 2007-12-28 13:28:37 UTC
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.
Comment 7 Rich Burridge 2007-12-29 03:56:48 UTC
See also bug #336609, which suggests a more general function
in line with Robert's suggestion in comment #4.
Comment 8 Rich Burridge 2008-01-01 17:33:50 UTC
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.
Comment 9 Rich Burridge 2008-01-01 17:34:25 UTC
Patch has been committed. Closing as FIXED. Thanks!
Comment 10 Robert Millan 2008-01-01 18:30:13 UTC
Thanks to you! :-)