Commit 0f62302a authored by Miguel de Icaza's avatar Miguel de Icaza Committed by Arturo Espinosa

Set the Column/Row dimensions here after loading them, as the new

1999-10-16  Miguel de Icaza  <miguel@gnu.org>

	* src/xml-io.c (xml_read_colrow_info): Set the Column/Row
	dimensions here after loading them, as the new
	sheet_set_zoom_factor can no longer be used to reset lingering
	values (the value of the pixels was being computed here after we
	had read the units).

	* src/eval.c (cell_get_dependencies): Prototype change.  We now
	take the Cell as an argument and we scan all the sheets that
	depend on us.
parent 26a4dab7
1999-10-16 Miguel de Icaza <miguel@gnu.org>
* src/xml-io.c (xml_read_colrow_info): Set the Column/Row
dimensions here after loading them, as the new
sheet_set_zoom_factor can no longer be used to reset lingering
values (the value of the pixels was being computed here after we
had read the units).
* src/eval.c (cell_get_dependencies): Prototype change. We now
take the Cell as an argument and we scan all the sheets that
depend on us.
1999-10-14 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/functions/fn-stat.c: Fixed the optional argument handling of
......
1999-10-16 Miguel de Icaza <miguel@gnu.org>
* src/xml-io.c (xml_read_colrow_info): Set the Column/Row
dimensions here after loading them, as the new
sheet_set_zoom_factor can no longer be used to reset lingering
values (the value of the pixels was being computed here after we
had read the units).
* src/eval.c (cell_get_dependencies): Prototype change. We now
take the Cell as an argument and we scan all the sheets that
depend on us.
1999-10-14 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/functions/fn-stat.c: Fixed the optional argument handling of
......
......@@ -84,6 +84,9 @@ Gnumeric Spread Sheet task list
* Sheet
Should be possible to bind a name by typing the name on the
region box and applying it to the selection
** Column sizes
Columns should be smaller by default, and have an
......
......@@ -690,9 +690,7 @@ cell_content_changed (Cell *cell)
g_return_if_fail (cell != NULL);
/* Queue all of the dependencies for this cell */
deps = cell_get_dependencies (cell->sheet,
cell->col->pos,
cell->row->pos);
deps = cell_get_dependencies (cell);
if (deps)
cell_queue_recalc_list (deps, TRUE);
}
......
......@@ -409,6 +409,9 @@ search_cell_deps (gpointer key, gpointer value, gpointer closure)
get_cell_dep_closure_t *c = closure;
GList *l;
if (deprange->sheet != c->sheet)
return;
/* No intersection is the common case */
if (!range_contains (range, c->col, c->row))
return;
......@@ -421,26 +424,28 @@ search_cell_deps (gpointer key, gpointer value, gpointer closure)
}
GList *
cell_get_dependencies (Sheet *sheet, int col, int row)
cell_get_dependencies (Cell *cell)
{
get_cell_dep_closure_t closure;
GList *l;
if (!cell->sheet->dependency_hash)
dependency_hash_init (cell->sheet);
g_return_val_if_fail (sheet != NULL, NULL);
if (!sheet->dependency_hash)
dependency_hash_init (sheet);
closure.col = col;
closure.row = row;
closure.sheet = sheet;
closure.col = cell->col->pos;
closure.row = cell->row->pos;
closure.sheet = cell->sheet;
closure.list = NULL;
#if 0
printf ("Checking deps for %s:%s%d\n",
sheet->name, col_name(col), row+1);
#endif
g_hash_table_foreach (sheet->dependency_hash,
&search_cell_deps, &closure);
for (l = workbook_sheets (cell->sheet->workbook); l; l = l->next){
Sheet *sheet = l->data;
if (!sheet->dependency_hash)
continue;
g_hash_table_foreach (sheet->dependency_hash,
&search_cell_deps, &closure);
}
return closure.list;
}
......@@ -575,13 +580,12 @@ workbook_recalc (Workbook *wb)
cell->generation = generation;
cell_eval (cell);
deps = cell_get_dependencies (cell->sheet,
cell->col->pos, cell->row->pos);
deps = cell_get_dependencies (cell);
#ifdef DEBUG_EVALUATION
printf ("\nDepends for %s:%s :\n",
cell->sheet->name,
cell_name(cell->col->pos, cell->row->pos));
cell_name (cell->col->pos, cell->row->pos));
#endif
for (l = deps; l; l = l->next){
......
......@@ -31,7 +31,7 @@ void cell_drop_dependencies (Cell *cell);
* Returns a newly allocated list with Cells inside that
* depend on the value at Sheet, col, row
*/
GList *cell_get_dependencies (Sheet *sheet, int col, int row);
GList *cell_get_dependencies (Cell *cell);
/*
* Returns a newly allocated list with Cells inside that
......
......@@ -409,6 +409,9 @@ search_cell_deps (gpointer key, gpointer value, gpointer closure)
get_cell_dep_closure_t *c = closure;
GList *l;
if (deprange->sheet != c->sheet)
return;
/* No intersection is the common case */
if (!range_contains (range, c->col, c->row))
return;
......@@ -421,26 +424,28 @@ search_cell_deps (gpointer key, gpointer value, gpointer closure)
}
GList *
cell_get_dependencies (Sheet *sheet, int col, int row)
cell_get_dependencies (Cell *cell)
{
get_cell_dep_closure_t closure;
GList *l;
if (!cell->sheet->dependency_hash)
dependency_hash_init (cell->sheet);
g_return_val_if_fail (sheet != NULL, NULL);
if (!sheet->dependency_hash)
dependency_hash_init (sheet);
closure.col = col;
closure.row = row;
closure.sheet = sheet;
closure.col = cell->col->pos;
closure.row = cell->row->pos;
closure.sheet = cell->sheet;
closure.list = NULL;
#if 0
printf ("Checking deps for %s:%s%d\n",
sheet->name, col_name(col), row+1);
#endif
g_hash_table_foreach (sheet->dependency_hash,
&search_cell_deps, &closure);
for (l = workbook_sheets (cell->sheet->workbook); l; l = l->next){
Sheet *sheet = l->data;
if (!sheet->dependency_hash)
continue;
g_hash_table_foreach (sheet->dependency_hash,
&search_cell_deps, &closure);
}
return closure.list;
}
......@@ -575,13 +580,12 @@ workbook_recalc (Workbook *wb)
cell->generation = generation;
cell_eval (cell);
deps = cell_get_dependencies (cell->sheet,
cell->col->pos, cell->row->pos);
deps = cell_get_dependencies (cell);
#ifdef DEBUG_EVALUATION
printf ("\nDepends for %s:%s :\n",
cell->sheet->name,
cell_name(cell->col->pos, cell->row->pos));
cell_name (cell->col->pos, cell->row->pos));
#endif
for (l = deps; l; l = l->next){
......
......@@ -31,7 +31,7 @@ void cell_drop_dependencies (Cell *cell);
* Returns a newly allocated list with Cells inside that
* depend on the value at Sheet, col, row
*/
GList *cell_get_dependencies (Sheet *sheet, int col, int row);
GList *cell_get_dependencies (Cell *cell);
/*
* Returns a newly allocated list with Cells inside that
......
......@@ -1854,7 +1854,7 @@ sheet_col_get (Sheet const *sheet, int const pos)
return ci;
}
/**
* sheet_col_get:
* sheet_col_fetch:
*
* Returns an allocated column: either an existing one, or a fresh copy
*/
......@@ -1862,6 +1862,7 @@ ColRowInfo *
sheet_col_fetch (Sheet *sheet, int pos)
{
ColRowInfo * res = sheet_col_get (sheet, pos);
if (res == NULL)
if ((res = sheet_col_new (sheet)) != NULL) {
res->pos = pos;
......@@ -2164,7 +2165,7 @@ sheet_cell_remove_internal (Sheet *sheet, Cell *cell)
if (cell->parsed_node)
sheet_cell_formula_unlink (cell);
deps = cell_get_dependencies (sheet, cell->col->pos, cell->row->pos);
deps = cell_get_dependencies (cell);
cell_queue_recalc_list (deps, TRUE);
sheet_cell_remove_from_hash (sheet, cell);
......@@ -2527,9 +2528,9 @@ sheet_clear_region (Sheet *sheet, int start_col, int start_row, int end_col, int
cb.end_col = end_col;
cb.end_row = end_row;
cb.l = NULL;
if (sheet_cell_foreach_range ( sheet, TRUE,
if (sheet_cell_foreach_range (sheet, TRUE,
start_col, start_row, end_col, end_row,
assemble_clear_cell_list, &cb) == NULL) {
assemble_clear_cell_list, &cb) == NULL){
cb.l = g_list_reverse (cb.l);
cell_freeze_redraws();
for (l = cb.l; l; l = l->next){
......
......@@ -974,7 +974,7 @@ static GnomeUIInfo workbook_menu_insert [] = {
{ GNOME_APP_UI_ITEM, N_("_Add/modify comment..."),
N_("Edit the selected cell's comment"), workbook_edit_comment },
{ GNOME_APP_UI_SUBTREE, N_("_Special"), NULL, workbook_menu_insert_special },
{ GNOME_APP_UI_SUBTREE, N_("S_pecial"), NULL, workbook_menu_insert_special },
GNOMEUIINFO_END
};
......
......@@ -5,7 +5,6 @@
* Daniel Veillard <Daniel.Veillard@w3.org>
* Miguel de Icaza <miguel@gnu.org>
*
* $Id$
*/
#include <config.h>
......@@ -1306,11 +1305,11 @@ xml_write_colrow_info (Sheet *sheet, ColRowInfo *info, void *user_data)
* Create a ColRowInfo equivalent to the XML subtree of doc.
*/
static ColRowInfo *
xml_read_colrow_info (parse_xml_context_t *ctxt, xmlNodePtr tree, ColRowInfo *ret)
xml_read_colrow_info (parse_xml_context_t *ctxt, xmlNodePtr tree, ColRowInfo *ret, double *units)
{
int col = 0;
int val;
if (!strcmp (tree->name, "ColInfo")){
col = 1;
} else if (!strcmp (tree->name, "RowInfo")){
......@@ -1330,8 +1329,9 @@ xml_read_colrow_info (parse_xml_context_t *ctxt, xmlNodePtr tree, ColRowInfo *re
if (ret == NULL)
return NULL;
ret->units = -1;
xml_get_value_int (tree, "No", &ret->pos);
xml_get_value_double (tree, "Unit", &ret->units);
xml_get_value_double (tree, "Unit", units);
xml_get_value_double (tree, "MarginA", &ret->margin_a_pt);
xml_get_value_double (tree, "MarginB", &ret->margin_b_pt);
if (xml_get_value_int (tree, "HardSize", &val))
......@@ -1814,9 +1814,13 @@ xml_read_cols_info (parse_xml_context_t *ctxt, Sheet *sheet, xmlNodePtr tree)
return;
for (cols = child->childs; cols; cols = cols->next){
info = xml_read_colrow_info (ctxt, cols, NULL);
if (info != NULL)
sheet_col_add (sheet, info);
double units;
info = xml_read_colrow_info (ctxt, cols, NULL, &units);
if (!info)
continue;
sheet_col_add (sheet, info);
sheet_col_set_width_units (ctxt->sheet, info->pos, units);
}
}
......@@ -1831,9 +1835,13 @@ xml_read_rows_info (parse_xml_context_t *ctxt, Sheet *sheet, xmlNodePtr tree)
return;
for (rows = child->childs; rows; rows = rows->next){
info = xml_read_colrow_info (ctxt, rows, NULL);
if (info != NULL)
sheet_row_add (sheet, info);
double units;
info = xml_read_colrow_info (ctxt, rows, NULL, &units);
if (!info)
continue;
sheet_row_add (sheet, info);
sheet_row_set_height_units (ctxt->sheet, info->pos, units, info->hard_size);
}
}
......
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