KiCad PCB EDA Suite
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 <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->SetLink( aFootprint->m_Uuid );
122
123 newFootprint->ClearFlags();
124 recordAndUpdateUuid( newFootprint );
125 newFootprint->RunOnChildren(
126 [&]( BOARD_ITEM* aItem )
127 {
128 if( aItem->Type() == PCB_PAD_T )
129 aItem->SetLocked( false );
130
131 aItem->ClearFlags();
132 recordAndUpdateUuid( aItem );
133 } );
134
135 AddFootprintToBoard( newFootprint );
136
137 // Clear references to any net info, because the footprint editor does know any thing about
138 // nets handled by the current edited board.
139 // Moreover we do not want to save any reference to an unknown net when saving the footprint
140 // in lib cache so we force the ORPHANED dummy net info for all pads.
141 newFootprint->ClearAllNets();
142
144 PlaceFootprint( newFootprint );
145 newFootprint->SetPosition( wxPoint( 0, 0 ) ); // cursor in GAL may not yet be initialized
146
147 // Put it on FRONT layer,
148 // because this is the default in Footprint Editor, and in libs
149 if( newFootprint->GetLayer() != F_Cu )
150 newFootprint->Flip( newFootprint->GetPosition(), frame->GetPcbNewSettings()->m_FlipLeftRight );
151
152 // Put it in orientation 0,
153 // because this is the default orientation in Footprint Editor, and in libs
154 newFootprint->SetOrientation( ANGLE_0 );
155
156 Zoom_Automatique( false );
157
158 m_adapter->SetPreselectNode( newFootprint->GetFPID(), 0 );
159
161 GetScreen()->SetContentModified( false );
162
163 // Update the save items if needed.
164 if( !is_last_fp_from_brd )
165 {
168
169 if( IsSearchTreeShown() )
171 }
172
173 Update3DView( true, true );
174 UpdateView();
175 GetCanvas()->Refresh();
176 m_treePane->GetLibTree()->RefreshLibTree(); // update any previously-highlighted items
177
178 return true;
179}
180
181
183{
184 // Close the current non-modal Lib browser if opened, and open a new one, in "modal" mode:
187
188 if( viewer )
189 {
190 viewer->Destroy();
191 // Destroy() does not immediately delete the viewer, if some events are pending.
192 // (for this reason delete operator cannot be used blindly with "top level" windows)
193 // so gives a slice of time to delete the viewer frame.
194 // This is especially important in OpenGL mode to avoid recreating context before
195 // the old one is deleted.
196 wxSafeYield();
197 }
198
199 SetFocus();
200
201 // Creates the modal Lib browser:
203
204 wxString fpid;
205 ignore_unused( viewer->ShowModal( &fpid, this ) );
206
207 viewer->Destroy();
208
209 return fpid;
210}
211
212
214{
215 FP_LIB_TABLE* fpTable = Prj().PcbFootprintLibs();
216 wxString footprintName;
217 LIB_ID fpid;
218 FOOTPRINT* footprint = nullptr;
219
220 static wxString lastComponentName;
221
222 // Load footprint files:
223 WX_PROGRESS_REPORTER* progressReporter = new WX_PROGRESS_REPORTER( this,
224 _( "Loading Footprint Libraries" ), 3 );
225 GFootprintList.ReadFootprintFiles( fpTable, nullptr, progressReporter );
226 bool cancel = progressReporter->WasCancelled();
227
228 // Force immediate deletion of the WX_PROGRESS_REPORTER. Do not use Destroy(), or use
229 // Destroy() followed by wxSafeYield() because on Windows, APP_PROGRESS_DIALOG and
230 // WX_PROGRESS_REPORTER have some side effects on the event loop manager. For instance, a
231 // subsequent call to ShowModal() or ShowQuasiModal() for a dialog following the use of a
232 // WX_PROGRESS_REPORTER results in incorrect modal or quasi modal behavior.
233 delete progressReporter;
234
235 if( cancel )
236 return nullptr;
237
240
241 wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER> ptr = FP_TREE_MODEL_ADAPTER::Create( this, fpTable );
242 FP_TREE_MODEL_ADAPTER* adapter = static_cast<FP_TREE_MODEL_ADAPTER*>( ptr.get() );
243
244 std::vector<LIB_TREE_ITEM*> historyInfos;
245
246 for( const wxString& item : s_FootprintHistoryList )
247 {
249
250 // this can be null, for example, if the footprint has been deleted from a library.
251 if( fp_info != nullptr )
252 historyInfos.push_back( fp_info );
253 }
254
255 adapter->DoAddLibrary( wxT( "-- " ) + _( "Recently Used" ) + wxT( " --" ), wxEmptyString,
256 historyInfos, false, true );
257
258 if( aPreselect.IsValid() )
259 adapter->SetPreselectNode( aPreselect, 0 );
260 else if( historyInfos.size() )
261 adapter->SetPreselectNode( historyInfos[0]->GetLibId(), 0 );
262
263 adapter->AddLibraries( this );
264
265 wxString title;
266 title.Printf( _( "Choose Footprint (%d items loaded)" ), adapter->GetItemCount() );
267
268 DIALOG_CHOOSE_FOOTPRINT dialog( this, title, ptr );
269
270 if( dialog.ShowQuasiModal() == wxID_CANCEL )
271 return nullptr;
272
273 if( dialog.IsExternalBrowserSelected() )
274 {
275 // SelectFootprintFromLibBrowser() returns the "full" footprint name, i.e.
276 // <lib_name>/<footprint name> or LIB_ID format "lib_name:fp_name:rev#"
277 footprintName = SelectFootprintFromLibBrowser();
278
279 if( footprintName.IsEmpty() ) // Cancel command
280 return nullptr;
281 else
282 fpid.Parse( footprintName );
283 }
284 else
285 {
286 fpid = dialog.GetSelectedLibId();
287
288 if( !fpid.IsValid() )
289 return nullptr;
290 else
291 footprintName = fpid.Format();
292 }
293
294 try
295 {
296 footprint = loadFootprint( fpid );
297 }
298 catch( const IO_ERROR& )
299 {
300 }
301
302 if( footprint )
303 {
304 lastComponentName = footprintName;
305 AddFootprintToHistory( footprintName );
306 }
307
308 return footprint;
309}
310
311
313{
314 FOOTPRINT* footprint = nullptr;
315
316 try
317 {
318 footprint = loadFootprint( aFootprintId );
319 }
320 catch( const IO_ERROR& )
321 {
322 }
323
324 return footprint;
325}
326
327
329{
330 FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs();
331
332 wxCHECK_MSG( fptbl, nullptr, wxT( "Cannot look up LIB_ID in NULL FP_LIB_TABLE." ) );
333
334 FOOTPRINT *footprint = nullptr;
335
336 // When loading a footprint from a library in the footprint editor
337 // the items UUIDs must be keep and not reinitialized
338 bool keepUUID = IsType( FRAME_FOOTPRINT_EDITOR );
339
340 try
341 {
342 footprint = fptbl->FootprintLoadWithOptionalNickname( aFootprintId, keepUUID );
343 }
344 catch( const IO_ERROR& )
345 {
346 }
347
348 // If the footprint is found, clear all net info to be sure there are no broken links to
349 // any netinfo list (should be not needed, but it can be edited from the footprint editor )
350 if( footprint )
351 footprint->ClearAllNets();
352
353 return footprint;
354}
355
356
358{
359 static wxString oldName; // Save name of last footprint selected.
360
361 wxString fpname;
362 wxString msg;
363 wxArrayString listnames;
364
365 for( FOOTPRINT* footprint : aPcb->Footprints() )
366 listnames.Add( footprint->GetReference() );
367
368 msg.Printf( _( "Footprints [%u items]" ), (unsigned) listnames.GetCount() );
369
370 wxArrayString headers;
371
372 headers.Add( _( "Footprint" ) );
373
374 std::vector<wxArrayString> itemsToDisplay;
375
376 // Conversion from wxArrayString to vector of ArrayString
377 for( unsigned i = 0; i < listnames.GetCount(); i++ )
378 {
379 wxArrayString item;
380
381 item.Add( listnames[i] );
382 itemsToDisplay.push_back( item );
383 }
384
385 EDA_LIST_DIALOG dlg( this, msg, headers, itemsToDisplay, wxEmptyString );
386
387 if( dlg.ShowModal() == wxID_OK )
388 fpname = dlg.GetTextSelection();
389 else
390 return nullptr;
391
392 oldName = fpname;
393
394 for( FOOTPRINT* fp : aPcb->Footprints() )
395 {
396 if( fpname == fp->GetReference() )
397 return fp;
398 }
399
400 return nullptr;
401}
402
403
404bool FOOTPRINT_EDIT_FRAME::SaveLibraryAs( const wxString& aLibraryPath )
405{
406 const wxString& curLibPath = aLibraryPath;
407 wxString dstLibPath = CreateNewLibrary( wxEmptyString, aLibraryPath );
408
409 if( !dstLibPath )
410 return false; // user aborted in CreateNewLibrary()
411
412 wxBusyCursor dummy;
413 wxString msg;
414
417
418 try
419 {
420 PLUGIN::RELEASER cur( IO_MGR::PluginFind( curType ) );
421 PLUGIN::RELEASER dst( IO_MGR::PluginFind( dstType ) );
422
423 wxArrayString footprints;
424
425 cur->FootprintEnumerate( footprints, curLibPath, false );
426
427 for( unsigned i = 0; i < footprints.size(); ++i )
428 {
429 const FOOTPRINT* footprint = cur->GetEnumeratedFootprint( curLibPath, footprints[i] );
430 dst->FootprintSave( dstLibPath, footprint );
431
432 msg = wxString::Format( _( "Footprint '%s' saved." ), footprints[i] );
433 SetStatusText( msg );
434 }
435 }
436 catch( const IO_ERROR& ioe )
437 {
438 DisplayError( this, ioe.What() );
439 return false;
440 }
441
442 msg = wxString::Format( _( "Footprint library '%s' saved as '%s'." ),
443 curLibPath,
444 dstLibPath );
445
446 DisplayInfoMessage( this, msg );
447
448 SetStatusText( wxEmptyString );
449 return true;
450}
451
452
453static FOOTPRINT* s_FootprintInitialCopy = nullptr; // Copy of footprint for abort/undo command
454
455static PICKED_ITEMS_LIST s_PickedList; // A pick-list to save initial footprint
456 // and dragged tracks
457
458
460{
461 wxString footprintName;
462 wxArrayString fplist;
463
464 // Build list of available fp references, to display them in dialog
465 for( FOOTPRINT* fp : GetBoard()->Footprints() )
466 fplist.Add( fp->GetReference() + wxT( " ( " ) + fp->GetValue() + wxT( " )" ) );
467
468 fplist.Sort();
469
470 DIALOG_GET_FOOTPRINT_BY_NAME dlg( this, fplist );
471
472 if( dlg.ShowModal() != wxID_OK ) //Aborted by user
473 return nullptr;
474
475 footprintName = dlg.GetValue();
476 footprintName.Trim( true );
477 footprintName.Trim( false );
478
479 if( !footprintName.IsEmpty() )
480 {
481 for( FOOTPRINT* fp : GetBoard()->Footprints() )
482 {
483 if( fp->GetReference().CmpNoCase( footprintName ) == 0 )
484 return fp;
485 }
486 }
487
488 return nullptr;
489}
490
491
492void PCB_BASE_FRAME::PlaceFootprint( FOOTPRINT* aFootprint, bool aRecreateRatsnest )
493{
494 if( aFootprint == nullptr )
495 return;
496
497 OnModify();
498
499 if( aFootprint->IsNew() )
500 {
502 }
503 else if( aFootprint->IsMoving() )
504 {
505 ITEM_PICKER picker( nullptr, aFootprint, UNDO_REDO::CHANGED );
507 s_PickedList.PushItem( picker );
508 s_FootprintInitialCopy = nullptr; // the picker is now owner of s_ModuleInitialCopy.
509 }
510
511 if( s_PickedList.GetCount() )
512 {
514
515 // Clear list, but DO NOT delete items, because they are owned by the saved undo
516 // list and they therefore in use
518 }
519
520 aFootprint->SetPosition( GetCanvas()->GetViewControls()->GetCursorPosition() );
521 aFootprint->ClearFlags();
522
524 s_FootprintInitialCopy = nullptr;
525
526 if( aRecreateRatsnest )
527 m_pcb->GetConnectivity()->Update( aFootprint );
528
529 if( aRecreateRatsnest )
530 Compile_Ratsnest( true );
531
532 SetMsgPanel( aFootprint );
533}
534
535
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:50
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:167
virtual void SetLocked(bool aLocked)
Definition: board_item.h:241
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Definition: board.h:397
FOOTPRINTS & Footprints()
Definition: board.h:307
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:424
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 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
Update the board display after modifying it by a python script (note: it is automatically called by a...
const KIID m_Uuid
Definition: eda_item.h:492
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:143
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.
void ReCreateMenuBar() override
(Re)Create the menubar for the Footprint Editor frame
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:1636
void SetLink(const KIID &aLink)
Definition: footprint.h:630
void SetOrientation(const EDA_ANGLE &aNewAngle)
Definition: footprint.cpp:1766
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: footprint.cpp:1350
const LIB_ID & GetFPID() const
Definition: footprint.h:207
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: footprint.cpp:549
void ClearAllNets()
Clear (i.e.
Definition: footprint.cpp:540
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:1356
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: footprint.cpp:1553
VECTOR2I GetPosition() const override
Definition: footprint.h:192
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:47
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
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:394
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:165
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:40
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.
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:311
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
virtual void OnModify()
Must be called after a change in order to set the "modify" flag of the current screen and update the ...
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:564
virtual void FootprintEnumerate(wxArrayString &aFootprintNames, const wxString &aLibraryPath, bool aBestEfforts, const PROPERTIES *aProperties=nullptr)
Return a list of footprint names contained within the library at aLibraryPath.
Definition: plugin.cpp:67
virtual void FootprintSave(const wxString &aLibraryPath, const FOOTPRINT *aFootprint, const PROPERTIES *aProperties=nullptr)
Write aFootprint to an existing library located at aLibraryPath.
Definition: plugin.cpp:108
virtual const FOOTPRINT * GetEnumeratedFootprint(const wxString &aLibraryPath, const wxString &aFootprintName, const PROPERTIES *aProperties=nullptr)
A version of FootprintLoad() for use after FootprintEnumerate() for more efficient cache management.
Definition: plugin.cpp:80
virtual FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
Definition: project.cpp:318
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:280
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:320
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:412
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
@ 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.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:74
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition: typeinfo.h:87
VECTOR2< double > VECTOR2D
Definition: vector2d.h:617