pspp-cvs
[Top][All Lists]
Advanced

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

[Pspp-cvs] pspp lib/gtksheet/gsheet-column-iface.c lib/gtk...


From: John Darrington
Subject: [Pspp-cvs] pspp lib/gtksheet/gsheet-column-iface.c lib/gtk...
Date: Sun, 23 Jul 2006 10:32:50 +0000

CVSROOT:        /sources/pspp
Module name:    pspp
Changes by:     John Darrington <jmd>   06/07/23 10:32:50

Modified files:
        lib/gtksheet   : gsheet-column-iface.c gsheet-column-iface.h 
                         gsheet-hetero-column.c gsheet-uniform-column.c 
                         gtksheet.c 
        src/ui/gui     : TODO data-sheet.c psppire-data-store.c 
                         psppire-data-store.h 

Log message:
        Fixed bug where gui would crash when columns were resized.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/lib/gtksheet/gsheet-column-iface.c?cvsroot=pspp&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/pspp/lib/gtksheet/gsheet-column-iface.h?cvsroot=pspp&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/pspp/lib/gtksheet/gsheet-hetero-column.c?cvsroot=pspp&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/pspp/lib/gtksheet/gsheet-uniform-column.c?cvsroot=pspp&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/pspp/lib/gtksheet/gtksheet.c?cvsroot=pspp&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/TODO?cvsroot=pspp&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/data-sheet.c?cvsroot=pspp&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/psppire-data-store.c?cvsroot=pspp&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/psppire-data-store.h?cvsroot=pspp&r1=1.3&r2=1.4

Patches:
Index: lib/gtksheet/gsheet-column-iface.c
===================================================================
RCS file: /sources/pspp/pspp/lib/gtksheet/gsheet-column-iface.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- lib/gtksheet/gsheet-column-iface.c  19 Jun 2006 10:16:51 -0000      1.4
+++ lib/gtksheet/gsheet-column-iface.c  23 Jul 2006 10:32:50 -0000      1.5
@@ -99,58 +99,57 @@
 
 
 inline void  
-g_sheet_column_set_width (GSheetColumn *column, gint col, gint size, 
-                         gpointer data)
+g_sheet_column_set_width (GSheetColumn *column, gint col, gint size)
 {
   g_return_if_fail (G_IS_SHEET_COLUMN (column));
 
   if ((G_SHEET_COLUMN_GET_IFACE (column)->set_width) ) 
-    (G_SHEET_COLUMN_GET_IFACE (column)->set_width) (column, col, size, data);
+    (G_SHEET_COLUMN_GET_IFACE (column)->set_width) (column, col, size);
 }
 
 
 inline gint 
-g_sheet_column_get_width (const GSheetColumn *column, gint col, gpointer data)
+g_sheet_column_get_width (const GSheetColumn *column, gint col)
 {
   g_return_val_if_fail (G_IS_SHEET_COLUMN (column), -1);
 
   g_assert (G_SHEET_COLUMN_GET_IFACE (column)->get_width);
   
-  return (G_SHEET_COLUMN_GET_IFACE (column)->get_width) (column, col, data);
+  return (G_SHEET_COLUMN_GET_IFACE (column)->get_width) (column, col);
 }
 
 
 
 inline gboolean  
 g_sheet_column_get_visibility(const GSheetColumn *column,
-                                           gint col, gpointer data)
+                                           gint col)
 {
   g_return_val_if_fail (G_IS_SHEET_COLUMN (column), FALSE);
 
   g_assert (G_SHEET_COLUMN_GET_IFACE (column)->get_visibility);
   
   return (G_SHEET_COLUMN_GET_IFACE (column)->get_visibility) (column, 
-                                                                 col, data);
+                                                                 col);
 
 }
 
 inline gboolean  
 g_sheet_column_get_sensitivity(const GSheetColumn *column,
-                                            gint col, gpointer data)
+                                            gint col)
 {
   g_return_val_if_fail (G_IS_SHEET_COLUMN (column), FALSE);
 
   g_assert (G_SHEET_COLUMN_GET_IFACE (column)->get_sensitivity);
   
   return (G_SHEET_COLUMN_GET_IFACE (column)->get_sensitivity) (column, 
-                                                                  col, data);
+                                                                  col);
 
 }
 
 
 inline GtkSheetButton *
 g_sheet_column_get_button(const GSheetColumn *column,
-                             gint col, gpointer data)
+                             gint col)
 {
   GtkSheetButton *button = gtk_sheet_button_new();
 
@@ -159,20 +158,20 @@
   g_return_val_if_fail (G_IS_SHEET_COLUMN (column), FALSE);
 
   if ( iface->get_button_label)
-    button->label = iface->get_button_label(column, col, data);
+    button->label = iface->get_button_label(column, col);
 
   return button;
 }
 
 inline GtkJustification 
 g_sheet_column_get_justification(const GSheetColumn *column, 
-                                    gint col, gpointer data)
+                                    gint col)
 {
   g_return_val_if_fail (G_IS_SHEET_COLUMN (column), FALSE);
 
   g_assert (G_SHEET_COLUMN_GET_IFACE (column)->get_justification);
   
-  return (G_SHEET_COLUMN_GET_IFACE (column)->get_justification) (column, col, 
data);
+  return (G_SHEET_COLUMN_GET_IFACE (column)->get_justification) (column, col);
 }
 
 
