KiCad PCB EDA Suite
DIALOG_FP_LIB_TABLE Class Reference

Class DIALOG_FP_LIB_TABLE shows and edits the PCB library tables. More...

Inheritance diagram for DIALOG_FP_LIB_TABLE:
DIALOG_FP_LIB_TABLE_BASE DIALOG_SHIM KIWAY_HOLDER

Public Member Functions

 DIALOG_FP_LIB_TABLE (wxTopLevelWindow *aParent, FP_LIB_TABLE *aGlobal, FP_LIB_TABLE *aProject)
 
 ~DIALOG_FP_LIB_TABLE ()
 
int ShowQuasiModal ()
 
void EndQuasiModal (int retCode)
 
bool IsQuasiModal ()
 
bool Show (bool show) override
 
bool Enable (bool enable) override
 
KIWAYKiway () const
 Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Function Prj returns a reference to the PROJECT "associated with" this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 Function SetKiway. More...
 

Protected Member Functions

void FinishDialogSettings ()
 In all dialogs, we must call the same functions to fix minimal dlg size, the default position and perhaps some others to fix a few issues depending on Windows Managers this helper function does these calls. More...
 
void FixOSXCancelButtonIssue ()
 A ugly hack to fix an issue on OSX: when typing ctrl+c in a wxTextCtrl inside a dialog, it is closed instead of copying a text if a button with wxID_CANCEL is used in a wxStdDialogButtonSizer, when the dlg is created by wxFormBuilder: the label is &Cancel, and this accelerator key has priority to copy text standard accelerator, and the dlg is closed when trying to copy text this function do nothing on other platforms. More...
 

Protected Attributes

wxAuiNotebook * m_auinotebook
 
wxPanel * m_global_panel
 
wxStaticText * m_staticText3
 
wxStaticText * m_GblTableFilename
 
wxGrid * m_global_grid
 
wxPanel * m_project_panel
 
wxStaticText * m_staticText4
 
wxStaticText * m_PrjTableFilename
 
wxGrid * m_project_grid
 
wxButton * m_buttonWizard
 
wxButton * m_append_button
 
wxButton * m_delete_button
 
wxButton * m_move_up_button
 
wxButton * m_move_down_button
 
wxButton * m_edit_options
 
wxGrid * m_path_subs_grid
 
wxStdDialogButtonSizer * m_sdbSizer
 
wxButton * m_sdbSizerOK
 
wxButton * m_sdbSizerCancel
 
std::string m_hash_key
 
EVENT_LOOPm_qmodal_loop
 
bool m_qmodal_showing
 
WDO_ENABLE_DISABLEm_qmodal_parent_disabler
 

Private Types

typedef FP_LIB_TABLE_ROW ROW
 

Private Member Functions

int getCursorCol () const
 If the cursor is not on a valid cell, because there are no rows at all, return -1, else return a 0 based column index. More...
 
int getCursorRow () const
 If the cursor is not on a valid cell, because there are no rows at all, return -1, else return a 0 based row index. More...
 
bool verifyTables ()
 Function verifyTables trims important fields, removes blank row entries, and checks for duplicates. More...
 
void onKeyDown (wxKeyEvent &ev) override
 
void pageChangedHandler (wxAuiNotebookEvent &event) override
 
void appendRowHandler (wxCommandEvent &event) override
 
void deleteRowHandler (wxCommandEvent &event) override
 
void moveUpHandler (wxCommandEvent &event) override
 
void moveDownHandler (wxCommandEvent &event) override
 
void optionsEditor (wxCommandEvent &event) override
 
void OnClickLibraryWizard (wxCommandEvent &event) override
 
void onCancelButtonClick (wxCommandEvent &event) override
 
void onCancelCaptionButtonClick (wxCloseEvent &event) override
 
void onOKButtonClick (wxCommandEvent &event) override
 
void populateEnvironReadOnlyTable ()
 Populate the readonly environment variable table with names and values by examining all the full_uri columns. More...
 
FP_TBL_MODELglobal_model () const
 
FP_TBL_MODELproject_model () const
 
FP_TBL_MODELcur_model () const
 

Private Attributes

FP_LIB_TABLEm_global
 
FP_LIB_TABLEm_project
 
wxGrid * m_cur_grid
 changed based on tab choice More...
 

Static Private Attributes

static int m_pageNdx = 0
 Remember the last notebook page selected during a session. More...
 

Detailed Description

Class DIALOG_FP_LIB_TABLE shows and edits the PCB library tables.

Two tables are expected, one global and one project specific.

Definition at line 290 of file dialog_fp_lib_table.cpp.

Member Typedef Documentation

Definition at line 390 of file dialog_fp_lib_table.cpp.

Constructor & Destructor Documentation

DIALOG_FP_LIB_TABLE::DIALOG_FP_LIB_TABLE ( wxTopLevelWindow *  aParent,
FP_LIB_TABLE aGlobal,
FP_LIB_TABLE aProject 
)
inline

Definition at line 294 of file dialog_fp_lib_table.cpp.

References COL_DESCR, COL_NICKNAME, COL_OPTIONS, COL_TYPE, COL_URI, IO_MGR::EAGLE, IO_MGR::GEDA_PCB, FP_LIB_TABLE::GetGlobalTableFileName(), IO_MGR::GITHUB, IO_MGR::KICAD, IO_MGR::LEGACY, DIALOG_FP_LIB_TABLE_BASE::m_auinotebook, m_cur_grid, DIALOG_FP_LIB_TABLE_BASE::m_GblTableFilename, DIALOG_FP_LIB_TABLE_BASE::m_global_grid, m_pageNdx, DIALOG_FP_LIB_TABLE_BASE::m_PrjTableFilename, DIALOG_FP_LIB_TABLE_BASE::m_project_grid, pageChangedHandler(), populateEnvironReadOnlyTable(), KIWAY_HOLDER::Prj(), and IO_MGR::ShowType().

