fix backanno for unicode and eeschema's debug build
This commit is contained in:
parent
7327197c17
commit
795e069a7a
|
@ -36,6 +36,7 @@ set(CVPCB_SRCS
|
||||||
set(CVPCB_EXTRA_SRCS
|
set(CVPCB_EXTRA_SRCS
|
||||||
../pcbnew/basepcbframe.cpp
|
../pcbnew/basepcbframe.cpp
|
||||||
../pcbnew/class_board.cpp
|
../pcbnew/class_board.cpp
|
||||||
|
../pcbnew/class_board_item.cpp
|
||||||
../pcbnew/class_cotation.cpp
|
../pcbnew/class_cotation.cpp
|
||||||
../pcbnew/class_drawsegment.cpp
|
../pcbnew/class_drawsegment.cpp
|
||||||
../pcbnew/class_edge_mod.cpp
|
../pcbnew/class_edge_mod.cpp
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
* EESchema: backanno.cpp
|
* EESchema: backanno.cpp
|
||||||
* (functions for backannotating Footprint info
|
* (functions for backannotating Footprint info
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "gr_basic.h"
|
#include "gr_basic.h"
|
||||||
|
@ -18,82 +18,90 @@
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
bool WinEDA_SchematicFrame::ProcessStuffFile(FILE* StuffFile)
|
bool WinEDA_SchematicFrame::ProcessStuffFile( FILE* StuffFile )
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
|
|
||||||
/* get footprint info from each line in the Stuff File by Ref Desg
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
int LineNum = 0;
|
int LineNum = 0;
|
||||||
char *cp, Ref[256], FootPrint[256], Line[1024];
|
char* cp, Ref[256], FootPrint[256], Line[1024];
|
||||||
SCH_ITEM* DrawList = NULL;
|
SCH_ITEM* DrawList = NULL;
|
||||||
SCH_COMPONENT* Cmp ;
|
SCH_COMPONENT* Cmp;
|
||||||
PartTextStruct* TextField ;
|
PartTextStruct* TextField;
|
||||||
|
|
||||||
while( GetLine( StuffFile, Line, &LineNum, sizeof(Line) ) ) {
|
while( GetLine( StuffFile, Line, &LineNum, sizeof(Line) ) )
|
||||||
if( sscanf( Line, "comp = \"%s module = \"%s", Ref, FootPrint) == 2 ) {
|
{
|
||||||
for( cp=Ref; *cp ; cp++ )
|
if( sscanf( Line, "comp = \"%s module = \"%s", Ref, FootPrint ) == 2 )
|
||||||
if( *cp == '"' )
|
{
|
||||||
*cp = 0;
|
for( cp = Ref; *cp; cp++ )
|
||||||
for( cp=FootPrint; *cp ; cp++ )
|
if( *cp == '"' )
|
||||||
if( *cp == '"' )
|
*cp = 0;
|
||||||
*cp = 0;
|
|
||||||
// printf("'%s' '%s'\n", Ref, FootPrint);
|
|
||||||
DrawList = WinEDA_SchematicFrame::FindComponentAndItem(
|
|
||||||
Ref, TRUE, 2, wxEmptyString, false);
|
|
||||||
|
|
||||||
if( DrawList == NULL )
|
for( cp = FootPrint; *cp; cp++ )
|
||||||
continue;
|
if( *cp == '"' )
|
||||||
|
*cp = 0;
|
||||||
|
|
||||||
if( DrawList->Type() == TYPE_SCH_COMPONENT ) {
|
// printf("'%s' '%s'\n", Ref, FootPrint);
|
||||||
Cmp = (SCH_COMPONENT*) DrawList;
|
|
||||||
TextField = &Cmp->m_Field[FOOTPRINT];
|
wxString reference = CONV_FROM_UTF8( Ref );
|
||||||
TextField->m_Text = FootPrint;
|
|
||||||
}
|
DrawList = WinEDA_SchematicFrame::FindComponentAndItem(
|
||||||
}
|
reference, TRUE, 2, wxEmptyString, false );
|
||||||
|
|
||||||
|
if( DrawList == NULL )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( DrawList->Type() == TYPE_SCH_COMPONENT )
|
||||||
|
{
|
||||||
|
Cmp = (SCH_COMPONENT*) DrawList;
|
||||||
|
TextField = &Cmp->m_Field[FOOTPRINT];
|
||||||
|
TextField->m_Text = CONV_FROM_UTF8( FootPrint );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
bool WinEDA_SchematicFrame::ReadInputStuffFile()
|
bool WinEDA_SchematicFrame::ReadInputStuffFile()
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
|
|
||||||
/* Backann footprint info to schematic.
|
/* Backann footprint info to schematic.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxString Line, filename;
|
wxString Line, filename;
|
||||||
FILE* StuffFile;
|
FILE* StuffFile;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
filename = EDA_FileSelector(_("Load Stuff File"),
|
filename = EDA_FileSelector( _( "Load Stuff File" ),
|
||||||
wxEmptyString, /* Chemin par defaut */
|
wxEmptyString, /* Chemin par defaut */
|
||||||
wxEmptyString, /* nom fichier par defaut */
|
wxEmptyString, /* nom fichier par defaut */
|
||||||
wxT( ".stf" ), /* extension par defaut */
|
wxT( ".stf" ), /* extension par defaut */
|
||||||
wxT( "*.stf" ), /* Masque d'affichage */
|
wxT( "*.stf" ), /* Masque d'affichage */
|
||||||
this,
|
this,
|
||||||
wxFD_OPEN,
|
wxFD_OPEN,
|
||||||
FALSE
|
FALSE
|
||||||
);
|
);
|
||||||
if ( filename.IsEmpty())
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
Line = g_Main_Title + wxT(" ") + GetBuildVersion();
|
if( filename.IsEmpty() )
|
||||||
Line += wxT(" ") + filename;
|
return FALSE;
|
||||||
SetTitle(Line);
|
|
||||||
|
Line = g_Main_Title + wxT( " " ) + GetBuildVersion();
|
||||||
|
Line += wxT( " " ) + filename;
|
||||||
|
SetTitle( Line );
|
||||||
|
|
||||||
if( filename.IsEmpty() )
|
if( filename.IsEmpty() )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
StuffFile = wxFopen( filename, wxT( "rt" ) );
|
StuffFile = wxFopen( filename, wxT( "rt" ) );
|
||||||
if( StuffFile == NULL ) {
|
if( StuffFile == NULL )
|
||||||
|
{
|
||||||
msg.Printf( _( "Failed to open Stuff File <%s>" ), filename.GetData() );
|
msg.Printf( _( "Failed to open Stuff File <%s>" ), filename.GetData() );
|
||||||
DisplayError( this, msg, 20 );
|
DisplayError( this, msg, 20 );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessStuffFile( StuffFile );
|
ProcessStuffFile( StuffFile );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,8 +128,17 @@ public:
|
||||||
void SaveProject();
|
void SaveProject();
|
||||||
int LoadOneEEProject( const wxString& FileName, bool IsNew );
|
int LoadOneEEProject( const wxString& FileName, bool IsNew );
|
||||||
bool LoadOneEEFile( SCH_SCREEN* screen, const wxString& FullFileName );
|
bool LoadOneEEFile( SCH_SCREEN* screen, const wxString& FullFileName );
|
||||||
bool ReadInputStuffFile();
|
bool ReadInputStuffFile();
|
||||||
bool ProcessStuffFile(FILE* filename);
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function ProcessStuffFile
|
||||||
|
* gets footprint info from each line in the Stuff File by Ref Desg
|
||||||
|
* @param filename The file to read from.
|
||||||
|
* @return bool - true if success, else true.
|
||||||
|
*/
|
||||||
|
bool ProcessStuffFile( FILE* filename );
|
||||||
|
|
||||||
bool SaveEEFile( SCH_SCREEN* screen, int FileSave );
|
bool SaveEEFile( SCH_SCREEN* screen, int FileSave );
|
||||||
SCH_SCREEN* CreateNewScreen( SCH_SCREEN* OldScreen, int TimeStamp );
|
SCH_SCREEN* CreateNewScreen( SCH_SCREEN* OldScreen, int TimeStamp );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue