KiCad PCB EDA Suite
footprint_edit_frame.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) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
6  * Copyright (C) 2015-2016 Wayne Stambaugh <stambaughw@gmail.com>
7  * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
8  *
9  * This program is free software: you can redistribute it and/or modify it
10  * under the terms of the GNU General Public License as published by the
11  * Free Software Foundation, either version 3 of the License, or (at your
12  * option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #include "tools/convert_tool.h"
24 #include "tools/drawing_tool.h"
25 #include "tools/edit_tool.h"
27 #include "tools/pad_tool.h"
28 #include "tools/pcb_actions.h"
29 #include "tools/pcbnew_control.h"
31 #include "tools/placement_tool.h"
32 #include "tools/point_editor.h"
33 #include "tools/selection_tool.h"
35 #include <bitmaps.h>
36 #include <board.h>
37 #include <footprint.h>
38 #include <confirm.h>
43 #include <footprint_edit_frame.h>
45 #include <footprint_info_impl.h>
46 #include <footprint_tree_pane.h>
47 #include <footprint_viewer_frame.h>
48 #include <fp_lib_table.h>
50 #include <kiface_i.h>
51 #include <kiplatform/app.h>
52 #include <kiway.h>
53 #include <panel_hotkeys_editor.h>
54 #include <pcb_draw_panel_gal.h>
55 #include <pcb_edit_frame.h>
56 #include <pcbnew.h>
57 #include <pcbnew_id.h>
58 #include <pgm_base.h>
59 #include <project.h>
61 #include <tool/action_toolbar.h>
62 #include <tool/common_control.h>
63 #include <tool/common_tools.h>
64 #include <tool/selection.h>
65 #include <tool/tool_dispatcher.h>
66 #include <tool/tool_manager.h>
67 #include <tool/zoom_tool.h>
69 #include <tools/pcb_viewer_tools.h>
70 #include <tools/group_tool.h>
73 #include <widgets/infobar.h>
74 #include <widgets/lib_tree.h>
75 #include <widgets/paged_dialog.h>
79 
80 
81 BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
82  EVT_MENU( wxID_CLOSE, FOOTPRINT_EDIT_FRAME::CloseFootprintEditor )
83  EVT_MENU( wxID_EXIT, FOOTPRINT_EDIT_FRAME::OnExitKiCad )
84 
86 
89 
91 
94 
95  // Horizontal toolbar
98 
99  // UI update events.
106 
107 END_EVENT_TABLE()
108 
109 
110 FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
111  EDA_DRAW_PANEL_GAL::GAL_TYPE aBackend ) :
112  PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_FOOTPRINT_EDITOR, wxEmptyString,
113  wxDefaultPosition, wxDefaultSize,
114  KICAD_DEFAULT_DRAWFRAME_STYLE, GetFootprintEditorFrameName() )
115 {
116  m_showBorderAndTitleBlock = false; // true to show the frame references
117  m_canvasType = aBackend;
118  m_aboutTitle = _( "Footprint Editor" );
119  m_selLayerBox = nullptr;
120  m_settings = nullptr;
121 
122  // Give an icon
123  wxIcon icon;
124  icon.CopyFromBitmap( KiBitmap( icon_modedit_xpm ) );
125  SetIcon( icon );
126 
127  // Create GAL canvas
128  if( aBackend == EDA_DRAW_PANEL_GAL::GAL_TYPE_UNKNOWN )
129  m_canvasType = loadCanvasTypeSetting();
130  else
131  m_canvasType = aBackend;
132 
133  PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_frameSize,
134  GetGalDisplayOptions(), m_canvasType );
135  SetCanvas( drawPanel );
136  SetBoard( new BOARD() );
137 
138 
139  // This board will only be used to hold a footprint for editing
141 
142  // In Footprint Editor, the default net clearance is not known (it depends on the actual
143  // board). So we do not show the default clearance, by setting it to 0. The footprint or
144  // pad specific clearance will be shown.
146 
147  // Don't show the default board solder mask clearance in the footprint editor. Only the
148  // footprint or pad clearance setting should be shown if it is not 0.
150 
151  // restore the last footprint from the project, if any
152  restoreLastFootprint();
153 
154  // Ensure all layers and items are visible:
155  // In footprint editor, some layers have no meaning or cannot be used, but we show all of
156  // them, at least to be able to edit a bad layer
158 
159  // However the "no net" mark on pads is useless, because there are no nets in footprint
160  // editor: make it non visible.
162 
163  GetGalDisplayOptions().m_axesEnabled = true;
164 
165  // In Footprint Editor, set the default paper size to A4 for plot/print
166  SetPageSettings( PAGE_INFO( PAGE_INFO::A4 ) );
167  SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
168 
169  // Create the manager and dispatcher & route draw panel events to the dispatcher
170  setupTools();
171  setupUIConditions();
172 
173  initLibraryTree();
174  m_treePane = new FOOTPRINT_TREE_PANE( this );
175 
176  ReCreateMenuBar();
177  ReCreateHToolbar();
178  ReCreateVToolbar();
179  ReCreateOptToolbar();
180 
181  m_selectionFilterPanel = new PANEL_SELECTION_FILTER( this );
182  m_appearancePanel = new APPEARANCE_CONTROLS( this, GetCanvas(), true );
183 
184  // LoadSettings() *after* creating m_LayersManager, because LoadSettings() initialize
185  // parameters in m_LayersManager
186  // NOTE: KifaceSettings() will return PCBNEW_SETTINGS if we started from pcbnew
187  LoadSettings( GetSettings() );
188 
189  // Must be set after calling LoadSettings() to be sure these parameters are not dependent
190  // on what is read in stored settings. Enable one internal layer, because footprints
191  // support keepout areas that can be on internal layers only (therefore on the first internal
192  // layer). This is needed to handle these keepout in internal layers only.
194  GetBoard()->SetEnabledLayers( GetBoard()->GetEnabledLayers().set( In1_Cu ) );
195  GetBoard()->SetVisibleLayers( GetBoard()->GetEnabledLayers() );
196  GetBoard()->SetLayerName( In1_Cu, _( "Inner layers" ) );
197 
198  SetActiveLayer( F_SilkS );
199 
200  // Create the infobar
201  m_infoBar = new WX_INFOBAR( this, &m_auimgr );
202 
203  m_auimgr.SetManagedWindow( this );
204 
205  unsigned int auiFlags = wxAUI_MGR_DEFAULT;
206 #if !defined( _WIN32 )
207  // Windows cannot redraw the UI fast enough during a live resize and may lead to all kinds of graphical glitches
208  auiFlags |= wxAUI_MGR_LIVE_RESIZE;
209 #endif
210  m_auimgr.SetFlags( auiFlags );
211 
212  // Horizontal items; layers 4 - 6
213  m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer( 6 ) );
214  m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer( 6 ) );
215  m_auimgr.AddPane( m_infoBar,
216  EDA_PANE().InfoBar().Name( "InfoBar" ).Top().Layer(1) );
217 
218  // Vertical items; layers 1 - 3
219  m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer( 3 ) );
220  m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "Footprints" ).Left().Layer(2)
221  .Caption( _( "Libraries" ) ).MinSize( 250, 400 ).Resizable() );
222 
223  m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(2) );
224 
225  m_auimgr.AddPane( m_appearancePanel, EDA_PANE().Name( "LayersManager" ).Right().Layer( 3 )
226  .Caption( _( "Appearance" ) ).PaneBorder( false )
227  .MinSize( 180, -1 ).BestSize( 180, -1 ) );
228  m_auimgr.AddPane( m_selectionFilterPanel,
229  EDA_PANE().Palette().Name( "SelectionFilter" ).Right().Layer( 3 )
230  .Caption( _( "Selection Filter" ) ).PaneBorder( false ).Position( 2 )
231  .MinSize( 160, -1 ).BestSize( m_selectionFilterPanel->GetBestSize() ) );
232 
233  // The selection filter doesn't need to grow in the vertical direction when docked
234  m_auimgr.GetPane( "SelectionFilter" ).dock_proportion = 0;
235 
236  m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
237 
238  ActivateGalCanvas();
239 
240  m_auimgr.GetArtProvider()->SetColour( wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR,
241  wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT ) );
242  m_auimgr.GetArtProvider()->SetColour( wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR,
243  wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT ) );
244 
245  // Call Update() to fix all pane default sizes, especially the "InfoBar" pane before
246  // hidding it.
247  m_auimgr.Update();
248 
249  // We don't want the infobar displayed right away
250  m_auimgr.GetPane( "InfoBar" ).Hide();
251  m_auimgr.Update();
252 
253  if( m_settings->m_LibWidth > 0 )
254  {
255  wxAuiPaneInfo& treePane = m_auimgr.GetPane( "Footprints" );
256 
257  // wxAUI hack: force width by setting MinSize() and then Fixed()
258  // thanks to ZenJu http://trac.wxwidgets.org/ticket/13180
259  treePane.MinSize( m_settings->m_LibWidth, -1 );
260  treePane.Fixed();
261  m_auimgr.Update();
262 
263  // now make it resizable again
264  treePane.Resizable();
265  m_auimgr.Update();
266 
267  // Note: DO NOT call m_auimgr.Update() anywhere after this; it will nuke the size
268  // back to minimum.
269  treePane.MinSize( 250, -1 );
270  }
271 
272  // Apply saved visibility stuff at the end
273  FOOTPRINT_EDITOR_SETTINGS* cfg = GetSettings();
274  m_appearancePanel->SetUserLayerPresets( cfg->m_LayerPresets );
275  m_appearancePanel->ApplyLayerPreset( cfg->m_ActiveLayerPreset );
276 
277  GetToolManager()->RunAction( ACTIONS::zoomFitScreen, false );
278  updateTitle();
279  initExitKey();
280  setupUnits( GetSettings() );
281 
282  // Default shutdown reason until a file is loaded
283  KIPLATFORM::APP::SetShutdownBlockReason( this, _( "Footprint changes are unsaved" ) );
284 
285  // Ensure the window is on top
286  Raise();
287  Show( true );
288 }
289 
290 
292 {
293  // Shutdown all running tools
294  if( m_toolManager )
296 
297  // save the footprint in the PROJECT
299 
300  delete m_selectionFilterPanel;
301  delete m_appearancePanel;
302 }
303 
304 
306 {
307  return GetScreen() && GetScreen()->IsModify() && GetBoard() && GetBoard()->GetFirstFootprint();
308 }
309 
310 
312 {
313  return m_toolManager->GetTool<SELECTION_TOOL>()->GetSelection();
314 }
315 
316 
318 {
319  // switches currently used canvas (Cairo / OpenGL).
320  PCB_BASE_FRAME::SwitchCanvas( aCanvasType );
321 
322  GetCanvas()->GetGAL()->SetAxesEnabled( true );
323 
324  // The base class method *does not reinit* the layers manager. We must upate the layer
325  // widget to match board visibility states, both layers and render columns, and and some
326  // settings dependent on the canvas.
328 }
329 
330 
332 {
333  SyncLibraryTree( true );
334  GetCanvas()->ForceRefresh();
335 }
336 
337 
339 {
340  wxAuiPaneInfo& treePane = m_auimgr.GetPane( m_treePane );
341  treePane.Show( !IsSearchTreeShown() );
342  m_auimgr.Update();
343 }
344 
345 
347 {
348  return m_auimgr.GetPane( m_treePane ).IsShown();
349 }
350 
351 
353 {
354  return GetBoard()->GetFirstFootprint();
355 }
356 
357 
359 {
361 }
362 
363 
365 {
367 }
368 
369 
371 {
372  LIB_ID id = GetTreeFPID();
373 
374  if( id.GetLibNickname().empty() )
375  return GetLoadedFPID();
376 
377  return id;
378 }
379 
380 
382 {
383  FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
384 
385  if( footprint )
386  return LIB_ID( footprint->GetFPID().GetLibNickname(), m_footprintNameWhenLoaded );
387  else
388  return LIB_ID();
389 }
390 
391 
393 {
394  if( GetBoard()->GetFirstFootprint() )
396 
397  GetScreen()->ClrModify();
398 }
399 
400 
402 {
403  FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
404 
405  return ( footprint && footprint->GetLink() != niluuid );
406 }
407 
408 
410 {
411  LIB_ID id = GetLoadedFPID();
412 
413  if( id.IsValid() )
414  {
416  Prj().SetRString( PROJECT::PCB_FOOTPRINT_EDITOR_FP_NAME, id.GetLibItemName() );
417  }
418 }
419 
420 
422 {
423  const wxString& footprintName = Prj().GetRString( PROJECT::PCB_FOOTPRINT_EDITOR_FP_NAME );
424  const wxString& libNickname = Prj().GetRString( PROJECT::PCB_FOOTPRINT_EDITOR_LIB_NICKNAME );
425 
426  if( libNickname.Length() && footprintName.Length() )
427  {
428  LIB_ID id;
429  id.SetLibNickname( libNickname );
430  id.SetLibItemName( footprintName );
431 
432  FOOTPRINT* footprint = loadFootprint( id );
433 
434  if( footprint )
435  AddFootprintToBoard( footprint );
436  }
437 }
438 
439 
441 {
442  m_revertModule.reset( (FOOTPRINT*) aFootprint->Clone() );
443 
445 
446  // Pads are always editable in Footprint Editor
447  aFootprint->SetPadsLocked( false );
448 
450 
451  if( IsCurrentFPFromBoard() )
452  {
453  wxString msg;
454  msg.Printf( _( "Editing %s from board. Saving will update the board only." ),
455  aFootprint->GetReference() );
456 
458  GetInfoBar()->ShowMessage( msg, wxICON_INFORMATION );
459  }
460 
461  UpdateMsgPanel();
462 }
463 
464 
466 {
468 }
469 
470 
472 {
473  return GetBoard()->GetDesignSettings();
474 }
475 
476 
478 {
479  wxFAIL_MSG( "Plotting not supported in Footprint Editor" );
480 
482 }
483 
484 
486 {
487  wxFAIL_MSG( "Plotting not supported in Footprint Editor" );
488 }
489 
490 
492 {
493  if( !m_settings )
494  m_settings = Pgm().GetSettingsManager().GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>();
495 
496  return m_settings;
497 }
498 
499 
501 {
502  // aCfg will be the PCBNEW_SETTINGS
504 
506 
508 
512 }
513 
514 
516 {
517  // aCfg will be the PCBNEW_SETTINGS
519 
521 
524  cfg->m_LibWidth = m_treePane->GetSize().x;
525  cfg->m_SelectionFilter = GetToolManager()->GetTool<SELECTION_TOOL>()->GetFilter();
528 
530 }
531 
532 
534 {
535  return Pgm().GetSettingsManager().GetColorSettings(
536  GetFootprintEditorSettings()->m_ColorTheme );
537 }
538 
539 
541 {
542  // Get the actual frame settings for magnetic items
544  wxCHECK( cfg, nullptr );
545  return &cfg->m_MagneticItems;
546 }
547 
548 
549 const BOX2I FOOTPRINT_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
550 {
551  FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
552 
553  if( footprint )
554  {
555  bool hasGraphicalItem = footprint->Pads().size() || footprint->Zones().size();
556 
557  if( !hasGraphicalItem )
558  {
559  for( const BOARD_ITEM* item : footprint->GraphicalItems() )
560  {
561  if( item->Type() == PCB_FP_TEXT_T )
562  continue;
563 
564  hasGraphicalItem = true;
565  break;
566  }
567  }
568 
569  if( hasGraphicalItem )
570  {
571  return footprint->GetFootprintRect();
572  }
573  else
574  {
575  BOX2I newFootprintBB( { 0, 0 }, { 0, 0 } );
576  newFootprintBB.Inflate( Millimeter2iu( 12 ) );
577  return newFootprintBB;
578  }
579  }
580 
581  return GetBoardBoundingBox( false );
582 }
583 
584 
585 bool FOOTPRINT_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
586 {
587  if( IsContentModified() )
588  {
589  // Shutdown blocks must be determined and vetoed as early as possible
590  if( KIPLATFORM::APP::SupportsShutdownBlockReason() && aEvent.GetId() == wxEVT_QUERY_END_SESSION )
591  {
592  aEvent.Veto();
593  return false;
594  }
595 
596  wxString footprintName = GetBoard()->GetFirstFootprint()->GetFPID().GetLibItemName();
597  wxString msg = _( "Save changes to \"%s\" before closing?" );
598 
599  if( !HandleUnsavedChanges( this, wxString::Format( msg, footprintName ),
600  [&]() -> bool
601  {
602  return SaveFootprint( GetBoard()->GetFirstFootprint() );
603  } ) )
604  {
605  aEvent.Veto();
606  return false;
607  }
608  }
609 
610  return true;
611 }
612 
613 
615 {
616  // No more vetos
618  GetCanvas()->StopDrawing();
619 
620  // Do not show the layer manager during closing to avoid flicker
621  // on some platforms (Windows) that generate useless redraw of items in
622  // the Layer Manger
623  m_auimgr.GetPane( "LayersManager" ).Show( false );
624  m_auimgr.GetPane( "SelectionFilter" ).Show( false );
625 
626  Pgm().GetSettingsManager().FlushAndRelease( GetSettings() );
627 
628  Clear_Pcb( false );
629 }
630 
631 
632 void FOOTPRINT_EDIT_FRAME::OnExitKiCad( wxCommandEvent& event )
633 {
634  Kiway().OnKiCadExit();
635 }
636 
637 
638 void FOOTPRINT_EDIT_FRAME::CloseFootprintEditor( wxCommandEvent& Event )
639 {
640  Close();
641 }
642 
643 
644 void FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected( wxUpdateUIEvent& aEvent )
645 {
646  aEvent.Enable( GetBoard()->GetFirstFootprint() != NULL );
647 }
648 
649 
651 {
653 
654  aEvent.Enable( frame && frame->GetBoard()->GetFirstFootprint() != NULL );
655 }
656 
657 
659 {
661 
662  FOOTPRINT* editorFootprint = GetBoard()->GetFirstFootprint();
663  bool canInsert = frame && editorFootprint && editorFootprint->GetLink() == niluuid;
664 
665  // If the source was deleted, the footprint can inserted but not updated in the board.
666  if( frame && editorFootprint && editorFootprint->GetLink() != niluuid )
667  {
668  BOARD* mainpcb = frame->GetBoard();
669  canInsert = true;
670 
671  // search if the source footprint was not deleted:
672  for( FOOTPRINT* candidate : mainpcb->Footprints() )
673  {
674  if( editorFootprint->GetLink() == candidate->m_Uuid )
675  {
676  canInsert = false;
677  break;
678  }
679  }
680  }
681 
682  aEvent.Enable( canInsert );
683 }
684 
685 
687 {
688  // call my base class
690 
691  // We have 2 panes to update.
692  // For some obscure reason, the AUI manager hides the first modified pane.
693  // So force show panes
694  wxAuiPaneInfo& tree_pane_info = m_auimgr.GetPane( m_treePane );
695  bool tree_shown = tree_pane_info.IsShown();
696  tree_pane_info.Caption( _( "Libraries" ) );
697 
698  wxAuiPaneInfo& lm_pane_info = m_auimgr.GetPane( m_appearancePanel );
699  bool lm_shown = lm_pane_info.IsShown();
700  lm_pane_info.Caption( _( "Appearance" ) );
701 
702  // update the layer manager
705 
706  // Now restore the visibility:
707  lm_pane_info.Show( lm_shown );
708  tree_pane_info.Show( tree_shown );
709  m_auimgr.Update();
710 }
711 
712 
714 {
716  Update3DView( true );
718 }
719 
720 
722 {
723  wxString title;
724  LIB_ID fpid = GetLoadedFPID();
725  FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
726  bool writable = true;
727 
728  if( IsCurrentFPFromBoard() )
729  {
730  title += wxString::Format( _( "%s [from %s.%s]" ) + wxT( " \u2014 " ),
731  footprint->GetReference(),
732  Prj().GetProjectName(),
734  }
735  else if( fpid.IsValid() )
736  {
737  try
738  {
739  writable = Prj().PcbFootprintLibs()->IsFootprintLibWritable( fpid.GetLibNickname() );
740  }
741  catch( const IO_ERROR& )
742  {
743  // best efforts...
744  }
745 
746  // Note: don't used GetLoadedFPID(); footprint name may have been edited
747  title += wxString::Format( wxT( "%s %s\u2014 " ),
748  FROM_UTF8( footprint->GetFPID().Format().c_str() ),
749  writable ? wxString( wxEmptyString )
750  : _( "[Read Only]" ) + wxS( " " ) );
751  }
752  else if( !fpid.GetLibItemName().empty() )
753  {
754  // Note: don't used GetLoadedFPID(); footprint name may have been edited
755  title += wxString::Format( wxT( "%s %s \u2014 " ),
756  FROM_UTF8( footprint->GetFPID().GetLibItemName().c_str() ),
757  _( "[Unsaved]" ) );
758  }
759 
760  title += _( "Footprint Editor" );
761 
762  SetTitle( title );
763 }
764 
765 
767 {
769 }
770 
771 
773 {
774  GetCanvas()->UpdateColors();
777  updateTitle();
778 }
779 
780 
782 {
783  FP_LIB_TABLE* fpTable = Prj().PcbFootprintLibs();
784 
785  WX_PROGRESS_REPORTER progressReporter( this, _( "Loading Footprint Libraries" ), 2 );
786  GFootprintList.ReadFootprintFiles( fpTable, NULL, &progressReporter );
787  progressReporter.Show( false );
788 
791 
793  auto adapter = static_cast<FP_TREE_SYNCHRONIZING_ADAPTER*>( m_adapter.get() );
794 
795  adapter->AddLibraries();
796 }
797 
798 
800 {
801  FP_LIB_TABLE* fpTable = Prj().PcbFootprintLibs();
802  auto adapter = static_cast<FP_TREE_SYNCHRONIZING_ADAPTER*>( m_adapter.get() );
803  LIB_ID target = GetTargetFPID();
804  bool targetSelected = ( target == m_treePane->GetLibTree()->GetSelectedLibId() );
805 
806  // Sync FOOTPRINT_INFO list to the libraries on disk
807  if( aProgress )
808  {
809  WX_PROGRESS_REPORTER progressReporter( this, _( "Updating Footprint Libraries" ), 2 );
810  GFootprintList.ReadFootprintFiles( fpTable, NULL, &progressReporter );
811  progressReporter.Show( false );
812  }
813  else
814  {
816  }
817 
818  // Sync the LIB_TREE to the FOOTPRINT_INFO list
819  adapter->Sync();
820 
822  m_treePane->GetLibTree()->Regenerate( true );
823 
824  if( target.IsValid() )
825  {
826  if( adapter->FindItem( target ) )
827  {
828  if( targetSelected )
829  m_treePane->GetLibTree()->SelectLibId( target );
830  else
831  m_treePane->GetLibTree()->CenterLibId( target );
832  }
833  else
834  {
835  // Try to focus on parent
836  target.SetLibItemName( wxEmptyString );
837  m_treePane->GetLibTree()->CenterLibId( target );
838  }
839  }
840 }
841 
842 
844 {
845  LIB_ID target = GetTargetFPID();
846 
847  m_treePane->GetLibTree()->Regenerate( true );
848 
849  if( target.IsValid() )
850  m_treePane->GetLibTree()->CenterLibId( target );
851 }
852 
853 
855 {
857 }
858 
859 
861 {
862  m_treePane->GetLibTree()->SelectLibId( aLibID );
863 }
864 
865 
867 {
869 }
870 
871 
873  PANEL_HOTKEYS_EDITOR* aHotkeysPanel )
874 {
875  wxTreebook* book = aParent->GetTreebook();
876 
877  book->AddPage( new wxPanel( book ), _( "Footprint Editor" ) );
878  book->AddSubPage( new PANEL_DISPLAY_OPTIONS( this, aParent ), _( "Display Options" ) );
879  book->AddSubPage( new PANEL_FP_EDITOR_COLOR_SETTINGS( this, book ), _( "Colors" ) );
880  book->AddSubPage( new PANEL_EDIT_OPTIONS( this, aParent ), _( "Editing Options" ) );
881  book->AddSubPage( new PANEL_FP_EDITOR_DEFAULTS( this, aParent ), _( "Default Values" ) );
882 
883  aHotkeysPanel->AddHotKeys( GetToolManager() );
884 }
885 
886 
888 {
889  // Create the manager and dispatcher & route draw panel events to the dispatcher
892  GetCanvas()->GetViewControls(), config(), this );
893  m_actions = new PCB_ACTIONS();
895 
897 
906  m_toolManager->RegisterTool( new PCBNEW_CONTROL ); // copy/paste
914 
915  m_toolManager->GetTool<SELECTION_TOOL>()->SetIsFootprintEditor( true );
916  m_toolManager->GetTool<EDIT_TOOL>()->SetIsFootprintEditor( true );
917  m_toolManager->GetTool<PAD_TOOL>()->SetIsFootprintEditor( true );
918  m_toolManager->GetTool<DRAWING_TOOL>()->SetIsFootprintEditor( true );
919  m_toolManager->GetTool<POINT_EDITOR>()->SetIsFootprintEditor( true );
920  m_toolManager->GetTool<PCBNEW_CONTROL>()->SetIsFootprintEditor( true );
921  m_toolManager->GetTool<PCBNEW_PICKER_TOOL>()->SetIsFootprintEditor( true );
922  m_toolManager->GetTool<POSITION_RELATIVE_TOOL>()->SetIsFootprintEditor( true );
923  m_toolManager->GetTool<GROUP_TOOL>()->SetIsFootprintEditor( true );
924 
925  m_toolManager->GetTool<PCB_VIEWER_TOOLS>()->SetFootprintFrame( true );
927 
928  m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
929 }
930 
931 
933 {
935 
937  PCB_EDITOR_CONDITIONS cond( this );
938 
939  wxASSERT( mgr );
940 
941 #define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
942 #define CHECK( x ) ACTION_CONDITIONS().Check( x )
943 
944  auto haveFootprintCond =
945  [this]( const SELECTION& )
946  {
947  return GetBoard()->GetFirstFootprint() != nullptr;
948  };
949 
950  auto footprintTargettedCond =
951  [this] ( const SELECTION& )
952  {
953  return !GetTargetFPID().GetLibItemName().empty();
954  };
955 
956  mgr->SetConditions( ACTIONS::saveAs, ENABLE( footprintTargettedCond ) );
960 
961  mgr->SetConditions( ACTIONS::undo, ENABLE( cond.UndoAvailable() ) );
962  mgr->SetConditions( ACTIONS::redo, ENABLE( cond.RedoAvailable() ) );
963 
971 
978  mgr->SetConditions( ACTIONS::selectAll, ENABLE( cond.HasItems() ) );
979 
983 
986 
987 
988  auto highContrastCond =
989  [this] ( const SELECTION& )
990  {
992  };
993 
994  auto footprintTreeCond =
995  [this] (const SELECTION& )
996  {
997  return IsSearchTreeShown();
998  };
999 
1000  mgr->SetConditions( ACTIONS::highContrastMode, CHECK( highContrastCond ) );
1001  mgr->SetConditions( PCB_ACTIONS::toggleFootprintTree, CHECK( footprintTreeCond ) );
1002 
1003  mgr->SetConditions( ACTIONS::print, ENABLE( haveFootprintCond ) );
1004  mgr->SetConditions( PCB_ACTIONS::exportFootprint, ENABLE( haveFootprintCond ) );
1005  mgr->SetConditions( PCB_ACTIONS::footprintProperties, ENABLE( haveFootprintCond ) );
1006  mgr->SetConditions( PCB_ACTIONS::cleanupGraphics, ENABLE( haveFootprintCond ) );
1007 
1008 
1009 // Only enable a tool if the part is edtable
1010 #define CURRENT_EDIT_TOOL( action ) mgr->SetConditions( action, \
1011  ACTION_CONDITIONS().Enable( haveFootprintCond ).Check( cond.CurrentTool( action ) ) )
1012 
1025 
1026 #undef CURRENT_EDIT_TOOL
1027 #undef ENABLE
1028 #undef CHECK
1029 }
1030 
1031 
1033 {
1035 
1036  // Be sure the axis are enabled
1037  GetCanvas()->GetGAL()->SetAxesEnabled( true );
1038 
1039  UpdateView();
1040 
1041  // Ensure the m_Layers settings are using the canvas type:
1043 }
1044 
1045 
1046 void FOOTPRINT_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
1047 {
1048  PCB_BASE_EDIT_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
1049 
1051  GetCanvas()->ForceRefresh();
1052 
1054 
1055  if( aEnvVarsChanged )
1056  SyncLibraryTree( true );
1057 
1058  Layout();
1059  SendSizeEvent();
1060 }
1061 
1062 
1063 void FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng( wxCommandEvent& event )
1064 {
1065  wxString fullFileName;
1066 
1067  LIB_ID id = GetLoadedFPID();
1068 
1069  if( id.empty() )
1070  {
1071  wxMessageBox( _( "No footprint selected." ) );
1072  return;
1073  }
1074 
1075  wxFileName fn( id.GetLibItemName() );
1076  fn.SetExt( "png" );
1077 
1078  wxString projectPath = wxPathOnly( Prj().GetProjectFullName() );
1079 
1080  wxFileDialog dlg( this, _( "Footprint Image File Name" ), projectPath,
1081  fn.GetFullName(), PngFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
1082 
1083  if( dlg.ShowModal() == wxID_CANCEL || dlg.GetPath().IsEmpty() )
1084  return;
1085 
1086  // calling wxYield is mandatory under Linux, after closing the file selector dialog
1087  // to refresh the screen before creating the PNG or JPEG image from screen
1088  wxYield();
1089  SaveCanvasImageToFile( this, dlg.GetPath() );
1090 }
void ShutdownAllTools()
Shutdown all tools with a currently registered event loop in this tool manager by waking them up with...
POSITION_RELATIVE_TOOL.
void ShowMessage(const wxString &aMessage, int aFlags=wxICON_INFORMATION) override
Show the info bar with the provided message and icon.
Definition: infobar.cpp:120
static TOOL_ACTION drawLine
Definition: pcb_actions.h:145
static TOOL_ACTION saveToBoard
Definition: pcb_actions.h:357
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:202
#define CHECK(x)
bool IsFootprintLibWritable(const wxString &aNickname)
Function IsFootprintLibWritable.
show a marker on pads with no nets
virtual void ShowChangedLanguage() override
Redraw the menus and what not in current language.
const UTF8 & GetLibItemName() const
Definition: lib_id.h:114
static TOOL_ACTION footprintProperties
Definition: pcb_actions.h:368
void OnKiCadExit()
Definition: kiway.cpp:587
void SelectLayer(wxCommandEvent &event)
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_holder.h:56
void ForceRefresh()
Function ForceRefresh() Forces a redraw.
void OnExitKiCad(wxCommandEvent &aEvent)
KIID niluuid(0)
class FP_TEXT, text in a footprint
Definition: typeinfo.h:93
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Change the visibility of an element category.
Definition: board.cpp:503
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:109
void ActivateGalCanvas() override
FOOTPRINT_EDITOR_TOOLS.
void OnUpdateLayerAlpha(wxUpdateUIEvent &aEvent) override
BOARD_DESIGN_SETTINGS & GetDesignSettings() const override
Returns the BOARD_DESIGN_SETTINGS for the open project Overloaded in FOOTPRINT_EDIT_FRAME.
SETTINGS_MANAGER * GetSettingsManager() const
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
#define CURRENT_EDIT_TOOL(action)
bool SaveCanvasImageToFile(EDA_DRAW_FRAME *aFrame, const wxString &aFileName, wxBitmapType aBitmapType)
Save the current view as an image file.
Definition: bitmap.cpp:179
Model changes (required full reload)
Definition: tool_base.h:82
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Called after the preferences dialog is run.
SELECTION_CONDITION HasItems()
Creates a functor that tests if there are items in the board.
This file is part of the common library.
static TOOL_ACTION doDelete
Definition: actions.h:75
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
Definition: board_item.h:86
APPEARANCE_CONTROLS * m_appearancePanel
AUI panel for controlling layer and object visibility and appearance.
static TOOL_ACTION drawArc
Definition: pcb_actions.h:149
SELECTION_CONDITION FullscreenCursor()
Creates a functor testing if the cursor is full screen in a frame.
static TOOL_ACTION cleanupGraphics
Definition: pcb_actions.h:317
static TOOL_ACTION zoomTool
Definition: actions.h:102
EVT_UPDATE_UI(ID_LOAD_FOOTPRINT_FROM_BOARD, FOOTPRINT_EDIT_FRAME::OnUpdateLoadFootprintFromBoard) EVT_UPDATE_UI(ID_ADD_FOOTPRINT_TO_BOARD
FOOTPRINT_EDITOR_SETTINGS * GetFootprintEditorSettings()
static bool Idle(const SELECTION &aSelection)
Tests if there no items selected or being edited.
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
SELECTION_TOOL.
virtual void Update3DView(bool aReloadRequest, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
void initLibraryTree()
Make sure the footprint info list is loaded (with a progress dialog) and then initialize the footprin...
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
SELECTION_CONDITION TextFillDisplay()
Creates a functor that tests if the frame fills text items.
#define ENABLE(x)
static wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > Create(FOOTPRINT_EDIT_FRAME *aFrame, FP_LIB_TABLE *aLibs)
void DisplayErrors(wxTopLevelWindow *aCaller=NULL)
SELECTION_CONDITION CurrentTool(const TOOL_ACTION &aTool)
Creates a functor testing if the specified tool is the current active tool in the frame.
PAD_TOOL.
Definition: pad_tool.h:37
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
static TOOL_ACTION zoomFitScreen
Definition: actions.h:99
static TOOL_ACTION millimetersUnits
Definition: actions.h:149
void SetCopperLayerCount(int aCount)
Definition: board.cpp:431
static TOOL_ACTION drawPolygon
Definition: pcb_actions.h:146
static TOOL_ACTION standardGraphics
Definition: actions.h:169
void UpdateView()
Reloads displayed items and sets view.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.h:559
static TOOL_ACTION placePad
Activation of the drawing tool (placing a PAD)
Definition: pcb_actions.h:374
SELECTION_CONDITION CanvasType(EDA_DRAW_PANEL_GAL::GAL_TYPE aType)
Creates a functor testing if the specified canvas is active in the frame.
void UpdateUserInterface()
Update the layer manager and other widgets from the board setup (layer and items visibility,...
void AddHotKeys(TOOL_MANAGER *aToolMgr)
void SetVisibleAlls()
Change the bit-mask of visible element categories and layers.
Definition: board.cpp:480
void SaveFootprintToBoard(wxCommandEvent &event)
SELECTION_CONDITION RedoAvailable()
Creates a functor that tests if there are any items in the redo queue.
wxAuiManager m_auimgr
ACTION_MANAGER.
static TOOL_ACTION print
Definition: actions.h:60
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
bool IsValid() const
Definition: lib_id.h:171
virtual const PCB_PLOT_PARAMS & GetPlotSettings() const
Function GetPlotSettings returns the PCB_PLOT_PARAMS for the BOARD owned by this frame.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:102
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Function GetDisplayOptions Display options control the way tracks, vias, outlines and other things ar...
static TOOL_ACTION setAnchor
Definition: pcb_actions.h:163
static bool NotEmpty(const SELECTION &aSelection)
Tests if there are any items selected.
static TOOL_ACTION placeText
Definition: pcb_actions.h:150
not specified: a GAL engine must be set by the client
SELECTION_CONDITION PadFillDisplay()
Creates a functor that tests if the frame fills the pads.
bool InvokeTool(TOOL_ID aToolId)
Function InvokeTool() Calls a tool by sending a tool activation event to tool of given ID.
SELECTION & GetCurrentSelection() override
Get the current selection from the canvas area.
PADS & Pads()
Definition: footprint.h:182
PCBNEW_CONTROL.
const char * c_str() const
Definition: utf8.h:107
bool IsContentModified() override
Get if any footprints or libraries have been modified but not saved.
void OnBoardChanged()
Updates the panel contents from the application and board models
const BOX2I GetDocumentExtents(bool aIncludeAllVisible=true) const override
Returns bbox of document with option to not include some items.
wxTreebook * GetTreebook()
Definition: paged_dialog.h:50
void SetShutdownBlockReason(wxWindow *aWindow, const wxString &aReason)
Sets the block reason why the window/application is preventing OS shutdown.
Definition: gtk/app.cpp:51
FOOTPRINT_LIST_IMPL GFootprintList
The global footprint info table.
PCB_DISPLAY_OPTIONS m_displayOptions
TOOL_MANAGER.
Definition: tool_manager.h:51
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:82
EDA_RECT GetFootprintRect() const
Function GetFootprintRect() Build and returns the boundary box of the footprint excluding any text.
Definition: footprint.cpp:579
static TOOL_ACTION measureTool
Definition: actions.h:157
FP_ZONES & Zones()
Definition: footprint.h:188
void SyncLibraryTree(bool aProgress)
Synchronize the footprint library tree to the current state of the footprint library table.
void RegenerateLibraryTree()
Filter, sort, and redisplay the library tree.
static TOOL_ACTION copy
Definition: actions.h:70
bool Clear_Pcb(bool aQuery)
Delete all and reinitialize the current board.
Definition: initpcb.cpp:94
static TOOL_ACTION toggleFootprintTree
Definition: pcb_actions.h:346
Generic tool for picking a point.
Multi-thread safe progress reporter dialog, intended for use of tasks that paralleize reporting back ...
void SetCheckboxesFromFilter(SELECTION_FILTER_OPTIONS &aOptions)
FOOTPRINT * loadFootprint(const LIB_ID &aFootprintId)
Function loadFootprint attempts to load aFootprintId from the footprint library table.
void HardRedraw() override
Refresh the library tree and redraw the window.
FOOTPRINT * GetFirstFootprint() const
Gets the first footprint on the board or nullptr.
Definition: board.h:348
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:99
SELECTION_CONDITION GridVisible()
Creates a functor testing if the grid is visible in a frame.
#define NULL
VTBL_ENTRY KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=NULL)
Function Player returns the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:345
LIB_TREE_NODE * GetCurrentTreeNode() const
Definition: lib_tree.cpp:169
SELECTION_CONDITION Units(EDA_UNITS aUnit)
Creates a functor that tests if the frame has the specified units.
void OnModify() override
Must be called after a footprint change in order to set the "modify" flag of the current screen and p...
void OnUpdateSaveFootprintToBoard(wxUpdateUIEvent &aEvent)
void DisplayBoard(BOARD *aBoard)
Function DisplayBoard adds all items from the current board to the VIEW, so they can be displayed by ...
DRAWING_TOOL.
Definition: drawing_tool.h:50
void SetClearance(int aClearance)
Definition: netclass.h:160
static TOOL_ACTION toggleGrid
Definition: actions.h:143
static TOOL_ACTION exportFootprint
Definition: pcb_actions.h:366
void FocusOnLibID(const LIB_ID &aLibID)
void SetVisibleLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of vis...
Definition: board.cpp:463
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
PAGE_INFO describes the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
static TOOL_ACTION inchesUnits
Definition: actions.h:147
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...
FOOTPRINTS & Footprints()
Definition: board.h:283
LIB_ID GetSelectedLibId(int *aUnit=nullptr) const
For multi-unit components, if the user selects the component itself rather than picking an individual...
Definition: lib_tree.cpp:151
bool SetLayerName(PCB_LAYER_ID aLayer, const wxString &aLayerName)
Changes the name of the layer given by aLayer.
Definition: board.cpp:348
wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > m_adapter
ACTIONS * m_actions
Definition: tools_holder.h:49
static TOOL_ACTION cut
Definition: actions.h:69
void Regenerate(bool aKeepState)
Regenerates the tree.
Definition: lib_tree.cpp:203
Definition of file extensions used in Kicad.
void Unselect()
Unselect currently selected item in wxDataViewCtrl.
Definition: lib_tree.cpp:192
FOOTPRINT_EDITOR_SETTINGS * m_settings
#define FOOTPRINT_EDIT_FRAME_NAME
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Function ResetTools() Resets all tools (i.e.
static TOOL_ACTION drawRectangle
Definition: pcb_actions.h:147
KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the s...
Definition: kiway.h:273
SELECTION_FILTER_OPTIONS m_SelectionFilter
KIGFX::GAL * GetGAL() const
Function GetGAL() Returns a pointer to the GAL instance used in the panel.
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:97
HIGH_CONTRAST_MODE m_ContrastModeDisplay
How inactive layers are displayed.
EDA_RECT GetBoardBoundingBox(bool aBoardEdgesOnly=false) const
Function GetBoardBoundingBox calculates the bounding box containing all board items (or board edge se...
DRAWINGS & GraphicalItems()
Definition: footprint.h:185
static const wxChar A4[]
Definition: page_info.h:65
virtual void OnSize(wxSizeEvent &event)
Recalculate the size of toolbars and display panel when the frame size changes.
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Saves common frame parameters to a configuration data file.
bool SupportsShutdownBlockReason()
Whether or not the window supports setting a shutdown block reason.
Definition: gtk/app.cpp:40
const LIB_ID & GetFPID() const
Definition: footprint.h:208
#define KICAD_DEFAULT_DRAWFRAME_STYLE
bool IsModify() const
Definition: base_screen.h:124
#define PcbFileExtension
const wxString GetReference() const
Function GetReference.
Definition: footprint.h:440
Footprint Editor pane with footprint library tree.
Model class in the component selector Model-View-Adapter (mediated MVC) architecture.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
PCB_PLOT_PARAMS handles plot parameters and options when plotting/printing a board.
COMMON_CONTROL.
void RefreshLibTree()
Refreshes the tree (mainly to update highlighting and asterisking)
Definition: lib_tree.cpp:221
void SetAxesEnabled(bool aAxesEnabled)
Enables drawing the axes.
std::unique_ptr< FOOTPRINT > m_revertModule
LIB_TREE * GetLibTree() const
EDIT_TOOL.
Definition: edit_tool.h:74
virtual KIGFX::PCB_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
Specialization of the wxAuiPaneInfo class for KiCad panels.
std::vector< LAYER_PRESET > GetUserLayerPresets() const
Returns a list of the layer presets created by the user
void SetConditions(const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions)
Set the conditions the UI elements for activating a specific tool action should use for determining t...
LIB_TREE_NODE * GetCurrentTreeNode() const
void RemoveAllButtons()
Remove all the buttons that have been added by the user.
Definition: infobar.cpp:226
static TOOL_ACTION milsUnits
Definition: actions.h:148
const PCB_PLOT_PARAMS & GetPlotSettings() const override
Function GetPlotSettings returns the PCB_PLOT_PARAMS for the BOARD owned by this frame.
UTF8 Format() const
Definition: lib_id.cpp:237
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:50
COMMON_TOOLS.
Definition: common_tools.h:38
void UpdateColors()
Updates the color settings in the painter and GAL.
void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType) override
switches currently used canvas (Cairo / OpenGL).
wxString PngFileWildcard()
KIID GetLink() const
Definition: footprint.h:556
const BITMAP_OPAQUE icon_modedit_xpm[1]
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Saves common frame parameters to a configuration data file.
SELECTION_CONDITION ContentModified()
Creates a functor that tests if the content of the frame is modified.
VTBL_ENTRY void SetRString(RSTRING_T aStringId, const wxString &aString)
Function SetRString stores a "retained string", which is any session and project specific string iden...
Definition: project.cpp:212
SELECTION_CONDITION NoActiveTool()
Creates a functor testing if there are no tools active in the frame.
BOARD * GetBoard()
static TOOL_ACTION pasteSpecial
Definition: actions.h:72
VTBL_ENTRY FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
Definition: project.cpp:284
static TOOL_ACTION padDisplayMode
Definition: pcb_actions.h:241
int SetLibNickname(const UTF8 &aNickname)
Override the logical library name portion of the LIB_ID to aNickname.
Definition: lib_id.cpp:193
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
static TOOL_ACTION drawCircle
Definition: pcb_actions.h:148
static TOOL_ACTION graphicsOutlines
Display footprint graphics as outlines.
Definition: pcb_actions.h:386
void InstallPreferences(PAGED_DIALOG *aParent, PANEL_HOTKEYS_EDITOR *aHotkeysPanel) override
Allows Footprint Editor to install its preferences panel into the preferences dialog.
static TOOL_ACTION saveToLibrary
Definition: pcb_actions.h:358
void LoadFootprintFromBoard(wxCommandEvent &event)
Called from the main toolbar to load a footprint from board mainly to edit it.
void updateTitle()
Updates window title according to getLibNickName().
A modified version of the wxInfoBar class that allows us to:
Definition: infobar.h:70
static TOOL_ACTION redo
Definition: actions.h:68
virtual void OnModify()
Function OnModify Must be called after a change in order to set the "modify" flag of the current scre...
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Function Inflate inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:302
VTBL_ENTRY const wxString & GetRString(RSTRING_T aStringId)
Function GetRString returns a "retained string", which is any session and project specific string ide...
Definition: project.cpp:227
PCB_ACTIONS.
Definition: pcb_actions.h:51
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:48
static TOOL_ACTION drawRuleArea
Definition: pcb_actions.h:157
see class PGM_BASE
void SetPlotSettings(const PCB_PLOT_PARAMS &aSettings) override
void OnSelectGrid(wxCommandEvent &event)
Command event handler for selecting grid sizes.
Declaration of the eda_3d_viewer class.
Common, abstract interface for edit frames.
void CloseFootprintEditor(wxCommandEvent &Event)
virtual void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Changes the current rendering backend.
SELECTION_CONDITION GraphicsFillDisplay()
Creates a functor that tests if the frame fills graphics items.
static TOOL_ACTION saveAs
Definition: actions.h:55
LIB_ID GetLoadedFPID() const
Return the LIB_ID of the part being edited.
PANEL_SELECTION_FILTER * m_selectionFilterPanel
AUI panel for changing the selection tool filter controls.
bool canCloseWindow(wxCloseEvent &Event) override
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:186
ACTION_MANAGER * GetActionManager()
Definition: tool_manager.h:200
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, APP_SETTINGS_BASE *aSettings, TOOLS_HOLDER *aFrame)
Sets the work environment (model, view, view controls and the parent window).
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Function SetEventDispatcher() Sets a dispatcher that processes events and forwards them to tools.
#define _(s)
Definition: 3d_actions.cpp:33
COLOR_SETTINGS * GetColorSettings() override
Helper to retrieve the current color settings.
SELECTION_CONDITION UndoAvailable()
Creates a functor that tests if there are any items in the undo queue.
std::vector< LAYER_PRESET > m_LayerPresets
BOARD_ITEM_CONTAINER * GetModel() const override
static TOOL_ACTION acceleratedGraphics
Definition: actions.h:168
NETCLASS * GetDefault() const
Function GetDefault.
PCB_EDIT_FRAME is the main frame for Pcbnew.
void ClrModify()
Definition: base_screen.h:121
FOOTPRINT_TREE_PANE * m_treePane
POINT_EDITOR.
Definition: point_editor.h:43
void SaveColorSettings(COLOR_SETTINGS *aSettings, const std::string &aNamespace="")
Safely saves a COLOR_SETTINGS to disk, preserving any changes outside the given namespace.
static bool empty(const wxTextEntryBase *aCtrl)
unsigned GetErrorCount() const
virtual void AddFootprintToBoard(FOOTPRINT *aFootprint)
Adds the given footprint to the board.
wxString GetActiveLayerPreset() const
MAGNETIC_SETTINGS * GetMagneticItemsSettings() override
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
PCB_VIEWER_TOOLS.
bool ReadFootprintFiles(FP_LIB_TABLE *aTable, const wxString *aNickname=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr) override
Read all the footprints provided by the combination of aTable and aNickname.
void ShowChangedLanguage() override
Update visible items after a language change.
Color settings are a bit different than most of the settings objects in that there can be more than o...
void OnUpdateLoadFootprintFromBoard(wxUpdateUIEvent &aEvent)
WX_INFOBAR * GetInfoBar()
static TOOL_ACTION deleteTool
Definition: actions.h:76
FOOTPRINT_EDITOR_SETTINGS * GetSettings()
VTBL_ENTRY const wxString GetProjectName() const
Function GetProjectName returns the short name of the project.
Definition: project.cpp:128
void SetPadsLocked(bool aPadsLocked)
Definition: footprint.h:336
static TOOL_ACTION undo
Definition: actions.h:67
void AddFootprintToBoard(FOOTPRINT *aFootprint) override
Override from PCB_BASE_EDIT_FRAME which adds a footprint to the editor's dummy board,...
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:76
void OnGridSettings(wxCommandEvent &event)
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:105
GERBVIEW_FRAME::OnZipFileHistory GERBVIEW_FRAME::OnSelectDisplayMode EVT_CHOICE(ID_GBR_AUX_TOOLBAR_PCB_APERATTRIBUTES_CHOICE, GERBVIEW_FRAME::OnSelectHighlightChoice) EVT_UPDATE_UI(ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER
void InitTools()
Function InitTools() Initializes all registered tools.
Abstract interface for BOARD_ITEMs capable of storing other items inside.
BOARD * GetBoard() const
static TOOL_ACTION gridSetOrigin
Definition: actions.h:140
void OnUpdateModuleSelected(wxUpdateUIEvent &aEvent)
BOARD_DESIGN_SETTINGS m_DesignSettings
Only some of these settings are actually used for footprint editing.
void UpdateAllLayersColor()
Function UpdateAllLayersColor() Applies the new coloring scheme to all layers.
Definition: view.cpp:776
EDA_ITEM * Clone() const override
Function Clone creates a duplicate of this item with linked list members set to NULL.
Definition: footprint.cpp:1081
Class that groups generic conditions for PCB editor states.
static constexpr int Millimeter2iu(double mm)
bool SaveFootprint(FOOTPRINT *aFootprint)
Save in an existing library a given footprint.
static TOOL_ACTION highContrastMode
Definition: actions.h:106
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76
static TOOL_ACTION selectAll
Definition: actions.h:73
void OnUpdateLayerSelectBox(wxUpdateUIEvent &aEvent)
void OnLayerAlphaChanged()
Updates the manual layer alpha overrides
void SetEnabledLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings Changes the bit-mask of ena...
Definition: board.cpp:457
static TOOL_ACTION paste
Definition: actions.h:71
PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
void StopDrawing()
Function StopDrawing() Prevents the GAL canvas from further drawing till it is recreated or StartDraw...
static TOOL_ACTION duplicate
Definition: actions.h:74
LIB_ID GetTreeFPID() const
Return the LIB_ID of the part or library selected in the footprint tree.
void SetBoardUse(BOARD_USE aUse)
Set what the board is going to be used for.
Definition: board.h:257
static TOOL_ACTION revert
Definition: actions.h:58
static const wxChar * GetFootprintEditorFrameName()
Function GetFootprintEditorFrameName (static)
static TOOL_ACTION selectionTool
Definition: actions.h:156
virtual void OnSelectZoom(wxCommandEvent &event)
Set the zoom factor when selected by the zoom list box in the main tool bar.
void RegisterTool(TOOL_BASE *aTool)
Function RegisterTool() Adds a tool to the manager set and sets it up.
void CenterLibId(const LIB_ID &aLibId)
Ensure that an item is visible (preferrably centered).
Definition: lib_tree.cpp:186
void OnSaveFootprintAsPng(wxCommandEvent &event)
void SelectLibId(const LIB_ID &aLibId)
Select an item in the tree widget.
Definition: lib_tree.cpp:180
bool empty() const
Definition: utf8.h:108
virtual void UpdateMsgPanel()
Redraw the message panel.
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.
static TOOL_ACTION textOutlines
Display texts as lines.
Definition: pcb_actions.h:389