Commit 2779b474 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

A few delayed patches.

These optimize paste, exit, sheet deletetion,
and start the process for fixing a few things.

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

	* src/clipboard.c (clipboard_copy_cell_range) : Adjust signature to
	  take a range.
	(sheet_paste_selection) : Export in preparation for adding undo.

	* src/commands.c (cmd_paste_copy) : Some initial work.  Not used or
	  complete.

	* src/parse-util.c (parse_text_value_or_expr) : Start passing in the
	  current format so that we can eventually attempt to match it before
	  trying all the others.

	* src/sheet.c (sheet_formulas_unlink) : New function.
	(sheet_destroy_contents) : Optimize.

	* src/dialogs/dialog-plugin-manager.c : Make a bit prettier.
	* src/dialogs/plugin-manager.glade : Ditto.

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

	* plugins/*/*.c : Rationalize the naming scheme.

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

	* src/eval.[ch] : Rename
	  cell_queue_recalc      -> eval_queue_cell
	  cell_queue_recalc_list -> eval_queue_list
	  cell_unqueue_recalc    -> eval_unqueue_cell
	(eval_unqueue_sheet) : New function.

	* src/sheet.c (sheet_cell_remove_simple) : Add precautionary removal
	  of cells from recalc list.  We should not need this in most
	  instances, but the check is inexpensive so I'll play it safe.
	(sheet_destroy_contents) : Batch cleanups rather than doing it cell by
	  cell.

	* src/cell.c (cell_make_value) : Fill in the implementation.

	* src/clipboard.c (paste_cell_flags) : Remove some dead code.
	  Merged in paste_cell and fixed handling of paste by value.

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

	* src/clipboard.c (paste_cell) : No need to call cell_content_changed
	  we can queue the recalc for the entire region later.  It is
	  sufficent to make the cell as changed with sheet_cell_changed.
	(paste_cell) : It is premature to redraw, we have no yet calculated
	  spans.  Redraw and respan at the range level, not the cell.
parent e000ba73
2000-05-17 Jody Goldberg <jgoldberg@home.com>
* src/clipboard.c (clipboard_copy_cell_range) : Adjust signature to
take a range.
(sheet_paste_selection) : Export in preparation for adding undo.
* src/commands.c (cmd_paste_copy) : Some initial work. Not used or
complete.
* src/parse-util.c (parse_text_value_or_expr) : Start passing in the
current format so that we can eventually attempt to match it before
trying all the others.
* src/sheet.c (sheet_formulas_unlink) : New function.
(sheet_destroy_contents) : Optimize.
* src/dialogs/dialog-plugin-manager.c : Make a bit prettier.
* src/dialogs/plugin-manager.glade : Ditto.
2000-05-16 Jody Goldberg <jgoldberg@home.com>
* plugins/*/*.c : Rationalize the naming scheme.
2000-05-15 Jody Goldberg <jgoldberg@home.com>
* src/eval.[ch] : Rename
cell_queue_recalc -> eval_queue_cell
cell_queue_recalc_list -> eval_queue_list
cell_unqueue_recalc -> eval_unqueue_cell
(eval_unqueue_sheet) : New function.
* src/sheet.c (sheet_cell_remove_simple) : Add precautionary removal
of cells from recalc list. We should not need this in most
instances, but the check is inexpensive so I'll play it safe.
(sheet_destroy_contents) : Batch cleanups rather than doing it cell by
cell.
* src/cell.c (cell_make_value) : Fill in the implementation.
* src/clipboard.c (paste_cell_flags) : Remove some dead code.
Merged in paste_cell and fixed handling of paste by value.
2000-05-14 Jody Goldberg <jgoldberg@home.com>
* src/clipboard.c (paste_cell) : No need to call cell_content_changed
we can queue the recalc for the entire region later. It is
sufficent to make the cell as changed with sheet_cell_changed.
(paste_cell) : It is premature to redraw, we have no yet calculated
spans. Redraw and respan at the range level, not the cell.
2000-05-20 Jody Goldberg <jgoldberg@home.com>
* Release 0.54
......
2000-05-17 Jody Goldberg <jgoldberg@home.com>
* src/clipboard.c (clipboard_copy_cell_range) : Adjust signature to
take a range.
(sheet_paste_selection) : Export in preparation for adding undo.
* src/commands.c (cmd_paste_copy) : Some initial work. Not used or
complete.
* src/parse-util.c (parse_text_value_or_expr) : Start passing in the
current format so that we can eventually attempt to match it before
trying all the others.
* src/sheet.c (sheet_formulas_unlink) : New function.
(sheet_destroy_contents) : Optimize.
* src/dialogs/dialog-plugin-manager.c : Make a bit prettier.
* src/dialogs/plugin-manager.glade : Ditto.
2000-05-16 Jody Goldberg <jgoldberg@home.com>
* plugins/*/*.c : Rationalize the naming scheme.
2000-05-15 Jody Goldberg <jgoldberg@home.com>
* src/eval.[ch] : Rename
cell_queue_recalc -> eval_queue_cell
cell_queue_recalc_list -> eval_queue_list
cell_unqueue_recalc -> eval_unqueue_cell
(eval_unqueue_sheet) : New function.
* src/sheet.c (sheet_cell_remove_simple) : Add precautionary removal
of cells from recalc list. We should not need this in most
instances, but the check is inexpensive so I'll play it safe.
(sheet_destroy_contents) : Batch cleanups rather than doing it cell by
cell.
* src/cell.c (cell_make_value) : Fill in the implementation.
* src/clipboard.c (paste_cell_flags) : Remove some dead code.
Merged in paste_cell and fixed handling of paste by value.
2000-05-14 Jody Goldberg <jgoldberg@home.com>
* src/clipboard.c (paste_cell) : No need to call cell_content_changed
we can queue the recalc for the entire region later. It is
sufficent to make the cell as changed with sheet_cell_changed.
(paste_cell) : It is premature to redraw, we have no yet calculated
spans. Redraw and respan at the range level, not the cell.
2000-05-20 Jody Goldberg <jgoldberg@home.com>
* Release 0.54
......
2000-05-17 Jody Goldberg <jgoldberg@home.com>
* src/clipboard.c (clipboard_copy_cell_range) : Adjust signature to
take a range.
(sheet_paste_selection) : Export in preparation for adding undo.
* src/commands.c (cmd_paste_copy) : Some initial work. Not used or
complete.
* src/parse-util.c (parse_text_value_or_expr) : Start passing in the
current format so that we can eventually attempt to match it before
trying all the others.
* src/sheet.c (sheet_formulas_unlink) : New function.
(sheet_destroy_contents) : Optimize.
* src/dialogs/dialog-plugin-manager.c : Make a bit prettier.
* src/dialogs/plugin-manager.glade : Ditto.
2000-05-16 Jody Goldberg <jgoldberg@home.com>
* plugins/*/*.c : Rationalize the naming scheme.
2000-05-15 Jody Goldberg <jgoldberg@home.com>
* src/eval.[ch] : Rename
cell_queue_recalc -> eval_queue_cell
cell_queue_recalc_list -> eval_queue_list
cell_unqueue_recalc -> eval_unqueue_cell
(eval_unqueue_sheet) : New function.
* src/sheet.c (sheet_cell_remove_simple) : Add precautionary removal
of cells from recalc list. We should not need this in most
instances, but the check is inexpensive so I'll play it safe.
(sheet_destroy_contents) : Batch cleanups rather than doing it cell by
cell.
* src/cell.c (cell_make_value) : Fill in the implementation.
* src/clipboard.c (paste_cell_flags) : Remove some dead code.
Merged in paste_cell and fixed handling of paste by value.
2000-05-14 Jody Goldberg <jgoldberg@home.com>
* src/clipboard.c (paste_cell) : No need to call cell_content_changed
we can queue the recalc for the entire region later. It is
sufficent to make the cell as changed with sheet_cell_changed.
(paste_cell) : It is premature to redraw, we have no yet calculated
spans. Redraw and respan at the range level, not the cell.
2000-05-20 Jody Goldberg <jgoldberg@home.com>
* Release 0.54
......
2000-05-17 Jody Goldberg <jgoldberg@home.com>
* src/clipboard.c (clipboard_copy_cell_range) : Adjust signature to
take a range.
(sheet_paste_selection) : Export in preparation for adding undo.
* src/commands.c (cmd_paste_copy) : Some initial work. Not used or
complete.
* src/parse-util.c (parse_text_value_or_expr) : Start passing in the
current format so that we can eventually attempt to match it before
trying all the others.
* src/sheet.c (sheet_formulas_unlink) : New function.
(sheet_destroy_contents) : Optimize.
* src/dialogs/dialog-plugin-manager.c : Make a bit prettier.
* src/dialogs/plugin-manager.glade : Ditto.
2000-05-16 Jody Goldberg <jgoldberg@home.com>
* plugins/*/*.c : Rationalize the naming scheme.
2000-05-15 Jody Goldberg <jgoldberg@home.com>
* src/eval.[ch] : Rename
cell_queue_recalc -> eval_queue_cell
cell_queue_recalc_list -> eval_queue_list
cell_unqueue_recalc -> eval_unqueue_cell
(eval_unqueue_sheet) : New function.
* src/sheet.c (sheet_cell_remove_simple) : Add precautionary removal
of cells from recalc list. We should not need this in most
instances, but the check is inexpensive so I'll play it safe.
(sheet_destroy_contents) : Batch cleanups rather than doing it cell by
cell.
* src/cell.c (cell_make_value) : Fill in the implementation.
* src/clipboard.c (paste_cell_flags) : Remove some dead code.
Merged in paste_cell and fixed handling of paste by value.
2000-05-14 Jody Goldberg <jgoldberg@home.com>
* src/clipboard.c (paste_cell) : No need to call cell_content_changed
we can queue the recalc for the entire region later. It is
sufficent to make the cell as changed with sheet_cell_changed.
(paste_cell) : It is premature to redraw, we have no yet calculated
spans. Redraw and respan at the range level, not the cell.
2000-05-20 Jody Goldberg <jgoldberg@home.com>
* Release 0.54
......
2000-05-17 Jody Goldberg <jgoldberg@home.com>
* src/clipboard.c (clipboard_copy_cell_range) : Adjust signature to
take a range.
(sheet_paste_selection) : Export in preparation for adding undo.
* src/commands.c (cmd_paste_copy) : Some initial work. Not used or
complete.
* src/parse-util.c (parse_text_value_or_expr) : Start passing in the
current format so that we can eventually attempt to match it before
trying all the others.
* src/sheet.c (sheet_formulas_unlink) : New function.
(sheet_destroy_contents) : Optimize.
* src/dialogs/dialog-plugin-manager.c : Make a bit prettier.
* src/dialogs/plugin-manager.glade : Ditto.
2000-05-16 Jody Goldberg <jgoldberg@home.com>
* plugins/*/*.c : Rationalize the naming scheme.
2000-05-15 Jody Goldberg <jgoldberg@home.com>
* src/eval.[ch] : Rename
cell_queue_recalc -> eval_queue_cell
cell_queue_recalc_list -> eval_queue_list
cell_unqueue_recalc -> eval_unqueue_cell
(eval_unqueue_sheet) : New function.
* src/sheet.c (sheet_cell_remove_simple) : Add precautionary removal
of cells from recalc list. We should not need this in most
instances, but the check is inexpensive so I'll play it safe.
(sheet_destroy_contents) : Batch cleanups rather than doing it cell by
cell.
* src/cell.c (cell_make_value) : Fill in the implementation.
* src/clipboard.c (paste_cell_flags) : Remove some dead code.
Merged in paste_cell and fixed handling of paste by value.
2000-05-14 Jody Goldberg <jgoldberg@home.com>
* src/clipboard.c (paste_cell) : No need to call cell_content_changed
we can queue the recalc for the entire region later. It is
sufficent to make the cell as changed with sheet_cell_changed.
(paste_cell) : It is premature to redraw, we have no yet calculated
spans. Redraw and respan at the range level, not the cell.
2000-05-20 Jody Goldberg <jgoldberg@home.com>
* Release 0.54
......
2000-05-17 Jody Goldberg <jgoldberg@home.com>
* src/clipboard.c (clipboard_copy_cell_range) : Adjust signature to
take a range.
(sheet_paste_selection) : Export in preparation for adding undo.
* src/commands.c (cmd_paste_copy) : Some initial work. Not used or
complete.
* src/parse-util.c (parse_text_value_or_expr) : Start passing in the
current format so that we can eventually attempt to match it before
trying all the others.
* src/sheet.c (sheet_formulas_unlink) : New function.
(sheet_destroy_contents) : Optimize.
* src/dialogs/dialog-plugin-manager.c : Make a bit prettier.
* src/dialogs/plugin-manager.glade : Ditto.
2000-05-16 Jody Goldberg <jgoldberg@home.com>
* plugins/*/*.c : Rationalize the naming scheme.
2000-05-15 Jody Goldberg <jgoldberg@home.com>
* src/eval.[ch] : Rename
cell_queue_recalc -> eval_queue_cell
cell_queue_recalc_list -> eval_queue_list
cell_unqueue_recalc -> eval_unqueue_cell
(eval_unqueue_sheet) : New function.
* src/sheet.c (sheet_cell_remove_simple) : Add precautionary removal
of cells from recalc list. We should not need this in most
instances, but the check is inexpensive so I'll play it safe.
(sheet_destroy_contents) : Batch cleanups rather than doing it cell by
cell.
* src/cell.c (cell_make_value) : Fill in the implementation.
* src/clipboard.c (paste_cell_flags) : Remove some dead code.
Merged in paste_cell and fixed handling of paste by value.
2000-05-14 Jody Goldberg <jgoldberg@home.com>
* src/clipboard.c (paste_cell) : No need to call cell_content_changed
we can queue the recalc for the entire region later. It is
sufficent to make the cell as changed with sheet_cell_changed.
(paste_cell) : It is premature to redraw, we have no yet calculated
spans. Redraw and respan at the range level, not the cell.
2000-05-20 Jody Goldberg <jgoldberg@home.com>
* Release 0.54
......
2000-05-17 Jody Goldberg <jgoldberg@home.com>
* src/clipboard.c (clipboard_copy_cell_range) : Adjust signature to
take a range.
(sheet_paste_selection) : Export in preparation for adding undo.
* src/commands.c (cmd_paste_copy) : Some initial work. Not used or
complete.
* src/parse-util.c (parse_text_value_or_expr) : Start passing in the
current format so that we can eventually attempt to match it before
trying all the others.
* src/sheet.c (sheet_formulas_unlink) : New function.
(sheet_destroy_contents) : Optimize.
* src/dialogs/dialog-plugin-manager.c : Make a bit prettier.
* src/dialogs/plugin-manager.glade : Ditto.
2000-05-16 Jody Goldberg <jgoldberg@home.com>
* plugins/*/*.c : Rationalize the naming scheme.
2000-05-15 Jody Goldberg <jgoldberg@home.com>
* src/eval.[ch] : Rename
cell_queue_recalc -> eval_queue_cell
cell_queue_recalc_list -> eval_queue_list
cell_unqueue_recalc -> eval_unqueue_cell
(eval_unqueue_sheet) : New function.
* src/sheet.c (sheet_cell_remove_simple) : Add precautionary removal
of cells from recalc list. We should not need this in most
instances, but the check is inexpensive so I'll play it safe.
(sheet_destroy_contents) : Batch cleanups rather than doing it cell by
cell.
* src/cell.c (cell_make_value) : Fill in the implementation.
* src/clipboard.c (paste_cell_flags) : Remove some dead code.
Merged in paste_cell and fixed handling of paste by value.
2000-05-14 Jody Goldberg <jgoldberg@home.com>
* src/clipboard.c (paste_cell) : No need to call cell_content_changed
we can queue the recalc for the entire region later. It is
sufficent to make the cell as changed with sheet_cell_changed.
(paste_cell) : It is premature to redraw, we have no yet calculated
spans. Redraw and respan at the range level, not the cell.
2000-05-20 Jody Goldberg <jgoldberg@home.com>
* Release 0.54
......
......@@ -3,18 +3,11 @@ appropriate for new developers.
Description Difficulty Integration
------------------------------------------------------ ---------- -----------
- Ability to Create a new sheet that is a copy Medium Medium
- Ability to Create a new sheet that is a copy Low Low
of an existing sheet.
- Financial functions (src/functions/fn-financial.c) Medium Very low
- Thoroughly check for division-by-zero and other Low Low
arithmetic problems in functions, mostly financial.
- Add tests for all kinds of error conditions for Low Low
functions to samples/regress.gnumeric so we can be
sure that we are returning the right error code.
- Save/Restore the values of the last selected colours Low Low
from the toolbar for background or font.
......@@ -25,10 +18,6 @@ Description Difficulty Integration
- Have the pattern buttons in the format dialog Medium Low
reflect colour changes.
- Add MS excel like format->autoformat. A dialog Low Low
that will display some canned styles and apply them
to the selection.
- Audit the help text for all the functions. Some are Low Low
missing or do not conform to the style guides,
......
......@@ -146,9 +146,7 @@ application_clipboard_copy (Sheet *sheet, Range const *area)
if (application_set_selected_sheet (sheet) ) {
app.clipboard_cut_range = *area;
app.clipboard_copied_contents =
clipboard_copy_cell_range (sheet,
area->start.col, area->start.row,
area->end.col, area->end.row);
clipboard_copy_cell_range (sheet, area);
workbook_view_set_paste_special_state (sheet->workbook, TRUE);
......
......@@ -45,7 +45,7 @@ cell_formula_changed (Cell *cell, gboolean queue_recalc)
{
sheet_cell_formula_link (cell);
if (queue_recalc)
cell_queue_recalc (cell);
eval_queue_cell (cell);
}
/**
......@@ -173,22 +173,24 @@ cell_content_changed (Cell *cell)
/* Queue all of the dependencies for this cell */
deps = cell_get_dependencies (cell);
if (deps)
cell_queue_recalc_list (deps, TRUE);
eval_queue_list (deps, TRUE);
sheet_cell_changed (cell);
}
/*
* cell_relocate:
* @cell: The cell that is changing position
* @check_bonunds : Should expressions be bounds checked.
* @cell : The cell that is changing position
* @check_bounds : Should expressions be bounds checked.
* @unlink : Does the cell need to be unlinked from the
* expression list.
*
* This routine is used to move a cell to a different location:
*
* Auxiliary items canvas items attached to the cell are moved.
*/
void
cell_relocate (Cell *cell, gboolean check_bounds)
cell_relocate (Cell *cell, gboolean check_bounds, gboolean unlink)
{
g_return_if_fail (cell != NULL);
......@@ -197,7 +199,8 @@ cell_relocate (Cell *cell, gboolean check_bounds)
/* 2. If the cell contains a formula, relocate the formula */
if (cell_has_expr (cell)) {
sheet_cell_formula_unlink (cell);
if (unlink)
sheet_cell_formula_unlink (cell);
/*
* WARNING WARNING WARNING
......@@ -254,8 +257,6 @@ cell_relocate (Cell *cell, gboolean check_bounds)
/* 3. Move any auxiliary canvas items */
if (cell->comment)
cell_comment_reposition (cell);
cell_content_changed (cell);
}
/****************************************************************************/
......@@ -287,7 +288,8 @@ cell_set_text (Cell *cell, char const *text)
g_return_if_fail (!cell_is_partial_array (cell));
format = parse_text_value_or_expr (eval_pos_init_cell (&pos, cell),
text, &val, &expr);
text, &val, &expr,
NULL /* TODO : Use assigned format ? */);
if (val != NULL) { /* String was a value */
/* If there was a prefered format remember it */
......@@ -301,7 +303,6 @@ cell_set_text (Cell *cell, char const *text)
cell->u.entered_text = string_get (text);
cell->format = fmt;
cell_render_value (cell);
cell_content_changed (cell);
} else { /* String was an expression */
cell_set_expr (cell, expr, format);
expr_tree_unref (expr);
......@@ -746,8 +747,19 @@ cell_set_format (Cell *cell, char const *format)
cell_dirty (cell);
}
/*
* This routine drops the formula and just keeps the value
/**
* cell_make_value : drops the expression keeps its value. Then uses the formatted
* result as if that had been entered.
*
* NOTE : the cell's expression can not be linked into the expression * list.
*
* The cell is rendered but spans are not calculated, the cell is NOT marked for
* recalc.
*
* WARNING : This is an internal routine that does not queue redraws,
* does not auto-resize, and does not calculate spans.
*
* NOTE : This DOES NOT check for array partitioning.
*/
void
cell_make_value (Cell *cell)
......@@ -755,7 +767,15 @@ cell_make_value (Cell *cell)
g_return_if_fail (cell != NULL);
g_return_if_fail (cell_has_expr(cell));
/* FIXME: does this work at all? -- MW */
/* THIS IS CRAP fix soon */
expr_tree_unref (cell->u.expression);
cell->u.expression = NULL;
cell->cell_flags &= ~CELL_HAS_EXPRESSION;
if (cell->rendered_value == NULL)
cell_render_value (cell);
g_return_if_fail (cell->rendered_value != NULL);
cell->u.entered_text = string_ref (cell->rendered_value->rendered_text);
cell_dirty (cell);
}
......@@ -46,7 +46,9 @@ struct _Cell {
Cell *cell_copy (Cell const *cell);
void cell_destroy (Cell *cell);
void cell_content_changed (Cell *cell);
void cell_relocate (Cell *cell, gboolean check_bounds);
void cell_relocate (Cell *cell,
gboolean check_bounds,
gboolean unlink);
/**
* Cell state checking
......
......@@ -40,102 +40,55 @@
*
* Passed through the workbook structure.
*/
typedef struct {
struct _PasteTarget {
Sheet *dest_sheet;
CellRegion *region;
int dest_col, dest_row;
int paste_flags;
} clipboard_paste_closure_t;
};
/**
* paste_cell:
* paste_cell_flags: Pastes a cell in the spreadsheet
*
* @dest_sheet: The sheet where the pasting will be done
* @new_cell: The cell to paste.
* @new_cell: A new cell (not linked into the sheet, or wb->expr_list)
* @target_col: Column to put the cell into
* @target_row: Row to put the cell into.
* @paste_flags: Bit mask that describes the paste options.
*
* Pastes a cell in the spreadsheet
*/
static void
paste_cell (Sheet *dest_sheet, Cell *new_cell,
int target_col, int target_row,
int paste_flags)
paste_cell_flags (Sheet *dest_sheet, int target_col, int target_row,
CellCopy *c_copy, int paste_flags)
{
g_return_if_fail (target_col < SHEET_MAX_COLS);
g_return_if_fail (target_row < SHEET_MAX_ROWS);
if (!(paste_flags & PASTE_FORMULAS)) {
if (cell_has_expr (new_cell)) {
/*
* NOTE : the new_cell must not be linked into the
* sheet at this point
*/
expr_tree_unref (new_cell->u.expression);
new_cell->u.expression = NULL;
new_cell->cell_flags &= ~CELL_HAS_EXPRESSION;
}
}
if ((paste_flags & (PASTE_FORMULAS | PASTE_VALUES))){
if (c_copy->type == CELL_COPY_TYPE_CELL) {
Cell *new_cell = cell_copy (c_copy->u.cell);
if (cell_has_expr (new_cell)) {
if (paste_flags & PASTE_FORMULAS) {
/* Cell can not be linked in yet, but it needs an accurate location */
new_cell->sheet = dest_sheet;
new_cell->col_info = sheet_col_fetch (dest_sheet, target_col);
new_cell->row_info = sheet_row_fetch (dest_sheet, target_row);
cell_relocate (new_cell, TRUE);
cell_content_changed (new_cell);
} else
cell_make_value (new_cell);
}
if (new_cell->value)
cell_render_value (new_cell);
/* Once we have set the content then insert */
sheet_cell_insert (dest_sheet, new_cell, target_col, target_row);
sheet_redraw_cell_region (dest_sheet,
target_col, target_row,
target_col, target_row);
}
static void
paste_cell_flags (Sheet *dest_sheet, int target_col, int target_row,
CellCopy *c_copy, int paste_flags)
{
if (!(paste_flags & (PASTE_FORMULAS | PASTE_VALUES))){
Range r;
r.start.col = target_col;
r.start.row = target_row;
r.end.col = target_col;
r.end.row = target_row;
} else {
Cell *new_cell;
if (c_copy->type == CELL_COPY_TYPE_CELL) {
Range r;
new_cell = cell_copy (c_copy->u.cell);
r.start.col = target_col;
r.start.row = target_row;
r.end.col = target_col;
r.end.row = target_row;
if (cell_has_expr (new_cell)) {
if (paste_flags & PASTE_FORMULAS) {
cell_relocate (new_cell, TRUE, FALSE);
/* FIXME : do this at a range level too */
sheet_cell_changed (new_cell);
} else
cell_make_value (new_cell);
} else {
g_return_if_fail (new_cell->value != NULL);
cell_render_value (new_cell);
}
paste_cell (dest_sheet, new_cell,
target_col, target_row, paste_flags);
sheet_cell_insert (dest_sheet, new_cell, target_col, target_row);
} else {
new_cell = sheet_cell_new (dest_sheet,
target_col, target_row);
if (c_copy->u.text) {
Cell *new_cell = sheet_cell_new (dest_sheet,
target_col, target_row);
if (c_copy->u.text)
sheet_cell_set_text (new_cell, c_copy->u.text);
}
if (c_copy->type == CELL_COPY_TYPE_TEXT_AND_COMMENT && c_copy->comment)
cell_set_comment (new_cell, c_copy->comment);
......@@ -220,7 +173,7 @@ do_clipboard_paste_cell_region (CommandContext *context,
dest_row + paste_height - 1);
if (deps)
cell_queue_recalc_list (deps, TRUE);
eval_queue_list (deps, TRUE);
}
static CellRegion *
......@@ -230,16 +183,16 @@ x_selection_to_cell_region (CommandContext *context, char const * data,
DialogStfResult_t *dialogresult;
CellRegion *cr = NULL;
CellRegion *crerr;
crerr = g_new (CellRegion, 1);
crerr->list = NULL;
crerr->cols = -1;
crerr->rows = 0;
crerr->styles = NULL;
if (!stf_parse_convert_to_unix (data)) {
g_free ( (char*) data);
g_free ( (char*) data);
g_warning (_("Error while trying to pre-convert clipboard data"));
return crerr;
}
......@@ -256,9 +209,9 @@ x_selection_to_cell_region (CommandContext *context, char const * data,
if (dialogresult != NULL) {
GSList *iterator;
int col, rowcount;
cr = stf_parse_region (dialogresult->parseoptions, dialogresult->newstart);
if (cr == NULL) {
g_free ( (char*) data);
......@@ -280,12 +233,12 @@ x_selection_to_cell_region (CommandContext *context, char const * data,
range.start.row = 0;
range.end.col = col;
range.end.row = rowcount;
region->style = style;
region->range = range;
cr->styles = g_list_prepend (cr->styles, region);
iterator = g_slist_next (iterator);
col++;
......@@ -294,23 +247,19 @@ x_selection_to_cell_region (CommandContext *context, char const * data,
stf_dialog_result_free (dialogresult);
}
else {
return crerr;
}
g_free (crerr);
return cr;
}
/**
* sheet_paste_selection:
*
*/
static void
void
sheet_paste_selection (CommandContext *context, Sheet *sheet,
CellRegion *content, SheetSelection *ss,
clipboard_paste_closure_t *pc)
CellRegion *content, Range const *r,
PasteTarget *pt)
{
int paste_height, paste_width;
int end_col, end_row;
......@@ -318,48 +267,46 @@ sheet_paste_selection (CommandContext *context, Sheet *sheet,
/* If 'cols' is set to -1 then there is _nothing_ to paste */
if (content->cols == -1)
return;
/* Compute the bigger bounding box (selection u clipboard-region) */
if (ss->user.end.col - ss->user.start.col + 1 > content->cols)
paste_width = ss->user.end.col - ss->user.start.col + 1;
else
paste_width = r->end.col - r->start.col + 1;