pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] pspp/src/ui/gui ChangeLog data-editor.c data-ed...


From: John Darrington
Subject: [Pspp-cvs] pspp/src/ui/gui ChangeLog data-editor.c data-ed...
Date: Fri, 29 Jun 2007 05:14:32 +0000

CVSROOT:        /sources/pspp
Module name:    pspp
Changes by:     John Darrington <jmd>   07/06/29 05:14:32

Modified files:
        src/ui/gui     : ChangeLog data-editor.c data-editor.glade 
                         psppire-data-store.c psppire-data-store.h 

Log message:
        (Re)enabled cell reference entry and datum entry widgets.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/ChangeLog?cvsroot=pspp&r1=1.60&r2=1.61
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/data-editor.c?cvsroot=pspp&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/data-editor.glade?cvsroot=pspp&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/psppire-data-store.c?cvsroot=pspp&r1=1.37&r2=1.38
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/psppire-data-store.h?cvsroot=pspp&r1=1.10&r2=1.11

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/ChangeLog,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -b -r1.60 -r1.61
--- ChangeLog   29 Jun 2007 00:52:03 -0000      1.60
+++ ChangeLog   29 Jun 2007 05:14:32 -0000      1.61
@@ -1,5 +1,11 @@
 2007-06-29  John Darrington <address@hidden>
 
+       * data-editor.c data-editor.glade psppire-data-store.c 
+       psppire-data-store.h: Enabled cell reference entry and datum 
+       entry widgets.
+
+2007-06-29  John Darrington <address@hidden>
+
        * data-editor.c data-sheet.c: Moved update_cell_ref_entry from 
        data-sheet.c to data-editor.c and made it work again.
 

Index: data-editor.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/data-editor.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- data-editor.c       29 Jun 2007 00:52:03 -0000      1.27
+++ data-editor.c       29 Jun 2007 05:14:32 -0000      1.28
@@ -171,7 +171,22 @@
 
 #endif
 
+static void
+datum_entry_activate (GtkEntry *entry, gpointer data)
+{
+  gint row, column;
+  GtkSheet *data_sheet = GTK_SHEET (data);
+  PsppireDataStore *store = PSPPIRE_DATA_STORE (gtk_sheet_get_model 
(data_sheet));
+
+  const char *text = gtk_entry_get_text (entry);
 
+  gtk_sheet_get_active_cell (data_sheet, &row, &column);
+
+  if ( row == -1 || column == -1)
+    return;
+
+  psppire_data_store_set_string (store, text, row, column);
+}
 
 /*
   Create a new data editor.
@@ -184,6 +199,7 @@
   GtkSheet *var_sheet ;
   GtkSheet *data_sheet ;
   PsppireVarStore *vs;
+  GtkWidget *datum_entry;
 
   de = g_malloc0 (sizeof (*de));
 
@@ -202,6 +218,12 @@
                    G_CALLBACK (update_data_ref_entry),
                    de->xml);
 
+  datum_entry = get_widget_assert (de->xml, "datum_entry");
+
+  g_signal_connect (G_OBJECT (datum_entry), "activate",
+                   G_CALLBACK (datum_entry_activate),
+                   data_sheet);
+
   g_signal_connect (vs->dict, "weight-changed",
                    G_CALLBACK (on_weight_change),
                    de);
@@ -302,9 +324,6 @@
                            de->action_data_open);
 
 
-
-
-
 #if RECENT_LISTS_AVAILABLE
   {
     GtkRecentManager *rm = gtk_recent_manager_get_default ();
@@ -1247,28 +1266,25 @@
 {
   GladeXML *data_editor_xml = data;
 
-  /* 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));
 
   g_return_val_if_fail (data_editor_xml, FALSE);
 
   if (data_store)
     {
-      const struct variable *pv =
+      const struct variable *var =
        psppire_dict_get_variable (data_store->dict, col);
 
-      gchar *text ;
-      gchar *s ;
-
-      text = g_strdup_printf ("%d: %s", row,
-                            pv ? var_get_name (pv) : "");
-
-      cell_ref_entry = GTK_ENTRY (get_widget_assert (data_editor_xml,
+      {
+       /* The entry where the reference to the current cell is displayed */
+       GtkEntry *cell_ref_entry =
+         GTK_ENTRY (get_widget_assert (data_editor_xml,
                                                   "cell_ref_entry"));
 
