diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index 2d5e2559f0..487eee0369 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -79,19 +79,27 @@ DRAWING_TOOL::~DRAWING_TOOL() bool DRAWING_TOOL::Init() { - auto activeToolFunctor = [ this ] ( const SELECTION& aSel ) { + auto activeToolFunctor = [ this ] ( const SELECTION& aSel ) + { return m_mode != MODE::NONE; }; // some interactive drawing tools can undo the last point - auto canUndoPoint = [ this ] ( const SELECTION& aSel ) { - return m_mode == MODE::ARC || m_mode == MODE::ZONE; + auto canUndoPoint = [ this ] ( const SELECTION& aSel ) + { + return ( m_mode == MODE::ARC + || m_mode == MODE::ZONE + || m_mode == MODE::KEEPOUT + || m_mode == MODE::GRAPHIC_POLYGON ); }; - // functor for zone-only actions - auto zoneActiveFunctor = [this ] ( const SELECTION& aSel ) { - return m_mode == MODE::ZONE; - }; + // functor for tools that can automatically close the outline + auto canCloseOutline = [ this ] ( const SELECTION& aSel ) + { + return ( m_mode == MODE::ZONE + || m_mode == MODE::KEEPOUT + || m_mode == MODE::GRAPHIC_POLYGON ); + }; auto& ctxMenu = m_menu.GetMenu(); @@ -100,7 +108,7 @@ bool DRAWING_TOOL::Init() ctxMenu.AddSeparator( 1 ); // tool-specific actions - ctxMenu.AddItem( PCB_ACTIONS::closeZoneOutline, zoneActiveFunctor, 200 ); + ctxMenu.AddItem( PCB_ACTIONS::closeOutline, canCloseOutline, 200 ); ctxMenu.AddItem( PCB_ACTIONS::deleteLastPoint, canUndoPoint, 200 ); ctxMenu.AddSeparator( 500 ); @@ -1506,11 +1514,11 @@ int DRAWING_TOOL::DrawZone( const TOOL_EVENT& aEvent ) // events that lock in nodes else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) - || evt->IsAction( &PCB_ACTIONS::closeZoneOutline ) ) + || evt->IsAction( &PCB_ACTIONS::closeOutline ) ) { // Check if it is double click / closing line (so we have to finish the zone) const bool endPolygon = evt->IsDblClick( BUT_LEFT ) - || evt->IsAction( &PCB_ACTIONS::closeZoneOutline ) + || evt->IsAction( &PCB_ACTIONS::closeOutline ) || polyGeomMgr.NewPointClosesOutline( cursorPos ); if( endPolygon ) diff --git a/pcbnew/tools/pcb_actions.cpp b/pcbnew/tools/pcb_actions.cpp index 5c5994e7d6..c5fbb1fa87 100644 --- a/pcbnew/tools/pcb_actions.cpp +++ b/pcbnew/tools/pcb_actions.cpp @@ -158,9 +158,9 @@ TOOL_ACTION PCB_ACTIONS::deleteLastPoint( "pcbnew.InteractiveDrawing.deleteLastP _( "Delete Last Point" ), _( "Delete the last point added to the current item" ), undo_xpm ); -TOOL_ACTION PCB_ACTIONS::closeZoneOutline( "pcbnew.InteractiveDrawing.closeZoneOutline", +TOOL_ACTION PCB_ACTIONS::closeOutline( "pcbnew.InteractiveDrawing.closeOutline", AS_CONTEXT, 0, "", - _( "Close Zone Outline" ), _( "Close the outline of a zone in progress" ), + _( "Close Outline" ), _( "Close the in progress outline" ), checked_ok_xpm ); diff --git a/pcbnew/tools/pcb_actions.h b/pcbnew/tools/pcb_actions.h index b0e0c301db..08447e7e29 100644 --- a/pcbnew/tools/pcb_actions.h +++ b/pcbnew/tools/pcb_actions.h @@ -150,7 +150,7 @@ public: static TOOL_ACTION placeImportedGraphics; static TOOL_ACTION setAnchor; static TOOL_ACTION deleteLastPoint; - static TOOL_ACTION closeZoneOutline; + static TOOL_ACTION closeOutline; /// Increase width of currently drawn line static TOOL_ACTION incWidth;