summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0453060)
raw | patch | inline | side by side (parent: 0453060)
author | cilix42 <cilix42@users.sourceforge.net> | |
Mon, 18 Aug 2008 00:36:15 +0000 (00:36 +0000) | ||
committer | cilix42 <cilix42@users.sourceforge.net> | |
Mon, 18 Aug 2008 00:36:15 +0000 (00:36 +0000) |
src/widgets/toolbox.cpp | patch | blob | history |
index 63561f746f2663ef08d89ae4587b0fdada7f7baa..84a4f68e6213830b7a507344c9c851371079ad76 100644 (file)
--- 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
// 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) );
}
}
}
-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 **/