Commit 531175c3 authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder

Patch for 161909:

2005-01-03  Morten Welinder  <terra@gnome.org>

        Patch for 161909:

        * src/sheet.c (sheet_cell_remove): Add new arg to control whether
        to flag dependencies.  All callers changed.
        (cb_empty_cell): Take whole flags argument.

        * src/clipboard.c (clipboard_paste_region): Handle new flag
        PASTE_NO_RECALC to help sorting speed.

        * src/sort.c (sort_contents): Paste using PASTE_NO_RECALC and
        handle dependencies ourselves.  Don't qsort if we have less than
        two elements.
parent c549634e
2005-01-03 Morten Welinder <terra@gnome.org>
Patch for 161909:
* src/sheet.c (sheet_cell_remove): Add new arg to control whether
to flag dependencies. All callers changed.
(cb_empty_cell): Take whole flags argument.
* src/clipboard.c (clipboard_paste_region): Handle new flag
PASTE_NO_RECALC to help sorting speed.
* src/sort.c (sort_contents): Paste using PASTE_NO_RECALC and
handle dependencies ourselves. Don't qsort if we have less than
two elements.
2004-12-29 Morten Welinder <terra@gnome.org>
* src/format.c (format_month_before_day): Add Win32 version.
......
......@@ -35,6 +35,8 @@ Morten:
* Fix deleting more than one character at once from a rich text
string.
* Fix rich text problem when starting from empty. [#161723].
* Vastly improve sorting speed for large ranges with formulas.
[#161909]
--------------------------------------------------------------------------
Gnumeric 1.4.1
......
2005-01-03 Morten Welinder <terra@gnome.org>
Patch for 161909:
* src/sheet.c (sheet_cell_remove): Add new arg to control whether
to flag dependencies. All callers changed.
(cb_empty_cell): Take whole flags argument.
* src/clipboard.c (clipboard_paste_region): Handle new flag
PASTE_NO_RECALC to help sorting speed.
* src/sort.c (sort_contents): Paste using PASTE_NO_RECALC and
handle dependencies ourselves. Don't qsort if we have less than
two elements.
2004-12-29 Morten Welinder <terra@gnome.org>
* src/format.c (format_month_before_day): Add Win32 version.
......
......@@ -458,6 +458,7 @@ clipboard_paste_region (GnmCellRegion const *content,
paste_object (pt, ptr->data, left, top);
}
if (!(pt->paste_flags & PASTE_NO_RECALC)) {
if (has_content) {
sheet_region_queue_recalc (pt->sheet, r);
sheet_flag_status_update_range (pt->sheet, r);
......@@ -469,6 +470,7 @@ clipboard_paste_region (GnmCellRegion const *content,
if (pt->paste_flags & PASTE_UPDATE_ROW_HEIGHT)
rows_height_update (pt->sheet, &pt->range, FALSE);
sheet_redraw_all (pt->sheet, FALSE);
}
return FALSE;
}
......
......@@ -35,7 +35,10 @@ enum {
/* Update the row height when pasting? (for large fonts, etc.) */
PASTE_UPDATE_ROW_HEIGHT = 1 << 14,
PASTE_EXPR_LOCAL_RELOCATE = 1 << 15
PASTE_EXPR_LOCAL_RELOCATE = 1 << 15,
/* Avoid flagging dependencies. */
PASTE_NO_RECALC = 1 << 16
};
#define PASTE_ALL_TYPES (PASTE_CONTENT | PASTE_FORMATS | PASTE_COMMENTS | PASTE_OBJECTS)
......
......@@ -805,7 +805,7 @@ sheet_autofill_dir (Sheet *sheet, gboolean singleton_increment,
loops * group_count + sub_index,
limit_x, limit_y);
} else if (cell != NULL)
sheet_cell_remove (sheet, cell, TRUE);
sheet_cell_remove (sheet, cell, TRUE, TRUE);
mstyle_ref (fi->style); /* style_set steals ref */
sheet_style_set_pos (sheet, col, row, fi->style);
......
......@@ -2543,10 +2543,12 @@ sheet_cell_destroy (Sheet *sheet, GnmCell *cell, gboolean queue_recalc)
/**
* sheet_cell_remove : Remove the cell from the web of depenancies of a
* sheet. Do NOT free the cell, optionally redraw it.
* sheet. Do NOT free the cell, optionally redraw it, optionally
* queue it for recalc.
*/
void
sheet_cell_remove (Sheet *sheet, GnmCell *cell, gboolean redraw)
sheet_cell_remove (Sheet *sheet, GnmCell *cell,
gboolean redraw, gboolean queue_recalc)
{
g_return_if_fail (cell != NULL);
g_return_if_fail (IS_SHEET (sheet));
......@@ -2559,8 +2561,7 @@ sheet_cell_remove (Sheet *sheet, GnmCell *cell, gboolean redraw)
sheet_flag_status_update_cell (cell);
}
sheet_cell_destroy (sheet, cell,
sheet->workbook->recursive_dirty_enabled);
sheet_cell_destroy (sheet, cell, queue_recalc);
}
static GnmValue *
......@@ -2817,8 +2818,9 @@ sheet_destroy (Sheet *sheet)
* this cell and can now continue.
*/
static GnmValue *
cb_empty_cell (Sheet *sheet, int col, int row, GnmCell *cell, gpointer flag)
cb_empty_cell (Sheet *sheet, int col, int row, GnmCell *cell, gpointer flags)
{
int clear_flags = GPOINTER_TO_INT (flags);
#if 0
/* TODO : here and other places flag a need to update the
* row/col maxima.
......@@ -2826,7 +2828,10 @@ cb_empty_cell (Sheet *sheet, int col, int row, GnmCell *cell, gpointer flag)
if (row >= sheet->rows.max_used || col >= sheet->cols.max_used) { }
#endif
sheet_cell_remove (sheet, cell, FALSE /* no redraw */);
sheet_cell_remove (sheet, cell, FALSE,
(clear_flags & CLEAR_RECALC_DEPS) &&
sheet->workbook->recursive_dirty_enabled);
return NULL;
}
......@@ -2887,7 +2892,7 @@ sheet_clear_region (Sheet *sheet,
*/
sheet_foreach_cell_in_range (sheet, CELL_ITER_IGNORE_NONEXISTENT,
start_col, start_row, end_col, end_row,
&cb_empty_cell, GINT_TO_POINTER (!(clear_flags & CLEAR_COMMENTS)));
&cb_empty_cell, GINT_TO_POINTER (clear_flags));
if (!(clear_flags & CLEAR_NORESPAN)) {
sheet_queue_respan (sheet, start_row, end_row);
......
......@@ -103,7 +103,8 @@ void sheet_set_visibility (Sheet *sheet, gboolean visible);
GnmCell *sheet_cell_get (Sheet const *sheet, int col, int row);
GnmCell *sheet_cell_fetch (Sheet *sheet, int col, int row);
GnmCell *sheet_cell_new (Sheet *sheet, int col, int row);
void sheet_cell_remove (Sheet *sheet, GnmCell *cell, gboolean redraw);
void sheet_cell_remove (Sheet *sheet, GnmCell *cell,
gboolean redraw, gboolean queue_recalc);
GnmValue *sheet_foreach_cell_in_range (Sheet *sheet, CellIterFlags flags,
int start_col, int start_row,
int end_col, int end_row,
......
......@@ -179,7 +179,7 @@ sort_permute (GnmSortData *data, int const *perm, int length,
GnmPasteTarget pt;
pt.sheet = data->sheet;
pt.paste_flags = PASTE_CONTENT | PASTE_COMMENTS;
pt.paste_flags = PASTE_CONTENT | PASTE_COMMENTS | PASTE_NO_RECALC;
if (!data->retain_formats)
pt.paste_flags = pt.paste_flags | PASTE_FORMATS;
......@@ -290,6 +290,7 @@ sort_contents (GnmSortData *data, GnmCmdContext *cc)
}
}
if (real_length > 1)
qsort (perm, real_length, sizeof (SortDataPerm), sort_qsort_compare);
cur = 0;
......@@ -307,5 +308,12 @@ sort_contents (GnmSortData *data, GnmCmdContext *cc)
sort_permute (data, iperm, length, cc);
/* Make up for the PASTE_NO_RECALC. */
sheet_region_queue_recalc (data->sheet, data->range);
sheet_flag_status_update_range (data->sheet, data->range);
sheet_range_calc_spans (data->sheet, data->range,
data->retain_formats ? SPANCALC_RENDER : SPANCALC_RE_RENDER);
sheet_redraw_all (data->sheet, FALSE);
return iperm;
}
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