KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 <[email protected]>
6 * Copyright (C) 2015-2016 Wayne Stambaugh <[email protected]>
7 * Copyright The 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 "tool/embed_tool.h"
24#include "tools/convert_tool.h"
25#include "tools/drawing_tool.h"
26#include "tools/edit_tool.h"
29#include "tools/pad_tool.h"
30#include "tools/pcb_actions.h"
31#include "tools/pcb_control.h"
38#include <bitmaps.h>
39#include <board.h>
40#include <footprint.h>
41#include <confirm.h>
44#include <footprint_info_impl.h>
45#include <fp_lib_table.h>
47#include <kiface_base.h>
48#include <kiplatform/app.h>
49#include <kiway.h>
50#include <macros.h>
51#include <pcbnew_id.h>
52#include <pgm_base.h>
53#include <project.h>
54#include <project_pcb.h>
56#include <tool/action_toolbar.h>
57#include <tool/common_control.h>
58#include <tool/common_tools.h>
60#include <tool/selection.h>
63#include <tool/tool_manager.h>
64#include <tool/zoom_tool.h>
65#include <tools/array_tool.h>
72#include <widgets/lib_tree.h>
79
80#include <wx/filedlg.h>
81#include <wx/hyperlink.h>
82
83BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
84 EVT_MENU( wxID_CLOSE, FOOTPRINT_EDIT_FRAME::CloseFootprintEditor )
85 EVT_MENU( wxID_EXIT, FOOTPRINT_EDIT_FRAME::OnExitKiCad )
86
88
91
93
94 // Drop files event
95 EVT_DROP_FILES( FOOTPRINT_EDIT_FRAME::OnDropFiles )
96
97END_EVENT_TABLE()
98
99
100FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
101 PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_FOOTPRINT_EDITOR, wxEmptyString,
102 wxDefaultPosition, wxDefaultSize,
103 KICAD_DEFAULT_DRAWFRAME_STYLE, GetFootprintEditorFrameName() ),
104 m_show_layer_manager_tools( true )
105{
106 m_showBorderAndTitleBlock = false; // true to show the frame references
107 m_aboutTitle = _HKI( "KiCad Footprint Editor" );
108 m_editorSettings = nullptr;
109
110 // Give an icon
111 wxIcon icon;
112 wxIconBundle icon_bundle;
113
114 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_modedit, 48 ) );
115 icon_bundle.AddIcon( icon );
116 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_modedit, 128 ) );
117 icon_bundle.AddIcon( icon );
118 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_modedit, 256 ) );
119 icon_bundle.AddIcon( icon );
120 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_modedit_32 ) );
121 icon_bundle.AddIcon( icon );
122 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_modedit_16 ) );
123 icon_bundle.AddIcon( icon );
124
125 SetIcons( icon_bundle );
126
127 // Create GAL canvas
128 m_canvasType = loadCanvasTypeSetting();
129
130 PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_frameSize,
131 GetGalDisplayOptions(), m_canvasType );
132 SetCanvas( drawPanel );
133
134 CreateInfoBar();
135
136 SetBoard( new BOARD() );
137
138 // This board will only be used to hold a footprint for editing
140
141 // In Footprint Editor, the default net clearance is not known (it depends on the actual
142 // board). So we do not show the default clearance, by setting it to 0. The footprint or
143 // pad specific clearance will be shown.
144 GetBoard()->GetDesignSettings().m_NetSettings->GetDefaultNetclass()->SetClearance( 0 );
145
146 // Don't show the default board solder mask expansion in the footprint editor. Only the
147 // footprint or pad mask expansions settings should be shown.
149
150 // Ensure all layers and items are visible:
151 // In footprint editor, some layers have no meaning or cannot be used, but we show all of
152 // them, at least to be able to edit a bad layer
154
155 GetGalDisplayOptions().m_axesEnabled = true;
156
157 // In Footprint Editor, set the default paper size to A4 for plot/print
158 SetPageSettings( PAGE_INFO( PAGE_INFO::A4 ) );
159 SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU( pcbIUScale.IU_PER_MILS ) ) );
160
161 // Create the manager and dispatcher & route draw panel events to the dispatcher
162 setupTools();
163 setupUIConditions();
164
165 initLibraryTree();
166 m_treePane = new FOOTPRINT_TREE_PANE( this );
167
168 m_toolbarSettings = GetToolbarSettings<FOOTPRINT_EDIT_TOOLBAR_SETTINGS>( "fpedit-toolbars" );
169 configureToolbars();
170 RecreateToolbars();
171 ReCreateLayerBox( false );
172
173 ReCreateMenuBar();
174
175 m_selectionFilterPanel = new PANEL_SELECTION_FILTER( this );
176 m_appearancePanel = new APPEARANCE_CONTROLS( this, GetCanvas(), true );
177 m_propertiesPanel = new PCB_PROPERTIES_PANEL( this, this );
178
179 // LoadSettings() *after* creating m_LayersManager, because LoadSettings() initialize
180 // parameters in m_LayersManager
181 // NOTE: KifaceSettings() will return PCBNEW_SETTINGS if we started from pcbnew
182 LoadSettings( GetSettings() );
183
184 updateEnabledLayers();
185
186 float proportion = GetFootprintEditorSettings()->m_AuiPanels.properties_splitter;
187 m_propertiesPanel->SetSplitterProportion( proportion );
188
189 SetActiveLayer( F_SilkS );
190
191 // Fetch a COPY of the config as a lot of these initializations are going to overwrite our
192 // data.
193 int libWidth = 0;
195
196 if( FOOTPRINT_EDITOR_SETTINGS* cfg = dynamic_cast<FOOTPRINT_EDITOR_SETTINGS*>( GetSettings() ) )
197 {
198 libWidth = cfg->m_LibWidth;
199 aui_cfg = cfg->m_AuiPanels;
200 }
201 else
202 {
203 // keep gcc quiet about uninitalized vars:
204 aui_cfg.appearance_panel_tab = 0;
205 aui_cfg.right_panel_width = -1;
206 }
207
208 m_auimgr.SetManagedWindow( this );
209
210 unsigned int auiFlags = wxAUI_MGR_DEFAULT;
211#if !defined( _WIN32 )
212 // Windows cannot redraw the UI fast enough during a live resize and may lead to all kinds
213 // of graphical glitches
214 auiFlags |= wxAUI_MGR_LIVE_RESIZE;
215#endif
216 m_auimgr.SetFlags( auiFlags );
217
218 // Rows; layers 4 - 6
219 m_auimgr.AddPane( m_tbTopMain, EDA_PANE().HToolbar().Name( "TopMainToolbar" )
220 .Top().Layer( 6 ) );
221
222 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" )
223 .Bottom().Layer( 6 ) );
224
225 // Columns; layers 1 - 3
226 m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "Footprints" )
227 .Left().Layer( 4 )
228 .Caption( _( "Libraries" ) )
229 .MinSize( FromDIP( 250 ), -1 ).BestSize( FromDIP( 250 ), -1 ) );
230 m_auimgr.AddPane( m_propertiesPanel, EDA_PANE().Name( PropertiesPaneName() )
231 .Left().Layer( 3 )
232 .Caption( _( "Properties" ) ).PaneBorder( false )
233 .MinSize( FromDIP( wxSize( 240, 60 ) ) ).BestSize( FromDIP( wxSize( 300, 200 ) ) ) );
234 m_auimgr.AddPane( m_tbLeft, EDA_PANE().VToolbar().Name( "LeftToolbar" )
235 .Left().Layer( 2 ) );
236
237 m_auimgr.AddPane( m_tbRight, EDA_PANE().VToolbar().Name( "RightToolbar" )
238 .Right().Layer(2) );
239 m_auimgr.AddPane( m_appearancePanel, EDA_PANE().Name( "LayersManager" )
240 .Right().Layer( 3 )
241 .Caption( _( "Appearance" ) ).PaneBorder( false )
242 .MinSize( FromDIP( 180 ), -1 ).BestSize( FromDIP( 180 ), -1 ) );
243 m_auimgr.AddPane( m_selectionFilterPanel, EDA_PANE().Palette().Name( "SelectionFilter" )
244 .Right().Layer( 3 ).Position( 2 )
245 .Caption( _( "Selection Filter" ) ).PaneBorder( false )
246 .MinSize( FromDIP( 180 ), -1 ).BestSize( FromDIP( 180 ), -1 ) );
247
248 // Center
249 m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" )
250 .Center() );
251
252 m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools );
253 m_auimgr.GetPane( "SelectionFilter" ).Show( m_show_layer_manager_tools );
254 m_auimgr.GetPane( PropertiesPaneName() ).Show( GetSettings()->m_AuiPanels.show_properties );
255
256 // The selection filter doesn't need to grow in the vertical direction when docked
257 m_auimgr.GetPane( "SelectionFilter" ).dock_proportion = 0;
258
261 DragAcceptFiles( true );
262
263 FinishAUIInitialization();
264
265 // Apply saved visibility stuff at the end
266 wxAuiPaneInfo& treePane = m_auimgr.GetPane( "Footprints" );
267 wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
268
269 if( libWidth > 0 )
270 SetAuiPaneSize( m_auimgr, treePane, libWidth, -1 );
271
272 if( aui_cfg.right_panel_width > 0 )
273 SetAuiPaneSize( m_auimgr, layersManager, aui_cfg.right_panel_width, -1 );
274
275 m_appearancePanel->SetTabIndex( aui_cfg.appearance_panel_tab );
276
277 if( FOOTPRINT_EDITOR_SETTINGS* cfg = dynamic_cast<FOOTPRINT_EDITOR_SETTINGS*>( GetSettings() ) )
278 {
279 m_appearancePanel->SetUserLayerPresets( cfg->m_LayerPresets );
280 m_appearancePanel->ApplyLayerPreset( cfg->m_ActiveLayerPreset );
281 }
282
283 // restore the last footprint from the project, if any, after the library has been init'ed
284 // N.B. This needs to happen after the AUI manager has been initialized so that we can
285 // properly call the WX_INFOBAR without crashing on some systems.
286 restoreLastFootprint();
287
288 // This displays the last footprint loaded, if any, so it must be done after restoreLastFootprint()
289 ActivateGalCanvas();
290
291 GetToolManager()->PostAction( ACTIONS::zoomFitScreen );
292 UpdateTitle();
293 setupUnits( GetSettings() );
294
295 resolveCanvasType();
296
297 // Default shutdown reason until a file is loaded
298 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "Footprint changes are unsaved" ) );
299
300 // Catch unhandled accelerator command characters that were no handled by the library tree
301 // panel.
302 Bind( wxEVT_CHAR, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
303 Bind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
304
305 // Ensure the window is on top
306 Raise();
307 Show( true );
308
309 // Register a call to update the toolbar sizes. It can't be done immediately because
310 // it seems to require some sizes calculated that aren't yet (at least on GTK).
311 CallAfter(
312 [this]()
313 {
314 // Ensure the controls on the toolbars all are correctly sized
315 UpdateToolbarControlSizes();
316 m_treePane->FocusSearchFieldIfExists();
317 } );
318}
319
320
322{
323 // Shutdown all running tools
324 if( m_toolManager )
326
327 // save the footprint in the PROJECT
329
330 // Clear the watched file
331 setFPWatcher( nullptr );
332
333 // We passed ownership of these to wxAuiManager.
334 // delete m_selectionFilterPanel;
335 // delete m_appearancePanel;
336 // delete m_treePane;
337}
338
339
341{
343
344 FOOTPRINT* fp = static_cast<FOOTPRINT*>( GetModel() );
345
346 if( fp )
347 {
348 std::vector<MSG_PANEL_ITEM> msgItems;
349 fp->GetMsgPanelInfo( this, msgItems );
350 SetMsgPanel( msgItems );
351 }
352}
353
354
356{
357 return GetScreen() && GetScreen()->IsContentModified()
359}
360
361
363{
364 return m_toolManager->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
365}
366
367
369{
370 // switches currently used canvas (Cairo / OpenGL).
371 PCB_BASE_FRAME::SwitchCanvas( aCanvasType );
372
373 GetCanvas()->GetGAL()->SetAxesEnabled( true );
374
375 // The base class method *does not reinit* the layers manager. We must update the layer
376 // widget to match board visibility states, both layers and render columns, and and some
377 // settings dependent on the canvas.
379}
380
381
383{
384 SyncLibraryTree( true );
386}
387
388
390{
391 wxAuiPaneInfo& treePane = m_auimgr.GetPane( m_treePane );
392 treePane.Show( !IsLibraryTreeShown() );
393
394 if( IsLibraryTreeShown() )
395 {
396 // SetAuiPaneSize also updates m_auimgr
398 }
399 else
400 {
401 m_editorSettings->m_LibWidth = m_treePane->GetSize().x;
402 m_auimgr.Update();
403 }
404}
405
406
408{
410}
411
412
414{
416 wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
417 wxAuiPaneInfo& selectionFilter = m_auimgr.GetPane( "SelectionFilter" );
418
419 // show auxiliary Vertical layers and visibility manager toolbar
421 layersManager.Show( m_show_layer_manager_tools );
422 selectionFilter.Show( m_show_layer_manager_tools );
423
425 {
426 SetAuiPaneSize( m_auimgr, layersManager, settings->m_AuiPanels.right_panel_width, -1 );
427 }
428 else
429 {
430 settings->m_AuiPanels.right_panel_width = m_appearancePanel->GetSize().x;
431 m_auimgr.Update();
432 }
433}
434
435
437{
438 return const_cast<wxAuiManager&>( m_auimgr ).GetPane( m_treePane ).IsShown();
439}
440
441
443{
444 return GetBoard()->GetFirstFootprint();
445}
446
447
449{
450 LIB_ID id;
451
452 if( IsLibraryTreeShown() )
454
455 if( id.GetLibNickname().empty() )
456 id = GetLoadedFPID();
457
458 return id;
459}
460
461
463{
464 FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
465
466 if( footprint )
467 return LIB_ID( footprint->GetFPID().GetLibNickname(), m_footprintNameWhenLoaded );
468 else
469 return LIB_ID();
470}
471
472
474{
475 if( GetBoard()->GetFirstFootprint() )
476 {
479 }
480
481 GetScreen()->SetContentModified( false );
482}
483
484
486{
487 // If we've already vetted closing this window, then we have no FP anymore
488 if( m_isClosing || !GetBoard() )
489 return false;
490
491 FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
492
493 return ( footprint && footprint->GetLink() != niluuid );
494}
495
496
498{
499 LIB_ID id = GetLoadedFPID();
500
501 if( id.IsValid() )
502 {
504 Prj().SetRString( PROJECT::PCB_FOOTPRINT_EDITOR_FP_NAME, id.GetLibItemName() );
505 }
506}
507
508
510{
511 const wxString& footprintName = Prj().GetRString( PROJECT::PCB_FOOTPRINT_EDITOR_FP_NAME );
512 const wxString& libNickname = Prj().GetRString( PROJECT::PCB_FOOTPRINT_EDITOR_LIB_NICKNAME );
513
514 if( libNickname.Length() && footprintName.Length() )
515 {
516 LIB_ID id;
517 id.SetLibNickname( libNickname );
518 id.SetLibItemName( footprintName );
519
520 FOOTPRINT* footprint = loadFootprint( id );
521
522 if( footprint )
523 AddFootprintToBoard( footprint );
524 }
525}
526
527
529{
530 // Enable one internal layer, because footprints support keepout areas that can be on
531 // internal layers only (therefore on the first internal layer). This is needed to handle
532 // these keepout in internal layers only.
534 GetBoard()->SetLayerName( In1_Cu, _( "Inner layers" ) );
535
536 // Don't drop pre-existing user layers
537 LSET enabledLayers = GetBoard()->GetEnabledLayers();
538
540 {
541 m_originalFootprintCopy->RunOnChildren(
542 [&]( BOARD_ITEM* child )
543 {
544 LSET childLayers = child->GetLayerSet() & LSET::UserDefinedLayersMask();
545
546 for( PCB_LAYER_ID layer : childLayers )
547 enabledLayers.set( layer );
548 },
549 RECURSE_MODE::RECURSE );
550 }
551
552 // Enable any layers that the user has gone to the trouble to name
553 if( FOOTPRINT_EDITOR_SETTINGS* cfg = GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>( "fpedit" ) )
554 {
555 for( const PCB_LAYER_ID& user : LSET::UserDefinedLayersMask() )
556 {
557 if( cfg->m_DesignSettings.m_UserLayerNames.contains( LSET::Name( user ).ToStdString() ) )
558 enabledLayers.set( user );
559 }
560 }
561
562 GetBoard()->SetEnabledLayers( enabledLayers );
563}
564
565
567{
569
570 m_originalFootprintCopy.reset( static_cast<FOOTPRINT*>( aFootprint->Clone() ) );
571 m_originalFootprintCopy->SetParent( nullptr );
572
574
576 // Ensure item UUIDs are valid
577 // ("old" footprints can have null uuids that create issues in fp editor)
578 aFootprint->FixUuids();
579
581
582 // Footprint Editor layer visibility is kept in the view, not the board (because the board
583 // just delegates to the project file, which we don't have).
584 for( PCB_LAYER_ID layer : GetBoard()->GetEnabledLayers() )
585 GetCanvas()->GetView()->SetLayerVisible( layer, true );
586
587 const wxString libName = aFootprint->GetFPID().GetLibNickname();
588
590 {
591 const wxString msg = wxString::Format( _( "Editing %s from board. Saving will update the board only." ),
592 aFootprint->GetReference() );
593 const wxString openLibLink = wxString::Format( _( "Open in library %s" ),
594 UnescapeString( libName ) );
595
596 const auto openLibraryCopy =
597 [this]( wxHyperlinkEvent& aEvent )
598 {
600 };
601
602 if( WX_INFOBAR* infobar = GetInfoBar() )
603 {
604 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, openLibLink,
605 wxEmptyString );
606 button->Bind( wxEVT_COMMAND_HYPERLINK, openLibraryCopy );
607
608 infobar->RemoveAllButtons();
609 infobar->AddButton( button );
610 infobar->AddCloseButton();
611 infobar->ShowMessage( msg, wxICON_INFORMATION );
612 }
613 }
614 // An empty libname is OK - you get that when creating a new footprint from the main menu
615 // In that case. treat is as editable, and the user will be prompted for save-as when saving.
616 else if( !libName.empty()
617 && !PROJECT_PCB::PcbFootprintLibs( &Prj() )->IsFootprintLibWritable( libName ) )
618 {
619 wxString msg = wxString::Format( _( "Editing footprint from read-only library %s." ),
620 UnescapeString( libName ) );
621
622 if( WX_INFOBAR* infobar = GetInfoBar() )
623 {
624 wxString link = _( "Save as editable copy" );
625
626 const auto saveAsEditableCopy =
627 [this, aFootprint]( wxHyperlinkEvent& aEvent )
628 {
629 SaveFootprintAs( aFootprint );
630 };
631
632 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, link, wxEmptyString );
633 button->Bind( wxEVT_COMMAND_HYPERLINK, saveAsEditableCopy );
634
635 infobar->RemoveAllButtons();
636 infobar->AddButton( button );
637 infobar->AddCloseButton();
638 infobar->ShowMessage( msg, wxICON_INFORMATION );
639 }
640 }
641 else
642 {
643 if( WX_INFOBAR* infobar = GetInfoBar() )
644 infobar->Dismiss();
645 }
646
649}
650
651
653{
654 ReloadFootprint( aFootprint );
655
657 setFPWatcher( nullptr );
658 else
659 setFPWatcher( aFootprint );
660}
661
662
664{
666}
667
668
670{
671 return GetBoard()->GetDesignSettings();
672}
673
674
676{
677 wxFAIL_MSG( wxT( "Plotting not supported in Footprint Editor" ) );
678
680}
681
682
684{
685 wxFAIL_MSG( wxT( "Plotting not supported in Footprint Editor" ) );
686}
687
688
690{
691 if( !m_editorSettings )
692 m_editorSettings = GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>( "fpedit" );
693
694 return m_editorSettings;
695}
696
697
699{
700 if( m_editorSettings )
701 return m_editorSettings;
702
704}
705
706
708{
709 // Get our own settings; aCfg will be the PCBNEW_SETTINGS because we're part of the pcbnew
710 // compile unit
712
713 if( cfg )
714 {
716
718
721
724
726
727 for( auto& [source_name, dest_name] : cfg->m_DesignSettings.m_UserLayerNames )
728 {
729 wxString wx_source_name = source_name;
730 PCB_LAYER_ID layer = static_cast<PCB_LAYER_ID>( LSET::NameToLayer( wx_source_name ) );
731
732 if( IsUserLayer( layer ) )
733 GetBoard()->SetLayerName( layer, dest_name );
734 }
735
736 }
737}
738
739
741{
742 // Load canvas type from the FOOTPRINT_EDITOR_SETTINGS:
744
745 // If we had an OpenGL failure this session, use the fallback GAL but don't update the
746 // user preference silently:
747
750}
751
752
754{
756
757 // Get our own settings; aCfg will be the PCBNEW_SETTINGS because we're part of the pcbnew
758 // compile unit
760
761 if( cfg )
762 {
764
767 cfg->m_LibWidth = m_treePane->GetSize().x;
769
771
773 {
774 cfg->m_AuiPanels.show_properties = m_propertiesPanel->IsShownOnScreen();
777 }
778
780
782 {
787 }
788 }
789}
790
791
792
794{
795 FOOTPRINT_EDITOR_SETTINGS* cfg = const_cast<FOOTPRINT_EDIT_FRAME*>( this )->GetSettings();
796
797 return cfg ? cfg->m_RotationAngle : ANGLE_90;
798}
799
800
801
803{
805 return ::GetColorSettings( cfg ? cfg->m_ColorTheme : DEFAULT_THEME );
806}
807
808
810{
811 static MAGNETIC_SETTINGS fallback;
812
814 return &cfg->m_MagneticItems;
815
816 return &fallback;
817}
818
819
820const BOX2I FOOTPRINT_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
821{
822 FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
823
824 if( footprint )
825 {
826 bool hasGraphicalItem = footprint->Pads().size() || footprint->Zones().size();
827
828 if( !hasGraphicalItem )
829 {
830 for( const BOARD_ITEM* item : footprint->GraphicalItems() )
831 {
832 if( item->Type() == PCB_TEXT_T || item->Type() == PCB_TEXTBOX_T )
833 continue;
834
835 hasGraphicalItem = true;
836 break;
837 }
838 }
839
840 if( hasGraphicalItem )
841 {
842 return footprint->GetBoundingBox( false );
843 }
844 else
845 {
846 BOX2I newFootprintBB( { 0, 0 }, { 0, 0 } );
847 newFootprintBB.Inflate( pcbIUScale.mmToIU( 12 ) );
848 return newFootprintBB;
849 }
850 }
851
852 return GetBoardBoundingBox( false );
853}
854
855
857{
858 if( IsContentModified() )
859 {
860 wxString footprintName = GetBoard()->GetFirstFootprint()->GetReference();
861 wxString msg = _( "Save changes to '%s' before closing?" );
862
863 if( !HandleUnsavedChanges( this, wxString::Format( msg, footprintName ),
864 [&]() -> bool
865 {
866 return SaveFootprint( GetBoard()->GetFirstFootprint() );
867 } ) )
868 {
869 return false;
870 }
871 }
872
873 if( doClose )
874 {
875 GetInfoBar()->ShowMessageFor( wxEmptyString, 1 );
876 Clear_Pcb( false );
877 UpdateTitle();
878 }
879
880 return true;
881}
882
883
884bool FOOTPRINT_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
885{
886 if( IsContentModified() )
887 {
888 // Shutdown blocks must be determined and vetoed as early as possible
890 aEvent.GetId() == wxEVT_QUERY_END_SESSION )
891 {
892 aEvent.Veto();
893 return false;
894 }
895
896 wxString footprintName = GetBoard()->GetFirstFootprint()->GetFPID().GetLibItemName();
897
899 footprintName = GetBoard()->GetFirstFootprint()->GetReference();
900
901 wxString msg = _( "Save changes to '%s' before closing?" );
902
903 if( !HandleUnsavedChanges( this, wxString::Format( msg, footprintName ),
904 [&]() -> bool
905 {
906 return SaveFootprint( GetBoard()->GetFirstFootprint() );
907 } ) )
908 {
909 aEvent.Veto();
910 return false;
911 }
912 }
913
914 PAD_TOOL* padTool = m_toolManager->GetTool<PAD_TOOL>();
915
916 if( padTool->InPadEditMode() )
917 padTool->ExitPadEditMode();
918
919 // Save footprint tree column widths
920 m_adapter->SaveSettings();
921
923}
924
925
927{
928 // No more vetos
929 GetCanvas()->SetEventDispatcher( nullptr );
931
932 if( GetLibTree() )
934
935 // Do not show the layer manager during closing to avoid flicker
936 // on some platforms (Windows) that generate useless redraw of items in
937 // the Layer Manager
938 m_auimgr.GetPane( wxT( "LayersManager" ) ).Show( false );
939 m_auimgr.GetPane( wxT( "SelectionFilter" ) ).Show( false );
940
941 Clear_Pcb( false );
942
944
945 if( mgr->IsProjectOpen() && wxFileName::IsDirWritable( Prj().GetProjectPath() ) )
946 {
947 GFootprintList.WriteCacheToFile( Prj().GetProjectPath() + wxT( "fp-info-cache" ) );
948 }
949}
950
951
952void FOOTPRINT_EDIT_FRAME::OnExitKiCad( wxCommandEvent& event )
953{
954 Kiway().OnKiCadExit();
955}
956
957
959{
960 Close();
961}
962
963
965{
966 // call my base class
968
969 // We have 2 panes to update.
970 // For some obscure reason, the AUI manager hides the first modified pane.
971 // So force show panes
972 wxAuiPaneInfo& tree_pane_info = m_auimgr.GetPane( m_treePane );
973 bool tree_shown = tree_pane_info.IsShown();
974 tree_pane_info.Caption( _( "Libraries" ) );
975
976 wxAuiPaneInfo& lm_pane_info = m_auimgr.GetPane( m_appearancePanel );
977 bool lm_shown = lm_pane_info.IsShown();
978 lm_pane_info.Caption( _( "Appearance" ) );
979 wxAuiPaneInfo& sf_pane_info = m_auimgr.GetPane( m_selectionFilterPanel );
980 sf_pane_info.Caption( _( "Selection Filter" ) );
981
982 // update the layer manager
984
985 // Now restore the visibility:
986 lm_pane_info.Show( lm_shown );
987 tree_pane_info.Show( tree_shown );
988 m_auimgr.Update();
989
991
992 UpdateTitle();
993}
994
995
997{
999
1000 if( m_isClosing )
1001 return;
1002
1003 Update3DView( true, true );
1005
1006 if( !GetTitle().StartsWith( wxT( "*" ) ) )
1007 UpdateTitle();
1008}
1009
1010
1012{
1013 wxString title;
1014 LIB_ID fpid = GetLoadedFPID();
1015 FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
1016 bool writable = true;
1017
1018 if( IsCurrentFPFromBoard() )
1019 {
1020 if( IsContentModified() )
1021 title = wxT( "*" );
1022
1023 title += footprint->GetReference();
1024 title += wxS( " " ) + wxString::Format( _( "[from %s]" ), Prj().GetProjectName()
1025 + wxT( "." )
1026 + FILEEXT::PcbFileExtension );
1027 }
1028 else if( fpid.IsValid() )
1029 {
1030 try
1031 {
1033 }
1034 catch( const IO_ERROR& )
1035 {
1036 // best efforts...
1037 }
1038
1039 // Note: don't used GetLoadedFPID(); footprint name may have been edited
1040 if( IsContentModified() )
1041 title = wxT( "*" );
1042
1043 title += From_UTF8( footprint->GetFPID().Format().c_str() );
1044
1045 if( !writable )
1046 title += wxS( " " ) + _( "[Read Only]" );
1047 }
1048 else if( !fpid.GetLibItemName().empty() )
1049 {
1050 // Note: don't used GetLoadedFPID(); footprint name may have been edited
1051 if( IsContentModified() )
1052 title = wxT( "*" );
1053
1054 title += From_UTF8( footprint->GetFPID().GetLibItemName().c_str() );
1055 title += wxS( " " ) + _( "[Unsaved]" );
1056 }
1057 else
1058 {
1059 title = _( "[no footprint loaded]" );
1060 }
1061
1062 title += wxT( " \u2014 " ) + _( "Footprint Editor" );
1063
1064 SetTitle( title );
1065}
1066
1067
1069{
1071}
1072
1073
1075{
1079 UpdateTitle();
1080}
1081
1082
1084{
1086
1087 WX_PROGRESS_REPORTER progressReporter( this, _( "Load Footprint Libraries" ), 1, PR_CAN_ABORT );
1088
1089 if( GFootprintList.GetCount() == 0 )
1090 GFootprintList.ReadCacheFromFile( Prj().GetProjectPath() + wxT( "fp-info-cache" ) );
1091
1092 GFootprintList.ReadFootprintFiles( fpTable, nullptr, &progressReporter );
1093 progressReporter.Show( false );
1094
1097
1099 auto adapter = static_cast<FP_TREE_SYNCHRONIZING_ADAPTER*>( m_adapter.get() );
1100
1101 adapter->AddLibraries( this );
1102}
1103
1104
1106{
1108 auto adapter = static_cast<FP_TREE_SYNCHRONIZING_ADAPTER*>( m_adapter.get() );
1109 LIB_ID target = GetTargetFPID();
1110 bool targetSelected = ( target == GetLibTree()->GetSelectedLibId() );
1111
1112 // Sync FOOTPRINT_INFO list to the libraries on disk
1113 if( aProgress )
1114 {
1115 WX_PROGRESS_REPORTER progressReporter( this, _( "Update Footprint Libraries" ), 1, PR_CAN_ABORT );
1116 GFootprintList.ReadFootprintFiles( fpTable, nullptr, &progressReporter );
1117 progressReporter.Show( false );
1118 }
1119 else
1120 {
1121 GFootprintList.ReadFootprintFiles( fpTable, nullptr, nullptr );
1122 }
1123
1124 // Unselect before syncing to avoid null reference in the adapter
1125 // if a selected item is removed during the sync
1126 GetLibTree()->Unselect();
1127
1128 // Sync the LIB_TREE to the FOOTPRINT_INFO list
1129 adapter->Sync( fpTable );
1130
1131 GetLibTree()->Regenerate( true );
1132
1133 if( target.IsValid() )
1134 {
1135 if( adapter->FindItem( target ) )
1136 {
1137 if( targetSelected )
1138 GetLibTree()->SelectLibId( target );
1139 else
1140 GetLibTree()->CenterLibId( target );
1141 }
1142 else
1143 {
1144 // Try to focus on parent
1145 target.SetLibItemName( wxEmptyString );
1146 GetLibTree()->CenterLibId( target );
1147 }
1148 }
1149}
1150
1151
1153{
1155}
1156
1157
1159{
1160 GetLibTree()->SelectLibId( aLibID );
1161}
1162
1163
1165{
1167}
1168
1169
1171{
1172 // Create the manager and dispatcher & route draw panel events to the dispatcher
1175 GetCanvas()->GetViewControls(), config(), this );
1176 m_actions = new PCB_ACTIONS();
1178
1180
1190 m_toolManager->RegisterTool( new PCB_CONTROL ); // copy/paste
1203
1204 for( TOOL_BASE* tool : m_toolManager->Tools() )
1205 {
1206 if( PCB_TOOL_BASE* pcbTool = dynamic_cast<PCB_TOOL_BASE*>( tool ) )
1207 pcbTool->SetIsFootprintEditor( true );
1208 }
1209
1210 m_toolManager->GetTool<PCB_VIEWER_TOOLS>()->SetFootprintFrame( true );
1212
1213 m_toolManager->InvokeTool( "common.InteractiveSelection" );
1214
1215 // Load or reload wizard plugins in case they changed since the last time the frame opened
1216 // Because the board editor has also a plugin python menu,
1217 // call the PCB_EDIT_FRAME RunAction() if the board editor is running
1218 // Otherwise run the current RunAction().
1219 PCB_EDIT_FRAME* pcbframe = static_cast<PCB_EDIT_FRAME*>( Kiway().Player( FRAME_PCB_EDITOR, false ) );
1220
1221 if( pcbframe )
1223 else
1225}
1226
1227
1229{
1231
1233 PCB_EDITOR_CONDITIONS cond( this );
1234
1235 wxASSERT( mgr );
1236
1237#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
1238#define CHECK( x ) ACTION_CONDITIONS().Check( x )
1239
1240 auto haveFootprintCond =
1241 [this]( const SELECTION& )
1242 {
1243 return GetBoard() && GetBoard()->GetFirstFootprint() != nullptr;
1244 };
1245
1246 auto footprintTargettedCond =
1247 [this]( const SELECTION& )
1248 {
1249 return !GetTargetFPID().GetLibItemName().empty();
1250 };
1251
1252 const auto footprintFromBoardCond =
1253 [this]( const SELECTION& )
1254 {
1255 return IsCurrentFPFromBoard();
1256 };
1257
1258 auto pcbFrameExistsCond =
1259 [this]( const SELECTION& )
1260 {
1261 PCB_EDIT_FRAME* frame = dynamic_cast<PCB_EDIT_FRAME*>( Kiway().Player( FRAME_PCB_EDITOR, false ) );
1262
1263 return ( frame != nullptr );
1264 };
1265
1266 auto boardFootprintExistsCond =
1267 [this]( const SELECTION& )
1268 {
1269 PCB_EDIT_FRAME* frame = dynamic_cast<PCB_EDIT_FRAME*>( Kiway().Player( FRAME_PCB_EDITOR, false ) );
1270
1271 FOOTPRINT* editorFootprint = GetBoard()->GetFirstFootprint();
1272 bool canInsert = frame && editorFootprint && editorFootprint->GetLink() == niluuid;
1273
1274 // If the source was deleted, the footprint can inserted but not updated in the board.
1275 if( frame && editorFootprint && editorFootprint->GetLink() != niluuid )
1276 {
1277 BOARD* mainpcb = frame->GetBoard();
1278 canInsert = true;
1279
1280 // search if the source footprint was not deleted:
1281 for( FOOTPRINT* candidate : mainpcb->Footprints() )
1282 {
1283 if( editorFootprint->GetLink() == candidate->m_Uuid )
1284 {
1285 canInsert = false;
1286 break;
1287 }
1288 }
1289 }
1290
1291 return canInsert;
1292 };
1293
1294 // clang-format off
1295 mgr->SetConditions( ACTIONS::saveAs, ENABLE( footprintTargettedCond ) );
1298 mgr->SetConditions( PCB_ACTIONS::editLibFpInFpEditor,ENABLE( footprintFromBoardCond ) );
1299
1300 mgr->SetConditions( PCB_ACTIONS::saveFpToBoard, ENABLE( boardFootprintExistsCond ) );
1301 mgr->SetConditions( PCB_ACTIONS::loadFpFromBoard, ENABLE( pcbFrameExistsCond ) );
1302
1305
1309 mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
1310 mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCH ) ) );
1311 mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
1312
1313 mgr->SetConditions( ACTIONS::cut, ENABLE( cond.HasItems() ) );
1314 mgr->SetConditions( ACTIONS::copy, ENABLE( cond.HasItems() ) );
1321
1328
1332
1335 // clang-format on
1336
1337 auto constrainedDrawingModeCond =
1338 [this]( const SELECTION& )
1339 {
1340 return GetSettings()->m_Use45Limit;
1341 };
1342
1343 auto highContrastCond =
1344 [this]( const SELECTION& )
1345 {
1346 return GetDisplayOptions().m_ContrastModeDisplay != HIGH_CONTRAST_MODE::NORMAL;
1347 };
1348
1349 auto boardFlippedCond =
1350 [this]( const SELECTION& )
1351 {
1352 return GetCanvas() && GetCanvas()->GetView()->IsMirroredX();
1353 };
1354
1355 auto libraryTreeCond =
1356 [this](const SELECTION& )
1357 {
1358 return IsLibraryTreeShown();
1359 };
1360
1361 auto layerManagerCond =
1362 [this]( const SELECTION& )
1363 {
1364 return m_auimgr.GetPane( "LayersManager" ).IsShown();
1365 };
1366
1367 auto propertiesCond =
1368 [this] ( const SELECTION& )
1369 {
1370 return m_auimgr.GetPane( PropertiesPaneName() ).IsShown();
1371 };
1372
1373 mgr->SetConditions( PCB_ACTIONS::toggleHV45Mode, CHECK( constrainedDrawingModeCond ) );
1374 mgr->SetConditions( ACTIONS::highContrastMode, CHECK( highContrastCond ) );
1375 mgr->SetConditions( PCB_ACTIONS::flipBoard, CHECK( boardFlippedCond ) );
1377
1378 mgr->SetConditions( ACTIONS::showLibraryTree, CHECK( libraryTreeCond ) );
1379 mgr->SetConditions( PCB_ACTIONS::showLayersManager, CHECK( layerManagerCond ) );
1380 mgr->SetConditions( ACTIONS::showProperties, CHECK( propertiesCond ) );
1381
1382 mgr->SetConditions( ACTIONS::print, ENABLE( haveFootprintCond ) );
1383 mgr->SetConditions( PCB_ACTIONS::exportFootprint, ENABLE( haveFootprintCond ) );
1384 mgr->SetConditions( PCB_ACTIONS::placeImportedGraphics, ENABLE( haveFootprintCond ) );
1385
1386 mgr->SetConditions( PCB_ACTIONS::footprintProperties, ENABLE( haveFootprintCond ) );
1387 mgr->SetConditions( PCB_ACTIONS::editTextAndGraphics, ENABLE( haveFootprintCond ) );
1388 mgr->SetConditions( PCB_ACTIONS::checkFootprint, ENABLE( haveFootprintCond ) );
1389 mgr->SetConditions( PCB_ACTIONS::repairFootprint, ENABLE( haveFootprintCond ) );
1390 mgr->SetConditions( PCB_ACTIONS::cleanupGraphics, ENABLE( haveFootprintCond ) );
1391 mgr->SetConditions( ACTIONS::showDatasheet, ENABLE( haveFootprintCond ) );
1392
1393 const auto isArcKeepCenterMode =
1394 [this]( const SELECTION& )
1395 {
1396 return GetSettings()->m_ArcEditMode == ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS;
1397 };
1398
1399 const auto isArcKeepEndpointMode =
1400 [this]( const SELECTION& )
1401 {
1402 return GetSettings()->m_ArcEditMode == ARC_EDIT_MODE::KEEP_ENDPOINTS_OR_START_DIRECTION;
1403 };
1404
1405 const auto isArcKeepRadiusMode =
1406 [this]( const SELECTION& )
1407 {
1408 return GetSettings()->m_ArcEditMode == ARC_EDIT_MODE::KEEP_CENTER_ENDS_ADJUST_ANGLE;
1409 };
1410
1411 // clang-format off
1412 mgr->SetConditions( ACTIONS::pointEditorArcKeepCenter, CHECK( isArcKeepCenterMode ) );
1413 mgr->SetConditions( ACTIONS::pointEditorArcKeepEndpoint, CHECK( isArcKeepEndpointMode ) );
1414 mgr->SetConditions( ACTIONS::pointEditorArcKeepRadius, CHECK( isArcKeepRadiusMode ) );
1415 // clang-format on
1416
1417// Only enable a tool if the part is edtable
1418#define CURRENT_EDIT_TOOL( action ) \
1419 mgr->SetConditions( action, ACTION_CONDITIONS().Enable( haveFootprintCond ) \
1420 .Check( cond.CurrentTool( action ) ) )
1421
1444
1445#undef CURRENT_EDIT_TOOL
1446#undef ENABLE
1447#undef CHECK
1448}
1449
1450
1452{
1454
1455 // Be sure the axis are enabled
1456 GetCanvas()->GetGAL()->SetAxesEnabled( true );
1457
1458 UpdateView();
1459
1460 // Ensure the m_Layers settings are using the canvas type:
1462}
1463
1464
1466{
1468
1469 if( FOOTPRINT_EDITOR_SETTINGS* cfg = GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>( "fpedit" ) )
1470 {
1471 GetGalDisplayOptions().ReadWindowSettings( cfg->m_Window );
1472
1473 GetBoard()->GetDesignSettings() = cfg->m_DesignSettings;
1475 }
1476
1480
1482
1483 if( aFlags & ENVVARS_CHANGED )
1484 SyncLibraryTree( true );
1485
1486 Layout();
1487 SendSizeEvent();
1488}
1489
1490
1491std::unique_ptr<GRID_HELPER> FOOTPRINT_EDIT_FRAME::MakeGridHelper()
1492{
1493 return std::make_unique<PCB_GRID_HELPER>( m_toolManager, GetMagneticItemsSettings() );
1494}
1495
1496
1498{
1499 LIB_ID id = GetLoadedFPID();
1500
1501 if( id.empty() )
1502 {
1503 DisplayErrorMessage( this, _( "No footprint selected." ) );
1504 return;
1505 }
1506
1507 wxFileName fn( id.GetLibItemName() );
1508 fn.SetExt( wxT( "png" ) );
1509
1510 wxString projectPath = wxPathOnly( Prj().GetProjectFullName() );
1511
1512 wxFileDialog dlg( this, _( "Export View as PNG" ), projectPath, fn.GetFullName(),
1513 FILEEXT::PngFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
1514
1515 if( dlg.ShowModal() == wxID_CANCEL || dlg.GetPath().IsEmpty() )
1516 return;
1517
1518 // calling wxYield is mandatory under Linux, after closing the file selector dialog
1519 // to refresh the screen before creating the PNG or JPEG image from screen
1520 wxYield();
1521 this->SaveCanvasImageToFile( dlg.GetPath(), BITMAP_TYPE::PNG );
1522}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:112
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:104
@ icon_modedit_32
@ icon_modedit
@ icon_modedit_16
static TOOL_ACTION toggleGrid
Definition: actions.h:195
static TOOL_ACTION paste
Definition: actions.h:80
static TOOL_ACTION millimetersUnits
Definition: actions.h:203
static TOOL_ACTION unselectAll
Definition: actions.h:83
static TOOL_ACTION revert
Definition: actions.h:62
static TOOL_ACTION showLibraryTree
Definition: actions.h:161
static TOOL_ACTION saveAs
Definition: actions.h:59
static TOOL_ACTION copy
Definition: actions.h:78
static TOOL_ACTION pluginsReload
Definition: actions.h:291
static TOOL_ACTION group
Definition: actions.h:236
static TOOL_ACTION pasteSpecial
Definition: actions.h:81
static TOOL_ACTION showDatasheet
Definition: actions.h:264
static TOOL_ACTION pointEditorArcKeepCenter
Definition: actions.h:270
static TOOL_ACTION milsUnits
Definition: actions.h:202
static TOOL_ACTION ungroup
Definition: actions.h:237
static TOOL_ACTION toggleBoundingBoxes
Definition: actions.h:154
static TOOL_ACTION pointEditorArcKeepRadius
Definition: actions.h:272
static TOOL_ACTION undo
Definition: actions.h:75
static TOOL_ACTION duplicate
Definition: actions.h:84
static TOOL_ACTION inchesUnits
Definition: actions.h:201
static TOOL_ACTION highContrastMode
Definition: actions.h:152
static TOOL_ACTION embeddedFiles
Definition: actions.h:294
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:151
static TOOL_ACTION measureTool
Definition: actions.h:249
static TOOL_ACTION doDelete
Definition: actions.h:85
static TOOL_ACTION selectionTool
Definition: actions.h:248
static TOOL_ACTION save
Definition: actions.h:58
static TOOL_ACTION zoomFitScreen
Definition: actions.h:141
static TOOL_ACTION redo
Definition: actions.h:76
static TOOL_ACTION deleteTool
Definition: actions.h:86
static TOOL_ACTION zoomTool
Definition: actions.h:145
static TOOL_ACTION print
Definition: actions.h:64
static TOOL_ACTION showProperties
Definition: actions.h:263
static TOOL_ACTION cut
Definition: actions.h:77
static TOOL_ACTION gridSetOrigin
Definition: actions.h:192
static TOOL_ACTION ddAddLibrary
Definition: actions.h:67
static TOOL_ACTION toggleGridOverrides
Definition: actions.h:196
static TOOL_ACTION selectAll
Definition: actions.h:82
static TOOL_ACTION pointEditorArcKeepEndpoint
Definition: actions.h:271
Manage TOOL_ACTION objects.
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...
std::vector< LAYER_PRESET > GetUserLayerPresets() const
Update the current layer presets from those saved in the project file.
int GetTabIndex() const
Set the current notebook tab.
void UpdateDisplayOptions()
Return a list of the layer presets created by the user.
wxString GetActiveLayerPreset() const
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:108
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:236
The array tool.
Definition: array_tool.h:48
bool IsContentModified() const
Definition: base_screen.h:60
void SetContentModified(bool aModified=true)
Definition: base_screen.h:59
BASE_SET & set(size_t pos)
Definition: base_set.h:116
Container for design settings for a BOARD object.
std::shared_ptr< NET_SETTINGS > m_NetSettings
std::map< std::string, wxString > m_UserLayerNames
Abstract interface for BOARD_ITEMs capable of storing other items inside.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:79
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Definition: board_item.h:252
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:317
void SetBoardUse(BOARD_USE aUse)
Set what the board is going to be used for.
Definition: board.h:329
bool SetLayerName(PCB_LAYER_ID aLayer, const wxString &aLayerName)
Changes the name of the layer given by aLayer.
Definition: board.cpp:698
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Definition: board.h:489
void SetVisibleAlls()
Change the bit-mask of visible element categories and layers.
Definition: board.cpp:956
const FOOTPRINTS & Footprints() const
Definition: board.h:358
void SetCopperLayerCount(int aCount)
Definition: board.cpp:865
void DeleteAllFootprints()
Remove all footprints from the deque and free the memory associated with them.
Definition: board.cpp:1563
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:1024
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:907
void SetEnabledLayers(const LSET &aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:927
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:558
Color settings are a bit different than most of the settings objects in that there can be more than o...
Handle actions that are shared between different applications.
Handles action that are shared between different applications.
Definition: common_tools.h:38
Tool responsible for drawing graphical elements like lines, arcs, circles, etc.
Definition: drawing_tool.h:55
void CommonSettingsChanged(int aFlags) override
Notification event that some of the common (suite-wide) settings have changed.
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
wxAuiManager m_auimgr
virtual void OnSize(wxSizeEvent &aEvent)
virtual bool canCloseWindow(wxCloseEvent &aCloseEvent)
virtual void OnDropFiles(wxDropFilesEvent &aEvent)
Handle event fired when a file is dropped to the window.
bool m_isClosing
Set by the close window event handler after frames are asked if they can close.
WX_INFOBAR * GetInfoBar()
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
The current canvas type.
void OnSelectGrid(wxCommandEvent &event)
Command event handler for selecting grid sizes.
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
bool SaveCanvasImageToFile(const wxString &aFileName, BITMAP_TYPE aBitmapType)
Save the current view as an image file.
virtual void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Change the current rendering backend.
virtual void OnSelectZoom(wxCommandEvent &event)
Set the zoom factor when selected by the zoom list box in the main tool bar.
GAL_DISPLAY_OPTIONS_IMPL & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
static bool m_openGLFailureOccured
Has any failure occurred when switching to OpenGL in any EDA_DRAW_FRAME?
static const wxString PropertiesPaneName()
virtual void UpdateMsgPanel()
Redraw the message panel.
EDA_DRAW_PANEL_GAL::GAL_TYPE loadCanvasTypeSetting()
Return the canvas type stored in the application settings.
PROPERTIES_PANEL * m_propertiesPanel
static constexpr GAL_TYPE GAL_FALLBACK
void StopDrawing()
Prevent the GAL canvas from further drawing until it is recreated or StartDrawing() is called.
void ForceRefresh()
Force a redraw.
@ GAL_TYPE_OPENGL
OpenGL implementation.
KIGFX::GAL * GetGAL() const
Return a pointer to the GAL instance used in the panel.
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Set a dispatcher that processes events and forwards them to tools.
Specialization of the wxAuiPaneInfo class for KiCad panels.
SELECTION_CONDITION NoActiveTool()
Create a functor testing if there are no tools active in the frame.
SELECTION_CONDITION BoundingBoxes()
SELECTION_CONDITION RedoAvailable()
Create a functor that tests if there are any items in the redo queue.
SELECTION_CONDITION CurrentTool(const TOOL_ACTION &aTool)
Create a functor testing if the specified tool is the current active tool in the frame.
virtual SELECTION_CONDITION UndoAvailable()
Create a functor that tests if there are any items in the undo queue.
SELECTION_CONDITION Units(EDA_UNITS aUnit)
Create a functor that tests if the frame has the specified units.
SELECTION_CONDITION GridVisible()
Create a functor testing if the grid is visible in a frame.
SELECTION_CONDITION ContentModified()
Create a functor that tests if the content of the frame is modified.
SELECTION_CONDITION GridOverrides()
Create a functor testing if the grid overrides wires is enabled in a frame.
SELECTION_CONDITION FullscreenCursor()
Create a functor testing if the cursor is full screen in a frame.
The interactive edit tool.
Definition: edit_tool.h:56
Module editor specific tools.
BOARD_DESIGN_SETTINGS m_DesignSettings
Only some of these settings are actually used for footprint editing.
std::vector< LAYER_PRESET > m_LayerPresets
PCB_SELECTION_FILTER_OPTIONS m_SelectionFilter
void CloseFootprintEditor(wxCommandEvent &Event)
BOARD_DESIGN_SETTINGS & GetDesignSettings() const override
Return the BOARD_DESIGN_SETTINGS for the open project.
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
void ActivateGalCanvas() override
Use to start up the GAL drawing canvas.
void HardRedraw() override
Refresh the library tree and redraw the window.
static const wxChar * GetFootprintEditorFrameName()
void SyncLibraryTree(bool aProgress)
Synchronize the footprint library tree to the current state of the footprint library table.
void OnSaveFootprintAsPng(wxCommandEvent &event)
bool SaveFootprintAs(FOOTPRINT *aFootprint)
void FocusLibraryTreeInput() override
void ToggleLibraryTree() override
BOARD_ITEM_CONTAINER * GetModel() const override
LIB_TREE * GetLibTree() const override
bool canCloseWindow(wxCloseEvent &Event) override
void UpdateMsgPanel() override
Redraw the message panel.
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.
APP_SETTINGS_BASE * config() const override
Return the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
void SetPlotSettings(const PCB_PLOT_PARAMS &aSettings) override
bool SaveFootprint(FOOTPRINT *aFootprint)
Save in an existing library a given footprint.
void initLibraryTree()
Make sure the footprint info list is loaded (with a progress dialog) and then initialize the footprin...
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void ShowChangedLanguage() override
Update visible items after a language change.
void resolveCanvasType() override
Determines the Canvas type to load (with prompt if required) and initializes m_canvasType.
void CommonSettingsChanged(int aFlags) override
Called after the preferences dialog is run.
bool IsContentModified() const override
Get if any footprints or libraries have been modified but not saved.
void UpdateUserInterface()
Update the layer manager and other widgets from the board setup (layer and items visibility,...
wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > m_adapter
bool IsLibraryTreeShown() const override
FOOTPRINT_EDITOR_SETTINGS * m_editorSettings
const BOX2I GetDocumentExtents(bool aIncludeAllVisible=true) const override
Return bounding box of document with option to not include some items.
bool Clear_Pcb(bool doAskAboutUnsavedChanges)
Delete all and reinitialize the current board.
Definition: initpcb.cpp:108
SELECTION & GetCurrentSelection() override
Get the current selection from the canvas area.
bool CanCloseFPFromBoard(bool doClose)
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...
FOOTPRINT_TREE_PANE * m_treePane
std::unique_ptr< GRID_HELPER > MakeGridHelper() override
void OnDisplayOptionsChanged() override
void FocusOnLibID(const LIB_ID &aLibID)
const PCB_PLOT_PARAMS & GetPlotSettings() const override
Return the PCB_PLOT_PARAMS for the BOARD owned by this frame.
std::unique_ptr< FOOTPRINT > m_originalFootprintCopy
void ReloadFootprint(FOOTPRINT *aFootprint) override
Override from PCB_BASE_FRAME which reloads the footprint from the library without setting the footpri...
EDA_ANGLE GetRotationAngle() const override
Return the angle used for rotate operations.
void RefreshLibraryTree()
Redisplay the library tree.
void OnExitKiCad(wxCommandEvent &aEvent)
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
MAGNETIC_SETTINGS * GetMagneticItemsSettings() override
FOOTPRINT_EDITOR_SETTINGS * GetSettings()
void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType) override
Switch the currently used canvas (Cairo / OpenGL).
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Helper to retrieve the current color settings.
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 WriteCacheToFile(const wxString &aFilePath) override
void ReadCacheFromFile(const wxString &aFilePath) override
void DisplayErrors(wxTopLevelWindow *aCaller=nullptr)
unsigned GetErrorCount() const
unsigned GetCount() const
Footprint Editor pane with footprint library tree.
void FocusSearchFieldIfExists()
Focus the search widget if it exists.
bool FixUuids()
Old footprints do not always have a valid UUID (some can be set to null uuid) However null UUIDs,...
Definition: footprint.cpp:705
ZONES & Zones()
Definition: footprint.h:215
EDA_ITEM * Clone() const override
Invoke a function on all children.
Definition: footprint.cpp:2250
std::deque< PAD * > & Pads()
Definition: footprint.h:209
const LIB_ID & GetFPID() const
Definition: footprint.h:251
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition: footprint.cpp:1685
KIID GetLink() const
Definition: footprint.h:843
const wxString & GetReference() const
Definition: footprint.h:627
DRAWINGS & GraphicalItems()
Definition: footprint.h:212
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: footprint.cpp:1347
bool IsFootprintLibWritable(const wxString &aNickname)
Return true if the library given by aNickname is writable.
void AddLibraries(EDA_BASE_FRAME *aParent)
static wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > Create(FOOTPRINT_EDIT_FRAME *aFrame, FP_LIB_TABLE *aLibs)
void ReadWindowSettings(WINDOW_SETTINGS &aCfg)
Read GAL config options from application-level config.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:77
bool m_axesEnabled
Fullscreen crosshair or small cross.
void SetAxesEnabled(bool aAxesEnabled)
Enable drawing the axes.
void UpdateAllLayersColor()
Apply the new coloring scheme to all layers.
Definition: view.cpp:775
void SetLayerVisible(int aLayer, bool aVisible=true)
Control the visibility of a particular layer.
Definition: view.h:400
bool IsMirroredX() const
Return true if view is flipped across the X axis.
Definition: view.h:250
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition: view.h:639
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:286
void OnKiCadExit()
Definition: kiway.cpp:694
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:395
Module editor specific tools.
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
int SetLibItemName(const UTF8 &aLibItemName)
Override the library item name portion of the LIB_ID to aLibItemName.
Definition: lib_id.cpp:111
bool IsValid() const
Check if this LID_ID is valid.
Definition: lib_id.h:172
int SetLibNickname(const UTF8 &aLibNickname)
Override the logical library name portion of the LIB_ID to aLibNickname.
Definition: lib_id.cpp:100
UTF8 Format() const
Definition: lib_id.cpp:119
const wxString GetUniStringLibItemName() const
Get strings for display messages in dialogs.
Definition: lib_id.h:112
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
void RefreshLibTree()
Refresh the tree (mainly to update highlighting and asterisking)
Definition: lib_tree.cpp:472
void CenterLibId(const LIB_ID &aLibId)
Ensure that an item is visible (preferably centered).
Definition: lib_tree.cpp:381
void ShutdownPreviews()
Definition: lib_tree.cpp:287
void ShowChangedLanguage()
Definition: lib_tree.cpp:304
void SelectLibId(const LIB_ID &aLibId)
Select an item in the tree widget.
Definition: lib_tree.cpp:375
LIB_TREE_MODEL_ADAPTER::SORT_MODE GetSortMode() const
Definition: lib_tree.h:155
void Unselect()
Unselect currently selected item in wxDataViewCtrl.
Definition: lib_tree.cpp:387
LIB_ID GetSelectedLibId(int *aUnit=nullptr) const
For multi-unit symbols, if the user selects the symbol itself rather than picking an individual unit,...
Definition: lib_tree.cpp:314
void Regenerate(bool aKeepState)
Regenerate the tree.
Definition: lib_tree.cpp:454
void SetSortMode(LIB_TREE_MODEL_ADAPTER::SORT_MODE aMode)
Save/restore the sorting mode.
Definition: lib_tree.h:154
LSET is a set of PCB_LAYER_IDs.
Definition: lset.h:37
static int NameToLayer(wxString &aName)
Return the layer number from a layer name.
Definition: lset.cpp:117
static LSET UserDefinedLayersMask(int aUserDefinedLayerCount=MAX_USER_DEFINED_LAYERS)
Return a mask with the requested number of user defined layers.
Definition: lset.cpp:687
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
Definition: lset.cpp:188
void ExitPadEditMode()
Definition: pad_tool.cpp:832
bool InPadEditMode()
Definition: pad_tool.h:61
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:59
static const wxChar A4[]
Definition: page_info.h:68
void SetCheckboxesFromFilter(PCB_SELECTION_FILTER_OPTIONS &aOptions)
Gather all the actions that are shared by tools.
Definition: pcb_actions.h:51
static TOOL_ACTION toggleHV45Mode
Definition: pcb_actions.h:539
static TOOL_ACTION drawRuleArea
Definition: pcb_actions.h:211
static TOOL_ACTION drawBezier
Definition: pcb_actions.h:194
static TOOL_ACTION placeText
Definition: pcb_actions.h:196
static TOOL_ACTION drawOrthogonalDimension
Definition: pcb_actions.h:207
static TOOL_ACTION drawRectangle
Definition: pcb_actions.h:191
static TOOL_ACTION setAnchor
Definition: pcb_actions.h:218
static TOOL_ACTION padDisplayMode
Definition: pcb_actions.h:319
static TOOL_ACTION placeReferenceImage
Definition: pcb_actions.h:195
static TOOL_ACTION showLayersManager
Definition: pcb_actions.h:451
static TOOL_ACTION drawCircle
Definition: pcb_actions.h:192
static TOOL_ACTION mirrorH
Mirroring of selected items.
Definition: pcb_actions.h:125
static TOOL_ACTION exportFootprint
Definition: pcb_actions.h:485
static TOOL_ACTION drawTable
Definition: pcb_actions.h:198
static TOOL_ACTION drawTextBox
Definition: pcb_actions.h:197
static TOOL_ACTION drawPolygon
Definition: pcb_actions.h:190
static TOOL_ACTION placePad
Activation of the drawing tool (placing a PAD)
Definition: pcb_actions.h:499
static TOOL_ACTION drawRadialDimension
Definition: pcb_actions.h:206
static TOOL_ACTION editTextAndGraphics
Definition: pcb_actions.h:434
static TOOL_ACTION drawLeader
Definition: pcb_actions.h:208
static TOOL_ACTION ddImportFootprint
Definition: pcb_actions.h:598
static TOOL_ACTION placeImportedGraphics
Definition: pcb_actions.h:217
static TOOL_ACTION drawArc
Definition: pcb_actions.h:193
static TOOL_ACTION graphicsOutlines
Display footprint graphics as outlines.
Definition: pcb_actions.h:511
static TOOL_ACTION loadFpFromBoard
Definition: pcb_actions.h:492
static TOOL_ACTION drawCenterDimension
Definition: pcb_actions.h:205
static TOOL_ACTION footprintProperties
Definition: pcb_actions.h:487
static TOOL_ACTION flipBoard
Definition: pcb_actions.h:374
static TOOL_ACTION textOutlines
Display texts as lines.
Definition: pcb_actions.h:514
static TOOL_ACTION checkFootprint
Definition: pcb_actions.h:490
static TOOL_ACTION editLibFpInFpEditor
Definition: pcb_actions.h:449
static TOOL_ACTION mirrorV
Definition: pcb_actions.h:126
static TOOL_ACTION repairFootprint
Definition: pcb_actions.h:557
static TOOL_ACTION saveFpToBoard
Definition: pcb_actions.h:493
static TOOL_ACTION drawLine
Definition: pcb_actions.h:189
static TOOL_ACTION cleanupGraphics
Definition: pcb_actions.h:438
static TOOL_ACTION rotateCw
Rotation of selected objects.
Definition: pcb_actions.h:118
static TOOL_ACTION rotateCcw
Definition: pcb_actions.h:119
static TOOL_ACTION drawAlignedDimension
Definition: pcb_actions.h:204
Common, abstract interface for edit frames.
APPEARANCE_CONTROLS * m_appearancePanel
PANEL_SELECTION_FILTER * m_selectionFilterPanel
void ActivateGalCanvas() override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
virtual const PCB_PLOT_PARAMS & GetPlotSettings() const
Return the PCB_PLOT_PARAMS for the BOARD owned by this frame.
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void setFPWatcher(FOOTPRINT *aFootprint)
Create or removes a watcher on the specified footprint.
void OnModify() override
Must be called after a change in order to set the "modify" flag and update other data structures and ...
FOOTPRINT * loadFootprint(const LIB_ID &aFootprintId)
Attempt to load aFootprintId from the footprint library table.
BOX2I GetBoardBoundingBox(bool aBoardEdgesOnly=false) const
Calculate the bounding box containing all board items (or board edge segments).
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
BOARD * GetBoard() const
virtual void AddFootprintToBoard(FOOTPRINT *aFootprint)
Add the given footprint to the board.
PCB_DISPLAY_OPTIONS m_displayOptions
FOOTPRINT_EDITOR_SETTINGS * GetFootprintEditorSettings() const
virtual void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
Handle actions that are shared between different frames in PcbNew.
Definition: pcb_control.h:47
HIGH_CONTRAST_MODE m_ContrastModeDisplay
How inactive layers are displayed.
void UpdateColors()
Update the color settings in the painter and GAL.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
void DisplayBoard(BOARD *aBoard, PROGRESS_REPORTER *aReporter=nullptr)
Add all items from the current board to the VIEW, so they can be displayed by GAL.
Group generic conditions for PCB editor states.
SELECTION_CONDITION PadFillDisplay()
Create a functor that tests if the frame fills the pads.
SELECTION_CONDITION HasItems()
Create a functor that tests if there are items in the board.
SELECTION_CONDITION GraphicsFillDisplay()
Create a functor that tests if the frame fills graphics items.
SELECTION_CONDITION TextFillDisplay()
Create a functor that tests if the frame fills text items.
The main frame for Pcbnew.
Generic tool for picking an item.
Parameters and options when plotting/printing a board.
Tool that displays edit points allowing to modify items by dragging the points.
The selection tool: currently supports:
Tool useful for viewing footprints.
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:125
The interactive edit tool.
static FP_LIB_TABLE * PcbFootprintLibs(PROJECT *aProject)
Return the table of footprint libraries without Kiway.
Definition: project_pcb.cpp:37
@ PCB_FOOTPRINT_EDITOR_FP_NAME
Definition: project.h:231
@ PCB_FOOTPRINT_EDITOR_LIB_NICKNAME
Definition: project.h:232
virtual void SetRString(RSTRING_T aStringId, const wxString &aString)
Store a "retained string", which is any session and project specific string identified in enum RSTRIN...
Definition: project.cpp:321
virtual const wxString & GetRString(RSTRING_T aStringId)
Return a "retained string", which is any session and project specific string identified in enum RSTRI...
Definition: project.cpp:332
float SplitterProportion() const
Action handler for the Properties panel.
Tool relating to pads and pad settings.
static SELECTION_CONDITION HasType(KICAD_T aType)
Create a functor that tests if among the selected items there is at least one of a given type.
static bool NotEmpty(const SELECTION &aSelection)
Test if there are any items selected.
static bool Idle(const SELECTION &aSelection)
Test if there no items selected or being edited.
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
T * GetAppSettings(const char *aFilename)
Return a handle to the a given settings by type.
bool IsProjectOpen() const
Helper for checking if we have a project open.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:171
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:173
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:55
ACTIONS * m_actions
Definition: tools_holder.h:172
Base abstract interface for all kinds of tools.
Definition: tool_base.h:66
@ MODEL_RELOAD
Model changes (the sheet for a schematic)
Definition: tool_base.h:80
virtual void DispatchWxEvent(wxEvent &aEvent)
Process wxEvents (mostly UI events), translate them to TOOL_EVENTs, and make tools handle those.
Master controller class:
Definition: tool_manager.h:62
bool RunAction(const std::string &aActionName, T aParam)
Run the specified action immediately, pausing the current action to run the new one.
Definition: tool_manager.h:150
bool InvokeTool(TOOL_ID aToolId)
Call a tool by sending a tool activation event to tool of given ID.
ACTION_MANAGER * GetActionManager() const
Definition: tool_manager.h:306
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Reset all tools (i.e.
std::vector< TOOL_BASE * > Tools()
Definition: tool_manager.h:341
void RegisterTool(TOOL_BASE *aTool)
Add a tool to the manager set and sets it up.
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, APP_SETTINGS_BASE *aSettings, TOOLS_HOLDER *aFrame)
Set the work environment (model, view, view controls and the parent window).
void InitTools()
Initialize all registered tools.
void ShutdownAllTools()
Shutdown all tools with a currently registered event loop in this tool manager by waking them up with...
bool empty() const
Definition: utf8.h:110
const char * c_str() const
Definition: utf8.h:109
A modified version of the wxInfoBar class that allows us to:
Definition: wx_infobar.h:76
void ShowMessageFor(const wxString &aMessage, int aTime, int aFlags=wxICON_INFORMATION, MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the infobar with the provided message and icon for a specific period of time.
Definition: wx_infobar.cpp:142
Multi-thread safe progress reporter dialog, intended for use of tasks that parallel reporting back of...
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:129
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:194
This file is part of the common library.
#define CHECK(x)
#define ENABLE(x)
#define _HKI(x)
static bool empty(const wxTextEntryBase *aCtrl)
#define _(s)
Declaration of the eda_3d_viewer class.
static constexpr EDA_ANGLE ANGLE_90
Definition: eda_angle.h:413
#define KICAD_DEFAULT_DRAWFRAME_STYLE
#define FOOTPRINT_EDIT_FRAME_NAME
#define CURRENT_EDIT_TOOL(action)
FOOTPRINT_LIST_IMPL GFootprintList
The global footprint info table.
Definition: cvpcb.cpp:156
@ FRAME_PCB_EDITOR
Definition: frame_type.h:42
@ FRAME_FOOTPRINT_EDITOR
Definition: frame_type.h:43
static const std::string KiCadFootprintLibPathExtension
static const std::string KiCadFootprintFileExtension
static wxString PngFileWildcard()
@ ID_ON_GRID_SELECT
Definition: id.h:114
@ ID_ON_ZOOM_SELECT
Definition: id.h:112
PROJECT & Prj()
Definition: kicad.cpp:608
KIID niluuid(0)
bool IsUserLayer(PCB_LAYER_ID aLayerId)
Test whether a layer is a non copper and a non tech layer.
Definition: layer_ids.h:746
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
@ F_SilkS
Definition: layer_ids.h:100
@ In1_Cu
Definition: layer_ids.h:66
This file contains miscellaneous commonly used macros and functions.
@ TARGET_NONCACHED
Auxiliary rendering target (noncached)
Definition: definitions.h:38
void SetShutdownBlockReason(wxWindow *aWindow, const wxString &aReason)
Sets the block reason why the window/application is preventing OS shutdown.
Definition: unix/app.cpp:90
bool SupportsShutdownBlockReason()
Whether or not the window supports setting a shutdown block reason.
Definition: unix/app.cpp:79
@ ID_FPEDIT_SAVE_PNG
Definition: pcbnew_id.h:77
SETTINGS_MANAGER * GetSettingsManager()
BOARD * GetBoard()
PGM_BASE & Pgm()
The global program "get" accessor.
Definition: pgm_base.cpp:902
see class PGM_BASE
#define DEFAULT_THEME
KIWAY Kiway(KFCTL_STANDALONE)
wxString UnescapeString(const wxString &aSource)
wxString From_UTF8(const char *cstring)
const double IU_PER_MILS
Definition: base_units.h:77
constexpr int mmToIU(double mm) const
Definition: base_units.h:92
#define ENVVARS_CHANGED
Definition: tools_holder.h:152
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:110
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
Definition: typeinfo.h:93
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
Definition: typeinfo.h:92
Definition of file extensions used in Kicad.
void SetAuiPaneSize(wxAuiManager &aManager, wxAuiPaneInfo &aPane, int aWidth, int aHeight)
Sets the size of an AUI pane, working around http://trac.wxwidgets.org/ticket/13180.
#define PR_CAN_ABORT