summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiam P. White <inkscapebrony@gmail.com>2014-08-10 02:47:25 +0000
committerLiam P. White <inkscapebrony@gmail.com>2014-08-10 02:47:25 +0000
commit764f8e7612bbf000a5fab4eeed165432f4ff779b (patch)
treeee2a1c55b35548b5d585c80c99de4860c0fb448f /src
parentUpdate to trunk r13504 (diff)
downloadinkscape-764f8e7612bbf000a5fab4eeed165432f4ff779b.tar.gz
inkscape-764f8e7612bbf000a5fab4eeed165432f4ff779b.zip
Further fixes related to bug #1327267, toolbars don't need to update when their context is not in use
(bzr r13341.1.126)
Diffstat (limited to 'src')
-rw-r--r--src/ui/tools/arc-tool.h2
-rw-r--r--src/widgets/arc-toolbar.cpp20
-rw-r--r--src/widgets/box3d-toolbar.cpp20
-rw-r--r--src/widgets/lpe-toolbar.cpp32
-rw-r--r--src/widgets/mesh-toolbar.cpp88
-rw-r--r--src/widgets/node-toolbar.cpp45
-rw-r--r--src/widgets/rect-toolbar.cpp20
-rw-r--r--src/widgets/star-toolbar.cpp23
-rw-r--r--src/widgets/text-toolbar.cpp2
9 files changed, 153 insertions, 99 deletions
diff --git a/src/ui/tools/arc-tool.h b/src/ui/tools/arc-tool.h
index c4c67660d..55cbaf78c 100644
--- a/src/ui/tools/arc-tool.h
+++ b/src/ui/tools/arc-tool.h
@@ -30,7 +30,7 @@ namespace Inkscape {
}
#define SP_ARC_CONTEXT(obj) (dynamic_cast<Inkscape::UI::Tools::ArcTool*>((Inkscape::UI::Tools::ToolBase*)obj))
-#define SP_IS_ARC_CONTEXT(obj) (dynamic_cast<const Inkscape::UI::Tools::ArcTool*>(const Inkscape::UI::Tools::ToolBase*(obj)) != NULL)
+#define SP_IS_ARC_CONTEXT(obj) (dynamic_cast<const Inkscape::UI::Tools::ArcTool*>(obj) != NULL)
namespace Inkscape {
namespace UI {
diff --git a/src/widgets/arc-toolbar.cpp b/src/widgets/arc-toolbar.cpp
index ca6810c81..1005de70d 100644
--- a/src/widgets/arc-toolbar.cpp
+++ b/src/widgets/arc-toolbar.cpp
@@ -45,6 +45,7 @@
#include "toolbox.h"
#include "ui/icon-names.h"
#include "ui/uxmanager.h"
+#include "ui/tools/arc-tool.h"
#include "verbs.h"
#include "widgets/spinbutton-events.h"
#include "xml/node-event-vector.h"
@@ -304,6 +305,7 @@ static void sp_arc_toolbox_selection_changed(Inkscape::Selection *selection, GOb
}
}
+static void arc_toolbox_check_ec(SPDesktop* dt, Inkscape::UI::Tools::ToolBase* ec, GObject* holder);
void sp_arc_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
{
@@ -402,14 +404,22 @@ void sp_arc_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObjec
sp_arctb_sensitivize( holder, gtk_adjustment_get_value(adj1), gtk_adjustment_get_value(adj2) );
}
-
- sigc::connection *connection = new sigc::connection(
- sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(sp_arc_toolbox_selection_changed), G_OBJECT(holder)))
- );
- g_signal_connect( holder, "destroy", G_CALLBACK(delete_connection), connection );
+ desktop->connectEventContextChanged(sigc::bind(sigc::ptr_fun(arc_toolbox_check_ec), holder));
g_signal_connect( holder, "destroy", G_CALLBACK(purge_repr_listener), holder );
}
+static void arc_toolbox_check_ec(SPDesktop* desktop, Inkscape::UI::Tools::ToolBase* ec, GObject* holder)
+{
+ static sigc::connection changed;
+
+ if (SP_IS_ARC_CONTEXT(ec)) {
+ changed = sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(sp_arc_toolbox_selection_changed), holder));
+ sp_arc_toolbox_selection_changed(sp_desktop_selection(desktop), holder);
+ } else {
+ if (changed)
+ changed.disconnect();
+ }
+}
/*
Local Variables:
diff --git a/src/widgets/box3d-toolbar.cpp b/src/widgets/box3d-toolbar.cpp
index 6d6b86c4d..7629e8c24 100644
--- a/src/widgets/box3d-toolbar.cpp
+++ b/src/widgets/box3d-toolbar.cpp
@@ -43,6 +43,7 @@
#include "selection.h"
#include "toolbox.h"
#include "ui/icon-names.h"
+#include "ui/tools/box3d-tool.h"
#include "ui/uxmanager.h"
#include "verbs.h"
#include "xml/node-event-vector.h"
@@ -280,6 +281,8 @@ static void box3d_vp_z_state_changed( GtkToggleAction *act, GtkAction *box3d_ang
box3d_vp_state_changed(act, box3d_angle, Proj::Z);
}
+static void box3d_toolbox_check_ec(SPDesktop* dt, Inkscape::UI::Tools::ToolBase* ec, GObject* holder);
+
void box3d_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
@@ -409,13 +412,22 @@ void box3d_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), prefs->getBool("/tools/shapes/3dbox/vp_z_state", true) );
}
- sigc::connection *connection = new sigc::connection(
- sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(box3d_toolbox_selection_changed), G_OBJECT(holder)))
- );
- g_signal_connect(holder, "destroy", G_CALLBACK(delete_connection), connection);
+ desktop->connectEventContextChanged(sigc::bind(sigc::ptr_fun(box3d_toolbox_check_ec), holder));
g_signal_connect(holder, "destroy", G_CALLBACK(purge_repr_listener), holder);
}
+static void box3d_toolbox_check_ec(SPDesktop* desktop, Inkscape::UI::Tools::ToolBase* ec, GObject* holder)
+{
+ static sigc::connection changed;
+ if (SP_IS_BOX3D_CONTEXT(ec)) {
+ changed = sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(box3d_toolbox_selection_changed), holder));
+ box3d_toolbox_selection_changed(sp_desktop_selection(desktop), holder);
+ } else {
+ if (changed)
+ changed.disconnect();
+ }
+}
+
/*
Local Variables:
mode:c++
diff --git a/src/widgets/lpe-toolbar.cpp b/src/widgets/lpe-toolbar.cpp
index 94d42b5eb..9d1e0983f 100644
--- a/src/widgets/lpe-toolbar.cpp
+++ b/src/widgets/lpe-toolbar.cpp
@@ -276,6 +276,8 @@ static void lpetool_open_lpe_dialog(GtkToggleAction *act, gpointer data)
gtk_toggle_action_set_active(act, false);
}
+static void lpetool_toolbox_watch_ec(SPDesktop* dt, Inkscape::UI::Tools::ToolBase* ec, GObject* holder);
+
void sp_lpetool_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
{
UnitTracker* tracker = new UnitTracker(Inkscape::Util::UNIT_TYPE_LINEAR);
@@ -402,21 +404,27 @@ void sp_lpetool_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GO
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(act), FALSE );
}
- //watch selection
- Inkscape::ConnectionPool* pool = Inkscape::ConnectionPool::new_connection_pool ("ISNodeToolbox");
+ desktop->connectEventContextChanged(sigc::bind(sigc::ptr_fun(lpetool_toolbox_watch_ec), holder));
+}
- sigc::connection *c_selection_modified =
- new sigc::connection (sp_desktop_selection (desktop)->connectModified
- (sigc::bind (sigc::ptr_fun (sp_lpetool_toolbox_sel_modified), holder)));
- pool->add_connection ("selection-modified", c_selection_modified);
+static void lpetool_toolbox_watch_ec(SPDesktop* desktop, Inkscape::UI::Tools::ToolBase* ec, GObject* holder)
+{
+ static sigc::connection c_selection_modified;
+ static sigc::connection c_selection_changed;
- sigc::connection *c_selection_changed =
- new sigc::connection (sp_desktop_selection (desktop)->connectChanged
- (sigc::bind (sigc::ptr_fun(sp_lpetool_toolbox_sel_changed), holder)));
- pool->add_connection ("selection-changed", c_selection_changed);
+ if (SP_IS_LPETOOL_CONTEXT(ec)) {
+ // Watch selection
+ c_selection_modified = sp_desktop_selection(desktop)->connectModified(sigc::bind(sigc::ptr_fun(sp_lpetool_toolbox_sel_modified), holder));
+ c_selection_changed = sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(sp_lpetool_toolbox_sel_changed), holder));
+ sp_lpetool_toolbox_sel_changed(sp_desktop_selection(desktop), holder);
+ } else {
+ if (c_selection_modified)
+ c_selection_modified.disconnect();
+ if (c_selection_changed)
+ c_selection_changed.disconnect();
+ }
}
-
/*
Local Variables:
mode:c++
@@ -426,4 +434,4 @@ void sp_lpetool_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GO
fill-column:99
End:
*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 :
diff --git a/src/widgets/mesh-toolbar.cpp b/src/widgets/mesh-toolbar.cpp
index 15dda94f0..73e450926 100644
--- a/src/widgets/mesh-toolbar.cpp
+++ b/src/widgets/mesh-toolbar.cpp
@@ -42,6 +42,7 @@
#include <glibmm/i18n.h>
#include "ui/tools/gradient-tool.h"
+#include "ui/tools/mesh-tool.h"
#include "gradient-drag.h"
#include "sp-mesh-gradient.h"
#include "gradient-chemistry.h"
@@ -49,17 +50,16 @@
#include "selection.h"
#include "ui/icon-names.h"
-#include "../ege-adjustment-action.h"
-#include "../ege-output-action.h"
-#include "../ege-select-one-action.h"
-#include "../ink-action.h"
-#include "../ink-comboboxentry-action.h"
+#include "ege-adjustment-action.h"
+#include "ege-output-action.h"
+#include "ege-select-one-action.h"
+#include "ink-action.h"
+#include "ink-comboboxentry-action.h"
#include "sp-stop.h"
#include "svg/css-ostringstream.h"
#include "svg/svg-color.h"
#include "desktop-style.h"
-#include "ui/tools/gradient-tool.h"
#include "toolbox.h"
@@ -67,7 +67,7 @@ using Inkscape::DocumentUndo;
using Inkscape::UI::ToolboxFactory;
using Inkscape::UI::PrefPusher;
-static gboolean blocked = FALSE;
+static bool blocked = false;
//########################
//## Mesh ##
@@ -116,22 +116,16 @@ static void ms_drag_selection_changed(gpointer /*dragger*/, gpointer data)
}
-static void ms_defs_release(SPObject * /*defs*/, GtkWidget *widget)
+static void ms_defs_release(SPObject * /*defs*/, GObject *widget)
{
ms_tb_selection_changed(NULL, widget);
}
-static void ms_defs_modified(SPObject * /*defs*/, guint /*flags*/, GtkWidget *widget)
+static void ms_defs_modified(SPObject * /*defs*/, guint /*flags*/, GObject *widget)
{
- ms_tb_selection_changed(NULL, (gpointer) widget);
-}
-
-static void ms_disconnect_sigc(GObject * /*obj*/, sigc::connection *connection) {
- connection->disconnect();
- delete connection;
+ ms_tb_selection_changed(NULL, widget);
}
-
/*
* Callback functions for user actions
*/
@@ -184,6 +178,8 @@ static void ms_col_changed(GtkAdjustment *adj, GObject * /*tbl*/ )
blocked = FALSE;
}
+static void mesh_toolbox_watch_ec(SPDesktop* dt, Inkscape::UI::Tools::ToolBase* ec, GObject* holder);
+
/**
* Mesh auxiliary toolbar construction and setup.
*
@@ -323,35 +319,43 @@ void sp_mesh_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions, GObj
g_signal_connect( holder, "destroy", G_CALLBACK(delete_prefspusher), pusher);
}
-
- 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(&ms_tb_selection_changed), (gpointer) holder)));
- sigc::connection *conn2 = new sigc::connection(
- selection->connectModified(sigc::bind(sigc::ptr_fun(&ms_tb_selection_modified), (gpointer) holder)));
- sigc::connection *conn3 = new sigc::connection(
- desktop->connectToolSubselectionChanged( sigc::bind(sigc::ptr_fun(&ms_drag_selection_changed), (gpointer) holder)));
-
- // when holder is destroyed, disconnect
- g_signal_connect(G_OBJECT(holder), "destroy", G_CALLBACK(ms_disconnect_sigc), conn1);
- g_signal_connect(G_OBJECT(holder), "destroy", G_CALLBACK(ms_disconnect_sigc), conn2);
- g_signal_connect(G_OBJECT(holder), "destroy", G_CALLBACK(ms_disconnect_sigc), conn3);
-
- // connect to release and modified signals of the defs (i.e. when someone changes mesh)
- sigc::connection *release_connection = new sigc::connection();
- *release_connection = document->getDefs()->connectRelease(sigc::bind<1>(sigc::ptr_fun(&ms_defs_release), GTK_WIDGET(holder)));
- sigc::connection *modified_connection = new sigc::connection();
- *modified_connection = document->getDefs()->connectModified(sigc::bind<2>(sigc::ptr_fun(&ms_defs_modified), GTK_WIDGET(holder)));
-
- // when holder is destroyed, disconnect
- g_signal_connect(G_OBJECT(holder), "destroy", G_CALLBACK(ms_disconnect_sigc), release_connection);
- g_signal_connect(G_OBJECT(holder), "destroy", G_CALLBACK(ms_disconnect_sigc), modified_connection);
+ desktop->connectEventContextChanged(sigc::bind(sigc::ptr_fun(mesh_toolbox_watch_ec), holder));
+}
+static void mesh_toolbox_watch_ec(SPDesktop* desktop, Inkscape::UI::Tools::ToolBase* ec, GObject* holder)
+{
+ static sigc::connection c_selection_changed;
+ static sigc::connection c_selection_modified;
+ static sigc::connection c_subselection_changed;
+ static sigc::connection c_defs_release;
+ static sigc::connection c_defs_modified;
+
+ if (SP_IS_MESH_CONTEXT(ec)) {
+ // connect to selection modified and changed signals
+ Inkscape::Selection *selection = sp_desktop_selection (desktop);
+ SPDocument *document = sp_desktop_document (desktop);
+
+ c_selection_changed = selection->connectChanged(sigc::bind(sigc::ptr_fun(&ms_tb_selection_changed), holder));
+ c_selection_modified = selection->connectModified(sigc::bind(sigc::ptr_fun(&ms_tb_selection_modified), holder));
+ c_subselection_changed = desktop->connectToolSubselectionChanged(sigc::bind(sigc::ptr_fun(&ms_drag_selection_changed), holder));
+
+ c_defs_release = document->getDefs()->connectRelease(sigc::bind<1>(sigc::ptr_fun(&ms_defs_release), holder));
+ c_defs_modified = document->getDefs()->connectModified(sigc::bind<2>(sigc::ptr_fun(&ms_defs_modified), holder));
+ ms_tb_selection_changed(selection, holder);
+ } else {
+ if (c_selection_changed)
+ c_selection_changed.disconnect();
+ if (c_selection_modified)
+ c_selection_modified.disconnect();
+ if (c_subselection_changed)
+ c_subselection_changed.disconnect();
+ if (c_defs_release)
+ c_defs_release.disconnect();
+ if (c_defs_modified)
+ c_defs_modified.disconnect();
+ }
}
/*
diff --git a/src/widgets/node-toolbar.cpp b/src/widgets/node-toolbar.cpp
index 38e3f4fbd..20bf2f7b9 100644
--- a/src/widgets/node-toolbar.cpp
+++ b/src/widgets/node-toolbar.cpp
@@ -322,7 +322,7 @@ static void sp_node_toolbox_sel_modified(Inkscape::Selection *selection, guint /
sp_node_toolbox_sel_changed (selection, tbl);
}
-
+static void node_toolbox_watch_ec(SPDesktop* dt, Inkscape::UI::Tools::ToolBase* ec, GObject* holder);
//################################
//## Node Editing Toolbox ##
@@ -615,32 +615,33 @@ void sp_node_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje
gtk_action_group_add_action( mainActions, act );
}
-
sp_node_toolbox_sel_changed(sp_desktop_selection(desktop), holder);
+ desktop->connectEventContextChanged(sigc::bind(sigc::ptr_fun(node_toolbox_watch_ec), holder));
- //watch selection
- Inkscape::ConnectionPool* pool = Inkscape::ConnectionPool::new_connection_pool ("ISNodeToolbox");
-
- sigc::connection *c_selection_changed =
- new sigc::connection (sp_desktop_selection (desktop)->connectChanged
- (sigc::bind (sigc::ptr_fun (sp_node_toolbox_sel_changed), holder)));
- pool->add_connection ("selection-changed", c_selection_changed);
-
- sigc::connection *c_selection_modified =
- new sigc::connection (sp_desktop_selection (desktop)->connectModified
- (sigc::bind (sigc::ptr_fun (sp_node_toolbox_sel_modified), holder)));
- pool->add_connection ("selection-modified", c_selection_modified);
-
- sigc::connection *c_subselection_changed =
- new sigc::connection (desktop->connectToolSubselectionChanged
- (sigc::bind (sigc::ptr_fun (sp_node_toolbox_coord_changed), holder)));
- pool->add_connection ("tool-subselection-changed", c_subselection_changed);
+} // end of sp_node_toolbox_prep()
- Inkscape::ConnectionPool::connect_destroy (G_OBJECT (holder), pool);
+static void node_toolbox_watch_ec(SPDesktop* desktop, Inkscape::UI::Tools::ToolBase* ec, GObject* holder)
+{
+ static sigc::connection c_selection_changed;
+ static sigc::connection c_selection_modified;
+ static sigc::connection c_subselection_changed;
- g_signal_connect( holder, "destroy", G_CALLBACK(purge_repr_listener), holder );
-} // end of sp_node_toolbox_prep()
+ if (INK_IS_NODE_TOOL(ec)) {
+ // watch selection
+ c_selection_changed = sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(sp_node_toolbox_sel_changed), holder));
+ c_selection_modified = sp_desktop_selection(desktop)->connectModified(sigc::bind(sigc::ptr_fun(sp_node_toolbox_sel_modified), holder));
+ c_subselection_changed = desktop->connectToolSubselectionChanged(sigc::bind(sigc::ptr_fun(sp_node_toolbox_coord_changed), holder));
+ sp_node_toolbox_sel_changed(sp_desktop_selection(desktop), holder);
+ } else {
+ if (c_selection_changed)
+ c_selection_changed.disconnect();
+ if (c_selection_modified)
+ c_selection_modified.disconnect();
+ if (c_subselection_changed)
+ c_subselection_changed.disconnect();
+ }
+}
/*
diff --git a/src/widgets/rect-toolbar.cpp b/src/widgets/rect-toolbar.cpp
index c9a09e908..48808fe70 100644
--- a/src/widgets/rect-toolbar.cpp
+++ b/src/widgets/rect-toolbar.cpp
@@ -44,6 +44,7 @@
#include "sp-rect.h"
#include "toolbox.h"
#include "ui/icon-names.h"
+#include "ui/tools/rect-tool.h"
#include "ui/uxmanager.h"
#include "ui/widget/unit-tracker.h"
#include "util/units.h"
@@ -288,6 +289,7 @@ static void sp_rect_toolbox_selection_changed(Inkscape::Selection *selection, GO
}
}
+static void rect_toolbox_watch_ec(SPDesktop* dt, Inkscape::UI::Tools::ToolBase* ec, GObject* holder);
void sp_rect_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
{
@@ -394,13 +396,21 @@ void sp_rect_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje
g_object_set_data( holder, "single", GINT_TO_POINTER(TRUE) );
sp_rtb_sensitivize( holder );
- sigc::connection *connection = new sigc::connection(
- sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(sp_rect_toolbox_selection_changed), holder))
- );
- g_signal_connect( holder, "destroy", G_CALLBACK(delete_connection), connection );
+ desktop->connectEventContextChanged(sigc::bind(sigc::ptr_fun(rect_toolbox_watch_ec), holder));
g_signal_connect( holder, "destroy", G_CALLBACK(purge_repr_listener), holder );
}
+static void rect_toolbox_watch_ec(SPDesktop* desktop, Inkscape::UI::Tools::ToolBase* ec, GObject* holder)
+{
+ static sigc::connection changed;
+
+ if (SP_IS_RECT_CONTEXT(ec)) {
+ changed = sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(sp_rect_toolbox_selection_changed), holder));
+ } else {
+ if (changed)
+ changed.disconnect();
+ }
+}
/*
Local Variables:
@@ -411,4 +421,4 @@ void sp_rect_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje
fill-column:99
End:
*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 :
diff --git a/src/widgets/star-toolbar.cpp b/src/widgets/star-toolbar.cpp
index 7a7d0dc71..0f8c31be8 100644
--- a/src/widgets/star-toolbar.cpp
+++ b/src/widgets/star-toolbar.cpp
@@ -42,6 +42,7 @@
#include "sp-star.h"
#include "toolbox.h"
#include "ui/icon-names.h"
+#include "ui/tools/star-tool.h"
#include "ui/uxmanager.h"
#include "verbs.h"
#include "widgets/../preferences.h"
@@ -435,6 +436,7 @@ static void sp_stb_defaults( GtkWidget * /*widget*/, GObject *dataKludge )
gtk_adjustment_value_changed(adj);
}
+static void star_toolbox_watch_ec(SPDesktop* dt, Inkscape::UI::Tools::ToolBase* ec, GObject* holder);
void sp_star_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
{
@@ -571,15 +573,22 @@ void sp_star_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje
}
}
- sigc::connection *connection = new sigc::connection(
- sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(sp_star_toolbox_selection_changed), holder))
- );
- g_signal_connect( holder, "destroy", G_CALLBACK(delete_connection), connection );
- g_signal_connect( holder, "destroy", G_CALLBACK(purge_repr_listener), holder );
+ desktop->connectEventContextChanged(sigc::bind(sigc::ptr_fun(star_toolbox_watch_ec), holder));
+ g_signal_connect(holder, "destroy", G_CALLBACK(purge_repr_listener), holder);
}
+static void star_toolbox_watch_ec(SPDesktop* desktop, Inkscape::UI::Tools::ToolBase* ec, GObject* holder)
+{
+ static sigc::connection changed;
-
+ if (dynamic_cast<Inkscape::UI::Tools::StarTool const*>(ec) != NULL) {
+ changed = sp_desktop_selection(desktop)->connectChanged(sigc::bind(sigc::ptr_fun(sp_star_toolbox_selection_changed), holder));
+ sp_star_toolbox_selection_changed(sp_desktop_selection(desktop), holder);
+ } else {
+ if (changed)
+ changed.disconnect();
+ }
+}
/*
Local Variables:
@@ -590,4 +599,4 @@ void sp_star_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje
fill-column:99
End:
*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 :
diff --git a/src/widgets/text-toolbar.cpp b/src/widgets/text-toolbar.cpp
index 36a151c52..408babf06 100644
--- a/src/widgets/text-toolbar.cpp
+++ b/src/widgets/text-toolbar.cpp
@@ -1661,4 +1661,4 @@ static void text_toolbox_watch_ec(SPDesktop* desktop, Inkscape::UI::Tools::ToolB
fill-column:99
End:
*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8 :