[gnumeric] Fix problems with out-of-bounds selection after sheet resize.
- From: Morten Welinder <mortenw src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnumeric] Fix problems with out-of-bounds selection after sheet resize.
- Date: Fri, 24 Apr 2009 11:30:06 -0400 (EDT)
commit 3f2c7cf9a7650c5ca6fab5ee375744bb9d5c9301
Author: Morten Welinder <terra gnome org>
Date: Fri Apr 24 11:29:14 2009 -0400
Fix problems with out-of-bounds selection after sheet resize.
---
ChangeLog | 6 ++++++
src/sheet-control-gui.c | 5 ++---
src/sheet.c | 32 ++++++++++++++++++++++++++++++++
3 files changed, 40 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0fce716..284016b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2009-04-24 Morten Welinder <terra gnome org>
+ * src/sheet.c (gnm_sheet_resize_main): Restrict the selection to
+ the size of the new sheet.
+
+ * src/sheet-control-gui.c (cb_scg_sheet_resized): For panes and
+ thus cursors to be updated.
+
* src/sheet-style.c (sheet_style_resize): Fix off-by-one.
* configure.in (PANGO_WEIGHT_THIN): Check for this and friends.
diff --git a/src/sheet-control-gui.c b/src/sheet-control-gui.c
index 8b17fd1..6b46caf 100644
--- a/src/sheet-control-gui.c
+++ b/src/sheet-control-gui.c
@@ -1218,9 +1218,8 @@ cb_scg_sheet_resized (Sheet *sheet,
GParamSpec *pspec,
SheetControlGUI *scg)
{
- SheetControl *sc = &scg->sheet_control;
- sc_set_panes (sc);
- scg_redraw_all (sc, TRUE);
+ cb_scg_redraw_resize (sheet, pspec, scg);
+ sc_set_panes (&scg->sheet_control);
}
static void
diff --git a/src/sheet.c b/src/sheet.c
index b8d86ed..0d5323f 100644
--- a/src/sheet.c
+++ b/src/sheet.c
@@ -1147,6 +1147,36 @@ gnm_sheet_resize_main (Sheet *sheet, int cols, int rows,
}
/* ---------------------------------------- */
+ /* Restrict selection. (Not undone.) */
+
+ SHEET_FOREACH_VIEW (sheet, sv,
+ {
+ GnmRange new_full;
+ GSList *l;
+ GSList *sel = selection_get_ranges (sv, TRUE);
+ gboolean any = FALSE;
+ GnmCellPos vis;
+ sv_selection_reset (sv);
+ range_init (&new_full, 0, 0, cols - 1, rows - 1);
+ vis = new_full.start;
+ for (l = sel; l; l = l->next) {
+ GnmRange *r = l->data;
+ GnmRange newr;
+ if (range_intersection (&newr, r, &new_full)) {
+ sv_selection_add_range (sv, &newr);
+ vis = newr.start;
+ any = TRUE;
+ }
+ g_free (r);
+ }
+ g_slist_free (sel);
+ if (!any) {
+ sv_selection_add_pos (sv, 0, 0);
+ }
+ sv_make_cell_visible (sv, vis.col, vis.row, FALSE);
+ });
+
+ /* ---------------------------------------- */
/* Resize column and row containers. */
colrow_resize (&sheet->cols, cols);
@@ -1208,6 +1238,8 @@ gnm_sheet_resize_main (Sheet *sheet, int cols, int rows,
range_init_full_sheet (&sheet->priv->unhidden_region, sheet);
+ /* ---------------------------------------- */
+
sheet_redraw_all (sheet, TRUE);
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]