Re: Reread file option for "image" standard object
- From: "Dolores Alia de Saravia" <loli unsa edu ar>
- To: dia-list gnome org
- Subject: Re: Reread file option for "image" standard object
- Date: Wed, 7 Aug 2002 08:37:35 -0300
On Tue, 6 Aug 2002, Lars Clausen wrote:
On Tue, 6 Aug 2002, Dolores Alia de Saravia wrote:
A small change for image.c (from version of August 5, attached) is
proposed in order to make easier to refresh an image if one
suspects
file image changed.
(With actual program, the only way I found to do it is by changing,
twice, the file name)
A "reread image file" ToggleButton and corresponding source is
added,
to reload the file without changing representation image size.
As Cyrille said, *please* use unidiffs (cvs diff -u <file>). We
can't look
through the entire file to find just the small changes you've made.
I'm sending the output which I called "diferencias". Is this one
Lars and Cyrille are talking about?
It is, however, a good point you're bringing up. Instead of adding a
button, I would suggest that you make a check (using stat(2)) in
image_update_data() to see if the timestamp has changed, and store the
timestamp whenever the image is loaded.
I will look at this; but I think that in any case the option should be
there for the user to decide.
Thanks,
Loli
email: loli unsa edu ar
Sent using NeoMail, a web-based e-mail client.
http://neomail.sourceforge.net
Index: RDIR/image.c
===================================================================
RCS file: /home/loli/cvs/objects/standard/RDIR/image.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 image.c
--- RDIR/image.c 2002/08/07 04:21:23 1.1.1.1
+++ RDIR/image.c 2002/08/06 11:22:41
@@ -57,13 +57,15 @@
gchar *file;
gboolean draw_border;
gboolean keep_aspect;
+ gboolean re_read_file;
};
static struct _ImageProperties {
gchar *file;
gboolean draw_border;
gboolean keep_aspect;
-} default_properties = { "", FALSE, TRUE };
+ gboolean re_read_file;
+} default_properties = { "", FALSE, TRUE, FALSE };
static real image_distance_from(Image *image, Point *point);
static void image_select(Image *image, Point *clicked_point,
@@ -131,6 +133,8 @@
N_("Draw border"), NULL, NULL},
{ "keep_aspect", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE,
N_("Keep aspect ratio"), NULL, NULL},
+ { "re_read_file", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE,
+ N_("Reread image file"), NULL, NULL},
PROP_STD_LINE_WIDTH,
PROP_STD_LINE_COLOUR,
PROP_STD_LINE_STYLE,
@@ -150,6 +154,7 @@
{ "image_file", PROP_TYPE_FILE, offsetof(Image, file) },
{ "show_border", PROP_TYPE_BOOL, offsetof(Image, draw_border) },
{ "keep_aspect", PROP_TYPE_BOOL, offsetof(Image, keep_aspect) },
+ { "re_read_file", PROP_TYPE_BOOL, offsetof(Image, re_read_file) },
{ "line_width", PROP_TYPE_REAL, offsetof(Image, border_width) },
{ "line_colour", PROP_TYPE_COLOUR, offsetof(Image, border_color) },
{ "line_style", PROP_TYPE_LINESTYLE,
@@ -355,6 +360,13 @@
Element *elem = &image->element;
ElementBBExtras *extra = &elem->extra_spacing;
Object *obj = &elem->object;
+ real h,w;
+
+ if (image->re_read_file){
+ h = elem->height; w = elem->width;
+ image->image = dia_image_load(image->file);
+ elem->height = h; elem->width = w;
+ };
/* Update connections: */
image->connections[0].pos = elem->corner;
@@ -432,6 +444,7 @@
image->draw_border = default_properties.draw_border;
image->keep_aspect = default_properties.keep_aspect;
+ image->re_read_file = default_properties.re_read_file;
image_update_data(image);
@@ -486,6 +499,7 @@
newimage->draw_border = image->draw_border;
newimage->keep_aspect = image->keep_aspect;
+ newimage->re_read_file = image->re_read_file;
return &newimage->element.object;
}
@@ -546,6 +560,7 @@
data_add_boolean(new_attribute(obj_node, "draw_border"), image->draw_border);
data_add_boolean(new_attribute(obj_node, "keep_aspect"), image->keep_aspect);
+ data_add_boolean(new_attribute(obj_node, "re_read_file"), image->re_read_file);
if (image->file != NULL) {
if (g_path_is_absolute(image->file)) { /* Absolute pathname */
@@ -610,7 +625,7 @@
if (attr != NULL)
image->dashlength = data_real(attribute_first_data(attr));
- image->draw_border = TRUE;
+ image->draw_border = FALSE;
attr = object_find_attribute(obj_node, "draw_border");
if (attr != NULL)
image->draw_border = data_boolean( attribute_first_data(attr) );
@@ -619,6 +634,11 @@
attr = object_find_attribute(obj_node, "keep_aspect");
if (attr != NULL)
image->keep_aspect = data_boolean( attribute_first_data(attr) );
+
+ image->re_read_file = FALSE;
+ attr = object_find_attribute(obj_node, "re_read_file");
+ if (attr != NULL)
+ image->re_read_file = data_boolean( attribute_first_data(attr) );
attr = object_find_attribute(obj_node, "file");
if (attr != NULL) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]