KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 auto fpExportCondition =
114 [ this ]( const SELECTION& aSel )
115 {
117 return fp != nullptr;
118 };
119
120 ctxMenu.AddItem( ACTIONS::pinLibrary, unpinnedLibSelectedCondition );
121 ctxMenu.AddItem( ACTIONS::unpinLibrary, pinnedLibSelectedCondition );
122
123 ctxMenu.AddSeparator();
124 ctxMenu.AddItem( PCB_ACTIONS::newFootprint, libSelectedCondition );
125 ctxMenu.AddItem( PCB_ACTIONS::createFootprint, libSelectedCondition );
126
127 ctxMenu.AddSeparator();
129 ctxMenu.AddItem( ACTIONS::saveAs, libSelectedCondition || fpSelectedCondition );
130 ctxMenu.AddItem( ACTIONS::revert, libSelectedCondition || libInferredCondition );
131
132 ctxMenu.AddSeparator();
133 ctxMenu.AddItem( PCB_ACTIONS::cutFootprint, fpSelectedCondition );
134 ctxMenu.AddItem( PCB_ACTIONS::copyFootprint, fpSelectedCondition );
135 ctxMenu.AddItem( PCB_ACTIONS::pasteFootprint, libInferredCondition );
136 ctxMenu.AddItem( PCB_ACTIONS::duplicateFootprint, fpSelectedCondition );
137 ctxMenu.AddItem( PCB_ACTIONS::renameFootprint, fpSelectedCondition );
138 ctxMenu.AddItem( PCB_ACTIONS::deleteFootprint, fpSelectedCondition );
139
140 ctxMenu.AddSeparator();
141 ctxMenu.AddItem( PCB_ACTIONS::importFootprint, libInferredCondition );
142 ctxMenu.AddItem( PCB_ACTIONS::exportFootprint, fpExportCondition );
143
144 // If we've got nothing else to show, at least show a hide tree option
145 ctxMenu.AddItem( PCB_ACTIONS::hideFootprintTree, !libInferredCondition );
146
147 return true;
148}
149
150
152{
153 LIB_ID selected = m_frame->GetTreeFPID();
154 FOOTPRINT* newFootprint = m_frame->CreateNewFootprint( wxEmptyString );
155
156 if( !newFootprint )
157 return 0;
158
159 if( !m_frame->Clear_Pcb( true ) )
160 return 0;
161
163 m_frame->AddFootprintToBoard( newFootprint );
164
165 // Initialize data relative to nets and netclasses (for a new footprint the defaults are
166 // used). This is mandatory to handle and draw pads.
168 newFootprint->SetPosition( VECTOR2I( 0, 0 ) );
169 newFootprint->ClearFlags();
170
171 m_frame->Zoom_Automatique( false );
173
174 // If selected from the library tree then go ahead and save it there
175 if( !selected.GetLibNickname().empty() )
176 {
177 LIB_ID fpid = newFootprint->GetFPID();
178 fpid.SetLibNickname( selected.GetLibNickname() );
179 newFootprint->SetFPID( fpid );
180 m_frame->SaveFootprint( newFootprint );
182 }
183
185 m_frame->Update3DView( true, true );
186
187 m_frame->SyncLibraryTree( false );
188 return 0;
189}
190
191
193{
194 LIB_ID selected = m_frame->GetTreeFPID();
195
197 {
198 if( !HandleUnsavedChanges( m_frame, _( "The current footprint has been modified. "
199 "Save changes?" ),
200 [&]() -> bool
201 {
202 return m_frame->SaveFootprint( footprint() );
203 } ) )
204 {
205 return 0;
206 }
207 }
208
210 true, m_frame );
211
212 if( wizard->ShowModal( nullptr, m_frame ) )
213 {
214 // Creates the new footprint from python script wizard
215 FOOTPRINT* newFootprint = wizard->GetBuiltFootprint();
216
217 if( newFootprint ) // i.e. if create footprint command is OK
218 {
219 m_frame->Clear_Pcb( false );
220
222 // Add the new object to board
223 m_frame->AddFootprintToBoard( newFootprint );
224
225 // Initialize data relative to nets and netclasses (for a new footprint the defaults
226 // are used). This is mandatory to handle and draw pads.
228 newFootprint->SetPosition( VECTOR2I( 0, 0 ) );
229 newFootprint->ClearFlags();
230
231 m_frame->Zoom_Automatique( false );
233 m_frame->OnModify();
234
235 // If selected from the library tree then go ahead and save it there
236 if( !selected.GetLibNickname().empty() )
237 {
238 LIB_ID fpid = newFootprint->GetFPID();
239 fpid.SetLibNickname( selected.GetLibNickname() );
240 newFootprint->SetFPID( fpid );
241 m_frame->SaveFootprint( newFootprint );
243 }
244
246 canvas()->Refresh();
247 m_frame->Update3DView( true, true );
248
249 m_frame->SyncLibraryTree( false );
250 }
251 }
252
253 wizard->Destroy();
254 return 0;
255}
256
257
259{
260 if( !footprint() ) // no loaded footprint
261 return 0;
262
264 {
266 {
267 view()->Update( footprint() );
268
269 canvas()->ForceRefresh();
272 }
273 }
274
276 return 0;
277}
278
279
281{
283 {
284 // Save Library As
285 const wxString& src_libNickname = m_frame->GetTargetFPID().GetLibNickname();
286 wxString src_libFullName = m_frame->Prj().PcbFootprintLibs()->GetFullURI( src_libNickname );
287
288 if( m_frame->SaveLibraryAs( src_libFullName ) )
289 m_frame->SyncLibraryTree( true );
290 }
291 else if( m_frame->GetTargetFPID() == m_frame->GetLoadedFPID() )
292 {
293 // Save Footprint As
295 {
296 view()->Update( footprint() );
298
299 // Get rid of the save-will-update-board-only (or any other dismissable warning)
300 WX_INFOBAR* infobar = m_frame->GetInfoBar();
301
302 if( infobar->IsShown() && infobar->HasCloseButton() )
303 infobar->Dismiss();
304
305 canvas()->ForceRefresh();
306 m_frame->SyncLibraryTree( true );
307 }
308 }
309 else
310 {
311 // Save Selected Footprint As
313
315 {
316 m_frame->SyncLibraryTree( true );
318 }
319 }
320
322 return 0;
323}
324
325
327{
328 getEditFrame<FOOTPRINT_EDIT_FRAME>()->RevertFootprint();
329 return 0;
330}
331
332
334{
335 LIB_ID fpID = m_frame->GetTreeFPID();
336
337 if( fpID == m_frame->GetLoadedFPID() )
338 {
339 m_copiedFootprint = std::make_unique<FOOTPRINT>( *m_frame->GetBoard()->GetFirstFootprint() );
340 m_copiedFootprint->SetParent( nullptr );
341 }
342 else
343 {
344 m_copiedFootprint.reset( m_frame->LoadFootprint( fpID ) );
345 }
346
347 if( aEvent.IsAction( &PCB_ACTIONS::cutFootprint ) )
348 DeleteFootprint( aEvent );
349
350 return 0;
351}
352
353
355{
357 {
358 wxString newLib = m_frame->GetTreeFPID().GetLibNickname();
359 wxString newName = m_copiedFootprint->GetFPID().GetLibItemName();
360
361 while( m_frame->Prj().PcbFootprintLibs()->FootprintExists( newLib, newName ) )
362 newName += _( "_copy" );
363
364 m_copiedFootprint->SetFPID( LIB_ID( newLib, newName ) );
366
367 m_frame->SyncLibraryTree( true );
371 }
372
373 return 0;
374}
375
376
378{
379 LIB_ID fpID = m_frame->GetTreeFPID();
381
382 if( fpID == m_frame->GetLoadedFPID() )
384 else
386
388 {
389 m_frame->SyncLibraryTree( true );
393 }
394
395 return 0;
396}
397
398
400{
402 LIB_ID fpID = m_frame->GetTreeFPID();
403 wxString libraryName = fpID.GetLibNickname();
404 wxString oldName = fpID.GetLibItemName();
405 wxString newName = oldName;
406 bool done = false;
407
408 while( !done )
409 {
410 wxTextEntryDialog dlg( m_frame, _( "New name:" ), _( "Change Footprint Name" ), newName );
411
412 if( dlg.ShowModal() != wxID_OK )
413 return 0; // canceled by user
414
415 newName = dlg.GetValue();
416 newName.Trim( true ).Trim( false );
417
418 if( newName.IsEmpty() )
419 {
420 DisplayErrorMessage( m_frame, _( "Footprint name cannot be empty." ) );
421 }
422 else if( tbl->FootprintExists( libraryName, newName ) )
423 {
424 DisplayErrorMessage( m_frame, wxString::Format( _( "Footprint name '%s' already "
425 "in use in library '%s'." ),
426 UnescapeString( newName ),
427 libraryName ) );
428 newName = oldName;
429 }
430 else
431 {
432 done = true;
433 }
434 }
435
436 FOOTPRINT* footprint = nullptr;
437
438 if( fpID == m_frame->GetLoadedFPID() )
439 {
441
442 if( footprint )
443 {
444 footprint->SetFPID( LIB_ID( libraryName, newName ) );
445
446 if( footprint->GetValue() == oldName )
447 footprint->SetValue( newName );
448
449 m_frame->OnModify();
451 }
452 }
453 else
454 {
456
457 if( footprint )
458 {
459 try
460 {
461 footprint->SetFPID( LIB_ID( libraryName, newName ) );
462
463 if( footprint->GetValue() == oldName )
464 footprint->SetValue( newName );
465
467
468 m_frame->Prj().PcbFootprintLibs()->FootprintDelete( libraryName, oldName );
469 }
470 catch( const IO_ERROR& ioe )
471 {
472 DisplayError( m_frame, ioe.What() );
473 }
474 catch( ... )
475 {
476 // Best efforts...
477 }
478 }
479 }
480
481 wxDataViewItem treeItem = m_frame->GetLibTreeAdapter()->FindItem( fpID );
482 m_frame->UpdateLibraryTree( treeItem, footprint );
483 m_frame->FocusOnLibID( LIB_ID( libraryName, newName ) );
484
485 return 0;
486}
487
488
490{
491 FOOTPRINT_EDIT_FRAME* frame = getEditFrame<FOOTPRINT_EDIT_FRAME>();
492
493 if( frame->DeleteFootprintFromLibrary( frame->GetTargetFPID(), true ) )
494 {
495 if( frame->GetTargetFPID() == frame->GetLoadedFPID() )
496 frame->Clear_Pcb( false );
497
498 frame->SyncLibraryTree( true );
499 }
500
501 return 0;
502}
503
504
506{
507 bool is_last_fp_from_brd = m_frame->IsCurrentFPFromBoard();
508
509 if( !m_frame->Clear_Pcb( true ) )
510 return -1; // this command is aborted
511
514
517
519
520 // Update the save items if needed.
521 if( is_last_fp_from_brd )
522 {
525 }
526
528 m_frame->OnModify();
529 return 0;
530}
531
532
534{
535 LIB_ID fpID = m_frame->GetTreeFPID();
537
538 if( fp )
540
541 return 0;
542}
543
544
546{
548 return 0;
549}
550
551
553{
554 LIB_TREE_NODE* currentNode = m_frame->GetCurrentTreeNode();
555
556 if( currentNode && !currentNode->m_Pinned )
557 {
558 m_frame->Prj().PinLibrary( currentNode->m_LibId.GetLibNickname(), false );
559
560 currentNode->m_Pinned = true;
562 }
563
564 return 0;
565}
566
567
569{
570 LIB_TREE_NODE* currentNode = m_frame->GetCurrentTreeNode();
571
572 if( currentNode && currentNode->m_Pinned )
573 {
574 m_frame->Prj().UnpinLibrary( currentNode->m_LibId.GetLibNickname(), false );
575
576 currentNode->m_Pinned = false;
578 }
579
580 return 0;
581}
582
583
585{
587 return 0;
588}
589
590
592{
594 return 0;
595}
596
597
599{
601 return 0;
602}
603
604
606{
608
609 if( footprint )
610 {
611 getEditFrame<FOOTPRINT_EDIT_FRAME>()->OnEditItemRequest( footprint );
613 }
614 return 0;
615}
616
617
619{
620 getEditFrame<FOOTPRINT_EDIT_FRAME>()->ShowPadPropertiesDialog( nullptr );
621 return 0;
622}
623
624
626{
627 FOOTPRINT_EDIT_FRAME* editFrame = getEditFrame<FOOTPRINT_EDIT_FRAME>();
628 DIALOG_CLEANUP_GRAPHICS dlg( editFrame, true );
629
630 dlg.ShowModal();
631 return 0;
632}
633
634
636{
637 if( !m_checkerDialog )
638 {
640
641 m_checkerDialog->Show( true );
642 }
643 else // The dialog is just not visible (because the user has double clicked on an error item)
644 {
645 m_checkerDialog->Show( true );
646 }
647
648 return 0;
649}
650
651
653{
654 if( !m_checkerDialog )
656
657 if( !m_checkerDialog->IsShown() )
658 m_checkerDialog->Show( true );
659
660 m_checkerDialog->SelectMarker( aMarker );
661}
662
663
665{
666 if( m_checkerDialog )
667 {
668 m_checkerDialog->Destroy();
669 m_checkerDialog = nullptr;
670 }
671}
672
673
675{
676 FOOTPRINT* footprint = board()->Footprints().front();
677 int errors = 0;
678 wxString details;
679
680 // Repair duplicate IDs and missing nets.
681 std::set<KIID> ids;
682 int duplicates = 0;
683
684 auto processItem =
685 [&]( EDA_ITEM* aItem )
686 {
687 if( ids.count( aItem->m_Uuid ) )
688 {
689 duplicates++;
690 const_cast<KIID&>( aItem->m_Uuid ) = KIID();
691 }
692
693 ids.insert( aItem->m_Uuid );
694 };
695
696 // Footprint IDs are the most important, so give them the first crack at "claiming" a
697 // particular KIID.
698
699 processItem( footprint );
700
701 // After that the principal use is for DRC marker pointers, which are most likely to pads.
702
703 for( PAD* pad : footprint->Pads() )
704 processItem( pad );
705
706 // From here out I don't think order matters much.
707
708 processItem( &footprint->Reference() );
709 processItem( &footprint->Value() );
710
711 for( BOARD_ITEM* item : footprint->GraphicalItems() )
712 processItem( item );
713
714 for( ZONE* zone : footprint->Zones() )
715 processItem( zone );
716
717 for( PCB_GROUP* group : footprint->Groups() )
718 processItem( group );
719
720 if( duplicates )
721 {
722 errors += duplicates;
723 details += wxString::Format( _( "%d duplicate IDs replaced.\n" ), duplicates );
724 }
725
726 /*******************************
727 * Your test here
728 */
729
730 /*******************************
731 * Inform the user
732 */
733
734 if( errors )
735 {
736 m_frame->OnModify();
737
738 wxString msg = wxString::Format( _( "%d potential problems repaired." ), errors );
739 DisplayInfoMessage( m_frame, msg, details );
740 }
741 else
742 {
743 DisplayInfoMessage( m_frame, _( "No footprint problems found." ) );
744 }
745
746 return 0;
747}
748
749
751{
760
765
768
771
774
783}
static TOOL_ACTION revert
Definition: actions.h:55
static TOOL_ACTION saveAs
Definition: actions.h:52
static TOOL_ACTION pinLibrary
Definition: actions.h:113
static TOOL_ACTION save
Definition: actions.h:51
static TOOL_ACTION zoomFitScreen
Definition: actions.h:99
static TOOL_ACTION unpinLibrary
Definition: actions.h:114
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 BuildListOfNets()
Definition: board.h:779
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Definition: board.h:405
FOOTPRINTS & Footprints()
Definition: board.h:312
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
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:125
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 ToggleProperties(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:1656
void SetFPID(const LIB_ID &aFPID)
Definition: footprint.h:215
ZONES & Zones()
Definition: footprint.h:178
PCB_TEXT & Value()
read/write accessors:
Definition: footprint.h:569
PADS & Pads()
Definition: footprint.h:172
const LIB_ID & GetFPID() const
Definition: footprint.h:214
void SetValue(const wxString &aValue)
Definition: footprint.h:557
PCB_TEXT & Reference()
Definition: footprint.h:570
GROUPS & Groups()
Definition: footprint.h:181
const wxString & GetValue() const
Definition: footprint.h:549
DRAWINGS & GraphicalItems()
Definition: footprint.h:175
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:432
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
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:414
static TOOL_ACTION renameFootprint
Definition: pcb_actions.h:413
static TOOL_ACTION showLayersManager
Definition: pcb_actions.h:390
static TOOL_ACTION createFootprint
Definition: pcb_actions.h:404
static TOOL_ACTION hideFootprintTree
Definition: pcb_actions.h:397
static TOOL_ACTION editFootprint
Definition: pcb_actions.h:411
static TOOL_ACTION exportFootprint
Definition: pcb_actions.h:419
static TOOL_ACTION showFootprintTree
Definition: pcb_actions.h:396
static TOOL_ACTION showProperties
Definition: pcb_actions.h:391
static TOOL_ACTION editTextAndGraphics
Definition: pcb_actions.h:360
static TOOL_ACTION newFootprint
Definition: pcb_actions.h:401
static TOOL_ACTION defaultPadProperties
Definition: pcb_actions.h:422
static TOOL_ACTION importFootprint
Definition: pcb_actions.h:418
static TOOL_ACTION pasteFootprint
Definition: pcb_actions.h:417
static TOOL_ACTION footprintProperties
Definition: pcb_actions.h:421
static TOOL_ACTION checkFootprint
Definition: pcb_actions.h:424
static TOOL_ACTION duplicateFootprint
Definition: pcb_actions.h:412
static TOOL_ACTION cutFootprint
Definition: pcb_actions.h:415
static TOOL_ACTION repairFootprint
Definition: pcb_actions.h:492
static TOOL_ACTION copyFootprint
Definition: pcb_actions.h:416
static TOOL_ACTION cleanupGraphics
Definition: pcb_actions.h:364
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:216
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:81
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:325
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Definition: wx_infobar.cpp:187
Handle a list of polygons defining a copper zone.
Definition: zone.h:72
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
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:243
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:308
This file is part of the common library.
#define _(s)
@ FRAME_FOOTPRINT_WIZARD
Definition: frame_type.h:44
Class to handle a set of BOARD_ITEMs.
see class PGM_BASE
wxString UnescapeString(const wxString &aSource)
VECTOR2< double > VECTOR2D
Definition: vector2d.h:587
VECTOR2< int > VECTOR2I
Definition: vector2d.h:588