Code

New feature: to exchange position of two objects (bug #171944)
authorJazzyNico <nicoduf@yahoo.fr>
Tue, 3 Aug 2010 19:44:44 +0000 (21:44 +0200)
committerJazzyNico <nicoduf@yahoo.fr>
Tue, 3 Aug 2010 19:44:44 +0000 (21:44 +0200)
share/icons/icons.svg
src/ui/dialog/align-and-distribute.cpp
src/ui/dialog/align-and-distribute.h
src/ui/icon-names.h

index 52360276ae838c1b7c2c77a85e079699e15c1c07..a315a1252ee8e49076245ee00e97313bb95f4b80 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.47+devel r9365" sodipodi:docname="icons.svg" height="540" width="1250" sodipodi:version="0.32" id="svg1" inkscape:output_extension="org.inkscape.output.svg.inkscape" version="1.0">
+<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.48+devel r9680" sodipodi:docname="icons.svg" height="540" width="1250" sodipodi:version="0.32" id="svg1" inkscape:output_extension="org.inkscape.output.svg.inkscape" version="1.0">
 <defs id="defs3">
 <linearGradient id="linearGradient6618">
 <stop offset="0" style="stop-color:#1caf19;stop-opacity:1" id="stop6620" />
 <linearGradient inkscape:collect="always" xlink:href="#linearGradient6684-6" id="linearGradient7067" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-1.0619426,0.61311287,-0.61311287,-1.0619426,1168.341,499.52897)" x1="501.36981" y1="278.69318" x2="498.01834" y2="275.92883" />
 <linearGradient inkscape:collect="always" xlink:href="#linearGradient5704-1" id="linearGradient7070" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-1.0619426,0.61311287,-0.61311287,-1.0619426,1170.4728,499.78597)" x1="497.19922" y1="276.5925" x2="501.15674" y2="279.68689" />
 <linearGradient inkscape:collect="always" xlink:href="#linearGradient24464" id="linearGradient7073" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-0.90891476,0.82310731,-0.8530767,-0.94200831,659.33278,552.03151)" x1="99.279366" y1="121.4717" x2="95.750748" y2="118.64024" />