@@ -180,76 +179,76 @@
 
 inline gint  
 g_sheet_column_get_left_text_column (const GSheetColumn *column,
-                                        gint col, gpointer data)
+                                        gint col)
 {
   g_return_val_if_fail (G_IS_SHEET_COLUMN (column), -1);
 
   if  ( ! G_SHEET_COLUMN_GET_IFACE (column)->get_left_text_column)
     return col;
   
-  return (G_SHEET_COLUMN_GET_IFACE (column)->get_left_text_column) (column, 
col, data);
+  return (G_SHEET_COLUMN_GET_IFACE (column)->get_left_text_column) (column, 
col);
 
 }
 
 inline gint  
 g_sheet_column_get_right_text_column (const GSheetColumn *column,
-                                         gint col, gpointer data)
+                                         gint col)
 {
   g_return_val_if_fail (G_IS_SHEET_COLUMN (column), -1);
 
   if  ( ! G_SHEET_COLUMN_GET_IFACE (column)->get_right_text_column)
     return col;
   
-  return (G_SHEET_COLUMN_GET_IFACE (column)->get_right_text_column) (column, 
col, data);
+  return (G_SHEET_COLUMN_GET_IFACE (column)->get_right_text_column) (column, 
col);
 
 }
 
 inline void 
 g_sheet_column_set_left_text_column (const GSheetColumn *column,
-                                        gint col, gint i, gpointer data)
+                                        gint col, gint i)
 {
   g_return_if_fail (G_IS_SHEET_COLUMN (column));
 
   if  ( G_SHEET_COLUMN_GET_IFACE (column)->set_left_text_column)
-    (G_SHEET_COLUMN_GET_IFACE (column)->set_left_text_column) (column, col, i, 
data);
+    (G_SHEET_COLUMN_GET_IFACE (column)->set_left_text_column) (column, col, i);
 
 }
 
 
 inline void 
 g_sheet_column_set_right_text_column (const GSheetColumn *column,
-                                         gint col, gint i, gpointer data)
+                                         gint col, gint i)
 {
   g_return_if_fail (G_IS_SHEET_COLUMN (column));
 
   if  ( G_SHEET_COLUMN_GET_IFACE (column)->set_right_text_column)
-    (G_SHEET_COLUMN_GET_IFACE (column)->set_right_text_column) (column, col, 
i, data);
+    (G_SHEET_COLUMN_GET_IFACE (column)->set_right_text_column) (column, col, 
i);
 }
 
 inline gint  
-g_sheet_column_get_column_count(const GSheetColumn *geo, gpointer data)
+g_sheet_column_get_column_count(const GSheetColumn *geo)
 {
   g_return_val_if_fail (G_IS_SHEET_COLUMN (geo), -1);
 
   g_assert  ( G_SHEET_COLUMN_GET_IFACE (geo)->get_column_count);
 
-  return (G_SHEET_COLUMN_GET_IFACE (geo)->get_column_count) (geo, data);
+  return (G_SHEET_COLUMN_GET_IFACE (geo)->get_column_count) (geo);
 }
 
 inline gint  
-g_sheet_column_start_pixel(const GSheetColumn *geo, gint col, gpointer data)
+g_sheet_column_start_pixel(const GSheetColumn *geo, gint col)
 {
   gint i;
   gint start_pixel = 0;
 
   g_return_val_if_fail (G_IS_SHEET_COLUMN (geo), -1);
   g_return_val_if_fail (col < 
-                       g_sheet_column_get_column_count(geo, data),-1);
+                       g_sheet_column_get_column_count(geo),-1);
 
   for ( i = 0 ; i < col ; ++i ) 
     {
-      if ( g_sheet_column_get_visibility(geo, i, data))
-       start_pixel += g_sheet_column_get_width(geo, i, data);
+      if ( g_sheet_column_get_visibility(geo, i))
+       start_pixel += g_sheet_column_get_width(geo, i);
     }
   
   return start_pixel;

Index: lib/gtksheet/gsheet-column-iface.h
===================================================================
RCS file: /sources/pspp/pspp/lib/gtksheet/gsheet-column-iface.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- lib/gtksheet/gsheet-column-iface.h  19 Jun 2006 10:16:51 -0000      1.3
+++ lib/gtksheet/gsheet-column-iface.h  23 Jul 2006 10:32:50 -0000      1.4
@@ -47,37 +47,37 @@
                                      gint col, gint n_columns);
 
   /* Virtual Table */
-  gint (* get_width) (const GSheetColumn *gcolumn, gint col, gpointer data);
-  void (* set_width) (GSheetColumn *gcolumn, gint col, gint width, gpointer 
data);
+  gint (* get_width) (const GSheetColumn *gcolumn, gint col);
+  void (* set_width) (GSheetColumn *gcolumn, gint col, gint width);
 
-  gboolean (* get_visibility) (const GSheetColumn *gcolumn, gint col, gpointer 
data);
-  gboolean (* get_sensitivity) (const GSheetColumn *gcolumn, gint col, 
gpointer data);
-  const GtkSheetButton * (* get_button) (const GSheetColumn *gcolumn, gint 
col, gpointer data);
-  GtkJustification (* get_justification) (const GSheetColumn *gcolumn, gint 
col, gpointer data);
+  gboolean (* get_visibility) (const GSheetColumn *gcolumn, gint col);
+  gboolean (* get_sensitivity) (const GSheetColumn *gcolumn, gint col);
+  const GtkSheetButton * (* get_button) (const GSheetColumn *gcolumn, gint 
col);
+  GtkJustification (* get_justification) (const GSheetColumn *gcolumn, gint 
col);
 
   gint  (*get_left_text_column) (const GSheetColumn *gcolumn,
-                                gint col, gpointer data);
+                                gint col);
 
   gint  (*get_right_text_column) (const GSheetColumn *gcolumn,
-                                 gint col, gpointer data);
+                                 gint col);
 
   void (* set_left_text_column) (const GSheetColumn *gcolumn,
-                                gint col, gint i, gpointer data);
+                                gint col, gint i);
 
   void (* set_right_text_column) (const GSheetColumn *gcolumn,
-                                 gint col, gint i, gpointer data);
+                                 gint col, gint i);
 
