KiCad PCB EDA Suite
Loading...
Searching...
No Matches
load_select_footprint.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) 2018 Jean-Pierre Charras, [email protected]
5 * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <[email protected]>
6 * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, you may find one here:
20 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21 * or you may search the http://www.gnu.org website for the version 2 license,
22 * or you may write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 */
25
26#include <functional>
27using namespace std::placeholders;
28
29#include <board.h>
30#include <footprint.h>
31#include <confirm.h>
35#include <eda_list_dialog.h>
37#include <footprint_info_impl.h>
38#include <footprint_tree_pane.h>
40#include <fp_lib_table.h>
41#include <core/ignore.h>
42#include <io_mgr.h>
43#include <string_utils.h>
44#include <kiway.h>
45#include <lib_id.h>
46#include <macros.h>
47#include <pcb_edit_frame.h>
48#include <pcbnew_settings.h>
49#include <view/view_controls.h>
50#include <widgets/lib_tree.h>
53
55
56
57static wxArrayString s_FootprintHistoryList;
58static unsigned s_FootprintHistoryMaxCount = 8;
59
60static void AddFootprintToHistory( const wxString& aName )
61{
62 // Remove duplicates
63 for( int ii = s_FootprintHistoryList.GetCount() - 1; ii >= 0; --ii )
64 {
65 if( s_FootprintHistoryList[ ii ] == aName )
66 s_FootprintHistoryList.RemoveAt((size_t) ii );
67 }
68
69 // Add the new name at the beginning of the history list
70 s_FootprintHistoryList.Insert( aName, 0 );
71
72 // Remove extra names
74 s_FootprintHistoryList.RemoveAt( s_FootprintHistoryList.GetCount() - 1 );
75}
76
77
78#include <bitmaps.h>
80{
81 bool is_last_fp_from_brd = IsCurrentFPFromBoard();
82
83 FOOTPRINT* newFootprint = nullptr;
85
86 if( frame == nullptr ) // happens if no board editor opened
87 return false;
88
89 if( aFootprint == nullptr )
90 {
91 if( !frame->GetBoard() || !frame->GetBoard()->GetFirstFootprint() )
92 return false;
93
94 aFootprint = SelectFootprintFromBoard( frame->GetBoard() );
95 }
96
97 if( aFootprint == nullptr )
98 return false;
99
100 // Ensure we do not have the pad editor open (that is apseudo modal dlg).
101 // LoadFootprintFromBoard() can be called from the board editor, and we must ensure
102 // no footprint item is currently in edit
103 if( wxWindow::FindWindowByName( PAD_PROPERTIES_DLG_NAME ) )
104 wxWindow::FindWindowByName( PAD_PROPERTIES_DLG_NAME )->Close();
105
106 if( !Clear_Pcb( true ) )
107 return false;
108
109 m_boardFootprintUuids.clear();
110
111 auto recordAndUpdateUuid =
112 [&]( BOARD_ITEM* aItem )
113 {
114 KIID newId;
115 m_boardFootprintUuids[ newId ] = aItem->m_Uuid;
116 const_cast<KIID&>( aItem->m_Uuid ) = newId;
117 };
118
119 newFootprint = (FOOTPRINT*) aFootprint->Clone(); // Keep existing uuids
120 newFootprint->SetParent( GetBoard() );
121 newFootprint->SetParentGroup( nullptr );
122 newFootprint->SetLink( aFootprint->m_Uuid );
123
124 newFootprint->ClearFlags();
125 recordAndUpdateUuid( newFootprint );
126 newFootprint->RunOnChildren(
127 [&]( BOARD_ITEM* aItem )
128 {
129 if( aItem->Type() == PCB_PAD_T )
130 aItem->SetLocked( false );
131
132 aItem->ClearFlags();
133 recordAndUpdateUuid( aItem );
134 } );
135
136 AddFootprintToBoard( newFootprint );
137
138 // Clear references to any net info, because the footprint editor does know any thing about
139 // nets handled by the current edited board.
140 // Moreover we do not want to save any reference to an unknown net when saving the footprint
141 // in lib cache so we force the ORPHANED dummy net info for all pads.
142 newFootprint->ClearAllNets();
143
145 PlaceFootprint( newFootprint );
146 newFootprint->SetPosition( VECTOR2I( 0, 0 ) ); // cursor in GAL may not yet be initialized
147
148 // Put it on FRONT layer,
149 // because this is the default in Footprint Editor, and in libs
150 if( newFootprint->GetLayer() != F_Cu )
151 newFootprint->Flip( newFootprint->GetPosition(), frame->GetPcbNewSettings()->m_FlipLeftRight );
152
153 // Put it in orientation 0,
154 // because this is the default orientation in Footprint Editor, and in libs
155 newFootprint->SetOrientation( ANGLE_0 );
156
157 Zoom_Automatique( false );
158
159 m_adapter->SetPreselectNode( newFootprint->GetFPID(), 0 );
160
162 GetScreen()->SetContentModified( false );
163
164 // Update the save items if needed.
165 if( !is_last_fp_from_brd )
166 {
169
170 if( IsSearchTreeShown() )
172 }
173
174 Update3DView( true, true );
175 UpdateView();
176 GetCanvas()->Refresh();
177 m_treePane->GetLibTree()->RefreshLibTree(); // update any previously-highlighted items
178
179 return true;
180}
181
182
184{
185 // Close the current non-modal Lib browser if opened, and open a new one, in "modal" mode:
188
189 if( viewer )
190 {
191 viewer->Destroy();
192 // Destroy() does not immediately delete the viewer, if some events are pending.
193 // (for this reason delete operator cannot be used blindly with "top level" windows)
194 // so gives a slice of time to delete the viewer frame.
195 // This is especially important in OpenGL mode to avoid recreating context before
196 // the old one is deleted.
197 wxSafeYield();
198 }
199
200 SetFocus();
201
202 // Creates the modal Lib browser:
204
205 wxString fpid;
206 ignore_unused( viewer->ShowModal( &fpid, this ) );
207
208 viewer->Destroy();
209
210 return fpid;
211}
212
213
215{
216 FP_LIB_TABLE* fpTable = Prj().PcbFootprintLibs();
217 wxString footprintName;
218 LIB_ID fpid;
219 FOOTPRINT* footprint = nullptr;
220
221 static wxString lastComponentName;
222
223 // Load footprint files:
224 WX_PROGRESS_REPORTER* progressReporter = new WX_PROGRESS_REPORTER( this,
225 _( "Loading Footprint Libraries" ), 3 );
226 GFootprintList.ReadFootprintFiles( fpTable, nullptr, progressReporter );
227 bool cancel = progressReporter->WasCancelled();
228
229 // Force immediate deletion of the WX_PROGRESS_REPORTER. Do not use Destroy(), or use
230 // Destroy() followed by wxSafeYield() because on Windows, APP_PROGRESS_DIALOG and
231 // WX_PROGRESS_REPORTER have some side effects on the event loop manager. For instance, a
232 // subsequent call to ShowModal() or ShowQuasiModal() for a dialog following the use of a
233 // WX_PROGRESS_REPORTER results in incorrect modal or quasi modal behavior.
234 delete progressReporter;
235
236 if( cancel )
237 return nullptr;
238
241
242 wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER> ptr = FP_TREE_MODEL_ADAPTER::Create( this, fpTable );
243 FP_TREE_MODEL_ADAPTER* adapter = static_cast<FP_TREE_MODEL_ADAPTER*>( ptr.get() );
244
245 std::vector<LIB_TREE_ITEM*> historyInfos;
246
247 for( const wxString& item : s_FootprintHistoryList )
248 {
250
251 // this can be null, for example, if the footprint has been deleted from a library.
252 if( fp_info != nullptr )
253 historyInfos.push_back( fp_info );
254 }
255
256 adapter->DoAddLibrary( wxT( "-- " ) + _( "Recently Used" ) + wxT( " --" ), wxEmptyString,
257 historyInfos, false, true );
258
259 if( aPreselect.IsValid() )
260 adapter->SetPreselectNode( aPreselect, 0 );
261 else if( historyInfos.size() )
262 adapter->SetPreselectNode( historyInfos[0]->GetLibId(), 0 );
263
264 adapter->AddLibraries( this );
265
266 wxString title;
267 title.Printf( _( "Choose Footprint (%d items loaded)" ), adapter->GetItemCount() );
268
269 DIALOG_CHOOSE_FOOTPRINT dialog( this, title, ptr );
270
271 if( dialog.ShowQuasiModal() == wxID_CANCEL )
272 return nullptr;
273
274 // Save any changes to column widths, etc.
275 adapter->SaveSettings();
276
277 if( dialog.IsExternalBrowserSelected() )
278 {
279 // SelectFootprintFromLibBrowser() returns the "full" footprint name, i.e.
280 // <lib_name>/<footprint name> or LIB_ID format "lib_name:fp_name:rev#"
281 footprintName = SelectFootprintFromLibBrowser();
282
283 if( footprintName.IsEmpty() ) // Cancel command
284 return nullptr;
285 else
286 fpid.Parse( footprintName );
287 }
288 else
289 {
290 fpid = dialog.GetSelectedLibId();
291
292 if( !fpid.IsValid() )
293 return nullptr;
294 else
295 footprintName = fpid.Format();
296 }
297
298 try
299 {
300 footprint = loadFootprint( fpid );
301 }
302 catch( const IO_ERROR& )
303 {
304 }
305
306 if( footprint )
307 {
308 lastComponentName = footprintName;
309 AddFootprintToHistory( footprintName );
310 }
311
312 return footprint;
313}
314
315
317{
318 FOOTPRINT* footprint = nullptr;
319
320 try
321 {
322 footprint = loadFootprint( aFootprintId );
323 }
324 catch( const IO_ERROR& )
325 {
326 }
327
328 return footprint;
329}
330
331
333{
334 FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs();
335
336 wxCHECK_MSG( fptbl, nullptr, wxT( "Cannot look up LIB_ID in NULL FP_LIB_TABLE." ) );
337
338 FOOTPRINT *footprint = nullptr;
339
340 // When loading a footprint from a library in the footprint editor
341 // the items UUIDs must be keep and not reinitialized
342 bool keepUUID = IsType( FRAME_FOOTPRINT_EDITOR );
343
344 try
345 {
346 footprint = fptbl->FootprintLoadWithOptionalNickname( aFootprintId, keepUUID );
347 }
348 catch( const IO_ERROR& )
349 {
350 }
351
352 // If the footprint is found, clear all net info to be sure there are no broken links to
353 // any netinfo list (should be not needed, but it can be edited from the footprint editor )
354 if( footprint )
355 footprint->ClearAllNets();
356
357 return footprint;
358}
359
360
362{
363 static wxString oldName; // Save name of last footprint selected.
364
365 wxString fpname;
366 wxString msg;
367 wxArrayString listnames;
368
369 for( FOOTPRINT* footprint : aPcb->Footprints() )
370 listnames.Add( footprint->GetReference() );
371
372 msg.Printf( _( "Footprints [%u items]" ), (unsigned) listnames.GetCount() );
373
374 wxArrayString headers;
375
376 headers.Add( _( "Footprint" ) );
377
378 std::vector<wxArrayString> itemsToDisplay;
379
380 // Conversion from wxArrayString to vector of ArrayString
381 for( unsigned i = 0; i < listnames.GetCount(); i++ )
382 {
383 wxArrayString item;
384
385 item.Add( listnames[i] );
386 itemsToDisplay.push_back( item );
387 }
388
389 EDA_LIST_DIALOG dlg( this, msg, headers, itemsToDisplay, wxEmptyString );
390
391 if( dlg.ShowModal() == wxID_OK )
392 fpname = dlg.GetTextSelection();
393 else
394 return nullptr;
395
396 oldName = fpname;
397
398 for( FOOTPRINT* fp : aPcb->Footprints() )
399 {
400 if( fpname == fp->GetReference() )
401 return fp;
402 }
403
404 return nullptr;
405}
406
407
408bool FOOTPRINT_EDIT_FRAME::SaveLibraryAs( const wxString& aLibraryPath )
409{
410 const wxString& curLibPath = aLibraryPath;
411 wxString dstLibPath = CreateNewLibrary( wxEmptyString, aLibraryPath );
412
413 if( !dstLibPath )
414 return false; // user aborted in CreateNewLibrary()
415
416 wxBusyCursor dummy;
417 wxString msg;
418
421
422 try
423 {
424 PLUGIN::RELEASER cur( IO_MGR::PluginFind( curType ) );
425 PLUGIN::RELEASER dst( IO_MGR::PluginFind( dstType ) );
426
427 wxArrayString footprints;
428
429 cur->FootprintEnumerate( footprints, curLibPath, false );
430
431 for( unsigned i = 0; i < footprints.size(); ++i )
432 {
433 const FOOTPRINT* footprint = cur->GetEnumeratedFootprint( curLibPath, footprints[i] );
434 dst->FootprintSave( dstLibPath, footprint );
435
436 msg = wxString::Format( _( "Footprint '%s' saved." ), footprints[i] );
437 SetStatusText( msg );
438 }
439 }
440 catch( const IO_ERROR& ioe )
441 {
442 DisplayError( this, ioe.What() );
443 return false;
444 }
445
446 msg = wxString::Format( _( "Footprint library '%s' saved as '%s'." ),
447 curLibPath,
448 dstLibPath );
449
450 DisplayInfoMessage( this, msg );
451
452 SetStatusText( wxEmptyString );
453 return true;
454}
455
456
457static FOOTPRINT* s_FootprintInitialCopy = nullptr; // Copy of footprint for abort/undo command
458
459static PICKED_ITEMS_LIST s_PickedList; // A pick-list to save initial footprint
460 // and dragged tracks
461
462
464{
465 wxString footprintName;
466 wxArrayString fplist;
467
468 // Build list of available fp references, to display them in dialog
469 for( FOOTPRINT* fp : GetBoard()->Footprints() )
470 fplist.Add( fp->GetReference() + wxT( " ( " ) + fp->GetValue() + wxT( " )" ) );
471
472 fplist.Sort();
473
474 DIALOG_GET_FOOTPRINT_BY_NAME dlg( this, fplist );
475
476 if( dlg.ShowModal() != wxID_OK ) //Aborted by user
477 return nullptr;
478
479 footprintName = dlg.GetValue();
480 footprintName.Trim( true );
481 footprintName.Trim( false );
482
483 if( !footprintName.IsEmpty() )
484 {
485 for( FOOTPRINT* fp : GetBoard()->Footprints() )
486 {
487 if( fp->GetReference().CmpNoCase( footprintName ) == 0 )
488 return fp;
489 }
490 }
491
492 return nullptr;
493}
494
495
496void PCB_BASE_FRAME::PlaceFootprint( FOOTPRINT* aFootprint, bool aRecreateRatsnest )
497{
498 if( aFootprint == nullptr )
499 return;
500
501 OnModify();
502
503 if( aFootprint->IsNew() )
504 {
505 SaveCopyInUndoList( aFootprint, UNDO_REDO::NEWITEM );
506 }
507 else if( aFootprint->IsMoving() )
508 {
509 ITEM_PICKER picker( nullptr, aFootprint, UNDO_REDO::CHANGED );
511 s_PickedList.PushItem( picker );
512 s_FootprintInitialCopy = nullptr; // the picker is now owner of s_ModuleInitialCopy.
513 }
514
515 if( s_PickedList.GetCount() )
516 {
517 SaveCopyInUndoList( s_PickedList, UNDO_REDO::UNSPECIFIED );
518
519 // Clear list, but DO NOT delete items, because they are owned by the saved undo
520 // list and they therefore in use
522 }
523
524 aFootprint->SetPosition( GetCanvas()->GetViewControls()->GetCursorPosition() );
525 aFootprint->ClearFlags();
526
528 s_FootprintInitialCopy = nullptr;
529
530 if( aRecreateRatsnest )
531 m_pcb->GetConnectivity()->Update( aFootprint );
532
533 if( aRecreateRatsnest )
534 Compile_Ratsnest( true );
535
536 SetMsgPanel( aFootprint );
537}
538
539
void SetContentModified(bool aModified=true)
Definition: base_screen.h:59
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:71
void SetParentGroup(PCB_GROUP *aGroup)
Definition: board_item.h:84
virtual void SetLocked(bool aLocked)
Definition: board_item.h:270
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:270
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Definition: board.h:405
FOOTPRINTS & Footprints()
Definition: board.h:312
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:432
Dialog class to select a footprint from the libraries.
bool IsExternalBrowserSelected() const
Function IsExternalBrowserSelected.
LIB_ID GetSelectedLibId() const
To be called after this dialog returns from ShowModal().
DIALOG_GET_FOOTPRINT_BY_NAME is a helper dialog to select a footprint by its reference One can enter ...
int ShowQuasiModal()
virtual void ClearUndoRedoList()
Clear the undo and redo list using ClearUndoORRedoList()
bool IsType(FRAME_T aType) const
void ReCreateMenuBar()
Recreates the menu bar.
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
virtual void Zoom_Automatique(bool aWarpPointer)
Redraw the screen with best zoom level and the best centering that shows all the page or the board.
KIGFX::VIEW_CONTROLS * GetViewControls() const
Return a pointer to the #VIEW_CONTROLS instance used in the panel.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
const KIID m_Uuid
Definition: eda_item.h:475
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:125
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:100
bool IsMoving() const
Definition: eda_item.h:104
bool IsNew() const
Definition: eda_item.h:103
A dialog which shows:
wxString GetTextSelection(int aColumn=0)
Return the selected text from aColumn in the wxListCtrl in the dialog.
bool SaveLibraryAs(const wxString &aLibraryPath)
Save a library to a new name and/or library type.
std::map< KIID, KIID > m_boardFootprintUuids
FOOTPRINT * SelectFootprintFromBoard(BOARD *aPcb)
Display the list of footprints currently existing on the BOARD.
void ReCreateHToolbar() override
Create the main horizontal toolbar for the footprint editor.
wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > m_adapter
void AddFootprintToBoard(FOOTPRINT *aFootprint) override
Override from PCB_BASE_EDIT_FRAME which adds a footprint to the editor's dummy board,...
FOOTPRINT_TREE_PANE * m_treePane
bool Clear_Pcb(bool aQuery)
Delete all and reinitialize the current board.
Definition: initpcb.cpp:97
bool LoadFootprintFromBoard(FOOTPRINT *aFootprint)
Load a footprint from the main board into the Footprint Editor.
bool ReadFootprintFiles(FP_LIB_TABLE *aTable, const wxString *aNickname=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr) override
Read all the footprints provided by the combination of aTable and aNickname.
void DisplayErrors(wxTopLevelWindow *aCaller=nullptr)
unsigned GetErrorCount() const
FOOTPRINT_INFO * GetFootprintInfo(const wxString &aFootprintName)
Get info for a footprint by id.
LIB_TREE * GetLibTree() const
Component library viewer main window.
bool ShowModal(wxString *aFootprint, wxWindow *aParent) override
Run the footprint viewer as a modal dialog.
void SetPosition(const VECTOR2I &aPos) override
Definition: footprint.cpp:1652
void SetLink(const KIID &aLink)
Definition: footprint.h:692
void SetOrientation(const EDA_ANGLE &aNewAngle)
Definition: footprint.cpp:1724
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: footprint.cpp:1386
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: footprint.h:202
const LIB_ID & GetFPID() const
Definition: footprint.h:214
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: footprint.cpp:568
void ClearAllNets()
Clear (i.e.
Definition: footprint.cpp:559
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction) const
Invoke a function on all BOARD_ITEMs that belong to the footprint (pads, drawings,...
Definition: footprint.cpp:1392
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: footprint.cpp:1596
VECTOR2I GetPosition() const override
Definition: footprint.h:190
FOOTPRINT * FootprintLoadWithOptionalNickname(const LIB_ID &aFootprintId, bool aKeepUUID=false)
Load a footprint having aFootprintId with possibly an empty nickname.
static wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > Create(EDA_BASE_FRAME *aParent, LIB_TABLE *aLibs)
Factory function: create a model adapter in a reference-counting container.
void AddLibraries(EDA_BASE_FRAME *aParent)
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:76
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
static PCB_FILE_T GuessPluginTypeFromLibPath(const wxString &aLibPath)
Return a plugin type given a footprint library's libPath.
Definition: io_mgr.cpp:124
PCB_FILE_T
The set of file types that the IO_MGR knows about, and for which there has been a plugin written.
Definition: io_mgr.h:54
static PLUGIN * PluginFind(PCB_FILE_T aFileType)
Return a PLUGIN which the caller can use to import, export, save, or load design documents.
Definition: io_mgr.cpp:58
void SetLink(EDA_ITEM *aItem)
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Move the graphic crosshair cursor to the requested position expressed in world coordinates.
Definition: kiid.h:48
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:432
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
Definition: lib_id.cpp:50
bool IsValid() const
Check if this LID_ID is valid.
Definition: lib_id.h:172
UTF8 Format() const
Definition: lib_id.cpp:117
A mix-in to provide polymorphism between items stored in libraries (symbols, aliases and footprints).
Definition: lib_tree_item.h:41
void SetPreselectNode(const LIB_ID &aLibId, int aUnit)
Set the symbol name to be selected if there are no search results.
void DoAddLibrary(const wxString &aNodeName, const wxString &aDesc, const std::vector< LIB_TREE_ITEM * > &aItemList, bool pinned, bool presorted)
Add the given list of symbols by alias.
void SaveSettings()
Save the column widths to the config file.
int GetItemCount() const
Return the number of symbols loaded in the tree.
void RefreshLibTree()
Refreshes the tree (mainly to update highlighting and asterisking)
Definition: lib_tree.cpp:361
wxString CreateNewLibrary(const wxString &aLibName=wxEmptyString, const wxString &aProposedName=wxEmptyString)
If a library name is given, creates a new footprint library in the project folder with the given name...
wxString SelectFootprintFromLibBrowser()
Launch the footprint viewer to select the name of a footprint to load.
FOOTPRINT * SelectFootprintFromLibTree(LIB_ID aPreselect=LIB_ID())
Open a dialog to select a footprint.
FOOTPRINT * GetFootprintFromBoardByReference()
PCBNEW_SETTINGS * GetPcbNewSettings() const
void OnModify() override
Must be called after a change in order to set the "modify" flag and update other data structures and ...
FOOTPRINT * loadFootprint(const LIB_ID &aFootprintId)
Attempts to load aFootprintId from the footprint library table.
FOOTPRINT * LoadFootprint(const LIB_ID &aFootprintId)
Attempt to load aFootprintId from the footprint library table.
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
BOARD * GetBoard() const
void PlaceFootprint(FOOTPRINT *aFootprint, bool aRecreateRatsnest=true)
Places aFootprint at the current cursor position and updates footprint coordinates with the new posit...
virtual void SaveCopyInUndoList(EDA_ITEM *aItemToCopy, UNDO_REDO aTypeCommand)=0
Create a new entry in undo list of commands.
void Compile_Ratsnest(bool aDisplayStatus)
Create the entire board ratsnest.
Definition: ratsnest.cpp:35
virtual void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
The main frame for Pcbnew.
A holder to handle information on schematic or board items.
void PushItem(const ITEM_PICKER &aItem)
Push aItem to the top of the list.
unsigned GetCount() const
void ClearItemsList()
Delete only the list of pickers NOT the picked data itself.
Releases a PLUGIN in the context of a potential thrown exception through its destructor.
Definition: io_mgr.h:562
virtual const FOOTPRINT * GetEnumeratedFootprint(const wxString &aLibraryPath, const wxString &aFootprintName, const STRING_UTF8_MAP *aProperties=nullptr)
A version of FootprintLoad() for use after FootprintEnumerate() for more efficient cache management.
Definition: plugin.cpp:70
virtual void FootprintSave(const wxString &aLibraryPath, const FOOTPRINT *aFootprint, const STRING_UTF8_MAP *aProperties=nullptr)
Write aFootprint to an existing library located at aLibraryPath.
Definition: plugin.cpp:95
virtual void FootprintEnumerate(wxArrayString &aFootprintNames, const wxString &aLibraryPath, bool aBestEfforts, const STRING_UTF8_MAP *aProperties=nullptr)
Return a list of footprint names contained within the library at aLibraryPath.
Definition: plugin.cpp:57
virtual FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
Definition: project.cpp:324
Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting back of...
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:283
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:335
This file is part of the common library.
#define PAD_PROPERTIES_DLG_NAME
DIALOG_PAD_PROPERTIES, derived from DIALOG_PAD_PROPERTIES_BASE, created by wxFormBuilder.
#define _(s)
static constexpr EDA_ANGLE & ANGLE_0
Definition: eda_angle.h:429
FOOTPRINT_LIST_IMPL GFootprintList
The global footprint info table.
Definition: cvpcb.cpp:140
@ FRAME_PCB_EDITOR
Definition: frame_type.h:40
@ FRAME_FOOTPRINT_VIEWER_MODAL
Definition: frame_type.h:43
@ FRAME_FOOTPRINT_VIEWER
Definition: frame_type.h:42
@ FRAME_FOOTPRINT_EDITOR
Definition: frame_type.h:41
void ignore_unused(const T &)
Definition: ignore.h:24
KIWAY Kiway
@ F_Cu
Definition: layer_ids.h:64
static wxArrayString s_FootprintHistoryList
static unsigned s_FootprintHistoryMaxCount
static PICKED_ITEMS_LIST s_PickedList
static FOOTPRINT * s_FootprintInitialCopy
static void AddFootprintToHistory(const wxString &aName)
This file contains miscellaneous commonly used macros and functions.
std::vector< FAB_LAYER_COLOR > dummy
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition: typeinfo.h:87
VECTOR2< double > VECTOR2D
Definition: vector2d.h:587
VECTOR2< int > VECTOR2I
Definition: vector2d.h:588