[gnumeric] Sheet: introduce GnmSheetSize.



commit cb6fb4b64c3406079a88977af978c447a716fbab
Author: Morten Welinder <terra gnome org>
Date:   Mon Apr 27 11:35:35 2009 -0400

    Sheet: introduce GnmSheetSize.
---
 ChangeLog      |    5 +++++
 src/gnumeric.h |    1 +
 src/sheet.c    |   26 +++++++++++++-------------
 src/sheet.h    |    8 ++++++--
 4 files changed, 25 insertions(+), 15 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3558dd7..72a3a18 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2009-04-27  Morten Welinder  <terra gnome org>
 
+	* src/sheet.h (struct _Sheet): Move max_cols and max_rows into
+	new member size of type GnmSheetSize.
+
+2009-04-27  Morten Welinder  <terra gnome org>
+
 	* src/item-grid.c (cb_cursor_come_to_rest): Fix tooltip
 	positioning.
 	* src/item-cursor.c (item_cursor_tip_setlabel): Ditto.
diff --git a/src/gnumeric.h b/src/gnumeric.h
index bc692de..ca22fe6 100644
--- a/src/gnumeric.h
+++ b/src/gnumeric.h
@@ -132,6 +132,7 @@ typedef struct _GnmCellRef	        GnmCellRef;	/* abs/rel point with sheet */
 typedef struct _GnmRangeRef	        GnmRangeRef;	/* abs/rel range with sheet */
 typedef struct _GnmEvalPos		GnmEvalPos;
 typedef struct _GnmParsePos	        GnmParsePos;
+typedef struct _GnmSheetSize		GnmSheetSize;
 typedef struct _GnmParseError	        GnmParseError;
 typedef struct _GnmConventions		GnmConventions;
 typedef struct _GnmConventionsOut	GnmConventionsOut;
diff --git a/src/sheet.c b/src/sheet.c
index 78e779b..daa9acf 100644
--- a/src/sheet.c
+++ b/src/sheet.c
@@ -491,11 +491,11 @@ gnm_sheet_set_property (GObject *object, guint property_id,
 		break;
 	case PROP_COLUMNS:
 		/* Construction-time only */
-		sheet->max_cols = g_value_get_int (value);
+		sheet->size.max_cols = g_value_get_int (value);
 		break;
 	case PROP_ROWS:
 		/* Construction-time only */
-		sheet->max_rows = g_value_get_int (value);
+		sheet->size.max_rows = g_value_get_int (value);
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -616,10 +616,10 @@ gnm_sheet_get_property (GObject *object, guint property_id,
 		g_value_set_double (value, sheet->last_zoom_factor_used);
 		break;
 	case PROP_COLUMNS:
-		g_value_set_int (value, sheet->max_cols);
+		g_value_set_int (value, sheet->size.max_cols);
 		break;
 	case PROP_ROWS:
-		g_value_set_int (value, sheet->max_rows);
+		g_value_set_int (value, sheet->size.max_rows);
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -652,11 +652,11 @@ gnm_sheet_constructor (GType type,
 	/* Now sheet_type, max_cols, and max_rows have been set.  */
 	sheet->being_constructed = FALSE;
 
-	colrow_resize (&sheet->cols, sheet->max_cols);
-	colrow_resize (&sheet->rows, sheet->max_rows);
+	colrow_resize (&sheet->cols, sheet->size.max_cols);
+	colrow_resize (&sheet->rows, sheet->size.max_rows);
 
-	sheet->priv->reposition_objects.col = sheet->max_cols;
-	sheet->priv->reposition_objects.row = sheet->max_rows;
+	sheet->priv->reposition_objects.col = sheet->size.max_cols;
+	sheet->priv->reposition_objects.row = sheet->size.max_rows;
 
 	range_init_full_sheet (&sheet->priv->unhidden_region, sheet);
 	sheet_style_init (sheet);
@@ -1216,8 +1216,8 @@ gnm_sheet_resize_main (Sheet *sheet, int cols, int rows,
 	/* ---------------------------------------- */
 	/* Actually change the properties.  */
 
-	sheet->max_cols = cols;
-	sheet->max_rows = rows;
+	sheet->size.max_cols = cols;
+	sheet->size.max_rows = rows;
 	if (old_cols != cols)
 		g_object_notify (G_OBJECT (sheet), "columns");
 	if (old_rows != rows)
@@ -5439,7 +5439,7 @@ sheet_dup (Sheet const *src)
 	name = workbook_sheet_get_free_name (wb, src->name_unquoted,
 					     TRUE, TRUE);
 	dst = sheet_new_with_type (wb, name, src->sheet_type,
-				   src->max_cols, src->max_rows);
+				   src->size.max_cols, src->size.max_rows);
 	g_free (name);
 
 	dst->protected_allow = src->protected_allow;
@@ -5716,7 +5716,7 @@ gnm_sheet_get_max_rows (Sheet const *sheet)
 	if (G_UNLIKELY (sheet->being_constructed))
 		g_warning ("Access to sheet size during construction!");
 
-	return sheet->max_rows;
+	return sheet->size.max_rows;
 }
 
 int
@@ -5731,5 +5731,5 @@ gnm_sheet_get_max_cols (Sheet const *sheet)
 	if (G_UNLIKELY (sheet->being_constructed))
 		g_warning ("Access to sheet size during construction!");
 
-	return sheet->max_cols;
+	return sheet->size.max_cols;
 }
diff --git a/src/sheet.h b/src/sheet.h
index 00bff47..889eadc 100644
--- a/src/sheet.h
+++ b/src/sheet.h
@@ -10,6 +10,10 @@
 
 G_BEGIN_DECLS
 
+struct _GnmSheetSize {
+	int max_rows, max_cols;
+};
+
 typedef struct _SheetPrivate SheetPrivate;
 typedef enum {
 	GNM_SHEET_DATA,
@@ -106,8 +110,8 @@ struct _Sheet {
 	/* This needs to move elsewhere and get shared.  */
 	PangoContext *context;
 
-	/* Size related data */
-	int max_rows, max_cols;
+	GnmSheetSize size;
+
 	/* tile related data */
 	int tile_top_level, max_width, max_height;
 	gboolean partial_row, partial_col;



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