From: John Darrington Date: Wed, 25 Jul 2007 01:33:02 +0000 (+0000) Subject: Made Missing Values and Value Label cells non-editable, if the variable X-Git-Tag: v0.6.0~354 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=948629d16bb369cdda1f3b8f24d5440fc5976651;p=pspp-builds.git Made Missing Values and Value Label cells non-editable, if the variable is a long string variable. Closes bug #20564 --- diff --git a/src/ui/gui/ChangeLog b/src/ui/gui/ChangeLog index 23707386..e0b6a971 100644 --- a/src/ui/gui/ChangeLog +++ b/src/ui/gui/ChangeLog @@ -1,3 +1,13 @@ +2007-07-25 John Darrington + + * customentry.c: Redraw button in insensitive state, if the widget's + "editable" style is FALSE. Don't emit the "clicked" signal if + "editable" is FALSE. + + * var-sheet.c: If variables are long-string variables, then set the + "editable" properties of the entry widgets for the values and missing + cells to FALSE, + 2007-07-18 John Darrington * psppire-case-file.c psppire-case-file.h psppire-data-store.c diff --git a/src/ui/gui/customentry.c b/src/ui/gui/customentry.c index f7192fe1..b40c11cd 100644 --- a/src/ui/gui/customentry.c +++ b/src/ui/gui/customentry.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2005 Free Software Foundation + Copyright (C) 2005, 2007 Free Software Foundation This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -259,6 +259,7 @@ psppire_custom_entry_expose (GtkWidget *widget, if (GTK_WIDGET_DRAWABLE (widget)) { + gboolean is_editable; GtkShadowType shadow_type; GdkRectangle rect; @@ -275,14 +276,14 @@ psppire_custom_entry_expose (GtkWidget *widget, shadow_type = psppire_custom_entry_get_shadow_type (ce); - if (shadow_type != GTK_SHADOW_NONE) - { - gtk_paint_box (widget->style, ce->panel, - GTK_STATE_NORMAL, shadow_type, - NULL, widget, "customentry", - rect.x, rect.y, rect.width, rect.height); + g_object_get (widget, "editable", &is_editable, NULL); + + gtk_paint_box (widget->style, ce->panel, + is_editable ? GTK_STATE_NORMAL: GTK_STATE_INSENSITIVE, + shadow_type, + NULL, widget, "customentry", + rect.x, rect.y, rect.width, rect.height); - } gdk_window_end_paint (ce->panel); } @@ -370,10 +371,13 @@ psppire_custom_entry_button_press (GtkWidget *widget, if (event->window == ce->panel) { + gboolean is_editable ; if (!GTK_WIDGET_HAS_FOCUS (widget)) gtk_widget_grab_focus (widget); - if ( event->button == 1) + g_object_get (ce, "editable", &is_editable, NULL); + + if ( event->button == 1 && is_editable ) g_signal_emit (widget, custom_entry_signals[CLICKED], 0); } diff --git a/src/ui/gui/var-sheet.c b/src/ui/gui/var-sheet.c index b6440e4d..b57cdb57 100644 --- a/src/ui/gui/var-sheet.c +++ b/src/ui/gui/var-sheet.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2004, 2005, 2006 Free Software Foundation + Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -206,7 +206,7 @@ var_sheet_cell_entry_enter (GtkSheet * sheet, gint row, gint column, { GtkSheetCellAttr attributes; PsppireVarStore *var_store ; - struct variable *pv ; + struct variable *var ; GladeXML *xml; @@ -223,13 +223,13 @@ var_sheet_cell_entry_enter (GtkSheet * sheet, gint row, gint column, gtk_sheet_get_attributes (sheet, row, column, &attributes); - pv = psppire_var_store_get_var (var_store, row); + var = psppire_var_store_get_var (var_store, row); switch (column) { case COL_ALIGN: { - static GtkListStore *list_store = 0; + static GtkListStore *list_store = NULL; GtkComboBoxEntry *cbe; gtk_sheet_change_entry (sheet, GTK_TYPE_COMBO_BOX_ENTRY); cbe = @@ -245,9 +245,10 @@ var_sheet_cell_entry_enter (GtkSheet * sheet, gint row, gint column, g_signal_connect (G_OBJECT (cbe),"changed", - G_CALLBACK (change_alignment), pv); + G_CALLBACK (change_alignment), var); } break; + case COL_MEASURE: { static GtkListStore *list_store = 0; @@ -265,13 +266,13 @@ var_sheet_cell_entry_enter (GtkSheet * sheet, gint row, gint column, gtk_combo_box_entry_set_text_column (cbe, 0); g_signal_connect (G_OBJECT (cbe),"changed", - G_CALLBACK (change_measure), pv); + G_CALLBACK (change_measure), var); } break; case COL_VALUES: { - static struct val_labs_dialog *val_labs_dialog = 0; + static struct val_labs_dialog *val_labs_dialog = NULL; PsppireCustomEntry *customEntry; @@ -280,11 +281,15 @@ var_sheet_cell_entry_enter (GtkSheet * sheet, gint row, gint column, customEntry = PSPPIRE_CUSTOM_ENTRY (gtk_sheet_get_entry (sheet)); + if ( var_is_long_string (var)) + g_object_set (customEntry, + "editable", FALSE, + NULL); if (!val_labs_dialog ) val_labs_dialog = val_labs_dialog_create (xml); - val_labs_dialog_set_target_variable (val_labs_dialog, pv); + val_labs_dialog_set_target_variable (val_labs_dialog, var); g_signal_connect_swapped (GTK_OBJECT (customEntry), "clicked", @@ -292,6 +297,7 @@ var_sheet_cell_entry_enter (GtkSheet * sheet, gint row, gint column, val_labs_dialog); } break; + case COL_MISSING: { static struct missing_val_dialog *missing_val_dialog = 0; @@ -302,6 +308,11 @@ var_sheet_cell_entry_enter (GtkSheet * sheet, gint row, gint column, customEntry = PSPPIRE_CUSTOM_ENTRY (gtk_sheet_get_entry (sheet)); + if ( var_is_long_string (var)) + g_object_set (customEntry, + "editable", FALSE, + NULL); + if (!missing_val_dialog ) missing_val_dialog = missing_val_dialog_create (xml); @@ -331,7 +342,7 @@ var_sheet_cell_entry_enter (GtkSheet * sheet, gint row, gint column, var_type_dialog = var_type_dialog_create (xml); - var_type_dialog->pv = pv; + var_type_dialog->pv = var; g_signal_connect_swapped (GTK_OBJECT (customEntry), "clicked", @@ -339,6 +350,7 @@ var_sheet_cell_entry_enter (GtkSheet * sheet, gint row, gint column, var_type_dialog); } break; + case COL_WIDTH: case COL_DECIMALS: case COL_COLUMNS: @@ -355,7 +367,7 @@ var_sheet_cell_entry_enter (GtkSheet * sheet, gint row, gint column, const gint current_value = atoi (s); GtkObject *adj ; - const struct fmt_spec *fmt = var_get_write_format (pv); + const struct fmt_spec *fmt = var_get_write_format (var); switch (column) { case COL_WIDTH: