aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-08-21 13:34:59 +0800
committerChris Lahey <clahey@src.gnome.org>2000-08-21 13:34:59 +0800
commit2764b49bc7bfb505480352a7864d3c4ac34c54a0 (patch)
tree64a244c831f7837419755fc01577b2bbc0532ca0
parent5b04deeae30fd6161ff79f1a8235f72c69676beb (diff)
downloadgsoc2013-evolution-2764b49bc7bfb505480352a7864d3c4ac34c54a0.tar.gz
gsoc2013-evolution-2764b49bc7bfb505480352a7864d3c4ac34c54a0.tar.zst
gsoc2013-evolution-2764b49bc7bfb505480352a7864d3c4ac34c54a0.zip
Added code to make handle position persist across resizes.
2000-08-21 Christopher James Lahey <clahey@helixcode.com> * widgets/e-paned/e-hpaned.c, widgets/e-paned/e-paned.c, widgets/e-paned/e-paned.h, widgets/e-paned/e-vpaned.c: Added code to make handle position persist across resizes. svn path=/trunk/; revision=4898
-rw-r--r--widgets/e-paned/e-hpaned.c8
-rw-r--r--widgets/e-paned/e-paned.c11
-rw-r--r--widgets/e-paned/e-paned.h1
-rw-r--r--widgets/e-paned/e-vpaned.c8
4 files changed, 17 insertions, 11 deletions
diff --git a/widgets/e-paned/e-hpaned.c b/widgets/e-paned/e-hpaned.c
index 68fa893210..933fc1c057 100644
--- a/widgets/e-paned/e-hpaned.c
+++ b/widgets/e-paned/e-hpaned.c
@@ -203,7 +203,7 @@ e_hpaned_size_allocate (GtkWidget *widget,
handle_shown = e_paned_handle_shown(paned);
if (handle_shown)
{
- paned->handle_xpos = paned->child1_size + border_width;
+ paned->handle_xpos = paned->child1_real_size + border_width;
paned->handle_ypos = border_width;
paned->handle_width = paned->handle_size;
paned->handle_height = MAX (1, (gint) widget->allocation.height - 2 * border_width);
@@ -226,7 +226,7 @@ e_hpaned_size_allocate (GtkWidget *widget,
}
child1_allocation.height = child2_allocation.height = MAX (1, (gint) allocation->height - border_width * 2);
- child1_allocation.width = paned->child1_size;
+ child1_allocation.width = paned->child1_real_size;
child1_allocation.x = border_width;
child1_allocation.y = child2_allocation.y = border_width;
@@ -329,7 +329,7 @@ e_hpaned_xor_line (EPaned *paned)
gdk_gc_set_line_attributes (paned->xor_gc, 2, GDK_LINE_SOLID,
GDK_CAP_NOT_LAST, GDK_JOIN_BEVEL);
- xpos = paned->child1_size
+ xpos = paned->child1_real_size
+ GTK_CONTAINER (paned)->border_width + paned->handle_size / 2;
gdk_draw_line (widget->window, paned->xor_gc,
@@ -367,6 +367,7 @@ e_hpaned_button_press (GtkWidget *widget,
widget->allocation.width
- paned->handle_size
- 2 * GTK_CONTAINER (paned)->border_width);
+ paned->child1_real_size = paned->child1_size;
e_hpaned_xor_line (paned);
return TRUE;
@@ -423,6 +424,7 @@ e_hpaned_motion (GtkWidget *widget,
e_hpaned_xor_line (paned);
paned->child1_size = CLAMP (e_paned_quantized_size(paned, size), paned->min_position, paned->max_position);
+ paned->child1_real_size = paned->child1_size;
e_hpaned_xor_line (paned);
}
diff --git a/widgets/e-paned/e-paned.c b/widgets/e-paned/e-paned.c
index ae68e10082..f02d4389a0 100644
--- a/widgets/e-paned/e-paned.c
+++ b/widgets/e-paned/e-paned.c
@@ -158,6 +158,7 @@ e_paned_init (EPaned *paned)
paned->handle_ypos = -1;
paned->old_child1_size = 0;
+ paned->child1_size = 0;
paned->quantum = 1;
}
@@ -518,7 +519,7 @@ e_paned_get_position (EPaned *paned)
g_return_val_if_fail (paned != NULL, 0);
g_return_val_if_fail (E_IS_PANED (paned), 0);
- return paned->child1_size;
+ return paned->child1_real_size;
}
void
@@ -597,14 +598,14 @@ e_paned_compute_position(EPaned *paned,
{
if (paned->child1_resize && !paned->child2_resize)
paned->child1_size += allocation - paned->last_allocation;
- else if (!(!paned->child1_resize && paned->child2_resize))
+ else if (paned->child1_resize && paned->child2_resize)
paned->child1_size = allocation * ((gdouble) paned->child1_size / (paned->last_allocation));
}
}
- paned->child1_size = CLAMP (paned->child1_size,
- paned->min_position,
- paned->max_position);
+ paned->child1_real_size = CLAMP (paned->child1_size,
+ paned->min_position,
+ paned->max_position);
paned->last_allocation = allocation;
}
diff --git a/widgets/e-paned/e-paned.h b/widgets/e-paned/e-paned.h
index e3799a6bce..b211d32bda 100644
--- a/widgets/e-paned/e-paned.h
+++ b/widgets/e-paned/e-paned.h
@@ -71,6 +71,7 @@ struct _EPaned
guint16 handle_width;
guint16 handle_height;
+ gint child1_real_size;
gint child1_size;
gint last_allocation;
gint min_position;
diff --git a/widgets/e-paned/e-vpaned.c b/widgets/e-paned/e-vpaned.c
index 0a093af2d9..705a36f331 100644
--- a/widgets/e-paned/e-vpaned.c
+++ b/widgets/e-paned/e-vpaned.c
@@ -203,7 +203,7 @@ e_vpaned_size_allocate (GtkWidget *widget,
if (handle_shown)
{
paned->handle_xpos = border_width;
- paned->handle_ypos = paned->child1_size + border_width;
+ paned->handle_ypos = paned->child1_real_size + border_width;
paned->handle_width = MAX (1, (gint) widget->allocation.width - 2 * border_width);
paned->handle_height = paned->handle_size;
@@ -225,7 +225,7 @@ e_vpaned_size_allocate (GtkWidget *widget,
}
child1_allocation.width = child2_allocation.width = MAX (1, (gint) allocation->width - border_width * 2);
- child1_allocation.height = paned->child1_size;
+ child1_allocation.height = paned->child1_real_size;
child1_allocation.x = child2_allocation.x = border_width;
child1_allocation.y = border_width;
@@ -328,7 +328,7 @@ e_vpaned_xor_line (EPaned *paned)
gdk_gc_set_line_attributes (paned->xor_gc, 2, GDK_LINE_SOLID,
GDK_CAP_NOT_LAST, GDK_JOIN_BEVEL);
- ypos = paned->child1_size
+ ypos = paned->child1_real_size
+ GTK_CONTAINER (paned)->border_width + paned->handle_size / 2;
gdk_draw_line (widget->window, paned->xor_gc,
@@ -366,6 +366,7 @@ e_vpaned_button_press (GtkWidget *widget,
widget->allocation.height -
paned->handle_size -
2 * GTK_CONTAINER (paned)->border_width);
+ paned->child1_real_size = paned->child1_size;
e_vpaned_xor_line(paned);
return TRUE;
@@ -422,6 +423,7 @@ e_vpaned_motion (GtkWidget *widget,
e_vpaned_xor_line (paned);
paned->child1_size = CLAMP (e_paned_quantized_size(paned, size), paned->min_position, paned->max_position);
+ paned->child1_real_size = paned->child1_size;
e_vpaned_xor_line(paned);
}