dia r3986 - in trunk: lib plug-ins/cairo plug-ins/xfig samples



Author: hans
Date: Sun May  4 11:13:22 2008
New Revision: 3986
URL: http://svn.gnome.org/viewvc/dia?rev=3986&view=rev

Log:
2008-05-04  Hans Breuer  <hans breuer org>

	* plug-ins/xfig/xfig-import.c lib/create.h(create_standard_arc) : the 
	fifth parameter was named and treated as radius alsthough it set the
	"curve_distance"
	* lib/create.c(create_standard_arc) : also the second point passed in
	was simply ignored. Now it moves the second handle. Part of bug #436148
	
	* plug-ins/cairo/diacairo.c : more exporters marked as FILTER_DONT_GUESS
	Fixes writing of (old) WMF, but text is missing for both EMF and WMF.

	* samples/render-test.dia : fixed some alignments and colors



Modified:
   trunk/lib/create.c
   trunk/lib/create.h
   trunk/plug-ins/cairo/diacairo.c
   trunk/plug-ins/xfig/xfig-import.c
   trunk/samples/render-test.dia

Modified: trunk/lib/create.c
==============================================================================
--- trunk/lib/create.c	(original)
+++ trunk/lib/create.c	Sun May  4 11:13:22 2008
@@ -282,13 +282,13 @@
 
 DiaObject *
 create_standard_arc(real x1, real y1, real x2, real y2,
-		    real radius, 
+		    real distance, 
 		    Arrow *end_arrow,
 		    Arrow *start_arrow) {
     DiaObjectType *otype = object_get_type("Standard - Arc");
     DiaObject *new_obj;
     Handle *h1, *h2;
-    Point point;
+    Point p1, p2;
     GPtrArray *props;
 
     if (otype == NULL){
@@ -296,16 +296,19 @@
 	return NULL;
     }
 
-    point.x = x1;
-    point.y = y1;
+    p1.x = x1;
+    p1.y = y1;
+    p2.x = x2;
+    p2.y = y2;
 
-    new_obj = otype->ops->create(&point, otype->default_user_data,
+
+    new_obj = otype->ops->create(&p1, otype->default_user_data,
 				 &h1, &h2);
-    
+    new_obj->ops->move_handle(new_obj, h2, &p2, NULL, HANDLE_MOVE_USER_FINAL,0);
     props = prop_list_from_descs(create_arc_prop_descs,pdtpp_true);
     g_assert(props->len == 3);
     
-    ((RealProperty *)g_ptr_array_index(props,0))->real_data = radius;
+    ((RealProperty *)g_ptr_array_index(props,0))->real_data = distance;
     if (start_arrow != NULL)
 	((ArrowProperty *)g_ptr_array_index(props, 1))->arrow_data = *start_arrow;
     if (end_arrow != NULL)

Modified: trunk/lib/create.h
==============================================================================
--- trunk/lib/create.h	(original)
+++ trunk/lib/create.h	Sun May  4 11:13:22 2008
@@ -60,7 +60,7 @@
 create_standard_beziergon(int num_points, BezPoint *points);
 DiaObject *
 create_standard_arc(real x1, real y1, real x2, real y2,
-		    real radius, 
+		    real curve_distance, 
 		    Arrow *end_arrow, Arrow *start_arrow);
 DiaObject *
 create_standard_image(real xpos, real ypos, real width, real height,

Modified: trunk/plug-ins/cairo/diacairo.c
==============================================================================
--- trunk/plug-ins/cairo/diacairo.c	(original)
+++ trunk/plug-ins/cairo/diacairo.c	Sun May  4 11:13:22 2008
@@ -251,7 +251,24 @@
     } else {
       message_error (_("Can't write %d bytes to %s"), nSize, filename_utf8);
     }
-    DeleteEnhMetaFile (hFileDC);
+    DeleteEnhMetaFile (hEmf);
+    g_free (pData);
+  } else if (OUTPUT_WMF == kind) {
+    FILE* f = g_fopen(filename_utf8, "wb");
+    HENHMETAFILE hEmf = CloseEnhMetaFile(hFileDC);
+    HDC hdc = GetDC(NULL);
+    UINT nSize = GetWinMetaFileBits (hEmf, 0, NULL, MM_ANISOTROPIC, hdc);
+    BYTE* pData = g_new(BYTE, nSize);
+    nSize = GetWinMetaFileBits (hEmf, nSize, pData, MM_ANISOTROPIC, hdc);
+    if (f) {
+      /* FIXME: write the placeable header */
+      fwrite(pData,1,nSize,f);
+      fclose(f);
+    } else {
+      message_error (_("Can't write %d bytes to %s"), nSize, filename_utf8);
+    }
+    ReleaseDC(NULL, hdc);
+    DeleteEnhMetaFile (hEmf);
     g_free (pData);
   }
 #endif
@@ -317,7 +334,8 @@
     svg_extensions,
     export_data,
     (void*)OUTPUT_SVG,
-    "cairo-svg"
+    "cairo-svg",
+    FILTER_DONT_GUESS /* don't use this if not asked explicit */
 };
 #endif
 
