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 331 of file dialog_export_svg.cpp.

332{
333 DIALOG_EXPORT_SVG dlg( aCaller, aBoard );
334
335 dlg.ShowModal();
336
337 return true;
338}

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

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

References _, editor, KIWAY::ExpressMail(), PROJECT::FootprintLibTblName(), FRAME_CVPCB, 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, MAIL_RELOAD_LIB, PROJECT::PcbFootprintLibs(), KIWAY::Player(), KIWAY::Prj(), LIB_TABLE::Save(), KIWAY_HOLDER::SetKiway(), and IO_ERROR::What().

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

◆ 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 296 of file dialog_fp_plugin_options.cpp.

299{
300 DIALOG_FP_PLUGIN_OPTIONS dlg( aCaller, aNickname, aPluginType, aOptions, aResult );
301
302 dlg.ShowModal();
303}
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().