From 16b0147af85ab66b557a9a688de5f65c35b53434 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 11 Jun 2021 17:59:28 +0100 Subject: [PATCH] Prefix DIMENSION types. --- 3d-viewer/3d_canvas/board_adapter.h | 7 +- .../3d_canvas/create_3Dgraphic_brd_items.cpp | 2 +- 3d-viewer/3d_canvas/create_layer_items.cpp | 4 +- common/CMakeLists.txt | 2 +- include/core/typeinfo.h | 10 +- pcbnew/CMakeLists.txt | 4 +- pcbnew/board_design_settings.cpp | 2 +- ...board_items_to_polygon_shape_transform.cpp | 12 +- pcbnew/collectors.cpp | 24 +-- .../dialogs/dialog_dimension_properties.cpp | 12 +- pcbnew/dialogs/dialog_dimension_properties.h | 8 +- .../dialog_global_edit_text_and_graphics.cpp | 10 +- .../drc_test_provider_copper_clearance.cpp | 2 +- pcbnew/edit.cpp | 6 +- pcbnew/pcb_base_edit_frame.cpp | 4 +- pcbnew/{dimension.cpp => pcb_dimension.cpp} | 155 +++++++++--------- pcbnew/{dimension.h => pcb_dimension.h} | 36 ++-- pcbnew/pcb_edit_frame.h | 4 +- pcbnew/pcb_painter.cpp | 6 +- pcbnew/pcb_painter.h | 4 +- pcbnew/pcbplot.h | 4 +- pcbnew/plot_board_layers.cpp | 2 +- pcbnew/plot_brditems_plotter.cpp | 6 +- pcbnew/plugins/altium/altium_pcb.cpp | 6 +- .../cadstar/cadstar_pcb_archive_loader.cpp | 20 +-- .../cadstar/cadstar_pcb_archive_loader.h | 4 +- pcbnew/plugins/eagle/eagle_plugin.cpp | 4 +- pcbnew/plugins/kicad/kicad_plugin.cpp | 14 +- pcbnew/plugins/kicad/kicad_plugin.h | 4 +- pcbnew/plugins/kicad/pcb_parser.cpp | 28 ++-- pcbnew/plugins/kicad/pcb_parser.h | 34 ++-- pcbnew/plugins/legacy/legacy_plugin.cpp | 4 +- pcbnew/plugins/legacy/legacy_plugin.h | 2 +- pcbnew/python/swig/board.i | 4 +- pcbnew/python/swig/board_item.i | 44 ++--- pcbnew/python/swig/dimension.i | 6 - pcbnew/python/swig/pcb_dimension.i | 6 + .../swig/{marker_pcb.i => pcb_marker.i} | 0 pcbnew/tools/drawing_tool.cpp | 32 ++-- pcbnew/tools/drawing_tool.h | 2 +- pcbnew/tools/pcb_control.cpp | 4 +- pcbnew/tools/pcb_grid_helper.cpp | 8 +- pcbnew/tools/pcb_point_editor.cpp | 28 ++-- pcbnew/undo_redo.cpp | 2 +- 44 files changed, 291 insertions(+), 291 deletions(-) rename pcbnew/{dimension.cpp => pcb_dimension.cpp} (86%) rename pcbnew/{dimension.h => pcb_dimension.h} (95%) delete mode 100644 pcbnew/python/swig/dimension.i create mode 100644 pcbnew/python/swig/pcb_dimension.i rename pcbnew/python/swig/{marker_pcb.i => pcb_marker.i} (100%) diff --git a/3d-viewer/3d_canvas/board_adapter.h b/3d-viewer/3d_canvas/board_adapter.h index 659e12bdb5..b19e3cf459 100644 --- a/3d-viewer/3d_canvas/board_adapter.h +++ b/3d-viewer/3d_canvas/board_adapter.h @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include #include #include @@ -586,8 +586,9 @@ private: void addShapeWithClearance( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aDstContainer, PCB_LAYER_ID aLayerId, int aClearanceValue ); - void addShapeWithClearance( const DIMENSION_BASE* aDimension, CONTAINER_2D_BASE* aDstContainer, - PCB_LAYER_ID aLayerId, int aClearanceValue ); + void addShapeWithClearance( const PCB_DIMENSION_BASE* aDimension, + CONTAINER_2D_BASE* aDstContainer, PCB_LAYER_ID aLayerId, + int aClearanceValue ); void addSolidAreasShapes( const ZONE* aZoneContainer, CONTAINER_2D_BASE* aDstContainer, PCB_LAYER_ID aLayerId ); diff --git a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp index 2bce123ca5..9cfee75a0c 100644 --- a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp +++ b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp @@ -110,7 +110,7 @@ void BOARD_ADAPTER::addShapeWithClearance( const PCB_TEXT* aText, CONTAINER_2D_B } -void BOARD_ADAPTER::addShapeWithClearance( const DIMENSION_BASE* aDimension, +void BOARD_ADAPTER::addShapeWithClearance( const PCB_DIMENSION_BASE* aDimension, CONTAINER_2D_BASE* aDstContainer, PCB_LAYER_ID aLayerId, int aClearanceValue ) { diff --git a/3d-viewer/3d_canvas/create_layer_items.cpp b/3d-viewer/3d_canvas/create_layer_items.cpp index 3749935a96..d0daf14ab8 100644 --- a/3d-viewer/3d_canvas/create_layer_items.cpp +++ b/3d-viewer/3d_canvas/create_layer_items.cpp @@ -625,7 +625,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) case PCB_DIM_CENTER_T: case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_LEADER_T: - addShapeWithClearance( static_cast( item ), + addShapeWithClearance( static_cast( item ), layerContainer, curr_layer_id, 0 ); break; @@ -919,7 +919,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) case PCB_DIM_CENTER_T: case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_LEADER_T: - addShapeWithClearance( static_cast( item ), layerContainer, + addShapeWithClearance( static_cast( item ), layerContainer, curr_layer_id, 0 ); break; diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index c26101d77c..7743b60ac8 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -516,7 +516,7 @@ set( PCB_COMMON_SRCS ${CMAKE_SOURCE_DIR}/pcbnew/board_items_to_polygon_shape_transform.cpp ${CMAKE_SOURCE_DIR}/pcbnew/board.cpp ${CMAKE_SOURCE_DIR}/pcbnew/board_item.cpp - ${CMAKE_SOURCE_DIR}/pcbnew/dimension.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 diff --git a/include/core/typeinfo.h b/include/core/typeinfo.h index 3de78c8569..b5f2bfee14 100644 --- a/include/core/typeinfo.h +++ b/include/core/typeinfo.h @@ -96,11 +96,11 @@ enum KICAD_T PCB_VIA_T, ///< class VIA, a via (like a track segment on a copper layer) PCB_ARC_T, ///< class ARC, an arc track segment on a copper layer PCB_MARKER_T, ///< class MARKER_PCB, a marker used to show something - PCB_DIMENSION_T, ///< class DIMENSION_BASE: abstract dimension meta-type - PCB_DIM_ALIGNED_T, ///< class ALIGNED_DIMENSION, a linear dimension (graphic item) - PCB_DIM_LEADER_T, ///< class LEADER, a leader dimension (graphic item) - PCB_DIM_CENTER_T, ///< class CENTER_DIMENSION, a center point marking (graphic item) - PCB_DIM_ORTHOGONAL_T, ///< class ORTHOGONAL_DIMENSION, a linear dimension constrained to x/y + PCB_DIMENSION_T, ///< class PCB_DIMENSION_BASE: abstract dimension meta-type + PCB_DIM_ALIGNED_T, ///< class PCB_DIM_ALIGNED, a linear dimension (graphic item) + PCB_DIM_LEADER_T, ///< class PCB_DIM_LEADER, a leader dimension (graphic item) + PCB_DIM_CENTER_T, ///< class PCB_DIM_CENTER, a center point marking (graphic item) + PCB_DIM_ORTHOGONAL_T, ///< class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y PCB_TARGET_T, ///< class PCB_TARGET, a target (graphic item) PCB_ZONE_T, ///< class ZONE, a copper pour area PCB_ITEM_LIST_T, ///< class BOARD_ITEM_LIST, a list of board items diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 545f1e592b..cb84acdfe5 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -452,10 +452,10 @@ add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/pcbnew_wrap.cxx DEPENDS python/swig/board_item.i DEPENDS python/swig/board_item_container.i DEPENDS python/swig/connectivity.i - DEPENDS python/swig/dimension.i + DEPENDS python/swig/pcb_dimension.i DEPENDS python/swig/pcb_shape.i DEPENDS python/swig/fp_shape.i - DEPENDS python/swig/marker_pcb.i + DEPENDS python/swig/pcb_marker.i DEPENDS python/swig/pcb_target.i DEPENDS python/swig/pcb_plot_params.i DEPENDS python/swig/footprint.i diff --git a/pcbnew/board_design_settings.cpp b/pcbnew/board_design_settings.cpp index e04cc746d9..f8b19588db 100644 --- a/pcbnew/board_design_settings.cpp +++ b/pcbnew/board_design_settings.cpp @@ -21,7 +21,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include #include #include #include diff --git a/pcbnew/board_items_to_polygon_shape_transform.cpp b/pcbnew/board_items_to_polygon_shape_transform.cpp index 0a665e466a..22dff403a1 100644 --- a/pcbnew/board_items_to_polygon_shape_transform.cpp +++ b/pcbnew/board_items_to_polygon_shape_transform.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include @@ -774,10 +774,10 @@ void ZONE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, } -void DIMENSION_BASE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, - PCB_LAYER_ID aLayer, int aClearance, - int aError, ERROR_LOC aErrorLoc, - bool aIgnoreLineWidth ) const +void PCB_DIMENSION_BASE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, + PCB_LAYER_ID aLayer, int aClearance, + int aError, ERROR_LOC aErrorLoc, + bool aIgnoreLineWidth ) const { wxASSERT_MSG( !aIgnoreLineWidth, "IgnoreLineWidth has no meaning for dimensions." ); @@ -800,7 +800,7 @@ void DIMENSION_BASE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCorn } else { - wxFAIL_MSG( "DIMENSION::TransformShapeWithClearanceToPolygon unexpected shape type." ); + wxFAIL_MSG( "PCB_DIMENSION_BASE::TransformShapeWithClearanceToPolygon unexpected shape type." ); } } } diff --git a/pcbnew/collectors.cpp b/pcbnew/collectors.cpp index 134099a54e..68a91a656b 100644 --- a/pcbnew/collectors.cpp +++ b/pcbnew/collectors.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include @@ -156,16 +156,16 @@ const KICAD_T GENERAL_COLLECTOR::DraggableItems[] = { SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) { - BOARD_ITEM* item = (BOARD_ITEM*) testItem; - FOOTPRINT* footprint = nullptr; - PCB_GROUP* group = nullptr; - PAD* pad = nullptr; - bool pad_through = false; - VIA* via = nullptr; - PCB_MARKER* marker = nullptr; - ZONE* zone = nullptr; - PCB_SHAPE* shape = nullptr; - DIMENSION_BASE* dimension = nullptr; + BOARD_ITEM* item = (BOARD_ITEM*) testItem; + FOOTPRINT* footprint = nullptr; + PCB_GROUP* group = nullptr; + PAD* pad = nullptr; + bool pad_through = false; + VIA* via = nullptr; + PCB_MARKER* marker = nullptr; + ZONE* zone = nullptr; + PCB_SHAPE* shape = nullptr; + PCB_DIMENSION_BASE* dimension = nullptr; #if 0 // debugging static int breakhere = 0; @@ -288,7 +288,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) case PCB_DIM_CENTER_T: case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_LEADER_T: - dimension = static_cast( item ); + dimension = static_cast( item ); break; case PCB_TARGET_T: diff --git a/pcbnew/dialogs/dialog_dimension_properties.cpp b/pcbnew/dialogs/dialog_dimension_properties.cpp index 1002882414..43055fe6eb 100644 --- a/pcbnew/dialogs/dialog_dimension_properties.cpp +++ b/pcbnew/dialogs/dialog_dimension_properties.cpp @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include #include @@ -47,8 +47,8 @@ DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES( PCB_BASE_EDIT_FRAME* a m_extensionOffset( aParent, m_lblExtensionOffset, m_txtExtensionOffset, m_lblExtensionOffsetUnits ) { wxASSERT( BaseType( aItem->Type() ) == PCB_DIMENSION_T ); - m_dimension = static_cast( aItem ); - m_previewDimension = static_cast( m_dimension->Clone() ); + m_dimension = static_cast( aItem ); + m_previewDimension = static_cast( m_dimension->Clone() ); m_previewDimension->SetParent( m_frame->GetBoard() ); switch( m_dimension->Type() ) @@ -247,7 +247,7 @@ bool DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow() if( m_dimension->Type() == PCB_DIM_LEADER_T ) { - LEADER* leader = static_cast( m_dimension ); + PCB_DIM_LEADER* leader = static_cast( m_dimension ); m_cbTextFrame->SetSelection( static_cast( leader->GetTextFrame() ) ); } @@ -283,7 +283,7 @@ bool DIALOG_DIMENSION_PROPERTIES::TransferDataFromWindow() } -void DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog( DIMENSION_BASE* aTarget ) +void DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog( PCB_DIMENSION_BASE* aTarget ) { BOARD* board = m_frame->GetBoard(); @@ -353,7 +353,7 @@ void DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog( DIMENSION_BASE* aTa if( aTarget->Type() == PCB_DIM_LEADER_T ) { - LEADER* leader = static_cast( aTarget ); + PCB_DIM_LEADER* leader = static_cast( aTarget ); leader->SetTextFrame( static_cast( m_cbTextFrame->GetSelection() ) ); } diff --git a/pcbnew/dialogs/dialog_dimension_properties.h b/pcbnew/dialogs/dialog_dimension_properties.h index 8aae0a3162..c13d412492 100644 --- a/pcbnew/dialogs/dialog_dimension_properties.h +++ b/pcbnew/dialogs/dialog_dimension_properties.h @@ -28,7 +28,7 @@ class BOARD_ITEM; -class DIMENSION_BASE; +class PCB_DIMENSION_BASE; class PCB_BASE_EDIT_FRAME; @@ -48,8 +48,8 @@ private: PCB_BASE_EDIT_FRAME* m_frame; - DIMENSION_BASE* m_dimension; - DIMENSION_BASE* m_previewDimension; + PCB_DIMENSION_BASE* m_dimension; + PCB_DIMENSION_BASE* m_previewDimension; PCB_LAYER_BOX_SELECTOR* m_cbLayerActual; // The active layer box control wxTextCtrl* m_txtValueActual; // The active value control @@ -67,7 +67,7 @@ private: UNIT_BINDER m_arrowLength; UNIT_BINDER m_extensionOffset; - void updateDimensionFromDialog( DIMENSION_BASE* aTarget ); + void updateDimensionFromDialog( PCB_DIMENSION_BASE* aTarget ); void updatePreviewText(); }; diff --git a/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp b/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp index c9908c6d98..134b7eafde 100644 --- a/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp +++ b/pcbnew/dialogs/dialog_global_edit_text_and_graphics.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include @@ -287,10 +287,10 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( BOARD_COMMIT& aCommit, B { aCommit.Modify( aItem ); - EDA_TEXT* textItem = dynamic_cast( aItem ); - FP_TEXT* fpTextItem = dynamic_cast( aItem ); - PCB_SHAPE* drawItem = dynamic_cast( aItem ); - DIMENSION_BASE* dimension = dynamic_cast( aItem ); + EDA_TEXT* textItem = dynamic_cast( aItem ); + FP_TEXT* fpTextItem = dynamic_cast( aItem ); + PCB_SHAPE* drawItem = dynamic_cast( aItem ); + PCB_DIMENSION_BASE* dimension = dynamic_cast( aItem ); if( dimension ) textItem = &dimension->Text(); diff --git a/pcbnew/drc/drc_test_provider_copper_clearance.cpp b/pcbnew/drc/drc_test_provider_copper_clearance.cpp index dee6e4d1fb..b4c2650fbc 100644 --- a/pcbnew/drc/drc_test_provider_copper_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_copper_clearance.cpp @@ -40,7 +40,7 @@ #include #include #include -#include +#include /* Copper clearance test. Checks all copper items (pads, vias, tracks, drawings, zones) for their electrical clearance. diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index b4f04c8cca..7472c0e3bf 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include @@ -139,7 +139,7 @@ void PCB_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem ) case PCB_DIM_CENTER_T: case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_LEADER_T: - ShowDimensionPropertiesDialog( static_cast( aItem ) ); + ShowDimensionPropertiesDialog( static_cast( aItem ) ); break; case PCB_FP_TEXT_T: @@ -164,7 +164,7 @@ void PCB_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem ) } -void PCB_EDIT_FRAME::ShowDimensionPropertiesDialog( DIMENSION_BASE* aDimension ) +void PCB_EDIT_FRAME::ShowDimensionPropertiesDialog( PCB_DIMENSION_BASE* aDimension ) { if( aDimension == nullptr ) return; diff --git a/pcbnew/pcb_base_edit_frame.cpp b/pcbnew/pcb_base_edit_frame.cpp index 825fb63c87..fe6813a186 100644 --- a/pcbnew/pcb_base_edit_frame.cpp +++ b/pcbnew/pcb_base_edit_frame.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include @@ -187,7 +187,7 @@ void PCB_BASE_EDIT_FRAME::unitsChangeRefresh() INSPECTOR_FUNC inspector = [units, view]( EDA_ITEM* aItem, void* aTestData ) { - DIMENSION_BASE* dimension = static_cast( aItem ); + PCB_DIMENSION_BASE* dimension = static_cast( aItem ); if( dimension->GetUnitsMode() == DIM_UNITS_MODE::AUTOMATIC ) { diff --git a/pcbnew/dimension.cpp b/pcbnew/pcb_dimension.cpp similarity index 86% rename from pcbnew/dimension.cpp rename to pcbnew/pcb_dimension.cpp index 8e8a7dc719..49389d6024 100644 --- a/pcbnew/dimension.cpp +++ b/pcbnew/pcb_dimension.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include @@ -39,7 +39,7 @@ #include -DIMENSION_BASE::DIMENSION_BASE( BOARD_ITEM* aParent, KICAD_T aType ) : +PCB_DIMENSION_BASE::PCB_DIMENSION_BASE( BOARD_ITEM* aParent, KICAD_T aType ) : BOARD_ITEM( aParent, aType ), m_overrideTextEnabled( false ), m_units( EDA_UNITS::INCHES ), @@ -59,14 +59,14 @@ DIMENSION_BASE::DIMENSION_BASE( BOARD_ITEM* aParent, KICAD_T aType ) : } -void DIMENSION_BASE::SetParent( EDA_ITEM* aParent ) +void PCB_DIMENSION_BASE::SetParent( EDA_ITEM* aParent ) { BOARD_ITEM::SetParent( aParent ); m_text.SetParent( aParent ); } -void DIMENSION_BASE::updateText() +void PCB_DIMENSION_BASE::updateText() { wxString text = m_overrideTextEnabled ? m_valueString : GetValueText(); @@ -95,13 +95,13 @@ void DIMENSION_BASE::updateText() template -void DIMENSION_BASE::addShape( const ShapeType& aShape ) +void PCB_DIMENSION_BASE::addShape( const ShapeType& aShape ) { m_shapes.push_back( std::make_shared( aShape ) ); } -wxString DIMENSION_BASE::GetValueText() const +wxString PCB_DIMENSION_BASE::GetValueText() const { struct lconv* lc = localeconv(); wxChar sep = lc->decimal_point[0]; @@ -130,25 +130,25 @@ wxString DIMENSION_BASE::GetValueText() const } -void DIMENSION_BASE::SetPrefix( const wxString& aPrefix ) +void PCB_DIMENSION_BASE::SetPrefix( const wxString& aPrefix ) { m_prefix = aPrefix; } -void DIMENSION_BASE::SetSuffix( const wxString& aSuffix ) +void PCB_DIMENSION_BASE::SetSuffix( const wxString& aSuffix ) { m_suffix = aSuffix; } -void DIMENSION_BASE::SetUnits( EDA_UNITS aUnits ) +void PCB_DIMENSION_BASE::SetUnits( EDA_UNITS aUnits ) { m_units = aUnits; } -DIM_UNITS_MODE DIMENSION_BASE::GetUnitsMode() const +DIM_UNITS_MODE PCB_DIMENSION_BASE::GetUnitsMode() const { if( m_autoUnits ) { @@ -172,7 +172,7 @@ DIM_UNITS_MODE DIMENSION_BASE::GetUnitsMode() const } -void DIMENSION_BASE::SetUnitsMode( DIM_UNITS_MODE aMode ) +void PCB_DIMENSION_BASE::SetUnitsMode( DIM_UNITS_MODE aMode ) { m_autoUnits = false; @@ -197,27 +197,27 @@ void DIMENSION_BASE::SetUnitsMode( DIM_UNITS_MODE aMode ) } -void DIMENSION_BASE::SetText( const wxString& aNewText ) +void PCB_DIMENSION_BASE::SetText( const wxString& aNewText ) { m_valueString = aNewText; updateText(); } -const wxString DIMENSION_BASE::GetText() const +const wxString PCB_DIMENSION_BASE::GetText() const { return m_text.GetText(); } -void DIMENSION_BASE::SetLayer( PCB_LAYER_ID aLayer ) +void PCB_DIMENSION_BASE::SetLayer( PCB_LAYER_ID aLayer ) { m_layer = aLayer; m_text.SetLayer( aLayer ); } -void DIMENSION_BASE::Move( const wxPoint& offset ) +void PCB_DIMENSION_BASE::Move( const wxPoint& offset ) { m_text.Offset( offset ); @@ -228,7 +228,7 @@ void DIMENSION_BASE::Move( const wxPoint& offset ) } -void DIMENSION_BASE::Rotate( const wxPoint& aRotCentre, double aAngle ) +void PCB_DIMENSION_BASE::Rotate( const wxPoint& aRotCentre, double aAngle ) { double newAngle = m_text.GetTextAngle() + aAngle; @@ -248,7 +248,7 @@ void DIMENSION_BASE::Rotate( const wxPoint& aRotCentre, double aAngle ) } -void DIMENSION_BASE::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) +void PCB_DIMENSION_BASE::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) { Mirror( aCentre ); @@ -256,7 +256,7 @@ void DIMENSION_BASE::Flip( const wxPoint& aCentre, bool aFlipLeftRight ) } -void DIMENSION_BASE::Mirror( const wxPoint& axis_pos, bool aMirrorLeftRight ) +void PCB_DIMENSION_BASE::Mirror( const wxPoint& axis_pos, bool aMirrorLeftRight ) { int axis = aMirrorLeftRight ? axis_pos.x : axis_pos.y; wxPoint newPos = m_text.GetTextPos(); @@ -289,7 +289,7 @@ void DIMENSION_BASE::Mirror( const wxPoint& axis_pos, bool aMirrorLeftRight ) } -void DIMENSION_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) +void PCB_DIMENSION_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) { // for now, display only the text within the DIMENSION using class PCB_TEXT. wxString msg; @@ -352,7 +352,7 @@ void DIMENSION_BASE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector DIMENSION_BASE::GetEffectiveShape( PCB_LAYER_ID aLayer ) const +std::shared_ptr PCB_DIMENSION_BASE::GetEffectiveShape( PCB_LAYER_ID aLayer ) const { std::shared_ptr effectiveShape = std::make_shared(); @@ -365,7 +365,7 @@ std::shared_ptr DIMENSION_BASE::GetEffectiveShape( PCB_LAYER_ID aLayer ) } -bool DIMENSION_BASE::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool PCB_DIMENSION_BASE::HitTest( const wxPoint& aPosition, int aAccuracy ) const { if( m_text.TextHitTest( aPosition ) ) return true; @@ -384,7 +384,7 @@ bool DIMENSION_BASE::HitTest( const wxPoint& aPosition, int aAccuracy ) const } -bool DIMENSION_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const +bool PCB_DIMENSION_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const { EDA_RECT arect = aRect; arect.Inflate( aAccuracy ); @@ -401,7 +401,7 @@ bool DIMENSION_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccur } -const EDA_RECT DIMENSION_BASE::GetBoundingBox() const +const EDA_RECT PCB_DIMENSION_BASE::GetBoundingBox() const { EDA_RECT bBox; int xmin, xmax, ymin, ymax; @@ -434,7 +434,7 @@ const EDA_RECT DIMENSION_BASE::GetBoundingBox() const } -wxString DIMENSION_BASE::GetSelectMenuText( EDA_UNITS aUnits ) const +wxString PCB_DIMENSION_BASE::GetSelectMenuText( EDA_UNITS aUnits ) const { return wxString::Format( _( "Dimension '%s' on %s" ), GetText(), @@ -443,7 +443,7 @@ wxString DIMENSION_BASE::GetSelectMenuText( EDA_UNITS aUnits ) const -const BOX2I DIMENSION_BASE::ViewBBox() const +const BOX2I PCB_DIMENSION_BASE::ViewBBox() const { BOX2I dimBBox = BOX2I( VECTOR2I( GetBoundingBox().GetPosition() ), VECTOR2I( GetBoundingBox().GetSize() ) ); @@ -453,7 +453,8 @@ const BOX2I DIMENSION_BASE::ViewBBox() const } -OPT_VECTOR2I DIMENSION_BASE::segPolyIntersection( const SHAPE_POLY_SET& aPoly, const SEG& aSeg, bool aStart ) +OPT_VECTOR2I PCB_DIMENSION_BASE::segPolyIntersection( const SHAPE_POLY_SET& aPoly, const SEG& aSeg, + bool aStart ) { VECTOR2I start( aStart ? aSeg.A : aSeg.B ); VECTOR2I endpoint( aStart ? aSeg.B : aSeg.A ); @@ -477,7 +478,7 @@ OPT_VECTOR2I DIMENSION_BASE::segPolyIntersection( const SHAPE_POLY_SET& aPoly, c } -OPT_VECTOR2I DIMENSION_BASE::segCircleIntersection( CIRCLE& aCircle, SEG& aSeg, bool aStart ) +OPT_VECTOR2I PCB_DIMENSION_BASE::segCircleIntersection( CIRCLE& aCircle, SEG& aSeg, bool aStart ) { VECTOR2I start( aStart ? aSeg.A : aSeg.B ); VECTOR2I endpoint( aStart ? aSeg.B : aSeg.A ); @@ -501,8 +502,8 @@ OPT_VECTOR2I DIMENSION_BASE::segCircleIntersection( CIRCLE& aCircle, SEG& aSeg, } -ALIGNED_DIMENSION::ALIGNED_DIMENSION( BOARD_ITEM* aParent, KICAD_T aType ) : - DIMENSION_BASE( aParent, aType ), +PCB_DIM_ALIGNED::PCB_DIM_ALIGNED( BOARD_ITEM* aParent, KICAD_T aType ) : + PCB_DIMENSION_BASE( aParent, aType ), m_height( 0 ) { // To preserve look of old dimensions, initialize extension height based on default arrow length @@ -510,32 +511,31 @@ ALIGNED_DIMENSION::ALIGNED_DIMENSION( BOARD_ITEM* aParent, KICAD_T aType ) : } -EDA_ITEM* ALIGNED_DIMENSION::Clone() const +EDA_ITEM* PCB_DIM_ALIGNED::Clone() const { - return new ALIGNED_DIMENSION( *this ); + return new PCB_DIM_ALIGNED( *this ); } -void ALIGNED_DIMENSION::SwapData( BOARD_ITEM* aImage ) +void PCB_DIM_ALIGNED::SwapData( BOARD_ITEM* aImage ) { assert( aImage->Type() == PCB_DIM_ALIGNED_T ); m_shapes.clear(); - static_cast( aImage )->m_shapes.clear(); + static_cast( aImage )->m_shapes.clear(); - std::swap( *static_cast( this ), - *static_cast( aImage ) ); + std::swap( *static_cast( this ), *static_cast( aImage ) ); Update(); } -BITMAPS ALIGNED_DIMENSION::GetMenuImage() const +BITMAPS PCB_DIM_ALIGNED::GetMenuImage() const { return BITMAPS::add_aligned_dimension; } -void ALIGNED_DIMENSION::UpdateHeight( const wxPoint& aCrossbarStart, const wxPoint& aCrossbarEnd ) +void PCB_DIM_ALIGNED::UpdateHeight( const wxPoint& aCrossbarStart, const wxPoint& aCrossbarEnd ) { VECTOR2D height( aCrossbarStart - GetStart() ); VECTOR2D crossBar( aCrossbarEnd - aCrossbarStart ); @@ -549,7 +549,7 @@ void ALIGNED_DIMENSION::UpdateHeight( const wxPoint& aCrossbarStart, const wxPoi } -void ALIGNED_DIMENSION::updateGeometry() +void PCB_DIM_ALIGNED::updateGeometry() { m_shapes.clear(); @@ -637,7 +637,7 @@ void ALIGNED_DIMENSION::updateGeometry() } -void ALIGNED_DIMENSION::updateText() +void PCB_DIM_ALIGNED::updateText() { VECTOR2I crossbarCenter( ( m_crossBarEnd - m_crossBarStart ) / 2 ); @@ -673,21 +673,20 @@ void ALIGNED_DIMENSION::updateText() m_text.SetTextAngle( textAngle ); } - DIMENSION_BASE::updateText(); + PCB_DIMENSION_BASE::updateText(); } -void ALIGNED_DIMENSION::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, - std::vector& aList ) +void PCB_DIM_ALIGNED::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) { - DIMENSION_BASE::GetMsgPanelInfo( aFrame, aList ); + PCB_DIMENSION_BASE::GetMsgPanelInfo( aFrame, aList ); aList.emplace_back( _( "Height" ), MessageTextFromValue( aFrame->GetUserUnits(), m_height ) ); } -ORTHOGONAL_DIMENSION::ORTHOGONAL_DIMENSION( BOARD_ITEM* aParent ) : - ALIGNED_DIMENSION( aParent, 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( m_arrowLength * std::sin( DEG2RAD( s_arrowAngle ) ) ); @@ -695,33 +694,33 @@ ORTHOGONAL_DIMENSION::ORTHOGONAL_DIMENSION( BOARD_ITEM* aParent ) : } -EDA_ITEM* ORTHOGONAL_DIMENSION::Clone() const +EDA_ITEM* PCB_DIM_ORTHOGONAL::Clone() const { - return new ORTHOGONAL_DIMENSION( *this ); + return new PCB_DIM_ORTHOGONAL( *this ); } -void ORTHOGONAL_DIMENSION::SwapData( BOARD_ITEM* aImage ) +void PCB_DIM_ORTHOGONAL::SwapData( BOARD_ITEM* aImage ) { assert( aImage->Type() == PCB_DIM_ORTHOGONAL_T ); m_shapes.clear(); - static_cast( aImage )->m_shapes.clear(); + static_cast( aImage )->m_shapes.clear(); - std::swap( *static_cast( this ), - *static_cast( aImage ) ); + std::swap( *static_cast( this ), + *static_cast( aImage ) ); Update(); } -BITMAPS ORTHOGONAL_DIMENSION::GetMenuImage() const +BITMAPS PCB_DIM_ORTHOGONAL::GetMenuImage() const { return BITMAPS::add_orthogonal_dimension; } -void ORTHOGONAL_DIMENSION::updateGeometry() +void PCB_DIM_ORTHOGONAL::updateGeometry() { m_shapes.clear(); @@ -822,7 +821,7 @@ void ORTHOGONAL_DIMENSION::updateGeometry() } -void ORTHOGONAL_DIMENSION::updateText() +void PCB_DIM_ORTHOGONAL::updateText() { VECTOR2I crossbarCenter( ( m_crossBarEnd - m_crossBarStart ) / 2 ); @@ -856,11 +855,11 @@ void ORTHOGONAL_DIMENSION::updateText() m_text.SetTextAngle( textAngle ); } - DIMENSION_BASE::updateText(); + PCB_DIMENSION_BASE::updateText(); } -void ORTHOGONAL_DIMENSION::Rotate( const wxPoint& aRotCentre, double aAngle ) +void PCB_DIM_ORTHOGONAL::Rotate( const wxPoint& aRotCentre, double aAngle ) { // restrict angle to -179.9 to 180.0 degrees if( aAngle > 1800 ) @@ -910,12 +909,12 @@ void ORTHOGONAL_DIMENSION::Rotate( const wxPoint& aRotCentre, double aAngle ) } // this will update m_crossBarStart and m_crossbarEnd - DIMENSION_BASE::Rotate( aRotCentre, aAngle ); + PCB_DIMENSION_BASE::Rotate( aRotCentre, aAngle ); } -LEADER::LEADER( BOARD_ITEM* aParent ) : - DIMENSION_BASE( aParent, PCB_DIM_LEADER_T ), +PCB_DIM_LEADER::PCB_DIM_LEADER( BOARD_ITEM* aParent ) : + PCB_DIMENSION_BASE( aParent, PCB_DIM_LEADER_T ), m_textFrame( DIM_TEXT_FRAME::NONE ) { m_unitsFormat = DIM_UNITS_FORMAT::NO_SUFFIX; @@ -924,27 +923,27 @@ LEADER::LEADER( BOARD_ITEM* aParent ) : } -EDA_ITEM* LEADER::Clone() const +EDA_ITEM* PCB_DIM_LEADER::Clone() const { - return new LEADER( *this ); + return new PCB_DIM_LEADER( *this ); } -void LEADER::SwapData( BOARD_ITEM* aImage ) +void PCB_DIM_LEADER::SwapData( BOARD_ITEM* aImage ) { assert( aImage->Type() == PCB_DIM_LEADER_T ); - std::swap( *static_cast( this ), *static_cast( aImage ) ); + std::swap( *static_cast( this ), *static_cast( aImage ) ); } -BITMAPS LEADER::GetMenuImage() const +BITMAPS PCB_DIM_LEADER::GetMenuImage() const { return BITMAPS::add_leader; } -void LEADER::updateGeometry() +void PCB_DIM_LEADER::updateGeometry() { m_shapes.clear(); @@ -1035,7 +1034,7 @@ void LEADER::updateGeometry() } -void LEADER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) +void PCB_DIM_LEADER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) { wxString msg; @@ -1055,35 +1054,35 @@ void LEADER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vectorType() == PCB_DIM_CENTER_T ); - std::swap( *static_cast( this ), *static_cast( aImage ) ); + std::swap( *static_cast( this ), *static_cast( aImage ) ); } -BITMAPS CENTER_DIMENSION::GetMenuImage() const +BITMAPS PCB_DIM_CENTER::GetMenuImage() const { return BITMAPS::add_center_dimension; } -const EDA_RECT CENTER_DIMENSION::GetBoundingBox() const +const EDA_RECT PCB_DIM_CENTER::GetBoundingBox() const { int halfWidth = VECTOR2I( m_end - m_start ).x + ( m_lineThickness / 2.0 ); @@ -1100,14 +1099,14 @@ const EDA_RECT CENTER_DIMENSION::GetBoundingBox() const } -const BOX2I CENTER_DIMENSION::ViewBBox() const +const BOX2I PCB_DIM_CENTER::ViewBBox() const { return BOX2I( VECTOR2I( GetBoundingBox().GetPosition() ), VECTOR2I( GetBoundingBox().GetSize() ) ); } -void CENTER_DIMENSION::updateGeometry() +void PCB_DIM_CENTER::updateGeometry() { m_shapes.clear(); @@ -1127,8 +1126,8 @@ static struct DIMENSION_DESC DIMENSION_DESC() { PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance(); - REGISTER_TYPE( DIMENSION_BASE ); - propMgr.InheritsAfter( TYPE_HASH( DIMENSION_BASE ), TYPE_HASH( BOARD_ITEM ) ); + REGISTER_TYPE( PCB_DIMENSION_BASE ); + propMgr.InheritsAfter( TYPE_HASH( PCB_DIMENSION_BASE ), TYPE_HASH( BOARD_ITEM ) ); // TODO: add dimension properties: //propMgr.AddProperty( new PROPERTY( _HKI( "Height" ), //&DIMENSION::SetHeight, &DIMENSION::GetHeight, PROPERTY_DISPLAY::DISTANCE ) ); diff --git a/pcbnew/dimension.h b/pcbnew/pcb_dimension.h similarity index 95% rename from pcbnew/dimension.h rename to pcbnew/pcb_dimension.h index c70263d4b8..67ed39ce46 100644 --- a/pcbnew/dimension.h +++ b/pcbnew/pcb_dimension.h @@ -22,8 +22,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef DIMENSION_H -#define DIMENSION_H +#ifndef PCB_DIMENSION_H +#define PCB_DIMENSION_H #include @@ -92,10 +92,10 @@ enum class DIM_TEXT_FRAME * - "crossbar" refers to the perpendicular line (usually with arrows at each end) between feature * lines on linear dimensions */ -class DIMENSION_BASE : public BOARD_ITEM +class PCB_DIMENSION_BASE : public BOARD_ITEM { public: - DIMENSION_BASE( BOARD_ITEM* aParent, KICAD_T aType = PCB_DIMENSION_T ); + PCB_DIMENSION_BASE( BOARD_ITEM* aParent, KICAD_T aType = PCB_DIMENSION_T ); bool IsType( const KICAD_T aScanTypes[] ) const override { @@ -338,15 +338,15 @@ protected: * The height (distance from features to crossbar) can be set directly, or set by manipulating the * crossbar start or end point (with the point editor). */ -class ALIGNED_DIMENSION : public DIMENSION_BASE +class PCB_DIM_ALIGNED : public PCB_DIMENSION_BASE { public: - ALIGNED_DIMENSION( BOARD_ITEM* aParent, KICAD_T aType = PCB_DIM_ALIGNED_T ); + 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. - ~ALIGNED_DIMENSION() = default; + ~PCB_DIM_ALIGNED() = default; static inline bool ClassOf( const EDA_ITEM* aItem ) { @@ -395,7 +395,7 @@ public: wxString GetClass() const override { - return wxT( "ALIGNED_DIMENSION" ); + return wxT( "PCB_DIM_ALIGNED" ); } void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override; @@ -419,7 +419,7 @@ protected: * An orthogonal dimension is like an aligned dimension, but the extension lines are locked to the * X or Y axes, and the measurement is only taken in the X or Y direction. */ -class ORTHOGONAL_DIMENSION : public ALIGNED_DIMENSION +class PCB_DIM_ORTHOGONAL : public PCB_DIM_ALIGNED { public: enum class DIR @@ -428,9 +428,9 @@ public: VERTICAL // Aligned with y-axis }; - ORTHOGONAL_DIMENSION( BOARD_ITEM* aParent ); + PCB_DIM_ORTHOGONAL( BOARD_ITEM* aParent ); - ~ORTHOGONAL_DIMENSION() = default; + ~PCB_DIM_ORTHOGONAL() = default; static inline bool ClassOf( const EDA_ITEM* aItem ) { @@ -453,7 +453,7 @@ public: wxString GetClass() const override { - return wxT( "ORTHOGONAL_DIMENSION" ); + return wxT( "PCB_DIM_ORTHOGONAL" ); } void Rotate( const wxPoint& aRotCentre, double aAngle ) override; @@ -483,10 +483,10 @@ private: * Point (a) is m_start, point (b) is m_end, point (c) is the end of the "text line" * The b-c line is drawn from b to the text center, and clipped on the text bounding box. */ -class LEADER : public DIMENSION_BASE +class PCB_DIM_LEADER : public PCB_DIMENSION_BASE { public: - LEADER( BOARD_ITEM* aParent ); + PCB_DIM_LEADER( BOARD_ITEM* aParent ); static inline bool ClassOf( const EDA_ITEM* aItem ) { @@ -501,7 +501,7 @@ public: wxString GetClass() const override { - return wxT( "LEADER" ); + return wxT( "PCB_DIM_LEADER" ); } void SetTextFrame( DIM_TEXT_FRAME aFrame ) { m_textFrame = aFrame; } @@ -523,10 +523,10 @@ private: * The size and orientation of the cross is adjustable. * m_start always marks the center being measured; m_end marks the end of one leg of the cross. */ -class CENTER_DIMENSION : public DIMENSION_BASE +class PCB_DIM_CENTER : public PCB_DIMENSION_BASE { public: - CENTER_DIMENSION( BOARD_ITEM* aParent ); + PCB_DIM_CENTER( BOARD_ITEM* aParent ); static inline bool ClassOf( const EDA_ITEM* aItem ) { @@ -541,7 +541,7 @@ public: wxString GetClass() const override { - return wxT( "CENTER_DIMENSION" ); + return wxT( "PCB_DIM_CENTER" ); } const EDA_RECT GetBoundingBox() const override; diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h index 3f9b042070..41fd9fbb70 100644 --- a/pcbnew/pcb_edit_frame.h +++ b/pcbnew/pcb_edit_frame.h @@ -38,7 +38,7 @@ class VIA; class PAD; class PCB_TARGET; class PCB_GROUP; -class DIMENSION_BASE; +class PCB_DIMENSION_BASE; class DRC; class DIALOG_PLOT; class ZONE; @@ -555,7 +555,7 @@ public: // Properties dialogs void ShowTargetOptionsDialog( PCB_TARGET* aTarget ); - void ShowDimensionPropertiesDialog( DIMENSION_BASE* aDimension ); + void ShowDimensionPropertiesDialog( PCB_DIMENSION_BASE* aDimension ); void InstallNetlistFrame(); /** diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 83d1388a81..126140948d 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include @@ -522,7 +522,7 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer ) case PCB_DIM_CENTER_T: case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_LEADER_T: - draw( static_cast( item ), aLayer ); + draw( static_cast( item ), aLayer ); break; case PCB_TARGET_T: @@ -1686,7 +1686,7 @@ void PCB_PAINTER::draw( const ZONE* aZone, int aLayer ) } -void PCB_PAINTER::draw( const DIMENSION_BASE* aDimension, int aLayer ) +void PCB_PAINTER::draw( const PCB_DIMENSION_BASE* aDimension, int aLayer ) { const COLOR4D& strokeColor = m_pcbSettings.GetColor( aDimension, aLayer ); diff --git a/pcbnew/pcb_painter.h b/pcbnew/pcb_painter.h index 68343e9976..6277314050 100644 --- a/pcbnew/pcb_painter.h +++ b/pcbnew/pcb_painter.h @@ -48,7 +48,7 @@ class FOOTPRINT; class ZONE; class PCB_TEXT; class FP_TEXT; -class DIMENSION_BASE; +class PCB_DIMENSION_BASE; class PCB_TARGET; class PCB_MARKER; class NET_SETTINGS; @@ -264,7 +264,7 @@ protected: void draw( const FOOTPRINT* aFootprint, int aLayer ); void draw( const PCB_GROUP* aGroup, int aLayer ); void draw( const ZONE* aZone, int aLayer ); - void draw( const DIMENSION_BASE* aDimension, int aLayer ); + void draw( const PCB_DIMENSION_BASE* aDimension, int aLayer ); void draw( const PCB_TARGET* aTarget ); void draw( const PCB_MARKER* aMarker, int aLayer ); diff --git a/pcbnew/pcbplot.h b/pcbnew/pcbplot.h index e755bac28f..e74e5742c3 100644 --- a/pcbnew/pcbplot.h +++ b/pcbnew/pcbplot.h @@ -39,7 +39,7 @@ class PLOTTER; class PCB_TEXT; class PAD; class PCB_SHAPE; -class DIMENSION_BASE; +class PCB_DIMENSION_BASE; class FOOTPRINT; class FP_SHAPE; class PCB_TARGET; @@ -92,7 +92,7 @@ public: */ void PlotFootprintTextItems( const FOOTPRINT* aFootprint ); - void PlotDimension( const DIMENSION_BASE* aDim ); + void PlotDimension( const PCB_DIMENSION_BASE* aDim ); void PlotPcbTarget( const PCB_TARGET* aMire ); void PlotFilledAreas( const ZONE* aZone, const SHAPE_POLY_SET& aPolysList ); void PlotPcbText( const PCB_TEXT* aText ); diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index 360cd3aa05..dab2b7af2a 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -46,7 +46,7 @@ #include #include #include -#include +#include #include #include diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index d301bb6a9f..ae78a1f958 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -54,7 +54,7 @@ #include #include // for BOARD_ITEM, S_CIRCLE -#include +#include #include #include #include @@ -355,7 +355,7 @@ void BRDITEMS_PLOTTER::PlotBoardGraphicItems() case PCB_DIM_CENTER_T: case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_LEADER_T: - PlotDimension( (DIMENSION_BASE*) item ); + PlotDimension( (PCB_DIMENSION_BASE*) item ); break; case PCB_TARGET_T: @@ -407,7 +407,7 @@ void BRDITEMS_PLOTTER::PlotFootprintTextItem( const FP_TEXT* aTextMod, COLOR4D a } -void BRDITEMS_PLOTTER::PlotDimension( const DIMENSION_BASE* aDim ) +void BRDITEMS_PLOTTER::PlotDimension( const PCB_DIMENSION_BASE* aDim ) { if( !m_layerMask[aDim->GetLayer()] ) return; diff --git a/pcbnew/plugins/altium/altium_pcb.cpp b/pcbnew/plugins/altium/altium_pcb.cpp index cee646ca92..2641d821f2 100644 --- a/pcbnew/plugins/altium/altium_pcb.cpp +++ b/pcbnew/plugins/altium/altium_pcb.cpp @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include #include @@ -924,7 +924,7 @@ void ALTIUM_PCB::HelperParseDimensions6Linear( const ADIMENSION6& aElem ) wxPoint referencePoint0 = aElem.referencePoint.at( 0 ); wxPoint referencePoint1 = aElem.referencePoint.at( 1 ); - ALIGNED_DIMENSION* dimension = new ALIGNED_DIMENSION( m_board ); + PCB_DIM_ALIGNED* dimension = new PCB_DIM_ALIGNED( m_board ); m_board->Add( dimension, ADD_MODE::APPEND ); dimension->SetPrecision( aElem.textprecision ); @@ -1102,7 +1102,7 @@ void ALTIUM_PCB::HelperParseDimensions6Center( const ADIMENSION6& aElem ) wxPoint vec = wxPoint( 0, aElem.height / 2 ); RotatePoint( &vec, aElem.angle * 10. ); - CENTER_DIMENSION* dimension = new CENTER_DIMENSION( m_board ); + PCB_DIM_CENTER* dimension = new PCB_DIM_CENTER( m_board ); m_board->Add( dimension, ADD_MODE::APPEND ); dimension->SetLayer( klayer ); dimension->SetLineThickness( aElem.linewidth ); diff --git a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp index 2121f8f273..b876a18d22 100644 --- a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp +++ b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.cpp @@ -29,7 +29,7 @@ #include // KEY_COPPER, KEY_CORE, KEY_PREPREG #include #include -#include +#include #include #include #include @@ -1311,21 +1311,21 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions() csDim.ID ) ); } - ALIGNED_DIMENSION* dimension = nullptr; + PCB_DIM_ALIGNED* dimension = nullptr; if( csDim.Subtype == DIMENSION::SUBTYPE::ORTHOGONAL ) { - dimension = new ORTHOGONAL_DIMENSION( m_board ); - ORTHOGONAL_DIMENSION* orDim = static_cast( dimension ); + dimension = new PCB_DIM_ORTHOGONAL( m_board ); + PCB_DIM_ORTHOGONAL* orDim = static_cast( dimension ); if( csDim.ExtensionLineParams.Start.x == csDim.Line.Start.x ) - orDim->SetOrientation( ORTHOGONAL_DIMENSION::DIR::HORIZONTAL ); + orDim->SetOrientation( PCB_DIM_ORTHOGONAL::DIR::HORIZONTAL ); else - orDim->SetOrientation( ORTHOGONAL_DIMENSION::DIR::VERTICAL ); + orDim->SetOrientation( PCB_DIM_ORTHOGONAL::DIR::VERTICAL ); } else { - dimension = new ALIGNED_DIMENSION( m_board ); + dimension = new PCB_DIM_ALIGNED( m_board ); } m_board->Add( dimension, ADD_MODE::APPEND ); @@ -1374,7 +1374,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions() if( csDim.Line.Style == DIMENSION::LINE::STYLE::INTERNAL ) { // "internal" is a simple double sided arrow from start to end (no extension lines) - ALIGNED_DIMENSION* dimension = new ALIGNED_DIMENSION( m_board ); + PCB_DIM_ALIGNED* dimension = new PCB_DIM_ALIGNED( m_board ); m_board->Add( dimension, ADD_MODE::APPEND ); applyDimensionSettings( csDim, dimension ); @@ -1390,7 +1390,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::loadDimensions() else { // "external" is a "leader" style dimension - LEADER* leaderDim = new LEADER( m_board ); + PCB_DIM_LEADER* leaderDim = new PCB_DIM_LEADER( m_board ); m_board->Add( leaderDim, ADD_MODE::APPEND ); applyDimensionSettings( csDim, leaderDim ); @@ -3475,7 +3475,7 @@ void CADSTAR_PCB_ARCHIVE_LOADER::checkAndLogHatchCode( const HATCHCODE_ID& aCads void CADSTAR_PCB_ARCHIVE_LOADER::applyDimensionSettings( const DIMENSION& aCadstarDim, - DIMENSION_BASE* aKiCadDim ) + PCB_DIMENSION_BASE* aKiCadDim ) { UNITS dimensionUnits = aCadstarDim.LinearUnits; TEXTCODE txtCode = getTextCode( aCadstarDim.Text.TextCodeID ); diff --git a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.h b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.h index d48fe9ef87..8875020a0d 100644 --- a/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.h +++ b/pcbnew/plugins/cadstar/cadstar_pcb_archive_loader.h @@ -34,7 +34,7 @@ class BOARD; class BOARD_STACKUP_ITEM; -class DIMENSION_BASE; +class PCB_DIMENSION_BASE; class CADSTAR_PCB_ARCHIVE_LOADER : public CADSTAR_PCB_ARCHIVE_PARSER { @@ -169,7 +169,7 @@ private: /// Load via and return via size int loadNetVia( const NET_ID& aCadstarNetID, const NET_PCB::VIA& aCadstarVia ); void checkAndLogHatchCode( const HATCHCODE_ID& aCadstarHatchcodeID ); - void applyDimensionSettings( const DIMENSION& aCadstarDim, DIMENSION_BASE* aKiCadDim ); + void applyDimensionSettings( const DIMENSION& aCadstarDim, PCB_DIMENSION_BASE* aKiCadDim ); /** diff --git a/pcbnew/plugins/eagle/eagle_plugin.cpp b/pcbnew/plugins/eagle/eagle_plugin.cpp index db1c7bb14e..978bc70035 100644 --- a/pcbnew/plugins/eagle/eagle_plugin.cpp +++ b/pcbnew/plugins/eagle/eagle_plugin.cpp @@ -77,7 +77,7 @@ Load() TODO's #include #include #include -#include +#include #include @@ -874,7 +874,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics ) if( layer != UNDEFINED_LAYER ) { const BOARD_DESIGN_SETTINGS& designSettings = m_board->GetDesignSettings(); - ALIGNED_DIMENSION* dimension = new ALIGNED_DIMENSION( m_board ); + PCB_DIM_ALIGNED* dimension = new PCB_DIM_ALIGNED( m_board ); m_board->Add( dimension, ADD_MODE::APPEND ); if( d.dimensionType ) diff --git a/pcbnew/plugins/kicad/kicad_plugin.cpp b/pcbnew/plugins/kicad/kicad_plugin.cpp index 4ca5b56208..17ed5d4f49 100644 --- a/pcbnew/plugins/kicad/kicad_plugin.cpp +++ b/pcbnew/plugins/kicad/kicad_plugin.cpp @@ -30,7 +30,7 @@ #include #include // for enum RECT_CHAMFER_POSITIONS definition #include -#include +#include #include #include #include @@ -406,7 +406,7 @@ void PCB_IO::Format( const BOARD_ITEM* aItem, int aNestLevel ) const case PCB_DIM_CENTER_T: case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_LEADER_T: - format( static_cast( aItem ), aNestLevel ); + format( static_cast( aItem ), aNestLevel ); break; case PCB_SHAPE_T: @@ -691,12 +691,12 @@ void PCB_IO::format( const BOARD* aBoard, int aNestLevel ) const } -void PCB_IO::format( const DIMENSION_BASE* aDimension, int aNestLevel ) const +void PCB_IO::format( const PCB_DIMENSION_BASE* aDimension, int aNestLevel ) const { - const ALIGNED_DIMENSION* aligned = dynamic_cast( aDimension ); - const ORTHOGONAL_DIMENSION* ortho = dynamic_cast( aDimension ); - const CENTER_DIMENSION* center = dynamic_cast( aDimension ); - const LEADER* leader = dynamic_cast( aDimension ); + const PCB_DIM_ALIGNED* aligned = dynamic_cast( aDimension ); + const PCB_DIM_ORTHOGONAL* ortho = dynamic_cast( aDimension ); + const PCB_DIM_CENTER* center = dynamic_cast( aDimension ); + const PCB_DIM_LEADER* leader = dynamic_cast( aDimension ); m_out->Print( aNestLevel, "(dimension" ); diff --git a/pcbnew/plugins/kicad/kicad_plugin.h b/pcbnew/plugins/kicad/kicad_plugin.h index 7acf5b8dc5..8ace5199fd 100644 --- a/pcbnew/plugins/kicad/kicad_plugin.h +++ b/pcbnew/plugins/kicad/kicad_plugin.h @@ -35,7 +35,7 @@ class FP_CACHE; class PCB_PARSER; class NETINFO_MAPPING; class BOARD_DESIGN_SETTINGS; -class DIMENSION_BASE; +class PCB_DIMENSION_BASE; class FP_SHAPE; class PCB_SHAPE; class PCB_TARGET; @@ -242,7 +242,7 @@ protected: private: void format( const BOARD* aBoard, int aNestLevel = 0 ) const; - void format( const DIMENSION_BASE* aDimension, int aNestLevel = 0 ) const; + void format( const PCB_DIMENSION_BASE* aDimension, int aNestLevel = 0 ) const; void format( const FP_SHAPE* aFPShape, int aNestLevel = 0 ) const; diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index bd1ff8a067..3b9d73c3c3 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include @@ -2566,14 +2566,14 @@ PCB_TEXT* PCB_PARSER::parsePCB_TEXT() } -DIMENSION_BASE* PCB_PARSER::parseDIMENSION() +PCB_DIMENSION_BASE* PCB_PARSER::parseDIMENSION() { wxCHECK_MSG( CurTok() == T_dimension, NULL, wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as DIMENSION." ) ); T token; bool locked = false; - std::unique_ptr dimension; + std::unique_ptr dimension; token = NextTok(); @@ -2595,7 +2595,7 @@ DIMENSION_BASE* PCB_PARSER::parseDIMENSION() if( token == T_width ) { isLegacyDimension = true; - dimension = std::make_unique( nullptr ); + dimension = std::make_unique( nullptr ); dimension->SetLineThickness( parseBoardUnits( "dimension width value" ) ); NeedRIGHT(); } @@ -2607,19 +2607,19 @@ DIMENSION_BASE* PCB_PARSER::parseDIMENSION() switch( NextTok() ) { case T_aligned: - dimension = std::make_unique( nullptr ); + dimension = std::make_unique( nullptr ); break; case T_orthogonal: - dimension = std::make_unique( nullptr ); + dimension = std::make_unique( nullptr ); break; case T_leader: - dimension = std::make_unique( nullptr ); + dimension = std::make_unique( nullptr ); break; case T_center: - dimension = std::make_unique( nullptr ); + dimension = std::make_unique( nullptr ); break; default: @@ -2691,7 +2691,7 @@ DIMENSION_BASE* PCB_PARSER::parseDIMENSION() wxCHECK_MSG( dimension->Type() == PCB_DIM_ALIGNED_T || dimension->Type() == PCB_DIM_ORTHOGONAL_T, nullptr, wxT( "Invalid height token" ) ); - ALIGNED_DIMENSION* aligned = static_cast( dimension.get() ); + PCB_DIM_ALIGNED* aligned = static_cast( dimension.get() ); aligned->SetHeight( parseBoardUnits( "dimension height value" ) ); NeedRIGHT(); break; @@ -2701,11 +2701,11 @@ DIMENSION_BASE* PCB_PARSER::parseDIMENSION() { wxCHECK_MSG( dimension->Type() == PCB_DIM_ORTHOGONAL_T, nullptr, wxT( "Invalid orientation token" ) ); - ORTHOGONAL_DIMENSION* ortho = static_cast( dimension.get() ); + PCB_DIM_ORTHOGONAL* ortho = static_cast( dimension.get() ); int orientation = parseInt( "orthogonal dimension orientation" ); orientation = std::max( 0, std::min( 1, orientation ) ); - ortho->SetOrientation( static_cast( orientation ) ); + ortho->SetOrientation( static_cast( orientation ) ); NeedRIGHT(); break; } @@ -2806,7 +2806,7 @@ DIMENSION_BASE* PCB_PARSER::parseDIMENSION() case T_extension_height: { - ALIGNED_DIMENSION* aligned = dynamic_cast( dimension.get() ); + PCB_DIM_ALIGNED* aligned = dynamic_cast( dimension.get() ); wxCHECK_MSG( aligned, nullptr, wxT( "Invalid extension_height token" ) ); aligned->SetExtensionHeight( parseBoardUnits( "extension height" ) ); NeedRIGHT(); @@ -2826,7 +2826,7 @@ DIMENSION_BASE* PCB_PARSER::parseDIMENSION() { wxCHECK_MSG( dimension->Type() == PCB_DIM_LEADER_T, nullptr, wxT( "Invalid text_frame token" ) ); - LEADER* leader = static_cast( dimension.get() ); + PCB_DIM_LEADER* leader = static_cast( dimension.get() ); int textFrame = parseInt( "dimension text frame mode" ); textFrame = std::max( 0, std::min( 3, textFrame ) ); @@ -2893,7 +2893,7 @@ DIMENSION_BASE* PCB_PARSER::parseDIMENSION() if( token == T_pts ) { // If we have a crossbar, we know we're an old aligned dimension - ALIGNED_DIMENSION* aligned = static_cast( dimension.get() ); + PCB_DIM_ALIGNED* aligned = static_cast( dimension.get() ); // Old style: calculate height from crossbar wxPoint point1, point2; diff --git a/pcbnew/plugins/kicad/pcb_parser.h b/pcbnew/plugins/kicad/pcb_parser.h index ff5a064f75..56bacf94d4 100644 --- a/pcbnew/plugins/kicad/pcb_parser.h +++ b/pcbnew/plugins/kicad/pcb_parser.h @@ -46,7 +46,7 @@ class BOARD_ITEM; class BOARD_ITEM_CONTAINER; class PAD; class BOARD_DESIGN_SETTINGS; -class DIMENSION_BASE; +class PCB_DIMENSION_BASE; class PCB_SHAPE; class EDA_TEXT; class FP_SHAPE; @@ -185,30 +185,30 @@ private: void parseNETINFO_ITEM(); void parseNETCLASS(); - PCB_SHAPE* parsePCB_SHAPE(); - PCB_TEXT* parsePCB_TEXT(); - DIMENSION_BASE* parseDIMENSION(); + PCB_SHAPE* parsePCB_SHAPE(); + PCB_TEXT* parsePCB_TEXT(); + PCB_DIMENSION_BASE* parseDIMENSION(); // Parse a footprint, but do not replace PARSE_ERROR with FUTURE_FORMAT_ERROR automatically. - FOOTPRINT* parseFOOTPRINT_unchecked( wxArrayString* aInitialComments = nullptr ); + FOOTPRINT* parseFOOTPRINT_unchecked( wxArrayString* aInitialComments = nullptr ); - FP_TEXT* parseFP_TEXT(); - FP_SHAPE* parseFP_SHAPE(); - PAD* parsePAD( FOOTPRINT* aParent = NULL ); + FP_TEXT* parseFP_TEXT(); + FP_SHAPE* parseFP_SHAPE(); + PAD* parsePAD( FOOTPRINT* aParent = NULL ); // Parse only the (option ...) inside a pad description - bool parsePAD_option( PAD* aPad ); + bool parsePAD_option( PAD* aPad ); - ARC* parseARC(); - TRACK* parseTRACK(); - VIA* parseVIA(); - ZONE* parseZONE( BOARD_ITEM_CONTAINER* aParent ); - PCB_TARGET* parsePCB_TARGET(); - BOARD* parseBOARD(); - void parseGROUP( BOARD_ITEM* aParent ); + ARC* parseARC(); + TRACK* parseTRACK(); + VIA* parseVIA(); + ZONE* parseZONE( BOARD_ITEM_CONTAINER* aParent ); + PCB_TARGET* parsePCB_TARGET(); + BOARD* parseBOARD(); + void parseGROUP( BOARD_ITEM* aParent ); // Parse a board, but do not replace PARSE_ERROR with FUTURE_FORMAT_ERROR automatically. - BOARD* parseBOARD_unchecked(); + BOARD* parseBOARD_unchecked(); /** * Parse the current token for the layer definition of a #BOARD_ITEM object. diff --git a/pcbnew/plugins/legacy/legacy_plugin.cpp b/pcbnew/plugins/legacy/legacy_plugin.cpp index e07b5169e6..6b9bbaec96 100644 --- a/pcbnew/plugins/legacy/legacy_plugin.cpp +++ b/pcbnew/plugins/legacy/legacy_plugin.cpp @@ -78,7 +78,7 @@ #include #include #include -#include +#include #include #include #include @@ -2720,7 +2720,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() void LEGACY_PLUGIN::loadDIMENSION() { - std::unique_ptr dim = std::make_unique( m_board ); + std::unique_ptr dim = std::make_unique( m_board ); char* line; diff --git a/pcbnew/plugins/legacy/legacy_plugin.h b/pcbnew/plugins/legacy/legacy_plugin.h index 8d1c569280..0dc010a0b6 100644 --- a/pcbnew/plugins/legacy/legacy_plugin.h +++ b/pcbnew/plugins/legacy/legacy_plugin.h @@ -44,7 +44,7 @@ class TRACK; class NETCLASS; class NETCLASSES; class ZONE; -class DIMENSION_BASE; +class PCB_DIMENSION_BASE; class NETINFO_ITEM; class FP_TEXT; class TRACK; diff --git a/pcbnew/python/swig/board.i b/pcbnew/python/swig/board.i index c3de8abd6e..ef8f9ff673 100644 --- a/pcbnew/python/swig/board.i +++ b/pcbnew/python/swig/board.i @@ -54,9 +54,9 @@ HANDLE_EXCEPTIONS(BOARD::TracksInNetBetweenPoints) %include zone.i %include zone_settings.i %include pcb_text.i -%include dimension.i +%include pcb_dimension.i %include pcb_shape.i -%include marker_pcb.i +%include pcb_marker.i %include pcb_target.i %include fp_shape.i %include fp_text.i diff --git a/pcbnew/python/swig/board_item.i b/pcbnew/python/swig/board_item.i index 3acafca17c..a8fa7c91c3 100644 --- a/pcbnew/python/swig/board_item.i +++ b/pcbnew/python/swig/board_item.i @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2012 Miguel Angel Ajo - * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2021 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 @@ -62,10 +62,10 @@ const int S_CURVE = (const int)PCB_SHAPE_TYPE::CURVE; %{ class PCB_TEXT; -class ALIGNED_DIMENSION; -class ORTHOGONAL_DIMENSION; -class LEADER; -class CENTER_DIMENSION; +class PCB_DIM_ALIGNED; +class PCB_DIM_ORTHOGONAL; +class PCB_DIM_LEADER; +class PCB_DIM_CENTER; class FOOTPRINT; class PCB_GROUP; class FP_TEXT; @@ -88,10 +88,10 @@ extern "C" { #endif static PCB_TEXT* Cast_to_PCB_TEXT( BOARD_ITEM* ); -static ALIGNED_DIMENSION* Cast_to_ALIGNED_DIMENSION( BOARD_ITEM* ); -static ORTHOGONAL_DIMENSION* Cast_to_ORTHOGONAL_DIMENSION( BOARD_ITEM* ); -static LEADER* Cast_to_LEADER( BOARD_ITEM* ); -static CENTER_DIMENSION* Cast_to_CENTER_DIMENSION( BOARD_ITEM* ); +static PCB_DIM_ALIGNED* Cast_to_PCB_DIM_ALIGNED( BOARD_ITEM* ); +static PCB_DIM_ORTHOGONAL* Cast_to_PCB_DIM_ORTHOGONAL( BOARD_ITEM* ); +static PCB_DIM_LEADER* Cast_to_PCB_DIM_LEADER( BOARD_ITEM* ); +static PCB_DIM_CENTER* Cast_to_PCB_DIM_CENTER( BOARD_ITEM* ); static FOOTPRINT* Cast_to_FOOTPRINT( BOARD_ITEM* ); static PCB_GROUP* Cast_to_PCB_GROUP( BOARD_ITEM* ); static FP_TEXT* Cast_to_FP_TEXT( BOARD_ITEM* ); @@ -114,10 +114,10 @@ static PCB_TARGET* Cast_to_PCB_TARGET( BOARD_ITEM* ); static PCB_TEXT* Cast_to_PCB_TEXT( BOARD_ITEM* ); -static ALIGNED_DIMENSION* Cast_to_ALIGNED_DIMENSION( BOARD_ITEM* ); -static ORTHOGONAL_DIMENSION* Cast_to_ORTHOGONAL_DIMENSION( BOARD_ITEM* ); -static LEADER* Cast_to_LEADER( BOARD_ITEM* ); -static CENTER_DIMENSION* Cast_to_CENTER_DIMENSION( BOARD_ITEM* ); +static PCB_DIM_ALIGNED* Cast_to_PCB_DIM_ALIGNED( BOARD_ITEM* ); +static PCB_DIM_ORTHOGONAL* Cast_to_PCB_DIM_ORTHOGONAL( BOARD_ITEM* ); +static PCB_DIM_LEADER* Cast_to_PCB_DIM_LEADER( BOARD_ITEM* ); +static PCB_DIM_CENTER* Cast_to_PCB_DIM_CENTER( BOARD_ITEM* ); static FOOTPRINT* Cast_to_FOOTPRINT( BOARD_ITEM* ); static PCB_GROUP* Cast_to_PCB_GROUP( BOARD_ITEM* ); static FP_TEXT* Cast_to_FP_TEXT( BOARD_ITEM* ); @@ -147,19 +147,19 @@ static PCB_TARGET* Cast_to_PCB_TARGET( BOARD_ITEM* ); elif ct=="BOARD": return Cast_to_BOARD(self) elif ct=="ALIGNED_DIMENSION": - return Cast_to_ALIGNED_DIMENSION(self) + return Cast_to_PCB_DIM_ALIGNED(self) elif ct=="LEADER": - return Cast_to_LEADER(self) + return Cast_to_PCB_DIM_LEADER(self) elif ct=="CENTER_DIMENSION": - return Cast_to_CENTER_DIMENSION(self) + return Cast_to_PCB_DIM_CENTER(self) elif ct=="ORTHOGONAL_DIMENSION": - return Cast_to_ORTHOGONAL_DIMENSION(self) + return Cast_to_PCB_DIM_ORTHOGONAL(self) elif ct=="PCB_SHAPE": return Cast_to_PCB_SHAPE(self) elif ct=="MGRAPHIC": return Cast_to_FP_SHAPE(self) elif ct=="MODULE": - return Cast_to_MODULE(self) + return Cast_to_FOOTPRINT(self) elif ct=="PCB_GROUP": return Cast_to_PCB_GROUP(self) elif ct=="PAD": @@ -205,10 +205,10 @@ static PCB_TARGET* Cast_to_PCB_TARGET( BOARD_ITEM* ); // the %header section. See section 5.6.2 of SWIG 3.0 documentation. %wrapper %{ static PCB_TEXT* Cast_to_PCB_TEXT( BOARD_ITEM* self ) { return dynamic_cast(self); } -static ALIGNED_DIMENSION* Cast_to_ALIGNED_DIMENSION( BOARD_ITEM* self ) { return dynamic_cast(self); } -static ORTHOGONAL_DIMENSION* Cast_to_ORTHOGONAL_DIMENSION( BOARD_ITEM* self ) { return dynamic_cast(self); } -static LEADER* Cast_to_LEADER( BOARD_ITEM* self ) { return dynamic_cast(self); } -static CENTER_DIMENSION* Cast_to_CENTER_DIMENSION( BOARD_ITEM* self ) { return dynamic_cast(self); } +static PCB_DIM_ALIGNED* Cast_to_PCB_DIM_ALIGNED( BOARD_ITEM* self ) { return dynamic_cast(self); } +static PCB_DIM_ORTHOGONAL* Cast_to_PCB_DIM_ORTHOGONAL( BOARD_ITEM* self ) { return dynamic_cast(self); } +static PCB_DIM_LEADER* Cast_to_PCB_DIM_LEADER( BOARD_ITEM* self ) { return dynamic_cast(self); } +static PCB_DIM_CENTER* Cast_to_PCB_DIM_CENTER( BOARD_ITEM* self ) { return dynamic_cast(self); } static FOOTPRINT* Cast_to_FOOTPRINT( BOARD_ITEM* self ) { return dynamic_cast(self); } static PCB_GROUP* Cast_to_PCB_GROUP( BOARD_ITEM* self ) { return dynamic_cast(self); } static FP_TEXT* Cast_to_FP_TEXT( BOARD_ITEM* self ) { return dynamic_cast(self); } diff --git a/pcbnew/python/swig/dimension.i b/pcbnew/python/swig/dimension.i deleted file mode 100644 index b9a5f96f83..0000000000 --- a/pcbnew/python/swig/dimension.i +++ /dev/null @@ -1,6 +0,0 @@ - -%include dimension.h -%{ -#include -%} - diff --git a/pcbnew/python/swig/pcb_dimension.i b/pcbnew/python/swig/pcb_dimension.i new file mode 100644 index 0000000000..df8aeda9da --- /dev/null +++ b/pcbnew/python/swig/pcb_dimension.i @@ -0,0 +1,6 @@ + +%include pcb_dimension.h +%{ +#include +%} + diff --git a/pcbnew/python/swig/marker_pcb.i b/pcbnew/python/swig/pcb_marker.i similarity index 100% rename from pcbnew/python/swig/marker_pcb.i rename to pcbnew/python/swig/pcb_marker.i diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index d0c094ced0..31c29852d2 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include #include #include @@ -643,7 +643,7 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent ) } -void DRAWING_TOOL::constrainDimension( DIMENSION_BASE* aDim ) +void DRAWING_TOOL::constrainDimension( PCB_DIMENSION_BASE* aDim ) { const VECTOR2I lineVector{ aDim->GetEnd() - aDim->GetStart() }; @@ -666,7 +666,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent ) }; TOOL_EVENT originalEvent = aEvent; - DIMENSION_BASE* dimension = nullptr; + PCB_DIMENSION_BASE* dimension = nullptr; BOARD_COMMIT commit( m_frame ); PCB_GRID_HELPER grid( m_toolMgr, m_frame->GetMagneticItemsSettings() ); BOARD_DESIGN_SETTINGS& boardSettings = m_board->GetDesignSettings(); @@ -795,7 +795,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent ) // Init the new item attributes auto setMeasurementAttributes = - [&]( DIMENSION_BASE* aDim ) + [&]( PCB_DIMENSION_BASE* aDim ) { aDim->SetUnitsMode( boardSettings.m_DimensionUnitsMode ); aDim->SetUnitsFormat( boardSettings.m_DimensionUnitsFormat ); @@ -810,21 +810,21 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent ) if( originalEvent.IsAction( &PCB_ACTIONS::drawAlignedDimension ) ) { - dimension = new ALIGNED_DIMENSION( m_board ); + dimension = new PCB_DIM_ALIGNED( m_board ); setMeasurementAttributes( dimension ); } else if( originalEvent.IsAction( &PCB_ACTIONS::drawOrthogonalDimension ) ) { - dimension = new ORTHOGONAL_DIMENSION( m_board ); + dimension = new PCB_DIM_ORTHOGONAL( m_board ); setMeasurementAttributes( dimension ); } else if( originalEvent.IsAction( &PCB_ACTIONS::drawCenterDimension ) ) { - dimension = new CENTER_DIMENSION( m_board ); + dimension = new PCB_DIM_CENTER( m_board ); } else if( originalEvent.IsAction( &PCB_ACTIONS::drawLeader ) ) { - dimension = new LEADER( m_board ); + dimension = new PCB_DIM_LEADER( m_board ); dimension->Text().SetPosition( wxPoint( cursorPos ) ); } else @@ -929,7 +929,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent ) if( dimension->Type() == PCB_DIM_ORTHOGONAL_T ) { - ORTHOGONAL_DIMENSION* ortho = static_cast( dimension ); + PCB_DIM_ORTHOGONAL* ortho = static_cast( dimension ); BOX2I bounds( dimension->GetStart(), dimension->GetEnd() - dimension->GetStart() ); @@ -937,8 +937,8 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent ) // Create a nice preview by measuring the longer dimension bool vert = bounds.GetWidth() < bounds.GetHeight(); - ortho->SetOrientation( vert ? ORTHOGONAL_DIMENSION::DIR::VERTICAL - : ORTHOGONAL_DIMENSION::DIR::HORIZONTAL ); + ortho->SetOrientation( vert ? PCB_DIM_ORTHOGONAL::DIR::VERTICAL + : PCB_DIM_ORTHOGONAL::DIR::HORIZONTAL ); } dimension->Update(); @@ -952,7 +952,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent ) { if( dimension->Type() == PCB_DIM_ALIGNED_T ) { - ALIGNED_DIMENSION* aligned = static_cast( dimension ); + PCB_DIM_ALIGNED* aligned = static_cast( dimension ); // Calculating the direction of travel perpendicular to the selected axis double angle = aligned->GetAngle() + ( M_PI / 2 ); @@ -964,7 +964,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent ) } else if( dimension->Type() == PCB_DIM_ORTHOGONAL_T ) { - ORTHOGONAL_DIMENSION* ortho = static_cast( dimension ); + PCB_DIM_ORTHOGONAL* ortho = static_cast( dimension ); BOX2I bounds( dimension->GetStart(), dimension->GetEnd() - dimension->GetStart() ); @@ -996,12 +996,12 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent ) { vert = std::abs( direction.y ) < std::abs( direction.x ); } - ortho->SetOrientation( vert ? ORTHOGONAL_DIMENSION::DIR::VERTICAL - : ORTHOGONAL_DIMENSION::DIR::HORIZONTAL ); + ortho->SetOrientation( vert ? PCB_DIM_ORTHOGONAL::DIR::VERTICAL + : PCB_DIM_ORTHOGONAL::DIR::HORIZONTAL ); } else { - vert = ortho->GetOrientation() == ORTHOGONAL_DIMENSION::DIR::VERTICAL; + vert = ortho->GetOrientation() == PCB_DIM_ORTHOGONAL::DIR::VERTICAL; } VECTOR2I heightVector( cursorPos - dimension->GetStart() ); diff --git a/pcbnew/tools/drawing_tool.h b/pcbnew/tools/drawing_tool.h index 29fe2f5037..b46628e55e 100644 --- a/pcbnew/tools/drawing_tool.h +++ b/pcbnew/tools/drawing_tool.h @@ -259,7 +259,7 @@ private: * * @param aDimension is the dimension element currently being drawn. */ - void constrainDimension( DIMENSION_BASE* aDim ); + void constrainDimension( PCB_DIMENSION_BASE* aDim ); ///< Return the appropriate width for a segment depending on the settings. int getSegmentWidth( PCB_LAYER_ID aLayer ) const; diff --git a/pcbnew/tools/pcb_control.cpp b/pcbnew/tools/pcb_control.cpp index 8c1bdb9e73..56729aba57 100644 --- a/pcbnew/tools/pcb_control.cpp +++ b/pcbnew/tools/pcb_control.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include @@ -902,7 +902,7 @@ int PCB_CONTROL::placeBoardItems( std::vector& aItems, bool aIsNew, case PCB_DIM_LEADER_T: { // Dimensions need to have their units updated if they are automatic - DIMENSION_BASE* dim = static_cast( item ); + PCB_DIMENSION_BASE* dim = static_cast( item ); if( dim->GetUnitsMode() == DIM_UNITS_MODE::AUTOMATIC ) dim->SetUnits( frame()->GetUserUnits() ); diff --git a/pcbnew/tools/pcb_grid_helper.cpp b/pcbnew/tools/pcb_grid_helper.cpp index 7d856f31ad..3e6202ef18 100644 --- a/pcbnew/tools/pcb_grid_helper.cpp +++ b/pcbnew/tools/pcb_grid_helper.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include #include @@ -643,7 +643,7 @@ void PCB_GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos case PCB_DIM_ALIGNED_T: case PCB_DIM_ORTHOGONAL_T: { - const ALIGNED_DIMENSION* dim = static_cast( aItem ); + const PCB_DIM_ALIGNED* dim = static_cast( aItem ); addAnchor( dim->GetCrossbarStart(), CORNER | SNAPPABLE, aItem ); addAnchor( dim->GetCrossbarEnd(), CORNER | SNAPPABLE, aItem ); addAnchor( dim->GetStart(), CORNER | SNAPPABLE, aItem ); @@ -653,7 +653,7 @@ void PCB_GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos case PCB_DIM_CENTER_T: { - const CENTER_DIMENSION* dim = static_cast( aItem ); + const PCB_DIM_CENTER* dim = static_cast( aItem ); addAnchor( dim->GetStart(), CORNER | SNAPPABLE, aItem ); addAnchor( dim->GetEnd(), CORNER | SNAPPABLE, aItem ); @@ -671,7 +671,7 @@ void PCB_GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos case PCB_DIM_LEADER_T: { - const LEADER* leader = static_cast( aItem ); + const PCB_DIM_LEADER* leader = static_cast( aItem ); addAnchor( leader->GetStart(), CORNER | SNAPPABLE, aItem ); addAnchor( leader->GetEnd(), CORNER | SNAPPABLE, aItem ); addAnchor( leader->Text().GetPosition(), CORNER | SNAPPABLE, aItem ); diff --git a/pcbnew/tools/pcb_point_editor.cpp b/pcbnew/tools/pcb_point_editor.cpp index 9463aa4c3a..d98d5aa4c2 100644 --- a/pcbnew/tools/pcb_point_editor.cpp +++ b/pcbnew/tools/pcb_point_editor.cpp @@ -40,7 +40,7 @@ using namespace std::placeholders; #include #include #include -#include +#include #include #include #include @@ -291,7 +291,7 @@ std::shared_ptr PCB_POINT_EDITOR::makePoints( EDA_ITEM* aItem ) case PCB_DIM_ALIGNED_T: case PCB_DIM_ORTHOGONAL_T: { - const ALIGNED_DIMENSION* dimension = static_cast( aItem ); + const PCB_DIM_ALIGNED* dimension = static_cast( aItem ); points->AddPoint( dimension->GetStart() ); points->AddPoint( dimension->GetEnd() ); @@ -315,7 +315,7 @@ std::shared_ptr PCB_POINT_EDITOR::makePoints( EDA_ITEM* aItem ) case PCB_DIM_CENTER_T: { - const CENTER_DIMENSION* dimension = static_cast( aItem ); + const PCB_DIM_CENTER* dimension = static_cast( aItem ); points->AddPoint( dimension->GetStart() ); points->AddPoint( dimension->GetEnd() ); @@ -328,7 +328,7 @@ std::shared_ptr PCB_POINT_EDITOR::makePoints( EDA_ITEM* aItem ) case PCB_DIM_LEADER_T: { - const LEADER* dimension = static_cast( aItem ); + const PCB_DIM_LEADER* dimension = static_cast( aItem ); points->AddPoint( dimension->GetStart() ); points->AddPoint( dimension->GetEnd() ); @@ -1314,7 +1314,7 @@ void PCB_POINT_EDITOR::updateItem() const case PCB_DIM_ALIGNED_T: { - ALIGNED_DIMENSION* dimension = static_cast( item ); + PCB_DIM_ALIGNED* dimension = static_cast( item ); // Check which point is currently modified and updated dimension's points respectively if( isModified( m_editPoints->Point( DIM_CROSSBARSTART ) ) ) @@ -1376,7 +1376,7 @@ void PCB_POINT_EDITOR::updateItem() const case PCB_DIM_ORTHOGONAL_T: { - ORTHOGONAL_DIMENSION* dimension = static_cast( item ); + PCB_DIM_ORTHOGONAL* dimension = static_cast( item ); if( isModified( m_editPoints->Point( DIM_CROSSBARSTART ) ) || isModified( m_editPoints->Point( DIM_CROSSBAREND ) ) ) @@ -1418,12 +1418,12 @@ void PCB_POINT_EDITOR::updateItem() const { vert = std::abs( direction.y ) < std::abs( direction.x ); } - dimension->SetOrientation( vert ? ORTHOGONAL_DIMENSION::DIR::VERTICAL - : ORTHOGONAL_DIMENSION::DIR::HORIZONTAL ); + dimension->SetOrientation( vert ? PCB_DIM_ORTHOGONAL::DIR::VERTICAL + : PCB_DIM_ORTHOGONAL::DIR::HORIZONTAL ); } else { - vert = dimension->GetOrientation() == ORTHOGONAL_DIMENSION::DIR::VERTICAL; + vert = dimension->GetOrientation() == PCB_DIM_ORTHOGONAL::DIR::VERTICAL; } dimension->SetHeight( vert ? featureLine.x : featureLine.y ); @@ -1452,7 +1452,7 @@ void PCB_POINT_EDITOR::updateItem() const case PCB_DIM_CENTER_T: { - CENTER_DIMENSION* dimension = static_cast( item ); + PCB_DIM_CENTER* dimension = static_cast( item ); if( isModified( m_editPoints->Point( DIM_START ) ) ) { @@ -1472,7 +1472,7 @@ void PCB_POINT_EDITOR::updateItem() const case PCB_DIM_LEADER_T: { - LEADER* dimension = static_cast( item ); + PCB_DIM_LEADER* dimension = static_cast( item ); if( isModified( m_editPoints->Point( DIM_START ) ) ) { @@ -1723,7 +1723,7 @@ void PCB_POINT_EDITOR::updatePoints() case PCB_DIM_ALIGNED_T: case PCB_DIM_ORTHOGONAL_T: { - const ALIGNED_DIMENSION* dimension = static_cast( item ); + const PCB_DIM_ALIGNED* dimension = static_cast( item ); m_editPoints->Point( DIM_START ).SetPosition( dimension->GetStart() ); m_editPoints->Point( DIM_END ).SetPosition( dimension->GetEnd() ); @@ -1735,7 +1735,7 @@ void PCB_POINT_EDITOR::updatePoints() case PCB_DIM_CENTER_T: { - const CENTER_DIMENSION* dimension = static_cast( item ); + const PCB_DIM_CENTER* dimension = static_cast( item ); m_editPoints->Point( DIM_START ).SetPosition( dimension->GetStart() ); m_editPoints->Point( DIM_END ).SetPosition( dimension->GetEnd() ); @@ -1744,7 +1744,7 @@ void PCB_POINT_EDITOR::updatePoints() case PCB_DIM_LEADER_T: { - const LEADER* dimension = static_cast( item ); + const PCB_DIM_LEADER* dimension = static_cast( item ); m_editPoints->Point( DIM_START ).SetPosition( dimension->GetStart() ); m_editPoints->Point( DIM_END ).SetPosition( dimension->GetEnd() ); diff --git a/pcbnew/undo_redo.cpp b/pcbnew/undo_redo.cpp index c2f52e855a..48e89b037b 100644 --- a/pcbnew/undo_redo.cpp +++ b/pcbnew/undo_redo.cpp @@ -35,7 +35,7 @@ using namespace std::placeholders; #include #include #include -#include +#include #include #include #include