[gcalctool/gcalctool-newui2] ...



commit 7d7342b35c73ab53b96354398e297f3ead71521a
Author: Robert Ancell <robert ancell gmail com>
Date:   Thu Sep 24 11:32:49 2009 +1000

    ...

 configure.in      |    2 +-
 data/gcalctool.ui |  340 +++++++++++++++------------------------------------
 po/POTFILES.in    |    1 -
 src/Makefile.am   |    2 -
 src/calctool.c    |    1 -
 src/display.c     |  333 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 src/display.h     |   25 ++++-
 src/functions.c   |  348 -----------------------------------------------------
 src/functions.h   |   47 -------
 src/gtk.c         |   46 ++++++-
 10 files changed, 494 insertions(+), 651 deletions(-)
---
diff --git a/configure.in b/configure.in
index 106e382..bc8f0d9 100644
--- a/configure.in
+++ b/configure.in
@@ -1,7 +1,7 @@
 Process this file with autoconf to produce a configure script.
 
 AC_INIT(configure.in)
-AM_INIT_AUTOMAKE(gcalctool, 5.27.3)
+AM_INIT_AUTOMAKE(gcalctool, 5.29.0)
 AC_CONFIG_MACRO_DIR([m4])
 AM_CONFIG_HEADER(config.h)
 AM_MAINTAINER_MODE
diff --git a/data/gcalctool.ui b/data/gcalctool.ui
index a00a0f4..56e831a 100644
--- a/data/gcalctool.ui
+++ b/data/gcalctool.ui
@@ -861,7 +861,7 @@
                   <object class="GtkLabel" id="bit_marker_label0">
                     <property name="visible">True</property>
                     <property name="xalign">0</property>
-                    <property name="label" translatable="yes" comments="Label for the most significant bit (bit 63) on the bit editor">63</property>
+                    <property name="label">63</property>
                     <property name="justify">center</property>
                   </object>
                   <packing>
@@ -875,7 +875,7 @@
                   <object class="GtkLabel" id="bit_maker_label3">
                     <property name="visible">True</property>
                     <property name="xalign">0</property>
-                    <property name="label" translatable="yes" comments="Label for bit 31 on the bit editor">31</property>
+                    <property name="label">31</property>
                     <property name="justify">center</property>
                   </object>
                   <packing>
@@ -889,7 +889,7 @@
                   <object class="GtkLabel" id="bit_marker_label2">
                     <property name="visible">True</property>
                     <property name="xalign">0</property>
-                    <property name="label" translatable="yes" comments="Label for bit 32 on the bit editor">32</property>
+                    <property name="label">32</property>
                     <property name="justify">center</property>
                   </object>
                   <packing>
@@ -905,7 +905,7 @@
                   <object class="GtkLabel" id="bit_marker_label5">
                     <property name="visible">True</property>
                     <property name="xalign">0</property>
-                    <property name="label" translatable="yes" comments="Label for the least significant bit (bit 0) on the bit editor">0</property>
+                    <property name="label" translatable="yes">0</property>
                     <property name="justify">center</property>
                   </object>
                   <packing>
@@ -1591,7 +1591,7 @@
                   <object class="GtkLabel" id="bit_marker_label1">
                     <property name="visible">True</property>
                     <property name="xalign">0</property>
-                    <property name="label" translatable="yes" comments="Label for bit 47 on the bit editor">47</property>
+                    <property name="label">47</property>
                     <property name="justify">center</property>
                   </object>
                   <packing>
@@ -1607,7 +1607,7 @@
                   <object class="GtkLabel" id="bit_marker_label4">
                     <property name="visible">True</property>
                     <property name="xalign">0</property>
-                    <property name="label" translatable="yes" comments="Label for bit 15 on the bit editor">15</property>
+                    <property name="label">15</property>
                     <property name="justify">center</property>
                   </object>
                   <packing>
@@ -2209,19 +2209,14 @@
                 </child>
                 <child>
                   <object class="GtkButton" id="calc_divide_button">
-                    <property name="label" translatable="yes" comments="Division button">&#xF7;</property>
+                    <property name="label">&#xF7;</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
-                    <property name="tooltip_text" translatable="yes">Divide [/]</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the division button">Divide [/]</property>
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="calc_divide_button-atkobject">
-                        <property name="AtkObject::accessible-name" translatable="yes">Divide</property>
-                      </object>
-                    </child>
                     <signal name="clicked" handler="button_cb"/>
                   </object>
                   <packing>
@@ -2256,7 +2251,7 @@
                 </child>
                 <child>
                   <object class="GtkButton" id="calc_2_button">
-                    <property name="label" translatable="yes" comments="Numeric 2 button">2</property>
+                    <property name="label">2</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
@@ -2308,15 +2303,10 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
-                    <property name="tooltip_text" translatable="yes">Numeric point [. or ,]</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the numeric point button">Numeric point [. or ,]</property>
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="calc_numeric_point_button-atkobject">
-                        <property name="AtkObject::accessible-name" translatable="yes">Numeric point</property>
-                      </object>
-                    </child>
                     <signal name="clicked" handler="button_cb"/>
                   </object>
                   <packing>
@@ -2330,19 +2320,14 @@
                 </child>
                 <child>
                   <object class="GtkButton" id="calc_result_button">
-                    <property name="label" translatable="yes" comments="Solve button (clicking this solves the displayed calculation)">=</property>
+                    <property name="label" translatable="yes" comments="Label on the solve button (clicking this solves the displayed calculation)">=</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
-                    <property name="tooltip_text" translatable="yes">Calculate result [=]</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the solve button">Calculate result [=]</property>
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="calc_result_button-atkobject">
-                        <property name="AtkObject::accessible-name" translatable="yes">Calculate result</property>
-                      </object>
-                    </child>
                     <signal name="clicked" handler="solve_cb"/>
                   </object>
                   <packing>
@@ -2381,20 +2366,14 @@
                 </child>
                 <child>
                   <object class="GtkButton" id="calc_multiply_button">
-                    <property name="label" translatable="yes" comments="Multiplication button">&#xD7;</property>
+                    <property name="label">&#xD7;</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
-                    <property name="tooltip_text" translatable="yes">Multiply [*]</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the multiplication button">Multiply [*]</property>
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="calc_multiply_button-atkobject">
-                        <property name="AtkObject::accessible-name" translatable="yes">Multiply</property>
-                        <property name="AtkObject::accessible-description" translatable="yes">Multiply</property>
-                      </object>
-                    </child>
                     <signal name="clicked" handler="button_cb"/>
                   </object>
                   <packing>
@@ -2408,20 +2387,14 @@
                 </child>
                 <child>
                   <object class="GtkButton" id="calc_subtract_button">
