Hi James,
attached a small patch (mainly missing includes). But there
one thing I need your advice.

properties.h uses GIMPVAR to export prop_std_line_width_data, etc.

Thanks for using it, but because later on there is used a pointer
to these vars, which breaks the built (initializer is not a constant).

The address depends on the dynamic linker and probably isn't resolved
when initializing is needed.
I've fixed it by declaring these vars as static, which will result
in many instances (one for every includage of properties.h).

Without diving too deep in your properties code, was it intended
to have only one prop_std_line_width_data in the whole dia address
space? If so, my patch will break it and I'll provide another
sollution, like initializing at first usage.

        Hans 
diff -u -r --exclude=*.obj from-cvs/dia/app/app_procs.c my-gtk/dia/app/app_procs.c
--- from-cvs/dia/app/app_procs.c        Tue Feb 29 21:45:50 2000
+++ my-gtk/dia/app/app_procs.c  Wed Mar 01 22:36:08 2000
@@ -60,6 +60,7 @@
 #include "dia_dirs.h"
 #include "render_eps.h"
 #include "render_svg.h"
+#include "sheet.h"

 #if defined(HAVE_LIBPNG) && defined(HAVE_LIBART)
 extern DiaExportFilter png_export_filter;
diff -u -r --exclude=*.obj from-cvs/dia/app/export_png.c my-gtk/dia/app/export_png.c
--- from-cvs/dia/app/export_png.c       Mon Feb 28 15:54:06 2000
+++ my-gtk/dia/app/export_png.c Wed Mar 01 23:53:28 2000
@@ -30,6 +30,7 @@
 #include "filter.h"
 #include "render_libart.h"
 #include "display.h"
+#include "message.h"

 /* the dots per centimetre to render this diagram at */
 /* this matches the setting `100%' setting in dia. */
diff -u -r --exclude=*.obj from-cvs/dia/app/linewidth_area.c 
my-gtk/dia/app/linewidth_area.c
--- from-cvs/dia/app/linewidth_area.c   Fri Feb 18 21:17:58 2000
+++ my-gtk/dia/app/linewidth_area.c     Wed Mar 01 22:43:56 2000
@@ -19,6 +19,11 @@
 #include "attributes.h"
 #include "intl.h"

+#if !defined(rint)
+# include <math.h>
+# define rint(x) floor ((x) + 0.5)
+#endif
+
 #define BASE_WIDTH 0.05
 #define PIXELS_BETWEEN_LINES 6
 #define NUMLINES 5
diff -u -r --exclude=*.obj from-cvs/dia/app/preferences.c my-gtk/dia/app/preferences.c
--- from-cvs/dia/app/preferences.c      Tue Feb 29 21:45:54 2000
+++ my-gtk/dia/app/preferences.c        Wed Mar 01 22:37:26 2000
@@ -38,6 +38,7 @@
 #include "widgets.h"
 #include "diagram.h"
 #include "preferences.h"
+#include "message.h"

 struct DiaPreferences prefs;

diff -u -r --exclude=*.obj from-cvs/dia/app/render_svg.c my-gtk/dia/app/render_svg.c
--- from-cvs/dia/app/render_svg.c       Tue Feb 29 21:45:54 2000
+++ my-gtk/dia/app/render_svg.c Wed Mar 01 22:48:58 2000
@@ -22,6 +22,7 @@
 #include <time.h>
 #include <math.h>
 #include <unistd.h>
+#include <malloc.h>

 #include <entities.h>

diff -u -r --exclude=*.obj from-cvs/dia/lib/properties.c my-gtk/dia/lib/properties.c
--- from-cvs/dia/lib/properties.c       Sat Feb 26 12:10:04 2000
+++ my-gtk/dia/lib/properties.c Wed Mar 01 23:11:10 2000
@@ -21,6 +21,7 @@

 #include <gtk/gtk.h>
 #include <string.h>
+#include <stdlib.h>

 #include "geometry.h"
 #include "arrows.h"
@@ -1094,7 +1095,7 @@
 }

 /* --------------------------------------- */
-
+#if 0 /* HB: see properties header */
 /* standard property extra data members */
 PropNumData prop_std_line_width_data = { 0.0, 10.0, 0.01 };
 PropNumData prop_std_text_height_data = { 0.1, 10.0, 0.1 };
@@ -1104,3 +1105,4 @@
   { N_("Right"), ALIGN_RIGHT },
   { NULL, 0 }
 };
+#endif

diff -u -r --exclude=*.obj from-cvs/dia/lib/properties.h my-gtk/dia/lib/properties.h
--- from-cvs/dia/lib/properties.h       Sat Feb 26 12:10:04 2000
+++ my-gtk/dia/lib/properties.h Wed Mar 01 23:16:48 2000
@@ -27,6 +27,8 @@
 #include <stddef.h>
 #endif

+#include "intl.h"
+
 #include "geometry.h"
 #include "render.h"
 #include "arrows.h"
@@ -305,8 +307,24 @@
  * of a number of objects should be greater, making setting properties on
  * groups better. */

+#if 0
+/* HB: exporting these vars, does mean the pointers used below have to
+ * be calculated at run-time by the loader, because they will exist
+ * only once in the process space. Indeed it causes compile
+ * time errors with MSVC (initialzer not a constant).
+ */
 DIAVAR PropNumData prop_std_line_width_data, prop_std_text_height_data;
 DIAVAR PropEnumData prop_std_text_align_data[];
+#else
+static PropNumData prop_std_line_width_data = { 0.0, 10.0, 0.01 };
+static PropNumData prop_std_text_height_data = { 0.1, 10.0, 0.1 };
+static PropEnumData prop_std_text_align_data[] = {
+  { N_("Left"), ALIGN_LEFT },
+  { N_("Center"), ALIGN_CENTER },
+  { N_("Right"), ALIGN_RIGHT },
+  { NULL, 0 }
+};
+#endif

 #define PROP_STD_LINE_WIDTH \
   { "line_width", PROP_TYPE_REAL, PROP_FLAG_VISIBLE, \

-------- Hans "at" Breuer "dot" Org -----------
Tell me what you need, and I'll tell you how to 
get along without it.                -- Dilbert

Reply via email to