From 75ffce1a0be4cfadd5072e907f038c497811ee0c Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sat, 12 Sep 2020 16:09:40 -0400 Subject: [PATCH] ADDED: Leader dimension object Fixes https://gitlab.com/kicad/code/kicad/-/issues/5555 --- .../3d_canvas/create_3Dgraphic_brd_items.cpp | 46 +- 3d-viewer/3d_canvas/create_layer_items.cpp | 6 +- bitmaps_png/CMakeLists.txt | 4 +- bitmaps_png/cpp_26/add_aligned_dimension.cpp | 55 ++ bitmaps_png/cpp_26/add_leader.cpp | 53 ++ bitmaps_png/cpp_26/zoom_fit_to_objects.cpp | 70 +-- .../include/bitmaps_png/bitmaps_list.h | 4 +- bitmaps_png/sources/add_aligned_dimension.svg | 248 +++++++++ bitmaps_png/sources/add_leader.svg | 244 +++++++++ common/base_struct.cpp | 3 +- common/pcb.keywords | 2 + include/core/typeinfo.h | 8 +- pcbnew/array_creator.cpp | 3 +- pcbnew/board_commit.cpp | 3 +- pcbnew/class_board.cpp | 15 +- pcbnew/class_dimension.cpp | 269 ++++++--- pcbnew/class_dimension.h | 116 +++- pcbnew/class_pcb_text.cpp | 2 +- pcbnew/collectors.cpp | 17 +- .../dialogs/dialog_dimension_properties.cpp | 61 ++- pcbnew/dialogs/dialog_dimension_properties.h | 3 + .../dialog_dimension_properties_base.cpp | 104 ++-- .../dialog_dimension_properties_base.fbp | 516 ++++++++++++++++-- .../dialog_dimension_properties_base.h | 13 +- pcbnew/drc/drc_test_provider.cpp | 2 +- pcbnew/edit.cpp | 3 +- pcbnew/exporters/gen_drill_report_files.cpp | 3 +- pcbnew/kicad_plugin.cpp | 36 +- pcbnew/kicad_plugin.h | 7 +- pcbnew/menubar_pcb_editor.cpp | 3 +- pcbnew/pcb_edit_frame.cpp | 3 +- pcbnew/pcb_painter.cpp | 27 +- pcbnew/pcb_parser.cpp | 52 +- pcbnew/plot_brditems_plotter.cpp | 44 +- pcbnew/toolbars_pcb_editor.cpp | 4 +- pcbnew/tools/drawing_tool.cpp | 88 ++- pcbnew/tools/edit_tool.cpp | 3 +- pcbnew/tools/grid_helper.cpp | 11 +- pcbnew/tools/pcb_actions.cpp | 11 +- pcbnew/tools/pcb_actions.h | 3 +- pcbnew/tools/pcb_viewer_tools.cpp | 4 +- pcbnew/tools/point_editor.cpp | 64 ++- pcbnew/tools/selection_tool.cpp | 6 +- 43 files changed, 1916 insertions(+), 323 deletions(-) create mode 100644 bitmaps_png/cpp_26/add_aligned_dimension.cpp create mode 100644 bitmaps_png/cpp_26/add_leader.cpp create mode 100644 bitmaps_png/sources/add_aligned_dimension.svg create mode 100644 bitmaps_png/sources/add_leader.svg diff --git a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp index 0ebbe541a2..bf7fd87a29 100644 --- a/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp +++ b/3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp @@ -138,19 +138,47 @@ void BOARD_ADAPTER::AddShapeWithClearanceToContainer( const DIMENSION* aDimensio const int linewidth = aDimension->GetLineThickness() + (2 * aClearanceValue); - for( const SEG& seg : aDimension->GetLines() ) + for( const std::shared_ptr& shape : aDimension->GetShapes() ) { - const SFVEC2F start3DU( seg.A.x * m_biuTo3Dunits, - -seg.A.y * m_biuTo3Dunits ); + switch( shape->Type() ) + { + case SH_SEGMENT: + { + const SEG& seg = static_cast( shape.get() )->GetSeg(); - const SFVEC2F end3DU ( seg.B.x * m_biuTo3Dunits, - -seg.B.y * m_biuTo3Dunits ); + const SFVEC2F start3DU( seg.A.x * m_biuTo3Dunits, + -seg.A.y * m_biuTo3Dunits ); + + const SFVEC2F end3DU ( seg.B.x * m_biuTo3Dunits, + -seg.B.y * m_biuTo3Dunits ); + + aDstContainer->Add( new CROUNDSEGMENT2D( start3DU, + end3DU, + linewidth * m_biuTo3Dunits, + *aDimension ) ); + break; + } + + case SH_CIRCLE: + { + int radius = static_cast( shape.get() )->GetRadius(); + int deltar = aDimension->GetLineThickness(); + + SFVEC2F center( shape->Centre().x * m_biuTo3Dunits, + shape->Centre().y * m_biuTo3Dunits ); + + aDstContainer->Add( new CRING2D( center, ( radius - deltar ) * m_biuTo3Dunits, + ( radius + deltar ) * m_biuTo3Dunits, *aDimension ) ); + + break; + } + + default: + break; + } - aDstContainer->Add( new CROUNDSEGMENT2D( start3DU, - end3DU, - linewidth * m_biuTo3Dunits, - *aDimension ) ); } + } diff --git a/3d-viewer/3d_canvas/create_layer_items.cpp b/3d-viewer/3d_canvas/create_layer_items.cpp index e9bf334eb6..a40a450494 100644 --- a/3d-viewer/3d_canvas/create_layer_items.cpp +++ b/3d-viewer/3d_canvas/create_layer_items.cpp @@ -628,7 +628,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) 0 ); break; - case PCB_DIMENSION_T: + case PCB_DIM_ALIGNED_T: + case PCB_DIM_LEADER_T: AddShapeWithClearanceToContainer( (DIMENSION*) item, layerContainer, curr_layer_id, @@ -911,7 +912,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) 0 ); break; - case PCB_DIMENSION_T: + case PCB_DIM_ALIGNED_T: + case PCB_DIM_LEADER_T: AddShapeWithClearanceToContainer( (DIMENSION*) item, layerContainer, curr_layer_id, diff --git a/bitmaps_png/CMakeLists.txt b/bitmaps_png/CMakeLists.txt index 070fe6092b..75a3dec183 100644 --- a/bitmaps_png/CMakeLists.txt +++ b/bitmaps_png/CMakeLists.txt @@ -111,6 +111,7 @@ set( BMAPS_SMALL # image basenames that go into the toolbar sized destinations, i.e. 26x26 set( BMAPS_MID about + add_aligned_dimension add_arc add_board add_bus2bus @@ -119,7 +120,6 @@ set( BMAPS_MID add_component add_corner add_dashed_line - add_dimension add_document add_gerber add_glabel @@ -130,10 +130,12 @@ set( BMAPS_MID add_hierarchical_subsheet add_junction add_keepout_area + add_leader add_library add_line2bus add_line_label add_line + add_orthogonal_dimension add_pcb_target add_power add_rectangle diff --git a/bitmaps_png/cpp_26/add_aligned_dimension.cpp b/bitmaps_png/cpp_26/add_aligned_dimension.cpp new file mode 100644 index 0000000000..4b4ae201ef --- /dev/null +++ b/bitmaps_png/cpp_26/add_aligned_dimension.cpp @@ -0,0 +1,55 @@ + +/* Do not modify this file, it was automatically generated by the + * PNG2cpp CMake script, using a *.png file as input. + */ + +#include + +static const unsigned char png[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x1a, 0x08, 0x06, 0x00, 0x00, 0x00, 0xa9, 0x4a, 0x4c, + 0xce, 0x00, 0x00, 0x02, 0x5d, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0xb5, 0x95, 0xcf, 0x8b, 0x12, + 0x61, 0x18, 0xc7, 0x1d, 0xd3, 0x09, 0x37, 0x94, 0x20, 0xa3, 0x29, 0x64, 0x0f, 0x61, 0xfe, 0x36, + 0x5c, 0x64, 0x2d, 0xaa, 0x1d, 0x5a, 0xea, 0x50, 0x43, 0xc8, 0xb6, 0x30, 0xb3, 0xb4, 0x09, 0xe5, + 0xf8, 0xbe, 0x9a, 0xe3, 0x4a, 0xd7, 0x20, 0x2c, 0x3a, 0x19, 0x44, 0x4b, 0xf4, 0x0f, 0xd4, 0x61, + 0xab, 0x43, 0x97, 0xba, 0x49, 0x51, 0x87, 0xe8, 0xd4, 0x25, 0x88, 0xa2, 0x20, 0x22, 0x88, 0xb6, + 0x58, 0x88, 0x56, 0x16, 0xb4, 0x8d, 0xca, 0xe9, 0xfb, 0x84, 0xc6, 0x06, 0x46, 0x4a, 0x33, 0x03, + 0x1f, 0xd4, 0x79, 0xdf, 0x79, 0x3f, 0xf3, 0x7d, 0xdf, 0xe7, 0x7d, 0x75, 0x38, 0x06, 0xbb, 0x84, + 0x48, 0x24, 0x72, 0x21, 0x1c, 0x0e, 0x9f, 0x76, 0xd8, 0x78, 0xad, 0x83, 0xe4, 0x1a, 0x30, 0xa3, + 0xd1, 0x68, 0xcd, 0x16, 0x43, 0x3c, 0x1e, 0x17, 0x21, 0xb8, 0x4d, 0x12, 0xa4, 0xb9, 0x68, 0x8b, + 0x24, 0x9d, 0x4e, 0x8f, 0x40, 0xd0, 0x00, 0x9d, 0x40, 0x20, 0x70, 0xc9, 0x16, 0x49, 0x2a, 0x95, + 0xda, 0x08, 0xc1, 0x63, 0xf0, 0x1d, 0xd3, 0xc5, 0x5c, 0x2e, 0xd7, 0xbc, 0x28, 0x8a, 0x8b, 0x68, + 0x3a, 0xf0, 0x5f, 0x03, 0xeb, 0xba, 0xbe, 0xad, 0x54, 0x2a, 0x15, 0x09, 0x45, 0x51, 0x92, 0x98, + 0xa6, 0xa7, 0x90, 0x7c, 0xc5, 0xa7, 0x4a, 0xed, 0x1e, 0x8f, 0x67, 0x54, 0x10, 0x84, 0x0e, 0xbe, + 0x9a, 0xe0, 0x3e, 0xc8, 0x0c, 0x2d, 0x61, 0x8c, 0xed, 0x66, 0x06, 0x5b, 0x99, 0xaa, 0x6b, 0x2d, + 0xd0, 0xce, 0x97, 0xf4, 0x1f, 0x99, 0x4c, 0xe6, 0x0b, 0x24, 0x87, 0xfe, 0x28, 0x3b, 0x41, 0xb8, + 0xd3, 0x15, 0x11, 0x24, 0xbd, 0x4e, 0xef, 0x30, 0x78, 0x9a, 0xb9, 0xc2, 0x8b, 0x89, 0x1b, 0x8a, + 0x19, 0x7b, 0xb4, 0xef, 0x17, 0xf2, 0x82, 0x62, 0x9e, 0x2c, 0xe7, 0xdf, 0xf4, 0xe9, 0x7a, 0x90, + 0x24, 0x94, 0xcc, 0xe7, 0xf3, 0xdd, 0xa5, 0x6a, 0x1c, 0x2a, 0x11, 0x3f, 0xc5, 0x57, 0x93, 0x0f, + 0xe5, 0xdf, 0xa2, 0xe4, 0x03, 0xd9, 0xa4, 0x7b, 0xfd, 0xf6, 0x12, 0x78, 0x85, 0xf5, 0x3a, 0x8f, + 0x69, 0x7d, 0x8b, 0xc4, 0xfa, 0x50, 0xa2, 0x7c, 0xa5, 0xf0, 0x7c, 0x62, 0xe1, 0xf0, 0xda, 0x44, + 0x9d, 0x7c, 0x45, 0x7f, 0xf6, 0x97, 0xee, 0x39, 0x20, 0xa2, 0x40, 0x76, 0x40, 0xb6, 0x08, 0xa6, + 0x07, 0x16, 0x15, 0x8b, 0xc5, 0x5d, 0xb4, 0x46, 0x47, 0xeb, 0x33, 0x2d, 0x82, 0x95, 0xd9, 0x0a, + 0xe7, 0x7c, 0xfc, 0x5f, 0xcf, 0x85, 0x42, 0xa1, 0x71, 0x88, 0x96, 0x20, 0x95, 0x87, 0x91, 0x6d, + 0xa5, 0x8a, 0x83, 0x80, 0x1b, 0x86, 0x21, 0x0d, 0xfa, 0x1c, 0xa6, 0x6f, 0x92, 0x64, 0xb1, 0x58, + 0x6c, 0xac, 0x7b, 0x4b, 0xb2, 0xed, 0x7c, 0x42, 0xa2, 0x29, 0xc8, 0x3e, 0x80, 0x10, 0x7e, 0xde, + 0xa4, 0xb0, 0xb6, 0xc9, 0x20, 0x39, 0x21, 0x49, 0xd2, 0x52, 0xb7, 0xec, 0xe7, 0xed, 0xf2, 0xec, + 0x01, 0xb7, 0xd6, 0xec, 0xb1, 0x65, 0x30, 0x62, 0x87, 0x48, 0xa4, 0x65, 0x06, 0x1f, 0x7b, 0x32, + 0xa7, 0xd3, 0x59, 0xee, 0x35, 0x26, 0x12, 0x89, 0x2d, 0x48, 0x5c, 0xb7, 0x52, 0xb8, 0x01, 0x9c, + 0x81, 0x64, 0xd5, 0xed, 0x76, 0x7f, 0xea, 0x56, 0xe6, 0x76, 0x48, 0x5e, 0x83, 0x96, 0xe5, 0xf1, + 0xbc, 0x5e, 0xef, 0x26, 0x6c, 0xea, 0xcb, 0x7e, 0xbf, 0xff, 0x08, 0x04, 0xef, 0xc1, 0x67, 0x54, + 0xe7, 0x5e, 0xbb, 0x2a, 0x51, 0x86, 0xa0, 0x49, 0xd5, 0x08, 0xc9, 0x4e, 0x5b, 0x24, 0x18, 0x38, + 0x0b, 0x41, 0x1b, 0xbc, 0xc4, 0x1f, 0xe7, 0xa8, 0x25, 0x83, 0x56, 0xab, 0xd5, 0xf5, 0xac, 0xc2, + 0xaf, 0xe2, 0x64, 0x69, 0x12, 0x5a, 0x4e, 0xbb, 0x87, 0xcd, 0xfb, 0x0d, 0x92, 0x27, 0xc1, 0x60, + 0x70, 0xb3, 0x65, 0x6f, 0x4f, 0x12, 0xed, 0xdc, 0x6c, 0x7b, 0xac, 0x31, 0x69, 0xa6, 0x1a, 0xfb, + 0x4d, 0xf5, 0xec, 0x31, 0x33, 0x3b, 0x9d, 0x7d, 0x87, 0x54, 0x5e, 0x4b, 0xa7, 0x89, 0x52, 0x90, + 0xa0, 0x77, 0x20, 0x93, 0x90, 0x19, 0xbc, 0x69, 0xf9, 0x7a, 0xf4, 0x15, 0x55, 0xd8, 0xb2, 0xe5, + 0xa2, 0xc2, 0x1c, 0xbf, 0x32, 0x53, 0x3b, 0xde, 0x26, 0x19, 0x49, 0xb4, 0x5a, 0xae, 0x55, 0x30, + 0xb8, 0xf5, 0x47, 0x10, 0x15, 0x03, 0xc9, 0x28, 0x05, 0x41, 0x12, 0x55, 0x55, 0xc5, 0x7e, 0x7d, + 0x7f, 0x02, 0x6c, 0xe9, 0xe3, 0xa9, 0x6e, 0x3e, 0xbd, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, + 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, +}; + +const BITMAP_OPAQUE add_aligned_dimension_xpm[1] = {{ png, sizeof( png ), "add_aligned_dimension_xpm" }}; + +//EOF diff --git a/bitmaps_png/cpp_26/add_leader.cpp b/bitmaps_png/cpp_26/add_leader.cpp new file mode 100644 index 0000000000..2a33e06282 --- /dev/null +++ b/bitmaps_png/cpp_26/add_leader.cpp @@ -0,0 +1,53 @@ + +/* Do not modify this file, it was automatically generated by the + * PNG2cpp CMake script, using a *.png file as input. + */ + +#include + +static const unsigned char png[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x1a, 0x08, 0x06, 0x00, 0x00, 0x00, 0xa9, 0x4a, 0x4c, + 0xce, 0x00, 0x00, 0x02, 0x45, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0xc5, 0x94, 0x3d, 0x68, 0x13, + 0x61, 0x1c, 0x87, 0x13, 0x1a, 0x4c, 0x17, 0x11, 0xa2, 0x46, 0x1c, 0x8c, 0x31, 0x89, 0xb9, 0xe4, + 0x42, 0xa5, 0x3a, 0x39, 0x44, 0xa9, 0xa2, 0xd0, 0x41, 0xaa, 0x60, 0x49, 0xa1, 0x75, 0x91, 0x26, + 0x42, 0x1b, 0xe3, 0x26, 0xba, 0xb4, 0x53, 0x41, 0x5c, 0x44, 0x0a, 0x0e, 0x0e, 0x8e, 0x22, 0x4e, + 0x56, 0x10, 0x8c, 0xa8, 0x8b, 0x83, 0x48, 0x51, 0x10, 0x0b, 0x7e, 0x0c, 0x8a, 0x20, 0x08, 0x52, + 0xd0, 0x8a, 0x26, 0x62, 0xad, 0x39, 0x9f, 0x9f, 0xbc, 0x07, 0x47, 0x89, 0x36, 0xd4, 0x3b, 0x3c, + 0x78, 0x78, 0xff, 0x79, 0xbf, 0x9e, 0xf7, 0xeb, 0x9f, 0x50, 0xad, 0x56, 0x8b, 0x96, 0xab, 0x95, + 0xe9, 0xf2, 0x78, 0x79, 0x41, 0x8c, 0x9e, 0xac, 0x5c, 0x54, 0x5d, 0xc8, 0xef, 0x4f, 0x92, 0xd2, + 0xe4, 0x70, 0x73, 0x67, 0x7d, 0x9f, 0xd3, 0x5b, 0xef, 0x73, 0x4a, 0x93, 0xc7, 0x1a, 0x92, 0xf9, + 0x2f, 0x62, 0x17, 0x12, 0xd8, 0x0f, 0x8a, 0xbf, 0x91, 0xb0, 0x5c, 0x2d, 0x7f, 0x0a, 0x54, 0xb4, + 0xe5, 0x9c, 0x1d, 0x9c, 0x48, 0xc7, 0x34, 0x34, 0x31, 0xd2, 0x94, 0x6c, 0xed, 0xae, 0x98, 0x53, + 0x28, 0xf6, 0x2c, 0x8e, 0x8e, 0x57, 0x2e, 0xf8, 0x2e, 0xd2, 0xc5, 0x4b, 0xa6, 0x5d, 0xc4, 0x37, + 0xc5, 0x97, 0xa8, 0x72, 0xa2, 0xd1, 0xe8, 0xe9, 0x50, 0x90, 0x5f, 0x24, 0x12, 0xb9, 0x21, 0x11, + 0xb4, 0x60, 0x38, 0x48, 0xd7, 0xb4, 0x11, 0x09, 0xed, 0x6e, 0x30, 0x28, 0xd1, 0x94, 0x47, 0x24, + 0xbe, 0x43, 0x7f, 0x10, 0xa2, 0x33, 0xcb, 0x44, 0xa2, 0x01, 0x7b, 0xfc, 0x16, 0x8d, 0x79, 0x25, + 0xe1, 0x70, 0x78, 0x9e, 0x72, 0x06, 0xae, 0x40, 0xcc, 0x4f, 0xd1, 0x88, 0x11, 0xcc, 0x25, 0x12, + 0x89, 0x6f, 0xb9, 0x5c, 0xee, 0x72, 0x50, 0x77, 0x34, 0x00, 0x57, 0xf5, 0x00, 0x25, 0x81, 0x26, + 0xac, 0x0f, 0x42, 0x94, 0x84, 0x6e, 0x05, 0xb6, 0x6d, 0x17, 0x90, 0xb4, 0x2c, 0xcb, 0xfa, 0x6b, + 0x4e, 0x65, 0x32, 0x99, 0x8d, 0xf9, 0x7c, 0x7e, 0x8a, 0xbe, 0x8f, 0xe1, 0x3d, 0xcc, 0x31, 0xe6, + 0x12, 0x58, 0x1d, 0x5b, 0x19, 0x74, 0x1f, 0xde, 0x12, 0x76, 0xb5, 0x6b, 0x47, 0x70, 0x80, 0xf6, + 0x8f, 0xf0, 0x83, 0x79, 0xef, 0xe9, 0x14, 0xa8, 0x9b, 0xa1, 0xfc, 0x02, 0x8b, 0xd4, 0x8d, 0x75, + 0x24, 0x62, 0xd0, 0x11, 0x06, 0x38, 0x2a, 0xdb, 0x2c, 0xa2, 0x07, 0xbe, 0xc2, 0x53, 0xda, 0xb7, + 0x7b, 0xdb, 0xb2, 0xd9, 0xec, 0x06, 0x23, 0x6c, 0xc1, 0xd1, 0x4e, 0x5c, 0x5d, 0x74, 0x7c, 0xa3, + 0x9d, 0xb5, 0x11, 0xdd, 0x86, 0x0f, 0x1c, 0x9d, 0x4d, 0xf9, 0x1a, 0x6e, 0xaa, 0x9e, 0x5d, 0xec, + 0x37, 0xbf, 0x93, 0xf0, 0x08, 0xde, 0x15, 0x0a, 0x85, 0x35, 0x2b, 0x9a, 0x74, 0x47, 0xda, 0x15, + 0xe5, 0x0e, 0xef, 0x8a, 0xa9, 0x5b, 0x62, 0xd5, 0x13, 0xb0, 0x59, 0xed, 0x86, 0x43, 0x06, 0xf5, + 0xdf, 0xe6, 0xc6, 0x3a, 0xe2, 0x15, 0x45, 0xac, 0x26, 0x46, 0xe7, 0x06, 0xbc, 0x82, 0xbb, 0x82, + 0x49, 0x66, 0xcd, 0x04, 0x07, 0x3d, 0xa2, 0x3b, 0xf0, 0x8c, 0xb6, 0x01, 0x57, 0x64, 0xc6, 0x2a, + 0x3e, 0xd5, 0xd1, 0x5d, 0xd1, 0xf1, 0xb8, 0x2b, 0x31, 0xcc, 0x9a, 0x09, 0xfa, 0x5d, 0x11, 0xe5, + 0x10, 0x3c, 0x27, 0xbe, 0xe6, 0x8a, 0xd2, 0xe9, 0x74, 0xdc, 0xb4, 0x55, 0x57, 0x95, 0x03, 0xa9, + 0x54, 0x6a, 0x9d, 0x79, 0x55, 0xe7, 0x5d, 0x11, 0xf1, 0x20, 0x94, 0x88, 0x7f, 0xba, 0x22, 0xc9, + 0x15, 0x73, 0xd4, 0xc5, 0x55, 0x27, 0x1c, 0x93, 0x5c, 0x67, 0x92, 0xcf, 0x94, 0xbb, 0x5d, 0x11, + 0xd5, 0x61, 0x93, 0x4f, 0x8e, 0xf2, 0xd0, 0xec, 0xf0, 0xe5, 0x9f, 0xd2, 0xa3, 0x53, 0xd1, 0x56, + 0x26, 0x99, 0x57, 0x9e, 0x11, 0xef, 0x5d, 0x76, 0xd4, 0x16, 0xf5, 0x0f, 0x95, 0x5f, 0xd0, 0xf7, + 0xcf, 0x7f, 0x23, 0x5c, 0x76, 0xaf, 0x79, 0xfe, 0x7a, 0x0c, 0x2f, 0xe0, 0x16, 0x3c, 0x31, 0xc7, + 0xb7, 0x80, 0xef, 0xb0, 0x7f, 0xff, 0x59, 0xc9, 0x64, 0x37, 0x93, 0x9e, 0x30, 0x09, 0xaa, 0x47, + 0x52, 0x87, 0xb3, 0x4a, 0x81, 0xd0, 0xff, 0xf8, 0x7e, 0x01, 0x36, 0x6c, 0xfa, 0x28, 0xb6, 0x73, + 0xfe, 0xed, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, +}; + +const BITMAP_OPAQUE add_leader_xpm[1] = {{ png, sizeof( png ), "add_leader_xpm" }}; + +//EOF diff --git a/bitmaps_png/cpp_26/zoom_fit_to_objects.cpp b/bitmaps_png/cpp_26/zoom_fit_to_objects.cpp index 2e2a5ec5dd..6737615578 100644 --- a/bitmaps_png/cpp_26/zoom_fit_to_objects.cpp +++ b/bitmaps_png/cpp_26/zoom_fit_to_objects.cpp @@ -8,43 +8,43 @@ static const unsigned char png[] = { 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x1a, 0x08, 0x04, 0x00, 0x00, 0x00, 0x03, 0x43, 0x84, - 0x45, 0x00, 0x00, 0x02, 0x29, 0x49, 0x44, 0x41, 0x54, 0x38, 0xcb, 0xd5, 0x94, 0xc1, 0x6f, 0x12, + 0x45, 0x00, 0x00, 0x02, 0x2a, 0x49, 0x44, 0x41, 0x54, 0x38, 0xcb, 0xd5, 0x94, 0xc1, 0x6f, 0x12, 0x41, 0x14, 0xc6, 0x37, 0x31, 0x5e, 0xb4, 0xa5, 0x5e, 0xf8, 0x17, 0x5a, 0xef, 0x93, 0x62, 0x04, - 0x8c, 0x97, 0x26, 0xa4, 0x91, 0x84, 0x80, 0xb1, 0x37, 0x7a, 0x72, 0x5d, 0xbd, 0x78, 0x20, 0x31, + 0x8c, 0x97, 0x26, 0xa4, 0x91, 0x84, 0x80, 0xa9, 0x37, 0x7a, 0x72, 0x5d, 0xbd, 0x78, 0x20, 0x31, 0x1e, 0x5c, 0xf4, 0xd6, 0xea, 0x6d, 0x6d, 0x57, 0x84, 0x26, 0x55, 0xd3, 0x78, 0x28, 0x85, 0xb6, - 0x1a, 0x96, 0x18, 0x12, 0x83, 0x46, 0x4c, 0x49, 0x04, 0xd3, 0x66, 0xb9, 0x40, 0xcf, 0xd6, 0xad, - 0x3d, 0x58, 0x20, 0xa1, 0x97, 0x4d, 0xe7, 0x73, 0x66, 0xa1, 0x48, 0xcb, 0x56, 0xf1, 0xe8, 0x7e, - 0x97, 0xdd, 0xc9, 0xfc, 0xf6, 0xbd, 0xf7, 0xbd, 0x37, 0x23, 0x08, 0xff, 0xe3, 0x83, 0x21, 0x5c, - 0x64, 0x3a, 0x3f, 0xe8, 0xf6, 0x91, 0xd4, 0xaa, 0xb2, 0x1b, 0x35, 0x45, 0x88, 0x88, 0x9a, 0x8a, - 0xb1, 0x92, 0x86, 0xe3, 0x2f, 0xc8, 0xdb, 0x47, 0x33, 0x07, 0x6e, 0x10, 0x78, 0x70, 0x9d, 0xa9, - 0xfd, 0x36, 0xdb, 0x5a, 0x97, 0xff, 0x80, 0x24, 0x5f, 0x87, 0x29, 0xc1, 0x1d, 0x1a, 0xaf, 0x66, - 0x55, 0x3d, 0xa0, 0x07, 0xb4, 0x58, 0xa2, 0x2a, 0xb1, 0x95, 0x30, 0x5d, 0x5e, 0x3a, 0x35, 0x4a, - 0x98, 0xba, 0xf0, 0x6c, 0xbf, 0x38, 0xd1, 0xbb, 0xba, 0xe1, 0x53, 0xeb, 0x2e, 0x4c, 0x53, 0xdb, - 0x68, 0x18, 0x99, 0x39, 0x20, 0x50, 0xf7, 0xe5, 0xdc, 0xbd, 0x9f, 0xc7, 0x25, 0xe7, 0xd4, 0x3a, - 0x61, 0x49, 0xda, 0xd4, 0xb6, 0xb2, 0xea, 0xc6, 0x6d, 0x5a, 0x9c, 0x88, 0x34, 0x34, 0x94, 0x90, - 0x67, 0xfa, 0x88, 0x32, 0x93, 0x86, 0x48, 0xa3, 0x38, 0x29, 0x51, 0x0f, 0x52, 0xa9, 0x3e, 0x48, - 0xd9, 0x25, 0x88, 0x57, 0x05, 0x21, 0xd2, 0xd8, 0xc2, 0x37, 0x66, 0x00, 0xc1, 0x15, 0x34, 0x99, - 0xb6, 0x18, 0x24, 0x08, 0x89, 0x1a, 0xc1, 0x53, 0xe3, 0x64, 0x72, 0xc3, 0xb2, 0xe9, 0x45, 0x66, - 0xbe, 0x0d, 0xed, 0xe0, 0x2a, 0xbc, 0xb8, 0x86, 0x6d, 0xac, 0xe1, 0xbd, 0x05, 0x65, 0x62, 0x1e, - 0xd6, 0x80, 0x13, 0x7d, 0xc3, 0x98, 0x48, 0x43, 0xd0, 0x03, 0x6d, 0xa8, 0xd9, 0xd1, 0x1a, 0x8b, - 0x17, 0xb7, 0xa0, 0x4a, 0x28, 0x88, 0x5b, 0x14, 0xa3, 0xc7, 0xa1, 0x51, 0x91, 0x06, 0x51, 0x09, - 0x72, 0x68, 0x13, 0x85, 0x8e, 0xf4, 0x6e, 0xa4, 0xcd, 0x1b, 0x41, 0x88, 0x7d, 0xd0, 0x10, 0x4f, - 0x4f, 0xb3, 0xd2, 0x2b, 0x59, 0x15, 0x71, 0x95, 0xbb, 0x35, 0x65, 0x62, 0x6e, 0xc8, 0x66, 0x9f, - 0x7f, 0xdc, 0x88, 0x85, 0x1a, 0x87, 0xca, 0x18, 0xef, 0xe8, 0xeb, 0x6f, 0x23, 0xb6, 0x09, 0x14, - 0xa3, 0xdf, 0xf2, 0xb4, 0x07, 0x12, 0xdd, 0xf0, 0x71, 0xcb, 0xcb, 0x3d, 0xe2, 0x96, 0x17, 0xfc, - 0xd2, 0xa1, 0x17, 0xe9, 0x64, 0x7f, 0x73, 0x1d, 0xb3, 0x2d, 0x82, 0x79, 0x9b, 0xe6, 0x46, 0x73, - 0x73, 0x4d, 0x82, 0x27, 0x2d, 0x5c, 0xb0, 0x99, 0x89, 0x75, 0x99, 0x8f, 0x91, 0x5a, 0xff, 0x3c, - 0xd9, 0xbb, 0x5a, 0xf0, 0xcf, 0x35, 0x5d, 0xb8, 0x84, 0x6c, 0xe9, 0x94, 0xe9, 0x5b, 0x5e, 0x9a, - 0x66, 0xe3, 0x29, 0xd1, 0x44, 0x35, 0xfb, 0x5c, 0x0f, 0x54, 0x82, 0x5a, 0x7c, 0xa1, 0x26, 0x1d, - 0x12, 0x86, 0x10, 0x4c, 0x51, 0xed, 0xd3, 0x87, 0xfb, 0x38, 0x6b, 0x83, 0xbd, 0x79, 0xf0, 0xb8, - 0xe5, 0x61, 0x5b, 0xdc, 0x08, 0x31, 0xf1, 0xa3, 0xe1, 0x65, 0x89, 0xbd, 0xfb, 0x32, 0xc5, 0x7e, - 0x36, 0x0e, 0x1f, 0x5e, 0x7d, 0x37, 0x9c, 0x76, 0x83, 0xeb, 0x48, 0xa5, 0x14, 0xe3, 0xa1, 0x29, - 0xd2, 0x9b, 0x54, 0x66, 0x87, 0x30, 0x9d, 0xe4, 0xb5, 0x64, 0xf2, 0x97, 0xad, 0x26, 0xb8, 0xb0, - 0xb8, 0x67, 0x8b, 0x59, 0xe8, 0x39, 0x8c, 0xb1, 0xe3, 0x3e, 0x7c, 0xf4, 0x9d, 0xbf, 0xeb, 0xef, - 0xf4, 0x8e, 0x63, 0x83, 0x5e, 0x02, 0x67, 0x5e, 0xee, 0xb8, 0xba, 0xd8, 0xc0, 0x57, 0x8d, 0xe1, - 0x5c, 0xdc, 0x3b, 0xc2, 0xfe, 0xe1, 0x86, 0x32, 0x9c, 0x2f, 0x7e, 0xb4, 0xb1, 0x5f, 0xc5, 0xd8, - 0xb1, 0x0b, 0xd5, 0xd8, 0x0b, 0x57, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, - 0x60, 0x82, + 0x2a, 0x8b, 0x09, 0x89, 0x69, 0x8d, 0x98, 0x92, 0x08, 0xa6, 0x0d, 0x5c, 0xa0, 0x67, 0xeb, 0xd6, + 0x1e, 0x2c, 0x90, 0xd0, 0xcb, 0xa6, 0xf3, 0x39, 0xb3, 0x50, 0xa4, 0xdd, 0xad, 0xe2, 0xd1, 0xfd, + 0x2e, 0xbb, 0x93, 0xf9, 0xed, 0x7b, 0xef, 0x7b, 0x6f, 0x46, 0x10, 0xfe, 0xc7, 0x07, 0x03, 0xb8, + 0xc8, 0x74, 0xbe, 0xdf, 0xed, 0x43, 0xa9, 0x65, 0x65, 0x37, 0x6a, 0x88, 0x10, 0x11, 0x35, 0x14, + 0x7d, 0x29, 0x0d, 0xc7, 0x5f, 0x90, 0xb7, 0x8f, 0xa6, 0x0e, 0xdc, 0x20, 0xf0, 0xe0, 0x3a, 0x53, + 0xfb, 0x6d, 0xba, 0xb5, 0x2a, 0xff, 0x01, 0x49, 0xbe, 0x0e, 0x53, 0x82, 0x3b, 0x34, 0x5e, 0xcd, + 0xaa, 0xe5, 0x40, 0x39, 0xa0, 0xc5, 0x12, 0x55, 0x89, 0xad, 0x84, 0xe9, 0xe2, 0xc2, 0xa9, 0x51, + 0xc2, 0xd4, 0x85, 0x67, 0xfb, 0x85, 0xb1, 0xde, 0xd5, 0x0d, 0x9f, 0x5a, 0x77, 0x61, 0x92, 0xda, + 0x46, 0xc3, 0xd0, 0xd4, 0x01, 0x81, 0xba, 0x2f, 0xe7, 0xee, 0xfd, 0x3c, 0x2e, 0x39, 0xa7, 0xd6, + 0x09, 0x4b, 0xd2, 0xa6, 0xb6, 0xa5, 0x65, 0x37, 0x6e, 0xd3, 0xc2, 0x58, 0xa4, 0xa1, 0xa1, 0x88, + 0x35, 0xa6, 0x8f, 0x28, 0x31, 0x69, 0x88, 0x34, 0x0a, 0xe3, 0x12, 0xf5, 0x20, 0x95, 0xb2, 0x40, + 0xca, 0x2e, 0x41, 0xbc, 0x2a, 0x08, 0x91, 0xc6, 0x16, 0xbe, 0x31, 0x03, 0x08, 0xae, 0xa0, 0xc9, + 0xb4, 0xc5, 0x20, 0x41, 0x48, 0xd4, 0x08, 0x9e, 0xea, 0x27, 0x93, 0x1b, 0x94, 0x0d, 0x2f, 0x32, + 0xb3, 0x6d, 0x68, 0x07, 0x57, 0xe1, 0xc5, 0x35, 0x6c, 0x63, 0x05, 0x1f, 0x4c, 0x28, 0x13, 0xf3, + 0xb0, 0x06, 0x9c, 0xe8, 0x1b, 0x46, 0x44, 0x1a, 0x42, 0x39, 0xd0, 0x86, 0x9a, 0x1d, 0xad, 0xb0, + 0x78, 0x71, 0x13, 0xaa, 0x84, 0x82, 0xb8, 0x45, 0x31, 0x7c, 0x1c, 0x1a, 0x16, 0x69, 0x10, 0x95, + 0x20, 0x87, 0x36, 0x91, 0xef, 0xa8, 0xdc, 0x8d, 0xb4, 0x39, 0x11, 0x84, 0x68, 0x81, 0x06, 0x78, + 0x7a, 0x9a, 0x99, 0x5e, 0xd1, 0xac, 0x88, 0xab, 0xd4, 0xad, 0x29, 0x13, 0x73, 0x43, 0x36, 0x2c, + 0xfe, 0x71, 0x23, 0xe6, 0x6a, 0x1c, 0x2a, 0x61, 0xb4, 0xa3, 0xaf, 0xbf, 0x8d, 0xd8, 0x26, 0x50, + 0x74, 0xab, 0xe5, 0x69, 0x0f, 0x24, 0xba, 0xe1, 0xe3, 0x96, 0x97, 0x7a, 0xc4, 0x2d, 0xcf, 0xfb, + 0xa5, 0x43, 0x2f, 0xd2, 0x49, 0x6b, 0x73, 0x1d, 0xd3, 0x2d, 0x82, 0x59, 0x9b, 0xe6, 0x46, 0x73, + 0x33, 0x4d, 0x82, 0x27, 0x2d, 0x5c, 0xb0, 0x99, 0x89, 0x55, 0x99, 0x8f, 0x91, 0x5a, 0xff, 0x3c, + 0xde, 0xbb, 0x9a, 0xf7, 0xcf, 0x34, 0x5d, 0xb8, 0x84, 0x6c, 0xf1, 0x94, 0xe9, 0x5b, 0x5c, 0x98, + 0x64, 0xe3, 0x29, 0xd1, 0x44, 0x35, 0xfb, 0xbc, 0x1c, 0xa8, 0x04, 0xb5, 0xf8, 0x5c, 0x4d, 0x3a, + 0x24, 0x0c, 0x21, 0xb8, 0x41, 0xb5, 0x4f, 0xeb, 0xf7, 0x71, 0xd6, 0x06, 0x7b, 0xf3, 0xe0, 0x71, + 0xcb, 0xc3, 0xb6, 0xb8, 0x11, 0x62, 0xe2, 0x47, 0xc3, 0xcb, 0x12, 0x7b, 0xff, 0x65, 0x82, 0xfd, + 0x6c, 0x14, 0x3e, 0xbc, 0xfa, 0xae, 0x3b, 0xed, 0x06, 0xd7, 0x91, 0x4a, 0x29, 0xfa, 0x43, 0x43, + 0xa4, 0x37, 0xa9, 0xcc, 0x0e, 0x61, 0x3a, 0xc9, 0x6b, 0x79, 0xb7, 0x7e, 0xd9, 0x6c, 0x82, 0x0b, + 0xf3, 0x7b, 0xb6, 0x98, 0x89, 0x9e, 0xc3, 0x08, 0x3b, 0xee, 0x83, 0x47, 0xdf, 0x6b, 0x77, 0xfd, + 0x9d, 0xde, 0x71, 0xac, 0xdf, 0x4b, 0xe0, 0xcc, 0xcb, 0x1d, 0x57, 0x17, 0xeb, 0xfb, 0xaa, 0xd1, + 0x9d, 0xf3, 0x7b, 0x47, 0xd8, 0x3f, 0xdc, 0x50, 0xba, 0xf3, 0xc5, 0x8f, 0x36, 0xf6, 0x0b, 0xc3, + 0xa7, 0xb1, 0x09, 0x45, 0x7d, 0xc0, 0x44, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, + 0x42, 0x60, 0x82, }; const BITMAP_OPAQUE zoom_fit_to_objects_xpm[1] = {{ png, sizeof( png ), "zoom_fit_to_objects_xpm" }}; diff --git a/bitmaps_png/include/bitmaps_png/bitmaps_list.h b/bitmaps_png/include/bitmaps_png/bitmaps_list.h index 782135d9f9..fb9e37d6b2 100644 --- a/bitmaps_png/include/bitmaps_png/bitmaps_list.h +++ b/bitmaps_png/include/bitmaps_png/bitmaps_list.h @@ -29,6 +29,7 @@ // may eventually generate this file automatically. EXTERN_BITMAP( about_xpm ) +EXTERN_BITMAP( add_aligned_dimension_xpm ) EXTERN_BITMAP( add_arc_xpm ) EXTERN_BITMAP( add_board_xpm ) EXTERN_BITMAP( add_bus2bus_xpm ) @@ -37,7 +38,6 @@ EXTERN_BITMAP( add_circle_xpm ) EXTERN_BITMAP( add_component_xpm ) EXTERN_BITMAP( add_corner_xpm ) EXTERN_BITMAP( add_dashed_line_xpm ) -EXTERN_BITMAP( add_dimension_xpm ) EXTERN_BITMAP( add_document_xpm ) EXTERN_BITMAP( add_gerber_xpm ) EXTERN_BITMAP( add_glabel_xpm ) @@ -48,10 +48,12 @@ EXTERN_BITMAP( add_hierarchical_subsheet_xpm ) EXTERN_BITMAP( add_hierar_pin_xpm ) EXTERN_BITMAP( add_junction_xpm ) EXTERN_BITMAP( add_keepout_area_xpm ) +EXTERN_BITMAP( add_leader_xpm ) EXTERN_BITMAP( add_library_xpm ) EXTERN_BITMAP( add_line2bus_xpm ) EXTERN_BITMAP( add_line_label_xpm ) EXTERN_BITMAP( add_line_xpm ) +EXTERN_BITMAP( add_orthogonal_dimension_xpm ) EXTERN_BITMAP( add_pcb_target_xpm ) EXTERN_BITMAP( add_power_xpm ) EXTERN_BITMAP( add_rectangle_xpm ) diff --git a/bitmaps_png/sources/add_aligned_dimension.svg b/bitmaps_png/sources/add_aligned_dimension.svg new file mode 100644 index 0000000000..406491edbc --- /dev/null +++ b/bitmaps_png/sources/add_aligned_dimension.svg @@ -0,0 +1,248 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bitmaps_png/sources/add_leader.svg b/bitmaps_png/sources/add_leader.svg new file mode 100644 index 0000000000..67e024f219 --- /dev/null +++ b/bitmaps_png/sources/add_leader.svg @@ -0,0 +1,244 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + N + diff --git a/common/base_struct.cpp b/common/base_struct.cpp index 43b6a38f30..6b31e8efeb 100644 --- a/common/base_struct.cpp +++ b/common/base_struct.cpp @@ -791,7 +791,8 @@ static struct EDA_ITEM_DESC .Map( PCB_TRACE_T, _( "Track" ) ) .Map( PCB_VIA_T, _( "Via" ) ) .Map( PCB_MARKER_T, _( "Board Marker" ) ) - .Map( PCB_DIMENSION_T, _( "Dimension" ) ) + .Map( PCB_DIM_ALIGNED_T, _( "Aligned Dimension" ) ) + .Map( PCB_DIM_LEADER_T, _( "Leader" ) ) .Map( PCB_TARGET_T, _( "Target" ) ) .Map( PCB_ZONE_AREA_T, _( "Zone" ) ) .Map( PCB_ITEM_LIST_T, _( "Item List" ) ) diff --git a/common/pcb.keywords b/common/pcb.keywords index 9173e4d942..dd4e2493f1 100644 --- a/common/pcb.keywords +++ b/common/pcb.keywords @@ -152,6 +152,7 @@ kicad_pcb last_trace_width layer layers +leader left linear links @@ -252,6 +253,7 @@ target title title_block tedit +text_frame text_position_mode thermal_width thermal_gap diff --git a/include/core/typeinfo.h b/include/core/typeinfo.h index e2493c4a74..9bbcab3a29 100644 --- a/include/core/typeinfo.h +++ b/include/core/typeinfo.h @@ -97,7 +97,9 @@ 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, a dimension (graphic item) + PCB_DIMENSION_T, ///< class DIMENSION: abstract dimension meta-type + PCB_DIM_ALIGNED_T, ///< class ALIGNED_DIMENSION, a linear dimension (graphic item) + PCB_DIM_LEADER_T, ///< class LEADER, a leader dimension (graphic item) PCB_TARGET_T, ///< class PCB_TARGET, a target (graphic item) PCB_ZONE_AREA_T, ///< class ZONE_CONTAINER, a zone area PCB_ITEM_LIST_T, ///< class BOARD_ITEM_LIST, a list of board items @@ -253,6 +255,10 @@ constexpr KICAD_T BaseType( const KICAD_T aType ) case PCB_LOCATE_NPTH_T: return PCB_LOCATE_HOLE_T; + case PCB_DIM_ALIGNED_T: + case PCB_DIM_LEADER_T: + return PCB_DIMENSION_T; + default: return aType; } diff --git a/pcbnew/array_creator.cpp b/pcbnew/array_creator.cpp index 6c7d314b6c..a2aef5ed64 100644 --- a/pcbnew/array_creator.cpp +++ b/pcbnew/array_creator.cpp @@ -113,7 +113,8 @@ void ARRAY_CREATOR::Invoke() case PCB_VIA_T: case PCB_ZONE_AREA_T: case PCB_TARGET_T: - case PCB_DIMENSION_T: + case PCB_DIM_ALIGNED_T: + case PCB_DIM_LEADER_T: new_item = item->Duplicate(); break; diff --git a/pcbnew/board_commit.cpp b/pcbnew/board_commit.cpp index 63058e3cf5..6f7d8c96b1 100644 --- a/pcbnew/board_commit.cpp +++ b/pcbnew/board_commit.cpp @@ -217,7 +217,8 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a case PCB_TRACE_T: // a track segment (segment on a copper layer) case PCB_ARC_T: // an arced track segment (segment on a copper layer) case PCB_VIA_T: // a via (like track segment on a copper layer) - case PCB_DIMENSION_T: // a dimension (graphic item) + case PCB_DIM_ALIGNED_T: // a dimension (graphic item) + case PCB_DIM_LEADER_T: // a leader dimension case PCB_TARGET_T: // a target (graphic item) case PCB_MARKER_T: // a marker used to show something case PCB_GROUP_T: // a group of items diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 4cd7f58450..4aae500a3a 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -214,7 +214,8 @@ void BOARD::Move( const wxPoint& aMoveVector ) // overload PCB_MARKER_T, PCB_TEXT_T, PCB_LINE_T, - PCB_DIMENSION_T, + PCB_DIM_ALIGNED_T, + PCB_DIM_LEADER_T, PCB_TARGET_T, PCB_VIA_T, PCB_TRACE_T, @@ -579,7 +580,8 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode ) break; - case PCB_DIMENSION_T: + case PCB_DIM_ALIGNED_T: + case PCB_DIM_LEADER_T: case PCB_LINE_T: case PCB_TEXT_T: case PCB_TARGET_T: @@ -666,7 +668,8 @@ void BOARD::Remove( BOARD_ITEM* aBoardItem ) } ) ); break; - case PCB_DIMENSION_T: + case PCB_DIM_ALIGNED_T: + case PCB_DIM_LEADER_T: case PCB_LINE_T: case PCB_TEXT_T: case PCB_TARGET_T: @@ -1003,7 +1006,8 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s case PCB_LINE_T: case PCB_TEXT_T: - case PCB_DIMENSION_T: + case PCB_DIM_ALIGNED_T: + case PCB_DIM_LEADER_T: case PCB_TARGET_T: result = IterateForward( m_drawings, inspector, testData, p ); @@ -1014,7 +1018,8 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s { case PCB_LINE_T: case PCB_TEXT_T: - case PCB_DIMENSION_T: + case PCB_DIM_ALIGNED_T: + case PCB_DIM_LEADER_T: case PCB_TARGET_T: continue; diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp index 7a37ac8f82..0cdd21eb8e 100644 --- a/pcbnew/class_dimension.cpp +++ b/pcbnew/class_dimension.cpp @@ -32,12 +32,15 @@ #include #include #include +#include +#include +#include #include #include -DIMENSION::DIMENSION( BOARD_ITEM* aParent ) : - BOARD_ITEM( aParent, PCB_DIMENSION_T ), +DIMENSION::DIMENSION( BOARD_ITEM* aParent, KICAD_T aType ) : + BOARD_ITEM( aParent, aType ), m_overrideTextEnabled( false ), m_units( EDA_UNITS::INCHES ), m_useMils( false ), @@ -104,6 +107,13 @@ void DIMENSION::updateText() } +template +void DIMENSION::addShape( ShapeType* aShape ) +{ + m_shapes.emplace_back( std::make_shared( *aShape ) ); +} + + wxString DIMENSION::GetValueText() const { int val = GetMeasuredValue(); @@ -310,9 +320,9 @@ bool DIMENSION::HitTest( const wxPoint& aPosition, int aAccuracy ) const // Locate SEGMENTS - for( const SEG& seg : GetLines() ) + for( const std::shared_ptr& shape : GetShapes() ) { - if( TestSegmentHit( aPosition, wxPoint( seg.A ), wxPoint( seg.B ), dist_max ) ) + if( shape->Collide( aPosition, dist_max ) ) return true; } @@ -347,16 +357,13 @@ const EDA_RECT DIMENSION::GetBoundingBox() const ymin = bBox.GetY(); ymax = bBox.GetBottom(); - for( const SEG& seg : GetLines() ) + for( const std::shared_ptr& shape : GetShapes() ) { - xmin = std::min( xmin, seg.A.x ); - xmin = std::min( xmin, seg.B.x ); - xmax = std::max( xmax, seg.A.x ); - xmax = std::max( xmax, seg.B.x ); - ymin = std::min( ymin, seg.A.y ); - ymin = std::min( ymin, seg.B.y ); - ymax = std::max( ymax, seg.A.y ); - ymax = std::max( ymax, seg.B.y ); + BOX2I shapeBox = shape->BBox(); + xmin = std::min( xmin, shapeBox.GetOrigin().x ); + xmax = std::max( xmax, shapeBox.GetEnd().x ); + ymin = std::min( ymin, shapeBox.GetOrigin().y ); + ymax = std::max( ymax, shapeBox.GetEnd().y ); } bBox.SetX( xmin ); @@ -376,11 +383,6 @@ wxString DIMENSION::GetSelectMenuText( EDA_UNITS aUnits ) const } -BITMAP_DEF DIMENSION::GetMenuImage() const -{ - return add_dimension_xpm; -} - const BOX2I DIMENSION::ViewBBox() const { @@ -392,6 +394,30 @@ const BOX2I DIMENSION::ViewBBox() const } +OPT_VECTOR2I DIMENSION::segPolyIntersection( SHAPE_POLY_SET& aPoly, SEG& aSeg, bool aStart ) +{ + VECTOR2I start( aStart ? aSeg.A : aSeg.B ); + VECTOR2I endpoint( aStart ? aSeg.B : aSeg.A ); + + if( aPoly.Contains( start ) ) + return NULLOPT; + + for( SHAPE_POLY_SET::SEGMENT_ITERATOR seg = aPoly.IterateSegments(); seg; seg++ ) + { + if( OPT_VECTOR2I intersection = ( *seg ).Intersect( aSeg ) ) + { + if( ( *intersection - start ).SquaredEuclideanNorm() < + ( endpoint - start ).SquaredEuclideanNorm() ) + endpoint = *intersection; + } + } + if( start == endpoint ) + return NULLOPT; + + return OPT_VECTOR2I( endpoint ); +} + + static struct DIMENSION_DESC { DIMENSION_DESC() @@ -406,7 +432,7 @@ static struct DIMENSION_DESC ALIGNED_DIMENSION::ALIGNED_DIMENSION( BOARD_ITEM* aParent ) : - DIMENSION( aParent ), + DIMENSION( aParent, PCB_DIM_ALIGNED_T ), m_height( 0 ) { // To preserve look of old dimensions, initialize extension height based on default arrow length @@ -422,10 +448,20 @@ EDA_ITEM* ALIGNED_DIMENSION::Clone() const void ALIGNED_DIMENSION::SwapData( BOARD_ITEM* aImage ) { - assert( aImage->Type() == PCB_DIMENSION_T ); + assert( aImage->Type() == PCB_DIM_ALIGNED_T ); + + m_shapes.clear(); + static_cast( aImage )->m_shapes.clear(); std::swap( *static_cast( this ), *static_cast( aImage ) ); + + Update(); +} + +BITMAP_DEF ALIGNED_DIMENSION::GetMenuImage() const +{ + return add_aligned_dimension_xpm; } @@ -452,7 +488,7 @@ void ALIGNED_DIMENSION::UpdateHeight( const wxPoint& aCrossbarStart, const wxPoi void ALIGNED_DIMENSION::updateGeometry() { - m_lines.clear(); + m_shapes.clear(); VECTOR2I dimension( m_end - m_start ); @@ -468,17 +504,15 @@ void ALIGNED_DIMENSION::updateGeometry() // Add extension lines int extensionHeight = std::abs( m_height ) - m_extensionOffset + m_extensionHeight; - VECTOR2I extensionStart( m_start ); - extensionStart += extension.Resize( m_extensionOffset ); + VECTOR2I extStart( m_start ); + extStart += extension.Resize( m_extensionOffset ); - m_lines.emplace_back( SEG( extensionStart, - extensionStart + extension.Resize( extensionHeight ) ) ); + addShape( new SHAPE_SEGMENT( extStart, extStart + extension.Resize( extensionHeight ) ) ); - extensionStart = VECTOR2I( m_end ); - extensionStart += extension.Resize( m_extensionOffset ); + extStart = VECTOR2I( m_end ); + extStart += extension.Resize( m_extensionOffset ); - m_lines.emplace_back( SEG( extensionStart, - extensionStart + extension.Resize( extensionHeight ) ) ); + addShape( new SHAPE_SEGMENT( extStart, extStart + extension.Resize( extensionHeight ) ) ); // Add crossbar VECTOR2I crossBarDistance = sign( m_height ) * extension.Resize( m_height ); @@ -504,55 +538,21 @@ void ALIGNED_DIMENSION::updateGeometry() // The ideal crossbar, if the text doesn't collide SEG crossbar( m_crossBarStart, m_crossBarEnd ); - auto findEndpoint = - [&]( const VECTOR2I& aStart, const VECTOR2I& aEnd ) -> VECTOR2I - { - VECTOR2I endpoint( aEnd ); - - for( SHAPE_POLY_SET::SEGMENT_ITERATOR seg = polyBox.IterateSegments(); seg; seg++ ) - { - if( OPT_VECTOR2I intersection = ( *seg ).Intersect( crossbar ) ) - { - if( ( *intersection - aStart ).SquaredEuclideanNorm() < - ( endpoint - aStart ).SquaredEuclideanNorm() ) - endpoint = *intersection; - } - } - - return endpoint; - }; - // Now we can draw 0, 1, or 2 crossbar lines depending on how the polygon collides - bool containsA = polyBox.Contains( crossbar.A ); bool containsB = polyBox.Contains( crossbar.B ); - if( containsA && !containsB ) - { - m_lines.emplace_back( SEG( findEndpoint( crossbar.B, crossbar.A ), crossbar.B ) ); - } - else if( containsB && !containsA ) - { - m_lines.emplace_back( SEG( crossbar.A, findEndpoint( crossbar.A, crossbar.B ) ) ); - } - else if( polyBox.Collide( crossbar ) ) - { - // text box collides and we need two segs - VECTOR2I endpoint1 = findEndpoint( crossbar.B, crossbar.A ); - VECTOR2I endpoint2 = findEndpoint( crossbar.A, crossbar.B ); + OPT_VECTOR2I endpointA = segPolyIntersection( polyBox, crossbar ); + OPT_VECTOR2I endpointB = segPolyIntersection( polyBox, crossbar, false ); - if( ( crossbar.B - endpoint1 ).SquaredEuclideanNorm() > - ( crossbar.B - endpoint2 ).SquaredEuclideanNorm() ) - std::swap( endpoint1, endpoint2 ); + if( endpointA ) + m_shapes.emplace_back( new SHAPE_SEGMENT( crossbar.A, *endpointA ) ); - m_lines.emplace_back( SEG( endpoint1, crossbar.B ) ); - m_lines.emplace_back( SEG( crossbar.A, endpoint2 ) ); - } - else if( !containsA && !containsB ) - { - // No collision - m_lines.emplace_back( crossbar ); - } + if( endpointB ) + m_shapes.emplace_back( new SHAPE_SEGMENT( *endpointB, crossbar.B ) ); + + if( !containsA && !containsB && !endpointA && !endpointB ) + m_shapes.emplace_back( new SHAPE_SEGMENT( crossbar ) ); // Add arrows VECTOR2I arrowEnd( m_arrowLength, 0 ); @@ -560,17 +560,17 @@ void ALIGNED_DIMENSION::updateGeometry() double arrowRotPos = dimension.Angle() + DEG2RAD( s_arrowAngle ); double arrowRotNeg = dimension.Angle() - DEG2RAD( s_arrowAngle ); - m_lines.emplace_back( SEG( m_crossBarStart, - m_crossBarStart + wxPoint( arrowEnd.Rotate( arrowRotPos ) ) ) ); + m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarStart, + m_crossBarStart + wxPoint( arrowEnd.Rotate( arrowRotPos ) ) ) ); - m_lines.emplace_back( SEG( m_crossBarStart, - m_crossBarStart + wxPoint( arrowEnd.Rotate( arrowRotNeg ) ) ) ); + m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarStart, + m_crossBarStart + wxPoint( arrowEnd.Rotate( arrowRotNeg ) ) ) ); - m_lines.emplace_back( SEG( m_crossBarEnd, - m_crossBarEnd - wxPoint( arrowEnd.Rotate( arrowRotPos ) ) ) ); + m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarEnd, + m_crossBarEnd - wxPoint( arrowEnd.Rotate( arrowRotPos ) ) ) ); - m_lines.emplace_back( SEG( m_crossBarEnd, - m_crossBarEnd - wxPoint( arrowEnd.Rotate( arrowRotNeg ) ) ) ); + m_shapes.emplace_back( new SHAPE_SEGMENT( m_crossBarEnd, + m_crossBarEnd - wxPoint( arrowEnd.Rotate( arrowRotNeg ) ) ) ); } @@ -607,3 +607,112 @@ void ALIGNED_DIMENSION::updateText() DIMENSION::updateText(); } + + +LEADER::LEADER( BOARD_ITEM* aParent ) : + DIMENSION( aParent, PCB_DIM_LEADER_T ), + m_textFrame( DIM_TEXT_FRAME::NONE ) +{ + m_unitsFormat = DIM_UNITS_FORMAT::NO_SUFFIX; + m_overrideTextEnabled = true; + m_keepTextAligned = false; +} + + +EDA_ITEM* LEADER::Clone() const +{ + return new LEADER( *this ); +} + + +void LEADER::SwapData( BOARD_ITEM* aImage ) +{ + assert( aImage->Type() == PCB_DIM_LEADER_T ); + + std::swap( *static_cast( this ), *static_cast( aImage ) ); +} + + +BITMAP_DEF LEADER::GetMenuImage() const +{ + return add_leader_xpm; +} + + +void LEADER::updateGeometry() +{ + m_shapes.clear(); + + VECTOR2I firstLine( m_end - m_start ); + VECTOR2I start( m_start ); + start += firstLine.Resize( m_extensionOffset ); + + m_shapes.emplace_back( new SHAPE_SEGMENT( start, m_end ) ); + + // Add arrows + VECTOR2I arrowEnd( m_arrowLength, 0 ); + + double arrowRotPos = firstLine.Angle() + DEG2RAD( s_arrowAngle ); + double arrowRotNeg = firstLine.Angle() - DEG2RAD( s_arrowAngle ); + + m_shapes.emplace_back( new SHAPE_SEGMENT( start, + start + wxPoint( arrowEnd.Rotate( arrowRotPos ) ) ) ); + m_shapes.emplace_back( new SHAPE_SEGMENT( start, + start + wxPoint( arrowEnd.Rotate( arrowRotNeg ) ) ) ); + + updateText(); + + // Now that we have the text updated, we can determine how to draw the second line + // First we need to create an appropriate bounding polygon to collide with + EDA_RECT textBox = m_text.GetTextBox().Inflate( m_text.GetTextWidth() / 2, + m_text.GetEffectiveTextPenWidth() ); + + SHAPE_POLY_SET polyBox; + polyBox.NewOutline(); + polyBox.Append( textBox.GetOrigin() ); + polyBox.Append( textBox.GetOrigin().x, textBox.GetEnd().y ); + polyBox.Append( textBox.GetEnd() ); + polyBox.Append( textBox.GetEnd().x, textBox.GetOrigin().y ); + polyBox.Rotate( -m_text.GetTextAngleRadians(), textBox.GetCenter() ); + + SEG textSeg( m_end, m_text.GetPosition() ); + OPT_VECTOR2I endpoint = segPolyIntersection( polyBox, textSeg ); + + if( !GetText().IsEmpty() ) + { + switch( m_textFrame ) + { + case DIM_TEXT_FRAME::RECT: + { + for( SHAPE_POLY_SET::SEGMENT_ITERATOR seg = polyBox.IterateSegments(); seg; seg++ ) + m_shapes.emplace_back( new SHAPE_SEGMENT( *seg ) ); + + break; + } + + case DIM_TEXT_FRAME::CIRCLE: + { + double penWidth = m_text.GetEffectiveTextPenWidth() / 2.0; + double radius = ( textBox.GetWidth() / 2.0 ) - penWidth; + m_shapes.emplace_back( new SHAPE_CIRCLE( textBox.GetCenter(), radius ) ); + + // Calculated bbox endpoint won't be right + if( endpoint ) + { + VECTOR2I totalLength( textBox.GetCenter() - m_end ); + VECTOR2I circleEndpoint( *endpoint - m_end ); + circleEndpoint = circleEndpoint.Resize( totalLength.EuclideanNorm() - radius ); + endpoint = OPT_VECTOR2I( VECTOR2I( m_end ) + circleEndpoint ); + } + + break; + } + + default: + break; + } + } + + if( endpoint ) + m_shapes.emplace_back( new SHAPE_SEGMENT( m_end, *endpoint ) ); +} diff --git a/pcbnew/class_dimension.h b/pcbnew/class_dimension.h index 1fc495ef62..699897afbb 100644 --- a/pcbnew/class_dimension.h +++ b/pcbnew/class_dimension.h @@ -33,7 +33,7 @@ #include #include -#include +#include class LINE_READER; @@ -68,6 +68,17 @@ enum class DIM_UNITS_MODE AUTOMATIC }; +/** + * Frame to show around dimension text + */ +enum class DIM_TEXT_FRAME +{ + NONE, + RECT, + CIRCLE, + ROUNDRECT +}; + /** * Abstract dimension API * @@ -90,7 +101,21 @@ enum class DIM_UNITS_MODE class DIMENSION : public BOARD_ITEM { public: - DIMENSION( BOARD_ITEM* aParent ); + DIMENSION( BOARD_ITEM* aParent, KICAD_T aType = PCB_DIMENSION_T ); + + bool IsType( const KICAD_T aScanTypes[] ) const override + { + if( BOARD_ITEM::IsType( aScanTypes ) ) + return true; + + for( const KICAD_T* p = aScanTypes; *p != EOT; ++p ) + { + if( *p == PCB_LOCATE_GRAPHIC_T ) + return true; + } + + return false; + } void SetParent( EDA_ITEM* aParent ) override; @@ -199,7 +224,7 @@ public: /** * @return a list of line segments that make up this dimension (for drawing, plotting, etc) */ - const std::vector& GetLines() const { return m_lines; } + const std::vector>& GetShapes() const { return m_shapes; } // BOARD_ITEM overrides @@ -224,8 +249,6 @@ public: wxString GetSelectMenuText( EDA_UNITS aUnits ) const override; - BITMAP_DEF GetMenuImage() const override; - virtual const BOX2I ViewBBox() const override; #if defined(DEBUG) @@ -244,6 +267,18 @@ protected: */ virtual void updateText(); + template + void addShape( ShapeType* aShape ); + + /** + * Finds the intersection between a given segment and polygon outline + * @param aPoly is the polygon to collide + * @param aSeg is the segment to collide + * @param aStart if true will start from aSeg.A, otherwise aSeg.B + * @return a point on aSeg that collides with aPoly closest to the start, if one exists + */ + static OPT_VECTOR2I segPolyIntersection( SHAPE_POLY_SET& aPoly, SEG& aSeg, bool aStart = true ); + // Value format bool m_overrideTextEnabled; ///< Manually specify the displayed measurement value wxString m_valueString; ///< Displayed value when m_overrideValue = true @@ -269,7 +304,10 @@ protected: wxPoint m_start; wxPoint m_end; - std::vector m_lines; ///< Internal cache of drawn lines + ///< Internal cache of drawn shapes + std::vector> m_shapes; + + static constexpr float s_arrowAngle = 27.5; }; /** @@ -308,8 +346,6 @@ class ALIGNED_DIMENSION : public DIMENSION wxPoint m_crossBarStart; ///< Crossbar start control point wxPoint m_crossBarEnd; ///< Crossbar end control point - static constexpr float s_arrowAngle = 27.5; - public: ALIGNED_DIMENSION( BOARD_ITEM* aParent ); @@ -320,27 +356,15 @@ public: static inline bool ClassOf( const EDA_ITEM* aItem ) { - return aItem && PCB_DIMENSION_T == aItem->Type(); - } - - bool IsType( const KICAD_T aScanTypes[] ) const override - { - if( BOARD_ITEM::IsType( aScanTypes ) ) - return true; - - for( const KICAD_T* p = aScanTypes; *p != EOT; ++p ) - { - if( *p == PCB_LOCATE_GRAPHIC_T ) - return true; - } - - return false; + return aItem && PCB_DIM_ALIGNED_T == aItem->Type(); } EDA_ITEM* Clone() const override; virtual void SwapData( BOARD_ITEM* aImage ) override; + BITMAP_DEF GetMenuImage() const override; + const wxPoint& GetCrossbarStart() const { return m_crossBarStart; } const wxPoint& GetCrossbarEnd() const { return m_crossBarEnd; } @@ -385,4 +409,50 @@ protected: void updateText() override; }; + +/** + * A leader is a dimension-like object pointing to a specific point. + * + * A guide to the geometry of a leader: + * + * a + * _ + * |\ + * \ + * b---c TEXT + * + * Point (a) is m_start, point (b) is m_end, point (c) is the end of the "text line" + * The b-c line is drawn from b to the text center, and clipped on the text bounding box. + */ +class LEADER : public DIMENSION +{ + DIM_TEXT_FRAME m_textFrame; + +public: + LEADER( BOARD_ITEM* aParent ); + + static inline bool ClassOf( const EDA_ITEM* aItem ) + { + return aItem && PCB_DIM_LEADER_T == aItem->Type(); + } + + EDA_ITEM* Clone() const override; + + virtual void SwapData( BOARD_ITEM* aImage ) override; + + BITMAP_DEF GetMenuImage() const override; + + wxString GetClass() const override + { + return wxT( "LEADER" ); + } + + void SetTextFrame( DIM_TEXT_FRAME aFrame ) { m_textFrame = aFrame; } + DIM_TEXT_FRAME GetTextFrame() const { return m_textFrame; } + +protected: + + void updateGeometry() override; +}; + #endif // DIMENSION_H_ diff --git a/pcbnew/class_pcb_text.cpp b/pcbnew/class_pcb_text.cpp index 7c4c71ddfd..7f6306e5de 100644 --- a/pcbnew/class_pcb_text.cpp +++ b/pcbnew/class_pcb_text.cpp @@ -109,7 +109,7 @@ void TEXTE_PCB::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vectorType() == PCB_DIMENSION_T ) + if( BaseType( m_Parent->Type() ) == PCB_DIMENSION_T ) aList.emplace_back( _( "Dimension" ), GetShownText(), DARKGREEN ); else aList.emplace_back( _( "PCB Text" ), GetShownText(), DARKGREEN ); diff --git a/pcbnew/collectors.cpp b/pcbnew/collectors.cpp index 3d8c0ac5c7..c1cc429818 100644 --- a/pcbnew/collectors.cpp +++ b/pcbnew/collectors.cpp @@ -49,7 +49,8 @@ const KICAD_T GENERAL_COLLECTOR::AllBoardItems[] = { PCB_MARKER_T, // in m_markers PCB_TEXT_T, // in m_drawings PCB_LINE_T, // in m_drawings - PCB_DIMENSION_T, // in m_drawings + PCB_DIM_ALIGNED_T, // in m_drawings + PCB_DIM_LEADER_T, // in m_drawings PCB_TARGET_T, // in m_drawings PCB_VIA_T, // in m_tracks PCB_TRACE_T, // in m_tracks @@ -67,7 +68,8 @@ const KICAD_T GENERAL_COLLECTOR::BoardLevelItems[] = { PCB_MARKER_T, PCB_TEXT_T, PCB_LINE_T, - PCB_DIMENSION_T, + PCB_DIM_ALIGNED_T, + PCB_DIM_LEADER_T, PCB_TARGET_T, PCB_VIA_T, PCB_ARC_T, @@ -83,7 +85,8 @@ const KICAD_T GENERAL_COLLECTOR::AllButZones[] = { PCB_MARKER_T, PCB_TEXT_T, PCB_LINE_T, - PCB_DIMENSION_T, + PCB_DIM_ALIGNED_T, + PCB_DIM_LEADER_T, PCB_TARGET_T, PCB_VIA_T, PCB_TRACE_T, @@ -164,7 +167,8 @@ const KICAD_T GENERAL_COLLECTOR::Zones[] = { const KICAD_T GENERAL_COLLECTOR::Dimensions[] = { - PCB_DIMENSION_T, + PCB_DIM_ALIGNED_T, + PCB_DIM_LEADER_T, EOT }; @@ -216,7 +220,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) breakhere++; break; - case PCB_DIMENSION_T: + case PCB_DIM_ALIGNED_T: breakhere++; break; @@ -306,7 +310,8 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData ) drawSegment = static_cast( item ); break; - case PCB_DIMENSION_T: + case PCB_DIM_ALIGNED_T: + case PCB_DIM_LEADER_T: break; case PCB_TARGET_T: diff --git a/pcbnew/dialogs/dialog_dimension_properties.cpp b/pcbnew/dialogs/dialog_dimension_properties.cpp index 2d8aa597f3..96e4d2d165 100644 --- a/pcbnew/dialogs/dialog_dimension_properties.cpp +++ b/pcbnew/dialogs/dialog_dimension_properties.cpp @@ -32,6 +32,8 @@ DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES( PCB_BASE_EDIT_FRAME* a BOARD_ITEM* aItem ) : DIALOG_DIMENSION_PROPERTIES_BASE( aParent ), m_frame( aParent ), + m_cbLayerActual( m_cbLayer ), + m_txtValueActual( m_txtValue ), m_textWidth( aParent, m_lblTextWidth, m_txtTextWidth, m_lblTextWidthUnits, true ), m_textHeight( aParent, m_lblTextHeight, m_txtTextHeight, m_lblTextHeightUnits, true ), m_textThickness( aParent, m_lblTextThickness, m_txtTextThickness, @@ -45,11 +47,33 @@ DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES( PCB_BASE_EDIT_FRAME* a m_extensionOffset( aParent, m_lblExtensionOffset, m_txtExtensionOffset, m_lblExtensionOffsetUnits ) { - wxASSERT( aItem->Type() == PCB_DIMENSION_T ); + wxASSERT( BaseType( aItem->Type() ) == PCB_DIMENSION_T ); m_dimension = static_cast( aItem ); m_previewDimension = static_cast( m_dimension->Clone() ); m_previewDimension->SetParent( m_frame->GetBoard() ); + switch( m_dimension->Type() ) + { + case PCB_DIM_LEADER_T: + // Hide the main format controls and keep the leader controls shown + m_sizerFormat->GetStaticBox()->Hide(); + + m_cbLayerActual = m_cbLeaderLayer; + m_txtValueActual = m_txtLeaderValue; + + // Remove a fewings from text format + m_lblTextPositionMode->Hide(); + m_cbTextPositionMode->Hide(); + break; + + default: + m_sizerLeader->GetStaticBox()->Hide(); + break; + } + + // Fix the size after hiding/showing some of the properties + Layout(); + // Configure display origin transforms m_textPosX.SetCoordType( ORIGIN_TRANSFORMS::ABS_X_COORD ); m_textPosY.SetCoordType( ORIGIN_TRANSFORMS::ABS_Y_COORD ); @@ -57,12 +81,12 @@ DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES( PCB_BASE_EDIT_FRAME* a // Configure the layers list selector. Note that footprints are built outside the current // board and so we may need to show all layers if the text is on an unactivated layer. if( !m_frame->GetBoard()->IsLayerEnabled( m_dimension->GetLayer() ) ) - m_cbLayer->ShowNonActivatedLayers( true ); + m_cbLayerActual->ShowNonActivatedLayers( true ); - m_cbLayer->SetLayersHotkeys( false ); - m_cbLayer->SetNotAllowedLayerSet( LSET::ForbiddenTextLayers() ); - m_cbLayer->SetBoardFrame( aParent ); - m_cbLayer->Resync(); + m_cbLayerActual->SetLayersHotkeys( false ); + m_cbLayerActual->SetNotAllowedLayerSet( LSET::ForbiddenTextLayers() ); + m_cbLayerActual->SetBoardFrame( aParent ); + m_cbLayerActual->Resync(); m_orientValue = 0.0; m_orientValidator.SetRange( -360.0, 360.0 ); @@ -97,6 +121,7 @@ DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES( PCB_BASE_EDIT_FRAME* a updatePreviewText(); }; + // No need to use m_txtValueActual here since we don't have previewing for leaders m_txtValue->Bind( wxEVT_TEXT, updateEventHandler ); m_txtPrefix->Bind( wxEVT_TEXT, updateEventHandler ); m_txtSuffix->Bind( wxEVT_TEXT, updateEventHandler ); @@ -148,11 +173,11 @@ bool DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow() m_txtPrefix->SetValue( m_dimension->GetPrefix() ); m_txtSuffix->SetValue( m_dimension->GetSuffix() ); - if( m_cbLayer->SetLayerSelection( m_dimension->GetLayer() ) < 0 ) + if( m_cbLayerActual->SetLayerSelection( m_dimension->GetLayer() ) < 0 ) { wxMessageBox( _( "This item was on a non-existing or forbidden layer.\n" "It has been moved to the first allowed layer." ) ); - m_cbLayer->SetSelection( 0 ); + m_cbLayerActual->SetSelection( 0 ); } m_cbSuppressZeroes->SetValue( m_dimension->GetSuppressZeroes() ); @@ -188,12 +213,18 @@ bool DIALOG_DIMENSION_PROPERTIES::TransferDataToWindow() // Do this last; it depends on the other settings if( m_dimension->GetOverrideTextEnabled() ) - m_txtValue->SetValue( m_dimension->GetOverrideText() ); + m_txtValueActual->SetValue( m_dimension->GetOverrideText() ); else - m_txtValue->SetValue( m_dimension->GetValueText() ); + m_txtValueActual->SetValue( m_dimension->GetValueText() ); m_orientValidator.TransferToWindow(); + if( m_dimension->Type() == PCB_DIM_LEADER_T ) + { + LEADER* leader = static_cast( m_dimension ); + m_cbTextFrame->SetSelection( static_cast( leader->GetTextFrame() ) ); + } + return DIALOG_DIMENSION_PROPERTIES_BASE::TransferDataToWindow(); } @@ -233,11 +264,11 @@ void DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog( DIMENSION* aTarget aTarget->SetOverrideTextEnabled( m_cbOverrideValue->GetValue() ); if( m_cbOverrideValue->GetValue() ) - aTarget->SetOverrideText( m_txtValue->GetValue() ); + aTarget->SetOverrideText( m_txtValueActual->GetValue() ); aTarget->SetPrefix( m_txtPrefix->GetValue() ); aTarget->SetSuffix( m_txtSuffix->GetValue() ); - aTarget->SetLayer( static_cast( m_cbLayer->GetLayerSelection() ) ); + aTarget->SetLayer( static_cast( m_cbLayerActual->GetLayerSelection() ) ); aTarget->SetUnits( m_frame->GetUserUnits(), false ); aTarget->SetUnitsMode( static_cast( m_cbUnits->GetSelection() ) ); @@ -271,6 +302,12 @@ void DIALOG_DIMENSION_PROPERTIES::updateDimensionFromDialog( DIMENSION* aTarget aTarget->SetArrowLength( m_arrowLength.GetValue() ); aTarget->SetExtensionOffset( m_extensionOffset.GetValue() ); + if( aTarget->Type() == PCB_DIM_LEADER_T ) + { + LEADER* leader = static_cast( aTarget ); + leader->SetTextFrame( static_cast( m_cbTextFrame->GetSelection() ) ); + } + aTarget->Update(); } diff --git a/pcbnew/dialogs/dialog_dimension_properties.h b/pcbnew/dialogs/dialog_dimension_properties.h index 15f774c427..fda4a97b55 100644 --- a/pcbnew/dialogs/dialog_dimension_properties.h +++ b/pcbnew/dialogs/dialog_dimension_properties.h @@ -51,6 +51,9 @@ private: DIMENSION* m_dimension; DIMENSION* m_previewDimension; + PCB_LAYER_BOX_SELECTOR* m_cbLayerActual; // The active layer box control + wxTextCtrl* m_txtValueActual; // The active value control + UNIT_BINDER m_textWidth; UNIT_BINDER m_textHeight; UNIT_BINDER m_textThickness; diff --git a/pcbnew/dialogs/dialog_dimension_properties_base.cpp b/pcbnew/dialogs/dialog_dimension_properties_base.cpp index dd06a6e363..0961313fd1 100644 --- a/pcbnew/dialogs/dialog_dimension_properties_base.cpp +++ b/pcbnew/dialogs/dialog_dimension_properties_base.cpp @@ -15,30 +15,72 @@ DIALOG_DIMENSION_PROPERTIES_BASE::DIALOG_DIMENSION_PROPERTIES_BASE( wxWindow* pa { this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize ); - wxBoxSizer* bMainSizer; - bMainSizer = new wxBoxSizer( wxVERTICAL ); + m_mainSizer = new wxBoxSizer( wxVERTICAL ); - wxStaticBoxSizer* sbSizerFormat; - sbSizerFormat = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Dimension Format") ), wxVERTICAL ); + m_sizerLeader = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Leader Format") ), wxVERTICAL ); + + wxGridBagSizer* gbSizerLeader; + gbSizerLeader = new wxGridBagSizer( 0, 0 ); + gbSizerLeader->SetFlexibleDirection( wxBOTH ); + gbSizerLeader->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_lblLeaderValue = new wxStaticText( m_sizerLeader->GetStaticBox(), wxID_ANY, _("Value:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_lblLeaderValue->Wrap( -1 ); + gbSizerLeader->Add( m_lblLeaderValue, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + m_txtLeaderValue = new wxTextCtrl( m_sizerLeader->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + gbSizerLeader->Add( m_txtLeaderValue, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 ); + + + gbSizerLeader->Add( 60, 0, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 ); + + m_lblTextFrame = new wxStaticText( m_sizerLeader->GetStaticBox(), wxID_ANY, _("Text frame:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_lblTextFrame->Wrap( -1 ); + m_lblTextFrame->SetToolTip( _("Draw a shape around the leader text") ); + + gbSizerLeader->Add( m_lblTextFrame, wxGBPosition( 0, 3 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + wxString m_cbTextFrameChoices[] = { _("None"), _("Rectangle"), _("Circle") }; + int m_cbTextFrameNChoices = sizeof( m_cbTextFrameChoices ) / sizeof( wxString ); + m_cbTextFrame = new wxChoice( m_sizerLeader->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cbTextFrameNChoices, m_cbTextFrameChoices, 0 ); + m_cbTextFrame->SetSelection( 0 ); + m_cbTextFrame->SetToolTip( _("Draw a shape around the leader text") ); + + gbSizerLeader->Add( m_cbTextFrame, wxGBPosition( 0, 4 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 ); + + m_lblLeaderLayer = new wxStaticText( m_sizerLeader->GetStaticBox(), wxID_ANY, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_lblLeaderLayer->Wrap( -1 ); + gbSizerLeader->Add( m_lblLeaderLayer, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + m_cbLeaderLayer = new PCB_LAYER_BOX_SELECTOR( m_sizerLeader->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + gbSizerLeader->Add( m_cbLeaderLayer, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 ); + + + m_sizerLeader->Add( gbSizerLeader, 1, wxBOTTOM|wxEXPAND, 5 ); + + + m_mainSizer->Add( m_sizerLeader, 0, wxALL|wxEXPAND, 5 ); + + m_sizerFormat = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Dimension Format") ), wxVERTICAL ); wxGridBagSizer* gbSizerFormat; gbSizerFormat = new wxGridBagSizer( 0, 5 ); - gbSizerFormat->SetFlexibleDirection( wxHORIZONTAL ); + gbSizerFormat->SetFlexibleDirection( wxBOTH ); gbSizerFormat->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_lblValue = new wxStaticText( sbSizerFormat->GetStaticBox(), wxID_ANY, _("Value:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_lblValue = new wxStaticText( m_sizerFormat->GetStaticBox(), wxID_ANY, _("Value:"), wxDefaultPosition, wxDefaultSize, 0 ); m_lblValue->Wrap( -1 ); m_lblValue->SetToolTip( _("Measured value of this dimension") ); gbSizerFormat->Add( m_lblValue, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_txtValue = new wxTextCtrl( sbSizerFormat->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_txtValue = new wxTextCtrl( m_sizerFormat->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_txtValue->Enable( false ); m_txtValue->SetToolTip( _("Measured value of this dimension") ); gbSizerFormat->Add( m_txtValue, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 ); - m_cbOverrideValue = new wxCheckBox( sbSizerFormat->GetStaticBox(), wxID_ANY, _("Override value"), wxDefaultPosition, wxDefaultSize, 0 ); + m_cbOverrideValue = new wxCheckBox( m_sizerFormat->GetStaticBox(), wxID_ANY, _("Override value"), wxDefaultPosition, wxDefaultSize, 0 ); m_cbOverrideValue->SetToolTip( _("When checked, the actual measurement is ignored and any value can be entered") ); gbSizerFormat->Add( m_cbOverrideValue, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 ); @@ -46,7 +88,7 @@ DIALOG_DIMENSION_PROPERTIES_BASE::DIALOG_DIMENSION_PROPERTIES_BASE( wxWindow* pa gbSizerFormat->Add( 20, 0, wxGBPosition( 0, 3 ), wxGBSpan( 1, 1 ), 0, 5 ); - m_lblUnits = new wxStaticText( sbSizerFormat->GetStaticBox(), wxID_ANY, _("Units:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_lblUnits = new wxStaticText( m_sizerFormat->GetStaticBox(), wxID_ANY, _("Units:"), wxDefaultPosition, wxDefaultSize, 0 ); m_lblUnits->Wrap( -1 ); m_lblUnits->SetToolTip( _("Units of this dimension (\"automatic\" to follow the units selected in the editor)") ); @@ -54,24 +96,24 @@ DIALOG_DIMENSION_PROPERTIES_BASE::DIALOG_DIMENSION_PROPERTIES_BASE( wxWindow* pa wxString m_cbUnitsChoices[] = { _("Inches"), _("Mils"), _("Millimeters"), _("Automatic") }; int m_cbUnitsNChoices = sizeof( m_cbUnitsChoices ) / sizeof( wxString ); - m_cbUnits = new wxChoice( sbSizerFormat->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cbUnitsNChoices, m_cbUnitsChoices, 0 ); + m_cbUnits = new wxChoice( m_sizerFormat->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cbUnitsNChoices, m_cbUnitsChoices, 0 ); m_cbUnits->SetSelection( 0 ); m_cbUnits->SetToolTip( _("Units of this dimension (\"automatic\" to follow the units selected in the editor)") ); gbSizerFormat->Add( m_cbUnits, wxGBPosition( 0, 5 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 ); - m_lblPrefix = new wxStaticText( sbSizerFormat->GetStaticBox(), wxID_ANY, _("Prefix:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_lblPrefix = new wxStaticText( m_sizerFormat->GetStaticBox(), wxID_ANY, _("Prefix:"), wxDefaultPosition, wxDefaultSize, 0 ); m_lblPrefix->Wrap( -1 ); m_lblPrefix->SetToolTip( _("Text to print before the dimension value") ); gbSizerFormat->Add( m_lblPrefix, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_txtPrefix = new wxTextCtrl( sbSizerFormat->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_txtPrefix = new wxTextCtrl( m_sizerFormat->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_txtPrefix->SetToolTip( _("Text to print before the dimension value") ); gbSizerFormat->Add( m_txtPrefix, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 ); - m_txtUnitsFormat = new wxStaticText( sbSizerFormat->GetStaticBox(), wxID_ANY, _("Units format:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_txtUnitsFormat = new wxStaticText( m_sizerFormat->GetStaticBox(), wxID_ANY, _("Units format:"), wxDefaultPosition, wxDefaultSize, 0 ); m_txtUnitsFormat->Wrap( -1 ); m_txtUnitsFormat->SetToolTip( _("Choose how to display the units") ); @@ -79,24 +121,24 @@ DIALOG_DIMENSION_PROPERTIES_BASE::DIALOG_DIMENSION_PROPERTIES_BASE( wxWindow* pa wxString m_cbUnitsFormatChoices[] = { _("1234"), _("1234 mm"), _("1234 (mm)") }; int m_cbUnitsFormatNChoices = sizeof( m_cbUnitsFormatChoices ) / sizeof( wxString ); - m_cbUnitsFormat = new wxChoice( sbSizerFormat->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cbUnitsFormatNChoices, m_cbUnitsFormatChoices, 0 ); + m_cbUnitsFormat = new wxChoice( m_sizerFormat->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cbUnitsFormatNChoices, m_cbUnitsFormatChoices, 0 ); m_cbUnitsFormat->SetSelection( 1 ); m_cbUnitsFormat->SetToolTip( _("Choose how to display the units") ); gbSizerFormat->Add( m_cbUnitsFormat, wxGBPosition( 1, 5 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 ); - m_lblSuffix = new wxStaticText( sbSizerFormat->GetStaticBox(), wxID_ANY, _("Suffix:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_lblSuffix = new wxStaticText( m_sizerFormat->GetStaticBox(), wxID_ANY, _("Suffix:"), wxDefaultPosition, wxDefaultSize, 0 ); m_lblSuffix->Wrap( -1 ); m_lblSuffix->SetToolTip( _("Text to print after the dimension value") ); gbSizerFormat->Add( m_lblSuffix, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_txtSuffix = new wxTextCtrl( sbSizerFormat->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_txtSuffix = new wxTextCtrl( m_sizerFormat->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_txtSuffix->SetToolTip( _("Text to print after the dimension value") ); gbSizerFormat->Add( m_txtSuffix, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 ); - m_lblPrecision = new wxStaticText( sbSizerFormat->GetStaticBox(), wxID_ANY, _("Precision:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_lblPrecision = new wxStaticText( m_sizerFormat->GetStaticBox(), wxID_ANY, _("Precision:"), wxDefaultPosition, wxDefaultSize, 0 ); m_lblPrecision->Wrap( -1 ); m_lblPrecision->SetToolTip( _("Choose how many digits of precision to display") ); @@ -104,29 +146,29 @@ DIALOG_DIMENSION_PROPERTIES_BASE::DIALOG_DIMENSION_PROPERTIES_BASE( wxWindow* pa wxString m_cbPrecisionChoices[] = { _("0"), _("0.0"), _("0.00"), _("0.000"), _("0.0000"), _("0.00000") }; int m_cbPrecisionNChoices = sizeof( m_cbPrecisionChoices ) / sizeof( wxString ); - m_cbPrecision = new wxChoice( sbSizerFormat->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cbPrecisionNChoices, m_cbPrecisionChoices, 0 ); + m_cbPrecision = new wxChoice( m_sizerFormat->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_cbPrecisionNChoices, m_cbPrecisionChoices, 0 ); m_cbPrecision->SetSelection( 0 ); m_cbPrecision->SetToolTip( _("Choose how many digits of precision to display") ); gbSizerFormat->Add( m_cbPrecision, wxGBPosition( 2, 5 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 ); - m_cbSuppressZeroes = new wxCheckBox( sbSizerFormat->GetStaticBox(), wxID_ANY, _("Suppress trailing zeroes"), wxDefaultPosition, wxDefaultSize, 0 ); + m_cbSuppressZeroes = new wxCheckBox( m_sizerFormat->GetStaticBox(), wxID_ANY, _("Suppress trailing zeroes"), wxDefaultPosition, wxDefaultSize, 0 ); m_cbSuppressZeroes->SetToolTip( _("When checked, \"0.100\" will be shown as \"0.1\" even if the precision setting is higher") ); gbSizerFormat->Add( m_cbSuppressZeroes, wxGBPosition( 3, 4 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_lblLayer = new wxStaticText( sbSizerFormat->GetStaticBox(), wxID_ANY, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_lblLayer = new wxStaticText( m_sizerFormat->GetStaticBox(), wxID_ANY, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 ); m_lblLayer->Wrap( -1 ); gbSizerFormat->Add( m_lblLayer, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_cbLayer = new PCB_LAYER_BOX_SELECTOR( sbSizerFormat->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + m_cbLayer = new PCB_LAYER_BOX_SELECTOR( m_sizerFormat->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); gbSizerFormat->Add( m_cbLayer, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALL, 5 ); - m_lblPreview = new wxStaticText( sbSizerFormat->GetStaticBox(), wxID_ANY, _("Preview:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_lblPreview = new wxStaticText( m_sizerFormat->GetStaticBox(), wxID_ANY, _("Preview:"), wxDefaultPosition, wxDefaultSize, 0 ); m_lblPreview->Wrap( -1 ); gbSizerFormat->Add( m_lblPreview, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_staticTextPreview = new wxStaticText( sbSizerFormat->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextPreview = new wxStaticText( m_sizerFormat->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextPreview->Wrap( -1 ); m_staticTextPreview->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) ); @@ -137,10 +179,10 @@ DIALOG_DIMENSION_PROPERTIES_BASE::DIALOG_DIMENSION_PROPERTIES_BASE( wxWindow* pa gbSizerFormat->AddGrowableCol( 3 ); gbSizerFormat->AddGrowableCol( 5 ); - sbSizerFormat->Add( gbSizerFormat, 1, wxBOTTOM|wxEXPAND, 5 ); + m_sizerFormat->Add( gbSizerFormat, 1, wxBOTTOM|wxEXPAND, 5 ); - bMainSizer->Add( sbSizerFormat, 0, wxALL|wxEXPAND, 5 ); + m_mainSizer->Add( m_sizerFormat, 1, wxALL|wxEXPAND, 5 ); wxStaticBoxSizer* sbSizerText; sbSizerText = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Dimension Text") ), wxVERTICAL ); @@ -274,7 +316,7 @@ DIALOG_DIMENSION_PROPERTIES_BASE::DIALOG_DIMENSION_PROPERTIES_BASE( wxWindow* pa sbSizerText->Add( gbSizerText, 0, wxBOTTOM|wxEXPAND, 5 ); - bMainSizer->Add( sbSizerText, 0, wxALL|wxEXPAND, 5 ); + m_mainSizer->Add( sbSizerText, 0, wxALL|wxEXPAND, 5 ); wxStaticBoxSizer* sbSizerLine; sbSizerLine = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Dimension Line") ), wxVERTICAL ); @@ -334,13 +376,13 @@ DIALOG_DIMENSION_PROPERTIES_BASE::DIALOG_DIMENSION_PROPERTIES_BASE( wxWindow* pa sbSizerLine->Add( gbSizerLine, 1, wxBOTTOM|wxEXPAND, 5 ); - bMainSizer->Add( sbSizerLine, 0, wxALL|wxEXPAND, 5 ); + m_mainSizer->Add( sbSizerLine, 0, wxALL|wxEXPAND, 5 ); - bMainSizer->Add( 0, 0, 0, wxTOP, 5 ); + m_mainSizer->Add( 0, 0, 0, wxTOP, 5 ); m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bMainSizer->Add( m_staticline, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 ); + m_mainSizer->Add( m_staticline, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 ); wxBoxSizer* lowerSizer; lowerSizer = new wxBoxSizer( wxHORIZONTAL ); @@ -358,10 +400,10 @@ DIALOG_DIMENSION_PROPERTIES_BASE::DIALOG_DIMENSION_PROPERTIES_BASE( wxWindow* pa lowerSizer->Add( m_sdbSizer, 0, wxALL, 5 ); - bMainSizer->Add( lowerSizer, 0, wxEXPAND, 5 ); + m_mainSizer->Add( lowerSizer, 0, wxEXPAND, 5 ); - this->SetSizer( bMainSizer ); + this->SetSizer( m_mainSizer ); this->Layout(); this->Centre( wxBOTH ); diff --git a/pcbnew/dialogs/dialog_dimension_properties_base.fbp b/pcbnew/dialogs/dialog_dimension_properties_base.fbp index 7d2b0b4fd0..5426e8d7c8 100644 --- a/pcbnew/dialogs/dialog_dimension_properties_base.fbp +++ b/pcbnew/dialogs/dialog_dimension_properties_base.fbp @@ -45,7 +45,7 @@ -1,-1 DIALOG_DIMENSION_PROPERTIES_BASE - 654,757 + 654,600 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU DIALOG_SHIM; dialog_shim.h Dimension Properties @@ -56,28 +56,466 @@ OnInitDlg - bMainSizer + m_mainSizer wxVERTICAL - none + protected 5 wxALL|wxEXPAND 0 wxID_ANY - Dimension Format + Leader Format - sbSizerFormat + m_sizerLeader wxVERTICAL 1 - none + protected 5 wxBOTTOM|wxEXPAND 1 - wxHORIZONTAL + wxBOTH + + + 0 + + gbSizerLeader + wxFLEX_GROWMODE_SPECIFIED + none + 0 + + 5 + 1 + 0 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Value: + 0 + + 0 + + + 0 + + 1 + m_lblLeaderValue + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + 1 + 1 + wxALL|wxEXPAND + 0 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_txtLeaderValue + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + 1 + 2 + wxEXPAND + 0 + 1 + + 0 + protected + 60 + + + + 5 + 1 + 3 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Text frame: + 0 + + 0 + + + 0 + + 1 + m_lblTextFrame + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + Draw a shape around the leader text + + + + -1 + + + + 5 + 1 + 4 + wxALL|wxEXPAND + 0 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "None" "Rectangle" "Circle" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_cbTextFrame + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + ; ; forward_declare + 0 + Draw a shape around the leader text + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + 1 + 0 + wxALIGN_CENTER_VERTICAL|wxALL + 1 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Layer: + 0 + + 0 + + + 0 + + 1 + m_lblLeaderLayer + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + 1 + 1 + wxALL|wxEXPAND + 1 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_cbLeaderLayer + 1 + + + protected + 1 + + Resizable + -1 + 1 + + + PCB_LAYER_BOX_SELECTOR; pcb_layer_box_selector.h + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 1 + + wxID_ANY + Dimension Format + + m_sizerFormat + wxVERTICAL + 1 + protected + + 5 + wxBOTTOM|wxEXPAND + 1 + + + wxBOTH 1,3,5 5 @@ -1288,7 +1726,7 @@ 5 wxALL|wxEXPAND 0 - + wxID_ANY Dimension Text @@ -1296,11 +1734,11 @@ wxVERTICAL 1 none - + 5 wxBOTTOM|wxEXPAND 0 - + wxHORIZONTAL 1,3,5 @@ -1311,7 +1749,7 @@ wxFLEX_GROWMODE_SPECIFIED none 0 - + 5 1 0 @@ -1375,7 +1813,7 @@ -1 - + 5 1 1 @@ -1443,7 +1881,7 @@ OnOkClick - + 5 1 2 @@ -1507,20 +1945,20 @@ -1 - + 5 1 3 wxEXPAND 0 1 - + 0 protected 20 - + 5 1 4 @@ -1584,7 +2022,7 @@ -1 - + 5 1 5 @@ -1652,7 +2090,7 @@ OnOkClick - + 5 1 6 @@ -1716,7 +2154,7 @@ -1 - + 5 1 0 @@ -1780,7 +2218,7 @@ -1 - + 5 1 1 @@ -1848,7 +2286,7 @@ OnOkClick - + 5 1 2 @@ -1912,7 +2350,7 @@ -1 - + 5 1 4 @@ -1976,7 +2414,7 @@ -1 - + 5 1 5 @@ -2044,7 +2482,7 @@ OnOkClick - + 5 1 6 @@ -2108,7 +2546,7 @@ -1 - + 5 1 0 @@ -2172,7 +2610,7 @@ -1 - + 5 1 1 @@ -2240,7 +2678,7 @@ OnOkClick - + 5 1 2 @@ -2304,7 +2742,7 @@ -1 - + 5 1 4 @@ -2368,7 +2806,7 @@ -1 - + 5 1 5 @@ -2437,7 +2875,7 @@ OnOkClick - + 5 1 0 @@ -2504,14 +2942,14 @@ - + 5 3 4 wxALIGN_CENTER_VERTICAL|wxALL 4 1 - + 1 1 1 @@ -2571,7 +3009,7 @@ - + 5 1 0 @@ -2638,7 +3076,7 @@ - + 5 1 0 @@ -2702,7 +3140,7 @@ -1 - + 5 1 1 @@ -2769,14 +3207,14 @@ - + 5 1 4 wxALIGN_CENTER_VERTICAL|wxALL 2 1 - + 1 1 1 @@ -2833,14 +3271,14 @@ -1 - + 5 1 5 wxALL|wxEXPAND 2 1 - + 1 1 1 diff --git a/pcbnew/dialogs/dialog_dimension_properties_base.h b/pcbnew/dialogs/dialog_dimension_properties_base.h index 2c7789a581..1a88d2dc67 100644 --- a/pcbnew/dialogs/dialog_dimension_properties_base.h +++ b/pcbnew/dialogs/dialog_dimension_properties_base.h @@ -20,12 +20,12 @@ class PCB_LAYER_BOX_SELECTOR; #include #include #include -#include #include #include #include #include #include +#include #include #include #include @@ -42,6 +42,15 @@ class DIALOG_DIMENSION_PROPERTIES_BASE : public DIALOG_SHIM private: protected: + wxBoxSizer* m_mainSizer; + wxStaticBoxSizer* m_sizerLeader; + wxStaticText* m_lblLeaderValue; + wxTextCtrl* m_txtLeaderValue; + wxStaticText* m_lblTextFrame; + wxChoice* m_cbTextFrame; + wxStaticText* m_lblLeaderLayer; + PCB_LAYER_BOX_SELECTOR* m_cbLeaderLayer; + wxStaticBoxSizer* m_sizerFormat; wxStaticText* m_lblValue; wxTextCtrl* m_txtValue; wxCheckBox* m_cbOverrideValue; @@ -106,7 +115,7 @@ class DIALOG_DIMENSION_PROPERTIES_BASE : public DIALOG_SHIM public: - DIALOG_DIMENSION_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Dimension Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 654,757 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU ); + DIALOG_DIMENSION_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Dimension Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 654,600 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU ); ~DIALOG_DIMENSION_PROPERTIES_BASE(); }; diff --git a/pcbnew/drc/drc_test_provider.cpp b/pcbnew/drc/drc_test_provider.cpp index b5ccf2a407..369bb1bea0 100644 --- a/pcbnew/drc/drc_test_provider.cpp +++ b/pcbnew/drc/drc_test_provider.cpp @@ -156,7 +156,7 @@ int DRC_TEST_PROVIDER::forEachGeometryItem( const std::vector& aTypes, { if( (item->GetLayerSet() & aLayers).any() ) { - if( typeMask[ PCB_DIMENSION_T ] && item->Type() == PCB_DIMENSION_T ) + if( typeMask[PCB_DIMENSION_T] && BaseType( item->Type() ) == PCB_DIMENSION_T ) { if( !aFunc( item ) ) return n; diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 4af9886c64..c913a9c72d 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -142,7 +142,8 @@ void PCB_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem ) ShowTargetOptionsDialog( static_cast( aItem ) ); break; - case PCB_DIMENSION_T: + case PCB_DIM_ALIGNED_T: + case PCB_DIM_LEADER_T: ShowDimensionPropertyDialog( static_cast( aItem ) ); break; diff --git a/pcbnew/exporters/gen_drill_report_files.cpp b/pcbnew/exporters/gen_drill_report_files.cpp index bfe5509604..55ef154467 100644 --- a/pcbnew/exporters/gen_drill_report_files.cpp +++ b/pcbnew/exporters/gen_drill_report_files.cpp @@ -202,7 +202,8 @@ bool GENDRILL_WRITER_BASE::genDrillMapFile( const wxString& aFullFileName, PLOT_ itemplotter.PlotTextePcb( (TEXTE_PCB*) PtStruct ); break; - case PCB_DIMENSION_T: + case PCB_DIM_ALIGNED_T: + case PCB_DIM_LEADER_T: case PCB_TARGET_T: case PCB_MARKER_T: // do not draw default: diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index 4b91757c34..b6ae0412bf 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -398,8 +398,9 @@ void PCB_IO::Format( BOARD_ITEM* aItem, int aNestLevel ) const format( static_cast( aItem ), aNestLevel ); break; - case PCB_DIMENSION_T: - format( static_cast( aItem ), aNestLevel ); + case PCB_DIM_ALIGNED_T: + case PCB_DIM_LEADER_T: + format( static_cast( aItem ), aNestLevel ); break; case PCB_LINE_T: @@ -659,9 +660,19 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const } -void PCB_IO::format( ALIGNED_DIMENSION* aDimension, int aNestLevel ) const +void PCB_IO::format( DIMENSION* aDimension, int aNestLevel ) const { - m_out->Print( aNestLevel, "(dimension (type aligned)" ); + ALIGNED_DIMENSION* aligned = dynamic_cast( aDimension ); + LEADER* leader = dynamic_cast( aDimension ); + + m_out->Print( aNestLevel, "(dimension" ); + + if( aDimension->Type() == PCB_DIM_ALIGNED_T ) + m_out->Print( 0, " (type aligned)" ); + else if( aDimension->Type() == PCB_DIM_LEADER_T ) + m_out->Print( 0, " (type leader)" ); + else + wxFAIL_MSG( wxT( "Cannot format unknown dimension type!" ) ); formatLayer( aDimension ); @@ -675,8 +686,9 @@ void PCB_IO::format( ALIGNED_DIMENSION* aDimension, int aNestLevel ) const FormatInternalUnits( aDimension->GetEnd().x ).c_str(), FormatInternalUnits( aDimension->GetEnd().y ).c_str() ); - m_out->Print( aNestLevel+1, "(height %s)\n", - FormatInternalUnits( aDimension->GetHeight() ).c_str() ); + if( aligned ) + m_out->Print( aNestLevel+1, "(height %s)\n", + FormatInternalUnits( aligned->GetHeight() ).c_str() ); Format( &aDimension->Text(), aNestLevel+1 ); @@ -705,8 +717,16 @@ void PCB_IO::format( ALIGNED_DIMENSION* aDimension, int aNestLevel ) const FormatInternalUnits( aDimension->GetArrowLength() ).c_str(), static_cast( aDimension->GetTextPositionMode() ) ); - m_out->Print( 0, " (extension_height %s) (extension_offset %s)", - FormatInternalUnits( aDimension->GetExtensionHeight() ).c_str(), + if( aligned ) + { + m_out->Print( 0, " (extension_height %s)", + FormatInternalUnits( aligned->GetExtensionHeight() ).c_str() ); + } + + if( leader ) + m_out->Print( 0, " (text_frame %d)", static_cast( leader->GetTextFrame() ) ); + + m_out->Print( 0, " (extension_offset %s)", FormatInternalUnits( aDimension->GetExtensionOffset() ).c_str() ); if( aDimension->GetKeepTextAligned() ) diff --git a/pcbnew/kicad_plugin.h b/pcbnew/kicad_plugin.h index 136d7dc2cb..e61583cb17 100644 --- a/pcbnew/kicad_plugin.h +++ b/pcbnew/kicad_plugin.h @@ -35,7 +35,7 @@ class FP_CACHE; class PCB_PARSER; class NETINFO_MAPPING; class BOARD_DESIGN_SETTINGS; -class ALIGNED_DIMENSION; +class DIMENSION; class EDGE_MODULE; class DRAWSEGMENT; class PCB_TARGET; @@ -83,7 +83,8 @@ class TEXTE_PCB; //#define SEXPR_BOARD_FILE_VERSION 20200825 // Remove host information //#define SEXPR_BOARD_FILE_VERSION 20200828 // Add new fabrication attributes //#define SEXPR_BOARD_FILE_VERSION 20200829 // Remove library name from exported footprints -#define SEXPR_BOARD_FILE_VERSION 20200909 // Change DIMENSION format +//#define SEXPR_BOARD_FILE_VERSION 20200909 // Change DIMENSION format +#define SEXPR_BOARD_FILE_VERSION 20200913 // Add leader dimension #define BOARD_FILE_HOST_VERSION 20200825 ///< Earlier files than this include the host tag @@ -252,7 +253,7 @@ protected: private: void format( BOARD* aBoard, int aNestLevel = 0 ) const; - void format( ALIGNED_DIMENSION* aDimension, int aNestLevel = 0 ) const; + void format( DIMENSION* aDimension, int aNestLevel = 0 ) const; void format( EDGE_MODULE* aModuleDrawing, int aNestLevel = 0 ) const; diff --git a/pcbnew/menubar_pcb_editor.cpp b/pcbnew/menubar_pcb_editor.cpp index 3ccdd2fa17..b74e506771 100644 --- a/pcbnew/menubar_pcb_editor.cpp +++ b/pcbnew/menubar_pcb_editor.cpp @@ -320,7 +320,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() placeMenu->Add( PCB_ACTIONS::drawPolygon ); placeMenu->AppendSeparator(); - placeMenu->Add( PCB_ACTIONS::drawDimension ); + placeMenu->Add( PCB_ACTIONS::drawAlignedDimension ); + placeMenu->Add( PCB_ACTIONS::drawLeader ); placeMenu->AppendSeparator(); placeMenu->Add( PCB_ACTIONS::placeTarget ); diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index d97d3ab77f..1c02bf7bae 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -720,7 +720,8 @@ void PCB_EDIT_FRAME::setupUIConditions() CURRENT_TOOL( PCB_ACTIONS::drawArc ); CURRENT_TOOL( PCB_ACTIONS::drawPolygon ); CURRENT_TOOL( PCB_ACTIONS::placeText ); - CURRENT_TOOL( PCB_ACTIONS::drawDimension ); + CURRENT_TOOL( PCB_ACTIONS::drawAlignedDimension ); + CURRENT_TOOL( PCB_ACTIONS::drawLeader ); CURRENT_TOOL( PCB_ACTIONS::placeTarget ); CURRENT_TOOL( PCB_ACTIONS::drillOrigin ); CURRENT_TOOL( PCB_ACTIONS::gridSetOrigin ); diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 5732e50528..c8b34bf684 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -443,7 +443,8 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer ) draw( static_cast( item ), aLayer ); break; - case PCB_DIMENSION_T: + case PCB_DIM_ALIGNED_T: + case PCB_DIM_LEADER_T: draw( static_cast( item ), aLayer ); break; @@ -1277,9 +1278,29 @@ void PCB_PAINTER::draw( const DIMENSION* aDimension, int aLayer ) } // Draw dimension shapes - for( const SEG& seg : aDimension->GetLines() ) - m_gal->DrawLine( seg.A, seg.B ); + // TODO(JE) lift this out + for( const std::shared_ptr& shape : aDimension->GetShapes() ) + { + switch( shape->Type() ) + { + case SH_SEGMENT: + { + const SEG& seg = static_cast( shape.get() )->GetSeg(); + m_gal->DrawLine( seg.A, seg.B ); + break; + } + case SH_CIRCLE: + { + int radius = static_cast( shape.get() )->GetRadius(); + m_gal->DrawCircle( shape->Centre(), radius ); + break; + } + + default: + break; + } + } // Draw text TEXTE_PCB& text = aDimension->Text(); VECTOR2D position( text.GetTextPos().x, text.GetTextPos().y ); diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index e8ee92caf4..e0cb198685 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -2354,7 +2354,7 @@ DIMENSION* PCB_PARSER::parseDIMENSION() T token; - std::unique_ptr dimension( new ALIGNED_DIMENSION( nullptr ) ); + std::unique_ptr dimension; // skip value that used to be saved if( NextTok() != T_LEFT ) @@ -2368,6 +2368,7 @@ DIMENSION* PCB_PARSER::parseDIMENSION() if( token == T_width ) { isLegacyDimension = true; + dimension = std::make_unique( nullptr ); dimension->SetLineThickness( parseBoardUnits( "dimension width value" ) ); NeedRIGHT(); } @@ -2376,9 +2377,20 @@ DIMENSION* PCB_PARSER::parseDIMENSION() if( token != T_type ) Expecting( T_type ); - // This function only parses aligned dimensions for now - if( NextTok() != T_aligned ) - Expecting( T_aligned ); + switch( NextTok() ) + { + case T_aligned: + dimension = std::make_unique( nullptr ); + break; + + case T_leader: + dimension = std::make_unique( nullptr ); + break; + + default: + wxFAIL_MSG( wxT( "Cannot parse unknown dimension type %s" ) + + GetTokenString( CurTok() ) ); + } NeedRIGHT(); } @@ -2441,9 +2453,14 @@ DIMENSION* PCB_PARSER::parseDIMENSION() } case T_height: - dimension->SetHeight( parseBoardUnits( "dimension height value" ) ); + { + wxCHECK_MSG( dimension->Type() == PCB_DIM_ALIGNED_T, nullptr, + wxT( "Invalid height token" ) ); + ALIGNED_DIMENSION* aligned = static_cast( dimension.get() ); + aligned->SetHeight( parseBoardUnits( "dimension height value" ) ); NeedRIGHT(); break; + } case T_format: { @@ -2540,9 +2557,14 @@ DIMENSION* PCB_PARSER::parseDIMENSION() } case T_extension_height: - dimension->SetExtensionHeight( parseBoardUnits( "extension height" ) ); + { + wxCHECK_MSG( dimension->Type() == PCB_DIM_ALIGNED_T, nullptr, + wxT( "Invalid extension_height token" ) ); + ALIGNED_DIMENSION* aligned = static_cast( dimension.get() ); + aligned->SetExtensionHeight( parseBoardUnits( "extension height" ) ); NeedRIGHT(); break; + } case T_extension_offset: dimension->SetExtensionOffset( parseBoardUnits( "extension offset" ) ); @@ -2553,6 +2575,19 @@ DIMENSION* PCB_PARSER::parseDIMENSION() dimension->SetKeepTextAligned( true ); break; + case T_text_frame: + { + wxCHECK_MSG( dimension->Type() == PCB_DIM_LEADER_T, nullptr, + wxT( "Invalid text_frame token" ) ); + LEADER* leader = static_cast( dimension.get() ); + + int textFrame = parseInt( "dimension text frame mode" ); + textFrame = std::max( 0, std::min( 3, textFrame ) ); + leader->SetTextFrame( static_cast( textFrame ) ); + NeedRIGHT(); + break; + } + default: Expecting( "thickness, arrow_length, text_position_mode, extension_height, " "extension_offset" ); @@ -2610,11 +2645,14 @@ DIMENSION* 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() ); + // Old style: calculate height from crossbar wxPoint point1, point2; parseXY( &point1.x, &point1.y ); parseXY( &point2.x, &point2.y ); - dimension->UpdateHeight( point2, point1 ); // Yes, backwards intentionally + aligned->UpdateHeight( point2, point1 ); // Yes, backwards intentionally NeedRIGHT(); } diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index 69b3cb78b0..593c503ee5 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -31,8 +31,10 @@ #include #include #include // for SEG +#include #include // for SHAPE_LINE_CHAIN #include // for SHAPE_POLY_SET, SHAPE_P... +#include #include // for KiROUND, Clamp #include // for VECTOR2I #include @@ -311,7 +313,12 @@ void BRDITEMS_PLOTTER::PlotBoardGraphicItems() { case PCB_LINE_T: PlotDrawSegment( (DRAWSEGMENT*) item); break; case PCB_TEXT_T: PlotTextePcb( (TEXTE_PCB*) item ); break; - case PCB_DIMENSION_T: PlotDimension( (DIMENSION*) item ); break; + + case PCB_DIM_ALIGNED_T: + case PCB_DIM_LEADER_T: + PlotDimension( (DIMENSION*) item ); + break; + case PCB_TARGET_T: PlotPcbTarget( (PCB_TARGET*) item ); break; default: break; } @@ -371,11 +378,38 @@ void BRDITEMS_PLOTTER::PlotDimension( DIMENSION* aDim ) PlotTextePcb( &aDim->Text() ); - for( const SEG& seg : aDim->GetLines() ) + for( const std::shared_ptr& shape : aDim->GetShapes() ) { - draw.SetStart( wxPoint( seg.A ) ); - draw.SetEnd( wxPoint( seg.B ) ); - PlotDrawSegment( &draw ); + switch( shape->Type() ) + { + case SH_SEGMENT: + { + const SEG& seg = static_cast( shape.get() )->GetSeg(); + + draw.SetShape( S_SEGMENT ); + draw.SetStart( wxPoint( seg.A ) ); + draw.SetEnd( wxPoint( seg.B ) ); + + PlotDrawSegment( &draw ); + break; + } + + case SH_CIRCLE: + { + wxPoint start( shape->Centre() ); + int radius = static_cast( shape.get() )->GetRadius(); + + draw.SetShape( S_CIRCLE ); + draw.SetStart( start ); + draw.SetEnd( wxPoint( start.x + radius, start.y ) ); + + PlotDrawSegment( &draw ); + break; + } + + default: + break; + } } } diff --git a/pcbnew/toolbars_pcb_editor.cpp b/pcbnew/toolbars_pcb_editor.cpp index df457f336c..3046a226cc 100644 --- a/pcbnew/toolbars_pcb_editor.cpp +++ b/pcbnew/toolbars_pcb_editor.cpp @@ -378,7 +378,9 @@ void PCB_EDIT_FRAME::ReCreateVToolbar() m_drawToolBar->Add( PCB_ACTIONS::drawArc, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( PCB_ACTIONS::drawPolygon, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( PCB_ACTIONS::placeText, ACTION_TOOLBAR::TOGGLE ); - m_drawToolBar->Add( PCB_ACTIONS::drawDimension, ACTION_TOOLBAR::TOGGLE ); + m_drawToolBar->Add( PCB_ACTIONS::drawAlignedDimension, ACTION_TOOLBAR::TOGGLE ); + // TODO: re-insert when we have a multi-select tool button + // m_drawToolBar->Add( PCB_ACTIONS::drawLeader, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( PCB_ACTIONS::placeTarget, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( ACTIONS::deleteTool, ACTION_TOOLBAR::TOGGLE ); diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index 454a1f5fab..0c6e4eefea 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -604,10 +604,11 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent ) if( m_editModules && !m_frame->GetModel() ) return 0; - POINT_EDITOR* pointEditor = m_toolMgr->GetTool(); - ALIGNED_DIMENSION* dimension = nullptr; - BOARD_COMMIT commit( m_frame ); - GRID_HELPER grid( m_toolMgr, m_frame->GetMagneticItemsSettings() ); + TOOL_EVENT originalEvent = aEvent; + POINT_EDITOR* pointEditor = m_toolMgr->GetTool(); + DIMENSION* dimension = nullptr; + BOARD_COMMIT commit( m_frame ); + GRID_HELPER grid( m_toolMgr, m_frame->GetMagneticItemsSettings() ); const BOARD_DESIGN_SETTINGS& boardSettings = m_board->GetDesignSettings(); @@ -731,27 +732,40 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent ) layer = Dwgs_User; // Init the new item attributes - dimension = new ALIGNED_DIMENSION( m_board ); + if( originalEvent.IsAction( &PCB_ACTIONS::drawAlignedDimension ) ) + { + dimension = new ALIGNED_DIMENSION( m_board ); + + dimension->SetUnitsMode( boardSettings.m_DimensionUnitsMode ); + dimension->SetUnitsFormat( boardSettings.m_DimensionUnitsFormat ); + dimension->SetPrecision( boardSettings.m_DimensionPrecision ); + dimension->SetSuppressZeroes( boardSettings.m_DimensionSuppressZeroes ); + dimension->SetTextPositionMode( boardSettings.m_DimensionTextPosition ); + dimension->SetKeepTextAligned( boardSettings.m_DimensionKeepTextAligned ); + + if( boardSettings.m_DimensionUnitsMode == DIM_UNITS_MODE::AUTOMATIC ) + dimension->SetUnits( m_frame->GetUserUnits(), false ); + } + else if( originalEvent.IsAction( &PCB_ACTIONS::drawLeader ) ) + { + dimension = new LEADER( m_board ); + dimension->Text().SetPosition( wxPoint( cursorPos ) ); + } + else + { + wxFAIL_MSG( "Unhandled action in DRAWING_TOOL::DrawDimension" ); + } + dimension->SetLayer( layer ); - dimension->SetPrecision( boardSettings.m_DimensionPrecision ); dimension->Text().SetTextSize( boardSettings.GetTextSize( layer ) ); dimension->Text().SetTextThickness( boardSettings.GetTextThickness( layer ) ); dimension->Text().SetItalic( boardSettings.GetTextItalic( layer ) ); dimension->SetLineThickness( boardSettings.GetLineThickness( layer ) ); - dimension->SetUnitsMode( boardSettings.m_DimensionUnitsMode ); - dimension->SetUnitsFormat( boardSettings.m_DimensionUnitsFormat ); - dimension->SetPrecision( boardSettings.m_DimensionPrecision ); - dimension->SetSuppressZeroes( boardSettings.m_DimensionSuppressZeroes ); - dimension->SetTextPositionMode( boardSettings.m_DimensionTextPosition ); - dimension->SetKeepTextAligned( boardSettings.m_DimensionKeepTextAligned ); dimension->SetArrowLength( boardSettings.m_DimensionArrowLength ); dimension->SetExtensionOffset( boardSettings.m_DimensionExtensionOffset ); dimension->SetStart( (wxPoint) cursorPos ); dimension->SetEnd( (wxPoint) cursorPos ); - if( boardSettings.m_DimensionUnitsMode == DIM_UNITS_MODE::AUTOMATIC ) - dimension->SetUnits( m_frame->GetUserUnits(), false ); - preview.Add( dimension ); m_controls->SetAutoPan( true ); @@ -768,12 +782,27 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent ) // Dimensions that have origin and end in the same spot are not valid if( dimension->GetStart() == dimension->GetEnd() ) --step; + else if( dimension->Type() == PCB_DIM_LEADER_T ) + dimension->SetText( wxT( "?" ) ); break; case SET_HEIGHT: { - if( (wxPoint) cursorPos != dimension->GetPosition() ) + if( dimension->Type() == PCB_DIM_LEADER_T ) + { + assert( dimension->GetStart() != dimension->GetEnd() ); + assert( dimension->GetLineThickness() > 0 ); + + preview.Remove( dimension ); + + commit.Add( dimension ); + commit.Push( _( "Draw a leader" ) ); + + // Run the edit immediately to set the leader text + m_toolMgr->RunAction( PCB_ACTIONS::properties, true, dimension ); + } + else if( (wxPoint) cursorPos != dimension->GetPosition() ) { assert( dimension->GetStart() != dimension->GetEnd() ); assert( dimension->GetLineThickness() > 0 ); @@ -810,12 +839,26 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent ) case SET_HEIGHT: { - // Calculating the direction of travel perpendicular to the selected axis - double angle = dimension->GetAngle() + ( M_PI / 2 ); + if( dimension->Type() == PCB_DIM_ALIGNED_T ) + { + ALIGNED_DIMENSION* aligned = static_cast( dimension ); - wxPoint delta( (wxPoint) cursorPos - dimension->GetEnd() ); - double height = ( delta.x * cos( angle ) ) + ( delta.y * sin( angle ) ); - dimension->SetHeight( height ); + // Calculating the direction of travel perpendicular to the selected axis + double angle = aligned->GetAngle() + ( M_PI / 2 ); + + wxPoint delta( (wxPoint) cursorPos - dimension->GetEnd() ); + double height = ( delta.x * cos( angle ) ) + ( delta.y * sin( angle ) ); + aligned->SetHeight( height ); + } + else + { + wxASSERT( dimension->Type() == PCB_DIM_LEADER_T ); + + VECTOR2I lineVector( cursorPos - dimension->GetEnd() ); + dimension->Text().SetPosition( wxPoint( VECTOR2I( dimension->GetEnd() ) + + GetVectorSnapped45( lineVector ) ) ); + dimension->Update(); + } } break; } @@ -2083,7 +2126,8 @@ void DRAWING_TOOL::setTransitions() Go( &DRAWING_TOOL::DrawRectangle, PCB_ACTIONS::drawRectangle.MakeEvent() ); Go( &DRAWING_TOOL::DrawCircle, PCB_ACTIONS::drawCircle.MakeEvent() ); Go( &DRAWING_TOOL::DrawArc, PCB_ACTIONS::drawArc.MakeEvent() ); - Go( &DRAWING_TOOL::DrawDimension, PCB_ACTIONS::drawDimension.MakeEvent() ); + Go( &DRAWING_TOOL::DrawDimension, PCB_ACTIONS::drawAlignedDimension.MakeEvent() ); + Go( &DRAWING_TOOL::DrawDimension, PCB_ACTIONS::drawLeader.MakeEvent() ); Go( &DRAWING_TOOL::DrawZone, PCB_ACTIONS::drawZone.MakeEvent() ); Go( &DRAWING_TOOL::DrawZone, PCB_ACTIONS::drawZoneKeepout.MakeEvent() ); Go( &DRAWING_TOOL::DrawZone, PCB_ACTIONS::drawZoneCutout.MakeEvent() ); diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 7ecc9493e4..0429bd7906 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -1420,7 +1420,8 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent ) case PCB_VIA_T: case PCB_ZONE_AREA_T: case PCB_TARGET_T: - case PCB_DIMENSION_T: + case PCB_DIM_ALIGNED_T: + case PCB_DIM_LEADER_T: dupe_item = orig_item->Duplicate(); break; diff --git a/pcbnew/tools/grid_helper.cpp b/pcbnew/tools/grid_helper.cpp index e73850b1ee..5c3f6bcde0 100644 --- a/pcbnew/tools/grid_helper.cpp +++ b/pcbnew/tools/grid_helper.cpp @@ -546,7 +546,7 @@ void GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos, bo break; } - case PCB_DIMENSION_T: + case PCB_DIM_ALIGNED_T: { const ALIGNED_DIMENSION* dim = static_cast( aItem ); addAnchor( dim->GetCrossbarStart(), CORNER | SNAPPABLE, aItem ); @@ -556,6 +556,15 @@ void GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos, bo break; } + case PCB_DIM_LEADER_T: + { + const LEADER* leader = static_cast( aItem ); + addAnchor( leader->GetStart(), CORNER | SNAPPABLE, aItem ); + addAnchor( leader->GetEnd(), CORNER | SNAPPABLE, aItem ); + addAnchor( leader->Text().GetPosition(), CORNER | SNAPPABLE, aItem ); + break; + } + case PCB_MODULE_TEXT_T: case PCB_TEXT_T: addAnchor( aItem->GetPosition(), ORIGIN, aItem ); diff --git a/pcbnew/tools/pcb_actions.cpp b/pcbnew/tools/pcb_actions.cpp index 4968986d3c..7bd8e253a8 100644 --- a/pcbnew/tools/pcb_actions.cpp +++ b/pcbnew/tools/pcb_actions.cpp @@ -116,11 +116,16 @@ TOOL_ACTION PCB_ACTIONS::placeText( "pcbnew.InteractiveDrawing.text", _( "Add Text" ), _( "Add a text item" ), text_xpm, AF_ACTIVATE ); -TOOL_ACTION PCB_ACTIONS::drawDimension( "pcbnew.InteractiveDrawing.dimension", +TOOL_ACTION PCB_ACTIONS::drawAlignedDimension( "pcbnew.InteractiveDrawing.alignedDimension", AS_GLOBAL, MD_SHIFT + MD_CTRL + 'H', LEGACY_HK_NAME( "Add Dimension" ), - _( "Add Dimension" ), _( "Add a dimension" ), - add_dimension_xpm, AF_ACTIVATE ); + _( "Add Aligned Dimension" ), _( "Add an aligned linear dimension" ), + add_aligned_dimension_xpm, AF_ACTIVATE ); + +TOOL_ACTION PCB_ACTIONS::drawLeader( "pcbnew.InteractiveDrawing.leader", + AS_GLOBAL, 0, "", + _( "Add Leader" ), _( "Add a leader dimension" ), + add_leader_xpm, AF_ACTIVATE ); TOOL_ACTION PCB_ACTIONS::drawZone( "pcbnew.InteractiveDrawing.zone", AS_GLOBAL, diff --git a/pcbnew/tools/pcb_actions.h b/pcbnew/tools/pcb_actions.h index 9aad1231eb..7ac852e5e1 100644 --- a/pcbnew/tools/pcb_actions.h +++ b/pcbnew/tools/pcb_actions.h @@ -139,7 +139,8 @@ public: static TOOL_ACTION drawCircle; static TOOL_ACTION drawArc; static TOOL_ACTION placeText; - static TOOL_ACTION drawDimension; + static TOOL_ACTION drawAlignedDimension; + static TOOL_ACTION drawLeader; static TOOL_ACTION drawZone; static TOOL_ACTION drawVia; static TOOL_ACTION drawZoneKeepout; diff --git a/pcbnew/tools/pcb_viewer_tools.cpp b/pcbnew/tools/pcb_viewer_tools.cpp index 999d92feec..225de15d1d 100644 --- a/pcbnew/tools/pcb_viewer_tools.cpp +++ b/pcbnew/tools/pcb_viewer_tools.cpp @@ -149,7 +149,7 @@ int PCB_VIEWER_TOOLS::GraphicOutlines( const TOOL_EVENT& aEvent ) { KICAD_T t = item->Type(); - if( t == PCB_LINE_T || t == PCB_DIMENSION_T || t == PCB_TARGET_T ) + if( t == PCB_LINE_T || BaseType( t ) == PCB_DIMENSION_T || t == PCB_TARGET_T ) view()->Update( item, KIGFX::GEOMETRY ); } @@ -182,7 +182,7 @@ int PCB_VIEWER_TOOLS::TextOutlines( const TOOL_EVENT& aEvent ) { KICAD_T t = item->Type(); - if( t == PCB_TEXT_T || t == PCB_DIMENSION_T ) + if( t == PCB_TEXT_T || BaseType( t ) == PCB_DIMENSION_T ) view()->Update( item, KIGFX::GEOMETRY ); } diff --git a/pcbnew/tools/point_editor.cpp b/pcbnew/tools/point_editor.cpp index 1c53a39f74..277239b45c 100644 --- a/pcbnew/tools/point_editor.cpp +++ b/pcbnew/tools/point_editor.cpp @@ -76,11 +76,11 @@ enum BEZIER_CURVE_POINTS enum DIMENSION_POINTS { - DIM_CROSSBARSTART, - DIM_CROSSBAREND, DIM_START, DIM_END, - DIM_TEXT + DIM_TEXT, + DIM_CROSSBARSTART, + DIM_CROSSBAREND, }; class EDIT_POINTS_FACTORY @@ -244,7 +244,7 @@ public: } break; - case PCB_DIMENSION_T: + case PCB_DIM_ALIGNED_T: { const ALIGNED_DIMENSION* dimension = static_cast( aItem ); @@ -262,6 +262,17 @@ public: } break; + case PCB_DIM_LEADER_T: + { + const LEADER* dimension = static_cast( aItem ); + + points->AddPoint( dimension->GetStart() ); + points->AddPoint( dimension->GetEnd() ); + points->AddPoint( dimension->Text().GetPosition() ); + + break; + } + default: points.reset(); break; @@ -377,7 +388,7 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent ) BOARD_COMMIT commit( editFrame ); LSET snapLayers = item->GetLayerSet(); - if( item->Type() == PCB_DIMENSION_T ) + if( BaseType( item->Type() ) == PCB_DIMENSION_T ) snapLayers = LSET::AllLayersMask(); // Main loop: keep receiving events @@ -1252,7 +1263,7 @@ void POINT_EDITOR::updateItem() const break; } - case PCB_DIMENSION_T: + case PCB_DIM_ALIGNED_T: { ALIGNED_DIMENSION* dimension = static_cast( item ); @@ -1310,6 +1321,33 @@ void POINT_EDITOR::updateItem() const break; } + case PCB_DIM_LEADER_T: + { + LEADER* dimension = static_cast( item ); + + if( isModified( m_editPoints->Point( DIM_START ) ) ) + { + dimension->SetStart( wxPoint( m_editedPoint->GetPosition().x, + m_editedPoint->GetPosition().y ) ); + } + else if( isModified( m_editPoints->Point( DIM_END ) ) ) + { + wxPoint newPoint( m_editedPoint->GetPosition().x, m_editedPoint->GetPosition().y ); + wxPoint delta = newPoint - dimension->GetEnd(); + + dimension->SetEnd( newPoint ); + dimension->Text().SetPosition( dimension->Text().GetPosition() + delta ); + } + else if( isModified( m_editPoints->Point( DIM_TEXT ) ) ) + { + dimension->Text().SetPosition( wxPoint( m_editedPoint->GetPosition() ) ); + } + + dimension->Update(); + + break; + } + default: break; } @@ -1527,12 +1565,22 @@ void POINT_EDITOR::updatePoints() break; } - case PCB_DIMENSION_T: + case PCB_DIM_ALIGNED_T: { const ALIGNED_DIMENSION* dimension = static_cast( item ); + m_editPoints->Point( DIM_START ).SetPosition( dimension->GetStart() ); + m_editPoints->Point( DIM_END ).SetPosition( dimension->GetEnd() ); + m_editPoints->Point( DIM_TEXT ).SetPosition( dimension->Text().GetPosition() ); m_editPoints->Point( DIM_CROSSBARSTART ).SetPosition( dimension->GetCrossbarStart() ); m_editPoints->Point( DIM_CROSSBAREND ).SetPosition( dimension->GetCrossbarEnd() ); + break; + } + + case PCB_DIM_LEADER_T: + { + const LEADER* dimension = static_cast( item ); + m_editPoints->Point( DIM_START ).SetPosition( dimension->GetStart() ); m_editPoints->Point( DIM_END ).SetPosition( dimension->GetEnd() ); m_editPoints->Point( DIM_TEXT ).SetPosition( dimension->Text().GetPosition() ); @@ -1633,7 +1681,7 @@ EDIT_POINT POINT_EDITOR::get45DegConstrainer() const break; } - case PCB_DIMENSION_T: + case PCB_DIM_ALIGNED_T: { // Constraint for crossbar if( isModified( m_editPoints->Point( DIM_START ) ) ) diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index fb513d3025..afda41c64e 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -1377,7 +1377,8 @@ static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem, const BOARD& aBoard } case PCB_LINE_T: case PCB_TARGET_T: - case PCB_DIMENSION_T: + case PCB_DIM_ALIGNED_T: + case PCB_DIM_LEADER_T: { if( layer == Edge_Cuts ) include = aFilterOptions.includeBoardOutlineLayer; @@ -1512,7 +1513,8 @@ bool SELECTION_TOOL::itemPassesFilter( BOARD_ITEM* aItem ) break; - case PCB_DIMENSION_T: + case PCB_DIM_ALIGNED_T: + case PCB_DIM_LEADER_T: if( !m_filter.dimensions ) return false;