diff options
| author | Marc Jeanmougin <marc@jeanmougin.fr> | 2018-05-09 13:07:03 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marc@jeanmougin.fr> | 2018-05-09 13:07:03 +0000 |
| commit | 9c6f702ebfbd401e7d4119b6d6b434783cf4c5b4 (patch) | |
| tree | 97ef62fc5823e6d784bc9259f889ad11c0e659f0 /src/ui/dialog/document-properties.cpp | |
| parent | Create stateless alignment selector and use it instead (diff) | |
| parent | Guides created after "lock all guides" selected should be locked (diff) | |
| download | inkscape-9c6f702ebfbd401e7d4119b6d6b434783cf4c5b4.tar.gz inkscape-9c6f702ebfbd401e7d4119b6d6b434783cf4c5b4.zip | |
Merge branch 'guidespanel' of gitlab.com:darktrojan/inkscape
Diffstat (limited to 'src/ui/dialog/document-properties.cpp')
| -rw-r--r-- | src/ui/dialog/document-properties.cpp | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 433638f30..8d794e4e7 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -26,6 +26,7 @@ #include "document-properties.h" #include "rdf.h" #include "verbs.h" +#include "helper/action.h" #include "io/sys.h" @@ -112,8 +113,11 @@ DocumentProperties::DocumentProperties() //--------------------------------------------------------------- //General snap options _rcb_sgui(_("Show _guides"), _("Show or hide guides"), "showguides", _wr), + _rcb_lgui(_("Lock all guides"), _("Toggle lock of all guides in the document"), "inkscape:lockguides", _wr), _rcp_gui(_("Guide co_lor:"), _("Guideline color"), _("Color of guidelines"), "guidecolor", "guideopacity", _wr), _rcp_hgui(_("_Highlight color:"), _("Highlighted guideline color"), _("Color of a guideline when it is under mouse"), "guidehicolor", "guidehiopacity", _wr), + _create_guides_btn(_("Create guides around the page")), + _delete_guides_btn(_("Delete all guides")), //--------------------------------------------------------------- _rsu_sno(_("Snap _distance"), _("Snap only when _closer than:"), _("Always snap"), _("Snapping distance, in screen pixels, for snapping to objects"), _("Always snap to objects, regardless of their distance"), @@ -359,11 +363,17 @@ void DocumentProperties::build_guides() { label_gui, 0, 0, &_rcb_sgui, + 0, &_rcb_lgui, 0, &_rcp_gui, - 0, &_rcp_hgui + 0, &_rcp_hgui, + 0, &_create_guides_btn, + 0, &_delete_guides_btn }; attach_all(_page_guides->table(), widget_array, G_N_ELEMENTS(widget_array)); + + _create_guides_btn.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::create_guides_around_page)); + _delete_guides_btn.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::delete_all_guides)); } void DocumentProperties::build_snap() @@ -462,6 +472,30 @@ static void sanitizeName( Glib::ustring& str ) } } +void DocumentProperties::create_guides_around_page() +{ + SPDesktop *dt = getDesktop(); + Verb *verb = Verb::get( SP_VERB_EDIT_GUIDES_AROUND_PAGE ); + if (verb) { + SPAction *action = verb->get_action(Inkscape::ActionContext(dt)); + if (action) { + sp_action_perform(action, NULL); + } + } +} + +void DocumentProperties::delete_all_guides() +{ + SPDesktop *dt = getDesktop(); + Verb *verb = Verb::get( SP_VERB_EDIT_DELETE_ALL_GUIDES ); + if (verb) { + SPAction *action = verb->get_action(Inkscape::ActionContext(dt)); + if (action) { + sp_action_perform(action, NULL); + } + } +} + /// Links the selected color profile in the combo box to the document void DocumentProperties::linkSelectedProfile() { @@ -1434,6 +1468,7 @@ void DocumentProperties::update() //-----------------------------------------------------------guide page _rcb_sgui.setActive (nv->showguides); + _rcb_lgui.setActive (nv->lockguides); _rcp_gui.setRgba32 (nv->guidecolor); _rcp_hgui.setRgba32 (nv->guidehicolor); |
