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

776 {
777  WIZARD_FPLIB_TABLE dlg( aParent );
778 
779  if( !dlg.RunWizard( dlg.GetFirstPage() ) )
780  return 0; // Aborted by user
781 
782  const std::vector<WIZARD_FPLIB_TABLE::LIBRARY>& libs = dlg.GetLibraries();
783  WIZARD_FPLIB_TABLE::LIB_SCOPE scope = dlg.GetLibScope();
784  FP_LIB_TABLE* fp_tbl = ( scope == WIZARD_FPLIB_TABLE::GLOBAL ? aGlobal : aProject );
785 
786  if( fp_tbl )
787  {
788  for( std::vector<WIZARD_FPLIB_TABLE::LIBRARY>::const_iterator it = libs.begin();
789  it != libs.end(); ++it )
790  {
791  if( it->GetStatus() == WIZARD_FPLIB_TABLE::LIBRARY::INVALID )
792  continue;
793 
794  FP_LIB_TABLE_ROW* row = new FP_LIB_TABLE_ROW( it->GetDescription(),
795  it->GetAutoPath( scope ),
796  it->GetPluginName(),
797  wxEmptyString ); // options
798  fp_tbl->InsertRow( row );
799  }
800  }
801 
802  return scope;
803 }
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 763 of file dialog_fp_lib_table.cpp.

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

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