From ccfefc397134e6b4bc5f4b5ab65ecaf61ccd65ad Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 11 Mar 2024 14:13:11 +0000 Subject: [PATCH] Table support for footprint editor. Fixes https://gitlab.com/kicad/code/kicad/-/issues/17333 --- pcbnew/footprint.cpp | 3 +++ pcbnew/menubar_footprint_editor.cpp | 1 + pcbnew/tools/drawing_tool.cpp | 4 ++-- pcbnew/tools/pcb_selection_tool.cpp | 10 +++++++++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp index a9cbbadd43..05e7279ad8 100644 --- a/pcbnew/footprint.cpp +++ b/pcbnew/footprint.cpp @@ -735,6 +735,7 @@ void FOOTPRINT::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode, bool aSkipConnectiv case PCB_DIM_ORTHOGONAL_T: case PCB_SHAPE_T: case PCB_TEXTBOX_T: + case PCB_TABLE_T: case PCB_REFERENCE_IMAGE_T: if( aMode == ADD_MODE::APPEND ) m_drawings.push_back( aBoardItem ); @@ -1689,6 +1690,8 @@ INSPECT_RESULT FOOTPRINT::Visit( INSPECTOR inspector, void* testData, case PCB_DIM_ORTHOGONAL_T: case PCB_SHAPE_T: case PCB_TEXTBOX_T: + case PCB_TABLE_T: + case PCB_TABLECELL_T: if( !drawingsScanned ) { if( IterateForward( m_drawings, inspector, testData, aScanTypes ) diff --git a/pcbnew/menubar_footprint_editor.cpp b/pcbnew/menubar_footprint_editor.cpp index bdf60347a1..eee78c2c67 100644 --- a/pcbnew/menubar_footprint_editor.cpp +++ b/pcbnew/menubar_footprint_editor.cpp @@ -174,6 +174,7 @@ void FOOTPRINT_EDIT_FRAME::doReCreateMenuBar() placeMenu->Add( PCB_ACTIONS::placeReferenceImage ); placeMenu->Add( PCB_ACTIONS::placeText ); placeMenu->Add( PCB_ACTIONS::drawTextBox ); + placeMenu->Add( PCB_ACTIONS::drawTable ); placeMenu->AppendSeparator(); placeMenu->Add( PCB_ACTIONS::drawAlignedDimension ); diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index 70561cf35d..78755efdd7 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -1162,6 +1162,8 @@ int DRAWING_TOOL::DrawTable( const TOOL_EVENT& aEvent ) } else { + m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); + table->ClearFlags(); table->Normalize(); @@ -1170,8 +1172,6 @@ int DRAWING_TOOL::DrawTable( const TOOL_EVENT& aEvent ) // QuasiModal required for Scintilla auto-complete if( dlg.ShowQuasiModal() == wxID_OK ) { - m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); - commit.Add( table, m_frame->GetScreen() ); commit.Push( _( "Draw Table" ) ); diff --git a/pcbnew/tools/pcb_selection_tool.cpp b/pcbnew/tools/pcb_selection_tool.cpp index a2f68d1236..949da305f9 100644 --- a/pcbnew/tools/pcb_selection_tool.cpp +++ b/pcbnew/tools/pcb_selection_tool.cpp @@ -412,7 +412,15 @@ int PCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) GENERAL_COLLECTORS_GUIDE guide = getCollectorsGuide(); GENERAL_COLLECTOR collector; - collector.Collect( board(), { PCB_TABLECELL_T }, evt->DragOrigin(), guide ); + if( m_isFootprintEditor ) + { + collector.Collect( board()->GetFirstFootprint(), { PCB_TABLECELL_T }, + evt->DragOrigin(), guide ); + } + else + { + collector.Collect( board(), { PCB_TABLECELL_T }, evt->DragOrigin(), guide ); + } if( collector.GetCount() ) {