Code

Fix bug #552289 - Ungrouping objects changes position of arrow lines. This was due...
[inkscape.git] / src / number-opt-number.h
index abbc759d83fa2ac2891bd7ad78d932e2238c047b..b2f2f2a1ed94c737284623596c178721769dc38f 100644 (file)
  * Released under GNU GPL, read the file 'COPYING' for more information
  */
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <glib.h>
 #include <glib/gprintf.h>
 //todo: use glib instead of stdlib
 #include <stdlib.h>
+#include "svg/stringstream.h"
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+
+gdouble fixed_g_ascii_strtod (const gchar *nptr, gchar **endptr);
 
 class NumberOptNumber {
 
@@ -69,20 +73,30 @@ public:
         number = num;
     }
 
-    gchar *getValueString(gchar *str)
+    bool optNumIsSet(){
+        return optNumber_set;
+    }
+
+    bool numIsSet(){
+        return _set;
+    }
+    
+    gchar *getValueString()
     {
+        Inkscape::SVGOStringStream os;
+
         if( _set )
         {
 
             if( optNumber_set )
             {
-                g_sprintf(str, "%lf %lf", number, optNumber);
+                os << number << " " << optNumber;
             }
             else {
-                g_sprintf(str, "%lf", number);
+                os << number;
             }
         }
-        return str;
+        return g_strdup(os.str().c_str());
     }
 
     void set(gchar const *str)
@@ -94,13 +108,12 @@ public:
 
         if( values[0] != NULL )
         {
-            number = strtof(values[0], NULL);
+            number = g_ascii_strtod(values[0], NULL);
             _set = TRUE;
 
             if( values[1] != NULL )
             {
-  //              optNumber = g_ascii_strtod(values[1], NULL);
-                optNumber = strtof(values[1], NULL);
+                optNumber = g_ascii_strtod(values[1], NULL);
                 optNumber_set = TRUE;
             }
             else
@@ -125,4 +138,4 @@ public:
   fill-column:99
   End:
 */
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :