diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2013-03-23 14:55:27 +0000 |
|---|---|---|
| committer | Jabiertxo Arraiza Zenotz <jtx@jtx.marker.es> | 2013-03-23 14:55:27 +0000 |
| commit | ece108cd1302b59ac5f41a38b6bb377093348147 (patch) | |
| tree | 7e0288ea4271b638c22c94c0eefe1b833504b0f5 /src | |
| parent | Enabling Mesh (diff) | |
| parent | Adding mesh (diff) | |
| download | inkscape-ece108cd1302b59ac5f41a38b6bb377093348147.tar.gz inkscape-ece108cd1302b59ac5f41a38b6bb377093348147.zip | |
Mauro based feedbak added some fixes
(bzr r11950.1.68)
Diffstat (limited to 'src')
| -rw-r--r-- | src/live_effects/lpe-bspline.cpp | 45 | ||||
| -rw-r--r-- | src/pen-context.cpp | 2 | ||||
| -rw-r--r-- | src/ui/tool/node.cpp | 4 | ||||
| -rw-r--r-- | src/ui/tool/node.h | 1 | ||||
| -rw-r--r-- | src/ui/tool/path-manipulator.cpp | 23 | ||||
| -rw-r--r-- | src/ui/tool/path-manipulator.h | 2 | ||||
| -rw-r--r-- | src/widgets/toolbox.cpp | 10 |
7 files changed, 52 insertions, 35 deletions
diff --git a/src/live_effects/lpe-bspline.cpp b/src/live_effects/lpe-bspline.cpp index d3c64bb67..0a13c17b2 100644 --- a/src/live_effects/lpe-bspline.cpp +++ b/src/live_effects/lpe-bspline.cpp @@ -28,7 +28,7 @@ #include "helper/geom-curves.h" #include "ui/widget/scalar.h" #include "selection.h" - +#include "gtkmm/checkbutton.h" // For handling un-continuous paths: #include "message-stack.h" #include "inkscape.h" @@ -48,14 +48,14 @@ LPEBSpline::LPEBSpline(LivePathEffectObject *lpeobject) : //testpointA(_("Test Point A"), _("Test A"), "ptA", &wr, this, Geom::Point(100,100)), steps(_("Steps whith CTRL:"), _("Change number of steps whith CTRL pressed"), "steps", &wr, this, 2), ignoreCusp(_("Ignore cusp nodes:"), _("Change ignoring cusp nodes"), "ignoreCusp", &wr, this, true), - weight(_("Change weight:"), _("Change weight of the effect"), "weight", &wr, this, 33.33) + weight(_("Change weight:"), _("Change weight of the effect"), "weight", &wr, this, 0.3334) { registerParameter( dynamic_cast<Parameter *>(&ignoreCusp) ); registerParameter( dynamic_cast<Parameter *>(&weight) ); registerParameter( dynamic_cast<Parameter *>(&steps) ); - weight.param_set_range(0.00, 100); - weight.param_set_increments(1., 1.); - weight.param_set_digits(2); + weight.param_set_range(0.0000, 1); + weight.param_set_increments(0.1, 0.1); + weight.param_set_digits(4); steps.param_set_range(1, 10); steps.param_set_increments(1, 1); steps.param_set_digits(0); @@ -268,21 +268,19 @@ LPEBSpline::newWidget() Gtk::VBox * vbox = Gtk::manage( new Gtk::VBox(Effect::newWidget()) ); vbox->set_border_width(5); - - Gtk::Button* defaultWeight = Gtk::manage(new Gtk::Button(Glib::ustring(_("Default weight")))); - defaultWeight->set_alignment(0.0, 0.5); - Gtk::Widget* defaultWeightWidget = dynamic_cast<Gtk::Widget *>(defaultWeight); - defaultWeight->signal_clicked().connect(sigc::mem_fun (*this,&LPEBSpline::toDefaultWeight)); - vbox->pack_start(*defaultWeightWidget, true, true,2); - std::vector<Parameter *>::iterator it = param_vector.begin(); while (it != param_vector.end()) { if ((*it)->widget_is_visible) { Parameter * param = *it; - Gtk::Widget * widg = param->param_newWidget(); - if(param->param_key == "weight"){ - Inkscape::UI::Widget::Scalar * widgRegistered = dynamic_cast<Inkscape::UI::Widget::Scalar *>(widg); + Gtk::Widget * widg = dynamic_cast<Gtk::Widget *>(param->param_newWidget()); + if(param->param_key == "weight"||param->param_key == "steps"){ + Inkscape::UI::Widget::Scalar * widgRegistered = Gtk::manage(dynamic_cast<Inkscape::UI::Widget::Scalar *>(widg)); widgRegistered->signal_value_changed().connect(sigc::mem_fun (*this,&LPEBSpline::toWeight)); + widg = dynamic_cast<Gtk::Widget *>(widgRegistered); + } + if(param->param_key == "ignoreCusp"){ + Gtk::CheckButton * widgRegistered = Gtk::manage(dynamic_cast<Gtk::CheckButton *>(widg)); + widg = dynamic_cast<Gtk::Widget *>(widgRegistered); } Glib::ustring * tip = param->param_getTooltip(); if (widg) { @@ -298,20 +296,27 @@ LPEBSpline::newWidget() ++it; } + Gtk::Button* defaultWeight = Gtk::manage(new Gtk::Button(Glib::ustring(_("Default weight 0.3334")))); + defaultWeight->set_alignment(0.0, 0.5); + defaultWeight->signal_clicked().connect(sigc::mem_fun (*this,&LPEBSpline::toDefaultWeight)); + Gtk::Widget* defaultWeightWidget = dynamic_cast<Gtk::Widget *>(defaultWeight); + vbox->pack_start(*defaultWeightWidget, true, true,2); return dynamic_cast<Gtk::Widget *>(vbox); } void LPEBSpline::toDefaultWeight(){ - double weightValue = 0.3334; - weight.param_set_value(33.33); - changeWeight(weightValue); + Gtk::Widget * widg = dynamic_cast<Gtk::Widget *>(param_vector[2]->param_newWidget()); + Inkscape::UI::Widget::Scalar * widgRegistered = Gtk::manage(dynamic_cast<Inkscape::UI::Widget::Scalar *>(widg)); + widgRegistered->setValue(0.3334); + widgRegistered->update(); + weight.param_set_value(0.3334); + changeWeight(0.3334); } void LPEBSpline::toWeight(){ - double weightValue = weight/100; - changeWeight(weightValue); + changeWeight(weight); } void diff --git a/src/pen-context.cpp b/src/pen-context.cpp index 6f61ceb99..851a5f629 100644 --- a/src/pen-context.cpp +++ b/src/pen-context.cpp @@ -1578,6 +1578,8 @@ static void bspline_spiro_start_anchor_on(SPPenContext *const pc) if (pc->sa->start) { tmpCurve = tmpCurve->create_reverse(); } + pc->sa->curve->reset(); + pc->sa->curve = tmpCurve; } static void bspline_spiro_start_anchor_off(SPPenContext *const pc) diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 3e4fbd508..b4976bde5 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -389,7 +389,8 @@ void Handle::dragged(Geom::Point &new_pos, GdkEventMotion *event) double pos = 0; h = this; setPosition(new_pos); - pos = ceilf(_pm().BSplineHandlePosition(h)*_pm().controlBSplineSteps)/_pm().controlBSplineSteps; + int steps = _pm().getSteps(); + pos = ceilf(_pm().BSplineHandlePosition(h)*steps)/steps; new_pos=_pm().BSplineHandleReposition(h,pos); } //BSpline End @@ -864,6 +865,7 @@ void Node::setType(NodeType type, bool update_handles) Handle* front = &_front; Handle* back = &_back; double pos = _pm().BSplineHandlePosition(front); + if(pos !=0) pos = 0.3334; _front.setPosition(_pm().BSplineHandleReposition(front,pos)); _back.setPosition(_pm().BSplineHandleReposition(back,pos)); } diff --git a/src/ui/tool/node.h b/src/ui/tool/node.h index af83ac54e..2b547256b 100644 --- a/src/ui/tool/node.h +++ b/src/ui/tool/node.h @@ -125,7 +125,6 @@ private: // so a naked pointer is OK and allows setting it during Node's construction SPCtrlLine *_handle_line; bool _degenerate; // True if the handle is retracted, i.e. has zero length. This is used often internally so it makes sense to cache this - int controlBsplineSteps; /** * Control point of a cubic Bezier curve in a path. * diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index 8f6651dee..84e300306 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -161,7 +161,6 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, isBSpline = false; if(lpe_bsp){ isBSpline = true; - controlBSplineSteps = lpe_bsp->steps+1; } //BSpline End } @@ -842,8 +841,12 @@ void PathManipulator::scaleHandle(Node *n, int which, int dir, bool pixel) relpos *= ((rellen + length_change) / rellen); } h->setRelativePos(relpos); - update(); + if(isBSpline){ + double pos = BSplineHandlePosition(h); + h->setPosition(BSplineHandleReposition(h,pos)); + } + update(); gchar const *key = which < 0 ? "handle:scale:left" : "handle:scale:right"; _commit(_("Scale handle"), key); } @@ -867,7 +870,14 @@ void PathManipulator::rotateHandle(Node *n, int which, int dir, bool pixel) } h->setRelativePos(h->relativePos() * Geom::Rotate(angle)); + + if(isBSpline){ + double pos = BSplineHandlePosition(h); + h->setPosition(BSplineHandleReposition(h,pos)); + } + update(); + gchar const *key = which < 0 ? "handle:rotate:left" : "handle:rotate:right"; _commit(_("Rotate handle"), key); } @@ -1200,12 +1210,11 @@ void PathManipulator::_createControlPointsFromGeometry() } } +int PathManipulator::getSteps(){ + return lpe_bsp->steps+1; +} + double PathManipulator::BSplineHandlePosition(Handle *h){ - //BSpline - if(lpe_bsp){ - controlBSplineSteps = lpe_bsp->steps+1; - } - //BSpline End using Geom::X; using Geom::Y; double pos = 0; diff --git a/src/ui/tool/path-manipulator.h b/src/ui/tool/path-manipulator.h index 496bd957c..e68cabef1 100644 --- a/src/ui/tool/path-manipulator.h +++ b/src/ui/tool/path-manipulator.h @@ -99,7 +99,7 @@ public: bool search_unselected, bool closest); //BSpline bool isBSpline; - int controlBSplineSteps; + int getSteps(); //BSpline End // this is necessary for Tab-selection in MultiPathManipulator SubpathList &subpathList() { return _subpaths; } diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 3ffeff1fd..c9af08ed8 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -110,10 +110,10 @@ enum BarId { BAR_COMMANDS, BAR_SNAP, }; - +#define WITH_MESH #define BAR_ID_KEY "BarIdValue" #define HANDLE_POS_MARK "x-inkscape-pos" -#define WITH_MESH + static GtkWidget *sp_empty_toolbox_new(SPDesktop *desktop); @@ -514,9 +514,9 @@ static gchar const * ui_descr = " <toolitem action='MeshRowAction' />" " <toolitem action='MeshColumnAction' />" " <separator />" - " <toolitem action='MeshEditFillAction' />" - " <toolitem action='MeshEditStrokeAction' />" - " <toolitem action='MeshShowHandlesAction' />" +// " <toolitem action='MeshEditFillAction' />" +// " <toolitem action='MeshEditStrokeAction' />" +// " <toolitem action='MeshShowHandlesAction' />" " <separator />" " </toolbar>" |
