KiCad PCB EDA Suite
invoke_pcb_dialog.h File Reference

Go to the source code of this file.

Functions

void InvokePcbLibTableEditor (KIWAY *aKiway, wxWindow *aCaller)
 Function InvokePcbLibTableEditor shows the modal DIALOG_FP_LIB_TABLE for purposes of editing the global and project library tables. More...
 
void Invoke3DShapeLibsDownloaderWizard (wxWindow *aCaller)
 Function Invoke3DShapeLibsDownloaderWizard Runs the downloader wizard for easy 3D shape libraries download from the official Kicad Github repository of *.3Dshape libraries. More...
 
void InvokePluginOptionsEditor (wxWindow *aCaller, const wxString &aNickname, const wxString &aPluginType, const wxString &aOptions, wxString *aResult)
 Function InvokePluginOptionsEditor calls DIALOG_FP_PLUGIN_OPTIONS dialog so that plugin options set can be edited. More...
 
bool InvokeDXFDialogBoardImport (PCB_BASE_FRAME *aCaller)
 Function InvokeDXFDialogBoardImport shows the modal DIALOG_DXF_IMPORT for importing a DXF file to a board. More...
 
bool InvokeDXFDialogModuleImport (PCB_BASE_FRAME *aCaller, MODULE *aModule)
 Function InvokeDXFDialogModuleImport shows the modal DIALOG_DXF_IMPORT for importing a DXF file as footprint outlines. More...
 
bool InvokeExportSVG (PCB_BASE_FRAME *aCaller, BOARD *aBoard)
 Function InvokeExportSVG shows the Export SVG dialog. More...
 

Function Documentation

void Invoke3DShapeLibsDownloaderWizard ( wxWindow *  aCaller)

Function Invoke3DShapeLibsDownloaderWizard Runs the downloader wizard for easy 3D shape libraries download from the official Kicad Github repository of *.3Dshape libraries.

Parameters
aCalleris the wxWindow which is invoking the dialog.

Definition at line 58 of file wizard_3DShape_Libs_downloader.cpp.

References WIZARD_3DSHAPE_LIBS_DOWNLOADER::GetFirstPage().

Referenced by PCB_EDIT_FRAME::Process_Config().

59 {
60  WIZARD_3DSHAPE_LIBS_DOWNLOADER wizard( aCaller );
61  wizard.RunWizard( wizard.GetFirstPage() );
62 }
bool InvokeDXFDialogBoardImport ( PCB_BASE_FRAME aCaller)

Function InvokeDXFDialogBoardImport shows the modal DIALOG_DXF_IMPORT for importing a DXF file to a board.

Parameters
aCalleris the wxTopLevelWindow which is invoking the dialog.
Returns
true if the import was made.

Definition at line 322 of file dialog_dxf_import.cpp.

References BOARD::Add(), PCB_BASE_FRAME::GetBoard(), DIALOG_DXF_IMPORT::GetImportedItems(), PCB_BASE_FRAME::OnModify(), PICKED_ITEMS_LIST::PushItem(), PCB_BASE_FRAME::SaveCopyInUndoList(), and UR_NEW.

Referenced by PCB_EDIT_FRAME::Process_Special_Functions().

323 {
324  DIALOG_DXF_IMPORT dlg( aCaller );
325  bool success = ( dlg.ShowModal() == wxID_OK );
326 
327  if( success )
328  {
329  const std::list<BOARD_ITEM*>& list = dlg.GetImportedItems();
330  PICKED_ITEMS_LIST picklist;
331  BOARD* board = aCaller->GetBoard();
332 
333  std::list<BOARD_ITEM*>::const_iterator it, itEnd;
334  for( it = list.begin(), itEnd = list.end(); it != itEnd; ++it )
335  {
336  BOARD_ITEM* item = *it;
337  board->Add( item );
338 
339  ITEM_PICKER itemWrapper( item, UR_NEW );
340  picklist.PushItem( itemWrapper );
341  }
342 
343  aCaller->SaveCopyInUndoList( picklist, UR_NEW, wxPoint( 0, 0 ) );
344  aCaller->OnModify();
345  }
346 
347  return success;
348 }
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
BOARD * GetBoard() const
void PushItem(const ITEM_PICKER &aItem)
Function PushItem pushes aItem to the top of the list.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_INSERT) override
Adds an item to the container.
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
virtual void OnModify()
Function OnModify Virtual Must be called after a change in order to set the "modify" flag of the curr...
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
virtual void SaveCopyInUndoList(BOARD_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0))=0
Function SaveCopyInUndoList (virtual pure) Creates a new entry in undo list of commands.
bool InvokeDXFDialogModuleImport ( PCB_BASE_FRAME aCaller,
MODULE aModule 
)

