ADDED: Center marker dimension type

This commit is contained in:
Jon Evans 2020-09-16 20:54:58 -04:00
parent 5109857883
commit e9b627bfd8
33 changed files with 806 additions and 54 deletions

View File

@ -629,6 +629,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
break;
case PCB_DIM_ALIGNED_T:
case PCB_DIM_CENTER_T:
case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T:
AddShapeWithClearanceToContainer( (DIMENSION*) item,
layerContainer,
@ -913,6 +915,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
break;
case PCB_DIM_ALIGNED_T:
case PCB_DIM_CENTER_T:
case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T:
AddShapeWithClearanceToContainer( (DIMENSION*) item,
layerContainer,

View File

@ -116,6 +116,7 @@ set( BMAPS_MID
add_board
add_bus2bus
add_bus
add_center_dimension
add_circle
add_component
add_corner

View File

@ -0,0 +1,29 @@
/* 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, 0x00, 0xbd, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0x63, 0x60, 0x18, 0xac, 0x40,
0x53, 0x53, 0x53, 0x12, 0x84, 0x69, 0x6e, 0x91, 0x86, 0x86, 0xc6, 0x0e, 0x10, 0xa6, 0x87, 0x45,
0x07, 0x41, 0x78, 0xd4, 0xa2, 0x51, 0x8b, 0x86, 0x91, 0x45, 0xb9, 0xb9, 0xb9, 0xec, 0x29, 0xd9,
0xa9, 0x93, 0x12, 0xd3, 0x93, 0x7e, 0x83, 0x70, 0x72, 0x4e, 0xea, 0x04, 0x90, 0x18, 0x2e, 0x75,
0x29, 0x59, 0x29, 0x1f, 0x40, 0x18, 0x97, 0x3a, 0x9c, 0x00, 0xa4, 0x39, 0xac, 0x2e, 0xea, 0x9b,
0xe1, 0x0e, 0xc7, 0xff, 0x06, 0x3b, 0x1c, 0xfe, 0x87, 0xd5, 0xc5, 0x7c, 0x05, 0x19, 0x42, 0xb2,
0x3a, 0x75, 0x75, 0xf5, 0x7c, 0x60, 0x90, 0xec, 0xc6, 0x85, 0x41, 0xbe, 0x00, 0x69, 0xd4, 0x3a,
0x64, 0x03, 0xc6, 0x20, 0x83, 0x12, 0x33, 0x92, 0x7e, 0x13, 0xa3, 0x2e, 0x25, 0x3b, 0xe5, 0x3d,
0xfd, 0x2d, 0x22, 0x04, 0x40, 0xde, 0x0f, 0xaf, 0x8d, 0xfe, 0x06, 0x32, 0x04, 0xa4, 0x39, 0xac,
0x16, 0x18, 0x24, 0x59, 0xa9, 0x7d, 0xe4, 0xaa, 0xc3, 0x9b, 0x18, 0x40, 0x86, 0x24, 0x01, 0x7d,
0x01, 0xc2, 0x20, 0xcd, 0xa1, 0xa1, 0xa1, 0x6c, 0xb8, 0xd4, 0x81, 0x7c, 0x01, 0xc2, 0xb8, 0xd4,
0x8d, 0x66, 0xd8, 0x51, 0x8b, 0x46, 0xb8, 0x45, 0xf4, 0x69, 0x9c, 0xd0, 0xad, 0xb9, 0x45, 0x2e,
0x00, 0x00, 0x24, 0x51, 0xd2, 0xad, 0xa0, 0x23, 0x80, 0x52, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45,
0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
};
const BITMAP_OPAQUE add_center_dimension_xpm[1] = {{ png, sizeof( png ), "add_center_dimension_xpm" }};
//EOF

View File

@ -34,6 +34,7 @@ EXTERN_BITMAP( add_arc_xpm )
EXTERN_BITMAP( add_board_xpm )
EXTERN_BITMAP( add_bus2bus_xpm )
EXTERN_BITMAP( add_bus_xpm )
EXTERN_BITMAP( add_center_dimension_xpm )
EXTERN_BITMAP( add_circle_xpm )
EXTERN_BITMAP( add_component_xpm )
EXTERN_BITMAP( add_corner_xpm )

View File

@ -0,0 +1,266 @@
<?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_center_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></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="16.236259"
inkscape:cx="-11.454916"
inkscape:cy="17.560173"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg2"
showguides="true"
inkscape:guide-bbox="true">
<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:guide
position="0,13"
orientation="0,1"
id="guide942"
inkscape:locked="false" />
<sodipodi:guide
position="13,26"
orientation="1,0"
id="guide944"
inkscape:locked="false" />
</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
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 23,13 H 13"
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>
<rect
rx="2.5"
ry="2.5"
y="10.5"
x="20.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" />
<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 13,23.5 V 13"
id="path3006-3"
inkscape:connector-curvature="0"
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 13,13 H 3"
id="path3006-7"
inkscape:connector-curvature="0"
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 13,13 V 2.5"
id="path3006-3-5"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<rect
rx="2.5"
ry="2.5"
y="10.5"
x="10.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" />
</svg>

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

@ -100,6 +100,8 @@ enum KICAD_T
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_DIM_CENTER_T, ///< class CENTER_DIMENSION, a center point marking (graphic item)
PCB_DIM_ORTHOGONAL_T, ///< class ORTHOGONAL_DIMENSION, a linear dimension constrained to x/y
PCB_TARGET_T, ///< class PCB_TARGET, a target (graphic item)
PCB_ZONE_AREA_T, ///< class ZONE_CONTAINER, a zone area
PCB_ITEM_LIST_T, ///< class BOARD_ITEM_LIST, a list of board items
@ -256,6 +258,8 @@ constexpr KICAD_T BaseType( const KICAD_T aType )
return PCB_LOCATE_HOLE_T;
case PCB_DIM_ALIGNED_T:
case PCB_DIM_CENTER_T:
case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T:
return PCB_DIMENSION_T;

View File

@ -114,6 +114,8 @@ void ARRAY_CREATOR::Invoke()
case PCB_ZONE_AREA_T:
case PCB_TARGET_T:
case PCB_DIM_ALIGNED_T:
case PCB_DIM_CENTER_T:
case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T:
new_item = item->Duplicate();
break;

View File

@ -218,6 +218,8 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
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_DIM_ALIGNED_T: // a dimension (graphic item)
case PCB_DIM_CENTER_T:
case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T: // a leader dimension
case PCB_TARGET_T: // a target (graphic item)
case PCB_MARKER_T: // a marker used to show something

View File

@ -581,6 +581,8 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode )
break;
case PCB_DIM_ALIGNED_T:
case PCB_DIM_CENTER_T:
case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T:
case PCB_LINE_T:
case PCB_TEXT_T:
@ -669,6 +671,8 @@ void BOARD::Remove( BOARD_ITEM* aBoardItem )
break;
case PCB_DIM_ALIGNED_T:
case PCB_DIM_CENTER_T:
case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T:
case PCB_LINE_T:
case PCB_TEXT_T:
@ -1007,6 +1011,8 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s
case PCB_LINE_T:
case PCB_TEXT_T:
case PCB_DIM_ALIGNED_T:
case PCB_DIM_CENTER_T:
case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T:
case PCB_TARGET_T:
result = IterateForward<BOARD_ITEM*>( m_drawings, inspector, testData, p );
@ -1019,6 +1025,8 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s
case PCB_LINE_T:
case PCB_TEXT_T:
case PCB_DIM_ALIGNED_T:
case PCB_DIM_CENTER_T:
case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T:
case PCB_TARGET_T:
continue;

View File

@ -336,6 +336,7 @@ bool DIMENSION::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
arect.Inflate( aAccuracy );
EDA_RECT rect = GetBoundingBox();
if( aAccuracy )
rect.Inflate( aAccuracy );
@ -360,6 +361,8 @@ const EDA_RECT DIMENSION::GetBoundingBox() const
for( const std::shared_ptr<SHAPE>& shape : GetShapes() )
{
BOX2I shapeBox = shape->BBox();
shapeBox.Inflate( m_lineThickness / 2 );
xmin = std::min( xmin, shapeBox.GetOrigin().x );
xmax = std::max( xmax, shapeBox.GetEnd().x );
ymin = std::min( ymin, shapeBox.GetOrigin().y );
@ -716,3 +719,70 @@ void LEADER::updateGeometry()
if( endpoint )
m_shapes.emplace_back( new SHAPE_SEGMENT( m_end, *endpoint ) );
}
CENTER_DIMENSION::CENTER_DIMENSION( BOARD_ITEM* aParent ) :
DIMENSION( aParent, PCB_DIM_CENTER_T )
{
m_unitsFormat = DIM_UNITS_FORMAT::NO_SUFFIX;
m_overrideTextEnabled = true;
}
EDA_ITEM* CENTER_DIMENSION::Clone() const
{
return new CENTER_DIMENSION( *this );
}
void CENTER_DIMENSION::SwapData( BOARD_ITEM* aImage )
{
assert( aImage->Type() == PCB_DIM_CENTER_T );
std::swap( *static_cast<CENTER_DIMENSION*>( this ), *static_cast<CENTER_DIMENSION*>( aImage ) );
}
BITMAP_DEF CENTER_DIMENSION::GetMenuImage() const
{
return add_center_dimension_xpm;
}
const EDA_RECT CENTER_DIMENSION::GetBoundingBox() const
{
int halfWidth = VECTOR2I( m_end - m_start ).x + ( m_lineThickness / 2.0 );
EDA_RECT bBox;
bBox.SetX( m_start.x - halfWidth );
bBox.SetY( m_start.y - halfWidth );
bBox.SetWidth( halfWidth * 2 );
bBox.SetHeight( halfWidth * 2 );
bBox.Normalize();
return bBox;
}
const BOX2I CENTER_DIMENSION::ViewBBox() const
{
return BOX2I( VECTOR2I( GetBoundingBox().GetPosition() ),
VECTOR2I( GetBoundingBox().GetSize() ) );
}
void CENTER_DIMENSION::updateGeometry()
{
m_shapes.clear();
VECTOR2I center( m_start );
VECTOR2I arm( m_end - m_start );
m_shapes.emplace_back( new SHAPE_SEGMENT( center - arm, center + arm ) );
arm = arm.Rotate( DEG2RAD( 90 ) );
m_shapes.emplace_back( new SHAPE_SEGMENT( center - arm, center + arm ) );
}

View File

@ -249,7 +249,7 @@ public:
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
virtual const BOX2I ViewBBox() const override;
const BOX2I ViewBBox() const override;
#if defined(DEBUG)
virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
@ -455,4 +455,41 @@ protected:
void updateGeometry() override;
};
/**
* Marks the center of a circle or arc with a cross shape
* The size and orientation of the cross is adjustable.
* m_start always marks the center being measured; m_end marks the end of one leg of the cross.
*/
class CENTER_DIMENSION : public DIMENSION
{
public:
CENTER_DIMENSION( BOARD_ITEM* aParent );
static inline bool ClassOf( const EDA_ITEM* aItem )
{
return aItem && PCB_DIM_CENTER_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( "CENTER_DIMENSION" );
}
const EDA_RECT GetBoundingBox() const override;
const BOX2I ViewBBox() const override;
protected:
void updateGeometry() override;
};
#endif // DIMENSION_H_

View File

@ -50,6 +50,8 @@ const KICAD_T GENERAL_COLLECTOR::AllBoardItems[] = {
PCB_TEXT_T, // in m_drawings
PCB_LINE_T, // in m_drawings
PCB_DIM_ALIGNED_T, // in m_drawings
PCB_DIM_CENTER_T, // in m_drawings
PCB_DIM_ORTHOGONAL_T, // in m_drawings
PCB_DIM_LEADER_T, // in m_drawings
PCB_TARGET_T, // in m_drawings
PCB_VIA_T, // in m_tracks
@ -311,6 +313,8 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
break;
case PCB_DIM_ALIGNED_T:
case PCB_DIM_CENTER_T:
case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T:
break;

View File

@ -57,6 +57,7 @@ DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES( PCB_BASE_EDIT_FRAME* a
case PCB_DIM_LEADER_T:
// Hide the main format controls and keep the leader controls shown
m_sizerFormat->GetStaticBox()->Hide();
m_sizerCenter->GetStaticBox()->Hide();
m_cbLayerActual = m_cbLeaderLayer;
m_txtValueActual = m_txtLeaderValue;
@ -66,8 +67,25 @@ DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES( PCB_BASE_EDIT_FRAME* a
m_cbTextPositionMode->Hide();
break;
case PCB_DIM_CENTER_T:
m_sizerLeader->GetStaticBox()->Hide();
m_sizerFormat->GetStaticBox()->Hide();
m_sizerText->GetStaticBox()->Hide();
m_lblArrowLength->Hide();
m_txtArrowLength->Hide();
m_lblArrowLengthUnits->Hide();
m_lblExtensionOffset->Hide();
m_txtExtensionOffset->Hide();
m_lblExtensionOffsetUnits->Hide();
m_cbLayerActual = m_cbCenterLayer;
break;
default:
m_sizerLeader->GetStaticBox()->Hide();
m_sizerCenter->GetStaticBox()->Hide();
break;
}

View File

@ -61,6 +61,26 @@ DIALOG_DIMENSION_PROPERTIES_BASE::DIALOG_DIMENSION_PROPERTIES_BASE( wxWindow* pa
m_mainSizer->Add( m_sizerLeader, 0, wxALL|wxEXPAND, 5 );
m_sizerCenter = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Dimension Format") ), wxVERTICAL );
wxGridBagSizer* gbSizerCenter;
gbSizerCenter = new wxGridBagSizer( 0, 0 );
gbSizerCenter->SetFlexibleDirection( wxBOTH );
gbSizerCenter->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_lblCenterLayer = new wxStaticText( m_sizerCenter->GetStaticBox(), wxID_ANY, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblCenterLayer->Wrap( -1 );
gbSizerCenter->Add( m_lblCenterLayer, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_cbCenterLayer = new PCB_LAYER_BOX_SELECTOR( m_sizerCenter->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
gbSizerCenter->Add( m_cbCenterLayer, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
m_sizerCenter->Add( gbSizerCenter, 1, wxBOTTOM|wxEXPAND, 5 );
m_mainSizer->Add( m_sizerCenter, 1, wxALL|wxEXPAND, 5 );
m_sizerFormat = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Dimension Format") ), wxVERTICAL );
wxGridBagSizer* gbSizerFormat;
@ -184,125 +204,124 @@ DIALOG_DIMENSION_PROPERTIES_BASE::DIALOG_DIMENSION_PROPERTIES_BASE( wxWindow* pa
m_mainSizer->Add( m_sizerFormat, 1, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* sbSizerText;
sbSizerText = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Dimension Text") ), wxVERTICAL );
m_sizerText = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Dimension Text") ), wxVERTICAL );
wxGridBagSizer* gbSizerText;
gbSizerText = new wxGridBagSizer( 0, 0 );
gbSizerText->SetFlexibleDirection( wxHORIZONTAL );
gbSizerText->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_lblTextWidth = new wxStaticText( sbSizerText->GetStaticBox(), wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblTextWidth = new wxStaticText( m_sizerText->GetStaticBox(), wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblTextWidth->Wrap( -1 );
m_lblTextWidth->SetToolTip( _("Text width") );
gbSizerText->Add( m_lblTextWidth, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_txtTextWidth = new wxTextCtrl( sbSizerText->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
m_txtTextWidth = new wxTextCtrl( m_sizerText->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
gbSizerText->Add( m_txtTextWidth, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
m_lblTextWidthUnits = new wxStaticText( sbSizerText->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblTextWidthUnits = new wxStaticText( m_sizerText->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblTextWidthUnits->Wrap( -1 );
gbSizerText->Add( m_lblTextWidthUnits, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
gbSizerText->Add( 20, 0, wxGBPosition( 0, 3 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
m_lblTextPosX = new wxStaticText( sbSizerText->GetStaticBox(), wxID_ANY, _("Position X:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblTextPosX = new wxStaticText( m_sizerText->GetStaticBox(), wxID_ANY, _("Position X:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblTextPosX->Wrap( -1 );
m_lblTextPosX->SetToolTip( _("Text pos X") );
gbSizerText->Add( m_lblTextPosX, wxGBPosition( 0, 4 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_txtTextPosX = new wxTextCtrl( sbSizerText->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
m_txtTextPosX = new wxTextCtrl( m_sizerText->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
gbSizerText->Add( m_txtTextPosX, wxGBPosition( 0, 5 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
m_lblTextPosXUnits = new wxStaticText( sbSizerText->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblTextPosXUnits = new wxStaticText( m_sizerText->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblTextPosXUnits->Wrap( -1 );
gbSizerText->Add( m_lblTextPosXUnits, wxGBPosition( 0, 6 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL, 5 );
m_lblTextHeight = new wxStaticText( sbSizerText->GetStaticBox(), wxID_ANY, _("Height:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblTextHeight = new wxStaticText( m_sizerText->GetStaticBox(), wxID_ANY, _("Height:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblTextHeight->Wrap( -1 );
m_lblTextHeight->SetToolTip( _("Text height") );
gbSizerText->Add( m_lblTextHeight, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_txtTextHeight = new wxTextCtrl( sbSizerText->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
m_txtTextHeight = new wxTextCtrl( m_sizerText->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
gbSizerText->Add( m_txtTextHeight, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
m_lblTextHeightUnits = new wxStaticText( sbSizerText->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblTextHeightUnits = new wxStaticText( m_sizerText->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblTextHeightUnits->Wrap( -1 );
gbSizerText->Add( m_lblTextHeightUnits, wxGBPosition( 1, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_lblTextPosY = new wxStaticText( sbSizerText->GetStaticBox(), wxID_ANY, _("Position Y:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblTextPosY = new wxStaticText( m_sizerText->GetStaticBox(), wxID_ANY, _("Position Y:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblTextPosY->Wrap( -1 );
m_lblTextPosY->SetToolTip( _("Text pos Y") );
gbSizerText->Add( m_lblTextPosY, wxGBPosition( 1, 4 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_txtTextPosY = new wxTextCtrl( sbSizerText->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
m_txtTextPosY = new wxTextCtrl( m_sizerText->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
gbSizerText->Add( m_txtTextPosY, wxGBPosition( 1, 5 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
m_lblTextPosYUnits = new wxStaticText( sbSizerText->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblTextPosYUnits = new wxStaticText( m_sizerText->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblTextPosYUnits->Wrap( -1 );
gbSizerText->Add( m_lblTextPosYUnits, wxGBPosition( 1, 6 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL, 5 );
m_lblTextThickness = new wxStaticText( sbSizerText->GetStaticBox(), wxID_ANY, _("Thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblTextThickness = new wxStaticText( m_sizerText->GetStaticBox(), wxID_ANY, _("Thickness:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblTextThickness->Wrap( -1 );
m_lblTextThickness->SetToolTip( _("Text thickness") );
gbSizerText->Add( m_lblTextThickness, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_txtTextThickness = new wxTextCtrl( sbSizerText->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
m_txtTextThickness = new wxTextCtrl( m_sizerText->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
gbSizerText->Add( m_txtTextThickness, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
m_lblTextThicknessUnits = new wxStaticText( sbSizerText->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblTextThicknessUnits = new wxStaticText( m_sizerText->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblTextThicknessUnits->Wrap( -1 );
gbSizerText->Add( m_lblTextThicknessUnits, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_lblTextOrientation = new wxStaticText( sbSizerText->GetStaticBox(), wxID_ANY, _("Orientation:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblTextOrientation = new wxStaticText( m_sizerText->GetStaticBox(), wxID_ANY, _("Orientation:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblTextOrientation->Wrap( -1 );
m_lblTextOrientation->SetToolTip( _("Text orientation") );
gbSizerText->Add( m_lblTextOrientation, wxGBPosition( 3, 4 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_cbTextOrientation = new wxComboBox( sbSizerText->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
m_cbTextOrientation = new wxComboBox( m_sizerText->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
m_cbTextOrientation->Append( _("0.0") );
m_cbTextOrientation->Append( _("90.0") );
m_cbTextOrientation->Append( _("-90.0") );
m_cbTextOrientation->Append( _("180.0") );
gbSizerText->Add( m_cbTextOrientation, wxGBPosition( 3, 5 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
m_cbItalic = new wxCheckBox( sbSizerText->GetStaticBox(), wxID_ANY, _("Italic"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbItalic = new wxCheckBox( m_sizerText->GetStaticBox(), wxID_ANY, _("Italic"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizerText->Add( m_cbItalic, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_cbKeepAligned = new wxCheckBox( sbSizerText->GetStaticBox(), wxID_ANY, _("Keep aligned with dimension"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbKeepAligned = new wxCheckBox( m_sizerText->GetStaticBox(), wxID_ANY, _("Keep aligned with dimension"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbKeepAligned->SetToolTip( _("Automatically set the text orientation to match the dimension lines") );
gbSizerText->Add( m_cbKeepAligned, wxGBPosition( 4, 4 ), wxGBSpan( 1, 3 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_cbMirrored = new wxCheckBox( sbSizerText->GetStaticBox(), wxID_ANY, _("Mirrored"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbMirrored = new wxCheckBox( m_sizerText->GetStaticBox(), wxID_ANY, _("Mirrored"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbMirrored->SetToolTip( _("Mirror text") );
gbSizerText->Add( m_cbMirrored, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_lblJustification = new wxStaticText( sbSizerText->GetStaticBox(), wxID_ANY, _("Justification:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblJustification = new wxStaticText( m_sizerText->GetStaticBox(), wxID_ANY, _("Justification:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblJustification->Wrap( -1 );
gbSizerText->Add( m_lblJustification, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
wxString m_cbJustificationChoices[] = { _("Left"), _("Center"), _("Right") };
int m_cbJustificationNChoices = sizeof( m_cbJustificationChoices ) / sizeof( wxString );
m_cbJustification = new wxChoice( sbSizerText->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cbJustificationNChoices, m_cbJustificationChoices, 0 );
m_cbJustification = new wxChoice( m_sizerText->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cbJustificationNChoices, m_cbJustificationChoices, 0 );
m_cbJustification->SetSelection( 0 );
gbSizerText->Add( m_cbJustification, wxGBPosition( 5, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
m_lblTextPositionMode = new wxStaticText( sbSizerText->GetStaticBox(), wxID_ANY, _("Position mode:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblTextPositionMode = new wxStaticText( m_sizerText->GetStaticBox(), wxID_ANY, _("Position mode:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblTextPositionMode->Wrap( -1 );
gbSizerText->Add( m_lblTextPositionMode, wxGBPosition( 2, 4 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
wxString m_cbTextPositionModeChoices[] = { _("Outside"), _("Inline"), _("Manual") };
int m_cbTextPositionModeNChoices = sizeof( m_cbTextPositionModeChoices ) / sizeof( wxString );
m_cbTextPositionMode = new wxChoice( sbSizerText->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cbTextPositionModeNChoices, m_cbTextPositionModeChoices, 0 );
m_cbTextPositionMode = new wxChoice( m_sizerText->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cbTextPositionModeNChoices, m_cbTextPositionModeChoices, 0 );
m_cbTextPositionMode->SetSelection( 0 );
m_cbTextPositionMode->SetToolTip( _("Choose how to position the text relative to the dimension line") );
@ -313,10 +332,10 @@ DIALOG_DIMENSION_PROPERTIES_BASE::DIALOG_DIMENSION_PROPERTIES_BASE( wxWindow* pa
gbSizerText->AddGrowableCol( 3 );
gbSizerText->AddGrowableCol( 5 );
sbSizerText->Add( gbSizerText, 0, wxBOTTOM|wxEXPAND, 5 );
m_sizerText->Add( gbSizerText, 0, wxBOTTOM|wxEXPAND, 5 );
m_mainSizer->Add( sbSizerText, 0, wxALL|wxEXPAND, 5 );
m_mainSizer->Add( m_sizerText, 0, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* sbSizerLine;
sbSizerLine = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Dimension Line") ), wxVERTICAL );

View File

@ -45,7 +45,7 @@
<property name="minimum_size">-1,-1</property>
<property name="name">DIALOG_DIMENSION_PROPERTIES_BASE</property>
<property name="pos"></property>
<property name="size">654,600</property>
<property name="size">654,500</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Dimension Properties</property>
@ -497,6 +497,169 @@
</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_sizerCenter</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"></property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
<property name="name">gbSizerCenter</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">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_lblCenterLayer</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="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_cbCenterLayer</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>
@ -1730,10 +1893,10 @@
<property name="id">wxID_ANY</property>
<property name="label">Dimension Text</property>
<property name="minimum_size"></property>
<property name="name">sbSizerText</property>
<property name="name">m_sizerText</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<property name="permission">protected</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxEXPAND</property>

View File

@ -50,6 +50,9 @@ class DIALOG_DIMENSION_PROPERTIES_BASE : public DIALOG_SHIM
wxChoice* m_cbTextFrame;
wxStaticText* m_lblLeaderLayer;
PCB_LAYER_BOX_SELECTOR* m_cbLeaderLayer;
wxStaticBoxSizer* m_sizerCenter;
wxStaticText* m_lblCenterLayer;
PCB_LAYER_BOX_SELECTOR* m_cbCenterLayer;
wxStaticBoxSizer* m_sizerFormat;
wxStaticText* m_lblValue;
wxTextCtrl* m_txtValue;
@ -69,6 +72,7 @@ class DIALOG_DIMENSION_PROPERTIES_BASE : public DIALOG_SHIM
PCB_LAYER_BOX_SELECTOR* m_cbLayer;
wxStaticText* m_lblPreview;
wxStaticText* m_staticTextPreview;
wxStaticBoxSizer* m_sizerText;
wxStaticText* m_lblTextWidth;
wxTextCtrl* m_txtTextWidth;
wxStaticText* m_lblTextWidthUnits;
@ -115,7 +119,7 @@ class DIALOG_DIMENSION_PROPERTIES_BASE : public DIALOG_SHIM
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,600 ), 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,500 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DIALOG_DIMENSION_PROPERTIES_BASE();
};

View File

@ -143,6 +143,8 @@ void PCB_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
break;
case PCB_DIM_ALIGNED_T:
case PCB_DIM_CENTER_T:
case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T:
ShowDimensionPropertyDialog( static_cast<DIMENSION*>( aItem ) );
break;

View File

@ -203,6 +203,8 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_
break;
case PCB_DIM_ALIGNED_T:
case PCB_DIM_CENTER_T:
case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T:
case PCB_TARGET_T:
case PCB_MARKER_T: // do not draw

View File

@ -399,6 +399,8 @@ void PCB_IO::Format( BOARD_ITEM* aItem, int aNestLevel ) const
break;
case PCB_DIM_ALIGNED_T:
case PCB_DIM_CENTER_T:
case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T:
format( static_cast<DIMENSION*>( aItem ), aNestLevel );
break;
@ -663,6 +665,7 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
void PCB_IO::format( DIMENSION* aDimension, int aNestLevel ) const
{
ALIGNED_DIMENSION* aligned = dynamic_cast<ALIGNED_DIMENSION*>( aDimension );
CENTER_DIMENSION* center = dynamic_cast<CENTER_DIMENSION*>( aDimension );
LEADER* leader = dynamic_cast<LEADER*>( aDimension );
m_out->Print( aNestLevel, "(dimension" );
@ -671,6 +674,8 @@ void PCB_IO::format( DIMENSION* aDimension, int aNestLevel ) const
m_out->Print( 0, " (type aligned)" );
else if( aDimension->Type() == PCB_DIM_LEADER_T )
m_out->Print( 0, " (type leader)" );
else if( aDimension->Type() == PCB_DIM_CENTER_T )
m_out->Print( 0, " (type center)" );
else
wxFAIL_MSG( wxT( "Cannot format unknown dimension type!" ) );
@ -690,27 +695,30 @@ void PCB_IO::format( DIMENSION* aDimension, int aNestLevel ) const
m_out->Print( aNestLevel+1, "(height %s)\n",
FormatInternalUnits( aligned->GetHeight() ).c_str() );
Format( &aDimension->Text(), aNestLevel+1 );
if( !center )
{
Format( &aDimension->Text(), aNestLevel + 1 );
m_out->Print( aNestLevel+1, "(format" );
m_out->Print( aNestLevel + 1, "(format" );
if( !aDimension->GetPrefix().IsEmpty() )
m_out->Print( 0, " (prefix \"%s\")", TO_UTF8( aDimension->GetPrefix() ) );
if( !aDimension->GetPrefix().IsEmpty() )
m_out->Print( 0, " (prefix \"%s\")", TO_UTF8( aDimension->GetPrefix() ) );
if( !aDimension->GetSuffix().IsEmpty() )
m_out->Print( 0, " (suffix \"%s\")", TO_UTF8( aDimension->GetSuffix() ) );
if( !aDimension->GetSuffix().IsEmpty() )
m_out->Print( 0, " (suffix \"%s\")", TO_UTF8( aDimension->GetSuffix() ) );
m_out->Print( 0, " (units %d) (units_format %d) (precision %d)",
static_cast<int>( aDimension->GetUnitsMode() ),
static_cast<int>( aDimension->GetUnitsFormat() ), aDimension->GetPrecision() );
m_out->Print( 0, " (units %d) (units_format %d) (precision %d)",
static_cast<int>( aDimension->GetUnitsMode() ),
static_cast<int>( aDimension->GetUnitsFormat() ), aDimension->GetPrecision() );
if( aDimension->GetOverrideTextEnabled() )
m_out->Print( 0, " (override_value \"%s\")", TO_UTF8( aDimension->GetOverrideText() ) );
if( aDimension->GetOverrideTextEnabled() )
m_out->Print( 0, " (override_value \"%s\")", TO_UTF8( aDimension->GetOverrideText() ) );
if( aDimension->GetSuppressZeroes() )
m_out->Print( 0, " suppress_zeroes" );
if( aDimension->GetSuppressZeroes() )
m_out->Print( 0, " suppress_zeroes" );
m_out->Print( 0, ")\n" );
m_out->Print( 0, ")\n" );
}
m_out->Print( aNestLevel+1, "(style (thickness %s) (arrow_length %s) (text_position_mode %d)",
FormatInternalUnits( aDimension->GetLineThickness() ).c_str(),

View File

@ -84,7 +84,8 @@ class TEXTE_PCB;
//#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 20200909 // Change DIMENSION format
#define SEXPR_BOARD_FILE_VERSION 20200913 // Add leader dimension
//#define SEXPR_BOARD_FILE_VERSION 20200913 // Add leader dimension
#define SEXPR_BOARD_FILE_VERSION 20200916 // Add center dimension
#define BOARD_FILE_HOST_VERSION 20200825 ///< Earlier files than this include the host tag

View File

@ -321,6 +321,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
placeMenu->AppendSeparator();
placeMenu->Add( PCB_ACTIONS::drawAlignedDimension );
placeMenu->Add( PCB_ACTIONS::drawCenterDimension );
placeMenu->Add( PCB_ACTIONS::drawLeader );
placeMenu->AppendSeparator();

View File

@ -723,6 +723,7 @@ void PCB_EDIT_FRAME::setupUIConditions()
CURRENT_TOOL( PCB_ACTIONS::drawPolygon );
CURRENT_TOOL( PCB_ACTIONS::placeText );
CURRENT_TOOL( PCB_ACTIONS::drawAlignedDimension );
CURRENT_TOOL( PCB_ACTIONS::drawCenterDimension );
CURRENT_TOOL( PCB_ACTIONS::drawLeader );
CURRENT_TOOL( PCB_ACTIONS::placeTarget );
CURRENT_TOOL( PCB_ACTIONS::drillOrigin );

View File

@ -444,6 +444,8 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
break;
case PCB_DIM_ALIGNED_T:
case PCB_DIM_CENTER_T:
case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T:
draw( static_cast<const DIMENSION*>( item ), aLayer );
break;

View File

@ -2387,6 +2387,10 @@ DIMENSION* PCB_PARSER::parseDIMENSION()
dimension = std::make_unique<LEADER>( nullptr );
break;
case T_center:
dimension = std::make_unique<CENTER_DIMENSION>( nullptr );
break;
default:
wxFAIL_MSG( wxT( "Cannot parse unknown dimension type %s" ) +
GetTokenString( CurTok() ) );

View File

@ -315,6 +315,8 @@ void BRDITEMS_PLOTTER::PlotBoardGraphicItems()
case PCB_TEXT_T: PlotTextePcb( (TEXTE_PCB*) item ); break;
case PCB_DIM_ALIGNED_T:
case PCB_DIM_CENTER_T:
case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T:
PlotDimension( (DIMENSION*) item );
break;

View File

@ -380,6 +380,7 @@ void PCB_EDIT_FRAME::ReCreateVToolbar()
m_drawToolBar->Add( PCB_ACTIONS::placeText, 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::drawCenterDimension, ACTION_TOOLBAR::TOGGLE );
// m_drawToolBar->Add( PCB_ACTIONS::drawLeader, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( PCB_ACTIONS::placeTarget, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( ACTIONS::deleteTool, ACTION_TOOLBAR::TOGGLE );

View File

@ -746,6 +746,10 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
if( boardSettings.m_DimensionUnitsMode == DIM_UNITS_MODE::AUTOMATIC )
dimension->SetUnits( m_frame->GetUserUnits(), false );
}
else if( originalEvent.IsAction( &PCB_ACTIONS::drawCenterDimension ) )
{
dimension = new CENTER_DIMENSION( m_board );
}
else if( originalEvent.IsAction( &PCB_ACTIONS::drawLeader ) )
{
dimension = new LEADER( m_board );
@ -774,9 +778,10 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
break;
case SET_END:
{
dimension->SetEnd( (wxPoint) cursorPos );
if( !!evt->Modifier( MD_CTRL ) )
if( !!evt->Modifier( MD_CTRL ) || dimension->Type() == PCB_DIM_CENTER_T )
constrainDimension( dimension );
// Dimensions that have origin and end in the same spot are not valid
@ -785,7 +790,15 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
else if( dimension->Type() == PCB_DIM_LEADER_T )
dimension->SetText( wxT( "?" ) );
break;
if( dimension->Type() == PCB_DIM_CENTER_T )
{
// No separate height/text step
++step;
KI_FALLTHROUGH;
}
else
break;
}
case SET_HEIGHT:
{
@ -814,8 +827,9 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, dimension );
}
break;
}
break;
}
if( ++step == FINISHED )
@ -832,7 +846,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
case SET_END:
dimension->SetEnd( (wxPoint) cursorPos );
if( !!evt->Modifier( MD_CTRL ) )
if( !!evt->Modifier( MD_CTRL ) || dimension->Type() == PCB_DIM_CENTER_T )
constrainDimension( dimension );
break;
@ -850,7 +864,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
double height = ( delta.x * cos( angle ) ) + ( delta.y * sin( angle ) );
aligned->SetHeight( height );
}
else
else if( dimension->Type() != PCB_DIM_CENTER_T )
{
wxASSERT( dimension->Type() == PCB_DIM_LEADER_T );
@ -2127,6 +2141,7 @@ void DRAWING_TOOL::setTransitions()
Go( &DRAWING_TOOL::DrawCircle, PCB_ACTIONS::drawCircle.MakeEvent() );
Go( &DRAWING_TOOL::DrawArc, PCB_ACTIONS::drawArc.MakeEvent() );
Go( &DRAWING_TOOL::DrawDimension, PCB_ACTIONS::drawAlignedDimension.MakeEvent() );
Go( &DRAWING_TOOL::DrawDimension, PCB_ACTIONS::drawCenterDimension.MakeEvent() );
Go( &DRAWING_TOOL::DrawDimension, PCB_ACTIONS::drawLeader.MakeEvent() );
Go( &DRAWING_TOOL::DrawZone, PCB_ACTIONS::drawZone.MakeEvent() );
Go( &DRAWING_TOOL::DrawZone, PCB_ACTIONS::drawZoneKeepout.MakeEvent() );

View File

@ -1421,6 +1421,8 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
case PCB_ZONE_AREA_T:
case PCB_TARGET_T:
case PCB_DIM_ALIGNED_T:
case PCB_DIM_CENTER_T:
case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T:
dupe_item = orig_item->Duplicate();
break;

View File

@ -556,6 +556,24 @@ void GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos, bo
break;
}
case PCB_DIM_CENTER_T:
{
const CENTER_DIMENSION* dim = static_cast<const CENTER_DIMENSION*>( aItem );
addAnchor( dim->GetStart(), CORNER | SNAPPABLE, aItem );
addAnchor( dim->GetEnd(), CORNER | SNAPPABLE, aItem );
VECTOR2I start( dim->GetStart() );
VECTOR2I radial( dim->GetEnd() - dim->GetStart() );
for( int i = 0; i < 2; i++ )
{
radial = radial.Rotate( DEG2RAD( 90 ) );
addAnchor( start + radial, CORNER | SNAPPABLE, aItem );
}
break;
}
case PCB_DIM_LEADER_T:
{
const LEADER* leader = static_cast<const LEADER*>( aItem );

View File

@ -122,6 +122,11 @@ TOOL_ACTION PCB_ACTIONS::drawAlignedDimension( "pcbnew.InteractiveDrawing.aligne
_( "Add Aligned Dimension" ), _( "Add an aligned linear dimension" ),
add_aligned_dimension_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::drawCenterDimension( "pcbnew.InteractiveDrawing.centerDimension",
AS_GLOBAL, 0, "",
_( "Add Center Dimension" ), _( "Add a center dimension" ),
add_center_dimension_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::drawLeader( "pcbnew.InteractiveDrawing.leader",
AS_GLOBAL, 0, "",
_( "Add Leader" ), _( "Add a leader dimension" ),

View File

@ -143,6 +143,7 @@ public:
static TOOL_ACTION drawArc;
static TOOL_ACTION placeText;
static TOOL_ACTION drawAlignedDimension;
static TOOL_ACTION drawCenterDimension;
static TOOL_ACTION drawLeader;
static TOOL_ACTION drawZone;
static TOOL_ACTION drawVia;

View File

@ -259,8 +259,22 @@ public:
points->Point( DIM_START ) ) );
points->Point( DIM_CROSSBAREND ).SetConstraint( new EC_LINE( points->Point( DIM_CROSSBAREND ),
points->Point( DIM_END ) ) );
}
break;
}
case PCB_DIM_CENTER_T:
{
const CENTER_DIMENSION* dimension = static_cast<const CENTER_DIMENSION*>( aItem );
points->AddPoint( dimension->GetStart() );
points->AddPoint( dimension->GetEnd() );
points->Point( DIM_END ).SetConstraint( new EC_45DEGREE( points->Point( DIM_END ),
points->Point( DIM_START ) ) );
break;
}
case PCB_DIM_LEADER_T:
{
@ -1321,6 +1335,26 @@ void POINT_EDITOR::updateItem() const
break;
}
case PCB_DIM_CENTER_T:
{
CENTER_DIMENSION* dimension = static_cast<CENTER_DIMENSION*>( 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 ) ) )
{
dimension->SetEnd( wxPoint( m_editedPoint->GetPosition().x,
m_editedPoint->GetPosition().y ) );
}
dimension->Update();
break;
}
case PCB_DIM_LEADER_T:
{
LEADER* dimension = static_cast<LEADER*>( item );
@ -1577,6 +1611,15 @@ void POINT_EDITOR::updatePoints()
break;
}
case PCB_DIM_CENTER_T:
{
const CENTER_DIMENSION* dimension = static_cast<const CENTER_DIMENSION*>( item );
m_editPoints->Point( DIM_START ).SetPosition( dimension->GetStart() );
m_editPoints->Point( DIM_END ).SetPosition( dimension->GetEnd() );
break;
}
case PCB_DIM_LEADER_T:
{
const LEADER* dimension = static_cast<const LEADER*>( item );
@ -1696,6 +1739,14 @@ EDIT_POINT POINT_EDITOR::get45DegConstrainer() const
break;
}
case PCB_DIM_CENTER_T:
{
if( isModified( m_editPoints->Point( DIM_END ) ) )
return m_editPoints->Point( DIM_START );
break;
}
default:
break;
}

View File

@ -1382,6 +1382,8 @@ static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem, const BOARD& aBoard
case PCB_LINE_T:
case PCB_TARGET_T:
case PCB_DIM_ALIGNED_T:
case PCB_DIM_CENTER_T:
case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T:
{
if( layer == Edge_Cuts )
@ -1518,6 +1520,8 @@ bool SELECTION_TOOL::itemPassesFilter( BOARD_ITEM* aItem )
break;
case PCB_DIM_ALIGNED_T:
case PCB_DIM_CENTER_T:
case PCB_DIM_ORTHOGONAL_T:
case PCB_DIM_LEADER_T:
if( !m_filter.dimensions )
return false;