static GOData * gog_xy_dropbar_plot_axis_get_bounds (GogPlot *plot, GogAxisType axis, GogPlotBoundInfo *bounds) { GogXYDropBarPlot *model = GOG_XY_DROPBAR_PLOT (plot); if ((model->horizontal && axis == GOG_AXIS_Y) || (!model->horizontal && axis == GOG_AXIS_X)) { GSList *ptr; bounds->val.minima = model->x.minima; bounds->val.maxima = model->x.maxima; bounds->is_discrete = model->x.minima > model->x.maxima || !go_finite (model->x.minima) || !go_finite (model->x.maxima); if (bounds->fmt == NULL && model->x.fmt != NULL) bounds->fmt = go_format_ref (model->x.fmt); if (model->x.date_conv) bounds->date_conv = model->x.date_conv; for (ptr = plot->series; ptr != NULL ; ptr = ptr->next) if (gog_series_is_valid (GOG_SERIES (ptr->data))) return GOG_SERIES (ptr->data)->values[0].data; return NULL; } if ((model->horizontal && axis == GOG_AXIS_X) || (!model->horizontal && axis == GOG_AXIS_Y)) { bounds->val.minima = model->y.minima; bounds->val.maxima = model->y.maxima; if (bounds->fmt == NULL && model->y.fmt != NULL) bounds->fmt = go_format_ref (model->y.fmt); if (model->y.date_conv) bounds->date_conv = model->y.date_conv; } return NULL; }
static void cb_popup_menu_extend_format (GtkWidget *widget, gpointer data) { StfDialogData *pagedata = data; guint index = pagedata->format.index; GOFormat *colformat = g_ptr_array_index (pagedata->format.formats, pagedata->format.index); for (index++; index < pagedata->format.formats->len; index++) { GOFormat *sf = g_ptr_array_index (pagedata->format.formats, index); GtkTreeViewColumn* column = stf_preview_get_column (pagedata->format.renderdata, index); GtkWidget *w = g_object_get_data (G_OBJECT (column), "formatlabel"); go_format_unref (sf); g_ptr_array_index (pagedata->format.formats, index) = go_format_ref (colformat); gtk_button_set_label (GTK_BUTTON (w), go_format_sel_format_classification (colformat)); } format_page_update_preview (data); }
/** * stf_preview_colformats_add * @renderdata : a struct containing rendering information * @format : the format of the column * * This will add an entry to the @renderdata->colformats array. * The widths of the columns will be set to at least have the width of * the @format. * * returns : nothing **/ void stf_preview_colformats_add (RenderData_t *renderdata, GOFormat *format) { g_return_if_fail (renderdata != NULL); g_return_if_fail (format != NULL); g_ptr_array_add (renderdata->colformats, go_format_ref (format)); }
static void cb_format_clicked (GtkButton *widget, gpointer _i) { int i = GPOINTER_TO_INT (_i); StfDialogData *pagedata = g_object_get_data (G_OBJECT (widget), "pagedata"); gint result; GOFormat *sf; GtkWidget *dialog = gtk_dialog_new_with_buttons (_("Format Selector"), GTK_WINDOW (pagedata->dialog), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL); GOFormatSel *format_selector = GO_FORMAT_SEL (go_format_sel_new_full (TRUE)); GtkWidget *w = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); GtkTreeViewColumn* column; GtkWidget *format_label; sf = g_ptr_array_index (pagedata->format.formats, i); go_format_sel_set_style_format (format_selector, sf); go_format_sel_set_locale (format_selector, pagedata->locale); gtk_box_pack_start (GTK_BOX (w), GTK_WIDGET (format_selector), FALSE, TRUE, 5); gtk_widget_show (GTK_WIDGET (format_selector)); result = gtk_dialog_run (GTK_DIALOG (dialog)); switch (result) { case GTK_RESPONSE_ACCEPT: column = stf_preview_get_column (pagedata->format.renderdata, i); format_label = g_object_get_data (G_OBJECT (column), "formatlabel"); sf = g_ptr_array_index (pagedata->format.formats, i); go_format_unref (sf); sf = go_format_ref (go_format_sel_get_fmt (format_selector)); gtk_button_set_label (GTK_BUTTON (format_label), go_format_sel_format_classification (sf)); g_ptr_array_index (pagedata->format.formats, i) = sf; format_page_update_preview (pagedata); default: break; } gtk_widget_destroy (dialog); return; }
/** * stf_dialog_format_page_prepare * @data: mother struct * * This will prepare the widgets on the format page before * the page gets displayed * * returns : nothing **/ void stf_dialog_format_page_prepare (StfDialogData *data) { GOFormat *general = go_format_general (); /* Set the trim. */ format_page_trim_menu_changed (NULL, data); /* If necessary add new items (non-visual) */ while ((int)data->format.formats->len < data->format.renderdata->colcount) g_ptr_array_add (data->format.formats, go_format_ref (general)); data->format.manual_change = TRUE; activate_column (data, 0); }