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