KiCad PCB EDA Suite
footprint_editor_control.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) 2014-2019 CERN
5 * Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors.
6 * @author Maciej Suminski <[email protected]>
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
27#include <wx/generic/textdlgg.h>
28#include <string_utils.h>
29#include <pgm_base.h>
30#include <tool/tool_manager.h>
31#include <tools/pcb_actions.h>
33#include <pcbnew_id.h>
34#include <confirm.h>
35#include <widgets/wx_infobar.h>
36#include <footprint.h>
37#include <pad.h>
38#include <pcb_group.h>
39#include <zone.h>
40#include <fp_lib_table.h>
44#include <kiway.h>
45#include <drc/drc_item.h>
46
47#include <memory>
48
49
51 PCB_TOOL_BASE( "pcbnew.ModuleEditor" ),
52 m_frame( nullptr ),
53 m_checkerDialog( nullptr )
54{
55}
56
57
59{
60}
61
62
64{
65 m_frame = getEditFrame<FOOTPRINT_EDIT_FRAME>();
66
67 if( m_checkerDialog )
69}
70
71
73{
74 // Build a context menu for the footprint tree
75 //
76 CONDITIONAL_MENU& ctxMenu = m_menu.GetMenu();
77
78 auto libSelectedCondition =
79 [ this ]( const SELECTION& aSel )
80 {
81 LIB_ID sel = m_frame->GetTreeFPID();
82 return !sel.GetLibNickname().empty() && sel.GetLibItemName().empty();
83 };
84
85 // The libInferredCondition allows you to do things like New Symbol and Paste with a
86 // symbol selected (in other words, when we know the library context even if the library
87 // itself isn't selected.
88 auto libInferredCondition =
89 [ this ]( const SELECTION& aSel )
90 {
91 LIB_ID sel = m_frame->GetTreeFPID();
92 return !sel.GetLibNickname().empty();
93 };
94 auto pinnedLibSelectedCondition =
95 [ this ]( const SELECTION& aSel )
96 {
98 return current && current->m_Type == LIB_TREE_NODE::LIB && current->m_Pinned;
99 };
100 auto unpinnedLibSelectedCondition =
101 [ this ](const SELECTION& aSel )
102 {
104 return current && current->m_Type == LIB_TREE_NODE::LIB && !current->m_Pinned;
105 };
106 auto fpSelectedCondition =
107 [ this ]( const SELECTION& aSel )
108 {
109 LIB_ID sel = m_frame->GetTreeFPID();
110 return !sel.GetLibNickname().empty() && !sel.GetLibItemName().empty();
111 };
112
113 ctxMenu.AddItem( ACTIONS::pinLibrary, unpinnedLibSelectedCondition );
114 ctxMenu.AddItem( ACTIONS::unpinLibrary, pinnedLibSelectedCondition );
115
116 ctxMenu.AddSeparator();
117 ctxMenu.AddItem( PCB_ACTIONS::newFootprint, libSelectedCondition );
118 ctxMenu.AddItem( PCB_ACTIONS::createFootprint, libSelectedCondition );
119
120 ctxMenu.AddSeparator();
122 ctxMenu.AddItem( ACTIONS::saveAs, libSelectedCondition || fpSelectedCondition );
123 ctxMenu.AddItem( ACTIONS::revert, libSelectedCondition || libInferredCondition );
124
125 ctxMenu.AddSeparator();
126 ctxMenu.AddItem( PCB_ACTIONS::cutFootprint, fpSelectedCondition );
127 ctxMenu.AddItem( PCB_ACTIONS::copyFootprint, fpSelectedCondition );
128 ctxMenu.AddItem( PCB_ACTIONS::pasteFootprint, libInferredCondition );
129 ctxMenu.AddItem( PCB_ACTIONS::duplicateFootprint, fpSelectedCondition );
130 ctxMenu.AddItem( PCB_ACTIONS::renameFootprint, fpSelectedCondition );
131 ctxMenu.AddItem( PCB_ACTIONS::deleteFootprint, fpSelectedCondition );
132
133 ctxMenu.AddSeparator();
134 ctxMenu.AddItem( PCB_ACTIONS::importFootprint, libInferredCondition );
135 ctxMenu.AddItem( PCB_ACTIONS::exportFootprint, fpSelectedCondition );
136
137 // If we've got nothing else to show, at least show a hide tree option
138 ctxMenu.AddItem( PCB_ACTIONS::hideFootprintTree, !libInferredCondition );
139
140 return true;
141}
142
143
145{
146 LIB_ID selected = m_frame->GetTreeFPID();
147 FOOTPRINT* newFootprint = m_frame->CreateNewFootprint( wxEmptyString );
148
149 if( !newFootprint )
150 return 0;
151
152 if( !m_frame->Clear_Pcb( true ) )
153 return 0;
154
156 m_frame->AddFootprintToBoard( newFootprint );
157
158 // Initialize data relative to nets and netclasses (for a new footprint the defaults are
159 // used). This is mandatory to handle and draw pads.
161 newFootprint->SetPosition( wxPoint( 0, 0 ) );
162 newFootprint->ClearFlags();
163
164 m_frame->Zoom_Automatique( false );
166
167 // If selected from the library tree then go ahead and save it there
168 if( !selected.GetLibNickname().empty() )
169 {
170 LIB_ID fpid = newFootprint->GetFPID();
171 fpid.SetLibNickname( selected.GetLibNickname() );
172 newFootprint->SetFPID( fpid );
173 m_frame->SaveFootprint( newFootprint );
175 }
176
178 m_frame->Update3DView( true, true );
179
180 m_frame->SyncLibraryTree( false );
181 return 0;
182}
183
184
186{
187 LIB_ID selected = m_frame->GetTreeFPID();
188
190 {
191 if( !HandleUnsavedChanges( m_frame, _( "The current footprint has been modified. "
192 "Save changes?" ),
193 [&]() -> bool
194 {
195 return m_frame->SaveFootprint( footprint() );
196 } ) )
197 {
198 return 0;
199 }
200 }
201
203 true, m_frame );
204
205 if( wizard->ShowModal( nullptr, m_frame ) )
206 {
207 // Creates the new footprint from python script wizard
208 FOOTPRINT* newFootprint = wizard->GetBuiltFootprint();
209
210 if( newFootprint ) // i.e. if create footprint command is OK
211 {
212 m_frame->Clear_Pcb( false );
213
215 // Add the new object to board
216 m_frame->AddFootprintToBoard( newFootprint );
217
218 // Initialize data relative to nets and netclasses (for a new footprint the defaults
219 // are used). This is mandatory to handle and draw pads.
221 newFootprint->SetPosition( wxPoint( 0, 0 ) );
222 newFootprint->ClearFlags();
223
224 m_frame->Zoom_Automatique( false );
226 m_frame->OnModify();
227
228 // If selected from the library tree then go ahead and save it there
229 if( !selected.GetLibNickname().empty() )
230 {
231 LIB_ID fpid = newFootprint->GetFPID();
232 fpid.SetLibNickname( selected.GetLibNickname() );
233 newFootprint->SetFPID( fpid );
234 m_frame->SaveFootprint( newFootprint );
236 }
237
239 canvas()->Refresh();
240 m_frame->Update3DView( true, true );
241
242 m_frame->SyncLibraryTree( false );
243 }
244 }
245
246 wizard->Destroy();
247 return 0;
248}
249
250
252{
253 if( !footprint() ) // no loaded footprint
254 return 0;
255
257 {
259 {
260 view()->Update( footprint() );
261
262 canvas()->ForceRefresh();
265 }
266 }
267
269 return 0;
270}
271
272
274{
276 {
277 // Save Library As
278 const wxString& src_libNickname = m_frame->GetTargetFPID().GetLibNickname();
279 wxString src_libFullName = m_frame->Prj().PcbFootprintLibs()->GetFullURI( src_libNickname );
280
281 if( m_frame->SaveLibraryAs( src_libFullName ) )
282 m_frame->SyncLibraryTree( true );
283 }
284 else if( m_frame->GetTargetFPID() == m_frame->GetLoadedFPID() )
285 {
286 // Save Footprint As
288 {
289 view()->Update( footprint() );
291
292 // Get rid of the save-will-update-board-only (or any other dismissable warning)
293 WX_INFOBAR* infobar = m_frame->GetInfoBar();
294
295 if( infobar->IsShown() && infobar->HasCloseButton() )
296 infobar->Dismiss();
297
298 canvas()->ForceRefresh();
299 m_frame->SyncLibraryTree( true );
300 }
301 }
302 else
303 {
304 // Save Selected Footprint As
306
308 {
309 m_frame->SyncLibraryTree( true );
311 }
312 }
313
315 return 0;
316}
317
318
320{
321 getEditFrame<FOOTPRINT_EDIT_FRAME>()->RevertFootprint();
322 return 0;
323}
324
325
327{
328 LIB_ID fpID = m_frame->GetTreeFPID();
329
330 if( fpID == m_frame->GetLoadedFPID() )
331 {
332 m_copiedFootprint = std::make_unique<FOOTPRINT>( *m_frame->GetBoard()->GetFirstFootprint() );
333 m_copiedFootprint->SetParent( nullptr );
334 }
335 else
336 {
337 m_copiedFootprint.reset( m_frame->LoadFootprint( fpID ) );
338 }
339
340 if( aEvent.IsAction( &PCB_ACTIONS::cutFootprint ) )
341 DeleteFootprint( aEvent );
342
343 return 0;
344}
345
346
348{
350 {
351 wxString newLib = m_frame->GetTreeFPID().GetLibNickname();
352 wxString newName = m_copiedFootprint->GetFPID().GetLibItemName();
353
354 while( m_frame->Prj().PcbFootprintLibs()->FootprintExists( newLib, newName ) )
355 newName += _( "_copy" );
356
357 m_copiedFootprint->SetFPID( LIB_ID( newLib, newName ) );
359
360 m_frame->SyncLibraryTree( true );
364 }
365
366 return 0;
367}
368
369
371{
372 LIB_ID fpID = m_frame->GetTreeFPID();
374
375 if( fpID == m_frame->GetLoadedFPID() )
377 else
379
381 {
382 m_frame->SyncLibraryTree( true );
386 }
387
388 return 0;
389}
390
391
393{
395 LIB_ID fpID = m_frame->GetTreeFPID();
396 wxString libraryName = fpID.GetLibNickname();
397 wxString oldName = fpID.GetLibItemName();
398 wxString newName = oldName;
399 bool done = false;
400
401 while( !done )
402 {
403 wxTextEntryDialog dlg( m_frame, _( "New name:" ), _( "Change Footprint Name" ), newName );
404
405 if( dlg.ShowModal() != wxID_OK )
406 return 0; // canceled by user
407
408 newName = dlg.GetValue();
409 newName.Trim( true ).Trim( false );
410
411 if( newName.IsEmpty() )
412 {
413 DisplayErrorMessage( m_frame, _( "Footprint name cannot be empty." ) );
414 }
415 else if( tbl->FootprintExists( libraryName, newName ) )
416 {
417 DisplayErrorMessage( m_frame, wxString::Format( _( "Footprint name '%s' already "
418 "in use in library '%s'." ),
419 UnescapeString( newName ),
420 libraryName ) );
421 newName = oldName;
422 }
423 else
424 {
425 done = true;
426 }
427 }
428
429 FOOTPRINT* footprint = nullptr;
430
431 if( fpID == m_frame->GetLoadedFPID() )
432 {
434
435 if( footprint )
436 {
437 footprint->SetFPID( LIB_ID( libraryName, newName ) );
438
439 if( footprint->GetValue() == oldName )
440 footprint->SetValue( newName );
441
442 m_frame->OnModify();
444 }
445 }
446 else
447 {
449
450 if( footprint )
451 {
452 try
453 {
454 footprint->SetFPID( LIB_ID( libraryName, newName ) );
455
456 if( footprint->GetValue() == oldName )
457 footprint->SetValue( newName );
458
460
461 m_frame->Prj().PcbFootprintLibs()->FootprintDelete( libraryName, oldName );
462 }
463 catch( const IO_ERROR& ioe )
464 {
465 DisplayError( m_frame, ioe.What() );
466 }
467 catch( ... )
468 {
469 // Best efforts...
470 }
471 }
472 }
473
474 wxDataViewItem treeItem = m_frame->GetLibTreeAdapter()->FindItem( fpID );
475 m_frame->UpdateLibraryTree( treeItem, footprint );
476 m_frame->FocusOnLibID( LIB_ID( libraryName, newName ) );
477
478 return 0;
479}
480
481
483{
484 FOOTPRINT_EDIT_FRAME* frame = getEditFrame<FOOTPRINT_EDIT_FRAME>();
485
486 if( frame->DeleteFootprintFromLibrary( frame->GetTargetFPID(), true ) )
487 {
488 if( frame->GetTargetFPID() == frame->GetLoadedFPID() )
489 frame->Clear_Pcb( false );
490
491 frame->SyncLibraryTree( true );
492 }
493
494 return 0;
495}
496
497
499{
500 bool is_last_fp_from_brd = m_frame->IsCurrentFPFromBoard();
501
502 if( !m_frame->Clear_Pcb( true ) )
503 return -1; // this command is aborted
504
507
510
512
513 // Update the save items if needed.
514 if( is_last_fp_from_brd )
515 {
518 }
519
521 m_frame->OnModify();
522 return 0;
523}
524
525
527{
528 LIB_ID fpID = m_frame->GetTreeFPID();
529 FOOTPRINT* fp;
530
531 if( !fpID.IsValid() )
533 else
534 fp = m_frame->LoadFootprint( fpID );
535
537 return 0;
538}
539
540
542{
544 return 0;
545}
546
547
549{
550 LIB_TREE_NODE* currentNode = m_frame->GetCurrentTreeNode();
551
552 if( currentNode && !currentNode->m_Pinned )
553 {
554 m_frame->Prj().PinLibrary( currentNode->m_LibId.GetLibNickname(), false );
555
556 currentNode->m_Pinned = true;
558 }
559
560 return 0;
561}
562
563
565{
566 LIB_TREE_NODE* currentNode = m_frame->GetCurrentTreeNode();
567
568 if( currentNode && currentNode->m_Pinned )
569 {
570 m_frame->Prj().UnpinLibrary( currentNode->m_LibId.GetLibNickname(), false );
571
572 currentNode->m_Pinned = false;
574 }
575
576 return 0;
577}
578
579
581{
583 return 0;
584}
585
586
588{
590 return 0;
591}
592
593
595{
597
598 if( footprint )
599 {
600 getEditFrame<FOOTPRINT_EDIT_FRAME>()->OnEditItemRequest( footprint );
602 }
603 return 0;
604}
605
606
608{
609 getEditFrame<FOOTPRINT_EDIT_FRAME>()->ShowPadPropertiesDialog( nullptr );
610 return 0;
611}
612
613
615{
616 FOOTPRINT_EDIT_FRAME* editFrame = getEditFrame<FOOTPRINT_EDIT_FRAME>();
617 DIALOG_CLEANUP_GRAPHICS dlg( editFrame, true );
618
619 dlg.ShowModal();
620 return 0;
621}
622
623
625{
626 if( !m_checkerDialog )
627 {
629
630 m_checkerDialog->Show( true );
631 }
632 else // The dialog is just not visible (because the user has double clicked on an error item)
633 {
634 m_checkerDialog->Show( true );
635 }
636
637 return 0;
638}
639
640
642{
643 if( !m_checkerDialog )
645
646 if( !m_checkerDialog->IsShown() )
647 m_checkerDialog->Show( true );
648
649 m_checkerDialog->SelectMarker( aMarker );
650}
651
652
654{
655 if( m_checkerDialog )
656 {
657 m_checkerDialog->Destroy();
658 m_checkerDialog = nullptr;
659 }
660}
661
662
664{
665 FOOTPRINT* footprint = board()->Footprints().front();
666 int errors = 0;
667 wxString details;
668
669 // Repair duplicate IDs and missing nets.
670 std::set<KIID> ids;
671 int duplicates = 0;
672
673 auto processItem =
674 [&]( EDA_ITEM* aItem )
675 {
676 if( ids.count( aItem->m_Uuid ) )
677 {
678 duplicates++;
679 const_cast<KIID&>( aItem->m_Uuid ) = KIID();
680 }
681
682 ids.insert( aItem->m_Uuid );
683 };
684
685 // Footprint IDs are the most important, so give them the first crack at "claiming" a
686 // particular KIID.
687
688 processItem( footprint );
689
690 // After that the principal use is for DRC marker pointers, which are most likely to pads.
691
692 for( PAD* pad : footprint->Pads() )
693 processItem( pad );
694
695 // From here out I don't think order matters much.
696
697 processItem( &footprint->Reference() );
698 processItem( &footprint->Value() );
699
700 for( BOARD_ITEM* item : footprint->GraphicalItems() )
701 processItem( item );
702
703 for( ZONE* zone : footprint->Zones() )
704 processItem( zone );
705
706 for( PCB_GROUP* group : footprint->Groups() )
707 processItem( group );
708
709 if( duplicates )
710 {
711 errors += duplicates;
712 details += wxString::Format( _( "%d duplicate IDs replaced.\n" ), duplicates );
713 }
714
715 /*******************************
716 * Your test here
717 */
718
719 /*******************************
720 * Inform the user
721 */
722
723 if( errors )
724 {
725 m_frame->OnModify();
726
727 wxString msg = wxString::Format( _( "%d potential problems repaired." ), errors );
728 DisplayInfoMessage( m_frame, msg, details );
729 }
730 else
731 {
732 DisplayInfoMessage( m_frame, _( "No footprint problems found." ) );
733 }
734
735 return 0;
736}
737
738
740{
749
754
757
760
763
771}
static TOOL_ACTION revert
Definition: actions.h:55
static TOOL_ACTION saveAs
Definition: actions.h:52
static TOOL_ACTION pinLibrary
Definition: actions.h:112
static TOOL_ACTION save
Definition: actions.h:51
static TOOL_ACTION zoomFitScreen
Definition: actions.h:98
static TOOL_ACTION unpinLibrary
Definition: actions.h:113
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:58
void BuildListOfNets()
Definition: board.h:744
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Definition: board.h:397
FOOTPRINTS & Footprints()
Definition: board.h:307
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Add a menu entry to run a TOOL_ACTION on selected items.
void AddSeparator(int aOrder=ANY_ORDER)
Add a separator to the menu.
void SelectMarker(const PCB_MARKER *aMarker)
bool Show(bool show) override
virtual void ClearUndoRedoList()
Clear the undo and redo list using ClearUndoORRedoList()
void ReCreateMenuBar()
Recreates the menu bar.
WX_INFOBAR * GetInfoBar()
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.
void ForceRefresh()
Force a redraw.
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...
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:141
int Revert(const TOOL_EVENT &aEvent)
int PinLibrary(const TOOL_EVENT &aEvent)
int PasteFootprint(const TOOL_EVENT &aEvent)
DIALOG_FOOTPRINT_CHECKER * m_checkerDialog
int ToggleFootprintTree(const TOOL_EVENT &aEvent)
int CutCopyFootprint(const TOOL_EVENT &aEvent)
int EditFootprint(const TOOL_EVENT &aEvent)
int Save(const TOOL_EVENT &aEvent)
void Reset(RESET_REASON aReason) override
Bring the tool to a known, initial state.
int CreateFootprint(const TOOL_EVENT &aEvent)
FOOTPRINT_EDIT_FRAME * m_frame
int NewFootprint(const TOOL_EVENT &aEvent)
int DefaultPadProperties(const TOOL_EVENT &aEvent)
Edit the properties used for new pad creation.
void CrossProbe(const PCB_MARKER *aMarker)
int ImportFootprint(const TOOL_EVENT &aEvent)
int CleanupGraphics(const TOOL_EVENT &aEvent)
int UnpinLibrary(const TOOL_EVENT &aEvent)
int Properties(const TOOL_EVENT &aEvent)
int ToggleLayersManager(const TOOL_EVENT &aEvent)
int RepairFootprint(const TOOL_EVENT &aEvent)
int RenameFootprint(const TOOL_EVENT &aEvent)
int DuplicateFootprint(const TOOL_EVENT &aEvent)
std::unique_ptr< FOOTPRINT > m_copiedFootprint
bool Init() override
Init() is called once upon a registration of the tool.
int ExportFootprint(const TOOL_EVENT &aEvent)
int DeleteFootprint(const TOOL_EVENT &aEvent)
int SaveAs(const TOOL_EVENT &aEvent)
void setTransitions() override
< Set up handlers for various events.
int CheckFootprint(const TOOL_EVENT &aEvent)
void UpdateLibraryTree(const wxDataViewItem &treeItem, FOOTPRINT *aFootprint)
Update a single node in the library tree.
void SyncLibraryTree(bool aProgress)
Synchronize the footprint library tree to the current state of the footprint library table.
bool SaveFootprintInLibrary(FOOTPRINT *aFootprint, const wxString &aLibraryName)
bool SaveLibraryAs(const wxString &aLibraryPath)
Save a library to a new name and/or library type.
bool SaveFootprintAs(FOOTPRINT *aFootprint)
bool DuplicateFootprint(FOOTPRINT *aFootprint)
void ExportFootprint(FOOTPRINT *aFootprint)
Create a file containing only one footprint.
LIB_ID GetTargetFPID() const
Return the LIB_ID of the part selected in the footprint tree, or the loaded part if there is no selec...
LIB_ID GetLoadedFPID() const
Return the LIB_ID of the part being edited.
LIB_TREE_NODE * GetCurrentTreeNode() const
bool SaveFootprint(FOOTPRINT *aFootprint)
Save in an existing library a given footprint.
LIB_ID GetTreeFPID() const
Return the LIB_ID of the part or library selected in the footprint tree.
void LoadFootprintFromLibrary(LIB_ID aFPID)
wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > & GetLibTreeAdapter()
Return the adapter object that provides the stored data.
FOOTPRINT * ImportFootprint(const wxString &aName=wxT(""))
Read a file containing only one footprint.
void ReCreateHToolbar() override
Create the main horizontal toolbar for the footprint editor.
bool IsContentModified() const override
Get if any footprints or libraries have been modified but not saved.
void RegenerateLibraryTree()
Filter, sort, and redisplay the library tree.
void AddFootprintToBoard(FOOTPRINT *aFootprint) override
Override from PCB_BASE_EDIT_FRAME which adds a footprint to the editor's dummy board,...
void OnModify() override
Must be called after a footprint change in order to set the "modify" flag of the current screen and p...
bool Clear_Pcb(bool aQuery)
Delete all and reinitialize the current board.
Definition: initpcb.cpp:97
void FocusOnLibID(const LIB_ID &aLibID)
void RefreshLibraryTree()
Redisplay the library tree.
void SetPosition(const VECTOR2I &aPos) override
Definition: footprint.cpp:1670
void SetFPID(const LIB_ID &aFPID)
Definition: footprint.h:213
FP_GROUPS & Groups()
Definition: footprint.h:179
PADS & Pads()
Definition: footprint.h:170
const LIB_ID & GetFPID() const
Definition: footprint.h:212
void SetValue(const wxString &aValue)
Definition: footprint.h:555
FP_TEXT & Value()
read/write accessors:
Definition: footprint.h:567
const wxString & GetValue() const
Definition: footprint.h:547
FP_ZONES & Zones()
Definition: footprint.h:176
DRAWINGS & GraphicalItems()
Definition: footprint.h:173
FP_TEXT & Reference()
Definition: footprint.h:568
void FootprintDelete(const wxString &aNickname, const wxString &aFootprintName)
Delete the aFootprintName from the library given by aNickname.
bool FootprintExists(const wxString &aNickname, const wxString &aFootprintName)
Indicates whether or not the given footprint already exists in the given library.
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
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: pcb_view.cpp:92
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.
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
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
bool IsValid() const
Check if this LID_ID is valid.
Definition: lib_id.h:172
int SetLibNickname(const UTF8 &aNickname)
Override the logical library name portion of the LIB_ID to aNickname.
Definition: lib_id.cpp:98
const UTF8 & GetLibItemName() const
Definition: lib_id.h:102
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:87
wxString GetFullURI(const wxString &aLibNickname, bool aExpandEnvVars=true) const
Return the full URI of the library mapped to aLibNickname.
Model class in the component selector Model-View-Adapter (mediated MVC) architecture.
enum TYPE m_Type
Definition: pad.h:59
static TOOL_ACTION deleteFootprint
Definition: pcb_actions.h:413
static TOOL_ACTION renameFootprint
Definition: pcb_actions.h:412
static TOOL_ACTION showLayersManager
Definition: pcb_actions.h:389
static TOOL_ACTION createFootprint
Definition: pcb_actions.h:403
static TOOL_ACTION hideFootprintTree
Definition: pcb_actions.h:396
static TOOL_ACTION editFootprint
Definition: pcb_actions.h:410
static TOOL_ACTION exportFootprint
Definition: pcb_actions.h:418
static TOOL_ACTION showFootprintTree
Definition: pcb_actions.h:395
static TOOL_ACTION editTextAndGraphics
Definition: pcb_actions.h:360
static TOOL_ACTION newFootprint
Definition: pcb_actions.h:400
static TOOL_ACTION defaultPadProperties
Definition: pcb_actions.h:421
static TOOL_ACTION importFootprint
Definition: pcb_actions.h:417
static TOOL_ACTION pasteFootprint
Definition: pcb_actions.h:416
static TOOL_ACTION footprintProperties
Definition: pcb_actions.h:420
static TOOL_ACTION checkFootprint
Definition: pcb_actions.h:423
static TOOL_ACTION duplicateFootprint
Definition: pcb_actions.h:411
static TOOL_ACTION cutFootprint
Definition: pcb_actions.h:414
static TOOL_ACTION repairFootprint
Definition: pcb_actions.h:491
static TOOL_ACTION copyFootprint
Definition: pcb_actions.h:415
static TOOL_ACTION cleanupGraphics
Definition: pcb_actions.h:363
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
FOOTPRINT * CreateNewFootprint(const wxString &aFootprintName, bool aQuiet=false)
Creates a new footprint, at position 0,0.
virtual void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:51
KIGFX::PCB_VIEW * view() const
PCB_BASE_EDIT_FRAME * frame() const
BOARD * board() const
PCB_DRAW_PANEL_GAL * canvas() const
FOOTPRINT * footprint() const
void UnpinLibrary(const wxString &aLibrary, bool isSymbolLibrary)
Definition: project.cpp:177
virtual FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
Definition: project.cpp:324
void PinLibrary(const wxString &aLibrary, bool isSymbolLibrary)
Definition: project.cpp:156
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
RESET_REASON
Determine the reason of reset for a tool.
Definition: tool_base.h:78
Generic, UI-independent tool event.
Definition: tool_event.h:156
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
Definition: tool_event.cpp:88
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Define which state (aStateFunc) to go when a certain event arrives (aConditions).
TOOL_MENU m_menu
The functions below are not yet implemented - their interface may change.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:142
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:44
bool empty() const
Definition: utf8.h:103
A modified version of the wxInfoBar class that allows us to:
Definition: wx_infobar.h:75
bool HasCloseButton() const
Definition: wx_infobar.cpp:313
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Definition: wx_infobar.cpp:175
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:300
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:352
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:260
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:325
This file is part of the common library.
#define _(s)
@ FRAME_FOOTPRINT_WIZARD
Definition: frame_type.h:44
see class PGM_BASE
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
wxString UnescapeString(const wxString &aSource)
VECTOR2< double > VECTOR2D
Definition: vector2d.h:617