return rect.width;
}
+/* Callback for the axis' resize signal.
+ Changes the variable's display width */
+static void
+rewidth_variable (PsppireDataEditor *de, gint unit, glong size)
+{
+ const PsppireDict *dict = de->data_store->dict;
+ struct variable *var = psppire_dict_get_variable (dict, unit);
+
+ var_set_display_width (var, size / (float) width_of_m (de));
+}
+
+
static void
new_variables_callback (PsppireDict *dict, gpointer data)
{
PsppireAxisImpl *haxis;
g_object_get (de->data_sheet[i], "horizontal-axis", &haxis, NULL);
+ g_signal_connect_swapped (haxis, "resize-unit",
+ G_CALLBACK (rewidth_variable), de);
+
psppire_axis_impl_clear (haxis);
for (v = 0 ; v < psppire_dict_get_var_cnt (dict); ++v)
psppire_axis_impl_delete (var_vaxis, posn, 1);
- for (i = 0 ; i < 4 ; ++i)
- {
- PsppireAxisImpl *haxis;
- g_object_get (de->data_sheet[i], "horizontal-axis", &haxis, NULL);
- psppire_axis_impl_delete (haxis, posn, 1);
- }
+ {
+ PsppireAxisImpl *haxis;
+ g_object_get (de->data_sheet[0], "horizontal-axis", &haxis, NULL);
+
+ psppire_axis_impl_delete (haxis, posn, 1);
+ }
}