-                    <property name="label" translatable="yes" comments="Subtraction button">&#x2212;</property>
+                    <property name="label">&#x2212;</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
-                    <property name="tooltip_text" translatable="yes">Subtract [-]</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the subtraction button">Subtract [-]</property>
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="calc_subtract_button-atkobject">
-                        <property name="AtkObject::accessible-name" translatable="yes">Subtract</property>
-                        <property name="AtkObject::accessible-description" translatable="yes">Subtract [-]</property>
-                      </object>
-                    </child>
                     <signal name="clicked" handler="button_cb"/>
                   </object>
                   <packing>
@@ -2435,19 +2408,14 @@
                 </child>
                 <child>
                   <object class="GtkButton" id="calc_add_button">
-                    <property name="label" translatable="yes" comments="Addition button">+</property>
+                    <property name="label">+</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
-                    <property name="tooltip_text" translatable="yes">Add [+]</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the addition button">Add [+]</property>
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="calc_add_button-atkobject">
-                        <property name="AtkObject::accessible-name" translatable="yes">Add</property>
-                      </object>
-                    </child>
                     <signal name="clicked" handler="button_cb"/>
                   </object>
                   <packing>
@@ -2461,19 +2429,14 @@
                 </child>
                 <child>
                   <object class="GtkButton" id="calc_clear_button">
-                    <property name="label" translatable="yes" comments="Clear display button. Clr is short for Clear">Clr</property>
+                    <property name="label" translatable="yes" comments="Label on the clear display button. Clr is short for Clear">Clr</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
-                    <property name="tooltip_text" translatable="yes" comments="Clear display tooltip">Clear display [Escape]</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltop for the clear display button">Clear display [Escape]</property>
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="calc_clear_button-atkobject">
-                        <property name="AtkObject::accessible-name" translatable="yes">Clear</property>
-                      </object>
-                    </child>
                     <signal name="clicked" handler="clear_cb"/>
                   </object>
                   <packing>
@@ -2491,14 +2454,10 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the start block button">Start block [(]</property>
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="calc_start_group_button-atkobject">
-                        <property name="AtkObject::accessible-name" translatable="yes">Left bracket</property>
-                      </object>
-                    </child>
                     <signal name="clicked" handler="button_cb"/>
                   </object>
                   <packing>
@@ -2514,14 +2473,10 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the end block button">End block [)]</property>
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="calc_end_group_button-atkobject">
-                        <property name="AtkObject::accessible-name" translatable="yes">Right bracket</property>
-                      </object>
-                    </child>
                     <signal name="clicked" handler="button_cb"/>
                   </object>
                   <packing>
@@ -2535,19 +2490,14 @@
                 </child>
                 <child>
                   <object class="GtkButton" id="calc_percentage_button">
-                    <property name="label" translatable="yes" comments="The percentage button">%</property>
+                    <property name="label">%</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
-                    <property name="tooltip_text" translatable="yes" comments="Percentage button tooltip">Percentage [%]</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip on the percentage button">Percentage [%]</property>
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="calc_percentage_button-atkobject">
-                        <property name="AtkObject::accessible-name" translatable="yes">Percentage</property>
-                      </object>
-                    </child>
                     <signal name="clicked" handler="button_cb"/>
                   </object>
                   <packing>
@@ -2578,13 +2528,9 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the store value button">Store value</property>
                     <property name="border_width">3</property>
                     <property name="focus_on_click">False</property>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="calc_store_button-atkobject">
-                        <property name="AtkObject::accessible-name" translatable="yes">Store to register</property>
-                      </object>
-                    </child>
                     <signal name="clicked" handler="popup_cb"/>
                     <child>
                       <object class="GtkHBox" id="hbox20">
@@ -2593,13 +2539,7 @@
                         <child>
                           <object class="GtkLabel" id="label23">
                             <property name="visible">True</property>
-                            <property name="label" translatable="yes" comments="Memory store button. Sto is short for Store">&#x2190; R</property>
-                            <child internal-child="accessible">
-                              <object class="AtkObject" id="label23-atkobject">
-                                <property name="AtkObject::accessible-name" translatable="yes">Sto</property>
-                                <property name="AtkObject::accessible-description" translatable="yes">Store to register</property>
-                              </object>
-                            </child>
+                            <property name="label" translatable="yes" comments="The label on the memory store button">&#x2190; R</property>
                           </object>
                           <packing>
                             <property name="position">0</property>
@@ -2632,13 +2572,9 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the recall value button">Recall value</property>
                     <property name="border_width">3</property>
                     <property name="focus_on_click">False</property>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="calc_recall_button-atkobject">
-                        <property name="AtkObject::accessible-name" translatable="yes">Retrieve from register</property>
-                      </object>
-                    </child>
                     <signal name="clicked" handler="popup_cb"/>
                     <child>
                       <object class="GtkHBox" id="hbox19">
@@ -2647,13 +2583,7 @@
                         <child>
                           <object class="GtkLabel" id="label22">
                             <property name="visible">True</property>
-                            <property name="label" translatable="yes" comments="Memory recall button. Rcl is short for Recall">&#x2192; R</property>
-                            <child internal-child="accessible">
-                              <object class="AtkObject" id="label22-atkobject">
-                                <property name="AtkObject::accessible-name" translatable="yes">Rcl</property>
-                                <property name="AtkObject::accessible-description" translatable="yes">Retrieve from register</property>
-                              </object>
-                            </child>
+                            <property name="label" translatable="yes" comments="The label on the memory recall button">&#x2192; R</property>
                           </object>
                           <packing>
                             <property name="position">0</property>
@@ -2684,6 +2614,7 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the Pi button">Pi [Ctrl+P]</property>
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
@@ -2705,10 +2636,11 @@
                 </child>
                 <child>
                   <object class="GtkButton" id="calc_modulus_divide_button">
-                    <property name="label" translatable="yes" comments="Modulus division button">mod</property>
+                    <property name="label">mod</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the modulus division button">Modulus divide</property>
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
@@ -2725,19 +2657,14 @@
                 </child>
                 <child>
                   <object class="GtkButton" id="calc_root_button">
-                    <property name="label" translatable="yes" comments="Root button">&#x221A;</property>
+                    <property name="label">&#x221A;</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the root button">Root [Ctrl+S]</property>
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="calc_root_button-atkobject">
-                        <property name="AtkObject::accessible-name" translatable="yes">Square root</property>
-                        <property name="AtkObject::accessible-description" translatable="yes">Square root [s]</property>
-                      </object>
-                    </child>
                     <signal name="clicked" handler="button_cb"/>
                   </object>
                   <packing>
@@ -2752,13 +2679,14 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the exponentiation (x to the power or y) button">Exponent [^ or **]</property>
                     <property name="border_width">3</property>
                     <property name="focus_on_click">False</property>
                     <signal name="clicked" handler="button_cb"/>
                     <child>
                       <object class="GtkLabel" id="x_pow_y_label">
                         <property name="visible">True</property>
