KiCad PCB EDA Suite
dialog_fp_lib_table.cpp File Reference
#include <set>
#include <wx/regex.h>
#include <fctsys.h>
#include <project.h>
#include <3d_viewer.h>
#include <dialog_fp_lib_table_base.h>
#include <fp_lib_table.h>
#include <lib_table_lexer.h>
#include <invoke_pcb_dialog.h>
#include <grid_tricks.h>
#include <confirm.h>
#include <wizard_add_fplib.h>
#include <lib_table_grid.h>

Go to the source code of this file.

Classes

class  FP_LIB_TABLE_GRID
 This class builds a wxGridTableBase by wrapping an FP_LIB_TABLE object. More...
 
class  FP_GRID_TRICKS
 
class  DIALOG_FP_LIB_TABLE
 Class DIALOG_FP_LIB_TABLE shows and edits the PCB library tables. More...
 

Functions

int InvokePcbLibTableEditor (wxTopLevelWindow *aCaller, FP_LIB_TABLE *aGlobal, FP_LIB_TABLE *aProject)
 Function InvokePcbLibTableEditor shows the modal DIALOG_FP_LIB_TABLE for purposes of editing two lib tables. More...
 
int InvokeFootprintWizard (wxTopLevelWindow *aParent, FP_LIB_TABLE *aGlobal, FP_LIB_TABLE *aProject)
 Function InvokeFootprintWizard Runs the footprint library wizard for easy library addition. More...
 

Function Documentation

int InvokeFootprintWizard ( wxTopLevelWindow *  aCaller,
FP_LIB_TABLE aGlobal,
FP_LIB_TABLE aProject 
)

Function InvokeFootprintWizard Runs the footprint library wizard for easy library addition.

Parameters
aCalleris the wxTopLevelWindow which is invoking the dialog.
aGlobalis the common footprint library table file being edited. If aGlobal is NULL, then it will not be updated.
aProjectis the project specific footprint library table file being edited. if aProject is NULL, then it will not be updated.
Returns
int 0 - no changes 1 - changes in the global table 2 - changes in the project table 3 - changes in both tables

Definition at line 765 of file dialog_fp_lib_table.cpp.

References WIZARD_FPLIB_TABLE::GetFirstPage(), WIZARD_FPLIB_TABLE::GetLibraries(), WIZARD_FPLIB_TABLE::GetLibScope(), WIZARD_FPLIB_TABLE::GLOBAL, LIB_TABLE::InsertRow(), and WIZARD_FPLIB_TABLE::LIBRARY::INVALID.

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

767 {
768  WIZARD_FPLIB_TABLE dlg( aParent );
769 
770  if( !dlg.RunWizard( dlg.GetFirstPage() ) )
771  return 0; // Aborted by user
772 
773  const std::vector<WIZARD_FPLIB_TABLE::LIBRARY>& libs = dlg.GetLibraries();
774  WIZARD_FPLIB_TABLE::LIB_SCOPE scope = dlg.GetLibScope();
775  FP_LIB_TABLE* fp_tbl = ( scope == WIZARD_FPLIB_TABLE::GLOBAL ? aGlobal : aProject );
776 
777  if( fp_tbl )
778  {
779  for( std::vector<WIZARD_FPLIB_TABLE::LIBRARY>::const_iterator it = libs.begin();
780  it != libs.end(); ++it )
781  {
782  if( it->GetStatus() == WIZARD_FPLIB_TABLE::LIBRARY::INVALID )
783  continue;
784 
785  FP_LIB_TABLE_ROW* row = new FP_LIB_TABLE_ROW( it->GetDescription(),
786  it->GetAutoPath( scope ),
787  it->GetPluginName(),
788  wxEmptyString ); // options
789  fp_tbl->InsertRow( row );
790  }
791  }
792 
793  return scope;
794 }
Class FP_LIB_TABLE_ROW.
Definition: fp_lib_table.h:42
bool InsertRow(LIB_TABLE_ROW *aRow, bool doReplace=false)
Function InsertRow.
LIB_SCOPE
Scope (global/project)
int InvokePcbLibTableEditor ( wxTopLevelWindow *  aCaller,
FP_LIB_TABLE aGlobal,
FP_LIB_TABLE aProject 
)

Function InvokePcbLibTableEditor shows the modal DIALOG_FP_LIB_TABLE for purposes of editing two lib tables.

Parameters
aCalleris the wxTopLevelWindow which is invoking the dialog.
aGlobalis the common footprint library table file being edited.
aProjectis the project specific footprint library table file being edited.
Returns
int - bits 0 and 1 tell whether a change was made to the aGlobal and/or the aProject table, respectively. If set, table was modified.

Definition at line 754 of file dialog_fp_lib_table.cpp.

Referenced by CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), PCB_EDIT_FRAME::Process_Config(), and FOOTPRINT_EDIT_FRAME::ProcessPreferences().

756 {
757  DIALOG_FP_LIB_TABLE dlg( aCaller, aGlobal, aProject );
758 
759  int dialogRet = dlg.ShowModal(); // returns value passed to EndModal() above
760 
761  return dialogRet;
762 }
Class DIALOG_FP_LIB_TABLE shows and edits the PCB library tables.