diff options
| author | Martin Owens <doctormo@gmail.com> | 2013-08-12 17:14:38 +0000 |
|---|---|---|
| committer | Martin Owens <doctormo@gmail.com> | 2013-08-12 17:14:38 +0000 |
| commit | 870b75d81c82e7eea57134e9e4cd35734d443da2 (patch) | |
| tree | 32fadd87a5507b108c457db4da40d963c5c7b7e4 /src | |
| parent | Packaging. Hebrew translation by Yaron Shahrabani. (diff) | |
| parent | Allow Object to Path verb from non-GUI (DBus) interface (diff) | |
| download | inkscape-870b75d81c82e7eea57134e9e4cd35734d443da2.tar.gz inkscape-870b75d81c82e7eea57134e9e4cd35734d443da2.zip | |
Merge in object-to-path enabler dbus command
(bzr r12474)
Diffstat (limited to 'src')
| -rw-r--r-- | src/extension/internal/bluredge.cpp | 2 | ||||
| -rw-r--r-- | src/path-chemistry.cpp | 10 | ||||
| -rw-r--r-- | src/path-chemistry.h | 4 | ||||
| -rw-r--r-- | src/ui/dialog/livepatheffect-editor.cpp | 2 | ||||
| -rw-r--r-- | src/verbs.cpp | 23 |
5 files changed, 26 insertions, 15 deletions
diff --git a/src/extension/internal/bluredge.cpp b/src/extension/internal/bluredge.cpp index a3d2fd6e5..3ce537d9f 100644 --- a/src/extension/internal/bluredge.cpp +++ b/src/extension/internal/bluredge.cpp @@ -94,7 +94,7 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View new_group->appendChild(new_items[i]); selection->add(new_items[i]); - sp_selected_path_to_curves(static_cast<SPDesktop *>(desktop)); + sp_selected_path_to_curves(selection, static_cast<SPDesktop *>(desktop)); if (offset < 0.0) { /* Doing an inset here folks */ diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index b192904ce..e1924664b 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -294,18 +294,16 @@ sp_selected_path_break_apart(SPDesktop *desktop) /* This function is an entry point from GUI */ void -sp_selected_path_to_curves(SPDesktop *desktop, bool interactive) +sp_selected_path_to_curves(Inkscape::Selection *selection, SPDesktop *desktop, bool interactive) { - Inkscape::Selection *selection = sp_desktop_selection(desktop); - if (selection->isEmpty()) { - if (interactive) + if (interactive && desktop) sp_desktop_message_stack(desktop)->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to convert to path.")); return; } bool did = false; - if (interactive) { + if (interactive && desktop) { desktop->messageStack()->flash(Inkscape::IMMEDIATE_MESSAGE, _("Converting objects to paths...")); // set "busy" cursor desktop->setWaitingCursor(); @@ -324,7 +322,7 @@ sp_selected_path_to_curves(SPDesktop *desktop, bool interactive) g_slist_free (to_select); g_slist_free (selected); - if (interactive) { + if (interactive && desktop) { desktop->clearWaitingCursor(); if (did) { DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_OBJECT_TO_CURVE, diff --git a/src/path-chemistry.h b/src/path-chemistry.h index b88b84087..efc687b44 100644 --- a/src/path-chemistry.h +++ b/src/path-chemistry.h @@ -19,6 +19,7 @@ class SPDesktop; class SPItem; namespace Inkscape { +class Selection; namespace XML { class Node; } // namespace XML @@ -26,7 +27,8 @@ class Node; void sp_selected_path_combine (SPDesktop *desktop); void sp_selected_path_break_apart (SPDesktop *desktop); -void sp_selected_path_to_curves (SPDesktop *desktop, bool interactive = true); +// interactive=true only has an effect if desktop != NULL, i.e. if a GUI is available +void sp_selected_path_to_curves (Inkscape::Selection *selection, SPDesktop *desktop, bool interactive = true); void sp_selected_to_lpeitems(SPDesktop *desktop); Inkscape::XML::Node *sp_selected_item_to_curved_repr(SPItem *item, guint32 text_grouping_policy); void sp_selected_path_reverse (SPDesktop *desktop); diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index 6c6f3a582..6dc9c1ee3 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -416,7 +416,7 @@ LivePathEffectEditor::onAdd() // If item is a SPRect, convert it to path first: if ( SP_IS_RECT(item) ) { - sp_selected_path_to_curves(current_desktop, false); + sp_selected_path_to_curves(sel, current_desktop, false); item = sel->singleItem(); // get new item } diff --git a/src/verbs.cpp b/src/verbs.cpp index 06e59be38..baac07d60 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -1446,12 +1446,26 @@ void LayerVerb::perform(SPAction *action, void *data) */ void ObjectVerb::perform( SPAction *action, void *data) { - g_return_if_fail(ensure_desktop_valid(action)); SPDesktop *dt = sp_action_get_desktop(action); + Inkscape::Selection *sel = sp_action_get_selection(action); - SPEventContext *ec = dt->event_context; + // We can perform some actions without a desktop + bool handled = true; + switch (reinterpret_cast<std::size_t>(data)) { + case SP_VERB_OBJECT_TO_CURVE: + sp_selected_path_to_curves(sel, dt); + break; + default: + handled = false; + break; + } + if (handled) { + return; + } - Inkscape::Selection *sel = sp_desktop_selection(dt); + g_return_if_fail(ensure_desktop_valid(action)); + + SPEventContext *ec = dt->event_context; if (sel->isEmpty()) return; @@ -1478,9 +1492,6 @@ void ObjectVerb::perform( SPAction *action, void *data) case SP_VERB_OBJECT_FLATTEN: sp_selection_remove_transform(dt); break; - case SP_VERB_OBJECT_TO_CURVE: - sp_selected_path_to_curves(dt); - break; case SP_VERB_OBJECT_FLOW_TEXT: text_flow_into_shape(); break; |
