From 398a336d91d2f0e6f9479f0e2212628d8d26b561 Mon Sep 17 00:00:00 2001 From: Mike Williams Date: Wed, 20 Sep 2023 11:12:03 -0400 Subject: [PATCH] BOM Generator: redirect BOM buttons to new exporter Also add legacy generator menu item. --- eeschema/dialogs/dialog_symbol_fields_table.cpp | 6 ++++++ eeschema/dialogs/dialog_symbol_fields_table.h | 2 ++ eeschema/menubar.cpp | 1 + eeschema/tools/ee_actions.cpp | 7 +++++++ eeschema/tools/ee_actions.h | 1 + eeschema/tools/sch_editor_control.cpp | 9 +++++++++ eeschema/tools/sch_editor_control.h | 1 + 7 files changed, 27 insertions(+) diff --git a/eeschema/dialogs/dialog_symbol_fields_table.cpp b/eeschema/dialogs/dialog_symbol_fields_table.cpp index ca22c80367..aab779c8c4 100644 --- a/eeschema/dialogs/dialog_symbol_fields_table.cpp +++ b/eeschema/dialogs/dialog_symbol_fields_table.cpp @@ -1153,6 +1153,12 @@ BOM_FMT_PRESET DIALOG_SYMBOL_FIELDS_TABLE::GetCurrentBomFmtSettings() } +void DIALOG_SYMBOL_FIELDS_TABLE::ShowExportTab() +{ + m_nbPages->SetSelection( 1 ); +} + + void DIALOG_SYMBOL_FIELDS_TABLE::OnOutputFileBrowseClicked( wxCommandEvent& event ) { // Build the absolute path of current output directory to preselect it in the file browser. diff --git a/eeschema/dialogs/dialog_symbol_fields_table.h b/eeschema/dialogs/dialog_symbol_fields_table.h index 51dd3cc005..e5787be6d4 100644 --- a/eeschema/dialogs/dialog_symbol_fields_table.h +++ b/eeschema/dialogs/dialog_symbol_fields_table.h @@ -48,6 +48,8 @@ public: bool TransferDataToWindow() override; bool TransferDataFromWindow() override; + void ShowExportTab(); + private: void SetupColumnProperties( int aCol ); void SetupAllColumnProperties(); diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index e633aa8a03..a5ad9c2620 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -288,6 +288,7 @@ void SCH_EDIT_FRAME::doReCreateMenuBar() toolsMenu->AppendSeparator(); toolsMenu->Add( EE_ACTIONS::assignFootprints ); toolsMenu->Add( EE_ACTIONS::generateBOM ); + toolsMenu->Add( EE_ACTIONS::generateBOMLegacy ); toolsMenu->AppendSeparator(); update = toolsMenu->Add( ACTIONS::updateSchematicFromPcb ); diff --git a/eeschema/tools/ee_actions.cpp b/eeschema/tools/ee_actions.cpp index 0f4b8eb50d..07bd5b3436 100644 --- a/eeschema/tools/ee_actions.cpp +++ b/eeschema/tools/ee_actions.cpp @@ -1047,6 +1047,13 @@ TOOL_ACTION EE_ACTIONS::generateBOM( TOOL_ACTION_ARGS() .Tooltip( _( "Generate a bill of materials for the current schematic" ) ) .Icon( BITMAPS::post_bom ) ); +TOOL_ACTION EE_ACTIONS::generateBOMLegacy( TOOL_ACTION_ARGS() + .Name( "eeschema.EditorControl.generateBOMLegacy" ) + .Scope( AS_GLOBAL ) + .MenuText( _( "Generate BOM (Legacy)..." ) ) + .Tooltip( _( "Generate a bill of materials for the current schematic (Legacy Generator)" ) ) + ); + TOOL_ACTION EE_ACTIONS::exportSymbolsToLibrary( TOOL_ACTION_ARGS() .Name( "eeschema.EditorControl.exportSymbolsToLibrary" ) .Scope( AS_GLOBAL ) diff --git a/eeschema/tools/ee_actions.h b/eeschema/tools/ee_actions.h index 9b5e349e5a..87616ef051 100644 --- a/eeschema/tools/ee_actions.h +++ b/eeschema/tools/ee_actions.h @@ -173,6 +173,7 @@ public: static TOOL_ACTION importFPAssignments; static TOOL_ACTION exportNetlist; static TOOL_ACTION generateBOM; + static TOOL_ACTION generateBOMLegacy; static TOOL_ACTION addSymbolToSchematic; static TOOL_ACTION exportSymbolsToLibrary; static TOOL_ACTION exportSymbolsToNewLibrary; diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index ae4b448f5f..b880f9fb6b 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -2112,6 +2112,14 @@ int SCH_EDITOR_CONTROL::ExportNetlist( const TOOL_EVENT& aEvent ) int SCH_EDITOR_CONTROL::GenerateBOM( const TOOL_EVENT& aEvent ) +{ + EditSymbolFields( aEvent ); + m_frame->GetSymbolFieldsTableDialog()->ShowExportTab(); + return 0; +} + + +int SCH_EDITOR_CONTROL::GenerateBOMLegacy( const TOOL_EVENT& aEvent ) { InvokeDialogCreateBOM( m_frame ); return 0; @@ -2462,6 +2470,7 @@ void SCH_EDITOR_CONTROL::setTransitions() Go( &SCH_EDITOR_CONTROL::UpdateFromPCB, ACTIONS::updateSchematicFromPcb.MakeEvent() ); Go( &SCH_EDITOR_CONTROL::ExportNetlist, EE_ACTIONS::exportNetlist.MakeEvent() ); Go( &SCH_EDITOR_CONTROL::GenerateBOM, EE_ACTIONS::generateBOM.MakeEvent() ); + Go( &SCH_EDITOR_CONTROL::GenerateBOMLegacy, EE_ACTIONS::generateBOMLegacy.MakeEvent() ); Go( &SCH_EDITOR_CONTROL::DrawSheetOnClipboard, EE_ACTIONS::drawSheetOnClipboard.MakeEvent() ); Go( &SCH_EDITOR_CONTROL::ShowSearch, EE_ACTIONS::showSearch.MakeEvent() ); diff --git a/eeschema/tools/sch_editor_control.h b/eeschema/tools/sch_editor_control.h index 99b81704c6..e00e518007 100644 --- a/eeschema/tools/sch_editor_control.h +++ b/eeschema/tools/sch_editor_control.h @@ -121,6 +121,7 @@ public: int ImportFPAssignments( const TOOL_EVENT& aEvent ); int ExportNetlist( const TOOL_EVENT& aEvent ); int GenerateBOM( const TOOL_EVENT& aEvent ); + int GenerateBOMLegacy( const TOOL_EVENT& aEvent ); int DrawSheetOnClipboard( const TOOL_EVENT& aEvent ); int ShowSearch( const TOOL_EVENT& aEvent );