@@ -339,22 +357,24 @@
 };
 
 #if DIA_CAIRO_CAN_EMF
-static const gchar *emf_extensions[] = { "wmf", NULL };
+static const gchar *emf_extensions[] = { "emf", NULL };
 static DiaExportFilter emf_export_filter = {
-    N_("Cairo WMF"),
+    N_("Cairo EMF"),
     emf_extensions,
     export_data,
     (void*)OUTPUT_EMF,
-    "cairo-emf"
+    "cairo-emf",
+    FILTER_DONT_GUESS /* don't use this if not asked explicit */
 };
 
 static const gchar *wmf_extensions[] = { "wmf", NULL };
 static DiaExportFilter wmf_export_filter = {
-    N_("Cairo old WMF"),
+    N_("Cairo WMF"),
     wmf_extensions,
     export_data,
     (void*)OUTPUT_WMF,
-    "cairo-wmf"
+    "cairo-wmf",
+    FILTER_DONT_GUESS /* don't use this if not asked explicit */
 };
 #endif
 

Modified: trunk/plug-ins/xfig/xfig-import.c
==============================================================================
--- trunk/plug-ins/xfig/xfig-import.c	(original)
+++ trunk/plug-ins/xfig/xfig-import.c	Sun May  4 11:13:22 2008
@@ -338,7 +338,7 @@
 static char *
 fig_read_text_line(FILE *file) {
     char *text_buf;
-    int text_alloc, text_len;
+    guint text_alloc, text_len;
 
     getc(file);
     text_alloc = 80;
@@ -835,6 +835,8 @@
     int x3, y3;
     real radius;
     char* old_locale;
+    Point p2, pm;
+    real distance;
 
     old_locale = setlocale(LC_NUMERIC, "C");
     if (fscanf(file, "%d %d %d %d %d %d %d %d %lf %d %d %d %d %lf %lf %d %d %d %d %d %d\n",
@@ -868,13 +870,16 @@
     }
 
     radius = sqrt((x1-center_x)*(x1-center_x)+(y1-center_y)*(y1-center_y))/FIG_UNIT;
+    p2.x = x2/FIG_UNIT; p2.y = y2/FIG_UNIT;
+    pm.x = (x1+x3)/(2*FIG_UNIT); pm.y = (y1+y3)/(2*FIG_UNIT);
+    distance = distance_point_point (&p2, &pm);
 
     switch (sub_type) {
     case 0: /* We can't do pie-wedge properly yet */
     case 1: 
 	newobj = create_standard_arc(x1/FIG_UNIT, y1/FIG_UNIT,
 				     x3/FIG_UNIT, y3/FIG_UNIT,
-				     radius, 
+				     direction ? distance : -distance, 
 				     forward_arrow_info,
 				     backward_arrow_info);
 	if (newobj == NULL) goto exit;

Modified: trunk/samples/render-test.dia
==============================================================================
Binary files. No diff available.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]