Code

LIBNR REMOVAL. remove nartbpath code!!!
[inkscape.git] / src / extension / internal / javafx-out.cpp
index 070b59781a0334cd91aeef8dd4b21899d0990637..967ddd92d72a57fd541a29b13b08a42ae31f390e 100644 (file)
@@ -60,9 +60,11 @@ namespace Internal
 static void err(const char *fmt, ...)\r
 {\r
     va_list args;\r
+    g_log(NULL,  G_LOG_LEVEL_WARNING, "javafx-out err: ");\r
     va_start(args, fmt);\r
     g_logv(NULL, G_LOG_LEVEL_WARNING, fmt, args);\r
     va_end(args);\r
+    g_log(NULL,  G_LOG_LEVEL_WARNING, "\n");\r
 }\r
 \r
 \r
@@ -96,7 +98,8 @@ static double effective_opacity(const SPStyle *style)
 \r
 \r
 /**\r
- * We want to control floating output format\r
+ * We want to control floating output format.\r
+ * Especially to avoid localization. (decimal ',' for example)\r
  */\r
 static JavaFXOutput::String dstr(double d)\r
 {\r
@@ -109,6 +112,10 @@ static JavaFXOutput::String dstr(double d)
 \r
 #define DSTR(d) (dstr(d).c_str())\r
 \r
+\r
+/**\r
+ * Format a double as an integer\r
+ */\r
 static JavaFXOutput::String istr(double d)\r
 {\r
     char dbuf[G_ASCII_DTOSTR_BUF_SIZE+1];\r
@@ -120,6 +127,7 @@ static JavaFXOutput::String istr(double d)
 \r
 #define ISTR(d) (istr(d).c_str())\r
 \r
+\r
 /**\r
  * Format an rgba() string\r
  */\r
@@ -204,7 +212,7 @@ bool JavaFXOutput::doHeader()
     out("/*###################################################################\n");\r
     out("### This JavaFX document was generated by Inkscape\n");\r
     out("### http://www.inkscape.org\n");\r
-    out("### Created: %s", ctime(&tim));\r
+    out("### Created: %s",   ctime(&tim));\r
     out("### Version: %s\n", INKSCAPE_VERSION);\r
     out("#####################################################################\n");\r
     out("### NOTES:\n");\r
@@ -263,7 +271,7 @@ bool JavaFXOutput::doTail()
     // Frame\r
     out("Frame {\n");\r
     out("    title: \"%s\"\n", name.c_str());\r
-    out("    width: %s\n", ISTR(maxx-minx + border * 2.0));\r
+    out("    width: %s\n",  ISTR(maxx-minx + border * 2.0));\r
     out("    height: %s\n", ISTR(maxy-miny + border * 2.0));\r
     out("    visible: true\n");\r
 \r
@@ -306,7 +314,7 @@ bool JavaFXOutput::doGradient(SPGradient *grad, const String &id)
                 SPGradientStop stop = stops[i];\r
                 out("                Stop {\n");\r
                 out("                    offset: %s\n", DSTR(stop.offset));\r
-                out("                    color: %s\n", rgba(stop.color, stop.opacity).c_str());\r
+                out("                    color: %s\n",  rgba(stop.color, stop.opacity).c_str());\r
                 out("                },\n");\r
                 }\r
             out("            ]\n");\r
@@ -323,9 +331,9 @@ bool JavaFXOutput::doGradient(SPGradient *grad, const String &id)
         out("        RadialGradient {\n");\r
         out("            centerX: %s\n", DSTR(g->cx.value));\r
         out("            centerY: %s\n", DSTR(g->cy.value));\r
-        out("            focusX: %s\n", DSTR(g->fx.value));\r
-        out("            focusY: %s\n", DSTR(g->fy.value));\r
-        out("            radius: %s\n", DSTR(g->r.value));\r
+        out("            focusX: %s\n",  DSTR(g->fx.value));\r
+        out("            focusY: %s\n",  DSTR(g->fy.value));\r
+        out("            radius: %s\n",  DSTR(g->r.value ));\r
         std::vector<SPGradientStop> stops = g->vector.stops;\r
         if (stops.size() > 0)\r
             {\r
@@ -336,7 +344,7 @@ bool JavaFXOutput::doGradient(SPGradient *grad, const String &id)
                 SPGradientStop stop = stops[i];\r
                 out("                Stop {\n");\r
                 out("                    offset: %s\n", DSTR(stop.offset));\r
-                out("                    color: %s\n", rgba(stop.color, stop.opacity).c_str());\r
+                out("                    color: %s\n",  rgba(stop.color, stop.opacity).c_str());\r
                 out("                },\n");\r
                 }\r
             out("            ]\n");\r
@@ -411,11 +419,11 @@ bool JavaFXOutput::doStyle(SPStyle *style)
         out("            stroke: %s\n",\r
             rgba(stroke.value.color, SP_SCALE24_TO_FLOAT(style->stroke_opacity.value)).c_str());\r
         double strokewidth = style->stroke_width.value;\r
-        unsigned linecap = style->stroke_linecap.value;\r
-        unsigned linejoin = style->stroke_linejoin.value;\r
-        out("            strokeWidth: %s\n", DSTR(strokewidth));\r
-        out("            strokeLineCap: %s\n", getStrokeLineCap(linecap).c_str());\r
-        out("            strokeLineJoin: %s\n", getStrokeLineJoin(linejoin).c_str());\r
+        unsigned linecap   = style->stroke_linecap.value;\r
+        unsigned linejoin  = style->stroke_linejoin.value;\r
+        out("            strokeWidth: %s\n",      DSTR(strokewidth));\r
+        out("            strokeLineCap: %s\n",    getStrokeLineCap(linecap).c_str());\r
+        out("            strokeLineJoin: %s\n",   getStrokeLineJoin(linejoin).c_str());\r
         out("            strokeMiterLimit: %s\n", DSTR(style->stroke_miterlimit.value));\r
         if(style->stroke_dasharray_set) {\r
            if(style->stroke_dashoffset_set) {\r
@@ -509,9 +517,9 @@ bool JavaFXOutput::doCurve(SPItem *item, const String &id)
         for (Geom::Path::const_iterator cit = pit->begin(); cit != pit->end_closed(); ++cit)\r
             {\r
             //### LINE\r
-            if( dynamic_cast<Geom::LineSegment const *> (&*cit) ||\r
-                dynamic_cast<Geom::HLineSegment const *>(&*cit) ||\r
-                dynamic_cast<Geom::VLineSegment const *>(&*cit) )\r
+            if( dynamic_cast<Geom::LineSegment  const *> (&*cit) ||\r
+                dynamic_cast<Geom::HLineSegment const *> (&*cit) ||\r
+                dynamic_cast<Geom::VLineSegment const *> (&*cit) )\r
                 {\r
                 Geom::Point p = cit->finalPoint();\r
                 out("                LineTo {\n");\r
@@ -532,8 +540,8 @@ bool JavaFXOutput::doCurve(SPItem *item, const String &id)
                 out("                    controlY1: %s\n", DSTR(p1[Y]));\r
                 out("                    controlX2: %s\n", DSTR(p2[X]));\r
                 out("                    controlY2: %s\n", DSTR(p2[Y]));\r
-                out("                    x: %s\n", DSTR(p3[X]));\r
-                out("                    y: %s\n", DSTR(p3[Y]));\r
+                out("                    x: %s\n",         DSTR(p3[X]));\r
+                out("                    y: %s\n",         DSTR(p3[Y]));\r
                 out("                },\n");\r
                 nrNodes++;\r
                 }\r