[goffice] Fixed a couple of issues in XYZ contour and surface plots.
- From: Jean Bréfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Fixed a couple of issues in XYZ contour and surface plots.
- Date: Mon, 10 Jun 2013 16:03:28 +0000 (UTC)
commit c572d35e762a83f3e6f0b0125c7ce91a0ca2a4f9
Author: Jean Brefort <jean brefort normalesup org>
Date: Mon Jun 10 18:01:09 2013 +0200
Fixed a couple of issues in XYZ contour and surface plots.
ChangeLog | 11 +++++++++
plugins/plot_surface/gog-xyz-surface-prefs.c | 15 +++++++------
plugins/plot_surface/gog-xyz-surface.c | 29 +++++++++++++------------
plugins/plot_surface/gog-xyz-surface.h | 2 +
4 files changed, 36 insertions(+), 21 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0d229a3..70c7165 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2013-06-10 Jean Brefort <jean brefort normalesup org>
+
+ * plugins/plot_surface/gog-xyz-surface-prefs.c
+ (cb_missing_as_changed), (gog_xyz_surface_plot_pref): fixed "missing as"
+ combo box.
+ * plugins/plot_surface/gog-xyz-surface.c
+ (gog_xyz_matrix_plot_build_matrix),
+ (gog_xyz_surface_plot_build_matrix),
+ (gog_xyz_surface_plot_set_property): force update when bins change.
+ * plugins/plot_surface/gog-xyz-surface.h: make two halper functions public.
+
2013-06-09 Jean Brefort <jean brefort normalesup org>
* goffice/graph/gog-axis.c (gog_axis_get_color_scale): make public.
diff --git a/plugins/plot_surface/gog-xyz-surface-prefs.c b/plugins/plot_surface/gog-xyz-surface-prefs.c
index e73c312..6de830d 100644
--- a/plugins/plot_surface/gog-xyz-surface-prefs.c
+++ b/plugins/plot_surface/gog-xyz-surface-prefs.c
@@ -79,10 +79,10 @@ cb_rows_toggled (GtkToggleButton *btn, XYZSurfPrefsState *state)
}
static void
-cb_missing_as_changed (GtkComboBoxText *box, XYZSurfPrefsState *state)
+cb_missing_as_changed (GtkComboBox *box, XYZSurfPrefsState *state)
{
g_object_set (state->plot,
- "missing-as", gtk_combo_box_text_get_active_text (box),
+ "missing-as", missing_as_string (gtk_combo_box_get_active (box)),
NULL);
}
@@ -101,7 +101,6 @@ gog_xyz_surface_plot_pref (GogXYZPlot *plot, GogDataAllocator *dalloc, GOCmdCont
GogDataset *set = GOG_DATASET (plot);
XYZSurfPrefsState *state;
GtkWidget *w, *grid;
- int prop;
GtkBuilder *gui =
go_gtk_builder_load ("res:go:plot_surface/gog-xyz-surface-prefs.ui",
GETTEXT_PACKAGE, cc);
@@ -157,17 +156,19 @@ gog_xyz_surface_plot_pref (GogXYZPlot *plot, GogDataAllocator *dalloc, GOCmdCont
w = go_gtk_builder_get_widget (gui, "missing-as-btn");
if (GOG_PLOT (plot)->desc.series.num_dim == 2) {
+ gboolean as_density;
gtk_widget_hide (w);
gtk_widget_hide (go_gtk_builder_get_widget (gui, "missing-lbl"));
w = gtk_check_button_new_with_label (_("Display population density"));
gtk_container_add (GTK_CONTAINER (grid), w);
gtk_widget_show (w);
- g_object_get (plot, "as-density", &prop, NULL);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), prop);
+ g_object_get (plot, "as-density", &as_density, NULL);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), as_density);
g_signal_connect (G_OBJECT (w), "toggled", G_CALLBACK (cb_as_density_toggled), state);
} else {
- g_object_get (plot, "missing-as", &prop, NULL);
- gtk_combo_box_set_active (GTK_COMBO_BOX (w), prop);
+ char const *missing;
+ g_object_get (plot, "missing-as", &missing, NULL);
+ gtk_combo_box_set_active (GTK_COMBO_BOX (w), missing_as_value (missing));
g_signal_connect (G_OBJECT (w), "changed", G_CALLBACK (cb_missing_as_changed), state);
}
diff --git a/plugins/plot_surface/gog-xyz-surface.c b/plugins/plot_surface/gog-xyz-surface.c
index 5600856..4efd581 100644
--- a/plugins/plot_surface/gog-xyz-surface.c
+++ b/plugins/plot_surface/gog-xyz-surface.c
@@ -42,7 +42,7 @@ static struct {unsigned n; char const *name;} missing_as_strings[] =
{XYZ_SURFACE_MISSING_AS_ZERO, "0"}
};
-static char const *
+char const *
missing_as_string (unsigned n)
{
unsigned i;
@@ -52,7 +52,7 @@ missing_as_string (unsigned n)
return "invalid"; /* default property value */
}
-static unsigned
+unsigned
missing_as_value (char const *name)
{
unsigned i;
@@ -108,13 +108,13 @@ gog_xyz_matrix_plot_build_matrix (GogXYZPlot *plot, gboolean *cardinality_change
if (GOG_IS_XYZ_MATRIX_PLOT (plot)) {
GogXYZMatrixPlot *xyz = GOG_XYZ_MATRIX_PLOT (plot);
- if (xyz->grid[0].data) {
+ if (!plot->auto_x && xyz->grid[0].data) {
if (xyz->base.x_vals)
g_object_unref (xyz->base.x_vals);
xyz->base.x_vals = g_object_ref (xyz->grid[0].data);
xyz->base.columns = go_data_get_vector_size (plot->x_vals) - 1;
}
- if (xyz->grid[1].data) {
+ if (!plot->auto_y && xyz->grid[1].data) {
if (xyz->base.y_vals)
g_object_unref (xyz->base.y_vals);
xyz->base.y_vals = g_object_ref (xyz->grid[1].data);
@@ -122,13 +122,13 @@ gog_xyz_matrix_plot_build_matrix (GogXYZPlot *plot, gboolean *cardinality_change
}
} else {
GogXYMatrixPlot *xyz = GOG_XY_MATRIX_PLOT (plot);
- if (xyz->grid[0].data) {
+ if (!plot->auto_x && xyz->grid[0].data) {
if (xyz->base.x_vals)
g_object_unref (xyz->base.x_vals);
xyz->base.x_vals = g_object_ref (xyz->grid[0].data);
xyz->base.columns = go_data_get_vector_size (plot->x_vals) - 1;
}
- if (xyz->grid[1].data) {
+ if (!plot->auto_y && xyz->grid[1].data) {
if (xyz->base.y_vals)
g_object_unref (xyz->base.y_vals);
xyz->base.y_vals = g_object_ref (xyz->grid[1].data);
@@ -232,13 +232,13 @@ gog_xyz_surface_plot_build_matrix (GogXYZPlot *plot, gboolean *cardinality_chang
if (GOG_IS_CONTOUR_PLOT (plot)) {
if (is_3d) {
GogXYZContourPlot *xyz = GOG_XYZ_CONTOUR_PLOT (plot);
- if (xyz->grid[0].data) {
+ if (!plot->auto_x && xyz->grid[0].data) {
if (plot->x_vals)
g_object_unref (plot->x_vals);
plot->x_vals = g_object_ref (xyz->grid[0].data);
plot->columns = go_data_get_vector_size (plot->x_vals);
}
- if (xyz->grid[1].data) {
+ if (!plot->auto_y && xyz->grid[1].data) {
if (plot->y_vals)
g_object_unref (plot->y_vals);
plot->y_vals = g_object_ref (xyz->grid[1].data);
@@ -246,13 +246,13 @@ gog_xyz_surface_plot_build_matrix (GogXYZPlot *plot, gboolean *cardinality_chang
}
} else {
GogXYContourPlot *xyz = GOG_XY_CONTOUR_PLOT (plot);
- if (xyz->grid[0].data) {
+ if (!plot->auto_x && xyz->grid[0].data) {
if (plot->x_vals)
g_object_unref (plot->x_vals);
plot->x_vals = g_object_ref (xyz->grid[0].data);
plot->columns = go_data_get_vector_size (plot->x_vals);
}
- if (xyz->grid[1].data) {
+ if (!plot->auto_y && xyz->grid[1].data) {
if (plot->y_vals)
g_object_unref (plot->y_vals);
plot->y_vals = g_object_ref (xyz->grid[1].data);
@@ -262,13 +262,13 @@ gog_xyz_surface_plot_build_matrix (GogXYZPlot *plot, gboolean *cardinality_chang
} else {
if (is_3d) {
GogXYZSurfacePlot *xyz = GOG_XYZ_SURFACE_PLOT (plot);
- if (xyz->grid[0].data) {
+ if (!plot->auto_x && xyz->grid[0].data) {
if (xyz->base.x_vals)
g_object_unref (xyz->base.x_vals);
xyz->base.x_vals = g_object_ref (xyz->grid[0].data);
xyz->base.columns = go_data_get_vector_size (plot->x_vals);
}
- if (xyz->grid[1].data) {
+ if (!plot->auto_y && xyz->grid[1].data) {
if (xyz->base.y_vals)
g_object_unref (xyz->base.y_vals);
xyz->base.y_vals = g_object_ref (xyz->grid[1].data);
@@ -276,13 +276,13 @@ gog_xyz_surface_plot_build_matrix (GogXYZPlot *plot, gboolean *cardinality_chang
}
} else {
GogXYSurfacePlot *xyz = GOG_XY_SURFACE_PLOT (plot);
- if (xyz->grid[0].data) {
+ if (!plot->auto_x && xyz->grid[0].data) {
if (xyz->base.x_vals)
g_object_unref (xyz->base.x_vals);
xyz->base.x_vals = g_object_ref (xyz->grid[0].data);
xyz->base.columns = go_data_get_vector_size (plot->x_vals);
}
- if (xyz->grid[1].data) {
+ if (!plot->auto_y && xyz->grid[1].data) {
if (xyz->base.y_vals)
g_object_unref (xyz->base.y_vals);
xyz->base.y_vals = g_object_ref (xyz->grid[1].data);
@@ -639,6 +639,7 @@ gog_xyz_surface_plot_set_property (GObject *obj, guint param_id,
default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
return; /* NOTE : RETURN */
}
+ gog_object_request_update (GOG_OBJECT (obj));
gog_object_emit_changed (GOG_OBJECT (obj), FALSE);
}
diff --git a/plugins/plot_surface/gog-xyz-surface.h b/plugins/plot_surface/gog-xyz-surface.h
index 09fe3f2..fb2afb0 100644
--- a/plugins/plot_surface/gog-xyz-surface.h
+++ b/plugins/plot_surface/gog-xyz-surface.h
@@ -34,6 +34,8 @@ G_BEGIN_DECLS
*
*-----------------------------------------------------------------------------
*/
+char const *missing_as_string (unsigned n);
+unsigned missing_as_value (char const *name);
typedef struct {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]