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 777 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().

779 {
780  WIZARD_FPLIB_TABLE dlg( aParent );
781 
782  if( !dlg.RunWizard( dlg.GetFirstPage() ) )
783  return 0; // Aborted by user
784 
785  const std::vector<WIZARD_FPLIB_TABLE::LIBRARY>& libs = dlg.GetLibraries();
786  WIZARD_FPLIB_TABLE::LIB_SCOPE scope = dlg.GetLibScope();
787  FP_LIB_TABLE* fp_tbl = ( scope == WIZARD_FPLIB_TABLE::GLOBAL ? aGlobal : aProject );
788 
789  if( fp_tbl )
790  {
791  for( std::vector<WIZARD_FPLIB_TABLE::LIBRARY>::const_iterator it = libs.begin();
792  it != libs.end(); ++it )
793  {
794  if( it->GetStatus() == WIZARD_FPLIB_TABLE::LIBRARY::INVALID )
795  continue;
796 
797  FP_LIB_TABLE_ROW* row = new FP_LIB_TABLE_ROW( it->GetDescription(),
798  it->GetAutoPath( scope ),
799  it->GetPluginName(),
800  wxEmptyString ); // options
801  fp_tbl->InsertRow( row );
802  }
803  }
804 
805  return scope;
806 }
Class FP_LIB_TABLE_ROW.
Definition: fp_lib_table.h:42
bool InsertRow(LIB_TABLE_ROW *aRow, bool doReplace=false)
Adds aRow if it does not already exist or if doReplace is true.
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 766 of file dialog_fp_lib_table.cpp.

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

768 {
769  DIALOG_FP_LIB_TABLE dlg( aCaller, aGlobal, aProject );
770 
771  int dialogRet = dlg.ShowModal(); // returns value passed to EndModal() above
772 
773  return dialogRet;
774 }
Class DIALOG_FP_LIB_TABLE shows and edits the PCB library tables.