summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2013-07-16 21:52:53 +0000
committerJaviertxo <jtx@jtx.marker.es>2013-07-16 21:52:53 +0000
commit488bfe58fe622fbd7b0d93039d5dd014c69e7884 (patch)
treefd4bf21c1ec55f4d8ca2f2b25a2087b057005cd1 /src
parentUpdate to trunk (diff)
parentShape calculations. re-introduce grid of a smaller size. (http://article.gman... (diff)
downloadinkscape-488bfe58fe622fbd7b0d93039d5dd014c69e7884.tar.gz
inkscape-488bfe58fe622fbd7b0d93039d5dd014c69e7884.zip
Update to trunk
(bzr r11950.1.125)
Diffstat (limited to 'src')
-rw-r--r--src/Makefile_insert1
-rw-r--r--src/document.cpp5
-rw-r--r--src/document.h1
-rw-r--r--src/extension/dbus/dbus-init.cpp29
-rw-r--r--src/extension/dbus/dbus-init.h10
-rw-r--r--src/extension/dbus/document-interface.h3
-rw-r--r--src/extension/dbus/wrapper/inkscape-dbus-wrapper.h2
-rw-r--r--src/livarot/Shape.cpp8
-rw-r--r--src/livarot/Shape.h12
-rw-r--r--src/livarot/ShapeMisc.cpp12
-rw-r--r--src/livarot/ShapeSweep.cpp8
-rw-r--r--src/main.cpp20
-rw-r--r--src/selection.cpp29
-rw-r--r--src/selection.h13
-rw-r--r--src/seltrans-handles.h2
-rw-r--r--src/seltrans.h2
-rw-r--r--src/ui/dialog/align-and-distribute.cpp190
-rw-r--r--src/ui/dialog/align-and-distribute.h10
-rw-r--r--src/ui/widget/dock.cpp20
-rw-r--r--src/ui/widget/dock.h10
-rw-r--r--src/util/units.cpp267
-rw-r--r--src/util/units.h62
-rw-r--r--src/verbs.cpp12
23 files changed, 394 insertions, 334 deletions
diff --git a/src/Makefile_insert b/src/Makefile_insert
index 023d640ca..88f809b52 100644
--- a/src/Makefile_insert
+++ b/src/Makefile_insert
@@ -21,6 +21,7 @@ ink_common_sources += \
color-profile.cpp color-profile.h \
color-profile-cms-fns.h \
color-rgba.h \
+ colorspace.h \
common-context.cpp common-context.h \
composite-undo-stack-observer.cpp \
composite-undo-stack-observer.h \
diff --git a/src/document.cpp b/src/document.cpp
index 706710cfc..0e9c43fe4 100644
--- a/src/document.cpp
+++ b/src/document.cpp
@@ -611,6 +611,11 @@ Geom::Point SPDocument::getDimensions() const
return Geom::Point(getWidth(), getHeight());
}
+Geom::OptRect SPDocument::preferredBounds() const
+{
+ return Geom::OptRect( Geom::Point(0, 0), getDimensions() );
+}
+
/**
* Given a Geom::Rect that may, for example, correspond to the bbox of an object,
* this function fits the canvas to that rect by resizing the canvas
diff --git a/src/document.h b/src/document.h
index 606a83be8..d49067250 100644
--- a/src/document.h
+++ b/src/document.h
@@ -228,6 +228,7 @@ public:
gdouble getWidth() const;
gdouble getHeight() const;
Geom::Point getDimensions() const;
+ Geom::OptRect preferredBounds() const;
void setWidth(gdouble width, const SPUnit *unit);
void setHeight(gdouble height, const SPUnit *unit);
void requestModified();
diff --git a/src/extension/dbus/dbus-init.cpp b/src/extension/dbus/dbus-init.cpp
index eb62f4b3a..19b48e10d 100644
--- a/src/extension/dbus/dbus-init.cpp
+++ b/src/extension/dbus/dbus-init.cpp
@@ -36,7 +36,14 @@
#include <sstream>
-
+namespace
+{
+ // This stores the bus name to use for this app instance. By default, it
+ // will be set to org.inkscape. However, users may provide other names by
+ // setting command-line parameters when starting Inkscape, so that more
+ // than one instance of Inkscape may be used by external scripts.
+ gchar *instance_bus_name = NULL;
+}
namespace Inkscape {
namespace Extension {
@@ -120,6 +127,11 @@ dbus_register_document(Inkscape::ActionContext const & target)
void
init (void)
{
+ if (instance_bus_name == NULL) {
+ // Set the bus name to the default
+ instance_bus_name = strdup("org.inkscape");
+ }
+
guint result;
GError *error = NULL;
DBusGConnection *connection;
@@ -127,7 +139,7 @@ init (void)
connection = dbus_get_connection();
proxy = dbus_get_proxy(connection);
org_freedesktop_DBus_request_name (proxy,
- "org.inkscape",
+ instance_bus_name,
DBUS_NAME_FLAG_DO_NOT_QUEUE, &result, &error);
//create interface for application
dbus_register_object (connection,
@@ -198,6 +210,19 @@ init_desktop (void) {
return strdup(name.c_str());
}
+void
+dbus_set_bus_name(gchar * bus_name)
+{
+ g_assert(bus_name != NULL);
+ g_assert(instance_bus_name == NULL);
+ instance_bus_name = strdup(bus_name);
+}
+gchar *
+dbus_get_bus_name()
+{
+ g_assert(instance_bus_name != NULL);
+ return instance_bus_name;
+}
} } } /* namespace Inkscape::Extension::Dbus */
diff --git a/src/extension/dbus/dbus-init.h b/src/extension/dbus/dbus-init.h
index 486e55b86..7862ad3c3 100644
--- a/src/extension/dbus/dbus-init.h
+++ b/src/extension/dbus/dbus-init.h
@@ -28,6 +28,16 @@ gchar * init_desktop (void);
gchar * dbus_init_desktop_interface (SPDesktop * dt);
+/** Set the bus name to use. Default is "org.inkscape".
+ This function should only be called once, before init(), if a non-default
+ bus name is required. */
+void dbus_set_bus_name(gchar * bus_name);
+
+/** Get the bus name for this instance. Default is "org.inkscape".
+ This function should only be called after init().
+ The returned gchar * is owned by this module and should not be freed. */
+gchar * dbus_get_bus_name();
+
} } } /* namespace Dbus, Extension, Inkscape */
#endif /* INKSCAPE_EXTENSION_DBUS_INIT_H__ */
diff --git a/src/extension/dbus/document-interface.h b/src/extension/dbus/document-interface.h
index 00d964f36..27460de52 100644
--- a/src/extension/dbus/document-interface.h
+++ b/src/extension/dbus/document-interface.h
@@ -34,9 +34,6 @@
class SPDesktop;
class SPItem;
-
-// TODO: this define doesn't seem to be used... although the path itself is also hardcoded in dbus-init.cpp
-#define DBUS_DOCUMENT_INTERFACE_PATH "/org/inkscape/document"
#define TYPE_DOCUMENT_INTERFACE (document_interface_get_type ())
#define DOCUMENT_INTERFACE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), TYPE_DOCUMENT_INTERFACE, DocumentInterface))
diff --git a/src/extension/dbus/wrapper/inkscape-dbus-wrapper.h b/src/extension/dbus/wrapper/inkscape-dbus-wrapper.h
index 79f8188d4..20830bd65 100644
--- a/src/extension/dbus/wrapper/inkscape-dbus-wrapper.h
+++ b/src/extension/dbus/wrapper/inkscape-dbus-wrapper.h
@@ -8,8 +8,6 @@
//#include <dbus/dbus-glib-bindings.h>
//#include <dbus/dbus-glib-lowlevel.h>
-
-#define DBUS_DOCUMENT_INTERFACE_PATH "/org/inkscape/document"
#define TYPE_DOCUMENT_INTERFACE (document_interface_get_type ())
#define DOCUMENT_INTERFACE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), TYPE_DOCUMENT_INTERFACE, DocumentInterface))
diff --git a/src/livarot/Shape.cpp b/src/livarot/Shape.cpp
index 130b1b03a..c29444a33 100644
--- a/src/livarot/Shape.cpp
+++ b/src/livarot/Shape.cpp
@@ -334,8 +334,8 @@ Shape::AddPoint (const Geom::Point x)
pData[n].nextLinkedPoint = -1;
pData[n].askForWindingS = NULL;
pData[n].askForWindingB = -1;
- pData[n].rx[0] = /*Round*/ (p.x[0]);
- pData[n].rx[1] = /*Round*/ (p.x[1]);
+ pData[n].rx[0] = Round(p.x[0]);
+ pData[n].rx[1] = Round(p.x[1]);
}
if (_has_voronoi_data)
{
@@ -2116,8 +2116,8 @@ void Shape::initialisePointData()
pData[i].pending = 0;
pData[i].edgeOnLeft = -1;
pData[i].nextLinkedPoint = -1;
- pData[i].rx[0] = /*Round*/ (getPoint(i).x[0]);
- pData[i].rx[1] = /*Round*/ (getPoint(i).x[1]);
+ pData[i].rx[0] = Round(getPoint(i).x[0]);
+ pData[i].rx[1] = Round(getPoint(i).x[1]);
}
_point_data_initialised = true;
diff --git a/src/livarot/Shape.h b/src/livarot/Shape.h
index b999b9dca..98fc2d7bf 100644
--- a/src/livarot/Shape.h
+++ b/src/livarot/Shape.h
@@ -266,20 +266,20 @@ public:
// be careful when using this function
// the coordinate rounding function
-// inline static double Round(double x)
-// {
-// return ldexp(rint(ldexp(x, 5)), -5);
-// }
+ inline static double Round(double x)
+ {
+ return ldexp(rint(ldexp(x, 9)), -9);
+ }
// 2 miscannellous variations on it, to scale to and back the rounding grid
inline static double HalfRound(double x)
{
- return ldexp(x, -5);
+ return ldexp(x, -9);
}
inline static double IHalfRound(double x)
{
- return ldexp(x, 5);
+ return ldexp(x, 9);
}
// boolean operations on polygons (requests intersection-free poylygons)
diff --git a/src/livarot/ShapeMisc.cpp b/src/livarot/ShapeMisc.cpp
index 5bb8a25ef..6fd40790f 100644
--- a/src/livarot/ShapeMisc.cpp
+++ b/src/livarot/ShapeMisc.cpp
@@ -49,8 +49,8 @@ Shape::ConvertToForme (Path * dest)
for (int i = 0; i < numberOfPoints(); i++)
{
- pData[i].rx[0] = /*Round*/ (getPoint(i).x[0]);
- pData[i].rx[1] = /*Round*/ (getPoint(i).x[1]);
+ pData[i].rx[0] = Round (getPoint(i).x[0]);
+ pData[i].rx[1] = Round (getPoint(i).x[1]);
}
for (int i = 0; i < numberOfEdges(); i++)
{
@@ -199,8 +199,8 @@ Shape::ConvertToForme (Path * dest, int nbP, Path * *orig, bool splitWhenForced)
for (int i = 0; i < numberOfPoints(); i++)
{
- pData[i].rx[0] = /*Round*/ (getPoint(i).x[0]);
- pData[i].rx[1] = /*Round*/ (getPoint(i).x[1]);
+ pData[i].rx[0] = Round (getPoint(i).x[0]);
+ pData[i].rx[1] = Round (getPoint(i).x[1]);
}
for (int i = 0; i < numberOfEdges(); i++)
{
@@ -352,8 +352,8 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int wildPath,in
for (int i = 0; i < numberOfPoints(); i++)
{
- pData[i].rx[0] = /*Round*/ (getPoint(i).x[0]);
- pData[i].rx[1] = /*Round*/ (getPoint(i).x[1]);
+ pData[i].rx[0] = Round (getPoint(i).x[0]);
+ pData[i].rx[1] = Round (getPoint(i).x[1]);
}
for (int i = 0; i < numberOfEdges(); i++)
{
diff --git a/src/livarot/ShapeSweep.cpp b/src/livarot/ShapeSweep.cpp
index ffe5a9d73..c2fd83e31 100644
--- a/src/livarot/ShapeSweep.cpp
+++ b/src/livarot/ShapeSweep.cpp
@@ -250,8 +250,8 @@ Shape::ConvertToShape (Shape * a, FillRule directed, bool invert)
}
Geom::Point rPtX;
- rPtX[0]= /*Round*/ (ptX[0]);
- rPtX[1]= /*Round*/ (ptX[1]);
+ rPtX[0]= Round (ptX[0]);
+ rPtX[1]= Round (ptX[1]);
int lastPointNo = -1;
lastPointNo = AddPoint (rPtX);
pData[lastPointNo].rx = rPtX;
@@ -1051,8 +1051,8 @@ Shape::Booleen (Shape * a, Shape * b, BooleanOp mod,int cutPathID)
}
Geom::Point rPtX;
- rPtX[0]= /*Round*/ (ptX[0]);
- rPtX[1]= /*Round*/ (ptX[1]);
+ rPtX[0]= Round (ptX[0]);
+ rPtX[1]= Round (ptX[1]);
int lastPointNo = -1;
lastPointNo = AddPoint (rPtX);
pData[lastPointNo].rx = rPtX;
diff --git a/src/main.cpp b/src/main.cpp
index ba51951da..4e2f2fd2b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -103,6 +103,11 @@
#endif // WIN32
#include "extension/init.h"
+// Not ideal, but there doesn't appear to be a nicer system in place for
+// passing command-line parameters to extensions before initialization...
+#ifdef WITH_DBUS
+#include "extension/dbus/dbus-init.h"
+#endif // WITH_DBUS
#include <glibmm/i18n.h>
#include <glibmm/main.h>
@@ -171,6 +176,7 @@ enum {
SP_ARG_VACUUM_DEFS,
#ifdef WITH_DBUS
SP_ARG_DBUS_LISTEN,
+ SP_ARG_DBUS_NAME,
#endif // WITH_DBUS
SP_ARG_VERB_LIST,
SP_ARG_VERB,
@@ -227,6 +233,7 @@ static gboolean sp_shell = FALSE;
static gboolean sp_vacuum_defs = FALSE;
#ifdef WITH_DBUS
static gboolean sp_dbus_listen = FALSE;
+static gchar *sp_dbus_name = NULL;
#endif // WITH_DBUS
static gchar *sp_export_png_utf8 = NULL;
static gchar *sp_export_svg_utf8 = NULL;
@@ -274,6 +281,7 @@ static void resetCommandlineGlobals() {
sp_vacuum_defs = FALSE;
#ifdef WITH_DBUS
sp_dbus_listen = FALSE;
+ sp_dbus_name = NULL;
#endif // WITH_DBUS
sp_export_png_utf8 = NULL;
@@ -487,6 +495,11 @@ struct poptOption options[] = {
POPT_ARG_NONE, &sp_dbus_listen, SP_ARG_DBUS_LISTEN,
N_("Enter a listening loop for D-Bus messages in console mode"),
NULL},
+
+ {"dbus-name", 0,
+ POPT_ARG_STRING, &sp_dbus_name, SP_ARG_DBUS_NAME,
+ N_("Specify the D-Bus bus name to listen for messages on (default is org.inkscape)"),
+ N_("BUS-NAME")},
#endif // WITH_DBUS
{"verb-list", 0,
@@ -885,6 +898,13 @@ static int sp_common_main( int argc, char const **argv, GSList **flDest )
if ( sp_global_printer )
sp_global_printer_utf8 = g_strdup( sp_global_printer );
}
+
+#ifdef WITH_DBUS
+ // Before initializing extensions, we must set the DBus bus name if required
+ if (sp_dbus_name != NULL) {
+ Inkscape::Extension::Dbus::dbus_set_bus_name(sp_dbus_name);
+ }
+#endif
// Return the list if wanted, else free it up.
if ( flDest ) {
diff --git a/src/selection.cpp b/src/selection.cpp
index d018aba0c..784219c88 100644
--- a/src/selection.cpp
+++ b/src/selection.cpp
@@ -358,6 +358,35 @@ SPItem *Selection::singleItem() {
}
}
+SPItem *Selection::smallestItem(Selection::CompareSize compare) {
+ return _sizeistItem(true, compare);
+}
+
+SPItem *Selection::largestItem(Selection::CompareSize compare) {
+ return _sizeistItem(false, compare);
+}
+
+SPItem *Selection::_sizeistItem(bool sml, Selection::CompareSize compare) {
+ GSList const *items = const_cast<Selection *>(this)->itemList();
+ gdouble max = sml ? 1e18 : 0;
+ SPItem *ist = NULL;
+
+ for ( GSList const *i = items; i != NULL ; i = i->next ) {
+ Geom::OptRect obox = SP_ITEM(i->data)->desktopPreferredBounds();
+ if (!obox || obox.isEmpty()) continue;
+ Geom::Rect bbox = *obox;
+
+ gdouble size = compare == 2 ? bbox.area() :
+ (compare == 1 ? bbox.width() : bbox.height());
+ size = sml ? size : size * -1;
+ if (size < max) {
+ max = size;
+ ist = SP_ITEM(i->data);
+ }
+ }
+ return ist;
+}
+
Inkscape::XML::Node *Selection::singleRepr() {
SPObject *obj=single();
return obj ? obj->getRepr() : NULL;
diff --git a/src/selection.h b/src/selection.h
index f076cf7aa..32eade21f 100644
--- a/src/selection.h
+++ b/src/selection.h
@@ -27,6 +27,7 @@
#include "sp-item.h"
#include "snapped-point.h"
+
class SPDesktop;
class SPItem;
class SPBox3D;
@@ -63,6 +64,7 @@ class Selection : public Inkscape::GC::Managed<>,
public Inkscape::GC::Anchored
{
public:
+ enum CompareSize { HORIZONTAL, VERTICAL, AREA };
/**
* Constructs an selection object, bound to a particular
* layer model
@@ -220,6 +222,16 @@ public:
SPItem *singleItem();
/**
+ * Returns the smallest item from this selection.
+ */
+ SPItem *smallestItem(CompareSize compare);
+
+ /**
+ * Returns the largest item from this selection.
+ */
+ SPItem *largestItem(CompareSize compare);
+
+ /**
* Returns a single selected object's xml node.
*
* @return NULL unless exactly one object is selected
@@ -349,6 +361,7 @@ private:
void add_3D_boxes_recursively(SPObject *obj);
void remove_box_perspective(SPBox3D *box);
void remove_3D_boxes_recursively(SPObject *obj);
+ SPItem *_sizeistItem(bool sml, CompareSize compare);
std::list<SPBox3D *> _3dboxes;
diff --git a/src/seltrans-handles.h b/src/seltrans-handles.h
index 5c3fdd269..740729a6e 100644
--- a/src/seltrans-handles.h
+++ b/src/seltrans-handles.h
@@ -33,7 +33,7 @@ enum SPSelTransType {
};
struct SPSelTransTypeInfo {
- uint const *color;
+ guint32 const *color;
gchar const *tip;
};
// One per handle type in order
diff --git a/src/seltrans.h b/src/seltrans.h
index 880f30c94..d97375520 100644
--- a/src/seltrans.h
+++ b/src/seltrans.h
@@ -180,7 +180,7 @@ private:
bool _center_is_set; ///< we've already set _center, no need to reread it from items
int _center_handle;
- SPKnot *knots[17];
+ SPKnot *knots[NUMHANDS];
SPCanvasItem *_norm;
SPCanvasItem *_grip;
SPCtrlLine *_l[4];
diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp
index 7f88824f7..8845b60e5 100644
--- a/src/ui/dialog/align-and-distribute.cpp
+++ b/src/ui/dialog/align-and-distribute.cpp
@@ -88,119 +88,73 @@ Action::Action(const Glib::ustring &id,
}
-void ActionAlign::do_action(SPDesktop *desktop, int index) {
-
+void ActionAlign::do_action(SPDesktop *desktop, int index)
+{
Inkscape::Selection *selection = sp_desktop_selection(desktop);
if (!selection) return;
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
bool sel_as_group = prefs->getBool("/dialogs/align/sel-as-groups");
- int prefs_bbox = prefs->getBool("/tools/bounding_box");
using Inkscape::Util::GSListConstIterator;
std::list<SPItem *> selected;
selected.insert<GSListConstIterator<SPItem *> >(selected.end(), selection->itemList(), NULL);
if (selected.empty()) return;
- Geom::Point mp; //Anchor point
- AlignAndDistribute::AlignTarget target = AlignAndDistribute::getAlignTarget();
- const Coeffs &a= _allCoeffs[index];
- switch (target)
- {
- case AlignAndDistribute::LAST:
- case AlignAndDistribute::FIRST:
- case AlignAndDistribute::BIGGEST:
- case AlignAndDistribute::SMALLEST:
+ const Coeffs &a = _allCoeffs[index];
+ SPItem *focus = NULL;
+ Geom::OptRect b = Geom::OptRect();
+ Selection::CompareSize horiz = (a.mx0 != 0.0) || (a.mx1 != 0.0)
+ ? Selection::HORIZONTAL : Selection::VERTICAL;
+
+ switch (AlignTarget(prefs->getInt("/dialogs/align/align-to", 6)))
{
- //Check 2 or more selected objects
- std::list<SPItem *>::iterator second(selected.begin());
- ++second;
- if (second == selected.end())
- return;
- //Find the master (anchor on which the other objects are aligned)
- std::list<SPItem *>::iterator master(
- AlignAndDistribute::find_master (
- selected,
- (a.mx0 != 0.0) ||
- (a.mx1 != 0.0) )
- );
- //remove the master from the selection
- SPItem * thing = *master;
- // TODO: either uncomment or remove the following commented lines, depending on which
- // behaviour of moving objects makes most sense; also cf. discussion at
- // https://bugs.launchpad.net/inkscape/+bug/255933
- /*if (!sel_as_group) { */
- selected.erase(master);
- /*}*/
- //Compute the anchor point
- Geom::OptRect b = !prefs_bbox ? thing->desktopVisualBounds() : thing->desktopGeometricBounds();
- if (b) {
- mp = Geom::Point(a.mx0 * b->min()[Geom::X] + a.mx1 * b->max()[Geom::X],
- a.my0 * b->min()[Geom::Y] + a.my1 * b->max()[Geom::Y]);
- } else {
- return;
- }
+ case LAST:
+ focus = SP_ITEM(*selected.begin());
break;
- }
-
- case AlignAndDistribute::PAGE:
- mp = Geom::Point(a.mx1 * sp_desktop_document(desktop)->getWidth(),
- a.my1 * sp_desktop_document(desktop)->getHeight());
+ case FIRST:
+ focus = SP_ITEM(*--(selected.end()));
break;
-
- case AlignAndDistribute::DRAWING:
- {
- Geom::OptRect b = !prefs_bbox ? sp_desktop_document(desktop)->getRoot()->desktopVisualBounds()
- : sp_desktop_document(desktop)->getRoot()->desktopGeometricBounds();
- if (b) {
- mp = Geom::Point(a.mx0 * b->min()[Geom::X] + a.mx1 * b->max()[Geom::X],
- a.my0 * b->min()[Geom::Y] + a.my1 * b->max()[Geom::Y]);
- } else {
- return;
- }
+ case BIGGEST:
+ focus = selection->largestItem(horiz);
break;
- }
-
- case AlignAndDistribute::SELECTION:
- {
- Geom::OptRect b = !prefs_bbox ? selection->visualBounds() : selection->geometricBounds();
- if (b) {
- mp = Geom::Point(a.mx0 * b->min()[Geom::X] + a.mx1 * b->max()[Geom::X],
- a.my0 * b->min()[Geom::Y] + a.my1 * b->max()[Geom::Y]);
- } else {
- return;
- }
+ case SMALLEST:
+ focus = selection->smallestItem(horiz);
+ break;
+ case PAGE:
+ b = sp_desktop_document(desktop)->preferredBounds();
+ break;
+ case DRAWING:
+ b = sp_desktop_document(desktop)->getRoot()->desktopPreferredBounds();
+ break;
+ case SELECTION:
+ b = selection->preferredBounds();
break;
- }
-
default:
g_assert_not_reached ();
break;
- }; // end of switch
+ };
+
+ if(focus)
+ b = focus->desktopPreferredBounds();
+ g_return_if_fail(b);
- // Top hack: temporarily set clone compensation to unmoved, so that we can align/distribute
- // clones with their original (and the move of the original does not disturb the
- // clones). The only problem with this is that if there are outside-of-selection clones of
- // a selected original, they will be unmoved too, possibly contrary to user's
- // expecation. However this is a minor point compared to making align/distribute always
- // work as expected, and "unmoved" is the default option anyway.
- int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED);
- prefs->setInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED);
+ // Generate the move point from the selected bounding box
+ Geom::Point mp = Geom::Point(a.mx0 * b->min()[Geom::X] + a.mx1 * b->max()[Geom::X],
+ a.my0 * b->min()[Geom::Y] + a.my1 * b->max()[Geom::Y]);
bool changed = false;
- Geom::OptRect b;
if (sel_as_group)
- b = !prefs_bbox ? selection->visualBounds() : selection->geometricBounds();
+ b = selection->preferredBounds();
//Move each item in the selected list separately
for (std::list<SPItem *>::iterator it(selected.begin());
- it != selected.end();
- ++it)
+ it != selected.end(); ++it)
{
sp_desktop_document (desktop)->ensureUpToDate();
if (!sel_as_group)
- b = !prefs_bbox ? (*it)->desktopVisualBounds() : (*it)->desktopGeometricBounds();
- if (b) {
+ b = (*it)->desktopPreferredBounds();
+ if (b && (!focus || (*it) != focus)) {
Geom::Point const sp(a.sx0 * b->min()[Geom::X] + a.sx1 * b->max()[Geom::X],
a.sy0 * b->min()[Geom::Y] + a.sy1 * b->max()[Geom::Y]);
Geom::Point const mp_rel( mp - sp );
@@ -211,15 +165,10 @@ void ActionAlign::do_action(SPDesktop *desktop, int index) {
}
}
- // restore compensation setting
- prefs->setInt("/options/clonecompensation/value", saved_compensation);
-
if (changed) {
DocumentUndo::done( sp_desktop_document(desktop) , SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
_("Align"));
}
-
-
}
@@ -1265,69 +1214,6 @@ void AlignAndDistribute::addBaselineButton(const Glib::ustring &id, const Glib::
*this, table, orientation, distribute));
}
-
-
-
-std::list<SPItem *>::iterator AlignAndDistribute::find_master( std::list<SPItem *> &list, bool horizontal){
- std::list<SPItem *>::iterator master = list.end();
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- int prefs_bbox = prefs->getBool("/tools/bounding_box");
- switch (getAlignTarget()) {
- case LAST:
- return list.begin();
- break;
-
- case FIRST:
- return --(list.end());
- break;
-
- case BIGGEST:
- {
- gdouble max = -1e18;
- for (std::list<SPItem *>::iterator it = list.begin(); it != list.end(); ++it) {
- Geom::OptRect b = !prefs_bbox ? (*it)->desktopVisualBounds() : (*it)->desktopGeometricBounds();
- if (b) {
- gdouble dim = (*b)[horizontal ? Geom::X : Geom::Y].extent();
- if (dim > max) {
- max = dim;
- master = it;
- }
- }
- }
- return master;
- }
-
- case SMALLEST:
- {
- gdouble max = 1e18;
- for (std::list<SPItem *>::iterator it = list.begin(); it != list.end(); ++it) {
- Geom::OptRect b = !prefs_bbox ? (*it)->desktopVisualBounds() : (*it)->desktopGeometricBounds();
- if (b) {
- gdouble dim = (*b)[horizontal ? Geom::X : Geom::Y].extent();
- if (dim < max) {
- max = dim;
- master = it;
- }
- }
- }
- return master;
- }
-
- default:
- g_assert_not_reached ();
- break;
-
- } // end of switch statement
- return master;
-}
-
-AlignAndDistribute::AlignTarget AlignAndDistribute::getAlignTarget() {
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- return AlignTarget(prefs->getInt("/dialogs/align/align-to", 6));
-}
-
-
-
} // namespace Dialog
} // namespace UI
} // namespace Inkscape
diff --git a/src/ui/dialog/align-and-distribute.h b/src/ui/dialog/align-and-distribute.h
index c9165a83e..dfd84535b 100644
--- a/src/ui/dialog/align-and-distribute.h
+++ b/src/ui/dialog/align-and-distribute.h
@@ -47,12 +47,6 @@ public:
static AlignAndDistribute &getInstance() { return *new AlignAndDistribute(); }
- enum AlignTarget { LAST=0, FIRST, BIGGEST, SMALLEST, PAGE, DRAWING, SELECTION };
-
-
-
- static AlignTarget getAlignTarget();
-
#if WITH_GTKMM_3_0
Gtk::Grid &align_table(){return _alignTable;}
Gtk::Grid &distribute_table(){return _distributeTable;}
@@ -67,7 +61,6 @@ public:
Gtk::Table &nodes_table(){return _nodesTable;}
#endif
- static std::list<SPItem *>::iterator find_master(std::list <SPItem *> &list, bool horizontal);
void setMode(bool nodeEdit);
Geom::OptRect randomize_bbox;
@@ -189,6 +182,7 @@ public :
double sx0, sx1, sy0, sy1;
int verb_id;
};
+ enum AlignTarget { LAST=0, FIRST, BIGGEST, SMALLEST, PAGE, DRAWING, SELECTION };
ActionAlign(const Glib::ustring &id,
const Glib::ustring &tiptext,
guint row, guint column,
@@ -204,6 +198,7 @@ public :
* Static function called to align from a keyboard shortcut
*/
static void do_verb_action(SPDesktop *desktop, int verb);
+ static int verb_to_coeff(int verb);
private :
@@ -217,7 +212,6 @@ private :
}
static void do_action(SPDesktop *desktop, int index);
- static int verb_to_coeff(int verb);
guint _index;
AlignAndDistribute &_dialog;
diff --git a/src/ui/widget/dock.cpp b/src/ui/widget/dock.cpp
index 2bfc7e0df..52e9ea605 100644
--- a/src/ui/widget/dock.cpp
+++ b/src/ui/widget/dock.cpp
@@ -48,11 +48,21 @@ const int Dock::_default_dock_bar_width = 36;
Dock::Dock(Gtk::Orientation orientation)
- : _gdl_dock (GDL_DOCK (gdl_dock_new())),
- _gdl_dock_bar (GDL_DOCK_BAR (gdl_dock_bar_new(GDL_DOCK(_gdl_dock)))),
+ : _gdl_dock(gdl_dock_new()),
+#if WITH_GDL_3_6
+ _gdl_dock_bar(GDL_DOCK_BAR(gdl_dock_bar_new(G_OBJECT(_gdl_dock)))),
+#else
+ _gdl_dock_bar(GDL_DOCK_BAR(gdl_dock_bar_new(GDL_DOCK(_gdl_dock)))),
+#endif
_scrolled_window (Gtk::manage(new Gtk::ScrolledWindow))
{
- gdl_dock_bar_set_orientation(_gdl_dock_bar, static_cast<GtkOrientation>(orientation));
+#if WITH_GDL_3_6
+ gtk_orientable_set_orientation(GTK_ORIENTABLE(_gdl_dock_bar),
+ static_cast<GtkOrientation>(orientation));
+#else
+ gdl_dock_bar_set_orientation(_gdl_dock_bar,
+ static_cast<GtkOrientation>(orientation));
+#endif
#if WITH_GTKMM_3_0
switch(orientation) {
@@ -127,7 +137,9 @@ Dock::~Dock()
void Dock::addItem(DockItem& item, DockItem::Placement placement)
{
_dock_items.push_back(&item);
- gdl_dock_add_item(_gdl_dock, GDL_DOCK_ITEM(item.gobj()), (GdlDockPlacement)placement);
+ gdl_dock_add_item(GDL_DOCK(_gdl_dock),
+ GDL_DOCK_ITEM(item.gobj()),
+ (GdlDockPlacement)placement);
// FIXME: This is a hack to prevent the dock from expanding the main window, this can't be done
// initially as the paned doesn't exist.
diff --git a/src/ui/widget/dock.h b/src/ui/widget/dock.h
index 611c10f46..33e60b836 100644
--- a/src/ui/widget/dock.h
+++ b/src/ui/widget/dock.h
@@ -74,11 +74,11 @@ protected:
/** Interface widgets, will be packed like
* _scrolled_window -> (_dock_box -> (_paned -> (_dock -> _filler) | _dock_bar))
*/
- Gtk::Box *_dock_box;
- Gtk::Paned* _paned;
- GdlDock *_gdl_dock;
- GdlDockBar *_gdl_dock_bar;
- Gtk::VBox _filler;
+ Gtk::Box *_dock_box;
+ Gtk::Paned *_paned;
+ GtkWidget *_gdl_dock;
+ GdlDockBar *_gdl_dock_bar;
+ Gtk::VBox _filler;
Gtk::ScrolledWindow *_scrolled_window;
/** Internal signal handlers */
diff --git a/src/util/units.cpp b/src/util/units.cpp
index f822d01de..d1275b082 100644
--- a/src/util/units.cpp
+++ b/src/util/units.cpp
@@ -11,6 +11,39 @@
#include "path-prefix.h"
#include "streq.h"
+using Inkscape::Util::UNIT_TYPE_DIMENSIONLESS;
+using Inkscape::Util::UNIT_TYPE_LINEAR;
+using Inkscape::Util::UNIT_TYPE_RADIAL;
+using Inkscape::Util::UNIT_TYPE_FONT_HEIGHT;
+
+namespace
+{
+
+/**
+ * A std::map that gives the data type value for the string version.
+ *
+ * Note that we'd normally not return a reference to an internal version, but
+ * for this constant case it allows us to check against getTypeMappings().end().
+ */
+/** @todo consider hiding map behind hasFoo() and getFoo() type functions.*/
+std::map<Glib::ustring, Inkscape::Util::UnitType> &getTypeMappings()
+{
+ static bool init = false;
+ static std::map<Glib::ustring, Inkscape::Util::UnitType> typeMap;
+ if (!init)
+ {
+ init = true;
+ typeMap["DIMENSIONLESS"] = UNIT_TYPE_DIMENSIONLESS;
+ typeMap["LINEAR"] = UNIT_TYPE_LINEAR;
+ typeMap["RADIAL"] = UNIT_TYPE_RADIAL;
+ typeMap["FONT_HEIGHT"] = UNIT_TYPE_FONT_HEIGHT;
+ // Note that code was not yet handling LINEAR_SCALED, TIME, QTY and NONE
+ }
+ return typeMap;
+}
+
+} // namespace
+
namespace Inkscape {
namespace Util {
@@ -40,179 +73,172 @@ UnitsSAXHandler::UnitsSAXHandler(UnitTable *table) :
#define BUFSIZE (255)
-/**
- * Returns the suggested precision to use for displaying numbers
- * of this unit.
- */
+Unit::Unit() :
+ type(UNIT_TYPE_DIMENSIONLESS), // should this or NONE be the default?
+ factor(1.0),
+ name(),
+ name_plural(),
+ abbr(),
+ description()
+{
+}
+
+Unit::Unit(UnitType type,
+ double factor,
+ Glib::ustring const &name,
+ Glib::ustring const &name_plural,
+ Glib::ustring const &abbr,
+ Glib::ustring const &description) :
+ type(type),
+ factor(factor),
+ name(name),
+ name_plural(name_plural),
+ abbr(abbr),
+ description(description)
+{
+}
+
+void Unit::clear()
+{
+ *this = Unit();
+}
+
int Unit::defaultDigits() const {
int factor_digits = int(log10(factor));
if (factor_digits < 0) {
g_warning("factor = %f, factor_digits = %d", factor, factor_digits);
g_warning("factor_digits < 0 - returning 0");
- return 0;
- } else {
- return factor_digits;
+ factor_digits = 0;
}
+ return factor_digits;
}
-/**
- * Initializes the unit tables and identifies the primary unit types.
- *
- * The primary unit's conversion factor is required to be 1.00
- */
-UnitTable::UnitTable()
+UnitTable::UnitTable()
{
// if we swich to the xml file, don't forget to force locale to 'C'
- // load("share/ui/units.xml"); // <-- Buggy
+ // load("share/ui/units.xml"); // <-- Buggy
gchar *filename = g_build_filename(INKSCAPE_UIDIR, "units.txt", NULL);
loadText(filename);
g_free(filename);
}
UnitTable::~UnitTable() {
- UnitMap::iterator iter = _unit_map.begin();
- while (iter != _unit_map.end()) {
- delete (*iter).second;
- ++iter;
+ for (UnitMap::iterator iter = _unit_map.begin(); iter != _unit_map.end(); ++iter)
+ {
+ delete (*iter).second;
}
}
-/** Add a new unit to the table */
void UnitTable::addUnit(Unit const &u, bool primary) {
_unit_map[u.abbr] = new Unit(u);
if (primary) {
- _primary_unit[u.type] = u.abbr;
+ _primary_unit[u.type] = u.abbr;
}
}
-/** Retrieve a given unit based on its string identifier */
Unit UnitTable::getUnit(Glib::ustring const &unit_abbr) const {
UnitMap::const_iterator iter = _unit_map.find(unit_abbr);
if (iter != _unit_map.end()) {
- return *((*iter).second);
+ return *((*iter).second);
} else {
- return Unit();
+ return Unit();
}
}
-/** Remove a unit definition from the given unit type table */
bool UnitTable::deleteUnit(Unit const &u) {
- if (u.abbr == _primary_unit[u.type]) {
- // Cannot delete the primary unit type since it's
- // used for conversions
- return false;
- }
- UnitMap::iterator iter = _unit_map.find(u.abbr);
- if (iter != _unit_map.end()) {
- delete (*iter).second;
- _unit_map.erase(iter);
- return true;
- } else {
- return false;
+ bool deleted = false;
+ // Cannot delete the primary unit type since it's
+ // used for conversions
+ if (u.abbr != _primary_unit[u.type]) {
+ UnitMap::iterator iter = _unit_map.find(u.abbr);
+ if (iter != _unit_map.end()) {
+ delete (*iter).second;
+ _unit_map.erase(iter);
+ deleted = true;
+ }
}
+ return deleted;
}
-/** Returns true if the given string 'name' is a valid unit in the table */
bool UnitTable::hasUnit(Glib::ustring const &unit) const
{
UnitMap::const_iterator iter = _unit_map.find(unit);
return (iter != _unit_map.end());
}
-/** Provides an iteratable list of items in the given unit table */
UnitTable::UnitMap UnitTable::units(UnitType type) const
{
UnitMap submap;
- for (UnitMap::const_iterator iter = _unit_map.begin();
- iter != _unit_map.end(); ++iter) {
- if (((*iter).second)->type == type) {
- submap.insert(UnitMap::value_type((*iter).first, new Unit(*((*iter).second))));
- }
+ for (UnitMap::const_iterator iter = _unit_map.begin(); iter != _unit_map.end(); ++iter) {
+ if (((*iter).second)->type == type) {
+ submap.insert(UnitMap::value_type((*iter).first, new Unit(*((*iter).second))));
+ }
}
return submap;
}
-/** Returns the default unit abbr for the given type */
Glib::ustring UnitTable::primary(UnitType type) const
{
return _primary_unit[type];
}
-/** Loads units from a text file.
-
- loadText loads and merges the contents of the given file into the UnitTable,
- possibly overwriting existing unit definitions.
-
- @param filename: file to be loaded*/
bool UnitTable::loadText(Glib::ustring const &filename)
{
- char buf[BUFSIZE];
+ char buf[BUFSIZE] = {0};
// Open file for reading
FILE * f = fopen(filename.c_str(), "r");
if (f == NULL) {
- g_warning("Could not open units file '%s': %s\n",
- filename.c_str(), strerror(errno));
+ g_warning("Could not open units file '%s': %s\n",
+ filename.c_str(), strerror(errno));
g_warning("* INKSCAPE_DATADIR is: '%s'\n", INKSCAPE_DATADIR);
g_warning("* INKSCAPE_UIDIR is: '%s'\n", INKSCAPE_UIDIR);
- return false;
+ return false;
}
+ /** @todo fix this to use C++ means and explicit locale to avoid need to change. */
// bypass current locale in order to make
// sscanf read floats with '.' as a separator
// set locale to 'C' and keep old locale
- char *old_locale;
- old_locale = g_strdup (setlocale (LC_NUMERIC, NULL));
+ char *old_locale = g_strdup(setlocale(LC_NUMERIC, NULL));
setlocale (LC_NUMERIC, "C");
while (fgets(buf, BUFSIZE, f) != NULL) {
- char name[BUFSIZE];
- char plural[BUFSIZE];
- char abbr[BUFSIZE];
- char type[BUFSIZE];
- double factor;
- char primary[BUFSIZE];
-
- int nchars = 0;
- // locale is set to C, scanning %lf should work _everywhere_
- if (sscanf(buf, "%15s %15s %15s %15s %8lf %1s %15n",
- name, plural, abbr, type, &factor, primary, &nchars) != 6)
- {
- // Skip the line - doesn't appear to be valid
- continue;
- }
-
- g_assert(nchars < BUFSIZE);
-
- char *desc = buf;
- desc += nchars; // buf is now only the description
-
- // insert into _unit_map
- Unit u;
- u.name = name;
- u.name_plural = plural;
- u.abbr = abbr;
- u.description = desc;
- u.factor = factor;
-
- if (streq(type, "DIMENSIONLESS")) {
- u.type = UNIT_TYPE_DIMENSIONLESS;
- } else if (streq(type, "LINEAR")) {
- u.type = UNIT_TYPE_LINEAR;
- } else if (streq(type, "RADIAL")) {
- u.type = UNIT_TYPE_RADIAL;
- } else if (streq(type, "FONT_HEIGHT")) {
- u.type = UNIT_TYPE_FONT_HEIGHT;
- } else {
- g_warning("Skipping unknown unit type '%s' for %s.\n",
- type, name);
- continue;
- }
-
- // if primary is 'Y', list this unit as a primary
- addUnit(u, (primary[0]=='Y' || primary[0]=='y'));
+ char name[BUFSIZE] = {0};
+ char plural[BUFSIZE] = {0};
+ char abbr[BUFSIZE] = {0};
+ char type[BUFSIZE] = {0};
+ double factor = 0.0;
+ char primary[BUFSIZE] = {0};
+
+ int nchars = 0;
+ // locale is set to C, scanning %lf should work _everywhere_
+ /** @todo address %15n, which causes a warning: */
+ if (sscanf(buf, "%15s %15s %15s %15s %8lf %1s %15n",
+ name, plural, abbr, type, &factor, primary, &nchars) != 6)
+ {
+ // Skip the line - doesn't appear to be valid
+ continue;
+ }
+
+ g_assert(nchars < BUFSIZE);
+
+ char *desc = buf;
+ desc += nchars; // buf is now only the description
+
+ // insert into _unit_map
+ if (getTypeMappings().find(type) == getTypeMappings().end())
+ {
+ g_warning("Skipping unknown unit type '%s' for %s.\n", type, name);
+ continue;
+ }
+ UnitType utype = getTypeMappings()[type];
+
+ Unit u(utype, factor, name, plural, abbr, desc);
+ // if primary is 'Y', list this unit as a primary
+ addUnit(u, (primary[0]=='Y' || primary[0]=='y'));
}
// set back the saved locale
@@ -221,9 +247,8 @@ bool UnitTable::loadText(Glib::ustring const &filename)
// close file
if (fclose(f) != 0) {
- g_warning("Error closing units file '%s': %s\n",
- filename.c_str(), strerror(errno));
- return false;
+ g_warning("Error closing units file '%s': %s\n", filename.c_str(), strerror(errno));
+ return false;
}
return true;
@@ -235,23 +260,20 @@ bool UnitTable::load(Glib::ustring const &filename) {
int result = handler.parseFile( filename.c_str() );
if ( result != 0 ) {
// perhaps
- g_warning("Problem loading units file '%s': %d\n",
- filename.c_str(), result);
- return false;
+ g_warning("Problem loading units file '%s': %d\n", filename.c_str(), result);
+ return false;
}
return true;
}
-/** Saves the current UnitTable to the given file. */
bool UnitTable::save(Glib::ustring const &filename) {
// open file for writing
FILE *f = fopen(filename.c_str(), "w");
if (f == NULL) {
- g_warning("Could not open units file '%s': %s\n",
- filename.c_str(), strerror(errno));
- return false;
+ g_warning("Could not open units file '%s': %s\n", filename.c_str(), strerror(errno));
+ return false;
}
// write out header
@@ -268,9 +290,8 @@ bool UnitTable::save(Glib::ustring const &filename) {
// close file
if (fclose(f) != 0) {
- g_warning("Error closing units file '%s': %s\n",
- filename.c_str(), strerror(errno));
- return false;
+ g_warning("Error closing units file '%s': %s\n", filename.c_str(), strerror(errno));
+ return false;
}
return true;
@@ -281,12 +302,7 @@ void UnitsSAXHandler::_startElement(xmlChar const *name, xmlChar const **attrs)
{
if (streq("unit", (char const *)name)) {
// reset for next use
- unit.name.clear();
- unit.name_plural.clear();
- unit.abbr.clear();
- unit.description.clear();
- unit.type = UNIT_TYPE_DIMENSIONLESS;
- unit.factor = 1.0;
+ unit.clear();
primary = false;
skip = false;
@@ -294,14 +310,9 @@ void UnitsSAXHandler::_startElement(xmlChar const *name, xmlChar const **attrs)
char const *const key = (char const *)attrs[i];
if (streq("type", key)) {
char const *type = (char const*)attrs[i+1];
- if (streq(type, "DIMENSIONLESS")) {
- unit.type = UNIT_TYPE_DIMENSIONLESS;
- } else if (streq(type, "LINEAR")) {
- unit.type = UNIT_TYPE_LINEAR;
- } else if (streq(type, "RADIAL")) {
- unit.type = UNIT_TYPE_RADIAL;
- } else if (streq(type, "FONT_HEIGHT")) {
- unit.type = UNIT_TYPE_FONT_HEIGHT;
+ if (getTypeMappings().find(type) != getTypeMappings().end())
+ {
+ unit.type = getTypeMappings()[type];
} else {
g_warning("Skipping unknown unit type '%s' for %s.\n", type, name);
skip = true;
diff --git a/src/util/units.h b/src/util/units.h
index b22bdb1f2..40c89a4a0 100644
--- a/src/util/units.h
+++ b/src/util/units.h
@@ -36,40 +36,78 @@ const char DEG[] = "°";
class Unit {
public:
- Glib::ustring name;
- Glib::ustring name_plural;
- Glib::ustring abbr;
- Glib::ustring description;
-
- UnitType type;
+ Unit();
+ Unit(UnitType type,
+ double factor,
+ Glib::ustring const &name,
+ Glib::ustring const &name_plural,
+ Glib::ustring const &abbr,
+ Glib::ustring const &description);
- double factor;
+ void clear();
bool isAbsolute() const { return type != UNIT_TYPE_DIMENSIONLESS; }
+
+ /**
+ * Returns the suggested precision to use for displaying numbers
+ * of this unit.
+ */
int defaultDigits() const;
+
+ UnitType type;
+ double factor;
+ Glib::ustring name;
+ Glib::ustring name_plural;
+ Glib::ustring abbr;
+ Glib::ustring description;
};
class UnitTable {
public:
+ /**
+ * Initializes the unit tables and identifies the primary unit types.
+ *
+ * The primary unit's conversion factor is required to be 1.00
+ */
UnitTable();
virtual ~UnitTable();
typedef std::map<Glib::ustring, Unit*> UnitMap;
+ /** Add a new unit to the table */
void addUnit(Unit const& u, bool primary);
+
+ /** Retrieve a given unit based on its string identifier */
Unit getUnit(Glib::ustring const& name) const;
+
+ /** Remove a unit definition from the given unit type table */
bool deleteUnit(Unit const& u);
+
+ /** Returns true if the given string 'name' is a valid unit in the table */
bool hasUnit(Glib::ustring const &name) const;
+ /** Provides an iteratable list of items in the given unit table */
UnitTable::UnitMap units(UnitType type) const;
+ /** Returns the default unit abbr for the given type */
Glib::ustring primary(UnitType type) const;
double getScale() const;
+
void setScale();
bool load(Glib::ustring const &filename);
+
+ /** Loads units from a text file.
+ *
+ * loadText loads and merges the contents of the given file into the UnitTable,
+ * possibly overwriting existing unit definitions.
+ *
+ * @param filename file to be loaded
+ */
bool loadText(Glib::ustring const &filename);
+
+ /** Saves the current UnitTable to the given file. */
bool save(Glib::ustring const &filename);
protected:
@@ -88,3 +126,13 @@ class UnitTable {
} // namespace Inkscape
#endif // define INKSCAPE_UTIL_UNITS_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:fileencoding=utf-8:textwidth=99 :
diff --git a/src/verbs.cpp b/src/verbs.cpp
index 1dae8bcf0..d0396155c 100644
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
@@ -2903,7 +2903,17 @@ Verb *Verb::_base_verbs[] = {
N_("Link an ICC color profile"), NULL),
new EditVerb(SP_VERB_EDIT_REMOVE_COLOR_PROFILE, "RemoveColorProfile", N_("Remove Color Profile"),
N_("Remove a linked ICC color profile"), NULL),
-
+ // Scripting
+ new ContextVerb(SP_VERB_EDIT_ADD_EXTERNAL_SCRIPT, "AddExternalScript",
+ N_("Add External Script"), N_("Add an external script"), NULL),
+ new ContextVerb(SP_VERB_EDIT_ADD_EMBEDDED_SCRIPT, "AddEmbeddedScript",
+ N_("Add Embedded Script"), N_("Add an embedded script"), NULL),
+ new ContextVerb(SP_VERB_EDIT_EMBEDDED_SCRIPT, "EditEmbeddedScript",
+ N_("Edit Embedded Script"), N_("Edit an embedded script"), NULL),
+ new ContextVerb(SP_VERB_EDIT_REMOVE_EXTERNAL_SCRIPT, "RemoveExternalScript",
+ N_("Remove External Script"), N_("Remove an external script"), NULL),
+ new ContextVerb(SP_VERB_EDIT_REMOVE_EMBEDDED_SCRIPT, "RemoveEmbeddedScript",
+ N_("Remove Embedded Script"), N_("Remove an embedded script"), NULL),
// Align
new ContextVerb(SP_VERB_ALIGN_HORIZONTAL_RIGHT_TO_ANCHOR, "AlignHorizontalRightToAnchor", N_("Align right edges of objects to the left edge of the anchor"),
N_("Align right edges of objects to the left edge of the anchor"), INKSCAPE_ICON("align-horizontal-right-to-anchor")),