-  gint  (* get_column_count) (const GSheetColumn *geo, gpointer data);
+  gint  (* get_column_count) (const GSheetColumn *geo);
 
 
-  GtkStateType  (*get_button_state)(const GSheetColumn *geo, gint col, 
gpointer data);
-  gchar * (*get_button_label)(const GSheetColumn *geo, gint col, gpointer 
data);
+  GtkStateType  (*get_button_state)(const GSheetColumn *geo, gint col);
+  gchar * (*get_button_label)(const GSheetColumn *geo, gint col);
   gboolean      (*get_button_visibility)(const GSheetColumn *geo, 
-                                       gint col, gpointer data);
+                                       gint col);
   const GtkSheetChild * (*get_button_child)(const GSheetColumn *geo, 
-                                          gint col, gpointer data);
+                                          gint col);
   GtkJustification * (*get_button_justification)(const GSheetColumn *geo, 
-                                               gint col, gpointer data);
+                                               gint col);
 };
 
 
@@ -85,43 +85,43 @@
 
 
 inline gint  g_sheet_column_get_width (const GSheetColumn *gcolumn,
-                                      gint col, gpointer data);
+                                      gint col);
 
 
 inline void  g_sheet_column_set_width (GSheetColumn *gcolumn,
-                                      gint col, gint size, gpointer data);
+                                      gint col, gint size);
 
 
 inline gboolean  g_sheet_column_get_visibility(const GSheetColumn *gcolumn,
-                                           gint col, gpointer data);
+                                           gint col);
 
 inline gboolean  g_sheet_column_get_sensitivity(const GSheetColumn *gcolumn,
-                                            gint col, gpointer data);
+                                            gint col);
 
 
 inline GtkSheetButton *g_sheet_column_get_button(const GSheetColumn *gcolumn,
-                                            gint col, gpointer data);
+                                            gint col);
 
-inline GtkJustification g_sheet_column_get_justification(const GSheetColumn 
*gcolumn, gint col, gpointer data);
+inline GtkJustification g_sheet_column_get_justification(const GSheetColumn 
*gcolumn, gint col);
 
 
 inline gint  g_sheet_column_get_left_text_column (const GSheetColumn *gcolumn,
-                                       gint col, gpointer data);
+                                       gint col);
 
 inline gint  g_sheet_column_get_right_text_column (const GSheetColumn *gcolumn,
-                                       gint col, gpointer data);
+                                       gint col);
 
 inline void g_sheet_column_set_left_text_column (const GSheetColumn *gcolumn,
-                                       gint col, gint i, gpointer data);
+                                       gint col, gint i);
 
 
 inline void g_sheet_column_set_right_text_column (const GSheetColumn *gcolumn,
-                                       gint col, gint i, gpointer data);
+                                       gint col, gint i);
 
 
-inline gint  g_sheet_column_get_column_count(const GSheetColumn *geo, gpointer 
data);
+inline gint  g_sheet_column_get_column_count(const GSheetColumn *geo);
 
-inline gint  g_sheet_column_start_pixel(const GSheetColumn *geo, gint col, 
gpointer data);
+inline gint  g_sheet_column_start_pixel(const GSheetColumn *geo, gint col);
 
 inline void g_sheet_column_columns_changed(GSheetColumn *geo, 
                                           gint first, gint n_columns);

Index: lib/gtksheet/gsheet-hetero-column.c
===================================================================
RCS file: /sources/pspp/pspp/lib/gtksheet/gsheet-hetero-column.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- lib/gtksheet/gsheet-hetero-column.c 19 Jun 2006 10:16:51 -0000      1.5
+++ lib/gtksheet/gsheet-hetero-column.c 23 Jul 2006 10:32:50 -0000      1.6
@@ -104,7 +104,7 @@
 }
 
 static gint 
-g_sheet_hetero_column_get_width(const GSheetColumn *geom, gint i, gpointer 
data)
+g_sheet_hetero_column_get_width(const GSheetColumn *geom, gint i)
 {
   GSheetHeteroColumn *hg = G_SHEET_HETERO_COLUMN(geom);
 
@@ -114,14 +114,14 @@
 }
 
 static gint 
-g_sheet_hetero_column_get_sensitivity(const GSheetColumn *geom, gint u, 
gpointer data)
+g_sheet_hetero_column_get_sensitivity(const GSheetColumn *geom, gint u)
 {
   return TRUE;
 }
 
 
 static gint 
-g_sheet_hetero_column_get_visibility(const GSheetColumn *geom, gint u, 
gpointer data)
+g_sheet_hetero_column_get_visibility(const GSheetColumn *geom, gint u)
 {
   return TRUE;
 }
@@ -129,7 +129,7 @@
 
 
 static gchar *