Function InvokeDXFDialogModuleImport shows the modal DIALOG_DXF_IMPORT for importing a DXF file as footprint outlines.

Parameters
aCalleris the wxTopLevelWindow which is invoking the dialog.
aModuleis the footprint currently edited.
Returns
true if the import was made.

Definition at line 351 of file dialog_dxf_import.cpp.

References MODULE::Add(), DIALOG_DXF_IMPORT::GetImportedItems(), PCB_BASE_FRAME::OnModify(), PCB_BASE_FRAME::SaveCopyInUndoList(), and UR_CHANGED.

Referenced by FOOTPRINT_EDIT_FRAME::Process_Special_Functions().

352 {
353  wxASSERT( aModule );
354 
355  DIALOG_DXF_IMPORT dlg( aCaller, true );
356  bool success = ( dlg.ShowModal() == wxID_OK );
357 
358  if( success )
359  {
360  const std::list<BOARD_ITEM*>& list = dlg.GetImportedItems();
361 
362  aCaller->SaveCopyInUndoList( aModule, UR_CHANGED );
363  aCaller->OnModify();
364 
365  std::list<BOARD_ITEM*>::const_iterator it, itEnd;
366 
367  for( it = list.begin(), itEnd = list.end(); it != itEnd; ++it )
368  {
369  aModule->Add( *it );
370  }
371  }
372 
373  return success;
374 }
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_INSERT) override
>
virtual void OnModify()
Function OnModify Virtual Must be called after a change in order to set the "modify" flag of the curr...
virtual void SaveCopyInUndoList(BOARD_ITEM *aItemToCopy, UNDO_REDO_T aTypeCommand, const wxPoint &aTransformPoint=wxPoint(0, 0))=0
Function SaveCopyInUndoList (virtual pure) Creates a new entry in undo list of commands.
bool InvokeExportSVG ( PCB_BASE_FRAME aCaller,
BOARD aBoard 
)

Function InvokeExportSVG shows the Export SVG dialog.

Parameters
aCalleris the PCB_BASE_FRAME which is invoking the dialog.
aBoardis the currently edited board.
Returns
bool - true if user pressed OK (did not abort), else false.

Definition at line 370 of file dialog_export_svg.cpp.

Referenced by PCB_EDIT_FRAME::ExportSVG().

371 {
372  DIALOG_EXPORT_SVG dlg( aCaller, aBoard );
373 
374  dlg.ShowModal();
375 
376  return true;
377 }
void InvokePcbLibTableEditor ( KIWAY aKiway,
wxWindow *  aCaller 
)

Function InvokePcbLibTableEditor shows the modal DIALOG_FP_LIB_TABLE for purposes of editing the global and project library tables.

Parameters
aCalleris the wxWindow which is invoking the dialog.
Returns
true if either table changed.

Definition at line 800 of file panel_fp_lib_table.cpp.

References PROJECT::FootprintLibTblName(), FRAME_PCB_MODULE_EDITOR, FRAME_PCB_MODULE_VIEWER, FP_LIB_TABLE::GetGlobalTableFileName(), PROJECT::GetProjectPath(), GFootprintTable, DIALOG_EDIT_LIBRARY_TABLES::InstallPanel(), DIALOG_EDIT_LIBRARY_TABLES::m_GlobalTableChanged, DIALOG_EDIT_LIBRARY_TABLES::m_ProjectTableChanged, PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE(), PROJECT::PcbFootprintLibs(), KIWAY::Player(), KIWAY::Prj(), LIB_TABLE::Save(), KIWAY_HOLDER::SetKiway(), and IO_ERROR::What().

