KiCad PCB EDA Suite
cvpcb_mainframe.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) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
29 #ifndef _CVPCB_MAINFRAME_H_
30 #define _CVPCB_MAINFRAME_H_
31 
32 #include <wx/listctrl.h>
33 #include <wx/filename.h>
34 #include <pcb_netlist.h>
35 #include <footprint_info.h>
36 
37 #include <wxBasePcbFrame.h>
38 #include <config_params.h>
39 #include <autosel.h>
40 #include <memory>
41 
42 
43 /* Forward declarations of all top-level window classes. */
44 class wxAuiToolBar;
45 class FOOTPRINTS_LISTBOX;
46 class COMPONENTS_LISTBOX;
47 class LIBRARY_LISTBOX;
49 class COMPONENT;
50 class FP_LIB_TABLE;
51 
52 namespace CV { struct IFACE; }
53 
58 {
59  friend struct CV::IFACE;
60 
61  wxArrayString m_footprintListEntries;
66  wxAuiToolBar* m_mainToolBar;
70  wxTextCtrl* m_tcFilterString;
71 
72 public:
73  wxArrayString m_ModuleLibNames;
74  wxArrayString m_EquFilesNames;
76  std::unique_ptr<FOOTPRINT_LIST> m_FootprintsList;
77 
78 protected:
80  bool m_modified;
81  bool m_skipComponentSelect; // true to skip OnSelectComponent event
82  // (in automatic selection/deletion of associations)
84 
85  CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent );
86 
87 public:
89 
90  bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl=0 ) override;
91 
92  void KiwayMailIn( KIWAY_EXPRESS& aEvent ) override;
93 
98 
106  void OnSelectComponent( wxListEvent& event );
107 
113  void OnEditFootprintLibraryTable( wxCommandEvent& event );
114 
115  void OnQuit( wxCommandEvent& event );
116  void OnCloseWindow( wxCloseEvent& Event );
117  void OnSize( wxSizeEvent& SizeEvent );
118  void ReCreateHToolbar();
119  virtual void ReCreateMenuBar() override;
120 
121  void ChangeFocus( bool aMoveRight );
122 
123  void ToFirstNA( wxCommandEvent& event );
124  void ToPreviousNA( wxCommandEvent& event );
125 
130  void DelAssociations( wxCommandEvent& event );
131 
132  void SaveQuitCvpcb( wxCommandEvent& event );
133 
134  void OnConfigurePaths( wxCommandEvent& aEvent );
135 
140  void OnEditEquFilesList( wxCommandEvent& aEvent );
141 
142  void OnKeepOpenOnSave( wxCommandEvent& event );
143  void DisplayModule( wxCommandEvent& event );
144 
153  void AutomaticFootprintMatching( wxCommandEvent& event );
154 
155  void DisplayDocFile( wxCommandEvent& event );
156 
161  void OnSelectFilteringFootprint( wxCommandEvent& event );
162 
167  void OnEnterFilteringText( wxCommandEvent& event );
168 
175  void SetNewPkg( const wxString& aFootprintName );
176 
177  void BuildCmpListBox();
179  void BuildLIBRARY_LISTBOX();
180 
185  void CreateScreenCmp();
186 
193 
200  bool ReadNetListAndLinkFiles( const std::string& aNetlist );
201 
202  int ReadSchematicNetlist( const std::string& aNetlist );
203 
208  void LoadProjectFile();
209 
214  void SaveProjectFile();
215 
216  void LoadSettings( wxConfigBase* aCfg ) override;
217 
218  void SaveSettings( wxConfigBase* aCfg ) override;
219 
232  void DisplayStatus();
233 
245  bool LoadFootprintFiles();
246 
261 
270  void UpdateTitle();
271 
278  void SendMessageToEESCHEMA();
279 
281 
286  const wxString GetSelectedFootprint();
287 
288 private:
289  // UI event handlers.
290  // Keep consistent the display state of toggle menus or tools in toolbar
291  void OnUpdateKeepOpenOnSave( wxUpdateUIEvent& event );
292  void OnFilterFPbyKeywords( wxUpdateUIEvent& event );
293  void OnFilterFPbyPinCount( wxUpdateUIEvent& event );
294  void OnFilterFPbyLibrary( wxUpdateUIEvent& event );
295  void OnFilterFPbyKeyName( wxUpdateUIEvent& event );
296 
304  int buildEquivalenceList( FOOTPRINT_EQUIVALENCE_LIST& aList, wxString * aErrorMessages = NULL );
305 
306  void refreshAfterComponentSearch (COMPONENT* component);
307 
308  DECLARE_EVENT_TABLE()
309 };
310 
311 #endif //#ifndef _CVPCB_MAINFRAME_H_
void OnUpdateKeepOpenOnSave(wxUpdateUIEvent &event)
void ToFirstNA(wxCommandEvent &event)
IFACE(const char *aName, KIWAY::FACE_T aType)
Definition: pcbnew.cpp:377
void SendMessageToEESCHEMA()
Function SendMessageToEESCHEMA Send a remote command to Eeschema via a socket, Commands are $PART: "r...
wxString m_DocModulesFileName
A list of parameters type.
void OnEditFootprintLibraryTable(wxCommandEvent &event)
Function OnEditFootprintLibraryTable displays the footprint library table editing dialog and updates ...
Class KIWAY_PLAYER is a wxFrame capable of the OpenProjectFiles function, meaning it can load a porti...
Definition: kiway_player.h:111
Class KIWAY_EXPRESS carries a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition: kiway_express.h:39
void OnSelectFilteringFootprint(wxCommandEvent &event)
Function OnSelectFilteringFootprint is the command event handler for enabling and disabling footprint...
wxArrayString m_footprintListEntries
wxArrayString m_EquFilesNames
COMPONENTS_LISTBOX * m_compListBox
wxString m_currentSearchPattern
Definition: cvpcb.cpp:57
void SetNewPkg(const wxString &aFootprintName)
Function SetNewPkg links the footprint to the current selected component and selects the next compone...
void OnFilterFPbyKeywords(wxUpdateUIEvent &event)
void UpdateTitle()
Function UpdateTitle sets the main window title bar text.
The common library.
void ReCreateHToolbar()
Definition: tool_cvpcb.cpp:42
int ReadSchematicNetlist(const std::string &aNetlist)
void SaveQuitCvpcb(wxCommandEvent &event)
bool LoadFootprintFiles()
Function LoadFootprintFiles reads the list of footprint (*.mod files) and generate the list of footpr...
void ChangeFocus(bool aMoveRight)
void ToPreviousNA(wxCommandEvent &event)
void CreateScreenCmp()
Create or Update the frame showing the current highlighted footprint and (if showed) the 3D display f...
void AutomaticFootprintMatching(wxCommandEvent &event)
Called by the automatic association button Read *.equ files to try to find corresponding footprint fo...
Definition: autosel.cpp:169
Class DISPLAY_FOOTPRINTS_FRAME is used to display footprints.
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
void OnSize(wxSizeEvent &SizeEvent)
wxTextCtrl * m_tcFilterString
void OnSelectComponent(wxListEvent &event)
Function OnSelectComponent Called when clicking on a component in component list window.
void DelAssociations(wxCommandEvent &event)
Function DelAssociations removes all component footprint associations already made.
void refreshAfterComponentSearch(COMPONENT *component)
void SaveSettings(wxConfigBase *aCfg) override
Function SaveSettings saves common frame parameters to a configuration data file. ...
Classes used in Pcbnew, CvPcb and GerbView.
Class NETLIST stores all of information read from a netlist along with the flags used to update the N...
Definition: pcb_netlist.h:205
bool OpenProjectFiles(const std::vector< wxString > &aFileSet, int aCtl=0) override
bool ReadNetListAndLinkFiles(const std::string &aNetlist)
Function ReadNetList reads the netlist (.net) file defined by #m_NetlistFileName. ...
wxArrayString m_ModuleLibNames
void KiwayMailIn(KIWAY_EXPRESS &aEvent) override
Function KiwayMailIn receives KIWAY_EXPRESS messages from other players.
wxAuiToolBar * m_mainToolBar
Class KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within...
Definition: kiway.h:257
void OnFilterFPbyPinCount(wxUpdateUIEvent &event)
boost::ptr_vector< FOOTPRINT_EQUIVALENCE > FOOTPRINT_EQUIVALENCE_LIST
Definition: autosel.h:43
virtual void ReCreateMenuBar() override
(Re)Create the menubar for the CvPcb mainframe
void BuildFOOTPRINTS_LISTBOX()
const wxString GetSelectedFootprint()
void OnQuit(wxCommandEvent &event)
LIBRARY_LISTBOX * m_libListBox
Class COMPONENT is used to store components and all of their related information found in a netlist...
Definition: pcb_netlist.h:83
void OnKeepOpenOnSave(wxCommandEvent &event)
void DisplayDocFile(wxCommandEvent &event)
int buildEquivalenceList(FOOTPRINT_EQUIVALENCE_LIST &aList, wxString *aErrorMessages=NULL)
read the .equ files and populate the list of equvalents
Definition: autosel.cpp:83
void OnFilterFPbyKeyName(wxUpdateUIEvent &event)
void OnCloseWindow(wxCloseEvent &Event)
PARAM_CFG_ARRAY m_projectFileParams
DISPLAY_FOOTPRINTS_FRAME * GetFootprintViewerFrame()
void OnEditEquFilesList(wxCommandEvent &aEvent)
Function OnEditEquFilesList envokes the equ files list edit dialog.
void SaveProjectFile()
Function SaveProjectFile Saves the CvPcb configuration parameter from the project (...
Definition: cfg.cpp:70
CVPCB_MAINFRAME(KIWAY *aKiway, wxWindow *aParent)
COMPONENT * GetSelectedComponent()
FOOTPRINTS_LISTBOX * m_footprintListBox
void OnConfigurePaths(wxCommandEvent &aEvent)
void OnEnterFilteringText(wxCommandEvent &event)
Function OnEnterFilteringText Is called each time the text of m_tcFilterString is changed...
void SaveFootprintAssociation()
Function SaveFootprintAssociation saves the edits that the user has done by sending them back to eesc...
void OnFilterFPbyLibrary(wxUpdateUIEvent &event)
void DisplayStatus()
Function DisplayStatus updates the information displayed on the status bar at bottom of the main fram...
void LoadProjectFile()
Function LoadProjectFile reads the CvPcb configuration parameter from the project (...
Definition: cfg.cpp:59
PARAM_CFG_ARRAY & GetProjectFileParameters(void)
Function GetProjectFileParameters return project file parameter list for CvPcb.
Definition: cfg.cpp:45
The CvPcb application main window.
void DisplayModule(wxCommandEvent &event)
std::unique_ptr< FOOTPRINT_LIST > m_FootprintsList