2011-02-05 16:15:48 +00:00
|
|
|
/**
|
|
|
|
* @file cvpcb_mainframe.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _CVPCB_MAINFRAME_H_
|
|
|
|
#define _CVPCB_MAINFRAME_H_
|
|
|
|
|
|
|
|
#include "wx/listctrl.h"
|
|
|
|
#include <wx/filename.h>
|
|
|
|
#include "param_config.h"
|
|
|
|
#include "cvpcb.h"
|
2011-02-21 18:27:47 +00:00
|
|
|
#include "footprint_info.h"
|
2011-02-05 16:15:48 +00:00
|
|
|
|
|
|
|
/* Forward declarations of all top-level window classes. */
|
|
|
|
class FOOTPRINTS_LISTBOX;
|
|
|
|
class COMPONENTS_LISTBOX;
|
|
|
|
class DISPLAY_FOOTPRINTS_FRAME;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2011-08-29 19:50:05 +00:00
|
|
|
* The CvPcb application main window.
|
2011-02-05 16:15:48 +00:00
|
|
|
*/
|
|
|
|
class CVPCB_MAINFRAME : public EDA_BASE_FRAME
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
bool m_KeepCvpcbOpen;
|
2011-08-04 11:23:19 +00:00
|
|
|
FOOTPRINTS_LISTBOX* m_FootprintList;
|
|
|
|
COMPONENTS_LISTBOX* m_ListCmp;
|
|
|
|
DISPLAY_FOOTPRINTS_FRAME* m_DisplayFootprintFrame;
|
|
|
|
EDA_TOOLBAR* m_HToolBar;
|
|
|
|
wxFileName m_NetlistFileName;
|
|
|
|
wxArrayString m_ModuleLibNames;
|
|
|
|
wxArrayString m_AliasLibNames;
|
|
|
|
wxString m_UserLibraryPath;
|
|
|
|
wxString m_NetlistFileExtension;
|
|
|
|
wxString m_DocModulesFileName;
|
|
|
|
FOOTPRINT_LIST m_footprints;
|
|
|
|
COMPONENT_LIST m_components;
|
2011-02-05 16:15:48 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
int m_undefinedComponentCnt;
|
|
|
|
bool m_modified;
|
|
|
|
bool m_isEESchemaNetlist;
|
|
|
|
PARAM_CFG_ARRAY m_projectFileParams;
|
|
|
|
|
2011-08-24 19:44:05 +00:00
|
|
|
public:
|
|
|
|
CVPCB_MAINFRAME( const wxString& title, long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
|
2011-02-05 16:15:48 +00:00
|
|
|
~CVPCB_MAINFRAME();
|
|
|
|
|
|
|
|
void OnLeftClick( wxListEvent& event );
|
|
|
|
void OnLeftDClick( wxListEvent& event );
|
|
|
|
void OnSelectComponent( wxListEvent& event );
|
|
|
|
|
|
|
|
void OnQuit( wxCommandEvent& event );
|
|
|
|
void OnCloseWindow( wxCloseEvent& Event );
|
|
|
|
void OnSize( wxSizeEvent& SizeEvent );
|
|
|
|
void OnChar( wxKeyEvent& event );
|
|
|
|
void ReCreateHToolbar();
|
|
|
|
virtual void ReCreateMenuBar();
|
2011-08-24 19:44:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetLanguage
|
|
|
|
* is called on a language menu selection.
|
|
|
|
*/
|
2011-02-05 16:15:48 +00:00
|
|
|
void SetLanguage( wxCommandEvent& event );
|
|
|
|
|
|
|
|
void ToFirstNA( wxCommandEvent& event );
|
|
|
|
void ToPreviousNA( wxCommandEvent& event );
|
2011-08-24 19:44:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function DelAssociations
|
|
|
|
* removes all component footprint associations already made
|
|
|
|
*/
|
2011-02-05 16:15:48 +00:00
|
|
|
void DelAssociations( wxCommandEvent& event );
|
2011-08-24 19:44:05 +00:00
|
|
|
|
|
|
|
void SaveProjectFile( wxCommandEvent& aEvent );
|
2011-02-05 16:15:48 +00:00
|
|
|
void SaveQuitCvpcb( wxCommandEvent& event );
|
2011-08-24 19:44:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function LoadNetList
|
|
|
|
* reads a netlist selected by user when clicking on load netlist button or any entry
|
|
|
|
* in the file history menu.
|
|
|
|
*/
|
2011-02-05 16:15:48 +00:00
|
|
|
void LoadNetList( wxCommandEvent& event );
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void ConfigCvpcb( wxCommandEvent& event );
|
|
|
|
void OnKeepOpenOnSave( wxCommandEvent& event );
|
|
|
|
void DisplayModule( wxCommandEvent& event );
|
2011-08-29 19:50:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called by the automatic association button
|
|
|
|
* Read *.equ files to try to find corresponding footprint
|
|
|
|
* for each component that is not already linked to a footprint ( a "free"
|
|
|
|
* component )
|
|
|
|
* format of a line:
|
|
|
|
* 'cmp_ref' 'footprint_name'
|
|
|
|
*/
|
2011-02-05 16:15:48 +00:00
|
|
|
void AssocieModule( wxCommandEvent& event );
|
2011-08-29 19:50:05 +00:00
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void WriteStuffList( wxCommandEvent& event );
|
|
|
|
void DisplayDocFile( wxCommandEvent& event );
|
2011-08-24 19:44:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function OnSelectFilteringFootprint
|
|
|
|
* is the command event handler for enabling and disabling footprint filtering.
|
|
|
|
*/
|
2011-02-05 16:15:48 +00:00
|
|
|
void OnSelectFilteringFootprint( wxCommandEvent& event );
|
|
|
|
|
|
|
|
void OnUpdateKeepOpenOnSave( wxUpdateUIEvent& event );
|
|
|
|
|
2011-08-24 19:44:05 +00:00
|
|
|
/**
|
|
|
|
* Function SetNewPkg
|
|
|
|
* set the module to the selected component and selects the next component.
|
|
|
|
*/
|
2011-02-05 16:15:48 +00:00
|
|
|
void SetNewPkg( const wxString& package );
|
|
|
|
void BuildCmpListBox();
|
|
|
|
void BuildFOOTPRINTS_LISTBOX();
|
|
|
|
void CreateScreenCmp();
|
2011-08-24 19:44:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SaveNetList
|
|
|
|
* backup and save netlist (.net) file to \a aFullFileName.
|
|
|
|
*
|
|
|
|
* @param aFullFileName A reference wxString object containing the full path and
|
|
|
|
* file name of the netlist to save.
|
|
|
|
* @return 0 if an error occurred saving the netlist to \a aFullFileName.
|
|
|
|
*/
|
|
|
|
int SaveNetList( const wxString& aFullFileName );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SaveComponentList
|
|
|
|
* backup modules to file \a aFullFileName.
|
|
|
|
*
|
|
|
|
* @param aFullFileName Name of net list file to save.
|
|
|
|
* @returns 1 if OK, 0 if error.
|
|
|
|
*/
|
|
|
|
int SaveComponentList( const wxString& aFullFileName );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function ReadNetList
|
|
|
|
* reads the netlist (.net) file defined by #m_NetlistFileName.
|
|
|
|
*/
|
2011-02-05 16:15:48 +00:00
|
|
|
bool ReadNetList();
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
int ReadSchematicNetlist();
|
2011-08-24 19:44:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function LoadProjectFile
|
|
|
|
* reads the configuration parameter from the project (.pro) file \a aFileName
|
|
|
|
*/
|
|
|
|
void LoadProjectFile( const wxString& aFileName );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function LoadSettings
|
2011-08-29 19:50:05 +00:00
|
|
|
* loads the CvPcb main frame specific configuration settings.
|
2011-08-24 19:44:05 +00:00
|
|
|
*
|
|
|
|
* Don't forget to call this base method from any derived classes or the
|
|
|
|
* settings will not get loaded.
|
|
|
|
*/
|
2011-02-05 16:15:48 +00:00
|
|
|
virtual void LoadSettings();
|
2011-08-24 19:44:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SaveSettings
|
2011-08-29 19:50:05 +00:00
|
|
|
* save the CvPcb frame specific configuration settings.
|
2011-08-24 19:44:05 +00:00
|
|
|
*
|
|
|
|
* Don't forget to call this base method from any derived classes or the
|
|
|
|
* settings will not get saved.
|
|
|
|
*/
|
2011-02-05 16:15:48 +00:00
|
|
|
virtual void SaveSettings();
|
2011-02-21 18:27:47 +00:00
|
|
|
|
|
|
|
/**
|
2011-08-24 19:44:05 +00:00
|
|
|
* Function DisplayStatus
|
|
|
|
* displays info to the status line at bottom of the main frame.
|
2011-02-05 16:15:48 +00:00
|
|
|
*/
|
|
|
|
void DisplayStatus();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function LoadFootprintFiles
|
2011-08-24 19:44:05 +00:00
|
|
|
* reads the list of footprint (*.mod files) and generate the list of footprints.
|
2011-02-05 16:15:48 +00:00
|
|
|
* for each module are stored
|
|
|
|
* the module name
|
|
|
|
* documentation string
|
|
|
|
* associated keywords
|
|
|
|
* m_ModuleLibNames is the list of library that must be read (loaded)
|
|
|
|
* fills m_footprints
|
|
|
|
* @return true if libraries are found, false otherwise.
|
|
|
|
*/
|
2011-08-04 11:23:19 +00:00
|
|
|
bool LoadFootprintFiles();
|
2011-02-05 16:15:48 +00:00
|
|
|
|
2011-02-21 18:27:47 +00:00
|
|
|
/**
|
|
|
|
* function GenNetlistPcbnew
|
|
|
|
* writes the output netlist file
|
|
|
|
*
|
|
|
|
*/
|
2011-08-04 11:23:19 +00:00
|
|
|
int GenNetlistPcbnew( FILE* f, bool isEESchemaNetlist = true );
|
2011-02-21 18:27:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function LoadComponentFile
|
2011-08-24 19:44:05 +00:00
|
|
|
* loads the .cmp file \a aCmpFileName that stores the component/footprint association.
|
|
|
|
*
|
|
|
|
* @param aFileName The full filename of .cmp file to load
|
2011-02-21 18:27:47 +00:00
|
|
|
*/
|
2011-08-24 19:44:05 +00:00
|
|
|
bool LoadComponentFile( const wxString& aFileName );
|
2011-02-21 18:27:47 +00:00
|
|
|
|
2011-08-24 19:44:05 +00:00
|
|
|
/**
|
|
|
|
* Function GetProjectFileParameters
|
2011-08-29 19:50:05 +00:00
|
|
|
* return project file parameter list for CvPcb.
|
2011-08-24 19:44:05 +00:00
|
|
|
* <p>
|
2011-08-29 19:50:05 +00:00
|
|
|
* Populate the project file parameter array specific to CvPcb if it hasn't
|
2011-08-24 19:44:05 +00:00
|
|
|
* already been populated and return a reference to the array to the caller.
|
|
|
|
* Creating the parameter list at run time has the advantage of being able
|
|
|
|
* to define local variables. The old method of statically building the array
|
|
|
|
* at compile time requiring global variable definitions.
|
|
|
|
* </p>
|
|
|
|
*
|
2011-08-29 19:50:05 +00:00
|
|
|
* @return A reference to a PARAM_CFG_ARRAY contain the project settings for CvPcb.
|
2011-08-24 19:44:05 +00:00
|
|
|
*/
|
2011-02-05 16:15:48 +00:00
|
|
|
PARAM_CFG_ARRAY& GetProjectFileParameters( void );
|
|
|
|
|
2011-08-24 19:44:05 +00:00
|
|
|
/**
|
|
|
|
* Function UpdateTitle
|
|
|
|
* sets the main window title bar text.
|
|
|
|
* <p>
|
|
|
|
* If file name defined by CVPCB_MAINFRAME::m_NetlistFileName is not set, the title is
|
|
|
|
* set to the application name appended with no file. Otherwise, the title is set to
|
|
|
|
* the full path and file name and read only is appended to the title if the user does
|
|
|
|
* not have write access to the file.
|
|
|
|
*/
|
|
|
|
void UpdateTitle();
|
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif //#ifndef _CVPCB_MAINFRAME_H_
|