void SPLPEItem::addPathEffect(gchar *value, bool reset) { if (value) { // Apply the path effects here because in the casse of a group, lpe->resetDefaults // needs that all the subitems have their effects applied sp_lpe_item_update_patheffect(this, false, true); // Disable the path effects while preparing the new lpe sp_lpe_item_enable_path_effects(this, false); // Add the new reference to the list of LPE references HRefList hreflist; for (PathEffectList::const_iterator it = this->path_effect_list->begin(); it != this->path_effect_list->end(); ++it) { hreflist.push_back( std::string((*it)->lpeobject_href) ); } hreflist.push_back( std::string(value) ); std::string hrefs = hreflist_write_svg(hreflist); this->getRepr()->setAttribute("inkscape:path-effect", hrefs.c_str()); // Make sure that ellipse is stored as <svg:path> if( SP_IS_GENERICELLIPSE(this)) { SP_GENERICELLIPSE(this)->write( this->getRepr()->document(), this->getRepr(), SP_OBJECT_WRITE_EXT ); } // make sure there is an original-d for paths!!! sp_lpe_item_create_original_path_recursive(this); LivePathEffectObject *lpeobj = this->path_effect_list->back()->lpeobject; if (lpeobj && lpeobj->get_lpe()) { Inkscape::LivePathEffect::Effect *lpe = lpeobj->get_lpe(); // Ask the path effect to reset itself if it doesn't have parameters yet if (reset) { // has to be called when all the subitems have their lpes applied lpe->resetDefaults(this); } // perform this once when the effect is applied lpe->doOnApply(this); // indicate that all necessary preparations are done and the effect can be performed lpe->setReady(); } //Enable the path effects now that everything is ready to apply the new path effect sp_lpe_item_enable_path_effects(this, true); // Apply the path effect sp_lpe_item_update_patheffect(this, true, true); //fix bug 1219324 if (SP_ACTIVE_DESKTOP ) { Inkscape::UI::Tools::ToolBase *ec = SP_ACTIVE_DESKTOP->event_context; if (INK_IS_NODE_TOOL(ec)) { tools_switch(SP_ACTIVE_DESKTOP, TOOLS_LPETOOL); //mhh tools_switch(SP_ACTIVE_DESKTOP, TOOLS_NODES); } } } }
void tools_switch_current (int num) { SPDesktop *dt; dt = SP_ACTIVE_DESKTOP; if (dt) tools_switch (dt, num); }