g_return_if_fail (allocation != NULL);
ce = PSPPIRE_CUSTOM_ENTRY (widget);
- button_width = psppire_custom_entry_get_button_width(ce);
+ button_width = psppire_custom_entry_get_button_width (ce);
panel_width = button_width + 2 * widget->style->xthickness;
widget->allocation = *allocation;
void open_data_window (GtkMenuItem *, gpointer);
-void data_editor_select_sheet(struct data_editor *de, gint page);
+void data_editor_select_sheet (struct data_editor *de, gint page);
#endif
gint n_vars;
PsppireDataStore *data_store =
- PSPPIRE_DATA_STORE(gtk_sheet_get_model(sheet));
+ PSPPIRE_DATA_STORE(gtk_sheet_get_model (sheet));
g_assert (data_store);
- n_vars = psppire_dict_get_var_cnt(data_store->dict);
+ n_vars = psppire_dict_get_var_cnt (data_store->dict);
if ( *new_column >= n_vars )
return FALSE;
- case_count = psppire_case_file_get_case_count(data_store->case_file);
+ case_count = psppire_case_file_get_case_count (data_store->case_file);
if ( *new_row >= case_count )
{
/* Update the data_ref_entry with the reference of the active cell */
gint
-update_data_ref_entry(const GtkSheet *sheet, gint row, gint col)
+update_data_ref_entry (const GtkSheet *sheet, gint row, gint col)
{
GladeXML *data_editor_xml = NULL; /* FIXME !!!! */
/* The entry where the reference to the current cell is displayed */
GtkEntry *cell_ref_entry;
- PsppireDataStore *data_store = PSPPIRE_DATA_STORE(gtk_sheet_get_model(sheet));
+ PsppireDataStore *data_store = PSPPIRE_DATA_STORE(gtk_sheet_get_model (sheet));
if (data_store)
{
const struct variable *pv =
- psppire_dict_get_variable(data_store->dict, col);
+ psppire_dict_get_variable (data_store->dict, col);
gchar *text ;
gchar *s ;
if ( !data_editor_xml)
return FALSE;
- text = g_strdup_printf("%d: %s", row,
+ text = g_strdup_printf ("%d: %s", row,
pv ? var_get_name (pv) : "");
cell_ref_entry = GTK_ENTRY(get_widget_assert (data_editor_xml,
"cell_ref_entry"));
- s = pspp_locale_to_utf8(text, -1, 0);
+ s = pspp_locale_to_utf8 (text, -1, 0);
- g_free(text);
+ g_free (text);
- gtk_entry_set_text(cell_ref_entry, s);
+ gtk_entry_set_text (cell_ref_entry, s);
- g_free(s);
+ g_free (s);
}
return FALSE;
/* Return the width that an 'M' character would occupy when typeset in WIDGET */
static guint
-calc_m_width(GtkWidget *widget, const PangoFontDescription *font_desc)
+calc_m_width (GtkWidget *widget, const PangoFontDescription *font_desc)
{
PangoRectangle rect;
PangoLayout *layout ;
pango_layout_get_extents (layout, NULL, &rect);
- g_object_unref(G_OBJECT(layout));
- g_object_unref(G_OBJECT(context));
+ g_object_unref (G_OBJECT(layout));
+ g_object_unref (G_OBJECT(context));
return PANGO_PIXELS(rect.width);
}
void
-font_change_callback(GObject *obj, gpointer data)
+font_change_callback (GObject *obj, gpointer data)
{
GtkWidget *sheet = data;
PsppireDataStore *ds = PSPPIRE_DATA_STORE(obj);
- ds->width_of_m = calc_m_width(sheet, ds->font_desc);
+ ds->width_of_m = calc_m_width (sheet, ds->font_desc);
}
GtkWidget*
{
GtkWidget *sheet;
- sheet = gtk_sheet_new(G_SHEET_ROW(the_data_store),
+ sheet = gtk_sheet_new (G_SHEET_ROW(the_data_store),
G_SHEET_COLUMN(the_data_store), "data sheet", 0);
- the_data_store->width_of_m = calc_m_width(sheet, the_data_store->font_desc);
+ the_data_store->width_of_m = calc_m_width (sheet, the_data_store->font_desc);
g_signal_connect (G_OBJECT (sheet), "activate",
G_CALLBACK (update_data_ref_entry),
g_signal_connect (G_OBJECT (the_data_store), "font-changed",
G_CALLBACK (font_change_callback), sheet);
- gtk_sheet_set_active_cell(GTK_SHEET(sheet), -1, -1);
+ gtk_sheet_set_active_cell (GTK_SHEET(sheet), -1, -1);
- gtk_sheet_set_model(sheet, G_SHEET_MODEL(the_data_store));
+ gtk_sheet_set_model (sheet, G_SHEET_MODEL(the_data_store));
- gtk_widget_show(sheet);
+ gtk_widget_show (sheet);
return sheet;
}
#include <gtksheet/gtksheet.h>
#include "psppire-dict.h"
-void psppire_data_sheet_clear(GtkSheet *sheet);
+void psppire_data_sheet_clear (GtkSheet *sheet);
#if 0
-void psppire_data_sheet_set_dictionary(GtkSheet *sheet, PsppireDict *d);
+void psppire_data_sheet_set_dictionary (GtkSheet *sheet, PsppireDict *d);
#endif
GtkWidget* psppire_data_sheet_create (gchar *widget_name,
gint int1, gint int2);
-void data_sheet_set_cell_value(GtkSheet *sheet, gint row, gint col,
+void data_sheet_set_cell_value (GtkSheet *sheet, gint row, gint col,
const GValue *value);
-void psppire_data_sheet_set_show_labels(GtkSheet *sheet, gboolean show_labels);
+void psppire_data_sheet_set_show_labels (GtkSheet *sheet, gboolean show_labels);
/* Repair any damage that may have been done to the data sheet */
-void psppire_data_sheet_redisplay(GtkSheet *sheet);
+void psppire_data_sheet_redisplay (GtkSheet *sheet);
-guint columnWidthToPixels(GtkSheet *sheet, gint column, guint width);
+guint columnWidthToPixels (GtkSheet *sheet, gint column, guint width);
#endif
static struct casefile *
-produce_flexifile(struct casefile_factory *this UNUSED, size_t value_cnt)
+produce_flexifile (struct casefile_factory *this UNUSED, size_t value_cnt)
{
struct casefile *ff = flexifile_create (value_cnt);
/* Formats a value according to FORMAT
The returned string must be freed when no longer required */
gchar *
-value_to_text(union value v, struct fmt_spec format)
+value_to_text (union value v, struct fmt_spec format)
{
gchar *s = 0;
- s = g_new(gchar, format.w + 1);
- data_out(&v, &format, s);
+ s = g_new (gchar, format.w + 1);
+ data_out (&v, &format, s);
s[format.w]='\0';
- g_strchug(s);
+ g_strchug (s);
return s;
}
gboolean
-text_to_value(const gchar *text, union value *v,
+text_to_value (const gchar *text, union value *v,
struct fmt_spec format)
{
bool ok;
{
const gchar *s = text;
- while(*s)
+ while (*s)
{
- if ( !isspace(*s))
+ if ( !isspace (*s))
break;
s++;
}
GtkWidget *
-get_widget_assert(GladeXML *xml, const gchar *name)
+get_widget_assert (GladeXML *xml, const gchar *name)
{
GtkWidget *w;
- g_assert(xml);
- g_assert(name);
+ g_assert (xml);
+ g_assert (name);
- w = glade_xml_get_widget(xml, name);
+ w = glade_xml_get_widget (xml, name);
if ( !w )
- g_warning("Widget \"%s\" could not be found\n", name);
+ g_warning ("Widget \"%s\" could not be found\n", name);
return w;
}
/* Converts a string in the pspp locale to utf-8 */
char *
-pspp_locale_to_utf8(const gchar *text, gssize len, GError **err)
+pspp_locale_to_utf8 (const gchar *text, gssize len, GError **err)
{
- return recode_string(CONV_PSPP_TO_UTF8, text, len);
+ return recode_string (CONV_PSPP_TO_UTF8, text, len);
}
/* Formats a value according to FORMAT
The returned string must be freed when no longer required */
-gchar * value_to_text(union value v, struct fmt_spec format);
+gchar * value_to_text (union value v, struct fmt_spec format);
-gboolean text_to_value(const gchar *text, union value *v,
+gboolean text_to_value (const gchar *text, union value *v,
struct fmt_spec format);
-GtkWidget * get_widget_assert(GladeXML *xml, const gchar *name);
+GtkWidget * get_widget_assert (GladeXML *xml, const gchar *name);
/* Converts a string in the pspp locale to utf-8 */
-char * pspp_locale_to_utf8(const gchar *text, gssize len, GError **err);
+char * pspp_locale_to_utf8 (const gchar *text, gssize len, GError **err);
#endif
void
message_dialog_init (struct source_stream *ss)
{
- message_queue = g_queue_new();
+ message_queue = g_queue_new ();
msg_init (ss, enqueue_msg);
}
void
message_dialog_done (void)
{
- msg_done();
- g_queue_free(message_queue);
+ msg_done ();
+ g_queue_free (message_queue);
}
static gboolean
-dequeue_message(gpointer data)
+dequeue_message (gpointer data)
{
struct msg * m ;
a modal dialog box, will cause an impossible situation.
So don't pop it up just yet.
*/
- if ( gdk_pointer_is_grabbed())
+ if ( gdk_pointer_is_grabbed ())
return TRUE;
- m = g_queue_pop_tail(message_queue);
+ m = g_queue_pop_tail (message_queue);
if ( m )
{
- popup_message(m);
- msg_destroy(m);
+ popup_message (m);
+ msg_destroy (m);
return TRUE;
}
}
static void
-enqueue_msg(const struct msg *msg)
+enqueue_msg (const struct msg *msg)
{
- struct msg *m = msg_dup(msg);
+ struct msg *m = msg_dup (msg);
- g_queue_push_head(message_queue, m);
+ g_queue_push_head (message_queue, m);
- g_idle_add(dequeue_message, 0);
+ g_idle_add (dequeue_message, 0);
}
void
-popup_message(const struct msg *m)
+popup_message (const struct msg *m)
{
GtkWindow *parent;
GtkWidget *dialog;
GTK_BUTTONS_CLOSE,
msg);
- gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG(dialog),
_("%s (line %d) %s"),
m->where.file_name,
m->where.line_number,
gtk_window_set_keep_above (GTK_WINDOW(dialog), TRUE);
- gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_dialog_run (GTK_DIALOG(dialog));
gtk_widget_destroy (dialog);
}
void message_dialog_init (struct source_stream *);
void message_dialog_done (void);
-void popup_message(const struct msg *m);
+void popup_message (const struct msg *m);
#endif
/* A simple (sub) dialog box for displaying user input errors */
static void
-err_dialog(const gchar *msg, GtkWindow *window)
+err_dialog (const gchar *msg, GtkWindow *window)
{
GtkWidget *hbox ;
GtkWidget *label = gtk_label_new (msg);
NULL);
- GtkWidget *icon = gtk_image_new_from_stock(GTK_STOCK_DIALOG_ERROR,
+ GtkWidget *icon = gtk_image_new_from_stock (GTK_STOCK_DIALOG_ERROR,
GTK_ICON_SIZE_DIALOG);
g_signal_connect_swapped (dialog,
G_CALLBACK (gtk_widget_destroy),
dialog);
- hbox = gtk_hbox_new(FALSE, 10);
+ hbox = gtk_hbox_new (FALSE, 10);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox),
hbox);
- gtk_box_pack_start(GTK_BOX(hbox), icon, TRUE, FALSE, 10);
- gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 10);
+ gtk_box_pack_start (GTK_BOX(hbox), icon, TRUE, FALSE, 10);
+ gtk_box_pack_start (GTK_BOX(hbox), label, TRUE, TRUE, 10);
gtk_widget_show_all (dialog);
}
/* Callback which occurs when the OK button is clicked */
static void
-missing_val_dialog_accept(GtkWidget *w, gpointer data)
+missing_val_dialog_accept (GtkWidget *w, gpointer data)
{
struct missing_val_dialog *dialog = data;
const struct fmt_spec *write_spec = var_get_write_format (dialog->pv);
- if ( gtk_toggle_button_get_active(dialog->button_discrete))
+ if ( gtk_toggle_button_get_active (dialog->button_discrete))
{
gint nvals = 0;
gint badvals = 0;
gint i;
- mv_clear(&dialog->mvl);
- for(i = 0 ; i < 3 ; ++i )
+ mv_clear (&dialog->mvl);
+ for (i = 0 ; i < 3 ; ++i )
{
gchar *text =
- g_strdup(gtk_entry_get_text(GTK_ENTRY(dialog->mv[i])));
+ g_strdup (gtk_entry_get_text (GTK_ENTRY(dialog->mv[i])));
union value v;
- if ( !text || strlen(g_strstrip(text)) == 0 )
+ if ( !text || strlen (g_strstrip (text)) == 0 )
{
- g_free(text);
+ g_free (text);
continue;
}
- if ( text_to_value(text, &v, *write_spec))
+ if ( text_to_value (text, &v, *write_spec))
{
nvals++;
mv_add_value (&dialog->mvl, &v);
}
else
badvals++;
- g_free(text);
+ g_free (text);
}
if ( nvals == 0 || badvals > 0 )
{
- err_dialog(_("Incorrect value for variable type"),
+ err_dialog (_("Incorrect value for variable type"),
GTK_WINDOW(dialog->window));
return ;
}
}
- if (gtk_toggle_button_get_active(dialog->button_range))
+ if (gtk_toggle_button_get_active (dialog->button_range))
{
gchar *discrete_text ;
union value low_val ;
union value high_val;
- const gchar *low_text = gtk_entry_get_text(GTK_ENTRY(dialog->low));
- const gchar *high_text = gtk_entry_get_text(GTK_ENTRY(dialog->high));
+ const gchar *low_text = gtk_entry_get_text (GTK_ENTRY(dialog->low));
+ const gchar *high_text = gtk_entry_get_text (GTK_ENTRY(dialog->high));
- if ( text_to_value(low_text, &low_val, *write_spec)
+ if ( text_to_value (low_text, &low_val, *write_spec)
&&
- text_to_value(high_text, &high_val, *write_spec) )
+ text_to_value (high_text, &high_val, *write_spec) )
{
if ( low_val.f > high_val.f )
{
- err_dialog(_("Incorrect range specification"),
+ err_dialog (_("Incorrect range specification"),
GTK_WINDOW(dialog->window));
return ;
}
}
else
{
- err_dialog(_("Incorrect range specification"),
+ err_dialog (_("Incorrect range specification"),
GTK_WINDOW(dialog->window));
return;
}
discrete_text =
- g_strdup(gtk_entry_get_text(GTK_ENTRY(dialog->discrete)));
+ g_strdup (gtk_entry_get_text (GTK_ENTRY(dialog->discrete)));
- mv_clear(&dialog->mvl);
- mv_add_num_range(&dialog->mvl, low_val.f, high_val.f);
+ mv_clear (&dialog->mvl);
+ mv_add_num_range (&dialog->mvl, low_val.f, high_val.f);
- if ( discrete_text && strlen(g_strstrip(discrete_text)) > 0 )
+ if ( discrete_text && strlen (g_strstrip (discrete_text)) > 0 )
{
union value discrete_val;
- if ( !text_to_value(discrete_text, &discrete_val,
+ if ( !text_to_value (discrete_text, &discrete_val,
*write_spec))
{
- err_dialog(_("Incorrect value for variable type"),
+ err_dialog (_("Incorrect value for variable type"),
GTK_WINDOW(dialog->window) );
- g_free(discrete_text);
+ g_free (discrete_text);
return;
}
- mv_add_value(&dialog->mvl, &discrete_val);
+ mv_add_value (&dialog->mvl, &discrete_val);
}
- g_free(discrete_text);
+ g_free (discrete_text);
}
- if (gtk_toggle_button_get_active(dialog->button_none))
- mv_clear(&dialog->mvl);
+ if (gtk_toggle_button_get_active (dialog->button_none))
+ mv_clear (&dialog->mvl);
var_set_missing_values (dialog->pv, &dialog->mvl);
/* Callback which occurs when the 'discrete' radiobutton is toggled */
static void
-discrete(GtkToggleButton *button, gpointer data)
+discrete (GtkToggleButton *button, gpointer data)
{
gint i;
struct missing_val_dialog *dialog = data;
- for(i = 0 ; i < 3 ; ++i )
+ for (i = 0 ; i < 3 ; ++i )
{
- gtk_widget_set_sensitive(dialog->mv[i],
- gtk_toggle_button_get_active(button));
+ gtk_widget_set_sensitive (dialog->mv[i],
+ gtk_toggle_button_get_active (button));
}
}
/* Callback which occurs when the 'range' radiobutton is toggled */
static void
-range(GtkToggleButton *button, gpointer data)
+range (GtkToggleButton *button, gpointer data)
{
struct missing_val_dialog *dialog = data;
const gboolean active = gtk_toggle_button_get_active (button);
- gtk_widget_set_sensitive(dialog->low, active);
- gtk_widget_set_sensitive(dialog->high, active);
- gtk_widget_set_sensitive(dialog->discrete, active);
+ gtk_widget_set_sensitive (dialog->low, active);
+ gtk_widget_set_sensitive (dialog->high, active);
+ gtk_widget_set_sensitive (dialog->discrete, active);
}
/* Creates the dialog structure from the xml */
struct missing_val_dialog *
-missing_val_dialog_create(GladeXML *xml)
+missing_val_dialog_create (GladeXML *xml)
{
- struct missing_val_dialog *dialog = g_malloc(sizeof(*dialog));
+ struct missing_val_dialog *dialog = g_malloc (sizeof (*dialog));
- dialog->window = get_widget_assert(xml, "missing_values_dialog");
+ dialog->window = get_widget_assert (xml, "missing_values_dialog");
gtk_window_set_transient_for
(GTK_WINDOW(dialog->window),
- GTK_WINDOW(get_widget_assert(xml, "data_editor")));
+ GTK_WINDOW(get_widget_assert (xml, "data_editor")));
- g_signal_connect_swapped(get_widget_assert(xml, "missing_val_cancel"),
+ g_signal_connect_swapped (get_widget_assert (xml, "missing_val_cancel"),
"clicked", G_CALLBACK(gtk_widget_hide), dialog->window);
- g_signal_connect(get_widget_assert(xml, "missing_val_ok"),
+ g_signal_connect (get_widget_assert (xml, "missing_val_ok"),
"clicked", G_CALLBACK(missing_val_dialog_accept), dialog);
- dialog->mv[0] = get_widget_assert(xml, "mv0");
- dialog->mv[1] = get_widget_assert(xml, "mv1");
- dialog->mv[2] = get_widget_assert(xml, "mv2");
+ dialog->mv[0] = get_widget_assert (xml, "mv0");
+ dialog->mv[1] = get_widget_assert (xml, "mv1");
+ dialog->mv[2] = get_widget_assert (xml, "mv2");
- dialog->low = get_widget_assert(xml, "mv-low");
- dialog->high = get_widget_assert(xml, "mv-high");
- dialog->discrete = get_widget_assert(xml, "mv-discrete");
+ dialog->low = get_widget_assert (xml, "mv-low");
+ dialog->high = get_widget_assert (xml, "mv-high");
+ dialog->discrete = get_widget_assert (xml, "mv-discrete");
dialog->button_none =
- GTK_TOGGLE_BUTTON(get_widget_assert(xml, "no_missing"));
+ GTK_TOGGLE_BUTTON(get_widget_assert (xml, "no_missing"));
dialog->button_discrete =
- GTK_TOGGLE_BUTTON(get_widget_assert(xml, "discrete_missing"));
+ GTK_TOGGLE_BUTTON(get_widget_assert (xml, "discrete_missing"));
dialog->button_range =
- GTK_TOGGLE_BUTTON(get_widget_assert(xml, "range_missing"));
+ GTK_TOGGLE_BUTTON(get_widget_assert (xml, "range_missing"));
- g_signal_connect(G_OBJECT(dialog->button_discrete), "toggled",
+ g_signal_connect (G_OBJECT(dialog->button_discrete), "toggled",
G_CALLBACK(discrete), dialog);
- g_signal_connect(G_OBJECT(dialog->button_range), "toggled",
+ g_signal_connect (G_OBJECT(dialog->button_range), "toggled",
G_CALLBACK(range), dialog);
return dialog;
/* Shows the dialog box and sets default values */
void
-missing_val_dialog_show(struct missing_val_dialog *dialog)
+missing_val_dialog_show (struct missing_val_dialog *dialog)
{
const struct fmt_spec *write_spec ;
gint i;
- g_return_if_fail(dialog);
- g_return_if_fail(dialog->pv);
+ g_return_if_fail (dialog);
+ g_return_if_fail (dialog->pv);
mv_copy (&dialog->mvl, var_get_missing_values (dialog->pv));
write_spec = var_get_write_format (dialog->pv);
/* Blank all entry boxes and make them insensitive */
- gtk_entry_set_text(GTK_ENTRY(dialog->low), "");
- gtk_entry_set_text(GTK_ENTRY(dialog->high), "");
- gtk_entry_set_text(GTK_ENTRY(dialog->discrete), "");
- gtk_widget_set_sensitive(dialog->low, FALSE);
- gtk_widget_set_sensitive(dialog->high, FALSE);
- gtk_widget_set_sensitive(dialog->discrete, FALSE);
-
- gtk_widget_set_sensitive(GTK_WIDGET(dialog->button_range),
+ gtk_entry_set_text (GTK_ENTRY(dialog->low), "");
+ gtk_entry_set_text (GTK_ENTRY(dialog->high), "");
+ gtk_entry_set_text (GTK_ENTRY(dialog->discrete), "");
+ gtk_widget_set_sensitive (dialog->low, FALSE);
+ gtk_widget_set_sensitive (dialog->high, FALSE);
+ gtk_widget_set_sensitive (dialog->discrete, FALSE);
+
+ gtk_widget_set_sensitive (GTK_WIDGET(dialog->button_range),
var_is_numeric (dialog->pv));
- for(i = 0 ; i < 3 ; ++i )
+ for (i = 0 ; i < 3 ; ++i )
{
- gtk_entry_set_text(GTK_ENTRY(dialog->mv[i]), "");
- gtk_widget_set_sensitive(dialog->mv[i], FALSE);
+ gtk_entry_set_text (GTK_ENTRY(dialog->mv[i]), "");
+ gtk_widget_set_sensitive (dialog->mv[i], FALSE);
}
if ( mv_has_range (&dialog->mvl))
union value low, high;
gchar *low_text;
gchar *high_text;
- mv_peek_range(&dialog->mvl, &low.f, &high.f);
+ mv_peek_range (&dialog->mvl, &low.f, &high.f);
- low_text = value_to_text(low, *write_spec);
- high_text = value_to_text(high, *write_spec);
+ low_text = value_to_text (low, *write_spec);
+ high_text = value_to_text (high, *write_spec);
- gtk_entry_set_text(GTK_ENTRY(dialog->low), low_text);
- gtk_entry_set_text(GTK_ENTRY(dialog->high), high_text);
- g_free(low_text);
- g_free(high_text);
+ gtk_entry_set_text (GTK_ENTRY(dialog->low), low_text);
+ gtk_entry_set_text (GTK_ENTRY(dialog->high), high_text);
+ g_free (low_text);
+ g_free (high_text);
- if ( mv_has_value(&dialog->mvl))
+ if ( mv_has_value (&dialog->mvl))
{
gchar *text;
union value value;
- mv_peek_value(&dialog->mvl, &value, 0);
- text = value_to_text(value, *write_spec);
- gtk_entry_set_text(GTK_ENTRY(dialog->discrete), text);
- g_free(text);
+ mv_peek_value (&dialog->mvl, &value, 0);
+ text = value_to_text (value, *write_spec);
+ gtk_entry_set_text (GTK_ENTRY(dialog->discrete), text);
+ g_free (text);
}
- gtk_toggle_button_set_active(dialog->button_range, TRUE);
- gtk_widget_set_sensitive(dialog->low, TRUE);
- gtk_widget_set_sensitive(dialog->high, TRUE);
- gtk_widget_set_sensitive(dialog->discrete, TRUE);
+ gtk_toggle_button_set_active (dialog->button_range, TRUE);
+ gtk_widget_set_sensitive (dialog->low, TRUE);
+ gtk_widget_set_sensitive (dialog->high, TRUE);
+ gtk_widget_set_sensitive (dialog->discrete, TRUE);
}
else if ( mv_has_value (&dialog->mvl))
{
const int n = mv_n_values (&dialog->mvl);
- for(i = 0 ; i < 3 ; ++i )
+ for (i = 0 ; i < 3 ; ++i )
{
if ( i < n)
{
gchar *text ;
union value value;
- mv_peek_value(&dialog->mvl, &value, i);
- text = value_to_text(value, *write_spec);
- gtk_entry_set_text(GTK_ENTRY(dialog->mv[i]), text);
- g_free(text);
+ mv_peek_value (&dialog->mvl, &value, i);
+ text = value_to_text (value, *write_spec);
+ gtk_entry_set_text (GTK_ENTRY(dialog->mv[i]), text);
+ g_free (text);
}
- gtk_widget_set_sensitive(dialog->mv[i], TRUE);
+ gtk_widget_set_sensitive (dialog->mv[i], TRUE);
}
- gtk_toggle_button_set_active(dialog->button_discrete, TRUE);
+ gtk_toggle_button_set_active (dialog->button_discrete, TRUE);
}
else if ( mv_is_empty (&dialog->mvl))
{
- gtk_toggle_button_set_active(dialog->button_none, TRUE);
+ gtk_toggle_button_set_active (dialog->button_none, TRUE);
}
- gtk_widget_show(dialog->window);
+ gtk_widget_show (dialog->window);
}
GtkWidget *discrete;
};
-struct missing_val_dialog * missing_val_dialog_create(GladeXML *xml);
+struct missing_val_dialog * missing_val_dialog_create (GladeXML *xml);
-void missing_val_dialog_show(struct missing_val_dialog *dialog);
+void missing_val_dialog_show (struct missing_val_dialog *dialog);
#endif
PsppireCaseFile *cf = PSPPIRE_CASE_FILE (object);
if ( cf->flexifile)
- casefile_destroy(cf->flexifile);
+ casefile_destroy (cf->flexifile);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
gboolean
-psppire_case_file_delete_cases(PsppireCaseFile *cf, gint n_cases, gint first)
+psppire_case_file_delete_cases (PsppireCaseFile *cf, gint n_cases, gint first)
{
int result;
- g_return_val_if_fail(cf, FALSE);
- g_return_val_if_fail(cf->flexifile, FALSE);
+ g_return_val_if_fail (cf, FALSE);
+ g_return_val_if_fail (cf->flexifile, FALSE);
- result = flexifile_delete_cases(FLEXIFILE(cf->flexifile), n_cases, first);
+ result = flexifile_delete_cases (FLEXIFILE(cf->flexifile), n_cases, first);
- g_signal_emit(cf, signal[CASES_DELETED], 0, n_cases, first);
+ g_signal_emit (cf, signal[CASES_DELETED], 0, n_cases, first);
return result;
}
/* Insert case CC into the case file before POSN */
gboolean
-psppire_case_file_insert_case(PsppireCaseFile *cf,
+psppire_case_file_insert_case (PsppireCaseFile *cf,
struct ccase *cc,
gint posn)
{
bool result ;
- g_return_val_if_fail(cf, FALSE);
- g_return_val_if_fail(cf->flexifile, FALSE);
+ g_return_val_if_fail (cf, FALSE);
+ g_return_val_if_fail (cf->flexifile, FALSE);
- result = flexifile_insert_case(FLEXIFILE(cf->flexifile), cc, posn);
+ result = flexifile_insert_case (FLEXIFILE(cf->flexifile), cc, posn);
if ( result )
- g_signal_emit(cf, signal[CASE_INSERTED], 0, posn);
+ g_signal_emit (cf, signal[CASE_INSERTED], 0, posn);
else
- g_warning("Cannot insert case at position %d\n", posn);
+ g_warning ("Cannot insert case at position %d\n", posn);
return result;
}
/* Append a case to the case file */
gboolean
-psppire_case_file_append_case(PsppireCaseFile *cf,
+psppire_case_file_append_case (PsppireCaseFile *cf,
struct ccase *c)
{
bool result ;
gint posn ;
- g_return_val_if_fail(cf, FALSE);
- g_return_val_if_fail(cf->flexifile, FALSE);
+ g_return_val_if_fail (cf, FALSE);
+ g_return_val_if_fail (cf->flexifile, FALSE);
- posn = casefile_get_case_cnt(cf->flexifile);
+ posn = casefile_get_case_cnt (cf->flexifile);
- result = casefile_append(cf->flexifile, c);
+ result = casefile_append (cf->flexifile, c);
- g_signal_emit(cf, signal[CASE_INSERTED], 0, posn);
+ g_signal_emit (cf, signal[CASE_INSERTED], 0, posn);
return result;
}
inline gint
-psppire_case_file_get_case_count(const PsppireCaseFile *cf)
+psppire_case_file_get_case_count (const PsppireCaseFile *cf)
{
- g_return_val_if_fail(cf, FALSE);
+ g_return_val_if_fail (cf, FALSE);
if ( ! cf->flexifile)
return 0;
- return casefile_get_case_cnt(cf->flexifile);
+ return casefile_get_case_cnt (cf->flexifile);
}
/* Return the IDXth value from case CASENUM.
The return value must not be freed or written to
*/
const union value *
-psppire_case_file_get_value(const PsppireCaseFile *cf, gint casenum, gint idx)
+psppire_case_file_get_value (const PsppireCaseFile *cf, gint casenum, gint idx)
{
const union value *v;
struct ccase c;
- g_return_val_if_fail(cf, NULL);
- g_return_val_if_fail(cf->flexifile, NULL);
+ g_return_val_if_fail (cf, NULL);
+ g_return_val_if_fail (cf->flexifile, NULL);
- g_return_val_if_fail(idx < casefile_get_value_cnt(cf->flexifile), NULL);
+ g_return_val_if_fail (idx < casefile_get_value_cnt (cf->flexifile), NULL);
- flexifile_get_case(FLEXIFILE(cf->flexifile), casenum, &c);
+ flexifile_get_case (FLEXIFILE(cf->flexifile), casenum, &c);
- v = case_data_idx(&c, idx);
- case_destroy(&c);
+ v = case_data_idx (&c, idx);
+ case_destroy (&c);
return v;
}
void
-psppire_case_file_clear(PsppireCaseFile *cf)
+psppire_case_file_clear (PsppireCaseFile *cf)
{
- casefile_destroy(cf->flexifile);
+ casefile_destroy (cf->flexifile);
cf->flexifile = 0;
- g_signal_emit(cf, signal[CASES_DELETED], 0, 0, -1);
+ g_signal_emit (cf, signal[CASES_DELETED], 0, 0, -1);
}
/* Set the IDXth value of case C to SYSMIS/EMPTY */
gboolean
-psppire_case_file_set_value(PsppireCaseFile *cf, gint casenum, gint idx,
+psppire_case_file_set_value (PsppireCaseFile *cf, gint casenum, gint idx,
union value *v, gint width)
{
struct ccase cc ;
int bytes;
- g_return_val_if_fail(cf, FALSE);
- g_return_val_if_fail(cf->flexifile, FALSE);
+ g_return_val_if_fail (cf, FALSE);
+ g_return_val_if_fail (cf->flexifile, FALSE);
- g_return_val_if_fail(idx < casefile_get_value_cnt(cf->flexifile), FALSE);
+ g_return_val_if_fail (idx < casefile_get_value_cnt (cf->flexifile), FALSE);
- if ( ! flexifile_get_case(FLEXIFILE(cf->flexifile), casenum, &cc) )
+ if ( ! flexifile_get_case (FLEXIFILE(cf->flexifile), casenum, &cc) )
return FALSE;
if ( width == 0 )
bytes = DIV_RND_UP(width, MAX_SHORT_STRING) * MAX_SHORT_STRING ;
/* Cast away const in flagrant abuse of the casefile */
- memcpy((union value *)case_data_idx(&cc, idx), v, bytes);
+ memcpy ((union value *)case_data_idx (&cc, idx), v, bytes);
- g_signal_emit(cf, signal[CASE_CHANGED], 0, casenum);
+ g_signal_emit (cf, signal[CASE_CHANGED], 0, casenum);
return TRUE;
}
/* Set the IDXth value of case C using D_IN */
gboolean
-psppire_case_file_data_in(PsppireCaseFile *cf, gint casenum, gint idx,
+psppire_case_file_data_in (PsppireCaseFile *cf, gint casenum, gint idx,
struct substring input, const struct fmt_spec *fmt)
{
struct ccase cc ;
- g_return_val_if_fail(cf, FALSE);
- g_return_val_if_fail(cf->flexifile, FALSE);
+ g_return_val_if_fail (cf, FALSE);
+ g_return_val_if_fail (cf->flexifile, FALSE);
- g_return_val_if_fail(idx < casefile_get_value_cnt(cf->flexifile), FALSE);
+ g_return_val_if_fail (idx < casefile_get_value_cnt (cf->flexifile), FALSE);
- if ( ! flexifile_get_case(FLEXIFILE(cf->flexifile), casenum, &cc) )
+ if ( ! flexifile_get_case (FLEXIFILE(cf->flexifile), casenum, &cc) )
return FALSE;
/* Cast away const in flagrant abuse of the casefile */
if (!data_in (input, fmt->type, 0, 0,
- (union value *) case_data_idx(&cc, idx), fmt_var_width (fmt)))
- g_warning("Cant set value\n");
+ (union value *) case_data_idx (&cc, idx), fmt_var_width (fmt)))
+ g_warning ("Cant set value\n");
- g_signal_emit(cf, signal[CASE_CHANGED], 0, casenum);
+ g_signal_emit (cf, signal[CASE_CHANGED], 0, casenum);
return TRUE;
}
void
-psppire_case_file_sort(PsppireCaseFile *cf, const struct sort_criteria *sc)
+psppire_case_file_sort (PsppireCaseFile *cf, const struct sort_criteria *sc)
{
gint c;
struct casefile_factory *factory = flexifile_factory_create ();
- cfile = sort_execute(reader, sc, factory);
+ cfile = sort_execute (reader, sc, factory);
- casefile_destroy(cf->flexifile);
+ casefile_destroy (cf->flexifile);
cf->flexifile = cfile;
/* FIXME: Need to have a signal to change a range of cases, instead of
calling a signal many times */
- for ( c = 0 ; c < casefile_get_case_cnt(cf->flexifile) ; ++c )
- g_signal_emit(cf, signal[CASE_CHANGED], 0, c);
+ for ( c = 0 ; c < casefile_get_case_cnt (cf->flexifile) ; ++c )
+ g_signal_emit (cf, signal[CASE_CHANGED], 0, c);
flexifile_factory_destroy (factory);
}
psppire_case_file_insert_values (PsppireCaseFile *cf,
gint n_values, gint before)
{
- g_return_val_if_fail(cf, FALSE);
+ g_return_val_if_fail (cf, FALSE);
if ( ! cf->flexifile )
{
- cf->flexifile = flexifile_create(n_values);
+ cf->flexifile = flexifile_create (n_values);
return TRUE;
}
PsppireCaseFile* psppire_case_file_new_from_flexifile (struct flexifile *ff);
-gboolean psppire_case_file_insert_case(PsppireCaseFile *cf, struct ccase *c, gint row);
+gboolean psppire_case_file_insert_case (PsppireCaseFile *cf, struct ccase *c, gint row);
-gint psppire_case_file_get_case_count(const PsppireCaseFile *cf);
+gint psppire_case_file_get_case_count (const PsppireCaseFile *cf);
-const union value * psppire_case_file_get_value(const PsppireCaseFile *cf,
+const union value * psppire_case_file_get_value (const PsppireCaseFile *cf,
gint c, gint idx);
struct fmt_spec;
-gboolean psppire_case_file_data_in(PsppireCaseFile *cf, gint c, gint idx,
+gboolean psppire_case_file_data_in (PsppireCaseFile *cf, gint c, gint idx,
struct substring input,
const struct fmt_spec *);
-gboolean psppire_case_file_set_value(PsppireCaseFile *cf, gint casenum,
+gboolean psppire_case_file_set_value (PsppireCaseFile *cf, gint casenum,
gint idx, union value *v, gint width);
-void psppire_case_file_clear(PsppireCaseFile *cf);
+void psppire_case_file_clear (PsppireCaseFile *cf);
-gboolean psppire_case_file_delete_cases(PsppireCaseFile *cf, gint n_rows,
+gboolean psppire_case_file_delete_cases (PsppireCaseFile *cf, gint n_rows,
gint first);
-gboolean psppire_case_file_insert_values(PsppireCaseFile *cf, gint n_values, gint before);
+gboolean psppire_case_file_insert_values (PsppireCaseFile *cf, gint n_values, gint before);
struct sort_criteria;
-void psppire_case_file_sort(PsppireCaseFile *cf, const struct sort_criteria *);
+void psppire_case_file_sort (PsppireCaseFile *cf, const struct sort_criteria *);
-gboolean psppire_case_file_get_case(const PsppireCaseFile *cf, gint casenum,
+gboolean psppire_case_file_get_case (const PsppireCaseFile *cf, gint casenum,
struct ccase *c);
#include <string.h>
#include <stdlib.h>
#include <gettext.h>
-#define _(msgid) gettext(msgid)
+#define _(msgid) gettext (msgid)
#define N_(msgid) msgid
#include <data/casefile.h>
static void psppire_data_store_finalize (GObject *object);
-static gchar *psppire_data_store_get_string(const GSheetModel *sheet_model, gint row, gint column);
+static gchar *psppire_data_store_get_string (const GSheetModel *sheet_model, gint row, gint column);
-static gboolean psppire_data_store_set_string(GSheetModel *model,
+static gboolean psppire_data_store_set_string (GSheetModel *model,
const gchar *text, gint row, gint column);
-static gboolean psppire_data_store_clear_datum(GSheetModel *model,
+static gboolean psppire_data_store_clear_datum (GSheetModel *model,
gint row, gint column);
{
const PsppireDataStore *store = PSPPIRE_DATA_STORE(model);
- return psppire_dict_get_var_cnt(store->dict);
+ return psppire_dict_get_var_cnt (store->dict);
}
static gint
{
const PsppireDataStore *store = PSPPIRE_DATA_STORE(model);
- return psppire_case_file_get_case_count(store->case_file);
+ return psppire_case_file_get_case_count (store->case_file);
}
}
const PangoFontDescription *
-psppire_data_store_get_font_desc(const GSheetModel *model,
+psppire_data_store_get_font_desc (const GSheetModel *model,
gint row, gint column)
{
PsppireDataStore *store = PSPPIRE_DATA_STORE(model);
}
static
-gboolean always_true()
+gboolean always_true ()
{
return TRUE;
}
static void
-delete_cases_callback(GtkWidget *w, gint first, gint n_cases, gpointer data)
+delete_cases_callback (GtkWidget *w, gint first, gint n_cases, gpointer data)
{
PsppireDataStore *store ;
store = PSPPIRE_DATA_STORE(data);
- g_assert(first >= 0);
+ g_assert (first >= 0);
g_sheet_model_rows_deleted (G_SHEET_MODEL(store), first, n_cases);
}
static void
-insert_case_callback(GtkWidget *w, gint casenum, gpointer data)
+insert_case_callback (GtkWidget *w, gint casenum, gpointer data)
{
PsppireDataStore *store ;
g_sheet_model_range_changed (G_SHEET_MODEL(store),
casenum, -1,
- psppire_case_file_get_case_count(store->case_file),
+ psppire_case_file_get_case_count (store->case_file),
-1);
g_sheet_model_rows_inserted (G_SHEET_MODEL(store), casenum, 1);
static void
-changed_case_callback(GtkWidget *w, gint casenum, gpointer data)
+changed_case_callback (GtkWidget *w, gint casenum, gpointer data)
{
PsppireDataStore *store ;
g_return_if_fail (data);
static void
-delete_variables_callback(GObject *obj, gint var_num, gint n_vars, gpointer data)
+delete_variables_callback (GObject *obj, gint var_num, gint n_vars, gpointer data)
{
PsppireDataStore *store ;
g_sheet_model_columns_deleted (G_SHEET_MODEL(store), var_num, n_vars);
- g_sheet_column_columns_changed(G_SHEET_COLUMN(store),
+ g_sheet_column_columns_changed (G_SHEET_COLUMN(store),
var_num, -1);
}
static void
-insert_variable_callback(GObject *obj, gint var_num, gpointer data)
+insert_variable_callback (GObject *obj, gint var_num, gpointer data)
{
PsppireDataStore *store;
gint posn;
if ( var_num > 0 )
{
struct variable *variable;
- variable = psppire_dict_get_variable(store->dict, var_num);
+ variable = psppire_dict_get_variable (store->dict, var_num);
posn = var_get_case_index (variable);
}
posn = 0;
}
- psppire_case_file_insert_values(store->case_file, 1, posn);
+ psppire_case_file_insert_values (store->case_file, 1, posn);
- g_sheet_column_columns_changed(G_SHEET_COLUMN(store),
+ g_sheet_column_columns_changed (G_SHEET_COLUMN(store),
var_num, 1);
g_sheet_model_columns_inserted (G_SHEET_MODEL(store), var_num, 1);
static void
-dict_size_change_callback(GObject *obj,
+dict_size_change_callback (GObject *obj,
gint posn, gint adjustment, gpointer data)
{
PsppireDataStore *store ;
retval = g_object_new (GTK_TYPE_DATA_STORE, NULL);
- psppire_data_store_set_dictionary(retval, dict);
+ psppire_data_store_set_dictionary (retval, dict);
return retval;
* destroyed.
**/
void
-psppire_data_store_set_dictionary(PsppireDataStore *data_store, PsppireDict *dict)
+psppire_data_store_set_dictionary (PsppireDataStore *data_store, PsppireDict *dict)
{
- gint var_cnt = psppire_dict_get_next_value_idx(dict);
+ gint var_cnt = psppire_dict_get_next_value_idx (dict);
data_store->dict = dict;
if ( data_store->case_file)
{
- g_object_unref(data_store->case_file);
+ g_object_unref (data_store->case_file);
data_store->case_file = 0;
}
- data_store->case_file = psppire_case_file_new(var_cnt);
+ data_store->case_file = psppire_case_file_new (var_cnt);
- g_signal_connect(data_store->case_file, "cases-deleted",
+ g_signal_connect (data_store->case_file, "cases-deleted",
G_CALLBACK(delete_cases_callback),
data_store);
- g_signal_connect(data_store->case_file, "case-inserted",
+ g_signal_connect (data_store->case_file, "case-inserted",
G_CALLBACK(insert_case_callback),
data_store);
- g_signal_connect(data_store->case_file, "case-changed",
+ g_signal_connect (data_store->case_file, "case-changed",
G_CALLBACK(changed_case_callback),
data_store);
- g_signal_connect(dict, "variable-inserted",
+ g_signal_connect (dict, "variable-inserted",
G_CALLBACK(insert_variable_callback),
data_store);
- g_signal_connect(dict, "variables-deleted",
+ g_signal_connect (dict, "variables-deleted",
G_CALLBACK(delete_variables_callback),
data_store);
/* The entire model has changed */
g_sheet_model_range_changed (G_SHEET_MODEL(data_store), -1, -1, -1, -1);
- g_sheet_column_columns_changed(G_SHEET_COLUMN(data_store), 0, -1);
+ g_sheet_column_columns_changed (G_SHEET_COLUMN(data_store), 0, -1);
}
static void
/* Insert a blank case before POSN */
gboolean
-psppire_data_store_insert_new_case(PsppireDataStore *ds, gint posn)
+psppire_data_store_insert_new_case (PsppireDataStore *ds, gint posn)
{
gboolean result;
gint val_cnt, v;
/* Opportunity for optimisation exists here when creating a blank case */
- val_cnt = casefile_get_value_cnt(ds->case_file->flexifile) ;
+ val_cnt = casefile_get_value_cnt (ds->case_file->flexifile) ;
case_create (&cc, val_cnt);
v = psppire_case_file_get_value (store->case_file, row, idx);
- g_return_val_if_fail(v, NULL);
+ g_return_val_if_fail (v, NULL);
if ( store->show_labels)
{
const struct val_labs * vl = var_get_value_labels (pv);
const gchar *label;
- if ( (label = val_labs_find(vl, *v)) )
+ if ( (label = val_labs_find (vl, *v)) )
{
- return pspp_locale_to_utf8(label, -1, 0);
+ return pspp_locale_to_utf8 (label, -1, 0);
}
}
if ( var_is_numeric (pv))
v.f = SYSMIS;
else
- memcpy(v.s, "", MAX_SHORT_STRING);
+ memcpy (v.s, "", MAX_SHORT_STRING);
- psppire_case_file_set_value(store->case_file, row, index, &v,
+ psppire_case_file_set_value (store->case_file, row, index, &v,
var_get_width (pv));
return TRUE;
Returns true if anything was updated, false otherwise.
*/
static gboolean
-psppire_data_store_set_string(GSheetModel *model,
+psppire_data_store_set_string (GSheetModel *model,
const gchar *text, gint row, gint col)
{
PsppireDataStore *store = PSPPIRE_DATA_STORE(model);
- const struct variable *pv = psppire_dict_get_variable(store->dict, col);
- g_return_val_if_fail(pv, FALSE);
+ const struct variable *pv = psppire_dict_get_variable (store->dict, col);
+ g_return_val_if_fail (pv, FALSE);
#if 0
/* Allow the user to insert a lot of blank cases, simply by skipping rows */
- for(r = psppire_case_file_get_case_count(store->case_file); r <= row ; ++r)
+ for (r = psppire_case_file_get_case_count (store->case_file); r <= row ; ++r)
{
gint c;
- psppire_case_array_insert_case(store->cases, r, 0, 0);
+ psppire_case_array_insert_case (store->cases, r, 0, 0);
- for (c = 0 ; c < psppire_dict_get_var_cnt(store->dict); ++c )
- psppire_data_store_clear_datum(model, r, c);
+ for (c = 0 ; c < psppire_dict_get_var_cnt (store->dict); ++c )
+ psppire_data_store_clear_datum (model, r, c);
}
#endif
void
-psppire_data_store_set_font(PsppireDataStore *store,
+psppire_data_store_set_font (PsppireDataStore *store,
const PangoFontDescription *fd)
{
g_return_if_fail (store);
store->font_desc = fd;
#if 0
- store->width_of_m = calc_m_width(fd);
+ store->width_of_m = calc_m_width (fd);
#endif
- g_signal_emit(store, signal[FONT_CHANGED], 0);
+ g_signal_emit (store, signal[FONT_CHANGED], 0);
g_sheet_model_range_changed (G_SHEET_MODEL(store),
void
-psppire_data_store_show_labels(PsppireDataStore *store, gboolean show_labels)
+psppire_data_store_show_labels (PsppireDataStore *store, gboolean show_labels)
{
g_return_if_fail (store);
g_return_if_fail (PSPPIRE_IS_DATA_STORE (store));
/* FIXME: There's no reason to actually have this function.
It should be done by a procedure */
void
-psppire_data_store_create_system_file(PsppireDataStore *store,
+psppire_data_store_create_system_file (PsppireDataStore *store,
struct file_handle *handle)
{
gint i, var_cnt;
struct sfm_writer *writer ;
- g_assert(handle);
+ g_assert (handle);
- writer = sfm_open_writer(handle, store->dict->dict, wo);
+ writer = sfm_open_writer (handle, store->dict->dict, wo);
if ( ! writer)
return;
var_cnt = psppire_data_store_get_var_count (G_SHEET_MODEL(store));
- for (i = 0 ; i < psppire_case_file_get_case_count(store->case_file); ++i )
+ for (i = 0 ; i < psppire_case_file_get_case_count (store->case_file); ++i )
{
struct ccase c;
case_destroy (&c);
}
- sfm_close_writer(writer);
+ sfm_close_writer (writer);
}
void
-psppire_data_store_clear(PsppireDataStore *data_store)
+psppire_data_store_clear (PsppireDataStore *data_store)
{
- psppire_case_file_clear(data_store->case_file);
+ psppire_case_file_clear (data_store->case_file);
- psppire_dict_clear(data_store->dict);
+ psppire_dict_clear (data_store->dict);
}
/* Column related funcs */
static gint
-geometry_get_column_count(const GSheetColumn *geom)
+geometry_get_column_count (const GSheetColumn *geom)
{
PsppireDataStore *ds = PSPPIRE_DATA_STORE(geom);
- return MAX(MIN_COLUMNS, psppire_dict_get_var_cnt(ds->dict));
+ return MAX(MIN_COLUMNS, psppire_dict_get_var_cnt (ds->dict));
}
static gint
-geometry_get_width(const GSheetColumn *geom, gint unit)
+geometry_get_width (const GSheetColumn *geom, gint unit)
{
const struct variable *pv ;
PsppireDataStore *ds = PSPPIRE_DATA_STORE(geom);
- if ( unit >= psppire_dict_get_var_cnt(ds->dict) )
+ if ( unit >= psppire_dict_get_var_cnt (ds->dict) )
return ds->width_of_m * 8 ;
pv = psppire_dict_get_variable (ds->dict, unit);
}
static void
-geometry_set_width(GSheetColumn *geom, gint unit, gint width)
+geometry_set_width (GSheetColumn *geom, gint unit, gint width)
{
PsppireDataStore *ds = PSPPIRE_DATA_STORE(geom);
static GtkJustification
-geometry_get_justification(const GSheetColumn *geom, gint unit)
+geometry_get_justification (const GSheetColumn *geom, gint unit)
{
PsppireDataStore *ds = PSPPIRE_DATA_STORE(geom);
const struct variable *pv ;
- if ( unit >= psppire_dict_get_var_cnt(ds->dict) )
+ if ( unit >= psppire_dict_get_var_cnt (ds->dict) )
return GTK_JUSTIFY_LEFT;
- pv = psppire_dict_get_variable(ds->dict, unit);
+ pv = psppire_dict_get_variable (ds->dict, unit);
return (var_get_alignment (pv) == ALIGN_LEFT ? GTK_JUSTIFY_LEFT
: var_get_alignment (pv) == ALIGN_RIGHT ? GTK_JUSTIFY_RIGHT
static const gchar null_var_name[]=N_("var");
static gchar *
-geometry_get_column_button_label(const GSheetColumn *geom, gint unit)
+geometry_get_column_button_label (const GSheetColumn *geom, gint unit)
{
gchar *text;
struct variable *pv ;
PsppireDataStore *ds = PSPPIRE_DATA_STORE(geom);
- if ( unit >= psppire_dict_get_var_cnt(ds->dict) )
- return g_locale_to_utf8(null_var_name, -1, 0, 0, 0);
+ if ( unit >= psppire_dict_get_var_cnt (ds->dict) )
+ return g_locale_to_utf8 (null_var_name, -1, 0, 0, 0);
pv = psppire_dict_get_variable (ds->dict, unit);
static gboolean
-geometry_get_sensitivity(const GSheetColumn *geom, gint unit)
+geometry_get_sensitivity (const GSheetColumn *geom, gint unit)
{
PsppireDataStore *ds = PSPPIRE_DATA_STORE(geom);
- return (unit < psppire_dict_get_var_cnt(ds->dict));
+ return (unit < psppire_dict_get_var_cnt (ds->dict));
}
/* Row related funcs */
static gint
-geometry_get_row_count(const GSheetRow *geom, gpointer data)
+geometry_get_row_count (const GSheetRow *geom, gpointer data)
{
PsppireDataStore *ds = PSPPIRE_DATA_STORE(geom);
- return TRAILING_ROWS + psppire_case_file_get_case_count(ds->case_file);
+ return TRAILING_ROWS + psppire_case_file_get_case_count (ds->case_file);
}
static gint
-geometry_get_height(const GSheetRow *geom, gint unit, gpointer data)
+geometry_get_height (const GSheetRow *geom, gint unit, gpointer data)
{
return 25;
}
static gboolean
-geometry_get_row_sensitivity(const GSheetRow *geom, gint unit, gpointer data)
+geometry_get_row_sensitivity (const GSheetRow *geom, gint unit, gpointer data)
{
PsppireDataStore *ds = PSPPIRE_DATA_STORE(geom);
- return (unit < psppire_case_file_get_case_count(ds->case_file));
+ return (unit < psppire_case_file_get_case_count (ds->case_file));
}
static gchar *
-geometry_get_row_button_label(const GSheetRow *geom, gint unit, gpointer data)
+geometry_get_row_button_label (const GSheetRow *geom, gint unit, gpointer data)
{
gchar *text;
gchar *s;
PsppireDataStore *ds = PSPPIRE_DATA_STORE(geom);
if ( unit >
- TRAILING_ROWS + psppire_case_file_get_case_count(ds->case_file))
+ TRAILING_ROWS + psppire_case_file_get_case_count (ds->case_file))
return 0;
- s = g_strdup_printf(_("%d"), unit);
+ s = g_strdup_printf (_("%d"), unit);
- text = pspp_locale_to_utf8(s, -1, 0);
+ text = pspp_locale_to_utf8 (s, -1, 0);
- g_free(s);
+ g_free (s);
return text;
}
inline GType psppire_data_store_get_type (void) G_GNUC_CONST;
PsppireDataStore *psppire_data_store_new (PsppireDict *dict);
-void psppire_data_store_set_dictionary(PsppireDataStore *data_store,
+void psppire_data_store_set_dictionary (PsppireDataStore *data_store,
PsppireDict *dict);
-void psppire_data_store_set_font(PsppireDataStore *store,
+void psppire_data_store_set_font (PsppireDataStore *store,
const PangoFontDescription *fd);
-void psppire_data_store_show_labels(PsppireDataStore *store,
+void psppire_data_store_show_labels (PsppireDataStore *store,
gboolean show_labels);
-void psppire_data_store_clear(PsppireDataStore *data_store);
+void psppire_data_store_clear (PsppireDataStore *data_store);
struct file_handle;
static void psppire_dict_init (PsppireDict *dict);
static void psppire_dict_finalize (GObject *object);
-static void dictionary_tree_model_init(GtkTreeModelIface *iface);
+static void dictionary_tree_model_init (GtkTreeModelIface *iface);
/* --- variables --- */
"PsppireDict",
&object_info, 0);
- g_type_add_interface_static(object_type, GTK_TYPE_TREE_MODEL,
+ g_type_add_interface_static (object_type, GTK_TYPE_TREE_MODEL,
&tree_model_info);
{
PsppireDict *d = PSPPIRE_DICT (object);
- dict_destroy(d->dict);
+ dict_destroy (d->dict);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
addcb (struct dictionary *d, int idx, void *pd)
{
- g_signal_emit(pd, signal[VARIABLE_INSERTED], 0, idx);
+ g_signal_emit (pd, signal[VARIABLE_INSERTED], 0, idx);
}
static void
delcb (struct dictionary *d, int idx, void *pd)
{
- g_signal_emit(pd, signal[VARIABLES_DELETED], 0, idx, 1);
+ g_signal_emit (pd, signal[VARIABLES_DELETED], 0, idx, 1);
}
static void
mutcb (struct dictionary *d, int idx, void *pd)
{
- g_signal_emit(pd, signal[VARIABLE_CHANGED], 0, idx);
+ g_signal_emit (pd, signal[VARIABLE_CHANGED], 0, idx);
}
static const struct dict_callbacks gui_callbacks =
static void
psppire_dict_init (PsppireDict *psppire_dict)
{
- psppire_dict->stamp = g_random_int();
+ psppire_dict->stamp = g_random_int ();
}
/**
gint d = 0;
static gchar name[10];
- while (g_snprintf(name, 10, "VAR%05d",d++),
- psppire_dict_lookup_var(dict, name))
+ while (g_snprintf (name, 10, "VAR%05d",d++),
+ psppire_dict_lookup_var (dict, name))
;
return name;
If NAME is null, then a name will be automatically assigned.
*/
void
-psppire_dict_insert_variable(PsppireDict *d, gint idx, const gchar *name)
+psppire_dict_insert_variable (PsppireDict *d, gint idx, const gchar *name)
{
struct variable *var ;
- g_return_if_fail(d);
- g_return_if_fail(G_IS_PSPPIRE_DICT(d));
+ g_return_if_fail (d);
+ g_return_if_fail (G_IS_PSPPIRE_DICT(d));
if ( ! name )
- name = auto_generate_var_name(d);
+ name = auto_generate_var_name (d);
- var = dict_create_var(d->dict, name, 0);
+ var = dict_create_var (d->dict, name, 0);
- dict_reorder_var(d->dict, var, idx);
+ dict_reorder_var (d->dict, var, idx);
- g_signal_emit(d, signal[VARIABLE_INSERTED], 0, idx );
+ g_signal_emit (d, signal[VARIABLE_INSERTED], 0, idx );
}
/* Delete N variables beginning at FIRST */
void
-psppire_dict_delete_variables(PsppireDict *d, gint first, gint n)
+psppire_dict_delete_variables (PsppireDict *d, gint first, gint n)
{
gint idx;
- g_return_if_fail(d);
- g_return_if_fail(d->dict);
- g_return_if_fail(G_IS_PSPPIRE_DICT(d));
+ g_return_if_fail (d);
+ g_return_if_fail (d->dict);
+ g_return_if_fail (G_IS_PSPPIRE_DICT(d));
for (idx = 0 ; idx < n ; ++idx )
{
if ( first >= dict_get_var_cnt (d->dict))
break;
- var = dict_get_var(d->dict, first);
+ var = dict_get_var (d->dict, first);
dict_delete_var (d->dict, var);
}
- dict_compact_values(d->dict);
+ dict_compact_values (d->dict);
- g_signal_emit(d, signal[VARIABLES_DELETED], 0, first, idx );
+ g_signal_emit (d, signal[VARIABLES_DELETED], 0, first, idx );
}
void
-psppire_dict_set_name(PsppireDict* d, gint idx, const gchar *name)
+psppire_dict_set_name (PsppireDict* d, gint idx, const gchar *name)
{
struct variable *var;
- g_assert(d);
- g_assert(G_IS_PSPPIRE_DICT(d));
+ g_assert (d);
+ g_assert (G_IS_PSPPIRE_DICT(d));
- if ( idx < dict_get_var_cnt(d->dict))
+ if ( idx < dict_get_var_cnt (d->dict))
{
/* This is an existing variable? */
- var = dict_get_var(d->dict, idx);
- dict_rename_var(d->dict, var, name);
- g_signal_emit(d, signal[VARIABLE_CHANGED], 0, idx);
+ var = dict_get_var (d->dict, idx);
+ dict_rename_var (d->dict, var, name);
+ g_signal_emit (d, signal[VARIABLE_CHANGED], 0, idx);
}
else
{
/* new variable */
- dict_create_var(d->dict, name, 0);
- g_signal_emit(d, signal[VARIABLE_INSERTED], 0, idx);
+ dict_create_var (d->dict, name, 0);
+ g_signal_emit (d, signal[VARIABLE_INSERTED], 0, idx);
}
}
/* Return the IDXth variable */
struct variable *
-psppire_dict_get_variable(PsppireDict *d, gint idx)
+psppire_dict_get_variable (PsppireDict *d, gint idx)
{
- g_return_val_if_fail(d, NULL);
- g_return_val_if_fail(d->dict, NULL);
+ g_return_val_if_fail (d, NULL);
+ g_return_val_if_fail (d->dict, NULL);
if ( dict_get_var_cnt (d->dict) <= idx )
return NULL;
void
psppire_dict_var_changed (PsppireDict *d, gint idx)
{
- g_return_if_fail(d);
+ g_return_if_fail (d);
- g_signal_emit(d, signal[VARIABLE_CHANGED], 0, idx);
+ g_signal_emit (d, signal[VARIABLE_CHANGED], 0, idx);
}
/* Clears the contents of D */
void
-psppire_dict_clear(PsppireDict *d)
+psppire_dict_clear (PsppireDict *d)
{
- g_return_if_fail(d);
- g_return_if_fail(d->dict);
+ g_return_if_fail (d);
+ g_return_if_fail (d->dict);
{
- const gint n_vars = dict_get_var_cnt(d->dict);
+ const gint n_vars = dict_get_var_cnt (d->dict);
- dict_clear(d->dict);
+ dict_clear (d->dict);
- g_signal_emit(d, signal[VARIABLES_DELETED], 0, 0, n_vars );
+ g_signal_emit (d, signal[VARIABLES_DELETED], 0, 0, n_vars );
}
}
If REPORT is true, then invalid names will be reported as such as errors
*/
gboolean
-psppire_dict_check_name(const PsppireDict *dict,
+psppire_dict_check_name (const PsppireDict *dict,
const gchar *name, gboolean report)
{
- if ( ! var_is_valid_name(name, report ) )
+ if ( ! var_is_valid_name (name, report ) )
return FALSE;
- if (psppire_dict_lookup_var(dict, name))
+ if (psppire_dict_lookup_var (dict, name))
{
if ( report )
- msg(ME,"Duplicate variable name.");
+ msg (ME,"Duplicate variable name.");
return FALSE;
}
inline gint
psppire_dict_get_next_value_idx (const PsppireDict *dict)
{
- return dict_get_next_value_idx(dict->dict);
+ return dict_get_next_value_idx (dict->dict);
}
fv = var_get_case_index (pv);
- g_signal_emit(d, signal[VARIABLE_RESIZED], 0,
+ g_signal_emit (d, signal[VARIABLE_RESIZED], 0,
fv + old_size,
new_size - old_size );
}
{
g_return_val_if_fail (G_IS_PSPPIRE_DICT(model), (GType) 0);
- switch(index)
+ switch (index)
{
case DICT_TVM_COL_NAME:
return G_TYPE_STRING;
return G_TYPE_POINTER;
break;
default:
- g_return_val_if_reached((GType)0);
+ g_return_val_if_reached ((GType)0);
break;
}
- g_assert_not_reached();
+ g_assert_not_reached ();
return ((GType)0);
}
static gboolean
-tree_model_get_iter(GtkTreeModel *model, GtkTreeIter *iter, GtkTreePath *path)
+tree_model_get_iter (GtkTreeModel *model, GtkTreeIter *iter, GtkTreePath *path)
{
gint *indices, depth;
gint n;
indices = gtk_tree_path_get_indices (path);
depth = gtk_tree_path_get_depth (path);
- g_return_val_if_fail(depth == 1, FALSE);
+ g_return_val_if_fail (depth == 1, FALSE);
n = indices[0];
static gboolean
-tree_model_iter_next(GtkTreeModel *model, GtkTreeIter *iter)
+tree_model_iter_next (GtkTreeModel *model, GtkTreeIter *iter)
{
PsppireDict *dict = PSPPIRE_DICT (model);
struct variable *variable;
gint idx;
- g_return_val_if_fail(iter->stamp == dict->stamp, FALSE);
+ g_return_val_if_fail (iter->stamp == dict->stamp, FALSE);
if ( iter == NULL || iter->user_data == NULL)
return FALSE;
idx = var_get_dict_index (variable);
- if ( idx + 1 >= psppire_dict_get_var_cnt(dict))
+ if ( idx + 1 >= psppire_dict_get_var_cnt (dict))
return FALSE;
variable = psppire_dict_get_variable (dict, idx + 1);
}
static GtkTreePath *
-tree_model_get_path(GtkTreeModel *model, GtkTreeIter *iter)
+tree_model_get_path (GtkTreeModel *model, GtkTreeIter *iter)
{
GtkTreePath *path;
struct variable *variable;
PsppireDict *dict = PSPPIRE_DICT (model);
- g_return_val_if_fail(iter->stamp == dict->stamp, FALSE);
+ g_return_val_if_fail (iter->stamp == dict->stamp, FALSE);
variable = (struct variable *) iter->user_data;
- path = gtk_tree_path_new();
- gtk_tree_path_append_index(path, var_get_dict_index (variable));
+ path = gtk_tree_path_new ();
+ gtk_tree_path_append_index (path, var_get_dict_index (variable));
return path;
}
static void
-tree_model_get_value(GtkTreeModel *model, GtkTreeIter *iter,
+tree_model_get_value (GtkTreeModel *model, GtkTreeIter *iter,
gint column, GValue *value)
{
struct variable *variable;
PsppireDict *dict = PSPPIRE_DICT (model);
- g_return_if_fail(iter->stamp == dict->stamp);
+ g_return_if_fail (iter->stamp == dict->stamp);
variable = (struct variable *) iter->user_data;
- switch(column)
+ switch (column)
{
case DICT_TVM_COL_NAME:
- g_value_init(value, G_TYPE_STRING);
- g_value_set_string(value, var_get_name(variable));
+ g_value_init (value, G_TYPE_STRING);
+ g_value_set_string (value, var_get_name (variable));
break;
case DICT_TVM_COL_VAR:
- g_value_init(value, G_TYPE_POINTER);
- g_value_set_pointer(value, variable);
+ g_value_init (value, G_TYPE_POINTER);
+ g_value_set_pointer (value, variable);
break;
default:
- g_return_if_reached();
+ g_return_if_reached ();
break;
}
}
static gboolean
-tree_model_nth_child(GtkTreeModel *model, GtkTreeIter *iter,
+tree_model_nth_child (GtkTreeModel *model, GtkTreeIter *iter,
GtkTreeIter *parent, gint n)
{
PsppireDict *dict;
- g_return_val_if_fail(G_IS_PSPPIRE_DICT(model), FALSE);
+ g_return_val_if_fail (G_IS_PSPPIRE_DICT(model), FALSE);
dict = PSPPIRE_DICT(model);
if ( parent )
return FALSE;
- if ( n >= psppire_dict_get_var_cnt(dict) )
+ if ( n >= psppire_dict_get_var_cnt (dict) )
return FALSE;
iter->stamp = dict->stamp;
- iter->user_data = psppire_dict_get_variable(dict, n);
+ iter->user_data = psppire_dict_get_variable (dict, n);
if ( !iter->user_data)
return FALSE;
void psppire_dict_delete_var (PsppireDict *s, gint idx);
/* Return the number of variables in the dictionary */
-gint psppire_dict_get_var_cnt(const PsppireDict *d);
+gint psppire_dict_get_var_cnt (const PsppireDict *d);
/* Return a variable by name.
Return NULL if it doesn't exist
struct variable * psppire_dict_lookup_var (const PsppireDict *d, const gchar *name);
/* Tell the dictionary that one of its variable has changed */
-void psppire_dict_var_changed(PsppireDict *d, gint idx);
+void psppire_dict_var_changed (PsppireDict *d, gint idx);
/* Clears the contents of D */
-void psppire_dict_clear(PsppireDict *d);
+void psppire_dict_clear (PsppireDict *d);
/* Return the IDXth variable */
struct variable * psppire_dict_get_variable (PsppireDict *d, gint idx);
/* Delete N variables beginning at FIRST */
-void psppire_dict_delete_variables(PsppireDict *d, gint first, gint n);
+void psppire_dict_delete_variables (PsppireDict *d, gint first, gint n);
/* Insert a new variable at posn IDX */
-void psppire_dict_insert_variable(PsppireDict *d, gint idx, const gchar *name);
+void psppire_dict_insert_variable (PsppireDict *d, gint idx, const gchar *name);
-void psppire_dict_resize_variable(PsppireDict *,
+void psppire_dict_resize_variable (PsppireDict *,
const struct variable *,
gint, gint );
-gboolean psppire_dict_check_name(const PsppireDict *dict,
+gboolean psppire_dict_check_name (const PsppireDict *dict,
const gchar *name, gboolean report);
gint psppire_dict_get_next_value_idx (const PsppireDict *dict);
/* -- PsppireObject --- */
-GType psppire_object_get_type(void);
-PsppireObject* psppire_object_new(void);
+GType psppire_object_get_type (void);
+PsppireObject* psppire_object_new (void);
G_END_DECLS
static void psppire_var_store_sheet_model_init (GSheetModelIface *iface);
static void psppire_var_store_finalize (GObject *object);
-static gchar *psppire_var_store_get_string(const GSheetModel *sheet_model, gint row, gint column);
+static gchar *psppire_var_store_get_string (const GSheetModel *sheet_model, gint row, gint column);
-static gboolean psppire_var_store_clear(GSheetModel *model, gint row, gint col);
+static gboolean psppire_var_store_clear (GSheetModel *model, gint row, gint col);
-static gboolean psppire_var_store_set_string(GSheetModel *model,
+static gboolean psppire_var_store_set_string (GSheetModel *model,
const gchar *text, gint row, gint column);
-static gint psppire_var_store_get_row_count(const GSheetModel * model);
+static gint psppire_var_store_get_row_count (const GSheetModel * model);
-static gchar *text_for_column(const struct variable *pv, gint c, GError **err);
+static gchar *text_for_column (const struct variable *pv, gint c, GError **err);
static void psppire_var_store_sheet_row_init (GSheetRowIface *iface);
static void
psppire_var_store_init (PsppireVarStore *var_store)
{
- GdkColormap *colormap = gdk_colormap_get_system();
+ GdkColormap *colormap = gdk_colormap_get_system ();
- g_assert(gdk_color_parse("gray", &var_store->disabled));
+ g_assert (gdk_color_parse ("gray", &var_store->disabled));
gdk_colormap_alloc_color (colormap, &var_store->disabled, FALSE, TRUE);
}
static gboolean
-psppire_var_store_item_editable(PsppireVarStore *var_store, gint row, gint column)
+psppire_var_store_item_editable (PsppireVarStore *var_store, gint row, gint column)
{
const struct fmt_spec *write_spec ;
}
static gboolean
-psppire_var_store_is_editable(const GSheetModel *model, gint row, gint column)
+psppire_var_store_is_editable (const GSheetModel *model, gint row, gint column)
{
PsppireVarStore *store = PSPPIRE_VAR_STORE(model);
- return psppire_var_store_item_editable(store, row, column);
+ return psppire_var_store_item_editable (store, row, column);
}
static const GdkColor *
-psppire_var_store_get_foreground(const GSheetModel *model, gint row, gint column)
+psppire_var_store_get_foreground (const GSheetModel *model, gint row, gint column)
{
PsppireVarStore *store = PSPPIRE_VAR_STORE(model);
- if ( ! psppire_var_store_item_editable(store, row, column) )
+ if ( ! psppire_var_store_item_editable (store, row, column) )
return &store->disabled;
return NULL;
const PangoFontDescription *
-psppire_var_store_get_font_desc(const GSheetModel *model,
+psppire_var_store_get_font_desc (const GSheetModel *model,
gint row, gint column)
{
PsppireVarStore *store = PSPPIRE_VAR_STORE(model);
retval = g_object_new (GTK_TYPE_VAR_STORE, NULL);
- psppire_var_store_set_dictionary(retval, dict);
+ psppire_var_store_set_dictionary (retval, dict);
return retval;
}
static void
-var_change_callback(GtkWidget *w, gint n, gpointer data)
+var_change_callback (GtkWidget *w, gint n, gpointer data)
{
GSheetModel *model = G_SHEET_MODEL(data);
g_sheet_model_range_changed (model,
static void
-var_delete_callback(GtkWidget *w, gint first, gint n, gpointer data)
+var_delete_callback (GtkWidget *w, gint first, gint n, gpointer data)
{
GSheetModel *model = G_SHEET_MODEL(data);
static void
-var_insert_callback(GtkWidget *w, gint row, gpointer data)
+var_insert_callback (GtkWidget *w, gint row, gpointer data)
{
GSheetModel *model = G_SHEET_MODEL(data);
* destroyed.
**/
void
-psppire_var_store_set_dictionary(PsppireVarStore *var_store, PsppireDict *dict)
+psppire_var_store_set_dictionary (PsppireVarStore *var_store, PsppireDict *dict)
{
- if ( var_store->dict ) g_object_unref(var_store->dict);
+ if ( var_store->dict ) g_object_unref (var_store->dict);
var_store->dict = dict;
- g_signal_connect(dict, "variable-changed", G_CALLBACK(var_change_callback),
+ g_signal_connect (dict, "variable-changed", G_CALLBACK(var_change_callback),
var_store);
- g_signal_connect(dict, "variables-deleted", G_CALLBACK(var_delete_callback),
+ g_signal_connect (dict, "variables-deleted", G_CALLBACK(var_delete_callback),
var_store);
- g_signal_connect(dict, "variable-inserted", G_CALLBACK(var_insert_callback),
+ g_signal_connect (dict, "variable-inserted", G_CALLBACK(var_insert_callback),
var_store);
}
static gchar *
-psppire_var_store_get_string(const GSheetModel *model, gint row, gint column)
+psppire_var_store_get_string (const GSheetModel *model, gint row, gint column)
{
PsppireVarStore *store = PSPPIRE_VAR_STORE(model);
struct variable *pv;
- if ( row >= psppire_dict_get_var_cnt(store->dict))
+ if ( row >= psppire_dict_get_var_cnt (store->dict))
return 0;
pv = psppire_dict_get_variable (store->dict, row);
Returns true if anything was updated, false otherwise.
*/
static gboolean
-psppire_var_store_clear(GSheetModel *model, gint row, gint col)
+psppire_var_store_clear (GSheetModel *model, gint row, gint col)
{
struct variable *pv ;
Returns true if anything was updated, false otherwise.
*/
static gboolean
-psppire_var_store_set_string(GSheetModel *model,
+psppire_var_store_set_string (GSheetModel *model,
const gchar *text, gint row, gint col)
{
struct variable *pv ;
PsppireVarStore *var_store = PSPPIRE_VAR_STORE(model);
- if ( row >= psppire_dict_get_var_cnt(var_store->dict))
+ if ( row >= psppire_dict_get_var_cnt (var_store->dict))
return FALSE;
pv = psppire_var_store_get_var (var_store, row);
break;
case COL_COLUMNS:
if ( ! text) return FALSE;
- var_set_display_width (pv, atoi(text));
+ var_set_display_width (pv, atoi (text));
return TRUE;
break;
case COL_WIDTH:
}
break;
case COL_LABEL:
- var_set_label(pv, text);
+ var_set_label (pv, text);
return TRUE;
break;
case COL_TYPE:
return FALSE;
break;
default:
- g_assert_not_reached();
+ g_assert_not_reached ();
return FALSE;
}
static gchar *
-text_for_column(const struct variable *pv, gint c, GError **err)
+text_for_column (const struct variable *pv, gint c, GError **err)
{
static gchar none[] = N_("None");
switch ( write_spec->type )
{
case FMT_F:
- return g_locale_to_utf8(gettext(type_label[VT_NUMERIC]), -1, 0, 0, err);
+ return g_locale_to_utf8 (gettext (type_label[VT_NUMERIC]), -1, 0, 0, err);
break;
case FMT_COMMA:
- return g_locale_to_utf8(gettext(type_label[VT_COMMA]), -1, 0, 0, err);
+ return g_locale_to_utf8 (gettext (type_label[VT_COMMA]), -1, 0, 0, err);
break;
case FMT_DOT:
- return g_locale_to_utf8(gettext(type_label[VT_DOT]), -1, 0, 0, err);
+ return g_locale_to_utf8 (gettext (type_label[VT_DOT]), -1, 0, 0, err);
break;
case FMT_E:
- return g_locale_to_utf8(gettext(type_label[VT_SCIENTIFIC]), -1, 0, 0, err);
+ return g_locale_to_utf8 (gettext (type_label[VT_SCIENTIFIC]), -1, 0, 0, err);
break;
case FMT_DATE:
case FMT_EDATE:
case FMT_DTIME:
case FMT_WKDAY:
case FMT_MONTH:
- return g_locale_to_utf8(type_label[VT_DATE], -1, 0, 0, err);
+ return g_locale_to_utf8 (type_label[VT_DATE], -1, 0, 0, err);
break;
case FMT_DOLLAR:
- return g_locale_to_utf8(type_label[VT_DOLLAR], -1, 0, 0, err);
+ return g_locale_to_utf8 (type_label[VT_DOLLAR], -1, 0, 0, err);
break;
case FMT_CCA:
case FMT_CCB:
case FMT_CCC:
case FMT_CCD:
case FMT_CCE:
- return g_locale_to_utf8(gettext(type_label[VT_CUSTOM]), -1, 0, 0, err);
+ return g_locale_to_utf8 (gettext (type_label[VT_CUSTOM]), -1, 0, 0, err);
break;
case FMT_A:
- return g_locale_to_utf8(gettext(type_label[VT_STRING]), -1, 0, 0, err);
+ return g_locale_to_utf8 (gettext (type_label[VT_STRING]), -1, 0, 0, err);
break;
default:
{
char str[FMT_STRING_LEN_MAX + 1];
- g_warning("Unknown format: \"%s\"\n",
- fmt_to_string(write_spec, str));
+ g_warning ("Unknown format: \"%s\"\n",
+ fmt_to_string (write_spec, str));
}
break;
}
case COL_WIDTH:
{
gchar *s;
- GString *gstr = g_string_sized_new(10);
- g_string_printf(gstr, _("%d"), write_spec->w);
- s = g_locale_to_utf8(gstr->str, gstr->len, 0, 0, err);
- g_string_free(gstr, TRUE);
+ GString *gstr = g_string_sized_new (10);
+ g_string_printf (gstr, _("%d"), write_spec->w);
+ s = g_locale_to_utf8 (gstr->str, gstr->len, 0, 0, err);
+ g_string_free (gstr, TRUE);
return s;
}
break;
case COL_DECIMALS:
{
gchar *s;
- GString *gstr = g_string_sized_new(10);
- g_string_printf(gstr, _("%d"), write_spec->d);
- s = g_locale_to_utf8(gstr->str, gstr->len, 0, 0, err);
- g_string_free(gstr, TRUE);
+ GString *gstr = g_string_sized_new (10);
+ g_string_printf (gstr, _("%d"), write_spec->d);
+ s = g_locale_to_utf8 (gstr->str, gstr->len, 0, 0, err);
+ g_string_free (gstr, TRUE);
return s;
}
break;
case COL_COLUMNS:
{
gchar *s;
- GString *gstr = g_string_sized_new(10);
- g_string_printf(gstr, _("%d"), var_get_display_width (pv));
- s = g_locale_to_utf8(gstr->str, gstr->len, 0, 0, err);
- g_string_free(gstr, TRUE);
+ GString *gstr = g_string_sized_new (10);
+ g_string_printf (gstr, _("%d"), var_get_display_width (pv));
+ s = g_locale_to_utf8 (gstr->str, gstr->len, 0, 0, err);
+ g_string_free (gstr, TRUE);
return s;
}
break;
{
gchar *s;
const struct missing_values *miss = var_get_missing_values (pv);
- if ( mv_is_empty(miss))
- return g_locale_to_utf8(gettext(none), -1, 0, 0, err);
+ if ( mv_is_empty (miss))
+ return g_locale_to_utf8 (gettext (none), -1, 0, 0, err);
else
{
if ( ! mv_has_range (miss))
{
- GString *gstr = g_string_sized_new(10);
- const int n = mv_n_values(miss);
+ GString *gstr = g_string_sized_new (10);
+ const int n = mv_n_values (miss);
gchar *mv[4] = {0,0,0,0};
gint i;
- for(i = 0 ; i < n; ++i )
+ for (i = 0 ; i < n; ++i )
{
union value v;
- mv_peek_value(miss, &v, i);
- mv[i] = value_to_text(v, *write_spec);
+ mv_peek_value (miss, &v, i);
+ mv[i] = value_to_text (v, *write_spec);
if ( i > 0 )
- g_string_append(gstr, ", ");
- g_string_append(gstr, mv[i]);
- g_free(mv[i]);
+ g_string_append (gstr, ", ");
+ g_string_append (gstr, mv[i]);
+ g_free (mv[i]);
}
- s = pspp_locale_to_utf8(gstr->str, gstr->len, err);
- g_string_free(gstr, TRUE);
+ s = pspp_locale_to_utf8 (gstr->str, gstr->len, err);
+ g_string_free (gstr, TRUE);
}
else
{
- GString *gstr = g_string_sized_new(10);
+ GString *gstr = g_string_sized_new (10);
gchar *l, *h;
union value low, high;
- mv_peek_range(miss, &low.f, &high.f);
+ mv_peek_range (miss, &low.f, &high.f);
- l = value_to_text(low, *write_spec);
- h = value_to_text(high, *write_spec);
+ l = value_to_text (low, *write_spec);
+ h = value_to_text (high, *write_spec);
- g_string_printf(gstr, "%s - %s", l, h);
- g_free(l);
- g_free(h);
+ g_string_printf (gstr, "%s - %s", l, h);
+ g_free (l);
+ g_free (h);
- if ( mv_has_value(miss))
+ if ( mv_has_value (miss))
{
gchar *ss = 0;
union value v;
- mv_peek_value(miss, &v, 0);
+ mv_peek_value (miss, &v, 0);
- ss = value_to_text(v, *write_spec);
+ ss = value_to_text (v, *write_spec);
- g_string_append(gstr, ", ");
- g_string_append(gstr, ss);
- free(ss);
+ g_string_append (gstr, ", ");
+ g_string_append (gstr, ss);
+ free (ss);
}
- s = pspp_locale_to_utf8(gstr->str, gstr->len, err);
- g_string_free(gstr, TRUE);
+ s = pspp_locale_to_utf8 (gstr->str, gstr->len, err);
+ g_string_free (gstr, TRUE);
}
return s;
break;
case COL_ALIGN:
{
- const gint align = var_get_alignment(pv);
+ const gint align = var_get_alignment (pv);
g_assert (align < n_ALIGNMENTS);
- return g_locale_to_utf8(gettext(alignments[align]), -1, 0, 0, err);
+ return g_locale_to_utf8 (gettext (alignments[align]), -1, 0, 0, err);
}
break;
case COL_MEASURE:
/* Return the number of variables */
gint
-psppire_var_store_get_var_cnt(PsppireVarStore *store)
+psppire_var_store_get_var_cnt (PsppireVarStore *store)
{
- return psppire_dict_get_var_cnt(store->dict);
+ return psppire_dict_get_var_cnt (store->dict);
}
void
-psppire_var_store_set_font(PsppireVarStore *store, const PangoFontDescription *fd)
+psppire_var_store_set_font (PsppireVarStore *store, const PangoFontDescription *fd)
{
g_return_if_fail (store);
g_return_if_fail (PSPPIRE_IS_VAR_STORE (store));
static gint
-psppire_var_store_get_row_count(const GSheetModel * model)
+psppire_var_store_get_row_count (const GSheetModel * model)
{
gint rows = 0;
PsppireVarStore *vs = PSPPIRE_VAR_STORE(model);
if (vs->dict)
- rows = psppire_dict_get_var_cnt(vs->dict);
+ rows = psppire_dict_get_var_cnt (vs->dict);
return rows ;
}
/* Row related funcs */
static gint
-geometry_get_row_count(const GSheetRow *geom, gpointer data)
+geometry_get_row_count (const GSheetRow *geom, gpointer data)
{
gint rows = 0;
PsppireVarStore *vs = PSPPIRE_VAR_STORE(geom);
if (vs->dict)
- rows = psppire_dict_get_var_cnt(vs->dict);
+ rows = psppire_dict_get_var_cnt (vs->dict);
return rows + TRAILING_ROWS;
}
static gint
-geometry_get_height(const GSheetRow *geom, gint row, gpointer data)
+geometry_get_height (const GSheetRow *geom, gint row, gpointer data)
{
return 25;
}
static gboolean
-geometry_is_sensitive(const GSheetRow *geom, gint row, gpointer data)
+geometry_is_sensitive (const GSheetRow *geom, gint row, gpointer data)
{
PsppireVarStore *vs = PSPPIRE_VAR_STORE(geom);
if ( ! vs->dict)
return FALSE;
- return row < psppire_dict_get_var_cnt(vs->dict);
+ return row < psppire_dict_get_var_cnt (vs->dict);
}
static
-gboolean always_true()
+gboolean always_true ()
{
return TRUE;
}
static gchar *
-geometry_get_button_label(const GSheetRow *geom, gint unit, gpointer data)
+geometry_get_button_label (const GSheetRow *geom, gint unit, gpointer data)
{
- gchar *label = g_strdup_printf(_("%d"), unit);
+ gchar *label = g_strdup_printf (_("%d"), unit);
return label;
}
/* Return the number of variables */
gint psppire_var_store_get_var_cnt (PsppireVarStore *var_store);
-void psppire_var_store_set_font(PsppireVarStore *store, const PangoFontDescription *fd);
+void psppire_var_store_set_font (PsppireVarStore *store, const PangoFontDescription *fd);
#ifdef __cplusplus
#define N_(msgid) msgid
static void
-give_help(void)
+give_help (void)
{
static struct msg m = {
MSG_GENERAL,
};
if (! m.text)
- m.text=g_strdup(_("Sorry. The help system hasn't yet been implemented."));
+ m.text=g_strdup (_("Sorry. The help system hasn't yet been implemented."));
- popup_message(&m);
+ popup_message (&m);
}
PsppireVarStore *the_var_store = 0;
int
-main(int argc, char *argv[])
+main (int argc, char *argv[])
{
struct casefile_factory *factory;
PsppireDict *dictionary = 0;
GError *err = 0;
gchar *vers;
- gtk_init(&argc, &argv);
- if ( (vers = gtk_check_version(GTK_MAJOR_VERSION,
+ gtk_init (&argc, &argv);
+ if ( (vers = gtk_check_version (GTK_MAJOR_VERSION,
GTK_MINOR_VERSION,
GTK_MICRO_VERSION)) )
{
- g_critical(vers);
+ g_critical (vers);
}
textdomain (PACKAGE);
- if ( ! parse_command_line(&argc, &argv, &filename, &err) )
+ if ( ! parse_command_line (&argc, &argv, &filename, &err) )
{
- g_clear_error(&err);
+ g_clear_error (&err);
return 0;
}
- glade_init();
+ glade_init ();
- fmt_init();
- settings_init();
+ fmt_init ();
+ settings_init ();
fh_init ();
factory = flexifile_factory_create ();
the_source_stream = create_source_stream (
dataset_dict (the_dataset)
);
- bind_textdomain_codeset(PACKAGE, "UTF-8");
+ bind_textdomain_codeset (PACKAGE, "UTF-8");
/* Create the model for the var_sheet */
- the_var_store = psppire_var_store_new(dictionary);
+ the_var_store = psppire_var_store_new (dictionary);
the_data_store = psppire_data_store_new (dictionary);
- create_icon_factory();
+ create_icon_factory ();
#if 0
/* load the interface */
- data_editor_xml = glade_xml_new(PKGDATADIR "/data-editor.glade", NULL, NULL);
+ data_editor_xml = glade_xml_new (PKGDATADIR "/data-editor.glade", NULL, NULL);
if ( !data_editor_xml ) return 1;
- data_editor = get_widget_assert(data_editor_xml, "data_editor");
+ data_editor = get_widget_assert (data_editor_xml, "data_editor");
/* connect the signals in the interface */
- glade_xml_signal_autoconnect(data_editor_xml);
+ glade_xml_signal_autoconnect (data_editor_xml);
- var_sheet = GTK_SHEET(get_widget_assert(data_editor_xml, "variable_sheet"));
- data_sheet = GTK_SHEET(get_widget_assert(data_editor_xml, "data_sheet"));
+ var_sheet = GTK_SHEET(get_widget_assert (data_editor_xml, "variable_sheet"));
+ data_sheet = GTK_SHEET(get_widget_assert (data_editor_xml, "data_sheet"));
- gtk_sheet_set_model(var_sheet, G_SHEET_MODEL(the_var_store));
+ gtk_sheet_set_model (var_sheet, G_SHEET_MODEL(the_var_store));
- gtk_sheet_set_model(data_sheet, G_SHEET_MODEL(the_data_store));
+ gtk_sheet_set_model (data_sheet, G_SHEET_MODEL(the_data_store));
- var_data_selection_init();
+ var_data_selection_init ();
{
- GList *helps = glade_xml_get_widget_prefix(data_editor_xml, "help_button_");
+ GList *helps = glade_xml_get_widget_prefix (data_editor_xml, "help_button_");
GList *i;
- for ( i = g_list_first(helps); i ; i = g_list_next(i))
- g_signal_connect(GTK_WIDGET(i->data), "clicked", give_help, 0);
+ for ( i = g_list_first (helps); i ; i = g_list_next (i))
+ g_signal_connect (GTK_WIDGET(i->data), "clicked", give_help, 0);
}
#endif
new_data_window (NULL, NULL);
/* start the event loop */
- gtk_main();
+ gtk_main ();
destroy_source_stream (the_source_stream);
- message_dialog_done();
+ message_dialog_done ();
- settings_done();
+ settings_done ();
return 0;
}
/* Parses the command line specified by ARGC and ARGV as received by
- main(). Returns true if normal execution should proceed,
+ main (). Returns true if normal execution should proceed,
false if the command-line indicates that PSPP should exit. */
static bool
parse_command_line (int *argc, char ***argv, gchar **filename, GError **err)
void
create_icon_factory (void)
{
- GtkIconFactory *factory = gtk_icon_factory_new();
+ GtkIconFactory *factory = gtk_icon_factory_new ();
GtkIconSet *icon_set;
GtkTreeSelection *otherselection ;
struct sort_cases_dialog *dialog = (struct sort_cases_dialog*) data;
- if ( 0 == gtk_tree_selection_count_selected_rows(selection) )
+ if ( 0 == gtk_tree_selection_count_selected_rows (selection) )
return ;
- gtk_arrow_set(dialog->arrow, GTK_ARROW_RIGHT, GTK_SHADOW_OUT);
+ gtk_arrow_set (dialog->arrow, GTK_ARROW_RIGHT, GTK_SHADOW_OUT);
dialog->button_state = VAR_SELECT;
- otherselection = gtk_tree_view_get_selection(dialog->criteria_view);
+ otherselection = gtk_tree_view_get_selection (dialog->criteria_view);
- gtk_tree_selection_unselect_all(otherselection);
+ gtk_tree_selection_unselect_all (otherselection);
}
GtkTreeSelection *otherselection ;
struct sort_cases_dialog *dialog = (struct sort_cases_dialog*) data;
- if ( 0 == gtk_tree_selection_count_selected_rows(selection) )
+ if ( 0 == gtk_tree_selection_count_selected_rows (selection) )
return ;
- otherselection = gtk_tree_view_get_selection(dialog->dict_view);
+ otherselection = gtk_tree_view_get_selection (dialog->dict_view);
- gtk_arrow_set(dialog->arrow, GTK_ARROW_LEFT, GTK_SHADOW_OUT);
+ gtk_arrow_set (dialog->arrow, GTK_ARROW_LEFT, GTK_SHADOW_OUT);
dialog->button_state = VAR_DESELECT;
- gtk_tree_selection_unselect_all(otherselection);
+ gtk_tree_selection_unselect_all (otherselection);
}
/* Occurs when the dialog box is deleted (eg: closed via the title bar) */
static gint
-delete_event_callback(GtkWidget *widget,
+delete_event_callback (GtkWidget *widget,
GdkEvent *event,
gpointer data)
{
struct sort_cases_dialog *dialog = (struct sort_cases_dialog*) data;
- g_main_loop_quit(dialog->loop);
+ g_main_loop_quit (dialog->loop);
- gtk_widget_hide_on_delete(widget);
+ gtk_widget_hide_on_delete (widget);
dialog->response = GTK_RESPONSE_DELETE_EVENT;
/* Occurs when the cancel button is clicked */
static void
-sort_cases_cancel_callback(GObject *obj, gpointer data)
+sort_cases_cancel_callback (GObject *obj, gpointer data)
{
struct sort_cases_dialog *dialog = (struct sort_cases_dialog*) data;
- gtk_widget_hide(dialog->window);
+ gtk_widget_hide (dialog->window);
- g_main_loop_quit(dialog->loop);
+ g_main_loop_quit (dialog->loop);
dialog->response = GTK_RESPONSE_CANCEL;
}
/* Occurs when the reset button is clicked */
static void
-sort_cases_reset_callback(GObject *obj, gpointer data)
+sort_cases_reset_callback (GObject *obj, gpointer data)
{
struct sort_cases_dialog *dialog = (struct sort_cases_dialog*) data;
- gtk_arrow_set(dialog->arrow, GTK_ARROW_RIGHT, GTK_SHADOW_OUT);
+ gtk_arrow_set (dialog->arrow, GTK_ARROW_RIGHT, GTK_SHADOW_OUT);
dialog->button_state = VAR_SELECT;
- gtk_list_store_clear(dialog->criteria_list);
+ gtk_list_store_clear (dialog->criteria_list);
}
/* Add variables currently selected in the dictionary tree view to the
list of criteria */
static void
-select_criteria(GtkTreeModel *model, GtkTreePath *path,
+select_criteria (GtkTreeModel *model, GtkTreePath *path,
GtkTreeIter *iter, gpointer data)
{
GtkTreeIter new_iter;
SRT_ASCEND:SRT_DESCEND;
/* Append to the list of criteria */
- gtk_list_store_append(dialog->criteria_list, &new_iter);
- gtk_list_store_set(dialog->criteria_list,
+ gtk_list_store_append (dialog->criteria_list, &new_iter);
+ gtk_list_store_set (dialog->criteria_list,
&new_iter, CRIT_TVM_IDX, index, -1);
- gtk_list_store_set(dialog->criteria_list,
+ gtk_list_store_set (dialog->criteria_list,
&new_iter, CRIT_TVM_DIR, dir, -1);
}
/* Create a list of the RowRefs which are to be removed from the
criteria list */
static void
-path_to_row_ref(GtkTreeModel *model, GtkTreePath *path,
+path_to_row_ref (GtkTreeModel *model, GtkTreePath *path,
GtkTreeIter *iter, gpointer data)
{
GList **rrlist = data;
- GtkTreeRowReference *rowref = gtk_tree_row_reference_new(model, path);
+ GtkTreeRowReference *rowref = gtk_tree_row_reference_new (model, path);
- *rrlist = g_list_append(*rrlist, rowref);
+ *rrlist = g_list_append (*rrlist, rowref);
}
/* Remove a row from the list of criteria */
static void
-deselect_criteria(gpointer data,
+deselect_criteria (gpointer data,
gpointer user_data)
{
GtkTreeIter iter;
GtkTreePath *path;
struct sort_cases_dialog *dialog = (struct sort_cases_dialog*) user_data;
- path = gtk_tree_row_reference_get_path(row_ref);
+ path = gtk_tree_row_reference_get_path (row_ref);
- gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->criteria_list), &iter, path);
+ gtk_tree_model_get_iter (GTK_TREE_MODEL(dialog->criteria_list), &iter, path);
- gtk_list_store_remove(dialog->criteria_list, &iter);
+ gtk_list_store_remove (dialog->criteria_list, &iter);
- gtk_tree_row_reference_free(row_ref);
+ gtk_tree_row_reference_free (row_ref);
}
/* Callback which occurs when the button to remove variables from the list
of criteria is clicked. */
static void
-sort_cases_button_callback(GObject *obj, gpointer data)
+sort_cases_button_callback (GObject *obj, gpointer data)
{
struct sort_cases_dialog *dialog = (struct sort_cases_dialog*) data;
if ( dialog->button_state == VAR_SELECT) /* Right facing arrow */
{
GtkTreeSelection *selection =
- gtk_tree_view_get_selection(dialog->dict_view);
+ gtk_tree_view_get_selection (dialog->dict_view);
- gtk_tree_selection_selected_foreach(selection, select_criteria, dialog);
+ gtk_tree_selection_selected_foreach (selection, select_criteria, dialog);
}
else /* Left facing arrow */
{
GList *selectedRows = NULL;
GtkTreeSelection *selection =
- gtk_tree_view_get_selection(dialog->criteria_view);
+ gtk_tree_view_get_selection (dialog->criteria_view);
/* Make a list of rows to be deleted */
- gtk_tree_selection_selected_foreach(selection, path_to_row_ref,
+ gtk_tree_selection_selected_foreach (selection, path_to_row_ref,
&selectedRows);
/* ... and delete them */
- g_list_foreach(selectedRows, deselect_criteria, dialog);
+ g_list_foreach (selectedRows, deselect_criteria, dialog);
- g_list_free(selectedRows);
+ g_list_free (selectedRows);
}
}
/* Callback which occurs when the OK button is clicked */
static void
-sort_cases_ok_callback(GObject *obj, gpointer data)
+sort_cases_ok_callback (GObject *obj, gpointer data)
{
struct sort_cases_dialog *dialog = (struct sort_cases_dialog*) data;
- gtk_widget_hide(dialog->window);
- g_main_loop_quit(dialog->loop);
+ gtk_widget_hide (dialog->window);
+ g_main_loop_quit (dialog->loop);
dialog->response = GTK_RESPONSE_OK;
}
/* This function is responsible for rendering a criterion in the
criteria list */
static void
-criteria_render_func(GtkTreeViewColumn *column, GtkCellRenderer *renderer,
+criteria_render_func (GtkTreeViewColumn *column, GtkCellRenderer *renderer,
GtkTreeModel *model, GtkTreeIter *iter,
gpointer data)
{
gchar *varname;
PsppireDict *dict = data;
- gtk_tree_model_get(model, iter,
+ gtk_tree_model_get (model, iter,
CRIT_TVM_IDX, &var_index,
CRIT_TVM_DIR, &direction, -1);
- variable = psppire_dict_get_variable(dict, var_index);
+ variable = psppire_dict_get_variable (dict, var_index);
- varname = pspp_locale_to_utf8 (var_get_name(variable),
+ varname = pspp_locale_to_utf8 (var_get_name (variable),
-1, 0);
if ( direction == SRT_ASCEND)
- buf = g_strdup_printf("%s: %s", varname, _("Ascending"));
+ buf = g_strdup_printf ("%s: %s", varname, _("Ascending"));
else
- buf = g_strdup_printf("%s: %s", varname, _("Descending"));
+ buf = g_strdup_printf ("%s: %s", varname, _("Descending"));
- g_free(varname);
+ g_free (varname);
- g_object_set(renderer, "text", buf, NULL);
+ g_object_set (renderer, "text", buf, NULL);
- g_free(buf);
+ g_free (buf);
}
/* Create the dialog */
struct sort_cases_dialog *
-sort_cases_dialog_create(GladeXML *xml)
+sort_cases_dialog_create (GladeXML *xml)
{
- struct sort_cases_dialog *dialog = g_malloc(sizeof(*dialog));
+ struct sort_cases_dialog *dialog = g_malloc (sizeof (*dialog));
- dialog->loop = g_main_loop_new(NULL, FALSE);
+ dialog->loop = g_main_loop_new (NULL, FALSE);
- dialog->window = get_widget_assert(xml, "sort-cases-dialog");
+ dialog->window = get_widget_assert (xml, "sort-cases-dialog");
dialog->dict_view = GTK_TREE_VIEW(get_widget_assert
(xml, "sort-cases-treeview-dict"));
dialog->criteria_view = GTK_TREE_VIEW(get_widget_assert
(xml, "sort-cases-treeview-criteria"));
- dialog->arrow = GTK_ARROW(get_widget_assert(xml, "sort-cases-arrow"));
- dialog->button = GTK_BUTTON(get_widget_assert(xml, "sort-cases-button"));
+ dialog->arrow = GTK_ARROW(get_widget_assert (xml, "sort-cases-arrow"));
+ dialog->button = GTK_BUTTON(get_widget_assert (xml, "sort-cases-button"));
dialog->ascending_button =
- GTK_TOGGLE_BUTTON(get_widget_assert(xml, "sort-cases-button-ascending"));
+ GTK_TOGGLE_BUTTON(get_widget_assert (xml, "sort-cases-button-ascending"));
- g_signal_connect(dialog->window, "delete-event",
+ g_signal_connect (dialog->window, "delete-event",
G_CALLBACK(delete_event_callback), dialog);
- g_signal_connect(get_widget_assert(xml, "sort-cases-cancel"),
+ g_signal_connect (get_widget_assert (xml, "sort-cases-cancel"),
"clicked", G_CALLBACK(sort_cases_cancel_callback), dialog);
- g_signal_connect(get_widget_assert(xml, "sort-cases-ok"),
+ g_signal_connect (get_widget_assert (xml, "sort-cases-ok"),
"clicked", G_CALLBACK(sort_cases_ok_callback), dialog);
- g_signal_connect(get_widget_assert(xml, "sort-cases-reset"),
+ g_signal_connect (get_widget_assert (xml, "sort-cases-reset"),
"clicked", G_CALLBACK(sort_cases_reset_callback), dialog);
- g_signal_connect(get_widget_assert(xml, "sort-cases-button"),
+ g_signal_connect (get_widget_assert (xml, "sort-cases-button"),
"clicked", G_CALLBACK(sort_cases_button_callback), dialog);
GtkTreeViewColumn *col;
GtkTreeSelection *selection =
- gtk_tree_view_get_selection(dialog->dict_view);
+ gtk_tree_view_get_selection (dialog->dict_view);
- GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
+ GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
- col = gtk_tree_view_column_new_with_attributes(_("Var"),
+ col = gtk_tree_view_column_new_with_attributes (_("Var"),
renderer,
"text",
0,
NULL);
/* FIXME: make this a value in terms of character widths */
- g_object_set(col, "min-width", 100, NULL);
+ g_object_set (col, "min-width", 100, NULL);
gtk_tree_view_column_set_sizing (col, GTK_TREE_VIEW_COLUMN_FIXED);
- gtk_tree_view_append_column(dialog->dict_view, col);
+ gtk_tree_view_append_column (dialog->dict_view, col);
- gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
+ gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
- g_signal_connect(selection, "changed",
+ g_signal_connect (selection, "changed",
G_CALLBACK(dictionary_selection_changed), dialog);
}
{
/* Set up the variable list treeview */
GtkTreeSelection *selection =
- gtk_tree_view_get_selection(dialog->criteria_view);
+ gtk_tree_view_get_selection (dialog->criteria_view);
- gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE);
+ gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
- dialog->crit_renderer = gtk_cell_renderer_text_new();
+ dialog->crit_renderer = gtk_cell_renderer_text_new ();
- dialog->crit_col = gtk_tree_view_column_new_with_attributes(_("Criteria"),
+ dialog->crit_col = gtk_tree_view_column_new_with_attributes (_("Criteria"),
dialog->crit_renderer,
"text",
0,
gtk_tree_view_column_set_sizing (dialog->crit_col, GTK_TREE_VIEW_COLUMN_FIXED);
- gtk_tree_view_append_column(GTK_TREE_VIEW(dialog->criteria_view),
+ gtk_tree_view_append_column (GTK_TREE_VIEW(dialog->criteria_view),
dialog->crit_col);
- g_signal_connect(selection, "changed",
+ g_signal_connect (selection, "changed",
G_CALLBACK(criteria_selection_changed), dialog);
}
{
/* Create the list of criteria */
- dialog->criteria_list = gtk_list_store_new(2,
+ dialog->criteria_list = gtk_list_store_new (2,
G_TYPE_INT, /* index of the variable */
G_TYPE_INT /* Ascending/Descending */
);
- gtk_tree_view_set_model(dialog->criteria_view,
+ gtk_tree_view_set_model (dialog->criteria_view,
GTK_TREE_MODEL(dialog->criteria_list));
}
static void
-convert_list_store_to_criteria(GtkListStore *list,
+convert_list_store_to_criteria (GtkListStore *list,
PsppireDict *dict,
struct sort_criteria *criteria);
with a valid sort criteria which can be used to sort the data.
This structure and its contents must be freed by the caller. */
gint
-sort_cases_dialog_run(struct sort_cases_dialog *dialog,
+sort_cases_dialog_run (struct sort_cases_dialog *dialog,
PsppireDict *dict,
struct sort_criteria *criteria
)
{
- g_assert(! g_main_loop_is_running(dialog->loop));
+ g_assert (! g_main_loop_is_running (dialog->loop));
- gtk_tree_view_set_model(GTK_TREE_VIEW(dialog->dict_view),
+ gtk_tree_view_set_model (GTK_TREE_VIEW(dialog->dict_view),
GTK_TREE_MODEL(dict));
- gtk_tree_view_column_set_cell_data_func(dialog->crit_col,
+ gtk_tree_view_column_set_cell_data_func (dialog->crit_col,
dialog->crit_renderer,
criteria_render_func, dict, 0);
- gtk_list_store_clear(dialog->criteria_list);
+ gtk_list_store_clear (dialog->criteria_list);
- gtk_arrow_set(dialog->arrow, GTK_ARROW_RIGHT, GTK_SHADOW_OUT);
+ gtk_arrow_set (dialog->arrow, GTK_ARROW_RIGHT, GTK_SHADOW_OUT);
dialog->button_state = VAR_SELECT;
- gtk_widget_show(dialog->window);
+ gtk_widget_show (dialog->window);
- g_main_loop_run(dialog->loop);
+ g_main_loop_run (dialog->loop);
if ( GTK_RESPONSE_OK == dialog->response)
- convert_list_store_to_criteria(dialog->criteria_list,
+ convert_list_store_to_criteria (dialog->criteria_list,
dict, criteria);
return dialog->response;
/* Convert the GtkListStore to a struct sort_criteria*/
static void
-convert_list_store_to_criteria(GtkListStore *list,
+convert_list_store_to_criteria (GtkListStore *list,
PsppireDict *dict,
struct sort_criteria *criteria)
{
criteria->crit_cnt = gtk_tree_model_iter_n_children (model, NULL);
- criteria->crits = g_malloc(sizeof(struct sort_criterion) *
+ criteria->crits = g_malloc (sizeof (struct sort_criterion) *
criteria->crit_cnt);
- for(valid = gtk_tree_model_get_iter_first(model, &iter);
+ for (valid = gtk_tree_model_get_iter_first (model, &iter);
valid;
- valid = gtk_tree_model_iter_next(model, &iter))
+ valid = gtk_tree_model_iter_next (model, &iter))
{
struct variable *variable;
gint index;
g_assert ( n < criteria->crit_cnt);
n++;
- gtk_tree_model_get(model, &iter,
+ gtk_tree_model_get (model, &iter,
CRIT_TVM_IDX, &index,
CRIT_TVM_DIR, &scn->dir,
-1);
- variable = psppire_dict_get_variable(dict, index);
+ variable = psppire_dict_get_variable (dict, index);
scn->fv = var_get_case_index (variable);
- scn->width = var_get_width(variable);
+ scn->width = var_get_width (variable);
}
}
gint response;
};
-struct sort_cases_dialog * sort_cases_dialog_create(GladeXML *xml);
+struct sort_cases_dialog * sort_cases_dialog_create (GladeXML *xml);
-gint sort_cases_dialog_run(struct sort_cases_dialog *dialog,
+gint sort_cases_dialog_run (struct sort_cases_dialog *dialog,
PsppireDict *dict,
struct sort_criteria *criteria
);
-struct val_labs_dialog * val_labs_dialog_create(GladeXML *xml);
+struct val_labs_dialog * val_labs_dialog_create (GladeXML *xml);
-void val_labs_dialog_show(struct val_labs_dialog *dialog);
+void val_labs_dialog_show (struct val_labs_dialog *dialog);
#endif
};
static GtkListStore *
-create_label_list(const gchar **labels)
+create_label_list (const gchar **labels)
{
const gchar *s;
gint i = 0;
{
gtk_list_store_append (list_store, &iter);
gtk_list_store_set (list_store, &iter,
- 0, gettext(s),
+ 0, gettext (s),
-1);
}
/* Callback for when the alignment combo box
item is selected */
static void
-change_alignment(GtkComboBox *cb,
+change_alignment (GtkComboBox *cb,
gpointer user_data)
{
struct variable *pv = user_data;
- gint active_item = gtk_combo_box_get_active(cb);
+ gint active_item = gtk_combo_box_get_active (cb);
if ( active_item < 0 ) return ;
/* Callback for when the measure combo box
item is selected */
static void
-change_measure(GtkComboBox *cb,
+change_measure (GtkComboBox *cb,
gpointer user_data)
{
struct variable *pv = user_data;
- gint active_item = gtk_combo_box_get_active(cb);
+ gint active_item = gtk_combo_box_get_active (cb);
if ( active_item < 0 ) return ;
gint *new_row, gint *new_column
)
{
- PsppireVarStore *var_store = PSPPIRE_VAR_STORE(gtk_sheet_get_model(sheet));
+ PsppireVarStore *var_store = PSPPIRE_VAR_STORE(gtk_sheet_get_model (sheet));
- gint n_vars = psppire_var_store_get_var_cnt(var_store);
+ gint n_vars = psppire_var_store_get_var_cnt (var_store);
if ( row == n_vars && *new_row >= n_vars)
{
- GtkEntry *entry = GTK_ENTRY(gtk_sheet_get_entry(sheet));
+ GtkEntry *entry = GTK_ENTRY(gtk_sheet_get_entry (sheet));
- const gchar *name = gtk_entry_get_text(entry);
+ const gchar *name = gtk_entry_get_text (entry);
- if (! psppire_dict_check_name(var_store->dict, name, TRUE))
+ if (! psppire_dict_check_name (var_store->dict, name, TRUE))
return FALSE;
- psppire_dict_insert_variable(var_store->dict, row, name);
+ psppire_dict_insert_variable (var_store->dict, row, name);
return TRUE;
}
{
gint i;
for ( i = n_vars ; i <= *new_row; ++i )
- psppire_dict_insert_variable(var_store->dict, i, NULL);
+ psppire_dict_insert_variable (var_store->dict, i, NULL);
}
return TRUE;
var_sheet_cell_entry_leave (GtkSheet * sheet, gint row, gint column,
gpointer data)
{
- gtk_sheet_change_entry(sheet, GTK_TYPE_ENTRY);
+ gtk_sheet_change_entry (sheet, GTK_TYPE_ENTRY);
return TRUE;
}
GladeXML *xml;
- g_return_val_if_fail(sheet != NULL, FALSE);
+ g_return_val_if_fail (sheet != NULL, FALSE);
- var_store = PSPPIRE_VAR_STORE (gtk_sheet_get_model(sheet));
+ var_store = PSPPIRE_VAR_STORE (gtk_sheet_get_model (sheet));
g_assert (var_store);
- if ( row >= psppire_var_store_get_var_cnt(var_store))
+ if ( row >= psppire_var_store_get_var_cnt (var_store))
return TRUE;
xml = glade_xml_new (PKGDATADIR "/data-editor.glade", NULL, NULL);
- gtk_sheet_get_attributes(sheet, row, column, &attributes);
+ gtk_sheet_get_attributes (sheet, row, column, &attributes);
pv = psppire_var_store_get_var (var_store, row);
{
static GtkListStore *list_store = 0;
GtkComboBoxEntry *cbe;
- gtk_sheet_change_entry(sheet, GTK_TYPE_COMBO_BOX_ENTRY);
+ gtk_sheet_change_entry (sheet, GTK_TYPE_COMBO_BOX_ENTRY);
cbe =
- GTK_COMBO_BOX_ENTRY(gtk_sheet_get_entry(sheet)->parent);
+ GTK_COMBO_BOX_ENTRY(gtk_sheet_get_entry (sheet)->parent);
- if ( ! list_store) list_store = create_label_list(alignments);
+ if ( ! list_store) list_store = create_label_list (alignments);
- gtk_combo_box_set_model(GTK_COMBO_BOX(cbe),
+ gtk_combo_box_set_model (GTK_COMBO_BOX(cbe),
GTK_TREE_MODEL(list_store));
gtk_combo_box_entry_set_text_column (cbe, 0);
- g_signal_connect(G_OBJECT(cbe),"changed",
+ g_signal_connect (G_OBJECT(cbe),"changed",
G_CALLBACK(change_alignment), pv);
}
break;
{
static GtkListStore *list_store = 0;
GtkComboBoxEntry *cbe;
- gtk_sheet_change_entry(sheet, GTK_TYPE_COMBO_BOX_ENTRY);
+ gtk_sheet_change_entry (sheet, GTK_TYPE_COMBO_BOX_ENTRY);
cbe =
- GTK_COMBO_BOX_ENTRY(gtk_sheet_get_entry(sheet)->parent);
+ GTK_COMBO_BOX_ENTRY(gtk_sheet_get_entry (sheet)->parent);
if ( ! list_store) list_store = create_label_list (measures);
- gtk_combo_box_set_model(GTK_COMBO_BOX(cbe),
+ gtk_combo_box_set_model (GTK_COMBO_BOX(cbe),
GTK_TREE_MODEL(list_store));
gtk_combo_box_entry_set_text_column (cbe, 0);
PsppireCustomEntry *customEntry;
- gtk_sheet_change_entry(sheet, PSPPIRE_CUSTOM_ENTRY_TYPE);
+ gtk_sheet_change_entry (sheet, PSPPIRE_CUSTOM_ENTRY_TYPE);
customEntry =
- PSPPIRE_CUSTOM_ENTRY(gtk_sheet_get_entry(sheet));
+ PSPPIRE_CUSTOM_ENTRY(gtk_sheet_get_entry (sheet));
if (!val_labs_dialog )
- val_labs_dialog = val_labs_dialog_create(xml);
+ val_labs_dialog = val_labs_dialog_create (xml);
val_labs_dialog->pv = pv;
- g_signal_connect_swapped(GTK_OBJECT(customEntry),
+ g_signal_connect_swapped (GTK_OBJECT(customEntry),
"clicked",
GTK_SIGNAL_FUNC(val_labs_dialog_show),
val_labs_dialog);
static struct missing_val_dialog *missing_val_dialog = 0;
PsppireCustomEntry *customEntry;
- gtk_sheet_change_entry(sheet, PSPPIRE_CUSTOM_ENTRY_TYPE);
+ gtk_sheet_change_entry (sheet, PSPPIRE_CUSTOM_ENTRY_TYPE);
customEntry =
- PSPPIRE_CUSTOM_ENTRY(gtk_sheet_get_entry(sheet));
+ PSPPIRE_CUSTOM_ENTRY(gtk_sheet_get_entry (sheet));
if (!missing_val_dialog )
- missing_val_dialog = missing_val_dialog_create(xml);
+ missing_val_dialog = missing_val_dialog_create (xml);
missing_val_dialog->pv = psppire_var_store_get_var (var_store, row);
- g_signal_connect_swapped(GTK_OBJECT(customEntry),
+ g_signal_connect_swapped (GTK_OBJECT(customEntry),
"clicked",
GTK_SIGNAL_FUNC(missing_val_dialog_show),
missing_val_dialog);
PsppireCustomEntry *customEntry;
- gtk_sheet_change_entry(sheet, PSPPIRE_CUSTOM_ENTRY_TYPE);
+ gtk_sheet_change_entry (sheet, PSPPIRE_CUSTOM_ENTRY_TYPE);
customEntry =
- PSPPIRE_CUSTOM_ENTRY(gtk_sheet_get_entry(sheet));
+ PSPPIRE_CUSTOM_ENTRY(gtk_sheet_get_entry (sheet));
/* Popup the Variable Type dialog box */
if (!var_type_dialog )
- var_type_dialog = var_type_dialog_create(xml);
+ var_type_dialog = var_type_dialog_create (xml);
var_type_dialog->pv = pv;
- g_signal_connect_swapped(GTK_OBJECT(customEntry),
+ g_signal_connect_swapped (GTK_OBJECT(customEntry),
"clicked",
GTK_SIGNAL_FUNC(var_type_dialog_show),
var_type_dialog);
{
gint r_min, r_max;
- const gchar *s = gtk_sheet_cell_get_text(sheet, row, column);
+ const gchar *s = gtk_sheet_cell_get_text (sheet, row, column);
if (s)
{
GtkSpinButton *spinButton ;
- const gint current_value = atoi(s);
+ const gint current_value = atoi (s);
GtkObject *adj ;
const struct fmt_spec *fmt = var_get_write_format (pv);
r_max = 255 ; /* Is this a sensible value ? */
break;
default:
- g_assert_not_reached();
+ g_assert_not_reached ();
}
- adj = gtk_adjustment_new(current_value,
+ adj = gtk_adjustment_new (current_value,
r_min, r_max,
1.0, 1.0, 1.0 /* steps */
);
- gtk_sheet_change_entry(sheet, GTK_TYPE_SPIN_BUTTON);
+ gtk_sheet_change_entry (sheet, GTK_TYPE_SPIN_BUTTON);
spinButton =
- GTK_SPIN_BUTTON(gtk_sheet_get_entry(sheet));
+ GTK_SPIN_BUTTON(gtk_sheet_get_entry (sheet));
- gtk_spin_button_set_adjustment(spinButton, GTK_ADJUSTMENT(adj));
- gtk_spin_button_set_digits(spinButton, 0);
+ gtk_spin_button_set_adjustment (spinButton, GTK_ADJUSTMENT(adj));
+ gtk_spin_button_set_digits (spinButton, 0);
}
}
}
break;
default:
- gtk_sheet_change_entry(sheet, GTK_TYPE_ENTRY);
+ gtk_sheet_change_entry (sheet, GTK_TYPE_ENTRY);
break;
}
gint i;
GtkWidget *sheet;
- GObject *geo = g_sheet_hetero_column_new(75, n_COLS);
+ GObject *geo = g_sheet_hetero_column_new (75, n_COLS);
g_assert (the_var_store);
- sheet = gtk_sheet_new(G_SHEET_ROW(the_var_store),
+ sheet = gtk_sheet_new (G_SHEET_ROW(the_var_store),
G_SHEET_COLUMN(geo),
"variable sheet", 0);
GTK_SIGNAL_FUNC (traverse_cell_callback), 0);
- gtk_sheet_set_model(sheet, G_SHEET_MODEL(the_var_store));
+ gtk_sheet_set_model (sheet, G_SHEET_MODEL(the_var_store));
/* Since this happens inside glade_xml_new, we must prevent strings from
* being re-encoded twice */
- codeset = bind_textdomain_codeset(PACKAGE, 0);
- bind_textdomain_codeset(PACKAGE, nl_langinfo(CODESET));
+ codeset = bind_textdomain_codeset (PACKAGE, 0);
+ bind_textdomain_codeset (PACKAGE, nl_langinfo (CODESET));
for (i = 0 ; i < n_COLS ; ++i )
{
- g_sheet_hetero_column_set_button_label(G_SHEET_HETERO_COLUMN(geo), i,
- gettext(column_def[i].label));
+ g_sheet_hetero_column_set_button_label (G_SHEET_HETERO_COLUMN(geo), i,
+ gettext (column_def[i].label));
- g_sheet_hetero_column_set_width(G_SHEET_HETERO_COLUMN(geo), i,
+ g_sheet_hetero_column_set_width (G_SHEET_HETERO_COLUMN(geo), i,
column_def[i].width);
}
- bind_textdomain_codeset(PACKAGE, codeset);
+ bind_textdomain_codeset (PACKAGE, codeset);
- gtk_widget_show(sheet);
+ gtk_widget_show (sheet);
return sheet;
}
n_COLS};
-void var_sheet_range_set_editable(GtkSheet *sheet,
+void var_sheet_range_set_editable (GtkSheet *sheet,
const GtkSheetRange *urange,
gboolean editable);
static void select_treeview_from_format
(GtkTreeView *treeview, const struct fmt_spec *fmt);
-static void select_treeview_from_format_type(GtkTreeView *treeview,
+static void select_treeview_from_format_type (GtkTreeView *treeview,
const int fmt_type);
/* callback for when any of the radio buttons are toggled */
static void
-on_toggle_1(GtkToggleButton *togglebutton, gpointer user_data)
+on_toggle_1 (GtkToggleButton *togglebutton, gpointer user_data)
{
struct tgs *tgs = user_data;
- if ( gtk_toggle_button_get_active(togglebutton) == FALSE)
+ if ( gtk_toggle_button_get_active (togglebutton) == FALSE)
return ;
tgs->dialog->active_button = tgs->button;
}
-static void update_width_decimals(const struct var_type_dialog *dialog);
+static void update_width_decimals (const struct var_type_dialog *dialog);
#define force_max(x, val) if (x > val) x = val
Set the local format from the variable
and force them to have sensible values */
static void
-set_local_width_decimals(struct var_type_dialog *dialog)
+set_local_width_decimals (struct var_type_dialog *dialog)
{
dialog->fmt_l = * var_get_write_format (dialog->pv);
switch (dialog->active_button)
{
case BUTTON_STRING:
- force_max( dialog->fmt_l.w, 255);
+ force_max ( dialog->fmt_l.w, 255);
break;
default:
- force_max( dialog->fmt_l.w, 40);
- force_max( dialog->fmt_l.d, 16);
+ force_max ( dialog->fmt_l.w, 40);
+ force_max ( dialog->fmt_l.d, 16);
break;
}
}
/* callback for when any of the radio buttons are toggled */
static void
-on_toggle_2(GtkToggleButton *togglebutton, gpointer user_data)
+on_toggle_2 (GtkToggleButton *togglebutton, gpointer user_data)
{
struct var_type_dialog *dialog = user_data;
- if ( gtk_toggle_button_get_active(togglebutton) == FALSE)
+ if ( gtk_toggle_button_get_active (togglebutton) == FALSE)
{
switch (dialog->active_button)
{
case BUTTON_DATE:
- gtk_widget_hide(dialog->date_format_list);
+ gtk_widget_hide (dialog->date_format_list);
break;
case BUTTON_CUSTOM:
- gtk_widget_hide(dialog->custom_currency_hbox);
+ gtk_widget_hide (dialog->custom_currency_hbox);
break;
case BUTTON_DOLLAR:
- gtk_widget_hide(dialog->dollar_window);
+ gtk_widget_hide (dialog->dollar_window);
break;
case BUTTON_STRING:
- gtk_widget_show(dialog->label_decimals);
- gtk_widget_show(dialog->entry_decimals);
+ gtk_widget_show (dialog->label_decimals);
+ gtk_widget_show (dialog->entry_decimals);
break;
}
return ;
}
- set_local_width_decimals(dialog);
- update_width_decimals(dialog);
+ set_local_width_decimals (dialog);
+ update_width_decimals (dialog);
switch (dialog->active_button)
{
case BUTTON_STRING:
- gtk_widget_show(dialog->width_decimals);
- gtk_widget_hide(dialog->label_decimals);
- gtk_widget_hide(dialog->entry_decimals);
+ gtk_widget_show (dialog->width_decimals);
+ gtk_widget_hide (dialog->label_decimals);
+ gtk_widget_hide (dialog->entry_decimals);
break;
case BUTTON_DATE:
- select_treeview_from_format(dialog->date_format_treeview,
+ select_treeview_from_format (dialog->date_format_treeview,
&format_option[0].spec);
- gtk_widget_hide(dialog->width_decimals);
- gtk_widget_show(dialog->date_format_list);
+ gtk_widget_hide (dialog->width_decimals);
+ gtk_widget_show (dialog->date_format_list);
break;
case BUTTON_DOLLAR:
- select_treeview_from_format(dialog->dollar_treeview,
+ select_treeview_from_format (dialog->dollar_treeview,
&dollar_format[0]);
- gtk_widget_show(dialog->dollar_window);
- gtk_widget_show_all(dialog->width_decimals);
+ gtk_widget_show (dialog->dollar_window);
+ gtk_widget_show_all (dialog->width_decimals);
break;
case BUTTON_CUSTOM:
- select_treeview_from_format_type(dialog->custom_treeview,
+ select_treeview_from_format_type (dialog->custom_treeview,
cc_format[0]);
- gtk_widget_show(dialog->width_decimals);
- gtk_widget_show(dialog->custom_currency_hbox);
+ gtk_widget_show (dialog->width_decimals);
+ gtk_widget_show (dialog->custom_currency_hbox);
break;
default:
- gtk_widget_show_all(dialog->width_decimals);
+ gtk_widget_show_all (dialog->width_decimals);
break;
}
}
-static gint on_var_type_ok_clicked(GtkWidget *w, gpointer data);
+static gint on_var_type_ok_clicked (GtkWidget *w, gpointer data);
#define LEN 20
static void
-add_to_group(GtkWidget *w, gpointer data)
+add_to_group (GtkWidget *w, gpointer data)
{
GtkSizeGroup *sg = data;
- gtk_size_group_add_widget(sg, w);
+ gtk_size_group_add_widget (sg, w);
}
/* Set the local width and decimals entry boxes to reflec the local format */
static void
-update_width_decimals(const struct var_type_dialog *dialog)
+update_width_decimals (const struct var_type_dialog *dialog)
{
gchar *text;
- g_assert(dialog);
+ g_assert (dialog);
- text = g_strdup_printf("%d", dialog->fmt_l.w);
- gtk_entry_set_text(GTK_ENTRY(dialog->entry_width), text);
- g_free(text);
+ text = g_strdup_printf ("%d", dialog->fmt_l.w);
+ gtk_entry_set_text (GTK_ENTRY(dialog->entry_width), text);
+ g_free (text);
- text = g_strdup_printf("%d", dialog->fmt_l.d);
- gtk_entry_set_text(GTK_ENTRY(dialog->entry_decimals), text);
- g_free(text);
+ text = g_strdup_printf ("%d", dialog->fmt_l.d);
+ gtk_entry_set_text (GTK_ENTRY(dialog->entry_decimals), text);
+ g_free (text);
}
/* Callback for when the custom treeview row is changed.
It sets dialog box to reflect the selected format */
static void
-preview_custom(GtkWidget *w, gpointer data)
+preview_custom (GtkWidget *w, gpointer data)
{
const gchar *text ;
if ( dialog->active_button != BUTTON_CUSTOM )
return;
- text = gtk_entry_get_text(GTK_ENTRY(dialog->entry_decimals));
- dialog->fmt_l.d = atoi(text);
+ text = gtk_entry_get_text (GTK_ENTRY(dialog->entry_decimals));
+ dialog->fmt_l.d = atoi (text);
- text = gtk_entry_get_text(GTK_ENTRY(dialog->entry_width));
- dialog->fmt_l.w = atoi(text);
+ text = gtk_entry_get_text (GTK_ENTRY(dialog->entry_width));
+ dialog->fmt_l.w = atoi (text);
msg_disable ();
- if ( ! fmt_check_output(&dialog->fmt_l))
+ if ( ! fmt_check_output (&dialog->fmt_l))
{
- gtk_label_set_text(GTK_LABEL(dialog->label_psample), "---");
- gtk_label_set_text(GTK_LABEL(dialog->label_nsample), "---");
+ gtk_label_set_text (GTK_LABEL(dialog->label_psample), "---");
+ gtk_label_set_text (GTK_LABEL(dialog->label_nsample), "---");
}
else
{
union value v;
v.f = 1234.56;
- sample_text = value_to_text(v, dialog->fmt_l);
- gtk_label_set_text(GTK_LABEL(dialog->label_psample), sample_text);
- g_free(sample_text);
+ sample_text = value_to_text (v, dialog->fmt_l);
+ gtk_label_set_text (GTK_LABEL(dialog->label_psample), sample_text);
+ g_free (sample_text);
v.f = -v.f;
- sample_text = value_to_text(v, dialog->fmt_l);
- gtk_label_set_text(GTK_LABEL(dialog->label_nsample), sample_text);
- g_free(sample_text);
+ sample_text = value_to_text (v, dialog->fmt_l);
+ gtk_label_set_text (GTK_LABEL(dialog->label_nsample), sample_text);
+ g_free (sample_text);
}
msg_enable ();
}
/* Callback for when a treeview row is changed.
It sets the fmt_l_spec to reflect the selected format */
static void
-set_format_from_treeview(GtkTreeView *treeview, gpointer data)
+set_format_from_treeview (GtkTreeView *treeview, gpointer data)
{
struct var_type_dialog *dialog = data;
GtkTreeIter iter ;
GValue the_value = {0};
- GtkTreeSelection* sel = gtk_tree_view_get_selection(treeview);
+ GtkTreeSelection* sel = gtk_tree_view_get_selection (treeview);
- GtkTreeModel * model = gtk_tree_view_get_model(treeview);
+ GtkTreeModel * model = gtk_tree_view_get_model (treeview);
gtk_tree_selection_get_selected (sel, &model, &iter);
- gtk_tree_model_get_value(model, &iter, 1, &the_value);
+ gtk_tree_model_get_value (model, &iter, 1, &the_value);
- dialog->fmt_l = *(struct fmt_spec *) g_value_get_pointer(&the_value);
+ dialog->fmt_l = *(struct fmt_spec *) g_value_get_pointer (&the_value);
}
/* Callback for when a treeview row is changed.
It sets the type of the fmt_l to reflect the selected type */
static void
-set_format_type_from_treeview(GtkTreeView *treeview, gpointer data)
+set_format_type_from_treeview (GtkTreeView *treeview, gpointer data)
{
static struct fmt_spec custom_format = {0,0,0};
struct var_type_dialog *dialog = data;
GtkTreeIter iter ;
GValue the_value = {0};
- GtkTreeSelection* sel = gtk_tree_view_get_selection(treeview);
+ GtkTreeSelection* sel = gtk_tree_view_get_selection (treeview);
- GtkTreeModel * model = gtk_tree_view_get_model(treeview);
+ GtkTreeModel * model = gtk_tree_view_get_model (treeview);
gtk_tree_selection_get_selected (sel, &model, &iter);
- gtk_tree_model_get_value(model, &iter, 1, &the_value);
+ gtk_tree_model_get_value (model, &iter, 1, &the_value);
dialog->fmt_l = custom_format;
- dialog->fmt_l.type = *(int*) g_value_get_pointer(&the_value);
+ dialog->fmt_l.type = *(int*) g_value_get_pointer (&the_value);
}
var_type_dialog_create (GladeXML *xml)
{
gint i;
- struct var_type_dialog *dialog = g_malloc(sizeof(struct var_type_dialog));
+ struct var_type_dialog *dialog = g_malloc (sizeof (struct var_type_dialog));
- g_assert(xml);
+ g_assert (xml);
- dialog->window = get_widget_assert(xml,"var_type_dialog");
+ dialog->window = get_widget_assert (xml,"var_type_dialog");
- gtk_window_set_transient_for(GTK_WINDOW(dialog->window),
- GTK_WINDOW(get_widget_assert(xml, "data_editor")));
+ gtk_window_set_transient_for (GTK_WINDOW(dialog->window),
+ GTK_WINDOW(get_widget_assert (xml, "data_editor")));
dialog->radioButton[BUTTON_NUMERIC] =
- get_widget_assert(xml,"radiobutton1");
+ get_widget_assert (xml,"radiobutton1");
dialog->radioButton[BUTTON_COMMA] =
- get_widget_assert(xml,"radiobutton2");
+ get_widget_assert (xml,"radiobutton2");
dialog->radioButton[BUTTON_DOT] =
- get_widget_assert(xml,"radiobutton3");
+ get_widget_assert (xml,"radiobutton3");
dialog->radioButton[BUTTON_SCIENTIFIC] =
- get_widget_assert(xml,"radiobutton4");
+ get_widget_assert (xml,"radiobutton4");
dialog->radioButton[BUTTON_DATE] =
- get_widget_assert(xml,"radiobutton5");
+ get_widget_assert (xml,"radiobutton5");
dialog->radioButton[BUTTON_DOLLAR] =
- get_widget_assert(xml,"radiobutton6");
+ get_widget_assert (xml,"radiobutton6");
dialog->radioButton[BUTTON_CUSTOM] =
- get_widget_assert(xml,"radiobutton7");
+ get_widget_assert (xml,"radiobutton7");
dialog->radioButton[BUTTON_STRING] =
- get_widget_assert(xml,"radiobutton8");
+ get_widget_assert (xml,"radiobutton8");
- dialog->date_format_list = get_widget_assert(xml, "scrolledwindow4");
- dialog->width_decimals = get_widget_assert(xml, "width_decimals");
- dialog->label_decimals = get_widget_assert(xml, "decimals_label");
- dialog->entry_decimals = get_widget_assert(xml, "decimals_entry");
+ dialog->date_format_list = get_widget_assert (xml, "scrolledwindow4");
+ dialog->width_decimals = get_widget_assert (xml, "width_decimals");
+ dialog->label_decimals = get_widget_assert (xml, "decimals_label");
+ dialog->entry_decimals = get_widget_assert (xml, "decimals_entry");
- dialog->label_psample = get_widget_assert(xml, "psample_label");
- dialog->label_nsample = get_widget_assert(xml, "nsample_label");
+ dialog->label_psample = get_widget_assert (xml, "psample_label");
+ dialog->label_nsample = get_widget_assert (xml, "nsample_label");
- dialog->entry_width = get_widget_assert(xml,"width_entry");
+ dialog->entry_width = get_widget_assert (xml,"width_entry");
- dialog->custom_currency_hbox = get_widget_assert(xml,
+ dialog->custom_currency_hbox = get_widget_assert (xml,
"custom_currency_hbox");
- dialog->dollar_window = get_widget_assert(xml, "dollar_window");
+ dialog->dollar_window = get_widget_assert (xml, "dollar_window");
dialog->dollar_treeview =
- GTK_TREE_VIEW(get_widget_assert(xml, "dollar_treeview"));
+ GTK_TREE_VIEW(get_widget_assert (xml, "dollar_treeview"));
dialog->custom_treeview =
- GTK_TREE_VIEW(get_widget_assert(xml, "custom_treeview"));
+ GTK_TREE_VIEW(get_widget_assert (xml, "custom_treeview"));
- dialog->ok = get_widget_assert(xml,"var_type_ok");
+ dialog->ok = get_widget_assert (xml,"var_type_ok");
{
However only one child is ever shown at a time.
We need to make sure that they all have the same width, to avoid
upleasant resizing effects */
- GtkSizeGroup *sizeGroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+ GtkSizeGroup *sizeGroup = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
- gtk_container_foreach(GTK_CONTAINER(get_widget_assert(xml, "middle_box")),
+ gtk_container_foreach (GTK_CONTAINER(get_widget_assert (xml, "middle_box")),
add_to_group, sizeGroup);
{
tgs[i].dialog = dialog;
tgs[i].button = i;
- g_signal_connect(dialog->radioButton[i], "toggled",
+ g_signal_connect (dialog->radioButton[i], "toggled",
G_CALLBACK(on_toggle_1), &tgs[i]);
- g_signal_connect(dialog->radioButton[i], "toggled",
+ g_signal_connect (dialog->radioButton[i], "toggled",
G_CALLBACK(on_toggle_2), dialog);
}
/* Populate the date format tree view */
- dialog->date_format_treeview = GTK_TREE_VIEW(get_widget_assert(xml,
+ dialog->date_format_treeview = GTK_TREE_VIEW(get_widget_assert (xml,
"date_format_list_view"));
- renderer = gtk_cell_renderer_text_new();
+ renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("Title",
renderer,
list_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
- for ( i = 0 ; i < sizeof(format_option) / sizeof(format_option[0]) ; ++i )
+ for ( i = 0 ; i < sizeof (format_option) / sizeof (format_option[0]) ; ++i )
{
gtk_list_store_append (list_store, &iter);
gtk_list_store_set (list_store, &iter,
-1);
}
- gtk_tree_view_set_model(GTK_TREE_VIEW(dialog->date_format_treeview),
+ gtk_tree_view_set_model (GTK_TREE_VIEW(dialog->date_format_treeview),
GTK_TREE_MODEL(list_store));
- g_object_unref(list_store);
+ g_object_unref (list_store);
- g_signal_connect(GTK_OBJECT(dialog->date_format_treeview), "cursor-changed",
+ g_signal_connect (GTK_OBJECT(dialog->date_format_treeview), "cursor-changed",
GTK_SIGNAL_FUNC(set_format_from_treeview), dialog);
/* populate the dollar treeview */
- renderer = gtk_cell_renderer_text_new();
+ renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("Title",
renderer,
list_store = gtk_list_store_new (2, G_TYPE_STRING,
G_TYPE_POINTER);
- for ( i = 0 ; i < sizeof(dollar_format)/sizeof(dollar_format[0]) ; ++i )
+ for ( i = 0 ; i < sizeof (dollar_format)/sizeof (dollar_format[0]) ; ++i )
{
char *template = fmt_dollar_template (&dollar_format[i]);
gtk_list_store_append (list_store, &iter);
free (template);
}
- gtk_tree_view_set_model(GTK_TREE_VIEW(dialog->dollar_treeview),
+ gtk_tree_view_set_model (GTK_TREE_VIEW(dialog->dollar_treeview),
GTK_TREE_MODEL(list_store));
- g_object_unref(list_store);
+ g_object_unref (list_store);
- g_signal_connect(GTK_OBJECT(dialog->dollar_treeview),
+ g_signal_connect (GTK_OBJECT(dialog->dollar_treeview),
"cursor-changed",
GTK_SIGNAL_FUNC(set_format_from_treeview), dialog);
- g_signal_connect_swapped(GTK_OBJECT(dialog->dollar_treeview),
+ g_signal_connect_swapped (GTK_OBJECT(dialog->dollar_treeview),
"cursor-changed",
GTK_SIGNAL_FUNC(update_width_decimals), dialog);
/* populate the custom treeview */
- renderer = gtk_cell_renderer_text_new();
+ renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("Title",
renderer,
{
enum fmt_type cc_fmts[5] = {FMT_CCA, FMT_CCB, FMT_CCC, FMT_CCD, FMT_CCE};
gchar text[4];
- g_snprintf(text, 4, "%s", fmt_name (cc_fmts[i]));
+ g_snprintf (text, 4, "%s", fmt_name (cc_fmts[i]));
gtk_list_store_append (list_store, &iter);
gtk_list_store_set (list_store, &iter,
0, text,
-1);
}
- gtk_tree_view_set_model(GTK_TREE_VIEW(dialog->custom_treeview),
+ gtk_tree_view_set_model (GTK_TREE_VIEW(dialog->custom_treeview),
GTK_TREE_MODEL(list_store));
- g_object_unref(list_store);
+ g_object_unref (list_store);
- g_signal_connect(GTK_OBJECT(dialog->custom_treeview),
+ g_signal_connect (GTK_OBJECT(dialog->custom_treeview),
"cursor-changed",
GTK_SIGNAL_FUNC(set_format_type_from_treeview), dialog);
- g_signal_connect(GTK_OBJECT(dialog->custom_treeview),
+ g_signal_connect (GTK_OBJECT(dialog->custom_treeview),
"cursor-changed",
GTK_SIGNAL_FUNC(preview_custom), dialog);
- g_signal_connect(GTK_OBJECT(dialog->entry_width),
+ g_signal_connect (GTK_OBJECT(dialog->entry_width),
"changed",
GTK_SIGNAL_FUNC(preview_custom), dialog);
- g_signal_connect(GTK_OBJECT(dialog->entry_decimals),
+ g_signal_connect (GTK_OBJECT(dialog->entry_decimals),
"changed",
GTK_SIGNAL_FUNC(preview_custom), dialog);
/* Connect the OK button */
- g_signal_connect(dialog->ok, "clicked", G_CALLBACK(on_var_type_ok_clicked),
+ g_signal_connect (dialog->ok, "clicked", G_CALLBACK(on_var_type_ok_clicked),
dialog);
/* Set a particular button to be active */
void
-var_type_dialog_set_active_button(struct var_type_dialog *dialog, gint b)
+var_type_dialog_set_active_button (struct var_type_dialog *dialog, gint b)
{
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->radioButton[b]),
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(dialog->radioButton[b]),
TRUE);
dialog->active_button = b;
}
/* Set the TREEVIEW list cursor to the item described by FMT */
static void
-select_treeview_from_format(GtkTreeView *treeview, const struct fmt_spec *fmt)
+select_treeview_from_format (GtkTreeView *treeview, const struct fmt_spec *fmt)
{
GtkTreePath *path ;
efficient, but the list is short ... */
GtkTreeIter iter;
- GtkTreeModel * model = gtk_tree_view_get_model(treeview);
+ GtkTreeModel * model = gtk_tree_view_get_model (treeview);
gboolean success;
- for (success = gtk_tree_model_get_iter_first(model, &iter);
+ for (success = gtk_tree_model_get_iter_first (model, &iter);
success;
- success = gtk_tree_model_iter_next(model, &iter))
+ success = gtk_tree_model_iter_next (model, &iter))
{
const struct fmt_spec *spec;
GValue value = {0};
- gtk_tree_model_get_value(model, &iter, 1, &value);
+ gtk_tree_model_get_value (model, &iter, 1, &value);
- spec = g_value_get_pointer(&value);
+ spec = g_value_get_pointer (&value);
- if ( 0 == memcmp(spec, fmt, sizeof (struct fmt_spec)))
+ if ( 0 == memcmp (spec, fmt, sizeof (struct fmt_spec)))
{
break;
}
}
- path = gtk_tree_model_get_path(model, &iter);
+ path = gtk_tree_model_get_path (model, &iter);
if ( path )
{
- gtk_tree_view_set_cursor(treeview, path, 0, 0);
- gtk_tree_path_free(path);
+ gtk_tree_view_set_cursor (treeview, path, 0, 0);
+ gtk_tree_path_free (path);
}
else
{
char str[FMT_STRING_LEN_MAX + 1];
- g_warning("Unusual date format: %s\n", fmt_to_string(fmt, str));
+ g_warning ("Unusual date format: %s\n", fmt_to_string (fmt, str));
}
}
/* Set the TREEVIEW list cursor to the item described by FMT_TYPE */
static void
-select_treeview_from_format_type(GtkTreeView *treeview,
+select_treeview_from_format_type (GtkTreeView *treeview,
const int fmt_type)
{
GtkTreePath *path ;
efficient, but the list is short ... */
GtkTreeIter iter;
- GtkTreeModel * model = gtk_tree_view_get_model(treeview);
+ GtkTreeModel * model = gtk_tree_view_get_model (treeview);
gboolean success;
- for (success = gtk_tree_model_get_iter_first(model, &iter);
+ for (success = gtk_tree_model_get_iter_first (model, &iter);
success;
- success = gtk_tree_model_iter_next(model, &iter))
+ success = gtk_tree_model_iter_next (model, &iter))
{
int spec ;
GValue value = {0};
- gtk_tree_model_get_value(model, &iter, 1, &value);
+ gtk_tree_model_get_value (model, &iter, 1, &value);
- spec = * ((int *) g_value_get_pointer(&value));
+ spec = * ((int *) g_value_get_pointer (&value));
if ( spec == fmt_type)
break;
}
- path = gtk_tree_model_get_path(model, &iter);
+ path = gtk_tree_model_get_path (model, &iter);
if ( path )
{
- gtk_tree_view_set_cursor(treeview, path, 0, 0);
- gtk_tree_path_free(path);
+ gtk_tree_view_set_cursor (treeview, path, 0, 0);
+ gtk_tree_path_free (path);
}
else
- g_warning("Unknown custom type %d\n", fmt_type);
+ g_warning ("Unknown custom type %d\n", fmt_type);
}
/* Set up the state of the dialog box to match the variable VAR */
static void
-var_type_dialog_set_state(struct var_type_dialog *dialog)
+var_type_dialog_set_state (struct var_type_dialog *dialog)
{
const struct fmt_spec *write_spec ;
- GString *str = g_string_new("");
+ GString *str = g_string_new ("");
- g_assert(dialog);
- g_assert(dialog->pv);
+ g_assert (dialog);
+ g_assert (dialog->pv);
/* Populate width and decimals */
write_spec = var_get_write_format (dialog->pv);
- g_string_printf(str, "%d", write_spec->d);
+ g_string_printf (str, "%d", write_spec->d);
- gtk_entry_set_text(GTK_ENTRY(dialog->entry_decimals),
+ gtk_entry_set_text (GTK_ENTRY(dialog->entry_decimals),
str->str);
- g_string_printf(str, "%d", write_spec->w);
+ g_string_printf (str, "%d", write_spec->w);
- gtk_entry_set_text(GTK_ENTRY(dialog->entry_width),
+ gtk_entry_set_text (GTK_ENTRY(dialog->entry_width),
str->str);
- g_string_free(str, TRUE);
+ g_string_free (str, TRUE);
/* Populate the radio button states */
switch (write_spec->type)
{
case FMT_F:
- var_type_dialog_set_active_button(dialog, BUTTON_NUMERIC);
- gtk_widget_show_all(dialog->width_decimals);
+ var_type_dialog_set_active_button (dialog, BUTTON_NUMERIC);
+ gtk_widget_show_all (dialog->width_decimals);
break;
case FMT_A:
- var_type_dialog_set_active_button(dialog, BUTTON_STRING);
- gtk_widget_hide(dialog->label_decimals);
- gtk_widget_hide(dialog->entry_decimals);
+ var_type_dialog_set_active_button (dialog, BUTTON_STRING);
+ gtk_widget_hide (dialog->label_decimals);
+ gtk_widget_hide (dialog->entry_decimals);
break;
case FMT_COMMA:
- var_type_dialog_set_active_button(dialog, BUTTON_COMMA);
- gtk_widget_show_all(dialog->width_decimals);
+ var_type_dialog_set_active_button (dialog, BUTTON_COMMA);
+ gtk_widget_show_all (dialog->width_decimals);
break;
case FMT_DOT:
- var_type_dialog_set_active_button(dialog, BUTTON_DOT);
- gtk_widget_show_all(dialog->width_decimals);
+ var_type_dialog_set_active_button (dialog, BUTTON_DOT);
+ gtk_widget_show_all (dialog->width_decimals);
break;
case FMT_DOLLAR:
- var_type_dialog_set_active_button(dialog, BUTTON_DOLLAR);
- gtk_widget_show_all(dialog->width_decimals);
+ 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, write_spec);
break;
case FMT_DATE:
case FMT_EDATE:
case FMT_DTIME:
case FMT_WKDAY:
case FMT_MONTH:
- 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);
+ 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);
break;
case FMT_CCA:
case FMT_CCB:
case FMT_CCC:
case FMT_CCD:
case FMT_CCE:
- var_type_dialog_set_active_button(dialog, BUTTON_CUSTOM);
- select_treeview_from_format_type(dialog->custom_treeview,
+ var_type_dialog_set_active_button (dialog, BUTTON_CUSTOM);
+ select_treeview_from_format_type (dialog->custom_treeview,
write_spec->type);
- gtk_widget_show_all(dialog->width_decimals);
+ gtk_widget_show_all (dialog->width_decimals);
break;
default:
- gtk_widget_show_all(dialog->width_decimals);
+ gtk_widget_show_all (dialog->width_decimals);
break;
}
}
/* Popup the dialog box */
void
-var_type_dialog_show(struct var_type_dialog *dialog)
+var_type_dialog_show (struct var_type_dialog *dialog)
{
- var_type_dialog_set_state(dialog);
+ var_type_dialog_set_state (dialog);
- gtk_widget_show(dialog->window);
+ gtk_widget_show (dialog->window);
}
/* Fills F with an output format specification with type TYPE, width
/* Callback for when the var type dialog is closed using the OK button.
It sets the appropriate variable accordingly. */
static gint
-on_var_type_ok_clicked(GtkWidget *w, gpointer data)
+on_var_type_ok_clicked (GtkWidget *w, gpointer data)
{
struct var_type_dialog *dialog = data;
- g_assert(dialog);
- g_assert(dialog->pv);
+ g_assert (dialog);
+ g_assert (dialog->pv);
{
- gint width = atoi(gtk_entry_get_text
+ gint width = atoi (gtk_entry_get_text
(GTK_ENTRY(dialog->entry_width)));
- gint decimals = atoi(gtk_entry_get_text
+ gint decimals = atoi (gtk_entry_get_text
(GTK_ENTRY(dialog->entry_decimals)));
gint new_type = VAR_NUMERIC;
case BUTTON_STRING:
new_type = VAR_STRING;
new_width = width;
- result = make_output_format_try(&spec, FMT_A, width, 0);
+ result = make_output_format_try (&spec, FMT_A, width, 0);
break;
case BUTTON_NUMERIC:
- result = make_output_format_try(&spec, FMT_F, width, decimals);
+ result = make_output_format_try (&spec, FMT_F, width, decimals);
break;
case BUTTON_COMMA:
- result = make_output_format_try(&spec, FMT_COMMA, width, decimals);
+ result = make_output_format_try (&spec, FMT_COMMA, width, decimals);
break;
case BUTTON_DOT:
- result = make_output_format_try(&spec, FMT_DOT, width, decimals);
+ result = make_output_format_try (&spec, FMT_DOT, width, decimals);
break;
case BUTTON_SCIENTIFIC:
- result = make_output_format_try(&spec, FMT_E, width, decimals);
+ result = make_output_format_try (&spec, FMT_E, width, decimals);
break;
case BUTTON_DATE:
case BUTTON_CUSTOM:
- g_assert(fmt_check_output(&dialog->fmt_l));
- result = memcpy(&spec, &dialog->fmt_l, sizeof(struct fmt_spec));
+ g_assert (fmt_check_output (&dialog->fmt_l));
+ result = memcpy (&spec, &dialog->fmt_l, sizeof (struct fmt_spec));
break;
case BUTTON_DOLLAR:
- result = make_output_format_try(&spec, FMT_DOLLAR, width, decimals);
+ result = make_output_format_try (&spec, FMT_DOLLAR, width, decimals);
break;
default:
- g_print("Unknown variable type: %d\n", dialog->active_button) ;
+ g_print ("Unknown variable type: %d\n", dialog->active_button) ;
result = false;
break;
}
}
}
- gtk_widget_hide(dialog->window);
+ gtk_widget_hide (dialog->window);
return FALSE;
}
gint
-on_var_type_cancel_clicked(GtkWidget *w, gpointer data)
+on_var_type_cancel_clicked (GtkWidget *w, gpointer data)
{
- gtk_widget_hide(w);
+ gtk_widget_hide (w);
return FALSE;
}
};
-struct var_type_dialog * var_type_dialog_create(GladeXML *xml);
+struct var_type_dialog * var_type_dialog_create (GladeXML *xml);
-void var_type_dialog_set_variable(struct var_type_dialog *dialog,
+void var_type_dialog_set_variable (struct var_type_dialog *dialog,
variable_changed_func set_variable_changed,
struct variable *var);
-void var_type_dialog_show(struct var_type_dialog *dialog);
+void var_type_dialog_show (struct var_type_dialog *dialog);
#endif