[gnumeric] Conditional formats: track dependents and redraw when they change.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Conditional formats: track dependents and redraw when they change.
- Date: Fri, 8 Feb 2013 15:18:14 +0000 (UTC)
commit 57fe98ca480c9466d3e472cab900e60ad2367e42
Author: Morten Welinder <terra gnome org>
Date: Fri Feb 8 10:16:55 2013 -0500
Conditional formats: track dependents and redraw when they change.
This commit basically turns things on. The meat was in the previous
long commit sequence. GNM_DEBUG=style-deps shows the action.
ChangeLog | 7 +++++++
NEWS | 2 ++
src/sheet-style.c | 27 +++++++++++++++++++++------
3 files changed, 30 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 00d689e..8de3248 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-02-08 Morten Welinder <terra gnome org>
+
+ * src/sheet-style.c (rstyle_apply): Take extra range argument and
+ link/unlink style dependents. All callers changed.
+ (sheet_style_shutdown): Set default style for whole sheet to
+ ensure style dependents get cleared.
+
2013-02-07 Morten Welinder <terra gnome org>
* src/sheet-style.c (cell_tile_optimize): Implement
diff --git a/NEWS b/NEWS
index a809d10..d20bed3 100644
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,8 @@ Morten:
* Add LEVERAGE function for regression tool. [#691913]
* Clean up matrix code.
* Speed up regressions. [#691984]
+ * Clean up sheet style code somewhat.
+ * Track dependents of conditional formats. [#654495] [#674954]
--------------------------------------------------------------------------
Gnumeric 1.12.0
diff --git a/src/sheet-style.c b/src/sheet-style.c
index 5687532..1911774 100644
--- a/src/sheet-style.c
+++ b/src/sheet-style.c
@@ -292,7 +292,7 @@ rstyle_dtor (ReplacementStyle *rs)
* and will maintain the cache of styles associated with each sheet
*/
static void
-rstyle_apply (GnmStyle **old, ReplacementStyle *rs)
+rstyle_apply (GnmStyle **old, ReplacementStyle *rs, GnmRange const *r)
{
GnmStyle *s;
g_return_if_fail (old != NULL);
@@ -314,9 +314,11 @@ rstyle_apply (GnmStyle **old, ReplacementStyle *rs)
if (*old != s) {
if (*old) {
+ gnm_style_unlink_dependents (*old, r);
gnm_style_unlink (*old);
}
+ gnm_style_link_dependents (s, r);
gnm_style_link (s);
*old = s;
@@ -583,7 +585,6 @@ cell_tile_matrix_set (CellTile *t)
}
case TILE_MATRIX:
- case TILE_PTR_MATRIX:
default:
g_assert_not_reached();
}
@@ -914,21 +915,31 @@ tile_is_uniform (CellTile const *tile)
static void
vector_apply_pstyle (CellTile *tile, ReplacementStyle *rs,
- GnmRange const *indic)
+ int cc, int cr, int level, GnmRange const *indic)
{
const CellTileType type = tile->type;
const int ncols = tile_col_count[type];
const int nrows = tile_row_count[type];
+ const int w1 = tile_widths[level + 1] / ncols;
+ const int h1 = tile_heights[level + 1] / nrows;
const int fcol = indic->start.col;
const int frow = indic->start.row;
const int lcol = MIN (ncols - 1, indic->end.col);
const int lrow = MIN (nrows - 1, indic->end.row);
+ GnmSheetSize const *ss = gnm_sheet_get_size (rs->sheet);
int r, c;
+ GnmRange rng;
for (r = frow; r <= lrow; r++) {
GnmStyle **st = tile->style_any.style + ncols * r;
+ rng.start.row = cr + h1 * r;
+ rng.end.row = MIN (rng.start.row + (h1 - 1),
+ ss->max_rows - 1);
for (c = fcol; c <= lcol; c++) {
- rstyle_apply (st + c, rs);
+ rng.start.col = cc + w1 * c;
+ rng.end.col = MIN (rng.start.col + (w1 - 1),
+ ss->max_cols - 1);
+ rstyle_apply (st + c, rs, &rng);
}
}
}
@@ -1115,7 +1126,7 @@ split_to_matrix:
*tile = cell_tile_matrix_set (*tile);
apply:
- vector_apply_pstyle (*tile, rs, &indic);
+ vector_apply_pstyle (*tile, rs, corner_col, corner_row, level, &indic);
try_optimize:
{
@@ -1279,12 +1290,15 @@ cell_tile_apply_pos (CellTile **tile, int level,
{
CellTile *tmp;
CellTileType type;
+ GnmRange rng;
g_return_if_fail (col >= 0);
g_return_if_fail (col < gnm_sheet_get_max_cols (rs->sheet));
g_return_if_fail (row >= 0);
g_return_if_fail (row < gnm_sheet_get_max_rows (rs->sheet));
+ range_init (&rng, col, row, col, row);
+
tail_recursion:
g_return_if_fail (TILE_TOP_LEVEL >= level && level >= 0);
g_return_if_fail (tile != NULL);
@@ -1320,7 +1334,8 @@ tail_recursion:
g_return_if_fail (tmp->type == TILE_MATRIX);
rstyle_apply (tmp->style_matrix.style + row * TILE_SIZE_COL + col,
- rs);
+ rs,
+ &rng);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]