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"
37#include <bitmaps.h>
38#include <board.h>
40#include <widgets/wx_infobar.h>
41#include <footprint.h>
42#include <confirm.h>
47#include <kiface_base.h>
48#include <kiplatform/app.h>
49#include <kiplatform/ui.h>
50#include <kiway.h>
51#include <macros.h>
52#include <pcbnew_id.h>
53#include <pgm_base.h>
54#include <project.h>
55#include <project_pcb.h>
56#include <string_utils.h>
58#include <tool/action_toolbar.h>
59#include <tool/common_control.h>
60#include <tool/common_tools.h>
62#include <tool/selection.h>
65#include <tool/tool_manager.h>
66#include <tool/zoom_tool.h>
67#include <tools/array_tool.h>
74#include <widgets/lib_tree.h>
80
81#include <wx/filedlg.h>
82#include <wx/hyperlink.h>
83
84#ifdef KICAD_IPC_API
85#include <api/api_server.h>
88#endif
89
90BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
91 EVT_MENU( wxID_CLOSE, FOOTPRINT_EDIT_FRAME::CloseFootprintEditor )
92 EVT_MENU( wxID_EXIT, FOOTPRINT_EDIT_FRAME::OnExitKiCad )
93
95
98
100
101 // Drop files event
102 EVT_DROP_FILES( FOOTPRINT_EDIT_FRAME::OnDropFiles )
103
104END_EVENT_TABLE()
105
106
107FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
108 PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_FOOTPRINT_EDITOR, wxEmptyString,
109 wxDefaultPosition, wxDefaultSize,
112{
113 m_showBorderAndTitleBlock = false; // true to show the frame references
114 m_aboutTitle = _HKI( "KiCad Footprint Editor" );
115 m_editorSettings = nullptr;
116
117 // Give an icon
118 wxIcon icon;
119 wxIconBundle icon_bundle;
120
121 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_modedit, 48 ) );
122 icon_bundle.AddIcon( icon );
123 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_modedit, 128 ) );
124 icon_bundle.AddIcon( icon );
125 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_modedit, 256 ) );
126 icon_bundle.AddIcon( icon );
127 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_modedit_32 ) );
128 icon_bundle.AddIcon( icon );
129 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_modedit_16 ) );
130 icon_bundle.AddIcon( icon );
131
132 SetIcons( icon_bundle );
133
134 // Create GAL canvas
136
137 PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_frameSize,
139 SetCanvas( drawPanel );
140
142
143 SetBoard( new BOARD() );
144
145 // This board will only be used to hold a footprint for editing
146 GetBoard()->SetBoardUse( BOARD_USE::FPHOLDER );
147
148 // In Footprint Editor, the default net clearance is not known (it depends on the actual
149 // board). So we do not show the default clearance, by setting it to 0. The footprint or
150 // pad specific clearance will be shown.
151 GetBoard()->GetDesignSettings().m_NetSettings->GetDefaultNetclass()->SetClearance( 0 );
152
153 // Don't show the default board solder mask expansion in the footprint editor. Only the
154 // footprint or pad mask expansions settings should be shown.
155 GetBoard()->GetDesignSettings().m_SolderMaskExpansion = 0;
156
157 // Ensure all layers and items are visible:
158 // In footprint editor, some layers have no meaning or cannot be used, but we show all of
159 // them, at least to be able to edit a bad layer
160 GetBoard()->SetVisibleAlls();
161
162 GetGalDisplayOptions().m_axesEnabled = true;
163
164 // In Footprint Editor, set the default paper size to A4 for plot/print
166 SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU( pcbIUScale.IU_PER_MILS ) ) );
167
168 // Create the manager and dispatcher & route draw panel events to the dispatcher
169 setupTools();
171
173 m_treePane = new FOOTPRINT_TREE_PANE( this );
174
178 ReCreateLayerBox( false );
179
181
183 m_appearancePanel = new APPEARANCE_CONTROLS( this, GetCanvas(), true );
184 m_propertiesPanel = new PCB_PROPERTIES_PANEL( this, this );
185
186 // LoadSettings() *after* creating m_LayersManager, because LoadSettings() initialize
187 // parameters in m_LayersManager
188 // NOTE: KifaceSettings() will return PCBNEW_SETTINGS if we started from pcbnew
190
192
193 float proportion = GetFootprintEditorSettings()->m_AuiPanels.properties_splitter;
194 m_propertiesPanel->SetSplitterProportion( proportion );
195
197
198 // Fetch a COPY of the config as a lot of these initializations are going to overwrite our
199 // data.
200 int libWidth = 0;
202
204 {
205 libWidth = cfg->m_LibWidth;
206 aui_cfg = cfg->m_AuiPanels;
207 }
208 else
209 {
210 // keep gcc quiet about uninitalized vars:
211 aui_cfg.appearance_panel_tab = 0;
212 aui_cfg.right_panel_width = -1;
213 }
214
215 m_auimgr.SetManagedWindow( this );
216
217 unsigned int auiFlags = wxAUI_MGR_DEFAULT;
218#if !defined( _WIN32 )
219 // Windows cannot redraw the UI fast enough during a live resize and may lead to all kinds
220 // of graphical glitches
221 auiFlags |= wxAUI_MGR_LIVE_RESIZE;
222#endif
223 m_auimgr.SetFlags( auiFlags );
224
225 // Rows; layers 4 - 6
226 m_auimgr.AddPane( m_tbTopMain, EDA_PANE().HToolbar().Name( "TopMainToolbar" )
227 .Top().Layer( 6 ) );
228
229 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" )
230 .Bottom().Layer( 6 ) );
231
232 // Columns; layers 1 - 3
233 m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "Footprints" )
234 .Left().Layer( 4 )
235 .Caption( _( "Libraries" ) )
236 // Don't use -1 for don't-change-height on a growable panel; it has side-effects.
237 .MinSize( FromDIP( 250 ), FromDIP( 80 ) )
238 .BestSize( FromDIP( 250 ), -1 ) );
240 .Left().Layer( 3 )
241 .Caption( _( "Properties" ) ).PaneBorder( false )
242 .MinSize( FromDIP( wxSize( 240, 60 ) ) ).BestSize( FromDIP( wxSize( 300, 200 ) ) ) );
243 m_auimgr.AddPane( m_tbLeft, EDA_PANE().VToolbar().Name( "LeftToolbar" )
244 .Left().Layer( 2 ) );
245
246 m_auimgr.AddPane( m_tbRight, EDA_PANE().VToolbar().Name( "RightToolbar" )
247 .Right().Layer(2) );
248 m_auimgr.AddPane( m_appearancePanel, EDA_PANE().Name( "LayersManager" )
249 .Right().Layer( 3 )
250 .Caption( _( "Appearance" ) ).PaneBorder( false )
251 // Don't use -1 for don't-change-height on a growable panel; it has side-effects.
252 .MinSize( FromDIP( 180 ), FromDIP( 80 ) )
253 .BestSize( FromDIP( 180 ), -1 ) );
254 m_auimgr.AddPane( m_selectionFilterPanel, EDA_PANE().Palette().Name( "SelectionFilter" )
255 .Right().Layer( 3 ).Position( 2 )
256 .Caption( _( "Selection Filter" ) ).PaneBorder( false )
257 // Fixed-size pane; -1 for MinSize height is required
258 .MinSize( FromDIP( 180 ), -1 )
259 .BestSize( FromDIP( 180 ), -1 ) );
260
261 // Center
262 m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" )
263 .Center() );
264
266
267 m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools );
268 m_auimgr.GetPane( "SelectionFilter" ).Show( m_show_layer_manager_tools );
269 m_auimgr.GetPane( PropertiesPaneName() ).Show( GetSettings()->m_AuiPanels.show_properties );
270
271 // The selection filter doesn't need to grow in the vertical direction when docked
272 m_auimgr.GetPane( "SelectionFilter" ).dock_proportion = 0;
273
276 DragAcceptFiles( true );
277
279
280 // Apply saved visibility stuff at the end
281 wxAuiPaneInfo& treePane = m_auimgr.GetPane( "Footprints" );
282 wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
283
284 if( libWidth > 0 )
285 SetAuiPaneSize( m_auimgr, treePane, libWidth, -1 );
286
287 if( aui_cfg.right_panel_width > 0 )
288 SetAuiPaneSize( m_auimgr, layersManager, aui_cfg.right_panel_width, -1 );
289
290 m_appearancePanel->SetTabIndex( aui_cfg.appearance_panel_tab );
291
293 {
294 m_appearancePanel->SetUserLayerPresets( cfg->m_LayerPresets );
295 m_appearancePanel->ApplyLayerPreset( cfg->m_ActiveLayerPreset );
296 }
297
298 // restore the last footprint from the project, if any, after the library has been init'ed
299 // N.B. This needs to happen after the AUI manager has been initialized so that we can
300 // properly call the WX_INFOBAR without crashing on some systems.
302
303#ifdef KICAD_IPC_API
304 m_apiHandler = std::make_unique<API_HANDLER_FOOTPRINT>( this );
305 Pgm().GetApiServer().RegisterHandler( m_apiHandler.get() );
306
307 if( Kiface().IsSingle() )
308 {
309 m_apiHandlerCommon = std::make_unique<API_HANDLER_COMMON>();
310 Pgm().GetApiServer().RegisterHandler( m_apiHandlerCommon.get() );
311 }
312#endif
313
314 // This displays the last footprint loaded, if any, so it must be done after restoreLastFootprint()
316
317 GetToolManager()->PostAction( ACTIONS::zoomFitScreen );
318 UpdateTitle();
320
322
323 // Default shutdown reason until a file is loaded
324 KIPLATFORM::APP::SetShutdownBlockReason( this, _( "Footprint changes are unsaved" ) );
325
326 // Catch unhandled accelerator command characters that were no handled by the library tree
327 // panel.
329 Bind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
330
331 // Ensure the window is on top
332 Raise();
333 Show( true );
334
335 // Register a call to update the toolbar sizes. It can't be done immediately because
336 // it seems to require some sizes calculated that aren't yet (at least on GTK).
337 CallAfter(
338 [this]()
339 {
340 // Ensure the controls on the toolbars all are correctly sized
342 m_treePane->FocusSearchFieldIfExists();
343
344 // Update the angle snap mode toolbar button to reflect the current preference
346 } );
347}
348
349
351{
352 // Shutdown all running tools
353 if( m_toolManager )
354 m_toolManager->ShutdownAllTools();
355
356 // save the footprint in the PROJECT
358
359 // Clear the watched file
360 setFPWatcher( nullptr );
361
362 // We passed ownership of these to wxAuiManager.
363 // delete m_selectionFilterPanel;
364 // delete m_appearancePanel;
365 // delete m_treePane;
366}
367
368
370{
372
373 FOOTPRINT* fp = static_cast<FOOTPRINT*>( GetModel() );
374
375 if( fp )
376 {
377 std::vector<MSG_PANEL_ITEM> msgItems;
378 fp->GetMsgPanelInfo( this, msgItems );
379 SetMsgPanel( msgItems );
380 }
381}
382
383
389
390
392{
393 return m_toolManager->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
394}
395
396
398{
399 // switches currently used canvas (Cairo / OpenGL).
400 PCB_BASE_FRAME::SwitchCanvas( aCanvasType );
401
402 GetCanvas()->GetGAL()->SetAxesEnabled( true );
403
404 // The base class method *does not reinit* the layers manager. We must update the layer
405 // widget to match board visibility states, both layers and render columns, and and some
406 // settings dependent on the canvas.
408}
409
410
416
417
419{
420 wxAuiPaneInfo& treePane = m_auimgr.GetPane( m_treePane );
421 treePane.Show( !IsLibraryTreeShown() );
422
423 if( IsLibraryTreeShown() )
424 {
425 // SetAuiPaneSize also updates m_auimgr
426 SetAuiPaneSize( m_auimgr, treePane, m_editorSettings->m_LibWidth, -1 );
427 }
428 else
429 {
430 m_editorSettings->m_LibWidth = m_treePane->GetSize().x;
431 m_auimgr.Update();
432 }
433}
434
435
437{
438 m_treePane->FocusSearchFieldIfExists();
439}
440
441
443{
445 wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
446 wxAuiPaneInfo& selectionFilter = m_auimgr.GetPane( "SelectionFilter" );
447
448 // show auxiliary Vertical layers and visibility manager toolbar
450 layersManager.Show( m_show_layer_manager_tools );
451 selectionFilter.Show( m_show_layer_manager_tools );
452
454 {
455 SetAuiPaneSize( m_auimgr, layersManager, settings->m_AuiPanels.right_panel_width, -1 );
456 }
457 else
458 {
459 settings->m_AuiPanels.right_panel_width = m_appearancePanel->GetSize().x;
460 m_auimgr.Update();
461 }
462}
463
464
466{
467 return const_cast<wxAuiManager&>( m_auimgr ).GetPane( m_treePane ).IsShown();
468}
469
470
475
476
478{
479 LIB_ID id;
480
481 if( IsLibraryTreeShown() )
483
484 if( id.GetLibNickname().empty() )
485 id = GetLoadedFPID();
486
487 return id;
488}
489
490
492{
493 FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
494
495 if( footprint )
496 return LIB_ID( footprint->GetFPID().GetLibNickname(), m_footprintNameWhenLoaded );
497 else
498 return LIB_ID();
499}
500
501
503{
504 if( GetBoard()->GetFirstFootprint() )
505 {
508 }
509
510 GetScreen()->SetContentModified( false );
511}
512
513
515{
516 // If we've already vetted closing this window, then we have no FP anymore
517 if( m_isClosing || !GetBoard() )
518 return false;
519
520 FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
521
522 return ( footprint && footprint->GetLink() != niluuid );
523}
524
525
527{
528 LIB_ID id = GetLoadedFPID();
529
530 if( id.IsValid() )
531 {
533 Prj().SetRString( PROJECT::PCB_FOOTPRINT_EDITOR_FP_NAME, id.GetLibItemName() );
534 }
535}
536
537
539{
540 const wxString& footprintName = Prj().GetRString( PROJECT::PCB_FOOTPRINT_EDITOR_FP_NAME );
541 const wxString& libNickname = Prj().GetRString( PROJECT::PCB_FOOTPRINT_EDITOR_LIB_NICKNAME );
542
543 if( libNickname.Length() && footprintName.Length() )
544 {
545 LIB_ID id;
546 id.SetLibNickname( libNickname );
547 id.SetLibItemName( footprintName );
548
549 FOOTPRINT* footprint = loadFootprint( id );
550
551 if( footprint )
552 AddFootprintToBoard( footprint );
553 }
554}
555
556
558{
559 FOOTPRINT* footprint = static_cast<FOOTPRINT*>( GetModel() );
560 BOARD& board = *GetBoard();
561
562 // All FPs have these layers enabled
563 LSET enabledLayers = LSET::AllTechMask() | LSET::UserMask();
564
565 const auto configureStackup =
566 [&]( FOOTPRINT_STACKUP aMode, const LSET& aLayerSet )
567 {
568 const LSET cuLayers = aLayerSet & LSET::AllCuMask();
569 board.SetCopperLayerCount( cuLayers.count() );
570
571 switch( aMode )
572 {
574 {
575 enabledLayers |= LSET{ F_Cu, In1_Cu, B_Cu };
576 board.SetLayerName( In1_Cu, _( "Inner layers" ) );
577 break;
578 }
579
581 {
582 // Nothing extra to add
583
584 // Clear layer name defaults
585 board.SetLayerName( In1_Cu, wxEmptyString );
586 break;
587 }
588
589 }
590
591 enabledLayers |= aLayerSet;
592 };
593
594 if( footprint )
595 {
596 configureStackup( footprint->GetStackupMode(), footprint->GetStackupLayers() );
597 }
598 else
599 {
600 // If no footprint is loaded, we assume the default stackup mode
601 configureStackup( FOOTPRINT_STACKUP::EXPAND_INNER_LAYERS, LSET{} );
602 }
603
605 {
606 m_originalFootprintCopy->RunOnChildren(
607 [&]( BOARD_ITEM* child )
608 {
609 LSET childLayers = child->GetLayerSet() & LSET::UserDefinedLayersMask();
610
611 for( PCB_LAYER_ID layer : childLayers )
612 enabledLayers.set( layer );
613 },
615 }
616
617 // Enable the user-configured number of user layers, plus any specifically named layers
619 {
620 int userLayerCount = cfg->m_DesignSettings.GetUserDefinedLayerCount();
621 enabledLayers |= LSET::UserDefinedLayersMask( userLayerCount );
622
623 for( const PCB_LAYER_ID& user : LSET::UserDefinedLayersMask() )
624 {
625 if( cfg->m_DesignSettings.m_UserLayerNames.contains( LSET::Name( user ).ToStdString() ) )
626 enabledLayers.set( user );
627 }
628 }
629
630 board.SetEnabledLayers( enabledLayers );
631
632 // Footprint Editor layer visibility is kept in the view, not the board (because the board
633 // just delegates to the project file, which we don't have).
634 for( const PCB_LAYER_ID& layer : GetBoard()->GetEnabledLayers() )
635 GetCanvas()->GetView()->SetLayerVisible( layer, true );
636}
637
638
640{
642
643 m_originalFootprintCopy.reset( static_cast<FOOTPRINT*>( aFootprint->Clone() ) );
644 m_originalFootprintCopy->SetParent( nullptr );
645
647
649 // Ensure item UUIDs are valid
650 // ("old" footprints can have null uuids that create issues in fp editor)
651 aFootprint->FixUuids();
652
654
655 // Use CallAfter so that we update the canvas before waiting for the infobar animation
656 CallAfter(
657 [this]()
658 {
660 wxString libName = fp->GetFPID().GetLibNickname();
661 wxString msg, link;
662
664 {
665 msg.Printf( _( "Editing %s from board. Saving will update the board only." ), fp->GetReference() );
666 link.Printf( _( "Open in library %s" ), UnescapeString( libName ) );
667
668 const auto openLibraryCopy =
669 [this]( wxHyperlinkEvent& aEvent )
670 {
672 };
673
674 if( WX_INFOBAR* infobar = GetInfoBar() )
675 {
676 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, link, wxEmptyString );
677 button->Bind( wxEVT_COMMAND_HYPERLINK, openLibraryCopy );
678
679 infobar->RemoveAllButtons();
680 infobar->AddButton( button );
681 infobar->AddCloseButton();
682 infobar->ShowMessage( msg, wxICON_INFORMATION );
683 }
684 }
685 // An empty libname is OK - you get that when creating a new footprint from the main menu
686 // In that case. treat is as editable, and the user will be prompted for save-as when saving.
687 else if( !libName.empty()
688 && !PROJECT_PCB::FootprintLibAdapter( &Prj() )->IsFootprintLibWritable( libName ) )
689 {
690 msg.Printf( _( "Editing footprint from read-only library %s." ), UnescapeString( libName ) );
691
692 if( WX_INFOBAR* infobar = GetInfoBar() )
693 {
694 link = _( "Save as editable copy" );
695
696 const auto saveAsEditableCopy =
697 [this]( wxHyperlinkEvent& aEvent )
698 {
699 SaveFootprintAs( GetBoard()->GetFirstFootprint() );
700 GetCanvas()->GetView()->Update( GetBoard()->GetFirstFootprint() );
701 ClearModify();
702
703 // Get rid of the save-will-update-board-only (or any other dismissable warning)
704 WX_INFOBAR* loc_infobar = GetInfoBar();
705
706 if( loc_infobar->IsShownOnScreen() && loc_infobar->HasCloseButton() )
707 loc_infobar->Dismiss();
708
710 SyncLibraryTree( true );
711 };
712
713 wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, link, wxEmptyString );
714 button->Bind( wxEVT_COMMAND_HYPERLINK, saveAsEditableCopy );
715
716 infobar->RemoveAllButtons();
717 infobar->AddButton( button );
718 infobar->AddCloseButton();
719 infobar->ShowMessage( msg, wxICON_INFORMATION );
720 }
721 }
722 else
723 {
724 if( WX_INFOBAR* infobar = GetInfoBar() )
725 infobar->Dismiss();
726 }
727 } );
728
731}
732
733
735{
736 ReloadFootprint( aFootprint );
737
739 setFPWatcher( nullptr );
740 else
741 setFPWatcher( aFootprint );
742}
743
744
749
750
755
756
758{
759 wxFAIL_MSG( wxT( "Plotting not supported in Footprint Editor" ) );
760
762}
763
764
766{
767 wxFAIL_MSG( wxT( "Plotting not supported in Footprint Editor" ) );
768}
769
770
778
779
787
788
790{
791 // Get our own settings; aCfg will be the PCBNEW_SETTINGS because we're part of the pcbnew
792 // compile unit
794
795 if( cfg )
796 {
798
800
803
805 m_selectionFilterPanel->SetCheckboxesFromFilter( cfg->m_SelectionFilter );
806
808
809 for( auto& [source_name, dest_name] : cfg->m_DesignSettings.m_UserLayerNames )
810 {
811 wxString wx_source_name = source_name;
812 PCB_LAYER_ID layer = static_cast<PCB_LAYER_ID>( LSET::NameToLayer( wx_source_name ) );
813
814 if( IsUserLayer( layer ) )
815 GetBoard()->SetLayerName( layer, dest_name );
816 }
817
818 }
819}
820
821
823{
824 // Load canvas type from the FOOTPRINT_EDITOR_SETTINGS:
826
827 // If we had an OpenGL failure this session, use the fallback GAL but don't update the
828 // user preference silently:
829
832}
833
834
836{
838
839 // Get our own settings; aCfg will be the PCBNEW_SETTINGS because we're part of the pcbnew
840 // compile unit
842
843 if( cfg )
844 {
846
849 cfg->m_LibWidth = m_treePane->GetSize().x;
850
851 if( TOOL_MANAGER* toolMgr = GetToolManager() )
852 {
853 if( PCB_SELECTION_TOOL* selTool = toolMgr->GetTool<PCB_SELECTION_TOOL>() )
854 cfg->m_SelectionFilter = selTool->GetFilter();
855 }
856
858
860 {
861 cfg->m_AuiPanels.show_properties = m_propertiesPanel->IsShownOnScreen();
863 cfg->m_AuiPanels.properties_splitter = m_propertiesPanel->SplitterProportion();
864 }
865
867
869 {
872 cfg->m_LayerPresets = m_appearancePanel->GetUserLayerPresets();
873 cfg->m_ActiveLayerPreset = m_appearancePanel->GetActiveLayerPreset();
874 }
875 }
876}
877
878
879
881{
882 FOOTPRINT_EDITOR_SETTINGS* cfg = const_cast<FOOTPRINT_EDIT_FRAME*>( this )->GetSettings();
883
884 return cfg ? cfg->m_RotationAngle : ANGLE_90;
885}
886
887
888
890{
892 return ::GetColorSettings( cfg ? cfg->m_ColorTheme : DEFAULT_THEME );
893}
894
895
897{
898 static MAGNETIC_SETTINGS fallback;
899
901 return &cfg->m_MagneticItems;
902
903 return &fallback;
904}
905
906
907const BOX2I FOOTPRINT_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) const
908{
909 FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
910
911 if( footprint )
912 {
913 bool hasGraphicalItem = footprint->Pads().size() || footprint->Zones().size();
914
915 if( !hasGraphicalItem )
916 {
917 for( const BOARD_ITEM* item : footprint->GraphicalItems() )
918 {
919 if( item->Type() == PCB_TEXT_T || item->Type() == PCB_TEXTBOX_T )
920 continue;
921
922 hasGraphicalItem = true;
923 break;
924 }
925 }
926
927 if( hasGraphicalItem )
928 {
929 return footprint->GetBoundingBox( false );
930 }
931 else
932 {
933 BOX2I newFootprintBB( { 0, 0 }, { 0, 0 } );
934 newFootprintBB.Inflate( pcbIUScale.mmToIU( 12 ) );
935 return newFootprintBB;
936 }
937 }
938
939 return GetBoardBoundingBox( false );
940}
941
942
944{
945 if( IsContentModified() )
946 {
947 wxString footprintName = GetBoard()->GetFirstFootprint()->GetReference();
948 wxString msg = _( "Save changes to '%s' before closing?" );
949
950 if( !HandleUnsavedChanges( this, wxString::Format( msg, footprintName ),
951 [&]() -> bool
952 {
953 return SaveFootprint( GetBoard()->GetFirstFootprint() );
954 } ) )
955 {
956 return false;
957 }
958 }
959
960 if( doClose )
961 {
962 GetInfoBar()->ShowMessageFor( wxEmptyString, 1 );
963 Clear_Pcb( false );
964 UpdateTitle();
965 }
966
967 return true;
968}
969
970
971bool FOOTPRINT_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
972{
973 if( IsContentModified() )
974 {
975 // Shutdown blocks must be determined and vetoed as early as possible
977 aEvent.GetId() == wxEVT_QUERY_END_SESSION )
978 {
979 aEvent.Veto();
980 return false;
981 }
982
983 wxString footprintName = GetBoard()->GetFirstFootprint()->GetFPID().GetLibItemName();
984
986 footprintName = GetBoard()->GetFirstFootprint()->GetReference();
987
988 wxString msg = _( "Save changes to '%s' before closing?" );
989
990 if( !HandleUnsavedChanges( this, wxString::Format( msg, footprintName ),
991 [&]() -> bool
992 {
993 return SaveFootprint( GetBoard()->GetFirstFootprint() );
994 } ) )
995 {
996 aEvent.Veto();
997 return false;
998 }
999 }
1000
1001 PAD_TOOL* padTool = m_toolManager->GetTool<PAD_TOOL>();
1002
1003 if( padTool->InPadEditMode() )
1004 padTool->ExitPadEditMode();
1005
1006 // Save footprint tree column widths
1007 m_adapter->SaveSettings();
1008
1009 return PCB_BASE_EDIT_FRAME::canCloseWindow( aEvent );
1010}
1011
1012
1014{
1015 // No more vetos
1016 GetCanvas()->SetEventDispatcher( nullptr );
1018
1019#ifdef KICAD_IPC_API
1020 Pgm().GetApiServer().DeregisterHandler( m_apiHandler.get() );
1021#endif
1022
1023 if( GetLibTree() )
1025
1026 // Do not show the layer manager during closing to avoid flicker
1027 // on some platforms (Windows) that generate useless redraw of items in
1028 // the Layer Manager
1029 m_auimgr.GetPane( wxT( "LayersManager" ) ).Show( false );
1030 m_auimgr.GetPane( wxT( "SelectionFilter" ) ).Show( false );
1031
1032 Clear_Pcb( false );
1033}
1034
1035
1036void FOOTPRINT_EDIT_FRAME::OnExitKiCad( wxCommandEvent& event )
1037{
1038 Kiway().OnKiCadExit();
1039}
1040
1041
1043{
1044 Close();
1045}
1046
1047
1049{
1050 // call my base class
1052
1053 // We have 2 panes to update.
1054 // For some obscure reason, the AUI manager hides the first modified pane.
1055 // So force show panes
1056 wxAuiPaneInfo& tree_pane_info = m_auimgr.GetPane( m_treePane );
1057 bool tree_shown = tree_pane_info.IsShown();
1058 tree_pane_info.Caption( _( "Libraries" ) );
1059
1060 wxAuiPaneInfo& lm_pane_info = m_auimgr.GetPane( m_appearancePanel );
1061 bool lm_shown = lm_pane_info.IsShown();
1062 lm_pane_info.Caption( _( "Appearance" ) );
1063 wxAuiPaneInfo& sf_pane_info = m_auimgr.GetPane( m_selectionFilterPanel );
1064 sf_pane_info.Caption( _( "Selection Filter" ) );
1065
1066 // update the layer manager
1068
1069 // Now restore the visibility:
1070 lm_pane_info.Show( lm_shown );
1071 tree_pane_info.Show( tree_shown );
1072 m_auimgr.Update();
1073
1075
1076 UpdateTitle();
1077}
1078
1079
1081{
1083
1084 if( m_isClosing )
1085 return;
1086
1087 Update3DView( true, true );
1089
1090 if( !GetTitle().StartsWith( wxT( "*" ) ) )
1091 UpdateTitle();
1092}
1093
1094
1096{
1097 wxString title;
1098 LIB_ID fpid = GetLoadedFPID();
1099 FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
1100 bool writable = true;
1101
1102 if( IsCurrentFPFromBoard() )
1103 {
1104 if( IsContentModified() )
1105 title = wxT( "*" );
1106
1107 title += footprint->GetReference();
1108 title += wxS( " " ) + wxString::Format( _( "[from %s]" ), Prj().GetProjectName()
1109 + wxT( "." )
1110 + FILEEXT::PcbFileExtension );
1111 }
1112 else if( fpid.IsValid() )
1113 {
1114 try
1115 {
1117 }
1118 catch( const IO_ERROR& )
1119 {
1120 // best efforts...
1121 }
1122
1123 // Note: don't used GetLoadedFPID(); footprint name may have been edited
1124 if( IsContentModified() )
1125 title = wxT( "*" );
1126
1127 title += From_UTF8( footprint->GetFPID().Format().c_str() );
1128
1129 if( !writable )
1130 title += wxS( " " ) + _( "[Read Only]" );
1131 }
1132 else if( !fpid.GetLibItemName().empty() )
1133 {
1134 // Note: don't used GetLoadedFPID(); footprint name may have been edited
1135 if( IsContentModified() )
1136 title = wxT( "*" );
1137
1138 title += From_UTF8( footprint->GetFPID().GetLibItemName().c_str() );
1139 title += wxS( " " ) + _( "[Unsaved]" );
1140 }
1141 else
1142 {
1143 title = _( "[no footprint loaded]" );
1144 }
1145
1146 title += wxT( " \u2014 " ) + _( "Footprint Editor" );
1147
1148 SetTitle( title );
1149}
1150
1151
1153{
1154 m_appearancePanel->OnBoardChanged();
1155}
1156
1157
1159{
1163 m_propertiesPanel->UpdateData();
1164 UpdateTitle();
1165}
1166
1167
1169{
1171
1173 auto adapter = static_cast<FP_TREE_SYNCHRONIZING_ADAPTER*>( m_adapter.get() );
1174
1175 adapter->AddLibraries( this );
1176}
1177
1178
1179void FOOTPRINT_EDIT_FRAME::SyncLibraryTree( [[maybe_unused]] bool aProgress )
1180{
1182 auto adapter = static_cast<FP_TREE_SYNCHRONIZING_ADAPTER*>( m_adapter.get() );
1183 LIB_ID target = GetTargetFPID();
1184 bool targetSelected = ( target == GetLibTree()->GetSelectedLibId() );
1185
1186 // Unselect before syncing to avoid null reference in the adapter
1187 // if a selected item is removed during the sync
1188 GetLibTree()->Unselect();
1189
1190 // Sync the LIB_TREE to the FOOTPRINT_INFO list
1191 adapter->Sync( footprints );
1192
1193 GetLibTree()->Regenerate( true );
1194
1195 if( target.IsValid() )
1196 {
1197 if( adapter->FindItem( target ) )
1198 {
1199 if( targetSelected )
1200 GetLibTree()->SelectLibId( target );
1201 else
1202 GetLibTree()->CenterLibId( target );
1203 }
1204 else
1205 {
1206 // Try to focus on parent
1207 target.SetLibItemName( wxEmptyString );
1208 GetLibTree()->CenterLibId( target );
1209 }
1210 }
1211}
1212
1213
1218
1219
1221{
1222 GetLibTree()->SelectLibId( aLibID );
1223}
1224
1225
1227{
1228 m_appearancePanel->UpdateDisplayOptions();
1229}
1230
1231
1233{
1234 // Create the manager and dispatcher & route draw panel events to the dispatcher
1236 m_toolManager->SetEnvironment( GetBoard(), GetCanvas()->GetView(),
1237 GetCanvas()->GetViewControls(), config(), this );
1238 m_actions = new PCB_ACTIONS();
1240
1242
1243 m_toolManager->RegisterTool( new COMMON_CONTROL );
1244 m_toolManager->RegisterTool( new COMMON_TOOLS );
1245 m_toolManager->RegisterTool( new PCB_SELECTION_TOOL );
1246 m_toolManager->RegisterTool( new ZOOM_TOOL );
1247 m_toolManager->RegisterTool( new EDIT_TOOL );
1248 m_toolManager->RegisterTool( new PCB_EDIT_TABLE_TOOL );
1249 m_toolManager->RegisterTool( new PAD_TOOL );
1250 m_toolManager->RegisterTool( new DRAWING_TOOL );
1251 m_toolManager->RegisterTool( new PCB_POINT_EDITOR );
1252 m_toolManager->RegisterTool( new PCB_CONTROL ); // copy/paste
1253 m_toolManager->RegisterTool( new LIBRARY_EDITOR_CONTROL );
1254 m_toolManager->RegisterTool( new FOOTPRINT_EDITOR_CONTROL );
1255 m_toolManager->RegisterTool( new ALIGN_DISTRIBUTE_TOOL );
1256 m_toolManager->RegisterTool( new PCB_PICKER_TOOL );
1257 m_toolManager->RegisterTool( new POSITION_RELATIVE_TOOL );
1258 m_toolManager->RegisterTool( new ARRAY_TOOL );
1259 m_toolManager->RegisterTool( new PCB_VIEWER_TOOLS );
1260 m_toolManager->RegisterTool( new PCB_GROUP_TOOL );
1261 m_toolManager->RegisterTool( new CONVERT_TOOL );
1262 m_toolManager->RegisterTool( new PROPERTIES_TOOL );
1263 m_toolManager->RegisterTool( new EMBED_TOOL );
1264
1265 for( TOOL_BASE* tool : m_toolManager->Tools() )
1266 {
1267 if( PCB_TOOL_BASE* pcbTool = dynamic_cast<PCB_TOOL_BASE*>( tool ) )
1268 pcbTool->SetIsFootprintEditor( true );
1269 }
1270
1271 m_toolManager->GetTool<PCB_VIEWER_TOOLS>()->SetFootprintFrame( true );
1272 m_toolManager->InitTools();
1273
1274 m_toolManager->InvokeTool( "common.InteractiveSelection" );
1275
1276 // Load or reload wizard plugins in case they changed since the last time the frame opened
1277 // Because the board editor has also a plugin python menu,
1278 // call the PCB_EDIT_FRAME RunAction() if the board editor is running
1279 // Otherwise run the current RunAction().
1280 PCB_EDIT_FRAME* pcbframe = static_cast<PCB_EDIT_FRAME*>( Kiway().Player( FRAME_PCB_EDITOR, false ) );
1281
1282 if( pcbframe )
1284 else
1286}
1287
1288
1290{
1292
1293 ACTION_MANAGER* mgr = m_toolManager->GetActionManager();
1294 PCB_EDITOR_CONDITIONS cond( this );
1295
1296 wxASSERT( mgr );
1297
1298#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
1299#define CHECK( x ) ACTION_CONDITIONS().Check( x )
1300
1301 auto haveFootprintCond =
1302 [this]( const SELECTION& )
1303 {
1304 return GetBoard() && GetBoard()->GetFirstFootprint() != nullptr;
1305 };
1306
1307 auto footprintTargettedCond =
1308 [this]( const SELECTION& )
1309 {
1310 return !GetTargetFPID().GetLibItemName().empty();
1311 };
1312
1313 auto footprintSelectedInTreeCond =
1314 [this]( const SELECTION& )
1315 {
1317 return !sel.GetLibNickname().empty() && !sel.GetLibItemName().empty();
1318 };
1319
1320 const auto footprintFromBoardCond =
1321 [this]( const SELECTION& )
1322 {
1323 return IsCurrentFPFromBoard();
1324 };
1325
1326 auto pcbFrameExistsCond =
1327 [this]( const SELECTION& )
1328 {
1329 PCB_EDIT_FRAME* frame = dynamic_cast<PCB_EDIT_FRAME*>( Kiway().Player( FRAME_PCB_EDITOR, false ) );
1330
1331 return ( frame != nullptr );
1332 };
1333
1334 auto boardFootprintExistsCond =
1335 [this]( const SELECTION& )
1336 {
1337 PCB_EDIT_FRAME* frame = dynamic_cast<PCB_EDIT_FRAME*>( Kiway().Player( FRAME_PCB_EDITOR, false ) );
1338
1339 FOOTPRINT* editorFootprint = GetBoard()->GetFirstFootprint();
1340 bool canInsert = frame && editorFootprint && editorFootprint->GetLink() == niluuid;
1341
1342 // If the source was deleted, the footprint can inserted but not updated in the board.
1343 if( frame && editorFootprint && editorFootprint->GetLink() != niluuid )
1344 {
1345 BOARD* mainpcb = frame->GetBoard();
1346 canInsert = true;
1347
1348 // search if the source footprint was not deleted:
1349 for( FOOTPRINT* candidate : mainpcb->Footprints() )
1350 {
1351 if( editorFootprint->GetLink() == candidate->m_Uuid )
1352 {
1353 canInsert = false;
1354 break;
1355 }
1356 }
1357 }
1358
1359 return canInsert;
1360 };
1361
1362 // clang-format off
1363 mgr->SetConditions( ACTIONS::saveAs, ENABLE( footprintTargettedCond ) );
1366 mgr->SetConditions( PCB_ACTIONS::editLibFpInFpEditor,ENABLE( footprintFromBoardCond ) );
1367
1368 mgr->SetConditions( PCB_ACTIONS::saveFpToBoard, ENABLE( boardFootprintExistsCond ) );
1369 mgr->SetConditions( PCB_ACTIONS::loadFpFromBoard, ENABLE( pcbFrameExistsCond ) );
1370
1373
1376
1377 mgr->SetConditions( ACTIONS::cut, ENABLE( cond.HasItems() ) );
1378 mgr->SetConditions( ACTIONS::copy, ENABLE( cond.HasItems() ) );
1385
1392
1396
1401 // clang-format on
1402
1403 auto highContrastCond =
1404 [this]( const SELECTION& )
1405 {
1407 };
1408
1409 auto boardFlippedCond = [this]( const SELECTION& )
1410 {
1412 };
1413
1414 auto libraryTreeCond =
1415 [this](const SELECTION& )
1416 {
1417 return IsLibraryTreeShown();
1418 };
1419
1420 auto layerManagerCond =
1421 [this]( const SELECTION& )
1422 {
1423 return m_auimgr.GetPane( "LayersManager" ).IsShown();
1424 };
1425
1426 auto propertiesCond =
1427 [this] ( const SELECTION& )
1428 {
1429 return m_auimgr.GetPane( PropertiesPaneName() ).IsShown();
1430 };
1431
1432 mgr->SetConditions( ACTIONS::highContrastMode, CHECK( highContrastCond ) );
1433 mgr->SetConditions( PCB_ACTIONS::flipBoard, CHECK( boardFlippedCond ) );
1435
1436 mgr->SetConditions( ACTIONS::showLibraryTree, CHECK( libraryTreeCond ) );
1437 mgr->SetConditions( PCB_ACTIONS::showLayersManager, CHECK( layerManagerCond ) );
1438 mgr->SetConditions( ACTIONS::showProperties, CHECK( propertiesCond ) );
1439
1440 mgr->SetConditions( ACTIONS::print, ENABLE( haveFootprintCond ) );
1441 mgr->SetConditions( PCB_ACTIONS::exportFootprint, ENABLE( haveFootprintCond ) );
1442 mgr->SetConditions( PCB_ACTIONS::placeImportedGraphics, ENABLE( haveFootprintCond ) );
1443
1444 mgr->SetConditions( PCB_ACTIONS::footprintProperties, ENABLE( footprintSelectedInTreeCond || haveFootprintCond ) );
1445 mgr->SetConditions( PCB_ACTIONS::padTable, ENABLE( haveFootprintCond ) );
1446 mgr->SetConditions( PCB_ACTIONS::editTextAndGraphics, ENABLE( haveFootprintCond ) );
1447 mgr->SetConditions( PCB_ACTIONS::checkFootprint, ENABLE( haveFootprintCond ) );
1448 mgr->SetConditions( PCB_ACTIONS::repairFootprint, ENABLE( haveFootprintCond ) );
1449 mgr->SetConditions( PCB_ACTIONS::cleanupGraphics, ENABLE( haveFootprintCond ) );
1450 mgr->SetConditions( ACTIONS::showDatasheet, ENABLE( haveFootprintCond ) );
1451
1452 const auto isArcKeepCenterMode =
1453 [this]( const SELECTION& )
1454 {
1456 };
1457
1458 const auto isArcKeepEndpointMode =
1459 [this]( const SELECTION& )
1460 {
1462 };
1463
1464 const auto isArcKeepRadiusMode =
1465 [this]( const SELECTION& )
1466 {
1468 };
1469
1470 // clang-format off
1471 mgr->SetConditions( ACTIONS::pointEditorArcKeepCenter, CHECK( isArcKeepCenterMode ) );
1472 mgr->SetConditions( ACTIONS::pointEditorArcKeepEndpoint, CHECK( isArcKeepEndpointMode ) );
1473 mgr->SetConditions( ACTIONS::pointEditorArcKeepRadius, CHECK( isArcKeepRadiusMode ) );
1474 // clang-format on
1475
1476// Only enable a tool if the part is edtable
1477#define CURRENT_EDIT_TOOL( action ) \
1478 mgr->SetConditions( action, ACTION_CONDITIONS().Enable( haveFootprintCond ) \
1479 .Check( cond.CurrentTool( action ) ) )
1480
1507
1508#undef CURRENT_EDIT_TOOL
1509#undef ENABLE
1510#undef CHECK
1511}
1512
1513
1515{
1517
1518 // Be sure the axis are enabled
1519 GetCanvas()->GetGAL()->SetAxesEnabled( true );
1520
1521 UpdateView();
1522
1523 // Ensure the m_Layers settings are using the canvas type:
1525}
1526
1527
1529{
1531 m_appearancePanel->CommonSettingsChanged( aFlags );
1532
1534 {
1535 GetGalDisplayOptions().ReadWindowSettings( cfg->m_Window );
1536
1537 GetBoard()->GetDesignSettings() = cfg->m_DesignSettings;
1539 }
1540
1544
1546
1547 if( aFlags & ENVVARS_CHANGED )
1548 SyncLibraryTree( true );
1549
1550 Layout();
1551 SendSizeEvent();
1552}
1553
1554
1555std::unique_ptr<GRID_HELPER> FOOTPRINT_EDIT_FRAME::MakeGridHelper()
1556{
1557 return std::make_unique<PCB_GRID_HELPER>( m_toolManager, GetMagneticItemsSettings() );
1558}
1559
1560
1562{
1563 LIB_ID id = GetLoadedFPID();
1564
1565 if( id.empty() )
1566 {
1567 DisplayErrorMessage( this, _( "No footprint selected." ) );
1568 return;
1569 }
1570
1571 wxFileName fn( id.GetLibItemName() );
1572 fn.SetExt( wxT( "png" ) );
1573
1574 wxString projectPath = wxPathOnly( Prj().GetProjectFullName() );
1575
1576 wxFileDialog dlg( this, _( "Export View as PNG" ), projectPath, fn.GetFullName(),
1577 FILEEXT::PngFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
1578
1580
1581 if( dlg.ShowModal() == wxID_CANCEL || dlg.GetPath().IsEmpty() )
1582 return;
1583
1584 // calling wxYield is mandatory under Linux, after closing the file selector dialog
1585 // to refresh the screen before creating the PNG or JPEG image from screen
1586 wxYield();
1587 this->SaveCanvasImageToFile( dlg.GetPath(), BITMAP_TYPE::PNG );
1588}
@ KEEP_ENDPOINTS_OR_START_DIRECTION
Whe editing endpoints, the other end remains in place.
@ KEEP_CENTER_ENDS_ADJUST_ANGLE
When editing endpoints, only the angle is adjusted.
@ KEEP_CENTER_ADJUST_ANGLE_RADIUS
When editing endpoints, the angle and radius are adjusted.
constexpr EDA_IU_SCALE pcbIUScale
Definition base_units.h:125
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
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_16
@ FPHOLDER
Definition board.h:315
@ NORMAL
Inactive layers are shown normally (no high-contrast mode)
BOX2< VECTOR2I > BOX2I
Definition box2.h:922
static TOOL_ACTION toggleGrid
Definition actions.h:198
static TOOL_ACTION paste
Definition actions.h:80
static TOOL_ACTION unselectAll
Definition actions.h:83
static TOOL_ACTION revert
Definition actions.h:62
static TOOL_ACTION showLibraryTree
Definition actions.h:164
static TOOL_ACTION saveAs
Definition actions.h:59
static TOOL_ACTION copy
Definition actions.h:78
static TOOL_ACTION pluginsReload
Definition actions.h:294
static TOOL_ACTION selectSetLasso
Definition actions.h:221
static TOOL_ACTION selectSetRect
Set lasso selection mode.
Definition actions.h:220
static TOOL_ACTION group
Definition actions.h:239
static TOOL_ACTION pasteSpecial
Definition actions.h:81
static TOOL_ACTION showDatasheet
Definition actions.h:267
static TOOL_ACTION pointEditorArcKeepCenter
Definition actions.h:273
static TOOL_ACTION ungroup
Definition actions.h:240
static TOOL_ACTION toggleBoundingBoxes
Definition actions.h:157
static TOOL_ACTION pointEditorArcKeepRadius
Definition actions.h:275
static TOOL_ACTION undo
Definition actions.h:75
static TOOL_ACTION duplicate
Definition actions.h:84
static TOOL_ACTION highContrastMode
Definition actions.h:155
static TOOL_ACTION embeddedFiles
Definition actions.h:297
static TOOL_ACTION measureTool
Definition actions.h:252
static TOOL_ACTION doDelete
Definition actions.h:85
static TOOL_ACTION selectionTool
Definition actions.h:251
static TOOL_ACTION save
Definition actions.h:58
static TOOL_ACTION zoomFitScreen
Definition actions.h:142
static TOOL_ACTION redo
Definition actions.h:76
static TOOL_ACTION deleteTool
Definition actions.h:86
static TOOL_ACTION zoomTool
Definition actions.h:146
static TOOL_ACTION print
Definition actions.h:64
static TOOL_ACTION showProperties
Definition actions.h:266
static TOOL_ACTION cut
Definition actions.h:77
static TOOL_ACTION gridSetOrigin
Definition actions.h:195
static TOOL_ACTION ddAddLibrary
Definition actions.h:67
static TOOL_ACTION toggleGridOverrides
Definition actions.h:199
static TOOL_ACTION selectAll
Definition actions.h:82
static TOOL_ACTION pointEditorArcKeepEndpoint
Definition actions.h:274
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...
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
wxString m_ColorTheme
Active color theme name.
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::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:84
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Definition board_item.h:288
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:323
bool SetLayerName(PCB_LAYER_ID aLayer, const wxString &aLayerName)
Changes the name of the layer given by aLayer.
Definition board.cpp:763
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Definition board.h:524
const FOOTPRINTS & Footprints() const
Definition board.h:364
void SetCopperLayerCount(int aCount)
Definition board.cpp:943
void DeleteAllFootprints()
Remove all footprints from the deque and free the memory associated with them.
Definition board.cpp:1774
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition board.cpp:1101
void SetEnabledLayers(const LSET &aLayerMask)
A proxy function that calls the correspondent function in m_BoardSettings.
Definition board.cpp:1006
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.
Tool responsible for drawing graphical elements like lines, arcs, circles, etc.
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.
virtual void UpdateToolbarControlSizes()
Update the sizes of any controls in the toolbars of the frame.
ACTION_TOOLBAR * m_tbRight
TOOLBAR_SETTINGS * m_toolbarSettings
wxAuiManager m_auimgr
virtual void RecreateToolbars()
ACTION_TOOLBAR * m_tbLeft
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.
std::map< const wxString, TOOL_ACTION * > m_acceptedExts
Associate file extensions with action to execute.
ACTION_TOOLBAR * m_tbTopMain
wxString m_aboutTitle
bool m_isClosing
Set by the close window event handler after frames are asked if they can close.
void ReCreateMenuBar()
Recreate the menu bar.
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 setupUnits(APP_SETTINGS_BASE *aCfg)
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
bool SaveCanvasImageToFile(const wxString &aFileName, BITMAP_TYPE aBitmapType)
Save the current view as an image file.
virtual void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Change the current rendering backend.
virtual void OnSelectZoom(wxCommandEvent &event)
Set the zoom factor when selected by the zoom list box in the main tool bar.
GAL_DISPLAY_OPTIONS_IMPL & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
static bool m_openGLFailureOccured
Has any failure occurred when switching to OpenGL in any EDA_DRAW_FRAME?
static const wxString PropertiesPaneName()
EDA_MSG_PANEL * m_messagePanel
void SetCanvas(EDA_DRAW_PANEL_GAL *aPanel)
virtual void SetScreen(BASE_SCREEN *aScreen)
virtual void UpdateMsgPanel()
Redraw the message panel.
EDA_DRAW_PANEL_GAL::GAL_TYPE loadCanvasTypeSetting()
Return the canvas type stored in the application settings.
PROPERTIES_PANEL * m_propertiesPanel
bool m_showBorderAndTitleBlock
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 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.
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
BOARD_ITEM_CONTAINER * GetModel() const override
void ReCreateLayerBox(bool aForceResizeToolbar=true)
Re create the layer Box by clearing the old list, and building a new one from the new layers names an...
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
FOOTPRINT_EDIT_FRAME(KIWAY *aKiway, wxWindow *aParent)
protected so only friend PCB::IFACE::CreateWindow() can act as sole factory.
SELECTION & GetCurrentSelection() override
Get the current selection from the canvas area.
bool CanCloseFPFromBoard(bool doClose)
void SetActiveLayer(PCB_LAYER_ID aLayer) override
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.
An interface to the global shared library manager that is schematic-specific and linked to one projec...
bool IsFootprintLibWritable(const wxString &aNickname)
Return true if the library given by aNickname is writable.
Footprint Editor pane with footprint library tree.
bool FixUuids()
Old footprints do not always have a valid UUID (some can be set to null uuid) However null UUIDs,...
ZONES & Zones()
Definition footprint.h:383
EDA_ITEM * Clone() const override
Invoke a function on all children.
std::deque< PAD * > & Pads()
Definition footprint.h:377
const LIB_ID & GetFPID() const
Definition footprint.h:429
const LSET & GetStackupLayers() const
Definition footprint.h:493
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.
KIID GetLink() const
Definition footprint.h:1163
const wxString & GetReference() const
Definition footprint.h:829
FOOTPRINT_STACKUP GetStackupMode() const
Definition footprint.h:486
DRAWINGS & GraphicalItems()
Definition footprint.h:380
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
void AddLibraries(EDA_BASE_FRAME *aParent)
static wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > Create(FOOTPRINT_EDIT_FRAME *aFrame, FOOTPRINT_LIBRARY_ADAPTER *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.
bool m_axesEnabled
Crosshair drawing mode.
void SetAxesEnabled(bool aAxesEnabled)
Enable drawing the axes.
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition pcb_view.cpp:91
void UpdateAllLayersColor()
Apply the new coloring scheme to all layers.
Definition view.cpp:848
void SetLayerVisible(int aLayer, bool aVisible=true)
Control the visibility of a particular layer.
Definition view.h:409
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition view.h:661
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:315
void OnKiCadExit()
Definition kiway.cpp:800
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition kiway.cpp:402
Module editor specific tools.
A logical library item identifier and consists of various portions much like a URI.
Definition lib_id.h:49
int SetLibItemName(const UTF8 &aLibItemName)
Override the library item name portion of the LIB_ID to aLibItemName.
Definition lib_id.cpp:111
bool IsValid() const
Check if this LID_ID is valid.
Definition lib_id.h:172
int SetLibNickname(const UTF8 &aLibNickname)
Override the logical library name portion of the LIB_ID to aLibNickname.
Definition lib_id.cpp:100
UTF8 Format() const
Definition lib_id.cpp:119
const wxString GetUniStringLibItemName() const
Get strings for display messages in dialogs.
Definition lib_id.h:112
const UTF8 & GetLibItemName() const
Definition lib_id.h:102
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition lib_id.h:87
void RefreshLibTree()
Refresh the tree (mainly to update highlighting and asterisking)
Definition lib_tree.cpp:472
void CenterLibId(const LIB_ID &aLibId)
Ensure that an item is visible (preferably centered).
Definition lib_tree.cpp:381
void ShutdownPreviews()
Definition lib_tree.cpp:287
void ShowChangedLanguage()
Definition lib_tree.cpp:304
void SelectLibId(const LIB_ID &aLibId)
Select an item in the tree widget.
Definition lib_tree.cpp:375
LIB_TREE_MODEL_ADAPTER::SORT_MODE GetSortMode() const
Definition lib_tree.h:156
void Unselect()
Unselect currently selected item in wxDataViewCtrl.
Definition lib_tree.cpp:387
LIB_ID GetSelectedLibId(int *aUnit=nullptr) const
For multi-unit symbols, if the user selects the symbol itself rather than picking an individual unit,...
Definition lib_tree.cpp:314
void Regenerate(bool aKeepState)
Regenerate the tree.
Definition lib_tree.cpp:454
void SetSortMode(LIB_TREE_MODEL_ADAPTER::SORT_MODE aMode)
Save/restore the sorting mode.
Definition lib_tree.h:155
LSET is a set of PCB_LAYER_IDs.
Definition lset.h:37
static const LSET & AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
Definition lset.cpp:608
static const LSET & UserMask()
Definition lset.cpp:690
static int NameToLayer(wxString &aName)
Return the layer number from a layer name.
Definition lset.cpp:117
static const LSET & AllTechMask()
Return a mask holding all technical layers (no CU layer) on both side.
Definition lset.cpp:676
static LSET UserDefinedLayersMask(int aUserDefinedLayerCount=MAX_USER_DEFINED_LAYERS)
Return a mask with the requested number of user defined layers.
Definition lset.cpp:704
static wxString Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
Definition lset.cpp:188
void ExitPadEditMode()
Definition pad_tool.cpp:804
bool InPadEditMode()
Definition pad_tool.h:63
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition page_info.h:79
Gather all the actions that are shared by tools.
Definition pcb_actions.h:51
static TOOL_ACTION drawRuleArea
static TOOL_ACTION drawBezier
static TOOL_ACTION placeText
static TOOL_ACTION drawOrthogonalDimension
static TOOL_ACTION drawRectangle
static TOOL_ACTION setAnchor
static TOOL_ACTION padDisplayMode
static TOOL_ACTION placeReferenceImage
static TOOL_ACTION showLayersManager
static TOOL_ACTION drawCircle
static TOOL_ACTION mirrorH
Mirroring of selected items.
static TOOL_ACTION exportFootprint
static TOOL_ACTION drawEllipseArc
static TOOL_ACTION drawTable
static TOOL_ACTION drawTextBox
static TOOL_ACTION drawPolygon
static TOOL_ACTION placePad
Activation of the drawing tool (placing a PAD)
static TOOL_ACTION drawRadialDimension
static TOOL_ACTION padTable
static TOOL_ACTION editTextAndGraphics
static TOOL_ACTION drawLeader
static TOOL_ACTION angleSnapModeChanged
Notification event when angle mode changes.
static TOOL_ACTION drawEllipse
static TOOL_ACTION ddImportFootprint
static TOOL_ACTION placeImportedGraphics
static TOOL_ACTION drawArc
static TOOL_ACTION graphicsOutlines
Display footprint graphics as outlines.
static TOOL_ACTION loadFpFromBoard
static TOOL_ACTION drawCenterDimension
static TOOL_ACTION footprintProperties
static TOOL_ACTION flipBoard
static TOOL_ACTION textOutlines
Display texts as lines.
static TOOL_ACTION checkFootprint
static TOOL_ACTION placeBarcode
static TOOL_ACTION placePoint
static TOOL_ACTION editLibFpInFpEditor
static TOOL_ACTION mirrorV
static TOOL_ACTION repairFootprint
static TOOL_ACTION saveFpToBoard
static TOOL_ACTION drawLine
static TOOL_ACTION cleanupGraphics
static TOOL_ACTION rotateCw
Rotation of selected objects.
static TOOL_ACTION rotateCcw
static TOOL_ACTION drawAlignedDimension
virtual void SetBoard(BOARD *aBoard, PROGRESS_REPORTER *aReporter=nullptr) override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
void configureToolbars() override
PCB_BASE_EDIT_FRAME(KIWAY *aKiway, wxWindow *aParent, FRAME_T aFrameType, const wxString &aTitle, const wxPoint &aPos, const wxSize &aSize, long aStyle, const wxString &aFrameName)
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.
const PAGE_INFO & GetPageSettings() const override
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.
virtual void SetPageSettings(const PAGE_INFO &aPageSettings) override
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
bool m_FlipBoardView
true if the board is flipped to show the mirrored view
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:130
The interactive edit tool.
static FOOTPRINT_LIBRARY_ADAPTER * FootprintLibAdapter(PROJECT *aProject)
@ PCB_FOOTPRINT_EDITOR_FP_NAME
Definition project.h:231
@ PCB_FOOTPRINT_EDITOR_LIB_NICKNAME
Definition project.h:232
virtual void SetRString(RSTRING_T aStringId, const wxString &aString)
Store a "retained string", which is any session and project specific string identified in enum RSTRIN...
Definition project.cpp:359
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:370
Action handler for the Properties panel.
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 SELECTION_CONDITION MoreThan(int aNumber)
Create a functor that tests if the number of selected items is greater than the value given as parame...
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.
TOOL_MANAGER * m_toolManager
TOOL_DISPATCHER * m_toolDispatcher
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
ACTIONS * m_actions
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:
bool RunAction(const std::string &aActionName, T aParam)
Run the specified action immediately, pausing the current action to run the new one.
bool empty() const
Definition utf8.h:109
const char * c_str() const
Definition utf8.h:108
A modified version of the wxInfoBar class that allows us to:
Definition wx_infobar.h:77
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.
bool HasCloseButton() const
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
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:150
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition confirm.cpp:221
This file is part of the common library.
#define CHECK(x)
#define ENABLE(x)
static bool empty(const wxTextEntryBase *aCtrl)
#define _(s)
static constexpr EDA_ANGLE ANGLE_90
Definition eda_angle.h:413
#define KICAD_DEFAULT_DRAWFRAME_STYLE
#define FOOTPRINT_EDIT_FRAME_NAME
@ RECURSE
Definition eda_item.h:53
FOOTPRINT_STACKUP
Definition footprint.h:145
@ EXPAND_INNER_LAYERS
The 'normal' stackup handling, where there is a single inner layer (In1) and rule areas using it expa...
Definition footprint.h:150
@ CUSTOM_LAYERS
Stackup handling where the footprint can have any number of copper layers, and objects on those layer...
Definition footprint.h:155
#define CURRENT_EDIT_TOOL(action)
@ FRAME_PCB_EDITOR
Definition frame_type.h:42
@ FRAME_FOOTPRINT_EDITOR
Definition frame_type.h:43
a few functions useful in geometry calculations.
static const std::string KiCadFootprintLibPathExtension
static const std::string KiCadFootprintFileExtension
static wxString PngFileWildcard()
@ ID_ON_GRID_SELECT
Definition id.h:116
@ ID_ON_ZOOM_SELECT
Definition id.h:115
PROJECT & Prj()
Definition kicad.cpp:669
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:761
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:60
@ B_Cu
Definition layer_ids.h:65
@ F_SilkS
Definition layer_ids.h:100
@ In1_Cu
Definition layer_ids.h:66
@ F_Cu
Definition layer_ids.h:64
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:102
bool SupportsShutdownBlockReason()
Whether or not the window supports setting a shutdown block reason.
Definition unix/app.cpp:91
void AllowNetworkFileSystems(wxDialog *aDialog)
Configure a file dialog to show network and virtual file systems.
Definition wxgtk/ui.cpp:448
#define _HKI(x)
Definition page_info.cpp:44
@ ID_FPEDIT_SAVE_PNG
Definition pcbnew_id.h:81
PGM_BASE & Pgm()
The global program "get" accessor.
see class PGM_BASE
#define DEFAULT_THEME
T * GetToolbarSettings(const wxString &aFilename)
T * GetAppSettings(const char *aFilename)
KIWAY Kiway(KFCTL_STANDALONE)
wxString UnescapeString(const wxString &aSource)
wxString From_UTF8(const char *cstring)
#define EDIT_TOOL(tool)
#define ENVVARS_CHANGED
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
Definition typeinfo.h:108
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
Definition typeinfo.h:90
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
Definition typeinfo.h:89
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.