Merge lp:~chr0x07/inkscape/0.92.fixes.2 into lp:inkscape/0.92.x

Proposed by chr[]
Status: Merged
Merged at revision: 15430
Proposed branch: lp:~chr0x07/inkscape/0.92.fixes.2
Merge into: lp:inkscape/0.92.x
Diff against target: 732 lines (+225/-73)
17 files modified
share/icons/icons.svg (+24/-0)
src/live_effects/lpe-bspline.cpp (+1/-0)
src/live_effects/parameter/path.cpp (+2/-1)
src/path-chemistry.cpp (+2/-1)
src/selection-chemistry.cpp (+62/-2)
src/selection-chemistry.h (+2/-0)
src/sp-item-group.cpp (+1/-0)
src/sp-item.cpp (+6/-2)
src/sp-item.h (+2/-2)
src/sp-pattern.cpp (+4/-2)
src/ui/dialog/objects.cpp (+75/-44)
src/ui/dialog/objects.h (+4/-1)
src/ui/widget/clipmaskicon.cpp (+12/-12)
src/ui/widget/clipmaskicon.h (+2/-2)
src/verbs.cpp (+14/-0)
src/verbs.h (+2/-0)
src/widgets/stroke-marker-selector.cpp (+10/-4)
To merge this branch: bzr merge lp:~chr0x07/inkscape/0.92.fixes.2
Reviewer Review Type Date Requested Status
Mc (community) Approve
Review via email: mp+324218@code.launchpad.net

Description of the change

Support Raise and Lower (z-order) for non-overlapping objects

To generate CNC data with inkscape we want to order objects by z-order

bugfixes object manager panel:

- It uses raise/lower which is clearly a bug

- polish behavior regarding collapsing/expanding the tree: in drawings with many objects in groups it is annoying if it opens group just by selecting them. Expand group as they are entered via double click

- disable search function which eats many keystrokes: use ctrl+f to use it

- fix some memory leaks

- fix: speed up inkscape startup time
 (due to missing icons / non cached icons)
 (~2 seconds left: stroke-panel/arrow marker ....)

Note: this no more modifies default key strokes, you can assign the keystrokes you like to the new functions.

To post a comment you must log in.
Revision history for this message
chr[] (chr0x07) wrote :

I have no idea why CMakeScripts/InstallMSYS2.cmake made it into the diff

Revision history for this message
Patrick Storz (ede123) wrote :

Could you maybe just "bzr revert CMakeScripts/InstallMSYS2.cmake"?

I guess this has to do with Bazaar storing something like an inode number for each file, so even if a file has the same content it will show as a conflict (stupid, but that's just the way bzr is ;-) )

I recently had to explicitly delete and recreate that file as it was impossible to merge changes from trunk otherwise (bzr insisted it were different files, even when the content was identical, because they were created "individually" after branching 0.92.x)

Revision history for this message
chr[] (chr0x07) wrote :

so, the diff looks all right now

Revision history for this message
Mc (mc...) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'share/icons/icons.svg'
2--- share/icons/icons.svg 2016-12-15 13:03:33 +0000
3+++ share/icons/icons.svg 2017-05-17 23:30:53 +0000
4@@ -4323,4 +4323,28 @@
5 </g>
6 </g>
7 </g>
8+<g id="object-clipped" transform="translate(238.8904,209.8666)">
9+<rect transform="rotate(90)" style="opacity:1;vector-effect:none;fill:#9ab8d5;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.99999988;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:1.5;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" id="rect5272" width="16.00001" height="15.99999" x="159.1449" y="-92.158638" />
10+<path d="m -98.444747,-168.45699 a 12.6149,12.6149 0 0 1 13.078074,12.08243 l -12.60403,0.52356 z" sodipodi:end="6.24167" sodipodi:start="4.674802" sodipodi:ry="12.6149" sodipodi:rx="12.6149" sodipodi:cy="-155.851" sodipodi:cx="-97.970703" sodipodi:type="arc" id="path5274" style="display:inline;opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:0.99335549;fill-rule:nonzero;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1.20000005;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" transform="rotate(-177.7077)" />
11+<rect y="-91.658653" x="159.6449" height="15" width="15" id="rect5276" style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#c80000;stroke-width:1.00000012;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:1.5;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" transform="rotate(90)" />
12+</g>
13+<g transform="matrix(1.034469,0,0,1.034469,199.9323,-218.0428)" id="object-masked" style="stroke-width:0.96667951">
14+<g style="stroke-width:0.96667659" transform="matrix(1.000013,0,0,0.9999918,121.4104,415.3122)" id="g5284">
15+<path style="opacity:1;vector-effect:none;fill:#9ab8d5;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.45001554;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:1.5;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" d="m 13.55417,167.1658 v -14.5 h 14.5 z" id="path5280" inkscape:connector-curvature="0" sodipodi:nodetypes="cccc" />
16+<path style="opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.45001554;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:1.5;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" d="m 28.05417,152.6658 v 14.5 h -14.5 z" id="path5282" inkscape:connector-curvature="0" sodipodi:nodetypes="cccc" />
17+</g>
18+<g style="stroke-width:2.00240207" id="g5290" transform="matrix(-0.4827649,0,0,-0.4827546,152.2584,652.4268)">
19+<path sodipodi:nodetypes="cccc" inkscape:connector-curvature="0" id="path5286" d="m 13.55417,167.1658 v -14.5 h 14.5 z" style="opacity:1;vector-effect:none;fill:#9ab8d5;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.00360346;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:1.5;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
20+<path sodipodi:nodetypes="cccc" inkscape:connector-curvature="0" id="path5288" d="m 28.05417,152.6658 v 14.5 h -14.5 z" style="opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.00360346;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:1.5;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
21+</g>
22+<rect y="-149.465" x="567.97681" height="14.50019" width="14.49988" id="rect5292" style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.96667951;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:1.5;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" transform="rotate(90)" />
23+</g>
24+<g style="opacity:1;stroke-width:0.96774209" transform="matrix(1.033333,0,0,1.033333,166.9413,-217.5105)" id="object-clip-mask">
25+<path style="opacity:1;vector-effect:none;fill:#9ab8d5;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.45161366;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:1.5;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" d="m 190.0319,582.7473 v -15 h 15 z" id="path5296" inkscape:connector-curvature="0" sodipodi:nodetypes="cccc" />
26+<path style="opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:0.98349819;fill-rule:nonzero;stroke:none;stroke-width:1.45161366;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:1.5;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" d="m 205.0318,567.7474 v 15 h -15 z" id="path5298" inkscape:connector-curvature="0" sodipodi:nodetypes="cccc" />
27+<path transform="rotate(-177.7077)" style="display:inline;opacity:1;vector-effect:none;fill:none;fill-opacity:0.99335549;fill-rule:nonzero;stroke:#000000;stroke-width:0.96774209;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:1.20000005;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" id="path5300" sodipodi:type="arc" sodipodi:cx="-227.3363" sodipodi:cy="-559.35199" sodipodi:rx="12.6149" sodipodi:ry="12.6149" sodipodi:start="4.674802" sodipodi:end="6.24167" d="m -227.81035,-571.95798 a 12.6149,12.6149 0 0 1 13.07808,12.08243 l -12.60403,0.52356 z" />
28+<path sodipodi:nodetypes="cccc" inkscape:connector-curvature="0" id="path5302" d="m 194.0319,578.7472 v -6.9999 h 7 z" style="opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.45161378;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:1.5;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
29+<rect transform="rotate(90)" style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#c80000;stroke-width:0.96774209;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:1.5;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" id="rect5304" width="14.5" height="14.5" x="567.99731" y="-204.78191" />
30+<path sodipodi:nodetypes="cccc" inkscape:connector-curvature="0" id="path5306" d="m 201.0319,571.7473 v 6.9999 h -7 z" style="opacity:1;vector-effect:none;fill:#9ab8d5;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.45161378;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:1.5;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
31+</g>
32 </svg>
33
34=== modified file 'src/live_effects/lpe-bspline.cpp'
35--- src/live_effects/lpe-bspline.cpp 2016-01-05 15:30:09 +0000
36+++ src/live_effects/lpe-bspline.cpp 2017-05-17 23:30:53 +0000
37@@ -168,6 +168,7 @@
38 doBSplineFromWidget(curve, weight_ammount/100.0);
39 gchar *str = sp_svg_write_path(curve->get_pathvector());
40 path->getRepr()->setAttribute("inkscape:original-d", str);
41+ g_free(str);
42 }
43 }
44
45
46=== modified file 'src/live_effects/parameter/path.cpp'
47--- src/live_effects/parameter/path.cpp 2016-07-02 00:27:56 +0000
48+++ src/live_effects/parameter/path.cpp 2017-05-17 23:30:53 +0000
49@@ -242,8 +242,9 @@
50 r.lpe_key = param_key;
51 Geom::PathVector stored_pv = _pathvector;
52 param_write_to_repr("M0,0 L1,0");
53- const char *svgd = sp_svg_write_path(stored_pv);
54+ gchar *svgd = sp_svg_write_path(stored_pv);
55 param_write_to_repr(svgd);
56+ g_free(svgd);
57 } else {
58 r.item = ref.getObject();
59 }
60
61=== modified file 'src/path-chemistry.cpp'
62--- src/path-chemistry.cpp 2016-04-08 13:26:55 +0000
63+++ src/path-chemistry.cpp 2017-05-17 23:30:53 +0000
64@@ -250,8 +250,9 @@
65 repr->setAttribute("inkscape:original-d", str);
66 else
67 repr->setAttribute("d", str);
68+ str = sp_svg_transform_write(transform);
69+ repr->setAttribute("transform", str);
70 g_free(str);
71- repr->setAttribute("transform", sp_svg_transform_write(transform));
72
73 // add the new repr to the parent
74 parent->appendChild(repr);
75
76=== modified file 'src/selection-chemistry.cpp'
77--- src/selection-chemistry.cpp 2017-02-22 13:10:40 +0000
78+++ src/selection-chemistry.cpp 2017-05-17 23:30:53 +0000
79@@ -1115,6 +1115,63 @@
80 C_("Undo action", "Lower"));
81 }
82
83+void sp_selection_stack_down(Inkscape::Selection *selection, SPDesktop *desktop)
84+{
85+ SPDocument *document = selection->layers()->getDocument();
86+ std::vector<SPItem*> selected = selection->itemList();
87+
88+ if (selected.empty()) {
89+ selection_display_message(desktop, Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to stack down."));
90+ return;
91+ }
92+
93+ /* Construct direct-ordered list of selected children. */
94+ std::vector<SPItem*> items(selected);
95+ sort(items.begin(),items.end(),sp_item_repr_compare_position_bool);
96+
97+ for (std::vector<SPItem*>::const_iterator item=items.begin();item!=items.end();++item) {
98+ SPItem *item_obj = *item;
99+ if(!item_obj->lowerOne()) {
100+ DocumentUndo::cancel(document);
101+ selection_display_message(desktop, Inkscape::WARNING_MESSAGE, _("We hit bottom."));
102+ return;
103+ }
104+ }
105+
106+ DocumentUndo::done(document, SP_VERB_SELECTION_STACK_DOWN,
107+ //TRANSLATORS: "Lower" means "to lower an object" in the undo history
108+ C_("Undo action", "stack down"));
109+}
110+
111+void sp_selection_stack_up(Inkscape::Selection *selection, SPDesktop *desktop)
112+{
113+ SPDocument *document = selection->layers()->getDocument();
114+ std::vector<SPItem*> selected = selection->itemList();
115+
116+ if (selected.empty()) {
117+ selection_display_message(desktop, Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to stack up."));
118+ return;
119+ }
120+
121+ /* Construct direct-ordered list of selected children. */
122+ std::vector<SPItem*> items(selected);
123+ sort(items.begin(),items.end(),sp_item_repr_compare_position_bool);
124+ bool cancel = false;
125+
126+ for (std::vector<SPItem*>::const_reverse_iterator item=items.rbegin();item!=items.rend();++item) {
127+ SPItem *item_obj = *item;
128+ if (!item_obj->raiseOne()) {
129+ DocumentUndo::cancel(document);
130+ selection_display_message(desktop, Inkscape::WARNING_MESSAGE, _("We hit top."));
131+ return;
132+ }
133+ }
134+
135+ DocumentUndo::done(document, SP_VERB_SELECTION_STACK_UP,
136+ //TRANSLATORS: "Lower" means "to lower an object" in the undo history
137+ C_("Undo action", "stack up"));
138+}
139+
140 void sp_selection_lower_to_bottom(Inkscape::Selection *selection, SPDesktop *desktop)
141 {
142 SPDocument *document = selection->layers()->getDocument();
143@@ -3175,8 +3232,11 @@
144 the_parent_repr->appendChild(clone);
145
146 if( single_group && transform.isTranslation() ) {
147- if( !transform.isIdentity() )
148- clone->setAttribute("transform", sp_svg_transform_write( transform ));
149+ if( !transform.isIdentity() ) {
150+ gchar *c = sp_svg_transform_write( transform );
151+ clone->setAttribute("transform", c);
152+ g_free(c);
153+ }
154 }
155
156 // Change selection to new <use> element.
157
158=== modified file 'src/selection-chemistry.h'
159--- src/selection-chemistry.h 2016-04-14 18:19:03 +0000
160+++ src/selection-chemistry.h 2017-05-17 23:30:53 +0000
161@@ -79,8 +79,10 @@
162 void sp_selection_ungroup_pop_selection(Inkscape::Selection *selection, SPDesktop *desktop);
163
164 void sp_selection_raise(Inkscape::Selection *selection, SPDesktop *desktop);
165+void sp_selection_stack_up(Inkscape::Selection *selection, SPDesktop *desktop);
166 void sp_selection_raise_to_top(Inkscape::Selection *selection, SPDesktop *desktop);
167 void sp_selection_lower(Inkscape::Selection *selection, SPDesktop *desktop);
168+void sp_selection_stack_down(Inkscape::Selection *selection, SPDesktop *desktop);
169 void sp_selection_lower_to_bottom(Inkscape::Selection *selection, SPDesktop *desktop);
170
171 SPCSSAttr *take_style_from_item (SPObject *object);
172
173=== modified file 'src/sp-item-group.cpp'
174--- src/sp-item-group.cpp 2016-08-29 06:01:18 +0000
175+++ src/sp-item-group.cpp 2017-05-17 23:30:53 +0000
176@@ -598,6 +598,7 @@
177 Geom::Affine ttrans = ctrans.inverse() * SP_ITEM(text)->transform * ctrans;
178 gchar *affinestr = sp_svg_transform_write(ttrans);
179 nrepr->setAttribute("transform", affinestr);
180+ g_free(affinestr);
181 }
182 } else {
183 nrepr->setAttribute("transform", affinestr);
184
185=== modified file 'src/sp-item.cpp'
186--- src/sp-item.cpp 2017-01-17 10:28:55 +0000
187+++ src/sp-item.cpp 2017-05-17 23:30:53 +0000
188@@ -318,17 +318,19 @@
189 }
190 }
191
192-void SPItem::raiseOne() {
193+bool SPItem::raiseOne() {
194 SPObject *next_higher=std::find_if<SPObject::SiblingIterator>(
195 next, NULL, &is_item
196 );
197 if (next_higher) {
198 Inkscape::XML::Node *ref = next_higher->getRepr();
199 getRepr()->parent()->changeOrder(getRepr(), ref);
200+ return true;
201 }
202+ return false;
203 }
204
205-void SPItem::lowerOne() {
206+bool SPItem::lowerOne() {
207 using Inkscape::Util::MutableList;
208 using Inkscape::Util::reverse_list;
209
210@@ -343,7 +345,9 @@
211 ++next_lower;
212 Inkscape::XML::Node *ref = ( next_lower ? next_lower->getRepr() : NULL );
213 getRepr()->parent()->changeOrder(getRepr(), ref);
214+ return true;
215 }
216+ return false;
217 }
218
219 void SPItem::lowerToBottom() {
220
221=== modified file 'src/sp-item.h'
222--- src/sp-item.h 2015-03-16 20:22:36 +0000
223+++ src/sp-item.h 2017-05-17 23:30:53 +0000
224@@ -212,8 +212,8 @@
225
226 Geom::Affine getRelativeTransform(SPObject const *obj) const;
227
228- void raiseOne();
229- void lowerOne();
230+ bool raiseOne();
231+ bool lowerOne();
232 void raiseToTop();
233 void lowerToBottom();
234
235
236=== modified file 'src/sp-pattern.cpp'
237--- src/sp-pattern.cpp 2016-09-06 10:44:16 +0000
238+++ src/sp-pattern.cpp 2017-05-17 23:30:53 +0000
239@@ -374,8 +374,9 @@
240 }
241 _pattern_transform_set = true;
242
243- Glib::ustring c = sp_svg_transform_write(_pattern_transform);
244+ gchar *c = sp_svg_transform_write(_pattern_transform);
245 getRepr()->setAttribute("patternTransform", c);
246+ g_free(c);
247 }
248
249 const gchar *SPPattern::produce(const std::vector<Inkscape::XML::Node *> &reprs, Geom::Rect bounds,
250@@ -392,8 +393,9 @@
251 sp_repr_set_svg_double(repr, "height", bounds.dimensions()[Geom::Y]);
252 //TODO: Maybe is better handle it in sp_svg_transform_write
253 if(transform != Geom::Affine()){
254- Glib::ustring t = sp_svg_transform_write(transform);
255+ gchar *t = sp_svg_transform_write(transform);
256 repr->setAttribute("patternTransform", t);
257+ g_free(t);
258 }
259 defsrepr->appendChild(repr);
260 const gchar *pat_id = repr->attribute("id");
261
262=== modified file 'src/ui/dialog/objects.cpp'
263--- src/ui/dialog/objects.cpp 2016-11-07 16:26:09 +0000
264+++ src/ui/dialog/objects.cpp 2017-05-17 23:30:53 +0000
265@@ -34,6 +34,7 @@
266 #include "helper/action.h"
267 #include "inkscape.h"
268 #include "layer-manager.h"
269+#include "shortcuts.h"
270 #include "preferences.h"
271 #include "selection.h"
272 #include "sp-clippath.h"
273@@ -319,11 +320,13 @@
274 SPRoot* root = document->getRoot();
275 if ( root ) {
276 _selectedConnection.block();
277+ _documentChangedCurrentLayer.block();
278 //Clear the tree store
279 _store->clear();
280 //Add all items recursively
281 _addObject( root, 0 );
282 _selectedConnection.unblock();
283+ _documentChangedCurrentLayer.unblock();
284 //Set the tree selection
285 _objectsSelected(_desktop->selection);
286 //Handle button sensitivity
287@@ -362,13 +365,17 @@
288 row[_model->_colLocked] = !item->isSensitive();
289 row[_model->_colType] = group ? (group->layerMode() == SPGroup::LAYER ? 2 : 1) : 0;
290 row[_model->_colHighlight] = item->isHighlightSet() ? item->highlight_color() : item->highlight_color() & 0xffffff00;
291- row[_model->_colClipMask] = item->clip_ref && item->clip_ref->getObject() ? 1 : (item->mask_ref && item->mask_ref->getObject() ? 2 : 0);
292+ row[_model->_colClipMask] = item ? (
293+ (item->clip_ref && item->clip_ref->getObject() ? 1 : 0) |
294+ (item->mask_ref && item->mask_ref->getObject() ? 2 : 0)
295+ ) : 0;
296 //row[_model->_colInsertOrder] = group ? (group->insertBottom() ? 2 : 1) : 0;
297
298 //If our parent object is a group and it's expanded, expand the tree
299 if (SP_IS_GROUP(obj) && SP_GROUP(obj)->expanded())
300 {
301 _tree.expand_to_path( _store->get_path(iter) );
302+ _tree.collapse_row( _store->get_path(iter) );
303 }
304
305 //Add an object watcher to the item
306@@ -426,7 +433,10 @@
307 row[_model->_colLocked] = item ? !item->isSensitive() : false;
308 row[_model->_colType] = group ? (group->layerMode() == SPGroup::LAYER ? 2 : 1) : 0;
309 row[_model->_colHighlight] = item ? (item->isHighlightSet() ? item->highlight_color() : item->highlight_color() & 0xffffff00) : 0;
310- row[_model->_colClipMask] = item ? (item->clip_ref && item->clip_ref->getObject() ? 1 : (item->mask_ref && item->mask_ref->getObject() ? 2 : 0)) : 0;
311+ row[_model->_colClipMask] = item ? (
312+ (item->clip_ref && item->clip_ref->getObject() ? 1 : 0) |
313+ (item->mask_ref && item->mask_ref->getObject() ? 2 : 0)
314+ ) : 0;
315 //row[_model->_colInsertOrder] = group ? (group->insertBottom() ? 2 : 1) : 0;
316
317 return true;
318@@ -486,13 +496,13 @@
319 _setCompositingValues(item);
320 setOpacity = false;
321 }
322- _store->foreach(sigc::bind<SPItem *, bool>( sigc::mem_fun(*this, &ObjectsPanel::_checkForSelected), item, (*i)==items.back()));
323+ _store->foreach(sigc::bind<SPItem *, bool>( sigc::mem_fun(*this, &ObjectsPanel::_checkForSelected), item, (*i)==items.back(), false));
324 }
325 if (!item) {
326 if (_desktop->currentLayer() && SP_IS_ITEM(_desktop->currentLayer())) {
327 item = SP_ITEM(_desktop->currentLayer());
328 _setCompositingValues(item);
329- _store->foreach(sigc::bind<SPItem *, bool>( sigc::mem_fun(*this, &ObjectsPanel::_checkForSelected), item, true));
330+ _store->foreach(sigc::bind<SPItem *, bool>( sigc::mem_fun(*this, &ObjectsPanel::_checkForSelected), item, false, true));
331 }
332 }
333 _selectedConnection.unblock();
334@@ -559,7 +569,7 @@
335 * @param scrollto Whether to scroll to the item
336 * @return Whether to continue searching the tree
337 */
338-bool ObjectsPanel::_checkForSelected(const Gtk::TreePath &path, const Gtk::TreeIter& iter, SPItem* item, bool scrollto)
339+bool ObjectsPanel::_checkForSelected(const Gtk::TreePath &path, const Gtk::TreeIter& iter, SPItem* item, bool scrollto, bool expand)
340 {
341 bool stopGoing = false;
342
343@@ -568,13 +578,16 @@
344 {
345 //We found the item! Expand to the path and select it in the tree.
346 _tree.expand_to_path( path );
347+ if (!expand)
348+ // but don't expand itself, just the path
349+ _tree.collapse_row(path);
350
351 Glib::RefPtr<Gtk::TreeSelection> select = _tree.get_selection();
352
353 select->select(iter);
354 if (scrollto) {
355 //Scroll to the item in the tree
356- _tree.scroll_to_row(path);
357+ _tree.scroll_to_row(path, 0.5);
358 }
359
360 stopGoing = true;
361@@ -591,6 +604,7 @@
362 if ( _desktop && _desktop->currentRoot() ) {
363 //block connections for selection and compositing values to prevent interference
364 _selectionChangedConnection.block();
365+ _documentChangedCurrentLayer.block();
366
367 //Clear the selection and then iterate over the tree selection, pushing each item to the desktop
368 _desktop->selection->clear();
369@@ -598,6 +612,7 @@
370 _tree.get_selection()->selected_foreach_iter( sigc::bind<bool *>(sigc::mem_fun(*this, &ObjectsPanel::_selected_row_callback), &setOpacity));
371 //unblock connections
372 _selectionChangedConnection.unblock();
373+ _documentChangedCurrentLayer.unblock();
374
375 _checkTreeSelection();
376 }
377@@ -696,53 +711,63 @@
378 */
379 bool ObjectsPanel::_handleKeyEvent(GdkEventKey *event)
380 {
381-
382+ if (!_desktop)
383+ return false;
384+
385+ unsigned int shortcut;
386+ shortcut = Inkscape::UI::Tools::get_group0_keyval(event) |
387+ ( event->state & GDK_SHIFT_MASK ?
388+ SP_SHORTCUT_SHIFT_MASK : 0 ) |
389+ ( event->state & GDK_CONTROL_MASK ?
390+ SP_SHORTCUT_CONTROL_MASK : 0 ) |
391+ ( event->state & GDK_MOD1_MASK ?
392+ SP_SHORTCUT_ALT_MASK : 0 );
393+
394+ switch (shortcut) {
395+ // how to get users key binding for the action “start-interactive-search” ??
396+ // ctrl+f is just the default
397+ case GDK_KEY_f | SP_SHORTCUT_CONTROL_MASK:
398+ return false;
399+ break;
400+ // shall we slurp ctrl+w to close panel?
401+
402+ // defocus:
403+ case GDK_KEY_Escape:
404+ if (_desktop->canvas) {
405+ gtk_widget_grab_focus (GTK_WIDGET(_desktop->canvas));
406+ return true;
407+ }
408+ break;
409+ }
410+
411+ // invoke user defined shortcuts first
412+ bool done = sp_shortcut_invoke(shortcut, _desktop);
413+ if (done)
414+ return true;
415+
416+ // handle events for the treeview
417 bool empty = _desktop->selection->isEmpty();
418
419 switch (Inkscape::UI::Tools::get_group0_keyval(event)) {
420 case GDK_KEY_Return:
421 case GDK_KEY_KP_Enter:
422- case GDK_KEY_F2:
423 {
424- Gtk::TreeModel::iterator iter = _tree.get_selection()->get_selected();
425- if (iter && !_text_renderer->property_editable()) {
426+ Gtk::TreeModel::Path path;
427+ Gtk::TreeViewColumn *focus_column = 0;
428+
429+ _tree.get_cursor(path, focus_column);
430+ if (focus_column == _name_column && !_text_renderer->property_editable()) {
431 //Rename item
432- Gtk::TreeModel::Path *path = new Gtk::TreeModel::Path(iter);
433 _text_renderer->property_editable() = true;
434- _tree.set_cursor(*path, *_name_column, true);
435+ _tree.set_cursor(path, *_name_column, true);
436 grab_focus();
437 return true;
438 }
439- }
440- break;
441- case GDK_KEY_Home:
442- //Move item(s) to top of containing group/layer
443- _fireAction( empty ? SP_VERB_LAYER_TO_TOP : SP_VERB_SELECTION_TO_FRONT );
444- break;
445- case GDK_KEY_End:
446- //Move item(s) to bottom of containing group/layer
447- _fireAction( empty ? SP_VERB_LAYER_TO_BOTTOM : SP_VERB_SELECTION_TO_BACK );
448- break;
449- case GDK_KEY_Page_Up:
450- {
451- //Move item(s) up in containing group/layer
452- int ch = event->state & GDK_SHIFT_MASK ? SP_VERB_LAYER_MOVE_TO_NEXT : SP_VERB_SELECTION_RAISE;
453- _fireAction( empty ? SP_VERB_LAYER_RAISE : ch );
454- break;
455- }
456- case GDK_KEY_Page_Down:
457- {
458- //Move item(s) down in containing group/layer
459- int ch = event->state & GDK_SHIFT_MASK ? SP_VERB_LAYER_MOVE_TO_PREV : SP_VERB_SELECTION_LOWER;
460- _fireAction( empty ? SP_VERB_LAYER_LOWER : ch );
461- break;
462- }
463-
464- //TODO: Handle Ctrl-A, etc.
465- default:
466 return false;
467+ break;
468+ }
469 }
470- return true;
471+ return false;
472 }
473
474 /**
475@@ -1186,7 +1211,7 @@
476 }
477 else
478 {
479- _fireAction( SP_VERB_SELECTION_RAISE );
480+ _fireAction( SP_VERB_SELECTION_STACK_UP );
481 }
482 }
483 break;
484@@ -1198,7 +1223,7 @@
485 }
486 else
487 {
488- _fireAction( SP_VERB_SELECTION_LOWER );
489+ _fireAction( SP_VERB_SELECTION_STACK_DOWN );
490 }
491 }
492 break;
493@@ -1746,6 +1771,8 @@
494 //Set the expander and search columns
495 _tree.set_expander_column( *_tree.get_column(nameColNum) );
496 _tree.set_search_column(_model->_colLabel);
497+ // use ctrl+f to start search
498+ _tree.set_enable_search(false);
499
500 //Set up the tree selection
501 _tree.get_selection()->set_mode(Gtk::SELECTION_MULTIPLE);
502@@ -1914,8 +1941,8 @@
503
504 _popupMenu.append(*Gtk::manage(new Gtk::SeparatorMenuItem()));
505
506- _watchingNonTop.push_back( &_addPopupItem( targetDesktop, SP_VERB_SELECTION_RAISE, "gtk-go-up", _("Up"), (int)BUTTON_UP ) );
507- _watchingNonBottom.push_back( &_addPopupItem( targetDesktop, SP_VERB_SELECTION_LOWER, "gtk-go-down", _("Down"), (int)BUTTON_DOWN ) );
508+ _watchingNonTop.push_back( &_addPopupItem( targetDesktop, SP_VERB_SELECTION_STACK_UP, "gtk-go-up", _("Up"), (int)BUTTON_UP ) );
509+ _watchingNonBottom.push_back( &_addPopupItem( targetDesktop, SP_VERB_SELECTION_STACK_DOWN, "gtk-go-down", _("Down"), (int)BUTTON_DOWN ) );
510
511 _popupMenu.append(*Gtk::manage(new Gtk::SeparatorMenuItem()));
512
513@@ -2054,6 +2081,7 @@
514
515 if ( desktop != _desktop ) {
516 _documentChangedConnection.disconnect();
517+ _documentChangedCurrentLayer.disconnect();
518 _selectionChangedConnection.disconnect();
519 if ( _desktop ) {
520 _desktop = 0;
521@@ -2063,6 +2091,9 @@
522 if ( _desktop ) {
523 //Connect desktop signals
524 _documentChangedConnection = _desktop->connectDocumentReplaced( sigc::mem_fun(*this, &ObjectsPanel::setDocument));
525+
526+ _documentChangedCurrentLayer = _desktop->connectCurrentLayerChanged( sigc::mem_fun(*this, &ObjectsPanel::_objectsChanged));
527+
528 _selectionChangedConnection = _desktop->selection->connectChanged( sigc::mem_fun(*this, &ObjectsPanel::_objectsSelected));
529
530 setDocument(_desktop, _desktop->doc());
531
532=== modified file 'src/ui/dialog/objects.h'
533--- src/ui/dialog/objects.h 2015-06-18 09:36:24 +0000
534+++ src/ui/dialog/objects.h 2017-05-17 23:30:53 +0000
535@@ -77,6 +77,9 @@
536 //Connection for when the document changes
537 sigc::connection _documentChangedConnection;
538
539+ //Connection for when the active layer changes
540+ sigc::connection _documentChangedCurrentLayer;
541+
542 //Connection for when the active selection in the document changes
543 sigc::connection _selectionChangedConnection;
544
545@@ -226,7 +229,7 @@
546 bool _checkForUpdated(const Gtk::TreeIter& iter, SPObject* obj);
547
548 void _objectsSelected(Selection *sel);
549- bool _checkForSelected(const Gtk::TreePath& path, const Gtk::TreeIter& iter, SPItem* item, bool scrollto);
550+ bool _checkForSelected(const Gtk::TreePath& path, const Gtk::TreeIter& iter, SPItem* item, bool scrollto, bool expand);
551
552 void _objectsChanged(SPObject *obj);
553 void _addObject( SPObject* obj, Gtk::TreeModel::Row* parentRow );
554
555=== modified file 'src/ui/widget/clipmaskicon.cpp'
556--- src/ui/widget/clipmaskicon.cpp 2015-04-27 23:38:31 +0000
557+++ src/ui/widget/clipmaskicon.cpp 2017-05-17 23:30:53 +0000
558@@ -27,13 +27,13 @@
559 ClipMaskIcon::ClipMaskIcon() :
560 Glib::ObjectBase(typeid(ClipMaskIcon)),
561 Gtk::CellRendererPixbuf(),
562- _pixClipName(INKSCAPE_ICON("path-intersection")),
563- _pixInverseName(INKSCAPE_ICON("path-difference")),
564- _pixMaskName(INKSCAPE_ICON("mask-intersection")),
565+ _pixClipName(INKSCAPE_ICON("object-clipped")),
566+ _pixMaskName(INKSCAPE_ICON("object-masked")),
567+ _pixBothName(INKSCAPE_ICON("object-clip-mask")),
568 _property_active(*this, "active", 0),
569 _property_pixbuf_clip(*this, "pixbuf_on", Glib::RefPtr<Gdk::Pixbuf>(0)),
570- _property_pixbuf_inverse(*this, "pixbuf_on", Glib::RefPtr<Gdk::Pixbuf>(0)),
571- _property_pixbuf_mask(*this, "pixbuf_off", Glib::RefPtr<Gdk::Pixbuf>(0))
572+ _property_pixbuf_mask(*this, "pixbuf_off", Glib::RefPtr<Gdk::Pixbuf>(0)),
573+ _property_pixbuf_both(*this, "pixbuf_on", Glib::RefPtr<Gdk::Pixbuf>(0))
574 {
575
576 property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE;
577@@ -43,22 +43,22 @@
578 if (!icon_theme->has_icon(_pixClipName)) {
579 Inkscape::queueIconPrerender( INKSCAPE_ICON(_pixClipName.data()), Inkscape::ICON_SIZE_DECORATION );
580 }
581- if (!icon_theme->has_icon(_pixInverseName)) {
582- Inkscape::queueIconPrerender( INKSCAPE_ICON(_pixInverseName.data()), Inkscape::ICON_SIZE_DECORATION );
583- }
584 if (!icon_theme->has_icon(_pixMaskName)) {
585 Inkscape::queueIconPrerender( INKSCAPE_ICON(_pixMaskName.data()), Inkscape::ICON_SIZE_DECORATION );
586 }
587+ if (!icon_theme->has_icon(_pixBothName)) {
588+ Inkscape::queueIconPrerender( INKSCAPE_ICON(_pixBothName.data()), Inkscape::ICON_SIZE_DECORATION );
589+ }
590
591 if (icon_theme->has_icon(_pixClipName)) {
592 _property_pixbuf_clip = icon_theme->load_icon(_pixClipName, phys, (Gtk::IconLookupFlags)0);
593 }
594- if (icon_theme->has_icon(_pixInverseName)) {
595- _property_pixbuf_inverse = icon_theme->load_icon(_pixInverseName, phys, (Gtk::IconLookupFlags)0);
596- }
597 if (icon_theme->has_icon(_pixMaskName)) {
598 _property_pixbuf_mask = icon_theme->load_icon(_pixMaskName, phys, (Gtk::IconLookupFlags)0);
599 }
600+ if (icon_theme->has_icon(_pixBothName)) {
601+ _property_pixbuf_both = icon_theme->load_icon(_pixBothName, phys, (Gtk::IconLookupFlags)0);
602+ }
603
604 property_pixbuf() = Glib::RefPtr<Gdk::Pixbuf>(0);
605 }
606@@ -137,7 +137,7 @@
607 property_pixbuf() = _property_pixbuf_mask;
608 break;
609 case 3:
610- property_pixbuf() = _property_pixbuf_inverse;
611+ property_pixbuf() = _property_pixbuf_both;
612 break;
613 default:
614 property_pixbuf() = Glib::RefPtr<Gdk::Pixbuf>(0);
615
616=== modified file 'src/ui/widget/clipmaskicon.h'
617--- src/ui/widget/clipmaskicon.h 2014-10-08 02:22:03 +0000
618+++ src/ui/widget/clipmaskicon.h 2017-05-17 23:30:53 +0000
619@@ -71,13 +71,13 @@
620 int phys;
621
622 Glib::ustring _pixClipName;
623- Glib::ustring _pixInverseName;
624 Glib::ustring _pixMaskName;
625+ Glib::ustring _pixBothName;
626
627 Glib::Property<int> _property_active;
628 Glib::Property< Glib::RefPtr<Gdk::Pixbuf> > _property_pixbuf_clip;
629- Glib::Property< Glib::RefPtr<Gdk::Pixbuf> > _property_pixbuf_inverse;
630 Glib::Property< Glib::RefPtr<Gdk::Pixbuf> > _property_pixbuf_mask;
631+ Glib::Property< Glib::RefPtr<Gdk::Pixbuf> > _property_pixbuf_both;
632
633 };
634
635
636=== modified file 'src/verbs.cpp'
637--- src/verbs.cpp 2016-11-02 22:44:54 +0000
638+++ src/verbs.cpp 2017-05-17 23:30:53 +0000
639@@ -1144,6 +1144,12 @@
640 case SP_VERB_SELECTION_LOWER:
641 sp_selection_lower(selection, dt);
642 break;
643+ case SP_VERB_SELECTION_STACK_UP:
644+ sp_selection_stack_up(selection, dt);
645+ break;
646+ case SP_VERB_SELECTION_STACK_DOWN:
647+ sp_selection_stack_down(selection, dt);
648+ break;
649 case SP_VERB_SELECTION_GROUP:
650 sp_selection_group(selection, dt);
651 break;
652@@ -2558,6 +2564,14 @@
653 N_("Raise selection one step"), INKSCAPE_ICON("selection-raise")),
654 new SelectionVerb(SP_VERB_SELECTION_LOWER, "SelectionLower", N_("_Lower"),
655 N_("Lower selection one step"), INKSCAPE_ICON("selection-lower")),
656+
657+
658+ new SelectionVerb(SP_VERB_SELECTION_STACK_UP, "SelectionStackUp", N_("_Stack up"),
659+ N_("Stack selection one step up"), INKSCAPE_ICON("layer-lower")),
660+ new SelectionVerb(SP_VERB_SELECTION_STACK_DOWN, "SelectionStackDown", N_("_Stack down"),
661+ N_("Stack selection one step down"), INKSCAPE_ICON("layer-raise")),
662+
663+
664 new SelectionVerb(SP_VERB_SELECTION_GROUP, "SelectionGroup", N_("_Group"),
665 N_("Group selected objects"), INKSCAPE_ICON("object-group")),
666 new SelectionVerb(SP_VERB_SELECTION_UNGROUP, "SelectionUnGroup", N_("_Ungroup"),
667
668=== modified file 'src/verbs.h'
669--- src/verbs.h 2016-04-14 18:19:03 +0000
670+++ src/verbs.h 2017-05-17 23:30:53 +0000
671@@ -114,6 +114,8 @@
672 SP_VERB_SELECTION_TO_BACK,
673 SP_VERB_SELECTION_RAISE,
674 SP_VERB_SELECTION_LOWER,
675+ SP_VERB_SELECTION_STACK_UP,
676+ SP_VERB_SELECTION_STACK_DOWN,
677 SP_VERB_SELECTION_GROUP,
678 SP_VERB_SELECTION_UNGROUP,
679 SP_VERB_SELECTION_UNGROUP_POP_SELECTION,
680
681=== modified file 'src/widgets/stroke-marker-selector.cpp'
682--- src/widgets/stroke-marker-selector.cpp 2014-12-23 09:25:08 +0000
683+++ src/widgets/stroke-marker-selector.cpp 2017-05-17 23:30:53 +0000
684@@ -60,8 +60,13 @@
685 set_cell_data_func(image_renderer, sigc::mem_fun(*this, &MarkerComboBox::prepareImageRenderer));
686 gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(gobj()), MarkerComboBox::separator_cb, NULL, NULL);
687
688+ Glib::ustring no_marker("no-marker");
689+ Glib::RefPtr<Gtk::IconTheme> iconTheme = Gtk::IconTheme::get_default();
690+ if (!iconTheme->has_icon(no_marker)) {
691+ Inkscape::queueIconPrerender( INKSCAPE_ICON(no_marker.data()), Inkscape::ICON_SIZE_SMALL_TOOLBAR );
692+ }
693 empty_image = new Gtk::Image( Glib::wrap(
694- sp_pixbuf_new( Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("no-marker") ) ) );
695+ sp_pixbuf_new( Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON(no_marker.data()) ) ) );
696
697 sandbox = ink_markers_preview_doc ();
698 desktop = SP_ACTIVE_DESKTOP;
699@@ -77,6 +82,7 @@
700 MarkerComboBox::~MarkerComboBox() {
701 delete combo_id;
702 delete sandbox;
703+ delete empty_image;
704
705 if (doc) {
706 modified_connection.disconnect();
707@@ -399,7 +405,7 @@
708 gchar const *markid = repr->attribute("inkscape:stockid") ? repr->attribute("inkscape:stockid") : repr->attribute("id");
709
710 // generate preview
711- Gtk::Image *prv = create_marker_image (22, repr->attribute("id"), source, drawing, visionkey);
712+ Gtk::Image *prv = create_marker_image (24, repr->attribute("id"), source, drawing, visionkey);
713 prv->show();
714
715 // Add history before separator, others after
716@@ -430,14 +436,14 @@
717 MarkerComboBox::update_marker_image(gchar const *mname)
718 {
719 gchar *cache_name = g_strconcat(combo_id, mname, NULL);
720- Glib::ustring key = svg_preview_cache.cache_key(doc->getURI(), cache_name, 22);
721+ Glib::ustring key = svg_preview_cache.cache_key(doc->getURI(), cache_name, 24);
722 g_free (cache_name);
723 svg_preview_cache.remove_preview_from_cache(key);
724
725 Inkscape::Drawing drawing;
726 unsigned const visionkey = SPItem::display_key_new(1);
727 drawing.setRoot(sandbox->getRoot()->invoke_show(drawing, visionkey, SP_ITEM_SHOW_DISPLAY));
728- Gtk::Image *prv = create_marker_image(22, mname, doc, drawing, visionkey);
729+ Gtk::Image *prv = create_marker_image(24, mname, doc, drawing, visionkey);
730 if (prv) {
731 prv->show();
732 }

Subscribers

People subscribed via source and target branches