-                        <property name="label" translatable="yes" comments="The x to the power of y button">&lt;i&gt;x&lt;/i&gt;&lt;sup&gt;&lt;i&gt;y&lt;/i&gt;&lt;/sup&gt;</property>
+                        <property name="label">&lt;i&gt;x&lt;/i&gt;&lt;sup&gt;&lt;i&gt;y&lt;/i&gt;&lt;/sup&gt;</property>
                         <property name="use_markup">True</property>
                       </object>
                     </child>
@@ -2770,10 +2698,11 @@
                 </child>
                 <child>
                   <object class="GtkButton" id="calc_logarithm_button">
-                    <property name="label" translatable="yes" comments="The 10-based logarithm button">log</property>
+                    <property name="label">log</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the base 10 logarithm button">Base 10 logarithm</property>
                     <property name="border_width">3</property>
                     <property name="focus_on_click">False</property>
                     <signal name="clicked" handler="button_cb"/>
@@ -2790,26 +2719,16 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the inverse button">Inverse [Ctrl+I]</property>
                     <property name="border_width">3</property>
                     <property name="focus_on_click">False</property>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="calc_inverse_button-atkobject">
-                        <property name="AtkObject::accessible-name" translatable="yes">Inverse</property>
-                      </object>
-                    </child>
                     <signal name="clicked" handler="button_cb"/>
                     <child>
                       <object class="GtkLabel" id="label20">
                         <property name="visible">True</property>
-                        <property name="label" translatable="yes" comments="Inverse button">&lt;i&gt;x&lt;/i&gt;&lt;sup&gt;&#x2212;1&lt;/sup&gt;</property>
+                        <property name="label">&lt;i&gt;x&lt;/i&gt;&lt;sup&gt;&#x2212;1&lt;/sup&gt;</property>
                         <property name="use_markup">True</property>
                         <property name="justify">center</property>
-                        <child internal-child="accessible">
-                          <object class="AtkObject" id="label20-atkobject">
-                            <property name="AtkObject::accessible-name" translatable="yes">1/x</property>
-                            <property name="AtkObject::accessible-description" translatable="yes">Inverse</property>
-                          </object>
-                        </child>
                       </object>
                     </child>
                   </object>
@@ -2822,10 +2741,11 @@
                 </child>
                 <child>
                   <object class="GtkButton" id="calc_natural_logarithm_button">
-                    <property name="label" translatable="yes" comments="The natural logarithm button">ln</property>
+                    <property name="label">ln</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the natural logarithm button">Natural logarithm</property>		    
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
@@ -2845,6 +2765,7 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the eulers number button">Eulers number</property>
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
@@ -2871,26 +2792,16 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the absolute value button">Absolute value [|]</property>		    
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="calc_abs_button-atkobject">
-                        <property name="AtkObject::accessible-name" translatable="yes">Absolute value</property>
-                      </object>
-                    </child>
                     <signal name="clicked" handler="button_cb"/>
                     <child>
                       <object class="GtkLabel" id="label1">
                         <property name="visible">True</property>
-                        <property name="label" translatable="yes" comments="x to the power of 2 button">|&lt;i&gt;x&lt;/i&gt;|</property>
+                        <property name="label">|&lt;i&gt;x&lt;/i&gt;|</property>
                         <property name="use_markup">True</property>
-                        <child internal-child="accessible">
-                          <object class="AtkObject" id="label1-atkobject">
-                            <property name="AtkObject::accessible-name" translatable="yes">x2</property>
-                            <property name="AtkObject::accessible-description" translatable="yes">Square</property>
-                          </object>
-                        </child>
                       </object>
                     </child>
                   </object>
@@ -2906,13 +2817,14 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the factorial button">Factorial [!]</property>
                     <property name="border_width">3</property>
                     <property name="focus_on_click">False</property>
                     <signal name="clicked" handler="button_cb"/>
                     <child>
                       <object class="GtkLabel" id="label14">
                         <property name="visible">True</property>
-                        <property name="label" translatable="yes" comments="Factorial">&lt;i&gt;x&lt;/i&gt;!</property>
+                        <property name="label">&lt;i&gt;x&lt;/i&gt;!</property>
                         <property name="use_markup">True</property>
                       </object>
                     </child>
@@ -2928,18 +2840,14 @@
                 </child>
                 <child>
                   <object class="GtkButton" id="calc_integer_portion_button">
-                    <property name="label" translatable="yes" comments="Integer portion button">int</property>
+                    <property name="label">int</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the integer portion button">Integer portion</property>
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="calc_integer_portion_button-atkobject">
-                        <property name="AtkObject::accessible-name" translatable="yes">Integer portion</property>
-                      </object>
-                    </child>
                     <signal name="clicked" handler="button_cb"/>
                   </object>
                   <packing>
@@ -2956,6 +2864,7 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the scientific exponent button">Scientific exponent [Ctrl+E]</property>
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
@@ -2963,7 +2872,7 @@
                     <child>
                       <object class="GtkLabel" id="label2">
                         <property name="visible">True</property>
-                        <property name="label" translatable="yes">&#xD7;10&lt;sup&gt;&lt;i&gt;y&lt;/i&gt;&lt;/sup&gt;</property>
+                        <property name="label">&#xD7;10&lt;sup&gt;&lt;i&gt;y&lt;/i&gt;&lt;/sup&gt;</property>
                         <property name="use_markup">True</property>
                       </object>
                     </child>
@@ -2977,18 +2886,14 @@
                 </child>
                 <child>
                   <object class="GtkButton" id="calc_fractional_portion_button">
-                    <property name="label" translatable="yes" comments="Integer portion button">frac</property>
+                    <property name="label">frac</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the fractional portion button">Fractional portion</property>
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="calc_fractional_portion_button-atkobject">
-                        <property name="AtkObject::accessible-name" translatable="yes">Integer portion</property>
-                      </object>
-                    </child>
                     <signal name="clicked" handler="button_cb"/>
                   </object>
                   <packing>
@@ -3030,6 +2935,7 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the subscript mode button">Subscipt number mode</property>
                     <property name="border_width">3</property>
                     <property name="focus_on_click">False</property>
                     <signal name="clicked" handler="set_subscript_cb"/>
@@ -3037,7 +2943,7 @@
                       <object class="GtkLabel" id="label4">
                         <property name="visible">True</property>
                         <property name="yalign">0</property>
-                        <property name="label" translatable="yes">&#x2395;&lt;sub&gt;n&lt;/sub&gt;</property>
+                        <property name="label">&#x2395;&lt;sub&gt;n&lt;/sub&gt;</property>
                         <property name="use_markup">True</property>
                       </object>
                     </child>
@@ -3056,13 +2962,14 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the superscript mode button">Superscipt number mode</property>
                     <property name="border_width">3</property>
                     <property name="focus_on_click">False</property>
                     <signal name="clicked" handler="set_superscript_cb"/>
                     <child>
                       <object class="GtkLabel" id="label3">
                         <property name="visible">True</property>
-                        <property name="label" translatable="yes">&#x2395;&lt;sup&gt;n&lt;/sup&gt;</property>
+                        <property name="label">&#x2395;&lt;sup&gt;n&lt;/sup&gt;</property>
                         <property name="use_markup">True</property>
                       </object>
                     </child>
@@ -3078,10 +2985,11 @@
                 </child>
                 <child>
                   <object class="GtkButton" id="calc_ans_button">
-                    <property name="label" translatable="yes" comments="The natural logarithm button">ans</property>
+                    <property name="label">ans</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the answer variable button">Answer variable</property>
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
@@ -3226,10 +3134,11 @@
                 </child>
                 <child>
                   <object class="GtkButton" id="calc_and_button">
-                    <property name="label" translatable="yes" comments="Boolean AND button">and</property>
+                    <property name="label">and</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the boolean AND button">Boolean AND</property>
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
@@ -3244,10 +3153,11 @@
                 </child>
                 <child>
                   <object class="GtkButton" id="calc_or_button">
-                    <property name="label" translatable="yes" comments="Boolean OR button">or</property>
+                    <property name="label">or</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the boolean OR button">Boolean OR</property>
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
@@ -3262,10 +3172,11 @@
                 </child>
                 <child>
                   <object class="GtkButton" id="calc_not_button">
-                    <property name="label" translatable="yes" comments="Boolean NOT button">not</property>
+                    <property name="label">not</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the boolean NOT button">Boolean NOT</property>
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
@@ -3280,10 +3191,11 @@
                 </child>
                 <child>
                   <object class="GtkButton" id="calc_xor_button">
-                    <property name="label" translatable="yes" comments="Boolean exlcusive OR button">xor</property>
+                    <property name="label">xor</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the boolean exclusive OR button">Boolean exclusive OR</property>
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
@@ -3298,10 +3210,11 @@
                 </child>
                 <child>
                   <object class="GtkButton" id="calc_ones_complement_button">
-                    <property name="label" translatable="yes" comments="1's complement">ones</property>
+                    <property name="label">ones</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the ones&apos; complement button">Ones&apos; complement</property>
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
@@ -3318,10 +3231,11 @@
                 </child>
                 <child>
                   <object class="GtkButton" id="calc_twos_complement_button">
-                    <property name="label" translatable="yes" comments="2's complement">twos</property>
+                    <property name="label">twos</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the two&apos;s complement button">Two&apos;s complement</property>
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
@@ -3341,6 +3255,7 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the shift right button">Shift right [&gt;]</property>
                     <property name="border_width">3</property>
                     <property name="focus_on_click">False</property>
                     <signal name="clicked" handler="popup_cb"/>
@@ -3352,7 +3267,7 @@
                           <object class="GtkLabel" id="label6">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
-                            <property name="label" translatable="yes" comments="Shift right button">&gt;</property>
+                            <property name="label">&gt;</property>
                           </object>
                           <packing>
                             <property name="position">0</property>
@@ -3385,6 +3300,7 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the shift left button">Shift left [&lt;]</property>
                     <property name="border_width">3</property>
                     <property name="focus_on_click">False</property>
                     <signal name="clicked" handler="popup_cb"/>
@@ -3396,7 +3312,7 @@
                           <object class="GtkLabel" id="label7">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
-                            <property name="label" translatable="yes" comments="Shift left button">&lt;</property>
+                            <property name="label">&lt;</property>
                           </object>
                           <packing>
                             <property name="position">0</property>
@@ -3426,10 +3342,11 @@
                 </child>
                 <child>
                   <object class="GtkButton" id="calc_trunc_button">
-                    <property name="label" translatable="yes" comments="Truncate displayed value">trunc</property>
+                    <property name="label">trunc</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the truncate button">Truncate value</property>
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
@@ -3446,10 +3363,11 @@
                 </child>
                 <child>
                   <object class="GtkButton" id="calc_random_button">
-                    <property name="label" translatable="yes" comments="Random number">rand</property>
+                    <property name="label">rand</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the random number button">Random number</property>
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
@@ -3467,13 +3385,14 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the base 2 button">Base 2</property>
                     <property name="border_width">3</property>
                     <property name="focus_on_click">False</property>
                     <signal name="clicked" handler="button_cb"/>
                     <child>
                       <object class="GtkLabel" id="base_2_label">
                         <property name="visible">True</property>
-                        <property name="label" translatable="yes" comments="The base 2 button">&lt;i&gt;x&lt;/i&gt;&lt;sub&gt;2&lt;/sub&gt;</property>
+                        <property name="label">&lt;i&gt;x&lt;/i&gt;&lt;sub&gt;2&lt;/sub&gt;</property>
                         <property name="use_markup">True</property>
                       </object>
                     </child>
@@ -3492,13 +3411,14 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the base 8 button">Base 8</property>
                     <property name="border_width">3</property>
                     <property name="focus_on_click">False</property>
                     <signal name="clicked" handler="button_cb"/>
                     <child>
                       <object class="GtkLabel" id="base_8_label">
                         <property name="visible">True</property>
-                        <property name="label" translatable="yes" comments="The base 8 button">&lt;i&gt;x&lt;/i&gt;&lt;sub&gt;8&lt;/sub&gt;</property>
+                        <property name="label">&lt;i&gt;x&lt;/i&gt;&lt;sub&gt;8&lt;/sub&gt;</property>
                         <property name="use_markup">True</property>
                       </object>
                     </child>
@@ -3515,13 +3435,14 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the base 16 button">Base 16</property>
                     <property name="border_width">3</property>
                     <property name="focus_on_click">False</property>
                     <signal name="clicked" handler="button_cb"/>
                     <child>
                       <object class="GtkLabel" id="base_16_label">
                         <property name="visible">True</property>
-                        <property name="label" translatable="yes" comments="The base 16 button">&lt;i&gt;x&lt;/i&gt;&lt;sub&gt;16&lt;/sub&gt;</property>
+                        <property name="label">&lt;i&gt;x&lt;/i&gt;&lt;sub&gt;16&lt;/sub&gt;</property>
                         <property name="use_markup">True</property>
                       </object>
                     </child>
@@ -3537,10 +3458,11 @@
                 </child>
                 <child>
                   <object class="GtkButton" id="calc_character_button">
-                    <property name="label" translatable="yes" comments="Boolean NOT button">&#xE1;</property>
+                    <property name="label">&#xE1;</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
+                    <property name="tooltip_text" translatable="yes" comments="Tooltip for the insert character button">Insert character</property>
                     <property name="border_width">3</property>
                     <property name="focus_on_click">False</property>
                   </object>
@@ -3857,12 +3779,6 @@
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="calc_finc_straight_line_depreciation_button-atkobject">
-                        <property name="AtkObject::accessible-name" translatable="yes">Straight-line depreciation</property>
-                        <property name="AtkObject::accessible-description" translatable="yes">Straight-line depreciation [l]</property>
-                      </object>
-                    </child>
                     <signal name="clicked" handler="finc_cb"/>
                   </object>
                   <packing>
@@ -3881,12 +3797,6 @@
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="calc_finc_periodic_interest_rate_button-atkobject">
-                        <property name="AtkObject::accessible-name" translatable="yes">Periodic interest rate</property>
-                        <property name="AtkObject::accessible-description" translatable="yes">Periodic interest rate [T]</property>
-                      </object>
-                    </child>
                     <signal name="clicked" handler="finc_cb"/>
                   </object>
                   <packing>
@@ -3905,12 +3815,6 @@
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="calc_finc_present_value_button-atkobject">
-                        <property name="AtkObject::accessible-name" translatable="yes">Present value</property>
-                        <property name="AtkObject::accessible-description" translatable="yes">Present value [p]</property>
-                      </object>
-                    </child>
                     <signal name="clicked" handler="finc_cb"/>
                   </object>
                   <packing>
@@ -3929,12 +3833,6 @@
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="calc_finc_periodic_payment_button-atkobject">
-                        <property name="AtkObject::accessible-name" translatable="yes">Periodic payment</property>
-                        <property name="AtkObject::accessible-description" translatable="yes">Periodic payment [P]</property>
-                      </object>
-                    </child>
                     <signal name="clicked" handler="finc_cb"/>
                   </object>
                   <packing>
@@ -3953,12 +3851,6 @@
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="calc_finc_future_value_button-atkobject">
-                        <property name="AtkObject::accessible-name" translatable="yes">Future value</property>
-                        <property name="AtkObject::accessible-description" translatable="yes">Future value [v]</property>
-                      </object>
-                    </child>
                     <signal name="clicked" handler="finc_cb"/>
                   </object>
                   <packing>
@@ -3977,12 +3869,6 @@
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="calc_finc_gross_profit_margin_button-atkobject">
-                        <property name="AtkObject::accessible-name" translatable="yes">Gross Profit Margin</property>
-                        <property name="AtkObject::accessible-description" translatable="yes">Gross Profit Margin [g]</property>
-                      </object>
-                    </child>
                     <signal name="clicked" handler="finc_cb"/>
                   </object>
                   <packing>
@@ -4001,12 +3887,6 @@
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="calc_finc_double_declining_depreciation_button-atkobject">
-                        <property name="AtkObject::accessible-name" translatable="yes">Double-declining depreciation</property>
-                        <property name="AtkObject::accessible-description" translatable="yes">Double-declining depreciation [D]</property>
-                      </object>
-                    </child>
                     <signal name="clicked" handler="finc_cb"/>
                   </object>
                   <packing>
@@ -4025,12 +3905,6 @@
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="calc_finc_compounding_term_button-atkobject">
-                        <property name="AtkObject::accessible-name" translatable="yes">Compounding term</property>
-                        <property name="AtkObject::accessible-description" translatable="yes">Compounding term [m]</property>
-                      </object>
-                    </child>
                     <signal name="clicked" handler="finc_cb"/>
                   </object>
                   <packing>
@@ -4047,12 +3921,6 @@
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="calc_finc_sum_of_the_years_digits_depreciation_button-atkobject">
-                        <property name="AtkObject::accessible-name" translatable="yes">Sum-of-the years'-digits depreciation</property>
-                        <property name="AtkObject::accessible-description" translatable="yes">Sum-of-the years'-digits depreciation [y]</property>
-                      </object>
-                    </child>
                     <signal name="clicked" handler="finc_cb"/>
                   </object>
                   <packing>
@@ -4071,12 +3939,6 @@
                     <property name="border_width">3</property>
                     <property name="use_underline">True</property>
                     <property name="focus_on_click">False</property>
-                    <child internal-child="accessible">
-                      <object class="AtkObject" id="calc_finc_term_button-atkobject">
-                        <property name="AtkObject::accessible-name" translatable="yes">Payment period</property>
-                        <property name="AtkObject::accessible-description" translatable="yes">Payment period [t]</property>
-                      </object>
-                    </child>
                     <signal name="clicked" handler="finc_cb"/>
                   </object>
                   <packing>
@@ -4356,16 +4218,16 @@
     </columns>
     <data>
       <row>
-        <col id="0" translatable="yes">Degrees</col>
-        <col id="1" translatable="yes">degrees</col>
+        <col id="0" translatable="yes" comments="Preferences dialog: Angle unit combo box: Use degrees for trigonometric calculations">Degrees</col>
+        <col id="1">degrees</col>
       </row>
       <row>
-        <col id="0" translatable="yes">Radians</col>
-        <col id="1" translatable="yes">radians</col>
+        <col id="0" translatable="yes" comments="Preferences dialog: Angle unit combo box: Use radians for trigonometric calculations">Radians</col>
+        <col id="1">radians</col>
       </row>
       <row>
-        <col id="0" translatable="yes">Gradians</col>
-        <col id="1" translatable="yes">gradians</col>
+        <col id="0" translatable="yes" comments="Preferences dialog: Angle unit combo box: Use gradians for trigonometric calculations">Gradians</col>
+        <col id="1">gradians</col>
       </row>
     </data>
   </object>
@@ -4700,7 +4562,7 @@
               <object class="GtkLabel" id="label8">
                 <property name="visible">True</property>
                 <property name="xalign">0</property>
-                <property name="label" translatable="yes">_Angle units:</property>
+                <property name="label" translatable="yes" comments="Preferences dialog: Label for angle unit combo box">_Angle units:</property>
                 <property name="use_underline">True</property>
                 <property name="mnemonic_widget">angle_unit_combobox</property>
               </object>
@@ -4712,7 +4574,7 @@
               <object class="GtkLabel" id="label9">
                 <property name="visible">True</property>
                 <property name="xalign">0</property>
-                <property name="label" translatable="yes">Display _Format:</property>
+                <property name="label" translatable="yes" comments="Preferences dialog: Label for display format combo box">Display _Format:</property>
                 <property name="use_underline">True</property>
                 <property name="mnemonic_widget">display_format_combobox</property>
               </object>
@@ -4750,7 +4612,7 @@
               <object class="GtkLabel" id="label11">
                 <property name="visible">True</property>
                 <property name="xalign">0</property>
-                <property name="label" translatable="yes">Word _size:</property>
+                <property name="label" translatable="yes" comments="Preferences dialog: label for word size combo box">Word _size:</property>
                 <property name="use_underline">True</property>
                 <property name="mnemonic_widget">word_size_combobox</property>
               </object>
@@ -4785,7 +4647,7 @@
                     <property name="row_spacing">6</property>
                     <child>
                       <object class="GtkCheckButton" id="trailing_zeroes_check">
-                        <property name="label" translatable="yes">Show trailing _zeroes</property>
+                        <property name="label" translatable="yes" comments="Preferences dialog: label for show trailing zeroes check button">Show trailing _zeroes</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
@@ -4800,7 +4662,7 @@
                     </child>
                     <child>
                       <object class="GtkCheckButton" id="thousands_separator_check">
-                        <property name="label" translatable="yes">Show _thousands separators</property>
+                        <property name="label" translatable="yes" comments="Preferences dialog: label for show thousands separator check button">Show _thousands separators</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
@@ -4818,10 +4680,10 @@
                         <property name="visible">True</property>
                         <property name="spacing">6</property>
                         <child>
-                          <object class="GtkLabel" id="label12">
+                          <object class="GtkLabel" id="decimal_places_label1">
                             <property name="visible">True</property>
                             <property name="xalign">0</property>
-                            <property name="label" translatable="yes">Show</property>
+                            <property name="label">Show</property>
                             <property name="use_underline">True</property>
                             <property name="mnemonic_widget">decimal_places_spin</property>
                           </object>
@@ -4844,10 +4706,10 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkLabel" id="label10">
+                          <object class="GtkLabel" id="decimal_places_label2">
                             <property name="visible">True</property>
                             <property name="xalign">0</property>
-                            <property name="label" translatable="yes">decimal _places</property>
+                            <property name="label">decimal _places</property>
                             <property name="use_underline">True</property>
                             <property name="mnemonic_widget">decimal_places_spin</property>
                           </object>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 56d042e..e2e3306 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -8,7 +8,6 @@ data/gcalctool.schemas.in
 src/calctool.c
 src/display.c
 src/financial.c
-src/functions.c
 src/get.c
 src/gtk.c
 src/mp.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 23d9efc..5c98a1b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -20,8 +20,6 @@ gcalctool_SOURCES = \
 	display.h \
 	get.c \
 	get.h \
-	functions.c \
-	functions.h \
 	mp.c \
 	mp.h \
 	mp-binary.c \
diff --git a/src/calctool.c b/src/calctool.c
index 3e4df9e..f5110ab 100644
--- a/src/calctool.c
+++ b/src/calctool.c
@@ -30,7 +30,6 @@
 #include "unittest.h"
 #include "get.h"
 #include "display.h"
-#include "functions.h"
 #include "ui.h"
 #include "register.h"
 #include "mp-equation.h"
diff --git a/src/display.c b/src/display.c
index e5be9ed..0a66b1c 100644
--- a/src/display.c
+++ b/src/display.c
@@ -23,17 +23,16 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include <ctype.h>
 #include <math.h>
 #include <errno.h>
-#include <assert.h>
 #include <glib.h>
 
 #include "display.h"
 
 #include "mp.h"
-#include "functions.h"
 #include "ui.h"
-#include "mp-equation.h" // For mp_equation_parse()
+#include "mp-equation.h"
 #include "register.h"
 
 static GCDisplayState *
@@ -560,6 +559,8 @@ display_init(GCDisplay *display)
     display->show_tsep = FALSE;
     display->format = DEC;
     display->accuracy = 9;
+    display->word_size = 32;
+    display->angle_unit = MP_DEGREES;
 
     for (i = 0; i < UNDO_HISTORY_LENGTH; i++)
         display->h.e[i].expression = strdup("");
@@ -590,13 +591,22 @@ void display_set_show_trailing_zeroes(GCDisplay *display, gboolean visible)
 }
 
 
-void display_set_format(GCDisplay *display, DisplayFormat type)
+void display_set_format(GCDisplay *display, DisplayFormat format)
 {
-    display->format = type;
+    display->format = format;
     get_state(display)->cursor = -1;
     display_refresh(display);
 }
 
+void display_set_word_size(GCDisplay *display, int word_size)
+{
+    display->word_size = word_size;
+}
+
+void display_set_angle_unit(GCDisplay *display, MPAngleUnit angle_unit)
+{
+    display->angle_unit = angle_unit;
+}
 
 /* Convert engineering or scientific number in the given base. */
 static void
@@ -704,3 +714,316 @@ display_make_number(GCDisplay *display, char *target, int target_len, const MPNu
         break;
     }
 }
+
+static int
+get_variable(const char *name, MPNumber *z, void *data)
+{
+    char *c, *lower_name;
+    int result = 1;
+    GCDisplay *display = data;
+    
+    lower_name = strdup(name);
+    for (c = lower_name; *c; c++)
+        *c = tolower(*c);
+
+    if (lower_name[0] == 'r')
+        mp_set_from_mp(register_get_value(atoi(name+1)), z);
+    else if (strcmp(lower_name, "ans") == 0)
+        mp_set_from_mp(display_get_answer(display), z);
+    else
+        result = 0;
+
+    free(lower_name);
+
+    return result;
+}
+
+
+static void
+set_variable(const char *name, const MPNumber *x, void *data)
+{
+    if (name[0] == 'R' || name[0] == 'r')
+        register_set_value(atoi(name+1), x);
+}
+
+
+static int
+parse(GCDisplay *display, const char *text, MPNumber *z)
+{
+    MPEquationOptions options;
+
+    memset(&options, 0, sizeof(options));
+    options.wordlen = display->word_size;
+    options.angle_units = display->angle_unit;
+    options.get_variable = get_variable;
+    options.set_variable = set_variable;
+    options.callback_data = display;
+
+    return mp_equation_parse(text, &options, z);
+}
+
+
+static void
+do_paste(GCDisplay *display, int cursor_start, int cursor_end, const char *text)
+{
+    const char *input;
+    char c, *output, *clean_text;
+
+    /* Copy input to modify, no operation can make the clean string longer than
+     * the original string */
+    clean_text = strdup(text);
+    
+    output = clean_text;
+    for (input = text; *input; input++) {
+        /* If the clipboard buffer contains any occurances of the "thousands
+         * separator", remove them.
+         */
+        if (v->tsep[0] != '\0' && strncmp(input, v->tsep, strlen(v->tsep)) == 0) {
+            input += strlen(v->tsep) - 1;
+            continue;
+        }
+        
+        /* Replace radix with "." */
+        else if (strncmp(input, v->radix, strlen(v->radix)) == 0) {
+            input += strlen(v->radix) - 1;
+            c = '.';
+        }
+
+        /* Replace tabs with spaces */        
+        else if (*input == '\t') {
+            c = ' ';
+        }
+        
+        /* Terminate on newlines */        
+        else if (*input == '\r' || *input == '\n') {
+            c = '\0';
+        }
+        
+        /* If an "A", "B", "C", "D" or "F" character is encountered, it 
+         * will be converted to its lowercase equivalent. If an "E" is 
+         * found,  and the next character is a "-" or a "+", then it 
+         * remains as an upper case "E" (it's assumed to be a possible 
+         * exponential number), otherwise its converted to a lower case 
+         * "e". See bugs #455889 and #469245 for more details.
+         */
+        else if (*input >= 'A' && *input <= 'F') {
+            c = *input;
+            if (*input == 'E') {
+                if (*(input+1) != '-' && *(input+1) != '+')
+                    c = tolower(*input);
+            }
+            else
+                c = tolower(*input);
+        }
+        
+        else
+            c = *input;
+        
+        *output++ = c;
+    }
+    *output++ = '\0';
+
+    display_insert(display, cursor_start, cursor_end, clean_text);
+}
+
+
+static void
+do_insert_character(GCDisplay *display, const char *text)
+{
+    MPNumber value;
+    mp_set_from_integer(text[0], &value);
+    display_set_number(display, &value);
+}
+
+
+/* Perform bitwise shift on display value. */
+static void
+do_shift(GCDisplay *display, int count)
+{
+    MPNumber z;
+
+    if (!display_is_usable_number(display, &z)) {
+        /* Translators: This message is displayed in the status bar when a bit
+           shift operation is performed and the display does not contain a number */
+        ui_set_statusbar(_("No sane value to do bitwise shift"));
+    }
+    else {
+        mp_shift(&z, count, display_get_answer(display));
+        display_set_answer(display);
+    }
+}
+
+
+static void
+do_sto(GCDisplay *display, int index)
+{
+    MPNumber temp;
+    
+    if (!display_is_usable_number(display, &temp))
+        ui_set_statusbar(_("No sane value to store"));
+    else
+        register_set_value(index, &temp);
+}
+
+
+void
+display_do_function(GCDisplay *display, int function, int arg, int cursor_start, int cursor_end)
+{
+    char buf[MAXLINE];
+    MPNumber *ans;
+    int enabled;
+    guint64 bit_value;
+    
+    switch (function) {
+        case FN_UNDO:
+            display_pop(display);
+            return;
+
+        case FN_REDO:
+            display_unpop(display);
+            return;
+
+        default:
+            break;
+    }
+    
+    display_push(display);
+
+    display_set_cursor(display, cursor_start);
+    ans = display_get_answer(display);
+
+    ui_set_statusbar("");
+
+    switch (function) {
+        case FN_CLEAR:
+            display_clear(display);
+            mp_set_from_string("0", ans);
+            break;
+
+        case FN_SHIFT:
+            do_shift(display, arg);
+            break;
+
+        case FN_PASTE:
+            do_paste(display, cursor_start, cursor_end, (const char *)arg); // FIXME: Probably not 64 bit safe
+            return;
+        
+        case FN_INSERT_CHARACTER:
+            do_insert_character(display, (const char *)arg); // FIXME: Probably not 64 bit safe
+            return;        
+
+        case FN_STORE:
+            do_sto(display, arg);
+            return;
+
+        case FN_RECALL:
+            SNPRINTF(buf, MAXLINE, "R%d", arg);
+            display_insert(display, cursor_start, cursor_end, buf);
+            break;
+
+        case FN_BACKSPACE:
+            display_backspace(display, cursor_start, cursor_end);
+            break;
+        
+        case FN_DELETE:
+            display_delete(display, cursor_start, cursor_end);
+            break;
+
+        case FN_TOGGLE_BIT:
+            if (display_get_unsigned_integer(display, &bit_value)) {
+                char buf[MAX_DISPLAY];
+                MPNumber MP;
+
+                bit_value ^= (1LL << (63 - arg));
+    
+                /* FIXME: Convert to string since we don't support setting MP numbers from 64 bit integers */
+                SNPRINTF(buf, MAX_DISPLAY, "%llu", bit_value);
+                mp_set_from_string(buf, &MP);
+                display_set_number(display, &MP);
+            }
+            break;
+
+        case FN_CALCULATE:
+            /* If showing a result display the calculation that caused
+             * this result */
+            /* TODO: Work out why two undo steps are required and why
+             * the cursor must be taken from the first undo */
+            if (display_is_result(display)) {
+                display_pop(display);
+                if (display_is_undo_step(display)) {
+                    display_pop(display);
+                }
+
+            /* Do nothing */                
+            } else if (display_is_empty(display)) {
+                ;
+                
+            /* Solve the equation */
+            } else {
+                MPNumber z;
+                int result;
+                const char *message = NULL;
+
+                result = parse(display, display_get_text(display), &z);
+                switch (result) {
+                    case 0:
+                        mp_set_from_mp(&z, ans);
+                        display_set_answer(display);
+                        break;
+
+                    case -PARSER_ERR_BITWISEOP:
+                        /* Translators: Error displayed to user when they
+                         * perform an invalid bitwise operation, e.g.
+                         * 1 XOR -1 */
+                        message = _("Invalid bitwise operation");
+                        break;
+
+                    case -PARSER_ERR_MODULUSOP:
+                        /* Translators: Error displayed to user when they
+                         * perform an invalid modulus operation, e.g.
+                         * 6 MOD 1.2 */
+                        message = _("Invalid modulus operation");
+                        break;
+
+                    case -PARSER_ERR_OVERFLOW:
+                        /* Translators; Error displayd to user when they
+                         * perform a bitwise operation on numbers greater
+                         * than the current word */
+                       message = _("Overflow. Try a bigger word size");
+                       break;
+
+                    case -PARSER_ERR_UNKNOWN_VARIABLE:
+                        /* Translators; Error displayd to user when they
+                         * an unknown variable is entered */
+                       message = _("Unknown variable");
+                       break;
+
+                    case -PARSER_ERR_UNKNOWN_FUNCTION:
+                        /* Translators; Error displayd to user when they
+                         * an unknown function is entered */
+                       message = _("Unknown function");
+                       break;
+
+                    case -PARSER_ERR_MP:
+                        message = mp_get_error();
+                        break;
+
+                    default:
+                        /* Translators: Error displayed to user when they
+                         * enter an invalid calculation */
+                        message = _("Malformed expression");
+                        break;
+                }
+                if (message)
+                    ui_set_statusbar(message);
+            }
+            break;
+
+        case FN_TEXT:
+            display_insert(display, cursor_start, cursor_end, (const char *)arg); // FIXME: Probably not 64 bit safe
+            break;
+    }
+
+    enabled = display_get_unsigned_integer(display, &bit_value);
+    ui_set_bitfield(enabled, bit_value);
+}
diff --git a/src/display.h b/src/display.h
index 3173a23..57a95a6 100644
--- a/src/display.h
+++ b/src/display.h
@@ -54,14 +54,35 @@ typedef struct
     int show_zeroes;       /* Set if trailing zeroes should be shown. */
     DisplayFormat format;  /* Number display mode. */
     int accuracy;          /* Number of digits to show */
+    int word_size;
+    MPAngleUnit angle_unit;
 } GCDisplay;
 
+/* Available functions */
+enum
+{
+    FN_TEXT,
+    FN_CALCULATE,
+    FN_CLEAR,
+    FN_BACKSPACE,
+    FN_DELETE,        
+    FN_TOGGLE_BIT,
+    FN_SHIFT,
+    FN_STORE,
+    FN_RECALL,
+    FN_UNDO,
+    FN_REDO,
+    FN_PASTE,
+    FN_INSERT_CHARACTER
+};
+
 void display_init(GCDisplay *);
 void display_set_accuracy(GCDisplay *display, int accuracy);
 void display_set_show_thousands_separator(GCDisplay *display, gboolean visible);
 void display_set_show_trailing_zeroes(GCDisplay *display, gboolean visible);
-void display_set_base(GCDisplay *display, int base);
 void display_set_format(GCDisplay *display, DisplayFormat format);
+void display_set_word_size(GCDisplay *display, int word_size);
+void display_set_angle_unit(GCDisplay *display, MPAngleUnit angle_unit);
 void display_clear(GCDisplay *);
 
 gboolean display_get_integer(GCDisplay *display, gint64 *value);
@@ -95,4 +116,6 @@ const char *display_get_text(GCDisplay *display);
 
 void display_make_number(GCDisplay *display, char *target, int target_len, const MPNumber *x);
 
+void display_do_function(GCDisplay *display, int function, int arg, int cursor_start, int cursor_end);
+
 #endif /* DISPLAY_H */
diff --git a/src/gtk.c b/src/gtk.c
index 0a523fe..0ccfb3e 100644
--- a/src/gtk.c
+++ b/src/gtk.c
@@ -13,7 +13,7 @@
  *  WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
  *  General Public License for more details.
- *           
+ *
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -37,7 +37,6 @@
 #include "ui.h"
 
 #include "config.h"
-#include "functions.h"
 #include "financial.h"
 #include "mp-equation.h"
 #include "display.h"
@@ -386,7 +385,7 @@ do_button(int function, int arg)
         do_button(FN_TEXT, (int)"^"); // FIXME: Not 64 bit safe
     }
     else {
-        do_expression(function, arg, cursor_start, cursor_end);
+        display_do_function(&v->display, function, arg, cursor_start, cursor_end);
         if (function == FN_TEXT)
             X.last_text = (char *)arg;
         else
@@ -1421,6 +1420,8 @@ create_main_window()
     renderer = gtk_cell_renderer_text_new();
     gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(widget), renderer, TRUE);
     gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(widget), renderer, "text", 0);
+    
+    // _("Show %d decimal places") decimal_places_label1, decimal_places_label2
 }
 
 
@@ -1453,13 +1454,27 @@ G_MODULE_EXPORT
 void
 angle_unit_combobox_changed_cb(GtkWidget *combo)
 {
+    int i;
     const gchar *value;
     GtkTreeModel *model;
     GtkTreeIter iter;
+    struct
+    {
+        const gchar *value;
+        MPAngleUnit units;
+    } unit_map[] =
+    {
+        {"degrees",     MP_DEGREES},
+        {"radians" ,    MP_RADIANS},
+        {"gradians",    MP_GRADIANS},
+        {NULL,          MP_DEGREES}
+    };
     
     model = gtk_combo_box_get_model(GTK_COMBO_BOX(combo));
     gtk_combo_box_get_active_iter(GTK_COMBO_BOX(combo), &iter);
     gtk_tree_model_get(model, &iter, 1, &value, -1);
+    for (i = 0; unit_map[i].value != NULL && strcmp(unit_map[i].value, value) != 0; i++);
+    display_set_angle_unit(&v->display, unit_map[i].units);
 
     set_resource(R_TRIG, value);
 }
@@ -1469,13 +1484,30 @@ G_MODULE_EXPORT
 void
 display_format_combobox_changed_cb(GtkWidget *combo)
 {
+    int i;
     const gchar *value;
     GtkTreeModel *model;
     GtkTreeIter iter;
-    
+    struct
+    {
+        const gchar *value;
+        DisplayFormat format;
+    } mode_map[] =
+    {
+        {"decimal",     DEC},
+        {"binary" ,     BIN},
+        {"octal",       OCT},
+        {"hexadecimal", HEX},
+        {"scientific",  SCI},
+        {"engineering", ENG},
+        {NULL,          DEC}
+    };
+
     model = gtk_combo_box_get_model(GTK_COMBO_BOX(combo));
     gtk_combo_box_get_active_iter(GTK_COMBO_BOX(combo), &iter);
     gtk_tree_model_get(model, &iter, 1, &value, -1);
+    for (i = 0; mode_map[i].value != NULL && strcmp(mode_map[i].value, value) != 0; i++);
+    display_set_format(&v->display, mode_map[i].format);
 
     set_resource(R_DISPLAY, value);
 }
@@ -1492,6 +1524,7 @@ word_size_combobox_changed_cb(GtkWidget *combo)
     model = gtk_combo_box_get_model(GTK_COMBO_BOX(combo));
     gtk_combo_box_get_active_iter(GTK_COMBO_BOX(combo), &iter);
     gtk_tree_model_get(model, &iter, 1, &value, -1);
+    display_set_word_size(&v->display, value);
 
     set_int_resource(R_WORDLEN, value);
 }
@@ -1504,6 +1537,7 @@ decimal_places_spin_change_value_cb(GtkWidget *spin)
     gint value = 0;
 
     value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin));
+    display_set_accuracy(&v->display, value);
 
     set_int_resource(R_ACCURACY, value);
 }
@@ -1516,7 +1550,7 @@ thousands_separator_check_toggled_cb(GtkWidget *check)
     gboolean value;
 
     value = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check));
-
+    display_set_show_thousands_separator(&v->display, value);
     set_boolean_resource(R_TSEP, value);
 }
 
@@ -1528,7 +1562,7 @@ trailing_zeroes_check_toggled_cb(GtkWidget *check)
     gboolean value;
 
     value = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check));
-    
+    display_set_show_trailing_zeroes(&v->display, value);
     set_boolean_resource(R_ZEROES, value);
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]