[gnumeric] Fix autofitting on data entry. [#626861]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Fix autofitting on data entry. [#626861]
- Date: Fri, 13 Aug 2010 19:19:42 +0000 (UTC)
commit e52670a00563fe54ceb52b851c65e2ba9a7b9b75
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Fri Aug 13 13:18:50 2010 -0600
Fix autofitting on data entry. [#626861]
2010-08-13 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/commands.c (cmd_set_text_full): always autofit the rows and also
autofit the columns for non-strings.
ChangeLog | 5 +++++
NEWS | 1 +
src/commands.c | 34 +++++++++++++++++++++-------------
3 files changed, 27 insertions(+), 13 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0b1ff91..2c841a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2010-08-13 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * src/commands.c (cmd_set_text_full): always autofit the rows and also
+ autofit the columns for non-strings.
+
+2010-08-13 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* src/colrow.c (colrow_set_sizes): revert last change
* src/commands.c (cmd_set_text_full_autofit_*): new
(cmd_set_text_full): don't use colrow_set_sizes but colrow_autofit
diff --git a/NEWS b/NEWS
index c4a2733..cb98edd 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,7 @@ Andreas:
* Fix autocorrection when entering in ranges. [#626781]
* Fix column wdth and row height adjustments when entering in ranges.
[#626789]
+ * Fix autofitting on data entry. [#626861]
Jean:
* Import Guppi graphs from gnumeric-1.0.x files. [#567953]
diff --git a/src/commands.c b/src/commands.c
index 2728957..845b258 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -773,7 +773,7 @@ cmd_set_text_full (WorkbookControl *wbc, GSList *selection, GnmEvalPos *ep,
GnmExprTop const *texpr = NULL;
GOUndo *undo = NULL;
GOUndo *redo = NULL;
- gboolean result, autofit_row = TRUE;
+ gboolean result, autofit_col = FALSE;
char *text = NULL;
char *name;
Sheet *sheet = ep->sheet;
@@ -843,7 +843,7 @@ cmd_set_text_full (WorkbookControl *wbc, GSList *selection, GnmEvalPos *ep,
if (new_style)
gnm_style_unref (new_style);
gnm_expr_top_unref (texpr);
- autofit_row = FALSE;
+ autofit_col = TRUE;
} else {
GString *text_str;
PangoAttrList *adj_markup = NULL;
@@ -885,23 +885,31 @@ cmd_set_text_full (WorkbookControl *wbc, GSList *selection, GnmEvalPos *ep,
}
g_free (name);
-
+ if (!autofit_col) {
+ GnmCell *cell = sheet_cell_fetch
+ (sheet, ep->eval.col, ep->eval.row);
+ go_undo_undo (redo);
+ autofit_col = !VALUE_IS_STRING (cell->value);
+ go_undo_undo (undo);
+ }
for (l = selection; l != NULL; l = l->next) {
GnmRange *r = l->data;
GnmRange *new_r;
new_r = g_new (GnmRange, 1);
*new_r = *r;
- if (autofit_row) {
- redo = go_undo_combine
- (go_undo_binary_new
- (sheet, new_r,
- (GOUndoBinaryFunc) cmd_set_text_full_autofit_row,
- NULL, g_free),
- redo);
- cri_row_list = colrow_get_index_list
- (r->start.row, r->end.row, cri_row_list);
- } else {
+ redo = go_undo_combine
+ (go_undo_binary_new
+ (sheet, new_r,
+ (GOUndoBinaryFunc) cmd_set_text_full_autofit_row,
+ NULL, g_free),
+ redo);
+ cri_row_list = colrow_get_index_list
+ (r->start.row, r->end.row, cri_row_list);
+
+ if (autofit_col) {
+ new_r = g_new (GnmRange, 1);
+ *new_r = *r;
redo = go_undo_combine
(go_undo_binary_new
(sheet, new_r,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]