[gcalctool] Add angle units combo in advanced and number base combo in programming buttons. Limit the conveted v
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcalctool] Add angle units combo in advanced and number base combo in programming buttons. Limit the conveted v
- Date: Sun, 18 Apr 2010 23:38:18 +0000 (UTC)
commit bb2a45badf2527f6b3c1289694fb104158a9865c
Author: Robert Ancell <robert ancell gmail com>
Date: Mon Apr 19 09:31:43 2010 +1000
Add angle units combo in advanced and number base combo in programming buttons. Limit the conveted value labels to stop becomming too wide
data/buttons-advanced.ui | 25 ++++-
data/buttons-programming.ui | 24 +++-
src/math-buttons.c | 284 ++++++++++++++++++++++++++++++++++---------
src/math-equation.c | 66 +++++++++--
src/math-equation.h | 10 +-
src/math-preferences.c | 4 +-
6 files changed, 332 insertions(+), 81 deletions(-)
---
diff --git a/data/buttons-advanced.ui b/data/buttons-advanced.ui
index 55b189d..5d80dff 100644
--- a/data/buttons-advanced.ui
+++ b/data/buttons-advanced.ui
@@ -8,10 +8,29 @@
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
- <object class="GtkLabel" id="angle_label">
+ <object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="label" comments="Example content">3.14159 radians = 180 degrees</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkComboBox" id="angle_units_combo">
+ <property name="visible">True</property>
+ <property name="focus_on_click">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="angle_label">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" comments="Example content">3.14159 radians = 180 degrees</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
diff --git a/data/buttons-programming.ui b/data/buttons-programming.ui
index b0ba77a..3c36d42 100644
--- a/data/buttons-programming.ui
+++ b/data/buttons-programming.ui
@@ -8,10 +8,28 @@
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
- <object class="GtkLabel" id="base_label">
+ <object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="label" comments="Example content">FF₁₆ 256₁₀</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkComboBox" id="base_combo">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="base_label">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" comments="Example content">FF₁₆ 256₁₀</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="position">0</property>
diff --git a/src/math-buttons.c b/src/math-buttons.c
index 1297991..0422136 100644
--- a/src/math-buttons.c
+++ b/src/math-buttons.c
@@ -50,9 +50,11 @@ struct MathButtonsPrivate
GList *superscript_toggles;
GList *subscript_toggles;
- GtkWidget *angle_label, *base_label;
-
- guint64 bits;
+ GtkWidget *angle_combo;
+ GtkWidget *angle_label;
+
+ GtkWidget *base_combo;
+ GtkWidget *base_label;
GtkWidget *bit_panel;
GtkWidget *bit_labels[MAXBITS];
@@ -434,30 +436,53 @@ display_changed_cb(MathEquation *equation, GParamSpec *spec, MathButtons *button
is_number = math_equation_get_number(equation, &x);
if (buttons->priv->angle_label && is_number) {
- MPNumber pi;
- char *label, ans_string[1024], conv_string[1024];
+ MPNumber pi, max_value, min_value, fraction, input, output;
+ char *label, input_text[1024], output_text[1024];
mp_get_pi(&pi);
- mp_cast_to_string(&x, 10, 10, 2, false, ans_string, 1024);
switch (math_equation_get_angle_units(equation)) {
default:
case MP_DEGREES:
- mp_multiply(&x, &pi, &x);
- mp_divide_integer(&x, 180, &x);
- mp_cast_to_string(&x, 10, 10, 2, false, conv_string, 1024);
- label = g_strdup_printf("%s degrees = %s radians", ans_string, conv_string);
+ label = g_strdup("");
break;
case MP_RADIANS:
- mp_multiply_integer(&x, 180, &x);
- mp_divide(&x, &pi, &x);
- mp_cast_to_string(&x, 10, 10, 2, false, conv_string, 1024);
- label = g_strdup_printf("%s radians = %s degrees", ans_string, conv_string);
+ /* Clip to the range ±2Ï? */
+ mp_multiply_integer(&pi, 2, &max_value);
+ mp_invert_sign(&max_value, &min_value);
+ if (!mp_is_equal(&x, &max_value) && !mp_is_equal(&x, &min_value)) {
+ mp_divide(&x, &max_value, &fraction);
+ mp_fractional_component(&fraction, &fraction);
+ mp_multiply(&fraction, &max_value, &input);
+ }
+ else {
+ mp_set_from_mp(&x, &input);
+ mp_set_from_integer(mp_is_negative(&input) ? -1 : 1, &fraction);
+ }
+ mp_cast_to_string(&input, 10, 10, 2, false, input_text, 1024);
+
+ mp_multiply_integer(&fraction, 360, &output);
+ mp_cast_to_string(&output, 10, 10, 2, false, output_text, 1024);
+ label = g_strdup_printf("%s radians = %s degrees", input_text, output_text);
break;
case MP_GRADIANS:
- mp_multiply(&x, &pi, &x);
- mp_divide_integer(&x, 200, &x);
- mp_cast_to_string(&x, 10, 10, 2, false, conv_string, 1024);
- label = g_strdup_printf("%s gradians = %s radians", ans_string, conv_string);
+ /* Clip to the range ±400 */
+ mp_set_from_integer(400, &max_value);
+ mp_invert_sign(&max_value, &min_value);
+ if (!mp_is_equal(&x, &max_value) && !mp_is_equal(&x, &min_value)) {
+ mp_divide(&x, &max_value, &fraction);
+ mp_fractional_component(&fraction, &fraction);
+ mp_multiply(&fraction, &max_value, &input);
+ }
+ else {
+ mp_set_from_mp(&x, &input);
+ mp_set_from_integer(mp_is_negative(&input) ? -1 : 1, &fraction);
+ }
+
+ mp_cast_to_string(&input, 10, 10, 2, false, input_text, 1024);
+
+ mp_multiply_integer(&fraction, 360, &output);
+ mp_cast_to_string(&output, 10, 10, 2, false, output_text, 1024);
+ label = g_strdup_printf("%s gradians = %s degrees", input_text, output_text);
break;
}
@@ -465,39 +490,9 @@ display_changed_cb(MathEquation *equation, GParamSpec *spec, MathButtons *button
g_free(label);
}
- if (buttons->priv->base_label) {
- GString *label;
- gint base;
- gchar text[1024];
-
- base = math_equation_get_base(equation);
- label = g_string_new("");
- if (base != 8) {
- mp_cast_to_string(&x, 0, 8, 2, true, text, 1024);
- if (label->len != 0)
- g_string_append(label, " ");
- g_string_append(label, text);
- }
- if (base != 10) {
- mp_cast_to_string(&x, 0, 10, 2, true, text, 1024);
- if (label->len != 0)
- g_string_append(label, " ");
- g_string_append(label, text);
- }
- if (base != 16) {
- mp_cast_to_string(&x, 0, 16, 2, true, text, 1024);
- if (label->len != 0)
- g_string_append(label, " ");
- g_string_append(label, text);
- }
-
- gtk_label_set_text(GTK_LABEL(buttons->priv->base_label), label->str);
- g_string_free(label, TRUE);
- }
-
if (buttons->priv->bit_panel) {
gboolean enabled = is_number;
- int i;
+ guint64 bits;
if (enabled) {
MPNumber max;
@@ -506,23 +501,136 @@ display_changed_cb(MathEquation *equation, GParamSpec *spec, MathButtons *button
if (mp_is_negative(&x) || mp_is_greater_than(&x, &max))
enabled = FALSE;
else
- buttons->priv->bits = mp_cast_to_unsigned_int(&x);
+ bits = mp_cast_to_unsigned_int(&x);
}
gtk_widget_set_sensitive(buttons->priv->bit_panel, enabled);
- for (i = 0; i < MAXBITS; i++) {
- const gchar *label;
+ gtk_widget_set_sensitive(buttons->priv->base_label, enabled);
+
+ if (enabled) {
+ int i;
+ GString *label;
+ gint base;
+
+ for (i = 0; i < MAXBITS; i++) {
+ const gchar *label;
+
+ if (bits & (1LL << (MAXBITS-i-1)))
+ label = " 1";
+ else
+ label = " 0";
+ gtk_label_set_text(GTK_LABEL(buttons->priv->bit_labels[i]), label);
+ }
- if (buttons->priv->bits & (1LL << (MAXBITS-i-1)))
- label = " 1";
- else
- label = " 0";
- gtk_label_set_text(GTK_LABEL(buttons->priv->bit_labels[i]), label);
+ base = math_equation_get_base(equation);
+ label = g_string_new("");
+ if (base != 8) {
+ if (label->len != 0)
+ g_string_append(label, " = ");
+ g_string_append_printf(label, "%lo", bits);
+ g_string_append(label, "â??");
+ }
+ if (base != 10) {
+ if (label->len != 0)
+ g_string_append(label, " = ");
+ g_string_append_printf(label, "%lu", bits);
+ g_string_append(label, "â??â??");
+ }
+ if (base != 16) {
+ if (label->len != 0)
+ g_string_append(label, " = ");
+ g_string_append_printf(label, "%lX", bits);
+ g_string_append(label, "â??â??");
+ }
+
+ gtk_label_set_text(GTK_LABEL(buttons->priv->base_label), label->str);
+ g_string_free(label, TRUE);
}
}
}
+static void
+angle_unit_combobox_changed_cb(GtkWidget *combo, MathButtons *buttons)
+{
+ MPAngleUnit 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);
+ math_equation_set_angle_units(buttons->priv->equation, value);
+}
+
+
+static void
+angle_unit_cb(MathEquation *equation, GParamSpec *spec, MathButtons *buttons)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gboolean valid;
+
+ model = gtk_combo_box_get_model(GTK_COMBO_BOX(buttons->priv->angle_combo));
+ valid = gtk_tree_model_get_iter_first(model, &iter);
+
+ while (valid) {
+ gint v;
+
+ gtk_tree_model_get(model, &iter, 1, &v, -1);
+ if (v == math_equation_get_angle_units(buttons->priv->equation))
+ 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(buttons->priv->angle_combo), &iter);
+}
+
+
+static void
+base_combobox_changed_cb(GtkWidget *combo, MathButtons *buttons)
+{
+ 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);
+
+ math_equation_set_base(buttons->priv->equation, value);
+}
+
+
+static void
+base_changed_cb(MathEquation *equation, GParamSpec *spec, MathButtons *buttons)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gboolean valid;
+ gint value;
+
+ model = gtk_combo_box_get_model(GTK_COMBO_BOX(buttons->priv->base_combo));
+ valid = gtk_tree_model_get_iter_first(model, &iter);
+ value = math_equation_get_base(buttons->priv->equation);
+
+ while (valid) {
+ gint v;
+
+ gtk_tree_model_get(model, &iter, 1, &v, -1);
+ if (v == value)
+ 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(buttons->priv->base_combo), &iter);
+}
+
+
static GtkWidget *
load_mode(MathButtons *buttons, ButtonMode mode)
{
@@ -650,11 +758,42 @@ load_mode(MathButtons *buttons, ButtonMode mode)
}
if (mode == ADVANCED) {
+ GtkListStore *model;
+ GtkTreeIter iter;
+ GtkCellRenderer *renderer;
+
buttons->priv->angle_label = GET_WIDGET(builder, "angle_label");
+
+ buttons->priv->angle_combo = GET_WIDGET(builder, "angle_units_combo");
+ model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
+ gtk_combo_box_set_model(GTK_COMBO_BOX(buttons->priv->angle_combo), GTK_TREE_MODEL(model));
+ gtk_list_store_append(GTK_LIST_STORE(model), &iter);
+ gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0,
+ /* Advanced buttons: Angle unit combo box: Use degrees for trigonometric calculations */
+ _("Degrees"), 1, MP_DEGREES, -1);
+ gtk_list_store_append(GTK_LIST_STORE(model), &iter);
+ gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0,
+ /* Advanced buttons: Angle unit combo box: Use radians for trigonometric calculations */
+ _("Radians"), 1, MP_RADIANS, -1);
+ gtk_list_store_append(GTK_LIST_STORE(model), &iter);
+ gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0,
+ /* Advanced buttons: Angle unit combo box: Use gradians for trigonometric calculations */
+ _("Gradians"), 1, MP_GRADIANS, -1);
+ renderer = gtk_cell_renderer_text_new();
+ gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(buttons->priv->angle_combo), renderer, TRUE);
+ gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(buttons->priv->angle_combo), renderer, "text", 0);
+
+ g_signal_connect(buttons->priv->angle_combo, "changed", G_CALLBACK(angle_unit_combobox_changed_cb), buttons);
+ g_signal_connect(buttons->priv->equation, "notify::angle-unit", G_CALLBACK(angle_unit_cb), buttons);
+ angle_unit_cb(buttons->priv->equation, NULL, buttons);
}
if (mode == PROGRAMMING) {
- buttons->priv->base_label = GET_WIDGET(builder, "base_label");
+ GtkListStore *model;
+ GtkTreeIter iter;
+ GtkCellRenderer *renderer;
+
+ buttons->priv->base_label = GET_WIDGET(builder, "base_label");
buttons->priv->character_code_dialog = GET_WIDGET(builder, "character_code_dialog");
buttons->priv->character_code_entry = GET_WIDGET(builder, "character_code_entry");
@@ -666,6 +805,33 @@ load_mode(MathButtons *buttons, ButtonMode mode)
name = g_strdup_printf("bit_eventbox_%d", i);
set_int_data(builder, name, "bit_index", i);
}
+
+ buttons->priv->base_combo = GET_WIDGET(builder, "base_combo");
+ model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT);
+ gtk_combo_box_set_model(GTK_COMBO_BOX(buttons->priv->base_combo), GTK_TREE_MODEL(model));
+ gtk_list_store_append(GTK_LIST_STORE(model), &iter);
+ gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0,
+ /* Number display mode combo: Binary, e.g. 10011010010â?? */
+ _("Binary"), 1, 2, -1);
+ gtk_list_store_append(GTK_LIST_STORE(model), &iter);
+ gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0,
+ /* Number display mode combo: Octal, e.g. 2322â?? */
+ _("Octal"), 1, 8, -1);
+ gtk_list_store_append(GTK_LIST_STORE(model), &iter);
+ gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0,
+ /* Number display mode combo: Decimal, e.g. 1234 */
+ _("Decimal"), 1, 10, -1);
+ gtk_list_store_append(GTK_LIST_STORE(model), &iter);
+ gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0,
+ /* Number display mode combo: Hexadecimal, e.g. 4D2â??â?? */
+ _("Hexadecimal"), 1, 16, -1);
+ renderer = gtk_cell_renderer_text_new();
+ gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(buttons->priv->base_combo), renderer, TRUE);
+ gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(buttons->priv->base_combo), renderer, "text", 0);
+
+ g_signal_connect(buttons->priv->base_combo, "changed", G_CALLBACK(base_combobox_changed_cb), buttons);
+ g_signal_connect(buttons->priv->equation, "notify::base", G_CALLBACK(base_changed_cb), buttons);
+ base_changed_cb(buttons->priv->equation, NULL, buttons);
}
/* Setup financial functions */
diff --git a/src/math-equation.c b/src/math-equation.c
index b2e4046..39f915c 100644
--- a/src/math-equation.c
+++ b/src/math-equation.c
@@ -45,6 +45,7 @@ enum {
PROP_SHOW_THOUSANDS_SEPARATORS,
PROP_SHOW_TRAILING_ZEROES,
PROP_NUMBER_FORMAT,
+ PROP_BASE,
PROP_WORD_SIZE,
PROP_ANGLE_UNITS
};
@@ -69,11 +70,11 @@ struct MathEquationPrivate
{
GtkTextTag *ans_tag;
- int show_tsep; /* Set if the thousands separator should be shown. */
- int show_zeroes; /* Set if trailing zeroes should be shown. */
+ gint show_tsep; /* Set if the thousands separator should be shown. */
+ gint show_zeroes; /* Set if trailing zeroes should be shown. */
DisplayFormat format; /* Number display mode. */
- int accuracy; /* Number of digits to show */
- int word_size; /* Word size in bits */
+ gint accuracy; /* Number of digits to show */
+ gint word_size; /* Word size in bits */
MPAngleUnit angle_units; /* Units for trigonometric functions */
NumberMode number_mode; /* ??? */
gboolean can_super_minus; /* TRUE if entering minus can generate a superscript minus */
@@ -81,7 +82,7 @@ struct MathEquationPrivate
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. */
+ gint tsep_count; /* Number of digits between separator. */
GtkTextMark *ans_start, *ans_end;
@@ -326,7 +327,7 @@ math_equation_get_numeric_point_text(MathEquation *equation)
void
-math_equation_set_accuracy(MathEquation *equation, int accuracy)
+math_equation_set_accuracy(MathEquation *equation, gint accuracy)
{
if (equation->priv->accuracy == accuracy)
return;
@@ -336,7 +337,7 @@ math_equation_set_accuracy(MathEquation *equation, int accuracy)
}
-int
+gint
math_equation_get_accuracy(MathEquation *equation)
{
return equation->priv->accuracy;
@@ -382,11 +383,17 @@ math_equation_get_show_trailing_zeroes(MathEquation *equation)
void
math_equation_set_number_format(MathEquation *equation, DisplayFormat format)
{
+ gint base;
+
if (equation->priv->format == format)
return;
+
+ base = math_equation_get_base(equation);
equation->priv->format = format;
reformat_display(equation);
g_object_notify(G_OBJECT(equation), "number-format");
+ if (base != math_equation_get_base(equation))
+ g_object_notify(G_OBJECT(equation), "base");
}
@@ -397,6 +404,32 @@ math_equation_get_number_format(MathEquation *equation)
}
+void
+math_equation_set_base(MathEquation *equation, gint base)
+{
+ if (math_equation_get_base(equation) == base)
+ return;
+
+ switch(base) {
+ case 2:
+ math_equation_set_number_format(equation, BIN);
+ break;
+ case 8:
+ math_equation_set_number_format(equation, OCT);
+ break;
+ case 10:
+ math_equation_set_number_format(equation, DEC);
+ break;
+ case 16:
+ math_equation_set_number_format(equation, HEX);
+ break;
+ default:
+ g_warning("Attempt to set non-supported base %d", base);
+ return;
+ }
+}
+
+
gint
math_equation_get_base(MathEquation *equation)
{
@@ -415,7 +448,7 @@ math_equation_get_base(MathEquation *equation)
void
-math_equation_set_word_size(MathEquation *equation, int word_size)
+math_equation_set_word_size(MathEquation *equation, gint word_size)
{
if (equation->priv->word_size == word_size)
return;
@@ -424,7 +457,7 @@ math_equation_set_word_size(MathEquation *equation, int word_size)
}
-int
+gint
math_equation_get_word_size(MathEquation *equation)
{
return equation->priv->word_size;
@@ -733,7 +766,7 @@ math_equation_insert(MathEquation *equation, const gchar *text)
void
-math_equation_insert_digit(MathEquation *equation, unsigned int digit)
+math_equation_insert_digit(MathEquation *equation, guint digit)
{
static const char *subscript_digits[] = {"â??", "â??", "â??", "â??", "â??", "â??", "â??", "â??", "â??", "â??", NULL};
static const char *superscript_digits[] = {"�", "¹", "²", "³", "�", "�", "�", "�", "�", "�", NULL};
@@ -1199,6 +1232,9 @@ math_equation_set_property(GObject *object,
case PROP_NUMBER_FORMAT:
math_equation_set_number_format(self, g_value_get_int(value));
break;
+ case PROP_BASE:
+ math_equation_set_base(self, g_value_get_int(value));
+ break;
case PROP_WORD_SIZE:
math_equation_set_word_size(self, g_value_get_int(value));
break;
@@ -1252,6 +1288,9 @@ math_equation_get_property(GObject *object,
case PROP_NUMBER_FORMAT:
g_value_set_enum(value, self->priv->format);
break;
+ case PROP_BASE:
+ g_value_set_int(value, math_equation_get_base(self));
+ break;
case PROP_WORD_SIZE:
g_value_set_int(value, self->priv->word_size);
break;
@@ -1362,6 +1401,13 @@ math_equation_class_init (MathEquationClass *klass)
DEC,
G_PARAM_READWRITE));
g_object_class_install_property(object_class,
+ PROP_BASE,
+ g_param_spec_int("base",
+ "base",
+ "Default number base (derived from number-format)",
+ 2, 16, 10,
+ G_PARAM_READWRITE));
+ g_object_class_install_property(object_class,
PROP_WORD_SIZE,
g_param_spec_int("word-size",
"word-size",
diff --git a/src/math-equation.h b/src/math-equation.h
index 7952cbf..3d32ed2 100644
--- a/src/math-equation.h
+++ b/src/math-equation.h
@@ -75,8 +75,8 @@ gboolean math_equation_get_number(MathEquation *equation, MPNumber *z);
void math_equation_set_number_mode(MathEquation *equation, NumberMode mode);
NumberMode math_equation_get_number_mode(MathEquation *equation);
-void math_equation_set_accuracy(MathEquation *equation, int accuracy);
-int math_equation_get_accuracy(MathEquation *equation);
+void math_equation_set_accuracy(MathEquation *equation, gint accuracy);
+gint math_equation_get_accuracy(MathEquation *equation);
void math_equation_set_show_thousands_separators(MathEquation *equation, gboolean visible);
gboolean math_equation_get_show_thousands_separators(MathEquation *equation);
@@ -86,10 +86,12 @@ gboolean math_equation_get_show_trailing_zeroes(MathEquation *equation);
void math_equation_set_number_format(MathEquation *equation, DisplayFormat format);
DisplayFormat math_equation_get_number_format(MathEquation *equation);
+
+void math_equation_set_base(MathEquation *equation, gint base);
gint math_equation_get_base(MathEquation *equation);
-void math_equation_set_word_size(MathEquation *equation, int word_size);
-int math_equation_get_word_size(MathEquation *equation);
+void math_equation_set_word_size(MathEquation *equation, gint word_size);
+gint math_equation_get_word_size(MathEquation *equation);
void math_equation_set_angle_units(MathEquation *equation, MPAngleUnit angle_unit);
MPAngleUnit math_equation_get_angle_units(MathEquation *equation);
diff --git a/src/math-preferences.c b/src/math-preferences.c
index 243b54b..88b06d1 100644
--- a/src/math-preferences.c
+++ b/src/math-preferences.c
@@ -324,9 +324,9 @@ create_gui(MathPreferencesDialog *dialog)
g_signal_connect(dialog->priv->equation, "notify::accuracy", G_CALLBACK(accuracy_cb), dialog);
g_signal_connect(dialog->priv->equation, "notify::show-thousands-separators", G_CALLBACK(show_thousands_separators_cb), dialog);
g_signal_connect(dialog->priv->equation, "notify::show-trailing_zeroes", G_CALLBACK(show_trailing_zeroes_cb), dialog);
- g_signal_connect(dialog->priv->equation, "notify::number_format", G_CALLBACK(number_format_cb), dialog);
+ g_signal_connect(dialog->priv->equation, "notify::number-format", G_CALLBACK(number_format_cb), dialog);
g_signal_connect(dialog->priv->equation, "notify::word-size", G_CALLBACK(word_size_cb), dialog);
- g_signal_connect(dialog->priv->equation, "notify::angle-unit", G_CALLBACK(angle_unit_cb), dialog);
+ g_signal_connect(dialog->priv->equation, "notify::angle-units", G_CALLBACK(angle_unit_cb), dialog);
accuracy_cb(dialog->priv->equation, NULL, dialog);
show_thousands_separators_cb(dialog->priv->equation, NULL, dialog);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]