Commit b740bf75 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg
Browse files

If successful queue everything for recalc. (xml_cell_set_array_expr) : no


2001-05-26  Jody Goldberg <jgoldberg@home.com>

	* xml-sax-read.c (xml_sax_file_open) : If successful queue everything
	  for recalc.
	(xml_cell_set_array_expr) : no need to queue a recalc for arrays.

2001-05-26  Jody Goldberg <jgoldberg@home.com>

	* src/sheet.c (colrow_move) : no need to queue recalc here.
	(cb_sheet_cell_copy) : Actually copy the array values.

	* src/cell.c (cell_relocate) : Just relink, no need to queue a recalc.
	(cell_set_array_formula) : Remove the ability to queue the recalc at
	  this level.  Just link the formulas in.  Reorder the the arguments
	  to match the standard approach.

	* src/eval.c (workbook_recalc_all) : Used here.
	(workbook_queue_all_recalc) : new function.

	* src/xml-io.c (xml_workbook_read) : Queue everything for recalc.
	(xml_cell_set_array_expr) : no need to queue a recalc here.

	* src/commands.c (cmd_autofill_redo) : queue the recalc here.
	(cmd_area_set_text_redo) : we need to manually queue a recalc for
	  arrays now.

	* src/sheet.c (sheet_cell_set_text) : we need to queue a recalc for
	  both expressions and values now.
	(sheet_range_set_text) : queue recalcs for the region as a block.

	* src/graph-vector.c (graph_vector_new) : Just use dependent_link if
	  we don't want a recalc.
