gnumeric r16529 - in trunk: . plugins/html src



Author: mortenw
Date: Mon Apr 28 23:05:39 2008
New Revision: 16529
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16529&view=rev

Log:
2008-04-28  Morten Welinder  <terra gnome org>

	* src/colrow.h (colrow_max): Take a sheet argument too.  All
	callers changed.



Modified:
   trunk/ChangeLog
   trunk/plugins/html/latex.c
   trunk/src/colrow.c
   trunk/src/colrow.h
   trunk/src/commands.c
   trunk/src/parse-util.c
   trunk/src/print-info.c
   trunk/src/sheet-control-gui.c
   trunk/src/sheet.c
   trunk/src/sheet.h

Modified: trunk/plugins/html/latex.c
==============================================================================
--- trunk/plugins/html/latex.c	(original)
+++ trunk/plugins/html/latex.c	Mon Apr 28 23:05:39 2008
@@ -676,7 +676,7 @@
 		return ((gnm_style_border_is_blank (border)) ? GNM_STYLE_BORDER_NONE :
 			border->line_type);
 	} else {
-		if ((col+1) >= colrow_max (TRUE))
+		if ((col+1) >= colrow_max (TRUE, sheet))
 		    return GNM_STYLE_BORDER_NONE;
 		style = sheet_style_get (sheet, col + 1, row);
 		border = gnm_style_get_border (style, MSTYLE_BORDER_LEFT);

Modified: trunk/src/colrow.c
==============================================================================
--- trunk/src/colrow.c	(original)
+++ trunk/src/colrow.c	Mon Apr 28 23:05:39 2008
@@ -430,7 +430,7 @@
 		 * defined calculation speed grinds to a halt.
 		 */
 		if (new_size > 0 && index->first == 0 &&
-		    (index->last+1) >= colrow_max (is_cols)) {
+		    (index->last+1) >= colrow_max (is_cols, sheet)) {
 			struct resize_closure closure;
 			ColRowRLEState *rles = g_new0 (ColRowRLEState, 1);
 
@@ -940,7 +940,7 @@
 {
 	ColRowInfo * (*get) (Sheet const *sheet, int pos) = is_cols
 		? &sheet_col_get : &sheet_row_get;
-	int const max = colrow_max (is_cols);
+	int const max = colrow_max (is_cols, sheet);
 	int const step = inc ? 1 : -1;
 
 	while (1) {
@@ -972,7 +972,7 @@
 colrow_find_adjacent_visible (Sheet *sheet, gboolean is_cols,
 			      int index, gboolean forward)
 {
-	int const max = colrow_max (is_cols);
+	int const max = colrow_max (is_cols, sheet);
 	int i         = index; /* To avoid trouble at edges */
 
 	do {
@@ -1083,7 +1083,7 @@
 		}
 	}
 
-	if (changed && 0 <= i && i < colrow_max (is_cols)) {
+	if (changed && 0 <= i && i < colrow_max (is_cols, sheet)) {
 		ColRowInfo * const cri = sheet_colrow_fetch (sheet, i, is_cols);
 		if (prev_outline > cri->outline_level)
 			cri->is_collapsed = !visible;
@@ -1175,7 +1175,7 @@
 	ColRowInfo const *default_cri = &infos->default_style;
 	ColRowSegment *segment;
 	ColRowInfo *cri;
-	int const end = colrow_max (is_cols);
+	int const end = colrow_max (is_cols, sheet);
 	int inner, inner_start, inner_last, i;
 
 	i = COLROW_SEGMENT_START(maxima);

Modified: trunk/src/colrow.h
==============================================================================
--- trunk/src/colrow.h	(original)
+++ trunk/src/colrow.h	Mon Apr 28 23:05:39 2008
@@ -131,7 +131,7 @@
 						 ColRowVisList *list);
 
 /* Misc */
-#define		 colrow_max(is_cols)		((is_cols) ? SHEET_MAX_COLS : SHEET_MAX_ROWS)
+#define		 colrow_max(is_cols,sheet)	((is_cols) ? gnm_sheet_get_max_cols (sheet) : gnm_sheet_get_max_rows (sheet))
 void             colrow_reset_defaults		(Sheet *sheet, gboolean is_cols, int maxima);
 int              colrow_find_adjacent_visible   (Sheet *sheet, gboolean is_cols,
 						 int index, gboolean forward);

Modified: trunk/src/commands.c
==============================================================================
--- trunk/src/commands.c	(original)
+++ trunk/src/commands.c	Mon Apr 28 23:05:39 2008
@@ -1409,7 +1409,7 @@
 
 	/* Range that will get deleted. */
 	first = me->is_insert
-		? colrow_max (is_cols) - count
+		? colrow_max (is_cols, sheet) - count
 		: index;
 	last = first + count - 1;
 	(is_cols ? range_init_cols : range_init_rows) (&r, first, last);
@@ -2299,7 +2299,7 @@
 						last, d+1, FALSE);
 				}
 			}
-		} else if (index+1 < colrow_max (is_cols)) {
+		} else if (index+1 < colrow_max (is_cols, sheet)) {
 			ColRowInfo const *next =
 				sheet_colrow_get (sheet, index+1, is_cols);
 

Modified: trunk/src/parse-util.c
==============================================================================
--- trunk/src/parse-util.c	(original)
+++ trunk/src/parse-util.c	Mon Apr 28 23:05:39 2008
@@ -549,7 +549,8 @@
 			return NULL;
 		return end + 1;
 	} else {
-		if (*num <= 0 || *num > colrow_max (is_col))
+#warning "We cannot have NULL here."
+		if (*num <= 0 || *num > colrow_max (is_col, NULL))
 			return NULL;
 		(*num)--;
 	}

Modified: trunk/src/print-info.c
==============================================================================
--- trunk/src/print-info.c	(original)
+++ trunk/src/print-info.c	Mon Apr 28 23:05:39 2008
@@ -1192,7 +1192,8 @@
 {
 	GnmPageBreaks *res = g_new (GnmPageBreaks, 1);
 
-	if (len < 0 || len > colrow_max (is_vert))
+#warning "We cannot use NULL here."
+	if (len < 0 || len > colrow_max (is_vert, NULL))
 		len = 0;
 	res->is_vert = is_vert;
 	res->details = g_array_sized_new (FALSE, FALSE,

Modified: trunk/src/sheet-control-gui.c
==============================================================================
--- trunk/src/sheet-control-gui.c	(original)
+++ trunk/src/sheet-control-gui.c	Mon Apr 28 23:05:39 2008
@@ -2144,7 +2144,7 @@
 	gboolean snap = FALSE;
 	int length = 0;
 	ColRowInfo const *cr_info;
-	int sheet_max = colrow_max (is_col);
+	int sheet_max = colrow_max (is_col, sheet);
 	int const sign = (is_col && sheet->text_is_rtl) ? -1 : 1;
 	int pos = sign * (w_pos * FOO_CANVAS (pane)->pixels_per_unit + .5);
 

Modified: trunk/src/sheet.c
==============================================================================
--- trunk/src/sheet.c	(original)
+++ trunk/src/sheet.c	Mon Apr 28 23:05:39 2008
@@ -1296,7 +1296,7 @@
 {
 	int outline_level = 0;
 	colrow_foreach (is_cols ? &sheet->cols : &sheet->rows,
-		0, colrow_max (is_cols) - 1,
+			0, colrow_max (is_cols, sheet) - 1,
 		(ColRowHandler)cb_outline_level, &outline_level);
 	return outline_level;
 }
@@ -3839,14 +3839,14 @@
 	ColRowInfo *cri;
 	ColRowInfo const *vs = NULL;
 
-	if (pos < 0 || pos >= colrow_max (is_cols))
+	if (pos < 0 || pos >= colrow_max (is_cols, sheet))
 		return;
 
 	/* grab the next or previous col/row */
 	if ((is_cols ? sheet->outline_symbols_right : sheet->outline_symbols_below)) {
 		if (pos > 0)
 			vs = sheet_colrow_get (sheet, pos-1, is_cols);
-	} else if ((pos+1) < colrow_max (is_cols))
+	} else if ((pos+1) < colrow_max (is_cols, sheet))
 		vs = sheet_colrow_get (sheet, pos+1, is_cols);
 
 	/* handle the case where an empty col/row should be marked collapsed */
@@ -3870,7 +3870,7 @@
 	sheet_colrow_insdel_finish (rinfo, is_cols, pos, pundo);
 	sheet_colrow_set_collapse (sheet, is_cols, pos);
 	sheet_colrow_set_collapse (sheet, is_cols, pos + count);
-	sheet_colrow_set_collapse (sheet, is_cols, colrow_max (is_cols));
+	sheet_colrow_set_collapse (sheet, is_cols, colrow_max (is_cols, sheet));
 	gnm_sheet_filter_insdel_colrow (sheet, is_cols, TRUE, pos, count);
 
 	/* WARNING WARNING WARNING
@@ -3889,7 +3889,7 @@
 			    int pos, int count, GOUndo **pundo)
 {
 	Sheet *sheet = rinfo->origin_sheet;
-	int end = colrow_max (is_cols) - count;
+	int end = colrow_max (is_cols, sheet) - count;
 
 	sheet_style_relocate (rinfo);
 	sheet_colrow_insdel_finish (rinfo, is_cols, pos, pundo);
@@ -5058,7 +5058,7 @@
 	g_return_if_fail (IS_SHEET (sheet));
 
 	/* not particularly efficient, but this is not a hot spot */
-	for (i = colrow_max (is_cols); i-- > 0 ; )
+	for (i = colrow_max (is_cols, sheet); i-- > 0 ; )
 		sheet_colrow_set_collapse (sheet, is_cols, i);
 }
 

Modified: trunk/src/sheet.h
==============================================================================
--- trunk/src/sheet.h	(original)
+++ trunk/src/sheet.h	Mon Apr 28 23:05:39 2008
@@ -116,6 +116,11 @@
 Sheet    *sheet_dup		 (Sheet const *source_sheet);
 void      sheet_destroy_contents (Sheet *sheet);
 
+#define gnm_sheet_get_max_cols(sheet) SHEET_MAX_COLS
+#define gnm_sheet_get_max_rows(sheet) SHEET_MAX_ROWS
+#define gnm_sheet_get_last_col(sheet) (gnm_sheet_get_max_cols(sheet) - 1)
+#define gnm_sheet_get_last_row(sheet) (gnm_sheet_get_max_rows(sheet) - 1)
+
 /* GnmCell management */
 GnmCell  *sheet_cell_get	 (Sheet const *sheet, int col, int row);
 GnmCell  *sheet_cell_fetch	 (Sheet *sheet, int col, int row);



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