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 The 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
58#include <wx/choice.h>
59#include <wx/debug.h>
60#include <cvpcb_id.h>
61#include <project_pcb.h>
62
63BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME )
64 EVT_CLOSE( DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow )
67END_EVENT_TABLE()
68
69
71 PCB_BASE_FRAME( aKiway, aParent, FRAME_CVPCB_DISPLAY, _( "Footprint Viewer" ),
72 wxDefaultPosition, wxDefaultSize,
74 m_currentComp( nullptr )
75{
76 // Give an icon
77 wxIcon icon;
78 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_cvpcb ) );
79 SetIcon( icon );
80
81 SetBoard( new BOARD() );
82
83 // This board will only be used to hold a footprint for viewing
85
86 SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
87
88 // Create GAL canvas before loading settings
89 auto* gal_drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_frameSize,
90 GetGalDisplayOptions(),
92 SetCanvas( gal_drawPanel );
93
94 // Don't show the default board solder mask expansion. Only the footprint or pad expansion
95 // settings should be shown.
97
98 LoadSettings( config() );
99
100 // Create the manager and dispatcher & route draw panel events to the dispatcher
101 m_toolManager = new TOOL_MANAGER;
102 m_toolManager->SetEnvironment( GetBoard(), gal_drawPanel->GetView(),
103 gal_drawPanel->GetViewControls(), config(), this );
104 m_actions = new CVPCB_ACTIONS();
105 m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
106 gal_drawPanel->SetEventDispatcher( m_toolDispatcher );
107
108 m_toolManager->RegisterTool( new COMMON_TOOLS );
109 m_toolManager->RegisterTool( new ZOOM_TOOL );
110 m_toolManager->RegisterTool( new CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL );
111 m_toolManager->RegisterTool( new PCB_VIEWER_TOOLS );
112
113 m_toolManager->GetTool<PCB_VIEWER_TOOLS>()->SetFootprintFrame( true );
114
115 m_toolManager->InitTools();
116
117 setupUIConditions();
118
119 m_toolbarSettings = GetToolbarSettings<DISPLAY_FOOTPRINTS_TOOLBAR_SETTINGS>( "display_footprints-toolbars" );
120 configureToolbars();
121 RecreateToolbars();
122
123 // Run the control tool, it is supposed to be always active
124 m_toolManager->InvokeTool( "common.InteractiveSelection" );
125
126 m_auimgr.SetManagedWindow( this );
127
128 CreateInfoBar();
129 m_auimgr.AddPane( m_tbTopMain, EDA_PANE().HToolbar().Name( wxS( "TopMainToolbar" ) )
130 .Top().Layer( 6 ) );
131 m_auimgr.AddPane( m_tbLeft, EDA_PANE().VToolbar().Name( wxS( "LeftToolbar" ) )
132 .Left().Layer( 3 ) );
133 m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( wxS( "DrawFrame" ) )
134 .Center() );
135 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( wxS( "MsgPanel" ) )
136 .Bottom().Layer( 6 ) );
137
138 FinishAUIInitialization();
139
140 auto& galOpts = GetGalDisplayOptions();
141 galOpts.m_axesEnabled = true;
142
143 ActivateGalCanvas();
144
145 setupUnits( config() );
146
147 // Restore last zoom. (If auto-zooming we'll adjust when we load the footprint.)
148 CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( config() );
149
150 if( cfg )
151 GetCanvas()->GetView()->SetScale( cfg->m_FootprintViewerZoom );
152
153 updateView();
154
155 Show( true );
156
157 // Register a call to update the toolbar sizes. It can't be done immediately because
158 // it seems to require some sizes calculated that aren't yet (at least on GTK).
159 CallAfter( [this]()
160 {
161 // Ensure the controls on the toolbars all are correctly sized
162 UpdateToolbarControlSizes();
163 } );
164}
165
166
168{
169 // Shutdown all running tools
170 if( m_toolManager )
172
175 GetCanvas()->GetView()->Clear();
176 // Be sure any event cannot be fired after frame deletion:
177 GetCanvas()->SetEvtHandlerEnabled( false );
178
179 delete GetScreen();
180 SetScreen( nullptr ); // Be sure there is no double deletion
181 setFPWatcher( nullptr );
182}
183
184
186{
188
190 PCB_EDITOR_CONDITIONS cond( this );
191
192 wxASSERT( mgr );
193
194#define CHECK( x ) ACTION_CONDITIONS().Check( x )
198
201
202 mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MM ) ) );
203 mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCH ) ) );
204 mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
205
211#undef CHECK
212}
213
214
216{
217 // We don't allow people to change this right now, so make sure it's on
219
220 if( CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( aCfg ) )
221 {
223 SetDisplayOptions( cfg->m_FootprintViewerDisplayOptions );
224 }
225}
226
227
229{
231
232 if( CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( aCfg ) )
233 {
234 cfg->m_FootprintViewerDisplayOptions = GetDisplayOptions();
235 cfg->m_FootprintViewerZoom = GetCanvas()->GetView()->GetScale();
236 }
237}
238
239
241{
242 if( CVPCB_SETTINGS* cfg = GetAppSettings<CVPCB_SETTINGS>( "cvpcb" ) )
243 return &cfg->m_FootprintViewer;
244
245 wxFAIL_MSG( wxT( "DISPLAY_FOOTPRINTS_FRAME not running with CVPCB_SETTINGS" ) );
246 return &aCfg->m_Window; // non-null fail-safe
247}
248
249
251{
252 return GetAppSettings<CVPCB_SETTINGS>( "cvpcb" );
253}
254
255
257{
258 static MAGNETIC_SETTINGS fallback;
259
260 if( CVPCB_SETTINGS* cfg = GetAppSettings<CVPCB_SETTINGS>( "cvpcb" ) )
261 return &cfg->m_FootprintViewerMagneticSettings;
262
263 wxFAIL_MSG( wxT( "DISPLAY_FOOTPRINTS_FRAME not running with CVPCB_SETTINGS" ) );
264 return &fallback;
265}
266
267
269{
270 return COLOR4D( DARKGRAY );
271}
272
273
274FOOTPRINT* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintName, REPORTER& aReporter )
275{
276 FOOTPRINT* footprint = nullptr;
277 LIB_ID fpid;
278
279 if( fpid.Parse( aFootprintName ) >= 0 )
280 {
281 aReporter.Report( wxString::Format( _( "Footprint ID '%s' is not valid." ), aFootprintName ),
283 return nullptr;
284 }
285
286 wxString libNickname = From_UTF8( fpid.GetLibNickname().c_str() );
287 wxString fpName = From_UTF8( fpid.GetLibItemName().c_str() );
288
290 wxASSERT( fpTable );
291
292 // See if the library requested is in the library table
293 if( !fpTable->HasLibrary( libNickname ) )
294 {
295 aReporter.Report( wxString::Format( _( "Library '%s' is not in the footprint library table." ),
296 libNickname ),
298 return nullptr;
299 }
300
301 // See if the footprint requested is in the library
302 if( !fpTable->FootprintExists( libNickname, fpName ) )
303 {
304 aReporter.Report( wxString::Format( _( "Footprint '%s' not found." ), aFootprintName ),
306 return nullptr;
307 }
308
309 try
310 {
311 if( const FOOTPRINT* fp = fpTable->GetEnumeratedFootprint( libNickname, fpName ) )
312 footprint = static_cast<FOOTPRINT*>( fp->Duplicate( IGNORE_PARENT_GROUP ) );
313 }
314 catch( const IO_ERROR& ioe )
315 {
316 DisplayErrorMessage( this, _( "Error loading footprint" ), ioe.What() );
317 return nullptr;
318 }
319
320 if( footprint )
321 {
322 footprint->SetFPID( fpid );
323 footprint->SetParent( (EDA_ITEM*) GetBoard() );
324 footprint->SetPosition( VECTOR2I( 0, 0 ) );
325 return footprint;
326 }
327
328 aReporter.Report( wxString::Format( _( "Footprint '%s' not found." ), aFootprintName ),
330 return nullptr;
331}
332
333
335{
336 if( !aFootprint || !m_currentComp )
337 return;
338
340 GetCanvas()->GetView()->Clear();
341
342 for( PAD* pad : aFootprint->Pads() )
343 {
344 const COMPONENT_NET& net = m_currentComp->GetNet( pad->GetNumber() );
345
346 if( !net.GetPinFunction().IsEmpty() )
347 pad->SetPinFunction( net.GetPinFunction() );
348 }
349
351
352 GetBoard()->Add( aFootprint );
353 updateView();
354 GetCanvas()->Refresh();
355}
356
357
359{
360 CVPCB_MAINFRAME* parentframe = (CVPCB_MAINFRAME *) GetParent();
361 COMPONENT* comp = parentframe->GetSelectedComponent();
362 FOOTPRINT* footprint = nullptr;
363 const FOOTPRINT_INFO* fpInfo = nullptr;
364
365 wxString footprintName = parentframe->GetSelectedFootprint();
366
367 if( footprintName.IsEmpty() && comp )
368 footprintName = comp->GetFPID().Format().wx_str();
369
370 if( m_currentFootprint == footprintName && m_currentComp == comp )
371 return;
372
374 GetCanvas()->GetView()->Clear();
375
376 INFOBAR_REPORTER infoReporter( m_infoBar );
378
379 if( !footprintName.IsEmpty() )
380 {
381 SetTitle( wxString::Format( _( "Footprint: %s" ), footprintName ) );
382
383 footprint = GetFootprint( footprintName, infoReporter );
384
385 fpInfo = parentframe->m_FootprintsList->GetFootprintInfo( footprintName );
386 }
387
388 if( footprint )
389 {
390 if( comp )
391 {
392 for( PAD* pad : footprint->Pads() )
393 {
394 const COMPONENT_NET& net = comp->GetNet( pad->GetNumber() );
395
396 if( !net.GetPinFunction().IsEmpty() )
397 pad->SetPinFunction( net.GetPinFunction() );
398 }
399 }
400
401 GetBoard()->Add( footprint );
402 GetCanvas()->GetView()->Update( footprint );
403 m_currentFootprint = footprintName;
404 m_currentComp = comp;
405 setFPWatcher( footprint );
406 }
407
408 if( fpInfo )
409 SetStatusText( wxString::Format( _( "Lib: %s" ), fpInfo->GetLibNickname() ), 0 );
410 else
411 SetStatusText( wxEmptyString, 0 );
412
413 infoReporter.Finalize();
414
415 updateView();
416
418
419 GetCanvas()->Refresh();
420 Update3DView( true, true );
421}
422
423
425{
426 PCB_DRAW_PANEL_GAL* dp = static_cast<PCB_DRAW_PANEL_GAL*>( GetCanvas() );
427 dp->UpdateColors();
428 dp->DisplayBoard( GetBoard() );
429
431
432 CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( config() );
433 wxCHECK( cfg, /* void */ );
434
437 else
439
441}
442
443
445{
446 FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
447 std::vector<MSG_PANEL_ITEM> items;
448
449 if( footprint )
450 footprint->GetMsgPanelInfo( this, items );
451
452 SetMsgPanel( items );
453}
454
455
457{
458 FOOTPRINT_EDITOR_SETTINGS* cfg = GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>( "fpedit" );
459 return ::GetColorSettings( cfg ? cfg->m_ColorTheme : DEFAULT_THEME );
460}
461
462
464{
465 return GetBoard()->GetFirstFootprint();
466}
467
468
470{
472}
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
static TOOL_ACTION toggleGrid
Definition: actions.h:195
static TOOL_ACTION millimetersUnits
Definition: actions.h:203
static TOOL_ACTION milsUnits
Definition: actions.h:202
static TOOL_ACTION centerContents
Definition: actions.h:148
static TOOL_ACTION inchesUnits
Definition: actions.h:201
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:151
static TOOL_ACTION measureTool
Definition: actions.h:245
static TOOL_ACTION selectionTool
Definition: actions.h:244
static TOOL_ACTION zoomFitScreen
Definition: actions.h:141
static TOOL_ACTION zoomTool
Definition: actions.h:145
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.
Definition: app_settings.h:108
WINDOW_SETTINGS m_Window
Definition: app_settings.h:234
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:237
Abstract interface for BOARD_ITEMs capable of storing other items inside.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:317
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: board.cpp:1138
void SetBoardUse(BOARD_USE aUse)
Set what the board is going to be used for.
Definition: board.h:329
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Definition: board.h:487
void DeleteAllFootprints()
Remove all footprints from the deque and free the memory associated with them.
Definition: board.cpp:1554
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:1023
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:100
const COMPONENT_NET & GetNet(unsigned aIndex) const
Definition: pcb_netlist.h:128
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:161
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.
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.
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 ...).
BOARD_ITEM_CONTAINER * GetModel() const override
MAGNETIC_SETTINGS * GetMagneticItemsSettings() override
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 APP_SETTINGS_BASE * config() const
Return the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
WX_INFOBAR * m_infoBar
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.
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)
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:97
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:112
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:2465
void SetFPID(const LIB_ID &aFPID)
Definition: footprint.h:252
std::deque< PAD * > & Pads()
Definition: footprint.h:209
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:1680
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:327
void Finalize()
Update the infobar with the reported text.
Definition: wx_infobar.cpp:504
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:272
void Clear()
Remove all items from the view.
Definition: view.cpp:1133
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:286
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:52
UTF8 Format() const
Definition: lib_id.cpp:119
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:319
static TOOL_ACTION rehatchShapes
Definition: pcb_actions.h:376
static TOOL_ACTION graphicsOutlines
Display footprint graphics as outlines.
Definition: pcb_actions.h:512
static TOOL_ACTION fpAutoZoom
Definition: pcb_actions.h:327
static TOOL_ACTION textOutlines
Display texts as lines.
Definition: pcb_actions.h:515
static TOOL_ACTION showPadNumbers
Definition: pcb_actions.h:326
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)
Create 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)
Update the current display options.
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 FootprintViewerAutoZoom()
Create a functor that tests if the footprint viewer should auto zoom on new footprints.
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.
bool m_FootprintViewerAutoZoomOnSelect
true to use automatic zoom on fp selection
double m_FootprintViewerZoom
The last zoom level used (0 for auto)
Tool useful for viewing footprints.
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:73
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Report a string with a given severity.
Definition: reporter.h:102
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:171
@ 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:306
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:192
@ 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:194
This file is part of the common library.
#define CHECK(x)
#define FOOTPRINTVIEWER_FRAME_NAME
#define _(s)
#define KICAD_DEFAULT_DRAWFRAME_STYLE
#define IGNORE_PARENT_GROUP
Definition: eda_item.h:54
@ FRAME_CVPCB_DISPLAY
Definition: frame_type.h:53
@ ID_ON_GRID_SELECT
Definition: id.h:114
@ ID_ON_ZOOM_SELECT
Definition: id.h:112
PROJECT & Prj()
Definition: kicad.cpp:601
This file contains miscellaneous commonly used macros and functions.
Message panel definition file.
BOARD * GetBoard()
see class PGM_BASE
@ RPT_SEVERITY_ERROR
#define DEFAULT_THEME
wxString From_UTF8(const char *cstring)
bool always_show_cursor
Definition: app_settings.h:44
Store the common settings that are saved and loaded for each window / frame.
Definition: app_settings.h:90
CURSOR_SETTINGS cursor
Definition: app_settings.h:96
VECTOR2< int32_t > VECTOR2I
Definition: vector2d.h:695