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 F_Cu, 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  SetActiveLayer( F_Cu );
156 
157  // Creates the parameter pages list
158  m_pageList = new wxListBox( this, ID_FOOTPRINT_WIZARD_PAGE_LIST,
159  wxDefaultPosition, wxDefaultSize,
160  0, NULL, wxLB_HSCROLL );
161 
162  // Creates the The list of parameters for the current parameter page
163  initParameterGrid();
164 
165  ReCreatePageList();
166 
167  DisplayWizardInfos();
168 
169  m_auimgr.SetManagedWindow( this );
170 
171  EDA_PANEINFO horiztb;
172  horiztb.HorizontalToolbarPane();
173 
174  EDA_PANEINFO info;
175  info.InfoToolbarPane();
176 
177  EDA_PANEINFO mesg;
178  mesg.MessageToolbarPane();
179 
180  // Manage main toolbal
181  m_auimgr.AddPane( m_mainToolBar, wxAuiPaneInfo( horiztb ).
182  Name( wxT ("m_mainToolBar" ) ).Top().Row( 0 ) );
183 
184  // Manage the left window (list of parameter pages)
185  EDA_PANEINFO paneList;
186  paneList.InfoToolbarPane().Name( wxT( "m_pageList" ) ).Left().Row( 0 );
187  m_auimgr.AddPane( m_pageList, wxAuiPaneInfo( paneList ) );
188 
189  // Manage the parameters grid editor for the current parameter page
190  EDA_PANEINFO panePrms;
191  panePrms.InfoToolbarPane().Name( wxT( "m_parameterGrid" ) ).Left().Row( 1 );
192  m_auimgr.AddPane( m_parameterGrid, wxAuiPaneInfo( panePrms ) );
193 
194  // Manage the draw panel
195  m_auimgr.AddPane( m_canvas,
196  wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
197 
198  // Manage the message panel
199  m_auimgr.AddPane( m_messagePanel,
200  wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(1) );
201 
202  // Gives a min size and the last saved size to left windows
203  m_auimgr.GetPane( m_pageList ).MinSize( wxSize(60, -1 ) );
204  m_auimgr.GetPane( m_pageList ).BestSize( wxSize(m_pageListWidth, -1) );
205 
206  m_auimgr.GetPane( m_parameterGrid ).MinSize( wxSize( 120, -1 ) );
207  m_auimgr.GetPane( m_parameterGrid ).BestSize( wxSize(m_parameterGridWidth, -1) );
208 
209  m_auimgr.Update();
210 
211  // Now Drawpanel is sized, we can use BestZoom to show the component (if any)
212 #ifdef USE_WX_GRAPHICS_CONTEXT
213  GetScreen()->SetZoom( BestZoom() );
214 #else
215  Zoom_Automatique( false );
216 #endif
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 // SelectFootprintWizard();
224 }
EDA_PANEINFO & HorizontalToolbarPane()
Function HorizontalToolbarPane Change *this to a horizontal toolbar for KiCad.
Definition: wxstruct.h:487
#define KICAD_DEFAULT_DRAWFRAME_STYLE
Definition: wxstruct.h:55
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.
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:478
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
#define FOOTPRINT_WIZARD_FRAME_NAME
EDA_PANEINFO & InfoToolbarPane()
Function InfoToolbarPane Change *this to a information panel for for KiCad.
Definition: wxstruct.h:552
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:524
bool m_DisplayPadIsol
Definition: pcbstruct.h:68
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:169
#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[]