From: Ben Pfaff Date: Sat, 11 Jun 2011 16:42:22 +0000 (-0700) Subject: gui: Consistently use print format instead of write format. X-Git-Tag: v0.7.9~271 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=49ad45764ab062f60a205dd84d0c3b600f051727;p=pspp-builds.git gui: Consistently use print format instead of write format. In syntax, only the WRITE command uses write formats. Other commands all use print formats. I don't see why the GUI should act differently. --- diff --git a/src/ui/gui/find-dialog.c b/src/ui/gui/find-dialog.c index 11a90594..61f5a50f 100644 --- a/src/ui/gui/find-dialog.c +++ b/src/ui/gui/find-dialog.c @@ -498,7 +498,7 @@ string_value_compare (const struct comparator *cmptr, g_return_val_if_fail (width > 0, false); assert ( ! (cmptr->flags & STR_CMP_LABELS)); - text = value_to_text (*val, cmptr->dict, *var_get_write_format (cmptr->var)); + text = value_to_text (*val, cmptr->dict, *var_get_print_format (cmptr->var)); if ( cmptr->flags & STR_CMP_SUBSTR) found = (NULL != g_strstr_len (text, width, ssc->pattern)); @@ -527,7 +527,7 @@ regexp_value_compare (const struct comparator *cmptr, g_return_val_if_fail (width > 0, false); - text = value_to_text (*val, cmptr->dict, *var_get_write_format (cmptr->var)); + text = value_to_text (*val, cmptr->dict, *var_get_print_format (cmptr->var)); /* We must remove trailing whitespace, otherwise $ will not match where one would expect */ g_strchomp (text); diff --git a/src/ui/gui/missing-val-dialog.c b/src/ui/gui/missing-val-dialog.c index 7222fd1a..4aa940bd 100644 --- a/src/ui/gui/missing-val-dialog.c +++ b/src/ui/gui/missing-val-dialog.c @@ -283,7 +283,7 @@ missing_val_dialog_create (GtkWindow *toplevel) void missing_val_dialog_show (struct missing_val_dialog *dialog) { - const struct fmt_spec *write_spec ; + const struct fmt_spec *format ; gint i; g_return_if_fail (dialog); @@ -291,7 +291,7 @@ missing_val_dialog_show (struct missing_val_dialog *dialog) mv_copy (&dialog->mvl, var_get_missing_values (dialog->pv)); - write_spec = var_get_write_format (dialog->pv); + format = var_get_print_format (dialog->pv); /* Blank all entry boxes and make them insensitive */ gtk_entry_set_text (GTK_ENTRY (dialog->low), ""); @@ -319,8 +319,8 @@ missing_val_dialog_show (struct missing_val_dialog *dialog) mv_get_range (&dialog->mvl, &low.f, &high.f); - low_text = value_to_text (low, dialog->dict, *write_spec); - high_text = value_to_text (high, dialog->dict, *write_spec); + low_text = value_to_text (low, dialog->dict, *format); + high_text = value_to_text (high, dialog->dict, *format); gtk_entry_set_text (GTK_ENTRY (dialog->low), low_text); gtk_entry_set_text (GTK_ENTRY (dialog->high), high_text); @@ -330,7 +330,7 @@ missing_val_dialog_show (struct missing_val_dialog *dialog) if ( mv_has_value (&dialog->mvl)) { gchar *text; - text = value_to_text (*mv_get_value (&dialog->mvl, 0), dialog->dict, *write_spec); + text = value_to_text (*mv_get_value (&dialog->mvl, 0), dialog->dict, *format); gtk_entry_set_text (GTK_ENTRY (dialog->discrete), text); g_free (text); } @@ -352,7 +352,7 @@ missing_val_dialog_show (struct missing_val_dialog *dialog) gchar *text ; text = value_to_text (*mv_get_value (&dialog->mvl, i), dialog->dict, - *write_spec); + *format); gtk_entry_set_text (GTK_ENTRY (dialog->mv[i]), text); g_free (text); } diff --git a/src/ui/gui/psppire-data-store.c b/src/ui/gui/psppire-data-store.c index 9b1b26a2..2fabf4d5 100644 --- a/src/ui/gui/psppire-data-store.c +++ b/src/ui/gui/psppire-data-store.c @@ -621,7 +621,7 @@ psppire_data_store_get_string (PsppireDataStore *store, glong row, glong column) } } - fp = var_get_write_format (pv); + fp = var_get_print_format (pv); text = data_out (&v, dict_get_encoding (dict), fp); @@ -679,7 +679,7 @@ psppire_data_store_set_string (PsppireDataStore *store, psppire_data_store_data_in (store, row, var_get_case_index (pv), ss_cstr (text), - var_get_write_format (pv)); + var_get_print_format (pv)); psppire_sheet_model_range_changed (PSPPIRE_SHEET_MODEL (store), row, col, row, col); diff --git a/src/ui/gui/psppire-dictview.c b/src/ui/gui/psppire-dictview.c index cab7436c..baccea7b 100644 --- a/src/ui/gui/psppire-dictview.c +++ b/src/ui/gui/psppire-dictview.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2009, 2010 Free Software Foundation + Copyright (C) 2009, 2010, 2011 Free Software Foundation This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -344,7 +344,7 @@ var_icon_cell_data_func (GtkTreeViewColumn *col, } else { - const struct fmt_spec *fs = var_get_write_format (var); + const struct fmt_spec *fs = var_get_print_format (var); int cat = fmt_get_category (fs->type); switch ( var_get_measure (var)) { diff --git a/src/ui/gui/psppire-var-sheet.c b/src/ui/gui/psppire-var-sheet.c index 48f34f6d..bf0c0126 100644 --- a/src/ui/gui/psppire-var-sheet.c +++ b/src/ui/gui/psppire-var-sheet.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2008, 2009 Free Software Foundation, Inc. + Copyright (C) 2008, 2009, 2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -433,7 +433,7 @@ var_sheet_change_active_cell (PsppireVarSheet *vs, const gint current_value = g_strtod (s, NULL); GtkObject *adj ; - const struct fmt_spec *fmt = var_get_write_format (var); + const struct fmt_spec *fmt = var_get_print_format (var); switch (column) { case PSPPIRE_VAR_STORE_COL_WIDTH: diff --git a/src/ui/gui/psppire-var-store.c b/src/ui/gui/psppire-var-store.c index e41b4922..50304ba3 100644 --- a/src/ui/gui/psppire-var-store.c +++ b/src/ui/gui/psppire-var-store.c @@ -550,7 +550,7 @@ psppire_var_store_set_string (PsppireSheetModel *model, bool for_input = var_store->format_type == PSPPIRE_VAR_STORE_INPUT_FORMATS; struct fmt_spec fmt ; - fmt = *var_get_write_format (pv); + fmt = *var_get_print_format (pv); if ( width < fmt_min_width (fmt.type, for_input) || width > fmt_max_width (fmt.type, for_input)) @@ -573,7 +573,7 @@ psppire_var_store_set_string (PsppireSheetModel *model, struct fmt_spec fmt; if ( ! text) return FALSE; decimals = atoi (text); - fmt = *var_get_write_format (pv); + fmt = *var_get_print_format (pv); if ( decimals > fmt_max_decimals (fmt.type, fmt.w, @@ -631,7 +631,7 @@ text_for_column (PsppireVarStore *vs, enum {VT_NUMERIC, VT_COMMA, VT_DOT, VT_SCIENTIFIC, VT_DATE, VT_DOLLAR, VT_CUSTOM, VT_STRING}; - const struct fmt_spec *write_spec = var_get_write_format (pv); + const struct fmt_spec *format = var_get_print_format (pv); switch (c) { @@ -640,7 +640,7 @@ text_for_column (PsppireVarStore *vs, break; case PSPPIRE_VAR_STORE_COL_TYPE: { - switch ( write_spec->type ) + switch ( format->type ) { case FMT_F: return xstrdup (gettext (type_label[VT_NUMERIC])); @@ -686,7 +686,7 @@ text_for_column (PsppireVarStore *vs, { char str[FMT_STRING_LEN_MAX + 1]; g_warning ("Unknown format: `%s'\n", - fmt_to_string (write_spec, str)); + fmt_to_string (format, str)); } break; } @@ -696,7 +696,7 @@ text_for_column (PsppireVarStore *vs, { gchar *s; GString *gstr = g_string_sized_new (10); - g_string_printf (gstr, _("%d"), write_spec->w); + g_string_printf (gstr, _("%d"), format->w); s = g_locale_to_utf8 (gstr->str, gstr->len, 0, 0, err); g_string_free (gstr, TRUE); return s; @@ -706,7 +706,7 @@ text_for_column (PsppireVarStore *vs, { gchar *s; GString *gstr = g_string_sized_new (10); - g_string_printf (gstr, _("%d"), write_spec->d); + g_string_printf (gstr, _("%d"), format->d); s = g_locale_to_utf8 (gstr->str, gstr->len, 0, 0, err); g_string_free (gstr, TRUE); return s; @@ -750,7 +750,7 @@ text_for_column (PsppireVarStore *vs, g_assert (vl); { - gchar *const vstr = value_to_text (vl->value, dict, *write_spec); + gchar *const vstr = value_to_text (vl->value, dict, *format); return g_strdup_printf (_("{%s,`%s'}_"), vstr, val_lab_get_escaped_label (vl)); diff --git a/src/ui/gui/val-labs-dialog.c b/src/ui/gui/val-labs-dialog.c index 610e5244..150dcd54 100644 --- a/src/ui/gui/val-labs-dialog.c +++ b/src/ui/gui/val-labs-dialog.c @@ -356,7 +356,7 @@ on_select_row (GtkTreeView *treeview, gpointer data) gchar *text; get_selected_tuple (dialog, &value, &label); - text = value_to_text (value, dialog->dict, *var_get_write_format (dialog->pv)); + text = value_to_text (value, dialog->dict, *var_get_print_format (dialog->pv)); g_signal_handler_block (GTK_ENTRY (dialog->value_entry), dialog->value_handler_id); @@ -510,7 +510,7 @@ repopulate_dialog (struct val_labs_dialog *dialog) gchar *const vstr = value_to_text (vl->value, dialog->dict, - *var_get_write_format (dialog->pv)); + *var_get_print_format (dialog->pv)); gchar *const text = g_strdup_printf (_("%s = `%s'"), vstr, val_lab_get_escaped_label (vl)); diff --git a/src/ui/gui/var-type-dialog.c b/src/ui/gui/var-type-dialog.c index f196e554..fb1977a5 100644 --- a/src/ui/gui/var-type-dialog.c +++ b/src/ui/gui/var-type-dialog.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2005, 2006, 2010 Free Software Foundation + Copyright (C) 2005, 2006, 2010, 2011 Free Software Foundation This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -125,7 +125,7 @@ static void update_width_decimals (const struct var_type_dialog *dialog); static void set_local_width_decimals (struct var_type_dialog *dialog) { - dialog->fmt_l = * var_get_write_format (dialog->pv); + dialog->fmt_l = * var_get_print_format (dialog->pv); switch (dialog->active_button) { @@ -664,21 +664,21 @@ select_treeview_from_format_type (GtkTreeView *treeview, static void var_type_dialog_set_state (struct var_type_dialog *dialog) { - const struct fmt_spec *write_spec ; + const struct fmt_spec *format ; GString *str = g_string_new (""); g_assert (dialog); g_assert (dialog->pv); /* Populate width and decimals */ - write_spec = var_get_write_format (dialog->pv); + format = var_get_print_format (dialog->pv); - g_string_printf (str, "%d", write_spec->d); + g_string_printf (str, "%d", format->d); gtk_entry_set_text (GTK_ENTRY (dialog->entry_decimals), str->str); - g_string_printf (str, "%d", write_spec->w); + g_string_printf (str, "%d", format->w); gtk_entry_set_text (GTK_ENTRY (dialog->entry_width), str->str); @@ -686,7 +686,7 @@ var_type_dialog_set_state (struct var_type_dialog *dialog) g_string_free (str, TRUE); /* Populate the radio button states */ - switch (write_spec->type) + switch (format->type) { case FMT_F: var_type_dialog_set_active_button (dialog, BUTTON_NUMERIC); @@ -709,7 +709,7 @@ var_type_dialog_set_state (struct var_type_dialog *dialog) var_type_dialog_set_active_button (dialog, BUTTON_DOLLAR); gtk_widget_show_all (dialog->width_decimals); - select_treeview_from_format (dialog->dollar_treeview, write_spec); + select_treeview_from_format (dialog->dollar_treeview, format); break; case FMT_DATE: case FMT_EDATE: @@ -727,7 +727,7 @@ var_type_dialog_set_state (struct var_type_dialog *dialog) var_type_dialog_set_active_button (dialog, BUTTON_DATE); gtk_widget_hide (dialog->width_decimals); gtk_widget_show (dialog->date_format_list); - select_treeview_from_format (dialog->date_format_treeview, write_spec); + select_treeview_from_format (dialog->date_format_treeview, format); break; case FMT_CCA: case FMT_CCB: @@ -736,7 +736,7 @@ var_type_dialog_set_state (struct var_type_dialog *dialog) case FMT_CCE: var_type_dialog_set_active_button (dialog, BUTTON_CUSTOM); select_treeview_from_format_type (dialog->custom_treeview, - write_spec->type); + format->type); gtk_widget_show_all (dialog->width_decimals); break; default: