summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2013-10-04 21:18:20 +0000
committerJohan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl>2013-10-04 21:18:20 +0000
commit9a2c4ca30ed332442428594438848b9de2e589a9 (patch)
tree04af472d3c8bb4c4e7f62af4c3f822d832b569a8 /src
parentfix bug (added some comments to jabiertxof's patch) (diff)
downloadinkscape-9a2c4ca30ed332442428594438848b9de2e589a9.tar.gz
inkscape-9a2c4ca30ed332442428594438848b9de2e589a9.zip
C++
(bzr r12659)
Diffstat (limited to 'src')
-rw-r--r--src/box3d-side.cpp2
-rw-r--r--src/sp-ellipse.cpp2
-rw-r--r--src/sp-item-group.cpp2
-rw-r--r--src/sp-item.cpp2
-rw-r--r--src/sp-lpe-item.cpp40
-rw-r--r--src/sp-lpe-item.h12
-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/ui/dialog/livepatheffect-editor.cpp14
-rw-r--r--src/ui/tool/path-manipulator.cpp2
11 files changed, 42 insertions, 40 deletions
diff --git a/src/box3d-side.cpp b/src/box3d-side.cpp
index 4d8b1e2d7..c2b95203a 100644
--- a/src/box3d-side.cpp
+++ b/src/box3d-side.cpp
@@ -207,7 +207,7 @@ void Box3DSide::set_shape() {
* This is very important for LPEs to work properly! (the bbox might be recalculated depending on the curve in shape)*/
this->setCurveInsync( c, TRUE);
- if (hasPathEffect() && sp_lpe_item_path_effects_enabled(this)) {
+ if (hasPathEffect() && pathEffectsEnabled()) {
SPCurve *c_lpe = c->copy();
bool success = sp_lpe_item_perform_path_effect(this, c_lpe);
diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp
index 80e57afc3..8f74b2643 100644
--- a/src/sp-ellipse.cpp
+++ b/src/sp-ellipse.cpp
@@ -205,7 +205,7 @@ void SPGenericEllipse::set_shape()
this->setCurveInsync(curve, TRUE);
this->setCurveBeforeLPE(curve);
- if (hasPathEffect() && sp_lpe_item_path_effects_enabled(this)) {
+ if (hasPathEffect() && pathEffectsEnabled()) {
SPCurve *c_lpe = curve->copy();
bool success = sp_lpe_item_perform_path_effect(this, c_lpe);
diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp
index 41e049b86..941b7a8a6 100644
--- a/src/sp-item-group.cpp
+++ b/src/sp-item-group.cpp
@@ -763,7 +763,7 @@ void SPGroup::update_patheffect(bool write) {
}
}
- if (hasPathEffect() && sp_lpe_item_path_effects_enabled(this)) {
+ if (hasPathEffect() && pathEffectsEnabled()) {
for (PathEffectList::iterator it = this->path_effect_list->begin(); it != this->path_effect_list->end(); it++)
{
LivePathEffectObject *lpeobj = (*it)->lpeobject;
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index 5bf0afdeb..b6b7d90ea 100644
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -1291,7 +1291,7 @@ void SPItem::adjust_livepatheffect (Geom::Affine const &postmul, bool set)
sp_lpe_item_fork_path_effects_if_necessary(lpeitem);
// now that all LPEs are forked_if_necessary, we can apply the transform
- PathEffectList effect_list = sp_lpe_item_get_effect_list(lpeitem);
+ PathEffectList effect_list = lpeitem->getEffectList();
for (PathEffectList::iterator it = effect_list.begin(); it != effect_list.end(); ++it)
{
LivePathEffectObject *lpeobj = (*it)->lpeobject;
diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp
index 0517201f1..89a2658c8 100644
--- a/src/sp-lpe-item.cpp
+++ b/src/sp-lpe-item.cpp
@@ -206,7 +206,7 @@ bool sp_lpe_item_perform_path_effect(SPLPEItem *lpeitem, SPCurve *curve) {
return false;
}
- if (lpeitem->hasPathEffect() && sp_lpe_item_path_effects_enabled(lpeitem)) {
+ if (lpeitem->hasPathEffect() && lpeitem->pathEffectsEnabled()) {
for (PathEffectList::iterator it = lpeitem->path_effect_list->begin(); it != lpeitem->path_effect_list->end(); ++it)
{
LivePathEffectObject *lpeobj = (*it)->lpeobject;
@@ -273,11 +273,11 @@ sp_lpe_item_update_patheffect (SPLPEItem *lpeitem, bool wholetree, bool write)
g_return_if_fail (lpeitem != NULL);
g_return_if_fail (SP_IS_LPE_ITEM (lpeitem));
- if (!sp_lpe_item_path_effects_enabled(lpeitem))
+ if (!lpeitem->pathEffectsEnabled())
return;
// TODO: hack! this will be removed when path length measuring is reimplemented in a better way
- PathEffectList lpelist = sp_lpe_item_get_effect_list(lpeitem);
+ PathEffectList lpelist = lpeitem->getEffectList();
std::list<Inkscape::LivePathEffect::LPEObjectReference *>::iterator i;
for (i = lpelist.begin(); i != lpelist.end(); ++i) {
if ((*i)->lpeobject) {
@@ -452,13 +452,13 @@ void sp_lpe_item_remove_all_path_effects(SPLPEItem *lpeitem, bool keep_paths)
}
}
-void sp_lpe_item_down_current_path_effect(SPLPEItem *lpeitem)
+void SPLPEItem::downCurrentPathEffect()
{
- Inkscape::LivePathEffect::LPEObjectReference* lperef = sp_lpe_item_get_current_lpereference(lpeitem);
+ Inkscape::LivePathEffect::LPEObjectReference* lperef = sp_lpe_item_get_current_lpereference(this);
if (!lperef)
return;
- PathEffectList new_list = *lpeitem->path_effect_list;
+ PathEffectList new_list = *this->path_effect_list;
PathEffectList::iterator cur_it = find( new_list.begin(), new_list.end(), lperef );
if (cur_it != new_list.end()) {
PathEffectList::iterator down_it = cur_it;
@@ -468,18 +468,18 @@ void sp_lpe_item_down_current_path_effect(SPLPEItem *lpeitem)
}
}
std::string r = patheffectlist_write_svg(new_list);
- lpeitem->getRepr()->setAttribute("inkscape:path-effect", r.c_str());
+ this->getRepr()->setAttribute("inkscape:path-effect", r.c_str());
- sp_lpe_item_cleanup_original_path_recursive(lpeitem);
+ sp_lpe_item_cleanup_original_path_recursive(this);
}
-void sp_lpe_item_up_current_path_effect(SPLPEItem *lpeitem)
+void SPLPEItem::upCurrentPathEffect()
{
- Inkscape::LivePathEffect::LPEObjectReference* lperef = sp_lpe_item_get_current_lpereference(lpeitem);
+ Inkscape::LivePathEffect::LPEObjectReference* lperef = sp_lpe_item_get_current_lpereference(this);
if (!lperef)
return;
- PathEffectList new_list = *lpeitem->path_effect_list;
+ PathEffectList new_list = *this->path_effect_list;
PathEffectList::iterator cur_it = find( new_list.begin(), new_list.end(), lperef );
if (cur_it != new_list.end() && cur_it != new_list.begin()) {
PathEffectList::iterator up_it = cur_it;
@@ -488,9 +488,9 @@ void sp_lpe_item_up_current_path_effect(SPLPEItem *lpeitem)
}
std::string r = patheffectlist_write_svg(new_list);
- lpeitem->getRepr()->setAttribute("inkscape:path-effect", r.c_str());
+ this->getRepr()->setAttribute("inkscape:path-effect", r.c_str());
- sp_lpe_item_cleanup_original_path_recursive(lpeitem);
+ sp_lpe_item_cleanup_original_path_recursive(this);
}
/** used for shapes so they can see if they should also disable shape calculation and read from d= */
@@ -647,15 +647,15 @@ static std::string hreflist_write_svg(HRefList const & list)
}
// Return a copy of the effect list
-PathEffectList sp_lpe_item_get_effect_list(SPLPEItem *lpeitem)
+PathEffectList SPLPEItem::getEffectList()
{
- return *(lpeitem->path_effect_list);
+ return *path_effect_list;
}
// Return a copy of the effect list
-PathEffectList const sp_lpe_item_get_effect_list(SPLPEItem const *lpeitem)
+PathEffectList const SPLPEItem::getEffectList() const
{
- return *(lpeitem->path_effect_list);
+ return *path_effect_list;
}
Inkscape::LivePathEffect::LPEObjectReference* sp_lpe_item_get_current_lpereference(SPLPEItem *lpeitem)
@@ -738,7 +738,7 @@ bool sp_lpe_item_fork_path_effects_if_necessary(SPLPEItem *lpeitem, unsigned int
nr_of_allowed_users += lpeitem->hrefcount;
std::vector<LivePathEffectObject const *> old_lpeobjs, new_lpeobjs;
- PathEffectList effect_list = sp_lpe_item_get_effect_list(lpeitem);
+ PathEffectList effect_list = lpeitem->getEffectList();
for (PathEffectList::iterator it = effect_list.begin(); it != effect_list.end(); ++it)
{
LivePathEffectObject *lpeobj = (*it)->lpeobject;
@@ -773,9 +773,9 @@ static void sp_lpe_item_enable_path_effects(SPLPEItem *lpeitem, bool enable)
}
// Are the path effects enabled on this item ?
-bool sp_lpe_item_path_effects_enabled(SPLPEItem *lpeitem)
+bool SPLPEItem::pathEffectsEnabled() const
{
- return lpeitem->path_effects_enabled > 0;
+ return path_effects_enabled > 0;
}
/*
diff --git a/src/sp-lpe-item.h b/src/sp-lpe-item.h
index 00c3e1f3b..3f2947b06 100644
--- a/src/sp-lpe-item.h
+++ b/src/sp-lpe-item.h
@@ -70,11 +70,18 @@ public:
virtual void update_patheffect(bool write);
+ bool pathEffectsEnabled() const;
bool hasPathEffect() const;
bool hasPathEffectOfType(int const type) const;
bool hasPathEffectRecursive() const;
Inkscape::LivePathEffect::Effect* getPathEffectOfType(int type);
bool hasBrokenPathEffect() const;
+
+ PathEffectList getEffectList();
+ PathEffectList const getEffectList() const;
+
+ void downCurrentPathEffect();
+ void upCurrentPathEffect();
};
void sp_lpe_item_update_patheffect (SPLPEItem *lpeitem, bool wholetree, bool write);
@@ -84,15 +91,10 @@ void sp_lpe_item_add_path_effect(SPLPEItem *lpeitem, LivePathEffectObject * new_
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_down_current_path_effect(SPLPEItem *lpeitem);
-void sp_lpe_item_up_current_path_effect(SPLPEItem *lpeitem);
void sp_lpe_item_edit_next_param_oncanvas(SPLPEItem *lpeitem, SPDesktop *dt);
-PathEffectList sp_lpe_item_get_effect_list(SPLPEItem *lpeitem);
-PathEffectList const sp_lpe_item_get_effect_list(SPLPEItem const *lpeitem);
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);
-bool sp_lpe_item_path_effects_enabled(SPLPEItem *lpeitem);
#endif /* !SP_LPE_ITEM_H_SEEN */
diff --git a/src/sp-path.cpp b/src/sp-path.cpp
index 5c347e485..bd923d058 100644
--- a/src/sp-path.cpp
+++ b/src/sp-path.cpp
@@ -76,7 +76,7 @@ gchar* SPPath::description() {
if (hasPathEffect()) {
Glib::ustring s;
- PathEffectList effect_list = sp_lpe_item_get_effect_list(this);
+ PathEffectList effect_list = this->getEffectList();
for (PathEffectList::iterator it = effect_list.begin(); it != effect_list.end(); ++it)
{
diff --git a/src/sp-spiral.cpp b/src/sp-spiral.cpp
index 5d80e43fe..27e45f64b 100644
--- a/src/sp-spiral.cpp
+++ b/src/sp-spiral.cpp
@@ -380,7 +380,7 @@ void SPSpiral::set_shape() {
setCurveInsync( c, TRUE);
setCurveBeforeLPE( c );
- if (hasPathEffect() && sp_lpe_item_path_effects_enabled(this)) {
+ if (hasPathEffect() && pathEffectsEnabled()) {
SPCurve *c_lpe = c->copy();
bool success = sp_lpe_item_perform_path_effect(this, c_lpe);
diff --git a/src/sp-star.cpp b/src/sp-star.cpp
index c2c0883e5..72a27114d 100644
--- a/src/sp-star.cpp
+++ b/src/sp-star.cpp
@@ -460,7 +460,7 @@ void SPStar::set_shape() {
this->setCurveInsync( c, TRUE);
this->setCurveBeforeLPE( c );
- if (hasPathEffect() && sp_lpe_item_path_effects_enabled(this)) {
+ if (hasPathEffect() && pathEffectsEnabled()) {
SPCurve *c_lpe = c->copy();
bool success = sp_lpe_item_perform_path_effect(this, c_lpe);
diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp
index e96b57170..96f8c9446 100644
--- a/src/ui/dialog/livepatheffect-editor.cpp
+++ b/src/ui/dialog/livepatheffect-editor.cpp
@@ -332,7 +332,7 @@ LivePathEffectEditor::effect_list_reload(SPLPEItem *lpeitem)
{
effectlist_store->clear();
- PathEffectList effectlist = sp_lpe_item_get_effect_list(lpeitem);
+ PathEffectList effectlist = lpeitem->getEffectList();
PathEffectList::iterator it;
for( it = effectlist.begin() ; it!=effectlist.end(); ++it)
{
@@ -491,13 +491,13 @@ void LivePathEffectEditor::onUp()
Inkscape::Selection *sel = _getSelection();
if ( sel && !sel->isEmpty() ) {
SPItem *item = sel->singleItem();
- if ( item && SP_IS_LPE_ITEM(item) ) {
- sp_lpe_item_up_current_path_effect(SP_LPE_ITEM(item));
+ if ( SPLPEItem *lpeitem = SP_LPE_ITEM(item) ) {
+ lpeitem->upCurrentPathEffect();
DocumentUndo::done( sp_desktop_document(current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
_("Move path effect up") );
- effect_list_reload(SP_LPE_ITEM(item));
+ effect_list_reload(lpeitem);
}
}
}
@@ -507,13 +507,13 @@ void LivePathEffectEditor::onDown()
Inkscape::Selection *sel = _getSelection();
if ( sel && !sel->isEmpty() ) {
SPItem *item = sel->singleItem();
- if ( item && SP_IS_LPE_ITEM(item) ) {
- sp_lpe_item_down_current_path_effect(SP_LPE_ITEM(item));
+ if ( SPLPEItem *lpeitem = SP_LPE_ITEM(item) ) {
+ lpeitem->downCurrentPathEffect();
DocumentUndo::done( sp_desktop_document(current_desktop), SP_VERB_DIALOG_LIVE_PATH_EFFECT,
_("Move path effect down") );
- effect_list_reload(SP_LPE_ITEM(item));
+ effect_list_reload(lpeitem);
}
}
}
diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp
index 36f78af9d..d12e2958b 100644
--- a/src/ui/tool/path-manipulator.cpp
+++ b/src/ui/tool/path-manipulator.cpp
@@ -1208,7 +1208,7 @@ void PathManipulator::_createGeometryFromControlPoints(bool alert_LPE)
if (alert_LPE) {
/// \todo note that _path can be an Inkscape::LivePathEffect::Effect* too, kind of confusing, rework member naming?
if (SP_IS_LPE_ITEM(_path) && _path->hasPathEffect()) {
- PathEffectList effect_list = sp_lpe_item_get_effect_list(_path);
+ PathEffectList effect_list = _path->getEffectList();
LivePathEffect::LPEPowerStroke *lpe_pwr = dynamic_cast<LivePathEffect::LPEPowerStroke*>( effect_list.front()->lpeobject->get_lpe() );
if (lpe_pwr) {
lpe_pwr->adjustForNewPath(pathv);