-      s = pspp_locale_to_utf8 (text, -1, 0);
+       gchar *text = g_strdup_printf ("%d: %s", row,
+                                      var ? var_get_name (var) : "");
+
+       gchar *s = pspp_locale_to_utf8 (text, -1, 0);
 
       g_free (text);
 
@@ -1277,5 +1293,21 @@
       g_free (s);
     }
 
+      {
+       GtkEntry *datum_entry =
+         GTK_ENTRY (get_widget_assert (data_editor_xml,
+                                       "datum_entry"));
+
+       gchar *text =
+         psppire_data_store_get_string (data_store, row,
+                                        var_get_dict_index(var));
+       g_strchug (text);
+
+       gtk_entry_set_text (datum_entry, text);
+
+       free (text);
+      }
+    }
+
   return FALSE;
 }

Index: data-editor.glade
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/data-editor.glade,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- data-editor.glade   30 Apr 2007 08:58:14 -0000      1.18
+++ data-editor.glade   29 Jun 2007 05:14:32 -0000      1.19
@@ -758,7 +758,7 @@
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkEntry" id="entry4">
+                      <widget class="GtkEntry" id="datum_entry">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                       </widget>

Index: psppire-data-store.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/psppire-data-store.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -b -r1.37 -r1.38
--- psppire-data-store.c        15 Jun 2007 01:24:28 -0000      1.37
+++ psppire-data-store.c        29 Jun 2007 05:14:32 -0000      1.38
@@ -58,11 +58,6 @@
 
 static void psppire_data_store_finalize        (GObject           *object);
 
-static gchar *psppire_data_store_get_string (const GSheetModel *sheet_model, 
gint row, gint column);
-
-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,
                                          gint row, gint column);
 
@@ -199,13 +194,32 @@
   return store->font_desc;
 }
 
+static inline gchar *
+psppire_data_store_get_string_wrapper (const GSheetModel *model, gint row,
+                                      gint column)
+{
+  return psppire_data_store_get_string (PSPPIRE_DATA_STORE (model), row, 
column);
+}
+
+
+static inline gboolean
+psppire_data_store_set_string_wrapper (GSheetModel *model,
+                                      const gchar *text,
+                                      gint row, gint column)
+{
+  return psppire_data_store_set_string (PSPPIRE_DATA_STORE (model), text,
+                                       row, column);
+}
+
+
+
 
 static void
 psppire_data_store_sheet_model_init (GSheetModelIface *iface)
 {
   iface->free_strings = TRUE;
-  iface->get_string = psppire_data_store_get_string;
-  iface->set_string = psppire_data_store_set_string;
+  iface->get_string = psppire_data_store_get_string_wrapper;
+  iface->set_string = psppire_data_store_set_string_wrapper;
   iface->clear_datum = psppire_data_store_clear_datum;
   iface->is_editable = NULL;
   iface->is_visible = NULL;
@@ -480,8 +494,8 @@
 }
 
 
-static gchar *
-psppire_data_store_get_string (const GSheetModel *model, gint row, gint column)
+gchar *
+psppire_data_store_get_string (PsppireDataStore *store, gint row, gint column)
 {
   gint idx;
   char *text;
@@ -489,7 +503,6 @@
   const struct variable *pv ;
   union value *v ;
   GString *s;
-  PsppireDataStore *store = PSPPIRE_DATA_STORE (model);
 
   g_return_val_if_fail (store->dict, NULL);
   g_return_val_if_fail (store->case_file, NULL);
@@ -575,12 +588,10 @@
    to ROW, COL with  the value TEXT.
    Returns true if anything was updated, false otherwise.
 */
-static gboolean
-psppire_data_store_set_string (GSheetModel *model,
+gboolean
+psppire_data_store_set_string (PsppireDataStore *store,
                          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);
 

Index: psppire-data-store.h
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/psppire-data-store.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- psppire-data-store.h        15 Jun 2007 01:24:28 -0000      1.10
+++ psppire-data-store.h        29 Jun 2007 05:14:32 -0000      1.11
@@ -108,7 +108,12 @@
 
 struct casereader * psppire_data_store_get_reader (PsppireDataStore *ds);
 
+gchar * psppire_data_store_get_string (PsppireDataStore *ds,
+                                      gint row, gint column);
 
+gboolean psppire_data_store_set_string (PsppireDataStore *ds,
+                                       const gchar *text,
+                                       gint row, gint column);
 
 #ifdef __cplusplus
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]