KiCad PCB EDA Suite
footprint_wizard_frame.cpp File Reference
#include <fctsys.h>
#include <kiface_i.h>
#include <class_drawpanel.h>
#include <wxPcbStruct.h>
#include <pcbnew.h>
#include <3d_viewer/eda_3d_viewer.h>
#include <msgpanel.h>
#include <macros.h>
#include <bitmaps.h>
#include <class_board.h>
#include <class_module.h>
#include <module_editor_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 FOOTPRINT_WIZARD_FRAME_NAME   wxT( "FootprintWizard" )
 
#define MODAL_MODE_EXTRASTYLE   wxFRAME_FLOAT_ON_PARENT
 
#define PAGE_LIST_WIDTH_KEY   wxT( "Fpwizard_Pagelist_width" )
 
#define PARAMLIST_WIDTH_KEY   wxT( "Fpwizard_Paramlist_width" )
 
#define MESSAGE_BOX_POSX_KEY   wxT( "Fpwizard_Msg_PosX" )
 
#define MESSAGE_BOX_POSY_KEY   wxT( "Fpwizard_Msg_PosY" )
 
#define MESSAGE_BOX_SIZEX_KEY   wxT( "Fpwizard_Msg_SIZEX" )
 
#define MESSAGE_BOX_SIZEY_KEY   wxT( "Fpwizard_Msg_SIZEY" )
 

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 FOOTPRINT_WIZARD_FRAME_NAME   wxT( "FootprintWizard" )
#define MESSAGE_BOX_POSX_KEY   wxT( "Fpwizard_Msg_PosX" )
#define MESSAGE_BOX_POSY_KEY   wxT( "Fpwizard_Msg_PosY" )
#define MESSAGE_BOX_SIZEX_KEY   wxT( "Fpwizard_Msg_SIZEX" )
#define MESSAGE_BOX_SIZEY_KEY   wxT( "Fpwizard_Msg_SIZEY" )
#define MODAL_MODE_EXTRASTYLE   wxFRAME_FLOAT_ON_PARENT
#define PAGE_LIST_WIDTH_KEY   wxT( "Fpwizard_Pagelist_width" )
#define PARAMLIST_WIDTH_KEY   wxT( "Fpwizard_Paramlist_width" )

Function Documentation

Definition at line 86 of file footprint_wizard_frame.cpp.

References FRAME_PCB_FOOTPRINT_WIZARD_MODAL, g_Module_Viewer_Hokeys_Descr, GetBoard(), EDA_PANEINFO::HorizontalToolbarPane(), ID_POPUP_GRID_LEVEL_1000, EDA_PANEINFO::InfoToolbarPane(), KiBitmap(), LAYER_NO_CONNECTS, DISPLAY_OPTIONS::m_DisplayPadIsol, DISPLAY_OPTIONS::m_DisplayPadNum, EDA_PANEINFO::MessageToolbarPane(), BOARD::SetElementVisibility(), and BOARD::SetVisibleAlls().

