KiCad PCB EDA Suite
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 (C) 2004-2021 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>
31#include <widgets/msgpanel.h>
32#include <bitmaps.h>
33#include <grid_tricks.h>
34#include <board.h>
37#include <pcbnew_id.h>
38#include <pcbnew_settings.h>
40#include <wx/listbox.h>
41#include <wx/tokenzr.h>
42#include <wx/numformatter.h>
44#include <base_units.h>
45#include <pgm_base.h>
48#include <tool/tool_manager.h>
50#include <tool/action_toolbar.h>
51#include <tool/common_tools.h>
53#include "tools/pcb_control.h"
54#include "tools/pcb_actions.h"
55
56
57BEGIN_EVENT_TABLE( FOOTPRINT_WIZARD_FRAME, EDA_DRAW_FRAME )
58
59 // Window events
62
63 // Toolbar events
69
70 // listbox events
73 FOOTPRINT_WIZARD_FRAME::ParametersUpdated )
74END_EVENT_TABLE()
75
76
77// Note: our FOOTPRINT_WIZARD_FRAME is always modal.
78
79FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* aParent,
80 FRAME_T aFrameType ) :
81 PCB_BASE_EDIT_FRAME( aKiway, aParent, aFrameType, _( "Footprint Wizard" ),
82 wxDefaultPosition, wxDefaultSize,
83 aParent ? KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT
84 : KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP,
86 m_wizardListShown( false )
87{
88 wxASSERT( aFrameType == FRAME_FOOTPRINT_WIZARD );
89
90 // This frame is always show modal:
91 SetModal( true );
92
93 // Give an icon
94 wxIcon icon;
95 icon.CopyFromBitmap( KiBitmap( BITMAPS::module_wizard ) );
96 SetIcon( icon );
97
98 m_wizardName.Empty();
99
100 // Create the GAL canvas.
101 // Must be created before calling LoadSettings() that needs a valid GAL canvas
102 PCB_DRAW_PANEL_GAL* gal_drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ),
103 m_frameSize,
104 GetGalDisplayOptions(),
106 SetCanvas( gal_drawPanel );
107
108 SetBoard( new BOARD() );
109
110 // Ensure all layers and items are visible:
112 SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
113 GetScreen()->m_Center = true; // Center coordinate origins on screen.
114
115 LoadSettings( config() );
116
117 SetSize( m_framePos.x, m_framePos.y, m_frameSize.x, m_frameSize.y );
118
119 // Set some display options here, because the FOOTPRINT_WIZARD_FRAME
120 // does not have a config menu to do that:
121
122 // the footprint wizard frame has no config menu. so use some settings
123 // from the caller, or force some options:
124 PCB_BASE_FRAME* caller = dynamic_cast<PCB_BASE_FRAME*>( aParent );
125
126 if( caller )
127 SetUserUnits( caller->GetUserUnits() );
128
129 // In viewer, the default net clearance is not known (it depends on the actual board).
130 // So we do not show the default clearance, by setting it to 0
131 // The footprint or pad specific clearance will be shown
132 GetBoard()->GetDesignSettings().m_NetSettings->m_DefaultNetClass->SetClearance( 0 );
133
134 // Create the manager and dispatcher & route draw panel events to the dispatcher
135 m_toolManager = new TOOL_MANAGER;
136 m_toolManager->SetEnvironment( GetBoard(), gal_drawPanel->GetView(),
137 gal_drawPanel->GetViewControls(), config(), this );
138 m_actions = new PCB_ACTIONS();
139 m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
140 gal_drawPanel->SetEventDispatcher( m_toolDispatcher );
141
142 m_toolManager->RegisterTool( new PCB_CONTROL );
143 m_toolManager->RegisterTool( new PCB_SELECTION_TOOL ); // for std context menus (zoom & grid)
144 m_toolManager->RegisterTool( new COMMON_TOOLS );
145 m_toolManager->InitTools();
146
147 // Run the control tool, it is supposed to be always active
148 m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
149
150 // Create the toolbars
151 ReCreateHToolbar();
152 ReCreateVToolbar();
153
154 // Create the parameters panel
155 m_parametersPanel = new wxPanel( this, wxID_ANY );
156
157 m_pageList = new wxListBox( m_parametersPanel, ID_FOOTPRINT_WIZARD_PAGE_LIST,
158 wxDefaultPosition, wxDefaultSize, 0, nullptr,
159 wxLB_HSCROLL | wxNO_BORDER );
160
161 auto divider = new wxStaticLine( m_parametersPanel, wxID_ANY,
162 wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
163
164 m_parameterGrid = new WX_GRID( m_parametersPanel, ID_FOOTPRINT_WIZARD_PARAMETER_LIST );
165 initParameterGrid();
166 m_parameterGrid->PushEventHandler( new GRID_TRICKS( m_parameterGrid ) );
167
168 ReCreatePageList();
169
170 wxBoxSizer* parametersSizer = new wxBoxSizer( wxHORIZONTAL );
171 parametersSizer->Add( m_pageList, 0, wxEXPAND, 5 );
172 parametersSizer->Add( divider, 0, wxEXPAND, 5 );
173 parametersSizer->Add( m_parameterGrid, 1, wxEXPAND, 5 );
174 m_parametersPanel->SetSizer( parametersSizer );
175 m_parametersPanel->Layout();
176
177 // Create the build message box
178 m_buildMessageBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString,
179 wxDefaultPosition, wxDefaultSize,
180 wxTE_MULTILINE | wxTE_READONLY | wxNO_BORDER );
181
182 DisplayWizardInfos();
183
184 m_auimgr.SetManagedWindow( this );
185
186 m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
187 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6)
188 .BestSize( -1, m_msgFrameHeight ) );
189
190 m_auimgr.AddPane( m_parametersPanel, EDA_PANE().Palette().Name( "Params" ).Left().Position(0)
191 .Caption( _( "Parameters" ) ).MinSize( 360, 180 ) );
192 m_auimgr.AddPane( m_buildMessageBox, EDA_PANE().Palette().Name( "Output" ).Left().Position(1)
193 .CaptionVisible( false ).MinSize( 360, -1 ) );
194
195 m_auimgr.AddPane( GetCanvas(), wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() );
196
197 auto& galOpts = GetGalDisplayOptions();
198 galOpts.m_fullscreenCursor = true;
199 galOpts.m_forceDisplayCursor = true;
200 galOpts.m_axesEnabled = true;
201
202 ActivateGalCanvas();
203 updateView();
204
205 SetActiveLayer( F_Cu );
206 GetToolManager()->RunAction( ACTIONS::zoomFitScreen, false );
207
208 // Do not Run a dialog here: on some Window Managers, it creates issues.
209 // Reason: the FOOTPRINT_WIZARD_FRAME is run as modal;
210 // It means the call to FOOTPRINT_WIZARD_FRAME::ShowModal will change the
211 // Event Loop Manager, and stop the one created by the dialog.
212 // It does not happen on all W.M., perhaps due to the way the order events are called
213 // See the call in onActivate instead
214}
215
216
218{
219 // Delete the GRID_TRICKS.
220 m_parameterGrid->PopEventHandler( true );
221
223 // Be sure any event cannot be fired after frame deletion:
224 GetCanvas()->SetEvtHandlerEnabled( false );
225
226 // Be sure a active tool (if exists) is deactivated:
227 if( m_toolManager )
229
230 EDA_3D_VIEWER_FRAME* draw3DFrame = Get3DViewerFrame();
231
232 if( draw3DFrame )
233 draw3DFrame->Destroy();
234
235 // Now this frame can be deleted
236}
237
238
240{
241 SaveSettings( config() );
242
243 if( IsModal() )
244 {
245 // Only dismiss a modal frame once, so that the return values set by
246 // the prior DismissModal() are not bashed for ShowModal().
247 if( !IsDismissed() )
248 DismissModal( false );
249 }
250}
251
252
254{
255 DismissModal( true );
256 Close();
257}
258
259
260void FOOTPRINT_WIZARD_FRAME::OnGridSize( wxSizeEvent& aSizeEvent )
261{
262 // Resize the parameter columns
264
265 aSizeEvent.Skip();
266}
267
268
269void FOOTPRINT_WIZARD_FRAME::OnSize( wxSizeEvent& SizeEv )
270{
271 if( m_auimgr.GetManagedWindow() )
272 m_auimgr.Update();
273
274 SizeEv.Skip();
275}
276
277
279{
280 wxString currentTheme = GetFootprintEditorSettings()->m_ColorTheme;
281
282 return Pgm().GetSettingsManager().GetColorSettings( currentTheme );
283}
284
285
287{
293}
294
295
297{
298 BOARD_ITEM* footprint = GetBoard()->GetFirstFootprint();
299
300 if( footprint )
301 {
302 std::vector<MSG_PANEL_ITEM> items;
303
304 footprint->GetMsgPanelInfo( this, items );
305 SetMsgPanel( items );
306 }
307 else
308 {
310 }
311}
312
313
315{
317
318 // Prepare the grid where parameters are displayed
319
320 m_parameterGrid->CreateGrid( 0, 3 );
321
322 m_parameterGrid->SetColLabelValue( WIZ_COL_NAME, _( "Parameter" ) );
323 m_parameterGrid->SetColLabelValue( WIZ_COL_VALUE, _( "Value" ) );
324 m_parameterGrid->SetColLabelValue( WIZ_COL_UNITS, _( "Units" ) );
325
327 m_parameterGrid->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE );
328 m_parameterGrid->AutoSizeColumns();
329
330 m_parameterGrid->AutoSizeRows();
331 m_parameterGrid->SetRowLabelSize( 0 );
332
333 m_parameterGrid->DisableDragGridSize();
334 m_parameterGrid->DisableDragColSize();
335
336 m_parameterGrid->Connect( wxEVT_SIZE,
337 wxSizeEventHandler( FOOTPRINT_WIZARD_FRAME::OnGridSize ),
338 nullptr, this );
339}
340
341
343{
344 if( m_pageList == nullptr )
345 return;
346
347 FOOTPRINT_WIZARD* footprintWizard = GetMyWizard();
348
349 if( !footprintWizard )
350 return;
351
352 m_pageList->Clear();
353 int max_page = footprintWizard->GetNumParameterPages();
354
355 for( int i = 0; i < max_page; i++ )
356 {
357 wxString name = footprintWizard->GetParameterPageName( i );
358 m_pageList->Append( name );
359 }
360
361 m_pageList->SetSelection( 0, true );
362
366 GetCanvas()->Refresh();
367}
368
369
371{
372 if( m_parameterGrid == nullptr )
373 return;
374
375 FOOTPRINT_WIZARD* footprintWizard = GetMyWizard();
376
377 if( footprintWizard == nullptr )
378 return;
379
380 m_parameterGrid->Freeze();
381
382 m_parameterGrid->ClearGrid();
383 m_parameterGridPage = m_pageList->GetSelection();
384
385 if( m_parameterGridPage < 0 ) // Should not happen
386 return;
387
388 // Get the list of names, values, types, hints and designators
389 wxArrayString designatorsList = footprintWizard->GetParameterDesignators( m_parameterGridPage );
390 wxArrayString namesList = footprintWizard->GetParameterNames( m_parameterGridPage );
391 wxArrayString valuesList = footprintWizard->GetParameterValues( m_parameterGridPage );
392 wxArrayString typesList = footprintWizard->GetParameterTypes( m_parameterGridPage );
393 wxArrayString hintsList = footprintWizard->GetParameterHints( m_parameterGridPage );
394
395 // Dimension the wxGrid
397 m_parameterGrid->AppendRows( namesList.size() );
398
399 wxString designator, name, value, units, hint;
400
401 for( unsigned int i = 0; i < namesList.size(); i++ )
402 {
403 designator = designatorsList[i];
404 name = namesList[i];
405 value = valuesList[i];
406 units = typesList[i];
407 hint = hintsList[i];
408
409 m_parameterGrid->SetRowLabelValue( i, designator );
410
411 // Set the 'Name'
412 m_parameterGrid->SetCellValue( i, WIZ_COL_NAME, name );
413 m_parameterGrid->SetReadOnly( i, WIZ_COL_NAME );
414
415 // Boolean parameters are displayed using a checkbox
416 if( units == WIZARD_PARAM_UNITS_BOOL )
417 {
418 // Set to ReadOnly as we delegate interactivity to GRID_TRICKS
419 m_parameterGrid->SetReadOnly( i, WIZ_COL_VALUE );
420 m_parameterGrid->SetCellRenderer( i, WIZ_COL_VALUE, new wxGridCellBoolRenderer );
421 }
422 // Parameters that can be selected from a list of multiple options
423 else if( units.Contains( wxT( "," ) ) ) // Indicates list of available options
424 {
425 wxStringTokenizer tokenizer( units, wxT( "," ) );
426 wxArrayString options;
427
428 while( tokenizer.HasMoreTokens() )
429 {
430 options.Add( tokenizer.GetNextToken() );
431 }
432
433 m_parameterGrid->SetCellEditor( i, WIZ_COL_VALUE,
434 new wxGridCellChoiceEditor( options ) );
435
436 units = wxT( "" );
437 }
438 else if( units == WIZARD_PARAM_UNITS_INTEGER ) // Integer parameters
439 {
440 m_parameterGrid->SetCellEditor( i, WIZ_COL_VALUE, new wxGridCellNumberEditor );
441 }
442 else if( ( units == WIZARD_PARAM_UNITS_MM ) ||
443 ( units == WIZARD_PARAM_UNITS_MILS ) ||
444 ( units == WIZARD_PARAM_UNITS_FLOAT ) ||
445 ( units == WIZARD_PARAM_UNITS_RADIANS ) ||
446 ( units == WIZARD_PARAM_UNITS_DEGREES ) ||
447 ( units == WIZARD_PARAM_UNITS_PERCENT ) )
448 {
449 // Non-integer numerical parameters
450 m_parameterGrid->SetCellEditor( i, WIZ_COL_VALUE, new wxGridCellFloatEditor );
451
452 // Convert separators to the locale-specific character
453 value.Replace( ",", wxNumberFormatter::GetDecimalSeparator() );
454 value.Replace( ".", wxNumberFormatter::GetDecimalSeparator() );
455 }
456
457 // Set the 'Units'
458 m_parameterGrid->SetCellValue( i, WIZ_COL_UNITS, units );
459 m_parameterGrid->SetReadOnly( i, WIZ_COL_UNITS );
460
461 // Set the 'Value'
462 m_parameterGrid->SetCellValue( i, WIZ_COL_VALUE, value );
463 }
464
466
467 m_parameterGrid->Thaw();
468}
469
471{
472 // Parameter grid is not yet configured
473 if( ( m_parameterGrid == nullptr ) || ( m_parameterGrid->GetNumberCols() == 0 ) )
474 return;
475
476 // first auto-size the columns to ensure enough space around text
477 m_parameterGrid->AutoSizeColumns();
478
479 // Auto-size the value column
480 int width = m_parameterGrid->GetClientSize().GetWidth() -
481 m_parameterGrid->GetRowLabelSize() -
482 m_parameterGrid->GetColSize( WIZ_COL_NAME ) -
483 m_parameterGrid->GetColSize( WIZ_COL_UNITS );
484
485 if( width > m_parameterGrid->GetColMinimalAcceptableWidth() )
486 {
487 m_parameterGrid->SetColSize( WIZ_COL_VALUE, width );
488 }
489}
490
491
492void FOOTPRINT_WIZARD_FRAME::ClickOnPageList( wxCommandEvent& event )
493{
494 if( m_pageList->GetSelection() >= 0 )
495 {
497 GetCanvas()->Refresh();
499 }
500}
501
502
504{
505 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
506 wxCHECK( cfg, /*void*/ );
507
509
511}
512
513
515{
516 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
517 wxCHECK( cfg, /*void*/ );
518
520
521 cfg->m_FootprintViewer.perspective = m_auimgr.SavePerspective().ToStdString();
522}
523
524
526{
527 auto cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
528 wxASSERT( cfg );
529
530 return cfg ? &cfg->m_FootprintWizard : nullptr;
531}
532
533
534void FOOTPRINT_WIZARD_FRAME::OnActivate( wxActivateEvent& event )
535{
536 // Ensure we do not have old selection:
537 if( !event.GetActive() )
538 return;
539
540 if( !m_wizardListShown )
541 {
542 m_wizardListShown = true;
543 wxPostEvent( this, wxCommandEvent( wxEVT_TOOL, ID_FOOTPRINT_WIZARD_SELECT_WIZARD ) );
544 }
545#if 0
546 // Currently, we do not have a way to see if a Python wizard has changed,
547 // therefore the lists of parameters and option has to be rebuilt
548 // This code could be enabled when this way exists
549 bool footprintWizardsChanged = false;
550
551 if( footprintWizardsChanged )
552 {
553 // If we are here, the library list has changed, rebuild it
556 }
557#endif
558}
559
560
561void FOOTPRINT_WIZARD_FRAME::Update3DView( bool aMarkDirty, bool aRefresh, const wxString* aTitle )
562{
563 wxString frm3Dtitle;
564 frm3Dtitle.Printf( _( "ModView: 3D Viewer [%s]" ), m_wizardName );
565 PCB_BASE_FRAME::Update3DView( aMarkDirty, aRefresh, &frm3Dtitle );
566}
567
568
570{
571 if( m_mainToolBar )
572 {
574 }
575 else
576 {
577 m_mainToolBar = new ACTION_TOOLBAR( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
578 KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
580 }
581
582 // Set up toolbar
583 m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_SELECT_WIZARD, wxEmptyString,
585 _( "Select wizard script to run" ) );
586
590 _( "Reset wizard parameters to default") );
591
593 m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_PREVIOUS, wxEmptyString,
595 _( "Select previous parameters page" ) );
596 m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_NEXT, wxEmptyString,
598 _( "Select next parameters page" ) );
599
600#if 0 // Currently: the 3D viewer is not useful
603#endif
604
610
611 // The footprint wizard always can export the current footprint
615 _( "Export footprint to editor" ) );
616
617 // after adding the buttons to the toolbar, must call Realize() to
618 // reflect the changes
619 m_mainToolBar->Realize();
620}
621
622
624{
625 return GetBoard()->GetFirstFootprint();
626}
627
628
630{
631 // Currently, there is no vertical toolbar
632}
633
635{
636 // Reload the Python plugins
637 // Because the board editor has also a plugin python menu,
638 // call PCB_EDIT_FRAME::PythonPluginsReload() if the board editor
639 // is running
640 auto brd_frame = static_cast<PCB_EDIT_FRAME*>( Kiway().Player( FRAME_PCB_EDITOR, false ) );
641
642 if( brd_frame )
644 else
646}
const char * name
Definition: DXF_plotter.cpp:56
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
@ lib_previous
@ export_footprint_names
@ module_wizard
static TOOL_ACTION zoomRedraw
Definition: actions.h:92
static TOOL_ACTION show3DViewer
Definition: actions.h:162
static TOOL_ACTION zoomOutCenter
Definition: actions.h:96
static TOOL_ACTION zoomFitScreen
Definition: actions.h:98
static TOOL_ACTION zoomInCenter
Definition: actions.h:95
Define the structure of a toolbar with buttons that invoke ACTIONs.
void SetAuiManager(wxAuiManager *aManager)
Set the AUI manager that this toolbar belongs to.
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:110
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:196
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:58
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Definition: board.h:397
void SetVisibleAlls()
Change the bit-mask of visible element categories and layers.
Definition: board.cpp:575
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:643
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
Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard.
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
static constexpr int KICAD_AUI_TB_STYLE
< Default style flags used for wxAUI toolbars.
wxAuiManager m_auimgr
The base class for create windows for drawing purpose.
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.
ACTION_TOOLBAR * m_mainToolBar
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
Update the board display after modifying it by a python script (note: it is automatically called by a...
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:211
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
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.
void ReCreatePageList()
Create or recreate the list of parameter pages for the current wizard.
void Process_Special_Functions(wxCommandEvent &event)
wxString m_auiPerspective
Encoded string describing the AUI layout.
void DefaultParameters(wxCommandEvent &event)
void ExportSelectedFootprint(wxCommandEvent &aEvent)
Will let the caller exit from the wait loop, and get the built footprint.
void SelectCurrentWizard(wxCommandEvent &event)
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...
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
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
bool IsDismissed()
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...
Definition: kiway_player.h:159
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:273
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:394
WINDOW_SETTINGS m_FootprintViewer
Gather all the actions that are shared by tools.
Definition: pcb_actions.h:49
static TOOL_ACTION pluginsReload
Scripting Actions.
Definition: pcb_actions.h:354
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_MANAGER * m_toolManager
Definition: tools_holder.h:170
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:54
@ 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
void DeactivateTool()
Deactivate the currently active tool.
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).
EDA_UNITS GetUserUnits() const
void SetColLabelSize(int aHeight)
Hide wxGrid's SetColLabelSize() method with one which makes sure the size is tall enough for the syst...
Definition: wx_grid.cpp:76
void ClearRows()
wxWidgets recently added an ASSERT which fires if the position is greater than or equal to the number...
Definition: wx_grid.h:133
#define _(s)
#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
@ WIZ_COL_VALUE
@ WIZ_COL_NAME
@ WIZ_COL_UNITS
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:40
@ FRAME_FOOTPRINT_WIZARD
Definition: frame_type.h:44
@ F_Cu
Definition: layer_ids.h:64
Message panel definition file.
@ ID_FOOTPRINT_WIZARD_PREVIOUS
Definition: pcbnew_id.h:109
@ ID_FOOTPRINT_WIZARD_NEXT
Definition: pcbnew_id.h:108
@ ID_FOOTPRINT_WIZARD_DONE
Definition: pcbnew_id.h:110
@ ID_FOOTPRINT_WIZARD_SELECT_WIZARD
Definition: pcbnew_id.h:113
@ ID_FOOTPRINT_WIZARD_RESET_TO_DEFAULT
Definition: pcbnew_id.h:114
@ ID_FOOTPRINT_WIZARD_PARAMETER_LIST
Definition: pcbnew_id.h:112
@ ID_FOOTPRINT_WIZARD_PAGE_LIST
Definition: pcbnew_id.h:111
BOARD * GetBoard()
see class PGM_BASE
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111
Stores the common settings that are saved and loaded for each window / frame.
Definition: app_settings.h:92
wxString perspective
Definition: app_settings.h:95
Definition of file extensions used in Kicad.