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 (C) 1992-2023 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>
69#include <tools/group_tool.h>
72#include <widgets/lib_tree.h>
78
79#include <wx/filedlg.h>
80#include <wx/hyperlink.h>
81
82BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
83 EVT_MENU( wxID_CLOSE, FOOTPRINT_EDIT_FRAME::CloseFootprintEditor )
84 EVT_MENU( wxID_EXIT, FOOTPRINT_EDIT_FRAME::OnExitKiCad )
85
87
90
92
95
96 // Horizontal toolbar
98
99 // UI update events.
101 FOOTPRINT_EDIT_FRAME::OnUpdateLoadFootprintFromBoard )
103 FOOTPRINT_EDIT_FRAME::OnUpdateSaveFootprintToBoard )
105
106 // Drop files event
107 EVT_DROP_FILES( FOOTPRINT_EDIT_FRAME::OnDropFiles )
108
109END_EVENT_TABLE()
110
111
112FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
113 PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_FOOTPRINT_EDITOR, wxEmptyString,
114 wxDefaultPosition, wxDefaultSize,
115 KICAD_DEFAULT_DRAWFRAME_STYLE, GetFootprintEditorFrameName() ),
116 m_show_layer_manager_tools( true )
117{
118 m_showBorderAndTitleBlock = false; // true to show the frame references
119 m_aboutTitle = _HKI( "KiCad Footprint Editor" );
120 m_selLayerBox = nullptr;
121 m_editorSettings = nullptr;
122
123 // Give an icon
124 wxIcon icon;
125 wxIconBundle icon_bundle;
126
127 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_modedit, 48 ) );
128 icon_bundle.AddIcon( icon );
129 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_modedit, 128 ) );
130 icon_bundle.AddIcon( icon );
131 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_modedit, 256 ) );
132 icon_bundle.AddIcon( icon );
133 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_modedit_32 ) );
134 icon_bundle.AddIcon( icon );
135 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_modedit_16 ) );
136 icon_bundle.AddIcon( icon );
137
138 SetIcons( icon_bundle );
139
140 // Create GAL canvas
141 m_canvasType = loadCanvasTypeSetting( GetSettings() );
142
143 PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_frameSize,
144 GetGalDisplayOptions(), m_canvasType );
145 SetCanvas( drawPanel );
146
147 CreateInfoBar();
148
149 SetBoard( new BOARD() );
150
151 // This board will only be used to hold a footprint for editing
153
154 // In Footprint Editor, the default net clearance is not known (it depends on the actual
155 // board). So we do not show the default clearance, by setting it to 0. The footprint or
156 // pad specific clearance will be shown.
157 GetBoard()->GetDesignSettings().m_NetSettings->GetDefaultNetclass()->SetClearance( 0 );
158
159 // Don't show the default board solder mask expansion in the footprint editor. Only the
160 // footprint or pad mask expansions settings should be shown.
162
163 // Ensure all layers and items are visible:
164 // In footprint editor, some layers have no meaning or cannot be used, but we show all of
165 // them, at least to be able to edit a bad layer
167
168 GetGalDisplayOptions().m_axesEnabled = true;
169
170 // In Footprint Editor, set the default paper size to A4 for plot/print
171 SetPageSettings( PAGE_INFO( PAGE_INFO::A4 ) );
172 SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU( pcbIUScale.IU_PER_MILS ) ) );
173
174 // Create the manager and dispatcher & route draw panel events to the dispatcher
175 setupTools();
176 setupUIConditions();
177
178 initLibraryTree();
179 m_treePane = new FOOTPRINT_TREE_PANE( this );
180
181 ReCreateMenuBar();
182 ReCreateHToolbar();
183 ReCreateVToolbar();
184 ReCreateOptToolbar();
185
186 m_selectionFilterPanel = new PANEL_SELECTION_FILTER( this );
187 m_appearancePanel = new APPEARANCE_CONTROLS( this, GetCanvas(), true );
188 m_propertiesPanel = new PCB_PROPERTIES_PANEL( this, this );
189
190 // LoadSettings() *after* creating m_LayersManager, because LoadSettings() initialize
191 // parameters in m_LayersManager
192 // NOTE: KifaceSettings() will return PCBNEW_SETTINGS if we started from pcbnew
193 LoadSettings( GetSettings() );
194
195 float proportion = GetFootprintEditorSettings()->m_AuiPanels.properties_splitter;
196 m_propertiesPanel->SetSplitterProportion( proportion );
197
198 // Must be set after calling LoadSettings() to be sure these parameters are not dependent
199 // on what is read in stored settings. Enable one internal layer, because footprints
200 // support keepout areas that can be on internal layers only (therefore on the first internal
201 // layer). This is needed to handle these keepout in internal layers only.
203 GetBoard()->SetEnabledLayers( GetBoard()->GetEnabledLayers().set( In1_Cu ) );
204 GetBoard()->SetVisibleLayers( GetBoard()->GetEnabledLayers() );
205 GetBoard()->SetLayerName( In1_Cu, _( "Inner layers" ) );
206
207 SetActiveLayer( F_SilkS );
208
209 m_auimgr.SetManagedWindow( this );
210
211 unsigned int auiFlags = wxAUI_MGR_DEFAULT;
212#if !defined( _WIN32 )
213 // Windows cannot redraw the UI fast enough during a live resize and may lead to all kinds
214 // of graphical glitches
215 auiFlags |= wxAUI_MGR_LIVE_RESIZE;
216#endif
217 m_auimgr.SetFlags( auiFlags );
218
219 // Rows; layers 4 - 6
220 m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" )
221 .Top().Layer( 6 ) );
222
223 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" )
224 .Bottom().Layer( 6 ) );
225
226 // Columns; layers 1 - 3
227 m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "Footprints" )
228 .Left().Layer( 4 )
229 .Caption( _( "Libraries" ) )
230 .MinSize( FromDIP( 250 ), -1 ).BestSize( FromDIP( 250 ), -1 ) );
231 m_auimgr.AddPane( m_propertiesPanel, EDA_PANE().Name( PropertiesPaneName() )
232 .Left().Layer( 3 )
233 .Caption( _( "Properties" ) ).PaneBorder( false )
234 .MinSize( FromDIP( wxSize( 240, 60 ) ) ).BestSize( FromDIP( wxSize( 300, 200 ) ) ) );
235 m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" )
236 .Left().Layer( 2 ) );
237
238 m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" )
239 .Right().Layer(2) );
240 m_auimgr.AddPane( m_appearancePanel, EDA_PANE().Name( "LayersManager" )
241 .Right().Layer( 3 )
242 .Caption( _( "Appearance" ) ).PaneBorder( false )
243 .MinSize( FromDIP( 180 ), -1 ).BestSize( FromDIP( 180 ), -1 ) );
244 m_auimgr.AddPane( m_selectionFilterPanel, EDA_PANE().Palette().Name( "SelectionFilter" )
245 .Right().Layer( 3 ).Position( 2 )
246 .Caption( _( "Selection Filter" ) ).PaneBorder( false )
247 .MinSize( FromDIP( 180 ), -1 ).BestSize( FromDIP( 180 ), -1 ) );
248
249 // Center
250 m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" )
251 .Center() );
252
253 m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools );
254 m_auimgr.GetPane( "SelectionFilter" ).Show( m_show_layer_manager_tools );
255 m_auimgr.GetPane( PropertiesPaneName() ).Show( GetSettings()->m_AuiPanels.show_properties );
256
257 // The selection filter doesn't need to grow in the vertical direction when docked
258 m_auimgr.GetPane( "SelectionFilter" ).dock_proportion = 0;
259
262 DragAcceptFiles( true );
263
264 FinishAUIInitialization();
265
266 // Apply saved visibility stuff at the end
267 if( FOOTPRINT_EDITOR_SETTINGS* cfg = dynamic_cast<FOOTPRINT_EDITOR_SETTINGS*>( GetSettings() ) )
268 {
269 wxAuiPaneInfo& treePane = m_auimgr.GetPane( "Footprints" );
270 wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
271
272 if( cfg->m_LibWidth > 0 )
273 SetAuiPaneSize( m_auimgr, treePane, cfg->m_LibWidth, -1 );
274
275 if( cfg->m_AuiPanels.right_panel_width > 0 )
276 SetAuiPaneSize( m_auimgr, layersManager, cfg->m_AuiPanels.right_panel_width, -1 );
277
278 m_appearancePanel->SetUserLayerPresets( cfg->m_LayerPresets );
279 m_appearancePanel->ApplyLayerPreset( cfg->m_ActiveLayerPreset );
280 m_appearancePanel->SetTabIndex( cfg->m_AuiPanels.appearance_panel_tab );
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
334 delete m_appearancePanel;
335 delete m_treePane;
336}
337
338
340{
342
343 FOOTPRINT* fp = static_cast<FOOTPRINT*>( GetModel() );
344
345 if( fp )
346 {
347 std::vector<MSG_PANEL_ITEM> msgItems;
348 fp->GetMsgPanelInfo( this, msgItems );
349 SetMsgPanel( msgItems );
350 }
351}
352
353
355{
356 return GetScreen() && GetScreen()->IsContentModified()
358}
359
360
362{
363 return m_toolManager->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
364}
365
366
368{
369 // switches currently used canvas (Cairo / OpenGL).
370 PCB_BASE_FRAME::SwitchCanvas( aCanvasType );
371
372 GetCanvas()->GetGAL()->SetAxesEnabled( true );
373
374 // The base class method *does not reinit* the layers manager. We must update the layer
375 // widget to match board visibility states, both layers and render columns, and and some
376 // settings dependent on the canvas.
378}
379
380
382{
383 SyncLibraryTree( true );
385}
386
387
389{
390 wxAuiPaneInfo& treePane = m_auimgr.GetPane( m_treePane );
391 treePane.Show( !IsLibraryTreeShown() );
392
393 if( IsLibraryTreeShown() )
394 {
395 // SetAuiPaneSize also updates m_auimgr
397 }
398 else
399 {
400 m_editorSettings->m_LibWidth = m_treePane->GetSize().x;
401 m_auimgr.Update();
402 }
403}
404
405
407{
409}
410
411
413{
415 wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
416 wxAuiPaneInfo& selectionFilter = m_auimgr.GetPane( "SelectionFilter" );
417
418 // show auxiliary Vertical layers and visibility manager toolbar
420 layersManager.Show( m_show_layer_manager_tools );
421 selectionFilter.Show( m_show_layer_manager_tools );
422
424 {
425 SetAuiPaneSize( m_auimgr, layersManager, settings->m_AuiPanels.right_panel_width, -1 );
426 }
427 else
428 {
429 settings->m_AuiPanels.right_panel_width = m_appearancePanel->GetSize().x;
430 m_auimgr.Update();
431 }
432}
433
434
436{
437 return const_cast<wxAuiManager&>( m_auimgr ).GetPane( m_treePane ).IsShown();
438}
439
440
442{
443 return GetBoard()->GetFirstFootprint();
444}
445
446
448{
449 LIB_ID id;
450
451 if( IsLibraryTreeShown() )
453
454 if( id.GetLibNickname().empty() )
455 id = GetLoadedFPID();
456
457 return id;
458}
459
460
462{
463 FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
464
465 if( footprint )
466 return LIB_ID( footprint->GetFPID().GetLibNickname(), m_footprintNameWhenLoaded );
467 else
468 return LIB_ID();
469}
470
471
473{
474 if( GetBoard()->GetFirstFootprint() )
475 {
478 }
479
480 GetScreen()->SetContentModified( false );
481}
482
483
485{
486 // If we've already vetted closing this window, then we have no FP anymore
487 if( m_isClosing || !GetBoard() )
488 return false;
489
490 FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
491
492 return ( footprint && footprint->GetLink() != niluuid );
493}
494
495
497{
498 LIB_ID id = GetLoadedFPID();
499
500 if( id.IsValid() )
501 {
503 Prj().SetRString( PROJECT::PCB_FOOTPRINT_EDITOR_FP_NAME, id.GetLibItemName() );
504 }
505}
506
507
509{
510 const wxString& footprintName = Prj().GetRString( PROJECT::PCB_FOOTPRINT_EDITOR_FP_NAME );
511 const wxString& libNickname = Prj().GetRString( PROJECT::PCB_FOOTPRINT_EDITOR_LIB_NICKNAME );
512
513 if( libNickname.Length() && footprintName.Length() )
514 {
515 LIB_ID id;
516 id.SetLibNickname( libNickname );
517 id.SetLibItemName( footprintName );
518
519 FOOTPRINT* footprint = loadFootprint( id );
520
521 if( footprint )
522 AddFootprintToBoard( footprint );
523 }
524}
525
526
528{
530
531 m_originalFootprintCopy.reset( static_cast<FOOTPRINT*>( aFootprint->Clone() ) );
532 m_originalFootprintCopy->SetParent( nullptr );
533
535
537 // Ensure item UUIDs are valid
538 // ("old" footprints can have null uuids that create issues in fp editor)
539 aFootprint->FixUuids();
540
541 const wxString libName = aFootprint->GetFPID().GetLibNickname();
542
544 {
545 const wxString msg =
546 wxString::Format( _( "Editing %s from board. Saving will update the board only." ),
547 aFootprint->GetReference() );
548 const wxString openLibLink =
549 wxString::Format( _( "Open in library %s" ), UnescapeString( libName ) );
550
551 const auto openLibraryCopy = [this]( wxHyperlinkEvent& aEvent )
552 {
554 };
555
556 if( WX_INFOBAR* infobar = GetInfoBar() )
557 {
558 wxHyperlinkCtrl* button =
559 new wxHyperlinkCtrl( infobar, wxID_ANY, openLibLink, wxEmptyString );
560 button->Bind( wxEVT_COMMAND_HYPERLINK, openLibraryCopy );
561
562 infobar->RemoveAllButtons();
563 infobar->AddButton( button );
564 infobar->AddCloseButton();
565 infobar->ShowMessage( msg, wxICON_INFORMATION );
566 }
567 }
568 // An empty libname is OK - you get that when creating a new footprint from the main menu
569 // In that case. treat is as editable, and the user will be prompted for save-as when saving.
570 else if( !libName.empty()
571 && !PROJECT_PCB::PcbFootprintLibs( &Prj() )->IsFootprintLibWritable( libName ) )
572 {
573 wxString msg = wxString::Format( _( "Editing footprint from read-only library %s." ),
574 UnescapeString( libName ) );
575
576 if( WX_INFOBAR* infobar = GetInfoBar() )
577 {
578 wxString link = _( "Save as editable copy" );
579
580 const auto saveAsEditableCopy = [this, aFootprint]( wxHyperlinkEvent& aEvent )
581 {
582 SaveFootprintAs( aFootprint );
583 };
584
585 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, link, wxEmptyString );
586 button->Bind( wxEVT_COMMAND_HYPERLINK, saveAsEditableCopy );
587
588 infobar->RemoveAllButtons();
589 infobar->AddButton( button );
590 infobar->AddCloseButton();
591 infobar->ShowMessage( msg, wxICON_INFORMATION );
592 }
593 }
594 else
595 {
596 if( WX_INFOBAR* infobar = GetInfoBar() )
597 infobar->Dismiss();
598 }
599
601}
602
603
605{
606 ReloadFootprint( aFootprint );
607
609 setFPWatcher( nullptr );
610 else
611 setFPWatcher( aFootprint );
612}
613
614
616{
618}
619
620
622{
623 return GetBoard()->GetDesignSettings();
624}
625
626
628{
629 wxFAIL_MSG( wxT( "Plotting not supported in Footprint Editor" ) );
630
632}
633
634
636{
637 wxFAIL_MSG( wxT( "Plotting not supported in Footprint Editor" ) );
638}
639
640
642{
643 if( !m_editorSettings )
645
646 return m_editorSettings;
647}
648
649
651{
654}
655
656
658{
659 // Get our own settings; aCfg will be the PCBNEW_SETTINGS because we're part of the pcbnew
660 // compile unit
662
663 if( cfg )
664 {
666
668
671
674
676 }
677}
678
679
681{
682 // Load canvas type from the FOOTPRINT_EDITOR_SETTINGS:
684
685 // If we had an OpenGL failure this session, use the fallback GAL but don't update the
686 // user preference silently:
687
690}
691
692
694{
696
697 // Get our own settings; aCfg will be the PCBNEW_SETTINGS because we're part of the pcbnew
698 // compile unit
700
701 if( cfg )
702 {
704
707 cfg->m_LibWidth = m_treePane->GetSize().x;
709
711
713 {
714 cfg->m_AuiPanels.show_properties = m_propertiesPanel->IsShownOnScreen();
717 }
718
720
722 {
727 }
728 }
729}
730
731
732
734{
735 FOOTPRINT_EDITOR_SETTINGS* cfg = const_cast<FOOTPRINT_EDIT_FRAME*>( this )->GetSettings();
736
737 return cfg ? cfg->m_RotationAngle : ANGLE_90;
738}
739
740
741
743{
744 wxString currentTheme = GetFootprintEditorSettings()->m_ColorTheme;
745 return Pgm().GetSettingsManager().GetColorSettings( currentTheme );
746}
747
748
750{
751 // Get the actual frame settings for magnetic items
753 wxCHECK( cfg, nullptr );
754 return &cfg->m_MagneticItems;
755}
756
757
758const BOX2I FOOTPRINT_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
759{
760 FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
761
762 if( footprint )
763 {
764 bool hasGraphicalItem = footprint->Pads().size() || footprint->Zones().size();
765
766 if( !hasGraphicalItem )
767 {
768 for( const BOARD_ITEM* item : footprint->GraphicalItems() )
769 {
770 if( item->Type() == PCB_TEXT_T || item->Type() == PCB_TEXTBOX_T )
771 continue;
772
773 hasGraphicalItem = true;
774 break;
775 }
776 }
777
778 if( hasGraphicalItem )
779 {
780 return footprint->GetBoundingBox( false );
781 }
782 else
783 {
784 BOX2I newFootprintBB( { 0, 0 }, { 0, 0 } );
785 newFootprintBB.Inflate( pcbIUScale.mmToIU( 12 ) );
786 return newFootprintBB;
787 }
788 }
789
790 return GetBoardBoundingBox( false );
791}
792
793
795{
796 if( IsContentModified() )
797 {
798 wxString footprintName = GetBoard()->GetFirstFootprint()->GetReference();
799 wxString msg = _( "Save changes to '%s' before closing?" );
800
801 if( !HandleUnsavedChanges( this, wxString::Format( msg, footprintName ),
802 [&]() -> bool
803 {
804 return SaveFootprint( GetBoard()->GetFirstFootprint() );
805 } ) )
806 {
807 return false;
808 }
809 }
810
811 if( doClose )
812 {
813 GetInfoBar()->ShowMessageFor( wxEmptyString, 1 );
814 Clear_Pcb( false );
815 UpdateTitle();
816 }
817
818 return true;
819}
820
821
822bool FOOTPRINT_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
823{
824 if( IsContentModified() )
825 {
826 // Shutdown blocks must be determined and vetoed as early as possible
828 aEvent.GetId() == wxEVT_QUERY_END_SESSION )
829 {
830 aEvent.Veto();
831 return false;
832 }
833
834 wxString footprintName = GetBoard()->GetFirstFootprint()->GetFPID().GetLibItemName();
835
837 footprintName = GetBoard()->GetFirstFootprint()->GetReference();
838
839 wxString msg = _( "Save changes to '%s' before closing?" );
840
841 if( !HandleUnsavedChanges( this, wxString::Format( msg, footprintName ),
842 [&]() -> bool
843 {
844 return SaveFootprint( GetBoard()->GetFirstFootprint() );
845 } ) )
846 {
847 aEvent.Veto();
848 return false;
849 }
850 }
851
852 PAD_TOOL* padTool = m_toolManager->GetTool<PAD_TOOL>();
853
854 if( padTool->InPadEditMode() )
855 padTool->ExitPadEditMode();
856
857 // Save footprint tree column widths
858 m_adapter->SaveSettings();
859
861}
862
863
865{
866 // No more vetos
867 GetCanvas()->SetEventDispatcher( nullptr );
869
870 // Do not show the layer manager during closing to avoid flicker
871 // on some platforms (Windows) that generate useless redraw of items in
872 // the Layer Manager
873 m_auimgr.GetPane( wxT( "LayersManager" ) ).Show( false );
874 m_auimgr.GetPane( wxT( "SelectionFilter" ) ).Show( false );
875
876 Clear_Pcb( false );
877
879
880 if( mgr->IsProjectOpen() && wxFileName::IsDirWritable( Prj().GetProjectPath() ) )
881 {
882 GFootprintList.WriteCacheToFile( Prj().GetProjectPath() + wxT( "fp-info-cache" ) );
883 }
884}
885
886
887void FOOTPRINT_EDIT_FRAME::OnExitKiCad( wxCommandEvent& event )
888{
889 Kiway().OnKiCadExit();
890}
891
892
894{
895 Close();
896}
897
898
900{
902
903 aEvent.Enable( frame != nullptr );
904}
905
906
908{
910
911 FOOTPRINT* editorFootprint = GetBoard()->GetFirstFootprint();
912 bool canInsert = frame && editorFootprint && editorFootprint->GetLink() == niluuid;
913
914 // If the source was deleted, the footprint can inserted but not updated in the board.
915 if( frame && editorFootprint && editorFootprint->GetLink() != niluuid )
916 {
917 BOARD* mainpcb = frame->GetBoard();
918 canInsert = true;
919
920 // search if the source footprint was not deleted:
921 for( FOOTPRINT* candidate : mainpcb->Footprints() )
922 {
923 if( editorFootprint->GetLink() == candidate->m_Uuid )
924 {
925 canInsert = false;
926 break;
927 }
928 }
929 }
930
931 aEvent.Enable( canInsert );
932}
933
934
936{
937 // call my base class
939
940 // We have 2 panes to update.
941 // For some obscure reason, the AUI manager hides the first modified pane.
942 // So force show panes
943 wxAuiPaneInfo& tree_pane_info = m_auimgr.GetPane( m_treePane );
944 bool tree_shown = tree_pane_info.IsShown();
945 tree_pane_info.Caption( _( "Libraries" ) );
946
947 wxAuiPaneInfo& lm_pane_info = m_auimgr.GetPane( m_appearancePanel );
948 bool lm_shown = lm_pane_info.IsShown();
949 lm_pane_info.Caption( _( "Appearance" ) );
950 wxAuiPaneInfo& sf_pane_info = m_auimgr.GetPane( m_selectionFilterPanel );
951 sf_pane_info.Caption( _( "Selection Filter" ) );
952
953 // update the layer manager
955
956 // Now restore the visibility:
957 lm_pane_info.Show( lm_shown );
958 tree_pane_info.Show( tree_shown );
959 m_auimgr.Update();
960
962
963 UpdateTitle();
964}
965
966
968{
970 Update3DView( true, true );
972
973 if( !GetTitle().StartsWith( wxT( "*" ) ) )
974 UpdateTitle();
975}
976
977
979{
980 wxString title;
981 LIB_ID fpid = GetLoadedFPID();
982 FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
983 bool writable = true;
984
986 {
987 if( IsContentModified() )
988 title = wxT( "*" );
989
990 title += footprint->GetReference();
991 title += wxS( " " ) + wxString::Format( _( "[from %s]" ), Prj().GetProjectName()
992 + wxT( "." )
993 + FILEEXT::PcbFileExtension );
994 }
995 else if( fpid.IsValid() )
996 {
997 try
998 {
1000 }
1001 catch( const IO_ERROR& )
1002 {
1003 // best efforts...
1004 }
1005
1006 // Note: don't used GetLoadedFPID(); footprint name may have been edited
1007 if( IsContentModified() )
1008 title = wxT( "*" );
1009
1010 title += From_UTF8( footprint->GetFPID().Format().c_str() );
1011
1012 if( !writable )
1013 title += wxS( " " ) + _( "[Read Only]" );
1014 }
1015 else if( !fpid.GetLibItemName().empty() )
1016 {
1017 // Note: don't used GetLoadedFPID(); footprint name may have been edited
1018 if( IsContentModified() )
1019 title = wxT( "*" );
1020
1021 title += From_UTF8( footprint->GetFPID().GetLibItemName().c_str() );
1022 title += wxS( " " ) + _( "[Unsaved]" );
1023 }
1024 else
1025 {
1026 title = _( "[no footprint loaded]" );
1027 }
1028
1029 title += wxT( " \u2014 " ) + _( "Footprint Editor" );
1030
1031 SetTitle( title );
1032}
1033
1034
1036{
1038}
1039
1040
1042{
1046 UpdateTitle();
1047}
1048
1049
1051{
1053
1054 WX_PROGRESS_REPORTER progressReporter( this, _( "Loading Footprint Libraries" ), 2 );
1055
1056 if( GFootprintList.GetCount() == 0 )
1057 GFootprintList.ReadCacheFromFile( Prj().GetProjectPath() + wxT( "fp-info-cache" ) );
1058
1059 GFootprintList.ReadFootprintFiles( fpTable, nullptr, &progressReporter );
1060 progressReporter.Show( false );
1061
1064
1066 auto adapter = static_cast<FP_TREE_SYNCHRONIZING_ADAPTER*>( m_adapter.get() );
1067
1068 adapter->AddLibraries( this );
1069}
1070
1071
1073{
1075 auto adapter = static_cast<FP_TREE_SYNCHRONIZING_ADAPTER*>( m_adapter.get() );
1076 LIB_ID target = GetTargetFPID();
1077 bool targetSelected = ( target == GetLibTree()->GetSelectedLibId() );
1078
1079 // Sync FOOTPRINT_INFO list to the libraries on disk
1080 if( aProgress )
1081 {
1082 WX_PROGRESS_REPORTER progressReporter( this, _( "Updating Footprint Libraries" ), 2 );
1083 GFootprintList.ReadFootprintFiles( fpTable, nullptr, &progressReporter );
1084 progressReporter.Show( false );
1085 }
1086 else
1087 {
1088 GFootprintList.ReadFootprintFiles( fpTable, nullptr, nullptr );
1089 }
1090
1091 // Unselect before syncing to avoid null reference in the adapter
1092 // if a selected item is removed during the sync
1093 GetLibTree()->Unselect();
1094
1095 // Sync the LIB_TREE to the FOOTPRINT_INFO list
1096 adapter->Sync( fpTable );
1097
1098 GetLibTree()->Regenerate( true );
1099
1100 if( target.IsValid() )
1101 {
1102 if( adapter->FindItem( target ) )
1103 {
1104 if( targetSelected )
1105 GetLibTree()->SelectLibId( target );
1106 else
1107 GetLibTree()->CenterLibId( target );
1108 }
1109 else
1110 {
1111 // Try to focus on parent
1112 target.SetLibItemName( wxEmptyString );
1113 GetLibTree()->CenterLibId( target );
1114 }
1115 }
1116}
1117
1118
1120{
1122}
1123
1124
1126{
1127 GetLibTree()->SelectLibId( aLibID );
1128}
1129
1130
1132{
1134}
1135
1136
1138{
1139 // Create the manager and dispatcher & route draw panel events to the dispatcher
1142 GetCanvas()->GetViewControls(), config(), this );
1143 m_actions = new PCB_ACTIONS();
1145
1147
1157 m_toolManager->RegisterTool( new PCB_CONTROL ); // copy/paste
1170
1171 for( TOOL_BASE* tool : m_toolManager->Tools() )
1172 {
1173 if( PCB_TOOL_BASE* pcbTool = dynamic_cast<PCB_TOOL_BASE*>( tool ) )
1174 pcbTool->SetIsFootprintEditor( true );
1175 }
1176
1177 m_toolManager->GetTool<PCB_VIEWER_TOOLS>()->SetFootprintFrame( true );
1179
1180 m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
1181
1182 // Load or reload wizard plugins in case they changed since the last time the frame opened
1183 // Because the board editor has also a plugin python menu,
1184 // call the PCB_EDIT_FRAME RunAction() if the board editor is running
1185 // Otherwise run the current RunAction().
1186 PCB_EDIT_FRAME* pcbframe = static_cast<PCB_EDIT_FRAME*>( Kiway().Player( FRAME_PCB_EDITOR, false ) );
1187
1188 if( pcbframe )
1190 else
1192}
1193
1194
1196{
1198
1200 PCB_EDITOR_CONDITIONS cond( this );
1201
1202 wxASSERT( mgr );
1203
1204#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
1205#define CHECK( x ) ACTION_CONDITIONS().Check( x )
1206
1207 auto haveFootprintCond =
1208 [this]( const SELECTION& )
1209 {
1210 return GetBoard() && GetBoard()->GetFirstFootprint() != nullptr;
1211 };
1212
1213 auto footprintTargettedCond =
1214 [this]( const SELECTION& )
1215 {
1216 return !GetTargetFPID().GetLibItemName().empty();
1217 };
1218
1219 const auto footprintFromBoardCond =
1220 [this]( const SELECTION& )
1221 {
1222 return IsCurrentFPFromBoard();
1223 };
1224
1225 // clang-format off
1226 mgr->SetConditions( ACTIONS::saveAs, ENABLE( footprintTargettedCond ) );
1229 mgr->SetConditions( PCB_ACTIONS::editLibFpInFpEditor,ENABLE( footprintFromBoardCond ) );
1230
1233
1237 mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MILLIMETRES ) ) );
1238 mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCHES ) ) );
1239 mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
1240
1241 mgr->SetConditions( ACTIONS::cut, ENABLE( cond.HasItems() ) );
1242 mgr->SetConditions( ACTIONS::copy, ENABLE( cond.HasItems() ) );
1249
1256
1260
1263 // clang-format on
1264
1265 auto constrainedDrawingModeCond =
1266 [this]( const SELECTION& )
1267 {
1268 return GetSettings()->m_Use45Limit;
1269 };
1270
1271 auto highContrastCond =
1272 [this]( const SELECTION& )
1273 {
1274 return GetDisplayOptions().m_ContrastModeDisplay != HIGH_CONTRAST_MODE::NORMAL;
1275 };
1276
1277 auto boardFlippedCond =
1278 [this]( const SELECTION& )
1279 {
1280 return GetCanvas() && GetCanvas()->GetView()->IsMirroredX();
1281 };
1282
1283 auto libraryTreeCond =
1284 [this](const SELECTION& )
1285 {
1286 return IsLibraryTreeShown();
1287 };
1288
1289 auto layerManagerCond =
1290 [this]( const SELECTION& )
1291 {
1292 return m_auimgr.GetPane( "LayersManager" ).IsShown();
1293 };
1294
1295 auto propertiesCond =
1296 [this] ( const SELECTION& )
1297 {
1298 return m_auimgr.GetPane( PropertiesPaneName() ).IsShown();
1299 };
1300
1301 mgr->SetConditions( PCB_ACTIONS::toggleHV45Mode, CHECK( constrainedDrawingModeCond ) );
1302 mgr->SetConditions( ACTIONS::highContrastMode, CHECK( highContrastCond ) );
1303 mgr->SetConditions( PCB_ACTIONS::flipBoard, CHECK( boardFlippedCond ) );
1305
1306 mgr->SetConditions( ACTIONS::showLibraryTree, CHECK( libraryTreeCond ) );
1307 mgr->SetConditions( PCB_ACTIONS::showLayersManager, CHECK( layerManagerCond ) );
1308 mgr->SetConditions( PCB_ACTIONS::showProperties, CHECK( propertiesCond ) );
1309
1310 mgr->SetConditions( ACTIONS::print, ENABLE( haveFootprintCond ) );
1311 mgr->SetConditions( PCB_ACTIONS::exportFootprint, ENABLE( haveFootprintCond ) );
1312 mgr->SetConditions( PCB_ACTIONS::placeImportedGraphics, ENABLE( haveFootprintCond ) );
1313
1314 mgr->SetConditions( PCB_ACTIONS::footprintProperties, ENABLE( haveFootprintCond ) );
1315 mgr->SetConditions( PCB_ACTIONS::editTextAndGraphics, ENABLE( haveFootprintCond ) );
1316 mgr->SetConditions( PCB_ACTIONS::checkFootprint, ENABLE( haveFootprintCond ) );
1317 mgr->SetConditions( PCB_ACTIONS::repairFootprint, ENABLE( haveFootprintCond ) );
1318 mgr->SetConditions( PCB_ACTIONS::cleanupGraphics, ENABLE( haveFootprintCond ) );
1319 mgr->SetConditions( ACTIONS::showDatasheet, ENABLE( haveFootprintCond ) );
1320
1321 auto isArcKeepCenterMode =
1322 [this]( const SELECTION& )
1323 {
1324 return GetSettings()->m_ArcEditMode == ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS;
1325 };
1326
1327 auto isArcKeepEndpointMode =
1328 [this]( const SELECTION& )
1329 {
1330 return GetSettings()->m_ArcEditMode == ARC_EDIT_MODE::KEEP_ENDPOINTS_OR_START_DIRECTION;
1331 };
1332
1333 mgr->SetConditions( PCB_ACTIONS::pointEditorArcKeepCenter, CHECK( isArcKeepCenterMode ) );
1334 mgr->SetConditions( PCB_ACTIONS::pointEditorArcKeepEndpoint, CHECK( isArcKeepEndpointMode ) );
1335
1336
1337// Only enable a tool if the part is edtable
1338#define CURRENT_EDIT_TOOL( action ) \
1339 mgr->SetConditions( action, ACTION_CONDITIONS().Enable( haveFootprintCond ) \
1340 .Check( cond.CurrentTool( action ) ) )
1341
1362
1363#undef CURRENT_EDIT_TOOL
1364#undef ENABLE
1365#undef CHECK
1366}
1367
1368
1370{
1372
1373 // Be sure the axis are enabled
1374 GetCanvas()->GetGAL()->SetAxesEnabled( true );
1375
1376 UpdateView();
1377
1378 // Ensure the m_Layers settings are using the canvas type:
1380}
1381
1382
1383void FOOTPRINT_EDIT_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
1384{
1385 PCB_BASE_EDIT_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
1386
1388 GetGalDisplayOptions().ReadWindowSettings( cfg->m_Window );
1389
1390 GetBoard()->GetDesignSettings() = cfg->m_DesignSettings;
1391
1395
1397
1398 if( aEnvVarsChanged )
1399 SyncLibraryTree( true );
1400
1401 Layout();
1402 SendSizeEvent();
1403}
1404
1405
1406std::unique_ptr<GRID_HELPER> FOOTPRINT_EDIT_FRAME::MakeGridHelper()
1407{
1408 return std::make_unique<PCB_GRID_HELPER>( m_toolManager, GetMagneticItemsSettings() );
1409}
1410
1411
1413{
1414 LIB_ID id = GetLoadedFPID();
1415
1416 if( id.empty() )
1417 {
1418 DisplayErrorMessage( this, _( "No footprint selected." ) );
1419 return;
1420 }
1421
1422 wxFileName fn( id.GetLibItemName() );
1423 fn.SetExt( wxT( "png" ) );
1424
1425 wxString projectPath = wxPathOnly( Prj().GetProjectFullName() );
1426
1427 wxFileDialog dlg( this, _( "Export View as PNG" ), projectPath, fn.GetFullName(),
1428 FILEEXT::PngFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
1429
1430 if( dlg.ShowModal() == wxID_CANCEL || dlg.GetPath().IsEmpty() )
1431 return;
1432
1433 // calling wxYield is mandatory under Linux, after closing the file selector dialog
1434 // to refresh the screen before creating the PNG or JPEG image from screen
1435 wxYield();
1436 this->SaveCanvasImageToFile( dlg.GetPath(), BITMAP_TYPE::PNG );
1437}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:108
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:187
static TOOL_ACTION paste
Definition: actions.h:73
static TOOL_ACTION millimetersUnits
Definition: actions.h:195
static TOOL_ACTION unselectAll
Definition: actions.h:76
static TOOL_ACTION revert
Definition: actions.h:55
static TOOL_ACTION showLibraryTree
Definition: actions.h:154
static TOOL_ACTION saveAs
Definition: actions.h:52
static TOOL_ACTION copy
Definition: actions.h:71
static TOOL_ACTION pluginsReload
Definition: actions.h:241
static TOOL_ACTION pasteSpecial
Definition: actions.h:74
static TOOL_ACTION showDatasheet
Definition: actions.h:217
static TOOL_ACTION milsUnits
Definition: actions.h:194
static TOOL_ACTION toggleBoundingBoxes
Definition: actions.h:147
static TOOL_ACTION undo
Definition: actions.h:68
static TOOL_ACTION duplicate
Definition: actions.h:77
static TOOL_ACTION inchesUnits
Definition: actions.h:193
static TOOL_ACTION highContrastMode
Definition: actions.h:145
static TOOL_ACTION embeddedFiles
Definition: actions.h:244
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:144
static TOOL_ACTION measureTool
Definition: actions.h:203
static TOOL_ACTION doDelete
Definition: actions.h:78
static TOOL_ACTION selectionTool
Definition: actions.h:202
static TOOL_ACTION save
Definition: actions.h:51
static TOOL_ACTION zoomFitScreen
Definition: actions.h:134
static TOOL_ACTION redo
Definition: actions.h:69
static TOOL_ACTION deleteTool
Definition: actions.h:79
static TOOL_ACTION zoomTool
Definition: actions.h:138
static TOOL_ACTION print
Definition: actions.h:57
static TOOL_ACTION showProperties
Definition: actions.h:216
static TOOL_ACTION cut
Definition: actions.h:70
static TOOL_ACTION gridSetOrigin
Definition: actions.h:184
static TOOL_ACTION ddAddLibrary
Definition: actions.h:60
static TOOL_ACTION toggleGridOverrides
Definition: actions.h:188
static TOOL_ACTION selectAll
Definition: actions.h:75
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:92
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:189
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
Container for design settings for a BOARD object.
std::shared_ptr< NET_SETTINGS > m_NetSettings
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
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:290
void SetBoardUse(BOARD_USE aUse)
Set what the board is going to be used for.
Definition: board.h:302
void SetEnabledLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
Definition: board.cpp:795
bool SetLayerName(PCB_LAYER_ID aLayer, const wxString &aLayerName)
Changes the name of the layer given by aLayer.
Definition: board.cpp:595
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Definition: board.h:448
void SetVisibleAlls()
Change the bit-mask of visible element categories and layers.
Definition: board.cpp:824
const FOOTPRINTS & Footprints() const
Definition: board.h:331
void SetVisibleLayers(LSET aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings changes the bit-mask of vis...
Definition: board.cpp:807
void SetCopperLayerCount(int aCount)
Definition: board.cpp:744
void DeleteAllFootprints()
Remove all footprints from the deque and free the memory associated with them.
Definition: board.cpp:1395
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:892
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 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
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
virtual void OnSize(wxSizeEvent &aEvent)
virtual bool canCloseWindow(wxCloseEvent &aCloseEvent)
bool m_isClosing
Set by NonUserClose() to indicate that the user did not request the current close.
WX_INFOBAR * GetInfoBar()
EDA_DRAW_PANEL_GAL::GAL_TYPE m_canvasType
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)
Changes the current rendering backend.
EDA_DRAW_PANEL_GAL::GAL_TYPE loadCanvasTypeSetting(APP_SETTINGS_BASE *aCfg=nullptr)
Returns 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 occured 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
Returns 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
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
void SelectLayer(wxCommandEvent &event)
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 OnLoadFootprintFromBoard(wxCommandEvent &event)
Called from the main toolbar to load a footprint from board mainly to edit it.
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Called after the preferences dialog is run.
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 OnSaveFootprintToBoard(wxCommandEvent &event)
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
Returns bbox of document with option to not include some items.
bool Clear_Pcb(bool doAskAboutUnsavedChanges)
Delete all and reinitialize the current board.
Definition: initpcb.cpp:105
void OnUpdateLoadFootprintFromBoard(wxUpdateUIEvent &aEvent)
void OnUpdateSaveFootprintToBoard(wxUpdateUIEvent &aEvent)
Install the corresponding dialog editor for the given item.
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:649
ZONES & Zones()
Definition: footprint.h:212
EDA_ITEM * Clone() const override
Invoke a function on all children.
Definition: footprint.cpp:2032
std::deque< PAD * > & Pads()
Definition: footprint.h:206
const LIB_ID & GetFPID() const
Definition: footprint.h:248
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:1530
KIID GetLink() const
Definition: footprint.h:852
const wxString & GetReference() const
Definition: footprint.h:602
DRAWINGS & GraphicalItems()
Definition: footprint.h:209
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: footprint.cpp:1252
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:755
bool IsMirroredX() const
Return true if view is flipped across the X axis.
Definition: view.h:247
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition: view.h:636
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:284
void OnKiCadExit()
Definition: kiway.cpp:725
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:406
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:110
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:99
UTF8 Format() const
Definition: lib_id.cpp:118
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()
Refreshes the tree (mainly to update highlighting and asterisking)
Definition: lib_tree.cpp:440
void CenterLibId(const LIB_ID &aLibId)
Ensure that an item is visible (preferably centered).
Definition: lib_tree.cpp:349
void ShowChangedLanguage()
Definition: lib_tree.cpp:291
void SelectLibId(const LIB_ID &aLibId)
Select an item in the tree widget.
Definition: lib_tree.cpp:343
LIB_TREE_MODEL_ADAPTER::SORT_MODE GetSortMode() const
Definition: lib_tree.h:141
void Unselect()
Unselect currently selected item in wxDataViewCtrl.
Definition: lib_tree.cpp:355
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:301
void Regenerate(bool aKeepState)
Regenerate the tree.
Definition: lib_tree.cpp:422
void SetSortMode(LIB_TREE_MODEL_ADAPTER::SORT_MODE aMode)
Save/restore the sorting mode.
Definition: lib_tree.h:140
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:50
static TOOL_ACTION toggleHV45Mode
Definition: pcb_actions.h:524
static TOOL_ACTION drawRuleArea
Definition: pcb_actions.h:223
static TOOL_ACTION placeText
Definition: pcb_actions.h:208
static TOOL_ACTION pointEditorArcKeepCenter
Definition: pcb_actions.h:302
static TOOL_ACTION drawOrthogonalDimension
Definition: pcb_actions.h:219
static TOOL_ACTION drawRectangle
Definition: pcb_actions.h:203
static TOOL_ACTION setAnchor
Definition: pcb_actions.h:230
static TOOL_ACTION padDisplayMode
Definition: pcb_actions.h:340
static TOOL_ACTION placeReferenceImage
Definition: pcb_actions.h:207
static TOOL_ACTION showLayersManager
Definition: pcb_actions.h:454
static TOOL_ACTION drawCircle
Definition: pcb_actions.h:204
static TOOL_ACTION mirrorH
Mirroring of selected items.
Definition: pcb_actions.h:139
static TOOL_ACTION exportFootprint
Definition: pcb_actions.h:476
static TOOL_ACTION drawTextBox
Definition: pcb_actions.h:209
static TOOL_ACTION drawPolygon
Definition: pcb_actions.h:202
static TOOL_ACTION placePad
Activation of the drawing tool (placing a PAD)
Definition: pcb_actions.h:484
static TOOL_ACTION group
Definition: pcb_actions.h:532
static TOOL_ACTION drawRadialDimension
Definition: pcb_actions.h:218
static TOOL_ACTION editTextAndGraphics
Definition: pcb_actions.h:423
static TOOL_ACTION drawLeader
Definition: pcb_actions.h:220
static TOOL_ACTION ddImportFootprint
Definition: pcb_actions.h:590
static TOOL_ACTION ungroup
Definition: pcb_actions.h:533
static TOOL_ACTION placeImportedGraphics
Definition: pcb_actions.h:229
static TOOL_ACTION drawArc
Definition: pcb_actions.h:205
static TOOL_ACTION graphicsOutlines
Display footprint graphics as outlines.
Definition: pcb_actions.h:496
static TOOL_ACTION pointEditorArcKeepEndpoint
Definition: pcb_actions.h:303
static TOOL_ACTION drawCenterDimension
Definition: pcb_actions.h:217
static TOOL_ACTION footprintProperties
Definition: pcb_actions.h:478
static TOOL_ACTION flipBoard
Definition: pcb_actions.h:394
static TOOL_ACTION textOutlines
Display texts as lines.
Definition: pcb_actions.h:499
static TOOL_ACTION checkFootprint
Definition: pcb_actions.h:481
static TOOL_ACTION editLibFpInFpEditor
Definition: pcb_actions.h:452
static TOOL_ACTION mirrorV
Definition: pcb_actions.h:140
static TOOL_ACTION repairFootprint
Definition: pcb_actions.h:550
static TOOL_ACTION drawLine
Definition: pcb_actions.h:201
static TOOL_ACTION cleanupGraphics
Definition: pcb_actions.h:427
static TOOL_ACTION rotateCw
Rotation of selected objects.
Definition: pcb_actions.h:132
static TOOL_ACTION rotateCcw
Definition: pcb_actions.h:133
static TOOL_ACTION drawAlignedDimension
Definition: pcb_actions.h:216
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)
Creates (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)
Attempts 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:142
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:226
@ PCB_FOOTPRINT_EDITOR_LIB_NICKNAME
Definition: project.h:227
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:307
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:318
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()
Returns a handle to the a given settings by type If the settings have already been loaded,...
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
bool IsProjectOpen() const
Helper for checking if we have a project open TODO: This should be deprecated along with Prj() once w...
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:167
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:169
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:55
ACTIONS * m_actions
Definition: tools_holder.h:168
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:302
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Reset all tools (i.e.
std::vector< TOOL_BASE * > Tools()
Definition: tool_manager.h:337
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()
Initializes 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:195
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:403
#define KICAD_DEFAULT_DRAWFRAME_STYLE
#define FOOTPRINT_EDIT_FRAME_NAME
EVT_UPDATE_UI(ID_LOAD_FOOTPRINT_FROM_BOARD, FOOTPRINT_EDIT_FRAME::OnUpdateLoadFootprintFromBoard) EVT_UPDATE_UI(ID_ADD_FOOTPRINT_TO_BOARD
#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:145
@ ID_ON_ZOOM_SELECT
Definition: id.h:143
PROJECT & Prj()
Definition: kicad.cpp:595
KIID niluuid(0)
@ 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:98
@ ID_ADD_FOOTPRINT_TO_BOARD
Definition: pcbnew_id.h:116
@ ID_LOAD_FOOTPRINT_FROM_BOARD
Definition: pcbnew_id.h:117
@ ID_TOOLBARH_PCB_SELECT_LAYER
Definition: pcbnew_id.h:96
SETTINGS_MANAGER * GetSettingsManager()
BOARD * GetBoard()
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1060
see class PGM_BASE
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:88
@ 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.