Fix bug resizing rows/columns
authorJohn Darrington <john@darrington.wattle.id.au>
Tue, 9 Dec 2008 01:20:48 +0000 (10:20 +0900)
committerJohn Darrington <john@darrington.wattle.id.au>
Tue, 9 Dec 2008 01:20:48 +0000 (10:20 +0900)
lib/gtksheet/gtksheet.c
lib/gtksheet/psppire-axis.c

index d0873404fbeb28b3fe7eb493f85e2f912b8baf53..92dda55c0f1892b7de2dc7136b9c4438f11da922 100644 (file)
@@ -95,7 +95,7 @@ static void draw_row_title_buttons_range (GtkSheet *sheet, gint first, gint n);
 
 static void set_row_height (GtkSheet *sheet,
                            gint row,
-                           guint height);
+                           gint height);
 
 static void destroy_hover_window (GtkSheetHoverTitle *);
 static GtkSheetHoverTitle *create_hover_window (void);
@@ -1319,7 +1319,7 @@ gtk_sheet_get_columns_count (GtkSheet *sheet)
 
 static void set_column_width (GtkSheet *sheet,
                              gint column,
-                             guint width);
+                             gint width);
 
 
 void
@@ -3443,9 +3443,9 @@ gtk_sheet_button_release (GtkWidget *widget,
       gdk_display_pointer_ungrab (display, event->time);
       draw_xor_vline (sheet);
 
-      width = event->x - 
-       psppire_axis_start_pixel (sheet->haxis, sheet->drag_cell.col) -
-       sheet->hadjustment->value;
+      width = event->x -
+       psppire_axis_start_pixel (sheet->haxis, sheet->drag_cell.col)
+       sheet->hadjustment->value;
 
       set_column_width (sheet, sheet->drag_cell.col, width);
 
@@ -3462,7 +3462,7 @@ gtk_sheet_button_release (GtkWidget *widget,
       draw_xor_hline (sheet);
 
       height = event->y -
-       psppire_axis_start_pixel (sheet->vaxis, sheet->drag_cell.row) -
+       psppire_axis_start_pixel (sheet->vaxis, sheet->drag_cell.row) +
        sheet->vadjustment->value;
 
       set_row_height (sheet, sheet->drag_cell.row, height);
@@ -5063,7 +5063,7 @@ draw_xor_rectangle (GtkSheet *sheet, GtkSheetRange range)
 static void
 set_column_width (GtkSheet *sheet,
                  gint column,
-                 guint width)
+                 gint width)
 {
   g_return_if_fail (sheet != NULL);
   g_return_if_fail (GTK_IS_SHEET (sheet));
@@ -5085,7 +5085,7 @@ set_column_width (GtkSheet *sheet,
 static void
 set_row_height (GtkSheet *sheet,
                gint row,
-               guint height)
+               gint height)
 {
   g_return_if_fail (sheet != NULL);
   g_return_if_fail (GTK_IS_SHEET (sheet));
index b30005a20b93a14687330da0a21385bcde287b9e..d5750fffd6cfd20a5c67626d17ef64b118251094 100644 (file)
@@ -289,6 +289,8 @@ psppire_axis_resize (PsppireAxis *a, gint unit, glong size)
 
   g_return_if_fail (PSPPIRE_AXIS_GET_IFACE (a));
 
+  g_return_if_fail (size > 0);
+
   if (PSPPIRE_AXIS_GET_IFACE (a)->resize)
     PSPPIRE_AXIS_GET_IFACE (a)->resize (a, unit, size);