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>

Go to the source code of this file.

Classes

class  FP_TBL_MODEL
 Class FP_TBL_MODEL mixes in FP_LIB_TABLE into wxGridTableBase so the result can be used as a table within wxGrid. More...
 
class  FP_GRID_TRICKS
 
class  DIALOG_FP_LIB_TABLE
 Class DIALOG_FP_LIB_TABLE shows and edits the PCB library tables. More...
 

Enumerations

enum  COL_ORDER {
  COL_NICKNAME, COL_URI, COL_TYPE, COL_OPTIONS,
  COL_DESCR, COL_COUNT
}
 grid column order is established by this sequence More...
 

Functions

int InvokePcbLibTableEditor (wxTopLevelWindow *aParent, 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...
 

Enumeration Type Documentation

enum COL_ORDER

grid column order is established by this sequence

Enumerator
COL_NICKNAME 
COL_URI 
COL_TYPE 
COL_OPTIONS 
COL_DESCR 
COL_COUNT 

Definition at line 50 of file dialog_fp_lib_table.cpp.

Function Documentation

int InvokeFootprintWizard ( wxTopLevelWindow *  aParent,
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 885 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().

887 {
888  WIZARD_FPLIB_TABLE dlg( aParent );
889 
890  if( !dlg.RunWizard( dlg.GetFirstPage() ) )
891  return 0; // Aborted by user
892 
893  const std::vector<WIZARD_FPLIB_TABLE::LIBRARY>& libs = dlg.GetLibraries();
894  WIZARD_FPLIB_TABLE::LIB_SCOPE scope = dlg.GetLibScope();
895  FP_LIB_TABLE* fp_tbl = ( scope == WIZARD_FPLIB_TABLE::GLOBAL ? aGlobal : aProject );
896 
897  if( fp_tbl )
898  {
899  for( std::vector<WIZARD_FPLIB_TABLE::LIBRARY>::const_iterator it = libs.begin();
900  it != libs.end(); ++it )
901  {
902  if( it->GetStatus() == WIZARD_FPLIB_TABLE::LIBRARY::INVALID )
903  continue;
904 
905  FP_LIB_TABLE_ROW* row = new FP_LIB_TABLE_ROW( it->GetDescription(),
906  it->GetAutoPath( scope ),
907  it->GetPluginName(),
908  wxEmptyString ); // options
909  fp_tbl->InsertRow( row );
910  }
911  }
912 
913  return scope;
914 }
Class FP_LIB_TABLE_ROW.
Definition: fp_lib_table.h:41
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 874 of file dialog_fp_lib_table.cpp.

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

876 {
877  DIALOG_FP_LIB_TABLE dlg( aParent, aGlobal, aProject );
878 
879  int dialogRet = dlg.ShowModal(); // returns value passed to EndModal() above
880 
881  return dialogRet;
882 }
Class DIALOG_FP_LIB_TABLE shows and edits the PCB library tables.