pcad2kicadpcb_plugin: prepend numerical Ref with '.'
Kicad (EESchema) doesn't support only numerical references (like '1'). Prepend with '.' same references (convert reference '1' to '.1').
This commit is contained in:
parent
21ddb2d989
commit
897702b2dc
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/config.h>
|
||||
#include <wx/regex.h>
|
||||
|
||||
#include <common.h>
|
||||
#include <convert_to_biu.h>
|
||||
|
@ -225,6 +226,18 @@ wxString ValidateName( wxString aName )
|
|||
}
|
||||
|
||||
|
||||
wxString ValidateReference( wxString aRef )
|
||||
{
|
||||
wxRegEx reRef;
|
||||
reRef.Compile( wxT( "^[[:digit:]][[:digit:]]*$" ) );
|
||||
|
||||
if( reRef.Matches( aRef ) )
|
||||
aRef.Prepend( wxT( '.' ) );
|
||||
|
||||
return aRef;
|
||||
}
|
||||
|
||||
|
||||
void SetWidth( wxString aStr,
|
||||
wxString aDefaultMeasurementUnit,
|
||||
int* aWidth,
|
||||
|
|
|
@ -71,6 +71,7 @@ extern wxString GetAndCutWordWithMeasureUnits( wxString* aStr,
|
|||
wxString aDefaultMeasurementUnit );
|
||||
extern int StrToInt1Units( wxString aStr );
|
||||
extern wxString ValidateName( wxString aName );
|
||||
extern wxString ValidateReference( wxString aRef );
|
||||
extern void SetWidth( wxString aStr,
|
||||
wxString aDefaultMeasurementUnit,
|
||||
int* aWidth,
|
||||
|
|
|
@ -526,7 +526,7 @@ void PCB_MODULE::AddToBoard()
|
|||
// reference text
|
||||
TEXTE_MODULE* ref_text = &module->Reference();
|
||||
|
||||
ref_text->SetText( m_name.text );
|
||||
ref_text->SetText( ValidateReference( m_name.text ) );
|
||||
ref_text->SetType( TEXTE_MODULE::TEXT_is_REFERENCE );
|
||||
|
||||
ref_text->SetPos0( wxPoint( m_name.correctedPositionX, m_name.correctedPositionY ) );
|
||||
|
|
Loading…
Reference in New Issue