[gcalctool] Revamped the user interface
- From: Robert Ancell <rancell src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gcalctool] Revamped the user interface
- Date: Mon, 28 Sep 2009 01:52:34 +0000 (UTC)
commit 0be7b51eeb71395072bc037ac32b06d18e63cdd0
Author: Robert Ancell <robert ancell gmail com>
Date: Mon Sep 28 11:52:18 2009 +1000
Revamped the user interface
ChangeLog | 4 +
NEWS | 8 +
README | 2 +-
configure.in | 59 +-
data/gcalctool.ui | 4616 ++++++++++++++++------------------------------
src/Makefile.am | 2 -
src/calctool.c | 60 +-
src/calctool.h | 17 +-
src/display.c | 638 +++++---
src/display.h | 37 +-
src/financial.h | 3 +-
src/functions.c | 637 -------
src/functions.h | 99 -
src/get.c | 4 +-
src/get.h | 12 +-
src/gtk.c | 2522 +++++++------------------
src/mp-binary.c | 57 +-
src/mp-convert.c | 70 +-
src/mp-equation-lexer.l | 108 +-
src/mp-equation-parser.y | 39 +-
src/mp-equation.h | 6 -
src/mp-trigonometric.c | 19 +-
src/mp.c | 139 +-
src/mp.h | 4 +-
src/register.c | 73 +-
src/register.h | 10 +-
src/ui.h | 25 +-
src/unittest.c | 175 ++-
28 files changed, 3186 insertions(+), 6259 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0823dd5..0293bc3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,10 @@
gcalctool change history.
=========================
+2009-09-28 Robert Ancell <robert ancell gmail com>
+
+ * Revamped the user interface
+
2009-09-22 Robert Ancell <robert ancell gmail com>
* README:
diff --git a/NEWS b/NEWS
index 6d3fcb4..3f9a73f 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,14 @@
* All Rights Reserved.
*/
+Overview of changes in gcalctool 5.29.0
+
+ * New user interface:
+ - Window is now shorter to better fix in netbook resolutions
+ - Superscript and subscript numbers to allow better notation, e.g. "â??â??5"
+ - Preferences moved into a dialog
+ - Functions are now typed, e.g. s+i+n for sine instead of "k"
+
Overview of changes in gcalctool 5.28.0
* Don't override space bar when buttons are focussed as this stops keyboard control
diff --git a/README b/README
index 2091fa1..de760ab 100644
--- a/README
+++ b/README
@@ -17,7 +17,7 @@ CONTENTS:
1. Introduction.
----------------
-This is v5.28.0 of gcalctool, the calculator application that was previously
+This is v5.29.0 of gcalctool, the calculator application that was previously
in the OpenWindows Deskset of the Solaris 8 operating system.
Sun Microsystems Inc. have kindly given me permission to release it.
diff --git a/configure.in b/configure.in
index 357f9c1..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.28.0)
+AM_INIT_AUTOMAKE(gcalctool, 5.29.0)
AC_CONFIG_MACRO_DIR([m4])
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
@@ -14,49 +14,50 @@ AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC
-PKG_CHECK_MODULES(ATK, atk >= 1.5)
-AC_SUBST(ATK_CFLAGS)
-AC_SUBST(ATK_LIBS)
+dnl ###########################################################################
+dnl Dependencies
+dnl ###########################################################################
-pkg_modules="gtk+-2.0 >= 2.14.0 gobject-2.0 gdk-x11-2.0 glib-2.0 atk gdk-pixbuf-2.0 gmodule-export-2.0"
-PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
-AC_SUBST(PACKAGE_CFLAGS)
-AC_SUBST(PACKAGE_LIBS)
+GTK_REQUIRED=2.17.5
+GCONF_REQUIRED=1.1.9
+
+PKG_CHECK_MODULES(PACKAGE, [
+ gtk+-2.0 >= $GTK_REQUIRED
+ gconf-2.0 >= $GCONF_REQUIRED
+ gmodule-export-2.0
+])
+
+dnl ###########################################################################
+dnl Determine if a usable lex is available on this system
+dnl ###########################################################################
AM_PROG_LEX
if [[ "$LEX" != "flex" ]]; then
AC_MSG_ERROR(flex is required to create the gcalctool scanners)
fi
-LFLAGS="-8"
-AC_SUBST(LFLAGS)
+
+dnl ###########################################################################
+dnl Determine if a usable yacc is available on this system
+dnl ###########################################################################
AC_PROG_YACC
-dnl determine if a usable yacc is available on this system
AC_CHECK_PROG(HAVE_YACC, $YACC, yes, no)
if [[ "$HAVE_YACC" = "no" ]]; then
AC_MSG_ERROR($YACC is not usable as yacc - consider using bison)
fi
dnl ###########################################################################
-dnl PKG_CONFIG and required versions
+dnl Scrollkeeper checks
dnl ###########################################################################
-PKG_CHECK_MODULES(GCONF, gconf-2.0 >= 1.1.9)
-AC_SUBST(GCONF_CFLAGS)
-AC_SUBST(GCONF_LIBS)
-
-dnl ********************
-dnl scrollkeeper checks
-dnl ********************
-
AC_PATH_PROG(SCROLLKEEPER_CONFIG, scrollkeeper-config,no)
if test x$SCROLLKEEPER_CONFIG = xno; then
AC_MSG_ERROR(Couldn't find scrollkeeper-config. Please install the scrollkeeper package)
fi
-dnl *******************************
+dnl ###########################################################################
dnl Internationalization
-dnl *******************************
+dnl ###########################################################################
GETTEXT_PACKAGE=gcalctool
AC_PREREQ(2.53)
@@ -66,7 +67,10 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE")
AM_PROG_LIBTOOL
AM_GLIB_GNU_GETTEXT
+dnl ###########################################################################
dnl Use -Wall if we have gcc.
+dnl ###########################################################################
+
changequote(,)dnl
if test "x$GCC" = "xyes"; then
case " $CFLAGS " in
@@ -76,7 +80,10 @@ if test "x$GCC" = "xyes"; then
fi
changequote([,])dnl
+dnl ###########################################################################
dnl Checking for gconftool-2
+dnl ###########################################################################
+
AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
if test "x$GCONFTOOL" = xno; then
@@ -85,12 +92,16 @@ fi
AM_GCONF_SOURCE_2
-dnl *****************
+dnl ###########################################################################
dnl API Documentation
-dnl *****************
+dnl ###########################################################################
GNOME_DOC_INIT
+dnl ###########################################################################
+dnl Files to generate
+dnl ###########################################################################
+
AC_OUTPUT([
Makefile
src/Makefile
diff --git a/data/gcalctool.ui b/data/gcalctool.ui
index 317aec1..4ed75e7 100644
--- a/data/gcalctool.ui
+++ b/data/gcalctool.ui
@@ -4,12 +4,12 @@
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkWindow" id="calc_window">
<property name="events">GDK_BUTTON_PRESS_MASK</property>
+ <property name="role">gcalctool</property>
<accel-groups>
<group name="accelgroup1"/>
</accel-groups>
<signal name="key_press_event" handler="main_window_key_press_cb"/>
<signal name="delete_event" handler="quit_cb"/>
- <signal name="key_release_event" handler="main_window_key_release_cb"/>
<child>
<object class="GtkVBox" id="window_vbox">
<property name="visible">True</property>
@@ -27,30 +27,6 @@
<child type="submenu">
<object class="GtkMenu" id="menuitem1_menu">
<child>
- <object class="GtkImageMenuItem" id="quit_menu">
- <property name="label">gtk-quit</property>
- <property name="visible">True</property>
- <property name="tooltip_text" translatable="yes">Quit the calculator</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- <property name="accel_group">accelgroup1</property>
- <signal name="select" handler="menu_item_select_cb"/>
- <signal name="deselect" handler="menu_item_deselect_cb"/>
- <signal name="activate" handler="quit_cb"/>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="edit_menu">
- <property name="visible">True</property>
- <property name="label" translatable="yes" comments="Edit menu">_Edit</property>
- <property name="use_underline">True</property>
- <child type="submenu">
- <object class="GtkMenu" id="edit_menu_menu">
- <child>
<object class="GtkImageMenuItem" id="copy_menu">
<property name="label">gtk-copy</property>
<property name="visible">True</property>
@@ -58,8 +34,6 @@
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<property name="accel_group">accelgroup1</property>
- <signal name="select" handler="menu_item_select_cb"/>
- <signal name="deselect" handler="menu_item_deselect_cb"/>
<signal name="activate" handler="copy_cb"/>
</object>
</child>
@@ -71,54 +45,37 @@
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<property name="accel_group">accelgroup1</property>
- <signal name="select" handler="menu_item_select_cb"/>
- <signal name="deselect" handler="menu_item_deselect_cb"/>
<signal name="activate" handler="paste_cb"/>
</object>
</child>
<child>
- <object class="GtkImageMenuItem" id="undo_menu">
- <property name="label" comments="Edit|Undo menu item" translatable="yes">_Undo</property>
+ <object class="GtkSeparatorMenuItem" id="menuitem5">
<property name="visible">True</property>
- <property name="tooltip_text" translatable="yes">Undo</property>
- <property name="use_underline">True</property>
- <property name="use_stock">True</property>
- <property name="accel_group">accelgroup1</property>
- <accelerator key="Z" signal="activate" modifiers="GDK_CONTROL_MASK"/>
- <signal name="select" handler="menu_item_select_cb"/>
- <signal name="deselect" handler="menu_item_deselect_cb"/>
- <signal name="activate" handler="undo_cb"/>
</object>
</child>
<child>
- <object class="GtkImageMenuItem" id="redo_menu">
- <property name="label" comments="Edit|Redo menu item" translatable="yes">_Redo</property>
+ <object class="GtkImageMenuItem" id="menuitem6">
+ <property name="label">gtk-preferences</property>
<property name="visible">True</property>
- <property name="tooltip_text" translatable="yes">Redo</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
- <property name="accel_group">accelgroup1</property>
- <accelerator key="Z" signal="activate" modifiers="GDK_SHIFT_MASK | GDK_CONTROL_MASK"/>
- <signal name="select" handler="menu_item_select_cb"/>
- <signal name="deselect" handler="menu_item_deselect_cb"/>
- <signal name="activate" handler="redo_cb"/>
+ <signal name="activate" handler="show_preferences_cb"/>
</object>
</child>
<child>
- <object class="GtkSeparatorMenuItem" id="menuitem5">
+ <object class="GtkSeparatorMenuItem" id="menuitem2">
<property name="visible">True</property>
</object>
</child>
<child>
- <object class="GtkMenuItem" id="insert_ascii_menu">
+ <object class="GtkImageMenuItem" id="quit_menu">
+ <property name="label">gtk-quit</property>
<property name="visible">True</property>
- <property name="tooltip_text" translatable="yes">Insert ASCII value</property>
- <property name="label" translatable="yes" comments="Edit|Insert ASCII value menu item">_Insert ASCII value...</property>
+ <property name="tooltip_text" translatable="yes">Quit the calculator</property>
<property name="use_underline">True</property>
- <accelerator key="I" signal="activate" modifiers="GDK_CONTROL_MASK"/>
- <signal name="select" handler="menu_item_select_cb"/>
- <signal name="deselect" handler="menu_item_deselect_cb"/>
- <signal name="activate" handler="insert_ascii_cb"/>
+ <property name="use_stock">True</property>
+ <property name="accel_group">accelgroup1</property>
+ <signal name="activate" handler="quit_cb"/>
</object>
</child>
</object>
@@ -140,8 +97,6 @@
<property name="use_underline">True</property>
<property name="active">True</property>
<accelerator key="B" signal="activate" modifiers="GDK_CONTROL_MASK"/>
- <signal name="select" handler="menu_item_select_cb"/>
- <signal name="deselect" handler="menu_item_deselect_cb"/>
<signal name="activate" handler="mode_radio_cb"/>
</object>
</child>
@@ -153,8 +108,6 @@
<property name="use_underline">True</property>
<property name="group">view_basic_menu</property>
<accelerator key="A" signal="activate" modifiers="GDK_CONTROL_MASK"/>
- <signal name="select" handler="menu_item_select_cb"/>
- <signal name="deselect" handler="menu_item_deselect_cb"/>
<signal name="activate" handler="mode_radio_cb"/>
</object>
</child>
@@ -166,8 +119,6 @@
<property name="use_underline">True</property>
<property name="group">view_basic_menu</property>
<accelerator key="F" signal="activate" modifiers="GDK_CONTROL_MASK"/>
- <signal name="select" handler="menu_item_select_cb"/>
- <signal name="deselect" handler="menu_item_deselect_cb"/>
<signal name="activate" handler="mode_radio_cb"/>
</object>
</child>
@@ -179,8 +130,6 @@
<property name="use_underline">True</property>
<property name="group">view_basic_menu</property>
<accelerator key="S" signal="activate" modifiers="GDK_CONTROL_MASK"/>
- <signal name="select" handler="menu_item_select_cb"/>
- <signal name="deselect" handler="menu_item_deselect_cb"/>
<signal name="activate" handler="mode_radio_cb"/>
</object>
</child>
@@ -192,57 +141,9 @@
<property name="use_underline">True</property>
<property name="group">view_basic_menu</property>
<accelerator key="P" signal="activate" modifiers="GDK_CONTROL_MASK"/>
- <signal name="select" handler="menu_item_select_cb"/>
- <signal name="deselect" handler="menu_item_deselect_cb"/>
<signal name="activate" handler="mode_radio_cb"/>
</object>
</child>
- <child>
- <object class="GtkSeparatorMenuItem" id="separator1">
- <property name="visible">True</property>
- </object>
- </child>
- <child>
- <object class="GtkCheckMenuItem" id="show_trailing_zeroes_menu">
- <property name="visible">True</property>
- <property name="tooltip_text" translatable="yes">Show trailing zeroes</property>
- <property name="label" translatable="yes" comments="View|Show Trailing Zeroes menu item">Show _Trailing Zeroes</property>
- <property name="use_underline">True</property>
- <accelerator key="T" signal="activate" modifiers="GDK_CONTROL_MASK"/>
- <signal name="select" handler="menu_item_select_cb"/>
- <signal name="deselect" handler="menu_item_deselect_cb"/>
- <signal name="activate" handler="show_trailing_zeroes_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkCheckMenuItem" id="show_thousands_separator_menu">
- <property name="visible">True</property>
- <property name="tooltip_text" translatable="yes">Show thousands separator</property>
- <property name="label" translatable="yes" comments="View|Show Thousands Separator menu item">Show T_housands Separator</property>
- <property name="use_underline">True</property>
- <accelerator key="K" signal="activate" modifiers="GDK_CONTROL_MASK"/>
- <signal name="select" handler="menu_item_select_cb"/>
- <signal name="deselect" handler="menu_item_deselect_cb"/>
- <signal name="activate" handler="show_thousands_separator_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkSeparatorMenuItem" id="separator2">
- <property name="visible">True</property>
- </object>
- </child>
- <child>
- <object class="GtkCheckMenuItem" id="show_registers_menu">
- <property name="visible">True</property>
- <property name="tooltip_text" translatable="yes">Show memory registers</property>
- <property name="label" translatable="yes" comments="View|Memory Registers menu item">_Memory Registers</property>
- <property name="use_underline">True</property>
- <accelerator key="M" signal="activate" modifiers="GDK_CONTROL_MASK"/>
- <signal name="select" handler="menu_item_select_cb"/>
- <signal name="deselect" handler="menu_item_deselect_cb"/>
- <signal name="activate" handler="show_registers_cb"/>
- </object>
- </child>
</object>
</child>
</object>
@@ -256,7 +157,7 @@
<object class="GtkMenu" id="menuitem4_menu">
<child>
<object class="GtkImageMenuItem" id="help_menu">
- <property name="label" comments="Help|Contents menu" translatable="yes">_Contents</property>
+ <property name="label" comments="Help|Contents menu">_Contents</property>
<property name="visible">True</property>
<property name="tooltip_text" translatable="yes">Show help contents</property>
<property name="use_underline">True</property>
@@ -264,8 +165,6 @@
<property name="use_stock">False</property>
<property name="accel_group">accelgroup1</property>
<accelerator key="F1" signal="activate"/>
- <signal name="select" handler="menu_item_select_cb"/>
- <signal name="deselect" handler="menu_item_deselect_cb"/>
<signal name="activate" handler="help_cb"/>
</object>
</child>
@@ -277,8 +176,6 @@
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<property name="accel_group">accelgroup1</property>
- <signal name="select" handler="menu_item_select_cb"/>
- <signal name="deselect" handler="menu_item_deselect_cb"/>
<signal name="activate" handler="about_cb"/>
</object>
</child>
@@ -304,627 +201,62 @@
<property name="vscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
- <object class="GtkTextView" id="displayitem">
- <property name="visible">True</property>
- <property name="border_width">1</property>
- <property name="pixels_above_lines">8</property>
- <property name="pixels_below_lines">8</property>
- <property name="editable">False</property>
- <property name="justification">right</property>
- <property name="right_margin">6</property>
- <property name="buffer">display_buffer</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="displayitem-atkobject">
- <property name="AtkObject::accessible-description" translatable="yes">Result Region</property>
- </object>
- </child>
- <signal name="populate_popup" handler="buffer_populate_popup_cb"/>
- <signal name="button_release_event" handler="mouse_button_cb"/>
- </object>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="programming_mode_panel">
- <property name="visible">True</property>
- <property name="border_width">8</property>
- <child>
- <object class="GtkHBox" id="hbox7">
- <property name="visible">True</property>
- <child>
- <object class="GtkRadioButton" id="64bit_radio">
- <property name="label" translatable="yes" comments="64 bit radio button">_64 bit</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Makes the bitwise functions use 64 bit mode</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="word_cb"/>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkRadioButton" id="32bit_radio">
- <property name="label" translatable="yes" comments="32 bit radio button">_32 bit</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Makes the bitwise functions use 32 bit mode</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">64bit_radio</property>
- <signal name="toggled" handler="word_cb"/>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkRadioButton" id="16bit_radio">
- <property name="label" translatable="yes" comments="16 bit radio button">_16 bit</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Makes the bitwise functions use 16 bit mode</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">64bit_radio</property>
- <signal name="toggled" handler="word_cb"/>
- </object>
- <packing>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox6">
- <property name="visible">True</property>
- <child>
- <object class="GtkRadioButton" id="binary_radio">
- <property name="label" translatable="yes" comments="Base 2 radio button">_Bin</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Set numeric base to binary (base 2)</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="base_cb"/>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkRadioButton" id="octal_radio">
- <property name="label" translatable="yes" comments="Base 8 radio button">_Oct</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Set numeric base to octal (base 8)</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">binary_radio</property>
- <signal name="toggled" handler="base_cb"/>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkRadioButton" id="decimal_radio">
- <property name="label" translatable="yes" comments="Base 10 radio button">_Dec</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Set numeric base to decimal (base 10)</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">binary_radio</property>
- <signal name="toggled" handler="base_cb"/>
- </object>
- <packing>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkRadioButton" id="hexadecimal_radio">
- <property name="label" translatable="yes" comments="Base 16 radio button">He_x</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Set numeric base to hexadecimal (base 16)</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">binary_radio</property>
- <signal name="toggled" handler="base_cb"/>
- </object>
- <packing>
- <property name="position">3</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkVBox" id="scientific_mode_panel">
- <property name="visible">True</property>
- <property name="border_width">6</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkHBox" id="hbox4">
- <property name="visible">True</property>
- <property name="border_width">2</property>
- <child>
- <object class="GtkHBox" id="hbox5">
+ <object class="GtkViewport" id="viewport1">
<property name="visible">True</property>
+ <property name="resize_mode">queue</property>
<child>
- <object class="GtkRadioButton" id="degrees_radio">
- <property name="label" translatable="yes" comments="Degrees radio button">De_grees</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Set trigonometric type to degrees</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="trig_cb"/>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkRadioButton" id="gradians_radio">
- <property name="label" translatable="yes" comments="Gradians radio button">Gr_adians</property>
+ <object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Set trigonometric type to gradians</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">degrees_radio</property>
- <signal name="toggled" handler="trig_cb"/>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkRadioButton" id="radians_radio">
- <property name="label" translatable="yes" comments="Radian radio button">_Radians</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Set trigonometric type to radians</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">degrees_radio</property>
- <signal name="toggled" handler="trig_cb"/>
- </object>
- <packing>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox9">
- <property name="visible">True</property>
- <child>
- <object class="GtkRadioButton" id="engineering_radio">
- <property name="label" translatable="yes" comments="Engineering display radio button">E_ng</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Set display type to engineering format</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="disp_cb"/>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkRadioButton" id="fixed_point_radio">
- <property name="label" translatable="yes" comments="Fixed-point display radio button">_Fix</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Set display type to fixed-point format</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">engineering_radio</property>
- <signal name="toggled" handler="disp_cb"/>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkRadioButton" id="scientific_radio">
- <property name="label" translatable="yes" comments="Scientific display radio button">_Sci</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Set display type to scientific format</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">engineering_radio</property>
- <signal name="toggled" handler="disp_cb"/>
- </object>
- <packing>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="pack_type">end</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox1">
- <property name="visible">True</property>
- <property name="border_width">2</property>
- <child>
- <object class="GtkHBox" id="hbox8">
- <property name="visible">True</property>
- <child>
- <object class="GtkCheckButton" id="inverse_check">
- <property name="label" translatable="yes" comments="Inverse check box">_Inv</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Set inverse option for trigonometric functions</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="inv_cb"/>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="hyperbolic_check">
- <property name="label" translatable="yes" comments="Hyperbolic check box">H_yp</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Set hyperbolic option for trigonometric functions</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="hyp_cb"/>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkTextView" id="displayitem">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="pixels_above_lines">8</property>
+ <property name="pixels_below_lines">2</property>
+ <property name="editable">False</property>
+ <property name="wrap_mode">word</property>
+ <property name="justification">right</property>
+ <property name="right_margin">6</property>
+ <property name="buffer">display_buffer</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="displayitem-atkobject">
+ <property name="AtkObject::accessible-description" translatable="yes">Result Region</property>
+ </object>
+ </child>
+ <signal name="populate_popup" handler="buffer_populate_popup_cb"/>
+ <signal name="button_release_event" handler="middle_click_paste_cb"/>
+ <signal name="paste_clipboard" handler="paste_cb"/>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkTextView" id="info_textview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">False</property>
+ <property name="wrap_mode">word</property>
+ <property name="justification">right</property>
+ <property name="right_margin">6</property>
+ <property name="cursor_visible">False</property>
+ <property name="buffer">info_buffer</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
- <packing>
- <property name="position">1</property>
- </packing>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkTable" id="financial_panel">
- <property name="visible">True</property>
- <property name="border_width">8</property>
- <property name="n_rows">2</property>
- <property name="n_columns">8</property>
- <property name="column_spacing">6</property>
- <property name="row_spacing">6</property>
- <property name="homogeneous">True</property>
- <child>
- <object class="GtkButton" id="calc_finc_sum_of_the_years_digits_depreciation_button">
- <property name="label" translatable="yes" comments="Calculates the depreciation allowance on an asset for a specified period of time, using the Sum-Of-The-Years'-Digits method. This method of depreciation accelerates the rate of depreciation, so that more depreciation expense occurs in earlier periods than in later ones. The depreciable cost is cost - salvage. The useful life is the number of periods, typically years, over which an asset is depreciated. See also: http://en.wikipedia.org/wiki/Depreciation">Syd</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Sum-of-the years'-digits depreciation [Y]</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="button_cb"/>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_finc_straight_line_depreciation_button">
- <property name="label" translatable="yes" comments="Calculates the straight-line depreciation of an asset for one period. The depreciable cost is cost - salvage. The straight-line method of depreciation divides the depreciable cost evenly over the useful life of an asset. The useful life is the number of periods, typically years, over which an asset is depreciated. See also: http://en.wikipedia.org/wiki/Depreciation">Sln</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Straight-line depreciation [l]</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="button_cb"/>
- </object>
- <packing>
- <property name="left_attach">7</property>
- <property name="right_attach">8</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_finc_periodic_interest_rate_button">
- <property name="label" translatable="yes" comments="Calculates the periodic interest necessary to increase an investment of present value pv to a future value of fv, over the number of compounding periods in term. See also: http://en.wikipedia.org/wiki/Interest ">Rate</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Periodic interest rate [T]</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="button_cb"/>
- </object>
- <packing>
- <property name="left_attach">6</property>
- <property name="right_attach">7</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_finc_present_value_button">
- <property name="label" translatable="yes" comments="Calculates the present value of an investment based on a series of equal payments, each of amount pmt, discounted at a periodic interest rate of int, over the number of payment periods in the term. See also: http://en.wikipedia.org/wiki/Present_value">Pv</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Present value [p]</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="button_cb"/>
- </object>
- <packing>
- <property name="left_attach">5</property>
- <property name="right_attach">6</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_finc_periodic_payment_button">
- <property name="label" translatable="yes" comments="Calculates the amount of the periodic payment of a loan, where payments are made at the end of each payment period. See also: http://en.wikipedia.org/wiki/Amortization_schedule">Pmt</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Periodic payment [P]</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="button_cb"/>
- </object>
- <packing>
- <property name="left_attach">4</property>
- <property name="right_attach">5</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_finc_future_value_button">
- <property name="label" translatable="yes" comments="Calculates the future value of an investment based on a series of equal payments, each of amount pmt, at a periodic interest rate of int, over the number of payment periods in the term. See also: http://en.wikipedia.org/wiki/Future_value">Fv</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Future value [v]</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="button_cb"/>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_finc_gross_profit_margin_button">
- <property name="label" translatable="yes" comments="Calculates the resale price of a product, based on the product cost and the wanted gross profit margin. See also: http://en.wikipedia.org/wiki/Gross_profit_margin">Gpm</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Gross Profit Margin [I]</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="button_cb"/>
- </object>
- <packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_finc_double_declining_depreciation_button">
- <property name="label" translatable="yes" comments="Calculates the depreciation allowance on an asset for a specified period of time, using the double-declining balance method. See also: http://en.wikipedia.org/wiki/Depreciation">Ddb</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Double-declining depreciation [D]</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="button_cb"/>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_finc_compounding_term_button">
- <property name="label" translatable="yes" comments="Calculates the number of compounding periods necessary to increase an investment of present value pv to a future value of fv, at a fixed interest rate of int per compounding period. See also: http://en.wikipedia.org/wiki/Compound_interest">Ctrm</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Compounding term [m]</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="button_cb"/>
- </object>
- <packing>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_finc_term_button">
- <property name="label" translatable="yes" comments="Calculates the number of payment periods that are necessary during the term of an ordinary annuity, to accumulate a future value of fv, at a periodic interest rate of int. Each payment is equal to amount pmt. See also: http://en.wikipedia.org/wiki/Annuity_(finance_theory)">Term</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Payment period [t]</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="button_cb"/>
</object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
</child>
</object>
<packing>
- <property name="position">4</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
@@ -933,9 +265,8 @@
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
- <object class="GtkTable" id="table8">
+ <object class="GtkTable" id="bit_table">
<property name="visible">True</property>
- <property name="border_width">6</property>
<property name="n_rows">4</property>
<property name="n_columns">39</property>
<child>
@@ -1531,7 +862,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>
@@ -1545,7 +876,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>
@@ -1559,7 +890,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>
@@ -1575,7 +906,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>
@@ -2261,7 +1592,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>
@@ -2277,7 +1608,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>
@@ -2723,871 +2054,829 @@
</object>
<packing>
<property name="expand">False</property>
- <property name="position">5</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
- <object class="GtkTable" id="scientific_panel">
+ <object class="GtkTable" id="button_table">
<property name="visible">True</property>
- <property name="border_width">8</property>
- <property name="n_rows">2</property>
- <property name="n_columns">8</property>
- <property name="column_spacing">6</property>
- <property name="row_spacing">6</property>
- <property name="homogeneous">True</property>
+ <property name="border_width">3</property>
+ <property name="n_rows">9</property>
+ <property name="n_columns">10</property>
<child>
- <object class="GtkButton" id="calc_functions_button">
+ <object class="GtkTable" id="basic_panel">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">User-defined functions [F]</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
+ <property name="n_rows">4</property>
+ <property name="n_columns">5</property>
<child>
- <object class="GtkHBox" id="hbox13">
+ <object class="GtkButton" id="calc_4_button">
+ <property name="label">4</property>
<property name="visible">True</property>
- <property name="spacing">3</property>
- <child>
- <object class="GtkLabel" id="label9">
- <property name="visible">True</property>
- <property name="label" translatable="yes" comments="Functions button">Fun</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</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_4_button-atkobject">
+ <property name="AtkObject::accessible-name" translatable="yes">Numeric 4</property>
</object>
- <packing>
- <property name="position">0</property>
- </packing>
</child>
- <child>
- <object class="GtkArrow" id="arrow7">
- <property name="visible">True</property>
- <property name="arrow_type">down</property>
+ <signal name="clicked" handler="digit_cb"/>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_7_button">
+ <property name="label">7</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</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_7_button-atkobject">
+ <property name="AtkObject::accessible-name" translatable="yes">Numeric 7</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
</child>
+ <signal name="clicked" handler="digit_cb"/>
</object>
+ <packing>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
</child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_constants_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Constants [#]</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
<child>
- <object class="GtkHBox" id="hbox12">
+ <object class="GtkButton" id="calc_8_button">
+ <property name="label">8</property>
<property name="visible">True</property>
- <property name="spacing">3</property>
- <child>
- <object class="GtkLabel" id="label8">
- <property name="visible">True</property>
- <property name="label" translatable="yes" comments="Constants button">Con</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</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_8_button-atkobject">
+ <property name="AtkObject::accessible-name" translatable="yes">Numeric 8</property>
</object>
- <packing>
- <property name="position">0</property>
- </packing>
</child>
- <child>
- <object class="GtkArrow" id="arrow6">
- <property name="visible">True</property>
- <property name="arrow_type">down</property>
+ <signal name="clicked" handler="digit_cb"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_9_button">
+ <property name="label">9</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</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_9_button-atkobject">
+ <property name="AtkObject::accessible-name" translatable="yes">Numeric 9</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
</child>
+ <signal name="clicked" handler="digit_cb"/>
</object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
</child>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_natural_logarithm_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">(Ln)</property>
- <property name="use_underline">True</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
<child>
- <object class="GtkLabel" id="natural_logarithm_label">
+ <object class="GtkButton" id="calc_5_button">
+ <property name="label">5</property>
<property name="visible">True</property>
- <property name="label" comments="Variable label button - text set inside gtk.c">(Ln)</property>
- <property name="use_markup">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</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_5_button-atkobject">
+ <property name="AtkObject::accessible-name" translatable="yes">Numeric 5</property>
+ </object>
+ </child>
+ <signal name="clicked" handler="digit_cb"/>
</object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
</child>
- </object>
- <packing>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_logarithm_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">(log)</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
<child>
- <object class="GtkLabel" id="logarithm_label">
+ <object class="GtkButton" id="calc_6_button">
+ <property name="label">6</property>
<property name="visible">True</property>
- <property name="label" comments="Varable label button - text set inside gtk.c">(log)</property>
- <property name="use_markup">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</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_6_button-atkobject">
+ <property name="AtkObject::accessible-name" translatable="yes">Numeric 6</property>
+ </object>
+ </child>
+ <signal name="clicked" handler="digit_cb"/>
</object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
</child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_logarithm2_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">(log2)</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
<child>
- <object class="GtkLabel" id="logarithm2_label">
+ <object class="GtkButton" id="calc_divide_button">
+ <property name="label">÷</property>
<property name="visible">True</property>
- <property name="label" comments="Variable function button - text set inside gtk.c">(log2)</property>
- <property name="use_markup">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</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>
+ <signal name="clicked" handler="button_cb"/>
</object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
</child>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_exponential_button">
- <property name="label" translatable="yes" comments="Exponential">Exp</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Enter an exponential number [E]</property>
- <property name="use_underline">True</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_accuracy_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">(Set accuracy from 0 to N numeric places [A])</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
<child>
- <object class="GtkHBox" id="hbox14">
+ <object class="GtkButton" id="calc_1_button">
+ <property name="label">1</property>
<property name="visible">True</property>
- <property name="spacing">3</property>
- <child>
- <object class="GtkLabel" id="label10">
- <property name="visible">True</property>
- <property name="label" translatable="yes" comments="Accuracy button">Acc</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</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_1_button-atkobject">
+ <property name="AtkObject::accessible-name" translatable="yes">Numeric 1</property>
</object>
- <packing>
- <property name="position">0</property>
- </packing>
</child>
- <child>
- <object class="GtkArrow" id="arrow8">
- <property name="visible">True</property>
- <property name="arrow_type">down</property>
+ <signal name="clicked" handler="digit_cb"/>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_2_button">
+ <property name="label">2</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</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_2_button-atkobject">
+ <property name="AtkObject::accessible-name" translatable="yes">Numeric 2</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
</child>
+ <signal name="clicked" handler="digit_cb"/>
</object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
</child>
- </object>
- <packing>
- <property name="left_attach">7</property>
- <property name="right_attach">8</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_random_button">
- <property name="label" translatable="yes" comments="Random number">Rand</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Random number in the range 0.0 to 1.0 [?]</property>
- <property name="use_underline">True</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
- </object>
- <packing>
- <property name="left_attach">7</property>
- <property name="right_attach">8</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_factorial_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Factorial of displayed value [!]</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
<child>
- <object class="GtkLabel" id="label14">
+ <object class="GtkButton" id="calc_0_button">
+ <property name="label">0</property>
<property name="visible">True</property>
- <property name="label" translatable="yes" comments="Factorial"><i>x</i>!</property>
- <property name="use_markup">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</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_0_button-atkobject">
+ <property name="AtkObject::accessible-name" translatable="yes">Numeric 0</property>
+ </object>
+ </child>
+ <signal name="clicked" handler="digit_cb"/>
</object>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
</child>
- </object>
- <packing>
- <property name="left_attach">4</property>
- <property name="right_attach">5</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_x_pow_y_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">(X^Y)</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
<child>
- <object class="GtkLabel" id="x_pow_y_label">
+ <object class="GtkButton" id="calc_numeric_point_button">
+ <property name="label" comments="Label is set in gtk.c to comply with LC flags">.</property>
<property name="visible">True</property>
- <property name="label" comments="Variable function button - text set inside gtk.c">(X^Y)</property>
- <property name="use_markup">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</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>
+ <signal name="clicked" handler="button_cb"/>
</object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
</child>
- </object>
- <packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_tangent_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">(tan)</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
<child>
- <object class="GtkLabel" id="tangent_label">
+ <object class="GtkButton" id="calc_result_button">
+ <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="label" comments="Variable function button - text set inside gtk.c">(tan)</property>
- <property name="use_markup">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</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>
+ <signal name="clicked" handler="solve_cb"/>
</object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
</child>
- </object>
- <packing>
- <property name="left_attach">5</property>
- <property name="right_attach">6</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_sine_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">(sin)</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
<child>
- <object class="GtkLabel" id="sine_label">
+ <object class="GtkButton" id="calc_3_button">
+ <property name="label">3</property>
<property name="visible">True</property>
- <property name="label" comments="Variable function button - text set inside gtk.c">(sin)</property>
- <property name="use_markup">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</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_3_button-atkobject">
+ <property name="AtkObject::accessible-name" translatable="yes">Numeric 3</property>
+ </object>
+ </child>
+ <signal name="clicked" handler="digit_cb"/>
</object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
</child>
- </object>
- <packing>
- <property name="left_attach">4</property>
- <property name="right_attach">5</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_cosine_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">(cos)</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
<child>
- <object class="GtkLabel" id="cosine_label">
+ <object class="GtkButton" id="calc_multiply_button">
+ <property name="label">×</property>
<property name="visible">True</property>
- <property name="label" comments="Variable function button - text set inside gtk.c">(cos)</property>
- <property name="use_markup">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</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>
+ <signal name="clicked" handler="button_cb"/>
</object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_subtract_button">
+ <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" 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>
+ <signal name="clicked" handler="button_cb"/>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_add_button">
+ <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" 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>
+ <signal name="clicked" handler="button_cb"/>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_clear_button">
+ <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="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>
+ <signal name="clicked" handler="clear_cb"/>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_start_group_button">
+ <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="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>
+ <signal name="clicked" handler="button_cb"/>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_end_group_button">
+ <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="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>
+ <signal name="clicked" handler="button_cb"/>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_percentage_button">
+ <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="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>
+ <signal name="clicked" handler="button_cb"/>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
</child>
</object>
<packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- </object>
- <packing>
- <property name="position">6</property>
- </packing>
- </child>
- <child>
- <object class="GtkTable" id="programming_panel">
- <property name="visible">True</property>
- <property name="border_width">8</property>
- <property name="n_rows">3</property>
- <property name="n_columns">6</property>
- <property name="column_spacing">22</property>
- <property name="row_spacing">7</property>
- <property name="homogeneous">True</property>
- <child>
- <object class="GtkButton" id="calc_d_button">
- <property name="label" translatable="yes" comments="Hexadecimal digit D button">D</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Hexadecimal digit D [d]</property>
- <property name="use_underline">True</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_e_button">
- <property name="label" translatable="yes" comments="Hexadecimal digit E button">E</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Hexadecimal digit E [e]</property>
- <property name="use_underline">True</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_f_button">
- <property name="label" translatable="yes" comments="Hexadecimal digit F button">F</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Hexadecimal digit F [f]</property>
- <property name="use_underline">True</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_a_button">
- <property name="label" translatable="yes" comments="Hexadecimal digit A button">A</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Hexadecimal digit A [a]</property>
- <property name="use_underline">True</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
- </object>
- <packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_b_button">
- <property name="label" translatable="yes" comments="Hexadecimal digit B button">B</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Hexadecimal digit B [b]</property>
- <property name="use_underline">True</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_c_button">
- <property name="label" translatable="yes" comments="Hexadecimal digit C button">C</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Hexadecimal digit C [c]</property>
- <property name="use_underline">True</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_1s_button">
- <property name="label" translatable="yes" comments="1's complement">1's</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">1's complement [z]</property>
- <property name="use_underline">True</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
- </object>
- <packing>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_2s_button">
- <property name="label" translatable="yes" comments="2's complement">2's</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">2's complement [Z]</property>
- <property name="use_underline">True</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_xnor_button">
- <property name="label" translatable="yes" comments="Boolean exclusive NOR button">XNOR</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Bitwise XNOR [{]</property>
- <property name="use_underline">True</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
- </object>
- <packing>
- <property name="left_attach">4</property>
- <property name="right_attach">5</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_modulus_divide_button">
- <property name="label" translatable="yes" comments="Modulus division button">Mod</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Modulus Division [M]</property>
- <property name="use_underline">True</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
- </object>
- <packing>
- <property name="left_attach">5</property>
- <property name="right_attach">6</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_trunc_button">
- <property name="label" translatable="yes" comments="Truncate displayed value">Trunc</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Truncate displayed value to the chosen word size ([)</property>
- <property name="use_underline">True</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_not_button">
- <property name="label" translatable="yes" comments="Boolean NOT button">NOT</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Bitwise NOT [~]</property>
- <property name="use_underline">True</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
- </object>
- <packing>
- <property name="left_attach">5</property>
- <property name="right_attach">6</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_xor_button">
- <property name="label" translatable="yes" comments="Boolean exlcusive OR button">XOR</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Bitwise XOR [x]</property>
- <property name="use_underline">True</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
- </object>
- <packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_and_button">
- <property name="label" translatable="yes" comments="Boolean AND button">AND</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Bitwise AND [&]</property>
- <property name="use_underline">True</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
- </object>
- <packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_or_button">
- <property name="label" translatable="yes" comments="Boolean OR button">OR</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Bitwise OR [|]</property>
- <property name="use_underline">True</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
- </object>
- <packing>
- <property name="left_attach">4</property>
<property name="right_attach">5</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">9</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_shift_left_button">
+ <object class="GtkTable" id="advanced_panel">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Shift displayed value 1-15 places to the left [<]</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
+ <property name="n_rows">4</property>
+ <property name="n_columns">5</property>
<child>
- <object class="GtkHBox" id="hbox11">
+ <object class="GtkButton" id="calc_store_button">
<property name="visible">True</property>
- <property name="spacing">3</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>
+ <signal name="clicked" handler="popup_cb"/>
<child>
- <object class="GtkLabel" id="label7">
+ <object class="GtkHBox" id="hbox20">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes" comments="Shift left button"><</property>
+ <property name="spacing">3</property>
+ <child>
+ <object class="GtkLabel" id="label23">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes" comments="The label on the memory store button">← R</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkArrow" id="arrow14">
+ <property name="visible">True</property>
+ <property name="arrow_type">down</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
- <packing>
- <property name="position">0</property>
- </packing>
</child>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_recall_button">
+ <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>
+ <signal name="clicked" handler="popup_cb"/>
<child>
- <object class="GtkArrow" id="arrow5">
+ <object class="GtkHBox" id="hbox19">
<property name="visible">True</property>
- <property name="arrow_type">down</property>
+ <property name="spacing">3</property>
+ <child>
+ <object class="GtkLabel" id="label22">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes" comments="The label on the memory recall button">→ R</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkArrow" id="arrow13">
+ <property name="visible">True</property>
+ <property name="arrow_type">down</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
</child>
</object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
</child>
- </object>
- <packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_shift_right_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Shift displayed value 1-15 places to the right [>]</property>
- <property name="focus_on_click">False</property>
- <signal name="clicked" handler="button_cb"/>
<child>
- <object class="GtkHBox" id="hbox10">
+ <object class="GtkButton" id="calc_pi_button">
<property name="visible">True</property>
- <property name="spacing">3</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>
+ <signal name="clicked" handler="button_cb"/>
<child>
- <object class="GtkLabel" id="label6">
+ <object class="GtkLabel" id="pi_label">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes" comments="Shift right button">></property>
+ <property name="label">π</property>
+ <property name="use_markup">True</property>
</object>
- <packing>
- <property name="position">0</property>
- </packing>
</child>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_modulus_divide_button">
+ <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>
+ <signal name="clicked" handler="button_cb"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_root_button">
+ <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="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>
+ <signal name="clicked" handler="button_cb"/>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_x_pow_y_button">
+ <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="GtkArrow" id="arrow4">
+ <object class="GtkLabel" id="x_pow_y_label">
<property name="visible">True</property>
- <property name="arrow_type">down</property>
+ <property name="label"><i>x</i><sup><i>y</i></sup></property>
+ <property name="use_markup">True</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
</child>
</object>
+ <packing>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
</child>
- </object>
- <packing>
- <property name="left_attach">4</property>
- <property name="right_attach">5</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
- </object>
- <packing>
- <property name="position">7</property>
- </packing>
- </child>
- <child>
- <object class="GtkTable" id="table4">
- <property name="visible">True</property>
- <property name="border_width">8</property>
- <property name="n_rows">5</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">6</property>
- <property name="row_spacing">6</property>
- <child>
- <object class="GtkTable" id="basic_panel">
- <property name="visible">True</property>
- <property name="n_columns">4</property>
- <property name="column_spacing">6</property>
- <property name="row_spacing">6</property>
- <property name="homogeneous">True</property>
<child>
- <object class="GtkButton" id="calc_backspace_simple_button">
- <property name="label" translatable="yes" comments="Backspace button. Bksp is short for Backspace">Bksp</property>
+ <object class="GtkButton" id="calc_logarithm_button">
+ <property name="label">log</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Remove rightmost character from displayed value [Backspace]</property>
- <property name="use_underline">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>
- <child internal-child="accessible">
- <object class="AtkObject" id="calc_backspace_simple_button-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Backspace</property>
+ <signal name="clicked" handler="button_cb"/>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_inverse_button">
+ <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>
+ <signal name="clicked" handler="button_cb"/>
+ <child>
+ <object class="GtkLabel" id="label20">
+ <property name="visible">True</property>
+ <property name="label"><i>x</i><sup>−1</sup></property>
+ <property name="use_markup">True</property>
+ <property name="justify">center</property>
</object>
</child>
+ </object>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_natural_logarithm_button">
+ <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>
<signal name="clicked" handler="button_cb"/>
</object>
<packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_change_sign_simple_button">
- <property name="label" translatable="yes" comments="Change sign button">±</property>
+ <object class="GtkButton" id="calc_eulers_number_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Change Sign [C]</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>
- <child internal-child="accessible">
- <object class="AtkObject" id="calc_change_sign_simple_button-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Change sign</property>
+ <signal name="clicked" handler="button_cb"/>
+ <child>
+ <object class="GtkLabel" id="eulers_number_label">
+ <property name="visible">True</property>
+ <property name="label"><i>e</i></property>
+ <property name="use_markup">True</property>
</object>
</child>
- <signal name="clicked" handler="button_cb"/>
</object>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_clear_simple_button">
- <property name="label" translatable="yes" comments="Clear button. Clr is short for Clear">Clr</property>
+ <object class="GtkButton" id="calc_abs_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Clear displayed value and any partial calculation [Shift Delete]</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_clear_simple_button-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Clear</property>
+ <signal name="clicked" handler="button_cb"/>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label">|<i>x</i>|</property>
+ <property name="use_markup">True</property>
</object>
</child>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_factorial_button">
+ <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"><i>x</i>!</property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_clear_entry_simple_button">
- <property name="label" translatable="yes" comments="Clear displayed value button">CE</property>
+ <object class="GtkButton" id="calc_integer_portion_button">
+ <property name="label">int</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Clear displayed value [Escape]</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_clear_entry_simple_button-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Clear entry</property>
- <property name="AtkObject::accessible-description" translatable="yes">Clear</property>
+ <signal name="clicked" handler="button_cb"/>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_exponential_button">
+ <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>
+ <signal name="clicked" handler="button_cb"/>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="label">×10<sup><i>y</i></sup></property>
+ <property name="use_markup">True</property>
</object>
</child>
- <signal name="clicked" handler="button_cb"/>
</object>
<packing>
<property name="left_attach">1</property>
@@ -3596,69 +2885,99 @@
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
- </object>
- <packing>
- <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkTable" id="advanced_panel">
- <property name="visible">True</property>
- <property name="n_rows">4</property>
- <property name="n_columns">4</property>
- <property name="column_spacing">6</property>
- <property name="row_spacing">6</property>
- <property name="homogeneous">True</property>
<child>
- <object class="GtkButton" id="calc_start_group_button">
- <property name="label" translatable="yes" comments="Start calculation group button">(</property>
+ <object class="GtkButton" id="calc_fractional_portion_button">
+ <property name="label">frac</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Start group of calculations [(]</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_start_group_button-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Left bracket</property>
+ <signal name="clicked" handler="button_cb"/>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_imaginary_button">
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="border_width">3</property>
+ <property name="use_underline">True</property>
+ <property name="focus_on_click">False</property>
+ <signal name="clicked" handler="button_cb"/>
+ <child>
+ <object class="GtkLabel" id="imaginary_label">
+ <property name="visible">True</property>
+ <property name="label"><i>i</i></property>
+ <property name="use_markup">True</property>
</object>
</child>
- <signal name="clicked" handler="button_cb"/>
</object>
<packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_reciprocal_button">
+ <object class="GtkToggleButton" id="subscript_togglebutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Reciprocal [r]</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes" comments="Tooltip for the subscript mode button">Subscipt number mode [Alt+number]</property>
+ <property name="border_width">3</property>
<property name="focus_on_click">False</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="calc_reciprocal_button-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Reciprocal</property>
+ <signal name="clicked" handler="set_subscript_cb"/>
+ <child>
+ <object class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="yalign">0</property>
+ <property name="label">⎕<sub>n</sub></property>
+ <property name="use_markup">True</property>
</object>
</child>
- <signal name="clicked" handler="button_cb"/>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleButton" id="superscript_togglebutton">
+ <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 [Ctrl+number]</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="label20">
+ <object class="GtkLabel" id="label3">
<property name="visible">True</property>
- <property name="label" translatable="yes" comments="Reciprocal button">1/<i>x</i></property>
+ <property name="label">⎕<sup>n</sup></property>
<property name="use_markup">True</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">Reciprocal</property>
- </object>
- </child>
</object>
</child>
</object>
<packing>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
@@ -3666,22 +2985,20 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_percentage_button">
- <property name="label" translatable="yes" comments="The percentage button">%</property>
+ <object class="GtkButton" id="calc_ans_button">
+ <property name="label">ans</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Percentage [%]</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>
- <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>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
@@ -3689,42 +3006,48 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_end_group_button">
- <property name="label" translatable="yes" comments="Right bracket">)</property>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">5</property>
+ <property name="right_attach">10</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">9</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkTable" id="programming_panel">
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">10</property>
+ <child>
+ <object class="GtkButton" id="calc_13_button">
+ <property name="label">D</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">End group of calculations [)]</property>
+ <property name="receives_default">True</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>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_backspace_advanced_button">
- <property name="label" translatable="yes" comments="Bksp is short for Backspace">Bksp</property>
+ <object class="GtkButton" id="calc_14_button">
+ <property name="label">E</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Remove rightmost character from displayed value [Backspace]</property>
+ <property name="receives_default">True</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_backspace_advanced_button-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Backspace</property>
- </object>
- </child>
<signal name="clicked" handler="button_cb"/>
</object>
<packing>
@@ -3735,24 +3058,35 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_change_sign_advanced_button">
- <property name="label" translatable="yes" comments="Change sign button">±</property>
+ <object class="GtkButton" id="calc_15_button">
+ <property name="label">F</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Change Sign [C]</property>
+ <property name="receives_default">True</property>
+ <property name="border_width">3</property>
+ <property name="use_underline">True</property>
+ <property name="focus_on_click">False</property>
+ <signal name="clicked" handler="button_cb"/>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_10_button">
+ <property name="label">A</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</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_change_sign_advanced_button-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Change sign</property>
- </object>
- </child>
<signal name="clicked" handler="button_cb"/>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
@@ -3760,100 +3094,136 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_sqrt_button">
- <property name="label" translatable="yes" comments="Square root button">√</property>
+ <object class="GtkButton" id="calc_11_button">
+ <property name="label">B</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Square root [s]</property>
+ <property name="receives_default">True</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_sqrt_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>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_abs_button">
- <property name="label" translatable="yes" comments="Absolute value button. Abs is short for Absolute">Abs</property>
+ <object class="GtkButton" id="calc_12_button">
+ <property name="label">C</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Absolute value [u]</property>
+ <property name="receives_default">True</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"/>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_fractional_portion_button">
- <property name="label" translatable="yes" comments="Fractional portion button">Frac</property>
+ <object class="GtkButton" id="calc_and_button">
+ <property name="label">and</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Fractional portion of displayed value [:]</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>
- <child internal-child="accessible">
- <object class="AtkObject" id="calc_fractional_portion_button-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Fractional portion</property>
- </object>
- </child>
<signal name="clicked" handler="button_cb"/>
</object>
<packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="left_attach">5</property>
+ <property name="right_attach">6</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_integer_portion_button">
- <property name="label" translatable="yes" comments="Integer portion button">Int</property>
+ <object class="GtkButton" id="calc_or_button">
+ <property name="label">or</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Integer portion of displayed value [i]</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>
- <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>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
+ <property name="left_attach">6</property>
+ <property name="right_attach">7</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_not_button">
+ <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>
+ <signal name="clicked" handler="button_cb"/>
+ </object>
+ <packing>
+ <property name="left_attach">8</property>
+ <property name="right_attach">9</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_xor_button">
+ <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>
+ <signal name="clicked" handler="button_cb"/>
+ </object>
+ <packing>
+ <property name="left_attach">7</property>
+ <property name="right_attach">8</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_ones_complement_button">
+ <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' complement button">Ones' complement</property>
+ <property name="border_width">3</property>
+ <property name="use_underline">True</property>
+ <property name="focus_on_click">False</property>
+ <signal name="clicked" handler="button_cb"/>
+ </object>
+ <packing>
+ <property name="left_attach">7</property>
+ <property name="right_attach">8</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
@@ -3861,62 +3231,51 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_clear_entry_advanced_button">
- <property name="label" translatable="yes" comments="Clear displayed value button">CE</property>
+ <object class="GtkButton" id="calc_twos_complement_button">
+ <property name="label">twos</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Clear displayed value [Escape]</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes" comments="Tooltip for the two's complement button">Two's complement</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_entry_advanced_button-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Clear entry</property>
- </object>
- </child>
<signal name="clicked" handler="button_cb"/>
</object>
<packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
+ <property name="left_attach">8</property>
+ <property name="right_attach">9</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_exchange_button">
+ <object class="GtkButton" id="calc_shift_right_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Exchange displayed value with memory register [X]</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes" comments="Tooltip for the shift right button">Shift right [>]</property>
+ <property name="border_width">3</property>
<property name="focus_on_click">False</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="calc_exchange_button-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Exchange with register</property>
- </object>
- </child>
- <signal name="clicked" handler="button_cb"/>
+ <signal name="clicked" handler="popup_cb"/>
<child>
- <object class="GtkHBox" id="hbox18">
+ <object class="GtkHBox" id="hbox10">
<property name="visible">True</property>
<property name="spacing">3</property>
<child>
- <object class="GtkLabel" id="label21">
+ <object class="GtkLabel" id="label6">
<property name="visible">True</property>
- <property name="label" translatable="yes" comments="Memory exchange button. Exch is short for Exchange">Exch</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="label21-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Exch</property>
- <property name="AtkObject::accessible-description" translatable="yes">Exchange with register</property>
- </object>
- </child>
+ <property name="can_focus">True</property>
+ <property name="label">></property>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkArrow" id="arrow12">
+ <object class="GtkArrow" id="arrow4">
<property name="visible">True</property>
<property name="arrow_type">down</property>
</object>
@@ -3929,48 +3288,39 @@
</child>
</object>
<packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
+ <property name="left_attach">6</property>
+ <property name="right_attach">7</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_recall_button">
+ <object class="GtkButton" id="calc_shift_left_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Retrieve memory register to display [R]</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes" comments="Tooltip for the shift left button">Shift left [<]</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="button_cb"/>
+ <signal name="clicked" handler="popup_cb"/>
<child>
- <object class="GtkHBox" id="hbox19">
+ <object class="GtkHBox" id="hbox11">
<property name="visible">True</property>
<property name="spacing">3</property>
<child>
- <object class="GtkLabel" id="label22">
+ <object class="GtkLabel" id="label7">
<property name="visible">True</property>
- <property name="label" translatable="yes" comments="Memory recall button. Rcl is short for Recall">Rcl</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="can_focus">True</property>
+ <property name="label"><</property>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkArrow" id="arrow13">
+ <object class="GtkArrow" id="arrow5">
<property name="visible">True</property>
<property name="arrow_type">down</property>
</object>
@@ -3983,28 +3333,45 @@
</child>
</object>
<packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="left_attach">5</property>
+ <property name="right_attach">6</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_clear_advanced_button">
- <property name="label" translatable="yes" comments="Clear display button. Clr is short for Clear">Clr</property>
+ <object class="GtkButton" id="calc_trunc_button">
+ <property name="label">trunc</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Clear displayed value and any partial calculation [Shift Delete]</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>
+ <signal name="clicked" handler="button_cb"/>
+ </object>
+ <packing>
+ <property name="left_attach">9</property>
+ <property name="right_attach">10</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_random_button">
+ <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>
- <child internal-child="accessible">
- <object class="AtkObject" id="calc_clear_advanced_button-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Clear</property>
- </object>
- </child>
<signal name="clicked" handler="button_cb"/>
</object>
<packing>
@@ -4015,47 +3382,19 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_store_button">
+ <object class="GtkButton" id="calc_base_2_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Store displayed value in memory register [S]</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>
- <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="button_cb"/>
<child>
- <object class="GtkHBox" id="hbox20">
+ <object class="GtkLabel" id="base_2_label">
<property name="visible">True</property>
- <property name="spacing">3</property>
- <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">Sto</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>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkArrow" id="arrow14">
- <property name="visible">True</property>
- <property name="arrow_type">down</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
+ <property name="label"><i>x</i><sub>2</sub></property>
+ <property name="use_markup">True</property>
</object>
</child>
</object>
@@ -4069,115 +3408,202 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_square_button">
+ <object class="GtkButton" id="calc_base_8_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Square [ ]</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>
- <child internal-child="accessible">
- <object class="AtkObject" id="calc_square_button-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Square</property>
+ <signal name="clicked" handler="button_cb"/>
+ <child>
+ <object class="GtkLabel" id="base_8_label">
+ <property name="visible">True</property>
+ <property name="label"><i>x</i><sub>8</sub></property>
+ <property name="use_markup">True</property>
</object>
</child>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_base_16_button">
+ <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="label24">
+ <object class="GtkLabel" id="base_16_label">
<property name="visible">True</property>
- <property name="label" translatable="yes" comments="x to the power of 2 button"><i>x</i><sup>2</sup></property>
+ <property name="label"><i>x</i><sub>16</sub></property>
<property name="use_markup">True</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="label24-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">x2</property>
- <property name="AtkObject::accessible-description" translatable="yes">Square</property>
- </object>
- </child>
</object>
</child>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_character_button">
+ <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="Tooltip for the insert character button">Insert character</property>
+ <property name="border_width">3</property>
+ <property name="focus_on_click">False</property>
+ </object>
+ <packing>
+ <property name="left_attach">9</property>
+ <property name="right_attach">10</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
+ <property name="right_attach">10</property>
+ <property name="top_attach">3</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkTable" id="core_panel">
- <property name="visible">True</property>
- <property name="n_rows">4</property>
- <property name="n_columns">4</property>
- <property name="column_spacing">6</property>
- <property name="row_spacing">6</property>
- <property name="homogeneous">True</property>
+ <object class="GtkTable" id="si_panel">
+ <property name="n_columns">10</property>
<child>
- <object class="GtkButton" id="calc_4_button">
- <property name="label" translatable="yes" comments="Numeric 4 button">4</property>
+ <object class="GtkButton" id="calc_si_kilo_button">
+ <property name="label">k</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
+ <property name="receives_default">True</property>
+ <property name="border_width">3</property>
<property name="focus_on_click">False</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="calc_4_button-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Numeric 4</property>
- </object>
- </child>
- <signal name="clicked" handler="button_cb"/>
</object>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="left_attach">5</property>
+ <property name="right_attach">6</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_7_button">
- <property name="label" translatable="yes" comments="Numeric 7 button">7</property>
+ <object class="GtkButton" id="calc_si_milli_button">
+ <property name="label">m</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
+ <property name="receives_default">True</property>
+ <property name="border_width">3</property>
+ <property name="focus_on_click">False</property>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_si_micro_button">
+ <property name="label">µ</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="border_width">3</property>
<property name="focus_on_click">False</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="calc_7_button-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Numeric 7</property>
- </object>
- </child>
- <signal name="clicked" handler="button_cb"/>
</object>
<packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_8_button">
- <property name="label" translatable="yes" comments="Numeric 8 button">8</property>
+ <object class="GtkButton" id="calc_si_mega_button">
+ <property name="label">M</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
+ <property name="receives_default">True</property>
+ <property name="border_width">3</property>
+ <property name="focus_on_click">False</property>
+ </object>
+ <packing>
+ <property name="left_attach">6</property>
+ <property name="right_attach">7</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_si_giga_button">
+ <property name="label">G</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="border_width">3</property>
+ <property name="focus_on_click">False</property>
+ </object>
+ <packing>
+ <property name="left_attach">7</property>
+ <property name="right_attach">8</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_si_peta_button">
+ <property name="label">P</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="border_width">3</property>
+ <property name="focus_on_click">False</property>
+ </object>
+ <packing>
+ <property name="left_attach">8</property>
+ <property name="right_attach">9</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_si_femto_button">
+ <property name="label">f</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="border_width">3</property>
+ <property name="focus_on_click">False</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_si_pico_button">
+ <property name="label">p</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="border_width">3</property>
<property name="focus_on_click">False</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="calc_8_button-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Numeric 8</property>
- </object>
- </child>
- <signal name="clicked" handler="button_cb"/>
</object>
<packing>
<property name="left_attach">1</property>
@@ -4187,19 +3613,13 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_9_button">
- <property name="label" translatable="yes" comments="Numeric 9 button">9</property>
+ <object class="GtkButton" id="calc_si_nano_button">
+ <property name="label">n</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
+ <property name="receives_default">True</property>
+ <property name="border_width">3</property>
<property name="focus_on_click">False</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="calc_9_button-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Numeric 9</property>
- </object>
- </child>
- <signal name="clicked" handler="button_cb"/>
</object>
<packing>
<property name="left_attach">2</property>
@@ -4209,67 +3629,63 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_5_button">
- <property name="label" translatable="yes" comments="Numeric 5 button">5</property>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="right_attach">10</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkTable" id="scientific_panel">
+ <property name="visible">True</property>
+ <property name="n_columns">10</property>
+ <child>
+ <object class="GtkButton" id="calc_tangent_button">
+ <property name="label">tan</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
+ <property name="receives_default">True</property>
+ <property name="border_width">3</property>
<property name="focus_on_click">False</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="calc_5_button-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Numeric 5</property>
- </object>
- </child>
<signal name="clicked" handler="button_cb"/>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="left_attach">5</property>
+ <property name="right_attach">6</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_6_button">
- <property name="label" translatable="yes" comments="Numeric 6 button">6</property>
+ <object class="GtkButton" id="calc_sine_button">
+ <property name="label">sin</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
+ <property name="receives_default">True</property>
+ <property name="border_width">3</property>
<property name="focus_on_click">False</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="calc_6_button-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Numeric 6</property>
- </object>
- </child>
<signal name="clicked" handler="button_cb"/>
</object>
<packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_divide_button">
- <property name="label" translatable="yes" comments="Division button">÷</property>
+ <object class="GtkButton" id="calc_cosine_button">
+ <property name="label">cos</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="use_underline">True</property>
+ <property name="receives_default">True</property>
+ <property name="border_width">3</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>
@@ -4280,258 +3696,270 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_1_button">
- <property name="label" translatable="yes" comments="Numeric 1 button">1</property>
+ <object class="GtkButton" id="calc_hyperbolic_cosine_button">
+ <property name="label">cosh</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
+ <property name="receives_default">True</property>
+ <property name="border_width">3</property>
<property name="focus_on_click">False</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="calc_1_button-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Numeric 1</property>
- </object>
- </child>
<signal name="clicked" handler="button_cb"/>
</object>
<packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="left_attach">6</property>
+ <property name="right_attach">7</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_2_button">
- <property name="label" translatable="yes" comments="Numeric 2 button">2</property>
+ <object class="GtkButton" id="calc_hyperbolic_sine_button">
+ <property name="label">sinh</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
+ <property name="receives_default">True</property>
+ <property name="border_width">3</property>
<property name="focus_on_click">False</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="calc_2_button-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Numeric 2</property>
- </object>
- </child>
<signal name="clicked" handler="button_cb"/>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="left_attach">7</property>
+ <property name="right_attach">8</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_0_button">
- <property name="label" translatable="yes" comments="Numeric 0 button">0</property>
+ <object class="GtkButton" id="calc_hyperbolic_tangent_button">
+ <property name="label">tanh</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
+ <property name="receives_default">True</property>
+ <property name="border_width">3</property>
<property name="focus_on_click">False</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="calc_0_button-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Numeric 0</property>
- </object>
- </child>
<signal name="clicked" handler="button_cb"/>
</object>
<packing>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
+ <property name="left_attach">8</property>
+ <property name="right_attach">9</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_numeric_point_button">
- <property name="label" comments="Label is set in gtk.c to comply with LC flags">.</property>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="right_attach">10</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkTable" id="financial_panel">
+ <property name="visible">True</property>
+ <property name="n_columns">10</property>
+ <child>
+ <object class="GtkButton" id="calc_finc_straight_line_depreciation_button">
+ <property name="label" translatable="yes" comments="Calculates the straight-line depreciation of an asset for one period. The depreciable cost is cost - salvage. The straight-line method of depreciation divides the depreciable cost evenly over the useful life of an asset. The useful life is the number of periods, typically years, over which an asset is depreciated. See also: http://en.wikipedia.org/wiki/Depreciation">Sln</property>
<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</property>
+ <property name="receives_default">True</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"/>
+ <signal name="clicked" handler="finc_cb"/>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
+ <property name="left_attach">7</property>
+ <property name="right_attach">8</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_result_button">
- <property name="label" translatable="yes" comments="Solve button (clicking this solves the displayed calculation)">=</property>
+ <object class="GtkButton" id="calc_finc_periodic_interest_rate_button">
+ <property name="label" translatable="yes" comments="Calculates the periodic interest necessary to increase an investment of present value pv to a future value of fv, over the number of compounding periods in term. See also: http://en.wikipedia.org/wiki/Interest ">Rate</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="receives_default">True</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="button_cb"/>
+ <signal name="clicked" handler="finc_cb"/>
</object>
<packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
+ <property name="left_attach">6</property>
+ <property name="right_attach">7</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_3_button">
- <property name="label" translatable="yes" comments="Numeric 3 button">3</property>
+ <object class="GtkButton" id="calc_finc_present_value_button">
+ <property name="label" translatable="yes" comments="Calculates the present value of an investment based on a series of equal payments, each of amount pmt, discounted at a periodic interest rate of int, over the number of payment periods in the term. See also: http://en.wikipedia.org/wiki/Present_value">Pv</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">False</property>
+ <property name="receives_default">True</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_3_button-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Numeric 3</property>
- </object>
- </child>
- <signal name="clicked" handler="button_cb"/>
+ <signal name="clicked" handler="finc_cb"/>
+ </object>
+ <packing>
+ <property name="left_attach">5</property>
+ <property name="right_attach">6</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_finc_periodic_payment_button">
+ <property name="label" translatable="yes" comments="Calculates the amount of the periodic payment of a loan, where payments are made at the end of each payment period. See also: http://en.wikipedia.org/wiki/Amortization_schedule">Pmt</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="border_width">3</property>
+ <property name="use_underline">True</property>
+ <property name="focus_on_click">False</property>
+ <signal name="clicked" handler="finc_cb"/>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_finc_future_value_button">
+ <property name="label" translatable="yes" comments="Calculates the future value of an investment based on a series of equal payments, each of amount pmt, at a periodic interest rate of int, over the number of payment periods in the term. See also: http://en.wikipedia.org/wiki/Future_value">Fv</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="border_width">3</property>
+ <property name="use_underline">True</property>
+ <property name="focus_on_click">False</property>
+ <signal name="clicked" handler="finc_cb"/>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_multiply_button">
- <property name="label" translatable="yes" comments="Multiplication button">×</property>
+ <object class="GtkButton" id="calc_finc_gross_profit_margin_button">
+ <property name="label" translatable="yes" comments="Calculates the resale price of a product, based on the product cost and the wanted gross profit margin. See also: http://en.wikipedia.org/wiki/Gross_profit_margin">Gpm</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="receives_default">True</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"/>
+ <signal name="clicked" handler="finc_cb"/>
</object>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_subtract_button">
- <property name="label" translatable="yes" comments="Subtraction button">−</property>
+ <object class="GtkButton" id="calc_finc_double_declining_depreciation_button">
+ <property name="label" translatable="yes" comments="Calculates the depreciation allowance on an asset for a specified period of time, using the double-declining balance method. See also: http://en.wikipedia.org/wiki/Depreciation">Ddb</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="receives_default">True</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"/>
+ <signal name="clicked" handler="finc_cb"/>
</object>
<packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="calc_add_button">
- <property name="label" translatable="yes" comments="Addition button">+</property>
+ <object class="GtkButton" id="calc_finc_compounding_term_button">
+ <property name="label" translatable="yes" comments="Calculates the number of compounding periods necessary to increase an investment of present value pv to a future value of fv, at a fixed interest rate of int per compounding period. See also: http://en.wikipedia.org/wiki/Compound_interest">Ctrm</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="receives_default">True</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"/>
+ <signal name="clicked" handler="finc_cb"/>
</object>
<packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_finc_sum_of_the_years_digits_depreciation_button">
+ <property name="label" translatable="yes" comments="Calculates the depreciation allowance on an asset for a specified period of time, using the Sum-Of-The-Years'-Digits method. This method of depreciation accelerates the rate of depreciation, so that more depreciation expense occurs in earlier periods than in later ones. The depreciable cost is cost - salvage. The useful life is the number of periods, typically years, over which an asset is depreciated. See also: http://en.wikipedia.org/wiki/Depreciation">Syd</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="border_width">3</property>
+ <property name="use_underline">True</property>
+ <property name="focus_on_click">False</property>
+ <signal name="clicked" handler="finc_cb"/>
+ </object>
+ <packing>
+ <property name="left_attach">8</property>
+ <property name="right_attach">9</property>
+ <property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ <property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_finc_term_button">
+ <property name="label" translatable="yes" comments="Calculates the number of payment periods that are necessary during the term of an ordinary annuity, to accumulate a future value of fv, at a periodic interest rate of int. Each payment is equal to amount pmt. See also: http://en.wikipedia.org/wiki/Annuity_(finance_theory)">Term</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="border_width">3</property>
+ <property name="use_underline">True</property>
+ <property name="focus_on_click">False</property>
+ <signal name="clicked" handler="finc_cb"/>
+ </object>
+ <packing>
+ <property name="left_attach">9</property>
+ <property name="right_attach">10</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
</object>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">5</property>
+ <property name="right_attach">10</property>
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
</packing>
</child>
- <child>
- <placeholder/>
- </child>
- </object>
- <packing>
- <property name="position">8</property>
- </packing>
- </child>
- <child>
- <object class="GtkStatusbar" id="statusbar">
- <property name="visible">True</property>
- <property name="has_resize_grip">False</property>
- <child>
- <object class="GtkImage" id="status_image">
- <property name="visible">True</property>
- <property name="stock">gtk-missing-image</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
</object>
<packing>
<property name="expand">False</property>
- <property name="position">9</property>
+ <property name="position">3</property>
</packing>
</child>
</object>
@@ -4783,954 +4211,87 @@
</object>
</child>
</object>
- <object class="GtkMenu" id="accuracy_popup">
- <property name="border_width">1</property>
- <child>
- <object class="GtkRadioMenuItem" id="acc_item0">
- <property name="visible">True</property>
- <property name="label" translatable="yes" comments="Accuracy Popup: Menu item to set accuracy to 0 significant places">_0 significant places</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="accuracy_radio_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkRadioMenuItem" id="acc_item1">
- <property name="visible">True</property>
- <property name="label" translatable="yes" comments="Accuracy Popup: Menu item to set accuracy to 1 significant place">_1 significant place</property>
- <property name="use_underline">True</property>
- <property name="group">acc_item0</property>
- <signal name="activate" handler="accuracy_radio_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkRadioMenuItem" id="acc_item2">
- <property name="visible">True</property>
- <property name="label" translatable="yes" comments="Accuracy Popup: Menu item to set accuracy to 2 significant places">_2 significant places</property>
- <property name="use_underline">True</property>
- <property name="group">acc_item0</property>
- <signal name="activate" handler="accuracy_radio_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkRadioMenuItem" id="acc_item3">
- <property name="visible">True</property>
- <property name="label" translatable="yes" comments="Accuracy Popup: Menu item to set accuracy to 3 significant places">_3 significant places</property>
- <property name="use_underline">True</property>
- <property name="group">acc_item0</property>
- <signal name="activate" handler="accuracy_radio_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkRadioMenuItem" id="acc_item4">
- <property name="visible">True</property>
- <property name="label" translatable="yes" comments="Accuracy Popup: Menu item to set accuracy to 4 significant places">_4 significant places</property>
- <property name="use_underline">True</property>
- <property name="group">acc_item0</property>
- <signal name="activate" handler="accuracy_radio_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkRadioMenuItem" id="acc_item5">
- <property name="visible">True</property>
- <property name="label" translatable="yes" comments="Accuracy Popup: Menu item to set accuracy to 5 significant places">_5 significant places</property>
- <property name="use_underline">True</property>
- <property name="group">acc_item0</property>
- <signal name="activate" handler="accuracy_radio_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkRadioMenuItem" id="acc_item6">
- <property name="visible">True</property>
- <property name="label" translatable="yes" comments="Accuracy Popup: Menu item to set accuracy to 6 significant places">_6 significant places</property>
- <property name="use_underline">True</property>
- <property name="group">acc_item0</property>
- <signal name="activate" handler="accuracy_radio_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkRadioMenuItem" id="acc_item7">
- <property name="visible">True</property>
- <property name="label" translatable="yes" comments="Accuracy Popup: Menu item to set accuracy to 7 significant places">_7 significant places</property>
- <property name="use_underline">True</property>
- <property name="group">acc_item0</property>
- <signal name="activate" handler="accuracy_radio_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkRadioMenuItem" id="acc_item8">
- <property name="visible">True</property>
- <property name="label" translatable="yes" comments="Accuracy Popup: Menu item to set accuracy to 8 significant places">_8 significant places</property>
- <property name="use_underline">True</property>
- <property name="group">acc_item0</property>
- <signal name="activate" handler="accuracy_radio_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkRadioMenuItem" id="acc_item9">
- <property name="visible">True</property>
- <property name="label" translatable="yes" comments="Accuracy Popup: Menu item to set accuracy to 9 significant places">_9 significant places</property>
- <property name="use_underline">True</property>
- <property name="group">acc_item0</property>
- <signal name="activate" handler="accuracy_radio_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkRadioMenuItem" id="acc_item_other">
- <property name="visible">True</property>
- <property name="label" comments="Variable label button - text set inside gtk.c">(_Other (N) ...)</property>
- <property name="use_underline">True</property>
- <property name="group">acc_item0</property>
- <signal name="activate" handler="accuracy_other_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkSeparatorMenuItem" id="separator4">
- <property name="visible">True</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="acc_item_default">
- <property name="visible">True</property>
- <property name="label" comments="Set and translated inside gtk.c">Reset to _Default (%d)</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="accuracy_default_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkSeparatorMenuItem" id="separator5">
- <property name="visible">True</property>
- </object>
- </child>
- <child>
- <object class="GtkCheckMenuItem" id="acc_trailing_zeroes_item">
- <property name="visible">True</property>
- <property name="label" translatable="yes" comments="Accuracy Popup: Check menu item to enable trailing zeroes">Show _Trailing Zeroes</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="show_trailing_zeroes_cb"/>
- </object>
- </child>
+ <object class="GtkListStore" id="angle_unit_model">
+ <columns>
+ <!-- column-name label -->
+ <column type="gchararray"/>
+ <!-- column-name units -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <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" 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" comments="Preferences dialog: Angle unit combo box: Use gradians for trigonometric calculations">Gradians</col>
+ <col id="1">gradians</col>
+ </row>
+ </data>
</object>
- <object class="GtkDialog" id="register_dialog">
- <property name="border_width">5</property>
- <property name="title" translatable="yes">Memory Registers</property>
- <property name="resizable">False</property>
- <property name="type_hint">dialog</property>
- <property name="has_separator">False</property>
- <signal name="response" handler="register_dialog_response_cb"/>
- <signal name="delete_event" handler="register_dialog_delete_cb"/>
- <child internal-child="vbox">
- <object class="GtkVBox" id="dialog-vbox1">
- <property name="visible">True</property>
- <property name="orientation">vertical</property>
- <property name="spacing">2</property>
- <child>
- <object class="GtkTable" id="table9">
- <property name="visible">True</property>
- <property name="border_width">5</property>
- <property name="n_rows">10</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">12</property>
- <property name="row_spacing">6</property>
- <child>
- <object class="GtkLabel" id="label40">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" comments=""R0" is the abbreviation for "Register 0", used in the memory register dialog"><span weight="bold">R0</span></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label41">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" comments=""R1" is the abbreviation for "Register 1", used in the memory register dialog"><span weight="bold">R1</span></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label42">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" comments=""R2" is the abbreviation for "Register 2", used in the memory register dialog"><span weight="bold">R2</span></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label43">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" comments=""R3" is the abbreviation for "Register 3", used in the memory register dialog"><span weight="bold">R3</span></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label44">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" comments=""R4" is the abbreviation for "Register 4", used in the memory register dialog"><span weight="bold">R4</span></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label45">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" comments=""R5" is the abbreviation for "Register 5", used in the memory register dialog"><span weight="bold">R5</span></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label46">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" comments=""R6" is the abbreviation for "Register 6", used in the memory register dialog"><span weight="bold">R6</span></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label47">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" comments=""R7" is the abbreviation for "Register 7", used in the memory register dialog"><span weight="bold">R7</span></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="top_attach">7</property>
- <property name="bottom_attach">8</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label48">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" comments=""R8" is the abbreviation for "Register 8", used in the memory register dialog"><span weight="bold">R8</span></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="top_attach">8</property>
- <property name="bottom_attach">9</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label49">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" comments=""R9" is the abbreviation for "Register 9", used in the memory register dialog"><span weight="bold">R9</span></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="top_attach">9</property>
- <property name="bottom_attach">10</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="register_entry_0">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">False</property>
- <property name="invisible_char">●</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="register_entry_0-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes" comments="This is accessible name for memory register 0. It is spoken by screen readers such as Orca, to help people who are blind or have low vision.">register 0</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="register_entry_1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">False</property>
- <property name="invisible_char">●</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="register_entry_1-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes" comments="This is accessible name for memory register 1. It is spoken by screen readers such as Orca, to help people who are blind or have low vision.">register 1</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="register_entry_2">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">False</property>
- <property name="invisible_char">●</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="register_entry_2-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes" comments="This is accessible name for memory register 2. It is spoken by screen readers such as Orca, to help people who are blind or have low vision.">register 2</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="register_entry_3">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">False</property>
- <property name="invisible_char">●</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="register_entry_3-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes" comments="This is accessible name for memory register 3. It is spoken by screen readers such as Orca, to help people who are blind or have low vision.">register 3</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="register_entry_4">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">False</property>
- <property name="invisible_char">●</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="register_entry_4-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes" comments="This is accessible name for memory register 4. It is spoken by screen readers such as Orca, to help people who are blind or have low vision.">register 4</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="register_entry_5">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">False</property>
- <property name="invisible_char">●</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="register_entry_5-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes" comments="This is accessible name for memory register 5. It is spoken by screen readers such as Orca, to help people who are blind or have low vision.">register 5</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="register_entry_6">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">False</property>
- <property name="invisible_char">●</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="register_entry_6-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes" comments="This is accessible name for memory register 6. It is spoken by screen readers such as Orca, to help people who are blind or have low vision.">register 6</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="register_entry_7">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">False</property>
- <property name="invisible_char">●</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="register_entry_7-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes" comments="This is accessible name for memory register 7. It is spoken by screen readers such as Orca, to help people who are blind or have low vision.">register 7</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">7</property>
- <property name="bottom_attach">8</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="register_entry_8">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">False</property>
- <property name="invisible_char">●</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="register_entry_8-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes" comments="This is accessible name for memory register 8. It is spoken by screen readers such as Orca, to help people who are blind or have low vision.">register 8</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">8</property>
- <property name="bottom_attach">9</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="register_entry_9">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">False</property>
- <property name="invisible_char">●</property>
- <child internal-child="accessible">
- <object class="AtkObject" id="register_entry_9-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes" comments="This is accessible name for memory register 9. It is spoken by screen readers such as Orca, to help people who are blind or have low vision.">register 9</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">9</property>
- <property name="bottom_attach">10</property>
- <property name="y_options"></property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area1">
- <property name="visible">True</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="closebutton1">
- <property name="label">gtk-close</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- </child>
- <action-widgets>
- <action-widget response="-7">closebutton1</action-widget>
- </action-widgets>
+ <object class="GtkListStore" id="display_format_model">
+ <columns>
+ <!-- column-name label -->
+ <column type="gchararray"/>
+ <!-- column-name format -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">Decimal</col>
+ <col id="1">decimal</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Scientific</col>
+ <col id="1">scientific</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Engineering</col>
+ <col id="1">engineering</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Binary</col>
+ <col id="1">binary</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Octal</col>
+ <col id="1">octal</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Hexadecimal</col>
+ <col id="1">hexadecimal</col>
+ </row>
+ </data>
</object>
- <object class="GtkDialog" id="edit_constants_dialog">
- <property name="width_request">380</property>
- <property name="height_request">300</property>
- <property name="border_width">5</property>
- <property name="title" translatable="yes" comments="Title of edit constants dialog">Edit Constants</property>
- <property name="destroy_with_parent">True</property>
- <property name="type_hint">dialog</property>
- <property name="has_separator">False</property>
- <signal name="response" handler="edit_constants_response_cb"/>
- <signal name="delete_event" handler="edit_constants_delete_cb"/>
- <child internal-child="vbox">
- <object class="GtkVBox" id="dialog-vbox2">
- <property name="visible">True</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkVBox" id="vbox2">
- <property name="visible">True</property>
- <property name="border_width">5</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="label51">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" comments="Edit Constants Dialog: Instructions in dialog">Click a _value or description to edit it:</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkScrolledWindow" id="scrolledwindow1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">automatic</property>
- <property name="vscrollbar_policy">never</property>
- <child>
- <object class="GtkTreeView" id="edit_constants_treeview">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="rules_hint">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label50">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" comments="Edit Constants Dialog: Note about what base numbers will be entered as"><small><i><b>Note:</b> All constant values are specified in the decimal numeric base.</i></small></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area2">
- <property name="visible">True</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="helpbutton1">
- <property name="label">gtk-help</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="cancelbutton1">
- <property name="label">gtk-cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="okbutton1">
- <property name="label">gtk-ok</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="receives_default">False</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- </child>
- <action-widgets>
- <action-widget response="-11">helpbutton1</action-widget>
- <action-widget response="-6">cancelbutton1</action-widget>
- <action-widget response="-3">okbutton1</action-widget>
- </action-widgets>
- </object>
- <object class="GtkMenu" id="constants_popup">
- <child>
- <object class="GtkMenuItem" id="edit_constants1">
- <property name="visible">True</property>
- <property name="label" translatable="yes" comments="Menu item in the constants menu to show the Edit Constants dialog">Edit Constants...</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="edit_constants_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="constant_menu_item0">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="constant_menu_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="constant_menu_item1">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="constant_menu_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="constant_menu_item2">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="constant_menu_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="constant_menu_item3">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="constant_menu_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="constant_menu_item4">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="constant_menu_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="constant_menu_item5">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="constant_menu_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="constant_menu_item6">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="constant_menu_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="constant_menu_item7">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="constant_menu_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="constant_menu_item8">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="constant_menu_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="constant_menu_item9">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="constant_menu_cb"/>
- </object>
- </child>
- </object>
- <object class="GtkMenu" id="functions_popup">
- <child>
- <object class="GtkMenuItem" id="menuitem6">
- <property name="visible">True</property>
- <property name="label" translatable="yes" comments="Menu item in the constants menu to show the Edit Functions dialog">Edit Functions...</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="edit_functions_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="function_menu_item0">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="function_menu_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="function_menu_item1">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="function_menu_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="function_menu_item2">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="function_menu_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="function_menu_item3">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="function_menu_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="function_menu_item4">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="function_menu_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="function_menu_item5">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="function_menu_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="function_menu_item6">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="function_menu_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="function_menu_item7">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="function_menu_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="function_menu_item8">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="function_menu_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="function_menu_item9">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="function_menu_cb"/>
- </object>
- </child>
- </object>
- <object class="GtkDialog" id="edit_functions_dialog">
- <property name="width_request">380</property>
- <property name="height_request">300</property>
- <property name="border_width">5</property>
- <property name="title" translatable="yes" comments="Title of edit functions dialog">Edit Functions</property>
- <property name="destroy_with_parent">True</property>
- <property name="type_hint">dialog</property>
- <property name="has_separator">False</property>
- <signal name="response" handler="edit_functions_response_cb"/>
- <signal name="delete_event" handler="edit_functions_delete_cb"/>
- <child internal-child="vbox">
- <object class="GtkVBox" id="vbox4">
- <property name="visible">True</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkVBox" id="vbox5">
- <property name="visible">True</property>
- <property name="border_width">5</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="label53">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" comments="Edit Functions Dialog: Instructions in dialog">Click a _value or description to edit it:</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkScrolledWindow" id="scrolledwindow2">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">automatic</property>
- <property name="vscrollbar_policy">never</property>
- <child>
- <object class="GtkTreeView" id="edit_functions_treeview">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="rules_hint">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label54">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes" comments="Edit Function Dialog: Note about what base numbers will be entered as"><small><i><b>Note:</b> All constant values are specified in the decimal numeric base.</i></small></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child internal-child="action_area">
- <object class="GtkHButtonBox" id="hbuttonbox3">
- <property name="visible">True</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="button5">
- <property name="label">gtk-help</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button6">
- <property name="label">gtk-cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button7">
- <property name="label">gtk-ok</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="receives_default">False</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- </child>
- <action-widgets>
- <action-widget response="-11">button5</action-widget>
- <action-widget response="-6">button6</action-widget>
- <action-widget response="-3">button7</action-widget>
- </action-widgets>
+ <object class="GtkListStore" id="word_size_model">
+ <columns>
+ <!-- column-name label -->
+ <column type="gchararray"/>
+ <!-- column-name size -->
+ <column type="gint"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">8-bit</col>
+ <col id="1">8</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">16-bit</col>
+ <col id="1">16</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">32-bit</col>
+ <col id="1">32</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">64-bit</col>
+ <col id="1">64</col>
+ </row>
+ </data>
</object>
<object class="GtkMenu" id="memory_store_popup">
<child>
@@ -5804,78 +4365,6 @@
</object>
</child>
</object>
- <object class="GtkMenu" id="memory_exchange_popup">
- <child>
- <object class="GtkMenuItem" id="exchange_menu_item0">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="exchange_menu_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="exchange_menu_item1">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="exchange_menu_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="exchange_menu_item2">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="exchange_menu_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="exchange_menu_item3">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="exchange_menu_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="exchange_menu_item4">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="exchange_menu_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="exchange_menu_item5">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="exchange_menu_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="exchange_menu_item6">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="exchange_menu_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="exchange_menu_item7">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="exchange_menu_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="exchange_menu_item8">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="exchange_menu_cb"/>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="exchange_menu_item9">
- <property name="visible">True</property>
- <property name="use_underline">True</property>
- <signal name="activate" handler="exchange_menu_cb"/>
- </object>
- </child>
- </object>
<object class="GtkMenu" id="memory_recall_popup">
<child>
<object class="GtkMenuItem" id="recall_menu_item0">
@@ -6044,50 +4533,201 @@
<action-widget response="-5">button9</action-widget>
</action-widgets>
</object>
- <object class="GtkDialog" id="precision_dialog">
- <property name="border_width">6</property>
- <property name="title" translatable="yes" comments="Title of set precision dialog">Set Precision</property>
- <property name="resizable">False</property>
- <property name="type_hint">dialog</property>
+ <object class="GtkTextBuffer" id="display_buffer"/>
+ <object class="GtkAccelGroup" id="accelgroup1"/>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="stock">gtk-help</property>
+ <property name="icon-size">1</property>
+ </object>
+ <object class="GtkDialog" id="preferences_dialog">
+ <property name="border_width">8</property>
+ <property name="title" translatable="yes">Preferences</property>
+ <property name="type_hint">normal</property>
<property name="has_separator">False</property>
- <signal name="response" handler="precision_dialog_response_cb"/>
- <signal name="delete_event" handler="precision_dialog_delete_cb"/>
+ <signal name="response" handler="preferences_response_cb"/>
+ <signal name="delete_event" handler="preferences_dialog_delete_cb"/>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox4">
<property name="visible">True</property>
<property name="orientation">vertical</property>
+ <property name="spacing">5</property>
<child>
- <object class="GtkHBox" id="hbox22">
+ <object class="GtkTable" id="table1">
<property name="visible">True</property>
<property name="border_width">5</property>
- <property name="spacing">6</property>
+ <property name="n_rows">4</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">12</property>
<child>
- <object class="GtkLabel" id="label52">
+ <object class="GtkLabel" id="label8">
<property name="visible">True</property>
- <property name="label" translatable="yes" comments="Set Precision Dialog: Label before the significant places spin button">Significant _places:</property>
+ <property name="xalign">0</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">precision_dialog_spin</property>
+ <property name="mnemonic_widget">angle_unit_combobox</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
+ <property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="precision_dialog_spin">
+ <object class="GtkLabel" id="label9">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="adjustment">adjustment1</property>
- <property name="climb_rate">1</property>
- <property name="numeric">True</property>
- <property name="update_policy">if-valid</property>
- <signal name="activate" handler="precision_dialog_activate_cb" after="yes"/>
+ <property name="xalign">0</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>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="angle_unit_combobox">
+ <property name="visible">True</property>
+ <property name="model">angle_unit_model</property>
+ <signal name="changed" handler="angle_unit_combobox_changed_cb"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="display_format_combobox">
+ <property name="visible">True</property>
+ <property name="model">display_format_model</property>
+ <signal name="changed" handler="display_format_combobox_changed_cb"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label11">
+ <property name="visible">True</property>
+ <property name="xalign">0</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>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="word_size_combobox">
+ <property name="visible">True</property>
+ <property name="model">word_size_model</property>
+ <signal name="changed" handler="word_size_combobox_changed_cb"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="bottom_padding">6</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkTable" id="table2">
+ <property name="visible">True</property>
+ <property name="n_rows">3</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkCheckButton" id="trailing_zeroes_check">
+ <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>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="trailing_zeroes_check_toggled_cb"/>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="thousands_separator_check">
+ <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>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="thousands_separator_check_toggled_cb"/>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="decimal_places_label1">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label">Show</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">decimal_places_spin</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="decimal_places_spin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="adjustment">decimal_places_adjustment</property>
+ <signal name="value_changed" handler="decimal_places_spin_change_value_cb"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="decimal_places_label2">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label">decimal _places</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">decimal_places_spin</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
</packing>
</child>
</object>
@@ -6100,12 +4740,11 @@
<property name="visible">True</property>
<property name="layout_style">end</property>
<child>
- <object class="GtkButton" id="button10">
- <property name="label">gtk-cancel</property>
+ <object class="GtkButton" id="button1">
+ <property name="label">gtk-close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
+ <property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
@@ -6114,21 +4753,6 @@
<property name="position">0</property>
</packing>
</child>
- <child>
- <object class="GtkButton" id="button11">
- <property name="label" translatable="yes" comments="Set Precision Dialog: Button to apply settings">_Set</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
</object>
<packing>
<property name="expand">False</property>
@@ -6139,21 +4763,13 @@
</object>
</child>
<action-widgets>
- <action-widget response="-6">button10</action-widget>
- <action-widget response="-5">button11</action-widget>
+ <action-widget response="0">button1</action-widget>
</action-widgets>
</object>
- <object class="GtkAdjustment" id="adjustment1">
- <property name="value">1</property>
- <property name="upper">99</property>
+ <object class="GtkTextBuffer" id="info_buffer"/>
+ <object class="GtkAdjustment" id="decimal_places_adjustment">
+ <property name="upper">9</property>
<property name="step_increment">1</property>
- <property name="page_increment">10</property>
- </object>
- <object class="GtkTextBuffer" id="display_buffer"/>
- <object class="GtkAccelGroup" id="accelgroup1"/>
- <object class="GtkImage" id="image1">
- <property name="visible">True</property>
- <property name="stock">gtk-help</property>
- <property name="icon-size">1</property>
+ <property name="page_increment">1</property>
</object>
</interface>
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 c69c451..d1e25f9 100644
--- a/src/calctool.c
+++ b/src/calctool.c
@@ -1,7 +1,5 @@
-/* $Header$
- *
- * Copyright (c) 1987-2008 Sun Microsystems, Inc. All Rights Reserved.
+/* Copyright (c) 1987-2008 Sun Microsystems, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,10 +17,9 @@
* 02111-1307, USA.
*/
+#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <stdlib.h>
-#include <assert.h>
#include <sys/types.h>
#include <glib-object.h>
@@ -30,14 +27,10 @@
#include "unittest.h"
#include "get.h"
#include "display.h"
-#include "functions.h"
#include "ui.h"
-#include "mp.h"
#include "register.h"
#include "mp-equation.h"
-time_t time();
-
/* Calctool variables and options. */
static CalculatorVariables calc_state;
CalculatorVariables *v;
@@ -58,7 +51,6 @@ solve(const char *equation)
char result_str[MAXLINE];
memset(&options, 0, sizeof(options));
- options.base = 10;
options.wordlen = 32;
options.angle_units = MP_DEGREES;
@@ -68,7 +60,7 @@ solve(const char *equation)
exit(1);
}
else {
- mp_cast_to_string(&result, v->base, 9, 1, result_str, MAXLINE);
+ mp_cast_to_string(&result, 10, 9, 1, result_str, MAXLINE);
printf("%s\n", result_str);
exit(0);
}
@@ -172,41 +164,27 @@ get_options(int argc, char *argv[])
static void
init_state(void)
{
- int acc, i;
+ /* Translators: Digits localized for the given language */
+ const char *digit_values = _("0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F");
+ const char *default_digits[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"};
+ gchar **digits;
+ gboolean use_default_digits = FALSE;
+ int i;
- acc = MAX_DIGITS + 12; /* MP internal accuracy. */
+ digits = g_strsplit(digit_values, ",", -1);
+ for (i = 0; i < 16; i++) {
+ if (use_default_digits || digits[i] == NULL) {
+ use_default_digits = TRUE;
+ v->digits[i] = strdup(default_digits[i]);
+ }
+ else
+ v->digits[i] = strdup(digits[i]);
+ }
+ g_strfreev(digits);
- v->error = FALSE; /* No calculator error initially. */
v->radix = get_radix(); /* Locale specific radix string. */
v->tsep = get_tsep(); /* Locale specific thousands separator. */
v->tsep_count = get_tsep_count();
-
- if (get_int_resource(R_ACCURACY, &i))
- v->accuracy = i;
- else
- v->accuracy = DEFAULT_ACCURACY;
- if (v->accuracy < 0 || v->accuracy > MAXACC) {
- /* Translators: A log message displayed when an invalid accuracy
- is read from the configuration */
- fprintf(stderr, _("%s: accuracy should be in the range 0-%d\n"),
- v->progname, MAXACC);
- v->accuracy = DEFAULT_ACCURACY;
- }
-
- if (get_int_resource(R_BASE, &i))
- v->base = i;
- else
- v->base = 10;
-
- if (get_enumerated_resource(R_TRIG, Rtstr, &i))
- v->ttype = (MPAngleUnit) i;
- else
- v->ttype = MP_DEGREES;
-
- if (get_int_resource(R_WORDLEN, &i))
- v->wordlen = i;
- else
- v->wordlen = 64;
}
diff --git a/src/calctool.h b/src/calctool.h
index c13c744..925e34a 100644
--- a/src/calctool.h
+++ b/src/calctool.h
@@ -35,15 +35,10 @@
#define MAX_DIGITS 200 /* Maximum displayable number of digits. */
#define MAX_LOCALIZED (MAX_DIGITS * (1 + MB_LEN_MAX) + MB_LEN_MAX)
-#define DEFAULT_ACCURACY 9
-
#ifndef MAXLINE
#define MAXLINE 512 /* Length of character strings. */
#endif
-#define MAXACC 99 /* Max. number of digits after numeric point. */
-
-#define MAX_CONSTANTS 10
#define MAX_FUNCTIONS 10
#define MAX_REGISTERS 10 /* Maximum number of memory registers. */
@@ -56,26 +51,18 @@
#undef FALSE
#define FALSE 0
-#define MPMATH_ERR 20001
-
/* Calctool variables and options. */
typedef struct {
char *progname; /* Name of this program. */
GCDisplay display; /* Display stack */
+ const char *digits[16]; /* Localized digit values */
const char *radix; /* Locale specific radix string. */
const char *tsep; /* Locale specific thousands separator. */
int tsep_count; /* Number of digits between separator. */
-
- int base; /* Numeric base e.g. 2, 8, 10, 16 */
- MPAngleUnit ttype; /* Angle unit type */
- int wordlen; /* Length of word for bitwise operations */
- int accuracy; /* Number of digits precision. */
-
- int error; /* true if there is a display error */
} CalculatorVariables;
extern CalculatorVariables *v; /* Calctool variables and options. */
-#endif /*CALCTOOL_H*/
+#endif /* CALCTOOL_H */
diff --git a/src/display.c b/src/display.c
index 71aa18c..1b7c714 100644
--- a/src/display.c
+++ b/src/display.c
@@ -23,48 +23,24 @@
#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 "get.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 const char *display_types[] = { "ENG", "FIX", "SCI", NULL };
-
static GCDisplayState *
get_state(GCDisplay *display)
{
return &(display->h.e[display->h.current]);
}
-static gboolean
-exp_has_postfix(char *str, char *postfix)
-{
- int len, plen;
-
- if (!str) {
- return FALSE;
- }
-
- assert(postfix);
-
- len = strlen(str);
- plen = strlen(postfix);
-
- if (plen > len) {
- return FALSE;
- }
-
- return strcasecmp(str + len - plen, postfix) == 0;
-}
static char *
str_replace(char *str, char *from, char *to)
@@ -100,7 +76,7 @@ str_replace(char *str, char *from, char *to)
/* Add in the thousand separators characters if required */
static void
-localize_expression(char *dest, const char *src, int dest_length, int *cursor)
+localize_expression(GCDisplay *display, char *dest, const char *src, int dest_length, int *cursor)
{
GString *output;
const char *c, *d;
@@ -129,7 +105,7 @@ localize_expression(char *dest, const char *src, int dest_length, int *cursor)
g_string_append_unichar(output, g_utf8_get_char(c));
/* Insert separator after nth digit */
- if (v->display.show_tsep && v->base == 10 &&
+ if (display->show_tsep && display->format == DEC &&
!after_radix && digit_count > 1 && digit_count % v->tsep_count == 1) {
g_string_append(output, v->tsep);
if (new_cursor > read_cursor) {
@@ -166,7 +142,6 @@ localize_expression(char *dest, const char *src, int dest_length, int *cursor)
void
display_clear(GCDisplay *display)
{
- v->error = 0;
display_set_string(display, "", -1);
}
@@ -183,18 +158,14 @@ gboolean display_get_integer(GCDisplay *display, gint64 *value)
const char *text;
char buf[MAX_DISPLAY];
gchar *endptr;
- guint bases[] = {2, 8, 10, 16};
text = display_get_text(display);
- if (text[0] == '\0') {
- text = "0";
- }
- else if (display_is_result(display)) {
- display_make_number(display, buf, MAX_DISPLAY, display_get_answer(display), v->base, FALSE);
+ if (display_is_result(display)) {
+ display_make_number(display, buf, MAX_DISPLAY, display_get_answer(display));
text = buf;
}
-
- *value = g_ascii_strtoll(text, &endptr, bases[v->base]);
+
+ *value = g_ascii_strtoll(text, &endptr, 10);
if(*endptr != '\0' || ((*value == G_MAXINT64 || *value == G_MININT64) && errno == ERANGE))
return FALSE;
return TRUE;
@@ -208,11 +179,8 @@ gboolean display_get_unsigned_integer(GCDisplay *display, guint64 *value)
gchar *endptr;
text = display_get_text(display);
- if (text[0] == '\0') {
- text = "0";
- }
- else if (display_is_result(display)) {
- display_make_number(display, buf, MAX_DISPLAY, display_get_answer(display), v->base, FALSE);
+ if (display_is_result(display)) {
+ display_make_number(display, buf, MAX_DISPLAY, display_get_answer(display));
text = buf;
}
@@ -220,7 +188,7 @@ gboolean display_get_unsigned_integer(GCDisplay *display, guint64 *value)
if(strncmp(text, "-", strlen("-")) == 0 || strncmp(text, "â??", strlen("â??")) == 0)
return FALSE;
- *value = g_ascii_strtoull(text, &endptr, v->base);
+ *value = g_ascii_strtoull(text, &endptr, 10);
if(*endptr != '\0' || (*value == G_MAXUINT64 && errno == ERANGE))
return FALSE;
return TRUE;
@@ -240,11 +208,12 @@ display_get_cursor(GCDisplay *display)
}
+// FIXME: Looses accuracy
void
-display_set_number(GCDisplay *display, const MPNumber *MPval)
+display_set_number(GCDisplay *display, const MPNumber *x)
{
char text[MAX_DISPLAY];
- display_make_number(display, text, MAX_DISPLAY, MPval, v->base, FALSE);
+ display_make_number(display, text, MAX_DISPLAY, x);
display_set_string(display, text, -1);
}
@@ -259,33 +228,21 @@ display_set_answer(GCDisplay *display)
static void
display_make_text(GCDisplay *display, char *localized, int length, int *cursor)
{
- int i;
- MPNumber MP_reg;
- char temp[MAX_LOCALIZED], *str, reg[3];
+ char *str;
GCDisplayState *e;
e = get_state(display);
- if (display_is_empty(display)) {
- mp_set_from_integer(0, &MP_reg);
- display_make_number(display, temp, MAX_LOCALIZED, &MP_reg, v->base, FALSE);
- str = strdup(temp);
- } else {
- str = strdup(e->expression);
- }
/* Substitute answer register */
- display_make_number(display, temp, MAX_LOCALIZED, &e->ans, v->base, TRUE);
- str = str_replace(str, "ans", temp);
-
- /* Replace registers with values. */
- for (i = 0; i < 10; i++) {
- SNPRINTF(reg, 3, "R%d", i);
- register_get(i, &MP_reg);
- display_make_number(display, temp, MAX_LOCALIZED, &MP_reg, v->base, FALSE);
- str = str_replace(str, reg, temp);
+ if (display_is_result(display)) {
+ char temp[MAX_LOCALIZED];
+ display_make_number(display, temp, MAX_LOCALIZED, &e->ans);
+ str = strdup(temp);
}
+ else
+ str = strdup(e->expression);
- localize_expression(localized, str, length, cursor);
+ localize_expression(display, localized, str, length, cursor);
free(str);
}
@@ -333,7 +290,7 @@ display_set_cursor(GCDisplay *display, int cursor)
void
display_set_error(GCDisplay *display, const char *message)
{
- ui_set_statusbar(message, "gtk-dialog-error");
+ ui_set_statusbar(message);
}
@@ -411,9 +368,9 @@ void display_pop(GCDisplay *display)
{
if (display->h.current != display->h.begin) {
display->h.current = ((display->h.current - 1) % UNDO_HISTORY_LENGTH);
- ui_set_statusbar("", "");
+ ui_set_statusbar("");
} else {
- ui_set_statusbar(_("No undo history"), "gtk-dialog-warning");
+ ui_set_statusbar(_("No undo history"));
}
update_undo_redo_button_sensitivity(display);
@@ -426,9 +383,9 @@ display_unpop(GCDisplay *display)
{
if (display->h.current != display->h.end) {
display->h.current = ((display->h.current + 1) % UNDO_HISTORY_LENGTH);
- ui_set_statusbar("", "");
+ ui_set_statusbar("");
} else {
- ui_set_statusbar(_("No redo steps"), "gtk-dialog-warning");
+ ui_set_statusbar(_("No redo steps"));
}
update_undo_redo_button_sensitivity(display);
get_state(display)->cursor = -1;
@@ -473,7 +430,7 @@ display_insert(GCDisplay *display, int cursor_start, int cursor_end, const char
use = FALSE;
/* Ignore thousands separators */
- if (v->tsep[0] != '\0' && strncmp(c, v->tsep, strlen(v->tsep)) == 0)
+ if (strncmp(c, v->tsep, strlen(v->tsep)) == 0)
use = FALSE;
/* Copy existing text */
@@ -500,7 +457,7 @@ void
display_insert_number(GCDisplay *display, int cursor_start, int cursor_end, const MPNumber *value)
{
char text[MAX_DISPLAY];
- display_make_number(display, text, MAX_DISPLAY, value, v->base, FALSE);
+ display_make_number(display, text, MAX_DISPLAY, value);
display_insert(display, cursor_start, cursor_end, text);
}
@@ -508,10 +465,9 @@ display_insert_number(GCDisplay *display, int cursor_start, int cursor_end, cons
void
display_backspace(GCDisplay *display, int cursor_start, int cursor_end)
{
- char buf[MAX_DISPLAY] = "", buf2[MAX_DISPLAY];
+ char buf[MAX_DISPLAY] = "";
GCDisplayState *e = get_state(display);
- int i, cursor;
- MPNumber MP_reg;
+ int cursor;
/* Can't delete empty display */
if (display_is_empty(display))
@@ -525,21 +481,11 @@ display_backspace(GCDisplay *display, int cursor_start, int cursor_end)
len = g_utf8_strlen(ui_get_display(), -1);
- if (exp_has_postfix(e->expression, "ans")) {
- display_make_number(display, buf, MAX_DISPLAY, &e->ans, v->base, FALSE);
+ if (display_is_result(display)) {
+ display_make_number(display, buf, MAX_DISPLAY, &e->ans);
e->expression = str_replace(e->expression, "ans", buf);
- } else {
- for (i = 0; i < 10; i++) {
- SNPRINTF(buf, MAX_DISPLAY, "R%d", i);
- if (exp_has_postfix(e->expression, buf)) {
- register_get(i, &MP_reg);
- display_make_number(display, buf2, MAX_DISPLAY, &MP_reg, v->base, FALSE);
- SNPRINTF(buf, MAX_DISPLAY, "%.*s%s", strlen(e->expression) - 2, e->expression - 2, buf2);
- break;
- }
- }
}
-
+
display_insert(display, len - 1, len, "");
} else if (cursor_start != cursor_end) {
display_insert(display, cursor_start, cursor_end, "");
@@ -597,7 +543,7 @@ display_is_usable_number(GCDisplay *display, MPNumber *z)
mp_set_from_mp(display_get_answer(display), z);
return TRUE;
} else {
- return mp_set_from_string(display_get_text(display), v->base, z) == 0;
+ return mp_set_from_string(display_get_text(display), z) == 0;
}
}
@@ -609,22 +555,12 @@ display_init(GCDisplay *display)
memset(display, 0, sizeof(GCDisplay));
- display->base = 10;
-
- if (get_boolean_resource(R_ZEROES, &i))
- display->show_zeroes = i;
- else
- display->show_zeroes = FALSE;
-
- if (get_boolean_resource(R_TSEP, &i))
- display->show_tsep = i;
- else
- display->show_tsep = FALSE;
-
- if (get_enumerated_resource(R_DISPLAY, display_types, &i))
- display->format = (DisplayFormat) i;
- else
- display->format = FIX;
+ display->show_zeroes = FALSE;
+ 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("");
@@ -633,7 +569,7 @@ display_init(GCDisplay *display)
void display_set_accuracy(GCDisplay *display, int accuracy)
{
- set_int_resource(R_ACCURACY, accuracy);
+ display->accuracy = accuracy;
get_state(display)->cursor = -1;
display_refresh(display);
}
@@ -642,7 +578,6 @@ void display_set_accuracy(GCDisplay *display, int accuracy)
void display_set_show_thousands_separator(GCDisplay *display, gboolean visible)
{
display->show_tsep = visible;
- set_boolean_resource(R_TSEP, visible);
display_set_cursor(display, -1);
display_refresh(display);
}
@@ -651,170 +586,425 @@ void display_set_show_thousands_separator(GCDisplay *display, gboolean visible)
void display_set_show_trailing_zeroes(GCDisplay *display, gboolean visible)
{
display->show_zeroes = visible;
- set_boolean_resource(R_ZEROES, visible);
get_state(display)->cursor = -1;
display_refresh(display);
}
-void display_set_base(GCDisplay *display, int base)
+void display_set_format(GCDisplay *display, DisplayFormat format)
{
- display->base = base;
+ display->format = format;
get_state(display)->cursor = -1;
display_refresh(display);
}
-
-void display_set_format(GCDisplay *display, DisplayFormat type)
+void display_set_word_size(GCDisplay *display, int word_size)
{
- v->display.format = type;
- set_enumerated_resource(R_DISPLAY, display_types, (int) type);
- get_state(display)->cursor = -1;
- display_refresh(display);
+ 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
-make_eng_sci(GCDisplay *display, char *target, int target_len, const MPNumber *MPnumber, int base)
+make_eng_sci(GCDisplay *display, char *target, int target_len, const MPNumber *x, int base_)
{
static char digits[] = "0123456789ABCDEF";
- char fixed[MAX_DIGITS], *optr;
- MPNumber MP1, MPatmp, MPval;
- MPNumber MP1base, MP3base, MP10base;
- int i, dval, len;
- MPNumber MPmant; /* Mantissa. */
- int ddig; /* Number of digits in exponent. */
- int eng = 0; /* Set if this is an engineering number. */
- int exp = 0; /* Exponent */
+ char fixed[MAX_DIGITS];
+ MPNumber t, z, base, base3, base10, base10inv, mantissa;
+ int ddig, eng, exponent = 0;
+ GString *string;
- if (display->format == ENG) {
- eng = 1;
- }
- optr = target;
- mp_abs(MPnumber, &MPval);
- mp_set_from_integer(0, &MP1);
- if (mp_is_less_than(MPnumber, &MP1)) {
- strcpy(optr, "â??");
- optr += strlen("â??");
- }
- mp_set_from_mp(&MPval, &MPmant);
-
- mp_set_from_integer(base, &MP1base);
- mp_xpowy_integer(&MP1base, 3, &MP3base);
- mp_xpowy_integer(&MP1base, 10, &MP10base);
+ string = g_string_sized_new(target_len);
- mp_set_from_integer(1, &MP1);
- mp_divide(&MP1, &MP10base, &MPatmp);
-
- mp_set_from_integer(0, &MP1);
- if (!mp_is_equal(&MPmant, &MP1)) {
- while (!eng && mp_is_greater_equal(&MPmant, &MP10base)) {
- exp += 10;
- mp_multiply(&MPmant, &MPatmp, &MPmant);
+ eng = display->format == ENG;
+
+ mp_abs(x, &z);
+ if (mp_is_negative(x))
+ g_string_append(string, "â??");
+ mp_set_from_mp(&z, &mantissa);
+
+ mp_set_from_integer(base_, &base);
+ mp_xpowy_integer(&base, 3, &base3);
+ mp_xpowy_integer(&base, 10, &base10);
+ mp_set_from_integer(1, &t);
+ mp_divide(&t, &base10, &base10inv);
+
+ if (!mp_is_zero(&mantissa)) {
+ while (!eng && mp_is_greater_equal(&mantissa, &base10)) {
+ exponent += 10;
+ mp_multiply(&mantissa, &base10inv, &mantissa);
}
- while ((!eng && mp_is_greater_equal(&MPmant, &MP1base)) ||
- (eng && (mp_is_greater_equal(&MPmant, &MP3base) || exp % 3 != 0))) {
- exp += 1;
- mp_divide(&MPmant, &MP1base, &MPmant);
+ while ((!eng && mp_is_greater_equal(&mantissa, &base)) ||
+ (eng && (mp_is_greater_equal(&mantissa, &base3) || exponent % 3 != 0))) {
+ exponent += 1;
+ mp_divide(&mantissa, &base, &mantissa);
}
- while (!eng && mp_is_less_than(&MPmant, &MPatmp)) {
- exp -= 10;
- mp_multiply(&MPmant, &MP10base, &MPmant);
+ while (!eng && mp_is_less_than(&mantissa, &base10inv)) {
+ exponent -= 10;
+ mp_multiply(&mantissa, &base10, &mantissa);
}
- mp_set_from_integer(1, &MP1);
- while (mp_is_less_than(&MPmant, &MP1) || (eng && exp % 3 != 0)) {
- exp -= 1;
- mp_multiply(&MPmant, &MP1base, &MPmant);
+ mp_set_from_integer(1, &t);
+ while (mp_is_less_than(&mantissa, &t) || (eng && exponent % 3 != 0)) {
+ exponent -= 1;
+ mp_multiply(&mantissa, &base, &mantissa);
}
}
- mp_cast_to_string(&MPmant, base, v->accuracy, !v->display.show_zeroes, fixed, MAX_DIGITS);
- len = strlen(fixed);
- for (i = 0; i < len; i++) {
- *optr++ = fixed[i];
- }
-
- *optr++ = 'e';
+ mp_cast_to_string(&mantissa, base_, display->accuracy, !display->show_zeroes, fixed, MAX_DIGITS);
+ g_string_append(string, fixed);
+ g_string_append(string, "Ã?10^");
- if (exp < 0) {
- exp = -exp;
- strcpy(optr, "â??");
- optr += strlen("â??");
+ if (exponent < 0) {
+ exponent = -exponent;
+ g_string_append(string, "â??");
} else {
- *optr++ = '+';
+ g_string_append(string, "+");
}
- mp_set_from_string("0.5", 10, &MP1);
- mp_add_integer(&MP1, exp, &MPval);
- mp_set_from_integer(1, &MP1);
- for (ddig = 0; mp_is_greater_equal(&MPval, &MP1); ddig++) {
- mp_divide(&MPval, &MP1base, &MPval);
- }
-
- if (ddig == 0) {
- *optr++ = '0';
+ mp_set_from_string("0.5", &t);
+ mp_add_integer(&t, exponent, &z);
+ mp_set_from_integer(1, &t);
+ for (ddig = 0; mp_is_greater_equal(&z, &t); ddig++) {
+ mp_divide(&z, &base, &z);
}
while (ddig-- > 0) {
- mp_multiply(&MPval, &MP1base, &MPval);
- dval = mp_cast_to_int(&MPval);
- *optr++ = digits[dval];
- dval = -dval;
- mp_add_integer(&MPval, dval, &MPval);
+ int dval;
+
+ mp_multiply(&z, &base, &z);
+ dval = mp_cast_to_int(&z);
+ g_string_append_c(string, digits[dval]);
+ mp_add_integer(&z, -dval, &z);
}
- *optr++ = '\0';
+
+ strncpy(target, string->str, target_len);
+ g_string_free(string, TRUE);
}
-/* Convert MP number to character string in the given base. */
+/* Convert MP number to character string. */
void
-display_make_number(GCDisplay *display, char *target, int target_len, const MPNumber *x, int base, int ignoreError)
+display_make_number(GCDisplay *display, char *target, int target_len, const MPNumber *x)
{
- double val, max_fix;
-
- /* NOTE: display_make_number can currently set v->error when converting to a double.
- * This is to provide the same look&feel as V3 even though gcalctool
- * now does internal arithmetic to "infinite" precision.
- *
- * XXX: Needs to be improved. Shouldn't need to convert to a double in
- * order to do these tests.
- */
-
- double number = mp_cast_to_double(x);
-
- val = fabs(number);
- if (v->error && !ignoreError) {
- target[0] = '\0';
- return;
- }
-
- switch (base)
- {
- case 2:
- max_fix = 1.298074214e+33;
+ switch(display->format) {
+ case DEC:
+ mp_cast_to_string(x, 10, display->accuracy, !display->show_zeroes, target, target_len);
+ break;
+ case BIN:
+ mp_cast_to_string(x, 2, display->accuracy, !display->show_zeroes, target, target_len);
+ break;
+ case OCT:
+ mp_cast_to_string(x, 8, display->accuracy, !display->show_zeroes, target, target_len);
break;
- case 8:
- max_fix = 2.037035976e+90;
+ case HEX:
+ mp_cast_to_string(x, 16, display->accuracy, !display->show_zeroes, target, target_len);
break;
- case 10:
- max_fix = 1.000000000e+100;
+ case SCI:
+ make_eng_sci(display, target, target_len, x, 10);
break;
- default:
- case 16:
- max_fix = 2.582249878e+120;
+ case ENG:
+ make_eng_sci(display, target, target_len, x, 10);
break;
}
+}
+
+static int
+get_variable(const char *name, MPNumber *z, void *data)
+{
+ char *c, *lower_name;
+ int result = 1;
+ GCDisplay *display = data;
- // FIXME: Do this based on the number of digits, not actual values
- if ((display->format == ENG) ||
- (display->format == SCI) ||
- (display->format == FIX && val != 0.0 && (val > max_fix))) {
- make_eng_sci(display, target, target_len, x, base);
- } else {
- mp_cast_to_string(x, base, v->accuracy, !v->display.show_zeroes, target, target_len);
+ 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_OVERFLOW:
+ /* Translators: Error displayed 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 displayed to user when they an unknown variable is entered */
+ message = _("Unknown variable");
+ break;
+
+ case -PARSER_ERR_UNKNOWN_FUNCTION:
+ /* Translators: Error displayed to user when an unknown function is entered */
+ message = _("Function '%s' is not defined");
+ 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 810bc05..57a95a6 100644
--- a/src/display.h
+++ b/src/display.h
@@ -45,23 +45,44 @@ typedef struct {
} GCDisplayHistory;
/* Number display mode. */
-typedef enum { ENG, FIX, SCI, MAXDISPMODES } DisplayFormat;
+typedef enum { DEC, BIN, OCT, HEX, SCI, ENG } DisplayFormat;
typedef struct
{
- GCDisplayHistory h; /* History of expression mode states */
- int show_tsep; /* Set if the thousands separator should be shown. */
- int show_zeroes; /* Set if trailing zeroes should be shown. */
+ GCDisplayHistory h; /* History of expression mode states */
+ int show_tsep; /* Set if the thousands separator should be shown. */
+ int show_zeroes; /* Set if trailing zeroes should be shown. */
DisplayFormat format; /* Number display mode. */
- int base;
+ 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);
@@ -93,6 +114,8 @@ gboolean display_is_usable_number(GCDisplay *display, MPNumber *);
const char *display_get_text(GCDisplay *display);
-void display_make_number(GCDisplay *display, char *target, int target_len, const MPNumber *MPnumber, int base, int ignoreError);
+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/financial.h b/src/financial.h
index cf42055..0c95cc1 100644
--- a/src/financial.h
+++ b/src/financial.h
@@ -35,8 +35,7 @@ enum finc_dialogs {
FINC_RATE_DIALOG,
FINC_SLN_DIALOG,
FINC_SYD_DIALOG,
- FINC_TERM_DIALOG,
- FINC_NUM_DIALOGS,
+ FINC_TERM_DIALOG
};
#endif /* FINANCIAL_H */
diff --git a/src/get.c b/src/get.c
index fa27d8b..9bafa8c 100644
--- a/src/get.c
+++ b/src/get.c
@@ -40,8 +40,6 @@
/* Various string values read/written as X resources. */
-const char *Rtstr[] = { "DEG", "GRAD", "RAD", NULL };
-
static GConfClient *client = NULL;
@@ -58,7 +56,7 @@ void
set_resource(const char *key, const char *value)
{
char key_name[MAXLINE];
- SNPRINTF(key_name, MAXLINE, "/apps/gcalctool/%s", key);
+ SNPRINTF(key_name, MAXLINE, "/apps/gcalctool/%s", key);
gconf_client_set_string(client, key_name, value, NULL);
}
diff --git a/src/get.h b/src/get.h
index 34dd65f..abe4ffa 100644
--- a/src/get.h
+++ b/src/get.h
@@ -25,18 +25,12 @@
#include "calctool.h"
#define R_ACCURACY "accuracy"
-#define R_BASE "base"
-#define R_DISPLAY "display"
-#define R_MODE "mode"
-#define R_REGS "showregisters"
-#define R_TRIG "trigtype"
+#define R_DISPLAY "result_format"
+#define R_MODE "button_layout"
+#define R_TRIG "angle_units"
#define R_ZEROES "showzeroes"
#define R_TSEP "showthousands"
#define R_WORDLEN "wordlen"
-#define R_XPOS "xposition"
-#define R_YPOS "yposition"
-
-extern const char *Rtstr[];
void resources_init();
diff --git a/src/gtk.c b/src/gtk.c
index ce90439..7bfe074 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
@@ -27,7 +27,6 @@
#include <assert.h>
#include <gtk/gtk.h>
-#include <gdk/gdkx.h>
#include <gdk/gdkkeysyms.h>
#include <limits.h>
@@ -38,7 +37,6 @@
#include "ui.h"
#include "config.h"
-#include "functions.h"
#include "financial.h"
#include "mp-equation.h"
#include "display.h"
@@ -48,12 +46,52 @@
static const char *mode_names[] = { "BASIC", "ADVANCED", "FINANCIAL",
"SCIENTIFIC", "PROGRAMMING", NULL };
-#define MAX_ACCELERATORS 8
-struct button_widget {
- int function;
- char *widget_name;
- guint accelerator_mods[MAX_ACCELERATORS];
- guint accelerator_keys[MAX_ACCELERATORS];
+typedef struct {
+ const char *widget_name;
+ const char *data;
+} ButtonData;
+
+static ButtonData button_data[] = {
+ {"pi", "Ï?"},
+ {"eulers_number", "e"},
+ {"random", "rand"},
+ {"ans", "ans"},
+ {"numeric_point", "."},
+ {"add", "+"},
+ {"subtract", "â??"},
+ {"multiply", "Ã?"},
+ {"divide", "÷"},
+ {"modulus_divide", "mod"},
+ {"x_pow_y", "^"},
+ {"exponential", "Ã?10^"},
+ {"percentage", "%"},
+ {"factorial", "!"},
+ {"abs", "|"},
+ {"root", "â??"},
+ {"logarithm", "log"},
+ {"natural_logarithm", "ln"},
+ {"sine", "sin"},
+ {"cosine", "cos"},
+ {"tangent", "tan"},
+ {"hyperbolic_sine", "sinh"},
+ {"hyperbolic_cosine", "cosh"},
+ {"hyperbolic_tangent", "tanh"},
+ {"inverse", "�¹"},
+ {"base_2", "â??"},
+ {"base_8", "â??"},
+ {"base_16", "â??â??"},
+ {"and", "and"},
+ {"or", "or"},
+ {"xor", "xor"},
+ {"not", "not"},
+ {"integer_portion", "int"},
+ {"fractional_portion", "frac"},
+ {"ones_complement", "ones"},
+ {"twos_complement", "twos"},
+ {"trunc", "trunc"},
+ {"start_group", "("},
+ {"end_group", ")"},
+ {NULL, NULL}
};
/* Window titles dependant on mode */
@@ -70,22 +108,8 @@ static char *titles[] = {
N_("Calculator - Programming")
};
-/* Window titles dependant on mode and hostname */
-static char *hostname_titles[] = {
- /* Translators: The window title when in basic mode. %s is replaced with the hostname. */
- N_("Calculator [%s]"),
- /* Translators: The window title when in advanced mode. %s is replaced with the hostname. */
- N_("Calculator [%s] - Advanced"),
- /* Translators: The window title when in financial mode. %s is replaced with the hostname. */
- N_("Calculator [%s] - Financial"),
- /* Translators: The window title when in scientific mode. %s is replaced with the hostname. */
- N_("Calculator [%s] - Scientific"),
- /* Translators: The window title when in programming mode. %s is replaced with the hostname. */
- N_("Calculator [%s] - Programming")
-};
-
/* The names of each field in the dialogs for the financial functions */
-static char *finc_dialog_fields[FINC_NUM_DIALOGS][5] = {
+static char *finc_dialog_fields[][5] = {
{"ctrm_pint", "ctrm_fv", "ctrm_pv", NULL, NULL},
{"ddb_cost", "ddb_life", "ddb_period", NULL, NULL},
{"fv_pmt", "fv_pint", "fv_n", NULL, NULL},
@@ -96,355 +120,9 @@ static char *finc_dialog_fields[FINC_NUM_DIALOGS][5] = {
{"sln_cost", "sln_salvage", "sln_life", NULL, NULL},
{"syd_cost", "syd_salvage", "syd_life", "syd_period", NULL},
{"term_pmt", "term_fv", "term_pint", NULL, NULL},
+ {NULL, NULL, NULL, NULL, NULL}
};
-/* This table shows the keyboard values that are currently being used:
- *
- * | a b c d e f g h i j k l m n o p q r s t u v w x y z
- *-----------+-----------------------------------------------------
- * Lower: | a b c d e f g h i j k l m n o p q r s t u v w x z
- * Upper: | A C D E F G H I J K M N O P Q R S T W X Y Z
- * Numeric: | 0 1 2 3 4 5 6 7 8 9
- * Other: | @ . + - * / = % ( ) # < > [ { | & ~ ^ ? ! :
- * | BackSpace Delete Return
- *-----------+-----------------------------------------------------
- */
-
-static struct button_widget button_widgets[] = {
- {FN_0, "0",
- { 0, 0, 0, 0 },
- { GDK_0, GDK_KP_0, GDK_KP_Insert, 0 }},
-
- {FN_1, "1",
- { 0, 0, 0, 0, 0 },
- { GDK_1, GDK_KP_1, GDK_KP_End, GDK_R13, 0 }},
-
- {FN_2, "2",
- { 0, 0, 0, 0 },
- { GDK_2, GDK_KP_2, GDK_KP_Down, 0 }},
-
- {FN_3, "3",
- { 0, 0, 0, 0, 0 },
- { GDK_3, GDK_KP_3, GDK_KP_Page_Down, GDK_R15, 0 }},
-
- {FN_4, "4",
- { 0, 0, 0, 0 },
- { GDK_4, GDK_KP_4, GDK_KP_Left, 0 }},
-
- {FN_5, "5",
- { 0, 0, 0, 0, 0 },
- { GDK_5, GDK_KP_5, GDK_KP_Begin, GDK_R11, 0 }},
-
- {FN_6, "6",
- { 0, 0, 0, 0 },
- { GDK_6, GDK_KP_6, GDK_KP_Right, 0 }},
-
- {FN_7, "7",
- { 0, 0, 0, 0, 0 },
- { GDK_7, GDK_KP_7, GDK_KP_Home, GDK_R7, 0 }},
-
- {FN_8, "8",
- { 0, 0, 0, 0 },
- { GDK_8, GDK_KP_8, GDK_KP_Up, 0 }},
-
- {FN_9, "9",
- { 0, 0, 0, 0, 0 },
- { GDK_9, GDK_KP_9, GDK_KP_Page_Up, GDK_R9, 0 }},
-
- {FN_A, "a",
- { 0, 0 },
- { GDK_a, 0 }},
-
- {FN_B, "b",
- { 0, 0 },
- { GDK_b, 0 }},
-
- {FN_C, "c",
- { 0, 0 },
- { GDK_c, 0 }},
-
- {FN_D, "d",
- { 0, 0 },
- { GDK_d, 0 }},
-
- {FN_E, "e",
- { 0, 0 },
- { GDK_e, 0 }},
-
- {FN_F, "f",
- { 0, 0 },
- { GDK_f, 0 }},
-
- {FN_CLEAR, "clear_simple",
- { GDK_SHIFT_MASK, 0 },
- { GDK_Delete, 0 }},
-
- {FN_CLEAR, "clear_advanced",
- { GDK_SHIFT_MASK, 0 },
- { GDK_Delete, 0 }},
-
- {FN_SHIFT, "shift_left",
- { 0, 0 },
- { GDK_less, 0 }},
-
- {FN_SHIFT, "shift_right",
- { 0, 0 },
- { GDK_greater, 0 }},
-
- {FN_SET_ACCURACY, "accuracy",
- { 0, 0 },
- { GDK_A, 0 }},
-
- {FN_CONSTANT, "constants",
- { 0, 0 },
- { GDK_numbersign, 0 }},
-
- {FN_FUNCTION, "functions",
- { 0, 0 },
- { GDK_F, 0 }},
-
- {FN_STORE, "store",
- { 0, 0 },
- { GDK_S, 0 }},
-
- {FN_RECALL, "recall",
- { 0, 0 },
- { GDK_R, 0 }},
-
- {FN_EXCHANGE, "exchange",
- { 0, 0 },
- { GDK_X, 0 }},
-
- {FN_CLEAR_ENTRY, "clear_entry_simple",
- { GDK_CONTROL_MASK, 0, 0 },
- { GDK_BackSpace, GDK_Escape, 0 }},
-
- {FN_CLEAR_ENTRY, "clear_entry_advanced",
- { GDK_CONTROL_MASK, 0, 0 },
- { GDK_BackSpace, GDK_Escape, 0 }},
-
- {FN_BACKSPACE, "backspace_simple",
- { 0, 0 },
- { GDK_BackSpace, 0 }},
-
- {FN_BACKSPACE, "backspace_advanced",
- { 0, 0 },
- { GDK_BackSpace, 0 }},
-
- {FN_NUMERIC_POINT, "numeric_point",
- { 0, 0, 0, 0, 0 },
- { GDK_period, GDK_KP_Decimal, GDK_KP_Delete, GDK_KP_Separator, 0 }},
-
- {FN_CALCULATE, "result",
- { 0, 0, 0, 0 },
- { GDK_equal, GDK_KP_Enter, GDK_Return, 0 }},
-
- {FN_START_BLOCK, "start_group",
- { 0, 0 },
- { GDK_parenleft, 0 }},
-
- {FN_END_BLOCK, "end_group",
- { 0, 0 },
- { GDK_parenright, 0 }},
-
- {FN_ADD, "add",
- { 0, 0, 0 },
- { GDK_plus, GDK_KP_Add, 0 }},
-
- {FN_SUBTRACT, "subtract",
- { 0, 0, 0, 0 },
- { GDK_minus, GDK_KP_Subtract, GDK_R4, 0 }},
-
- {FN_MULTIPLY, "multiply",
- { 0, 0, 0, 0, 0 },
- { GDK_asterisk, GDK_multiply, GDK_KP_Multiply, GDK_R6, 0 }},
-
- {FN_DIVIDE, "divide",
- { 0, 0, 0, 0, 0 },
- { GDK_slash, GDK_division, GDK_KP_Divide, GDK_R5, 0 }},
-
- {FN_CHANGE_SIGN, "change_sign_simple",
- { 0, 0 },
- { GDK_C, 0 }},
-
- {FN_CHANGE_SIGN, "change_sign_advanced",
- { 0, 0 },
- { GDK_C, 0 }},
-
- {FN_INTEGER, "integer_portion",
- { 0, 0 },
- { GDK_i, 0 }},
-
- {FN_FRACTION, "fractional_portion",
- { 0, 0 },
- { GDK_colon, 0 }},
-
- {FN_PERCENTAGE, "percentage",
- { 0, 0 },
- { GDK_percent, 0 }},
-
- {FN_SQUARE, "square",
- { 0, 0 },
- { GDK_at, 0 }},
-
- {FN_SQUARE_ROOT, "sqrt",
- { 0, 0 },
- { GDK_s, 0 }},
-
- {FN_RECIPROCAL, "reciprocal",
- { 0, 0 },
- { GDK_r, 0 }},
-
- {FN_ABSOLUTE_VALUE_FUNC, "abs",
- { 0, 0 },
- { GDK_u, 0 }},
-
- {FN_TRUNC, "trunc",
- { 0, 0 },
- { GDK_bracketleft, 0 }},
-
- {FN_MODULUS_DIVIDE, "modulus_divide",
- { 0, 0 },
- { GDK_M, 0 }},
-
- {FN_1S_COMPLEMENT, "1s",
- { 0, 0 },
- { GDK_z, 0 }},
-
- {FN_2S_COMPLEMENT, "2s",
- { 0, 0 },
- { GDK_Z, 0 }},
-
- {FN_EXPONENTIAL, "exponential",
- { 0, 0 },
- { GDK_E, 0 }},
-
- {FN_FACTORIAL, "factorial",
- { 0, 0 },
- { GDK_exclam, 0 }},
-
- {FN_RANDOM, "random",
- { 0, 0 },
- { GDK_question, 0 }},
-
- {FN_NOT, "not",
- { 0, 0 },
- { GDK_asciitilde, 0 }},
-
- {FN_OR, "or",
- { 0, 0 },
- { GDK_bar, 0 }},
-
- {FN_AND, "and",
- { 0, 0 },
- { GDK_ampersand, 0 }},
-
- {FN_XOR, "xor",
- { 0, 0 },
- { GDK_x, 0 }},
-
- {FN_XNOR, "xnor",
- { 0, 0 },
- { GDK_braceleft, 0 }},
-
- {FN_SIN, "sine",
- { 0, 0 },
- { GDK_k, 0 }},
-
- {FN_ASIN, "sine",
- { 0, 0 },
- { GDK_K, 0 }},
-
- {FN_COS, "cosine",
- { 0, 0 },
- { GDK_j, 0 }},
-
- {FN_ACOS, "cosine",
- { 0, 0 },
- { GDK_J, 0 }},
-
- {FN_TAN, "tangent",
- { 0, 0 },
- { GDK_w, 0 }},
-
- {FN_ATAN, "tangent",
- { 0, 0 },
- { GDK_W, 0 }},
-
- {FN_NATURAL_LOGARITHM, "natural_logarithm",
- { 0, 0 },
- { GDK_n, 0 }},
-
- {FN_E_POW_X, "natural_logarithm",
- { 0, 0 },
- { GDK_N, 0 }},
-
- {FN_LOGARITHM, "logarithm",
- { 0, 0 },
- { GDK_g, 0 }},
-
- {FN_10_POW_X, "logarithm",
- { 0, 0 },
- { GDK_G, 0 }},
-
- {FN_LOGARITHM2, "logarithm2",
- { 0, 0 },
- { GDK_h, 0 }},
-
- {FN_2_POW_X, "logarithm2",
- { 0, 0 },
- { GDK_H, 0 }},
-
- {FN_X_POW_Y, "x_pow_y",
- { 0, 0, 0, 0, 0 },
- { GDK_o, GDK_caret, GDK_asciicircum, GDK_dead_circumflex, 0 }},
-
- {FN_X_POW_Y_INV, "x_pow_y",
- { 0, 0 },
- { GDK_O, 0 }},
-
- {FN_FINC_CTRM, "finc_compounding_term",
- { 0, 0 },
- { GDK_m, 0 }},
-
- {FN_FINC_DDB, "finc_double_declining_depreciation",
- { 0, 0 },
- { GDK_D, 0 }},
-
- {FN_FINC_FV, "finc_future_value",
- { 0, 0 },
- { GDK_v, 0 }},
-
- {FN_FINC_GPM, "finc_gross_profit_margin",
- { 0, 0 },
- { GDK_I, 0 }},
-
- {FN_FINC_PMT, "finc_periodic_payment",
- { 0, 0 },
- { GDK_P, 0 }},
-
- {FN_FINC_PV, "finc_present_value",
- { 0, 0 },
- { GDK_p, 0 }},
-
- {FN_FINC_RATE, "finc_periodic_interest_rate",
- { 0, 0 },
- { GDK_T, 0 }},
-
- {FN_FINC_SLN, "finc_straight_line_depreciation",
- { 0, 0 },
- { GDK_l, 0 }},
-
- {FN_FINC_SYD, "finc_sum_of_the_years_digits_depreciation",
- { 0, 0 },
- { GDK_Y, 0 }},
-
- {FN_FINC_TERM, "finc_term",
- { 0, 0 },
- { GDK_t, 0 }}
-};
-#define NBUTTONS (sizeof(button_widgets) / sizeof(struct button_widget))
-
#define UI_FILE PACKAGE_UI_DIR "/gcalctool.ui"
#define UI_FINC_FILE PACKAGE_UI_DIR "/financial.ui"
@@ -457,6 +135,15 @@ static struct button_widget button_widgets[] = {
#define GET_FINC_WIDGET(name) \
GTK_WIDGET(gtk_builder_get_object(X.financial, (name)))
+/* Calculator modes. */
+typedef enum {
+ BASIC,
+ ADVANCED,
+ FINANCIAL,
+ SCIENTIFIC,
+ PROGRAMMING
+} ModeType;
+
/* Gtk+/Xlib graphics object. */
typedef struct {
ModeType mode; /* Current calculator mode. */
@@ -466,72 +153,40 @@ typedef struct {
GtkWidget *main_window;
- GtkTreeModel *constants_model;
- GtkWidget *constants_dialog;
-
- GtkTreeModel *functions_model;
- GtkWidget *function_dialog;
-
GtkWidget *menubar; // FIXME: Why is this needed?
GtkWidget *bit_panel;
GtkWidget *bit_labels[MAXBITS];
- GtkWidget *status_image; /* Statusbar image */
- GtkWidget *statusbar;
-
GtkWidget *ascii_dialog;
GtkWidget *ascii_entry;
GtkWidget *display_item; /* Calculator display. */
GtkTextBuffer *display_buffer; /* Buffer used in display */
+ GtkTextBuffer *info_buffer; /* Buffer used in info messages */
GtkWidget *scrolledwindow; /* Scrolled window for display_item. */
- GtkWidget *register_dialog;
- GtkWidget *register_entries[MAX_REGISTERS];
-
- GtkWidget *precision_dialog;
- GtkWidget *precision_spin;
-
- GtkWidget *buttons[NBUTTONS];
- GtkWidget *digit_buttons[16];
- GtkWidget *clear_buttons[2];
-
GtkWidget *bas_panel; /* Panel containing basic mode widgets. */
GtkWidget *adv_panel; /* Panel containing advanced mode widgets. */
GtkWidget *fin_panel; /* Panel containing financial mode widgets. */
GtkWidget *sci_panel; /* Panel containing scientific mode widgets. */
GtkWidget *prog_panel; /* Panel containing programming mode widgets. */
- GtkWidget *sci_mode_panel; /* Panel containing scientific mode widgets. */
- GtkWidget *prog_mode_panel;/* Panel containing programming mode widgets. */
+
+ GtkWidget *superscript_toggle;
+ GtkWidget *subscript_toggle;
/* Labels for popup menus */
- GtkWidget *constant_menu_labels[MAX_CONSTANTS];
- GtkWidget *function_menu_labels[MAX_FUNCTIONS];
GtkWidget *memory_store_labels[MAX_REGISTERS];
GtkWidget *memory_recall_labels[MAX_REGISTERS];
- GtkWidget *memory_exchange_labels[MAX_REGISTERS];
- /* Scientific mode widgets */
- GtkWidget *hyperbolic_toggle; /* Hyperbolic mode. */
- GtkWidget *inverse_toggle; /* Inverse mode. */
- GtkWidget *display_mode_radios[MAXDISPMODES]; /* Numeric display mode. */
- GtkWidget *radian_radio; /* Radian radio button. */
- GtkWidget *degree_radio; /* Degree radio button. */
- GtkWidget *gradian_radio; /* Gradian radio button. */
-
- /* Programming mode widgets */
- GtkWidget *binary_radio;
- GtkWidget *octal_radio;
- GtkWidget *decimal_radio;
- GtkWidget *hexadecimal_radio;
- GtkWidget *word_length_radios[3]; /* Wordlength radio buttons. */
-
+ GtkWidget *preferences_dialog;
+
GdkAtom clipboard_atom;
GdkAtom primary_atom;
char *shelf; /* PUT selection shelf contents. */
-
- int last_function;
+
+ /* Last text entered */
+ char *last_text;
} GtkUI;
static GtkUI X;
@@ -581,11 +236,16 @@ static void load_ui(GtkBuilder *ui, const gchar *filename)
exit(0);
}
-static void set_data(GtkBuilder *ui, const gchar *object_name, const gchar *name, gpointer value)
+static void set_data(GtkBuilder *ui, const gchar *object_name, const gchar *name, const gpointer value)
{
g_object_set_data(gtk_builder_get_object(ui, object_name), name, value);
}
+static void set_string_data(GtkBuilder *ui, const gchar *object_name, const gchar *name, const char *value)
+{
+ g_object_set_data(gtk_builder_get_object(ui, object_name), name, (gpointer)value); // FIXME: Copy?
+}
+
static void set_int_data(GtkBuilder *ui, const gchar *object_name, const gchar *name, gint value)
{
set_data(ui, object_name, name, GINT_TO_POINTER(value));
@@ -664,298 +324,12 @@ position_popup(GtkWidget *base, GtkWidget *popup,
gtk_window_move(GTK_WINDOW(popup), popup_x, popup_y);
}
-void
-ui_set_accuracy(int accuracy)
-{
- GtkWidget *widget;
- char text[MAXLINE];
-
- /* Translators: Accuracy Popup: Menu item to show the accuracy dialog. %d is replaced with the current accuracy. */
- SNPRINTF(text, MAXLINE, _("_Other (%d) ..."), accuracy);
- widget = gtk_bin_get_child(GTK_BIN(GET_OBJECT("acc_item_other")));
- gtk_label_set_markup_with_mnemonic(GTK_LABEL(widget), text);
-
- gtk_widget_set_tooltip_text (GET_WIDGET("calc_accuracy_button"),
- /* Translators: Tooltip for accuracy button */
- ngettext("Set accuracy from 0 to %d numeric place. [A]",
- "Set accuracy from 0 to %d numeric places. [A]",
- MAXACC));
-
- if (accuracy >= 0 && accuracy <= 9) {
- SNPRINTF(text, MAXLINE, "acc_item%d", accuracy);
- widget = GET_WIDGET(text);
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), TRUE);
- }
-
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(X.precision_spin), (double)accuracy);
-
- /* Hide the manual dialog */
- gtk_widget_hide(X.precision_dialog);
-
- /* Rebuild registers with new format */
- ui_make_registers();
-}
-
-
-static void
-ui_update_modifier_mode()
-{
- static char *sine_labels[] = {
- /* Translators: The sine button */
- N_("sin"),
- /* Translators: The inverse sine button */
- N_("sin<sup>â??1</sup>"),
- /* Translators: The hyperbolic sine button */
- N_("sinh"),
- /* Translators: The inverse hyperbolic sine button */
- N_("sinh<sup>â??1</sup>")};
- static char *sine_tooltips[] = {
- /* Translators: The sine tooltip */
- N_("Sine [k]"),
- /* Translators: The inverse sine tooltip */
- N_("Inverse Sine [K]"),
- /* Translators: The hyperbolic sine tooltip */
- N_("Hyperbolic Sine [k]"),
- /* Translators: The hyperbolic inverse sine tooltip */
- N_("Hyperbolic Inverse Sine [K]")};
- static int sine_functions[] = {FN_SIN, FN_ASIN, FN_SINH, FN_ASINH};
- static char *cosine_labels[] = {
- /* Translators: The cosine button */
- N_("cos"),
- /* Translators: The inverse cosine button */
- N_("cos<sup>â??1</sup>"),
- /* Translators: The hyperbolic cosine button */
- N_("cosh"),
- /* Translators: The inverse hyperbolic cosine button */
- N_("cosh<sup>â??1</sup>")};
- static char *cosine_tooltips[] = {
- /* Translators: The cosine tooltip */
- N_("Cosine [j]"),
- /* Translators: The inverse cosine tooltip */
- N_("Inverse Cosine [J]"),
- /* Translators: The hyperbolic cosine tooltip */
- N_("Hyperbolic Cosine [j]"),
- /* Translators: The hyperbolic inverse cosine tooltip */
- N_("Hyperbolic Inverse Cosine [J]")};
- static int cosine_functions[] = {FN_COS, FN_ACOS, FN_COSH, FN_ACOSH};
- static char *tangent_labels[] = {
- /* Translators: The tangent button */
- N_("tan"),
- /* Translators: The inverse tangent button */
- N_("tan<sup>â??1</sup>"),
- /* Translators: The hyperbolic tangent button */
- N_("tanh"),
- /* Translators: The inverse hyperbolic tangent button */
- N_("tanh<sup>â??1</sup>")};
- static char *tangent_tooltips[] = {
- /* Translators: The tangent tooltip */
- N_("Tangent [w]"),
- /* Translators: The inverse tangent tooltip */
- N_("Inverse Tangent [W]"),
- /* Translators: The hyperbolic tangent tooltip */
- N_("Hyperbolic Tangent [w]"),
- /* Translators: The hyperbolic inverse tangent tooltip */
- N_("Hyperbolic Inverse Tangent [W]")};
- static int tangent_functions[] = {FN_TAN, FN_ATAN, FN_TANH, FN_ATANH};
-
- static char *ln_labels[] = {
- /* Translators: The natural logaritm button */
- N_("ln"),
- /* Translators: The e to the power of x button */
- N_("e<sup><i>x</i></sup>")};
- static char *ln_tooltips[] = {
- /* Translators: Tooltip for the natural log button */
- N_("Natural logarithm [n]"),
- /* Translators: Tooltip for the e to the power of x button */
- N_("e to the power of the displayed value [N]")};
- static int ln_functions[] = {FN_NATURAL_LOGARITHM, FN_E_POW_X};
-
- static char *log_labels[] = {
- /* Translators: The 10-based logaritm button */
- N_("log"),
- /* Translators: The 10 to the power of x button */
- N_("10<sup><i>x</i></sup>")};
- static char *log_tooltips[] = {
- /* Translators: Tooltip for the log base 10 button */
- N_("Base 10 logarithm [g]"),
- /* Translators: Tooltip for the 10 to the power of x button */
- N_("10 to the power of displayed value [G]")};
- static int log_functions[] = {FN_LOGARITHM, FN_10_POW_X};
-
- static char *log2_labels[] = {
- /* Translators: The 2-based logaritm button */
- N_("log<sub>2</sub>"),
- /* Translators: The 2 to the power of x button */
- N_("2<sup><i>x</i></sup>")};
- static char *log2_tooltips[] = {
- /* Translators: Tooltip for the log base 2 button */
- N_("Base 2 logarithm [h]"),
- /* Translators: Tooltip for the 2 to the power of x button */
- N_("2 to the power of the displayed value [H]")};
- static int log2_functions[] = {FN_LOGARITHM2, FN_2_POW_X};
-
- static char *x_pow_y_labels[] = {
- /* Translators: The x to the power of y button */
- N_("x<sup><i>y</i></sup>"),
- /* Translators: The x to the power of reciprocal y button */
- N_("x<sup>1/<i>y</i></sup>")};
- static char *x_pow_y_tooltips[] = {
- /* Translators: Tooltip for the x to the power of y button */
- N_("Raise displayed value to the power of y [o]"),
- /* Translators: Tooltip for the x to the power of reciprocal y button */
- N_("Raise displayed value to the power of reciprocal y [O]")};
- static int x_pow_y_functions[] = {FN_X_POW_Y, FN_X_POW_Y_INV};
-
- int index = 0;
-
- if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(X.inverse_toggle)))
- index |= 0x1;
-
- gtk_label_set_markup(GTK_LABEL(GET_OBJECT("natural_logarithm_label")),
- _(ln_labels[index]));
- gtk_widget_set_tooltip_text(GET_WIDGET("calc_natural_logarithm_button"),
- _(ln_tooltips[index]));
- set_int_data(X.ui, "calc_natural_logarithm_button", "calc_function", ln_functions[index]);
-
- gtk_label_set_markup(GTK_LABEL(GET_OBJECT("logarithm_label")),
- _(log_labels[index]));
- gtk_widget_set_tooltip_text(GET_WIDGET("calc_logarithm_button"),
- _(log_tooltips[index]));
- set_int_data(X.ui, "calc_logarithm_button", "calc_function", log_functions[index]);
-
- gtk_label_set_markup(GTK_LABEL(GET_OBJECT("logarithm2_label")),
- _(log2_labels[index]));
- gtk_widget_set_tooltip_text(GET_WIDGET("calc_logarithm2_button"),
- _(log2_tooltips[index]));
- set_int_data(X.ui, "calc_logarithm2_button", "calc_function", log2_functions[index]);
-
- gtk_label_set_markup(GTK_LABEL(GET_OBJECT("x_pow_y_label")),
- _(x_pow_y_labels[index]));
- gtk_widget_set_tooltip_text(GET_WIDGET("calc_x_pow_y_button"),
- _(x_pow_y_tooltips[index]));
- set_int_data(X.ui, "calc_x_pow_y_button", "calc_function", x_pow_y_functions[index]);
-
- if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(X.hyperbolic_toggle)))
- index |= 0x2;
-
- gtk_label_set_markup(GTK_LABEL(GET_OBJECT("sine_label")),
- _(sine_labels[index]));
- gtk_widget_set_tooltip_text(GET_WIDGET("calc_sine_button"),
- _(sine_tooltips[index]));
- set_int_data(X.ui, "calc_sine_button", "calc_function", sine_functions[index]);
-
- gtk_label_set_markup(GTK_LABEL(GET_OBJECT("cosine_label")),
- _(cosine_labels[index]));
- gtk_widget_set_tooltip_text(GET_WIDGET("calc_cosine_button"),
- _(cosine_tooltips[index]));
- set_int_data(X.ui, "calc_cosine_button", "calc_function", cosine_functions[index]);
-
- gtk_label_set_markup(GTK_LABEL(GET_OBJECT("tangent_label")),
- _(tangent_labels[index]));
- gtk_widget_set_tooltip_text(GET_WIDGET("calc_tangent_button"),
- _(tangent_tooltips[index]));
- set_int_data(X.ui, "calc_tangent_button", "calc_function", tangent_functions[index]);
-}
-
-
-void
-ui_set_trigonometric_mode(MPAngleUnit units)
-{
- GtkWidget *radio;
- switch(units) {
- default:
- case MP_RADIANS:
- radio = X.radian_radio;
- break;
- case MP_DEGREES:
- radio = X.degree_radio;
- break;
- case MP_GRADIANS:
- radio = X.gradian_radio;
- break;
- }
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio), 1);
-}
-
-
-void
-ui_set_numeric_mode(DisplayFormat mode)
-{
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(X.display_mode_radios[mode]), 1);
-}
-
-
-void
-ui_set_show_thousands_separator(gboolean visible)
-{
- GtkWidget *menu;
-
- display_set_show_thousands_separator(&v->display, visible);
-
- menu = GET_WIDGET("show_thousands_separator_menu");
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), visible);
-
- /* Rebuild registers */
- ui_make_registers();
-}
-
-
-void
-ui_set_show_trailing_zeroes(gboolean visible)
-{
- GtkWidget *menu;
-
- display_set_show_trailing_zeroes(&v->display, visible);
-
- /* Rebuild registers */
- ui_make_registers();
-
- menu = GET_WIDGET("show_trailing_zeroes_menu");
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), visible);
- menu = GET_WIDGET("acc_trailing_zeroes_item");
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), visible);
-}
-
void
ui_set_undo_enabled(gboolean undo, gboolean redo)
{
- gtk_widget_set_sensitive(GET_WIDGET("undo_menu"), undo);
- gtk_widget_set_sensitive(GET_WIDGET("redo_menu"), redo);
-}
-
-
-static char *
-make_hostname()
-{
- Display *dpy = GDK_DISPLAY();
- char client_hostname[MAXLINE] = "";
- char hostname[MAXHOSTNAMELEN];
- char *display = DisplayString(dpy);
- char *scanner = display;
-
- gethostname(hostname, MAXHOSTNAMELEN);
-
- while (*scanner)
- scanner++;
-
- while (*scanner != ':')
- scanner--;
-
- *scanner = '\0';
-
- if (strcmp(display, hostname) &&
- strcmp(display, "localhost") &&
- strcmp(display, "unix") &&
- strcmp(display, ""))
- SNPRINTF(client_hostname, MAXLINE, " [%s] ", hostname);
-
- *scanner = ':';
-
- if (client_hostname[0] == '\0')
- return NULL;
- else
- return strdup(client_hostname);
+// gtk_widget_set_sensitive(GET_WIDGET("undo_menu"), undo);
+// gtk_widget_set_sensitive(GET_WIDGET("redo_menu"), redo);
}
@@ -985,7 +359,9 @@ ui_set_bitfield(int enabled, guint64 bits)
}
}
-static void do_button(int function, int arg)
+
+static void
+do_button(int function, int arg)
{
GtkTextIter start, end;
gint cursor_start, cursor_end;
@@ -1000,19 +376,31 @@ static void do_button(int function, int arg)
cursor_start = -1;
cursor_end = cursor_start;
}
-
+
/* Some keyboards don't have a '^' button so convert two multiplies to one '^' */
if (cursor_start == cursor_end &&
- function == FN_MULTIPLY && X.last_function == FN_MULTIPLY) {
+ function == FN_TEXT && X.last_text != NULL &&
+ strcmp((char *)arg, "Ã?") == 0 && strcmp(X.last_text, "Ã?") == 0) {
do_button(FN_BACKSPACE, 0);
- do_button(FN_X_POW_Y, 0);
+ do_button(FN_TEXT, (int)"^"); // FIXME: Not 64 bit safe
}
else {
- do_expression(function, arg, cursor_start, cursor_end);
- X.last_function = function;
+ display_do_function(&v->display, function, arg, cursor_start, cursor_end);
+ if (function == FN_TEXT)
+ X.last_text = (char *)arg;
+ else
+ X.last_text = NULL;
}
}
+
+static void
+do_text(const char *text)
+{
+ do_button(FN_TEXT, (int)text); // FIXME: Not 64 bit safe
+}
+
+
static void
do_finc(char* dialog)
{
@@ -1022,118 +410,24 @@ do_finc(char* dialog)
gtk_widget_hide(GTK_WIDGET(GET_FINC_WIDGET(dialog)));
}
-void
+static void
ui_set_mode(ModeType mode)
{
- GtkRequisition *r;
- gint w, h;
- char *hostname, title[MAXLINE];
GtkWidget *menu;
- if (X.mode != mode) {
- X.mode = mode;
-
- // FIXME: These should affect display but not the actual UI settings
- if (mode != PROGRAMMING)
- ui_set_base(10);
- if (mode != SCIENTIFIC) {
- ui_set_numeric_mode(FIX);
- do_button(FN_SET_ACCURACY, DEFAULT_ACCURACY);
- }
- if (mode == BASIC)
- ui_set_show_trailing_zeroes(FALSE);
+ X.mode = mode;
- ui_make_registers();
- }
-
/* Save mode */
set_enumerated_resource(R_MODE, mode_names, (int)mode);
/* Show/enable the widgets used in this mode */
- g_object_set(G_OBJECT(X.bas_panel), "visible", mode == BASIC, NULL);
g_object_set(G_OBJECT(X.adv_panel), "visible", mode != BASIC, NULL);
g_object_set(G_OBJECT(X.fin_panel), "visible", mode == FINANCIAL, NULL);
- g_object_set(G_OBJECT(X.sci_mode_panel), "visible", mode == SCIENTIFIC, NULL);
- g_object_set(G_OBJECT(X.prog_mode_panel), "visible", mode == PROGRAMMING, NULL);
g_object_set(G_OBJECT(X.sci_panel), "visible", mode == SCIENTIFIC, NULL);
g_object_set(G_OBJECT(X.prog_panel), "visible", mode == PROGRAMMING, NULL);
g_object_set(G_OBJECT(X.bit_panel), "visible", mode == PROGRAMMING, NULL);
- gtk_widget_set_sensitive(GET_WIDGET("show_trailing_zeroes_menu"), mode == SCIENTIFIC || mode == PROGRAMMING);
- gtk_widget_set_sensitive(GET_WIDGET("show_registers_menu"), mode != BASIC);
-
- /* HACK: Some horrible hack down below to keep the buttons the same size.
- * There must be a safer way of doing this... */
- r = g_new0(GtkRequisition, 1);
- gtk_widget_size_request(X.menubar, r);
- w = r->width;
- h = r->height;
- gtk_widget_size_request(X.display_item, r);
- w = MAX(w, r->width);
- h += r->height;
-
-#if GTK_CHECK_VERSION (2,17,7)
- if (gtk_widget_get_visible (GTK_WIDGET (X.fin_panel))) {
-#else
- if (GTK_WIDGET_VISIBLE(X.fin_panel)) {
-#endif
- gtk_widget_size_request(X.fin_panel, r);
- w = MAX(w, r->width);
- h += r->height;
- }
-
-#if GTK_CHECK_VERSION (2,17,7)
- if (gtk_widget_get_visible (GTK_WIDGET (X.sci_mode_panel))) {
-#else
- if (GTK_WIDGET_VISIBLE(X.sci_mode_panel)) {
-#endif
- gtk_widget_size_request(X.sci_mode_panel, r);
- w = MAX(w, r->width);
- h += r->height;
- }
-#if GTK_CHECK_VERSION (2,17,7)
- if (gtk_widget_get_visible (GTK_WIDGET (X.prog_mode_panel))) {
-#else
- if (GTK_WIDGET_VISIBLE(X.prog_mode_panel)) {
-#endif
- gtk_widget_size_request(X.prog_mode_panel, r);
- w = MAX(w, r->width);
- h += r->height;
- }
-
-#if GTK_CHECK_VERSION (2,17,7)
- if (gtk_widget_get_visible (GTK_WIDGET (X.sci_panel))) {
-#else
- if (GTK_WIDGET_VISIBLE(X.sci_panel)) {
-#endif
- gtk_widget_size_request(X.sci_panel, r);
- w = MAX(w, r->width);
- h += r->height;
- }
-
-#if GTK_CHECK_VERSION (2,17,7)
- if (gtk_widget_get_visible (GTK_WIDGET (X.prog_panel))) {
-#else
- if (GTK_WIDGET_VISIBLE(X.prog_panel)) {
-#endif
- gtk_widget_size_request(X.prog_panel, r);
- w = MAX(w, r->width);
- h += r->height;
- }
- g_free(r);
-
- /* For initial display. */
- gtk_window_set_default_size(GTK_WINDOW(X.main_window), w, h);
- gtk_window_resize(GTK_WINDOW(X.main_window), w, h);
-
- /* Set the title */
- if((hostname = make_hostname())) {
- SNPRINTF(title, MAXLINE, gettext(hostname_titles[mode]), hostname);
- g_free(hostname);
- } else {
- SNPRINTF(title, MAXLINE, "%s", gettext(titles[mode]));
- }
- gtk_window_set_title(GTK_WINDOW(X.main_window), title);
+ gtk_window_set_title(GTK_WINDOW(X.main_window), gettext(titles[mode]));
/* Update the menu */
switch (mode) {
@@ -1166,17 +460,9 @@ ui_set_mode(ModeType mode)
void
-ui_set_statusbar(const gchar *text, const gchar *imagename)
+ui_set_statusbar(const gchar *text)
{
- GtkImage *image = GTK_IMAGE(X.status_image);
-
- assert(text);
- assert(imagename);
- assert(image);
-
- gtk_image_set_from_stock(image, imagename, GTK_ICON_SIZE_BUTTON);
- gtk_statusbar_pop(GTK_STATUSBAR(X.statusbar), 0);
- gtk_statusbar_push(GTK_STATUSBAR(X.statusbar), 0, text);
+ gtk_text_buffer_set_text(X.info_buffer, text, -1);
}
@@ -1238,144 +524,6 @@ ui_set_display(char *str, int cursor)
}
-/* When an error condition occurs:
- *
- * - make insensitive all buttons except Clr.
- * - make all Scientific mode toggles and checkboxes insensitive.
- * - make all menubar items insensitive except:
- * Calculator->Quit
- * Help->Contents
- *
- * When the error condition is cleared, resensitise everything, setting
- * the numeric base buttons correctly.
- */
-void
-ui_set_error_state(gboolean error)
-{
- int i;
-
- v->error = error;
-
- for (i = 0; i < NBUTTONS; i++)
- gtk_widget_set_sensitive(X.buttons[i], !v->error);
- /* Clr button always sensitive. */
- gtk_widget_set_sensitive(X.clear_buttons[0], TRUE);
- gtk_widget_set_sensitive(X.clear_buttons[1], TRUE);
-
- if (!v->error)
- ui_set_base(v->base);
-
- gtk_widget_set_sensitive(X.sci_mode_panel, !v->error);
- gtk_widget_set_sensitive(X.prog_mode_panel, !v->error);
-
- gtk_widget_set_sensitive(GET_WIDGET("copy_menu"), !v->error);
- gtk_widget_set_sensitive(GET_WIDGET("paste_menu"), !v->error);
- gtk_widget_set_sensitive(GET_WIDGET("undo_menu"), !v->error);
- gtk_widget_set_sensitive(GET_WIDGET("redo_menu"), !v->error);
- gtk_widget_set_sensitive(GET_WIDGET("insert_ascii_menu"), !v->error);
-
- gtk_widget_set_sensitive(GET_WIDGET("view_basic_menu"), !v->error);
- gtk_widget_set_sensitive(GET_WIDGET("view_advanced_menu"), !v->error);
- gtk_widget_set_sensitive(GET_WIDGET("view_financial_menu"), !v->error);
- gtk_widget_set_sensitive(GET_WIDGET("view_scientific_menu"), !v->error);
- gtk_widget_set_sensitive(GET_WIDGET("show_trailing_zeroes_menu"),
- !v->error && (X.mode == SCIENTIFIC ||
- X.mode == PROGRAMMING));
- gtk_widget_set_sensitive(GET_WIDGET("show_thousands_separator_menu"),
- !v->error);
- gtk_widget_set_sensitive(GET_WIDGET("show_registers_menu"), !v->error);
-
- gtk_widget_set_sensitive(GET_WIDGET("about_menu"), !v->error);
-}
-
-
-void
-ui_beep()
-{
- gdk_beep();
-}
-
-
-void
-ui_set_base(int base)
-{
- GtkWidget *widget;
- int i;
-
- v->base = base;
-
- for (i = 0; i < 16; i++)
- gtk_widget_set_sensitive(X.digit_buttons[i], i < base);
- switch (base)
- {
- case 2:
- widget = X.binary_radio;
- break;
- case 8:
- widget = X.octal_radio;
- break;
- case 10:
- widget = X.decimal_radio;
- break;
- case 16:
- widget = X.hexadecimal_radio;
- break;
- default:
- return;
- }
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
-}
-
-
-void
-ui_set_wordlen(int len)
-{
- GtkWidget *widget;
- v->wordlen = len;
- switch (len) {
- case 64:
- widget = X.word_length_radios[0];
- break;
- case 32:
- widget = X.word_length_radios[1];
- break;
- case 16:
- widget = X.word_length_radios[2];
- break;
- default:
- return;
- }
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), 1);
-}
-
-
-void
-ui_set_registers_visible(gboolean visible)
-{
- GtkWidget *menu;
-
- ui_make_registers();
-
- menu = GET_WIDGET("show_registers_menu");
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), visible);
-
- gtk_widget_realize(X.register_dialog);
-
- if (visible) {
- if (gdk_window_is_visible(gtk_widget_get_window(X.register_dialog))) {
- gdk_window_raise(gtk_widget_get_window(X.register_dialog));
- return;
- }
- position_popup(X.main_window, X.register_dialog, POPUP_ABOVE);
- gtk_widget_show(X.register_dialog);
- } else {
- gtk_widget_hide(X.register_dialog);
- }
-
- set_boolean_resource(R_REGS, visible);
-}
-
-
G_MODULE_EXPORT
void
about_cb(GtkWidget *widget)
@@ -1396,8 +544,7 @@ about_cb(GtkWidget *widget)
const gchar *translator_credits = _("translator-credits");
/* Translators: The license this software is under (GPL2+) */
- char *license =
- _("Gcalctool is free software; you can redistribute it and/or modify\n"
+ char *license = _("Gcalctool is free software; you can redistribute it and/or modify\n"
"it under the terms of the GNU General Public License as published by\n"
"the Free Software Foundation; either version 2 of the License, or\n"
"(at your option) any later version.\n"
@@ -1427,60 +574,6 @@ about_cb(GtkWidget *widget)
NULL);
}
-static void
-cell_edited_cb(GtkCellRendererText *cell, const gchar *path_string,
- const gchar *new_text, gpointer data)
-{
- GtkTreeModel *model = (GtkTreeModel *) data;
- GtkTreePath *path = gtk_tree_path_new_from_string(path_string);
- GtkTreeIter iter;
- gint *column;
-
- column = g_object_get_data(G_OBJECT(cell), "column");
-
- gtk_tree_model_get_iter(model, &iter, path);
-
- switch (GPOINTER_TO_INT(column)) {
- case COLUMN_VALUE:
- gtk_list_store_set(GTK_LIST_STORE(model), &iter, column,
- g_strdup(new_text), -1);
- break;
-
- case COLUMN_DESCRIPTION:
- gtk_list_store_set(GTK_LIST_STORE(model), &iter, column,
- g_strdup(new_text), -1);
- break;
- }
-
- gtk_tree_path_free(path);
-}
-
-
-static void
-add_cf_column(GtkTreeView *treeview, gchar *name, gint colno, gboolean editable)
-{
- GtkCellRenderer *renderer;
- GtkTreeModel *model = gtk_tree_view_get_model(treeview);
-
- renderer = gtk_cell_renderer_text_new();
- if (editable)
- g_signal_connect(G_OBJECT(renderer), "edited",
- G_CALLBACK(cell_edited_cb), model);
- g_object_set_data(G_OBJECT(renderer), "column", GINT_TO_POINTER(colno));
-
- if (editable)
- gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview),
- -1, name, renderer,
- "text", colno,
- "editable", COLUMN_EDITABLE,
- NULL);
- else
- gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview),
- -1, name, renderer,
- "text", colno,
- NULL);
-}
-
G_MODULE_EXPORT
void
@@ -1514,54 +607,6 @@ ascii_dialog_activate_cb(GtkWidget *entry)
}
-G_MODULE_EXPORT
-void
-register_dialog_response_cb(GtkWidget *dialog, int response_id)
-{
- ui_set_registers_visible(FALSE);
-}
-
-
-G_MODULE_EXPORT
-gboolean
-register_dialog_delete_cb(GtkWidget *dialog)
-{
- register_dialog_response_cb(dialog, GTK_RESPONSE_OK);
- return TRUE;
-}
-
-
-G_MODULE_EXPORT
-void
-disp_cb(GtkWidget *widget)
-{
- if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
- do_button(FN_SET_NUMBERTYPE, (int)g_object_get_data(G_OBJECT(widget), "numeric_mode"));
-}
-
-
-G_MODULE_EXPORT
-void
-base_cb(GtkWidget *widget)
-{
- int base;
-
- base = (int) g_object_get_data(G_OBJECT(widget), "base_mode");
- if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
- do_button(FN_SET_BASE, base);
-}
-
-G_MODULE_EXPORT
-void
-word_cb(GtkWidget *widget)
-{
- int wordlen;
-
- wordlen = (int) g_object_get_data(G_OBJECT(widget), "wordlen_mode");
- if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
- do_button(FN_SET_WORDLEN, wordlen);
-}
-
static void
help_display(void)
{
@@ -1574,10 +619,13 @@ help_display(void)
if (error != NULL)
{
GtkWidget *d;
+ /* Translators: Error message displayed when unable to launch help browser */
+ const char *message = _("Unable to open help file");
+
d = gtk_message_dialog_new (GTK_WINDOW (X.main_window),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
- "%s", _("Unable to open help file"));
+ "%s", message);
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (d),
"%s", error->message);
g_signal_connect (d, "response", G_CALLBACK (gtk_widget_destroy), NULL);
@@ -1590,24 +638,6 @@ help_display(void)
G_MODULE_EXPORT
void
-constant_menu_cb(GtkMenuItem *menu)
-{
- int arg = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(menu), "constant_id"));
- do_button(FN_CONSTANT, arg);
-}
-
-
-G_MODULE_EXPORT
-void
-function_menu_cb(GtkMenuItem *menu)
-{
- int arg = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(menu), "function_id"));
- do_button(FN_FUNCTION, arg);
-}
-
-
-G_MODULE_EXPORT
-void
store_menu_cb(GtkMenuItem *menu)
{
int arg = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(menu), "register_id"));
@@ -1626,17 +656,7 @@ recall_menu_cb(GtkMenuItem *menu)
G_MODULE_EXPORT
void
-exchange_menu_cb(GtkMenuItem *menu)
-{
- int arg = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(menu), "register_id"));
- do_button(FN_EXCHANGE, arg);
-}
-
-
-G_MODULE_EXPORT
-void
-finc_activate_cb(GtkWidget *widget)
-{
+finc_activate_cb(GtkWidget *widget) {
gint dialog, field;
dialog = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "finc_dialog"));
@@ -1645,11 +665,7 @@ finc_activate_cb(GtkWidget *widget)
if (finc_dialog_fields[dialog][field+1] == NULL) {
GtkWidget *dialog_widget;
dialog_widget = gtk_widget_get_toplevel(widget);
-#if GTK_CHECK_VERSION (2,17,10)
- if (gtk_widget_is_toplevel (dialog_widget)) {
-#else
if (GTK_WIDGET_TOPLEVEL (dialog_widget)) {
-#endif
gtk_dialog_response(GTK_DIALOG(dialog_widget),
GTK_RESPONSE_OK);
return;
@@ -1683,7 +699,7 @@ finc_response_cb(GtkWidget *widget, gint response_id)
}
entry = GET_FINC_WIDGET(finc_dialog_fields[dialog][i]);
// FIXME: Have to delocalize the input
- mp_set_from_string(gtk_entry_get_text(GTK_ENTRY(entry)), 10, &arg[i]);
+ mp_set_from_string(gtk_entry_get_text(GTK_ENTRY(entry)), &arg[i]);
gtk_entry_set_text(GTK_ENTRY(entry), "0");
}
gtk_widget_grab_focus(GET_FINC_WIDGET(finc_dialog_fields[dialog][0]));
@@ -1711,7 +727,7 @@ setup_finc_dialogs(void)
set_int_data(X.financial, "syd_dialog", "finc_dialog", FINC_SYD_DIALOG);
set_int_data(X.financial, "term_dialog", "finc_dialog", FINC_TERM_DIALOG);
- for (i = 0; i < FINC_NUM_DIALOGS; i++) {
+ for (i = 0; finc_dialog_fields[i][0] != NULL; i++) {
for (j = 0; finc_dialog_fields[i][j]; j++) {
GObject *o;
o = gtk_builder_get_object(X.financial, finc_dialog_fields[i][j]);
@@ -1723,206 +739,6 @@ setup_finc_dialogs(void)
gtk_builder_connect_signals(X.financial, NULL);
}
-static void
-update_constants_menu(void)
-{
- char mline[MAXLINE], value[MAXLINE];
- int i;
-
- for (i = 0; i < MAX_CONSTANTS; i++) {
- display_make_number(&v->display, value, MAXLINE, constant_get_value(i), 10, TRUE);
- SNPRINTF(mline, MAXLINE,
- "<span weight=\"bold\">%s_%1d:</span> %s [%s]", _("C"), i,
- value,
- constant_get_name(i));
- gtk_label_set_markup_with_mnemonic(GTK_LABEL(X.constant_menu_labels[i]), mline);
- }
-}
-
-
-static void
-update_functions_menu(void)
-{
- char mline[MAXLINE];
- int i;
-
- for (i = 0; i < MAX_FUNCTIONS; i++) {
- const char *name, *value;
-
- name = function_get_name(i);
- value = function_get_value(i);
-
- if (strlen(value) != 0) {
- SNPRINTF(mline, MAXLINE,
- "<span weight=\"bold\">%s_%1d:</span> %s [%s]",
- _("F"), i, value, name);
- gtk_widget_show(gtk_widget_get_parent(X.function_menu_labels[i]));
- gtk_label_set_markup_with_mnemonic(GTK_LABEL(X.function_menu_labels[i]), mline);
- }
- else
- gtk_widget_hide(gtk_widget_get_parent(X.function_menu_labels[i]));
- }
-}
-
-
-G_MODULE_EXPORT
-void
-edit_constants_response_cb(GtkDialog *dialog, gint id)
-{
- GtkTreeIter iter;
- gint number;
- gchar *value;
- gchar *description;
-
- if (id == GTK_RESPONSE_HELP)
- help_display();
-
- if (id == GTK_RESPONSE_ACCEPT) {
- if (gtk_tree_model_get_iter_first(X.constants_model, &iter)) {
- do {
- MPNumber temp;
- gtk_tree_model_get(X.constants_model, &iter,
- COLUMN_NUMBER, &number,
- COLUMN_VALUE, &value,
- COLUMN_DESCRIPTION, &description, -1);
- // FIXME: Have to delocalize
- mp_set_from_string(value, 10, &temp);
- constant_set(number, description, &temp);
- } while (gtk_tree_model_iter_next(X.constants_model, &iter));
- }
- }
-
- gtk_widget_hide(GTK_WIDGET(dialog));
-}
-
-
-G_MODULE_EXPORT
-gboolean
-edit_constants_delete_cb(GtkDialog *dialog)
-{
- edit_constants_response_cb(dialog, GTK_RESPONSE_CANCEL);
- return TRUE;
-}
-
-
-G_MODULE_EXPORT
-void
-edit_functions_response_cb(GtkDialog *dialog, gint id)
-{
- GtkTreeIter iter;
- gint number;
- gchar *value;
- gchar *description;
-
- if (id == GTK_RESPONSE_HELP)
- help_display();
-
- if (id == GTK_RESPONSE_ACCEPT) {
- if (gtk_tree_model_get_iter_first(X.functions_model, &iter)) {
- do {
- gtk_tree_model_get(X.functions_model, &iter,
- COLUMN_NUMBER, &number,
- COLUMN_VALUE, &value,
- COLUMN_DESCRIPTION, &description, -1);
- function_set(number, description, value);
- } while (gtk_tree_model_iter_next(X.functions_model, &iter));
- }
- }
-
- gtk_widget_hide(GTK_WIDGET(dialog));
-}
-
-
-G_MODULE_EXPORT
-gboolean
-edit_functions_delete_cb(GtkDialog *dialog)
-{
- edit_functions_response_cb(dialog, GTK_RESPONSE_CANCEL);
- return TRUE;
-}
-
-
-static GtkTreeModel *
-create_constants_model()
-{
- gint i = 0;
- GtkListStore *model;
- GtkTreeIter iter;
- char constant[MAXLINE];
-
- model = gtk_list_store_new(NUM_COLUMNS, G_TYPE_INT, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_BOOLEAN);
- for (i = 0; i < MAX_CONSTANTS; i++) {
- gtk_list_store_append(model, &iter);
-
- display_make_number(&v->display, constant, MAXLINE, constant_get_value(i), 10, TRUE);
- gtk_list_store_set(model, &iter,
- COLUMN_NUMBER, i,
- COLUMN_EDITABLE, TRUE,
- COLUMN_VALUE, constant,
- COLUMN_DESCRIPTION, constant_get_name(i),
- -1);
- }
-
- return GTK_TREE_MODEL(model);
-}
-
-
-static GtkTreeModel *
-create_functions_model()
-{
- gint i = 0;
- GtkListStore *model;
- GtkTreeIter iter;
-
- model = gtk_list_store_new(NUM_COLUMNS, G_TYPE_INT, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_BOOLEAN);
- for (i = 0; i < MAX_FUNCTIONS; i++) {
- gtk_list_store_append(model, &iter);
-
- gtk_list_store_set(model, &iter,
- COLUMN_NUMBER, i,
- COLUMN_EDITABLE, TRUE,
- COLUMN_VALUE, function_get_value(i),
- COLUMN_DESCRIPTION, function_get_name(i),
- -1);
- }
-
- return GTK_TREE_MODEL(model);
-}
-
-
-void
-ui_make_registers() /* Calculate memory register frame values. */
-{
- char mval[MAXLINE], key[MAXLINE], value[MAXLINE];
- int n;
-
- for (n = 0; n < MAX_REGISTERS; n++) {
- MPNumber temp;
-
- register_get(n, &temp);
- display_make_number(&v->display, mval, MAXLINE, &temp, v->base, TRUE);
- gtk_entry_set_width_chars(GTK_ENTRY(X.register_entries[n]), strlen(mval));
- gtk_entry_set_text(GTK_ENTRY(X.register_entries[n]), mval);
-
- SNPRINTF(key, MAXLINE, "register%d", n);
- display_make_number(&v->display, value, MAXLINE, &temp, 10, TRUE);
- set_resource(key, value);
- }
-}
-
-
-static void
-save_win_position()
-{
- int x, y;
-
- (void) gdk_window_get_origin(gtk_widget_get_window(X.main_window), &x, &y);
- set_int_resource(R_XPOS, x);
- set_int_resource(R_YPOS, y);
-}
-
G_MODULE_EXPORT
gboolean
@@ -1937,42 +753,19 @@ bit_toggle_cb(GtkWidget *event_box, GdkEventButton *event)
G_MODULE_EXPORT
void
-menu_item_select_cb(GtkWidget *widget)
+set_superscript_cb(GtkWidget *widget)
{
- GtkStatusbar *statusbar = GTK_STATUSBAR(X.statusbar);
- gchar *tooltip;
- guint context_id;
-
- context_id = gtk_statusbar_get_context_id(statusbar, "menuhelp");
-
- tooltip = (gchar *)g_object_get_data(G_OBJECT(widget), "tooltip");
- if (tooltip)
- gtk_statusbar_push(statusbar, context_id, tooltip);
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(X.subscript_toggle), FALSE);
}
G_MODULE_EXPORT
void
-menu_item_deselect_cb(GtkWidget *widget)
-{
- GtkStatusbar *statusbar = GTK_STATUSBAR(X.statusbar);
- guint context_id;
-
- context_id = gtk_statusbar_get_context_id(statusbar, "menuhelp");
- gtk_statusbar_pop(statusbar, context_id);
-}
-
-
-static void
-set_menubar_tooltip(gchar *menu_name)
+set_subscript_cb(GtkWidget *widget)
{
- GtkWidget *menu;
- gchar *tooltip;
-
- menu = GET_WIDGET(menu_name);
- tooltip = gtk_widget_get_tooltip_text(menu);
- g_object_set_data(G_OBJECT(menu), "tooltip", tooltip);
- gtk_widget_set_tooltip_text(menu, NULL);
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(X.superscript_toggle), FALSE);
}
@@ -1983,20 +776,26 @@ update_memory_menus()
int i;
for (i = 0; i < MAX_REGISTERS; i++) {
- MPNumber temp;
- register_get(i, &temp);
- display_make_number(&v->display, value, MAXLINE, &temp, v->base, TRUE);
- SNPRINTF(mstr, MAXLINE, "<span weight=\"bold\">%s_%d:</span> %s",
- /* Translators: R is the short form of register used inter alia in popup menus */
- _("R"), i, value);
+ const char *name, *register_prefix;
+
+ name = register_get_name(i);
+
+ /* Translators: R is the short form of register used inter alia in popup menus */
+ register_prefix = _("R");
+
+ display_make_number(&v->display, value, MAXLINE, register_get_value(i));
+ if (name[0] != '\0')
+ SNPRINTF(mstr, MAXLINE, "<span weight=\"bold\">%s_%d:</span> %s [%s]", register_prefix, i, value, name);
+ else
+ SNPRINTF(mstr, MAXLINE, "<span weight=\"bold\">%s_%d:</span> %s", register_prefix, i, value);
gtk_label_set_markup_with_mnemonic(GTK_LABEL(X.memory_store_labels[i]), mstr);
gtk_label_set_markup_with_mnemonic(GTK_LABEL(X.memory_recall_labels[i]), mstr);
- gtk_label_set_markup_with_mnemonic(GTK_LABEL(X.memory_exchange_labels[i]), mstr);
}
}
+/* The Copy function key has been pressed. */
static void
-get_display() /* The Copy function key has been pressed. */
+get_display()
{
gchar *string = NULL;
GtkTextIter start, end;
@@ -2018,7 +817,7 @@ get_display() /* The Copy function key has been pressed. */
static gboolean
check_for_localized_numeric_point(int keyval)
{
- gchar outbuf[10]; /* Minumum size 6. */
+ gchar outbuf[10]; /* Minumum size 6. */
gunichar ch;
ch = gdk_keyval_to_unicode(keyval);
@@ -2038,95 +837,95 @@ help_cb(GtkWidget *widget)
}
-G_MODULE_EXPORT
-void
-hyp_cb(GtkWidget *widget)
+static void
+menu_pos_func(GtkMenu *menu, gint *x, gint *y,
+ gboolean *push_in, gpointer user_data)
{
- ui_update_modifier_mode();
+ GdkPoint *loc = (GdkPoint *) user_data;
+
+ *x = loc->x;
+ *y = loc->y;
}
G_MODULE_EXPORT
void
-trig_cb(GtkWidget *widget)
+solve_cb(GtkWidget *widget, GdkEventButton *event)
{
- if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
- do_button(FN_SET_TRIG_TYPE, (int)g_object_get_data(G_OBJECT(widget), "trig_mode"));
+ do_button(FN_CALCULATE, 0);
}
G_MODULE_EXPORT
void
-inv_cb(GtkWidget *widget)
+clear_cb(GtkWidget *widget, GdkEventButton *event)
{
- ui_update_modifier_mode();
+ do_button(FN_CLEAR, 0);
}
-static void
-menu_pos_func(GtkMenu *menu, gint *x, gint *y,
- gboolean *push_in, gpointer user_data)
+G_MODULE_EXPORT
+void
+finc_cb(GtkWidget *widget, GdkEventButton *event)
{
- GdkPoint *loc = (GdkPoint *) user_data;
-
- *x = loc->x;
- *y = loc->y;
+ do_finc(g_object_get_data(G_OBJECT(widget), "finc_dialog"));
}
G_MODULE_EXPORT
void
-button_cb(GtkWidget *widget, GdkEventButton *event)
+popup_cb(GtkWidget *widget, GdkEventButton *event)
{
- int function;
GtkWidget *menu;
GdkPoint loc;
- char* dialog;
-#if GTK_CHECK_VERSION (2,17,7)
- GtkAllocation allocation;
-#endif
-
- function = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "calc_function"));
+
+ /* If gcalctool is being driven by gok, the on-screen keyboard
+ * assistive technology, it's possible that the event returned by
+ * gtk_get_current_event() is NULL. If this is the case, we need
+ * to fudge the popping up on the menu associated with this menu
+ * button.
+ */
+
+ update_memory_menus();
+
menu = (GtkWidget *)g_object_get_data(G_OBJECT(widget), "calc_menu");
- dialog = g_object_get_data(G_OBJECT(widget), "finc_dialog");
-
- if (menu == NULL && dialog == NULL) {
- do_button(function, 0);
- } else if (dialog != NULL) {
- do_finc(dialog);
- } else {
- /* If gcalctool is being driven by gok, the on-screen keyboard
- * assistive technology, it's possible that the event returned by
- * gtk_get_current_event() is NULL. If this is the case, we need
- * to fudge the popping up on the menu associated with this menu
- * button.
- */
-
- update_constants_menu();
- update_functions_menu();
- update_memory_menus();
-
- if (event == NULL) {
- gdk_window_get_origin(gtk_widget_get_window(widget), &loc.x, &loc.y);
-#if GTK_CHECK_VERSION (2,17,7)
- gtk_widget_get_allocation (widget, &allocation);
- loc.x += allocation.x;
- loc.y += allocation.y;
-#else
- loc.x += widget->allocation.x;
- loc.y += widget->allocation.y;
-#endif
- gtk_menu_popup(GTK_MENU(menu), NULL, NULL, menu_pos_func,
- (gpointer) &loc, 0, gtk_get_current_event_time());
- } else if (event->button == 1) {
- gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
- event->button, event->time);
- }
+ if (event == NULL) {
+ GtkAllocation allocation;
+
+ gdk_window_get_origin(gtk_widget_get_window(widget), &loc.x, &loc.y);
+ gtk_widget_get_allocation(widget, &allocation);
+ loc.x += allocation.x;
+ loc.y += allocation.y;
+ gtk_menu_popup(GTK_MENU(menu), NULL, NULL, menu_pos_func,
+ (gpointer) &loc, 0, gtk_get_current_event_time());
+ } else if (event->button == 1) {
+ gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
+ event->button, event->time);
}
}
+G_MODULE_EXPORT
+void
+digit_cb(GtkWidget *widget, GdkEventButton *event)
+{
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(X.superscript_toggle)))
+ do_text(g_object_get_data(G_OBJECT(widget), "calc_superscript_text"));
+ else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(X.subscript_toggle)))
+ do_text(g_object_get_data(G_OBJECT(widget), "calc_subscript_text"));
+ else
+ do_text(g_object_get_data(G_OBJECT(widget), "calc_text"));
+}
-static void
+
+G_MODULE_EXPORT
+void
+button_cb(GtkWidget *widget, GdkEventButton *event)
+{
+ do_text(g_object_get_data(G_OBJECT(widget), "calc_text"));
+}
+
+
+/*static void
select_display_entry(int offset)
{
GtkTextIter iter;
@@ -2134,159 +933,186 @@ select_display_entry(int offset)
gtk_text_buffer_get_iter_at_offset(X.display_buffer, &iter, offset);
gtk_text_buffer_place_cursor(X.display_buffer, &iter);
gtk_widget_grab_focus(X.display_item);
-}
+}*/
G_MODULE_EXPORT
gboolean
main_window_key_press_cb(GtkWidget *widget, GdkEventKey *event)
{
- int i, j, state;
- GtkWidget *button;
-
+ int i, state;
+ const char *conversions[] = {"-", "*", "/", "\t", NULL};
+ const char *conversion_values[] = {"â??", "Ã?", "÷", " ", };
+
/* Only look at the modifiers we use */
state = event->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK);
+ // FIXME: Convert event to character
+ // FIXME: Or safer to intercept characters as they enter the text input (handles input methods)
+
if (check_for_localized_numeric_point(event->keyval) == TRUE) {
event->state = 0;
event->keyval = GDK_KP_Decimal;
}
- /* Accuracy shortcuts */
- if (state == GDK_CONTROL_MASK && (X.mode == SCIENTIFIC ||
- X.mode == PROGRAMMING)) {
- switch (event->keyval) {
- case GDK_0:
- do_button(FN_SET_ACCURACY, 0);
- return TRUE;
- case GDK_1:
- do_button(FN_SET_ACCURACY, 1);
- return TRUE;
- case GDK_2:
- do_button(FN_SET_ACCURACY, 2);
- return TRUE;
- case GDK_3:
- do_button(FN_SET_ACCURACY, 3);
- return TRUE;
- case GDK_4:
- do_button(FN_SET_ACCURACY, 4);
- return TRUE;
- case GDK_5:
- do_button(FN_SET_ACCURACY, 5);
- return TRUE;
- case GDK_6:
- do_button(FN_SET_ACCURACY, 6);
- return TRUE;
- case GDK_7:
- do_button(FN_SET_ACCURACY, 7);
- return TRUE;
- case GDK_8:
- do_button(FN_SET_ACCURACY, 8);
- return TRUE;
- case GDK_9:
- do_button(FN_SET_ACCURACY, 9);
- return TRUE;
+ /* Shortcuts */
+ if (state == GDK_CONTROL_MASK) {
+ switch(event->keyval)
+ {
+ case GDK_0:
+ do_text("â?°");
+ return TRUE;
+ case GDK_1:
+ do_text("¹");
+ return TRUE;
+ case GDK_2:
+ do_text("²");
+ return TRUE;
+ case GDK_3:
+ do_text("³");
+ return TRUE;
+ case GDK_4:
+ do_text("â?´");
+ return TRUE;
+ case GDK_5:
+ do_text("â?µ");
+ return TRUE;
+ case GDK_6:
+ do_text("â?¶");
+ return TRUE;
+ case GDK_7:
+ do_text("â?·");
+ return TRUE;
+ case GDK_8:
+ do_text("â?¸");
+ return TRUE;
+ case GDK_9:
+ do_text("â?¹");
+ return TRUE;
+ case GDK_u:
+ do_text("µ");
+ return TRUE;
+ case GDK_e:
+ do_text("Ã?10^");
+ return TRUE;
+ case GDK_r:
+ do_text("â??");
+ return TRUE;
+ case GDK_i:
+ do_text("�¹");
+ return TRUE;
+ case GDK_p:
+ do_text("Ï?");
+ return TRUE;
}
}
-
- /* Connect home and end keys to move into the display entry */
- if (!gtk_widget_is_focus(X.display_item)) {
- if (event->keyval == GDK_Home) { /* || event->keyval == GDK_Left) { */
- select_display_entry(0);
+ else if (state == GDK_MOD1_MASK) {
+ switch(event->keyval)
+ {
+ case GDK_0:
+ do_text("â??");
+ return TRUE;
+ case GDK_1:
+ do_text("â??");
+ return TRUE;
+ case GDK_2:
+ do_text("â??");
+ return TRUE;
+ case GDK_3:
+ do_text("â??");
+ return TRUE;
+ case GDK_4:
+ do_text("â??");
return TRUE;
- } else if (event->keyval == GDK_End) { /* || event->keyval == GDK_Right) { */
- select_display_entry(-1);
+ case GDK_5:
+ do_text("â??");
+ return TRUE;
+ case GDK_6:
+ do_text("â??");
+ return TRUE;
+ case GDK_7:
+ do_text("â??");
+ return TRUE;
+ case GDK_8:
+ do_text("â??");
+ return TRUE;
+ case GDK_9:
+ do_text("â??");
return TRUE;
}
}
-
- /* Whitespace (but don't override activating buttons from the keyboard) */
- if (gtk_widget_is_focus(X.display_item) && event->keyval == GDK_space && state == 0) {
- do_button(FN_SPACE, 0);
- return TRUE;
- }
-
- /* Absolute value */
- /*if (event->keyval == GDK_bar && state == 0) {
- do_button(FN_ABSOLUTE_VALUE, 0);
- return TRUE;
- }*/
/* Delete in display */
if (event->keyval == GDK_Delete && state == 0 && (event->state & GDK_SHIFT_MASK) == 0) {
do_button(FN_DELETE, 0);
return TRUE;
}
-
- /* Shift inverse mode based on if shift is pressed */
- if (event->keyval == GDK_Shift_L || event->keyval == GDK_Shift_R) {
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(X.inverse_toggle),
- TRUE);
+ if (event->keyval == GDK_BackSpace && state == 0 && (event->state & GDK_SHIFT_MASK) == 0) {
+ do_button(FN_BACKSPACE, 0);
return TRUE;
}
- for (i = 0; i < NBUTTONS; i++) {
- button = X.buttons[i];
-
- /* Check if function is available */
-#if GTK_CHECK_VERSION (2,17,5)
- if (!gtk_widget_is_sensitive (button))
-#else
- if (!GTK_WIDGET_IS_SENSITIVE(button))
-#endif
- continue;
-
- /* In basic mode only allow buttons that the user can see */
- if (X.mode == BASIC &&
-#if GTK_CHECK_VERSION (2,17,5)
- (!gtk_widget_get_visible (gtk_widget_get_parent(button)) ||
- !gtk_widget_get_visible (button)))
-#else
- (!GTK_WIDGET_VISIBLE(gtk_widget_get_parent(button)) ||
- !GTK_WIDGET_VISIBLE(button)))
-#endif
- continue;
-
- // FIXME: This is a bit hacky - needs to be rethought
- for (j = 0; button_widgets[i].accelerator_keys[j] != 0; j++) {
- if (button_widgets[i].accelerator_keys[j] == event->keyval &&
- (button_widgets[i].accelerator_mods[j] & ~GDK_SHIFT_MASK) == state) {
-
- // If we use shift for this shortcut then check it was in the original mask
- if ((button_widgets[i].accelerator_mods[j] & GDK_SHIFT_MASK) &&
- !(event->state & GDK_SHIFT_MASK))
- continue;
-
- // Hack if this is a multi-function button
- if (GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button), "calc_function")) !=
- button_widgets[i].function)
- do_button(button_widgets[i].function, 0);
- else
- button_cb(button, NULL);
- return TRUE;
- }
+ /* Clear display */
+ if ((event->keyval == GDK_Escape && state == 0) ||
+ (event->keyval == GDK_BackSpace && state == GDK_CONTROL_MASK) ||
+ (event->keyval == GDK_Delete && state == GDK_SHIFT_MASK)) {
+ do_button(FN_CLEAR, 0);
+ return TRUE;
+ }
+
+ /* Solve */
+ if ((event->keyval == GDK_Return && state == 0) ||
+ (event->keyval == GDK_KP_Enter && state == 0)) {
+ do_button(FN_CALCULATE, 0);
+ return TRUE;
+ }
+
+ if (state != 0)
+ return FALSE;
+
+ // FIXME: event->string deprecated
+
+ for (i = 0; conversions[i]; i++) {
+ if (strcmp(event->string, conversions[i]) == 0) {
+ do_text(conversion_values[i]);
+ return TRUE;
}
}
+ if (strcmp(event->string, ".") == 0) {
+ do_text(v->radix);
+ return TRUE;
+ }
+
+ /* Some keyboards use this keyval for '^' (e.g. German) */
+ if (event->keyval == GDK_dead_circumflex) {
+ do_text("^");
+ return TRUE;
+ }
- return FALSE;
-}
-
-
-G_MODULE_EXPORT
-gboolean
-main_window_key_release_cb(GtkWidget *widget, GdkEventKey *event)
-{
- if (event->keyval == GDK_Shift_L || event->keyval == GDK_Shift_R) {
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(X.inverse_toggle),
- FALSE);
+ switch(*event->string)
+ {
+ case '<':
+ button_cb(GET_WIDGET("calc_shift_left_button"), NULL);
+ return TRUE;
+ case '>':
+ button_cb(GET_WIDGET("calc_shift_right_button"), NULL);
+ return TRUE;
+ case '=':
+ case '\n':
+ do_button(FN_CALCULATE, 0);
+ return TRUE;
+ }
+
+ if (event->string[0] != '\0') {
+ do_text(event->string);
return TRUE;
}
+
return FALSE;
}
-G_MODULE_EXPORT
-void
+G_MODULE_EXPORT void
edit_cb(GtkWidget *widget)
{
gboolean can_paste, can_copy;
@@ -2318,7 +1144,7 @@ on_paste(GtkClipboard *clipboard, const gchar *text, gpointer data)
G_MODULE_EXPORT
gboolean
-mouse_button_cb(GtkWidget *widget, GdkEventButton *event)
+middle_click_paste_cb(GtkWidget *widget, GdkEventButton *event)
{
if (event->button == 2)
gtk_clipboard_request_text(gtk_clipboard_get(X.primary_atom),
@@ -2364,12 +1190,13 @@ redo_cb(GtkWidget *widget)
static void
for_each_menu(GtkWidget *widget, gpointer data)
{
- /* Find the "Paste" entry and activate it (see bug #317786). */
- if (strcmp(G_OBJECT_TYPE_NAME(widget), "GtkImageMenuItem") == 0) {
+ /* Find the "Paste" entry and activate it (see bug #317786).
+ * It is disabled because the GtkEntry is not marked as editable.
+ */
+ if (strcmp(G_OBJECT_TYPE_NAME(widget), "GtkImageMenuItem") == 0) {
GtkWidget *label = gtk_bin_get_child(GTK_BIN(widget));
- // FIXME: WTF?
- if (strcmp(gtk_label_get_text(GTK_LABEL(label)), _("Paste")) == 0) {
+ if (strcmp(gtk_label_get_text(GTK_LABEL(label)), _("Paste")) == 0) {
if (gtk_clipboard_wait_is_text_available(
gtk_clipboard_get(X.clipboard_atom))) {
gtk_widget_set_sensitive(GTK_WIDGET(widget), TRUE);
@@ -2393,11 +1220,7 @@ G_MODULE_EXPORT
void
insert_ascii_cb(GtkWidget *widget)
{
-#if GTK_CHECK_VERSION (2,17,5)
- if (!gtk_widget_get_visible (X.ascii_dialog))
-#else
- if (!GTK_WIDGET_VISIBLE(X.ascii_dialog))
-#endif
+ if (!gtk_widget_get_visible(X.ascii_dialog))
position_popup(X.main_window, X.ascii_dialog, POPUP_LEFT);
gtk_widget_grab_focus(GTK_WIDGET(X.ascii_entry));
gtk_widget_show(X.ascii_dialog);
@@ -2416,16 +1239,6 @@ shift_cb(GtkWidget *widget)
G_MODULE_EXPORT
void
-show_registers_cb(GtkWidget *widget)
-{
- gboolean visible;
- visible = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
- ui_set_registers_visible(visible);
-}
-
-
-G_MODULE_EXPORT
-void
mode_radio_cb(GtkWidget *menu)
{
int mode; /* The new mode. */
@@ -2440,138 +1253,34 @@ mode_radio_cb(GtkWidget *menu)
G_MODULE_EXPORT
void
-accuracy_radio_cb(GtkWidget *widget)
-{
- int count;
- count = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "accuracy"));
- if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)))
- do_button(FN_SET_ACCURACY, count);
-}
-
-
-G_MODULE_EXPORT
-void
-accuracy_other_cb(GtkWidget *widget)
-{
-#if GTK_CHECK_VERSION (2,17,5)
- if (!gtk_widget_get_visible (X.precision_dialog))
-#else
- if (!GTK_WIDGET_VISIBLE(X.precision_dialog))
-#endif
- position_popup(X.main_window, X.precision_dialog, POPUP_LEFT);
- gtk_widget_grab_focus(GTK_WIDGET(X.precision_spin));
- gtk_widget_show(X.precision_dialog);
-}
-
-
-G_MODULE_EXPORT
-void
-accuracy_default_cb(GtkWidget *widget)
-{
- do_button(FN_SET_ACCURACY, DEFAULT_ACCURACY);
-}
-
-
-G_MODULE_EXPORT
-void
-show_trailing_zeroes_cb(GtkWidget *widget)
-{
- gboolean visible;
- visible = gtk_check_menu_item_get_active(
- GTK_CHECK_MENU_ITEM(widget));
- ui_set_show_trailing_zeroes(visible);
-}
-
-
-G_MODULE_EXPORT
-void
quit_cb(GtkWidget *widget)
{
- save_win_position();
gtk_main_quit();
}
G_MODULE_EXPORT
void
-precision_dialog_response_cb(GtkWidget *dialog, gint response_id)
-{
- int val;
- if (response_id == GTK_RESPONSE_OK) {
- val = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(X.precision_spin));
- do_button(FN_SET_ACCURACY, val);
- }
-
- gtk_widget_hide(dialog);
-}
-
-
-G_MODULE_EXPORT
-gboolean
-precision_dialog_delete_cb(GtkWidget *dialog)
-{
- precision_dialog_response_cb(dialog, GTK_RESPONSE_CANCEL);
- return TRUE;
-}
-
-
-G_MODULE_EXPORT
-void
-precision_dialog_activate_cb(GtkWidget *spin)
-{
- precision_dialog_response_cb(X.precision_dialog, GTK_RESPONSE_OK);
-}
-
-
-G_MODULE_EXPORT
-void
-show_thousands_separator_cb(GtkWidget *widget)
+show_preferences_cb(GtkMenuItem *menu)
{
- gboolean visible;
-
- visible = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
- ui_set_show_thousands_separator(visible);
+ gtk_window_present(GTK_WINDOW(X.preferences_dialog));
}
G_MODULE_EXPORT
void
-edit_constants_cb(GtkMenuItem *item)
+preferences_response_cb(GtkWidget *widget, gint id)
{
- gtk_widget_show(X.constants_dialog);
+ gtk_widget_hide(X.preferences_dialog);
}
G_MODULE_EXPORT
-void
-edit_functions_cb(GtkMenuItem *item)
-{
- gtk_widget_show(X.function_dialog);
-}
-
-
-static void
-set_win_position()
+gboolean
+preferences_dialog_delete_cb(GtkWidget *widget)
{
- int intval, screen_height, screen_width;
- int x = 0, y = 0;
-
- screen_width = gdk_screen_get_width(gdk_screen_get_default());
- screen_height = gdk_screen_get_height(gdk_screen_get_default());
-
- if (get_int_resource(R_XPOS, &intval)) {
- x = intval;
- if (x < 0 || x > screen_width)
- x = 0;
- }
-
- if (get_int_resource(R_YPOS, &intval)) {
- y = intval;
- if (y < 0 || y > screen_height)
- y = 0;
- }
-
- gtk_window_move(GTK_WINDOW(X.main_window), x, y);
+ preferences_response_cb(widget, 0);
+ return TRUE;
}
@@ -2582,9 +1291,7 @@ create_main_window()
char name[MAXLINE];
GtkWidget *widget;
PangoFontDescription *font_desc;
- GtkSizeGroup *size_group;
- GtkAccelGroup *accel_group;
- GtkWidget *treeview;
+ GtkCellRenderer *renderer;
X.ui = gtk_builder_new();
load_ui(X.ui, UI_FILE);
@@ -2595,11 +1302,6 @@ create_main_window()
X.main_window = GET_WIDGET("calc_window");
X.ascii_dialog = GET_WIDGET("ascii_dialog");
X.ascii_entry = GET_WIDGET("ascii_entry");
- X.precision_dialog = GET_WIDGET("precision_dialog");
- X.precision_spin = GET_WIDGET("precision_dialog_spin");
- X.register_dialog = GET_WIDGET("register_dialog");
- X.constants_dialog = GET_WIDGET("edit_constants_dialog");
- X.function_dialog = GET_WIDGET("edit_functions_dialog");
X.menubar = GET_WIDGET("menubar");
X.scrolledwindow = GET_WIDGET("display_scroll"),
X.display_item = GET_WIDGET("displayitem"),
@@ -2609,72 +1311,42 @@ create_main_window()
X.adv_panel = GET_WIDGET("advanced_panel");
X.fin_panel = GET_WIDGET("financial_panel");
X.bit_panel = GET_WIDGET("bit_panel");
- X.clear_buttons[0] = GET_WIDGET("calc_clear_simple_button");
- X.clear_buttons[1] = GET_WIDGET("calc_clear_advanced_button");
- X.sci_mode_panel = GET_WIDGET("scientific_mode_panel");
- X.prog_mode_panel = GET_WIDGET("programming_mode_panel");
- X.degree_radio = GET_WIDGET("degrees_radio");
- X.gradian_radio = GET_WIDGET("gradians_radio");
- X.radian_radio = GET_WIDGET("radians_radio");
- X.binary_radio = GET_WIDGET("binary_radio");
- X.octal_radio = GET_WIDGET("octal_radio");
- X.decimal_radio = GET_WIDGET("decimal_radio");
- X.hexadecimal_radio = GET_WIDGET("hexadecimal_radio");
- X.display_mode_radios[0] = GET_WIDGET("engineering_radio");
- X.display_mode_radios[1] = GET_WIDGET("fixed_point_radio");
- X.display_mode_radios[2] = GET_WIDGET("scientific_radio");
- X.word_length_radios[0] = GET_WIDGET("64bit_radio");
- X.word_length_radios[1] = GET_WIDGET("32bit_radio");
- X.word_length_radios[2] = GET_WIDGET("16bit_radio");
- X.inverse_toggle = GET_WIDGET("inverse_check");
- X.hyperbolic_toggle = GET_WIDGET("hyperbolic_check");
- X.statusbar = GET_WIDGET("statusbar");
- for (i = 0; i < 16; i++) {
- SNPRINTF(name, MAXLINE, "calc_%x_button", i);
- X.digit_buttons[i] = GET_WIDGET(name);
- }
- for (i = 0; i < MAX_REGISTERS; i++) {
- SNPRINTF(name, MAXLINE, "register_entry_%d", i);
- X.register_entries[i] = GET_WIDGET(name);
+ X.superscript_toggle = GET_WIDGET("superscript_togglebutton");
+ X.subscript_toggle = GET_WIDGET("subscript_togglebutton");
+ X.preferences_dialog = GET_WIDGET("preferences_dialog");
+ X.info_buffer = GTK_TEXT_BUFFER(GET_OBJECT("info_buffer"));
+
+ /* Connect text to buttons */
+ for (i = 0; button_data[i].widget_name != NULL; i++) {
+ SNPRINTF(name, MAXLINE, "calc_%s_button", button_data[i].widget_name);
+ set_string_data(X.ui, name, "calc_text", button_data[i].data);
}
- /* Load buttons and set them all to be the same size */
- size_group = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
- for (i = 0; i < NBUTTONS; i++) {
- SNPRINTF(name, MAXLINE, "calc_%s_button",
- button_widgets[i].widget_name);
- X.buttons[i] = GET_WIDGET(name);
- assert(X.buttons[i] != NULL);
-
- gtk_size_group_add_widget(size_group, X.buttons[i]);
-
- g_object_set_data(G_OBJECT(X.buttons[i]), "calc_function", GINT_TO_POINTER(button_widgets[i].function));
+ /* Localize buttons */
+ for (i = 0; i < 16; i++) {
+ SNPRINTF(name, MAXLINE, "calc_%d_button", i);
+ gtk_button_set_label(GTK_BUTTON(GET_OBJECT(name)), v->digits[i]);
+ set_string_data(X.ui, name, "calc_text", v->digits[i]);
}
+ gtk_button_set_label(GTK_BUTTON(GET_OBJECT("calc_numeric_point_button")), v->radix);
- /* Make popup buttons */
- set_data(X.ui, "calc_accuracy_button", "calc_menu", GET_WIDGET("accuracy_popup"));
- set_data(X.ui, "calc_shift_left_button", "calc_menu", GET_WIDGET("left_shift_popup"));
- set_data(X.ui, "calc_shift_right_button", "calc_menu", GET_WIDGET("right_shift_popup"));
-
- set_data(X.ui, "calc_constants_button", "calc_menu", GET_WIDGET("constants_popup"));
- for (i = 0; i < MAX_CONSTANTS; i++) {
- SNPRINTF(name, MAXLINE, "constant_menu_item%d", i);
- widget = GET_WIDGET(name);
- g_object_set_data(G_OBJECT(widget), "constant_id", GINT_TO_POINTER(i));
- X.constant_menu_labels[i] = gtk_bin_get_child(GTK_BIN(widget));
- }
+ /* Connect super and subscript */
+ for (i = 0; i < 10; i++) {
+ static const char *subscript_digits[] = {"â??", "â??", "â??", "â??", "â??", "â??", "â??", "â??", "â??", "â??"};
+ static const char *superscript_digits[] = {"�", "¹", "²", "³", "�", "�", "�", "�", "�", "�"};
- set_data(X.ui, "calc_functions_button", "calc_menu", GET_WIDGET("functions_popup"));
- for (i = 0; i < MAX_FUNCTIONS; i++) {
- SNPRINTF(name, MAXLINE, "function_menu_item%d", i);
- widget = GET_WIDGET(name);
- g_object_set_data(G_OBJECT(widget), "function_id", GINT_TO_POINTER(i));
- X.function_menu_labels[i] = gtk_bin_get_child(GTK_BIN(widget));
+ SNPRINTF(name, MAXLINE, "calc_%d_button", i);
+ set_string_data(X.ui, name, "calc_subscript_text", subscript_digits[i]);
+ set_string_data(X.ui, name, "calc_superscript_text", superscript_digits[i]);
}
+ /* Connect menus to popup buttons */
+ set_data(X.ui, "calc_shift_left_button", "calc_menu", GET_WIDGET("left_shift_popup"));
+ set_data(X.ui, "calc_shift_right_button", "calc_menu", GET_WIDGET("right_shift_popup"));
set_data(X.ui, "calc_store_button", "calc_menu", GET_WIDGET("memory_store_popup"));
set_data(X.ui, "calc_recall_button", "calc_menu", GET_WIDGET("memory_recall_popup"));
- set_data(X.ui, "calc_exchange_button", "calc_menu", GET_WIDGET("memory_exchange_popup"));
+
+ /* Get labels from popup menus */
for (i = 0; i < MAX_REGISTERS; i++) {
SNPRINTF(name, MAXLINE, "store_menu_item%d", i);
widget = GET_WIDGET(name);
@@ -2684,12 +1356,7 @@ create_main_window()
SNPRINTF(name, MAXLINE, "recall_menu_item%d", i);
widget = GET_WIDGET(name);
g_object_set_data(G_OBJECT(widget), "register_id", GINT_TO_POINTER(i));
- X.memory_recall_labels[i] = gtk_bin_get_child(GTK_BIN(widget));
-
- SNPRINTF(name, MAXLINE, "exchange_menu_item%d", i);
- widget = GET_WIDGET(name);
- g_object_set_data(G_OBJECT(widget), "register_id", GINT_TO_POINTER(i));
- X.memory_exchange_labels[i] = gtk_bin_get_child(GTK_BIN(widget));
+ X.memory_recall_labels[i] = gtk_bin_get_child(GTK_BIN(widget));
}
/* Load bit panel */
@@ -2699,69 +1366,9 @@ create_main_window()
SNPRINTF(name, MAXLINE, "bit_eventbox_%d", i);
set_int_data(X.ui, name, "bit_index", i);
}
-
- /* Make menu tooltips displayed in the status bar */
- set_menubar_tooltip("quit_menu");
- set_menubar_tooltip("copy_menu");
- set_menubar_tooltip("paste_menu");
- set_menubar_tooltip("insert_ascii_menu");
- set_menubar_tooltip("undo_menu");
- set_menubar_tooltip("redo_menu");
- set_menubar_tooltip("view_basic_menu");
- set_menubar_tooltip("view_advanced_menu");
- set_menubar_tooltip("view_financial_menu");
- set_menubar_tooltip("view_scientific_menu");
- set_menubar_tooltip("show_trailing_zeroes_menu");
- set_menubar_tooltip("show_thousands_separator_menu");
- set_menubar_tooltip("show_registers_menu");
- set_menubar_tooltip("help_menu");
- set_menubar_tooltip("about_menu");
/* Make dialogs transient of the main window */
gtk_window_set_transient_for(GTK_WINDOW(X.ascii_dialog), GTK_WINDOW(X.main_window));
- gtk_window_set_transient_for(GTK_WINDOW(X.precision_dialog), GTK_WINDOW(X.main_window));
- gtk_window_set_transient_for(GTK_WINDOW(X.register_dialog), GTK_WINDOW(X.main_window));
- gtk_window_set_transient_for(GTK_WINDOW(X.constants_dialog),
- GTK_WINDOW(X.main_window));
-
- /* Can't set max length for spin buttons in Glade 2 */
- gtk_entry_set_max_length(GTK_ENTRY(X.precision_spin), 2);
-
- gtk_dialog_set_default_response(GTK_DIALOG(X.constants_dialog),
- GTK_RESPONSE_ACCEPT);
-
- /* Make constant tree model */
- X.constants_model = create_constants_model();
- treeview = GET_WIDGET("edit_constants_treeview");
- gtk_tree_view_set_model(GTK_TREE_VIEW(treeview), X.constants_model);
- gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)),
- GTK_SELECTION_SINGLE);
- /* Translators: Edit Constants Dialog: Constant number column title */
- add_cf_column(GTK_TREE_VIEW(treeview), _("No."), COLUMN_NUMBER, FALSE);
- /* Translators: Edit Constants Dialog: Constant value column title */
- add_cf_column(GTK_TREE_VIEW(treeview), _("Value"), COLUMN_VALUE, TRUE);
- /* Translators: Edit Constants Dialog: Constant description column title */
- add_cf_column(GTK_TREE_VIEW(treeview), _("Description"), COLUMN_DESCRIPTION, TRUE);
-
- /* Make function tree model */
- X.functions_model = create_functions_model();
- treeview = GET_WIDGET("edit_functions_treeview");
- gtk_dialog_set_default_response(GTK_DIALOG(X.function_dialog),
- GTK_RESPONSE_ACCEPT);
- gtk_window_set_transient_for(GTK_WINDOW(X.function_dialog),
- GTK_WINDOW(X.main_window));
- gtk_tree_view_set_model(GTK_TREE_VIEW(treeview), X.functions_model);
- gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)),
- GTK_SELECTION_SINGLE);
- /* Translators: Edit Functions Dialog: Function number column title */
- add_cf_column(GTK_TREE_VIEW(treeview), _("No."),
- COLUMN_NUMBER, FALSE);
- /* Translators: Edit Functions Dialog: Function value column title */
- add_cf_column(GTK_TREE_VIEW(treeview), _("Value"),
- COLUMN_VALUE, TRUE);
- /* Translators: Edit Functions Dialog: Function description column title */
- add_cf_column(GTK_TREE_VIEW(treeview), _("Description"),
- COLUMN_DESCRIPTION, TRUE);
X.display_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(X.display_item));
gtk_widget_ensure_style(X.display_item);
@@ -2774,23 +1381,6 @@ create_main_window()
ATK_ROLE_EDITBAR);
gtk_widget_realize(X.main_window);
- set_win_position();
-
- g_object_set_data(G_OBJECT(X.radian_radio), "trig_mode", GINT_TO_POINTER(MP_RADIANS));
- g_object_set_data(G_OBJECT(X.degree_radio), "trig_mode", GINT_TO_POINTER(MP_DEGREES));
- g_object_set_data(G_OBJECT(X.gradian_radio), "trig_mode", GINT_TO_POINTER(MP_GRADIANS));
- g_object_set_data(G_OBJECT(X.binary_radio), "base_mode", GINT_TO_POINTER(2));
- g_object_set_data(G_OBJECT(X.octal_radio), "base_mode", GINT_TO_POINTER(8));
- g_object_set_data(G_OBJECT(X.decimal_radio), "base_mode", GINT_TO_POINTER(10));
- g_object_set_data(G_OBJECT(X.hexadecimal_radio), "base_mode", GINT_TO_POINTER(16));
- g_object_set_data(G_OBJECT(X.display_mode_radios[0]), "numeric_mode", GINT_TO_POINTER(ENG));
- g_object_set_data(G_OBJECT(X.display_mode_radios[1]), "numeric_mode", GINT_TO_POINTER(FIX));
- g_object_set_data(G_OBJECT(X.display_mode_radios[2]), "numeric_mode", GINT_TO_POINTER(SCI));
- g_object_set_data(G_OBJECT(X.word_length_radios[0]), "wordlen_mode", GINT_TO_POINTER(64));
- g_object_set_data(G_OBJECT(X.word_length_radios[1]), "wordlen_mode", GINT_TO_POINTER(32));
- g_object_set_data(G_OBJECT(X.word_length_radios[2]), "wordlen_mode", GINT_TO_POINTER(16));
-
- X.status_image = GET_WIDGET("status_image");
/* Set modes for menu items */
for (i = 1; i < 16; i++) {
@@ -2805,17 +1395,6 @@ create_main_window()
set_int_data(X.ui, "view_scientific_menu", "calcmode", SCIENTIFIC);
set_int_data(X.ui, "view_programming_menu", "calcmode", PROGRAMMING);
- /* Make shortcuts for accuracy menus */
- accel_group = gtk_accel_group_new();
- gtk_window_add_accel_group(GTK_WINDOW(X.main_window), accel_group);
- for (i = 0; i < 10; i++) {
- SNPRINTF(name, MAXLINE, "acc_item%d", i);
- set_int_data(X.ui, name, "accuracy", i);
- }
-
- /* Localize label for numeric point */
- gtk_button_set_label(GTK_BUTTON(GET_OBJECT("calc_numeric_point_button")), v->radix);
-
/* Setup financial functions */
set_data(X.ui, "calc_finc_compounding_term_button", "finc_dialog", "ctrm_dialog");
set_data(X.ui, "calc_finc_double_declining_depreciation_button", "finc_dialog", "ddb_dialog");
@@ -2827,6 +1406,25 @@ create_main_window()
set_data(X.ui, "calc_finc_straight_line_depreciation_button", "finc_dialog", "sln_dialog");
set_data(X.ui, "calc_finc_sum_of_the_years_digits_depreciation_button", "finc_dialog", "syd_dialog");
set_data(X.ui, "calc_finc_term_button", "finc_dialog", "term_dialog");
+
+ /* Configuration dialog */
+
+ widget = GET_WIDGET("angle_unit_combobox");
+ 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);
+
+ widget = GET_WIDGET("display_format_combobox");
+ 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);
+
+ widget = GET_WIDGET("word_size_combobox");
+ 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
}
@@ -2855,49 +1453,325 @@ ui_init(int *argc, char ***argv)
}
+G_MODULE_EXPORT
void
-ui_load(void)
+angle_unit_combobox_changed_cb(GtkWidget *combo)
{
- int boolval;
- char text[MAXLINE];
- GtkWidget *widget;
+ 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);
+}
+
+
+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);
+}
+
+
+G_MODULE_EXPORT
+void
+word_size_combobox_changed_cb(GtkWidget *combo)
+{
+ gint value;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ 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);
+}
+
+
+G_MODULE_EXPORT
+void
+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);
+}
+
+
+G_MODULE_EXPORT
+void
+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);
+}
+
+
+G_MODULE_EXPORT
+void
+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);
+}
+
+
+static void
+set_combo_box_from_config(const gchar *name, const gchar *key_name, GType key_type)
+{
+ GtkWidget *combo;
+ GtkTreeModel *model;
+ gchar *str_key_value = NULL;
+ int int_key_value;
+ GtkTreeIter iter;
+ gboolean valid;
+
+ combo = GET_WIDGET(name);
+ model = gtk_combo_box_get_model(GTK_COMBO_BOX(combo));
+ valid = gtk_tree_model_get_iter_first(model, &iter);
+
+ switch (key_type)
+ {
+ case G_TYPE_STRING:
+ str_key_value = get_resource(key_name);
+ if (!str_key_value)
+ valid = FALSE;
+ break;
+ case G_TYPE_INT:
+ if (!get_int_resource(key_name, &int_key_value))
+ valid = FALSE;
+ break;
+ default:
+ break;
+ }
+
+ while (valid) {
+ gchar *str_value;
+ gint int_value;
+ gboolean matched = FALSE;
+
+ switch (key_type)
+ {
+ case G_TYPE_STRING:
+ gtk_tree_model_get(model, &iter, 1, &str_value, -1);
+ matched = strcmp(str_value, str_key_value) == 0;
+ break;
+ case G_TYPE_INT:
+ gtk_tree_model_get(model, &iter, 1, &int_value, -1);
+ matched = int_value == int_key_value;
+ break;
+ default:
+ break;
+ }
+
+ if (matched)
+ break;
+
+ valid = gtk_tree_model_iter_next(model, &iter);
+ }
+ if (!valid)
+ valid = gtk_tree_model_get_iter_first(model, &iter);
+
+ gtk_combo_box_set_active_iter(GTK_COMBO_BOX(combo), &iter);
+
+ g_free(str_key_value);
+}
+
+
+void
+ui_load(void)
+{
+ int value;
+
/* Create main gcalctool window. */
create_main_window();
+ ui_set_undo_enabled(FALSE, FALSE);
- /* Load configuration */
- ui_set_show_thousands_separator(v->display.show_tsep);
- ui_set_show_trailing_zeroes(v->display.show_zeroes);
+ set_combo_box_from_config("angle_unit_combobox", R_TRIG, G_TYPE_STRING);
+ set_combo_box_from_config("display_format_combobox", R_DISPLAY, G_TYPE_STRING);
+ set_combo_box_from_config("word_size_combobox", R_WORDLEN, G_TYPE_INT);
- ui_set_mode(X.mode);
- ui_set_numeric_mode(v->display.format);
- ui_set_base(v->base);
- ui_set_wordlen(v->wordlen);
- ui_set_accuracy(v->accuracy);
- ui_set_undo_enabled(FALSE, FALSE);
- ui_update_modifier_mode();
+ if (!get_int_resource(R_ACCURACY, &value))
+ value = 9;
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(GET_OBJECT("decimal_places_spin")), value);
- /* Show the memory register window? */
- ui_make_registers();
- if (get_boolean_resource(R_REGS, &boolval))
- ui_set_registers_visible(boolval);
+ if (!get_boolean_resource(R_TSEP, &value))
+ value = FALSE;
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(GET_OBJECT("thousands_separator_check")), value);
+
+ if (!get_boolean_resource(R_ZEROES, &value))
+ value = FALSE;
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(GET_OBJECT("trailing_zeroes_check")), value);
+}
+
- /* Set default accuracy menu item */
- /* Translators: Accuracy Popup: Menu item to reset the accuracy to the default value. %d is replaced with the default value. */
- SNPRINTF(text, MAXLINE, _("Reset to _Default (%d)"), DEFAULT_ACCURACY);
- widget = gtk_bin_get_child(GTK_BIN(GET_OBJECT("acc_item_default")));
- gtk_label_set_markup_with_mnemonic(GTK_LABEL(widget), text);
+static void
+add_buttons_to_size_group()
+{
+ int i;
+ GtkSizeGroup *size_group;
+
+ const char *button_names[] = {
+ "calc_finc_straight_line_depreciation_button",
+ "calc_finc_periodic_interest_rate_button",
+ "calc_finc_present_value_button",
+ "calc_finc_periodic_payment_button",
+ "calc_finc_future_value_button",
+ "calc_finc_gross_profit_margin_button",
+ "calc_finc_double_declining_depreciation_button",
+ "calc_finc_compounding_term_button",
+ "calc_finc_sum_of_the_years_digits_depreciation_button",
+ "calc_finc_term_button",
+ "calc_store_button",
+ "calc_recall_button",
+ "calc_pi_button",
+ "calc_modulus_divide_button",
+ "calc_root_button",
+ "calc_x_pow_y_button",
+ "calc_logarithm_button",
+ "calc_inverse_button",
+ "calc_natural_logarithm_button",
+ "calc_eulers_number_button",
+ "calc_abs_button",
+ "calc_factorial_button",
+ "calc_integer_portion_button",
+ "calc_exponential_button",
+ "calc_fractional_portion_button",
+ "calc_imaginary_button",
+ "subscript_togglebutton",
+ "superscript_togglebutton",
+ "calc_ans_button",
+ "calc_4_button",
+ "calc_7_button",
+ "calc_8_button",
+ "calc_9_button",
+ "calc_5_button",
+ "calc_6_button",
+ "calc_divide_button",
+ "calc_1_button",
+ "calc_2_button",
+ "calc_0_button",
+ "calc_numeric_point_button",
+ "calc_result_button",
+ "calc_3_button",
+ "calc_multiply_button",
+ "calc_subtract_button",
+ "calc_add_button",
+ "calc_clear_button",
+ "calc_start_group_button",
+ "calc_end_group_button",
+ "calc_percentage_button",
+ "calc_10_button",
+ "calc_11_button",
+ "calc_12_button",
+ "calc_13_button",
+ "calc_14_button",
+ "calc_15_button",
+ "calc_and_button",
+ "calc_or_button",
+ "calc_not_button",
+ "calc_xor_button",
+ "calc_ones_complement_button",
+ "calc_twos_complement_button",
+ "calc_shift_right_button",
+ "calc_shift_left_button",
+ "calc_trunc_button",
+ "calc_random_button",
+ "calc_base_2_button",
+ "calc_base_8_button",
+ "calc_base_16_button",
+ "calc_si_kilo_button",
+ "calc_si_milli_button",
+ "calc_si_micro_button",
+ "calc_si_mega_button",
+ "calc_si_giga_button",
+ "calc_si_peta_button",
+ "calc_si_femto_button",
+ "calc_si_pico_button",
+ "calc_si_nano_button",
+ "calc_tangent_button",
+ "calc_sine_button",
+ "calc_cosine_button",
+ "calc_hyperbolic_cosine_button",
+ "calc_hyperbolic_sine_button",
+ "calc_hyperbolic_tangent_button",
+ "calc_character_button",
+ NULL};
+
+ size_group = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
+ for (i = 0; button_names[i] != NULL; i++)
+ gtk_size_group_add_widget(size_group, GET_WIDGET(button_names[i]));
}
+
void
ui_start(void)
-{
- ui_set_base(v->base);
- ui_set_wordlen(v->wordlen);
- ui_set_trigonometric_mode(v->ttype);
- ui_set_numeric_mode(v->display.format);
-
+{
+ ui_set_mode(X.mode);
+
gtk_widget_show(X.main_window);
+ /* Add buttons to size group so they are all the same size.
+ *
+ * This is supported in GtkBuilder but it does not appear to work, setting
+ * the group after showing the widgets works. It would have been preferrable
+ * to make the table homogeneous but this does not ignore hidden rows.
+ */
+ add_buttons_to_size_group();
+
gtk_main();
}
diff --git a/src/mp-binary.c b/src/mp-binary.c
index 90663fb..3c382b3 100644
--- a/src/mp-binary.c
+++ b/src/mp-binary.c
@@ -1,3 +1,5 @@
+#include <stdio.h>
+
#include "mp.h"
#include "mp-internal.h"
@@ -21,13 +23,13 @@ static int hex_to_int(char digit)
static void
mp_bitwise(const MPNumber *x, const MPNumber *y, int (*bitwise_operator)(int, int), MPNumber *z, int wordlen)
{
- char text1[MAX_DIGITS], text2[MAX_DIGITS], text_out[MAX_DIGITS];
+ char text1[MAX_DIGITS], text2[MAX_DIGITS], text_out[MAX_DIGITS], text_out2[MAX_DIGITS];
int offset1, offset2, offset_out;
mp_cast_to_string(x, 16, 0, 0, text1, MAX_DIGITS);
mp_cast_to_string(y, 16, 0, 0, text2, MAX_DIGITS);
- offset1 = strlen(text1) - 1;
- offset2 = strlen(text2) - 1;
+ offset1 = strlen(text1) - 1 - strlen("â??â??");
+ offset2 = strlen(text2) - 1 - strlen("â??â??");
offset_out = wordlen / 4 - 1;
if (offset_out <= 0) {
offset_out = offset1 > offset2 ? offset1 : offset2;
@@ -52,14 +54,14 @@ mp_bitwise(const MPNumber *x, const MPNumber *y, int (*bitwise_operator)(int, in
text_out[offset_out] = digits[bitwise_operator(v1, v2)];
}
- mp_set_from_string(text_out, 16, z);
+ snprintf(text_out2, MAX_DIGITS, "%sâ??â??", text_out);
+ mp_set_from_string(text_out2, z);
}
static int mp_bitwise_and(int v1, int v2) { return v1 & v2; }
static int mp_bitwise_or(int v1, int v2) { return v1 | v2; }
static int mp_bitwise_xor(int v1, int v2) { return v1 ^ v2; }
-static int mp_bitwise_xnor(int v1, int v2) { return v1 ^ v2 ^ 0xF; }
static int mp_bitwise_not(int v1, int dummy) { return v1 ^ 0xF; }
@@ -76,6 +78,12 @@ mp_is_overflow (const MPNumber *x, int wordlen)
void
mp_and(const MPNumber *x, const MPNumber *y, MPNumber *z)
{
+ if (!mp_is_natural(x) || !mp_is_natural(y))
+ {
+ /* Translators: Error displayed when boolean AND attempted on non-integer values */
+ mperr(_("Boolean AND only defined for natural numbers"));
+ }
+
mp_bitwise(x, y, mp_bitwise_and, z, 0);
}
@@ -83,6 +91,12 @@ mp_and(const MPNumber *x, const MPNumber *y, MPNumber *z)
void
mp_or(const MPNumber *x, const MPNumber *y, MPNumber *z)
{
+ if (!mp_is_natural(x) || !mp_is_natural(y))
+ {
+ /* Translators: Error displayed when boolean OR attempted on non-integer values */
+ mperr(_("Boolean OR only defined for natural numbers"));
+ }
+
mp_bitwise(x, y, mp_bitwise_or, z, 0);
}
@@ -90,14 +104,13 @@ mp_or(const MPNumber *x, const MPNumber *y, MPNumber *z)
void
mp_xor(const MPNumber *x, const MPNumber *y, MPNumber *z)
{
- mp_bitwise(x, y, mp_bitwise_xor, z, 0);
-}
-
+ if (!mp_is_natural(x) || !mp_is_natural(y))
+ {
+ /* Translators: Error displayed when boolean XOR attempted on non-integer values */
+ mperr(_("Boolean XOR only defined for natural numbers"));
+ }
-void
-mp_xnor(const MPNumber *x, const MPNumber *y, int wordlen, MPNumber *z)
-{
- mp_bitwise(x, y, mp_bitwise_xnor, z, wordlen);
+ mp_bitwise(x, y, mp_bitwise_xor, z, 0);
}
@@ -105,6 +118,13 @@ void
mp_not(const MPNumber *x, int wordlen, MPNumber *z)
{
MPNumber temp;
+
+ if (!mp_is_natural(x))
+ {
+ /* Translators: Error displayed when boolean XOR attempted on non-integer values */
+ mperr(_("Boolean NOT only defined for natural numbers"));
+ }
+
mp_set_from_integer(0, &temp);
mp_bitwise(x, &temp, mp_bitwise_not, z, wordlen);
}
@@ -118,10 +138,10 @@ mp_mask(const MPNumber *x, int wordlen, MPNumber *z)
/* Convert to a hexadecimal string and use last characters */
mp_cast_to_string(x, 16, 0, 0, text, MAX_DIGITS);
- len = strlen(text);
+ len = strlen(text) - strlen("â??â??");
offset = wordlen / 4;
offset = len > offset ? len - offset: 0;
- mp_set_from_string(text + offset, 16, z);
+ mp_set_from_string(text + offset, z);
}
@@ -130,6 +150,12 @@ mp_shift(const MPNumber *x, int count, MPNumber *z)
{
int i, multiplier = 1;
+ if (!mp_is_integer(x)) {
+ /* Translators: Error displayed when bit shift attempted on non-integer values */
+ mperr(_("Shift only possible on integer values"));
+ return;
+ }
+
if (count >= 0) {
for (i = 0; i < count; i++)
multiplier *= 2;
@@ -150,7 +176,8 @@ mp_ones_complement(const MPNumber *x, int wordlen, MPNumber *z)
{
MPNumber t;
mp_set_from_integer(0, &t);
- mp_bitwise(x, &t, mp_bitwise_xnor, z, wordlen);
+ mp_bitwise(x, &t, mp_bitwise_xor, z, wordlen);
+ mp_not(z, wordlen, z);
}
diff --git a/src/mp-convert.c b/src/mp-convert.c
index f0ae9da..a79af5f 100644
--- a/src/mp-convert.c
+++ b/src/mp-convert.c
@@ -504,6 +504,22 @@ mp_cast_to_string(const MPNumber *x, int base, int accuracy, int trim_zeroes, ch
/* Remove negative sign if the number was rounded down to zero */
if (mp_is_negative(x) && strcmp(string->str, "0") != 0)
g_string_prepend(string, "â??");
+
+ switch(base)
+ {
+ case 2:
+ g_string_append(string, "â??");
+ break;
+ case 8:
+ g_string_append(string, "â??");
+ break;
+ default:
+ case 10:
+ break;
+ case 16:
+ g_string_append(string, "â??â??");
+ break;
+ }
// FIXME: Check for truncation
strncpy(buffer, string->str, buffer_length);
@@ -580,9 +596,9 @@ char_val(char **c, int base)
int
-mp_set_from_string(const char *str, int base, MPNumber *z)
+mp_set_from_string(const char *str, MPNumber *z)
{
- int i, negate = 0, multiplier = 0;
+ int i, base, negate = 0, multiplier = 0;
const char *c, *end;
gboolean has_fraction = FALSE;
@@ -598,15 +614,13 @@ mp_set_from_string(const char *str, int base, MPNumber *z)
end = str;
while (*end != '\0')
end++;
- if (base < 0) {
- for (i = 0; base_suffixes[i] != NULL; i++) {
- if (end - strlen(base_suffixes[i]) < str)
- continue;
- if (strcmp(end - strlen(base_suffixes[i]), base_suffixes[i]) == 0)
- break;
- }
- base = base_values[i];
+ for (i = 0; base_suffixes[i] != NULL; i++) {
+ if (end - strlen(base_suffixes[i]) < str)
+ continue;
+ if (strcmp(end - strlen(base_suffixes[i]), base_suffixes[i]) == 0)
+ break;
}
+ base = base_values[i];
/* Check if this has a sign */
c = str;
@@ -670,40 +684,6 @@ mp_set_from_string(const char *str, int base, MPNumber *z)
mp_add(z, &numerator, z);
}
- /* Convert exponential part */
- if (*c == 'e' || *c == 'E') {
- int negate = 0;
- MPNumber MPbase, MPexponent, temp;
-
- c++;
-
- /* Get sign */
- if (*c == '-') {
- negate = 1;
- c++;
- } else if (strncmp(c, "â??", strlen("â??")) == 0) {
- negate = 1;
- c += strlen("â??");
- } else if (*c == '+') {
- c++;
- }
-
- /* Get magnitude */
- mp_set_from_integer(0, &MPexponent);
- while ((i = char_val((char **)&c, base)) >= 0) {
- mp_multiply_integer(&MPexponent, base, &MPexponent);
- mp_add_integer(&MPexponent, i, &MPexponent);
- c++;
- }
- if (negate) {
- mp_invert_sign(&MPexponent, &MPexponent);
- }
-
- mp_set_from_integer(base, &MPbase);
- mp_xpowy(&MPbase, &MPexponent, &temp);
- mp_multiply(z, &temp, z);
- }
-
if (c != end) {
return 1;
}
@@ -717,6 +697,6 @@ mp_set_from_string(const char *str, int base, MPNumber *z)
if (negate == 1)
mp_invert_sign(z, z);
-
+
return 0;
}
diff --git a/src/mp-equation-lexer.l b/src/mp-equation-lexer.l
index 4a84df9..11588ac 100644
--- a/src/mp-equation-lexer.l
+++ b/src/mp-equation-lexer.l
@@ -68,37 +68,40 @@ static int sub_atoi(const char *data)
%}
-ZERO "0"|"Ù "|"Û°"|"ß?"|"०"|"০"|"੦"|"૦"|"à¦"|"௦"|"౦"|"೦"|"൦"|"à¹?"|"à»?"
-ONE "1"|"Ù¡"|"Û±"|"ß?"|"१"|"১"|"੧"|"૧"|"à§"|"௧"|"౧"|"೧"|"൧"|"à¹?"|"à»?"
-TWO "2"|"Ù¢"|"Û²"|"ß?"|"२"|"২"|"੨"|"૨"|"à¨"|"௨"|"౨"|"೨"|"൨"|"à¹?"|"à»?"
-THREE "3"|"Ù£"|"Û³"|"ß?"|"३"|"৩"|"à©©"|"à«©"|"à©"|"௩"|"౩"|"೩"|"൩"|"à¹?"|"à»?"
-FOUR "4"|"Ù¤"|"Û´"|"ß?"|"४"|"৪"|"੪"|"૪"|"àª"|"௪"|"౪"|"೪"|"൪"|"à¹?"|"à»?"
-FIVE "5"|"Ù¥"|"Ûµ"|"ß?"|"५"|"৫"|"à©«"|"à««"|"à«"|"௫"|"౫"|"೫"|"൫"|"à¹?"|"à»?"
-SIX "6"|"Ù¦"|"Û¶"|"ß?"|"६"|"৬"|"੬"|"૬"|"à¬"|"௬"|"౬"|"೬"|"൬"|"à¹?"|"à»?"
-SEVEN "7"|"Ù§"|"Û·"|"ß?"|"à¥"|"à§"|"à©"|"à«"|"à"|"à¯"|"à±"|"à³"|"àµ"|"à¹?"|"à»?"
-EIGHT "8"|"Ù¨"|"Û¸"|"ß?"|"८"|"৮"|"à©®"|"à«®"|"à®"|"௮"|"à±®"|"à³®"|"൮"|"à¹?"|"à»?"
-NINE "9"|"Ù©"|"Û¹"|"ß?"|"९"|"৯"|"੯"|"૯"|"à¯"|"௯"|"౯"|"೯"|"൯"|"à¹?"|"à»?"
+ZERO "0"|"Ù "|"Û°"|"ß?"|"०"|"০"|"੦"|"૦"|"à¦"|"௦"|"౦"|"೦"|"൦"|"à¹?"|"à»?"|"༠"|"á??"|"á??"|"á? "|"á ?"|"á¥?"|"á§?"|"á?"|"á®°"|"á±?"|"á±?"|"ê? "|"ê£?"|"ê¤?"|"ê©?"|"ð?? "
+ONE "1"|"Ù¡"|"Û±"|"ß?"|"१"|"১"|"੧"|"૧"|"à§"|"௧"|"౧"|"೧"|"൧"|"à¹?"|"à»?"|"༡"|"á??"|"á??"|"á?¡"|"á ?"|"á¥?"|"á§?"|"á?"|"á®±"|"á±?"|"á±?"|"ê?¡"|"ê£?"|"ê¤?"|"ê©?"|"ð??¡"
+TWO "2"|"Ù¢"|"Û²"|"ß?"|"२"|"২"|"੨"|"૨"|"à¨"|"௨"|"౨"|"೨"|"൨"|"à¹?"|"à»?"|"༢"|"á??"|"á??"|"á?¢"|"á ?"|"á¥?"|"á§?"|"á?"|"᮲"|"á±?"|"á±?"|"ê?¢"|"ê£?"|"ê¤?"|"ê©?"|"ð??¢"
+THREE "3"|"Ù£"|"Û³"|"ß?"|"३"|"৩"|"à©©"|"à«©"|"à©"|"௩"|"౩"|"೩"|"൩"|"à¹?"|"à»?"|"༣"|"á??"|"á??"|"á?£"|"á ?"|"á¥?"|"á§?"|"á?"|"᮳"|"á±?"|"á±?"|"ê?£"|"ê£?"|"ê¤?"|"ê©?"|"ð??£"
+FOUR "4"|"Ù¤"|"Û´"|"ß?"|"४"|"৪"|"੪"|"૪"|"àª"|"௪"|"౪"|"೪"|"൪"|"à¹?"|"à»?"|"༤"|"á??"|"á??"|"á?¤"|"á ?"|"á¥?"|"á§?"|"á?"|"á®´"|"á±?"|"á±?"|"ê?¤"|"ê£?"|"ê¤?"|"ê©?"|"ð??¤"
+FIVE "5"|"Ù¥"|"Ûµ"|"ß?"|"५"|"৫"|"à©«"|"à««"|"à«"|"௫"|"౫"|"೫"|"൫"|"à¹?"|"à»?"|"༥"|"á??"|"á??"|"á?¥"|"á ?"|"á¥?"|"á§?"|"á?"|"᮵"|"á±?"|"á±?"|"ê?¥"|"ê£?"|"ê¤?"|"ê©?"|"ð??¥"
+SIX "6"|"Ù¦"|"Û¶"|"ß?"|"६"|"৬"|"੬"|"૬"|"à¬"|"௬"|"౬"|"೬"|"൬"|"à¹?"|"à»?"|"༦"|"á??"|"á??"|"á?¦"|"á ?"|"á¥?"|"á§?"|"á?"|"᮶"|"á±?"|"á±?"|"ê?¦"|"ê£?"|"ê¤?"|"ê©?"|"ð??¦"
+SEVEN "7"|"Ù§"|"Û·"|"ß?"|"à¥"|"à§"|"à©"|"à«"|"à"|"à¯"|"à±"|"à³"|"àµ"|"à¹?"|"à»?"|"༧"|"á??"|"á??"|"á?§"|"á ?"|"á¥?"|"á§?"|"á?"|"á®·"|"á±?"|"á±?"|"ê?§"|"ê£?"|"ê¤?"|"ê©?"|"ð??§"
+EIGHT "8"|"Ù¨"|"Û¸"|"ß?"|"८"|"৮"|"à©®"|"à«®"|"à®"|"௮"|"à±®"|"à³®"|"൮"|"à¹?"|"à»?"|"༨"|"á??"|"á??"|"á?¨"|"á ?"|"á¥?"|"á§?"|"á?"|"᮸"|"á±?"|"á±?"|"ê?¨"|"ê£?"|"ê¤?"|"ê©?"|"ð??¨"
+NINE "9"|"Ù©"|"Û¹"|"ß?"|"९"|"৯"|"੯"|"૯"|"à¯"|"௯"|"౯"|"೯"|"൯"|"à¹?"|"à»?"|"༩"|"á??"|"á??"|"á?©"|"á ?"|"á¥?"|"á§?"|"á?"|"᮹"|"á±?"|"á±?"|"ê?©"|"ê£?"|"ê¤?"|"ê©?"|"ð??©"
DECIMAL "."|","
BIN {ZERO}|{ONE}
+BIN_SUFFIX "â??"
OCT {ZERO}|{ONE}|{TWO}|{THREE}|{FOUR}|{FIVE}|{SIX}|{SEVEN}
+OCT_SUFFIX "â??"
DEC {ZERO}|{ONE}|{TWO}|{THREE}|{FOUR}|{FIVE}|{SIX}|{SEVEN}|{EIGHT}|{NINE}
HEX {DEC}|[A-F]|[a-f]
-EXP "e"|"e+"|"e-"|"E"|"E+"|"E-"
+HEX_SUFFIX "â??â??"
SI_SUFFIX "T"|"G"|"M"|"k"|"d"|"c"|"m"|"u"|"µ"|"n"|"p"|"f"
SUPER_DIGITS "�"|"¹"|"²"|"³"|"�"|"�"|"�"|"�"|"�"|"�"
SUB_DIGITS "â??"|"â??"|"â??"|"â??"|"â??"|"â??"|"â??"|"â??"|"â??"|"â??"
FRACTION "½"|"â??"|"â??"|"¼"|"¾"|"â??"|"â??"|"â??"|"â??"|"â??"|"â??"|"â??"|"â??"|"â??"|"â??"
INVERSE "�¹"
-HEX_NUM {HEX}+|{HEX}*{DECIMAL}{HEX}+
-DEC_NUM {DEC}+|{DEC}+{SI_SUFFIX}|{DEC}*{DECIMAL}{DEC}+|{DEC}*{SI_SUFFIX}{DEC}+|{FRACTION}|{DEC}{FRACTION}
-OCT_NUM {OCT}+|{OCT}*{DECIMAL}{OCT}+
-BIN_NUM {BIN}+|{BIN}*{DECIMAL}{BIN}+
+HEX_NUM {HEX}+{HEX_SUFFIX}|{HEX}*{DECIMAL}{HEX}+{HEX_SUFFIX}
+DEC_NUM {DEC}+|{DEC}+{SI_SUFFIX}|{DEC}*{DECIMAL}{DEC}+|{DEC}*{SI_SUFFIX}{DEC}+|{FRACTION}|{DEC}{FRACTION}
+OCT_NUM {OCT}+{OCT_SUFFIX}|{OCT}*{DECIMAL}{OCT}+{OCT_SUFFIX}
+BIN_NUM {BIN}+{BIN_SUFFIX}|{BIN}*{DECIMAL}{BIN}+{BIN_SUFFIX}
SUP_NUM {SUPER_DIGITS}+
SUB_NUM {SUB_DIGITS}+
+NUMBER {BIN_NUM}|{OCT_NUM}|{DEC_NUM}|{HEX_NUM}
GREEKS "α"|"β"|"γ"|"δ"|"ε"|"ζ"|"η"|"θ"|"ι"|"κ"|"λ"|"μ"|"ν"|"ξ"|"ο"|"Ï?"|"Ï?"|"Ï?"|"Ï?"|"Ï?"|"Ï?"|"Ï?"|"Ï?"|"Ï?"|"Ï?"
-REGISTERS "R0"|"R1"|"R2"|"R3"|"R4"|"R5"|"R6"|"R7"|"R8"|"R9"
-ANS [aA][nN][sS]
+REGISTERS "Râ??"|"Râ??"|"Râ??"|"Râ??"|"Râ??"|"Râ??"|"Râ??"|"Râ??"|"Râ??"|"Râ??"
+ANS [aA][nN][sS]
VARIABLE {REGISTERS}|{GREEKS}|"e"|{ANS}
VARIABLE_NAME [a-zA-Z]+
FUNCTION {VARIABLE_NAME}|{VARIABLE_NAME}{INVERSE}|{VARIABLE_NAME}{SUB_NUM}
@@ -107,62 +110,29 @@ MOD [mM][oO][dD]
AND "â?§"|[aA][nN][dD]
OR "â?¨"|[oO][rR]
XOR "â??"|[xX][oO][rR]
-XNOR [xX][nN][oO][rR]
NOT "¬"|"~"|[nN][oO][tT]
%%
-"+" {return tADD;}
-"-"|"â??" {return tSUBTRACT;}
-"*"|"Ã?" {return tMULTIPLY;}
-"/"|"÷" {return tDIVIDE;}
-{MOD} {return tMOD;}
-"â??" {return tROOT;}
-"â??" {return tROOT3;}
-"â??" {return tROOT4;}
-{NOT} {return tNOT;}
-{AND} {return tAND;}
-{OR} {return tOR;}
-{XOR} {return tXOR;}
-{XNOR} {return tXNOR;}
-{SUP_NUM} {yylval->integer = super_atoi(yytext); return tSUPNUM; }
-{SUB_NUM} {yylval->integer = sub_atoi(yytext); return tSUBNUM; }
-{VARIABLE} {yylval->name = strdup(yytext); return tVARIABLE;}
-{INVERSE} {return tINVERSE;}
-
-{DEC_NUM}{EXP}{DEC_NUM} {
-if (_mp_equation_get_extra(yyscanner)->options->base == 16) REJECT;
-mp_set_from_string(yytext, _mp_equation_get_extra(yyscanner)->options->base, &yylval->int_t);
-return tNUMBER;
-}
-
-{BIN_NUM} {
-if (_mp_equation_get_extra(yyscanner)->options->base != 2) REJECT;
-mp_set_from_string(yytext, _mp_equation_get_extra(yyscanner)->options->base, &yylval->int_t);
-return tNUMBER;
-}
-
-{OCT_NUM} {
-if (_mp_equation_get_extra(yyscanner)->options->base != 8) REJECT;
-mp_set_from_string(yytext, _mp_equation_get_extra(yyscanner)->options->base, &yylval->int_t);
-return tNUMBER;
-}
-
-{DEC_NUM} {
-if (_mp_equation_get_extra(yyscanner)->options->base != 10) REJECT;
-mp_set_from_string(yytext, _mp_equation_get_extra(yyscanner)->options->base, &yylval->int_t);
-return tNUMBER;
-}
-
-{HEX_NUM} {
-if (_mp_equation_get_extra(yyscanner)->options->base != 16) REJECT;
-mp_set_from_string(yytext, _mp_equation_get_extra(yyscanner)->options->base, &yylval->int_t);
-return tNUMBER;
-}
-
-{FUNCTION} {yylval->name = strdup(yytext); return tFUNCTION;}
-
+"+" {return tADD;}
+"-"|"â??" {return tSUBTRACT;}
+"*"|"Ã?" {return tMULTIPLY;}
+"/"|"â??"|"÷" {return tDIVIDE;}
+{MOD} {return tMOD;}
+"â??" {return tROOT;}
+"â??" {return tROOT3;}
+"â??" {return tROOT4;}
+{NOT} {return tNOT;}
+{AND} {return tAND;}
+{OR} {return tOR;}
+{XOR} {return tXOR;}
+{SUP_NUM} {yylval->integer = super_atoi(yytext); return tSUPNUM; }
+{SUB_NUM} {yylval->integer = sub_atoi(yytext); return tSUBNUM; }
+{NUMBER} {mp_set_from_string(yytext, &yylval->int_t); return tNUMBER;}
+{VARIABLE} {yylval->name = strdup(yytext); return tVARIABLE;}
+{FUNCTION} {yylval->name = strdup(yytext); return tFUNCTION;}
+{INVERSE} {return tINVERSE;}
[ \t\n]
-. {return *yytext;}
+. {return *yytext;}
%%
diff --git a/src/mp-equation-parser.y b/src/mp-equation-parser.y
index a2f7897..bcf2625 100644
--- a/src/mp-equation-parser.y
+++ b/src/mp-equation-parser.y
@@ -54,42 +54,14 @@ static void get_function(yyscan_t yyscanner, const char *name, const MPNumber *x
set_error(yyscanner, -PARSER_ERR_UNKNOWN_FUNCTION);
}
-static void do_bitwise(yyscan_t yyscanner, void (*mp_fn)(const MPNumber *x, const MPNumber *y, MPNumber *z), const MPNumber *x, const MPNumber *y, MPNumber *z)
-{
- if (!mp_is_natural(x) || !mp_is_natural(y))
- set_error(yyscanner, -PARSER_ERR_BITWISEOP);
- else
- mp_fn(x, y, z);
-}
-
-static void do_xnor(yyscan_t yyscanner, const MPNumber *x, const MPNumber *y, MPNumber *z)
-{
- if (!mp_is_natural(x)) {
- set_error(yyscanner, -PARSER_ERR_BITWISEOP);
- } else if (!mp_is_overflow(x, _mp_equation_get_extra(yyscanner)->options->wordlen)) {
- set_error(yyscanner, -PARSER_ERR_OVERFLOW);
- }
- mp_xnor(x, y, _mp_equation_get_extra(yyscanner)->options->wordlen, z);
-}
-
static void do_not(yyscan_t yyscanner, const MPNumber *x, MPNumber *z)
{
- if (!mp_is_natural(x)) {
- set_error(yyscanner, -PARSER_ERR_BITWISEOP);
- } else if (!mp_is_overflow(x, _mp_equation_get_extra(yyscanner)->options->wordlen)) {
+ if (!mp_is_overflow(x, _mp_equation_get_extra(yyscanner)->options->wordlen)) {
set_error(yyscanner, -PARSER_ERR_OVERFLOW);
}
mp_not(x, _mp_equation_get_extra(yyscanner)->options->wordlen, z);
}
-static void do_mod(yyscan_t yyscanner, const MPNumber *x, const MPNumber *y, MPNumber *z)
-{
- if (!mp_is_integer(x) || !mp_is_integer(y)) {
- set_error(yyscanner, -PARSER_ERR_MODULUSOP);
- } else {
- mp_modulus_divide(x, y, z);
- }
-}
%}
%pure-parser
@@ -143,7 +115,7 @@ exp:
| tSUBTRACT exp %prec UNARY_MINUS {mp_invert_sign(&$2, &$$);}
| tADD tNUMBER %prec UNARY_PLUS {mp_set_from_mp(&$2, &$$);}
| exp tDIVIDE exp {mp_divide(&$1, &$3, &$$);}
-| exp tMOD exp {do_mod(yyscanner, &$1, &$3, &$$);}
+| exp tMOD exp {mp_modulus_divide(&$1, &$3, &$$);}
| exp tMULTIPLY exp {mp_multiply(&$1, &$3, &$$);}
| exp tADD exp '%' %prec PERCENTAGE {mp_add_integer(&$3, 100, &$3); mp_divide_integer(&$3, 100, &$3); mp_multiply(&$1, &$3, &$$);}
| exp tSUBTRACT exp '%' %prec PERCENTAGE {mp_add_integer(&$3, -100, &$3); mp_divide_integer(&$3, -100, &$3); mp_multiply(&$1, &$3, &$$);}
@@ -151,10 +123,9 @@ exp:
| exp tSUBTRACT exp {mp_subtract(&$1, &$3, &$$);}
| exp '%' {mp_divide_integer(&$1, 100, &$$);}
| tNOT exp {do_not(yyscanner, &$2, &$$);}
-| exp tAND exp %prec BOOLEAN_OPERATOR {do_bitwise(yyscanner, mp_and, &$1, &$3, &$$);}
-| exp tOR exp %prec BOOLEAN_OPERATOR {do_bitwise(yyscanner, mp_or, &$1, &$3, &$$);}
-| exp tXOR exp %prec BOOLEAN_OPERATOR {do_bitwise(yyscanner, mp_xor, &$1, &$3, &$$);}
-| exp tXNOR exp %prec BOOLEAN_OPERATOR {do_xnor(yyscanner, &$1, &$3, &$$);}
+| exp tAND exp %prec BOOLEAN_OPERATOR {mp_and(&$1, &$3, &$$);}
+| exp tOR exp %prec BOOLEAN_OPERATOR {mp_or(&$1, &$3, &$$);}
+| exp tXOR exp %prec BOOLEAN_OPERATOR {mp_xor(&$1, &$3, &$$);}
| tNUMBER {mp_set_from_mp(&$1, &$$);}
;
diff --git a/src/mp-equation.h b/src/mp-equation.h
index 61d008b..3787e05 100644
--- a/src/mp-equation.h
+++ b/src/mp-equation.h
@@ -26,19 +26,13 @@
#include "mp.h"
#define PARSER_ERR_INVALID 1
-#define PARSER_ERR_BITWISEOP 3
-#define PARSER_ERR_MODULUSOP 4
#define PARSER_ERR_OVERFLOW 5
#define PARSER_ERR_UNKNOWN_VARIABLE 6
#define PARSER_ERR_UNKNOWN_FUNCTION 7
-#define PARSER_ERR_INVALID_BASE 8
#define PARSER_ERR_MP 9
/* Options for parser */
typedef struct {
- /* The numeric base (e.g 2, 8, 10, 16) */
- int base;
-
/* The wordlength for binary operations in bits (e.g. 8, 16, 32) */
int wordlen;
diff --git a/src/mp-trigonometric.c b/src/mp-trigonometric.c
index 799ab9e..f43a649 100644
--- a/src/mp-trigonometric.c
+++ b/src/mp-trigonometric.c
@@ -67,7 +67,7 @@ convert_to_radians(const MPNumber *x, MPAngleUnit unit, MPNumber *z)
void
mp_get_pi(MPNumber *z)
{
- mp_set_from_string("3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679", 10, z);
+ mp_set_from_string("3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679", z);
}
@@ -278,7 +278,7 @@ mp_tan(const MPNumber *x, MPAngleUnit unit, MPNumber *z)
mp_cos(x, unit, &cos_x);
if (mp_is_zero(&cos_x)) {
/* Translators: Error displayed when tangent value is undefined */
- mperr(_("Tangent is infinite"));
+ mperr(_("Tangent not defined for angles that are multiples of Ï?â??2 (180°) from Ï?â??4 (90°)"));
return;
}
@@ -314,8 +314,10 @@ mp_asin(const MPNumber *x, MPAngleUnit unit, MPNumber *z)
/* HERE ABS(X) >= 1. SEE IF X == +-1 */
mp_set_from_integer(x->sign, &t2);
- if (!mp_is_equal(x, &t2))
- mperr("*** ABS(X) > 1 IN CALL TO MP_ASIN ***");
+ if (!mp_is_equal(x, &t2)) {
+ /* Translators: Error displayed when inverse sine value is undefined */
+ mperr(_("Inverse sine not defined for values outside [-1, 1]"));
+ }
/* X == +-1 SO RETURN +-PI/2 */
mp_get_pi(z);
@@ -336,7 +338,8 @@ mp_acos(const MPNumber *x, MPAngleUnit unit, MPNumber *z)
mp_set_from_integer(-1, &MPn1);
if (mp_is_greater_than(x, &t1) || mp_is_less_than(x, &MPn1)) {
- mperr("Error");
+ /* Translators: Error displayed when inverse cosine value is undefined */
+ mperr(_("Inverse cosine not defined for values outside [-1, 1]"));
mp_set_from_integer(0, z);
} else if (x->sign == 0) {
mp_divide_integer(&pi, 2, z);
@@ -550,7 +553,8 @@ mp_acosh(const MPNumber *x, MPNumber *z)
/* Check x >= 1 */
mp_set_from_integer(1, &t);
if (mp_is_less_than(x, &t)) {
- mperr("Error");
+ /* Translators: Error displayed when inverse hyperbolic cosine value is undefined */
+ mperr(_("Inverse hyperbolic cosine not defined for values less than or equal to one"));
mp_set_from_integer(0, z);
return;
}
@@ -573,7 +577,8 @@ mp_atanh(const MPNumber *x, MPNumber *z)
mp_set_from_integer(1, &one);
mp_set_from_integer(-1, &minus_one);
if (mp_is_greater_equal(x, &one) || mp_is_less_equal(x, &minus_one)) {
- mperr("Error");
+ /* Translators: Error displayed when inverse hyperbolic tangent value is undefined */
+ mperr(_("Inverse hyperbolic tangent not defined for values outside [-1, 1]"));
mp_set_from_integer(0, z);
return;
}
diff --git a/src/mp.c b/src/mp.c
index 45d771b..cdc7d48 100644
--- a/src/mp.c
+++ b/src/mp.c
@@ -453,7 +453,8 @@ mp_divide(const MPNumber *x, const MPNumber *y, MPNumber *z)
/* x/0 */
if (y->sign == 0) {
- mperr("*** ATTEMPTED DIVISION BY ZERO IN CALL TO MP_DIVIDE ***");
+ /* Translators: Error displayed attempted to divide by zero */
+ mperr(_("Division by zero is not defined"));
mp_set_from_integer(0, z);
return;
}
@@ -489,7 +490,8 @@ mp_divide_integer(const MPNumber *x, int y, MPNumber *z)
/* x/0 */
if (y == 0) {
- mperr("*** ATTEMPTED DIVISION BY ZERO IN CALL TO MP_DIVIDE_INTEGER ***");
+ /* Translators: Error displayed attempted to divide by zero */
+ mperr(_("Division by zero is not defined"));
mp_set_from_integer(0, z);
return;
}
@@ -747,17 +749,13 @@ mpexp(const MPNumber *x, MPNumber *z)
mp_set_from_integer(0, z);
return;
}
+
+ /* Sum series, reducing t where possible */
mp_set_from_mp(&t1, z);
mp_set_from_mp(&t1, &t2);
-
- /* SUM SERIES, REDUCING T WHERE POSSIBLE */
- for (i = 2; ; i++) {
- if (MP_T + t2.exponent - z->exponent <= 0)
- break;
-
+ for (i = 2; MP_T + t2.exponent - z->exponent > 0; i++) {
mp_multiply(&t1, &t2, &t2);
mp_divide_integer(&t2, i, &t2);
-
mp_add(&t2, z, z);
if (t2.sign == 0)
break;
@@ -805,13 +803,6 @@ mp_epowy(const MPNumber *x, MPNumber *z)
xs = x->sign;
mp_abs(x, &t2);
- /* IF ABS(X) > M POSSIBLE THAT INT(X) OVERFLOWS,
- * SO DIVIDE BY 32.
- */
- /*if (fabs(rx) > (float)MP.m) {
- mp_divide_integer(&t2, 32, &t2);
- }*/
-
/* GET FRACTIONAL AND INTEGER PARTS OF ABS(X) */
ix = mp_cast_to_int(&t2);
mp_fractional_component(&t2, &t2);
@@ -851,17 +842,6 @@ mp_epowy(const MPNumber *x, MPNumber *z)
/* MULTIPLY EXPS OF INTEGER AND FRACTIONAL PARTS */
mp_multiply(z, &t2, z);
- /* MUST CORRECT RESULT IF DIVIDED BY 32 ABOVE. */
- /*if (fabs(rx) > (float)MP.m && z->sign != 0) {
- for (i = 1; i <= 5; ++i) {
- // SAVE EXPONENT TO AVOID OVERFLOW IN MP_MULTIPLY
- ie = z->exponent;
- z->exponent = 0;
- mp_multiply(z, z, z);
- z->exponent += ie << 1;
- }
- }*/
-
/* CHECK THAT RELATIVE ERROR LESS THAN 0.01 UNLESS ABS(X) LARGE
* (WHEN EXP MIGHT OVERFLOW OR UNDERFLOW)
*/
@@ -1040,7 +1020,8 @@ mp_ln(const MPNumber *x, MPNumber *z)
/* ln(-x) invalid */
if (x->sign <= 0) {
- mperr("*** X NONPOSITIVE IN CALL TO MP_LN ***");
+ /* Translators: Error displayed attempted to take logarithm of negative value */
+ mperr(_("Logarithm of negative values is undefined"));
mp_set_from_integer(0, z);
return;
}
@@ -1218,6 +1199,58 @@ mp_multiply(const MPNumber *x, const MPNumber *y, MPNumber *z)
void
+mp_multiply_new(const MPNumber *x, const MPNumber *y, MPNumber *z)
+{
+ int i, j, offset, y_length;
+ int fraction[MP_SIZE*2];
+
+ /* x*0 or 0*y or 0*0 = 0 */
+ if (x->sign * y->sign == 0) {
+ mp_set_from_integer(0, z);
+ return;
+ }
+
+ /* Calculate length of each fraction */
+ y_length = MP_SIZE;
+ while (y_length > 0 && y->fraction[y_length - 1] == 0)
+ y_length--;
+
+ /* Multiply together */
+ memset(fraction, 0, sizeof(fraction));
+ for (i = MP_SIZE - 1; i >= 0; i--) {
+ if (x->fraction[i] == 0)
+ continue;
+ for (j = y_length - 1; j >= 0; j--) {
+ int pos = i + j + 1;
+
+ fraction[pos] += x->fraction[i] * y->fraction[j];
+ fraction[pos-1] += fraction[pos] / MP_BASE;
+ fraction[pos] = fraction[pos] % MP_BASE;
+ }
+ }
+
+ offset = 0;
+ for (i = 0; i < MP_SIZE && fraction[offset] == 0; i++)
+ offset++;
+ z->sign = x->sign * y->sign;
+ z->exponent = x->exponent + y->exponent - offset;
+ for (i = 0; i < MP_SIZE; i++) {
+ if (i + offset >= MP_SIZE*2)
+ z->fraction[i] = 0;
+ else
+ z->fraction[i] = fraction[i + offset];
+ }
+
+ /*for (i = MP_SIZE + offset; i < MP_SIZE * 2; i++) {
+ if (fraction[i] != 0) {
+ printf("truncated\n");
+ break;
+ }
+ }*/
+}
+
+
+void
mp_multiply_integer(const MPNumber *x, int y, MPNumber *z)
{
int c, i, c1, c2, j1, j2;
@@ -1343,7 +1376,7 @@ void
mp_multiply_fraction(const MPNumber *x, int numerator, int denominator, MPNumber *z)
{
if (denominator == 0) {
- mperr("*** ATTEMPTED DIVISION BY ZERO IN MP_MULTIPLY_FRACTION ***");
+ mperr(_("Division by zero is not defined"));
mp_set_from_integer(0, z);
return;
}
@@ -1466,14 +1499,14 @@ mp_pwr(const MPNumber *x, const MPNumber *y, MPNumber *z)
/* (-x)^y imaginary */
if (x->sign < 0) {
- mperr(_("Negative X and non-integer Y not supported"));
+ mperr(_("The power of negative numbers only defined for for integer exponents"));
mp_set_from_integer(0, z);
return;
}
/* 0^-y illegal */
if (x->sign == 0 && y->sign < 0) {
- mperr("*** X ZERO AND Y NONPOSITIVE IN CALL TO MP_PWR ***");
+ mperr(_("The power of zero is not defined for a negative exponent"));
mp_set_from_integer(0, z);
return;
}
@@ -1505,9 +1538,9 @@ mp_reciprocal(const MPNumber *x, MPNumber *z)
float rx;
static int it[9] = { 0, 8, 6, 5, 4, 4, 4, 4, 4 };
- /* 1/x invalid */
+ /* 1/0 invalid */
if (x->sign == 0) {
- mperr("*** ATTEMPTED DIVISION BY ZERO IN CALL TO MP_RECIPROCAL ***");
+ mperr(_("Reciprocal of zero is not defined"));
mp_set_from_integer(0, z);
return;
}
@@ -1588,20 +1621,7 @@ mp_root(const MPNumber *x, int n, MPNumber *z)
/* x^(1/0) invalid */
if (n == 0) {
- mperr("*** N == 0 IN CALL TO MP_ROOT ***");
- mp_set_from_integer(0, z);
- return;
- }
-
- /* 0^-(1/n) invalid */
- if (x->sign == 0 && n < 0) {
- mperr("*** X == 0 AND N NEGATIVE IN CALL TO MP_ROOT ***");
- mp_set_from_integer(0, z);
- return;
- }
-
- /* 0^(1/n) = 0 */
- if (x->sign == 0) {
+ mperr(_("Root must non-zero"));
mp_set_from_integer(0, z);
return;
}
@@ -1615,8 +1635,16 @@ mp_root(const MPNumber *x, int n, MPNumber *z)
return;
}
+ /* 0^(1/n) = 0 for positive n */
+ if (x->sign == 0) {
+ mp_set_from_integer(0, z);
+ if (n <= 0)
+ mperr(_("Negative root of zero is undefined"));
+ return;
+ }
+
if (x->sign < 0 && np % 2 == 0) {
- mperr("*** X NEGATIVE AND N EVEN IN CALL TO MP_ROOT ***");
+ mperr(_("nth root of negative number not defined for even n"));
mp_set_from_integer(0, z);
return;
}
@@ -1706,7 +1734,7 @@ void
mp_sqrt(const MPNumber *x, MPNumber *z)
{
if (x->sign < 0)
- mperr("*** X NEGATIVE IN CALL TO SUBROUTINE MP_SQRT ***");
+ mperr(_("Square root is not defined for negative values"));
else if (x->sign == 0)
mp_set_from_integer(0, z);
else {
@@ -1732,7 +1760,8 @@ mp_factorial(const MPNumber *x, MPNumber *z)
return;
}
if (!mp_is_natural(x)) {
- mperr("Cannot take factorial of non-natural number");
+ /* Translators: Error displayed when attempted take the factorial of a fractional number */
+ mperr(_("Factorial only defined for natural numbers"));
return;
}
@@ -1749,6 +1778,11 @@ mp_modulus_divide(const MPNumber *x, const MPNumber *y, MPNumber *z)
{
MPNumber t1, t2;
+ if (!mp_is_integer(x) || !mp_is_integer(y)) {
+ /* Translators: Error displayed when attemping to do a modulus division on non-integer numbers */
+ mperr(_("Modulus division only defined for integers"));
+ }
+
mp_divide(x, y, &t1);
mp_integer_component(&t1, &t1);
mp_multiply(&t1, y, &t2);
@@ -1782,9 +1816,10 @@ mp_xpowy_integer(const MPNumber *x, int n, MPNumber *z)
int i;
MPNumber t;
- /* x^-n invalid */
+ /* 0^-n invalid */
if (x->sign == 0 && n < 0) {
- mperr("*** ATTEMPT TO RAISE ZERO TO NEGATIVE POWER IN CALL TO SUBROUTINE mp_xpowy_integer ***");
+ /* Translators: Error displayed when attempted to raise 0 to a negative exponent */
+ mperr(_("The power of zero is not defined for a negative exponent"));
return;
}
diff --git a/src/mp.h b/src/mp.h
index 1602439..729f7ae 100644
--- a/src/mp.h
+++ b/src/mp.h
@@ -204,10 +204,10 @@ void mp_set_from_fraction(int numerator, int denominator, MPNumber *z);
/* Sets z to be a uniform random number in the range [0, 1] */
void mp_set_from_random(MPNumber *z);
-/* Sets z from a string representation in 'text' in base 'base'.
+/* Sets z from a string representation in 'text'.
* Returns 0 on success.
*/
-int mp_set_from_string(const char *text, int base, MPNumber *z);
+int mp_set_from_string(const char *text, MPNumber *z);
/* Returns x as a native single-precision floating point number */
float mp_cast_to_float(const MPNumber *x);
diff --git a/src/register.c b/src/register.c
index 40567af..3c7c346 100644
--- a/src/register.c
+++ b/src/register.c
@@ -26,15 +26,14 @@
#include "get.h"
#include "mp.h"
-static char constant_names[MAX_CONSTANTS][MAXLINE]; /* Selectable constant names. */
-static MPNumber constant_values[MAX_CONSTANTS]; /* Selectable constants. */
-
static char function_names[MAX_FUNCTIONS][MAXLINE]; /* Function names from .gcalctoolcf. */
static char function_values[MAX_FUNCTIONS][MAXLINE]; /* Function defs from .gcalctoolcf. */
static MPNumber registers[MAX_REGISTERS]; /* Memory register values. */
+static char register_names[MAX_REGISTERS][MAXLINE]; /* Memory register names */
+
-static const char *default_constants[][2] =
+static const char *default_registers[][2] =
{
/* Translators: This is the label for the default constant, the number of miles in one kilometer (0.621) */
{ N_("Kilometer-to-mile conversion factor"), "0.621" },
@@ -61,42 +60,32 @@ static const char *default_constants[][2] =
void register_init()
{
int i;
- char key[MAXLINE], *value;
-
- for (i = 0; i < MAX_REGISTERS; i++) {
- SNPRINTF(key, MAXLINE, "register%d", i);
- value = get_resource(key);
- if (value) {
- MPNumber temp;
- mp_set_from_string(value, 10, &temp);
- g_free(value);
- register_set(i, &temp);
- }
- }
- for (i = 0; i < MAX_CONSTANTS; i++) {
+ for (i = 0; i < MAX_REGISTERS; i++) {
char nkey[MAXLINE], *nline;
char vkey[MAXLINE], *vline = NULL;
MPNumber value;
- SNPRINTF(nkey, MAXLINE, "constant%1dname", i);
+ SNPRINTF(nkey, MAXLINE, "registger%1dname", i);
nline = get_resource(nkey);
if (nline) {
- SNPRINTF(vkey, MAXLINE, "constant%1dvalue", i);
+ SNPRINTF(vkey, MAXLINE, "register%1d", i);
vline = get_resource(vkey);
if (vline == NULL)
g_free(nline);
}
if (nline && vline) {
- mp_set_from_string(vline, 10, &value);
- constant_set(i, nline, &value);
+ mp_set_from_string(vline, &value);
+ register_set_name(i, nline);
+ register_set_value(i, &value);
g_free(nline);
g_free(vline);
}
else {
- mp_set_from_string(default_constants[i][1], 10, &value);
- constant_set(i, default_constants[i][0], &value);
+ mp_set_from_string(default_registers[i][1], &value);
+ register_set_name(i, default_registers[i][0]);
+ register_set_value(i, &value);
}
}
@@ -126,48 +115,36 @@ void register_init()
void
-register_set(int index, const MPNumber *value)
+register_set_value(int index, const MPNumber *value)
{
if ((index >= 0) && (index <= 10))
mp_set_from_mp(value, ®isters[index]);
}
-void
-register_get(int index, MPNumber *value)
+const MPNumber *
+register_get_value(int index)
{
if ((index >= 0) && (index <= 10))
- mp_set_from_mp(®isters[index], value);
+ return ®isters[index];
+ else
+ return NULL;
}
-void constant_set(int index, const char *name, MPNumber *value)
+void register_set_name(int index, const char *name)
{
- char key[MAXLINE], text[MAX_LOCALIZED];
-
- STRNCPY(constant_names[index], name, MAXLINE - 1);
- mp_set_from_mp(value, &constant_values[index]);
-
- SNPRINTF(key, MAXLINE, "constant%1dname", index);
+ char key[MAXLINE];
+
+ STRNCPY(register_names[index], name, MAXLINE - 1);
+ SNPRINTF(key, MAXLINE, "register%1dname", index);
set_resource(key, name);
-
- /* NOTE: Constants are written out with no thousands separator and with a
- radix character of ".". */
- mp_cast_to_string(value, 10, MAX_DIGITS, 1, text, MAX_LOCALIZED);
- SNPRINTF(key, MAXLINE, "constant%1dvalue", index);
- set_resource(key, text);
-}
-
-
-const char *constant_get_name(int index)
-{
- return constant_names[index];
}
-const MPNumber *constant_get_value(int index)
+const char *register_get_name(int index)
{
- return &constant_values[index];
+ return register_names[index];
}
diff --git a/src/register.h b/src/register.h
index c0593d9..5b2dff3 100644
--- a/src/register.h
+++ b/src/register.h
@@ -25,12 +25,10 @@
#include "mp.h"
void register_init();
-void register_set(int index, const MPNumber *value);
-void register_get(int index, MPNumber *value);
-
-void constant_set(int index, const char *name, MPNumber *value);
-const char *constant_get_name(int index);
-const MPNumber *constant_get_value(int index);
+void register_set_value(int index, const MPNumber *value);
+void register_set_name(int index, const char *name);
+const MPNumber *register_get_value(int index);
+const char *register_get_name(int index);
void function_set(int index, const char *name, const char *value);
const char *function_get_name(int index);
diff --git a/src/ui.h b/src/ui.h
index d087f98..6c624dd 100644
--- a/src/ui.h
+++ b/src/ui.h
@@ -27,37 +27,16 @@
#include "calctool.h"
-/* Calculator modes. */
-typedef enum { BASIC,
- ADVANCED,
- FINANCIAL,
- SCIENTIFIC,
- PROGRAMMING } ModeType;
-
void ui_init(int *argc, char ***argv);
void ui_load(void);
void ui_start(void);
-void ui_make_registers(void);
void ui_set_undo_enabled(gboolean, gboolean);
void ui_set_display(char *, int);
void ui_set_bitfield(int enabled, guint64 bits);
-gchar *ui_get_display(void);
-
-void ui_set_registers_visible(gboolean);
-void ui_set_accuracy(int);
-void ui_set_mode(ModeType);
-void ui_set_base(int);
-void ui_set_trigonometric_mode(MPAngleUnit unit);
-void ui_set_numeric_mode(DisplayFormat);
-void ui_set_show_thousands_separator(gboolean);
-void ui_set_show_trailing_zeroes(gboolean);
-void ui_set_wordlen(int);
+void ui_set_statusbar(const gchar *);
-void ui_set_error_state(gboolean);
-void ui_set_statusbar(const gchar *, const gchar *);
-
-void ui_beep(void);
+gchar *ui_get_display(void);
#endif /* UI_H */
diff --git a/src/unittest.c b/src/unittest.c
index 39ce089..c9bb66e 100644
--- a/src/unittest.c
+++ b/src/unittest.c
@@ -28,6 +28,7 @@
#include "mp-equation.h"
static MPEquationOptions options;
+static int base;
static int fails = 0;
@@ -72,7 +73,7 @@ test(char *expression, char *expected, int expected_error)
error = mp_equation_parse(expression, &options, &result);
if(error == 0) {
- mp_cast_to_string(&result, options.base, 9, 1, result_str, 1024);
+ mp_cast_to_string(&result, base, 9, 1, result_str, 1024);
if(expected_error != 0)
fail("'%s' -> %s, expected error %d", expression, result_str, expected_error);
else if(strcmp(result_str, expected) != 0)
@@ -93,63 +94,37 @@ void
test_parser()
{
memset(&options, 0, sizeof(options));
- options.base = 10;
+ base = 10;
options.wordlen = 32;
options.angle_units = MP_DEGREES;
- options.base = 2;
- test("0", "0", 0);
- test("1", "1", 0);
- test("10", "10", 0);
- test("210", "", -1);
-
- options.base = 8;
- test("0", "0", 0);
- test("1", "1", 0);
- test("2", "2", 0);
- test("3", "3", 0);
- test("4", "4", 0);
- test("5", "5", 0);
- test("6", "6", 0);
- test("7", "7", 0);
- test("76543210", "76543210", 0);
- test("876543210", "", -1);
+ base = 2;
+ test("2", "10â??", 0);
+
+ base = 8;
+ test("16434824", "76543210â??", 0);
- options.base = 10;
- test("0", "0", 0);
- test("1", "1", 0);
- test("2", "2", 0);
- test("3", "3", 0);
- test("4", "4", 0);
- test("5", "5", 0);
- test("6", "6", 0);
- test("7", "7", 0);
- test("8", "8", 0);
- test("9", "9", 0);
- test("9876543210", "9876543210", 0);
- test("A9876543210", "", -7);
-
- options.base = 16;
- test("0", "0", 0);
- test("1", "1", 0);
- test("2", "2", 0);
- test("3", "3", 0);
- test("4", "4", 0);
- test("5", "5", 0);
- test("6", "6", 0);
- test("7", "7", 0);
- test("8", "8", 0);
- test("9", "9", 0);
- test("A", "A", 0);
- test("B", "B", 0);
- test("C", "C", 0);
- test("D", "D", 0);
- test("E", "E", 0);
- test("F", "F", 0);
- test("FEDBCA9876543210", "FEDBCA9876543210", 0);
- test("GFEDBCA9876543210", "", -7);
-
- options.base = 10;
+ base = 16;
+ test("18364758544493064720", "FEDCBA9876543210â??â??", 0);
+
+ base = 10;
+ test("0â??", "0", 0); test("0â??", "0", 0); test("0", "0", 0); test("0â??â??", "0", 0);
+ test("1â??", "1", 0); test("1â??", "1", 0); test("1", "1", 0); test("1â??â??", "1", 0);
+ test("2â??", "", -1); test("2â??", "2", 0); test("2", "2", 0); test("2â??â??", "2", 0);
+ test("3â??", "", -1); test("3â??", "3", 0); test("3", "3", 0); test("3â??â??", "3", 0);
+ test("4â??", "", -1); test("4â??", "4", 0); test("4", "4", 0); test("4â??â??", "4", 0);
+ test("5â??", "", -1); test("5â??", "5", 0); test("5", "5", 0); test("5â??â??", "5", 0);
+ test("6â??", "", -1); test("6â??", "6", 0); test("6", "6", 0); test("6â??â??", "6", 0);
+ test("7â??", "", -1); test("7â??", "7", 0); test("7", "7", 0); test("7â??â??", "7", 0);
+ test("8â??", "", -1); test("8â??", "", -1); test("8", "8", 0); test("8â??â??", "8", 0);
+ test("9â??", "", -1); test("9â??", "", -1); test("9", "9", 0); test("9â??â??", "9", 0);
+ test("Aâ??", "", -1); test("Aâ??", "", -1); test("A", "", -1); test("Aâ??â??", "10", 0);
+ test("Bâ??", "", -1); test("Bâ??", "", -1); test("B", "", -1); test("Bâ??â??", "11", 0);
+ test("Câ??", "", -1); test("Câ??", "", -1); test("C", "", -1); test("Câ??â??", "12", 0);
+ test("Dâ??", "", -1); test("Dâ??", "", -1); test("D", "", -1); test("Dâ??â??", "13", 0);
+ test("Eâ??", "", -1); test("Eâ??", "", -1); test("E", "", -1); test("Eâ??â??", "14", 0);
+ test("Fâ??", "", -1); test("Fâ??", "", -1); test("F", "", -1); test("Fâ??â??", "15", 0);
+
test("+1", "1", 0);
test("â??1", "â??1", 0);
test("+ 1", "1", 0); // FIXME: Should this be allowed?
@@ -195,9 +170,6 @@ test_parser()
//test("2p3", "0.0000000000023", 0); // FIXME: Need to print out significant figures, not decimal places
//test("2f3", "0.0000000000000023", 0); // FIXME: Need to print out significant figures, not decimal places
- test("2e3", "2000", 0);
- test("2e+3", "2000", 0);
- test("2e-3", "0.002", 0);
test("2Ã?10^3", "2000", 0);
test("2Ã?10^â??3", "0.002", 0);
@@ -405,13 +377,87 @@ test_parser()
test("3 or 5", "7", 0);
test("3 xor 5", "6", 0);
- options.base = 16;
- test("ones 1", "FFFFFFFE", 0);
- test("ones 7FFFFFFF", "80000000", 0);
- test("twos 1", "FFFFFFFF", 0);
- test("twos 7FFFFFFF", "80000001", 0);
- test("3 xnor 5", "FFFFFFF9", 0);
- test("~7A", "FFFFFF85", 0);
+ base = 16;
+ test("ones 1", "FFFFFFFEâ??â??", 0);
+ test("ones 7FFFFFFFâ??â??", "80000000â??â??", 0);
+ test("twos 1", "FFFFFFFFâ??â??", 0);
+ test("twos 7FFFFFFFâ??â??", "80000001â??â??", 0);
+ test("~7Aâ??â??", "FFFFFF85â??â??", 0);
+}
+
+
+static void
+print_number(MPNumber *x)
+{
+ int i, j;
+
+ printf("sign=%d exponent=%d fraction=%d", x->sign, x->exponent, x->fraction[0]);
+ for (i = 1; i < MP_SIZE; i++) {
+ for (j = i; j < MP_SIZE && x->fraction[j] == 0; j++);
+ if (j == MP_SIZE) {
+ printf(",...");
+ break;
+ }
+ printf(",%d", x->fraction[i]);
+ }
+}
+
+static void
+test_string(const char *number)
+{
+ MPNumber t;
+
+ mp_set_from_string(number, &t);
+
+ printf("MPNumber(%s) -> {", number);
+ print_number(&t);
+ printf("}\n");
+}
+
+static void
+test_integer(int number)
+{
+ MPNumber t;
+
+ mp_set_from_integer(number, &t);
+
+ printf("MPNumber(%d) -> {", number);
+ print_number(&t);
+ printf("}\n");
+}
+
+#include "mp-internal.h"
+static void
+test_numbers()
+{
+ printf("base=%d\n", MP_BASE);
+ test_integer(0);
+ test_integer(1);
+ test_integer(-1);
+ test_integer(2);
+ test_integer(9999);
+ test_integer(10000);
+ test_integer(10001);
+ test_integer(2147483647);
+
+ test_string("0");
+ test_string("1");
+ test_string("-1");
+ test_string("16383");
+ test_string("16384");
+ test_string("16385");
+ test_string("268435456");
+
+ test_string("0.1");
+ test_string("0.5");
+ test_string("0.25");
+ test_string("0.125");
+ test_string("0.0625");
+ test_string("0.00006103515625");
+ test_string("0.000030517578125");
+
+ test_string("1.00006103515625");
+ test_string("16384.00006103515625");
}
@@ -419,5 +465,6 @@ void
unittest()
{
test_parser();
+ test_numbers();
exit(fails > 0 ? 1 : 0);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]