Commit 018b0800 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: Add keepout areas (Copper zones without tracks or/and vias).

This is *a work in progress*, so some features are missing, and/or could be modified.
Mainly keepout zones are not yet exported to autorouters, and pads are not taken in account.
Some code cleanup in polygon.*
parent 0bdec796
...@@ -129,6 +129,7 @@ set( BMAPS_MID ...@@ -129,6 +129,7 @@ set( BMAPS_MID
add_hierar_pin add_hierar_pin
add_hierarchical_subsheet add_hierarchical_subsheet
add_junction add_junction
add_keepout_area
add_line2bus add_line2bus
add_line_label add_line_label
add_line add_line
......
/* 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, 0x04, 0x0b, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0xbd, 0xd6, 0x5f, 0x4c, 0x53,
0x57, 0x1c, 0x07, 0xf0, 0x5b, 0x4a, 0x59, 0x41, 0x18, 0xcc, 0x44, 0xd4, 0x42, 0x81, 0xd2, 0xd6,
0x21, 0xd3, 0x0d, 0xc7, 0xc0, 0xc4, 0xd0, 0x0c, 0x1a, 0x61, 0xe8, 0x58, 0x04, 0x16, 0x15, 0x87,
0x32, 0x08, 0x43, 0x83, 0xcc, 0x4c, 0x37, 0x56, 0xa0, 0x02, 0x86, 0xe0, 0xa4, 0x30, 0x81, 0xc1,
0x1c, 0x6a, 0x41, 0xf9, 0x53, 0x6a, 0xe5, 0x6f, 0x0b, 0x88, 0x80, 0xe0, 0xda, 0x52, 0xda, 0x42,
0xf4, 0x61, 0xcf, 0x4b, 0x7c, 0x59, 0x32, 0x93, 0xbd, 0x2c, 0xf1, 0xdf, 0x93, 0x8c, 0xef, 0x7a,
0x6f, 0xd3, 0xd3, 0x15, 0xda, 0x72, 0xb7, 0x87, 0x3d, 0x7c, 0xdb, 0xdb, 0x7b, 0xcf, 0xf9, 0x7d,
0xee, 0x39, 0x3d, 0xf7, 0x0f, 0x05, 0x80, 0xfa, 0x3f, 0xc2, 0x7c, 0xc4, 0xbe, 0x1d, 0xf4, 0x4b,
0x94, 0x24, 0xe0, 0x35, 0x9d, 0xb4, 0x0c, 0xce, 0x6a, 0xe1, 0x29, 0xce, 0x5a, 0x45, 0x05, 0xb5,
0x76, 0xfe, 0x3c, 0x85, 0xa2, 0x62, 0xce, 0x5a, 0xd6, 0x61, 0xce, 0x5f, 0xd1, 0x52, 0xe7, 0xf1,
0xff, 0x90, 0x17, 0x04, 0x12, 0xef, 0x09, 0x7d, 0xd2, 0xa0, 0x56, 0xe1, 0x72, 0x6b, 0x2a, 0x6a,
0xaa, 0x29, 0xaf, 0x69, 0xb8, 0x22, 0x85, 0xfa, 0x7e, 0x3f, 0x7a, 0x8d, 0x73, 0xac, 0x73, 0x7d,
0x7a, 0x0c, 0x51, 0x52, 0xee, 0x6b, 0x0f, 0xe8, 0x92, 0x6a, 0x3d, 0xc2, 0xc1, 0xc5, 0xda, 0x10,
0x8f, 0x7d, 0x8d, 0xcd, 0x89, 0xd0, 0x2d, 0x5b, 0x70, 0x77, 0xc5, 0xca, 0x2a, 0x34, 0xe6, 0x01,
0xa5, 0x65, 0xf0, 0x9f, 0xba, 0x8a, 0x29, 0x6b, 0xb8, 0x68, 0xef, 0x2d, 0xc2, 0x80, 0x71, 0xd4,
0xd1, 0x78, 0x09, 0x3d, 0xd3, 0xd7, 0x50, 0xdf, 0x10, 0x49, 0x30, 0x65, 0xf7, 0x51, 0xd4, 0x4c,
0xb4, 0x42, 0x61, 0x68, 0xc1, 0x80, 0xed, 0xe7, 0x7f, 0x07, 0xe5, 0x1d, 0xe3, 0xfd, 0xe9, 0x2a,
0xa4, 0xea, 0x90, 0x6d, 0xe8, 0xd0, 0x35, 0x5c, 0x43, 0xa0, 0xfc, 0x2a, 0x0a, 0x5c, 0x85, 0x33,
0x1f, 0xb4, 0x1d, 0x80, 0x76, 0x79, 0x91, 0x3d, 0x54, 0x52, 0xca, 0x7d, 0xe5, 0x2a, 0x74, 0xd3,
0xd0, 0xb4, 0xa1, 0xc3, 0x1d, 0xc7, 0x99, 0x2b, 0x95, 0x3c, 0xe6, 0xf8, 0x99, 0x6a, 0x37, 0x44,
0x47, 0xf6, 0x63, 0x16, 0x74, 0x8e, 0x91, 0xb3, 0x82, 0x0a, 0x0a, 0x03, 0x9f, 0xb9, 0xa0, 0x1f,
0xfa, 0x4a, 0x36, 0x74, 0x18, 0x5c, 0x9c, 0x22, 0x23, 0x3a, 0xb9, 0x0e, 0xa2, 0x93, 0x7d, 0x33,
0x9f, 0x1d, 0x74, 0xf0, 0xd0, 0x1b, 0x7f, 0xd4, 0x56, 0x52, 0x68, 0xfa, 0x82, 0x83, 0xba, 0x4b,
0x6f, 0x41, 0x63, 0x9e, 0x20, 0x8d, 0x75, 0x76, 0x13, 0x5a, 0xba, 0xb2, 0x09, 0x54, 0xd6, 0x24,
0xc5, 0xc7, 0xea, 0x63, 0x4c, 0xc2, 0x6b, 0xc3, 0x09, 0xf6, 0xe9, 0xed, 0xe2, 0xcd, 0x21, 0xc9,
0xde, 0xd0, 0x27, 0x5a, 0xf9, 0x56, 0x98, 0xb7, 0x71, 0x61, 0xd8, 0xcb, 0x45, 0xc7, 0x09, 0x2e,
0x9a, 0x3b, 0xe5, 0x68, 0xeb, 0x39, 0x8e, 0xba, 0xfa, 0x70, 0xf7, 0x42, 0x70, 0x4c, 0x5f, 0xdf,
0x82, 0x96, 0x14, 0xba, 0x7a, 0xa7, 0x15, 0x29, 0xc5, 0x7c, 0x82, 0x15, 0x0d, 0x9e, 0xf3, 0x0f,
0xe5, 0x8a, 0x42, 0x7e, 0xb7, 0x08, 0x22, 0x61, 0x8e, 0x0c, 0x62, 0x30, 0x3a, 0x33, 0x62, 0x2e,
0x5a, 0x4a, 0x38, 0x1e, 0xcb, 0xbb, 0x53, 0x53, 0xce, 0x14, 0x98, 0xe8, 0xbe, 0x01, 0x53, 0xce,
0x61, 0x2c, 0x8b, 0xe2, 0x60, 0x16, 0xee, 0x40, 0xe1, 0x47, 0x3c, 0x06, 0x0a, 0x54, 0x70, 0x50,
0x3e, 0xa4, 0xf4, 0x0d, 0xc9, 0xa4, 0x21, 0xbf, 0x8d, 0xe6, 0xe5, 0xc0, 0x26, 0x15, 0xc3, 0xb2,
0x63, 0x0b, 0xc1, 0x4c, 0x91, 0x5c, 0xdc, 0xca, 0x0a, 0x40, 0x7d, 0x7d, 0x04, 0x6e, 0x8c, 0x37,
0x62, 0xb2, 0xb3, 0x1d, 0x66, 0x79, 0x3a, 0x03, 0xd0, 0x59, 0x4c, 0xff, 0x10, 0xe3, 0x43, 0x5a,
0x5c, 0x18, 0x6b, 0x44, 0x60, 0x55, 0x00, 0x83, 0xf1, 0x1c, 0xdf, 0x95, 0xfa, 0x2b, 0xde, 0x21,
0xfa, 0x82, 0x6d, 0x1e, 0x54, 0x63, 0x78, 0x61, 0x0e, 0x33, 0xca, 0x2a, 0x2c, 0xbd, 0x93, 0x00,
0xab, 0x70, 0x3b, 0xac, 0xd1, 0xdb, 0x60, 0x8b, 0x11, 0xc0, 0x94, 0x99, 0x81, 0x87, 0xc7, 0x8f,
0x12, 0xc0, 0x2e, 0x11, 0x63, 0x56, 0xf1, 0x0d, 0x86, 0x6c, 0xee, 0xa5, 0x7d, 0xfa, 0xae, 0x82,
0x4c, 0x21, 0xbf, 0x9a, 0x87, 0xba, 0xa9, 0x0e, 0xdf, 0x90, 0xab, 0xd3, 0xc8, 0x83, 0xfb, 0xee,
0xc2, 0x31, 0x42, 0x3c, 0x0a, 0x0b, 0x73, 0x24, 0x14, 0xcb, 0xb1, 0x31, 0x58, 0x7a, 0x7f, 0x1f,
0xc6, 0x47, 0x74, 0x5e, 0x57, 0xd9, 0x89, 0xfe, 0x33, 0x04, 0xdb, 0xa2, 0x0c, 0x46, 0xbd, 0xa1,
0xd3, 0x3f, 0xe4, 0xca, 0x6c, 0xe5, 0xd7, 0x0c, 0xf2, 0x98, 0xcf, 0x67, 0xf2, 0x28, 0x22, 0x02,
0xfa, 0x81, 0x5e, 0xbf, 0x77, 0x83, 0x4f, 0xba, 0x0b, 0x08, 0xf6, 0xe6, 0xc5, 0x30, 0x6c, 0x4f,
0x0e, 0x58, 0xf5, 0x0b, 0xdd, 0x53, 0x7d, 0x07, 0xbb, 0x54, 0x82, 0x95, 0xe8, 0x28, 0x3c, 0x0e,
0x09, 0x61, 0xb2, 0x22, 0x8c, 0x86, 0xf9, 0xa0, 0x1c, 0x43, 0x56, 0xb3, 0x4f, 0x88, 0xbe, 0x78,
0xd3, 0x7f, 0x3a, 0x44, 0xb0, 0xa0, 0x2f, 0x69, 0xc2, 0x07, 0x34, 0x79, 0xad, 0xc3, 0x31, 0x6d,
0x22, 0xf7, 0x7f, 0xe2, 0x00, 0xed, 0x12, 0x09, 0xf9, 0x3d, 0x5f, 0x56, 0xea, 0x77, 0x54, 0xf4,
0x6d, 0x29, 0xa5, 0x3d, 0xcd, 0x89, 0x55, 0xfa, 0x80, 0xe8, 0xf9, 0xb7, 0xed, 0x4e, 0x20, 0x45,
0x6d, 0x89, 0xbb, 0x31, 0xae, 0xd3, 0x40, 0xaf, 0xed, 0x67, 0xb6, 0x5d, 0xfb, 0xa7, 0xda, 0xbe,
0xf7, 0x8b, 0x69, 0x6c, 0x46, 0x24, 0xaa, 0xde, 0x05, 0xf7, 0x5b, 0x2f, 0x10, 0xbd, 0xea, 0x96,
0x52, 0x53, 0x48, 0x31, 0x3a, 0xf7, 0xae, 0x36, 0x93, 0xce, 0x7a, 0x4d, 0x1f, 0x39, 0x09, 0x6b,
0xd2, 0x7b, 0x18, 0x36, 0x2d, 0xf8, 0xc5, 0xba, 0xe6, 0xf5, 0xe0, 0x9f, 0xe6, 0xac, 0x6d, 0x80,
0x16, 0x8a, 0x8b, 0x3c, 0x10, 0x63, 0xee, 0x91, 0x0d, 0x9d, 0x0d, 0xbd, 0x3d, 0xb0, 0xc7, 0x3b,
0xa7, 0x75, 0xee, 0xdc, 0xd9, 0x4d, 0x1f, 0x13, 0x3b, 0xf7, 0xac, 0x5b, 0x75, 0xd7, 0x2f, 0xd7,
0x7a, 0xfc, 0x2f, 0xf4, 0x99, 0x8f, 0x4e, 0x4f, 0x7a, 0x2d, 0xf0, 0xa0, 0xa2, 0x9c, 0x5c, 0x4f,
0x63, 0x86, 0x51, 0xf6, 0x8f, 0x09, 0xa9, 0x03, 0x9a, 0x4b, 0x4e, 0xf2, 0x18, 0xcd, 0x4c, 0xb5,
0xc2, 0x67, 0x81, 0xa1, 0x45, 0x23, 0x2c, 0xfb, 0x53, 0x9d, 0xa3, 0xce, 0x3b, 0xc2, 0x1e, 0xca,
0x8f, 0x0b, 0x7e, 0x6a, 0x89, 0x12, 0xfc, 0x63, 0x01, 0x24, 0x62, 0xd8, 0x38, 0xef, 0x77, 0x5a,
0x0c, 0xb7, 0xd4, 0xa4, 0xbd, 0xbe, 0xff, 0x36, 0x3b, 0x88, 0x9e, 0xba, 0x81, 0xb3, 0xa5, 0xb0,
0x8b, 0xe3, 0x99, 0x8e, 0xb3, 0x17, 0xbe, 0x62, 0xf5, 0x4e, 0xb0, 0xf0, 0xf9, 0x29, 0xa6, 0xfd,
0xc3, 0xcf, 0x0a, 0xd8, 0x41, 0xa2, 0xc4, 0xe0, 0x5f, 0x93, 0x64, 0xb1, 0x2f, 0x4f, 0xa6, 0xc4,
0xbe, 0x1c, 0xd9, 0x1a, 0xba, 0x2a, 0x4f, 0xdf, 0xf5, 0x7c, 0x7f, 0x66, 0xc2, 0xb3, 0xcd, 0x92,
0x2d, 0x93, 0xbc, 0xa0, 0xdb, 0x97, 0xed, 0x13, 0xbe, 0xf2, 0x76, 0x3c, 0x55, 0xbe, 0xeb, 0x39,
0xfd, 0xca, 0x45, 0x20, 0x81, 0x98, 0x3a, 0xb0, 0x53, 0x4c, 0x65, 0xd3, 0x49, 0x8e, 0xa3, 0x72,
0x5d, 0xdb, 0x6c, 0x22, 0x8d, 0xa7, 0x72, 0xfc, 0x1d, 0x17, 0x88, 0xa8, 0x4c, 0xda, 0xf8, 0x1b,
0x60, 0x76, 0x60, 0xa1, 0x4e, 0x22, 0xae, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44,
0xae, 0x42, 0x60, 0x82,
};
const BITMAP_OPAQUE add_keepout_area_xpm[1] = {{ png, sizeof( png ), "add_keepout_area_xpm" }};
//EOF
<?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"
height="26"
width="26"
version="1.1"
id="svg2"
inkscape:version="0.48.1 "
sodipodi:docname="add_keepout_area.svg">
<metadata
id="metadata14">
<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="defs12">
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3165"
id="linearGradient3147"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.0243903,0,0,1.0355608,-35.845375,-31.825111)"
x1="10"
y1="2.5"
x2="15.409858"
y2="21.491209" />
<linearGradient
id="linearGradient3165">
<stop
id="stop5217"
offset="0"
style="stop-color:#f48e86;stop-opacity:0.99607843;" />
<stop
style="stop-color:#bf2c21;stop-opacity:0.99607843;"
offset="0.5"
id="stop5223" />
<stop
style="stop-color:#48130f;stop-opacity:0.99607843;"
offset="1"
id="stop5221" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3165"
id="linearGradient3149"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.0243903,0,0,1.0355608,-35.33318,-31.825111)"
x1="9.5"
y1="2.5"
x2="14.909858"
y2="21.491209" />
<linearGradient
id="linearGradient8262">
<stop
style="stop-color:#f68273;stop-opacity:1;"
offset="0"
id="stop8264" />
<stop
id="stop8266"
offset="0.5"
style="stop-color:#cd2923;stop-opacity:1;" />
<stop
style="stop-color:#8c0000;stop-opacity:1"
offset="1"
id="stop8268" />
</linearGradient>
<linearGradient
y2="21.491209"
x2="14.909858"
y1="2.5"
x1="9.5"
gradientTransform="matrix(1.0243903,0,0,1.0355608,-35.33318,-31.825111)"
gradientUnits="userSpaceOnUse"
id="linearGradient8273"
xlink:href="#linearGradient3165"
inkscape:collect="always" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3165"
id="linearGradient5212"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.96823216,0,0,0.98360286,21.081824,17.367375)"
x1="9.5"
y1="2.5"
x2="14.909858"
y2="21.491209" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3165"
id="linearGradient5215"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.96823216,0,0,0.98360286,21.903889,16.869782)"
x1="10"
y1="2.5"
x2="15.409858"
y2="21.491209" />
</defs>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1280"
inkscape:window-height="968"
id="namedview10"
showgrid="true"
inkscape:snap-grids="false"
inkscape:snap-to-guides="false"
inkscape:zoom="31.197274"
inkscape:cx="12.755157"
inkscape:cy="13.257277"
inkscape:window-x="-4"
inkscape:window-y="-4"
inkscape:window-maximized="1"
inkscape:current-layer="svg2">
<inkscape:grid
type="xygrid"
id="grid2822"
empspacing="5"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true" />
</sodipodi:namedview>
<rect
style="fill:#a8c9c5;fill-opacity:1;stroke:#1a2200;stroke-width:1.04457009;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
id="rect3767"
width="22.751417"
height="23.217913"
x="1.7035706"
y="1.551699" />
<path
d="m 11.388353,4.7619742 3.570662,-0.080905 10.013099,10.7534978 c 0.05305,1.027595 -0.0071,1.109722 0.04199,3.98885 L 14.971765,8.5777429 l -3.583953,-0.01462 -0.01801,-2.0063721 0.01856,-1.7947794 z"
id="path6"
style="fill:#037600;fill-opacity:1"
sodipodi:nodetypes="cccccccc"
inkscape:connector-curvature="0" />
<path
d="M 7.1933422,1.0463663 C 3.8459678,0.99480061 1.2607574,3.4092055 1.2343849,6.6456504 1.212037,9.3663522 3.7139513,12.43648 7.1669697,12.476979 10.355862,12.51438 12.921899,9.9848585 12.914948,6.6972161 12.90832,3.5634848 10.382485,0.99480061 7.1933422,1.0463663 z M 7.1405977,3.8886568 C 8.9745023,3.8628747 10.089243,5.3767725 10.097572,6.6456504 10.108967,8.3791437 8.6844134,9.6131959 7.1142253,9.5831254 5.4124574,9.5505334 4.2062509,8.276423 4.1836256,6.7487817 4.1598941,5.1194121 5.4120948,3.8886568 7.1405976,3.8886568 z"
id="path8"
style="fill:#797800;fill-opacity:1"
sodipodi:nodetypes="csssccsssc"
inkscape:connector-curvature="0" />
<g
id="g3004"
transform="matrix(0.82726961,0,0,0.80467364,-17.473303,-6.3485938)"
style="fill:#cd0404;fill-opacity:1">
<path
inkscape:connector-curvature="0"
style="opacity:0.85321099;fill:#cd0404;fill-opacity:1;fill-rule:evenodd;stroke:none"
d="m 40.727806,39.169139 c 0,0 -5.138993,-13.201066 -18.02601,-17.485067 l 2.088731,-3.121414 c 12.777976,4.18237 17.994777,19.284892 17.994777,19.284892 z"
id="path3006"
sodipodi:nodetypes="ccccc" />
<path
inkscape:connector-curvature="0"
style="opacity:0.85321099;fill:#cd0404;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m 22.933897,35.970958 3.852963,3.290103 C 32.515122,24.39248 42.867046,20.959903 42.867046,20.959903 l -1.890358,-1.119465 c 0,0 -11.064955,2.012207 -18.042791,16.13052 z"
id="path3008"
sodipodi:nodetypes="ccccc" />
</g>
</svg>
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
# These are the keywords for the Pcbnew s-expression file format. # These are the keywords for the Pcbnew s-expression file format.
add_net add_net
allowed
angle angle
arc arc
arc_segments arc_segments
...@@ -84,6 +85,7 @@ hatch ...@@ -84,6 +85,7 @@ hatch
hide hide
italic italic
justify justify
keepout
kicad_pcb kicad_pcb
last_trace_width last_trace_width
layer layer
...@@ -107,10 +109,12 @@ nets ...@@ -107,10 +109,12 @@ nets
no no
no_connects no_connects
none none
not_allowed
np_thru_hole np_thru_hole
offset offset
oval oval
pad pad
pads
pad_drill pad_drill
pad_size pad_size
pad_to_mask_clearance pad_to_mask_clearance
...@@ -178,6 +182,7 @@ uvias_allowed ...@@ -178,6 +182,7 @@ uvias_allowed
value value
version version
via via
vias
via_dia via_dia
via_drill via_drill
via_min_drill via_min_drill
...@@ -194,4 +199,5 @@ zone ...@@ -194,4 +199,5 @@ zone
zone_45_only zone_45_only
zone_clearance zone_clearance
zone_connect zone_connect
zone_type
zones zones
...@@ -62,6 +62,7 @@ EXTERN_BITMAP( add_hierarchical_label_xpm ) ...@@ -62,6 +62,7 @@ EXTERN_BITMAP( add_hierarchical_label_xpm )
EXTERN_BITMAP( add_hierarchical_subsheet_xpm ) EXTERN_BITMAP( add_hierarchical_subsheet_xpm )
EXTERN_BITMAP( add_hierar_pin_xpm ) EXTERN_BITMAP( add_hierar_pin_xpm )
EXTERN_BITMAP( add_junction_xpm ) EXTERN_BITMAP( add_junction_xpm )
EXTERN_BITMAP( add_keepout_area_xpm )
EXTERN_BITMAP( add_line2bus_xpm ) EXTERN_BITMAP( add_line2bus_xpm )
EXTERN_BITMAP( add_line_label_xpm ) EXTERN_BITMAP( add_line_label_xpm )
EXTERN_BITMAP( add_line_xpm ) EXTERN_BITMAP( add_line_xpm )
......
...@@ -61,6 +61,8 @@ set(PCBNEW_DIALOGS ...@@ -61,6 +61,8 @@ set(PCBNEW_DIALOGS
dialogs/dialog_graphic_item_properties_for_Modedit.cpp dialogs/dialog_graphic_item_properties_for_Modedit.cpp
dialogs/dialog_global_deletion.cpp dialogs/dialog_global_deletion.cpp
dialogs/dialog_global_deletion_base.cpp dialogs/dialog_global_deletion_base.cpp
dialogs/dialog_keepout_area_properties.cpp
dialogs/dialog_keepout_area_properties_base.cpp
dialogs/dialog_layers_setup.cpp dialogs/dialog_layers_setup.cpp
dialogs/dialog_layers_setup_base.cpp dialogs/dialog_layers_setup_base.cpp
dialogs/dialog_netlist.cpp dialogs/dialog_netlist.cpp
......
...@@ -102,8 +102,21 @@ wxString DRC_ITEM::GetErrorText() const ...@@ -102,8 +102,21 @@ wxString DRC_ITEM::GetErrorText() const
case DRCE_NETCLASS_uVIADRILLSIZE: case DRCE_NETCLASS_uVIADRILLSIZE:
return wxString( _("NetClass uVia Drill &lt; global limit")); return wxString( _("NetClass uVia Drill &lt; global limit"));
case DRCE_VIA_INSIDE_KEEPOUT:
return wxString( _("Via inside a keepout area"));
case DRCE_TRACK_INSIDE_KEEPOUT:
return wxString( _("Track inside a keepout area"));
case DRCE_PAD_INSIDE_KEEPOUT:
return wxString( _("Pad inside a keepout area"));
default: default:
return wxString( wxT("PROGRAM BUG, PLEASE LEAVE THE ROOM.") ); {
wxString msg;
msg.Printf( wxT( "Unknown DRC error code %d" ), m_ErrorCode );
return ( msg );
}
} }
} }
......
...@@ -56,9 +56,13 @@ ZONE_CONTAINER::ZONE_CONTAINER( BOARD* aBoard ) : ...@@ -56,9 +56,13 @@ ZONE_CONTAINER::ZONE_CONTAINER( BOARD* aBoard ) :
m_IsFilled = false; // fill status : true when the zone is filled m_IsFilled = false; // fill status : true when the zone is filled
m_FillMode = 0; // How to fill areas: 0 = use filled polygons, != 0 fill with segments m_FillMode = 0; // How to fill areas: 0 = use filled polygons, != 0 fill with segments
m_priority = 0; m_priority = 0;
smoothedPoly = NULL; m_smoothedPoly = NULL;
cornerSmoothingType = ZONE_SETTINGS::SMOOTHING_NONE; m_cornerSmoothingType = ZONE_SETTINGS::SMOOTHING_NONE;
cornerRadius = 0; m_isKeepout = false;
m_doNotAllowPads = true; // has meaning only if m_isKeepout == true
m_doNotAllowVias = true; // has meaning only if m_isKeepout == true
m_doNotAllowTracks = true; // has meaning only if m_isKeepout == true
m_cornerRadius = 0;
utility = 0; // flags used in polygon calculations utility = 0; // flags used in polygon calculations
utility2 = 0; // flags used in polygon calculations utility2 = 0; // flags used in polygon calculations
m_Poly = new CPolyLine(); // Outlines m_Poly = new CPolyLine(); // Outlines
...@@ -87,8 +91,15 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) : ...@@ -87,8 +91,15 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) :
m_FilledPolysList = aZone.m_FilledPolysList; m_FilledPolysList = aZone.m_FilledPolysList;
m_FillSegmList = aZone.m_FillSegmList; m_FillSegmList = aZone.m_FillSegmList;
cornerSmoothingType = aZone.cornerSmoothingType; m_isKeepout = aZone.m_isKeepout;
cornerRadius = aZone.cornerRadius; m_doNotAllowPads = aZone.m_doNotAllowPads;
m_doNotAllowVias = aZone.m_doNotAllowVias;
m_doNotAllowTracks = aZone.m_doNotAllowTracks;
m_cornerSmoothingType = aZone.m_cornerSmoothingType;
m_cornerRadius = aZone.m_cornerRadius;
utility = aZone.utility; utility = aZone.utility;
utility2 = aZone.utility; utility2 = aZone.utility;
} }
...@@ -221,10 +232,8 @@ void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode, const ...@@ -221,10 +232,8 @@ void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode, const
for( unsigned ic = 0; ic < m_Poly->m_HatchLines.size(); ic++ ) for( unsigned ic = 0; ic < m_Poly->m_HatchLines.size(); ic++ )
{ {
seg_start.x = m_Poly->m_HatchLines[ic].xi + offset.x; seg_start = m_Poly->m_HatchLines[ic].m_Start + offset;
seg_start.y = m_Poly->m_HatchLines[ic].yi + offset.y; seg_end = m_Poly->m_HatchLines[ic].m_End + offset;
seg_end.x = m_Poly->m_HatchLines[ic].xf + offset.x;
seg_end.y = m_Poly->m_HatchLines[ic].yf + offset.y;
lines.push_back( seg_start ); lines.push_back( seg_start );
lines.push_back( seg_end ); lines.push_back( seg_end );
} }
......
...@@ -498,24 +498,24 @@ public: ...@@ -498,24 +498,24 @@ public:
*/ */
CPolyLine* GetSmoothedPoly() const CPolyLine* GetSmoothedPoly() const
{ {
if( smoothedPoly ) if( m_smoothedPoly )
return smoothedPoly; return m_smoothedPoly;
else else
return m_Poly; return m_Poly;
}; };
void SetCornerSmoothingType( int aType ) { cornerSmoothingType = aType; }; void SetCornerSmoothingType( int aType ) { m_cornerSmoothingType = aType; };
int GetCornerSmoothingType() const { return cornerSmoothingType; }; int GetCornerSmoothingType() const { return m_cornerSmoothingType; };
void SetCornerRadius( unsigned int aRadius ) void SetCornerRadius( unsigned int aRadius )
{ {
cornerRadius = aRadius; m_cornerRadius = aRadius;
if( cornerRadius > (unsigned int) Mils2iu( MAX_ZONE_CORNER_RADIUS_MILS ) ) if( m_cornerRadius > (unsigned int) Mils2iu( MAX_ZONE_CORNER_RADIUS_MILS ) )
cornerRadius = Mils2iu( MAX_ZONE_CORNER_RADIUS_MILS ); m_cornerRadius = Mils2iu( MAX_ZONE_CORNER_RADIUS_MILS );
}; };
unsigned int GetCornerRadius() const { return cornerRadius; }; unsigned int GetCornerRadius() const { return m_cornerRadius; };
void AddPolygon( std::vector< wxPoint >& aPolygon ); void AddPolygon( std::vector< wxPoint >& aPolygon );
...@@ -535,6 +535,20 @@ public: ...@@ -535,6 +535,20 @@ public:
virtual EDA_ITEM* Clone() const; virtual EDA_ITEM* Clone() const;
/**
* Accessors to parameters used in Keepout zones:
*/
bool GetIsKeepout() const { return m_isKeepout; }
bool GetDoNotAllowPads() const { return m_doNotAllowPads; }
bool GetDoNotAllowVias() const { return m_doNotAllowVias; }
bool GetDoNotAllowTracks() const { return m_doNotAllowTracks; }
void SetIsKeepout( bool aEnable ) { m_isKeepout = aEnable; }
void SetDoNotAllowPads( bool aEnable ) { m_doNotAllowPads = aEnable; }
void SetDoNotAllowVias( bool aEnable ) { m_doNotAllowVias = aEnable; }
void SetDoNotAllowTracks( bool aEnable ) { m_doNotAllowTracks = aEnable; }
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
#endif #endif
...@@ -573,13 +587,28 @@ public: ...@@ -573,13 +587,28 @@ public:
private: private:
wxString m_Netname; // Net Name wxString m_Netname; // Net Name
CPolyLine* smoothedPoly; // Corner-smoothed version of m_Poly CPolyLine* m_smoothedPoly; // Corner-smoothed version of m_Poly
int cornerSmoothingType; int m_cornerSmoothingType;
unsigned int cornerRadius; unsigned int m_cornerRadius;
// Priority: when a zone outline is inside and other zone, if its priority is higher
// the other zone priority, it will be created inside. /* Priority: when a zone outline is inside and other zone, if its priority is higher
// if priorities are equal, a DRC error is set * the other zone priority, it will be created inside.
* if priorities are equal, a DRC error is set
*/
unsigned m_priority; unsigned m_priority;
/* A zone outline can be a keepout zone.
* It will be never filled, and DRC should test for pads, tracks and vias
*/
bool m_isKeepout;
/* For keepout zones only:
* what is not allowed inside the keepout ( pads, tracks and vias )
*/
bool m_doNotAllowPads;
bool m_doNotAllowVias;
bool m_doNotAllowTracks;
ZoneConnection m_PadConnection; ZoneConnection m_PadConnection;
/* set of filled polygons used to draw a zone as a filled area. /* set of filled polygons used to draw a zone as a filled area.
......
...@@ -60,8 +60,13 @@ ZONE_SETTINGS::ZONE_SETTINGS() ...@@ -60,8 +60,13 @@ ZONE_SETTINGS::ZONE_SETTINGS()
m_Zone_45_Only = false; m_Zone_45_Only = false;
cornerSmoothingType = SMOOTHING_NONE; m_cornerSmoothingType = SMOOTHING_NONE;
cornerRadius = 0; m_cornerRadius = 0;
SetIsKeepout( false );
SetDoNotAllowPads( false );
SetDoNotAllowVias( true );
SetDoNotAllowTracks( true );
} }
...@@ -78,8 +83,12 @@ ZONE_SETTINGS& ZONE_SETTINGS::operator << ( const ZONE_CONTAINER& aSource ) ...@@ -78,8 +83,12 @@ ZONE_SETTINGS& ZONE_SETTINGS::operator << ( const ZONE_CONTAINER& aSource )
m_ThermalReliefGap = aSource.m_ThermalReliefGap; m_ThermalReliefGap = aSource.m_ThermalReliefGap;
m_ThermalReliefCopperBridge = aSource.m_ThermalReliefCopperBridge; m_ThermalReliefCopperBridge = aSource.m_ThermalReliefCopperBridge;
m_PadConnection = aSource.GetPadConnection(); m_PadConnection = aSource.GetPadConnection();
cornerSmoothingType = aSource.GetCornerSmoothingType(); m_cornerSmoothingType = aSource.GetCornerSmoothingType();
cornerRadius = aSource.GetCornerRadius(); m_cornerRadius = aSource.GetCornerRadius();
m_isKeepout = aSource.GetIsKeepout();
m_keepoutDoNotAllowPads = aSource.GetDoNotAllowPads();
m_keepoutDoNotAllowVias = aSource.GetDoNotAllowVias();
m_keepoutDoNotAllowTracks = aSource.GetDoNotAllowTracks();
return *this; return *this;
} }
...@@ -95,8 +104,12 @@ void ZONE_SETTINGS::ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport ) c ...@@ -95,8 +104,12 @@ void ZONE_SETTINGS::ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport ) c
aTarget.m_ThermalReliefGap = m_ThermalReliefGap; aTarget.m_ThermalReliefGap = m_ThermalReliefGap;
aTarget.m_ThermalReliefCopperBridge = m_ThermalReliefCopperBridge; aTarget.m_ThermalReliefCopperBridge = m_ThermalReliefCopperBridge;
aTarget.SetPadConnection( m_PadConnection ); aTarget.SetPadConnection( m_PadConnection );
aTarget.SetCornerSmoothingType( cornerSmoothingType ); aTarget.SetCornerSmoothingType( m_cornerSmoothingType );
aTarget.SetCornerRadius( cornerRadius ); aTarget.SetCornerRadius( m_cornerRadius );
aTarget.SetIsKeepout( GetIsKeepout() );
aTarget.SetDoNotAllowPads( GetDoNotAllowPads() );
aTarget.SetDoNotAllowVias( GetDoNotAllowVias() );
aTarget.SetDoNotAllowTracks( GetDoNotAllowTracks() );
if( aFullExport ) if( aFullExport )
{ {
......
...@@ -18,6 +18,8 @@ class ZONE_CONTAINER; ...@@ -18,6 +18,8 @@ class ZONE_CONTAINER;
/** /**
* Class ZONE_SETTINGS * Class ZONE_SETTINGS
* handles zones parameters. * handles zones parameters.
* Because a zone can be on copper or non copper layers, and can be also
* a keepout area, some parameters are irrelevant depending on the type of zone
*/ */
class ZONE_SETTINGS class ZONE_SETTINGS
{ {
...@@ -51,10 +53,23 @@ public: ...@@ -51,10 +53,23 @@ public:
bool m_Zone_45_Only; bool m_Zone_45_Only;
private: private:
int cornerSmoothingType; ///< Corner smoothing type int m_cornerSmoothingType; ///< Corner smoothing type
unsigned int cornerRadius; ///< Corner chamfer distance / fillet radius unsigned int m_cornerRadius; ///< Corner chamfer distance / fillet radius
ZoneConnection m_PadConnection; ZoneConnection m_PadConnection;
/* A zone outline can be a keepout zone.
* It will be never filled, and DRC should test for pads, tracks and vias
*/
bool m_isKeepout;
/* For keepout zones only:
* what is not allowed inside the keepout ( pads, tracks and vias )
*/
bool m_keepoutDoNotAllowPads;
bool m_keepoutDoNotAllowVias;
bool m_keepoutDoNotAllowTracks;
public: public:
ZONE_SETTINGS(); ZONE_SETTINGS();
...@@ -77,25 +92,37 @@ public: ...@@ -77,25 +92,37 @@ public:
*/ */
void ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport = true ) const; void ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport = true ) const;
void SetCornerSmoothingType( int aType) { cornerSmoothingType = aType; } void SetCornerSmoothingType( int aType) { m_cornerSmoothingType = aType; }
int GetCornerSmoothingType() const { return cornerSmoothingType; } int GetCornerSmoothingType() const { return m_cornerSmoothingType; }
void SetCornerRadius( int aRadius ) void SetCornerRadius( int aRadius )
{ {
if( aRadius > Mils2iu( MAX_ZONE_CORNER_RADIUS_MILS ) ) if( aRadius > Mils2iu( MAX_ZONE_CORNER_RADIUS_MILS ) )
cornerRadius = Mils2iu( MAX_ZONE_CORNER_RADIUS_MILS ); m_cornerRadius = Mils2iu( MAX_ZONE_CORNER_RADIUS_MILS );
else if( aRadius < 0 ) else if( aRadius < 0 )
cornerRadius = 0; m_cornerRadius = 0;
else else
cornerRadius = aRadius; m_cornerRadius = aRadius;
}; };
unsigned int GetCornerRadius() const { return cornerRadius; } unsigned int GetCornerRadius() const { return m_cornerRadius; }
ZoneConnection GetPadConnection() const { return m_PadConnection; } ZoneConnection GetPadConnection() const { return m_PadConnection; }
void SetPadConnection( ZoneConnection aPadConnection ) { m_PadConnection = aPadConnection; } void SetPadConnection( ZoneConnection aPadConnection ) { m_PadConnection = aPadConnection; }
/**
* Accessors to parameters used in Keepout zones:
*/
const bool GetIsKeepout() const { return m_isKeepout; }
const bool GetDoNotAllowPads() const { return m_keepoutDoNotAllowPads; }
const bool GetDoNotAllowVias() const { return m_keepoutDoNotAllowVias; }
const bool GetDoNotAllowTracks() const { return m_keepoutDoNotAllowTracks; }
void SetIsKeepout( bool aEnable ) { m_isKeepout = aEnable; }
void SetDoNotAllowPads( bool aEnable ) { m_keepoutDoNotAllowPads = aEnable; }
void SetDoNotAllowVias( bool aEnable ) { m_keepoutDoNotAllowVias = aEnable; }
void SetDoNotAllowTracks( bool aEnable ) { m_keepoutDoNotAllowTracks = aEnable; }
}; };
......
...@@ -133,6 +133,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode ) ...@@ -133,6 +133,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
break; break;
case ID_PCB_ZONES_BUTT: case ID_PCB_ZONES_BUTT:
case ID_PCB_KEEPOUT_AREA_BUTT:
scanList = GENERAL_COLLECTOR::Zones; scanList = GENERAL_COLLECTOR::Zones;
break; break;
......
...@@ -76,8 +76,6 @@ private: ...@@ -76,8 +76,6 @@ private:
static wxString m_netNameShowFilter; ///< the filter to show nets (default * "*"). static wxString m_netNameShowFilter; ///< the filter to show nets (default * "*").
///< static to keep this pattern for an entire pcbnew session ///< static to keep this pattern for an entire pcbnew session
wxListView* m_LayerSelectionCtrl;
/** /**
* Function initDialog * Function initDialog
* fills in the dialog controls using the current settings. * fills in the dialog controls using the current settings.
...@@ -155,16 +153,6 @@ DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* ...@@ -155,16 +153,6 @@ DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS*
SetReturnCode( ZONE_ABORT ); // Will be changed on buttons click SetReturnCode( ZONE_ABORT ); // Will be changed on buttons click
m_LayerSelectionCtrl = new wxListView( this, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
wxLC_NO_HEADER | wxLC_REPORT
| wxLC_SINGLE_SEL | wxRAISED_BORDER );
wxListItem col0;
col0.SetId( 0 );
m_LayerSelectionCtrl->InsertColumn( 0, col0 );
m_layerSizer->Add( m_LayerSelectionCtrl, 1,
wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
// Fix static text widget minimum width to a suitable value so that // Fix static text widget minimum width to a suitable value so that
// resizing the dialog is not necessary when changing the corner smoothing type. // resizing the dialog is not necessary when changing the corner smoothing type.
// Depends on the default text in the widget. // Depends on the default text in the widget.
...@@ -173,8 +161,6 @@ DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* ...@@ -173,8 +161,6 @@ DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS*
initDialog(); initDialog();
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
Center();
} }
...@@ -259,6 +245,10 @@ void DIALOG_COPPER_ZONE::initDialog() ...@@ -259,6 +245,10 @@ void DIALOG_COPPER_ZONE::initDialog()
m_ArcApproximationOpt->SetSelection( m_ArcApproximationOpt->SetSelection(
m_settings.m_ArcToSegmentsCount == ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF ? 1 : 0 ); m_settings.m_ArcToSegmentsCount == ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF ? 1 : 0 );
// Create one column in m_LayerSelectionCtrl
wxListItem col0;
col0.SetId( 0 );
m_LayerSelectionCtrl->InsertColumn( 0, col0 );
// Build copper layer list and append to layer widget // Build copper layer list and append to layer widget
int layerCount = board->GetCopperLayerCount(); int layerCount = board->GetCopperLayerCount();
int layerNumber, itemIndex, layerColor; int layerNumber, itemIndex, layerColor;
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012) // C++ code generated with wxFormBuilder (version Mar 17 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -32,12 +32,16 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i ...@@ -32,12 +32,16 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i
wxBoxSizer* m_OptionsBoxSizer; wxBoxSizer* m_OptionsBoxSizer;
m_OptionsBoxSizer = new wxBoxSizer( wxHORIZONTAL ); m_OptionsBoxSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* m_layerSizer;
m_layerSizer = new wxBoxSizer( wxVERTICAL ); m_layerSizer = new wxBoxSizer( wxVERTICAL );
m_staticText17 = new wxStaticText( this, wxID_ANY, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText17 = new wxStaticText( this, wxID_ANY, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText17->Wrap( -1 ); m_staticText17->Wrap( -1 );
m_layerSizer->Add( m_staticText17, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); m_layerSizer->Add( m_staticText17, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
m_LayerSelectionCtrl = new wxListView( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_ALIGN_LEFT|wxLC_NO_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_SMALL_ICON );
m_layerSizer->Add( m_LayerSelectionCtrl, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_OptionsBoxSizer->Add( m_layerSizer, 1, wxEXPAND, 5 ); m_OptionsBoxSizer->Add( m_layerSizer, 1, wxEXPAND, 5 );
...@@ -128,7 +132,7 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i ...@@ -128,7 +132,7 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i
m_cornerSmoothingTitle = new wxStaticText( this, wxID_ANY, _("Chamfer distance (mm):"), wxDefaultPosition, wxDefaultSize, 0 ); m_cornerSmoothingTitle = new wxStaticText( this, wxID_ANY, _("Chamfer distance (mm):"), wxDefaultPosition, wxDefaultSize, 0 );
m_cornerSmoothingTitle->Wrap( -1 ); m_cornerSmoothingTitle->Wrap( -1 );
bSizer9->Add( m_cornerSmoothingTitle, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); bSizer9->Add( m_cornerSmoothingTitle, 0, wxRIGHT|wxLEFT, 5 );
m_cornerSmoothingCtrl = new wxTextCtrl( this, ID_M_CORNERSMOOTHINGCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_cornerSmoothingCtrl = new wxTextCtrl( this, ID_M_CORNERSMOOTHINGCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizer9->Add( m_cornerSmoothingCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); bSizer9->Add( m_cornerSmoothingCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
...@@ -143,7 +147,7 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i ...@@ -143,7 +147,7 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i
m_staticText13->Wrap( -1 ); m_staticText13->Wrap( -1 );
m_LeftBox->Add( m_staticText13, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); m_LeftBox->Add( m_staticText13, 0, wxLEFT|wxRIGHT|wxTOP, 5 );
wxString m_PadInZoneOptChoices[] = { _("Solid"), _("Thermal relief"), _("THT Thermal"), _("None") }; wxString m_PadInZoneOptChoices[] = { _("Solid"), _("Thermal relief"), _("THT thermal"), _("None") };
int m_PadInZoneOptNChoices = sizeof( m_PadInZoneOptChoices ) / sizeof( wxString ); int m_PadInZoneOptNChoices = sizeof( m_PadInZoneOptChoices ) / sizeof( wxString );
m_PadInZoneOpt = new wxChoice( this, ID_M_PADINZONEOPT, wxDefaultPosition, wxDefaultSize, m_PadInZoneOptNChoices, m_PadInZoneOptChoices, 0 ); m_PadInZoneOpt = new wxChoice( this, ID_M_PADINZONEOPT, wxDefaultPosition, wxDefaultSize, m_PadInZoneOptNChoices, m_PadInZoneOptChoices, 0 );
m_PadInZoneOpt->SetSelection( 0 ); m_PadInZoneOpt->SetSelection( 0 );
...@@ -183,7 +187,7 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i ...@@ -183,7 +187,7 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i
m_staticText171->Wrap( -1 ); m_staticText171->Wrap( -1 );
m_staticText171->SetToolTip( _("On each copper layer, zones are filled by priority order.\nSo when a zone is inside an other zone:\n* If its priority is highter: its outlines are removed from the other layer.\n* If its priority is equal: a DRC error is set.") ); m_staticText171->SetToolTip( _("On each copper layer, zones are filled by priority order.\nSo when a zone is inside an other zone:\n* If its priority is highter: its outlines are removed from the other layer.\n* If its priority is equal: a DRC error is set.") );
m_MiddleBox->Add( m_staticText171, 0, wxRIGHT|wxLEFT, 5 ); m_MiddleBox->Add( m_staticText171, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_PriorityLevelCtrl = new wxSpinCtrl( this, ID_M_PRIORITYLEVELCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, 0 ); m_PriorityLevelCtrl = new wxSpinCtrl( this, ID_M_PRIORITYLEVELCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, 0 );
m_MiddleBox->Add( m_PriorityLevelCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_MiddleBox->Add( m_PriorityLevelCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
...@@ -238,7 +242,7 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i ...@@ -238,7 +242,7 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i
m_ExportableSetupSizer->Add( bSizer81, 0, wxEXPAND, 5 ); m_ExportableSetupSizer->Add( bSizer81, 0, wxEXPAND, 5 );
m_MainBoxSizer->Add( m_ExportableSetupSizer, 1, wxALL|wxEXPAND, 5 ); m_MainBoxSizer->Add( m_ExportableSetupSizer, 0, wxALL|wxEXPAND, 5 );
wxBoxSizer* bSizer10; wxBoxSizer* bSizer10;
bSizer10 = new wxBoxSizer( wxHORIZONTAL ); bSizer10 = new wxBoxSizer( wxHORIZONTAL );
......
This diff is collapsed.
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012) // C++ code generated with wxFormBuilder (version Mar 17 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <wx/font.h> #include <wx/font.h>
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/listctrl.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/listbox.h> #include <wx/listbox.h>
#include <wx/choice.h> #include <wx/choice.h>
...@@ -71,8 +72,8 @@ class DIALOG_COPPER_ZONE_BASE : public DIALOG_SHIM ...@@ -71,8 +72,8 @@ class DIALOG_COPPER_ZONE_BASE : public DIALOG_SHIM
}; };
wxBoxSizer* m_MainBoxSizer; wxBoxSizer* m_MainBoxSizer;
wxBoxSizer* m_layerSizer;
wxStaticText* m_staticText17; wxStaticText* m_staticText17;
wxListView* m_LayerSelectionCtrl;
wxStaticText* m_staticText2; wxStaticText* m_staticText2;
wxListBox* m_ListNetNameSelection; wxListBox* m_ListNetNameSelection;
wxStaticText* m_staticText16; wxStaticText* m_staticText16;
...@@ -124,7 +125,7 @@ class DIALOG_COPPER_ZONE_BASE : public DIALOG_SHIM ...@@ -124,7 +125,7 @@ class DIALOG_COPPER_ZONE_BASE : public DIALOG_SHIM
public: public:
DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID id = ID_DIALOG_COPPER_ZONE_BASE, const wxString& title = _("Zone Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 550,500 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID id = ID_DIALOG_COPPER_ZONE_BASE, const wxString& title = _("Zone Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 567,500 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_COPPER_ZONE_BASE(); ~DIALOG_COPPER_ZONE_BASE();
}; };
......
...@@ -165,6 +165,7 @@ void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event ) ...@@ -165,6 +165,7 @@ void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event )
m_tester->SetSettings( true, // Pad to pad DRC test enabled m_tester->SetSettings( true, // Pad to pad DRC test enabled
true, // unconnected pdas DRC test enabled true, // unconnected pdas DRC test enabled
true, // DRC test for zones enabled true, // DRC test for zones enabled
true, // DRC test for keepout areas enabled
reportName, m_CreateRptCtrl->IsChecked() ); reportName, m_CreateRptCtrl->IsChecked() );
DelDRCMarkers(); DelDRCMarkers();
...@@ -243,6 +244,7 @@ void DIALOG_DRC_CONTROL::OnListUnconnectedClick( wxCommandEvent& event ) ...@@ -243,6 +244,7 @@ void DIALOG_DRC_CONTROL::OnListUnconnectedClick( wxCommandEvent& event )
m_tester->SetSettings( true, // Pad to pad DRC test enabled m_tester->SetSettings( true, // Pad to pad DRC test enabled
true, // unconnected pdas DRC test enabled true, // unconnected pdas DRC test enabled
true, // DRC test for zones enabled true, // DRC test for zones enabled
true, // DRC test for keepout areas enabled
reportName, m_CreateRptCtrl->IsChecked() ); reportName, m_CreateRptCtrl->IsChecked() );
DelDRCMarkers(); DelDRCMarkers();
......
/**
* @file dialog_keepout_area_properties.cpp
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <wx/wx.h>
#include <fctsys.h>
#include <appl_wxstruct.h>
#include <confirm.h>
#include <pcbnew.h>
#include <wxPcbStruct.h>
#include <zones.h>
#include <base_units.h>
#include <class_zone_settings.h>
#include <class_board.h>
#include <dialog_keepout_area_properties_base.h>
#include <wx/imaglist.h> // needed for wx/listctrl.h, in wxGTK 2.8.12
#include <wx/listctrl.h>
/**
* Class DIALOG_KEEPOUT_AREA_PROPERTIES
* is the derived class from dialog_copper_zone_frame created by wxFormBuilder
*/
class DIALOG_KEEPOUT_AREA_PROPERTIES : public DIALOG_KEEPOUT_AREA_PROPERTIES_BASE
{
public:
DIALOG_KEEPOUT_AREA_PROPERTIES( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aSettings );
private:
PCB_BASE_FRAME* m_Parent;
wxConfig* m_Config; ///< Current config
ZONE_SETTINGS m_zonesettings;
ZONE_SETTINGS* m_ptr;
std::vector<int> m_LayerId; ///< Handle the real layer number from layer
///< name position in m_LayerSelectionCtrl
/**
* Function initDialog
* fills in the dialog controls using the current settings.
*/
void initDialog();
void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
void OnSize( wxSizeEvent& event );
/**
* Function AcceptOptionsForKeepOut
* Test validity of options, and copy options in m_zonesettings, for keepout zones
* @return bool - false if incorrect options, true if ok.
*/
bool AcceptOptionsForKeepOut();
/**
* Function makeLayerBitmap
* creates the colored rectangle bitmaps used in the layer selection widget.
* @param aColor is the color to fill the rectangle with.
*/
wxBitmap makeLayerBitmap( int aColor );
};
#define LAYER_BITMAP_SIZE_X 20
#define LAYER_BITMAP_SIZE_Y 10
ZONE_EDIT_T InvokeKeepoutAreaEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings )
{
DIALOG_KEEPOUT_AREA_PROPERTIES dlg( aCaller, aSettings );
ZONE_EDIT_T result = ZONE_EDIT_T( dlg.ShowModal() );
return result;
}
DIALOG_KEEPOUT_AREA_PROPERTIES::DIALOG_KEEPOUT_AREA_PROPERTIES( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aSettings ) :
DIALOG_KEEPOUT_AREA_PROPERTIES_BASE( aParent )
{
m_Parent = aParent;
m_Config = wxGetApp().GetSettings();
m_ptr = aSettings;
m_zonesettings = *aSettings;
SetReturnCode( ZONE_ABORT ); // Will be changed on button OK ckick
initDialog();
GetSizer()->SetSizeHints( this );
}
void DIALOG_KEEPOUT_AREA_PROPERTIES::initDialog()
{
BOARD* board = m_Parent->GetBoard();
wxString msg;
if( m_zonesettings.m_Zone_45_Only )
m_OrientEdgesOpt->SetSelection( 1 );
switch( m_zonesettings.m_Zone_HatchingStyle )
{
case CPolyLine::NO_HATCH:
m_OutlineAppearanceCtrl->SetSelection( 0 );
break;
case CPolyLine::DIAGONAL_EDGE:
m_OutlineAppearanceCtrl->SetSelection( 1 );
break;
case CPolyLine::DIAGONAL_FULL:
m_OutlineAppearanceCtrl->SetSelection( 2 );
break;
}
// Create one column in m_LayerSelectionCtrl
wxListItem col0;
col0.SetId( 0 );
m_LayerSelectionCtrl->InsertColumn( 0, col0 );
// Build copper layer list and append to layer widget
int layerCount = board->GetCopperLayerCount();
int layerNumber, itemIndex, layerColor;
wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL );
for( int ii = 0; ii < layerCount; ii++ )
{
layerNumber = LAYER_N_BACK;
if( layerCount <= 1 || ii < layerCount - 1 )
layerNumber = ii;
else if( ii == layerCount - 1 )
layerNumber = LAYER_N_FRONT;
m_LayerId.insert( m_LayerId.begin(), layerNumber );
msg = board->GetLayerName( layerNumber );
layerColor = board->GetLayerColor( layerNumber );
imageList->Add( makeLayerBitmap( layerColor ) );
itemIndex = m_LayerSelectionCtrl->InsertItem( 0, msg, ii );
if( m_zonesettings.m_CurrentZone_Layer == layerNumber )
m_LayerSelectionCtrl->Select( itemIndex );
}
// Init keepout parameters:
m_cbTracksCtrl->SetValue( m_zonesettings.GetDoNotAllowTracks() );
m_cbViasCtrl->SetValue( m_zonesettings.GetDoNotAllowVias() );
m_cbPadsCtrl->SetValue( m_zonesettings.GetDoNotAllowPads() );
}
void DIALOG_KEEPOUT_AREA_PROPERTIES::OnCancelClick( wxCommandEvent& event )
{
EndModal( ZONE_ABORT );
}
void DIALOG_KEEPOUT_AREA_PROPERTIES::OnOkClick( wxCommandEvent& event )
{
if( AcceptOptionsForKeepOut() )
{
*m_ptr = m_zonesettings;
EndModal( ZONE_OK );
}
}
void DIALOG_KEEPOUT_AREA_PROPERTIES::OnSize( wxSizeEvent& event )
{
Layout();
// Set layer list column width to widget width minus a few pixels
m_LayerSelectionCtrl->SetColumnWidth( 0, m_LayerSelectionCtrl->GetSize().x - 5 );
event.Skip();
}
bool DIALOG_KEEPOUT_AREA_PROPERTIES::AcceptOptionsForKeepOut()
{
// Init keepout parameters:
m_zonesettings.SetIsKeepout( true );
m_zonesettings.SetDoNotAllowTracks( m_cbTracksCtrl->GetValue() );
m_zonesettings.SetDoNotAllowVias( m_cbViasCtrl->GetValue() );
m_zonesettings.SetDoNotAllowPads( m_cbPadsCtrl->GetValue() );
// Test for not allowed items: should have at least one item not allowed:
if( ! m_zonesettings.GetDoNotAllowTracks() &&
! m_zonesettings.GetDoNotAllowVias() &&
! m_zonesettings.GetDoNotAllowPads() )
{
DisplayError( NULL,
_("Tracks, vias and pads are allowed. The keepout is useless" ) );
return false;
}
// Get the layer selection for this zone
int ii = m_LayerSelectionCtrl->GetFirstSelected();
if( ii < 0 )
{
DisplayError( NULL, _( "No layer selected." ) );
return false;
}
m_zonesettings.m_CurrentZone_Layer = m_LayerId[ii];
switch( m_OutlineAppearanceCtrl->GetSelection() )
{
case 0:
m_zonesettings.m_Zone_HatchingStyle = CPolyLine::NO_HATCH;
break;
case 1:
m_zonesettings.m_Zone_HatchingStyle = CPolyLine::DIAGONAL_EDGE;
break;
case 2:
m_zonesettings.m_Zone_HatchingStyle = CPolyLine::DIAGONAL_FULL;
break;
}
if( m_Config )
{
m_Config->Write( ZONE_NET_OUTLINES_HATCH_OPTION_KEY,
(long) m_zonesettings.m_Zone_HatchingStyle );
}
if( m_OrientEdgesOpt->GetSelection() == 0 )
m_zonesettings.m_Zone_45_Only = false;
else
m_zonesettings.m_Zone_45_Only = true;
m_zonesettings.m_ZonePriority = 0; //m_PriorityLevelCtrl->GetValue();
return true;
}
wxBitmap DIALOG_KEEPOUT_AREA_PROPERTIES::makeLayerBitmap( int aColor )
{
wxBitmap bitmap( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
wxBrush brush;
wxMemoryDC iconDC;
iconDC.SelectObject( bitmap );
brush.SetColour( MakeColour( aColor ) );
brush.SetStyle( wxSOLID );
iconDC.SetBrush( brush );
iconDC.DrawRectangle( 0, 0, LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
return bitmap;
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_keepout_area_properties_base.h"
///////////////////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE( DIALOG_KEEPOUT_AREA_PROPERTIES_BASE, DIALOG_SHIM )
EVT_BUTTON( wxID_CANCEL, DIALOG_KEEPOUT_AREA_PROPERTIES_BASE::_wxFB_OnCancelClick )
EVT_BUTTON( wxID_OK, DIALOG_KEEPOUT_AREA_PROPERTIES_BASE::_wxFB_OnOkClick )
END_EVENT_TABLE()
DIALOG_KEEPOUT_AREA_PROPERTIES_BASE::DIALOG_KEEPOUT_AREA_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* m_MainSizer;
m_MainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* m_UpperSizer;
m_UpperSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* m_layersListSizer;
m_layersListSizer = new wxBoxSizer( wxVERTICAL );
m_staticTextLayerSelection = new wxStaticText( this, wxID_ANY, _("Layer selection:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextLayerSelection->Wrap( -1 );
m_layersListSizer->Add( m_staticTextLayerSelection, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_LayerSelectionCtrl = new wxListView( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_ALIGN_LEFT|wxLC_ICON|wxLC_NO_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_SMALL_ICON );
m_layersListSizer->Add( m_LayerSelectionCtrl, 1, wxALL|wxEXPAND, 5 );
m_UpperSizer->Add( m_layersListSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bSizerRight;
bSizerRight = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* m_OutilinesBoxOpt;
m_OutilinesBoxOpt = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Outlines Options:") ), wxVERTICAL );
wxString m_OrientEdgesOptChoices[] = { _("Any"), _("H, V and 45 deg") };
int m_OrientEdgesOptNChoices = sizeof( m_OrientEdgesOptChoices ) / sizeof( wxString );
m_OrientEdgesOpt = new wxRadioBox( this, wxID_ANY, _("Zone Edges Orient"), wxDefaultPosition, wxDefaultSize, m_OrientEdgesOptNChoices, m_OrientEdgesOptChoices, 1, wxRA_SPECIFY_COLS );
m_OrientEdgesOpt->SetSelection( 0 );
m_OutilinesBoxOpt->Add( m_OrientEdgesOpt, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
wxString m_OutlineAppearanceCtrlChoices[] = { _("Line"), _("Hatched Outline"), _("Full Hatched") };
int m_OutlineAppearanceCtrlNChoices = sizeof( m_OutlineAppearanceCtrlChoices ) / sizeof( wxString );
m_OutlineAppearanceCtrl = new wxRadioBox( this, wxID_ANY, _("Outlines Appearence"), wxDefaultPosition, wxDefaultSize, m_OutlineAppearanceCtrlNChoices, m_OutlineAppearanceCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_OutlineAppearanceCtrl->SetSelection( 1 );
m_OutilinesBoxOpt->Add( m_OutlineAppearanceCtrl, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
bSizerRight->Add( m_OutilinesBoxOpt, 0, wxEXPAND|wxALL, 5 );
wxStaticBoxSizer* sbSizerCutoutOpts;
sbSizerCutoutOpts = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Keepout Options:") ), wxVERTICAL );
m_cbTracksCtrl = new wxCheckBox( this, wxID_ANY, _("No Tracks"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerCutoutOpts->Add( m_cbTracksCtrl, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_cbViasCtrl = new wxCheckBox( this, wxID_ANY, _("No Vias"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerCutoutOpts->Add( m_cbViasCtrl, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_cbPadsCtrl = new wxCheckBox( this, wxID_ANY, _("No Pads"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerCutoutOpts->Add( m_cbPadsCtrl, 0, wxALL|wxEXPAND, 5 );
bSizerRight->Add( sbSizerCutoutOpts, 0, wxEXPAND|wxALL, 5 );
m_UpperSizer->Add( bSizerRight, 0, wxEXPAND, 5 );
m_MainSizer->Add( m_UpperSizer, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
m_MainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
m_sdbSizerButtons = new wxStdDialogButtonSizer();
m_sdbSizerButtonsOK = new wxButton( this, wxID_OK );
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsOK );
m_sdbSizerButtonsCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel );
m_sdbSizerButtons->Realize();
m_MainSizer->Add( m_sdbSizerButtons, 0, wxEXPAND, 5 );
this->SetSizer( m_MainSizer );
this->Layout();
this->Centre( wxBOTH );
}
DIALOG_KEEPOUT_AREA_PROPERTIES_BASE::~DIALOG_KEEPOUT_AREA_PROPERTIES_BASE()
{
}
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_KEEPOUT_AREA_PROPERTIES_BASE_H__
#define __DIALOG_KEEPOUT_AREA_PROPERTIES_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/listctrl.h>
#include <wx/sizer.h>
#include <wx/radiobox.h>
#include <wx/statbox.h>
#include <wx/checkbox.h>
#include <wx/statline.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_KEEPOUT_AREA_PROPERTIES_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_KEEPOUT_AREA_PROPERTIES_BASE : public DIALOG_SHIM
{
DECLARE_EVENT_TABLE()
private:
// Private event handlers
void _wxFB_OnCancelClick( wxCommandEvent& event ){ OnCancelClick( event ); }
void _wxFB_OnOkClick( wxCommandEvent& event ){ OnOkClick( event ); }
protected:
wxStaticText* m_staticTextLayerSelection;
wxListView* m_LayerSelectionCtrl;
wxRadioBox* m_OrientEdgesOpt;
wxRadioBox* m_OutlineAppearanceCtrl;
wxCheckBox* m_cbTracksCtrl;
wxCheckBox* m_cbViasCtrl;
wxCheckBox* m_cbPadsCtrl;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizerButtons;
wxButton* m_sdbSizerButtonsOK;
wxButton* m_sdbSizerButtonsCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_KEEPOUT_AREA_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Keepout Area Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 308,355 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER );
~DIALOG_KEEPOUT_AREA_PROPERTIES_BASE();
};
#endif //__DIALOG_KEEPOUT_AREA_PROPERTIES_BASE_H__
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 11 2012) // C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE( DialogNonCopperZonesPropertiesBase, DIALOG_SHIM ) BEGIN_EVENT_TABLE( DialogNonCopperZonesPropertiesBase, DIALOG_SHIM )
EVT_BUTTON( wxID_OK, DialogNonCopperZonesPropertiesBase::_wxFB_OnOkClick )
EVT_BUTTON( wxID_CANCEL, DialogNonCopperZonesPropertiesBase::_wxFB_OnCancelClick ) EVT_BUTTON( wxID_CANCEL, DialogNonCopperZonesPropertiesBase::_wxFB_OnCancelClick )
EVT_BUTTON( wxID_OK, DialogNonCopperZonesPropertiesBase::_wxFB_OnOkClick )
END_EVENT_TABLE() END_EVENT_TABLE()
DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
...@@ -24,24 +24,21 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow ...@@ -24,24 +24,21 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow
wxBoxSizer* m_UpperSizer; wxBoxSizer* m_UpperSizer;
m_UpperSizer = new wxBoxSizer( wxHORIZONTAL ); m_UpperSizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* sbLeftSizer_; wxBoxSizer* bSizerLeft;
sbLeftSizer_ = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Zone Fill Options:") ), wxVERTICAL ); bSizerLeft = new wxBoxSizer( wxVERTICAL );
wxString m_FillModeCtrlChoices[] = { _("Use polygons"), _("Use segments") }; m_staticTextLayerSelection = new wxStaticText( this, wxID_ANY, _("Layer selection:"), wxDefaultPosition, wxDefaultSize, 0 );
int m_FillModeCtrlNChoices = sizeof( m_FillModeCtrlChoices ) / sizeof( wxString ); m_staticTextLayerSelection->Wrap( -1 );
m_FillModeCtrl = new wxRadioBox( this, wxID_ANY, _("Filling Mode:"), wxDefaultPosition, wxDefaultSize, m_FillModeCtrlNChoices, m_FillModeCtrlChoices, 1, wxRA_SPECIFY_COLS ); bSizerLeft->Add( m_staticTextLayerSelection, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_FillModeCtrl->SetSelection( 0 );
sbLeftSizer_->Add( m_FillModeCtrl, 0, wxALL|wxEXPAND, 5 );
m_MinThicknessValueTitle = new wxStaticText( this, wxID_ANY, _("Zone min thickness value"), wxDefaultPosition, wxDefaultSize, 0 ); m_LayerSelectionCtrl = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
m_MinThicknessValueTitle->Wrap( -1 ); bSizerLeft->Add( m_LayerSelectionCtrl, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
sbLeftSizer_->Add( m_MinThicknessValueTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_ZoneMinThicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbLeftSizer_->Add( m_ZoneMinThicknessCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_UpperSizer->Add( bSizerLeft, 1, wxEXPAND, 5 );
m_UpperSizer->Add( sbLeftSizer_, 0, 0, 5 ); wxBoxSizer* bSizerRight;
bSizerRight = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* m_OutilinesBoxOpt; wxStaticBoxSizer* m_OutilinesBoxOpt;
m_OutilinesBoxOpt = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Outlines Options:") ), wxVERTICAL ); m_OutilinesBoxOpt = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Outlines Options:") ), wxVERTICAL );
...@@ -50,39 +47,41 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow ...@@ -50,39 +47,41 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow
int m_OrientEdgesOptNChoices = sizeof( m_OrientEdgesOptChoices ) / sizeof( wxString ); int m_OrientEdgesOptNChoices = sizeof( m_OrientEdgesOptChoices ) / sizeof( wxString );
m_OrientEdgesOpt = new wxRadioBox( this, wxID_ANY, _("Zone Edges Orient"), wxDefaultPosition, wxDefaultSize, m_OrientEdgesOptNChoices, m_OrientEdgesOptChoices, 1, wxRA_SPECIFY_COLS ); m_OrientEdgesOpt = new wxRadioBox( this, wxID_ANY, _("Zone Edges Orient"), wxDefaultPosition, wxDefaultSize, m_OrientEdgesOptNChoices, m_OrientEdgesOptChoices, 1, wxRA_SPECIFY_COLS );
m_OrientEdgesOpt->SetSelection( 0 ); m_OrientEdgesOpt->SetSelection( 0 );
m_OutilinesBoxOpt->Add( m_OrientEdgesOpt, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); m_OutilinesBoxOpt->Add( m_OrientEdgesOpt, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
wxString m_OutlineAppearanceCtrlChoices[] = { _("Line"), _("Hatched Outline"), _("Full Hatched") }; wxString m_OutlineAppearanceCtrlChoices[] = { _("Line"), _("Hatched Outline"), _("Full Hatched") };
int m_OutlineAppearanceCtrlNChoices = sizeof( m_OutlineAppearanceCtrlChoices ) / sizeof( wxString ); int m_OutlineAppearanceCtrlNChoices = sizeof( m_OutlineAppearanceCtrlChoices ) / sizeof( wxString );
m_OutlineAppearanceCtrl = new wxRadioBox( this, wxID_ANY, _("Outlines Appearence"), wxDefaultPosition, wxDefaultSize, m_OutlineAppearanceCtrlNChoices, m_OutlineAppearanceCtrlChoices, 1, wxRA_SPECIFY_COLS ); m_OutlineAppearanceCtrl = new wxRadioBox( this, wxID_ANY, _("Outlines Appearence"), wxDefaultPosition, wxDefaultSize, m_OutlineAppearanceCtrlNChoices, m_OutlineAppearanceCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_OutlineAppearanceCtrl->SetSelection( 1 ); m_OutlineAppearanceCtrl->SetSelection( 1 );
m_OutilinesBoxOpt->Add( m_OutlineAppearanceCtrl, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); m_OutilinesBoxOpt->Add( m_OutlineAppearanceCtrl, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_UpperSizer->Add( m_OutilinesBoxOpt, 0, 0, 5 ); bSizerRight->Add( m_OutilinesBoxOpt, 0, wxEXPAND|wxALL, 5 );
wxBoxSizer* m_ButtonsSizer; m_MinThicknessValueTitle = new wxStaticText( this, wxID_ANY, _("Zone min thickness value"), wxDefaultPosition, wxDefaultSize, 0 );
m_ButtonsSizer = new wxBoxSizer( wxVERTICAL ); m_MinThicknessValueTitle->Wrap( -1 );
bSizerRight->Add( m_MinThicknessValueTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_buttonOk = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonOk->SetDefault();
m_ButtonsSizer->Add( m_buttonOk, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); m_ZoneMinThicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_ButtonsSizer->Add( m_buttonCancel, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); bSizerRight->Add( m_ZoneMinThicknessCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_UpperSizer->Add( m_ButtonsSizer, 1, wxALIGN_CENTER_VERTICAL, 5 ); m_UpperSizer->Add( bSizerRight, 0, wxEXPAND, 5 );
m_MainSizer->Add( m_UpperSizer, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 ); m_MainSizer->Add( m_UpperSizer, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
m_staticTextLayerSelection = new wxStaticText( this, wxID_ANY, _("Layer selection:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
m_staticTextLayerSelection->Wrap( -1 ); m_MainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
m_MainSizer->Add( m_staticTextLayerSelection, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_LayerSelectionCtrl = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); m_sdbSizerButtons = new wxStdDialogButtonSizer();
m_MainSizer->Add( m_LayerSelectionCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_sdbSizerButtonsOK = new wxButton( this, wxID_OK );
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsOK );
m_sdbSizerButtonsCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel );
m_sdbSizerButtons->Realize();
m_MainSizer->Add( m_sdbSizerButtons, 0, wxEXPAND, 5 );
this->SetSizer( m_MainSizer ); this->SetSizer( m_MainSizer );
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 11 2012) // C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -13,17 +13,18 @@ ...@@ -13,17 +13,18 @@
#include <wx/intl.h> #include <wx/intl.h>
#include "dialog_shim.h" #include "dialog_shim.h"
#include <wx/string.h> #include <wx/string.h>
#include <wx/radiobox.h> #include <wx/stattext.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/font.h> #include <wx/font.h>
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/stattext.h> #include <wx/listbox.h>
#include <wx/textctrl.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/radiobox.h>
#include <wx/statbox.h> #include <wx/statbox.h>
#include <wx/textctrl.h>
#include <wx/statline.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/listbox.h>
#include <wx/dialog.h> #include <wx/dialog.h>
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
...@@ -37,29 +38,30 @@ class DialogNonCopperZonesPropertiesBase : public DIALOG_SHIM ...@@ -37,29 +38,30 @@ class DialogNonCopperZonesPropertiesBase : public DIALOG_SHIM
private: private:
// Private event handlers // Private event handlers
void _wxFB_OnOkClick( wxCommandEvent& event ){ OnOkClick( event ); }
void _wxFB_OnCancelClick( wxCommandEvent& event ){ OnCancelClick( event ); } void _wxFB_OnCancelClick( wxCommandEvent& event ){ OnCancelClick( event ); }
void _wxFB_OnOkClick( wxCommandEvent& event ){ OnOkClick( event ); }
protected: protected:
wxRadioBox* m_FillModeCtrl;
wxStaticText* m_MinThicknessValueTitle;
wxTextCtrl* m_ZoneMinThicknessCtrl;
wxRadioBox* m_OrientEdgesOpt;
wxRadioBox* m_OutlineAppearanceCtrl;
wxButton* m_buttonOk;
wxButton* m_buttonCancel;
wxStaticText* m_staticTextLayerSelection; wxStaticText* m_staticTextLayerSelection;
wxListBox* m_LayerSelectionCtrl; wxListBox* m_LayerSelectionCtrl;
wxRadioBox* m_OrientEdgesOpt;
wxRadioBox* m_OutlineAppearanceCtrl;
wxStaticText* m_MinThicknessValueTitle;
wxTextCtrl* m_ZoneMinThicknessCtrl;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizerButtons;
wxButton* m_sdbSizerButtonsOK;
wxButton* m_sdbSizerButtonsCancel;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public: public:
DialogNonCopperZonesPropertiesBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Non Copper Zones Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 416,287 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER ); DialogNonCopperZonesPropertiesBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Non Copper Zones Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 369,317 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER );
~DialogNonCopperZonesPropertiesBase(); ~DialogNonCopperZonesPropertiesBase();
}; };
......
...@@ -136,6 +136,14 @@ int DRC::Drc( TRACK* aRefSegm, TRACK* aList ) ...@@ -136,6 +136,14 @@ int DRC::Drc( TRACK* aRefSegm, TRACK* aList )
return BAD_DRC; return BAD_DRC;
} }
if( !doTrackKeepoutDrc( aRefSegm ) )
{
wxASSERT( m_currentMarker );
m_currentMarker->DisplayInfo( m_mainWindow );
return BAD_DRC;
}
return OK_DRC; return OK_DRC;
} }
...@@ -252,6 +260,18 @@ void DRC::RunTests( wxTextCtrl* aMessages ) ...@@ -252,6 +260,18 @@ void DRC::RunTests( wxTextCtrl* aMessages )
testUnconnected(); testUnconnected();
} }
// find and gather vias, tracks, pads inside keepout areas.
if( m_doKeepoutTest )
{
if( aMessages )
{
aMessages->AppendText( _( "Keepout areas ...\n" ) );
aMessages->Refresh();
}
testKeepoutAreas();
}
// update the m_ui listboxes // update the m_ui listboxes
updatePointers(); updatePointers();
...@@ -556,6 +576,107 @@ void DRC::testZones() ...@@ -556,6 +576,107 @@ void DRC::testZones()
} }
void DRC::testKeepoutAreas()
{
// Test keepout areas for vias, tracks and pads inside keepout areas
for( int ii = 0; ii < m_pcb->GetAreaCount(); ii++ )
{
ZONE_CONTAINER* area = m_pcb->GetArea( ii );
if( !area->GetIsKeepout() )
continue;
for( TRACK* segm = m_pcb->m_Track; segm != NULL; segm = segm->Next() )
{
if( segm->Type() == PCB_TRACE_T )
{
if( ! area->GetDoNotAllowTracks() )
continue;
if( segm->GetLayer() != area->GetLayer() )
continue;
if( area->m_Poly->Distance( segm->GetStart(), segm->GetEnd(), segm->GetWidth() ) == 0 )
{
m_currentMarker = fillMarker( segm, NULL,
DRCE_TRACK_INSIDE_KEEPOUT, m_currentMarker );
m_pcb->Add( m_currentMarker );
m_currentMarker = 0;
}
}
else if( segm->Type() == PCB_VIA_T )
{
if( ! area->GetDoNotAllowVias() )
continue;
if( ! ((SEGVIA*)segm)->IsOnLayer( area->GetLayer() ) )
continue;
if( area->m_Poly->Distance( segm->GetPosition() ) < segm->GetWidth()/2 )
{
m_currentMarker = fillMarker( segm, NULL,
DRCE_VIA_INSIDE_KEEPOUT, m_currentMarker );
m_pcb->Add( m_currentMarker );
m_currentMarker = 0;
}
}
}
// Test pads: TODO
}
}
/*
* Function doTrackKeepoutDrc
* tests the current segment or via.
* aRefSeg is the segment to test
* return true if no DRC err
*/
bool DRC::doTrackKeepoutDrc( TRACK* aRefSeg )
{
// Test keepout areas for vias, tracks and pads inside keepout areas
for( int ii = 0; ii < m_pcb->GetAreaCount(); ii++ )
{
ZONE_CONTAINER* area = m_pcb->GetArea( ii );
if( !area->GetIsKeepout() )
continue;
if( aRefSeg->Type() == PCB_TRACE_T )
{
if( ! area->GetDoNotAllowTracks() )
continue;
if( aRefSeg->GetLayer() != area->GetLayer() )
continue;
if( area->m_Poly->Distance( aRefSeg->GetStart(), aRefSeg->GetEnd(), aRefSeg->GetWidth() ) == 0 )
{
m_currentMarker = fillMarker( aRefSeg, NULL,
DRCE_TRACK_INSIDE_KEEPOUT, m_currentMarker );
return false;
}
}
else if( aRefSeg->Type() == PCB_VIA_T )
{
if( ! area->GetDoNotAllowVias() )
continue;
if( ! ((SEGVIA*)aRefSeg)->IsOnLayer( area->GetLayer() ) )
continue;
if( area->m_Poly->Distance( aRefSeg->GetPosition() ) < aRefSeg->GetWidth()/2 )
{
m_currentMarker = fillMarker( aRefSeg, NULL,
DRCE_VIA_INSIDE_KEEPOUT, m_currentMarker );
return false;
}
}
}
return true;
}
bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_limit ) bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_limit )
{ {
int layerMask = aRefPad->GetLayerMask() & ALL_CU_LAYERS; int layerMask = aRefPad->GetLayerMask() & ALL_CU_LAYERS;
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include <vector> #include <vector>
#define OK_DRC 0 #define OK_DRC 0
#define BAD_DRC 1 #define BAD_DRC 1
...@@ -73,6 +72,9 @@ ...@@ -73,6 +72,9 @@
#define DRCE_NETCLASS_VIADRILLSIZE 33 ///< netclass has ViaDrillSize < board.m_designSettings->m_ViasMinDrill #define DRCE_NETCLASS_VIADRILLSIZE 33 ///< netclass has ViaDrillSize < board.m_designSettings->m_ViasMinDrill
#define DRCE_NETCLASS_uVIASIZE 34 ///< netclass has ViaSize < board.m_designSettings->m_MicroViasMinSize #define DRCE_NETCLASS_uVIASIZE 34 ///< netclass has ViaSize < board.m_designSettings->m_MicroViasMinSize
#define DRCE_NETCLASS_uVIADRILLSIZE 35 ///< netclass has ViaSize < board.m_designSettings->m_MicroViasMinDrill #define DRCE_NETCLASS_uVIADRILLSIZE 35 ///< netclass has ViaSize < board.m_designSettings->m_MicroViasMinDrill
#define DRCE_VIA_INSIDE_KEEPOUT 36 ///< Via in inside a keepout area
#define DRCE_TRACK_INSIDE_KEEPOUT 37 ///< Track in inside a keepout area
#define DRCE_PAD_INSIDE_KEEPOUT 38 ///< Pad in inside a keepout area
class EDA_DRAW_PANEL; class EDA_DRAW_PANEL;
...@@ -155,15 +157,14 @@ private: ...@@ -155,15 +157,14 @@ private:
bool m_doPad2PadTest; bool m_doPad2PadTest;
bool m_doUnconnectedTest; bool m_doUnconnectedTest;
bool m_doZonesTest; bool m_doZonesTest;
bool m_doKeepoutTest;
bool m_doCreateRptFile; bool m_doCreateRptFile;
wxString m_rptFilename; wxString m_rptFilename;
// int m_errorCount;
MARKER_PCB* m_currentMarker; MARKER_PCB* m_currentMarker;
bool m_aboartDRC; bool m_abortDRC;
bool m_drcInProgress; bool m_drcInProgress;
/* In DRC functions, many calculations are using coordinates relative /* In DRC functions, many calculations are using coordinates relative
...@@ -182,7 +183,7 @@ private: ...@@ -182,7 +183,7 @@ private:
int m_segmLength; // length of the reference segment int m_segmLength; // length of the reference segment
/* variables used in checkLine to test DRC segm to segm: /* variables used in checkLine to test DRC segm to segm:
* define the area relative to the ref segment that does not contains anu other segment * define the area relative to the ref segment that does not contains any other segment
*/ */
int m_xcliplo; int m_xcliplo;
int m_ycliplo; int m_ycliplo;
...@@ -278,6 +279,7 @@ private: ...@@ -278,6 +279,7 @@ private:
void testZones(); void testZones();
void testKeepoutAreas();
//-----<single "item" tests>----------------------------------------- //-----<single "item" tests>-----------------------------------------
...@@ -305,6 +307,15 @@ private: ...@@ -305,6 +307,15 @@ private:
*/ */
bool doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool doPads = true ); bool doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool doPads = true );
/**
* Function doTrackKeepoutDrc
* tests the current segment or via.
* @param aRefSeg The segment to test
* @return bool - true if no poblems, else false and m_currentMarker is
* filled in with the problem information.
*/
bool doTrackKeepoutDrc( TRACK* aRefSeg );
/** /**
* Function doEdgeZoneDrc * Function doEdgeZoneDrc
...@@ -412,7 +423,10 @@ public: ...@@ -412,7 +423,10 @@ public:
{ {
updatePointers(); updatePointers();
return doTrackDrc( aRefSeg, aList ) ? OK_DRC : BAD_DRC; if( ! doTrackDrc( aRefSeg, aList ) )
return BAD_DRC;
return doTrackKeepoutDrc( aRefSeg ) ? OK_DRC : BAD_DRC;
} }
...@@ -443,11 +457,13 @@ public: ...@@ -443,11 +457,13 @@ public:
* @param aSaveReport A boolean telling whether to generate disk file report. * @param aSaveReport A boolean telling whether to generate disk file report.
*/ */
void SetSettings( bool aPad2PadTest, bool aUnconnectedTest, void SetSettings( bool aPad2PadTest, bool aUnconnectedTest,
bool aZonesTest, const wxString& aReportName, bool aSaveReport ) bool aZonesTest, bool aKeepoutTest,
const wxString& aReportName, bool aSaveReport )
{ {
m_doPad2PadTest = aPad2PadTest; m_doPad2PadTest = aPad2PadTest;
m_doUnconnectedTest = aUnconnectedTest; m_doUnconnectedTest = aUnconnectedTest;
m_doZonesTest = aZonesTest; m_doZonesTest = aZonesTest;
m_doKeepoutTest = aKeepoutTest;
m_rptFilename = aReportName; m_rptFilename = aReportName;
m_doCreateRptFile = aSaveReport; m_doCreateRptFile = aSaveReport;
} }
......
...@@ -1343,6 +1343,10 @@ void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent ) ...@@ -1343,6 +1343,10 @@ void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
break; break;
case ID_PCB_KEEPOUT_AREA_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add keepout" ) );
break;
case ID_PCB_MIRE_BUTT: case ID_PCB_MIRE_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add layer alignment target" ) ); SetToolID( id, wxCURSOR_PENCIL, _( "Add layer alignment target" ) );
break; break;
......
...@@ -980,7 +980,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const ...@@ -980,7 +980,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
FMT_IU( aZone->m_Poly->GetHatchPitch() ).c_str() ); FMT_IU( aZone->m_Poly->GetHatchPitch() ).c_str() );
if( aZone->GetPriority() > 0 ) if( aZone->GetPriority() > 0 )
m_out->Print( aNestLevel+1, " (priority %d)\n", aZone->GetPriority() ); m_out->Print( aNestLevel+1, "(priority %d)\n", aZone->GetPriority() );
m_out->Print( aNestLevel+1, "(connect_pads" ); m_out->Print( aNestLevel+1, "(connect_pads" );
...@@ -1009,6 +1009,14 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const ...@@ -1009,6 +1009,14 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
m_out->Print( aNestLevel+1, "(min_thickness %s)\n", m_out->Print( aNestLevel+1, "(min_thickness %s)\n",
FMT_IU( aZone->GetMinThickness() ).c_str() ); FMT_IU( aZone->GetMinThickness() ).c_str() );
if( aZone->GetIsKeepout() )
{
m_out->Print( aNestLevel+1, "(keepout (tracks %s) (vias %s) (pads %s))\n",
aZone->GetDoNotAllowTracks() ? "not_allowed" : "allowed",
aZone->GetDoNotAllowVias() ? "not_allowed" : "allowed",
aZone->GetDoNotAllowPads() ? "not_allowed" : "allowed" );
}
m_out->Print( aNestLevel+1, "(fill" ); m_out->Print( aNestLevel+1, "(fill" );
// Default is not filled. // Default is not filled.
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2007-2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2007-2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2004 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr * Copyright (C) 2004 Jean-Pierre Charras, jp.charras@wanadoo.fr
* Copyright (C) 1992-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -2205,6 +2205,34 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() ...@@ -2205,6 +2205,34 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
zc->SetCornerRadius( cornerRadius ); zc->SetCornerRadius( cornerRadius );
} }
else if( TESTLINE( "ZKeepout" ) )
{
zc->SetIsKeepout( true );
// e.g. "ZKeepout tracks N vias N pads Y"
data = strtok( line + SZ( "ZKeepout" ), delims );
while( data )
{
if( !strcmp( data, "tracks" ) )
{
data = strtok( NULL, delims );
zc->SetDoNotAllowTracks( data && *data == 'N' );
}
else if( !strcmp( data, "vias" ) )
{
data = strtok( NULL, delims );
zc->SetDoNotAllowVias( data && *data == 'N' );
}
else if( !strcmp( data, "pads" ) )
{
data = strtok( NULL, delims );
zc->SetDoNotAllowPads( data && *data == 'N' );
}
data = strtok( NULL, delims );
}
}
else if( TESTLINE( "ZOptions" ) ) else if( TESTLINE( "ZOptions" ) )
{ {
// e.g. "ZOptions 0 32 F 200 200" // e.g. "ZOptions 0 32 F 200 200"
...@@ -3566,6 +3594,14 @@ void LEGACY_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const ...@@ -3566,6 +3594,14 @@ void LEGACY_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const
fmtBIU( me->GetThermalReliefGap() ).c_str(), fmtBIU( me->GetThermalReliefGap() ).c_str(),
fmtBIU( me->GetThermalReliefCopperBridge() ).c_str() ); fmtBIU( me->GetThermalReliefCopperBridge() ).c_str() );
if( me->GetIsKeepout() )
{
fprintf( m_fp, "ZKeepout tracks %c vias %c pads %c\n",
me->GetDoNotAllowTracks() ? 'N' : 'Y',
me->GetDoNotAllowVias() ? 'N' : 'Y',
me->GetDoNotAllowPads() ? 'N' : 'Y' );
}
fprintf( m_fp, "ZSmoothing %d %s\n", fprintf( m_fp, "ZSmoothing %d %s\n",
me->GetCornerSmoothingType(), me->GetCornerSmoothingType(),
fmtBIU( me->GetCornerRadius() ).c_str() ); fmtBIU( me->GetCornerRadius() ).c_str() );
......
...@@ -370,6 +370,10 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -370,6 +370,10 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
AddMenuItem( placeMenu, ID_PCB_ZONES_BUTT, AddMenuItem( placeMenu, ID_PCB_ZONES_BUTT,
_( "&Zone" ), _( "Add filled zones" ), KiBitmap( add_zone_xpm ) ); _( "&Zone" ), _( "Add filled zones" ), KiBitmap( add_zone_xpm ) );
// Keepout areas
AddMenuItem( placeMenu, ID_PCB_KEEPOUT_AREA_BUTT,
_( "&Zone" ), _( "Add keepout areas" ), KiBitmap( add_keepout_area_xpm ) );
// Text // Text
AddMenuItem( placeMenu, ID_PCB_ADD_TEXT_BUTT, AddMenuItem( placeMenu, ID_PCB_ADD_TEXT_BUTT,
_( "Te&xt" ), _( "Add text on copper layers or graphic text" ), _( "Te&xt" ), _( "Add text on copper layers or graphic text" ),
......
...@@ -291,37 +291,13 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -291,37 +291,13 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
break; break;
case ID_PCB_ZONES_BUTT: case ID_PCB_ZONES_BUTT:
case ID_PCB_KEEPOUT_AREA_BUTT:
/* ZONE Tool is selected. Determine action for a left click: /* ZONE or KEEPOUT Tool is selected. Determine action for a left click:
* this can be start a new zone or select and move an existing zone outline corner * this can be start a new zone or select and move an existing zone outline corner
* if found near the mouse cursor * if found near the mouse cursor
*/ */
if( (DrawStruct == NULL) || (DrawStruct->GetFlags() == 0) ) if( (DrawStruct == NULL) || (DrawStruct->GetFlags() == 0) )
{ {
#if 0 // Set to 1 to automatically edit a zone found under the mouse
// there is no current item, try to find something under the mouse cursor
DrawStruct = PcbGeneralLocateAndDisplay();
bool hit_on_corner = false;
if( DrawStruct && (DrawStruct->Type() == PCB_ZONE_AREA_T) )
{
// We have a hit under mouse (a zone outline corner or segment)
// test for a corner only because want to move corners only.
ZONE_CONTAINER* edge_zone = (ZONE_CONTAINER*) DrawStruct;
if( edge_zone->HitTestForCorner( GetScreen()->RefPos( true ) ) ) // corner located!
hit_on_corner = true;
}
if( hit_on_corner )
{
m_canvas->MoveCursorToCrossHair();
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
m_canvas->SetAutoPanRequest( true );
Start_Move_Zone_Corner( aDC, zone_cont, zone_cont->m_CornerSelection, false );
}
else
#endif
if( Begin_Zone( aDC ) ) if( Begin_Zone( aDC ) )
{ {
m_canvas->SetAutoPanRequest( true ); m_canvas->SetAutoPanRequest( true );
...@@ -521,6 +497,7 @@ void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -521,6 +497,7 @@ void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
break; break;
case ID_PCB_ZONES_BUTT: case ID_PCB_ZONES_BUTT:
case ID_PCB_KEEPOUT_AREA_BUTT:
if( End_Zone( aDC ) ) if( End_Zone( aDC ) )
{ {
m_canvas->SetAutoPanRequest( false ); m_canvas->SetAutoPanRequest( false );
......
...@@ -329,6 +329,12 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -329,6 +329,12 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
aPopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
break; break;
case ID_PCB_KEEPOUT_AREA_BUTT:
AddMenuItem( aPopMenu, ID_POPUP_PCB_SELECT_LAYER,
_( "Select Working Layer" ), KiBitmap( select_w_layer_xpm ) );
aPopMenu->AppendSeparator();
break;
case ID_TRACK_BUTT: case ID_TRACK_BUTT:
if ( ! locate_track ) // This menu is already added when a track is located if ( ! locate_track ) // This menu is already added when a track is located
AddMenuItem( aPopMenu, Append_Track_Width_List( GetBoard() ), AddMenuItem( aPopMenu, Append_Track_Width_List( GetBoard() ),
...@@ -601,7 +607,9 @@ void PCB_EDIT_FRAME::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu* ...@@ -601,7 +607,9 @@ void PCB_EDIT_FRAME::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu*
{ {
wxMenu* zones_menu = new wxMenu(); wxMenu* zones_menu = new wxMenu();
AddMenuItem( aPopMenu, zones_menu, -1, _( "Zones" ), KiBitmap( add_zone_xpm ) ); AddMenuItem( aPopMenu, zones_menu, -1,
edge_zone->GetIsKeepout() ? _("Keepout Area") : _( "Zones" ),
KiBitmap( add_zone_xpm ) );
if( edge_zone->HitTestForCorner( GetScreen()->RefPos( true ) ) ) if( edge_zone->HitTestForCorner( GetScreen()->RefPos( true ) ) )
{ {
...@@ -632,6 +640,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu* ...@@ -632,6 +640,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu*
zones_menu->AppendSeparator(); zones_menu->AppendSeparator();
if( ! edge_zone->GetIsKeepout() )
AddMenuItem( zones_menu, ID_POPUP_PCB_FILL_ZONE, _( "Fill Zone" ), AddMenuItem( zones_menu, ID_POPUP_PCB_FILL_ZONE, _( "Fill Zone" ),
KiBitmap( fill_zone_xpm ) ); KiBitmap( fill_zone_xpm ) );
......
...@@ -2464,6 +2464,49 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR ) ...@@ -2464,6 +2464,49 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR )
break; break;
case T_keepout:
zone->SetIsKeepout( true );
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
{
if( token == T_LEFT )
token = NextTok();
switch( token )
{
case T_tracks:
token = NextTok();
if( token != T_allowed && token != T_not_allowed )
Expecting( "allowed or not_allowed" );
zone->SetDoNotAllowTracks( token == T_not_allowed );
break;
case T_vias:
token = NextTok();
if( token != T_allowed && token != T_not_allowed )
Expecting( "allowed or not_allowed" );
zone->SetDoNotAllowVias( token == T_not_allowed );
break;
case T_pads:
token = NextTok();
if( token != T_allowed && token != T_not_allowed )
Expecting( "allowed or not_allowed" );
zone->SetDoNotAllowPads( token == T_not_allowed );
break;
default:
Expecting( "tracks, vias or pads" );
}
NeedRIGHT();
}
break;
case T_polygon: case T_polygon:
{ {
std::vector< wxPoint > corners; std::vector< wxPoint > corners;
......
...@@ -26,6 +26,7 @@ enum pcbnew_ids ...@@ -26,6 +26,7 @@ enum pcbnew_ids
ID_PCB_MODULE_BUTT, ID_PCB_MODULE_BUTT,
ID_TRACK_BUTT, ID_TRACK_BUTT,
ID_PCB_ZONES_BUTT, ID_PCB_ZONES_BUTT,
ID_PCB_KEEPOUT_AREA_BUTT,
ID_PCB_ADD_LINE_BUTT, ID_PCB_ADD_LINE_BUTT,
ID_PCB_CIRCLE_BUTT, ID_PCB_CIRCLE_BUTT,
ID_PCB_ARC_BUTT, ID_PCB_ARC_BUTT,
......
...@@ -429,6 +429,10 @@ void PCB_EDIT_FRAME::ReCreateVToolbar() ...@@ -429,6 +429,10 @@ void PCB_EDIT_FRAME::ReCreateVToolbar()
m_drawToolBar->AddTool( ID_PCB_ZONES_BUTT, wxEmptyString, KiBitmap( add_zone_xpm ), m_drawToolBar->AddTool( ID_PCB_ZONES_BUTT, wxEmptyString, KiBitmap( add_zone_xpm ),
_( "Add filled zones" ), wxITEM_CHECK ); _( "Add filled zones" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_PCB_KEEPOUT_AREA_BUTT, wxEmptyString,
KiBitmap( add_keepout_area_xpm ),
_( "Add keepout areas" ), wxITEM_CHECK );
m_drawToolBar->AddSeparator(); m_drawToolBar->AddSeparator();
m_drawToolBar->AddTool( ID_PCB_ADD_LINE_BUTT, wxEmptyString, KiBitmap( add_dashed_line_xpm ), m_drawToolBar->AddTool( ID_PCB_ADD_LINE_BUTT, wxEmptyString, KiBitmap( add_dashed_line_xpm ),
_( "Add graphic line or polygon" ), wxITEM_CHECK ); _( "Add graphic line or polygon" ), wxITEM_CHECK );
......
...@@ -69,35 +69,35 @@ int ZONE_CONTAINER::BuildFilledPolysListData( BOARD* aPcb, std::vector <CPolyPt> ...@@ -69,35 +69,35 @@ int ZONE_CONTAINER::BuildFilledPolysListData( BOARD* aPcb, std::vector <CPolyPt>
return 0; return 0;
// Make a smoothed polygon out of the user-drawn polygon if required // Make a smoothed polygon out of the user-drawn polygon if required
if( smoothedPoly ) if( m_smoothedPoly )
{ {
delete smoothedPoly; delete m_smoothedPoly;
smoothedPoly = NULL; m_smoothedPoly = NULL;
} }
switch( cornerSmoothingType ) switch( m_cornerSmoothingType )
{ {
case ZONE_SETTINGS::SMOOTHING_CHAMFER: case ZONE_SETTINGS::SMOOTHING_CHAMFER:
smoothedPoly = m_Poly->Chamfer( cornerRadius ); m_smoothedPoly = m_Poly->Chamfer( m_cornerRadius );
break; break;
case ZONE_SETTINGS::SMOOTHING_FILLET: case ZONE_SETTINGS::SMOOTHING_FILLET:
smoothedPoly = m_Poly->Fillet( cornerRadius, m_ArcToSegmentsCount ); m_smoothedPoly = m_Poly->Fillet( m_cornerRadius, m_ArcToSegmentsCount );
break; break;
default: default:
smoothedPoly = new CPolyLine; m_smoothedPoly = new CPolyLine;
smoothedPoly->Copy( m_Poly ); m_smoothedPoly->Copy( m_Poly );
break; break;
} }
smoothedPoly->MakeKboolPoly( -1, -1, NULL, true ); m_smoothedPoly->MakeKboolPoly( -1, -1, NULL, true );
int count = 0; int count = 0;
while( smoothedPoly->GetKboolEngine()->StartPolygonGet() ) while( m_smoothedPoly->GetKboolEngine()->StartPolygonGet() )
{ {
CPolyPt corner( 0, 0, false ); CPolyPt corner( 0, 0, false );
while( smoothedPoly->GetKboolEngine()->PolygonHasMorePoints() ) while( m_smoothedPoly->GetKboolEngine()->PolygonHasMorePoints() )
{ {
corner.x = (int) smoothedPoly->GetKboolEngine()->GetPolygonXPoint(); corner.x = (int) m_smoothedPoly->GetKboolEngine()->GetPolygonXPoint();
corner.y = (int) smoothedPoly->GetKboolEngine()->GetPolygonYPoint(); corner.y = (int) m_smoothedPoly->GetKboolEngine()->GetPolygonYPoint();
corner.end_contour = false; corner.end_contour = false;
if( aCornerBuffer ) if( aCornerBuffer )
aCornerBuffer->push_back( corner ); aCornerBuffer->push_back( corner );
...@@ -117,10 +117,10 @@ int ZONE_CONTAINER::BuildFilledPolysListData( BOARD* aPcb, std::vector <CPolyPt> ...@@ -117,10 +117,10 @@ int ZONE_CONTAINER::BuildFilledPolysListData( BOARD* aPcb, std::vector <CPolyPt>
m_FilledPolysList.pop_back(); m_FilledPolysList.pop_back();
m_FilledPolysList.push_back( corner ); m_FilledPolysList.push_back( corner );
} }
smoothedPoly->GetKboolEngine()->EndPolygonGet(); m_smoothedPoly->GetKboolEngine()->EndPolygonGet();
} }
smoothedPoly->FreeKboolEngine(); m_smoothedPoly->FreeKboolEngine();
/* For copper layers, we now must add holes in the Polygon list. /* For copper layers, we now must add holes in the Polygon list.
* holes are pads and tracks with their clearance area * holes are pads and tracks with their clearance area
......
...@@ -68,4 +68,15 @@ ZONE_EDIT_T InvokeNonCopperZonesEditor( PCB_BASE_FRAME* aParent, ZONE_CONTAINER* ...@@ -68,4 +68,15 @@ ZONE_EDIT_T InvokeNonCopperZonesEditor( PCB_BASE_FRAME* aParent, ZONE_CONTAINER*
*/ */
ZONE_EDIT_T InvokeCopperZonesEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings ); ZONE_EDIT_T InvokeCopperZonesEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings );
/**
* Function InvokeKeepoutAreaEditor
* invokes up a modal dialog window for copper zone editing.
*
* @param aCaller is the PCB_BASE_FRAME calling parent window for the modal dialog,
* and it gives access to the BOARD through PCB_BASE_FRAME::GetBoard().
* @param aSettings points to the ZONE_SETTINGS to edit.
* @return ZONE_EDIT_T - tells if user aborted, changed only one zone, or all of them.
*/
ZONE_EDIT_T InvokeKeepoutAreaEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings );
#endif // ZONES_H_ #endif // ZONES_H_
...@@ -83,7 +83,7 @@ void PCB_EDIT_FRAME::Add_Similar_Zone( wxDC* DC, ZONE_CONTAINER* aZone ) ...@@ -83,7 +83,7 @@ void PCB_EDIT_FRAME::Add_Similar_Zone( wxDC* DC, ZONE_CONTAINER* aZone )
// Use the general event handler to set others params (like toolbar) // Use the general event handler to set others params (like toolbar)
wxCommandEvent evt; wxCommandEvent evt;
evt.SetId( ID_PCB_ZONES_BUTT ); evt.SetId( aZone->GetIsKeepout() ? ID_PCB_KEEPOUT_AREA_BUTT : ID_PCB_ZONES_BUTT );
OnSelectTool( evt ); OnSelectTool( evt );
} }
...@@ -103,7 +103,7 @@ void PCB_EDIT_FRAME::Add_Zone_Cutout( wxDC* DC, ZONE_CONTAINER* aZone ) ...@@ -103,7 +103,7 @@ void PCB_EDIT_FRAME::Add_Zone_Cutout( wxDC* DC, ZONE_CONTAINER* aZone )
// Use the general event handle to set others params (like toolbar) // Use the general event handle to set others params (like toolbar)
wxCommandEvent evt; wxCommandEvent evt;
evt.SetId( ID_PCB_ZONES_BUTT ); evt.SetId( aZone->GetIsKeepout() ? ID_PCB_KEEPOUT_AREA_BUTT : ID_PCB_ZONES_BUTT );
OnSelectTool( evt ); OnSelectTool( evt );
} }
...@@ -116,7 +116,16 @@ void PCB_EDIT_FRAME::duplicateZone( wxDC* aDC, ZONE_CONTAINER* aZone ) ...@@ -116,7 +116,16 @@ void PCB_EDIT_FRAME::duplicateZone( wxDC* aDC, ZONE_CONTAINER* aZone )
ZONE_SETTINGS zoneSettings; ZONE_SETTINGS zoneSettings;
zoneSettings << *aZone; zoneSettings << *aZone;
if( InvokeCopperZonesEditor( this, &zoneSettings ) ) bool success;
if( aZone->GetIsKeepout() )
success = InvokeKeepoutAreaEditor( this, &zoneSettings );
else if( aZone->IsOnCopperLayer() )
success = InvokeCopperZonesEditor( this, &zoneSettings );
else
success = InvokeNonCopperZonesEditor( this, aZone, &zoneSettings );
if( success )
{ {
zoneSettings.ExportSetting( *newZone ); zoneSettings.ExportSetting( *newZone );
newZone->m_Poly->Hatch(); newZone->m_Poly->Hatch();
...@@ -510,7 +519,17 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) ...@@ -510,7 +519,17 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
// If no zone contour in progress, a new zone is being created: // If no zone contour in progress, a new zone is being created:
if( !GetBoard()->m_CurrentZoneContour ) if( !GetBoard()->m_CurrentZoneContour )
{
if( GetToolId() == ID_PCB_KEEPOUT_AREA_BUTT &&
getActiveLayer() >= FIRST_NON_COPPER_LAYER )
{
DisplayError( this,
_( "Error: a keepout area is allowed only on copper layers" ) );
return 0;
}
else
GetBoard()->m_CurrentZoneContour = new ZONE_CONTAINER( GetBoard() ); GetBoard()->m_CurrentZoneContour = new ZONE_CONTAINER( GetBoard() );
}
ZONE_CONTAINER* zone = GetBoard()->m_CurrentZoneContour; ZONE_CONTAINER* zone = GetBoard()->m_CurrentZoneContour;
...@@ -557,12 +576,17 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) ...@@ -557,12 +576,17 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
zoneInfo.m_CurrentZone_Layer = zone->GetLayer(); zoneInfo.m_CurrentZone_Layer = zone->GetLayer();
if( GetToolId() == ID_PCB_KEEPOUT_AREA_BUTT )
{
zoneInfo.SetIsKeepout( true );
edited = InvokeKeepoutAreaEditor( this, &zoneInfo );
}
else
edited = InvokeCopperZonesEditor( this, &zoneInfo ); edited = InvokeCopperZonesEditor( this, &zoneInfo );
} }
else // Put a zone on a non copper layer (technical layer) else // Put a zone on a non copper layer (technical layer)
{ {
zoneInfo.m_NetcodeSelection = 0; // No net for non copper zones zoneInfo.m_NetcodeSelection = 0; // No net for non copper zones
edited = InvokeNonCopperZonesEditor( this, zone, &zoneInfo ); edited = InvokeNonCopperZonesEditor( this, zone, &zoneInfo );
} }
...@@ -591,7 +615,8 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) ...@@ -591,7 +615,8 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
} }
// Show the Net for zones on copper layers // Show the Net for zones on copper layers
if( zoneInfo.m_CurrentZone_Layer < FIRST_NO_COPPER_LAYER ) if( zoneInfo.m_CurrentZone_Layer < FIRST_NO_COPPER_LAYER &&
! zoneInfo.GetIsKeepout() )
{ {
if( s_CurrentZone ) if( s_CurrentZone )
{ {
...@@ -815,7 +840,13 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* aZone ) ...@@ -815,7 +840,13 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* aZone )
s_PickedList.ClearListAndDeleteItems(); s_PickedList.ClearListAndDeleteItems();
SaveCopyOfZones(s_PickedList, GetBoard(), -1, -1 ); SaveCopyOfZones(s_PickedList, GetBoard(), -1, -1 );
if( aZone->GetLayer() < FIRST_NO_COPPER_LAYER ) if( aZone->GetIsKeepout() )
{
// edit a keepout area on a copper layer
zoneInfo << *aZone;
edited = InvokeKeepoutAreaEditor( this, &zoneInfo );
}
else if( aZone->GetLayer() < FIRST_NO_COPPER_LAYER )
{ {
// edit a zone on a copper layer // edit a zone on a copper layer
......
...@@ -87,6 +87,13 @@ void PCB_EDIT_FRAME::Delete_OldZone_Fill( SEGZONE* aZone, time_t aTimestamp ) ...@@ -87,6 +87,13 @@ void PCB_EDIT_FRAME::Delete_OldZone_Fill( SEGZONE* aZone, time_t aTimestamp )
int PCB_EDIT_FRAME::Fill_Zone( ZONE_CONTAINER* aZone ) int PCB_EDIT_FRAME::Fill_Zone( ZONE_CONTAINER* aZone )
{ {
aZone->ClearFilledPolysList();
aZone->UnFill();
// Cannot fill keepout zones:
if( aZone->GetIsKeepout() )
return 1;
wxString msg; wxString msg;
ClearMsgPanel(); ClearMsgPanel();
...@@ -105,8 +112,6 @@ int PCB_EDIT_FRAME::Fill_Zone( ZONE_CONTAINER* aZone ) ...@@ -105,8 +112,6 @@ int PCB_EDIT_FRAME::Fill_Zone( ZONE_CONTAINER* aZone )
wxBusyCursor dummy; // Shows an hourglass cursor (removed by its destructor) wxBusyCursor dummy; // Shows an hourglass cursor (removed by its destructor)
aZone->ClearFilledPolysList();
aZone->UnFill();
aZone->BuildFilledPolysListData( GetBoard() ); aZone->BuildFilledPolysListData( GetBoard() );
OnModify(); OnModify();
...@@ -142,6 +147,9 @@ int PCB_EDIT_FRAME::Fill_All_Zones( wxWindow * aActiveWindow, bool aVerbose ) ...@@ -142,6 +147,9 @@ int PCB_EDIT_FRAME::Fill_All_Zones( wxWindow * aActiveWindow, bool aVerbose )
for( ii = 0; ii < areaCount; ii++ ) for( ii = 0; ii < areaCount; ii++ )
{ {
ZONE_CONTAINER* zoneContainer = GetBoard()->GetArea( ii ); ZONE_CONTAINER* zoneContainer = GetBoard()->GetArea( ii );
if( zoneContainer->GetIsKeepout() )
continue;
msg.Printf( FORMAT_STRING, ii+1, areaCount, GetChars( zoneContainer->GetNetName() ) ); msg.Printf( FORMAT_STRING, ii+1, areaCount, GetChars( zoneContainer->GetNetName() ) );
if( progressDialog ) if( progressDialog )
......
...@@ -360,6 +360,9 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) ...@@ -360,6 +360,9 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
if( zone->GetLayer() != GetLayer() ) if( zone->GetLayer() != GetLayer() )
continue; continue;
if( zone->GetIsKeepout() )
continue;
if( zone->GetPriority() <= GetPriority() ) if( zone->GetPriority() <= GetPriority() )
continue; continue;
...@@ -372,8 +375,12 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) ...@@ -372,8 +375,12 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
// However if the zone has the same net as the current zone, // However if the zone has the same net as the current zone,
// do not add clearance. // do not add clearance.
// the zone will be connected to the current zone, but filled areas // the zone will be connected to the current zone, but filled areas
// will use different parameters (clearnce, thermal shapes ) // will use different parameters (clearance, thermal shapes )
bool addclearance = GetNet() != zone->GetNet(); bool addclearance = GetNet() != zone->GetNet();
if( zone->GetIsKeepout() )
addclearance = false;
zone->TransformShapeWithClearanceToPolygon( zone->TransformShapeWithClearanceToPolygon(
cornerBufferPolysToSubstract, cornerBufferPolysToSubstract,
zone_clearance, s_CircleToSegmentsCount, zone_clearance, s_CircleToSegmentsCount,
......
...@@ -70,19 +70,37 @@ bool ZONE_CONTAINER::IsSame( const ZONE_CONTAINER& aZoneToCompare ) ...@@ -70,19 +70,37 @@ bool ZONE_CONTAINER::IsSame( const ZONE_CONTAINER& aZoneToCompare )
if( m_Netname != aZoneToCompare.m_Netname ) if( m_Netname != aZoneToCompare.m_Netname )
return false; return false;
// Compare zone specfic parameters if( GetPriority() != aZoneToCompare.GetPriority() )
if( m_ZoneClearance != aZoneToCompare.m_ZoneClearance )
return false; return false;
if( m_ZoneMinThickness != aZoneToCompare.m_ZoneMinThickness ) // Compare zone specific parameters
if( GetIsKeepout() != aZoneToCompare.GetIsKeepout() )
return false; return false;
if( m_FillMode != aZoneToCompare.m_FillMode ) if( GetIsKeepout() )
{
if( GetDoNotAllowPads() != aZoneToCompare.GetDoNotAllowPads() )
return false; return false;
if( GetDoNotAllowVias() != aZoneToCompare.GetDoNotAllowVias() )
return false;
if( GetDoNotAllowTracks() != aZoneToCompare.GetDoNotAllowTracks() )
return false;
}
if( m_ArcToSegmentsCount != aZoneToCompare.m_ArcToSegmentsCount ) if( m_ArcToSegmentsCount != aZoneToCompare.m_ArcToSegmentsCount )
return false; return false;
if( m_ZoneClearance != aZoneToCompare.m_ZoneClearance )
return false;
if( m_ZoneMinThickness != aZoneToCompare.m_ZoneMinThickness )
return false;
if( m_FillMode != aZoneToCompare.m_FillMode )
return false;
if( m_PadConnection != aZoneToCompare.m_PadConnection ) if( m_PadConnection != aZoneToCompare.m_PadConnection )
return false; return false;
...@@ -92,8 +110,6 @@ bool ZONE_CONTAINER::IsSame( const ZONE_CONTAINER& aZoneToCompare ) ...@@ -92,8 +110,6 @@ bool ZONE_CONTAINER::IsSame( const ZONE_CONTAINER& aZoneToCompare )
if( m_ThermalReliefCopperBridge != aZoneToCompare.m_ThermalReliefCopperBridge ) if( m_ThermalReliefCopperBridge != aZoneToCompare.m_ThermalReliefCopperBridge )
return false; return false;
if( GetPriority() != aZoneToCompare.GetPriority() )
return false;
// Compare outlines // Compare outlines
wxASSERT( m_Poly ); // m_Poly == NULL Should never happen wxASSERT( m_Poly ); // m_Poly == NULL Should never happen
......
...@@ -29,7 +29,7 @@ private: ...@@ -29,7 +29,7 @@ private:
PCB_BASE_FRAME* m_Parent; PCB_BASE_FRAME* m_Parent;
ZONE_CONTAINER* m_zone; ZONE_CONTAINER* m_zone;
ZONE_SETTINGS* m_ptr; ZONE_SETTINGS* m_ptr;
ZONE_SETTINGS m_settings; ZONE_SETTINGS m_settings; // working copy of zone settings
void OnOkClick( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
...@@ -76,8 +76,6 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::Init() ...@@ -76,8 +76,6 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::Init()
{ {
SetReturnCode( ZONE_ABORT ); // Will be changed on button click SetReturnCode( ZONE_ABORT ); // Will be changed on button click
m_FillModeCtrl->SetSelection( m_settings.m_FillMode ? 1 : 0 );
AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit ); AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit );
wxString msg = ReturnStringFromValue( g_UserUnit, m_settings.m_ZoneMinThickness ); wxString msg = ReturnStringFromValue( g_UserUnit, m_settings.m_ZoneMinThickness );
m_ZoneMinThicknessCtrl->SetValue( msg ); m_ZoneMinThicknessCtrl->SetValue( msg );
...@@ -132,11 +130,11 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::OnOkClick( wxCommandEvent& event ) ...@@ -132,11 +130,11 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::OnOkClick( wxCommandEvent& event )
if( m_settings.m_ZoneMinThickness < 10 ) if( m_settings.m_ZoneMinThickness < 10 )
{ {
DisplayError( this, DisplayError( this,
_( "Error :\nyou must choose a copper min thickness value bigger than 0.001 inch (or 0.0254 mm)" ) ); _( "Error :\nyou must choose a min thickness value bigger than 0.001 inch (or 0.0254 mm)" ) );
return; return;
} }
m_settings.m_FillMode = (m_FillModeCtrl->GetSelection() == 0) ? 0 : 1; m_settings.m_FillMode = 0; // Use always polygon fill mode
switch( m_OutlineAppearanceCtrl->GetSelection() ) switch( m_OutlineAppearanceCtrl->GetSelection() )
{ {
......
This diff is collapsed.
This diff is collapsed.
...@@ -49,25 +49,22 @@ public: ...@@ -49,25 +49,22 @@ public:
int left, right, top, bottom; int left, right, top, bottom;
}; };
class CPoint
{
public:
int x, y;
public:
CPoint( void ) { x = y = 0; };
CPoint( int i, int j ) { x = i; y = j; };
};
class CSegment class CSegment
{ {
public: public:
int xi, yi, xf, yf; wxPoint m_Start;
wxPoint m_End;
CSegment() { }; CSegment() { };
CSegment( const wxPoint & aStart, const wxPoint & aEnd )
{
m_Start = aStart;
m_End = aEnd;
}
CSegment( int x0, int y0, int x1, int y1 ) CSegment( int x0, int y0, int x1, int y1 )
{ {
xi = x0; yi = y0; xf = x1; yf = y1; m_Start.x = x0; m_Start.y = y0;
m_End.x = x1; m_End.y = y1;
} }
}; };
...@@ -282,6 +279,25 @@ public: ...@@ -282,6 +279,25 @@ public:
void AppendBezier(int x1, int y1, int x2, int y2, int x3, int y3); void AppendBezier(int x1, int y1, int x2, int y2, int x3, int y3);
void AppendBezier(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4); void AppendBezier(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4);
/**
* Function Distance
* Calculates the distance between a point and the zone:
* @param aPoint the coordinate of the point.
* @return int = distance between the point and outline.
* 0 if the point is inside
*/
int Distance( const wxPoint& aPoint );
/**
* Function Distance
* Calculates the distance between a segment and the zone:
* @param aStart the starting point of the segment.
* @param aEnd the ending point of the segment.
* @param aWidth the width of the segment.
* @return int = distance between the segment and outline.
* 0 if segment intersects or is inside
*/
int Distance( wxPoint aStart, wxPoint aEnd, int aWidth );
private: private:
int m_layer; // layer to draw on int m_layer; // layer to draw on
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment