X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Flpe-tool-context.cpp;h=be465e32469b1eaf08d7b63163844306dfe1848e;hb=ae70a7da8de014672f4c9efc8561b08eeb7bd12a;hp=8439f7086871b9f2945d180c9c18f6bc81998f6f;hpb=e9b6af083e34e2397a8ddbe9781920733d09d151;p=inkscape.git diff --git a/src/lpe-tool-context.cpp b/src/lpe-tool-context.cpp index 8439f7086..be465e324 100644 --- a/src/lpe-tool-context.cpp +++ b/src/lpe-tool-context.cpp @@ -34,6 +34,7 @@ #include "document.h" #include "display/curve.h" #include "display/canvas-bpath.h" +#include "display/canvas-text.h" #include "message-stack.h" #include "sp-path.h" #include "helper/units.h" @@ -53,15 +54,16 @@ void sp_lpetool_context_selection_changed(Inkscape::Selection *selection, gpoint const int num_subtools = 8; -Inkscape::LivePathEffect::EffectType lpesubtools[] = { - Inkscape::LivePathEffect::INVALID_LPE, // this must be here to account for the "all inactive" action - Inkscape::LivePathEffect::LINE_SEGMENT, - Inkscape::LivePathEffect::CIRCLE_3PTS, - Inkscape::LivePathEffect::CIRCLE_WITH_RADIUS, - Inkscape::LivePathEffect::PARALLEL, - Inkscape::LivePathEffect::PERP_BISECTOR, - Inkscape::LivePathEffect::ANGLE_BISECTOR, - Inkscape::LivePathEffect::MIRROR_SYMMETRY, +SubtoolEntry lpesubtools[] = { + // this must be here to account for the "all inactive" action + {Inkscape::LivePathEffect::INVALID_LPE, "draw-geometry-inactive"}, + {Inkscape::LivePathEffect::LINE_SEGMENT, "draw-geometry-line-segment"}, + {Inkscape::LivePathEffect::CIRCLE_3PTS, "draw-geometry-circle-from-three-points"}, + {Inkscape::LivePathEffect::CIRCLE_WITH_RADIUS, "draw-geometry-circle-from-radius"}, + {Inkscape::LivePathEffect::PARALLEL, "draw-geometry-line-parallel"}, + {Inkscape::LivePathEffect::PERP_BISECTOR, "draw-geometry-line-perpendicular"}, + {Inkscape::LivePathEffect::ANGLE_BISECTOR, "draw-geometry-angle-bisector"}, + {Inkscape::LivePathEffect::MIRROR_SYMMETRY, "draw-geometry-mirror"} }; static SPPenContextClass *lpetool_parent_class = 0; @@ -203,9 +205,10 @@ sp_lpetool_context_selection_changed(Inkscape::Selection *selection, gpointer da static void sp_lpetool_context_set(SPEventContext *ec, Inkscape::Preferences::Entry *val) { - // FIXME: how to set this correcly? the value from preferences-skeleton.h doesn't seem to get - // read (it wants to set drag = 1) - // lpetool_parent_class->set(ec, key, "drag"); + if (val->getEntryName() == "mode") { + Inkscape::Preferences::get()->setString("/tools/geometric/mode", "drag"); + SP_PEN_CONTEXT(ec)->mode = SP_PEN_CONTEXT_MODE_DRAG; + } /* //pass on up to parent class to handle common attributes. @@ -283,9 +286,9 @@ sp_lpetool_context_root_handler(SPEventContext *event_context, GdkEvent *event) Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int mode = prefs->getInt("/tools/lpetool/mode"); - EffectType type = lpesubtools[mode]; + EffectType type = lpesubtools[mode].type; - //bool over_stroke = lc->shape_editor->is_over_stroke(NR::Point(event->button.x, event->button.y), true); + //bool over_stroke = lc->shape_editor->is_over_stroke(Geom::Point(event->button.x, event->button.y), true); sp_pen_context_wait_for_LPE_mouse_clicks(lc, type, Inkscape::LivePathEffect::Effect::acceptsNumClicks(type)); @@ -300,7 +303,7 @@ sp_lpetool_context_root_handler(SPEventContext *event_context, GdkEvent *event) } bool over_stroke = false; - over_stroke = lc->shape_editor->is_over_stroke(NR::Point(event->motion.x, event->motion.y), false); + over_stroke = lc->shape_editor->is_over_stroke(Geom::Point(event->motion.x, event->motion.y), false); if (over_stroke) { event_context->cursor_shape = cursor_node_xpm; @@ -363,7 +366,7 @@ sp_lpetool_context_root_handler(SPEventContext *event_context, GdkEvent *event) int lpetool_mode_to_index(Inkscape::LivePathEffect::EffectType const type) { for (int i = 0; i < num_subtools; ++i) { - if (lpesubtools[i] == type) { + if (lpesubtools[i].type == type) { return i; } } @@ -374,7 +377,7 @@ lpetool_mode_to_index(Inkscape::LivePathEffect::EffectType const type) { * Checks whether an item has a construction applied as LPE and if so returns the index in * lpesubtools of this construction */ -int lpetool_item_has_construction(SPLPEToolContext *lc, SPItem *item) +int lpetool_item_has_construction(SPLPEToolContext */*lc*/, SPItem *item) { if (!SP_IS_LPE_ITEM(item)) { return -1; @@ -453,7 +456,7 @@ lpetool_context_reset_limiting_bbox(SPLPEToolContext *lc) Geom::Point A, B; lpetool_get_limiting_bbox_corners(document, A, B); - NR::Matrix doc2dt(lc->desktop->doc2dt()); + Geom::Matrix doc2dt(lc->desktop->doc2dt()); A *= doc2dt; B *= doc2dt; @@ -466,7 +469,7 @@ lpetool_context_reset_limiting_bbox(SPLPEToolContext *lc) static void set_pos_and_anchor(SPCanvasText *canvas_text, const Geom::Piecewise > &pwd2, - const double t, const double length, bool use_curvature = false) + const double t, const double length, bool /*use_curvature*/ = false) { using namespace Geom;