diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2016-07-29 10:06:16 +0000 |
|---|---|---|
| committer | jabiertxof <info@marker.es> | 2016-07-29 10:06:16 +0000 |
| commit | 881b103a91e5668c1f7333ac989e4a968aa92aed (patch) | |
| tree | 7672c49ced787ae07e81cefb71f86af5a4ec5836 /src | |
| parent | Fix little typo (diff) | |
| download | inkscape-881b103a91e5668c1f7333ac989e4a968aa92aed.tar.gz inkscape-881b103a91e5668c1f7333ac989e4a968aa92aed.zip | |
Improvements to widget redraw
(bzr r15017.1.11)
Diffstat (limited to 'src')
| -rw-r--r-- | src/knotholder.cpp | 4 | ||||
| -rw-r--r-- | src/live_effects/lpe-ellipse_5pts.cpp | 2 | ||||
| -rw-r--r-- | src/live_effects/lpe-extrude.cpp | 2 | ||||
| -rw-r--r-- | src/live_effects/lpe-knot.cpp | 4 | ||||
| -rw-r--r-- | src/live_effects/parameter/parameter.cpp | 38 | ||||
| -rw-r--r-- | src/live_effects/parameter/parameter.h | 2 | ||||
| -rw-r--r-- | src/live_effects/parameter/point.cpp | 31 | ||||
| -rw-r--r-- | src/live_effects/parameter/point.h | 2 |
8 files changed, 50 insertions, 35 deletions
diff --git a/src/knotholder.cpp b/src/knotholder.cpp index 86ae8f0b8..eed358001 100644 --- a/src/knotholder.cpp +++ b/src/knotholder.cpp @@ -227,12 +227,8 @@ KnotHolder::knot_ungrabbed_handler(SPKnot */*knot*/, guint /*state*/) // write the ones that were changed? Inkscape::LivePathEffect::Effect *lpe = lpeItem->getCurrentLPE(); if (lpe) { - lpe->upd_params = true; LivePathEffectObject *lpeobj = lpe->getLPEObj(); lpeobj->updateRepr(); - //Force redraw for update widgets - Inkscape::Selection *selection = desktop->getSelection(); - selection ->emitModified(); } } diff --git a/src/live_effects/lpe-ellipse_5pts.cpp b/src/live_effects/lpe-ellipse_5pts.cpp index 4c953bcda..088d24b9c 100644 --- a/src/live_effects/lpe-ellipse_5pts.cpp +++ b/src/live_effects/lpe-ellipse_5pts.cpp @@ -171,7 +171,7 @@ LPEEllipse5Pts::doEffect_path (Geom::PathVector const & path_in) // figure out if we have a slice, guarding against rounding errors - Path p(Geom::Point(cos(0), sin(0))); + Geom::Path p(Geom::Point(cos(0), sin(0))); double end = 2 * M_PI; for (s = 0; s < end; s += M_PI_2) { diff --git a/src/live_effects/lpe-extrude.cpp b/src/live_effects/lpe-extrude.cpp index 8b3f4714a..dd1a8c824 100644 --- a/src/live_effects/lpe-extrude.cpp +++ b/src/live_effects/lpe-extrude.cpp @@ -66,7 +66,7 @@ LPEExtrude::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2 using namespace Geom; // generate connecting lines (the 'sides' of the extrusion) - Path path(Point(0.,0.)); + Geom::Path path(Point(0.,0.)); path.appendNew<Geom::LineSegment>( extrude_vector.getVector() ); Piecewise<D2<SBasis> > connector = path.toPwSb(); diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp index a033a6c4a..09f35f05e 100644 --- a/src/live_effects/lpe-knot.cpp +++ b/src/live_effects/lpe-knot.cpp @@ -101,7 +101,7 @@ findShadowedTime(Geom::Path const &patha, std::vector<Geom::Point> const &pt_and Affine mat = from_basis( T, N, pt_and_dir[0] ); mat = mat.inverse(); - Path p = patha * mat; + Geom::Path p = patha * mat; std::vector<double> times; @@ -484,7 +484,7 @@ LPEKnot::doEffect_path (Geom::PathVector const &path_in) // std::cout<<"fusing first and last component\n"; ++beg_comp; --end_comp; - Path first = gpaths[i0].portion(dom.back()); + Geom::Path first = gpaths[i0].portion(dom.back()); //FIXME: stitching should not be necessary (?!?) first.setStitching(true); first.append(gpaths[i0].portion(dom.front())); diff --git a/src/live_effects/parameter/parameter.cpp b/src/live_effects/parameter/parameter.cpp index ae55c84e9..3f8fced4b 100644 --- a/src/live_effects/parameter/parameter.cpp +++ b/src/live_effects/parameter/parameter.cpp @@ -4,8 +4,6 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include "ui/widget/registered-widget.h" -#include <glibmm/i18n.h> #include "live_effects/parameter/parameter.h" #include "live_effects/effect.h" @@ -16,6 +14,8 @@ #include "verbs.h" +#include <glibmm/i18n.h> + #define noLPEREALPARAM_DEBUG namespace Inkscape { @@ -66,7 +66,8 @@ ScalarParam::ScalarParam( const Glib::ustring& label, const Glib::ustring& tip, inc_page(1), add_slider(false), overwrite_widget(false), - hide_widget(no_widget) + hide_widget(no_widget), + _rsu(NULL) { } @@ -117,6 +118,9 @@ ScalarParam::param_set_value(gdouble val) value = max; if (value < min) value = min; + if (_rsu) { + _rsu->setValue(val); + } } void @@ -138,7 +142,9 @@ ScalarParam::param_set_range(gdouble min, gdouble max) } else { this->max = SCALARPARAM_G_MAXDOUBLE; } - + if (_rsu) { + _rsu->setRange(this->min, this->max); + } param_set_value(value); // reset value to see whether it is in ranges } @@ -161,22 +167,22 @@ Gtk::Widget * ScalarParam::param_newWidget() { if(!hide_widget){ - Inkscape::UI::Widget::RegisteredScalar *rsu = Gtk::manage( new Inkscape::UI::Widget::RegisteredScalar( + _rsu = Gtk::manage( new Inkscape::UI::Widget::RegisteredScalar( param_label, param_tooltip, param_key, *param_wr, param_effect->getRepr(), param_effect->getSPDoc() ) ); - rsu->setValue(value); - rsu->setDigits(digits); - rsu->setIncrements(inc_step, inc_page); - rsu->setRange(min, max); - rsu->setProgrammatically = false; + _rsu->setValue(value); + _rsu->setDigits(digits); + _rsu->setIncrements(inc_step, inc_page); + _rsu->setRange(min, max); + _rsu->setProgrammatically = false; if (add_slider) { - rsu->addSlider(); + _rsu->addSlider(); } if(!overwrite_widget){ - rsu->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change scalar parameter")); + _rsu->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change scalar parameter")); } param_effect->upd_params = false; - return dynamic_cast<Gtk::Widget *> (rsu); + return dynamic_cast<Gtk::Widget *> (_rsu); } else { return NULL; } @@ -186,6 +192,9 @@ void ScalarParam::param_set_digits(unsigned digits) { this->digits = digits; + if (_rsu) { + _rsu->setDigits(this->digits); + } } void @@ -193,6 +202,9 @@ ScalarParam::param_set_increments(double step, double page) { inc_step = step; inc_page = page; + if (_rsu) { + _rsu->setIncrements(inc_step, inc_page); + } } diff --git a/src/live_effects/parameter/parameter.h b/src/live_effects/parameter/parameter.h index 8556b0d9a..63c55203e 100644 --- a/src/live_effects/parameter/parameter.h +++ b/src/live_effects/parameter/parameter.h @@ -12,6 +12,7 @@ #include <glibmm/ustring.h> #include <2geom/forward.h> #include <2geom/pathvector.h> +#include "ui/widget/registered-widget.h" // In gtk2, this wasn't an issue; we could toss around // G_MAXDOUBLE and not worry about size allocations. But @@ -140,6 +141,7 @@ protected: private: ScalarParam(const ScalarParam&); ScalarParam& operator=(const ScalarParam&); + Inkscape::UI::Widget::RegisteredScalar *_rsu; }; } //namespace LivePathEffect diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp index 90a5b252b..3442fd851 100644 --- a/src/live_effects/parameter/point.cpp +++ b/src/live_effects/parameter/point.cpp @@ -4,7 +4,6 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include "ui/widget/registered-widget.h" #include "live_effects/parameter/point.h" #include "live_effects/effect.h" #include "svg/svg.h" @@ -30,7 +29,8 @@ PointParam::PointParam( const Glib::ustring& label, const Glib::ustring& tip, : Parameter(label, tip, key, wr, effect), defvalue(default_value), liveupdate(live_update), - knoth(NULL) + knoth(NULL), + _pointwdg(NULL) { knot_shape = SP_KNOT_SHAPE_DIAMOND; knot_mode = SP_KNOT_MODE_XOR; @@ -81,6 +81,9 @@ PointParam::param_setValue(Geom::Point newpoint, bool write) if(knoth && liveupdate){ knoth->update_knots(); } + if (_pointwdg) { + _pointwdg->setValue( newpoint ); + } } bool @@ -116,7 +119,7 @@ PointParam::param_transform_multiply(Geom::Affine const& postmul, bool /*set*/) Gtk::Widget * PointParam::param_newWidget() { - Inkscape::UI::Widget::RegisteredTransformedPoint * pointwdg = Gtk::manage( + _pointwdg = Gtk::manage( new Inkscape::UI::Widget::RegisteredTransformedPoint( param_label, param_tooltip, param_key, @@ -126,13 +129,13 @@ PointParam::param_newWidget() // TODO: fix to get correct desktop (don't use SP_ACTIVE_DESKTOP) SPDesktop *desktop = SP_ACTIVE_DESKTOP; Geom::Affine transf = desktop->doc2dt(); - pointwdg->setTransform(transf); - pointwdg->setValue( *this ); - pointwdg->clearProgrammatically(); - pointwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change point parameter")); + _pointwdg->setTransform(transf); + _pointwdg->setValue( *this ); + _pointwdg->clearProgrammatically(); + _pointwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change point parameter")); Gtk::HBox * hbox = Gtk::manage( new Gtk::HBox() ); - static_cast<Gtk::HBox*>(hbox)->pack_start(*pointwdg, true, true); + static_cast<Gtk::HBox*>(hbox)->pack_start(*_pointwdg, true, true); static_cast<Gtk::HBox*>(hbox)->show_all_children(); param_effect->upd_params = false; return dynamic_cast<Gtk::Widget *> (hbox); @@ -191,13 +194,13 @@ void PointParamKnotHolderEntity::knot_click(guint state) { if (state & GDK_CONTROL_MASK) { - if (state & GDK_MOD1_MASK) { - this->pparam->param_set_default(); - SPLPEItem * splpeitem = dynamic_cast<SPLPEItem *>(item); - if(splpeitem){ - sp_lpe_item_update_patheffect(splpeitem, false, false); - } + if (state & GDK_MOD1_MASK) { + this->pparam->param_set_default(); + SPLPEItem * splpeitem = dynamic_cast<SPLPEItem *>(item); + if(splpeitem){ + sp_lpe_item_update_patheffect(splpeitem, false, false); } + } } } diff --git a/src/live_effects/parameter/point.h b/src/live_effects/parameter/point.h index d41e8a710..62c6fb83d 100644 --- a/src/live_effects/parameter/point.h +++ b/src/live_effects/parameter/point.h @@ -11,6 +11,7 @@ #include <glib.h> #include <2geom/point.h> +#include "ui/widget/registered-widget.h" #include "live_effects/parameter/parameter.h" #include "knot-holder-entity.h" @@ -61,6 +62,7 @@ private: SPKnotModeType knot_mode; guint32 knot_color; gchar *handle_tip; + Inkscape::UI::Widget::RegisteredTransformedPoint * _pointwdg; }; |