+<linearGradient inkscape:collect="always" xlink:href="#linearGradient5704-0" id="linearGradient8980" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.209494,0,0,1.382055,-12.2469,758.2004)" x1="11.87961" y1="205.4478" x2="18.58443" y2="211.605" />
+<linearGradient id="linearGradient5704-0">
+<stop style="stop-color:#5a5a5a;stop-opacity:1;" offset="0" id="stop5706-2" />
+<stop style="stop-color:#000000;stop-opacity:1.0000000;" offset="1.0000000" id="stop5708-9" />
+</linearGradient>
+<linearGradient inkscape:collect="always" xlink:href="#linearGradient5734-6" id="linearGradient8982" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.306645,0,0,2.608597,-18.88425,480.9675)" x1="16.3967" y1="214.8097" x2="21.32992" y2="218.8141" />
+<linearGradient id="linearGradient5734-6">
+<stop id="stop5736-0" offset="0" style="stop-color:#8ab3df;stop-opacity:1;" />
+<stop id="stop5738-9" offset="1" style="stop-color:#ffffff" />
+</linearGradient>
+<linearGradient inkscape:collect="always" xlink:href="#linearGradient5740-3" id="linearGradient8984" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.9834125,0,0,1.562975,-12.92154,707.8904)" x1="15.64649" y1="214.5411" x2="17.49814" y2="218.8026" />
+<linearGradient id="linearGradient5740-3">
+<stop id="stop5742-5" offset="0.0000000" style="stop-color:#ffffff;stop-opacity:1.0000000;" />
+<stop id="stop5744-4" offset="1.0000000" style="stop-color:#98b6d3;stop-opacity:1.0000000;" />
+</linearGradient>
+<linearGradient inkscape:collect="always" xlink:href="#linearGradient5704-0" id="linearGradient8986" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.209494,0,0,1.382055,-12.2469,758.2004)" x1="11.87961" y1="205.4478" x2="18.58443" y2="211.605" />
+<linearGradient inkscape:collect="always" xlink:href="#linearGradient5734-6" id="linearGradient8988" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.306645,0,0,2.608597,-18.88425,480.9675)" x1="16.3967" y1="214.8097" x2="21.32992" y2="218.8141" />
+<linearGradient inkscape:collect="always" xlink:href="#linearGradient5740-3" id="linearGradient8990" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.9834125,0,0,1.562975,-12.92154,707.8904)" x1="15.64649" y1="214.5411" x2="17.49814" y2="218.8026" />
+<linearGradient inkscape:collect="always" xlink:href="#linearGradient5704-0" id="linearGradient8772" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.209494,0,0,1.382055,-12.2469,758.2004)" x1="11.87961" y1="205.4478" x2="18.58443" y2="211.605" />
+<linearGradient inkscape:collect="always" xlink:href="#linearGradient5734-6" id="linearGradient8774" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.306645,0,0,2.608597,-18.88425,480.9675)" x1="16.3967" y1="214.8097" x2="21.32992" y2="218.8141" />
+<linearGradient inkscape:collect="always" xlink:href="#linearGradient5740-3" id="linearGradient8776" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.9834125,0,0,1.562975,-12.92154,707.8904)" x1="15.64649" y1="214.5411" x2="17.49814" y2="218.8026" />
+<linearGradient inkscape:collect="always" xlink:href="#linearGradient5704-0" id="linearGradient8766" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.209494,0,0,1.382055,-12.2469,758.2004)" x1="11.87961" y1="205.4478" x2="18.58443" y2="211.605" />
+<linearGradient inkscape:collect="always" xlink:href="#linearGradient5734-6" id="linearGradient8768" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.306645,0,0,2.608597,-18.88425,480.9675)" x1="16.3967" y1="214.8097" x2="21.32992" y2="218.8141" />
+<linearGradient inkscape:collect="always" xlink:href="#linearGradient5740-3" id="linearGradient8770" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.9834125,0,0,1.562975,-12.92154,707.8904)" x1="15.64649" y1="214.5411" x2="17.49814" y2="218.8026" />
+<linearGradient inkscape:collect="always" xlink:href="#linearGradient5704-3" id="linearGradient6608" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.209494,0,0,1.382055,-12.2469,758.2004)" x1="11.87961" y1="205.4478" x2="18.58443" y2="211.605" />
+<linearGradient id="linearGradient5704-3">
+<stop style="stop-color:#5a5a5a;stop-opacity:1;" offset="0" id="stop5706-7" />
+<stop style="stop-color:#000000;stop-opacity:1.0000000;" offset="1.0000000" id="stop5708-90" />
+</linearGradient>
+<linearGradient inkscape:collect="always" xlink:href="#linearGradient5734-2" id="linearGradient6610" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.306645,0,0,2.608597,-18.88425,480.9675)" x1="16.3967" y1="214.8097" x2="21.32992" y2="218.8141" />
+<linearGradient id="linearGradient5734-2">
+<stop id="stop5736-3" offset="0" style="stop-color:#8ab3df;stop-opacity:1;" />
+<stop id="stop5738-99" offset="1" style="stop-color:#ffffff" />
+</linearGradient>
+<linearGradient inkscape:collect="always" xlink:href="#linearGradient5740-7" id="linearGradient6612" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.9834125,0,0,1.562975,-12.92154,707.8904)" x1="15.64649" y1="214.5411" x2="17.49814" y2="218.8026" />
+<linearGradient id="linearGradient5740-7">
+<stop id="stop5742-0" offset="0.0000000" style="stop-color:#ffffff;stop-opacity:1.0000000;" />
+<stop id="stop5744-3" offset="1.0000000" style="stop-color:#98b6d3;stop-opacity:1.0000000;" />
+</linearGradient>
+<linearGradient inkscape:collect="always" xlink:href="#linearGradient5704-3" id="linearGradient6614" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.209494,0,0,1.382055,-12.2469,758.2004)" x1="11.87961" y1="205.4478" x2="18.58443" y2="211.605" />
+<linearGradient inkscape:collect="always" xlink:href="#linearGradient5734-2" id="linearGradient6616" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.306645,0,0,2.608597,-18.88425,480.9675)" x1="16.3967" y1="214.8097" x2="21.32992" y2="218.8141" />
+<linearGradient inkscape:collect="always" xlink:href="#linearGradient5740-7" id="linearGradient6618-9" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.9834125,0,0,1.562975,-12.92154,707.8904)" x1="15.64649" y1="214.5411" x2="17.49814" y2="218.8026" />
 <linearGradient xlink:href="#linearGradient5704-46" y2="351.125" x2="511.4375" y1="347.1808" x1="508.1888" gradientUnits="userSpaceOnUse" id="linearGradient5857-1" inkscape:collect="always" />
 <linearGradient id="linearGradient5704-46">
 <stop style="stop-color:#5a5a5a;stop-opacity:1;" offset="0" id="stop5706-7" />
        x2="677.5"
        y2="306.5" />
 </defs>
-<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="1" inkscape:window-x="0" inkscape:window-height="1019" inkscape:window-width="1680" inkscape:cy="221.2109" inkscape:cx="480.2787" inkscape:zoom="1.373237" gridtolerance="6" snaptogrid="false" showgrid="true" id="base" inkscape:document-units="px" inkscape:grid-points="true" guidetolerance="8" fill="#8ab3de" stroke="#646464" inkscape:object-nodes="true" 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="false" inkscape:object-paths="false" inkscape:snap-object-midpoints="false" inkscape:window-maximized="1">
+<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="1" inkscape:window-x="0" inkscape:window-height="1017" inkscape:window-width="1680" inkscape:cy="305.5611" inkscape:cx="748.6239" inkscape:zoom="0.9991554" 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="true" 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="false" inkscape:object-paths="false" inkscape:snap-object-midpoints="false" inkscape:window-maximized="1">
 <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" />
@@ -2245,10 +2287,10 @@ http://www.inkscape.org/</dc:description>
 <rect style="color:#000000;fill:none;stroke:#000000;stroke-width:0.99999893;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;display:inline" id="rect4381" width="19.000811" height="18.99999" x="670.49939" y="65.5" />
 </g>
 <g id="paint-swatch" transform="translate(395.00061,282)" inkscape:label="#fill_swatch">
-<rect inkscape:label="#ccc" y="66" x="671" height="18" width="18" id="rect7681" style="color:#000000;fill:#99b6d4;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.00000036;marker:none;display:inline" />
-<rect style="color:#000000;fill:none;stroke:#000000;stroke-width:0.99999893;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;display:inline" id="rect7683" width="19.000811" height="18.99999" x="670.49939" y="65.5" />
+<rect inkscape:label="#ccc" y="66" x="671" height="18" width="18" id="rect11473" style="color:#000000;fill:#99b6d4;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1.00000036;marker:none;display:inline" />
+<rect style="color:#000000;fill:none;stroke:#000000;stroke-width:0.99999893;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;display:inline" id="rect11475" width="19.000811" height="18.99999" x="670.49939" y="65.5" />
 <rect style="fill:#000000;stroke:none;marker:none;display:inline" id="rect4382" width="13.000811" height="12.99999" x="674.49939" y="69.5" />
-<rect style="fill:#ffffff;stroke:none;marker:none;display:inline" id="rect7686" width="13.000811" height="12.99999" x="673.49939" y="68.5" />
+<rect style="fill:#ffffff;stroke:none;marker:none;display:inline" id="rect11478" width="13.000811" height="12.99999" x="673.49939" y="68.5" />
 </g>
 <g id="distribute-graph" transform="matrix(0.173978,0,0,0.208504,867.70076,70.054562)" inkscape:label="#graph_layout">
 <g transform="matrix(4.416533,0,0,3.725389,-3265.91,88.05639)" id="g3559" />
@@ -3475,6 +3517,68 @@ http://www.inkscape.org/</dc:description>
 <use height="1052.3622" width="744.09448" transform="translate(-4.7245626,0)" id="use23505" xlink:href="#use23485" y="0" x="0" />
 <use height="1052.3622" width="744.09448" transform="translate(0.69239279,4.1136278)" id="use23509" xlink:href="#use23505" y="0" x="0" />
 </g>
+<g transform="translate(-1.367187e-5,-1.000977e-6)" id="exchange-positions" inkscape:label="#g5791">
+<rect y="217.9579" x="1105.989" height="24" width="24" id="rect5511" style="opacity:0;fill:none;stroke:none;stroke-width:1;marker:none;display:inline" />
+<g transform="translate(1106.989,-822.8055)" id="g6870">
+<rect style="fill:none;stroke:url(#linearGradient6608);stroke-width:0.925648;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;display:inline" id="rect6878" width="9.674352" height="9.673169" x="0.462824" y="1042.226" />
+<rect style="fill:url(#linearGradient6610);fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient6612);stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;display:inline" id="rect6880" width="7.840812" height="7.835659" x="1.379594" y="1043.145" />
+</g>
+<g id="g6888" transform="translate(1119.244,-812.1375)">
+<rect y="1042.226" x="0.462824" height="9.673169" width="9.674352" id="rect6890" style="fill:none;stroke:url(#linearGradient6614);stroke-width:0.925648;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;display:inline" />
+<rect y="1043.145" x="1.379594" height="7.835659" width="7.840812" id="rect6892" style="fill:url(#linearGradient6616);fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient6618-9);stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;display:inline" />
+</g>
+<g id="g6894" transform="matrix(-1.5,0,0,-1.5,1679.065,1036.244)" style="fill:#ffff00">
+<path inkscape:connector-curvature="0" style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;display:inline" d="m 373.1989,533.2837 0,0.7 3,0 1.1645,1 0,2.5154 -1.2973,0 1.6269,1.9968 1.6838,-1.9968 -1.2954,0 0,-2.782 -1.6826,-1.4334 -3.1999,0 z" id="path6896" sodipodi:nodetypes="cccccccccccc" />
+</g>
+<g style="fill:#ffff00" transform="matrix(1.5,0,0,1.5,556.9348,-576.9256)" id="g5473">
+<path inkscape:connector-curvature="0" sodipodi:nodetypes="cccccccccccc" id="path5524" d="m 373.1989,533.2837 0,0.7 3,0 1.1645,1 0,2.5154 -1.2973,0 1.6269,1.9968 1.6838,-1.9968 -1.2954,0 0,-2.782 -1.6826,-1.4334 -3.1999,0 z" style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;display:inline" />
+</g>
+</g>
+<g id="exchange-positions-zorder" transform="translate(31.999986,-26.000001)" inkscape:label="exchange-positions-zorder">
+<rect y="244" x="1106" height="24" width="24" id="rect5511-4" style="opacity:0;fill:none;stroke:none;stroke-width:1;marker:none;display:inline" />
+<g transform="matrix(0.8490566,0,0,0.8490566,1107,-639.5161)" id="g6870-3">
+<rect style="fill:none;stroke:url(#linearGradient8772);stroke-width:0.92564797;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;display:inline" id="rect6878-1" width="9.6743517" height="9.6731691" x="0.46282399" y="1042.226" />
+<rect style="fill:url(#linearGradient8774);fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient8776);stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;display:inline" id="rect6880-9" width="7.8408122" height="7.835659" x="1.379594" y="1043.145" />
+</g>
+<g id="g6888-1" transform="matrix(0.8490566,0,0,0.8490566,1120,-632.5151)">
+<rect y="1042.226" x="0.46282399" height="9.6731691" width="9.6743517" id="rect6890-0" style="fill:none;stroke:url(#linearGradient8766);stroke-width:0.92564797;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;display:inline" />
+<rect y="1043.145" x="1.379594" height="7.835659" width="7.8408122" id="rect6892-9" style="fill:url(#linearGradient8768);fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient8770);stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;display:inline" />
+</g>
+<g id="g6894-4" transform="matrix(-1.214009,0,0,-1.214009,1572.567,906.4111)" style="fill:#ffff00">
+<path style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;display:inline" d="m 372.8308,534.9312 0,0.7 5.0155,0 1.1646,1 0,0.8679 -1.2973,0 1.6268,1.9968 1.6838,-1.9968 -1.2953,0 0,-1.1346 -1.6827,-1.4333 -5.2154,0 z" id="path6896-5" sodipodi:nodetypes="cccccccccccc" inkscape:connector-curvature="0" />
+</g>
+<g style="fill:#ffff00" transform="matrix(1.214009,0,0,1.214009,661.8316,-398.1738)" id="g5473-6">
+<path sodipodi:nodetypes="cccccccccccc" id="path5524-2" d="m 373.9715,533.0883 0,0.7 5.606,0 1.1646,1 0,0.8679 -1.2973,0 1.6268,1.9968 1.6838,-1.9968 -1.2953,0 0,-1.1346 -1.6827,-1.4333 -5.8059,0 z" style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;display:inline" inkscape:connector-curvature="0" />
+</g>
+<use xlink:href="#path10475" height="1250" width="1250" id="use7638-0" y="0" x="0" style="display:inline" transform="translate(1155.035,83.0092)" />
+<use xlink:href="#path10483" height="1250" width="1250" id="use8589-6" y="0" x="0" style="display:inline" transform="translate(1152.062,76.0092)" />
+<use transform="translate(1155.062,79.0092)" style="display:inline" x="0" y="0" id="use7946" width="1250" height="1250" xlink:href="#path10483" />
+<path id="path10449-0" d="m 1116.127,258 -0.936,0 0,5.4545 -1.873,0 2.256,2.5524 2.426,-2.5524 -1.873,0 0,-5.4545 z" style="fill:#c80000;fill-opacity:1;fill-rule:evenodd;stroke:none" sodipodi:nodetypes="cccccccc" inkscape:connector-curvature="0" />
+<path id="path10449-0-8" d="m 1112.236,266 -0.882,0 0,-2.9358 0,-2.5187 -1.763,0 2.373,-2.3834 2.036,2.3834 -1.764,0 0,5.4545 z" style="fill:#c80000;fill-opacity:1;fill-rule:evenodd;stroke:none" sodipodi:nodetypes="ccccccccc" inkscape:connector-curvature="0" />
+</g>
+<g id="exchange-positions-clockwise" transform="translate(23.99999,-26)" inkscape:label="exchange-positions-clockwise">
+<rect style="opacity:0;fill:none;stroke:none;stroke-width:1;marker:none;display:inline" id="rect8798" width="24" height="24" x="1146" y="244" />
+<g id="g8800" transform="matrix(0.8490566,0,0,0.8490566,1147,-639.5161)">
+<rect y="1042.226" x="0.462824" height="9.673169" width="9.674352" id="rect8802" style="fill:none;stroke:url(#linearGradient8980);stroke-width:0.925648;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;display:inline" />
+<rect y="1043.145" x="1.379594" height="7.835659" width="7.840812" id="rect8804" style="fill:url(#linearGradient8982);fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient8984);stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;display:inline" />
+</g>
+<g transform="matrix(0.8490566,0,0,0.8490566,1160,-632.5151)" id="g8806">
+<rect style="fill:none;stroke:url(#linearGradient8986);stroke-width:0.925648;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;display:inline" id="rect8808" width="9.674352" height="9.673169" x="0.462824" y="1042.226" />
+<rect style="fill:url(#linearGradient8988);fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient8990);stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;display:inline" id="rect8810" width="7.840812" height="7.835659" x="1.379594" y="1043.145" />
+</g>
+<g style="fill:#ffff00" transform="matrix(-1.214009,0,0,-1.214009,1612.567,906.4111)" id="g8812">
+<path inkscape:connector-curvature="0" sodipodi:nodetypes="cccccccccccc" id="path8814" d="m 372.8308,534.9312 0,0.7 5.0155,0 1.1646,1 0,0.8679 -1.2973,0 1.6268,1.9968 1.6838,-1.9968 -1.2953,0 0,-1.1346 -1.6827,-1.4333 -5.2154,0 z" style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;display:inline" />
+</g>
+<g id="g8816" transform="matrix(1.214009,0,0,1.214009,701.8316,-398.1738)" style="fill:#ffff00">
+<path inkscape:connector-curvature="0" style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;display:inline" d="m 373.9715,533.0883 0,0.7 5.606,0 1.1646,1 0,0.8679 -1.2973,0 1.6268,1.9968 1.6838,-1.9968 -1.2953,0 0,-1.1346 -1.6827,-1.4333 -5.8059,0 z" id="path8818" sodipodi:nodetypes="cccccccccccc" />
+</g>
+<g inkscape:transform-center-x="3.042784" transform="matrix(0.5350629,0.5892249,-0.5892249,0.5350629,686.558,-576.3326)" id="g8956">
+<path inkscape:connector-curvature="0" style="color:#000000;fill:none;stroke:#c80000;stroke-width:1.5077016;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:1.5077017, 1.5077017;stroke-dashoffset:0;marker:none;display:inline" d="m 1173.915,279.6085 c 3.028,0 5.485,-2.458 5.485,-5.4866 0,-3.0286 -2.457,-5.4866 -5.485,-5.4866" id="path11132-6" sodipodi:nodetypes="csc" />
+<path inkscape:connector-curvature="0" sodipodi:nodetypes="cccc" style="fill:#c80000;fill-opacity:1;fill-rule:evenodd;stroke:none" d="m 1172.21,279.2058 3.771,-3.1433 0,6.2868 -3.771,-3.1435 z" id="path11140-4" />
+<path inkscape:connector-curvature="0" sodipodi:nodetypes="csc" id="path8948" d="m 1173.102,268.4294 c -3.028,0 -5.485,2.458 -5.485,5.4866 0,3.0286 2.457,5.4866 5.485,5.4866" style="color:#000000;fill:none;stroke:#c80000;stroke-width:1.5077016;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:1.5077017, 1.5077017;stroke-dashoffset:0.3015402;marker:none;display:inline" />
+<path inkscape:connector-curvature="0" id="path8950" d="m 1174.61,268.7807 -3.771,3.1434 0,-6.2867 3.771,3.1433 z" style="fill:#c80000;fill-opacity:1;fill-rule:evenodd;stroke:none" sodipodi:nodetypes="cccc" />
+</g>
+</g>
 <g id="text_remove_kerns" transform="translate(-693.87,270.0361)">
 <g transform="matrix(0.922438,0,0,0.922438,106.4646,4.828925)" id="g2607">
 <rect style="color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.7402338px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;display:inline" id="rect3019" width="29.18541" height="29.19199" x="1352.876" y="51.67942" />
index a75a8d68d9eea638e162784d9407391aa94b4ae2..048c46a2055b0496aa24dedf3c6d3c59aff12746 100644 (file)
@@ -518,8 +518,8 @@ public:
                          guint row,
                          guint column,
                          AlignAndDistribute &dialog) :
-        Action(id, tiptext, row, column + 4,
-               dialog.graphLayout_table(), dialog.tooltips(), dialog)
+        Action(id, tiptext, row, column,
+               dialog.rearrange_table(), dialog.tooltips(), dialog)
     {}
 
 private :
@@ -542,6 +542,101 @@ private :
     }
 };
 
+class ActionExchangePositions : public Action {
+public:
+    enum SortOrder {
+       None,
+       ZOrder,
+       Clockwise
+    };     
+
+    ActionExchangePositions(Glib::ustring const &id,
+                         Glib::ustring const &tiptext,
+                         guint row,
+                         guint column,
+                         AlignAndDistribute &dialog, SortOrder order = None) :
+        Action(id, tiptext, row, column,
+               dialog.rearrange_table(), dialog.tooltips(), dialog),
+        sortOrder(order)
+    {};
+
+
+private :
+    const SortOrder sortOrder;
+    static boost::optional<Geom::Point> center;
+
+    static bool sort_compare(const SPItem * a,const SPItem * b) {
+        if (a == NULL) return false;
+        if (b == NULL) return true;
+        if (center) {
+            Geom::Point point_a = a->getCenter() - (*center);
+            Geom::Point point_b = b->getCenter() - (*center);
+            // First criteria: Sort according to the angle to the center point
+            double angle_a = atan2(double(point_a[Geom::Y]), double(point_a[Geom::X]));
+            double angle_b = atan2(double(point_b[Geom::Y]), double(point_b[Geom::X]));
+            if (angle_a != angle_b) return (angle_a < angle_b);
+            // Second criteria: Sort according to the distance the center point
+            Geom::Coord length_a = point_a.length();
+            Geom::Coord length_b = point_b.length();
+            if (length_a != length_b) return (length_a > length_b);
+        }
+        // Last criteria: Sort according to the z-coordinate
+        return (a->isSiblingOf(b));
+    }
+
+    virtual void on_button_click()
+    {
+        SPDesktop *desktop = _dialog.getDesktop();
+        if (!desktop) return;
+
+        Inkscape::Selection *selection = sp_desktop_selection(desktop);
+        if (!selection) return;
+
+        using Inkscape::Util::GSListConstIterator;
+        std::list<SPItem *> selected;
+        selected.insert<GSListConstIterator<SPItem *> >(selected.end(), selection->itemList(), NULL);
+        if (selected.empty()) return;
+
+        //Check 2 or more selected objects
+        if (selected.size() < 2) return;
+
+        // see comment in ActionAlign above
+        Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+        int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED);
+        prefs->setInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED);
+
+        // sort the list
+       if (sortOrder != None) {
+               if (sortOrder == Clockwise) {
+                       center = selection->center();
+               } else { // sorting by ZOrder is outomatically done by not setting the center
+                       center.reset();
+               }
+               selected.sort(ActionExchangePositions::sort_compare);
+       }
+       std::list<SPItem *>::iterator it(selected.begin());
+       Geom::Point p1 =  (*it)->getCenter();
+       for (++it ;it != selected.end(); ++it)
+       {
+               Geom::Point p2 = (*it)->getCenter();
+               Geom::Point delta = p1 - p2;
+               sp_item_move_rel((*it),Geom::Translate(delta[Geom::X],delta[Geom::Y] ));
+               p1 = p2;
+       }
+       Geom::Point p2 = selected.front()->getCenter();
+       Geom::Point delta = p1 - p2;
+       sp_item_move_rel(selected.front(),Geom::Translate(delta[Geom::X],delta[Geom::Y] ));
+
+        // restore compensation setting
+        prefs->setInt("/options/clonecompensation/value", saved_compensation);
+
+       sp_document_done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_ALIGN_DISTRIBUTE,
+                        _("Exchange Positions"));
+    }
+};
+// instantiae the private static member
+boost::optional<Geom::Point> ActionExchangePositions::center;
+
 class ActionUnclump : public Action {
 public :
     ActionUnclump(const Glib::ustring &id,
@@ -550,7 +645,7 @@ public :
                guint column,
                AlignAndDistribute &dialog):
         Action(id, tiptext, row, column,
-               dialog.distribute_table(), dialog.tooltips(), dialog)
+               dialog.rearrange_table(), dialog.tooltips(), dialog)
     {}
 
 private :
