diff options
| author | Geoff Lankow <geoff@darktrojan.net> | 2018-05-04 04:05:50 +0000 |
|---|---|---|
| committer | Geoff Lankow <geoff@darktrojan.net> | 2018-05-04 04:29:07 +0000 |
| commit | 77fc334fc39f4bb390990be4927a8b18588cf594 (patch) | |
| tree | 3715b4f1b1a5aa8c9cff56cc33fce70af763c45c /src/ui | |
| parent | Merge branch 'master' of gitlab.com:gadic/inkscape (diff) | |
| download | inkscape-77fc334fc39f4bb390990be4927a8b18588cf594.tar.gz inkscape-77fc334fc39f4bb390990be4927a8b18588cf594.zip | |
Add global guide controls to guides panel
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/dialog/document-properties.cpp | 37 | ||||
| -rw-r--r-- | src/ui/dialog/document-properties.h | 6 | ||||
| -rw-r--r-- | src/ui/view/edit-widget-interface.h | 3 |
3 files changed, 42 insertions, 4 deletions
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index aae9ce867..9e16f4d6d 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"), @@ -363,11 +367,17 @@ void DocumentProperties::build_guides() { label_gui, 0, 0, &_rcb_sgui, + 0, &_rcb_lgui, _rcp_gui._label, &_rcp_gui, - _rcp_hgui._label, &_rcp_hgui + _rcp_hgui._label, &_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() @@ -466,6 +476,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() { @@ -1438,6 +1472,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); diff --git a/src/ui/dialog/document-properties.h b/src/ui/dialog/document-properties.h index fe0e1864e..06db64782 100644 --- a/src/ui/dialog/document-properties.h +++ b/src/ui/dialog/document-properties.h @@ -58,6 +58,9 @@ protected: void build_guides(); void build_snap(); void build_gridspage(); + + void create_guides_around_page(); + void delete_all_guides(); #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) void build_cms(); #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) @@ -132,8 +135,11 @@ protected: UI::Widget::PageSizer _page_sizer; //--------------------------------------------------------------- UI::Widget::RegisteredCheckButton _rcb_sgui; + UI::Widget::RegisteredCheckButton _rcb_lgui; UI::Widget::RegisteredColorPicker _rcp_gui; UI::Widget::RegisteredColorPicker _rcp_hgui; + Gtk::Button _create_guides_btn; + Gtk::Button _delete_guides_btn; //--------------------------------------------------------------- UI::Widget::ToleranceSlider _rsu_sno; UI::Widget::ToleranceSlider _rsu_sn; diff --git a/src/ui/view/edit-widget-interface.h b/src/ui/view/edit-widget-interface.h index c93b1f0ee..a8f68518f 100644 --- a/src/ui/view/edit-widget-interface.h +++ b/src/ui/view/edit-widget-interface.h @@ -116,9 +116,6 @@ struct EditWidgetInterface /// Toggle CMS on/off and set preference value accordingly virtual void toggleColorProfAdjust() = 0; - /// Toggle lock guides on/off and set namedview value accordingly - virtual void toggleGuidesLock() = 0; - /// Is CMS on/off virtual bool colorProfAdjustEnabled() = 0; |