parent 17843497
2001-05-26 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (colrow_move) : no need to queue recalc here.
(cb_sheet_cell_copy) : Actually copy the array values.
* src/cell.c (cell_relocate) : Just relink, no need to queue a recalc.
(cell_set_array_formula) : Remove the ability to queue the recalc at
this level. Just link the formulas in. Reorder the the arguments
to match the standard approach.
* src/eval.c (workbook_recalc_all) : Used here.
(workbook_queue_all_recalc) : new function.
* src/xml-io.c (xml_workbook_read) : Queue everything for recalc.
(xml_cell_set_array_expr) : no need to queue a recalc here.
* src/commands.c (cmd_autofill_redo) : queue the recalc here.
(cmd_area_set_text_redo) : we need to manually queue a recalc for
arrays now.
* src/sheet.c (sheet_cell_set_text) : we need to queue a recalc for
both expressions and values now.
(sheet_range_set_text) : queue recalcs for the region as a block.
* src/graph-vector.c (graph_vector_new) : Just use dependent_link if
we don't want a recalc.
2001-05-27 Karl Eichwalder <ke@suse.de>
* Run xml-i18n-prepare:
......
2001-05-26 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (colrow_move) : no need to queue recalc here.
(cb_sheet_cell_copy) : Actually copy the array values.
* src/cell.c (cell_relocate) : Just relink, no need to queue a recalc.
(cell_set_array_formula) : Remove the ability to queue the recalc at
this level. Just link the formulas in. Reorder the the arguments
to match the standard approach.
* src/eval.c (workbook_recalc_all) : Used here.
(workbook_queue_all_recalc) : new function.
* src/xml-io.c (xml_workbook_read) : Queue everything for recalc.
(xml_cell_set_array_expr) : no need to queue a recalc here.
* src/commands.c (cmd_autofill_redo) : queue the recalc here.
(cmd_area_set_text_redo) : we need to manually queue a recalc for
arrays now.
* src/sheet.c (sheet_cell_set_text) : we need to queue a recalc for
both expressions and values now.
(sheet_range_set_text) : queue recalcs for the region as a block.
* src/graph-vector.c (graph_vector_new) : Just use dependent_link if
we don't want a recalc.
2001-05-27 Karl Eichwalder <ke@suse.de>
* Run xml-i18n-prepare:
......
2001-05-26 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (colrow_move) : no need to queue recalc here.
(cb_sheet_cell_copy) : Actually copy the array values.
* src/cell.c (cell_relocate) : Just relink, no need to queue a recalc.
(cell_set_array_formula) : Remove the ability to queue the recalc at
this level. Just link the formulas in. Reorder the the arguments
to match the standard approach.
* src/eval.c (workbook_recalc_all) : Used here.
(workbook_queue_all_recalc) : new function.
* src/xml-io.c (xml_workbook_read) : Queue everything for recalc.
(xml_cell_set_array_expr) : no need to queue a recalc here.
* src/commands.c (cmd_autofill_redo) : queue the recalc here.
(cmd_area_set_text_redo) : we need to manually queue a recalc for
arrays now.
* src/sheet.c (sheet_cell_set_text) : we need to queue a recalc for
both expressions and values now.
(sheet_range_set_text) : queue recalcs for the region as a block.
* src/graph-vector.c (graph_vector_new) : Just use dependent_link if
we don't want a recalc.
2001-05-27 Karl Eichwalder <ke@suse.de>
* Run xml-i18n-prepare:
......
2001-05-26 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (colrow_move) : no need to queue recalc here.
(cb_sheet_cell_copy) : Actually copy the array values.
* src/cell.c (cell_relocate) : Just relink, no need to queue a recalc.
(cell_set_array_formula) : Remove the ability to queue the recalc at
this level. Just link the formulas in. Reorder the the arguments
to match the standard approach.
* src/eval.c (workbook_recalc_all) : Used here.
(workbook_queue_all_recalc) : new function.
* src/xml-io.c (xml_workbook_read) : Queue everything for recalc.
(xml_cell_set_array_expr) : no need to queue a recalc here.
* src/commands.c (cmd_autofill_redo) : queue the recalc here.
(cmd_area_set_text_redo) : we need to manually queue a recalc for
arrays now.
* src/sheet.c (sheet_cell_set_text) : we need to queue a recalc for
both expressions and values now.
(sheet_range_set_text) : queue recalcs for the region as a block.
* src/graph-vector.c (graph_vector_new) : Just use dependent_link if
we don't want a recalc.
2001-05-27 Karl Eichwalder <ke@suse.de>
* Run xml-i18n-prepare:
......
2001-05-26 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (colrow_move) : no need to queue recalc here.
(cb_sheet_cell_copy) : Actually copy the array values.
* src/cell.c (cell_relocate) : Just relink, no need to queue a recalc.
(cell_set_array_formula) : Remove the ability to queue the recalc at
this level. Just link the formulas in. Reorder the the arguments
to match the standard approach.
* src/eval.c (workbook_recalc_all) : Used here.
(workbook_queue_all_recalc) : new function.
* src/xml-io.c (xml_workbook_read) : Queue everything for recalc.
(xml_cell_set_array_expr) : no need to queue a recalc here.
* src/commands.c (cmd_autofill_redo) : queue the recalc here.
(cmd_area_set_text_redo) : we need to manually queue a recalc for
arrays now.
* src/sheet.c (sheet_cell_set_text) : we need to queue a recalc for
both expressions and values now.
(sheet_range_set_text) : queue recalcs for the region as a block.
* src/graph-vector.c (graph_vector_new) : Just use dependent_link if
we don't want a recalc.
2001-05-27 Karl Eichwalder <ke@suse.de>
* Run xml-i18n-prepare:
......
......@@ -1019,9 +1019,9 @@ applix_read_cells (ApplixReadState *state)
if (is_array) {
expr_tree_ref (expr);
cell_set_array_formula (sheet,
r.start.row, r.start.col,
r.end.row, r.end.col,
expr, FALSE);
r.start.col, r.start.row,
r.end.col, r.end.row,
expr);
cell_assign_value (cell, val, NULL);
} else
cell_set_expr_and_value (cell, expr, val, NULL, TRUE);
......
......@@ -1854,10 +1854,9 @@ ms_excel_formula_shared (BiffQuery *q, ExcelSheet *sheet, Cell *cell)
if (is_array)
cell_set_array_formula (sheet->gnum_sheet,
array_row_first,
array_col_first,
array_row_last,
array_col_last, expr, FALSE);
array_col_first, array_row_first,
array_col_last, array_row_last,
expr);
return expr;
}
......
2001-05-26 Jody Goldberg <jgoldberg@home.com>
* xml-sax-read.c (xml_sax_file_open) : If successful queue everything
for recalc.
(xml_cell_set_array_expr) : no need to queue a recalc for arrays.
2001-05-22 Almer S. Tigelaar <almer@gnome.org>
* xml-sax-read.c (xml_sax_sheet_name): Don't create
......
......@@ -1158,11 +1158,9 @@ xml_cell_set_array_expr (Cell *cell, char const *text,
g_return_if_fail (expr != NULL);
cell_set_array_formula (cell->base.sheet,
cell->pos.row,
cell->pos.col,
cell->pos.row + rows-1,
cell->pos.col + cols-1,
expr, TRUE);
cell->pos.col, cell->pos.row,
cell->pos.col + cols-1, cell->pos.row + rows-1,
expr);
}
/**
......@@ -1927,6 +1925,8 @@ xml_sax_file_open (GnumFileOpener const *fo, IOContext *io_context,
gnumeric_io_error_info_set (io_context,
error_info_new_str (
_("XML document not well formed!")));
else
workbook_queue_all_recalc (state.wb);
ctxt->sax = NULL;
xmlFreeParserCtxt (ctxt);
......
......@@ -299,7 +299,7 @@ cell_relocate (Cell *cell, ExprRewriteInfo *rwinfo)
}
/* Relink the expression. */
dependent_changed (CELL_TO_DEP (cell), &cell->pos, TRUE);
dependent_link (CELL_TO_DEP (cell), &cell->pos);
}
}
......@@ -499,7 +499,7 @@ cell_set_expr_internal (Cell *cell, ExprTree *expr, StyleFormat *opt_fmt)
* marks the sheet as dirty. Intented for use by import routines that
* do bulk assignment.
*
* The cell IS marked for recalc.
* The cell is NOT marked for recalc.
*
* If an optional format is supplied it is stored for later use.
*
......@@ -515,7 +515,7 @@ cell_set_expr_unsafe (Cell *cell, ExprTree *expr, StyleFormat *opt_fmt)
g_return_if_fail (expr != NULL);
cell_set_expr_internal (cell, expr, opt_fmt);
dependent_changed (CELL_TO_DEP (cell), &cell->pos, TRUE);
dependent_link (CELL_TO_DEP (cell), &cell->pos);
}
/**
......@@ -556,9 +556,8 @@ cell_set_expr (Cell *cell, ExprTree *expr, StyleFormat *opt_fmt)
*/
void
cell_set_array_formula (Sheet *sheet,
int row_a, int col_a, int row_b, int col_b,
ExprTree *formula,
gboolean queue_recalc)
int col_a, int row_a, int col_b, int row_b,
ExprTree *formula)
{
int const num_rows = 1 + row_b - row_a;
int const num_cols = 1 + col_b - col_a;
......@@ -589,13 +588,11 @@ cell_set_array_formula (Sheet *sheet,
cell = sheet_cell_fetch (sheet, col_a + x, row_a + y);
wrapper = expr_tree_new_array (x, y, num_rows, num_cols);
cell_set_expr_internal (cell, wrapper, NULL);
dependent_changed (CELL_TO_DEP (cell),
&cell->pos, queue_recalc);
dependent_link (CELL_TO_DEP (cell), &cell->pos);
expr_tree_unref (wrapper);
}
/* Put the corner at the head of the recalc list */
dependent_changed (CELL_TO_DEP (corner), &corner->pos, queue_recalc);
dependent_link (CELL_TO_DEP (corner), &corner->pos);
}
/***************************************************************************/
......
......@@ -78,9 +78,9 @@ void cell_set_expr (Cell *c, ExprTree *expr,
StyleFormat *opt_fmt);
void cell_set_expr_unsafe (Cell *cell, ExprTree *expr,
StyleFormat *opt_fmt);
void cell_set_array_formula (Sheet *sheet, int rowa, int cola,
int rowb, int colb, ExprTree *expr,
gboolean queue_recalc);
void cell_set_array_formula (Sheet *sheet,
int cola, int rowa, int colb, int rowb,
ExprTree *expr);
void cell_convert_expr_to_value (Cell *cell);
/**
......
......@@ -757,12 +757,13 @@ cmd_area_set_text_redo (GnumericCommand *cmd, WorkbookControl *wbc)
sheet_region_queue_recalc (me->pos.sheet, r);
/* If there is an expression then this was an array */
if (expr != NULL)
if (expr != NULL) {
cell_set_array_formula (me->pos.sheet,
r->start.row, r->start.col,
r->end.row, r->end.col,
expr, TRUE);
else
r->start.col, r->start.row,
r->end.col, r->end.row,
expr);
sheet_region_queue_recalc (me->pos.sheet, r);
} else
sheet_range_set_text (&me->pos, r, me->text);
/* mark content as dirty */
......@@ -2649,6 +2650,7 @@ cmd_autofill_redo (GnumericCommand *cmd, WorkbookControl *wbc)
me->base_col, me->base_row,
me->end_col, me->end_row);
sheet_region_queue_recalc (me->dst.sheet, &me->dst.range);
sheet_range_calc_spans (me->dst.sheet, me->dst.range, SPANCALC_RENDER);
sheet_flag_status_update_range (me->dst.sheet, &me->dst.range);
sheet_make_cell_visible (me->dst.sheet, me->base_col, me->base_row);
......
......@@ -98,6 +98,7 @@ dependent_set_expr (Dependent *dep, ExprTree *expr)
* replacing the corner of an array.
*/
cell_set_expr_unsafe (DEP_TO_CELL (dep), expr, NULL);
#warning Check to see what recalc assumptions the callers make
} else {
DependentClass *klass = g_ptr_array_index (dep_classes, t);
......@@ -625,7 +626,7 @@ handle_tree_deps (Dependent *dep, CellPos const *pos,
* Adds the dependent to the workbook wide list of dependents.
*/
void
dependent_link (Dependent *dep, const CellPos *pos)
dependent_link (Dependent *dep, CellPos const *pos)
{
Workbook *wb;
......@@ -720,7 +721,8 @@ dependent_unlink_sheet (Sheet const *sheet)
* @cell : the dependent that changed
* @queue_recalc: also queue a recalc for the dependent.
*
* Registers the expression with the sheet and optionally queues a recalc.
* Registers the expression with the sheet and optionally queues a recalc
* of the dependent.
*/
void
dependent_changed (Dependent *dep, CellPos const *pos, gboolean queue_recalc)
......@@ -1118,6 +1120,12 @@ workbook_deps_destroy (Workbook *wb)
g_list_free (sheets);
}
void
workbook_queue_all_recalc (Workbook *wb)
{
dependent_queue_recalc_list (wb->dependents, FALSE);
}
/*
* Computes all of the cells pending computation and
* any dependency.
......@@ -1163,7 +1171,7 @@ workbook_recalc (Workbook *wb)
void
workbook_recalc_all (Workbook *wb)
{
dependent_queue_recalc_list (wb->dependents, FALSE);
workbook_queue_all_recalc (wb);
workbook_recalc (wb);
WORKBOOK_FOREACH_VIEW (wb, view,
sheet_update (wb_view_cur_sheet (view)););
......
......@@ -57,6 +57,7 @@ void sheet_foreach_dep (Sheet *sheet, DepFunc func, gpointer user);
*/
void sheet_deps_destroy (Sheet *sheet);
void workbook_deps_destroy (Workbook *wb);
void workbook_queue_all_recalc (Workbook *wb);
DependencyData *dependency_data_new (void);
......
......@@ -98,6 +98,7 @@ dependent_set_expr (Dependent *dep, ExprTree *expr)
* replacing the corner of an array.
*/
cell_set_expr_unsafe (DEP_TO_CELL (dep), expr, NULL);
#warning Check to see what recalc assumptions the callers make
} else {
DependentClass *klass = g_ptr_array_index (dep_classes, t);
......@@ -625,7 +626,7 @@ handle_tree_deps (Dependent *dep, CellPos const *pos,
* Adds the dependent to the workbook wide list of dependents.
*/
void
dependent_link (Dependent *dep, const CellPos *pos)
dependent_link (Dependent *dep, CellPos const *pos)
{
Workbook *wb;
......@@ -720,7 +721,8 @@ dependent_unlink_sheet (Sheet const *sheet)
* @cell : the dependent that changed
* @queue_recalc: also queue a recalc for the dependent.
*
* Registers the expression with the sheet and optionally queues a recalc.
* Registers the expression with the sheet and optionally queues a recalc
* of the dependent.
*/
void
dependent_changed (Dependent *dep, CellPos const *pos, gboolean queue_recalc)
......@@ -1118,6 +1120,12 @@ workbook_deps_destroy (Workbook *wb)
g_list_free (sheets);
}
void
workbook_queue_all_recalc (Workbook *wb)
{
dependent_queue_recalc_list (wb->dependents, FALSE);
}
/*
* Computes all of the cells pending computation and
* any dependency.
......@@ -1163,7 +1171,7 @@ workbook_recalc (Workbook *wb)
void
workbook_recalc_all (Workbook *wb)
{
dependent_queue_recalc_list (wb->dependents, FALSE);
workbook_queue_all_recalc (wb);
workbook_recalc (wb);
WORKBOOK_FOREACH_VIEW (wb, view,
sheet_update (wb_view_cur_sheet (view)););
......
......@@ -57,6 +57,7 @@ void sheet_foreach_dep (Sheet *sheet, DepFunc func, gpointer user);
*/
void sheet_deps_destroy (Sheet *sheet);
void workbook_deps_destroy (Workbook *wb);
void workbook_queue_all_recalc (Workbook *wb);
DependencyData *dependency_data_new (void);
......
......@@ -465,7 +465,7 @@ graph_vector_new (Sheet *sheet, Range const *r, char *name)
vector->dep.flags = graph_vector_get_dep_type ();
vector->dep.expression = expr_tree_new_constant (
value_new_cellrange_r (sheet, r));
dependent_changed (&vector->dep, NULL, FALSE);
dependent_link (&vector->dep, NULL, FALSE);
CORBA_exception_init (&ev);
switch (type) {
......
......@@ -465,7 +465,7 @@ graph_vector_new (Sheet *sheet, Range const *r, char *name)
vector->dep.flags = graph_vector_get_dep_type ();
vector->dep.expression = expr_tree_new_constant (
value_new_cellrange_r (sheet, r));
dependent_changed (&vector->dep, NULL, FALSE);
dependent_link (&vector->dep, NULL, FALSE);
CORBA_exception_init (&ev);
switch (type) {
......
......@@ -1337,6 +1337,7 @@ sheet_range_set_text (EvalPos const *pos, Range const *r, char const *str)
}
g_slist_free (merged);
sheet_region_queue_recalc (pos->sheet, r);
if (closure.format)
style_format_unref (closure.format);
......@@ -1385,8 +1386,8 @@ sheet_cell_set_text (Cell *cell, char const *text)
} else {
cell_set_value (cell, val, format);
sheet_cell_calc_span (cell, SPANCALC_RESIZE | SPANCALC_RENDER);
cell_queue_recalc (cell);
}
cell_queue_recalc (cell);
if (format)
style_format_unref (format);
sheet_flag_status_update_cell (cell);
......@@ -3217,7 +3218,6 @@ colrow_move (Sheet *sheet,
sheet_cell_add_to_hash (sheet, cell);
cell_relocate (cell, NULL);
cell_queue_recalc (cell);
}
}
......@@ -3614,7 +3614,6 @@ sheet_move_range (WorkbookControl *wbc,
dependent_link (CELL_TO_DEP (cell), &cell->pos);
cell_relocate (cell, NULL);
cell_queue_recalc (cell);
}
/* 7. Move objects in the range */
......@@ -4176,16 +4175,25 @@ cb_sheet_cell_copy (gpointer unused, gpointer key, gpointer new_sheet_param)
ExprArray const* array = cell_is_array (cell);
if (array != NULL) {
if (array->x == 0 && array->y == 0) {
int i, j;
ExprTree *expr = array->corner.expr;
expr_tree_ref (expr);
cell_set_array_formula (dst,
cell->pos.row, cell->pos.col,
cell->pos.row + array->rows-1,
cell->pos.col + array->cols-1,
expr,
/* FIXME : We should copy the values */
TRUE);
cell->pos.col, cell->pos.row,
cell->pos.col + array->cols-1,
cell->pos.row + array->rows-1,
expr);
for (i = 0; i < array->cols ; i++)
for (j = 0; j < array->rows ; j++)
if (i != 0 || j != 0) {
Cell const *in = sheet_cell_fetch (cell->base.sheet,
cell->pos.col + i,
cell->pos.row + j);
Cell *out = sheet_cell_fetch (dst,
cell->pos.col + i,
cell->pos.row + j);
cell_set_value (out, in->value, in->format);
}
}
return;
}
......
......@@ -1787,11 +1787,9 @@ xml_cell_set_array_expr (Cell *cell, char const *text,
g_return_if_fail (expr != NULL);
cell_set_array_formula (cell->base.sheet,
cell->pos.row,
cell->pos.col,
cell->pos.row + rows-1,
cell->pos.col + cols-1,
expr, TRUE);
cell->pos.col, cell->pos.row,
cell->pos.col + cols-1, cell->pos.row + rows-1,
expr);
}
/**
......@@ -3102,6 +3100,8 @@ xml_workbook_read (IOContext *context, WorkbookView *wb_view,
gnumeric_setlocale (LC_NUMERIC, old_num_locale);
g_free (old_num_locale);
workbook_queue_all_recalc (wb);
return TRUE;
}
......
......@@ -1158,11 +1158,9 @@ xml_cell_set_array_expr (Cell *cell, char const *text,
g_return_if_fail (expr != NULL);
cell_set_array_formula (cell->base.sheet,
cell->pos.row,
cell->pos.col,
cell->pos.row + rows-1,
cell->pos.col + cols-1,
expr, TRUE);
cell->pos.col, cell->pos.row,
cell->pos.col + cols-1, cell->pos.row + rows-1,
expr);
}
/**
......@@ -1927,6 +1925,8 @@ xml_sax_file_open (GnumFileOpener const *fo, IOContext *io_context,
gnumeric_io_error_info_set (io_context,
error_info_new_str (
_("XML document not well formed!")));
else
workbook_queue_all_recalc (state.wb);
ctxt->sax = NULL;
xmlFreeParserCtxt (ctxt);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment