Code

Add buttons for snapping to grids and/or guides
authordvlierop2 <dvlierop2@users.sourceforge.net>
Wed, 28 Jan 2009 21:19:16 +0000 (21:19 +0000)
committerdvlierop2 <dvlierop2@users.sourceforge.net>
Wed, 28 Jan 2009 21:19:16 +0000 (21:19 +0000)
16 files changed:
share/icons/icons.svg
share/icons/tango_icons.svg
src/attributes-test.h
src/attributes.cpp
src/attributes.h
src/display/canvas-axonomgrid.cpp
src/display/canvas-axonomgrid.h
src/display/canvas-grid.cpp
src/guide-snapper.cpp
src/snap-preferences.cpp
src/snap-preferences.h
src/snap.cpp
src/snapper.h
src/sp-namedview.cpp
src/ui/dialog/document-properties.cpp
src/widgets/toolbox.cpp

index 10b3a6d05399e0ec946761ee3f49a0816484309d..ec05ea3925e47121aa035279d0cdd17c15828f20 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" inkscape:version="0.46+devel r20521 custom" sodipodi:docname="icons.svg" height="1000.0000pt" width="1000.0000pt" sodipodi:version="0.32" id="svg1" inkscape:output_extension="org.inkscape.output.svg.inkscape">
+<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" inkscape:version="0.46+devel r20595 custom" sodipodi:docname="icons.svg" height="1000.0000pt" width="1000.0000pt" sodipodi:version="0.32" id="svg1" inkscape:output_extension="org.inkscape.output.svg.inkscape">
 <defs id="defs3">
 <inkscape:perspective sodipodi:type="inkscape:persp3d" inkscape:vp_x="0 : 625 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_z="1250 : 625 : 1" inkscape:persp3d-origin="625 : 416.6667 : 1" id="perspective8072" />
 <linearGradient inkscape:collect="always" id="linearGradient7836">
 <inkscape:perspective id="perspective8636" inkscape:persp3d-origin="0.5 : 0.3333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d" />
 <inkscape:perspective id="perspective9457" inkscape:persp3d-origin="0.5 : 0.3333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d" />
 <inkscape:perspective id="perspective9457-2" inkscape:persp3d-origin="0.5 : 0.3333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d" />
+<inkscape:perspective id="perspective8531" inkscape:persp3d-origin="0.5 : 0.3333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d" />
+<inkscape:perspective id="perspective8531-4" inkscape:persp3d-origin="0.5 : 0.3333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d" />
 </defs>
-<sodipodi:namedview inkscape:guide-bbox="true" inkscape:current-layer="toggle_snap_to_bbox_midpoints-3" inkscape:grid-bbox="true" inkscape:pageopacity="1.0000000" pagecolor="#e8e8e4" snaptoguides="true" showguides="true" inkscape:window-y="24" inkscape:window-x="0" inkscape:window-height="1129" inkscape:window-width="1920" inkscape:cy="1204.346" inkscape:cx="805.2226" inkscape:zoom="5.492948" gridtolerance="6" snaptogrid="false" showgrid="false" id="base" inkscape:document-units="px" inkscape:grid-points="true" guidetolerance="8" fill="#8ab3de" stroke="#646464" inkscape:object-nodes="false" objecttolerance="11" inkscape:snap-bbox="true" inkscape:snap-nodes="false" inkscape:bbox-nodes="false" inkscape:bbox-paths="false" inkscape:snap-global="true" inkscape:snap-center="true" inkscape:snap-midpoints="false" inkscape:snap-intersection-paths="true" inkscape:object-paths="true" inkscape:snap-object-midpoints="false">
+<sodipodi:namedview inkscape:guide-bbox="true" inkscape:current-layer="svg1" inkscape:grid-bbox="true" inkscape:pageopacity="1.0000000" pagecolor="#e8e8e4" snaptoguides="true" showguides="true" inkscape:window-y="24" inkscape:window-x="0" inkscape:window-height="1129" inkscape:window-width="1920" inkscape:cy="824.2503" inkscape:cx="519.9243" inkscape:zoom="0.9710252" gridtolerance="6" snaptogrid="false" showgrid="false" id="base" inkscape:document-units="px" inkscape:grid-points="true" guidetolerance="8" fill="#8ab3de" stroke="#646464" inkscape:object-nodes="false" objecttolerance="11" inkscape:snap-bbox="true" inkscape:snap-nodes="false" inkscape:bbox-nodes="false" inkscape:bbox-paths="false" inkscape:snap-global="true" inkscape:snap-center="true" inkscape:snap-midpoints="false" inkscape:snap-intersection-paths="true" inkscape:object-paths="true" inkscape:snap-object-midpoints="false">
 <inkscape:grid type="xygrid" id="grid9252" originx="0px" originy="0px" spacingx="0.5px" spacingy="0.5px" empspacing="2" visible="true" enabled="true" />
 <sodipodi:guide orientation="0,1" position="630.08101,968.02815" id="guide4946" />
 <sodipodi:guide orientation="0,1" position="618.47896,943.93157" id="guide4948" />
@@ -734,7 +736,7 @@ http://www.inkscape.org/</dc:description>
 <dc:title>Inkscape Developers</dc:title>
 </cc:Agent>
 </dc:rights>
-<dc:title></dc:title>
+<dc:title />
 </cc:Work>
 <cc:License rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
 <cc:permits rdf:resource="http://web.resource.org/cc/Reproduction" />
@@ -3314,4 +3316,9 @@ http://www.inkscape.org/</dc:description>
 <path id="path9141-9-2-5-3" d="m 705.5,29.99943 0,13 -13,0" style="color:#000000;fill:none;stroke:#000000;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 2;stroke-dashoffset:2.5;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
 <path sodipodi:type="arc" style="color:#000000;fill:#6464ff;fill-opacity:0.3921569;fill-rule:evenodd;stroke:#008000;stroke-width:1.1428572;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" id="path6530-4" sodipodi:cx="753.5" sodipodi:cy="33" sodipodi:rx="2" sodipodi:ry="2" d="m 755.5,33 a 2,2 0 1 1 -4,0 2,2 0 1 1 4,0 z" transform="matrix(0.8749999,0,0,0.875,46.21002,5.147436)" />
 </g>
+<g id="guide" transform="translate(-24,0)" inkscape:label="#guide">
+<path sodipodi:nodetypes="cc" id="path5235-0" d="m 305.5,421.5 0,15" style="fill:none;stroke:#0000ff;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+<path style="fill:none;stroke:#0000ff;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" d="m 315.5,421.5 -5.0974,15" id="use5244-0" sodipodi:nodetypes="cc" />
+<use style="stroke-linecap:round" height="1250" width="1250" transform="translate(12,0)" id="use5246-9" xlink:href="#path5235-0" y="0" x="0" />
+</g>
 </svg>
index cc8827d757816c6aae60d59ede6bf88aec927997..11dc11e7cbff73f6ca80f64fcc949b7a34092fa8 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" inkscape:version="0.46+devel r20535 custom" sodipodi:docname="tango_icons.svg" height="2000" width="2000" sodipodi:version="0.32" id="svg1" inkscape:output_extension="org.inkscape.output.svg.inkscape" version="1.0" style="display:inline">
+<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" inkscape:version="0.46+devel r20595 custom" sodipodi:docname="tango_icons.svg" height="2000" width="2000" sodipodi:version="0.32" id="svg1" inkscape:output_extension="org.inkscape.output.svg.inkscape" version="1.0" style="display:inline">
 <defs id="defs3">
 <inkscape:perspective sodipodi:type="inkscape:persp3d" inkscape:vp_x="0 : 1000 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_z="2000 : 1000 : 1" inkscape:persp3d-origin="1000 : 666.6667 : 1" id="perspective15495" />
 <linearGradient id="linearGradient14411">
 <stop id="stop19969-6" offset="0" style="stop-color:#73d216" />
 <stop id="stop19971-80" offset="1.0000000" style="stop-color:#4e9a06;stop-opacity:1" />
 </linearGradient>
+<inkscape:perspective id="perspective15703" inkscape:persp3d-origin="0.5 : 0.3333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d" />
+<inkscape:perspective id="perspective15734" inkscape:persp3d-origin="0.5 : 0.3333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d" />
+<linearGradient inkscape:collect="always" xlink:href="#linearGradient11207-6" id="linearGradient16121-2" gradientUnits="userSpaceOnUse" gradientTransform="translate(0,-1)" x1="1469" y1="34.49997" x2="1482" y2="34.49997" />
+<linearGradient id="linearGradient11207-6">
+<stop style="stop-color:#d3d7cf;stop-opacity:1;" offset="0" id="stop11209-5" />
+<stop style="stop-color:#d3d7cf;stop-opacity:1;" offset="1" id="stop11211-8" />
+</linearGradient>
+<linearGradient inkscape:collect="always" xlink:href="#linearGradient11215-9" id="linearGradient16123-7" gradientUnits="userSpaceOnUse" gradientTransform="translate(0,-1)" x1="1469" y1="34.49997" x2="1482" y2="34.49997" />
+<linearGradient id="linearGradient11215-9">
+<stop style="stop-color:#888a85;stop-opacity:1;" offset="0" id="stop11217-6" />
+<stop style="stop-color:#888a85;stop-opacity:1;" offset="1" id="stop11219-0" />
+</linearGradient>
+<inkscape:perspective id="perspective15789" inkscape:persp3d-origin="0.5 : 0.3333333 : 1" inkscape:vp_z="1 : 0.5 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d" />
 </defs>
