pcbnew: add align center and align middle tools and related icons

NEW: add placement tools that allow aligning the centers of items in a selection, both vertically and horizonally
This commit is contained in:
Robbert Lagerweij 2018-02-08 17:01:36 +01:00 committed by Wayne Stambaugh
parent 7683364bdb
commit b356275e76
9 changed files with 1160 additions and 0 deletions

View File

@ -138,6 +138,8 @@ set( BMAPS_MID
add_zone_cutout add_zone_cutout
add_zone add_zone
align_items align_items
align_items_center
align_items_middle
anchor anchor
annotate_down_right annotate_down_right
annotate_right_down annotate_right_down

View File

@ -0,0 +1,31 @@
/* Do not modify this file, it was automatically generated by the
* PNG2cpp CMake script, using a *.png file as input.
*/
#include <bitmaps.h>
static const unsigned char png[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x1a, 0x08, 0x06, 0x00, 0x00, 0x00, 0xa9, 0x4a, 0x4c,
0xce, 0x00, 0x00, 0x00, 0xdf, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0x63, 0x60, 0x18, 0x05, 0xd8,
0x80, 0x83, 0x03, 0x0b, 0xa3, 0x4a, 0xf8, 0x77, 0x06, 0xa5, 0xd0, 0xff, 0xc8, 0x18, 0x2c, 0x06,
0x94, 0x43, 0x55, 0x2c, 0xe5, 0xcb, 0xc5, 0x20, 0x17, 0x25, 0x88, 0x82, 0x41, 0x62, 0xc4, 0x00,
0x15, 0x4f, 0x76, 0x90, 0xc1, 0xc1, 0xd3, 0x7e, 0xfd, 0x0f, 0x9d, 0xf9, 0x1f, 0x8c, 0x41, 0x6c,
0xb0, 0x85, 0x20, 0x39, 0x38, 0x50, 0x48, 0xe0, 0x60, 0x54, 0x0e, 0xff, 0x85, 0xe1, 0x22, 0x90,
0x18, 0x50, 0x8e, 0x7a, 0x16, 0xa9, 0x44, 0xf3, 0x81, 0x04, 0xbd, 0xbb, 0x5f, 0xff, 0xf7, 0x9f,
0xf8, 0x05, 0x8c, 0x41, 0x6c, 0x88, 0x42, 0xa0, 0x1c, 0xb5, 0x2d, 0x0a, 0x98, 0xfc, 0x0d, 0xae,
0x10, 0xc4, 0x1e, 0x18, 0x8b, 0x64, 0x42, 0x39, 0x31, 0xe2, 0x10, 0x24, 0x46, 0x55, 0x8b, 0x8c,
0xd3, 0x58, 0x81, 0xf1, 0xf5, 0x03, 0x4b, 0x1c, 0xfe, 0x00, 0xc9, 0x51, 0xcf, 0x22, 0x90, 0xcb,
0x81, 0x6c, 0xdf, 0xde, 0x77, 0xf0, 0x38, 0x04, 0xb1, 0xc1, 0xf2, 0x20, 0x39, 0x6a, 0x5b, 0x14,
0x34, 0xf5, 0x27, 0x5c, 0x1e, 0xc4, 0x1e, 0xbc, 0x16, 0xc5, 0x27, 0xa6, 0x3e, 0xc4, 0x65, 0x51,
0x42, 0x52, 0xea, 0xff, 0xa4, 0xe4, 0xd4, 0xff, 0xb8, 0x2c, 0x02, 0xc9, 0x25, 0xa7, 0x40, 0xe4,
0xb1, 0x59, 0x04, 0x94, 0x7b, 0x30, 0x8c, 0x83, 0x6e, 0xf0, 0xa4, 0x3a, 0xba, 0xe5, 0x23, 0xba,
0x95, 0x0c, 0x43, 0xaf, 0xf4, 0xa6, 0x5b, 0x7d, 0x44, 0xb7, 0x1a, 0x96, 0xae, 0x6d, 0x86, 0x51,
0x40, 0x22, 0x00, 0x00, 0x7a, 0x89, 0xca, 0x92, 0x6e, 0xf9, 0x69, 0x42, 0x00, 0x00, 0x00, 0x00,
0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
};
const BITMAP_OPAQUE align_items_center_xpm[1] = {{ png, sizeof( png ), "align_items_center_xpm" }};
//EOF

View File

@ -0,0 +1,31 @@
/* Do not modify this file, it was automatically generated by the
* PNG2cpp CMake script, using a *.png file as input.
*/
#include <bitmaps.h>
static const unsigned char png[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x1a, 0x08, 0x06, 0x00, 0x00, 0x00, 0xa9, 0x4a, 0x4c,
0xce, 0x00, 0x00, 0x00, 0xe5, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0x63, 0x60, 0x18, 0x30, 0x20,
0xe5, 0xcb, 0xc5, 0x20, 0x17, 0x25, 0x88, 0x0b, 0xc7, 0x25, 0xa4, 0x3e, 0xc4, 0x27, 0x0f, 0xd6,
0x4f, 0x10, 0x28, 0x24, 0x70, 0x30, 0x2a, 0x87, 0xff, 0x62, 0x50, 0x0a, 0xfd, 0x4f, 0x2e, 0x06,
0xeb, 0x07, 0x9a, 0x83, 0xdf, 0x22, 0x95, 0x68, 0x3e, 0x90, 0x62, 0xef, 0xee, 0xd7, 0xff, 0xfd,
0x27, 0x7e, 0x21, 0x19, 0x83, 0xf4, 0x81, 0x2d, 0x04, 0x99, 0x43, 0x8c, 0x45, 0x01, 0x93, 0xbf,
0xfd, 0x0f, 0x9d, 0xf9, 0x9f, 0x64, 0x0c, 0xd2, 0x37, 0x38, 0x2d, 0xa2, 0x7d, 0xd0, 0xd1, 0x2d,
0x31, 0x10, 0x91, 0xbc, 0xe3, 0x13, 0x53, 0xff, 0x53, 0x9e, 0xbc, 0xb1, 0x01, 0x99, 0x50, 0x4e,
0xbc, 0x16, 0x81, 0xe4, 0x29, 0x06, 0xc6, 0x69, 0xac, 0xc0, 0xa0, 0xf8, 0x41, 0x20, 0xa8, 0x7e,
0x80, 0xd4, 0x51, 0x66, 0x11, 0xc8, 0xb5, 0x40, 0xc3, 0x7c, 0x7b, 0xdf, 0x61, 0x8d, 0x7c, 0x90,
0x38, 0xd8, 0x42, 0x8a, 0x7d, 0x05, 0xb5, 0x28, 0x68, 0xea, 0x4f, 0xac, 0xc9, 0x19, 0x24, 0x3e,
0x34, 0x2d, 0xa2, 0x7d, 0xd0, 0xd1, 0x2d, 0x31, 0xd0, 0x2d, 0x79, 0x63, 0x01, 0x69, 0x69, 0x69,
0xff, 0xc9, 0xd7, 0xed, 0xe0, 0xc0, 0xc2, 0xa8, 0x12, 0xfe, 0x9d, 0x92, 0xa2, 0x07, 0x23, 0x48,
0x41, 0xe6, 0x01, 0xcd, 0x45, 0x2b, 0x4c, 0x3d, 0xd9, 0x41, 0x92, 0xc1, 0xd3, 0x7e, 0x91, 0x55,
0x6a, 0xa3, 0x63, 0x90, 0x39, 0x90, 0xc2, 0x15, 0x68, 0xee, 0xa8, 0x45, 0xd4, 0xb1, 0x88, 0x6e,
0x89, 0x81, 0xb4, 0xe4, 0x7d, 0x97, 0x61, 0x30, 0x03, 0x00, 0xb8, 0x97, 0xbe, 0x3f, 0x90, 0xee,
0x47, 0x63, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
};
const BITMAP_OPAQUE align_items_middle_xpm[1] = {{ png, sizeof( png ), "align_items_middle_xpm" }};
//EOF

View File

@ -0,0 +1,494 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<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"
version="1.1"
width="26"
height="26"
viewBox="0 0 26 26"
id="svg2"
inkscape:version="0.91 r13725"
sodipodi:docname="align_items_center.svg">
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1600"
inkscape:window-height="824"
id="namedview93"
showgrid="true"
inkscape:zoom="18.805896"
inkscape:cx="5.5399721"
inkscape:cy="9.5578523"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1"
inkscape:current-layer="svg2"
inkscape:snap-grids="true"
inkscape:snap-bbox="true"
inkscape:object-nodes="true">
<inkscape:grid
type="xygrid"
id="grid3070"
empspacing="2"
visible="true"
enabled="true"
snapvisiblegridlinesonly="false"
spacingx="0.5"
spacingy="0.5" />
</sodipodi:namedview>
<metadata
id="metadata100">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs4">
<linearGradient
x1="14.463"
y1="12.285"
x2="34.534"
y2="39.685001"
id="linearGradient4067"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.2419,0,0,1.2419,36.866,-2.4533)">
<stop
id="stop4069"
style="stop-color:#c9c9c9;stop-opacity:1"
offset="0" />
<stop
id="stop4071"
style="stop-color:#f8f8f8;stop-opacity:1"
offset="0.44999999" />
<stop
id="stop4073"
style="stop-color:#e2e2e2;stop-opacity:1"
offset="0.66666645" />
<stop
id="stop4075"
style="stop-color:#b0b0b0;stop-opacity:1"
offset="0.95000005" />
<stop
id="stop4077"
style="stop-color:#c9c9c9;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="14.463"
y1="12.285"
x2="34.534"
y2="39.685001"
id="linearGradient4053"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.2419,0,0,1.2419,36.866,-2.4533)">
<stop
id="stop4055"
style="stop-color:#c9c9c9;stop-opacity:1"
offset="0" />
<stop
id="stop4057"
style="stop-color:#f8f8f8;stop-opacity:1"
offset="0.34999999" />
<stop
id="stop4059"
style="stop-color:#e2e2e2;stop-opacity:1"
offset="0.59999996" />
<stop
id="stop4061"
style="stop-color:#b0b0b0;stop-opacity:1"
offset="0.84999996" />
<stop
id="stop4063"
style="stop-color:#c9c9c9;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="28.079"
y1="12.338"
x2="30.431999"
y2="14.691"
id="h"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(6.3922,12.185)">
<stop
id="stop7"
style="stop-color:#fcaf3e;stop-opacity:1"
offset="0" />
<stop
id="stop9"
style="stop-color:#ce5c00;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="23.448"
y1="21.481001"
x2="22.809999"
y2="22.118999"
id="i"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(6.3922,12.185)">
<stop
id="stop12"
style="stop-color:#ce5c00;stop-opacity:1"
offset="0" />
<stop
id="stop14"
style="stop-color:#ce5c00;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="26.379"
y1="34.389999"
x2="25.485001"
y2="32.714001"
id="j"
gradientUnits="userSpaceOnUse">
<stop
id="stop17"
style="stop-color:#e9b96e;stop-opacity:1"
offset="0" />
<stop
id="stop19"
style="stop-color:#ffffff;stop-opacity:1"
offset="1" />
</linearGradient>
<radialGradient
cx="-138.84"
cy="128"
r="9.1267004"
id="l"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.35473,-0.34328,0.35696,0.34544,130.15,-71.026)">
<stop
id="stop22"
style="stop-color:#f9a9a9;stop-opacity:1"
offset="0" />
<stop
id="stop24"
style="stop-color:#ab5f5f;stop-opacity:1"
offset="1" />
</radialGradient>
<linearGradient
x1="-158.75"
y1="115.94"
x2="-158.75"
y2="134.25"
id="k"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.20949,-0.20274,0.20949,0.20274,129.28,-31.999)">
<stop
id="stop27"
style="stop-color:#dddddd;stop-opacity:1"
offset="0" />
<stop
id="stop29"
style="stop-color:#ffffff;stop-opacity:1"
offset="0.34468001" />
<stop
id="stop31"
style="stop-color:#737373;stop-opacity:1"
offset="0.72694999" />
<stop
id="stop33"
style="stop-color:#bbbbbb;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="-15.36"
y1="-3.7385001"
x2="253.64999"
y2="-20.465"
id="g"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.076209,0,0,0.0837,-38.77,12.013)">
<stop
id="stop36"
style="stop-color:#faff00;stop-opacity:1"
offset="0" />
<stop
id="stop38"
style="stop-color:#0bae09;stop-opacity:1"
offset="1" />
</linearGradient>
<radialGradient
cx="35.292999"
cy="20.493999"
r="16.955999"
id="e"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,-0.84302,1.0202,0,-4.8963249,41.059418)">
<stop
id="stop12-7"
style="stop-color:#73d216;stop-opacity:1"
offset="0" />
<stop
id="stop14-2"
style="stop-color:#4e9a06;stop-opacity:1"
offset="1" />
</radialGradient>
<radialGradient
cx="15.987"
cy="1.535"
r="17.171"
id="f"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,-2.0467,-1.5576,0,38.613235,65.406418)">
<stop
id="stop17-4"
style="stop-color:#ffffff;stop-opacity:1"
offset="0" />
<stop
id="stop19-5"
style="stop-color:#ffffff;stop-opacity:0"
offset="1" />
</radialGradient>
<linearGradient
x1="14.463"
y1="12.285"
x2="34.534"
y2="39.685001"
id="linearGradient3095"
xlink:href="#ad"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.41988578,0,0,0.39843199,7.8528064,8.6668249)" />
<linearGradient
x1="14.463"
y1="12.285"
x2="34.534"
y2="39.685001"
id="ad"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.2419,0,0,1.2419,36.866,-2.4533)">
<stop
id="stop34"
style="stop-color:#c9c9c9;stop-opacity:1"
offset="0" />
<stop
id="stop36-5"
style="stop-color:#f8f8f8;stop-opacity:1"
offset="0.25" />
<stop
id="stop38-6"
style="stop-color:#e2e2e2;stop-opacity:1"
offset="0.5" />
<stop
id="stop40"
style="stop-color:#b0b0b0;stop-opacity:1"
offset="0.75" />
<stop
id="stop42"
style="stop-color:#c9c9c9;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="-5"
y1="30.486"
x2="-5"
y2="28"
id="linearGradient4134"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-1.2091711,0,0,1.1263729,4.7731704,-27.330323)">
<stop
id="stop53-3"
style="stop-color:#d8cb00;stop-opacity:1"
offset="0" />
<stop
id="stop55-5"
style="stop-color:#fff119;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="10"
y1="44.015999"
x2="10"
y2="12.805"
id="linearGradient3074"
xlink:href="#linearGradient3125"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.60606203,0,0,0.60307714,-0.18961248,-2.9899238)" />
<linearGradient
x1="10"
y1="44.015999"
x2="10"
y2="12.805"
id="linearGradient3125"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.60606203,0,0,0.60307714,-0.18961248,-2.9899238)">
<stop
id="stop58-0"
style="stop-color:#ffffff;stop-opacity:1"
offset="0" />
<stop
id="stop60-2"
style="stop-color:#ffffff;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
x1="-5"
y1="30.486"
x2="-5"
y2="28"
id="linearGradient4134-6"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.2091711,0,0,1.2246864,11.81803,-14.894446)">
<stop
id="stop53-3-8"
style="stop-color:#d8cb00;stop-opacity:1"
offset="0" />
<stop
id="stop55-5-7"
style="stop-color:#fff119;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="10"
y1="44.015999"
x2="10"
y2="12.805"
id="linearGradient3074-6"
xlink:href="#linearGradient3125-5"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.60606203,0,0,0.60307714,-0.18961248,-2.9899238)" />
<linearGradient
x1="10"
y1="44.015999"
x2="10"
y2="12.805"
id="linearGradient3125-5"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.60606203,0,0,0.60307714,-0.18961248,-2.9899238)">
<stop
id="stop58-0-3"
style="stop-color:#ffffff;stop-opacity:1"
offset="0" />
<stop
id="stop60-2-9"
style="stop-color:#ffffff;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
x1="-5"
y1="30.486"
x2="-5"
y2="28"
id="linearGradient4134-3"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.2091711,0,0,1.2246864,11.81803,-14.894446)">
<stop
id="stop53-3-5"
style="stop-color:#d8cb00;stop-opacity:1"
offset="0" />
<stop
id="stop55-5-70"
style="stop-color:#fff119;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="10"
y1="44.015999"
x2="10"
y2="12.805"
id="linearGradient3074-8"
xlink:href="#linearGradient3125-2"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.60606203,0,0,0.60307714,-0.18961248,-2.9899238)" />
<linearGradient
x1="10"
y1="44.015999"
x2="10"
y2="12.805"
id="linearGradient3125-2"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.60606203,0,0,0.60307714,-0.18961248,-2.9899238)">
<stop
id="stop58-0-2"
style="stop-color:#ffffff;stop-opacity:1"
offset="0" />
<stop
id="stop60-2-94"
style="stop-color:#ffffff;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
x1="-5"
y1="30.486"
x2="-5"
y2="28"
id="linearGradient4134-7"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.2091711,0,0,1.2246864,11.81803,-23.190448)">
<stop
id="stop53-3-0"
style="stop-color:#d8cb00;stop-opacity:1"
offset="0" />
<stop
id="stop55-5-2"
style="stop-color:#fff119;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="10"
y1="44.015999"
x2="10"
y2="12.805"
id="linearGradient3125-9"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.60606203,0,0,0.60307714,-0.18961248,-2.9899238)">
<stop
id="stop58-0-9"
style="stop-color:#ffffff;stop-opacity:1"
offset="0" />
<stop
id="stop60-2-7"
style="stop-color:#ffffff;stop-opacity:0"
offset="1" />
</linearGradient>
</defs>
<g
transform="matrix(1.1081499,0,0,1.134214,16.587022,-4.1190902)"
id="g4574" />
<path
inkscape:connector-curvature="0"
d="m 1.49995,12.499996 23,0"
id="path3860"
style="fill:none;stroke:#666666;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
sodipodi:nodetypes="cc" />
<path
inkscape:connector-curvature="0"
id="path4216"
d="M 15.5,16.500046 15.5,8.5 l -5,0 0,8.000046 z"
style="fill:#5599ff;fill-opacity:1;stroke:#002255;stroke-width:1.06904829;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
sodipodi:nodetypes="ccccc" />
<path
sodipodi:nodetypes="ccccc"
style="fill:#5599ff;fill-opacity:1;stroke:#002255;stroke-width:1.05409384;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 23.49995,22.5 0,-20.00005 -5,0 0,20.00005 z"
id="path4218"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="ccccc"
style="fill:#5599ff;fill-opacity:1;stroke:#002255;stroke-width:1.10940218;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 7.49995,20.500046 0,-16.000046 -5,0 0,16.000046 z"
id="path4264"
inkscape:connector-curvature="0" />
</svg>

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -0,0 +1,498 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<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"
version="1.1"
width="26"
height="26"
viewBox="0 0 26 26"
id="svg2"
inkscape:version="0.91 r13725"
sodipodi:docname="align_items_middle.svg">
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1600"
inkscape:window-height="824"
id="namedview93"
showgrid="true"
inkscape:zoom="18.805896"
inkscape:cx="5.5399721"
inkscape:cy="9.5578523"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1"
inkscape:current-layer="svg2"
inkscape:snap-grids="true"
inkscape:snap-bbox="true"
inkscape:object-nodes="true">
<inkscape:grid
type="xygrid"
id="grid3070"
empspacing="2"
visible="true"
enabled="true"
snapvisiblegridlinesonly="false"
spacingx="0.5"
spacingy="0.5" />
</sodipodi:namedview>
<metadata
id="metadata100">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs4">
<linearGradient
x1="14.463"
y1="12.285"
x2="34.534"
y2="39.685001"
id="linearGradient4067"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.2419,0,0,1.2419,36.866,-2.4533)">
<stop
id="stop4069"
style="stop-color:#c9c9c9;stop-opacity:1"
offset="0" />
<stop
id="stop4071"
style="stop-color:#f8f8f8;stop-opacity:1"
offset="0.44999999" />
<stop
id="stop4073"
style="stop-color:#e2e2e2;stop-opacity:1"
offset="0.66666645" />
<stop
id="stop4075"
style="stop-color:#b0b0b0;stop-opacity:1"
offset="0.95000005" />
<stop
id="stop4077"
style="stop-color:#c9c9c9;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="14.463"
y1="12.285"
x2="34.534"
y2="39.685001"
id="linearGradient4053"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.2419,0,0,1.2419,36.866,-2.4533)">
<stop
id="stop4055"
style="stop-color:#c9c9c9;stop-opacity:1"
offset="0" />
<stop
id="stop4057"
style="stop-color:#f8f8f8;stop-opacity:1"
offset="0.34999999" />
<stop
id="stop4059"
style="stop-color:#e2e2e2;stop-opacity:1"
offset="0.59999996" />
<stop
id="stop4061"
style="stop-color:#b0b0b0;stop-opacity:1"
offset="0.84999996" />
<stop
id="stop4063"
style="stop-color:#c9c9c9;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="28.079"
y1="12.338"
x2="30.431999"
y2="14.691"
id="h"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(6.3922,12.185)">
<stop
id="stop7"
style="stop-color:#fcaf3e;stop-opacity:1"
offset="0" />
<stop
id="stop9"
style="stop-color:#ce5c00;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="23.448"
y1="21.481001"
x2="22.809999"
y2="22.118999"
id="i"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(6.3922,12.185)">
<stop
id="stop12"
style="stop-color:#ce5c00;stop-opacity:1"
offset="0" />
<stop
id="stop14"
style="stop-color:#ce5c00;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="26.379"
y1="34.389999"
x2="25.485001"
y2="32.714001"
id="j"
gradientUnits="userSpaceOnUse">
<stop
id="stop17"
style="stop-color:#e9b96e;stop-opacity:1"
offset="0" />
<stop
id="stop19"
style="stop-color:#ffffff;stop-opacity:1"
offset="1" />
</linearGradient>
<radialGradient
cx="-138.84"
cy="128"
r="9.1267004"
id="l"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.35473,-0.34328,0.35696,0.34544,130.15,-71.026)">
<stop
id="stop22"
style="stop-color:#f9a9a9;stop-opacity:1"
offset="0" />
<stop
id="stop24"
style="stop-color:#ab5f5f;stop-opacity:1"
offset="1" />
</radialGradient>
<linearGradient
x1="-158.75"
y1="115.94"
x2="-158.75"
y2="134.25"
id="k"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.20949,-0.20274,0.20949,0.20274,129.28,-31.999)">
<stop
id="stop27"
style="stop-color:#dddddd;stop-opacity:1"
offset="0" />
<stop
id="stop29"
style="stop-color:#ffffff;stop-opacity:1"
offset="0.34468001" />
<stop
id="stop31"
style="stop-color:#737373;stop-opacity:1"
offset="0.72694999" />
<stop
id="stop33"
style="stop-color:#bbbbbb;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="-15.36"
y1="-3.7385001"
x2="253.64999"
y2="-20.465"
id="g"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.076209,0,0,0.0837,-38.77,12.013)">
<stop
id="stop36"
style="stop-color:#faff00;stop-opacity:1"
offset="0" />
<stop
id="stop38"
style="stop-color:#0bae09;stop-opacity:1"
offset="1" />
</linearGradient>
<radialGradient
cx="35.292999"
cy="20.493999"
r="16.955999"
id="e"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,-0.84302,1.0202,0,-4.8963249,41.059418)">
<stop
id="stop12-7"
style="stop-color:#73d216;stop-opacity:1"
offset="0" />
<stop
id="stop14-2"
style="stop-color:#4e9a06;stop-opacity:1"
offset="1" />
</radialGradient>
<radialGradient
cx="15.987"
cy="1.535"
r="17.171"
id="f"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,-2.0467,-1.5576,0,38.613235,65.406418)">
<stop
id="stop17-4"
style="stop-color:#ffffff;stop-opacity:1"
offset="0" />
<stop
id="stop19-5"
style="stop-color:#ffffff;stop-opacity:0"
offset="1" />
</radialGradient>
<linearGradient
x1="14.463"
y1="12.285"
x2="34.534"
y2="39.685001"
id="linearGradient3095"
xlink:href="#ad"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.41988578,0,0,0.39843199,7.8528064,8.6668249)" />
<linearGradient
x1="14.463"
y1="12.285"
x2="34.534"
y2="39.685001"
id="ad"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.2419,0,0,1.2419,36.866,-2.4533)">
<stop
id="stop34"
style="stop-color:#c9c9c9;stop-opacity:1"
offset="0" />
<stop
id="stop36-5"
style="stop-color:#f8f8f8;stop-opacity:1"
offset="0.25" />
<stop
id="stop38-6"
style="stop-color:#e2e2e2;stop-opacity:1"
offset="0.5" />
<stop
id="stop40"
style="stop-color:#b0b0b0;stop-opacity:1"
offset="0.75" />
<stop
id="stop42"
style="stop-color:#c9c9c9;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="-5"
y1="30.486"
x2="-5"
y2="28"
id="linearGradient4134"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-1.2091711,0,0,1.1263729,4.7731704,-27.330323)">
<stop
id="stop53-3"
style="stop-color:#d8cb00;stop-opacity:1"
offset="0" />
<stop
id="stop55-5"
style="stop-color:#fff119;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="10"
y1="44.015999"
x2="10"
y2="12.805"
id="linearGradient3074"
xlink:href="#linearGradient3125"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.60606203,0,0,0.60307714,-0.18961248,-2.9899238)" />
<linearGradient
x1="10"
y1="44.015999"
x2="10"
y2="12.805"
id="linearGradient3125"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.60606203,0,0,0.60307714,-0.18961248,-2.9899238)">
<stop
id="stop58-0"
style="stop-color:#ffffff;stop-opacity:1"
offset="0" />
<stop
id="stop60-2"
style="stop-color:#ffffff;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
x1="-5"
y1="30.486"
x2="-5"
y2="28"
id="linearGradient4134-6"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.2091711,0,0,1.2246864,11.81803,-14.894446)">
<stop
id="stop53-3-8"
style="stop-color:#d8cb00;stop-opacity:1"
offset="0" />
<stop
id="stop55-5-7"
style="stop-color:#fff119;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="10"
y1="44.015999"
x2="10"
y2="12.805"
id="linearGradient3074-6"
xlink:href="#linearGradient3125-5"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.60606203,0,0,0.60307714,-0.18961248,-2.9899238)" />
<linearGradient
x1="10"
y1="44.015999"
x2="10"
y2="12.805"
id="linearGradient3125-5"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.60606203,0,0,0.60307714,-0.18961248,-2.9899238)">
<stop
id="stop58-0-3"
style="stop-color:#ffffff;stop-opacity:1"
offset="0" />
<stop
id="stop60-2-9"
style="stop-color:#ffffff;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
x1="-5"
y1="30.486"
x2="-5"
y2="28"
id="linearGradient4134-3"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.2091711,0,0,1.2246864,11.81803,-14.894446)">
<stop
id="stop53-3-5"
style="stop-color:#d8cb00;stop-opacity:1"
offset="0" />
<stop
id="stop55-5-70"
style="stop-color:#fff119;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="10"
y1="44.015999"
x2="10"
y2="12.805"
id="linearGradient3074-8"
xlink:href="#linearGradient3125-2"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.60606203,0,0,0.60307714,-0.18961248,-2.9899238)" />
<linearGradient
x1="10"
y1="44.015999"
x2="10"
y2="12.805"
id="linearGradient3125-2"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.60606203,0,0,0.60307714,-0.18961248,-2.9899238)">
<stop
id="stop58-0-2"
style="stop-color:#ffffff;stop-opacity:1"
offset="0" />
<stop
id="stop60-2-94"
style="stop-color:#ffffff;stop-opacity:0"
offset="1" />
</linearGradient>
<linearGradient
x1="-5"
y1="30.486"
x2="-5"
y2="28"
id="linearGradient4134-7"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.2091711,0,0,1.2246864,11.81803,-23.190448)">
<stop
id="stop53-3-0"
style="stop-color:#d8cb00;stop-opacity:1"
offset="0" />
<stop
id="stop55-5-2"
style="stop-color:#fff119;stop-opacity:1"
offset="1" />
</linearGradient>
<linearGradient
x1="10"
y1="44.015999"
x2="10"
y2="12.805"
id="linearGradient3125-9"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.60606203,0,0,0.60307714,-0.18961248,-2.9899238)">
<stop
id="stop58-0-9"
style="stop-color:#ffffff;stop-opacity:1"
offset="0" />
<stop
id="stop60-2-7"
style="stop-color:#ffffff;stop-opacity:0"
offset="1" />
</linearGradient>
</defs>
<g
transform="matrix(1.1081499,0,0,1.134214,16.587022,-4.1190902)"
id="g4574" />
<g
id="g4841"
transform="matrix(0,1,-1,0,25.000046,0)">
<path
sodipodi:nodetypes="cc"
style="fill:none;stroke:#666666;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
id="path3860"
d="m 1.49995,12.499996 23,0"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="ccccc"
style="fill:#5599ff;fill-opacity:1;stroke:#002255;stroke-width:1.06904829;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 15.5,16.500046 15.5,8.5 l -5,0 0,8.000046 z"
id="path4216"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
id="path4218"
d="m 23.49995,22.5 0,-20.00005 -5,0 0,20.00005 z"
style="fill:#5599ff;fill-opacity:1;stroke:#002255;stroke-width:1.05409384;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
sodipodi:nodetypes="ccccc" />
<path
inkscape:connector-curvature="0"
id="path4264"
d="m 7.49995,20.500046 0,-16.000046 -5,0 0,16.000046 z"
style="fill:#5599ff;fill-opacity:1;stroke:#002255;stroke-width:1.10940218;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
sodipodi:nodetypes="ccccc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -67,6 +67,8 @@ EXTERN_BITMAP( annotate_down_right_xpm )
EXTERN_BITMAP( annotate_right_down_xpm ) EXTERN_BITMAP( annotate_right_down_xpm )
EXTERN_BITMAP( annotate_xpm ) EXTERN_BITMAP( annotate_xpm )
EXTERN_BITMAP( align_items_xpm ) EXTERN_BITMAP( align_items_xpm )
EXTERN_BITMAP( align_items_center_xpm )
EXTERN_BITMAP( align_items_middle_xpm )
EXTERN_BITMAP( apply_pad_settings_xpm ) EXTERN_BITMAP( apply_pad_settings_xpm )
EXTERN_BITMAP( array_xpm ) EXTERN_BITMAP( array_xpm )
EXTERN_BITMAP( auto_associe_xpm ) EXTERN_BITMAP( auto_associe_xpm )

View File

@ -234,6 +234,12 @@ public:
/// Align items to the right edge of selection bounding box /// Align items to the right edge of selection bounding box
static TOOL_ACTION alignRight; static TOOL_ACTION alignRight;
/// Align items to the middle of selection bounding box
static TOOL_ACTION alignCenterX;
/// Align items to the center of selection bounding box
static TOOL_ACTION alignCenterY;
/// Distributes items evenly along the horizontal axis /// Distributes items evenly along the horizontal axis
static TOOL_ACTION distributeHorizontally; static TOOL_ACTION distributeHorizontally;

View File

@ -57,6 +57,16 @@ TOOL_ACTION PCB_ACTIONS::alignRight( "pcbnew.AlignAndDistribute.alignRight",
_( "Align to Right" ), _( "Align to Right" ),
_( "Aligns selected items to the right edge" ), right_xpm ); _( "Aligns selected items to the right edge" ), right_xpm );
TOOL_ACTION PCB_ACTIONS::alignCenterX( "pcbnew.AlignAndDistribute.alignCenterX",
AS_GLOBAL, 0,
_( "Align to Middle" ),
_( "Aligns selected items to the vertical center" ), align_items_middle_xpm );
TOOL_ACTION PCB_ACTIONS::alignCenterY( "pcbnew.AlignAndDistribute.alignCenterY",
AS_GLOBAL, 0,
_( "Align to Center" ),
_( "Aligns selected items to the horizontal center" ), align_items_center_xpm );
TOOL_ACTION PCB_ACTIONS::distributeHorizontally( "pcbnew.AlignAndDistribute.distributeHorizontally", TOOL_ACTION PCB_ACTIONS::distributeHorizontally( "pcbnew.AlignAndDistribute.distributeHorizontally",
AS_GLOBAL, 0, AS_GLOBAL, 0,
_( "Distribute Horizontally" ), _( "Distribute Horizontally" ),
@ -100,6 +110,8 @@ bool ALIGN_DISTRIBUTE_TOOL::Init()
m_placementMenu->Add( PCB_ACTIONS::alignBottom ); m_placementMenu->Add( PCB_ACTIONS::alignBottom );
m_placementMenu->Add( PCB_ACTIONS::alignLeft ); m_placementMenu->Add( PCB_ACTIONS::alignLeft );
m_placementMenu->Add( PCB_ACTIONS::alignRight ); m_placementMenu->Add( PCB_ACTIONS::alignRight );
m_placementMenu->Add( PCB_ACTIONS::alignCenterX );
m_placementMenu->Add( PCB_ACTIONS::alignCenterY );
m_placementMenu->AppendSeparator(); m_placementMenu->AppendSeparator();
m_placementMenu->Add( PCB_ACTIONS::distributeHorizontally ); m_placementMenu->Add( PCB_ACTIONS::distributeHorizontally );
m_placementMenu->Add( PCB_ACTIONS::distributeVertically ); m_placementMenu->Add( PCB_ACTIONS::distributeVertically );
@ -126,6 +138,16 @@ bool SortTopmostY( const std::pair<BOARD_ITEM*, EDA_RECT> left, const std::pair<
return ( left.second.GetY() < right.second.GetY() ); return ( left.second.GetY() < right.second.GetY() );
} }
bool SortCenterX( const std::pair<BOARD_ITEM*, EDA_RECT> left, const std::pair<BOARD_ITEM*, EDA_RECT> right)
{
return ( left.second.GetCenter().x < right.second.GetCenter().x );
}
bool SortCenterY( const std::pair<BOARD_ITEM*, EDA_RECT> left, const std::pair<BOARD_ITEM*, EDA_RECT> right)
{
return ( left.second.GetCenter().y < right.second.GetCenter().y );
}
bool SortBottommostY( const std::pair<BOARD_ITEM*, EDA_RECT> left, const std::pair<BOARD_ITEM*, EDA_RECT> right) bool SortBottommostY( const std::pair<BOARD_ITEM*, EDA_RECT> left, const std::pair<BOARD_ITEM*, EDA_RECT> right)
{ {
return ( left.second.GetBottom() > right.second.GetBottom() ); return ( left.second.GetBottom() > right.second.GetBottom() );
@ -298,6 +320,64 @@ int ALIGN_DISTRIBUTE_TOOL::doAlignRight()
} }
int ALIGN_DISTRIBUTE_TOOL::AlignCenterX( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
if( selection.Size() <= 1 )
return 0;
BOARD_COMMIT commit( getEditFrame<PCB_BASE_FRAME>() );
commit.StageItems( selection, CHT_MODIFY );
auto itemsToAlign = GetBoundingBoxes( selection );
std::sort( itemsToAlign.begin(), itemsToAlign.end(), SortCenterX );
// after sorting use the x coordinate of the middle item as a target for all other items
const int targetX = itemsToAlign.at( itemsToAlign.size() / 2 ).second.GetCenter().x;
// Move the selected items
for( auto& i : itemsToAlign )
{
int difference = targetX - i.second.GetCenter().x;
i.first->Move( wxPoint( difference, 0 ) );
}
commit.Push( _( "Align to middle" ) );
return 0;
}
int ALIGN_DISTRIBUTE_TOOL::AlignCenterY( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
if( selection.Size() <= 1 )
return 0;
BOARD_COMMIT commit( getEditFrame<PCB_BASE_FRAME>() );
commit.StageItems( selection, CHT_MODIFY );
auto itemsToAlign = GetBoundingBoxes( selection );
std::sort( itemsToAlign.begin(), itemsToAlign.end(), SortCenterY );
// after sorting use the y coordinate of the middle item as a target for all other items
const int targetY = itemsToAlign.at( itemsToAlign.size() / 2 ).second.GetCenter().y;
// Move the selected items
for( auto& i : itemsToAlign )
{
int difference = targetY - i.second.GetCenter().y;
i.first->Move( wxPoint( 0, difference ) );
}
commit.Push( _( "Align to center" ) );
return 0;
}
int ALIGN_DISTRIBUTE_TOOL::DistributeHorizontally( const TOOL_EVENT& aEvent ) int ALIGN_DISTRIBUTE_TOOL::DistributeHorizontally( const TOOL_EVENT& aEvent )
{ {
const SELECTION& selection = m_selectionTool->GetSelection(); const SELECTION& selection = m_selectionTool->GetSelection();
@ -401,6 +481,8 @@ void ALIGN_DISTRIBUTE_TOOL::setTransitions()
Go( &ALIGN_DISTRIBUTE_TOOL::AlignBottom, PCB_ACTIONS::alignBottom.MakeEvent() ); Go( &ALIGN_DISTRIBUTE_TOOL::AlignBottom, PCB_ACTIONS::alignBottom.MakeEvent() );
Go( &ALIGN_DISTRIBUTE_TOOL::AlignLeft, PCB_ACTIONS::alignLeft.MakeEvent() ); Go( &ALIGN_DISTRIBUTE_TOOL::AlignLeft, PCB_ACTIONS::alignLeft.MakeEvent() );
Go( &ALIGN_DISTRIBUTE_TOOL::AlignRight, PCB_ACTIONS::alignRight.MakeEvent() ); Go( &ALIGN_DISTRIBUTE_TOOL::AlignRight, PCB_ACTIONS::alignRight.MakeEvent() );
Go( &ALIGN_DISTRIBUTE_TOOL::AlignCenterX, PCB_ACTIONS::alignCenterX.MakeEvent() );
Go( &ALIGN_DISTRIBUTE_TOOL::AlignCenterY, PCB_ACTIONS::alignCenterY.MakeEvent() );
Go( &ALIGN_DISTRIBUTE_TOOL::DistributeHorizontally, PCB_ACTIONS::distributeHorizontally.MakeEvent() ); Go( &ALIGN_DISTRIBUTE_TOOL::DistributeHorizontally, PCB_ACTIONS::distributeHorizontally.MakeEvent() );
Go( &ALIGN_DISTRIBUTE_TOOL::DistributeVertically, PCB_ACTIONS::distributeVertically.MakeEvent() ); Go( &ALIGN_DISTRIBUTE_TOOL::DistributeVertically, PCB_ACTIONS::distributeVertically.MakeEvent() );

View File

@ -68,6 +68,20 @@ public:
*/ */
int AlignRight( const TOOL_EVENT& aEvent ); int AlignRight( const TOOL_EVENT& aEvent );
/**
* Function AlignCenterX()
* Sets the x coordinate of the midpoint of each of the selected items to
* the value of the x coordinate of the center of the middle selected item.
*/
int AlignCenterX( const TOOL_EVENT& aEvent );
/**
* Function AlignCenterX()
* Sets the y coordinate of the midpoint of each of the selected items to
* the value of the y coordinate of the center of the middle selected item.
*/
int AlignCenterY( const TOOL_EVENT& aEvent );
/** /**
* Function DistributeHorizontally() * Function DistributeHorizontally()
* Distributes the selected items along the X axis. * Distributes the selected items along the X axis.