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

When queuing for recalc, tag the cell, so that if we remove the cell from

1999-04-16  Miguel de Icaza  <miguel@nuclecu.unam.mx>

	* src/eval.c (cell_queue_recalc): When queuing for recalc, tag the
	cell, so that if we remove the cell from the recalc list we can
	quickly find out if we have to look for it on the list of pending
	recomputations.
	(pick_next_cell_from_queue): Clear the cell's
	CELL_QUEUED_FOR_RECALC bit.
	(cell_unqueue_from_recalc): New routine to remove a cell queued
	for recomputation.

	* src/clipboard.c (new_node): Trim leading spaces.
parent 8fb8d9ed
1999-04-16 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/eval.c (cell_queue_recalc): When queuing for recalc, tag the
cell, so that if we remove the cell from the recalc list we can
quickly find out if we have to look for it on the list of pending
recomputations.
(pick_next_cell_from_queue): Clear the cell's
CELL_QUEUED_FOR_RECALC bit.
(cell_unqueue_from_recalc): New routine to remove a cell queued
for recomputation.
* src/clipboard.c (new_node): Trim leading spaces.
1999-04-16 Jukka-Pekka Iivonen <iivonen@iki.fi>
......
1999-04-16 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/eval.c (cell_queue_recalc): When queuing for recalc, tag the
cell, so that if we remove the cell from the recalc list we can
quickly find out if we have to look for it on the list of pending
recomputations.
(pick_next_cell_from_queue): Clear the cell's
CELL_QUEUED_FOR_RECALC bit.
(cell_unqueue_from_recalc): New routine to remove a cell queued
for recomputation.
* src/clipboard.c (new_node): Trim leading spaces.
1999-04-16 Jukka-Pekka Iivonen <iivonen@iki.fi>
......
1999-04-16 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/eval.c (cell_queue_recalc): When queuing for recalc, tag the
cell, so that if we remove the cell from the recalc list we can
quickly find out if we have to look for it on the list of pending
recomputations.
(pick_next_cell_from_queue): Clear the cell's
CELL_QUEUED_FOR_RECALC bit.
(cell_unqueue_from_recalc): New routine to remove a cell queued
for recomputation.
* src/clipboard.c (new_node): Trim leading spaces.
1999-04-16 Jukka-Pekka Iivonen <iivonen@iki.fi>
......
1999-04-16 Miguel de Icaza <miguel@nuclecu.unam.mx>
* src/eval.c (cell_queue_recalc): When queuing for recalc, tag the
cell, so that if we remove the cell from the recalc list we can
quickly find out if we have to look for it on the list of pending
recomputations.
(pick_next_cell_from_queue): Clear the cell's
CELL_QUEUED_FOR_RECALC bit.
(cell_unqueue_from_recalc): New routine to remove a cell queued
for recomputation.
* src/clipboard.c (new_node): Trim leading spaces.
1999-04-16 Jukka-Pekka Iivonen <iivonen@iki.fi>
......
......@@ -20,9 +20,16 @@ typedef struct {
#define COL_INTERNAL_WIDTH(col) ((col)->pixels - ((col)->margin_b + (col)->margin_a))
#define ROW_INTERNAL_HEIGHT(row) ((row)->pixels - ((row)->margin_b + (row)->margin_a))
#define CELL_ERROR 1
#define CELL_HAS_COMMENT 2
#define CELL_FORMAT_SET 4
/* Cell has a computation error */
#define CELL_ERROR 1
/* Cell container a comment */
#define CELL_HAS_COMMENT 2
#define CELL_FORMAT_SET 4
/* Cell has been queued for recalc */
#define CELL_QUEUED_FOR_RECALC 8
/**
* CellComment:
......
......@@ -371,6 +371,12 @@ cell_get_dependencies (Sheet *sheet, int col, int row)
return closure.list;
}
/*
* cell_queue_recalc:
* @cell: the cell that contains the formula that must be recomputed
*
* Queues the cell @cell for recalculation.
*/
void
cell_queue_recalc (Cell *cell)
{
......@@ -380,6 +386,30 @@ cell_queue_recalc (Cell *cell)
wb = ((Sheet *)cell->sheet)->workbook;
wb->eval_queue = g_list_prepend (wb->eval_queue, cell);
cell->flags |= CELL_QUEUED_FOR_RECALC;
}
/*
* cell_unqueue_from_recalc:
* @cell: the cell to remove from the recomputation queue
*
* Removes a cell that has been previously added to the recomputation
* queue. Used internally when a cell that was queued no longer contains
* a formula.
*/
void
cell_unqueue_from_recalc (Cell *cell)
{
Workbook *wb;
g_return_if_fail (cell != NULL);
if (!(cell->flags & CELL_QUEUED_FOR_RECALC))
return;
wb = ((Sheet *)(cell->sheet))->workbook;
wb->eval_queue = g_list_remove (wb->eval_queue, cell);
cell->flags &= ~CELL_QUEUED_FOR_RECALC;
}
void
......@@ -407,6 +437,7 @@ pick_next_cell_from_queue (Workbook *wb)
cell = wb->eval_queue->data;
wb->eval_queue = g_list_remove (wb->eval_queue, cell);
cell->flags &= ~CELL_QUEUED_FOR_RECALC;
return cell;
}
......@@ -476,4 +507,3 @@ workbook_recalc_all (Workbook *workbook)
workbook_recalc (workbook);
}
......@@ -45,6 +45,8 @@ void cell_queue_recalc (Cell *cell);
void cell_queue_recalc_list (GList *list);
void cell_unqueue_from_recalc (Cell *cell);
/*
* Evaluate a cell
*/
......
......@@ -371,6 +371,12 @@ cell_get_dependencies (Sheet *sheet, int col, int row)
return closure.list;
}
/*
* cell_queue_recalc:
* @cell: the cell that contains the formula that must be recomputed
*
* Queues the cell @cell for recalculation.
*/
void
cell_queue_recalc (Cell *cell)
{
......@@ -380,6 +386,30 @@ cell_queue_recalc (Cell *cell)
wb = ((Sheet *)cell->sheet)->workbook;
wb->eval_queue = g_list_prepend (wb->eval_queue, cell);
cell->flags |= CELL_QUEUED_FOR_RECALC;
}
/*
* cell_unqueue_from_recalc:
* @cell: the cell to remove from the recomputation queue
*
* Removes a cell that has been previously added to the recomputation
* queue. Used internally when a cell that was queued no longer contains
* a formula.
*/
void
cell_unqueue_from_recalc (Cell *cell)
{
Workbook *wb;
g_return_if_fail (cell != NULL);
if (!(cell->flags & CELL_QUEUED_FOR_RECALC))
return;
wb = ((Sheet *)(cell->sheet))->workbook;
wb->eval_queue = g_list_remove (wb->eval_queue, cell);
cell->flags &= ~CELL_QUEUED_FOR_RECALC;
}
void
......@@ -407,6 +437,7 @@ pick_next_cell_from_queue (Workbook *wb)
cell = wb->eval_queue->data;
wb->eval_queue = g_list_remove (wb->eval_queue, cell);
cell->flags &= ~CELL_QUEUED_FOR_RECALC;
return cell;
}
......@@ -476,4 +507,3 @@ workbook_recalc_all (Workbook *workbook)
workbook_recalc (workbook);
}
......@@ -45,6 +45,8 @@ void cell_queue_recalc (Cell *cell);
void cell_queue_recalc_list (GList *list);
void cell_unqueue_from_recalc (Cell *cell);
/*
* Evaluate a cell
*/
......
......@@ -12,6 +12,7 @@
#include "gnumeric-sheet.h"
#include "dialogs.h"
#include "sheet-object.h"
#include "sheet-object-container.h"
#include "cursors.h"
/* Pulls the GnumericSheet from a SheetView */
......
......@@ -2147,6 +2147,10 @@ sheet_cell_formula_unlink (Cell *cell)
sheet = cell->sheet;
cell_drop_dependencies (cell);
sheet->workbook->formula_cell_list = g_list_remove (sheet->workbook->formula_cell_list, cell);
/* Just an optimization to avoid an expensive list lookup */
if (cell->flags & CELL_QUEUED_FOR_RECALC)
cell_unqueue_from_recalc (cell);
}
/**
......@@ -3416,7 +3420,7 @@ sheet_lookup_by_name (Sheet *base, char *name)
return NULL;
}
#ifdef 0
#if 0
void
sheet_insert_object (Sheet *sheet, char *repoid)
{
......
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