Commit 56a9e1f0 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg
Browse files

Improve status update.

Simplify a few command paths in preparation for registration.
Hopefully fix bug 3961

2000-04-04  Jody Goldberg <jgoldberg@home.com>

	* src/workbook.c (workbook_class_init) : Remove CELL_CHANGED.
	(workbook_finish_editing) : At LAST! cmd_set_text is responsible for
	  setting the text directly :-)

	* src/workbook-format-toolbar.c (change_font_size_in_selection_cmd) :
	  cmd_format takes care of the height adjustments.
	* src/dialogs/dialog-cell-format.c (cb_fmt_dialog_dialog_apply) : Ditto.

	* src/sheet.c (Sheet): Add flags edit_pos_changed, selection_content_changed.
	(sheet_new) : init them.
	(sheet_flag_status_update_cell) : New function that sets the flags.
	(sheet_flag_status_update_range) : Ditto.
	(sheet_update) : Fix typo. Add support for new flags.
	(sheet_update_auto_expr) : Const correctness.
	(sheet_update_controls) : Ditto.
	(sheet_load_cell_val) : Ditto. Delete unused signal.
	(sheet_set_text) : Use sheet_flag_status_update_range.
	(sheet_set_edit_pos) : New routine.
	(sheet_cursor_move) : Delete.
	(sheet_fill_selection_with) : Remove.

	* src/selection.c (sheet_selection_changed_hook) : const correctness.
	(sheet_selection_change) : merge into sheet_selection_set.
	(sheet_selection_extend_to) : Use sheet_selection_set.
	(sheet_selection_set) : Merge with sheet_selection_change and use the
	  sheet_cursor accessors rather than changing things directly.
	(sheet_selection_walk_step) : Use sheet_selection_set, and sheet_set_edit_pos.

	(sheet_is_all_selected) : const correctness.
	(sheet_is_cell_selected) : New routine.
	(sheet_is_range_selected) : New routine.

	* src/item-grid.c (item_grid_draw_background) : Adjust to rename of
	* sheet_selection_is_cell_selected -> sheet_is_cell_selected.

	* src/gnumeric-sheet.c (gnumeric_sheet_key_mode_sheet) : Cleanup the
	  logic for creating fills and arrays so that it can have undo
	  support.
	  - Change the heuristic for selecting what type of characters can start
	    an edit session.  Rather than using fixed Latin1 centric codes,
	    guess that the 'length' field of the event is >0 if the character is
	    printable.  Be more careful NOT to forward characters to the entry
	    if we are not editing.
	  - Use sheet_update.

	* src/commands.c (command_pop_list_top) : Delete.
	(cmd_format_redo) : Apply the height adjustment here.
	(cmd_set_area_*) : Implement.
	(*) : Use sheet_update.

	* src/colrow.c (rows_height_update) : Moved here and generalized from
	  sheet_selection_height_update.

	* src/clipboard.c (sheet_paste_selection) : No need to call
	  sheet_cursor_set.  sheet_selection_add_range already does that.
	(clipboard_paste_region) : Flag updates to the status display if
	  something changes.
