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) 2012 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
6  * Copyright (C) 2004-2012 KiCad Developers, see change_log.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 <class_footprint_wizard.h>
36 class wxSashLayoutWindow;
37 class wxListBox;
38 class wxGrid;
39 class wxGridEvent;
41 
42 // A helper class to display messages when building a footprint
44 
46 {
50 };
51 
56 {
57 private:
58  wxListBox* m_pageList;
60  wxGrid* m_parameterGrid;
63 
64 protected:
65  wxString m_wizardName;
67  wxString m_wizardStatus;
68 
69 public:
70 
71  FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* parent, FRAME_T aFrameType );
72 
74 
76 
82  void PythonPluginsReload();
83 
84 private:
85 
86  void OnSize( wxSizeEvent& event ) override;
87 
88  void OnGridSize( wxSizeEvent& aSizeEvent );
89 
95  void ExportSelectedFootprint( wxCommandEvent& aEvent );
96 
102  void OnSashDrag( wxSashEvent& event );
103 
109  void ReCreatePageList();
110 
115  void ReCreateParameterList();
116 
120  void ResizeParamColumns();
121 
126  void initParameterGrid();
127 
132  void SelectFootprintWizard();
133 
138  void ReloadFootprint();
139 
144  void DisplayBuildMessage( wxString& aMessage );
145 
151 
152 
153  void Process_Special_Functions( wxCommandEvent& event );
154 
159  void DisplayWizardInfos();
160 
161 
162  void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override;
163  void OnCloseWindow( wxCloseEvent& Event ) override;
164  void ReCreateHToolbar() override;
165  void ReCreateVToolbar() override;
166  void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) override;
167  void ClickOnPageList( wxCommandEvent& event );
168  void OnSetRelativeOffset( wxCommandEvent& event );
169 
170  bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ) override;
171 
172  void LoadSettings( wxConfigBase* aCfg ) override;
173  void SaveSettings( wxConfigBase* aCfg ) override;
174 
176  EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override { return NULL; }
177 
183  virtual void OnActivate( wxActivateEvent& event ) override;
184 
185  void SelectCurrentWizard( wxCommandEvent& event );
186 
187  void DefaultParameters( wxCommandEvent& event );
188 
193  void ParametersUpdated( wxGridEvent& event );
194 
195  bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) override;
196 
201  void Show3D_Frame( wxCommandEvent& event ) override;
202 
210  void Update3D_Frame( bool aForceReloadFootprint = true );
211 
212  /*
213  * Virtual functions, not used here, but needed by PCB_BASE_FRAME
214  * (virtual pure functions )
215  */
216  void OnLeftDClick( wxDC*, const wxPoint& ) override {}
217  void SaveCopyInUndoList( BOARD_ITEM*, UNDO_REDO_T, const wxPoint& ) override {}
218  void SaveCopyInUndoList( const PICKED_ITEMS_LIST&, UNDO_REDO_T, const wxPoint& ) override {}
219 
220 
221  DECLARE_EVENT_TABLE()
222 };
223 
224 
225 // A miniframe to display messages from the builder
226 class FOOTPRINT_WIZARD_MESSAGES: public wxMiniFrame
227 {
228 public:
229  FOOTPRINT_WIZARD_MESSAGES( FOOTPRINT_WIZARD_FRAME* aParent, wxConfigBase* aCfg );
231  void PrintMessage( const wxString& aMessage );
232  void ClearScreen();
233  void SaveSettings();
234  void LoadSettings();
235 
236 private:
237  wxTextCtrl* m_messageWindow;
239  wxSize m_size;
240  wxConfigBase* m_config;
241  bool m_canClose; // false to veto a close event, true to allow it
242 
243  void OnCloseMsgWindow( wxCloseEvent& aEvent );
244 
245  DECLARE_EVENT_TABLE()
246 };
247 
248 #endif // FOOTPRINT_WIZARD_FRM_H_
Class FOOTPRINT_WIZARD_FRAME.
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...
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.
void ExportSelectedFootprint(wxCommandEvent &aEvent)
Function ExportSelectedFootprint(); will let the caller exit from the wait loop, and get the built fo...
FOOTPRINT_WIZARD_MESSAGES * m_messagesFrame
int m_parameterGridWidth
size of the grid
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).
EDA_HOTKEY * GetHotKeyDescription(int aCommand) const override
>
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.
Class PCBNEW_FOOTPRINT_WIZARDS.
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 ...
UNDO_REDO_T
Undo Redo considerations: Basically we have 3 cases New item Deleted item Modified item there is also...
wxGrid * m_parameterGrid
The list of parameters.
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...
void OnCloseMsgWindow(wxCloseEvent &aEvent)
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...
int m_pageListWidth
width of the window
void PrintMessage(const wxString &aMessage)
Class KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within...
Definition: kiway.h:257
uint32_t EDA_KEY
Definition: common.h:52
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 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
Function OnSize recalculates 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)
FOOTPRINT_WIZARD_MESSAGES(FOOTPRINT_WIZARD_FRAME *aParent, wxConfigBase *aCfg)
class EDA_HOTKEY is a class to handle hot key commands.
Definition: hotkeys_basic.h:57
bool GeneralControl(wxDC *aDC, const wxPoint &aPosition, EDA_KEY aHotKey=0) override
Function GeneralControl performs 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)
void SelectCurrentWizard(wxCommandEvent &event)
void Process_Special_Functions(wxCommandEvent &event)
void OnCloseWindow(wxCloseEvent &Event) override
void ResizeParamColumns()
Expand the 'Value' column to fill available.
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