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( GetSettings() );
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 // Enable one internal layer, because footprints support keepout areas that can be on
185 // internal layers only (therefore on the first internal layer). This is needed to handle
186 // these keepout in internal layers only.
188 GetBoard()->SetLayerName( In1_Cu, _( "Inner layers" ) );
189
190 float proportion = GetFootprintEditorSettings()->m_AuiPanels.properties_splitter;
191 m_propertiesPanel->SetSplitterProportion( proportion );
192
193 SetActiveLayer( F_SilkS );
194
195 // Fetch a COPY of the config as a lot of these initializations are going to overwrite our
196 // data.
197 int libWidth = 0;
199
200 if( FOOTPRINT_EDITOR_SETTINGS* cfg = dynamic_cast<FOOTPRINT_EDITOR_SETTINGS*>( GetSettings() ) )
201 {
202 libWidth = cfg->m_LibWidth;
203 aui_cfg = cfg->m_AuiPanels;
204 }
205 else
206 {
207 // keep gcc quiet about uninitalized vars:
208 aui_cfg.appearance_panel_tab = 0;
209 aui_cfg.right_panel_width = -1;
210 }
211
212 m_auimgr.SetManagedWindow( this );
213
214 unsigned int auiFlags = wxAUI_MGR_DEFAULT;
215#if !defined( _WIN32 )
216 // Windows cannot redraw the UI fast enough during a live resize and may lead to all kinds
217 // of graphical glitches
218 auiFlags |= wxAUI_MGR_LIVE_RESIZE;
219#endif
220 m_auimgr.SetFlags( auiFlags );
221
222 // Rows; layers 4 - 6
223 m_auimgr.AddPane( m_tbTopMain, EDA_PANE().HToolbar().Name( "TopMainToolbar" )
224 .Top().Layer( 6 ) );
225
226 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" )
227 .Bottom().Layer( 6 ) );
228
229 // Columns; layers 1 - 3
230 m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "Footprints" )
231 .Left().Layer( 4 )
232 .Caption( _( "Libraries" ) )
233 .MinSize( FromDIP( 250 ), -1 ).BestSize( FromDIP( 250 ), -1 ) );
234 m_auimgr.AddPane( m_propertiesPanel, EDA_PANE().Name( PropertiesPaneName() )
235 .Left().Layer( 3 )
236 .Caption( _( "Properties" ) ).PaneBorder( false )
237 .MinSize( FromDIP( wxSize( 240, 60 ) ) ).BestSize( FromDIP( wxSize( 300, 200 ) ) ) );
238 m_auimgr.AddPane( m_tbLeft, EDA_PANE().VToolbar().Name( "LeftToolbar" )
239 .Left().Layer( 2 ) );
240
241 m_auimgr.AddPane( m_tbRight, EDA_PANE().VToolbar().Name( "RightToolbar" )
242 .Right().Layer(2) );
243 m_auimgr.AddPane( m_appearancePanel, EDA_PANE().Name( "LayersManager" )
244 .Right().Layer( 3 )
245 .Caption( _( "Appearance" ) ).PaneBorder( false )
246 .MinSize( FromDIP( 180 ), -1 ).BestSize( FromDIP( 180 ), -1 ) );
247 m_auimgr.AddPane( m_selectionFilterPanel, EDA_PANE().Palette().Name( "SelectionFilter" )
248 .Right().Layer( 3 ).Position( 2 )
249 .Caption( _( "Selection Filter" ) ).PaneBorder( false )
250 .MinSize( FromDIP( 180 ), -1 ).BestSize( FromDIP( 180 ), -1 ) );
251
252 // Center
253 m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" )
254 .Center() );
255
256 m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools );
257 m_auimgr.GetPane( "SelectionFilter" ).Show( m_show_layer_manager_tools );
258 m_auimgr.GetPane( PropertiesPaneName() ).Show( GetSettings()->m_AuiPanels.show_properties );
259
260 // The selection filter doesn't need to grow in the vertical direction when docked
261 m_auimgr.GetPane( "SelectionFilter" ).dock_proportion = 0;
262
265 DragAcceptFiles( true );
266
267 FinishAUIInitialization();
268
269 // Apply saved visibility stuff at the end
270 wxAuiPaneInfo& treePane = m_auimgr.GetPane( "Footprints" );
271 wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
272
273 if( libWidth > 0 )
274 SetAuiPaneSize( m_auimgr, treePane, libWidth, -1 );
275
276 if( aui_cfg.right_panel_width > 0 )
277 SetAuiPaneSize( m_auimgr, layersManager, aui_cfg.right_panel_width, -1 );
278
279 m_appearancePanel->SetTabIndex( aui_cfg.appearance_panel_tab );
280
281 if( FOOTPRINT_EDITOR_SETTINGS* cfg = dynamic_cast<FOOTPRINT_EDITOR_SETTINGS*>( GetSettings() ) )
282 {
283 m_appearancePanel->SetUserLayerPresets( cfg->m_LayerPresets );
284 m_appearancePanel->ApplyLayerPreset( cfg->m_ActiveLayerPreset );
285 }
286
287 // restore the last footprint from the project, if any, after the library has been init'ed
288 // N.B. This needs to happen after the AUI manager has been initialized so that we can
289 // properly call the WX_INFOBAR without crashing on some systems.
290 restoreLastFootprint();
291
292 // This displays the last footprint loaded, if any, so it must be done after restoreLastFootprint()
293 ActivateGalCanvas();
294
295 GetToolManager()->PostAction( ACTIONS::zoomFitScreen );
296 UpdateTitle();
297 setupUnits( GetSettings() );
298
299 resolveCanvasType();
300
301 // Default shutdown reason until a file is loaded
302 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "Footprint changes are unsaved" ) );
303
304 // Catch unhandled accelerator command characters that were no handled by the library tree
305 // panel.
306 Bind( wxEVT_CHAR, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
307 Bind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
308
309 // Ensure the window is on top
310 Raise();
311 Show( true );
312
313 // Register a call to update the toolbar sizes. It can't be done immediately because
314 // it seems to require some sizes calculated that aren't yet (at least on GTK).
315 CallAfter(
316 [this]()
317 {
318 // Ensure the controls on the toolbars all are correctly sized
319 UpdateToolbarControlSizes();
320 m_treePane->FocusSearchFieldIfExists();
321 } );
322}
323
324
326{
327 // Shutdown all running tools
328 if( m_toolManager )
330
331 // save the footprint in the PROJECT
333
334 // Clear the watched file
335 setFPWatcher( nullptr );
336
338 delete m_appearancePanel;
339 delete m_treePane;
340}
341
342
344{
346
347 FOOTPRINT* fp = static_cast<FOOTPRINT*>( GetModel() );
348
349 if( fp )
350 {
351 std::vector<MSG_PANEL_ITEM> msgItems;
352 fp->GetMsgPanelInfo( this, msgItems );
353 SetMsgPanel( msgItems );
354 }
355}
356
357
359{
360 return GetScreen() && GetScreen()->IsContentModified()
362}
363
364
366{
367 return m_toolManager->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
368}
369
370
372{
373 // switches currently used canvas (Cairo / OpenGL).
374 PCB_BASE_FRAME::SwitchCanvas( aCanvasType );
375
376 GetCanvas()->GetGAL()->SetAxesEnabled( true );
377
378 // The base class method *does not reinit* the layers manager. We must update the layer
379 // widget to match board visibility states, both layers and render columns, and and some
380 // settings dependent on the canvas.
382}
383
384
386{
387 SyncLibraryTree( true );
389}
390
391
393{
394 wxAuiPaneInfo& treePane = m_auimgr.GetPane( m_treePane );
395 treePane.Show( !IsLibraryTreeShown() );
396
397 if( IsLibraryTreeShown() )
398 {
399 // SetAuiPaneSize also updates m_auimgr
401 }
402 else
403 {
404 m_editorSettings->m_LibWidth = m_treePane->GetSize().x;
405 m_auimgr.Update();
406 }
407}
408
409
411{
413}
414
415
417{
419 wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
420 wxAuiPaneInfo& selectionFilter = m_auimgr.GetPane( "SelectionFilter" );
421
422 // show auxiliary Vertical layers and visibility manager toolbar
424 layersManager.Show( m_show_layer_manager_tools );
425 selectionFilter.Show( m_show_layer_manager_tools );
426
428 {
429 SetAuiPaneSize( m_auimgr, layersManager, settings->m_AuiPanels.right_panel_width, -1 );
430 }
431 else
432 {
433 settings->m_AuiPanels.right_panel_width = m_appearancePanel->GetSize().x;
434 m_auimgr.Update();
435 }
436}
437
438
440{
441 return const_cast<wxAuiManager&>( m_auimgr ).GetPane( m_treePane ).IsShown();
442}
443
444
446{
447 return GetBoard()->GetFirstFootprint();
448}
449
450
452{
453 LIB_ID id;
454
455 if( IsLibraryTreeShown() )
457
458 if( id.GetLibNickname().empty() )
459 id = GetLoadedFPID();
460
461 return id;
462}
463
464
466{
467 FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
468
469 if( footprint )
470 return LIB_ID( footprint->GetFPID().GetLibNickname(), m_footprintNameWhenLoaded );
471 else
472 return LIB_ID();
473}
474
475
477{
478 if( GetBoard()->GetFirstFootprint() )
479 {
482 }
483
484 GetScreen()->SetContentModified( false );
485}
486
487
489{
490 // If we've already vetted closing this window, then we have no FP anymore
491 if( m_isClosing || !GetBoard() )
492 return false;
493
494 FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
495
496 return ( footprint && footprint->GetLink() != niluuid );
497}
498
499
501{
502 LIB_ID id = GetLoadedFPID();
503
504 if( id.IsValid() )
505 {
507 Prj().SetRString( PROJECT::PCB_FOOTPRINT_EDITOR_FP_NAME, id.GetLibItemName() );
508 }
509}
510
511
513{
514 const wxString& footprintName = Prj().GetRString( PROJECT::PCB_FOOTPRINT_EDITOR_FP_NAME );
515 const wxString& libNickname = Prj().GetRString( PROJECT::PCB_FOOTPRINT_EDITOR_LIB_NICKNAME );
516
517 if( libNickname.Length() && footprintName.Length() )
518 {
519 LIB_ID id;
520 id.SetLibNickname( libNickname );
521 id.SetLibItemName( footprintName );
522
523 FOOTPRINT* footprint = loadFootprint( id );
524
525 if( footprint )
526 AddFootprintToBoard( footprint );
527 }
528}
529
530
532{
533 // Enable one internal layer, because footprints support keepout areas that can be on
534 // internal layers only (therefore on the first internal layer). This is needed to handle
535 // these keepout in internal layers only.
537 GetBoard()->SetLayerName( In1_Cu, _( "Inner layers" ) );
538
539 // Don't drop pre-existing user layers
540 LSET enabledLayers = GetBoard()->GetEnabledLayers();
541
543 {
544 m_originalFootprintCopy->RunOnChildren(
545 [&]( BOARD_ITEM* child )
546 {
547 LSET childLayers = child->GetLayerSet() & LSET::UserDefinedLayersMask();
548
549 for( PCB_LAYER_ID layer : childLayers )
550 enabledLayers.set( layer );
551 },
552 RECURSE_MODE::RECURSE );
553 }
554
555 // Enable any layers that the user has gone to the trouble to name
556 if( FOOTPRINT_EDITOR_SETTINGS* cfg = GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>( "fpedit" ) )
557 {
558 for( const PCB_LAYER_ID& user : LSET::UserDefinedLayersMask() )
559 {
560 if( cfg->m_DesignSettings.m_UserLayerNames.contains( LSET::Name( user ).ToStdString() ) )
561 enabledLayers.set( user );
562 }
563 }
564
565 GetBoard()->SetEnabledLayers( enabledLayers );
566}
567
568
570{
572
573 m_originalFootprintCopy.reset( static_cast<FOOTPRINT*>( aFootprint->Clone() ) );
574 m_originalFootprintCopy->SetParent( nullptr );
575
577
579 // Ensure item UUIDs are valid
580 // ("old" footprints can have null uuids that create issues in fp editor)
581 aFootprint->FixUuids();
582
584
585 // Footprint Editor layer visibility is kept in the view, not the board (because the board
586 // just delegates to the project file, which we don't have).
587 for( PCB_LAYER_ID layer : GetBoard()->GetEnabledLayers() )
588 GetCanvas()->GetView()->SetLayerVisible( layer, true );
589
590 const wxString libName = aFootprint->GetFPID().GetLibNickname();
591
593 {
594 const wxString msg = wxString::Format( _( "Editing %s from board. Saving will update the board only." ),
595 aFootprint->GetReference() );
596 const wxString openLibLink = wxString::Format( _( "Open in library %s" ),
597 UnescapeString( libName ) );
598
599 const auto openLibraryCopy =
600 [this]( wxHyperlinkEvent& aEvent )
601 {
603 };
604
605 if( WX_INFOBAR* infobar = GetInfoBar() )
606 {
607 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, openLibLink,
608 wxEmptyString );
609 button->Bind( wxEVT_COMMAND_HYPERLINK, openLibraryCopy );
610
611 infobar->RemoveAllButtons();
612 infobar->AddButton( button );
613 infobar->AddCloseButton();
614 infobar->ShowMessage( msg, wxICON_INFORMATION );
615 }
616 }
617 // An empty libname is OK - you get that when creating a new footprint from the main menu
618 // In that case. treat is as editable, and the user will be prompted for save-as when saving.
619 else if( !libName.empty()
620 && !PROJECT_PCB::PcbFootprintLibs( &Prj() )->IsFootprintLibWritable( libName ) )
621 {
622 wxString msg = wxString::Format( _( "Editing footprint from read-only library %s." ),
623 UnescapeString( libName ) );
624
625 if( WX_INFOBAR* infobar = GetInfoBar() )
626 {
627 wxString link = _( "Save as editable copy" );
628
629 const auto saveAsEditableCopy =
630 [this, aFootprint]( wxHyperlinkEvent& aEvent )
631 {
632 SaveFootprintAs( aFootprint );
633 };
634
635 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, link, wxEmptyString );
636 button->Bind( wxEVT_COMMAND_HYPERLINK, saveAsEditableCopy );
637
638 infobar->RemoveAllButtons();
639 infobar->AddButton( button );
640 infobar->AddCloseButton();
641 infobar->ShowMessage( msg, wxICON_INFORMATION );
642 }
643 }
644 else
645 {
646 if( WX_INFOBAR* infobar = GetInfoBar() )
647 infobar->Dismiss();
648 }
649
652}
653
654
656{
657 ReloadFootprint( aFootprint );
658
660 setFPWatcher( nullptr );
661 else
662 setFPWatcher( aFootprint );
663}
664
665
667{
669}
670
671
673{
674 return GetBoard()->GetDesignSettings();
675}
676
677
679{
680 wxFAIL_MSG( wxT( "Plotting not supported in Footprint Editor" ) );
681
683}
684
685
687{
688 wxFAIL_MSG( wxT( "Plotting not supported in Footprint Editor" ) );
689}
690
691
693{
694 if( !m_editorSettings )
695 m_editorSettings = GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>( "fpedit" );
696
697 return m_editorSettings;
698}
699
700
702{
703 if( m_editorSettings )
704 return m_editorSettings;
705
707}
708
709
711{
712 // Get our own settings; aCfg will be the PCBNEW_SETTINGS because we're part of the pcbnew
713 // compile unit
715
716 if( cfg )
717 {
719
721
724
727
729
730 for( auto& [source_name, dest_name] : cfg->m_DesignSettings.m_UserLayerNames )
731 {
732 wxString wx_source_name = source_name;
733 PCB_LAYER_ID layer = static_cast<PCB_LAYER_ID>( LSET::NameToLayer( wx_source_name ) );
734
735 if( IsUserLayer( layer ) )
736 GetBoard()->SetLayerName( layer, dest_name );
737 }
738
739 }
740}
741
742
744{
745 // Load canvas type from the FOOTPRINT_EDITOR_SETTINGS:
747
748 // If we had an OpenGL failure this session, use the fallback GAL but don't update the
749 // user preference silently:
750
753}
754
755
757{
759
760 // Get our own settings; aCfg will be the PCBNEW_SETTINGS because we're part of the pcbnew
761 // compile unit
763
764 if( cfg )
765 {
767
770 cfg->m_LibWidth = m_treePane->GetSize().x;
772
774
776 {
777 cfg->m_AuiPanels.show_properties = m_propertiesPanel->IsShownOnScreen();
780 }
781
783
785 {
790 }
791 }
792}
793
794
795
797{
798 FOOTPRINT_EDITOR_SETTINGS* cfg = const_cast<FOOTPRINT_EDIT_FRAME*>( this )->GetSettings();
799
800 return cfg ? cfg->m_RotationAngle : ANGLE_90;
801}
802
803
804
806{
808 return ::GetColorSettings( cfg ? cfg->m_ColorTheme : DEFAULT_THEME );
809}
810
811
813{
814 // Get the actual frame settings for magnetic items
816 wxCHECK( cfg, nullptr );
817 return &cfg->m_MagneticItems;
818}
819
820
821const BOX2I FOOTPRINT_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
822{
823 FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
824
825 if( footprint )
826 {
827 bool hasGraphicalItem = footprint->Pads().size() || footprint->Zones().size();
828
829 if( !hasGraphicalItem )
830 {
831 for( const BOARD_ITEM* item : footprint->GraphicalItems() )
832 {
833 if( item->Type() == PCB_TEXT_T || item->Type() == PCB_TEXTBOX_T )
834 continue;
835
836 hasGraphicalItem = true;
837 break;
838 }
839 }
840
841 if( hasGraphicalItem )
842 {
843 return footprint->GetBoundingBox( false );
844 }
845 else
846 {
847 BOX2I newFootprintBB( { 0, 0 }, { 0, 0 } );
848 newFootprintBB.Inflate( pcbIUScale.mmToIU( 12 ) );
849 return newFootprintBB;
850 }
851 }
852
853 return GetBoardBoundingBox( false );
854}
855
856
858{
859 if( IsContentModified() )
860 {
861 wxString footprintName = GetBoard()->GetFirstFootprint()->GetReference();
862 wxString msg = _( "Save changes to '%s' before closing?" );
863
864 if( !HandleUnsavedChanges( this, wxString::Format( msg, footprintName ),
865 [&]() -> bool
866 {
867 return SaveFootprint( GetBoard()->GetFirstFootprint() );
868 } ) )
869 {
870 return false;
871 }
872 }
873
874 if( doClose )
875 {
876 GetInfoBar()->ShowMessageFor( wxEmptyString, 1 );
877 Clear_Pcb( false );
878 UpdateTitle();
879 }
880
881 return true;
882}
883
884
885bool FOOTPRINT_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
886{
887 if( IsContentModified() )
888 {
889 // Shutdown blocks must be determined and vetoed as early as possible
891 aEvent.GetId() == wxEVT_QUERY_END_SESSION )
892 {
893 aEvent.Veto();
894 return false;
895 }
896
897 wxString footprintName = GetBoard()->GetFirstFootprint()->GetFPID().GetLibItemName();
898
900 footprintName = GetBoard()->GetFirstFootprint()->GetReference();
901
902 wxString msg = _( "Save changes to '%s' before closing?" );
903
904 if( !HandleUnsavedChanges( this, wxString::Format( msg, footprintName ),
905 [&]() -> bool
906 {
907 return SaveFootprint( GetBoard()->GetFirstFootprint() );
908 } ) )
909 {
910 aEvent.Veto();
911 return false;
912 }
913 }
914
915 PAD_TOOL* padTool = m_toolManager->GetTool<PAD_TOOL>();
916
917 if( padTool->InPadEditMode() )
918 padTool->ExitPadEditMode();
919
920 // Save footprint tree column widths
921 m_adapter->SaveSettings();
922
924}
925
926
928{
929 // No more vetos
930 GetCanvas()->SetEventDispatcher( nullptr );
932
933 // Do not show the layer manager during closing to avoid flicker
934 // on some platforms (Windows) that generate useless redraw of items in
935 // the Layer Manager
936 m_auimgr.GetPane( wxT( "LayersManager" ) ).Show( false );
937 m_auimgr.GetPane( wxT( "SelectionFilter" ) ).Show( false );
938
939 Clear_Pcb( false );
940
942
943 if( mgr->IsProjectOpen() && wxFileName::IsDirWritable( Prj().GetProjectPath() ) )
944 {
945 GFootprintList.WriteCacheToFile( Prj().GetProjectPath() + wxT( "fp-info-cache" ) );
946 }
947}
948
949
950void FOOTPRINT_EDIT_FRAME::OnExitKiCad( wxCommandEvent& event )
951{
952 Kiway().OnKiCadExit();
953}
954
955
957{
958 Close();
959}
960
961
963{
964 // call my base class
966
967 // We have 2 panes to update.
968 // For some obscure reason, the AUI manager hides the first modified pane.
969 // So force show panes
970 wxAuiPaneInfo& tree_pane_info = m_auimgr.GetPane( m_treePane );
971 bool tree_shown = tree_pane_info.IsShown();
972 tree_pane_info.Caption( _( "Libraries" ) );
973
974 wxAuiPaneInfo& lm_pane_info = m_auimgr.GetPane( m_appearancePanel );
975 bool lm_shown = lm_pane_info.IsShown();
976 lm_pane_info.Caption( _( "Appearance" ) );
977 wxAuiPaneInfo& sf_pane_info = m_auimgr.GetPane( m_selectionFilterPanel );
978 sf_pane_info.Caption( _( "Selection Filter" ) );
979
980 // update the layer manager
982
983 // Now restore the visibility:
984 lm_pane_info.Show( lm_shown );
985 tree_pane_info.Show( tree_shown );
986 m_auimgr.Update();
987
989
990 UpdateTitle();
991}
992
993
995{
997
998 if( m_isClosing )
999 return;
1000
1001 Update3DView( true, true );
1003
1004 if( !GetTitle().StartsWith( wxT( "*" ) ) )
1005 UpdateTitle();
1006}
1007
1008
1010{
1011 wxString title;
1012 LIB_ID fpid = GetLoadedFPID();
1013 FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
1014 bool writable = true;
1015
1016 if( IsCurrentFPFromBoard() )
1017 {
1018 if( IsContentModified() )
1019 title = wxT( "*" );
1020
1021 title += footprint->GetReference();
1022 title += wxS( " " ) + wxString::Format( _( "[from %s]" ), Prj().GetProjectName()
1023 + wxT( "." )
1024 + FILEEXT::PcbFileExtension );
1025 }
1026 else if( fpid.IsValid() )
1027 {
1028 try
1029 {
1031 }
1032 catch( const IO_ERROR& )
1033 {
1034 // best efforts...
1035 }
1036
1037 // Note: don't used GetLoadedFPID(); footprint name may have been edited
1038 if( IsContentModified() )
1039 title = wxT( "*" );
1040
1041 title += From_UTF8( footprint->GetFPID().Format().c_str() );
1042
1043 if( !writable )
1044 title += wxS( " " ) + _( "[Read Only]" );
1045 }
1046 else if( !fpid.GetLibItemName().empty() )
1047 {
1048 // Note: don't used GetLoadedFPID(); footprint name may have been edited
1049 if( IsContentModified() )
1050 title = wxT( "*" );
1051
1052 title += From_UTF8( footprint->GetFPID().GetLibItemName().c_str() );
1053 title += wxS( " " ) + _( "[Unsaved]" );
1054 }
1055 else
1056 {
1057 title = _( "[no footprint loaded]" );
1058 }
1059
1060 title += wxT( " \u2014 " ) + _( "Footprint Editor" );
1061
1062 SetTitle( title );
1063}
1064
1065
1067{
1069}
1070
1071
1073{
1077 UpdateTitle();
1078}
1079
1080
1082{
1084
1085 WX_PROGRESS_REPORTER progressReporter( this, _( "Load Footprint Libraries" ), 1, PR_CAN_ABORT );
1086
1087 if( GFootprintList.GetCount() == 0 )
1088 GFootprintList.ReadCacheFromFile( Prj().GetProjectPath() + wxT( "fp-info-cache" ) );
1089
1090 GFootprintList.ReadFootprintFiles( fpTable, nullptr, &progressReporter );
1091 progressReporter.Show( false );
1092
1095
1097 auto adapter = static_cast<FP_TREE_SYNCHRONIZING_ADAPTER*>( m_adapter.get() );
1098
1099 adapter->AddLibraries( this );
1100}
1101
1102
1104{
1106 auto adapter = static_cast<FP_TREE_SYNCHRONIZING_ADAPTER*>( m_adapter.get() );
1107 LIB_ID target = GetTargetFPID();
1108 bool targetSelected = ( target == GetLibTree()->GetSelectedLibId() );
1109
1110 // Sync FOOTPRINT_INFO list to the libraries on disk
1111 if( aProgress )
1112 {
1113 WX_PROGRESS_REPORTER progressReporter( this, _( "Update Footprint Libraries" ), 1, PR_CAN_ABORT );
1114 GFootprintList.ReadFootprintFiles( fpTable, nullptr, &progressReporter );
1115 progressReporter.Show( false );
1116 }
1117 else
1118 {
1119 GFootprintList.ReadFootprintFiles( fpTable, nullptr, nullptr );
1120 }
1121
1122 // Unselect before syncing to avoid null reference in the adapter
1123 // if a selected item is removed during the sync
1124 GetLibTree()->Unselect();
1125
1126 // Sync the LIB_TREE to the FOOTPRINT_INFO list
1127 adapter->Sync( fpTable );
1128
1129 GetLibTree()->Regenerate( true );
1130
1131 if( target.IsValid() )
1132 {
1133 if( adapter->FindItem( target ) )
1134 {
1135 if( targetSelected )
1136 GetLibTree()->SelectLibId( target );
1137 else
1138 GetLibTree()->CenterLibId( target );
1139 }
1140 else
1141 {
1142 // Try to focus on parent
1143 target.SetLibItemName( wxEmptyString );
1144 GetLibTree()->CenterLibId( target );
1145 }
1146 }
1147}
1148
1149
1151{
1153}
1154
1155
1157{
1158 GetLibTree()->SelectLibId( aLibID );
1159}
1160
1161
1163{
1165}
1166
1167
1169{
1170 // Create the manager and dispatcher & route draw panel events to the dispatcher
1173 GetCanvas()->GetViewControls(), config(), this );
1174 m_actions = new PCB_ACTIONS();
1176
1178
1188 m_toolManager->RegisterTool( new PCB_CONTROL ); // copy/paste
1201
1202 for( TOOL_BASE* tool : m_toolManager->Tools() )
1203 {
1204 if( PCB_TOOL_BASE* pcbTool = dynamic_cast<PCB_TOOL_BASE*>( tool ) )
1205 pcbTool->SetIsFootprintEditor( true );
1206 }
1207
1208 m_toolManager->GetTool<PCB_VIEWER_TOOLS>()->SetFootprintFrame( true );
1210
1211 m_toolManager->InvokeTool( "common.InteractiveSelection" );
1212
1213 // Load or reload wizard plugins in case they changed since the last time the frame opened
1214 // Because the board editor has also a plugin python menu,
1215 // call the PCB_EDIT_FRAME RunAction() if the board editor is running
1216 // Otherwise run the current RunAction().
1217 PCB_EDIT_FRAME* pcbframe = static_cast<PCB_EDIT_FRAME*>( Kiway().Player( FRAME_PCB_EDITOR, false ) );
1218
1219 if( pcbframe )
1221 else
1223}
1224
1225
1227{
1229
1231 PCB_EDITOR_CONDITIONS cond( this );
1232
1233 wxASSERT( mgr );
1234
1235#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
1236#define CHECK( x ) ACTION_CONDITIONS().Check( x )
1237
1238 auto haveFootprintCond =
1239 [this]( const SELECTION& )
1240 {
1241 return GetBoard() && GetBoard()->GetFirstFootprint() != nullptr;
1242 };
1243
1244 auto footprintTargettedCond =
1245 [this]( const SELECTION& )
1246 {
1247 return !GetTargetFPID().GetLibItemName().empty();
1248 };
1249
1250 const auto footprintFromBoardCond =
1251 [this]( const SELECTION& )
1252 {
1253 return IsCurrentFPFromBoard();
1254 };
1255
1256 auto pcbFrameExistsCond =
1257 [this]( const SELECTION& )
1258 {
1259 PCB_EDIT_FRAME* frame = dynamic_cast<PCB_EDIT_FRAME*>( Kiway().Player( FRAME_PCB_EDITOR, false ) );
1260
1261 return ( frame != nullptr );
1262 };
1263
1264 auto boardFootprintExistsCond =
1265 [this]( const SELECTION& )
1266 {
1267 PCB_EDIT_FRAME* frame = dynamic_cast<PCB_EDIT_FRAME*>( Kiway().Player( FRAME_PCB_EDITOR, false ) );
1268
1269 FOOTPRINT* editorFootprint = GetBoard()->GetFirstFootprint();
1270 bool canInsert = frame && editorFootprint && editorFootprint->GetLink() == niluuid;
1271
1272 // If the source was deleted, the footprint can inserted but not updated in the board.
1273 if( frame && editorFootprint && editorFootprint->GetLink() != niluuid )
1274 {
1275 BOARD* mainpcb = frame->GetBoard();
1276 canInsert = true;
1277
1278 // search if the source footprint was not deleted:
1279 for( FOOTPRINT* candidate : mainpcb->Footprints() )
1280 {
1281 if( editorFootprint->GetLink() == candidate->m_Uuid )
1282 {
1283 canInsert = false;
1284 break;
1285 }
1286 }
1287 }
1288
1289 return canInsert;
1290 };
1291
1292 // clang-format off
1293 mgr->SetConditions( ACTIONS::saveAs, ENABLE( footprintTargettedCond ) );
1296 mgr->SetConditions( PCB_ACTIONS::editLibFpInFpEditor,ENABLE( footprintFromBoardCond ) );
1297
1298 mgr->SetConditions( PCB_ACTIONS::saveFpToBoard, ENABLE( boardFootprintExistsCond ) );
1299 mgr->SetConditions( PCB_ACTIONS::loadFpFromBoard, ENABLE( pcbFrameExistsCond ) );
1300
1303
1307 mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
1308 mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCH ) ) );
1309 mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
1310
1311 mgr->SetConditions( ACTIONS::cut, ENABLE( cond.HasItems() ) );
1312 mgr->SetConditions( ACTIONS::copy, ENABLE( cond.HasItems() ) );
1319
1326
1330
1333 // clang-format on
1334
1335 auto constrainedDrawingModeCond =
1336 [this]( const SELECTION& )
1337 {
1338 return GetSettings()->m_Use45Limit;
1339 };
1340
1341 auto highContrastCond =
1342 [this]( const SELECTION& )
1343 {
1344 return GetDisplayOptions().m_ContrastModeDisplay != HIGH_CONTRAST_MODE::NORMAL;
1345 };
1346
1347 auto boardFlippedCond =
1348 [this]( const SELECTION& )
1349 {
1350 return GetCanvas() && GetCanvas()->GetView()->IsMirroredX();
1351 };
1352
1353 auto libraryTreeCond =
1354 [this](const SELECTION& )
1355 {
1356 return IsLibraryTreeShown();
1357 };
1358
1359 auto layerManagerCond =
1360 [this]( const SELECTION& )
1361 {
1362 return m_auimgr.GetPane( "LayersManager" ).IsShown();
1363 };
1364
1365 auto propertiesCond =
1366 [this] ( const SELECTION& )
1367 {
1368 return m_auimgr.GetPane( PropertiesPaneName() ).IsShown();
1369 };
1370
1371 mgr->SetConditions( PCB_ACTIONS::toggleHV45Mode, CHECK( constrainedDrawingModeCond ) );
1372 mgr->SetConditions( ACTIONS::highContrastMode, CHECK( highContrastCond ) );
1373 mgr->SetConditions( PCB_ACTIONS::flipBoard, CHECK( boardFlippedCond ) );
1375
1376 mgr->SetConditions( ACTIONS::showLibraryTree, CHECK( libraryTreeCond ) );
1377 mgr->SetConditions( PCB_ACTIONS::showLayersManager, CHECK( layerManagerCond ) );
1378 mgr->SetConditions( ACTIONS::showProperties, CHECK( propertiesCond ) );
1379
1380 mgr->SetConditions( ACTIONS::print, ENABLE( haveFootprintCond ) );
1381 mgr->SetConditions( PCB_ACTIONS::exportFootprint, ENABLE( haveFootprintCond ) );
1382 mgr->SetConditions( PCB_ACTIONS::placeImportedGraphics, ENABLE( haveFootprintCond ) );
1383
1384 mgr->SetConditions( PCB_ACTIONS::footprintProperties, ENABLE( haveFootprintCond ) );
1385 mgr->SetConditions( PCB_ACTIONS::editTextAndGraphics, ENABLE( haveFootprintCond ) );
1386 mgr->SetConditions( PCB_ACTIONS::checkFootprint, ENABLE( haveFootprintCond ) );
1387 mgr->SetConditions( PCB_ACTIONS::repairFootprint, ENABLE( haveFootprintCond ) );
1388 mgr->SetConditions( PCB_ACTIONS::cleanupGraphics, ENABLE( haveFootprintCond ) );
1389 mgr->SetConditions( ACTIONS::showDatasheet, ENABLE( haveFootprintCond ) );
1390
1391 const auto isArcKeepCenterMode =
1392 [this]( const SELECTION& )
1393 {
1394 return GetSettings()->m_ArcEditMode == ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS;
1395 };
1396
1397 const auto isArcKeepEndpointMode =
1398 [this]( const SELECTION& )
1399 {
1400 return GetSettings()->m_ArcEditMode == ARC_EDIT_MODE::KEEP_ENDPOINTS_OR_START_DIRECTION;
1401 };
1402
1403 const auto isArcKeepRadiusMode =
1404 [this]( const SELECTION& )
1405 {
1406 return GetSettings()->m_ArcEditMode == ARC_EDIT_MODE::KEEP_CENTER_ENDS_ADJUST_ANGLE;
1407 };
1408
1409 // clang-format off
1410 mgr->SetConditions( ACTIONS::pointEditorArcKeepCenter, CHECK( isArcKeepCenterMode ) );
1411 mgr->SetConditions( ACTIONS::pointEditorArcKeepEndpoint, CHECK( isArcKeepEndpointMode ) );
1412 mgr->SetConditions( ACTIONS::pointEditorArcKeepRadius, CHECK( isArcKeepRadiusMode ) );
1413 // clang-format on
1414
1415// Only enable a tool if the part is edtable
1416#define CURRENT_EDIT_TOOL( action ) \
1417 mgr->SetConditions( action, ACTION_CONDITIONS().Enable( haveFootprintCond ) \
1418 .Check( cond.CurrentTool( action ) ) )
1419
1442
1443#undef CURRENT_EDIT_TOOL
1444#undef ENABLE
1445#undef CHECK
1446}
1447
1448
1450{
1452
1453 // Be sure the axis are enabled
1454 GetCanvas()->GetGAL()->SetAxesEnabled( true );
1455
1456 UpdateView();
1457
1458 // Ensure the m_Layers settings are using the canvas type:
1460}
1461
1462
1464{
1466
1467 if( FOOTPRINT_EDITOR_SETTINGS* cfg = GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>( "fpedit" ) )
1468 {
1469 GetGalDisplayOptions().ReadWindowSettings( cfg->m_Window );
1470
1471 GetBoard()->GetDesignSettings() = cfg->m_DesignSettings;
1473 }
1474
1478
1480
1481 if( aFlags & ENVVARS_CHANGED )
1482 SyncLibraryTree( true );
1483
1484 Layout();
1485 SendSizeEvent();
1486}
1487
1488
1489std::unique_ptr<GRID_HELPER> FOOTPRINT_EDIT_FRAME::MakeGridHelper()
1490{
1491 return std::make_unique<PCB_GRID_HELPER>( m_toolManager, GetMagneticItemsSettings() );
1492}
1493
1494
1496{
1497 LIB_ID id = GetLoadedFPID();
1498
1499 if( id.empty() )
1500 {
1501 DisplayErrorMessage( this, _( "No footprint selected." ) );
1502 return;
1503 }
1504
1505 wxFileName fn( id.GetLibItemName() );
1506 fn.SetExt( wxT( "png" ) );
1507
1508 wxString projectPath = wxPathOnly( Prj().GetProjectFullName() );
1509
1510 wxFileDialog dlg( this, _( "Export View as PNG" ), projectPath, fn.GetFullName(),
1511 FILEEXT::PngFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
1512
1513 if( dlg.ShowModal() == wxID_CANCEL || dlg.GetPath().IsEmpty() )
1514 return;
1515
1516 // calling wxYield is mandatory under Linux, after closing the file selector dialog
1517 // to refresh the screen before creating the PNG or JPEG image from screen
1518 wxYield();
1519 this->SaveCanvasImageToFile( dlg.GetPath(), BITMAP_TYPE::PNG );
1520}
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:287
static TOOL_ACTION group
Definition: actions.h:232
static TOOL_ACTION pasteSpecial
Definition: actions.h:81
static TOOL_ACTION showDatasheet
Definition: actions.h:260
static TOOL_ACTION pointEditorArcKeepCenter
Definition: actions.h:266
static TOOL_ACTION milsUnits
Definition: actions.h:202
static TOOL_ACTION ungroup
Definition: actions.h:233
static TOOL_ACTION toggleBoundingBoxes
Definition: actions.h:154
static TOOL_ACTION pointEditorArcKeepRadius
Definition: actions.h:268
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:290
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:151
static TOOL_ACTION measureTool
Definition: actions.h:245
static TOOL_ACTION doDelete
Definition: actions.h:85
static TOOL_ACTION selectionTool
Definition: actions.h:244
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:259
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:267
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:235
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:297
void SetBoardUse(BOARD_USE aUse)
Set what the board is going to be used for.
Definition: board.h:309
bool SetLayerName(PCB_LAYER_ID aLayer, const wxString &aLayerName)
Changes the name of the layer given by aLayer.
Definition: board.cpp:629
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Definition: board.h:463
void SetVisibleAlls()
Change the bit-mask of visible element categories and layers.
Definition: board.cpp:875
const FOOTPRINTS & Footprints() const
Definition: board.h:338
void SetCopperLayerCount(int aCount)
Definition: board.cpp:784
void DeleteAllFootprints()
Remove all footprints from the deque and free the memory associated with them.
Definition: board.cpp:1471
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:943
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
Definition: board.cpp:826
void SetEnabledLayers(const LSET &aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:846
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.
EDA_DRAW_PANEL_GAL::GAL_TYPE loadCanvasTypeSetting(APP_SETTINGS_BASE *aCfg=nullptr)
Return the canvas type stored in the application settings.
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.
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:701
ZONES & Zones()
Definition: footprint.h:215
EDA_ITEM * Clone() const override
Invoke a function on all children.
Definition: footprint.cpp:2194
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:1672
KIID GetLink() const
Definition: footprint.h:841
const wxString & GetReference() const
Definition: footprint.h:625
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:1334
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:765
void SetLayerVisible(int aLayer, bool aVisible=true)
Control the visibility of a particular layer.
Definition: view.h:396
bool IsMirroredX() const
Return true if view is flipped across the X axis.
Definition: view.h:246
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition: view.h:635
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:285
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:456
void CenterLibId(const LIB_ID &aLibId)
Ensure that an item is visible (preferably centered).
Definition: lib_tree.cpp:365
void ShowChangedLanguage()
Definition: lib_tree.cpp:288
void SelectLibId(const LIB_ID &aLibId)
Select an item in the tree widget.
Definition: lib_tree.cpp:359
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:371
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:298
void Regenerate(bool aKeepState)
Regenerate the tree.
Definition: lib_tree.cpp:438
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:690
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
Definition: lset.cpp:188
Tool relating to pads and pad settings.
Definition: pad_tool.h:37
void ExitPadEditMode()
Definition: pad_tool.cpp:844
bool InPadEditMode()
Definition: pad_tool.h:65
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:540
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:452
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:486
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:500
static TOOL_ACTION drawRadialDimension
Definition: pcb_actions.h:206
static TOOL_ACTION editTextAndGraphics
Definition: pcb_actions.h:435
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:512
static TOOL_ACTION loadFpFromBoard
Definition: pcb_actions.h:493
static TOOL_ACTION drawCenterDimension
Definition: pcb_actions.h:205
static TOOL_ACTION footprintProperties
Definition: pcb_actions.h:488
static TOOL_ACTION flipBoard
Definition: pcb_actions.h:374
static TOOL_ACTION textOutlines
Display texts as lines.
Definition: pcb_actions.h:515
static TOOL_ACTION checkFootprint
Definition: pcb_actions.h:491
static TOOL_ACTION editLibFpInFpEditor
Definition: pcb_actions.h:450
static TOOL_ACTION mirrorV
Definition: pcb_actions.h:126
static TOOL_ACTION repairFootprint
Definition: pcb_actions.h:558
static TOOL_ACTION saveFpToBoard
Definition: pcb_actions.h:494
static TOOL_ACTION drawLine
Definition: pcb_actions.h:189
static TOOL_ACTION cleanupGraphics
Definition: pcb_actions.h:439
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:230
@ PCB_FOOTPRINT_EDITOR_LIB_NICKNAME
Definition: project.h:231
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:320
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:331
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:104
const char * c_str() const
Definition: utf8.h:103
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:140
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:130
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:406
#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:107
@ ID_ON_ZOOM_SELECT
Definition: id.h:105
PROJECT & Prj()
Definition: kicad.cpp:597
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:744
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:893
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