diff --git a/bitmaps_png/CMakeLists.txt b/bitmaps_png/CMakeLists.txt index 7e882336cd..dc54e11a10 100644 --- a/bitmaps_png/CMakeLists.txt +++ b/bitmaps_png/CMakeLists.txt @@ -116,6 +116,8 @@ set( BMAPS_MID add_dimension add_entry add_glabel + add_graphical_segments + add_graphical_polygon add_hierarchical_label add_hierar_pin add_hierarchical_subsheet diff --git a/bitmaps_png/cpp_26/add_graphical_polygon.cpp b/bitmaps_png/cpp_26/add_graphical_polygon.cpp new file mode 100644 index 0000000000..0e98790248 --- /dev/null +++ b/bitmaps_png/cpp_26/add_graphical_polygon.cpp @@ -0,0 +1,39 @@ + +/* 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, 0x01, 0x61, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0x63, 0x60, 0x18, 0x05, 0xd4, + 0x01, 0x27, 0x0e, 0x03, 0xf1, 0x67, 0x20, 0xbe, 0x0a, 0xc4, 0x3b, 0x81, 0x78, 0x1e, 0x03, 0xc3, + 0xf1, 0x06, 0x20, 0x4e, 0x01, 0x62, 0x4f, 0x06, 0x86, 0x53, 0xda, 0x0c, 0x0c, 0x67, 0xf8, 0xa9, + 0x61, 0xd1, 0x7f, 0x22, 0x31, 0xba, 0x63, 0xaa, 0x19, 0x18, 0x0e, 0x0b, 0x92, 0x6c, 0x51, 0x76, + 0xf6, 0xbb, 0xff, 0x31, 0x31, 0x2f, 0xfe, 0xfb, 0xf9, 0x3d, 0xfe, 0xef, 0xe0, 0x70, 0xef, 0xbf, + 0xa1, 0xe1, 0xc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0x77, 0xff, 0x83, 0x82, 0x9e, 0xfe, 0x37, 0x33, + 0xbb, 0xfd, 0x5f, 0x52, 0xf2, 0xe2, 0x7f, 0x26, 0xa6, 0x93, 0xd8, 0x0a, 0xd9, 0xc3, 0x24, 0x59, + 0x54, 0x53, 0xf3, 0xf9, 0x7f, 0x72, 0xf2, 0xab, 0xff, 0x9e, 0x9e, 0x0f, 0xff, 0x6b, 0x6b, 0x5f, + 0xff, 0xcf, 0xc3, 0x73, 0x06, 0x9b, 0xa1, 0x7f, 0xa0, 0xd5, 0xc6, 0x22, 0x20, 0x4e, 0x83, 0xd4, + 0x5b, 0xff, 0x19, 0x09, 0x5a, 0x44, 0x84, 0x6b, 0x5f, 0x02, 0xf1, 0x46, 0x20, 0xae, 0x00, 0x16, + 0xa4, 0xf6, 0x0c, 0x0c, 0x17, 0xb9, 0xa9, 0x51, 0xf1, 0x91, 0xea, 0x5a, 0xa2, 0xab, 0x72, 0x4a, + 0x5d, 0x3b, 0x0a, 0xa8, 0x0b, 0x00, 0x9e, 0x40, 0x15, 0x36, 0x37, 0x00, 0x77, 0x7b, 0x00, 0x00, + 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, +}; + +const BITMAP_OPAQUE add_graphical_polygon_xpm[1] = {{ png, sizeof( png ), "add_graphical_polygon_xpm" }}; + +//EOF diff --git a/bitmaps_png/cpp_26/add_graphical_segments.cpp b/bitmaps_png/cpp_26/add_graphical_segments.cpp new file mode 100644 index 0000000000..1207ed0875 --- /dev/null +++ b/bitmaps_png/cpp_26/add_graphical_segments.cpp @@ -0,0 +1,51 @@ + +/* 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, 0x1d, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0x63, 0x60, 0xa0, 0x27, 0xc8, + 0xcd, 0xcd, 0x65, 0x4f, 0xc9, 0x4e, 0x9d, 0x94, 0x92, 0x95, 0xf2, 0x01, 0x84, 0x93, 0x73, 0x52, + 0x27, 0x80, 0xc4, 0xa8, 0x6e, 0x11, 0xc8, 0x92, 0xb0, 0xba, 0xa8, 0x6f, 0x86, 0x3b, 0x1c, 0xff, + 0x1b, 0xec, 0x70, 0xf8, 0x1f, 0x56, 0x17, 0xf3, 0x15, 0x64, 0x19, 0x31, 0x7a, 0x53, 0x53, 0x53, + 0xdd, 0xd3, 0xd2, 0xd2, 0x0a, 0x81, 0xd8, 0x8d, 0xb0, 0x45, 0x40, 0x5f, 0x80, 0x2c, 0xd0, 0x3a, + 0x64, 0x03, 0xc6, 0x20, 0x0b, 0xe3, 0xd3, 0x32, 0x7f, 0x33, 0x30, 0x9c, 0x98, 0xc7, 0xc0, 0x70, + 0xbc, 0x01, 0x88, 0x53, 0x80, 0xd8, 0x93, 0x81, 0xe1, 0x94, 0x36, 0x03, 0xc3, 0x19, 0x7e, 0x98, + 0xbe, 0xa4, 0xec, 0x94, 0xcd, 0xb1, 0x25, 0x09, 0x9f, 0xbc, 0xfb, 0x82, 0x7f, 0xc5, 0x16, 0xc7, + 0x7f, 0x4a, 0xca, 0x4e, 0xda, 0x48, 0xb2, 0x45, 0x71, 0x29, 0xd9, 0xff, 0x81, 0x16, 0xe1, 0xc2, + 0x9f, 0x15, 0x14, 0x56, 0x3c, 0x8c, 0x2c, 0x48, 0xf9, 0xad, 0x7d, 0xd0, 0x16, 0xac, 0x47, 0xfb, + 0x80, 0xed, 0xff, 0x38, 0xa0, 0xa5, 0xe9, 0xe9, 0xe9, 0xae, 0x38, 0x2d, 0x02, 0x05, 0x53, 0x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 0xd5, 0xb0, 0x83, 0x18, + 0x00, 0x00, 0x06, 0xd3, 0x8e, 0xf0, 0xd7, 0x9a, 0xbb, 0xe9, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, + 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, +}; + +const BITMAP_OPAQUE add_graphical_segments_xpm[1] = {{ png, sizeof( png ), "add_graphical_segments_xpm" }}; + +//EOF diff --git a/bitmaps_png/sources/add_graphical_polygon.svg b/bitmaps_png/sources/add_graphical_polygon.svg new file mode 100644 index 0000000000..699792c942 --- /dev/null +++ b/bitmaps_png/sources/add_graphical_polygon.svg @@ -0,0 +1,67 @@ + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/bitmaps_png/sources/add_graphical_segments.svg b/bitmaps_png/sources/add_graphical_segments.svg new file mode 100644 index 0000000000..6cf48a0710 --- /dev/null +++ b/bitmaps_png/sources/add_graphical_segments.svg @@ -0,0 +1,103 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/include/bitmaps.h b/include/bitmaps.h index 800ec2d1a6..f608264160 100644 --- a/include/bitmaps.h +++ b/include/bitmaps.h @@ -41,6 +41,8 @@ EXTERN_BITMAP( add_dashed_line_xpm ) EXTERN_BITMAP( add_dimension_xpm ) EXTERN_BITMAP( add_entry_xpm ) EXTERN_BITMAP( add_glabel_xpm ) +EXTERN_BITMAP( add_graphical_segments_xpm ) +EXTERN_BITMAP( add_graphical_polygon_xpm ) EXTERN_BITMAP( add_hierarchical_label_xpm ) EXTERN_BITMAP( add_hierarchical_subsheet_xpm ) EXTERN_BITMAP( add_hierar_pin_xpm ) diff --git a/pcbnew/menubar_pcbframe.cpp b/pcbnew/menubar_pcbframe.cpp index 66b5120317..570d633231 100644 --- a/pcbnew/menubar_pcbframe.cpp +++ b/pcbnew/menubar_pcbframe.cpp @@ -335,9 +335,14 @@ void preparePlaceMenu( wxMenu* aParentMenu ) KiBitmap( add_circle_xpm ) ); AddMenuItem( aParentMenu, ID_PCB_ADD_LINE_BUTT, - _( "&Line or Polygon" ), - _( "Add graphic line or polygon" ), - KiBitmap( add_polygon_xpm ) ); + _( "&Lines" ), + _( "Add graphic lines" ), + KiBitmap( add_graphical_segments_xpm ) ); + + AddMenuItem( aParentMenu, ID_PCB_ADD_POLYGON_BUTT, + _( "&Polygons" ), + _( "Add graphic polygons" ), + KiBitmap( add_graphical_polygon_xpm ) ); aParentMenu->AppendSeparator(); @@ -469,25 +474,12 @@ void prepareEditMenu( wxMenu* aParentMenu, bool aUseGal ) _( "&Delete" ), _( "Delete items" ), KiBitmap( delete_xpm ) ); + aParentMenu->AppendSeparator(); + text = AddHotkeyName( _( "&Find" ), g_Pcbnew_Editor_Hokeys_Descr, HK_FIND_ITEM ); AddMenuItem( aParentMenu, ID_FIND_ITEMS, text, HELP_FIND , KiBitmap( find_xpm ) ); aParentMenu->AppendSeparator(); - - if( aUseGal ) - { - text = AddHotkeyName( _( "&Cut" ), g_Pcbnew_Editor_Hokeys_Descr, HK_EDIT_CUT ); - AddMenuItem( aParentMenu, ID_EDIT_CUT, text, _( - "Cuts the selected item(s) to the Clipboard" ), KiBitmap( cut_xpm ) ); - text = AddHotkeyName( _( "&Copy" ), g_Pcbnew_Editor_Hokeys_Descr, HK_EDIT_COPY ); - AddMenuItem( aParentMenu, ID_EDIT_COPY, text, _( - "Copies the selected item(s) to the Clipboard" ), KiBitmap( copy_xpm ) ); - text = AddHotkeyName( _( "&Paste" ), g_Pcbnew_Editor_Hokeys_Descr, HK_EDIT_PASTE ); - AddMenuItem( aParentMenu, ID_EDIT_PASTE, text, _( - "Pastes item(s) from the Clipboard" ), KiBitmap( paste_xpm ) ); - aParentMenu->AppendSeparator(); - } - AddMenuItem( aParentMenu, ID_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE, _( "Edit All Tracks and Vias" ), KiBitmap( width_track_via_xpm ) ); @@ -526,7 +518,7 @@ void prepareViewMenu( wxMenu* aParentMenu ) * From hotkeys, zooming is made around the mouse cursor position * (obviously not possible from the toolbar or menubar command) * - * in other words HK_ZOOM_IN and HK_ZOOM_OUT *are NOT* accelerator + * in other words HK_ZOOM_IN and HK_ZOOM_OUT *are NOT* accelerators * for Zoom in and Zoom out sub menus */ text = AddHotkeyName( _( "Zoom &In" ), g_Pcbnew_Editor_Hokeys_Descr, diff --git a/pcbnew/pcbnew_id.h b/pcbnew/pcbnew_id.h index 8b8e51c3db..b4c25ff62e 100644 --- a/pcbnew/pcbnew_id.h +++ b/pcbnew/pcbnew_id.h @@ -33,6 +33,7 @@ enum pcbnew_ids ID_PCB_DRAW_VIA_BUTT, ID_PCB_KEEPOUT_AREA_BUTT, ID_PCB_ADD_LINE_BUTT, + ID_PCB_ADD_POLYGON_BUTT, ID_PCB_CIRCLE_BUTT, ID_PCB_ARC_BUTT, ID_PCB_ADD_TEXT_BUTT, @@ -342,6 +343,7 @@ enum pcbnew_ids ID_MODEDIT_LINE_TOOL, ID_MODEDIT_CIRCLE_TOOL, ID_MODEDIT_ARC_TOOL, + ID_MODEDIT_POLYGON_TOOL, ID_MODEDIT_TEXT_TOOL, ID_MODEDIT_ANCHOR_TOOL, ID_MODEDIT_DELETE_TOOL, diff --git a/pcbnew/tool_modedit.cpp b/pcbnew/tool_modedit.cpp index 97f1a93ae7..7cea7beb41 100644 --- a/pcbnew/tool_modedit.cpp +++ b/pcbnew/tool_modedit.cpp @@ -170,8 +170,8 @@ void FOOTPRINT_EDIT_FRAME::ReCreateVToolbar() _( "Add pad" ), wxITEM_CHECK ); m_drawToolBar->AddSeparator(); - m_drawToolBar->AddTool( ID_MODEDIT_LINE_TOOL, wxEmptyString, KiBitmap( add_polygon_xpm ), - _( "Add graphic line or polygon" ), wxITEM_CHECK ); + m_drawToolBar->AddTool( ID_MODEDIT_LINE_TOOL, wxEmptyString, KiBitmap( add_graphical_segments_xpm ), + _( "Add graphic line" ), wxITEM_CHECK ); m_drawToolBar->AddTool( ID_MODEDIT_CIRCLE_TOOL, wxEmptyString, KiBitmap( add_circle_xpm ), _( "Add graphic circle" ), wxITEM_CHECK ); @@ -179,6 +179,9 @@ void FOOTPRINT_EDIT_FRAME::ReCreateVToolbar() m_drawToolBar->AddTool( ID_MODEDIT_ARC_TOOL, wxEmptyString, KiBitmap( add_arc_xpm ), _( "Add graphic arc" ), wxITEM_CHECK ); + m_drawToolBar->AddTool( ID_MODEDIT_POLYGON_TOOL, wxEmptyString, KiBitmap( add_graphical_polygon_xpm ), + _( "Add graphic polygon" ), wxITEM_CHECK ); + m_drawToolBar->AddTool( ID_MODEDIT_TEXT_TOOL, wxEmptyString, KiBitmap( text_xpm ), _( "Add Text" ), wxITEM_CHECK ); diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index 193efcec18..a7a25e85d7 100644 --- a/pcbnew/tool_pcb.cpp +++ b/pcbnew/tool_pcb.cpp @@ -452,8 +452,9 @@ void PCB_EDIT_FRAME::ReCreateVToolbar() _( "Add keepout areas" ), wxITEM_CHECK ); m_drawToolBar->AddSeparator(); - m_drawToolBar->AddTool( ID_PCB_ADD_LINE_BUTT, wxEmptyString, KiBitmap( add_dashed_line_xpm ), - _( "Add graphic line or polygon" ), wxITEM_CHECK ); + + m_drawToolBar->AddTool( ID_PCB_ADD_LINE_BUTT, wxEmptyString, KiBitmap( add_graphical_segments_xpm ), + _( "Add graphic lines" ), wxITEM_CHECK ); m_drawToolBar->AddTool( ID_PCB_CIRCLE_BUTT, wxEmptyString, KiBitmap( add_circle_xpm ), _( "Add graphic circle" ), wxITEM_CHECK ); @@ -461,6 +462,9 @@ void PCB_EDIT_FRAME::ReCreateVToolbar() m_drawToolBar->AddTool( ID_PCB_ARC_BUTT, wxEmptyString, KiBitmap( add_arc_xpm ), _( "Add graphic arc" ), wxITEM_CHECK ); + m_drawToolBar->AddTool( ID_PCB_ADD_POLYGON_BUTT, wxEmptyString, KiBitmap( add_graphical_polygon_xpm ), + _( "Add graphic polygon" ), wxITEM_CHECK ); + m_drawToolBar->AddTool( ID_PCB_ADD_TEXT_BUTT, wxEmptyString, KiBitmap( text_xpm ), _( "Add text on copper layers or graphic text" ), wxITEM_CHECK ); diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index abdcd46384..2c3ca4498d 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -68,6 +68,10 @@ TOOL_ACTION PCB_ACTIONS::drawLine( "pcbnew.InteractiveDrawing.line", AS_GLOBAL, 0, _( "Draw Line" ), _( "Draw a line" ), NULL, AF_ACTIVATE ); +TOOL_ACTION PCB_ACTIONS::drawGraphicPolygon( "pcbnew.InteractiveDrawing.graphicPolygon", + AS_GLOBAL, 0, + _( "Draw Graphic Polygon" ), _( "Draw a graphic polygon" ), NULL, AF_ACTIVATE ); + TOOL_ACTION PCB_ACTIONS::drawCircle( "pcbnew.InteractiveDrawing.circle", AS_GLOBAL, 0, _( "Draw Circle" ), _( "Draw a circle" ), NULL, AF_ACTIVATE ); @@ -668,6 +672,15 @@ int DRAWING_TOOL::DrawZoneCutout( const TOOL_EVENT& aEvent ) return drawZone( false, ZONE_MODE::CUTOUT ); } +int DRAWING_TOOL::DrawGraphicPolygon( const TOOL_EVENT& aEvent ) +{ + SCOPED_DRAW_MODE scopedDrawMode( m_mode, MODE::GRAPHIC_POLYGON ); + + m_frame->SetToolID( ID_PCB_ADD_POLYGON_BUTT, wxCURSOR_PENCIL, _( "Add graphic polygon" ) ); + + return drawZone( false, ZONE_MODE::GRAPHIC_POLYGON ); +} + int DRAWING_TOOL::DrawSimilarZone( const TOOL_EVENT& aEvent ) { @@ -1207,7 +1220,7 @@ bool DRAWING_TOOL::getSourceZoneForAction( ZONE_MODE aMode, ZONE_CONTAINER*& aZo aZone = nullptr; // not an action that needs a source zone - if( aMode == ZONE_MODE::ADD ) + if( aMode == ZONE_MODE::ADD || aMode == ZONE_MODE::GRAPHIC_POLYGON ) return true; SELECTION_TOOL* selTool = m_toolMgr->GetTool(); @@ -1531,6 +1544,7 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent ) void DRAWING_TOOL::setTransitions() { Go( &DRAWING_TOOL::DrawLine, PCB_ACTIONS::drawLine.MakeEvent() ); + Go( &DRAWING_TOOL::DrawGraphicPolygon, PCB_ACTIONS::drawGraphicPolygon.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() ); diff --git a/pcbnew/tools/drawing_tool.h b/pcbnew/tools/drawing_tool.h index 61dc3942f3..871993a830 100644 --- a/pcbnew/tools/drawing_tool.h +++ b/pcbnew/tools/drawing_tool.h @@ -77,6 +77,7 @@ public: DIMENSION, KEEPOUT, ZONE, + GRAPHIC_POLYGON }; /** @@ -134,6 +135,7 @@ public: * polyline finishes the drawing. */ int DrawZone( const TOOL_EVENT& aEvent ); + int DrawGraphicPolygon( const TOOL_EVENT& aEvent ); int DrawVia( const TOOL_EVENT& aEvent ); @@ -185,7 +187,8 @@ private: { ADD, ///< Add a new zone/keepout with fresh settings CUTOUT, ///< Make a cutout to an existing zone - SIMILAR ///< Add a new zone with the same settings as an existing one + SIMILAR, ///< Add a new zone with the same settings as an existing one + GRAPHIC_POLYGON }; ///> Shows the context menu for the drawing tool diff --git a/pcbnew/tools/grid_helper.cpp b/pcbnew/tools/grid_helper.cpp index f01f2f8e63..00789bce51 100644 --- a/pcbnew/tools/grid_helper.cpp +++ b/pcbnew/tools/grid_helper.cpp @@ -353,6 +353,12 @@ void GRID_HELPER::computeAnchors( BOARD_ITEM* aItem, const VECTOR2I& aRefPos ) break; } + case S_POLYGON: + { + // no anchors for the moment + break; + } + default: { origin = dseg->GetStart(); diff --git a/pcbnew/tools/pcb_actions.cpp b/pcbnew/tools/pcb_actions.cpp index 8142884f1d..842b99daa9 100644 --- a/pcbnew/tools/pcb_actions.cpp +++ b/pcbnew/tools/pcb_actions.cpp @@ -68,6 +68,10 @@ boost::optional PCB_ACTIONS::TranslateLegacyId( int aId ) case ID_MODEDIT_LINE_TOOL: return PCB_ACTIONS::drawLine.MakeEvent(); + case ID_PCB_ADD_POLYGON_BUTT: + case ID_MODEDIT_POLYGON_TOOL: + return PCB_ACTIONS::drawGraphicPolygon.MakeEvent(); + case ID_PCB_CIRCLE_BUTT: case ID_MODEDIT_CIRCLE_TOOL: return PCB_ACTIONS::drawCircle.MakeEvent(); diff --git a/pcbnew/tools/pcb_actions.h b/pcbnew/tools/pcb_actions.h index 7e8a2a38a9..100ea8b830 100644 --- a/pcbnew/tools/pcb_actions.h +++ b/pcbnew/tools/pcb_actions.h @@ -132,6 +132,9 @@ public: /// Activation of the drawing tool (line) static TOOL_ACTION drawLine; + // Activation of the drawing tool (graphic polygons) + static TOOL_ACTION drawGraphicPolygon; + /// Activation of the drawing tool (circle) static TOOL_ACTION drawCircle; @@ -288,6 +291,9 @@ public: /// Activation of the drawing tool (placing a PAD) static TOOL_ACTION placePad; + static TOOL_ACTION createPadFromShapes; + static TOOL_ACTION explodePadToShapes; + /// Tool for quick pad enumeration static TOOL_ACTION enumeratePads; diff --git a/pcbnew/tools/point_editor.cpp b/pcbnew/tools/point_editor.cpp index 5363efa50a..59f9544ffb 100644 --- a/pcbnew/tools/point_editor.cpp +++ b/pcbnew/tools/point_editor.cpp @@ -79,9 +79,50 @@ enum DIMENSION_POINTS DIM_FEATUREDO, }; - class EDIT_POINTS_FACTORY { +private: + + static void buildForPolyOutline( std::shared_ptr points, const SHAPE_POLY_SET* aOutline, KIGFX::GAL* aGal ) + { + + int cornersCount = aOutline->TotalVertices(); + + for( auto iterator = aOutline->CIterateWithHoles(); iterator; iterator++ ) + { + points->AddPoint( *iterator ); + + if( iterator.IsEndContour() ) + points->AddBreak(); + } + + // Lines have to be added after creating edit points, + // as they use EDIT_POINT references + for( int i = 0; i < cornersCount - 1; ++i ) + { + if( points->IsContourEnd( i ) ) + { + points->AddLine( points->Point( i ), + points->Point( points->GetContourStartIdx( i ) ) ); + } + else + { + points->AddLine( points->Point( i ), points->Point( i + 1 ) ); + } + + points->Line( i ).SetConstraint( new EC_SNAPLINE( points->Line( i ), + std::bind( &KIGFX::GAL::GetGridPoint, aGal, _1 ) ) ); + } + + // The last missing line, connecting the last and the first polygon point + points->AddLine( points->Point( cornersCount - 1 ), + points->Point( points->GetContourStartIdx( cornersCount - 1 ) ) ); + + points->Line( points->LinesSize() - 1 ).SetConstraint( + new EC_SNAPLINE( points->Line( points->LinesSize() - 1 ), + std::bind( &KIGFX::GAL::GetGridPoint, aGal, _1 ) ) ); + } + public: static std::shared_ptr Make( EDA_ITEM* aItem, KIGFX::GAL* aGal ) { @@ -122,6 +163,12 @@ public: points->AddPoint( segment->GetEnd() ); break; + case S_POLYGON: + { + buildForPolyOutline( points, &segment->GetPolyShape(), aGal ); + break; + } + default: // suppress warnings break; } @@ -131,44 +178,8 @@ public: case PCB_ZONE_AREA_T: { - const SHAPE_POLY_SET* outline; - outline = static_cast( aItem )->Outline(); - - int cornersCount = outline->TotalVertices(); - - for( auto iterator = outline->CIterateWithHoles(); iterator; iterator++ ) - { - points->AddPoint( *iterator ); - - if( iterator.IsEndContour() ) - points->AddBreak(); - } - - // Lines have to be added after creating edit points, - // as they use EDIT_POINT references - for( int i = 0; i < cornersCount - 1; ++i ) - { - if( points->IsContourEnd( i ) ) - { - points->AddLine( points->Point( i ), - points->Point( points->GetContourStartIdx( i ) ) ); - } - else - { - points->AddLine( points->Point( i ), points->Point( i + 1 ) ); - } - - points->Line( i ).SetConstraint( new EC_SNAPLINE( points->Line( i ), - std::bind( &KIGFX::GAL::GetGridPoint, aGal, _1 ) ) ); - } - - // The last missing line, connecting the last and the first polygon point - points->AddLine( points->Point( cornersCount - 1 ), - points->Point( points->GetContourStartIdx( cornersCount - 1 ) ) ); - - points->Line( points->LinesSize() - 1 ).SetConstraint( - new EC_SNAPLINE( points->Line( points->LinesSize() - 1 ), - std::bind( &KIGFX::GAL::GetGridPoint, aGal, _1 ) ) ); + auto zone = static_cast( aItem ); + buildForPolyOutline( points, zone->Outline(), aGal ); break; } @@ -455,6 +466,17 @@ void POINT_EDITOR::updateItem() const break; } + case S_POLYGON: + { + SHAPE_POLY_SET* outline = &segment->GetPolyShape(); + + for( int i = 0; i < outline->TotalVertices(); ++i ) + { + VECTOR2I point = m_editPoints->Point( i ).GetPosition(); + outline->Vertex( i ) = point; + } + } + default: // suppress warnings break; } @@ -908,28 +930,43 @@ int POINT_EDITOR::removeCorner( const TOOL_EVENT& aEvent ) if( !item ) return 0; - if( item->Type() == PCB_ZONE_AREA_T ) + SHAPE_POLY_SET *outline = nullptr; + + if( item->Type() == PCB_ZONE_AREA_T) { - PCB_BASE_FRAME* frame = getEditFrame(); - BOARD_COMMIT commit( frame ); - - ZONE_CONTAINER* zone = static_cast( item ); - SHAPE_POLY_SET* zoneOutline = zone->Outline(); - commit.Modify( zone ); - - for( int i = 0; i < zoneOutline->TotalVertices(); ++i ) - { - if( zoneOutline->Vertex( i ) == m_editedPoint->GetPosition() ) - { - zoneOutline->RemoveVertex( i ); - setEditedPoint( NULL ); - commit.Push( _( "Remove a zone corner" ) ); - break; - } - } - - updatePoints(); + auto zone = static_cast( item ); + outline = zone->Outline(); } + else if ( item->Type() == PCB_LINE_T ) + { + auto ds = static_cast( item ); + if( ds->GetShape() == S_POLYGON ) + { + outline = &ds->GetPolyShape(); + } + } + + if( !outline ) + return 0; + + PCB_BASE_FRAME* frame = getEditFrame(); + BOARD_COMMIT commit( frame ); + + commit.Modify( item ); + + for( int i = 0; i < outline->TotalVertices(); ++i ) + { + if( outline->Vertex( i ) == m_editedPoint->GetPosition() ) + { + outline->RemoveVertex( i ); + setEditedPoint( NULL ); + commit.Push( _( "Remove a zone/polygon corner" ) ); + break; + } + } + + updatePoints(); + return 0; } diff --git a/pcbnew/tools/zone_create_helper.cpp b/pcbnew/tools/zone_create_helper.cpp index 1b297bd13a..131f2d30f5 100644 --- a/pcbnew/tools/zone_create_helper.cpp +++ b/pcbnew/tools/zone_create_helper.cpp @@ -25,6 +25,9 @@ #include #include #include +#include +#include +#include #include #include @@ -61,22 +64,27 @@ std::unique_ptr ZONE_CREATE_HELPER::createNewZone( bool aKeepout zoneInfo.m_NetcodeSelection = board.GetHighLightNetCode(); zoneInfo.SetIsKeepout( m_params.m_keepout ); - // Show options dialog - ZONE_EDIT_T dialogResult; - - if( m_params.m_keepout ) - dialogResult = InvokeKeepoutAreaEditor( &frame, &zoneInfo ); - else + if ( m_params.m_mode != DRAWING_TOOL::ZONE_MODE::GRAPHIC_POLYGON ) { - if( IsCopperLayer( zoneInfo.m_CurrentZone_Layer ) ) - dialogResult = InvokeCopperZonesEditor( &frame, &zoneInfo ); + // Get the current default settings for zones + + // Show options dialog + ZONE_EDIT_T dialogResult; + + if( m_params.m_keepout ) + dialogResult = InvokeKeepoutAreaEditor( &frame, &zoneInfo ); else - dialogResult = InvokeNonCopperZonesEditor( &frame, nullptr, &zoneInfo ); - } + { + if( IsCopperLayer( zoneInfo.m_CurrentZone_Layer ) ) + dialogResult = InvokeCopperZonesEditor( &frame, &zoneInfo ); + else + dialogResult = InvokeNonCopperZonesEditor( &frame, nullptr, &zoneInfo ); + } - if( dialogResult == ZONE_ABORT ) - { - return nullptr; + if( dialogResult == ZONE_ABORT ) + { + return nullptr; + } } auto newZone = std::make_unique( &board ); @@ -137,24 +145,41 @@ void ZONE_CREATE_HELPER::commitZone( std::unique_ptr aZone ) BOARD_COMMIT bCommit( &m_tool ); - if( m_params.m_mode == DRAWING_TOOL::ZONE_MODE::CUTOUT ) + switch ( m_params.m_mode ) { - // For cutouts, subtract from the source - bCommit.Modify( m_params.m_sourceZone ); - performZoneCutout( *m_params.m_sourceZone, *aZone ); - bCommit.Push( _( "Add a zone cutout" ) ); - m_params.m_sourceZone->Hatch(); - } - else - { - // Add the zone as a new board item - aZone->Hatch(); + case DRAWING_TOOL::ZONE_MODE::CUTOUT: + // For cutouts, subtract from the source + bCommit.Modify( m_params.m_sourceZone ); + performZoneCutout( *m_params.m_sourceZone, *aZone ); + bCommit.Push( _( "Add a zone cutout" ) ); + m_params.m_sourceZone->Hatch(); + break; - if( !m_params.m_keepout ) - frame.Fill_Zone( aZone.get() ); + case DRAWING_TOOL::ZONE_MODE::ADD: + case DRAWING_TOOL::ZONE_MODE::SIMILAR: + aZone->Hatch(); - bCommit.Add( aZone.release() ); - bCommit.Push( _( "Add a zone" ) ); + if( !m_params.m_keepout ) + frame.Fill_Zone( aZone.get() ); + + bCommit.Add( aZone.release() ); + bCommit.Push( _( "Add a zone" ) ); + break; + + case DRAWING_TOOL::ZONE_MODE::GRAPHIC_POLYGON: + { + BOARD_ITEM_CONTAINER* parent = frame.GetModel(); + auto poly = m_tool.m_editModules ? new EDGE_MODULE( (MODULE *) parent ) : new DRAWSEGMENT(); + + poly->SetShape ( S_POLYGON ); + poly->SetLayer( aZone->GetLayer() ); + poly->SetPolyShape ( *aZone->Outline() ); + + bCommit.Add( poly ); + bCommit.Push( _( "Add a graphical polygon" ) ); + + break; + } } };