KiCad PCB EDA Suite
Loading...
Searching...
No Matches
footprint_wizard_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) 2012-2015 Miguel Angel Ajo Pelayo <[email protected]>
5 * Copyright (C) 2012-2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
6 * Copyright (C) 2008 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
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, you may find one here:
21 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22 * or you may search the http://www.gnu.org website for the version 2 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
27#include <kiface_base.h>
28#include <pcb_draw_panel_gal.h>
29#include <pcb_edit_frame.h>
32#include <widgets/msgpanel.h>
33#include <bitmaps.h>
34#include <grid_tricks.h>
35#include <board.h>
39#include <pcbnew_id.h>
41#include <wx/listbox.h>
42#include <wx/statline.h>
43
44#include <nlohmann/json.hpp>
45#include <wx/tokenzr.h>
46#include <wx/numformatter.h>
47#include <wx/wupdlock.h>
48#include <pgm_base.h>
51#include <tool/tool_manager.h>
53#include <tool/action_toolbar.h>
54#include <tool/common_tools.h>
55#include <tool/common_control.h>
57#include <tools/pcb_control.h>
58#include <tools/pcb_actions.h>
63
64
66
67 // Window events
70
71 // Toolbar events
74
75 // listbox events
78 FOOTPRINT_WIZARD_FRAME::ParametersUpdated )
79END_EVENT_TABLE()
80
81
82// Note: our FOOTPRINT_WIZARD_FRAME is always modal.
83
84FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* aParent,
85 FRAME_T aFrameType ) :
86 PCB_BASE_EDIT_FRAME( aKiway, aParent, aFrameType, _( "Footprint Wizard" ),
87 wxDefaultPosition, wxDefaultSize,
88 aParent ? KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT
89 : KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP,
91 m_wizardListShown( false )
92{
93 wxASSERT( aFrameType == FRAME_FOOTPRINT_WIZARD );
94
95 // This frame is always show modal:
96 SetModal( true );
97
98 // Give an icon
99 wxIcon icon;
100 icon.CopyFromBitmap( KiBitmap( BITMAPS::module_wizard ) );
101 SetIcon( icon );
102
103 m_wizardName.Empty();
104
105 // Create the GAL canvas.
106 // Must be created before calling LoadSettings() that needs a valid GAL canvas
107 PCB_DRAW_PANEL_GAL* gal_drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ),
108 m_frameSize,
109 GetGalDisplayOptions(),
111 SetCanvas( gal_drawPanel );
112
113 SetBoard( new BOARD() );
114
115 // Ensure all layers and items are visible:
117 SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
118 GetScreen()->m_Center = true; // Center coordinate origins on screen.
119
120 LoadSettings( config() );
121
122 SetSize( m_framePos.x, m_framePos.y, m_frameSize.x, m_frameSize.y );
123
124 // Set some display options here, because the FOOTPRINT_WIZARD_FRAME
125 // does not have a config menu to do that:
126
127 // the footprint wizard frame has no config menu. so use some settings
128 // from the caller, or force some options:
129 PCB_BASE_FRAME* caller = dynamic_cast<PCB_BASE_FRAME*>( aParent );
130
131 if( caller )
132 SetUserUnits( caller->GetUserUnits() );
133
134 // In viewer, the default net clearance is not known (it depends on the actual board).
135 // So we do not show the default clearance, by setting it to 0
136 // The footprint or pad specific clearance will be shown
138
139 // Create the manager and dispatcher & route draw panel events to the dispatcher
140 m_toolManager = new TOOL_MANAGER;
141 m_toolManager->SetEnvironment( GetBoard(), gal_drawPanel->GetView(),
142 gal_drawPanel->GetViewControls(), config(), this );
143 m_actions = new PCB_ACTIONS();
144 m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
145 gal_drawPanel->SetEventDispatcher( m_toolDispatcher );
146
147 m_toolManager->RegisterTool( new PCB_CONTROL );
148 m_toolManager->RegisterTool( new PCB_SELECTION_TOOL ); // for std context menus (zoom & grid)
149 m_toolManager->RegisterTool( new SCRIPTING_TOOL );
150 m_toolManager->RegisterTool( new COMMON_TOOLS );
151 m_toolManager->RegisterTool( new COMMON_CONTROL );
152 m_toolManager->RegisterTool( new FOOTPRINT_WIZARD_TOOLS );
153 m_toolManager->InitTools();
154
155 // Run the control tool, it is supposed to be always active
156 m_toolManager->InvokeTool( "common.InteractiveSelection" );
157
158 // Create the toolbars
159 m_toolbarSettings = GetToolbarSettings<FOOTPRINT_WIZARD_TOOLBAR_SETTINGS>( "fpwizard-toolbars" );
160 configureToolbars();
161 RecreateToolbars();
162
163 // Create the parameters panel
164 m_parametersPanel = new wxPanel( this, wxID_ANY );
165
166 m_pageList = new wxListBox( m_parametersPanel, ID_FOOTPRINT_WIZARD_PAGE_LIST,
167 wxDefaultPosition, wxDefaultSize, 0, nullptr,
168 wxLB_HSCROLL | wxNO_BORDER );
169
170 auto divider = new wxStaticLine( m_parametersPanel, wxID_ANY,
171 wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
172
173 m_parameterGrid = new WX_GRID( m_parametersPanel, ID_FOOTPRINT_WIZARD_PARAMETER_LIST );
174 initParameterGrid();
175 m_parameterGrid->PushEventHandler( new GRID_TRICKS( m_parameterGrid ) );
176
177 ReCreatePageList();
178
179 wxBoxSizer* parametersSizer = new wxBoxSizer( wxHORIZONTAL );
180 parametersSizer->Add( m_pageList, 0, wxEXPAND, 5 );
181 parametersSizer->Add( divider, 0, wxEXPAND, 5 );
182 parametersSizer->Add( m_parameterGrid, 1, wxEXPAND, 5 );
183 m_parametersPanel->SetSizer( parametersSizer );
184 m_parametersPanel->Layout();
185
186 // Create the build message box
187 m_buildMessageBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString,
188 wxDefaultPosition, wxDefaultSize,
189 wxTE_MULTILINE | wxTE_READONLY | wxNO_BORDER );
190
191 DisplayWizardInfos();
192
193 m_auimgr.SetManagedWindow( this );
194
195 m_auimgr.AddPane( m_tbTopMain, EDA_PANE().HToolbar().Name( "TopMainToolbar" ).Top().Layer(6) );
196 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6)
197 .BestSize( -1, m_msgFrameHeight ) );
198
199 m_auimgr.AddPane( m_parametersPanel, EDA_PANE().Palette().Name( "Params" ).Left().Position(0)
200 .Caption( _( "Parameters" ) ).MinSize( 360, 180 ) );
201 m_auimgr.AddPane( m_buildMessageBox, EDA_PANE().Palette().Name( "Output" ).Left().Position(1)
202 .CaptionVisible( false ).MinSize( 360, -1 ) );
203
204 m_auimgr.AddPane( GetCanvas(), wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() );
205
206 auto& galOpts = GetGalDisplayOptions();
207 galOpts.SetCursorMode( KIGFX::CROSS_HAIR_MODE::FULLSCREEN_CROSS );
208 galOpts.m_forceDisplayCursor = true;
209 galOpts.m_axesEnabled = true;
210
211 // Switch to the canvas type set in config
212 resolveCanvasType();
213 GetCanvas()->SwitchBackend( m_canvasType );
214 ActivateGalCanvas();
215
216 updateView();
217
218 SetActiveLayer( F_Cu );
219 GetToolManager()->PostAction( ACTIONS::zoomFitScreen );
220
221 // Do not Run a dialog here: on some Window Managers, it creates issues.
222 // Reason: the FOOTPRINT_WIZARD_FRAME is run as modal;
223 // It means the call to FOOTPRINT_WIZARD_FRAME::ShowModal will change the
224 // Event Loop Manager, and stop the one created by the dialog.
225 // It does not happen on all W.M., perhaps due to the way the order events are called
226 // See the call in onActivate instead
227}
228
229
231{
232 // Delete the GRID_TRICKS.
233 m_parameterGrid->PopEventHandler( true );
234
236 // Be sure any event cannot be fired after frame deletion:
237 GetCanvas()->SetEvtHandlerEnabled( false );
238
239 // Be sure a active tool (if exists) is deactivated:
240 if( m_toolManager )
241 m_toolManager->DeactivateTool();
242
243 EDA_3D_VIEWER_FRAME* draw3DFrame = Get3DViewerFrame();
244
245 if( draw3DFrame )
246 draw3DFrame->Destroy();
247
248 // Now this frame can be deleted
249}
250
251
253{
254 SaveSettings( config() );
255
256 if( IsModal() )
257 {
258 // Only dismiss a modal frame once, so that the return values set by
259 // the prior DismissModal() are not bashed for ShowModal().
260 if( !IsDismissed() )
261 DismissModal( false );
262 }
263}
264
265
267{
268 DismissModal( true );
269 Close();
270}
271
272
273void FOOTPRINT_WIZARD_FRAME::OnGridSize( wxSizeEvent& aSizeEvent )
274{
275 // Resize the parameter columns
277
278 aSizeEvent.Skip();
279}
280
281
282void FOOTPRINT_WIZARD_FRAME::OnSize( wxSizeEvent& SizeEv )
283{
284 if( m_auimgr.GetManagedWindow() )
285 m_auimgr.Update();
286
287 SizeEv.Skip();
288}
289
290
292{
294 return ::GetColorSettings( cfg ? cfg->m_ColorTheme : DEFAULT_THEME );
295}
296
297
306
307
309{
310 BOARD_ITEM* footprint = GetBoard()->GetFirstFootprint();
311
312 if( footprint )
313 {
314 std::vector<MSG_PANEL_ITEM> items;
315
316 footprint->GetMsgPanelInfo( this, items );
317 SetMsgPanel( items );
318 }
319 else
320 {
322 }
323}
324
325
327{
329
330 // Prepare the grid where parameters are displayed
331
332 m_parameterGrid->CreateGrid( 0, 3 );
333
334 m_parameterGrid->SetColLabelValue( WIZ_COL_NAME, _( "Parameter" ) );
335 m_parameterGrid->SetColLabelValue( WIZ_COL_VALUE, _( "Value" ) );
336 m_parameterGrid->SetColLabelValue( WIZ_COL_UNITS, _( "Units" ) );
337
338 m_parameterGrid->SetColLabelSize( 22 );
339 m_parameterGrid->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE );
340 m_parameterGrid->AutoSizeColumns();
341
342 m_parameterGrid->AutoSizeRows();
343 m_parameterGrid->SetRowLabelSize( 0 );
344
345 m_parameterGrid->DisableDragGridSize();
346 m_parameterGrid->DisableDragColSize();
347
348 m_parameterGrid->Connect( wxEVT_SIZE,
349 wxSizeEventHandler( FOOTPRINT_WIZARD_FRAME::OnGridSize ),
350 nullptr, this );
351}
352
353
355{
356 if( m_pageList == nullptr )
357 return;
358
359 FOOTPRINT_WIZARD* footprintWizard = GetMyWizard();
360
361 if( !footprintWizard )
362 return;
363
364 m_pageList->Clear();
365 int max_page = footprintWizard->GetNumParameterPages();
366
367 for( int i = 0; i < max_page; i++ )
368 {
369 wxString name = footprintWizard->GetParameterPageName( i );
370 m_pageList->Append( name );
371 }
372
373 m_pageList->SetSelection( 0, true );
374
378 GetCanvas()->Refresh();
379}
380
381
383{
384 if( m_parameterGrid == nullptr )
385 return;
386
387 FOOTPRINT_WIZARD* footprintWizard = GetMyWizard();
388
389 if( footprintWizard == nullptr )
390 return;
391
392 wxWindowUpdateLocker updateLock( m_parameterGrid );
393
394 m_parameterGrid->ClearGrid();
395 m_parameterGridPage = m_pageList->GetSelection();
396
397 if( m_parameterGridPage < 0 ) // Should not happen
398 return;
399
400 // Get the list of names, values, types, hints and designators
401 wxArrayString designatorsList = footprintWizard->GetParameterDesignators( m_parameterGridPage );
402 wxArrayString namesList = footprintWizard->GetParameterNames( m_parameterGridPage );
403 wxArrayString valuesList = footprintWizard->GetParameterValues( m_parameterGridPage );
404 wxArrayString typesList = footprintWizard->GetParameterTypes( m_parameterGridPage );
405 wxArrayString hintsList = footprintWizard->GetParameterHints( m_parameterGridPage );
406
407 // Dimension the wxGrid
408 m_parameterGrid->ClearRows();
409 m_parameterGrid->AppendRows( namesList.size() );
410
411 wxString designator, name, value, units, hint;
412
413 for( unsigned int i = 0; i < namesList.size(); i++ )
414 {
415 designator = designatorsList[i];
416 name = namesList[i];
417 value = valuesList[i];
418 units = typesList[i];
419 hint = hintsList[i];
420
421 m_parameterGrid->SetRowLabelValue( i, designator );
422
423 // Set the 'Name'
424 m_parameterGrid->SetCellValue( i, WIZ_COL_NAME, name );
425 m_parameterGrid->SetReadOnly( i, WIZ_COL_NAME );
426
427 // Boolean parameters are displayed using a checkbox
428 if( units == WIZARD_PARAM_UNITS_BOOL )
429 {
430 // Set to ReadOnly as we delegate interactivity to GRID_TRICKS
431 m_parameterGrid->SetReadOnly( i, WIZ_COL_VALUE );
432 m_parameterGrid->SetCellRenderer( i, WIZ_COL_VALUE, new wxGridCellBoolRenderer );
433 }
434 // Parameters that can be selected from a list of multiple options
435 else if( units.Contains( "," ) ) // Indicates list of available options
436 {
437 wxStringTokenizer tokenizer( units, "," );
438 wxArrayString options;
439
440 while( tokenizer.HasMoreTokens() )
441 options.Add( tokenizer.GetNextToken() );
442
443 m_parameterGrid->SetCellEditor( i, WIZ_COL_VALUE, new wxGridCellChoiceEditor( options ) );
444
445 units = wxT( "" );
446 }
447 else if( units == WIZARD_PARAM_UNITS_INTEGER ) // Integer parameters
448 {
449 m_parameterGrid->SetCellEditor( i, WIZ_COL_VALUE, new wxGridCellNumberEditor );
450 }
451 else if( ( units == WIZARD_PARAM_UNITS_MM ) ||
452 ( units == WIZARD_PARAM_UNITS_MILS ) ||
453 ( units == WIZARD_PARAM_UNITS_FLOAT ) ||
454 ( units == WIZARD_PARAM_UNITS_RADIANS ) ||
455 ( units == WIZARD_PARAM_UNITS_DEGREES ) ||
456 ( units == WIZARD_PARAM_UNITS_PERCENT ) )
457 {
458 // Non-integer numerical parameters
459 m_parameterGrid->SetCellEditor( i, WIZ_COL_VALUE, new wxGridCellFloatEditor );
460
461 // Convert separators to the locale-specific character
462 value.Replace( ",", wxNumberFormatter::GetDecimalSeparator() );
463 value.Replace( ".", wxNumberFormatter::GetDecimalSeparator() );
464 }
465
466 // Set the 'Units'
467 m_parameterGrid->SetCellValue( i, WIZ_COL_UNITS, units );
468 m_parameterGrid->SetReadOnly( i, WIZ_COL_UNITS );
469
470 // Set the 'Value'
471 m_parameterGrid->SetCellValue( i, WIZ_COL_VALUE, value );
472 }
473
475}
476
478{
479 // Parameter grid is not yet configured
480 if( ( m_parameterGrid == nullptr ) || ( m_parameterGrid->GetNumberCols() == 0 ) )
481 return;
482
483 // first auto-size the columns to ensure enough space around text
484 m_parameterGrid->AutoSizeColumns();
485
486 // Auto-size the value column
487 int width = m_parameterGrid->GetClientSize().GetWidth() -
488 m_parameterGrid->GetRowLabelSize() -
489 m_parameterGrid->GetColSize( WIZ_COL_NAME ) -
490 m_parameterGrid->GetColSize( WIZ_COL_UNITS );
491
492 if( width > m_parameterGrid->GetColMinimalAcceptableWidth() )
493 {
494 m_parameterGrid->SetColSize( WIZ_COL_VALUE, width );
495 }
496}
497
498
499void FOOTPRINT_WIZARD_FRAME::ClickOnPageList( wxCommandEvent& event )
500{
501 if( m_pageList->GetSelection() >= 0 )
502 {
504 GetCanvas()->Refresh();
506 }
507}
508
509
511{
512 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
513 wxCHECK( cfg, /*void*/ );
514
516
518 m_viewerAuiState = std::make_unique<nlohmann::json>( cfg->m_FootprintViewer.aui_state );
519}
520
521
523{
524 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
525 wxCHECK( cfg, /*void*/ );
526
528
529#if wxCHECK_VERSION( 3, 3, 0 )
530 {
531 WX_AUI_JSON_SERIALIZER serializer( m_auimgr );
532 nlohmann::json state = serializer.Serialize();
533
534 if( state.is_null() || state.empty() )
535 cfg->m_FootprintViewer.aui_state = nlohmann::json();
536 else
537 cfg->m_FootprintViewer.aui_state = state;
538
539 cfg->m_FootprintViewer.perspective.clear();
540 }
541#else
542 cfg->m_FootprintViewer.perspective = m_auimgr.SavePerspective().ToStdString();
543 cfg->m_FootprintViewer.aui_state = nlohmann::json();
544#endif
545}
546
547
549{
550 if( PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg ) )
551 return &cfg->m_FootprintWizard;
552
553 wxFAIL_MSG( wxT( "FOOTPRINT_CHOOSER not running with PCBNEW_SETTINGS" ) );
554 return &aCfg->m_Window; // non-null fail-safe
555}
556
557
558void FOOTPRINT_WIZARD_FRAME::OnActivate( wxActivateEvent& event )
559{
560 // Ensure we do not have old selection:
561 if( !event.GetActive() )
562 return;
563
564 if( !m_wizardListShown )
565 {
566 m_wizardListShown = true;
567 wxPostEvent( this, wxCommandEvent( wxEVT_TOOL, ID_FOOTPRINT_WIZARD_SELECT_WIZARD ) );
568 }
569#if 0
570 // Currently, we do not have a way to see if a Python wizard has changed,
571 // therefore the lists of parameters and option has to be rebuilt
572 // This code could be enabled when this way exists
573 bool footprintWizardsChanged = false;
574
575 if( footprintWizardsChanged )
576 {
577 // If we are here, the library list has changed, rebuild it
580 }
581#endif
582}
583
584
585void FOOTPRINT_WIZARD_FRAME::Update3DView( bool aMarkDirty, bool aRefresh, const wxString* aTitle )
586{
587 wxString frm3Dtitle;
588 frm3Dtitle.Printf( _( "ModView: 3D Viewer [%s]" ), m_wizardName );
589 PCB_BASE_FRAME::Update3DView( aMarkDirty, aRefresh, &frm3Dtitle );
590}
591
592
597
598
600{
601 // Reload the Python plugins
602 // Because the board editor has also a plugin python menu,
603 // call the PCB_EDIT_FRAME RunAction() if the board editor is running
604 // Otherwise run the current RunAction().
605 PCB_EDIT_FRAME* pcbframe = static_cast<PCB_EDIT_FRAME*>( Kiway().Player( FRAME_PCB_EDITOR, false ) );
606
607 if( pcbframe )
609 else
611}
const char * name
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 pluginsReload
Definition actions.h:294
static TOOL_ACTION zoomFitScreen
Definition actions.h:142
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
WINDOW_SETTINGS m_Window
wxString m_ColorTheme
Active color theme name.
std::shared_ptr< NET_SETTINGS > m_NetSettings
Abstract interface for BOARD_ITEMs capable of storing other items inside.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:84
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Definition board.h:530
void SetVisibleAlls()
Change the bit-mask of visible element categories and layers.
Definition board.cpp:1016
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition board.cpp:1082
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.
Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard.
wxAuiManager m_auimgr
virtual void ClearMsgPanel()
Clear all messages from the message panel.
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
virtual void ReCreateHToolbar()
static constexpr GAL_TYPE GAL_FALLBACK
void StopDrawing()
Prevent the GAL canvas from further drawing until it is recreated or StartDrawing() is called.
KIGFX::VIEW_CONTROLS * GetViewControls() const
Return a pointer to the #VIEW_CONTROLS instance used in the panel.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Set a dispatcher that processes events and forwards them to tools.
virtual void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition eda_item.h:226
Specialization of the wxAuiPaneInfo class for KiCad panels.
BOARD_ITEM_CONTAINER * GetModel() const override
void PythonPluginsReload()
Reload the Python plugins if they are newer than the already loaded, and load new plugins if any.
void initParameterGrid()
Prepare the grid where parameters are displayed.
void OnSize(wxSizeEvent &event) override
Recalculate the size of toolbars and display panel when the frame size changes.
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
int m_parameterGridPage
the page currently displayed by m_parameterGrid it is most of time the m_pageList selection,...
wxListBox * m_pageList
The list of pages.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void ReCreateParameterList()
Create the list of parameters for the current page.
void DisplayWizardInfos()
Show all the details about the current wizard.
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Helper to retrieve the current color settings.
wxString m_wizardName
name of the current wizard
void SelectCurrentWizard(wxCommandEvent &aDummy)
bool m_wizardListShown
A show-once flag for the wizard list.
void updateView()
Rebuild the GAL view (reint tool manager, colors and drawings) must be run after any footprint change...
void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr) override
Update the 3D view, if the viewer is opened by this frame.
void ClickOnPageList(wxCommandEvent &event)
WX_GRID * m_parameterGrid
The list of parameters.
FOOTPRINT_WIZARD * GetMyWizard()
Reloads the wizard by name.
void ResizeParamColumns()
Expand the 'Value' column to fill available.
void UpdateMsgPanel() override
Redraw the message panel.
std::unique_ptr< nlohmann::json > m_viewerAuiState
void ReCreatePageList()
Create or recreate the list of parameter pages for the current wizard.
wxString m_auiPerspective
Encoded string describing the AUI layout.
void ExportSelectedFootprint(wxCommandEvent &aEvent)
Will let the caller exit from the wait loop, and get the built footprint.
void OnGridSize(wxSizeEvent &aSizeEvent)
WINDOW_SETTINGS * GetWindowSettings(APP_SETTINGS_BASE *aCfg) override
Return a pointer to the window settings for this frame.
void OnActivate(wxActivateEvent &event)
Called when the frame frame is activate to reload the libraries and component lists that can be chang...
Tool useful for viewing footprints.
The parent class from where any footprint wizard class must derive.
virtual wxArrayString GetParameterHints(int aPage)=0
virtual wxArrayString GetParameterNames(int aPage)=0
virtual wxArrayString GetParameterValues(int aPage)=0
virtual wxString GetParameterPageName(int aPage)=0
virtual wxArrayString GetParameterTypes(int aPage)=0
virtual int GetNumParameterPages()=0
virtual wxArrayString GetParameterDesignators(int aPage)=0
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
Definition grid_tricks.h:61
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
void DismissModal(bool aRetVal, const wxString &aResult=wxEmptyString)
bool IsModal() const override
Return true if the frame is shown in our modal mode and false if the frame is shown as an usual frame...
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:295
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition kiway.cpp:407
void SetClearance(int aClearance)
Definition netclass.h:119
std::shared_ptr< NETCLASS > GetDefaultNetclass()
Gets the default netclass for the project.
WINDOW_SETTINGS m_FootprintViewer
Gather all the actions that are shared by tools.
Definition pcb_actions.h:51
Common, abstract interface for edit frames.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
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.
BOARD * GetBoard() const
FOOTPRINT_EDITOR_SETTINGS * GetFootprintEditorSettings() const
EDA_3D_VIEWER_FRAME * Get3DViewerFrame()
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
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.
The main frame for Pcbnew.
The selection tool: currently supports:
Tool relating to pads and pad settings.
TOOL_MANAGER * m_toolManager
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
@ MODEL_RELOAD
Model changes (the sheet for a schematic)
Definition tool_base.h:80
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.
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).
EDA_UNITS GetUserUnits() const
nlohmann::json Serialize() const
#define _(s)
Declaration of the eda_3d_viewer class.
#define KICAD_DEFAULT_DRAWFRAME_STYLE
#define FOOTPRINT_WIZARD_FRAME_NAME
const wxString WIZARD_PARAM_UNITS_PERCENT
const wxString WIZARD_PARAM_UNITS_RADIANS
const wxString WIZARD_PARAM_UNITS_MM
const wxString WIZARD_PARAM_UNITS_INTEGER
const wxString WIZARD_PARAM_UNITS_BOOL
const wxString WIZARD_PARAM_UNITS_FLOAT
const wxString WIZARD_PARAM_UNITS_MILS
const wxString WIZARD_PARAM_UNITS_DEGREES
EVT_GRID_CMD_CELL_CHANGED(ID_FOOTPRINT_WIZARD_PARAMETER_LIST, FOOTPRINT_WIZARD_FRAME::ParametersUpdated) FOOTPRINT_WIZARD_FRAME
FRAME_T
The set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Definition frame_type.h:33
@ FRAME_PCB_EDITOR
Definition frame_type.h:42
@ FRAME_FOOTPRINT_WIZARD
Definition frame_type.h:46
@ F_Cu
Definition layer_ids.h:64
Message panel definition file.
@ ID_FOOTPRINT_WIZARD_DONE
Definition pcbnew_id.h:90
@ ID_FOOTPRINT_WIZARD_SELECT_WIZARD
Definition pcbnew_id.h:93
@ ID_FOOTPRINT_WIZARD_PARAMETER_LIST
Definition pcbnew_id.h:92
@ ID_FOOTPRINT_WIZARD_PAGE_LIST
Definition pcbnew_id.h:91
BOARD * GetBoard()
see class PGM_BASE
#define DEFAULT_THEME
T * GetToolbarSettings(const wxString &aFilename)
KIWAY Kiway(KFCTL_STANDALONE)
Store the common settings that are saved and loaded for each window / frame.
nlohmann::json aui_state
wxString perspective