summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2013-10-04 21:57:28 +0000
committerJohan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl>2013-10-04 21:57:28 +0000
commit4f857ae84089672e9c7378d327e54889f64c62fb (patch)
treeb899e1d4f41027674eeb35fc70e0fed4484e34b6 /src
parentC++ (diff)
downloadinkscape-4f857ae84089672e9c7378d327e54889f64c62fb.tar.gz
inkscape-4f857ae84089672e9c7378d327e54889f64c62fb.zip
C++
(bzr r12660)
Diffstat (limited to 'src')
-rw-r--r--src/box3d-side.cpp2
-rw-r--r--src/draw-context.cpp6
-rw-r--r--src/knotholder.cpp2
-rw-r--r--src/live_effects/effect.cpp2
-rw-r--r--src/live_effects/effect.h2
-rw-r--r--src/live_effects/lpeobject.cpp2
-rw-r--r--src/lpe-tool-context.cpp2
-rw-r--r--src/object-edit.cpp8
-rw-r--r--src/path-chemistry.cpp2
-rw-r--r--src/pen-context.cpp2
-rw-r--r--src/selection-chemistry.cpp8
-rw-r--r--src/sp-ellipse.cpp2
-rw-r--r--src/sp-item-group.cpp4
-rw-r--r--src/sp-item.cpp2
-rw-r--r--src/sp-lpe-item.cpp98
-rw-r--r--src/sp-lpe-item.h25
-rw-r--r--src/sp-path.cpp2
-rw-r--r--src/sp-spiral.cpp2
-rw-r--r--src/sp-star.cpp2
-rw-r--r--src/splivarot.cpp2
-rw-r--r--src/ui/clipboard.cpp4
-rw-r--r--src/ui/dialog/livepatheffect-editor.cpp6
-rw-r--r--src/widgets/lpe-toolbar.cpp2
23 files changed, 96 insertions, 93 deletions
diff --git a/src/box3d-side.cpp b/src/box3d-side.cpp
index c2b95203a..040b031c6 100644
--- a/src/box3d-side.cpp
+++ b/src/box3d-side.cpp
@@ -209,7 +209,7 @@ void Box3DSide::set_shape() {
if (hasPathEffect() && pathEffectsEnabled()) {
SPCurve *c_lpe = c->copy();
- bool success = sp_lpe_item_perform_path_effect(this, c_lpe);
+ bool success = this->performPathEffect(c_lpe);
if (success) {
this->setCurveInsync(c_lpe, TRUE);
diff --git a/src/draw-context.cpp b/src/draw-context.cpp
index a0241852c..498ff5bfb 100644
--- a/src/draw-context.cpp
+++ b/src/draw-context.cpp
@@ -212,7 +212,7 @@ static void spdc_paste_curve_as_freehand_shape(const SPCurve *c, SPDrawContext *
// TODO: Don't paste path if nothing is on the clipboard
Effect::createAndApply(PATTERN_ALONG_PATH, dc->desktop->doc(), item);
- Effect* lpe = sp_lpe_item_get_current_lpe(SP_LPE_ITEM(item));
+ Effect* lpe = SP_LPE_ITEM(item)->getCurrentLPE();
gchar *svgd = sp_svg_write_path(c->get_pathvector());
static_cast<LPEPatternAlongPath*>(lpe)->pattern.paste_param_path(svgd);
}
@@ -222,7 +222,7 @@ static void spdc_apply_powerstroke_shape(const std::vector<Geom::Point> & points
using namespace Inkscape::LivePathEffect;
Effect::createAndApply(POWERSTROKE, dc->desktop->doc(), item);
- Effect* lpe = sp_lpe_item_get_current_lpe(SP_LPE_ITEM(item));
+ Effect* lpe = SP_LPE_ITEM(item)->getCurrentLPE();
static_cast<LPEPowerStroke*>(lpe)->offset_points.param_set_and_write_new_value(points);
// write powerstroke parameters:
@@ -297,7 +297,7 @@ 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
Effect::createAndApply(PATTERN_ALONG_PATH, dc->desktop->doc(), item);
- Effect* lpe = sp_lpe_item_get_current_lpe(SP_LPE_ITEM(item));
+ Effect* lpe = SP_LPE_ITEM(item)->getCurrentLPE();
static_cast<LPEPatternAlongPath*>(lpe)->pattern.on_paste_button_click();
shape_applied = true;
diff --git a/src/knotholder.cpp b/src/knotholder.cpp
index 32ba9075b..9abba83d7 100644
--- a/src/knotholder.cpp
+++ b/src/knotholder.cpp
@@ -209,7 +209,7 @@ KnotHolder::knot_ungrabbed_handler(SPKnot */*knot*/)
// This writes all parameters to SVG. Is this sufficiently efficient or should we only
// write the ones that were changed?
- Inkscape::LivePathEffect::Effect *lpe = sp_lpe_item_get_current_lpe(SP_LPE_ITEM(object));
+ Inkscape::LivePathEffect::Effect *lpe = SP_LPE_ITEM(object)->getCurrentLPE();
if (lpe) {
LivePathEffectObject *lpeobj = lpe->getLPEObj();
lpeobj->updateRepr();
diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp
index 105fdea32..623879ac5 100644
--- a/src/live_effects/effect.cpp
+++ b/src/live_effects/effect.cpp
@@ -270,7 +270,7 @@ void Effect::createAndApply(const char* name, SPDocument *doc, SPItem *item)
Inkscape::GC::release(repr);
gchar *href = g_strdup_printf("#%s", repr_id);
- sp_lpe_item_add_path_effect(SP_LPE_ITEM(item), href, true);
+ SP_LPE_ITEM(item)->addPathEffect(href, true);
g_free(href);
}
diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h
index f7a7155b0..b9d86628f 100644
--- a/src/live_effects/effect.h
+++ b/src/live_effects/effect.h
@@ -66,7 +66,7 @@ public:
/*
* isReady() indicates whether all preparations which are necessary to apply the LPE are done,
* e.g., waiting for a parameter path either before the effect is created or when it needs a
- * path as argument. This is set in sp_lpe_item_add_path_effect().
+ * path as argument. This is set in SPLPEItem::addPathEffect().
*/
inline bool isReady() const { return is_ready; }
inline void setReady(bool ready = true) { is_ready = ready; }
diff --git a/src/live_effects/lpeobject.cpp b/src/live_effects/lpeobject.cpp
index d61f2b2fa..d92c94d01 100644
--- a/src/live_effects/lpeobject.cpp
+++ b/src/live_effects/lpeobject.cpp
@@ -181,7 +181,7 @@ livepatheffect_on_repr_attr_changed ( Inkscape::XML::Node * /*repr*/,
/**
* If this has other users, create a new private duplicate and return it
* returns 'this' when no forking was necessary (and therefore no duplicate was made)
- * Check out sp_lpe_item_fork_path_effects_if_necessary !
+ * Check out SPLPEItem::forkPathEffectsIfNecessary !
*/
LivePathEffectObject *LivePathEffectObject::fork_private_if_necessary(unsigned int nr_of_allowed_users)
{
diff --git a/src/lpe-tool-context.cpp b/src/lpe-tool-context.cpp
index bcf58aaf3..edc9a6930 100644
--- a/src/lpe-tool-context.cpp
+++ b/src/lpe-tool-context.cpp
@@ -290,7 +290,7 @@ int lpetool_item_has_construction(SPLPEToolContext */*lc*/, SPItem *item)
return -1;
}
- Inkscape::LivePathEffect::Effect* lpe = sp_lpe_item_get_current_lpe(SP_LPE_ITEM(item));
+ Inkscape::LivePathEffect::Effect* lpe = SP_LPE_ITEM(item)->getCurrentLPE();
if (!lpe) {
return -1;
}
diff --git a/src/object-edit.cpp b/src/object-edit.cpp
index 28786bf66..2021b91f5 100644
--- a/src/object-edit.cpp
+++ b/src/object-edit.cpp
@@ -46,7 +46,7 @@ static KnotHolder *sp_lpe_knot_holder(SPItem *item, SPDesktop *desktop)
{
KnotHolder *knot_holder = new KnotHolder(desktop, item, NULL);
- Inkscape::LivePathEffect::Effect *effect = sp_lpe_item_get_current_lpe(SP_LPE_ITEM(item));
+ Inkscape::LivePathEffect::Effect *effect = SP_LPE_ITEM(item)->getCurrentLPE();
effect->addHandles(knot_holder, desktop, item);
return knot_holder;
@@ -61,9 +61,9 @@ KnotHolder *createKnotHolder(SPItem *item, SPDesktop *desktop)
KnotHolder *knotholder = NULL;
if (SP_IS_LPE_ITEM(item) &&
- sp_lpe_item_get_current_lpe(SP_LPE_ITEM(item)) &&
- sp_lpe_item_get_current_lpe(SP_LPE_ITEM(item))->isVisible() &&
- sp_lpe_item_get_current_lpe(SP_LPE_ITEM(item))->providesKnotholder()) {
+ SP_LPE_ITEM(item)->getCurrentLPE() &&
+ SP_LPE_ITEM(item)->getCurrentLPE()->isVisible() &&
+ SP_LPE_ITEM(item)->getCurrentLPE()->providesKnotholder()) {
knotholder = sp_lpe_knot_holder(item, desktop);
} else if (SP_IS_RECT(item)) {
knotholder = new RectKnotHolder(desktop, item, NULL);
diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp
index 52569dd21..5f478435d 100644
--- a/src/path-chemistry.cpp
+++ b/src/path-chemistry.cpp
@@ -405,7 +405,7 @@ sp_item_list_to_curves(const GSList *items, GSList **selected, GSList **to_selec
}
if (SP_IS_GROUP(item)) {
- sp_lpe_item_remove_all_path_effects(SP_LPE_ITEM(item), true);
+ SP_LPE_ITEM(item)->removeAllPathEffects(true);
GSList *item_list = sp_item_group_item_list(SP_GROUP(item));
GSList *item_to_select = NULL;
diff --git a/src/pen-context.cpp b/src/pen-context.cpp
index 916fb7cdb..d67bc5e57 100644
--- a/src/pen-context.cpp
+++ b/src/pen-context.cpp
@@ -132,7 +132,7 @@ SPPenContext::~SPPenContext() {
if (this->expecting_clicks_for_LPE > 0) {
// we received too few clicks to sanely set the parameter path so we remove the LPE from the item
- sp_lpe_item_remove_current_path_effect(this->waiting_item, false);
+ this->waiting_item->removeCurrentPathEffect(false);
}
}
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index 2105ca99a..49a731b15 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -482,7 +482,7 @@ void sp_selection_duplicate(SPDesktop *desktop, bool suppressDone)
if (fork_livepatheffects) {
SPObject *new_obj = doc->getObjectByRepr(copy);
if (new_obj && SP_IS_LPE_ITEM(new_obj)) {
- sp_lpe_item_fork_path_effects_if_necessary(SP_LPE_ITEM(new_obj), 1);
+ SP_LPE_ITEM(new_obj)->forkPathEffectsIfNecessary(1);
}
}
@@ -1184,7 +1184,7 @@ static void sp_selection_remove_livepatheffect_impl(SPItem *item)
{
if ( SPLPEItem *lpeitem = dynamic_cast<SPLPEItem*>(item) ) {
if ( lpeitem->hasPathEffect() ) {
- sp_lpe_item_remove_all_path_effects(SP_LPE_ITEM(item), false);
+ lpeitem->removeAllPathEffects(false);
}
}
}
@@ -2321,7 +2321,7 @@ void sp_selection_next_patheffect_param(SPDesktop * dt)
SPItem *item = selection->singleItem();
if ( SPLPEItem *lpeitem = dynamic_cast<SPLPEItem*>(item) ) {
if (lpeitem->hasPathEffect()) {
- sp_lpe_item_edit_next_param_oncanvas(lpeitem, dt);
+ lpeitem->editNextParamOncanvas(dt);
} else {
dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("The selection has no applied path effect."));
}
@@ -2779,7 +2779,7 @@ void sp_selection_clone_original_path_lpe(SPDesktop *desktop)
SPObject *clone_obj = desktop->doc()->getObjectById(clone->attribute("id"));
if (SP_IS_LPE_ITEM(clone_obj)) {
gchar *href = g_strdup_printf("#%s", lpe_id);
- sp_lpe_item_add_path_effect( SP_LPE_ITEM(clone_obj), href, false );
+ SP_LPE_ITEM(clone_obj)->addPathEffect( href, false );
g_free(href);
}
}
diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp
index 8f74b2643..06201859f 100644
--- a/src/sp-ellipse.cpp
+++ b/src/sp-ellipse.cpp
@@ -207,7 +207,7 @@ void SPGenericEllipse::set_shape()
if (hasPathEffect() && pathEffectsEnabled()) {
SPCurve *c_lpe = curve->copy();
- bool success = sp_lpe_item_perform_path_effect(this, c_lpe);
+ bool success = this->performPathEffect(c_lpe);
if (success) {
this->setCurveInsync(c_lpe, TRUE);
diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp
index 941b7a8a6..ae974200f 100644
--- a/src/sp-item-group.cpp
+++ b/src/sp-item-group.cpp
@@ -424,7 +424,7 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done)
gitem = group;
}
- sp_lpe_item_remove_all_path_effects(SP_LPE_ITEM(group), false);
+ SP_LPE_ITEM(group)->removeAllPathEffects(false);
/* Step 1 - generate lists of children objects */
GSList *items = NULL;
@@ -799,7 +799,7 @@ sp_group_perform_patheffect(SPGroup *group, SPGroup *topgroup, bool write)
// only run LPEs when the shape has a curve defined
if (c) {
c->transform(i2anc_affine(subitem, topgroup));
- sp_lpe_item_perform_path_effect(SP_LPE_ITEM(topgroup), c);
+ SP_LPE_ITEM(topgroup)->performPathEffect(c);
c->transform(i2anc_affine(subitem, topgroup).inverse());
SP_SHAPE(subitem)->setCurve(c, TRUE);
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index b6b7d90ea..e8338046b 100644
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -1288,7 +1288,7 @@ void SPItem::adjust_livepatheffect (Geom::Affine const &postmul, bool set)
if ( SP_IS_LPE_ITEM(this) ) {
SPLPEItem *lpeitem = SP_LPE_ITEM (this);
if ( lpeitem->hasPathEffect() ) {
- sp_lpe_item_fork_path_effects_if_necessary(lpeitem);
+ lpeitem->forkPathEffectsIfNecessary();
// now that all LPEs are forked_if_necessary, we can apply the transform
PathEffectList effect_list = lpeitem->getEffectList();
diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp
index 89a2658c8..b7e4ee4a9 100644
--- a/src/sp-lpe-item.cpp
+++ b/src/sp-lpe-item.cpp
@@ -197,8 +197,8 @@ Inkscape::XML::Node* SPLPEItem::write(Inkscape::XML::Document *xml_doc, Inkscape
/**
* returns true when LPE was successful.
*/
-bool sp_lpe_item_perform_path_effect(SPLPEItem *lpeitem, SPCurve *curve) {
- if (!lpeitem) {
+bool SPLPEItem::performPathEffect(SPCurve *curve) {
+ if (!this) {
return false;
}
@@ -206,15 +206,15 @@ bool sp_lpe_item_perform_path_effect(SPLPEItem *lpeitem, SPCurve *curve) {
return false;
}
- if (lpeitem->hasPathEffect() && lpeitem->pathEffectsEnabled()) {
- for (PathEffectList::iterator it = lpeitem->path_effect_list->begin(); it != lpeitem->path_effect_list->end(); ++it)
+ if (this->hasPathEffect() && this->pathEffectsEnabled()) {
+ for (PathEffectList::iterator it = this->path_effect_list->begin(); it != this->path_effect_list->end(); ++it)
{
LivePathEffectObject *lpeobj = (*it)->lpeobject;
if (!lpeobj) {
/** \todo Investigate the cause of this.
* For example, this happens when copy pasting an object with LPE applied. Probably because the object is pasted while the effect is not yet pasted to defs, and cannot be found.
*/
- g_warning("sp_lpe_item_perform_path_effect - NULL lpeobj in list!");
+ g_warning("SPLPEItem::performPathEffect - NULL lpeobj in list!");
return false;
}
Inkscape::LivePathEffect::Effect *lpe = lpeobj->get_lpe();
@@ -222,7 +222,7 @@ bool sp_lpe_item_perform_path_effect(SPLPEItem *lpeitem, SPCurve *curve) {
/** \todo Investigate the cause of this.
* Not sure, but I think this can happen when an unknown effect type is specified...
*/
- g_warning("sp_lpe_item_perform_path_effect - lpeobj with invalid lpe in the stack!");
+ g_warning("SPLPEItem::performPathEffect - lpeobj with invalid lpe in the stack!");
return false;
}
@@ -234,8 +234,8 @@ bool sp_lpe_item_perform_path_effect(SPLPEItem *lpeitem, SPCurve *curve) {
}
// Groups have their doBeforeEffect called elsewhere
- if (!SP_IS_GROUP(lpeitem)) {
- lpe->doBeforeEffect(lpeitem);
+ if (!SP_IS_GROUP(this)) {
+ lpe->doBeforeEffect(this);
}
try {
@@ -366,95 +366,95 @@ sp_lpe_item_cleanup_original_path_recursive(SPLPEItem *lpeitem)
}
}
-void sp_lpe_item_add_path_effect(SPLPEItem *lpeitem, gchar *value, bool reset)
+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(lpeitem, false, true);
+ sp_lpe_item_update_patheffect(this, false, true);
// Disable the path effects while preparing the new lpe
- sp_lpe_item_enable_path_effects(lpeitem, false);
+ 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 = lpeitem->path_effect_list->begin(); it != lpeitem->path_effect_list->end(); ++it)
+ 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);
- lpeitem->getRepr()->setAttribute("inkscape:path-effect", hrefs.c_str());
+ this->getRepr()->setAttribute("inkscape:path-effect", hrefs.c_str());
// make sure there is an original-d for paths!!!
- sp_lpe_item_create_original_path_recursive(lpeitem);
+ sp_lpe_item_create_original_path_recursive(this);
- LivePathEffectObject *lpeobj = lpeitem->path_effect_list->back()->lpeobject;
+ 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(lpeitem);
+ lpe->resetDefaults(this);
}
// perform this once when the effect is applied
- lpe->doOnApply(SP_LPE_ITEM(lpeitem));
+ 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(lpeitem, true);
+ sp_lpe_item_enable_path_effects(this, true);
// Apply the path effect
- sp_lpe_item_update_patheffect(lpeitem, true, true);
+ sp_lpe_item_update_patheffect(this, true, true);
}
}
-void sp_lpe_item_add_path_effect(SPLPEItem *lpeitem, LivePathEffectObject * new_lpeobj)
+void SPLPEItem::addPathEffect(LivePathEffectObject * new_lpeobj)
{
const gchar * repr_id = new_lpeobj->getRepr()->attribute("id");
gchar *hrefstr = g_strdup_printf("#%s", repr_id);
- sp_lpe_item_add_path_effect(lpeitem, hrefstr, false);
+ this->addPathEffect(hrefstr, false);
g_free(hrefstr);
}
-void sp_lpe_item_remove_current_path_effect(SPLPEItem *lpeitem, bool keep_paths)
+void SPLPEItem::removeCurrentPathEffect(bool keep_paths)
{
- Inkscape::LivePathEffect::LPEObjectReference* lperef = sp_lpe_item_get_current_lpereference(lpeitem);
+ Inkscape::LivePathEffect::LPEObjectReference* lperef = this->getCurrentLPEReference();
if (!lperef)
return;
- PathEffectList new_list = *lpeitem->path_effect_list;
+ PathEffectList new_list = *this->path_effect_list;
new_list.remove(lperef); //current lpe ref is always our 'own' pointer from the path_effect_list
std::string r = patheffectlist_write_svg(new_list);
if (!r.empty()) {
- lpeitem->getRepr()->setAttribute("inkscape:path-effect", r.c_str());
+ this->getRepr()->setAttribute("inkscape:path-effect", r.c_str());
} else {
- lpeitem->getRepr()->setAttribute("inkscape:path-effect", NULL);
+ this->getRepr()->setAttribute("inkscape:path-effect", NULL);
}
if (!keep_paths) {
- sp_lpe_item_cleanup_original_path_recursive(lpeitem);
+ sp_lpe_item_cleanup_original_path_recursive(this);
}
}
-void sp_lpe_item_remove_all_path_effects(SPLPEItem *lpeitem, bool keep_paths)
+void SPLPEItem::removeAllPathEffects(bool keep_paths)
{
- lpeitem->getRepr()->setAttribute("inkscape:path-effect", NULL);
+ this->getRepr()->setAttribute("inkscape:path-effect", NULL);
if (!keep_paths) {
- sp_lpe_item_cleanup_original_path_recursive(lpeitem);
+ sp_lpe_item_cleanup_original_path_recursive(this);
}
}
void SPLPEItem::downCurrentPathEffect()
{
- Inkscape::LivePathEffect::LPEObjectReference* lperef = sp_lpe_item_get_current_lpereference(this);
+ Inkscape::LivePathEffect::LPEObjectReference* lperef = getCurrentLPEReference();
if (!lperef)
return;
@@ -475,7 +475,7 @@ void SPLPEItem::downCurrentPathEffect()
void SPLPEItem::upCurrentPathEffect()
{
- Inkscape::LivePathEffect::LPEObjectReference* lperef = sp_lpe_item_get_current_lpereference(this);
+ Inkscape::LivePathEffect::LPEObjectReference* lperef = getCurrentLPEReference();
if (!lperef)
return;
@@ -577,11 +577,11 @@ SPLPEItem::getPathEffectOfType(int type)
return NULL;
}
-void sp_lpe_item_edit_next_param_oncanvas(SPLPEItem *lpeitem, SPDesktop *dt)
+void SPLPEItem::editNextParamOncanvas(SPDesktop *dt)
{
- Inkscape::LivePathEffect::LPEObjectReference *lperef = sp_lpe_item_get_current_lpereference(lpeitem);
+ Inkscape::LivePathEffect::LPEObjectReference *lperef = this->getCurrentLPEReference();
if (lperef && lperef->lpeobject && lperef->lpeobject->get_lpe()) {
- lperef->lpeobject->get_lpe()->editNextParamOncanvas(lpeitem, dt);
+ lperef->lpeobject->get_lpe()->editNextParamOncanvas(this, dt);
}
}
@@ -658,18 +658,18 @@ PathEffectList const SPLPEItem::getEffectList() const
return *path_effect_list;
}
-Inkscape::LivePathEffect::LPEObjectReference* sp_lpe_item_get_current_lpereference(SPLPEItem *lpeitem)
+Inkscape::LivePathEffect::LPEObjectReference* SPLPEItem::getCurrentLPEReference()
{
- if (!lpeitem->current_path_effect && !lpeitem->path_effect_list->empty()) {
- sp_lpe_item_set_current_path_effect(lpeitem, lpeitem->path_effect_list->back());
+ if (!this->current_path_effect && !this->path_effect_list->empty()) {
+ setCurrentPathEffect(this->path_effect_list->back());
}
- return lpeitem->current_path_effect;
+ return this->current_path_effect;
}
-Inkscape::LivePathEffect::Effect* sp_lpe_item_get_current_lpe(SPLPEItem *lpeitem)
+Inkscape::LivePathEffect::Effect* SPLPEItem::getCurrentLPE()
{
- Inkscape::LivePathEffect::LPEObjectReference* lperef = sp_lpe_item_get_current_lpereference(lpeitem);
+ Inkscape::LivePathEffect::LPEObjectReference* lperef = getCurrentLPEReference();
if (lperef && lperef->lpeobject)
return lperef->lpeobject->get_lpe();
@@ -677,11 +677,11 @@ Inkscape::LivePathEffect::Effect* sp_lpe_item_get_current_lpe(SPLPEItem *lpeitem
return NULL;
}
-bool sp_lpe_item_set_current_path_effect(SPLPEItem *lpeitem, Inkscape::LivePathEffect::LPEObjectReference* lperef)
+bool SPLPEItem::setCurrentPathEffect(Inkscape::LivePathEffect::LPEObjectReference* lperef)
{
- for (PathEffectList::iterator it = lpeitem->path_effect_list->begin(); it != lpeitem->path_effect_list->end(); ++it) {
+ for (PathEffectList::iterator it = path_effect_list->begin(); it != path_effect_list->end(); ++it) {
if ((*it)->lpeobject_repr == lperef->lpeobject_repr) {
- lpeitem->current_path_effect = (*it); // current_path_effect should always be a pointer from the path_effect_list !
+ this->current_path_effect = (*it); // current_path_effect should always be a pointer from the path_effect_list !
return true;
}
}
@@ -724,21 +724,21 @@ void SPLPEItem::replacePathEffects( std::vector<LivePathEffectObject const *> co
* use this method instead.
* Returns true if one or more effects were forked; returns false if nothing was done.
*/
-bool sp_lpe_item_fork_path_effects_if_necessary(SPLPEItem *lpeitem, unsigned int nr_of_allowed_users)
+bool SPLPEItem::forkPathEffectsIfNecessary(unsigned int nr_of_allowed_users)
{
bool forked = false;
- if ( lpeitem->hasPathEffect() ) {
+ if ( this->hasPathEffect() ) {
// If one of the path effects is used by 2 or more items, fork it
// so that each object has its own independent copy of the effect.
// Note: replacing path effects messes up the path effect list
// Clones of the LPEItem will increase the refcount of the lpeobjects.
// Therefore, nr_of_allowed_users should be increased with the number of clones (i.e. refs to the lpeitem)
- nr_of_allowed_users += lpeitem->hrefcount;
+ nr_of_allowed_users += this->hrefcount;
std::vector<LivePathEffectObject const *> old_lpeobjs, new_lpeobjs;
- PathEffectList effect_list = lpeitem->getEffectList();
+ PathEffectList effect_list = this->getEffectList();
for (PathEffectList::iterator it = effect_list.begin(); it != effect_list.end(); ++it)
{
LivePathEffectObject *lpeobj = (*it)->lpeobject;
@@ -753,7 +753,7 @@ bool sp_lpe_item_fork_path_effects_if_necessary(SPLPEItem *lpeitem, unsigned int
}
if (forked) {
- lpeitem->replacePathEffects(old_lpeobjs, new_lpeobjs);
+ this->replacePathEffects(old_lpeobjs, new_lpeobjs);
}
}
diff --git a/src/sp-lpe-item.h b/src/sp-lpe-item.h
index 3f2947b06..cd72ac55b 100644
--- a/src/sp-lpe-item.h
+++ b/src/sp-lpe-item.h
@@ -70,6 +70,8 @@ public:
virtual void update_patheffect(bool write);
+ bool performPathEffect(SPCurve *curve);
+
bool pathEffectsEnabled() const;
bool hasPathEffect() const;
bool hasPathEffectOfType(int const type) const;
@@ -82,19 +84,20 @@ public:
void downCurrentPathEffect();
void upCurrentPathEffect();
+ Inkscape::LivePathEffect::LPEObjectReference* getCurrentLPEReference();
+ Inkscape::LivePathEffect::Effect* getCurrentLPE();
+ bool setCurrentPathEffect(Inkscape::LivePathEffect::LPEObjectReference* lperef);
+ void removeCurrentPathEffect(bool keep_paths);
+ void removeAllPathEffects(bool keep_paths);
+ void addPathEffect(gchar *value, bool reset);
+ void addPathEffect(LivePathEffectObject * new_lpeobj);
+
+ bool forkPathEffectsIfNecessary(unsigned int nr_of_allowed_users = 1);
+
+ void editNextParamOncanvas(SPDesktop *dt);
};
-void sp_lpe_item_update_patheffect (SPLPEItem *lpeitem, bool wholetree, bool write);
-bool sp_lpe_item_perform_path_effect(SPLPEItem *lpeitem, SPCurve *curve);
-void sp_lpe_item_add_path_effect(SPLPEItem *lpeitem, gchar *value, bool reset);
-void sp_lpe_item_add_path_effect(SPLPEItem *lpeitem, LivePathEffectObject * new_lpeobj);
-bool sp_lpe_item_fork_path_effects_if_necessary(SPLPEItem *lpeitem, unsigned int nr_of_allowed_users = 1);
-void sp_lpe_item_remove_all_path_effects(SPLPEItem *lpeitem, bool keep_paths);
-void sp_lpe_item_remove_current_path_effect(SPLPEItem *lpeitem, bool keep_paths);
-void sp_lpe_item_edit_next_param_oncanvas(SPLPEItem *lpeitem, SPDesktop *dt);
-Inkscape::LivePathEffect::LPEObjectReference* sp_lpe_item_get_current_lpereference(SPLPEItem *lpeitem);
-Inkscape::LivePathEffect::Effect* sp_lpe_item_get_current_lpe(SPLPEItem *lpeitem);
-bool sp_lpe_item_set_current_path_effect(SPLPEItem *lpeitem, Inkscape::LivePathEffect::LPEObjectReference* lperef);
+void sp_lpe_item_update_patheffect (SPLPEItem *lpeitem, bool wholetree, bool write); // careful, class already has method with *very* similar name!
#endif /* !SP_LPE_ITEM_H_SEEN */
diff --git a/src/sp-path.cpp b/src/sp-path.cpp
index bd923d058..b225f0735 100644
--- a/src/sp-path.cpp
+++ b/src/sp-path.cpp
@@ -307,7 +307,7 @@ g_message("sp_path_update_patheffect");
* This is very important for LPEs to work properly! (the bbox might be recalculated depending on the curve in shape)*/
this->setCurveInsync(curve, TRUE);
- bool success = sp_lpe_item_perform_path_effect(this, curve);
+ bool success = this->performPathEffect(curve);
if (success && write) {
// could also do this->getRepr()->updateRepr(); but only the d attribute needs updating.
diff --git a/src/sp-spiral.cpp b/src/sp-spiral.cpp
index 27e45f64b..56aca507f 100644
--- a/src/sp-spiral.cpp
+++ b/src/sp-spiral.cpp
@@ -382,7 +382,7 @@ void SPSpiral::set_shape() {
if (hasPathEffect() && pathEffectsEnabled()) {
SPCurve *c_lpe = c->copy();
- bool success = sp_lpe_item_perform_path_effect(this, c_lpe);
+ bool success = this->performPathEffect(c_lpe);
if (success) {
this->setCurveInsync( c_lpe, TRUE);
diff --git a/src/sp-star.cpp b/src/sp-star.cpp
index 72a27114d..e634eccac 100644
--- a/src/sp-star.cpp
+++ b/src/sp-star.cpp
@@ -462,7 +462,7 @@ void SPStar::set_shape() {
if (hasPathEffect() && pathEffectsEnabled()) {
SPCurve *c_lpe = c->copy();
- bool success = sp_lpe_item_perform_path_effect(this, c_lpe);
+ bool success = this->performPathEffect(c_lpe);
if (success) {
this->setCurveInsync( c_lpe, TRUE);
diff --git a/src/splivarot.cpp b/src/splivarot.cpp
index 319928d99..ad40178fb 100644
--- a/src/splivarot.cpp
+++ b/src/splivarot.cpp
@@ -419,7 +419,7 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool
{
// apply live path effects prior to performing boolean operation
if (SP_IS_LPE_ITEM(l->data)) {
- sp_lpe_item_remove_all_path_effects(SP_LPE_ITEM(l->data), true);
+ SP_LPE_ITEM(l->data)->removeAllPathEffects(true);
}
SPCSSAttr *css = sp_repr_css_attr(reinterpret_cast<SPObject *>(il->data)->getRepr(), "style");
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index ed28cabbd..da6fed86b 100644
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
@@ -938,7 +938,7 @@ void ClipboardManagerImpl::_applyPathEffect(SPItem *item, gchar const *effectsta
{
SPLPEItem *lpeitem = SP_LPE_ITEM(item);
// for each effect in the stack, check if we need to fork it before adding it to the item
- sp_lpe_item_fork_path_effects_if_necessary(lpeitem, 1);
+ lpeitem->forkPathEffectsIfNecessary(1);
std::istringstream iss(effectstack);
std::string href;
@@ -949,7 +949,7 @@ void ClipboardManagerImpl::_applyPathEffect(SPItem *item, gchar const *effectsta
return;
}
LivePathEffectObject *lpeobj = LIVEPATHEFFECT(obj);
- sp_lpe_item_add_path_effect(lpeitem, lpeobj);
+ lpeitem->addPathEffect(lpeobj);
}
}
}
diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp
index 96f8c9446..30b16cee0 100644
--- a/src/ui/dialog/livepatheffect-editor.cpp
+++ b/src/ui/dialog/livepatheffect-editor.cpp
@@ -280,7 +280,7 @@ LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel)
set_sensitize_all(true);
if ( lpeitem->hasPathEffect() ) {
- Inkscape::LivePathEffect::Effect *lpe = sp_lpe_item_get_current_lpe(lpeitem);
+ Inkscape::LivePathEffect::Effect *lpe = lpeitem->getCurrentLPE();
if (lpe) {
showParams(*lpe);
lpe_list_locked = true;
@@ -475,7 +475,7 @@ LivePathEffectEditor::onRemove()
if ( sel && !sel->isEmpty() ) {
SPItem *item = sel->singleItem();
if ( item && SP_IS_LPE_ITEM(item) ) {
- sp_lpe_item_remove_current_path_effect(SP_LPE_ITEM(item), false);
+ SP_LPE_ITEM(item)->removeCurrentPathEffect(false);
DocumentUndo::done( sp_desktop_document(current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
_("Remove path effect") );
@@ -530,7 +530,7 @@ void LivePathEffectEditor::on_effect_selection_changed()
if (lperef && current_lpeitem) {
if (lperef->lpeobject->get_lpe()) {
lpe_list_locked = true; // prevent reload of the list which would lose selection
- sp_lpe_item_set_current_path_effect(current_lpeitem, lperef);
+ current_lpeitem->setCurrentPathEffect(lperef);
showParams(*lperef->lpeobject->get_lpe());
}
}
diff --git a/src/widgets/lpe-toolbar.cpp b/src/widgets/lpe-toolbar.cpp
index 55cce90cd..922526a9f 100644
--- a/src/widgets/lpe-toolbar.cpp
+++ b/src/widgets/lpe-toolbar.cpp
@@ -145,7 +145,7 @@ static void sp_lpetool_toolbox_sel_changed(Inkscape::Selection *selection, GObje
SPItem *item = selection->singleItem();
if (item && SP_IS_LPE_ITEM(item) && lpetool_item_has_construction(lc, item)) {
SPLPEItem *lpeitem = SP_LPE_ITEM(item);
- Effect* lpe = sp_lpe_item_get_current_lpe(lpeitem);
+ Effect* lpe = lpeitem->getCurrentLPE();
if (lpe && lpe->effectType() == LINE_SEGMENT) {
LPELineSegment *lpels = static_cast<LPELineSegment*>(lpe);
g_object_set_data(tbl, "currentlpe", lpe);