diff options
| author | bulia byak <buliabyak@gmail.com> | 2007-04-14 18:51:46 +0000 |
|---|---|---|
| committer | buliabyak <buliabyak@users.sourceforge.net> | 2007-04-14 18:51:46 +0000 |
| commit | 4ce3b2432a4babc496de2038b3e6ef8fadc82e0b (patch) | |
| tree | d956f671169a01b451576cb00bfafe4fee51a0f8 /src/dyna-draw-context.cpp | |
| parent | Don't snap nodes to their parent path (diff) | |
| download | inkscape-4ce3b2432a4babc496de2038b3e6ef8fadc82e0b.tar.gz inkscape-4ce3b2432a4babc496de2038b3e6ef8fadc82e0b.zip | |
recurse into groups for thinning/thickening
(bzr r2889)
Diffstat (limited to 'src/dyna-draw-context.cpp')
| -rw-r--r-- | src/dyna-draw-context.cpp | 69 |
1 files changed, 44 insertions, 25 deletions
diff --git a/src/dyna-draw-context.cpp b/src/dyna-draw-context.cpp index 3084e2cf0..1ee339465 100644 --- a/src/dyna-draw-context.cpp +++ b/src/dyna-draw-context.cpp @@ -58,6 +58,7 @@ #include "inkscape.h" #include "color.h" #include "splivarot.h" +#include "sp-item-group.h" #include "sp-shape.h" #include "sp-path.h" #include "sp-text.h" @@ -607,49 +608,37 @@ get_dilate_force (SPDynaDrawContext *dc) } bool -sp_ddc_dilate (SPDynaDrawContext *dc, NR::Point p, bool expand) +sp_ddc_dilate_recursive (SPItem *item, NR::Point p, bool expand, double radius, double offset) { - Inkscape::Selection *selection = sp_desktop_selection(SP_EVENT_CONTEXT(dc)->desktop); - - if (selection->isEmpty()) { - return false; - } - bool did = false; - double radius = get_dilate_radius(dc); - double offset = get_dilate_force(dc); - if (radius == 0 || offset == 0) { - return false; - } - for (GSList *items = g_slist_copy((GSList *) selection->itemList()); - items != NULL; - items = items->next) { - - SPItem *item = (SPItem *) items->data; + if (SP_IS_GROUP(item)) { + for (SPObject *child = sp_object_first_child(SP_OBJECT(item)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + if (SP_IS_ITEM(child)) { + did = did || sp_ddc_dilate_recursive (SP_ITEM(child), p, expand, radius, offset); + } + } - // only paths - if (!SP_IS_PATH(item)) - continue; + } else if (SP_IS_PATH(item)) { SPCurve *curve = NULL; curve = sp_shape_get_curve(SP_SHAPE(item)); if (curve == NULL) - continue; + return false; // skip those paths whose bboxes are entirely out of reach with our radius NR::Maybe<NR::Rect> bbox = item->getBounds(sp_item_i2doc_affine(item)); if (bbox) { bbox->growBy(radius); if (!bbox->contains(p)) { - continue; + return false; } } Path *orig = Path_for_item(item, false); if (orig == NULL) { sp_curve_unref(curve); - continue; + return false; } Path *res = new Path; res->SetBackData(false); @@ -723,6 +712,36 @@ sp_ddc_dilate (SPDynaDrawContext *dc, NR::Point p, bool expand) return did; } + +bool +sp_ddc_dilate (SPDynaDrawContext *dc, NR::Point p, bool expand) +{ + Inkscape::Selection *selection = sp_desktop_selection(SP_EVENT_CONTEXT(dc)->desktop); + + if (selection->isEmpty()) { + return false; + } + + bool did = false; + double radius = get_dilate_radius(dc); + double offset = get_dilate_force(dc); + if (radius == 0 || offset == 0) { + return false; + } + + for (GSList *items = g_slist_copy((GSList *) selection->itemList()); + items != NULL; + items = items->next) { + + SPItem *item = (SPItem *) items->data; + + did = did || sp_ddc_dilate_recursive (item, p, expand, radius, offset); + + } + + return did; +} + void sp_ddc_update_cursors (SPDynaDrawContext *dc) { @@ -836,8 +855,8 @@ sp_dyna_draw_context_root_handler(SPEventContext *event_context, } else { dc->_message_context->setF(Inkscape::NORMAL_MESSAGE, event->motion.state & GDK_SHIFT_MASK? - _("<b>Thickening %d</b> selected paths; without <b>Shift</b> to thin") : - _("<b>Thinning %d</b> selected paths; with <b>Shift</b> to thicken"), num); + _("<b>Thickening %d</b> selected objects; without <b>Shift</b> to thin") : + _("<b>Thinning %d</b> selected objects; with <b>Shift</b> to thicken"), num); } } else { |
