[goffice] Update circular axis bounds after a unit change. [#746738]



commit 82486e0d3125ea1c1e31ef96cd442b71cc523648
Author: Jean Brefort <jean brefort normalesup org>
Date:   Tue Mar 31 15:05:27 2015 +0200

    Update circular axis bounds after a unit change. [#746738]

 ChangeLog                |    6 ++++++
 NEWS                     |    1 +
 goffice/graph/gog-axis.c |   21 +++++++++++++++------
 3 files changed, 22 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9998841..d2ef9a7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-03-31  Jean Brefort  <jean brefort normalesup org>
+
+       * goffice/graph/gog-axis.c (make_dim_editor),
+       (cb_polar_unit_changed), (gog_axis_populate_editor): update circular axis 
+       bounds after a unit change. [#746738]
+
 2015-03-28  Jean Brefort  <jean brefort normalesup org>
 
        * plugins/plot_xy/gog-xy.c (gog_xy_view_render): protect colored xy and
diff --git a/NEWS b/NEWS
index c18c1bb..0f1b899 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ goffice 0.10.22:
 Jean:
        * Fix selection of axes using only part fo the plot area. [#746456]
        * Protect colored xy and bubble plots against NULL z values.
+       * Update circular axis bounds after a unit change. [#746738]
 
 Johannes Deutsch:
        * Do not draw the line over the arrow head at start. [#745736]
diff --git a/goffice/graph/gog-axis.c b/goffice/graph/gog-axis.c
index f49e55a..6d8688a 100644
--- a/goffice/graph/gog-axis.c
+++ b/goffice/graph/gog-axis.c
@@ -2687,6 +2687,7 @@ typedef struct {
        GtkComboBox *color_map_combo;
        GOCmdContext *cc;
        GtkBuilder *gui;
+       GogDataEditor *de[GOG_AXIS_ELEM_CROSS_POINT];
 } GogAxisPrefState;
 
 static void
@@ -2764,7 +2765,7 @@ cb_update_dim_editor (GogObject *gobj, ElemToggleData *closure)
        g_signal_handler_unblock (closure->toggle, closure->toggle_handler);
 }
 
-static void
+static GogDataEditor *
 make_dim_editor (GogDataset *set, GtkGrid *grid, unsigned dim,
                 GogDataAllocator *dalloc, char const *dim_name)
 {
@@ -2808,7 +2809,7 @@ make_dim_editor (GogDataset *set, GtkGrid *grid, unsigned dim,
        g_object_set (G_OBJECT (editor), "hexpand", TRUE, NULL);
        gtk_grid_attach (grid, editor,
                1, dim + 1, 1, 1);
-
+       return GOG_DATA_EDITOR (editor);
 }
 
 static void
@@ -2847,6 +2848,7 @@ cb_polar_unit_changed (GtkComboBox *combo,
 {
        GogAxis *axis = state->axis;
        GOFormat *format;
+       int i;
 
        axis->polar_unit = gtk_combo_box_get_active (combo);
        format = go_format_new_from_XL (polar_units[axis->polar_unit].xl_format);
@@ -2854,6 +2856,13 @@ cb_polar_unit_changed (GtkComboBox *combo,
        if (gog_axis_set_format (axis, format) &&
            state->format_selector != NULL)
                go_format_sel_set_style_format (GO_FORMAT_SEL (state->format_selector), format);
+       gog_axis_auto_bound (axis);
+       for (i = GOG_AXIS_ELEM_MIN; i < GOG_AXIS_ELEM_CROSS_POINT; i++) {
+               GOData *data = gog_dataset_get_dim (GOG_DATASET (axis), i);
+               gog_data_editor_set_value_double (state->de[i],
+                                                     (data)? go_data_get_scalar_value (data): 
axis->auto_bound[i],
+                                                     axis->date_conv);
+       }
 }
 
 static void
@@ -3098,8 +3107,8 @@ gog_axis_populate_editor (GogObject *gobj,
                        N_("Categories between _labels")
                };
                for (i = GOG_AXIS_ELEM_MIN; i < GOG_AXIS_ELEM_CROSS_POINT ; i++)
-                       make_dim_editor (set, grid, i, dalloc,
-                                        _(dim_names[i]));
+                       state->de[i] = make_dim_editor (set, grid, i, dalloc,
+                                                       _(dim_names[i]));
        } else {
                static char const * const dim_names[] = {
                        N_("M_inimum"),
@@ -3109,8 +3118,8 @@ gog_axis_populate_editor (GogObject *gobj,
                };
 
                for (i = GOG_AXIS_ELEM_MIN; i < GOG_AXIS_ELEM_CROSS_POINT ; i++)
-                       make_dim_editor (set, grid, i, dalloc,
-                                        _(dim_names[i]));
+                       state->de[i] = make_dim_editor (set, grid, i, dalloc,
+                                                       _(dim_names[i]));
        }
        gtk_widget_show_all (GTK_WIDGET (grid));
 


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