KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_lib_footprint_fields_table.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
22
23#include <algorithm>
24#include <set>
25
26#include <confirm.h>
27#include <eda_doc.h>
29#include <footprint.h>
31#include <grid_tricks.h>
32#include <kiface_base.h>
33#include <pgm_base.h>
34#include <project.h>
35#include <project_pcb.h>
39#include <template_fieldnames.h>
40#include <trace_helpers.h>
43#include <wx/menu.h>
44#include <wx/msgdlg.h>
45
47
48
49static GRID_CELL_URL_EDITOR_CONTEXT getDatasheetContext( const std::vector<FOOTPRINT_REF>& aFootprints )
50{
51 std::vector<EMBEDDED_FILES*> embedTargets;
52 std::vector<EMBEDDED_FILES*> inheritedFiles;
53
54 for( FOOTPRINT_REF footprint : aFootprints )
55 {
56 embedTargets.push_back( footprint.GetFootprint().GetEmbeddedFiles() );
57 }
58
59 return MakeGridCellUrlEditorContext( embedTargets, inheritedFiles );
60}
61
62
63enum
64{
68};
69
70
72{
73public:
75 VIEW_CONTROLS_GRID_DATA_MODEL* aViewFieldsData,
77 FIELDS_TABLE_GRID_TRICKS( aParent, aGrid, aDataModel ),
78 m_dlg( aParent ),
79 m_viewControlsDataModel( aViewFieldsData ),
80 m_dataModel( aDataModel )
81 {}
82
83protected:
84 bool toggleCell( int aRow, int aCol, bool aPreserveSelection = false ) override
85 {
86 if( !m_grid->IsEditable() || m_dataModel->IsCellReadOnly( aRow, aCol ) )
87 return false;
88
89 return GRID_TRICKS::toggleCell( aRow, aCol, aPreserveSelection );
90 }
91
92 void showFieldsTablePopupMenu( wxMenu& aMenu, wxGridEvent& aEvent ) override
93 {
94 int row = m_grid->GetGridCursorRow();
95 int col = m_grid->GetGridCursorCol();
96
97 if( row >= 0 && col >= 0 )
98 {
99 if( m_dataModel->GetColFieldName( col ) == GetDefaultFieldName( FIELD_T::DATASHEET, UNTRANSLATED ) )
100 {
101 aMenu.Append( MYID_SHOW_DATASHEET, _( "Show Datasheet" ), _( "Show datasheet in browser" ) );
102 aMenu.AppendSeparator();
103 }
104 }
105
106 GRID_TRICKS::showPopupMenu( aMenu, aEvent );
107 }
108
109 void doFieldsTablePopupSelection( wxCommandEvent& aEvent ) override
110 {
111 int row = m_grid->GetGridCursorRow();
112 int col = m_grid->GetGridCursorCol();
113
114 if( aEvent.GetId() == MYID_SHOW_DATASHEET )
115 {
116 wxString datasheetUri = m_grid->GetCellValue( row, col );
117 GetAssociatedDocument( m_dlg, datasheetUri, &m_dlg->Prj(), nullptr, { } );
118 }
119 else if( aEvent.GetId() >= GRIDTRICKS_FIRST_SHOWHIDE )
120 {
121 if( !m_grid->CommitPendingChanges( false ) )
122 return;
123
124 // Pop-up column order is the order of the shown fields, not the viewControls order
125 col = aEvent.GetId() - GRIDTRICKS_FIRST_SHOWHIDE;
126
127 bool show = !m_dataModel->GetShowColumn( col );
128
129 m_dlg->ShowHideColumn( col, show );
130
131 wxString fieldName = m_dataModel->GetColFieldName( col );
132
133 for( row = 0; row < m_viewControlsDataModel->GetNumberRows(); row++ )
134 {
135 if( m_viewControlsDataModel->GetUntranslatedFieldName( row ) == fieldName )
136 m_viewControlsDataModel->SetValueAsBool( row, SHOW_FIELD_COLUMN, show );
137 }
138
139 if( m_viewControlsDataModel->GetView() )
140 m_viewControlsDataModel->GetView()->ForceRefresh();
141 }
142 else
143 {
145 }
146 }
147
148private:
152};
153
154
156 DIALOG_FIELDS_TABLE( aParent, aParent->GetSettings()->m_LibFieldEditor,
157 aParent->GetSettings()->m_LibFieldEditorBom, nullptr ),
158 m_parent( aParent )
159{
161
162 const wxString& libName = m_parent->GetTargetFPID().GetLibNickname();
163 const bool readOnly = !PROJECT_PCB::FootprintLibAdapter( &Prj() )->IsFootprintLibWritable( libName );
164
166 m_dataModel->SetScope( aScope );
167
168 m_grid->UseNativeColHeader( true );
169 m_grid->SetTable( m_dataModel, true );
170
171 // The field-list grid regroups its rows, so the dialog's position-based Ctrl+Z would shift
172 // values onto the wrong field.
174
175 // must be done after SetTable(), which appears to re-set it
176 m_grid->SetSelectionMode( wxGrid::wxGridSelectCells );
177
178 // add Cut, Copy, and Paste to wxGrid
179 m_grid->PushEventHandler(
181
183 m_variantsPanel->Hide();
184
185 // Footprint libraries don't have a concept of related or derived footprints like symbols do.
186 m_scope->Clear();
187 m_scope->Append( _( "Whole Library" ) );
188 m_scope->SetSelection( static_cast<int>( m_dataModel->GetScope() ) );
189 m_filterScope->SetString( static_cast<int>( BOM_FILTER_SCOPE::REFERENCE ), _( "Footprint Names" ) );
190
191 wxString title = wxString::Format( _( "Footprint Fields Table ('%s' Library)" ), libName );
192
193 if( readOnly )
194 title += wxS( " " ) + _( "[Read Only]" );
195
196 SetTitle( title );
197 m_buttonApply->SetLabel( _( "Save" ) );
198
200 m_grid->ClearSelection();
201
203 SetReadOnly( readOnly );
204
206
207 SetSize( GetDefaultDialogSize() );
208
210
212
213 m_outputFileName->SetValue( m_cfgBomSettings.m_BomExportFileName );
214
215 Center();
216
217 // Connect Events
218 m_grid->Bind( wxEVT_GRID_COL_SORT, &DIALOG_LIB_FOOTPRINT_FIELDS_TABLE::OnColSort, this );
219 m_grid->Bind( wxEVT_GRID_COL_MOVE, &DIALOG_LIB_FOOTPRINT_FIELDS_TABLE::OnColMove, this );
220 m_grid->GetGridWindow()->Bind( wxEVT_MOTION, &DIALOG_LIB_FOOTPRINT_FIELDS_TABLE::OnGridMouseMove, this );
223}
224
225
227{
228 m_footprintsList.clear();
229 m_loadedFootprints.clear();
230
232 wxString libName = m_parent->GetTargetFPID().GetLibNickname();
233 std::vector<wxString> footprintNames = libMgr->GetFootprintNames( libName );
234
235 if( footprintNames.empty() )
236 {
237 wxMessageBox( wxString::Format( _( "No footprints found in library '%s'." ), libName ) );
238 return;
239 }
240
241 // Saving replaces the library manager's cached footprint object, so keep independent copies
242 // whose addresses remain stable for the lifetime of the data model.
243 for( const wxString& footprintName : footprintNames )
244 {
245 try
246 {
247 // LoadFootprint returns a caller-owned clone.
248 std::unique_ptr<FOOTPRINT> footprint( libMgr->LoadFootprint( libName, footprintName, true ) );
249
250 if( footprint )
251 {
252 m_loadedFootprints.push_back( std::move( footprint ) );
253 m_footprintsList.emplace_back( *m_loadedFootprints.back() );
254 }
255 }
256 catch( const IO_ERROR& ioe )
257 {
258 wxLogWarning( wxString::Format( _( "Error loading footprint '%s': %s" ), footprintName, ioe.What() ) );
259 }
260 }
261
262 if( m_footprintsList.empty() )
263 wxMessageBox( _( "No footprints could be loaded from the library." ) );
264}
265
266
268{
269 savePresets( true );
272
273 // Disconnect Events
274 m_grid->GetGridWindow()->Unbind( wxEVT_MOTION, &DIALOG_LIB_FOOTPRINT_FIELDS_TABLE::OnGridMouseMove, this );
275 m_grid->Unbind( wxEVT_GRID_COL_SORT, &DIALOG_LIB_FOOTPRINT_FIELDS_TABLE::OnColSort, this );
276 m_grid->Unbind( wxEVT_GRID_COL_MOVE, &DIALOG_LIB_FOOTPRINT_FIELDS_TABLE::OnColMove, this );
279
280 // Delete the GRID_TRICKS.
281 m_grid->PopEventHandler( true );
282
283 // we gave ownership of m_viewControlsDataModel & m_dataModel to the wxGrids...
284}
285
286
288{
289 return new GRID_CELL_URL_EDITOR(
290 this, nullptr,
291 [this]( int aRow )
292 {
293 return getDatasheetContext( m_dataModel->GetRowReferences( aRow ) );
294 } );
295}
296
297
299{
300 if( !wxDialog::TransferDataToWindow() )
301 return false;
302
303 LoadFieldNames(); // loads rows into m_viewControlsDataModel and columns into m_dataModel
304
305 m_scope->SetSelection( static_cast<int>( m_dataModel->GetScope() ) );
306
307 // Load our BOM view presets
308 SetUserBomPresets( m_cfgBomSettings.m_BomPresets );
309
310 BOM_PRESET preset = m_cfgBomSettings.m_BomSettings;
311
312 ApplyBomPreset( preset );
314
315 // Load BOM export format presets
316 SetUserBomFmtPresets( m_cfgBomSettings.m_BomFmtPresets );
317 ApplyBomFmtPreset( m_cfgBomSettings.m_BomFmtSettings );
319
320 m_outputFileName->SetValue( m_cfgBomSettings.m_BomExportFileName );
321
322 m_dataModel->SetGroupingEnabled( m_groupSymbolsBox->GetValue() );
323
324 setScope( static_cast<SCOPE>( m_scope->GetSelection() ) );
325
326 return true;
327}
328
329
331{
332 if( !m_grid->CommitPendingChanges() )
333 return false;
334
335 if( !wxDialog::TransferDataFromWindow() )
336 return false;
337
338 std::set<KIID_PATH> savedSelection = SaveGridSelection();
339 bool libraryChanged = false;
340
341 bool allChangesApplied = m_dataModel->ApplyData(
342 [&]( FOOTPRINT& aFootprint )
343 {
344 bool saved =
345 m_parent->SaveFootprintInLibrary( &aFootprint, aFootprint.GetFPID().GetUniStringLibNickname() );
346
347 libraryChanged |= saved;
348
349 if( saved )
350 m_parent->RefreshLibraryFootprintTab( aFootprint );
351
352 return saved;
353 } );
354
355 m_dataModel->RebuildRows();
356 RestoreGridSelection( savedSelection );
357
358 if( libraryChanged )
359 m_parent->SyncLibraryTree( true );
360
361 if( !allChangesApplied )
362 return false;
363
364 ClearModify();
365 return true;
366}
367
368
370{
371 auto addMandatoryField =
372 [&]( FIELD_T aFieldId, bool aShow, bool aGroupBy )
373 {
374 m_mandatoryFieldListIndexes[aFieldId] = m_viewControlsDataModel->GetNumberRows();
375
377 aShow, aGroupBy );
378 };
379
380 AddField( wxS( "${FOOTPRINT_NAME}" ), _( "Footprint Name" ), true, false );
381
382 // Add mandatory fields first show groupBy
383 addMandatoryField( FIELD_T::REFERENCE, false, false );
384 addMandatoryField( FIELD_T::VALUE, true, false );
385 addMandatoryField( FIELD_T::FOOTPRINT, true, false );
386 addMandatoryField( FIELD_T::DATASHEET, true, false );
387 addMandatoryField( FIELD_T::DESCRIPTION, false, false );
388
389 // Generated fields present only in the fields table
391 AddField( wxS( "${EXCLUDE_FROM_BOM}" ), _( "Exclude From BOM" ), true, false );
392 AddField( wxS( "${EXCLUDE_FROM_SIM}" ), _( "Exclude From Simulation" ), true, false );
393 AddField( wxS( "${EXCLUDE_FROM_BOARD}" ), _( "Exclude From Board" ), true, false );
394 AddField( wxS( "${EXCLUDE_FROM_POS_FILES}" ), _( "Exclude From Position Files" ), true, false );
395
396 // User field names are stored and matched case-sensitively (see issue #24021), so each
397 // distinct name gets its own column rather than collapsing case variants together.
398 std::set<wxString> userFieldNames;
399
401 {
402 for( PCB_FIELD* field : ref.GetFootprint().GetFields() )
403 {
404 if( !field->IsMandatory() && !field->IsPrivate() )
405 userFieldNames.insert( field->GetName() );
406 }
407 }
408
409 for( const wxString& fieldName : userFieldNames )
410 AddField( fieldName, GetGeneratedFieldDisplayName( fieldName ), true, false );
411
412 // Add any global template field names which aren't already present.
413 for( const TEMPLATE_FIELDNAME& templateField :
414 Pgm().GetCommonSettings()->m_FieldNameTemplates.GetTemplateFieldNames( TEMPLATES::SCOPE::GLOBAL ) )
415 {
416 if( userFieldNames.count( templateField.m_Name ) == 0 )
417 AddField( templateField.m_Name, GetGeneratedFieldDisplayName( templateField.m_Name ), false, false );
418 }
419}
420
421
423{
424 m_dataModel->SetScope( aScope );
425 m_dataModel->RebuildRows();
426}
427
428
429void DIALOG_LIB_FOOTPRINT_FIELDS_TABLE::OnScope( wxCommandEvent& aEvent )
430{
431 switch( aEvent.GetSelection() )
432 {
433 case 0: setScope( SCOPE::SCOPE_ALL ); break;
434 }
435}
436
437
438void DIALOG_LIB_FOOTPRINT_FIELDS_TABLE::OnMenu( wxCommandEvent& aEvent )
439{
440 // Build a pop menu:
441 wxMenu menu;
442
443 menu.Append( MYID_INCLUDE_DNP, _( "Include 'DNP' Footprints" ),
444 _( "Show footprints marked 'DNP' in the table. This setting also controls whether or not 'DNP' "
445 "footprints are included on export." ),
446 wxITEM_CHECK );
447 menu.Check( MYID_INCLUDE_DNP, !m_dataModel->GetExcludeDNP() );
448
449 menu.Append( MYID_INCLUDE_EXCLUDED_FROM_BOM, _( "Include 'Exclude from BOM' Footprints" ),
450 _( "Show footprints marked 'Exclude from BOM' in the table. Footprints marked 'Exclude from BOM' "
451 "are never included on export." ),
452 wxITEM_CHECK );
453 menu.Check( MYID_INCLUDE_EXCLUDED_FROM_BOM, m_dataModel->GetIncludeExcludedFromBOM() );
454
455 // menuId is the selected submenu id from the popup menu or wxID_NONE
456 int menuId = m_bMenu->GetPopupMenuSelectionFromUser( menu );
457
458 if( menuId == 0 || menuId == MYID_INCLUDE_DNP )
459 {
460 m_dataModel->SetExcludeDNP( !m_dataModel->GetExcludeDNP() );
461 m_dataModel->RebuildRows();
462 m_grid->ForceRefresh();
463
465 }
466 else if( menuId == 1 || menuId == MYID_INCLUDE_EXCLUDED_FROM_BOM )
467 {
468 m_dataModel->SetIncludeExcludedFromBOM( !m_dataModel->GetIncludeExcludedFromBOM() );
469 m_dataModel->RebuildRows();
470 m_grid->ForceRefresh();
471
473 }
474}
475
476
478{
480 {
481 m_cfgBomSettings.m_BomExportFileName = m_outputFileName->GetValue();
482 ClearModify();
483 }
484}
485
486
488{
489 m_grid->CommitPendingChanges( true );
490
491 if( m_dataModel->IsEdited() )
492 {
493 if( !HandleUnsavedChanges( this, _( "Save changes?" ),
494 [&]() -> bool
495 {
496 return TransferDataFromWindow();
497 } ) )
498 {
499 return;
500 }
501 }
502
503 EndModal( wxID_CANCEL );
504}
505
506
507void DIALOG_LIB_FOOTPRINT_FIELDS_TABLE::OnOk( wxCommandEvent& aEvent )
508{
510 return;
511
512 m_cfgBomSettings.m_BomExportFileName = m_outputFileName->GetValue();
513 EndModal( wxID_OK );
514}
515
516
518{
519 m_grid->CommitPendingChanges( true );
520
521 if( m_dataModel->IsEdited() && aEvent.CanVeto() )
522 {
523 if( !HandleUnsavedChanges( this, _( "Save changes?" ),
524 [&]() -> bool
525 {
526 return TransferDataFromWindow();
527 } ) )
528 {
529 aEvent.Veto();
530 return;
531 }
532 }
533
534 aEvent.Skip();
535}
536
537
539{
540 std::vector<BOM_PRESET> presets = BOM_PRESET::BuiltInPresets();
541
542 for( BOM_PRESET& preset : presets )
543 {
544 if( preset.sortField == GetDefaultFieldName( FIELD_T::REFERENCE, TRANSLATED ) )
546
547 for( BOM_FIELD& field : preset.fieldsOrdered )
548 {
550 {
552 field.label = wxS( "Footprint Name" );
553 field.groupBy = false;
554 }
555 }
556
557 if( preset.name == BOM_PRESET::DefaultEditing().name )
558 {
559 preset.groupSymbols = false;
560 preset.fieldsOrdered = {
561 { LIB_FOOTPRINT_FIELDS_EDITOR_GRID_DATA_MODEL::FOOTPRINT_NAME, wxS( "Footprint Name" ), true, false },
562 { GetDefaultFieldName( FIELD_T::REFERENCE, UNTRANSLATED ), wxS( "Reference" ), false, false },
563 { GetDefaultFieldName( FIELD_T::VALUE, UNTRANSLATED ), wxS( "Value" ), true, false },
564 { GetDefaultFieldName( FIELD_T::FOOTPRINT, UNTRANSLATED ), wxS( "Footprint" ), true, false },
565 { GetDefaultFieldName( FIELD_T::DATASHEET, UNTRANSLATED ), wxS( "Datasheet" ), true, false },
566 { GetDefaultFieldName( FIELD_T::DESCRIPTION, UNTRANSLATED ), wxS( "Description" ), false, false },
567 { LIB_FOOTPRINT_FIELDS_EDITOR_GRID_DATA_MODEL::FOOTPRINT_KEYWORDS, wxS( "Keywords" ), true, false },
568 { wxS( "${EXCLUDE_FROM_BOM}" ), wxS( "Exclude From BOM" ), true, false },
569 { wxS( "${EXCLUDE_FROM_SIM}" ), wxS( "Exclude From Simulation" ), true, false },
570 { wxS( "${EXCLUDE_FROM_BOARD}" ), wxS( "Exclude From Board" ), true, false },
571 { wxS( "${EXCLUDE_FROM_POS_FILES}" ), wxS( "Exclude From Position Files" ), true, false },
572 };
573 }
574 }
575
576 return presets;
577}
578
579
581{
582 return wxEmptyString;
583}
584
585
587{
588 return Prj().TextVarResolver( aToken );
589}
void SetUserBomFmtPresets(std::vector< BOM_FMT_PRESET > &aPresetList)
wxSize GetDefaultDialogSize() const
void OnColMove(wxGridEvent &aEvent)
void OnColSort(wxGridEvent &aEvent)
void OnGridMouseMove(wxMouseEvent &aEvent)
bool savePresets(bool aSaveCurrentSettings)
void RestoreGridSelection(const std::set< KIID_PATH > &aItemKeys)
Restore a selection previously returned by SaveGridSelection().
std::map< FIELD_T, int > m_mandatoryFieldListIndexes
void onBomFmtPresetChanged(wxCommandEvent &aEvent)
void SetUserBomPresets(std::vector< BOM_PRESET > &aPresetList)
void ApplyBomFmtPreset(const wxString &aPresetName)
DIALOG_FIELDS_TABLE(wxWindow *aParent, FIELDS_TABLE_SETTINGS &aPanelSettings, FIELDS_TABLE_BOM_SETTINGS &aBomSettings, JOB_EXPORT_BOM *aJob)
FIELDS_TABLE_BOM_SETTINGS & m_cfgBomSettings
void onBomPresetChanged(wxCommandEvent &aEvent)
void SetReadOnly(bool aReadOnly)
std::set< KIID_PATH > SaveGridSelection()
Save the grid selection by stable item identity so it can survive a row rebuild.
void ApplyBomPreset(const wxString &aPresetName)
VIEW_CONTROLS_GRID_DATA_MODEL * m_viewControlsDataModel
void AddField(const wxString &aFieldName, const wxString &aLabelValue, bool aShow, bool aGroupBy, bool aAddedByUser=false)
std::vector< std::unique_ptr< FOOTPRINT > > m_loadedFootprints
void OnSaveAndContinue(wxCommandEvent &aEvent) override
void LoadFieldNames()
Construct the rows of m_fieldsCtrl and the columns of m_dataModel from a union of all field names in ...
LIB_FOOTPRINT_FIELDS_EDITOR_GRID_DATA_MODEL * m_dataModel
void OnScope(wxCommandEvent &aEvent) override
std::vector< BOM_PRESET > getBuiltInBomPresets() const override
void OnCancel(wxCommandEvent &aEvent) override
void OnMenu(wxCommandEvent &aEvent) override
void setScope(FOOTPRINT_FIELDS_EDITOR_GRID_DATA_MODEL::SCOPE aScope)
bool resolveTextVar(wxString *aToken) const override
DIALOG_LIB_FOOTPRINT_FIELDS_TABLE(FOOTPRINT_EDIT_FRAME *aParent, FOOTPRINT_FIELDS_EDITOR_GRID_DATA_MODEL::SCOPE aScope)
void ExcludeFromControlUndoRedo(wxWindow *aWindow)
Opt a control out of the dialog's generic Ctrl+Z/Ctrl+Y undo/redo.
void OptOut(wxWindow *aWindow)
Opt out of control state saving.
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition dialog_shim.h:94
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
FIELDS_TABLE_GRID_TRICKS(DIALOG_FIELDS_TABLE *aDialog, WX_GRID *aGrid, FIELDS_TABLE_DATA_MODEL_BASE *aDataModel)
static constexpr int FIRST_CLIENT_ID
An interface to the global shared library manager that is schematic-specific and linked to one projec...
bool IsFootprintLibWritable(const wxString &aNickname)
Return true if the library given by aNickname is writable.
std::vector< wxString > GetFootprintNames(const wxString &aNickname, bool aBestEfforts=false)
Retrieves a list of footprint names contained in a given loaded library.
FOOTPRINT * LoadFootprint(const wxString &aNickname, const wxString &aName, bool aKeepUUID)
Load a FOOTPRINT having aName from the library given by aNickname.
This is the minimal equivalent to the SCH_REFERENCE so we can provide similar non-null guarantees thr...
const LIB_ID & GetFPID() const
Definition footprint.h:473
virtual void doPopupSelection(wxCommandEvent &event)
virtual void showPopupMenu(wxMenu &menu, wxGridEvent &aEvent)
WX_GRID * m_grid
I don't own the grid, but he owns me.
virtual bool toggleCell(int aRow, int aCol, bool aPreserveSelection=false)
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
virtual const wxString What() const
A composite of Problem() and Where()
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
LIB_FOOTPRINT_FIELDS_EDITOR_GRID_TRICKS(DIALOG_LIB_FOOTPRINT_FIELDS_TABLE *aParent, WX_GRID *aGrid, VIEW_CONTROLS_GRID_DATA_MODEL *aViewFieldsData, LIB_FOOTPRINT_FIELDS_EDITOR_GRID_DATA_MODEL *aDataModel)
void showFieldsTablePopupMenu(wxMenu &aMenu, wxGridEvent &aEvent) override
LIB_FOOTPRINT_FIELDS_EDITOR_GRID_DATA_MODEL * m_dataModel
bool toggleCell(int aRow, int aCol, bool aPreserveSelection=false) override
void doFieldsTablePopupSelection(wxCommandEvent &aEvent) override
const wxString GetUniStringLibNickname() const
Definition lib_id.h:84
static FOOTPRINT_LIBRARY_ADAPTER * FootprintLibAdapter(PROJECT *aProject)
virtual bool TextVarResolver(wxString *aToken) const
Definition project.cpp:81
wxString GetGeneratedFieldDisplayName(const wxString &aSource)
Returns any variables unexpanded, e.g.
Definition common.cpp:481
bool HandleUnsavedChanges(wxWindow *aParent, const wxString &aMessage, const std::function< bool()> &aSaveFunction)
Display a dialog with Save, Cancel and Discard Changes buttons.
Definition confirm.cpp:146
This file is part of the common library.
static GRID_CELL_URL_EDITOR_CONTEXT getDatasheetContext(const std::vector< LIB_SYMBOL * > &aSymbols)
LIB_FIELDS_EDITOR_GRID_DATA_MODEL::SCOPE SCOPE
@ MYID_INCLUDE_EXCLUDED_FROM_BOM
static GRID_CELL_URL_EDITOR_CONTEXT getDatasheetContext(const std::vector< FOOTPRINT_REF > &aFootprints)
#define _(s)
bool GetAssociatedDocument(wxWindow *aParent, const wxString &aDocName, PROJECT *aProject, SEARCH_STACK *aPaths, std::vector< EMBEDDED_FILES * > aFilesStack)
Open a document (file) with the suitable browser.
Definition eda_doc.cpp:59
This file is part of the common library.
GRID_CELL_URL_EDITOR_CONTEXT MakeGridCellUrlEditorContext(const std::vector< EMBEDDED_FILES * > &aEmbedTargets, const std::vector< EMBEDDED_FILES * > &aAdditionalLookupFiles)
@ GRIDTRICKS_FIRST_SHOWHIDE
Definition grid_tricks.h:47
PGM_BASE & Pgm()
The global program "get" accessor.
see class PGM_BASE
wxString label
wxString name
Hold a name of a symbol's field, field value, and default visibility.
wxString GetDefaultFieldName(FIELD_T aFieldId, TRANSLATION aTranslation)
Return a default symbol field name for a mandatory field type.
FIELD_T
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
@ DESCRIPTION
Field Description of part, i.e. "1/4W 1% Metal Film Resistor".
@ FOOTPRINT
Field Name Module PCB, i.e. "16DIP300".
@ DATASHEET
name of datasheet
@ REFERENCE
Field Reference of part, i.e. "IC21".
@ VALUE
Field Value of part, i.e. "3.3K".
@ UNTRANSLATED
@ TRANSLATED
wxLogTrace helper definitions.