Merge lp:~inkscape.dev/inkscape/lastApplied into lp:~inkscape.dev/inkscape/trunk
- lastApplied
- Merge into trunk
Status: | Merged |
---|---|
Merge reported by: | su_v |
Merged at revision: | not available |
Proposed branch: | lp:~inkscape.dev/inkscape/lastApplied |
Merge into: | lp:~inkscape.dev/inkscape/trunk |
Diff against target: |
120 lines (+40/-6) 2 files modified
src/ui/tools/freehand-base.cpp (+39/-6) src/widgets/pencil-toolbar.cpp (+1/-0) |
To merge this branch: | bzr merge lp:~inkscape.dev/inkscape/lastApplied |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jabiertxof | Needs Resubmitting | ||
Krzysztof Kosinski | Needs Fixing | ||
Martin Owens | code review | Approve | |
Review via email: mp+184594@code.launchpad.net |
Commit message
Description of the change
Add a dropdown item to the path stroke list in pen/cil mode. It get the last applied path from the clipboard, making unnecesary retain the desired path in the clipboard.
Jabiertxof (jabiertxof) wrote : | # |
Thanks for the review Krzysztof.
Anybody confirm about first point? If is wrong with no manual XML
modification...
Second point. Any body can help me?
Third point is bad because i like the strokes like the original, I
dislike force the style to black and always filled.
If is posibol to continue with it i need a better name...you are
welcome.
Hi, Jabier.
If anybody confirm
El lun, 09-09-2013 a las 15:54 +0000, Krzysztof Kosinski escribió:
> Review: Disapprove
>
> 1. This feature is misleadingly named. It will apply the first stroke shape encountered in the defs. As far as I know, there is no guarantee on the order of defs.
>
> 2. The line "if (pattern == (const gchar *)"M 0,0 1,0") continue;" is wrong - you can't test for pointer equality even when one of the strings is constant.
>
> 3. Confusing control flow around the "shape_applied" variable. It should default to false and be set to true inside the if.
Martin Owens (doctormo) wrote : | # |
The code looks small, compact and useful. Is there any reason not to merge?
Krzysztof Kosinski (tweenk) wrote : | # |
The new behavior looks a lot better, but there are 2 more things to fix:
1. The static global variable 'pathv' is declared in the header, which is unacceptable - it should be declared in the cpp file, preferably in the function itself.
2. The name should be "Last applied".
3. Other cases in the switch should also set 'pathv' to the stroke shape which they applied.
- 12509. By Jabiertxof <email address hidden>
-
Krzysztof review done
Jabiertxof (jabiertxof) wrote : | # |
El jue, 19-09-2013 a las 14:02 +0000, Krzysztof Kosinski escribió:
> Review: Needs Fixing
>
> The new behavior looks a lot better, but there are 2 more things to fix:
>
> 1. The static global variable 'pathv' is declared in the header, which is unacceptable - it should be declared in the cpp file, preferably in the function itself.
> 2. The name should be "Last applied".
> 3. Other cases in the switch should also set 'pathv' to the stroke shape which they applied.
Hi Krzysztof thanks for the review.
I made a update to the branch whith your improvements.
The only thing not full adopt is the point tree, because the case 1 and
2 not use a pathvector, use the live effect "Power Stroke" and the case
3 depends is a ellipse calculated whith the data of the stroke. I made
another approach. Tell me your opinion.
- 12510. By Jabiertxof <email address hidden>
-
Fix and update to trunk
su_v (suv-lp) wrote : | # |
r12510 fails to compile (OS X 10.7.5, llvm-gcc-4.2, glib 2.36.4, glibmm 2.36.2):
CXX draw-context.o
../../src/
../../src/
../../src/
../../src/
make[3]: *** [draw-context.o] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
- 12511. By Jabiertxof <email address hidden>
-
~suv review: Fix for error compiling with clipboard
Jabiertxof (jabiertxof) wrote : | # |
El vie, 20-09-2013 a las 17:02 +0000, ~suv escribió:
> r12510 fails to compile (OS X 10.7.5, llvm-gcc-4.2, glib 2.36.4, glibmm 2.36.2):
>
> CXX draw-context.o
> ../../src/
> ../../src/
> ../../src/
> ../../src/
> make[3]: *** [draw-context.o] Error 1
> make[2]: *** [all] Error 2
> make[1]: *** [all-recursive] Error 1
> make: *** [all] Error 2
>
Hi ~suv, could you test now? Thanks.
su_v (suv-lp) wrote : | # |
On 2013-09-20 19:33 +0200, Jabiertxo Arraiza Cenoz wrote:
> El vie, 20-09-2013 a las 17:02 +0000, ~suv escribió:
>> r12510 fails to compile (OS X 10.7.5, llvm-gcc-4.2, glib 2.36.4, glibmm 2.36.2):
>>
>> CXX draw-context.o
>> ../../src/
>> ../../src/
>> ../../src/
>> ../../src/
>> make[3]: *** [draw-context.o] Error 1
>> make[2]: *** [all] Error 2
>> make[1]: *** [all-recursive] Error 1
>> make: *** [all] Error 2
>>
> Hi ~suv, could you test now? Thanks.
Confirmed fixed (r12511) - build succeeds once the missing header file is included :)
- 12512. By Jabiertxof <email address hidden>
-
update to trunk
Jabiertxof (jabiertxof) wrote : | # |
El vie, 20-09-2013 a las 17:42 +0000, ~suv escribió:
> On 2013-09-20 19:33 +0200, Jabiertxo Arraiza Cenoz wrote:
> > El vie, 20-09-2013 a las 17:02 +0000, ~suv escribió:
> >> r12510 fails to compile (OS X 10.7.5, llvm-gcc-4.2, glib 2.36.4, glibmm 2.36.2):
> >>
> >> CXX draw-context.o
> >> ../../src/
> >> ../../src/
> >> ../../src/
> >> ../../src/
> >> make[3]: *** [draw-context.o] Error 1
> >> make[2]: *** [all] Error 2
> >> make[1]: *** [all-recursive] Error 1
> >> make: *** [all] Error 2
> >>
> > Hi ~suv, could you test now? Thanks.
>
> Confirmed fixed (r12511) - build succeeds once the missing header file is included :)
Thanks and sorry for the mistake ~suv
Jabiertxof (jabiertxof) wrote : | # |
Hi Krzysztof i requet for another review with the web gui. Thanks again for your time.
- 12515. By Jabiertxof <email address hidden>
-
Start
- 12516. By Jabiertxof <email address hidden>
-
update to trunk
- 12517. By Jabiertxof <email address hidden>
-
Update to trunk
- 12518. By Jabiertxof <email address hidden>
-
Update to trunk
- 12519. By Jabiertxof <email address hidden>
-
Update to trunk
- 12520. By Jabiertxof <email address hidden>
-
Update to trunk
- 12521. By Jabiertxof <email address hidden>
-
Update to trunk
- 12522. By Jabiertxof <email address hidden>
-
Update to trunk
- 12523. By Jabiertxof <email address hidden>
-
update to trunk
- 12524. By Jabiertxof <email address hidden>
-
fixes released thanks to Johan Engelen in today bughunt
- 12525. By Jabiertxof <email address hidden>
-
update to trunk
- 12526. By Jabiertxof <email address hidden>
-
update to trunk
- 12527. By Jabiertxof <email address hidden>
-
update to trunk
Jabiertxof (jabiertxof) wrote : | # |
Hi Krzysztof Kosinski. I update the code whith your changes and whith the big help of Johan Engelen.
- 12528. By root <email address hidden>
-
update to trunk
- 12529. By Jabiertxof <email address hidden>
-
update to trunk
- 12530. By Jabiertxof <email address hidden>
-
Use of enum instead integers, pointed by Adib.
- 12531. By Jabiertxof <email address hidden>
-
a bit refactor on enum shapes
- 12532. By Jabiertxof <email address hidden>
-
update to trunk
- 12533. By Jabiertxof <email address hidden>
-
update to trunk
su_v (suv-lp) wrote : | # |
lastApplied was added to experimental in r13449
http://
experimental was merged into trunk in r13641
http://
Changing status to 'Merged'.
Preview Diff
1 | === modified file 'src/ui/tools/freehand-base.cpp' |
2 | --- src/ui/tools/freehand-base.cpp 2014-07-29 01:47:11 +0000 |
3 | +++ src/ui/tools/freehand-base.cpp 2014-07-30 00:15:34 +0000 |
4 | @@ -44,6 +44,8 @@ |
5 | #include "live_effects/lpe-powerstroke.h" |
6 | #include "style.h" |
7 | #include "ui/control-manager.h" |
8 | +// clipboard support |
9 | +#include "ui/clipboard.h" |
10 | #include "ui/tools/freehand-base.h" |
11 | |
12 | #include <gdk/gdkkeysyms.h> |
13 | @@ -272,7 +274,13 @@ |
14 | Effect::createAndApply(SPIRO, dc->desktop->doc(), item); |
15 | } |
16 | |
17 | - int shape = prefs->getInt(tool_name(dc) + "/shape", 0); |
18 | + //Store the clipboard path to apply in the future without the use of clipboard |
19 | + static Geom::PathVector previous_shape_pathv; |
20 | + enum shapeType { NONE, TRIANGLE_IN, TRIANGLE_OUT, ELLIPSE, CLIPBOARD, LAST_APPLIED }; |
21 | + static shapeType previous_shape_type = NONE; |
22 | + |
23 | + |
24 | + shapeType shape = (shapeType)prefs->getInt(tool_name(dc) + "/shape", 0); |
25 | bool shape_applied = false; |
26 | SPCSSAttr *css_item = sp_css_attr_from_object(item, SP_STYLE_FLAG_ALWAYS); |
27 | const char *cstroke = sp_repr_css_property(css_item, "stroke", "none"); |
28 | @@ -280,11 +288,18 @@ |
29 | #define SHAPE_LENGTH 10 |
30 | #define SHAPE_HEIGHT 10 |
31 | |
32 | + if(shape == LAST_APPLIED){ |
33 | + shape = previous_shape_type; |
34 | + if(shape == CLIPBOARD){ |
35 | + shape = LAST_APPLIED; |
36 | + } |
37 | + } |
38 | + |
39 | switch (shape) { |
40 | - case 0: |
41 | + case NONE: |
42 | // don't apply any shape |
43 | break; |
44 | - case 1: |
45 | + case TRIANGLE_IN: |
46 | { |
47 | // "triangle in" |
48 | std::vector<Geom::Point> points(1); |
49 | @@ -294,7 +309,7 @@ |
50 | shape_applied = true; |
51 | break; |
52 | } |
53 | - case 2: |
54 | + case TRIANGLE_OUT: |
55 | { |
56 | // "triangle out" |
57 | guint curve_length = curve->get_segment_count(); |
58 | @@ -305,7 +320,7 @@ |
59 | shape_applied = true; |
60 | break; |
61 | } |
62 | - case 3: |
63 | + case ELLIPSE: |
64 | { |
65 | // "ellipse" |
66 | SPCurve *c = new SPCurve(); |
67 | @@ -318,22 +333,40 @@ |
68 | c->closepath(); |
69 | spdc_paste_curve_as_freehand_shape(c, dc, item); |
70 | c->unref(); |
71 | + |
72 | shape_applied = true; |
73 | break; |
74 | } |
75 | - case 4: |
76 | + case CLIPBOARD: |
77 | { |
78 | // take shape from clipboard; TODO: catch the case where clipboard is empty |
79 | Effect::createAndApply(PATTERN_ALONG_PATH, dc->desktop->doc(), item); |
80 | Effect* lpe = SP_LPE_ITEM(item)->getCurrentLPE(); |
81 | static_cast<LPEPatternAlongPath*>(lpe)->pattern.on_paste_button_click(); |
82 | + Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get(); |
83 | + Glib::ustring svgd = cm->getPathParameter(SP_ACTIVE_DESKTOP); |
84 | + previous_shape_pathv = sp_svg_read_pathv(svgd.data()); |
85 | |
86 | shape_applied = true; |
87 | break; |
88 | } |
89 | + case LAST_APPLIED: |
90 | + { |
91 | + if(previous_shape_pathv.size() != 0){ |
92 | + SPCurve * c = new SPCurve(); |
93 | + c->set_pathvector(previous_shape_pathv); |
94 | + spdc_paste_curve_as_freehand_shape(c, dc, item); |
95 | + c->unref(); |
96 | + |
97 | + shape_applied = true; |
98 | + } |
99 | + break; |
100 | + } |
101 | default: |
102 | break; |
103 | } |
104 | + previous_shape_type = shape; |
105 | + |
106 | if (shape_applied) { |
107 | // apply original stroke color as fill and unset stroke; then return |
108 | SPCSSAttr *css = sp_repr_css_attr_new(); |
109 | |
110 | === modified file 'src/widgets/pencil-toolbar.cpp' |
111 | --- src/widgets/pencil-toolbar.cpp 2014-03-26 21:14:16 +0000 |
112 | +++ src/widgets/pencil-toolbar.cpp 2014-07-30 00:15:34 +0000 |
113 | @@ -157,6 +157,7 @@ |
114 | glist = g_list_append (glist, _("Triangle out")); |
115 | glist = g_list_append (glist, _("Ellipse")); |
116 | glist = g_list_append (glist, _("From clipboard")); |
117 | + glist = g_list_append (glist, _("Last applied")); |
118 | |
119 | return glist; |
120 | } |
1. This feature is misleadingly named. It will apply the first stroke shape encountered in the defs. As far as I know, there is no guarantee on the order of defs.
2. The line "if (pattern == (const gchar *)"M 0,0 1,0") continue;" is wrong - you can't test for pointer equality even when one of the strings is constant.
3. Confusing control flow around the "shape_applied" variable. It should default to false and be set to true inside the if.