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 <miguelangel@nbee.es>
5  * Copyright (C) 2012-2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
6  * Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
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>
35 #include <footprint_edit_frame.h>
37 #include <pcbnew_id.h>
38 #include <pcbnew_settings.h>
39 #include "footprint_wizard_frame.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>
49 #include <tool/tool_dispatcher.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 
57 BEGIN_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 )
74 END_EVENT_TABLE()
75 
76 
77 // Note: our FOOTPRINT_WIZARD_FRAME is always modal.
78 
79 FOOTPRINT_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
134 
135  PCB_DISPLAY_OPTIONS disp_opts = GetDisplayOptions();
136 
137  disp_opts.m_DisplayPadClearance = true;
138  disp_opts.m_DisplayPadNum = true;
139  SetDisplayOptions( disp_opts );
140 
141  // Create the manager and dispatcher & route draw panel events to the dispatcher
142  m_toolManager = new TOOL_MANAGER;
143  m_toolManager->SetEnvironment( GetBoard(), gal_drawPanel->GetView(),
144  gal_drawPanel->GetViewControls(), config(), this );
145  m_actions = new PCB_ACTIONS();
146  m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
147  gal_drawPanel->SetEventDispatcher( m_toolDispatcher );
148 
149  m_toolManager->RegisterTool( new PCB_CONTROL );
150  m_toolManager->RegisterTool( new PCB_SELECTION_TOOL ); // for std context menus (zoom & grid)
151  m_toolManager->RegisterTool( new COMMON_TOOLS );
152  m_toolManager->InitTools();
153 
154  // Run the control tool, it is supposed to be always active
155  m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
156 
157  // Create the toolbars
158  ReCreateHToolbar();
159  ReCreateVToolbar();
160 
161  // Create the parameters panel
162  m_parametersPanel = new wxPanel( this, wxID_ANY );
163 
164  m_pageList = new wxListBox( m_parametersPanel, ID_FOOTPRINT_WIZARD_PAGE_LIST,
165  wxDefaultPosition, wxDefaultSize, 0, nullptr,
166  wxLB_HSCROLL | wxNO_BORDER );
167 
168  auto divider = new wxStaticLine( m_parametersPanel, wxID_ANY,
169  wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
170 
171  m_parameterGrid = new WX_GRID( m_parametersPanel, ID_FOOTPRINT_WIZARD_PARAMETER_LIST );
172  initParameterGrid();
173  m_parameterGrid->PushEventHandler( new GRID_TRICKS( m_parameterGrid ) );
174 
175  ReCreatePageList();
176 
177  wxBoxSizer* parametersSizer = new wxBoxSizer( wxHORIZONTAL );
178  parametersSizer->Add( m_pageList, 0, wxEXPAND, 5 );
179  parametersSizer->Add( divider, 0, wxEXPAND, 5 );
180  parametersSizer->Add( m_parameterGrid, 1, wxEXPAND, 5 );
181  m_parametersPanel->SetSizer( parametersSizer );
182  m_parametersPanel->Layout();
183 
184  // Create the build message box
185  m_buildMessageBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString,
186  wxDefaultPosition, wxDefaultSize,
187  wxTE_MULTILINE | wxTE_READONLY | wxNO_BORDER );
188 
189  DisplayWizardInfos();
190 
191  m_auimgr.SetManagedWindow( this );
192 
193  m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
194  m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6)
195  .BestSize( -1, m_msgFrameHeight ) );
196 
197  m_auimgr.AddPane( m_parametersPanel, EDA_PANE().Palette().Name( "Params" ).Left().Position(0)
198  .Caption( _( "Parameters" ) ).MinSize( 360, 180 ) );
199  m_auimgr.AddPane( m_buildMessageBox, EDA_PANE().Palette().Name( "Output" ).Left().Position(1)
200  .CaptionVisible( false ).MinSize( 360, -1 ) );
201 
202  m_auimgr.AddPane( GetCanvas(), wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() );
203 
204  auto& galOpts = GetGalDisplayOptions();
205  galOpts.m_fullscreenCursor = true;
206  galOpts.m_forceDisplayCursor = true;
207  galOpts.m_axesEnabled = true;
208 
209  ActivateGalCanvas();
210  updateView();
211 
212  SetActiveLayer( F_Cu );
213  GetToolManager()->RunAction( ACTIONS::zoomFitScreen, false );
214 
215  // Do not Run a dialog here: on some Window Managers, it creates issues.
216  // Reason: the FOOTPRINT_WIZARD_FRAME is run as modal;
217  // It means the call to FOOTPRINT_WIZARD_FRAME::ShowModal will change the
218  // Event Loop Manager, and stop the one created by the dialog.
219  // It does not happen on all W.M., perhaps due to the way the order events are called
220  // See the call in onActivate instead
221 }
222 
223 
225 {
226  // Delete the GRID_TRICKS.
227  m_parameterGrid->PopEventHandler( true );
228 
229  GetCanvas()->StopDrawing();
230  // Be sure any event cannot be fired after frame deletion:
231  GetCanvas()->SetEvtHandlerEnabled( false );
232 
233  // Be sure a active tool (if exists) is deactivated:
234  if( m_toolManager )
236 
237  EDA_3D_VIEWER_FRAME* draw3DFrame = Get3DViewerFrame();
238 
239  if( draw3DFrame )
240  draw3DFrame->Destroy();
241 
242  // Now this frame can be deleted
243 }
244 
245 
247 {
248  SaveSettings( config() );
249 
250  if( IsModal() )
251  {
252  // Only dismiss a modal frame once, so that the return values set by
253  // the prior DismissModal() are not bashed for ShowModal().
254  if( !IsDismissed() )
255  DismissModal( false );
256  }
257 }
258 
259 
261 {
262  DismissModal( true );
263  Close();
264 }
265 
266 
267 void FOOTPRINT_WIZARD_FRAME::OnGridSize( wxSizeEvent& aSizeEvent )
268 {
269  // Resize the parameter columns
271 
272  aSizeEvent.Skip();
273 }
274 
275 
276 void FOOTPRINT_WIZARD_FRAME::OnSize( wxSizeEvent& SizeEv )
277 {
278  if( m_auimgr.GetManagedWindow() )
279  m_auimgr.Update();
280 
281  SizeEv.Skip();
282 }
283 
284 
286 {
287  wxString currentTheme = GetFootprintEditorSettings()->m_ColorTheme;
288 
289  return Pgm().GetSettingsManager().GetColorSettings( currentTheme );
290 }
291 
292 
294 {
295  GetCanvas()->UpdateColors();
299  UpdateMsgPanel();
300 }
301 
302 
304 {
305  BOARD_ITEM* footprint = GetBoard()->GetFirstFootprint();
306 
307  if( footprint )
308  {
309  MSG_PANEL_ITEMS items;
310 
311  footprint->GetMsgPanelInfo( this, items );
312  SetMsgPanel( items );
313  }
314  else
315  {
316  ClearMsgPanel();
317  }
318 }
319 
320 
322 {
323  m_parameterGridPage = -1;
324 
325  // Prepare the grid where parameters are displayed
326 
327  m_parameterGrid->CreateGrid( 0, 3 );
328 
329  m_parameterGrid->SetColLabelValue( WIZ_COL_NAME, _( "Parameter" ) );
330  m_parameterGrid->SetColLabelValue( WIZ_COL_VALUE, _( "Value" ) );
331  m_parameterGrid->SetColLabelValue( WIZ_COL_UNITS, _( "Units" ) );
332 
334  m_parameterGrid->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE );
335  m_parameterGrid->AutoSizeColumns();
336 
337  m_parameterGrid->AutoSizeRows();
338  m_parameterGrid->SetRowLabelSize( 0 );
339 
340  m_parameterGrid->DisableDragGridSize();
341  m_parameterGrid->DisableDragColSize();
342 
343  m_parameterGrid->Connect( wxEVT_SIZE,
344  wxSizeEventHandler( FOOTPRINT_WIZARD_FRAME::OnGridSize ),
345  nullptr, this );
346 }
347 
348 
350 {
351  if( m_pageList == nullptr )
352  return;
353 
354  FOOTPRINT_WIZARD* footprintWizard = GetMyWizard();
355 
356  if( !footprintWizard )
357  return;
358 
359  m_pageList->Clear();
360  int max_page = footprintWizard->GetNumParameterPages();
361 
362  for( int i = 0; i < max_page; i++ )
363  {
364  wxString name = footprintWizard->GetParameterPageName( i );
365  m_pageList->Append( name );
366  }
367 
368  m_pageList->SetSelection( 0, true );
369 
373  GetCanvas()->Refresh();
374 }
375 
376 
378 {
379  if( m_parameterGrid == nullptr )
380  return;
381 
382  FOOTPRINT_WIZARD* footprintWizard = GetMyWizard();
383 
384  if( footprintWizard == nullptr )
385  return;
386 
387  m_parameterGrid->Freeze();
388 
389  m_parameterGrid->ClearGrid();
390  m_parameterGridPage = m_pageList->GetSelection();
391 
392  if( m_parameterGridPage < 0 ) // Should not happen
393  return;
394 
395  // Get the list of names, values, types, hints and designators
396  wxArrayString designatorsList = footprintWizard->GetParameterDesignators( m_parameterGridPage );
397  wxArrayString namesList = footprintWizard->GetParameterNames( m_parameterGridPage );
398  wxArrayString valuesList = footprintWizard->GetParameterValues( m_parameterGridPage );
399  wxArrayString typesList = footprintWizard->GetParameterTypes( m_parameterGridPage );
400  wxArrayString hintsList = footprintWizard->GetParameterHints( m_parameterGridPage );
401 
402  // Dimension the wxGrid
404  m_parameterGrid->AppendRows( namesList.size() );
405 
406  wxString designator, name, value, units, hint;
407 
408  for( unsigned int i = 0; i < namesList.size(); i++ )
409  {
410  designator = designatorsList[i];
411  name = namesList[i];
412  value = valuesList[i];
413  units = typesList[i];
414  hint = hintsList[i];
415 
416  m_parameterGrid->SetRowLabelValue( i, designator );
417 
418  // Set the 'Name'
419  m_parameterGrid->SetCellValue( i, WIZ_COL_NAME, name );
420  m_parameterGrid->SetReadOnly( i, WIZ_COL_NAME );
421 
422  // Boolean parameters are displayed using a checkbox
423  if( units == WIZARD_PARAM_UNITS_BOOL )
424  {
425  // Set to ReadOnly as we delegate interactivity to GRID_TRICKS
426  m_parameterGrid->SetReadOnly( i, WIZ_COL_VALUE );
427  m_parameterGrid->SetCellRenderer( i, WIZ_COL_VALUE, new wxGridCellBoolRenderer );
428  }
429  // Parameters that can be selected from a list of multiple options
430  else if( units.Contains( "," ) ) // Indicates list of available options
431  {
432  wxStringTokenizer tokenizer( units, "," );
433  wxArrayString options;
434 
435  while( tokenizer.HasMoreTokens() )
436  {
437  options.Add( tokenizer.GetNextToken() );
438  }
439 
440  m_parameterGrid->SetCellEditor( i, WIZ_COL_VALUE,
441  new wxGridCellChoiceEditor( options ) );
442 
443  units = wxT( "" );
444  }
445  else if( units == WIZARD_PARAM_UNITS_INTEGER ) // Integer parameters
446  {
447  m_parameterGrid->SetCellEditor( i, WIZ_COL_VALUE, new wxGridCellNumberEditor );
448  }
449  else if( ( units == WIZARD_PARAM_UNITS_MM ) ||
450  ( units == WIZARD_PARAM_UNITS_MILS ) ||
451  ( units == WIZARD_PARAM_UNITS_FLOAT ) ||
452  ( units == WIZARD_PARAM_UNITS_RADIANS ) ||
453  ( units == WIZARD_PARAM_UNITS_DEGREES ) ||
454  ( units == WIZARD_PARAM_UNITS_PERCENT ) )
455  {
456  // Non-integer numerical parameters
457  m_parameterGrid->SetCellEditor( i, WIZ_COL_VALUE, new wxGridCellFloatEditor );
458 
459  // Convert separators to the locale-specific character
460  value.Replace( ",", wxNumberFormatter::GetDecimalSeparator() );
461  value.Replace( ".", wxNumberFormatter::GetDecimalSeparator() );
462  }
463 
464  // Set the 'Units'
465  m_parameterGrid->SetCellValue( i, WIZ_COL_UNITS, units );
466  m_parameterGrid->SetReadOnly( i, WIZ_COL_UNITS );
467 
468  // Set the 'Value'
469  m_parameterGrid->SetCellValue( i, WIZ_COL_VALUE, value );
470  }
471 
473 
474  m_parameterGrid->Thaw();
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 
499 void 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 }
519 
520 
522 {
523  PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
524  wxCHECK( cfg, /*void*/ );
525 
527 
528  cfg->m_FootprintViewer.perspective = m_auimgr.SavePerspective().ToStdString();
529 }
530 
531 
533 {
534  auto cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
535  wxASSERT( cfg );
536 
537  return cfg ? &cfg->m_FootprintWizard : nullptr;
538 }
539 
540 
541 void FOOTPRINT_WIZARD_FRAME::OnActivate( wxActivateEvent& event )
542 {
543  // Ensure we do not have old selection:
544  if( !event.GetActive() )
545  return;
546 
547  if( !m_wizardListShown )
548  {
549  m_wizardListShown = true;
550  wxPostEvent( this, wxCommandEvent( wxEVT_TOOL, ID_FOOTPRINT_WIZARD_SELECT_WIZARD ) );
551  }
552 #if 0
553  // Currently, we do not have a way to see if a Python wizard has changed,
554  // therefore the lists of parameters and option has to be rebuilt
555  // This code could be enabled when this way exists
556  bool footprintWizardsChanged = false;
557 
558  if( footprintWizardsChanged )
559  {
560  // If we are here, the library list has changed, rebuild it
563  }
564 #endif
565 }
566 
567 
568 void FOOTPRINT_WIZARD_FRAME::Update3DView( bool aMarkDirty, bool aRefresh, const wxString* aTitle )
569 {
570  wxString frm3Dtitle;
571  frm3Dtitle.Printf( _( "ModView: 3D Viewer [%s]" ), m_wizardName );
572  PCB_BASE_FRAME::Update3DView( aMarkDirty, aRefresh, &frm3Dtitle );
573 }
574 
575 
577 {
578  if( m_mainToolBar )
579  {
581  }
582  else
583  {
584  m_mainToolBar = new ACTION_TOOLBAR( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
585  KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
587  }
588 
589  // Set up toolbar
590  m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_SELECT_WIZARD, wxEmptyString,
592  _( "Select wizard script to run" ) );
593 
595  m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_RESET_TO_DEFAULT, wxEmptyString,
597  _( "Reset wizard parameters to default") );
598 
600  m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_PREVIOUS, wxEmptyString,
602  _( "Select previous parameters page" ) );
603  m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_NEXT, wxEmptyString,
605  _( "Select next parameters page" ) );
606 
607 #if 0 // Currently: the 3D viewer is not useful
610 #endif
611 
617 
618  // The footprint wizard always can export the current footprint
621  wxEmptyString, KiBitmap( BITMAPS::export_footprint_names ),
622  _( "Export footprint to editor" ) );
623 
624  // after adding the buttons to the toolbar, must call Realize() to
625  // reflect the changes
626  m_mainToolBar->Realize();
627 }
628 
629 
631 {
632  return GetBoard()->GetFirstFootprint();
633 }
634 
635 
637 {
638  // Currently, there is no vertical toolbar
639 }
640 
642 {
643  // Reload the Python plugins
644  // Because the board editor has also a plugin python menu,
645  // call PCB_EDIT_FRAME::PythonPluginsReload() if the board editor
646  // is running
647  auto brd_frame = static_cast<PCB_EDIT_FRAME*>( Kiway().Player( FRAME_PCB_EDITOR, false ) );
648 
649  if( brd_frame )
650  brd_frame->GetToolManager()->RunAction( PCB_ACTIONS::pluginsReload );
651  else
653 }
static TOOL_ACTION show3DViewer
Definition: actions.h:158
Define the structure of a toolbar with buttons that invoke ACTIONs.
wxString m_wizardName
name of the current wizard
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
KIGFX::VIEW_CONTROLS * GetViewControls() const
Return a pointer to the #VIEW_CONTROLS instance used in the panel.
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Change the visibility of an element category.
Definition: board.cpp:538
void DisplayWizardInfos()
Show all the details about the current wizard.
static TOOL_ACTION zoomInCenter
Definition: actions.h:93
const wxString WIZARD_PARAM_UNITS_MM
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
EDA_3D_VIEWER_FRAME * Get3DViewerFrame()
Model changes (required full reload)
Definition: tool_base.h:80
Implementation of conversion functions that require both schematic and board internal units.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:80
wxString m_auiPerspective
Encoded string describing the AUI layout.
bool IsDismissed()
wxListBox * m_pageList
The list of pages.
FOOTPRINT_EDITOR_SETTINGS * GetFootprintEditorSettings() const
FRAME_T
The set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Definition: frame_type.h:32
void AddScaledSeparator(wxWindow *aWindow)
Add a separator that introduces space on either side to not squash the tools when scaled.
static TOOL_ACTION pluginsReload
Scripting Actions.
Definition: pcb_actions.h:312
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void ExportSelectedFootprint(wxCommandEvent &aEvent)
Will let the caller exit from the wait loop, and get the built footprint.
virtual wxString GetParameterPageName(int aPage)=0
int m_parameterGridPage
the page currently displayed by m_parameterGrid it is most of time the m_pageList selection,...
void Add(const TOOL_ACTION &aAction, bool aIsToggleEntry=false, bool aIsCancellable=false)
Add a TOOL_ACTION-based button to the toolbar.
static constexpr GAL_TYPE GAL_FALLBACK
Add mouse and command handling (such as cut, copy, and paste) to a WX_GRID instance.
Definition: grid_tricks.h:55
static TOOL_ACTION zoomFitScreen
Definition: actions.h:96
virtual wxArrayString GetParameterTypes(int aPage)=0
WX_GRID * m_parameterGrid
The list of parameters.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
void SetAuiManager(wxAuiManager *aManager)
Set the AUI manager that this toolbar belongs to.
void SetVisibleAlls()
Change the bit-mask of visible element categories and layers.
Definition: board.cpp:515
wxAuiManager m_auimgr
#define FOOTPRINT_WIZARD_FRAME_NAME
ACTION_TOOLBAR * m_mainToolBar
virtual wxArrayString GetParameterNames(int aPage)=0
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void initParameterGrid()
Prepare the grid where parameters are displayed.
The base class for create windows for drawing purpose.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:106
const wxString WIZARD_PARAM_UNITS_DEGREES
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:589
void ClickOnPageList(wxCommandEvent &event)
void DeactivateTool()
Deactivate the currently active tool.
static TOOL_ACTION zoomOutCenter
Definition: actions.h:94
BOARD_ITEM_CONTAINER * GetModel() const override
const wxString WIZARD_PARAM_UNITS_RADIANS
void ReCreateParameterList()
Create the list of parameters for the current page.
Master controller class:
Definition: tool_manager.h:54
Stores the common settings that are saved and loaded for each window / frame.
Definition: app_settings.h:81
const wxString WIZARD_PARAM_UNITS_INTEGER
Container for display options like enable/disable some optional drawings.
wxString perspective
Definition: app_settings.h:85
void ReCreatePageList()
Create or recreate the list of parameter pages for the current wizard.
void OnActivate(wxActivateEvent &event)
Called when the frame frame is activate to reload the libraries and component lists that can be chang...
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Definition: board.h:317
virtual wxArrayString GetParameterDesignators(int aPage)=0
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:99
const wxString WIZARD_PARAM_UNITS_MILS
const wxString WIZARD_PARAM_UNITS_FLOAT
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
void DisplayBoard(BOARD *aBoard)
Add all items from the current board to the VIEW, so they can be displayed by GAL.
Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard.
void SetClearance(int aClearance)
Definition: netclass.h:125
Handle actions that are shared between different frames in PcbNew.
Definition: pcb_control.h:46
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:214
Definition of file extensions used in Kicad.
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Reset all tools (i.e.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:260
COLOR_SETTINGS * GetColorSettings() const override
Helper to retrieve the current color settings.
#define _(s)
const wxString WIZARD_PARAM_UNITS_PERCENT
#define KICAD_DEFAULT_DRAWFRAME_STYLE
EVT_GRID_CMD_CELL_CHANGED(ID_FOOTPRINT_WIZARD_PARAMETER_LIST, FOOTPRINT_WIZARD_FRAME::ParametersUpdated) FOOTPRINT_WIZARD_FRAME
WINDOW_SETTINGS m_FootprintViewer
FOOTPRINT_WIZARD * GetMyWizard()
Reloads the wizard by name.
bool m_wizardListShown
A show-once flag for the wizard list.
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
virtual void ClearMsgPanel()
Clear all messages from the message panel.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
Specialization of the wxAuiPaneInfo class for KiCad panels.
void PythonPluginsReload()
Reload the Python plugins if they are newer than the already loaded, and load new plugins if any.
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:173
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
void OnSize(wxSizeEvent &event) override
Recalculate the size of toolbars and display panel when the frame size changes.
Handles action that are shared between different applications.
Definition: common_tools.h:37
void UpdateColors()
Update the color settings in the painter and GAL.
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
BOARD * GetBoard()
show a marker on pads with no nets
Definition: layer_ids.h:202
void DefaultParameters(wxCommandEvent &event)
virtual int GetNumParameterPages()=0
Gather all the actions that are shared by tools.
Definition: pcb_actions.h:48
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:158
see class PGM_BASE
const char * name
Definition: DXF_plotter.cpp:56
Common, abstract interface for edit frames.
void DismissModal(bool aRetVal, const wxString &aResult=wxEmptyString)
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
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 SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Set a dispatcher that processes events and forwards them to tools.
static TOOL_ACTION zoomRedraw
Definition: actions.h:90
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
virtual void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
Definition: layer_ids.h:70
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...
NETCLASS * GetDefault() const
void OnGridSize(wxSizeEvent &aSizeEvent)
The selection tool: currently supports:
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:97
static constexpr int KICAD_AUI_TB_STYLE
< Default style flags used for wxAUI toolbars.
void ClearRows()
wxWidgets recently added an ASSERT which fires if the position is greater than or equal to the number...
Definition: wx_grid.h:106
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
Color settings are a bit different than most of the settings objects in that there can be more than o...
void SelectCurrentWizard(wxCommandEvent &event)
void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr) override
Update the 3D view, if the viewer is opened by this frame.
virtual wxArrayString GetParameterValues(int aPage)=0
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:54
void Process_Special_Functions(wxCommandEvent &event)
Abstract interface for BOARD_ITEMs capable of storing other items inside.
BOARD * GetBoard() const
virtual wxArrayString GetParameterHints(int aPage)=0
const wxString WIZARD_PARAM_UNITS_BOOL
Message panel definition file.
void updateView()
Rebuild the GAL view (reint tool manager, colors and drawings) must be run after any footprint change...
void UpdateMsgPanel() override
Redraw the message panel.
void ResizeParamColumns()
Expand the 'Value' column to fill available.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
void StopDrawing()
Prevent the GAL canvas from further drawing until it is recreated or StartDrawing() is called.
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:53
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
The parent class from where any footprint wizard class must derive.
WINDOW_SETTINGS * GetWindowSettings(APP_SETTINGS_BASE *aCfg) override
Return a pointer to the window settings for this frame.
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:184
void ClearToolbar()
Clear the toolbar and remove all associated menus.