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 embedTargets.push_back( footprint.GetFootprint().GetEmbeddedFiles() );
56
57 return MakeGridCellUrlEditorContext( embedTargets, inheritedFiles );
58}
59
60
61enum
62{
66};
67
68
70{
71public:
73 VIEW_CONTROLS_GRID_DATA_MODEL* aViewFieldsData,
75 FIELDS_TABLE_GRID_TRICKS( aParent, aGrid, aDataModel ),
76 m_dlg( aParent ),
77 m_viewControlsDataModel( aViewFieldsData ),
78 m_dataModel( aDataModel )
79 {}
80
81protected:
82 bool toggleCell( int aRow, int aCol, bool aPreserveSelection = false ) override
83 {
84 if( !m_grid->IsEditable() || m_dataModel->IsCellReadOnly( aRow, aCol ) )
85 return false;
86
87 return GRID_TRICKS::toggleCell( aRow, aCol, aPreserveSelection );
88 }
89
90 void showFieldsTablePopupMenu( wxMenu& aMenu, wxGridEvent& aEvent ) override
91 {
92 int row = m_grid->GetGridCursorRow();
93 int col = m_grid->GetGridCursorCol();
94
95 if( row >= 0 && col >= 0 )
96 {
97 if( m_dataModel->GetColFieldName( col ) == GetDefaultFieldName( FIELD_T::DATASHEET, UNTRANSLATED ) )
98 {
99 aMenu.Append( MYID_SHOW_DATASHEET, _( "Show Datasheet" ), _( "Show datasheet in browser" ) );
100 aMenu.AppendSeparator();
101 }
102 }
103
104 GRID_TRICKS::showPopupMenu( aMenu, aEvent );
105 }
106
107 void doFieldsTablePopupSelection( wxCommandEvent& aEvent ) override
108 {
109 int row = m_grid->GetGridCursorRow();
110 int col = m_grid->GetGridCursorCol();
111
112 if( aEvent.GetId() == MYID_SHOW_DATASHEET )
113 {
114 wxString datasheetUri = m_grid->GetCellValue( row, col );
115 GetAssociatedDocument( m_dlg, datasheetUri, &m_dlg->Prj(), nullptr, { } );
116 }
117 else if( aEvent.GetId() >= GRIDTRICKS_FIRST_SHOWHIDE )
118 {
119 if( !m_grid->CommitPendingChanges( false ) )
120 return;
121
122 // Pop-up column order is the order of the shown fields, not the viewControls order
123 col = aEvent.GetId() - GRIDTRICKS_FIRST_SHOWHIDE;
124
125 bool show = !m_dataModel->GetShowColumn( col );
126
127 m_dlg->ShowHideColumn( col, show );
128
129 wxString fieldName = m_dataModel->GetColFieldName( col );
130
131 for( row = 0; row < m_viewControlsDataModel->GetNumberRows(); row++ )
132 {
133 if( m_viewControlsDataModel->GetUntranslatedFieldName( row ) == fieldName )
134 m_viewControlsDataModel->SetValueAsBool( row, SHOW_FIELD_COLUMN, show );
135 }
136
137 if( m_viewControlsDataModel->GetView() )
138 m_viewControlsDataModel->GetView()->ForceRefresh();
139 }
140 else
141 {
143 }
144 }
145
146private:
150};
151
152
154 DIALOG_FIELDS_TABLE( aParent, aParent->GetSettings()->m_LibFieldEditor,
155 aParent->GetSettings()->m_LibFieldEditorBom, nullptr ),
156 m_parent( aParent )
157{
159
160 const wxString& libName = m_parent->GetTargetFPID().GetLibNickname();
161 const bool readOnly = !PROJECT_PCB::FootprintLibAdapter( &Prj() )->IsFootprintLibWritable( libName );
162
164 m_dataModel->SetScope( aScope );
165
166 m_grid->UseNativeColHeader( true );
167 m_grid->SetTable( m_dataModel, true );
168
169 // The field-list grid regroups its rows, so the dialog's position-based Ctrl+Z would shift
170 // values onto the wrong field.
172
173 // must be done after SetTable(), which appears to re-set it
174 m_grid->SetSelectionMode( wxGrid::wxGridSelectCells );
175
176 // add Cut, Copy, and Paste to wxGrid
177 m_grid->PushEventHandler(
179
181 m_variantsPanel->Hide();
182
183 // Footprint libraries don't have a concept of related or derived footprints like symbols do.
184 m_scope->Clear();
185 m_scope->Append( _( "Whole Library" ) );
186 m_scope->SetSelection( static_cast<int>( m_dataModel->GetScope() ) );
187 m_filterScope->SetString( static_cast<int>( BOM_FILTER_SCOPE::REFERENCE ), _( "Footprint Names" ) );
188
189 wxString title = wxString::Format( _( "Footprint Fields Table ('%s' Library)" ), libName );
190
191 if( readOnly )
192 title += wxS( " " ) + _( "[Read Only]" );
193
194 SetTitle( title );
195 m_buttonApply->SetLabel( _( "Save" ) );
196
198 m_grid->ClearSelection();
199
201 SetReadOnly( readOnly );
202
204
205 SetSize( GetDefaultDialogSize() );
206
208
210
211 m_outputFileName->SetValue( m_cfgBomSettings.m_BomExportFileName );
212
213 Center();
214
215 // Connect Events
216 m_grid->Bind( wxEVT_GRID_COL_SORT, &DIALOG_LIB_FOOTPRINT_FIELDS_TABLE::OnColSort, this );
217 m_grid->Bind( wxEVT_GRID_COL_MOVE, &DIALOG_LIB_FOOTPRINT_FIELDS_TABLE::OnColMove, this );
218 m_grid->GetGridWindow()->Bind( wxEVT_MOTION, &DIALOG_LIB_FOOTPRINT_FIELDS_TABLE::OnGridMouseMove, this );
221}
222
223
225{
226 m_footprintsList.clear();
227 m_loadedFootprints.clear();
228
230 wxString libName = m_parent->GetTargetFPID().GetLibNickname();
231 std::vector<wxString> footprintNames;
232
233 try
234 {
235 footprintNames = libMgr->GetFootprintNames( libName );
236 }
237 catch( const IO_ERROR& ioe )
238 {
239 wxMessageBox( wxString::Format( _( "Error loading footprints from library '%s': %s" ),
240 libName, ioe.What() ) );
241 return;
242 }
243
244 if( footprintNames.empty() )
245 {
246 wxMessageBox( wxString::Format( _( "No footprints found in library '%s'." ), libName ) );
247 return;
248 }
249
250 // Saving replaces the library manager's cached footprint object, so keep independent copies
251 // whose addresses remain stable for the lifetime of the data model.
252 for( const wxString& footprintName : footprintNames )
253 {
254 try
255 {
256 // LoadFootprint returns a caller-owned clone.
257 std::unique_ptr<FOOTPRINT> footprint( libMgr->LoadFootprint( libName, footprintName, true ) );
258
259 if( footprint )
260 {
261 m_loadedFootprints.push_back( std::move( footprint ) );
262 m_footprintsList.emplace_back( *m_loadedFootprints.back() );
263 }
264 }
265 catch( const IO_ERROR& ioe )
266 {
267 wxLogWarning( wxString::Format( _( "Error loading footprint '%s': %s" ), footprintName, ioe.What() ) );
268 }
269 }
270
271 if( m_footprintsList.empty() )
272 wxMessageBox( _( "No footprints could be loaded from the library." ) );
273}
274
275
277{
278 savePresets( true );
281
282 // Disconnect Events
283 m_grid->GetGridWindow()->Unbind( wxEVT_MOTION, &DIALOG_LIB_FOOTPRINT_FIELDS_TABLE::OnGridMouseMove, this );
284 m_grid->Unbind( wxEVT_GRID_COL_SORT, &DIALOG_LIB_FOOTPRINT_FIELDS_TABLE::OnColSort, this );
285 m_grid->Unbind( wxEVT_GRID_COL_MOVE, &DIALOG_LIB_FOOTPRINT_FIELDS_TABLE::OnColMove, this );
288
289 // Delete the GRID_TRICKS.
290 m_grid->PopEventHandler( true );
291
292 // we gave ownership of m_viewControlsDataModel & m_dataModel to the wxGrids...
293}
294
295
297{
298 return new GRID_CELL_URL_EDITOR(
299 this, nullptr,
300 [this]( int aRow )
301 {
302 return getDatasheetContext( m_dataModel->GetRowReferences( aRow ) );
303 } );
304}
305
306
308{
309 if( !wxDialog::TransferDataToWindow() )
310 return false;
311
312 LoadFieldNames(); // loads rows into m_viewControlsDataModel and columns into m_dataModel
313
314 m_scope->SetSelection( static_cast<int>( m_dataModel->GetScope() ) );
315
316 // Load our BOM view presets
317 SetUserBomPresets( m_cfgBomSettings.m_BomPresets );
318
319 BOM_PRESET preset = m_cfgBomSettings.m_BomSettings;
320
321 ApplyBomPreset( preset );
323
324 // Load BOM export format presets
325 SetUserBomFmtPresets( m_cfgBomSettings.m_BomFmtPresets );
326 ApplyBomFmtPreset( m_cfgBomSettings.m_BomFmtSettings );
328
329 m_outputFileName->SetValue( m_cfgBomSettings.m_BomExportFileName );
330
331 m_dataModel->SetGroupingEnabled( m_groupSymbolsBox->GetValue() );
332
333 setScope( static_cast<SCOPE>( m_scope->GetSelection() ) );
334
335 return true;
336}
337
338
340{
341 if( !m_grid->CommitPendingChanges() )
342 return false;
343
344 if( !wxDialog::TransferDataFromWindow() )
345 return false;
346
347 std::set<KIID_PATH> savedSelection = SaveGridSelection();
348 bool libraryChanged = false;
349
350 bool allChangesApplied = m_dataModel->ApplyData(
351 [&]( FOOTPRINT& aFootprint )
352 {
353 bool saved = m_parent->SaveFootprintInLibrary( &aFootprint,
354 aFootprint.GetFPID().GetUniStringLibNickname() );
355
356 libraryChanged |= saved;
357
358 if( saved )
359 m_parent->RefreshLibraryFootprintTab( aFootprint );
360
361 return saved;
362 } );
363
364 m_dataModel->RebuildRows();
365 RestoreGridSelection( savedSelection );
366
367 if( libraryChanged )
368 m_parent->SyncLibraryTree( true );
369
370 if( !allChangesApplied )
371 return false;
372
373 ClearModify();
374 return true;
375}
376
377
379{
380 auto addMandatoryField =
381 [&]( FIELD_T aFieldId, bool aShow, bool aGroupBy )
382 {
383 m_mandatoryFieldListIndexes[aFieldId] = m_viewControlsDataModel->GetNumberRows();
384
386 aShow, aGroupBy );
387 };
388
389 AddField( wxS( "${FOOTPRINT_NAME}" ), _( "Footprint Name" ), true, false );
390
391 // Add mandatory fields first show groupBy
392 addMandatoryField( FIELD_T::REFERENCE, false, false );
393 addMandatoryField( FIELD_T::VALUE, true, false );
394 addMandatoryField( FIELD_T::FOOTPRINT, true, false );
395 addMandatoryField( FIELD_T::DATASHEET, true, false );
396 addMandatoryField( FIELD_T::DESCRIPTION, false, false );
397
398 // Generated fields present only in the fields table
400 AddField( wxS( "${EXCLUDE_FROM_BOM}" ), _( "Exclude From BOM" ), true, false );
401 AddField( wxS( "${EXCLUDE_FROM_SIM}" ), _( "Exclude From Simulation" ), true, false );
402 AddField( wxS( "${EXCLUDE_FROM_BOARD}" ), _( "Exclude From Board" ), true, false );
403 AddField( wxS( "${EXCLUDE_FROM_POS_FILES}" ), _( "Exclude From Position Files" ), true, false );
404
405 // User field names are stored and matched case-sensitively (see issue #24021), so each
406 // distinct name gets its own column rather than collapsing case variants together.
407 std::set<wxString> userFieldNames;
408
410 {
411 for( PCB_FIELD* field : ref.GetFootprint().GetFields() )
412 {
413 if( !field->IsMandatory() && !field->IsPrivate() )
414 userFieldNames.insert( field->GetName() );
415 }
416 }
417
418 for( const wxString& fieldName : userFieldNames )
419 AddField( fieldName, GetGeneratedFieldDisplayName( fieldName ), true, false );
420
421 // Add any global template field names which aren't already present.
422 for( const TEMPLATE_FIELDNAME& templateField :
423 Pgm().GetCommonSettings()->m_FieldNameTemplates.GetTemplateFieldNames( TEMPLATES::SCOPE::GLOBAL ) )
424 {
425 if( userFieldNames.count( templateField.m_Name ) == 0 )
426 AddField( templateField.m_Name, GetGeneratedFieldDisplayName( templateField.m_Name ), false, false );
427 }
428}
429
430
432{
433 m_dataModel->SetScope( aScope );
434 m_dataModel->RebuildRows();
435}
436
437
438void DIALOG_LIB_FOOTPRINT_FIELDS_TABLE::OnScope( wxCommandEvent& aEvent )
439{
440 switch( aEvent.GetSelection() )
441 {
442 case 0: setScope( SCOPE::SCOPE_ALL ); break;
443 }
444}
445
446
447void DIALOG_LIB_FOOTPRINT_FIELDS_TABLE::OnMenu( wxCommandEvent& aEvent )
448{
449 // Build a pop menu:
450 wxMenu menu;
451
452 menu.Append( MYID_INCLUDE_DNP, _( "Include 'DNP' Footprints" ),
453 _( "Show footprints marked 'DNP' in the table. This setting also controls whether or not 'DNP' "
454 "footprints are included on export." ),
455 wxITEM_CHECK );
456 menu.Check( MYID_INCLUDE_DNP, !m_dataModel->GetExcludeDNP() );
457
458 menu.Append( MYID_INCLUDE_EXCLUDED_FROM_BOM, _( "Include 'Exclude from BOM' Footprints" ),
459 _( "Show footprints marked 'Exclude from BOM' in the table. Footprints marked 'Exclude from BOM' "
460 "are never included on export." ),
461 wxITEM_CHECK );
462 menu.Check( MYID_INCLUDE_EXCLUDED_FROM_BOM, m_dataModel->GetIncludeExcludedFromBOM() );
463
464 // menuId is the selected submenu id from the popup menu or wxID_NONE
465 int menuId = m_bMenu->GetPopupMenuSelectionFromUser( menu );
466
467 if( menuId == 0 || menuId == MYID_INCLUDE_DNP )
468 {
469 m_dataModel->SetExcludeDNP( !m_dataModel->GetExcludeDNP() );
470 m_dataModel->RebuildRows();
471 m_grid->ForceRefresh();
472
474 }
475 else if( menuId == 1 || menuId == MYID_INCLUDE_EXCLUDED_FROM_BOM )
476 {
477 m_dataModel->SetIncludeExcludedFromBOM( !m_dataModel->GetIncludeExcludedFromBOM() );
478 m_dataModel->RebuildRows();
479 m_grid->ForceRefresh();
480
482 }
483}
484
485
487{
489 {
490 m_cfgBomSettings.m_BomExportFileName = m_outputFileName->GetValue();
491 ClearModify();
492 }
493}
494
495
497{
498 m_grid->CommitPendingChanges( true );
499
500 if( m_dataModel->IsEdited() )
501 {
502 if( !HandleUnsavedChanges( this, _( "Save changes?" ),
503 [&]() -> bool
504 {
505 return TransferDataFromWindow();
506 } ) )
507 {
508 return;
509 }
510 }
511
512 EndModal( wxID_CANCEL );
513}
514
515
516void DIALOG_LIB_FOOTPRINT_FIELDS_TABLE::OnOk( wxCommandEvent& aEvent )
517{
519 return;
520
521 m_cfgBomSettings.m_BomExportFileName = m_outputFileName->GetValue();
522 EndModal( wxID_OK );
523}
524
525
527{
528 m_grid->CommitPendingChanges( true );
529
530 if( m_dataModel->IsEdited() && aEvent.CanVeto() )
531 {
532 if( !HandleUnsavedChanges( this, _( "Save changes?" ),
533 [&]() -> bool
534 {
535 return TransferDataFromWindow();
536 } ) )
537 {
538 aEvent.Veto();
539 return;
540 }
541 }
542
543 aEvent.Skip();
544}
545
546
548{
549 std::vector<BOM_PRESET> presets = BOM_PRESET::BuiltInPresets();
550
551 for( BOM_PRESET& preset : presets )
552 {
553 if( preset.sortField == GetDefaultFieldName( FIELD_T::REFERENCE, TRANSLATED ) )
555
556 for( BOM_FIELD& field : preset.fieldsOrdered )
557 {
559 {
561 field.label = wxS( "Footprint Name" );
562 field.groupBy = false;
563 }
564 }
565
566 if( preset.name == BOM_PRESET::DefaultEditing().name )
567 {
568 preset.groupSymbols = false;
569 preset.fieldsOrdered = {
570 { LIB_FOOTPRINT_FIELDS_EDITOR_GRID_DATA_MODEL::FOOTPRINT_NAME, wxS( "Footprint Name" ), true, false },
571 { GetDefaultFieldName( FIELD_T::REFERENCE, UNTRANSLATED ), wxS( "Reference" ), false, false },
572 { GetDefaultFieldName( FIELD_T::VALUE, UNTRANSLATED ), wxS( "Value" ), true, false },
573 { GetDefaultFieldName( FIELD_T::FOOTPRINT, UNTRANSLATED ), wxS( "Footprint" ), true, false },
574 { GetDefaultFieldName( FIELD_T::DATASHEET, UNTRANSLATED ), wxS( "Datasheet" ), true, false },
575 { GetDefaultFieldName( FIELD_T::DESCRIPTION, UNTRANSLATED ), wxS( "Description" ), false, false },
576 { LIB_FOOTPRINT_FIELDS_EDITOR_GRID_DATA_MODEL::FOOTPRINT_KEYWORDS, wxS( "Keywords" ), true, false },
577 { wxS( "${EXCLUDE_FROM_BOM}" ), wxS( "Exclude From BOM" ), true, false },
578 { wxS( "${EXCLUDE_FROM_SIM}" ), wxS( "Exclude From Simulation" ), true, false },
579 { wxS( "${EXCLUDE_FROM_BOARD}" ), wxS( "Exclude From Board" ), true, false },
580 { wxS( "${EXCLUDE_FROM_POS_FILES}" ), wxS( "Exclude From Position Files" ), true, false },
581 };
582 }
583 }
584
585 return presets;
586}
587
588
590{
591 return wxEmptyString;
592}
593
594
596{
597 return Prj().TextVarResolver( aToken );
598}
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)
Store what changed since rememberLoadedPresets(); true if anything did.
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:95
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:417
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:178
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:49
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.