KiCad PCB EDA Suite
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-2022 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 <widgets/infobar.h>
58#include <wx/choice.h>
59#include <wx/debug.h>
60#include <cvpcb_id.h>
61
62
63BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME )
64 EVT_CLOSE( DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow )
68END_EVENT_TABLE()
69
70
72 PCB_BASE_FRAME( aKiway, aParent, FRAME_CVPCB_DISPLAY, _( "Footprint Viewer" ),
73 wxDefaultPosition, wxDefaultSize,
75 m_currentComp( nullptr )
76{
77 // Give an icon
78 wxIcon icon;
79 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_cvpcb ) );
80 SetIcon( icon );
81
82 SetBoard( new BOARD() );
83
84 // This board will only be used to hold a footprint for viewing
86
87 SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
88
89 // Create GAL canvas before loading settings
90 auto* gal_drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_frameSize,
91 GetGalDisplayOptions(),
93 SetCanvas( gal_drawPanel );
94
95 // Don't show the default board solder mask expansion. Only the footprint or pad expansion
96 // settings should be shown.
98
99 LoadSettings( config() );
100
101 // Create the manager and dispatcher & route draw panel events to the dispatcher
102 m_toolManager = new TOOL_MANAGER;
103 m_toolManager->SetEnvironment( GetBoard(), gal_drawPanel->GetView(),
104 gal_drawPanel->GetViewControls(), config(), this );
105 m_actions = new CVPCB_ACTIONS();
106 m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
107 gal_drawPanel->SetEventDispatcher( m_toolDispatcher );
108
109 m_toolManager->RegisterTool( new COMMON_TOOLS );
110 m_toolManager->RegisterTool( new ZOOM_TOOL );
111 m_toolManager->RegisterTool( new CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL );
112 m_toolManager->RegisterTool( new PCB_VIEWER_TOOLS );
113
114 m_toolManager->GetTool<PCB_VIEWER_TOOLS>()->SetFootprintFrame( true );
115
116 m_toolManager->InitTools();
117
118 setupUIConditions();
119
120 // Run the control tool, it is supposed to be always active
121 m_toolManager->InvokeTool( "cvpcb.FootprintViewerInteractiveSelection" );
122
123 ReCreateHToolbar();
124 ReCreateVToolbar();
125 ReCreateOptToolbar();
126
127 m_auimgr.SetManagedWindow( this );
128
129 CreateInfoBar();
130 m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" )
131 .Top().Layer( 6 ) );
132 m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" )
133 .Left().Layer( 3 ) );
134 m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" )
135 .Center() );
136 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" )
137 .Bottom().Layer( 6 ) );
138
139 FinishAUIInitialization();
140
141 auto& galOpts = GetGalDisplayOptions();
142 galOpts.m_axesEnabled = true;
143
144 ActivateGalCanvas();
145
146 setupUnits( config() );
147
148 // Restore last zoom. (If auto-zooming we'll adjust when we load the footprint.)
149 CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( config() );
150
151 if( cfg )
152 {
153 GetCanvas()->GetView()->SetScale( cfg->m_FootprintViewerZoom );
154
155 wxAuiToolBarItem* toolOpt = m_mainToolBar->FindTool( ID_CVPCB_FPVIEWER_AUTOZOOM_TOOL );
156
158 toolOpt->SetState( wxAUI_BUTTON_STATE_CHECKED );
159 else
160 toolOpt->SetState( 0 );
161 }
162
163 updateView();
164
165 Show( true );
166
167 // Register a call to update the toolbar sizes. It can't be done immediately because
168 // it seems to require some sizes calculated that aren't yet (at least on GTK).
169 CallAfter( [&]()
170 {
171 // Ensure the controls on the toolbars all are correctly sized
172 UpdateToolbarControlSizes();
173 } );
174}
175
176
178{
179 // Shutdown all running tools
180 if( m_toolManager )
182
185 GetCanvas()->GetView()->Clear();
186 // Be sure any event cannot be fired after frame deletion:
187 GetCanvas()->SetEvtHandlerEnabled( false );
188
189 delete GetScreen();
190 SetScreen( nullptr ); // Be sure there is no double deletion
191}
192
193
195{
197
199 PCB_EDITOR_CONDITIONS cond( this );
200
201 wxASSERT( mgr );
202
203#define CHECK( x ) ACTION_CONDITIONS().Check( x )
204
211
214
218
223
224#undef CHECK
225}
226
227
229{
230 Destroy();
231}
232
233
235{
236 // Currently, no vertical right toolbar.
237}
238
239
241{
242 if( m_optionsToolBar )
243 {
245 }
246 else
247 {
248 m_optionsToolBar = new ACTION_TOOLBAR( this, ID_OPT_TOOLBAR, wxDefaultPosition,
249 wxDefaultSize,
250 KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
252 }
253
256
264
270
271 m_optionsToolBar->Realize();
272}
273
274
276{
277 // Note:
278 // To rebuild the aui toolbar, the more easy way is to clear ( calling m_mainToolBar.Clear() )
279 // all wxAuiToolBarItems.
280 // However the wxAuiToolBarItems are not the owners of controls managed by
281 // them ( m_zoomSelectBox and m_gridSelectBox ), and therefore do not delete them
282 // So we do not recreate them after clearing the tools.
283
284 if( m_mainToolBar )
285 {
287 }
288 else
289 {
290 m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
291 KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
293 }
294
300
303
305
306 // Grid selection choice box.
307 if( !m_gridSelectBox )
309
311 m_mainToolBar->AddControl( m_gridSelectBox );
312
314
315 // Zoom selection choice box.
316 if( !m_zoomSelectBox )
318
320 m_mainToolBar->AddControl( m_zoomSelectBox );
321
322 // Option to run Zoom automatique on footprint selection changge
323 m_mainToolBar->AddTool( ID_CVPCB_FPVIEWER_AUTOZOOM_TOOL, wxEmptyString,
325 _( "Automatic Zoom on footprint change" ),
326 wxITEM_CHECK );
327
329
332
333 // after adding the buttons to the toolbar, must call Realize() to reflect the changes
334 m_mainToolBar->Realize();
335}
336
337
339{
340 if( m_mainToolBar )
341 {
342 // Update the item widths
345 }
346}
347
348
350{
351 CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( aCfg );
352 wxCHECK( cfg, /* void */ );
353
354 // We don't allow people to change this right now, so make sure it's on
356
358
360}
361
362
364{
365 CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( aCfg );
366 wxCHECK( cfg, /* void */ );
367
369
371
373
374 wxAuiToolBarItem* toolOpt = m_mainToolBar->FindTool( ID_CVPCB_FPVIEWER_AUTOZOOM_TOOL );
375 cfg->m_FootprintViewerAutoZoomOnSelect = ( toolOpt->GetState() & wxAUI_BUTTON_STATE_CHECKED );
376}
377
378
380{
381 CVPCB_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<CVPCB_SETTINGS>();
382 return &cfg->m_FootprintViewer;
383}
384
385
387{
388 return Pgm().GetSettingsManager().GetAppSettings<CVPCB_SETTINGS>();
389}
390
391
393{
394 CVPCB_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<CVPCB_SETTINGS>();
396}
397
398
400{
401 return COLOR4D( DARKGRAY );
402}
403
404
405FOOTPRINT* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintName,
406 REPORTER& aReporter )
407{
408 FOOTPRINT* footprint = nullptr;
409 LIB_ID fpid;
410
411 if( fpid.Parse( aFootprintName ) >= 0 )
412 {
413 aReporter.Report( wxString::Format( _( "Footprint ID '%s' is not valid." ),
414 aFootprintName ),
416 return nullptr;
417 }
418
419 wxString libNickname = FROM_UTF8( fpid.GetLibNickname().c_str() );
420 wxString fpName = FROM_UTF8( fpid.GetLibItemName().c_str() );
421
422 FP_LIB_TABLE* fpTable = Prj().PcbFootprintLibs();
423 wxASSERT( fpTable );
424
425 // See if the library requested is in the library table
426 if( !fpTable->HasLibrary( libNickname ) )
427 {
428 aReporter.Report( wxString::Format( _( "Library '%s' is not in the footprint library table." ),
429 libNickname ),
431 return nullptr;
432 }
433
434 // See if the footprint requested is in the library
435 if( !fpTable->FootprintExists( libNickname, fpName ) )
436 {
437 aReporter.Report( wxString::Format( _( "Footprint '%s' not found." ), aFootprintName ),
439 return nullptr;
440 }
441
442 try
443 {
444 const FOOTPRINT* fp = fpTable->GetEnumeratedFootprint( libNickname, fpName );
445
446 if( fp )
447 footprint = static_cast<FOOTPRINT*>( fp->Duplicate() );
448 }
449 catch( const IO_ERROR& ioe )
450 {
451 DisplayError( this, ioe.What() );
452 return nullptr;
453 }
454
455 if( footprint )
456 {
457 footprint->SetParent( (EDA_ITEM*) GetBoard() );
458 footprint->SetPosition( wxPoint( 0, 0 ) );
459 return footprint;
460 }
461
462 aReporter.Report( wxString::Format( _( "Footprint '%s' not found." ), aFootprintName ),
464 return nullptr;
465}
466
467
469{
470 CVPCB_MAINFRAME* parentframe = (CVPCB_MAINFRAME *) GetParent();
471 COMPONENT* comp = parentframe->GetSelectedComponent();
472 FOOTPRINT* footprint = nullptr;
473 const FOOTPRINT_INFO* fpInfo = nullptr;
474
475 wxString footprintName = parentframe->GetSelectedFootprint();
476
477 if( footprintName.IsEmpty() && comp )
478 footprintName = comp->GetFPID().Format();
479
480 if( m_currentFootprint == footprintName && m_currentComp == comp )
481 return;
482
485 GetCanvas()->GetView()->Clear();
486
487 INFOBAR_REPORTER infoReporter( m_infoBar );
489
490 if( !footprintName.IsEmpty() )
491 {
492 SetTitle( wxString::Format( _( "Footprint: %s" ), footprintName ) );
493
494 footprint = GetFootprint( footprintName, infoReporter );
495
496 fpInfo = parentframe->m_FootprintsList->GetFootprintInfo( footprintName );
497 }
498
499 if( footprint )
500 {
501 if( comp )
502 {
503 for( PAD* pad : footprint->Pads() )
504 {
505 const COMPONENT_NET& net = comp->GetNet( pad->GetNumber() );
506
507 if( !net.GetPinFunction().IsEmpty() )
508 {
509 NETINFO_ITEM* netinfo = new NETINFO_ITEM( GetBoard() );
510 netinfo->SetNetname( net.GetPinFunction() );
511 GetBoard()->Add( netinfo );
512 pad->SetNet( netinfo );
513 }
514 }
515 }
516
517 GetBoard()->Add( footprint );
518 m_currentFootprint = footprintName;
519 m_currentComp = comp;
520 }
521
522 if( fpInfo )
523 SetStatusText( wxString::Format( _( "Lib: %s" ), fpInfo->GetLibNickname() ), 0 );
524 else
525 SetStatusText( wxEmptyString, 0 );
526
527 infoReporter.Finalize();
528
529 updateView();
530
532
533 GetCanvas()->Refresh();
534 Update3DView( true, true );
535}
536
537
539{
540 PCB_DRAW_PANEL_GAL* dp = static_cast<PCB_DRAW_PANEL_GAL*>( GetCanvas() );
541 dp->UpdateColors();
542 dp->DisplayBoard( GetBoard() );
543
545
546 wxAuiToolBarItem* toolOpt = m_mainToolBar->FindTool( ID_CVPCB_FPVIEWER_AUTOZOOM_TOOL );
547
548 if( toolOpt->GetState() & wxAUI_BUTTON_STATE_CHECKED )
550 else
552
554}
555
556
558{
559 FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
560 std::vector<MSG_PANEL_ITEM> items;
561
562 if( footprint )
563 footprint->GetMsgPanelInfo( this, items );
564
565 SetMsgPanel( items );
566}
567
568
570{
571 auto* settings = Pgm().GetSettingsManager().GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>();
572
573 if( settings )
574 return Pgm().GetSettingsManager().GetColorSettings( settings->m_ColorTheme );
575 else
576 return Pgm().GetSettingsManager().GetColorSettings();
577}
578
579
581{
582 return GetBoard()->GetFirstFootprint();
583}
584
585
587{
589}
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:105
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:148
@ zoom_auto_fit_in_page
static TOOL_ACTION toggleGrid
Definition: actions.h:143
static TOOL_ACTION zoomRedraw
Definition: actions.h:92
static TOOL_ACTION millimetersUnits
Definition: actions.h:149
static TOOL_ACTION show3DViewer
Definition: actions.h:161
static TOOL_ACTION zoomOutCenter
Definition: actions.h:96
static TOOL_ACTION togglePolarCoords
Definition: actions.h:152
static TOOL_ACTION milsUnits
Definition: actions.h:148
static TOOL_ACTION centerContents
Definition: actions.h:102
static TOOL_ACTION inchesUnits
Definition: actions.h:147
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:104
static TOOL_ACTION measureTool
Definition: actions.h:157
static TOOL_ACTION selectionTool
Definition: actions.h:156
static TOOL_ACTION zoomFitScreen
Definition: actions.h:98
static TOOL_ACTION zoomTool
Definition: actions.h:101
static TOOL_ACTION zoomInCenter
Definition: actions.h:95
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:101
Abstract interface for BOARD_ITEMs capable of storing other items inside.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
const NETINFO_LIST & GetNetInfo() const
Definition: board.h:763
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: board.cpp:686
void SetBoardUse(BOARD_USE aUse)
Set what the board is going to be used for.
Definition: board.h:277
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Definition: board.h:397
void DeleteAllFootprints()
Remove all footprints from the deque and free the memory associated with them.
Definition: board.cpp:924
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:618
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:44
const wxString & GetPinFunction() const
Definition: pcb_netlist.h:59
Store all of the related footprint information found in a netlist.
Definition: pcb_netlist.h:85
const COMPONENT_NET & GetNet(unsigned aIndex) const
Definition: pcb_netlist.h:111
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:138
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
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
void OnGridSettings(wxCommandEvent &event)
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
Update the board display after modifying it by a python script (note: it is automatically called by a...
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:100
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:1636
BOARD_ITEM * Duplicate() const override
Create a copy of this BOARD_ITEM.
Definition: footprint.cpp:1819
PADS & Pads()
Definition: footprint.h:174
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:996
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: reporter.h:316
void Finalize()
Update the infobar with the reported text.
Definition: reporter.cpp:227
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:76
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
double GetScale() const
Definition: view.h:269
void Clear()
Remove all items from the view.
Definition: view.cpp:1096
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:267
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:50
UTF8 Format() const
Definition: lib_id.cpp:117
const UTF8 & GetLibItemName() const
Definition: lib_id.h:101
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.
Handle the data for a net.
Definition: netinfo.h:66
void SetNetname(const wxString &aNewName)
Set the long netname to aNetName, and the short netname to the last token in the long netname's path.
Definition: netinfo.h:139
void RemoveUnusedNets()
Definition: pad.h:58
static TOOL_ACTION padDisplayMode
Definition: pcb_actions.h:272
static TOOL_ACTION graphicsOutlines
Display footprint graphics as outlines.
Definition: pcb_actions.h:430
static TOOL_ACTION textOutlines
Display texts as lines.
Definition: pcb_actions.h:433
static TOOL_ACTION showPadNumbers
Definition: pcb_actions.h:279
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.
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 FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
Definition: project.cpp:318
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:71
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:170
@ MODEL_RELOAD
Model changes (required full reload)
Definition: tool_base.h:80
Master controller class:
Definition: tool_manager.h:55
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:142
ACTION_MANAGER * GetActionManager() const
Definition: tool_manager.h:196
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:102
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Definition: infobar.cpp:175
@ DARKGRAY
Definition: color4d.h:46
The common library.
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:280
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
GERBVIEW_FRAME::OnZipFileHistory GERBVIEW_FRAME::OnSelectDisplayMode EVT_CHOICE(ID_GBR_AUX_TOOLBAR_PCB_APERATTRIBUTES_CHOICE, GERBVIEW_FRAME::OnSelectHighlightChoice) EVT_UPDATE_UI(ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER
@ FRAME_CVPCB_DISPLAY
Definition: frame_type.h:49
@ ID_ON_GRID_SELECT
Definition: id.h:145
@ ID_OPT_TOOLBAR
Definition: id.h:102
@ ID_ON_ZOOM_SELECT
Definition: id.h:143
@ ID_H_TOOLBAR
Definition: id.h:100
@ ID_GRID_SETTINGS
Definition: id.h:146
This file contains miscellaneous commonly used macros and functions.
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:110
Message panel definition file.
BOARD * GetBoard()
see class PGM_BASE
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
@ RPT_SEVERITY_ERROR
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111
bool always_show_cursor
Definition: app_settings.h:43
Stores the common settings that are saved and loaded for each window / frame.
Definition: app_settings.h:83
CURSOR_SETTINGS cursor
Definition: app_settings.h:89