Merge lp:~7-eric/inkscape/dbus-verbs into lp:~inkscape.dev/inkscape/trunk

Proposed by Eric Greveson
Status: Merged
Merged at revision: 12474
Proposed branch: lp:~7-eric/inkscape/dbus-verbs
Merge into: lp:~inkscape.dev/inkscape/trunk
Diff against target: 127 lines (+26/-15)
5 files modified
src/extension/internal/bluredge.cpp (+1/-1)
src/path-chemistry.cpp (+4/-6)
src/path-chemistry.h (+3/-1)
src/ui/dialog/livepatheffect-editor.cpp (+1/-1)
src/verbs.cpp (+17/-6)
To merge this branch: bzr merge lp:~7-eric/inkscape/dbus-verbs
Reviewer Review Type Date Requested Status
Martin Owens code review Approve
Review via email: mp+179736@code.launchpad.net

Description of the change

Allow Object to Path verb from DBus interface in console mode

To post a comment you must log in.
Revision history for this message
Martin Owens (doctormo) wrote :

Merging now, looks good and fairly simple.

review: Approve (code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/extension/internal/bluredge.cpp'
--- src/extension/internal/bluredge.cpp 2013-07-01 20:04:32 +0000
+++ src/extension/internal/bluredge.cpp 2013-08-12 15:49:10 +0000
@@ -94,7 +94,7 @@
9494
95 new_group->appendChild(new_items[i]);95 new_group->appendChild(new_items[i]);
96 selection->add(new_items[i]);96 selection->add(new_items[i]);
97 sp_selected_path_to_curves(static_cast<SPDesktop *>(desktop));97 sp_selected_path_to_curves(selection, static_cast<SPDesktop *>(desktop));
9898
99 if (offset < 0.0) {99 if (offset < 0.0) {
100 /* Doing an inset here folks */100 /* Doing an inset here folks */
101101
=== modified file 'src/path-chemistry.cpp'
--- src/path-chemistry.cpp 2013-05-01 05:46:14 +0000
+++ src/path-chemistry.cpp 2013-08-12 15:49:10 +0000
@@ -294,18 +294,16 @@
294294
295/* This function is an entry point from GUI */295/* This function is an entry point from GUI */
296void296void
297sp_selected_path_to_curves(SPDesktop *desktop, bool interactive)297sp_selected_path_to_curves(Inkscape::Selection *selection, SPDesktop *desktop, bool interactive)
298{298{
299 Inkscape::Selection *selection = sp_desktop_selection(desktop);
300
301 if (selection->isEmpty()) {299 if (selection->isEmpty()) {
302 if (interactive)300 if (interactive && desktop)
303 sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to convert to path."));301 sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to convert to path."));
304 return;302 return;
305 }303 }
306304
307 bool did = false;305 bool did = false;
308 if (interactive) {306 if (interactive && desktop) {
309 desktop->messageStack()->flash(Inkscape::IMMEDIATE_MESSAGE, _("Converting objects to paths..."));307 desktop->messageStack()->flash(Inkscape::IMMEDIATE_MESSAGE, _("Converting objects to paths..."));
310 // set "busy" cursor308 // set "busy" cursor
311 desktop->setWaitingCursor();309 desktop->setWaitingCursor();
@@ -324,7 +322,7 @@
324 g_slist_free (to_select);322 g_slist_free (to_select);
325 g_slist_free (selected);323 g_slist_free (selected);
326324
327 if (interactive) {325 if (interactive && desktop) {
328 desktop->clearWaitingCursor();326 desktop->clearWaitingCursor();
329 if (did) {327 if (did) {
330 DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_OBJECT_TO_CURVE, 328 DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_OBJECT_TO_CURVE,
331329
=== modified file 'src/path-chemistry.h'
--- src/path-chemistry.h 2011-10-05 07:06:08 +0000
+++ src/path-chemistry.h 2013-08-12 15:49:10 +0000
@@ -19,6 +19,7 @@
19class SPItem;19class SPItem;
2020
21namespace Inkscape {21namespace Inkscape {
22class Selection;
22namespace XML {23namespace XML {
23class Node;24class Node;
24} // namespace XML25} // namespace XML
@@ -26,7 +27,8 @@
2627
27void sp_selected_path_combine (SPDesktop *desktop);28void sp_selected_path_combine (SPDesktop *desktop);
28void sp_selected_path_break_apart (SPDesktop *desktop);29void sp_selected_path_break_apart (SPDesktop *desktop);
29void sp_selected_path_to_curves (SPDesktop *desktop, bool interactive = true);30// interactive=true only has an effect if desktop != NULL, i.e. if a GUI is available
31void sp_selected_path_to_curves (Inkscape::Selection *selection, SPDesktop *desktop, bool interactive = true);
30void sp_selected_to_lpeitems(SPDesktop *desktop);32void sp_selected_to_lpeitems(SPDesktop *desktop);
31Inkscape::XML::Node *sp_selected_item_to_curved_repr(SPItem *item, guint32 text_grouping_policy);33Inkscape::XML::Node *sp_selected_item_to_curved_repr(SPItem *item, guint32 text_grouping_policy);
32void sp_selected_path_reverse (SPDesktop *desktop);34void sp_selected_path_reverse (SPDesktop *desktop);
3335
=== modified file 'src/ui/dialog/livepatheffect-editor.cpp'
--- src/ui/dialog/livepatheffect-editor.cpp 2013-08-03 21:09:02 +0000
+++ src/ui/dialog/livepatheffect-editor.cpp 2013-08-12 15:49:10 +0000
@@ -416,7 +416,7 @@
416416
417 // If item is a SPRect, convert it to path first:417 // If item is a SPRect, convert it to path first:
418 if ( SP_IS_RECT(item) ) {418 if ( SP_IS_RECT(item) ) {
419 sp_selected_path_to_curves(current_desktop, false);419 sp_selected_path_to_curves(sel, current_desktop, false);
420 item = sel->singleItem(); // get new item420 item = sel->singleItem(); // get new item
421 }421 }
422422
423423
=== modified file 'src/verbs.cpp'
--- src/verbs.cpp 2013-07-23 10:54:01 +0000
+++ src/verbs.cpp 2013-08-12 15:49:10 +0000
@@ -1446,13 +1446,27 @@
1446 */1446 */
1447void ObjectVerb::perform( SPAction *action, void *data)1447void ObjectVerb::perform( SPAction *action, void *data)
1448{1448{
1449 SPDesktop *dt = sp_action_get_desktop(action);
1450 Inkscape::Selection *sel = sp_action_get_selection(action);
1451
1452 // We can perform some actions without a desktop
1453 bool handled = true;
1454 switch (reinterpret_cast<std::size_t>(data)) {
1455 case SP_VERB_OBJECT_TO_CURVE:
1456 sp_selected_path_to_curves(sel, dt);
1457 break;
1458 default:
1459 handled = false;
1460 break;
1461 }
1462 if (handled) {
1463 return;
1464 }
1465
1449 g_return_if_fail(ensure_desktop_valid(action));1466 g_return_if_fail(ensure_desktop_valid(action));
1450 SPDesktop *dt = sp_action_get_desktop(action);
14511467
1452 SPEventContext *ec = dt->event_context;1468 SPEventContext *ec = dt->event_context;
14531469
1454 Inkscape::Selection *sel = sp_desktop_selection(dt);
1455
1456 if (sel->isEmpty())1470 if (sel->isEmpty())
1457 return;1471 return;
14581472
@@ -1478,9 +1492,6 @@
1478 case SP_VERB_OBJECT_FLATTEN:1492 case SP_VERB_OBJECT_FLATTEN:
1479 sp_selection_remove_transform(dt);1493 sp_selection_remove_transform(dt);
1480 break;1494 break;
1481 case SP_VERB_OBJECT_TO_CURVE:
1482 sp_selected_path_to_curves(dt);
1483 break;
1484 case SP_VERB_OBJECT_FLOW_TEXT:1495 case SP_VERB_OBJECT_FLOW_TEXT:
1485 text_flow_into_shape();1496 text_flow_into_shape();
1486 break;1497 break;