Merge lp:~inkscape.dev/inkscape/improvements_lpe_widget_redraw into lp:~inkscape.dev/inkscape/trunk
- improvements_lpe_widget_redraw
- Merge into trunk
Proposed by
Jabiertxof
Status: | Merged |
---|---|
Merge reported by: | Jabiertxof |
Merged at revision: | not available |
Proposed branch: | lp:~inkscape.dev/inkscape/improvements_lpe_widget_redraw |
Merge into: | lp:~inkscape.dev/inkscape/trunk |
Diff against target: |
574 lines (+115/-48) 17 files modified
src/knotholder.cpp (+2/-1) src/knotholder.h (+1/-1) src/live_effects/effect.cpp (+2/-1) src/live_effects/effect.h (+1/-0) src/live_effects/lpe-ellipse_5pts.cpp (+1/-1) src/live_effects/lpe-extrude.cpp (+1/-1) src/live_effects/lpe-knot.cpp (+2/-2) src/live_effects/lpe-transform_2pts.cpp (+0/-1) src/live_effects/parameter/parameter.cpp (+32/-13) src/live_effects/parameter/parameter.h (+3/-0) src/live_effects/parameter/point.cpp (+20/-17) src/live_effects/parameter/point.h (+3/-2) src/live_effects/parameter/togglebutton.cpp (+8/-1) src/selection.cpp (+5/-0) src/selection.h (+5/-0) src/ui/dialog/livepatheffect-editor.cpp (+25/-6) src/ui/dialog/livepatheffect-editor.h (+4/-1) |
To merge this branch: | bzr merge lp:~inkscape.dev/inkscape/improvements_lpe_widget_redraw |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Martin Owens | Approve | ||
Review via email: mp+300993@code.launchpad.net |
Commit message
Description of the change
Fix redraw of LPE widgets on each LPEitem update. -to not redraw always-
To post a comment you must log in.
- 15022. By Jabiertxof
-
update to trunk
- 15023. By Jabiertxof
-
Improvements and add toogle biton to play update
- 15024. By Jabiertxof
-
Fixes to autoredraw point and scalar on changes whitout redrawing all widgets
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/knotholder.cpp' |
2 | --- src/knotholder.cpp 2016-07-28 11:26:17 +0000 |
3 | +++ src/knotholder.cpp 2016-07-29 10:29:18 +0000 |
4 | @@ -17,6 +17,7 @@ |
5 | |
6 | #include "document.h" |
7 | #include "document-undo.h" |
8 | +#include "selection.h" |
9 | #include "sp-shape.h" |
10 | #include "knot.h" |
11 | #include "knotholder.h" |
12 | @@ -202,7 +203,7 @@ |
13 | } |
14 | |
15 | void |
16 | -KnotHolder::knot_ungrabbed_handler(SPKnot */*knot*/, guint) |
17 | +KnotHolder::knot_ungrabbed_handler(SPKnot */*knot*/, guint /*state*/) |
18 | { |
19 | this->dragging = false; |
20 | |
21 | |
22 | === modified file 'src/knotholder.h' |
23 | --- src/knotholder.h 2014-10-08 02:22:03 +0000 |
24 | +++ src/knotholder.h 2016-07-29 10:29:18 +0000 |
25 | @@ -51,7 +51,7 @@ |
26 | |
27 | void knot_moved_handler(SPKnot *knot, Geom::Point const &p, unsigned int state); |
28 | void knot_clicked_handler(SPKnot *knot, unsigned int state); |
29 | - void knot_ungrabbed_handler(SPKnot *knot, unsigned int); |
30 | + void knot_ungrabbed_handler(SPKnot *knot, unsigned int state); |
31 | |
32 | void add(KnotHolderEntity *e); |
33 | |
34 | |
35 | === modified file 'src/live_effects/effect.cpp' |
36 | --- src/live_effects/effect.cpp 2016-07-28 11:26:17 +0000 |
37 | +++ src/live_effects/effect.cpp 2016-07-29 10:29:18 +0000 |
38 | @@ -364,6 +364,7 @@ |
39 | concatenate_before_pwd2(false), |
40 | sp_lpe_item(NULL), |
41 | current_zoom(1), |
42 | + upd_params(true), |
43 | sp_curve(NULL), |
44 | provides_own_flash_paths(true), // is automatically set to false if providesOwnFlashPaths() is not overridden |
45 | is_ready(false) // is automatically set to false if providesOwnFlashPaths() is not overridden |
46 | @@ -691,7 +692,7 @@ |
47 | |
48 | ++it; |
49 | } |
50 | - |
51 | + upd_params = false; |
52 | return dynamic_cast<Gtk::Widget *>(vbox); |
53 | } |
54 | |
55 | |
56 | === modified file 'src/live_effects/effect.h' |
57 | --- src/live_effects/effect.h 2016-03-14 16:47:47 +0000 |
58 | +++ src/live_effects/effect.h 2016-07-29 10:29:18 +0000 |
59 | @@ -122,6 +122,7 @@ |
60 | |
61 | void editNextParamOncanvas(SPItem * item, SPDesktop * desktop); |
62 | bool apply_to_clippath_and_mask; |
63 | + bool upd_params; |
64 | |
65 | protected: |
66 | Effect(LivePathEffectObject *lpeobject); |
67 | |
68 | === modified file 'src/live_effects/lpe-ellipse_5pts.cpp' |
69 | --- src/live_effects/lpe-ellipse_5pts.cpp 2016-07-28 11:26:17 +0000 |
70 | +++ src/live_effects/lpe-ellipse_5pts.cpp 2016-07-29 10:29:18 +0000 |
71 | @@ -171,7 +171,7 @@ |
72 | |
73 | // figure out if we have a slice, guarding against rounding errors |
74 | |
75 | - Path p(Geom::Point(cos(0), sin(0))); |
76 | + Geom::Path p(Geom::Point(cos(0), sin(0))); |
77 | |
78 | double end = 2 * M_PI; |
79 | for (s = 0; s < end; s += M_PI_2) { |
80 | |
81 | === modified file 'src/live_effects/lpe-extrude.cpp' |
82 | --- src/live_effects/lpe-extrude.cpp 2016-07-28 11:26:17 +0000 |
83 | +++ src/live_effects/lpe-extrude.cpp 2016-07-29 10:29:18 +0000 |
84 | @@ -66,7 +66,7 @@ |
85 | using namespace Geom; |
86 | |
87 | // generate connecting lines (the 'sides' of the extrusion) |
88 | - Path path(Point(0.,0.)); |
89 | + Geom::Path path(Point(0.,0.)); |
90 | path.appendNew<Geom::LineSegment>( extrude_vector.getVector() ); |
91 | Piecewise<D2<SBasis> > connector = path.toPwSb(); |
92 | |
93 | |
94 | === modified file 'src/live_effects/lpe-knot.cpp' |
95 | --- src/live_effects/lpe-knot.cpp 2016-07-28 11:26:17 +0000 |
96 | +++ src/live_effects/lpe-knot.cpp 2016-07-29 10:29:18 +0000 |
97 | @@ -101,7 +101,7 @@ |
98 | |
99 | Affine mat = from_basis( T, N, pt_and_dir[0] ); |
100 | mat = mat.inverse(); |
101 | - Path p = patha * mat; |
102 | + Geom::Path p = patha * mat; |
103 | |
104 | std::vector<double> times; |
105 | |
106 | @@ -484,7 +484,7 @@ |
107 | // std::cout<<"fusing first and last component\n"; |
108 | ++beg_comp; |
109 | --end_comp; |
110 | - Path first = gpaths[i0].portion(dom.back()); |
111 | + Geom::Path first = gpaths[i0].portion(dom.back()); |
112 | //FIXME: stitching should not be necessary (?!?) |
113 | first.setStitching(true); |
114 | first.append(gpaths[i0].portion(dom.front())); |
115 | |
116 | === modified file 'src/live_effects/lpe-transform_2pts.cpp' |
117 | --- src/live_effects/lpe-transform_2pts.cpp 2016-07-28 11:26:17 +0000 |
118 | +++ src/live_effects/lpe-transform_2pts.cpp 2016-07-29 10:29:18 +0000 |
119 | @@ -90,7 +90,6 @@ |
120 | { |
121 | using namespace Geom; |
122 | original_bbox(lpeitem); |
123 | - |
124 | point_a = Point(boundingbox_X.min(), boundingbox_Y.middle()); |
125 | point_b = Point(boundingbox_X.max(), boundingbox_Y.middle()); |
126 | SPLPEItem * splpeitem = const_cast<SPLPEItem *>(lpeitem); |
127 | |
128 | === modified file 'src/live_effects/parameter/parameter.cpp' |
129 | --- src/live_effects/parameter/parameter.cpp 2015-10-18 19:13:13 +0000 |
130 | +++ src/live_effects/parameter/parameter.cpp 2016-07-29 10:29:18 +0000 |
131 | @@ -4,8 +4,6 @@ |
132 | * Released under GNU GPL, read the file 'COPYING' for more information |
133 | */ |
134 | |
135 | -#include "ui/widget/registered-widget.h" |
136 | -#include <glibmm/i18n.h> |
137 | |
138 | #include "live_effects/parameter/parameter.h" |
139 | #include "live_effects/effect.h" |
140 | @@ -16,6 +14,8 @@ |
141 | |
142 | #include "verbs.h" |
143 | |
144 | +#include <glibmm/i18n.h> |
145 | + |
146 | #define noLPEREALPARAM_DEBUG |
147 | |
148 | namespace Inkscape { |
149 | @@ -66,7 +66,8 @@ |
150 | inc_page(1), |
151 | add_slider(false), |
152 | overwrite_widget(false), |
153 | - hide_widget(no_widget) |
154 | + hide_widget(no_widget), |
155 | + _rsu(NULL) |
156 | { |
157 | } |
158 | |
159 | @@ -101,6 +102,12 @@ |
160 | param_set_value(defvalue); |
161 | } |
162 | |
163 | +void |
164 | +ScalarParam::param_update_default(gdouble default_value) |
165 | +{ |
166 | + defvalue = default_value; |
167 | +} |
168 | + |
169 | void |
170 | ScalarParam::param_set_value(gdouble val) |
171 | { |
172 | @@ -111,6 +118,9 @@ |
173 | value = max; |
174 | if (value < min) |
175 | value = min; |
176 | + if (_rsu) { |
177 | + _rsu->setValue(val); |
178 | + } |
179 | } |
180 | |
181 | void |
182 | @@ -132,7 +142,9 @@ |
183 | } else { |
184 | this->max = SCALARPARAM_G_MAXDOUBLE; |
185 | } |
186 | - |
187 | + if (_rsu) { |
188 | + _rsu->setRange(this->min, this->max); |
189 | + } |
190 | param_set_value(value); // reset value to see whether it is in ranges |
191 | } |
192 | |
193 | @@ -155,21 +167,22 @@ |
194 | ScalarParam::param_newWidget() |
195 | { |
196 | if(!hide_widget){ |
197 | - Inkscape::UI::Widget::RegisteredScalar *rsu = Gtk::manage( new Inkscape::UI::Widget::RegisteredScalar( |
198 | + _rsu = Gtk::manage( new Inkscape::UI::Widget::RegisteredScalar( |
199 | param_label, param_tooltip, param_key, *param_wr, param_effect->getRepr(), param_effect->getSPDoc() ) ); |
200 | |
201 | - rsu->setValue(value); |
202 | - rsu->setDigits(digits); |
203 | - rsu->setIncrements(inc_step, inc_page); |
204 | - rsu->setRange(min, max); |
205 | - rsu->setProgrammatically = false; |
206 | + _rsu->setValue(value); |
207 | + _rsu->setDigits(digits); |
208 | + _rsu->setIncrements(inc_step, inc_page); |
209 | + _rsu->setRange(min, max); |
210 | + _rsu->setProgrammatically = false; |
211 | if (add_slider) { |
212 | - rsu->addSlider(); |
213 | + _rsu->addSlider(); |
214 | } |
215 | if(!overwrite_widget){ |
216 | - rsu->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change scalar parameter")); |
217 | + _rsu->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change scalar parameter")); |
218 | } |
219 | - return dynamic_cast<Gtk::Widget *> (rsu); |
220 | + param_effect->upd_params = false; |
221 | + return dynamic_cast<Gtk::Widget *> (_rsu); |
222 | } else { |
223 | return NULL; |
224 | } |
225 | @@ -179,6 +192,9 @@ |
226 | ScalarParam::param_set_digits(unsigned digits) |
227 | { |
228 | this->digits = digits; |
229 | + if (_rsu) { |
230 | + _rsu->setDigits(this->digits); |
231 | + } |
232 | } |
233 | |
234 | void |
235 | @@ -186,6 +202,9 @@ |
236 | { |
237 | inc_step = step; |
238 | inc_page = page; |
239 | + if (_rsu) { |
240 | + _rsu->setIncrements(inc_step, inc_page); |
241 | + } |
242 | } |
243 | |
244 | |
245 | |
246 | === modified file 'src/live_effects/parameter/parameter.h' |
247 | --- src/live_effects/parameter/parameter.h 2015-10-18 19:13:13 +0000 |
248 | +++ src/live_effects/parameter/parameter.h 2016-07-29 10:29:18 +0000 |
249 | @@ -12,6 +12,7 @@ |
250 | #include <glibmm/ustring.h> |
251 | #include <2geom/forward.h> |
252 | #include <2geom/pathvector.h> |
253 | +#include "ui/widget/registered-widget.h" |
254 | |
255 | // In gtk2, this wasn't an issue; we could toss around |
256 | // G_MAXDOUBLE and not worry about size allocations. But |
257 | @@ -110,6 +111,7 @@ |
258 | virtual gchar * param_getSVGValue() const; |
259 | |
260 | virtual void param_set_default(); |
261 | + void param_update_default(gdouble default_value); |
262 | void param_set_value(gdouble val); |
263 | void param_make_integer(bool yes = true); |
264 | void param_set_range(gdouble min, gdouble max); |
265 | @@ -139,6 +141,7 @@ |
266 | private: |
267 | ScalarParam(const ScalarParam&); |
268 | ScalarParam& operator=(const ScalarParam&); |
269 | + Inkscape::UI::Widget::RegisteredScalar *_rsu; |
270 | }; |
271 | |
272 | } //namespace LivePathEffect |
273 | |
274 | === modified file 'src/live_effects/parameter/point.cpp' |
275 | --- src/live_effects/parameter/point.cpp 2016-01-17 19:18:53 +0000 |
276 | +++ src/live_effects/parameter/point.cpp 2016-07-29 10:29:18 +0000 |
277 | @@ -4,7 +4,6 @@ |
278 | * Released under GNU GPL, read the file 'COPYING' for more information |
279 | */ |
280 | |
281 | -#include "ui/widget/registered-widget.h" |
282 | #include "live_effects/parameter/point.h" |
283 | #include "live_effects/effect.h" |
284 | #include "svg/svg.h" |
285 | @@ -30,7 +29,8 @@ |
286 | : Parameter(label, tip, key, wr, effect), |
287 | defvalue(default_value), |
288 | liveupdate(live_update), |
289 | - knoth(NULL) |
290 | + knoth(NULL), |
291 | + _pointwdg(NULL) |
292 | { |
293 | knot_shape = SP_KNOT_SHAPE_DIAMOND; |
294 | knot_mode = SP_KNOT_MODE_XOR; |
295 | @@ -62,9 +62,9 @@ |
296 | } |
297 | |
298 | void |
299 | -PointParam::param_update_default(Geom::Point newpoint) |
300 | +PointParam::param_update_default(const Geom::Point default_point) |
301 | { |
302 | - defvalue = newpoint; |
303 | + defvalue = default_point; |
304 | } |
305 | |
306 | void |
307 | @@ -81,6 +81,9 @@ |
308 | if(knoth && liveupdate){ |
309 | knoth->update_knots(); |
310 | } |
311 | + if (_pointwdg) { |
312 | + _pointwdg->setValue( newpoint ); |
313 | + } |
314 | } |
315 | |
316 | bool |
317 | @@ -116,7 +119,7 @@ |
318 | Gtk::Widget * |
319 | PointParam::param_newWidget() |
320 | { |
321 | - Inkscape::UI::Widget::RegisteredTransformedPoint * pointwdg = Gtk::manage( |
322 | + _pointwdg = Gtk::manage( |
323 | new Inkscape::UI::Widget::RegisteredTransformedPoint( param_label, |
324 | param_tooltip, |
325 | param_key, |
326 | @@ -126,15 +129,15 @@ |
327 | // TODO: fix to get correct desktop (don't use SP_ACTIVE_DESKTOP) |
328 | SPDesktop *desktop = SP_ACTIVE_DESKTOP; |
329 | Geom::Affine transf = desktop->doc2dt(); |
330 | - pointwdg->setTransform(transf); |
331 | - pointwdg->setValue( *this ); |
332 | - pointwdg->clearProgrammatically(); |
333 | - pointwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change point parameter")); |
334 | + _pointwdg->setTransform(transf); |
335 | + _pointwdg->setValue( *this ); |
336 | + _pointwdg->clearProgrammatically(); |
337 | + _pointwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change point parameter")); |
338 | |
339 | Gtk::HBox * hbox = Gtk::manage( new Gtk::HBox() ); |
340 | - static_cast<Gtk::HBox*>(hbox)->pack_start(*pointwdg, true, true); |
341 | + static_cast<Gtk::HBox*>(hbox)->pack_start(*_pointwdg, true, true); |
342 | static_cast<Gtk::HBox*>(hbox)->show_all_children(); |
343 | - |
344 | + param_effect->upd_params = false; |
345 | return dynamic_cast<Gtk::Widget *> (hbox); |
346 | } |
347 | |
348 | @@ -191,13 +194,13 @@ |
349 | PointParamKnotHolderEntity::knot_click(guint state) |
350 | { |
351 | if (state & GDK_CONTROL_MASK) { |
352 | - if (state & GDK_MOD1_MASK) { |
353 | - this->pparam->param_set_default(); |
354 | - SPLPEItem * splpeitem = dynamic_cast<SPLPEItem *>(item); |
355 | - if(splpeitem){ |
356 | - sp_lpe_item_update_patheffect(splpeitem, false, false); |
357 | - } |
358 | + if (state & GDK_MOD1_MASK) { |
359 | + this->pparam->param_set_default(); |
360 | + SPLPEItem * splpeitem = dynamic_cast<SPLPEItem *>(item); |
361 | + if(splpeitem){ |
362 | + sp_lpe_item_update_patheffect(splpeitem, false, false); |
363 | } |
364 | + } |
365 | } |
366 | } |
367 | |
368 | |
369 | === modified file 'src/live_effects/parameter/point.h' |
370 | --- src/live_effects/parameter/point.h 2016-01-17 19:18:53 +0000 |
371 | +++ src/live_effects/parameter/point.h 2016-07-29 10:29:18 +0000 |
372 | @@ -11,7 +11,7 @@ |
373 | |
374 | #include <glib.h> |
375 | #include <2geom/point.h> |
376 | - |
377 | +#include "ui/widget/registered-widget.h" |
378 | #include "live_effects/parameter/parameter.h" |
379 | |
380 | #include "knot-holder-entity.h" |
381 | @@ -43,7 +43,7 @@ |
382 | void param_set_default(); |
383 | Geom::Point param_get_default() const; |
384 | void param_set_liveupdate(bool live_update); |
385 | - void param_update_default(Geom::Point newpoint); |
386 | + void param_update_default(const Geom::Point default_point); |
387 | virtual void param_transform_multiply(Geom::Affine const& /*postmul*/, bool /*set*/); |
388 | |
389 | void set_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color); |
390 | @@ -62,6 +62,7 @@ |
391 | SPKnotModeType knot_mode; |
392 | guint32 knot_color; |
393 | gchar *handle_tip; |
394 | + Inkscape::UI::Widget::RegisteredTransformedPoint * _pointwdg; |
395 | }; |
396 | |
397 | |
398 | |
399 | === modified file 'src/live_effects/parameter/togglebutton.cpp' |
400 | --- src/live_effects/parameter/togglebutton.cpp 2016-07-24 15:05:29 +0000 |
401 | +++ src/live_effects/parameter/togglebutton.cpp 2016-07-29 10:29:18 +0000 |
402 | @@ -12,6 +12,7 @@ |
403 | #include "live_effects/effect.h" |
404 | #include "svg/svg.h" |
405 | #include "svg/stringstream.h" |
406 | +#include "selection.h" |
407 | #include "widgets/icon.h" |
408 | #include "inkscape.h" |
409 | #include "verbs.h" |
410 | @@ -114,7 +115,7 @@ |
411 | checkwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change togglebutton parameter")); |
412 | |
413 | _toggled_connection = checkwdg->signal_toggled().connect(sigc::mem_fun(*this, &ToggleButtonParam::toggled)); |
414 | - |
415 | + param_effect->upd_params = false; |
416 | return checkwdg; |
417 | } |
418 | |
419 | @@ -161,6 +162,12 @@ |
420 | |
421 | void |
422 | ToggleButtonParam::toggled() { |
423 | + //Force redraw for update widgets |
424 | + param_effect->upd_params = true; |
425 | + if (SP_ACTIVE_DESKTOP) { |
426 | + Inkscape::Selection *selection = SP_ACTIVE_DESKTOP->getSelection(); |
427 | + selection ->emitModified(); |
428 | + } |
429 | _signal_toggled.emit(); |
430 | } |
431 | |
432 | |
433 | === modified file 'src/selection.cpp' |
434 | --- src/selection.cpp 2016-07-28 11:26:17 +0000 |
435 | +++ src/selection.cpp 2016-07-29 10:29:18 +0000 |
436 | @@ -282,6 +282,11 @@ |
437 | _emitChanged(); |
438 | } |
439 | |
440 | +void Selection::emitModified() |
441 | +{ |
442 | + _emitChanged(); |
443 | +} |
444 | + |
445 | std::vector<SPObject*> const &Selection::list() { |
446 | if(!_objs_vector.empty()) |
447 | return _objs_vector; |
448 | |
449 | === modified file 'src/selection.h' |
450 | --- src/selection.h 2016-07-28 11:26:17 +0000 |
451 | +++ src/selection.h 2016-07-29 10:29:18 +0000 |
452 | @@ -192,6 +192,11 @@ |
453 | void clear(); |
454 | |
455 | /** |
456 | + * Emmit modified signal |
457 | + */ |
458 | + void emitModified(); |
459 | + |
460 | + /** |
461 | * Returns true if no items are selected. |
462 | */ |
463 | bool isEmpty() const { return _objs.empty(); } |
464 | |
465 | === modified file 'src/ui/dialog/livepatheffect-editor.cpp' |
466 | --- src/ui/dialog/livepatheffect-editor.cpp 2016-07-28 11:26:17 +0000 |
467 | +++ src/ui/dialog/livepatheffect-editor.cpp 2016-07-29 10:29:18 +0000 |
468 | @@ -61,7 +61,7 @@ |
469 | { |
470 | LivePathEffectEditor *lpeeditor = static_cast<LivePathEffectEditor *>(data); |
471 | lpeeditor->lpe_list_locked = false; |
472 | - lpeeditor->onSelectionChanged(selection); |
473 | + lpeeditor->onSelectionChanged(selection, true); |
474 | } |
475 | |
476 | static void lpeeditor_selection_modified (Inkscape::Selection * selection, guint /*flags*/, gpointer data) |
477 | @@ -98,7 +98,8 @@ |
478 | button_up(), |
479 | button_down(), |
480 | current_desktop(NULL), |
481 | - current_lpeitem(NULL) |
482 | + current_lpeitem(NULL), |
483 | + current_lperef(NULL) |
484 | { |
485 | Gtk::Box *contents = _getContents(); |
486 | contents->set_spacing(4); |
487 | @@ -206,6 +207,10 @@ |
488 | void |
489 | LivePathEffectEditor::showParams(LivePathEffect::Effect& effect) |
490 | { |
491 | + if ( ! effect.upd_params ) { |
492 | + return; |
493 | + } |
494 | + |
495 | if (effectwidget) { |
496 | effectcontrol_vbox.remove(*effectwidget); |
497 | delete effectwidget; |
498 | @@ -265,9 +270,8 @@ |
499 | button_down.set_sensitive(sensitive); |
500 | } |
501 | |
502 | - |
503 | void |
504 | -LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel) |
505 | +LivePathEffectEditor::onSelectionChanged(Inkscape::Selection *sel, bool upd_params) |
506 | { |
507 | if (lpe_list_locked) { |
508 | // this was triggered by selecting a row in the list, so skip reloading |
509 | @@ -291,6 +295,9 @@ |
510 | if ( lpeitem->hasPathEffect() ) { |
511 | Inkscape::LivePathEffect::Effect *lpe = lpeitem->getCurrentLPE(); |
512 | if (lpe) { |
513 | + if (upd_params) { |
514 | + lpe->upd_params = true; |
515 | + } |
516 | showParams(*lpe); |
517 | lpe_list_locked = true; |
518 | selectInList(lpe); |
519 | @@ -494,6 +501,12 @@ |
520 | SPItem *item = sel->singleItem(); |
521 | SPLPEItem *lpeitem = dynamic_cast<SPLPEItem *>(item); |
522 | if ( lpeitem ) { |
523 | + if (current_lperef && current_lperef->lpeobject) { |
524 | + LivePathEffect::Effect * effect = current_lperef->lpeobject->get_lpe(); |
525 | + if (effect) { |
526 | + effect->upd_params = true; |
527 | + } |
528 | + } |
529 | lpeitem->removeCurrentPathEffect(false); |
530 | |
531 | DocumentUndo::done( current_desktop->getDocument(), SP_VERB_DIALOG_LIVE_PATH_EFFECT, |
532 | @@ -548,11 +561,17 @@ |
533 | Gtk::TreeModel::iterator it = sel->get_selected(); |
534 | LivePathEffect::LPEObjectReference * lperef = (*it)[columns.lperef]; |
535 | |
536 | - if (lperef && current_lpeitem) { |
537 | + if (lperef && current_lpeitem && current_lperef != lperef) { |
538 | + //The last condition ignore Gtk::TreeModel may occasionally be changed emitted when nothing has happened |
539 | if (lperef->lpeobject->get_lpe()) { |
540 | lpe_list_locked = true; // prevent reload of the list which would lose selection |
541 | current_lpeitem->setCurrentPathEffect(lperef); |
542 | - showParams(*lperef->lpeobject->get_lpe()); |
543 | + current_lperef = lperef; |
544 | + LivePathEffect::Effect * effect = lperef->lpeobject->get_lpe(); |
545 | + if (effect) { |
546 | + effect->upd_params = true; |
547 | + showParams(*effect); |
548 | + } |
549 | } |
550 | } |
551 | } |
552 | |
553 | === modified file 'src/ui/dialog/livepatheffect-editor.h' |
554 | --- src/ui/dialog/livepatheffect-editor.h 2014-03-27 01:33:44 +0000 |
555 | +++ src/ui/dialog/livepatheffect-editor.h 2016-07-29 10:29:18 +0000 |
556 | @@ -45,7 +45,8 @@ |
557 | |
558 | static LivePathEffectEditor &getInstance() { return *new LivePathEffectEditor(); } |
559 | |
560 | - void onSelectionChanged(Inkscape::Selection *sel); |
561 | + void onSelectionChanged(Inkscape::Selection *sel, bool upd_params = false); |
562 | + void onSelectionModified(Inkscape::Selection *sel); |
563 | virtual void on_effect_selection_changed(); |
564 | void setDesktop(SPDesktop *desktop); |
565 | |
566 | @@ -126,6 +127,8 @@ |
567 | |
568 | SPLPEItem * current_lpeitem; |
569 | |
570 | + LivePathEffect::LPEObjectReference * current_lperef; |
571 | + |
572 | friend void lpeeditor_selection_changed (Inkscape::Selection * selection, gpointer data); |
573 | |
574 | LivePathEffectEditor(LivePathEffectEditor const &d); |
This looks good.