diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2007-08-17 20:30:10 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2007-08-17 20:30:10 +0000 |
| commit | 32144cc14e87e3c3eede2966a874f17da9c24eba (patch) | |
| tree | 8044c7a6c739386393357d085dd7b9db793bc4dd /src/live_effects/parameter/point.cpp | |
| parent | Enable center-dragging of boxes ('in perspective') within the XY-plane (diff) | |
| download | inkscape-32144cc14e87e3c3eede2966a874f17da9c24eba.tar.gz inkscape-32144cc14e87e3c3eede2966a874f17da9c24eba.zip | |
Fix LPE:
* add default values for parameters
* remove text for LPE_INVALID
* update example for skel strokes
* clean a bit of the code
(bzr r3498)
Diffstat (limited to 'src/live_effects/parameter/point.cpp')
| -rw-r--r-- | src/live_effects/parameter/point.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp index 8079f54eb..39208ad62 100644 --- a/src/live_effects/parameter/point.cpp +++ b/src/live_effects/parameter/point.cpp @@ -29,8 +29,8 @@ namespace LivePathEffect { PointParam::PointParam( const Glib::ustring& label, const Glib::ustring& tip,
const Glib::ustring& key, Inkscape::UI::Widget::Registry* wr,
- Effect* effect )
- : Geom::Point(0,0), Parameter(label, tip, key, wr, effect)
+ Effect* effect, Geom::Point defvalue )
+ : Geom::Point(defvalue), Parameter(label, tip, key, wr, effect)
{
_widget = NULL;
pointwdg = NULL;
@@ -58,7 +58,7 @@ PointParam::param_readSVGValue(const gchar * strvalue) success += sp_svg_number_read_d(strarray[1], &newy);
g_strfreev (strarray);
if (success == 2) {
- *dynamic_cast<Geom::Point *>( this ) = Geom::Point(newx, newy);
+ param_setValue( Geom::Point(newx, newy) );
return true;
}
return false;
@@ -68,7 +68,7 @@ gchar * PointParam::param_writeSVGValue() const
{
Inkscape::SVGOStringStream os;
- os << pointwdg->getPoint()->getXValue() << "," << pointwdg->getPoint()->getYValue();
+ os << (*this)[0] << "," << (*this)[1];
gchar * str = g_strdup(os.str().c_str());
return str;
}
@@ -79,7 +79,7 @@ PointParam::param_getWidget() if (!_widget) {
pointwdg = new Inkscape::UI::Widget::RegisteredPoint();
pointwdg->init(param_label, param_tooltip, param_key, *param_wr, param_effect->getRepr(), param_effect->getSPDoc());
- pointwdg->setValue(0.1, 0.2);
+ pointwdg->setValue( (*this)[0], (*this)[1] );
pointwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change point parameter"));
Gtk::Widget* pIcon = Gtk::manage( sp_icon_get_icon( "draw_node", Inkscape::ICON_SIZE_BUTTON) );
@@ -108,7 +108,8 @@ void PointParam::param_setValue(Geom::Point newpoint)
{
*dynamic_cast<Geom::Point *>( this ) = newpoint;
- pointwdg->setValue(newpoint[0], newpoint[1]);
+ if (pointwdg)
+ pointwdg->setValue(newpoint[0], newpoint[1]);
}
@@ -150,9 +151,9 @@ PointParam::on_button_click() }
}
-}; /* namespace LivePathEffect */
+} /* namespace LivePathEffect */
-}; /* namespace Inkscape */
+} /* namespace Inkscape */
/*
Local Variables:
|
