[gnumeric] For freezing of panes consider edit cell A1 special [#594875]



commit 0980a2d0b1f1ba686c1577249083f32791ff066d
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Sat Sep 26 23:12:12 2009 -0600

    For freezing of panes consider edit cell A1 special [#594875]
    
    2009-09-27  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* src/wbc-gtk-actions.c (cb_view_freeze_panes): special handling if the
    	  edit cell is A1.

 ChangeLog             |    5 +++++
 NEWS                  |    1 +
 src/wbc-gtk-actions.c |   35 ++++++++++++++++++++++++++++-------
 3 files changed, 34 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0147ce9..83317cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-09-27  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* src/wbc-gtk-actions.c (cb_view_freeze_panes): special handling if the
+	  edit cell is A1.
+
 2009-09-26  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* src/GNOME_Gnumeric-gtk.xml.in: sort objects by type
diff --git a/NEWS b/NEWS
index 8385a96..b236974 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ Andreas:
 	* Add more ODF elements on ODF read. [#595750]
 	* Fix 2-factor ANOVA with replication
 	* Fix diagonal borders in ODF export/import
+	* For freezing of panes consider edit cell A1 special [#594875]
 
 Jean:
 	* Make plugins GUI labels translatable. [#159806]
diff --git a/src/wbc-gtk-actions.c b/src/wbc-gtk-actions.c
index 8b7aca2..cbbdcce 100644
--- a/src/wbc-gtk-actions.c
+++ b/src/wbc-gtk-actions.c
@@ -670,13 +670,32 @@ static GNM_ACTION_DEF (cb_view_freeze_panes)
 		frozen_tl = pane->first;
 		unfrozen_tl = sv->edit_pos;
 
-		/* If edit pos is out of visible range */
+		if (unfrozen_tl.row == 0 && unfrozen_tl.col == 0) {
+			GnmRange const *first = selection_first_range (sv, NULL, NULL);
+			Sheet *sheet = sv_sheet (sv);
+			gboolean full_rows = range_is_full (first, sheet, TRUE);
+			gboolean full_cols = range_is_full (first, sheet, FALSE);
+			if (!full_rows || !full_cols) {
+				if (!full_rows && !full_cols) {
+					unfrozen_tl.row = first->end.row + 1;
+					unfrozen_tl.col = first->end.col + 1;
+				} else if (full_rows) {
+					unfrozen_tl.row = first->end.row + 1;
+					unfrozen_tl.col = 0;
+				} else {
+					unfrozen_tl.row = 0;
+					unfrozen_tl.col = first->end.col + 1;
+				}
+			}
+		} 
+			
+                /* If edit pos is out of visible range */
 		if (unfrozen_tl.col < pane->first.col ||
 		    unfrozen_tl.col > pane->last_visible.col ||
 		    unfrozen_tl.row < pane->first.row ||
 		    unfrozen_tl.row > pane->last_visible.row)
 			center = TRUE;
-
+		
 		if (unfrozen_tl.col == pane->first.col) {
 			/* or edit pos is in top left visible cell */
 			if (unfrozen_tl.row == pane->first.row)
@@ -685,15 +704,17 @@ static GNM_ACTION_DEF (cb_view_freeze_panes)
 				unfrozen_tl.col = frozen_tl.col = 0;
 		} else if (unfrozen_tl.row == pane->first.row)
 			unfrozen_tl.row = frozen_tl.row = 0;
-
+		
 		if (center) {
-			unfrozen_tl.col = (pane->first.col + pane->last_visible.col) / 2;
-			unfrozen_tl.row = (pane->first.row + pane->last_visible.row) / 2;
+			unfrozen_tl.col = (pane->first.col + 
+					   pane->last_visible.col) / 2;
+			unfrozen_tl.row = (pane->first.row + 
+					   pane->last_visible.row) / 2;
 		}
-
+		
 		g_return_if_fail (unfrozen_tl.col > frozen_tl.col ||
 				  unfrozen_tl.row > frozen_tl.row);
-
+		
 		sv_freeze_panes (sv, &frozen_tl, &unfrozen_tl);
 	} else
 		sv_freeze_panes (sv, NULL, NULL);



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