KiCad PCB EDA Suite
Loading...
Searching...
No Matches
display_footprints_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) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2015 Wayne Stambaugh <[email protected]>
6 * Copyright (C) 2007-2023 KiCad Developers, see AUTHORS.txt for contributors.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, you may find one here:
20 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21 * or you may search the http://www.gnu.org website for the version 2 license,
22 * or you may write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 */
25
26#include <bitmaps.h>
27#include <board.h>
28#include <footprint.h>
29#include <pad.h>
30#include <common.h>
31#include <confirm.h>
34#include <fp_lib_table.h>
35#include <id.h>
36#include <kiface_base.h>
37#include <lib_id.h>
38#include <macros.h>
39#include <widgets/msgpanel.h>
40#include <pcb_draw_panel_gal.h>
41#include <pcb_painter.h>
42#include <pgm_base.h>
43#include <reporter.h>
45#include <tool/action_toolbar.h>
46#include <tool/common_tools.h>
48#include <tool/tool_manager.h>
49#include <tool/zoom_tool.h>
50#include <cvpcb_mainframe.h>
52#include <tools/cvpcb_actions.h>
53#include <tools/pcb_actions.h>
54#include <tools/pcb_editor_conditions.h> // Shared conditions with other Pcbnew frames
55#include <tools/pcb_viewer_tools.h> // shared tools with other Pcbnew frames
57#include <wx/choice.h>
58#include <wx/debug.h>
59#include <cvpcb_id.h>
60#include <project_pcb.h>
61
62BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME )
63 EVT_CLOSE( DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow )
66END_EVENT_TABLE()
67
68
70 PCB_BASE_FRAME( aKiway, aParent, FRAME_CVPCB_DISPLAY, _( "Footprint Viewer" ),
71 wxDefaultPosition, wxDefaultSize,
73 m_currentComp( nullptr )
74{
75 // Give an icon
76 wxIcon icon;
77 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_cvpcb ) );
78 SetIcon( icon );
79
80 SetBoard( new BOARD() );
81
82 // This board will only be used to hold a footprint for viewing
84
85 SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
86
87 // Create GAL canvas before loading settings
88 auto* gal_drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_frameSize,
89 GetGalDisplayOptions(),
91 SetCanvas( gal_drawPanel );
92
93 // Don't show the default board solder mask expansion. Only the footprint or pad expansion
94 // settings should be shown.
96
97 LoadSettings( config() );
98
99 // Create the manager and dispatcher & route draw panel events to the dispatcher
100 m_toolManager = new TOOL_MANAGER;
101 m_toolManager->SetEnvironment( GetBoard(), gal_drawPanel->GetView(),
102 gal_drawPanel->GetViewControls(), config(), this );
103 m_actions = new CVPCB_ACTIONS();
104 m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
105 gal_drawPanel->SetEventDispatcher( m_toolDispatcher );
106
107 m_toolManager->RegisterTool( new COMMON_TOOLS );
108 m_toolManager->RegisterTool( new ZOOM_TOOL );
109 m_toolManager->RegisterTool( new CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL );
110 m_toolManager->RegisterTool( new PCB_VIEWER_TOOLS );
111
112 m_toolManager->GetTool<PCB_VIEWER_TOOLS>()->SetFootprintFrame( true );
113
114 m_toolManager->InitTools();
115
116 setupUIConditions();
117
118 // Run the control tool, it is supposed to be always active
119 m_toolManager->InvokeTool( "cvpcb.FootprintViewerInteractiveSelection" );
120
121 ReCreateHToolbar();
122 ReCreateVToolbar();
123 ReCreateOptToolbar();
124
125 m_auimgr.SetManagedWindow( this );
126
127 CreateInfoBar();
128 m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( wxS( "MainToolbar" ) )
129 .Top().Layer( 6 ) );
130 m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( wxS( "OptToolbar" ) )
131 .Left().Layer( 3 ) );
132 m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( wxS( "DrawFrame" ) )
133 .Center() );
134 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( wxS( "MsgPanel" ) )
135 .Bottom().Layer( 6 ) );
136
137 FinishAUIInitialization();
138
139 auto& galOpts = GetGalDisplayOptions();
140 galOpts.m_axesEnabled = true;
141
142 ActivateGalCanvas();
143
144 setupUnits( config() );
145
146 // Restore last zoom. (If auto-zooming we'll adjust when we load the footprint.)
147 CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( config() );
148
149 if( cfg )
150 {
151 GetCanvas()->GetView()->SetScale( cfg->m_FootprintViewerZoom );
152
153 wxAuiToolBarItem* toolOpt = m_mainToolBar->FindTool( ID_CVPCB_FPVIEWER_AUTOZOOM_TOOL );
154
156 toolOpt->SetState( wxAUI_BUTTON_STATE_CHECKED );
157 else
158 toolOpt->SetState( 0 );
159 }
160
161 updateView();
162
163 Show( true );
164
165 // Register a call to update the toolbar sizes. It can't be done immediately because
166 // it seems to require some sizes calculated that aren't yet (at least on GTK).
167 CallAfter( [this]()
168 {
169 // Ensure the controls on the toolbars all are correctly sized
170 UpdateToolbarControlSizes();
171 } );
172}
173
174
176{
177 // Shutdown all running tools
178 if( m_toolManager )
180
183 GetCanvas()->GetView()->Clear();
184 // Be sure any event cannot be fired after frame deletion:
185 GetCanvas()->SetEvtHandlerEnabled( false );
186
187 delete GetScreen();
188 SetScreen( nullptr ); // Be sure there is no double deletion
189 setFPWatcher( nullptr );
190}
191
192
194{
196
198 PCB_EDITOR_CONDITIONS cond( this );
199
200 wxASSERT( mgr );
201
202#define CHECK( x ) ACTION_CONDITIONS().Check( x )
203
210
213
214 mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MILLIMETRES ) ) );
215 mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCHES ) ) );
216 mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
217
222
223#undef CHECK
224}
225
226
228{
229 // Currently, no vertical right toolbar.
230}
231
232
234{
235 if( m_optionsToolBar )
236 {
238 }
239 else
240 {
241 m_optionsToolBar = new ACTION_TOOLBAR( this, ID_OPT_TOOLBAR, wxDefaultPosition,
242 wxDefaultSize,
243 KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
245 }
246
249
257
263
264 m_optionsToolBar->Realize();
265}
266
267
269{
270 // Note:
271 // To rebuild the aui toolbar, the more easy way is to clear ( calling m_mainToolBar.Clear() )
272 // all wxAuiToolBarItems.
273 // However the wxAuiToolBarItems are not the owners of controls managed by
274 // them ( m_zoomSelectBox and m_gridSelectBox ), and therefore do not delete them
275 // So we do not recreate them after clearing the tools.
276
277 if( m_mainToolBar )
278 {
280 }
281 else
282 {
283 m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
284 KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
286 }
287
293
296
298
299 // Grid selection choice box.
300 if( !m_gridSelectBox )
302
304 m_mainToolBar->AddControl( m_gridSelectBox );
305
307
308 // Zoom selection choice box.
309 if( !m_zoomSelectBox )
311
313 m_mainToolBar->AddControl( m_zoomSelectBox );
314
315 // Option to run Zoom automatique on footprint selection changge
316 m_mainToolBar->AddTool( ID_CVPCB_FPVIEWER_AUTOZOOM_TOOL, wxEmptyString,
317 KiScaledBitmap( BITMAPS::zoom_auto_fit_in_page, this ),
318 _( "Automatic Zoom on footprint change" ),
319 wxITEM_CHECK );
320
322
325
326 // after adding the buttons to the toolbar, must call Realize() to reflect the changes
327 m_mainToolBar->Realize();
328}
329
330
332{
333 if( m_mainToolBar )
334 {
335 // Update the item widths
338 }
339}
340
341
343{
344 CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( aCfg );
345 wxCHECK( cfg, /* void */ );
346
347 // We don't allow people to change this right now, so make sure it's on
349
351
353}
354
355
357{
358 CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( aCfg );
359 wxCHECK( cfg, /* void */ );
360
362
364
366
367 wxAuiToolBarItem* toolOpt = m_mainToolBar->FindTool( ID_CVPCB_FPVIEWER_AUTOZOOM_TOOL );
368 cfg->m_FootprintViewerAutoZoomOnSelect = ( toolOpt->GetState() & wxAUI_BUTTON_STATE_CHECKED );
369}
370
371
373{
375 return &cfg->m_FootprintViewer;
376}
377
378
380{
382}
383
384
386{
389}
390
391
393{
394 return COLOR4D( DARKGRAY );
395}
396
397
398FOOTPRINT* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintName,
399 REPORTER& aReporter )
400{
401 FOOTPRINT* footprint = nullptr;
402 LIB_ID fpid;
403
404 if( fpid.Parse( aFootprintName ) >= 0 )
405 {
406 aReporter.Report( wxString::Format( _( "Footprint ID '%s' is not valid." ),
407 aFootprintName ),
409 return nullptr;
410 }
411
412 wxString libNickname = From_UTF8( fpid.GetLibNickname().c_str() );
413 wxString fpName = From_UTF8( fpid.GetLibItemName().c_str() );
414
416 wxASSERT( fpTable );
417
418 // See if the library requested is in the library table
419 if( !fpTable->HasLibrary( libNickname ) )
420 {
421 aReporter.Report( wxString::Format( _( "Library '%s' is not in the footprint library table." ),
422 libNickname ),
424 return nullptr;
425 }
426
427 // See if the footprint requested is in the library
428 if( !fpTable->FootprintExists( libNickname, fpName ) )
429 {
430 aReporter.Report( wxString::Format( _( "Footprint '%s' not found." ), aFootprintName ),
432 return nullptr;
433 }
434
435 try
436 {
437 const FOOTPRINT* fp = fpTable->GetEnumeratedFootprint( libNickname, fpName );
438
439 if( fp )
440 footprint = static_cast<FOOTPRINT*>( fp->Duplicate() );
441 }
442 catch( const IO_ERROR& ioe )
443 {
444 DisplayErrorMessage( this, _( "Error loading footprint" ), ioe.What() );
445 return nullptr;
446 }
447
448 if( footprint )
449 {
450 footprint->SetFPID( fpid );
451 footprint->SetParent( (EDA_ITEM*) GetBoard() );
452 footprint->SetPosition( VECTOR2I( 0, 0 ) );
453 return footprint;
454 }
455
456 aReporter.Report( wxString::Format( _( "Footprint '%s' not found." ), aFootprintName ),
458 return nullptr;
459}
460
461
463{
464 if( !aFootprint || !m_currentComp )
465 return;
466
468 GetCanvas()->GetView()->Clear();
469
470 for( PAD* pad : aFootprint->Pads() )
471 {
472 const COMPONENT_NET& net = m_currentComp->GetNet( pad->GetNumber() );
473
474 if( !net.GetPinFunction().IsEmpty() )
475 pad->SetPinFunction( net.GetPinFunction() );
476 }
477
478 GetBoard()->Add( aFootprint );
479 updateView();
480 GetCanvas()->Refresh();
481}
482
483
485{
486 CVPCB_MAINFRAME* parentframe = (CVPCB_MAINFRAME *) GetParent();
487 COMPONENT* comp = parentframe->GetSelectedComponent();
488 FOOTPRINT* footprint = nullptr;
489 const FOOTPRINT_INFO* fpInfo = nullptr;
490
491 wxString footprintName = parentframe->GetSelectedFootprint();
492
493 if( footprintName.IsEmpty() && comp )
494 footprintName = comp->GetFPID().Format().wx_str();
495
496 if( m_currentFootprint == footprintName && m_currentComp == comp )
497 return;
498
500 GetCanvas()->GetView()->Clear();
501
502 INFOBAR_REPORTER infoReporter( m_infoBar );
504
505 if( !footprintName.IsEmpty() )
506 {
507 SetTitle( wxString::Format( _( "Footprint: %s" ), footprintName ) );
508
509 footprint = GetFootprint( footprintName, infoReporter );
510
511 fpInfo = parentframe->m_FootprintsList->GetFootprintInfo( footprintName );
512 }
513
514 if( footprint )
515 {
516 if( comp )
517 {
518 for( PAD* pad : footprint->Pads() )
519 {
520 const COMPONENT_NET& net = comp->GetNet( pad->GetNumber() );
521
522 if( !net.GetPinFunction().IsEmpty() )
523 pad->SetPinFunction( net.GetPinFunction() );
524 }
525 }
526
527 GetBoard()->Add( footprint );
528 GetCanvas()->GetView()->Update( footprint );
529 m_currentFootprint = footprintName;
530 m_currentComp = comp;
531 setFPWatcher( footprint );
532 }
533
534 if( fpInfo )
535 SetStatusText( wxString::Format( _( "Lib: %s" ), fpInfo->GetLibNickname() ), 0 );
536 else
537 SetStatusText( wxEmptyString, 0 );
538
539 infoReporter.Finalize();
540
541 updateView();
542
544
545 GetCanvas()->Refresh();
546 Update3DView( true, true );
547}
548
549
551{
552 PCB_DRAW_PANEL_GAL* dp = static_cast<PCB_DRAW_PANEL_GAL*>( GetCanvas() );
553 dp->UpdateColors();
554 dp->DisplayBoard( GetBoard() );
555
557
558 wxAuiToolBarItem* toolOpt = m_mainToolBar->FindTool( ID_CVPCB_FPVIEWER_AUTOZOOM_TOOL );
559
560 if( toolOpt->GetState() & wxAUI_BUTTON_STATE_CHECKED )
562 else
564
566}
567
568
570{
571 FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
572 std::vector<MSG_PANEL_ITEM> items;
573
574 if( footprint )
575 footprint->GetMsgPanelInfo( this, items );
576
577 SetMsgPanel( items );
578}
579
580
582{
584
585 if( cfg )
586 return Pgm().GetSettingsManager().GetColorSettings( cfg->m_ColorTheme );
587 else
589}
590
591
593{
594 return GetBoard()->GetFirstFootprint();
595}
596
597
599{
601}
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
wxBitmap KiScaledBitmap(BITMAPS aBitmap, wxWindow *aWindow, int aHeight, bool aQuantized)
Construct a wxBitmap from a memory record, scaling it if device DPI demands it.
Definition: bitmap.cpp:147
static TOOL_ACTION toggleGrid
Definition: actions.h:187
static TOOL_ACTION zoomRedraw
Definition: actions.h:124
static TOOL_ACTION millimetersUnits
Definition: actions.h:195
static TOOL_ACTION show3DViewer
Definition: actions.h:209
static TOOL_ACTION zoomOutCenter
Definition: actions.h:128
static TOOL_ACTION togglePolarCoords
Definition: actions.h:198
static TOOL_ACTION milsUnits
Definition: actions.h:194
static TOOL_ACTION centerContents
Definition: actions.h:141
static TOOL_ACTION inchesUnits
Definition: actions.h:193
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:144
static TOOL_ACTION measureTool
Definition: actions.h:203
static TOOL_ACTION selectionTool
Definition: actions.h:202
static TOOL_ACTION zoomFitScreen
Definition: actions.h:134
static TOOL_ACTION zoomTool
Definition: actions.h:138
static TOOL_ACTION zoomInCenter
Definition: actions.h:127
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...
Define the structure of a toolbar with buttons that invoke ACTIONs.
static constexpr bool TOGGLE
static constexpr bool CANCEL
void SetAuiManager(wxAuiManager *aManager)
Set the AUI manager that this toolbar belongs to.
void UpdateControlWidth(int aID)
Update the toolbar item width of a control using its best size.
void AddScaledSeparator(wxWindow *aWindow)
Add a separator that introduces space on either side to not squash the tools when scaled.
void ClearToolbar()
Clear the toolbar and remove all associated menus.
void Add(const TOOL_ACTION &aAction, bool aIsToggleEntry=false, bool aIsCancellable=false)
Add a TOOL_ACTION-based button to the toolbar.
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:92
Abstract interface for BOARD_ITEMs capable of storing other items inside.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:290
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: board.cpp:1003
void SetBoardUse(BOARD_USE aUse)
Set what the board is going to be used for.
Definition: board.h:302
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Definition: board.h:448
void DeleteAllFootprints()
Remove all footprints from the deque and free the memory associated with them.
Definition: board.cpp:1399
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:895
Color settings are a bit different than most of the settings objects in that there can be more than o...
Handles action that are shared between different applications.
Definition: common_tools.h:38
Used to store the component pin name to net name (and pin function) associations stored in a netlist.
Definition: pcb_netlist.h:47
const wxString & GetPinFunction() const
Definition: pcb_netlist.h:62
Store all of the related footprint information found in a netlist.
Definition: pcb_netlist.h:88
const COMPONENT_NET & GetNet(unsigned aIndex) const
Definition: pcb_netlist.h:114
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:147
Gather all the actions that are shared by tools.
Definition: cvpcb_actions.h:38
Selection tool for the footprint viewer in cvpcb.
The CvPcb application main window.
wxString GetSelectedFootprint()
FOOTPRINT_LIST * m_FootprintsList
COMPONENT * GetSelectedComponent()
Get the selected component from the component listbox.
MAGNETIC_SETTINGS m_FootprintViewerMagneticSettings
WINDOW_SETTINGS m_FootprintViewer
double m_FootprintViewerZoom
bool m_FootprintViewerAutoZoomOnSelect
PCB_DISPLAY_OPTIONS m_FootprintViewerDisplayOptions
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
void InitDisplay()
Refresh the full display for this frame: Set the title, the status line and redraw the canvas Must be...
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Helper to retrieve the current color settings.
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
WINDOW_SETTINGS * GetWindowSettings(APP_SETTINGS_BASE *aCfg) override
Return a pointer to the window settings for this frame.
void UpdateMsgPanel() override
Redraw the message panel.
SELECTION & GetCurrentSelection() override
Get the current selection from the canvas area.
void updateView()
Update the gal canvas (view, colors ...).
void UpdateToolbarControlSizes() override
Update the sizes of any controls in the toolbars of the frame.
BOARD_ITEM_CONTAINER * GetModel() const override
MAGNETIC_SETTINGS * GetMagneticItemsSettings() override
Redraw the message panel.
PCB_VIEWERS_SETTINGS_BASE * GetViewerSettingsBase() const override
void ReloadFootprint(FOOTPRINT *aFootprint) override
Reload the footprint from the library.
FOOTPRINT * GetFootprint(const wxString &aFootprintName, REPORTER &aReporter)
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
static constexpr int KICAD_AUI_TB_STYLE
< Default style flags used for wxAUI toolbars.
WX_INFOBAR * m_infoBar
wxAuiManager m_auimgr
wxChoice * m_gridSelectBox
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.
ACTION_TOOLBAR * m_optionsToolBar
void UpdateGridSelectBox()
Rebuild the grid combobox to respond to any changes in the GUI (units, user grid changes,...
void UpdateZoomSelectBox()
Rebuild the grid combobox to respond to any changes in the GUI (units, user grid changes,...
virtual void OnSelectZoom(wxCommandEvent &event)
Set the zoom factor when selected by the zoom list box in the main tool bar.
virtual void SetScreen(BASE_SCREEN *aScreen)
ACTION_TOOLBAR * m_mainToolBar
wxChoice * m_zoomSelectBox
static constexpr GAL_TYPE GAL_FALLBACK
void StopDrawing()
Prevent the GAL canvas from further drawing until it is recreated or StartDrawing() is called.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:89
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:104
Specialization of the wxAuiPaneInfo class for KiCad panels.
SELECTION_CONDITION CurrentTool(const TOOL_ACTION &aTool)
Create a functor testing if the specified tool is the current active tool in the frame.
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 FullscreenCursor()
Create a functor testing if the cursor is full screen in a frame.
wxString GetLibNickname() const override
FOOTPRINT_INFO * GetFootprintInfo(const wxString &aFootprintName)
Get info for a footprint by id.
void SetPosition(const VECTOR2I &aPos) override
Definition: footprint.cpp:2388
void SetFPID(const LIB_ID &aFPID)
Definition: footprint.h:249
BOARD_ITEM * Duplicate() const override
Create a copy of this BOARD_ITEM.
Definition: footprint.cpp:2484
std::deque< PAD * > & Pads()
Definition: footprint.h:206
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:1573
const FOOTPRINT * GetEnumeratedFootprint(const wxString &aNickname, const wxString &aFootprintName)
A version of FootprintLoad() for use after FootprintEnumerate() for more efficient cache management.
bool FootprintExists(const wxString &aNickname, const wxString &aFootprintName)
Indicates whether or not the given footprint already exists in the given library.
A wrapper for reporting to a WX_INFOBAR UI element.
Definition: wx_infobar.h:319
void Finalize()
Update the infobar with the reported text.
Definition: wx_infobar.cpp:425
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:77
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
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
double GetScale() const
Definition: view.h:273
void Clear()
Remove all items from the view.
Definition: view.cpp:1127
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:284
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
Definition: lib_id.cpp:51
UTF8 Format() const
Definition: lib_id.cpp:118
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
bool HasLibrary(const wxString &aNickname, bool aCheckEnabled=false) const
Test for the existence of aNickname in the library table.
Definition: pad.h:54
static TOOL_ACTION padDisplayMode
Definition: pcb_actions.h:340
static TOOL_ACTION graphicsOutlines
Display footprint graphics as outlines.
Definition: pcb_actions.h:496
static TOOL_ACTION textOutlines
Display texts as lines.
Definition: pcb_actions.h:499
static TOOL_ACTION showPadNumbers
Definition: pcb_actions.h:347
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
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.
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
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions, bool aRefresh=true)
Updates the current display options from the given options struct.
virtual void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
virtual void UpdateStatusBar() override
Update the status bar information.
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 GraphicsFillDisplay()
Create a functor that tests if the frame fills graphics items.
SELECTION_CONDITION PadNumbersDisplay()
Create a functor that tests if the pad numbers are displayed.
SELECTION_CONDITION TextFillDisplay()
Create a functor that tests if the frame fills text items.
Tool useful for viewing footprints.
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:142
static FP_LIB_TABLE * PcbFootprintLibs(PROJECT *aProject)
Return the table of footprint libraries without Kiway.
Definition: project_pcb.cpp:37
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:72
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
T * GetAppSettings(const wxString &aFilename)
Returns a handle to the a given settings by type If the settings have already been loaded,...
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:167
@ MODEL_RELOAD
Model changes (the sheet for a schematic)
Definition: tool_base.h:80
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
ACTION_MANAGER * GetActionManager() const
Definition: tool_manager.h:302
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Reset all tools (i.e.
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 ShutdownAllTools()
Shutdown all tools with a currently registered event loop in this tool manager by waking them up with...
const char * c_str() const
Definition: utf8.h:103
wxString wx_str() const
Definition: utf8.cpp:45
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Definition: wx_infobar.cpp:190
@ DARKGRAY
Definition: color4d.h:46
The common library.
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.
@ ID_CVPCB_FPVIEWER_AUTOZOOM_TOOL
Definition: cvpcb_id.h:34
#define CHECK(x)
#define FOOTPRINTVIEWER_FRAME_NAME
#define _(s)
#define KICAD_DEFAULT_DRAWFRAME_STYLE
@ FRAME_CVPCB_DISPLAY
Definition: frame_type.h:53
@ ID_ON_GRID_SELECT
Definition: id.h:145
@ ID_OPT_TOOLBAR
Definition: id.h:101
@ ID_ON_ZOOM_SELECT
Definition: id.h:143
@ ID_H_TOOLBAR
Definition: id.h:99
PROJECT & Prj()
Definition: kicad.cpp:597
This file contains miscellaneous commonly used macros and functions.
Message panel definition file.
BOARD * GetBoard()
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1060
see class PGM_BASE
@ RPT_SEVERITY_ERROR
wxString From_UTF8(const char *cstring)
bool always_show_cursor
Definition: app_settings.h:44
Stores the common settings that are saved and loaded for each window / frame.
Definition: app_settings.h:74
CURSOR_SETTINGS cursor
Definition: app_settings.h:80
VECTOR2< int32_t > VECTOR2I
Definition: vector2d.h:691