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/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
49 PCB_TOOL_BASE( "pcbnew.ModuleEditor" ),
50 m_frame( nullptr ),
51 m_checkerDialog( nullptr )
52{
53}
54
55
57{
58}
59
60
62{
63 m_frame = getEditFrame<FOOTPRINT_EDIT_FRAME>();
64
65 if( m_checkerDialog )
67}
68
69
71{
72 // Build a context menu for the footprint tree
73 //
74 CONDITIONAL_MENU& ctxMenu = m_menu.GetMenu();
75
76 auto libSelectedCondition =
77 [ this ]( const SELECTION& aSel )
78 {
79 LIB_ID sel = m_frame->GetTreeFPID();
80 return !sel.GetLibNickname().empty() && sel.GetLibItemName().empty();
81 };
82
83 // The libInferredCondition allows you to do things like New Symbol and Paste with a
84 // symbol selected (in other words, when we know the library context even if the library
85 // itself isn't selected.
86 auto libInferredCondition =
87 [ this ]( const SELECTION& aSel )
88 {
89 LIB_ID sel = m_frame->GetTreeFPID();
90 return !sel.GetLibNickname().empty();
91 };
92 auto pinnedLibSelectedCondition =
93 [ this ]( const SELECTION& aSel )
94 {
96 return current && current->m_Type == LIB_TREE_NODE::LIB && current->m_Pinned;
97 };
98 auto unpinnedLibSelectedCondition =
99 [ this ](const SELECTION& aSel )
100 {
102 return current && current->m_Type == LIB_TREE_NODE::LIB && !current->m_Pinned;
103 };
104 auto fpSelectedCondition =
105 [ this ]( const SELECTION& aSel )
106 {
107 LIB_ID sel = m_frame->GetTreeFPID();
108 return !sel.GetLibNickname().empty() && !sel.GetLibItemName().empty();
109 };
110
111 ctxMenu.AddItem( ACTIONS::pinLibrary, unpinnedLibSelectedCondition );
112 ctxMenu.AddItem( ACTIONS::unpinLibrary, pinnedLibSelectedCondition );
113
114 ctxMenu.AddSeparator();
115 ctxMenu.AddItem( PCB_ACTIONS::newFootprint, libSelectedCondition );
116 ctxMenu.AddItem( PCB_ACTIONS::createFootprint, libSelectedCondition );
117
118 ctxMenu.AddSeparator();
120 ctxMenu.AddItem( ACTIONS::saveAs, libSelectedCondition || fpSelectedCondition );
121 ctxMenu.AddItem( ACTIONS::revert, libSelectedCondition || libInferredCondition );
122
123 ctxMenu.AddSeparator();
124 ctxMenu.AddItem( PCB_ACTIONS::cutFootprint, fpSelectedCondition );
125 ctxMenu.AddItem( PCB_ACTIONS::copyFootprint, fpSelectedCondition );
126 ctxMenu.AddItem( PCB_ACTIONS::pasteFootprint, libInferredCondition );
127 ctxMenu.AddItem( PCB_ACTIONS::duplicateFootprint, fpSelectedCondition );
128 ctxMenu.AddItem( PCB_ACTIONS::renameFootprint, fpSelectedCondition );
129 ctxMenu.AddItem( PCB_ACTIONS::deleteFootprint, fpSelectedCondition );
130
131 ctxMenu.AddSeparator();
132 ctxMenu.AddItem( PCB_ACTIONS::importFootprint, libInferredCondition );
133 ctxMenu.AddItem( PCB_ACTIONS::exportFootprint, fpSelectedCondition );
134
135 // If we've got nothing else to show, at least show a hide tree option
136 ctxMenu.AddItem( PCB_ACTIONS::hideFootprintTree, !libInferredCondition );
137
138 return true;
139}
140
141
143{
144 LIB_ID selected = m_frame->GetTreeFPID();
145 FOOTPRINT* newFootprint = m_frame->CreateNewFootprint( wxEmptyString );
146
147 if( !newFootprint )
148 return 0;
149
150 if( !m_frame->Clear_Pcb( true ) )
151 return 0;
152
154 m_frame->AddFootprintToBoard( newFootprint );
155
156 // Initialize data relative to nets and netclasses (for a new footprint the defaults are
157 // used). This is mandatory to handle and draw pads.
159 newFootprint->SetPosition( wxPoint( 0, 0 ) );
160 newFootprint->ClearFlags();
161
162 m_frame->Zoom_Automatique( false );
164
165 // If selected from the library tree then go ahead and save it there
166 if( !selected.GetLibNickname().empty() )
167 {
168 LIB_ID fpid = newFootprint->GetFPID();
169 fpid.SetLibNickname( selected.GetLibNickname() );
170 newFootprint->SetFPID( fpid );
171 m_frame->SaveFootprint( newFootprint );
173 }
174
176 m_frame->Update3DView( true, true );
177
178 m_frame->SyncLibraryTree( false );
179 return 0;
180}
181
182
184{
185 LIB_ID selected = m_frame->GetTreeFPID();
186
188 {
189 if( !HandleUnsavedChanges( m_frame, _( "The current footprint has been modified. "
190 "Save changes?" ),
191 [&]() -> bool
192 {
193 return m_frame->SaveFootprint( footprint() );
194 } ) )
195 {
196 return 0;
197 }
198 }
199
201 true, m_frame );
202
203 if( wizard->ShowModal( nullptr, m_frame ) )
204 {
205 // Creates the new footprint from python script wizard
206 FOOTPRINT* newFootprint = wizard->GetBuiltFootprint();
207
208 if( newFootprint ) // i.e. if create footprint command is OK
209 {
210 m_frame->Clear_Pcb( false );
211
213 // Add the new object to board
214 m_frame->AddFootprintToBoard( newFootprint );
215
216 // Initialize data relative to nets and netclasses (for a new footprint the defaults
217 // are used). This is mandatory to handle and draw pads.
219 newFootprint->SetPosition( wxPoint( 0, 0 ) );
220 newFootprint->ClearFlags();
221
222 m_frame->Zoom_Automatique( false );
224 m_frame->OnModify();
225
226 // If selected from the library tree then go ahead and save it there
227 if( !selected.GetLibNickname().empty() )
228 {
229 LIB_ID fpid = newFootprint->GetFPID();
230 fpid.SetLibNickname( selected.GetLibNickname() );
231 newFootprint->SetFPID( fpid );
232 m_frame->SaveFootprint( newFootprint );
234 }
235
237 canvas()->Refresh();
238 m_frame->Update3DView( true, true );
239
240 m_frame->SyncLibraryTree( false );
241 }
242 }
243
244 wizard->Destroy();
245 return 0;
246}
247
248
250{
251 if( !footprint() ) // no loaded footprint
252 return 0;
253
255 {
257 {
258 view()->Update( footprint() );
259
260 canvas()->ForceRefresh();
263 }
264 }
265
267 return 0;
268}
269
270
272{
274 {
275 // Save Library As
276 const wxString& src_libNickname = m_frame->GetTargetFPID().GetLibNickname();
277 wxString src_libFullName = m_frame->Prj().PcbFootprintLibs()->GetFullURI( src_libNickname );
278
279 if( m_frame->SaveLibraryAs( src_libFullName ) )
280 m_frame->SyncLibraryTree( true );
281 }
282 else if( m_frame->GetTargetFPID() == m_frame->GetLoadedFPID() )
283 {
284 // Save Footprint As
286 {
287 view()->Update( footprint() );
289
290 // Get rid of the save-will-update-board-only (or any other dismissable warning)
291 WX_INFOBAR* infobar = m_frame->GetInfoBar();
292
293 if( infobar->IsShown() && infobar->HasCloseButton() )
294 infobar->Dismiss();
295
296 canvas()->ForceRefresh();
297 m_frame->SyncLibraryTree( true );
298 }
299 }
300 else
301 {
302 // Save Selected Footprint As
304
306 {
307 m_frame->SyncLibraryTree( true );
309 }
310 }
311
313 return 0;
314}
315
316
318{
319 getEditFrame<FOOTPRINT_EDIT_FRAME>()->RevertFootprint();
320 return 0;
321}
322
323
325{
326 LIB_ID fpID = m_frame->GetTreeFPID();
327
328 if( fpID == m_frame->GetLoadedFPID() )
330 else
331 m_copiedFootprint.reset( m_frame->LoadFootprint( fpID ) );
332
333 if( aEvent.IsAction( &PCB_ACTIONS::cutFootprint ) )
334 DeleteFootprint( aEvent );
335
336 return 0;
337}
338
339
341{
343 {
344 wxString newLib = m_frame->GetTreeFPID().GetLibNickname();
345 wxString newName = m_copiedFootprint->GetFPID().GetLibItemName();
346
347 while( m_frame->Prj().PcbFootprintLibs()->FootprintExists( newLib, newName ) )
348 newName += _( "_copy" );
349
350 m_copiedFootprint->SetFPID( LIB_ID( newLib, newName ) );
352
353 m_frame->SyncLibraryTree( true );
357 }
358
359 return 0;
360}
361
362
364{
365 LIB_ID fpID = m_frame->GetTreeFPID();
367
368 if( fpID == m_frame->GetLoadedFPID() )
370 else
372
374 {
375 m_frame->SyncLibraryTree( true );
379 }
380
381 return 0;
382}
383
384
386{
388 LIB_ID fpID = m_frame->GetTreeFPID();
389 wxString libraryName = fpID.GetLibNickname();
390 wxString oldName = fpID.GetLibItemName();
391 wxString newName = oldName;
392 bool done = false;
393
394 while( !done )
395 {
396 wxTextEntryDialog dlg( m_frame, _( "New name:" ), _( "Change Footprint Name" ), newName );
397
398 if( dlg.ShowModal() != wxID_OK )
399 return 0; // canceled by user
400
401 newName = dlg.GetValue();
402 newName.Trim( true ).Trim( false );
403
404 if( newName.IsEmpty() )
405 {
406 DisplayErrorMessage( m_frame, _( "Footprint name cannot be empty." ) );
407 }
408 else if( tbl->FootprintExists( libraryName, newName ) )
409 {
410 DisplayErrorMessage( m_frame, wxString::Format( _( "Footprint name '%s' already "
411 "in use in library '%s'." ),
412 UnescapeString( newName ),
413 libraryName ) );
414 newName = oldName;
415 }
416 else
417 {
418 done = true;
419 }
420 }
421
422 FOOTPRINT* footprint = nullptr;
423
424 if( fpID == m_frame->GetLoadedFPID() )
425 {
427
428 if( footprint )
429 {
430 footprint->SetFPID( LIB_ID( libraryName, newName ) );
431
432 if( footprint->GetValue() == oldName )
433 footprint->SetValue( newName );
434
435 m_frame->OnModify();
437 }
438 }
439 else
440 {
442
443 if( footprint )
444 {
445 try
446 {
447 footprint->SetFPID( LIB_ID( libraryName, newName ) );
448
449 if( footprint->GetValue() == oldName )
450 footprint->SetValue( newName );
451
453
454 m_frame->Prj().PcbFootprintLibs()->FootprintDelete( libraryName, oldName );
455 }
456 catch( const IO_ERROR& ioe )
457 {
458 DisplayError( m_frame, ioe.What() );
459 }
460 catch( ... )
461 {
462 // Best efforts...
463 }
464 }
465 }
466
467 wxDataViewItem treeItem = m_frame->GetLibTreeAdapter()->FindItem( fpID );
468 m_frame->UpdateLibraryTree( treeItem, footprint );
469 m_frame->FocusOnLibID( LIB_ID( libraryName, newName ) );
470
471 return 0;
472}
473
474
476{
477 FOOTPRINT_EDIT_FRAME* frame = getEditFrame<FOOTPRINT_EDIT_FRAME>();
478
479 if( frame->DeleteFootprintFromLibrary( frame->GetTargetFPID(), true ) )
480 {
481 if( frame->GetTargetFPID() == frame->GetLoadedFPID() )
482 frame->Clear_Pcb( false );
483
484 frame->SyncLibraryTree( true );
485 }
486
487 return 0;
488}
489
490
492{
493 bool is_last_fp_from_brd = m_frame->IsCurrentFPFromBoard();
494
495 if( !m_frame->Clear_Pcb( true ) )
496 return -1; // this command is aborted
497
500
503
505
506 // Update the save items if needed.
507 if( is_last_fp_from_brd )
508 {
511 }
512
514 m_frame->OnModify();
515 return 0;
516}
517
518
520{
521 LIB_ID fpID = m_frame->GetTreeFPID();
522 FOOTPRINT* fp;
523
524 if( !fpID.IsValid() )
526 else
527 fp = m_frame->LoadFootprint( fpID );
528
530 return 0;
531}
532
533
535{
537 return 0;
538}
539
540
542{
543 LIB_TREE_NODE* currentNode = m_frame->GetCurrentTreeNode();
544
545 if( currentNode && !currentNode->m_Pinned )
546 {
547 m_frame->Prj().PinLibrary( currentNode->m_LibId.GetLibNickname(), false );
548
549 currentNode->m_Pinned = true;
551 }
552
553 return 0;
554}
555
556
558{
559 LIB_TREE_NODE* currentNode = m_frame->GetCurrentTreeNode();
560
561 if( currentNode && currentNode->m_Pinned )
562 {
563 m_frame->Prj().UnpinLibrary( currentNode->m_LibId.GetLibNickname(), false );
564
565 currentNode->m_Pinned = false;
567 }
568
569 return 0;
570}
571
572
574{
576 return 0;
577}
578
579
581{
583 return 0;
584}
585
586
588{
590
591 if( footprint )
592 {
593 getEditFrame<FOOTPRINT_EDIT_FRAME>()->OnEditItemRequest( footprint );
595 }
596 return 0;
597}
598
599
601{
602 getEditFrame<FOOTPRINT_EDIT_FRAME>()->ShowPadPropertiesDialog( nullptr );
603 return 0;
604}
605
606
608{
609 FOOTPRINT_EDIT_FRAME* editFrame = getEditFrame<FOOTPRINT_EDIT_FRAME>();
610 DIALOG_CLEANUP_GRAPHICS dlg( editFrame, true );
611
612 dlg.ShowModal();
613 return 0;
614}
615
616
618{
619 if( !m_checkerDialog )
620 {
622
623 m_checkerDialog->Show( true );
624 }
625 else // The dialog is just not visible (because the user has double clicked on an error item)
626 {
627 m_checkerDialog->Show( true );
628 }
629
630 return 0;
631}
632
633
635{
636 if( !m_checkerDialog )
638
639 if( !m_checkerDialog->IsShown() )
640 m_checkerDialog->Show( true );
641
642 m_checkerDialog->SelectMarker( aMarker );
643}
644
645
647{
648 if( m_checkerDialog )
649 {
650 m_checkerDialog->Destroy();
651 m_checkerDialog = nullptr;
652 }
653}
654
655
657{
658 FOOTPRINT* footprint = board()->Footprints().front();
659 int errors = 0;
660 wxString details;
661
662 // Repair duplicate IDs and missing nets.
663 std::set<KIID> ids;
664 int duplicates = 0;
665
666 auto processItem =
667 [&]( EDA_ITEM* aItem )
668 {
669 if( ids.count( aItem->m_Uuid ) )
670 {
671 duplicates++;
672 const_cast<KIID&>( aItem->m_Uuid ) = KIID();
673 }
674
675 ids.insert( aItem->m_Uuid );
676 };
677
678 // Footprint IDs are the most important, so give them the first crack at "claiming" a
679 // particular KIID.
680
681 processItem( footprint );
682
683 // After that the principal use is for DRC marker pointers, which are most likely to pads.
684
685 for( PAD* pad : footprint->Pads() )
686 processItem( pad );
687
688 // From here out I don't think order matters much.
689
690 processItem( &footprint->Reference() );
691 processItem( &footprint->Value() );
692
693 for( BOARD_ITEM* item : footprint->GraphicalItems() )
694 processItem( item );
695
696 for( ZONE* zone : footprint->Zones() )
697 processItem( zone );
698
699 for( PCB_GROUP* group : footprint->Groups() )
700 processItem( group );
701
702 if( duplicates )
703 {
704 errors += duplicates;
705 details += wxString::Format( _( "%d duplicate IDs replaced.\n" ), duplicates );
706 }
707
708 /*******************************
709 * Your test here
710 */
711
712 /*******************************
713 * Inform the user
714 */
715
716 if( errors )
717 {
718 m_frame->OnModify();
719
720 wxString msg = wxString::Format( _( "%d potential problems repaired." ), errors );
721 DisplayInfoMessage( m_frame, msg, details );
722 }
723 else
724 {
725 DisplayInfoMessage( m_frame, _( "No footprint problems found." ) );
726 }
727
728 return 0;
729}
730
731
733{
742
747
750
753
756
764}
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:50
void BuildListOfNets()
Definition: board.h:742
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()
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:143
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.
void ReCreateMenuBar() override
(Re)Create the menubar for the Footprint Editor frame
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:1636
void SetFPID(const LIB_ID &aFPID)
Definition: footprint.h:208
FP_GROUPS & Groups()
Definition: footprint.h:183
PADS & Pads()
Definition: footprint.h:174
const LIB_ID & GetFPID() const
Definition: footprint.h:207
void SetValue(const wxString &aValue)
Definition: footprint.h:549
FP_TEXT & Value()
read/write accessors:
Definition: footprint.h:555
const wxString & GetValue() const
Definition: footprint.h:541
FP_ZONES & Zones()
Definition: footprint.h:180
DRAWINGS & GraphicalItems()
Definition: footprint.h:177
FP_TEXT & Reference()
Definition: footprint.h:556
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: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
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:165
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:101
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:58
static TOOL_ACTION deleteFootprint
Definition: pcb_actions.h:405
static TOOL_ACTION renameFootprint
Definition: pcb_actions.h:404
static TOOL_ACTION showLayersManager
Definition: pcb_actions.h:381
static TOOL_ACTION createFootprint
Definition: pcb_actions.h:395
static TOOL_ACTION hideFootprintTree
Definition: pcb_actions.h:388
static TOOL_ACTION editFootprint
Definition: pcb_actions.h:402
static TOOL_ACTION exportFootprint
Definition: pcb_actions.h:410
static TOOL_ACTION showFootprintTree
Definition: pcb_actions.h:387
static TOOL_ACTION editTextAndGraphics
Definition: pcb_actions.h:352
static TOOL_ACTION newFootprint
Definition: pcb_actions.h:392
static TOOL_ACTION defaultPadProperties
Definition: pcb_actions.h:413
static TOOL_ACTION importFootprint
Definition: pcb_actions.h:409
static TOOL_ACTION pasteFootprint
Definition: pcb_actions.h:408
static TOOL_ACTION footprintProperties
Definition: pcb_actions.h:412
static TOOL_ACTION checkFootprint
Definition: pcb_actions.h:415
static TOOL_ACTION duplicateFootprint
Definition: pcb_actions.h:403
static TOOL_ACTION cutFootprint
Definition: pcb_actions.h:406
static TOOL_ACTION repairFootprint
Definition: pcb_actions.h:483
static TOOL_ACTION copyFootprint
Definition: pcb_actions.h:407
static TOOL_ACTION cleanupGraphics
Definition: pcb_actions.h:355
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:176
virtual FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
Definition: project.cpp:318
void PinLibrary(const wxString &aLibrary, bool isSymbolLibrary)
Definition: project.cpp:155
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:214
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: infobar.h:75
bool HasCloseButton() const
Definition: infobar.cpp:310
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Definition: 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:280
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:320
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:240
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:299
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