-<sodipodi:namedview inkscape:guide-bbox="true" inkscape:current-layer="layer2" inkscape:grid-bbox="true" inkscape:pageopacity="1" pagecolor="#f8f5f2" snaptoguides="true" showguides="true" inkscape:window-y="24" inkscape:window-x="0" inkscape:window-height="1129" inkscape:window-width="1920" inkscape:cy="1870.363" inkscape:cx="1474.951" inkscape:zoom="2.828427" gridtolerance="10000" snaptogrid="false" showgrid="true" id="base" inkscape:document-units="px" inkscape:grid-points="true" guidetolerance="19" fill="#8ab3de" stroke="#646464" inkscape:object-nodes="false" objecttolerance="10" inkscape:snap-bbox="true" inkscape:snap-nodes="true" showborder="false" inkscape:showpageshadow="false" inkscape:snap-center="true" inkscape:snap-intersection-grid-guide="false" inkscape:snap-guide="false" inkscape:bbox-paths="true" inkscape:bbox-nodes="true" inkscape:snap-global="true">
+<sodipodi:namedview inkscape:guide-bbox="true" inkscape:current-layer="layer5" inkscape:grid-bbox="true" inkscape:pageopacity="1" pagecolor="#f8f5f2" snaptoguides="true" showguides="true" inkscape:window-y="24" inkscape:window-x="0" inkscape:window-height="1129" inkscape:window-width="1920" inkscape:cy="1819.275" inkscape:cx="983.5815" inkscape:zoom="22.62742" gridtolerance="10000" snaptogrid="false" showgrid="false" id="base" inkscape:document-units="px" inkscape:grid-points="true" guidetolerance="19" fill="#8ab3de" stroke="#646464" inkscape:object-nodes="false" objecttolerance="10" inkscape:snap-bbox="true" inkscape:snap-nodes="true" showborder="false" inkscape:showpageshadow="false" inkscape:snap-center="false" inkscape:snap-intersection-grid-guide="false" inkscape:snap-guide="false" inkscape:bbox-paths="true" inkscape:bbox-nodes="true" inkscape:snap-global="true" inkscape:object-paths="true">
 <inkscape:grid type="xygrid" id="grid12302" empspacing="24" dotted="false" color="#009bcc" opacity="0.1254902" empcolor="#0019cc" empopacity="0.25098039" spacingx="0px" spacingy="0px" originx="0px" originy="0px" visible="true" enabled="true" />
 <inkscape:grid id="GridFromPre046Settings" type="xygrid" originx="0px" originy="0.0000000px" spacingx="0.5px" spacingy="0.5px" color="#0000ff" empcolor="#0000ff" opacity="0.2" empopacity="0.4" empspacing="2" visible="true" enabled="true" />
 </sodipodi:namedview>
@@ -2455,7 +2468,7 @@ http://www.inkscape.org/</dc:description>
 <dc:title>Inkscape Developers</dc:title>
 </cc:Agent>
 </dc:rights>
-<dc:title>Icon Sheet</dc:title>
+<dc:title></dc:title>
 <dc:contributor>
 <cc:Agent>
 <dc:title>jEsuSdA 8) www.jesusda.com</dc:title>
@@ -2722,6 +2735,19 @@ http://www.inkscape.org/</dc:description>
 <path sodipodi:nodetypes="cccccccs" id="path15326" d="M 1701.5897,203.79229 C 1699.531,203.53087 1697.8086,201.72661 1697.6494,199.65655 C 1697.4171,197.59382 1698.7683,195.49626 1700.7423,194.85453 C 1702.6929,194.14357 1705.048,194.96538 1706.1374,196.73175 C 1706.8192,197.76054 1706.9722,199.04231 1706.809,200.2446 C 1706.6337,201.44742 1707.1246,202.76916 1708.2074,203.38953 C 1709.5558,204.25428 1711.5364,203.72406 1712.2724,202.30119 C 1713.0858,200.92113 1712.4813,198.96192 1711.0317,198.28002" style="fill:none;stroke:#babdb6;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline" />
 </g>
 <text xml:space="preserve" style="font-size:14px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Zekton;-inkscape-font-specification:Zekton Bold" x="569.99994" y="342.00018" id="text16130" sodipodi:linespacing="100%"><tspan sodipodi:role="line" id="tspan16132" x="569.99994" y="342.00018" /></text>
+<g id="ink_guide" transform="translate(657,-243)" inkscape:label="#ink_guide">
+<path sodipodi:nodetypes="cc" id="path5235-0" d="m 305.5,421.5 0,15" style="fill:none;stroke:#0000ff;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+<path style="fill:none;stroke:#0000ff;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" d="m 315.5,421.5 -5.0974,15" id="use5244-0" sodipodi:nodetypes="cc" />
+<use style="stroke-linecap:round" height="1250" width="1250" transform="translate(12,0)" id="use5246-9" xlink:href="#path5235-0" y="0" x="0" />
+</g>
+<g style="display:inline" transform="translate(679.875,-243)" id="guide" inkscape:label="#guide">
+<path sodipodi:nodetypes="cc" id="path12102-2" d="m 306.25,421.75 0,15" style="fill:#204a87;stroke:#204a87;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+<path sodipodi:nodetypes="cc" id="path12106-3" d="m 314.25,421.75 -3.8891,15.0442" style="fill:#204a87;stroke:#204a87;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+<path sodipodi:nodetypes="cc" id="path12108-0" d="m 318.25,421.75 0,15" style="fill:#204a87;stroke:#204a87;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+<path style="fill:#729fcf;stroke:#729fcf;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" d="m 305.5,421.5 0,15" id="path12074-1" sodipodi:nodetypes="cc" />
+<path style="fill:#729fcf;stroke:#729fcf;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" d="m 313.5,421.5 -3.875,15" id="use12078-4" sodipodi:nodetypes="cc" />
+<path style="fill:#729fcf;stroke:#729fcf;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" d="m 317.5,421.5 0,15" id="use12080-9" sodipodi:nodetypes="cc" />
+</g>
 </g>
 <g inkscape:groupmode="layer" id="layer3" inkscape:label="inkscape" style="display:inline">
 <g transform="translate(842.60648,136.78099)" id="layer1" />
@@ -5291,7 +5317,7 @@ http://www.inkscape.org/</dc:description>
 <g transform="translate(675.5,78)" id="ink_toggle_snap_to_bbox_edge_midpoints">
 <rect style="color:#000000;fill:none;stroke:none;stroke-width:0.1;marker:none;display:inline" id="rect5385-6-4-0-8-5" width="16" height="16" x="692.5" y="30" />
 <path id="path9141-9-2-5-3" d="m 705.5,29.99943 0,13 -13,0" style="color:#000000;fill:none;stroke:#000000;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 2;stroke-dashoffset:2.5;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
-<path sodipodi:type="arc" style="color:#000000;fill:#6464ff;fill-opacity:0.3921569;fill-rule:evenodd;stroke:#008000;stroke-width:1.1428572;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" id="path6530-4" sodipodi:cx="753.5" sodipodi:cy="33" sodipodi:rx="2" sodipodi:ry="2" d="m 755.5,33 a 2,2 0 1 1 -4,0 2,2 0 1 1 4,0 z" transform="matrix(0.8749999,0,0,0.875,46.21002,5.147436)" />
+<path sodipodi:type="arc" style="color:#000000;fill:#6464ff;fill-opacity:0.3921569;fill-rule:evenodd;stroke:#008000;stroke-width:1.1428572;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" id="path6530-4" sodipodi:cx="753.5" sodipodi:cy="33" sodipodi:rx="2" sodipodi:ry="2" d="m 755.5,33 c 0,1.104 -0.896,2 -2,2 -1.104,0 -2,-0.896 -2,-2 0,-1.104 0.896,-2 2,-2 1.104,0 2,0.896 2,2 z" transform="matrix(0.8749999,0,0,0.875,46.21002,5.147436)" />
 </g>
 </g>
 <g inkscape:groupmode="layer" id="layer2" inkscape:label="tango" style="display:inline">
