[gnumeric] Fix column and row fitting on paste. [#359404][#611181]



commit 949ad85aaf6537c678350ee23335e4fcac28fc78
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Sat Aug 14 00:00:59 2010 -0600

    Fix column and row fitting on paste. [#359404][#611181]
    
    2010-08-14  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* src/commands.c (CmdPasteCopy): new fields
    	(cmd_paste_copy_impl): store sizes for rows and columns and restore them
    	(cmd_paste_copy_finalize): finalize new fields
    	(cmd_paste_copy): iitalize new fields

 ChangeLog      |    7 +++++++
 NEWS           |    1 +
 src/commands.c |   45 ++++++++++++++++++++++++++++++++++-----------
 3 files changed, 42 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f8a8fa6..dbad2d6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-08-14  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* src/commands.c (CmdPasteCopy): new fields
+	(cmd_paste_copy_impl): store sizes for rows and columns and restore them
+	(cmd_paste_copy_finalize): finalize new fields
+	(cmd_paste_copy): iitalize new fields
+	
 2010-08-13  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* src/commands.c (cmd_area_set_array_expr): autofit rows and columns.
diff --git a/NEWS b/NEWS
index 97db54d..9b1f0f1 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,7 @@ Andreas:
 	  ranges. [#626797]
 	* Adjust formats when autofitting new entries. [#626903]
 	* Autofit rows and columns when entering an array expression. [#626904]
+	* Fix column and row fitting on paste. [#359404][#611181]
 
 Jean:
 	* Import Guppi graphs from gnumeric-1.0.x files. [#567953]
diff --git a/src/commands.c b/src/commands.c
index e7880e9..8ef646a 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -2862,7 +2862,10 @@ typedef struct {
 	GnmPasteTarget   dst;
 	gboolean         has_been_through_cycle;
 	gboolean         only_objects;
-	ColRowStateList *saved_sizes;
+	ColRowStateGroup *saved_sizes_rows;
+	ColRowStateGroup *saved_sizes_cols;
+	ColRowIndexList  *saved_list_rows;;
+	ColRowIndexList  *saved_list_cols;;
 	gboolean single_merge_to_single_merge;
 } CmdPasteCopy;
 
@@ -2969,14 +2972,25 @@ cmd_paste_copy_impl (GnmCommand *cmd, WorkbookControl *wbc,
 	}
 
 	if (is_undo) {
-		colrow_set_states (me->dst.sheet, FALSE,
-			me->dst.range.start.row, me->saved_sizes);
-		colrow_state_list_destroy (me->saved_sizes);
-		me->saved_sizes = NULL;
+		colrow_restore_state_group (me->dst.sheet, FALSE,
+			me->saved_list_rows, me->saved_sizes_rows);
+		colrow_state_group_destroy (me->saved_sizes_rows);
+		me->saved_sizes_rows = NULL;
+		colrow_index_list_destroy (me->saved_list_rows);
+		me->saved_list_rows = NULL;
+		colrow_restore_state_group (me->dst.sheet, TRUE,
+			me->saved_list_cols, me->saved_sizes_cols);
+		colrow_state_group_destroy (me->saved_sizes_cols);
+		me->saved_sizes_cols = NULL;
+		colrow_index_list_destroy (me->saved_list_cols);
+		me->saved_list_cols = NULL;
 	} else {
-		me->saved_sizes = colrow_get_states (me->dst.sheet,
-			FALSE, me->dst.range.start.row, me->dst.range.end.row);
-		rows_height_update (me->dst.sheet, &me->dst.range, FALSE);
+		colrow_autofit (me->dst.sheet, &me->dst.range, FALSE, FALSE,
+				TRUE, FALSE,
+				&me->saved_list_rows, &me->saved_sizes_rows);
+		colrow_autofit (me->dst.sheet, &me->dst.range, TRUE, TRUE,
+				TRUE, FALSE,
+				&me->saved_list_cols, &me->saved_sizes_cols);
 	}
 
 	/*
@@ -3023,8 +3037,14 @@ cmd_paste_copy_finalize (GObject *cmd)
 {
 	CmdPasteCopy *me = CMD_PASTE_COPY (cmd);
 
-	if (me->saved_sizes)
-		me->saved_sizes = colrow_state_list_destroy (me->saved_sizes);
+	me->saved_sizes_rows = colrow_state_group_destroy 
+		(me->saved_sizes_rows);
+	colrow_index_list_destroy (me->saved_list_rows);
+	me->saved_list_rows = NULL;
+	me->saved_sizes_cols = colrow_state_group_destroy 
+		(me->saved_sizes_cols);
+	colrow_index_list_destroy (me->saved_list_cols);
+	me->saved_list_cols = NULL;
 	if (me->contents) {
 		if (me->has_been_through_cycle)
 			cellregion_unref (me->contents);
@@ -3061,7 +3081,10 @@ cmd_paste_copy (WorkbookControl *wbc,
 	me->contents = cr;
 	me->has_been_through_cycle = FALSE;
 	me->only_objects = (cr->cols < 1 || cr->rows < 1);
-	me->saved_sizes = NULL;
+	me->saved_sizes_rows = NULL;
+	me->saved_sizes_cols = NULL;
+	me->saved_list_rows = NULL;
+	me->saved_list_cols = NULL;
 	me->pasted_objects = NULL;
 	me->orig_contents_objects =
 		go_slist_map (cr->objects, (GOMapFunc)sheet_object_dup);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]