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;
234
235 try
236 {
237 footprintNames = libMgr->GetFootprintNames( libName );
238 }
239 catch( const IO_ERROR& ioe )
240 {
241 wxMessageBox( wxString::Format( _( "Error loading footprints from library '%s': %s" ),
242 libName, ioe.What() ) );
243 return;
244 }
245
246 if( footprintNames.empty() )
247 {
248 wxMessageBox( wxString::Format( _( "No footprints found in library '%s'." ), libName ) );
249 return;
250 }
251
252 // Saving replaces the library manager's cached footprint object, so keep independent copies
253 // whose addresses remain stable for the lifetime of the data model.
254 for( const wxString& footprintName : footprintNames )
255 {
256 try
257 {
258 // LoadFootprint returns a caller-owned clone.
259 std::unique_ptr<FOOTPRINT> footprint( libMgr->LoadFootprint( libName, footprintName, true ) );
260
261 if( footprint )
262 {
263 m_loadedFootprints.push_back( std::move( footprint ) );
264 m_footprintsList.emplace_back( *m_loadedFootprints.back() );
265 }
266 }
267 catch( const IO_ERROR& ioe )
268 {
269 wxLogWarning( wxString::Format( _( "Error loading footprint '%s': %s" ), footprintName, ioe.What() ) );
270 }
271 }
272
273 if( m_footprintsList.empty() )
274 wxMessageBox( _( "No footprints could be loaded from the library." ) );
275}
276
277
279{
280 savePresets( true );
283
284 // Disconnect Events
285 m_grid->GetGridWindow()->Unbind( wxEVT_MOTION, &DIALOG_LIB_FOOTPRINT_FIELDS_TABLE::OnGridMouseMove, this );
286 m_grid->Unbind( wxEVT_GRID_COL_SORT, &DIALOG_LIB_FOOTPRINT_FIELDS_TABLE::OnColSort, this );
287 m_grid->Unbind( wxEVT_GRID_COL_MOVE, &DIALOG_LIB_FOOTPRINT_FIELDS_TABLE::OnColMove, this );
290
291 // Delete the GRID_TRICKS.
292 m_grid->PopEventHandler( true );
293
294 // we gave ownership of m_viewControlsDataModel & m_dataModel to the wxGrids...
295}
296
297
299{
300 return new GRID_CELL_URL_EDITOR(
301 this, nullptr,
302 [this]( int aRow )
303 {
304 return getDatasheetContext( m_dataModel->GetRowReferences( aRow ) );
305 } );
306}
307
308
310{
311 if( !wxDialog::TransferDataToWindow() )
312 return false;
313
314 LoadFieldNames(); // loads rows into m_viewControlsDataModel and columns into m_dataModel
315
316 m_scope->SetSelection( static_cast<int>( m_dataModel->GetScope() ) );
317
318 // Load our BOM view presets
319 SetUserBomPresets( m_cfgBomSettings.m_BomPresets );
320
321 BOM_PRESET preset = m_cfgBomSettings.m_BomSettings;
322
323 ApplyBomPreset( preset );
325
326 // Load BOM export format presets
327 SetUserBomFmtPresets( m_cfgBomSettings.m_BomFmtPresets );
328 ApplyBomFmtPreset( m_cfgBomSettings.m_BomFmtSettings );
330
331 m_outputFileName->SetValue( m_cfgBomSettings.m_BomExportFileName );
332
333 m_dataModel->SetGroupingEnabled( m_groupSymbolsBox->GetValue() );
334
335 setScope( static_cast<SCOPE>( m_scope->GetSelection() ) );
336
337 return true;
338}
339
340
342{
343 if( !m_grid->CommitPendingChanges() )
344 return false;
345
346 if( !wxDialog::TransferDataFromWindow() )
347 return false;
348
349 std::set<KIID_PATH> savedSelection = SaveGridSelection();
350 bool libraryChanged = false;
351
352 bool allChangesApplied = m_dataModel->ApplyData(
353 [&]( FOOTPRINT& aFootprint )
354 {
355 bool saved =
356 m_parent->SaveFootprintInLibrary( &aFootprint, aFootprint.GetFPID().GetUniStringLibNickname() );
357
358 libraryChanged |= saved;
359
360 if( saved )
361 m_parent->RefreshLibraryFootprintTab( aFootprint );
362
363 return saved;
364 } );
365
366 m_dataModel->RebuildRows();
367 RestoreGridSelection( savedSelection );
368
369 if( libraryChanged )
370 m_parent->SyncLibraryTree( true );
371
372 if( !allChangesApplied )
373 return false;
374
375 ClearModify();
376 return true;
377}
378
379
381{
382 auto addMandatoryField =
383 [&]( FIELD_T aFieldId, bool aShow, bool aGroupBy )
384 {
385 m_mandatoryFieldListIndexes[aFieldId] = m_viewControlsDataModel->GetNumberRows();
386
388 aShow, aGroupBy );
389 };
390
391 AddField( wxS( "${FOOTPRINT_NAME}" ), _( "Footprint Name" ), true, false );
392
393 // Add mandatory fields first show groupBy
394 addMandatoryField( FIELD_T::REFERENCE, false, false );
395 addMandatoryField( FIELD_T::VALUE, true, false );
396 addMandatoryField( FIELD_T::FOOTPRINT, true, false );
397 addMandatoryField( FIELD_T::DATASHEET, true, false );
398 addMandatoryField( FIELD_T::DESCRIPTION, false, false );
399
400 // Generated fields present only in the fields table
402 AddField( wxS( "${EXCLUDE_FROM_BOM}" ), _( "Exclude From BOM" ), true, false );
403 AddField( wxS( "${EXCLUDE_FROM_SIM}" ), _( "Exclude From Simulation" ), true, false );
404 AddField( wxS( "${EXCLUDE_FROM_BOARD}" ), _( "Exclude From Board" ), true, false );
405 AddField( wxS( "${EXCLUDE_FROM_POS_FILES}" ), _( "Exclude From Position Files" ), true, false );
406
407 // User field names are stored and matched case-sensitively (see issue #24021), so each
408 // distinct name gets its own column rather than collapsing case variants together.
409 std::set<wxString> userFieldNames;
410
412 {
413 for( PCB_FIELD* field : ref.GetFootprint().GetFields() )
414 {
415 if( !field->IsMandatory() && !field->IsPrivate() )
416 userFieldNames.insert( field->GetName() );
417 }
418 }
419
420 for( const wxString& fieldName : userFieldNames )
421 AddField( fieldName, GetGeneratedFieldDisplayName( fieldName ), true, false );
422
423 // Add any global template field names which aren't already present.
424 for( const TEMPLATE_FIELDNAME& templateField :
425 Pgm().GetCommonSettings()->m_FieldNameTemplates.GetTemplateFieldNames( TEMPLATES::SCOPE::GLOBAL ) )
426 {
427 if( userFieldNames.count( templateField.m_Name ) == 0 )
428 AddField( templateField.m_Name, GetGeneratedFieldDisplayName( templateField.m_Name ), false, false );
429 }
430}
431
432
434{
435 m_dataModel->SetScope( aScope );
436 m_dataModel->RebuildRows();
437}
438
439
440void DIALOG_LIB_FOOTPRINT_FIELDS_TABLE::OnScope( wxCommandEvent& aEvent )
441{
442 switch( aEvent.GetSelection() )
443 {
444 case 0: setScope( SCOPE::SCOPE_ALL ); break;
445 }
446}
447
448
449void DIALOG_LIB_FOOTPRINT_FIELDS_TABLE::OnMenu( wxCommandEvent& aEvent )
450{
451 // Build a pop menu:
452 wxMenu menu;
453
454 menu.Append( MYID_INCLUDE_DNP, _( "Include 'DNP' Footprints" ),
455 _( "Show footprints marked 'DNP' in the table. This setting also controls whether or not 'DNP' "
456 "footprints are included on export." ),
457 wxITEM_CHECK );
458 menu.Check( MYID_INCLUDE_DNP, !m_dataModel->GetExcludeDNP() );
459
460 menu.Append( MYID_INCLUDE_EXCLUDED_FROM_BOM, _( "Include 'Exclude from BOM' Footprints" ),
461 _( "Show footprints marked 'Exclude from BOM' in the table. Footprints marked 'Exclude from BOM' "
462 "are never included on export." ),
463 wxITEM_CHECK );
464 menu.Check( MYID_INCLUDE_EXCLUDED_FROM_BOM, m_dataModel->GetIncludeExcludedFromBOM() );
465
466 // menuId is the selected submenu id from the popup menu or wxID_NONE
467 int menuId = m_bMenu->GetPopupMenuSelectionFromUser( menu );
468
469 if( menuId == 0 || menuId == MYID_INCLUDE_DNP )
470 {
471 m_dataModel->SetExcludeDNP( !m_dataModel->GetExcludeDNP() );
472 m_dataModel->RebuildRows();
473 m_grid->ForceRefresh();
474
476 }
477 else if( menuId == 1 || menuId == MYID_INCLUDE_EXCLUDED_FROM_BOM )
478 {
479 m_dataModel->SetIncludeExcludedFromBOM( !m_dataModel->GetIncludeExcludedFromBOM() );
480 m_dataModel->RebuildRows();
481 m_grid->ForceRefresh();
482
484 }
485}
486
487
489{
491 {
492 m_cfgBomSettings.m_BomExportFileName = m_outputFileName->GetValue();
493 ClearModify();
494 }
495}
496
497
499{
500 m_grid->CommitPendingChanges( true );
501
502 if( m_dataModel->IsEdited() )
503 {
504 if( !HandleUnsavedChanges( this, _( "Save changes?" ),
505 [&]() -> bool
506 {
507 return TransferDataFromWindow();
508 } ) )
509 {
510 return;
511 }
512 }
513
514 EndModal( wxID_CANCEL );
515}
516
517
518void DIALOG_LIB_FOOTPRINT_FIELDS_TABLE::OnOk( wxCommandEvent& aEvent )
519{
521 return;
522
523 m_cfgBomSettings.m_BomExportFileName = m_outputFileName->GetValue();
524 EndModal( wxID_OK );
525}
526
527
529{
530 m_grid->CommitPendingChanges( true );
531
532 if( m_dataModel->IsEdited() && aEvent.CanVeto() )
533 {
534 if( !HandleUnsavedChanges( this, _( "Save changes?" ),
535 [&]() -> bool
536 {
537 return TransferDataFromWindow();
538 } ) )
539 {
540 aEvent.Veto();
541 return;
542 }
543 }
544
545 aEvent.Skip();
546}
547
548
550{
551 std::vector<BOM_PRESET> presets = BOM_PRESET::BuiltInPresets();
552
553 for( BOM_PRESET& preset : presets )
554 {
555 if( preset.sortField == GetDefaultFieldName( FIELD_T::REFERENCE, TRANSLATED ) )
557
558 for( BOM_FIELD& field : preset.fieldsOrdered )
559 {
561 {
563 field.label = wxS( "Footprint Name" );
564 field.groupBy = false;
565 }
566 }
567
568 if( preset.name == BOM_PRESET::DefaultEditing().name )
569 {
570 preset.groupSymbols = false;
571 preset.fieldsOrdered = {
572 { LIB_FOOTPRINT_FIELDS_EDITOR_GRID_DATA_MODEL::FOOTPRINT_NAME, wxS( "Footprint Name" ), true, false },
573 { GetDefaultFieldName( FIELD_T::REFERENCE, UNTRANSLATED ), wxS( "Reference" ), false, false },
574 { GetDefaultFieldName( FIELD_T::VALUE, UNTRANSLATED ), wxS( "Value" ), true, false },
575 { GetDefaultFieldName( FIELD_T::FOOTPRINT, UNTRANSLATED ), wxS( "Footprint" ), true, false },
576 { GetDefaultFieldName( FIELD_T::DATASHEET, UNTRANSLATED ), wxS( "Datasheet" ), true, false },
577 { GetDefaultFieldName( FIELD_T::DESCRIPTION, UNTRANSLATED ), wxS( "Description" ), false, false },
578 { LIB_FOOTPRINT_FIELDS_EDITOR_GRID_DATA_MODEL::FOOTPRINT_KEYWORDS, wxS( "Keywords" ), true, false },
579 { wxS( "${EXCLUDE_FROM_BOM}" ), wxS( "Exclude From BOM" ), true, false },
580 { wxS( "${EXCLUDE_FROM_SIM}" ), wxS( "Exclude From Simulation" ), true, false },
581 { wxS( "${EXCLUDE_FROM_BOARD}" ), wxS( "Exclude From Board" ), true, false },
582 { wxS( "${EXCLUDE_FROM_POS_FILES}" ), wxS( "Exclude From Position Files" ), true, false },
583 };
584 }
585 }
586
587 return presets;
588}
589
590
592{
593 return wxEmptyString;
594}
595
596
598{
599 return Prj().TextVarResolver( aToken );
600}
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:474
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.