mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-19 18:51:40 +00:00
Collapse FP_* down into their PCB_* equivalents.
This commit is contained in:
parent
7695d510d6
commit
bbd6c80507
3d-viewer/3d_canvas
common
eeschema
include
pcbnew
array_creator.cppboard.cppboard_commit.cppboard_item.cppcollectors.cppcollectors.h
connectivity
convert_shape_list_to_polygon.cppcross-probing.cppdialogs
dialog_dimension_properties.cppdialog_find.cppdialog_footprint_properties.cppdialog_footprint_properties_fp_editor.cppdialog_global_edit_text_and_graphics.cppdialog_graphic_item_properties.cppdialog_text_properties.cppdialog_text_properties.hdialog_textbox_properties.cppdialog_textbox_properties.hpanel_setup_formatting.cpp
drc
drc_cache_generator.cppdrc_engine.cppdrc_rtree.hdrc_test_provider.cppdrc_test_provider_copper_clearance.cppdrc_test_provider_edge_clearance.cppdrc_test_provider_library_parity.cppdrc_test_provider_misc.cppdrc_test_provider_physical_clearance.cppdrc_test_provider_silk_clearance.cppdrc_test_provider_solder_mask.cppdrc_test_provider_text_dims.cpp
edit.cppexporters
footprint.cppfootprint.hfootprint_edit_frame.cppfootprint_editor_utils.cppfootprint_libraries_utils.cppfootprint_preview_panel.cppfp_shape.cppfp_shape.hfp_text.cppfp_text.hfp_text_grid_table.cppfp_text_grid_table.hfp_textbox.cppfp_textbox.hgraphics_cleaner.cppimport_gfx
kicad_clipboard.cppmicrowave
pad.cpppad.hpcb_base_edit_frame.hpcb_base_frame.cpppcb_dimension.cpppcb_dimension.hpcb_edit_frame.cpppcb_expr_functions.cpppcb_group.cpppcb_item_containers.hpcb_painter.cpppcb_painter.hpcb_shape.cpppcb_shape.hpcb_text.cpppcb_text.hpcb_textbox.cpppcbplot.hplot_board_layers.cppplot_brditems_plotter.cppplugins
altium
altium_circuit_maker_plugin.haltium_circuit_studio_plugin.haltium_designer_plugin.haltium_pcb.cppaltium_pcb.h
cadstar
eagle
fabmaster
geda
kicad
legacy
pcad
CMakeLists.txtpcad_arc.cpppcad_arc.hpcad_footprint.cpppcad_footprint.hpcad_item_types.hpcad_line.cpppcad_line.hpcad_pad.cpppcad_pad.hpcad_pad_shape.cpppcad_pad_shape.hpcad_pcb.cpppcad_pcb.hpcad_pcb_component.cpppcad_pcb_component.hpcad_plugin.cpppcad_polygon.cpppcad_polygon.hpcad_text.cpppcad_text.hpcad_via.cpppcad_via.hpcad_via_shape.cpppcad_via_shape.hpcb_copper_pour.cpppcb_copper_pour.hpcb_cutout.cpppcb_cutout.hpcb_keepout.cpppcb_keepout.hpcb_plane.cpppcb_plane.h
python/swig
router
specctra_import_export
tools
board_inspection_tool.cppconvert_tool.cppdrawing_stackup_table_tool.cppdrawing_tool.cppedit_tool.cppedit_tool_move_fct.cppgroup_tool.cpppad_tool.cpppad_tool.hpcb_control.cpppcb_grid_helper.cpppcb_point_editor.cpppcb_selection_tool.cpppcb_viewer_tools.cppzone_create_helper.cppzone_filler_tool.cpp
widgets
zone.cppzone.hzone_filler.cppqa
pcbnew_utils
unittests
common
pcbnew
@ -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() ) )
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user