Commit b3f13be3 authored by Dick Hollenbeck's avatar Dick Hollenbeck
parent fa863b08
......@@ -230,7 +230,6 @@ class EXPORT_HELP
*/
XNODE* makeGenericLibraries();
public:
/**
......@@ -293,9 +292,56 @@ public:
*/
bool WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
bool use_netnames );
/**
* Function MakeCommandLine
* builds up a string that describes a command line for
* executing a child process. The input and output file names
* along with any options to the executable are all possibly
* in the returned string.
*
* @param aFormatString holds:
* <ul>
* <li>the name of the external program
* <li>any options needed by that program
* <li>formatting sequences, see below.
* </ul>
*
* @param aTempfile is the name of an input file to the
* external program.
* @param aFinalFile is the name of an output file that
* the user expects.
*
* <p> Supported formatting sequences and their meaning:
* <ul>
* <li> %B => base filename of selected output file, minus
* path and extension.
* <li> %I => complete filename and path of the temporary
* input file.
* <li> %O => complete filename and path of the user chosen
* output file.
* </ul>
*/
static wxString MakeCommandLine( const wxString& aFormatString,
const wxString& aTempfile, const wxString& aFinalFile );
};
wxString EXPORT_HELP::MakeCommandLine( const wxString& aFormatString,
const wxString& aTempfile, const wxString& aFinalFile )
{
wxString ret = aFormatString;
wxFileName in = aTempfile;
wxFileName out = aFinalFile;
ret.Replace( wxT("%B"), out.GetName().GetData(), true );
ret.Replace( wxT("%I"), in.GetFullName().GetData(), true );
ret.Replace( wxT("%O"), out.GetFullName().GetData(), true );
return ret;
}
/**
* Function WriteNetListFile
* creates the netlist file. Netlist info must be existing
......@@ -356,22 +402,18 @@ bool WinEDA_SchematicFrame::WriteNetListFile( int aFormat, const wxString& aFull
if( !ret )
break;
// Call the external module (plug in )
// If user provided no plugin command line, return now.
if( g_NetListerCommandLine.IsEmpty() )
break;
wxString commandLine;
if( wxIsAbsolutePath( g_NetListerCommandLine ) )
commandLine = g_NetListerCommandLine;
else
commandLine = FindKicadFile( g_NetListerCommandLine );
// this is the input file to the plugin
commandLine += wxT( " " ) + tmpFile.GetFullPath();
// this is the output file to the plugin
commandLine += wxT( " " ) + aFullFileName;
// build full command line from user's format string, e.g.:
// "xsltproc -o %O /usr/local/lib/kicad/plugins/netlist_form_pads-pcb.xsl %I"
// becomes, after the user selects /tmp/s1.net as the output file from the file dialog:
// "xsltproc -o /tmp/s1.net /usr/local/lib/kicad/plugins/netlist_form_pads-pcb.xsl /tmp/s1.tmp"
wxString commandLine = EXPORT_HELP::MakeCommandLine(
g_NetListerCommandLine,
tmpFile.GetFullPath(),
aFullFileName );
ProcessExecute( commandLine, wxEXEC_SYNC );
......@@ -1614,7 +1656,7 @@ bool EXPORT_HELP::writeGENERICListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjects
/* Generate CADSTAR net list. */
wxString StartLine( wxT( "." ) );
static wxString StartLine( wxT( "." ) );
void EXPORT_HELP::WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f )
......
......@@ -445,6 +445,7 @@ void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event )
wxFileName fn;
wxString FileWildcard, FileExt;
wxString msg, Command;
wxString title = _( "Save Netlist File" );
NetlistUpdateOpt();
......@@ -466,15 +467,20 @@ void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event )
FileWildcard = _( "CadStar netlist file (.frp)|*.frp" );
break;
default:
case NET_TYPE_PCBNEW:
FileExt = NetlistFileExtension;
FileWildcard = NetlistFileWildcard;
break;
default: // custom
FileExt = wxT( "*" );
FileWildcard = AllFilesWildcard;
title = _( "Generic Export" );
}
fn.SetExt( FileExt );
wxFileDialog dlg( this, _( "Save Netlist Files" ), fn.GetPath(),
wxFileDialog dlg( this, title, fn.GetPath(),
fn.GetFullName(), FileWildcard,
wxFD_SAVE );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment