ADDED: Leader dimension object

Fixes https://gitlab.com/kicad/code/kicad/-/issues/5555
This commit is contained in:
Jon Evans 2020-09-12 16:09:40 -04:00
parent 0f22e8e2fe
commit 75ffce1a0b
43 changed files with 1916 additions and 323 deletions

View File

@ -138,8 +138,14 @@ void BOARD_ADAPTER::AddShapeWithClearanceToContainer( const DIMENSION* aDimensio
const int linewidth = aDimension->GetLineThickness() + (2 * aClearanceValue); const int linewidth = aDimension->GetLineThickness() + (2 * aClearanceValue);
for( const SEG& seg : aDimension->GetLines() ) for( const std::shared_ptr<SHAPE>& shape : aDimension->GetShapes() )
{ {
switch( shape->Type() )
{
case SH_SEGMENT:
{
const SEG& seg = static_cast<const SHAPE_SEGMENT*>( shape.get() )->GetSeg();
const SFVEC2F start3DU( seg.A.x * m_biuTo3Dunits, const SFVEC2F start3DU( seg.A.x * m_biuTo3Dunits,
-seg.A.y * m_biuTo3Dunits ); -seg.A.y * m_biuTo3Dunits );
@ -150,7 +156,29 @@ void BOARD_ADAPTER::AddShapeWithClearanceToContainer( const DIMENSION* aDimensio
end3DU, end3DU,
linewidth * m_biuTo3Dunits, linewidth * m_biuTo3Dunits,
*aDimension ) ); *aDimension ) );
break;
} }
case SH_CIRCLE:
{
int radius = static_cast<const SHAPE_CIRCLE*>( shape.get() )->GetRadius();
int deltar = aDimension->GetLineThickness();
SFVEC2F center( shape->Centre().x * m_biuTo3Dunits,
shape->Centre().y * m_biuTo3Dunits );
aDstContainer->Add( new CRING2D( center, ( radius - deltar ) * m_biuTo3Dunits,
( radius + deltar ) * m_biuTo3Dunits, *aDimension ) );
break;
}
default:
break;
}
}
} }

View File

@ -628,7 +628,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
0 ); 0 );
break; break;
case PCB_DIMENSION_T: case PCB_DIM_ALIGNED_T:
case PCB_DIM_LEADER_T:
AddShapeWithClearanceToContainer( (DIMENSION*) item, AddShapeWithClearanceToContainer( (DIMENSION*) item,
layerContainer, layerContainer,
curr_layer_id, curr_layer_id,
@ -911,7 +912,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
0 ); 0 );
break; break;
case PCB_DIMENSION_T: case PCB_DIM_ALIGNED_T:
case PCB_DIM_LEADER_T:
AddShapeWithClearanceToContainer( (DIMENSION*) item, AddShapeWithClearanceToContainer( (DIMENSION*) item,
layerContainer, layerContainer,
curr_layer_id, curr_layer_id,

View File

@ -111,6 +111,7 @@ set( BMAPS_SMALL
# image basenames that go into the toolbar sized destinations, i.e. 26x26 # image basenames that go into the toolbar sized destinations, i.e. 26x26
set( BMAPS_MID set( BMAPS_MID
about about
add_aligned_dimension
add_arc add_arc
add_board add_board
add_bus2bus add_bus2bus
@ -119,7 +120,6 @@ set( BMAPS_MID
add_component add_component
add_corner add_corner
add_dashed_line add_dashed_line
add_dimension
add_document add_document
add_gerber add_gerber
add_glabel add_glabel
@ -130,10 +130,12 @@ set( BMAPS_MID
add_hierarchical_subsheet add_hierarchical_subsheet
add_junction add_junction
add_keepout_area add_keepout_area
add_leader
add_library add_library
add_line2bus add_line2bus
add_line_label add_line_label
add_line add_line
add_orthogonal_dimension
add_pcb_target add_pcb_target
add_power add_power
add_rectangle add_rectangle

View File

@ -0,0 +1,55 @@
/* Do not modify this file, it was automatically generated by the
* PNG2cpp CMake script, using a *.png file as input.
*/
#include <bitmaps_png/bitmaps_list.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, 0x02, 0x5d, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0xb5, 0x95, 0xcf, 0x8b, 0x12,
0x61, 0x18, 0xc7, 0x1d, 0xd3, 0x09, 0x37, 0x94, 0x20, 0xa3,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, 0x53, 0x3b, 0xde, 0x26, 0x19, 0x49, 0xb4, 0x5a, 0xae, 0x55, 0x30,
0xb8, 0xf5, 0x47, 0x10, 0x15, 0x03, 0xc9, 0x28, 0x05, 0x41, 0x12, 0x55, 0x55, 0xc5, 0x7e, 0x7d,
0x7f, 0x02, 0x6c, 0xe9, 0xe3, 0xa9, 0x6e, 0x3e, 0xbd, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45,
0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
};
const BITMAP_OPAQUE add_aligned_dimension_xpm[1] = {{ png, sizeof( png ), "add_aligned_dimension_xpm" }};
//EOF

View File

@ -0,0 +1,53 @@
/* Do not modify this file, it was automatically generated by the
* PNG2cpp CMake script, using a *.png file as input.
*/
#include <bitmaps_png/bitmaps_list.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, 0x02, 0x45, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0xc5, 0x94, 0x3d, 0x68, 0x13,
0x61, 0x1c, 0x87, 0x13, 0x1a, 0x4c, 0x17, 0x11, 0xa2, 0x46, 0x1c, 0x8c, 0x31, 0x89, 0xb9, 0xe4,
0x42, 0xa5, 0x3a, 0x39, 0x44, 0xa9, 0xa2, 0xd0, 0x41, 0xaa, 0x60, 0x49, 0xa1, 0x75, 0x91, 0x26,
0x42, 0x1b, 0xe3, 0x26, 0xba, 0xb4, 0x53, 0x41, 0x5c, 0x44, 0x0a, 0x0e, 0x0e, 0x8e, 0x22, 0x4e,
0x56, 0x10, 0x8c, 0xa8, 0x8b, 0x83, 0x48, 0x51, 0x10, 0x0b, 0x7e, 0x0c, 0x8a, 0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0x3e, 0xd5, 0xd1, 0x5d, 0xd1, 0xf1, 0xb8, 0x2b, 0x31, 0xcc, 0x9a, 0x09, 0xfa, 0x5d, 0x11, 0xe5,
0x10, 0x3c, 0x27, 0xbe, 0xe6, 0x8a, 0xd2, 0xe9, 0x74, 0xdc, 0xb4, 0x55, 0x57, 0x95, 0x03, 0xa9,
0x54, 0x6a, 0x9d, 0x79, 0x55, 0xe7, 0x5d, 0x11, 0xf1, 0x20, 0x94, 0x88, 0x7f, 0xba, 0x22, 0xc9,
0x15, 0x73, 0xd4, 0xc5, 0x55, 0x27, 0x1c, 0x93, 0x5c, 0x67, 0x92, 0xcf, 0x94, 0xbb, 0x5d, 0x11,
0xd5, 0x61, 0x93, 0x4f, 0x8e, 0xf2, 0xd0, 0xec, 0xf0, 0xe5, 0x9f, 0xd2, 0xa3, 0x53, 0xd1, 0x56,
0x26, 0x99, 0x57, 0x9e, 0x11, 0xef, 0x5d, 0x76, 0xd4, 0x16, 0xf5, 0x0f, 0x95, 0x5f, 0xd0, 0xf7,
0xcf, 0x7f, 0x23, 0x5c, 0x76, 0xaf, 0x79, 0xfe, 0x7a, 0x0c, 0x2f, 0xe0, 0x16, 0x3c, 0x31, 0xc7,
0xb7, 0x80, 0xef, 0xb0, 0x7f, 0xff, 0x59, 0xc9, 0x64, 0x37, 0x93, 0x9e, 0x30, 0x09, 0xaa, 0x47,
0x52, 0x87, 0xb3, 0x4a, 0x81, 0xd0, 0xff, 0xf8, 0x7e, 0x01, 0x36, 0x6c, 0xfa, 0x28, 0xb6, 0x73,
0xfe, 0xed, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
};
const BITMAP_OPAQUE add_leader_xpm[1] = {{ png, sizeof( png ), "add_leader_xpm" }};
//EOF

View File

@ -8,43 +8,43 @@
static const unsigned char png[] = { static const unsigned char png[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 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, 0x04, 0x00, 0x00, 0x00, 0x03, 0x43, 0x84, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x1a, 0x08, 0x04, 0x00, 0x00, 0x00, 0x03, 0x43, 0x84,
0x45, 0x00, 0x00, 0x02, 0x29, 0x49, 0x44, 0x41, 0x54, 0x38, 0xcb, 0xd5, 0x94, 0xc1, 0x6f, 0x12, 0x45, 0x00, 0x00, 0x02, 0x2a, 0x49, 0x44, 0x41, 0x54, 0x38, 0xcb, 0xd5, 0x94, 0xc1, 0x6f, 0x12,
0x41, 0x14, 0xc6, 0x37, 0x31, 0x5e, 0xb4, 0xa5, 0x5e, 0xf8, 0x17, 0x5a, 0xef, 0x93, 0x62, 0x04, 0x41, 0x14, 0xc6, 0x37, 0x31, 0x5e, 0xb4, 0xa5, 0x5e, 0xf8, 0x17, 0x5a, 0xef, 0x93, 0x62, 0x04,
0x8c, 0x97, 0x26, 0xa4, 0x91, 0x84, 0x80, 0xb1, 0x37, 0x7a, 0x72, 0x5d, 0xbd, 0x78, 0x20, 0x31, 0x8c, 0x97, 0x26, 0xa4, 0x91, 0x84, 0x80, 0xa9, 0x37, 0x7a, 0x72, 0x5d, 0xbd, 0x78, 0x20, 0x31,
0x1e, 0x5c, 0xf4, 0xd6, 0xea, 0x6d, 0x6d, 0x57, 0x84, 0x26, 0x55, 0xd3, 0x78, 0x28, 0x85, 0xb6, 0x1e, 0x5c, 0xf4, 0xd6, 0xea, 0x6d, 0x6d, 0x57, 0x84, 0x26, 0x55, 0xd3, 0x78, 0x28, 0x85, 0xb6,
0x1a, 0x96, 0x18, 0x12, 0x83, 0x46, 0x4c, 0x49, 0x04, 0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0x02, 0x67, 0x5e, 0xee, 0xb8, 0xba, 0xd8, 0xc0, 0x57, 0x8d, 0xe1, 0x9d, 0xde, 0x71, 0xac, 0xdf, 0x4b, 0xe0, 0xcc, 0xcb, 0x1d, 0x57, 0x17, 0xeb, 0xfb, 0xaa, 0xd1,
0x5c, 0xdc, 0x3b, 0xc2, 0xfe, 0xe1, 0x86, 0x32, 0x9c, 0x2f, 0x7e, 0xb4, 0xb1, 0x5f, 0xc5, 0xd8, 0x9d, 0xf3, 0x7b, 0x47, 0xd8, 0x3f, 0xdc, 0x50, 0xba, 0xf3, 0xc5, 0x8f, 0x36, 0xf6, 0x0b, 0xc3,
0xb1, 0x0b, 0xd5, 0xd8, 0x0b, 0x57, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0xa7, 0xb1, 0x09, 0x45, 0x7d, 0xc0, 0x44, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae,
0x60, 0x82, 0x42, 0x60, 0x82,
}; };
const BITMAP_OPAQUE zoom_fit_to_objects_xpm[1] = {{ png, sizeof( png ), "zoom_fit_to_objects_xpm" }}; const BITMAP_OPAQUE zoom_fit_to_objects_xpm[1] = {{ png, sizeof( png ), "zoom_fit_to_objects_xpm" }};

View File

@ -29,6 +29,7 @@
// may eventually generate this file automatically. // may eventually generate this file automatically.
EXTERN_BITMAP( about_xpm ) EXTERN_BITMAP( about_xpm )
EXTERN_BITMAP( add_aligned_dimension_xpm )
EXTERN_BITMAP( add_arc_xpm ) EXTERN_BITMAP( add_arc_xpm )
EXTERN_BITMAP( add_board_xpm ) EXTERN_BITMAP( add_board_xpm )
EXTERN_BITMAP( add_bus2bus_xpm ) EXTERN_BITMAP( add_bus2bus_xpm )
@ -37,7 +38,6 @@ EXTERN_BITMAP( add_circle_xpm )
EXTERN_BITMAP( add_component_xpm ) EXTERN_BITMAP( add_component_xpm )
EXTERN_BITMAP( add_corner_xpm ) EXTERN_BITMAP( add_corner_xpm )
EXTERN_BITMAP( add_dashed_line_xpm ) EXTERN_BITMAP( add_dashed_line_xpm )
EXTERN_BITMAP( add_dimension_xpm )
EXTERN_BITMAP( add_document_xpm ) EXTERN_BITMAP( add_document_xpm )
EXTERN_BITMAP( add_gerber_xpm ) EXTERN_BITMAP( add_gerber_xpm )
EXTERN_BITMAP( add_glabel_xpm ) EXTERN_BITMAP( add_glabel_xpm )
@ -48,10 +48,12 @@ 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_keepout_area_xpm )
EXTERN_BITMAP( add_leader_xpm )
EXTERN_BITMAP( add_library_xpm ) EXTERN_BITMAP( add_library_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 )
EXTERN_BITMAP( add_orthogonal_dimension_xpm )
EXTERN_BITMAP( add_pcb_target_xpm ) EXTERN_BITMAP( add_pcb_target_xpm )
EXTERN_BITMAP( add_power_xpm ) EXTERN_BITMAP( add_power_xpm )
EXTERN_BITMAP( add_rectangle_xpm ) EXTERN_BITMAP( add_rectangle_xpm )

View File

@ -0,0 +1,248 @@
<?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: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.92.5 (2060ec1f9f, 2020-04-08)"
sodipodi:docname="add_aligned_dimension.svg">
<metadata
id="metadata58">
<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:license
rdf:resource="http://creativecommons.org/licenses/by-nc-sa/4.0/" />
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-nc-sa/4.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" />
<cc:prohibits
rdf:resource="http://creativecommons.org/ns#CommercialUse" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
</cc:License>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="2560"
inkscape:window-height="1370"
id="namedview56"
showgrid="true"
inkscape:zoom="22.961538"
inkscape:cx="-2.2622522"
inkscape:cy="14.540784"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg2">
<inkscape:grid
type="xygrid"
id="grid3028"
empspacing="2"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true"
spacingx="0.5"
spacingy="0.5"
originx="0"
originy="0" />
</sodipodi:namedview>
<defs
id="defs4">
<marker
inkscape:stockid="TriangleOutM"
orient="auto"
refY="0.0"
refX="0.0"
id="TriangleOutM"
style="overflow:visible">
<path
id="path3934"
d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"
transform="scale(0.4)" />
</marker>
<marker
inkscape:stockid="TriangleOutS"
orient="auto"
refY="0.0"
refX="0.0"
id="TriangleOutS"
style="overflow:visible">
<path
id="path3937"
d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"
transform="scale(0.2)" />
</marker>
<marker
inkscape:stockid="TriangleInM"
orient="auto"
refY="0.0"
refX="0.0"
id="TriangleInM"
style="overflow:visible">
<path
id="path3925"
d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"
transform="scale(-0.4)" />
</marker>
<marker
inkscape:stockid="Arrow2Mend"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow2Mend"
style="overflow:visible;">
<path
id="path3816"
style="fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
transform="scale(0.6) rotate(180) translate(0,0)" />
</marker>
<marker
inkscape:stockid="Arrow2Mstart"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow2Mstart"
style="overflow:visible">
<path
id="path3813"
style="fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round"
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
transform="scale(0.6) translate(0,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Sstart"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow1Sstart"
style="overflow:visible">
<path
id="path3801"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"
transform="scale(0.2) translate(6,0)" />
</marker>
<marker
inkscape:stockid="Arrow2Lstart"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow2Lstart"
style="overflow:visible">
<path
id="path3807"
style="fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round"
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
transform="scale(1.1) translate(1,0)" />
</marker>
<marker
id="h"
refY="0"
refX="0"
overflow="visible"
orient="auto"
style="overflow:visible">
<path
d="M 8.7186,4.0337 -2.2074,0.016 8.7186,-4.0017 c -1.7455,2.3721 -1.7354,5.6175 -6e-7,8.0354 z"
transform="scale(0.6,0.6)"
id="path10"
inkscape:connector-curvature="0"
style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" />
</marker>
<marker
id="g"
refY="0"
refX="0"
overflow="visible"
orient="auto"
style="overflow:visible">
<path
d="M 8.7186,4.0337 -2.2074,0.016 8.7186,-4.0017 c -1.7455,2.3721 -1.7354,5.6175 -6e-7,8.0354 z"
transform="scale(-0.6,-0.6)"
id="path13"
inkscape:connector-curvature="0"
style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" />
</marker>
</defs>
<path
inkscape:connector-curvature="0"
id="path3830"
d="M 11,1 3,8.5"
style="fill:none;stroke:#282828;stroke-width:1.51199996;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:2;stroke-dasharray:none;stroke-opacity:1"
sodipodi:nodetypes="cc" />
<path
style="fill:none;stroke:#282828;stroke-width:1.51181102;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:2;stroke-dasharray:none;stroke-opacity:1"
d="M 25.5,16.161166 18,23"
id="path3006"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<g
id="g50"
transform="matrix(1.6262979,0,0,1.2104957,1.0029289,4.782054)">
<rect
style="fill-opacity:0"
id="rect52"
x="0"
y="0"
width="16"
height="16" />
</g>
<path
inkscape:connector-curvature="0"
style="fill:none;stroke:#282828;stroke-width:1;stroke-miterlimit:0;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#Arrow2Mstart);marker-mid:none;marker-end:url(#Arrow2Mend)"
id="path44"
d="M 10,4.5 21.5,17"
sodipodi:nodetypes="cc" />
<rect
rx="2.5"
ry="2.5"
y="6"
x="0.5"
height="5.0000005"
width="5"
id="rect3761"
style="fill:#2ac23c;fill-opacity:1;fill-rule:evenodd;stroke:#666666;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<rect
rx="2.5"
ry="2.5"
y="20.5"
x="15.5"
height="5.0000005"
width="5"
id="rect3761-5"
style="fill:#2ac23c;fill-opacity:1;fill-rule:evenodd;stroke:#666666;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</svg>

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

@ -0,0 +1,244 @@
<?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: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.92.5 (2060ec1f9f, 2020-04-08)"
sodipodi:docname="add_leader.svg">
<metadata
id="metadata58">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<cc:license
rdf:resource="http://creativecommons.org/licenses/by-nc-sa/4.0/" />
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-nc-sa/4.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" />
<cc:prohibits
rdf:resource="http://creativecommons.org/ns#CommercialUse" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
</cc:License>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="2560"
inkscape:window-height="1370"
id="namedview56"
showgrid="true"
inkscape:zoom="22.961538"
inkscape:cx="5.5551684"
inkscape:cy="14.540784"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg2">
<inkscape:grid
type="xygrid"
id="grid3028"
empspacing="2"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true"
spacingx="0.5"
spacingy="0.5"
originx="0"
originy="0" />
</sodipodi:namedview>
<defs
id="defs4">
<marker
inkscape:stockid="TriangleOutM"
orient="auto"
refY="0.0"
refX="0.0"
id="TriangleOutM"
style="overflow:visible">
<path
id="path3934"
d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"
transform="scale(0.4)" />
</marker>
<marker
inkscape:stockid="TriangleOutS"
orient="auto"
refY="0.0"
refX="0.0"
id="TriangleOutS"
style="overflow:visible">
<path
id="path3937"
d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"
transform="scale(0.2)" />
</marker>
<marker
inkscape:stockid="TriangleInM"
orient="auto"
refY="0.0"
refX="0.0"
id="TriangleInM"
style="overflow:visible">
<path
id="path3925"
d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"
transform="scale(-0.4)" />
</marker>
<marker
inkscape:stockid="Arrow2Mend"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow2Mend"
style="overflow:visible;">
<path
id="path3816"
style="fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
transform="scale(0.6) rotate(180) translate(0,0)" />
</marker>
<marker
inkscape:stockid="Arrow2Mstart"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow2Mstart"
style="overflow:visible">
<path
id="path3813"
style="fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round"
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
transform="scale(0.6) translate(0,0)" />
</marker>
<marker
inkscape:stockid="Arrow1Sstart"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow1Sstart"
style="overflow:visible">
<path
id="path3801"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt"
transform="scale(0.2) translate(6,0)" />
</marker>
<marker
inkscape:stockid="Arrow2Lstart"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow2Lstart"
style="overflow:visible">
<path
id="path3807"
style="fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round"
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
transform="scale(1.1) translate(1,0)" />
</marker>
<marker
id="h"
refY="0"
refX="0"
overflow="visible"
orient="auto"
style="overflow:visible">
<path
d="M 8.7186,4.0337 -2.2074,0.016 8.7186,-4.0017 c -1.7455,2.3721 -1.7354,5.6175 -6e-7,8.0354 z"
transform="scale(0.6,0.6)"
id="path10"
inkscape:connector-curvature="0"
style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" />
</marker>
<marker
id="g"
refY="0"
refX="0"
overflow="visible"
orient="auto"
style="overflow:visible">
<path
d="M 8.7186,4.0337 -2.2074,0.016 8.7186,-4.0017 c -1.7455,2.3721 -1.7354,5.6175 -6e-7,8.0354 z"
transform="scale(-0.6,-0.6)"
id="path13"
inkscape:connector-curvature="0"
style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" />
</marker>
</defs>
<rect
rx="2.5"
ry="2.5"
y="0.49999976"
x="0.5"
height="5.0000005"
width="5"
id="rect3761"
style="fill:#2ac23c;fill-opacity:1;fill-rule:evenodd;stroke:#666666;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<g
id="g50"
transform="matrix(1.6262979,0,0,1.2104957,1.0029289,4.782054)">
<rect
style="fill-opacity:0"
id="rect52"
x="0"
y="0"
width="16"
height="16" />
</g>
<path
inkscape:connector-curvature="0"
style="fill:none;stroke:#282828;stroke-width:1.5;stroke-miterlimit:0;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#Arrow2Mstart);marker-mid:none"
id="path44"
d="m 4,5 6,14 h 5"
sodipodi:nodetypes="ccc" />
<circle
style="fill:none;fill-opacity:1;stroke:#282828;stroke-width:1.5;stroke-miterlimit:2;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke fill markers"
id="path1794"
cx="19.600924"
cy="18.947653"
r="5.1243324" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#282828;fill-opacity:1;stroke:none"
x="16.16918"
y="21.984087"
id="text1798"><tspan
sodipodi:role="line"
id="tspan1796"
x="16.16918"
y="21.984087"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:8px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';fill:#282828;fill-opacity:1">N</tspan></text>
</svg>

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

@ -791,7 +791,8 @@ static struct EDA_ITEM_DESC
.Map( PCB_TRACE_T, _( "Track" ) ) .Map( PCB_TRACE_T, _( "Track" ) )
.Map( PCB_VIA_T, _( "Via" ) ) .Map( PCB_VIA_T, _( "Via" ) )
.Map( PCB_MARKER_T, _( "Board Marker" ) ) .Map( PCB_MARKER_T, _( "Board Marker" ) )
.Map( PCB_DIMENSION_T, _( "Dimension" ) ) .Map( PCB_DIM_ALIGNED_T, _( "Aligned Dimension" ) )
.Map( PCB_DIM_LEADER_T, _( "Leader" ) )
.Map( PCB_TARGET_T, _( "Target" ) ) .Map( PCB_TARGET_T, _( "Target" ) )
.Map( PCB_ZONE_AREA_T, _( "Zone" ) ) .Map( PCB_ZONE_AREA_T, _( "Zone" ) )
.Map( PCB_ITEM_LIST_T, _( "Item List" ) ) .Map( PCB_ITEM_LIST_T, _( "Item List" ) )

View File

@ -152,6 +152,7 @@ kicad_pcb
last_trace_width last_trace_width
layer layer
layers layers
leader
left left
linear linear
links links
@ -252,6 +253,7 @@ target
title title
title_block title_block
tedit tedit
text_frame
text_position_mode text_position_mode
thermal_width thermal_width
thermal_gap thermal_gap

View File

@ -97,7 +97,9 @@ enum KICAD_T
PCB_VIA_T, ///< class VIA, a via (like a track segment on a copper layer) PCB_VIA_T, ///< class VIA, a via (like a track segment on a copper layer)
PCB_ARC_T, ///< class ARC, an arc track segment on a copper layer PCB_ARC_T, ///< class ARC, an arc track segment on a copper layer
PCB_MARKER_T, ///< class MARKER_PCB, a marker used to show something PCB_MARKER_T, ///< class MARKER_PCB, a marker used to show something
PCB_DIMENSION_T, ///< class DIMENSION, a dimension (graphic item) PCB_DIMENSION_T, ///< class DIMENSION: abstract dimension meta-type
PCB_DIM_ALIGNED_T, ///< class ALIGNED_DIMENSION, a linear dimension (graphic item)
PCB_DIM_LEADER_T, ///< class LEADER, a leader dimension (graphic item)
PCB_TARGET_T, ///< class PCB_TARGET, a target (graphic item) PCB_TARGET_T, ///< class PCB_TARGET, a target (graphic item)
PCB_ZONE_AREA_T, ///< class ZONE_CONTAINER, a zone area PCB_ZONE_AREA_T, ///< class ZONE_CONTAINER, a zone area
PCB_ITEM_LIST_T, ///< class BOARD_ITEM_LIST, a list of board items PCB_ITEM_LIST_T, ///< class BOARD_ITEM_LIST, a list of board items
@ -253,6 +255,10 @@ constexpr KICAD_T BaseType( const KICAD_T aType )
case PCB_LOCATE_NPTH_T: case PCB_LOCATE_NPTH_T:
return PCB_LOCATE_HOLE_T; return PCB_LOCATE_HOLE_T;
case PCB_DIM_ALIGNED_T:
case PCB_DIM_LEADER_T:
return PCB_DIMENSION_T;
default: default:
return aType; return aType;
} }

View File

@ -113,7 +113,8 @@ void ARRAY_CREATOR::Invoke()
case PCB_VIA_T: case PCB_VIA_T:
case PCB_ZONE_AREA_T: case PCB_ZONE_AREA_T:
case PCB_TARGET_T: case PCB_TARGET_T:
case PCB_DIMENSION_T: case PCB_DIM_ALIGNED_T:
case PCB_DIM_LEADER_T:
new_item = item->Duplicate(); new_item = item->Duplicate();
break; break;

View File

@ -217,7 +217,8 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
case PCB_TRACE_T: // a track segment (segment on a copper layer) case PCB_TRACE_T: // a track segment (segment on a copper layer)
case PCB_ARC_T: // an arced track segment (segment on a copper layer) case PCB_ARC_T: // an arced track segment (segment on a copper layer)
case PCB_VIA_T: // a via (like track segment on a copper layer) case PCB_VIA_T: // a via (like track segment on a copper layer)
case PCB_DIMENSION_T: // a dimension (graphic item) case PCB_DIM_ALIGNED_T: // a dimension (graphic item)
case PCB_DIM_LEADER_T: // a leader dimension
case PCB_TARGET_T: // a target (graphic item) case PCB_TARGET_T: // a target (graphic item)
case PCB_MARKER_T: // a marker used to show something case PCB_MARKER_T: // a marker used to show something
case PCB_GROUP_T: // a group of items case PCB_GROUP_T: // a group of items

View File

@ -214,7 +214,8 @@ void BOARD::Move( const wxPoint& aMoveVector ) // overload
PCB_MARKER_T, PCB_MARKER_T,
PCB_TEXT_T, PCB_TEXT_T,
PCB_LINE_T, PCB_LINE_T,
PCB_DIMENSION_T, PCB_DIM_ALIGNED_T,
PCB_DIM_LEADER_T,
PCB_TARGET_T, PCB_TARGET_T,
PCB_VIA_T, PCB_VIA_T,
PCB_TRACE_T, PCB_TRACE_T,
@ -579,7 +580,8 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode )
break; break;
case PCB_DIMENSION_T: case PCB_DIM_ALIGNED_T:
case PCB_DIM_LEADER_T:
case PCB_LINE_T: case PCB_LINE_T:
case PCB_TEXT_T: case PCB_TEXT_T:
case PCB_TARGET_T: case PCB_TARGET_T:
@ -666,7 +668,8 @@ void BOARD::Remove( BOARD_ITEM* aBoardItem )
} ) ); } ) );
break; break;
case PCB_DIMENSION_T: case PCB_DIM_ALIGNED_T:
case PCB_DIM_LEADER_T:
case PCB_LINE_T: case PCB_LINE_T:
case PCB_TEXT_T: case PCB_TEXT_T:
case PCB_TARGET_T: case PCB_TARGET_T:
@ -1003,7 +1006,8 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s
case PCB_LINE_T: case PCB_LINE_T:
case PCB_TEXT_T: case PCB_TEXT_T:
case PCB_DIMENSION_T: case PCB_DIM_ALIGNED_T:
case PCB_DIM_LEADER_T:
case PCB_TARGET_T: case PCB_TARGET_T:
result = IterateForward<BOARD_ITEM*>( m_drawings, inspector, testData, p ); result = IterateForward<BOARD_ITEM*>( m_drawings, inspector, testData, p );
@ -1014,7 +1018,8 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s
{ {
case PCB_LINE_T: case PCB_LINE_T:
case PCB_TEXT_T: case PCB_TEXT_T:
case PCB_DIMENSION_T: case PCB_DIM_ALIGNED_T:
case PCB_DIM_LEADER_T:
case PCB_TARGET_T: case PCB_TARGET_T:
continue; continue;

View File

@ -32,12 +32,15 @@
#include <class_board.h> #include <class_board.h>
#include <class_dimension.h> #include <class_dimension.h>
#include <class_pcb_text.h> #include <class_pcb_text.h>
#include <geometry/shape_circle.h>
#include <geometry/shape_rect.h>
#include <geometry/shape_segment.h>
#include <settings/color_settings.h> #include <settings/color_settings.h>
#include <settings/settings_manager.h> #include <settings/settings_manager.h>
DIMENSION::DIMENSION( BOARD_ITEM* aParent ) : DIMENSION::DIMENSION( BOARD_ITEM* aParent, KICAD_T aType ) :
BOARD_ITEM( aParent, PCB_DIMENSION_T ), BOARD_ITEM( aParent, aType ),
m_overrideTextEnabled( false ), m_overrideTextEnabled( false ),
m_units( EDA_UNITS::INCHES ), m_units( EDA_UNITS::INCHES ),
m_useMils( false ), m_useMils( false ),
@ -104,6 +107,13 @@ void DIMENSION::updateText()
} }
template<typename ShapeType>
void DIMENSION::addShape( ShapeType* aShape )
{
m_shapes.emplace_back( std::make_shared<ShapeType>( *aShape ) );
}
wxString DIMENSION::GetValueText() const wxString DIMENSION::GetValueText() const
{ {
int val = GetMeasuredValue(); int val = GetMeasuredValue();
@ -310,9 +320,9 @@ bool DIMENSION::HitTest( const wxPoint& aPosition, int aAccuracy ) const
// Locate SEGMENTS // Locate SEGMENTS
for( const SEG& seg : GetLines() ) for( const std::shared_ptr<SHAPE>& shape : GetShapes() )
{ {
if( TestSegmentHit( aPosition, wxPoint( seg.A ), wxPoint( seg.B ), dist_max ) ) if( shape->Collide( aPosition, dist_max ) )
return true; return true;
} }
@ -347,16 +357,13 @@ const EDA_RECT DIMENSION::GetBoundingBox() const
ymin = bBox.GetY(); ymin = bBox.GetY();
ymax = bBox.GetBottom(); ymax = bBox.GetBottom();
for( const SEG& seg : GetLines() ) for( const std::shared_ptr<SHAPE>& shape : GetShapes() )
{ {
xmin = std::min( xmin, seg.A.x ); BOX2I shapeBox = shape->BBox();
xmin = std::min( xmin, seg.B.x ); xmin = std::min( xmin, shapeBox.GetOrigin().x );
xmax = std::max( xmax, seg.A.x ); xmax = std::max( xmax, shapeBox.GetEnd().x );
xmax = std::max( xmax, seg.B.x ); ymin = std::min( ymin, shapeBox.GetOrigin().y );
ymin = std::min( ymin, seg.A.y ); ymax = std::max( ymax, shapeBox.GetEnd().y );
ymin = std::min( ymin, seg.B.y );
ymax = std::max( ymax, seg.A.y );
ymax = std::max( ymax, seg.B.y );
} }
bBox.SetX( xmin ); bBox.SetX( xmin );
@ -376,11 +383,6 @@ wxString DIMENSION::GetSelectMenuText( EDA_UNITS aUnits ) const
} }
BITMAP_DEF DIMENSION::GetMenuImage() const
{
return add_dimension_xpm;
}
const BOX2I DIMENSION::ViewBBox() const const BOX2I DIMENSION::ViewBBox() const
{ {
@ -392,6 +394,30 @@ const BOX2I DIMENSION::ViewBBox() const
} }
OPT_VECTOR2I DIMENSION::segPolyIntersection( SHAPE_POLY_SET& aPoly, SEG& aSeg, bool aStart )
{
VECTOR2I start( aStart ? aSeg.A : aSeg.B );
VECTOR2I endpoint( aStart ? aSeg.B : aSeg.A );
if( aPoly.Contains( start ) )
return NULLOPT;
for( SHAPE_POLY_SET::SEGMENT_ITERATOR seg = aPoly.IterateSegments(); seg; seg++ )
{
if( OPT_VECTOR2I intersection = ( *seg ).Intersect( aSeg ) )
{
if( ( *intersection - start ).SquaredEuclideanNorm() <
( endpoint - start ).SquaredEuclideanNorm() )
endpoint = *intersection;
}
}
if( start == endpoint )
return NULLOPT;
return OPT_VECTOR2I( endpoint );
}
static struct DIMENSION_DESC static struct DIMENSION_DESC
{ {
DIMENSION_DESC() DIMENSION_DESC()
@ -406,7 +432,7 @@ static struct DIMENSION_DESC
ALIGNED_DIMENSION::ALIGNED_DIMENSION( BOARD_ITEM* aParent ) : ALIGNED_DIMENSION::ALIGNED_DIMENSION( BOARD_ITEM* aParent ) :
DIMENSION( aParent ), DIMENSION( aParent, PCB_DIM_ALIGNED_T ),
m_height( 0 ) m_height( 0 )
{ {
// To preserve look of old dimensions, initialize extension height based on default arrow length // To preserve look of old dimensions, initialize extension height based on default arrow length
@ -422,10 +448,20 @@ EDA_ITEM* ALIGNED_DIMENSION::Clone() const
void ALIGNED_DIMENSION::SwapData( BOARD_ITEM* aImage ) void ALIGNED_DIMENSION::SwapData( BOARD_ITEM* aImage )
{ {
assert( aImage->Type() == PCB_DIMENSION_T ); assert( aImage->Type() == PCB_DIM_ALIGNED_T );
m_shapes.clear();
static_cast<ALIGNED_DIMENSION*>( aImage )->m_shapes.clear();
std::swap( *static_cast<ALIGNED_DIMENSION*>( this ), std::swap( *static_cast<ALIGNED_DIMENSION*>( this ),
*static_cast<ALIGNED_DIMENSION*>( aImage ) ); *static_cast<ALIGNED_DIMENSION*>( aImage ) );
Update();
}
BITMAP_DEF ALIGNED_DIMENSION::GetMenuImage() const
{
return add_aligned_dimension_xpm;
} }
@ -452,7 +488,7 @@ void ALIGNED_DIMENSION::UpdateHeight( const wxPoint& aCrossbarStart, const wxPoi
void ALIGNED_DIMENSION::updateGeometry() void ALIGNED_DIMENSION::updateGeometry()
{ {
m_lines.clear(); m_shapes.clear();
VECTOR2I dimension( m_end - m_start ); VECTOR2I dimension( m_end - m_start );
@ -468,17 +504,15 @@ void ALIGNED_DIMENSION::updateGeometry()
// Add extension lines // Add extension lines
int extensionHeight = std::abs( m_height ) - m_extensionOffset + m_extensionHeight; int extensionHeight = std::abs( m_height ) - m_extensionOffset + m_extensionHeight;
VECTOR2I extensionStart( m_start ); VECTOR2I extStart( m_start );
extensionStart += extension.Resize( m_extensionOffset ); extStart += extension.Resize( m_extensionOffset );
m_lines.emplace_back( SEG( extensionStart, addShape( new SHAPE_SEGMENT( extStart, extStart + extension.Resize( extensionHeight ) ) );
extensionStart + extension.Resize( extensionHeight ) ) );
extensionStart = VECTOR2I( m_end ); extStart = VECTOR2I( m_end );
extensionStart += extension.Resize( m_extensionOffset ); extStart += extension.Resize( m_extensionOffset );
m_lines.emplace_back( SEG( extensionStart, addShape( new SHAPE_SEGMENT( extStart, extStart + extension.Resize( extensionHeight ) ) );
extensionStart + extension.Resize( extensionHeight ) ) );
// Add crossbar // Add crossbar
VECTOR2I crossBarDistance = sign( m_height ) * extension.Resize( m_height ); VECTOR2I crossBarDistance = sign( m_height ) * extension.Resize( m_height );
@ -504,55 +538,21 @@ void ALIGNED_DIMENSION::updateGeometry()
// The ideal crossbar, if the text doesn't collide // The ideal crossbar, if the text doesn't collide
SEG crossbar( m_crossBarStart, m_crossBarEnd ); SEG crossbar( m_crossBarStart, m_crossBarEnd );
auto findEndpoint =
[&]( const VECTOR2I& aStart, const VECTOR2I& aEnd ) -> VECTOR2I
{
VECTOR2I endpoint( aEnd );
for( SHAPE_POLY_SET::SEGMENT_ITERATOR seg = polyBox.IterateSegments(); seg; seg++ )
{
if( OPT_VECTOR2I intersection = ( *seg ).Intersect( crossbar ) )
{
if( ( *intersection - aStart ).SquaredEuclideanNorm() <
( endpoint - aStart ).SquaredEuclideanNorm() )
endpoint = *intersection;
}
}
return endpoint;
};
// Now we can draw 0, 1, or 2 crossbar lines depending on how the polygon collides // Now we can draw 0, 1, or 2 crossbar lines depending on how the polygon collides
bool containsA = polyBox.Contains( crossbar.A ); bool containsA = polyBox.Contains( crossbar.A );
bool containsB = polyBox.Contains( crossbar.B ); bool containsB = polyBox.Contains( crossbar.B );
if( containsA && !containsB ) OPT_VECTOR2I endpointA = segPolyIntersection( polyBox, crossbar );
{ OPT_VECTOR2I endpointB = segPolyIntersection( polyBox, crossbar, false );
m_lines.emplace_back( SEG( findEndpoint( crossbar.B, crossbar.A ), crossbar.B ) );
}
else if( containsB && !containsA )
{
m_lines.emplace_back( SEG( crossbar.A, findEndpoint( crossbar.A, crossbar.B ) ) );
}
else if( polyBox.Collide( crossbar ) )
{
// text box collides and we need two segs
VECTOR2I endpoint1 = findEndpoint( crossbar.B, crossbar.A );
VECTOR2I endpoint2 = findEndpoint( crossbar.A, crossbar.B );
if( ( crossbar.B - endpoint1 ).SquaredEuclideanNorm() > if( endpointA )
( crossbar.B - endpoint2 ).SquaredEuclideanNorm() ) m_shapes.emplace_back( new SHAPE_SEGMENT( crossbar.A, *endpointA ) );
std::swap( endpoint1, endpoint2 );
m_lines.emplace_back( SEG( endpoint1, crossbar.B ) ); if( endpointB )
m_lines.emplace_back( SEG( crossbar.A, endpoint2 ) ); m_shapes.emplace_back( new SHAPE_SEGMENT( *endpointB, crossbar.B ) );
}
else if( !containsA && !containsB ) if( !containsA && !containsB && !endpointA && !endpointB )
{ m_shapes.emplace_back( new SHAPE_SEGMENT( crossbar ) );
// No collision
m_lines.emplace_back( crossbar );
}
// Add arrows // Add arrows
VECTOR2I arrowEnd( m_arrowLength, 0 ); VECTOR2I arrowEnd( m_arrowLength, 0 );
@ -560,16 +560,16 @@ void ALIGNED_DIMENSION::updateGeometry()
double arrowRotPos = dimension.Angle() + DEG2RAD( s_arrowAngle ); double arrowRotPos = dimension.Angle() + DEG2RAD( s_arrowAngle );
double arrowRotNeg = dimension.Angle() - DEG2RAD( s_arrowAngle ); double arrowRotNeg = dimension.Angle() - DEG2RAD( s_arrowAngle );
m_lines.emplace_back( SEG( m_crossBarStart, m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarStart,
m_crossBarStart + wxPoint( arrowEnd.Rotate( arrowRotPos ) ) ) ); m_crossBarStart + wxPoint( arrowEnd.Rotate( arrowRotPos ) ) ) );
m_lines.emplace_back( SEG( m_crossBarStart, m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarStart,
m_crossBarStart + wxPoint( arrowEnd.Rotate( arrowRotNeg ) ) ) ); m_crossBarStart + wxPoint( arrowEnd.Rotate( arrowRotNeg ) ) ) );
m_lines.emplace_back( SEG( m_crossBarEnd, m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarEnd,
m_crossBarEnd - wxPoint( arrowEnd.Rotate( arrowRotPos ) ) ) ); m_crossBarEnd - wxPoint( arrowEnd.Rotate( arrowRotPos ) ) ) );
m_lines.emplace_back( SEG( m_crossBarEnd, m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarEnd,
m_crossBarEnd - wxPoint( arrowEnd.Rotate( arrowRotNeg ) ) ) ); m_crossBarEnd - wxPoint( arrowEnd.Rotate( arrowRotNeg ) ) ) );
} }
@ -607,3 +607,112 @@ void ALIGNED_DIMENSION::updateText()
DIMENSION::updateText(); DIMENSION::updateText();
} }
LEADER::LEADER( BOARD_ITEM* aParent ) :
DIMENSION( aParent, PCB_DIM_LEADER_T ),
m_textFrame( DIM_TEXT_FRAME::NONE )
{
m_unitsFormat = DIM_UNITS_FORMAT::NO_SUFFIX;
m_overrideTextEnabled = true;
m_keepTextAligned = false;
}
EDA_ITEM* LEADER::Clone() const
{
return new LEADER( *this );
}
void LEADER::SwapData( BOARD_ITEM* aImage )
{
assert( aImage->Type() == PCB_DIM_LEADER_T );
std::swap( *static_cast<LEADER*>( this ), *static_cast<LEADER*>( aImage ) );
}
BITMAP_DEF LEADER::GetMenuImage() const
{
return add_leader_xpm;
}
void LEADER::updateGeometry()
{
m_shapes.clear();
VECTOR2I firstLine( m_end - m_start );
VECTOR2I start( m_start );
start += firstLine.Resize( m_extensionOffset );
m_shapes.emplace_back( new SHAPE_SEGMENT( start, m_end ) );
// Add arrows
VECTOR2I arrowEnd( m_arrowLength, 0 );
double arrowRotPos = firstLine.Angle() + DEG2RAD( s_arrowAngle );
double arrowRotNeg = firstLine.Angle() - DEG2RAD( s_arrowAngle );
m_shapes.emplace_back( new SHAPE_SEGMENT( start,
start + wxPoint( arrowEnd.Rotate( arrowRotPos ) ) ) );
m_shapes.emplace_back( new SHAPE_SEGMENT( start,
start + wxPoint( arrowEnd.Rotate( arrowRotNeg ) ) ) );
updateText();
// Now that we have the text updated, we can determine how to draw the second line
// First we need to create an appropriate bounding polygon to collide with
EDA_RECT textBox = m_text.GetTextBox().Inflate( m_text.GetTextWidth() / 2,
m_text.GetEffectiveTextPenWidth() );
SHAPE_POLY_SET polyBox;
polyBox.NewOutline();
polyBox.Append( textBox.GetOrigin() );
polyBox.Append( textBox.GetOrigin().x, textBox.GetEnd().y );
polyBox.Append( textBox.GetEnd() );
polyBox.Append( textBox.GetEnd().x, textBox.GetOrigin().y );
polyBox.Rotate( -m_text.GetTextAngleRadians(), textBox.GetCenter() );
SEG textSeg( m_end, m_text.GetPosition() );
OPT_VECTOR2I endpoint = segPolyIntersection( polyBox, textSeg );
if( !GetText().IsEmpty() )
{
switch( m_textFrame )
{
case DIM_TEXT_FRAME::RECT:
{
for( SHAPE_POLY_SET::SEGMENT_ITERATOR seg = polyBox.IterateSegments(); seg; seg++ )
m_shapes.emplace_back( new SHAPE_SEGMENT( *seg ) );
break;
}
case DIM_TEXT_FRAME::CIRCLE:
{
double penWidth = m_text.GetEffectiveTextPenWidth() / 2.0;
double radius = ( textBox.GetWidth() / 2.0 ) - penWidth;
m_shapes.emplace_back( new SHAPE_CIRCLE( textBox.GetCenter(), radius ) );
// Calculated bbox endpoint won't be right
if( endpoint )
{
VECTOR2I totalLength( textBox.GetCenter() - m_end );
VECTOR2I circleEndpoint( *endpoint - m_end );
circleEndpoint = circleEndpoint.Resize( totalLength.EuclideanNorm() - radius );
endpoint = OPT_VECTOR2I( VECTOR2I( m_end ) + circleEndpoint );
}
break;
}
default:
break;
}
}
if( endpoint )
m_shapes.emplace_back( new SHAPE_SEGMENT( m_end, *endpoint ) );
}

View File

@ -33,7 +33,7 @@
#include <class_board_item.h> #include <class_board_item.h>
#include <class_pcb_text.h> #include <class_pcb_text.h>
#include <geometry/seg.h> #include <geometry/shape.h>
class LINE_READER; class LINE_READER;
@ -68,6 +68,17 @@ enum class DIM_UNITS_MODE
AUTOMATIC AUTOMATIC
}; };
/**
* Frame to show around dimension text
*/
enum class DIM_TEXT_FRAME
{
NONE,
RECT,
CIRCLE,
ROUNDRECT
};
/** /**
* Abstract dimension API * Abstract dimension API
* *
@ -90,7 +101,21 @@ enum class DIM_UNITS_MODE
class DIMENSION : public BOARD_ITEM class DIMENSION : public BOARD_ITEM
{ {
public: public:
DIMENSION( BOARD_ITEM* aParent ); DIMENSION( BOARD_ITEM* aParent, KICAD_T aType = PCB_DIMENSION_T );
bool IsType( const KICAD_T aScanTypes[] ) const override
{
if( BOARD_ITEM::IsType( aScanTypes ) )
return true;
for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
{
if( *p == PCB_LOCATE_GRAPHIC_T )
return true;
}
return false;
}
void SetParent( EDA_ITEM* aParent ) override; void SetParent( EDA_ITEM* aParent ) override;
@ -199,7 +224,7 @@ public:
/** /**
* @return a list of line segments that make up this dimension (for drawing, plotting, etc) * @return a list of line segments that make up this dimension (for drawing, plotting, etc)
*/ */
const std::vector<SEG>& GetLines() const { return m_lines; } const std::vector<std::shared_ptr<SHAPE>>& GetShapes() const { return m_shapes; }
// BOARD_ITEM overrides // BOARD_ITEM overrides
@ -224,8 +249,6 @@ public:
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
BITMAP_DEF GetMenuImage() const override;
virtual const BOX2I ViewBBox() const override; virtual const BOX2I ViewBBox() const override;
#if defined(DEBUG) #if defined(DEBUG)
@ -244,6 +267,18 @@ protected:
*/ */
virtual void updateText(); virtual void updateText();
template<typename ShapeType>
void addShape( ShapeType* aShape );
/**
* Finds the intersection between a given segment and polygon outline
* @param aPoly is the polygon to collide
* @param aSeg is the segment to collide
* @param aStart if true will start from aSeg.A, otherwise aSeg.B
* @return a point on aSeg that collides with aPoly closest to the start, if one exists
*/
static OPT_VECTOR2I segPolyIntersection( SHAPE_POLY_SET& aPoly, SEG& aSeg, bool aStart = true );
// Value format // Value format
bool m_overrideTextEnabled; ///< Manually specify the displayed measurement value bool m_overrideTextEnabled; ///< Manually specify the displayed measurement value
wxString m_valueString; ///< Displayed value when m_overrideValue = true wxString m_valueString; ///< Displayed value when m_overrideValue = true
@ -269,7 +304,10 @@ protected:
wxPoint m_start; wxPoint m_start;
wxPoint m_end; wxPoint m_end;
std::vector<SEG> m_lines; ///< Internal cache of drawn lines ///< Internal cache of drawn shapes
std::vector<std::shared_ptr<SHAPE>> m_shapes;
static constexpr float s_arrowAngle = 27.5;
}; };
/** /**
@ -308,8 +346,6 @@ class ALIGNED_DIMENSION : public DIMENSION
wxPoint m_crossBarStart; ///< Crossbar start control point wxPoint m_crossBarStart; ///< Crossbar start control point
wxPoint m_crossBarEnd; ///< Crossbar end control point wxPoint m_crossBarEnd; ///< Crossbar end control point
static constexpr float s_arrowAngle = 27.5;
public: public:
ALIGNED_DIMENSION( BOARD_ITEM* aParent ); ALIGNED_DIMENSION( BOARD_ITEM* aParent );
@ -320,27 +356,15 @@ public:
static inline bool ClassOf( const EDA_ITEM* aItem ) static inline bool ClassOf( const EDA_ITEM* aItem )
{ {
return aItem && PCB_DIMENSION_T == aItem->Type(); return aItem && PCB_DIM_ALIGNED_T == aItem->Type();
}
bool IsType( const KICAD_T aScanTypes[] ) const override
{
if( BOARD_ITEM::IsType( aScanTypes ) )
return true;
for( const KICAD_T* p = aScanTypes; *p != EOT; ++p )
{
if( *p == PCB_LOCATE_GRAPHIC_T )
return true;
}
return false;
} }
EDA_ITEM* Clone() const override; EDA_ITEM* Clone() const override;
virtual void SwapData( BOARD_ITEM* aImage ) override; virtual void SwapData( BOARD_ITEM* aImage ) override;
BITMAP_DEF GetMenuImage() const override;
const wxPoint& GetCrossbarStart() const { return m_crossBarStart; } const wxPoint& GetCrossbarStart() const { return m_crossBarStart; }
const wxPoint& GetCrossbarEnd() const { return m_crossBarEnd; } const wxPoint& GetCrossbarEnd() const { return m_crossBarEnd; }
@ -385,4 +409,50 @@ protected:
void updateText() override; void updateText() override;
}; };
/**
* A leader is a dimension-like object pointing to a specific point.
*
* A guide to the geometry of a leader:
*
* a
* _
* |\
* \
* b---c TEXT
*
* Point (a) is m_start, point (b) is m_end, point (c) is the end of the "text line"
* The b-c line is drawn from b to the text center, and clipped on the text bounding box.
*/
class LEADER : public DIMENSION
{
DIM_TEXT_FRAME m_textFrame;
public:
LEADER( BOARD_ITEM* aParent );
static inline bool ClassOf( const EDA_ITEM* aItem )
{
return aItem && PCB_DIM_LEADER_T == aItem->Type();
}
EDA_ITEM* Clone() const override;
virtual void SwapData( BOARD_ITEM* aImage ) override;
BITMAP_DEF GetMenuImage() const override;
wxString GetClass() const override
{
return wxT( "LEADER" );
}
void SetTextFrame( DIM_TEXT_FRAME aFrame ) { m_textFrame = aFrame; }
DIM_TEXT_FRAME GetTextFrame() const { return m_textFrame; }
protected:
void updateGeometry() override;
};
#endif // DIMENSION_H_ #endif // DIMENSION_H_

View File

@ -109,7 +109,7 @@ void TEXTE_PCB::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_I
wxCHECK_RET( m_Parent != NULL, wxT( "TEXTE_PCB::GetMsgPanelInfo() m_Parent is NULL." ) ); wxCHECK_RET( m_Parent != NULL, wxT( "TEXTE_PCB::GetMsgPanelInfo() m_Parent is NULL." ) );
if( m_Parent->Type() == PCB_DIMENSION_T ) if( BaseType( m_Parent->Type() ) == PCB_DIMENSION_T )
aList.emplace_back( _( "Dimension" ), GetShownText(), DARKGREEN ); aList.emplace_back( _( "Dimension" ), GetShownText(), DARKGREEN );
else else
aList.emplace_back( _( "PCB Text" ), GetShownText(), DARKGREEN ); aList.emplace_back( _( "PCB Text" ), GetShownText(), DARKGREEN );

View File

@ -49,7 +49,8 @@ const KICAD_T GENERAL_COLLECTOR::AllBoardItems[] = {
PCB_MARKER_T, // in m_markers PCB_MARKER_T, // in m_markers
PCB_TEXT_T, // in m_drawings PCB_TEXT_T, // in m_drawings
PCB_LINE_T, // in m_drawings PCB_LINE_T, // in m_drawings
PCB_DIMENSION_T, // in m_drawings PCB_DIM_ALIGNED_T, // in m_drawings
PCB_DIM_LEADER_T, // in m_drawings
PCB_TARGET_T, // in m_drawings PCB_TARGET_T, // in m_drawings
PCB_VIA_T, // in m_tracks PCB_VIA_T, // in m_tracks
PCB_TRACE_T, // in m_tracks PCB_TRACE_T, // in m_tracks
@ -67,7 +68,8 @@ const KICAD_T GENERAL_COLLECTOR::BoardLevelItems[] = {
PCB_MARKER_T, PCB_MARKER_T,
PCB_TEXT_T, PCB_TEXT_T,
PCB_LINE_T, PCB_LINE_T,
PCB_DIMENSION_T, PCB_DIM_ALIGNED_T,
PCB_DIM_LEADER_T,
PCB_TARGET_T, PCB_TARGET_T,
PCB_VIA_T, PCB_VIA_T,
PCB_ARC_T, PCB_ARC_T,
@ -83,7 +85,8 @@ const KICAD_T GENERAL_COLLECTOR::AllButZones[] = {
PCB_MARKER_T, PCB_MARKER_T,
PCB_TEXT_T, PCB_TEXT_T,
PCB_LINE_T, PCB_LINE_T,
PCB_DIMENSION_T, PCB_DIM_ALIGNED_T,
PCB_DIM_LEADER_T,
PCB_TARGET_T, PCB_TARGET_T,
PCB_VIA_T, PCB_VIA_T,
PCB_TRACE_T, PCB_TRACE_T,
@ -164,7 +167,8 @@ const KICAD_T GENERAL_COLLECTOR::Zones[] = {
const KICAD_T GENERAL_COLLECTOR::Dimensions[] = { const KICAD_T GENERAL_COLLECTOR::Dimensions[] = {
PCB_DIMENSION_T, PCB_DIM_ALIGNED_T,
PCB_DIM_LEADER_T,
EOT EOT
}; };
@ -216,7 +220,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
breakhere++; breakhere++;
break; break;
case PCB_DIMENSION_T: case PCB_DIM_ALIGNED_T:
breakhere++; breakhere++;
break; break;
@ -306,7 +310,8 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
drawSegment = static_cast<DRAWSEGMENT*>( item ); drawSegment = static_cast<DRAWSEGMENT*>( item );
break; break;
case PCB_DIMENSION_T: case PCB_DIM_ALIGNED_T:
case PCB_DIM_LEADER_T:
break; break;
case PCB_TARGET_T: case PCB_TARGET_T:

View File

@ -32,6 +32,8 @@ DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES( PCB_BASE_EDIT_FRAME* a
BOARD_ITEM* aItem ) : BOARD_ITEM* aItem ) :
DIALOG_DIMENSION_PROPERTIES_BASE( aParent ), DIALOG_DIMENSION_PROPERTIES_BASE( aParent ),
m_frame( aParent ), m_frame( aParent ),
m_cbLayerActual( m_cbLayer ),
m_txtValueActual( m_txtValue ),
m_textWidth( aParent, m_lblTextWidth, m_txtTextWidth, m_lblTextWidthUnits, true ), m_textWidth( aParent, m_lblTextWidth, m_txtTextWidth, m_lblTextWidthUnits, true ),
m_textHeight( aParent, m_lblTextHeight, m_txtTextHeight, m_lblTextHeightUnits, true ), m_textHeight( aParent, m_lblTextHeight, m_txtTextHeight, m_lblTextHeightUnits, true ),
m_textThickness( aParent, m_lblTextThickness, m_txtTextThickness, m_textThickness( aParent, m_lblTextThickness, m_txtTextThickness,
@ -45,11 +47,33 @@ DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES( PCB_BASE_EDIT_FRAME* a
m_extensionOffset( aParent, m_lblExtensionOffset, m_txtExtensionOffset, m_extensionOffset( aParent, m_lblExtensionOffset, m_txtExtensionOffset,
m_lblExtensionOffsetUnits ) m_lblExtensionOffsetUnits )
{ {
wxASSERT( aItem->Type() == PCB_DIMENSION_T ); wxASSERT( BaseType( aItem->Type() ) == PCB_DIMENSION_T );
m_dimension = static_cast<DIMENSION*>( aItem ); m_dimension = static_cast<DIMENSION*>( aItem );
m_previewDimension = static_cast<DIMENSION*>( m_dimension->Clone() ); m_previewDimension = static_cast<DIMENSION*>( m_dimension->Clone() );
m_previewDimension->SetParent( m_frame->GetBoard() ); m_previewDimension->SetParent( m_frame->GetBoard() );
switch( m_dimension->Type() )
{
case PCB_DIM_LEADER_T:
// Hide the main format controls and keep the leader controls shown
m_sizerFormat->GetStaticBox()->Hide();
m_cbLayerActual = m_cbLeaderLayer;
m_txtValueActual = m_txtLeaderValue;
// Remove a fewings from text format
m_lblTextPositionMode->Hide();
m_cbTextPositionMode->Hide();
break;
default:
m_sizerLeader->GetStaticBox()->Hide();
break;
}
// Fix the size after hiding/showing some of the properties
Layout();
// Configure display origin transforms // Configure display origin transforms
m_textPosX.SetCoordType( ORIGIN_TRANSFORMS::ABS_X_COORD ); m_textPosX.SetCoordType( ORIGIN_TRANSFORMS::ABS_X_COORD );
m_textPosY.SetCoordType( ORIGIN_TRANSFORMS::ABS_Y_COORD ); m_textPosY.SetCoordType( ORIGIN_TRANSFORMS::ABS_Y_COORD );
@ -57,12 +81,12 @@ DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES( PCB_BASE_EDIT_FRAME* a
// Configure the layers list selector. Note that footprints are built outside the current // Configure the layers list selector. Note that footprints are built outside the current
// board and so we may need to show all layers if the text is on an unactivated layer. // board and so we may need to show all layers if the text is on an unactivated layer.
if( !m_frame->GetBoard()->IsLayerEnabled( m_dimension->GetLayer() ) ) if( !m_frame->GetBoard()->IsLayerEnabled( m_dimension->GetLayer() ) )
m_cbLayer->ShowNonActivatedLayers( true ); m_cbLayerActual->ShowNonActivatedLayers( true );
m_cbLayer->SetLayersHotkeys( false ); m_cbLayerActual->SetLayersHotkeys( false );
m_cbLayer->SetNotAllowedLayerSet( LSET::ForbiddenTextLayers() ); m_cbLayerActual->SetNotAllowedLayerSet( LSET::ForbiddenTextLayers() );
m_cbLayer->SetBoardFrame( aParent ); m_cbLayerActual->SetBoardFrame( aParent );
m_cbLayer->Resync(); m_cbLayerActual->Resync();
m_orientValue = 0.0; m_orientValue = 0.0;
m_orientValidator.SetRange( -360.0, 360.0 ); m_orientValidator.SetRange( -360.0, 360.0 );
@ -97,6 +121,7 @@ DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES( PCB_BASE_EDIT_FRAME* a
updatePreviewText(); updatePreviewText();
}; };
// No need to use m_txtValueActual here since we don't have previewing for leaders
m_txtValue->Bind( wxEVT_TEXT, updateEventHandler ); m_txtValue->Bind( wxEVT_TEXT, updateEventHandler );
m_txtPrefix->Bind( wxEVT_TEXT, updateEventHandler ); m_txtPrefix->Bind( wxEVT_TEXT, updateEventHandler );
m_txtSuffix->Bind( wxEVT_TEXT, updateEventHandler ); m_txtSuffix->Bind( wxEVT_TEXT, updateEventHandler );
@ -148,11 +173,11 @@ bool DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow()
m_txtPrefix->SetValue( m_dimension->GetPrefix() ); m_txtPrefix->SetValue( m_dimension->GetPrefix() );
m_txtSuffix->SetValue( m_dimension->GetSuffix() ); m_txtSuffix->SetValue( m_dimension->GetSuffix() );
if( m_cbLayer->SetLayerSelection( m_dimension->GetLayer() ) < 0 ) if( m_cbLayerActual->SetLayerSelection( m_dimension->GetLayer() ) < 0 )
{ {
wxMessageBox( _( "This item was on a non-existing or forbidden layer.\n" wxMessageBox( _( "This item was on a non-existing or forbidden layer.\n"
"It has been moved to the first allowed layer." ) ); "It has been moved to the first allowed layer." ) );
m_cbLayer->SetSelection( 0 ); m_cbLayerActual->SetSelection( 0 );
} }
m_cbSuppressZeroes->SetValue( m_dimension->GetSuppressZeroes() ); m_cbSuppressZeroes->SetValue( m_dimension->GetSuppressZeroes() );
@ -188,12 +213,18 @@ bool DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow()
// Do this last; it depends on the other settings // Do this last; it depends on the other settings
if( m_dimension->GetOverrideTextEnabled() ) if( m_dimension->GetOverrideTextEnabled() )
m_txtValue->SetValue( m_dimension->GetOverrideText() ); m_txtValueActual->SetValue( m_dimension->GetOverrideText() );
else else
m_txtValue->SetValue( m_dimension->GetValueText() ); m_txtValueActual->SetValue( m_dimension->GetValueText() );
m_orientValidator.TransferToWindow(); m_orientValidator.TransferToWindow();
if( m_dimension->Type() == PCB_DIM_LEADER_T )
{
LEADER* leader = static_cast<LEADER*>( m_dimension );
m_cbTextFrame->SetSelection( static_cast<int>( leader->GetTextFrame() ) );
}
return DIALOG_DIMENSION_PROPERTIES_BASE::TransferDataToWindow(); return DIALOG_DIMENSION_PROPERTIES_BASE::TransferDataToWindow();
} }
@ -233,11 +264,11 @@ void DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog( DIMENSION* aTarget
aTarget->SetOverrideTextEnabled( m_cbOverrideValue->GetValue() ); aTarget->SetOverrideTextEnabled( m_cbOverrideValue->GetValue() );
if( m_cbOverrideValue->GetValue() ) if( m_cbOverrideValue->GetValue() )
aTarget->SetOverrideText( m_txtValue->GetValue() ); aTarget->SetOverrideText( m_txtValueActual->GetValue() );
aTarget->SetPrefix( m_txtPrefix->GetValue() ); aTarget->SetPrefix( m_txtPrefix->GetValue() );
aTarget->SetSuffix( m_txtSuffix->GetValue() ); aTarget->SetSuffix( m_txtSuffix->GetValue() );
aTarget->SetLayer( static_cast<PCB_LAYER_ID>( m_cbLayer->GetLayerSelection() ) ); aTarget->SetLayer( static_cast<PCB_LAYER_ID>( m_cbLayerActual->GetLayerSelection() ) );
aTarget->SetUnits( m_frame->GetUserUnits(), false ); aTarget->SetUnits( m_frame->GetUserUnits(), false );
aTarget->SetUnitsMode( static_cast<DIM_UNITS_MODE>( m_cbUnits->GetSelection() ) ); aTarget->SetUnitsMode( static_cast<DIM_UNITS_MODE>( m_cbUnits->GetSelection() ) );
@ -271,6 +302,12 @@ void DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog( DIMENSION* aTarget
aTarget->SetArrowLength( m_arrowLength.GetValue() ); aTarget->SetArrowLength( m_arrowLength.GetValue() );
aTarget->SetExtensionOffset( m_extensionOffset.GetValue() ); aTarget->SetExtensionOffset( m_extensionOffset.GetValue() );
if( aTarget->Type() == PCB_DIM_LEADER_T )
{
LEADER* leader = static_cast<LEADER*>( aTarget );
leader->SetTextFrame( static_cast<DIM_TEXT_FRAME>( m_cbTextFrame->GetSelection() ) );
}
aTarget->Update(); aTarget->Update();
} }

View File

@ -51,6 +51,9 @@ private:
DIMENSION* m_dimension; DIMENSION* m_dimension;
DIMENSION* m_previewDimension; DIMENSION* m_previewDimension;
PCB_LAYER_BOX_SELECTOR* m_cbLayerActual; // The active layer box control
wxTextCtrl* m_txtValueActual; // The active value control
UNIT_BINDER m_textWidth; UNIT_BINDER m_textWidth;
UNIT_BINDER m_textHeight; UNIT_BINDER m_textHeight;
UNIT_BINDER m_textThickness; UNIT_BINDER m_textThickness;

View File

@ -15,30 +15,72 @@ DIALOG_DIMENSION_PROPERTIES_BASE::DIALOG_DIMENSION_PROPERTIES_BASE( wxWindow* pa
{ {
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize ); this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
wxBoxSizer* bMainSizer; m_mainSizer = new wxBoxSizer( wxVERTICAL );
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizerFormat; m_sizerLeader = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Leader Format") ), wxVERTICAL );
sbSizerFormat = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Dimension Format") ), wxVERTICAL );
wxGridBagSizer* gbSizerLeader;
gbSizerLeader = new wxGridBagSizer( 0, 0 );
gbSizerLeader->SetFlexibleDirection( wxBOTH );
gbSizerLeader->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_lblLeaderValue = new wxStaticText( m_sizerLeader->GetStaticBox(), wxID_ANY, _("Value:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblLeaderValue->Wrap( -1 );
gbSizerLeader->Add( m_lblLeaderValue, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_txtLeaderValue = new wxTextCtrl( m_sizerLeader->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizerLeader->Add( m_txtLeaderValue, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
gbSizerLeader->Add( 60, 0, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
m_lblTextFrame = new wxStaticText( m_sizerLeader->GetStaticBox(), wxID_ANY, _("Text frame:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblTextFrame->Wrap( -1 );
m_lblTextFrame->SetToolTip( _("Draw a shape around the leader text") );
gbSizerLeader->Add( m_lblTextFrame, wxGBPosition( 0, 3 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
wxString m_cbTextFrameChoices[] = { _("None"), _("Rectangle"), _("Circle") };
int m_cbTextFrameNChoices = sizeof( m_cbTextFrameChoices ) / sizeof( wxString );
m_cbTextFrame = new wxChoice( m_sizerLeader->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cbTextFrameNChoices, m_cbTextFrameChoices, 0 );
m_cbTextFrame->SetSelection( 0 );
m_cbTextFrame->SetToolTip( _("Draw a shape around the leader text") );
gbSizerLeader->Add( m_cbTextFrame, wxGBPosition( 0, 4 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
m_lblLeaderLayer = new wxStaticText( m_sizerLeader->GetStaticBox(), wxID_ANY, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblLeaderLayer->Wrap( -1 );
gbSizerLeader->Add( m_lblLeaderLayer, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_cbLeaderLayer = new PCB_LAYER_BOX_SELECTOR( m_sizerLeader->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
gbSizerLeader->Add( m_cbLeaderLayer, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
m_sizerLeader->Add( gbSizerLeader, 1, wxBOTTOM|wxEXPAND, 5 );
m_mainSizer->Add( m_sizerLeader, 0, wxALL|wxEXPAND, 5 );
m_sizerFormat = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Dimension Format") ), wxVERTICAL );
wxGridBagSizer* gbSizerFormat; wxGridBagSizer* gbSizerFormat;
gbSizerFormat = new wxGridBagSizer( 0, 5 ); gbSizerFormat = new wxGridBagSizer( 0, 5 );
gbSizerFormat->SetFlexibleDirection( wxHORIZONTAL ); gbSizerFormat->SetFlexibleDirection( wxBOTH );
gbSizerFormat->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); gbSizerFormat->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_lblValue = new wxStaticText( sbSizerFormat->GetStaticBox(), wxID_ANY, _("Value:"), wxDefaultPosition, wxDefaultSize, 0 ); m_lblValue = new wxStaticText( m_sizerFormat->GetStaticBox(), wxID_ANY, _("Value:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblValue->Wrap( -1 ); m_lblValue->Wrap( -1 );
m_lblValue->SetToolTip( _("Measured value of this dimension") ); m_lblValue->SetToolTip( _("Measured value of this dimension") );
gbSizerFormat->Add( m_lblValue, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 ); gbSizerFormat->Add( m_lblValue, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_txtValue = new wxTextCtrl( sbSizerFormat->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_txtValue = new wxTextCtrl( m_sizerFormat->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_txtValue->Enable( false ); m_txtValue->Enable( false );
m_txtValue->SetToolTip( _("Measured value of this dimension") ); m_txtValue->SetToolTip( _("Measured value of this dimension") );
gbSizerFormat->Add( m_txtValue, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 ); gbSizerFormat->Add( m_txtValue, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
m_cbOverrideValue = new wxCheckBox( sbSizerFormat->GetStaticBox(), wxID_ANY, _("Override value"), wxDefaultPosition, wxDefaultSize, 0 ); m_cbOverrideValue = new wxCheckBox( m_sizerFormat->GetStaticBox(), wxID_ANY, _("Override value"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbOverrideValue->SetToolTip( _("When checked, the actual measurement is ignored and any value can be entered") ); m_cbOverrideValue->SetToolTip( _("When checked, the actual measurement is ignored and any value can be entered") );
gbSizerFormat->Add( m_cbOverrideValue, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 ); gbSizerFormat->Add( m_cbOverrideValue, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
@ -46,7 +88,7 @@ DIALOG_DIMENSION_PROPERTIES_BASE::DIALOG_DIMENSION_PROPERTIES_BASE( wxWindow* pa
gbSizerFormat->Add( 20, 0, wxGBPosition( 0, 3 ), wxGBSpan( 1, 1 ), 0, 5 ); gbSizerFormat->Add( 20, 0, wxGBPosition( 0, 3 ), wxGBSpan( 1, 1 ), 0, 5 );
m_lblUnits = new wxStaticText( sbSizerFormat->GetStaticBox(), wxID_ANY, _("Units:"), wxDefaultPosition, wxDefaultSize, 0 ); m_lblUnits = new wxStaticText( m_sizerFormat->GetStaticBox(), wxID_ANY, _("Units:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblUnits->Wrap( -1 ); m_lblUnits->Wrap( -1 );
m_lblUnits->SetToolTip( _("Units of this dimension (\"automatic\" to follow the units selected in the editor)") ); m_lblUnits->SetToolTip( _("Units of this dimension (\"automatic\" to follow the units selected in the editor)") );
@ -54,24 +96,24 @@ DIALOG_DIMENSION_PROPERTIES_BASE::DIALOG_DIMENSION_PROPERTIES_BASE( wxWindow* pa
wxString m_cbUnitsChoices[] = { _("Inches"), _("Mils"), _("Millimeters"), _("Automatic") }; wxString m_cbUnitsChoices[] = { _("Inches"), _("Mils"), _("Millimeters"), _("Automatic") };
int m_cbUnitsNChoices = sizeof( m_cbUnitsChoices ) / sizeof( wxString ); int m_cbUnitsNChoices = sizeof( m_cbUnitsChoices ) / sizeof( wxString );
m_cbUnits = new wxChoice( sbSizerFormat->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cbUnitsNChoices, m_cbUnitsChoices, 0 ); m_cbUnits = new wxChoice( m_sizerFormat->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cbUnitsNChoices, m_cbUnitsChoices, 0 );
m_cbUnits->SetSelection( 0 ); m_cbUnits->SetSelection( 0 );
m_cbUnits->SetToolTip( _("Units of this dimension (\"automatic\" to follow the units selected in the editor)") ); m_cbUnits->SetToolTip( _("Units of this dimension (\"automatic\" to follow the units selected in the editor)") );
gbSizerFormat->Add( m_cbUnits, wxGBPosition( 0, 5 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 ); gbSizerFormat->Add( m_cbUnits, wxGBPosition( 0, 5 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
m_lblPrefix = new wxStaticText( sbSizerFormat->GetStaticBox(), wxID_ANY, _("Prefix:"), wxDefaultPosition, wxDefaultSize, 0 ); m_lblPrefix = new wxStaticText( m_sizerFormat->GetStaticBox(), wxID_ANY, _("Prefix:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblPrefix->Wrap( -1 ); m_lblPrefix->Wrap( -1 );
m_lblPrefix->SetToolTip( _("Text to print before the dimension value") ); m_lblPrefix->SetToolTip( _("Text to print before the dimension value") );
gbSizerFormat->Add( m_lblPrefix, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 ); gbSizerFormat->Add( m_lblPrefix, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_txtPrefix = new wxTextCtrl( sbSizerFormat->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_txtPrefix = new wxTextCtrl( m_sizerFormat->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_txtPrefix->SetToolTip( _("Text to print before the dimension value") ); m_txtPrefix->SetToolTip( _("Text to print before the dimension value") );
gbSizerFormat->Add( m_txtPrefix, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 ); gbSizerFormat->Add( m_txtPrefix, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
m_txtUnitsFormat = new wxStaticText( sbSizerFormat->GetStaticBox(), wxID_ANY, _("Units format:"), wxDefaultPosition, wxDefaultSize, 0 ); m_txtUnitsFormat = new wxStaticText( m_sizerFormat->GetStaticBox(), wxID_ANY, _("Units format:"), wxDefaultPosition, wxDefaultSize, 0 );
m_txtUnitsFormat->Wrap( -1 ); m_txtUnitsFormat->Wrap( -1 );
m_txtUnitsFormat->SetToolTip( _("Choose how to display the units") ); m_txtUnitsFormat->SetToolTip( _("Choose how to display the units") );
@ -79,24 +121,24 @@ DIALOG_DIMENSION_PROPERTIES_BASE::DIALOG_DIMENSION_PROPERTIES_BASE( wxWindow* pa
wxString m_cbUnitsFormatChoices[] = { _("1234"), _("1234 mm"), _("1234 (mm)") }; wxString m_cbUnitsFormatChoices[] = { _("1234"), _("1234 mm"), _("1234 (mm)") };
int m_cbUnitsFormatNChoices = sizeof( m_cbUnitsFormatChoices ) / sizeof( wxString ); int m_cbUnitsFormatNChoices = sizeof( m_cbUnitsFormatChoices ) / sizeof( wxString );
m_cbUnitsFormat = new wxChoice( sbSizerFormat->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cbUnitsFormatNChoices, m_cbUnitsFormatChoices, 0 ); m_cbUnitsFormat = new wxChoice( m_sizerFormat->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cbUnitsFormatNChoices, m_cbUnitsFormatChoices, 0 );
m_cbUnitsFormat->SetSelection( 1 ); m_cbUnitsFormat->SetSelection( 1 );
m_cbUnitsFormat->SetToolTip( _("Choose how to display the units") ); m_cbUnitsFormat->SetToolTip( _("Choose how to display the units") );
gbSizerFormat->Add( m_cbUnitsFormat, wxGBPosition( 1, 5 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 ); gbSizerFormat->Add( m_cbUnitsFormat, wxGBPosition( 1, 5 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
m_lblSuffix = new wxStaticText( sbSizerFormat->GetStaticBox(), wxID_ANY, _("Suffix:"), wxDefaultPosition, wxDefaultSize, 0 ); m_lblSuffix = new wxStaticText( m_sizerFormat->GetStaticBox(), wxID_ANY, _("Suffix:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblSuffix->Wrap( -1 ); m_lblSuffix->Wrap( -1 );
m_lblSuffix->SetToolTip( _("Text to print after the dimension value") ); m_lblSuffix->SetToolTip( _("Text to print after the dimension value") );
gbSizerFormat->Add( m_lblSuffix, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 ); gbSizerFormat->Add( m_lblSuffix, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_txtSuffix = new wxTextCtrl( sbSizerFormat->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_txtSuffix = new wxTextCtrl( m_sizerFormat->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_txtSuffix->SetToolTip( _("Text to print after the dimension value") ); m_txtSuffix->SetToolTip( _("Text to print after the dimension value") );
gbSizerFormat->Add( m_txtSuffix, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 ); gbSizerFormat->Add( m_txtSuffix, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
m_lblPrecision = new wxStaticText( sbSizerFormat->GetStaticBox(), wxID_ANY, _("Precision:"), wxDefaultPosition, wxDefaultSize, 0 ); m_lblPrecision = new wxStaticText( m_sizerFormat->GetStaticBox(), wxID_ANY, _("Precision:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblPrecision->Wrap( -1 ); m_lblPrecision->Wrap( -1 );
m_lblPrecision->SetToolTip( _("Choose how many digits of precision to display") ); m_lblPrecision->SetToolTip( _("Choose how many digits of precision to display") );
@ -104,29 +146,29 @@ DIALOG_DIMENSION_PROPERTIES_BASE::DIALOG_DIMENSION_PROPERTIES_BASE( wxWindow* pa
wxString m_cbPrecisionChoices[] = { _("0"), _("0.0"), _("0.00"), _("0.000"), _("0.0000"), _("0.00000") }; wxString m_cbPrecisionChoices[] = { _("0"), _("0.0"), _("0.00"), _("0.000"), _("0.0000"), _("0.00000") };
int m_cbPrecisionNChoices = sizeof( m_cbPrecisionChoices ) / sizeof( wxString ); int m_cbPrecisionNChoices = sizeof( m_cbPrecisionChoices ) / sizeof( wxString );
m_cbPrecision = new wxChoice( sbSizerFormat->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cbPrecisionNChoices, m_cbPrecisionChoices, 0 ); m_cbPrecision = new wxChoice( m_sizerFormat->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cbPrecisionNChoices, m_cbPrecisionChoices, 0 );
m_cbPrecision->SetSelection( 0 ); m_cbPrecision->SetSelection( 0 );
m_cbPrecision->SetToolTip( _("Choose how many digits of precision to display") ); m_cbPrecision->SetToolTip( _("Choose how many digits of precision to display") );
gbSizerFormat->Add( m_cbPrecision, wxGBPosition( 2, 5 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 ); gbSizerFormat->Add( m_cbPrecision, wxGBPosition( 2, 5 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
m_cbSuppressZeroes = new wxCheckBox( sbSizerFormat->GetStaticBox(), wxID_ANY, _("Suppress trailing zeroes"), wxDefaultPosition, wxDefaultSize, 0 ); m_cbSuppressZeroes = new wxCheckBox( m_sizerFormat->GetStaticBox(), wxID_ANY, _("Suppress trailing zeroes"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbSuppressZeroes->SetToolTip( _("When checked, \"0.100\" will be shown as \"0.1\" even if the precision setting is higher") ); m_cbSuppressZeroes->SetToolTip( _("When checked, \"0.100\" will be shown as \"0.1\" even if the precision setting is higher") );
gbSizerFormat->Add( m_cbSuppressZeroes, wxGBPosition( 3, 4 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 ); gbSizerFormat->Add( m_cbSuppressZeroes, wxGBPosition( 3, 4 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_lblLayer = new wxStaticText( sbSizerFormat->GetStaticBox(), wxID_ANY, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 ); m_lblLayer = new wxStaticText( m_sizerFormat->GetStaticBox(), wxID_ANY, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblLayer->Wrap( -1 ); m_lblLayer->Wrap( -1 );
gbSizerFormat->Add( m_lblLayer, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 ); gbSizerFormat->Add( m_lblLayer, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_cbLayer = new PCB_LAYER_BOX_SELECTOR( sbSizerFormat->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); m_cbLayer = new PCB_LAYER_BOX_SELECTOR( m_sizerFormat->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
gbSizerFormat->Add( m_cbLayer, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALL, 5 ); gbSizerFormat->Add( m_cbLayer, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALL, 5 );
m_lblPreview = new wxStaticText( sbSizerFormat->GetStaticBox(), wxID_ANY, _("Preview:"), wxDefaultPosition, wxDefaultSize, 0 ); m_lblPreview = new wxStaticText( m_sizerFormat->GetStaticBox(), wxID_ANY, _("Preview:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblPreview->Wrap( -1 ); m_lblPreview->Wrap( -1 );
gbSizerFormat->Add( m_lblPreview, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 ); gbSizerFormat->Add( m_lblPreview, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_staticTextPreview = new wxStaticText( sbSizerFormat->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextPreview = new wxStaticText( m_sizerFormat->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextPreview->Wrap( -1 ); m_staticTextPreview->Wrap( -1 );
m_staticTextPreview->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) ); m_staticTextPreview->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
@ -137,10 +179,10 @@ DIALOG_DIMENSION_PROPERTIES_BASE::DIALOG_DIMENSION_PROPERTIES_BASE( wxWindow* pa
gbSizerFormat->AddGrowableCol( 3 ); gbSizerFormat->AddGrowableCol( 3 );
gbSizerFormat->AddGrowableCol( 5 ); gbSizerFormat->AddGrowableCol( 5 );
sbSizerFormat->Add( gbSizerFormat, 1, wxBOTTOM|wxEXPAND, 5 ); m_sizerFormat->Add( gbSizerFormat, 1, wxBOTTOM|wxEXPAND, 5 );
bMainSizer->Add( sbSizerFormat, 0, wxALL|wxEXPAND, 5 ); m_mainSizer->Add( m_sizerFormat, 1, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* sbSizerText; wxStaticBoxSizer* sbSizerText;
sbSizerText = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Dimension Text") ), wxVERTICAL ); sbSizerText = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Dimension Text") ), wxVERTICAL );
@ -274,7 +316,7 @@ DIALOG_DIMENSION_PROPERTIES_BASE::DIALOG_DIMENSION_PROPERTIES_BASE( wxWindow* pa
sbSizerText->Add( gbSizerText, 0, wxBOTTOM|wxEXPAND, 5 ); sbSizerText->Add( gbSizerText, 0, wxBOTTOM|wxEXPAND, 5 );
bMainSizer->Add( sbSizerText, 0, wxALL|wxEXPAND, 5 ); m_mainSizer->Add( sbSizerText, 0, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* sbSizerLine; wxStaticBoxSizer* sbSizerLine;
sbSizerLine = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Dimension Line") ), wxVERTICAL ); sbSizerLine = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Dimension Line") ), wxVERTICAL );
@ -334,13 +376,13 @@ DIALOG_DIMENSION_PROPERTIES_BASE::DIALOG_DIMENSION_PROPERTIES_BASE( wxWindow* pa
sbSizerLine->Add( gbSizerLine, 1, wxBOTTOM|wxEXPAND, 5 ); sbSizerLine->Add( gbSizerLine, 1, wxBOTTOM|wxEXPAND, 5 );
bMainSizer->Add( sbSizerLine, 0, wxALL|wxEXPAND, 5 ); m_mainSizer->Add( sbSizerLine, 0, wxALL|wxEXPAND, 5 );
bMainSizer->Add( 0, 0, 0, wxTOP, 5 ); m_mainSizer->Add( 0, 0, 0, wxTOP, 5 );
m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bMainSizer->Add( m_staticline, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 ); m_mainSizer->Add( m_staticline, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
wxBoxSizer* lowerSizer; wxBoxSizer* lowerSizer;
lowerSizer = new wxBoxSizer( wxHORIZONTAL ); lowerSizer = new wxBoxSizer( wxHORIZONTAL );
@ -358,10 +400,10 @@ DIALOG_DIMENSION_PROPERTIES_BASE::DIALOG_DIMENSION_PROPERTIES_BASE( wxWindow* pa
lowerSizer->Add( m_sdbSizer, 0, wxALL, 5 ); lowerSizer->Add( m_sdbSizer, 0, wxALL, 5 );
bMainSizer->Add( lowerSizer, 0, wxEXPAND, 5 ); m_mainSizer->Add( lowerSizer, 0, wxEXPAND, 5 );
this->SetSizer( bMainSizer ); this->SetSizer( m_mainSizer );
this->Layout(); this->Layout();
this->Centre( wxBOTH ); this->Centre( wxBOTH );

View File

@ -45,7 +45,7 @@
<property name="minimum_size">-1,-1</property> <property name="minimum_size">-1,-1</property>
<property name="name">DIALOG_DIMENSION_PROPERTIES_BASE</property> <property name="name">DIALOG_DIMENSION_PROPERTIES_BASE</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size">654,757</property> <property name="size">654,600</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU</property> <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property> <property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Dimension Properties</property> <property name="title">Dimension Properties</property>
@ -56,28 +56,466 @@
<event name="OnInitDialog">OnInitDlg</event> <event name="OnInitDialog">OnInitDlg</event>
<object class="wxBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">bMainSizer</property> <property name="name">m_mainSizer</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="permission">none</property> <property name="permission">protected</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="1"> <object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Dimension Format</property> <property name="label">Leader Format</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">sbSizerFormat</property> <property name="name">m_sizerLeader</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="parent">1</property> <property name="parent">1</property>
<property name="permission">none</property> <property name="permission">protected</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxBOTTOM|wxEXPAND</property> <property name="flag">wxBOTTOM|wxEXPAND</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxGridBagSizer" expanded="1"> <object class="wxGridBagSizer" expanded="1">
<property name="empty_cell_size"></property> <property name="empty_cell_size"></property>
<property name="flexible_direction">wxHORIZONTAL</property> <property name="flexible_direction">wxBOTH</property>
<property name="growablecols"></property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
<property name="name">gbSizerLeader</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="vgap">0</property>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="row">0</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Value:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_lblLeaderValue</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="row">0</property>
<property name="rowspan">1</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_txtLeaderValue</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">2</property>
<property name="flag">wxEXPAND</property>
<property name="row">0</property>
<property name="rowspan">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">60</property>
</object>
</object>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="row">0</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Text frame:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_lblTextFrame</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Draw a shape around the leader text</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">4</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="row">0</property>
<property name="rowspan">1</property>
<object class="wxChoice" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices">&quot;None&quot; &quot;Rectangle&quot; &quot;Circle&quot;</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_cbTextFrame</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">0</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Draw a shape around the leader text</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="row">1</property>
<property name="rowspan">1</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Layer:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_lblLeaderLayer</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="row">1</property>
<property name="rowspan">1</property>
<object class="wxBitmapComboBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices"></property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_cbLeaderLayer</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">-1</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">PCB_LAYER_BOX_SELECTOR; pcb_layer_box_selector.h</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Dimension Format</property>
<property name="minimum_size"></property>
<property name="name">m_sizerFormat</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">protected</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxGridBagSizer" expanded="1">
<property name="empty_cell_size"></property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">1,3,5</property> <property name="growablecols">1,3,5</property>
<property name="growablerows"></property> <property name="growablerows"></property>
<property name="hgap">5</property> <property name="hgap">5</property>
@ -1288,7 +1726,7 @@
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="1"> <object class="wxStaticBoxSizer" expanded="0">
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Dimension Text</property> <property name="label">Dimension Text</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
@ -1296,11 +1734,11 @@
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="parent">1</property> <property name="parent">1</property>
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxBOTTOM|wxEXPAND</property> <property name="flag">wxBOTTOM|wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxGridBagSizer" expanded="1"> <object class="wxGridBagSizer" expanded="0">
<property name="empty_cell_size"></property> <property name="empty_cell_size"></property>
<property name="flexible_direction">wxHORIZONTAL</property> <property name="flexible_direction">wxHORIZONTAL</property>
<property name="growablecols">1,3,5</property> <property name="growablecols">1,3,5</property>
@ -1311,7 +1749,7 @@
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property> <property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property> <property name="permission">none</property>
<property name="vgap">0</property> <property name="vgap">0</property>
<object class="gbsizeritem" expanded="1"> <object class="gbsizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="colspan">1</property> <property name="colspan">1</property>
<property name="column">0</property> <property name="column">0</property>
@ -1375,7 +1813,7 @@
<property name="wrap">-1</property> <property name="wrap">-1</property>
</object> </object>
</object> </object>
<object class="gbsizeritem" expanded="1"> <object class="gbsizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="colspan">1</property> <property name="colspan">1</property>
<property name="column">1</property> <property name="column">1</property>
@ -1443,7 +1881,7 @@
<event name="OnTextEnter">OnOkClick</event> <event name="OnTextEnter">OnOkClick</event>
</object> </object>
</object> </object>
<object class="gbsizeritem" expanded="1"> <object class="gbsizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="colspan">1</property> <property name="colspan">1</property>
<property name="column">2</property> <property name="column">2</property>
@ -1507,20 +1945,20 @@
<property name="wrap">-1</property> <property name="wrap">-1</property>
</object> </object>
</object> </object>
<object class="gbsizeritem" expanded="1"> <object class="gbsizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="colspan">1</property> <property name="colspan">1</property>
<property name="column">3</property> <property name="column">3</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="row">0</property> <property name="row">0</property>
<property name="rowspan">1</property> <property name="rowspan">1</property>
<object class="spacer" expanded="1"> <object class="spacer" expanded="0">
<property name="height">0</property> <property name="height">0</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="width">20</property> <property name="width">20</property>
</object> </object>
</object> </object>
<object class="gbsizeritem" expanded="1"> <object class="gbsizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="colspan">1</property> <property name="colspan">1</property>
<property name="column">4</property> <property name="column">4</property>
@ -1584,7 +2022,7 @@
<property name="wrap">-1</property> <property name="wrap">-1</property>
</object> </object>
</object> </object>
<object class="gbsizeritem" expanded="1"> <object class="gbsizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="colspan">1</property> <property name="colspan">1</property>
<property name="column">5</property> <property name="column">5</property>
@ -1652,7 +2090,7 @@
<event name="OnTextEnter">OnOkClick</event> <event name="OnTextEnter">OnOkClick</event>
</object> </object>
</object> </object>
<object class="gbsizeritem" expanded="1"> <object class="gbsizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="colspan">1</property> <property name="colspan">1</property>
<property name="column">6</property> <property name="column">6</property>
@ -1716,7 +2154,7 @@
<property name="wrap">-1</property> <property name="wrap">-1</property>
</object> </object>
</object> </object>
<object class="gbsizeritem" expanded="1"> <object class="gbsizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="colspan">1</property> <property name="colspan">1</property>
<property name="column">0</property> <property name="column">0</property>
@ -1780,7 +2218,7 @@
<property name="wrap">-1</property> <property name="wrap">-1</property>
</object> </object>
</object> </object>
<object class="gbsizeritem" expanded="1"> <object class="gbsizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="colspan">1</property> <property name="colspan">1</property>
<property name="column">1</property> <property name="column">1</property>
@ -1848,7 +2286,7 @@
<event name="OnTextEnter">OnOkClick</event> <event name="OnTextEnter">OnOkClick</event>
</object> </object>
</object> </object>
<object class="gbsizeritem" expanded="1"> <object class="gbsizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="colspan">1</property> <property name="colspan">1</property>
<property name="column">2</property> <property name="column">2</property>
@ -1912,7 +2350,7 @@
<property name="wrap">-1</property> <property name="wrap">-1</property>
</object> </object>
</object> </object>
<object class="gbsizeritem" expanded="1"> <object class="gbsizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="colspan">1</property> <property name="colspan">1</property>
<property name="column">4</property> <property name="column">4</property>
@ -1976,7 +2414,7 @@
<property name="wrap">-1</property> <property name="wrap">-1</property>
</object> </object>
</object> </object>
<object class="gbsizeritem" expanded="1"> <object class="gbsizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="colspan">1</property> <property name="colspan">1</property>
<property name="column">5</property> <property name="column">5</property>
@ -2044,7 +2482,7 @@
<event name="OnTextEnter">OnOkClick</event> <event name="OnTextEnter">OnOkClick</event>
</object> </object>
</object> </object>
<object class="gbsizeritem" expanded="1"> <object class="gbsizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="colspan">1</property> <property name="colspan">1</property>
<property name="column">6</property> <property name="column">6</property>
@ -2108,7 +2546,7 @@
<property name="wrap">-1</property> <property name="wrap">-1</property>
</object> </object>
</object> </object>
<object class="gbsizeritem" expanded="1"> <object class="gbsizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="colspan">1</property> <property name="colspan">1</property>
<property name="column">0</property> <property name="column">0</property>
@ -2172,7 +2610,7 @@
<property name="wrap">-1</property> <property name="wrap">-1</property>
</object> </object>
</object> </object>
<object class="gbsizeritem" expanded="1"> <object class="gbsizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="colspan">1</property> <property name="colspan">1</property>
<property name="column">1</property> <property name="column">1</property>
@ -2240,7 +2678,7 @@
<event name="OnTextEnter">OnOkClick</event> <event name="OnTextEnter">OnOkClick</event>
</object> </object>
</object> </object>
<object class="gbsizeritem" expanded="1"> <object class="gbsizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="colspan">1</property> <property name="colspan">1</property>
<property name="column">2</property> <property name="column">2</property>
@ -2304,7 +2742,7 @@
<property name="wrap">-1</property> <property name="wrap">-1</property>
</object> </object>
</object> </object>
<object class="gbsizeritem" expanded="1"> <object class="gbsizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="colspan">1</property> <property name="colspan">1</property>
<property name="column">4</property> <property name="column">4</property>
@ -2368,7 +2806,7 @@
<property name="wrap">-1</property> <property name="wrap">-1</property>
</object> </object>
</object> </object>
<object class="gbsizeritem" expanded="1"> <object class="gbsizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="colspan">1</property> <property name="colspan">1</property>
<property name="column">5</property> <property name="column">5</property>
@ -2437,7 +2875,7 @@
<event name="OnTextEnter">OnOkClick</event> <event name="OnTextEnter">OnOkClick</event>
</object> </object>
</object> </object>
<object class="gbsizeritem" expanded="1"> <object class="gbsizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="colspan">1</property> <property name="colspan">1</property>
<property name="column">0</property> <property name="column">0</property>
@ -2504,14 +2942,14 @@
<property name="window_style"></property> <property name="window_style"></property>
</object> </object>
</object> </object>
<object class="gbsizeritem" expanded="1"> <object class="gbsizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="colspan">3</property> <property name="colspan">3</property>
<property name="column">4</property> <property name="column">4</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property> <property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="row">4</property> <property name="row">4</property>
<property name="rowspan">1</property> <property name="rowspan">1</property>
<object class="wxCheckBox" expanded="1"> <object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
@ -2571,7 +3009,7 @@
<property name="window_style"></property> <property name="window_style"></property>
</object> </object>
</object> </object>
<object class="gbsizeritem" expanded="1"> <object class="gbsizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="colspan">1</property> <property name="colspan">1</property>
<property name="column">0</property> <property name="column">0</property>
@ -2638,7 +3076,7 @@
<property name="window_style"></property> <property name="window_style"></property>
</object> </object>
</object> </object>
<object class="gbsizeritem" expanded="1"> <object class="gbsizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="colspan">1</property> <property name="colspan">1</property>
<property name="column">0</property> <property name="column">0</property>
@ -2702,7 +3140,7 @@
<property name="wrap">-1</property> <property name="wrap">-1</property>
</object> </object>
</object> </object>
<object class="gbsizeritem" expanded="1"> <object class="gbsizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="colspan">1</property> <property name="colspan">1</property>
<property name="column">1</property> <property name="column">1</property>
@ -2769,14 +3207,14 @@
<property name="window_style"></property> <property name="window_style"></property>
</object> </object>
</object> </object>
<object class="gbsizeritem" expanded="1"> <object class="gbsizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="colspan">1</property> <property name="colspan">1</property>
<property name="column">4</property> <property name="column">4</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property> <property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="row">2</property> <property name="row">2</property>
<property name="rowspan">1</property> <property name="rowspan">1</property>
<object class="wxStaticText" expanded="1"> <object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
@ -2833,14 +3271,14 @@
<property name="wrap">-1</property> <property name="wrap">-1</property>
</object> </object>
</object> </object>
<object class="gbsizeritem" expanded="1"> <object class="gbsizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="colspan">1</property> <property name="colspan">1</property>
<property name="column">5</property> <property name="column">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND</property>
<property name="row">2</property> <property name="row">2</property>
<property name="rowspan">1</property> <property name="rowspan">1</property>
<object class="wxChoice" expanded="1"> <object class="wxChoice" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
<property name="RightDockable">1</property> <property name="RightDockable">1</property>

View File

@ -20,12 +20,12 @@ class PCB_LAYER_BOX_SELECTOR;
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/textctrl.h> #include <wx/textctrl.h>
#include <wx/checkbox.h>
#include <wx/choice.h> #include <wx/choice.h>
#include <wx/bmpcbox.h> #include <wx/bmpcbox.h>
#include <wx/gbsizer.h> #include <wx/gbsizer.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/statbox.h> #include <wx/statbox.h>
#include <wx/checkbox.h>
#include <wx/combobox.h> #include <wx/combobox.h>
#include <wx/statline.h> #include <wx/statline.h>
#include <wx/button.h> #include <wx/button.h>
@ -42,6 +42,15 @@ class DIALOG_DIMENSION_PROPERTIES_BASE : public DIALOG_SHIM
private: private:
protected: protected:
wxBoxSizer* m_mainSizer;
wxStaticBoxSizer* m_sizerLeader;
wxStaticText* m_lblLeaderValue;
wxTextCtrl* m_txtLeaderValue;
wxStaticText* m_lblTextFrame;
wxChoice* m_cbTextFrame;
wxStaticText* m_lblLeaderLayer;
PCB_LAYER_BOX_SELECTOR* m_cbLeaderLayer;
wxStaticBoxSizer* m_sizerFormat;
wxStaticText* m_lblValue; wxStaticText* m_lblValue;
wxTextCtrl* m_txtValue; wxTextCtrl* m_txtValue;
wxCheckBox* m_cbOverrideValue; wxCheckBox* m_cbOverrideValue;
@ -106,7 +115,7 @@ class DIALOG_DIMENSION_PROPERTIES_BASE : public DIALOG_SHIM
public: public:
DIALOG_DIMENSION_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Dimension Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 654,757 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU ); DIALOG_DIMENSION_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Dimension Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 654,600 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DIALOG_DIMENSION_PROPERTIES_BASE(); ~DIALOG_DIMENSION_PROPERTIES_BASE();
}; };

View File

@ -156,7 +156,7 @@ int DRC_TEST_PROVIDER::forEachGeometryItem( const std::vector<KICAD_T>& aTypes,
{ {
if( (item->GetLayerSet() & aLayers).any() ) if( (item->GetLayerSet() & aLayers).any() )
{ {
if( typeMask[ PCB_DIMENSION_T ] && item->Type() == PCB_DIMENSION_T ) if( typeMask[PCB_DIMENSION_T] && BaseType( item->Type() ) == PCB_DIMENSION_T )
{ {
if( !aFunc( item ) ) if( !aFunc( item ) )
return n; return n;

View File

@ -142,7 +142,8 @@ void PCB_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
ShowTargetOptionsDialog( static_cast<PCB_TARGET*>( aItem ) ); ShowTargetOptionsDialog( static_cast<PCB_TARGET*>( aItem ) );
break; break;
case PCB_DIMENSION_T: case PCB_DIM_ALIGNED_T:
case PCB_DIM_LEADER_T:
ShowDimensionPropertyDialog( static_cast<DIMENSION*>( aItem ) ); ShowDimensionPropertyDialog( static_cast<DIMENSION*>( aItem ) );
break; break;

View File

@ -202,7 +202,8 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_
itemplotter.PlotTextePcb( (TEXTE_PCB*) PtStruct ); itemplotter.PlotTextePcb( (TEXTE_PCB*) PtStruct );
break; break;
case PCB_DIMENSION_T: case PCB_DIM_ALIGNED_T:
case PCB_DIM_LEADER_T:
case PCB_TARGET_T: case PCB_TARGET_T:
case PCB_MARKER_T: // do not draw case PCB_MARKER_T: // do not draw
default: default:

View File

@ -398,8 +398,9 @@ void PCB_IO::Format( BOARD_ITEM* aItem, int aNestLevel ) const
format( static_cast<BOARD*>( aItem ), aNestLevel ); format( static_cast<BOARD*>( aItem ), aNestLevel );
break; break;
case PCB_DIMENSION_T: case PCB_DIM_ALIGNED_T:
format( static_cast<ALIGNED_DIMENSION*>( aItem ), aNestLevel ); case PCB_DIM_LEADER_T:
format( static_cast<DIMENSION*>( aItem ), aNestLevel );
break; break;
case PCB_LINE_T: case PCB_LINE_T:
@ -659,9 +660,19 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
} }
void PCB_IO::format( ALIGNED_DIMENSION* aDimension, int aNestLevel ) const void PCB_IO::format( DIMENSION* aDimension, int aNestLevel ) const
{ {
m_out->Print( aNestLevel, "(dimension (type aligned)" ); ALIGNED_DIMENSION* aligned = dynamic_cast<ALIGNED_DIMENSION*>( aDimension );
LEADER* leader = dynamic_cast<LEADER*>( aDimension );
m_out->Print( aNestLevel, "(dimension" );
if( aDimension->Type() == PCB_DIM_ALIGNED_T )
m_out->Print( 0, " (type aligned)" );
else if( aDimension->Type() == PCB_DIM_LEADER_T )
m_out->Print( 0, " (type leader)" );
else
wxFAIL_MSG( wxT( "Cannot format unknown dimension type!" ) );
formatLayer( aDimension ); formatLayer( aDimension );
@ -675,8 +686,9 @@ void PCB_IO::format( ALIGNED_DIMENSION* aDimension, int aNestLevel ) const
FormatInternalUnits( aDimension->GetEnd().x ).c_str(), FormatInternalUnits( aDimension->GetEnd().x ).c_str(),
FormatInternalUnits( aDimension->GetEnd().y ).c_str() ); FormatInternalUnits( aDimension->GetEnd().y ).c_str() );
if( aligned )
m_out->Print( aNestLevel+1, "(height %s)\n", m_out->Print( aNestLevel+1, "(height %s)\n",
FormatInternalUnits( aDimension->GetHeight() ).c_str() ); FormatInternalUnits( aligned->GetHeight() ).c_str() );
Format( &aDimension->Text(), aNestLevel+1 ); Format( &aDimension->Text(), aNestLevel+1 );
@ -705,8 +717,16 @@ void PCB_IO::format( ALIGNED_DIMENSION* aDimension, int aNestLevel ) const
FormatInternalUnits( aDimension->GetArrowLength() ).c_str(), FormatInternalUnits( aDimension->GetArrowLength() ).c_str(),
static_cast<int>( aDimension->GetTextPositionMode() ) ); static_cast<int>( aDimension->GetTextPositionMode() ) );
m_out->Print( 0, " (extension_height %s) (extension_offset %s)", if( aligned )
FormatInternalUnits( aDimension->GetExtensionHeight() ).c_str(), {
m_out->Print( 0, " (extension_height %s)",
FormatInternalUnits( aligned->GetExtensionHeight() ).c_str() );
}
if( leader )
m_out->Print( 0, " (text_frame %d)", static_cast<int>( leader->GetTextFrame() ) );
m_out->Print( 0, " (extension_offset %s)",
FormatInternalUnits( aDimension->GetExtensionOffset() ).c_str() ); FormatInternalUnits( aDimension->GetExtensionOffset() ).c_str() );
if( aDimension->GetKeepTextAligned() ) if( aDimension->GetKeepTextAligned() )

View File

@ -35,7 +35,7 @@ class FP_CACHE;
class PCB_PARSER; class PCB_PARSER;
class NETINFO_MAPPING; class NETINFO_MAPPING;
class BOARD_DESIGN_SETTINGS; class BOARD_DESIGN_SETTINGS;
class ALIGNED_DIMENSION; class DIMENSION;
class EDGE_MODULE; class EDGE_MODULE;
class DRAWSEGMENT; class DRAWSEGMENT;
class PCB_TARGET; class PCB_TARGET;
@ -83,7 +83,8 @@ class TEXTE_PCB;
//#define SEXPR_BOARD_FILE_VERSION 20200825 // Remove host information //#define SEXPR_BOARD_FILE_VERSION 20200825 // Remove host information
//#define SEXPR_BOARD_FILE_VERSION 20200828 // Add new fabrication attributes //#define SEXPR_BOARD_FILE_VERSION 20200828 // Add new fabrication attributes
//#define SEXPR_BOARD_FILE_VERSION 20200829 // Remove library name from exported footprints //#define SEXPR_BOARD_FILE_VERSION 20200829 // Remove library name from exported footprints
#define SEXPR_BOARD_FILE_VERSION 20200909 // Change DIMENSION format //#define SEXPR_BOARD_FILE_VERSION 20200909 // Change DIMENSION format
#define SEXPR_BOARD_FILE_VERSION 20200913 // Add leader dimension
#define BOARD_FILE_HOST_VERSION 20200825 ///< Earlier files than this include the host tag #define BOARD_FILE_HOST_VERSION 20200825 ///< Earlier files than this include the host tag
@ -252,7 +253,7 @@ protected:
private: private:
void format( BOARD* aBoard, int aNestLevel = 0 ) const; void format( BOARD* aBoard, int aNestLevel = 0 ) const;
void format( ALIGNED_DIMENSION* aDimension, int aNestLevel = 0 ) const; void format( DIMENSION* aDimension, int aNestLevel = 0 ) const;
void format( EDGE_MODULE* aModuleDrawing, int aNestLevel = 0 ) const; void format( EDGE_MODULE* aModuleDrawing, int aNestLevel = 0 ) const;

View File

@ -320,7 +320,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
placeMenu->Add( PCB_ACTIONS::drawPolygon ); placeMenu->Add( PCB_ACTIONS::drawPolygon );
placeMenu->AppendSeparator(); placeMenu->AppendSeparator();
placeMenu->Add( PCB_ACTIONS::drawDimension ); placeMenu->Add( PCB_ACTIONS::drawAlignedDimension );
placeMenu->Add( PCB_ACTIONS::drawLeader );
placeMenu->AppendSeparator(); placeMenu->AppendSeparator();
placeMenu->Add( PCB_ACTIONS::placeTarget ); placeMenu->Add( PCB_ACTIONS::placeTarget );

View File

@ -720,7 +720,8 @@ void PCB_EDIT_FRAME::setupUIConditions()
CURRENT_TOOL( PCB_ACTIONS::drawArc ); CURRENT_TOOL( PCB_ACTIONS::drawArc );
CURRENT_TOOL( PCB_ACTIONS::drawPolygon ); CURRENT_TOOL( PCB_ACTIONS::drawPolygon );
CURRENT_TOOL( PCB_ACTIONS::placeText ); CURRENT_TOOL( PCB_ACTIONS::placeText );
CURRENT_TOOL( PCB_ACTIONS::drawDimension ); CURRENT_TOOL( PCB_ACTIONS::drawAlignedDimension );
CURRENT_TOOL( PCB_ACTIONS::drawLeader );
CURRENT_TOOL( PCB_ACTIONS::placeTarget ); CURRENT_TOOL( PCB_ACTIONS::placeTarget );
CURRENT_TOOL( PCB_ACTIONS::drillOrigin ); CURRENT_TOOL( PCB_ACTIONS::drillOrigin );
CURRENT_TOOL( PCB_ACTIONS::gridSetOrigin ); CURRENT_TOOL( PCB_ACTIONS::gridSetOrigin );

View File

@ -443,7 +443,8 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
draw( static_cast<const ZONE_CONTAINER*>( item ), aLayer ); draw( static_cast<const ZONE_CONTAINER*>( item ), aLayer );
break; break;
case PCB_DIMENSION_T: case PCB_DIM_ALIGNED_T:
case PCB_DIM_LEADER_T:
draw( static_cast<const DIMENSION*>( item ), aLayer ); draw( static_cast<const DIMENSION*>( item ), aLayer );
break; break;
@ -1277,9 +1278,29 @@ void PCB_PAINTER::draw( const DIMENSION* aDimension, int aLayer )
} }
// Draw dimension shapes // Draw dimension shapes
for( const SEG& seg : aDimension->GetLines() ) // TODO(JE) lift this out
for( const std::shared_ptr<SHAPE>& shape : aDimension->GetShapes() )
{
switch( shape->Type() )
{
case SH_SEGMENT:
{
const SEG& seg = static_cast<const SHAPE_SEGMENT*>( shape.get() )->GetSeg();
m_gal->DrawLine( seg.A, seg.B ); m_gal->DrawLine( seg.A, seg.B );
break;
}
case SH_CIRCLE:
{
int radius = static_cast<const SHAPE_CIRCLE*>( shape.get() )->GetRadius();
m_gal->DrawCircle( shape->Centre(), radius );
break;
}
default:
break;
}
}
// Draw text // Draw text
TEXTE_PCB& text = aDimension->Text(); TEXTE_PCB& text = aDimension->Text();
VECTOR2D position( text.GetTextPos().x, text.GetTextPos().y ); VECTOR2D position( text.GetTextPos().x, text.GetTextPos().y );

View File

@ -2354,7 +2354,7 @@ DIMENSION* PCB_PARSER::parseDIMENSION()
T token; T token;
std::unique_ptr<ALIGNED_DIMENSION> dimension( new ALIGNED_DIMENSION( nullptr ) ); std::unique_ptr<DIMENSION> dimension;
// skip value that used to be saved // skip value that used to be saved
if( NextTok() != T_LEFT ) if( NextTok() != T_LEFT )
@ -2368,6 +2368,7 @@ DIMENSION* PCB_PARSER::parseDIMENSION()
if( token == T_width ) if( token == T_width )
{ {
isLegacyDimension = true; isLegacyDimension = true;
dimension = std::make_unique<ALIGNED_DIMENSION>( nullptr );
dimension->SetLineThickness( parseBoardUnits( "dimension width value" ) ); dimension->SetLineThickness( parseBoardUnits( "dimension width value" ) );
NeedRIGHT(); NeedRIGHT();
} }
@ -2376,9 +2377,20 @@ DIMENSION* PCB_PARSER::parseDIMENSION()
if( token != T_type ) if( token != T_type )
Expecting( T_type ); Expecting( T_type );
// This function only parses aligned dimensions for now switch( NextTok() )
if( NextTok() != T_aligned ) {
Expecting( T_aligned ); case T_aligned:
dimension = std::make_unique<ALIGNED_DIMENSION>( nullptr );
break;
case T_leader:
dimension = std::make_unique<LEADER>( nullptr );
break;
default:
wxFAIL_MSG( wxT( "Cannot parse unknown dimension type %s" ) +
GetTokenString( CurTok() ) );
}
NeedRIGHT(); NeedRIGHT();
} }
@ -2441,9 +2453,14 @@ DIMENSION* PCB_PARSER::parseDIMENSION()
} }
case T_height: case T_height:
dimension->SetHeight( parseBoardUnits( "dimension height value" ) ); {
wxCHECK_MSG( dimension->Type() == PCB_DIM_ALIGNED_T, nullptr,
wxT( "Invalid height token" ) );
ALIGNED_DIMENSION* aligned = static_cast<ALIGNED_DIMENSION*>( dimension.get() );
aligned->SetHeight( parseBoardUnits( "dimension height value" ) );
NeedRIGHT(); NeedRIGHT();
break; break;
}
case T_format: case T_format:
{ {
@ -2540,9 +2557,14 @@ DIMENSION* PCB_PARSER::parseDIMENSION()
} }
case T_extension_height: case T_extension_height:
dimension->SetExtensionHeight( parseBoardUnits( "extension height" ) ); {
wxCHECK_MSG( dimension->Type() == PCB_DIM_ALIGNED_T, nullptr,
wxT( "Invalid extension_height token" ) );
ALIGNED_DIMENSION* aligned = static_cast<ALIGNED_DIMENSION*>( dimension.get() );
aligned->SetExtensionHeight( parseBoardUnits( "extension height" ) );
NeedRIGHT(); NeedRIGHT();
break; break;
}
case T_extension_offset: case T_extension_offset:
dimension->SetExtensionOffset( parseBoardUnits( "extension offset" ) ); dimension->SetExtensionOffset( parseBoardUnits( "extension offset" ) );
@ -2553,6 +2575,19 @@ DIMENSION* PCB_PARSER::parseDIMENSION()
dimension->SetKeepTextAligned( true ); dimension->SetKeepTextAligned( true );
break; break;
case T_text_frame:
{
wxCHECK_MSG( dimension->Type() == PCB_DIM_LEADER_T, nullptr,
wxT( "Invalid text_frame token" ) );
LEADER* leader = static_cast<LEADER*>( dimension.get() );
int textFrame = parseInt( "dimension text frame mode" );
textFrame = std::max( 0, std::min( 3, textFrame ) );
leader->SetTextFrame( static_cast<DIM_TEXT_FRAME>( textFrame ) );
NeedRIGHT();
break;
}
default: default:
Expecting( "thickness, arrow_length, text_position_mode, extension_height, " Expecting( "thickness, arrow_length, text_position_mode, extension_height, "
"extension_offset" ); "extension_offset" );
@ -2610,11 +2645,14 @@ DIMENSION* PCB_PARSER::parseDIMENSION()
if( token == T_pts ) if( token == T_pts )
{ {
// If we have a crossbar, we know we're an old aligned dimension
ALIGNED_DIMENSION* aligned = static_cast<ALIGNED_DIMENSION*>( dimension.get() );
// Old style: calculate height from crossbar // Old style: calculate height from crossbar
wxPoint point1, point2; wxPoint point1, point2;
parseXY( &point1.x, &point1.y ); parseXY( &point1.x, &point1.y );
parseXY( &point2.x, &point2.y ); parseXY( &point2.x, &point2.y );
dimension->UpdateHeight( point2, point1 ); // Yes, backwards intentionally aligned->UpdateHeight( point2, point1 ); // Yes, backwards intentionally
NeedRIGHT(); NeedRIGHT();
} }

View File

@ -31,8 +31,10 @@
#include <common.h> #include <common.h>
#include <convert_basic_shapes_to_polygon.h> #include <convert_basic_shapes_to_polygon.h>
#include <geometry/seg.h> // for SEG #include <geometry/seg.h> // for SEG
#include <geometry/shape_circle.h>
#include <geometry/shape_line_chain.h> // for SHAPE_LINE_CHAIN #include <geometry/shape_line_chain.h> // for SHAPE_LINE_CHAIN
#include <geometry/shape_poly_set.h> // for SHAPE_POLY_SET, SHAPE_P... #include <geometry/shape_poly_set.h> // for SHAPE_POLY_SET, SHAPE_P...
#include <geometry/shape_segment.h>
#include <math/util.h> // for KiROUND, Clamp #include <math/util.h> // for KiROUND, Clamp
#include <math/vector2d.h> // for VECTOR2I #include <math/vector2d.h> // for VECTOR2I
#include <plotter.h> #include <plotter.h>
@ -311,7 +313,12 @@ void BRDITEMS_PLOTTER::PlotBoardGraphicItems()
{ {
case PCB_LINE_T: PlotDrawSegment( (DRAWSEGMENT*) item); break; case PCB_LINE_T: PlotDrawSegment( (DRAWSEGMENT*) item); break;
case PCB_TEXT_T: PlotTextePcb( (TEXTE_PCB*) item ); break; case PCB_TEXT_T: PlotTextePcb( (TEXTE_PCB*) item ); break;
case PCB_DIMENSION_T: PlotDimension( (DIMENSION*) item ); break;
case PCB_DIM_ALIGNED_T:
case PCB_DIM_LEADER_T:
PlotDimension( (DIMENSION*) item );
break;
case PCB_TARGET_T: PlotPcbTarget( (PCB_TARGET*) item ); break; case PCB_TARGET_T: PlotPcbTarget( (PCB_TARGET*) item ); break;
default: break; default: break;
} }
@ -371,11 +378,38 @@ void BRDITEMS_PLOTTER::PlotDimension( DIMENSION* aDim )
PlotTextePcb( &aDim->Text() ); PlotTextePcb( &aDim->Text() );
for( const SEG& seg : aDim->GetLines() ) for( const std::shared_ptr<SHAPE>& shape : aDim->GetShapes() )
{ {
switch( shape->Type() )
{
case SH_SEGMENT:
{
const SEG& seg = static_cast<const SHAPE_SEGMENT*>( shape.get() )->GetSeg();
draw.SetShape( S_SEGMENT );
draw.SetStart( wxPoint( seg.A ) ); draw.SetStart( wxPoint( seg.A ) );
draw.SetEnd( wxPoint( seg.B ) ); draw.SetEnd( wxPoint( seg.B ) );
PlotDrawSegment( &draw ); PlotDrawSegment( &draw );
break;
}
case SH_CIRCLE:
{
wxPoint start( shape->Centre() );
int radius = static_cast<const SHAPE_CIRCLE*>( shape.get() )->GetRadius();
draw.SetShape( S_CIRCLE );
draw.SetStart( start );
draw.SetEnd( wxPoint( start.x + radius, start.y ) );
PlotDrawSegment( &draw );
break;
}
default:
break;
}
} }
} }

View File

@ -378,7 +378,9 @@ void PCB_EDIT_FRAME::ReCreateVToolbar()
m_drawToolBar->Add( PCB_ACTIONS::drawArc, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( PCB_ACTIONS::drawArc, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::drawPolygon, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( PCB_ACTIONS::drawPolygon, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::placeText, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( PCB_ACTIONS::placeText, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::drawDimension, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( PCB_ACTIONS::drawAlignedDimension, ACTION_TOOLBAR::TOGGLE );
// TODO: re-insert when we have a multi-select tool button
// m_drawToolBar->Add( PCB_ACTIONS::drawLeader, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::placeTarget, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( PCB_ACTIONS::placeTarget, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( ACTIONS::deleteTool, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( ACTIONS::deleteTool, ACTION_TOOLBAR::TOGGLE );

View File

@ -604,8 +604,9 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
if( m_editModules && !m_frame->GetModel() ) if( m_editModules && !m_frame->GetModel() )
return 0; return 0;
TOOL_EVENT originalEvent = aEvent;
POINT_EDITOR* pointEditor = m_toolMgr->GetTool<POINT_EDITOR>(); POINT_EDITOR* pointEditor = m_toolMgr->GetTool<POINT_EDITOR>();
ALIGNED_DIMENSION* dimension = nullptr; DIMENSION* dimension = nullptr;
BOARD_COMMIT commit( m_frame ); BOARD_COMMIT commit( m_frame );
GRID_HELPER grid( m_toolMgr, m_frame->GetMagneticItemsSettings() ); GRID_HELPER grid( m_toolMgr, m_frame->GetMagneticItemsSettings() );
@ -731,27 +732,40 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
layer = Dwgs_User; layer = Dwgs_User;
// Init the new item attributes // Init the new item attributes
if( originalEvent.IsAction( &PCB_ACTIONS::drawAlignedDimension ) )
{
dimension = new ALIGNED_DIMENSION( m_board ); dimension = new ALIGNED_DIMENSION( m_board );
dimension->SetLayer( layer );
dimension->SetPrecision( boardSettings.m_DimensionPrecision );
dimension->Text().SetTextSize( boardSettings.GetTextSize( layer ) );
dimension->Text().SetTextThickness( boardSettings.GetTextThickness( layer ) );
dimension->Text().SetItalic( boardSettings.GetTextItalic( layer ) );
dimension->SetLineThickness( boardSettings.GetLineThickness( layer ) );
dimension->SetUnitsMode( boardSettings.m_DimensionUnitsMode ); dimension->SetUnitsMode( boardSettings.m_DimensionUnitsMode );
dimension->SetUnitsFormat( boardSettings.m_DimensionUnitsFormat ); dimension->SetUnitsFormat( boardSettings.m_DimensionUnitsFormat );
dimension->SetPrecision( boardSettings.m_DimensionPrecision ); dimension->SetPrecision( boardSettings.m_DimensionPrecision );
dimension->SetSuppressZeroes( boardSettings.m_DimensionSuppressZeroes ); dimension->SetSuppressZeroes( boardSettings.m_DimensionSuppressZeroes );
dimension->SetTextPositionMode( boardSettings.m_DimensionTextPosition ); dimension->SetTextPositionMode( boardSettings.m_DimensionTextPosition );
dimension->SetKeepTextAligned( boardSettings.m_DimensionKeepTextAligned ); dimension->SetKeepTextAligned( boardSettings.m_DimensionKeepTextAligned );
if( boardSettings.m_DimensionUnitsMode == DIM_UNITS_MODE::AUTOMATIC )
dimension->SetUnits( m_frame->GetUserUnits(), false );
}
else if( originalEvent.IsAction( &PCB_ACTIONS::drawLeader ) )
{
dimension = new LEADER( m_board );
dimension->Text().SetPosition( wxPoint( cursorPos ) );
}
else
{
wxFAIL_MSG( "Unhandled action in DRAWING_TOOL::DrawDimension" );
}
dimension->SetLayer( layer );
dimension->Text().SetTextSize( boardSettings.GetTextSize( layer ) );
dimension->Text().SetTextThickness( boardSettings.GetTextThickness( layer ) );
dimension->Text().SetItalic( boardSettings.GetTextItalic( layer ) );
dimension->SetLineThickness( boardSettings.GetLineThickness( layer ) );
dimension->SetArrowLength( boardSettings.m_DimensionArrowLength ); dimension->SetArrowLength( boardSettings.m_DimensionArrowLength );
dimension->SetExtensionOffset( boardSettings.m_DimensionExtensionOffset ); dimension->SetExtensionOffset( boardSettings.m_DimensionExtensionOffset );
dimension->SetStart( (wxPoint) cursorPos ); dimension->SetStart( (wxPoint) cursorPos );
dimension->SetEnd( (wxPoint) cursorPos ); dimension->SetEnd( (wxPoint) cursorPos );
if( boardSettings.m_DimensionUnitsMode == DIM_UNITS_MODE::AUTOMATIC )
dimension->SetUnits( m_frame->GetUserUnits(), false );
preview.Add( dimension ); preview.Add( dimension );
m_controls->SetAutoPan( true ); m_controls->SetAutoPan( true );
@ -768,12 +782,27 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
// Dimensions that have origin and end in the same spot are not valid // Dimensions that have origin and end in the same spot are not valid
if( dimension->GetStart() == dimension->GetEnd() ) if( dimension->GetStart() == dimension->GetEnd() )
--step; --step;
else if( dimension->Type() == PCB_DIM_LEADER_T )
dimension->SetText( wxT( "?" ) );
break; break;
case SET_HEIGHT: case SET_HEIGHT:
{ {
if( (wxPoint) cursorPos != dimension->GetPosition() ) if( dimension->Type() == PCB_DIM_LEADER_T )
{
assert( dimension->GetStart() != dimension->GetEnd() );
assert( dimension->GetLineThickness() > 0 );
preview.Remove( dimension );
commit.Add( dimension );
commit.Push( _( "Draw a leader" ) );
// Run the edit immediately to set the leader text
m_toolMgr->RunAction( PCB_ACTIONS::properties, true, dimension );
}
else if( (wxPoint) cursorPos != dimension->GetPosition() )
{ {
assert( dimension->GetStart() != dimension->GetEnd() ); assert( dimension->GetStart() != dimension->GetEnd() );
assert( dimension->GetLineThickness() > 0 ); assert( dimension->GetLineThickness() > 0 );
@ -810,12 +839,26 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
case SET_HEIGHT: case SET_HEIGHT:
{ {
if( dimension->Type() == PCB_DIM_ALIGNED_T )
{
ALIGNED_DIMENSION* aligned = static_cast<ALIGNED_DIMENSION*>( dimension );
// Calculating the direction of travel perpendicular to the selected axis // Calculating the direction of travel perpendicular to the selected axis
double angle = dimension->GetAngle() + ( M_PI / 2 ); double angle = aligned->GetAngle() + ( M_PI / 2 );
wxPoint delta( (wxPoint) cursorPos - dimension->GetEnd() ); wxPoint delta( (wxPoint) cursorPos - dimension->GetEnd() );
double height = ( delta.x * cos( angle ) ) + ( delta.y * sin( angle ) ); double height = ( delta.x * cos( angle ) ) + ( delta.y * sin( angle ) );
dimension->SetHeight( height ); aligned->SetHeight( height );
}
else
{
wxASSERT( dimension->Type() == PCB_DIM_LEADER_T );
VECTOR2I lineVector( cursorPos - dimension->GetEnd() );
dimension->Text().SetPosition( wxPoint( VECTOR2I( dimension->GetEnd() ) +
GetVectorSnapped45( lineVector ) ) );
dimension->Update();
}
} }
break; break;
} }
@ -2083,7 +2126,8 @@ void DRAWING_TOOL::setTransitions()
Go( &DRAWING_TOOL::DrawRectangle, PCB_ACTIONS::drawRectangle.MakeEvent() ); Go( &DRAWING_TOOL::DrawRectangle, PCB_ACTIONS::drawRectangle.MakeEvent() );
Go( &DRAWING_TOOL::DrawCircle, PCB_ACTIONS::drawCircle.MakeEvent() ); Go( &DRAWING_TOOL::DrawCircle, PCB_ACTIONS::drawCircle.MakeEvent() );
Go( &DRAWING_TOOL::DrawArc, PCB_ACTIONS::drawArc.MakeEvent() ); Go( &DRAWING_TOOL::DrawArc, PCB_ACTIONS::drawArc.MakeEvent() );
Go( &DRAWING_TOOL::DrawDimension, PCB_ACTIONS::drawDimension.MakeEvent() ); Go( &DRAWING_TOOL::DrawDimension, PCB_ACTIONS::drawAlignedDimension.MakeEvent() );
Go( &DRAWING_TOOL::DrawDimension, PCB_ACTIONS::drawLeader.MakeEvent() );
Go( &DRAWING_TOOL::DrawZone, PCB_ACTIONS::drawZone.MakeEvent() ); Go( &DRAWING_TOOL::DrawZone, PCB_ACTIONS::drawZone.MakeEvent() );
Go( &DRAWING_TOOL::DrawZone, PCB_ACTIONS::drawZoneKeepout.MakeEvent() ); Go( &DRAWING_TOOL::DrawZone, PCB_ACTIONS::drawZoneKeepout.MakeEvent() );
Go( &DRAWING_TOOL::DrawZone, PCB_ACTIONS::drawZoneCutout.MakeEvent() ); Go( &DRAWING_TOOL::DrawZone, PCB_ACTIONS::drawZoneCutout.MakeEvent() );

View File

@ -1420,7 +1420,8 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
case PCB_VIA_T: case PCB_VIA_T:
case PCB_ZONE_AREA_T: case PCB_ZONE_AREA_T:
case PCB_TARGET_T: case PCB_TARGET_T:
case PCB_DIMENSION_T: case PCB_DIM_ALIGNED_T:
case PCB_DIM_LEADER_T:
dupe_item = orig_item->Duplicate(); dupe_item = orig_item->Duplicate();
break; break;

View File

@ -546,7 +546,7 @@ void GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos, bo
break; break;
} }
case PCB_DIMENSION_T: case PCB_DIM_ALIGNED_T:
{ {
const ALIGNED_DIMENSION* dim = static_cast<const ALIGNED_DIMENSION*>( aItem ); const ALIGNED_DIMENSION* dim = static_cast<const ALIGNED_DIMENSION*>( aItem );
addAnchor( dim->GetCrossbarStart(), CORNER | SNAPPABLE, aItem ); addAnchor( dim->GetCrossbarStart(), CORNER | SNAPPABLE, aItem );
@ -556,6 +556,15 @@ void GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos, bo
break; break;
} }
case PCB_DIM_LEADER_T:
{
const LEADER* leader = static_cast<const LEADER*>( aItem );
addAnchor( leader->GetStart(), CORNER | SNAPPABLE, aItem );
addAnchor( leader->GetEnd(), CORNER | SNAPPABLE, aItem );
addAnchor( leader->Text().GetPosition(), CORNER | SNAPPABLE, aItem );
break;
}
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
case PCB_TEXT_T: case PCB_TEXT_T:
addAnchor( aItem->GetPosition(), ORIGIN, aItem ); addAnchor( aItem->GetPosition(), ORIGIN, aItem );

View File

@ -116,11 +116,16 @@ TOOL_ACTION PCB_ACTIONS::placeText( "pcbnew.InteractiveDrawing.text",
_( "Add Text" ), _( "Add a text item" ), _( "Add Text" ), _( "Add a text item" ),
text_xpm, AF_ACTIVATE ); text_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::drawDimension( "pcbnew.InteractiveDrawing.dimension", TOOL_ACTION PCB_ACTIONS::drawAlignedDimension( "pcbnew.InteractiveDrawing.alignedDimension",
AS_GLOBAL, AS_GLOBAL,
MD_SHIFT + MD_CTRL + 'H', LEGACY_HK_NAME( "Add Dimension" ), MD_SHIFT + MD_CTRL + 'H', LEGACY_HK_NAME( "Add Dimension" ),
_( "Add Dimension" ), _( "Add a dimension" ), _( "Add Aligned Dimension" ), _( "Add an aligned linear dimension" ),
add_dimension_xpm, AF_ACTIVATE ); add_aligned_dimension_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::drawLeader( "pcbnew.InteractiveDrawing.leader",
AS_GLOBAL, 0, "",
_( "Add Leader" ), _( "Add a leader dimension" ),
add_leader_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::drawZone( "pcbnew.InteractiveDrawing.zone", TOOL_ACTION PCB_ACTIONS::drawZone( "pcbnew.InteractiveDrawing.zone",
AS_GLOBAL, AS_GLOBAL,

View File

@ -139,7 +139,8 @@ public:
static TOOL_ACTION drawCircle; static TOOL_ACTION drawCircle;
static TOOL_ACTION drawArc; static TOOL_ACTION drawArc;
static TOOL_ACTION placeText; static TOOL_ACTION placeText;
static TOOL_ACTION drawDimension; static TOOL_ACTION drawAlignedDimension;
static TOOL_ACTION drawLeader;
static TOOL_ACTION drawZone; static TOOL_ACTION drawZone;
static TOOL_ACTION drawVia; static TOOL_ACTION drawVia;
static TOOL_ACTION drawZoneKeepout; static TOOL_ACTION drawZoneKeepout;

View File

@ -149,7 +149,7 @@ int PCB_VIEWER_TOOLS::GraphicOutlines( const TOOL_EVENT& aEvent )
{ {
KICAD_T t = item->Type(); KICAD_T t = item->Type();
if( t == PCB_LINE_T || t == PCB_DIMENSION_T || t == PCB_TARGET_T ) if( t == PCB_LINE_T || BaseType( t ) == PCB_DIMENSION_T || t == PCB_TARGET_T )
view()->Update( item, KIGFX::GEOMETRY ); view()->Update( item, KIGFX::GEOMETRY );
} }
@ -182,7 +182,7 @@ int PCB_VIEWER_TOOLS::TextOutlines( const TOOL_EVENT& aEvent )
{ {
KICAD_T t = item->Type(); KICAD_T t = item->Type();
if( t == PCB_TEXT_T || t == PCB_DIMENSION_T ) if( t == PCB_TEXT_T || BaseType( t ) == PCB_DIMENSION_T )
view()->Update( item, KIGFX::GEOMETRY ); view()->Update( item, KIGFX::GEOMETRY );
} }

View File

@ -76,11 +76,11 @@ enum BEZIER_CURVE_POINTS
enum DIMENSION_POINTS enum DIMENSION_POINTS
{ {
DIM_CROSSBARSTART,
DIM_CROSSBAREND,
DIM_START, DIM_START,
DIM_END, DIM_END,
DIM_TEXT DIM_TEXT,
DIM_CROSSBARSTART,
DIM_CROSSBAREND,
}; };
class EDIT_POINTS_FACTORY class EDIT_POINTS_FACTORY
@ -244,7 +244,7 @@ public:
} }
break; break;
case PCB_DIMENSION_T: case PCB_DIM_ALIGNED_T:
{ {
const ALIGNED_DIMENSION* dimension = static_cast<const ALIGNED_DIMENSION*>( aItem ); const ALIGNED_DIMENSION* dimension = static_cast<const ALIGNED_DIMENSION*>( aItem );
@ -262,6 +262,17 @@ public:
} }
break; break;
case PCB_DIM_LEADER_T:
{
const LEADER* dimension = static_cast<const LEADER*>( aItem );
points->AddPoint( dimension->GetStart() );
points->AddPoint( dimension->GetEnd() );
points->AddPoint( dimension->Text().GetPosition() );
break;
}
default: default:
points.reset(); points.reset();
break; break;
@ -377,7 +388,7 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
BOARD_COMMIT commit( editFrame ); BOARD_COMMIT commit( editFrame );
LSET snapLayers = item->GetLayerSet(); LSET snapLayers = item->GetLayerSet();
if( item->Type() == PCB_DIMENSION_T ) if( BaseType( item->Type() ) == PCB_DIMENSION_T )
snapLayers = LSET::AllLayersMask(); snapLayers = LSET::AllLayersMask();
// Main loop: keep receiving events // Main loop: keep receiving events
@ -1252,7 +1263,7 @@ void POINT_EDITOR::updateItem() const
break; break;
} }
case PCB_DIMENSION_T: case PCB_DIM_ALIGNED_T:
{ {
ALIGNED_DIMENSION* dimension = static_cast<ALIGNED_DIMENSION*>( item ); ALIGNED_DIMENSION* dimension = static_cast<ALIGNED_DIMENSION*>( item );
@ -1310,6 +1321,33 @@ void POINT_EDITOR::updateItem() const
break; break;
} }
case PCB_DIM_LEADER_T:
{
LEADER* dimension = static_cast<LEADER*>( item );
if( isModified( m_editPoints->Point( DIM_START ) ) )
{
dimension->SetStart( wxPoint( m_editedPoint->GetPosition().x,
m_editedPoint->GetPosition().y ) );
}
else if( isModified( m_editPoints->Point( DIM_END ) ) )
{
wxPoint newPoint( m_editedPoint->GetPosition().x, m_editedPoint->GetPosition().y );
wxPoint delta = newPoint - dimension->GetEnd();
dimension->SetEnd( newPoint );
dimension->Text().SetPosition( dimension->Text().GetPosition() + delta );
}
else if( isModified( m_editPoints->Point( DIM_TEXT ) ) )
{
dimension->Text().SetPosition( wxPoint( m_editedPoint->GetPosition() ) );
}
dimension->Update();
break;
}
default: default:
break; break;
} }
@ -1527,12 +1565,22 @@ void POINT_EDITOR::updatePoints()
break; break;
} }
case PCB_DIMENSION_T: case PCB_DIM_ALIGNED_T:
{ {
const ALIGNED_DIMENSION* dimension = static_cast<const ALIGNED_DIMENSION*>( item ); const ALIGNED_DIMENSION* dimension = static_cast<const ALIGNED_DIMENSION*>( item );
m_editPoints->Point( DIM_START ).SetPosition( dimension->GetStart() );
m_editPoints->Point( DIM_END ).SetPosition( dimension->GetEnd() );
m_editPoints->Point( DIM_TEXT ).SetPosition( dimension->Text().GetPosition() );
m_editPoints->Point( DIM_CROSSBARSTART ).SetPosition( dimension->GetCrossbarStart() ); m_editPoints->Point( DIM_CROSSBARSTART ).SetPosition( dimension->GetCrossbarStart() );
m_editPoints->Point( DIM_CROSSBAREND ).SetPosition( dimension->GetCrossbarEnd() ); m_editPoints->Point( DIM_CROSSBAREND ).SetPosition( dimension->GetCrossbarEnd() );
break;
}
case PCB_DIM_LEADER_T:
{
const LEADER* dimension = static_cast<const LEADER*>( item );
m_editPoints->Point( DIM_START ).SetPosition( dimension->GetStart() ); m_editPoints->Point( DIM_START ).SetPosition( dimension->GetStart() );
m_editPoints->Point( DIM_END ).SetPosition( dimension->GetEnd() ); m_editPoints->Point( DIM_END ).SetPosition( dimension->GetEnd() );
m_editPoints->Point( DIM_TEXT ).SetPosition( dimension->Text().GetPosition() ); m_editPoints->Point( DIM_TEXT ).SetPosition( dimension->Text().GetPosition() );
@ -1633,7 +1681,7 @@ EDIT_POINT POINT_EDITOR::get45DegConstrainer() const
break; break;
} }
case PCB_DIMENSION_T: case PCB_DIM_ALIGNED_T:
{ {
// Constraint for crossbar // Constraint for crossbar
if( isModified( m_editPoints->Point( DIM_START ) ) ) if( isModified( m_editPoints->Point( DIM_START ) ) )

View File

@ -1377,7 +1377,8 @@ static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem, const BOARD& aBoard
} }
case PCB_LINE_T: case PCB_LINE_T:
case PCB_TARGET_T: case PCB_TARGET_T:
case PCB_DIMENSION_T: case PCB_DIM_ALIGNED_T:
case PCB_DIM_LEADER_T:
{ {
if( layer == Edge_Cuts ) if( layer == Edge_Cuts )
include = aFilterOptions.includeBoardOutlineLayer; include = aFilterOptions.includeBoardOutlineLayer;
@ -1512,7 +1513,8 @@ bool SELECTION_TOOL::itemPassesFilter( BOARD_ITEM* aItem )
break; break;
case PCB_DIMENSION_T: case PCB_DIM_ALIGNED_T:
case PCB_DIM_LEADER_T:
if( !m_filter.dimensions ) if( !m_filter.dimensions )
return false; return false;