[gnumeric] Fix scroll bar problem with large frozen panes. [#68603]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnumeric] Fix scroll bar problem with large frozen panes. [#68603]
- Date: Tue, 29 Dec 2009 00:28:07 +0000 (UTC)
commit b3c444063296944d7d0b23bfcd964faddacd3095
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date: Mon Dec 28 17:27:36 2009 -0700
Fix scroll bar problem with large frozen panes. [#68603]
2009-12-28 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/sheet-control-gui-priv.h (_SheetControlGUI): new fields
* src/sheet-control-gui.c (scg_gtk_paned_set_position): new
replace all calls to gtk_paned_set_position by
scg_gtk_paned_set_position throughout
(set_resize_pane_finish): unblock cb_check_resize
(cb_resize_pane_motion): block cb_check_resize
(cb_check_resize): new
(sheet_control_gui_new): attach cb_check_resize and fix
signal name
ChangeLog | 12 ++++++++
NEWS | 1 +
src/sheet-control-gui-priv.h | 1 +
src/sheet-control-gui.c | 58 +++++++++++++++++++++++++++++++++++++++---
4 files changed, 68 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c5b8cd1..ad94974 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
2009-12-28 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * src/sheet-control-gui-priv.h (_SheetControlGUI): new fields
+ * src/sheet-control-gui.c (scg_gtk_paned_set_position): new
+ replace all calls to gtk_paned_set_position by
+ scg_gtk_paned_set_position throughout
+ (set_resize_pane_finish): unblock cb_check_resize
+ (cb_resize_pane_motion): block cb_check_resize
+ (cb_check_resize): new
+ (sheet_control_gui_new): attach cb_check_resize and fix
+ signal name
+
+2009-12-28 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* src/value.c (find_rows_that_match): make this behave like
find_cells_that_match from the database plugin.
diff --git a/NEWS b/NEWS
index 6708bd3..76a43ec 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,7 @@ Andreas:
* Add menu item to select sheet objects. [#338615]
* Enable sheet tab menu when objects are selected. [#604496]
* Fix empty cell handling of the advanced filter. [#599064]
+ * Fix scroll bar problem with large frozen panes. [#68603]
Jean
* Fix import export of line type in scatter plots. [#605043]
diff --git a/src/sheet-control-gui-priv.h b/src/sheet-control-gui-priv.h
index 1b5bf7c..5b3f444 100644
--- a/src/sheet-control-gui-priv.h
+++ b/src/sheet-control-gui-priv.h
@@ -35,6 +35,7 @@ struct _SheetControlGUI {
GtkPaned *vpane, *hpane; /* drag panes for freezing */
GtkWidget *vs, *hs; /* Scrollbars */
GtkAdjustment *va, *ha; /* Adjustments */
+ int vpos, hpos; /* Handle positions */
guint pane_drag_handler;
/* SheetObject support */
diff --git a/src/sheet-control-gui.c b/src/sheet-control-gui.c
index 50ccf9a..e386c06 100644
--- a/src/sheet-control-gui.c
+++ b/src/sheet-control-gui.c
@@ -1236,6 +1236,17 @@ resize_pane_pos (SheetControlGUI *scg, GtkPaned *p,
}
static void
+scg_gtk_paned_set_position (SheetControlGUI *scg, GtkPaned *p, int pane_pos)
+{
+ if (p == scg->vpane)
+ scg->vpos = pane_pos;
+ else
+ scg->hpos = pane_pos;
+
+ gtk_paned_set_position (p, pane_pos);
+}
+
+static void
set_resize_pane_pos (SheetControlGUI *scg, GtkPaned *p)
{
int handle_size, pane_pos, size;
@@ -1262,11 +1273,14 @@ set_resize_pane_pos (SheetControlGUI *scg, GtkPaned *p)
g_signal_handlers_block_by_func (G_OBJECT (p),
G_CALLBACK (cb_resize_pane_motion), scg);
- gtk_paned_set_position (p, pane_pos);
+ scg_gtk_paned_set_position (scg, p, pane_pos);
g_signal_handlers_unblock_by_func (G_OBJECT (p),
G_CALLBACK (cb_resize_pane_motion), scg);
}
+static void
+cb_check_resize (GtkPaned *p, GtkAllocation *allocation, SheetControlGUI *scg);
+
static gboolean
resize_pane_finish (SheetControlGUI *scg, GtkPaned *p)
{
@@ -1301,6 +1315,10 @@ resize_pane_finish (SheetControlGUI *scg, GtkPaned *p)
set_resize_pane_pos (scg, p);
+ g_signal_handlers_unblock_by_func
+ (G_OBJECT (p),
+ G_CALLBACK (cb_check_resize), scg);
+
return FALSE;
}
static gboolean
@@ -1313,6 +1331,7 @@ cb_resize_hpane_finish (SheetControlGUI *scg)
{
return resize_pane_finish (scg, scg->hpane);
}
+
static void
cb_resize_pane_motion (GtkPaned *p,
G_GNUC_UNUSED GParamSpec *pspec,
@@ -1324,6 +1343,9 @@ cb_resize_pane_motion (GtkPaned *p,
resize_pane_pos (scg, p, &colrow, &guide_pos);
if (scg->pane_drag_handler == 0 && p->in_drag) {
+ g_signal_handlers_block_by_func
+ (G_OBJECT (p),
+ G_CALLBACK (cb_check_resize), scg);
scg_size_guide_start (scg, vert, colrow, 7);
scg->pane_drag_handler = g_timeout_add (250,
vert ? (GSourceFunc) cb_resize_hpane_finish
@@ -1332,6 +1354,29 @@ cb_resize_pane_motion (GtkPaned *p,
}
if (scg->pane_drag_handler)
scg_size_guide_motion (scg, vert, guide_pos);
+
+}
+
+static void
+cb_check_resize (GtkPaned *p, GtkAllocation *allocation,
+ SheetControlGUI *scg)
+{
+ gboolean const vert = (p == scg->vpane);
+ gint max, pos = vert ? scg->vpos : scg->hpos;
+
+ g_object_get (G_OBJECT (p), "max-position", &max, NULL);
+ if (pos > max)
+ pos = max;
+
+ if (gtk_paned_get_position (p) != pos) {
+ g_signal_handlers_block_by_func
+ (G_OBJECT (p),
+ G_CALLBACK (cb_resize_pane_motion), scg);
+ gtk_paned_set_position (p, pos);
+ g_signal_handlers_unblock_by_func
+ (G_OBJECT (p),
+ G_CALLBACK (cb_resize_pane_motion), scg);
+ }
}
SheetControlGUI *
@@ -1454,7 +1499,7 @@ sheet_control_gui_new (SheetView *sv, WBCGtk *wbcg)
scg->vpane = g_object_new (GTK_TYPE_VPANED, NULL);
gtk_paned_add1 (scg->vpane, gtk_label_new (NULL)); /* use a spacer */
gtk_paned_add2 (scg->vpane, scg->vs);
- gtk_paned_set_position (scg->vpane, 0);
+ scg_gtk_paned_set_position (scg, scg->vpane, 0);
gtk_table_attach (scg->table, GTK_WIDGET (scg->vpane),
1, 2, 0, 1,
GTK_FILL,
@@ -1463,7 +1508,7 @@ sheet_control_gui_new (SheetView *sv, WBCGtk *wbcg)
scg->hpane = g_object_new (GTK_TYPE_HPANED, NULL);
gtk_paned_add1 (scg->hpane, gtk_label_new (NULL)); /* use a spacer */
gtk_paned_add2 (scg->hpane, scg->hs);
- gtk_paned_set_position (scg->hpane, 0);
+ scg_gtk_paned_set_position (scg, scg->hpane, 0);
gtk_table_attach (scg->table, GTK_WIDGET (scg->hpane),
0, 1, 1, 2,
GTK_EXPAND | GTK_FILL | GTK_SHRINK,
@@ -1474,8 +1519,13 @@ sheet_control_gui_new (SheetView *sv, WBCGtk *wbcg)
G_CALLBACK (cb_resize_pane_motion), scg);
g_signal_connect (G_OBJECT (scg->hpane), "notify::position",
G_CALLBACK (cb_resize_pane_motion), scg);
+ g_signal_connect_after (G_OBJECT (scg->vpane), "size-allocate",
+ G_CALLBACK (cb_check_resize), scg);
+ g_signal_connect_after (G_OBJECT (scg->hpane), "size-allocate",
+ G_CALLBACK (cb_check_resize), scg);
+
g_signal_connect_data (G_OBJECT (scg->table),
- "size_allocate",
+ "size-allocate",
G_CALLBACK (scg_scrollbar_config), scg, NULL,
G_CONNECT_AFTER | G_CONNECT_SWAPPED);
g_signal_connect_object (G_OBJECT (scg->table),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]