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 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 InvokeExportSVG (PCB_EDIT_FRAME *aCaller, BOARD *aBoard)
 Function InvokeExportSVG shows the Export SVG dialog. More...
 

Function Documentation

◆ InvokeExportSVG()

bool InvokeExportSVG ( PCB_EDIT_FRAME aCaller,
BOARD aBoard 
)

Function InvokeExportSVG shows the Export SVG dialog.

Parameters
aCalleris the PCB_EDIT_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 388 of file dialog_export_svg.cpp.

389 {
390  DIALOG_EXPORT_SVG dlg( aCaller, aBoard );
391 
392  dlg.ShowModal();
393 
394  return true;
395 }

Referenced by PCB_EDIT_FRAME::ExportSVG().

◆ InvokePcbLibTableEditor()

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 1075 of file panel_fp_lib_table.cpp.

1076 {
1077  FP_LIB_TABLE* globalTable = &GFootprintTable;
1078  wxString globalTablePath = FP_LIB_TABLE::GetGlobalTableFileName();
1079  FP_LIB_TABLE* projectTable = aKiway->Prj().PcbFootprintLibs();
1080  wxString projectTablePath = aKiway->Prj().FootprintLibTblName();
1081  wxString msg;
1082 
1083  DIALOG_EDIT_LIBRARY_TABLES dlg( aCaller, _( "Footprint Libraries" ) );
1084  dlg.SetKiway( &dlg, aKiway );
1085 
1086  if( aKiway->Prj().IsNullProject() )
1087  projectTable = nullptr;
1088 
1089  dlg.InstallPanel( new PANEL_FP_LIB_TABLE( &dlg, globalTable, globalTablePath,
1090  projectTable, projectTablePath,
1091  aKiway->Prj().GetProjectPath() ) );
1092 
1093  if( dlg.ShowModal() == wxID_CANCEL )
1094  return;
1095 
1096  if( dlg.m_GlobalTableChanged )
1097  {
1098  try
1099  {
1100  globalTable->Save( globalTablePath );
1101  }
1102  catch( const IO_ERROR& ioe )
1103  {
1104  msg.Printf( _( "Error saving global library table:\n\n%s" ), ioe.What() );
1105  wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
1106  }
1107  }
1108 
1109  if( projectTable && dlg.m_ProjectTableChanged )
1110  {
1111  try
1112  {
1113  projectTable->Save( projectTablePath );
1114  }
1115  catch( const IO_ERROR& ioe )
1116  {
1117  msg.Printf( _( "Error saving project-specific library table:\n\n%s" ), ioe.What() );
1118  wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
1119  }
1120  }
1121 
1122  auto editor = (FOOTPRINT_EDIT_FRAME*) aKiway->Player( FRAME_FOOTPRINT_EDITOR, false );
1123 
1124  if( editor )
1125  {
1126  editor->SyncLibraryTree( true );
1127  editor->RefreshLibraryTree();
1128  }
1129 
1130  auto viewer = (FOOTPRINT_VIEWER_FRAME*) aKiway->Player( FRAME_FOOTPRINT_VIEWER, false );
1131 
1132  if( viewer )
1133  viewer->ReCreateLibraryList();
1134 }
FP_LIB_TABLE GFootprintTable
The global footprint library table.
Definition: cvpcb.cpp:134
virtual PROJECT & Prj() const
Return the PROJECT associated with this KIWAY.
Definition: kiway.cpp:191
Component library viewer main window.
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:393
virtual const wxString GetProjectPath() const
Return the full path of the project.
Definition: project.cpp:122
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
#define _(s)
virtual bool IsNullProject() const
Check if this project is a null project (i.e.
Definition: project.cpp:134
virtual FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
Definition: project.cpp:283
void Save(const wxString &aFileName) const
Write this library table to aFileName in s-expression form.
Dialog to show and edit symbol library tables.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75
virtual const wxString FootprintLibTblName() const
Returns the path and filename of this project's footprint library table.
Definition: project.cpp:146
static wxString GetGlobalTableFileName()

References _, editor, PROJECT::FootprintLibTblName(), FRAME_FOOTPRINT_EDITOR, FRAME_FOOTPRINT_VIEWER, FP_LIB_TABLE::GetGlobalTableFileName(), PROJECT::GetProjectPath(), GFootprintTable, DIALOG_EDIT_LIBRARY_TABLES::InstallPanel(), PROJECT::IsNullProject(), DIALOG_EDIT_LIBRARY_TABLES::m_GlobalTableChanged, DIALOG_EDIT_LIBRARY_TABLES::m_ProjectTableChanged, PROJECT::PcbFootprintLibs(), KIWAY::Player(), KIWAY::Prj(), LIB_TABLE::Save(), KIWAY_HOLDER::SetKiway(), and IO_ERROR::What().

Referenced by PCB::IFACE::CreateWindow().

◆ InvokePluginOptionsEditor()

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.

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

Referenced by FP_GRID_TRICKS::optionsEditor().