Referenced by PCB::IFACE::CreateWindow(), PCB_EDIT_FRAME::Process_Config(), and FOOTPRINT_EDIT_FRAME::ProcessPreferences().

801 {
802  FP_LIB_TABLE* globalTable = &GFootprintTable;
803  wxString globalTablePath = FP_LIB_TABLE::GetGlobalTableFileName();
804  FP_LIB_TABLE* projectTable = aKiway->Prj().PcbFootprintLibs();
805  wxString projectTablePath = aKiway->Prj().FootprintLibTblName();
806  wxString msg;
807 
808  DIALOG_EDIT_LIBRARY_TABLES dlg( aCaller, _( "Footprint Libraries" ) );
809  dlg.SetKiway( &dlg, aKiway );
810 
811  dlg.InstallPanel( new PANEL_FP_LIB_TABLE( &dlg, globalTable, globalTablePath,
812  projectTable, projectTablePath,
813  aKiway->Prj().GetProjectPath() ) );
814 
815  if( dlg.ShowModal() == wxID_CANCEL )
816  return;
817 
818  if( dlg.m_GlobalTableChanged )
819  {
820  try
821  {
822  globalTable->Save( globalTablePath );
823  }
824  catch( const IO_ERROR& ioe )
825  {
826  msg.Printf( _( "Error saving global library table:\n\n%s" ), ioe.What() );
827  wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
828  }
829  }
830 
831  if( dlg.m_ProjectTableChanged )
832  {
833  try
834  {
835  projectTable->Save( projectTablePath );
836  }
837  catch( const IO_ERROR& ioe )
838  {
839  msg.Printf( _( "Error saving project-specific library table:\n\n%s" ), ioe.What() );
840  wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
841  }
842  }
843 
844  auto editor = (FOOTPRINT_EDIT_FRAME*) aKiway->Player( FRAME_PCB_MODULE_EDITOR, false );
845 
846  if( editor )
847  editor->SyncLibraryTree( true );
848 
849  auto viewer = (FOOTPRINT_VIEWER_FRAME*) aKiway->Player( FRAME_PCB_MODULE_VIEWER, false );
850 
851  if( viewer )
852  viewer->ReCreateLibraryList();
853 }
Component library viewer main window.
FP_LIB_TABLE GFootprintTable
The global footprint library table.
Definition: pcbnew.cpp:333
VTBL_ENTRY KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=NULL)
Function Player returns the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:300
VTBL_ENTRY PROJECT & Prj() const
Function Prj returns the PROJECT associated with this KIWAY.
Definition: kiway.cpp:142
void Save(const wxString &aFileName) const
Write this library table to aFileName in s-expression form.
VTBL_ENTRY const wxString FootprintLibTblName() const
Function FootprintLibTblName returns the path and filename of this project&#39;s fp-lib-table, i.e.
Definition: project.cpp:120
VTBL_ENTRY FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
VTBL_ENTRY const wxString GetProjectPath() const
Function GetProjectPath returns the full path of the project.
Definition: project.cpp:102
Dialog to show and edit symbol library tables.
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76
static wxString GetGlobalTableFileName()
Function GetGlobalTableFileName.
void InvokePluginOptionsEditor ( wxWindow *  aCaller,
const wxString &  aNickname,
const wxString &  aPluginType,
const wxString &  aOptions,
wxString *  aResult 
)

Function InvokePluginOptionsEditor calls DIALOG_FP_PLUGIN_OPTIONS dialog so that plugin options set can be edited.

Parameters
aCalleris the wxTopLevelWindow which is invoking the dialog.
aNicknameis the footprint library whose options are being edited.
aPluginTypeis something that will pass through IO_MGR::EnumFromStr().
aOptionsis the options string on calling into this function.
aResultis where to put the result of the editing.

Definition at line 292 of file dialog_fp_plugin_options.cpp.

Referenced by FP_GRID_TRICKS::optionsEditor().

295 {
296  DIALOG_FP_PLUGIN_OPTIONS dlg( aCaller, aNickname, aPluginType, aOptions, aResult );
297 
298  dlg.ShowModal();
299 }
Class DIALOG_FP_PLUGIN_OPTIONS is an options editor in the form of a two column name/value spreadshee...