2011-12-16 20:12:49 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2013-06-06 18:03:29 +00:00
|
|
|
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras@wanadoo.fr
|
|
|
|
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
|
2012-08-21 10:45:54 +00:00
|
|
|
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-12-16 20:12:49 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2011-09-30 18:15:37 +00:00
|
|
|
/**
|
2012-12-18 13:54:44 +00:00
|
|
|
* @file eeschema/dialogs/dialog_netlist.cpp
|
2011-09-30 18:15:37 +00:00
|
|
|
* @brief Dialog box for creating netlists.
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-09-30 18:15:37 +00:00
|
|
|
/* Functions relative to the dialog creating the netlist for Pcbnew.
|
2009-11-04 20:46:53 +00:00
|
|
|
* The dialog is a notebook with 4 fixed netlist format:
|
2011-09-30 18:15:37 +00:00
|
|
|
* Pcbnew ORCADPCB2 CADSTAR and SPICE
|
2007-11-10 14:35:04 +00:00
|
|
|
* and up to CUSTOMPANEL_COUNTMAX (see netlist.h) user programmable format
|
|
|
|
* calling an external converter with convert an intermediate format to the
|
|
|
|
* user specific format.
|
2009-11-04 20:46:53 +00:00
|
|
|
* these external converters are referred there as plugins,
|
2007-11-10 14:35:04 +00:00
|
|
|
* but there are not really plugins, there are only external binaries
|
|
|
|
*/
|
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
#include <pgm_base.h>
|
|
|
|
#include <kiface_i.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <confirm.h>
|
|
|
|
#include <gestfich.h>
|
|
|
|
#include <wxEeschemaStruct.h>
|
2009-09-25 18:49:04 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <general.h>
|
|
|
|
#include <netlist.h>
|
|
|
|
#include <sch_sheet.h>
|
|
|
|
#include <dialog_helpers.h>
|
2013-06-27 20:34:30 +00:00
|
|
|
#include <dialogs/dialog_netlist_base.h>
|
2012-02-16 20:03:33 +00:00
|
|
|
#include <wildcards_and_files_ext.h>
|
|
|
|
#include <wildcards_and_files_ext.h>
|
2013-06-27 20:34:30 +00:00
|
|
|
#include <invoke_sch_dialog.h>
|
2008-02-27 19:38:16 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
#include <eeschema_id.h>
|
|
|
|
|
2013-06-27 20:34:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
#define CUSTOMPANEL_COUNTMAX 8 // Max number of netlist plugins
|
|
|
|
|
|
|
|
|
|
|
|
/* panel (notebook page) identifiers */
|
|
|
|
enum panel_netlist_index {
|
|
|
|
PANELPCBNEW = 0, /* Handle Netlist format Pcbnew */
|
|
|
|
PANELORCADPCB2, /* Handle Netlist format OracdPcb2 */
|
|
|
|
PANELCADSTAR, /* Handle Netlist format CadStar */
|
|
|
|
PANELSPICE, /* Handle Netlist format Pspice */
|
|
|
|
PANELCUSTOMBASE /* First auxiliary panel (custom netlists).
|
|
|
|
* others use PANELCUSTOMBASE+1, PANELCUSTOMBASE+2.. */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* wxPanels for creating the NoteBook pages for each netlist format: */
|
|
|
|
class NETLIST_PAGE_DIALOG : public wxPanel
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NETLIST_TYPE_ID m_IdNetType;
|
|
|
|
wxCheckBox* m_IsCurrentFormat;
|
|
|
|
wxCheckBox* m_AddSubPrefix;
|
|
|
|
wxTextCtrl* m_CommandStringCtrl;
|
|
|
|
wxTextCtrl* m_TitleStringCtrl;
|
|
|
|
wxButton* m_ButtonCancel;
|
|
|
|
wxBoxSizer* m_LeftBoxSizer;
|
|
|
|
wxBoxSizer* m_RightBoxSizer;
|
|
|
|
wxBoxSizer* m_RightOptionsBoxSizer;
|
|
|
|
wxBoxSizer* m_LowBoxSizer;
|
|
|
|
wxRadioBox* m_NetOption;
|
|
|
|
private:
|
|
|
|
wxString m_pageNetFmtName;
|
|
|
|
|
|
|
|
public:
|
|
|
|
/** Constructor to create a setup page for one netlist format.
|
|
|
|
* Used in Netlist format Dialog box creation
|
|
|
|
* @param parent = wxNotebook * parent
|
|
|
|
* @param title = title (name) of the notebook page
|
|
|
|
* @param id_NetType = netlist type id
|
|
|
|
*/
|
|
|
|
NETLIST_PAGE_DIALOG( wxNotebook* parent, const wxString& title,
|
|
|
|
NETLIST_TYPE_ID id_NetType );
|
|
|
|
~NETLIST_PAGE_DIALOG() { };
|
|
|
|
|
|
|
|
/**
|
|
|
|
* function GetPageNetFmtName
|
|
|
|
* @return the name of the netlist format for this page
|
|
|
|
* This is usually the page label.
|
|
|
|
* For the pcbnew netlist, this is "LegacyPcbnew"
|
|
|
|
* when the "old" format is selected
|
|
|
|
* and "PcbnewAdvanced" when the advanced format (S expr fmt)is selected
|
|
|
|
*/
|
|
|
|
const wxString GetPageNetFmtName();
|
|
|
|
|
|
|
|
void SetPageNetFmtName( const wxString &aName ) { m_pageNetFmtName = aName; }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* Dialog frame for creating netlists */
|
|
|
|
class NETLIST_DIALOG : public NETLIST_DIALOG_BASE
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SCH_EDIT_FRAME* m_Parent;
|
|
|
|
wxString m_NetFmtName;
|
|
|
|
NETLIST_PAGE_DIALOG* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX];
|
|
|
|
|
|
|
|
private:
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
wxConfigBase* m_config;
|
2013-06-27 20:34:30 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
// Constructor and destructor
|
|
|
|
NETLIST_DIALOG( SCH_EDIT_FRAME* parent );
|
|
|
|
~NETLIST_DIALOG() { };
|
|
|
|
|
|
|
|
private:
|
|
|
|
void InstallCustomPages();
|
|
|
|
NETLIST_PAGE_DIALOG* AddOneCustomPage( const wxString & aTitle,
|
|
|
|
const wxString & aCommandString,
|
|
|
|
NETLIST_TYPE_ID aNetTypeId );
|
|
|
|
void InstallPageSpice();
|
|
|
|
void GenNetlist( wxCommandEvent& event );
|
|
|
|
void RunSimulator( wxCommandEvent& event );
|
|
|
|
void NetlistUpdateOpt();
|
|
|
|
void OnCancelClick( wxCommandEvent& event );
|
|
|
|
void OnNetlistTypeSelection( wxNotebookEvent& event );
|
|
|
|
void SelectDefaultNetlistType( wxCommandEvent& event );
|
|
|
|
void EnableSubcircuitPrefix( wxCommandEvent& event );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function OnAddPlugin
|
|
|
|
* Add a new panel for a new netlist plugin
|
|
|
|
*/
|
|
|
|
void OnAddPlugin( wxCommandEvent& event );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function OnDelPlugin
|
|
|
|
* Remove a panel relative to a netlist plugin
|
|
|
|
*/
|
|
|
|
void OnDelPlugin( wxCommandEvent& event );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function WriteCurrentNetlistSetup
|
|
|
|
* Write the current netlist options setup in the configuration
|
|
|
|
*/
|
|
|
|
void WriteCurrentNetlistSetup();
|
|
|
|
|
|
|
|
bool GetUseDefaultNetlistName()
|
|
|
|
{
|
|
|
|
return m_cbUseDefaultNetlistName->IsChecked();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
* Function UserNetlistTypeName
|
2013-06-27 20:34:30 +00:00
|
|
|
* to retrieve user netlist type names
|
|
|
|
* @param first_item = true: return first name of the list, false = return next
|
|
|
|
* @return a wxString : name of the type netlist or empty string
|
|
|
|
* this function must be called first with "first_item" = true
|
|
|
|
* and after with "first_item" = false to get all the other existing netlist names
|
|
|
|
*/
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
const wxString UserNetlistTypeName( bool first_item );
|
2013-06-27 20:34:30 +00:00
|
|
|
|
|
|
|
/**
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
* Function FilenamePrms
|
2013-06-27 20:34:30 +00:00
|
|
|
* returns the filename extension and the wildcard string for this curr
|
|
|
|
* or a void name if there is no default name
|
|
|
|
* @param aNetTypeId = the netlist type ( NET_TYPE_PCBNEW ... )
|
|
|
|
* @param aExt = a reference to a wxString to return the default file ext.
|
|
|
|
* @param aWildCard = reference to a wxString to return the default wildcard.
|
|
|
|
* @return true for known netlist type, false for custom formats
|
|
|
|
*/
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
bool FilenamePrms( NETLIST_TYPE_ID aNetTypeId,
|
2013-06-27 20:34:30 +00:00
|
|
|
wxString * aExt, wxString * aWildCard );
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class NETLIST_DIALOG_ADD_PLUGIN : public NETLIST_DIALOG_ADD_PLUGIN_BASE
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
NETLIST_DIALOG* m_Parent;
|
|
|
|
|
|
|
|
public:
|
|
|
|
NETLIST_DIALOG_ADD_PLUGIN( NETLIST_DIALOG* parent );
|
|
|
|
const wxString GetPluginTitle()
|
|
|
|
{
|
|
|
|
return m_textCtrlName->GetValue();
|
|
|
|
}
|
|
|
|
const wxString GetPluginTCommandLine()
|
|
|
|
{
|
|
|
|
return m_textCtrlCommand->GetValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function OnOKClick
|
|
|
|
* Validate info relative to a new netlist plugin
|
|
|
|
*/
|
|
|
|
void OnOKClick( wxCommandEvent& event );
|
|
|
|
void OnCancelClick( wxCommandEvent& event );
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Browse plugin files, and set m_CommandStringCtrl field
|
|
|
|
*/
|
|
|
|
void OnBrowsePlugins( wxCommandEvent& event );
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
/* Event id for notebook page buttons: */
|
|
|
|
enum id_netlist {
|
|
|
|
ID_CREATE_NETLIST = ID_END_EESCHEMA_ID_LIST + 1,
|
|
|
|
ID_CURRENT_FORMAT_IS_DEFAULT,
|
|
|
|
ID_RUN_SIMULATOR,
|
|
|
|
ID_ADD_SUBCIRCUIT_PREFIX
|
|
|
|
};
|
2011-03-31 15:22:34 +00:00
|
|
|
|
2010-06-28 13:11:14 +00:00
|
|
|
//Imported function:
|
2010-07-14 13:24:36 +00:00
|
|
|
int TestDuplicateSheetNames( bool aCreateMarker );
|
2009-09-25 18:49:04 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
// ID for configuration:
|
2007-11-10 14:35:04 +00:00
|
|
|
#define CUSTOM_NETLIST_TITLE wxT( "CustomNetlistTitle" )
|
|
|
|
#define CUSTOM_NETLIST_COMMAND wxT( "CustomNetlistCommand" )
|
2012-08-21 10:45:54 +00:00
|
|
|
#define NETLIST_USE_DEFAULT_NETNAME wxT( "NetlistUseDefaultNetname" )
|
2012-09-28 17:47:41 +00:00
|
|
|
#define NETLIST_PSPICE_USE_NETNAME wxT( "SpiceUseNetNames" )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-12-16 11:36:18 +00:00
|
|
|
#define NETLIST_PCBNEW_LEGACY wxT("LegacyPcbnew" )
|
|
|
|
#define NETLIST_PCBNEW_NEWFMT wxT("PcbnewAdvanced" )
|
2007-11-10 14:35:04 +00:00
|
|
|
|
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
BEGIN_EVENT_TABLE( NETLIST_DIALOG, NETLIST_DIALOG_BASE )
|
2011-02-08 18:39:41 +00:00
|
|
|
EVT_BUTTON( ID_CREATE_NETLIST, NETLIST_DIALOG::GenNetlist )
|
2010-12-14 15:56:30 +00:00
|
|
|
EVT_CHECKBOX( ID_CURRENT_FORMAT_IS_DEFAULT,
|
2012-08-21 10:45:54 +00:00
|
|
|
NETLIST_DIALOG::SelectDefaultNetlistType )
|
2011-03-31 15:22:34 +00:00
|
|
|
EVT_CHECKBOX( ID_ADD_SUBCIRCUIT_PREFIX,
|
|
|
|
NETLIST_DIALOG::EnableSubcircuitPrefix )
|
2011-02-08 18:39:41 +00:00
|
|
|
EVT_BUTTON( ID_RUN_SIMULATOR, NETLIST_DIALOG::RunSimulator )
|
2007-11-10 14:35:04 +00:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-02-08 18:39:41 +00:00
|
|
|
NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent,
|
2011-03-14 15:17:18 +00:00
|
|
|
const wxString& title,
|
2012-08-21 10:45:54 +00:00
|
|
|
NETLIST_TYPE_ID id_NetType ) :
|
2012-12-16 11:36:18 +00:00
|
|
|
wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize,
|
|
|
|
wxTAB_TRAVERSAL | wxBORDER_SUNKEN )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-11-05 06:14:55 +00:00
|
|
|
m_IdNetType = id_NetType;
|
2012-03-12 10:04:40 +00:00
|
|
|
m_pageNetFmtName = title;
|
2007-11-05 06:14:55 +00:00
|
|
|
m_CommandStringCtrl = NULL;
|
2007-11-10 14:35:04 +00:00
|
|
|
m_TitleStringCtrl = NULL;
|
|
|
|
m_IsCurrentFormat = NULL;
|
2011-04-01 12:12:19 +00:00
|
|
|
m_AddSubPrefix = NULL;
|
2007-11-05 06:14:55 +00:00
|
|
|
m_ButtonCancel = NULL;
|
2012-01-26 09:37:36 +00:00
|
|
|
m_NetOption = NULL;
|
2012-09-28 17:47:41 +00:00
|
|
|
|
2012-03-12 10:04:40 +00:00
|
|
|
wxString netfmtName = ((NETLIST_DIALOG*)parent->GetParent())->m_NetFmtName;
|
2012-12-16 11:36:18 +00:00
|
|
|
int fmtOption = 1; // Default Pcbnew netlist fmt is advanced fmt
|
2012-03-12 10:04:40 +00:00
|
|
|
|
|
|
|
bool selected = m_pageNetFmtName == netfmtName;
|
|
|
|
|
|
|
|
// PCBNEW Format is a special type:
|
|
|
|
if( id_NetType == NET_TYPE_PCBNEW )
|
|
|
|
{
|
2012-12-16 11:36:18 +00:00
|
|
|
if( netfmtName.IsEmpty() || netfmtName == NETLIST_PCBNEW_NEWFMT )
|
2012-03-12 10:04:40 +00:00
|
|
|
selected = true;
|
2012-12-16 11:36:18 +00:00
|
|
|
if( netfmtName == NETLIST_PCBNEW_LEGACY )
|
2012-03-12 10:04:40 +00:00
|
|
|
{
|
|
|
|
selected = true;
|
2012-12-16 11:36:18 +00:00
|
|
|
fmtOption = 0;
|
2012-03-12 10:04:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2009-04-29 17:09:00 +00:00
|
|
|
parent->AddPage( this, title, selected );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxVERTICAL );
|
|
|
|
SetSizer( MainBoxSizer );
|
|
|
|
wxBoxSizer* UpperBoxSizer = new wxBoxSizer( wxHORIZONTAL );
|
|
|
|
m_LowBoxSizer = new wxBoxSizer( wxVERTICAL );
|
|
|
|
MainBoxSizer->Add( UpperBoxSizer, 0, wxGROW | wxALL, 5 );
|
|
|
|
MainBoxSizer->Add( m_LowBoxSizer, 0, wxGROW | wxALL, 5 );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
m_LeftBoxSizer = new wxBoxSizer( wxVERTICAL );
|
|
|
|
m_RightBoxSizer = new wxBoxSizer( wxVERTICAL );
|
|
|
|
m_RightOptionsBoxSizer = new wxBoxSizer( wxVERTICAL );
|
|
|
|
UpperBoxSizer->Add( m_LeftBoxSizer, 0, wxGROW | wxALL, 5 );
|
|
|
|
UpperBoxSizer->Add( m_RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
2011-03-14 15:17:18 +00:00
|
|
|
UpperBoxSizer->Add( m_RightOptionsBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
wxStaticText* text = new wxStaticText( this, -1, _( "Options:" ) );
|
|
|
|
m_LeftBoxSizer->Add( text, 0, wxGROW | wxALL, 5 );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
m_IsCurrentFormat = new wxCheckBox( this, ID_CURRENT_FORMAT_IS_DEFAULT,
|
|
|
|
_( "Default format" ) );
|
|
|
|
m_LeftBoxSizer->Add( m_IsCurrentFormat, 0, wxGROW | wxALL, 5 );
|
|
|
|
m_IsCurrentFormat->SetValue( selected );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2012-01-26 09:37:36 +00:00
|
|
|
if( id_NetType == NET_TYPE_PCBNEW )
|
|
|
|
{
|
2012-12-16 11:36:18 +00:00
|
|
|
wxString netlist_opt[2] = { _( "Legacy Format" ), _( "Advanced Format" ) };
|
2012-01-26 09:37:36 +00:00
|
|
|
m_NetOption = new wxRadioBox( this, -1, _( "Netlist Options:" ),
|
|
|
|
wxDefaultPosition, wxDefaultSize,
|
|
|
|
2, netlist_opt, 1,
|
|
|
|
wxRA_SPECIFY_COLS );
|
2012-03-12 10:04:40 +00:00
|
|
|
m_NetOption->SetSelection( fmtOption );
|
2012-01-26 09:37:36 +00:00
|
|
|
m_LeftBoxSizer->Add( m_NetOption, 0, wxGROW | wxALL, 5 );
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2013-06-27 20:34:30 +00:00
|
|
|
|
2012-03-12 10:04:40 +00:00
|
|
|
const wxString NETLIST_PAGE_DIALOG::GetPageNetFmtName()
|
|
|
|
{
|
|
|
|
// PCBNEW Format is a special type:
|
|
|
|
if( m_IdNetType == NET_TYPE_PCBNEW )
|
|
|
|
{
|
|
|
|
if( m_NetOption->GetSelection() )
|
2012-12-16 11:36:18 +00:00
|
|
|
return NETLIST_PCBNEW_NEWFMT;
|
2012-03-12 10:04:40 +00:00
|
|
|
else
|
2012-12-16 11:36:18 +00:00
|
|
|
return NETLIST_PCBNEW_LEGACY;
|
2012-03-12 10:04:40 +00:00
|
|
|
}
|
2012-12-16 11:36:18 +00:00
|
|
|
|
2012-03-12 10:04:40 +00:00
|
|
|
return m_pageNetFmtName;
|
|
|
|
}
|
|
|
|
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2011-02-08 18:39:41 +00:00
|
|
|
NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) :
|
2012-08-21 10:45:54 +00:00
|
|
|
NETLIST_DIALOG_BASE( parent )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-11-05 06:14:55 +00:00
|
|
|
m_Parent = parent;
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
m_config = Kiface().KifaceSettings();
|
2012-08-21 10:45:54 +00:00
|
|
|
|
|
|
|
long tmp;
|
2012-09-28 17:47:41 +00:00
|
|
|
m_config->Read( NETLIST_USE_DEFAULT_NETNAME, &tmp, 0l );
|
2012-08-21 10:45:54 +00:00
|
|
|
m_cbUseDefaultNetlistName->SetValue( tmp );
|
2012-03-12 10:04:40 +00:00
|
|
|
m_NetFmtName = m_Parent->GetNetListFormatName();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
for( int ii = 0; ii < PANELCUSTOMBASE + CUSTOMPANEL_COUNTMAX; ii++ )
|
2007-11-05 06:14:55 +00:00
|
|
|
{
|
|
|
|
m_PanelNetType[ii] = NULL;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
// Add notebook pages:
|
2007-11-05 06:14:55 +00:00
|
|
|
|
|
|
|
// Add Panel FORMAT PCBNEW
|
2009-04-29 17:09:00 +00:00
|
|
|
m_PanelNetType[PANELPCBNEW] =
|
2012-08-21 10:45:54 +00:00
|
|
|
new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "Pcbnew" ),
|
|
|
|
NET_TYPE_PCBNEW );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
|
|
|
// Add Panel FORMAT ORCADPCB2
|
2009-04-29 17:09:00 +00:00
|
|
|
m_PanelNetType[PANELORCADPCB2] =
|
2012-08-21 10:45:54 +00:00
|
|
|
new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "OrcadPCB2" ),
|
|
|
|
NET_TYPE_ORCADPCB2 );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
|
|
|
// Add Panel FORMAT CADSTAR
|
2009-04-29 17:09:00 +00:00
|
|
|
m_PanelNetType[PANELCADSTAR] =
|
2012-08-21 10:45:54 +00:00
|
|
|
new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "CadStar" ),
|
|
|
|
NET_TYPE_CADSTAR );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-05 06:14:55 +00:00
|
|
|
// Add Panel spice
|
|
|
|
InstallPageSpice();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-05 06:14:55 +00:00
|
|
|
// Add custom panels:
|
|
|
|
InstallCustomPages();
|
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
GetSizer()->SetSizeHints( this );
|
2010-08-11 15:32:44 +00:00
|
|
|
|
2010-07-14 13:24:36 +00:00
|
|
|
Centre();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
const wxString NETLIST_DIALOG::UserNetlistTypeName( bool first_item )
|
2012-08-21 10:45:54 +00:00
|
|
|
{
|
|
|
|
static int index;
|
|
|
|
wxString name, msg;
|
|
|
|
|
|
|
|
if( first_item )
|
|
|
|
index = 0;
|
|
|
|
else
|
|
|
|
index++;
|
|
|
|
|
|
|
|
msg = CUSTOM_NETLIST_TITLE;
|
|
|
|
msg << index + 1;
|
|
|
|
|
2012-09-28 17:47:41 +00:00
|
|
|
name = m_config->Read( msg );
|
2012-08-21 10:45:54 +00:00
|
|
|
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
2013-06-27 20:34:30 +00:00
|
|
|
|
2011-02-08 18:39:41 +00:00
|
|
|
void NETLIST_DIALOG::InstallPageSpice()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2011-03-14 15:17:18 +00:00
|
|
|
wxButton* Button;
|
2011-02-08 18:39:41 +00:00
|
|
|
NETLIST_PAGE_DIALOG* page;
|
2012-03-12 10:04:40 +00:00
|
|
|
wxString title = wxT( "Spice" );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2009-04-29 17:09:00 +00:00
|
|
|
page = m_PanelNetType[PANELSPICE] =
|
2012-08-21 10:45:54 +00:00
|
|
|
new NETLIST_PAGE_DIALOG( m_NoteBook, title, NET_TYPE_SPICE );
|
2011-03-14 15:17:18 +00:00
|
|
|
|
2011-03-31 15:22:34 +00:00
|
|
|
|
|
|
|
page->m_AddSubPrefix = new wxCheckBox( page, ID_ADD_SUBCIRCUIT_PREFIX,
|
|
|
|
_( "Prefix references 'U' and 'IC' with 'X'" ) );
|
2011-12-09 16:37:11 +00:00
|
|
|
page->m_AddSubPrefix->SetValue( m_Parent->GetAddReferencePrefix() );
|
2011-03-31 15:22:34 +00:00
|
|
|
page->m_LeftBoxSizer->Add( page->m_AddSubPrefix, 0, wxGROW | wxALL, 5 );
|
|
|
|
|
2011-09-06 19:42:46 +00:00
|
|
|
page->m_LowBoxSizer->Add( new wxStaticText( page, -1, _( "Simulator command:" ) ), 0,
|
2012-02-28 20:14:17 +00:00
|
|
|
wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
|
2011-09-06 19:42:46 +00:00
|
|
|
|
|
|
|
page->m_CommandStringCtrl = new wxTextCtrl( page, -1, m_Parent->GetSimulatorCommand(),
|
|
|
|
wxDefaultPosition, wxDefaultSize );
|
|
|
|
|
|
|
|
page->m_CommandStringCtrl->SetInsertionPoint( 1 );
|
|
|
|
page->m_LowBoxSizer->Add( page->m_CommandStringCtrl,
|
|
|
|
0,
|
|
|
|
wxGROW | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM,
|
|
|
|
5 );
|
2007-11-10 14:35:04 +00:00
|
|
|
|
2007-11-05 06:14:55 +00:00
|
|
|
// Add buttons
|
2007-11-10 14:35:04 +00:00
|
|
|
Button = new wxButton( page, ID_RUN_SIMULATOR, _( "&Run Simulator" ) );
|
|
|
|
page->m_RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2011-03-14 15:17:18 +00:00
|
|
|
void NETLIST_DIALOG::InstallCustomPages()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2012-08-21 10:45:54 +00:00
|
|
|
int ii;
|
|
|
|
wxString title, msg;
|
|
|
|
NETLIST_PAGE_DIALOG* currPage;
|
2011-03-14 15:17:18 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
for( ii = 0; ii < CUSTOMPANEL_COUNTMAX; ii++ )
|
2007-11-05 06:14:55 +00:00
|
|
|
{
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
title = UserNetlistTypeName( ii == 0 ? true : false );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
|
|
|
if( title.IsEmpty() )
|
2012-08-21 10:45:54 +00:00
|
|
|
break; // No more panel to install
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
// Install a plugin panel
|
2007-11-05 06:14:55 +00:00
|
|
|
msg = CUSTOM_NETLIST_COMMAND;
|
|
|
|
msg << ii + 1;
|
2012-09-28 17:47:41 +00:00
|
|
|
wxString command = m_config->Read( msg );
|
2011-09-06 19:42:46 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
currPage = AddOneCustomPage( title, command,
|
|
|
|
(NETLIST_TYPE_ID)(NET_TYPE_CUSTOM1 + ii) );
|
|
|
|
m_PanelNetType[PANELCUSTOMBASE + ii] = currPage;
|
2007-11-05 06:14:55 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2013-06-27 20:34:30 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
NETLIST_PAGE_DIALOG* NETLIST_DIALOG::AddOneCustomPage( const wxString & aTitle,
|
|
|
|
const wxString & aCommandString,
|
|
|
|
NETLIST_TYPE_ID aNetTypeId )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2012-08-21 10:45:54 +00:00
|
|
|
NETLIST_PAGE_DIALOG* currPage;
|
2007-11-10 14:35:04 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
currPage = new NETLIST_PAGE_DIALOG( m_NoteBook, aTitle, aNetTypeId );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2011-03-14 15:17:18 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
currPage->m_LowBoxSizer->Add( new wxStaticText( currPage,
|
|
|
|
-1, _( "Netlist command:" ) ), 0,
|
|
|
|
wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
currPage->m_CommandStringCtrl = new wxTextCtrl( currPage, -1, aCommandString,
|
|
|
|
wxDefaultPosition, wxDefaultSize );
|
2011-03-14 15:17:18 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
currPage->m_CommandStringCtrl->SetInsertionPoint( 1 );
|
|
|
|
currPage->m_LowBoxSizer->Add( currPage->m_CommandStringCtrl,
|
|
|
|
0,
|
|
|
|
wxGROW | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM,
|
|
|
|
5 );
|
2011-02-08 18:39:41 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
currPage->m_LowBoxSizer->Add( new wxStaticText( currPage,
|
|
|
|
-1, _( "Title:" ) ), 0,
|
|
|
|
wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
currPage->m_TitleStringCtrl = new wxTextCtrl( currPage, -1, aTitle,
|
|
|
|
wxDefaultPosition, wxDefaultSize );
|
2011-09-06 19:42:46 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
currPage->m_TitleStringCtrl->SetInsertionPoint( 1 );
|
|
|
|
currPage->m_LowBoxSizer->Add( currPage->m_TitleStringCtrl,
|
|
|
|
0,
|
|
|
|
wxGROW | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM,
|
|
|
|
5 );
|
|
|
|
return currPage;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
void NETLIST_DIALOG::SelectDefaultNetlistType( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-11-10 14:35:04 +00:00
|
|
|
int ii;
|
2012-08-21 10:45:54 +00:00
|
|
|
NETLIST_PAGE_DIALOG* currPage;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-05 06:14:55 +00:00
|
|
|
for( ii = 0; ii < PANELCUSTOMBASE + CUSTOMPANEL_COUNTMAX; ii++ )
|
|
|
|
if( m_PanelNetType[ii] )
|
2012-03-12 10:04:40 +00:00
|
|
|
m_PanelNetType[ii]->m_IsCurrentFormat->SetValue( false );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
|
2011-03-14 15:17:18 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
if( currPage == NULL )
|
2007-11-05 06:14:55 +00:00
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
m_Parent->SetNetListFormatName( currPage->GetPageNetFmtName() );
|
|
|
|
currPage->m_IsCurrentFormat->SetValue( true );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2013-06-27 20:34:30 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
void NETLIST_DIALOG::OnNetlistTypeSelection( wxNotebookEvent& event )
|
|
|
|
{
|
|
|
|
NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
|
|
|
|
if( currPage == NULL )
|
|
|
|
return;
|
|
|
|
|
|
|
|
m_buttonDelPlugin->Enable( currPage->m_IdNetType >= NET_TYPE_CUSTOM1 );
|
|
|
|
m_cbUseDefaultNetlistName->Enable( currPage->m_IdNetType < NET_TYPE_CUSTOM1 );
|
|
|
|
|
|
|
|
wxString fileExt;
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
if( FilenamePrms( currPage->m_IdNetType, &fileExt, NULL ) )
|
2012-08-21 10:45:54 +00:00
|
|
|
{
|
|
|
|
wxFileName fn = g_RootSheet->GetScreen()->GetFileName();
|
|
|
|
fn.SetExt( fileExt );
|
|
|
|
m_textCtrlDefaultFileName->SetValue( fn.GetFullName() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
m_textCtrlDefaultFileName->Clear();
|
|
|
|
}
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2013-06-27 20:34:30 +00:00
|
|
|
|
2011-03-31 15:22:34 +00:00
|
|
|
void NETLIST_DIALOG::EnableSubcircuitPrefix( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
NETLIST_PAGE_DIALOG* currPage;
|
2011-03-31 15:22:34 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
|
2011-03-31 15:22:34 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
if( currPage == NULL || currPage->m_AddSubPrefix == NULL )
|
2011-03-31 15:22:34 +00:00
|
|
|
return;
|
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
m_Parent->SetAddReferencePrefix( currPage->m_AddSubPrefix->IsChecked() );
|
2011-03-31 15:22:34 +00:00
|
|
|
}
|
|
|
|
|
2013-06-27 20:34:30 +00:00
|
|
|
|
2011-02-08 18:39:41 +00:00
|
|
|
void NETLIST_DIALOG::NetlistUpdateOpt()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-11-10 14:35:04 +00:00
|
|
|
int ii;
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2011-06-15 18:44:24 +00:00
|
|
|
m_Parent->SetSimulatorCommand( m_PanelNetType[PANELSPICE]->m_CommandStringCtrl->GetValue() );
|
2012-03-12 10:04:40 +00:00
|
|
|
m_Parent->SetNetListFormatName( wxEmptyString );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
|
|
|
for( ii = 0; ii < PANELCUSTOMBASE + CUSTOMPANEL_COUNTMAX; ii++ )
|
|
|
|
{
|
|
|
|
if( m_PanelNetType[ii] == NULL )
|
|
|
|
break;
|
2011-03-14 15:17:18 +00:00
|
|
|
|
|
|
|
if( m_PanelNetType[ii]->m_IsCurrentFormat->GetValue() == true )
|
2012-03-12 10:04:40 +00:00
|
|
|
m_Parent->SetNetListFormatName( m_PanelNetType[ii]->GetPageNetFmtName() );
|
2007-11-05 06:14:55 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2011-03-14 15:17:18 +00:00
|
|
|
void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-08-11 14:47:16 +00:00
|
|
|
wxFileName fn;
|
|
|
|
wxString fileWildcard;
|
|
|
|
wxString fileExt;
|
|
|
|
wxString title = _( "Save Netlist File" );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-11-05 06:14:55 +00:00
|
|
|
NetlistUpdateOpt();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
NETLIST_PAGE_DIALOG* currPage;
|
|
|
|
currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2012-01-26 09:37:36 +00:00
|
|
|
unsigned netlist_opt = 0;
|
|
|
|
|
2013-06-27 20:34:30 +00:00
|
|
|
// Calculate the netlist filename
|
2011-01-20 16:34:57 +00:00
|
|
|
fn = g_RootSheet->GetScreen()->GetFileName();
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
FilenamePrms( currPage->m_IdNetType, &fileExt, &fileWildcard );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
// Set some parameters
|
|
|
|
switch( currPage->m_IdNetType )
|
2007-11-05 06:14:55 +00:00
|
|
|
{
|
|
|
|
case NET_TYPE_SPICE:
|
2012-01-26 09:37:36 +00:00
|
|
|
// Set spice netlist options:
|
2012-08-21 10:45:54 +00:00
|
|
|
if( currPage->m_AddSubPrefix->GetValue() )
|
2012-01-26 09:37:36 +00:00
|
|
|
netlist_opt |= NET_USE_X_PREFIX;
|
2007-11-05 06:14:55 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case NET_TYPE_CADSTAR:
|
|
|
|
break;
|
|
|
|
|
2010-08-11 05:58:34 +00:00
|
|
|
case NET_TYPE_PCBNEW:
|
2012-08-21 10:45:54 +00:00
|
|
|
if( currPage->m_NetOption->GetSelection() != 0 )
|
2012-01-26 09:37:36 +00:00
|
|
|
netlist_opt = NET_PCBNEW_USE_NEW_FORMAT;
|
|
|
|
break;
|
|
|
|
|
2010-08-11 14:47:16 +00:00
|
|
|
case NET_TYPE_ORCADPCB2:
|
2007-11-05 06:14:55 +00:00
|
|
|
break;
|
2010-08-11 05:58:34 +00:00
|
|
|
|
2010-08-11 14:47:16 +00:00
|
|
|
default: // custom, NET_TYPE_CUSTOM1 and greater
|
2012-08-21 10:45:54 +00:00
|
|
|
title.Printf( _( "%s Export" ), currPage->m_TitleStringCtrl->GetValue().GetData() );
|
2007-11-05 06:14:55 +00:00
|
|
|
}
|
|
|
|
|
2010-08-11 14:47:16 +00:00
|
|
|
fn.SetExt( fileExt );
|
2013-05-27 13:59:10 +00:00
|
|
|
|
|
|
|
if( fn.GetPath().IsEmpty() )
|
|
|
|
fn.SetPath( wxGetCwd() );
|
|
|
|
|
2013-06-27 20:34:30 +00:00
|
|
|
wxString fullpath = fn.GetFullPath();
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
if( !GetUseDefaultNetlistName() || currPage->m_IdNetType >= NET_TYPE_CUSTOM1 )
|
|
|
|
{
|
2013-06-27 20:34:30 +00:00
|
|
|
wxString fullname = fn.GetFullName();
|
|
|
|
wxString path = fn.GetPath();
|
|
|
|
|
|
|
|
// fullname does not and should not include the path, per wx docs.
|
|
|
|
wxFileDialog dlg( this, title, path, fullname, fileWildcard, wxFD_SAVE );
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
if( dlg.ShowModal() == wxID_CANCEL )
|
|
|
|
return;
|
|
|
|
|
2013-06-27 20:34:30 +00:00
|
|
|
fullpath = dlg.GetPath(); // directory + filename
|
2012-08-21 10:45:54 +00:00
|
|
|
}
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2009-10-14 19:43:31 +00:00
|
|
|
m_Parent->ClearMsgPanel();
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
if( currPage->m_CommandStringCtrl )
|
|
|
|
m_Parent->SetNetListerCommand( currPage->m_CommandStringCtrl->GetValue() );
|
2010-07-14 13:24:36 +00:00
|
|
|
else
|
2011-06-15 18:44:24 +00:00
|
|
|
m_Parent->SetNetListerCommand( wxEmptyString );
|
2010-07-14 13:24:36 +00:00
|
|
|
|
2013-06-27 20:34:30 +00:00
|
|
|
m_Parent->CreateNetlist( currPage->m_IdNetType, fullpath, netlist_opt );
|
2010-07-14 13:24:36 +00:00
|
|
|
|
|
|
|
WriteCurrentNetlistSetup();
|
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
EndModal( wxID_OK );
|
2010-07-14 13:24:36 +00:00
|
|
|
}
|
|
|
|
|
2013-06-27 20:34:30 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
bool NETLIST_DIALOG::FilenamePrms( NETLIST_TYPE_ID aNetTypeId,
|
2012-08-21 10:45:54 +00:00
|
|
|
wxString * aExt, wxString * aWildCard )
|
|
|
|
{
|
|
|
|
wxString fileExt;
|
|
|
|
wxString fileWildcard;
|
|
|
|
|
|
|
|
bool ret = true;
|
|
|
|
|
|
|
|
switch( aNetTypeId )
|
|
|
|
{
|
|
|
|
case NET_TYPE_SPICE:
|
|
|
|
fileExt = wxT( "cir" );
|
|
|
|
fileWildcard = _( "SPICE netlist file (.cir)|*.cir" );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NET_TYPE_CADSTAR:
|
|
|
|
fileExt = wxT( "frp" );
|
|
|
|
fileWildcard = _( "CadStar netlist file (.frp)|*.frp" );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NET_TYPE_PCBNEW:
|
|
|
|
case NET_TYPE_ORCADPCB2:
|
|
|
|
fileExt = NetlistFileExtension;
|
|
|
|
fileWildcard = NetlistFileWildcard;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default: // custom, NET_TYPE_CUSTOM1 and greater
|
|
|
|
fileWildcard = AllFilesWildcard;
|
|
|
|
ret = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( aExt )
|
|
|
|
*aExt = fileExt;
|
|
|
|
|
|
|
|
if( aWildCard )
|
|
|
|
*aWildCard = fileWildcard;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2010-07-14 13:24:36 +00:00
|
|
|
|
2013-06-27 20:34:30 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
bool SCH_EDIT_FRAME::CreateNetlist( int aFormat, const wxString& aFullFileName,
|
2012-01-26 09:37:36 +00:00
|
|
|
unsigned aNetlistOptions )
|
2010-07-14 13:24:36 +00:00
|
|
|
{
|
2010-12-31 19:47:39 +00:00
|
|
|
SCH_SHEET_LIST sheets;
|
|
|
|
sheets.AnnotatePowerSymbols();
|
2010-07-14 13:24:36 +00:00
|
|
|
|
|
|
|
// Performs some controls:
|
|
|
|
if( CheckAnnotate( NULL, 0 ) )
|
2007-11-05 06:14:55 +00:00
|
|
|
{
|
2011-01-10 17:47:50 +00:00
|
|
|
if( !IsOK( NULL, _( "Some items are not annotated\n\
|
|
|
|
Do you want to annotate schematic?" ) ) )
|
|
|
|
return false;
|
2011-03-14 15:17:18 +00:00
|
|
|
|
2011-01-10 17:47:50 +00:00
|
|
|
// Schematic must be annotated: call Annotate dialog:
|
|
|
|
wxCommandEvent event;
|
|
|
|
OnAnnotate( event );
|
2011-03-14 15:17:18 +00:00
|
|
|
|
2011-01-10 17:47:50 +00:00
|
|
|
if( CheckAnnotate( NULL, 0 ) )
|
2010-07-14 13:24:36 +00:00
|
|
|
return false;
|
2007-11-05 06:14:55 +00:00
|
|
|
}
|
|
|
|
|
2010-06-28 13:11:14 +00:00
|
|
|
// Test duplicate sheet names:
|
2010-07-14 13:24:36 +00:00
|
|
|
if( TestDuplicateSheetNames( false ) > 0 )
|
2010-06-28 13:11:14 +00:00
|
|
|
{
|
2010-07-14 13:24:36 +00:00
|
|
|
if( !IsOK( NULL, _( "Error: duplicate sheet names. Continue?" ) ) )
|
|
|
|
return false;
|
2010-06-28 13:11:14 +00:00
|
|
|
}
|
|
|
|
|
2013-06-27 20:34:30 +00:00
|
|
|
// Cleanup the entire hierarchy
|
2010-12-31 19:47:39 +00:00
|
|
|
SCH_SCREENS screens;
|
|
|
|
screens.SchematicCleanUp();
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2013-09-27 12:30:35 +00:00
|
|
|
NETLIST_OBJECT_LIST * connectedItemsList = BuildNetListBase();
|
|
|
|
bool success = WriteNetListFile( connectedItemsList, aFormat,
|
|
|
|
aFullFileName, aNetlistOptions );
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2010-07-14 13:24:36 +00:00
|
|
|
return success;
|
2007-11-10 14:35:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-08 18:39:41 +00:00
|
|
|
void NETLIST_DIALOG::OnCancelClick( wxCommandEvent& event )
|
2007-11-10 14:35:04 +00:00
|
|
|
{
|
2012-08-21 10:45:54 +00:00
|
|
|
EndModal( wxID_CANCEL );
|
2007-11-10 14:35:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-08 18:39:41 +00:00
|
|
|
void NETLIST_DIALOG::RunSimulator( wxCommandEvent& event )
|
2007-11-10 14:35:04 +00:00
|
|
|
{
|
2009-04-05 20:49:15 +00:00
|
|
|
wxFileName fn;
|
2010-07-14 13:24:36 +00:00
|
|
|
wxString ExecFile, CommandLine;
|
2007-11-10 14:35:04 +00:00
|
|
|
|
2011-06-15 18:44:24 +00:00
|
|
|
wxString tmp = m_PanelNetType[PANELSPICE]->m_CommandStringCtrl->GetValue();
|
|
|
|
tmp.Trim( false );
|
|
|
|
tmp.Trim( true );
|
|
|
|
m_Parent->SetSimulatorCommand( tmp );
|
|
|
|
ExecFile = tmp.BeforeFirst( ' ' );
|
|
|
|
CommandLine = tmp.AfterFirst( ' ' );
|
2007-11-10 14:35:04 +00:00
|
|
|
|
2013-06-27 20:34:30 +00:00
|
|
|
// Calculate the netlist filename
|
2011-01-20 16:34:57 +00:00
|
|
|
fn = g_RootSheet->GetScreen()->GetFileName();
|
2009-04-05 20:49:15 +00:00
|
|
|
fn.SetExt( wxT( "cir" ) );
|
|
|
|
CommandLine += wxT( " \"" ) + fn.GetFullPath() + wxT( "\"" );
|
2007-11-10 14:35:04 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
NETLIST_PAGE_DIALOG* currPage;
|
|
|
|
currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
|
2010-07-14 13:24:36 +00:00
|
|
|
|
2012-01-26 09:37:36 +00:00
|
|
|
// Set spice netlist options:
|
|
|
|
unsigned netlist_opt = 0;
|
2011-06-15 18:44:24 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
if( currPage->m_AddSubPrefix && currPage->m_AddSubPrefix->GetValue() )
|
2012-01-26 09:37:36 +00:00
|
|
|
netlist_opt |= NET_USE_X_PREFIX;
|
2011-06-15 18:44:24 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
if( ! m_Parent->CreateNetlist( currPage->m_IdNetType, fn.GetFullPath(),
|
2012-01-26 09:37:36 +00:00
|
|
|
netlist_opt ) )
|
2010-07-14 13:24:36 +00:00
|
|
|
return;
|
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
ExecuteFile( this, ExecFile, CommandLine );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-06-27 20:34:30 +00:00
|
|
|
void NETLIST_DIALOG::WriteCurrentNetlistSetup()
|
2007-11-10 14:35:04 +00:00
|
|
|
{
|
2010-07-14 13:24:36 +00:00
|
|
|
wxString msg, Command;
|
2007-11-10 14:35:04 +00:00
|
|
|
|
2007-11-05 06:14:55 +00:00
|
|
|
NetlistUpdateOpt();
|
2007-11-10 14:35:04 +00:00
|
|
|
|
2012-09-28 17:47:41 +00:00
|
|
|
m_config->Write( NETLIST_USE_DEFAULT_NETNAME, GetUseDefaultNetlistName() );
|
2012-08-21 10:45:54 +00:00
|
|
|
|
2013-06-06 18:03:29 +00:00
|
|
|
// Update existing custom pages
|
|
|
|
int jj = 0;
|
2007-11-05 06:14:55 +00:00
|
|
|
for( int ii = 0; ii < CUSTOMPANEL_COUNTMAX; ii++ )
|
|
|
|
{
|
2012-08-21 10:45:54 +00:00
|
|
|
NETLIST_PAGE_DIALOG* currPage = m_PanelNetType[ii + PANELCUSTOMBASE];
|
2011-03-14 15:17:18 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
if( currPage == NULL )
|
2007-11-05 06:14:55 +00:00
|
|
|
break;
|
2011-03-14 15:17:18 +00:00
|
|
|
|
2013-06-06 18:03:29 +00:00
|
|
|
wxString title = currPage->m_TitleStringCtrl->GetValue();
|
2011-03-14 15:17:18 +00:00
|
|
|
|
2013-06-06 18:03:29 +00:00
|
|
|
if( title.IsEmpty() )
|
|
|
|
continue;
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2013-06-06 18:03:29 +00:00
|
|
|
msg = CUSTOM_NETLIST_TITLE;
|
|
|
|
msg << jj + 1;
|
|
|
|
m_config->Write( msg, title );
|
|
|
|
|
|
|
|
Command = currPage->m_CommandStringCtrl->GetValue();
|
|
|
|
msg = CUSTOM_NETLIST_COMMAND;
|
|
|
|
msg << jj + 1;
|
|
|
|
m_config->Write( msg, Command );
|
|
|
|
jj++;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Ensure all other pages are void
|
|
|
|
for(; jj < CUSTOMPANEL_COUNTMAX; jj++ )
|
|
|
|
{
|
|
|
|
msg = CUSTOM_NETLIST_TITLE;
|
|
|
|
msg << jj + 1;
|
|
|
|
m_config->Write( msg, wxEmptyString );
|
|
|
|
|
|
|
|
msg = CUSTOM_NETLIST_COMMAND;
|
|
|
|
msg << jj + 1;
|
|
|
|
m_config->Write( msg, wxEmptyString );
|
2007-11-05 06:14:55 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-11-05 06:14:55 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
void NETLIST_DIALOG::OnDelPlugin( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2012-08-21 10:45:54 +00:00
|
|
|
NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
currPage->m_CommandStringCtrl->SetValue( wxEmptyString );
|
|
|
|
currPage->m_TitleStringCtrl->SetValue( wxEmptyString );
|
2011-03-14 15:17:18 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
if( currPage->m_IsCurrentFormat->IsChecked() )
|
2007-11-10 14:35:04 +00:00
|
|
|
{
|
2012-08-21 10:45:54 +00:00
|
|
|
currPage->m_IsCurrentFormat->SetValue( false );
|
2011-03-14 15:17:18 +00:00
|
|
|
m_PanelNetType[PANELPCBNEW]->m_IsCurrentFormat->SetValue( true );
|
2007-11-10 14:35:04 +00:00
|
|
|
}
|
2011-03-14 15:17:18 +00:00
|
|
|
|
2007-11-10 14:35:04 +00:00
|
|
|
WriteCurrentNetlistSetup();
|
|
|
|
EndModal( NET_PLUGIN_CHANGE );
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2013-06-27 20:34:30 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
void NETLIST_DIALOG::OnAddPlugin( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
NETLIST_DIALOG_ADD_PLUGIN dlg( this );
|
|
|
|
if( dlg.ShowModal() != wxID_OK )
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Creates a new custom plugin page
|
|
|
|
wxString title = dlg.GetPluginTitle();
|
|
|
|
|
|
|
|
// Verify it does not exists
|
|
|
|
int netTypeId = PANELCUSTOMBASE; // the first not used type id
|
|
|
|
NETLIST_PAGE_DIALOG* currPage;
|
|
|
|
for( int ii = 0; ii < CUSTOMPANEL_COUNTMAX; ii++ )
|
|
|
|
{
|
|
|
|
netTypeId = PANELCUSTOMBASE + ii;
|
|
|
|
currPage = m_PanelNetType[ii + PANELCUSTOMBASE];
|
|
|
|
|
|
|
|
if( currPage == NULL )
|
|
|
|
break;
|
|
|
|
|
|
|
|
if( currPage->GetPageNetFmtName() == title )
|
|
|
|
{
|
|
|
|
wxMessageBox( _("This plugin already exists. Abort") );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
wxString cmd = dlg.GetPluginTCommandLine();
|
|
|
|
currPage = AddOneCustomPage( title,cmd, (NETLIST_TYPE_ID)netTypeId );
|
|
|
|
m_PanelNetType[netTypeId] = currPage;
|
|
|
|
WriteCurrentNetlistSetup();
|
|
|
|
|
|
|
|
// Close and reopen dialog to rebuild the dialog after changes
|
|
|
|
EndModal( NET_PLUGIN_CHANGE );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NETLIST_DIALOG_ADD_PLUGIN::NETLIST_DIALOG_ADD_PLUGIN( NETLIST_DIALOG* parent ) :
|
|
|
|
NETLIST_DIALOG_ADD_PLUGIN_BASE( parent )
|
2007-11-10 14:35:04 +00:00
|
|
|
{
|
2012-08-21 10:45:54 +00:00
|
|
|
m_Parent = parent;
|
|
|
|
GetSizer()->SetSizeHints( this );
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2013-06-27 20:34:30 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
void NETLIST_DIALOG_ADD_PLUGIN::OnOKClick( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
if( m_textCtrlCommand->GetValue() == wxEmptyString )
|
2007-11-10 14:35:04 +00:00
|
|
|
{
|
2012-08-21 10:45:54 +00:00
|
|
|
wxMessageBox( _( "Error. You must provide a command String" ) );
|
2007-11-10 14:35:04 +00:00
|
|
|
return;
|
|
|
|
}
|
2011-03-14 15:17:18 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
if( m_textCtrlName->GetValue() == wxEmptyString )
|
2007-11-10 14:35:04 +00:00
|
|
|
{
|
2012-08-21 10:45:54 +00:00
|
|
|
wxMessageBox( _( "Error. You must provide a Title" ) );
|
2007-11-10 14:35:04 +00:00
|
|
|
return;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
EndModal( wxID_OK );
|
|
|
|
}
|
|
|
|
|
2013-06-27 20:34:30 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
void NETLIST_DIALOG_ADD_PLUGIN::OnCancelClick( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
EndModal( wxID_CANCEL );
|
|
|
|
}
|
|
|
|
|
2013-06-27 20:34:30 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
void NETLIST_DIALOG_ADD_PLUGIN::OnBrowsePlugins( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
wxString FullFileName, Mask, Path;
|
|
|
|
|
|
|
|
Mask = wxT( "*" );
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
Path = Pgm().GetExecutablePath();
|
2012-08-21 10:45:54 +00:00
|
|
|
FullFileName = EDA_FileSelector( _( "Plugin files:" ),
|
|
|
|
Path,
|
|
|
|
FullFileName,
|
|
|
|
wxEmptyString,
|
|
|
|
Mask,
|
|
|
|
this,
|
|
|
|
wxFD_OPEN,
|
|
|
|
true
|
|
|
|
);
|
|
|
|
if( FullFileName.IsEmpty() )
|
|
|
|
return;
|
|
|
|
|
2013-06-06 18:03:29 +00:00
|
|
|
// Creates a default command line, suitable for external tool xslproc or python
|
2012-08-21 10:45:54 +00:00
|
|
|
// try to build a default command line depending on plugin extension
|
2013-06-06 18:03:29 +00:00
|
|
|
// "xsl" or "exe" or "py"
|
2012-08-21 10:45:54 +00:00
|
|
|
wxString cmdLine;
|
|
|
|
wxFileName fn( FullFileName );
|
|
|
|
wxString ext = fn.GetExt();
|
|
|
|
|
|
|
|
if( ext == wxT("xsl" ) )
|
|
|
|
cmdLine.Printf(wxT("xsltproc -o \"%%O\" \"%s\" \"%%I\""), GetChars(FullFileName) );
|
|
|
|
else if( ext == wxT("exe" ) || ext.IsEmpty() )
|
|
|
|
cmdLine.Printf(wxT("\"%s\" > \"%%O\" < \"%%I\""), GetChars(FullFileName) );
|
2013-06-06 18:03:29 +00:00
|
|
|
else if( ext == wxT("py" ) || ext.IsEmpty() )
|
|
|
|
cmdLine.Printf(wxT("python \"%s\" \"%%I\" \"%%O\""), GetChars(FullFileName) );
|
2012-08-21 10:45:54 +00:00
|
|
|
else
|
|
|
|
cmdLine.Printf(wxT("\"%s\""), GetChars(FullFileName) );
|
|
|
|
|
|
|
|
m_textCtrlCommand->SetValue( cmdLine );
|
|
|
|
|
|
|
|
/* Get a title for this page */
|
|
|
|
wxString title = m_textCtrlName->GetValue();
|
|
|
|
|
|
|
|
if( title.IsEmpty() )
|
|
|
|
wxMessageBox( _( "Do not forget to choose a title for this netlist control page" ) );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
2013-06-27 20:34:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
int InvokeDialogNetList( SCH_EDIT_FRAME* aCaller )
|
|
|
|
{
|
|
|
|
NETLIST_DIALOG dlg( aCaller );
|
|
|
|
|
|
|
|
return dlg.ShowModal();
|
|
|
|
}
|
|
|
|
|