[gnumeric] Autofit rows and columns when entering an array expression. [#626904]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Autofit rows and columns when entering an array expression. [#626904]
- Date: Sat, 14 Aug 2010 04:47:49 +0000 (UTC)
commit 9aa8a711eed2b36e6b4bfce91719fd7a8cd8e4ba
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Fri Aug 13 22:47:18 2010 -0600
Autofit rows and columns when entering an array expression. [#626904]
2010-08-13 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/commands.c (cmd_area_set_array_expr): autofit rows and columns.
ChangeLog | 4 ++++
NEWS | 3 ++-
src/commands.c | 41 +++++++++++++++++++++++++++++++++++++++--
3 files changed, 45 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 828eaea..f8a8fa6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2010-08-13 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * src/commands.c (cmd_area_set_array_expr): autofit rows and columns.
+
+2010-08-13 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* src/colrow.h (colrow_autofit_col): new
(colrow_autofit_row): new
* src/colrow.c (colrow_autofit_col): new
diff --git a/NEWS b/NEWS
index 66a7c74..97db54d 100644
--- a/NEWS
+++ b/NEWS
@@ -15,7 +15,8 @@ Andreas:
* Fix autofitting on data entry. [#626861]
* Avoid some of the multiple undos when entering existing text in
ranges. [#626797]
- * Adjust formats wehn autofitting new entries. [#626903]
+ * Adjust formats when autofitting new entries. [#626903]
+ * Autofit rows and columns when entering an array expression. [#626904]
Jean:
* Import Guppi graphs from gnumeric-1.0.x files. [#567953]
diff --git a/src/commands.c b/src/commands.c
index ca03ca4..e7880e9 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -1130,6 +1130,9 @@ cmd_area_set_array_expr (WorkbookControl *wbc, SheetView *sv,
char *name;
char *text;
GnmSheetRange *sr;
+ GnmRange *r_1, *r_2, *r;
+ ColRowIndexList *cri_col_list;
+ ColRowIndexList *cri_row_list;
g_return_val_if_fail (selection != NULL , TRUE);
g_return_val_if_fail (selection->next == NULL , TRUE);
@@ -1138,10 +1141,44 @@ cmd_area_set_array_expr (WorkbookControl *wbc, SheetView *sv,
text = g_strdup_printf (_("Inserting array expression in %s"), name);
g_free (name);
- undo = clipboard_copy_range_undo (sheet, selection->data);
+ r = selection->data;
- sr = gnm_sheet_range_new (sheet, selection->data);
+ cri_row_list = colrow_get_index_list
+ (r->start.row, r->end.row, NULL);
+ cri_col_list = colrow_get_index_list
+ (r->start.col, r->end.col, NULL);
+ undo = clipboard_copy_range_undo (sheet, selection->data);
+ undo = go_undo_combine (undo,
+ gnm_undo_colrow_restore_state_group_new
+ (sheet, TRUE,
+ cri_col_list,
+ colrow_get_sizes (sheet, TRUE,
+ cri_col_list, -1)));
+ undo = go_undo_combine (undo,
+ gnm_undo_colrow_restore_state_group_new
+ (sheet, FALSE,
+ cri_row_list,
+ colrow_get_sizes (sheet, FALSE,
+ cri_row_list, -1)));
+
+ sr = gnm_sheet_range_new (sheet, r);
+ r_1 = g_new (GnmRange, 1);
+ *r_1 = *r;
+ r_2 = g_new (GnmRange, 1);
+ *r_2 = *r;
redo = gnm_cell_set_array_formula_undo (sr, texpr);
+ redo = go_undo_combine
+ (go_undo_binary_new
+ (sheet, r_1,
+ (GOUndoBinaryFunc) colrow_autofit_col,
+ NULL, g_free),
+ redo);
+ redo = go_undo_combine
+ (go_undo_binary_new
+ (sheet, r_2,
+ (GOUndoBinaryFunc) colrow_autofit_row,
+ NULL, g_free),
+ redo);
range_fragment_free (selection);
result = cmd_generic (wbc, text, undo, redo);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]