KiCad PCB EDA Suite
footprint_wizard_frame.cpp File Reference
#include <fctsys.h>
#include <kiface_i.h>
#include <class_drawpanel.h>
#include <pcb_edit_frame.h>
#include <pcbnew.h>
#include <3d_viewer/eda_3d_viewer.h>
#include <msgpanel.h>
#include <macros.h>
#include <bitmaps.h>
#include <grid_tricks.h>
#include <class_board.h>
#include <class_module.h>
#include <footprint_edit_frame.h>
#include <pcbnew_id.h>
#include "footprint_wizard_frame.h"
#include <footprint_info.h>
#include <wx/grid.h>
#include <wx/tokenzr.h>
#include <wx/numformatter.h>
#include <hotkeys.h>
#include <wildcards_and_files_ext.h>
#include <base_units.h>

Go to the source code of this file.

Macros

#define MODAL_MODE_EXTRASTYLE   wxFRAME_FLOAT_ON_PARENT
 
#define AUI_PERSPECTIVE_KEY   wxT( "Fpwizard_auiPerspective" )
 

Functions

 EVT_TOOL (ID_FOOTPRINT_WIZARD_SELECT_WIZARD, FOOTPRINT_WIZARD_FRAME::SelectCurrentWizard) EVT_TOOL(ID_FOOTPRINT_WIZARD_RESET_TO_DEFAULT
 
FOOTPRINT_WIZARD_FRAME::DefaultParameters EVT_TOOL (ID_FOOTPRINT_WIZARD_NEXT, FOOTPRINT_WIZARD_FRAME::Process_Special_Functions) EVT_TOOL(ID_FOOTPRINT_WIZARD_PREVIOUS
 
FOOTPRINT_WIZARD_FRAME::DefaultParameters FOOTPRINT_WIZARD_FRAME::Process_Special_Functions EVT_TOOL (ID_FOOTPRINT_WIZARD_DONE, FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint) EVT_TOOL(ID_FOOTPRINT_WIZARD_SHOW_3D_VIEW
 
FOOTPRINT_WIZARD_FRAME::DefaultParameters FOOTPRINT_WIZARD_FRAME::Process_Special_Functions FOOTPRINT_WIZARD_FRAME::Show3D_Frame EVT_GRID_CMD_CELL_CHANGED (ID_FOOTPRINT_WIZARD_PARAMETER_LIST, FOOTPRINT_WIZARD_FRAME::ParametersUpdated) FOOTPRINT_WIZARD_FRAME
 

Macro Definition Documentation

#define AUI_PERSPECTIVE_KEY   wxT( "Fpwizard_auiPerspective" )
#define MODAL_MODE_EXTRASTYLE   wxFRAME_FLOAT_ON_PARENT

Function Documentation

Definition at line 87 of file footprint_wizard_frame.cpp.

References F_Cu, FRAME_PCB_FOOTPRINT_WIZARD_MODAL, g_Module_Viewer_Hotkeys_Descr, GetBoard(), EDA_PANEINFO::HorizontalToolbarPane(), ID_POPUP_GRID_LEVEL_1000, EDA_PANEINFO::InfoToolbarPane(), KiBitmap(), LAYER_NO_CONNECTS, EDA_PANEINFO::MessageToolbarPane(), BOARD::SetElementVisibility(), and BOARD::SetVisibleAlls().

109  :
110  PCB_BASE_FRAME( aKiway, aParent, aFrameType, _( "Footprint Wizard" ),
111  wxDefaultPosition, wxDefaultSize,
113  : KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP,
115 {
116  wxASSERT( aFrameType == FRAME_PCB_FOOTPRINT_WIZARD_MODAL );
117 
118  // This frame is always show modal:
119  SetModal( true );
120 
121  m_showAxis = true; // true to draw axis.
122 
123  // Give an icon
124  wxIcon icon;
125  icon.CopyFromBitmap( KiBitmap( module_wizard_xpm) );
126  SetIcon( icon );
127 
128  m_hotkeysDescrList = g_Module_Viewer_Hotkeys_Descr;
129  m_wizardName.Empty();
130 
131  SetBoard( new BOARD() );
132 
133  // Ensure all layers and items are visible:
135  SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
136  GetScreen()->m_Center = true; // Center coordinate origins on screen.
137 
138  LoadSettings( config() );
139 
140  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
141 
142  // Set some display options here, because the FOOTPRINT_WIZARD_FRAME
143  // does not have a config menu to do that:
144  auto disp_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
145  disp_opts->m_DisplayPadIsol = false;
146  disp_opts->m_DisplayPadNum = true;
148 
149  GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
150 
151  ReCreateHToolbar();
152  ReCreateVToolbar();
153  SetActiveLayer( F_Cu );
154 
155  // Create the parameters panel
156  m_parametersPanel = new wxPanel( this, wxID_ANY );
157 
158  m_pageList = new wxListBox( m_parametersPanel, ID_FOOTPRINT_WIZARD_PAGE_LIST,
159  wxDefaultPosition, wxDefaultSize,
160  0, NULL, wxLB_HSCROLL );
161 
162  m_parameterGrid = new wxGrid( m_parametersPanel, ID_FOOTPRINT_WIZARD_PARAMETER_LIST );
163  initParameterGrid();
164  m_parameterGrid->PushEventHandler( new GRID_TRICKS( m_parameterGrid ) );
165 
166  ReCreatePageList();
167 
168  wxBoxSizer* parametersSizer = new wxBoxSizer( wxHORIZONTAL );
169  parametersSizer->Add( m_pageList, 0, wxEXPAND|wxALL, 5 );
170  parametersSizer->Add( m_parameterGrid, 1, wxEXPAND|wxALL, 5 );
171  m_parametersPanel->SetSizer( parametersSizer );
172  m_parametersPanel->Layout();
173 
174  // Create the build message box
175  m_buildMessageBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString,
176  wxDefaultPosition, wxDefaultSize,
177  wxTE_MULTILINE|wxTE_READONLY );
178 
179  DisplayWizardInfos();
180 
181  m_auimgr.SetManagedWindow( this );
182 
183  EDA_PANEINFO horiztb;
184  horiztb.HorizontalToolbarPane();
185 
186  EDA_PANEINFO info;
187  info.InfoToolbarPane();
188 
189  EDA_PANEINFO mesg;
190  mesg.MessageToolbarPane();
191 
192  // Manage main toolbal
193  m_auimgr.AddPane( m_mainToolBar, wxAuiPaneInfo( horiztb ).
194  Name( wxT ("m_mainToolBar" ) ).Top().Row( 0 ) );
195 
196  // Manage the parameters panel
197  EDA_PANEINFO parametersPaneInfo;
198  parametersPaneInfo.InfoToolbarPane().Name( wxT( "m_parametersPanel" ) ).Left().Position( 0 );
199  m_auimgr.AddPane( m_parametersPanel, wxAuiPaneInfo( parametersPaneInfo ) );
200 
201  // Manage the build message box
202  EDA_PANEINFO buildMessageBoxInfo;
203  buildMessageBoxInfo.InfoToolbarPane().Name( wxT( "m_buildMessageBox" ) ).Left().Position( 1 );
204  m_auimgr.AddPane( m_buildMessageBox, wxAuiPaneInfo( buildMessageBoxInfo ) );
205 
206  // Manage the draw panel
207  m_auimgr.AddPane( m_canvas,
208  wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
209 
210  // Manage the message panel
211  m_auimgr.AddPane( m_messagePanel,
212  wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(1) );
213 
214  // Give a min size to the parameters
215  m_auimgr.GetPane( m_parametersPanel ).MinSize( wxSize( 360, 180 ) );
216 
217  m_auimgr.LoadPerspective( m_auiPerspective );
218 
219  // Now Drawpanel is sized, we can use BestZoom to show the component (if any)
220 #ifdef USE_WX_GRAPHICS_CONTEXT
221  GetScreen()->SetScalingFactor( BestZoom() );
222 #else
223  Zoom_Automatique( false );
224 #endif
225 
226  // Do not Run a dialog here: on some Window Managers, it creates issues.
227  // Reason: the FOOTPRINT_WIZARD_FRAME is run as modal;
228  // It means the call to FOOTPRINT_WIZARD_FRAME::ShowModal will change the
229  // Event Loop Manager, and stop the one created by the dialog.
230  // It does not happen on all W.M., perhaps due to the way the order events are called
231 // SelectFootprintWizard();
232 }
EDA_PANEINFO & HorizontalToolbarPane()
Function HorizontalToolbarPane Change *this to a horizontal toolbar for KiCad.
struct EDA_HOTKEY_CONFIG g_Module_Viewer_Hotkeys_Descr[]
show a marker on pads with no nets
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Function SetElementVisibility changes the visibility of an element category.
Class GRID_TRICKS is used to add cut, copy, and paste to an otherwise unmodied wxGrid instance...
Definition: grid_tricks.h:34
void SetVisibleAlls()
Function SetVisibleAlls changes the bit-mask of visible element categories and layers.
#define FOOTPRINT_WIZARD_FRAME_NAME
Definition: draw_frame.h:52
Specialization of the wxAuiPaneInfo class for KiCad panels.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
Class PCB_DISPLAY_OPTIONS handles display options like enable/disable some optional drawings...
#define KICAD_DEFAULT_DRAWFRAME_STYLE
EDA_PANEINFO & InfoToolbarPane()
Function InfoToolbarPane Change *this to a information panel for for KiCad.
BOARD * GetBoard()
EDA_PANEINFO & MessageToolbarPane()
Function MessageToolbarPane Change *this to a message pane for KiCad.
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:169
#define MODAL_MODE_EXTRASTYLE
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...