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-2015 Wayne Stambaugh <stambaughw@verizon.net>
7  * Copyright (C) 2004-2019 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 <fctsys.h>
28 #include <kiface_i.h>
29 #include <pcb_draw_panel_gal.h>
30 #include <pcb_edit_frame.h>
32 #include <msgpanel.h>
33 #include <macros.h>
34 #include <bitmaps.h>
35 #include <grid_tricks.h>
36 #include <class_board.h>
37 #include <footprint_edit_frame.h>
38 #include <pcbnew_id.h>
39 #include "footprint_wizard_frame.h"
40 #include <wx/tokenzr.h>
41 #include <wx/numformatter.h>
43 #include <base_units.h>
44 #include <tool/tool_manager.h>
45 #include <tool/tool_dispatcher.h>
46 #include <tool/action_toolbar.h>
47 #include <tool/common_tools.h>
48 #include "tools/selection_tool.h"
49 #include "tools/pcbnew_control.h"
50 #include "tools/pcb_actions.h"
51 
52 
53 BEGIN_EVENT_TABLE( FOOTPRINT_WIZARD_FRAME, EDA_DRAW_FRAME )
54 
55  // Window events
59 
60  // Toolbar events
66 
67  // listbox events
70  FOOTPRINT_WIZARD_FRAME::ParametersUpdated )
71 END_EVENT_TABLE()
72 
73 
74 // Note: our FOOTPRINT_WIZARD_FRAME is always modal.
75 
76 FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* aParent,
77  FRAME_T aFrameType ) :
78  PCB_BASE_FRAME( aKiway, aParent, aFrameType, _( "Footprint Wizard" ),
79  wxDefaultPosition, wxDefaultSize,
80  aParent ? KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT
81  : KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP,
83  m_wizardListShown( false )
84 {
85  wxASSERT( aFrameType == FRAME_FOOTPRINT_WIZARD );
86 
87  // This frame is always show modal:
88  SetModal( true );
89 
90  // Give an icon
91  wxIcon icon;
92  icon.CopyFromBitmap( KiBitmap( module_wizard_xpm) );
93  SetIcon( icon );
94 
95  m_wizardName.Empty();
96 
97  SetBoard( new BOARD() );
98 
99  // Ensure all layers and items are visible:
101  SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
102  GetScreen()->m_Center = true; // Center coordinate origins on screen.
103 
104  LoadSettings( config() );
105 
106  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
107 
108  // Set some display options here, because the FOOTPRINT_WIZARD_FRAME
109  // does not have a config menu to do that:
110 
111  // the footprint wizard frame has no config menu. so use some settings
112  // from the caller, or force some options:
113  PCB_BASE_FRAME* caller = dynamic_cast<PCB_BASE_FRAME*>( aParent );
114 
115  if( caller )
116  SetUserUnits( caller->GetUserUnits() );
117 
118  PCB_DISPLAY_OPTIONS disp_opts = GetDisplayOptions();
119  // In viewer, the default net clearance is not known (it depends on the actual board).
120  // So we do not show the default clearance, by setting it to 0
121  // The footprint or pad specific clearance will be shown
122  GetBoard()->GetDesignSettings().GetDefault()->SetClearance(0);
123 
124  disp_opts.m_DisplayPadIsol = true;
125  disp_opts.m_DisplayPadNum = true;
126  SetDisplayOptions( disp_opts );
127 
129 
130  GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
131 
132  // Create GAL canvas
133 #ifdef __WXMAC__
134  // Cairo renderer doesn't handle Retina displays
136 #else
138 #endif
139  PCB_DRAW_PANEL_GAL* gal_drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
140  GetGalDisplayOptions(), backend );
141  SetCanvas( gal_drawPanel );
142 
143  // Create the manager and dispatcher & route draw panel events to the dispatcher
144  m_toolManager = new TOOL_MANAGER;
145  m_toolManager->SetEnvironment( GetBoard(), gal_drawPanel->GetView(),
146  gal_drawPanel->GetViewControls(), this );
147  m_actions = new PCB_ACTIONS();
148  m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
149  gal_drawPanel->SetEventDispatcher( m_toolDispatcher );
150 
151  m_toolManager->RegisterTool( new PCBNEW_CONTROL );
152  m_toolManager->RegisterTool( new SELECTION_TOOL ); // for std context menus (zoom & grid)
153  m_toolManager->RegisterTool( new COMMON_TOOLS );
154  m_toolManager->InitTools();
155 
156  // Run the control tool, it is supposed to be always active
157  m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
158 
159  // Create the toolbars
160  ReCreateHToolbar();
161  ReCreateVToolbar();
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, NULL,
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_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).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.m_fullscreenCursor = true;
208  galOpts.m_forceDisplayCursor = true;
209  galOpts.m_axesEnabled = true;
210 
211  GetCanvas()->GetView()->SetScale( GetZoomLevelCoeff() / GetScreen()->GetZoom() );
212  ActivateGalCanvas();
213  updateView();
214 
215  SetActiveLayer( F_Cu );
216  GetToolManager()->RunAction( ACTIONS::zoomFitScreen, false );
217 
218  // Do not Run a dialog here: on some Window Managers, it creates issues.
219  // Reason: the FOOTPRINT_WIZARD_FRAME is run as modal;
220  // It means the call to FOOTPRINT_WIZARD_FRAME::ShowModal will change the
221  // Event Loop Manager, and stop the one created by the dialog.
222  // It does not happen on all W.M., perhaps due to the way the order events are called
223  // See the call in onActivate instead
224 }
225 
226 
228 {
229  // Delete the GRID_TRICKS.
230  m_parameterGrid->PopEventHandler( true );
231 
232  GetCanvas()->StopDrawing();
233  // Be sure any event cannot be fired after frame deletion:
234  GetCanvas()->SetEvtHandlerEnabled( false );
235 
236  // Be sure a active tool (if exists) is desactivated:
237  if( m_toolManager )
239 
240  EDA_3D_VIEWER* draw3DFrame = Get3DViewerFrame();
241 
242  if( draw3DFrame )
243  draw3DFrame->Destroy();
244 
245  // Now this frame can be deleted
246 }
247 
248 
249 void FOOTPRINT_WIZARD_FRAME::OnCloseWindow( wxCloseEvent& Event )
250 {
251  SaveSettings( config() );
252 
253  if( IsModal() )
254  {
255  // Only dismiss a modal frame once, so that the return values set by
256  // the prior DismissModal() are not bashed for ShowModal().
257  if( !IsDismissed() )
258  DismissModal( false );
259  }
260  else
261  {
262  Destroy();
263  }
264 }
265 
266 
268 {
269  DismissModal( true );
270  Close();
271 }
272 
273 
274 void FOOTPRINT_WIZARD_FRAME::OnGridSize( wxSizeEvent& aSizeEvent )
275 {
276  // Resize the parameter columns
278 
279  aSizeEvent.Skip();
280 }
281 
282 
283 void FOOTPRINT_WIZARD_FRAME::OnSize( wxSizeEvent& SizeEv )
284 {
285  if( m_auimgr.GetManagedWindow() )
286  m_auimgr.Update();
287 
288  SizeEv.Skip();
289 }
290 
291 
293 {
294  GetCanvas()->UseColorScheme( &Settings().Colors() );
298  UpdateMsgPanel();
299 }
300 
301 
303 {
304  BOARD_ITEM* footprint = GetBoard()->GetFirstModule();
305 
306  if( footprint )
307  {
308  MSG_PANEL_ITEMS items;
309 
310  footprint->GetMsgPanelInfo( m_userUnits, items );
311  SetMsgPanel( items );
312  }
313  else
314  ClearMsgPanel();
315 }
316 
317 
319 {
320  m_parameterGridPage = -1;
321 
322  // Prepare the grid where parameters are displayed
323 
324  m_parameterGrid->CreateGrid( 0, 3 );
325 
326  m_parameterGrid->SetColLabelValue( WIZ_COL_NAME, _( "Parameter" ) );
327  m_parameterGrid->SetColLabelValue( WIZ_COL_VALUE, _( "Value" ) );
328  m_parameterGrid->SetColLabelValue( WIZ_COL_UNITS, _( "Units" ) );
329 
331  m_parameterGrid->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE );
332  m_parameterGrid->AutoSizeColumns();
333 
334  m_parameterGrid->AutoSizeRows();
335  m_parameterGrid->SetRowLabelSize( 0 );
336 
337  m_parameterGrid->DisableDragGridSize();
338  m_parameterGrid->DisableDragColSize();
339 
340  m_parameterGrid->Connect( wxEVT_SIZE,
341  wxSizeEventHandler( FOOTPRINT_WIZARD_FRAME::OnGridSize ),
342  NULL, this );
343 }
344 
345 
347 {
348  if( m_pageList == NULL )
349  return;
350 
351  FOOTPRINT_WIZARD* footprintWizard = GetMyWizard();
352 
353  if( !footprintWizard )
354  return;
355 
356  m_pageList->Clear();
357  int max_page = footprintWizard->GetNumParameterPages();
358 
359  for( int i = 0; i<max_page; i++ )
360  {
361  wxString name = footprintWizard->GetParameterPageName( i );
362  m_pageList->Append( name );
363  }
364 
365  m_pageList->SetSelection( 0, true );
366 
370  GetCanvas()->Refresh();
371 }
372 
373 
375 {
376  if( m_parameterGrid == NULL )
377  return;
378 
379  FOOTPRINT_WIZARD* footprintWizard = GetMyWizard();
380 
381  if( footprintWizard == NULL )
382  return;
383 
384  m_parameterGrid->Freeze();
385 
386  m_parameterGrid->ClearGrid();
387  m_parameterGridPage = m_pageList->GetSelection();
388 
389  if( m_parameterGridPage < 0 ) // Should not happen
390  return;
391 
392  // Get the list of names, values, types, hints and designators
393  wxArrayString designatorsList = footprintWizard->GetParameterDesignators( m_parameterGridPage );
394  wxArrayString namesList = footprintWizard->GetParameterNames( m_parameterGridPage );
395  wxArrayString valuesList = footprintWizard->GetParameterValues( m_parameterGridPage );
396  wxArrayString typesList = footprintWizard->GetParameterTypes( m_parameterGridPage );
397  wxArrayString hintsList = footprintWizard->GetParameterHints( m_parameterGridPage );
398 
399  // Dimension the wxGrid
400  if( m_parameterGrid->GetNumberRows() > 0 )
401  m_parameterGrid->DeleteRows( 0, m_parameterGrid->GetNumberRows() );
402 
403  m_parameterGrid->AppendRows( namesList.size() );
404 
405  wxString designator, name, value, units, hint;
406 
407  for( unsigned int i = 0; i< namesList.size(); i++ )
408  {
409  designator = designatorsList[i];
410  name = namesList[i];
411  value = valuesList[i];
412  units = typesList[i];
413  hint = hintsList[i];
414 
415  m_parameterGrid->SetRowLabelValue( i, designator );
416 
417  // Set the 'Name'
418  m_parameterGrid->SetCellValue( i, WIZ_COL_NAME, name );
419  m_parameterGrid->SetReadOnly( i, WIZ_COL_NAME );
420 
421  // Boolean parameters are displayed using a checkbox
422  if( units == WIZARD_PARAM_UNITS_BOOL )
423  {
424  // Set to ReadOnly as we delegate interactivity to GRID_TRICKS
425  m_parameterGrid->SetReadOnly( i, WIZ_COL_VALUE );
426  m_parameterGrid->SetCellRenderer( i, WIZ_COL_VALUE, new wxGridCellBoolRenderer );
427  }
428  // Parameters that can be selected from a list of multiple options
429  else if( units.Contains( "," ) ) // Indicates list of available options
430  {
431  wxStringTokenizer tokenizer( units, "," );
432  wxArrayString options;
433 
434  while( tokenizer.HasMoreTokens() )
435  {
436  options.Add( tokenizer.GetNextToken() );
437  }
438 
439  m_parameterGrid->SetCellEditor( i, WIZ_COL_VALUE, new wxGridCellChoiceEditor( options ) );
440 
441  units = wxT( "" );
442  }
443  // Integer parameters
444  else if( units == WIZARD_PARAM_UNITS_INTEGER )
445  {
446  m_parameterGrid->SetCellEditor( i, WIZ_COL_VALUE, new wxGridCellNumberEditor );
447  }
448  // Non-integer numerical parameters
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  m_parameterGrid->SetCellEditor( i, WIZ_COL_VALUE, new wxGridCellFloatEditor );
457 
458  // Convert separators to the locale-specific character
459  value.Replace( ",", wxNumberFormatter::GetDecimalSeparator() );
460  value.Replace( ".", wxNumberFormatter::GetDecimalSeparator() );
461  }
462 
463  // Set the 'Units'
464  m_parameterGrid->SetCellValue( i, WIZ_COL_UNITS, units );
465  m_parameterGrid->SetReadOnly( i, WIZ_COL_UNITS );
466 
467  // Set the 'Value'
468  m_parameterGrid->SetCellValue( i, WIZ_COL_VALUE, value );
469  }
470 
472 
473  m_parameterGrid->Thaw();
474 }
475 
477 {
478  // Parameter grid is not yet configured
479  if( ( m_parameterGrid == NULL ) || ( m_parameterGrid->GetNumberCols() == 0 ) )
480  return;
481 
482  // first auto-size the columns to ensure enough space around text
483  m_parameterGrid->AutoSizeColumns();
484 
485  // Auto-size the value column
486  int width = m_parameterGrid->GetClientSize().GetWidth() -
487  m_parameterGrid->GetRowLabelSize() -
488  m_parameterGrid->GetColSize( WIZ_COL_NAME ) -
489  m_parameterGrid->GetColSize( WIZ_COL_UNITS );
490 
491  if( width > m_parameterGrid->GetColMinimalAcceptableWidth() )
492  {
493  m_parameterGrid->SetColSize( WIZ_COL_VALUE, width );
494  }
495 }
496 
497 
498 void FOOTPRINT_WIZARD_FRAME::ClickOnPageList( wxCommandEvent& event )
499 {
500  if( m_pageList->GetSelection() >= 0 )
501  {
503  GetCanvas()->Refresh();
505  }
506 }
507 
508 
509 #define AUI_PERSPECTIVE_KEY wxT( "Fpwizard_auiPerspective" )
510 
511 
512 void FOOTPRINT_WIZARD_FRAME::LoadSettings( wxConfigBase* aCfg )
513 {
515 
516  aCfg->Read( AUI_PERSPECTIVE_KEY, &m_auiPerspective );
517 }
518 
519 
520 void FOOTPRINT_WIZARD_FRAME::SaveSettings( wxConfigBase* aCfg )
521 {
523 
524  aCfg->Write( AUI_PERSPECTIVE_KEY, m_auimgr.SavePerspective() );
525 }
526 
527 
528 void FOOTPRINT_WIZARD_FRAME::OnActivate( wxActivateEvent& event )
529 {
530  // Ensure we do not have old selection:
531  if( !event.GetActive() )
532  return;
533 
534  if( !m_wizardListShown )
535  {
536  m_wizardListShown = true;
537  wxPostEvent( this, wxCommandEvent( wxEVT_TOOL, ID_FOOTPRINT_WIZARD_SELECT_WIZARD ) );
538  }
539 #if 0
540  // Currently, we do not have a way to see if a Python wizard has changed,
541  // therefore the lists of parameters and option has to be rebuilt
542  // This code could be enabled when this way exists
543  bool footprintWizardsChanged = false;
544 
545  if( footprintWizardsChanged )
546  {
547  // If we are here, the library list has changed, rebuild it
550  }
551 #endif
552 }
553 
554 
560 void FOOTPRINT_WIZARD_FRAME::Update3DView( bool aForceReload, const wxString* aTitle )
561 {
562  wxString frm3Dtitle;
563  frm3Dtitle.Printf( _( "ModView: 3D Viewer [%s]" ), GetChars( m_wizardName ) );
564  PCB_BASE_FRAME::Update3DView( aForceReload, &frm3Dtitle );
565 }
566 
567 
569 {
570  wxString msg;
571 
572  if( !m_mainToolBar )
573  {
574  m_mainToolBar = new ACTION_TOOLBAR( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
575  KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
576 
577  // Set up toolbar
578  m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_SELECT_WIZARD, wxEmptyString,
580  _( "Select wizard script to run" ) );
581 
582  m_mainToolBar->AddSeparator();
583  m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_RESET_TO_DEFAULT, wxEmptyString,
584  KiBitmap( reload_xpm ),
585  _( "Reset wizard parameters to default") );
586 
587  m_mainToolBar->AddSeparator();
588  m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_PREVIOUS, wxEmptyString,
590  _( "Select previous parameters page" ) );
591  m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_NEXT, wxEmptyString,
593  _( "Select next parameters page" ) );
594 
595  m_mainToolBar->AddSeparator();
597 
598  m_mainToolBar->AddSeparator();
603 
604  // The footprint wizard always can export the current footprint
605  m_mainToolBar->AddSeparator();
607  wxEmptyString, KiBitmap( export_footprint_names_xpm ),
608  _( "Export footprint to editor" ) );
609 
610  // after adding the buttons to the toolbar, must call Realize() to
611  // reflect the changes
612  m_mainToolBar->Realize();
613  }
614 
615  m_mainToolBar->Refresh();
616 }
617 
618 
620 {
621  // Currently, there is no vertical toolbar
622 }
623 
624 #if defined(KICAD_SCRIPTING)
626 {
627  // Reload the Python plugins
628  // Because the board editor has also a plugin python menu,
629  // call PCB_EDIT_FRAME::PythonPluginsReload() if the board editor
630  // is running
631  auto brd_frame = static_cast<PCB_EDIT_FRAME*>( Kiway().Player( FRAME_PCB_EDITOR, false ) );
632 
633  if( brd_frame )
634  brd_frame->PythonPluginsReload();
635  else
637 }
638 #endif
639 
640 
void Update3DView(bool aForceReload, const wxString *aTitle) override
Function Update3D_Frame must be called after a footprint selection Updates the 3D view and 3D frame t...
static TOOL_ACTION show3DViewer
Definition: actions.h:148
#define AUI_PERSPECTIVE_KEY
FOOTPRINT_WIZARD_FRAME.
ACTION_TOOLBAR.
show a marker on pads with no nets
wxString m_wizardName
name of the current wizard
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_holder.h:56
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel.
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Function SetElementVisibility changes the visibility of an element category.
void DisplayWizardInfos()
Function DisplayWizardInfos Shows all the details about the current wizard.
static TOOL_ACTION zoomInCenter
Definition: actions.h:90
const wxString WIZARD_PARAM_UNITS_MM
void SaveSettings(wxConfigBase *aCfg) override
Saves common frame parameters to a configuration data file.
Model changes (required full reload)
Definition: tool_base.h:82
Implementation of conversion functions that require both schematic and board internal units.
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
wxString m_auiPerspective
Encoded string describing the AUI layout.
bool IsDismissed()
Function IsDismissed returns false only if both the frame is acting in modal mode and it has not been...
const BITMAP_OPAQUE module_wizard_xpm[1]
void LoadSettings(wxConfigBase *aCfg) override
Load common frame parameters from a configuration file.
wxListBox * m_pageList
The list of pages.
FRAME_T
Enum FRAME_T is the set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Definition: frame_type.h:34
SELECTION_TOOL.
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void ExportSelectedFootprint(wxCommandEvent &aEvent)
Function ExportSelectedFootprint(); will let the caller exit from the wait loop, and get the built fo...
virtual wxString GetParameterPageName(int aPage)=0
Function GetParameterPageName.
int m_parameterGridPage
the page currently displayed by m_parameterGrid it is most of time the m_pageList selection,...
GRID_TRICKS is used to add mouse and command handling (such as cut, copy, and paste) to a WX_GRID ins...
Definition: grid_tricks.h:51
void Add(const TOOL_ACTION &aAction, bool aIsToggleEntry=false)
Function Add() Adds a TOOL_ACTION-based button to the toolbar.
static TOOL_ACTION zoomFitScreen
Definition: actions.h:93
virtual wxArrayString GetParameterTypes(int aPage)=0
Function GetParameterTypes.
WX_GRID * m_parameterGrid
The list of parameters.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
virtual wxConfigBase * config()
Returns the wxConfigBase used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:530
void SetVisibleAlls()
Function SetVisibleAlls changes the bit-mask of visible element categories and layers.
wxAuiManager m_auimgr
#define FOOTPRINT_WIZARD_FRAME_NAME
ACTION_TOOLBAR * m_mainToolBar
virtual wxArrayString GetParameterNames(int aPage)=0
Function GetParameterNames.
void initParameterGrid()
Function initParameterGrid Prepare the grid where parameters are displayed.
The base class for create windows for drawing purpose.
const wxString WIZARD_PARAM_UNITS_DEGREES
void SaveSettings(wxConfigBase *aCfg) override
Saves common frame parameters to a configuration data file.
void ClickOnPageList(wxCommandEvent &event)
void DeactivateTool()
Function DeactivateTool() Deactivates the currently active tool.
static TOOL_ACTION zoomOutCenter
Definition: actions.h:91
PCBNEW_CONTROL.
This file contains miscellaneous commonly used macros and functions.
const BITMAP_OPAQUE reload_xpm[1]
Definition: reload.cpp:71
const wxString WIZARD_PARAM_UNITS_RADIANS
void ReCreateParameterList()
Function ReCreateParameterList Creates the list of parameters for the current page.
TOOL_MANAGER.
Definition: tool_manager.h:50
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
const wxString WIZARD_PARAM_UNITS_INTEGER
PCB_DISPLAY_OPTIONS handles display options like enable/disable some optional drawings.
void ReCreatePageList()
Function ReCreatePageList Creates or recreates the list of parameter pages for the current wizard.
void OnActivate(wxActivateEvent &event)
Function OnActivate is called when the frame frame is activate to reload the libraries and component ...
virtual wxArrayString GetParameterDesignators(int aPage)=0
Function GetParamaterDesignators.
#define NULL
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)
Function DisplayBoard adds all items from the current board to the VIEW, so they can be displayed by ...
PCB_GENERAL_SETTINGS & Settings()
const BITMAP_OPAQUE lib_previous_xpm[1]
MODULE * GetFirstModule() const
Gets the first module in the list (used in footprint viewer/editor) or NULL if none.
Definition: class_board.h:275
Definition of file extensions used in Kicad.
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Function ResetTools() Resets all tools (i.e.
KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the s...
Definition: kiway.h:274
const BITMAP_OPAQUE lib_next_xpm[1]
Definition: lib_next.cpp:82
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
bool IsModal()
Definition: kiway_player.h:163
FOOTPRINT_WIZARD * GetMyWizard()
Function GetMyWizard Reloads the wizard by name.
bool m_wizardListShown
A show-once flag for the wizard list.
virtual void ClearMsgPanel()
Clear all messages from the message panel.
virtual KIGFX::PCB_VIEW * GetView() const override
Function GetView() Returns 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 Do n...
void LoadSettings(wxConfigBase *aCfg) override
Load common frame parameters from a configuration file.
void OnSize(wxSizeEvent &event) override
Recalculate the size of toolbars and display panel when the frame size changes.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
void UseColorScheme(const COLORS_DESIGN_SETTINGS *aSettings)
Function UseColorScheme Applies layer color settings.
COMMON_TOOLS.
Definition: common_tools.h:38
TOOL_DISPATCHER.
BOARD * GetBoard()
void DefaultParameters(wxCommandEvent &event)
virtual int GetNumParameterPages()=0
Function GetNumParameterPages.
PCB_ACTIONS.
Definition: pcb_actions.h:62
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:101
Declaration of the eda_3d_viewer class.
const char * name
Definition: DXF_plotter.cpp:60
NETCLASSPTR GetDefault() const
Function GetDefault.
void DismissModal(bool aRetVal, const wxString &aResult=wxEmptyString)
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:160
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Function SetEventDispatcher() Sets a dispatcher that processes events and forwards them to tools.
#define _(s)
Definition: 3d_actions.cpp:31
static TOOL_ACTION zoomRedraw
Definition: actions.h:87
void OnGridSize(wxSizeEvent &aSizeEvent)
EDA_UNITS m_userUnits
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, EDA_BASE_FRAME *aFrame)
Sets the work environment (model, view, view controls and the parent window).
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:102
static constexpr int KICAD_AUI_TB_STYLE
Default style flags used for wxAUI toolbars
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
const BITMAP_OPAQUE export_footprint_names_xpm[1]
void SelectCurrentWizard(wxCommandEvent &event)
Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard.
Definition: eda_3d_viewer.h:56
virtual wxArrayString GetParameterValues(int aPage)=0
Function GetParameterValues.
void Process_Special_Functions(wxCommandEvent &event)
TOOL_MANAGER * m_toolManager
virtual void GetMsgPanelInfo(EDA_UNITS aUnits, std::vector< MSG_PANEL_ITEM > &aList)
Function GetMsgPanelInfo populates aList of MSG_PANEL_ITEM objects with it's internal state for displ...
Definition: base_struct.h:318
void OnCloseWindow(wxCloseEvent &Event) override
void PythonPluginsReloadBase()
Helper function PythonPluginsReloadBase Reload Python plugins if they are newer than the already load...
BOARD * GetBoard() const
virtual wxArrayString GetParameterHints(int aPage)=0
Function GetParameterHints.
virtual void Update3DView(bool aForceReload, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
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
redraws the message panel.
void ResizeParamColumns()
Expand the 'Value' column to fill available.
EDA_3D_VIEWER * Get3DViewerFrame()
PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
void StopDrawing()
Function StopDrawing() Prevents the GAL canvas from further drawing till it is recreated or StartDraw...
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:47
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
FOOTPRINT_WIZARD This is the parent class from where any footprint wizard class must derive.