Commit 6604f0f8 authored by Michael Meeks's avatar Michael Meeks

Minor trivial optimisations,

Dependancy dumps when --debug=10.
parent cee9b219
1999-05-12 Michael Meeks <michael@imaginator.com>
* src/workbook.c (workbook_setup_edit_area): Added dependancy
debugging button for --debug=10 and fixed memory leak.
(deps_output): Dumps dependency data to stdout.
* src/gnumeric-util.c (range_contains): Re-order compares
to catch single cell ranges more quickly.
* src/eval.c (intersects): Change order of sheet / range check
for speed.
(search_cell_deps): Added comment.
* src/eval.h: Cosmetic typo. fix shet -> sheet
1999-05-12 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/fn-database.c: Database functions accept now string
......
1999-05-12 Michael Meeks <michael@imaginator.com>
* src/workbook.c (workbook_setup_edit_area): Added dependancy
debugging button for --debug=10 and fixed memory leak.
(deps_output): Dumps dependency data to stdout.
* src/gnumeric-util.c (range_contains): Re-order compares
to catch single cell ranges more quickly.
* src/eval.c (intersects): Change order of sheet / range check
for speed.
(search_cell_deps): Added comment.
* src/eval.h: Cosmetic typo. fix shet -> sheet
1999-05-12 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/fn-database.c: Database functions accept now string
......
1999-05-12 Michael Meeks <michael@imaginator.com>
* src/workbook.c (workbook_setup_edit_area): Added dependancy
debugging button for --debug=10 and fixed memory leak.
(deps_output): Dumps dependency data to stdout.
* src/gnumeric-util.c (range_contains): Re-order compares
to catch single cell ranges more quickly.
* src/eval.c (intersects): Change order of sheet / range check
for speed.
(search_cell_deps): Added comment.
* src/eval.h: Cosmetic typo. fix shet -> sheet
1999-05-12 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/fn-database.c: Database functions accept now string
......
1999-05-12 Michael Meeks <michael@imaginator.com>
* src/workbook.c (workbook_setup_edit_area): Added dependancy
debugging button for --debug=10 and fixed memory leak.
(deps_output): Dumps dependency data to stdout.
* src/gnumeric-util.c (range_contains): Re-order compares
to catch single cell ranges more quickly.
* src/eval.c (intersects): Change order of sheet / range check
for speed.
(search_cell_deps): Added comment.
* src/eval.h: Cosmetic typo. fix shet -> sheet
1999-05-12 Jukka-Pekka Iivonen <iivonen@iki.fi>
* src/fn-database.c: Database functions accept now string
......
......@@ -292,7 +292,8 @@ typedef struct {
static gboolean
intersects (Sheet *sheet, int col, int row, DependencyRange *range)
{
if (range_contains (&range->range, col, row) && (sheet == range->sheet))
if ((sheet == range->sheet) &&
range_contains (&range->range, col, row))
return TRUE;
return FALSE;
......@@ -305,13 +306,17 @@ search_cell_deps (gpointer key, gpointer value, gpointer closure)
get_dep_closure_t *c = closure;
Sheet *sheet = c->sheet;
GList *l;
static int inters=0;
static int nointers=0;
/* No intersection is the common case */
if (!(intersects (sheet, c->start_col, c->start_row, range) ||
intersects (sheet, c->end_col, c->end_row, range) ||
intersects (sheet, c->start_col, c->end_row, range) ||
intersects (sheet, c->end_col, c->start_row, range)))
return;
for (l = range->cell_list; l; l = l->next){
Cell *cell = l->data;
......@@ -441,6 +446,8 @@ pick_next_cell_from_queue (Workbook *wb)
cell = wb->eval_queue->data;
wb->eval_queue = g_list_remove (wb->eval_queue, cell);
if (!(cell->flags & CELL_QUEUED_FOR_RECALC))
printf ("De-queued cell here\n");
cell->flags &= ~CELL_QUEUED_FOR_RECALC;
return cell;
}
......
......@@ -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 *shet, int col, int row);
GList *cell_get_dependencies (Sheet *sheet, int col, int row);
/*
* Returns a newly allocated list with Cells inside that
......
......@@ -292,7 +292,8 @@ typedef struct {
static gboolean
intersects (Sheet *sheet, int col, int row, DependencyRange *range)
{
if (range_contains (&range->range, col, row) && (sheet == range->sheet))
if ((sheet == range->sheet) &&
range_contains (&range->range, col, row))
return TRUE;
return FALSE;
......@@ -305,13 +306,17 @@ search_cell_deps (gpointer key, gpointer value, gpointer closure)
get_dep_closure_t *c = closure;
Sheet *sheet = c->sheet;
GList *l;
static int inters=0;
static int nointers=0;
/* No intersection is the common case */
if (!(intersects (sheet, c->start_col, c->start_row, range) ||
intersects (sheet, c->end_col, c->end_row, range) ||
intersects (sheet, c->start_col, c->end_row, range) ||
intersects (sheet, c->end_col, c->start_row, range)))
return;
for (l = range->cell_list; l; l = l->next){
Cell *cell = l->data;
......@@ -441,6 +446,8 @@ pick_next_cell_from_queue (Workbook *wb)
cell = wb->eval_queue->data;
wb->eval_queue = g_list_remove (wb->eval_queue, cell);
if (!(cell->flags & CELL_QUEUED_FOR_RECALC))
printf ("De-queued cell here\n");
cell->flags &= ~CELL_QUEUED_FOR_RECALC;
return cell;
}
......
......@@ -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 *shet, int col, int row);
GList *cell_get_dependencies (Sheet *sheet, int col, int row);
/*
* Returns a newly allocated list with Cells inside that
......
......@@ -112,8 +112,8 @@ gboolean
range_contains (Range *range, int col, int row)
{
if ((col >= range->start_col) &&
(col <= range->end_col) &&
(row >= range->start_row) &&
(col <= range->end_col) &&
(row <= range->end_row))
return TRUE;
......
......@@ -112,8 +112,8 @@ gboolean
range_contains (Range *range, int col, int row)
{
if ((col >= range->start_col) &&
(col <= range->end_col) &&
(row >= range->start_row) &&
(col <= range->end_col) &&
(row <= range->end_row))
return TRUE;
......
......@@ -1222,17 +1222,51 @@ wizard_input (GtkWidget *widget, Workbook *wb)
g_free (edittxt);
}
static void
deps_output (GtkWidget *widget, Workbook *wb)
{
Sheet *sheet = workbook_get_current_sheet (wb);
int col, row, dummy;
Cell *cell;
GList *list;
if (!sheet_selection_first_range(sheet, &dummy, &dummy,
&col, &row,
&dummy, &dummy)) {
gnumeric_notice(wb, GNOME_MESSAGE_BOX_ERROR,
_("Selection must be a single range"));
return;
}
printf ("The cells that depend on %s\n",
cell_name (col, row));
if (!(cell = sheet_cell_get (sheet, col, row))) {
printf ("must contain some data\n");
return;
}
list = cell_get_dependencies (sheet, col, row);
if (!list)
printf ("No dependencies\n");
while (list) {
Cell *cell = list->data;
list = g_list_next (list);
if (!cell) continue;
if (sheet != cell->sheet && cell->sheet)
printf ("%s", cell->sheet->name);
printf ("%s\n", cell_name (cell->col->pos,
cell->row->pos));
}
}
static void
workbook_setup_edit_area (Workbook *wb)
{
GtkWidget *ok_button, *cancel_button, *wizard_button, *box, *box2;
GtkWidget *pix;
GtkWidget *ok_button, *cancel_button, *wizard_button;
GtkWidget *pix, *deps_button, *box, *box2;
wb->ea_status = gtk_entry_new ();
wb->ea_input = gtk_entry_new ();
ok_button = gtk_button_new ();
cancel_button = gtk_button_new ();
wizard_button = gtk_button_new ();
box = gtk_hbox_new (0, 0);
box2 = gtk_hbox_new (0, 0);
......@@ -1252,19 +1286,33 @@ workbook_setup_edit_area (Workbook *wb)
gtk_signal_connect (GTK_OBJECT (cancel_button), "clicked",
GTK_SIGNAL_FUNC(cancel_input), wb);
gtk_box_pack_start (GTK_BOX (box2), wb->ea_status, 0, 0, 0);
gtk_box_pack_start (GTK_BOX (box), ok_button, 0, 0, 0);
gtk_box_pack_start (GTK_BOX (box), cancel_button, 0, 0, 0);
/* Function Wizard, currently only enabled if you run with --debug=1 */
if (gnumeric_debugging){
wizard_button = gtk_button_new ();
pix = gnome_stock_pixmap_widget_new (wb->toplevel, GNOME_STOCK_PIXMAP_BOOK_GREEN);
gtk_container_add (GTK_CONTAINER (wizard_button), pix);
GTK_WIDGET_UNSET_FLAGS (wizard_button, GTK_CAN_FOCUS);
gtk_signal_connect (GTK_OBJECT (wizard_button), "clicked",
GTK_SIGNAL_FUNC(wizard_input), wb);
gtk_box_pack_start (GTK_BOX (box), wizard_button, 0, 0, 0);
}
/* Dependency Debugger, currently only enabled if you run with --debug=10 */
if (gnumeric_debugging>9){
deps_button = gtk_button_new ();
pix = gnome_stock_pixmap_widget_new (wb->toplevel, GNOME_STOCK_PIXMAP_BOOK_RED);
gtk_container_add (GTK_CONTAINER (deps_button), pix);
GTK_WIDGET_UNSET_FLAGS (deps_button, GTK_CAN_FOCUS);
gtk_signal_connect (GTK_OBJECT (deps_button), "clicked",
GTK_SIGNAL_FUNC(deps_output), wb);
gtk_box_pack_start (GTK_BOX (box), deps_button, 0, 0, 0);
}
gtk_box_pack_start (GTK_BOX (box2), wb->ea_status, 0, 0, 0);
gtk_box_pack_start (GTK_BOX (box), ok_button, 0, 0, 0);
gtk_box_pack_start (GTK_BOX (box), cancel_button, 0, 0, 0);
gtk_box_pack_start (GTK_BOX (box), wizard_button, 0, 0, 0);
gtk_box_pack_start (GTK_BOX (box2), box, 0, 0, 0);
gtk_box_pack_end (GTK_BOX (box2), wb->ea_input, 1, 1, 0);
......
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