Collapse FP_* down into their PCB_* equivalents.
This commit is contained in:
parent
7695d510d6
commit
bbd6c80507
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -34,16 +34,14 @@
|
|||
#include "../3d_rendering/raytracing/shapes2D/filled_circle_2d.h"
|
||||
#include "../3d_rendering/raytracing/shapes2D/round_segment_2d.h"
|
||||
#include "../3d_rendering/raytracing/shapes2D/triangle_2d.h"
|
||||
#include "fp_textbox.h"
|
||||
#include <board_adapter.h>
|
||||
#include <footprint.h>
|
||||
#include <pad.h>
|
||||
#include <pcb_text.h>
|
||||
#include <fp_shape.h>
|
||||
#include <pcb_textbox.h>
|
||||
#include <board_design_settings.h>
|
||||
#include <pcb_painter.h> // for PCB_RENDER_SETTINGS
|
||||
#include <zone.h>
|
||||
#include <fp_text.h>
|
||||
#include <convert_basic_shapes_to_polygon.h>
|
||||
#include <trigo.h>
|
||||
#include <geometry/shape_segment.h>
|
||||
|
@ -194,9 +192,9 @@ void BOARD_ADAPTER::addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2
|
|||
{
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_FP_TEXT_T:
|
||||
case PCB_TEXT_T:
|
||||
{
|
||||
FP_TEXT* text = static_cast<FP_TEXT*>( item );
|
||||
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
|
||||
|
||||
if( text->GetLayer() == aLayerId && text->IsVisible() )
|
||||
addText( text, aContainer, text );
|
||||
|
@ -204,9 +202,9 @@ void BOARD_ADAPTER::addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_FP_TEXTBOX_T:
|
||||
case PCB_TEXTBOX_T:
|
||||
{
|
||||
FP_TEXTBOX* textbox = static_cast<FP_TEXTBOX*>( item );
|
||||
PCB_TEXTBOX* textbox = static_cast<PCB_TEXTBOX*>( item );
|
||||
|
||||
if( textbox->GetLayer() == aLayerId )
|
||||
{
|
||||
|
@ -217,11 +215,11 @@ void BOARD_ADAPTER::addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_FP_DIM_ALIGNED_T:
|
||||
case PCB_FP_DIM_CENTER_T:
|
||||
case PCB_FP_DIM_ORTHOGONAL_T:
|
||||
case PCB_FP_DIM_RADIAL_T:
|
||||
case PCB_FP_DIM_LEADER_T:
|
||||
case PCB_DIM_ALIGNED_T:
|
||||
case PCB_DIM_CENTER_T:
|
||||
case PCB_DIM_ORTHOGONAL_T:
|
||||
case PCB_DIM_RADIAL_T:
|
||||
case PCB_DIM_LEADER_T:
|
||||
{
|
||||
PCB_DIMENSION_BASE* dimension = static_cast<PCB_DIMENSION_BASE*>( item );
|
||||
|
||||
|
@ -231,9 +229,9 @@ void BOARD_ADAPTER::addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_FP_SHAPE_T:
|
||||
case PCB_SHAPE_T:
|
||||
{
|
||||
FP_SHAPE* shape = static_cast<FP_SHAPE*>( item );
|
||||
PCB_SHAPE* shape = static_cast<PCB_SHAPE*>( item );
|
||||
|
||||
if( shape->GetLayer() == aLayerId )
|
||||
addShape( shape, aContainer, aFootprint );
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include <pad.h>
|
||||
#include <pcb_text.h>
|
||||
#include <pcb_textbox.h>
|
||||
#include <fp_shape.h>
|
||||
#include <pcb_shape.h>
|
||||
#include <zone.h>
|
||||
#include <convert_basic_shapes_to_polygon.h>
|
||||
#include <trigo.h>
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "board_adapter.h"
|
||||
#include <board_design_settings.h>
|
||||
#include <convert_basic_shapes_to_polygon.h>
|
||||
#include <fp_shape.h>
|
||||
#include <pcb_shape.h>
|
||||
#include <footprint.h>
|
||||
|
||||
|
||||
|
@ -71,19 +71,10 @@ void BOARD_ADAPTER::transformFPShapesToPolySet( const FOOTPRINT* aFootprint, PCB
|
|||
|
||||
for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
|
||||
{
|
||||
if( item->Type() == PCB_FP_SHAPE_T )
|
||||
if( item->Type() == PCB_SHAPE_T || BaseType( item->Type() ) == PCB_DIMENSION_T )
|
||||
{
|
||||
FP_SHAPE* shape = static_cast<FP_SHAPE*>( item );
|
||||
|
||||
if( shape->GetLayer() == aLayer )
|
||||
shape->TransformShapeToPolygon( aBuffer, aLayer, 0, maxError, ERROR_INSIDE );
|
||||
}
|
||||
else if( BaseType( item->Type() ) == PCB_DIMENSION_T )
|
||||
{
|
||||
PCB_DIMENSION_BASE* dimension = static_cast<PCB_DIMENSION_BASE*>( item );
|
||||
|
||||
if( dimension->GetLayer() == aLayer )
|
||||
dimension->TransformShapeToPolygon( aBuffer, aLayer, 0, maxError, ERROR_INSIDE );
|
||||
if( item->GetLayer() == aLayer )
|
||||
item->TransformShapeToPolygon( aBuffer, aLayer, 0, maxError, ERROR_INSIDE );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -540,7 +540,6 @@ set( PCB_COMMON_SRCS
|
|||
${CMAKE_SOURCE_DIR}/pcbnew/board_item.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/pcb_dimension.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/pcb_shape.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/fp_shape.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/pcb_group.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/pcb_marker.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/footprint.cpp
|
||||
|
@ -552,8 +551,6 @@ set( PCB_COMMON_SRCS
|
|||
${CMAKE_SOURCE_DIR}/pcbnew/pcb_text.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/pcb_textbox.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/board_stackup_manager/board_stackup.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/fp_text.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/fp_textbox.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/pcb_track.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/zone.cpp
|
||||
${CMAKE_SOURCE_DIR}/pcbnew/collectors.cpp
|
||||
|
|
|
@ -328,15 +328,6 @@ static struct EDA_ITEM_DESC
|
|||
.Map( PCB_BITMAP_T, _HKI( "Bitmap" ) )
|
||||
.Map( PCB_TEXT_T, _HKI( "Text" ) )
|
||||
.Map( PCB_TEXTBOX_T, _HKI( "Text Box" ) )
|
||||
.Map( PCB_FP_TEXT_T, _HKI( "Text" ) )
|
||||
.Map( PCB_FP_TEXTBOX_T, _HKI( "Text Box" ) )
|
||||
.Map( PCB_FP_SHAPE_T, _HKI( "Graphic" ) )
|
||||
.Map( PCB_FP_DIM_ALIGNED_T, _HKI( "Dimension" ) )
|
||||
.Map( PCB_FP_DIM_ORTHOGONAL_T, _HKI( "Dimension" ) )
|
||||
.Map( PCB_FP_DIM_CENTER_T, _HKI( "Dimension" ) )
|
||||
.Map( PCB_FP_DIM_RADIAL_T, _HKI( "Dimension" ) )
|
||||
.Map( PCB_FP_DIM_LEADER_T, _HKI( "Leader" ) )
|
||||
.Map( PCB_FP_ZONE_T, _HKI( "Zone" ) )
|
||||
.Map( PCB_TRACE_T, _HKI( "Track" ) )
|
||||
.Map( PCB_ARC_T, _HKI( "Track" ) )
|
||||
.Map( PCB_VIA_T, _HKI( "Via" ) )
|
||||
|
|
|
@ -184,7 +184,7 @@ void EDA_SHAPE::move( const VECTOR2I& aMoveVector )
|
|||
break;
|
||||
|
||||
case SHAPE_T::POLY:
|
||||
m_poly.Move( VECTOR2I( aMoveVector ) );
|
||||
m_poly.Move( aMoveVector );
|
||||
break;
|
||||
|
||||
case SHAPE_T::BEZIER:
|
||||
|
@ -712,14 +712,7 @@ const BOX2I EDA_SHAPE::getBoundingBox() const
|
|||
break;
|
||||
|
||||
for( auto iter = m_poly.CIterate(); iter; iter++ )
|
||||
{
|
||||
VECTOR2I pt( iter->x, iter->y );
|
||||
|
||||
RotatePoint( pt, getParentOrientation() );
|
||||
pt += getParentPosition();
|
||||
|
||||
bbox.Merge( pt );
|
||||
}
|
||||
bbox.Merge( *iter );
|
||||
|
||||
break;
|
||||
|
||||
|
@ -949,18 +942,10 @@ bool EDA_SHAPE::hitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) co
|
|||
// Account for the width of the line
|
||||
arect.Inflate( GetWidth() / 2 );
|
||||
|
||||
// Polygons in footprints use coordinates relative to the footprint.
|
||||
// Therefore, instead of using m_poly, we make a copy which is translated
|
||||
// to the actual location in the board.
|
||||
VECTOR2I offset = getParentPosition();
|
||||
|
||||
for( int ii = 0; ii < m_poly.OutlineCount(); ++ii )
|
||||
{
|
||||
SHAPE_LINE_CHAIN poly = m_poly.Outline( ii );
|
||||
poly.Rotate( getParentOrientation() );
|
||||
poly.Move( offset );
|
||||
|
||||
int count = poly.GetPointCount();
|
||||
const SHAPE_LINE_CHAIN& poly = m_poly.Outline( ii );
|
||||
int count = poly.GetPointCount();
|
||||
|
||||
for( int jj = 0; jj < count; jj++ )
|
||||
{
|
||||
|
@ -1038,32 +1023,11 @@ std::vector<VECTOR2I> EDA_SHAPE::GetRectCorners() const
|
|||
VECTOR2I topLeft = GetStart();
|
||||
VECTOR2I botRight = GetEnd();
|
||||
|
||||
// Un-rotate rect topLeft and botRight
|
||||
if( !getParentOrientation().IsCardinal() )
|
||||
{
|
||||
topLeft -= getParentPosition();
|
||||
RotatePoint( topLeft, -getParentOrientation() );
|
||||
|
||||
botRight -= getParentPosition();
|
||||
RotatePoint( botRight, -getParentOrientation() );
|
||||
}
|
||||
|
||||
// Set up the un-rotated 4 corners
|
||||
pts.emplace_back( topLeft );
|
||||
pts.emplace_back( botRight.x, topLeft.y );
|
||||
pts.emplace_back( botRight );
|
||||
pts.emplace_back( topLeft.x, botRight.y );
|
||||
|
||||
// Now re-rotate the 4 corners to get a diamond
|
||||
if( !getParentOrientation().IsCardinal() )
|
||||
{
|
||||
for( VECTOR2I& pt : pts )
|
||||
{
|
||||
RotatePoint( pt, getParentOrientation() );
|
||||
pt += getParentPosition();
|
||||
}
|
||||
}
|
||||
|
||||
return pts;
|
||||
}
|
||||
|
||||
|
@ -1198,9 +1162,6 @@ std::vector<SHAPE*> EDA_SHAPE::makeEffectiveShapes( bool aEdgeOnly, bool aLineCh
|
|||
if( aLineChainOnly )
|
||||
l.SetClosed( false );
|
||||
|
||||
l.Rotate( getParentOrientation() );
|
||||
l.Move( getParentPosition() );
|
||||
|
||||
if( IsFilled() && !aEdgeOnly )
|
||||
effectiveShapes.emplace_back( new SHAPE_SIMPLE( l ) );
|
||||
|
||||
|
@ -1604,38 +1565,30 @@ void EDA_SHAPE::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, int aClearance
|
|||
if( !IsPolyShapeValid() )
|
||||
break;
|
||||
|
||||
// The polygon is expected to be a simple polygon; not self intersecting, no hole.
|
||||
EDA_ANGLE orientation = getParentOrientation();
|
||||
VECTOR2I offset = getParentPosition();
|
||||
|
||||
// Build the polygon with the actual position and orientation:
|
||||
std::vector<VECTOR2I> poly;
|
||||
DupPolyPointsList( poly );
|
||||
|
||||
for( VECTOR2I& point : poly )
|
||||
{
|
||||
RotatePoint( point, orientation );
|
||||
point += offset;
|
||||
}
|
||||
|
||||
if( IsFilled() )
|
||||
{
|
||||
aBuffer.NewOutline();
|
||||
|
||||
for( const VECTOR2I& point : poly )
|
||||
aBuffer.Append( point.x, point.y );
|
||||
for( int ii = 0; ii < m_poly.OutlineCount(); ++ii )
|
||||
{
|
||||
const SHAPE_LINE_CHAIN& poly = m_poly.Outline( ii );
|
||||
|
||||
for( int jj = 0; jj < (int) poly.GetPointCount(); ++jj )
|
||||
aBuffer.Append( poly.GetPoint( jj ) );
|
||||
}
|
||||
}
|
||||
|
||||
if( width > 0 || !IsFilled() )
|
||||
{
|
||||
VECTOR2I pt1( poly[poly.size() - 1] );
|
||||
|
||||
for( const VECTOR2I& pt2 : poly )
|
||||
for( int ii = 0; ii < m_poly.OutlineCount(); ++ii )
|
||||
{
|
||||
if( pt2 != pt1 )
|
||||
TransformOvalToPolygon( aBuffer, pt1, pt2, width, aError, aErrorLoc );
|
||||
const SHAPE_LINE_CHAIN& poly = m_poly.Outline( ii );
|
||||
|
||||
pt1 = pt2;
|
||||
for( int jj = 0; jj < (int) poly.SegmentCount(); ++jj )
|
||||
{
|
||||
const SEG& seg = poly.GetSegment( jj );
|
||||
TransformOvalToPolygon( aBuffer, seg.A, seg.B, width, aError, aErrorLoc );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017 CERN
|
||||
* Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -26,9 +26,9 @@
|
|||
#include <hash_eda.h>
|
||||
#include <hash.h>
|
||||
#include <footprint.h>
|
||||
#include <fp_text.h>
|
||||
#include <fp_textbox.h>
|
||||
#include <fp_shape.h>
|
||||
#include <pcb_text.h>
|
||||
#include <pcb_textbox.h>
|
||||
#include <pcb_shape.h>
|
||||
#include <pad.h>
|
||||
|
||||
#include <functional>
|
||||
|
@ -101,14 +101,14 @@ size_t hash_fp_item( const EDA_ITEM* aItem, int aFlags )
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_FP_TEXT_T:
|
||||
case PCB_TEXT_T:
|
||||
{
|
||||
const FP_TEXT* text = static_cast<const FP_TEXT*>( aItem );
|
||||
const PCB_TEXT* text = static_cast<const PCB_TEXT*>( aItem );
|
||||
|
||||
if( !( aFlags & HASH_REF ) && text->GetType() == FP_TEXT::TEXT_is_REFERENCE )
|
||||
if( !( aFlags & HASH_REF ) && text->GetType() == PCB_TEXT::TEXT_is_REFERENCE )
|
||||
break;
|
||||
|
||||
if( !( aFlags & HASH_VALUE ) && text->GetType() == FP_TEXT::TEXT_is_VALUE )
|
||||
if( !( aFlags & HASH_VALUE ) && text->GetType() == PCB_TEXT::TEXT_is_VALUE )
|
||||
break;
|
||||
|
||||
ret = hash_board_item( text, aFlags );
|
||||
|
@ -123,10 +123,10 @@ size_t hash_fp_item( const EDA_ITEM* aItem, int aFlags )
|
|||
|
||||
if( aFlags & HASH_POS )
|
||||
{
|
||||
if( aFlags & REL_COORD )
|
||||
hash_combine( ret, text->GetPos0().x, text->GetPos0().y );
|
||||
else
|
||||
hash_combine( ret, text->GetPosition().x, text->GetPosition().y );
|
||||
VECTOR2I pos = ( aFlags & REL_COORD ) ? text->GetFPRelativePosition()
|
||||
: text->GetPosition();
|
||||
|
||||
hash_combine( ret, pos.x, pos.y );
|
||||
}
|
||||
|
||||
if( aFlags & HASH_ROT )
|
||||
|
@ -134,9 +134,9 @@ size_t hash_fp_item( const EDA_ITEM* aItem, int aFlags )
|
|||
}
|
||||
break;
|
||||
|
||||
case PCB_FP_SHAPE_T:
|
||||
case PCB_SHAPE_T:
|
||||
{
|
||||
const FP_SHAPE* shape = static_cast<const FP_SHAPE*>( aItem );
|
||||
const PCB_SHAPE* shape = static_cast<const PCB_SHAPE*>( aItem );
|
||||
ret = hash_board_item( shape, aFlags );
|
||||
hash_combine( ret, shape->GetShape() );
|
||||
hash_combine( ret, shape->GetWidth() );
|
||||
|
@ -147,39 +147,40 @@ size_t hash_fp_item( const EDA_ITEM* aItem, int aFlags )
|
|||
|
||||
if( aFlags & HASH_POS )
|
||||
{
|
||||
if( aFlags & REL_COORD )
|
||||
{
|
||||
hash_combine( ret, shape->GetStart0().x );
|
||||
hash_combine( ret, shape->GetStart0().y );
|
||||
hash_combine( ret, shape->GetEnd0().x );
|
||||
hash_combine( ret, shape->GetEnd0().y );
|
||||
VECTOR2I start = shape->GetStart();
|
||||
VECTOR2I end = shape->GetEnd();
|
||||
VECTOR2I center = shape->GetCenter();
|
||||
|
||||
if( shape->GetShape() == SHAPE_T::ARC )
|
||||
{
|
||||
hash_combine( ret, shape->GetCenter0().x );
|
||||
hash_combine( ret, shape->GetCenter0().y );
|
||||
}
|
||||
FOOTPRINT* parentFP = shape->GetParentFootprint();
|
||||
|
||||
if( parentFP && ( aFlags & REL_COORD ) )
|
||||
{
|
||||
start -= parentFP->GetPosition();
|
||||
end -= parentFP->GetPosition();
|
||||
center -= parentFP->GetPosition();
|
||||
|
||||
RotatePoint( start, -parentFP->GetOrientation() );
|
||||
RotatePoint( end, -parentFP->GetOrientation() );
|
||||
RotatePoint( center, -parentFP->GetOrientation() );
|
||||
}
|
||||
else
|
||||
{
|
||||
hash_combine( ret, shape->GetStart().x );
|
||||
hash_combine( ret, shape->GetStart().y );
|
||||
hash_combine( ret, shape->GetEnd().x );
|
||||
hash_combine( ret, shape->GetEnd().y );
|
||||
|
||||
if( shape->GetShape() == SHAPE_T::ARC )
|
||||
{
|
||||
hash_combine( ret, shape->GetCenter().x );
|
||||
hash_combine( ret, shape->GetCenter().y );
|
||||
}
|
||||
hash_combine( ret, start.x );
|
||||
hash_combine( ret, start.y );
|
||||
hash_combine( ret, end.x );
|
||||
hash_combine( ret, end.y );
|
||||
|
||||
if( shape->GetShape() == SHAPE_T::ARC )
|
||||
{
|
||||
hash_combine( ret, center.x );
|
||||
hash_combine( ret, center.y );
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PCB_FP_TEXTBOX_T:
|
||||
case PCB_TEXTBOX_T:
|
||||
{
|
||||
const FP_TEXTBOX* textbox = static_cast<const FP_TEXTBOX*>( aItem );
|
||||
const PCB_TEXTBOX* textbox = static_cast<const PCB_TEXTBOX*>( aItem );
|
||||
|
||||
ret = hash_board_item( textbox, aFlags );
|
||||
hash_combine( ret, textbox->GetText().ToStdString() );
|
||||
|
@ -199,20 +200,24 @@ size_t hash_fp_item( const EDA_ITEM* aItem, int aFlags )
|
|||
|
||||
if( aFlags & HASH_POS )
|
||||
{
|
||||
if( aFlags & REL_COORD )
|
||||
VECTOR2I start = textbox->GetStart();
|
||||
VECTOR2I end = textbox->GetEnd();
|
||||
|
||||
FOOTPRINT* parentFP = textbox->GetParentFootprint();
|
||||
|
||||
if( parentFP && ( aFlags & REL_COORD ) )
|
||||
{
|
||||
hash_combine( ret, textbox->GetStart0().x );
|
||||
hash_combine( ret, textbox->GetStart0().y );
|
||||
hash_combine( ret, textbox->GetEnd0().x );
|
||||
hash_combine( ret, textbox->GetEnd0().y );
|
||||
}
|
||||
else
|
||||
{
|
||||
hash_combine( ret, textbox->GetStart().x );
|
||||
hash_combine( ret, textbox->GetStart().y );
|
||||
hash_combine( ret, textbox->GetEnd().x );
|
||||
hash_combine( ret, textbox->GetEnd().y );
|
||||
start -= parentFP->GetPosition();
|
||||
end -= parentFP->GetPosition();
|
||||
|
||||
RotatePoint( start, -parentFP->GetOrientation() );
|
||||
RotatePoint( end, -parentFP->GetOrientation() );
|
||||
}
|
||||
|
||||
hash_combine( ret, start.x );
|
||||
hash_combine( ret, start.y );
|
||||
hash_combine( ret, end.x );
|
||||
hash_combine( ret, end.y );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -128,9 +128,6 @@ private:
|
|||
|
||||
void print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, void* aData,
|
||||
const TRANSFORM& aTransform, bool aDimmed ) override;
|
||||
|
||||
EDA_ANGLE getParentOrientation() const override { return ANGLE_0; }
|
||||
VECTOR2I getParentPosition() const override { return VECTOR2I(); }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -114,9 +114,6 @@ public:
|
|||
private:
|
||||
void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
|
||||
void PrintBackground( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
|
||||
|
||||
EDA_ANGLE getParentOrientation() const override { return ANGLE_0; }
|
||||
VECTOR2I getParentPosition() const override { return VECTOR2I(); }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ class SHAPE_SEGMENT;
|
|||
class PCB_BASE_FRAME;
|
||||
class SHAPE;
|
||||
class PCB_GROUP;
|
||||
class FOOTPRINT;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -174,7 +175,10 @@ public:
|
|||
|
||||
BOARD_ITEM_CONTAINER* GetParent() const { return (BOARD_ITEM_CONTAINER*) m_parent; }
|
||||
|
||||
BOARD_ITEM_CONTAINER* GetParentFootprint() const;
|
||||
FOOTPRINT* GetParentFootprint() const;
|
||||
|
||||
VECTOR2I GetFPRelativePosition() const;
|
||||
void SetFPRelativePosition( const VECTOR2I& aPos );
|
||||
|
||||
/**
|
||||
* Check if this item has line stoke properties.
|
||||
|
|
|
@ -89,15 +89,6 @@ enum KICAD_T
|
|||
PCB_BITMAP_T, ///< class PCB_BITMAP, bitmap on a layer
|
||||
PCB_TEXT_T, ///< class PCB_TEXT, text on a layer
|
||||
PCB_TEXTBOX_T, ///< class PCB_TEXTBOX, wrapped text on a layer
|
||||
PCB_FP_TEXT_T, ///< class FP_TEXT, text in a footprint
|
||||
PCB_FP_TEXTBOX_T, ///< class FP_TEXTBOX, wrapped text in a footprint
|
||||
PCB_FP_SHAPE_T, ///< class FP_SHAPE, a footprint edge
|
||||
PCB_FP_DIM_ALIGNED_T, ///< class PCB_DIM_ALIGNED, a linear dimension (graphic item)
|
||||
PCB_FP_DIM_LEADER_T, ///< class PCB_DIM_LEADER, a leader dimension (graphic item)
|
||||
PCB_FP_DIM_CENTER_T, ///< class PCB_DIM_CENTER, a center point marking (graphic item)
|
||||
PCB_FP_DIM_RADIAL_T, ///< class PCB_DIM_RADIAL, a radius or diameter dimension
|
||||
PCB_FP_DIM_ORTHOGONAL_T, ///< class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
|
||||
PCB_FP_ZONE_T, ///< class ZONE, managed by a footprint
|
||||
PCB_TRACE_T, ///< class PCB_TRACK, a track segment (segment on a copper layer)
|
||||
PCB_VIA_T, ///< class PCB_VIA, a via (like a track segment on a copper layer)
|
||||
PCB_ARC_T, ///< class PCB_ARC, an arc track segment on a copper layer
|
||||
|
@ -121,13 +112,12 @@ enum KICAD_T
|
|||
PCB_LOCATE_UVIA_T,
|
||||
PCB_LOCATE_BBVIA_T,
|
||||
PCB_LOCATE_TEXT_T,
|
||||
PCB_LOCATE_GRAPHIC_T,
|
||||
PCB_LOCATE_HOLE_T,
|
||||
PCB_LOCATE_PTH_T,
|
||||
PCB_LOCATE_NPTH_T,
|
||||
PCB_LOCATE_BOARD_EDGE_T,
|
||||
|
||||
// Same for locating shapes types from PCB_SHAPE_T and PCB_FP_SHAPE_T items
|
||||
// Same for locating shapes types from PCB_SHAPE_T items
|
||||
PCB_SHAPE_LOCATE_SEGMENT_T,
|
||||
PCB_SHAPE_LOCATE_RECT_T,
|
||||
PCB_SHAPE_LOCATE_CIRCLE_T,
|
||||
|
@ -291,11 +281,6 @@ constexpr KICAD_T BaseType( const KICAD_T aType )
|
|||
case PCB_DIM_RADIAL_T:
|
||||
case PCB_DIM_ORTHOGONAL_T:
|
||||
case PCB_DIM_LEADER_T:
|
||||
case PCB_FP_DIM_ALIGNED_T:
|
||||
case PCB_FP_DIM_CENTER_T:
|
||||
case PCB_FP_DIM_RADIAL_T:
|
||||
case PCB_FP_DIM_ORTHOGONAL_T:
|
||||
case PCB_FP_DIM_LEADER_T:
|
||||
return PCB_DIMENSION_T;
|
||||
|
||||
default:
|
||||
|
@ -336,7 +321,6 @@ constexpr bool IsInstantiableType( const KICAD_T aType )
|
|||
case PCB_LOCATE_UVIA_T:
|
||||
case PCB_LOCATE_BBVIA_T:
|
||||
case PCB_LOCATE_TEXT_T:
|
||||
case PCB_LOCATE_GRAPHIC_T:
|
||||
case PCB_LOCATE_HOLE_T:
|
||||
case PCB_LOCATE_PTH_T:
|
||||
case PCB_LOCATE_NPTH_T:
|
||||
|
@ -432,15 +416,6 @@ constexpr bool IsPcbnewType( const KICAD_T aType )
|
|||
case PCB_BITMAP_T:
|
||||
case PCB_TEXT_T:
|
||||
case PCB_TEXTBOX_T:
|
||||
case PCB_FP_TEXT_T:
|
||||
case PCB_FP_TEXTBOX_T:
|
||||
case PCB_FP_SHAPE_T:
|
||||
case PCB_FP_DIM_ALIGNED_T:
|
||||
case PCB_FP_DIM_LEADER_T:
|
||||
case PCB_FP_DIM_CENTER_T:
|
||||
case PCB_FP_DIM_RADIAL_T:
|
||||
case PCB_FP_DIM_ORTHOGONAL_T:
|
||||
case PCB_FP_ZONE_T:
|
||||
case PCB_TRACE_T:
|
||||
case PCB_VIA_T:
|
||||
case PCB_ARC_T:
|
||||
|
@ -461,7 +436,6 @@ constexpr bool IsPcbnewType( const KICAD_T aType )
|
|||
case PCB_LOCATE_UVIA_T:
|
||||
case PCB_LOCATE_BBVIA_T:
|
||||
case PCB_LOCATE_TEXT_T:
|
||||
case PCB_LOCATE_GRAPHIC_T:
|
||||
case PCB_LOCATE_HOLE_T:
|
||||
case PCB_LOCATE_PTH_T:
|
||||
case PCB_LOCATE_NPTH_T:
|
||||
|
|
|
@ -324,10 +324,6 @@ protected:
|
|||
void flip( const VECTOR2I& aCentre, bool aFlipLeftRight );
|
||||
void scale( double aScale );
|
||||
|
||||
// To be implemented by concrete classes
|
||||
virtual EDA_ANGLE getParentOrientation() const = 0;
|
||||
virtual VECTOR2I getParentPosition() const = 0;
|
||||
|
||||
const BOX2I getBoundingBox() const;
|
||||
|
||||
void computeArcBBox( BOX2I& aBBox ) const;
|
||||
|
|
|
@ -87,7 +87,7 @@ void ARRAY_CREATOR::Invoke()
|
|||
if( item->Type() == PCB_PAD_T && !m_isFootprintEditor )
|
||||
{
|
||||
// If it is not the footprint editor, then duplicate the parent footprint instead
|
||||
item = static_cast<FOOTPRINT*>( item )->GetParent();
|
||||
item = item->GetParentFootprint();
|
||||
}
|
||||
|
||||
BOARD_ITEM* this_item = nullptr;
|
||||
|
|
|
@ -1002,12 +1002,7 @@ void BOARD::UpdateUserUnits( BOARD_ITEM* aItem, KIGFX::VIEW* aView )
|
|||
PCB_DIM_LEADER_T,
|
||||
PCB_DIM_ORTHOGONAL_T,
|
||||
PCB_DIM_CENTER_T,
|
||||
PCB_DIM_RADIAL_T,
|
||||
PCB_FP_DIM_ALIGNED_T,
|
||||
PCB_FP_DIM_LEADER_T,
|
||||
PCB_FP_DIM_ORTHOGONAL_T,
|
||||
PCB_FP_DIM_CENTER_T,
|
||||
PCB_FP_DIM_RADIAL_T } );
|
||||
PCB_DIM_RADIAL_T } );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1321,7 +1316,7 @@ BOX2I BOARD::ComputeBoundingBox( bool aBoardEdgesOnly ) const
|
|||
{
|
||||
for( const BOARD_ITEM* edge : footprint->GraphicalItems() )
|
||||
{
|
||||
if( edge->GetLayer() == Edge_Cuts && edge->Type() == PCB_FP_SHAPE_T )
|
||||
if( edge->GetLayer() == Edge_Cuts && edge->Type() == PCB_SHAPE_T )
|
||||
bbox.Merge( edge->GetBoundingBox() );
|
||||
}
|
||||
}
|
||||
|
@ -1419,15 +1414,16 @@ INSPECT_RESULT BOARD::Visit( INSPECTOR inspector, void* testData,
|
|||
|
||||
case PCB_FOOTPRINT_T:
|
||||
case PCB_PAD_T:
|
||||
case PCB_FP_TEXT_T:
|
||||
case PCB_FP_TEXTBOX_T:
|
||||
case PCB_FP_SHAPE_T:
|
||||
case PCB_FP_DIM_ALIGNED_T:
|
||||
case PCB_FP_DIM_LEADER_T:
|
||||
case PCB_FP_DIM_CENTER_T:
|
||||
case PCB_FP_DIM_RADIAL_T:
|
||||
case PCB_FP_DIM_ORTHOGONAL_T:
|
||||
case PCB_FP_ZONE_T:
|
||||
case PCB_SHAPE_T:
|
||||
case PCB_BITMAP_T:
|
||||
case PCB_TEXT_T:
|
||||
case PCB_TEXTBOX_T:
|
||||
case PCB_DIM_ALIGNED_T:
|
||||
case PCB_DIM_CENTER_T:
|
||||
case PCB_DIM_RADIAL_T:
|
||||
case PCB_DIM_ORTHOGONAL_T:
|
||||
case PCB_DIM_LEADER_T:
|
||||
case PCB_TARGET_T:
|
||||
if( !footprintsScanned )
|
||||
{
|
||||
if( IterateForward<FOOTPRINT*>( m_footprints, inspector, testData, scanTypes )
|
||||
|
@ -1439,18 +1435,6 @@ INSPECT_RESULT BOARD::Visit( INSPECTOR inspector, void* testData,
|
|||
footprintsScanned = true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case PCB_SHAPE_T:
|
||||
case PCB_BITMAP_T:
|
||||
case PCB_TEXT_T:
|
||||
case PCB_TEXTBOX_T:
|
||||
case PCB_DIM_ALIGNED_T:
|
||||
case PCB_DIM_CENTER_T:
|
||||
case PCB_DIM_RADIAL_T:
|
||||
case PCB_DIM_ORTHOGONAL_T:
|
||||
case PCB_DIM_LEADER_T:
|
||||
case PCB_TARGET_T:
|
||||
if( !drawingsScanned )
|
||||
{
|
||||
if( IterateForward<BOARD_ITEM*>( m_drawings, inspector, testData, scanTypes )
|
||||
|
@ -1490,6 +1474,17 @@ INSPECT_RESULT BOARD::Visit( INSPECTOR inspector, void* testData,
|
|||
break;
|
||||
|
||||
case PCB_ZONE_T:
|
||||
if( !footprintsScanned )
|
||||
{
|
||||
if( IterateForward<FOOTPRINT*>( m_footprints, inspector, testData, scanTypes )
|
||||
== INSPECT_RESULT::QUIT )
|
||||
{
|
||||
return INSPECT_RESULT::QUIT;
|
||||
}
|
||||
|
||||
footprintsScanned = true;
|
||||
}
|
||||
|
||||
for( ZONE* zone : m_zones)
|
||||
{
|
||||
if( zone->Visit( inspector, testData, { scanType } ) == INSPECT_RESULT::QUIT )
|
||||
|
@ -1976,7 +1971,7 @@ std::list<ZONE*> BOARD::GetZoneList( bool aIncludeZonesInFootprints ) const
|
|||
{
|
||||
for( FOOTPRINT* footprint : m_footprints )
|
||||
{
|
||||
for( FP_ZONE* zone : footprint->Zones() )
|
||||
for( ZONE* zone : footprint->Zones() )
|
||||
zones.push_back( zone );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <macros.h>
|
||||
#include <board.h>
|
||||
#include <footprint.h>
|
||||
#include <pcb_group.h>
|
||||
|
@ -144,7 +145,7 @@ void BOARD_COMMIT::dirtyIntersectingZones( BOARD_ITEM* item, int aChangeType )
|
|||
|
||||
ZONE_FILLER_TOOL* zoneFillerTool = m_toolMgr->GetTool<ZONE_FILLER_TOOL>();
|
||||
|
||||
if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T )
|
||||
if( item->Type() == PCB_ZONE_T )
|
||||
zoneFillerTool->DirtyZone( static_cast<ZONE*>( item ) );
|
||||
|
||||
if( item->Type() == PCB_FOOTPRINT_T )
|
||||
|
@ -318,21 +319,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, int aCommitFlags )
|
|||
if( !( changeFlags & CHT_DONE ) )
|
||||
board->Footprints().front()->Add( boardItem );
|
||||
}
|
||||
else if( boardItem->Type() == PCB_PAD_T
|
||||
|| boardItem->Type() == PCB_FP_TEXT_T
|
||||
|| boardItem->Type() == PCB_FP_TEXTBOX_T
|
||||
|| boardItem->Type() == PCB_FP_SHAPE_T
|
||||
|| boardItem->Type() == PCB_FP_DIM_ALIGNED_T
|
||||
|| boardItem->Type() == PCB_FP_DIM_LEADER_T
|
||||
|| boardItem->Type() == PCB_FP_DIM_CENTER_T
|
||||
|| boardItem->Type() == PCB_FP_DIM_RADIAL_T
|
||||
|| boardItem->Type() == PCB_FP_DIM_ORTHOGONAL_T
|
||||
|| boardItem->Type() == PCB_FP_ZONE_T )
|
||||
{
|
||||
wxASSERT( boardItem->GetParent() &&
|
||||
boardItem->GetParent()->Type() == PCB_FOOTPRINT_T );
|
||||
}
|
||||
else
|
||||
else if( !boardItem->GetParentFootprint() )
|
||||
{
|
||||
if( !( aCommitFlags & SKIP_UNDO ) )
|
||||
undoList.PushItem( ITEM_PICKER( nullptr, boardItem, UNDO_REDO::NEWITEM ) );
|
||||
|
@ -355,6 +342,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, int aCommitFlags )
|
|||
|
||||
case CHT_REMOVE:
|
||||
{
|
||||
FOOTPRINT* parentFP = boardItem->GetParentFootprint();
|
||||
PCB_GROUP* parentGroup = boardItem->GetParentGroup();
|
||||
|
||||
if( !m_isFootprintEditor && !( aCommitFlags & SKIP_UNDO ) )
|
||||
|
@ -376,47 +364,16 @@ void BOARD_COMMIT::Push( const wxString& aMessage, int aCommitFlags )
|
|||
|
||||
switch( boardItem->Type() )
|
||||
{
|
||||
// Footprint items
|
||||
case PCB_TEXT_T:
|
||||
// don't allow deletion of Reference or Value
|
||||
if( static_cast<PCB_TEXT*>( boardItem )->GetType() != PCB_TEXT::TEXT_is_DIVERS )
|
||||
break;
|
||||
|
||||
KI_FALLTHROUGH;
|
||||
|
||||
case PCB_PAD_T:
|
||||
case PCB_FP_SHAPE_T:
|
||||
case PCB_FP_TEXT_T:
|
||||
case PCB_FP_TEXTBOX_T:
|
||||
case PCB_FP_DIM_ALIGNED_T:
|
||||
case PCB_FP_DIM_LEADER_T:
|
||||
case PCB_FP_DIM_CENTER_T:
|
||||
case PCB_FP_DIM_RADIAL_T:
|
||||
case PCB_FP_DIM_ORTHOGONAL_T:
|
||||
case PCB_FP_ZONE_T:
|
||||
// This level can only handle footprint children in the footprint editor as
|
||||
// only in that case has the entire footprint (and all its children) already
|
||||
// been saved for undo.
|
||||
wxASSERT( m_isFootprintEditor );
|
||||
|
||||
if( boardItem->Type() == PCB_FP_TEXT_T )
|
||||
{
|
||||
FP_TEXT* text = static_cast<FP_TEXT*>( boardItem );
|
||||
|
||||
// don't allow deletion of Reference or Value
|
||||
if( text->GetType() != FP_TEXT::TEXT_is_DIVERS )
|
||||
break;
|
||||
}
|
||||
|
||||
if( view )
|
||||
view->Remove( boardItem );
|
||||
|
||||
if( !( changeFlags & CHT_DONE ) )
|
||||
{
|
||||
FOOTPRINT* footprint = static_cast<FOOTPRINT*>( boardItem->GetParent() );
|
||||
wxASSERT( footprint && footprint->Type() == PCB_FOOTPRINT_T );
|
||||
footprint->Delete( boardItem );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// Board items
|
||||
case PCB_SHAPE_T: // a shape (normally not on copper layers)
|
||||
case PCB_BITMAP_T: // a bitmap on a user layer
|
||||
case PCB_TEXT_T: // a text on a layer
|
||||
case PCB_TEXTBOX_T: // a wrapped text on a 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)
|
||||
|
@ -434,8 +391,15 @@ void BOARD_COMMIT::Push( const wxString& aMessage, int aCommitFlags )
|
|||
|
||||
if( !( changeFlags & CHT_DONE ) )
|
||||
{
|
||||
board->Remove( boardItem, REMOVE_MODE::BULK );
|
||||
bulkRemovedItems.push_back( boardItem );
|
||||
if( parentFP )
|
||||
{
|
||||
parentFP->Delete( boardItem );
|
||||
}
|
||||
else
|
||||
{
|
||||
board->Remove( boardItem, REMOVE_MODE::BULK );
|
||||
bulkRemovedItems.push_back( boardItem );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -467,8 +431,10 @@ void BOARD_COMMIT::Push( const wxString& aMessage, int aCommitFlags )
|
|||
|
||||
if( !( changeFlags & CHT_DONE ) )
|
||||
{
|
||||
if( m_isFootprintEditor )
|
||||
board->GetFirstFootprint()->Remove( boardItem );
|
||||
if( parentFP )
|
||||
{
|
||||
parentFP->Remove( boardItem );
|
||||
}
|
||||
else
|
||||
{
|
||||
board->Remove( boardItem, REMOVE_MODE::BULK );
|
||||
|
@ -638,26 +604,10 @@ void BOARD_COMMIT::Push( const wxString& aMessage, int aCommitFlags )
|
|||
|
||||
EDA_ITEM* BOARD_COMMIT::parentObject( EDA_ITEM* aItem ) const
|
||||
{
|
||||
switch( aItem->Type() )
|
||||
if( BOARD_ITEM* boardItem = dynamic_cast<BOARD_ITEM*>( aItem ) )
|
||||
{
|
||||
case PCB_PAD_T:
|
||||
case PCB_FP_SHAPE_T:
|
||||
case PCB_FP_TEXT_T:
|
||||
case PCB_FP_TEXTBOX_T:
|
||||
case PCB_FP_DIM_ALIGNED_T:
|
||||
case PCB_FP_DIM_LEADER_T:
|
||||
case PCB_FP_DIM_CENTER_T:
|
||||
case PCB_FP_DIM_RADIAL_T:
|
||||
case PCB_FP_DIM_ORTHOGONAL_T:
|
||||
case PCB_FP_ZONE_T:
|
||||
return aItem->GetParent();
|
||||
|
||||
case PCB_ZONE_T:
|
||||
wxASSERT( !dynamic_cast<FOOTPRINT*>( aItem->GetParent() ) );
|
||||
return aItem;
|
||||
|
||||
default:
|
||||
break;
|
||||
if( FOOTPRINT* parentFP = boardItem->GetParentFootprint() )
|
||||
return parentFP;
|
||||
}
|
||||
|
||||
return aItem;
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <board.h>
|
||||
#include <board_design_settings.h>
|
||||
#include <pcb_group.h>
|
||||
#include <footprint.h>
|
||||
|
||||
|
||||
BOARD_ITEM::~BOARD_ITEM()
|
||||
|
@ -236,14 +237,45 @@ std::shared_ptr<SHAPE_SEGMENT> BOARD_ITEM::GetEffectiveHoleShape() const
|
|||
}
|
||||
|
||||
|
||||
BOARD_ITEM_CONTAINER* BOARD_ITEM::GetParentFootprint() const
|
||||
FOOTPRINT* BOARD_ITEM::GetParentFootprint() const
|
||||
{
|
||||
BOARD_ITEM_CONTAINER* ancestor = GetParent();
|
||||
|
||||
while( ancestor && ancestor->Type() == PCB_GROUP_T )
|
||||
ancestor = ancestor->GetParent();
|
||||
|
||||
return ( ancestor && ancestor->Type() == PCB_FOOTPRINT_T ) ? ancestor : nullptr;
|
||||
if( ancestor && ancestor->Type() == PCB_FOOTPRINT_T )
|
||||
return static_cast<FOOTPRINT*>( ancestor );
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
VECTOR2I BOARD_ITEM::GetFPRelativePosition() const
|
||||
{
|
||||
VECTOR2I pos = GetPosition();
|
||||
|
||||
if( FOOTPRINT* parentFP = GetParentFootprint() )
|
||||
{
|
||||
pos -= parentFP->GetPosition();
|
||||
RotatePoint( pos, -parentFP->GetOrientation() );
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
||||
void BOARD_ITEM::SetFPRelativePosition( const VECTOR2I& aPos )
|
||||
{
|
||||
VECTOR2I pos( aPos );
|
||||
|
||||
if( FOOTPRINT* parentFP = GetParentFootprint() )
|
||||
{
|
||||
RotatePoint( pos, parentFP->GetOrientation() );
|
||||
pos += parentFP->GetPosition();
|
||||
}
|
||||
|
||||
SetPosition( pos );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include <board_item.h> // class BOARD_ITEM
|
||||
|
||||
#include <footprint.h>
|
||||
#include <fp_shape.h>
|
||||
#include <pad.h>
|
||||
#include <pcb_track.h>
|
||||
#include <pcb_marker.h>
|
||||
|
@ -54,8 +53,6 @@ const std::vector<KICAD_T> GENERAL_COLLECTOR::AllBoardItems = {
|
|||
PCB_TRACE_T, // in m_tracks
|
||||
PCB_ARC_T, // in m_tracks
|
||||
PCB_PAD_T, // in footprints
|
||||
PCB_FP_TEXT_T, // in footprints
|
||||
PCB_FP_TEXTBOX_T, // in footprints
|
||||
PCB_FOOTPRINT_T, // in m_footprints
|
||||
PCB_GROUP_T, // in m_groups
|
||||
PCB_ZONE_T // in m_zones
|
||||
|
@ -98,16 +95,16 @@ const std::vector<KICAD_T> GENERAL_COLLECTOR::PadsOrTracks = {
|
|||
|
||||
const std::vector<KICAD_T> GENERAL_COLLECTOR::FootprintItems = {
|
||||
PCB_MARKER_T,
|
||||
PCB_FP_TEXT_T,
|
||||
PCB_FP_TEXTBOX_T,
|
||||
PCB_FP_SHAPE_T,
|
||||
PCB_FP_DIM_ALIGNED_T,
|
||||
PCB_FP_DIM_ORTHOGONAL_T,
|
||||
PCB_FP_DIM_CENTER_T,
|
||||
PCB_FP_DIM_RADIAL_T,
|
||||
PCB_FP_DIM_LEADER_T,
|
||||
PCB_TEXT_T,
|
||||
PCB_TEXTBOX_T,
|
||||
PCB_SHAPE_T,
|
||||
PCB_DIM_ALIGNED_T,
|
||||
PCB_DIM_ORTHOGONAL_T,
|
||||
PCB_DIM_CENTER_T,
|
||||
PCB_DIM_RADIAL_T,
|
||||
PCB_DIM_LEADER_T,
|
||||
PCB_PAD_T,
|
||||
PCB_FP_ZONE_T,
|
||||
PCB_ZONE_T,
|
||||
PCB_GROUP_T,
|
||||
PCB_BITMAP_T
|
||||
};
|
||||
|
@ -129,23 +126,12 @@ const std::vector<KICAD_T> GENERAL_COLLECTOR::LockableItems = {
|
|||
};
|
||||
|
||||
|
||||
const std::vector<KICAD_T> GENERAL_COLLECTOR::Zones = {
|
||||
PCB_ZONE_T,
|
||||
PCB_FP_ZONE_T
|
||||
};
|
||||
|
||||
|
||||
const std::vector<KICAD_T> GENERAL_COLLECTOR::Dimensions = {
|
||||
PCB_DIM_ALIGNED_T,
|
||||
PCB_DIM_LEADER_T,
|
||||
PCB_DIM_ORTHOGONAL_T,
|
||||
PCB_DIM_CENTER_T,
|
||||
PCB_DIM_RADIAL_T,
|
||||
PCB_FP_DIM_ALIGNED_T,
|
||||
PCB_FP_DIM_LEADER_T,
|
||||
PCB_FP_DIM_ORTHOGONAL_T,
|
||||
PCB_FP_DIM_CENTER_T,
|
||||
PCB_FP_DIM_RADIAL_T
|
||||
PCB_DIM_RADIAL_T
|
||||
};
|
||||
|
||||
|
||||
|
@ -159,8 +145,8 @@ const std::vector<KICAD_T> GENERAL_COLLECTOR::DraggableItems = {
|
|||
|
||||
INSPECT_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
|
||||
{
|
||||
BOARD_ITEM* item = (BOARD_ITEM*) testItem;
|
||||
FOOTPRINT* footprint = nullptr;
|
||||
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( testItem );
|
||||
FOOTPRINT* footprint = item->GetParentFootprint();
|
||||
PCB_GROUP* group = nullptr;
|
||||
PAD* pad = nullptr;
|
||||
bool pad_through = false;
|
||||
|
@ -208,19 +194,6 @@ INSPECT_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
|
|||
breakhere++;
|
||||
break;
|
||||
|
||||
case PCB_FP_TEXT_T:
|
||||
{
|
||||
FP_TEXT* fpText = (FP_TEXT*) item;
|
||||
|
||||
if( fpText->GetText() == wxT( "10uH" ) )
|
||||
breakhere++;
|
||||
}
|
||||
break;
|
||||
|
||||
case PCB_FP_TEXTBOX_T:
|
||||
breakhere++;
|
||||
break;
|
||||
|
||||
case PCB_FOOTPRINT_T:
|
||||
{
|
||||
FOOTPRINT* footprint = (FOOTPRINT*) item;
|
||||
|
@ -259,10 +232,6 @@ INSPECT_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
|
|||
// by leaving footprint==NULL, but having pad != null
|
||||
pad_through = true;
|
||||
}
|
||||
else // smd, so use pads test after footprint test
|
||||
{
|
||||
footprint = static_cast<FOOTPRINT*>( item->GetParent() );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
@ -277,31 +246,14 @@ INSPECT_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
|
|||
|
||||
break;
|
||||
|
||||
case PCB_FP_ZONE_T:
|
||||
footprint = static_cast<FOOTPRINT*>( item->GetParent() );
|
||||
|
||||
// Fallthrough to get the zone as well
|
||||
KI_FALLTHROUGH;
|
||||
|
||||
case PCB_ZONE_T:
|
||||
zone = static_cast<ZONE*>( item );
|
||||
break;
|
||||
|
||||
case PCB_TEXT_T:
|
||||
case PCB_TEXTBOX_T:
|
||||
case PCB_SHAPE_T:
|
||||
break;
|
||||
|
||||
case PCB_FP_DIM_ALIGNED_T:
|
||||
case PCB_FP_DIM_CENTER_T:
|
||||
case PCB_FP_DIM_RADIAL_T:
|
||||
case PCB_FP_DIM_ORTHOGONAL_T:
|
||||
case PCB_FP_DIM_LEADER_T:
|
||||
footprint = static_cast<FOOTPRINT*>( item->GetParent() );
|
||||
|
||||
// Fallthrough to get the zone as well
|
||||
KI_FALLTHROUGH;
|
||||
|
||||
case PCB_DIM_ALIGNED_T:
|
||||
case PCB_DIM_CENTER_T:
|
||||
case PCB_DIM_RADIAL_T:
|
||||
|
@ -313,63 +265,51 @@ INSPECT_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
|
|||
case PCB_TARGET_T:
|
||||
break;
|
||||
|
||||
case PCB_FP_TEXT_T:
|
||||
case PCB_FP_TEXTBOX_T:
|
||||
{
|
||||
PCB_LAYER_ID layer = item->GetLayer();
|
||||
|
||||
if( m_Guide->IgnoreHiddenFPText() && item->Type() == PCB_FP_TEXT_T )
|
||||
case PCB_TEXT_T:
|
||||
if( item->GetParentFootprint() )
|
||||
{
|
||||
FP_TEXT *text = static_cast<FP_TEXT*>( item );
|
||||
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
|
||||
PCB_LAYER_ID layer = item->GetLayer();
|
||||
|
||||
if( !text->IsVisible() )
|
||||
if( m_Guide->IgnoreHiddenFPText() )
|
||||
{
|
||||
if( !text->IsVisible() )
|
||||
return INSPECT_RESULT::CONTINUE;
|
||||
}
|
||||
|
||||
if( m_Guide->IgnoreFPTextOnBack() && IsBackLayer( layer ) )
|
||||
return INSPECT_RESULT::CONTINUE;
|
||||
|
||||
if( m_Guide->IgnoreFPTextOnFront() && IsFrontLayer( layer ) )
|
||||
return INSPECT_RESULT::CONTINUE;
|
||||
|
||||
/*
|
||||
* The three text types have different criteria: reference and value have their own
|
||||
* ignore flags; user text instead follows their layer visibility. Checking this here
|
||||
* is simpler than later (when layer visibility is checked for other entities)
|
||||
*/
|
||||
switch( text->GetType() )
|
||||
{
|
||||
case PCB_TEXT::TEXT_is_REFERENCE:
|
||||
if( m_Guide->IgnoreFPReferences() )
|
||||
return INSPECT_RESULT::CONTINUE;
|
||||
|
||||
break;
|
||||
|
||||
case PCB_TEXT::TEXT_is_VALUE:
|
||||
if( m_Guide->IgnoreFPValues() )
|
||||
return INSPECT_RESULT::CONTINUE;
|
||||
|
||||
break;
|
||||
|
||||
case PCB_TEXT::TEXT_is_DIVERS:
|
||||
if( !m_Guide->IsLayerVisible( layer ) )
|
||||
return INSPECT_RESULT::CONTINUE;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( m_Guide->IgnoreFPTextOnBack() && IsBackLayer( layer ) )
|
||||
return INSPECT_RESULT::CONTINUE;
|
||||
|
||||
if( m_Guide->IgnoreFPTextOnFront() && IsFrontLayer( layer ) )
|
||||
return INSPECT_RESULT::CONTINUE;
|
||||
|
||||
/*
|
||||
* The three text types have different criteria: reference and value have their own
|
||||
* ignore flags; user text instead follows their layer visibility. Checking this here
|
||||
* is simpler than later (when layer visibility is checked for other entities)
|
||||
*/
|
||||
|
||||
FP_TEXT::TEXT_TYPE textType = FP_TEXT::TEXT_is_DIVERS;
|
||||
|
||||
if( item->Type() == PCB_FP_TEXT_T )
|
||||
textType = static_cast<FP_TEXT*>( item )->GetType();
|
||||
|
||||
switch( textType )
|
||||
{
|
||||
case FP_TEXT::TEXT_is_REFERENCE:
|
||||
if( m_Guide->IgnoreFPReferences() )
|
||||
return INSPECT_RESULT::CONTINUE;
|
||||
|
||||
break;
|
||||
|
||||
case FP_TEXT::TEXT_is_VALUE:
|
||||
if( m_Guide->IgnoreFPValues() )
|
||||
return INSPECT_RESULT::CONTINUE;
|
||||
|
||||
break;
|
||||
|
||||
case FP_TEXT::TEXT_is_DIVERS:
|
||||
if( !m_Guide->IsLayerVisible( layer ) )
|
||||
return INSPECT_RESULT::CONTINUE;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// Extract the footprint since it could be hidden
|
||||
footprint = static_cast<FOOTPRINT*>( item->GetParent() );
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_FP_SHAPE_T:
|
||||
break;
|
||||
|
||||
case PCB_FOOTPRINT_T:
|
||||
|
@ -390,7 +330,7 @@ INSPECT_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
|
|||
|
||||
// common tests:
|
||||
|
||||
if( footprint ) // true from case PCB_PAD_T, PCB_FP_TEXT_T, or PCB_FOOTPRINT_T
|
||||
if( footprint )
|
||||
{
|
||||
if( m_Guide->IgnoreFootprintsOnBack() && ( footprint->GetLayer() == B_Cu ) )
|
||||
return INSPECT_RESULT::CONTINUE;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2007-2008 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -230,7 +230,7 @@ public:
|
|||
|
||||
/**
|
||||
* A scan list for all primary board items, omitting items which are subordinate to
|
||||
* a FOOTPRINT, such as PAD and FP_TEXT.
|
||||
* a FOOTPRINT, such as PAD and PCB_TEXT.
|
||||
*/
|
||||
static const std::vector<KICAD_T> BoardLevelItems;
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ bool CN_CONNECTIVITY_ALGO::Add( BOARD_ITEM* aItem )
|
|||
|
||||
case PCB_PAD_T:
|
||||
{
|
||||
if( FOOTPRINT* fp = dynamic_cast<FOOTPRINT*>( aItem->GetParentFootprint() ) )
|
||||
if( FOOTPRINT* fp = aItem->GetParentFootprint() )
|
||||
{
|
||||
if( fp->GetAttributes() & FP_JUST_ADDED )
|
||||
return false;
|
||||
|
|
|
@ -622,8 +622,8 @@ bool BuildBoardPolygonOutlines( BOARD* aBoard, SHAPE_POLY_SET& aOutlines, int aE
|
|||
|
||||
SHAPE_POLY_SET fpHoles;
|
||||
|
||||
// Get all the PCB and FP shapes into 'items', then keep only those on layer == Edge_Cuts.
|
||||
items.Collect( aBoard, { PCB_SHAPE_T, PCB_FP_SHAPE_T } );
|
||||
// Get all the shapes into 'items', then keep only those on layer == Edge_Cuts.
|
||||
items.Collect( aBoard, { PCB_SHAPE_T } );
|
||||
|
||||
for( int ii = 0; ii < items.GetCount(); ++ii )
|
||||
items[ii]->ClearFlags( SKIP_STRUCT );
|
||||
|
@ -631,7 +631,7 @@ bool BuildBoardPolygonOutlines( BOARD* aBoard, SHAPE_POLY_SET& aOutlines, int aE
|
|||
for( FOOTPRINT* fp : aBoard->Footprints() )
|
||||
{
|
||||
PCB_TYPE_COLLECTOR fpItems;
|
||||
fpItems.Collect( fp, { PCB_SHAPE_T, PCB_FP_SHAPE_T } );
|
||||
fpItems.Collect( fp, { PCB_SHAPE_T } );
|
||||
|
||||
std::vector<PCB_SHAPE*> fpSegList;
|
||||
|
||||
|
@ -881,7 +881,7 @@ bool BuildFootprintPolygonOutlines( BOARD* aBoard, SHAPE_POLY_SET& aOutlines, in
|
|||
bool success = false;
|
||||
|
||||
// Get all the SHAPEs into 'items', then keep only those on layer == Edge_Cuts.
|
||||
items.Collect( aBoard, { PCB_SHAPE_T, PCB_FP_SHAPE_T } );
|
||||
items.Collect( aBoard, { PCB_SHAPE_T } );
|
||||
|
||||
// Make a working copy of aSegList, because the list is modified during calculations
|
||||
std::vector<PCB_SHAPE*> segList;
|
||||
|
|
|
@ -257,39 +257,38 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
|
|||
|
||||
std::string FormatProbeItem( BOARD_ITEM* aItem )
|
||||
{
|
||||
FOOTPRINT* footprint;
|
||||
|
||||
if( !aItem )
|
||||
return "$CLEAR: \"HIGHLIGHTED\""; // message to clear highlight state
|
||||
|
||||
switch( aItem->Type() )
|
||||
{
|
||||
case PCB_FOOTPRINT_T:
|
||||
footprint = (FOOTPRINT*) aItem;
|
||||
{
|
||||
FOOTPRINT* footprint = static_cast<FOOTPRINT*>( aItem );
|
||||
return StrPrintf( "$PART: \"%s\"", TO_UTF8( footprint->GetReference() ) );
|
||||
}
|
||||
|
||||
case PCB_PAD_T:
|
||||
{
|
||||
footprint = static_cast<FOOTPRINT*>( aItem->GetParent() );
|
||||
wxString pad = static_cast<PAD*>( aItem )->GetNumber();
|
||||
PAD* pad = static_cast<PAD*>( aItem );
|
||||
FOOTPRINT* footprint = pad->GetParentFootprint();
|
||||
|
||||
return StrPrintf( "$PART: \"%s\" $PAD: \"%s\"",
|
||||
TO_UTF8( footprint->GetReference() ),
|
||||
TO_UTF8( pad ) );
|
||||
TO_UTF8( pad->GetNumber() ) );
|
||||
}
|
||||
|
||||
case PCB_FP_TEXT_T:
|
||||
case PCB_TEXT_T:
|
||||
{
|
||||
footprint = static_cast<FOOTPRINT*>( aItem->GetParent() );
|
||||
|
||||
FP_TEXT* text = static_cast<FP_TEXT*>( aItem );
|
||||
PCB_TEXT* text = static_cast<PCB_TEXT*>( aItem );
|
||||
FOOTPRINT* footprint = text->GetParentFootprint();
|
||||
const char* text_key;
|
||||
|
||||
/* This can't be a switch since the break need to pull out
|
||||
* from the outer switch! */
|
||||
if( text->GetType() == FP_TEXT::TEXT_is_REFERENCE )
|
||||
if( text->GetType() == PCB_TEXT::TEXT_is_REFERENCE )
|
||||
text_key = "$REF:";
|
||||
else if( text->GetType() == FP_TEXT::TEXT_is_VALUE )
|
||||
else if( text->GetType() == PCB_TEXT::TEXT_is_VALUE )
|
||||
text_key = "$VAL:";
|
||||
else
|
||||
break;
|
||||
|
@ -335,9 +334,8 @@ void collectItemsForSyncParts( ItemContainer& aItems, std::set<wxString>& parts
|
|||
|
||||
case PCB_PAD_T:
|
||||
{
|
||||
PAD* pad = static_cast<PAD*>( item );
|
||||
FOOTPRINT* footprint = static_cast<FOOTPRINT*>( pad->GetParentFootprint() );
|
||||
wxString ref = footprint->GetReference();
|
||||
PAD* pad = static_cast<PAD*>( item );
|
||||
wxString ref = pad->GetParentFootprint()->GetReference();
|
||||
|
||||
parts.emplace( wxT( "P" ) + EscapeString( ref, CTX_IPC ) + wxT( "/" )
|
||||
+ EscapeString( pad->GetNumber(), CTX_IPC ) );
|
||||
|
|
|
@ -56,7 +56,6 @@ DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES( PCB_BASE_EDIT_FRAME* a
|
|||
switch( m_dimension->Type() )
|
||||
{
|
||||
case PCB_DIM_LEADER_T:
|
||||
case PCB_FP_DIM_LEADER_T:
|
||||
// Hide the main format controls and keep the leader controls shown
|
||||
m_sizerFormat->GetStaticBox()->Hide();
|
||||
m_sizerCenter->GetStaticBox()->Hide();
|
||||
|
@ -70,7 +69,6 @@ DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES( PCB_BASE_EDIT_FRAME* a
|
|||
break;
|
||||
|
||||
case PCB_DIM_CENTER_T:
|
||||
case PCB_FP_DIM_CENTER_T:
|
||||
m_sizerLeader->GetStaticBox()->Hide();
|
||||
m_sizerFormat->GetStaticBox()->Hide();
|
||||
m_sizerText->GetStaticBox()->Hide();
|
||||
|
@ -275,7 +273,7 @@ bool DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow()
|
|||
m_txtValueActual->SetValue( m_dimension->GetValueText() );
|
||||
}
|
||||
|
||||
if( m_dimension->Type() == PCB_DIM_LEADER_T || m_dimension->Type() == PCB_FP_DIM_LEADER_T )
|
||||
if( m_dimension->Type() == PCB_DIM_LEADER_T )
|
||||
{
|
||||
PCB_DIM_LEADER* leader = static_cast<PCB_DIM_LEADER*>( m_dimension );
|
||||
m_cbTextFrame->SetSelection( static_cast<int>( leader->GetTextBorder() ) );
|
||||
|
@ -428,7 +426,7 @@ void DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog( PCB_DIMENSION_BASE*
|
|||
aTarget->SetArrowLength( m_arrowLength.GetValue() );
|
||||
aTarget->SetExtensionOffset( m_extensionOffset.GetValue() );
|
||||
|
||||
if( aTarget->Type() == PCB_DIM_LEADER_T || m_dimension->Type() == PCB_FP_DIM_LEADER_T )
|
||||
if( aTarget->Type() == PCB_DIM_LEADER_T )
|
||||
{
|
||||
PCB_DIM_LEADER* leader = static_cast<PCB_DIM_LEADER*>( aTarget );
|
||||
leader->SetTextBorder( static_cast<DIM_TEXT_BORDER>( m_cbTextFrame->GetSelection()));
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include <pcb_marker.h>
|
||||
#include <footprint.h>
|
||||
#include <pcb_text.h>
|
||||
#include <fp_text.h>
|
||||
#include <zone.h>
|
||||
#include <dialog_find.h>
|
||||
#include <string_utils.h>
|
||||
|
@ -267,12 +266,12 @@ void DIALOG_FIND::search( bool aDirection )
|
|||
{
|
||||
for( BOARD_ITEM* item : fp->GraphicalItems() )
|
||||
{
|
||||
FP_TEXT* textItem = dynamic_cast<FP_TEXT*>( item );
|
||||
|
||||
if( textItem && textItem->Matches( m_frame->GetFindReplaceData(),
|
||||
nullptr ) )
|
||||
if( item->Type() == PCB_TEXT_T )
|
||||
{
|
||||
m_hitList.push_back( fp );
|
||||
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
|
||||
|
||||
if( text && text->Matches( m_frame->GetFindReplaceData(), nullptr ) )
|
||||
m_hitList.push_back( fp );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -282,22 +281,21 @@ void DIALOG_FIND::search( bool aDirection )
|
|||
{
|
||||
for( BOARD_ITEM* item : board->Drawings() )
|
||||
{
|
||||
PCB_TEXT* textItem = dynamic_cast<PCB_TEXT*>( item );
|
||||
|
||||
if( textItem && textItem->Matches( m_frame->GetFindReplaceData(), nullptr ) )
|
||||
if( item->Type() == PCB_TEXT_T )
|
||||
{
|
||||
m_hitList.push_back( textItem );
|
||||
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
|
||||
|
||||
if( text && text->Matches( m_frame->GetFindReplaceData(), nullptr ) )
|
||||
m_hitList.push_back( text );
|
||||
}
|
||||
}
|
||||
|
||||
for( BOARD_ITEM* item : board->Zones() )
|
||||
{
|
||||
ZONE* zoneItem = dynamic_cast<ZONE*>( item );
|
||||
ZONE* zone = static_cast<ZONE*>( item );
|
||||
|
||||
if( zoneItem && zoneItem->Matches( m_frame->GetFindReplaceData(), nullptr ) )
|
||||
{
|
||||
m_hitList.push_back( zoneItem );
|
||||
}
|
||||
if( zone->Matches( m_frame->GetFindReplaceData(), nullptr ) )
|
||||
m_hitList.push_back( zone );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -316,9 +314,7 @@ void DIALOG_FIND::search( bool aDirection )
|
|||
for( NETINFO_ITEM* net : board->GetNetInfo() )
|
||||
{
|
||||
if( net && net->Matches( m_frame->GetFindReplaceData(), nullptr ) )
|
||||
{
|
||||
m_hitList.push_back( net );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2015 Dick Hollenbeck, dick@softplc.com
|
||||
* Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -250,9 +250,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow()
|
|||
|
||||
for( BOARD_ITEM* item : m_footprint->GraphicalItems() )
|
||||
{
|
||||
FP_TEXT* textItem = dyn_cast<FP_TEXT*>( item );
|
||||
|
||||
if( textItem )
|
||||
if( PCB_TEXT* textItem = dynamic_cast<PCB_TEXT*>( item ) )
|
||||
m_texts->push_back( *textItem );
|
||||
}
|
||||
|
||||
|
@ -349,7 +347,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES::Validate()
|
|||
// Validate texts.
|
||||
for( size_t i = 0; i < m_texts->size(); ++i )
|
||||
{
|
||||
FP_TEXT& text = m_texts->at( i );
|
||||
PCB_TEXT& text = m_texts->at( i );
|
||||
|
||||
if( i >= 2 )
|
||||
{
|
||||
|
@ -478,9 +476,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow()
|
|||
|
||||
for( BOARD_ITEM* item : m_footprint->GraphicalItems() )
|
||||
{
|
||||
FP_TEXT* textItem = dyn_cast<FP_TEXT*>( item );
|
||||
|
||||
if( textItem )
|
||||
if( PCB_TEXT* textItem = dynamic_cast<PCB_TEXT*>( item ) )
|
||||
{
|
||||
// copy grid table entries till we run out, then delete any remaining texts
|
||||
if( i < m_texts->size() )
|
||||
|
@ -493,7 +489,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow()
|
|||
// if there are still grid table entries, create new texts for them
|
||||
while( i < m_texts->size() )
|
||||
{
|
||||
auto newText = new FP_TEXT( m_texts->at( i++ ) );
|
||||
PCB_TEXT* newText = new PCB_TEXT( m_texts->at( i++ ) );
|
||||
m_footprint->Add( newText, ADD_MODE::APPEND );
|
||||
view->Add( newText );
|
||||
}
|
||||
|
@ -583,7 +579,7 @@ void DIALOG_FOOTPRINT_PROPERTIES::OnAddField( wxCommandEvent& )
|
|||
return;
|
||||
|
||||
const BOARD_DESIGN_SETTINGS& dsnSettings = m_frame->GetDesignSettings();
|
||||
FP_TEXT textItem( m_footprint );
|
||||
PCB_TEXT textItem( m_footprint, PCB_TEXT::TEXT_is_DIVERS );
|
||||
|
||||
// Set active layer if legal; otherwise copy layer from previous text item
|
||||
if( LSET::AllTechMask().test( m_frame->GetActiveLayer() ) )
|
||||
|
|
|
@ -274,9 +274,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow()
|
|||
|
||||
for( BOARD_ITEM* item : m_footprint->GraphicalItems() )
|
||||
{
|
||||
FP_TEXT* textItem = dyn_cast<FP_TEXT*>( item );
|
||||
|
||||
if( textItem )
|
||||
if( PCB_TEXT* textItem = dynamic_cast<PCB_TEXT*>( item) )
|
||||
m_texts->push_back( *textItem );
|
||||
}
|
||||
|
||||
|
@ -406,7 +404,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::Validate()
|
|||
// Check for empty texts.
|
||||
for( size_t i = 2; i < m_texts->size(); ++i )
|
||||
{
|
||||
FP_TEXT& text = m_texts->at( i );
|
||||
PCB_TEXT& text = m_texts->at( i );
|
||||
|
||||
if( text.GetText().IsEmpty() )
|
||||
{
|
||||
|
@ -506,11 +504,11 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataFromWindow()
|
|||
m_footprint->Value() = m_texts->at( 1 );
|
||||
|
||||
size_t i = 2;
|
||||
std::vector<FP_TEXT*> items_to_remove;
|
||||
std::vector<PCB_TEXT*> items_to_remove;
|
||||
|
||||
for( BOARD_ITEM* item : m_footprint->GraphicalItems() )
|
||||
{
|
||||
FP_TEXT* textItem = dynamic_cast<FP_TEXT*>( item );
|
||||
PCB_TEXT* textItem = dynamic_cast<PCB_TEXT*>( item );
|
||||
|
||||
if( textItem )
|
||||
{
|
||||
|
@ -526,7 +524,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataFromWindow()
|
|||
// Remove text items:
|
||||
PCB_SELECTION_TOOL* selTool = m_frame->GetToolManager()->GetTool<PCB_SELECTION_TOOL>();
|
||||
|
||||
for( FP_TEXT* item: items_to_remove )
|
||||
for( PCB_TEXT* item: items_to_remove )
|
||||
{
|
||||
selTool->RemoveItemFromSel( item );
|
||||
view->Remove( item );
|
||||
|
@ -536,7 +534,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataFromWindow()
|
|||
// if there are still grid table entries, create new texts for them
|
||||
while( i < m_texts->size() )
|
||||
{
|
||||
FP_TEXT* newText = new FP_TEXT( m_texts->at( i++ ) );
|
||||
PCB_TEXT* newText = new PCB_TEXT( m_texts->at( i++ ) );
|
||||
m_footprint->Add( newText, ADD_MODE::APPEND );
|
||||
view->Add( newText );
|
||||
}
|
||||
|
@ -632,7 +630,7 @@ void DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnAddField( wxCommandEvent& event )
|
|||
return;
|
||||
|
||||
const BOARD_DESIGN_SETTINGS& dsnSettings = m_frame->GetDesignSettings();
|
||||
FP_TEXT textItem( m_footprint );
|
||||
PCB_TEXT textItem( m_footprint );
|
||||
|
||||
// Set active layer if legal; otherwise copy layer from previous text item
|
||||
if( LSET::AllTechMask().test( m_frame->GetActiveLayer() ) )
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include <footprint.h>
|
||||
#include <pcb_group.h>
|
||||
#include <pcb_dimension.h>
|
||||
#include <fp_shape.h>
|
||||
#include <pcb_shape.h>
|
||||
#include <pcb_text.h>
|
||||
#include <widgets/unit_binder.h>
|
||||
#include <widgets/font_choice.h>
|
||||
|
@ -41,7 +41,6 @@
|
|||
#include <tools/global_edit_tool.h>
|
||||
#include <tools/footprint_editor_control.h>
|
||||
#include <dialog_global_edit_text_and_graphics_base.h>
|
||||
#include "font/kicad_font_name.h"
|
||||
|
||||
// Columns of layer classes grid
|
||||
enum
|
||||
|
@ -338,60 +337,58 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( BOARD_COMMIT& aCommit, B
|
|||
{
|
||||
aCommit.Modify( aItem );
|
||||
|
||||
EDA_TEXT* edaText = dynamic_cast<EDA_TEXT*>( aItem );
|
||||
FP_TEXT* fpText = dynamic_cast<FP_TEXT*>( aItem );
|
||||
PCB_TEXT* text = dynamic_cast<PCB_TEXT*>( aItem );
|
||||
PCB_SHAPE* shape = dynamic_cast<PCB_SHAPE*>( aItem );
|
||||
PCB_DIMENSION_BASE* dimension = dynamic_cast<PCB_DIMENSION_BASE*>( aItem );
|
||||
FOOTPRINT* parentFP = aItem->GetParentFootprint();
|
||||
|
||||
if( m_setToSpecifiedValues->GetValue() )
|
||||
{
|
||||
if( m_LayerCtrl->GetLayerSelection() != UNDEFINED_LAYER )
|
||||
aItem->SetLayer( ToLAYER_ID( m_LayerCtrl->GetLayerSelection() ) );
|
||||
|
||||
if( edaText )
|
||||
if( text )
|
||||
{
|
||||
if( !m_textWidth.IsIndeterminate() )
|
||||
edaText->SetTextSize( VECTOR2I( m_textWidth.GetValue(), edaText->GetTextSize().y ) );
|
||||
text->SetTextSize( VECTOR2I( m_textWidth.GetValue(), text->GetTextSize().y ) );
|
||||
|
||||
if( !m_textHeight.IsIndeterminate() )
|
||||
edaText->SetTextSize( VECTOR2I( edaText->GetTextSize().x, m_textHeight.GetValue() ) );
|
||||
text->SetTextSize( VECTOR2I( text->GetTextSize().x, m_textHeight.GetValue() ) );
|
||||
|
||||
if( !m_thickness.IsIndeterminate() )
|
||||
edaText->SetTextThickness( m_thickness.GetValue() );
|
||||
text->SetTextThickness( m_thickness.GetValue() );
|
||||
|
||||
if( m_bold->Get3StateValue() != wxCHK_UNDETERMINED )
|
||||
edaText->SetBold( m_bold->GetValue() );
|
||||
text->SetBold( m_bold->GetValue() );
|
||||
|
||||
if( m_italic->Get3StateValue() != wxCHK_UNDETERMINED )
|
||||
edaText->SetItalic( m_italic->GetValue() );
|
||||
text->SetItalic( m_italic->GetValue() );
|
||||
|
||||
// Must come after setting bold & italic
|
||||
if( m_fontCtrl->GetStringSelection() != INDETERMINATE_ACTION )
|
||||
{
|
||||
edaText->SetFont( m_fontCtrl->GetFontSelection( edaText->IsBold(),
|
||||
edaText->IsItalic() ) );
|
||||
text->SetFont( m_fontCtrl->GetFontSelection( text->IsBold(), text->IsItalic() ) );
|
||||
}
|
||||
else if(( m_italic->Get3StateValue() != wxCHK_UNDETERMINED
|
||||
|| m_bold->Get3StateValue() != wxCHK_UNDETERMINED ) )
|
||||
{
|
||||
wxString fontName = edaText->GetFontName();
|
||||
wxString fontName = text->GetFontName();
|
||||
|
||||
if( !edaText->GetFontName().IsEmpty() )
|
||||
if( !text->GetFontName().IsEmpty() )
|
||||
{
|
||||
edaText->SetFont( KIFONT::FONT::GetFont( edaText->GetFontName(),
|
||||
edaText->IsBold(),
|
||||
edaText->IsItalic() ) );
|
||||
text->SetFont( KIFONT::FONT::GetFont( text->GetFontName(), text->IsBold(),
|
||||
text->IsItalic() ) );
|
||||
}
|
||||
}
|
||||
|
||||
if( m_visible->Get3StateValue() != wxCHK_UNDETERMINED )
|
||||
edaText->SetVisible( m_visible->GetValue() );
|
||||
}
|
||||
if( parentFP )
|
||||
{
|
||||
if( m_visible->Get3StateValue() != wxCHK_UNDETERMINED )
|
||||
text->SetVisible( m_visible->GetValue() );
|
||||
|
||||
if( fpText )
|
||||
{
|
||||
if( m_keepUpright->Get3StateValue() != wxCHK_UNDETERMINED )
|
||||
fpText->SetKeepUpright( m_keepUpright->GetValue() );
|
||||
if( m_keepUpright->Get3StateValue() != wxCHK_UNDETERMINED )
|
||||
text->SetKeepUpright( m_keepUpright->GetValue() );
|
||||
}
|
||||
}
|
||||
|
||||
if( !m_lineWidth.IsIndeterminate() )
|
||||
|
@ -411,15 +408,15 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( BOARD_COMMIT& aCommit, B
|
|||
{
|
||||
PCB_LAYER_ID layer = aItem->GetLayer();
|
||||
|
||||
if( edaText )
|
||||
if( text )
|
||||
{
|
||||
edaText->SetTextSize( m_brdSettings->GetTextSize( layer ) );
|
||||
edaText->SetTextThickness( m_brdSettings->GetTextThickness( layer ) );
|
||||
edaText->SetItalic( m_brdSettings->GetTextItalic( layer ) );
|
||||
}
|
||||
text->SetTextSize( m_brdSettings->GetTextSize( layer ) );
|
||||
text->SetTextThickness( m_brdSettings->GetTextThickness( layer ) );
|
||||
text->SetItalic( m_brdSettings->GetTextItalic( layer ) );
|
||||
|
||||
if( fpText )
|
||||
fpText->SetKeepUpright( m_brdSettings->GetTextUpright( layer ) );
|
||||
if( parentFP )
|
||||
text->SetKeepUpright( m_brdSettings->GetTextUpright( layer ) );
|
||||
}
|
||||
|
||||
if( shape )
|
||||
{
|
||||
|
@ -477,9 +474,7 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( BOARD_COMMIT& aCommit, BOA
|
|||
{
|
||||
if( m_referenceFilterOpt->GetValue() && !m_referenceFilter->GetValue().IsEmpty() )
|
||||
{
|
||||
FOOTPRINT* fp = dynamic_cast<FOOTPRINT*>( aItem->GetParent() );
|
||||
|
||||
if( fp )
|
||||
if( FOOTPRINT* fp = aItem->GetParentFootprint() )
|
||||
{
|
||||
if( !WildCompareString( m_referenceFilter->GetValue(), fp->GetReference(), false ) )
|
||||
return;
|
||||
|
@ -488,9 +483,7 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( BOARD_COMMIT& aCommit, BOA
|
|||
|
||||
if( m_footprintFilterOpt->GetValue() && !m_footprintFilter->GetValue().IsEmpty() )
|
||||
{
|
||||
FOOTPRINT* fp = dynamic_cast<FOOTPRINT*>( aItem->GetParent() );
|
||||
|
||||
if( fp )
|
||||
if( FOOTPRINT* fp = aItem->GetParentFootprint() )
|
||||
{
|
||||
if( !WildCompareString( m_footprintFilter->GetValue(), fp->GetFPID().Format(), false ) )
|
||||
return;
|
||||
|
@ -526,7 +519,7 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow()
|
|||
{
|
||||
KICAD_T itemType = boardItem->Type();
|
||||
|
||||
if( itemType == PCB_FP_TEXT_T || itemType == PCB_FP_TEXTBOX_T )
|
||||
if( itemType == PCB_TEXT_T || itemType == PCB_TEXTBOX_T )
|
||||
{
|
||||
if( m_otherFields->GetValue() )
|
||||
visitItem( commit, boardItem );
|
||||
|
@ -536,7 +529,7 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow()
|
|||
if( m_footprintDimensions->GetValue() )
|
||||
visitItem( commit, boardItem );
|
||||
}
|
||||
else if( itemType == PCB_FP_SHAPE_T )
|
||||
else if( itemType == PCB_SHAPE_T )
|
||||
{
|
||||
if( m_footprintGraphics->GetValue() )
|
||||
visitItem( commit, boardItem );
|
||||
|
|
|
@ -35,9 +35,7 @@
|
|||
#include <tool/tool_manager.h>
|
||||
#include <tool/actions.h>
|
||||
#include <pcb_shape.h>
|
||||
#include <fp_shape.h>
|
||||
#include <macros.h>
|
||||
#include <confirm.h>
|
||||
#include <widgets/unit_binder.h>
|
||||
|
||||
#include <dialog_graphic_item_properties_base.h>
|
||||
|
@ -47,7 +45,7 @@
|
|||
class DIALOG_GRAPHIC_ITEM_PROPERTIES : public DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BOARD_ITEM* aItem );
|
||||
DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, PCB_SHAPE* aShape );
|
||||
~DIALOG_GRAPHIC_ITEM_PROPERTIES() {};
|
||||
|
||||
private:
|
||||
|
@ -70,7 +68,6 @@ private:
|
|||
private:
|
||||
PCB_BASE_EDIT_FRAME* m_parent;
|
||||
PCB_SHAPE* m_item;
|
||||
FP_SHAPE* m_fp_item;
|
||||
|
||||
UNIT_BINDER m_startX, m_startY;
|
||||
UNIT_BINDER m_endX, m_endY;
|
||||
|
@ -83,8 +80,10 @@ private:
|
|||
};
|
||||
|
||||
DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent,
|
||||
BOARD_ITEM* aItem ):
|
||||
PCB_SHAPE* aShape ):
|
||||
DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( aParent ),
|
||||
m_parent( aParent ),
|
||||
m_item( aShape ),
|
||||
m_startX( aParent, m_startXLabel, m_startXCtrl, m_startXUnits ),
|
||||
m_startY( aParent, m_startYLabel, m_startYCtrl, m_startYUnits ),
|
||||
m_endX( aParent, m_endXLabel, m_endXCtrl, m_endXUnits ),
|
||||
|
@ -97,10 +96,6 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FR
|
|||
m_bezierCtrl2Y( aParent, m_BezierPointC2YLabel, m_BezierC2Y_Ctrl, m_BezierPointC2YUnit ),
|
||||
m_flipStartEnd( false )
|
||||
{
|
||||
m_parent = aParent;
|
||||
m_item = dynamic_cast<PCB_SHAPE*>( aItem );
|
||||
m_fp_item = dynamic_cast<FP_SHAPE*>( aItem );
|
||||
|
||||
// Configure display origin transforms
|
||||
m_startX.SetCoordType( ORIGIN_TRANSFORMS::ABS_X_COORD );
|
||||
m_startY.SetCoordType( ORIGIN_TRANSFORMS::ABS_Y_COORD );
|
||||
|
@ -117,13 +112,13 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FR
|
|||
m_locked->Show( dynamic_cast<PCB_EDIT_FRAME*>( aParent ) != nullptr );
|
||||
|
||||
// Configure the layers list selector
|
||||
if( m_fp_item )
|
||||
if( m_parent->GetFrameType() == FRAME_FOOTPRINT_EDITOR )
|
||||
{
|
||||
LSET forbiddenLayers = LSET::ForbiddenFootprintLayers();
|
||||
|
||||
// If someone went to the trouble of setting the layer in a text editor, then there's
|
||||
// very little sense in nagging them about it.
|
||||
forbiddenLayers.set( m_fp_item->GetLayer(), false );
|
||||
forbiddenLayers.set( m_item->GetLayer(), false );
|
||||
|
||||
m_LayerSelectionCtrl->SetNotAllowedLayerSet( forbiddenLayers );
|
||||
}
|
||||
|
@ -143,18 +138,18 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FR
|
|||
}
|
||||
|
||||
|
||||
void PCB_BASE_EDIT_FRAME::ShowGraphicItemPropertiesDialog( BOARD_ITEM* aItem )
|
||||
void PCB_BASE_EDIT_FRAME::ShowGraphicItemPropertiesDialog( PCB_SHAPE* aShape )
|
||||
{
|
||||
wxCHECK_RET( aItem != NULL, wxT( "ShowGraphicItemPropertiesDialog() error: NULL item" ) );
|
||||
wxCHECK_RET( aShape != NULL, wxT( "ShowGraphicItemPropertiesDialog() error: NULL item" ) );
|
||||
|
||||
DIALOG_GRAPHIC_ITEM_PROPERTIES dlg( this, aItem );
|
||||
DIALOG_GRAPHIC_ITEM_PROPERTIES dlg( this, aShape );
|
||||
|
||||
if( dlg.ShowQuasiModal() == wxID_OK )
|
||||
{
|
||||
if( aItem->IsOnLayer( GetActiveLayer(), true ) )
|
||||
if( aShape->IsOnLayer( GetActiveLayer(), true ) )
|
||||
{
|
||||
DRAWING_TOOL* drawingTool = m_toolManager->GetTool<DRAWING_TOOL>();
|
||||
drawingTool->SetStroke( aItem->GetStroke(), GetActiveLayer() );
|
||||
drawingTool->SetStroke( aShape->GetStroke(), GetActiveLayer() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -363,22 +358,6 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
|
|||
m_item->SetCenter( c );
|
||||
}
|
||||
|
||||
if( m_fp_item )
|
||||
{
|
||||
// We are editing a footprint; init the item coordinates relative to the footprint anchor.
|
||||
m_fp_item->SetStart0( m_fp_item->GetStart() );
|
||||
m_fp_item->SetEnd0( m_fp_item->GetEnd() );
|
||||
|
||||
if( m_fp_item->GetShape() == SHAPE_T::ARC )
|
||||
m_fp_item->SetCenter0( m_fp_item->GetCenter() );
|
||||
|
||||
if( m_fp_item->GetShape() == SHAPE_T::BEZIER )
|
||||
{
|
||||
m_fp_item->SetBezierC1_0( m_fp_item->GetBezierC1() );
|
||||
m_fp_item->SetBezierC2_0( m_fp_item->GetBezierC2() );
|
||||
}
|
||||
}
|
||||
|
||||
bool wasLocked = m_item->IsLocked();
|
||||
|
||||
m_item->SetFilled( m_filledCtrl->GetValue() );
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004-2018 Jean-Pierre Charras jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2010-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2010-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -32,7 +32,6 @@
|
|||
#include <footprint.h>
|
||||
#include <string_utils.h>
|
||||
#include <pcb_text.h>
|
||||
#include <fp_text.h>
|
||||
#include <pcbnew.h>
|
||||
#include <pcb_edit_frame.h>
|
||||
#include <pcb_layer_box_selector.h>
|
||||
|
@ -41,13 +40,10 @@
|
|||
#include <scintilla_tricks.h>
|
||||
|
||||
|
||||
DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BOARD_ITEM* aItem ) :
|
||||
DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, PCB_TEXT* aText ) :
|
||||
DIALOG_TEXT_PROPERTIES_BASE( aParent ),
|
||||
m_frame( aParent ),
|
||||
m_item( aItem ),
|
||||
m_edaText( nullptr ),
|
||||
m_fpText( nullptr ),
|
||||
m_pcbText( nullptr ),
|
||||
m_item( aText ),
|
||||
m_textWidth( aParent, m_SizeXLabel, m_SizeXCtrl, m_SizeXUnits ),
|
||||
m_textHeight( aParent, m_SizeYLabel, m_SizeYCtrl, m_SizeYUnits ),
|
||||
m_thickness( aParent, m_ThicknessLabel, m_ThicknessCtrl, m_ThicknessUnits ),
|
||||
|
@ -74,23 +70,20 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BO
|
|||
m_MultiLineText->SetScrollWidth( 1 );
|
||||
m_MultiLineText->SetScrollWidthTracking( true );
|
||||
|
||||
if( m_item->Type() == PCB_FP_TEXT_T )
|
||||
if( m_item->GetParentFootprint() )
|
||||
{
|
||||
m_fpText = (FP_TEXT*) m_item;
|
||||
m_edaText = static_cast<EDA_TEXT*>( m_fpText );
|
||||
|
||||
switch( m_fpText->GetType() )
|
||||
switch( m_item->GetType() )
|
||||
{
|
||||
case FP_TEXT::TEXT_is_REFERENCE: title = _( "Footprint Reference Properties" ); break;
|
||||
case FP_TEXT::TEXT_is_VALUE: title = _( "Footprint Value Properties" ); break;
|
||||
case FP_TEXT::TEXT_is_DIVERS: title = _( "Footprint Text Properties" ); break;
|
||||
case PCB_TEXT::TEXT_is_REFERENCE: title = _( "Footprint Reference Properties" ); break;
|
||||
case PCB_TEXT::TEXT_is_VALUE: title = _( "Footprint Value Properties" ); break;
|
||||
case PCB_TEXT::TEXT_is_DIVERS: title = _( "Footprint Text Properties" ); break;
|
||||
}
|
||||
|
||||
switch( m_fpText->GetType() )
|
||||
switch( m_item->GetType() )
|
||||
{
|
||||
case FP_TEXT::TEXT_is_REFERENCE: m_TextLabel->SetLabel( _( "Reference:" ) ); break;
|
||||
case FP_TEXT::TEXT_is_VALUE: m_TextLabel->SetLabel( _( "Value:" ) ); break;
|
||||
case FP_TEXT::TEXT_is_DIVERS: m_TextLabel->SetLabel( _( "Text:" ) ); break;
|
||||
case PCB_TEXT::TEXT_is_REFERENCE: m_TextLabel->SetLabel( _( "Reference:" ) ); break;
|
||||
case PCB_TEXT::TEXT_is_VALUE: m_TextLabel->SetLabel( _( "Value:" ) ); break;
|
||||
case PCB_TEXT::TEXT_is_DIVERS: m_TextLabel->SetLabel( _( "Text:" ) ); break;
|
||||
}
|
||||
|
||||
SetInitialFocus( m_SingleLineText );
|
||||
|
@ -103,9 +96,6 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BO
|
|||
{
|
||||
title = _( "Text Properties" );
|
||||
|
||||
m_pcbText = (PCB_TEXT*) aItem;
|
||||
m_edaText = static_cast<EDA_TEXT*>( m_pcbText );
|
||||
|
||||
SetInitialFocus( m_MultiLineText );
|
||||
m_SingleLineSizer->Show( false );
|
||||
|
||||
|
@ -190,7 +180,7 @@ DIALOG_TEXT_PROPERTIES::~DIALOG_TEXT_PROPERTIES()
|
|||
}
|
||||
|
||||
|
||||
void PCB_BASE_EDIT_FRAME::ShowTextPropertiesDialog( BOARD_ITEM* aText )
|
||||
void PCB_BASE_EDIT_FRAME::ShowTextPropertiesDialog( PCB_TEXT* aText )
|
||||
{
|
||||
DIALOG_TEXT_PROPERTIES dlg( this, aText );
|
||||
dlg.ShowQuasiModal();
|
||||
|
@ -206,11 +196,11 @@ void DIALOG_TEXT_PROPERTIES::OnSetFocusText( wxFocusEvent& event )
|
|||
// Note that we can't do this on OSX as it tends to provoke Apple's
|
||||
// "[NSAlert runModal] may not be invoked inside of transaction begin/commit pair"
|
||||
// bug. See: https://bugs.launchpad.net/kicad/+bug/1837225
|
||||
if( m_fpText->GetType() == FP_TEXT::TEXT_is_REFERENCE )
|
||||
if( m_item->GetType() == PCB_TEXT::TEXT_is_REFERENCE )
|
||||
m_SingleLineText->Update();
|
||||
#endif
|
||||
|
||||
if( m_fpText->GetType() == FP_TEXT::TEXT_is_REFERENCE )
|
||||
if( m_item->GetType() == PCB_TEXT::TEXT_is_REFERENCE )
|
||||
KIUI::SelectReferenceNumber( static_cast<wxTextEntry*>( m_SingleLineText ) );
|
||||
else
|
||||
m_SingleLineText->SetSelection( -1, -1 );
|
||||
|
@ -221,41 +211,35 @@ void DIALOG_TEXT_PROPERTIES::OnSetFocusText( wxFocusEvent& event )
|
|||
|
||||
bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
|
||||
{
|
||||
BOARD* board = m_frame->GetBoard();
|
||||
FOOTPRINT* parentFP = m_item->GetParentFootprint();
|
||||
|
||||
if( m_SingleLineText->IsShown() )
|
||||
{
|
||||
m_SingleLineText->SetValue( m_edaText->GetText() );
|
||||
m_SingleLineText->SetValue( m_item->GetText() );
|
||||
|
||||
if( m_fpText && m_fpText->GetType() == FP_TEXT::TEXT_is_REFERENCE )
|
||||
if( m_item->GetType() == PCB_TEXT::TEXT_is_REFERENCE )
|
||||
KIUI::SelectReferenceNumber( static_cast<wxTextEntry*>( m_SingleLineText ) );
|
||||
else
|
||||
m_SingleLineText->SetSelection( -1, -1 );
|
||||
}
|
||||
else if( m_MultiLineText->IsShown() )
|
||||
{
|
||||
BOARD* board = m_frame->GetBoard();
|
||||
wxString converted = board->ConvertKIIDsToCrossReferences(
|
||||
UnescapeString( m_edaText->GetText() ) );
|
||||
wxString msg = board->ConvertKIIDsToCrossReferences( UnescapeString( m_item->GetText() ) );
|
||||
|
||||
m_MultiLineText->SetValue( converted );
|
||||
m_MultiLineText->SetValue( msg );
|
||||
m_MultiLineText->SetSelection( -1, -1 );
|
||||
m_MultiLineText->EmptyUndoBuffer();
|
||||
}
|
||||
|
||||
if( m_item->Type() == PCB_FP_TEXT_T && m_fpText )
|
||||
if( parentFP )
|
||||
{
|
||||
FOOTPRINT* footprint = dynamic_cast<FOOTPRINT*>( m_fpText->GetParent() );
|
||||
wxString msg;
|
||||
|
||||
if( footprint )
|
||||
{
|
||||
msg.Printf( _( "Footprint %s (%s), %s, rotated %.1f deg"),
|
||||
footprint->GetReference(),
|
||||
footprint->GetValue(),
|
||||
footprint->IsFlipped() ? _( "back side (mirrored)" ) : _( "front side" ),
|
||||
footprint->GetOrientation().AsDegrees() );
|
||||
}
|
||||
|
||||
m_statusLine->SetLabel( msg );
|
||||
m_statusLine->SetLabel( wxString::Format( _( "Footprint %s (%s), %s, rotated %.1f deg"),
|
||||
parentFP->GetReference(),
|
||||
parentFP->GetValue(),
|
||||
parentFP->IsFlipped() ? _( "back side (mirrored)" )
|
||||
: _( "front side" ),
|
||||
parentFP->GetOrientation().AsDegrees() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -267,39 +251,39 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
|
|||
m_LayerSelectionCtrl->SetLayerSelection( m_item->GetLayer() );
|
||||
m_cbKnockout->SetValue( m_item->IsKnockout() );
|
||||
|
||||
m_fontCtrl->SetFontSelection( m_edaText->GetFont() );
|
||||
m_fontCtrl->SetFontSelection( m_item->GetFont() );
|
||||
|
||||
m_textWidth.SetValue( m_edaText->GetTextSize().x );
|
||||
m_textHeight.SetValue( m_edaText->GetTextSize().y );
|
||||
m_thickness.SetValue( m_edaText->GetTextThickness() );
|
||||
m_posX.SetValue( m_edaText->GetTextPos().x );
|
||||
m_posY.SetValue( m_edaText->GetTextPos().y );
|
||||
m_textWidth.SetValue( m_item->GetTextSize().x );
|
||||
m_textHeight.SetValue( m_item->GetTextSize().y );
|
||||
m_thickness.SetValue( m_item->GetTextThickness() );
|
||||
m_posX.SetValue( m_item->GetFPRelativePosition().x );
|
||||
m_posY.SetValue( m_item->GetFPRelativePosition().y );
|
||||
|
||||
m_Visible->SetValue( m_edaText->IsVisible() );
|
||||
m_Visible->SetValue( m_item->IsVisible() );
|
||||
|
||||
if( m_fpText )
|
||||
m_KeepUpright->SetValue( m_fpText->IsKeepUpright() );
|
||||
if( parentFP )
|
||||
m_KeepUpright->SetValue( m_item->IsKeepUpright() );
|
||||
|
||||
m_bold->Check( m_edaText->IsBold() );
|
||||
m_italic->Check( m_edaText->IsItalic() );
|
||||
m_bold->Check( m_item->IsBold() );
|
||||
m_italic->Check( m_item->IsItalic() );
|
||||
|
||||
switch ( m_edaText->GetHorizJustify() )
|
||||
switch ( m_item->GetHorizJustify() )
|
||||
{
|
||||
case GR_TEXT_H_ALIGN_LEFT: m_alignLeft->Check( true ); break;
|
||||
case GR_TEXT_H_ALIGN_CENTER: m_alignCenter->Check( true ); break;
|
||||
case GR_TEXT_H_ALIGN_RIGHT: m_alignRight->Check( true ); break;
|
||||
}
|
||||
|
||||
switch ( m_edaText->GetVertJustify() )
|
||||
switch ( m_item->GetVertJustify() )
|
||||
{
|
||||
case GR_TEXT_V_ALIGN_BOTTOM: m_valignBottom->Check( true ); break;
|
||||
case GR_TEXT_V_ALIGN_CENTER: m_valignCenter->Check( true ); break;
|
||||
case GR_TEXT_V_ALIGN_TOP: m_valignTop->Check( true ); break;
|
||||
}
|
||||
|
||||
m_mirrored->Check( m_edaText->IsMirrored() );
|
||||
m_mirrored->Check( m_item->IsMirrored() );
|
||||
|
||||
EDA_ANGLE orientation = m_edaText->GetTextAngle();
|
||||
EDA_ANGLE orientation = m_item->GetTextAngle();
|
||||
m_orientation.SetAngleValue( orientation.Normalize180() );
|
||||
|
||||
return DIALOG_TEXT_PROPERTIES_BASE::TransferDataToWindow();
|
||||
|
@ -395,7 +379,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
|
|||
if( m_SingleLineText->IsShown() )
|
||||
{
|
||||
if( !m_SingleLineText->GetValue().IsEmpty() )
|
||||
m_edaText->SetText( m_SingleLineText->GetValue() );
|
||||
m_item->SetText( m_SingleLineText->GetValue() );
|
||||
}
|
||||
else if( m_MultiLineText->IsShown() )
|
||||
{
|
||||
|
@ -413,7 +397,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
|
|||
// drawing routines so strip the \r char.
|
||||
txt.Replace( wxT( "\r" ), wxT( "" ) );
|
||||
#endif
|
||||
m_edaText->SetText( EscapeString( txt, CTX_QUOTED_STR ) );
|
||||
m_item->SetText( EscapeString( txt, CTX_QUOTED_STR ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -424,52 +408,49 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
|
|||
|
||||
if( m_fontCtrl->HaveFontSelection() )
|
||||
{
|
||||
m_edaText->SetFont( m_fontCtrl->GetFontSelection( m_bold->IsChecked(),
|
||||
m_italic->IsChecked() ) );
|
||||
m_item->SetFont( m_fontCtrl->GetFontSelection( m_bold->IsChecked(),
|
||||
m_italic->IsChecked() ) );
|
||||
}
|
||||
|
||||
m_edaText->SetTextSize( VECTOR2I( m_textWidth.GetValue(), m_textHeight.GetValue() ) );
|
||||
m_edaText->SetTextThickness( m_thickness.GetValue() );
|
||||
m_edaText->SetTextPos( VECTOR2I( m_posX.GetValue(), m_posY.GetValue() ) );
|
||||
|
||||
if( m_fpText )
|
||||
m_fpText->SetLocalCoord();
|
||||
m_item->SetTextSize( VECTOR2I( m_textWidth.GetValue(), m_textHeight.GetValue() ) );
|
||||
m_item->SetTextThickness( m_thickness.GetValue() );
|
||||
m_item->SetFPRelativePosition( VECTOR2I( m_posX.GetValue(), m_posY.GetValue() ) );
|
||||
|
||||
// Test for acceptable values for thickness and size and clamp if fails
|
||||
int maxPenWidth = Clamp_Text_PenSize( m_edaText->GetTextThickness(), m_edaText->GetTextSize() );
|
||||
int maxPenWidth = Clamp_Text_PenSize( m_item->GetTextThickness(), m_item->GetTextSize() );
|
||||
|
||||
if( m_edaText->GetTextThickness() > maxPenWidth )
|
||||
if( m_item->GetTextThickness() > maxPenWidth )
|
||||
{
|
||||
DisplayError( this, _( "The text thickness is too large for the text size.\n"
|
||||
"It will be clamped." ) );
|
||||
m_edaText->SetTextThickness( maxPenWidth );
|
||||
m_item->SetTextThickness( maxPenWidth );
|
||||
}
|
||||
|
||||
m_edaText->SetTextAngle( m_orientation.GetAngleValue().Normalize() );
|
||||
m_item->SetTextAngle( m_orientation.GetAngleValue().Normalize() );
|
||||
|
||||
m_edaText->SetVisible( m_Visible->GetValue() );
|
||||
m_item->SetVisible( m_Visible->GetValue() );
|
||||
|
||||
if( m_fpText )
|
||||
m_fpText->SetKeepUpright( m_KeepUpright->GetValue() );
|
||||
if( m_KeepUpright->IsShown() )
|
||||
m_item->SetKeepUpright( m_KeepUpright->GetValue() );
|
||||
|
||||
m_edaText->SetBold( m_bold->IsChecked() );
|
||||
m_edaText->SetItalic( m_italic->IsChecked() );
|
||||
m_item->SetBold( m_bold->IsChecked() );
|
||||
m_item->SetItalic( m_italic->IsChecked() );
|
||||
|
||||
if( m_alignLeft->IsChecked() )
|
||||
m_edaText->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
||||
m_item->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
||||
else if( m_alignCenter->IsChecked() )
|
||||
m_edaText->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER );
|
||||
m_item->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER );
|
||||
else
|
||||
m_edaText->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
|
||||
m_item->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
|
||||
|
||||
if( m_valignBottom->IsChecked() )
|
||||
m_edaText->SetVertJustify ( GR_TEXT_V_ALIGN_BOTTOM );
|
||||
m_item->SetVertJustify ( GR_TEXT_V_ALIGN_BOTTOM );
|
||||
else if( m_valignCenter->IsChecked() )
|
||||
m_edaText->SetVertJustify( GR_TEXT_V_ALIGN_CENTER );
|
||||
m_item->SetVertJustify( GR_TEXT_V_ALIGN_CENTER );
|
||||
else
|
||||
m_edaText->SetVertJustify( GR_TEXT_V_ALIGN_TOP );
|
||||
m_item->SetVertJustify( GR_TEXT_V_ALIGN_TOP );
|
||||
|
||||
m_edaText->SetMirrored( m_mirrored->IsChecked() );
|
||||
m_item->SetMirrored( m_mirrored->IsChecked() );
|
||||
|
||||
if( pushCommit )
|
||||
commit.Push( _( "Change text properties" ) );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2018-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2018-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -33,7 +33,6 @@
|
|||
class PCB_BASE_EDIT_FRAME;
|
||||
class BOARD_ITEM;
|
||||
class EDA_TEXT;
|
||||
class FP_TEXT;
|
||||
class PCB_TEXT;
|
||||
class SCINTILLA_TRICKS;
|
||||
|
||||
|
@ -41,7 +40,7 @@ class SCINTILLA_TRICKS;
|
|||
class DIALOG_TEXT_PROPERTIES : public DIALOG_TEXT_PROPERTIES_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_TEXT_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BOARD_ITEM* aItem );
|
||||
DIALOG_TEXT_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, PCB_TEXT* aText );
|
||||
~DIALOG_TEXT_PROPERTIES();
|
||||
|
||||
/**
|
||||
|
@ -64,10 +63,7 @@ private:
|
|||
|
||||
private:
|
||||
PCB_BASE_EDIT_FRAME* m_frame;
|
||||
BOARD_ITEM* m_item; // FP_TEXT or PCB_TEXT
|
||||
EDA_TEXT* m_edaText; // always non-null
|
||||
FP_TEXT* m_fpText; // only non-null for FP_TEXTs
|
||||
PCB_TEXT* m_pcbText; // only non-null for PCB_TEXTs
|
||||
PCB_TEXT* m_item;
|
||||
|
||||
UNIT_BINDER m_textWidth;
|
||||
UNIT_BINDER m_textHeight;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2022-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -32,7 +32,6 @@
|
|||
#include <footprint.h>
|
||||
#include <string_utils.h>
|
||||
#include <pcb_textbox.h>
|
||||
#include <fp_textbox.h>
|
||||
#include <pcbnew.h>
|
||||
#include <pcb_edit_frame.h>
|
||||
#include <pcb_layer_box_selector.h>
|
||||
|
@ -41,13 +40,10 @@
|
|||
#include "macros.h"
|
||||
|
||||
DIALOG_TEXTBOX_PROPERTIES::DIALOG_TEXTBOX_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent,
|
||||
BOARD_ITEM* aItem ) :
|
||||
PCB_TEXTBOX* aTextBox ) :
|
||||
DIALOG_TEXTBOX_PROPERTIES_BASE( aParent ),
|
||||
m_frame( aParent ),
|
||||
m_item( aItem ),
|
||||
m_edaText( nullptr ),
|
||||
m_fpTextBox( nullptr ),
|
||||
m_pcbTextBox( nullptr ),
|
||||
m_textBox( aTextBox ),
|
||||
m_textWidth( aParent, m_SizeXLabel, m_SizeXCtrl, m_SizeXUnits ),
|
||||
m_textHeight( aParent, m_SizeYLabel, m_SizeYCtrl, m_SizeYUnits ),
|
||||
m_thickness( aParent, m_ThicknessLabel, m_ThicknessCtrl, m_ThicknessUnits ),
|
||||
|
@ -67,23 +63,11 @@ DIALOG_TEXTBOX_PROPERTIES::DIALOG_TEXTBOX_PROPERTIES( PCB_BASE_EDIT_FRAME* aPare
|
|||
m_MultiLineText->SetScrollWidth( 1 );
|
||||
m_MultiLineText->SetScrollWidthTracking( true );
|
||||
|
||||
if( m_item->Type() == PCB_FP_TEXTBOX_T )
|
||||
if( m_textBox->GetParentFootprint() )
|
||||
{
|
||||
m_fpTextBox = static_cast<FP_TEXTBOX*>( m_item );
|
||||
m_edaText = m_fpTextBox;
|
||||
|
||||
// Do not allow locking items in the footprint editor
|
||||
m_cbLocked->Show( false );
|
||||
}
|
||||
else if( m_item->Type() == PCB_TEXTBOX_T )
|
||||
{
|
||||
m_pcbTextBox = static_cast<PCB_TEXTBOX*>( m_item );
|
||||
m_edaText = m_pcbTextBox;
|
||||
}
|
||||
else
|
||||
{
|
||||
UNIMPLEMENTED_FOR( m_item->GetClass() );
|
||||
}
|
||||
|
||||
SetInitialFocus( m_MultiLineText );
|
||||
|
||||
|
@ -112,7 +96,7 @@ DIALOG_TEXTBOX_PROPERTIES::DIALOG_TEXTBOX_PROPERTIES( PCB_BASE_EDIT_FRAME* aPare
|
|||
|
||||
// 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.
|
||||
if( !m_frame->GetBoard()->IsLayerEnabled( m_item->GetLayer() ) )
|
||||
if( !m_frame->GetBoard()->IsLayerEnabled( m_textBox->GetLayer() ) )
|
||||
m_LayerSelectionCtrl->ShowNonActivatedLayers( true );
|
||||
|
||||
m_LayerSelectionCtrl->SetLayersHotkeys( false );
|
||||
|
@ -154,9 +138,9 @@ DIALOG_TEXTBOX_PROPERTIES::~DIALOG_TEXTBOX_PROPERTIES()
|
|||
}
|
||||
|
||||
|
||||
int PCB_BASE_EDIT_FRAME::ShowTextBoxPropertiesDialog( BOARD_ITEM* aText )
|
||||
int PCB_BASE_EDIT_FRAME::ShowTextBoxPropertiesDialog( PCB_TEXTBOX* aTextBox )
|
||||
{
|
||||
DIALOG_TEXTBOX_PROPERTIES dlg( this, aText );
|
||||
DIALOG_TEXTBOX_PROPERTIES dlg( this, aTextBox );
|
||||
return dlg.ShowQuasiModal();
|
||||
}
|
||||
|
||||
|
@ -165,44 +149,38 @@ bool DIALOG_TEXTBOX_PROPERTIES::TransferDataToWindow()
|
|||
{
|
||||
BOARD* board = m_frame->GetBoard();
|
||||
wxString converted = board->ConvertKIIDsToCrossReferences(
|
||||
UnescapeString( m_edaText->GetText() ) );
|
||||
UnescapeString( m_textBox->GetText() ) );
|
||||
|
||||
m_MultiLineText->SetValue( converted );
|
||||
m_MultiLineText->SetSelection( -1, -1 );
|
||||
m_MultiLineText->EmptyUndoBuffer();
|
||||
|
||||
m_cbLocked->SetValue( m_item->IsLocked() );
|
||||
m_cbLocked->SetValue( m_textBox->IsLocked() );
|
||||
|
||||
m_LayerSelectionCtrl->SetLayerSelection( m_item->GetLayer() );
|
||||
m_LayerSelectionCtrl->SetLayerSelection( m_textBox->GetLayer() );
|
||||
|
||||
m_fontCtrl->SetFontSelection( m_edaText->GetFont() );
|
||||
m_fontCtrl->SetFontSelection( m_textBox->GetFont() );
|
||||
|
||||
m_textWidth.SetValue( m_edaText->GetTextSize().x );
|
||||
m_textHeight.SetValue( m_edaText->GetTextSize().y );
|
||||
m_thickness.SetValue( m_edaText->GetTextThickness() );
|
||||
m_textWidth.SetValue( m_textBox->GetTextSize().x );
|
||||
m_textHeight.SetValue( m_textBox->GetTextSize().y );
|
||||
m_thickness.SetValue( m_textBox->GetTextThickness() );
|
||||
|
||||
m_bold->Check( m_edaText->IsBold() );
|
||||
m_italic->Check( m_edaText->IsItalic() );
|
||||
m_bold->Check( m_textBox->IsBold() );
|
||||
m_italic->Check( m_textBox->IsItalic() );
|
||||
|
||||
switch ( m_edaText->GetHorizJustify() )
|
||||
switch ( m_textBox->GetHorizJustify() )
|
||||
{
|
||||
case GR_TEXT_H_ALIGN_LEFT: m_alignLeft->Check( true ); break;
|
||||
case GR_TEXT_H_ALIGN_CENTER: m_alignCenter->Check( true ); break;
|
||||
case GR_TEXT_H_ALIGN_RIGHT: m_alignRight->Check( true ); break;
|
||||
}
|
||||
|
||||
m_mirrored->Check( m_edaText->IsMirrored() );
|
||||
m_mirrored->Check( m_textBox->IsMirrored() );
|
||||
|
||||
EDA_ANGLE orientation = m_edaText->GetTextAngle();
|
||||
EDA_ANGLE orientation = m_textBox->GetTextAngle();
|
||||
m_orientation.SetAngleValue( orientation.Normalize180() );
|
||||
|
||||
STROKE_PARAMS stroke;
|
||||
|
||||
if( m_fpTextBox )
|
||||
stroke = m_fpTextBox->GetStroke();
|
||||
else if( m_pcbTextBox )
|
||||
stroke = m_pcbTextBox->GetStroke();
|
||||
|
||||
STROKE_PARAMS stroke = m_textBox->GetStroke();
|
||||
m_borderCheckbox->SetValue( stroke.GetWidth() >= 0 );
|
||||
|
||||
if( stroke.GetWidth() >= 0 )
|
||||
|
@ -282,8 +260,8 @@ void DIALOG_TEXTBOX_PROPERTIES::onBorderChecked( wxCommandEvent& event )
|
|||
|
||||
if( border && m_borderWidth.GetValue() <= 0 )
|
||||
{
|
||||
BOARD_DESIGN_SETTINGS& bds = m_item->GetBoard()->GetDesignSettings();
|
||||
m_borderWidth.SetValue( bds.GetLineThickness( m_item->GetLayer() ) );
|
||||
BOARD_DESIGN_SETTINGS& bds = m_textBox->GetBoard()->GetDesignSettings();
|
||||
m_borderWidth.SetValue( bds.GetLineThickness( m_textBox->GetLayer() ) );
|
||||
}
|
||||
|
||||
m_borderWidth.Enable( border );
|
||||
|
@ -304,16 +282,16 @@ bool DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow()
|
|||
}
|
||||
|
||||
BOARD_COMMIT commit( m_frame );
|
||||
commit.Modify( m_item );
|
||||
commit.Modify( m_textBox );
|
||||
|
||||
// If no other command in progress, prepare undo command
|
||||
// (for a command in progress, will be made later, at the completion of command)
|
||||
bool pushCommit = ( m_item->GetEditFlags() == 0 );
|
||||
bool pushCommit = ( m_textBox->GetEditFlags() == 0 );
|
||||
|
||||
// Set IN_EDIT flag to force undo/redo/abort proper operation and avoid new calls to
|
||||
// SaveCopyInUndoList for the same text if is moved, and then rotated, edited, etc....
|
||||
if( !pushCommit )
|
||||
m_item->SetFlags( IN_EDIT );
|
||||
m_textBox->SetFlags( IN_EDIT );
|
||||
|
||||
BOARD* board = m_frame->GetBoard();
|
||||
wxString txt = board->ConvertCrossReferencesToKIIDs( m_MultiLineText->GetValue() );
|
||||
|
@ -328,54 +306,43 @@ bool DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow()
|
|||
txt.Replace( "\r", "" );
|
||||
#endif
|
||||
|
||||
m_edaText->SetText( EscapeString( txt, CTX_QUOTED_STR ) );
|
||||
|
||||
m_item->SetLocked( m_cbLocked->GetValue() );
|
||||
|
||||
m_item->SetLayer( ToLAYER_ID( m_LayerSelectionCtrl->GetLayerSelection() ) );
|
||||
m_textBox->SetText( EscapeString( txt, CTX_QUOTED_STR ) );
|
||||
m_textBox->SetLocked( m_cbLocked->GetValue() );
|
||||
m_textBox->SetLayer( ToLAYER_ID( m_LayerSelectionCtrl->GetLayerSelection() ) );
|
||||
|
||||
if( m_fontCtrl->HaveFontSelection() )
|
||||
{
|
||||
m_edaText->SetFont( m_fontCtrl->GetFontSelection( m_bold->IsChecked(),
|
||||
m_textBox->SetFont( m_fontCtrl->GetFontSelection( m_bold->IsChecked(),
|
||||
m_italic->IsChecked() ) );
|
||||
}
|
||||
|
||||
m_edaText->SetTextSize( VECTOR2I( m_textWidth.GetValue(), m_textHeight.GetValue() ) );
|
||||
m_edaText->SetTextThickness( m_thickness.GetValue() );
|
||||
|
||||
if( m_fpTextBox )
|
||||
m_fpTextBox->SetLocalCoord();
|
||||
m_textBox->SetTextSize( VECTOR2I( m_textWidth.GetValue(), m_textHeight.GetValue() ) );
|
||||
m_textBox->SetTextThickness( m_thickness.GetValue() );
|
||||
|
||||
// Test for acceptable values for thickness and size and clamp if fails
|
||||
int maxPenWidth = Clamp_Text_PenSize( m_edaText->GetTextThickness(), m_edaText->GetTextSize() );
|
||||
int maxPenWidth = Clamp_Text_PenSize( m_textBox->GetTextThickness(), m_textBox->GetTextSize() );
|
||||
|
||||
if( m_edaText->GetTextThickness() > maxPenWidth )
|
||||
if( m_textBox->GetTextThickness() > maxPenWidth )
|
||||
{
|
||||
DisplayError( this, _( "The text thickness is too large for the text size.\n"
|
||||
"It will be clamped." ) );
|
||||
m_edaText->SetTextThickness( maxPenWidth );
|
||||
m_textBox->SetTextThickness( maxPenWidth );
|
||||
}
|
||||
|
||||
m_edaText->SetTextAngle( m_orientation.GetAngleValue().Normalize() );
|
||||
|
||||
m_edaText->SetBold( m_bold->IsChecked() );
|
||||
m_edaText->SetItalic( m_italic->IsChecked() );
|
||||
m_textBox->SetTextAngle( m_orientation.GetAngleValue().Normalize() );
|
||||
m_textBox->SetBold( m_bold->IsChecked() );
|
||||
m_textBox->SetItalic( m_italic->IsChecked() );
|
||||
|
||||
if( m_alignLeft->IsChecked() )
|
||||
m_edaText->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
||||
m_textBox->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
||||
else if( m_alignCenter->IsChecked() )
|
||||
m_edaText->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER );
|
||||
m_textBox->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER );
|
||||
else
|
||||
m_edaText->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
|
||||
m_textBox->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
|
||||
|
||||
m_edaText->SetMirrored( m_mirrored->IsChecked() );
|
||||
m_textBox->SetMirrored( m_mirrored->IsChecked() );
|
||||
|
||||
STROKE_PARAMS stroke;
|
||||
|
||||
if( m_fpTextBox )
|
||||
stroke = m_fpTextBox->GetStroke();
|
||||
else if( m_pcbTextBox )
|
||||
stroke = m_pcbTextBox->GetStroke();
|
||||
STROKE_PARAMS stroke = m_textBox->GetStroke();
|
||||
|
||||
if( m_borderCheckbox->GetValue() )
|
||||
{
|
||||
|
@ -395,13 +362,10 @@ bool DIALOG_TEXTBOX_PROPERTIES::TransferDataFromWindow()
|
|||
else
|
||||
stroke.SetPlotStyle( it->first );
|
||||
|
||||
if( m_fpTextBox )
|
||||
m_fpTextBox->SetStroke( stroke );
|
||||
else if( m_pcbTextBox )
|
||||
m_pcbTextBox->SetStroke( stroke );
|
||||
m_textBox->SetStroke( stroke );
|
||||
|
||||
m_edaText->ClearBoundingBoxCache();
|
||||
m_edaText->ClearRenderCache();
|
||||
m_textBox->ClearBoundingBoxCache();
|
||||
m_textBox->ClearRenderCache();
|
||||
|
||||
if( pushCommit )
|
||||
commit.Push( _( "Change text box properties" ) );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2022-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -31,9 +31,6 @@
|
|||
|
||||
|
||||
class PCB_BASE_EDIT_FRAME;
|
||||
class BOARD_ITEM;
|
||||
class EDA_TEXT;
|
||||
class FP_TEXTBOX;
|
||||
class PCB_TEXTBOX;
|
||||
class SCINTILLA_TRICKS;
|
||||
|
||||
|
@ -41,7 +38,7 @@ class SCINTILLA_TRICKS;
|
|||
class DIALOG_TEXTBOX_PROPERTIES : public DIALOG_TEXTBOX_PROPERTIES_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_TEXTBOX_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BOARD_ITEM* aItem );
|
||||
DIALOG_TEXTBOX_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, PCB_TEXTBOX* aTextBox );
|
||||
~DIALOG_TEXTBOX_PROPERTIES();
|
||||
|
||||
private:
|
||||
|
@ -57,10 +54,7 @@ private:
|
|||
|
||||
private:
|
||||
PCB_BASE_EDIT_FRAME* m_frame;
|
||||
BOARD_ITEM* m_item; // FP_TEXTBOX or PCB_TEXTBOX
|
||||
EDA_TEXT* m_edaText; // always non-null
|
||||
FP_TEXTBOX* m_fpTextBox; // only non-null for FP_TEXTBOXes
|
||||
PCB_TEXTBOX* m_pcbTextBox; // only non-null for PCB_TEXTBOXes
|
||||
PCB_TEXTBOX* m_textBox;
|
||||
|
||||
UNIT_BINDER m_textWidth;
|
||||
UNIT_BINDER m_textHeight;
|
||||
|
|
|
@ -72,24 +72,11 @@ bool PANEL_SETUP_FORMATTING::TransferDataFromWindow()
|
|||
view->GetPainter()->GetSettings()->SetDashLengthRatio( settings.GetDashedLineDashRatio() );
|
||||
view->GetPainter()->GetSettings()->SetGapLengthRatio( settings.GetDashedLineGapRatio() );
|
||||
|
||||
view->UpdateAllItemsConditionally( KIGFX::REPAINT, [] ( KIGFX::VIEW_ITEM* aItem ) -> bool
|
||||
view->UpdateAllItemsConditionally( KIGFX::REPAINT,
|
||||
[] ( KIGFX::VIEW_ITEM* aItem ) -> bool
|
||||
{
|
||||
|
||||
const EDA_ITEM* item = dynamic_cast<const EDA_ITEM*>( aItem );
|
||||
|
||||
if( !item )
|
||||
return false;
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_SHAPE_T:
|
||||
case PCB_FP_SHAPE_T:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
const EDA_ITEM* item = dynamic_cast<const EDA_ITEM*>( aItem );
|
||||
return item && item->Type() == PCB_SHAPE_T;
|
||||
} );
|
||||
m_frame->GetCanvas()->Refresh();
|
||||
|
||||
|
|
|
@ -136,8 +136,8 @@ bool DRC_CACHE_GENERATOR::Run()
|
|||
static const std::vector<KICAD_T> itemTypes = {
|
||||
PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T,
|
||||
PCB_PAD_T,
|
||||
PCB_SHAPE_T, PCB_FP_SHAPE_T,
|
||||
PCB_TEXT_T, PCB_FP_TEXT_T, PCB_TEXTBOX_T, PCB_FP_TEXTBOX_T,
|
||||
PCB_SHAPE_T,
|
||||
PCB_TEXT_T, PCB_TEXTBOX_T,
|
||||
PCB_DIMENSION_T
|
||||
};
|
||||
|
||||
|
|
|
@ -98,10 +98,7 @@ DRC_ENGINE::~DRC_ENGINE()
|
|||
|
||||
static bool isKeepoutZone( const BOARD_ITEM* aItem, bool aCheckFlags )
|
||||
{
|
||||
if( !aItem )
|
||||
return false;
|
||||
|
||||
if( aItem->Type() != PCB_ZONE_T && aItem->Type() != PCB_FP_ZONE_T )
|
||||
if( !aItem || aItem->Type() != PCB_ZONE_T )
|
||||
return false;
|
||||
|
||||
const ZONE* zone = static_cast<const ZONE*>( aItem );
|
||||
|
@ -693,16 +690,16 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
|
|||
{
|
||||
if( a && a->Type() == PCB_PAD_T )
|
||||
pad = static_cast<const PAD*>( a );
|
||||
else if( a && ( a->Type() == PCB_ZONE_T || a->Type() == PCB_FP_ZONE_T ) )
|
||||
else if( a && a->Type() == PCB_ZONE_T )
|
||||
zone = static_cast<const ZONE*>( a );
|
||||
|
||||
if( b && b->Type() == PCB_PAD_T )
|
||||
pad = static_cast<const PAD*>( b );
|
||||
else if( b && ( b->Type() == PCB_ZONE_T || b->Type() == PCB_FP_ZONE_T ) )
|
||||
else if( b && b->Type() == PCB_ZONE_T )
|
||||
zone = static_cast<const ZONE*>( b );
|
||||
|
||||
if( pad )
|
||||
parentFootprint = static_cast<FOOTPRINT*>( pad->GetParentFootprint() );
|
||||
parentFootprint = pad->GetParentFootprint();
|
||||
}
|
||||
|
||||
DRC_CONSTRAINT constraint;
|
||||
|
@ -1112,24 +1109,17 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO
|
|||
case PCB_PAD_T: mask = DRC_DISALLOW_PADS; break;
|
||||
case PCB_FOOTPRINT_T: mask = DRC_DISALLOW_FOOTPRINTS; break;
|
||||
case PCB_SHAPE_T: mask = DRC_DISALLOW_GRAPHICS; break;
|
||||
case PCB_FP_SHAPE_T: mask = DRC_DISALLOW_GRAPHICS; break;
|
||||
case PCB_TEXT_T: mask = DRC_DISALLOW_TEXTS; break;
|
||||
case PCB_TEXTBOX_T: mask = DRC_DISALLOW_TEXTS; break;
|
||||
case PCB_FP_TEXT_T: mask = DRC_DISALLOW_TEXTS; break;
|
||||
case PCB_FP_TEXTBOX_T: mask = DRC_DISALLOW_TEXTS; break;
|
||||
case PCB_ZONE_T:
|
||||
case PCB_FP_ZONE_T:
|
||||
{
|
||||
const ZONE* test_zone = static_cast<const ZONE*>( a );
|
||||
|
||||
case PCB_ZONE_T:
|
||||
// Treat teardrop areas as tracks for DRC purposes
|
||||
if( test_zone->IsTeardropArea() )
|
||||
if( static_cast<const ZONE*>( a )->IsTeardropArea() )
|
||||
mask = DRC_DISALLOW_TRACKS;
|
||||
else
|
||||
mask = DRC_DISALLOW_ZONES;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_LOCATE_HOLE_T: mask = DRC_DISALLOW_HOLES; break;
|
||||
default: mask = 0; break;
|
||||
|
@ -1775,7 +1765,7 @@ bool DRC_ENGINE::IsNetADiffPair( BOARD* aBoard, NETINFO_ITEM* aNet, int& aNetP,
|
|||
bool DRC_ENGINE::IsNetTieExclusion( int aTrackNetCode, PCB_LAYER_ID aTrackLayer,
|
||||
const VECTOR2I& aCollisionPos, BOARD_ITEM* aCollidingItem )
|
||||
{
|
||||
FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( aCollidingItem->GetParentFootprint() );
|
||||
FOOTPRINT* parentFootprint = aCollidingItem->GetParentFootprint();
|
||||
|
||||
if( parentFootprint && parentFootprint->IsNetTie() )
|
||||
{
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include <board_item.h>
|
||||
#include <pad.h>
|
||||
#include <fp_text.h>
|
||||
#include <pcb_text.h>
|
||||
#include <memory>
|
||||
#include <unordered_set>
|
||||
#include <set>
|
||||
|
@ -115,7 +115,7 @@ public:
|
|||
{
|
||||
wxCHECK( aTargetLayer != UNDEFINED_LAYER, /* void */ );
|
||||
|
||||
if( aItem->Type() == PCB_FP_TEXT_T && !static_cast<FP_TEXT*>( aItem )->IsVisible() )
|
||||
if( aItem->Type() == PCB_TEXT_T && !static_cast<PCB_TEXT*>( aItem )->IsVisible() )
|
||||
return;
|
||||
|
||||
std::vector<const SHAPE*> subshapes;
|
||||
|
|
|
@ -60,7 +60,7 @@ void DRC_TEST_PROVIDER::Init()
|
|||
{
|
||||
s_allBasicItems.push_back( (KICAD_T) i );
|
||||
|
||||
if( i != PCB_ZONE_T && i != PCB_FP_ZONE_T )
|
||||
if( i != PCB_ZONE_T )
|
||||
s_allBasicItemsButZones.push_back( (KICAD_T) i );
|
||||
}
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ int DRC_TEST_PROVIDER::forEachGeometryItem( const std::vector<KICAD_T>& aTypes,
|
|||
|
||||
for( FOOTPRINT* footprint : brd->Footprints() )
|
||||
{
|
||||
if( typeMask[ PCB_FP_TEXT_T ] )
|
||||
if( typeMask[ PCB_TEXT_T ] )
|
||||
{
|
||||
if( ( footprint->Reference().GetLayerSet() & aLayers ).any() )
|
||||
{
|
||||
|
@ -292,21 +292,21 @@ int DRC_TEST_PROVIDER::forEachGeometryItem( const std::vector<KICAD_T>& aTypes,
|
|||
|
||||
n++;
|
||||
}
|
||||
else if( typeMask[ PCB_FP_TEXT_T ] && dwg->Type() == PCB_FP_TEXT_T )
|
||||
else if( typeMask[ PCB_TEXT_T ] && dwg->Type() == PCB_TEXT_T )
|
||||
{
|
||||
if( !aFunc( dwg ) )
|
||||
return n;
|
||||
|
||||
n++;
|
||||
}
|
||||
else if( typeMask[ PCB_FP_TEXTBOX_T ] && dwg->Type() == PCB_FP_TEXTBOX_T )
|
||||
else if( typeMask[ PCB_TEXTBOX_T ] && dwg->Type() == PCB_TEXTBOX_T )
|
||||
{
|
||||
if( !aFunc( dwg ) )
|
||||
return n;
|
||||
|
||||
n++;
|
||||
}
|
||||
else if( typeMask[ PCB_FP_SHAPE_T ] && dwg->Type() == PCB_FP_SHAPE_T )
|
||||
else if( typeMask[ PCB_SHAPE_T ] && dwg->Type() == PCB_SHAPE_T )
|
||||
{
|
||||
if( !aFunc( dwg ) )
|
||||
return n;
|
||||
|
@ -316,7 +316,7 @@ int DRC_TEST_PROVIDER::forEachGeometryItem( const std::vector<KICAD_T>& aTypes,
|
|||
}
|
||||
}
|
||||
|
||||
if( typeMask[ PCB_FP_ZONE_T ] )
|
||||
if( typeMask[ PCB_ZONE_T ] )
|
||||
{
|
||||
for( ZONE* zone : footprint->Zones() )
|
||||
{
|
||||
|
@ -345,13 +345,6 @@ int DRC_TEST_PROVIDER::forEachGeometryItem( const std::vector<KICAD_T>& aTypes,
|
|||
|
||||
bool DRC_TEST_PROVIDER::isInvisibleText( const BOARD_ITEM* aItem ) const
|
||||
{
|
||||
|
||||
if( const FP_TEXT* text = dyn_cast<const FP_TEXT*>( aItem ) )
|
||||
{
|
||||
if( !text->IsVisible() )
|
||||
return true;
|
||||
}
|
||||
|
||||
if( const PCB_TEXT* text = dyn_cast<const PCB_TEXT*>( aItem ) )
|
||||
{
|
||||
if( !text->IsVisible() )
|
||||
|
|
|
@ -551,7 +551,7 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem( PAD* pad, SHAPE* pa
|
|||
// Disable some tests for net-tie objects in a footprint
|
||||
if( other->GetParent() == pad->GetParent() )
|
||||
{
|
||||
FOOTPRINT* fp = static_cast<FOOTPRINT*>( pad->GetParent() );
|
||||
FOOTPRINT* fp = pad->GetParentFootprint();
|
||||
std::map<wxString, int> padToNetTieGroupMap = fp->MapPadNumbersToNetTieGroups();
|
||||
int padGroupIdx = padToNetTieGroupMap[ pad->GetNumber() ];
|
||||
|
||||
|
@ -566,7 +566,7 @@ bool DRC_TEST_PROVIDER_COPPER_CLEARANCE::testPadAgainstItem( PAD* pad, SHAPE* pa
|
|||
testHoles = false;
|
||||
}
|
||||
|
||||
if( other->Type() == PCB_FP_SHAPE_T && padGroupIdx >= 0 )
|
||||
if( other->Type() == PCB_SHAPE_T && padGroupIdx >= 0 )
|
||||
testClearance = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ bool DRC_TEST_PROVIDER_EDGE_CLEARANCE::Run()
|
|||
std::vector<std::unique_ptr<PCB_SHAPE>> edges;
|
||||
DRC_RTREE edgesTree;
|
||||
|
||||
forEachGeometryItem( { PCB_SHAPE_T, PCB_FP_SHAPE_T }, LSET( 2, Edge_Cuts, Margin ),
|
||||
forEachGeometryItem( { PCB_SHAPE_T }, LSET( 2, Edge_Cuts, Margin ),
|
||||
[&]( BOARD_ITEM *item ) -> bool
|
||||
{
|
||||
PCB_SHAPE* shape = static_cast<PCB_SHAPE*>( item );
|
||||
|
|
|
@ -26,8 +26,7 @@
|
|||
#include <netlist_reader/pcb_netlist.h>
|
||||
#include <fp_lib_table.h>
|
||||
#include <board.h>
|
||||
#include <fp_shape.h>
|
||||
#include <fp_text.h>
|
||||
#include <pcb_shape.h>
|
||||
#include <zone.h>
|
||||
#include <footprint.h>
|
||||
#include <pad.h>
|
||||
|
@ -266,7 +265,7 @@ bool padHasOverrides( const PAD* a, const PAD* b )
|
|||
}
|
||||
|
||||
|
||||
bool shapeNeedsUpdate( const FP_SHAPE* a, const FP_SHAPE* b )
|
||||
bool shapeNeedsUpdate( const PCB_SHAPE* a, const PCB_SHAPE* b )
|
||||
{
|
||||
REPORTER* aReporter = nullptr;
|
||||
bool diff = false;
|
||||
|
@ -278,26 +277,26 @@ bool shapeNeedsUpdate( const FP_SHAPE* a, const FP_SHAPE* b )
|
|||
case SHAPE_T::SEGMENT:
|
||||
case SHAPE_T::RECT:
|
||||
case SHAPE_T::CIRCLE:
|
||||
TEST( a->GetStart0(), b->GetStart0(), "" );
|
||||
TEST( a->GetEnd0(), b->GetEnd0(), "" );
|
||||
TEST( a->GetStart(), b->GetStart(), "" );
|
||||
TEST( a->GetEnd(), b->GetEnd(), "" );
|
||||
break;
|
||||
|
||||
case SHAPE_T::ARC:
|
||||
TEST( a->GetStart0(), b->GetStart0(), "" );
|
||||
TEST( a->GetEnd0(), b->GetEnd0(), "" );
|
||||
TEST( a->GetStart(), b->GetStart(), "" );
|
||||
TEST( a->GetEnd(), b->GetEnd(), "" );
|
||||
|
||||
// Arc center is calculated and so may have round-off errors when parents are
|
||||
// differentially rotated.
|
||||
if( ( a->GetCenter0() - b->GetCenter0() ).EuclideanNorm() > pcbIUScale.mmToIU( 0.0001 ) )
|
||||
if( ( a->GetCenter() - b->GetCenter() ).EuclideanNorm() > pcbIUScale.mmToIU( 0.0001 ) )
|
||||
return true;
|
||||
|
||||
break;
|
||||
|
||||
case SHAPE_T::BEZIER:
|
||||
TEST( a->GetStart0(), b->GetStart0(), "" );
|
||||
TEST( a->GetEnd0(), b->GetEnd0(), "" );
|
||||
TEST( a->GetBezierC1_0(), b->GetBezierC1_0(), "" );
|
||||
TEST( a->GetBezierC2_0(), b->GetBezierC2_0(), "" );
|
||||
TEST( a->GetStart(), b->GetStart(), "" );
|
||||
TEST( a->GetEnd(), b->GetEnd(), "" );
|
||||
TEST( a->GetBezierC1(), b->GetBezierC1(), "" );
|
||||
TEST( a->GetBezierC2(), b->GetBezierC2(), "" );
|
||||
break;
|
||||
|
||||
case SHAPE_T::POLY:
|
||||
|
@ -321,7 +320,7 @@ bool shapeNeedsUpdate( const FP_SHAPE* a, const FP_SHAPE* b )
|
|||
}
|
||||
|
||||
|
||||
bool textNeedsUpdate( const FP_TEXT* a, const FP_TEXT* b )
|
||||
bool textNeedsUpdate( const PCB_TEXT* a, const PCB_TEXT* b )
|
||||
{
|
||||
REPORTER* aReporter = nullptr;
|
||||
bool diff = false;
|
||||
|
@ -342,13 +341,13 @@ bool textNeedsUpdate( const FP_TEXT* a, const FP_TEXT* b )
|
|||
TEST( a->GetVertJustify(), b->GetVertJustify(), "" );
|
||||
|
||||
TEST( a->GetTextSize(), b->GetTextSize(), "" );
|
||||
TEST( a->GetPos0(), b->GetPos0(), "" );
|
||||
TEST( a->GetFPRelativePosition(), b->GetFPRelativePosition(), "" );
|
||||
|
||||
return diff;
|
||||
}
|
||||
|
||||
|
||||
bool zoneNeedsUpdate( const FP_ZONE* a, const FP_ZONE* b, REPORTER* aReporter )
|
||||
bool zoneNeedsUpdate( const ZONE* a, const ZONE* b, REPORTER* aReporter )
|
||||
{
|
||||
bool diff = false;
|
||||
|
||||
|
@ -539,14 +538,14 @@ bool FOOTPRINT::FootprintNeedsUpdate( const FOOTPRINT* aLibFootprint, REPORTER*
|
|||
std::inserter( aShapes, aShapes.begin() ),
|
||||
[]( BOARD_ITEM* item )
|
||||
{
|
||||
return item->Type() == PCB_FP_SHAPE_T;
|
||||
return item->Type() == PCB_SHAPE_T;
|
||||
} );
|
||||
std::set<BOARD_ITEM*, FOOTPRINT::cmp_drawings> bShapes;
|
||||
std::copy_if( aLibFootprint->GraphicalItems().begin(), aLibFootprint->GraphicalItems().end(),
|
||||
std::inserter( bShapes, bShapes.begin() ),
|
||||
[]( BOARD_ITEM* item )
|
||||
{
|
||||
return item->Type() == PCB_FP_SHAPE_T;
|
||||
return item->Type() == PCB_SHAPE_T;
|
||||
} );
|
||||
|
||||
if( aShapes.size() != bShapes.size() )
|
||||
|
@ -558,9 +557,9 @@ bool FOOTPRINT::FootprintNeedsUpdate( const FOOTPRINT* aLibFootprint, REPORTER*
|
|||
{
|
||||
for( auto aIt = aShapes.begin(), bIt = bShapes.begin(); aIt != aShapes.end(); aIt++, bIt++ )
|
||||
{
|
||||
if( ( *aIt )->Type() == PCB_FP_SHAPE_T )
|
||||
if( ( *aIt )->Type() == PCB_SHAPE_T )
|
||||
{
|
||||
if( shapeNeedsUpdate( static_cast<FP_SHAPE*>( *aIt ), static_cast<FP_SHAPE*>( *bIt ) ) )
|
||||
if( shapeNeedsUpdate( static_cast<PCB_SHAPE*>( *aIt ), static_cast<PCB_SHAPE*>( *bIt ) ) )
|
||||
{
|
||||
diff = true;
|
||||
REPORT( wxString::Format( _( "%s differs." ), ITEM_DESC( *aIt ) ) );
|
||||
|
@ -617,8 +616,8 @@ bool FOOTPRINT::FootprintNeedsUpdate( const FOOTPRINT* aLibFootprint, REPORTER*
|
|||
libCopy->SetOrientation( GetOrientation() );
|
||||
libCopy->Move( GetPosition() );
|
||||
|
||||
std::set<FP_ZONE*, FOOTPRINT::cmp_zones> aZones( Zones().begin(), Zones().end() );
|
||||
std::set<FP_ZONE*, FOOTPRINT::cmp_zones> bZones( libCopy->Zones().begin(), libCopy->Zones().end() );
|
||||
std::set<ZONE*, FOOTPRINT::cmp_zones> aZones( Zones().begin(), Zones().end() );
|
||||
std::set<ZONE*, FOOTPRINT::cmp_zones> bZones( libCopy->Zones().begin(), libCopy->Zones().end() );
|
||||
|
||||
if( aZones.size() != bZones.size() )
|
||||
{
|
||||
|
|
|
@ -178,7 +178,7 @@ void DRC_TEST_PROVIDER_MISC::testDisabledLayers()
|
|||
else if( disabledLayers.test( bottom ) )
|
||||
badLayer = bottom;
|
||||
}
|
||||
else if( item->Type() == PCB_FP_ZONE_T )
|
||||
else if( item->Type() == PCB_ZONE_T )
|
||||
{
|
||||
// Footprint zones just get a top/bottom/inner setting, so they're on
|
||||
// whatever inner layers there are.
|
||||
|
@ -260,7 +260,8 @@ void DRC_TEST_PROVIDER_MISC::testTextVars()
|
|||
int items = 0;
|
||||
|
||||
static const std::vector<KICAD_T> itemTypes = {
|
||||
PCB_TEXT_T, PCB_FP_TEXT_T, PCB_TEXTBOX_T, PCB_FP_TEXTBOX_T,
|
||||
PCB_TEXT_T,
|
||||
PCB_TEXTBOX_T,
|
||||
PCB_DIMENSION_T
|
||||
};
|
||||
|
||||
|
|
|
@ -112,8 +112,8 @@ bool DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::Run()
|
|||
PCB_TRACE_T, PCB_ARC_T, PCB_VIA_T,
|
||||
PCB_FOOTPRINT_T,
|
||||
PCB_PAD_T,
|
||||
PCB_SHAPE_T, PCB_FP_SHAPE_T,
|
||||
PCB_TEXT_T, PCB_FP_TEXT_T, PCB_TEXTBOX_T, PCB_FP_TEXTBOX_T,
|
||||
PCB_SHAPE_T,
|
||||
PCB_TEXT_T, PCB_TEXTBOX_T,
|
||||
PCB_DIMENSION_T
|
||||
};
|
||||
|
||||
|
@ -259,7 +259,7 @@ bool DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::Run()
|
|||
// Generate a count for progress reporting.
|
||||
//
|
||||
|
||||
forEachGeometryItem( { PCB_ZONE_T, PCB_FP_ZONE_T, PCB_SHAPE_T, PCB_FP_SHAPE_T },
|
||||
forEachGeometryItem( { PCB_ZONE_T, PCB_SHAPE_T },
|
||||
LSET::AllCuMask(),
|
||||
[&]( BOARD_ITEM* item ) -> bool
|
||||
{
|
||||
|
@ -277,7 +277,7 @@ bool DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::Run()
|
|||
// Run clearance checks -within- polygonal items.
|
||||
//
|
||||
|
||||
forEachGeometryItem( { PCB_ZONE_T, PCB_FP_ZONE_T, PCB_SHAPE_T, PCB_FP_SHAPE_T },
|
||||
forEachGeometryItem( { PCB_ZONE_T, PCB_SHAPE_T },
|
||||
LSET::AllCuMask(),
|
||||
[&]( BOARD_ITEM* item ) -> bool
|
||||
{
|
||||
|
@ -512,8 +512,11 @@ void DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testShapeLineChain( const SHAPE_LINE_
|
|||
std::shared_ptr<DRC_ITEM> drce = DRC_ITEM::Create( DRCE_CLEARANCE );
|
||||
VECTOR2I pt = collision.first;
|
||||
|
||||
if( aParentItem->GetParentFootprint() )
|
||||
pt += aParentItem->GetParentFootprint()->GetPosition();
|
||||
if( FOOTPRINT* parentFP = aParentItem->GetParentFootprint() )
|
||||
{
|
||||
RotatePoint( pt, parentFP->GetOrientation() );
|
||||
pt += parentFP->GetPosition();
|
||||
}
|
||||
|
||||
wxString msg = formatMsg( _( "Internal clearance violation (%s clearance %s; actual %s)" ),
|
||||
aConstraint.GetName(),
|
||||
|
@ -644,7 +647,6 @@ int DRC_TEST_PROVIDER_PHYSICAL_CLEARANCE::testItemAgainstItem( BOARD_ITEM* aItem
|
|||
|
||||
if( aItem->Type() == PCB_VIA_T )
|
||||
{
|
||||
|
||||
wxCHECK_MSG( aItem->GetLayerSet().Contains( aLayer ), violations,
|
||||
wxT( "Bug! Vias should only be checked for layers on which they exist" ) );
|
||||
|
||||
|
|
|
@ -220,12 +220,8 @@ bool DRC_TEST_PROVIDER_SILK_CLEARANCE::Run()
|
|||
VECTOR2I pos;
|
||||
|
||||
// Graphics are often compound shapes so ignore collisions between shapes in a
|
||||
// single footprint or on the board.
|
||||
if( refItem->Type() == PCB_SHAPE_T && testItem->Type() == PCB_SHAPE_T )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if( refItem->Type() == PCB_FP_SHAPE_T && testItem->Type() == PCB_FP_SHAPE_T
|
||||
// single footprint or on the board (both parent footprints will be nullptr).
|
||||
if( refItem->Type() == PCB_SHAPE_T && testItem->Type() == PCB_SHAPE_T
|
||||
&& refItem->GetParentFootprint() == testItem->GetParentFootprint() )
|
||||
{
|
||||
return true;
|
||||
|
|
|
@ -114,7 +114,7 @@ void DRC_TEST_PROVIDER_SOLDER_MASK::addItemToRTrees( BOARD_ITEM* aItem )
|
|||
{
|
||||
ZONE* solderMask = m_board->m_SolderMask;
|
||||
|
||||
if( aItem->Type() == PCB_ZONE_T || aItem->Type() == PCB_FP_ZONE_T )
|
||||
if( aItem->Type() == PCB_ZONE_T )
|
||||
{
|
||||
ZONE* zone = static_cast<ZONE*>( aItem );
|
||||
|
||||
|
@ -174,21 +174,6 @@ void DRC_TEST_PROVIDER_SOLDER_MASK::addItemToRTrees( BOARD_ITEM* aItem )
|
|||
}
|
||||
}
|
||||
}
|
||||
else if( aItem->Type() == PCB_FP_TEXT_T )
|
||||
{
|
||||
for( PCB_LAYER_ID layer : { F_Mask, B_Mask } )
|
||||
{
|
||||
if( aItem->IsOnLayer( layer ) )
|
||||
{
|
||||
const FP_TEXT* text = static_cast<const FP_TEXT*>( aItem );
|
||||
|
||||
text->TransformTextToPolySet( *solderMask->GetFill( layer ), layer,
|
||||
m_webWidth / 2, m_maxError, ERROR_OUTSIDE );
|
||||
|
||||
m_itemTree->Insert( aItem, layer, m_largestClearance );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for( PCB_LAYER_ID layer : { F_Mask, B_Mask } )
|
||||
|
@ -379,7 +364,7 @@ bool DRC_TEST_PROVIDER_SOLDER_MASK::checkMaskAperture( BOARD_ITEM* aMaskItem, BO
|
|||
if( aTestLayer == B_Mask && !aTestItem->IsOnLayer( B_Cu ) )
|
||||
return false;
|
||||
|
||||
FOOTPRINT* fp = static_cast<FOOTPRINT*>( aMaskItem->GetParentFootprint() );
|
||||
FOOTPRINT* fp = aMaskItem->GetParentFootprint();
|
||||
|
||||
if( fp && ( fp->GetAttributes() & FP_ALLOW_SOLDERMASK_BRIDGES ) > 0 )
|
||||
{
|
||||
|
@ -421,7 +406,7 @@ bool DRC_TEST_PROVIDER_SOLDER_MASK::checkMaskAperture( BOARD_ITEM* aMaskItem, BO
|
|||
|
||||
bool DRC_TEST_PROVIDER_SOLDER_MASK::checkItemMask( BOARD_ITEM* aMaskItem, int aTestNet )
|
||||
{
|
||||
FOOTPRINT* fp = static_cast<FOOTPRINT*>( aMaskItem->GetParentFootprint() );
|
||||
FOOTPRINT* fp = aMaskItem->GetParentFootprint();
|
||||
|
||||
wxCHECK( fp, false );
|
||||
|
||||
|
@ -463,7 +448,7 @@ void DRC_TEST_PROVIDER_SOLDER_MASK::testItemAgainstItems( BOARD_ITEM* aItem, con
|
|||
// Filter:
|
||||
[&]( BOARD_ITEM* other ) -> bool
|
||||
{
|
||||
FOOTPRINT* itemFP = static_cast<FOOTPRINT*>( aItem->GetParentFootprint() );
|
||||
FOOTPRINT* itemFP = aItem->GetParentFootprint();
|
||||
PAD* otherPad = dynamic_cast<PAD*>( other );
|
||||
int otherNet = -1;
|
||||
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
#include <macros.h>
|
||||
#include <pcb_text.h>
|
||||
#include <pcb_textbox.h>
|
||||
#include <fp_text.h>
|
||||
#include <fp_textbox.h>
|
||||
#include <drc/drc_engine.h>
|
||||
#include <drc/drc_item.h>
|
||||
#include <drc/drc_rule.h>
|
||||
|
@ -255,8 +253,7 @@ bool DRC_TEST_PROVIDER_TEXT_DIMS::Run()
|
|||
return true;
|
||||
};
|
||||
|
||||
static const std::vector<KICAD_T> itemTypes = { PCB_TEXT_T, PCB_FP_TEXT_T,
|
||||
PCB_TEXTBOX_T, PCB_FP_TEXTBOX_T };
|
||||
static const std::vector<KICAD_T> itemTypes = { PCB_TEXT_T, PCB_TEXTBOX_T };
|
||||
|
||||
forEachGeometryItem( itemTypes, LSET::AllLayersMask(),
|
||||
[&]( BOARD_ITEM* item ) -> bool
|
||||
|
@ -276,11 +273,9 @@ bool DRC_TEST_PROVIDER_TEXT_DIMS::Run()
|
|||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_TEXT_T: text = static_cast<PCB_TEXT*>( item ); break;
|
||||
case PCB_TEXTBOX_T: text = static_cast<PCB_TEXTBOX*>( item ); break;
|
||||
case PCB_FP_TEXT_T: text = static_cast<FP_TEXT*>( item ); break;
|
||||
case PCB_FP_TEXTBOX_T: text = static_cast<FP_TEXTBOX*>( item ); break;
|
||||
default: UNIMPLEMENTED_FOR( item->GetClass() ); break;
|
||||
case PCB_TEXT_T: text = static_cast<PCB_TEXT*>( item ); break;
|
||||
case PCB_TEXTBOX_T: text = static_cast<PCB_TEXTBOX*>( item ); break;
|
||||
default: UNIMPLEMENTED_FOR( item->GetClass() ); break;
|
||||
}
|
||||
|
||||
if( !text || !text->IsVisible() )
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
#include <zone.h>
|
||||
#include <pcb_target.h>
|
||||
#include <pcb_dimension.h>
|
||||
#include <pcb_textbox.h>
|
||||
#include <pcb_shape.h>
|
||||
#include <dialog_drc.h>
|
||||
#include <connectivity/connectivity_data.h>
|
||||
#include <tool/tool_manager.h>
|
||||
|
@ -124,13 +126,11 @@ void PCB_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
|
|||
break;
|
||||
|
||||
case PCB_TEXT_T:
|
||||
case PCB_FP_TEXT_T:
|
||||
ShowTextPropertiesDialog( aItem );
|
||||
ShowTextPropertiesDialog( static_cast<PCB_TEXT*>( aItem ) );
|
||||
break;
|
||||
|
||||
case PCB_TEXTBOX_T:
|
||||
case PCB_FP_TEXTBOX_T:
|
||||
ShowTextBoxPropertiesDialog( aItem );
|
||||
ShowTextBoxPropertiesDialog( static_cast<PCB_TEXTBOX*>( aItem ) );
|
||||
break;
|
||||
|
||||
case PCB_PAD_T:
|
||||
|
@ -157,7 +157,7 @@ void PCB_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
|
|||
}
|
||||
|
||||
case PCB_SHAPE_T:
|
||||
ShowGraphicItemPropertiesDialog( aItem );
|
||||
ShowGraphicItemPropertiesDialog( static_cast<PCB_SHAPE*>( aItem ) );
|
||||
break;
|
||||
|
||||
case PCB_ZONE_T:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2016 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -33,7 +33,7 @@
|
|||
#include <board.h>
|
||||
#include <board_design_settings.h>
|
||||
#include <convert_basic_shapes_to_polygon.h>
|
||||
#include <fp_shape.h>
|
||||
#include <pcb_shape.h>
|
||||
#include <footprint.h>
|
||||
#include <pad.h>
|
||||
#include <pcb_track.h>
|
||||
|
@ -49,7 +49,6 @@
|
|||
#include <project/project_file.h> // LAST_PATH_TYPE
|
||||
|
||||
#include <wx/app.h>
|
||||
#include <wx/filedlg.h>
|
||||
|
||||
static bool CreateHeaderInfoData( FILE* aFile, PCB_EDIT_FRAME* frame );
|
||||
static void CreateArtworksSection( FILE* aFile );
|
||||
|
@ -891,24 +890,25 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb )
|
|||
mirror, flip );
|
||||
|
||||
// Text on silk layer: RefDes and value (are they actually useful?)
|
||||
for( FP_TEXT* textItem : { &footprint->Reference(), &footprint->Value() } )
|
||||
for( PCB_TEXT* textItem : { &footprint->Reference(), &footprint->Value() } )
|
||||
{
|
||||
std::string layer = GenCADLayerName( cu_count,
|
||||
footprint->GetFlag() ? B_SilkS : F_SilkS );
|
||||
|
||||
fprintf( aFile, "TEXT %g %g %g %g %s %s \"%s\"",
|
||||
textItem->GetPos0().x / SCALE_FACTOR,
|
||||
-textItem->GetPos0().y / SCALE_FACTOR,
|
||||
textItem->GetFPRelativePosition().x / SCALE_FACTOR,
|
||||
-textItem->GetFPRelativePosition().y / SCALE_FACTOR,
|
||||
textItem->GetTextWidth() / SCALE_FACTOR,
|
||||
textItem->GetTextAngle().AsDegrees(),
|
||||
mirror,
|
||||
layer.c_str(),
|
||||
TO_UTF8( escapeString( textItem->GetText() ) ) );
|
||||
|
||||
// Please note, the width is approx
|
||||
BOX2I textBox = textItem->GetTextBox();
|
||||
|
||||
fprintf( aFile, " 0 0 %g %g\n",
|
||||
( textItem->GetTextWidth() * textItem->GetLength() ) / SCALE_FACTOR,
|
||||
textItem->GetTextHeight() / SCALE_FACTOR );
|
||||
textBox.GetWidth() / SCALE_FACTOR,
|
||||
textBox.GetHeight() / SCALE_FACTOR );
|
||||
}
|
||||
|
||||
// The SHEET is a 'generic description' for referencing the component
|
||||
|
@ -1197,8 +1197,6 @@ static void CreateTracksInfoData( FILE* aFile, BOARD* aPcb )
|
|||
*/
|
||||
static void FootprintWriteShape( FILE* aFile, FOOTPRINT* aFootprint, const wxString& aShapeName )
|
||||
{
|
||||
FP_SHAPE* shape;
|
||||
|
||||
/* creates header: */
|
||||
fprintf( aFile, "\nSHAPE \"%s\"\n", TO_UTF8( escapeString( aShapeName ) ) );
|
||||
|
||||
|
@ -1211,99 +1209,85 @@ static void FootprintWriteShape( FILE* aFile, FOOTPRINT* aFootprint, const wxStr
|
|||
// CAM350 read it right but only closed shapes
|
||||
// ProntoPlace double-flip it (at least the pads are correct)
|
||||
// GerberTool usually get it right...
|
||||
for( BOARD_ITEM* PtStruct : aFootprint->GraphicalItems() )
|
||||
for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
|
||||
{
|
||||
switch( PtStruct->Type() )
|
||||
if( item->Type() == PCB_SHAPE_T
|
||||
&& ( item->GetLayer() == F_SilkS || item->GetLayer() == B_SilkS ) )
|
||||
{
|
||||
case PCB_FP_TEXT_T:
|
||||
case PCB_FP_TEXTBOX_T:
|
||||
PCB_SHAPE* shape = static_cast<PCB_SHAPE*>( item );
|
||||
VECTOR2I start = shape->GetStart() - aFootprint->GetPosition();
|
||||
VECTOR2I end = shape->GetEnd() - aFootprint->GetPosition();
|
||||
VECTOR2I center = shape->GetCenter() - aFootprint->GetPosition();
|
||||
|
||||
// If we wanted to export text, this is not the correct section
|
||||
break;
|
||||
RotatePoint( start, -aFootprint->GetOrientation() );
|
||||
RotatePoint( end, -aFootprint->GetOrientation() );
|
||||
RotatePoint( center, -aFootprint->GetOrientation() );
|
||||
|
||||
case PCB_FP_SHAPE_T:
|
||||
shape = (FP_SHAPE*) PtStruct;
|
||||
|
||||
if( shape->GetLayer() == F_SilkS || shape->GetLayer() == B_SilkS )
|
||||
switch( shape->GetShape() )
|
||||
{
|
||||
switch( shape->GetShape() )
|
||||
{
|
||||
case SHAPE_T::SEGMENT:
|
||||
fprintf( aFile, "LINE %g %g %g %g\n",
|
||||
shape->GetStart0().x / SCALE_FACTOR,
|
||||
-shape->GetStart0().y / SCALE_FACTOR,
|
||||
shape->GetEnd0().x / SCALE_FACTOR,
|
||||
-shape->GetEnd0().y / SCALE_FACTOR );
|
||||
break;
|
||||
case SHAPE_T::SEGMENT:
|
||||
fprintf( aFile, "LINE %g %g %g %g\n",
|
||||
start.x / SCALE_FACTOR,
|
||||
-start.y / SCALE_FACTOR,
|
||||
end.x / SCALE_FACTOR,
|
||||
-end.y / SCALE_FACTOR );
|
||||
break;
|
||||
|
||||
case SHAPE_T::RECT:
|
||||
{
|
||||
fprintf( aFile, "LINE %g %g %g %g\n",
|
||||
shape->GetStart0().x / SCALE_FACTOR,
|
||||
-shape->GetStart0().y / SCALE_FACTOR,
|
||||
shape->GetEnd0().x / SCALE_FACTOR,
|
||||
-shape->GetStart0().y / SCALE_FACTOR );
|
||||
fprintf( aFile, "LINE %g %g %g %g\n",
|
||||
shape->GetEnd0().x / SCALE_FACTOR,
|
||||
-shape->GetStart0().y / SCALE_FACTOR,
|
||||
shape->GetEnd0().x / SCALE_FACTOR,
|
||||
-shape->GetEnd0().y / SCALE_FACTOR );
|
||||
fprintf( aFile, "LINE %g %g %g %g\n",
|
||||
shape->GetEnd0().x / SCALE_FACTOR,
|
||||
-shape->GetEnd0().y / SCALE_FACTOR,
|
||||
shape->GetStart0().x / SCALE_FACTOR,
|
||||
-shape->GetEnd0().y / SCALE_FACTOR );
|
||||
fprintf( aFile, "LINE %g %g %g %g\n",
|
||||
shape->GetStart0().x / SCALE_FACTOR,
|
||||
-shape->GetEnd0().y / SCALE_FACTOR,
|
||||
shape->GetStart0().x / SCALE_FACTOR,
|
||||
-shape->GetStart0().y / SCALE_FACTOR );
|
||||
}
|
||||
break;
|
||||
case SHAPE_T::RECT:
|
||||
fprintf( aFile, "LINE %g %g %g %g\n",
|
||||
start.x / SCALE_FACTOR,
|
||||
-start.y / SCALE_FACTOR,
|
||||
end.x / SCALE_FACTOR,
|
||||
-end.y / SCALE_FACTOR );
|
||||
fprintf( aFile, "LINE %g %g %g %g\n",
|
||||
end.x / SCALE_FACTOR,
|
||||
-start.y / SCALE_FACTOR,
|
||||
end.x / SCALE_FACTOR,
|
||||
-end.y / SCALE_FACTOR );
|
||||
fprintf( aFile, "LINE %g %g %g %g\n",
|
||||
end.x / SCALE_FACTOR,
|
||||
-end.y / SCALE_FACTOR,
|
||||
start.x / SCALE_FACTOR,
|
||||
-end.y / SCALE_FACTOR );
|
||||
fprintf( aFile, "LINE %g %g %g %g\n",
|
||||
start.x / SCALE_FACTOR,
|
||||
-end.y / SCALE_FACTOR,
|
||||
start.x / SCALE_FACTOR,
|
||||
-start.y / SCALE_FACTOR );
|
||||
break;
|
||||
|
||||
case SHAPE_T::CIRCLE:
|
||||
{
|
||||
int radius = KiROUND( GetLineLength( shape->GetEnd0(), shape->GetStart0() ) );
|
||||
case SHAPE_T::CIRCLE:
|
||||
{
|
||||
int radius = KiROUND( GetLineLength( end, start ) );
|
||||
|
||||
fprintf( aFile, "CIRCLE %g %g %g\n",
|
||||
shape->GetStart0().x / SCALE_FACTOR,
|
||||
-shape->GetStart0().y / SCALE_FACTOR,
|
||||
radius / SCALE_FACTOR );
|
||||
break;
|
||||
}
|
||||
|
||||
case SHAPE_T::ARC:
|
||||
{
|
||||
VECTOR2I start = shape->GetStart0();
|
||||
VECTOR2I end = shape->GetEnd0();
|
||||
|
||||
if( shape->GetArcAngle() > ANGLE_0 )
|
||||
std::swap( start, end );
|
||||
|
||||
fprintf( aFile, "ARC %g %g %g %g %g %g\n",
|
||||
start.x / SCALE_FACTOR,
|
||||
-start.y / SCALE_FACTOR,
|
||||
end.x / SCALE_FACTOR,
|
||||
-end.y / SCALE_FACTOR,
|
||||
shape->GetCenter0().x / SCALE_FACTOR,
|
||||
-shape->GetCenter0().y / SCALE_FACTOR );
|
||||
}
|
||||
break;
|
||||
|
||||
case SHAPE_T::POLY:
|
||||
// Not exported (TODO)
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( wxString::Format( wxT( "Type Edge Module %d invalid." ),
|
||||
PtStruct->Type() ) );
|
||||
break;
|
||||
}
|
||||
fprintf( aFile, "CIRCLE %g %g %g\n",
|
||||
start.x / SCALE_FACTOR,
|
||||
-start.y / SCALE_FACTOR,
|
||||
radius / SCALE_FACTOR );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
case SHAPE_T::ARC:
|
||||
if( shape->GetArcAngle() > ANGLE_0 )
|
||||
std::swap( start, end );
|
||||
|
||||
fprintf( aFile, "ARC %g %g %g %g %g %g\n",
|
||||
start.x / SCALE_FACTOR,
|
||||
-start.y / SCALE_FACTOR,
|
||||
end.x / SCALE_FACTOR,
|
||||
-end.y / SCALE_FACTOR,
|
||||
center.x / SCALE_FACTOR,
|
||||
-center.y / SCALE_FACTOR );
|
||||
break;
|
||||
|
||||
case SHAPE_T::POLY:
|
||||
// Not exported (TODO)
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( wxString::Format( wxT( "Shape type %d invalid." ), item->Type() ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013 Cirilo Bernardo
|
||||
* Copyright (C) 2018-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2018-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -31,9 +31,9 @@
|
|||
#include <board_design_settings.h>
|
||||
#include <footprint.h>
|
||||
#include <fp_lib_table.h>
|
||||
#include <fp_shape.h>
|
||||
#include <idf_parser.h>
|
||||
#include <pad.h>
|
||||
#include <pcb_shape.h>
|
||||
#include <build_version.h>
|
||||
#include <wx/msgdlg.h>
|
||||
#include "project.h"
|
||||
|
@ -59,12 +59,9 @@ static FILENAME_RESOLVER* resolver;
|
|||
static void idf_export_outline( BOARD* aPcb, IDF3_BOARD& aIDFBoard )
|
||||
{
|
||||
double scale = aIDFBoard.GetUserScale();
|
||||
|
||||
PCB_SHAPE* graphic; // KiCad graphical item
|
||||
IDF_POINT sp, ep; // start and end points from KiCad item
|
||||
|
||||
std::list< IDF_SEGMENT* > lines; // IDF intermediate form of KiCad graphical item
|
||||
IDF_OUTLINE* outline = nullptr; // graphical items forming an outline or cutout
|
||||
IDF_OUTLINE* outline = nullptr; // graphical items forming an outline or cutout
|
||||
|
||||
// NOTE: IMPLEMENTATION
|
||||
// If/when component cutouts are allowed, we must implement them separately. Cutouts
|
||||
|
@ -80,7 +77,7 @@ static void idf_export_outline( BOARD* aPcb, IDF3_BOARD& aIDFBoard )
|
|||
if( item->Type() != PCB_SHAPE_T || item->GetLayer() != Edge_Cuts )
|
||||
continue;
|
||||
|
||||
graphic = (PCB_SHAPE*) item;
|
||||
PCB_SHAPE* graphic = static_cast<PCB_SHAPE*>( item );
|
||||
|
||||
switch( graphic->GetShape() )
|
||||
{
|
||||
|
@ -311,7 +308,7 @@ static void idf_export_footprint( BOARD* aPcb, FOOTPRINT* aFootprint, IDF3_BOARD
|
|||
// TODO: If footprint cutouts are supported we must add code here
|
||||
// for( EDA_ITEM* item = aFootprint->GraphicalItems(); item != NULL; item = item->Next() )
|
||||
// {
|
||||
// if( item->Type() != PCB_FP_SHAPE_T || item->GetLayer() != Edge_Cuts )
|
||||
// if( item->Type() != PCB_SHAPE_T || item->GetLayer() != Edge_Cuts )
|
||||
// continue;
|
||||
// code to export cutouts
|
||||
// }
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include "board.h"
|
||||
#include "board_design_settings.h"
|
||||
#include <fp_lib_table.h>
|
||||
#include "fp_shape.h"
|
||||
#include "footprint.h"
|
||||
#include "pad.h"
|
||||
#include "pcb_text.h"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019 Jean_Pierre Charras <jp.charras at wanadoo.fr>
|
||||
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
|
@ -41,7 +41,6 @@
|
|||
#include <gbr_metadata.h>
|
||||
#include <footprint.h>
|
||||
#include <pad.h>
|
||||
#include <fp_shape.h>
|
||||
|
||||
|
||||
PLACEFILE_GERBER_WRITER::PLACEFILE_GERBER_WRITER( BOARD* aPcb )
|
||||
|
@ -304,8 +303,8 @@ int PLACEFILE_GERBER_WRITER::CreatePlaceFile( wxString& aFullFilename, PCB_LAYER
|
|||
{
|
||||
for( BOARD_ITEM* item : footprint->GraphicalItems() )
|
||||
{
|
||||
if( item->Type() == PCB_FP_SHAPE_T && item->GetLayer() == Edge_Cuts )
|
||||
brd_plotter.PlotFootprintShape( static_cast<FP_SHAPE*>( item ) );
|
||||
if( item->Type() == PCB_SHAPE_T && item->GetLayer() == Edge_Cuts )
|
||||
brd_plotter.PlotPcbShape( static_cast<PCB_SHAPE*>( item ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include <pcb_edit_frame.h>
|
||||
#include <board.h>
|
||||
#include <board_design_settings.h>
|
||||
#include <fp_shape.h>
|
||||
#include <macros.h>
|
||||
#include <pad.h>
|
||||
#include <pcb_marker.h>
|
||||
|
@ -41,6 +40,7 @@
|
|||
#include <pcb_track.h>
|
||||
#include <pcb_dimension.h>
|
||||
#include <pcb_bitmap.h>
|
||||
#include <pcb_textbox.h>
|
||||
#include <footprint.h>
|
||||
#include <zone.h>
|
||||
#include <view/view.h>
|
||||
|
@ -50,9 +50,9 @@
|
|||
#include <geometry/shape_simple.h>
|
||||
#include <convert_shape_list_to_polygon.h>
|
||||
#include <geometry/convex_hull.h>
|
||||
#include "fp_textbox.h"
|
||||
#include "convert_basic_shapes_to_polygon.h"
|
||||
|
||||
|
||||
FOOTPRINT::FOOTPRINT( BOARD* parent ) :
|
||||
BOARD_ITEM_CONTAINER((BOARD_ITEM*) parent, PCB_FOOTPRINT_T ),
|
||||
m_boundingBoxCacheTimeStamp( 0 ),
|
||||
|
@ -77,8 +77,8 @@ FOOTPRINT::FOOTPRINT( BOARD* parent ) :
|
|||
m_fileFormatVersionAtLoad = 0;
|
||||
|
||||
// These are special and mandatory text fields
|
||||
m_reference = new FP_TEXT( this, FP_TEXT::TEXT_is_REFERENCE );
|
||||
m_value = new FP_TEXT( this, FP_TEXT::TEXT_is_VALUE );
|
||||
m_reference = new PCB_TEXT( this, PCB_TEXT::TEXT_is_REFERENCE );
|
||||
m_value = new PCB_TEXT( this, PCB_TEXT::TEXT_is_VALUE );
|
||||
|
||||
m_3D_Drawings.clear();
|
||||
}
|
||||
|
@ -116,11 +116,11 @@ FOOTPRINT::FOOTPRINT( const FOOTPRINT& aFootprint ) :
|
|||
std::map<BOARD_ITEM*, BOARD_ITEM*> ptrMap;
|
||||
|
||||
// Copy reference and value.
|
||||
m_reference = new FP_TEXT( *aFootprint.m_reference );
|
||||
m_reference = new PCB_TEXT( *aFootprint.m_reference );
|
||||
m_reference->SetParent( this );
|
||||
ptrMap[ aFootprint.m_reference ] = m_reference;
|
||||
|
||||
m_value = new FP_TEXT( *aFootprint.m_value );
|
||||
m_value = new PCB_TEXT( *aFootprint.m_value );
|
||||
m_value->SetParent( this );
|
||||
ptrMap[ aFootprint.m_value ] = m_value;
|
||||
|
||||
|
@ -133,9 +133,9 @@ FOOTPRINT::FOOTPRINT( const FOOTPRINT& aFootprint ) :
|
|||
}
|
||||
|
||||
// Copy zones
|
||||
for( FP_ZONE* zone : aFootprint.Zones() )
|
||||
for( ZONE* zone : aFootprint.Zones() )
|
||||
{
|
||||
FP_ZONE* newZone = static_cast<FP_ZONE*>( zone->Clone() );
|
||||
ZONE* newZone = static_cast<ZONE*>( zone->Clone() );
|
||||
ptrMap[ zone ] = newZone;
|
||||
Add( newZone, ADD_MODE::APPEND ); // Append to ensure indexes are identical
|
||||
|
||||
|
@ -200,7 +200,7 @@ FOOTPRINT::FOOTPRINT( FOOTPRINT&& aFootprint ) :
|
|||
FOOTPRINT::~FOOTPRINT()
|
||||
{
|
||||
// Untangle group parents before doing any deleting
|
||||
for( PCB_GROUP* group : m_fp_groups )
|
||||
for( PCB_GROUP* group : m_groups )
|
||||
{
|
||||
for( BOARD_ITEM* item : group->GetItems() )
|
||||
item->SetParentGroup( nullptr );
|
||||
|
@ -216,15 +216,15 @@ FOOTPRINT::~FOOTPRINT()
|
|||
|
||||
m_pads.clear();
|
||||
|
||||
for( FP_ZONE* zone : m_fp_zones )
|
||||
for( ZONE* zone : m_zones )
|
||||
delete zone;
|
||||
|
||||
m_fp_zones.clear();
|
||||
m_zones.clear();
|
||||
|
||||
for( PCB_GROUP* group : m_fp_groups )
|
||||
for( PCB_GROUP* group : m_groups )
|
||||
delete group;
|
||||
|
||||
m_fp_groups.clear();
|
||||
m_groups.clear();
|
||||
|
||||
for( BOARD_ITEM* d : m_drawings )
|
||||
delete d;
|
||||
|
@ -252,11 +252,11 @@ bool FOOTPRINT::FixUuids()
|
|||
|
||||
// Note: one cannot fix null UUIDs inside the group, but it should not happen
|
||||
// because null uuids can be found in old footprints, therefore without group
|
||||
for( PCB_GROUP* group : m_fp_groups )
|
||||
for( PCB_GROUP* group : m_groups )
|
||||
item_list.push_back( group );
|
||||
|
||||
// Probably notneeded, because old fp do not have zones. But just in case.
|
||||
for( FP_ZONE* zone : m_fp_zones )
|
||||
for( ZONE* zone : m_zones )
|
||||
item_list.push_back( zone );
|
||||
|
||||
bool changed = false;
|
||||
|
@ -319,9 +319,9 @@ FOOTPRINT& FOOTPRINT::operator=( FOOTPRINT&& aOther )
|
|||
aOther.Pads().clear();
|
||||
|
||||
// Move the zones
|
||||
m_fp_zones.clear();
|
||||
m_zones.clear();
|
||||
|
||||
for( FP_ZONE* item : aOther.Zones() )
|
||||
for( ZONE* item : aOther.Zones() )
|
||||
{
|
||||
Add( item );
|
||||
|
||||
|
@ -343,7 +343,7 @@ FOOTPRINT& FOOTPRINT::operator=( FOOTPRINT&& aOther )
|
|||
aOther.GraphicalItems().clear();
|
||||
|
||||
// Move the groups
|
||||
m_fp_groups.clear();
|
||||
m_groups.clear();
|
||||
|
||||
for( PCB_GROUP* group : aOther.Groups() )
|
||||
Add( group );
|
||||
|
@ -419,11 +419,11 @@ FOOTPRINT& FOOTPRINT::operator=( const FOOTPRINT& aOther )
|
|||
}
|
||||
|
||||
// Copy zones
|
||||
m_fp_zones.clear();
|
||||
m_zones.clear();
|
||||
|
||||
for( FP_ZONE* zone : aOther.Zones() )
|
||||
for( ZONE* zone : aOther.Zones() )
|
||||
{
|
||||
FP_ZONE* newZone = static_cast<FP_ZONE*>( zone->Clone() );
|
||||
ZONE* newZone = static_cast<ZONE*>( zone->Clone() );
|
||||
ptrMap[ zone ] = newZone;
|
||||
Add( newZone );
|
||||
|
||||
|
@ -445,7 +445,7 @@ FOOTPRINT& FOOTPRINT::operator=( const FOOTPRINT& aOther )
|
|||
}
|
||||
|
||||
// Copy groups
|
||||
m_fp_groups.clear();
|
||||
m_groups.clear();
|
||||
|
||||
for( PCB_GROUP* group : aOther.Groups() )
|
||||
{
|
||||
|
@ -569,18 +569,18 @@ void FOOTPRINT::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode, bool aSkipConnectiv
|
|||
{
|
||||
switch( aBoardItem->Type() )
|
||||
{
|
||||
case PCB_FP_TEXT_T:
|
||||
case PCB_TEXT_T:
|
||||
// Only user text can be added this way.
|
||||
wxASSERT( static_cast<FP_TEXT*>( aBoardItem )->GetType() == FP_TEXT::TEXT_is_DIVERS );
|
||||
wxASSERT( static_cast<PCB_TEXT*>( aBoardItem )->GetType() == PCB_TEXT::TEXT_is_DIVERS );
|
||||
KI_FALLTHROUGH;
|
||||
|
||||
case PCB_FP_DIM_ALIGNED_T:
|
||||
case PCB_FP_DIM_LEADER_T:
|
||||
case PCB_FP_DIM_CENTER_T:
|
||||
case PCB_FP_DIM_RADIAL_T:
|
||||
case PCB_FP_DIM_ORTHOGONAL_T:
|
||||
case PCB_FP_SHAPE_T:
|
||||
case PCB_FP_TEXTBOX_T:
|
||||
case PCB_DIM_ALIGNED_T:
|
||||
case PCB_DIM_LEADER_T:
|
||||
case PCB_DIM_CENTER_T:
|
||||
case PCB_DIM_RADIAL_T:
|
||||
case PCB_DIM_ORTHOGONAL_T:
|
||||
case PCB_SHAPE_T:
|
||||
case PCB_TEXTBOX_T:
|
||||
case PCB_BITMAP_T:
|
||||
if( aMode == ADD_MODE::APPEND )
|
||||
m_drawings.push_back( aBoardItem );
|
||||
|
@ -595,18 +595,18 @@ void FOOTPRINT::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode, bool aSkipConnectiv
|
|||
m_pads.push_front( static_cast<PAD*>( aBoardItem ) );
|
||||
break;
|
||||
|
||||
case PCB_FP_ZONE_T:
|
||||
case PCB_ZONE_T:
|
||||
if( aMode == ADD_MODE::APPEND )
|
||||
m_fp_zones.push_back( static_cast<FP_ZONE*>( aBoardItem ) );
|
||||
m_zones.push_back( static_cast<ZONE*>( aBoardItem ) );
|
||||
else
|
||||
m_fp_zones.insert( m_fp_zones.begin(), static_cast<FP_ZONE*>( aBoardItem ) );
|
||||
m_zones.insert( m_zones.begin(), static_cast<ZONE*>( aBoardItem ) );
|
||||
break;
|
||||
|
||||
case PCB_GROUP_T:
|
||||
if( aMode == ADD_MODE::APPEND )
|
||||
m_fp_groups.push_back( static_cast<PCB_GROUP*>( aBoardItem ) );
|
||||
m_groups.push_back( static_cast<PCB_GROUP*>( aBoardItem ) );
|
||||
else
|
||||
m_fp_groups.insert( m_fp_groups.begin(), static_cast<PCB_GROUP*>( aBoardItem ) );
|
||||
m_groups.insert( m_groups.begin(), static_cast<PCB_GROUP*>( aBoardItem ) );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -629,19 +629,19 @@ void FOOTPRINT::Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aMode )
|
|||
{
|
||||
switch( aBoardItem->Type() )
|
||||
{
|
||||
case PCB_FP_TEXT_T:
|
||||
case PCB_TEXT_T:
|
||||
// Only user text can be removed this way.
|
||||
wxCHECK_RET( static_cast<FP_TEXT*>( aBoardItem )->GetType() == FP_TEXT::TEXT_is_DIVERS,
|
||||
wxCHECK_RET( static_cast<PCB_TEXT*>( aBoardItem )->GetType() == PCB_TEXT::TEXT_is_DIVERS,
|
||||
wxT( "Please report this bug: Invalid remove operation on required text" ) );
|
||||
KI_FALLTHROUGH;
|
||||
|
||||
case PCB_FP_DIM_ALIGNED_T:
|
||||
case PCB_FP_DIM_CENTER_T:
|
||||
case PCB_FP_DIM_ORTHOGONAL_T:
|
||||
case PCB_FP_DIM_RADIAL_T:
|
||||
case PCB_FP_DIM_LEADER_T:
|
||||
case PCB_FP_SHAPE_T:
|
||||
case PCB_FP_TEXTBOX_T:
|
||||
case PCB_DIM_ALIGNED_T:
|
||||
case PCB_DIM_CENTER_T:
|
||||
case PCB_DIM_ORTHOGONAL_T:
|
||||
case PCB_DIM_RADIAL_T:
|
||||
case PCB_DIM_LEADER_T:
|
||||
case PCB_SHAPE_T:
|
||||
case PCB_TEXTBOX_T:
|
||||
case PCB_BITMAP_T:
|
||||
for( auto it = m_drawings.begin(); it != m_drawings.end(); ++it )
|
||||
{
|
||||
|
@ -666,12 +666,12 @@ void FOOTPRINT::Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aMode )
|
|||
|
||||
break;
|
||||
|
||||
case PCB_FP_ZONE_T:
|
||||
for( auto it = m_fp_zones.begin(); it != m_fp_zones.end(); ++it )
|
||||
case PCB_ZONE_T:
|
||||
for( auto it = m_zones.begin(); it != m_zones.end(); ++it )
|
||||
{
|
||||
if( *it == static_cast<FP_ZONE*>( aBoardItem ) )
|
||||
if( *it == static_cast<ZONE*>( aBoardItem ) )
|
||||
{
|
||||
m_fp_zones.erase( it );
|
||||
m_zones.erase( it );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -679,11 +679,11 @@ void FOOTPRINT::Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aMode )
|
|||
break;
|
||||
|
||||
case PCB_GROUP_T:
|
||||
for( auto it = m_fp_groups.begin(); it != m_fp_groups.end(); ++it )
|
||||
for( auto it = m_groups.begin(); it != m_groups.end(); ++it )
|
||||
{
|
||||
if( *it == static_cast<PCB_GROUP*>( aBoardItem ) )
|
||||
{
|
||||
m_fp_groups.erase( it );
|
||||
m_groups.erase( it );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -847,14 +847,11 @@ const BOX2I FOOTPRINT::GetBoundingBox( bool aIncludeText, bool aIncludeInvisible
|
|||
continue;
|
||||
|
||||
// Handle text separately
|
||||
if( item->Type() == PCB_FP_TEXT_T )
|
||||
if( item->Type() == PCB_TEXT_T )
|
||||
continue;
|
||||
|
||||
// Treat dimension objects as text
|
||||
if( !aIncludeText
|
||||
&& ( item->Type() == PCB_FP_DIM_ALIGNED_T || item->Type() == PCB_FP_DIM_CENTER_T
|
||||
|| item->Type() == PCB_FP_DIM_LEADER_T || item->Type() == PCB_FP_DIM_ORTHOGONAL_T
|
||||
|| item->Type() == PCB_FP_DIM_RADIAL_T ) )
|
||||
if( !aIncludeText && BaseType( item->Type() ) == PCB_DIMENSION_T )
|
||||
continue;
|
||||
|
||||
bbox.Merge( item->GetBoundingBox() );
|
||||
|
@ -863,10 +860,10 @@ const BOX2I FOOTPRINT::GetBoundingBox( bool aIncludeText, bool aIncludeInvisible
|
|||
for( PAD* pad : m_pads )
|
||||
bbox.Merge( pad->GetBoundingBox() );
|
||||
|
||||
for( FP_ZONE* zone : m_fp_zones )
|
||||
for( ZONE* zone : m_zones )
|
||||
bbox.Merge( zone->GetBoundingBox() );
|
||||
|
||||
bool noDrawItems = ( m_drawings.empty() && m_pads.empty() && m_fp_zones.empty() );
|
||||
bool noDrawItems = ( m_drawings.empty() && m_pads.empty() && m_zones.empty() );
|
||||
|
||||
// Groups do not contribute to the rect, only their members
|
||||
if( aIncludeText || noDrawItems )
|
||||
|
@ -876,9 +873,9 @@ const BOX2I FOOTPRINT::GetBoundingBox( bool aIncludeText, bool aIncludeInvisible
|
|||
if( !isFPEdit && m_privateLayers.test( item->GetLayer() ) )
|
||||
continue;
|
||||
|
||||
// Only FP_TEXT items are independently selectable; FP_TEXTBOX items go in with
|
||||
// Only PCB_TEXT items are independently selectable; PCB_TEXTBOX items go in with
|
||||
// other graphic items above.
|
||||
if( item->Type() == PCB_FP_TEXT_T )
|
||||
if( item->Type() == PCB_TEXT_T )
|
||||
bbox.Merge( item->GetBoundingBox() );
|
||||
}
|
||||
|
||||
|
@ -960,7 +957,7 @@ SHAPE_POLY_SET FOOTPRINT::GetBoundingHull() const
|
|||
if( !isFPEdit && m_privateLayers.test( item->GetLayer() ) )
|
||||
continue;
|
||||
|
||||
if( item->Type() != PCB_FP_TEXT_T && item->Type() != PCB_BITMAP_T )
|
||||
if( item->Type() != PCB_TEXT_T && item->Type() != PCB_BITMAP_T )
|
||||
{
|
||||
item->TransformShapeToPolygon( rawPolys, UNDEFINED_LAYER, 0, ARC_LOW_DEF,
|
||||
ERROR_OUTSIDE );
|
||||
|
@ -976,7 +973,7 @@ SHAPE_POLY_SET FOOTPRINT::GetBoundingHull() const
|
|||
pad->TransformHoleToPolygon( rawPolys, 0, ARC_LOW_DEF, ERROR_OUTSIDE );
|
||||
}
|
||||
|
||||
for( FP_ZONE* zone : m_fp_zones )
|
||||
for( ZONE* zone : m_zones )
|
||||
{
|
||||
for( PCB_LAYER_ID layer : zone->GetLayerSet().Seq() )
|
||||
{
|
||||
|
@ -1104,7 +1101,7 @@ bool FOOTPRINT::IsOnLayer( PCB_LAYER_ID aLayer, bool aIncludeCourtyards ) const
|
|||
return m_layer == aLayer;
|
||||
|
||||
// No pads? Check if this entire footprint exists on the given layer
|
||||
for( FP_ZONE* zone : m_fp_zones )
|
||||
for( ZONE* zone : m_zones )
|
||||
{
|
||||
if( !zone->IsOnLayer( aLayer ) )
|
||||
return false;
|
||||
|
@ -1149,7 +1146,7 @@ bool FOOTPRINT::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) co
|
|||
return false;
|
||||
|
||||
// The empty footprint dummy rectangle intersects the selection area.
|
||||
if( m_pads.empty() && m_fp_zones.empty() && m_drawings.empty() )
|
||||
if( m_pads.empty() && m_zones.empty() && m_drawings.empty() )
|
||||
return GetBoundingBox( true, false ).Intersects( arect );
|
||||
|
||||
// Determine if any elements in the FOOTPRINT intersect the rect
|
||||
|
@ -1159,7 +1156,7 @@ bool FOOTPRINT::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) co
|
|||
return true;
|
||||
}
|
||||
|
||||
for( FP_ZONE* zone : m_fp_zones )
|
||||
for( ZONE* zone : m_zones )
|
||||
{
|
||||
if( zone->HitTest( arect, false, 0 ) )
|
||||
return true;
|
||||
|
@ -1170,11 +1167,8 @@ bool FOOTPRINT::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) co
|
|||
// Text items are selectable on their own, and are therefore excluded from this
|
||||
// test. TextBox items are NOT selectable on their own, and so MUST be included
|
||||
// here. Bitmaps aren't selectable since they aren't displayed.
|
||||
if( item->Type() != PCB_FP_TEXT_T && item->Type() != PCB_FP_TEXT_T
|
||||
&& item->HitTest( arect, false, 0 ) )
|
||||
{
|
||||
if( item->Type() != PCB_TEXT_T && item->HitTest( arect, false, 0 ) )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Groups are not hit-tested; only their members
|
||||
|
@ -1310,8 +1304,8 @@ INSPECT_RESULT FOOTPRINT::Visit( INSPECTOR inspector, void* testData,
|
|||
|
||||
break;
|
||||
|
||||
case PCB_FP_ZONE_T:
|
||||
if( IterateForward<FP_ZONE*>( m_fp_zones, inspector, testData, { scanType } )
|
||||
case PCB_ZONE_T:
|
||||
if( IterateForward<ZONE*>( m_zones, inspector, testData, { scanType } )
|
||||
== INSPECT_RESULT::QUIT )
|
||||
{
|
||||
return INSPECT_RESULT::QUIT;
|
||||
|
@ -1319,23 +1313,23 @@ INSPECT_RESULT FOOTPRINT::Visit( INSPECTOR inspector, void* testData,
|
|||
|
||||
break;
|
||||
|
||||
case PCB_FP_TEXT_T:
|
||||
case PCB_TEXT_T:
|
||||
if( inspector( m_reference, testData ) == INSPECT_RESULT::QUIT )
|
||||
return INSPECT_RESULT::QUIT;
|
||||
|
||||
if( inspector( m_value, testData ) == INSPECT_RESULT::QUIT )
|
||||
return INSPECT_RESULT::QUIT;
|
||||
|
||||
// Intentionally fall through since m_Drawings can hold PCB_FP_TEXT_T also
|
||||
// Intentionally fall through since m_Drawings can hold PCB_TEXT_T also
|
||||
KI_FALLTHROUGH;
|
||||
|
||||
case PCB_FP_DIM_ALIGNED_T:
|
||||
case PCB_FP_DIM_LEADER_T:
|
||||
case PCB_FP_DIM_CENTER_T:
|
||||
case PCB_FP_DIM_RADIAL_T:
|
||||
case PCB_FP_DIM_ORTHOGONAL_T:
|
||||
case PCB_FP_SHAPE_T:
|
||||
case PCB_FP_TEXTBOX_T:
|
||||
case PCB_DIM_ALIGNED_T:
|
||||
case PCB_DIM_LEADER_T:
|
||||
case PCB_DIM_CENTER_T:
|
||||
case PCB_DIM_RADIAL_T:
|
||||
case PCB_DIM_ORTHOGONAL_T:
|
||||
case PCB_SHAPE_T:
|
||||
case PCB_TEXTBOX_T:
|
||||
if( !drawingsScanned )
|
||||
{
|
||||
if( IterateForward<BOARD_ITEM*>( m_drawings, inspector, testData, aScanTypes )
|
||||
|
@ -1350,7 +1344,7 @@ INSPECT_RESULT FOOTPRINT::Visit( INSPECTOR inspector, void* testData,
|
|||
break;
|
||||
|
||||
case PCB_GROUP_T:
|
||||
if( IterateForward<PCB_GROUP*>( m_fp_groups, inspector, testData, { scanType } )
|
||||
if( IterateForward<PCB_GROUP*>( m_groups, inspector, testData, { scanType } )
|
||||
== INSPECT_RESULT::QUIT )
|
||||
{
|
||||
return INSPECT_RESULT::QUIT;
|
||||
|
@ -1397,10 +1391,10 @@ void FOOTPRINT::RunOnChildren( const std::function<void ( BOARD_ITEM*)>& aFuncti
|
|||
for( PAD* pad : m_pads )
|
||||
aFunction( static_cast<BOARD_ITEM*>( pad ) );
|
||||
|
||||
for( FP_ZONE* zone : m_fp_zones )
|
||||
aFunction( static_cast<FP_ZONE*>( zone ) );
|
||||
for( ZONE* zone : m_zones )
|
||||
aFunction( static_cast<ZONE*>( zone ) );
|
||||
|
||||
for( PCB_GROUP* group : m_fp_groups )
|
||||
for( PCB_GROUP* group : m_groups )
|
||||
aFunction( static_cast<PCB_GROUP*>( group ) );
|
||||
|
||||
for( BOARD_ITEM* drawing : m_drawings )
|
||||
|
@ -1573,8 +1567,8 @@ void FOOTPRINT::Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle )
|
|||
|
||||
for( BOARD_ITEM* item : m_drawings )
|
||||
{
|
||||
if( item->Type() == PCB_FP_TEXT_T )
|
||||
static_cast<FP_TEXT*>( item )->KeepUpright( orientation, newOrientation );
|
||||
if( item->Type() == PCB_TEXT_T )
|
||||
static_cast<PCB_TEXT*>( item )->KeepUpright( orientation, newOrientation );
|
||||
}
|
||||
|
||||
m_boundingBoxCacheTimeStamp = 0;
|
||||
|
@ -1624,7 +1618,7 @@ void FOOTPRINT::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
|
|||
pad->Flip( m_pos, false );
|
||||
|
||||
// Mirror zones to other side of board.
|
||||
for( ZONE* zone : m_fp_zones )
|
||||
for( ZONE* zone : m_zones )
|
||||
zone->Flip( m_pos, false );
|
||||
|
||||
// Mirror reference and value.
|
||||
|
@ -1633,39 +1627,7 @@ void FOOTPRINT::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
|
|||
|
||||
// Reverse mirror footprint graphics and texts.
|
||||
for( BOARD_ITEM* item : m_drawings )
|
||||
{
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_FP_SHAPE_T:
|
||||
static_cast<FP_SHAPE*>( item )->Flip( m_pos, false );
|
||||
break;
|
||||
|
||||
case PCB_FP_TEXT_T:
|
||||
static_cast<FP_TEXT*>( item )->Flip( m_pos, false );
|
||||
break;
|
||||
|
||||
case PCB_FP_TEXTBOX_T:
|
||||
static_cast<FP_TEXTBOX*>( item )->Flip( m_pos, false );
|
||||
break;
|
||||
|
||||
case PCB_BITMAP_T:
|
||||
static_cast<PCB_BITMAP*>( item )->Flip( m_pos, false );
|
||||
break;
|
||||
|
||||
case PCB_FP_DIM_ALIGNED_T:
|
||||
case PCB_FP_DIM_ORTHOGONAL_T:
|
||||
case PCB_FP_DIM_RADIAL_T:
|
||||
case PCB_FP_DIM_CENTER_T:
|
||||
case PCB_FP_DIM_LEADER_T:
|
||||
static_cast<PCB_DIMENSION_BASE*>( item )->Flip( m_pos, false );
|
||||
break;
|
||||
|
||||
default:
|
||||
wxMessageBox( wxString::Format( wxT( "FOOTPRINT::Flip() error: Unknown Draw Type %d" ),
|
||||
(int)item->Type() ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
item->Flip( m_pos, false );
|
||||
|
||||
// Now rotate 180 deg if required
|
||||
if( aFlipLeftRight )
|
||||
|
@ -1694,49 +1656,11 @@ void FOOTPRINT::SetPosition( const VECTOR2I& aPos )
|
|||
for( PAD* pad : m_pads )
|
||||
pad->SetPosition( pad->GetPosition() + delta );
|
||||
|
||||
for( ZONE* zone : m_fp_zones )
|
||||
for( ZONE* zone : m_zones )
|
||||
zone->Move( delta );
|
||||
|
||||
for( BOARD_ITEM* item : m_drawings )
|
||||
{
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_FP_SHAPE_T:
|
||||
{
|
||||
FP_SHAPE* shape = static_cast<FP_SHAPE*>( item );
|
||||
shape->SetDrawCoord();
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_FP_TEXTBOX_T:
|
||||
{
|
||||
FP_TEXTBOX* textb = static_cast<FP_TEXTBOX*>( item );
|
||||
textb->SetDrawCoord();
|
||||
textb->ClearRenderCache();
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_FP_TEXT_T:
|
||||
{
|
||||
FP_TEXT* text = static_cast<FP_TEXT*>( item );
|
||||
text->EDA_TEXT::Offset( delta );
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_FP_DIM_ALIGNED_T:
|
||||
case PCB_FP_DIM_CENTER_T:
|
||||
case PCB_FP_DIM_ORTHOGONAL_T:
|
||||
case PCB_FP_DIM_RADIAL_T:
|
||||
case PCB_FP_DIM_LEADER_T:
|
||||
case PCB_BITMAP_T:
|
||||
item->Move( delta );
|
||||
break;
|
||||
|
||||
default:
|
||||
wxMessageBox( wxT( "Draw type undefined." ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
item->Move( delta );
|
||||
|
||||
m_cachedBoundingBox.Move( delta );
|
||||
m_cachedVisibleBBox.Move( delta );
|
||||
|
@ -1763,10 +1687,8 @@ void FOOTPRINT::MoveAnchorPosition( const VECTOR2I& aMoveVector )
|
|||
RotatePoint( moveVector, -GetOrientation() );
|
||||
|
||||
// Update of the reference and value.
|
||||
m_reference->SetPos0( m_reference->GetPos0() + moveVector );
|
||||
m_reference->SetDrawCoord();
|
||||
m_value->SetPos0( m_value->GetPos0() + moveVector );
|
||||
m_value->SetDrawCoord();
|
||||
m_reference->Move( moveVector );
|
||||
m_value->Move( moveVector );
|
||||
|
||||
// Update the pad local coordinates.
|
||||
for( PAD* pad : m_pads )
|
||||
|
@ -1777,35 +1699,11 @@ void FOOTPRINT::MoveAnchorPosition( const VECTOR2I& aMoveVector )
|
|||
|
||||
// Update the draw element coordinates.
|
||||
for( BOARD_ITEM* item : GraphicalItems() )
|
||||
{
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_FP_SHAPE_T:
|
||||
case PCB_FP_TEXTBOX_T:
|
||||
{
|
||||
FP_SHAPE* shape = static_cast<FP_SHAPE*>( item );
|
||||
shape->Move( moveVector );
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_FP_TEXT_T:
|
||||
{
|
||||
FP_TEXT* text = static_cast<FP_TEXT*>( item );
|
||||
text->SetPos0( text->GetPos0() + moveVector );
|
||||
text->SetDrawCoord();
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
item->Move( moveVector );
|
||||
|
||||
// Update the keepout zones
|
||||
for( ZONE* zone : Zones() )
|
||||
{
|
||||
zone->Move( moveVector );
|
||||
}
|
||||
|
||||
// Update the 3D models
|
||||
for( FP_3DMODEL& model : Models() )
|
||||
|
@ -1834,37 +1732,15 @@ void FOOTPRINT::SetOrientation( const EDA_ANGLE& aNewAngle )
|
|||
pad->SetDrawCoord();
|
||||
}
|
||||
|
||||
for( ZONE* zone : m_fp_zones )
|
||||
for( ZONE* zone : m_zones )
|
||||
zone->Rotate( GetPosition(), angleChange );
|
||||
|
||||
for( BOARD_ITEM* item : m_drawings )
|
||||
{
|
||||
if( PCB_DIMENSION_BASE* dimension = dynamic_cast<PCB_DIMENSION_BASE*>( item ) )
|
||||
dimension->Rotate( GetPosition(), angleChange );
|
||||
}
|
||||
|
||||
// Update of the reference and value.
|
||||
m_reference->SetDrawCoord();
|
||||
m_value->SetDrawCoord();
|
||||
m_reference->Rotate( GetPosition(), angleChange );
|
||||
m_value->Rotate( GetPosition(), angleChange );
|
||||
|
||||
// Displace contours and text of the footprint.
|
||||
for( BOARD_ITEM* item : m_drawings )
|
||||
{
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_FP_SHAPE_T:
|
||||
case PCB_FP_TEXTBOX_T:
|
||||
static_cast<FP_SHAPE*>( item )->SetDrawCoord();
|
||||
break;
|
||||
|
||||
case PCB_FP_TEXT_T:
|
||||
static_cast<FP_TEXT*>( item )->SetDrawCoord();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
item->Rotate( GetPosition(), angleChange );
|
||||
|
||||
m_boundingBoxCacheTimeStamp = 0;
|
||||
m_visibleBBoxCacheTimeStamp = 0;
|
||||
|
@ -1891,7 +1767,6 @@ BOARD_ITEM* FOOTPRINT::Duplicate() const
|
|||
BOARD_ITEM* FOOTPRINT::DuplicateItem( const BOARD_ITEM* aItem, bool aAddToFootprint )
|
||||
{
|
||||
BOARD_ITEM* new_item = nullptr;
|
||||
FP_ZONE* new_zone = nullptr;
|
||||
|
||||
switch( aItem->Type() )
|
||||
{
|
||||
|
@ -1907,45 +1782,44 @@ BOARD_ITEM* FOOTPRINT::DuplicateItem( const BOARD_ITEM* aItem, bool aAddToFootpr
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_FP_ZONE_T:
|
||||
case PCB_ZONE_T:
|
||||
{
|
||||
new_zone = new FP_ZONE( *static_cast<const FP_ZONE*>( aItem ) );
|
||||
ZONE* new_zone = new ZONE( *static_cast<const ZONE*>( aItem ) );
|
||||
const_cast<KIID&>( new_zone->m_Uuid ) = KIID();
|
||||
|
||||
if( aAddToFootprint )
|
||||
m_fp_zones.push_back( new_zone );
|
||||
m_zones.push_back( new_zone );
|
||||
|
||||
new_item = new_zone;
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_FP_TEXT_T:
|
||||
case PCB_TEXT_T:
|
||||
{
|
||||
FP_TEXT* new_text = new FP_TEXT( *static_cast<const FP_TEXT*>( aItem ) );
|
||||
PCB_TEXT* new_text = new PCB_TEXT( *static_cast<const PCB_TEXT*>( aItem ) );
|
||||
const_cast<KIID&>( new_text->m_Uuid ) = KIID();
|
||||
|
||||
if( new_text->GetType() == FP_TEXT::TEXT_is_REFERENCE )
|
||||
if( new_text->GetType() == PCB_TEXT::TEXT_is_REFERENCE )
|
||||
{
|
||||
new_text->SetText( wxT( "${REFERENCE}" ) );
|
||||
new_text->SetType( FP_TEXT::TEXT_is_DIVERS );
|
||||
new_text->SetType( PCB_TEXT::TEXT_is_DIVERS );
|
||||
}
|
||||
else if( new_text->GetType() == FP_TEXT::TEXT_is_VALUE )
|
||||
else if( new_text->GetType() == PCB_TEXT::TEXT_is_VALUE )
|
||||
{
|
||||
new_text->SetText( wxT( "${VALUE}" ) );
|
||||
new_text->SetType( FP_TEXT::TEXT_is_DIVERS );
|
||||
new_text->SetType( PCB_TEXT::TEXT_is_DIVERS );
|
||||
}
|
||||
|
||||
if( aAddToFootprint )
|
||||
Add( new_text );
|
||||
|
||||
new_item = new_text;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_FP_SHAPE_T:
|
||||
case PCB_SHAPE_T:
|
||||
{
|
||||
FP_SHAPE* new_shape = new FP_SHAPE( *static_cast<const FP_SHAPE*>( aItem ) );
|
||||
PCB_SHAPE* new_shape = new PCB_SHAPE( *static_cast<const PCB_SHAPE*>( aItem ) );
|
||||
const_cast<KIID&>( new_shape->m_Uuid ) = KIID();
|
||||
|
||||
if( aAddToFootprint )
|
||||
|
@ -1955,9 +1829,9 @@ BOARD_ITEM* FOOTPRINT::DuplicateItem( const BOARD_ITEM* aItem, bool aAddToFootpr
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_FP_TEXTBOX_T:
|
||||
case PCB_TEXTBOX_T:
|
||||
{
|
||||
FP_TEXTBOX* new_textbox = new FP_TEXTBOX( *static_cast<const FP_TEXTBOX*>( aItem ) );
|
||||
PCB_TEXTBOX* new_textbox = new PCB_TEXTBOX( *static_cast<const PCB_TEXTBOX*>( aItem ) );
|
||||
const_cast<KIID&>( new_textbox->m_Uuid ) = KIID();
|
||||
|
||||
if( aAddToFootprint )
|
||||
|
@ -1967,11 +1841,11 @@ BOARD_ITEM* FOOTPRINT::DuplicateItem( const BOARD_ITEM* aItem, bool aAddToFootpr
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_FP_DIM_ALIGNED_T:
|
||||
case PCB_FP_DIM_LEADER_T:
|
||||
case PCB_FP_DIM_CENTER_T:
|
||||
case PCB_FP_DIM_RADIAL_T:
|
||||
case PCB_FP_DIM_ORTHOGONAL_T:
|
||||
case PCB_DIM_ALIGNED_T:
|
||||
case PCB_DIM_LEADER_T:
|
||||
case PCB_DIM_CENTER_T:
|
||||
case PCB_DIM_RADIAL_T:
|
||||
case PCB_DIM_ORTHOGONAL_T:
|
||||
{
|
||||
PCB_DIMENSION_BASE* dimension = static_cast<PCB_DIMENSION_BASE*>( aItem->Duplicate() );
|
||||
|
||||
|
@ -2075,15 +1949,15 @@ double FOOTPRINT::GetCoverageArea( const BOARD_ITEM* aItem, const GENERAL_COLLEC
|
|||
|
||||
poly = footprint->GetBoundingHull();
|
||||
}
|
||||
else if( aItem->Type() == PCB_FP_TEXT_T )
|
||||
else if( aItem->Type() == PCB_TEXT_T )
|
||||
{
|
||||
const FP_TEXT* text = static_cast<const FP_TEXT*>( aItem );
|
||||
const PCB_TEXT* text = static_cast<const PCB_TEXT*>( aItem );
|
||||
|
||||
text->TransformTextToPolySet( poly, UNDEFINED_LAYER, textMargin, ARC_LOW_DEF, ERROR_OUTSIDE );
|
||||
}
|
||||
else if( aItem->Type() == PCB_FP_TEXTBOX_T )
|
||||
else if( aItem->Type() == PCB_TEXTBOX_T )
|
||||
{
|
||||
const FP_TEXTBOX* tb = static_cast<const FP_TEXTBOX*>( aItem );
|
||||
const PCB_TEXTBOX* tb = static_cast<const PCB_TEXTBOX*>( aItem );
|
||||
|
||||
tb->TransformTextToPolySet( poly, UNDEFINED_LAYER, textMargin, ARC_LOW_DEF, ERROR_OUTSIDE );
|
||||
}
|
||||
|
@ -2151,24 +2025,17 @@ double FOOTPRINT::CoverageRatio( const GENERAL_COLLECTOR& aCollector ) const
|
|||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_FP_TEXT_T:
|
||||
case PCB_FP_TEXTBOX_T:
|
||||
case PCB_FP_SHAPE_T:
|
||||
if( item->GetParent() != this )
|
||||
{
|
||||
item->TransformShapeToPolygon( coveredRegion, UNDEFINED_LAYER, 0, ARC_LOW_DEF,
|
||||
ERROR_OUTSIDE );
|
||||
}
|
||||
break;
|
||||
|
||||
case PCB_TEXT_T:
|
||||
case PCB_TEXTBOX_T:
|
||||
case PCB_SHAPE_T:
|
||||
case PCB_TRACE_T:
|
||||
case PCB_ARC_T:
|
||||
case PCB_VIA_T:
|
||||
item->TransformShapeToPolygon( coveredRegion, UNDEFINED_LAYER, 0, ARC_LOW_DEF,
|
||||
ERROR_OUTSIDE );
|
||||
if( item->GetParent() != this )
|
||||
{
|
||||
item->TransformShapeToPolygon( coveredRegion, UNDEFINED_LAYER, 0, ARC_LOW_DEF,
|
||||
ERROR_OUTSIDE );
|
||||
}
|
||||
break;
|
||||
|
||||
case PCB_FOOTPRINT_T:
|
||||
|
@ -2225,7 +2092,7 @@ std::shared_ptr<SHAPE> FOOTPRINT::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHI
|
|||
|
||||
for( BOARD_ITEM* item : GraphicalItems() )
|
||||
{
|
||||
if( item->Type() == PCB_FP_SHAPE_T )
|
||||
if( item->Type() == PCB_SHAPE_T )
|
||||
shape->AddShape( item->GetEffectiveShape( aLayer, aFlash )->Clone() );
|
||||
}
|
||||
}
|
||||
|
@ -2255,17 +2122,17 @@ void FOOTPRINT::BuildCourtyardCaches( OUTLINE_ERROR_HANDLER* aErrorHandler )
|
|||
m_courtyard_cache_timestamp = GetBoard()->GetTimeStamp();
|
||||
|
||||
// Build the courtyard area from graphic items on the courtyard.
|
||||
// Only PCB_FP_SHAPE_T have meaning, graphic texts are ignored.
|
||||
// Only PCB_SHAPE_T have meaning, graphic texts are ignored.
|
||||
// Collect items:
|
||||
std::vector<PCB_SHAPE*> list_front;
|
||||
std::vector<PCB_SHAPE*> list_back;
|
||||
|
||||
for( BOARD_ITEM* item : GraphicalItems() )
|
||||
{
|
||||
if( item->GetLayer() == B_CrtYd && item->Type() == PCB_FP_SHAPE_T )
|
||||
if( item->GetLayer() == B_CrtYd && item->Type() == PCB_SHAPE_T )
|
||||
list_back.push_back( static_cast<PCB_SHAPE*>( item ) );
|
||||
|
||||
if( item->GetLayer() == F_CrtYd && item->Type() == PCB_FP_SHAPE_T )
|
||||
if( item->GetLayer() == F_CrtYd && item->Type() == PCB_SHAPE_T )
|
||||
list_front.push_back( static_cast<PCB_SHAPE*>( item ) );
|
||||
}
|
||||
|
||||
|
@ -2550,7 +2417,7 @@ void FOOTPRINT::CheckNetTies( const std::function<void( const BOARD_ITEM* aItem,
|
|||
copperItems.push_back( item );
|
||||
}
|
||||
|
||||
for( ZONE* zone : m_fp_zones )
|
||||
for( ZONE* zone : m_zones )
|
||||
{
|
||||
if( !zone->GetIsRuleArea() && zone->IsOnCopperLayer() )
|
||||
copperItems.push_back( zone );
|
||||
|
@ -2690,24 +2557,24 @@ bool FOOTPRINT::cmp_drawings::operator()( const BOARD_ITEM* itemA, const BOARD_I
|
|||
TEST( itemA->Type(), itemB->Type() );
|
||||
TEST( itemA->GetLayer(), itemB->GetLayer() );
|
||||
|
||||
if( itemA->Type() == PCB_FP_SHAPE_T )
|
||||
if( itemA->Type() == PCB_SHAPE_T )
|
||||
{
|
||||
const FP_SHAPE* dwgA = static_cast<const FP_SHAPE*>( itemA );
|
||||
const FP_SHAPE* dwgB = static_cast<const FP_SHAPE*>( itemB );
|
||||
const PCB_SHAPE* dwgA = static_cast<const PCB_SHAPE*>( itemA );
|
||||
const PCB_SHAPE* dwgB = static_cast<const PCB_SHAPE*>( itemB );
|
||||
|
||||
TEST( dwgA->GetShape(), dwgB->GetShape() );
|
||||
|
||||
TEST_PT( dwgA->GetStart0(), dwgB->GetStart0() );
|
||||
TEST_PT( dwgA->GetEnd0(), dwgB->GetEnd0() );
|
||||
TEST_PT( dwgA->GetStart(), dwgB->GetStart() );
|
||||
TEST_PT( dwgA->GetEnd(), dwgB->GetEnd() );
|
||||
|
||||
if( dwgA->GetShape() == SHAPE_T::ARC )
|
||||
{
|
||||
TEST_PT( dwgA->GetCenter0(), dwgB->GetCenter0() );
|
||||
TEST_PT( dwgA->GetCenter(), dwgB->GetCenter() );
|
||||
}
|
||||
else if( dwgA->GetShape() == SHAPE_T::BEZIER )
|
||||
{
|
||||
TEST_PT( dwgA->GetBezierC1_0(), dwgB->GetBezierC1_0() );
|
||||
TEST_PT( dwgA->GetBezierC2_0(), dwgB->GetBezierC2_0() );
|
||||
TEST_PT( dwgA->GetBezierC1(), dwgB->GetBezierC1() );
|
||||
TEST_PT( dwgA->GetBezierC2(), dwgB->GetBezierC2() );
|
||||
}
|
||||
else if( dwgA->GetShape() == SHAPE_T::POLY )
|
||||
{
|
||||
|
@ -2742,7 +2609,7 @@ bool FOOTPRINT::cmp_pads::operator()( const PAD* aFirst, const PAD* aSecond ) co
|
|||
}
|
||||
|
||||
|
||||
bool FOOTPRINT::cmp_zones::operator()( const FP_ZONE* aFirst, const FP_ZONE* aSecond ) const
|
||||
bool FOOTPRINT::cmp_zones::operator()( const ZONE* aFirst, const ZONE* aSecond ) const
|
||||
{
|
||||
TEST( aFirst->GetAssignedPriority(), aSecond->GetAssignedPriority() );
|
||||
TEST( aFirst->GetLayerSet().Seq(), aSecond->GetLayerSet().Seq() );
|
||||
|
@ -2839,32 +2706,32 @@ void FOOTPRINT::TransformFPShapesToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_I
|
|||
bool aIncludeText, bool aIncludeShapes,
|
||||
bool aIncludePrivateItems ) const
|
||||
{
|
||||
std::vector<FP_TEXT*> texts; // List of FP_TEXT to convert
|
||||
std::vector<PCB_TEXT*> texts; // List of PCB_TEXTs to convert
|
||||
|
||||
for( BOARD_ITEM* item : GraphicalItems() )
|
||||
{
|
||||
if( GetPrivateLayers().test( item->GetLayer() ) && !aIncludePrivateItems )
|
||||
continue;
|
||||
|
||||
if( item->Type() == PCB_FP_TEXT_T && aIncludeText )
|
||||
if( item->Type() == PCB_TEXT_T && aIncludeText )
|
||||
{
|
||||
FP_TEXT* text = static_cast<FP_TEXT*>( item );
|
||||
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
|
||||
|
||||
if( aLayer != UNDEFINED_LAYER && text->GetLayer() == aLayer && text->IsVisible() )
|
||||
texts.push_back( text );
|
||||
}
|
||||
|
||||
if( item->Type() == PCB_FP_TEXTBOX_T && aIncludeText )
|
||||
if( item->Type() == PCB_TEXTBOX_T && aIncludeText )
|
||||
{
|
||||
FP_TEXTBOX* textbox = static_cast<FP_TEXTBOX*>( item );
|
||||
PCB_TEXTBOX* textbox = static_cast<PCB_TEXTBOX*>( item );
|
||||
|
||||
if( aLayer != UNDEFINED_LAYER && textbox->GetLayer() == aLayer && textbox->IsVisible() )
|
||||
textbox->TransformShapeToPolygon( aBuffer, aLayer, 0, aError, aErrorLoc );
|
||||
}
|
||||
|
||||
if( item->Type() == PCB_FP_SHAPE_T && aIncludeShapes )
|
||||
if( item->Type() == PCB_SHAPE_T && aIncludeShapes )
|
||||
{
|
||||
const FP_SHAPE* outline = static_cast<FP_SHAPE*>( item );
|
||||
const PCB_SHAPE* outline = static_cast<PCB_SHAPE*>( item );
|
||||
|
||||
if( aLayer != UNDEFINED_LAYER && outline->GetLayer() == aLayer )
|
||||
outline->TransformShapeToPolygon( aBuffer, aLayer, 0, aError, aErrorLoc );
|
||||
|
@ -2880,7 +2747,7 @@ void FOOTPRINT::TransformFPShapesToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_I
|
|||
texts.push_back( &Value() );
|
||||
}
|
||||
|
||||
for( const FP_TEXT* text : texts )
|
||||
for( const PCB_TEXT* text : texts )
|
||||
text->TransformTextToPolySet( aBuffer, aLayer, aClearance, aError, aErrorLoc );
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -37,7 +37,7 @@
|
|||
#include <zones.h>
|
||||
#include <convert_shape_list_to_polygon.h>
|
||||
#include <pcb_item_containers.h>
|
||||
#include <fp_text.h>
|
||||
#include <pcb_text.h>
|
||||
#include <functional>
|
||||
#include <math/vector3.h>
|
||||
|
||||
|
@ -168,17 +168,17 @@ public:
|
|||
const BOX2I GetBoundingBox() const override;
|
||||
const BOX2I GetBoundingBox( bool aIncludeText, bool aIncludeInvisibleText ) const;
|
||||
|
||||
PADS& Pads() { return m_pads; }
|
||||
const PADS& Pads() const { return m_pads; }
|
||||
PADS& Pads() { return m_pads; }
|
||||
const PADS& Pads() const { return m_pads; }
|
||||
|
||||
DRAWINGS& GraphicalItems() { return m_drawings; }
|
||||
const DRAWINGS& GraphicalItems() const { return m_drawings; }
|
||||
|
||||
FP_ZONES& Zones() { return m_fp_zones; }
|
||||
const FP_ZONES& Zones() const { return m_fp_zones; }
|
||||
ZONES& Zones() { return m_zones; }
|
||||
const ZONES& Zones() const { return m_zones; }
|
||||
|
||||
FP_GROUPS& Groups() { return m_fp_groups; }
|
||||
const FP_GROUPS& Groups() const { return m_fp_groups; }
|
||||
GROUPS& Groups() { return m_groups; }
|
||||
const GROUPS& Groups() const { return m_groups; }
|
||||
|
||||
bool HasThroughHolePads() const;
|
||||
|
||||
|
@ -565,12 +565,12 @@ public:
|
|||
}
|
||||
|
||||
/// read/write accessors:
|
||||
FP_TEXT& Value() { return *m_value; }
|
||||
FP_TEXT& Reference() { return *m_reference; }
|
||||
PCB_TEXT& Value() { return *m_value; }
|
||||
PCB_TEXT& Reference() { return *m_reference; }
|
||||
|
||||
/// The const versions to keep the compiler happy.
|
||||
FP_TEXT& Value() const { return *m_value; }
|
||||
FP_TEXT& Reference() const { return *m_reference; }
|
||||
PCB_TEXT& Value() const { return *m_value; }
|
||||
PCB_TEXT& Reference() const { return *m_reference; }
|
||||
|
||||
const std::map<wxString, wxString>& GetProperties() const { return m_properties; }
|
||||
void SetProperties( const std::map<wxString, wxString>& aProps ) { m_properties = aProps; }
|
||||
|
@ -819,7 +819,7 @@ public:
|
|||
|
||||
struct cmp_zones
|
||||
{
|
||||
bool operator()( const FP_ZONE* aFirst, const FP_ZONE* aSecond ) const;
|
||||
bool operator()( const ZONE* aFirst, const ZONE* aSecond ) const;
|
||||
};
|
||||
|
||||
protected:
|
||||
|
@ -828,13 +828,13 @@ protected:
|
|||
private:
|
||||
DRAWINGS m_drawings; // BOARD_ITEMs for drawings on the board, owned by pointer.
|
||||
PADS m_pads; // PAD items, owned by pointer
|
||||
FP_ZONES m_fp_zones; // FP_ZONE items, owned by pointer
|
||||
FP_GROUPS m_fp_groups; // PCB_GROUP items, owned by pointer
|
||||
ZONES m_zones; // PCB_ZONE items, owned by pointer
|
||||
GROUPS m_groups; // PCB_GROUP items, owned by pointer
|
||||
|
||||
EDA_ANGLE m_orient; // Orientation
|
||||
VECTOR2I m_pos; // Position of footprint on the board in internal units.
|
||||
FP_TEXT* m_reference; // Component reference designator value (U34, R18..)
|
||||
FP_TEXT* m_value; // Component value (74LS00, 22K..)
|
||||
PCB_TEXT* m_reference; // Component reference designator value (U34, R18..)
|
||||
PCB_TEXT* m_value; // Component value (74LS00, 22K..)
|
||||
LIB_ID m_fpid; // The #LIB_ID of the FOOTPRINT.
|
||||
int m_attributes; // Flag bits (see FOOTPRINT_ATTR_T)
|
||||
int m_fpStatus; // For autoplace: flags (LOCKED, FIELDS_AUTOPLACED)
|
||||
|
|
|
@ -688,7 +688,7 @@ const BOX2I FOOTPRINT_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible )
|
|||
{
|
||||
for( const BOARD_ITEM* item : footprint->GraphicalItems() )
|
||||
{
|
||||
if( item->Type() == PCB_FP_TEXT_T )
|
||||
if( item->Type() == PCB_TEXT_T )
|
||||
continue;
|
||||
|
||||
hasGraphicalItem = true;
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
#include <functional>
|
||||
#include <kiway_express.h>
|
||||
#include <pcb_marker.h>
|
||||
#include <pcb_textbox.h>
|
||||
#include <pcb_shape.h>
|
||||
#include <pad.h>
|
||||
#include <zone.h>
|
||||
#include <settings/color_settings.h>
|
||||
|
@ -70,19 +72,19 @@ void FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary( LIB_ID aFPID )
|
|||
|
||||
// if either m_Reference or m_Value are gone, reinstall them -
|
||||
// otherwise you cannot see what you are doing on board
|
||||
FP_TEXT* ref = &footprint->Reference();
|
||||
FP_TEXT* val = &footprint->Value();
|
||||
PCB_TEXT* ref = &footprint->Reference();
|
||||
PCB_TEXT* val = &footprint->Value();
|
||||
|
||||
if( val && ref )
|
||||
{
|
||||
ref->SetType( FP_TEXT::TEXT_is_REFERENCE ); // just in case ...
|
||||
ref->SetType( PCB_TEXT::TEXT_is_REFERENCE ); // just in case ...
|
||||
|
||||
if( ref->GetLength() == 0 )
|
||||
if( ref->GetText().IsEmpty() )
|
||||
ref->SetText( wxT( "Ref**" ) );
|
||||
|
||||
val->SetType( FP_TEXT::TEXT_is_VALUE ); // just in case ...
|
||||
val->SetType( PCB_TEXT::TEXT_is_VALUE ); // just in case ...
|
||||
|
||||
if( val->GetLength() == 0 )
|
||||
if( val->GetText().IsEmpty() )
|
||||
val->SetText( wxT( "Val**" ) );
|
||||
}
|
||||
|
||||
|
@ -201,30 +203,30 @@ void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
|
|||
GetCanvas()->Refresh();
|
||||
break;
|
||||
|
||||
case PCB_FP_TEXT_T:
|
||||
ShowTextPropertiesDialog( aItem );
|
||||
case PCB_TEXT_T:
|
||||
ShowTextPropertiesDialog( static_cast<PCB_TEXT*>( aItem ) );
|
||||
break;
|
||||
|
||||
case PCB_FP_TEXTBOX_T:
|
||||
ShowTextBoxPropertiesDialog( aItem );
|
||||
case PCB_TEXTBOX_T:
|
||||
ShowTextBoxPropertiesDialog( static_cast<PCB_TEXTBOX*>( aItem ) );
|
||||
break;
|
||||
|
||||
case PCB_FP_SHAPE_T :
|
||||
ShowGraphicItemPropertiesDialog( aItem );
|
||||
case PCB_SHAPE_T :
|
||||
ShowGraphicItemPropertiesDialog( static_cast<PCB_SHAPE*>( aItem ) );
|
||||
break;
|
||||
|
||||
case PCB_FP_DIM_ALIGNED_T:
|
||||
case PCB_FP_DIM_CENTER_T:
|
||||
case PCB_FP_DIM_RADIAL_T:
|
||||
case PCB_FP_DIM_ORTHOGONAL_T:
|
||||
case PCB_FP_DIM_LEADER_T:
|
||||
case PCB_DIM_ALIGNED_T:
|
||||
case PCB_DIM_CENTER_T:
|
||||
case PCB_DIM_RADIAL_T:
|
||||
case PCB_DIM_ORTHOGONAL_T:
|
||||
case PCB_DIM_LEADER_T:
|
||||
{
|
||||
DIALOG_DIMENSION_PROPERTIES dlg( this, static_cast<PCB_DIMENSION_BASE*>( aItem ) );
|
||||
dlg.ShowQuasiModal();
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_FP_ZONE_T:
|
||||
case PCB_ZONE_T:
|
||||
{
|
||||
ZONE* zone = static_cast<ZONE*>( aItem );
|
||||
bool success = false;
|
||||
|
|
|
@ -36,8 +36,10 @@
|
|||
#include <tool/tool_manager.h>
|
||||
#include <tools/pcb_actions.h>
|
||||
#include <tools/board_editor_control.h>
|
||||
#include <tools/pad_tool.h>
|
||||
#include <board.h>
|
||||
#include <footprint.h>
|
||||
#include <pcb_text.h>
|
||||
#include <board_commit.h>
|
||||
#include <footprint_edit_frame.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
|
@ -49,7 +51,6 @@
|
|||
#include <project/project_file.h>
|
||||
#include <footprint_editor_settings.h>
|
||||
#include "footprint_viewer_frame.h"
|
||||
#include "tools/pad_tool.h"
|
||||
#include <wx/choicdlg.h>
|
||||
#include <wx/filedlg.h>
|
||||
|
||||
|
@ -1312,7 +1313,7 @@ FOOTPRINT* PCB_BASE_FRAME::CreateNewFootprint( const wxString& aFootprintName, b
|
|||
|
||||
for( size_t i = 2; i < settings.m_DefaultFPTextItems.size(); ++i )
|
||||
{
|
||||
FP_TEXT* textItem = new FP_TEXT( footprint );
|
||||
PCB_TEXT* textItem = new PCB_TEXT( footprint, PCB_TEXT::TEXT_is_DIVERS );
|
||||
textItem->SetText( settings.m_DefaultFPTextItems[i].m_Text );
|
||||
textItem->SetVisible( settings.m_DefaultFPTextItems[i].m_Visible );
|
||||
txt_layer = (PCB_LAYER_ID) settings.m_DefaultFPTextItems[i].m_Layer;
|
||||
|
@ -1332,9 +1333,9 @@ FOOTPRINT* PCB_BASE_FRAME::CreateNewFootprint( const wxString& aFootprintName, b
|
|||
footprint->RunOnChildren(
|
||||
[&] ( BOARD_ITEM* aChild )
|
||||
{
|
||||
if( aChild->Type() == PCB_FP_TEXT_T )
|
||||
if( aChild->Type() == PCB_TEXT_T )
|
||||
{
|
||||
FP_TEXT* textItem = static_cast<FP_TEXT*>( aChild );
|
||||
PCB_TEXT* textItem = static_cast<PCB_TEXT*>( aChild );
|
||||
PCB_LAYER_ID layer = textItem->GetLayer();
|
||||
|
||||
textItem->SetTextThickness( settings.GetTextThickness( layer ) );
|
||||
|
|
|
@ -111,10 +111,11 @@ void FOOTPRINT_PREVIEW_PANEL::renderFootprint( std::shared_ptr<FOOTPRINT> aFootp
|
|||
return INSPECT_RESULT::CONTINUE;
|
||||
};
|
||||
|
||||
aFootprint->Visit( inspector, nullptr, { PCB_FP_DIM_LEADER_T,
|
||||
PCB_FP_DIM_ORTHOGONAL_T,
|
||||
PCB_FP_DIM_CENTER_T,
|
||||
PCB_FP_DIM_RADIAL_T } );
|
||||
aFootprint->Visit( inspector, nullptr, { PCB_DIM_LEADER_T,
|
||||
PCB_DIM_ALIGNED_T,
|
||||
PCB_DIM_ORTHOGONAL_T,
|
||||
PCB_DIM_CENTER_T,
|
||||
PCB_DIM_RADIAL_T } );
|
||||
|
||||
// Ensure we are not using the high contrast mode to display the selected footprint
|
||||
KIGFX::PAINTER* painter = GetView()->GetPainter();
|
||||
|
|
|
@ -1,434 +0,0 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <core/wx_stl_compat.h>
|
||||
#include <bitmaps.h>
|
||||
#include <core/mirror.h>
|
||||
#include <macros.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
#include <settings/color_settings.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <pcb_edit_frame.h>
|
||||
#include <footprint.h>
|
||||
#include <fp_shape.h>
|
||||
#include <view/view.h>
|
||||
|
||||
|
||||
FP_SHAPE::FP_SHAPE( FOOTPRINT* parent, SHAPE_T aShape, KICAD_T aItemType ) :
|
||||
PCB_SHAPE( parent, aItemType, aShape )
|
||||
{
|
||||
m_layer = F_SilkS;
|
||||
}
|
||||
|
||||
|
||||
FP_SHAPE::~FP_SHAPE()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void FP_SHAPE::SetLocalCoord()
|
||||
{
|
||||
FOOTPRINT* fp = static_cast<FOOTPRINT*>( m_parent );
|
||||
|
||||
if( fp == NULL )
|
||||
{
|
||||
m_start0 = m_start;
|
||||
m_end0 = m_end;
|
||||
m_arcCenter0 = m_arcCenter;
|
||||
m_bezierC1_0 = m_bezierC1;
|
||||
m_bezierC2_0 = m_bezierC2;
|
||||
return;
|
||||
}
|
||||
|
||||
m_start0 = m_start - fp->GetPosition();
|
||||
m_end0 = m_end - fp->GetPosition();
|
||||
m_arcCenter0 = m_arcCenter - fp->GetPosition();
|
||||
m_bezierC1_0 = m_bezierC1 - fp->GetPosition();
|
||||
m_bezierC2_0 = m_bezierC2 - fp->GetPosition();
|
||||
|
||||
RotatePoint( &m_start0.x, &m_start0.y, - fp->GetOrientation() );
|
||||
RotatePoint( &m_end0.x, &m_end0.y, - fp->GetOrientation() );
|
||||
RotatePoint( &m_arcCenter0.x, &m_arcCenter0.y, - fp->GetOrientation() );
|
||||
RotatePoint( &m_bezierC1_0.x, &m_bezierC1_0.y, - fp->GetOrientation() );
|
||||
RotatePoint( &m_bezierC2_0.x, &m_bezierC2_0.y, - fp->GetOrientation() );
|
||||
}
|
||||
|
||||
|
||||
void FP_SHAPE::SetDrawCoord()
|
||||
{
|
||||
FOOTPRINT* fp = static_cast<FOOTPRINT*>( m_parent );
|
||||
|
||||
m_start = m_start0;
|
||||
m_end = m_end0;
|
||||
m_arcCenter = m_arcCenter0;
|
||||
m_bezierC1 = m_bezierC1_0;
|
||||
m_bezierC2 = m_bezierC2_0;
|
||||
|
||||
if( fp )
|
||||
{
|
||||
RotatePoint( &m_start.x, &m_start.y, fp->GetOrientation() );
|
||||
RotatePoint( &m_end.x, &m_end.y, fp->GetOrientation() );
|
||||
RotatePoint( &m_arcCenter.x, &m_arcCenter.y, fp->GetOrientation() );
|
||||
RotatePoint( &m_bezierC1.x, &m_bezierC1.y, fp->GetOrientation() );
|
||||
RotatePoint( &m_bezierC2.x, &m_bezierC2.y, fp->GetOrientation() );
|
||||
|
||||
m_start += fp->GetPosition();
|
||||
m_end += fp->GetPosition();
|
||||
m_arcCenter += fp->GetPosition();
|
||||
m_bezierC1 += fp->GetPosition();
|
||||
m_bezierC2 += fp->GetPosition();
|
||||
}
|
||||
|
||||
RebuildBezierToSegmentsPointsList( GetWidth() );
|
||||
}
|
||||
|
||||
|
||||
void FP_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
|
||||
{
|
||||
if( aFrame->GetName() == PCB_EDIT_FRAME_NAME )
|
||||
{
|
||||
FOOTPRINT* fp = static_cast<FOOTPRINT*>( m_parent );
|
||||
|
||||
if( fp )
|
||||
aList.emplace_back( _( "Footprint" ), fp->GetReference() );
|
||||
}
|
||||
|
||||
// append the features shared with the base class
|
||||
PCB_SHAPE::GetMsgPanelInfo( aFrame, aList );
|
||||
}
|
||||
|
||||
|
||||
wxString FP_SHAPE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "%s on %s" ),
|
||||
ShowShape(),
|
||||
GetLayerName() );
|
||||
}
|
||||
|
||||
|
||||
BITMAPS FP_SHAPE::GetMenuImage() const
|
||||
{
|
||||
return BITMAPS::show_mod_edge;
|
||||
}
|
||||
|
||||
|
||||
EDA_ITEM* FP_SHAPE::Clone() const
|
||||
{
|
||||
return new FP_SHAPE( *this );
|
||||
}
|
||||
|
||||
|
||||
VECTOR2I FP_SHAPE::GetCenter0() const
|
||||
{
|
||||
switch( m_shape )
|
||||
{
|
||||
case SHAPE_T::ARC:
|
||||
return m_arcCenter0;
|
||||
|
||||
case SHAPE_T::CIRCLE:
|
||||
return m_start0;
|
||||
|
||||
default:
|
||||
UNIMPLEMENTED_FOR( SHAPE_T_asString() );
|
||||
return VECTOR2I();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FP_SHAPE::SetCenter0( const VECTOR2I& aCenter )
|
||||
{
|
||||
switch( m_shape )
|
||||
{
|
||||
case SHAPE_T::ARC:
|
||||
m_arcCenter0 = aCenter;
|
||||
break;
|
||||
|
||||
case SHAPE_T::CIRCLE:
|
||||
m_start0 = aCenter;
|
||||
break;
|
||||
|
||||
default:
|
||||
UNIMPLEMENTED_FOR( SHAPE_T_asString() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VECTOR2I FP_SHAPE::GetArcMid0() const
|
||||
{
|
||||
// If none of the input data have changed since we loaded the arc,
|
||||
// keep the original mid point data to minimize churn
|
||||
if( m_arcMidData_0.start == m_start && m_arcMidData_0.end == m_end
|
||||
&& m_arcMidData_0.center == m_arcCenter )
|
||||
return m_arcMidData_0.mid;
|
||||
|
||||
VECTOR2I mid0 = m_start0;
|
||||
RotatePoint( mid0, m_arcCenter0, -GetArcAngle() / 2.0 );
|
||||
return mid0;
|
||||
}
|
||||
|
||||
|
||||
void FP_SHAPE::SetArcAngleAndEnd0( const EDA_ANGLE& aAngle, bool aCheckNegativeAngle )
|
||||
{
|
||||
EDA_ANGLE angle( aAngle );
|
||||
|
||||
m_end0 = m_start0;
|
||||
RotatePoint( m_end0, m_arcCenter0, -angle.Normalize720() );
|
||||
|
||||
if( aCheckNegativeAngle && aAngle < ANGLE_0 )
|
||||
std::swap( m_start0, m_end0 );
|
||||
}
|
||||
|
||||
|
||||
void FP_SHAPE::SetArcGeometry0( const VECTOR2I& aStart0, const VECTOR2I& aMid0,
|
||||
const VECTOR2I& aEnd0 )
|
||||
{
|
||||
m_start0 = aStart0;
|
||||
m_end0 = aEnd0;
|
||||
m_arcCenter0 = CalcArcCenter( aStart0, aMid0, aEnd0 );
|
||||
|
||||
m_arcMidData_0.center = m_arcCenter0;
|
||||
m_arcMidData_0.end = m_end0;
|
||||
m_arcMidData_0.mid = aMid0;
|
||||
m_arcMidData_0.start = m_start0;
|
||||
}
|
||||
|
||||
|
||||
void FP_SHAPE::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
|
||||
{
|
||||
VECTOR2I pt( 0, 0 );
|
||||
|
||||
switch( GetShape() )
|
||||
{
|
||||
case SHAPE_T::ARC:
|
||||
case SHAPE_T::SEGMENT:
|
||||
case SHAPE_T::RECT:
|
||||
case SHAPE_T::CIRCLE:
|
||||
case SHAPE_T::BEZIER:
|
||||
// If Start0 and Start are equal (ie: Footprint Editor), then flip both sets around the
|
||||
// centre point.
|
||||
if( m_start == m_start0 )
|
||||
pt = aCentre;
|
||||
|
||||
if( aFlipLeftRight )
|
||||
{
|
||||
MIRROR( m_start.x, aCentre.x );
|
||||
MIRROR( m_end.x, aCentre.x );
|
||||
MIRROR( m_arcCenter.x, aCentre.x );
|
||||
MIRROR( m_bezierC1.x, aCentre.x );
|
||||
MIRROR( m_bezierC2.x, aCentre.x );
|
||||
MIRROR( m_start0.x, pt.x );
|
||||
MIRROR( m_end0.x, pt.x );
|
||||
MIRROR( m_arcCenter0.x, pt.x );
|
||||
MIRROR( m_bezierC1_0.x, pt.x );
|
||||
MIRROR( m_bezierC2_0.x, pt.x );
|
||||
}
|
||||
else
|
||||
{
|
||||
MIRROR( m_start.y, aCentre.y );
|
||||
MIRROR( m_end.y, aCentre.y );
|
||||
MIRROR( m_arcCenter.y, aCentre.y );
|
||||
MIRROR( m_bezierC1.y, aCentre.y );
|
||||
MIRROR( m_bezierC2.y, aCentre.y );
|
||||
MIRROR( m_start0.y, pt.y );
|
||||
MIRROR( m_end0.y, pt.y );
|
||||
MIRROR( m_arcCenter0.y, pt.y );
|
||||
MIRROR( m_bezierC1_0.y, pt.y );
|
||||
MIRROR( m_bezierC2_0.y, pt.y );
|
||||
}
|
||||
|
||||
if( GetShape() == SHAPE_T::BEZIER )
|
||||
RebuildBezierToSegmentsPointsList( GetWidth() );
|
||||
|
||||
if( GetShape() == SHAPE_T::ARC )
|
||||
{
|
||||
std::swap( m_start, m_end );
|
||||
std::swap( m_start0, m_end0 );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SHAPE_T::POLY:
|
||||
// polygon corners coordinates are relative to the footprint position, orientation 0
|
||||
m_poly.Mirror( aFlipLeftRight, !aFlipLeftRight );
|
||||
break;
|
||||
|
||||
default:
|
||||
UNIMPLEMENTED_FOR( SHAPE_T_asString() );
|
||||
}
|
||||
|
||||
SetLayer( FlipLayer( GetLayer(), GetBoard()->GetCopperLayerCount() ) );
|
||||
}
|
||||
|
||||
|
||||
bool FP_SHAPE::IsParentFlipped() const
|
||||
{
|
||||
if( GetParent() && GetParent()->GetLayer() == B_Cu )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void FP_SHAPE::Mirror( const VECTOR2I& aCentre, bool aMirrorAroundXAxis )
|
||||
{
|
||||
switch( GetShape() )
|
||||
{
|
||||
case SHAPE_T::ARC:
|
||||
case SHAPE_T::SEGMENT:
|
||||
case SHAPE_T::RECT:
|
||||
case SHAPE_T::CIRCLE:
|
||||
case SHAPE_T::BEZIER:
|
||||
if( aMirrorAroundXAxis )
|
||||
{
|
||||
MIRROR( m_start0.y, aCentre.y );
|
||||
MIRROR( m_end0.y, aCentre.y );
|
||||
MIRROR( m_arcCenter0.y, aCentre.y );
|
||||
MIRROR( m_bezierC1_0.y, aCentre.y );
|
||||
MIRROR( m_bezierC2_0.y, aCentre.y );
|
||||
}
|
||||
else
|
||||
{
|
||||
MIRROR( m_start0.x, aCentre.x );
|
||||
MIRROR( m_end0.x, aCentre.x );
|
||||
MIRROR( m_arcCenter0.x, aCentre.x );
|
||||
MIRROR( m_bezierC1_0.x, aCentre.x );
|
||||
MIRROR( m_bezierC2_0.x, aCentre.x );
|
||||
}
|
||||
|
||||
if( GetShape() == SHAPE_T::ARC )
|
||||
{
|
||||
std::swap( m_start, m_end );
|
||||
std::swap( m_start0, m_end0 );
|
||||
}
|
||||
|
||||
if( GetShape() == SHAPE_T::BEZIER )
|
||||
RebuildBezierToSegmentsPointsList( GetWidth() );
|
||||
|
||||
break;
|
||||
|
||||
case SHAPE_T::POLY:
|
||||
m_poly.Mirror( !aMirrorAroundXAxis, aMirrorAroundXAxis, aCentre );
|
||||
break;
|
||||
|
||||
default:
|
||||
UNIMPLEMENTED_FOR( SHAPE_T_asString() );
|
||||
}
|
||||
|
||||
SetDrawCoord();
|
||||
}
|
||||
|
||||
|
||||
void FP_SHAPE::Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle )
|
||||
{
|
||||
// We should rotate the relative coordinates, but to avoid duplicate code do the base class
|
||||
// rotation of draw coordinates, which is acceptable because in the footprint editor
|
||||
// m_Pos0 = m_Pos
|
||||
PCB_SHAPE::Rotate( aRotCentre, aAngle );
|
||||
|
||||
// and now update the relative coordinates, which are the reference in most transforms.
|
||||
SetLocalCoord();
|
||||
}
|
||||
|
||||
|
||||
void FP_SHAPE::Move( const VECTOR2I& aMoveVector )
|
||||
{
|
||||
// Move an edge of the footprint.
|
||||
// This is a footprint shape modification.
|
||||
|
||||
switch( GetShape() )
|
||||
{
|
||||
case SHAPE_T::ARC:
|
||||
case SHAPE_T::SEGMENT:
|
||||
case SHAPE_T::RECT:
|
||||
case SHAPE_T::CIRCLE:
|
||||
case SHAPE_T::BEZIER:
|
||||
m_start0 += aMoveVector;
|
||||
m_end0 += aMoveVector;
|
||||
m_arcCenter0 += aMoveVector;
|
||||
m_bezierC1_0 += aMoveVector;
|
||||
m_bezierC2_0 += aMoveVector;
|
||||
break;
|
||||
|
||||
case SHAPE_T::POLY:
|
||||
// polygon corners coordinates are always relative to the
|
||||
// footprint position, orientation 0
|
||||
m_poly.Move( VECTOR2I( aMoveVector ) );
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
UNIMPLEMENTED_FOR( SHAPE_T_asString() );
|
||||
}
|
||||
|
||||
SetDrawCoord();
|
||||
}
|
||||
|
||||
|
||||
double FP_SHAPE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||
{
|
||||
constexpr double HIDE = std::numeric_limits<double>::max();
|
||||
|
||||
if( !aView )
|
||||
return 0;
|
||||
|
||||
// Handle Render tab switches
|
||||
if( !IsParentFlipped() && !aView->IsLayerVisible( LAYER_MOD_FR ) )
|
||||
return HIDE;
|
||||
|
||||
if( IsParentFlipped() && !aView->IsLayerVisible( LAYER_MOD_BK ) )
|
||||
return HIDE;
|
||||
|
||||
// Other layers are shown without any conditions
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
wxString FP_SHAPE::GetParentAsString() const
|
||||
{
|
||||
if( FOOTPRINT* fp = dynamic_cast<FOOTPRINT*>( m_parent ) )
|
||||
return fp->GetReference();
|
||||
|
||||
return m_parent->m_Uuid.AsString();
|
||||
}
|
||||
|
||||
|
||||
static struct FP_SHAPE_DESC
|
||||
{
|
||||
FP_SHAPE_DESC()
|
||||
{
|
||||
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
|
||||
REGISTER_TYPE( FP_SHAPE );
|
||||
propMgr.AddTypeCast( new TYPE_CAST<FP_SHAPE, BOARD_ITEM> );
|
||||
propMgr.AddTypeCast( new TYPE_CAST<FP_SHAPE, EDA_SHAPE> );
|
||||
propMgr.AddTypeCast( new TYPE_CAST<FP_SHAPE, PCB_SHAPE> );
|
||||
propMgr.InheritsAfter( TYPE_HASH( FP_SHAPE ), TYPE_HASH( BOARD_ITEM ) );
|
||||
propMgr.InheritsAfter( TYPE_HASH( FP_SHAPE ), TYPE_HASH( EDA_SHAPE ) );
|
||||
propMgr.InheritsAfter( TYPE_HASH( FP_SHAPE ), TYPE_HASH( PCB_SHAPE ) );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<FP_SHAPE, wxString>( _HKI( "Parent" ),
|
||||
NO_SETTER( FP_SHAPE, wxString ), &FP_SHAPE::GetParentAsString ) )
|
||||
.SetIsHiddenFromLibraryEditors();
|
||||
}
|
||||
} _FP_SHAPE_DESC;
|
|
@ -1,152 +0,0 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef FP_SHAPE_H
|
||||
#define FP_SHAPE_H
|
||||
|
||||
|
||||
#include <pcb_shape.h>
|
||||
|
||||
|
||||
class LINE_READER;
|
||||
class MSG_PANEL_ITEM;
|
||||
|
||||
|
||||
class FP_SHAPE : public PCB_SHAPE
|
||||
{
|
||||
public:
|
||||
FP_SHAPE( FOOTPRINT* aParent, SHAPE_T aShape = SHAPE_T::SEGMENT,
|
||||
KICAD_T aItemType = PCB_FP_SHAPE_T );
|
||||
|
||||
// Do not create a copy constructor & operator=.
|
||||
// The ones generated by the compiler are adequate.
|
||||
|
||||
~FP_SHAPE();
|
||||
|
||||
static inline bool ClassOf( const EDA_ITEM* aItem )
|
||||
{
|
||||
return aItem && PCB_FP_SHAPE_T == aItem->Type();
|
||||
}
|
||||
|
||||
bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
|
||||
{
|
||||
if( PCB_SHAPE::IsType( aScanTypes ) )
|
||||
return true;
|
||||
|
||||
// No special processing above and beyond PCB_SHAPE at present....
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the angle for arcs, and normalizes it within the range 0 - 360 degrees.
|
||||
* @param aAngle is tenths of degrees, but will soon be degrees.
|
||||
*/
|
||||
void SetArcAngleAndEnd0( const EDA_ANGLE& aAngle, bool aCheckNegativeAngle = false );
|
||||
|
||||
void SetArcGeometry0( const VECTOR2I& aStart, const VECTOR2I& aMid, const VECTOR2I& aEnd );
|
||||
|
||||
void Move( const VECTOR2I& aMoveVector ) override;
|
||||
|
||||
/**
|
||||
* Mirror horizontally or vertically. Do not change the layer.
|
||||
*/
|
||||
void Mirror( const VECTOR2I& aCentre, bool aMirrorAroundXAxis ) override;
|
||||
|
||||
void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
|
||||
|
||||
/**
|
||||
* Flip entity relative to aCentre.
|
||||
* The item is mirrored, and layer changed to the paired corresponding layer if it is on a
|
||||
* paired layer.
|
||||
* This function should be called only from FOOTPRINT::Flip because it is not usual to flip
|
||||
* an item alone, without flipping the parent footprint (consider Mirror() instead).
|
||||
*/
|
||||
void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override;
|
||||
|
||||
bool IsParentFlipped() const;
|
||||
|
||||
void SetStart0( const VECTOR2I& aPoint ) { m_start0 = aPoint; }
|
||||
const VECTOR2I& GetStart0() const { return m_start0; }
|
||||
|
||||
void SetEnd0( const VECTOR2I& aPoint ) { m_end0 = aPoint; }
|
||||
const VECTOR2I& GetEnd0() const { return m_end0; }
|
||||
|
||||
void SetBezierC1_0( const VECTOR2I& aPoint ) { m_bezierC1_0 = aPoint; }
|
||||
const VECTOR2I& GetBezierC1_0() const { return m_bezierC1_0; }
|
||||
|
||||
void SetBezierC2_0( const VECTOR2I& aPoint ) { m_bezierC2_0 = aPoint; }
|
||||
const VECTOR2I& GetBezierC2_0() const { return m_bezierC2_0; }
|
||||
|
||||
VECTOR2I GetCenter0() const;
|
||||
void SetCenter0( const VECTOR2I& aPt );
|
||||
|
||||
VECTOR2I GetArcMid0() const;
|
||||
|
||||
/**
|
||||
* Set relative coordinates from draw coordinates.
|
||||
* Call in only when the geometry or the footprint is modified and therefore the relative
|
||||
* coordinates have to be updated from the draw coordinates.
|
||||
*/
|
||||
virtual void SetLocalCoord();
|
||||
|
||||
/**
|
||||
* Set draw coordinates (absolute values ) from relative coordinates.
|
||||
* Must be called when a relative coordinate has changed in order to see the changes on screen
|
||||
*/
|
||||
virtual void SetDrawCoord();
|
||||
|
||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
||||
wxString GetClass() const override
|
||||
{
|
||||
return wxT( "MGRAPHIC" );
|
||||
}
|
||||
|
||||
wxString GetParentAsString() const;
|
||||
|
||||
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
||||
#endif
|
||||
|
||||
protected:
|
||||
VECTOR2I m_start0; ///< Start point or circle center, relative to footprint origin, orient 0.
|
||||
VECTOR2I m_end0; ///< End point or circle edge, relative to footprint origin, orient 0.
|
||||
VECTOR2I m_arcCenter0; ///< Center of arc, relative to footprint origin, orient 0.
|
||||
VECTOR2I m_bezierC1_0; ///< Bezier Control Point 1, relative to footprint origin, orient 0.
|
||||
VECTOR2I m_bezierC2_0; ///< Bezier Control Point 2, relative to footprint origin, orient 0.
|
||||
|
||||
ARC_MID m_arcMidData_0; ///< Originating Arc data, orient 0
|
||||
};
|
||||
|
||||
#endif // FP_SHAPE_H
|
|
@ -1,534 +0,0 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <pcb_edit_frame.h>
|
||||
#include <base_units.h>
|
||||
#include <bitmaps.h>
|
||||
#include <board.h>
|
||||
#include <board_design_settings.h>
|
||||
#include <core/mirror.h>
|
||||
#include <footprint.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <trigo.h>
|
||||
#include <string_utils.h>
|
||||
#include <painter.h>
|
||||
#include <geometry/shape_compound.h>
|
||||
#include <callback_gal.h>
|
||||
#include <convert_basic_shapes_to_polygon.h>
|
||||
|
||||
FP_TEXT::FP_TEXT( FOOTPRINT* aParentFootprint, TEXT_TYPE text_type ) :
|
||||
BOARD_ITEM( aParentFootprint, PCB_FP_TEXT_T ),
|
||||
EDA_TEXT( pcbIUScale )
|
||||
{
|
||||
FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( m_parent );
|
||||
|
||||
m_Type = text_type;
|
||||
SetKeepUpright( true );
|
||||
|
||||
// Set text thickness to a default value
|
||||
SetTextThickness( pcbIUScale.mmToIU( DEFAULT_TEXT_WIDTH ) );
|
||||
SetLayer( F_SilkS );
|
||||
|
||||
// Set position and give a default layer if a valid parent footprint exists
|
||||
if( parentFootprint && parentFootprint->Type() == PCB_FOOTPRINT_T )
|
||||
{
|
||||
SetTextPos( parentFootprint->GetPosition() );
|
||||
|
||||
if( IsBackLayer( parentFootprint->GetLayer() ) )
|
||||
{
|
||||
SetLayer( B_SilkS );
|
||||
SetMirrored( true );
|
||||
}
|
||||
}
|
||||
|
||||
SetDrawCoord();
|
||||
}
|
||||
|
||||
|
||||
FP_TEXT::~FP_TEXT()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool FP_TEXT::TextHitTest( const VECTOR2I& aPoint, int aAccuracy ) const
|
||||
{
|
||||
BOX2I rect = GetTextBox();
|
||||
VECTOR2I location = aPoint;
|
||||
|
||||
rect.Inflate( aAccuracy );
|
||||
|
||||
RotatePoint( location, GetTextPos(), -GetDrawRotation() );
|
||||
|
||||
return rect.Contains( location );
|
||||
}
|
||||
|
||||
|
||||
bool FP_TEXT::TextHitTest( const BOX2I& aRect, bool aContains, int aAccuracy ) const
|
||||
{
|
||||
BOX2I rect = aRect;
|
||||
|
||||
rect.Inflate( aAccuracy );
|
||||
|
||||
if( aContains )
|
||||
return rect.Contains( GetBoundingBox() );
|
||||
else
|
||||
return rect.Intersects( GetTextBox(), GetDrawRotation() );
|
||||
}
|
||||
|
||||
|
||||
void FP_TEXT::KeepUpright( const EDA_ANGLE& aOldOrientation, const EDA_ANGLE& aNewOrientation )
|
||||
{
|
||||
if( !IsKeepUpright() )
|
||||
return;
|
||||
|
||||
EDA_ANGLE newAngle = GetTextAngle() + aNewOrientation;
|
||||
newAngle.Normalize();
|
||||
|
||||
bool needsFlipped = newAngle >= ANGLE_180;
|
||||
|
||||
if( needsFlipped )
|
||||
{
|
||||
SetHorizJustify( static_cast<GR_TEXT_H_ALIGN_T>( -GetHorizJustify() ) );
|
||||
SetTextAngle( GetTextAngle() + ANGLE_180 );
|
||||
SetDrawCoord();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FP_TEXT::Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle )
|
||||
{
|
||||
// Used in footprint editing
|
||||
// Note also in footprint editor, m_Pos0 = m_Pos
|
||||
|
||||
VECTOR2I pt = GetTextPos();
|
||||
RotatePoint( pt, aRotCentre, aAngle );
|
||||
SetTextPos( pt );
|
||||
|
||||
EDA_ANGLE new_angle = GetTextAngle() + aAngle;
|
||||
new_angle.Normalize180();
|
||||
SetTextAngle( new_angle );
|
||||
|
||||
SetLocalCoord();
|
||||
}
|
||||
|
||||
|
||||
void FP_TEXT::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
|
||||
{
|
||||
// flipping the footprint is relative to the X axis
|
||||
if( aFlipLeftRight )
|
||||
{
|
||||
SetTextX( MIRRORVAL( GetTextPos().x, aCentre.x ) );
|
||||
SetTextAngle( -GetTextAngle() );
|
||||
}
|
||||
else
|
||||
{
|
||||
SetTextY( MIRRORVAL( GetTextPos().y, aCentre.y ) );
|
||||
SetTextAngle( ANGLE_180 - GetTextAngle() );
|
||||
}
|
||||
|
||||
SetLayer( FlipLayer( GetLayer(), GetBoard()->GetCopperLayerCount() ) );
|
||||
|
||||
if( ( GetLayerSet() & LSET::SideSpecificMask() ).any() )
|
||||
SetMirrored( !IsMirrored() );
|
||||
|
||||
SetLocalCoord();
|
||||
}
|
||||
|
||||
bool FP_TEXT::IsParentFlipped() const
|
||||
{
|
||||
if( GetParent() && GetParent()->GetLayer() == B_Cu )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void FP_TEXT::Mirror( const VECTOR2I& aCentre, bool aMirrorAroundXAxis )
|
||||
{
|
||||
// the position and justification are mirrored, but not the text itself
|
||||
|
||||
if( aMirrorAroundXAxis )
|
||||
{
|
||||
if( GetTextAngle() == ANGLE_VERTICAL )
|
||||
SetHorizJustify( (GR_TEXT_H_ALIGN_T) -GetHorizJustify() );
|
||||
|
||||
SetTextY( ::MIRRORVAL( GetTextPos().y, aCentre.y ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( GetTextAngle() == ANGLE_HORIZONTAL )
|
||||
SetHorizJustify( (GR_TEXT_H_ALIGN_T) -GetHorizJustify() );
|
||||
|
||||
SetTextX( ::MIRRORVAL( GetTextPos().x, aCentre.x ) );
|
||||
}
|
||||
|
||||
SetLocalCoord();
|
||||
}
|
||||
|
||||
|
||||
void FP_TEXT::Move( const VECTOR2I& aMoveVector )
|
||||
{
|
||||
Offset( aMoveVector );
|
||||
SetLocalCoord();
|
||||
}
|
||||
|
||||
|
||||
int FP_TEXT::GetLength() const
|
||||
{
|
||||
return GetText().Len();
|
||||
}
|
||||
|
||||
|
||||
void FP_TEXT::SetDrawCoord()
|
||||
{
|
||||
const FOOTPRINT* parentFootprint = static_cast<const FOOTPRINT*>( m_parent );
|
||||
|
||||
SetTextPos( m_Pos0 );
|
||||
|
||||
if( parentFootprint )
|
||||
{
|
||||
VECTOR2I pt = GetTextPos();
|
||||
RotatePoint( pt, parentFootprint->GetOrientation() );
|
||||
SetTextPos( pt );
|
||||
|
||||
Offset( parentFootprint->GetPosition() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FP_TEXT::SetLocalCoord()
|
||||
{
|
||||
const FOOTPRINT* parentFootprint = static_cast<const FOOTPRINT*>( m_parent );
|
||||
|
||||
if( parentFootprint )
|
||||
{
|
||||
m_Pos0 = GetTextPos() - parentFootprint->GetPosition();
|
||||
RotatePoint( &m_Pos0.x, &m_Pos0.y, - parentFootprint->GetOrientation() );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Pos0 = GetTextPos();
|
||||
}
|
||||
}
|
||||
|
||||
const BOX2I FP_TEXT::GetBoundingBox() const
|
||||
{
|
||||
EDA_ANGLE angle = GetDrawRotation();
|
||||
BOX2I bbox = GetTextBox();
|
||||
|
||||
if( !angle.IsZero() )
|
||||
bbox = bbox.GetBoundingBoxRotated( GetTextPos(), angle );
|
||||
|
||||
return bbox;
|
||||
}
|
||||
|
||||
|
||||
EDA_ANGLE FP_TEXT::GetDrawRotation() const
|
||||
{
|
||||
FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( m_parent );
|
||||
EDA_ANGLE rotation = GetTextAngle();
|
||||
|
||||
if( parentFootprint )
|
||||
rotation += parentFootprint->GetOrientation();
|
||||
|
||||
if( IsKeepUpright() )
|
||||
{
|
||||
// Keep angle between ]-90 .. 90 deg]. Otherwise the text is not easy to read
|
||||
while( rotation > ANGLE_90 )
|
||||
rotation -= ANGLE_180;
|
||||
|
||||
while( rotation <= -ANGLE_90 )
|
||||
rotation += ANGLE_180;
|
||||
}
|
||||
else
|
||||
{
|
||||
rotation.Normalize();
|
||||
}
|
||||
|
||||
return rotation;
|
||||
}
|
||||
|
||||
|
||||
void FP_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
static const wxString text_type_msg[3] =
|
||||
{
|
||||
_( "Reference" ), _( "Value" ), _( "Text" )
|
||||
};
|
||||
|
||||
if( aFrame->GetName() == PCB_EDIT_FRAME_NAME )
|
||||
{
|
||||
FOOTPRINT* fp = static_cast<FOOTPRINT*>( m_parent );
|
||||
|
||||
if( fp )
|
||||
aList.emplace_back( _( "Footprint" ), fp->GetReference() );
|
||||
}
|
||||
|
||||
// Don't use GetShownText() here; we want to show the user the variable references
|
||||
aList.emplace_back( _( "Text" ), UnescapeString( GetText() ) );
|
||||
|
||||
wxASSERT( m_Type >= TEXT_is_REFERENCE && m_Type <= TEXT_is_DIVERS );
|
||||
aList.emplace_back( _( "Type" ), text_type_msg[m_Type] );
|
||||
|
||||
if( aFrame->GetName() == PCB_EDIT_FRAME_NAME && IsLocked() )
|
||||
aList.emplace_back( _( "Status" ), _( "Locked" ) );
|
||||
|
||||
aList.emplace_back( _( "Display" ), IsVisible() ? _( "Yes" ) : _( "No" ) );
|
||||
|
||||
// Display text layer
|
||||
aList.emplace_back( _( "Layer" ), GetLayerName() );
|
||||
|
||||
aList.emplace_back( _( "Mirror" ), IsMirrored() ? _( "Yes" ) : _( "No" ) );
|
||||
|
||||
msg.Printf( wxT( "%g" ), GetTextAngle().AsDegrees() );
|
||||
aList.emplace_back( _( "Angle" ), msg );
|
||||
|
||||
aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
|
||||
aList.emplace_back( _( "Thickness" ), aFrame->MessageTextFromValue( GetTextThickness() ) );
|
||||
aList.emplace_back( _( "Width" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
|
||||
aList.emplace_back( _( "Height" ), aFrame->MessageTextFromValue( GetTextHeight() ) );
|
||||
}
|
||||
|
||||
|
||||
wxString FP_TEXT::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
switch( m_Type )
|
||||
{
|
||||
case TEXT_is_REFERENCE:
|
||||
return wxString::Format( _( "Reference '%s'" ),
|
||||
static_cast<FOOTPRINT*>( GetParent() )->GetReference() );
|
||||
|
||||
case TEXT_is_VALUE:
|
||||
return wxString::Format( _( "Value '%s' of %s" ),
|
||||
GetShownText(),
|
||||
static_cast<FOOTPRINT*>( GetParent() )->GetReference() );
|
||||
|
||||
default:
|
||||
return wxString::Format( _( "Footprint Text '%s' of %s" ),
|
||||
KIUI::EllipsizeMenuText( GetShownText() ),
|
||||
static_cast<FOOTPRINT*>( GetParent() )->GetReference() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BITMAPS FP_TEXT::GetMenuImage() const
|
||||
{
|
||||
return BITMAPS::text;
|
||||
}
|
||||
|
||||
|
||||
EDA_ITEM* FP_TEXT::Clone() const
|
||||
{
|
||||
return new FP_TEXT( *this );
|
||||
}
|
||||
|
||||
|
||||
const BOX2I FP_TEXT::ViewBBox() const
|
||||
{
|
||||
EDA_ANGLE angle = GetDrawRotation();
|
||||
BOX2I text_area = GetTextBox();
|
||||
|
||||
if( !angle.IsZero() )
|
||||
text_area = text_area.GetBoundingBoxRotated( GetTextPos(), angle );
|
||||
|
||||
return BOX2I( text_area.GetPosition(), text_area.GetSize() );
|
||||
}
|
||||
|
||||
|
||||
void FP_TEXT::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
{
|
||||
if( IsVisible() )
|
||||
aLayers[0] = GetLayer();
|
||||
else
|
||||
aLayers[0] = LAYER_MOD_TEXT_INVISIBLE;
|
||||
|
||||
aCount = 1;
|
||||
}
|
||||
|
||||
|
||||
double FP_TEXT::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||
{
|
||||
constexpr double HIDE = (double)std::numeric_limits<double>::max();
|
||||
|
||||
if( !aView )
|
||||
return 0.0;
|
||||
|
||||
// Hidden text gets put on the LAYER_MOD_TEXT_INVISIBLE for rendering, but
|
||||
// should only render if its native layer is visible.
|
||||
if( !aView->IsLayerVisible( GetLayer() ) )
|
||||
return HIDE;
|
||||
|
||||
// Handle Render tab switches
|
||||
if( m_Type == TEXT_is_VALUE || GetText() == wxT( "${VALUE}" ) )
|
||||
{
|
||||
if( !aView->IsLayerVisible( LAYER_MOD_VALUES ) )
|
||||
{
|
||||
return HIDE;
|
||||
}
|
||||
}
|
||||
|
||||
if( m_Type == TEXT_is_REFERENCE || GetText() == wxT( "${REFERENCE}" ) )
|
||||
{
|
||||
if( !aView->IsLayerVisible( LAYER_MOD_REFERENCES ) )
|
||||
{
|
||||
return HIDE;
|
||||
}
|
||||
}
|
||||
|
||||
if( !IsParentFlipped() && !aView->IsLayerVisible( LAYER_MOD_FR ) )
|
||||
return HIDE;
|
||||
|
||||
if( IsParentFlipped() && !aView->IsLayerVisible( LAYER_MOD_BK ) )
|
||||
return HIDE;
|
||||
|
||||
if( !aView->IsLayerVisible( LAYER_MOD_TEXT ) )
|
||||
return HIDE;
|
||||
|
||||
// Other layers are shown without any conditions
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
wxString FP_TEXT::GetShownText( int aDepth, bool aAllowExtraText ) const
|
||||
{
|
||||
const FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( GetParent() );
|
||||
|
||||
std::function<bool( wxString* )> footprintResolver =
|
||||
[&]( wxString* token ) -> bool
|
||||
{
|
||||
return parentFootprint && parentFootprint->ResolveTextVar( token, aDepth );
|
||||
};
|
||||
|
||||
wxString text = EDA_TEXT::GetShownText();
|
||||
|
||||
if( HasTextVars() )
|
||||
{
|
||||
if( aDepth < 10 )
|
||||
text = ExpandTextVars( text, &footprintResolver );
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
std::shared_ptr<SHAPE> FP_TEXT::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aFlash ) const
|
||||
{
|
||||
if( IsKnockout() )
|
||||
{
|
||||
SHAPE_POLY_SET knockouts;
|
||||
|
||||
TransformTextToPolySet( knockouts, aLayer, 0, GetBoard()->GetDesignSettings().m_MaxError,
|
||||
ERROR_INSIDE );
|
||||
|
||||
SHAPE_POLY_SET finalPoly;
|
||||
int strokeWidth = GetEffectiveTextPenWidth();
|
||||
VECTOR2I fontSize = GetTextSize();
|
||||
int margin = strokeWidth * 1.5 + GetKnockoutTextMargin( fontSize, strokeWidth );
|
||||
|
||||
TransformBoundingBoxToPolygon( &finalPoly, margin );
|
||||
finalPoly.BooleanSubtract( knockouts, SHAPE_POLY_SET::PM_FAST );
|
||||
finalPoly.Fracture( SHAPE_POLY_SET::PM_FAST );
|
||||
|
||||
return std::make_shared<SHAPE_POLY_SET>( finalPoly );
|
||||
}
|
||||
|
||||
return GetEffectiveTextShape();
|
||||
}
|
||||
|
||||
|
||||
void FP_TEXT::TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
|
||||
int aError, ERROR_LOC aErrorLoc ) const
|
||||
{
|
||||
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
|
||||
KIFONT::FONT* font = getDrawFont();
|
||||
int penWidth = GetEffectiveTextPenWidth();
|
||||
|
||||
// The polygonal shape of a text can have many basic shapes, so combining these shapes can
|
||||
// be very useful to create a final shape with a lot less vertices to speedup calculations.
|
||||
// Simplify shapes is not usually always efficient, but in this case it is.
|
||||
SHAPE_POLY_SET buffer;
|
||||
|
||||
CALLBACK_GAL callback_gal( empty_opts,
|
||||
// Stroke callback
|
||||
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
|
||||
{
|
||||
TransformOvalToPolygon( buffer, aPt1, aPt2, penWidth + ( 2 * aClearance ), aError,
|
||||
ERROR_INSIDE );
|
||||
},
|
||||
// Triangulation callback
|
||||
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2, const VECTOR2I& aPt3 )
|
||||
{
|
||||
buffer.NewOutline();
|
||||
|
||||
for( const VECTOR2I& point : { aPt1, aPt2, aPt3 } )
|
||||
buffer.Append( point.x, point.y );
|
||||
} );
|
||||
|
||||
TEXT_ATTRIBUTES attrs = GetAttributes();
|
||||
attrs.m_Angle = GetDrawRotation();
|
||||
|
||||
font->Draw( &callback_gal, GetShownText(), GetTextPos(), attrs );
|
||||
|
||||
buffer.Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||
aBuffer.Append( buffer );
|
||||
}
|
||||
|
||||
|
||||
void FP_TEXT::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
|
||||
int aError, ERROR_LOC aErrorLoc, bool aIgnoreLineWidth ) const
|
||||
{
|
||||
SHAPE_POLY_SET buffer;
|
||||
|
||||
EDA_TEXT::TransformBoundingBoxToPolygon( &buffer, aClearance );
|
||||
aBuffer.Append( buffer );
|
||||
}
|
||||
|
||||
|
||||
wxString FP_TEXT::GetParentAsString() const
|
||||
{
|
||||
if( FOOTPRINT* fp = dynamic_cast<FOOTPRINT*>( m_parent ) )
|
||||
return fp->GetReference();
|
||||
|
||||
return m_parent->m_Uuid.AsString();
|
||||
}
|
||||
|
||||
|
||||
static struct FP_TEXT_DESC
|
||||
{
|
||||
FP_TEXT_DESC()
|
||||
{
|
||||
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
|
||||
REGISTER_TYPE( FP_TEXT );
|
||||
propMgr.AddTypeCast( new TYPE_CAST<FP_TEXT, BOARD_ITEM> );
|
||||
propMgr.AddTypeCast( new TYPE_CAST<FP_TEXT, EDA_TEXT> );
|
||||
propMgr.InheritsAfter( TYPE_HASH( FP_TEXT ), TYPE_HASH( BOARD_ITEM ) );
|
||||
propMgr.InheritsAfter( TYPE_HASH( FP_TEXT ), TYPE_HASH( EDA_TEXT ) );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<FP_TEXT, wxString>( _HKI( "Parent" ),
|
||||
NO_SETTER( FP_TEXT, wxString ), &FP_TEXT::GetParentAsString ) )
|
||||
.SetIsHiddenFromLibraryEditors();
|
||||
}
|
||||
} _FP_TEXT_DESC;
|
199
pcbnew/fp_text.h
199
pcbnew/fp_text.h
|
@ -1,199 +0,0 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef FP_TEXT_H
|
||||
#define FP_TEXT_H
|
||||
|
||||
#include <eda_text.h>
|
||||
#include <board_item.h>
|
||||
|
||||
class LINE_READER;
|
||||
class FOOTPRINT;
|
||||
class MSG_PANEL_ITEM;
|
||||
class PCB_BASE_FRAME;
|
||||
class SHAPE;
|
||||
|
||||
|
||||
class FP_TEXT : public BOARD_ITEM, public EDA_TEXT
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Footprint text type: there must be only one (and only one) for each of the reference
|
||||
* value texts in one footprint; others could be added for the user (DIVERS is French for
|
||||
* 'others'). Reference and value always live on silkscreen (on the footprint side); other
|
||||
* texts are planned to go on whatever layer the user wants.
|
||||
*/
|
||||
enum TEXT_TYPE
|
||||
{
|
||||
TEXT_is_REFERENCE = 0,
|
||||
TEXT_is_VALUE = 1,
|
||||
TEXT_is_DIVERS = 2
|
||||
};
|
||||
|
||||
FP_TEXT( FOOTPRINT* aParentFootprint, TEXT_TYPE text_type = TEXT_is_DIVERS );
|
||||
|
||||
// Do not create a copy constructor & operator=.
|
||||
// The ones generated by the compiler are adequate.
|
||||
|
||||
~FP_TEXT();
|
||||
|
||||
static inline bool ClassOf( const EDA_ITEM* aItem )
|
||||
{
|
||||
return aItem && aItem->Type() == PCB_FP_TEXT_T;
|
||||
}
|
||||
|
||||
bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
|
||||
{
|
||||
if( BOARD_ITEM::IsType( aScanTypes ) )
|
||||
return true;
|
||||
|
||||
for( KICAD_T scanType : aScanTypes )
|
||||
{
|
||||
if( scanType == PCB_LOCATE_TEXT_T )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
wxString GetParentAsString() const;
|
||||
|
||||
bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override
|
||||
{
|
||||
return BOARD_ITEM::Matches( GetShownText(), aSearchData );
|
||||
}
|
||||
|
||||
virtual VECTOR2I GetPosition() const override
|
||||
{
|
||||
return EDA_TEXT::GetTextPos();
|
||||
}
|
||||
|
||||
virtual void SetPosition( const VECTOR2I& aPos ) override
|
||||
{
|
||||
EDA_TEXT::SetTextPos( aPos );
|
||||
SetLocalCoord();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when rotating the parent footprint.
|
||||
*/
|
||||
void KeepUpright( const EDA_ANGLE& aOldOrientation, const EDA_ANGLE& aNewOrientation );
|
||||
|
||||
void Rotate( const VECTOR2I& aOffset, const EDA_ANGLE& aAngle ) override;
|
||||
|
||||
/// Flip entity during footprint flip
|
||||
void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override;
|
||||
|
||||
bool IsParentFlipped() const;
|
||||
|
||||
/**
|
||||
* Mirror text position. Do not mirror the text itself, or change its layer.
|
||||
*/
|
||||
void Mirror( const VECTOR2I& aCentre, bool aMirrorAroundXAxis );
|
||||
|
||||
void Move( const VECTOR2I& aMoveVector ) override;
|
||||
|
||||
/// @deprecated it seems (but the type is used to 'protect' reference and value from deletion,
|
||||
/// and for identification)
|
||||
void SetType( TEXT_TYPE aType ) { m_Type = aType; }
|
||||
TEXT_TYPE GetType() const { return m_Type; }
|
||||
|
||||
// The Pos0 accessors are for footprint-relative coordinates.
|
||||
void SetPos0( const VECTOR2I& aPos ) { m_Pos0 = aPos; SetDrawCoord(); }
|
||||
const VECTOR2I& GetPos0() const { return m_Pos0; }
|
||||
|
||||
int GetLength() const; // text length
|
||||
|
||||
/**
|
||||
* @return the text rotation for drawings and plotting the footprint rotation is taken
|
||||
* in account.
|
||||
*/
|
||||
virtual EDA_ANGLE GetDrawRotation() const override;
|
||||
|
||||
// Virtual function
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
///< Set absolute coordinates.
|
||||
void SetDrawCoord();
|
||||
|
||||
///< Set relative coordinates.
|
||||
void SetLocalCoord();
|
||||
|
||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
||||
bool TextHitTest( const VECTOR2I& aPoint, int aAccuracy = 0 ) const override;
|
||||
bool TextHitTest( const BOX2I& aRect, bool aContains, int aAccuracy = 0 ) const override;
|
||||
|
||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy ) const override
|
||||
{
|
||||
return TextHitTest( aPosition, aAccuracy );
|
||||
}
|
||||
|
||||
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override
|
||||
{
|
||||
return TextHitTest( aRect, aContained, aAccuracy );
|
||||
}
|
||||
|
||||
void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
|
||||
int aError, ERROR_LOC aErrorLoc,
|
||||
bool aIgnoreLineWidth ) const override;
|
||||
|
||||
void TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
|
||||
int aError, ERROR_LOC aErrorLoc ) const;
|
||||
|
||||
// @copydoc BOARD_ITEM::GetEffectiveShape
|
||||
std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
|
||||
FLASHING aFlash = FLASHING::DEFAULT ) const override;
|
||||
|
||||
wxString GetClass() const override
|
||||
{
|
||||
return wxT( "FP_TEXT" );
|
||||
}
|
||||
|
||||
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
||||
virtual wxString GetShownText( int aDepth = 0, bool aAllowExtraText = true ) const override;
|
||||
|
||||
virtual const BOX2I ViewBBox() const override;
|
||||
|
||||
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
|
||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
|
||||
#if defined(DEBUG)
|
||||
virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
||||
#endif
|
||||
|
||||
private:
|
||||
TEXT_TYPE m_Type; ///< 0=ref, 1=val, etc.
|
||||
|
||||
VECTOR2I m_Pos0; ///< text coordinates relative to the footprint anchor, orient 0.
|
||||
///< text coordinate ref point is the text center
|
||||
};
|
||||
|
||||
#endif // FP_TEXT_H
|
|
@ -27,6 +27,7 @@
|
|||
#include <widgets/grid_combobox.h>
|
||||
#include <trigo.h>
|
||||
#include <pcb_base_frame.h>
|
||||
#include <footprint.h>
|
||||
#include "grid_layer_box_helpers.h"
|
||||
|
||||
enum
|
||||
|
@ -193,8 +194,8 @@ wxGridCellAttr* FP_TEXT_GRID_TABLE::GetAttr( int aRow, int aCol, wxGridCellAttr:
|
|||
|
||||
wxString FP_TEXT_GRID_TABLE::GetValue( int aRow, int aCol )
|
||||
{
|
||||
wxGrid* grid = GetView();
|
||||
const FP_TEXT& text = this->at( (size_t) aRow );
|
||||
wxGrid* grid = GetView();
|
||||
const PCB_TEXT& text = this->at( (size_t) aRow );
|
||||
|
||||
if( grid->GetGridCursorRow() == aRow && grid->GetGridCursorCol() == aCol
|
||||
&& grid->IsCellEditControlShown() )
|
||||
|
@ -223,13 +224,16 @@ wxString FP_TEXT_GRID_TABLE::GetValue( int aRow, int aCol )
|
|||
return text.GetLayerName();
|
||||
|
||||
case FPT_ORIENTATION:
|
||||
return m_frame->StringFromValue( text.GetTextAngle(), true );
|
||||
{
|
||||
EDA_ANGLE angle = text.GetTextAngle() - text.GetParentFootprint()->GetOrientation();
|
||||
return m_frame->StringFromValue( angle, true );
|
||||
}
|
||||
|
||||
case FPT_XOFFSET:
|
||||
return m_frame->StringFromValue( text.GetPos0().x, true );
|
||||
return m_frame->StringFromValue( text.GetFPRelativePosition().x, true );
|
||||
|
||||
case FPT_YOFFSET:
|
||||
return m_frame->StringFromValue( text.GetPos0().y, true );
|
||||
return m_frame->StringFromValue( text.GetFPRelativePosition().y, true );
|
||||
|
||||
default:
|
||||
// we can't assert here because wxWidgets sometimes calls this without checking
|
||||
|
@ -241,7 +245,7 @@ wxString FP_TEXT_GRID_TABLE::GetValue( int aRow, int aCol )
|
|||
|
||||
bool FP_TEXT_GRID_TABLE::GetValueAsBool( int aRow, int aCol )
|
||||
{
|
||||
FP_TEXT& text = this->at( (size_t) aRow );
|
||||
PCB_TEXT& text = this->at( (size_t) aRow );
|
||||
|
||||
switch( aCol )
|
||||
{
|
||||
|
@ -258,7 +262,7 @@ bool FP_TEXT_GRID_TABLE::GetValueAsBool( int aRow, int aCol )
|
|||
|
||||
long FP_TEXT_GRID_TABLE::GetValueAsLong( int aRow, int aCol )
|
||||
{
|
||||
FP_TEXT& text = this->at( (size_t) aRow );
|
||||
PCB_TEXT& text = this->at( (size_t) aRow );
|
||||
|
||||
switch( aCol )
|
||||
{
|
||||
|
@ -273,9 +277,9 @@ long FP_TEXT_GRID_TABLE::GetValueAsLong( int aRow, int aCol )
|
|||
|
||||
void FP_TEXT_GRID_TABLE::SetValue( int aRow, int aCol, const wxString &aValue )
|
||||
{
|
||||
FP_TEXT& text = this->at( (size_t) aRow );
|
||||
VECTOR2I pos;
|
||||
wxString value = aValue;
|
||||
PCB_TEXT& text = this->at( (size_t) aRow );
|
||||
VECTOR2I pos;
|
||||
wxString value = aValue;
|
||||
|
||||
switch( aCol )
|
||||
{
|
||||
|
@ -317,21 +321,20 @@ void FP_TEXT_GRID_TABLE::SetValue( int aRow, int aCol, const wxString &aValue )
|
|||
break;
|
||||
|
||||
case FPT_ORIENTATION:
|
||||
text.SetTextAngle( m_frame->AngleValueFromString( value ) );
|
||||
text.SetDrawCoord();
|
||||
text.SetTextAngle( m_frame->AngleValueFromString( value )
|
||||
+ text.GetParentFootprint()->GetOrientation() );
|
||||
break;
|
||||
|
||||
case FPT_XOFFSET:
|
||||
case FPT_YOFFSET:
|
||||
pos = text.GetPos0();
|
||||
pos = text.GetFPRelativePosition();
|
||||
|
||||
if( aCol == FPT_XOFFSET )
|
||||
pos.x = m_frame->ValueFromString( value );
|
||||
else
|
||||
pos.y = m_frame->ValueFromString( value );
|
||||
|
||||
text.SetPos0( pos );
|
||||
text.SetDrawCoord();
|
||||
text.SetFPRelativePosition( pos );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -345,7 +348,7 @@ void FP_TEXT_GRID_TABLE::SetValue( int aRow, int aCol, const wxString &aValue )
|
|||
|
||||
void FP_TEXT_GRID_TABLE::SetValueAsBool( int aRow, int aCol, bool aValue )
|
||||
{
|
||||
FP_TEXT& text = this->at( (size_t) aRow );
|
||||
PCB_TEXT& text = this->at( (size_t) aRow );
|
||||
|
||||
switch( aCol )
|
||||
{
|
||||
|
@ -369,7 +372,7 @@ void FP_TEXT_GRID_TABLE::SetValueAsBool( int aRow, int aCol, bool aValue )
|
|||
|
||||
void FP_TEXT_GRID_TABLE::SetValueAsLong( int aRow, int aCol, long aValue )
|
||||
{
|
||||
FP_TEXT& text = this->at( (size_t) aRow );
|
||||
PCB_TEXT& text = this->at( (size_t) aRow );
|
||||
|
||||
switch( aCol )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2018-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2018-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -26,10 +26,9 @@
|
|||
|
||||
#include <wx/grid.h>
|
||||
#include <grid_tricks.h>
|
||||
#include <fp_text.h>
|
||||
#include <pcb_text.h>
|
||||
|
||||
|
||||
class FOOTPRINT;
|
||||
class PCB_BASE_FRAME;
|
||||
|
||||
enum FP_TEXT_COL_ORDER
|
||||
|
@ -50,7 +49,7 @@ enum FP_TEXT_COL_ORDER
|
|||
};
|
||||
|
||||
|
||||
class FP_TEXT_GRID_TABLE : public wxGridTableBase, public std::vector<FP_TEXT>
|
||||
class FP_TEXT_GRID_TABLE : public wxGridTableBase, public std::vector<PCB_TEXT>
|
||||
{
|
||||
public:
|
||||
FP_TEXT_GRID_TABLE( PCB_BASE_FRAME* aFrame );
|
||||
|
|
|
@ -1,614 +0,0 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2022-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <pcb_edit_frame.h>
|
||||
#include <board.h>
|
||||
#include <board_design_settings.h>
|
||||
#include <core/mirror.h>
|
||||
#include <footprint.h>
|
||||
#include <fp_textbox.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <string_utils.h>
|
||||
#include <painter.h>
|
||||
#include <geometry/shape_compound.h>
|
||||
#include <callback_gal.h>
|
||||
#include <convert_basic_shapes_to_polygon.h>
|
||||
#include <macros.h>
|
||||
|
||||
|
||||
FP_TEXTBOX::FP_TEXTBOX( FOOTPRINT* aParentFootprint ) :
|
||||
FP_SHAPE( aParentFootprint, SHAPE_T::RECT, PCB_FP_TEXTBOX_T ),
|
||||
EDA_TEXT( pcbIUScale )
|
||||
{
|
||||
SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
|
||||
SetVertJustify( GR_TEXT_V_ALIGN_TOP );
|
||||
SetMultilineAllowed( true );
|
||||
|
||||
SetDrawCoord();
|
||||
}
|
||||
|
||||
|
||||
FP_TEXTBOX::~FP_TEXTBOX()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int FP_TEXTBOX::GetTextMargin() const
|
||||
{
|
||||
return KiROUND( GetStroke().GetWidth() / 2.0 ) + KiROUND( GetTextSize().y * 0.75 );
|
||||
}
|
||||
|
||||
|
||||
VECTOR2I FP_TEXTBOX::GetTopLeft() const
|
||||
{
|
||||
EDA_ANGLE rotation = GetDrawRotation();
|
||||
|
||||
if( rotation == ANGLE_90 )
|
||||
return VECTOR2I( GetStartX(), GetEndY() );
|
||||
else if( rotation == ANGLE_180 )
|
||||
return GetEnd();
|
||||
else if( rotation == ANGLE_270 )
|
||||
return VECTOR2I( GetEndX(), GetStartY() );
|
||||
else
|
||||
return GetStart();
|
||||
}
|
||||
|
||||
|
||||
VECTOR2I FP_TEXTBOX::GetBotRight() const
|
||||
{
|
||||
EDA_ANGLE rotation = GetDrawRotation();
|
||||
|
||||
if( rotation == ANGLE_90 )
|
||||
return VECTOR2I( GetEndX(), GetStartY() );
|
||||
else if( rotation == ANGLE_180 )
|
||||
return GetStart();
|
||||
else if( rotation == ANGLE_270 )
|
||||
return VECTOR2I( GetStartX(), GetEndY() );
|
||||
else
|
||||
return GetEnd();
|
||||
}
|
||||
|
||||
|
||||
void FP_TEXTBOX::SetTop( int aVal )
|
||||
{
|
||||
EDA_ANGLE rotation = GetDrawRotation();
|
||||
|
||||
if( rotation == ANGLE_90 || rotation == ANGLE_180 )
|
||||
SetEndY( aVal );
|
||||
else
|
||||
SetStartY( aVal );
|
||||
}
|
||||
|
||||
|
||||
void FP_TEXTBOX::SetBottom( int aVal )
|
||||
{
|
||||
EDA_ANGLE rotation = GetDrawRotation();
|
||||
|
||||
if( rotation == ANGLE_90 || rotation == ANGLE_180 )
|
||||
SetStartY( aVal );
|
||||
else
|
||||
SetEndY( aVal );
|
||||
}
|
||||
|
||||
|
||||
void FP_TEXTBOX::SetLeft( int aVal )
|
||||
{
|
||||
EDA_ANGLE rotation = GetDrawRotation();
|
||||
|
||||
if( rotation == ANGLE_180 || rotation == ANGLE_270 )
|
||||
SetEndX( aVal );
|
||||
else
|
||||
SetStartX( aVal );
|
||||
}
|
||||
|
||||
|
||||
void FP_TEXTBOX::SetRight( int aVal )
|
||||
{
|
||||
EDA_ANGLE rotation = GetDrawRotation();
|
||||
|
||||
if( rotation == ANGLE_180 || rotation == ANGLE_270 )
|
||||
SetStartX( aVal );
|
||||
else
|
||||
SetEndX( aVal );
|
||||
}
|
||||
|
||||
|
||||
void FP_TEXTBOX::SetTextAngle( const EDA_ANGLE& aAngle )
|
||||
{
|
||||
EDA_ANGLE delta = aAngle.Normalized() - GetTextAngle();
|
||||
Rotate( GetPosition(), delta );
|
||||
}
|
||||
|
||||
|
||||
std::vector<VECTOR2I> FP_TEXTBOX::GetCorners() const
|
||||
{
|
||||
std::vector<VECTOR2I> pts = FP_SHAPE::GetCorners();
|
||||
|
||||
// SHAPE_T::POLY doesn't use the DrawCoord/LocalCoord architecture and instead stores fully
|
||||
// resolved points (ie: relative to the board, not parent footprint).
|
||||
if( GetShape() == SHAPE_T::POLY )
|
||||
{
|
||||
if( FOOTPRINT* parentFootprint = PCB_SHAPE::GetParentFootprint() )
|
||||
{
|
||||
for( VECTOR2I& pt : pts )
|
||||
RotatePoint( pt, parentFootprint->GetPosition(), parentFootprint->GetOrientation() );
|
||||
}
|
||||
}
|
||||
|
||||
return pts;
|
||||
}
|
||||
|
||||
|
||||
EDA_ANGLE FP_TEXTBOX::GetDrawRotation() const
|
||||
{
|
||||
EDA_ANGLE rotation = GetTextAngle();
|
||||
|
||||
if( FOOTPRINT* parentFootprint = PCB_SHAPE::GetParentFootprint() )
|
||||
rotation += parentFootprint->GetOrientation();
|
||||
|
||||
rotation.Normalize();
|
||||
|
||||
return rotation;
|
||||
}
|
||||
|
||||
|
||||
std::vector<VECTOR2I> FP_TEXTBOX::GetNormalizedCorners() const
|
||||
{
|
||||
std::vector<VECTOR2I> corners = GetCorners();
|
||||
EDA_ANGLE textAngle( GetDrawRotation() );
|
||||
|
||||
if( FOOTPRINT* parentFootprint = PCB_SHAPE::GetParentFootprint() )
|
||||
{
|
||||
if( parentFootprint->IsFlipped() )
|
||||
std::swap( corners[1], corners[3] );
|
||||
}
|
||||
|
||||
textAngle.Normalize();
|
||||
|
||||
if( textAngle < ANGLE_90 )
|
||||
{
|
||||
if( corners[1].y > corners[0].y )
|
||||
std::swap( corners[1], corners[3] );
|
||||
}
|
||||
else if( textAngle < ANGLE_180 )
|
||||
{
|
||||
if( corners[1].x > corners[0].x )
|
||||
std::swap( corners[1], corners[3] );
|
||||
}
|
||||
else if( textAngle < ANGLE_270 )
|
||||
{
|
||||
if( corners[1].y < corners[0].y )
|
||||
std::swap( corners[1], corners[3] );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( corners[1].x < corners[0].x )
|
||||
std::swap( corners[1], corners[3] );
|
||||
}
|
||||
|
||||
return corners;
|
||||
}
|
||||
|
||||
|
||||
VECTOR2I FP_TEXTBOX::GetDrawPos() const
|
||||
{
|
||||
std::vector<VECTOR2I> corners = GetNormalizedCorners();
|
||||
GR_TEXT_H_ALIGN_T effectiveAlignment = GetHorizJustify();
|
||||
VECTOR2I textAnchor;
|
||||
VECTOR2I vMargin;
|
||||
VECTOR2I hMargin;
|
||||
bool isFlipped = false;
|
||||
|
||||
if( FOOTPRINT* parentFootprint = PCB_SHAPE::GetParentFootprint() )
|
||||
isFlipped = parentFootprint->IsFlipped();
|
||||
|
||||
if( IsMirrored() != isFlipped )
|
||||
{
|
||||
std::swap( corners[0], corners[1] );
|
||||
std::swap( corners[2], corners[3] );
|
||||
|
||||
switch( GetHorizJustify() )
|
||||
{
|
||||
case GR_TEXT_H_ALIGN_LEFT: effectiveAlignment = GR_TEXT_H_ALIGN_RIGHT; break;
|
||||
case GR_TEXT_H_ALIGN_CENTER: effectiveAlignment = GR_TEXT_H_ALIGN_CENTER; break;
|
||||
case GR_TEXT_H_ALIGN_RIGHT: effectiveAlignment = GR_TEXT_H_ALIGN_LEFT; break;
|
||||
}
|
||||
}
|
||||
|
||||
switch( effectiveAlignment )
|
||||
{
|
||||
case GR_TEXT_H_ALIGN_LEFT:
|
||||
textAnchor = corners[0];
|
||||
vMargin = ( corners[2] - corners[1] ).Resize( GetTextMargin() );
|
||||
hMargin = ( corners[1] - corners[0] ).Resize( GetTextMargin() );
|
||||
break;
|
||||
case GR_TEXT_H_ALIGN_CENTER:
|
||||
textAnchor = ( corners[0] + corners[1] ) / 2;
|
||||
vMargin = ( corners[2] - corners[1] ).Resize( GetTextMargin() );
|
||||
break;
|
||||
case GR_TEXT_H_ALIGN_RIGHT:
|
||||
textAnchor = corners[1];
|
||||
vMargin = ( corners[2] - corners[1] ).Resize( GetTextMargin() );
|
||||
hMargin = ( corners[0] - corners[1] ).Resize( GetTextMargin() );
|
||||
break;
|
||||
}
|
||||
|
||||
return textAnchor + hMargin + vMargin;
|
||||
}
|
||||
|
||||
|
||||
bool FP_TEXTBOX::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const
|
||||
{
|
||||
BOX2I rect = GetBoundingBox();
|
||||
|
||||
rect.Inflate( aAccuracy );
|
||||
|
||||
return rect.Contains( aPosition );
|
||||
}
|
||||
|
||||
|
||||
bool FP_TEXTBOX::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const
|
||||
{
|
||||
BOX2I rect = aRect;
|
||||
|
||||
rect.Inflate( aAccuracy );
|
||||
|
||||
if( aContained )
|
||||
return rect.Contains( GetBoundingBox() );
|
||||
|
||||
return rect.Intersects( GetBoundingBox() );
|
||||
}
|
||||
|
||||
|
||||
void FP_TEXTBOX::Move( const VECTOR2I& aMoveVector )
|
||||
{
|
||||
FP_SHAPE::Move( aMoveVector );
|
||||
EDA_TEXT::Offset( aMoveVector );
|
||||
}
|
||||
|
||||
|
||||
void FP_TEXTBOX::Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle )
|
||||
{
|
||||
FP_SHAPE::Rotate( aRotCentre, aAngle );
|
||||
EDA_TEXT::SetTextAngle( ( GetTextAngle() + aAngle ).Normalized() );
|
||||
}
|
||||
|
||||
|
||||
void FP_TEXTBOX::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
|
||||
{
|
||||
FP_SHAPE::Flip( aCentre, aFlipLeftRight );
|
||||
|
||||
// flipping the footprint is relative to the X axis
|
||||
if( aFlipLeftRight )
|
||||
{
|
||||
SetTextX( MIRRORVAL( GetTextPos().x, aCentre.x ) );
|
||||
EDA_TEXT::SetTextAngle( -GetTextAngle() );
|
||||
}
|
||||
else
|
||||
{
|
||||
SetTextY( MIRRORVAL( GetTextPos().y, aCentre.y ) );
|
||||
EDA_TEXT::SetTextAngle( ANGLE_180 - GetTextAngle() );
|
||||
}
|
||||
|
||||
if( ( GetLayerSet() & LSET::SideSpecificMask() ).any() )
|
||||
SetMirrored( !IsMirrored() );
|
||||
|
||||
SetLocalCoord();
|
||||
}
|
||||
|
||||
|
||||
void FP_TEXTBOX::Mirror( const VECTOR2I& aCentre, bool aMirrorAroundXAxis )
|
||||
{
|
||||
// the position is mirrored, but not the text (or its justification)
|
||||
FP_SHAPE::Mirror( aCentre, aMirrorAroundXAxis );
|
||||
|
||||
BOX2I rect( m_start0, m_end0 - m_start0 );
|
||||
rect.Normalize();
|
||||
m_start0 = VECTOR2I( rect.GetLeft(), rect.GetTop() );
|
||||
m_end0 = VECTOR2I( rect.GetRight(), rect.GetBottom() );
|
||||
|
||||
SetDrawCoord();
|
||||
}
|
||||
|
||||
|
||||
void FP_TEXTBOX::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
|
||||
{
|
||||
// Don't use GetShownText() here; we want to show the user the variable references
|
||||
aList.emplace_back( _( "Text Box" ), UnescapeString( GetText() ) );
|
||||
|
||||
if( aFrame->GetName() == PCB_EDIT_FRAME_NAME && IsLocked() )
|
||||
aList.emplace_back( _( "Status" ), _( "Locked" ) );
|
||||
|
||||
aList.emplace_back( _( "Layer" ), GetLayerName() );
|
||||
aList.emplace_back( _( "Mirror" ), IsMirrored() ? _( "Yes" ) : _( "No" ) );
|
||||
aList.emplace_back( _( "Angle" ), wxString::Format( "%g", GetTextAngle().AsDegrees() ) );
|
||||
|
||||
aList.emplace_back( _( "Font" ), GetFont() ? GetFont()->GetName() : _( "Default" ) );
|
||||
aList.emplace_back( _( "Thickness" ), aFrame->MessageTextFromValue( GetTextThickness() ) );
|
||||
aList.emplace_back( _( "Text Width" ), aFrame->MessageTextFromValue( GetTextWidth() ) );
|
||||
aList.emplace_back( _( "Text Height" ), aFrame->MessageTextFromValue( GetTextHeight() ) );
|
||||
|
||||
wxString msg = aFrame->MessageTextFromValue( std::abs( GetEnd().x - GetStart().x ) );
|
||||
aList.emplace_back( _( "Box Width" ), msg );
|
||||
|
||||
msg = aFrame->MessageTextFromValue( std::abs( GetEnd().y - GetStart().y ) );
|
||||
aList.emplace_back( _( "Box Height" ), msg );
|
||||
|
||||
m_stroke.GetMsgPanelInfo( aFrame, aList );
|
||||
}
|
||||
|
||||
|
||||
wxString FP_TEXTBOX::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "Footprint Text Box of %s" ),
|
||||
static_cast<FOOTPRINT*>( GetParent() )->GetReference() );
|
||||
}
|
||||
|
||||
|
||||
BITMAPS FP_TEXTBOX::GetMenuImage() const
|
||||
{
|
||||
return BITMAPS::add_textbox;
|
||||
}
|
||||
|
||||
|
||||
EDA_ITEM* FP_TEXTBOX::Clone() const
|
||||
{
|
||||
return new FP_TEXTBOX( *this );
|
||||
}
|
||||
|
||||
|
||||
void FP_TEXTBOX::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
{
|
||||
if( IsVisible() )
|
||||
aLayers[0] = GetLayer();
|
||||
else
|
||||
aLayers[0] = LAYER_MOD_TEXT_INVISIBLE;
|
||||
|
||||
aCount = 1;
|
||||
}
|
||||
|
||||
|
||||
double FP_TEXTBOX::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||
{
|
||||
constexpr double HIDE = (double)std::numeric_limits<double>::max();
|
||||
|
||||
if( !aView )
|
||||
return 0.0;
|
||||
|
||||
// Hidden text gets put on the LAYER_MOD_TEXT_INVISIBLE for rendering, but
|
||||
// should only render if its native layer is visible.
|
||||
if( !aView->IsLayerVisible( GetLayer() ) )
|
||||
return HIDE;
|
||||
|
||||
RENDER_SETTINGS* renderSettings = aView->GetPainter()->GetSettings();
|
||||
COLOR4D backgroundColor = renderSettings->GetLayerColor( LAYER_PCB_BACKGROUND );
|
||||
|
||||
// Handle Render tab switches
|
||||
if( renderSettings->GetLayerColor( LAYER_MOD_TEXT ) == backgroundColor )
|
||||
return HIDE;
|
||||
|
||||
if( !IsParentFlipped() && !aView->IsLayerVisible( LAYER_MOD_FR ) )
|
||||
return HIDE;
|
||||
|
||||
if( IsParentFlipped() && !aView->IsLayerVisible( LAYER_MOD_BK ) )
|
||||
return HIDE;
|
||||
|
||||
if( !aView->IsLayerVisible( LAYER_MOD_TEXT ) )
|
||||
return HIDE;
|
||||
|
||||
// Other layers are shown without any conditions
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
wxString FP_TEXTBOX::GetShownText( int aDepth, bool aAllowExtraText ) const
|
||||
{
|
||||
const FOOTPRINT* parentFootprint = static_cast<FOOTPRINT*>( GetParent() );
|
||||
|
||||
std::function<bool( wxString* )> footprintResolver =
|
||||
[&]( wxString* token ) -> bool
|
||||
{
|
||||
return parentFootprint && parentFootprint->ResolveTextVar( token, aDepth );
|
||||
};
|
||||
|
||||
wxString text = EDA_TEXT::GetShownText();
|
||||
|
||||
if( HasTextVars() )
|
||||
{
|
||||
if( aDepth < 10 )
|
||||
text = ExpandTextVars( text, &footprintResolver );
|
||||
}
|
||||
|
||||
KIFONT::FONT* font = getDrawFont();
|
||||
std::vector<VECTOR2I> corners = GetNormalizedCorners();
|
||||
int colWidth = ( corners[1] - corners[0] ).EuclideanNorm();
|
||||
|
||||
colWidth -= GetTextMargin() * 2;
|
||||
font->LinebreakText( text, colWidth, GetTextSize(), GetTextThickness(), IsBold(), IsItalic() );
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
std::shared_ptr<SHAPE> FP_TEXTBOX::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aFlash ) const
|
||||
{
|
||||
std::shared_ptr<SHAPE_COMPOUND> shape = GetEffectiveTextShape();
|
||||
|
||||
if( PCB_SHAPE::GetStroke().GetWidth() >= 0 )
|
||||
shape->AddShape( PCB_SHAPE::GetEffectiveShape( aLayer, aFlash ) );
|
||||
|
||||
return shape;
|
||||
}
|
||||
|
||||
|
||||
void FP_TEXTBOX::TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
|
||||
int aClearance, int aError, ERROR_LOC aErrorLoc ) const
|
||||
{
|
||||
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
|
||||
KIFONT::FONT* font = getDrawFont();
|
||||
int penWidth = GetEffectiveTextPenWidth();
|
||||
|
||||
// Note: this function is mainly used in 3D viewer.
|
||||
// the polygonal shape of a text can have many basic shapes,
|
||||
// so combining these shapes can be very useful to create a final shape
|
||||
// swith a lot less vertices to speedup calculations using this final shape
|
||||
// Simplify shapes is not usually always efficient, but in this case it is.
|
||||
SHAPE_POLY_SET buffer;
|
||||
|
||||
CALLBACK_GAL callback_gal( empty_opts,
|
||||
// Stroke callback
|
||||
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
|
||||
{
|
||||
TransformOvalToPolygon( buffer, aPt1, aPt2, penWidth + ( 2 * aClearance ), aError,
|
||||
ERROR_INSIDE );
|
||||
},
|
||||
// Triangulation callback
|
||||
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2, const VECTOR2I& aPt3 )
|
||||
{
|
||||
buffer.NewOutline();
|
||||
|
||||
for( const VECTOR2I& point : { aPt1, aPt2, aPt3 } )
|
||||
buffer.Append( point.x, point.y );
|
||||
} );
|
||||
|
||||
TEXT_ATTRIBUTES attrs = GetAttributes();
|
||||
attrs.m_Angle = GetDrawRotation();
|
||||
|
||||
font->Draw( &callback_gal, GetShownText(), GetDrawPos(), attrs );
|
||||
|
||||
buffer.Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||
aBuffer.Append( buffer );
|
||||
}
|
||||
|
||||
|
||||
void FP_TEXTBOX::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer,
|
||||
int aClearance, int aError, ERROR_LOC aErrorLoc,
|
||||
bool aIgnoreLineWidth ) const
|
||||
{
|
||||
// Don't use FP_SHAPE::TransformShapeToPolygon. We want to treat the textbox as filled even
|
||||
// if there's no background colour.
|
||||
|
||||
int width = GetWidth() + ( 2 * aClearance );
|
||||
|
||||
switch( m_shape )
|
||||
{
|
||||
case SHAPE_T::RECT:
|
||||
{
|
||||
std::vector<VECTOR2I> pts = GetRectCorners();
|
||||
|
||||
aBuffer.NewOutline();
|
||||
|
||||
for( const VECTOR2I& pt : pts )
|
||||
aBuffer.Append( pt );
|
||||
|
||||
if( width > 0 )
|
||||
{
|
||||
// Add in segments
|
||||
TransformOvalToPolygon( aBuffer, pts[0], pts[1], width, aError, aErrorLoc );
|
||||
TransformOvalToPolygon( aBuffer, pts[1], pts[2], width, aError, aErrorLoc );
|
||||
TransformOvalToPolygon( aBuffer, pts[2], pts[3], width, aError, aErrorLoc );
|
||||
TransformOvalToPolygon( aBuffer, pts[3], pts[0], width, aError, aErrorLoc );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SHAPE_T::POLY:
|
||||
{
|
||||
if( !IsPolyShapeValid() )
|
||||
break;
|
||||
|
||||
// The polygon is expected to be a simple polygon; not self intersecting, no hole.
|
||||
EDA_ANGLE orientation = getParentOrientation();
|
||||
VECTOR2I offset = getParentPosition();
|
||||
|
||||
// Build the polygon with the actual position and orientation:
|
||||
std::vector<VECTOR2I> poly;
|
||||
DupPolyPointsList( poly );
|
||||
|
||||
for( VECTOR2I& point : poly )
|
||||
{
|
||||
RotatePoint( point, orientation );
|
||||
point += offset;
|
||||
}
|
||||
|
||||
aBuffer.NewOutline();
|
||||
|
||||
for( const VECTOR2I& point : poly )
|
||||
aBuffer.Append( point.x, point.y );
|
||||
|
||||
if( width > 0 )
|
||||
{
|
||||
VECTOR2I pt1( poly[poly.size() - 1] );
|
||||
|
||||
for( const VECTOR2I& pt2 : poly )
|
||||
{
|
||||
if( pt2 != pt1 )
|
||||
TransformOvalToPolygon( aBuffer, pt1, pt2, width, aError, aErrorLoc );
|
||||
|
||||
pt1 = pt2;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
UNIMPLEMENTED_FOR( SHAPE_T_asString() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
wxString FP_TEXTBOX::GetParentAsString() const
|
||||
{
|
||||
if( FOOTPRINT* fp = dynamic_cast<FOOTPRINT*>( m_parent ) )
|
||||
return fp->GetReference();
|
||||
|
||||
return m_parent->m_Uuid.AsString();
|
||||
}
|
||||
|
||||
|
||||
static struct FP_TEXTBOX_DESC
|
||||
{
|
||||
FP_TEXTBOX_DESC()
|
||||
{
|
||||
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
|
||||
REGISTER_TYPE( FP_TEXTBOX );
|
||||
propMgr.AddTypeCast( new TYPE_CAST<FP_TEXTBOX, FP_SHAPE> );
|
||||
propMgr.AddTypeCast( new TYPE_CAST<FP_TEXTBOX, EDA_TEXT> );
|
||||
propMgr.InheritsAfter( TYPE_HASH( FP_TEXTBOX ), TYPE_HASH( FP_SHAPE ) );
|
||||
propMgr.InheritsAfter( TYPE_HASH( FP_TEXTBOX ), TYPE_HASH( EDA_TEXT ) );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<FP_TEXTBOX, wxString>( _HKI( "Parent" ),
|
||||
NO_SETTER( FP_TEXTBOX, wxString ), &FP_TEXTBOX::GetParentAsString ) )
|
||||
.SetIsHiddenFromLibraryEditors();
|
||||
|
||||
propMgr.Mask( TYPE_HASH( FP_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "Shape" ) );
|
||||
propMgr.Mask( TYPE_HASH( FP_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "Start X" ) );
|
||||
propMgr.Mask( TYPE_HASH( FP_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "Start Y" ) );
|
||||
propMgr.Mask( TYPE_HASH( FP_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "End X" ) );
|
||||
propMgr.Mask( TYPE_HASH( FP_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "End Y" ) );
|
||||
propMgr.Mask( TYPE_HASH( FP_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "Line Width" ) );
|
||||
}
|
||||
} _FP_TEXTBOX_DESC;
|
|
@ -1,145 +0,0 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef FP_TEXTBOX_H
|
||||
#define FP_TEXTBOX_H
|
||||
|
||||
#include <eda_text.h>
|
||||
#include <fp_shape.h>
|
||||
|
||||
class LINE_READER;
|
||||
class FOOTPRINT;
|
||||
class MSG_PANEL_ITEM;
|
||||
class PCB_BASE_FRAME;
|
||||
class SHAPE;
|
||||
|
||||
|
||||
class FP_TEXTBOX : public FP_SHAPE, public EDA_TEXT
|
||||
{
|
||||
public:
|
||||
FP_TEXTBOX( FOOTPRINT* aParentFootprint );
|
||||
|
||||
// Do not create a copy constructor & operator=.
|
||||
// The ones generated by the compiler are adequate.
|
||||
|
||||
~FP_TEXTBOX();
|
||||
|
||||
static inline bool ClassOf( const EDA_ITEM* aItem )
|
||||
{
|
||||
return aItem && aItem->Type() == PCB_FP_TEXT_T;
|
||||
}
|
||||
|
||||
bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
|
||||
{
|
||||
if( BOARD_ITEM::IsType( aScanTypes ) )
|
||||
return true;
|
||||
|
||||
for( KICAD_T scanType : aScanTypes )
|
||||
{
|
||||
if( scanType == PCB_LOCATE_TEXT_T )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
VECTOR2I GetTopLeft() const override;
|
||||
VECTOR2I GetBotRight() const override;
|
||||
|
||||
void SetTop( int aVal ) override;
|
||||
void SetLeft( int aVal ) override;
|
||||
void SetRight( int aVal ) override;
|
||||
void SetBottom( int aVal ) override;
|
||||
|
||||
void SetTextAngle( const EDA_ANGLE& aAngle ) override;
|
||||
|
||||
wxString GetParentAsString() const;
|
||||
|
||||
bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override
|
||||
{
|
||||
return BOARD_ITEM::Matches( GetShownText(), aSearchData );
|
||||
}
|
||||
|
||||
int GetTextMargin() const;
|
||||
|
||||
virtual EDA_ANGLE GetDrawRotation() const override;
|
||||
|
||||
VECTOR2I GetDrawPos() const override;
|
||||
|
||||
std::vector<VECTOR2I> GetCorners() const override;
|
||||
std::vector<VECTOR2I> GetNormalizedCorners() const;
|
||||
|
||||
void Move( const VECTOR2I& aMoveVector ) override;
|
||||
|
||||
void Rotate( const VECTOR2I& aOffset, const EDA_ANGLE& aAngle ) override;
|
||||
|
||||
void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override;
|
||||
|
||||
/**
|
||||
* Mirror the textbox's position, but not the text (or its justification).
|
||||
*/
|
||||
void Mirror( const VECTOR2I& aCentre, bool aMirrorAroundXAxis ) override;
|
||||
|
||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy ) const override;
|
||||
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
|
||||
int aError, ERROR_LOC aErrorLoc,
|
||||
bool aIgnoreLineWidth = false ) const override;
|
||||
|
||||
void TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
|
||||
int aError, ERROR_LOC aErrorLoc ) const;
|
||||
|
||||
// @copydoc BOARD_ITEM::GetEffectiveShape
|
||||
std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
|
||||
FLASHING aFlash = FLASHING::DEFAULT ) const override;
|
||||
|
||||
wxString GetClass() const override
|
||||
{
|
||||
return wxT( "FP_TEXTBOX" );
|
||||
}
|
||||
|
||||
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
||||
virtual wxString GetShownText( int aDepth = 0, bool aAllowExtraText = true ) const override;
|
||||
|
||||
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
|
||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
|
||||
#if defined(DEBUG)
|
||||
virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
||||
#endif
|
||||
|
||||
private:
|
||||
VECTOR2I m_Pos0; ///< text coordinates relative to the footprint anchor, orient 0.
|
||||
///< text coordinate ref point is the text center
|
||||
};
|
||||
|
||||
#endif // FP_TEXTBOX_H
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2004-2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -28,7 +28,6 @@
|
|||
#include <board_commit.h>
|
||||
#include <cleanup_item.h>
|
||||
#include <pcb_shape.h>
|
||||
#include <fp_shape.h>
|
||||
#include <pad.h>
|
||||
#include <footprint.h>
|
||||
#include <graphics_cleaner.h>
|
||||
|
@ -320,13 +319,7 @@ void GRAPHICS_CLEANER::mergeRects()
|
|||
|
||||
if( !m_dryRun )
|
||||
{
|
||||
PCB_SHAPE* rect;
|
||||
FP_SHAPE* fp_rect = nullptr;
|
||||
|
||||
if( m_parentFootprint )
|
||||
rect = fp_rect = new FP_SHAPE( m_parentFootprint );
|
||||
else
|
||||
rect = new PCB_SHAPE();
|
||||
PCB_SHAPE* rect = new PCB_SHAPE( m_parentFootprint );
|
||||
|
||||
rect->SetShape( SHAPE_T::RECT );
|
||||
rect->SetFilled( false );
|
||||
|
@ -335,9 +328,6 @@ void GRAPHICS_CLEANER::mergeRects()
|
|||
rect->SetLayer( top->shape->GetLayer() );
|
||||
rect->SetStroke( top->shape->GetStroke() );
|
||||
|
||||
if( fp_rect )
|
||||
fp_rect->SetLocalCoord();
|
||||
|
||||
m_commit.Add( rect );
|
||||
m_commit.Remove( left->shape );
|
||||
m_commit.Remove( top->shape );
|
||||
|
@ -366,13 +356,13 @@ void GRAPHICS_CLEANER::mergePads()
|
|||
if( padToNetTieGroupMap[ pad->GetNumber() ] >= 0 )
|
||||
continue;
|
||||
|
||||
std::vector<FP_SHAPE*> shapes = padTool->RecombinePad( pad, m_dryRun, m_commit );
|
||||
std::vector<PCB_SHAPE*> shapes = padTool->RecombinePad( pad, m_dryRun, m_commit );
|
||||
|
||||
if( !shapes.empty() )
|
||||
{
|
||||
std::shared_ptr<CLEANUP_ITEM> item = std::make_shared<CLEANUP_ITEM>( CLEANUP_MERGE_PAD );
|
||||
|
||||
for( FP_SHAPE* shape : shapes )
|
||||
for( PCB_SHAPE* shape : shapes )
|
||||
item->AddItem( shape );
|
||||
|
||||
item->AddItem( pad );
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2016 CERN
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
* Copyright (C) 2018-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2018-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -26,9 +26,9 @@
|
|||
#include "graphics_importer_pcbnew.h"
|
||||
|
||||
#include <board.h>
|
||||
#include <fp_shape.h>
|
||||
#include <footprint.h>
|
||||
#include <pcb_shape.h>
|
||||
#include <pcb_text.h>
|
||||
#include <fp_text.h>
|
||||
#include <memory>
|
||||
#include <tuple>
|
||||
|
||||
|
@ -71,10 +71,6 @@ void GRAPHICS_IMPORTER_PCBNEW::AddLine( const VECTOR2D& aOrigin, const VECTOR2D&
|
|||
if( line->GetStart() == line->GetEnd() )
|
||||
return;
|
||||
|
||||
|
||||
if( line->Type() == PCB_FP_SHAPE_T )
|
||||
static_cast<FP_SHAPE*>( line.get() )->SetLocalCoord();
|
||||
|
||||
addItem( std::move( line ) );
|
||||
}
|
||||
|
||||
|
@ -90,9 +86,6 @@ void GRAPHICS_IMPORTER_PCBNEW::AddCircle( const VECTOR2D& aCenter, double aRadiu
|
|||
circle->SetStart( MapCoordinate( aCenter ));
|
||||
circle->SetEnd( MapCoordinate( VECTOR2D( aCenter.x + aRadius, aCenter.y ) ) );
|
||||
|
||||
if( circle->Type() == PCB_FP_SHAPE_T )
|
||||
static_cast<FP_SHAPE*>( circle.get() )->SetLocalCoord();
|
||||
|
||||
addItem( std::move( circle ) );
|
||||
}
|
||||
|
||||
|
@ -118,14 +111,11 @@ void GRAPHICS_IMPORTER_PCBNEW::AddArc( const VECTOR2D& aCenter, const VECTOR2D&
|
|||
|
||||
arc->SetStroke( STROKE_PARAMS( MapLineWidth( aWidth ), PLOT_DASH_TYPE::SOLID ) );
|
||||
|
||||
if( arc->Type() == PCB_FP_SHAPE_T )
|
||||
static_cast<FP_SHAPE*>( arc.get() )->SetLocalCoord();
|
||||
|
||||
addItem( std::move( arc ) );
|
||||
}
|
||||
|
||||
|
||||
void GRAPHICS_IMPORTER_PCBNEW::AddPolygon( const std::vector< VECTOR2D >& aVertices, double aWidth )
|
||||
void GRAPHICS_IMPORTER_PCBNEW::AddPolygon( const std::vector<VECTOR2D>& aVertices, double aWidth )
|
||||
{
|
||||
std::vector<VECTOR2I> convertedPoints;
|
||||
convertedPoints.reserve( aVertices.size() );
|
||||
|
@ -139,8 +129,11 @@ void GRAPHICS_IMPORTER_PCBNEW::AddPolygon( const std::vector< VECTOR2D >& aVerti
|
|||
polygon->SetLayer( GetLayer() );
|
||||
polygon->SetPolyPoints( convertedPoints );
|
||||
|
||||
if( polygon->Type() == PCB_FP_SHAPE_T )
|
||||
static_cast<FP_SHAPE*>( polygon.get() )->SetLocalCoord();
|
||||
if( FOOTPRINT* parentFP = polygon->GetParentFootprint() )
|
||||
{
|
||||
polygon->Rotate( { 0, 0 }, parentFP->GetOrientation() );
|
||||
polygon->Move( parentFP->GetPosition() );
|
||||
}
|
||||
|
||||
polygon->SetStroke( STROKE_PARAMS( MapLineWidth( aWidth ), PLOT_DASH_TYPE::SOLID ) );
|
||||
addItem( std::move( polygon ) );
|
||||
|
@ -152,23 +145,18 @@ void GRAPHICS_IMPORTER_PCBNEW::AddText( const VECTOR2D& aOrigin, const wxString&
|
|||
double aOrientation, GR_TEXT_H_ALIGN_T aHJustify,
|
||||
GR_TEXT_V_ALIGN_T aVJustify )
|
||||
{
|
||||
std::unique_ptr<BOARD_ITEM> boardItem;
|
||||
EDA_TEXT* textItem;
|
||||
tie( boardItem, textItem ) = createText();
|
||||
boardItem->SetLayer( GetLayer() );
|
||||
std::unique_ptr<PCB_TEXT> textItem = createText();
|
||||
textItem->SetLayer( GetLayer() );
|
||||
textItem->SetTextThickness( MapLineWidth( aThickness ) );
|
||||
textItem->SetTextPos( MapCoordinate( aOrigin ) );
|
||||
textItem->SetTextAngle( EDA_ANGLE( aOrientation, DEGREES_T ) ); // Pcbnew uses the decidegree
|
||||
textItem->SetTextAngle( EDA_ANGLE( aOrientation, DEGREES_T ) );
|
||||
textItem->SetTextWidth( aWidth * ImportScalingFactor() );
|
||||
textItem->SetTextHeight( aHeight * ImportScalingFactor() );
|
||||
textItem->SetVertJustify( aVJustify );
|
||||
textItem->SetHorizJustify( aHJustify );
|
||||
textItem->SetText( aText );
|
||||
|
||||
if( boardItem->Type() == PCB_FP_TEXT_T )
|
||||
static_cast<FP_TEXT*>( boardItem.get() )->SetLocalCoord();
|
||||
|
||||
addItem( std::move( boardItem ) );
|
||||
addItem( std::move( textItem ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -199,10 +187,6 @@ void GRAPHICS_IMPORTER_PCBNEW::AddSpline( const VECTOR2D& aStart, const VECTOR2D
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
if( spline->Type() == PCB_FP_SHAPE_T )
|
||||
static_cast<FP_SHAPE*>( spline.get() )->SetLocalCoord();
|
||||
|
||||
addItem( std::move( spline ) );
|
||||
}
|
||||
|
||||
|
@ -213,21 +197,19 @@ std::unique_ptr<PCB_SHAPE> GRAPHICS_IMPORTER_BOARD::createDrawing()
|
|||
}
|
||||
|
||||
|
||||
std::pair<std::unique_ptr<BOARD_ITEM>, EDA_TEXT*> GRAPHICS_IMPORTER_BOARD::createText()
|
||||
std::unique_ptr<PCB_TEXT> GRAPHICS_IMPORTER_BOARD::createText()
|
||||
{
|
||||
PCB_TEXT* text = new PCB_TEXT( m_board );
|
||||
return make_pair( std::unique_ptr<BOARD_ITEM>( text ), static_cast<EDA_TEXT*>( text ) );
|
||||
return std::make_unique<PCB_TEXT>( m_board );
|
||||
}
|
||||
|
||||
|
||||
std::unique_ptr<PCB_SHAPE> GRAPHICS_IMPORTER_FOOTPRINT::createDrawing()
|
||||
{
|
||||
return std::make_unique<FP_SHAPE>( m_footprint );
|
||||
return std::make_unique<PCB_SHAPE>( m_footprint );
|
||||
}
|
||||
|
||||
|
||||
std::pair<std::unique_ptr<BOARD_ITEM>, EDA_TEXT*> GRAPHICS_IMPORTER_FOOTPRINT::createText()
|
||||
std::unique_ptr<PCB_TEXT> GRAPHICS_IMPORTER_FOOTPRINT::createText()
|
||||
{
|
||||
FP_TEXT* text = new FP_TEXT( m_footprint );
|
||||
return make_pair( std::unique_ptr<BOARD_ITEM>( text ), static_cast<EDA_TEXT*>( text ) );
|
||||
return std::make_unique<PCB_TEXT>( m_footprint, PCB_TEXT::TEXT_is_DIVERS );
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2016 CERN
|
||||
* Copyright (C) 2018-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2018-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
|
@ -31,11 +31,10 @@
|
|||
|
||||
#include <layer_ids.h>
|
||||
|
||||
class BOARD_ITEM;
|
||||
class BOARD;
|
||||
class FOOTPRINT;
|
||||
class PCB_SHAPE;
|
||||
class EDA_TEXT;
|
||||
class PCB_TEXT;
|
||||
|
||||
class GRAPHICS_IMPORTER_PCBNEW : public GRAPHICS_IMPORTER
|
||||
{
|
||||
|
@ -97,9 +96,8 @@ protected:
|
|||
///< Create an object representing a graphical shape.
|
||||
virtual std::unique_ptr<PCB_SHAPE> createDrawing() = 0;
|
||||
|
||||
///< Create an object representing a text. Both pointers point to different parts of the
|
||||
///< same object, the EDA_TEXT pointer is simply for convenience.
|
||||
virtual std::pair<std::unique_ptr<BOARD_ITEM>, EDA_TEXT*> createText() = 0;
|
||||
///< Create an object representing a text.
|
||||
virtual std::unique_ptr<PCB_TEXT> createText() = 0;
|
||||
|
||||
///< Target layer for the imported shapes.
|
||||
PCB_LAYER_ID m_layer;
|
||||
|
@ -116,7 +114,7 @@ public:
|
|||
|
||||
protected:
|
||||
std::unique_ptr<PCB_SHAPE> createDrawing() override;
|
||||
std::pair<std::unique_ptr<BOARD_ITEM>, EDA_TEXT*> createText() override;
|
||||
std::unique_ptr<PCB_TEXT> createText() override;
|
||||
|
||||
BOARD* m_board;
|
||||
};
|
||||
|
@ -132,7 +130,7 @@ public:
|
|||
|
||||
protected:
|
||||
std::unique_ptr<PCB_SHAPE> createDrawing() override;
|
||||
std::pair<std::unique_ptr<BOARD_ITEM>, EDA_TEXT*> createText() override;
|
||||
std::unique_ptr<PCB_TEXT> createText() override;
|
||||
|
||||
FOOTPRINT* m_footprint;
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017 KiCad Developers, see AUTHORS.TXT for contributors.
|
||||
* Copyright (C) 2017-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2017-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* @author Kristoffer Ödmark
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -33,8 +33,6 @@
|
|||
#include <pcb_shape.h>
|
||||
#include <pcb_text.h>
|
||||
#include <pcb_textbox.h>
|
||||
#include <fp_text.h>
|
||||
#include <fp_textbox.h>
|
||||
#include <zone.h>
|
||||
#include <locale_io.h>
|
||||
#include <netinfo.h>
|
||||
|
@ -113,9 +111,9 @@ void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootpri
|
|||
const PCB_GROUP* group = dynamic_cast<const PCB_GROUP*>( item );
|
||||
BOARD_ITEM* clone;
|
||||
|
||||
if( const FP_TEXT* text = dyn_cast<const FP_TEXT*>( item ) )
|
||||
if( const PCB_TEXT* text = dyn_cast<const PCB_TEXT*>( item ) )
|
||||
{
|
||||
if( text->GetType() != FP_TEXT::TEXT_is_DIVERS )
|
||||
if( text->GetType() != PCB_TEXT::TEXT_is_DIVERS )
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -133,7 +131,7 @@ void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootpri
|
|||
partialFootprint.Add( clone );
|
||||
|
||||
// A list of not added items, when adding items to the footprint
|
||||
// some FP_TEXT (reference and value) cannot be added to the footprint
|
||||
// some PCB_TEXT (reference and value) cannot be added to the footprint
|
||||
std::vector<BOARD_ITEM*> skipped_items;
|
||||
|
||||
if( group )
|
||||
|
@ -142,12 +140,12 @@ void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootpri
|
|||
[&]( BOARD_ITEM* descendant )
|
||||
{
|
||||
// One cannot add a text reference or value to a given footprint:
|
||||
// only one is allowed. So add only FP_TEXT::TEXT_is_DIVERS
|
||||
// only one is allowed. So add only PCB_TEXT::TEXT_is_DIVERS
|
||||
bool can_add = true;
|
||||
|
||||
if( const FP_TEXT* text = dyn_cast<const FP_TEXT*>( descendant ) )
|
||||
if( const PCB_TEXT* text = dyn_cast<const PCB_TEXT*>( descendant ) )
|
||||
{
|
||||
if( text->GetType() != FP_TEXT::TEXT_is_DIVERS )
|
||||
if( text->GetType() != PCB_TEXT::TEXT_is_DIVERS )
|
||||
can_add = false;
|
||||
}
|
||||
|
||||
|
@ -197,41 +195,16 @@ void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootpri
|
|||
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( i );
|
||||
BOARD_ITEM* copy = nullptr;
|
||||
|
||||
if( item->Type() == PCB_FP_SHAPE_T )
|
||||
if( item->Type() == PCB_TEXT_T )
|
||||
{
|
||||
// Convert to PCB_SHAPE_T
|
||||
copy = (BOARD_ITEM*) reinterpret_cast<PCB_SHAPE*>( item )->Clone();
|
||||
copy->SetLayer( item->GetLayer() );
|
||||
}
|
||||
else if( item->Type() == PCB_FP_TEXT_T )
|
||||
{
|
||||
// Convert to PCB_TEXT_T
|
||||
FOOTPRINT* footprint = static_cast<FOOTPRINT*>( item->GetParent() );
|
||||
FP_TEXT* fp_text = static_cast<FP_TEXT*>( item );
|
||||
PCB_TEXT* pcb_text = new PCB_TEXT( m_board );
|
||||
copy = static_cast<BOARD_ITEM*>( item->Clone() );
|
||||
|
||||
if( fp_text->GetText() == wxT( "${VALUE}" ) )
|
||||
pcb_text->SetText( footprint->GetValue() );
|
||||
else if( fp_text->GetText() == wxT( "${REFERENCE}" ) )
|
||||
pcb_text->SetText( footprint->GetReference() );
|
||||
else
|
||||
pcb_text->CopyText( *fp_text );
|
||||
PCB_TEXT* textItem = static_cast<PCB_TEXT*>( copy );
|
||||
|
||||
pcb_text->SetAttributes( *fp_text );
|
||||
pcb_text->SetLayer( fp_text->GetLayer() );
|
||||
copy = pcb_text;
|
||||
}
|
||||
else if( item->Type() == PCB_FP_TEXTBOX_T )
|
||||
{
|
||||
// Convert to PCB_TEXTBOX_T
|
||||
FP_TEXTBOX* fp_textbox = static_cast<FP_TEXTBOX*>( item );
|
||||
PCB_TEXTBOX* pcb_textbox = new PCB_TEXTBOX( m_board );
|
||||
|
||||
pcb_textbox->CopyText( *fp_textbox );
|
||||
|
||||
pcb_textbox->SetAttributes( *fp_textbox );
|
||||
pcb_textbox->SetLayer( fp_textbox->GetLayer() );
|
||||
copy = pcb_textbox;
|
||||
if( textItem->GetText() == wxT( "${VALUE}" ) )
|
||||
textItem->SetText( item->GetParentFootprint()->GetValue() );
|
||||
else if( textItem->GetText() == wxT( "${REFERENCE}" ) )
|
||||
textItem->SetText( item->GetParentFootprint()->GetReference() );
|
||||
}
|
||||
else if( item->Type() == PCB_PAD_T )
|
||||
{
|
||||
|
@ -244,13 +217,6 @@ void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootpri
|
|||
footprint->Add( pad );
|
||||
copy = footprint;
|
||||
}
|
||||
else if( item->Type() == PCB_FP_ZONE_T )
|
||||
{
|
||||
// Convert to PCB_ZONE_T
|
||||
ZONE* zone = new ZONE( m_board );
|
||||
zone->InitDataFromSrcInCopyCtor( *static_cast<ZONE*>( item ) );
|
||||
copy = zone;
|
||||
}
|
||||
else if( item->Type() == PCB_GROUP_T )
|
||||
{
|
||||
copy = static_cast<PCB_GROUP*>( item )->DeepClone();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2017-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -25,7 +25,7 @@
|
|||
#include <board_commit.h>
|
||||
#include <board_design_settings.h>
|
||||
#include <pad.h>
|
||||
#include <fp_shape.h>
|
||||
#include <pcb_shape.h>
|
||||
#include <footprint.h>
|
||||
#include <confirm.h>
|
||||
#include <dialogs/dialog_text_entry.h>
|
||||
|
@ -417,13 +417,11 @@ FOOTPRINT* MICROWAVE_TOOL::createMicrowaveInductor( MICROWAVE_INDUCTOR_PATTERN&
|
|||
// Generate segments
|
||||
for( unsigned jj = 1; jj < buffer.size(); jj++ )
|
||||
{
|
||||
FP_SHAPE* seg = new FP_SHAPE( footprint, SHAPE_T::SEGMENT );
|
||||
PCB_SHAPE* seg = new PCB_SHAPE( footprint, SHAPE_T::SEGMENT );
|
||||
seg->SetStart( buffer[jj - 1] );
|
||||
seg->SetEnd( buffer[jj] );
|
||||
seg->SetStroke( STROKE_PARAMS( aInductorPattern.m_Width, PLOT_DASH_TYPE::SOLID ) );
|
||||
seg->SetLayer( footprint->GetLayer() );
|
||||
seg->SetStart0( seg->GetStart() - footprint->GetPosition() );
|
||||
seg->SetEnd0( seg->GetEnd() - footprint->GetPosition() );
|
||||
footprint->Add( seg );
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include <dialogs/dialog_text_entry.h>
|
||||
#include <board.h>
|
||||
#include <footprint.h>
|
||||
#include <fp_shape.h>
|
||||
#include <pcb_shape.h>
|
||||
#include <microwave/microwave_tool.h>
|
||||
#include <pad.h>
|
||||
#include <pcbnew.h>
|
||||
|
@ -289,7 +289,7 @@ FOOTPRINT* MICROWAVE_TOOL::createPolygonShape()
|
|||
FOOTPRINT* footprint;
|
||||
wxString cmp_name;
|
||||
int pad_count = 2;
|
||||
FP_SHAPE* shape;
|
||||
PCB_SHAPE* shape;
|
||||
|
||||
PCB_EDIT_FRAME& editFrame = *getEditFrame<PCB_EDIT_FRAME>();
|
||||
|
||||
|
@ -341,7 +341,7 @@ FOOTPRINT* MICROWAVE_TOOL::createPolygonShape()
|
|||
pad2->SetX( pad2->GetPos0().x );
|
||||
|
||||
// Add a polygonal edge (corners will be added later) on copper layer
|
||||
shape = new FP_SHAPE( footprint, SHAPE_T::POLY );
|
||||
shape = new PCB_SHAPE( footprint, SHAPE_T::POLY );
|
||||
shape->SetFilled( true );
|
||||
shape->SetLayer( F_Cu );
|
||||
|
||||
|
@ -386,6 +386,8 @@ FOOTPRINT* MICROWAVE_TOOL::createPolygonShape()
|
|||
}
|
||||
|
||||
shape->SetPolyPoints( polyPoints );
|
||||
shape->Rotate( { 0, 0 }, footprint->GetOrientation() );
|
||||
shape->Move( footprint->GetPosition() );
|
||||
|
||||
// Set the polygon outline thickness to 0, only the polygonal shape is filled
|
||||
// without extra thickness.
|
||||
|
|
|
@ -164,7 +164,7 @@ bool PAD::IsLocked() const
|
|||
|
||||
bool PAD::SharesNetTieGroup( const PAD* aOther ) const
|
||||
{
|
||||
FOOTPRINT* parentFp = static_cast<FOOTPRINT*>( GetParentFootprint() );
|
||||
FOOTPRINT* parentFp = GetParentFootprint();
|
||||
|
||||
if( parentFp && parentFp->IsNetTie() && aOther->GetParentFootprint() == parentFp )
|
||||
{
|
||||
|
|
|
@ -49,7 +49,6 @@ enum CUST_PAD_SHAPE_IN_ZONE
|
|||
class LINE_READER;
|
||||
class EDA_3D_CANVAS;
|
||||
class FOOTPRINT;
|
||||
class FP_SHAPE;
|
||||
|
||||
namespace KIGFX
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014 CERN
|
||||
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
|
@ -33,6 +33,9 @@ class APPEARANCE_CONTROLS;
|
|||
class BOARD_ITEM_CONTAINER;
|
||||
class PANEL_SELECTION_FILTER;
|
||||
class PROPERTIES_PANEL;
|
||||
class PCB_TEXTBOX;
|
||||
class PCB_TEXT;
|
||||
class PCB_SHAPE;
|
||||
|
||||
/**
|
||||
* Common, abstract interface for edit frames.
|
||||
|
@ -174,9 +177,9 @@ public:
|
|||
//void SetRotationAngle( EDA_ANGLE aRotationAngle );
|
||||
|
||||
void ShowBitmapPropertiesDialog( BOARD_ITEM* aBitmap );
|
||||
void ShowTextPropertiesDialog( BOARD_ITEM* aText );
|
||||
int ShowTextBoxPropertiesDialog( BOARD_ITEM* aText );
|
||||
void ShowGraphicItemPropertiesDialog( BOARD_ITEM* aItem );
|
||||
void ShowTextPropertiesDialog( PCB_TEXT* aText );
|
||||
int ShowTextBoxPropertiesDialog( PCB_TEXTBOX* aTextBox );
|
||||
void ShowGraphicItemPropertiesDialog( PCB_SHAPE* aShape );
|
||||
|
||||
///< @copydoc EDA_DRAW_FRAME::UseGalCanvas()
|
||||
void ActivateGalCanvas() override;
|
||||
|
|
|
@ -447,10 +447,6 @@ void PCB_BASE_FRAME::FocusOnItems( std::vector<BOARD_ITEM*> aItems, PCB_LAYER_ID
|
|||
case PCB_SHAPE_T:
|
||||
case PCB_TEXT_T:
|
||||
case PCB_TEXTBOX_T:
|
||||
case PCB_FP_TEXT_T:
|
||||
case PCB_FP_TEXTBOX_T:
|
||||
case PCB_FP_SHAPE_T:
|
||||
case PCB_FP_ZONE_T:
|
||||
case PCB_TRACE_T:
|
||||
case PCB_ARC_T:
|
||||
case PCB_DIM_ALIGNED_T:
|
||||
|
@ -458,11 +454,6 @@ void PCB_BASE_FRAME::FocusOnItems( std::vector<BOARD_ITEM*> aItems, PCB_LAYER_ID
|
|||
case PCB_DIM_CENTER_T:
|
||||
case PCB_DIM_RADIAL_T:
|
||||
case PCB_DIM_ORTHOGONAL_T:
|
||||
case PCB_FP_DIM_ALIGNED_T:
|
||||
case PCB_FP_DIM_LEADER_T:
|
||||
case PCB_FP_DIM_CENTER_T:
|
||||
case PCB_FP_DIM_RADIAL_T:
|
||||
case PCB_FP_DIM_ORTHOGONAL_T:
|
||||
item->TransformShapeToPolygon( itemPoly, aLayer, 0, pcbIUScale.mmToIU( 0.1 ),
|
||||
ERROR_INSIDE );
|
||||
break;
|
||||
|
|
|
@ -335,7 +335,7 @@ void PCB_DIMENSION_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame,
|
|||
|
||||
ORIGIN_TRANSFORMS originTransforms = aFrame->GetOriginTransforms();
|
||||
|
||||
if( Type() == PCB_DIM_CENTER_T || Type() == PCB_FP_DIM_CENTER_T )
|
||||
if( Type() == PCB_DIM_CENTER_T )
|
||||
{
|
||||
VECTOR2I startCoord = originTransforms.ToDisplayAbs( GetStart() );
|
||||
wxString start = wxString::Format( wxT( "@(%s, %s)" ),
|
||||
|
@ -735,8 +735,8 @@ void PCB_DIM_ALIGNED::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_P
|
|||
}
|
||||
|
||||
|
||||
PCB_DIM_ORTHOGONAL::PCB_DIM_ORTHOGONAL( BOARD_ITEM* aParent, bool aInFP ) :
|
||||
PCB_DIM_ALIGNED( aParent, aInFP ? PCB_FP_DIM_ORTHOGONAL_T : PCB_DIM_ORTHOGONAL_T )
|
||||
PCB_DIM_ORTHOGONAL::PCB_DIM_ORTHOGONAL( BOARD_ITEM* aParent ) :
|
||||
PCB_DIM_ALIGNED( aParent, PCB_DIM_ORTHOGONAL_T )
|
||||
{
|
||||
// To preserve look of old dimensions, initialize extension height based on default arrow length
|
||||
m_extensionHeight = static_cast<int>( m_arrowLength * s_arrowAngle.Sin() );
|
||||
|
@ -948,8 +948,8 @@ void PCB_DIM_ORTHOGONAL::Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aA
|
|||
}
|
||||
|
||||
|
||||
PCB_DIM_LEADER::PCB_DIM_LEADER( BOARD_ITEM* aParent, bool aInFP ) :
|
||||
PCB_DIMENSION_BASE( aParent, aInFP ? PCB_FP_DIM_LEADER_T : PCB_DIM_LEADER_T ),
|
||||
PCB_DIM_LEADER::PCB_DIM_LEADER( BOARD_ITEM* aParent ) :
|
||||
PCB_DIMENSION_BASE( aParent, PCB_DIM_LEADER_T ),
|
||||
m_textBorder( DIM_TEXT_BORDER::NONE )
|
||||
{
|
||||
m_unitsFormat = DIM_UNITS_FORMAT::NO_SUFFIX;
|
||||
|
@ -1097,8 +1097,8 @@ void PCB_DIM_LEADER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
|
|||
}
|
||||
|
||||
|
||||
PCB_DIM_RADIAL::PCB_DIM_RADIAL( BOARD_ITEM* aParent, bool aInFP ) :
|
||||
PCB_DIMENSION_BASE( aParent, aInFP ? PCB_FP_DIM_RADIAL_T : PCB_DIM_RADIAL_T )
|
||||
PCB_DIM_RADIAL::PCB_DIM_RADIAL( BOARD_ITEM* aParent ) :
|
||||
PCB_DIMENSION_BASE( aParent, PCB_DIM_RADIAL_T )
|
||||
{
|
||||
m_unitsFormat = DIM_UNITS_FORMAT::NO_SUFFIX;
|
||||
m_overrideTextEnabled = false;
|
||||
|
@ -1228,8 +1228,8 @@ void PCB_DIM_RADIAL::updateGeometry()
|
|||
}
|
||||
|
||||
|
||||
PCB_DIM_CENTER::PCB_DIM_CENTER( BOARD_ITEM* aParent, bool aInFP ) :
|
||||
PCB_DIMENSION_BASE( aParent, aInFP ? PCB_FP_DIM_CENTER_T : PCB_DIM_CENTER_T )
|
||||
PCB_DIM_CENTER::PCB_DIM_CENTER( BOARD_ITEM* aParent ) :
|
||||
PCB_DIMENSION_BASE( aParent, PCB_DIM_CENTER_T )
|
||||
{
|
||||
m_unitsFormat = DIM_UNITS_FORMAT::NO_SUFFIX;
|
||||
m_overrideTextEnabled = true;
|
||||
|
|
|
@ -111,20 +111,6 @@ class PCB_DIMENSION_BASE : public PCB_TEXT
|
|||
public:
|
||||
PCB_DIMENSION_BASE( BOARD_ITEM* aParent, KICAD_T aType = PCB_DIMENSION_T );
|
||||
|
||||
bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
|
||||
{
|
||||
if( BOARD_ITEM::IsType( aScanTypes ) )
|
||||
return true;
|
||||
|
||||
for( KICAD_T scanType : aScanTypes )
|
||||
{
|
||||
if( scanType == PCB_LOCATE_GRAPHIC_T )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* The dimension's origin is the first feature point for the dimension. Every dimension has
|
||||
* one or more feature points, so every dimension has at least an origin.
|
||||
|
@ -383,7 +369,7 @@ protected:
|
|||
class PCB_DIM_ALIGNED : public PCB_DIMENSION_BASE
|
||||
{
|
||||
public:
|
||||
PCB_DIM_ALIGNED( BOARD_ITEM* aParent, KICAD_T aType );
|
||||
PCB_DIM_ALIGNED( BOARD_ITEM* aParent, KICAD_T aType = PCB_DIM_ALIGNED_T );
|
||||
|
||||
// Do not create a copy constructor & operator=.
|
||||
// The ones generated by the compiler are adequate.
|
||||
|
@ -392,8 +378,7 @@ public:
|
|||
|
||||
static inline bool ClassOf( const EDA_ITEM* aItem )
|
||||
{
|
||||
return aItem && ( aItem->Type() == PCB_DIM_ALIGNED_T
|
||||
|| aItem->Type() == PCB_FP_DIM_ALIGNED_T );
|
||||
return aItem && aItem->Type() == PCB_DIM_ALIGNED_T;
|
||||
}
|
||||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
@ -485,14 +470,13 @@ public:
|
|||
VERTICAL // Aligned with y-axis
|
||||
};
|
||||
|
||||
PCB_DIM_ORTHOGONAL( BOARD_ITEM* aParent, bool aInFP = false );
|
||||
PCB_DIM_ORTHOGONAL( BOARD_ITEM* aParent );
|
||||
|
||||
~PCB_DIM_ORTHOGONAL() = default;
|
||||
|
||||
static inline bool ClassOf( const EDA_ITEM* aItem )
|
||||
{
|
||||
return aItem && ( aItem->Type() == PCB_DIM_ORTHOGONAL_T
|
||||
|| aItem->Type() == PCB_FP_DIM_ORTHOGONAL_T );
|
||||
return aItem && aItem->Type() == PCB_DIM_ORTHOGONAL_T;
|
||||
}
|
||||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
@ -550,12 +534,11 @@ private:
|
|||
class PCB_DIM_RADIAL : public PCB_DIMENSION_BASE
|
||||
{
|
||||
public:
|
||||
PCB_DIM_RADIAL( BOARD_ITEM* aParent, bool aInFP = false );
|
||||
PCB_DIM_RADIAL( BOARD_ITEM* aParent );
|
||||
|
||||
static inline bool ClassOf( const EDA_ITEM* aItem )
|
||||
{
|
||||
return aItem && ( aItem->Type() == PCB_DIM_RADIAL_T
|
||||
|| aItem->Type() == PCB_FP_DIM_RADIAL_T );
|
||||
return aItem && aItem->Type() == PCB_DIM_RADIAL_T;
|
||||
}
|
||||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
@ -607,12 +590,11 @@ private:
|
|||
class PCB_DIM_LEADER : public PCB_DIMENSION_BASE
|
||||
{
|
||||
public:
|
||||
PCB_DIM_LEADER( BOARD_ITEM* aParent, bool aInFP = false );
|
||||
PCB_DIM_LEADER( BOARD_ITEM* aParent );
|
||||
|
||||
static inline bool ClassOf( const EDA_ITEM* aItem )
|
||||
{
|
||||
return aItem && ( aItem->Type() == PCB_DIM_LEADER_T
|
||||
|| aItem->Type() == PCB_FP_DIM_LEADER_T );
|
||||
return aItem && aItem->Type() == PCB_DIM_LEADER_T;
|
||||
}
|
||||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
@ -655,12 +637,11 @@ private:
|
|||
class PCB_DIM_CENTER : public PCB_DIMENSION_BASE
|
||||
{
|
||||
public:
|
||||
PCB_DIM_CENTER( BOARD_ITEM* aParent, bool aInFP = false );
|
||||
PCB_DIM_CENTER( BOARD_ITEM* aParent );
|
||||
|
||||
static inline bool ClassOf( const EDA_ITEM* aItem )
|
||||
{
|
||||
return aItem && ( aItem->Type() == PCB_DIM_CENTER_T
|
||||
|| aItem->Type() == PCB_FP_DIM_CENTER_T );
|
||||
return aItem && aItem->Type() == PCB_DIM_CENTER_T;
|
||||
}
|
||||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
|
|
@ -889,10 +889,10 @@ void PCB_EDIT_FRAME::setupUIConditions()
|
|||
|
||||
|
||||
SELECTION_CONDITION singleZoneCond = SELECTION_CONDITIONS::Count( 1 )
|
||||
&& SELECTION_CONDITIONS::OnlyTypes( { PCB_ZONE_T, PCB_FP_ZONE_T } );
|
||||
&& SELECTION_CONDITIONS::OnlyTypes( { PCB_ZONE_T } );
|
||||
|
||||
SELECTION_CONDITION zoneMergeCond = SELECTION_CONDITIONS::MoreThan( 1 )
|
||||
&& SELECTION_CONDITIONS::OnlyTypes( { PCB_ZONE_T, PCB_FP_ZONE_T } );
|
||||
&& SELECTION_CONDITIONS::OnlyTypes( { PCB_ZONE_T } );
|
||||
|
||||
mgr->SetConditions( PCB_ACTIONS::zoneDuplicate, ENABLE( singleZoneCond ) );
|
||||
mgr->SetConditions( PCB_ACTIONS::drawZoneCutout, ENABLE( singleZoneCond ) );
|
||||
|
@ -1699,10 +1699,6 @@ void PCB_EDIT_FRAME::ShowFindDialog()
|
|||
findString = static_cast<FOOTPRINT*>( front )->GetValue();
|
||||
break;
|
||||
|
||||
case PCB_FP_TEXT_T:
|
||||
findString = static_cast<FP_TEXT*>( front )->GetShownText();
|
||||
break;
|
||||
|
||||
case PCB_TEXT_T:
|
||||
findString = static_cast<PCB_TEXT*>( front )->GetShownText();
|
||||
|
||||
|
@ -2047,7 +2043,7 @@ int PCB_EDIT_FRAME::ShowExchangeFootprintsDialog( FOOTPRINT* aFootprint, bool aU
|
|||
namespace {
|
||||
|
||||
|
||||
void processTextItem( const FP_TEXT& aSrc, FP_TEXT& aDest,
|
||||
void processTextItem( const PCB_TEXT& aSrc, PCB_TEXT& aDest,
|
||||
bool resetText, bool resetTextLayers, bool resetTextEffects,
|
||||
bool* aUpdated )
|
||||
{
|
||||
|
@ -2074,7 +2070,7 @@ void processTextItem( const FP_TEXT& aSrc, FP_TEXT& aDest,
|
|||
*aUpdated |= aSrc.GetTextSize() != aDest.GetTextSize();
|
||||
*aUpdated |= aSrc.GetTextThickness() != aDest.GetTextThickness();
|
||||
*aUpdated |= aSrc.GetTextAngle() != aDest.GetTextAngle();
|
||||
*aUpdated |= aSrc.GetPos0() != aDest.GetPos0();
|
||||
*aUpdated |= aSrc.GetFPRelativePosition() != aDest.GetFPRelativePosition();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2082,20 +2078,20 @@ void processTextItem( const FP_TEXT& aSrc, FP_TEXT& aDest,
|
|||
bool visible = aDest.IsVisible();
|
||||
aDest.SetAttributes( aSrc );
|
||||
aDest.SetVisible( visible );
|
||||
aDest.SetPos0( aSrc.GetPos0() );
|
||||
aDest.SetFPRelativePosition( aSrc.GetFPRelativePosition() );
|
||||
}
|
||||
|
||||
aDest.SetLocked( aSrc.IsLocked() );
|
||||
}
|
||||
|
||||
|
||||
FP_TEXT* getMatchingTextItem( FP_TEXT* aRefItem, FOOTPRINT* aFootprint )
|
||||
PCB_TEXT* getMatchingTextItem( PCB_TEXT* aRefItem, FOOTPRINT* aFootprint )
|
||||
{
|
||||
std::vector<FP_TEXT*> candidates;
|
||||
std::vector<PCB_TEXT*> candidates;
|
||||
|
||||
for( BOARD_ITEM* item : aFootprint->GraphicalItems() )
|
||||
{
|
||||
FP_TEXT* candidate = dyn_cast<FP_TEXT*>( item );
|
||||
PCB_TEXT* candidate = dyn_cast<PCB_TEXT*>( item );
|
||||
|
||||
if( candidate && candidate->GetText() == aRefItem->GetText() )
|
||||
candidates.push_back( candidate );
|
||||
|
@ -2108,9 +2104,9 @@ FP_TEXT* getMatchingTextItem( FP_TEXT* aRefItem, FOOTPRINT* aFootprint )
|
|||
return candidates[0];
|
||||
|
||||
// Try refining the match by layer
|
||||
std::vector<FP_TEXT*> candidatesOnSameLayer;
|
||||
std::vector<PCB_TEXT*> candidatesOnSameLayer;
|
||||
|
||||
for( FP_TEXT* candidate : candidates )
|
||||
for( PCB_TEXT* candidate : candidates )
|
||||
{
|
||||
if( candidate->GetLayer() == aRefItem->GetLayer() )
|
||||
candidatesOnSameLayer.push_back( candidate );
|
||||
|
@ -2120,11 +2116,11 @@ FP_TEXT* getMatchingTextItem( FP_TEXT* aRefItem, FOOTPRINT* aFootprint )
|
|||
return candidatesOnSameLayer[0];
|
||||
|
||||
// Last ditch effort: refine by position
|
||||
std::vector<FP_TEXT*> candidatesAtSamePos;
|
||||
std::vector<PCB_TEXT*> candidatesAtSamePos;
|
||||
|
||||
for( FP_TEXT* candidate : candidatesOnSameLayer.size() ? candidatesOnSameLayer : candidates )
|
||||
for( PCB_TEXT* candidate : candidatesOnSameLayer.size() ? candidatesOnSameLayer : candidates )
|
||||
{
|
||||
if( candidate->GetPos0() == aRefItem->GetPos0() )
|
||||
if( candidate->GetFPRelativePosition() == aRefItem->GetFPRelativePosition() )
|
||||
candidatesAtSamePos.push_back( candidate );
|
||||
}
|
||||
|
||||
|
@ -2236,11 +2232,11 @@ void PCB_EDIT_FRAME::ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew,
|
|||
|
||||
for( BOARD_ITEM* item : aExisting->GraphicalItems() )
|
||||
{
|
||||
FP_TEXT* srcItem = dyn_cast<FP_TEXT*>( item );
|
||||
PCB_TEXT* srcItem = dyn_cast<PCB_TEXT*>( item );
|
||||
|
||||
if( srcItem )
|
||||
{
|
||||
FP_TEXT* destItem = getMatchingTextItem( srcItem, aNew );
|
||||
PCB_TEXT* destItem = getMatchingTextItem( srcItem, aNew );
|
||||
|
||||
if( destItem )
|
||||
{
|
||||
|
@ -2249,7 +2245,7 @@ void PCB_EDIT_FRAME::ExchangeFootprint( FOOTPRINT* aExisting, FOOTPRINT* aNew,
|
|||
}
|
||||
else if( !deleteExtraTexts )
|
||||
{
|
||||
aNew->Add( new FP_TEXT( *srcItem ) );
|
||||
aNew->Add( new PCB_TEXT( *srcItem ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -482,7 +482,7 @@ bool collidesWithArea( BOARD_ITEM* aItem, PCB_EXPR_CONTEXT* aCtx, ZONE* aArea )
|
|||
return false;
|
||||
}
|
||||
|
||||
if( aItem->Type() == PCB_ZONE_T || aItem->Type() == PCB_FP_ZONE_T )
|
||||
if( aItem->Type() == PCB_ZONE_T )
|
||||
{
|
||||
ZONE* zone = static_cast<ZONE*>( aItem );
|
||||
|
||||
|
|
|
@ -50,15 +50,6 @@ bool PCB_GROUP::IsGroupableType( KICAD_T aType )
|
|||
case PCB_BITMAP_T:
|
||||
case PCB_TEXT_T:
|
||||
case PCB_TEXTBOX_T:
|
||||
case PCB_FP_TEXT_T:
|
||||
case PCB_FP_TEXTBOX_T:
|
||||
case PCB_FP_SHAPE_T:
|
||||
case PCB_FP_DIM_ALIGNED_T:
|
||||
case PCB_FP_DIM_LEADER_T:
|
||||
case PCB_FP_DIM_CENTER_T:
|
||||
case PCB_FP_DIM_RADIAL_T:
|
||||
case PCB_FP_DIM_ORTHOGONAL_T:
|
||||
case PCB_FP_ZONE_T:
|
||||
case PCB_GROUP_T:
|
||||
case PCB_TRACE_T:
|
||||
case PCB_VIA_T:
|
||||
|
|
|
@ -48,11 +48,8 @@ DECL_DEQ_FOR_SWIG( DRAWINGS, BOARD_ITEM* )
|
|||
|
||||
|
||||
// Footprint-level items
|
||||
class FP_ZONE;
|
||||
class PAD;
|
||||
|
||||
DECL_DEQ_FOR_SWIG( PADS, PAD* )
|
||||
DECL_VEC_FOR_SWIG( FP_ZONES, FP_ZONE* )
|
||||
DECL_VEC_FOR_SWIG( FP_GROUPS, PCB_GROUP* )
|
||||
|
||||
#endif // PCB_ITEM_CONTAINERS_H_
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include <pcb_track.h>
|
||||
#include <pcb_group.h>
|
||||
#include <footprint.h>
|
||||
#include <fp_textbox.h>
|
||||
#include <pad.h>
|
||||
#include <pcb_shape.h>
|
||||
#include <string_utils.h>
|
||||
|
@ -223,7 +222,7 @@ COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) cons
|
|||
}
|
||||
|
||||
// Zones should pull from the copper layer
|
||||
if( item && ( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T ) )
|
||||
if( item && item->Type() == PCB_ZONE_T )
|
||||
{
|
||||
if( IsZoneFillLayer( aLayer ) )
|
||||
aLayer = aLayer - LAYER_ZONE_START;
|
||||
|
@ -429,7 +428,7 @@ COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) cons
|
|||
color.a *= m_viaOpacity;
|
||||
else if( item->Type() == PCB_PAD_T )
|
||||
color.a *= m_padOpacity;
|
||||
else if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T )
|
||||
else if( item->Type() == PCB_ZONE_T )
|
||||
color.a *= m_zoneOpacity;
|
||||
else if( item->Type() == PCB_BITMAP_T )
|
||||
color.a *= m_imageOpacity;
|
||||
|
@ -505,11 +504,13 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
|
|||
|
||||
if( item->GetParentFootprint() && !board->IsFootprintHolder() )
|
||||
{
|
||||
FOOTPRINT* parentFP = static_cast<FOOTPRINT*>( item->GetParentFootprint() );
|
||||
FOOTPRINT* parentFP = item->GetParentFootprint();
|
||||
|
||||
// Never draw footprint bitmaps on board
|
||||
if( item->Type() == PCB_BITMAP_T )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if( item->GetLayerSet().count() > 1 )
|
||||
{
|
||||
// For multi-layer objects, exclude only those layers that are private
|
||||
|
@ -553,7 +554,6 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
|
|||
break;
|
||||
|
||||
case PCB_SHAPE_T:
|
||||
case PCB_FP_SHAPE_T:
|
||||
draw( static_cast<const PCB_SHAPE*>( item ), aLayer );
|
||||
break;
|
||||
|
||||
|
@ -569,14 +569,6 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
|
|||
draw( static_cast<const PCB_TEXTBOX*>( item ), aLayer );
|
||||
break;
|
||||
|
||||
case PCB_FP_TEXT_T:
|
||||
draw( static_cast<const FP_TEXT*>( item ), aLayer );
|
||||
break;
|
||||
|
||||
case PCB_FP_TEXTBOX_T:
|
||||
draw( static_cast<const FP_TEXTBOX*>( item ), aLayer );
|
||||
break;
|
||||
|
||||
case PCB_FOOTPRINT_T:
|
||||
draw( static_cast<const FOOTPRINT*>( item ), aLayer );
|
||||
break;
|
||||
|
@ -586,7 +578,6 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
|
|||
break;
|
||||
|
||||
case PCB_ZONE_T:
|
||||
case PCB_FP_ZONE_T:
|
||||
draw( static_cast<const ZONE*>( item ), aLayer );
|
||||
break;
|
||||
|
||||
|
@ -595,11 +586,6 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
|
|||
case PCB_DIM_RADIAL_T:
|
||||
case PCB_DIM_ORTHOGONAL_T:
|
||||
case PCB_DIM_LEADER_T:
|
||||
case PCB_FP_DIM_ALIGNED_T:
|
||||
case PCB_FP_DIM_CENTER_T:
|
||||
case PCB_FP_DIM_RADIAL_T:
|
||||
case PCB_FP_DIM_ORTHOGONAL_T:
|
||||
case PCB_FP_DIM_LEADER_T:
|
||||
draw( static_cast<const PCB_DIMENSION_BASE*>( item ), aLayer );
|
||||
break;
|
||||
|
||||
|
@ -1116,14 +1102,14 @@ void PCB_PAINTER::draw( const PAD* aPad, int aLayer )
|
|||
|
||||
if( aPad->GetFlags() & ENTERED )
|
||||
{
|
||||
FOOTPRINT* fp = static_cast<FOOTPRINT*>( aPad->GetParentFootprint() );
|
||||
FOOTPRINT* fp = aPad->GetParentFootprint();
|
||||
|
||||
// Find the number box
|
||||
for( const BOARD_ITEM* aItem : fp->GraphicalItems() )
|
||||
{
|
||||
if( aItem->Type() == PCB_FP_SHAPE_T )
|
||||
if( aItem->Type() == PCB_SHAPE_T )
|
||||
{
|
||||
const FP_SHAPE* shape = static_cast<const FP_SHAPE*>( aItem );
|
||||
const PCB_SHAPE* shape = static_cast<const PCB_SHAPE*>( aItem );
|
||||
|
||||
if( shape->IsAnnotationProxy() )
|
||||
{
|
||||
|
@ -1768,18 +1754,10 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer )
|
|||
case SHAPE_T::POLY:
|
||||
{
|
||||
SHAPE_POLY_SET& shape = const_cast<PCB_SHAPE*>( aShape )->GetPolyShape();
|
||||
const FOOTPRINT* parentFootprint = aShape->GetParentFootprint();
|
||||
|
||||
if( shape.OutlineCount() == 0 )
|
||||
break;
|
||||
|
||||
if( parentFootprint )
|
||||
{
|
||||
m_gal->Save();
|
||||
m_gal->Translate( parentFootprint->GetPosition() );
|
||||
m_gal->Rotate( -parentFootprint->GetOrientation().AsRadians() );
|
||||
}
|
||||
|
||||
if( outline_mode )
|
||||
{
|
||||
for( int ii = 0; ii < shape.OutlineCount(); ++ii )
|
||||
|
@ -1809,9 +1787,6 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer )
|
|||
}
|
||||
}
|
||||
|
||||
if( parentFootprint )
|
||||
m_gal->Restore();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1976,6 +1951,7 @@ void PCB_PAINTER::draw( const PCB_TEXT* aText, int aLayer )
|
|||
|
||||
m_gal->SetStrokeColor( color );
|
||||
m_gal->SetFillColor( color );
|
||||
attrs.m_Angle = aText->GetDrawRotation();
|
||||
|
||||
if( aText->IsKnockout() )
|
||||
{
|
||||
|
@ -2131,159 +2107,6 @@ void PCB_PAINTER::draw( const PCB_TEXTBOX* aTextBox, int aLayer )
|
|||
}
|
||||
|
||||
|
||||
void PCB_PAINTER::draw( const FP_TEXT* aText, int aLayer )
|
||||
{
|
||||
wxString resolvedText( aText->GetShownText() );
|
||||
|
||||
if( resolvedText.Length() == 0 )
|
||||
return;
|
||||
|
||||
const COLOR4D& color = m_pcbSettings.GetColor( aText, aLayer );
|
||||
bool outline_mode = !viewer_settings()->m_ViewersDisplay.m_DisplayTextFill;
|
||||
TEXT_ATTRIBUTES attrs = aText->GetAttributes();
|
||||
|
||||
KIFONT::FONT* font = aText->GetFont();
|
||||
|
||||
if( !font )
|
||||
{
|
||||
font = KIFONT::FONT::GetFont( m_pcbSettings.GetDefaultFont(), aText->IsBold(),
|
||||
aText->IsItalic() );
|
||||
}
|
||||
|
||||
m_gal->SetStrokeColor( color );
|
||||
m_gal->SetFillColor( color );
|
||||
attrs.m_Angle = aText->GetDrawRotation();
|
||||
|
||||
if( aText->IsKnockout() )
|
||||
{
|
||||
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
|
||||
SHAPE_POLY_SET knockouts;
|
||||
|
||||
CALLBACK_GAL callback_gal( empty_opts,
|
||||
// Polygon callback
|
||||
[&]( const SHAPE_LINE_CHAIN& aPoly )
|
||||
{
|
||||
knockouts.AddOutline( aPoly );
|
||||
} );
|
||||
|
||||
attrs.m_StrokeWidth = getLineThickness( aText->GetEffectiveTextPenWidth() );
|
||||
|
||||
callback_gal.SetIsFill( font->IsOutline() );
|
||||
callback_gal.SetIsStroke( font->IsStroke() );
|
||||
callback_gal.SetLineWidth( attrs.m_StrokeWidth );
|
||||
font->Draw( &callback_gal, resolvedText, aText->GetDrawPos(), attrs );
|
||||
|
||||
SHAPE_POLY_SET finalPoly;
|
||||
int margin = attrs.m_StrokeWidth * 1.5
|
||||
+ GetKnockoutTextMargin( attrs.m_Size, attrs.m_StrokeWidth );
|
||||
|
||||
aText->TransformBoundingBoxToPolygon( &finalPoly, margin );
|
||||
finalPoly.BooleanSubtract( knockouts, SHAPE_POLY_SET::PM_FAST );
|
||||
finalPoly.Fracture( SHAPE_POLY_SET::PM_FAST );
|
||||
|
||||
m_gal->SetIsStroke( false );
|
||||
m_gal->SetIsFill( true );
|
||||
m_gal->DrawPolygon( finalPoly );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( outline_mode )
|
||||
attrs.m_StrokeWidth = m_pcbSettings.m_outlineWidth;
|
||||
else
|
||||
attrs.m_StrokeWidth = getLineThickness( aText->GetEffectiveTextPenWidth() );
|
||||
|
||||
if( m_gal->IsFlippedX() && !( aText->GetLayerSet() & LSET::SideSpecificMask() ).any() )
|
||||
{
|
||||
attrs.m_Mirrored = !attrs.m_Mirrored;
|
||||
attrs.m_Halign = static_cast<GR_TEXT_H_ALIGN_T>( -attrs.m_Halign );
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = nullptr;
|
||||
|
||||
if( font->IsOutline() )
|
||||
cache = aText->GetRenderCache( font, resolvedText );
|
||||
|
||||
if( cache )
|
||||
m_gal->DrawGlyphs( *cache );
|
||||
else
|
||||
strokeText( resolvedText, aText->GetTextPos(), attrs );
|
||||
}
|
||||
|
||||
// Draw the umbilical line
|
||||
if( aText->IsSelected() )
|
||||
{
|
||||
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
|
||||
m_gal->SetStrokeColor( m_pcbSettings.GetColor( nullptr, LAYER_ANCHOR ) );
|
||||
m_gal->DrawLine( aText->GetTextPos(), aText->GetParent()->GetPosition() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PCB_PAINTER::draw( const FP_TEXTBOX* aTextBox, int aLayer )
|
||||
{
|
||||
const COLOR4D& color = m_pcbSettings.GetColor( aTextBox, aTextBox->GetLayer() );
|
||||
int thickness = getLineThickness( aTextBox->GetWidth() );
|
||||
PLOT_DASH_TYPE lineStyle = aTextBox->GetStroke().GetPlotStyle();
|
||||
|
||||
m_gal->SetFillColor( color );
|
||||
m_gal->SetStrokeColor( color );
|
||||
m_gal->SetIsFill( true );
|
||||
m_gal->SetIsStroke( false );
|
||||
|
||||
if( thickness > 0 )
|
||||
{
|
||||
if( lineStyle <= PLOT_DASH_TYPE::FIRST_TYPE )
|
||||
{
|
||||
std::vector<VECTOR2I> pts = aTextBox->GetCorners();
|
||||
|
||||
for( size_t ii = 0; ii < pts.size(); ++ii )
|
||||
m_gal->DrawSegment( pts[ ii ], pts[ (ii + 1) % pts.size() ], thickness );
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<SHAPE*> shapes = aTextBox->MakeEffectiveShapes( true );
|
||||
|
||||
for( SHAPE* shape : shapes )
|
||||
{
|
||||
STROKE_PARAMS::Stroke( shape, lineStyle, thickness, &m_pcbSettings,
|
||||
[&]( const VECTOR2I& a, const VECTOR2I& b )
|
||||
{
|
||||
m_gal->DrawSegment( a, b, thickness );
|
||||
} );
|
||||
}
|
||||
|
||||
for( SHAPE* shape : shapes )
|
||||
delete shape;
|
||||
}
|
||||
}
|
||||
|
||||
wxString resolvedText( aTextBox->GetShownText() );
|
||||
|
||||
if( resolvedText.Length() == 0 )
|
||||
return;
|
||||
|
||||
TEXT_ATTRIBUTES attrs = aTextBox->GetAttributes();
|
||||
attrs.m_Angle = aTextBox->GetDrawRotation();
|
||||
attrs.m_StrokeWidth = getLineThickness( aTextBox->GetEffectiveTextPenWidth() );
|
||||
|
||||
if( m_gal->IsFlippedX() && !( aTextBox->GetLayerSet() & LSET::SideSpecificMask() ).any() )
|
||||
{
|
||||
attrs.m_Mirrored = !attrs.m_Mirrored;
|
||||
attrs.m_Halign = static_cast<GR_TEXT_H_ALIGN_T>( -attrs.m_Halign );
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache = nullptr;
|
||||
|
||||
if( aTextBox->GetFont() && aTextBox->GetFont()->IsOutline() )
|
||||
cache = aTextBox->GetRenderCache( aTextBox->GetFont(), resolvedText );
|
||||
|
||||
if( cache )
|
||||
m_gal->DrawGlyphs( *cache );
|
||||
else
|
||||
strokeText( resolvedText, aTextBox->GetDrawPos(), attrs );
|
||||
}
|
||||
|
||||
|
||||
void PCB_PAINTER::draw( const FOOTPRINT* aFootprint, int aLayer )
|
||||
{
|
||||
if( aLayer == LAYER_ANCHOR )
|
||||
|
|
|
@ -52,8 +52,6 @@ class ZONE;
|
|||
class PCB_BITMAP;
|
||||
class PCB_TEXT;
|
||||
class PCB_TEXTBOX;
|
||||
class FP_TEXT;
|
||||
class FP_TEXTBOX;
|
||||
class PCB_DIMENSION_BASE;
|
||||
class PCB_TARGET;
|
||||
class PCB_MARKER;
|
||||
|
@ -180,8 +178,6 @@ protected:
|
|||
void draw( const PCB_BITMAP* aBitmap, int aLayer );
|
||||
void draw( const PCB_TEXT* aText, int aLayer );
|
||||
void draw( const PCB_TEXTBOX* aText, int aLayer );
|
||||
void draw( const FP_TEXT* aText, int aLayer );
|
||||
void draw( const FP_TEXTBOX* aText, int aLayer );
|
||||
void draw( const FOOTPRINT* aFootprint, int aLayer );
|
||||
void draw( const PCB_GROUP* aGroup, int aLayer );
|
||||
void draw( const ZONE* aZone, int aLayer );
|
||||
|
|
|
@ -63,9 +63,7 @@ bool PCB_SHAPE::IsType( const std::vector<KICAD_T>& aScanTypes ) const
|
|||
|
||||
for( KICAD_T scanType : aScanTypes )
|
||||
{
|
||||
if( scanType == PCB_LOCATE_GRAPHIC_T )
|
||||
return true;
|
||||
else if( scanType == PCB_LOCATE_BOARD_EDGE_T )
|
||||
if( scanType == PCB_LOCATE_BOARD_EDGE_T )
|
||||
sametype = m_layer == Edge_Cuts;
|
||||
else if( scanType == PCB_SHAPE_LOCATE_ARC_T )
|
||||
sametype = m_shape == SHAPE_T::ARC;
|
||||
|
@ -140,12 +138,10 @@ std::vector<VECTOR2I> PCB_SHAPE::GetCorners() const
|
|||
}
|
||||
else if( GetShape() == SHAPE_T::POLY )
|
||||
{
|
||||
VECTOR2I offset = getParentPosition();
|
||||
|
||||
for( int ii = 0; ii < GetPolyShape().OutlineCount(); ++ii )
|
||||
{
|
||||
for( const VECTOR2I& pt : GetPolyShape().Outline( ii ).CPoints() )
|
||||
pts.emplace_back( pt + offset );
|
||||
pts.emplace_back( pt );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -249,30 +245,6 @@ void PCB_SHAPE::Mirror( const VECTOR2I& aCentre, bool aMirrorAroundXAxis )
|
|||
}
|
||||
|
||||
|
||||
FOOTPRINT* PCB_SHAPE::GetParentFootprint() const
|
||||
{
|
||||
return dynamic_cast<FOOTPRINT*>( BOARD_ITEM::GetParentFootprint() );
|
||||
}
|
||||
|
||||
|
||||
EDA_ANGLE PCB_SHAPE::getParentOrientation() const
|
||||
{
|
||||
if( GetParentFootprint() )
|
||||
return GetParentFootprint()->GetOrientation();
|
||||
else
|
||||
return ANGLE_0;
|
||||
}
|
||||
|
||||
|
||||
VECTOR2I PCB_SHAPE::getParentPosition() const
|
||||
{
|
||||
if( GetParentFootprint() )
|
||||
return GetParentFootprint()->GetPosition();
|
||||
else
|
||||
return VECTOR2I( 0, 0 );
|
||||
}
|
||||
|
||||
|
||||
double PCB_SHAPE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||
{
|
||||
constexpr double HIDE = std::numeric_limits<double>::max();
|
||||
|
@ -295,12 +267,27 @@ double PCB_SHAPE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
|||
}
|
||||
}
|
||||
|
||||
if( FOOTPRINT* parent = GetParentFootprint() )
|
||||
{
|
||||
if( parent->GetLayer() == F_Cu && !aView->IsLayerVisible( LAYER_MOD_FR ) )
|
||||
return HIDE;
|
||||
|
||||
if( parent->GetLayer() == B_Cu && !aView->IsLayerVisible( LAYER_MOD_BK ) )
|
||||
return HIDE;
|
||||
}
|
||||
|
||||
return SHOW;
|
||||
}
|
||||
|
||||
|
||||
void PCB_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
|
||||
{
|
||||
if( aFrame->GetName() == PCB_EDIT_FRAME_NAME )
|
||||
{
|
||||
if( FOOTPRINT* parent = GetParentFootprint() )
|
||||
aList.emplace_back( _( "Footprint" ), parent->GetReference() );
|
||||
}
|
||||
|
||||
aList.emplace_back( _( "Type" ), _( "Drawing" ) );
|
||||
|
||||
if( aFrame->GetName() == PCB_EDIT_FRAME_NAME && IsLocked() )
|
||||
|
@ -320,7 +307,10 @@ wxString PCB_SHAPE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
|
|||
|
||||
BITMAPS PCB_SHAPE::GetMenuImage() const
|
||||
{
|
||||
return BITMAPS::add_dashed_line;
|
||||
if( GetParentFootprint() )
|
||||
return BITMAPS::show_mod_edge;
|
||||
else
|
||||
return BITMAPS::add_dashed_line;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -83,13 +83,6 @@ public:
|
|||
*/
|
||||
const VECTOR2I GetFocusPosition() const override;
|
||||
|
||||
/**
|
||||
* Return the parent footprint or NULL if PCB_SHAPE does not belong to a footprint.
|
||||
*
|
||||
* @return the parent footprint or NULL.
|
||||
*/
|
||||
FOOTPRINT* GetParentFootprint() const;
|
||||
|
||||
/**
|
||||
* Make a set of SHAPE objects representing the PCB_SHAPE. Caller owns the objects.
|
||||
*/
|
||||
|
@ -158,9 +151,6 @@ protected:
|
|||
{
|
||||
bool operator()( const BOARD_ITEM* aFirst, const BOARD_ITEM* aSecond ) const;
|
||||
};
|
||||
|
||||
EDA_ANGLE getParentOrientation() const override;
|
||||
VECTOR2I getParentPosition() const override;
|
||||
};
|
||||
|
||||
#endif // PCB_SHAPE_H
|
||||
|
|
|
@ -40,13 +40,38 @@
|
|||
|
||||
|
||||
PCB_TEXT::PCB_TEXT( BOARD_ITEM* parent, KICAD_T idtype ) :
|
||||
BOARD_ITEM( parent, idtype ),
|
||||
EDA_TEXT( pcbIUScale )
|
||||
BOARD_ITEM( parent, idtype ),
|
||||
EDA_TEXT( pcbIUScale ),
|
||||
m_type( TEXT_is_DIVERS )
|
||||
{
|
||||
SetMultilineAllowed( true );
|
||||
}
|
||||
|
||||
|
||||
PCB_TEXT::PCB_TEXT( FOOTPRINT* aParent, TEXT_TYPE text_type ) :
|
||||
BOARD_ITEM( aParent, PCB_TEXT_T ),
|
||||
EDA_TEXT( pcbIUScale ),
|
||||
m_type( text_type )
|
||||
{
|
||||
SetKeepUpright( true );
|
||||
|
||||
// Set text thickness to a default value
|
||||
SetTextThickness( pcbIUScale.mmToIU( DEFAULT_TEXT_WIDTH ) );
|
||||
SetLayer( F_SilkS );
|
||||
|
||||
if( aParent )
|
||||
{
|
||||
SetTextPos( aParent->GetPosition() );
|
||||
|
||||
if( IsBackLayer( aParent->GetLayer() ) )
|
||||
{
|
||||
SetLayer( B_SilkS );
|
||||
SetMirrored( true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PCB_TEXT::~PCB_TEXT()
|
||||
{
|
||||
}
|
||||
|
@ -54,11 +79,15 @@ PCB_TEXT::~PCB_TEXT()
|
|||
|
||||
wxString PCB_TEXT::GetShownText( int aDepth, bool aAllowExtraText ) const
|
||||
{
|
||||
BOARD* board = dynamic_cast<BOARD*>( GetParent() );
|
||||
const FOOTPRINT* parentFootprint = GetParentFootprint();
|
||||
const BOARD* board = GetBoard();
|
||||
|
||||
std::function<bool( wxString* )> pcbTextResolver =
|
||||
std::function<bool( wxString* )> resolver =
|
||||
[&]( wxString* token ) -> bool
|
||||
{
|
||||
if( parentFootprint && parentFootprint->ResolveTextVar( token, aDepth + 1 ) )
|
||||
return true;
|
||||
|
||||
if( token->IsSameAs( wxT( "LAYER" ) ) )
|
||||
{
|
||||
*token = GetLayerName();
|
||||
|
@ -66,35 +95,85 @@ wxString PCB_TEXT::GetShownText( int aDepth, bool aAllowExtraText ) const
|
|||
}
|
||||
|
||||
if( board->ResolveTextVar( token, aDepth + 1 ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
wxString text = EDA_TEXT::GetShownText();
|
||||
|
||||
if( board && HasTextVars() && aDepth < 10 )
|
||||
text = ExpandTextVars( text, &pcbTextResolver );
|
||||
if( HasTextVars() )
|
||||
{
|
||||
if( aDepth < 10 )
|
||||
text = ExpandTextVars( text, &resolver );
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
EDA_ANGLE PCB_TEXT::GetDrawRotation() const
|
||||
{
|
||||
EDA_ANGLE rotation = GetTextAngle();
|
||||
|
||||
if( GetParentFootprint() && IsKeepUpright() )
|
||||
{
|
||||
// Keep angle between ]-90..90] deg. Otherwise the text is not easy to read
|
||||
while( rotation > ANGLE_90 )
|
||||
rotation -= ANGLE_180;
|
||||
|
||||
while( rotation <= -ANGLE_90 )
|
||||
rotation += ANGLE_180;
|
||||
}
|
||||
else
|
||||
{
|
||||
rotation.Normalize();
|
||||
}
|
||||
|
||||
return rotation;
|
||||
}
|
||||
|
||||
|
||||
const BOX2I PCB_TEXT::ViewBBox() const
|
||||
{
|
||||
EDA_ANGLE angle = GetDrawRotation();
|
||||
BOX2I text_area = GetTextBox();
|
||||
|
||||
if( !angle.IsZero() )
|
||||
text_area = text_area.GetBoundingBoxRotated( GetTextPos(), angle );
|
||||
|
||||
return BOX2I( text_area.GetPosition(), text_area.GetSize() );
|
||||
}
|
||||
|
||||
|
||||
void PCB_TEXT::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||
{
|
||||
if( GetParentFootprint() == nullptr || IsVisible() )
|
||||
aLayers[0] = GetLayer();
|
||||
else
|
||||
aLayers[0] = LAYER_MOD_TEXT_INVISIBLE;
|
||||
|
||||
aCount = 1;
|
||||
}
|
||||
|
||||
|
||||
double PCB_TEXT::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||
{
|
||||
constexpr double HIDE = std::numeric_limits<double>::max();
|
||||
|
||||
if( !aView )
|
||||
return 0.0;
|
||||
|
||||
KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( aView->GetPainter() );
|
||||
KIGFX::PCB_RENDER_SETTINGS* renderSettings = painter->GetSettings();
|
||||
|
||||
// Hidden text gets put on the LAYER_MOD_TEXT_INVISIBLE for rendering, but
|
||||
// should only render if its native layer is visible.
|
||||
if( !aView->IsLayerVisible( GetLayer() ) )
|
||||
return HIDE;
|
||||
|
||||
if( aLayer == LAYER_LOCKED_ITEM_SHADOW )
|
||||
{
|
||||
// Hide shadow if the main layer is not shown
|
||||
if( !aView->IsLayerVisible( m_layer ) )
|
||||
return HIDE;
|
||||
|
||||
// Hide shadow on dimmed tracks
|
||||
if( renderSettings->GetHighContrast() )
|
||||
{
|
||||
|
@ -103,18 +182,64 @@ double PCB_TEXT::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
|||
}
|
||||
}
|
||||
|
||||
if( FOOTPRINT* parentFP = GetParentFootprint() )
|
||||
{
|
||||
// Handle Render tab switches
|
||||
if( m_type == TEXT_is_VALUE || GetText() == wxT( "${VALUE}" ) )
|
||||
{
|
||||
if( !aView->IsLayerVisible( LAYER_MOD_VALUES ) )
|
||||
return HIDE;
|
||||
}
|
||||
|
||||
if( m_type == TEXT_is_REFERENCE || GetText() == wxT( "${REFERENCE}" ) )
|
||||
{
|
||||
if( !aView->IsLayerVisible( LAYER_MOD_REFERENCES ) )
|
||||
return HIDE;
|
||||
}
|
||||
|
||||
if( parentFP->GetLayer() == F_Cu && !aView->IsLayerVisible( LAYER_MOD_FR ) )
|
||||
return HIDE;
|
||||
|
||||
if( parentFP->GetLayer() == B_Cu && !aView->IsLayerVisible( LAYER_MOD_BK ) )
|
||||
return HIDE;
|
||||
|
||||
if( !aView->IsLayerVisible( LAYER_MOD_TEXT ) )
|
||||
return HIDE;
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
void PCB_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
|
||||
{
|
||||
FOOTPRINT* parentFP = GetParentFootprint();
|
||||
|
||||
if( parentFP && aFrame->GetName() == PCB_EDIT_FRAME_NAME )
|
||||
aList.emplace_back( _( "Footprint" ), parentFP->GetReference() );
|
||||
|
||||
// Don't use GetShownText() here; we want to show the user the variable references
|
||||
aList.emplace_back( _( "PCB Text" ), KIUI::EllipsizeStatusText( aFrame, GetText() ) );
|
||||
if( parentFP )
|
||||
aList.emplace_back( _( "Text" ), KIUI::EllipsizeStatusText( aFrame, GetText() ) );
|
||||
else
|
||||
aList.emplace_back( _( "PCB Text" ), KIUI::EllipsizeStatusText( aFrame, GetText() ) );
|
||||
|
||||
if( parentFP )
|
||||
{
|
||||
switch( m_type )
|
||||
{
|
||||
case TEXT_is_REFERENCE: aList.emplace_back( _( "Type" ), _( "Reference" ) ); break;
|
||||
case TEXT_is_VALUE: aList.emplace_back( _( "Type" ), _( "Value" ) ); break;
|
||||
case TEXT_is_DIVERS: aList.emplace_back( _( "Type" ), _( "Text" ) ); break;
|
||||
}
|
||||
}
|
||||
|
||||
if( aFrame->GetName() == PCB_EDIT_FRAME_NAME && IsLocked() )
|
||||
aList.emplace_back( _( "Status" ), _( "Locked" ) );
|
||||
|
||||
if( parentFP )
|
||||
aList.emplace_back( _( "Display" ), IsVisible() ? _( "Yes" ) : _( "No" ) );
|
||||
|
||||
aList.emplace_back( _( "Layer" ), GetLayerName() );
|
||||
|
||||
aList.emplace_back( _( "Mirror" ), IsMirrored() ? _( "Yes" ) : _( "No" ) );
|
||||
|
@ -137,14 +262,33 @@ int PCB_TEXT::getKnockoutMargin() const
|
|||
}
|
||||
|
||||
|
||||
void PCB_TEXT::KeepUpright( const EDA_ANGLE& aOldOrientation, const EDA_ANGLE& aNewOrientation )
|
||||
{
|
||||
if( !IsKeepUpright() )
|
||||
return;
|
||||
|
||||
EDA_ANGLE newAngle = GetTextAngle() + aNewOrientation;
|
||||
newAngle.Normalize();
|
||||
|
||||
bool needsFlipped = newAngle >= ANGLE_180;
|
||||
|
||||
if( needsFlipped )
|
||||
{
|
||||
SetHorizJustify( static_cast<GR_TEXT_H_ALIGN_T>( -GetHorizJustify() ) );
|
||||
SetTextAngle( GetTextAngle() + ANGLE_180 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const BOX2I PCB_TEXT::GetBoundingBox() const
|
||||
{
|
||||
BOX2I rect = GetTextBox();
|
||||
EDA_ANGLE angle = GetDrawRotation();
|
||||
BOX2I rect = GetTextBox();
|
||||
|
||||
if( IsKnockout() )
|
||||
rect.Inflate( getKnockoutMargin() );
|
||||
|
||||
if( !GetTextAngle().IsZero() )
|
||||
if( !angle.IsZero() )
|
||||
rect = rect.GetBoundingBoxRotated( GetTextPos(), GetTextAngle() );
|
||||
|
||||
return rect;
|
||||
|
@ -236,9 +380,31 @@ void PCB_TEXT::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
|
|||
|
||||
wxString PCB_TEXT::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
|
||||
{
|
||||
return wxString::Format( _( "PCB Text '%s' on %s"),
|
||||
KIUI::EllipsizeMenuText( GetShownText() ),
|
||||
GetLayerName() );
|
||||
if( FOOTPRINT* parentFP = GetParentFootprint() )
|
||||
{
|
||||
switch( m_type )
|
||||
{
|
||||
case TEXT_is_REFERENCE:
|
||||
return wxString::Format( _( "Reference '%s'" ),
|
||||
parentFP->GetReference() );
|
||||
|
||||
case TEXT_is_VALUE:
|
||||
return wxString::Format( _( "Value '%s' of %s" ),
|
||||
GetShownText(),
|
||||
parentFP->GetReference() );
|
||||
|
||||
case TEXT_is_DIVERS:
|
||||
return wxString::Format( _( "Footprint Text '%s' of %s" ),
|
||||
KIUI::EllipsizeMenuText( GetShownText() ),
|
||||
parentFP->GetReference() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return wxString::Format( _( "PCB Text '%s' on %s"),
|
||||
KIUI::EllipsizeMenuText( GetShownText() ),
|
||||
GetLayerName() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
class LINE_READER;
|
||||
class MSG_PANEL_ITEM;
|
||||
class FOOTPRINT;
|
||||
|
||||
|
||||
class PCB_TEXT : public BOARD_ITEM, public EDA_TEXT
|
||||
|
@ -38,6 +39,21 @@ class PCB_TEXT : public BOARD_ITEM, public EDA_TEXT
|
|||
public:
|
||||
PCB_TEXT( BOARD_ITEM* parent, KICAD_T idtype = PCB_TEXT_T );
|
||||
|
||||
/**
|
||||
* Footprint text type: there must be only one (and only one) for each of the reference
|
||||
* value texts in one footprint; others could be added for the user (DIVERS is French for
|
||||
* 'others'). Reference and value always live on silkscreen (on the footprint side); other
|
||||
* texts are planned to go on whatever layer the user wants.
|
||||
*/
|
||||
enum TEXT_TYPE
|
||||
{
|
||||
TEXT_is_REFERENCE = 0,
|
||||
TEXT_is_VALUE = 1,
|
||||
TEXT_is_DIVERS = 2
|
||||
};
|
||||
|
||||
PCB_TEXT( FOOTPRINT* aParent, TEXT_TYPE text_type );
|
||||
|
||||
// Do not create a copy constructor & operator=.
|
||||
// The ones generated by the compiler are adequate.
|
||||
|
||||
|
@ -62,11 +78,15 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when rotating the parent footprint.
|
||||
*/
|
||||
void KeepUpright( const EDA_ANGLE& aOldOrientation, const EDA_ANGLE& aNewOrientation );
|
||||
|
||||
wxString GetShownText( int aDepth = 0, bool aAllowExtraText = true ) const override;
|
||||
|
||||
/// PCB_TEXTs are always visible:
|
||||
void SetVisible( bool aVisible ) override { /* do nothing */}
|
||||
bool IsVisible() const override { return true; }
|
||||
void SetType( TEXT_TYPE aType ) { m_type = aType; }
|
||||
TEXT_TYPE GetType() const { return m_type; }
|
||||
|
||||
bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override
|
||||
{
|
||||
|
@ -138,6 +158,16 @@ public:
|
|||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
/**
|
||||
* @return the text rotation for drawings and plotting the footprint rotation is taken
|
||||
* in account.
|
||||
*/
|
||||
EDA_ANGLE GetDrawRotation() const override;
|
||||
|
||||
const BOX2I ViewBBox() const override;
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
|
||||
///< @copydoc VIEW_ITEM::ViewGetLOD
|
||||
double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
|
||||
|
@ -154,6 +184,9 @@ protected:
|
|||
virtual void swapData( BOARD_ITEM* aImage ) override;
|
||||
|
||||
int getKnockoutMargin() const;
|
||||
|
||||
private:
|
||||
TEXT_TYPE m_type;
|
||||
};
|
||||
|
||||
#endif // #define PCB_TEXT_H
|
||||
|
|
|
@ -485,22 +485,43 @@ void PCB_TEXTBOX::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID
|
|||
// Don't use PCB_SHAPE::TransformShapeToPolygon. We want to treat the textbox as filled even
|
||||
// if there's no background colour.
|
||||
|
||||
std::vector<VECTOR2I> pts = GetRectCorners();
|
||||
|
||||
aBuffer.NewOutline();
|
||||
|
||||
for( const VECTOR2I& pt : pts )
|
||||
aBuffer.Append( pt );
|
||||
|
||||
int width = GetWidth() + ( 2 * aClearance );
|
||||
|
||||
if( width > 0 )
|
||||
if( GetShape() == SHAPE_T::RECT )
|
||||
{
|
||||
// Add in segments
|
||||
TransformOvalToPolygon( aBuffer, pts[0], pts[1], width, aError, aErrorLoc );
|
||||
TransformOvalToPolygon( aBuffer, pts[1], pts[2], width, aError, aErrorLoc );
|
||||
TransformOvalToPolygon( aBuffer, pts[2], pts[3], width, aError, aErrorLoc );
|
||||
TransformOvalToPolygon( aBuffer, pts[3], pts[0], width, aError, aErrorLoc );
|
||||
std::vector<VECTOR2I> pts = GetRectCorners();
|
||||
|
||||
aBuffer.NewOutline();
|
||||
|
||||
for( const VECTOR2I& pt : pts )
|
||||
aBuffer.Append( pt );
|
||||
|
||||
if( width > 0 )
|
||||
{
|
||||
// Add in segments
|
||||
TransformOvalToPolygon( aBuffer, pts[0], pts[1], width, aError, aErrorLoc );
|
||||
TransformOvalToPolygon( aBuffer, pts[1], pts[2], width, aError, aErrorLoc );
|
||||
TransformOvalToPolygon( aBuffer, pts[2], pts[3], width, aError, aErrorLoc );
|
||||
TransformOvalToPolygon( aBuffer, pts[3], pts[0], width, aError, aErrorLoc );
|
||||
}
|
||||
}
|
||||
else if( GetShape() == SHAPE_T::POLY ) // Non-cardinally-rotated rect
|
||||
{
|
||||
aBuffer.NewOutline();
|
||||
|
||||
const SHAPE_LINE_CHAIN& poly = m_poly.Outline( 0 );
|
||||
|
||||
for( int ii = 0; ii < poly.PointCount(); ++ii )
|
||||
aBuffer.Append( poly.GetPoint( ii ) );
|
||||
|
||||
if( width > 0 )
|
||||
{
|
||||
for( int ii = 0; ii < poly.SegmentCount(); ++ii )
|
||||
{
|
||||
const SEG& seg = poly.GetSegment( ii );
|
||||
TransformOvalToPolygon( aBuffer, seg.A, seg.B, width, aError, aErrorLoc );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,9 +37,7 @@ class PAD;
|
|||
class PCB_SHAPE;
|
||||
class PCB_DIMENSION_BASE;
|
||||
class FOOTPRINT;
|
||||
class FP_SHAPE;
|
||||
class PCB_TARGET;
|
||||
class FP_TEXT;
|
||||
class ZONE;
|
||||
class BOARD;
|
||||
class BOARD_ITEM;
|
||||
|
@ -80,8 +78,7 @@ public:
|
|||
// Basic functions to plot a board item
|
||||
void SetLayerSet( LSET aLayerMask ) { m_layerMask = aLayerMask; }
|
||||
void PlotFootprintGraphicItems( const FOOTPRINT* aFootprint );
|
||||
void PlotFootprintShape( const FP_SHAPE* aShape );
|
||||
void PlotFootprintTextItem( const FP_TEXT* aText, const COLOR4D& aColor );
|
||||
void PlotFootprintTextItem( const PCB_TEXT* aText, const COLOR4D& aColor );
|
||||
|
||||
/*
|
||||
* Reference, Value, and other fields are plotted only if the corresponding option is enabled.
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include <footprint.h>
|
||||
#include <pcb_track.h>
|
||||
#include <pcb_text.h>
|
||||
#include <fp_shape.h>
|
||||
#include <pad.h>
|
||||
#include <zone.h>
|
||||
#include <pcb_shape.h>
|
||||
|
@ -825,7 +824,7 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
|
|||
SHAPE_POLY_SET initialPolys;
|
||||
|
||||
auto plotFPTextItem =
|
||||
[&]( const FP_TEXT& aText )
|
||||
[&]( const PCB_TEXT& aText )
|
||||
{
|
||||
if( !aText.IsVisible() && !itemplotter.GetPlotInvisibleText() )
|
||||
return;
|
||||
|
@ -865,9 +864,9 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
|
|||
{
|
||||
if( item->IsOnLayer( layer ) )
|
||||
{
|
||||
if( item->Type() == PCB_FP_TEXT_T )
|
||||
if( item->Type() == PCB_TEXT_T )
|
||||
{
|
||||
plotFPTextItem( static_cast<const FP_TEXT&>( *item ) );
|
||||
plotFPTextItem( static_cast<const PCB_TEXT&>( *item ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -882,7 +881,8 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
|
|||
}
|
||||
else if( item->IsOnLayer( Edge_Cuts ) )
|
||||
{
|
||||
itemplotter.PlotFootprintShape( static_cast<const FP_SHAPE*>( item ) );
|
||||
if( item->Type() == PCB_SHAPE_T )
|
||||
itemplotter.PlotPcbShape( static_cast<const PCB_SHAPE*>( item ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,10 +53,7 @@
|
|||
#include <board_item.h> // for BOARD_ITEM, S_CIRCLE
|
||||
#include <pcb_dimension.h>
|
||||
#include <pcb_shape.h>
|
||||
#include <fp_shape.h>
|
||||
#include <footprint.h>
|
||||
#include <fp_text.h>
|
||||
#include <fp_textbox.h>
|
||||
#include <pcb_track.h>
|
||||
#include <pad.h>
|
||||
#include <pcb_target.h>
|
||||
|
@ -296,8 +293,8 @@ void BRDITEMS_PLOTTER::PlotPad( const PAD* aPad, const COLOR4D& aColor, OUTLINE_
|
|||
|
||||
void BRDITEMS_PLOTTER::PlotFootprintTextItems( const FOOTPRINT* aFootprint )
|
||||
{
|
||||
const FP_TEXT* textItem = &aFootprint->Reference();
|
||||
int textLayer = textItem->GetLayer();
|
||||
const PCB_TEXT* textItem = &aFootprint->Reference();
|
||||
int textLayer = textItem->GetLayer();
|
||||
|
||||
// Reference and value are specific items, not in graphic items list
|
||||
if( GetPlotReference() && m_layerMask[textLayer]
|
||||
|
@ -317,7 +314,7 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItems( const FOOTPRINT* aFootprint )
|
|||
|
||||
for( const BOARD_ITEM* item : aFootprint->GraphicalItems() )
|
||||
{
|
||||
textItem = dyn_cast<const FP_TEXT*>( item );
|
||||
textItem = dyn_cast<const PCB_TEXT*>( item );
|
||||
|
||||
if( !textItem )
|
||||
continue;
|
||||
|
@ -392,7 +389,7 @@ void BRDITEMS_PLOTTER::PlotBoardGraphicItems()
|
|||
}
|
||||
|
||||
|
||||
void BRDITEMS_PLOTTER::PlotFootprintTextItem( const FP_TEXT* aText, const COLOR4D& aColor )
|
||||
void BRDITEMS_PLOTTER::PlotFootprintTextItem( const PCB_TEXT* aText, const COLOR4D& aColor )
|
||||
{
|
||||
COLOR4D color = aColor;
|
||||
|
||||
|
@ -431,7 +428,7 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItem( const FP_TEXT* aText, const COLOR4
|
|||
gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_NONCONDUCTOR );
|
||||
|
||||
gbr_metadata.SetNetAttribType( GBR_NETLIST_METADATA::GBR_NETINFO_CMP );
|
||||
const FOOTPRINT* parent = static_cast<const FOOTPRINT*> ( aText->GetParent() );
|
||||
const FOOTPRINT* parent = aText->GetParentFootprint();
|
||||
gbr_metadata.SetCmpReference( parent->GetReference() );
|
||||
|
||||
m_plotter->SetCurrentLineWidth( thickness );
|
||||
|
@ -586,34 +583,34 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItems( const FOOTPRINT* aFootprint )
|
|||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_FP_SHAPE_T:
|
||||
case PCB_SHAPE_T:
|
||||
{
|
||||
const FP_SHAPE* shape = static_cast<const FP_SHAPE*>( item );
|
||||
const PCB_SHAPE* shape = static_cast<const PCB_SHAPE*>( item );
|
||||
|
||||
if( m_layerMask[ shape->GetLayer() ] )
|
||||
PlotFootprintShape( shape );
|
||||
PlotPcbShape( shape );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_FP_TEXTBOX_T:
|
||||
case PCB_TEXTBOX_T:
|
||||
{
|
||||
const FP_TEXTBOX* textbox = static_cast<const FP_TEXTBOX*>( item );
|
||||
const PCB_TEXTBOX* textbox = static_cast<const PCB_TEXTBOX*>( item );
|
||||
|
||||
if( m_layerMask[ textbox->GetLayer() ] )
|
||||
{
|
||||
PlotPcbText( textbox, textbox->GetLayer(), textbox->IsKnockout() );
|
||||
PlotFootprintShape( textbox );
|
||||
PlotPcbShape( textbox );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_FP_DIM_ALIGNED_T:
|
||||
case PCB_FP_DIM_CENTER_T:
|
||||
case PCB_FP_DIM_RADIAL_T:
|
||||
case PCB_FP_DIM_ORTHOGONAL_T:
|
||||
case PCB_FP_DIM_LEADER_T:
|
||||
case PCB_DIM_ALIGNED_T:
|
||||
case PCB_DIM_CENTER_T:
|
||||
case PCB_DIM_RADIAL_T:
|
||||
case PCB_DIM_ORTHOGONAL_T:
|
||||
case PCB_DIM_LEADER_T:
|
||||
{
|
||||
const PCB_DIMENSION_BASE* dimension = static_cast<const PCB_DIMENSION_BASE*>( item );
|
||||
|
||||
|
@ -623,7 +620,7 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItems( const FOOTPRINT* aFootprint )
|
|||
break;
|
||||
}
|
||||
|
||||
case PCB_FP_TEXT_T:
|
||||
case PCB_TEXT_T:
|
||||
// Plotted in PlotFootprintTextItem()
|
||||
break;
|
||||
|
||||
|
@ -634,195 +631,6 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItems( const FOOTPRINT* aFootprint )
|
|||
}
|
||||
|
||||
|
||||
void BRDITEMS_PLOTTER::PlotFootprintShape( const FP_SHAPE* aShape )
|
||||
{
|
||||
m_plotter->SetColor( getColor( aShape->GetLayer() ) );
|
||||
|
||||
bool sketch = GetPlotMode() == SKETCH;
|
||||
int thickness = aShape->GetWidth();
|
||||
|
||||
GBR_METADATA gbr_metadata;
|
||||
gbr_metadata.SetNetAttribType( GBR_NETLIST_METADATA::GBR_NETINFO_CMP );
|
||||
const FOOTPRINT* parent = static_cast<const FOOTPRINT*> ( aShape->GetParent() );
|
||||
gbr_metadata.SetCmpReference( parent->GetReference() );
|
||||
|
||||
bool isOnCopperLayer = ( m_layerMask & LSET::AllCuMask() ).any();
|
||||
|
||||
if( aShape->GetLayer() == Edge_Cuts ) // happens also when plotting copper layers
|
||||
{
|
||||
gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_EDGECUT );
|
||||
}
|
||||
else if( isOnCopperLayer ) // only for items not on Edge_Cuts.
|
||||
{
|
||||
gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_ETCHEDCMP );
|
||||
gbr_metadata.SetCopper( true );
|
||||
}
|
||||
|
||||
int radius; // Circle/arc radius.
|
||||
PLOT_DASH_TYPE lineStyle = aShape->GetStroke().GetPlotStyle();
|
||||
|
||||
if( lineStyle <= PLOT_DASH_TYPE::FIRST_TYPE )
|
||||
{
|
||||
switch( aShape->GetShape() )
|
||||
{
|
||||
case SHAPE_T::SEGMENT:
|
||||
m_plotter->ThickSegment( aShape->GetStart(), aShape->GetEnd(), thickness, GetPlotMode(),
|
||||
&gbr_metadata );
|
||||
break;
|
||||
|
||||
case SHAPE_T::RECT:
|
||||
{
|
||||
std::vector<VECTOR2I> pts = aShape->GetRectCorners();
|
||||
|
||||
if( sketch || thickness > 0 )
|
||||
{
|
||||
m_plotter->ThickSegment( pts[0], pts[1], thickness, GetPlotMode(), &gbr_metadata );
|
||||
m_plotter->ThickSegment( pts[1], pts[2], thickness, GetPlotMode(), &gbr_metadata );
|
||||
m_plotter->ThickSegment( pts[2], pts[3], thickness, GetPlotMode(), &gbr_metadata );
|
||||
m_plotter->ThickSegment( pts[3], pts[0], thickness, GetPlotMode(), &gbr_metadata );
|
||||
}
|
||||
|
||||
if( !sketch && aShape->IsFilled() )
|
||||
{
|
||||
SHAPE_LINE_CHAIN poly;
|
||||
|
||||
for( const VECTOR2I& pt : pts )
|
||||
poly.Append( pt );
|
||||
|
||||
m_plotter->PlotPoly( poly, FILL_T::FILLED_SHAPE, -1, &gbr_metadata );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SHAPE_T::CIRCLE:
|
||||
radius = KiROUND( GetLineLength( aShape->GetStart(), aShape->GetEnd() ) );
|
||||
|
||||
if( aShape->IsFilled() )
|
||||
{
|
||||
m_plotter->FilledCircle( aShape->GetStart(), radius * 2 + thickness, GetPlotMode(),
|
||||
&gbr_metadata );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_plotter->ThickCircle( aShape->GetStart(), radius * 2, thickness, GetPlotMode(),
|
||||
&gbr_metadata );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SHAPE_T::ARC:
|
||||
{
|
||||
radius = KiROUND( GetLineLength( aShape->GetCenter(), aShape->GetStart() ) );
|
||||
|
||||
// when startAngle == endAngle ThickArc() doesn't know whether it's 0 deg and 360 deg
|
||||
// but it is a circle
|
||||
if( std::abs( aShape->GetArcAngle().AsDegrees() ) == 360.0 )
|
||||
{
|
||||
m_plotter->ThickCircle( aShape->GetCenter(), radius * 2, thickness, GetPlotMode(),
|
||||
&gbr_metadata );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_plotter->ThickArc( *aShape, GetPlotMode(), &gbr_metadata );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SHAPE_T::POLY:
|
||||
if( aShape->IsPolyShapeValid() )
|
||||
{
|
||||
std::vector<VECTOR2I> cornerList;
|
||||
aShape->DupPolyPointsList( cornerList );
|
||||
|
||||
// We must compute board coordinates from m_PolyList which are relative to the parent
|
||||
// position at orientation 0
|
||||
const FOOTPRINT *parentFootprint = aShape->GetParentFootprint();
|
||||
|
||||
if( parentFootprint )
|
||||
{
|
||||
for( unsigned ii = 0; ii < cornerList.size(); ++ii )
|
||||
{
|
||||
RotatePoint( cornerList[ii], parentFootprint->GetOrientation() );
|
||||
cornerList[ii] += parentFootprint->GetPosition();
|
||||
}
|
||||
}
|
||||
|
||||
if( sketch )
|
||||
{
|
||||
for( size_t i = 1; i < cornerList.size(); i++ )
|
||||
{
|
||||
m_plotter->ThickSegment( cornerList[i - 1], cornerList[i], thickness,
|
||||
GetPlotMode(), &gbr_metadata );
|
||||
}
|
||||
|
||||
m_plotter->ThickSegment( cornerList.back(), cornerList.front(), thickness,
|
||||
GetPlotMode(), &gbr_metadata );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// This must be simplified and fractured to prevent overlapping polygons
|
||||
// from generating invalid Gerber files
|
||||
|
||||
SHAPE_LINE_CHAIN line( cornerList );
|
||||
SHAPE_POLY_SET tmpPoly;
|
||||
|
||||
line.SetClosed( true );
|
||||
tmpPoly.AddOutline( line );
|
||||
tmpPoly.Fracture( SHAPE_POLY_SET::PM_FAST );
|
||||
|
||||
for( int jj = 0; jj < tmpPoly.OutlineCount(); ++jj )
|
||||
{
|
||||
SHAPE_LINE_CHAIN& poly = tmpPoly.Outline( jj );
|
||||
FILL_T fill_mode = aShape->IsFilled() ? FILL_T::FILLED_SHAPE
|
||||
: FILL_T::NO_FILL;
|
||||
// Plot the current filled area
|
||||
// (as region for Gerber plotter to manage attributes)
|
||||
if( m_plotter->GetPlotterType() == PLOT_FORMAT::GERBER )
|
||||
{
|
||||
static_cast<GERBER_PLOTTER*>( m_plotter )->
|
||||
PlotPolyAsRegion( poly, fill_mode,
|
||||
thickness, &gbr_metadata );
|
||||
}
|
||||
else
|
||||
m_plotter->PlotPoly( poly, fill_mode,
|
||||
thickness, &gbr_metadata );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SHAPE_T::BEZIER:
|
||||
m_plotter->BezierCurve( aShape->GetStart(), aShape->GetBezierC1(),
|
||||
aShape->GetBezierC2(), aShape->GetEnd(), 0, thickness );
|
||||
break;
|
||||
|
||||
default:
|
||||
wxASSERT_MSG( false, wxT( "Unhandled FP_SHAPE shape" ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<SHAPE*> shapes = aShape->MakeEffectiveShapes( true );
|
||||
|
||||
for( SHAPE* shape : shapes )
|
||||
{
|
||||
STROKE_PARAMS::Stroke( shape, lineStyle, thickness, m_plotter->RenderSettings(),
|
||||
[&]( const VECTOR2I& a, const VECTOR2I& b )
|
||||
{
|
||||
m_plotter->ThickSegment( a, b, thickness, GetPlotMode(),
|
||||
&gbr_metadata );
|
||||
} );
|
||||
}
|
||||
|
||||
for( SHAPE* shape : shapes )
|
||||
delete shape;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#include <font/stroke_font.h>
|
||||
void BRDITEMS_PLOTTER::PlotPcbText( const EDA_TEXT* aText, PCB_LAYER_ID aLayer, bool aIsKnockout )
|
||||
{
|
||||
|
@ -990,16 +798,31 @@ void BRDITEMS_PLOTTER::PlotPcbShape( const PCB_SHAPE* aShape )
|
|||
|
||||
m_plotter->SetColor( getColor( aShape->GetLayer() ) );
|
||||
|
||||
GBR_METADATA gbr_metadata;
|
||||
const FOOTPRINT* parentFP = aShape->GetParentFootprint();
|
||||
GBR_METADATA gbr_metadata;
|
||||
|
||||
if( parentFP )
|
||||
gbr_metadata.SetCmpReference( parentFP->GetReference() );
|
||||
|
||||
if( aShape->GetLayer() == Edge_Cuts )
|
||||
{
|
||||
gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_EDGECUT );
|
||||
|
||||
if( IsCopperLayer( aShape->GetLayer() ) )
|
||||
// Graphic items (PCB_SHAPE, TEXT) having no net have the NonConductor attribute
|
||||
// Graphic items having a net have the Conductor attribute, but are not (yet?)
|
||||
// supported in Pcbnew
|
||||
gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_NONCONDUCTOR );
|
||||
}
|
||||
else if( IsCopperLayer( aShape->GetLayer() ) )
|
||||
{
|
||||
if( parentFP )
|
||||
{
|
||||
gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_ETCHEDCMP );
|
||||
gbr_metadata.SetCopper( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Graphic items (PCB_SHAPE, TEXT) having no net have the NonConductor attribute
|
||||
// Graphic items having a net have the Conductor attribute, but are not (yet?)
|
||||
// supported in Pcbnew
|
||||
gbr_metadata.SetApertureAttrib( GBR_APERTURE_METADATA::GBR_APERTURE_ATTRIB_NONCONDUCTOR );
|
||||
}
|
||||
}
|
||||
|
||||
if( lineStyle <= PLOT_DASH_TYPE::FIRST_TYPE )
|
||||
{
|
||||
|
@ -1086,7 +909,9 @@ void BRDITEMS_PLOTTER::PlotPcbShape( const PCB_SHAPE* aShape )
|
|||
PlotPolyAsRegion( poly, fill, thickness, &gbr_metadata );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_plotter->PlotPoly( poly, fill, thickness, &gbr_metadata );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1104,7 +929,8 @@ void BRDITEMS_PLOTTER::PlotPcbShape( const PCB_SHAPE* aShape )
|
|||
m_plotter->ThickSegment( pts[2], pts[3], thickness, GetPlotMode(), &gbr_metadata );
|
||||
m_plotter->ThickSegment( pts[3], pts[0], thickness, GetPlotMode(), &gbr_metadata );
|
||||
}
|
||||
else
|
||||
|
||||
if( !sketch )
|
||||
{
|
||||
SHAPE_LINE_CHAIN poly;
|
||||
|
||||
|
@ -1122,7 +948,9 @@ void BRDITEMS_PLOTTER::PlotPcbShape( const PCB_SHAPE* aShape )
|
|||
PlotPolyAsRegion( poly, fill_mode, thickness, &gbr_metadata );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_plotter->PlotPoly( poly, fill_mode, thickness, &gbr_metadata );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019 Thomas Pointhuber <thomas.pointhuber@gmx.at>
|
||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -22,11 +22,6 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file pcad_plugin.h
|
||||
* @brief Pcbnew PLUGIN for Altium *.PcbDoc format.
|
||||
*/
|
||||
|
||||
#ifndef ALTIUM_CIRCUIT_MAKER_PLUGIN_H_
|
||||
#define ALTIUM_CIRCUIT_MAKER_PLUGIN_H_
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019 Thomas Pointhuber <thomas.pointhuber@gmx.at>
|
||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -22,11 +22,6 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file pcad_plugin.h
|
||||
* @brief Pcbnew PLUGIN for Altium *.PcbDoc format.
|
||||
*/
|
||||
|
||||
#ifndef ALTIUM_CIRCUIT_STUDIO_PLUGIN_H_
|
||||
#define ALTIUM_CIRCUIT_STUDIO_PLUGIN_H_
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019 Thomas Pointhuber <thomas.pointhuber@gmx.at>
|
||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -22,11 +22,6 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file pcad_plugin.h
|
||||
* @brief Pcbnew #PLUGIN for Altium *.PcbDoc format.
|
||||
*/
|
||||
|
||||
#ifndef ALTIUM_DESIGNER_PLUGIN_H_
|
||||
#define ALTIUM_DESIGNER_PLUGIN_H_
|
||||
|
||||
|
|
|
@ -35,9 +35,6 @@
|
|||
#include <pcb_text.h>
|
||||
#include <pcb_track.h>
|
||||
#include <string_utils.h>
|
||||
|
||||
#include <fp_shape.h>
|
||||
#include <fp_text.h>
|
||||
#include <zone.h>
|
||||
|
||||
#include <board_stackup_manager/stackup_predefined_prms.h>
|
||||
|
@ -101,7 +98,7 @@ PCB_SHAPE* ALTIUM_PCB::HelperCreateAndAddShape( uint16_t aComponent )
|
|||
}
|
||||
|
||||
FOOTPRINT* footprint = m_components.at( aComponent );
|
||||
PCB_SHAPE* fpShape = new FP_SHAPE( footprint );
|
||||
PCB_SHAPE* fpShape = new PCB_SHAPE( footprint );
|
||||
|
||||
footprint->Add( fpShape, ADD_MODE::APPEND );
|
||||
return fpShape;
|
||||
|
@ -109,53 +106,6 @@ PCB_SHAPE* ALTIUM_PCB::HelperCreateAndAddShape( uint16_t aComponent )
|
|||
}
|
||||
|
||||
|
||||
void ALTIUM_PCB::HelperShapeSetLocalCoord( PCB_SHAPE* aShape, uint16_t aComponent )
|
||||
{
|
||||
if( aComponent != ALTIUM_COMPONENT_NONE )
|
||||
{
|
||||
FP_SHAPE* fpShape = dynamic_cast<FP_SHAPE*>( aShape );
|
||||
|
||||
if( fpShape )
|
||||
{
|
||||
fpShape->SetLocalCoord();
|
||||
|
||||
// TODO: SetLocalCoord() does not update the polygon shape!
|
||||
// This workaround converts the poly shape into the local coordinates
|
||||
SHAPE_POLY_SET& polyShape = fpShape->GetPolyShape();
|
||||
|
||||
if( !polyShape.IsEmpty() )
|
||||
{
|
||||
FOOTPRINT* fp = m_components.at( aComponent );
|
||||
|
||||
polyShape.Move( -fp->GetPosition() );
|
||||
polyShape.Rotate( fp->GetOrientation() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ALTIUM_PCB::HelperShapeSetLocalCoord( FP_SHAPE* aShape )
|
||||
{
|
||||
aShape->SetLocalCoord();
|
||||
|
||||
// TODO: SetLocalCoord() does not update the polygon shape!
|
||||
// This workaround converts the poly shape into the local coordinates
|
||||
SHAPE_POLY_SET& polyShape = aShape->GetPolyShape();
|
||||
|
||||
if( !polyShape.IsEmpty() )
|
||||
{
|
||||
FOOTPRINT* fp = dynamic_cast<FOOTPRINT*>( aShape->GetParent() );
|
||||
|
||||
if( fp )
|
||||
{
|
||||
polyShape.Move( -fp->GetPosition() );
|
||||
polyShape.Rotate( fp->GetOrientation() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void HelperShapeLineChainFromAltiumVertices( SHAPE_LINE_CHAIN& aLine,
|
||||
const std::vector<ALTIUM_VERTICE>& aVertices )
|
||||
{
|
||||
|
@ -1982,7 +1932,7 @@ void ALTIUM_PCB::ConvertShapeBasedRegions6ToFootprintItem( FOOTPRINT* aFoot
|
|||
return;
|
||||
}
|
||||
|
||||
FP_ZONE* zone = new FP_ZONE( aFootprint );
|
||||
ZONE* zone = new ZONE( aFootprint );
|
||||
aFootprint->Add( zone, ADD_MODE::APPEND );
|
||||
|
||||
zone->SetIsRuleArea( true );
|
||||
|
@ -2052,14 +2002,13 @@ void ALTIUM_PCB::ConvertShapeBasedRegions6ToFootprintItemOnLayer( FOOTPRINT*
|
|||
return;
|
||||
}
|
||||
|
||||
FP_SHAPE* shape = new FP_SHAPE( aFootprint, SHAPE_T::POLY );
|
||||
PCB_SHAPE* shape = new PCB_SHAPE( aFootprint, SHAPE_T::POLY );
|
||||
|
||||
shape->SetPolyShape( linechain );
|
||||
shape->SetFilled( true );
|
||||
shape->SetLayer( aLayer );
|
||||
shape->SetStroke( STROKE_PARAMS( 0 ) );
|
||||
|
||||
HelperShapeSetLocalCoord( shape );
|
||||
aFootprint->Add( shape, ADD_MODE::APPEND );
|
||||
}
|
||||
|
||||
|
@ -2283,13 +2232,12 @@ void ALTIUM_PCB::ConvertArcs6ToFootprintItem( FOOTPRINT* aFootprint, const AARC6
|
|||
|
||||
if( width > 1 )
|
||||
{
|
||||
FP_SHAPE* arc = new FP_SHAPE( aFootprint );
|
||||
PCB_SHAPE* arc = new PCB_SHAPE( aFootprint );
|
||||
|
||||
ConvertArcs6ToPcbShape( aElem, arc );
|
||||
arc->SetStroke( STROKE_PARAMS( width, PLOT_DASH_TYPE::SOLID ) );
|
||||
arc->SetLayer( layerExpansionMask.first );
|
||||
|
||||
arc->SetLocalCoord();
|
||||
aFootprint->Add( arc, ADD_MODE::APPEND );
|
||||
}
|
||||
}
|
||||
|
@ -2339,13 +2287,12 @@ void ALTIUM_PCB::ConvertArcs6ToBoardItemOnLayer( const AARC6& aElem, PCB_LAYER_I
|
|||
void ALTIUM_PCB::ConvertArcs6ToFootprintItemOnLayer( FOOTPRINT* aFootprint, const AARC6& aElem,
|
||||
PCB_LAYER_ID aLayer )
|
||||
{
|
||||
FP_SHAPE* arc = new FP_SHAPE( aFootprint );
|
||||
PCB_SHAPE* arc = new PCB_SHAPE( aFootprint );
|
||||
|
||||
ConvertArcs6ToPcbShape( aElem, arc );
|
||||
arc->SetStroke( STROKE_PARAMS( aElem.width, PLOT_DASH_TYPE::SOLID ) );
|
||||
arc->SetLayer( aLayer );
|
||||
|
||||
arc->SetLocalCoord();
|
||||
aFootprint->Add( arc, ADD_MODE::APPEND );
|
||||
}
|
||||
|
||||
|
@ -2638,11 +2585,10 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnNonCopper( FOOTPRINT* aFootprint,
|
|||
klayer = Eco1_User;
|
||||
}
|
||||
|
||||
FP_SHAPE* pad = new FP_SHAPE( aFootprint );
|
||||
PCB_SHAPE* pad = new PCB_SHAPE( aFootprint );
|
||||
|
||||
HelperParsePad6NonCopper( aElem, klayer, pad );
|
||||
|
||||
HelperShapeSetLocalCoord( pad );
|
||||
aFootprint->Add( pad, ADD_MODE::APPEND );
|
||||
}
|
||||
|
||||
|
@ -2984,14 +2930,13 @@ void ALTIUM_PCB::ConvertTracks6ToFootprintItem( FOOTPRINT* aFootprint, const ATR
|
|||
int width = aElem.width + ( layerExpansionMask.second * 2 );
|
||||
if( width > 1 )
|
||||
{
|
||||
FP_SHAPE* seg = new FP_SHAPE( aFootprint, SHAPE_T::SEGMENT );
|
||||
PCB_SHAPE* seg = new PCB_SHAPE( aFootprint, SHAPE_T::SEGMENT );
|
||||
|
||||
seg->SetStart( aElem.start );
|
||||
seg->SetEnd( aElem.end );
|
||||
seg->SetStroke( STROKE_PARAMS( width, PLOT_DASH_TYPE::SOLID ) );
|
||||
seg->SetLayer( layerExpansionMask.first );
|
||||
|
||||
seg->SetLocalCoord();
|
||||
aFootprint->Add( seg, ADD_MODE::APPEND );
|
||||
}
|
||||
}
|
||||
|
@ -3029,14 +2974,13 @@ void ALTIUM_PCB::ConvertTracks6ToBoardItemOnLayer( const ATRACK6& aElem, PCB_LAY
|
|||
void ALTIUM_PCB::ConvertTracks6ToFootprintItemOnLayer( FOOTPRINT* aFootprint, const ATRACK6& aElem,
|
||||
PCB_LAYER_ID aLayer )
|
||||
{
|
||||
FP_SHAPE* seg = new FP_SHAPE( aFootprint, SHAPE_T::SEGMENT );
|
||||
PCB_SHAPE* seg = new PCB_SHAPE( aFootprint, SHAPE_T::SEGMENT );
|
||||
|
||||
seg->SetStart( aElem.start );
|
||||
seg->SetEnd( aElem.end );
|
||||
seg->SetStroke( STROKE_PARAMS( aElem.width, PLOT_DASH_TYPE::SOLID ) );
|
||||
seg->SetLayer( aLayer );
|
||||
|
||||
seg->SetLocalCoord();
|
||||
aFootprint->Add( seg, ADD_MODE::APPEND );
|
||||
}
|
||||
|
||||
|
@ -3136,7 +3080,8 @@ void ALTIUM_PCB::ConvertTexts6ToBoardItemOnLayer( const ATEXT6& aElem, PCB_LAYER
|
|||
void ALTIUM_PCB::ConvertTexts6ToFootprintItemOnLayer( FOOTPRINT* aFootprint, const ATEXT6& aElem,
|
||||
PCB_LAYER_ID aLayer )
|
||||
{
|
||||
FP_TEXT* fpText;
|
||||
PCB_TEXT* fpText;
|
||||
|
||||
if( aElem.isDesignator )
|
||||
{
|
||||
fpText = &aFootprint->Reference(); // TODO: handle multiple layers
|
||||
|
@ -3147,7 +3092,7 @@ void ALTIUM_PCB::ConvertTexts6ToFootprintItemOnLayer( FOOTPRINT* aFootprint, con
|
|||
}
|
||||
else
|
||||
{
|
||||
fpText = new FP_TEXT( aFootprint );
|
||||
fpText = new PCB_TEXT( aFootprint, PCB_TEXT::TEXT_is_DIVERS );
|
||||
aFootprint->Add( fpText, ADD_MODE::APPEND );
|
||||
}
|
||||
|
||||
|
@ -3166,12 +3111,10 @@ void ALTIUM_PCB::ConvertTexts6ToFootprintItemOnLayer( FOOTPRINT* aFootprint, con
|
|||
|
||||
fpText->SetKeepUpright( false );
|
||||
fpText->SetLayer( aLayer );
|
||||
fpText->SetPosition( aElem.position );
|
||||
fpText->SetTextAngle( EDA_ANGLE( aElem.rotation, DEGREES_T ) - aFootprint->GetOrientation() );
|
||||
fpText->SetFPRelativePosition( aElem.position );
|
||||
fpText->SetTextAngle( EDA_ANGLE( aElem.rotation, DEGREES_T ) );
|
||||
|
||||
ConvertTexts6ToEdaTextSettings( aElem, fpText );
|
||||
|
||||
fpText->SetLocalCoord();
|
||||
}
|
||||
|
||||
|
||||
|
@ -3395,7 +3338,7 @@ void ALTIUM_PCB::ConvertFills6ToBoardItemOnLayer( const AFILL6& aElem, PCB_LAYER
|
|||
void ALTIUM_PCB::ConvertFills6ToFootprintItemOnLayer( FOOTPRINT* aFootprint, const AFILL6& aElem,
|
||||
PCB_LAYER_ID aLayer )
|
||||
{
|
||||
FP_SHAPE* fill = new FP_SHAPE( aFootprint, SHAPE_T::RECT );
|
||||
PCB_SHAPE* fill = new PCB_SHAPE( aFootprint, SHAPE_T::RECT );
|
||||
|
||||
fill->SetFilled( true );
|
||||
fill->SetLayer( aLayer );
|
||||
|
@ -3411,7 +3354,6 @@ void ALTIUM_PCB::ConvertFills6ToFootprintItemOnLayer( FOOTPRINT* aFootprint, con
|
|||
fill->Rotate( center, EDA_ANGLE( aElem.rotation, DEGREES_T ) );
|
||||
}
|
||||
|
||||
fill->SetLocalCoord();
|
||||
aFootprint->Add( fill, ADD_MODE::APPEND );
|
||||
}
|
||||
|
||||
|
@ -3475,7 +3417,7 @@ void ALTIUM_PCB::HelperPcpShapeAsFootprintKeepoutRegion( FOOTPRINT* aFoo
|
|||
const ALTIUM_LAYER aAltiumLayer,
|
||||
const uint8_t aKeepoutRestrictions )
|
||||
{
|
||||
FP_ZONE* zone = new FP_ZONE( aFootprint );
|
||||
ZONE* zone = new ZONE( aFootprint );
|
||||
|
||||
zone->SetIsRuleArea( true );
|
||||
|
||||
|
|
|
@ -234,8 +234,6 @@ private:
|
|||
|
||||
FOOTPRINT* HelperGetFootprint( uint16_t aComponent ) const;
|
||||
PCB_SHAPE* HelperCreateAndAddShape( uint16_t aComponent );
|
||||
void HelperShapeSetLocalCoord( PCB_SHAPE* aShape, uint16_t aComponent );
|
||||
void HelperShapeSetLocalCoord( FP_SHAPE* aShape );
|
||||
|
||||
BOARD* m_board;
|
||||
std::vector<FOOTPRINT*> m_components;
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include <board_design_settings.h>
|
||||
#include <pcb_dimension.h>
|
||||
#include <pcb_shape.h>
|
||||
#include <fp_shape.h>
|
||||
#include <footprint.h>
|
||||
#include <pad.h>
|
||||
#include <pcb_group.h>
|
||||
|
@ -2781,12 +2780,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::drawCadstarShape( const SHAPE& aCadstarShape,
|
|||
break;
|
||||
}
|
||||
|
||||
PCB_SHAPE* shape;
|
||||
|
||||
if( isFootprint( aContainer ) )
|
||||
shape = new FP_SHAPE( (FOOTPRINT*) aContainer, SHAPE_T::POLY );
|
||||
else
|
||||
shape = new PCB_SHAPE( aContainer, SHAPE_T::POLY );
|
||||
PCB_SHAPE* shape = new PCB_SHAPE( aContainer, SHAPE_T::POLY );
|
||||
|
||||
shape->SetFilled( true );
|
||||
|
||||
|
@ -2919,11 +2913,7 @@ PCB_SHAPE* CADSTAR_PCB_ARCHIVE_LOADER::getShapeFromVertex( const POINT& aCadstar
|
|||
{
|
||||
|
||||
case VERTEX_TYPE::POINT:
|
||||
|
||||
if( isFootprint( aContainer ) )
|
||||
shape = new FP_SHAPE( static_cast<FOOTPRINT*>( aContainer ), SHAPE_T::SEGMENT );
|
||||
else
|
||||
shape = new PCB_SHAPE( aContainer, SHAPE_T::SEGMENT );
|
||||
shape = new PCB_SHAPE( aContainer, SHAPE_T::SEGMENT );
|
||||
|
||||
shape->SetStart( startPoint );
|
||||
shape->SetEnd( endPoint );
|
||||
|
@ -2937,10 +2927,7 @@ PCB_SHAPE* CADSTAR_PCB_ARCHIVE_LOADER::getShapeFromVertex( const POINT& aCadstar
|
|||
case VERTEX_TYPE::ANTICLOCKWISE_SEMICIRCLE:
|
||||
case VERTEX_TYPE::ANTICLOCKWISE_ARC:
|
||||
{
|
||||
if( isFootprint( aContainer ) )
|
||||
shape = new FP_SHAPE((FOOTPRINT*) aContainer, SHAPE_T::ARC );
|
||||
else
|
||||
shape = new PCB_SHAPE( aContainer, SHAPE_T::ARC );
|
||||
shape = new PCB_SHAPE( aContainer, SHAPE_T::ARC );
|
||||
|
||||
shape->SetCenter( centerPoint );
|
||||
shape->SetStart( startPoint );
|
||||
|
@ -2977,9 +2964,6 @@ PCB_SHAPE* CADSTAR_PCB_ARCHIVE_LOADER::getShapeFromVertex( const POINT& aCadstar
|
|||
if( aMoveVector != VECTOR2I{ 0, 0 } )
|
||||
shape->Move( aMoveVector );
|
||||
|
||||
if( isFootprint( aContainer ) && shape != nullptr )
|
||||
static_cast<FP_SHAPE*>( shape )->SetLocalCoord();
|
||||
|
||||
if( !aCadstarGroupID.IsEmpty() )
|
||||
addToGroup( aCadstarGroupID, shape );
|
||||
|
||||
|
@ -2991,7 +2975,7 @@ ZONE* CADSTAR_PCB_ARCHIVE_LOADER::getZoneFromCadstarShape( const SHAPE& aCadstar
|
|||
const int& aLineThickness,
|
||||
BOARD_ITEM_CONTAINER* aParentContainer )
|
||||
{
|
||||
ZONE* zone = new ZONE( aParentContainer, isFootprint( aParentContainer ) );
|
||||
ZONE* zone = new ZONE( aParentContainer );
|
||||
|
||||
if( aCadstarShape.Type == SHAPE_TYPE::HATCHED )
|
||||
{
|
||||
|
@ -3084,39 +3068,18 @@ SHAPE_LINE_CHAIN CADSTAR_PCB_ARCHIVE_LOADER::getLineChainFromShapes( const std::
|
|||
{
|
||||
case SHAPE_T::ARC:
|
||||
{
|
||||
if( shape->GetClass() == wxT( "MGRAPHIC" ) )
|
||||
{
|
||||
FP_SHAPE* fp_shape = (FP_SHAPE*) shape;
|
||||
SHAPE_ARC arc( fp_shape->GetCenter0(), fp_shape->GetStart0(), fp_shape->GetArcAngle() );
|
||||
SHAPE_ARC arc( shape->GetCenter(), shape->GetStart(), shape->GetArcAngle() );
|
||||
|
||||
if( shape->EndsSwapped() )
|
||||
arc.Reverse();
|
||||
if( shape->EndsSwapped() )
|
||||
arc.Reverse();
|
||||
|
||||
lineChain.Append( arc );
|
||||
}
|
||||
else
|
||||
{
|
||||
SHAPE_ARC arc( shape->GetCenter(), shape->GetStart(), shape->GetArcAngle() );
|
||||
|
||||
if( shape->EndsSwapped() )
|
||||
arc.Reverse();
|
||||
|
||||
lineChain.Append( arc );
|
||||
}
|
||||
lineChain.Append( arc );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case SHAPE_T::SEGMENT:
|
||||
if( shape->GetClass() == wxT( "MGRAPHIC" ) )
|
||||
{
|
||||
FP_SHAPE* fp_shape = (FP_SHAPE*) shape;
|
||||
lineChain.Append( fp_shape->GetStart0().x, fp_shape->GetStart0().y );
|
||||
lineChain.Append( fp_shape->GetEnd0().x, fp_shape->GetEnd0().y );
|
||||
}
|
||||
else
|
||||
{
|
||||
lineChain.Append( shape->GetStartX(), shape->GetStartY() );
|
||||
lineChain.Append( shape->GetEndX(), shape->GetEndY() );
|
||||
}
|
||||
lineChain.Append( shape->GetStartX(), shape->GetStartY() );
|
||||
lineChain.Append( shape->GetEndX(), shape->GetEndY() );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -3173,40 +3136,20 @@ std::vector<PCB_TRACK*> CADSTAR_PCB_ARCHIVE_LOADER::makeTracksFromShapes(
|
|||
switch( shape->GetShape() )
|
||||
{
|
||||
case SHAPE_T::ARC:
|
||||
if( shape->GetClass() == wxT( "MGRAPHIC" ) )
|
||||
{
|
||||
FP_SHAPE* fp_shape = (FP_SHAPE*) shape;
|
||||
SHAPE_ARC arc( fp_shape->GetStart0(), fp_shape->GetArcMid0(), fp_shape->GetEnd0(), 0 );
|
||||
{
|
||||
SHAPE_ARC arc( shape->GetStart(), shape->GetArcMid(), shape->GetEnd(), 0 );
|
||||
|
||||
if( fp_shape->EndsSwapped() )
|
||||
arc.Reverse();
|
||||
if( shape->EndsSwapped() )
|
||||
arc.Reverse();
|
||||
|
||||
track = new PCB_ARC( aParentContainer, &arc );
|
||||
}
|
||||
else
|
||||
{
|
||||
SHAPE_ARC arc( shape->GetStart(), shape->GetArcMid(), shape->GetEnd(), 0 );
|
||||
|
||||
if( shape->EndsSwapped() )
|
||||
arc.Reverse();
|
||||
|
||||
track = new PCB_ARC( aParentContainer, &arc );
|
||||
}
|
||||
track = new PCB_ARC( aParentContainer, &arc );
|
||||
break;
|
||||
}
|
||||
|
||||
case SHAPE_T::SEGMENT:
|
||||
if( shape->GetClass() == wxT( "MGRAPHIC" ) )
|
||||
{
|
||||
FP_SHAPE* fp_shape = (FP_SHAPE*) shape;
|
||||
track = new PCB_TRACK( aParentContainer );
|
||||
track->SetStart( fp_shape->GetStart0() );
|
||||
track->SetEnd( fp_shape->GetEnd0() );
|
||||
}
|
||||
else
|
||||
{
|
||||
track = new PCB_TRACK( aParentContainer );
|
||||
track->SetStart( shape->GetStart() );
|
||||
track->SetEnd( shape->GetEnd() );
|
||||
}
|
||||
track = new PCB_TRACK( aParentContainer );
|
||||
track->SetStart( shape->GetStart() );
|
||||
track->SetEnd( shape->GetEnd() );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -3286,7 +3229,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::addAttribute( const ATTRIBUTE_LOCATION& aCadsta
|
|||
FOOTPRINT* aFootprint,
|
||||
const wxString& aAttributeValue )
|
||||
{
|
||||
FP_TEXT* txt;
|
||||
PCB_TEXT* txt;
|
||||
|
||||
if( aCadstarAttributeID == COMPONENT_NAME_ATTRID )
|
||||
{
|
||||
|
@ -3302,7 +3245,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::addAttribute( const ATTRIBUTE_LOCATION& aCadsta
|
|||
}
|
||||
else
|
||||
{
|
||||
txt = new FP_TEXT( aFootprint );
|
||||
txt = new PCB_TEXT( aFootprint );
|
||||
aFootprint->Add( txt );
|
||||
txt->SetText( aAttributeValue );
|
||||
}
|
||||
|
@ -3323,21 +3266,17 @@ void CADSTAR_PCB_ARCHIVE_LOADER::addAttribute( const ATTRIBUTE_LOCATION& aCadsta
|
|||
}
|
||||
else
|
||||
{
|
||||
txt = new FP_TEXT( aFootprint );
|
||||
txt = new PCB_TEXT( aFootprint );
|
||||
aFootprint->Add( txt );
|
||||
txt->SetText( aAttributeValue );
|
||||
txt->SetVisible( false ); //make all user attributes invisible to avoid clutter.
|
||||
//TODO: Future improvement - allow user to decide what to do with attributes
|
||||
}
|
||||
|
||||
VECTOR2I rotatedTextPos = getKiCadPoint( aCadstarAttrLoc.Position ) - aFootprint->GetPosition();
|
||||
RotatePoint( rotatedTextPos, -aFootprint->GetOrientation() );
|
||||
|
||||
txt->SetTextPos( getKiCadPoint( aCadstarAttrLoc.Position ) );
|
||||
txt->SetPos0( rotatedTextPos );
|
||||
txt->SetPosition( getKiCadPoint( aCadstarAttrLoc.Position ) );
|
||||
txt->SetLayer( getKiCadLayer( aCadstarAttrLoc.LayerID ) );
|
||||
txt->SetMirrored( aCadstarAttrLoc.Mirror );
|
||||
txt->SetTextAngle( getAngle( aCadstarAttrLoc.OrientAngle ) - aFootprint->GetOrientation() );
|
||||
txt->SetTextAngle( getAngle( aCadstarAttrLoc.OrientAngle ) );
|
||||
|
||||
if( aCadstarAttrLoc.Mirror ) // If mirroring, invert angle to match CADSTAR
|
||||
txt->SetTextAngle( -txt->GetTextAngle() );
|
||||
|
|
|
@ -70,7 +70,7 @@ Load() TODO's
|
|||
#include <footprint.h>
|
||||
#include <pad.h>
|
||||
#include <pcb_track.h>
|
||||
#include <fp_shape.h>
|
||||
#include <pcb_shape.h>
|
||||
#include <zone.h>
|
||||
#include <pad_shapes.h>
|
||||
#include <pcb_text.h>
|
||||
|
@ -1393,10 +1393,6 @@ void EAGLE_PLUGIN::loadElements( wxXmlNode* aElements )
|
|||
|
||||
orientFootprintAndText( footprint, e, nameAttr, valueAttr );
|
||||
|
||||
// Set the local coordinates for the footprint text items
|
||||
footprint->Reference().SetLocalCoord();
|
||||
footprint->Value().SetLocalCoord();
|
||||
|
||||
// Get next element
|
||||
element = element->GetNext();
|
||||
}
|
||||
|
@ -1576,7 +1572,7 @@ void EAGLE_PLUGIN::orientFootprintAndText( FOOTPRINT* aFootprint, const EELEMENT
|
|||
}
|
||||
|
||||
|
||||
void EAGLE_PLUGIN::orientFPText( FOOTPRINT* aFootprint, const EELEMENT& e, FP_TEXT* aFPText,
|
||||
void EAGLE_PLUGIN::orientFPText( FOOTPRINT* aFootprint, const EELEMENT& e, PCB_TEXT* aFPText,
|
||||
const EATTR* aAttr )
|
||||
{
|
||||
// Smashed part ?
|
||||
|
@ -1624,7 +1620,6 @@ void EAGLE_PLUGIN::orientFPText( FOOTPRINT* aFootprint, const EELEMENT& e, FP_TE
|
|||
// package's text field. If they did not want zero, they specify
|
||||
// what they want explicitly.
|
||||
double degrees = a.rot ? a.rot->degrees : 0.0;
|
||||
double orient; // relative to parent
|
||||
|
||||
int sign = 1;
|
||||
bool spin = false;
|
||||
|
@ -1638,25 +1633,21 @@ void EAGLE_PLUGIN::orientFPText( FOOTPRINT* aFootprint, const EELEMENT& e, FP_TE
|
|||
|
||||
if( degrees == 90 || degrees == 0 || spin )
|
||||
{
|
||||
orient = degrees - aFootprint->GetOrientation().AsDegrees();
|
||||
aFPText->SetTextAngle( EDA_ANGLE( sign * orient, DEGREES_T ) );
|
||||
aFPText->SetTextAngle( EDA_ANGLE( sign * degrees, DEGREES_T ) );
|
||||
}
|
||||
else if( degrees == 180 )
|
||||
{
|
||||
orient = 0 - aFootprint->GetOrientation().AsDegrees();
|
||||
aFPText->SetTextAngle( EDA_ANGLE( sign * orient, DEGREES_T ) );
|
||||
aFPText->SetTextAngle( EDA_ANGLE( sign * 0, DEGREES_T ) );
|
||||
align = -align;
|
||||
}
|
||||
else if( degrees == 270 )
|
||||
{
|
||||
orient = 90 - aFootprint->GetOrientation().AsDegrees();
|
||||
align = -align;
|
||||
aFPText->SetTextAngle( EDA_ANGLE( sign * orient, DEGREES_T ) );
|
||||
aFPText->SetTextAngle( EDA_ANGLE( sign * 90, DEGREES_T ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
orient = 90 - degrees - aFootprint->GetOrientation().AsDegrees();
|
||||
aFPText->SetTextAngle( EDA_ANGLE( sign * orient, DEGREES_T ) );
|
||||
aFPText->SetTextAngle( EDA_ANGLE( sign * 90 - degrees, DEGREES_T ) );
|
||||
}
|
||||
|
||||
switch( align )
|
||||
|
@ -1820,28 +1811,29 @@ void EAGLE_PLUGIN::packageWire( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const
|
|||
}
|
||||
|
||||
// FIXME: the cap attribute is ignored because KiCad can't create lines with flat ends.
|
||||
FP_SHAPE* dwg;
|
||||
PCB_SHAPE* dwg;
|
||||
|
||||
if( !w.curve )
|
||||
{
|
||||
dwg = new FP_SHAPE( aFootprint, SHAPE_T::SEGMENT );
|
||||
dwg = new PCB_SHAPE( aFootprint, SHAPE_T::SEGMENT );
|
||||
|
||||
dwg->SetStart0( start );
|
||||
dwg->SetEnd0( end );
|
||||
dwg->SetStart( start );
|
||||
dwg->SetEnd( end );
|
||||
}
|
||||
else
|
||||
{
|
||||
dwg = new FP_SHAPE( aFootprint, SHAPE_T::ARC );
|
||||
dwg = new PCB_SHAPE( aFootprint, SHAPE_T::ARC );
|
||||
VECTOR2I center = ConvertArcCenter( start, end, *w.curve );
|
||||
|
||||
dwg->SetCenter0( center );
|
||||
dwg->SetStart0( start );
|
||||
dwg->SetArcAngleAndEnd0( -EDA_ANGLE( *w.curve, DEGREES_T ), true ); // KiCad rotates the other way
|
||||
dwg->SetCenter( center );
|
||||
dwg->SetStart( start );
|
||||
dwg->SetArcAngleAndEnd( -EDA_ANGLE( *w.curve, DEGREES_T ), true ); // KiCad rotates the other way
|
||||
}
|
||||
|
||||
dwg->SetLayer( layer );
|
||||
dwg->SetStroke( STROKE_PARAMS( width, PLOT_DASH_TYPE::SOLID ) );
|
||||
dwg->SetDrawCoord();
|
||||
dwg->Rotate( { 0, 0 }, aFootprint->GetOrientation() );
|
||||
dwg->Move( aFootprint->GetPosition() );
|
||||
|
||||
aFootprint->Add( dwg );
|
||||
}
|
||||
|
@ -1964,7 +1956,7 @@ void EAGLE_PLUGIN::packageText( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const
|
|||
return;
|
||||
}
|
||||
|
||||
FP_TEXT* textItem;
|
||||
PCB_TEXT* textItem;
|
||||
|
||||
if( t.text.Upper() == wxT( ">NAME" ) && aFootprint->GetReference().IsEmpty() )
|
||||
{
|
||||
|
@ -1980,8 +1972,7 @@ void EAGLE_PLUGIN::packageText( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const
|
|||
}
|
||||
else
|
||||
{
|
||||
// FIXME: graphical text items are rotated for some reason.
|
||||
textItem = new FP_TEXT( aFootprint );
|
||||
textItem = new PCB_TEXT( aFootprint, PCB_TEXT::TEXT_is_DIVERS );
|
||||
aFootprint->Add( textItem );
|
||||
|
||||
textItem->SetText( interpretText( t.text ) );
|
||||
|
@ -1989,9 +1980,7 @@ void EAGLE_PLUGIN::packageText( FOOTPRINT* aFootprint, wxXmlNode* aTree ) const
|
|||
|
||||
VECTOR2I pos( kicad_x( t.x ), kicad_y( t.y ) );
|
||||
|
||||
textItem->SetTextPos( pos );
|
||||
textItem->SetPos0( pos - aFootprint->GetPosition() );
|
||||
|
||||
textItem->SetPosition( pos );
|
||||
textItem->SetLayer( layer );
|
||||
|
||||
double ratio = t.ratio ? *t.ratio : 8; // DTD says 8 is default
|
||||
|
@ -2084,7 +2073,7 @@ void EAGLE_PLUGIN::packageRectangle( FOOTPRINT* aFootprint, wxXmlNode* aTree ) c
|
|||
if( r.layer == EAGLE_LAYER::TRESTRICT || r.layer == EAGLE_LAYER::BRESTRICT
|
||||
|| r.layer == EAGLE_LAYER::VRESTRICT )
|
||||
{
|
||||
FP_ZONE* zone = new FP_ZONE( aFootprint );
|
||||
ZONE* zone = new ZONE( aFootprint );
|
||||
aFootprint->Add( zone, ADD_MODE::APPEND );
|
||||
|
||||
setKeepoutSettingsToZone( zone, r.layer );
|
||||
|
@ -2117,7 +2106,7 @@ void EAGLE_PLUGIN::packageRectangle( FOOTPRINT* aFootprint, wxXmlNode* aTree ) c
|
|||
return;
|
||||
}
|
||||
|
||||
FP_SHAPE* dwg = new FP_SHAPE( aFootprint, SHAPE_T::POLY );
|
||||
PCB_SHAPE* dwg = new PCB_SHAPE( aFootprint, SHAPE_T::POLY );
|
||||
|
||||
aFootprint->Add( dwg );
|
||||
|
||||
|
@ -2139,6 +2128,9 @@ void EAGLE_PLUGIN::packageRectangle( FOOTPRINT* aFootprint, wxXmlNode* aTree ) c
|
|||
|
||||
if( r.rot )
|
||||
dwg->Rotate( dwg->GetCenter(), EDA_ANGLE( r.rot->degrees, DEGREES_T ) );
|
||||
|
||||
dwg->Rotate( { 0, 0 }, aFootprint->GetOrientation() );
|
||||
dwg->Move( aFootprint->GetPosition() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2209,7 +2201,7 @@ void EAGLE_PLUGIN::packagePolygon( FOOTPRINT* aFootprint, wxXmlNode* aTree ) con
|
|||
|| p.layer == EAGLE_LAYER::BRESTRICT
|
||||
|| p.layer == EAGLE_LAYER::VRESTRICT )
|
||||
{
|
||||
FP_ZONE* zone = new FP_ZONE( aFootprint );
|
||||
ZONE* zone = new ZONE( aFootprint );
|
||||
aFootprint->Add( zone, ADD_MODE::APPEND );
|
||||
|
||||
setKeepoutSettingsToZone( zone, p.layer );
|
||||
|
@ -2231,7 +2223,7 @@ void EAGLE_PLUGIN::packagePolygon( FOOTPRINT* aFootprint, wxXmlNode* aTree ) con
|
|||
return;
|
||||
}
|
||||
|
||||
FP_SHAPE* dwg = new FP_SHAPE( aFootprint, SHAPE_T::POLY );
|
||||
PCB_SHAPE* dwg = new PCB_SHAPE( aFootprint, SHAPE_T::POLY );
|
||||
|
||||
aFootprint->Add( dwg );
|
||||
|
||||
|
@ -2240,7 +2232,8 @@ void EAGLE_PLUGIN::packagePolygon( FOOTPRINT* aFootprint, wxXmlNode* aTree ) con
|
|||
dwg->SetLayer( layer );
|
||||
|
||||
dwg->SetPolyPoints( pts );
|
||||
dwg->SetDrawCoord();
|
||||
dwg->Rotate( { 0, 0 }, aFootprint->GetOrientation() );
|
||||
dwg->Move( aFootprint->GetPosition() );
|
||||
dwg->GetPolyShape().Inflate( p.width.ToPcbUnits() / 2, 32,
|
||||
SHAPE_POLY_SET::ALLOW_ACUTE_CORNERS );
|
||||
}
|
||||
|
@ -2258,7 +2251,7 @@ void EAGLE_PLUGIN::packageCircle( FOOTPRINT* aFootprint, wxXmlNode* aTree ) cons
|
|||
|| e.layer == EAGLE_LAYER::BRESTRICT
|
||||
|| e.layer == EAGLE_LAYER::VRESTRICT )
|
||||
{
|
||||
FP_ZONE* zone = new FP_ZONE( aFootprint );
|
||||
ZONE* zone = new ZONE( aFootprint );
|
||||
aFootprint->Add( zone, ADD_MODE::APPEND );
|
||||
|
||||
setKeepoutSettingsToZone( zone, e.layer );
|
||||
|
@ -2306,7 +2299,7 @@ void EAGLE_PLUGIN::packageCircle( FOOTPRINT* aFootprint, wxXmlNode* aTree ) cons
|
|||
return;
|
||||
}
|
||||
|
||||
FP_SHAPE* gr = new FP_SHAPE( aFootprint, SHAPE_T::CIRCLE );
|
||||
PCB_SHAPE* gr = new PCB_SHAPE( aFootprint, SHAPE_T::CIRCLE );
|
||||
|
||||
// width == 0 means filled circle
|
||||
if( width <= 0 )
|
||||
|
@ -2329,9 +2322,10 @@ void EAGLE_PLUGIN::packageCircle( FOOTPRINT* aFootprint, wxXmlNode* aTree ) cons
|
|||
}
|
||||
|
||||
gr->SetLayer( layer );
|
||||
gr->SetStart0( VECTOR2I( kicad_x( e.x ), kicad_y( e.y ) ) );
|
||||
gr->SetEnd0( VECTOR2I( kicad_x( e.x ) + radius, kicad_y( e.y ) ) );
|
||||
gr->SetDrawCoord();
|
||||
gr->SetStart( VECTOR2I( kicad_x( e.x ), kicad_y( e.y ) ) );
|
||||
gr->SetEnd( VECTOR2I( kicad_x( e.x ) + radius, kicad_y( e.y ) ) );
|
||||
gr->Rotate( { 0, 0 }, aFootprint->GetOrientation() );
|
||||
gr->Move( aFootprint->GetPosition() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include <wx/xml/xml.h>
|
||||
|
||||
class PAD;
|
||||
class FP_TEXT;
|
||||
class PCB_TEXT;
|
||||
class ZONE;
|
||||
|
||||
typedef std::map<wxString, FOOTPRINT*> FOOTPRINT_MAP;
|
||||
|
@ -278,7 +278,7 @@ private:
|
|||
void orientFootprintAndText( FOOTPRINT* aFootprint, const EELEMENT& e, const EATTR* aNameAttr,
|
||||
const EATTR* aValueAttr );
|
||||
|
||||
void orientFPText( FOOTPRINT* aFootprint, const EELEMENT& e, FP_TEXT* aFPText,
|
||||
void orientFPText( FOOTPRINT* aFootprint, const EELEMENT& e, PCB_TEXT* aFPText,
|
||||
const EATTR* aAttr );
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 BeagleBoard Foundation
|
||||
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.TXT for contributors.
|
||||
* Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -23,7 +23,6 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @file pcad_plugin.cpp
|
||||
* @brief Pcbnew PLUGIN for FABMASTER ASCII *.txt / *.fab format.
|
||||
*/
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 BeagleBoard Foundation
|
||||
* Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Author: Seth Hillbrand <hillbrand@kipro-pcb.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -42,7 +42,6 @@
|
|||
#include <board_design_settings.h>
|
||||
#include <board_item.h>
|
||||
#include <footprint.h>
|
||||
#include <fp_shape.h>
|
||||
#include <pad.h>
|
||||
#include <pad_shapes.h>
|
||||
#include <pcb_shape.h>
|
||||
|
@ -2022,7 +2021,7 @@ bool FABMASTER::loadFootprints( BOARD* aBoard )
|
|||
|
||||
if( lsrc->text == src->refdes )
|
||||
{
|
||||
FP_TEXT* txt = nullptr;
|
||||
PCB_TEXT* txt = nullptr;
|
||||
PCB_LAYER_ID layer = getLayer( ref->layer );
|
||||
|
||||
if( !IsPcbLayer( layer ) )
|
||||
|
@ -2034,7 +2033,7 @@ bool FABMASTER::loadFootprints( BOARD* aBoard )
|
|||
if( layer == F_SilkS || layer == B_SilkS )
|
||||
txt = &( fp->Reference() );
|
||||
else
|
||||
txt = new FP_TEXT( fp );
|
||||
txt = new PCB_TEXT( fp, PCB_TEXT::TEXT_is_DIVERS );
|
||||
|
||||
if( src->mirror )
|
||||
{
|
||||
|
@ -2053,7 +2052,6 @@ bool FABMASTER::loadFootprints( BOARD* aBoard )
|
|||
txt->SetTextHeight( lsrc->height );
|
||||
txt->SetTextWidth( lsrc->width );
|
||||
txt->SetHorizJustify( lsrc->orient );
|
||||
txt->SetLocalCoord();
|
||||
|
||||
if( txt != &fp->Reference() )
|
||||
fp->Add( txt, ADD_MODE::APPEND );
|
||||
|
@ -2092,7 +2090,7 @@ bool FABMASTER::loadFootprints( BOARD* aBoard )
|
|||
{
|
||||
const GRAPHIC_LINE* lsrc = static_cast<const GRAPHIC_LINE*>( seg.get() );
|
||||
|
||||
FP_SHAPE* line = new FP_SHAPE( fp, SHAPE_T::SEGMENT );
|
||||
PCB_SHAPE* line = new PCB_SHAPE( fp, SHAPE_T::SEGMENT );
|
||||
|
||||
if( src->mirror )
|
||||
{
|
||||
|
@ -2108,7 +2106,9 @@ bool FABMASTER::loadFootprints( BOARD* aBoard )
|
|||
}
|
||||
|
||||
line->SetStroke( STROKE_PARAMS( lsrc->width, PLOT_DASH_TYPE::SOLID ) );
|
||||
line->SetLocalCoord();
|
||||
|
||||
line->Rotate( { 0, 0 }, fp->GetOrientation() );
|
||||
line->Move( fp->GetPosition() );
|
||||
|
||||
if( lsrc->width == 0 )
|
||||
line->SetStroke( defaultStroke );
|
||||
|
@ -2120,13 +2120,15 @@ bool FABMASTER::loadFootprints( BOARD* aBoard )
|
|||
{
|
||||
const GRAPHIC_ARC* lsrc = static_cast<const GRAPHIC_ARC*>( seg.get() );
|
||||
|
||||
FP_SHAPE* circle = new FP_SHAPE( fp, SHAPE_T::CIRCLE );
|
||||
PCB_SHAPE* circle = new PCB_SHAPE( fp, SHAPE_T::CIRCLE );
|
||||
|
||||
circle->SetLayer( layer );
|
||||
circle->SetCenter( VECTOR2I( lsrc->center_x, lsrc->center_y ) );
|
||||
circle->SetEnd( VECTOR2I( lsrc->end_x, lsrc->end_y ) );
|
||||
circle->SetWidth( lsrc->width );
|
||||
circle->SetLocalCoord();
|
||||
|
||||
circle->Rotate( { 0, 0 }, fp->GetOrientation() );
|
||||
circle->Move( fp->GetPosition() );
|
||||
|
||||
if( lsrc->width == 0 )
|
||||
circle->SetWidth( ds.GetLineThickness( circle->GetLayer() ) );
|
||||
|
@ -2141,14 +2143,16 @@ bool FABMASTER::loadFootprints( BOARD* aBoard )
|
|||
{
|
||||
const GRAPHIC_ARC* lsrc = static_cast<const GRAPHIC_ARC*>( seg.get() );
|
||||
|
||||
FP_SHAPE* arc = new FP_SHAPE( fp, SHAPE_T::ARC );
|
||||
PCB_SHAPE* arc = new PCB_SHAPE( fp, SHAPE_T::ARC );
|
||||
|
||||
arc->SetLayer( layer );
|
||||
arc->SetArcGeometry( lsrc->result.GetP0(),
|
||||
lsrc->result.GetArcMid(),
|
||||
lsrc->result.GetP1() );
|
||||
arc->SetStroke( STROKE_PARAMS( lsrc->width, PLOT_DASH_TYPE::SOLID ) );
|
||||
arc->SetLocalCoord();
|
||||
|
||||
arc->Rotate( { 0, 0 }, fp->GetOrientation() );
|
||||
arc->Move( fp->GetPosition() );
|
||||
|
||||
if( lsrc->width == 0 )
|
||||
arc->SetStroke( defaultStroke );
|
||||
|
@ -2164,7 +2168,7 @@ bool FABMASTER::loadFootprints( BOARD* aBoard )
|
|||
const GRAPHIC_RECTANGLE *lsrc =
|
||||
static_cast<const GRAPHIC_RECTANGLE*>( seg.get() );
|
||||
|
||||
FP_SHAPE* rect = new FP_SHAPE( fp, SHAPE_T::RECT );
|
||||
PCB_SHAPE* rect = new PCB_SHAPE( fp, SHAPE_T::RECT );
|
||||
|
||||
if( src->mirror )
|
||||
{
|
||||
|
@ -2180,7 +2184,9 @@ bool FABMASTER::loadFootprints( BOARD* aBoard )
|
|||
}
|
||||
|
||||
rect->SetStroke( defaultStroke );
|
||||
rect->SetLocalCoord();
|
||||
|
||||
rect->Rotate( { 0, 0 }, fp->GetOrientation() );
|
||||
rect->Move( fp->GetPosition() );
|
||||
|
||||
fp->Add( rect, ADD_MODE::APPEND );
|
||||
break;
|
||||
|
@ -2190,7 +2196,7 @@ bool FABMASTER::loadFootprints( BOARD* aBoard )
|
|||
const GRAPHIC_TEXT *lsrc =
|
||||
static_cast<const GRAPHIC_TEXT*>( seg.get() );
|
||||
|
||||
FP_TEXT* txt = new FP_TEXT( fp );
|
||||
PCB_TEXT* txt = new PCB_TEXT( fp );
|
||||
|
||||
if( src->mirror )
|
||||
{
|
||||
|
@ -2209,7 +2215,6 @@ bool FABMASTER::loadFootprints( BOARD* aBoard )
|
|||
txt->SetTextHeight( lsrc->height );
|
||||
txt->SetTextWidth( lsrc->width );
|
||||
txt->SetHorizJustify( lsrc->orient );
|
||||
txt->SetLocalCoord();
|
||||
|
||||
// FABMASTER doesn't have visibility flags but layers that are not silk should be hidden
|
||||
// by default to prevent clutter.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -38,7 +38,6 @@
|
|||
#include <macros.h>
|
||||
#include <pcb_text.h>
|
||||
#include <pcb_shape.h>
|
||||
#include <fp_shape.h>
|
||||
#include <plugins/geda/gpcb_plugin.h>
|
||||
#include <wx_filename.h>
|
||||
|
||||
|
@ -413,8 +412,7 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
|
|||
textPos.x -= thsize / 10;
|
||||
textPos.y += thsize / 2;
|
||||
|
||||
footprint->Reference().SetTextPos( textPos );
|
||||
footprint->Reference().SetPos0( textPos );
|
||||
footprint->Reference().SetFPRelativePosition( textPos );
|
||||
footprint->Reference().SetTextSize( VECTOR2I( twsize, thsize ) );
|
||||
footprint->Reference().SetTextThickness( thickness );
|
||||
|
||||
|
@ -425,8 +423,7 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
|
|||
footprint->Value().SetTextSize( footprint->Reference().GetTextSize() );
|
||||
footprint->Value().SetTextThickness( footprint->Reference().GetTextThickness() );
|
||||
textPos.y += thsize * 13 / 10; // 130% line height
|
||||
footprint->Value().SetTextPos( textPos );
|
||||
footprint->Value().SetPos0( textPos );
|
||||
footprint->Value().SetFPRelativePosition( textPos );
|
||||
|
||||
while( aLineReader->ReadLine() )
|
||||
{
|
||||
|
@ -463,15 +460,18 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
|
|||
aLineReader->LineNumber(), 0 );
|
||||
}
|
||||
|
||||
FP_SHAPE* shape = new FP_SHAPE( footprint.get(), SHAPE_T::SEGMENT );
|
||||
PCB_SHAPE* shape = new PCB_SHAPE( footprint.get(), SHAPE_T::SEGMENT );
|
||||
shape->SetLayer( F_SilkS );
|
||||
shape->SetStart0( VECTOR2I( parseInt( parameters[2], conv_unit ),
|
||||
parseInt( parameters[3], conv_unit ) ) );
|
||||
shape->SetEnd0( VECTOR2I( parseInt( parameters[4], conv_unit ),
|
||||
parseInt( parameters[5], conv_unit ) ) );
|
||||
shape->SetStart( VECTOR2I( parseInt( parameters[2], conv_unit ),
|
||||
parseInt( parameters[3], conv_unit ) ) );
|
||||
shape->SetEnd( VECTOR2I( parseInt( parameters[4], conv_unit ),
|
||||
parseInt( parameters[5], conv_unit ) ) );
|
||||
shape->SetStroke( STROKE_PARAMS( parseInt( parameters[6], conv_unit ),
|
||||
PLOT_DASH_TYPE::SOLID ) );
|
||||
shape->SetDrawCoord();
|
||||
|
||||
shape->Rotate( { 0, 0 }, footprint->GetOrientation() );
|
||||
shape->Move( footprint->GetPosition() );
|
||||
|
||||
footprint->Add( shape );
|
||||
continue;
|
||||
}
|
||||
|
@ -487,18 +487,18 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
|
|||
}
|
||||
|
||||
// Pcbnew does know ellipse so we must have Width = Height
|
||||
FP_SHAPE* shape = new FP_SHAPE( footprint.get(), SHAPE_T::ARC );
|
||||
PCB_SHAPE* shape = new PCB_SHAPE( footprint.get(), SHAPE_T::ARC );
|
||||
shape->SetLayer( F_SilkS );
|
||||
footprint->Add( shape );
|
||||
|
||||
// for and arc: ibuf[3] = ibuf[4]. Pcbnew does not know ellipses
|
||||
int radius = ( parseInt( parameters[4], conv_unit ) +
|
||||
parseInt( parameters[5], conv_unit ) ) / 2;
|
||||
int radius = ( parseInt( parameters[4], conv_unit ) +
|
||||
parseInt( parameters[5], conv_unit ) ) / 2;
|
||||
|
||||
VECTOR2I centre( parseInt( parameters[2], conv_unit ),
|
||||
parseInt( parameters[3], conv_unit ) );
|
||||
|
||||
shape->SetCenter0( centre );
|
||||
shape->SetCenter( centre );
|
||||
|
||||
// Pcbnew start angles are inverted and 180 degrees from Geda PCB angles.
|
||||
EDA_ANGLE start_angle( (int) parseInt( parameters[6], -10.0 ), TENTHS_OF_A_DEGREE_T );
|
||||
|
@ -514,14 +514,16 @@ FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
|
|||
// Calculate start point coordinate of arc
|
||||
VECTOR2I arcStart( radius, 0 );
|
||||
RotatePoint( arcStart, -start_angle );
|
||||
shape->SetStart0( arcStart + centre );
|
||||
shape->SetStart( arcStart + centre );
|
||||
|
||||
// Angle value is clockwise in gpcb and Pcbnew.
|
||||
shape->SetArcAngleAndEnd0( sweep_angle );
|
||||
shape->SetArcAngleAndEnd( sweep_angle );
|
||||
|
||||
shape->SetStroke( STROKE_PARAMS( parseInt( parameters[8], conv_unit ),
|
||||
PLOT_DASH_TYPE::SOLID ) );
|
||||
shape->SetDrawCoord();
|
||||
|
||||
shape->Rotate( { 0, 0 }, footprint->GetOrientation() );
|
||||
shape->Move( footprint->GetPosition() );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue