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) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 1992-2018 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 <pcb_base_frame.h>
38 #include <config_params.h>
39 #include <auto_associate.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 
64  wxAuiToolBar* m_mainToolBar;
68  wxTextCtrl* m_tcFilterString;
69  wxStaticText* m_statusLine1;
70  wxStaticText* m_statusLine2;
71  wxButton* m_saveAndContinue;
72 
73 public:
74  wxArrayString m_ModuleLibNames;
75  wxArrayString m_EquFilesNames;
76 
78 
79 protected:
80  bool m_modified;
81  bool m_skipComponentSelect; // true to skip OnSelectComponent event
82  // (in automatic selection/deletion of associations)
84 
86 
87  CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent );
88 
89 public:
90  ~CVPCB_MAINFRAME();
91 
92  bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl=0 ) override;
93 
94  void KiwayMailIn( KIWAY_EXPRESS& aEvent ) override;
95 
99  DISPLAY_FOOTPRINTS_FRAME* GetFootprintViewerFrame();
100 
108  void OnSelectComponent( wxListEvent& event );
109 
115  void OnEditFootprintLibraryTable( wxCommandEvent& event );
116 
117  void OnCancel( wxCommandEvent& aEvent );
118  void OnOK( wxCommandEvent& aEvent );
119  void OnSaveAndContinue( wxCommandEvent& aEvent );
120  void OnQuit( wxCommandEvent& event );
121  void OnCloseWindow( wxCloseEvent& Event );
122  void OnSize( wxSizeEvent& SizeEvent );
123  void OnKeyDown( wxKeyEvent& aEvent );
124  void ReCreateHToolbar();
125  virtual void ReCreateMenuBar() override;
126  void ShowChangedLanguage() override;
127 
128  void ChangeFocus( bool aMoveRight );
129 
130  void ToFirstNA( wxCommandEvent& event );
131  void ToPreviousNA( wxCommandEvent& event );
132 
137  void DelAssociations( wxCommandEvent& event );
138 
139  void OnConfigurePaths( wxCommandEvent& aEvent );
140 
145  void OnEditEquFilesList( wxCommandEvent& aEvent );
146 
147  void DisplayModule( wxCommandEvent& event );
148 
149  void OnComponentRightClick( wxMouseEvent& event );
150 
151  void OnFootprintRightClick( wxMouseEvent& event );
152 
161  void AutomaticFootprintMatching( wxCommandEvent& event );
162 
167  void OnSelectFilteringFootprint( wxCommandEvent& event );
168 
173  void OnEnterFilteringText( wxCommandEvent& event );
174 
181  void SetNewPkg( const wxString& aFootprintName );
182 
190  void SetNewPkg( const wxString& aFootprintName, int aIndex );
191 
192  void BuildCmpListBox();
193  void BuildFOOTPRINTS_LISTBOX();
194  void BuildLIBRARY_LISTBOX();
195 
200  void CreateScreenCmp();
201 
208  bool SaveFootprintAssociation( bool doSaveSchematic );
209 
217  bool ReadNetListAndFpFiles( const std::string& aNetlist );
218 
226  int ReadSchematicNetlist( const std::string& aNetlist );
227 
232  void LoadProjectFile();
233 
238  void SaveProjectFile();
239 
240  void LoadSettings( wxConfigBase* aCfg ) override;
241 
242  void SaveSettings( wxConfigBase* aCfg ) override;
243 
256  void DisplayStatus();
257 
269  bool LoadFootprintFiles();
270 
284  PARAM_CFG_ARRAY& GetProjectFileParameters( void );
285 
292  void SendMessageToEESCHEMA();
293 
294  COMPONENT* GetSelectedComponent();
295 
300  wxString GetSelectedFootprint();
301 
302  void SetStatusText( const wxString& aText, int aNumber = 0 ) override;
303 
304 private:
305  // UI event handlers.
306  // Keep consistent the display state of toggle menus or tools in toolbar
307  void OnFilterFPbyKeywords( wxUpdateUIEvent& event );
308  void OnFilterFPbyPinCount( wxUpdateUIEvent& event );
309  void OnFilterFPbyLibrary( wxUpdateUIEvent& event );
310  void OnFilterFPbyKeyName( wxUpdateUIEvent& event );
311 
319  int buildEquivalenceList( FOOTPRINT_EQUIVALENCE_LIST& aList, wxString * aErrorMessages = NULL );
320 
321  void refreshAfterComponentSearch (COMPONENT* component);
322 
323  DECLARE_EVENT_TABLE()
324 };
325 
326 #endif //#ifndef _CVPCB_MAINFRAME_H_
IFACE(const char *aName, KIWAY::FACE_T aType)
Definition: pcbnew.cpp:398
A list of parameters type.
Class KIWAY_PLAYER is a wxFrame capable of the OpenProjectFiles function, meaning it can load a porti...
Definition: kiway_player.h:120
Class KIWAY_EXPRESS carries a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition: kiway_express.h:39
FOOTPRINT_LIST * m_FootprintsList
wxArrayString m_EquFilesNames
COMPONENTS_LISTBOX * m_compListBox
wxString m_currentSearchPattern
Definition: cvpcb.cpp:50
The common library.
Class DISPLAY_FOOTPRINTS_FRAME is used to display footprints.
Classes used in Pcbnew, CvPcb and GerbView.
wxTextCtrl * m_tcFilterString
Class NETLIST stores all of information read from a netlist along with the flags used to update the N...
Definition: pcb_netlist.h:214
boost::ptr_vector< FOOTPRINT_EQUIVALENCE > FOOTPRINT_EQUIVALENCE_LIST
wxArrayString m_ModuleLibNames
wxAuiToolBar * m_mainToolBar
Class KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within...
Definition: kiway.h:258
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
wxStaticText * m_statusLine2
PARAM_CFG_ARRAY m_projectFileParams
Holds a list of FOOTPRINT_INFO objects, along with a list of IO_ERRORs or PARSE_ERRORs that were thro...
FOOTPRINTS_LISTBOX * m_footprintListBox
wxButton * m_saveAndContinue
The CvPcb application main window.
wxStaticText * m_statusLine1