summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiam P. White <inkscapebrony@gmail.com>2014-08-09 18:55:23 +0000
committerLiam P. White <inkscapebrony@gmail.com>2014-08-09 18:55:23 +0000
commitc3115995762ecfed8ebed035cf682c525a32dd0c (patch)
treec959648001273acf4f0e70bcca8ffdbe36fc438f /src
parentMassive performance improvment for basic node operations with thousands of nodes (diff)
parentFix related to bug #1327267 -- don't bother to update gradient toolbar when n... (diff)
downloadinkscape-c3115995762ecfed8ebed035cf682c525a32dd0c.tar.gz
inkscape-c3115995762ecfed8ebed035cf682c525a32dd0c.zip
Update to trunk r13504
(bzr r13341.1.125)
Diffstat (limited to 'src')
-rw-r--r--src/libavoid/connector.cpp5
-rw-r--r--src/sp-star.cpp9
-rw-r--r--src/ui/dialog/xml-tree.cpp1
-rw-r--r--src/widgets/gradient-toolbar.cpp75
4 files changed, 54 insertions, 36 deletions
diff --git a/src/libavoid/connector.cpp b/src/libavoid/connector.cpp
index b8c99a48c..40ded7498 100644
--- a/src/libavoid/connector.cpp
+++ b/src/libavoid/connector.cpp
@@ -845,7 +845,10 @@ bool ConnRef::generatePath(void)
break;
}
// Check we don't have an apparent infinite connector path.
- COLA_ASSERT(pathlen < 200);
+//#ifdef PATHDEBUG
+ db_printf("Path length: %i\n", pathlen);
+//#endif
+ COLA_ASSERT(pathlen < 10000);
}
std::vector<Point> path(pathlen);
diff --git a/src/sp-star.cpp b/src/sp-star.cpp
index 712029468..97a690520 100644
--- a/src/sp-star.cpp
+++ b/src/sp-star.cpp
@@ -513,12 +513,11 @@ void SPStar::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::
}
}
-Geom::Affine SPStar::set_transform(Geom::Affine const &tform)
+Geom::Affine SPStar::set_transform(Geom::Affine const &xform)
{
- Geom::Affine xform = (randomized == 0 ? tform.withoutTranslation() : tform);
-
+ bool opt_trans = (randomized == 0);
// Only set transform with proportional scaling
- if (!xform.isUniformScale()) {
+ if (!xform.withoutTranslation().isUniformScale()) {
return xform;
}
@@ -532,7 +531,7 @@ Geom::Affine SPStar::set_transform(Geom::Affine const &tform)
/* This function takes care of translation and scaling, we return whatever parts we can't
handle. */
- Geom::Affine ret(xform);
+ Geom::Affine ret(opt_trans ? xform.withoutTranslation() : xform);
gdouble const s = hypot(ret[0], ret[1]);
if (s > 1e-9) {
ret[0] /= s;
diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp
index 55d0aff09..c87e42633 100644
--- a/src/ui/dialog/xml-tree.cpp
+++ b/src/ui/dialog/xml-tree.cpp
@@ -1033,6 +1033,7 @@ void XmlTree::cmd_set_attr()
updated->updateRepr();
}
+ reinterpret_cast<SPObject *>(current_desktop->currentLayer())->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
DocumentUndo::done(current_document, SP_VERB_DIALOG_XML_EDITOR,
_("Change attribute"));
diff --git a/src/widgets/gradient-toolbar.cpp b/src/widgets/gradient-toolbar.cpp
index 4fda44c8d..f5a99f3e7 100644
--- a/src/widgets/gradient-toolbar.cpp
+++ b/src/widgets/gradient-toolbar.cpp
@@ -448,11 +448,6 @@ static void gr_defs_modified(SPObject * /*defs*/, guint /*flags*/, GtkWidget *wi
gr_tb_selection_changed(NULL, (gpointer) widget);
}
-static void gr_disconnect_sigc(GObject * /*obj*/, sigc::connection *connection) {
- connection->disconnect();
- delete connection;
-}
-
static SPStop *get_selected_stop( GtkWidget *vb)
{
SPStop *stop = NULL;
@@ -1018,6 +1013,9 @@ void check_renderer(GtkWidget *combo)
g_object_set_data(G_OBJECT(combo), "renderers", renderer);
}
}
+
+static void gradient_toolbox_check_ec(SPDesktop* dt, Inkscape::UI::Tools::ToolBase* ec, GObject* holder);
+
/**
* Gradient auxiliary toolbar construction and setup.
*
@@ -1229,34 +1227,51 @@ void sp_gradient_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions,
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(itact), !linkedmode );
}
- Inkscape::Selection *selection = sp_desktop_selection(desktop);
- SPDocument *document = sp_desktop_document(desktop);
-
g_object_set_data(holder, "desktop", desktop);
- // connect to selection modified and changed signals
- sigc::connection *conn1 = new sigc::connection(
- selection->connectChanged(sigc::bind(sigc::ptr_fun(&gr_tb_selection_changed), (gpointer) holder)));
- sigc::connection *conn2 = new sigc::connection(
- selection->connectModified(sigc::bind(sigc::ptr_fun(&gr_tb_selection_modified), (gpointer) holder)));
- sigc::connection *conn3 = new sigc::connection(
- desktop->connectToolSubselectionChanged( sigc::bind(sigc::ptr_fun(&gr_drag_selection_changed), (gpointer) holder)));
-
- // when holder is destroyed, disconnect
- g_signal_connect(G_OBJECT(holder), "destroy", G_CALLBACK(gr_disconnect_sigc), conn1);
- g_signal_connect(G_OBJECT(holder), "destroy", G_CALLBACK(gr_disconnect_sigc), conn2);
- g_signal_connect(G_OBJECT(holder), "destroy", G_CALLBACK(gr_disconnect_sigc), conn3);
-
- // connect to release and modified signals of the defs (i.e. when someone changes gradient)
- sigc::connection *release_connection = new sigc::connection();
- *release_connection = document->getDefs()->connectRelease(sigc::bind<1>(sigc::ptr_fun(&gr_defs_release), GTK_WIDGET(holder)));
- sigc::connection *modified_connection = new sigc::connection();
- *modified_connection = document->getDefs()->connectModified(sigc::bind<2>(sigc::ptr_fun(&gr_defs_modified), GTK_WIDGET(holder)));
-
- // when holder is destroyed, disconnect
- g_signal_connect(G_OBJECT(holder), "destroy", G_CALLBACK(gr_disconnect_sigc), release_connection);
- g_signal_connect(G_OBJECT(holder), "destroy", G_CALLBACK(gr_disconnect_sigc), modified_connection);
+ desktop->connectEventContextChanged(sigc::bind(sigc::ptr_fun(&gradient_toolbox_check_ec), holder));
+}
+
+// lp:1327267
+/**
+ * Checks the current tool and connects gradient aux toolbox signals if it happens to be the gradient tool.
+ * Called every time the current tool changes by signal emission.
+ */
+static void gradient_toolbox_check_ec(SPDesktop* desktop, Inkscape::UI::Tools::ToolBase* ec, GObject* holder)
+{
+ static sigc::connection connChanged;
+ static sigc::connection connModified;
+ static sigc::connection connSubselectionChanged;
+ static sigc::connection connDefsRelease;
+ static sigc::connection connDefsModified;
+
+ if (SP_IS_GRADIENT_CONTEXT(ec)) {
+ Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ SPDocument *document = sp_desktop_document(desktop);
+ // connect to selection modified and changed signals
+ connChanged = selection->connectChanged(sigc::bind(sigc::ptr_fun(&gr_tb_selection_changed), holder));
+ connModified = selection->connectModified(sigc::bind(sigc::ptr_fun(&gr_tb_selection_modified), holder));
+ connSubselectionChanged = desktop->connectToolSubselectionChanged(sigc::bind(sigc::ptr_fun(&gr_drag_selection_changed), holder));
+
+ // Is this necessary? Couldn't hurt.
+ gr_tb_selection_changed(selection, holder);
+
+ // connect to release and modified signals of the defs (i.e. when someone changes gradient)
+ connDefsRelease = document->getDefs()->connectRelease(sigc::bind<1>(sigc::ptr_fun(&gr_defs_release), GTK_WIDGET(holder)));
+ connDefsModified = document->getDefs()->connectModified(sigc::bind<2>(sigc::ptr_fun(&gr_defs_modified), GTK_WIDGET(holder)));
+ } else {
+ if (connChanged)
+ connChanged.disconnect();
+ if (connModified)
+ connModified.disconnect();
+ if (connSubselectionChanged)
+ connSubselectionChanged.disconnect();
+ if (connDefsRelease)
+ connDefsRelease.disconnect();
+ if (connDefsModified)
+ connDefsModified.disconnect();
+ }
}
/*