294  :
295  DIALOG_FP_LIB_TABLE_BASE( aParent ),
296  m_global( aGlobal ),
297  m_project( aProject )
298  {
299  // For user info, shows the table filenames:
300  m_PrjTableFilename->SetLabel( Prj().FootprintLibTblName() );
302 
303  // wxGrid only supports user owned tables if they exist past end of ~wxGrid(),
304  // so make it a grid owned table.
305  m_global_grid->SetTable( new FP_TBL_MODEL( *aGlobal ), true );
306  m_project_grid->SetTable( new FP_TBL_MODEL( *aProject ), true );
307 
308  // add Cut, Copy, and Paste to wxGrids
309  m_global_grid->PushEventHandler( new FP_GRID_TRICKS( m_global_grid ) );
310  m_project_grid->PushEventHandler( new FP_GRID_TRICKS( m_project_grid ) );
311 
312  m_global_grid->AutoSizeColumns( false );
313  m_project_grid->AutoSizeColumns( false );
314 
315  wxArrayString choices;
316 
317  choices.Add( IO_MGR::ShowType( IO_MGR::KICAD ) );
318  choices.Add( IO_MGR::ShowType( IO_MGR::GITHUB ) );
319  choices.Add( IO_MGR::ShowType( IO_MGR::LEGACY ) );
320  choices.Add( IO_MGR::ShowType( IO_MGR::EAGLE ) );
321  choices.Add( IO_MGR::ShowType( IO_MGR::GEDA_PCB ) );
322 
323  /* PCAD_PLUGIN does not support Footprint*() functions
324  choices.Add( IO_MGR::ShowType( IO_MGR::GITHUB ) );
325  */
326 
327  wxGridCellAttr* attr;
328 
329  attr = new wxGridCellAttr;
330  attr->SetEditor( new wxGridCellChoiceEditor( choices ) );
331  m_project_grid->SetColAttr( COL_TYPE, attr );
332 
333  attr = new wxGridCellAttr;
334  attr->SetEditor( new wxGridCellChoiceEditor( choices ) );
335  m_global_grid->SetColAttr( COL_TYPE, attr );
336 
338 
339  for( int i=0; i<2; ++i )
340  {
341  wxGrid* g = i==0 ? m_global_grid : m_project_grid;
342 
343  // all but COL_OPTIONS, which is edited with Option Editor anyways.
344  g->AutoSizeColumn( COL_NICKNAME, false );
345  g->AutoSizeColumn( COL_TYPE, false );
346  g->AutoSizeColumn( COL_URI, false );
347  g->AutoSizeColumn( COL_DESCR, false );
348 
349  // would set this to width of title, if it was easily known.
350  g->SetColSize( COL_OPTIONS, 80 );
351  }
352 
353  // This scrunches the dialog hideously, probably due to wxAUI container.
354  // Fit();
355  // We derive from DIALOG_SHIM so prior size will be used anyways.
356 
357  // select the last selected page
358  m_auinotebook->SetSelection( m_pageNdx );
359 
360  // fire pageChangedHandler() so m_cur_grid gets set
361  // m_auinotebook->SetSelection will generate a pageChangedHandler()
362  // event call later, but too late.
363  wxAuiNotebookEvent uneventful;
364  pageChangedHandler( uneventful );
365 
366  // Gives a selection for each grid, mainly for delete lib button.
367  // Without that, we do not see what lib will be deleted
368  m_global_grid->SelectRow( 0 );
369  m_project_grid->SelectRow( 0 );
370 
371  // for ALT+A handling, we want the initial focus to be on the first selected grid.
372  m_cur_grid->SetFocus();
373 
374  // On some windows manager (Unity, XFCE), this dialog is
375  // not always raised, depending on this dialog is run.
376  // Force it to be raised
377  Raise();
378  }
Class FP_TBL_MODEL mixes in FP_LIB_TABLE into wxGridTableBase so the result can be used as a table wi...
static const wxString ShowType(PCB_FILE_T aFileType)
Function ShowType returns a brief name for a plugin, given aFileType enum.
Definition: io_mgr.cpp:105
DIALOG_FP_LIB_TABLE_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("PCB Library Tables"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(717, 600), long style=wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU)
Geda PCB file formats.
Definition: io_mgr.h:57
void populateEnvironReadOnlyTable()
Populate the readonly environment variable table with names and values by examining all the full_uri ...
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
S-expression Pcbnew file format.
Definition: io_mgr.h:54
void pageChangedHandler(wxAuiNotebookEvent &event) override
Legacy Pcbnew file formats prior to s-expression.
Definition: io_mgr.h:53
static int m_pageNdx
Remember the last notebook page selected during a session.
wxGrid * m_cur_grid
changed based on tab choice
Read only http://github.com repo holding pretty footprints.
Definition: io_mgr.h:58
static wxString GetGlobalTableFileName()
Function GetGlobalTableFileName.
DIALOG_FP_LIB_TABLE::~DIALOG_FP_LIB_TABLE ( )
inline

Definition at line 380 of file dialog_fp_lib_table.cpp.

References DIALOG_FP_LIB_TABLE_BASE::m_global_grid, and DIALOG_FP_LIB_TABLE_BASE::m_project_grid.

381  {
382  // Delete the GRID_TRICKS.
383  // Any additional event handlers should be popped before the window is deleted.
384  m_global_grid->PopEventHandler( true );
385  m_project_grid->PopEventHandler( true );
386  }

Member Function Documentation

void DIALOG_FP_LIB_TABLE::appendRowHandler ( wxCommandEvent &  event)
inlineoverrideprivatevirtual

Implements DIALOG_FP_LIB_TABLE_BASE.

Definition at line 523 of file dialog_fp_lib_table.cpp.

References m_cur_grid.

524  {
525  if( m_cur_grid->AppendRows( 1 ) )
526  {
527  int last_row = m_cur_grid->GetNumberRows() - 1;
528 
529  // wx documentation is wrong, SetGridCursor does not make visible.
530  m_cur_grid->MakeCellVisible( last_row, 0 );
531  m_cur_grid->SetGridCursor( last_row, 0 );
532  m_cur_grid->SelectRow( m_cur_grid->GetGridCursorRow() );
533  }
534  }
wxGrid * m_cur_grid
changed based on tab choice
FP_TBL_MODEL* DIALOG_FP_LIB_TABLE::cur_model ( ) const
inlineprivate

Definition at line 818 of file dialog_fp_lib_table.cpp.

References m_cur_grid.

Referenced by moveDownHandler(), moveUpHandler(), optionsEditor(), and verifyTables().

818 { return (FP_TBL_MODEL*) m_cur_grid->GetTable(); }
Class FP_TBL_MODEL mixes in FP_LIB_TABLE into wxGridTableBase so the result can be used as a table wi...
wxGrid * m_cur_grid
changed based on tab choice
void DIALOG_FP_LIB_TABLE::deleteRowHandler ( wxCommandEvent &  event)
inlineoverrideprivatevirtual

Implements DIALOG_FP_LIB_TABLE_BASE.

Definition at line 536 of file dialog_fp_lib_table.cpp.

References getCursorCol(), getCursorRow(), and m_cur_grid.

537  {
538  int currRow = getCursorRow();
539 
540  // In a wxGrid, collect rows that have a selected cell, or are selected
541  // is not so easy: it depend on the way the selection was made.
542  // Here, we collect row selected by clicking on a row label, and
543  // row that contain a cell previously selected.
544  // If no candidate, just delete the row with the grid cursor.
545  wxArrayInt selectedRows = m_cur_grid->GetSelectedRows();
546  wxGridCellCoordsArray cells = m_cur_grid->GetSelectedCells();
547 
548  // Add all row having cell selected to list:
549  for( unsigned ii = 0; ii < cells.GetCount(); ii++ )
550  selectedRows.Add( cells[ii].GetRow() );
551 
552  // Use the row having the grid cursor only if we have no candidate:
553  if( selectedRows.size() == 0 && getCursorRow() >= 0 )
554  selectedRows.Add( getCursorRow() );
555 
556  std::sort( selectedRows.begin(), selectedRows.end() );
557 
558  // Remove selected rows (note: a row can be stored more than once in list)
559  int last_row = -1;
560  for( int ii = selectedRows.GetCount()-1; ii >= 0; ii-- )
561  {
562  int row = selectedRows[ii];
563 
564  if( row != last_row )
565  {
566  last_row = row;
567  m_cur_grid->DeleteRows( row, 1 );
568  }
569  }
570 
571  if( currRow >= m_cur_grid->GetNumberRows() )
572  m_cur_grid->SetGridCursor(m_cur_grid->GetNumberRows()-1, getCursorCol() );
573 
574  m_cur_grid->SelectRow( m_cur_grid->GetGridCursorRow() );
575  }
int getCursorCol() const
If the cursor is not on a valid cell, because there are no rows at all, return -1, else return a 0 based column index.
int getCursorRow() const
If the cursor is not on a valid cell, because there are no rows at all, return -1, else return a 0 based row index.
wxGrid * m_cur_grid
changed based on tab choice
bool DIALOG_SHIM::Enable ( bool  enable)
overrideinherited

Definition at line 181 of file dialog_shim.cpp.

Referenced by DIALOG_PRINT_USING_PRINTER::InitValues().

182 {
183  // so we can do logging of this state change:
184 
185 #if defined(DEBUG)
186  const char* type_id = typeid( *this ).name();
187  printf( "wxDialog %s: %s\n", type_id, enable ? "enabled" : "disabled" );
188 #endif
189 
190  return wxDialog::Enable( enable );
191 }
void DIALOG_SHIM::EndQuasiModal ( int  retCode)
inherited

Definition at line 539 of file dialog_shim.cpp.

References DIALOG_SHIM::IsQuasiModal(), DIALOG_SHIM::m_qmodal_loop, DIALOG_SHIM::m_qmodal_parent_disabler, DIALOG_SHIM::m_qmodal_showing, and DIALOG_SHIM::Show().

Referenced by HK_PROMPT_DIALOG::EndFlexible(), DIALOG_SHIM::OnButton(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnCancelButtonClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnCancelButtonClick(), DIALOG_EDIT_ONE_FIELD::OnCancelClick(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnCloseDialog(), DIALOG_EDIT_ONE_FIELD::OnCloseDialog(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnCloseDialog(), DIALOG_CHOOSE_COMPONENT::OnCloseTimer(), DIALOG_SHIM::OnCloseWindow(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick(), DIALOG_EDIT_ONE_FIELD::OnOkClick(), DIALOG_EXCHANGE_MODULE::OnQuit(), DIALOG_CHOOSE_COMPONENT::OnSchViewDClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp(), and DIALOG_SHIM::~DIALOG_SHIM().

540 {
541  // Hook up validator and transfer data from controls handling so quasi-modal dialogs
542  // handle validation in the same way as other dialogs.
543  if( ( retCode == wxID_OK ) && ( !Validate() || !TransferDataFromWindow() ) )
544  return;
545 
546  SetReturnCode( retCode );
547 
548  if( !IsQuasiModal() )
549  {
550  wxFAIL_MSG( wxT( "either DIALOG_SHIM::EndQuasiModal called twice or ShowQuasiModal wasn't called" ) );
551  return;
552  }
553 
554  m_qmodal_showing = false;
555 
556  if( m_qmodal_loop )
557  {
558  if( m_qmodal_loop->IsRunning() )
559  m_qmodal_loop->Exit( 0 );
560  else
561  m_qmodal_loop->ScheduleExit( 0 );
562 
563  m_qmodal_loop = NULL;
564  }
565 
568 
569  Show( false );
570 }
bool m_qmodal_showing
Definition: dialog_shim.h:132
EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:131
bool IsQuasiModal()
Definition: dialog_shim.h:93
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:133
void DIALOG_SHIM::FinishDialogSettings ( )
protectedinherited

In all dialogs, we must call the same functions to fix minimal dlg size, the default position and perhaps some others to fix a few issues depending on Windows Managers this helper function does these calls.

FinishDialogSettings must be called from derived classes, when all widgets are initialized, and therefore their size fixed. If TransferDataToWindow() is used to initialize widgets, at end of TransferDataToWindow, or better at end of a wxInitDialogEvent handler

In any case, the best way is to call it in a wxInitDialogEvent handler after calling TransfertDataToWindow(), which is the default wxInitDialogEvent handler wxDialog

Definition at line 103 of file dialog_shim.cpp.

References PCAD2KICAD::Center.

Referenced by DIALOG_BOM::DIALOG_BOM(), DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE(), DIALOG_DESIGN_RULES::DIALOG_DESIGN_RULES(), DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR(), DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS(), DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY(), DIALOG_EESCHEMA_OPTIONS::DIALOG_EESCHEMA_OPTIONS(), DIALOG_ENUM_PADS::DIALOG_ENUM_PADS(), DIALOG_EXPORT_3DFILE::DIALOG_EXPORT_3DFILE(), DIALOG_EXPORT_IDF3::DIALOG_EXPORT_IDF3(), DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP(), DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST(), DIALOG_KEEPOUT_AREA_PROPERTIES::DIALOG_KEEPOUT_AREA_PROPERTIES(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM(), DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT(), DIALOG_LIB_NEW_COMPONENT::DIALOG_LIB_NEW_COMPONENT(), DIALOG_LIBEDIT_OPTIONS::DIALOG_LIBEDIT_OPTIONS(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC(), DIALOG_SCH_EDIT_SHEET_PIN::DIALOG_SCH_EDIT_SHEET_PIN(), DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS(), DIALOG_SELECT_PRETTY_LIB::DIALOG_SELECT_PRETTY_LIB(), DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE(), DIALOG_EDIT_ONE_FIELD::init(), NETLIST_DIALOG::NETLIST_DIALOG(), DIALOG_LIB_EDIT_PIN::OnInitDialog(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnInitDialog(), DIALOG_TRACK_VIA_PROPERTIES::OnInitDlg(), DIALOG_GRAPHIC_ITEMS_OPTIONS::OnInitDlg(), DialogEditModuleText::OnInitDlg(), DIALOG_SET_GRID::OnInitDlg(), DIALOG_PCB_TEXT_PROPERTIES::OnInitDlg(), DIALOG_PRINT_FOR_MODEDIT::OnInitDlg(), DIALOG_GRAPHIC_ITEM_PROPERTIES::OnInitDlg(), DIALOG_MODULE_MODULE_EDITOR::OnInitDlg(), DIALOG_SIM_SETTINGS::onInitDlg(), DIALOG_SPICE_MODEL::onInitDlg(), DIALOG_MODULE_BOARD_EDITOR::OnInitDlg(), DIALOG_PRINT_USING_PRINTER::OnInitDlg(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnInitDlg(), TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR(), and DIALOG_SIGNAL_LIST::TransferDataToWindow().

104 {
105  // must be called from the constructor of derived classes,
106  // when all widgets are initialized, and therefore their size fixed
107 
108  // SetSizeHints fixes the minimal size of sizers in the dialog
109  // (SetSizeHints calls Fit(), so no need to call it)
110  GetSizer()->SetSizeHints( this );
111 
112  // the default position, when calling the first time the dlg
113  Center();
114 }
void DIALOG_SHIM::FixOSXCancelButtonIssue ( )
protectedinherited

A ugly hack to fix an issue on OSX: when typing ctrl+c in a wxTextCtrl inside a dialog, it is closed instead of copying a text if a button with wxID_CANCEL is used in a wxStdDialogButtonSizer, when the dlg is created by wxFormBuilder: the label is &Cancel, and this accelerator key has priority to copy text standard accelerator, and the dlg is closed when trying to copy text this function do nothing on other platforms.

Definition at line 116 of file dialog_shim.cpp.

Referenced by DIALOG_SHIM::Show().

117 {
118 #ifdef __WXMAC__
119  // A ugly hack to fix an issue on OSX: ctrl+c closes the dialog instead of
120  // copying a text if a button with wxID_CANCEL is used in a wxStdDialogButtonSizer
121  // created by wxFormBuilder: the label is &Cancel, and this accelerator key has priority
122  // to copy text standard accelerator, and the dlg is closed when trying to copy text
123  wxButton* button = dynamic_cast< wxButton* > ( wxWindow::FindWindowById( wxID_CANCEL, this ) );
124 
125  if( button )
126  button->SetLabel( _( "Cancel" ) );
127 #endif
128 }
int DIALOG_FP_LIB_TABLE::getCursorCol ( ) const
inlineprivate

If the cursor is not on a valid cell, because there are no rows at all, return -1, else return a 0 based column index.

Definition at line 394 of file dialog_fp_lib_table.cpp.

References m_cur_grid.

Referenced by deleteRowHandler(), moveDownHandler(), and moveUpHandler().

395  {
396  return m_cur_grid->GetGridCursorCol();
397  }
wxGrid * m_cur_grid
changed based on tab choice
int DIALOG_FP_LIB_TABLE::getCursorRow ( ) const
inlineprivate

If the cursor is not on a valid cell, because there are no rows at all, return -1, else return a 0 based row index.

Definition at line 401 of file dialog_fp_lib_table.cpp.

References m_cur_grid.

Referenced by deleteRowHandler(), moveDownHandler(), moveUpHandler(), and optionsEditor().

402  {
403  return m_cur_grid->GetGridCursorRow();
404  }
wxGrid * m_cur_grid
changed based on tab choice
FP_TBL_MODEL* DIALOG_FP_LIB_TABLE::global_model ( ) const
inlineprivate

Definition at line 816 of file dialog_fp_lib_table.cpp.

References DIALOG_FP_LIB_TABLE_BASE::m_global_grid.

Referenced by onOKButtonClick(), populateEnvironReadOnlyTable(), and verifyTables().

816 { return (FP_TBL_MODEL*) m_global_grid->GetTable(); }
Class FP_TBL_MODEL mixes in FP_LIB_TABLE into wxGridTableBase so the result can be used as a table wi...
KIWAY& KIWAY_HOLDER::Kiway ( ) const
inlineinherited

Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in.

A KIWAY_HOLDER is not necessarily a KIWAY_PLAYER.

Definition at line 60 of file kiway_player.h.

References KIWAY_HOLDER::m_kiway.

Referenced by SCH_EDIT_FRAME::AppendOneEEProject(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), CVPCB_MAINFRAME::CreateScreenCmp(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_SHIM::DIALOG_SHIM(), EDIT_TOOL::editFootprintInFpEditor(), SCH_EDIT_FRAME::EditSheet(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), FOOTPRINT_EDIT_FRAME::GetPlotSettings(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers(), LIB_EDIT_FRAME::InstallConfigFrame(), PCB_EDIT_FRAME::InstallModuleOptionsFrame(), KIWAY_PLAYER::language_change(), SCH_SHEET::Load(), CVPCB_MAINFRAME::LoadFootprintFiles(), KIWAY_PLAYER::OnChangeIconsOptions(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnLeftClick(), SCH_BASE_FRAME::OnOpenLibraryViewer(), SCH_EDIT_FRAME::OnSimulate(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateReplaceModuleInBoard(), SCH_EDIT_FRAME::OpenProjectFiles(), KIWAY_HOLDER::Prj(), PCB_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Special_Functions(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), CVPCB_MAINFRAME::ReadNetListAndLinkFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), LIB_EDIT_FRAME::refreshSchematic(), SCH_EDIT_FRAME::SaveEEFile(), CVPCB_MAINFRAME::SaveFootprintAssociation(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_EDIT_FRAME::SetPlotSettings(), DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame(), FOOTPRINT_VIEWER_FRAME::Show3D_Frame(), FOOTPRINT_EDIT_FRAME::Show3D_Frame(), FOOTPRINT_WIZARD_FRAME::Show3D_Frame(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::showButtonHandler(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::showButtonHandler(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), and DIALOG_EXCHANGE_MODULE::ViewAndSelectFootprint().

61  {
62  wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
63  return *m_kiway;
64  }
KIWAY * m_kiway
Definition: kiway_player.h:85
void DIALOG_FP_LIB_TABLE::moveDownHandler ( wxCommandEvent &  event)
inlineoverrideprivatevirtual

Implements DIALOG_FP_LIB_TABLE_BASE.

Definition at line 616 of file dialog_fp_lib_table.cpp.

References cur_model(), getCursorCol(), getCursorRow(), m_cur_grid, and LIB_TABLE::rows.

617  {
618  wxArrayInt rowsSelected = m_cur_grid->GetSelectedRows();
619 
620  if( rowsSelected.GetCount() == 0 )
621  return;
622 
623  FP_TBL_MODEL* tbl = cur_model();
624 
625  // @todo: add multiple selection moves.
626  int curRow = rowsSelected[0];
627 
628  if( unsigned( curRow + 1 ) < tbl->rows.size() )
629  {
630  int curCol = getCursorCol();
631 
632  boost::ptr_vector< LIB_TABLE_ROW >::auto_type move_me =
633  tbl->rows.release( tbl->rows.begin() + curRow );
634 
635  ++curRow;
636  tbl->rows.insert( tbl->rows.begin() + curRow, move_me.release() );
637 
638  if( tbl->GetView() )
639  {
640  // fire a msg to cause redrawing
641  wxGridTableMessage msg( tbl,
642  wxGRIDTABLE_NOTIFY_ROWS_INSERTED,
643  curRow - 1,
644  0 );
645 
646  tbl->GetView()->ProcessTableMessage( msg );
647  }
648 
649  m_cur_grid->MakeCellVisible( curRow, curCol );
650  m_cur_grid->SetGridCursor( curRow, curCol );
651  m_cur_grid->SelectRow( getCursorRow() );
652  }
653  }
int getCursorCol() const
If the cursor is not on a valid cell, because there are no rows at all, return -1, else return a 0 based column index.
int getCursorRow() const
If the cursor is not on a valid cell, because there are no rows at all, return -1, else return a 0 based row index.
Class FP_TBL_MODEL mixes in FP_LIB_TABLE into wxGridTableBase so the result can be used as a table wi...
FP_TBL_MODEL * cur_model() const
LIB_TABLE_ROWS rows
wxGrid * m_cur_grid
changed based on tab choice
void DIALOG_FP_LIB_TABLE::moveUpHandler ( wxCommandEvent &  event)
inlineoverrideprivatevirtual

Implements DIALOG_FP_LIB_TABLE_BASE.

Definition at line 577 of file dialog_fp_lib_table.cpp.

References cur_model(), getCursorCol(), getCursorRow(), m_cur_grid, and LIB_TABLE::rows.

578  {
579  wxArrayInt rowsSelected = m_cur_grid->GetSelectedRows();
580 
581  if( rowsSelected.GetCount() == 0 )
582  return;
583 
584  // @todo: add multiple selection moves.
585  int curRow = rowsSelected[0];
586 
587  if( curRow >= 1 )
588  {
589  int curCol = getCursorCol();
590 
591  FP_TBL_MODEL* tbl = cur_model();
592 
593  boost::ptr_vector< LIB_TABLE_ROW >::auto_type move_me =
594  tbl->rows.release( tbl->rows.begin() + curRow );
595 
596  --curRow;
597  tbl->rows.insert( tbl->rows.begin() + curRow, move_me.release() );
598 
599  if( tbl->GetView() )
600  {
601  // fire a msg to cause redrawing
602  wxGridTableMessage msg( tbl,
603  wxGRIDTABLE_NOTIFY_ROWS_INSERTED,
604  curRow,
605  0 );
606 
607  tbl->GetView()->ProcessTableMessage( msg );
608  }
609 
610  m_cur_grid->MakeCellVisible( curRow, curCol );
611  m_cur_grid->SetGridCursor( curRow, curCol );
612  m_cur_grid->SelectRow( getCursorRow() );
613  }
614  }
int getCursorCol() const
If the cursor is not on a valid cell, because there are no rows at all, return -1, else return a 0 based column index.
int getCursorRow() const
If the cursor is not on a valid cell, because there are no rows at all, return -1, else return a 0 based row index.
Class FP_TBL_MODEL mixes in FP_LIB_TABLE into wxGridTableBase so the result can be used as a table wi...
FP_TBL_MODEL * cur_model() const
LIB_TABLE_ROWS rows
wxGrid * m_cur_grid
changed based on tab choice
void DIALOG_FP_LIB_TABLE::onCancelButtonClick ( wxCommandEvent &  event)
inlineoverrideprivatevirtual

Implements DIALOG_FP_LIB_TABLE_BASE.

Definition at line 689 of file dialog_fp_lib_table.cpp.

690  {
691  EndModal( 0 );
692  }
void DIALOG_FP_LIB_TABLE::onCancelCaptionButtonClick ( wxCloseEvent &  event)
inlineoverrideprivatevirtual

Implements DIALOG_FP_LIB_TABLE_BASE.

Definition at line 694 of file dialog_fp_lib_table.cpp.

695  {
696  EndModal( 0 );
697  }
void DIALOG_FP_LIB_TABLE::OnClickLibraryWizard ( wxCommandEvent &  event)
overrideprivatevirtual

Implements DIALOG_FP_LIB_TABLE_BASE.

Definition at line 828 of file dialog_fp_lib_table.cpp.

References COL_NICKNAME, COL_TYPE, COL_URI, WIZARD_FPLIB_TABLE::GetFirstPage(), WIZARD_FPLIB_TABLE::GetLibraries(), WIZARD_FPLIB_TABLE::GetLibScope(), FP_TBL_MODEL::GetNumberRows(), WIZARD_FPLIB_TABLE::GLOBAL, WIZARD_FPLIB_TABLE::LIBRARY::INVALID, DIALOG_FP_LIB_TABLE_BASE::m_auinotebook, DIALOG_FP_LIB_TABLE_BASE::m_global_grid, DIALOG_FP_LIB_TABLE_BASE::m_project_grid, and FP_TBL_MODEL::SetValue().

829 {
830  WIZARD_FPLIB_TABLE dlg( this );
831 
832  if( !dlg.RunWizard( dlg.GetFirstPage() ) )
833  return; // Aborted by user
834 
835  const std::vector<WIZARD_FPLIB_TABLE::LIBRARY>& libs = dlg.GetLibraries();
836  bool global_scope = dlg.GetLibScope() == WIZARD_FPLIB_TABLE::GLOBAL;
837  wxGrid* libgrid = global_scope ? m_global_grid : m_project_grid;
838  FP_TBL_MODEL* tbl = (FP_TBL_MODEL*) libgrid->GetTable();
839 
840  for( std::vector<WIZARD_FPLIB_TABLE::LIBRARY>::const_iterator it = libs.begin();
841  it != libs.end(); ++it )
842  {
843  if( it->GetStatus() == WIZARD_FPLIB_TABLE::LIBRARY::INVALID )
844  continue;
845 
846  if( libgrid->AppendRows( 1 ) )
847  {
848  int last_row = libgrid->GetNumberRows() - 1;
849 
850  // Add the nickname: currently make it from filename
851  tbl->SetValue( last_row, COL_NICKNAME, it->GetDescription() );
852 
853  // Add the path:
854  tbl->SetValue( last_row, COL_URI, it->GetAutoPath( dlg.GetLibScope() ) );
855 
856  // Add the plugin name:
857  tbl->SetValue( last_row, COL_TYPE, it->GetPluginName() );
858 
859  libgrid->MakeCellVisible( last_row, 0 );
860  libgrid->SetGridCursor( last_row, 0 );
861  }
862  }
863 
864  // Switch to the current scope tab
865  if( global_scope )
866  m_auinotebook->SetSelection( 0 );
867  else
868  m_auinotebook->SetSelection( 1 );
869 
870  libgrid->SelectRow( libgrid->GetGridCursorRow() );
871 }
void SetValue(int aRow, int aCol, const wxString &aValue) override
Class FP_TBL_MODEL mixes in FP_LIB_TABLE into wxGridTableBase so the result can be used as a table wi...
int GetNumberRows() override
void DIALOG_FP_LIB_TABLE::onKeyDown ( wxKeyEvent &  ev)
inlineoverrideprivatevirtual

Implements DIALOG_FP_LIB_TABLE_BASE.

Definition at line 505 of file dialog_fp_lib_table.cpp.

References m_cur_grid.

506  {
507 #if 0
508  // send the key to the current grid
509  ((wxEvtHandler*)m_cur_grid)->ProcessEvent( ev );
510 #else
511  // or no:
512  // m_cur_grid has the focus most of the time anyways, so above not needed.
513  ev.Skip();
514 #endif
515  }
wxGrid * m_cur_grid
changed based on tab choice
void DIALOG_FP_LIB_TABLE::onOKButtonClick ( wxCommandEvent &  event)
inlineoverrideprivatevirtual

Implements DIALOG_FP_LIB_TABLE_BASE.

Definition at line 699 of file dialog_fp_lib_table.cpp.

References LIB_TABLE::Clear(), global_model(), m_cur_grid, m_global, m_project, project_model(), LIB_TABLE::reindex(), LIB_TABLE::rows, and verifyTables().

700  {
701  int dialogRet = 0;
702 
703  // stuff any pending cell editor text into the table.
704  m_cur_grid->SaveEditControlValue();
705 
706  if( verifyTables() )
707  {
708  if( *global_model() != *m_global )
709  {
710  dialogRet |= 1;
711 
712  m_global->Clear();
713  m_global->rows.transfer( m_global->rows.end(), global_model()->rows.begin(),
714  global_model()->rows.end(), global_model()->rows );
715  m_global->reindex();
716  }
717 
718  if( *project_model() != *m_project )
719  {
720  dialogRet |= 2;
721 
722  m_project->Clear();
723  m_project->rows.transfer( m_project->rows.end(), project_model()->rows.begin(),
724  project_model()->rows.end(), project_model()->rows );
725  m_project->reindex();
726  }
727 
728  EndModal( dialogRet );
729  }
730  }
FP_TBL_MODEL * global_model() const
void Clear()
Delete all rows.
void reindex()
FP_TBL_MODEL * project_model() const
LIB_TABLE_ROWS rows
wxGrid * m_cur_grid
changed based on tab choice
bool verifyTables()
Function verifyTables trims important fields, removes blank row entries, and checks for duplicates...
void DIALOG_FP_LIB_TABLE::optionsEditor ( wxCommandEvent &  event)
inlineoverrideprivatevirtual

Implements DIALOG_FP_LIB_TABLE_BASE.

Definition at line 655 of file dialog_fp_lib_table.cpp.

References COL_NICKNAME, COL_TYPE, COL_URI, cur_model(), getCursorRow(), LIB_TABLE_ROW::GetNickName(), FP_TBL_MODEL::GetNumberRows(), LIB_TABLE_ROW::GetOptions(), LIB_TABLE_ROW::GetType(), InvokePluginOptionsEditor(), m_cur_grid, Refresh(), LIB_TABLE::rows, and LIB_TABLE_ROW::SetOptions().

656  {
657  FP_TBL_MODEL* tbl = cur_model();
658 
659  if( tbl->GetNumberRows() )
660  {
661  int curRow = getCursorRow();
662  LIB_TABLE_ROW* row = &tbl->rows[curRow];
663 
664  wxString result;
665  const wxString& options = row->GetOptions();
666 
667  InvokePluginOptionsEditor( this, row->GetNickName(), row->GetType(), options, &result );
668 
669  if( options != result )
670  {
671  row->SetOptions( result );
672 
673  // all but options:
674  m_cur_grid->AutoSizeColumn( COL_NICKNAME, false );
675  m_cur_grid->AutoSizeColumn( COL_URI, false );
676  m_cur_grid->AutoSizeColumn( COL_TYPE, false );
677 
678  // On Windows, the grid is not refresh,
679  // so force resfresh after a change
680 #ifdef __WINDOWS__
681  Refresh();
682 #endif
683  }
684  }
685  }
int getCursorRow() const
If the cursor is not on a valid cell, because there are no rows at all, return -1, else return a 0 based row index.
Class LIB_TABLE_ROW.
Class FP_TBL_MODEL mixes in FP_LIB_TABLE into wxGridTableBase so the result can be used as a table wi...
FP_TBL_MODEL * cur_model() const
void InvokePluginOptionsEditor(wxTopLevelWindow *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 c...
const wxString & GetOptions() const
Function GetOptions.
LIB_TABLE_ROWS rows
virtual const wxString GetType() const =0
Function GetType.
int GetNumberRows() override
void Refresh()
const wxString & GetNickName() const
Function GetNickName.
wxGrid * m_cur_grid
changed based on tab choice
void SetOptions(const wxString &aOptions)
Function SetOptions.
void DIALOG_FP_LIB_TABLE::pageChangedHandler ( wxAuiNotebookEvent &  event)
inlineoverrideprivatevirtual

Implements DIALOG_FP_LIB_TABLE_BASE.

Definition at line 517 of file dialog_fp_lib_table.cpp.

References DIALOG_FP_LIB_TABLE_BASE::m_auinotebook, m_cur_grid, DIALOG_FP_LIB_TABLE_BASE::m_global_grid, m_pageNdx, and DIALOG_FP_LIB_TABLE_BASE::m_project_grid.

Referenced by DIALOG_FP_LIB_TABLE().

518  {
519  m_pageNdx = m_auinotebook->GetSelection();
521  }
static int m_pageNdx
Remember the last notebook page selected during a session.
wxGrid * m_cur_grid
changed based on tab choice
void DIALOG_FP_LIB_TABLE::populateEnvironReadOnlyTable ( )
inlineprivate

Populate the readonly environment variable table with names and values by examining all the full_uri columns.

Definition at line 734 of file dialog_fp_lib_table.cpp.

References COL_URI, FP_TBL_MODEL::GetNumberRows(), FP_TBL_MODEL::GetValue(), global_model(), FP_LIB_TABLE::GlobalPathEnvVariableName(), KISYS3DMOD, DIALOG_FP_LIB_TABLE_BASE::m_path_subs_grid, project_model(), and PROJECT_VAR_NAME.

Referenced by DIALOG_FP_LIB_TABLE().

735  {
736  wxRegEx re( ".*?\\$\\{(.+?)\\}.*?", wxRE_ADVANCED );
737  wxASSERT( re.IsValid() ); // wxRE_ADVANCED is required.
738 
739  std::set< wxString > unique;
740  typedef std::set<wxString>::const_iterator SET_CITER;
741 
742  // clear the table
743  m_path_subs_grid->DeleteRows( 0, m_path_subs_grid->GetNumberRows() );
744 
745  FP_TBL_MODEL* gbl = global_model();
746  FP_TBL_MODEL* prj = project_model();
747 
748  int gblRowCount = gbl->GetNumberRows();
749  int prjRowCount = prj->GetNumberRows();
750  int row;
751 
752  for( row = 0; row < gblRowCount; ++row )
753  {
754  wxString uri = gbl->GetValue( row, COL_URI );
755 
756  while( re.Matches( uri ) )
757  {
758  wxString envvar = re.GetMatch( uri, 1 );
759 
760  // ignore duplicates
761  unique.insert( envvar );
762 
763  // delete the last match and search again
764  uri.Replace( re.GetMatch( uri, 0 ), wxEmptyString );
765  }
766  }
767 
768  for( row = 0; row < prjRowCount; ++row )
769  {
770  wxString uri = prj->GetValue( row, COL_URI );
771 
772  while( re.Matches( uri ) )
773  {
774  wxString envvar = re.GetMatch( uri, 1 );
775 
776  // ignore duplicates
777  unique.insert( envvar );
778 
779  // delete the last match and search again
780  uri.Replace( re.GetMatch( uri, 0 ), wxEmptyString );
781  }
782  }
783 
784  // Make sure this special environment variable shows up even if it was
785  // not used yet. It is automatically set by KiCad to the directory holding
786  // the current project.
787  unique.insert( PROJECT_VAR_NAME );
788  unique.insert( FP_LIB_TABLE::GlobalPathEnvVariableName() );
789  // This special environment variable is used to locate 3d shapes
790  unique.insert( KISYS3DMOD );
791 
792  m_path_subs_grid->AppendRows( unique.size() );
793 
794  row = 0;
795 
796  for( SET_CITER it = unique.begin(); it != unique.end(); ++it, ++row )
797  {
798  wxString evName = *it;
799  wxString evValue;
800 
801  m_path_subs_grid->SetCellValue( row, 0, evName );
802 
803  if( wxGetEnv( evName, &evValue ) )
804  m_path_subs_grid->SetCellValue( row, 1, evValue );
805  }
806 
807  m_path_subs_grid->AutoSizeColumns();
808  }
FP_TBL_MODEL * global_model() const
Class FP_TBL_MODEL mixes in FP_LIB_TABLE into wxGridTableBase so the result can be used as a table wi...
FP_TBL_MODEL * project_model() const
#define PROJECT_VAR_NAME
A variable name whose value holds the current project directory.
Definition: project.h:32
int GetNumberRows() override
static const wxString GlobalPathEnvVariableName()
Function GlobalPathEnvVarVariableName.
#define KISYS3DMOD
A variable name whose value holds the path of 3D shape files.
Definition: 3d_viewer.h:38
wxString GetValue(int aRow, int aCol) override
PROJECT & KIWAY_HOLDER::Prj ( ) const
inherited

Function Prj returns a reference to the PROJECT "associated with" this KIWAY.

Definition at line 34 of file kiway_holder.cpp.

References KIWAY_HOLDER::Kiway(), and KIWAY::Prj().

Referenced by SCH_EDIT_FRAME::AnnotateComponents(), SCH_EDIT_FRAME::AppendOneEEProject(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), LIB_VIEW_FRAME::BestZoom(), DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DShapeFile(), DIALOG_MODULE_BOARD_EDITOR::BrowseAndAdd3DShapeFile(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::BrowseAndSelectDocFile(), DIALOG_EXCHANGE_MODULE::BrowseAndSelectFootprint(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_MODULE_MODULE_EDITOR::Cfg3DPath(), DIALOG_MODULE_BOARD_EDITOR::Cfg3DPath(), SCH_EDIT_FRAME::CheckAnnotate(), SCH_SCREEN::CheckComponentsToPartsLinks(), SCH_EDIT_FRAME::ConvertPart(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), SCH_EDIT_FRAME::CreateArchiveLibrary(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), DIALOG_PLOT_SCHEMATIC::createPlotFileName(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary(), LIB_EDIT_FRAME::DeleteOnePart(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_EESCHEMA_CONFIG::DIALOG_EESCHEMA_CONFIG(), DIALOG_FP_LIB_TABLE(), DIALOG_MODULE_MODULE_EDITOR::DIALOG_MODULE_MODULE_EDITOR(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD(), LIB_VIEW_FRAME::DisplayLibInfos(), SCH_BASE_FRAME::DisplayListComponentsInLib(), PCB_EDIT_FRAME::doAutoSave(), DIALOG_MODULE_MODULE_EDITOR::Edit3DShapeFileName(), DIALOG_MODULE_BOARD_EDITOR::Edit3DShapeFileName(), SCH_EDIT_FRAME::EditComponentFieldText(), SCH_EDIT_FRAME::EditSheet(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::ExportToGenCAD(), PCB_EDIT_FRAME::ExportVRML_File(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::GenD356File(), DIALOG_GENDRILL::GenDrillAndMapFiles(), NETLIST_DIALOG::GenNetlist(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), LIB_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), LIB_EDIT_FRAME::GetCurPart(), FOOTPRINT_EDIT_FRAME::GetCurrentLib(), FOOTPRINT_EDIT_FRAME::getLibPath(), DIALOG_BOM::getPluginFileName(), LIB_VIEW_FRAME::getSelectedAlias(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers(), DIALOG_MODULE_MODULE_EDITOR::initModeditProperties(), DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties(), LIB_EDIT_FRAME::InstallConfigFrame(), SCH_EDIT_FRAME::InstallConfigFrame(), PCB_EDIT_FRAME::InstallNetlistFrame(), SCH_EDIT_FRAME::IsSearchCacheObsolete(), SCH_EDIT_FRAME::Load_Component(), SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile(), CVPCB_MAINFRAME::LoadFootprintFiles(), SCH_EDIT_FRAME::LoadOneEEFile(), LIB_EDIT_FRAME::LoadOneLibraryPart(), LIB_EDIT_FRAME::LoadOneSymbol(), CVPCB_MAINFRAME::LoadProjectFile(), SCH_EDIT_FRAME::LoadProjectFile(), PCB_EDIT_FRAME::LoadProjectSettings(), DIALOG_DRC_CONTROL::makeValidFileNameReport(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick(), DIALOG_EESCHEMA_CONFIG::OnAddOrInsertPath(), DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick(), LIB_EDIT_FRAME::OnCloseWindow(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), DIALOG_GENDRILL::OnGenReportFile(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), PCB_EDIT_FRAME::OnLeftClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick(), DIALOG_NETLIST::OnOpenNetlistClick(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_SVG_PRINT::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), DIALOG_GEN_MODULE_POSITION::OnOutputDirectoryBrowseClicked(), LIB_EDIT_FRAME::OnPlotCurrentComponent(), SCH_EDIT_FRAME::OnRightClick(), DIALOG_BOM::OnRunPlugin(), DIALOG_NETLIST::OnSaveMessagesToFile(), SCH_EDIT_FRAME::OnSaveProject(), DIALOG_SPICE_MODEL::onSelectIcLib(), LIB_VIEW_FRAME::OnSelectSymbol(), SCH_EDIT_FRAME::OnSelectUnit(), DIALOG_SPICE_MODEL::onSemiSelectLib(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnTestChipName(), FOOTPRINT_EDIT_FRAME::OnUpdateSelectCurrentLib(), LIB_EDIT_FRAME::OnViewEntryDoc(), LIB_VIEW_FRAME::onViewSymbolDocument(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::PasteListOfItems(), PCB_EDITOR_CONTROL::PlaceModule(), SCH_EDIT_FRAME::prepareForNetlist(), SCH_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Config(), SCH_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::ProcessCmpToFootprintLinkFile(), FP_LOADER_THREAD::ProcessEntry(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), CVPCB_MAINFRAME::ReadNetListAndLinkFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), LIB_VIEW_FRAME::ReCreateHToolbar(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), LIB_VIEW_FRAME::ReCreateListCmp(), LIB_VIEW_FRAME::ReCreateListLib(), LIB_VIEW_FRAME::RedrawActiveWindow(), EDA_3D_VIEWER::ReloadRequest(), SCH_EDIT_FRAME::RescueProject(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), SCH_SCREEN::Save(), LIB_EDIT_FRAME::SaveActiveLibrary(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), LIB_EDIT_FRAME::SaveOneSymbol(), CVPCB_MAINFRAME::SaveProjectFile(), SCH_EDIT_FRAME::SaveProjectSettings(), PCB_EDIT_FRAME::SaveProjectSettings(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), SCH_BASE_FRAME::SelectComponentFromLibrary(), FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint(), PCB_BASE_FRAME::SelectLibrary(), SCH_BASE_FRAME::SelectLibraryFromList(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), LIB_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), LIB_EDIT_FRAME::SetCurPart(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), EDA_3D_VIEWER::takeScreenshot(), DIALOG_ERC::TestErc(), DIALOG_SPICE_MODEL::updateFromFile(), SIM_PLOT_FRAME::updateNetlistExporter(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), CVPCB_MAINFRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::updateTitle(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_MODULE_BOARD_EDITOR::~DIALOG_MODULE_BOARD_EDITOR(), and DIALOG_MODULE_MODULE_EDITOR::~DIALOG_MODULE_MODULE_EDITOR().

35 {
36  return Kiway().Prj();
37 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
VTBL_ENTRY PROJECT & Prj() const
Function Prj returns the PROJECT associated with this KIWAY.
Definition: kiway.cpp:144
FP_TBL_MODEL* DIALOG_FP_LIB_TABLE::project_model ( ) const
inlineprivate

Definition at line 817 of file dialog_fp_lib_table.cpp.

References DIALOG_FP_LIB_TABLE_BASE::m_project_grid.

Referenced by onOKButtonClick(), populateEnvironReadOnlyTable(), and verifyTables().

817 { return (FP_TBL_MODEL*) m_project_grid->GetTable(); }
Class FP_TBL_MODEL mixes in FP_LIB_TABLE into wxGridTableBase so the result can be used as a table wi...
void KIWAY_HOLDER::SetKiway ( wxWindow *  aDest,
KIWAY aKiway 
)
inherited

Function SetKiway.

Parameters
aDestis the recipient of aKiway pointer. It is only used for debugging, since "this" is not a wxWindow*. "this" is a KIWAY_HOLDER mix-in.
aKiwayis often from a parent window, or from KIFACE::CreateWindow().

Definition at line 41 of file kiway_holder.cpp.

References KIWAY_HOLDER::m_kiway.

Referenced by DIALOG_SHIM::DIALOG_SHIM(), and SIM_PLOT_FRAME::SIM_PLOT_FRAME().

42 {
43 #if defined(DEBUG)
44  // offer a trap point for debugging most any window
45  wxASSERT( aDest );
46  if( !strcmp( typeid(aDest).name(), "DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB" ) )
47  {
48  int breakhere=1;
49  (void) breakhere;
50  }
51 #endif
52 
53  (void) aDest;
54 
55  m_kiway = aKiway;
56 }
KIWAY * m_kiway
Definition: kiway_player.h:85
bool DIALOG_SHIM::Show ( bool  show)
overrideinherited

Definition at line 138 of file dialog_shim.cpp.

References class_map, DIALOG_SHIM::FixOSXCancelButtonIssue(), EDA_RECT::GetPosition(), EDA_RECT::GetSize(), DIALOG_SHIM::m_hash_key, wxPoint::x, and wxPoint::y.

Referenced by DisplayHotkeyList(), DIALOG_SHIM::EndQuasiModal(), InvokeDialogERC(), DIALOG_SCH_FIND::OnCancel(), DIALOG_DRC_CONTROL::OnLeftDClickClearance(), DIALOG_DRC_CONTROL::OnLeftDClickUnconnected(), DIALOG_DRC_CONTROL::OnPopupMenu(), DIALOG_EXCHANGE_MODULE::OnQuit(), CVPCB_MAINFRAME::ReadNetListAndLinkFiles(), DRC::ShowDRCDialog(), and DIALOG_SHIM::ShowQuasiModal().

139 {
140  bool ret;
141  const char* hash_key;
142 
143  if( m_hash_key.size() )
144  {
145  // a special case like EDA_LIST_DIALOG, which has multiple uses.
146  hash_key = m_hash_key.c_str();
147  }
148  else
149  {
150  hash_key = typeid(*this).name();
151  }
152 
153  // Show or hide the window. If hiding, save current position and size.
154  // If showing, use previous position and size.
155  if( show )
156  {
157  wxDialog::Raise(); // Needed on OS X and some other window managers (i.e. Unity)
158  ret = wxDialog::Show( show );
159 
160  // classname is key, returns a zeroed out default EDA_RECT if none existed before.
161  EDA_RECT r = class_map[ hash_key ];
162 
163  if( r.GetSize().x != 0 && r.GetSize().y != 0 )
164  SetSize( r.GetPosition().x, r.GetPosition().y, r.GetSize().x, r.GetSize().y, 0 );
165  }
166  else
167  {
168  // Save the dialog's position & size before hiding, using classname as key
169  EDA_RECT r( wxDialog::GetPosition(), wxDialog::GetSize() );
170  class_map[ hash_key ] = r;
171 
172  ret = wxDialog::Show( show );
173  }
174 
176 
177  return ret;
178 }
std::string m_hash_key
Definition: dialog_shim.h:128
void FixOSXCancelButtonIssue()
A ugly hack to fix an issue on OSX: when typing ctrl+c in a wxTextCtrl inside a dialog, it is closed instead of copying a text if a button with wxID_CANCEL is used in a wxStdDialogButtonSizer, when the dlg is created by wxFormBuilder: the label is &Cancel, and this accelerator key has priority to copy text standard accelerator, and the dlg is closed when trying to copy text this function do nothing on other platforms.
static RECT_MAP class_map
const wxPoint & GetPosition() const
Class EDA_RECT handles the component boundary box.
const wxSize & GetSize() const
int DIALOG_SHIM::ShowQuasiModal ( )
inherited

Definition at line 494 of file dialog_shim.cpp.

References DBG, DIALOG_SHIM::m_qmodal_loop, DIALOG_SHIM::m_qmodal_parent_disabler, DIALOG_SHIM::m_qmodal_showing, and DIALOG_SHIM::Show().

Referenced by LIB_EDIT_FRAME::DeleteOnePart(), SCH_EDIT_FRAME::EditComponent(), SCH_EDIT_FRAME::EditComponentFieldText(), LIB_EDIT_FRAME::EditField(), EDIT_TOOL::ExchangeFootprints(), PCB_EDIT_FRAME::InstallExchangeModuleFrame(), LIB_EDIT_FRAME::InstallFieldsEditorDialog(), LIB_VIEW_FRAME::OnSelectSymbol(), and SCH_BASE_FRAME::SelectComponentFromLibrary().

495 {
496  // This is an exception safe way to zero a pointer before returning.
497  // Yes, even though DismissModal() clears this first normally, this is
498  // here in case there's an exception before the dialog is dismissed.
499  struct NULLER
500  {
501  void*& m_what;
502  NULLER( void*& aPtr ) : m_what( aPtr ) {}
503  ~NULLER() { m_what = 0; } // indeed, set it to NULL on destruction
504  } clear_this( (void*&) m_qmodal_loop );
505 
506  // release the mouse if it's currently captured as the window having it
507  // will be disabled when this dialog is shown -- but will still keep the
508  // capture making it impossible to do anything in the modal dialog itself
509  wxWindow* win = wxWindow::GetCapture();
510  if( win )
511  win->ReleaseMouse();
512 
513  // Get the optimal parent
514  wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() );
515 
516  // Show the optimal parent
517  DBG( if( parent ) printf( "%s: optimal parent: %s\n", __func__, typeid(*parent).name() );)
518 
519  wxASSERT_MSG( !m_qmodal_parent_disabler,
520  wxT( "Caller using ShowQuasiModal() twice on same window?" ) );
521 
522  // quasi-modal: disable only my "optimal" parent
524 
525  Show( true );
526 
527  m_qmodal_showing = true;
528 
529  EVENT_LOOP event_loop;
530 
531  m_qmodal_loop = &event_loop;
532 
533  event_loop.Run();
534 
535  return GetReturnCode();
536 }
bool m_qmodal_showing
Definition: dialog_shim.h:132
EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:131
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:133
Toggle a window's "enable" status to disabled, then enabled on destruction.
Definition: dialog_shim.cpp:33
#define DBG(x)
Definition: fctsys.h:33
bool DIALOG_FP_LIB_TABLE::verifyTables ( )
inlineprivate

Function verifyTables trims important fields, removes blank row entries, and checks for duplicates.

Returns
bool - true if tables are OK, else false.

Definition at line 411 of file dialog_fp_lib_table.cpp.

References COL_NICKNAME, COL_URI, cur_model(), FP_TBL_MODEL::DeleteRows(), Format(), GetChars(), FP_TBL_MODEL::GetNumberRows(), FP_TBL_MODEL::GetValue(), global_model(), DIALOG_FP_LIB_TABLE_BASE::m_auinotebook, m_cur_grid, project_model(), and FP_TBL_MODEL::SetValue().

Referenced by onOKButtonClick().

412  {
413  for( int t=0; t<2; ++t )
414  {
415  FP_TBL_MODEL& model = t==0 ? *global_model() : *project_model();
416 
417  for( int r = 0; r < model.GetNumberRows(); )
418  {
419  wxString nick = model.GetValue( r, COL_NICKNAME ).Trim( false ).Trim();
420  wxString uri = model.GetValue( r, COL_URI ).Trim( false ).Trim();
421 
422  if( !nick || !uri )
423  {
424  // Delete the "empty" row, where empty means missing nick or uri.
425  // This also updates the UI which could be slow, but there should only be a few
426  // rows to delete, unless the user fell asleep on the Add Row
427  // button.
428  model.DeleteRows( r, 1 );
429  }
430  else if( nick.find(':') != size_t(-1) )
431  {
432  wxString msg = wxString::Format(
433  _( "Illegal character '%s' found in Nickname: '%s' in row %d" ),
434  ":", GetChars( nick ), r );
435 
436  // show the tabbed panel holding the grid we have flunked:
437  if( &model != cur_model() )
438  {
439  m_auinotebook->SetSelection( &model == global_model() ? 0 : 1 );
440  }
441 
442  // go to the problematic row
443  m_cur_grid->SetGridCursor( r, 0 );
444  m_cur_grid->SelectBlock( r, 0, r, 0 );
445  m_cur_grid->MakeCellVisible( r, 0 );
446 
447  wxMessageDialog errdlg( this, msg, _( "No Colon in Nicknames" ) );
448  errdlg.ShowModal();
449  return false;
450  }
451  else
452  {
453  // set the trimmed values back into the table so they get saved to disk.
454  model.SetValue( r, COL_NICKNAME, nick );
455  model.SetValue( r, COL_URI, uri );
456  ++r; // this row was OK.
457  }
458  }
459  }
460 
461  // check for duplicate nickNames, separately in each table.
462  for( int t=0; t<2; ++t )
463  {
464  FP_TBL_MODEL& model = t==0 ? *global_model() : *project_model();
465 
466  for( int r1 = 0; r1 < model.GetNumberRows() - 1; ++r1 )
467  {
468  wxString nick1 = model.GetValue( r1, COL_NICKNAME );
469 
470  for( int r2=r1+1; r2 < model.GetNumberRows(); ++r2 )
471  {
472  wxString nick2 = model.GetValue( r2, COL_NICKNAME );
473 
474  if( nick1 == nick2 )
475  {
476  wxString msg = wxString::Format(
477  _( "Duplicate Nickname: '%s' in rows %d and %d" ),
478  GetChars( nick1 ), r1+1, r2+1
479  );
480 
481  // show the tabbed panel holding the grid we have flunked:
482  if( &model != cur_model() )
483  {
484  m_auinotebook->SetSelection( &model == global_model() ? 0 : 1 );
485  }
486 
487  // go to the lower of the two rows, it is technically the duplicate:
488  m_cur_grid->SetGridCursor( r2, 0 );
489  m_cur_grid->SelectBlock( r2, 0, r2, 0 );
490  m_cur_grid->MakeCellVisible( r2, 0 );
491 
492  wxMessageDialog errdlg( this, msg, _( "Please Delete or Modify One" ) );
493  errdlg.ShowModal();
494  return false;
495  }
496  }
497  }
498  }
499 
500  return true;
501  }
FP_TBL_MODEL * global_model() const
void SetValue(int aRow, int aCol, const wxString &aValue) override
Class FP_TBL_MODEL mixes in FP_LIB_TABLE into wxGridTableBase so the result can be used as a table wi...
FP_TBL_MODEL * project_model() const
FP_TBL_MODEL * cur_model() const
int GetNumberRows() override
bool DeleteRows(size_t aPos, size_t aNumRows) override
wxString GetValue(int aRow, int aCol) override
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
wxGrid * m_cur_grid
changed based on tab choice

Member Data Documentation

wxButton* DIALOG_FP_LIB_TABLE_BASE::m_append_button
protectedinherited
wxButton* DIALOG_FP_LIB_TABLE_BASE::m_buttonWizard
protectedinherited
wxButton* DIALOG_FP_LIB_TABLE_BASE::m_delete_button
protectedinherited
wxButton* DIALOG_FP_LIB_TABLE_BASE::m_edit_options
protectedinherited
wxStaticText* DIALOG_FP_LIB_TABLE_BASE::m_GblTableFilename
protectedinherited
FP_LIB_TABLE* DIALOG_FP_LIB_TABLE::m_global
private

Definition at line 813 of file dialog_fp_lib_table.cpp.

Referenced by onOKButtonClick().

wxGrid* DIALOG_FP_LIB_TABLE_BASE::m_global_grid
protectedinherited
wxPanel* DIALOG_FP_LIB_TABLE_BASE::m_global_panel
protectedinherited
std::string DIALOG_SHIM::m_hash_key
protectedinherited
wxButton* DIALOG_FP_LIB_TABLE_BASE::m_move_down_button
protectedinherited
wxButton* DIALOG_FP_LIB_TABLE_BASE::m_move_up_button
protectedinherited
int DIALOG_FP_LIB_TABLE::m_pageNdx = 0
staticprivate

Remember the last notebook page selected during a session.

Definition at line 821 of file dialog_fp_lib_table.cpp.

Referenced by DIALOG_FP_LIB_TABLE(), and pageChangedHandler().

wxGrid* DIALOG_FP_LIB_TABLE_BASE::m_path_subs_grid
protectedinherited
wxStaticText* DIALOG_FP_LIB_TABLE_BASE::m_PrjTableFilename
protectedinherited
FP_LIB_TABLE* DIALOG_FP_LIB_TABLE::m_project
private

Definition at line 814 of file dialog_fp_lib_table.cpp.

Referenced by onOKButtonClick().

wxGrid* DIALOG_FP_LIB_TABLE_BASE::m_project_grid
protectedinherited
wxPanel* DIALOG_FP_LIB_TABLE_BASE::m_project_panel
protectedinherited
EVENT_LOOP* DIALOG_SHIM::m_qmodal_loop
protectedinherited

Definition at line 131 of file dialog_shim.h.

Referenced by DIALOG_SHIM::EndQuasiModal(), and DIALOG_SHIM::ShowQuasiModal().

WDO_ENABLE_DISABLE* DIALOG_SHIM::m_qmodal_parent_disabler
protectedinherited
bool DIALOG_SHIM::m_qmodal_showing
protectedinherited
wxStdDialogButtonSizer* DIALOG_FP_LIB_TABLE_BASE::m_sdbSizer
protectedinherited
wxButton* DIALOG_FP_LIB_TABLE_BASE::m_sdbSizerCancel
protectedinherited
wxButton* DIALOG_FP_LIB_TABLE_BASE::m_sdbSizerOK
protectedinherited
wxStaticText* DIALOG_FP_LIB_TABLE_BASE::m_staticText3
protectedinherited
wxStaticText* DIALOG_FP_LIB_TABLE_BASE::m_staticText4
protectedinherited

The documentation for this class was generated from the following file: