summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2013-03-19 09:38:56 +0000
committerJabiertxo Arraiza Zenotz <jtx@jtx.marker.es>2013-03-19 09:38:56 +0000
commit757f1b17bf5db6b7b5cc8725a0ee3c438c08cafc (patch)
treec62786af287828f0f70dba2e079be3cea604d8f4
parentWorking width widgets (diff)
parentDrop remaining unused functions (diff)
downloadinkscape-757f1b17bf5db6b7b5cc8725a0ee3c438c08cafc.tar.gz
inkscape-757f1b17bf5db6b7b5cc8725a0ee3c438c08cafc.zip
Widgets to effect added
(bzr r11950.1.59)
-rw-r--r--configure.ac11
-rw-r--r--share/extensions/hpgl_output.inx117
-rwxr-xr-xshare/extensions/hpgl_output.py20
-rw-r--r--src/bind/javabind.cpp83
-rw-r--r--src/dialogs/CMakeLists.txt2
-rw-r--r--src/dialogs/Makefile_insert4
-rw-r--r--src/dialogs/find.cpp684
-rw-r--r--src/dialogs/find.h29
-rw-r--r--src/document.cpp2
-rw-r--r--src/libgdl/Makefile_insert11
-rw-r--r--src/libnrtype/font-lister.cpp21
-rw-r--r--src/libnrtype/font-lister.h10
-rw-r--r--src/livarot/PathSimplify.cpp3
-rw-r--r--src/live_effects/lpe-dynastroke.cpp24
-rw-r--r--src/marker.cpp2
-rw-r--r--src/pen-context.cpp2
-rw-r--r--src/pencil-context.cpp11
-rw-r--r--src/sp-item.h3
-rw-r--r--src/spray-context.cpp13
-rw-r--r--src/trace/quantize.cpp2
-rw-r--r--src/ui/control-manager.cpp15
-rw-r--r--src/ui/dialog/export.cpp5
-rw-r--r--src/ui/dialog/filedialogimpl-gtkmm.cpp8
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp4
-rw-r--r--src/ui/dialog/text-edit.cpp3
-rw-r--r--src/ui/tool/multi-path-manipulator.cpp1
-rw-r--r--src/ui/tool/node.cpp2
-rw-r--r--src/ui/widget/layer-selector.cpp11
-rw-r--r--src/ui/widget/licensor.cpp3
-rw-r--r--src/verbs.cpp1
-rw-r--r--src/xml/repr-util.cpp65
31 files changed, 153 insertions, 1019 deletions
diff --git a/configure.ac b/configure.ac
index 219748f28..ec3d3f29f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -112,6 +112,17 @@ if test "$GCC" = "yes"; then
CFLAGS="$ink_svd_CFLAGS"
fi
+
+ # This Automake variable is only used to suppress warnings in our internal
+ # fork of GDL. Once we get rid of our GDL fork, we can delete this test
+ AC_MSG_CHECKING([compiler support for -Wno-unused-but-set-variable])
+ ink_svd_CFLAGS="$CFLAGS"
+ CFLAGS="-Wno-unused-but-set-variable $CFLAGS"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], [ink_opt_ok=yes], [ink_opt_ok=no])
+ AC_MSG_RESULT([$ink_opt_ok])
+ CFLAGS="$ink_svd_CFLAGS"
+ AM_CONDITIONAL(CC_WNO_UNUSED_BUT_SET_VARIABLE_SUPPORTED, test "$ink_opt_ok" = "yes")
+
####
# Linker flags...
diff --git a/share/extensions/hpgl_output.inx b/share/extensions/hpgl_output.inx
index b54276911..492df0b0d 100644
--- a/share/extensions/hpgl_output.inx
+++ b/share/extensions/hpgl_output.inx
@@ -1,61 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
- <_name>HPGL Output</_name>
- <id>org.ekips.output.hpgl</id>
- <dependency type="extension">org.inkscape.output.svg.inkscape</dependency>
- <dependency type="executable" location="extensions">hpgl_output.py</dependency>
- <dependency type="executable" location="extensions">inkex.py</dependency>
- <_param name="introduction" type="description">Please make sure that all objects you want to plot are converted to paths. The plot will automatically be aligned to the zero point.</_param>
- <param name="horizontal_guide" type="description">—————————————————————————————</param>
- <param name="resolution" type="int" min="90" max="2048" _gui-text="Resolution (dpi)" _gui-description="The amount of steps the cutter moves if it moves for 1 inch, either get this value from your plotter manual or learn it by trial and error (Standard: '1016')">1016</param>
- <param name="pen" type="int" min="1" max="10" _gui-text="Pen number" _gui-description="The number of the pen (tool) to use, on most plotters 1 (Standard: '1')">1</param>
- <param name="angle" type="optiongroup" appearance="minimal" _gui-text="Orientation" _gui-description="Orientation of the plot, change this if your plotter is plotting horizontal instead of vertical (Standard: '90°')">
- <option value="90">90°</option>
- <option value="-90">-90°</option>
- <option value="0">0°</option>
- <option value="180">180°</option>
- </param>
- <param name="mirror" type="boolean" _gui-text="Mirror Y-axis" _gui-description="Whether to mirror the Y axis. Some plotters need this, some not. Look in your plotter manual or learn it by trial and error (Standard: 'False')">false</param>
- <param name="flat" type="float" min="0.1" max="10.0" precision="1" _gui-text="Curve flatness" _gui-description="Curves are divided into lines, this number controls how fine the curves will be reproduced, the smaller the finer (Standard: '1.2')">1.2</param>
- <param name="horizontal_guide" type="description">—————————————————————————————</param>
- <param name="useOvercut" type="boolean" _gui-text="Use Overcut" _gui-description="Whether the overcut will be used, if not the 'Overcut' parameter is unused (Standard: 'True')">true</param>
- <param name="overcut" type="float" min="0.0" max="100.0" precision="2" _gui-text="Overcut (mm)" _gui-description="The distance in mm that will be cut over the starting point of the path to prevent open paths (Standard: '1.00')">1.00</param>
- <param name="horizontal_guide" type="description">—————————————————————————————</param>
- <param name="correctToolOffset" type="boolean" _gui-text="Correct tool offset" _gui-description="Whether the tool offset should be corrected, if not the 'Tool offset' and 'Return Factor' parameters are unused (Standard: 'True')">true</param>
- <param name="toolOffset" type="float" min="0.0" max="100.0" precision="2" _gui-text="Tool offset (mm)" _gui-description="The offset from the tool tip to the tool axis in mm (Standard: '0.25')">0.25</param>
- <param name="toolOffsetReturn" type="float" min="1.0" max="10.0" precision="2" _gui-text="Return Factor" _gui-description="The return factor multiplied by the tool offset is the length that is used to guide the tool back to the original path after an overcut is performed, you can only determine this value by experimentation (Standard: '2.50')">2.50</param>
- <param name="horizontal_guide" type="description">—————————————————————————————</param>
- <param name="xOffset" type="float" min="0.0" max="10000.0" precision="2" _gui-text="X offset (mm)" _gui-description="The offset to move your plot away from the zero point in mm (Standard: '0.00')">0.00</param>
- <param name="yOffset" type="float" min="0.0" max="10000.0" precision="2" _gui-text="Y offset (mm)" _gui-description="The offset to move your plot away from the zero point in mm (Standard: '0.00')">0.00</param>
- <param name="plotInvisibleLayers" type="boolean" _gui-text="Plot invisible layers" _gui-description="Plot invisible layers (Standard: 'False')">false</param>
- <param name="horizontal_guide" type="description">—————————————————————————————</param>
- <param name="sendToPlotter" type="boolean" _gui-text="Send to Plotter also" _gui-description="Sends the generated HPGL data also via serial connection to your plotter (Standard: 'False')">false</param>
- <param name="port" type="string" _gui-text="Serial Port" _gui-description="The port of your serial connection, on Windows something like 'COM1', on Linux something like: '/dev/ttyUSB0' (Standard: 'COM1')">COM1</param>
- <param name="baudRate" type="optiongroup" appearance="minimal" _gui-text="Baud Rate" _gui-description="The Baud rate of your serial connection (Standard: '9600')">
- <option value="110">110</option>
- <option value="300">300</option>
- <option value="600">600</option>
- <option value="1200">1200</option>
- <option value="2400">2400</option>
- <option value="4800">4800</option>
- <option value="9600">9600</option>
- <option value="14400">14400</option>
- <option value="19200">19200</option>
- <option value="28800">28800</option>
- <option value="38400">38400</option>
- <option value="56000">56000</option>
- <option value="57600">57600</option>
- <option value="115200">115200</option>
- </param>
- <output>
- <extension>.hpgl</extension>
- <mimetype>image/hpgl</mimetype>
- <_filetypename>HP Graphics Language file (*.hpgl)</_filetypename>
- <_filetypetooltip>Export to an HP Graphics Language file</_filetypetooltip>
- <dataloss>true</dataloss>
- </output>
- <script>
- <command reldir="extensions" interpreter="python">hpgl_output.py</command>
- <helper_extension>org.inkscape.output.svg.inkscape</helper_extension>
- </script>
+ <_name>HPGL Output</_name>
+ <id>org.ekips.output.hpgl</id>
+ <dependency type="extension">org.inkscape.output.svg.inkscape</dependency>
+ <dependency type="executable" location="extensions">hpgl_output.py</dependency>
+ <dependency type="executable" location="extensions">inkex.py</dependency>
+ <_param name="introduction" type="description">Please make sure that all objects you want to plot are converted to paths. The plot will automatically be aligned to the zero point.</_param>
+ <param name="horizontal_guide" type="description">—————————————————————————————</param>
+ <param name="resolution" type="int" min="90" max="2048" _gui-text="Resolution (dpi)" _gui-description="The amount of steps the cutter moves if it moves for 1 inch, either get this value from your plotter manual or learn it by trial and error (Standard: '1016')">1016</param>
+ <param name="pen" type="int" min="1" max="10" _gui-text="Pen number" _gui-description="The number of the pen (tool) to use, on most plotters 1 (Standard: '1')">1</param>
+ <param name="angle" type="optiongroup" appearance="minimal" _gui-text="Orientation" _gui-description="Orientation of the plot, change this if your plotter is plotting horizontal instead of vertical (Standard: '90°')">
+ <option value="90">90°</option>
+ <option value="-90">-90°</option>
+ <option value="0">0°</option>
+ <option value="180">180°</option>
+ </param>
+ <param name="mirror" type="boolean" _gui-text="Mirror Y-axis" _gui-description="Whether to mirror the Y axis. Some plotters need this, some not. Look in your plotter manual or learn it by trial and error (Standard: 'False')">false</param>
+ <param name="center" type="boolean" _gui-text="Center Zero Point" _gui-description="Whether the plotter needs the zero point to be in the center of the drawing. Some plotters need this, some not. Look in your plotter manual or learn it by trial and error (Standard: 'False')">false</param>
+ <param name="flat" type="float" min="0.1" max="10.0" precision="1" _gui-text="Curve flatness" _gui-description="Curves are divided into lines, this number controls how fine the curves will be reproduced, the smaller the finer (Standard: '1.2')">1.2</param>
+ <param name="horizontal_guide" type="description">—————————————————————————————</param>
+ <param name="useOvercut" type="boolean" _gui-text="Use Overcut" _gui-description="Whether the overcut will be used, if not the 'Overcut' parameter is unused (Standard: 'True')">true</param>
+ <param name="overcut" type="float" min="0.0" max="100.0" precision="2" _gui-text="Overcut (mm)" _gui-description="The distance in mm that will be cut over the starting point of the path to prevent open paths (Standard: '1.00')">1.00</param>
+ <param name="horizontal_guide" type="description">—————————————————————————————</param>
+ <param name="correctToolOffset" type="boolean" _gui-text="Correct tool offset" _gui-description="Whether the tool offset should be corrected, if not the 'Tool offset' and 'Return Factor' parameters are unused (Standard: 'True')">true</param>
+ <param name="toolOffset" type="float" min="0.0" max="100.0" precision="2" _gui-text="Tool offset (mm)" _gui-description="The offset from the tool tip to the tool axis in mm (Standard: '0.25')">0.25</param>
+ <param name="toolOffsetReturn" type="float" min="1.0" max="10.0" precision="2" _gui-text="Return Factor" _gui-description="The return factor multiplied by the tool offset is the length that is used to guide the tool back to the original path after an overcut is performed, you can only determine this value by experimentation (Standard: '2.50')">2.50</param>
+ <param name="horizontal_guide" type="description">—————————————————————————————</param>
+ <param name="xOffset" type="float" min="0.0" max="10000.0" precision="2" _gui-text="X offset (mm)" _gui-description="The offset to move your plot away from the zero point in mm (Standard: '0.00')">0.00</param>
+ <param name="yOffset" type="float" min="0.0" max="10000.0" precision="2" _gui-text="Y offset (mm)" _gui-description="The offset to move your plot away from the zero point in mm (Standard: '0.00')">0.00</param>
+ <param name="plotInvisibleLayers" type="boolean" _gui-text="Plot invisible layers" _gui-description="Plot invisible layers (Standard: 'False')">false</param>
+ <param name="horizontal_guide" type="description">—————————————————————————————</param>
+ <param name="sendToPlotter" type="boolean" _gui-text="Send to Plotter also" _gui-description="Sends the generated HPGL data also via serial connection to your plotter (Standard: 'False')">false</param>
+ <param name="port" type="string" _gui-text="Serial Port" _gui-description="The port of your serial connection, on Windows something like 'COM1', on Linux something like: '/dev/ttyUSB0' (Standard: 'COM1')">COM1</param>
+ <param name="baudRate" type="optiongroup" appearance="minimal" _gui-text="Baud Rate" _gui-description="The Baud rate of your serial connection (Standard: '9600')">
+ <option value="110">110</option>
+ <option value="300">300</option>
+ <option value="600">600</option>
+ <option value="1200">1200</option>
+ <option value="2400">2400</option>
+ <option value="4800">4800</option>
+ <option value="9600">9600</option>
+ <option value="14400">14400</option>
+ <option value="19200">19200</option>
+ <option value="28800">28800</option>
+ <option value="38400">38400</option>
+ <option value="56000">56000</option>
+ <option value="57600">57600</option>
+ <option value="115200">115200</option>
+ </param>
+ <output>
+ <extension>.hpgl</extension>
+ <mimetype>image/hpgl</mimetype>
+ <_filetypename>HP Graphics Language file (*.hpgl)</_filetypename>
+ <_filetypetooltip>Export to an HP Graphics Language file</_filetypetooltip>
+ <dataloss>true</dataloss>
+ </output>
+ <script>
+ <command reldir="extensions" interpreter="python">hpgl_output.py</command>
+ <helper_extension>org.inkscape.output.svg.inkscape</helper_extension>
+ </script>
</inkscape-extension>
diff --git a/share/extensions/hpgl_output.py b/share/extensions/hpgl_output.py
index 38d95ac09..83d6da5af 100755
--- a/share/extensions/hpgl_output.py
+++ b/share/extensions/hpgl_output.py
@@ -31,6 +31,10 @@ class MyEffect(inkex.Effect):
action="store", type="inkbool",
dest="mirror", default="FALSE",
help="Mirror Y-Axis")
+ self.OptionParser.add_option("-v", "--center",
+ action="store", type="inkbool",
+ dest="center", default="FALSE",
+ help="Center Zero Point")
self.OptionParser.add_option("-x", "--xOffset",
action="store", type="float",
dest="xOffset", default=0.0,
@@ -90,8 +94,10 @@ class MyEffect(inkex.Effect):
def effect(self):
# initiate vars
- self.xDivergence = 999999999999.0
- self.yDivergence = 999999999999.0
+ self.xDivergence = 9999999999999.0
+ self.yDivergence = 9999999999999.0
+ self.xSize = -9999999999999.0
+ self.ySize = -9999999999999.0
scale = float(self.options.resolution) / 90 # dots/inch to dots/pixels
x0 = self.options.xOffset * 3.5433070866 * scale # mm to dots
y0 = self.options.yOffset * 3.5433070866 * scale # mm to dots
@@ -117,6 +123,9 @@ class MyEffect(inkex.Effect):
self.groupmat[0] = simpletransform.composeTransform(self.groupmat[0], simpletransform.parseTransform('rotate(' + self.options.rotation + ')'))
self.vData = [['', -1.0, -1.0], ['', -1.0, -1.0], ['', -1.0, -1.0], ['', -1.0, -1.0]]
self.process_group(doc)
+ if self.options.center:
+ self.xDivergence += (self.xSize - self.xDivergence) / 2
+ self.yDivergence += (self.ySize - self.yDivergence) / 2
# life run
self.dryRun = False
self.groupmat = [[[scale*viewBoxTransformX, 0.0, -self.xDivergence + x0], [0.0, mirror*scale*viewBoxTransformY, -self.yDivergence + y0]]]
@@ -246,9 +255,12 @@ class MyEffect(inkex.Effect):
if self.dryRun:
if x < self.xDivergence: self.xDivergence = x
if y < self.yDivergence: self.yDivergence = y
+ if x > self.xSize: self.xSize = x
+ if y > self.ySize: self.ySize = y
else:
- if x < 0: x = 0 # only positive values are allowed
- if y < 0: y = 0
+ if not self.options.center:
+ if x < 0: x = 0 # only positive values are allowed
+ if y < 0: y = 0
self.hpgl += '%s%d,%d;' % (command, x, y)
if self.options.sendToPlotter:
self.S.write('%s%d,%d;' % (command, x, y))
diff --git a/src/bind/javabind.cpp b/src/bind/javabind.cpp
index d2d01f0b3..8a66bac59 100644
--- a/src/bind/javabind.cpp
+++ b/src/bind/javabind.cpp
@@ -138,71 +138,6 @@ String getExceptionString(JNIEnv *env)
return buf;
}
-static jint getObjInt(JNIEnv *env, jobject obj, const char *name)
-{
- jfieldID fid = env->GetFieldID(env->GetObjectClass(obj), name, "I");
- return env->GetIntField(obj, fid);
-}
-
-static void setObjInt(JNIEnv *env, jobject obj, const char *name, jint val)
-{
- jfieldID fid = env->GetFieldID(env->GetObjectClass(obj), name, "I");
- env->SetIntField(obj, fid, val);
-}
-
-static jlong getObjLong(JNIEnv *env, jobject obj, const char *name)
-{
- jfieldID fid = env->GetFieldID(env->GetObjectClass(obj), name, "J");
- return env->GetLongField(obj, fid);
-}
-
-static void setObjLong(JNIEnv *env, jobject obj, const char *name, jlong val)
-{
- jfieldID fid = env->GetFieldID(env->GetObjectClass(obj), name, "J");
- env->SetLongField(obj, fid, val);
-}
-
-static jfloat getObjFloat(JNIEnv *env, jobject obj, const char *name)
-{
- jfieldID fid = env->GetFieldID(env->GetObjectClass(obj), name, "F");
- return env->GetFloatField(obj, fid);
-}
-
-static void setObjFloat(JNIEnv *env, jobject obj, const char *name, jfloat val)
-{
- jfieldID fid = env->GetFieldID(env->GetObjectClass(obj), name, "F");
- env->SetFloatField(obj, fid, val);
-}
-
-static jdouble getObjDouble(JNIEnv *env, jobject obj, const char *name)
-{
- jfieldID fid = env->GetFieldID(env->GetObjectClass(obj), name, "D");
- return env->GetDoubleField(obj, fid);
-}
-
-static void setObjDouble(JNIEnv *env, jobject obj, const char *name, jdouble val)
-{
- jfieldID fid = env->GetFieldID(env->GetObjectClass(obj), name, "D");
- env->SetDoubleField(obj, fid, val);
-}
-
-static String getObjString(JNIEnv *env, jobject obj, const char *name)
-{
- jfieldID fid = env->GetFieldID(env->GetObjectClass(obj), name, "Ljava/lang/String;");
- jstring jstr = (jstring)env->GetObjectField(obj, fid);
- return getString(env, jstr);
-}
-
-static void setObjString(JNIEnv *env, jobject obj, const char *name, const String &val)
-{
- jstring jstr = env->NewStringUTF(val.c_str());
- jfieldID fid = env->GetFieldID(env->GetObjectClass(obj), name, "Ljava/lang/String;");
- env->SetObjectField(obj, fid, jstr);
-}
-
-
-
-
//########################################################################
//# CONSTRUCTOR/DESTRUCTOR
//########################################################################
@@ -241,40 +176,22 @@ JavaBinderyImpl::~JavaBinderyImpl()
void err(const char *fmt, ...)
{
-#if 0
- va_list args;
- fprintf(stderr, "JavaBinderyImpl err:");
- va_start(args, fmt);
- vfprintf(stderr, fmt, args);
- va_end(args);
- fprintf(stderr, "\n");
-#else
va_list args;
g_warning("JavaBinderyImpl err:");
va_start(args, fmt);
g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, fmt, args);
va_end(args);
g_warning("\n");
-#endif
}
void msg(const char *fmt, ...)
{
-#if 0
- va_list args;
- fprintf(stdout, "JavaBinderyImpl:");
- va_start(args, fmt);
- vfprintf(stdout, fmt, args);
- va_end(args);
- fprintf(stdout, "\n");
-#else
va_list args;
g_message("JavaBinderyImpl:");
va_start(args, fmt);
g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, fmt, args);
va_end(args);
g_message("\n");
-#endif
}
diff --git a/src/dialogs/CMakeLists.txt b/src/dialogs/CMakeLists.txt
index 1cd230a08..ca19c0b72 100644
--- a/src/dialogs/CMakeLists.txt
+++ b/src/dialogs/CMakeLists.txt
@@ -1,12 +1,10 @@
set(dialogs_SRC
dialog-events.cpp
- find.cpp
# -------
# Headers
dialog-events.h
- find.h
)
# add_inkscape_lib(dialogs_LIB "${dialogs_SRC}")
diff --git a/src/dialogs/Makefile_insert b/src/dialogs/Makefile_insert
index 62641ecb9..f1ed89314 100644
--- a/src/dialogs/Makefile_insert
+++ b/src/dialogs/Makefile_insert
@@ -2,6 +2,4 @@
ink_common_sources += \
dialogs/dialog-events.cpp \
- dialogs/dialog-events.h \
- dialogs/find.cpp \
- dialogs/find.h
+ dialogs/dialog-events.h
diff --git a/src/dialogs/find.cpp b/src/dialogs/find.cpp
deleted file mode 100644
index 3fabe4d97..000000000
--- a/src/dialogs/find.cpp
+++ /dev/null
@@ -1,684 +0,0 @@
-/**
- * @file
- * Find dialog.
- */
-/* Authors:
- * bulia byak <bulia@users.sf.net>
- * Jon A. Cruz <jon@joncruz.org>
- * Abhishek Sharma
- *
- * Copyright (C) 2004 Authors
- *
- * Released under GNU GPL, read the file 'COPYING' for more information
- */
-
-#include "widgets/icon.h"
-#include "message-stack.h"
-
-#include <gtk/gtk.h>
-
-#include <glibmm/i18n.h>
-#include "helper/window.h"
-#include "macros.h"
-#include "inkscape.h"
-#include "document.h"
-#include "desktop.h"
-#include "selection.h"
-#include "desktop-handles.h"
-
-#include "dialog-events.h"
-#include "../preferences.h"
-#include "../verbs.h"
-#include "../interface.h"
-#include "../sp-text.h"
-#include "../sp-flowtext.h"
-#include "../text-editing.h"
-#include "../sp-tspan.h"
-#include "../sp-tref.h"
-#include "../selection-chemistry.h"
-#include "../sp-defs.h"
-#include "../sp-rect.h"
-#include "../sp-ellipse.h"
-#include "../sp-star.h"
-#include "../sp-spiral.h"
-#include "../sp-path.h"
-#include "../sp-line.h"
-#include "../sp-polyline.h"
-#include "../sp-item-group.h"
-#include "../sp-use.h"
-#include "../sp-image.h"
-#include "../sp-offset.h"
-#include <xml/repr.h>
-#include "sp-root.h"
-
-#define MIN_ONSCREEN_DISTANCE 50
-
-static GtkWidget *dlg = NULL;
-static win_data wd;
-
-// impossible original values to make sure they are read from prefs
-static gint x = -1000, y = -1000, w = 0, h = 0;
-static Glib::ustring const prefs_path = "/dialogs/find/";
-
-
-static void sp_find_dialog_destroy(GObject *object, gpointer)
-{
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->setInt(prefs_path + "visible", 0);
-
- sp_signal_disconnect_by_data (INKSCAPE, object);
- wd.win = dlg = NULL;
- wd.stop = 0;
-}
-
-
-
-static gboolean sp_find_dialog_delete(GObject *, GdkEvent *, gpointer /*data*/)
-{
- gtk_window_get_position (GTK_WINDOW (dlg), &x, &y);
- gtk_window_get_size (GTK_WINDOW (dlg), &w, &h);
-
- if (x<0) x=0;
- if (y<0) y=0;
-
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->setInt(prefs_path + "x", x);
- prefs->setInt(prefs_path + "y", y);
- prefs->setInt(prefs_path + "w", w);
- prefs->setInt(prefs_path + "h", h);
-
- return FALSE; // which means, go ahead and destroy it
-}
-
-static void
-sp_find_squeeze_window()
-{
- GtkRequisition r;
-#if GTK_CHECK_VERSION(3,0,0)
- gtk_widget_get_preferred_size(dlg, &r, NULL);
-#else
- gtk_widget_size_request(dlg, &r);
-#endif
- gtk_window_resize (GTK_WINDOW(dlg), r.width, r.height);
-}
-
-static bool
-item_id_match (SPItem *item, const gchar *id, bool exact)
-{
- if (item->getRepr() == NULL) {
- return false;
- }
-
- if (SP_IS_STRING(item)) { // SPStrings have "on demand" ids which are useless for searching
- return false;
- }
-
- const gchar *item_id = item->getRepr()->attribute("id");
- if (item_id == NULL) {
- return false;
- }
-
- if (exact) {
- return ((bool) !strcmp(item_id, id));
- } else {
-// g_print ("strstr: %s %s: %s\n", item_id, id, strstr(item_id, id) != NULL? "yes":"no");
- return ((bool) (strstr(item_id, id) != NULL));
- }
-}
-
-static bool
-item_text_match (SPItem *item, const gchar *text, bool exact)
-{
- if (item->getRepr() == NULL) {
- return false;
- }
-
- if (SP_IS_TEXT(item) || SP_IS_FLOWTEXT(item)) {
- const gchar *item_text = sp_te_get_string_multiline (item);
- if (item_text == NULL)
- return false;
- bool ret;
- if (exact) {
- ret = ((bool) !strcasecmp(item_text, text));
- } else {
- //FIXME: strcasestr
- ret = ((bool) (strstr(item_text, text) != NULL));
- }
- g_free(static_cast<void*>(g_strdup(item_text)));
- return ret;
- }
- return false;
-}
-
-static bool
-item_style_match (SPItem *item, const gchar *text, bool exact)
-{
- if (item->getRepr() == NULL) {
- return false;
- }
-
- const gchar *item_text = item->getRepr()->attribute("style");
- if (item_text == NULL) {
- return false;
- }
-
- if (exact) {
- return ((bool) !strcmp(item_text, text));
- } else {
- return ((bool) (strstr(item_text, text) != NULL));
- }
-}
-
-static bool
-item_attr_match(SPItem *item, const gchar *name, bool exact)
-{
- bool result = false;
- if (item->getRepr()) {
- if (exact) {
- const gchar *attr_value = item->getRepr()->attribute(name);
- result = (attr_value != NULL);
- } else {
- result = item->getRepr()->matchAttributeName(name);
- }
- }
- return result;
-}
-
-
-static GSList *
-filter_onefield (GSList *l, GObject *dlg, const gchar *field, bool (*match_function)(SPItem *, const gchar *, bool), bool exact)
-{
- GtkWidget *widget = GTK_WIDGET (g_object_get_data(G_OBJECT (dlg), field));
- const gchar *text = gtk_entry_get_text (GTK_ENTRY(widget));
-
- if (strlen (text) != 0) {
- GSList *n = NULL;
- for (GSList *i = l; i != NULL; i = i->next) {
- if (match_function (SP_ITEM(i->data), text, exact)) {
- n = g_slist_prepend (n, i->data);
- }
- }
- return n;
- } else {
- return l;
- }
-
- return NULL;
-}
-
-
-static bool
-type_checkbox (GtkWidget *widget, const gchar *data)
-{
- return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (widget), data)));
-}
-
-static bool
-item_type_match (SPItem *item, GtkWidget *widget)
-{
- SPDesktop *desktop = SP_ACTIVE_DESKTOP;
-
- if (SP_IS_RECT(item)) {
- return (type_checkbox (widget, "shapes") || type_checkbox (widget, "rects"));
-
- } else if (SP_IS_GENERICELLIPSE(item) || SP_IS_ELLIPSE(item) || SP_IS_ARC(item) || SP_IS_CIRCLE(item)) {
- return (type_checkbox (widget, "shapes") || type_checkbox (widget, "ellipses"));
-
- } else if (SP_IS_STAR(item) || SP_IS_POLYGON(item)) {
- return (type_checkbox (widget, "shapes") || type_checkbox (widget, "stars"));
-
- } else if (SP_IS_SPIRAL(item)) {
- return (type_checkbox (widget, "shapes") || type_checkbox (widget, "spirals"));
-
- } else if (SP_IS_PATH(item) || SP_IS_LINE(item) || SP_IS_POLYLINE(item)) {
- return (type_checkbox (widget, "paths"));
-
- } else if (SP_IS_TEXT(item) || SP_IS_TSPAN(item) || SP_IS_TREF(item) || SP_IS_STRING(item)) {
- return (type_checkbox (widget, "texts"));
-
- } else if (SP_IS_GROUP(item) && !desktop->isLayer(item) ) { // never select layers!
- return (type_checkbox (widget, "groups"));
-
- } else if (SP_IS_USE(item)) {
- return (type_checkbox (widget, "clones"));
-
- } else if (SP_IS_IMAGE(item)) {
- return (type_checkbox (widget, "images"));
-
- } else if (SP_IS_OFFSET(item)) {
- return (type_checkbox (widget, "offsets"));
- }
-
- return false;
-}
-
-static GSList *
-filter_types (GSList *l, GObject *dlg, bool (*match_function)(SPItem *, GtkWidget *))
-{
- GtkWidget *widget = GTK_WIDGET (g_object_get_data(G_OBJECT (dlg), "types"));
-
- GtkWidget *alltypes = GTK_WIDGET (g_object_get_data(G_OBJECT (widget), "all"));
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (alltypes)))
- return l;
-
-
- GSList *n = NULL;
- for (GSList *i = l; i != NULL; i = i->next) {
- if (match_function (SP_ITEM(i->data), widget)) {
- n = g_slist_prepend (n, i->data);
- }
- }
- return n;
-}
-
-
-static GSList *
-filter_list (GSList *l, GObject *dlg, bool exact)
-{
- l = filter_onefield (l, dlg, "text", item_text_match, exact);
- l = filter_onefield (l, dlg, "id", item_id_match, exact);
- l = filter_onefield (l, dlg, "style", item_style_match, exact);
- l = filter_onefield (l, dlg, "attr", item_attr_match, exact);
-
- l = filter_types (l, dlg, item_type_match);
-
- return l;
-}
-
-static GSList *
-all_items (SPObject *r, GSList *l, bool hidden, bool locked)
-{
- SPDesktop *desktop = SP_ACTIVE_DESKTOP;
-
- if (SP_IS_DEFS(r)) {
- return l; // we're not interested in items in defs
- }
-
- if (!strcmp(r->getRepr()->name(), "svg:metadata")) {
- return l; // we're not interested in metadata
- }
-
- for (SPObject *child = r->firstChild(); child; child = child->next) {
- if ( SP_IS_ITEM(child) && !child->cloned && !desktop->isLayer(child) ) {
- SPItem *item = SP_ITEM(child);
- if ((hidden || !desktop->itemIsHidden(item)) && (locked || !item->isLocked())) {
- l = g_slist_prepend (l, child);
- }
- }
- l = all_items (child, l, hidden, locked);
- }
- return l;
-}
-
-static GSList *
-all_selection_items (Inkscape::Selection *s, GSList *l, SPObject *ancestor, bool hidden, bool locked)
-{
- SPDesktop *desktop = SP_ACTIVE_DESKTOP;
-
- for (GSList *i = const_cast<GSList *>(s->itemList()); i != NULL; i = i->next) {
- if ( SP_IS_ITEM(i->data) && !SP_OBJECT(i->data)->cloned && !desktop->isLayer(SP_ITEM(i->data))) {
- SPItem * item = SP_ITEM(i->data);
- if (!ancestor || ancestor->isAncestorOf(item)) {
- if ((hidden || !desktop->itemIsHidden(item)) && (locked || !item->isLocked())) {
- l = g_slist_prepend (l, i->data);
- }
- }
- }
- if (!ancestor || ancestor->isAncestorOf(SP_OBJECT (i->data))) {
- l = all_items (SP_OBJECT (i->data), l, hidden, locked);
- }
- }
- return l;
-}
-
-
-static void
-sp_find_dialog_find(GObject *, GObject *dlg)
-{
- SPDesktop *desktop = SP_ACTIVE_DESKTOP;
-
- bool hidden = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (dlg), "includehidden")));
- bool locked = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (dlg), "includelocked")));
-
- GSList *l = NULL;
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (dlg), "inselection")))) {
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (dlg), "inlayer")))) {
- l = all_selection_items (desktop->selection, l, desktop->currentLayer(), hidden, locked);
- } else {
- l = all_selection_items (desktop->selection, l, NULL, hidden, locked);
- }
- } else {
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (dlg), "inlayer")))) {
- l = all_items (desktop->currentLayer(), l, hidden, locked);
- } else {
- l = all_items(sp_desktop_document(desktop)->getRoot(), l, hidden, locked);
- }
- }
- guint all = g_slist_length (l);
-
- bool exact = true;
- GSList *n = NULL;
- n = filter_list (l, dlg, exact);
- if (n == NULL) {
- exact = false;
- n = filter_list (l, dlg, exact);
- }
-
- if (n != NULL) {
- int count = g_slist_length (n);
- desktop->messageStack()->flashF(Inkscape::NORMAL_MESSAGE,
- // TRANSLATORS: "%s" is replaced with "exact" or "partial" when this string is displayed
- ngettext("<b>%d</b> object found (out of <b>%d</b>), %s match.",
- "<b>%d</b> objects found (out of <b>%d</b>), %s match.",
- count),
- count, all, exact? _("exact") : _("partial"));
-
- Inkscape::Selection *selection = sp_desktop_selection (desktop);
- selection->clear();
- selection->setList(n);
- scroll_to_show_item (desktop, SP_ITEM(n->data));
- } else {
- desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("No objects found"));
- }
-}
-
-static void
-sp_find_reset_searchfield (GObject *dlg, const gchar *field)
-{
- GtkWidget *widget = GTK_WIDGET (g_object_get_data(G_OBJECT (dlg), field));
- gtk_entry_set_text (GTK_ENTRY(widget), "");
-}
-
-
-static void
-sp_find_dialog_reset (GObject *, GObject *dlg)
-{
- sp_find_reset_searchfield (dlg, "text");
- sp_find_reset_searchfield (dlg, "id");
- sp_find_reset_searchfield (dlg, "style");
- sp_find_reset_searchfield (dlg, "attr");
-
- GtkWidget *types = GTK_WIDGET (g_object_get_data(G_OBJECT (dlg), "types"));
- GtkToggleButton *tb = GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (types), "all"));
- gtk_toggle_button_toggled (tb);
- gtk_toggle_button_set_active (tb, TRUE);
-}
-
-
-#define FIND_LABELWIDTH 80
-
-static void
-sp_find_new_searchfield (GtkWidget *dlg, GtkWidget *vb, const gchar *label, const gchar *id, const gchar *tip)
-{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_box_set_homogeneous(GTK_BOX(hb), FALSE);
-#else
- GtkWidget *hb = gtk_hbox_new (FALSE, 0);
-#endif
- GtkWidget *l = gtk_label_new_with_mnemonic (label);
- gtk_widget_set_size_request (l, FIND_LABELWIDTH, -1);
- gtk_misc_set_alignment (GTK_MISC (l), 1.0, 0.5);
- gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 0);
-
- GtkWidget *tf = gtk_entry_new ();
- gtk_entry_set_max_length (GTK_ENTRY (tf), 64);
- gtk_box_pack_start (GTK_BOX (hb), tf, TRUE, TRUE, 0);
- g_object_set_data (G_OBJECT (dlg), id, tf);
- gtk_widget_set_tooltip_text (tf, tip);
- g_signal_connect ( G_OBJECT (tf), "activate", G_CALLBACK (sp_find_dialog_find), dlg );
- gtk_label_set_mnemonic_widget (GTK_LABEL(l), tf);
-
- gtk_box_pack_start (GTK_BOX (vb), hb, FALSE, FALSE, 0);
-}
-
-static void
-sp_find_new_button (GtkWidget *dlg, GtkWidget *hb, const gchar *label, const gchar *tip, void (*function) (GObject *, GObject *))
-{
- GtkWidget *b = gtk_button_new_with_mnemonic (label);
- gtk_widget_set_tooltip_text (b, tip);
- gtk_box_pack_start (GTK_BOX (hb), b, TRUE, TRUE, 0);
- g_signal_connect ( G_OBJECT (b), "clicked", G_CALLBACK (function), dlg );
- gtk_widget_show (b);
-}
-
-static void
-toggle_alltypes (GtkToggleButton *tb, gpointer data)
-{
- GtkWidget *alltypes_pane = GTK_WIDGET (g_object_get_data(G_OBJECT (data), "all-pane"));
- if (gtk_toggle_button_get_active (tb)) {
- gtk_widget_hide (alltypes_pane);
- } else {
- gtk_widget_show_all (alltypes_pane);
-
- // excplicit toggle to make sure its handler gets called, no matter what was the original state
- gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "shapes")));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "shapes")), TRUE);
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "paths")), TRUE);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "texts")), TRUE);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "groups")), TRUE);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "clones")), TRUE);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "images")), TRUE);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "offsets")), TRUE);
- }
- sp_find_squeeze_window();
-}
-
-static void
-toggle_shapes (GtkToggleButton *tb, gpointer data)
-{
- GtkWidget *shapes_pane = GTK_WIDGET (g_object_get_data(G_OBJECT (data), "shapes-pane"));
- if (gtk_toggle_button_get_active (tb)) {
- gtk_widget_hide (shapes_pane);
- } else {
- gtk_widget_show_all (shapes_pane);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "rects")), FALSE);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "ellipses")), FALSE);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "stars")), FALSE);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (g_object_get_data(G_OBJECT (data), "spirals")), FALSE);
- }
- sp_find_squeeze_window();
-}
-
-
-static GtkWidget *
-sp_find_types_checkbox (GtkWidget *w, const gchar *data, gboolean active,
- const gchar *tip,
- const gchar *label,
- void (*toggled)(GtkToggleButton *, gpointer))
-{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_box_set_homogeneous(GTK_BOX(hb), FALSE);
-#else
- GtkWidget *hb = gtk_hbox_new (FALSE, 0);
-#endif
- gtk_widget_show (hb);
-
- {
- GtkWidget *b = gtk_check_button_new_with_label (label);
- gtk_widget_show (b);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(b), active);
- g_object_set_data (G_OBJECT (w), data, b);
- gtk_widget_set_tooltip_text (b, tip);
- if (toggled)
- g_signal_connect (G_OBJECT (b), "toggled", G_CALLBACK (toggled), w);
- gtk_box_pack_start (GTK_BOX (hb), b, FALSE, FALSE, 0);
- }
-
- return hb;
-}
-
-static GtkWidget *
-sp_find_types_checkbox_indented (GtkWidget *w, const gchar *data, gboolean active,
- const gchar *tip,
- const gchar *label,
- void (*toggled)(GtkToggleButton *, gpointer), guint indent)
-{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_box_set_homogeneous(GTK_BOX(hb), FALSE);
-#else
- GtkWidget *hb = gtk_hbox_new (FALSE, 0);
-#endif
- gtk_widget_show (hb);
-
- { // empty label for indent
- GtkWidget *l = gtk_label_new ("");
- gtk_widget_show (l);
- gtk_widget_set_size_request (l, FIND_LABELWIDTH + indent, -1);
- gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 0);
- }
-
- GtkWidget *c = sp_find_types_checkbox (w, data, active, tip, label, toggled);
- gtk_box_pack_start (GTK_BOX (hb), c, FALSE, FALSE, 0);
-
- return hb;
-}
-
-
-static GtkWidget *
-sp_find_types ()
-{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *vb = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
- gtk_box_set_homogeneous(GTK_BOX(vb), FALSE);
-#else
- GtkWidget *vb = gtk_vbox_new (FALSE, 4);
-#endif
- gtk_widget_show (vb);
-
- {
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_box_set_homogeneous(GTK_BOX(hb), FALSE);
-#else
- GtkWidget *hb = gtk_hbox_new (FALSE, 0);
-#endif
- gtk_widget_show (hb);
-
- {
- GtkWidget *l = gtk_label_new_with_mnemonic (_("T_ype: "));
- gtk_widget_show (l);
- gtk_widget_set_size_request (l, FIND_LABELWIDTH, -1);
- gtk_misc_set_alignment (GTK_MISC (l), 1.0, 0.5);
- gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 0);
- }
-
- GtkWidget *alltypes = sp_find_types_checkbox (vb, "all", TRUE, _("Search in all object types"), _("All types"), toggle_alltypes);
- gtk_box_pack_start (GTK_BOX (hb), alltypes, FALSE, FALSE, 0);
-
- gtk_box_pack_start (GTK_BOX (vb), hb, FALSE, FALSE, 0);
- }
-
- {
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *vb_all = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
- gtk_box_set_homogeneous(GTK_BOX(vb_all), FALSE);
-#else
- GtkWidget *vb_all = gtk_vbox_new (FALSE, 0);
-#endif
- gtk_widget_show (vb_all);
-
- {
- GtkWidget *c = sp_find_types_checkbox_indented (vb, "shapes", FALSE, _("Search all shapes"), _("All shapes"), toggle_shapes, 10);
- gtk_box_pack_start (GTK_BOX (vb_all), c, FALSE, FALSE, 0);
- }
-
-
- {
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_box_set_homogeneous(GTK_BOX(hb), FALSE);
-#else
- GtkWidget *hb = gtk_hbox_new (FALSE, 0);
-#endif
- gtk_widget_show (hb);
-
- { // empty label for alignment
- GtkWidget *l = gtk_label_new ("");
- gtk_widget_show (l);
- gtk_widget_set_size_request (l, FIND_LABELWIDTH + 20, -1);
- gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 0);
- }
-
- {
- GtkWidget *c = sp_find_types_checkbox (vb, "rects", FALSE, _("Search rectangles"), _("Rectangles"), NULL);
- gtk_box_pack_start (GTK_BOX (hb), c, FALSE, FALSE, 0);
- }
-
- {
- GtkWidget *c = sp_find_types_checkbox (vb, "ellipses", FALSE, _("Search ellipses, arcs, circles"), _("Ellipses"), NULL);
- gtk_box_pack_start (GTK_BOX (hb), c, FALSE, FALSE, 0);
- }
-
- {
- GtkWidget *c = sp_find_types_checkbox (vb, "stars", FALSE, _("Search stars and polygons"), _("Stars"), NULL);
- gtk_box_pack_start (GTK_BOX (hb), c, FALSE, FALSE, 0);
- }
-
- {
- GtkWidget *c = sp_find_types_checkbox (vb, "spirals", FALSE, _("Search spirals"), _("Spirals"), NULL);
- gtk_box_pack_start (GTK_BOX (hb), c, FALSE, FALSE, 0);
- }
-
- g_object_set_data (G_OBJECT (vb), "shapes-pane", hb);
-
- gtk_box_pack_start (GTK_BOX (vb_all), hb, FALSE, FALSE, 0);
- gtk_widget_hide (hb);
- }
-
- {
- // TRANSLATORS: polyline is a set of connected straight line segments
- // http://www.w3.org/TR/SVG11/shapes.html#PolylineElement
- GtkWidget *c = sp_find_types_checkbox_indented (vb, "paths", TRUE, _("Search paths, lines, polylines"), _("Paths"), NULL, 10);
- gtk_box_pack_start (GTK_BOX (vb_all), c, FALSE, FALSE, 0);
- }
-
- {
- GtkWidget *c = sp_find_types_checkbox_indented (vb, "texts", TRUE, _("Search text objects"), _("Texts"), NULL, 10);
- gtk_box_pack_start (GTK_BOX (vb_all), c, FALSE, FALSE, 0);
- }
-
- {
- GtkWidget *c = sp_find_types_checkbox_indented (vb, "groups", TRUE, _("Search groups"), _("Groups"), NULL, 10);
- gtk_box_pack_start (GTK_BOX (vb_all), c, FALSE, FALSE, 0);
- }
-
- {
- GtkWidget *c = sp_find_types_checkbox_indented (vb, "clones", TRUE, _("Search clones"),
- //TRANSLATORS: "Clones" is a noun indicating type of object to find
- C_("Find dialog","Clones"), NULL, 10);
- gtk_box_pack_start (GTK_BOX (vb_all), c, FALSE, FALSE, 0);
- }
-
- {
- GtkWidget *c = sp_find_types_checkbox_indented (vb, "images", TRUE, _("Search images"), _("Images"), NULL, 10);
- gtk_box_pack_start (GTK_BOX (vb_all), c, FALSE, FALSE, 0);
- }
-
- {
- GtkWidget *c = sp_find_types_checkbox_indented (vb, "offsets", TRUE, _("Search offset objects"), _("Offsets"), NULL, 10);
- gtk_box_pack_start (GTK_BOX (vb_all), c, FALSE, FALSE, 0);
- }
-
- gtk_box_pack_start (GTK_BOX (vb), vb_all, FALSE, FALSE, 0);
- g_object_set_data (G_OBJECT (vb), "all-pane", vb_all);
- gtk_widget_hide (vb_all);
- }
-
- return vb;
-}
-
-
-/*
- Local Variables:
- mode:c++
- c-file-style:"stroustrup"
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
- indent-tabs-mode:nil
- fill-column:99
- End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --git a/src/dialogs/find.h b/src/dialogs/find.h
deleted file mode 100644
index c06d3735f..000000000
--- a/src/dialogs/find.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/** @file
- * @brief Find dialog
- */
-/* Authors:
- * bulia byak <bulia@users.sf.net>
- *
- * Copyright (C) 2004 Authors
- *
- * Released under GNU GPL, read the file 'COPYING' for more information
- */
-
-#ifndef SEEN_FIND_H
-#define SEEN_FIND_H
-
-#include <gtk/gtk.h>
-
-
-#endif /* !SEEN_FIND_H */
-
-/*
- Local Variables:
- mode:c++
- c-file-style:"stroustrup"
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
- indent-tabs-mode:nil
- fill-column:99
- End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
diff --git a/src/document.cpp b/src/document.cpp
index 97b3bf584..706710cfc 100644
--- a/src/document.cpp
+++ b/src/document.cpp
@@ -953,7 +953,7 @@ void SPDocument::requestModified()
void SPDocument::setupViewport(SPItemCtx *ctx)
{
- ctx->ctx.flags = 0;
+ ctx->flags = 0;
ctx->i2doc = Geom::identity();
// Set up viewport in case svg has it defined as percentages
if (root->viewBox_set) { // if set, take from viewBox
diff --git a/src/libgdl/Makefile_insert b/src/libgdl/Makefile_insert
index 3f5228a20..7cfeaa8a2 100644
--- a/src/libgdl/Makefile_insert
+++ b/src/libgdl/Makefile_insert
@@ -44,6 +44,17 @@ libgdl/all: libgdl/libgdl.a
libgdl/clean:
rm -f libgdl/libgdl.a $(libgdl_gdl_a_OBJECTS)
+
+# Suppress some non-critical warnings for libgdl. We will drop our forked copy
+# of GDL once we upgrade to Gtk+ 3 so it's more important to minimise the number
+# of changes we make to GDL than to fix these minor issues in trunk.
+
+if CC_WNO_UNUSED_BUT_SET_VARIABLE_SUPPORTED
+libgdl_libgdl_a_CFLAGS = -Wno-unused-parameter -Wno-sign-compare -Wno-unused-variable -Wno-unused-but-set-variable $(AM_CFLAGS)
+else
+libgdl_libgdl_a_CFLAGS = -Wno-unused-parameter -Wno-sign-compare -Wno-unused-variable $(AM_CFLAGS)
+endif
+
libgdl_libgdl_a_SOURCES = \
libgdl/gdl-dock-object.h \
libgdl/gdl-dock-master.h \
diff --git a/src/libnrtype/font-lister.cpp b/src/libnrtype/font-lister.cpp
index 712c17915..8401c227f 100644
--- a/src/libnrtype/font-lister.cpp
+++ b/src/libnrtype/font-lister.cpp
@@ -970,6 +970,17 @@ namespace Inkscape
}
// Helper functions
+
+// Separator function (if true, a separator will be drawn)
+gboolean font_lister_separator_func(GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer /*data*/)
+{
+ gchar* text = 0;
+ gtk_tree_model_get(model, iter, 0, &text, -1 ); // Column 0: FontList.family
+ return (text && strcmp(text,"#") == 0);
+}
+
void font_lister_cell_data_func(GtkCellLayout */*cell_layout*/,
GtkCellRenderer *cell,
GtkTreeModel *model,
@@ -1043,3 +1054,13 @@ void font_lister_cell_data_func(GtkCellLayout */*cell_layout*/,
g_object_set (G_OBJECT (cell), "markup", markup.c_str(), NULL);
}
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
diff --git a/src/libnrtype/font-lister.h b/src/libnrtype/font-lister.h
index 5c48bf7a8..5a8f578d9 100644
--- a/src/libnrtype/font-lister.h
+++ b/src/libnrtype/font-lister.h
@@ -296,13 +296,9 @@ namespace Inkscape
}
// Helper functions
-// Separator function (if true, a separator will be drawn)
-static gboolean font_lister_separator_func(GtkTreeModel *model, GtkTreeIter *iter, gpointer /*data*/)
-{
- gchar* text = 0;
- gtk_tree_model_get(model, iter, 0, &text, -1 ); // Column 0: FontList.family
- return (text && strcmp(text,"#") == 0);
-}
+gboolean font_lister_separator_func(GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer /*data*/);
void font_lister_cell_data_func(GtkCellLayout */*cell_layout*/,
GtkCellRenderer *cell,
diff --git a/src/livarot/PathSimplify.cpp b/src/livarot/PathSimplify.cpp
index d9f609e87..7d9f3f57d 100644
--- a/src/livarot/PathSimplify.cpp
+++ b/src/livarot/PathSimplify.cpp
@@ -67,6 +67,7 @@ void Path::Simplify(double treshhold)
}
+#if 0
// dichomtomic method to get distance to curve approximation
// a real polynomial solver would get the minimum more efficiently, but since the polynom
// would likely be of degree >= 5, that would imply using some generic solver, liek using the sturm metod
@@ -114,7 +115,7 @@ static double RecDistanceToCubic(Geom::Point const &iS, Geom::Point const &isD,
return current;
}
-
+#endif
static double DistanceToCubic(Geom::Point const &start, PathDescrCubicTo res, Geom::Point &pt)
{
diff --git a/src/live_effects/lpe-dynastroke.cpp b/src/live_effects/lpe-dynastroke.cpp
index a5295d269..30ca5e2d6 100644
--- a/src/live_effects/lpe-dynastroke.cpp
+++ b/src/live_effects/lpe-dynastroke.cpp
@@ -26,30 +26,6 @@
namespace Inkscape {
namespace LivePathEffect {
-
-//----------------------------------------------------------
-//--- TODO: Test this and move to 2Geom --------------------
-//----------------------------------------------------------
-
-static
-std::vector<double>
-find_corners (Geom::Piecewise<Geom::D2<Geom::SBasis> > const &m){
- using namespace Geom;
- std::vector<double> output = std::vector<double>();
- Piecewise<D2<SBasis> > v = derivative(m);
- for (unsigned i=0; i<m.size()-1; i++){
- if ( m.segs[i].at1() == m.segs[i+1].at0() &&
- v.segs[i].at1() != v.segs[i+1].at0()){
- output.push_back(m.cuts[i+1]);
- }
- }
- return output;
-}
-
-//----------------------------------------------------------
-//----------------------------------------------------------
-//----------------------------------------------------------
-
//TODO: growfor/fadefor can be expressed in unit of width.
//TODO: make round/sharp end choices independant for start and end.
//TODO: define more styles like in calligtool.
diff --git a/src/marker.cpp b/src/marker.cpp
index ba5cd4b05..1c8542695 100644
--- a/src/marker.cpp
+++ b/src/marker.cpp
@@ -301,7 +301,7 @@ static void sp_marker_update(SPObject *object, SPCtx *ctx, guint flags)
// fixme: We have to set up clip here too
// Copy parent context
- rctx.ctx = *ctx;
+ rctx.flags = ctx->flags;
// Initialize tranformations
rctx.i2doc = Geom::identity();
diff --git a/src/pen-context.cpp b/src/pen-context.cpp
index 6f61ceb99..b43c2ff19 100644
--- a/src/pen-context.cpp
+++ b/src/pen-context.cpp
@@ -1791,7 +1791,7 @@ static void bspline_spiro_build(SPPenContext *const pc)
//We create the base curve
SPCurve *curve = new SPCurve();
//If we continuate the existing curve we add it at the start
- if(pc->sa && !pc->sa->curve->is_empty()){
+ if(pc->sa && !pc->sa->curve->is_empty() &&1>2){
curve = pc->sa->curve->copy();
if (pc->sa->start) {
curve = curve->create_reverse();
diff --git a/src/pencil-context.cpp b/src/pencil-context.cpp
index 37df2588a..a7fa5e111 100644
--- a/src/pencil-context.cpp
+++ b/src/pencil-context.cpp
@@ -722,6 +722,11 @@ interpolate(SPPencilContext *pc)
return;
}
+ //BSpline
+ using Geom::X;
+ using Geom::Y;
+ //BSpline end
+
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
double const tol = prefs->getDoubleLimited("/tools/freehand/pencil/tolerance", 10.0, 1.0, 100.0) * 0.4;
double const tolerance_sq = 0.02 * square( pc->desktop->w2d().descrim() *
@@ -761,7 +766,9 @@ interpolate(SPPencilContext *pc)
//Si el modo es BSpline modificamos para que el trazado cree los nodos adhoc
if(mode == 2){
Geom::Point BP = b[4*c+0] + (1./3)*(b[4*c+3] - b[4*c+0]);
+ BP = Geom::Point(BP[X] + 0.0625,BP[Y] + 0.0625);
Geom::Point CP = b[4*c+3] + (1./3)*(b[4*c+0] - b[4*c+3]);
+ CP = Geom::Point(CP[X] + 0.0625,CP[Y] + 0.0625);
pc->green_curve->curveto(BP,CP,b[4*c+3]);
}else{
pc->green_curve->curveto(b[4*c+1], b[4*c+2], b[4*c+3]);
@@ -908,12 +915,16 @@ fit_and_split(SPPencilContext *pc)
pc->red_curve->reset();
pc->red_curve->moveto(b[0]);
//BSpline
+ using Geom::X;
+ using Geom::Y;
//Si el modo es BSpline modificamos para que el trazado cree los nodos adhoc
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
guint mode = prefs->getInt("/tools/freehand/pencil/freehand-mode", 0);
if(mode == 2){
Geom::Point B = b[0] + (1./3)*(b[3] - b[0]);
+ B = Geom::Point(B[X] + 0.0625,B[Y] + 0.0625);
Geom::Point C = b[3] + (1./3)*(b[0] - b[3]);
+ C = Geom::Point(C[X] + 0.0625,C[Y] + 0.0625);
pc->red_curve->curveto(B,C,b[3]);
}else{
pc->red_curve->curveto(b[1], b[2], b[3]);
diff --git a/src/sp-item.h b/src/sp-item.h
index a3ba1dbe2..a93206414 100644
--- a/src/sp-item.h
+++ b/src/sp-item.h
@@ -87,9 +87,8 @@ public:
#define SP_ITEM_REFERENCE_FLAGS (1 << 1)
/// Contains transformations to document/viewport and the viewport size.
-class SPItemCtx {
+class SPItemCtx : public SPCtx {
public:
- SPCtx ctx;
/** Item to document transformation */
Geom::Affine i2doc;
/** Viewport size */
diff --git a/src/spray-context.cpp b/src/spray-context.cpp
index 694e3a500..6a5684891 100644
--- a/src/spray-context.cpp
+++ b/src/spray-context.cpp
@@ -610,19 +610,6 @@ static void sp_spray_switch_mode(SPSprayContext *tc, gint mode, bool with_shift)
sp_spray_update_cursor(tc, with_shift);
}
-static void sp_spray_switch_mode_temporarily(SPSprayContext *tc, gint mode, bool with_shift)
-{
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- // Juggling about so that prefs have the old value but tc->mode and the button show new mode:
- gint now_mode = prefs->getInt("/tools/spray/mode", 0);
- SP_EVENT_CONTEXT(tc)->desktop->setToolboxSelectOneValue("spray_tool_mode", mode);
- // button has changed prefs, restore
- prefs->setInt("/tools/spray/mode", now_mode);
- // changing prefs changed tc->mode, restore back :)
- tc->mode = mode;
- sp_spray_update_cursor(tc, with_shift);
-}
-
gint sp_spray_context_root_handler(SPEventContext *event_context, GdkEvent *event)
{
SPSprayContext *tc = SP_SPRAY_CONTEXT(event_context);
diff --git a/src/trace/quantize.cpp b/src/trace/quantize.cpp
index ba9306da8..c386c0ee9 100644
--- a/src/trace/quantize.cpp
+++ b/src/trace/quantize.cpp
@@ -192,6 +192,7 @@ static void octreeDelete(pool<Ocnode> *pool, Ocnode *node)
/**
* pretty-print an octree, debugging purposes
*/
+#if 0
static void ocnodePrint(Ocnode *node, int indent)
{
if (!node) return;
@@ -213,7 +214,6 @@ static void ocnodePrint(Ocnode *node, int indent)
}
}
-#if 0
void octreePrint(Ocnode *node)
{
printf("<<octree>>\n");
diff --git a/src/ui/control-manager.cpp b/src/ui/control-manager.cpp
index b14f27b8b..62e6ce3a3 100644
--- a/src/ui/control-manager.cpp
+++ b/src/ui/control-manager.cpp
@@ -31,29 +31,18 @@ namespace {
std::map<Inkscape::ControlType, std::vector<int> > sizeTable;
// Note: The following operator overloads are local to this file at the moment to discourage flag manipulation elsewhere.
-
+/*
ControlFlags operator |(ControlFlags lhs, ControlFlags rhs)
{
return static_cast<ControlFlags>(static_cast<int>(lhs) | static_cast<int>(rhs));
}
-
-ControlFlags& operator |=(ControlFlags &lhs, ControlFlags rhs)
-{
- lhs = lhs | rhs;
- return lhs;
-}
+*/
ControlFlags operator &(ControlFlags lhs, ControlFlags rhs)
{
return static_cast<ControlFlags>(static_cast<int>(lhs) & static_cast<int>(rhs));
}
-ControlFlags& operator &=(ControlFlags &lhs, ControlFlags rhs)
-{
- lhs = lhs & rhs;
- return lhs;
-}
-
ControlFlags operator ^(ControlFlags lhs, ControlFlags rhs)
{
return static_cast<ControlFlags>(static_cast<int>(lhs) ^ static_cast<int>(rhs));
diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp
index 603786742..ac039bf77 100644
--- a/src/ui/dialog/export.cpp
+++ b/src/ui/dialog/export.cpp
@@ -412,7 +412,6 @@ void Export::set_default_filename () {
if ( SP_ACTIVE_DOCUMENT && SP_ACTIVE_DOCUMENT->getURI() )
{
- gchar *name;
SPDocument * doc = SP_ACTIVE_DOCUMENT;
const gchar *uri = doc->getURI();
const gchar *text_extension = get_file_save_extension (Inkscape::Extension::FILE_SAVE_METHOD_SAVE_AS).c_str();
@@ -441,7 +440,7 @@ void Export::set_default_filename () {
g_free(uri_copy);
}
} else {
- name = g_strconcat(uri, ".png", NULL);
+ gchar *name = g_strconcat(uri, ".png", NULL);
filename_entry.set_text(name);
filename_entry.set_position(strlen(name));
@@ -1310,7 +1309,7 @@ void Export::onBrowse ()
WCHAR _filename[_MAX_PATH + 1];
memset(_filename, 0, sizeof(_filename));
gunichar2* utf16_path_string = g_utf8_to_utf16(filename.c_str(), -1, NULL, NULL, NULL);
- wcsncpy(_filename, (wchar_t*)utf16_path_string, _MAX_PATH);
+ wcsncpy(_filename, reinterpret_cast<wchar_t*>(utf16_path_string), _MAX_PATH);
g_free(utf16_path_string);
opf.hwndOwner = (HWND)(GDK_WINDOW_HWND(gtk_widget_get_window(GTK_WIDGET(this))));
diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp
index 75f80ed4a..cb6d92799 100644
--- a/src/ui/dialog/filedialogimpl-gtkmm.cpp
+++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp
@@ -1068,7 +1068,7 @@ FileSaveDialogImplGtk::FileSaveDialogImplGtk( Gtk::Window &parentWindow,
std::vector<Gtk::Entry *> entries;
findEntryWidgets(cont, entries);
//g_message("Found %d entry widgets\n", entries.size());
- if (entries.size() >=1 )
+ if (!entries.empty())
{
//Catch when user hits [return] on the text field
fileNameEntry = entries[0];
@@ -1080,7 +1080,7 @@ FileSaveDialogImplGtk::FileSaveDialogImplGtk( Gtk::Window &parentWindow,
std::vector<Gtk::Expander *> expanders;
findExpanderWidgets(cont, expanders);
//g_message("Found %d expander widgets\n", expanders.size());
- if (expanders.size() >=1 )
+ if (!expanders.empty())
{
//Always show the file list
Gtk::Expander *expander = expanders[0];
@@ -1639,7 +1639,7 @@ FileExportDialogImpl::FileExportDialogImpl( Gtk::Window& parentWindow,
std::vector<Gtk::Entry *> entries;
findEntryWidgets(cont, entries);
//g_message("Found %d entry widgets\n", entries.size());
- if (entries.size() >=1 )
+ if (!entries.empty())
{
//Catch when user hits [return] on the text field
fileNameEntry = entries[0];
@@ -1651,7 +1651,7 @@ FileExportDialogImpl::FileExportDialogImpl( Gtk::Window& parentWindow,
std::vector<Gtk::Expander *> expanders;
findExpanderWidgets(cont, expanders);
//g_message("Found %d expander widgets\n", expanders.size());
- if (expanders.size() >=1 )
+ if (!expanders.empty())
{
//Always show the file list
Gtk::Expander *expander = expanders[0];
diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp
index 989c40264..5afc85f10 100644
--- a/src/ui/dialog/filter-effects-dialog.cpp
+++ b/src/ui/dialog/filter-effects-dialog.cpp
@@ -945,13 +945,11 @@ private:
and all widgets within the setting group are aligned automatically. */
void add_widget(Gtk::Widget* w, const Glib::ustring& label)
{
- Gtk::Label *lbl = 0;
Gtk::HBox *hb = Gtk::manage(new Gtk::HBox);
hb->set_spacing(12);
if(label != "") {
- //lbl = Gtk::manage(new Gtk::Label(label + (label == "" ? "" : ":"), Gtk::ALIGN_LEFT)); colon now in label (LP #358921)
- lbl = Gtk::manage(new Gtk::Label(label, Gtk::ALIGN_START));
+ Gtk::Label *lbl = Gtk::manage(new Gtk::Label(label, Gtk::ALIGN_START));
hb->pack_start(*lbl, false, false);
_size_group->add_widget(*lbl);
lbl->show();
diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp
index a71227861..84d469750 100644
--- a/src/ui/dialog/text-edit.cpp
+++ b/src/ui/dialog/text-edit.cpp
@@ -423,12 +423,11 @@ void TextEdit::onSelectionChange()
void TextEdit::updateObjectText ( SPItem *text )
{
GtkTextIter start, end;
- gchar *str;
// write text
if (gtk_text_buffer_get_modified (text_buffer)) {
gtk_text_buffer_get_bounds (text_buffer, &start, &end);
- str = gtk_text_buffer_get_text (text_buffer, &start, &end, TRUE);
+ gchar *str = gtk_text_buffer_get_text (text_buffer, &start, &end, TRUE);
sp_te_set_repr_text_multiline (text, str);
g_free (str);
gtk_text_buffer_set_modified (text_buffer, FALSE);
diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp
index 2ef8c1766..3623bb006 100644
--- a/src/ui/tool/multi-path-manipulator.cpp
+++ b/src/ui/tool/multi-path-manipulator.cpp
@@ -65,7 +65,6 @@ typedef std::pair<double, IterPair> DistanceMapItem;
void find_join_iterators(ControlPointSelection &sel, IterPairList &pairs)
{
IterSet join_iters;
- DistanceMap dists;
// find all endnodes in selection
for (ControlPointSelection::iterator i = sel.begin(); i != sel.end(); ++i) {
diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp
index 819f5db54..a1fa4e55b 100644
--- a/src/ui/tool/node.cpp
+++ b/src/ui/tool/node.cpp
@@ -398,7 +398,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event)
}
std::vector<Inkscape::SnapCandidatePoint> unselected;
- if (snap) {
+ if (snap && ( (!held_control(*event) && _pm().isBSpline()) || !_pm().isBSpline())) {
ControlPointSelection::Set &nodes = _parent->_selection.allPoints();
for (ControlPointSelection::Set::iterator i = nodes.begin(); i != nodes.end(); ++i) {
Node *n = static_cast<Node*>(*i);
diff --git a/src/ui/widget/layer-selector.cpp b/src/ui/widget/layer-selector.cpp
index fbb9c0e24..7b1a8dbfb 100644
--- a/src/ui/widget/layer-selector.cpp
+++ b/src/ui/widget/layer-selector.cpp
@@ -163,17 +163,6 @@ LayerSelector::~LayerSelector() {
_selection_changed_connection.disconnect();
}
-namespace {
-
-/** Helper function - detaches desktop from selector
- */
-bool detach(LayerSelector *selector) {
- selector->setDesktop(NULL);
- return FALSE;
-}
-
-}
-
/** Sets the desktop for the widget. First disconnects signals
* for the current desktop, then stores the pointer to the
* given \a desktop, and attaches its signals to this one.
diff --git a/src/ui/widget/licensor.cpp b/src/ui/widget/licensor.cpp
index 8ecd36af2..c729354cb 100644
--- a/src/ui/widget/licensor.cpp
+++ b/src/ui/widget/licensor.cpp
@@ -79,7 +79,8 @@ void LicenseItem::on_toggled()
//---------------------------------------------------
Licensor::Licensor()
-: Gtk::VBox(false,4)
+: Gtk::VBox(false,4),
+ _eentry (NULL)
{
}
diff --git a/src/verbs.cpp b/src/verbs.cpp
index cdeeab99a..f8bfbab40 100644
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
@@ -39,7 +39,6 @@
#include "bind/javabind.h"
#include "desktop.h"
#include "desktop-handles.h"
-#include "dialogs/find.h"
#include "display/curve.h"
#include "document.h"
#include "draw-context.h"
diff --git a/src/xml/repr-util.cpp b/src/xml/repr-util.cpp
index 7e9f9c484..6ea20b87a 100644
--- a/src/xml/repr-util.cpp
+++ b/src/xml/repr-util.cpp
@@ -69,71 +69,6 @@ static void sp_xml_ns_register_defaults();
static char *sp_xml_ns_auto_prefix(char const *uri);
/*#####################
-# UTILITY
-#####################*/
-
-/**
- * Locale-independent double to string conversion
- */
-static unsigned int sp_xml_dtoa(gchar *buf, double val, unsigned int tprec, unsigned int fprec, unsigned int padf)
-{
- double dival, fval, epsilon;
- int idigits, ival, i;
- i = 0;
- if (val < 0.0) {
- buf[i++] = '-';
- val = -val;
- }
- /* Determine number of integral digits */
- if (val >= 1.0) {
- idigits = (int) floor(log10(val));
- } else {
- idigits = 0;
- }
- /* Determine the actual number of fractional digits */
- fprec = MAX(fprec, tprec - idigits);
- /* Find epsilon */
- epsilon = 0.5 * pow(10.0, - (double) fprec);
- /* Round value */
- val += epsilon;
- /* Extract integral and fractional parts */
- dival = floor(val);
- ival = (int) dival;
- fval = val - dival;
- /* Write integra */
- if (ival > 0) {
- char c[32];
- int j;
- j = 0;
- while (ival > 0) {
- c[32 - (++j)] = '0' + (ival % 10);
- ival /= 10;
- }
- memcpy(buf + i, &c[32 - j], j);
- i += j;
- tprec -= j;
- } else {
- buf[i++] = '0';
- tprec -= 1;
- }
- if ((fprec > 0) && (padf || (fval > epsilon))) {
- buf[i++] = '.';
- while ((fprec > 0) && (padf || (fval > epsilon))) {
- fval *= 10.0;
- dival = floor(fval);
- fval -= dival;
- buf[i++] = '0' + (int) dival;
- fprec -= 1;
- }
-
- }
- buf[i] = 0;
- return i;
-}
-
-
-
-/*#####################
# MAIN
#####################*/