KiCad PCB EDA Suite
footprint_wizard_frame.h
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 Miguel Angel Ajo Pelayo, miguelangel@nbee.es
5  * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
6  * Copyright (C) 2004-2018 KiCad Developers, see AUTHORS.txt for contributors.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
30 #ifndef FOOTPRINT_WIZARD_FRAME_H_
31 #define FOOTPRINT_WIZARD_FRAME_H_
32 
33 
34 #include <wx/gdicmn.h>
35 #include <footprint_wizard.h>
36 class wxSashLayoutWindow;
37 class wxListBox;
38 class WX_GRID;
39 class wxGridEvent;
41 
42 
44 {
48 };
49 
54 {
55 private:
56  wxPanel* m_parametersPanel;
57  wxListBox* m_pageList;
60  wxTextCtrl* m_buildMessageBox;
63 
64  wxString m_auiPerspective;
65 
67 
68 protected:
69  wxString m_wizardName;
71  wxString m_wizardStatus;
72 
73 public:
74 
75  FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* parent, FRAME_T aFrameType );
76 
78 
80 
86  void PythonPluginsReload();
87 
88 private:
89 
90  void OnSize( wxSizeEvent& event ) override;
91  void OnGridSize( wxSizeEvent& aSizeEvent );
92 
98  void UpdateMsgPanel() override;
99 
104  void updateView();
105 
111  void ExportSelectedFootprint( wxCommandEvent& aEvent );
112 
118  void OnSashDrag( wxSashEvent& event );
119 
125  void ReCreatePageList();
126 
131  void ReCreateParameterList();
132 
136  void ResizeParamColumns();
137 
142  void initParameterGrid();
143 
148  void SelectFootprintWizard();
149 
154  void ReloadFootprint();
155 
160  void DisplayBuildMessage( wxString& aMessage );
161 
167 
168 
169  void Process_Special_Functions( wxCommandEvent& event );
170 
175  void DisplayWizardInfos();
176 
177 
178  void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override;
179  void OnCloseWindow( wxCloseEvent& Event ) override;
180  void ReCreateHToolbar() override;
181  void ReCreateVToolbar() override;
182  void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) override;
183  void ClickOnPageList( wxCommandEvent& event );
184  void OnSetRelativeOffset( wxCommandEvent& event );
185 
186  bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ) override;
187 
189  EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
190 
199  bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL ) override;
200 
201  void LoadSettings( wxConfigBase* aCfg ) override;
202  void SaveSettings( wxConfigBase* aCfg ) override;
203 
209  virtual void OnActivate( wxActivateEvent& event ) override;
210 
211  void SelectCurrentWizard( wxCommandEvent& event );
212 
213  void DefaultParameters( wxCommandEvent& event );
214 
219  void ParametersUpdated( wxGridEvent& event );
220 
221  bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) override;
222 
227  void Show3D_Frame( wxCommandEvent& event ) override;
228 
236  void Update3D_Frame( bool aForceReloadFootprint = true );
237 
238  /*
239  * Virtual functions, not used here, but needed by PCB_BASE_FRAME
240  * (virtual pure functions )
241  */
242  void OnLeftDClick( wxDC*, const wxPoint& ) override {}
243  void SaveCopyInUndoList( BOARD_ITEM*, UNDO_REDO_T, const wxPoint& ) override {}
244  void SaveCopyInUndoList( const PICKED_ITEMS_LIST&, UNDO_REDO_T, const wxPoint& ) override {}
245 
246 
247  DECLARE_EVENT_TABLE()
248 };
249 
250 
251 
252 #endif // FOOTPRINT_WIZARD_FRM_H_
Class FOOTPRINT_WIZARD_FRAME.
bool OnHotKey(wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem=NULL) override
Function OnHotKey handle hot key events.
wxString m_wizardName
name of the current wizard
void DisplayWizardInfos()
Function DisplayWizardInfos Shows all the details about the current wizard.
void SaveSettings(wxConfigBase *aCfg) override
Function SaveSettings saves common frame parameters to a configuration data file.
Class 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.
WizardParameterColumnNames
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads 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
void RedrawActiveWindow(wxDC *DC, bool EraseBg) override
Function RedrawActiveWindow Display the current selected component.
UNDO_REDO_T
Undo Redo considerations: Basically we have 3 cases New item Deleted item Modified item there is also...
void ExportSelectedFootprint(wxCommandEvent &aEvent)
Function ExportSelectedFootprint(); will let the caller exit from the wait loop, and get the built fo...
int m_parameterGridPage
the page currently displayed by m_parameterGrid it is most of time the m_pageList selection,...
WX_GRID * m_parameterGrid
The list of parameters.
void ReloadFootprint()
Function ReloadFootprint Reloads the current footprint.
void SaveCopyInUndoList(const PICKED_ITEMS_LIST &, UNDO_REDO_T, const wxPoint &) override
Function SaveCopyInUndoList (virtual pure, overloaded).
void Update3D_Frame(bool aForceReloadFootprint=true)
Function Update3D_Frame must be called after a footprint selection Updates the 3D view and 3D frame t...
void initParameterGrid()
Function initParameterGrid Prepare the grid where parameters are displayed.
void ClickOnPageList(wxCommandEvent &event)
void ReCreateParameterList()
Function ReCreateParameterList Creates the list of parameters for the current page.
wxString m_wizardStatus
current wizard status
virtual void OnActivate(wxActivateEvent &event) override
Function OnActivate is called when the frame frame is activate to reload the libraries and component ...
wxPanel * m_parametersPanel
Panel for the page list and parameter grid.
void ReCreatePageList()
Function ReCreatePageList Creates or recreates the list of parameter pages for the current wizard.
void ParametersUpdated(wxGridEvent &event)
Function ParametersUpdated Update the footprint python parameters values from the values in grid.
FOOTPRINT_WIZARD_FRAME(KIWAY *aKiway, wxWindow *parent, FRAME_T aFrameType)
void DisplayBuildMessage(wxString &aMessage)
Function DisplayBuildMessages Display the message generated by the python build footprint script.
Class KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within...
Definition: kiway.h:258
uint32_t EDA_KEY
Definition: common.h:74
Class PICKED_ITEMS_LIST is a holder to handle information on schematic or board items.
FOOTPRINT_WIZARD * GetMyWizard()
Function GetMyWizard Reloads the wizard by name.
bool m_wizardListShown
A show-once flag for the wizard list.
bool OnRightClick(const wxPoint &MousePos, wxMenu *PopMenu) override
void PythonPluginsReload()
Reload the Python plugins if they are newer than the already loaded, and load new plugins if any Do n...
void Show3D_Frame(wxCommandEvent &event) override
Function Show3D_Frame (virtual) displays 3D view of the footprint (module) being edited.
void OnSize(wxSizeEvent &event) override
Recalculate the size of toolbars and display panel when the frame size changes.
void OnSashDrag(wxSashEvent &event)
Function OnSashDrag resizes the child windows when dragging a sash window border.
void DefaultParameters(wxCommandEvent &event)
class EDA_HOTKEY is a class to handle hot key commands.
Definition: hotkeys_basic.h:59
bool GeneralControl(wxDC *aDC, const wxPoint &aPosition, EDA_KEY aHotKey=0) override
Perform application specific control using aDC at aPosition in logical units.
void SelectFootprintWizard()
Function SelectFootprintWizard Shows the list of footprint wizards available into the system.
void OnSetRelativeOffset(wxCommandEvent &event)
void OnLeftDClick(wxDC *, const wxPoint &) override
void OnGridSize(wxSizeEvent &aSizeEvent)
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:154
void SelectCurrentWizard(wxCommandEvent &event)
void Process_Special_Functions(wxCommandEvent &event)
void OnCloseWindow(wxCloseEvent &Event) override
Class FOOTPRINT_WIZARD and FOOTPRINT_WIZARDS.
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_HOTKEY * GetHotKeyDescription(int aCommand) const override
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
void SaveCopyInUndoList(BOARD_ITEM *, UNDO_REDO_T, const wxPoint &) override
Function SaveCopyInUndoList (virtual pure) Creates a new entry in undo list of commands.
void OnLeftClick(wxDC *DC, const wxPoint &MousePos) override
Class FOOTPRINT_WIZARD This is the parent class from where any footprint wizard class must derive.
wxString m_wizardDescription
description of the wizard