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:
91 
92  bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl=0 ) override;
93 
94  void KiwayMailIn( KIWAY_EXPRESS& aEvent ) override;
95 
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();
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 
285 
294  void SendMessageToEESCHEMA( bool aClearHighligntOnly = false );
295 
297 
302  wxString GetSelectedFootprint();
303 
304  void SetStatusText( const wxString& aText, int aNumber = 0 ) override;
305 
306 private:
307  // UI event handlers.
308  // Keep consistent the display state of toggle menus or tools in toolbar
309  void OnFilterFPbyKeywords( wxUpdateUIEvent& event );
310  void OnFilterFPbyPinCount( wxUpdateUIEvent& event );
311  void OnFilterFPbyLibrary( wxUpdateUIEvent& event );
312  void OnFilterFPbyKeyName( wxUpdateUIEvent& event );
313 
321  int buildEquivalenceList( FOOTPRINT_EQUIVALENCE_LIST& aList, wxString * aErrorMessages = NULL );
322 
323  void refreshAfterComponentSearch (COMPONENT* component);
324 
325  DECLARE_EVENT_TABLE()
326 };
327 
328 #endif //#ifndef _CVPCB_MAINFRAME_H_
void ToFirstNA(wxCommandEvent &event)
IFACE(const char *aName, KIWAY::FACE_T aType)
Definition: pcbnew.cpp:390
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: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
void OnSelectFilteringFootprint(wxCommandEvent &event)
Function OnSelectFilteringFootprint is the command event handler for enabling and disabling footprint...
void OnCancel(wxCommandEvent &aEvent)
wxArrayString m_EquFilesNames
COMPONENTS_LISTBOX * m_compListBox
void SendMessageToEESCHEMA(bool aClearHighligntOnly=false)
Function SendMessageToEESCHEMA Send a remote command to Eeschema via a socket, Commands are $PART: "r...
wxString m_currentSearchPattern
Definition: cvpcb.cpp:50
void SetNewPkg(const wxString &aFootprintName)
Function SetNewPkg set the footprint name for all selected components in component list and selects t...
void OnFilterFPbyKeywords(wxUpdateUIEvent &event)
The common library.
int ReadSchematicNetlist(const std::string &aNetlist)
Function ReadSchematicNetlist read the netlist (.net) file built on the fly by Eeschema.
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...
Class DISPLAY_FOOTPRINTS_FRAME is used to display footprints.
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
Classes used in Pcbnew, CvPcb and GerbView.
void OnSize(wxSizeEvent &SizeEvent)
void ShowChangedLanguage() override
Function ShowChangedLanguage redraws the menus and what not in current language.
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. ...
Class NETLIST stores all of information read from a netlist along with the flags used to update the N...
Definition: pcb_netlist.h:214
bool OpenProjectFiles(const std::vector< wxString > &aFileSet, int aCtl=0) override
void OnOK(wxCommandEvent &aEvent)
boost::ptr_vector< FOOTPRINT_EQUIVALENCE > FOOTPRINT_EQUIVALENCE_LIST
wxArrayString m_ModuleLibNames
void OnComponentRightClick(wxMouseEvent &event)
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:258
void SetStatusText(const wxString &aText, int aNumber=0) override
void OnFilterFPbyPinCount(wxUpdateUIEvent &event)
virtual void ReCreateMenuBar() override
(Re)Create the menubar for the CvPcb mainframe
void BuildFOOTPRINTS_LISTBOX()
void OnQuit(wxCommandEvent &event)
void OnFootprintRightClick(wxMouseEvent &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
int buildEquivalenceList(FOOTPRINT_EQUIVALENCE_LIST &aList, wxString *aErrorMessages=NULL)
read the .equ files and populate the list of equvalents
wxStaticText * m_statusLine2
void OnFilterFPbyKeyName(wxUpdateUIEvent &event)
void OnCloseWindow(wxCloseEvent &Event)
wxString GetSelectedFootprint()
PARAM_CFG_ARRAY m_projectFileParams
DISPLAY_FOOTPRINTS_FRAME * GetFootprintViewerFrame()
Holds a list of FOOTPRINT_INFO objects, along with a list of IO_ERRORs or PARSE_ERRORs that were thro...
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
bool ReadNetListAndFpFiles(const std::string &aNetlist)
Function ReadNetListAndFpFiles loads the netlist file built on the fly by Eeschema and loads footprin...
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 OnKeyDown(wxKeyEvent &aEvent)
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
void OnSaveAndContinue(wxCommandEvent &aEvent)
PARAM_CFG_ARRAY & GetProjectFileParameters(void)
Function GetProjectFileParameters return project file parameter list for CvPcb.
Definition: cfg.cpp:45
wxButton * m_saveAndContinue
The CvPcb application main window.
wxStaticText * m_statusLine1
void DisplayModule(wxCommandEvent &event)
bool SaveFootprintAssociation(bool doSaveSchematic)
Function SaveFootprintAssociation saves the edits that the user has done by sending them back to eesc...