[gnumeric] Sheet: separate CELL_ITER_IGNORE_FILTERED from CELL_ITER_IGNORE_SUBTOTAL.



commit 99380a079a3271d8138b06f3535312f862ce70d0
Author: Morten Welinder <terra gnome org>
Date:   Fri Jan 4 12:36:52 2013 -0500

    Sheet: separate CELL_ITER_IGNORE_FILTERED from CELL_ITER_IGNORE_SUBTOTAL.
    
    CELL_ITER_IGNORE_SUBTOTAL uses to mean both, but functions like
    sheet_foreach_cell_in_range only did the filter part.
    
    With this change, "subtotal" is really only used for subtotal".  Which
    is good.

 src/collect.c         |    3 ++-
 src/gnumeric.h        |    6 ++++--
 src/graph.c           |    6 +++---
 src/sheet.c           |   16 +++++++++++-----
 src/wbc-gtk-actions.c |    2 ++
 src/workbook.c        |    2 ++
 6 files changed, 24 insertions(+), 11 deletions(-)
---
diff --git a/src/collect.c b/src/collect.c
index 9c8bd91..03f1b9e 100644
--- a/src/collect.c
+++ b/src/collect.c
@@ -480,7 +480,8 @@ collect_floats (int argc, GnmExprConstPtr const *argv,
 	/* ---------------------------------------- */
 
 	if (flags & COLLECT_IGNORE_SUBTOTAL)
-		iter_flags |= CELL_ITER_IGNORE_SUBTOTAL;
+		iter_flags |= (CELL_ITER_IGNORE_SUBTOTAL |
+			       CELL_ITER_IGNORE_FILTERED);
 
 	strict = (flags & (COLLECT_IGNORE_ERRORS | COLLECT_ZERO_ERRORS)) == 0;
 
diff --git a/src/gnumeric.h b/src/gnumeric.h
index df6b0e5..96f4449 100644
--- a/src/gnumeric.h
+++ b/src/gnumeric.h
@@ -155,8 +155,10 @@ typedef enum {
 	CELL_ITER_IGNORE_BLANK		= (CELL_ITER_IGNORE_NONEXISTENT | CELL_ITER_IGNORE_EMPTY),
 	CELL_ITER_IGNORE_HIDDEN		= 1 << 2, /* hidden manually */
 
-	/* contains SUBTOTAL, or hidden row in a filter */
-	CELL_ITER_IGNORE_SUBTOTAL	= 1 << 3
+	/* contains SUBTOTAL */
+	CELL_ITER_IGNORE_SUBTOTAL	= 1 << 3,
+	/* hidden row in a filter */
+	CELL_ITER_IGNORE_FILTERED	= 1 << 4
 } CellIterFlags;
 typedef struct _GnmCellIter GnmCellIter;
 typedef GnmValue *(*CellIterFunc) (GnmCellIter const *iter, gpointer user);
diff --git a/src/graph.c b/src/graph.c
index dfb93d8..1df5e20 100644
--- a/src/graph.c
+++ b/src/graph.c
@@ -699,7 +699,7 @@ gnm_go_data_vector_load_values (GODataVector *dat)
 			closure.vals = dat->values;
 			closure.last = -1;
 			closure.i = 0;
-			sheet_foreach_cell_in_range (start_sheet, CELL_ITER_IGNORE_SUBTOTAL,
+			sheet_foreach_cell_in_range (start_sheet, CELL_ITER_IGNORE_FILTERED,
 				r.start.col, r.start.row, r.end.col, r.end.row,
 				(CellIterFunc)cb_assign_val, &closure);
 			dat->len = closure.last + 1; /* clip */
@@ -737,7 +737,7 @@ gnm_go_data_vector_load_values (GODataVector *dat)
 					closure.vals = dat->values;
 					closure.last = last - 1;
 					closure.i = last;
-					sheet_foreach_cell_in_range (start_sheet, CELL_ITER_IGNORE_SUBTOTAL,
+					sheet_foreach_cell_in_range (start_sheet, CELL_ITER_IGNORE_FILTERED,
 						r.start.col, r.start.row, r.end.col, r.end.row,
 						(CellIterFunc)cb_assign_val, &closure);
 					last = dat->len = closure.last + 1; /* clip */
@@ -886,7 +886,7 @@ gnm_go_data_vector_get_str (GODataVector *dat, unsigned i)
 					r.end.col = start_sheet->cols.max_used;
 
 				if (r.start.col <= r.end.col && r.start.row <= r.end.row)
-					sheet_foreach_cell_in_range (start_sheet, CELL_ITER_IGNORE_SUBTOTAL,
+					sheet_foreach_cell_in_range (start_sheet, CELL_ITER_IGNORE_FILTERED,
 						r.start.col, r.start.row, r.end.col, r.end.row,
 						(CellIterFunc)cb_assign_string, vec->strs);
 			}
diff --git a/src/sheet.c b/src/sheet.c
index a30d213..2130028 100644
--- a/src/sheet.c
+++ b/src/sheet.c
@@ -2376,7 +2376,9 @@ sheet_col_size_fit_pixels (Sheet *sheet, int col, int srow, int erow,
 	data.max = -1;
 	data.ignore_strings = ignore_strings;
 	sheet_foreach_cell_in_range (sheet,
-		CELL_ITER_IGNORE_NONEXISTENT | CELL_ITER_IGNORE_HIDDEN,
+		CELL_ITER_IGNORE_NONEXISTENT |
+		CELL_ITER_IGNORE_HIDDEN |
+		CELL_ITER_IGNORE_FILTERED,
 		col, srow, col, erow,
 		(CellIterFunc)&cb_max_cell_width, &data);
 
@@ -2460,7 +2462,9 @@ sheet_row_size_fit_pixels (Sheet *sheet, int row, int scol, int ecol,
 	data.max = -1;
 	data.ignore_strings = FALSE;
 	sheet_foreach_cell_in_range (sheet,
-		CELL_ITER_IGNORE_NONEXISTENT | CELL_ITER_IGNORE_HIDDEN,
+		CELL_ITER_IGNORE_NONEXISTENT |
+		CELL_ITER_IGNORE_HIDDEN |
+		CELL_ITER_IGNORE_FILTERED,
 		scol, row,
 		ecol, row,
 		(CellIterFunc)&cb_max_cell_height, &data);
@@ -3781,6 +3785,8 @@ sheet_cells (Sheet *sheet, const GnmRange *r)
  * callback routine.  If the only_existing flag is passed, then
  * callbacks are only invoked for existing cells.
  *
+ * Note: this function does not honour the CELL_ITER_IGNORE_SUBTOTAL flag.
+ *
  * Returns: (transfer none): the value returned by the callback, which can be :
  *    non-NULL on error, or VALUE_TERMINATE if some invoked routine requested
  *    to stop (by returning non-NULL).
@@ -3804,7 +3810,7 @@ sheet_foreach_cell_in_range (Sheet *sheet, CellIterFlags flags,
 	GnmValue *cont;
 	GnmCellIter iter;
 	gboolean const visiblity_matters = (flags & CELL_ITER_IGNORE_HIDDEN) != 0;
-	gboolean const subtotal_magic = (flags & CELL_ITER_IGNORE_SUBTOTAL) != 0;
+	gboolean const ignore_filtered = (flags & CELL_ITER_IGNORE_FILTERED) != 0;
 	gboolean const only_existing = (flags & CELL_ITER_IGNORE_NONEXISTENT) != 0;
 	gboolean const ignore_empty = (flags & CELL_ITER_IGNORE_EMPTY) != 0;
 	gboolean ignore;
@@ -3862,7 +3868,7 @@ sheet_foreach_cell_in_range (Sheet *sheet, CellIterFlags flags,
 			}
 			if (visiblity_matters && !iter.ri->visible)
 				continue;
-			if (subtotal_magic && iter.ri->in_filter && !iter.ri->visible)
+			if (ignore_filtered && iter.ri->in_filter && !iter.ri->visible)
 				continue;
 
 			if (iter.pp.eval.col != last_col) {
@@ -3916,7 +3922,7 @@ sheet_foreach_cell_in_range (Sheet *sheet, CellIterFlags flags,
 
 		if (visiblity_matters && !iter.ri->visible)
 			continue;
-		if (subtotal_magic && iter.ri->in_filter && !iter.ri->visible)
+		if (ignore_filtered && iter.ri->in_filter && !iter.ri->visible)
 			continue;
 
 		for (iter.pp.eval.col = start_col; iter.pp.eval.col <= end_col; ++iter.pp.eval.col) {
diff --git a/src/wbc-gtk-actions.c b/src/wbc-gtk-actions.c
index f2de33c..63b78df 100644
--- a/src/wbc-gtk-actions.c
+++ b/src/wbc-gtk-actions.c
@@ -1901,6 +1901,8 @@ static GNM_ACTION_DEF (cb_copydown)
 static GNM_ACTION_DEF (cb_copyright)
 {
 	WorkbookControl *wbc = WORKBOOK_CONTROL (wbcg);
+	/* xgettext: copy from the cell to the left into current cell --
+	   this has nothing whatsoever to do with copyright.  */
 	cmd_copyrel (wbc, -1, 0, _("Copy right"));
 }
 
diff --git a/src/workbook.c b/src/workbook.c
index 55cfa01..840fdcc 100644
--- a/src/workbook.c
+++ b/src/workbook.c
@@ -521,6 +521,8 @@ workbook_set_last_export_uri (Workbook *wb, gchar *uri)
  * callback routine.  If the only_existing flag is TRUE, then
  * callbacks are only invoked for existing cells.
  *
+ * Note: this function does not honour the CELL_ITER_IGNORE_SUBTOTAL flag.
+ *
  * Return value:
  *    non-NULL on error, or VALUE_TERMINATE if some invoked routine requested
  *    to stop (by returning non-NULL).



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