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
1=== modified file 'src/extension/internal/bluredge.cpp'
2--- src/extension/internal/bluredge.cpp 2013-07-01 20:04:32 +0000
3+++ src/extension/internal/bluredge.cpp 2013-08-12 15:49:10 +0000
4@@ -94,7 +94,7 @@
5
6 new_group->appendChild(new_items[i]);
7 selection->add(new_items[i]);
8- sp_selected_path_to_curves(static_cast<SPDesktop *>(desktop));
9+ sp_selected_path_to_curves(selection, static_cast<SPDesktop *>(desktop));
10
11 if (offset < 0.0) {
12 /* Doing an inset here folks */
13
14=== modified file 'src/path-chemistry.cpp'
15--- src/path-chemistry.cpp 2013-05-01 05:46:14 +0000
16+++ src/path-chemistry.cpp 2013-08-12 15:49:10 +0000
17@@ -294,18 +294,16 @@
18
19 /* This function is an entry point from GUI */
20 void
21-sp_selected_path_to_curves(SPDesktop *desktop, bool interactive)
22+sp_selected_path_to_curves(Inkscape::Selection *selection, SPDesktop *desktop, bool interactive)
23 {
24- Inkscape::Selection *selection = sp_desktop_selection(desktop);
25-
26 if (selection->isEmpty()) {
27- if (interactive)
28+ if (interactive && desktop)
29 sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to convert to path."));
30 return;
31 }
32
33 bool did = false;
34- if (interactive) {
35+ if (interactive && desktop) {
36 desktop->messageStack()->flash(Inkscape::IMMEDIATE_MESSAGE, _("Converting objects to paths..."));
37 // set "busy" cursor
38 desktop->setWaitingCursor();
39@@ -324,7 +322,7 @@
40 g_slist_free (to_select);
41 g_slist_free (selected);
42
43- if (interactive) {
44+ if (interactive && desktop) {
45 desktop->clearWaitingCursor();
46 if (did) {
47 DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_OBJECT_TO_CURVE,
48
49=== modified file 'src/path-chemistry.h'
50--- src/path-chemistry.h 2011-10-05 07:06:08 +0000
51+++ src/path-chemistry.h 2013-08-12 15:49:10 +0000
52@@ -19,6 +19,7 @@
53 class SPItem;
54
55 namespace Inkscape {
56+class Selection;
57 namespace XML {
58 class Node;
59 } // namespace XML
60@@ -26,7 +27,8 @@
61
62 void sp_selected_path_combine (SPDesktop *desktop);
63 void sp_selected_path_break_apart (SPDesktop *desktop);
64-void sp_selected_path_to_curves (SPDesktop *desktop, bool interactive = true);
65+// interactive=true only has an effect if desktop != NULL, i.e. if a GUI is available
66+void sp_selected_path_to_curves (Inkscape::Selection *selection, SPDesktop *desktop, bool interactive = true);
67 void sp_selected_to_lpeitems(SPDesktop *desktop);
68 Inkscape::XML::Node *sp_selected_item_to_curved_repr(SPItem *item, guint32 text_grouping_policy);
69 void sp_selected_path_reverse (SPDesktop *desktop);
70
71=== modified file 'src/ui/dialog/livepatheffect-editor.cpp'
72--- src/ui/dialog/livepatheffect-editor.cpp 2013-08-03 21:09:02 +0000
73+++ src/ui/dialog/livepatheffect-editor.cpp 2013-08-12 15:49:10 +0000
74@@ -416,7 +416,7 @@
75
76 // If item is a SPRect, convert it to path first:
77 if ( SP_IS_RECT(item) ) {
78- sp_selected_path_to_curves(current_desktop, false);
79+ sp_selected_path_to_curves(sel, current_desktop, false);
80 item = sel->singleItem(); // get new item
81 }
82
83
84=== modified file 'src/verbs.cpp'
85--- src/verbs.cpp 2013-07-23 10:54:01 +0000
86+++ src/verbs.cpp 2013-08-12 15:49:10 +0000
87@@ -1446,13 +1446,27 @@
88 */
89 void ObjectVerb::perform( SPAction *action, void *data)
90 {
91+ SPDesktop *dt = sp_action_get_desktop(action);
92+ Inkscape::Selection *sel = sp_action_get_selection(action);
93+
94+ // We can perform some actions without a desktop
95+ bool handled = true;
96+ switch (reinterpret_cast<std::size_t>(data)) {
97+ case SP_VERB_OBJECT_TO_CURVE:
98+ sp_selected_path_to_curves(sel, dt);
99+ break;
100+ default:
101+ handled = false;
102+ break;
103+ }
104+ if (handled) {
105+ return;
106+ }
107+
108 g_return_if_fail(ensure_desktop_valid(action));
109- SPDesktop *dt = sp_action_get_desktop(action);
110
111 SPEventContext *ec = dt->event_context;
112
113- Inkscape::Selection *sel = sp_desktop_selection(dt);
114-
115 if (sel->isEmpty())
116 return;
117
118@@ -1478,9 +1492,6 @@
119 case SP_VERB_OBJECT_FLATTEN:
120 sp_selection_remove_transform(dt);
121 break;
122- case SP_VERB_OBJECT_TO_CURVE:
123- sp_selected_path_to_curves(dt);
124- break;
125 case SP_VERB_OBJECT_FLOW_TEXT:
126 text_flow_into_shape();
127 break;