parent affafc8a
......@@ -4,6 +4,7 @@ and longer term bugs.
Release Critical
----------------
- Morten has identified a major leak in the style code.
Long term breakage
------------------
......
2000-04-04 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (workbook_class_init) : Remove CELL_CHANGED.
(workbook_finish_editing) : At LAST! cmd_set_text is responsible for
setting the text directly :-)
* src/workbook-format-toolbar.c (change_font_size_in_selection_cmd) :
cmd_format takes care of the height adjustments.
* src/dialogs/dialog-cell-format.c (cb_fmt_dialog_dialog_apply) : Ditto.
* src/sheet.c (Sheet): Add flags edit_pos_changed, selection_content_changed.
(sheet_new) : init them.
(sheet_flag_status_update_cell) : New function that sets the flags.
(sheet_flag_status_update_range) : Ditto.
(sheet_update) : Fix typo. Add support for new flags.
(sheet_update_auto_expr) : Const correctness.
(sheet_update_controls) : Ditto.
(sheet_load_cell_val) : Ditto. Delete unused signal.
(sheet_set_text) : Use sheet_flag_status_update_range.
(sheet_set_edit_pos) : New routine.
(sheet_cursor_move) : Delete.
(sheet_fill_selection_with) : Remove.
* src/selection.c (sheet_selection_changed_hook) : const correctness.
(sheet_selection_change) : merge into sheet_selection_set.
(sheet_selection_extend_to) : Use sheet_selection_set.
(sheet_selection_set) : Merge with sheet_selection_change and use the
sheet_cursor accessors rather than changing things directly.
(sheet_selection_walk_step) : Use sheet_selection_set, and sheet_set_edit_pos.
(sheet_is_all_selected) : const correctness.
(sheet_is_cell_selected) : New routine.
(sheet_is_range_selected) : New routine.
* src/item-grid.c (item_grid_draw_background) : Adjust to rename of
* sheet_selection_is_cell_selected -> sheet_is_cell_selected.
* src/gnumeric-sheet.c (gnumeric_sheet_key_mode_sheet) : Cleanup the
logic for creating fills and arrays so that it can have undo
support.
- Change the heuristic for selecting what type of characters can start
an edit session. Rather than using fixed Latin1 centric codes,
guess that the 'length' field of the event is >0 if the character is
printable. Be more careful NOT to forward characters to the entry
if we are not editing.
- Use sheet_update.
* src/commands.c (command_pop_list_top) : Delete.
(cmd_format_redo) : Apply the height adjustment here.
(cmd_set_area_*) : Implement.
(*) : Use sheet_update.
* src/colrow.c (rows_height_update) : Moved here and generalized from
sheet_selection_height_update.
* src/clipboard.c (sheet_paste_selection) : No need to call
sheet_cursor_set. sheet_selection_add_range already does that.
(clipboard_paste_region) : Flag updates to the status display if
something changes.
2000-04-04 Jon K Hellan <hellan@acm.org>
* src/sheet-view.c (sheet_view_set_zoom_factor): Call
......
2000-04-04 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (workbook_class_init) : Remove CELL_CHANGED.
(workbook_finish_editing) : At LAST! cmd_set_text is responsible for
setting the text directly :-)
* src/workbook-format-toolbar.c (change_font_size_in_selection_cmd) :
cmd_format takes care of the height adjustments.
* src/dialogs/dialog-cell-format.c (cb_fmt_dialog_dialog_apply) : Ditto.
* src/sheet.c (Sheet): Add flags edit_pos_changed, selection_content_changed.
(sheet_new) : init them.
(sheet_flag_status_update_cell) : New function that sets the flags.
(sheet_flag_status_update_range) : Ditto.
(sheet_update) : Fix typo. Add support for new flags.
(sheet_update_auto_expr) : Const correctness.
(sheet_update_controls) : Ditto.
(sheet_load_cell_val) : Ditto. Delete unused signal.
(sheet_set_text) : Use sheet_flag_status_update_range.
(sheet_set_edit_pos) : New routine.
(sheet_cursor_move) : Delete.
(sheet_fill_selection_with) : Remove.
* src/selection.c (sheet_selection_changed_hook) : const correctness.
(sheet_selection_change) : merge into sheet_selection_set.
(sheet_selection_extend_to) : Use sheet_selection_set.
(sheet_selection_set) : Merge with sheet_selection_change and use the
sheet_cursor accessors rather than changing things directly.
(sheet_selection_walk_step) : Use sheet_selection_set, and sheet_set_edit_pos.
(sheet_is_all_selected) : const correctness.
(sheet_is_cell_selected) : New routine.
(sheet_is_range_selected) : New routine.
* src/item-grid.c (item_grid_draw_background) : Adjust to rename of
* sheet_selection_is_cell_selected -> sheet_is_cell_selected.
* src/gnumeric-sheet.c (gnumeric_sheet_key_mode_sheet) : Cleanup the
logic for creating fills and arrays so that it can have undo
support.
- Change the heuristic for selecting what type of characters can start
an edit session. Rather than using fixed Latin1 centric codes,
guess that the 'length' field of the event is >0 if the character is
printable. Be more careful NOT to forward characters to the entry
if we are not editing.
- Use sheet_update.
* src/commands.c (command_pop_list_top) : Delete.
(cmd_format_redo) : Apply the height adjustment here.
(cmd_set_area_*) : Implement.
(*) : Use sheet_update.
* src/colrow.c (rows_height_update) : Moved here and generalized from
sheet_selection_height_update.
* src/clipboard.c (sheet_paste_selection) : No need to call
sheet_cursor_set. sheet_selection_add_range already does that.
(clipboard_paste_region) : Flag updates to the status display if
something changes.
2000-04-04 Jon K Hellan <hellan@acm.org>
* src/sheet-view.c (sheet_view_set_zoom_factor): Call
......
......@@ -4,8 +4,10 @@ Jon:
* Tearoff combo boxes
Jody:
* Improve doc generation.
* Bugs fixes.
* Improve doc generation.
* Update the status area (autoexpr, editor, format tools) when things
* change.
* Rework canvas editor to behave nicely at boundaries and
span correctly.
......
2000-04-04 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (workbook_class_init) : Remove CELL_CHANGED.
(workbook_finish_editing) : At LAST! cmd_set_text is responsible for
setting the text directly :-)
* src/workbook-format-toolbar.c (change_font_size_in_selection_cmd) :
cmd_format takes care of the height adjustments.
* src/dialogs/dialog-cell-format.c (cb_fmt_dialog_dialog_apply) : Ditto.
* src/sheet.c (Sheet): Add flags edit_pos_changed, selection_content_changed.
(sheet_new) : init them.
(sheet_flag_status_update_cell) : New function that sets the flags.
(sheet_flag_status_update_range) : Ditto.
(sheet_update) : Fix typo. Add support for new flags.
(sheet_update_auto_expr) : Const correctness.
(sheet_update_controls) : Ditto.
(sheet_load_cell_val) : Ditto. Delete unused signal.
(sheet_set_text) : Use sheet_flag_status_update_range.
(sheet_set_edit_pos) : New routine.
(sheet_cursor_move) : Delete.
(sheet_fill_selection_with) : Remove.
* src/selection.c (sheet_selection_changed_hook) : const correctness.
(sheet_selection_change) : merge into sheet_selection_set.
(sheet_selection_extend_to) : Use sheet_selection_set.
(sheet_selection_set) : Merge with sheet_selection_change and use the
sheet_cursor accessors rather than changing things directly.
(sheet_selection_walk_step) : Use sheet_selection_set, and sheet_set_edit_pos.
(sheet_is_all_selected) : const correctness.
(sheet_is_cell_selected) : New routine.
(sheet_is_range_selected) : New routine.
* src/item-grid.c (item_grid_draw_background) : Adjust to rename of
* sheet_selection_is_cell_selected -> sheet_is_cell_selected.
* src/gnumeric-sheet.c (gnumeric_sheet_key_mode_sheet) : Cleanup the
logic for creating fills and arrays so that it can have undo
support.
- Change the heuristic for selecting what type of characters can start
an edit session. Rather than using fixed Latin1 centric codes,
guess that the 'length' field of the event is >0 if the character is
printable. Be more careful NOT to forward characters to the entry
if we are not editing.
- Use sheet_update.
* src/commands.c (command_pop_list_top) : Delete.
(cmd_format_redo) : Apply the height adjustment here.
(cmd_set_area_*) : Implement.
(*) : Use sheet_update.
* src/colrow.c (rows_height_update) : Moved here and generalized from
sheet_selection_height_update.
* src/clipboard.c (sheet_paste_selection) : No need to call
sheet_cursor_set. sheet_selection_add_range already does that.
(clipboard_paste_region) : Flag updates to the status display if
something changes.
2000-04-04 Jon K Hellan <hellan@acm.org>
* src/sheet-view.c (sheet_view_set_zoom_factor): Call
......
2000-04-04 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (workbook_class_init) : Remove CELL_CHANGED.
(workbook_finish_editing) : At LAST! cmd_set_text is responsible for
setting the text directly :-)
* src/workbook-format-toolbar.c (change_font_size_in_selection_cmd) :
cmd_format takes care of the height adjustments.
* src/dialogs/dialog-cell-format.c (cb_fmt_dialog_dialog_apply) : Ditto.
* src/sheet.c (Sheet): Add flags edit_pos_changed, selection_content_changed.
(sheet_new) : init them.
(sheet_flag_status_update_cell) : New function that sets the flags.
(sheet_flag_status_update_range) : Ditto.
(sheet_update) : Fix typo. Add support for new flags.
(sheet_update_auto_expr) : Const correctness.
(sheet_update_controls) : Ditto.
(sheet_load_cell_val) : Ditto. Delete unused signal.
(sheet_set_text) : Use sheet_flag_status_update_range.
(sheet_set_edit_pos) : New routine.
(sheet_cursor_move) : Delete.
(sheet_fill_selection_with) : Remove.
* src/selection.c (sheet_selection_changed_hook) : const correctness.
(sheet_selection_change) : merge into sheet_selection_set.
(sheet_selection_extend_to) : Use sheet_selection_set.
(sheet_selection_set) : Merge with sheet_selection_change and use the
sheet_cursor accessors rather than changing things directly.
(sheet_selection_walk_step) : Use sheet_selection_set, and sheet_set_edit_pos.
(sheet_is_all_selected) : const correctness.
(sheet_is_cell_selected) : New routine.
(sheet_is_range_selected) : New routine.
* src/item-grid.c (item_grid_draw_background) : Adjust to rename of
* sheet_selection_is_cell_selected -> sheet_is_cell_selected.
* src/gnumeric-sheet.c (gnumeric_sheet_key_mode_sheet) : Cleanup the
logic for creating fills and arrays so that it can have undo
support.
- Change the heuristic for selecting what type of characters can start
an edit session. Rather than using fixed Latin1 centric codes,
guess that the 'length' field of the event is >0 if the character is
printable. Be more careful NOT to forward characters to the entry
if we are not editing.
- Use sheet_update.
* src/commands.c (command_pop_list_top) : Delete.
(cmd_format_redo) : Apply the height adjustment here.
(cmd_set_area_*) : Implement.
(*) : Use sheet_update.
* src/colrow.c (rows_height_update) : Moved here and generalized from
sheet_selection_height_update.
* src/clipboard.c (sheet_paste_selection) : No need to call
sheet_cursor_set. sheet_selection_add_range already does that.
(clipboard_paste_region) : Flag updates to the status display if
something changes.
2000-04-04 Jon K Hellan <hellan@acm.org>
* src/sheet-view.c (sheet_view_set_zoom_factor): Call
......
2000-04-04 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (workbook_class_init) : Remove CELL_CHANGED.
(workbook_finish_editing) : At LAST! cmd_set_text is responsible for
setting the text directly :-)
* src/workbook-format-toolbar.c (change_font_size_in_selection_cmd) :
cmd_format takes care of the height adjustments.
* src/dialogs/dialog-cell-format.c (cb_fmt_dialog_dialog_apply) : Ditto.
* src/sheet.c (Sheet): Add flags edit_pos_changed, selection_content_changed.
(sheet_new) : init them.
(sheet_flag_status_update_cell) : New function that sets the flags.
(sheet_flag_status_update_range) : Ditto.
(sheet_update) : Fix typo. Add support for new flags.
(sheet_update_auto_expr) : Const correctness.
(sheet_update_controls) : Ditto.
(sheet_load_cell_val) : Ditto. Delete unused signal.
(sheet_set_text) : Use sheet_flag_status_update_range.
(sheet_set_edit_pos) : New routine.
(sheet_cursor_move) : Delete.
(sheet_fill_selection_with) : Remove.
* src/selection.c (sheet_selection_changed_hook) : const correctness.
(sheet_selection_change) : merge into sheet_selection_set.
(sheet_selection_extend_to) : Use sheet_selection_set.
(sheet_selection_set) : Merge with sheet_selection_change and use the
sheet_cursor accessors rather than changing things directly.
(sheet_selection_walk_step) : Use sheet_selection_set, and sheet_set_edit_pos.
(sheet_is_all_selected) : const correctness.
(sheet_is_cell_selected) : New routine.
(sheet_is_range_selected) : New routine.
* src/item-grid.c (item_grid_draw_background) : Adjust to rename of
* sheet_selection_is_cell_selected -> sheet_is_cell_selected.
* src/gnumeric-sheet.c (gnumeric_sheet_key_mode_sheet) : Cleanup the
logic for creating fills and arrays so that it can have undo
support.
- Change the heuristic for selecting what type of characters can start
an edit session. Rather than using fixed Latin1 centric codes,
guess that the 'length' field of the event is >0 if the character is
printable. Be more careful NOT to forward characters to the entry
if we are not editing.
- Use sheet_update.
* src/commands.c (command_pop_list_top) : Delete.
(cmd_format_redo) : Apply the height adjustment here.
(cmd_set_area_*) : Implement.
(*) : Use sheet_update.
* src/colrow.c (rows_height_update) : Moved here and generalized from
sheet_selection_height_update.
* src/clipboard.c (sheet_paste_selection) : No need to call
sheet_cursor_set. sheet_selection_add_range already does that.
(clipboard_paste_region) : Flag updates to the status display if
something changes.
2000-04-04 Jon K Hellan <hellan@acm.org>
* src/sheet-view.c (sheet_view_set_zoom_factor): Call
......
2000-04-04 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (workbook_class_init) : Remove CELL_CHANGED.
(workbook_finish_editing) : At LAST! cmd_set_text is responsible for
setting the text directly :-)
* src/workbook-format-toolbar.c (change_font_size_in_selection_cmd) :
cmd_format takes care of the height adjustments.
* src/dialogs/dialog-cell-format.c (cb_fmt_dialog_dialog_apply) : Ditto.
* src/sheet.c (Sheet): Add flags edit_pos_changed, selection_content_changed.
(sheet_new) : init them.
(sheet_flag_status_update_cell) : New function that sets the flags.
(sheet_flag_status_update_range) : Ditto.
(sheet_update) : Fix typo. Add support for new flags.
(sheet_update_auto_expr) : Const correctness.
(sheet_update_controls) : Ditto.
(sheet_load_cell_val) : Ditto. Delete unused signal.
(sheet_set_text) : Use sheet_flag_status_update_range.
(sheet_set_edit_pos) : New routine.
(sheet_cursor_move) : Delete.
(sheet_fill_selection_with) : Remove.
* src/selection.c (sheet_selection_changed_hook) : const correctness.
(sheet_selection_change) : merge into sheet_selection_set.
(sheet_selection_extend_to) : Use sheet_selection_set.
(sheet_selection_set) : Merge with sheet_selection_change and use the
sheet_cursor accessors rather than changing things directly.
(sheet_selection_walk_step) : Use sheet_selection_set, and sheet_set_edit_pos.
(sheet_is_all_selected) : const correctness.
(sheet_is_cell_selected) : New routine.
(sheet_is_range_selected) : New routine.
* src/item-grid.c (item_grid_draw_background) : Adjust to rename of
* sheet_selection_is_cell_selected -> sheet_is_cell_selected.
* src/gnumeric-sheet.c (gnumeric_sheet_key_mode_sheet) : Cleanup the
logic for creating fills and arrays so that it can have undo
support.
- Change the heuristic for selecting what type of characters can start
an edit session. Rather than using fixed Latin1 centric codes,
guess that the 'length' field of the event is >0 if the character is
printable. Be more careful NOT to forward characters to the entry
if we are not editing.
- Use sheet_update.
* src/commands.c (command_pop_list_top) : Delete.
(cmd_format_redo) : Apply the height adjustment here.
(cmd_set_area_*) : Implement.
(*) : Use sheet_update.
* src/colrow.c (rows_height_update) : Moved here and generalized from
sheet_selection_height_update.
* src/clipboard.c (sheet_paste_selection) : No need to call
sheet_cursor_set. sheet_selection_add_range already does that.
(clipboard_paste_region) : Flag updates to the status display if
something changes.
2000-04-04 Jon K Hellan <hellan@acm.org>
* src/sheet-view.c (sheet_view_set_zoom_factor): Call
......
2000-04-04 Jody Goldberg <jgoldberg@home.com>
* src/workbook.c (workbook_class_init) : Remove CELL_CHANGED.
(workbook_finish_editing) : At LAST! cmd_set_text is responsible for
setting the text directly :-)
* src/workbook-format-toolbar.c (change_font_size_in_selection_cmd) :
cmd_format takes care of the height adjustments.
* src/dialogs/dialog-cell-format.c (cb_fmt_dialog_dialog_apply) : Ditto.
* src/sheet.c (Sheet): Add flags edit_pos_changed, selection_content_changed.
(sheet_new) : init them.
(sheet_flag_status_update_cell) : New function that sets the flags.
(sheet_flag_status_update_range) : Ditto.
(sheet_update) : Fix typo. Add support for new flags.
(sheet_update_auto_expr) : Const correctness.
(sheet_update_controls) : Ditto.
(sheet_load_cell_val) : Ditto. Delete unused signal.
(sheet_set_text) : Use sheet_flag_status_update_range.
(sheet_set_edit_pos) : New routine.
(sheet_cursor_move) : Delete.
(sheet_fill_selection_with) : Remove.
* src/selection.c (sheet_selection_changed_hook) : const correctness.
(sheet_selection_change) : merge into sheet_selection_set.
(sheet_selection_extend_to) : Use sheet_selection_set.
(sheet_selection_set) : Merge with sheet_selection_change and use the
sheet_cursor accessors rather than changing things directly.
(sheet_selection_walk_step) : Use sheet_selection_set, and sheet_set_edit_pos.
(sheet_is_all_selected) : const correctness.
(sheet_is_cell_selected) : New routine.
(sheet_is_range_selected) : New routine.
* src/item-grid.c (item_grid_draw_background) : Adjust to rename of
* sheet_selection_is_cell_selected -> sheet_is_cell_selected.
* src/gnumeric-sheet.c (gnumeric_sheet_key_mode_sheet) : Cleanup the
logic for creating fills and arrays so that it can have undo
support.
- Change the heuristic for selecting what type of characters can start
an edit session. Rather than using fixed Latin1 centric codes,
guess that the 'length' field of the event is >0 if the character is
printable. Be more careful NOT to forward characters to the entry
if we are not editing.
- Use sheet_update.
* src/commands.c (command_pop_list_top) : Delete.
(cmd_format_redo) : Apply the height adjustment here.
(cmd_set_area_*) : Implement.
(*) : Use sheet_update.
* src/colrow.c (rows_height_update) : Moved here and generalized from
sheet_selection_height_update.
* src/clipboard.c (sheet_paste_selection) : No need to call
sheet_cursor_set. sheet_selection_add_range already does that.
(clipboard_paste_region) : Flag updates to the status display if
something changes.
2000-04-04 Jon K Hellan <hellan@acm.org>
* src/sheet-view.c (sheet_view_set_zoom_factor): Call
......
......@@ -359,11 +359,6 @@ sheet_paste_selection (CommandContext *context, Sheet *sheet,
paste_width, paste_height,
pc->paste_flags);
sheet_cursor_set (pc->dest_sheet,
pc->dest_col, pc->dest_row,
pc->dest_col, pc->dest_row,
end_col, end_row);
/* Make the newly pasted region the selection */
sheet_selection_reset_only (pc->dest_sheet);
sheet_selection_add_range (pc->dest_sheet,
......@@ -715,6 +710,7 @@ clipboard_paste_region (CommandContext *context,
{
clipboard_paste_closure_t *data;
g_return_if_fail (region != NULL);
g_return_if_fail (dest_sheet != NULL);
g_return_if_fail (IS_SHEET (dest_sheet));
......@@ -725,6 +721,15 @@ clipboard_paste_region (CommandContext *context,
data->dest_row = dest_row;
data->paste_flags = paste_flags;
{
/* Flag potential changes in the status area */
Range tmp;
tmp.start.col = dest_col;
tmp.start.row = dest_row;
tmp.end.col = dest_col + region->cols;
tmp.end.row = dest_row + region->rows;
sheet_flag_status_update_range (dest_sheet, &tmp);
}
/*
* If we own the selection, there is no need to ask X for
* the selection: we do the paste from our internal buffer.
......
......@@ -125,3 +125,30 @@ col_row_set_visiblity (Sheet *sheet, gboolean const is_col,
sheet_redraw_all (sheet);
sheet_redraw_headers (sheet, TRUE, TRUE, NULL);
}
static gboolean
cb_set_row_height (Sheet *sheet, ColRowInfo *info, void *dummy)
{
/* If the size was not set by the user then auto resize */
if (!info->hard_size) {
int const new_size = sheet_row_size_fit_pixels (sheet, info->pos);
sheet_row_set_size_pixels (sheet, info->pos, new_size, FALSE);
}
return FALSE;
}
/**
* rows_height_update
* @sheet: The sheet,
* @range: The range whose rows should be resized.
*
* Use this function having changed the font size to auto
* resize the row heights to make the text fit nicely.
**/
void
rows_height_update (Sheet *sheet, Range const * range)
{
sheet_foreach_colrow (sheet, &sheet->rows,
range->start.row, range->end.row,
&cb_set_row_height, NULL);
}
......@@ -42,4 +42,7 @@ void col_row_set_visiblity (Sheet *sheet, gboolean const is_col,
gboolean const visible,
ColRowVisList list);
/* Recalculate the height of all the rows in the range */
void rows_height_update (Sheet *sheet, Range const * range);
#endif /* GNUMERIC_COLROW_H */
......@@ -8,6 +8,7 @@
*/
#include <config.h>
#include "gnumeric-type-util.h"
#include "gnumeric-util.h"
#include "commands.h"
#include "sheet.h"
#include "workbook.h"
......@@ -228,28 +229,6 @@ command_redo (CommandContext *context, Workbook *wb)
undo_redo_menu_labels (wb);
}
/*
* command_list_pop_top : utility routine to free the top command on
* the undo list, and to regenerate the menus if needed.
*
* @cmd_list : The set of commands to free from.
*/
void
command_list_pop_top_undo (Workbook *wb)
{
GtkObject *cmd;
g_return_if_fail (wb->undo_commands != NULL);
cmd = GTK_OBJECT (wb->undo_commands->data);
g_return_if_fail (cmd != NULL);
gtk_object_unref (cmd);
wb->undo_commands = g_slist_remove (wb->undo_commands,
wb->undo_commands->data);
undo_redo_menu_labels (wb);
}
/*
* command_list_release : utility routine to free the resources associated
* with a list of commands.
......@@ -347,11 +326,7 @@ cmd_set_text_undo (GnumericCommand *cmd, CommandContext *context)
me->text = new_text;
/* Move back to the cell that was edited, and update the edit area */
sheet_cursor_set (me->pos.sheet,
me->pos.eval.col, me->pos.eval.row,
me->pos.eval.col, me->pos.eval.row,
me->pos.eval.col, me->pos.eval.row);
sheet_update (me->pos.sheet);
return FALSE;
}
......@@ -385,7 +360,7 @@ cmd_set_text (CommandContext *context,
CmdSetText *me;
gchar *pad = "";
gchar *text;
Cell *cell;
gboolean trouble;
g_return_val_if_fail (sheet != NULL, TRUE);
g_return_val_if_fail (new_text != NULL, TRUE);
......@@ -398,14 +373,7 @@ cmd_set_text (CommandContext *context,
/* Store the specs for the object */
me->pos.sheet = sheet;
me->pos.eval = *pos;
/* Save the new value so we can redo */
cell = sheet_cell_get (me->pos.sheet,
me->pos.eval.col,
me->pos.eval.row);
me->text = (cell == NULL || cell->value == NULL || cell->value->type == VALUE_EMPTY)
? NULL : cell_get_text (cell);
me->text = g_strdup (new_text);
/* Limit the size of the descriptor to something reasonable */
if (strlen(new_text) > max_descriptor_width) {
......@@ -422,8 +390,193 @@ cmd_set_text (CommandContext *context,
if (*pad)
g_free (text);
trouble = cmd_set_text_redo (GNUMERIC_COMMAND (me), context);
/* Register the command object */
return command_push_undo (sheet->workbook, obj, FALSE);
return command_push_undo (sheet->workbook, obj, trouble);
}
/******************************************************************/
#define CMD_AREA_SET_TEXT_TYPE (cmd_area_set_text_get_type ())
#define CMD_AREA_SET_TEXT(o) (GTK_CHECK_CAST ((o), CMD_AREA_SET_TEXT_TYPE, CmdAreaSetText))
typedef struct
{
GnumericCommand parent;
Sheet *sheet;
char *text;
gboolean as_array;
GSList *old_content;
GSList *selection;