diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2013-09-25 00:39:56 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2013-09-25 00:39:56 +0000 |
| commit | 4e687553f3955ef0988184c421a36ca19912c257 (patch) | |
| tree | 928ff1777d85b025757929db2ea2326b179da49e /src/draw-context.cpp | |
| parent | First attemp for (diff) | |
| download | inkscape-4e687553f3955ef0988184c421a36ca19912c257.tar.gz inkscape-4e687553f3955ef0988184c421a36ca19912c257.zip | |
Fix error in apply
(bzr r12588.1.2)
Diffstat (limited to 'src/draw-context.cpp')
| -rw-r--r-- | src/draw-context.cpp | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/draw-context.cpp b/src/draw-context.cpp index 8b0237c0f..ceb72cc71 100644 --- a/src/draw-context.cpp +++ b/src/draw-context.cpp @@ -235,6 +235,20 @@ static void spdc_apply_powerstroke_shape(const std::vector<Geom::Point> & points lpe->getRepr()->setAttribute("interpolator_beta", "0.2"); } +static void spdc_apply_bend_shape(gchar const *svgd, SPDrawContext *dc, SPItem *item) +{ + using namespace Inkscape::LivePathEffect; + + Effect::createAndApply(BEND_PATH, dc->desktop->doc(), item); + Effect* lpe = sp_lpe_item_get_current_lpe(SP_LPE_ITEM(item)); + + // write bend parameters: + lpe->getRepr()->setAttribute("bend_path", svgd); + lpe->getRepr()->setAttribute("prop_scale", "1"); + lpe->getRepr()->setAttribute("scale_y_rel", "false"); + lpe->getRepr()->setAttribute("vertical_pattern", "false"); +} + static void spdc_check_for_and_apply_waiting_LPE(SPDrawContext *dc, SPItem *item, SPCurve *curve) { using namespace Inkscape::LivePathEffect; @@ -319,13 +333,9 @@ static void spdc_check_for_and_apply_waiting_LPE(SPDrawContext *dc, SPItem *item GSList *items = const_cast<GSList *>(selection->itemList()); SPObject *obj = reinterpret_cast<SPObject *>(g_slist_nth_data(items,0)); itemEnd = SP_ITEM(obj); - Effect::createAndApply(BEND_PATH, dc->desktop->doc(), itemEnd); - Effect* lpe = sp_lpe_item_get_current_lpe(SP_LPE_ITEM(itemEnd)); gchar const *svgd = item->getRepr()->attribute("d"); - static_cast<LPEBendPath*>(lpe)->bend_path.paste_param_path(svgd); - static_cast<LPEBendPath*>(lpe)->bend_path.param_editOncanvas(itemEnd, SP_ACTIVE_DESKTOP); - item->deleteObject(false,false); - //SPItem* item = itemEnd; + spdc_apply_bend_shape(svgd, dc, itemEnd); + item->deleteObject(); } break; } @@ -388,13 +398,9 @@ static void spdc_check_for_and_apply_waiting_LPE(SPDrawContext *dc, SPItem *item { // take shape from clipboard; TODO: catch the case where clipboard is empty if(itemEnd != NULL){ - Effect::createAndApply(BEND_PATH, dc->desktop->doc(), itemEnd); - Effect* lpe = sp_lpe_item_get_current_lpe(SP_LPE_ITEM(itemEnd)); gchar const *svgd = item->getRepr()->attribute("d"); - static_cast<LPEBendPath*>(lpe)->bend_path.paste_param_path(svgd); - static_cast<LPEBendPath*>(lpe)->bend_path.param_editOncanvas(itemEnd, SP_ACTIVE_DESKTOP); - item->deleteObject(false,false); - //SPItem* item = itemEnd; + spdc_apply_bend_shape(svgd, dc, itemEnd); + item->deleteObject(); } break; } @@ -421,7 +427,7 @@ static void spdc_check_for_and_apply_waiting_LPE(SPDrawContext *dc, SPItem *item } if (dc->waiting_LPE_type != INVALID_LPE) { - if(shape != 5) Effect::createAndApply(dc->waiting_LPE_type, dc->desktop->doc(), item); + Effect::createAndApply(dc->waiting_LPE_type, dc->desktop->doc(), item); dc->waiting_LPE_type = INVALID_LPE; if (SP_IS_LPETOOL_CONTEXT(dc)) { |
