summaryrefslogtreecommitdiffstats
path: root/src/selection-chemistry.cpp
diff options
context:
space:
mode:
authorMaximilian Albert <maximilian.albert@gmail.com>2008-01-11 19:01:50 +0000
committercilix42 <cilix42@users.sourceforge.net>2008-01-11 19:01:50 +0000
commit0e82b86bbfd6d5656431edbf20fa8b6f79515a04 (patch)
treee9c728ab9079678cf526dc228800767a2f16c5f6 /src/selection-chemistry.cpp
parentCheck for perspective in document defs (to avoid hanging/crashes after vacuum... (diff)
downloadinkscape-0e82b86bbfd6d5656431edbf20fa8b6f79515a04.tar.gz
inkscape-0e82b86bbfd6d5656431edbf20fa8b6f79515a04.zip
Add possibility to convert objects (only rectangles and 3D boxes currently) to guidelines. Also see corresponding post on the mailing list; in particular, feel free to revert it if this is inappropriate during Frost phase.
(bzr r4462)
Diffstat (limited to 'src/selection-chemistry.cpp')
-rw-r--r--src/selection-chemistry.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index 56ef7b01f..fc2a6a271 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -72,12 +72,14 @@
#include <map>
#include "helper/units.h"
#include "sp-item.h"
+#include "box3d.h"
#include "unit-constants.h"
#include "xml/simple-document.h"
#include "sp-filter-reference.h"
#include "gradient-drag.h"
#include "uri-references.h"
#include "live_effects/lpeobject.h"
+#include "sp-rect.h"
using NR::X;
using NR::Y;
@@ -2440,6 +2442,39 @@ void sp_selection_to_marker(bool apply)
_("Objects to marker"));
}
+void sp_selection_to_guides()
+{
+ SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+ if (desktop == NULL)
+ return;
+
+ SPDocument *doc = sp_desktop_document(desktop);
+ Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ // we need to copy the list because it gets reset when objects are deleted
+ GSList *items = g_slist_copy((GSList *) selection->itemList());
+
+ bool performed = false;
+ for (GSList const *i = items; i != NULL; i = i->next) {
+ if (SP_IS_RECT(i->data)) {
+ sp_rect_convert_to_guides(SP_RECT(i->data), false);
+ performed = true;
+ } else if (SP_IS_BOX3D(i->data)) {
+ box3d_convert_to_guides(SP_BOX3D(i->data), false);
+ performed = true;
+ }
+ }
+
+ if (!performed) {
+ desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to convert to guides (selection must contain at least one rectangle or 3D box)."));
+ return;
+ }
+
+ if (performed) {
+ sp_document_done (doc, SP_VERB_EDIT_SELECTION_2_GUIDES,
+ _("Objects to guides"));
+ }
+}
+
void
sp_selection_tile(bool apply)
{