-g_sheet_hetero_column_get_button_label(const GSheetColumn *geom, gint u, 
gpointer data)
+g_sheet_hetero_column_get_button_label(const GSheetColumn *geom, gint u)
 {
   GSheetHeteroColumn *hg = G_SHEET_HETERO_COLUMN(geom);
 
@@ -138,7 +138,7 @@
 
 
 static GtkJustification
-g_sheet_hetero_column_get_justification(const GSheetColumn *geom, gint u, 
gpointer data)
+g_sheet_hetero_column_get_justification(const GSheetColumn *geom, gint u)
 {
   return GTK_JUSTIFY_FILL;
 }
@@ -146,7 +146,7 @@
 
 
 static gint 
-g_sheet_hetero_column_get_column_count(const GSheetColumn *geom, gpointer data)
+g_sheet_hetero_column_get_column_count(const GSheetColumn *geom)
 {
   GSheetHeteroColumn *hg = G_SHEET_HETERO_COLUMN(geom);
 
@@ -185,8 +185,7 @@
 }
 
 static void 
-hetero_column_set_width(GSheetColumn *geo,
-                                     gint i, gint size, gpointer data)
+hetero_column_set_width(GSheetColumn *geo, gint i, gint size)
 {
   GSheetHeteroColumn *hg = G_SHEET_HETERO_COLUMN(geo);
 
@@ -227,12 +226,11 @@
 
 
 inline void 
-g_sheet_hetero_column_set_width(GSheetHeteroColumn *geo,
-                                            gint i, gint size)
+g_sheet_hetero_column_set_width(GSheetHeteroColumn *geo, gint i, gint size)
 {
   GSheetColumn *iface = G_SHEET_COLUMN(geo);
 
-  hetero_column_set_width(iface, i, size, 0);
+  hetero_column_set_width(iface, i, size);
 }
 
 

Index: lib/gtksheet/gsheet-uniform-column.c
===================================================================
RCS file: /sources/pspp/pspp/lib/gtksheet/gsheet-uniform-column.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- lib/gtksheet/gsheet-uniform-column.c        19 Jun 2006 10:16:51 -0000      
1.3
+++ lib/gtksheet/gsheet-uniform-column.c        23 Jul 2006 10:32:50 -0000      
1.4
@@ -96,7 +96,7 @@
 }
 
 static gint 
-g_sheet_uniform_column_get_width(const GSheetColumn *geom, gint u, gpointer 
data)
+g_sheet_uniform_column_get_width(const GSheetColumn *geom, gint u)
 {
   GSheetUniformColumn *ug = G_SHEET_UNIFORM_COLUMN(geom);
   
@@ -104,7 +104,7 @@
 }
 
 static gint 
-g_sheet_uniform_column_get_sensitivity(const GSheetColumn *geom, gint u, 
gpointer data)
+g_sheet_uniform_column_get_sensitivity(const GSheetColumn *geom, gint u)
 {
   GSheetUniformColumn *ug = G_SHEET_UNIFORM_COLUMN(geom);
   
@@ -113,7 +113,7 @@
 
 
 static gint 
-g_sheet_uniform_column_get_visibility(const GSheetColumn *geom, gint u, 
gpointer data)
+g_sheet_uniform_column_get_visibility(const GSheetColumn *geom, gint u)
 {
   GSheetUniformColumn *ug = G_SHEET_UNIFORM_COLUMN(geom);
   
@@ -122,7 +122,7 @@
 
 
 static gchar *
-g_sheet_uniform_column_get_button_label(const GSheetColumn *geom, gint u, 
gpointer data)
+g_sheet_uniform_column_get_button_label(const GSheetColumn *geom, gint u)
 {
   gchar *label = g_strdup_printf("%d", u);
 
@@ -131,7 +131,7 @@
 
 
 static GtkJustification
-g_sheet_uniform_column_get_justification(const GSheetColumn *geom, gint u, 
gpointer data)
+g_sheet_uniform_column_get_justification(const GSheetColumn *geom, gint u)
 {
   return GTK_JUSTIFY_FILL;
 }
@@ -139,7 +139,7 @@
 
 
 static gint 
-g_sheet_uniform_column_get_column_count(const GSheetColumn *geom, gpointer 
data)
+g_sheet_uniform_column_get_column_count(const GSheetColumn *geom)
 {
   GSheetUniformColumn *ug = G_SHEET_UNIFORM_COLUMN(geom);
 

Index: lib/gtksheet/gtksheet.c
===================================================================
RCS file: /sources/pspp/pspp/lib/gtksheet/gtksheet.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- lib/gtksheet/gtksheet.c     19 Jun 2006 10:16:51 -0000      1.11
+++ lib/gtksheet/gtksheet.c     23 Jul 2006 10:32:50 -0000      1.12
@@ -269,7 +269,7 @@
   GSheetColumn *col_geo = sheet->column_geometry;
   if ( col < 0 ) return NULL ; 
 
-  return g_sheet_column_get_button(col_geo, col, 0);
+  return g_sheet_column_get_button(col_geo, col);
 }
 
 
@@ -278,9 +278,7 @@
 {
   GSheetColumn *geo = sheet->column_geometry;
 
-  /* FIXME: Get rid of this nasty cast.
-     In fact, get rid of this entire variable */
-  gint x = g_sheet_column_start_pixel(geo, col, (GtkSheet *) sheet);
+  gint x = g_sheet_column_start_pixel(geo, col);
 
   if ( sheet->row_titles_visible ) 
     x += sheet->row_title_area.width;
@@ -293,9 +291,7 @@
 {
   GSheetColumn *col_geo = sheet->column_geometry;
 
-  /* FIXME: Get rid of this nasty cast.
-     In fact, get rid of this entire variable */
-  return g_sheet_column_get_width(col_geo, col, (GtkSheet *)sheet);
+  return g_sheet_column_get_width(col_geo, col);
 }
 
 
@@ -303,7 +299,7 @@
 xxx_set_column_width(GtkSheet *sheet, gint col, gint width)
 {
   if ( sheet->column_geometry ) 
-    g_sheet_column_set_width(sheet->column_geometry, col, width, sheet);
+    g_sheet_column_set_width(sheet->column_geometry, col, width);
 }
 
 static inline void
@@ -311,7 +307,7 @@
 {
   GSheetColumn *col_geo = sheet->column_geometry;
 
-  g_sheet_column_set_left_text_column(col_geo, col, i, sheet);
+  g_sheet_column_set_left_text_column(col_geo, col, i);
 }
 
 static inline gint
@@ -319,7 +315,7 @@
 {
   GSheetColumn *col_geo = sheet->column_geometry;
 
-  return g_sheet_column_get_left_text_column(col_geo, col, 0);
+  return g_sheet_column_get_left_text_column(col_geo, col);
 }
 
 static inline void
@@ -327,7 +323,7 @@
 {
   GSheetColumn *col_geo = sheet->column_geometry;
 
-  g_sheet_column_set_right_text_column(col_geo, col, i, 0);
+  g_sheet_column_set_right_text_column(col_geo, col, i);
 }
 
 static inline gint
@@ -335,7 +331,7 @@
 {
   GSheetColumn *col_geo = sheet->column_geometry;
 
-  return g_sheet_column_get_right_text_column(col_geo, col, 0);
+  return g_sheet_column_get_right_text_column(col_geo, col);
 }
 
 static inline GtkJustification
@@ -343,7 +339,7 @@
 {
   GSheetColumn *col_geo = sheet->column_geometry;
 
-  return g_sheet_column_get_justification(col_geo, col, 0);
+  return g_sheet_column_get_justification(col_geo, col);
 }
 
 static inline gint
@@ -351,7 +347,7 @@
 {
   GSheetColumn *col_geo = sheet->column_geometry;
 
-  return g_sheet_column_get_visibility(col_geo, col, 0);
+  return g_sheet_column_get_visibility(col_geo, col);
 }
 
 
@@ -360,7 +356,7 @@
 {
   GSheetColumn *col_geo = sheet->column_geometry;
 
-  return g_sheet_column_get_sensitivity(col_geo, col, 0);
+  return g_sheet_column_get_sensitivity(col_geo, col);
 }
 
 
@@ -377,7 +373,7 @@
 {
   GSheetColumn *col_geo = sheet->column_geometry;
 
-  return g_sheet_column_get_column_count(col_geo, 0);
+  return g_sheet_column_get_column_count(col_geo);
 }
 
 /* returns the column index from a x pixel location in the 
@@ -481,7 +477,6 @@
 POSSIBLE_YDRAG(const GtkSheet *sheet, gint y, gint *drag_row)
 {
  gint row, ydrag;
-
  row=ROW_FROM_YPIXEL(sheet, y);
  *drag_row=row;
 
@@ -4733,7 +4728,7 @@
 
   g_return_if_fail (sheet != NULL);
 
-  if(range==NULL) range=&sheet->range;
+  if(range == NULL) range = &sheet->range;
 
   memcpy(&sheet->range, range, sizeof(*range));
 
@@ -4742,39 +4737,10 @@
 
   state = sheet->state;
 
-#if 0
-  if(state==GTK_SHEET_COLUMN_SELECTED || state==GTK_SHEET_RANGE_SELECTED){
-   for(i=sheet->range.col0; i< range->col0; i++)
-    column_button_release(sheet, i);
-   for(i=range->coli+1; i<= sheet->range.coli; i++)
-    column_button_release(sheet, i);
-   for(i=range->col0; i<=range->coli; i++){
-    column_button_set(sheet, i);
-   }
-  }
- 
-  if(state==GTK_SHEET_ROW_SELECTED || state==GTK_SHEET_RANGE_SELECTED){
-   for(i=sheet->range.row0; i< range->row0; i++)
-    row_button_release(sheet, i);
-   for(i=range->rowi+1; i<= sheet->range.rowi; i++)
-    row_button_release(sheet, i);
-   for(i=range->row0; i<=range->rowi; i++){
-    row_button_set(sheet, i);
-   }
-  }
-#endif
-
   if(range->coli != sheet->range.coli || range->col0 != sheet->range.col0 ||
      range->rowi != sheet->range.rowi || range->row0 != sheet->range.row0)
          {
-
-           gtk_sheet_new_selection(sheet, range);
-
-          sheet->range.col0=range->col0;
-          sheet->range.coli=range->coli;
-          sheet->range.row0=range->row0;
-          sheet->range.rowi=range->rowi;
-
+           gtk_sheet_new_selection(sheet, &sheet->range);
         }
   else
          {
@@ -4782,7 +4748,7 @@
            gtk_sheet_range_draw_selection(sheet, sheet->range);
          }
 
-  gtk_signal_emit(GTK_OBJECT(sheet), sheet_signals[SELECT_RANGE], range);
+  gtk_signal_emit(GTK_OBJECT(sheet), sheet_signals[SELECT_RANGE], 
&sheet->range);
 }
 
 void
@@ -5257,14 +5223,16 @@
   sheet=GTK_SHEET(widget);
 
   /* release on resize windows */
-  if (GTK_SHEET_IN_XDRAG (sheet)){
+  if (GTK_SHEET_IN_XDRAG (sheet))
+    {
          GTK_SHEET_UNSET_FLAGS (sheet, GTK_SHEET_IN_XDRAG);
           GTK_SHEET_UNSET_FLAGS (sheet, GTK_SHEET_IN_SELECTION);
          gtk_widget_get_pointer (widget, &x, NULL);
          gdk_pointer_ungrab (event->time);
          draw_xor_vline (sheet);
          
-         gtk_sheet_set_column_width (sheet, sheet->drag_cell.col, 
new_column_width (sheet, sheet->drag_cell.col, &x));
+      gtk_sheet_set_column_width (sheet, sheet->drag_cell.col, 
+                                 new_column_width (sheet, 
sheet->drag_cell.col, &x));
           sheet->old_hadjustment = -1.;
           gtk_signal_emit_by_name (GTK_OBJECT (sheet->hadjustment), 
"value_changed");
          return TRUE;
@@ -6266,11 +6234,13 @@
 
  sheet_entry = GTK_ENTRY(gtk_sheet_get_entry(sheet));
 
- gtk_sheet_get_attributes(sheet, sheet->active_cell.row, 
sheet->active_cell.col,                               &attributes);
+ if ( ! gtk_sheet_get_attributes(sheet, sheet->active_cell.row, 
+                                sheet->active_cell.col,
+                                &attributes) ) 
+   return ;
 
- if(GTK_WIDGET_REALIZED(sheet->sheet_entry))
+ if ( GTK_WIDGET_REALIZED(sheet->sheet_entry) )
     {
-
       if(!GTK_WIDGET(sheet_entry)->style) 
         gtk_widget_ensure_style(GTK_WIDGET(sheet_entry));
 
@@ -6285,6 +6255,7 @@
       style->text[GTK_STATE_ACTIVE] = attributes.foreground;
 
       pango_font_description_free(style->font_desc);
+     g_assert(attributes.font_desc);
       style->font_desc = pango_font_description_copy(attributes.font_desc);
 
       GTK_WIDGET(sheet_entry)->style = style;
@@ -6309,9 +6280,8 @@
 
  text_size = 0;
  text = gtk_entry_get_text(GTK_ENTRY(sheet_entry));
- if(text && strlen(text) > 0){ 
+ if(text && strlen(text) > 0)
      text_size = STRING_WIDTH(GTK_WIDGET(sheet), attributes.font_desc, text);
- }
 
  column_width=xxx_column_width(sheet, sheet->active_cell.col);
 
@@ -6326,8 +6296,8 @@
  shentry_allocation.width = column_width;
  shentry_allocation.height = yyy_row_height(sheet, sheet->active_cell.row);
 
- if(GTK_IS_ITEM_ENTRY(sheet->sheet_entry)){
-
+ if(GTK_IS_ITEM_ENTRY(sheet->sheet_entry))
+   {
    shentry_allocation.height -= 2*CELLOFFSET;
    shentry_allocation.y += CELLOFFSET;
    if(gtk_sheet_clip_text(sheet))
@@ -6347,7 +6317,6 @@
        shentry_allocation.x += CELLOFFSET;
        break;
     }
-
  }
 
  if(!GTK_IS_ITEM_ENTRY(sheet->sheet_entry))
@@ -6376,7 +6345,8 @@
  row=sheet->active_cell.row;
  col=sheet->active_cell.col;
 
- if(!GTK_IS_ITEM_ENTRY(sheet->sheet_entry) || gtk_sheet_clip_text(sheet)) 
return;
+ if( ! GTK_IS_ITEM_ENTRY(sheet->sheet_entry) || gtk_sheet_clip_text(sheet)) 
+   return;
 
  justification = GTK_ITEM_ENTRY(sheet->sheet_entry)->justification;
 
@@ -7312,16 +7282,17 @@
 
   xxx_set_column_width(sheet, column, width);
 
-  if(GTK_WIDGET_REALIZED(GTK_WIDGET(sheet)) && !GTK_SHEET_IS_FROZEN(sheet)){
+  if(GTK_WIDGET_REALIZED(GTK_WIDGET(sheet)) && !GTK_SHEET_IS_FROZEN(sheet))
+    {
     size_allocate_column_title_buttons (sheet);
     adjust_scrollbars (sheet);
     gtk_sheet_size_allocate_entry(sheet);
     gtk_sheet_range_draw (sheet, NULL);
-  } else
+    } 
 
   gtk_signal_emit(GTK_OBJECT(sheet), sheet_signals[CHANGED], -1, column);
-  gtk_signal_emit(GTK_OBJECT(sheet), sheet_signals[NEW_COL_WIDTH], column, 
width);
-
+  gtk_signal_emit(GTK_OBJECT(sheet), sheet_signals[NEW_COL_WIDTH], 
+                 column, width);
 }
 
 

Index: src/ui/gui/TODO
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/TODO,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- src/ui/gui/TODO     3 Jul 2006 01:38:24 -0000       1.3
+++ src/ui/gui/TODO     23 Jul 2006 10:32:50 -0000      1.4
@@ -1,5 +1,3 @@
-* Crashes when resizing rows/columns when no cell is selected.
-
 * Blank cell reference when deselecting cells. (Eg New command).
 
 * Strip leading/trailing whitespace on data in cells.
@@ -8,8 +6,6 @@
 
 * Case weights.
 
-* Resizing of string variables.
-
 * Goto Variable.
 
 * Widen columns in var sheet as necessary to accomodate non-english 
translations.

Index: src/ui/gui/data-sheet.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/data-sheet.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- src/ui/gui/data-sheet.c     19 Jun 2006 10:16:51 -0000      1.8
+++ src/ui/gui/data-sheet.c     23 Jul 2006 10:32:50 -0000      1.9
@@ -118,10 +118,45 @@
   return FALSE;
 }
 
-
 extern PsppireDataStore *data_store ;
 
 
+/* Return the width that an  'M' character would occupy when typeset in WIDGET 
*/
+static guint 
+calc_m_width(GtkWidget *widget, const PangoFontDescription *font_desc)
+{
+  PangoRectangle rect;
+  PangoLayout *layout ;
+  PangoContext * context;
+
+  context = gtk_widget_create_pango_context (widget);
+  g_assert (context);
+  layout = pango_layout_new (context);
+  g_assert (layout);
+
+  pango_layout_set_text (layout, "M", 1);
+  
+  pango_layout_set_font_description (layout, font_desc);
+
+  pango_layout_get_extents (layout, NULL, &rect);
+
+  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)
+{
+  GtkWidget *sheet  = data;
+  PsppireDataStore *ds = PSPPIRE_DATA_STORE(obj);
+
+  ds->width_of_m = calc_m_width(sheet, ds->font_desc);
+}
+
 GtkWidget*
 psppire_data_sheet_create (gchar *widget_name, gchar *string1, gchar *string2,
                           gint int1, gint int2)
@@ -131,19 +166,23 @@
   sheet = gtk_sheet_new(G_SHEET_ROW(data_store), 
                        G_SHEET_COLUMN(data_store), "data sheet", 0); 
 
+  data_store->width_of_m = calc_m_width(sheet, data_store->font_desc);
 
-  g_signal_connect (GTK_OBJECT (sheet), "activate",
-                   GTK_SIGNAL_FUNC (update_data_ref_entry),
+  g_signal_connect (G_OBJECT (sheet), "activate",
+                   G_CALLBACK (update_data_ref_entry),
                    0);
 
-  g_signal_connect (GTK_OBJECT (sheet), "traverse",
-                   GTK_SIGNAL_FUNC (traverse_callback), 0);
+  g_signal_connect (G_OBJECT (sheet), "traverse",
+                   G_CALLBACK (traverse_callback), 0);
 
 
-  g_signal_connect (GTK_OBJECT (sheet), "double-click-column",
-                   GTK_SIGNAL_FUNC (click2column),
+  g_signal_connect (G_OBJECT (sheet), "double-click-column",
+                   G_CALLBACK (click2column),
                    0);
 
+  g_signal_connect (G_OBJECT (data_store), "font-changed",
+                   G_CALLBACK (font_change_callback), sheet);
+
   gtk_sheet_set_active_cell(GTK_SHEET(sheet), -1, -1);
   gtk_widget_show(sheet);
 

Index: src/ui/gui/psppire-data-store.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/psppire-data-store.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- src/ui/gui/psppire-data-store.c     17 Jul 2006 10:45:43 -0000      1.15
+++ src/ui/gui/psppire-data-store.c     23 Jul 2006 10:32:50 -0000      1.16
@@ -33,6 +33,8 @@
 #include <gtksheet/gsheetmodel.h>
 #include <gtksheet/gsheet-column-iface.h>
 
+#include <pango/pango-context.h>
+
 #include "psppire-variable.h"
 #include "psppire-data-store.h"
 #include "helper.h"
@@ -70,6 +72,13 @@
 
 static GObjectClass *parent_class = NULL;
 
+
+enum  {FONT_CHANGED,
+       n_SIGNALS};
+
+static guint signal[n_SIGNALS];
+
+
 inline GType
 psppire_data_store_get_type (void)
 {
@@ -131,6 +140,7 @@
   return data_store_type;
 }
 
+
 static void
 psppire_data_store_class_init (PsppireDataStoreClass *class)
 {
@@ -140,6 +150,16 @@
   object_class = (GObjectClass*) class;
 
   object_class->finalize = psppire_data_store_finalize;
+
+  signal[FONT_CHANGED] =
+    g_signal_new ("font_changed",
+                 G_TYPE_FROM_CLASS(class),
+                 G_SIGNAL_RUN_FIRST,
+                 0,
+                 NULL, NULL,
+                 g_cclosure_marshal_VOID__VOID,
+                 G_TYPE_NONE, 
+                 0);
 }
 
 
@@ -166,6 +186,7 @@
 {
   data_store->dict = 0;
   data_store->case_file = 0;
+  data_store->width_of_m = 10;
 }
 
 const PangoFontDescription *
@@ -531,12 +552,19 @@
 
 
 void
-psppire_data_store_set_font(PsppireDataStore *store, PangoFontDescription *fd)
+psppire_data_store_set_font(PsppireDataStore *store, 
+                           const PangoFontDescription *fd)
 {
   g_return_if_fail (store);
   g_return_if_fail (PSPPIRE_IS_DATA_STORE (store));
 
   store->font_desc = fd;
+#if 0
+  store->width_of_m = calc_m_width(fd);
+#endif
+  g_signal_emit(store, signal[FONT_CHANGED], 0);  
+
+
   g_sheet_model_range_changed (G_SHEET_MODEL(store),
                                 -1, -1, -1, -1);
 }
@@ -598,84 +626,46 @@
 /* Column related funcs */
 
 static gint
-geometry_get_column_count(const GSheetColumn *geom, gpointer data)
+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 the width that an  'M' character would occupy when typeset at
-   row, col */
-static guint 
-M_width(const GtkSheet *sheet, gint row, gint col)
-{
-  GtkSheetCellAttr attributes;
-  PangoRectangle rect;
-  /* FIXME: make this a member of the data store */
-  static PangoLayout *layout = 0;
-
-  gtk_sheet_get_attributes(sheet, row, col, &attributes);
-
-  if (! layout ) 
-    layout = gtk_widget_create_pango_layout (GTK_WIDGET(sheet), "M");
-
-  g_assert(layout);
-  
-  pango_layout_set_font_description (layout, 
-                                    attributes.font_desc);
-
-  pango_layout_get_extents (layout, NULL, &rect);
-
-#if 0
-  g_object_unref(G_OBJECT(layout));
-#endif
-
-  return PANGO_PIXELS(rect.width);
-}
-
-
-/* Return the number of pixels corresponding to a column of 
-   WIDTH characters */
-static inline guint 
-columnWidthToPixels(GtkSheet *sheet, gint column, guint width)
-{
-  return (M_width(sheet, 0, column) * width);
-}
 
 
 static gint
-geometry_get_width(const GSheetColumn *geom, gint unit, GtkSheet *sheet)
+geometry_get_width(const GSheetColumn *geom, gint unit)
 {
   const struct PsppireVariable *pv ;
   PsppireDataStore *ds = PSPPIRE_DATA_STORE(geom);
 
   if ( unit >= psppire_dict_get_var_cnt(ds->dict) )
-    return 75;
+    return ds->width_of_m * 8 ;
 
-  /* FIXME: We can optimise this by caching the widths until they're resized */
   pv = psppire_dict_get_variable(ds->dict, unit);
 
-  return columnWidthToPixels(sheet, unit, psppire_variable_get_columns(pv));
-}
-
-
+  if ( pv == NULL ) 
+    return ds->width_of_m * 8 ;
 
+  return ds->width_of_m * psppire_variable_get_columns(pv);
+}
 
 static void
-geometry_set_width(GSheetColumn *geom, gint unit, gint width, GtkSheet *sheet)
+geometry_set_width(GSheetColumn *geom, gint unit, gint width)
 {
   PsppireDataStore *ds = PSPPIRE_DATA_STORE(geom);
 
   struct PsppireVariable *pv = psppire_dict_get_variable(ds->dict, unit);
 
-  psppire_variable_set_columns(pv, width / M_width(sheet, 1, unit));
+  psppire_variable_set_columns(pv, width / ds->width_of_m );
 }
 
 
 
 static GtkJustification
-geometry_get_justification(const GSheetColumn *geom, gint unit, gpointer data)
+geometry_get_justification(const GSheetColumn *geom, gint unit)
 {
   PsppireDataStore *ds = PSPPIRE_DATA_STORE(geom);
   const struct PsppireVariable *pv ;
@@ -695,8 +685,7 @@
 static const gchar null_var_name[]=N_("var");
  
 static gchar *
-geometry_get_column_button_label(const GSheetColumn *geom, gint unit, 
-                                gpointer data)
+geometry_get_column_button_label(const GSheetColumn *geom, gint unit)
 {
   gchar *text;
   struct PsppireVariable *pv ;
@@ -714,7 +703,7 @@
 
 
 static gboolean
-geometry_get_sensitivity(const GSheetColumn *geom, gint unit, gpointer data)
+geometry_get_sensitivity(const GSheetColumn *geom, gint unit)
 {
   PsppireDataStore *ds = PSPPIRE_DATA_STORE(geom);
 
@@ -798,7 +787,3 @@
 
   iface->get_button_label = geometry_get_row_button_label;
 }
-
-
-
-

Index: src/ui/gui/psppire-data-store.h
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/psppire-data-store.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- src/ui/gui/psppire-data-store.h     19 Jun 2006 10:16:51 -0000      1.3
+++ src/ui/gui/psppire-data-store.h     23 Jul 2006 10:32:50 -0000      1.4
@@ -59,7 +59,11 @@
   /*< private >*/
   PsppireDict *dict;
   PsppireCaseFile *case_file;
-  PangoFontDescription *font_desc;
+  const PangoFontDescription *font_desc;
+
+  /* The width of an upper case 'M' rendered in the current font */
+  gint width_of_m ; 
+  
   gboolean show_labels;
 
   /* Geometry */
@@ -81,17 +85,17 @@
 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, 
PsppireDict *dict);
-void psppire_data_store_set_font(PsppireDataStore *store, PangoFontDescription 
*fd);
+void psppire_data_store_set_dictionary(PsppireDataStore *data_store, 
+                                      PsppireDict *dict);
 
-void psppire_data_store_show_labels(PsppireDataStore *store, gboolean 
show_labels);
+void psppire_data_store_set_font(PsppireDataStore *store, 
+                                const PangoFontDescription *fd);
 
+void psppire_data_store_show_labels(PsppireDataStore *store, 
+                                   gboolean show_labels);
   
 void psppire_data_store_clear(PsppireDataStore *data_store);
 
-
-
-
 struct file_handle;
 
 void psppire_data_store_create_system_file(PsppireDataStore *store,




reply via email to

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