diff options
| author | Marc Jeanmougin <marc@jeanmougin.fr> | 2015-12-08 08:29:33 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marcjeanmougin@free.fr> | 2015-12-08 08:29:33 +0000 |
| commit | 5e5f10dfcca24194acdcb4b301f9e989ddc6e209 (patch) | |
| tree | 9287d4cdc6ff3281620a65091fb9a3ccd13c9b79 /src/sp-guide.cpp | |
| parent | fix crash (oops) (diff) | |
| parent | merge lp:~inkscape.dev/inkscape/lock_guides (diff) | |
| download | inkscape-5e5f10dfcca24194acdcb4b301f9e989ddc6e209.tar.gz inkscape-5e5f10dfcca24194acdcb4b301f9e989ddc6e209.zip | |
update to trunk + resolve conflicts
(bzr r14504.1.9)
Diffstat (limited to 'src/sp-guide.cpp')
| -rw-r--r-- | src/sp-guide.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp index 6038860f8..70c73b7e3 100644 --- a/src/sp-guide.cpp +++ b/src/sp-guide.cpp @@ -43,6 +43,7 @@ #include <2geom/angle.h> #include "document.h" #include "document-undo.h" +#include "helper-fns.h" #include "verbs.h" using Inkscape::DocumentUndo; @@ -51,6 +52,7 @@ using std::vector; SPGuide::SPGuide() : SPObject() , label(NULL) + , locked(0) , normal_to_line(Geom::Point(0.,1.)) , point_on_line(Geom::Point(0.,0.)) , color(0x0000ff7f) @@ -72,6 +74,7 @@ void SPGuide::build(SPDocument *document, Inkscape::XML::Node *repr) this->readAttr( "inkscape:color" ); this->readAttr( "inkscape:label" ); + this->readAttr( "inkscape:locked" ); this->readAttr( "orientation" ); this->readAttr( "position" ); @@ -112,6 +115,12 @@ void SPGuide::set(unsigned int key, const gchar *value) { this->set_label(this->label, false); break; + case SP_ATTR_INKSCAPE_LOCKED: + this->locked = helperfns_read_bool(value, false); + if (value) { + this->set_locked(this->locked, false); + } + break; case SP_ATTR_ORIENTATION: { if (value && !strcmp(value, "horizontal")) { @@ -338,6 +347,9 @@ double SPGuide::getDistanceFrom(Geom::Point const &pt) const */ void SPGuide::moveto(Geom::Point const point_on_line, bool const commit) { + if(this->locked) { + return; + } for(std::vector<SPGuideLine *>::const_iterator it = this->views.begin(); it != this->views.end(); ++it) { sp_guideline_set_position(*it, point_on_line); } @@ -384,6 +396,9 @@ void SPGuide::moveto(Geom::Point const point_on_line, bool const commit) */ void SPGuide::set_normal(Geom::Point const normal_to_line, bool const commit) { + if(this->locked) { + return; + } for(std::vector<SPGuideLine *>::const_iterator it = this->views.begin(); it != this->views.end(); ++it) { sp_guideline_set_normal(*it, normal_to_line); } @@ -422,6 +437,18 @@ void SPGuide::set_color(const unsigned r, const unsigned g, const unsigned b, bo } } +void SPGuide::set_locked(const bool locked, bool const commit) +{ + this->locked = locked; + if ( !views.empty() ) { + sp_guideline_set_locked(views[0], locked); + } + + if (commit) { + getRepr()->setAttribute("inkscape:locked", g_strdup(locked ? "true" : "false")); + } +} + void SPGuide::set_label(const char* label, bool const commit) { if (!views.empty()) { @@ -481,6 +508,7 @@ char* SPGuide::description(bool const verbose) const descr = g_strconcat(oldDescr, shortcuts, NULL); g_free(oldDescr); } + g_free(shortcuts); } |
