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-2021 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 "kicad_clipboard.h"
28 #include <tool/tool_manager.h>
29 #include <tools/pcb_actions.h>
30 #include <view/view_controls.h>
31 #include <footprint_edit_frame.h>
32 #include <pcbnew_id.h>
33 #include <confirm.h>
34 #include <widgets/infobar.h>
35 #include <bitmaps.h>
36 #include <footprint.h>
37 #include <pad.h>
38 #include <pcb_group.h>
39 #include <zone.h>
40 #include <project.h>
41 #include <fp_lib_table.h>
44 #include <footprint_wizard_frame.h>
45 #include <kiway.h>
47 
48 
50  PCB_TOOL_BASE( "pcbnew.ModuleEditor" ),
51  m_frame( nullptr ),
52  m_checkerDialog( nullptr )
53 {
54 }
55 
56 
58 {
59 }
60 
61 
63 {
64  m_frame = getEditFrame<FOOTPRINT_EDIT_FRAME>();
65 
66  if( m_checkerDialog )
68 }
69 
70 
72 {
73  // Build a context menu for the footprint tree
74  //
75  CONDITIONAL_MENU& ctxMenu = m_menu.GetMenu();
76 
77  auto libSelectedCondition =
78  [ this ]( const SELECTION& aSel )
79  {
80  LIB_ID sel = m_frame->GetTreeFPID();
81  return !sel.GetLibNickname().empty() && sel.GetLibItemName().empty();
82  };
83 
84  // The libInferredCondition allows you to do things like New Symbol and Paste with a
85  // symbol selected (in other words, when we know the library context even if the library
86  // itself isn't selected.
87  auto libInferredCondition =
88  [ this ]( const SELECTION& aSel )
89  {
90  LIB_ID sel = m_frame->GetTreeFPID();
91  return !sel.GetLibNickname().empty();
92  };
93  auto pinnedLibSelectedCondition =
94  [ this ]( const SELECTION& aSel )
95  {
97  return current && current->m_Type == LIB_TREE_NODE::LIB && current->m_Pinned;
98  };
99  auto unpinnedLibSelectedCondition =
100  [ this ](const SELECTION& aSel )
101  {
103  return current && current->m_Type == LIB_TREE_NODE::LIB && !current->m_Pinned;
104  };
105  auto fpSelectedCondition =
106  [ this ]( const SELECTION& aSel )
107  {
108  LIB_ID sel = m_frame->GetTreeFPID();
109  return !sel.GetLibNickname().empty() && !sel.GetLibItemName().empty();
110  };
111 
112  ctxMenu.AddItem( ACTIONS::pinLibrary, unpinnedLibSelectedCondition );
113  ctxMenu.AddItem( ACTIONS::unpinLibrary, pinnedLibSelectedCondition );
114 
115  ctxMenu.AddSeparator();
116  ctxMenu.AddItem( PCB_ACTIONS::newFootprint, libSelectedCondition );
117  ctxMenu.AddItem( PCB_ACTIONS::createFootprint, libSelectedCondition );
118 
119  ctxMenu.AddSeparator();
120  ctxMenu.AddItem( ACTIONS::save, libSelectedCondition || libInferredCondition );
121  ctxMenu.AddItem( ACTIONS::saveAs, libSelectedCondition );
122  ctxMenu.AddItem( ACTIONS::saveCopyAs, 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::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.
158  board()->BuildListOfNets();
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 );
172  m_frame->ClearModify();
173  }
174 
175  m_frame->UpdateView();
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 
187  if( m_frame->IsContentModified() )
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.
218  board()->BuildListOfNets();
219  newFootprint->SetPosition( wxPoint( 0, 0 ) );
220  newFootprint->ClearFlags();
221 
222  m_frame->Zoom_Automatique( false );
224 
225  // If selected from the library tree then go ahead and save it there
226  if( !selected.GetLibNickname().empty() )
227  {
228  LIB_ID fpid = newFootprint->GetFPID();
229  fpid.SetLibNickname( selected.GetLibNickname() );
230  newFootprint->SetFPID( fpid );
231  m_frame->SaveFootprint( newFootprint );
232  m_frame->ClearModify();
233  }
234 
235  m_frame->UpdateView();
236  canvas()->Refresh();
237  m_frame->Update3DView( true, true );
238 
239  m_frame->SyncLibraryTree( false );
240  }
241  }
242 
243  wizard->Destroy();
244  return 0;
245 }
246 
247 
249 {
250  if( !footprint() ) // no loaded footprint
251  return 0;
252 
254  {
255  if( m_frame->SaveFootprint( footprint() ) )
256  {
257  view()->Update( footprint() );
258 
259  canvas()->ForceRefresh();
260  m_frame->ClearModify();
261  m_frame->UpdateTitle();
262  }
263  }
264 
266  return 0;
267 }
268 
269 
271 {
273  {
274  // Save Library As
275  const wxString& src_libNickname = m_frame->GetTargetFPID().GetLibNickname();
276  wxString src_libFullName = m_frame->Prj().PcbFootprintLibs()->GetFullURI( src_libNickname );
277 
278  if( m_frame->SaveLibraryAs( src_libFullName ) )
279  m_frame->SyncLibraryTree( true );
280  }
281  else if( m_frame->GetTargetFPID() == m_frame->GetLoadedFPID() )
282  {
283  // Save Board Footprint As
284  if( footprint() && m_frame->SaveFootprintAs( footprint() ) )
285  {
286  view()->Update( footprint() );
287  m_frame->ClearModify();
288 
289  // Get rid of the save-will-update-board-only (or any other dismissable warning)
290  WX_INFOBAR* infobar = m_frame->GetInfoBar();
291 
292  if( infobar->IsShown() && infobar->HasCloseButton() )
293  infobar->Dismiss();
294 
295  canvas()->ForceRefresh();
296  m_frame->SyncLibraryTree( true );
297  }
298  }
299  else
300  {
301  // Save Selected Footprint As
303 
305  m_frame->SyncLibraryTree( true );
306  }
307 
309  return 0;
310 }
311 
312 
314 {
315  getEditFrame<FOOTPRINT_EDIT_FRAME>()->RevertFootprint();
316  return 0;
317 }
318 
319 
321 {
322  LIB_ID fpID = m_frame->GetTreeFPID();
323 
324  if( fpID == m_frame->GetLoadedFPID() )
326  else
327  m_copiedFootprint.reset( m_frame->LoadFootprint( fpID ) );
328 
329  if( aEvent.IsAction( &PCB_ACTIONS::cutFootprint ) )
330  DeleteFootprint( aEvent );
331 
332  return 0;
333 }
334 
335 
337 {
339  {
340  wxString newLib = m_frame->GetTreeFPID().GetLibNickname();
341  wxString newName = m_copiedFootprint->GetFPID().GetLibItemName();
342 
343  while( m_frame->Prj().PcbFootprintLibs()->FootprintExists( newLib, newName ) )
344  newName += _( "_copy" );
345 
346  m_copiedFootprint->SetFPID( LIB_ID( newLib, newName ) );
348 
349  m_frame->SyncLibraryTree( true );
350  m_frame->FocusOnLibID( m_copiedFootprint->GetFPID() );
351  }
352 
353  return 0;
354 }
355 
356 
358 {
359  FOOTPRINT_EDIT_FRAME* frame = getEditFrame<FOOTPRINT_EDIT_FRAME>();
360 
361  if( frame->DeleteFootprintFromLibrary( frame->GetTargetFPID(), true ) )
362  {
363  if( frame->GetTargetFPID() == frame->GetLoadedFPID() )
364  frame->Clear_Pcb( false );
365 
366  frame->SyncLibraryTree( true );
367  }
368 
369  return 0;
370 }
371 
372 
374 {
375  bool is_last_fp_from_brd = m_frame->IsCurrentFPFromBoard();
376 
377  if( !m_frame->Clear_Pcb( true ) )
378  return -1; // this command is aborted
379 
382 
385 
387 
388  // Update the save items if needed.
389  if( is_last_fp_from_brd )
390  {
393  }
394 
396  m_frame->OnModify();
397  return 0;
398 }
399 
400 
402 {
403  LIB_ID fpID = m_frame->GetTreeFPID();
404  FOOTPRINT* fp;
405 
406  if( !fpID.IsValid() )
408  else
409  fp = m_frame->LoadFootprint( fpID );
410 
411  m_frame->ExportFootprint( fp );
412  return 0;
413 }
414 
415 
417 {
419  return 0;
420 }
421 
422 
424 {
425  LIB_TREE_NODE* currentNode = m_frame->GetCurrentTreeNode();
426 
427  if( currentNode && !currentNode->m_Pinned )
428  {
429  currentNode->m_Pinned = true;
431  }
432 
433  return 0;
434 }
435 
436 
438 {
439  LIB_TREE_NODE* currentNode = m_frame->GetCurrentTreeNode();
440 
441  if( currentNode && currentNode->m_Pinned )
442  {
443  currentNode->m_Pinned = false;
445  }
446 
447  return 0;
448 }
449 
450 
452 {
454  return 0;
455 }
456 
457 
459 {
461 
462  if( footprint )
463  {
464  getEditFrame<FOOTPRINT_EDIT_FRAME>()->OnEditItemRequest( footprint );
465  m_frame->GetCanvas()->Refresh();
466  }
467  return 0;
468 }
469 
470 
472 {
473  getEditFrame<FOOTPRINT_EDIT_FRAME>()->ShowPadPropertiesDialog( nullptr );
474  return 0;
475 }
476 
477 
479 {
480  FOOTPRINT_EDIT_FRAME* editFrame = getEditFrame<FOOTPRINT_EDIT_FRAME>();
481  DIALOG_CLEANUP_GRAPHICS dlg( editFrame, true );
482 
483  dlg.ShowModal();
484  return 0;
485 }
486 
487 
489 {
490  if( !m_checkerDialog )
491  {
493 
494  m_checkerDialog->Show( true );
495  }
496  else // The dialog is just not visible (because the user has double clicked on an error item)
497  {
499  m_checkerDialog->Show( true );
500  }
501  return 0;
502 }
503 
504 
506 {
507  if( m_checkerDialog )
508  {
509  m_checkerDialog->Destroy();
510  m_checkerDialog = nullptr;
511  }
512 }
513 
514 
516 {
517  FOOTPRINT* footprint = board()->Footprints().front();
518  int errors = 0;
519  wxString details;
520 
521  // Repair duplicate IDs and missing nets.
522  std::set<KIID> ids;
523  int duplicates = 0;
524 
525  auto processItem =
526  [&]( EDA_ITEM* aItem )
527  {
528  if( ids.count( aItem->m_Uuid ) )
529  {
530  duplicates++;
531  const_cast<KIID&>( aItem->m_Uuid ) = KIID();
532  }
533 
534  ids.insert( aItem->m_Uuid );
535  };
536 
537  // Footprint IDs are the most important, so give them the first crack at "claiming" a
538  // particular KIID.
539 
540  processItem( footprint );
541 
542  // After that the principal use is for DRC marker pointers, which are most likely to pads.
543 
544  for( PAD* pad : footprint->Pads() )
545  processItem( pad );
546 
547  // From here out I don't think order matters much.
548 
549  processItem( &footprint->Reference() );
550  processItem( &footprint->Value() );
551 
552  for( BOARD_ITEM* item : footprint->GraphicalItems() )
553  processItem( item );
554 
555  for( ZONE* zone : footprint->Zones() )
556  processItem( zone );
557 
558  for( PCB_GROUP* group : footprint->Groups() )
559  processItem( group );
560 
561  if( duplicates )
562  {
563  errors += duplicates;
564  details += wxString::Format( _( "%d duplicate IDs replaced.\n" ), duplicates );
565  }
566 
567  /*******************************
568  * Your test here
569  */
570 
571  /*******************************
572  * Inform the user
573  */
574 
575  if( errors )
576  {
577  m_frame->OnModify();
578 
579  wxString msg = wxString::Format( _( "%d potential problems repaired." ), errors );
580  DisplayInfoMessage( m_frame, msg, details );
581  }
582  else
583  {
584  DisplayInfoMessage( m_frame, _( "No footprint problems found." ) );
585  }
586 
587  return 0;
588 }
589 
590 
592 {
600 
605 
608 
610 
613 
617  PCB_ACTIONS::showFootprintTree.MakeEvent() );
619  PCB_ACTIONS::hideFootprintTree.MakeEvent() );
621  PCB_ACTIONS::footprintProperties.MakeEvent() );
623  PCB_ACTIONS::defaultPadProperties.MakeEvent() );
624 }
int Save(const TOOL_EVENT &aEvent)
int DefaultPadProperties(const TOOL_EVENT &aEvent)
Edit the properties used for new pad creation.
static TOOL_ACTION pinLibrary
Definition: actions.h:109
void BuildListOfNets()
Definition: board.h:658
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:239
static TOOL_ACTION hideFootprintTree
Definition: pcb_actions.h:355
void LoadFootprintFromLibrary(LIB_ID aFPID)
const UTF8 & GetLibItemName() const
Definition: lib_id.h:104
TOOL_MENU m_menu
The functions below are not yet implemented - their interface may change.
static TOOL_ACTION footprintProperties
Definition: pcb_actions.h:377
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
void ForceRefresh()
Force a redraw.
void ReCreateHToolbar() override
Create the main horizontal toolbar for the footprint editor.
DIALOG_FOOTPRINT_CHECKER * m_checkerDialog
static TOOL_ACTION repairFootprint
Definition: pcb_actions.h:447
KIGFX::VIEW_CONTROLS * GetViewControls() const
Return a pointer to the #VIEW_CONTROLS instance used in the panel.
int RepairFootprint(const TOOL_EVENT &aEvent)
int PasteFootprint(const TOOL_EVENT &aEvent)
BOARD * board() const
This file is part of the common library.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
static TOOL_ACTION checkFootprint
Definition: pcb_actions.h:380
static TOOL_ACTION cleanupGraphics
Definition: pcb_actions.h:323
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:50
FOOTPRINT * CreateNewFootprint(const wxString &aFootprintName, bool aQuiet=false)
Creates a new footprint, at position 0,0.
std::unique_ptr< FOOTPRINT > m_copiedFootprint
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:46
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
static TOOL_ACTION zoomFitScreen
Definition: actions.h:96
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:383
bool Init() override
Init() is called once upon a registration of the tool.
int ImportFootprint(const TOOL_EVENT &aEvent)
static TOOL_ACTION unpinLibrary
Definition: actions.h:110
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
FOOTPRINT_EDIT_FRAME * m_frame
bool IsValid() const
Check if this LID_ID is valid.
Definition: lib_id.h:159
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).
int CreateFootprint(const TOOL_EVENT &aEvent)
PADS & Pads()
Definition: footprint.h:168
static TOOL_ACTION createFootprint
Definition: pcb_actions.h:362
static TOOL_ACTION saveCopyAs
Definition: actions.h:53
static TOOL_ACTION cutFootprint
Definition: pcb_actions.h:371
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
static TOOL_ACTION copyFootprint
Definition: pcb_actions.h:372
FP_TEXT & Value()
read/write accessors:
Definition: footprint.h:499
int CleanupGraphics(const TOOL_EVENT &aEvent)
int ToggleFootprintTree(const TOOL_EVENT &aEvent)
FP_TEXT & Reference()
Definition: footprint.h:500
bool HasCloseButton() const
Definition: infobar.cpp:310
PCB_BASE_EDIT_FRAME * frame() const
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.
FP_ZONES & Zones()
Definition: footprint.h:174
void ReCreateMenuBar() override
(Re)Create the menubar for the Footprint Editor frame
void ExportFootprint(FOOTPRINT *aFootprint)
Create a file containing only one footprint.
void SyncLibraryTree(bool aProgress)
Synchronize the footprint library tree to the current state of the footprint library table.
Definition: kiid.h:44
void RegenerateLibraryTree()
Filter, sort, and redisplay the library tree.
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Definition: infobar.cpp:175
bool Clear_Pcb(bool aQuery)
Delete all and reinitialize the current board.
Definition: initpcb.cpp:97
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
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Definition: board.h:317
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
int CutCopyFootprint(const TOOL_EVENT &aEvent)
bool SaveLibraryAs(const wxString &aLibraryPath)
Save a library to a new name and/or library type.
void OnModify() override
Must be called after a footprint change in order to set the "modify" flag of the current screen and p...
BOARD_DRC_ITEMS_PROVIDER is an implementation of the RC_ITEMS_PROVIDER interface which uses a BOARD i...
static TOOL_ACTION exportFootprint
Definition: pcb_actions.h:375
void FocusOnLibID(const LIB_ID &aLibID)
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
wxString GetFullURI(const wxString &aLibNickname, bool aExpandEnvVars=true) const
Return the full URI of the library mapped to aLibNickname.
static TOOL_ACTION editFootprint
Definition: pcb_actions.h:369
static TOOL_ACTION save
Definition: actions.h:51
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...
bool SaveFootprintInLibrary(FOOTPRINT *aFootprint, const wxString &aLibraryName)
FOOTPRINTS & Footprints()
Definition: board.h:233
Generic, UI-independent tool event.
Definition: tool_event.h:152
FOOTPRINT * footprint() const
KIGFX::PCB_VIEW * view() const
int Revert(const TOOL_EVENT &aEvent)
#define _(s)
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:90
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:154
DRAWINGS & GraphicalItems()
Definition: footprint.h:171
FOOTPRINT * LoadFootprint(const LIB_ID &aFootprintId)
Attempt to load aFootprintId from the footprint library table.
const LIB_ID & GetFPID() const
Definition: footprint.h:194
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
int NewFootprint(const TOOL_EVENT &aEvent)
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Move the graphic crosshair cursor to the requested position expressed in world coordinates.
Model class in the component selector Model-View-Adapter (mediated MVC) architecture.
LIB_TREE_NODE * GetCurrentTreeNode() const
static TOOL_ACTION importFootprint
Definition: pcb_actions.h:374
bool Show(bool show) override
void AddSeparator(int aOrder=ANY_ORDER)
Add a separator to the menu.
virtual FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
Definition: project.cpp:283
int SetLibNickname(const UTF8 &aNickname)
Override the logical library name portion of the LIB_ID to aNickname.
Definition: lib_id.cpp:97
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
void SetContentModified(bool aModified=true)
Definition: base_screen.h:59
void setTransitions() override
< Set up handlers for various events.
FP_GROUPS & Groups()
Definition: footprint.h:177
void SetFPID(const LIB_ID &aFPID)
Definition: footprint.h:195
A modified version of the wxInfoBar class that allows us to:
Definition: infobar.h:73
static TOOL_ACTION defaultPadProperties
Definition: pcb_actions.h:378
void Reset(RESET_REASON aReason) override
Bring the tool to a known, initial state.
int EditFootprint(const TOOL_EVENT &aEvent)
static TOOL_ACTION showFootprintTree
Definition: pcb_actions.h:354
int DeleteFootprint(const TOOL_EVENT &aEvent)
int CheckFootprint(const TOOL_EVENT &aEvent)
void SetMarkersProvider(RC_ITEMS_PROVIDER *aProvider)
static TOOL_ACTION saveAs
Definition: actions.h:52
LIB_ID GetLoadedFPID() const
Return the LIB_ID of the part being edited.
int ExportFootprint(const TOOL_EVENT &aEvent)
virtual void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
enum TYPE m_Type
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...
bool SaveFootprintAs(FOOTPRINT *aFootprint)
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
RESET_REASON
Determine the reason of reset for a tool.
Definition: tool_base.h:77
int UnpinLibrary(const TOOL_EVENT &aEvent)
WX_INFOBAR * GetInfoBar()
static TOOL_ACTION pasteFootprint
Definition: pcb_actions.h:373
int SaveAs(const TOOL_EVENT &aEvent)
void AddFootprintToBoard(FOOTPRINT *aFootprint) override
Override from PCB_BASE_EDIT_FRAME which adds a footprint to the editor's dummy board,...
void RefreshLibraryTree()
Redisplay the library tree.
BOARD * GetBoard() const
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
Definition: pad.h:57
void SetPosition(const wxPoint &aPos) override
Definition: footprint.cpp:1543
PCB_DRAW_PANEL_GAL * canvas() const
bool IsContentModified() const override
Get if any footprints or libraries have been modified but not saved.
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:307
bool SaveFootprint(FOOTPRINT *aFootprint)
Save in an existing library a given footprint.
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.
virtual void ClearUndoRedoList()
Clear the undo and redo list using ClearUndoORRedoList()
static TOOL_ACTION deleteFootprint
Definition: pcb_actions.h:370
int PinLibrary(const TOOL_EVENT &aEvent)
bool FootprintExists(const wxString &aNickname, const wxString &aFootprintName)
Indicates whether or not the given footprint already exists in the given library.
LIB_ID GetTreeFPID() const
Return the LIB_ID of the part or library selected in the footprint tree.
static TOOL_ACTION revert
Definition: actions.h:55
static TOOL_ACTION newFootprint
Definition: pcb_actions.h:359
int Properties(const TOOL_EVENT &aEvent)
FOOTPRINT * ImportFootprint(const wxString &aName=wxT(""))
Read a file containing only one footprint.
bool empty() const
Definition: utf8.h:103