Commit a86385bf authored by jean-pierre charras's avatar jean-pierre charras

Eeschema: fix bug 714835. Add electrical pin type in intermediate netlist file.

Use non translated fields names in intermediate netlist file because they are keyword in this file.
Change intermediate netlist file extension from .tmp to .xml
parent f92da901
......@@ -569,31 +569,48 @@ void LIB_FIELD::Rotate()
}
wxString LIB_FIELD::GetName() const
wxString LIB_FIELD::GetName(bool aTranslate) const
{
wxString name;
switch( m_id )
{
case REFERENCE:
name = _( "Reference" );
if( aTranslate )
name = _( "Reference" );
else
name = wxT( "Reference" );
break;
case VALUE:
name = _( "Value" );
if( aTranslate )
name = _( "Value" );
else
name = wxT( "Value" );
break;
case FOOTPRINT:
name = _( "Footprint" );
if( aTranslate )
name = _( "Footprint" );
else
name = wxT( "Footprint" );
break;
case DATASHEET:
name = _( "Datasheet" );
if( aTranslate )
name = _( "Datasheet" );
else
name = wxT( "Datasheet" );
break;
default:
if( m_name.IsEmpty() )
{
if( aTranslate )
name.Printf( _( "Field%d" ), m_id );
else
name.Printf( wxT( "Field%d" ), m_id );
}
else
name = m_name;
}
......
......@@ -61,9 +61,12 @@ public:
* names. The user definable fields will return FieldN where N is the ID of the field
* when the m_name member is empty.
*
* @param aTranslate = true to return translated field name (default)
* false to return the english name
* (usefull when the name is used as keyword in netlists ...)
* @return Name of the field.
*/
wxString GetName() const;
wxString GetName(bool aTranslate = true) const;
/**
* Function SetName
......
......@@ -254,15 +254,27 @@ public:
*/
void SetShape( int aShape );
/**
* Get the electrical type of the pin.
*
* @return The electrical type of the pin (see enun ElectricPinType for values).
*/
int GetType() const { return m_type; }
/**
* return a string giving the electrical type of the pin.
*
* @return The electrical name of the pin (see enun MsgPinElectricType for names).
*/
wxString GetTypeString() const { return MsgPinElectricType[m_type]; }
/**
* Set the electrical type of the pin.
*
* This will also update the electrical type of the pins marked by
* EnableEditMode().
*
* @param aType - The electrical type of the pin.
* @param aType - The electrical type of the pin(see enun ElectricPinType for values).
*/
void SetType( int aType );
......
......@@ -31,7 +31,6 @@
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "confirm.h"
#include "kicad_string.h"
......@@ -55,6 +54,8 @@
#include "build_version.h"
#define INTERMEDIATE_NETLIST_EXT wxT("xml")
#include <set>
/**
......@@ -406,7 +407,7 @@ bool SCH_EDIT_FRAME::WriteNetListFile( int aFormat, const wxString& aFullFileNam
default:
{
wxFileName tmpFile = aFullFileName;
tmpFile.SetExt( wxT( "tmp" ) );
tmpFile.SetExt( INTERMEDIATE_NETLIST_EXT );
D(printf("tmpFile:'%s'\n", CONV_TO_UTF8( tmpFile.GetFullPath() ) );)
......@@ -611,6 +612,9 @@ SCH_COMPONENT* EXPORT_HELP::findNextComponentAndCreatPinList( EDA_ITEM* aI
// Remove duplicate Pins in m_SortedComponentPinList
eraseDuplicatePins( m_SortedComponentPinList );
// record the usage of this library component entry.
m_LibParts.insert( entry ); // rejects non-unique pointers
return comp;
}
......@@ -705,9 +709,10 @@ XNODE* EXPORT_HELP::makeGenericLibParts()
wxString sLibpart = wxT( "libpart" );
wxString sLib = wxT( "lib" );
wxString sPart = wxT( "part" );
wxString sPins = wxT( "pins" );
wxString sPin = wxT( "pin" );
wxString sNum = wxT( "num" );
wxString sPins = wxT( "pins" ); // key for library component pins list
wxString sPin = wxT( "pin" ); // key for one library component pin descr
wxString sNum = wxT( "num" ); // key for one library component pin num
wxString sPinType = wxT( "type" ); // key for one library component pin electrical type
wxString sName = wxT( "name" );
wxString sField = wxT( "field" );
wxString sFields = wxT( "fields" );
......@@ -765,7 +770,7 @@ XNODE* EXPORT_HELP::makeGenericLibParts()
{
XNODE* xfield;
xfields->AddChild( xfield = node( sField, fieldList[i].m_Text ) );
xfield->AddAttribute( sName, fieldList[i].GetName() );
xfield->AddAttribute( sName, fieldList[i].GetName(false) );
}
}
......@@ -786,6 +791,7 @@ XNODE* EXPORT_HELP::makeGenericLibParts()
pins->AddChild( pin = node( sPin ) );
pin->AddAttribute( sNum, pinList[i]->GetNumberString() );
pin->AddAttribute( sPinType, pinList[i]->GetTypeString() );
// caution: construction work site here, drive slowly
}
......
......@@ -372,7 +372,11 @@ void WinEDA_NetlistFrame::SetupPluginData( wxCommandEvent& event )
if( CurrPage == NULL )
return;
CurrPage->m_CommandStringCtrl->SetValue( FullFileName );
// Creates a default command line, suitable for external tool xslproc:
// TODO: build better default command lines depending on plugin extension
wxString cmdLine;
cmdLine.Printf(wxT("xsltproc -o %%O %s %%I"), GetChars(FullFileName) );
CurrPage->m_CommandStringCtrl->SetValue( cmdLine );
/* Get a title for this page */
wxString title = CurrPage->m_TitleStringCtrl->GetValue();
......
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