From 57d95cb3b74694ab500d10ae16f06827b9acf3ff Mon Sep 17 00:00:00 2001 From: Damon Chaplin Date: Wed, 28 Nov 2001 22:11:07 +0000 Subject: updated to new version from Ximian Setup Tools. Fixes bug #7641. 2001-11-28 Damon Chaplin * e-map.c: updated to new version from Ximian Setup Tools. Fixes bug #7641. 2001-11-27 Damon Chaplin * e-dateedit.c (e_date_edit_get_date): if allow_no_date_set is FALSE, return the last valid date entered, even if the field is currently empty. Fixes bug #15749. svn path=/trunk/; revision=14817 --- widgets/misc/ChangeLog | 11 +++++ widgets/misc/e-dateedit.c | 7 ++-- widgets/misc/e-map.c | 102 +++++++++++++++++++++++++++------------------- 3 files changed, 76 insertions(+), 44 deletions(-) (limited to 'widgets/misc') diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog index 7647180d75..5b970ecd10 100644 --- a/widgets/misc/ChangeLog +++ b/widgets/misc/ChangeLog @@ -1,3 +1,14 @@ +2001-11-28 Damon Chaplin + + * e-map.c: updated to new version from Ximian Setup Tools. + Fixes bug #7641. + +2001-11-27 Damon Chaplin + + * e-dateedit.c (e_date_edit_get_date): if allow_no_date_set is FALSE, + return the last valid date entered, even if the field is currently + empty. Fixes bug #15749. + 2001-11-05 JP Rosevear * e-dateedit.c (e_date_edit_set_date_and_time_of_day): set both diff --git a/widgets/misc/e-dateedit.c b/widgets/misc/e-dateedit.c index 09ba1ad2d9..e8f6e74aea 100644 --- a/widgets/misc/e-dateedit.c +++ b/widgets/misc/e-dateedit.c @@ -673,13 +673,14 @@ e_date_edit_get_date (EDateEdit *dedit, /* Try to parse any new value now. */ e_date_edit_check_date_changed (dedit); - if (priv->date_set_to_none) - return FALSE; - *year = priv->year + 1900; *month = priv->month + 1; *day = priv->day; + if (priv->date_set_to_none + && e_date_edit_get_allow_no_date_set (dedit)) + return FALSE; + return TRUE; } diff --git a/widgets/misc/e-map.c b/widgets/misc/e-map.c index 9a96ccc90f..de9d96d009 100644 --- a/widgets/misc/e-map.c +++ b/widgets/misc/e-map.c @@ -263,7 +263,17 @@ e_map_finalize (GtkObject *object) gtk_object_unref (GTK_OBJECT (priv->vadj)); priv->vadj = NULL; - /* TODO: Unref pixbufs here */ + if (priv->map_pixbuf) + { + gdk_pixbuf_unref (priv->map_pixbuf); + priv->map_pixbuf = NULL; + } + + if (priv->map_render_pixbuf) + { + gdk_pixbuf_unref (priv->map_render_pixbuf); + priv->map_render_pixbuf = NULL; + } g_free (priv); view->priv = NULL; @@ -993,20 +1003,6 @@ load_map_background (EMap *view, gchar *name) } -#define SET_PIXEL_RGB(pixbuf, x, y, rgba) \ - *(gdk_pixbuf_get_pixels (pixbuf) + \ - ((gint) (y) * gdk_pixbuf_get_rowstride (pixbuf)) + \ - ((gint) (x) * 3)) = ((rgba) >> 24) & 0xff; \ -\ - *(gdk_pixbuf_get_pixels (pixbuf) + \ - ((gint) (y) * gdk_pixbuf_get_rowstride (pixbuf)) + \ - ((gint) (x) * 3) + 1) = ((rgba) >> 16) & 0xff; \ -\ - *(gdk_pixbuf_get_pixels (pixbuf) + \ - ((gint) (y) * gdk_pixbuf_get_rowstride (pixbuf)) + \ - ((gint) (x) * 3) + 2) = ((rgba) >> 8) & 0xff - - static void update_render_pixbuf (EMap *map, ArtFilterLevel interp, gboolean render_overlays) { @@ -1049,10 +1045,13 @@ update_render_pixbuf (EMap *map, ArtFilterLevel interp, gboolean render_overlays /* Scale the original map into the rendering pixbuf */ - gdk_pixbuf_scale (priv->map_pixbuf, priv->map_render_pixbuf, 0, 0, /* Dest (x, y) */ - width, height, 0, 0, /* Offset (x, y) */ - zoom, zoom, /* Scale (x, y) */ - interp); + if (width > 1 && height > 1) + { + gdk_pixbuf_scale (priv->map_pixbuf, priv->map_render_pixbuf, 0, 0, /* Dest (x, y) */ + width, height, 0, 0, /* Offset (x, y) */ + zoom, zoom, /* Scale (x, y) */ + interp); + } if (render_overlays) { @@ -1116,6 +1115,34 @@ request_paint_area (EMap *view, GdkRectangle *area) #endif } +static void +put_pixel_with_clipping (GdkPixbuf *pixbuf, gint x, gint y, guint rgba) +{ + gint width, height; + gint rowstride, n_channels; + guchar *pixels, *pixel; + + width = gdk_pixbuf_get_width (pixbuf); + height = gdk_pixbuf_get_height (pixbuf); + rowstride = gdk_pixbuf_get_rowstride (pixbuf); + n_channels = gdk_pixbuf_get_n_channels (pixbuf); + pixels = gdk_pixbuf_get_pixels (pixbuf); + + if (x < 0 || x >= width || y < 0 || y >= height) + return; + + pixel = pixels + (y * rowstride) + (x * n_channels); + + *pixel = (rgba >> 24); + *(pixel + 1) = (rgba >> 16) & 0x000000ff; + *(pixel + 2) = (rgba >> 8) & 0x000000ff; + + if (n_channels > 3) + { + *(pixel + 3) = rgba & 0x000000ff; + } +} + /* Redraw point in client pixbuf */ @@ -1131,34 +1158,27 @@ update_render_point (EMap *map, EMapPoint *point) pb = priv->map_render_pixbuf; if (!pb) return; - width = gdk_pixbuf_get_width (pb); + width = gdk_pixbuf_get_width (pb); height = gdk_pixbuf_get_height (pb); e_map_world_to_window (map, point->longitude, point->latitude, &px, &py); px += priv->xofs; py += priv->yofs; - if (px < width && px >= 0 && py < height && py >= 0) - { - /* Area */ - - SET_PIXEL_RGB (pb, px, py, point->rgba); - if (px > 0) SET_PIXEL_RGB (pb, px - 1, py, point->rgba); - if (px < width - 1) SET_PIXEL_RGB (pb, px + 1, py, point->rgba); - if (py > 0) SET_PIXEL_RGB (pb, px, py - 1, point->rgba); - if (py < height - 1) SET_PIXEL_RGB (pb, px, py + 1, point->rgba); - - /* Outline */ - - if (px > 1) SET_PIXEL_RGB (pb, px - 2, py, 0x000000ff); - if (px < width - 2) SET_PIXEL_RGB (pb, px + 2, py, 0x000000ff); - if (py > 1) SET_PIXEL_RGB (pb, px, py - 2, 0x000000ff); - if (py < height - 2) SET_PIXEL_RGB (pb, px, py + 2, 0x000000ff); - if (px > 0 && py > 0) SET_PIXEL_RGB (pb, px - 1, py - 1, 0x000000ff); - if (px > 0 && py < height - 1) SET_PIXEL_RGB (pb, px - 1, py + 1, 0x000000ff); - if (px < width - 1 && py > 0) SET_PIXEL_RGB (pb, px + 1, py - 1, 0x000000ff); - if (px < width - 1 && py < height - 1) SET_PIXEL_RGB (pb, px + 1, py + 1, 0x000000ff); - } + put_pixel_with_clipping (pb, px, py, point->rgba); + put_pixel_with_clipping (pb, px - 1, py, point->rgba); + put_pixel_with_clipping (pb, px + 1, py, point->rgba); + put_pixel_with_clipping (pb, px, py - 1, point->rgba); + put_pixel_with_clipping (pb, px, py + 1, point->rgba); + + put_pixel_with_clipping (pb, px - 2, py, 0x000000ff); + put_pixel_with_clipping (pb, px + 2, py, 0x000000ff); + put_pixel_with_clipping (pb, px, py - 2, 0x000000ff); + put_pixel_with_clipping (pb, px, py + 2, 0x000000ff); + put_pixel_with_clipping (pb, px - 1, py - 1, 0x000000ff); + put_pixel_with_clipping (pb, px - 1, py + 1, 0x000000ff); + put_pixel_with_clipping (pb, px + 1, py - 1, 0x000000ff); + put_pixel_with_clipping (pb, px + 1, py + 1, 0x000000ff); } -- cgit v1.2.3