diff options
| author | Felipe Corr??a da Silva Sanches <juca@members.fsf.org> | 2011-06-22 21:40:59 +0000 |
|---|---|---|
| committer | Felipe C. da S. Sanches <juca@members.fsf.org> | 2011-06-22 21:40:59 +0000 |
| commit | 1f189ac0c28ee85408431815dceefd0607b6465b (patch) | |
| tree | 51ba4c4bff3e6a29652668325ee3bfb5d89d0a20 /src | |
| parent | Translation. PO template and French translation update. (diff) | |
| download | inkscape-1f189ac0c28ee85408431815dceefd0607b6465b.tar.gz inkscape-1f189ac0c28ee85408431815dceefd0607b6465b.zip | |
Adding a "Remove All Guides" option to the Edit menu.
(bzr r10343)
Diffstat (limited to 'src')
| -rw-r--r-- | src/menus-skeleton.h | 1 | ||||
| -rw-r--r-- | src/sp-guide.cpp | 20 | ||||
| -rw-r--r-- | src/sp-guide.h | 1 | ||||
| -rw-r--r-- | src/verbs.cpp | 5 | ||||
| -rw-r--r-- | src/verbs.h | 1 |
5 files changed, 28 insertions, 0 deletions
diff --git a/src/menus-skeleton.h b/src/menus-skeleton.h index 080163d48..dccd17c59 100644 --- a/src/menus-skeleton.h +++ b/src/menus-skeleton.h @@ -83,6 +83,7 @@ static char const menus_skeleton[] = " <verb verb-id=\"EditDeselect\" />\n" " <separator/>\n" " <verb verb-id=\"EditGuidesAroundPage\" />\n" +" <verb verb-id=\"EditRemoveAllGuides\" />\n" " <separator/>\n" " <verb verb-id=\"DialogXMLEditor\" />\n" " </submenu>\n" diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp index aa365eb99..f71bc1762 100644 --- a/src/sp-guide.cpp +++ b/src/sp-guide.cpp @@ -163,6 +163,9 @@ static void sp_guide_build(SPObject *object, SPDocument *document, Inkscape::XML object->readAttr( "inkscape:label" ); object->readAttr( "orientation" ); object->readAttr( "position" ); + + /* Register */ + document->addResource("guide", object); } static void sp_guide_release(SPObject *object) @@ -174,6 +177,11 @@ static void sp_guide_release(SPObject *object) guide->views = g_slist_remove(guide->views, guide->views->data); } + if (object->document) { + // Unregister ourselves + object->document->removeResource("guide", object); + } + if (((SPObjectClass *) parent_class)->release) { ((SPObjectClass *) parent_class)->release(object); } @@ -299,6 +307,18 @@ sp_guide_create_guides_around_page(SPDesktop *dt) { DocumentUndo::done(doc, SP_VERB_NONE, _("Create Guides Around the Page")); } +void +sp_guide_delete_all_guides(SPDesktop *dt) { + SPDocument *doc=sp_desktop_document(dt); + const GSList *current; + while ( (current = doc->getResourceList("guide")) ) { + SPGuide* guide = SP_GUIDE(current->data); + sp_guide_remove(guide); + } + + DocumentUndo::done(doc, SP_VERB_NONE, _("Delete All Guides")); +} + void SPGuide::showSPGuide(SPCanvasGroup *group, GCallback handler) { SPCanvasItem *item = sp_guideline_new(group, label, point_on_line, normal_to_line); diff --git a/src/sp-guide.h b/src/sp-guide.h index 8cf9c7dc2..4fbfbed3d 100644 --- a/src/sp-guide.h +++ b/src/sp-guide.h @@ -60,6 +60,7 @@ GType sp_guide_get_type(); void sp_guide_pt_pairs_to_guides(SPDesktop *dt, std::list<std::pair<Geom::Point, Geom::Point> > &pts); void sp_guide_create_guides_around_page(SPDesktop *dt); +void sp_guide_delete_all_guides(SPDesktop *dt); void sp_guide_moveto(SPGuide &guide, Geom::Point const point_on_line, bool const commit); void sp_guide_set_normal(SPGuide &guide, Geom::Point const normal_to_line, bool const commit); diff --git a/src/verbs.cpp b/src/verbs.cpp index da2e396c7..bb22711e8 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -966,6 +966,9 @@ EditVerb::perform(SPAction *action, void *data, void */*pdata*/) case SP_VERB_EDIT_DESELECT: SelectionHelper::selectNone(dt); break; + case SP_VERB_EDIT_DELETE_ALL_GUIDES: + sp_guide_delete_all_guides(dt); + break; case SP_VERB_EDIT_GUIDES_AROUND_PAGE: sp_guide_create_guides_around_page(dt); break; @@ -2340,6 +2343,8 @@ Verb *Verb::_base_verbs[] = { N_("Deselect any selected objects or nodes"), INKSCAPE_ICON_EDIT_SELECT_NONE), new EditVerb(SP_VERB_EDIT_GUIDES_AROUND_PAGE, "EditGuidesAroundPage", N_("Create _Guides Around the Page"), N_("Create four guides aligned with the page borders"), NULL), + new EditVerb(SP_VERB_EDIT_DELETE_ALL_GUIDES, "EditRemoveAllGuides", N_("Delete All Guides"), + N_("Create four guides aligned with the page borders"), NULL), new EditVerb(SP_VERB_EDIT_NEXT_PATHEFFECT_PARAMETER, "EditNextPathEffectParameter", N_("Next path effect parameter"), N_("Show next editable path effect parameter"), INKSCAPE_ICON_PATH_EFFECT_PARAMETER_NEXT), diff --git a/src/verbs.h b/src/verbs.h index 5387b57c2..d20189cde 100644 --- a/src/verbs.h +++ b/src/verbs.h @@ -84,6 +84,7 @@ enum { SP_VERB_EDIT_SELECT_NEXT, SP_VERB_EDIT_SELECT_PREV, SP_VERB_EDIT_DESELECT, + SP_VERB_EDIT_DELETE_ALL_GUIDES, SP_VERB_EDIT_GUIDES_AROUND_PAGE, SP_VERB_EDIT_NEXT_PATHEFFECT_PARAMETER, /* Selection */ |