index 1148953ec1c386bd8933056652eccefaf234c09d..7b021a5433bc4a776e59cd9c0ea715ece4e0336a 100644 (file)
@@ -348,14 +348,16 @@ struct {char const *attr; bool supported;} const all_attrs[] = {
     {"inkscape:snap-global", true},
     {"inkscape:snap-bbox", true},
     {"inkscape:snap-nodes", true},
-    {"inkscape:snap-guide", true},
+    {"inkscape:snap-from-guide", true},
     {"inkscape:snap-center", true},
     {"inkscape:snap-smooth-nodes", true},
     {"inkscape:snap-midpoints", true},
     {"inkscape:snap-object-midpoints", true},
     {"inkscape:snap-bbox-edge-midpoints", true},
     {"inkscape:snap-bbox-midpoints", true},
-       {"inkscape:snap-intersection-grid-guide", true},
+       //{"inkscape:snap-intersection-grid-guide", true},
+       {"inkscape:snap-grids", true},
+       {"inkscape:snap-to-guides", true},
     {"inkscape:snap-intersection-paths", true},
     {"inkscape:pageopacity", true},
     {"inkscape:pageshadow", true},
index 049632e50f1b6524292971978f4122b76d6c1dec..f2fb62a1cb09215050d505fe27f23fb66a63f260 100644 (file)
@@ -89,14 +89,16 @@ static SPStyleProp const props[] = {
     {SP_ATTR_INKSCAPE_SNAP_GLOBAL, "inkscape:snap-global"},
     {SP_ATTR_INKSCAPE_SNAP_BBOX, "inkscape:snap-bbox"},
     {SP_ATTR_INKSCAPE_SNAP_NODES, "inkscape:snap-nodes"},
-    {SP_ATTR_INKSCAPE_SNAP_GUIDE, "inkscape:snap-guide"},
+    {SP_ATTR_INKSCAPE_SNAP_FROM_GUIDE, "inkscape:snap-from-guide"},
     {SP_ATTR_INKSCAPE_SNAP_CENTER, "inkscape:snap-center"},
+    {SP_ATTR_INKSCAPE_SNAP_GRIDS, "inkscape:snap-grids"},
+    {SP_ATTR_INKSCAPE_SNAP_TO_GUIDES, "inkscape:snap-to-guides"},
     {SP_ATTR_INKSCAPE_SNAP_SMOOTH_NODES, "inkscape:snap-smooth-nodes"},
     {SP_ATTR_INKSCAPE_SNAP_LINE_MIDPOINTS, "inkscape:snap-midpoints"},
     {SP_ATTR_INKSCAPE_SNAP_OBJECT_MIDPOINTS, "inkscape:snap-object-midpoints"},
     {SP_ATTR_INKSCAPE_SNAP_BBOX_EDGE_MIDPOINTS, "inkscape:snap-bbox-edge-midpoints"},
        {SP_ATTR_INKSCAPE_SNAP_BBOX_MIDPOINTS, "inkscape:snap-bbox-midpoints"},
-       {SP_ATTR_INKSCAPE_SNAP_INTERS_GRIDGUIDE, "inkscape:snap-intersection-grid-guide"},
+       //{SP_ATTR_INKSCAPE_SNAP_INTERS_GRIDGUIDE, "inkscape:snap-intersection-grid-guide"},
     {SP_ATTR_INKSCAPE_SNAP_INTERS_PATHS, "inkscape:snap-intersection-paths"},
     {SP_ATTR_INKSCAPE_OBJECT_PATHS, "inkscape:object-paths"},
     {SP_ATTR_INKSCAPE_OBJECT_NODES, "inkscape:object-nodes"},
index 6fe3ebb806bc54891dee44481b2a6dd33f3b9046..fc9e49f2b36b15796fffe763a6fe5959a4fce983 100644 (file)
@@ -89,14 +89,16 @@ enum SPAttributeEnum {
     SP_ATTR_INKSCAPE_SNAP_GLOBAL,
     SP_ATTR_INKSCAPE_SNAP_BBOX,
     SP_ATTR_INKSCAPE_SNAP_NODES,
-    SP_ATTR_INKSCAPE_SNAP_GUIDE,
+    SP_ATTR_INKSCAPE_SNAP_FROM_GUIDE,
     SP_ATTR_INKSCAPE_SNAP_CENTER,
+    SP_ATTR_INKSCAPE_SNAP_GRIDS,
+    SP_ATTR_INKSCAPE_SNAP_TO_GUIDES,
     SP_ATTR_INKSCAPE_SNAP_SMOOTH_NODES,
     SP_ATTR_INKSCAPE_SNAP_LINE_MIDPOINTS,
     SP_ATTR_INKSCAPE_SNAP_OBJECT_MIDPOINTS,
     SP_ATTR_INKSCAPE_SNAP_BBOX_EDGE_MIDPOINTS,
        SP_ATTR_INKSCAPE_SNAP_BBOX_MIDPOINTS,
-    SP_ATTR_INKSCAPE_SNAP_INTERS_GRIDGUIDE,
+    //SP_ATTR_INKSCAPE_SNAP_INTERS_GRIDGUIDE,
     SP_ATTR_INKSCAPE_SNAP_INTERS_PATHS,
     SP_ATTR_INKSCAPE_OBJECT_PATHS,
     SP_ATTR_INKSCAPE_OBJECT_NODES,
index 4b45eae339680baf17fd9c0ed72d872ca0971313..283f58a014e576b58d01e7f55fad2dfa2b28d5fb 100644 (file)
@@ -748,6 +748,10 @@ void CanvasAxonomGridSnapper::_addSnappedLine(SnappedConstraints &sc, Geom::Poin
     sc.grid_lines.push_back(dummy);
 }
 
+bool CanvasAxonomGridSnapper::ThisSnapperMightSnap() const
+{
+    return _snap_enabled && _snapmanager->snapprefs.getSnapToGrids() && _snapmanager->snapprefs.getSnapModeBBoxOrNodes();
+}
 
 
 }; // namespace Inkscape
index 0654a942947ae9e22efde24028a4eb03fbd35d71..9067e2e131720742b971229a3dc147abea2a916d 100644 (file)
@@ -71,6 +71,7 @@ class CanvasAxonomGridSnapper : public LineSnapper
 {
 public:
     CanvasAxonomGridSnapper(CanvasAxonomGrid *grid, SnapManager *sm, Geom::Coord const d);
+    bool ThisSnapperMightSnap() const;
 
 private:
     LineList _getSnapLines(Geom::Point const &p) const;
index b03bfca9e0e2385e3cbb694ca8b31744e23d1da0..0d5cabd8d0e028a9bdbbe78ed04af9ef8f8fd883 100644 (file)
@@ -999,7 +999,7 @@ void CanvasXYGridSnapper::_addSnappedLine(SnappedConstraints &sc, Geom::Point co
  */
 bool CanvasXYGridSnapper::ThisSnapperMightSnap() const
 {
-    return _snapmanager->snapprefs.getSnapModeBBoxOrNodes();
+    return _snap_enabled && _snapmanager->snapprefs.getSnapToGrids() && _snapmanager->snapprefs.getSnapModeBBoxOrNodes();
 }
 
 } // namespace Inkscape
index b05466ede6ef7ad761e66a49bea7e4e11357e0fb..54a4086a447c311b738530c10c2596a8747f380e 100644 (file)
@@ -47,7 +47,7 @@ bool Inkscape::GuideSnapper::ThisSnapperMightSnap() const
                return false;
        }
 
-       return (_snap_enabled && _snapmanager->snapprefs.getSnapModeBBoxOrNodes() && _snapmanager->getNamedView()->showguides);
+       return (_snap_enabled && _snapmanager->snapprefs.getSnapToGuides() && _snapmanager->snapprefs.getSnapModeBBoxOrNodes() && _snapmanager->getNamedView()->showguides);
 }
 
 void Inkscape::GuideSnapper::_addSnappedLine(SnappedConstraints &sc, Geom::Point const snapped_point, Geom::Coord const snapped_distance, Geom::Point const normal_to_line, Geom::Point const point_on_line) const
index d212599839334450c12656aa5d1b5d537c031ace..e8c9e06412b75e6fac0b96b19ec850e5fd7a6d9f 100644 (file)
@@ -22,6 +22,9 @@ Inkscape::SnapPreferences::PointType const Inkscape::SnapPreferences::SNAPPOINT_
 
 Inkscape::SnapPreferences::SnapPreferences() :
        _include_item_center(false),
+       _intersectionGG(true),
+       _snap_to_grids(true),
+       _snap_to_guides(true),
     _snap_enabled_globally(true),
     _snap_postponed_globally(false),
     _snap_to_itemnode(true), _snap_to_itempath(true),
index 97ef3cec210081653894a629c926bf953e0bed4c..258b1f5edecfb285a89650a16a674c2cf00bae3a 100644 (file)
@@ -51,6 +51,12 @@ public:
     bool getSnapBBoxEdgeMidpoints() const {return _bbox_edge_midpoints;}
        bool getSnapBBoxMidpoints() const {return _bbox_midpoints;}
 
+       void setSnapToGrids(bool enabled) {_snap_to_grids = enabled;}
+    bool getSnapToGrids() const {return _snap_to_grids;}
+
+    void setSnapToGuides(bool enabled) {_snap_to_guides = enabled;}
+       bool getSnapToGuides() const {return _snap_to_guides;}
+
     void setIncludeItemCenter(bool enabled) {_include_item_center = enabled;}
     bool getIncludeItemCenter() const {return _include_item_center;}
 
@@ -85,6 +91,8 @@ private:
     bool _object_midpoints; // the midpoint of shapes (e.g. a circle, rect, polygon) or of any other shape (at [h/2, w/2])
     bool _bbox_edge_midpoints;
        bool _bbox_midpoints;
+       bool _snap_to_grids;
+       bool _snap_to_guides;
     bool _snap_enabled_globally; // Toggles ALL snapping
     bool _snap_postponed_globally; // Hold all snapping temporarily when the mouse is moving fast
     PointType _snap_from; ///< bitmap of point types that we will snap from
index 04521f07fc64ad4b99cdb1ec18ecbedb0ce21a2a..548741455704b51b510b052b2d9df4a608d0dd9f 100644 (file)
@@ -77,7 +77,7 @@ SnapManager::getGridSnappers() const
     SnapperList s;
 
     //FIXME: this code should actually do this: add new grid snappers that are active for this desktop. now it just adds all gridsnappers
-    if (_desktop && _desktop->gridsEnabled()) {
+    if (_desktop && _desktop->gridsEnabled() && snapprefs.getSnapToGrids()) {
         for ( GSList const *l = _named_view->grids; l != NULL; l = l->next) {
             Inkscape::CanvasGrid *grid = (Inkscape::CanvasGrid*) l->data;
             s.push_back(grid->snapper);
index f6e1a086e8a18c301e645e435c57c673fe526328..7bea9b423ecec6b661984a0a3fee6950ecf6e98b 100644 (file)
@@ -55,7 +55,7 @@ public:
     //virtual bool ThisSnapperMightSnap() const;
     virtual bool ThisSnapperMightSnap() const {return _snap_enabled;} // will likely be overridden by derived classes
 
-    void setEnabled(bool s);
+    void setEnabled(bool s); // This is only used for grids, for which snapping can be enabled individually
     bool getEnabled() const {return _snap_enabled;}
 
     virtual void freeSnap(SnappedConstraints &/*sc*/,
@@ -108,6 +108,7 @@ protected:
        SnapManager *_snapmanager;
 
        bool _snap_enabled; ///< true if this snapper is enabled, otherwise false
+                                               // This is only used for grids, for which snapping can be enabled individually
 
 private:
        Geom::Coord _snapper_tolerance;   ///< snap tolerance in desktop coordinates
index 4ff66f6c38cf7316aefc1d7331ea98e343357a85..4bde2b191462bdb97dfa6a4bd48488d4a39305ce 100644 (file)
@@ -245,14 +245,16 @@ static void sp_namedview_build(SPObject *object, SPDocument *document, Inkscape:
     sp_object_read_attr(object, "inkscape:snap-global");
     sp_object_read_attr(object, "inkscape:snap-bbox");
     sp_object_read_attr(object, "inkscape:snap-nodes");
-    sp_object_read_attr(object, "inkscape:snap-guide");
+    sp_object_read_attr(object, "inkscape:snap-from-guide");
     sp_object_read_attr(object, "inkscape:snap-center");
     sp_object_read_attr(object, "inkscape:snap-smooth-nodes");
     sp_object_read_attr(object, "inkscape:snap-midpoints");
     sp_object_read_attr(object, "inkscape:snap-object-midpoints");
     sp_object_read_attr(object, "inkscape:snap-bbox-edge-midpoints");
     sp_object_read_attr(object, "inkscape:snap-bbox-midpoints");
-       sp_object_read_attr(object, "inkscape:snap-intersection-grid-guide");
+       //sp_object_read_attr(object, "inkscape:snap-intersection-grid-guide");
+       sp_object_read_attr(object, "inkscape:snap-to-guides");
+       sp_object_read_attr(object, "inkscape:snap-grids");
     sp_object_read_attr(object, "inkscape:snap-intersection-paths");
     sp_object_read_attr(object, "inkscape:object-paths");
     sp_object_read_attr(object, "inkscape:object-nodes");
@@ -470,7 +472,15 @@ static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *va
             nv->snap_manager.snapprefs.setIncludeItemCenter(value ? sp_str_to_bool(value) : FALSE);
             object->requestModified(SP_OBJECT_MODIFIED_FLAG);
             break;
-    case SP_ATTR_INKSCAPE_SNAP_SMOOTH_NODES:
+    case SP_ATTR_INKSCAPE_SNAP_GRIDS:
+                       nv->snap_manager.snapprefs.setSnapToGrids(value ? sp_str_to_bool(value) : TRUE);
+                       object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+                       break;
+    case SP_ATTR_INKSCAPE_SNAP_TO_GUIDES:
+                       nv->snap_manager.snapprefs.setSnapToGuides(value ? sp_str_to_bool(value) : TRUE);
+                       object->requestModified(SP_OBJECT_MODIFIED_FLAG);
+                       break;
+       case SP_ATTR_INKSCAPE_SNAP_SMOOTH_NODES:
             nv->snap_manager.snapprefs.setSnapSmoothNodes(value ? sp_str_to_bool(value) : FALSE);
             object->requestModified(SP_OBJECT_MODIFIED_FLAG);
             break;
@@ -490,14 +500,14 @@ static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *va
                        nv->snap_manager.snapprefs.setSnapBBoxMidpoints(value ? sp_str_to_bool(value) : FALSE);
                        object->requestModified(SP_OBJECT_MODIFIED_FLAG);
                        break;
-       case SP_ATTR_INKSCAPE_SNAP_GUIDE:
+       case SP_ATTR_INKSCAPE_SNAP_FROM_GUIDE:
             nv->snap_manager.snapprefs.setSnapModeGuide(value ? sp_str_to_bool(value) : FALSE);
             object->requestModified(SP_OBJECT_MODIFIED_FLAG);
             break;
-    case SP_ATTR_INKSCAPE_SNAP_INTERS_GRIDGUIDE:
+    /*case SP_ATTR_INKSCAPE_SNAP_INTERS_GRIDGUIDE:
             nv->snap_manager.snapprefs.setSnapIntersectionGG(value ? sp_str_to_bool(value) : TRUE);
             object->requestModified(SP_OBJECT_MODIFIED_FLAG);
-            break;
+            break;*/
     case SP_ATTR_INKSCAPE_SNAP_INTERS_PATHS:
             nv->snap_manager.snapprefs.setSnapIntersectionCS(value ? sp_str_to_bool(value) : FALSE);
             object->requestModified(SP_OBJECT_MODIFIED_FLAG);
index cbc3d79b9ccaad7940e307c9e625ed3c8d30555e..76a50c9c7f13ffbd4a274f0db6e5ad610fb76040 100644 (file)
@@ -101,7 +101,7 @@ DocumentProperties::DocumentProperties()
       //General snap options
       _rcb_sgui(_("Show _guides"), _("Show or hide guides"), "showguides", _wr),
       _rcbsng(_("_Snap guides while dragging"), _("While dragging a guide, snap to object nodes or bounding box corners ('Snap to nodes' or 'snap to bounding box corners' must be enabled in the 'Snap' tab; only a small part of the guide near the cursor will snap)"),
-                  "inkscape:snap-guide", _wr),
+                  "inkscape:snap-from-guide", _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),
     //---------------------------------------------------------------
index 0acc7731ab7f31bdd037d2016623231dc8f20bab..a2be7e2388fec3d3b426642c0b7768b639d08622 100644 (file)
@@ -1940,14 +1940,22 @@ void toggle_snap_callback (GtkToggleAction *act, gpointer data) { //data points
                v = nv->snap_manager.snapprefs.getIncludeItemCenter();
                sp_repr_set_boolean(repr, "inkscape:snap-center", !v);
                break;
+       case SP_ATTR_INKSCAPE_SNAP_GRIDS:
+               v = nv->snap_manager.snapprefs.getSnapToGrids();
+               sp_repr_set_boolean(repr, "inkscape:snap-grids", !v);
+               break;
+       case SP_ATTR_INKSCAPE_SNAP_TO_GUIDES:
+               v = nv->snap_manager.snapprefs.getSnapToGuides();
+               sp_repr_set_boolean(repr, "inkscape:snap-to-guides", !v);
+               break;
        case SP_ATTR_INKSCAPE_SNAP_PAGE:
                v = nv->snap_manager.snapprefs.getSnapToPageBorder();
                sp_repr_set_boolean(repr, "inkscape:snap-page", !v);
                break;
-       case SP_ATTR_INKSCAPE_SNAP_INTERS_GRIDGUIDE:
+       /*case SP_ATTR_INKSCAPE_SNAP_INTERS_GRIDGUIDE:
                v = nv->snap_manager.snapprefs.getSnapIntersectionGG();
                sp_repr_set_boolean(repr, "inkscape:snap-intersection-grid-guide", !v);
-               break;
+               break;*/
        case SP_ATTR_INKSCAPE_SNAP_LINE_MIDPOINTS:
                v = nv->snap_manager.snapprefs.getSnapLineMidpoints();
                sp_repr_set_boolean(repr, "inkscape:snap-midpoints", !v);
@@ -2000,7 +2008,9 @@ void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop)
                        "    <toolitem action='ToggleSnapToFromCenter' />"
                        "    <separator />"
                        "    <toolitem action='ToggleSnapToPageBorder' />"
-                       "    <toolitem action='ToggleSnapToGridGuideIntersections' />"
+                       "    <toolitem action='ToggleSnapToGrids' />"
+                       "    <toolitem action='ToggleSnapToGuides' />"
+                 //"    <toolitem action='ToggleSnapToGridGuideIntersections' />"
                        "  </toolbar>"
                "</ui>";
 
@@ -2187,6 +2197,30 @@ void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop)
        }
 
        {
+               InkToggleAction* act = ink_toggle_action_new("ToggleSnapToGrids",       // "name"
+                                                                                                _("Grids"),                            // "label"
+                                                                                                _("Snap to grids"),    // "tooltip"
+                                                                                                "grid_xy",     // "iconId"
+                                                                                                secondarySize,
+                                                                                                SP_ATTR_INKSCAPE_SNAP_GRIDS);
+
+               gtk_action_group_add_action( mainActions->gobj(), GTK_ACTION( act ) );
+               g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(toggle_snap_callback), toolbox );
+       }
+
+       {
+               InkToggleAction* act = ink_toggle_action_new("ToggleSnapToGuides",      // "name"
+                                                                                                _("Guides"),                           // "label"
+                                                                                                _("Snap to guides"),   // "tooltip"
+                                                                                                "guide",       // "iconId"
+                                                                                                secondarySize,
+                                                                                                SP_ATTR_INKSCAPE_SNAP_TO_GUIDES);
+
+               gtk_action_group_add_action( mainActions->gobj(), GTK_ACTION( act ) );
+               g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(toggle_snap_callback), toolbox );
+       }
+
+       /*{
                InkToggleAction* act = ink_toggle_action_new("ToggleSnapToGridGuideIntersections",      // "name"
                                                                                                 _("Grid/guide intersections"),                         // "label"
                                                                                                 _("Snap to intersections of a grid with a guide"),     // "tooltip"
@@ -2196,7 +2230,7 @@ void setup_snap_toolbox(GtkWidget *toolbox, SPDesktop *desktop)
 
                gtk_action_group_add_action( mainActions->gobj(), GTK_ACTION( act ) );
                g_signal_connect_after( G_OBJECT(act), "toggled", G_CALLBACK(toggle_snap_callback), toolbox );
-       }
+       }*/
 
     GtkUIManager* mgr = gtk_ui_manager_new();
     GError* errVal = 0;
@@ -2254,7 +2288,9 @@ void update_snap_toolbox(SPDesktop *desktop, SPEventContext */*eventcontext*/, G
        Glib::RefPtr<Gtk::Action> act10 = mainActions->get_action("ToggleSnapToFromObjectMidpoints");
        Glib::RefPtr<Gtk::Action> act11 = mainActions->get_action("ToggleSnapToFromCenter");
        Glib::RefPtr<Gtk::Action> act12 = mainActions->get_action("ToggleSnapToPageBorder");
-       Glib::RefPtr<Gtk::Action> act13 = mainActions->get_action("ToggleSnapToGridGuideIntersections");
+       //Glib::RefPtr<Gtk::Action> act13 = mainActions->get_action("ToggleSnapToGridGuideIntersections");
+       Glib::RefPtr<Gtk::Action> act14 = mainActions->get_action("ToggleSnapToGrids");
+       Glib::RefPtr<Gtk::Action> act15 = mainActions->get_action("ToggleSnapToGuides");
 
 
        if (!act1) {
@@ -2304,8 +2340,14 @@ void update_snap_toolbox(SPDesktop *desktop, SPEventContext */*eventcontext*/, G
 
        gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act12->gobj()), nv->snap_manager.snapprefs.getSnapToPageBorder());
        gtk_action_set_sensitive(GTK_ACTION(act12->gobj()), c1);
-       gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act13->gobj()), nv->snap_manager.snapprefs.getSnapIntersectionGG());
-       gtk_action_set_sensitive(GTK_ACTION(act13->gobj()), c1);
+       //gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act13->gobj()), nv->snap_manager.snapprefs.getSnapIntersectionGG());
+       //gtk_action_set_sensitive(GTK_ACTION(act13->gobj()), c1);
+
+       gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act14->gobj()), nv->snap_manager.snapprefs.getSnapToGrids());
+       gtk_action_set_sensitive(GTK_ACTION(act14->gobj()), c1);
+       gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(act15->gobj()), nv->snap_manager.snapprefs.getSnapToGuides());
+       gtk_action_set_sensitive(GTK_ACTION(act15->gobj()), c1);
+
 
        g_object_set_data(G_OBJECT(toolbox), "freeze", GINT_TO_POINTER(FALSE)); // unfreeze (see above)
 }