Update canvas bounds when resizing the canvas.

git-svn-id: https://gpredict.svn.sourceforge.net/svnroot/gpredict/trunk@188 ab6734ba-2843-0410-b83b-99c217ef6c0f
This commit is contained in:
csete 2008-12-28 14:53:15 +00:00
parent 86a6e32050
commit 2954c2613d

View file

@ -232,11 +232,9 @@ gtk_polar_view_new (GKeyFile *cfgdata, GHashTable *sats, qth_t *qth)
gtk_widget_modify_base (GTK_POLAR_VIEW (polv)->canvas, GTK_STATE_NORMAL, &bg_color);
gtk_widget_set_size_request (GTK_POLAR_VIEW (polv)->canvas,
POLV_DEFAULT_SIZE, POLV_DEFAULT_SIZE);
/* if we set canvas bounds resize will cut the image to this size
discovered with GooCanvas 0.12
goo_canvas_set_bounds (GOO_CANVAS (GTK_POLAR_VIEW (polv)->canvas), 0, 0,
POLV_DEFAULT_SIZE, POLV_DEFAULT_SIZE);
*/
/* connect size-request signal */
g_signal_connect (GTK_POLAR_VIEW (polv)->canvas, "size-allocate",
@ -521,6 +519,11 @@ size_allocate_cb (GtkWidget *widget, GtkAllocation *allocation, gpointer data)
polv->cx = allocation->width / 2;
polv->cy = allocation->height / 2;
/* update canvas bounds to match new size */
goo_canvas_set_bounds (GOO_CANVAS (GTK_POLAR_VIEW (polv)->canvas), 0, 0,
allocation->width, allocation->height);
/* update coordinate system */
g_object_set (polv->C00,
"center-x", (gdouble) polv->cx,