[gnumeric] Fix scroll when selecting a merged cell. [#626065]
- From: Jean Bréfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Fix scroll when selecting a merged cell. [#626065]
- Date: Sun, 8 Aug 2010 12:08:36 +0000 (UTC)
commit 57842b1271f874ed5d1da5acd5dc5b9e9cd4c72b
Author: Jean Brefort <jean brefort normalesup org>
Date: Sun Aug 8 14:09:27 2010 +0200
Fix scroll when selecting a merged cell. [#626065]
ChangeLog | 5 +++++
NEWS | 1 +
src/sheet-control-gui.c | 28 ++++++++++++++++++----------
3 files changed, 24 insertions(+), 10 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ace55eb..47c5981 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-08-08 Jean Brefort <jean brefort normalesup org>
+
+ * src/sheet-control-gui.c (gnm_pane_make_cell_visible): fix scroll when
+ selecting a merged cell. [#626065]
+
2010-08-06 Morten Welinder <terra gnome org>
* src/gnm-random.c (random_01_mersenne): Produce full precision
diff --git a/NEWS b/NEWS
index 43bb1fd..2367b43 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ Jean:
* Use theme foreground color for row and column headers. [#625727]
* Force column span recalculation when switching between number and
error. [#625994]
+ * Fix scroll when selecting a merged cell. [#626065]
Morten:
* Survive malformed xml files.
diff --git a/src/sheet-control-gui.c b/src/sheet-control-gui.c
index 5cd0250..a004096 100644
--- a/src/sheet-control-gui.c
+++ b/src/sheet-control-gui.c
@@ -870,6 +870,7 @@ gnm_pane_make_cell_visible (GnmPane *pane, int col, int row,
GocCanvas *canvas;
Sheet *sheet;
int new_first_col, new_first_row;
+ GnmRange range;
g_return_if_fail (IS_GNM_PANE (pane));
@@ -887,16 +888,19 @@ gnm_pane_make_cell_visible (GnmPane *pane, int col, int row,
g_return_if_fail (row < gnm_sheet_get_max_rows (sheet));
canvas = GOC_CANVAS (pane);
+ range.start.col = range.end.col = col;
+ range.start.row = range.end.row = row;
+ gnm_sheet_merge_find_container (sheet, &range);
/* Find the new pane->first.col */
- if (col < pane->first.col) {
- new_first_col = col;
- } else if (col > pane->last_full.col) {
+ if (range.start.col < pane->first.col) {
+ new_first_col = range.start.col;
+ } else if (range.end.col > pane->last_full.col) {
int width = GTK_WIDGET (canvas)->allocation.width;
- ColRowInfo const * const ci = sheet_col_get_info (sheet, col);
+ ColRowInfo const * const ci = sheet_col_get_info (sheet, range.end.col);
if (ci->size_pixels < width) {
int first_col = (pane->last_visible.col == pane->first.col)
- ? pane->first.col : col;
+ ? pane->first.col : range.end.col;
for (; first_col > 0; --first_col) {
ColRowInfo const * const ci = sheet_col_get_info (sheet, first_col);
@@ -907,20 +911,22 @@ gnm_pane_make_cell_visible (GnmPane *pane, int col, int row,
}
}
new_first_col = first_col+1;
+ if (new_first_col > range.start.col)
+ new_first_col = range.start.col;
} else
new_first_col = col;
} else
new_first_col = pane->first.col;
/* Find the new pane->first.row */
- if (row < pane->first.row) {
- new_first_row = row;
- } else if (row > pane->last_full.row) {
+ if (range.start.row < pane->first.row) {
+ new_first_row = range.start.row;
+ } else if (range.end.row > pane->last_full.row) {
int height = GTK_WIDGET (canvas)->allocation.height;
- ColRowInfo const * const ri = sheet_row_get_info (sheet, row);
+ ColRowInfo const * const ri = sheet_row_get_info (sheet, range.end.row);
if (ri->size_pixels < height) {
int first_row = (pane->last_visible.row == pane->first.row)
- ? pane->first.row : row;
+ ? pane->first.row : range.end.row;
for (; first_row > 0; --first_row) {
ColRowInfo const * const ri = sheet_row_get_info (sheet, first_row);
@@ -931,6 +937,8 @@ gnm_pane_make_cell_visible (GnmPane *pane, int col, int row,
}
}
new_first_row = first_row+1;
+ if (new_first_row > range.start.row)
+ new_first_row = range.start.row;
} else
new_first_row = row;
} else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]