summaryrefslogtreecommitdiffstats
path: root/src/widgets/toolbox.cpp
diff options
context:
space:
mode:
authorMaximilian Albert <maximilian.albert@gmail.com>2008-08-18 00:36:15 +0000
committercilix42 <cilix42@users.sourceforge.net>2008-08-18 00:36:15 +0000
commitd9e4ab95f2622e895b7670365bb8c53e9567a8d8 (patch)
tree1cc840b70041e28e461e99184f4089438aed7620 /src/widgets/toolbox.cpp
parentRemove commented code (diff)
downloadinkscape-d9e4ab95f2622e895b7670365bb8c53e9567a8d8.tar.gz
inkscape-d9e4ab95f2622e895b7670365bb8c53e9567a8d8.zip
Make sp_lpetool_mode_changed() generic, i.e., read the activated subtool from the given list
(bzr r6651)
Diffstat (limited to 'src/widgets/toolbox.cpp')
-rw-r--r--src/widgets/toolbox.cpp36
1 files changed, 15 insertions, 21 deletions
diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp
index 63561f746..84a4f68e6 100644
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
@@ -4783,14 +4783,25 @@ static void sp_dropper_toolbox_prep(SPDesktop */*desktop*/, GtkActionGroup* main
//## LPETool ##
//########################
+/* This is the list of subtools from which the toolbar of the LPETool is built automatically */
+static Inkscape::LivePathEffect::EffectType lpesubtools[] = {
+ Inkscape::LivePathEffect::ANGLE_BISECTOR,
+ Inkscape::LivePathEffect::CIRCLE_3PTS,
+ Inkscape::LivePathEffect::PERP_BISECTOR
+};
+
static void sp_lpetool_mode_changed(EgeSelectOneAction *act, GObject *tbl)
{
+ using namespace Inkscape::LivePathEffect;
+
SPDesktop *desktop = (SPDesktop *) g_object_get_data(tbl, "desktop");
+ // TODO: how can we set *all* actions inactive (such that no sutool is activated?)
gint lpeToolMode = ege_select_one_action_get_active(act);
if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) {
prefs_set_int_attribute( "tools.lpetool", "mode", lpeToolMode );
}
+ EffectType type = lpesubtools[lpeToolMode];
SPPenContext *pc = SP_PEN_CONTEXT(desktop->event_context);
// only take action if run by the attr_changed listener
@@ -4798,22 +4809,11 @@ static void sp_lpetool_mode_changed(EgeSelectOneAction *act, GObject *tbl)
// in turn, prevent listener from responding
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(TRUE) );
- switch (lpeToolMode) {
- case 0:
- // angle bisector
- sp_pen_context_wait_for_LPE_mouse_clicks(pc, Inkscape::LivePathEffect::ANGLE_BISECTOR, 3);
- break;
- case 1:
- // circle through 3 points
- //sp_pen_context_put_into_waiting_mode(desktop, Inkscape::LivePathEffect::CIRCLE_3PTS, 3);
- sp_pen_context_wait_for_LPE_mouse_clicks(pc, Inkscape::LivePathEffect::CIRCLE_3PTS, 3);
- //sp_pen_context_put_into_waiting_mode(desktop, Inkscape::LivePathEffect::CIRCLE_3PTS, 3);
- break;
- default:
- // don't do anything
- break;
+ // activate the LPE corresponding to the chosen subtool
+ if (type != INVALID_LPE) {
+ sp_pen_context_wait_for_LPE_mouse_clicks(pc, type, Effect::acceptsNumClicks(type));
}
- // TODO finish implementation
+ // TODO: how can we take LPEs into account that don't expect any 'pre-clicks'?
g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
}
@@ -4875,12 +4875,6 @@ sp_lpetool_toolbox_sel_changed(Inkscape::Selection *selection, GObject *tbl)
}
}
-static Inkscape::LivePathEffect::EffectType lpesubtools[] = {
- Inkscape::LivePathEffect::ANGLE_BISECTOR,
- Inkscape::LivePathEffect::CIRCLE_3PTS,
- Inkscape::LivePathEffect::PERP_BISECTOR
-};
-
static void sp_lpetool_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
{
/** Automatically create a list of LPEs that get added to the toolbar **/