Commit 7f94ba9e authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

renamed from sheet_cell_formula_{link,unlink}.


2000-06-05  Jody Goldberg <jgoldberg@home.com>

	* src/sheet.c (sheet_cell_expr_{link,unlink}) : renamed from
	  sheet_cell_formula_{link,unlink}.

	* src/cell.c (cell_relocate) : Doh! use the offset flags now that they
	  are being passed.

	* src/clipboard.c (paste_cell) : Renamed from paste_cell_flags.

	* src/expr.c (compare) : value_is_empty_cell -> VALUE_IS_EMPTY.

	* src/value.c (VALUE_IS_EMPTY) : rename from value_is_empty_cell.

	* src/sheet-private.h : Add resize_scrollbar.

	* src/sheet.c (sheet_{col,row}_add) : Use resize_scrollbar flag rather
	  than manually updating the scrolling bar.
	(sheet_update) : Handle resize_scrollbar.
	(sheet_cell_expr_link) : renamed from sheet_cell_formula_link.
	(sheet_cell_expr_unlink) : renamed from sheet_cell_formula_unlink.
parent 82da7fbe
......@@ -7,6 +7,7 @@ Release Critical
- Changing a name that is in use causes a crash.
- The max row/col canvas scroll size is still hard coded.
- Resize row/col undo is unfinished.
- changing col/row sizes does not mark a sheet dirty.
- Saving xml should not rely on changing the textdomain to disable translation
of TRUE/FALSE.
......@@ -24,9 +25,6 @@ Long term breakage
and remove decimals.
- Auto resize needs to handle empty cells.
- changing col/row sizes does not mark a sheet dirty.
- changing col/row sizes does not have undo support.
- auto-fill does not have undo support.
- The implication of mixed mode references ($B$2:C3)
is large. All accesses to a RangeRef need to be normalized. (1/2 done)
......
2000-06-05 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_cell_expr_{link,unlink}) : renamed from
sheet_cell_formula_{link,unlink}.
* src/cell.c (cell_relocate) : Doh! use the offset flags now that they
are being passed.
* src/clipboard.c (paste_cell) : Renamed from paste_cell_flags.
* src/expr.c (compare) : value_is_empty_cell -> VALUE_IS_EMPTY.
* src/value.c (VALUE_IS_EMPTY) : rename from value_is_empty_cell.
* src/sheet-private.h : Add resize_scrollbar.
* src/sheet.c (sheet_{col,row}_add) : Use resize_scrollbar flag rather
than manually updating the scrolling bar.
(sheet_update) : Handle resize_scrollbar.
(sheet_cell_expr_link) : renamed from sheet_cell_formula_link.
(sheet_cell_expr_unlink) : renamed from sheet_cell_formula_unlink.
2000-06-04 Jody Goldberg <jgoldberg@home.com>
* src/value.c (value_is_empty_cell) : str == "" is not empty
......
2000-06-05 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_cell_expr_{link,unlink}) : renamed from
sheet_cell_formula_{link,unlink}.
* src/cell.c (cell_relocate) : Doh! use the offset flags now that they
are being passed.
* src/clipboard.c (paste_cell) : Renamed from paste_cell_flags.
* src/expr.c (compare) : value_is_empty_cell -> VALUE_IS_EMPTY.
* src/value.c (VALUE_IS_EMPTY) : rename from value_is_empty_cell.
* src/sheet-private.h : Add resize_scrollbar.
* src/sheet.c (sheet_{col,row}_add) : Use resize_scrollbar flag rather
than manually updating the scrolling bar.
(sheet_update) : Handle resize_scrollbar.
(sheet_cell_expr_link) : renamed from sheet_cell_formula_link.
(sheet_cell_expr_unlink) : renamed from sheet_cell_formula_unlink.
2000-06-04 Jody Goldberg <jgoldberg@home.com>
* src/value.c (value_is_empty_cell) : str == "" is not empty
......
2000-06-05 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_cell_expr_{link,unlink}) : renamed from
sheet_cell_formula_{link,unlink}.
* src/cell.c (cell_relocate) : Doh! use the offset flags now that they
are being passed.
* src/clipboard.c (paste_cell) : Renamed from paste_cell_flags.
* src/expr.c (compare) : value_is_empty_cell -> VALUE_IS_EMPTY.
* src/value.c (VALUE_IS_EMPTY) : rename from value_is_empty_cell.
* src/sheet-private.h : Add resize_scrollbar.
* src/sheet.c (sheet_{col,row}_add) : Use resize_scrollbar flag rather
than manually updating the scrolling bar.
(sheet_update) : Handle resize_scrollbar.
(sheet_cell_expr_link) : renamed from sheet_cell_formula_link.
(sheet_cell_expr_unlink) : renamed from sheet_cell_formula_unlink.
2000-06-04 Jody Goldberg <jgoldberg@home.com>
* src/value.c (value_is_empty_cell) : str == "" is not empty
......
2000-06-05 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_cell_expr_{link,unlink}) : renamed from
sheet_cell_formula_{link,unlink}.
* src/cell.c (cell_relocate) : Doh! use the offset flags now that they
are being passed.
* src/clipboard.c (paste_cell) : Renamed from paste_cell_flags.
* src/expr.c (compare) : value_is_empty_cell -> VALUE_IS_EMPTY.
* src/value.c (VALUE_IS_EMPTY) : rename from value_is_empty_cell.
* src/sheet-private.h : Add resize_scrollbar.
* src/sheet.c (sheet_{col,row}_add) : Use resize_scrollbar flag rather
than manually updating the scrolling bar.
(sheet_update) : Handle resize_scrollbar.
(sheet_cell_expr_link) : renamed from sheet_cell_formula_link.
(sheet_cell_expr_unlink) : renamed from sheet_cell_formula_unlink.
2000-06-04 Jody Goldberg <jgoldberg@home.com>
* src/value.c (value_is_empty_cell) : str == "" is not empty
......
2000-06-05 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_cell_expr_{link,unlink}) : renamed from
sheet_cell_formula_{link,unlink}.
* src/cell.c (cell_relocate) : Doh! use the offset flags now that they
are being passed.
* src/clipboard.c (paste_cell) : Renamed from paste_cell_flags.
* src/expr.c (compare) : value_is_empty_cell -> VALUE_IS_EMPTY.
* src/value.c (VALUE_IS_EMPTY) : rename from value_is_empty_cell.
* src/sheet-private.h : Add resize_scrollbar.
* src/sheet.c (sheet_{col,row}_add) : Use resize_scrollbar flag rather
than manually updating the scrolling bar.
(sheet_update) : Handle resize_scrollbar.
(sheet_cell_expr_link) : renamed from sheet_cell_formula_link.
(sheet_cell_expr_unlink) : renamed from sheet_cell_formula_unlink.
2000-06-04 Jody Goldberg <jgoldberg@home.com>
* src/value.c (value_is_empty_cell) : str == "" is not empty
......
2000-06-05 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_cell_expr_{link,unlink}) : renamed from
sheet_cell_formula_{link,unlink}.
* src/cell.c (cell_relocate) : Doh! use the offset flags now that they
are being passed.
* src/clipboard.c (paste_cell) : Renamed from paste_cell_flags.
* src/expr.c (compare) : value_is_empty_cell -> VALUE_IS_EMPTY.
* src/value.c (VALUE_IS_EMPTY) : rename from value_is_empty_cell.
* src/sheet-private.h : Add resize_scrollbar.
* src/sheet.c (sheet_{col,row}_add) : Use resize_scrollbar flag rather
than manually updating the scrolling bar.
(sheet_update) : Handle resize_scrollbar.
(sheet_cell_expr_link) : renamed from sheet_cell_formula_link.
(sheet_cell_expr_unlink) : renamed from sheet_cell_formula_unlink.
2000-06-04 Jody Goldberg <jgoldberg@home.com>
* src/value.c (value_is_empty_cell) : str == "" is not empty
......
2000-06-05 Jody Goldberg <jgoldberg@home.com>
* src/sheet.c (sheet_cell_expr_{link,unlink}) : renamed from
sheet_cell_formula_{link,unlink}.
* src/cell.c (cell_relocate) : Doh! use the offset flags now that they
are being passed.
* src/clipboard.c (paste_cell) : Renamed from paste_cell_flags.
* src/expr.c (compare) : value_is_empty_cell -> VALUE_IS_EMPTY.
* src/value.c (VALUE_IS_EMPTY) : rename from value_is_empty_cell.
* src/sheet-private.h : Add resize_scrollbar.
* src/sheet.c (sheet_{col,row}_add) : Use resize_scrollbar flag rather
than manually updating the scrolling bar.
(sheet_update) : Handle resize_scrollbar.
(sheet_cell_expr_link) : renamed from sheet_cell_formula_link.
(sheet_cell_expr_unlink) : renamed from sheet_cell_formula_unlink.
2000-06-04 Jody Goldberg <jgoldberg@home.com>
* src/value.c (value_is_empty_cell) : str == "" is not empty
......
......@@ -43,7 +43,7 @@ cell_dirty (Cell *cell)
static void
cell_formula_changed (Cell *cell, gboolean queue_recalc)
{
sheet_cell_formula_link (cell);
sheet_cell_expr_link (cell);
if (queue_recalc)
eval_queue_cell (cell);
}
......@@ -72,8 +72,8 @@ cell_cleanout (Cell *cell)
/* A cell can have either an expression or entered text */
if (cell_has_expr (cell)) {
/* Clipboard cells, e.g., are not attached to a sheet. */
if (cell->sheet)
sheet_cell_formula_unlink (cell);
if (cell_expr_is_linked (cell))
sheet_cell_expr_unlink (cell);
expr_tree_unref (cell->u.expression);
cell->u.expression = NULL;
} else if (cell->u.entered_text) {
......@@ -200,7 +200,7 @@ cell_relocate (Cell *cell, int col_offset, int row_offset, gboolean check_bounds
/* 2. If the cell contains a formula, relocate the formula */
if (cell_has_expr (cell)) {
if (cell_expr_is_linked (cell))
sheet_cell_formula_unlink (cell);
sheet_cell_expr_unlink (cell);
/*
* WARNING WARNING WARNING
......@@ -238,8 +238,8 @@ cell_relocate (Cell *cell, int col_offset, int row_offset, gboolean check_bounds
rinfo->origin.start.row =
rinfo->origin.end.row = cell->row_info->pos;
rinfo->origin_sheet = rinfo->target_sheet = cell->sheet;
rinfo->col_offset = 0;
rinfo->row_offset = 0;
rinfo->col_offset = col_offset;
rinfo->row_offset = row_offset;
eval_pos_init_cell (&rinfo->pos, cell);
expr = expr_rewrite (expr, &rwinfo);
......@@ -450,7 +450,7 @@ cell_set_expr_and_value (Cell *cell, ExprTree *expr, Value *v)
cell->u.expression = expr;
cell->cell_flags |= CELL_HAS_EXPRESSION;
sheet_cell_formula_link (cell);
sheet_cell_expr_link (cell);
#if 0
/* TODO : Should we add this for consistancy ? */
cell->format = fmt;
......
......@@ -38,7 +38,7 @@
#define TARGETS_ATOM_NAME "TARGETS"
/**
* paste_cell_flags: Pastes a cell in the spreadsheet
* paste_cell: Pastes a cell in the spreadsheet
*
* @dest_sheet: The sheet where the pasting will be done
* @new_cell: A new cell (not linked into the sheet, or wb->expr_list)
......@@ -47,7 +47,7 @@
* @paste_flags: Bit mask that describes the paste options.
*/
static void
paste_cell_flags (Sheet *dest_sheet,
paste_cell (Sheet *dest_sheet,
int target_col, int target_row,
int col_offset, int row_offset,
CellCopy *c_copy, int paste_flags)
......@@ -205,7 +205,7 @@ clipboard_paste_region (CommandContext *context,
target_row += c_copy->row_offset;
}
paste_cell_flags (pt->sheet,
paste_cell (pt->sheet,
target_col, target_row,
col_offset, row_offset,
c_copy, pt->paste_flags);
......
......@@ -463,8 +463,8 @@ compare (Value const *a, Value const *b)
if (a == b)
return IS_EQUAL;
ta = value_is_empty_cell (a) ? VALUE_EMPTY : a->type;
tb = value_is_empty_cell (b) ? VALUE_EMPTY : b->type;
ta = VALUE_IS_EMPTY (a) ? VALUE_EMPTY : a->type;
tb = VALUE_IS_EMPTY (b) ? VALUE_EMPTY : b->type;
/* string > empty */
if (ta == VALUE_STRING) {
......
......@@ -12,6 +12,7 @@ struct _SheetPrivate {
gboolean selection_content_changed;
gboolean recompute_visibility;
gboolean recompute_spans;
gboolean resize_scrollbar;
int reposition_row_comment;
int reposition_col_comment;
};
......
......@@ -544,14 +544,8 @@ sheet_col_add (Sheet *sheet, ColRowInfo *cp)
(*segment)[COLROW_SUB_INDEX(col)] = cp;
if (col > sheet->cols.max_used){
GList *l;
sheet->cols.max_used = col;
for (l = sheet->sheet_views; l; l = l->next){
SheetView *sheet_view = l->data;
sheet_view_scrollbar_config (sheet_view);
}
sheet->priv->resize_scrollbar = TRUE;
}
}
......@@ -569,14 +563,8 @@ sheet_row_add (Sheet *sheet, ColRowInfo *rp)
(*segment)[COLROW_SUB_INDEX(row)] = rp;
if (rp->pos > sheet->rows.max_used){
GList *l;
sheet->rows.max_used = row;
for (l = sheet->sheet_views; l; l = l->next){
SheetView *sheet_view = l->data;
sheet_view_scrollbar_config (sheet_view);
}
sheet->priv->resize_scrollbar = TRUE;
}
}
......@@ -751,11 +739,22 @@ sheet_update (Sheet const *sheet)
* and use that.
*/
p->recompute_visibility = FALSE;
p->resize_scrollbar = FALSE; /* compute_visible_ranges does this */
sheet_compute_visible_ranges (sheet);
sheet_update_cursor_pos (sheet);
sheet_redraw_all (sheet);
}
if (p->resize_scrollbar) {
GList *l;
for (l = sheet->sheet_views; l; l = l->next){
SheetView *sheet_view = l->data;
sheet_view_scrollbar_config (sheet_view);
}
p->resize_scrollbar = FALSE;
}
/* Only manipulate the status line if we are not selecting a region */
if (sheet->workbook->editing)
return;
......@@ -2062,7 +2061,7 @@ sheet_cell_remove_simple (Sheet *sheet, Cell *cell)
eval_unqueue_cell (cell);
if (cell_has_expr (cell))
sheet_cell_formula_unlink (cell);
sheet_cell_expr_unlink (cell);
deps = cell_get_dependencies (cell);
if (deps)
......@@ -2121,7 +2120,7 @@ sheet_cell_comment_unlink (Cell *cell)
}
void
sheet_cell_formula_link (Cell *cell)
sheet_cell_expr_link (Cell *cell)
{
Sheet *sheet;
......@@ -2146,7 +2145,7 @@ sheet_cell_formula_link (Cell *cell)
}
void
sheet_cell_formula_unlink (Cell *cell)
sheet_cell_expr_unlink (Cell *cell)
{
Sheet *sheet;
......@@ -2154,10 +2153,12 @@ sheet_cell_formula_unlink (Cell *cell)
g_return_if_fail (cell_has_expr (cell));
g_return_if_fail (cell_expr_is_linked (cell));
cell->cell_flags &= ~CELL_IN_EXPR_LIST;
sheet = cell->sheet;
g_return_if_fail (sheet != NULL); /* Catch use of deleted cell */
if (sheet == NULL)
return;
cell->cell_flags &= ~CELL_IN_EXPR_LIST;
cell_drop_dependencies (cell);
sheet->workbook->formula_cell_list = g_list_remove (sheet->workbook->formula_cell_list, cell);
......@@ -2167,14 +2168,14 @@ sheet_cell_formula_unlink (Cell *cell)
}
/**
* sheet_formulas_unlink : An internal routine to remove all expressions
* sheet_expr_unlink : An internal routine to remove all expressions
* associated with a given sheet from the workbook wide expression list.
*
* WARNING : This is a dangerous internal function. it leaves the cells in an
* invalid state. It is intended for use by sheet_destroy_contents.
*/
static void
sheet_formulas_unlink (Sheet *sheet)
sheet_expr_unlink (Sheet *sheet)
{
GList *ptr, *next, *queue;
Workbook *wb;
......@@ -2310,7 +2311,7 @@ sheet_destroy_contents (Sheet *sheet)
eval_unqueue_sheet (sheet);
/* Unlink expressions from the workbook expr list */
sheet_formulas_unlink (sheet);
sheet_expr_unlink (sheet);
/* Remove all the cells */
g_hash_table_foreach_remove (sheet->cell_hash, &cb_remove_allcells, NULL);
......@@ -3259,7 +3260,7 @@ sheet_move_range (CommandContext *context,
GList *cells = NULL;
Cell *cell;
Range dst;
gboolean inter_sheet_formula, out_of_range;
gboolean inter_sheet_expr, out_of_range;
g_return_if_fail (rinfo != NULL);
g_return_if_fail (rinfo->origin_sheet != NULL);
......@@ -3361,25 +3362,25 @@ sheet_move_range (CommandContext *context,
if ((cell->col_info->pos + rinfo->col_offset) >= SHEET_MAX_COLS ||
(cell->row_info->pos + rinfo->row_offset) >= SHEET_MAX_ROWS) {
if (cell_has_expr (cell))
sheet_cell_formula_unlink (cell);
sheet_cell_expr_unlink (cell);
cell_unrealize (cell);
cell_destroy (cell);
continue;
}
/* Inter sheet movement requires the moving the formula too */
inter_sheet_formula = (cell->sheet != rinfo->target_sheet &&
/* Inter sheet movement requires the moving the expression too */
inter_sheet_expr = (cell->sheet != rinfo->target_sheet &&
cell_has_expr (cell));
if (inter_sheet_formula)
sheet_cell_formula_unlink (cell);
if (inter_sheet_expr)
sheet_cell_expr_unlink (cell);
/* Update the location */
sheet_cell_insert (rinfo->target_sheet, cell,
cell->col_info->pos + rinfo->col_offset,
cell->row_info->pos + rinfo->row_offset);
if (inter_sheet_formula)
sheet_cell_formula_link (cell);
if (inter_sheet_expr)
sheet_cell_expr_link (cell);
/* Move comments */
cell_relocate (cell, 0, 0, FALSE);
......
......@@ -169,8 +169,8 @@ void sheet_cell_comment_unlink (Cell *cell);
void sheet_recompute_spans_for_col (Sheet *sheet, int col);
void sheet_cell_formula_link (Cell *cell);
void sheet_cell_formula_unlink (Cell *cell);
void sheet_cell_expr_link (Cell *cell);
void sheet_cell_expr_unlink (Cell *cell);
void sheet_cell_changed (Cell *cell);
gboolean sheet_is_region_empty_or_selected (Sheet *sheet, int start_col, int start_row,
......
......@@ -533,18 +533,6 @@ value_get_as_float (const Value *v)
return 0.0;
}
/*
* Test @v to see if it fits the heurists used to identify the results of
* accessing an empty cell. Which are currently
* 1) v == NULL
* 2) v->type == VALUE_EMPTY (new)
*/
gboolean
value_is_empty_cell (Value const *v)
{
return v == NULL || (v->type == VALUE_EMPTY);
}
/*
* A utility routine for create a special static instance of Value to be used
* as a magic pointer to flag a request to terminate an iteration.
......
......@@ -63,12 +63,11 @@ union _Value {
ValueArray v_array;
};
#define VALUE_IS_NUMBER(x) (((x)->type == VALUE_INTEGER) || \
((x)->type == VALUE_FLOAT) || \
((x)->type == VALUE_BOOLEAN))
#define VALUE_IS_EMPTY_OR_ERROR(x) (value_is_empty_cell (x) || \
((x)->type == VALUE_ERROR))
#define VALUE_IS_EMPTY(v) (((v) == NULL) || ((v)->type == VALUE_EMPTY))
#define VALUE_IS_EMPTY_OR_ERROR(v) (VALUE_IS_EMPTY(v) || (v)->type == VALUE_ERROR)
#define VALUE_IS_NUMBER(v) (((v)->type == VALUE_INTEGER) || \
((v)->type == VALUE_FLOAT) || \
((v)->type == VALUE_BOOLEAN))
Value *value_new_empty (void);
Value *value_new_bool (gboolean b);
......@@ -98,9 +97,6 @@ float_t value_get_as_float (const Value *v);
char *value_cellrange_get_as_string (const Value *value,
gboolean use_relative_syntax);
/* Does the value correspond to an empty cell ? */
gboolean value_is_empty_cell (Value const *v);
/* Return a Special error value indicating that the iteration should stop */
Value *value_terminate (void);
......
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