110  :
111  PCB_BASE_FRAME( aKiway, aParent, aFrameType, _( "Footprint Wizard" ),
112  wxDefaultPosition, wxDefaultSize,
114  : KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP,
116 {
117  wxASSERT( aFrameType == FRAME_PCB_FOOTPRINT_WIZARD_MODAL );
118 
119  // This frame is always show modal:
120  SetModal( true );
121 
122  m_messagesFrame = NULL; // This windows will be created the first time a wizard is loaded
123  m_showAxis = true; // true to draw axis.
124 
125  // Give an icon
126  wxIcon icon;
127  icon.CopyFromBitmap( KiBitmap( module_wizard_xpm) );
128  SetIcon( icon );
129 
130  m_hotkeysDescrList = g_Module_Viewer_Hokeys_Descr;
131  m_wizardName.Empty();
132 
133  SetBoard( new BOARD() );
134 
135  // Ensure all layers and items are visible:
137  SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
138  GetScreen()->m_Center = true; // Center coordinate origins on screen.
139 
140  LoadSettings( config() );
141 
142  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
143 
144  // Set some display options here, because the FOOTPRINT_WIZARD_FRAME
145  // does not have a config menu to do that:
146  DISPLAY_OPTIONS* disp_opts = (DISPLAY_OPTIONS*) GetDisplayOptions();
147  disp_opts->m_DisplayPadIsol = false;
148  disp_opts->m_DisplayPadNum = true;
150 
151  GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
152 
153  ReCreateHToolbar();
154  ReCreateVToolbar();
155 
156  // Creates the parameter pages list
157  m_pageList = new wxListBox( this, ID_FOOTPRINT_WIZARD_PAGE_LIST,
158  wxDefaultPosition, wxDefaultSize,
159  0, NULL, wxLB_HSCROLL );
160 
161  // Creates the The list of parameters for the current parameter page
162  initParameterGrid();
163 
164  ReCreatePageList();
165 
166  DisplayWizardInfos();
167 
168  m_auimgr.SetManagedWindow( this );
169 
170  EDA_PANEINFO horiztb;
171  horiztb.HorizontalToolbarPane();
172 
173  EDA_PANEINFO info;
174  info.InfoToolbarPane();
175 
176  EDA_PANEINFO mesg;
177  mesg.MessageToolbarPane();
178 
179  // Manage main toolbal
180  m_auimgr.AddPane( m_mainToolBar, wxAuiPaneInfo( horiztb ).
181  Name( wxT ("m_mainToolBar" ) ).Top().Row( 0 ) );
182 
183  // Manage the left window (list of parameter pages)
184  EDA_PANEINFO paneList;
185  paneList.InfoToolbarPane().Name( wxT( "m_pageList" ) ).Left().Row( 0 );
186  m_auimgr.AddPane( m_pageList, wxAuiPaneInfo( paneList ) );
187 
188  // Manage the parameters grid editor for the current parameter page
189  EDA_PANEINFO panePrms;
190  panePrms.InfoToolbarPane().Name( wxT( "m_parameterGrid" ) ).Left().Row( 1 );
191  m_auimgr.AddPane( m_parameterGrid, wxAuiPaneInfo( panePrms ) );
192 
193  // Manage the draw panel
194  m_auimgr.AddPane( m_canvas,
195  wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
196 
197  // Manage the message panel
198  m_auimgr.AddPane( m_messagePanel,
199  wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(1) );
200 
201  // Gives a min size and the last saved size to left windows
202  m_auimgr.GetPane( m_pageList ).MinSize( wxSize(60, -1 ) );
203  m_auimgr.GetPane( m_pageList ).BestSize( wxSize(m_pageListWidth, -1) );
204 
205  m_auimgr.GetPane( m_parameterGrid ).MinSize( wxSize( 120, -1 ) );
206  m_auimgr.GetPane( m_parameterGrid ).BestSize( wxSize(m_parameterGridWidth, -1) );
207 
208  m_auimgr.Update();
209 
210  // Now Drawpanel is sized, we can use BestZoom to show the component (if any)
211 #ifdef USE_WX_GRAPHICS_CONTEXT
212  GetScreen()->SetZoom( BestZoom() );
213 #else
214  Zoom_Automatique( false );
215 #endif
216 
217  // Do not Run a dialog here: on some Window Managers, it creates issues.
218  // Reason: the FOOTPRINT_WIZARD_FRAME is run as modal;
219  // It means the call to FOOTPRINT_WIZARD_FRAME::ShowModal will change the
220  // Event Loop Manager, and stop the one created by the dialog.
221  // It does not happen on all W.M., perhaps due to the way the order events are called
222 // SelectFootprintWizard();
223 }
EDA_PANEINFO & HorizontalToolbarPane()
Function HorizontalToolbarPane Change *this to a horizontal toolbar for KiCad.
Definition: wxstruct.h:474
#define KICAD_DEFAULT_DRAWFRAME_STYLE
Definition: wxstruct.h:55
show a marker on pads with no nets
void SetVisibleAlls()
Function SetVisibleAlls changes the bit-mask of visible element categories and layers.
Specialization of the wxAuiPaneInfo class for KiCad panels.
Definition: wxstruct.h:465
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
void SetElementVisibility(GAL_LAYER_ID LAYER_aPCB, bool aNewState)
Function SetElementVisibility changes the visibility of an element category.
#define FOOTPRINT_WIZARD_FRAME_NAME
EDA_PANEINFO & InfoToolbarPane()
Function InfoToolbarPane Change *this to a information panel for for KiCad.
Definition: wxstruct.h:539
Class DISPLAY_OPTIONS handles display options like enable/disable some optional drawings.
Definition: pcbstruct.h:62
BOARD * GetBoard()
EDA_PANEINFO & MessageToolbarPane()
Function MessageToolbarPane Change *this to a message pane for KiCad.
Definition: wxstruct.h:511
bool m_DisplayPadIsol
Definition: pcbstruct.h:68
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:166
#define MODAL_MODE_EXTRASTYLE
bool m_DisplayPadNum
Definition: pcbstruct.h:67
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
struct EDA_HOTKEY_CONFIG g_Module_Viewer_Hokeys_Descr[]