@@ -581,7 +676,7 @@ public :
                guint column,
                AlignAndDistribute &dialog):
         Action(id, tiptext, row, column,
-               dialog.distribute_table(), dialog.tooltips(), dialog)
+               dialog.rearrange_table(), dialog.tooltips(), dialog)
     {}
 
 private :
@@ -792,13 +887,13 @@ AlignAndDistribute::AlignAndDistribute()
       randomize_bbox(),
       _alignFrame(_("Align")),
       _distributeFrame(_("Distribute")),
+      _rearrangeFrame(_("Rearrange")),
       _removeOverlapFrame(_("Remove overlaps")),
-      _graphLayoutFrame(_("Connector network layout")),
       _nodesFrame(_("Nodes")),
       _alignTable(2, 6, true),
-      _distributeTable(3, 6, true),
+      _distributeTable(2, 6, true),
+      _rearrangeTable(1, 5, false),
       _removeOverlapTable(1, 5, false),
-      _graphLayoutTable(1, 5, false),
       _nodesTable(1, 4, true),
       _anchorLabel(_("Relative to: ")),
       _selgrpLabel(_("Treat selection as group: "))
@@ -882,22 +977,33 @@ AlignAndDistribute::AlignAndDistribute()
                    _("Distribute baselines of texts vertically"),
                      1, 5, this->distribute_table(), Geom::Y, true);
 
+    // Rearrange
+    //Graph Layout
+    addGraphLayoutButton(INKSCAPE_ICON_DISTRIBUTE_GRAPH,
+                            _("Nicely arrange selected connector network"),
+                            0, 0);
+    addExchangePositionsButton(INKSCAPE_ICON_EXCHANGE_POSITIONS,
+                            _("Exchange positions of selected objects - selection order"),
+                            0, 1);
+    addExchangePositionsByZOrderButton(INKSCAPE_ICON_EXCHANGE_POSITIONS_ZORDER,
+                            _("Exchange positions of selected objects - stacking order"),
+                            0, 2);
+    addExchangePositionsClockwiseButton(INKSCAPE_ICON_EXCHANGE_POSITIONS_CLOCKWISE,
+                            _("Exchange positions of selected objects - clockwise rotate"),
+                            0, 3);
+                           
     //Randomize & Unclump
     addRandomizeButton(INKSCAPE_ICON_DISTRIBUTE_RANDOMIZE,
                         _("Randomize centers in both dimensions"),
-                        2, 2);
+                        0, 4);
     addUnclumpButton(INKSCAPE_ICON_DISTRIBUTE_UNCLUMP,
                         _("Unclump objects: try to equalize edge-to-edge distances"),
-                        2, 4);
+                        0, 5);
 
     //Remove overlaps
     addRemoveOverlapsButton(INKSCAPE_ICON_DISTRIBUTE_REMOVE_OVERLAPS,
                             _("Move objects as little as possible so that their bounding boxes do not overlap"),
                             0, 0);
-    //Graph Layout
-    addGraphLayoutButton(INKSCAPE_ICON_DISTRIBUTE_GRAPH,
-                            _("Nicely arrange selected connector network"),
-                            0, 0);
 
     //Node Mode buttons
     // NOTE: "align nodes vertically" means "move nodes vertically until they align on a common
@@ -943,8 +1049,8 @@ AlignAndDistribute::AlignAndDistribute()
 
     _alignFrame.add(_alignBox);
     _distributeFrame.add(_distributeTable);
+    _rearrangeFrame.add(_rearrangeTable);
     _removeOverlapFrame.add(_removeOverlapTable);
-    _graphLayoutFrame.add(_graphLayoutTable);
     _nodesFrame.add(_nodesTable);
 
     Gtk::Box *contents = _getContents();
@@ -954,8 +1060,8 @@ AlignAndDistribute::AlignAndDistribute()
 
     contents->pack_start(_alignFrame, true, true);
     contents->pack_start(_distributeFrame, true, true);
+    contents->pack_start(_rearrangeFrame, true, true);
     contents->pack_start(_removeOverlapFrame, true, true);
-    contents->pack_start(_graphLayoutFrame, true, true);
     contents->pack_start(_nodesFrame, true, true);
 
     //Connect to the global tool change signal
@@ -1010,8 +1116,8 @@ void AlignAndDistribute::setMode(bool nodeEdit)
 
     ((_alignFrame).*(mSel))();
     ((_distributeFrame).*(mSel))();
+    ((_rearrangeFrame).*(mSel))();
     ((_removeOverlapFrame).*(mSel))();
-    ((_graphLayoutFrame).*(mSel))();
     ((_nodesFrame).*(mNode))();
 
 }
@@ -1063,6 +1169,33 @@ void AlignAndDistribute::addGraphLayoutButton(const Glib::ustring &id, const Gli
         );
 }
 
+void AlignAndDistribute::addExchangePositionsButton(const Glib::ustring &id, const Glib::ustring tiptext,
+                                      guint row, guint col)
+{
+    _actionList.push_back(
+        new ActionExchangePositions(
+            id, tiptext, row, col, *this)
+        );
+}
+
+void AlignAndDistribute::addExchangePositionsByZOrderButton(const Glib::ustring &id, const Glib::ustring tiptext,
+                                      guint row, guint col)
+{
+    _actionList.push_back(
+        new ActionExchangePositions(
+            id, tiptext, row, col, *this, ActionExchangePositions::ZOrder)
+        );
+}
+
+void AlignAndDistribute::addExchangePositionsClockwiseButton(const Glib::ustring &id, const Glib::ustring tiptext,
+                                      guint row, guint col)
+{
+    _actionList.push_back(
+        new ActionExchangePositions(
+            id, tiptext, row, col, *this, ActionExchangePositions::Clockwise)
+        );
+}
+
 void AlignAndDistribute::addUnclumpButton(const Glib::ustring &id, const Glib::ustring tiptext,
                                       guint row, guint col)
 {
index 297b3d2a152d67d72c4b04f31a0966854ac1d415..f559983856ac2e258c9ae3c3fc344d545bc30fe3 100644 (file)
@@ -55,8 +55,8 @@ public:
 
     Gtk::Table &align_table(){return _alignTable;}
     Gtk::Table &distribute_table(){return _distributeTable;}
+    Gtk::Table &rearrange_table(){return _rearrangeTable;}
     Gtk::Table &removeOverlap_table(){return _removeOverlapTable;}
-    Gtk::Table &graphLayout_table(){return _graphLayoutTable;}
     Gtk::Table &nodes_table(){return _nodesTable;}
     Gtk::Tooltips &tooltips(){return _tooltips;}
 
@@ -82,6 +82,15 @@ protected:
     void addGraphLayoutButton(const Glib::ustring &id,
                         const Glib::ustring tiptext,
                         guint row, guint col);
+    void addExchangePositionsButton(const Glib::ustring &id,
+                        const Glib::ustring tiptext,
+                        guint row, guint col);
+    void addExchangePositionsByZOrderButton(const Glib::ustring &id,
+                        const Glib::ustring tiptext,
+                        guint row, guint col);
+    void addExchangePositionsClockwiseButton(const Glib::ustring &id,
+                        const Glib::ustring tiptext,
+                        guint row, guint col);
     void addUnclumpButton(const Glib::ustring &id, const Glib::ustring tiptext, 
                         guint row, guint col);
     void addRandomizeButton(const Glib::ustring &id, const Glib::ustring tiptext, 
@@ -90,8 +99,8 @@ protected:
                            guint row, guint col, Gtk::Table &table, Geom::Dim2 orientation, bool distribute);
 
     std::list<Action *> _actionList;
-    Gtk::Frame _alignFrame, _distributeFrame, _removeOverlapFrame, _graphLayoutFrame, _nodesFrame;
-    Gtk::Table _alignTable, _distributeTable, _removeOverlapTable, _graphLayoutTable, _nodesTable;
+    Gtk::Frame _alignFrame, _distributeFrame, _rearrangeFrame, _removeOverlapFrame, _nodesFrame;
+    Gtk::Table _alignTable, _distributeTable, _rearrangeTable, _removeOverlapTable, _nodesTable;
     Gtk::HBox _anchorBox;
     Gtk::HBox _selgrpBox;
     Gtk::VBox _alignBox;
index d36d4a41a029f9412e99f2114d515e7117ae2f3e..92fd86a488f9d5e287c5fae1988cc414703102dc 100644 (file)
     "edit-select-original"
 #define INKSCAPE_ICON_EDIT_UNDO_HISTORY \
     "edit-undo-history"
+#define INKSCAPE_ICON_EXCHANGE_POSITIONS \
+    "exchange-positions"
+#define INKSCAPE_ICON_EXCHANGE_POSITIONS_ZORDER \
+    "exchange-positions-zorder"
+#define INKSCAPE_ICON_EXCHANGE_POSITIONS_CLOCKWISE \
+    "exchange-positions-clockwise"
 #define INKSCAPE_ICON_FILL_RULE_EVEN_ODD \
     "fill-rule-even-odd"
 #define INKSCAPE_ICON_FILL_RULE_NONZERO \