diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2013-03-18 01:53:59 +0000 |
|---|---|---|
| committer | Jabiertxo Arraiza Zenotz <jtx@jtx.marker.es> | 2013-03-18 01:53:59 +0000 |
| commit | a5fc5840c370d58f395b7b256a11fd11ef3a9a54 (patch) | |
| tree | 0136821ae5b542e224d85a124f597002d45470b4 /src/ui | |
| parent | Working with widjets (diff) | |
| download | inkscape-a5fc5840c370d58f395b7b256a11fd11ef3a9a54.tar.gz inkscape-a5fc5840c370d58f395b7b256a11fd11ef3a9a54.zip | |
working whith widgets
(bzr r11950.1.57)
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/tool/node.cpp | 5 | ||||
| -rw-r--r-- | src/ui/tool/node.h | 3 | ||||
| -rw-r--r-- | src/ui/tool/path-manipulator.cpp | 16 | ||||
| -rw-r--r-- | src/ui/tool/path-manipulator.h | 3 |
4 files changed, 23 insertions, 4 deletions
diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index bee2cc477..b628d3500 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -113,6 +113,9 @@ Handle::Handle(NodeSharedData const &data, Geom::Point const &initial_pos, Node _degenerate(true) { setVisible(false); + //BSpline + setControlBsplineSteps( _pm().getControlBsplineSteps()); + //BSpline End; } Handle::~Handle() @@ -391,7 +394,7 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) double pos = 0; h = this; setPosition(new_pos); - pos = ceilf(_pm().BSplineHandlePosition(h)*10)/10; + pos = ceilf(_pm().BSplineHandlePosition(h)*controlBsplineSteps)/controlBsplineSteps; new_pos=_pm().BSplineHandleReposition(h,pos); } //BSpline End diff --git a/src/ui/tool/node.h b/src/ui/tool/node.h index e74698b1a..953ac0061 100644 --- a/src/ui/tool/node.h +++ b/src/ui/tool/node.h @@ -109,12 +109,15 @@ protected: virtual bool _eventHandler(SPEventContext *event_context, GdkEvent *event); //Bspline virtual void handle_2button_press(); + virtual void setControlBsplineSteps(int controlBsplineStepsValue){controlBsplineSteps = controlBsplineStepsValue;}; + int controlBsplineSteps; //BSpline End virtual void dragged(Geom::Point &new_pos, GdkEventMotion *event); virtual bool grabbed(GdkEventMotion *event); virtual void ungrabbed(GdkEventButton *event); virtual bool clicked(GdkEventButton *event); + virtual Glib::ustring _getTip(unsigned state) const; virtual Glib::ustring _getDragTip(GdkEventMotion *event) const; virtual bool _hasDragTips() const { return true; } diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 0a100ecfb..b46e85622 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -36,6 +36,7 @@ #include "live_effects/lpeobject-reference.h" #include "live_effects/parameter/path.h" #include "sp-path.h" +#include "sp-lpe-item.h" #include "helper/geom.h" #include "preferences.h" #include "style.h" @@ -1174,9 +1175,8 @@ void PathManipulator::_createControlPointsFromGeometry() bool PathManipulator::isBSpline(){ LivePathEffect::LPEBSpline *lpe_bsp = NULL; - if (SP_IS_LPE_ITEM(_path) && sp_lpe_item_has_path_effect(SP_LPE_ITEM(_path))) { - PathEffectList effect_list = sp_lpe_item_get_effect_list(SP_LPE_ITEM(_path)); - lpe_bsp = dynamic_cast<LivePathEffect::LPEBSpline*>( effect_list.front()->lpeobject->get_lpe()); + if (SP_LPE_ITEM(_path) && sp_lpe_item_has_path_effect(SP_LPE_ITEM(_path))){ + lpe_bsp = dynamic_cast<LivePathEffect::LPEBSpline*>(sp_lpe_item_has_path_effect_of_type(SP_LPE_ITEM(_path),Inkscape::LivePathEffect::BSPLINE)->getLPEObj()->get_lpe()); }else{ lpe_bsp = NULL; } @@ -1186,6 +1186,16 @@ bool PathManipulator::isBSpline(){ return false; } +int PathManipulator::getControlBsplineSteps(){ + LivePathEffect::LPEBSpline *lpe_bsp = NULL; + if (SP_LPE_ITEM(_path) && sp_lpe_item_has_path_effect(SP_LPE_ITEM(_path))){ + lpe_bsp = dynamic_cast<LivePathEffect::LPEBSpline*>(sp_lpe_item_has_path_effect_of_type(SP_LPE_ITEM(_path),Inkscape::LivePathEffect::BSPLINE)->getLPEObj()->get_lpe()); + if(lpe_bsp){ + return lpe_bsp->steps; + } + } + return 2; +} double PathManipulator::BSplineHandlePosition(Handle *h){ using Geom::X; using Geom::Y; diff --git a/src/ui/tool/path-manipulator.h b/src/ui/tool/path-manipulator.h index a235a3b05..04148592b 100644 --- a/src/ui/tool/path-manipulator.h +++ b/src/ui/tool/path-manipulator.h @@ -89,6 +89,9 @@ public: void updateHandles(); void setControlsTransform(Geom::Affine const &); void hideDragPoint(); + //BSpline + int getControlBsplineSteps(); + //BSpline End MultiPathManipulator &mpm() { return _multi_path_manipulator; } NodeList::iterator subdivideSegment(NodeList::iterator after, double t); |
