Commit 9c3d5bd9 authored by CHARRAS's avatar CHARRAS

eschema, pcbnew and cvpcb did not find libraries when they were in the default...

eschema, pcbnew and cvpcb did not find libraries when they were in the default library path, but in a subdirectory
parent b9049c50
...@@ -4,6 +4,16 @@ Started 2007-June-11 ...@@ -4,6 +4,16 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2007-Nov-032 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+all:
solved: eeschema, pcbnew and cvpcb did not find libraries when they were
in the default library path, but in a subdirectory
(this is because the default path was not added to the name if the name had
already a path)
2007-Nov-02 UPDATE Geoff Harland <gharlandau@yahoo.com.au> 2007-Nov-02 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
================================================================================ ================================================================================
+ pcbnew + pcbnew
......
...@@ -85,17 +85,18 @@ wxString MakeReducedFileName( const wxString& fullfilename, ...@@ -85,17 +85,18 @@ wxString MakeReducedFileName( const wxString& fullfilename,
const wxString& default_ext ) const wxString& default_ext )
/***************************************************************************/ /***************************************************************************/
/* Calcule le nom "reduit" d'un fichier d'apres les chaines /** Function MakeReducedFileName
* fullfilename = nom complet * Calculate the "reduced" filename from
* default_path = prefixe (chemin) par defaut * @param fullfilename = full filename
* default_ext = extension par defaut * @param default_path = default path
* @param default_ext = default extension
* *
* retourne le nom reduit, c'est a dire: * @return the "reduced" filename, i.e.:
* sans le chemin si le chemin est default_path * without path if it is default_path
* avec ./ si si le chemin est le chemin courant * wiht ./ if the path is the current path
* sans l'extension si l'extension est default_ext * without extension if extension is default_ext
* *
* Renvoie un chemin en notation unix ('/' en separateur de repertoire) * the new flename is in unix like notation ('/' as path separator)
*/ */
{ {
wxString reduced_filename = fullfilename; wxString reduced_filename = fullfilename;
...@@ -111,18 +112,19 @@ wxString MakeReducedFileName( const wxString& fullfilename, ...@@ -111,18 +112,19 @@ wxString MakeReducedFileName( const wxString& fullfilename,
path.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP ); path.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
#ifdef __WINDOWS__ #ifdef __WINDOWS__
// names are case insensitive under windows
path.MakeLower(); path.MakeLower();
Cwd.MakeLower(); Cwd.MakeLower();
ext.MakeLower(); ext.MakeLower();
#endif #endif
// Si le fichier est dans chemin par defaut -> suppression du chemin par defaut // if the path is "default_path" -> remove it
wxString root_path = path.Left( Cwd.Length() ); wxString root_path = path.Left( Cwd.Length() );
if( root_path == Cwd ) if( root_path == Cwd )
{ {
reduced_filename.Remove( 0, Cwd.Length() ); reduced_filename.Remove( 0, Cwd.Length() );
} }
else // Si fichier dans repertoire courant -> chemin = ./ else // if the path is the current path -> change path to ./
{ {
Cwd = wxGetCwd() + UNIX_STRING_DIR_SEP; Cwd = wxGetCwd() + UNIX_STRING_DIR_SEP;
#ifdef __WINDOWS__ #ifdef __WINDOWS__
...@@ -130,14 +132,14 @@ wxString MakeReducedFileName( const wxString& fullfilename, ...@@ -130,14 +132,14 @@ wxString MakeReducedFileName( const wxString& fullfilename,
#endif #endif
Cwd.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP ); Cwd.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
if( path == Cwd ) if( path == Cwd )
{ // lib est dans rpertoire courant -> Chemin = "./" { // the path is the current path -> path = "./"
reduced_filename.Remove( 0, Cwd.Length() ); reduced_filename.Remove( 0, Cwd.Length() );
wxString tmp = wxT( "./" ) + reduced_filename; wxString tmp = wxT( "./" ) + reduced_filename;
reduced_filename = tmp; reduced_filename = tmp;
} }
} }
// Suppression extension standard: // remove extension if == default_ext:
if( !ext.IsEmpty() && reduced_filename.Contains( ext ) ) if( !ext.IsEmpty() && reduced_filename.Contains( ext ) )
reduced_filename.Truncate( reduced_filename.Length() - ext.Length() ); reduced_filename.Truncate( reduced_filename.Length() - ext.Length() );
...@@ -150,15 +152,14 @@ wxString MakeFileName( const wxString& dir, ...@@ -150,15 +152,14 @@ wxString MakeFileName( const wxString& dir,
const wxString& shortname, const wxString& ext ) const wxString& shortname, const wxString& ext )
/***************************************************************************/ /***************************************************************************/
/* Calcule le nom complet d'un fichier d'apres les chaines /** Function MakeFileName
* dir = prefixe (chemin) (peut etre "") * Calculate the full file name from dir, shortname and ext
* shortname = nom avec ou sans chemin ou extension * @param dir = path (can be empty)
* ext = extension (peut etre "") * @param shortname = filename with or without path and/or extension
* * @param ext = extension (can be empty)
* si shortname possede deja un chemin ou une extension, elles * If shortname has an absolute path, or a path start by ./ , the path will not be modified
* ne seront pas modifiees * If shortname has an extension, it will not be modified
* * @return full filename
* retourne la chaine calculee
*/ */
{ {
wxString fullfilename; wxString fullfilename;
...@@ -166,31 +167,34 @@ wxString MakeFileName( const wxString& dir, ...@@ -166,31 +167,34 @@ wxString MakeFileName( const wxString& dir,
if( !dir.IsEmpty() ) if( !dir.IsEmpty() )
{ {
if( !shortname.Contains( UNIX_STRING_DIR_SEP ) && !shortname.Contains( WIN_STRING_DIR_SEP ) if( !wxIsAbsolutePath( shortname ) )
&& !shortname.Contains( wxT( ":" ) ) ) {
{ /* aucun chemin n'est donne */ wxString left = shortname.Left(2);
fullfilename = dir; if( left != wxT("./") )
} { /* no absolute path in shortname */
fullfilename = dir;
}
}
} }
fullfilename += shortname; fullfilename += shortname;
fullfilename.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP ); fullfilename.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
/* Placement de l'extension s'il n'y en a pas deja une */ /* Add an extension if shortname has no extension */
if( ext.IsEmpty() ) if( ext.IsEmpty() )
return fullfilename; return fullfilename;
/* Recherche d'une eventuelle extension */ /* search for an extension */
ii = fullfilename.Length(); /* Pointe la fin du texte */ ii = fullfilename.Length(); /* Get the end of name */
for( ; ii >= 0; ii-- ) for( ; ii >= 0; ii-- )
{ {
if( fullfilename.GetChar( ii ) == '/' ) if( fullfilename.GetChar( ii ) == '/' )
{ {
/* Pas d'extension: placement de l'extension standard */ /* not extension: add ext */
fullfilename += ext; fullfilename += ext;
break; break;
} }
if( fullfilename.GetChar( ii ) == '.' ) /* extension trouvee */ if( fullfilename.GetChar( ii ) == '.' ) /* extension exists, do nothing */
break; break;
} }
...@@ -202,7 +206,10 @@ wxString MakeFileName( const wxString& dir, ...@@ -202,7 +206,10 @@ wxString MakeFileName( const wxString& dir,
void ChangeFileNameExt( wxString& FullFileName, const wxString& NewExt ) void ChangeFileNameExt( wxString& FullFileName, const wxString& NewExt )
/**************************************************************************/ /**************************************************************************/
/* Change l'extension du "filename FullFileName" en NewExt. /** Function ChangeFileNameExt
* change the extension of FullFileName to NewExt.
* @param FullFileName = filename to modify
* @param NewExt = new extension for FullFileName
*/ */
{ {
wxString FileName; wxString FileName;
...@@ -223,7 +230,9 @@ void ChangeFileNameExt( wxString& FullFileName, const wxString& NewExt ) ...@@ -223,7 +230,9 @@ void ChangeFileNameExt( wxString& FullFileName, const wxString& NewExt )
void AddDelimiterString( wxString& string ) void AddDelimiterString( wxString& string )
/*******************************************/ /*******************************************/
/* ajoute un " en debut et fin de string s'il n'y en a pas deja. /** Function AddDelimiterString
* Add un " to the start and the end of string (if not already done).
* @param string = string to modify
*/ */
{ {
wxString text; wxString text;
...@@ -237,9 +246,9 @@ void AddDelimiterString( wxString& string ) ...@@ -237,9 +246,9 @@ void AddDelimiterString( wxString& string )
} }
/*************************************/ /***********************************/
/* Fonction de selection de Repertoires */ /* Selection Directory dialog box: */
/*************************************/ /***********************************/
bool EDA_DirectorySelector( const wxString& Title, /* Titre de la fenetre */ bool EDA_DirectorySelector( const wxString& Title, /* Titre de la fenetre */
wxString& Path, /* Chemin par defaut */ wxString& Path, /* Chemin par defaut */
...@@ -300,7 +309,7 @@ wxString EDA_FileSelector( const wxString& Title, /* Dialog ti ...@@ -300,7 +309,7 @@ wxString EDA_FileSelector( const wxString& Title, /* Dialog ti
defaultname, defaultname,
Ext, Ext,
Mask, Mask,
flag,/* options d'affichage (wxFD_OPEN, wxFD_SAVE .. */ flag,/* open mode wxFD_OPEN, wxFD_SAVE .. */
Frame, Frame,
Pos.x, Pos.y ); Pos.x, Pos.y );
...@@ -314,9 +323,9 @@ wxString EDA_FileSelector( const wxString& Title, /* Dialog ti ...@@ -314,9 +323,9 @@ wxString EDA_FileSelector( const wxString& Title, /* Dialog ti
/********************************************************/ /********************************************************/
wxString FindKicadHelpPath() wxString FindKicadHelpPath()
/********************************************************/ /********************************************************/
/* Find absolute path for kicad/help (or kicad/help/<language>) */ /** Function FindKicadHelpPath
* Find an absolute path for kicad/help (or kicad/help/<language>)
/* Find path kicad/help/xx/ ou kicad/help/: * Find path kicad/help/xx/ ou kicad/help/:
* from BinDir * from BinDir
* else from environment variable KICAD * else from environment variable KICAD
* else from one of s_HelpPathList * else from one of s_HelpPathList
......
/***********************************************************/ /*****************************************************************/
/* Module to handle libraries (first part - file and io). */ /* Functions to handle component library files : read functions */
/***********************************************************/ /*****************************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
...@@ -13,10 +13,7 @@ ...@@ -13,10 +13,7 @@
#include "protos.h" #include "protos.h"
/* Variables Locales */ /* Local Functions */
/* Fonctions locales */
/* pour librairies de composants */
static LibEDA_BaseStruct* GetDrawEntry( WinEDA_DrawFrame* frame, FILE* f, static LibEDA_BaseStruct* GetDrawEntry( WinEDA_DrawFrame* frame, FILE* f,
char* Line, int* LineNum ); char* Line, int* LineNum );
static bool GetLibEntryField( EDA_LibComponentStruct* LibEntry, char* line ); static bool GetLibEntryField( EDA_LibComponentStruct* LibEntry, char* line );
...@@ -27,22 +24,18 @@ static bool ReadLibEntryDateAndTime( EDA_LibComponentStruct* Lib ...@@ -27,22 +24,18 @@ static bool ReadLibEntryDateAndTime( EDA_LibComponentStruct* Lib
static int AddFootprintFilterList( EDA_LibComponentStruct* LibEntryLibEntry, static int AddFootprintFilterList( EDA_LibComponentStruct* LibEntryLibEntry,
FILE* f, char* Line, int* LineNum ); FILE* f, char* Line, int* LineNum );
/* pour doc librairies */
/****************************************************/
/* Routines de lecture des librairies de composants */
/****************************************************/
/*************************************************************************************/
/*****************************************************************************
* Routine to load the given library name. FullLibName should hold full path *
* of file name to open, while LibName should hold only its name. *
* IF library already exists, it is NOT reloaded. *
* return: new lib or NULL *
*****************************************************************************/
LibraryStruct* LoadLibraryName( WinEDA_DrawFrame* frame, LibraryStruct* LoadLibraryName( WinEDA_DrawFrame* frame,
const wxString& FullLibName, const wxString& LibName ) const wxString& FullLibName, const wxString& LibName )
/*************************************************************************************/
/** Function LoadLibraryName
* Routine to load the given library name. FullLibName should hold full path
* of file name to open, while LibName should hold only its name.
* IF library already exists, it is NOT reloaded.
* @return : new lib or NULL
*/
{ {
int NumOfParts; int NumOfParts;
FILE* f; FILE* f;
...@@ -103,8 +96,9 @@ LibraryStruct* LoadLibraryName( WinEDA_DrawFrame* frame, ...@@ -103,8 +96,9 @@ LibraryStruct* LoadLibraryName( WinEDA_DrawFrame* frame,
void LoadLibraries( WinEDA_DrawFrame* frame ) void LoadLibraries( WinEDA_DrawFrame* frame )
/******************************************/ /******************************************/
/* Delete toutes les librairies chargees et recree toutes les librairies /* Function LoadLibraries
* donnes dans la liste g_LibName_List * Clear all alredy loaded librries and load all librairies
* given in g_LibName_List
*/ */
{ {
wxString FullLibName, msg; wxString FullLibName, msg;
...@@ -136,16 +130,17 @@ void LoadLibraries( WinEDA_DrawFrame* frame ) ...@@ -136,16 +130,17 @@ void LoadLibraries( WinEDA_DrawFrame* frame )
if( LibName.IsEmpty() ) if( LibName.IsEmpty() )
continue; continue;
FullLibName = MakeFileName( g_RealLibDirBuffer, LibName, g_LibExtBuffer ); FullLibName = MakeFileName( g_RealLibDirBuffer, LibName, g_LibExtBuffer );
msg = wxT( "Loading " ) + FullLibName; msg = wxT( "Loading " ) + FullLibName;
frame->PrintMsg( msg );
if( LoadLibraryName( frame, FullLibName, LibName ) ) if( LoadLibraryName( frame, FullLibName, LibName ) )
msg += wxT( " OK" ); msg += wxT( " OK" );
else else
msg += wxT( " ->Error" ); msg += wxT( " ->Error" );
frame->PrintMsg( msg ); frame->PrintMsg( msg );
} }
...@@ -161,9 +156,9 @@ void LoadLibraries( WinEDA_DrawFrame* frame ) ...@@ -161,9 +156,9 @@ void LoadLibraries( WinEDA_DrawFrame* frame )
return; return;
LibraryStruct** libs = LibraryStruct** libs =
(LibraryStruct**) MyZMalloc( sizeof(LibraryStruct *) * (NumOfLibs + 2) ); (LibraryStruct**) MyZMalloc( sizeof(LibraryStruct*) * (NumOfLibs + 2) );
int jj = 0; int jj = 0;
for( ii = 0; ii < g_LibName_List.GetCount(); ii++ ) for( ii = 0; ii < g_LibName_List.GetCount(); ii++ )
{ {
if( jj >= NumOfLibs ) if( jj >= NumOfLibs )
...@@ -198,10 +193,13 @@ void LoadLibraries( WinEDA_DrawFrame* frame ) ...@@ -198,10 +193,13 @@ void LoadLibraries( WinEDA_DrawFrame* frame )
} }
/***************************************************************************** /**************************************************************/
* Routine to free a library from the current loaded libraries. *
*****************************************************************************/
void FreeCmpLibrary( wxWindow* frame, const wxString& LibName ) void FreeCmpLibrary( wxWindow* frame, const wxString& LibName )
/**************************************************************/
/** Function FreeCmpLibrary
* Routine to remove and free a library from the current loaded libraries.
*/
{ {
int NumOfLibs = NumOfLibraries(); int NumOfLibs = NumOfLibraries();
LibraryStruct* Lib, * TempLib; LibraryStruct* Lib, * TempLib;
...@@ -234,7 +232,8 @@ void FreeCmpLibrary( wxWindow* frame, const wxString& LibName ) ...@@ -234,7 +232,8 @@ void FreeCmpLibrary( wxWindow* frame, const wxString& LibName )
delete Lib; delete Lib;
/* La librairie supprimee est peut etre celle selectee dans libedit */ /* The removed librairy can be the current library in libedit.
* If so, clear the current library in libedit */
if( Lib == CurrentLib ) if( Lib == CurrentLib )
CurrentLib = NULL; CurrentLib = NULL;
} }
...@@ -244,7 +243,8 @@ void FreeCmpLibrary( wxWindow* frame, const wxString& LibName ) ...@@ -244,7 +243,8 @@ void FreeCmpLibrary( wxWindow* frame, const wxString& LibName )
const wxChar** GetLibNames() const wxChar** GetLibNames()
/******************************/ /******************************/
/* Routine to return pointers to all library names. /** GetLibNames()
* Routine to return pointers to all library names.
* User is responsible to deallocate memory * User is responsible to deallocate memory
*/ */
{ {
...@@ -252,7 +252,7 @@ const wxChar** GetLibNames() ...@@ -252,7 +252,7 @@ const wxChar** GetLibNames()
const wxChar** Names; const wxChar** Names;
LibraryStruct* Lib; LibraryStruct* Lib;
Names = (const wxChar**) MyZMalloc( sizeof(wxChar *) * (NumOfLibs + 1) ); Names = (const wxChar**) MyZMalloc( sizeof(wxChar*) * (NumOfLibs + 1) );
for( ii = 0, Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext, ii++ ) for( ii = 0, Lib = g_LibraryList; Lib != NULL; Lib = Lib->m_Pnext, ii++ )
{ {
Names[ii] = Lib->m_Name.GetData(); Names[ii] = Lib->m_Name.GetData();
...@@ -264,10 +264,10 @@ const wxChar** GetLibNames() ...@@ -264,10 +264,10 @@ const wxChar** GetLibNames()
} }
/***************************************************************************** /** Function LibraryEntryCompare
* Routine to compare two EDA_LibComponentStruct for the PriorQue module. * * Routine to compare two EDA_LibComponentStruct for the PriorQue module.
* Comparison (insensitive case) is based on Part name. * * Comparison (insensitive case) is based on Part name.
*****************************************************************************/ */
int LibraryEntryCompare( EDA_LibComponentStruct* LE1, EDA_LibComponentStruct* LE2 ) int LibraryEntryCompare( EDA_LibComponentStruct* LE1, EDA_LibComponentStruct* LE2 )
{ {
return LE1->m_Name.m_Text.CmpNoCase( LE2->m_Name.m_Text ); return LE1->m_Name.m_Text.CmpNoCase( LE2->m_Name.m_Text );
...@@ -355,7 +355,7 @@ EDA_LibComponentStruct* Read_Component_Definition( WinEDA_DrawFrame* frame, char ...@@ -355,7 +355,7 @@ EDA_LibComponentStruct* Read_Component_Definition( WinEDA_DrawFrame* frame, char
char* p; char* p;
char* name; char* name;
char* prefix = NULL; char* prefix = NULL;
EDA_LibComponentStruct* LibEntry = NULL; EDA_LibComponentStruct* LibEntry = NULL;
bool Res; bool Res;
wxString Msg; wxString Msg;
...@@ -397,11 +397,11 @@ EDA_LibComponentStruct* Read_Component_Definition( WinEDA_DrawFrame* frame, char ...@@ -397,11 +397,11 @@ EDA_LibComponentStruct* Read_Component_Definition( WinEDA_DrawFrame* frame, char
return NULL; return NULL;
} }
else /* Mise a jour des infos de la ligne "DEF" */ else /* Update infos read from the line "DEF" */
{ {
LibEntry->m_DrawPinNum = (drawnum == 'N') ? FALSE : TRUE; LibEntry->m_DrawPinNum = (drawnum == 'N') ? FALSE : TRUE;
LibEntry->m_DrawPinName = (drawname == 'N') ? FALSE : TRUE; LibEntry->m_DrawPinName = (drawname == 'N') ? FALSE : TRUE;
/* Copy part name and prefix. */ /* Copy part name and prefix. */
strupper( name ); strupper( name );
if( name[0] != '~' ) if( name[0] != '~' )
...@@ -433,11 +433,11 @@ EDA_LibComponentStruct* Read_Component_Definition( WinEDA_DrawFrame* frame, char ...@@ -433,11 +433,11 @@ EDA_LibComponentStruct* Read_Component_Definition( WinEDA_DrawFrame* frame, char
} }
} }
/* Analyse lignes suivantes */ /* Read next lines */
while( GetLine( f, Line, LineNum, 1024 ) ) while( GetLine( f, Line, LineNum, 1024 ) )
{ {
p = strtok( Line, " \t\n" ); p = strtok( Line, " \t\n" );
Res = TRUE; /* Pour test d'erreur (Res = FALSE = erreur) */ Res = TRUE; /* This is the error flag ( if an error occurs, Res = FALSE) */
if( (Line[0] == 'T') && (Line[1] == 'i') ) if( (Line[0] == 'T') && (Line[1] == 'i') )
{ {
...@@ -470,7 +470,7 @@ EDA_LibComponentStruct* Read_Component_Definition( WinEDA_DrawFrame* frame, char ...@@ -470,7 +470,7 @@ EDA_LibComponentStruct* Read_Component_Definition( WinEDA_DrawFrame* frame, char
frame->PrintMsg( Msg ); frame->PrintMsg( Msg );
} }
/* Fin analyse de la ligne ou block: test de l'info lue */ /* End line or block analysis: test for an error */
if( !Res ) if( !Res )
{ /* Something went wrong there. */ { /* Something went wrong there. */
Msg.Printf( wxT( " Error Line %d, Library not loaded" ), *LineNum ); Msg.Printf( wxT( " Error Line %d, Library not loaded" ), *LineNum );
...@@ -533,10 +533,10 @@ static LibEDA_BaseStruct* GetDrawEntry( WinEDA_DrawFrame* frame, FILE* f, char* ...@@ -533,10 +533,10 @@ static LibEDA_BaseStruct* GetDrawEntry( WinEDA_DrawFrame* frame, FILE* f, char*
&Arc->m_Width, chartmp, &startx, &starty, &endx, &endy ); &Arc->m_Width, chartmp, &startx, &starty, &endx, &endy );
if( nbarg < 8 ) if( nbarg < 8 )
Error = TRUE; Error = TRUE;
Arc->m_Unit = Unit; Arc->m_Unit = Unit;
Arc->m_Convert = Convert; Arc->m_Convert = Convert;
if( chartmp[0] == 'F' ) if( chartmp[0] == 'F' )
Arc->m_Fill = FILLED_SHAPE; Arc->m_Fill = FILLED_SHAPE;
if( chartmp[0] == 'f' ) if( chartmp[0] == 'f' )
...@@ -545,12 +545,12 @@ static LibEDA_BaseStruct* GetDrawEntry( WinEDA_DrawFrame* frame, FILE* f, char* ...@@ -545,12 +545,12 @@ static LibEDA_BaseStruct* GetDrawEntry( WinEDA_DrawFrame* frame, FILE* f, char*
NORMALIZE_ANGLE( Arc->t1 ); NORMALIZE_ANGLE( Arc->t1 );
NORMALIZE_ANGLE( Arc->t2 ); NORMALIZE_ANGLE( Arc->t2 );
if( nbarg >= 13 ) // Coord reelles des extremites de l'arc lues if( nbarg >= 13 ) // Actual Coordinates of arc ends are read from file
{ {
Arc->m_ArcStart.x = startx; Arc->m_ArcStart.y = starty; Arc->m_ArcStart.x = startx; Arc->m_ArcStart.y = starty;
Arc->m_ArcEnd.x = endx; Arc->m_ArcEnd.y = endy; Arc->m_ArcEnd.x = endx; Arc->m_ArcEnd.y = endy;
} }
else else // Actual Coordinates of arc ends are not read from file (old library), calculate them
{ {
Arc->m_ArcStart.x = Arc->m_Rayon; Arc->m_ArcStart.y = 0; Arc->m_ArcStart.x = Arc->m_Rayon; Arc->m_ArcStart.y = 0;
Arc->m_ArcEnd.x = Arc->m_Rayon; Arc->m_ArcEnd.y = 0; Arc->m_ArcEnd.x = Arc->m_Rayon; Arc->m_ArcEnd.y = 0;
...@@ -636,11 +636,11 @@ static LibEDA_BaseStruct* GetDrawEntry( WinEDA_DrawFrame* frame, FILE* f, char* ...@@ -636,11 +636,11 @@ static LibEDA_BaseStruct* GetDrawEntry( WinEDA_DrawFrame* frame, FILE* f, char*
Pin->m_PinLen = ll; Pin->m_PinLen = ll;
Pin->m_Orient = chartmp1[0] & 255; Pin->m_Orient = chartmp1[0] & 255;
Pin->m_Unit = Unit; Pin->m_Unit = Unit;
Pin->m_Convert = Convert; Pin->m_Convert = Convert;
strncpy( (char*) &Pin->m_PinNum, PinNum, 4 ); strncpy( (char*) &Pin->m_PinNum, PinNum, 4 );
Error = (i != 11 && i != 12); Error = (i != 11 && i != 12);
Pin->m_PinName = CONV_FROM_UTF8( BufName ); Pin->m_PinName = CONV_FROM_UTF8( BufName );
...@@ -716,7 +716,6 @@ static LibEDA_BaseStruct* GetDrawEntry( WinEDA_DrawFrame* frame, FILE* f, char* ...@@ -716,7 +716,6 @@ static LibEDA_BaseStruct* GetDrawEntry( WinEDA_DrawFrame* frame, FILE* f, char*
} }
} }
} }
} }
break; break;
...@@ -868,7 +867,7 @@ static bool GetLibEntryField( EDA_LibComponentStruct* LibEntry, char* line ) ...@@ -868,7 +867,7 @@ static bool GetLibEntryField( EDA_LibComponentStruct* LibEntry, char* line )
if( *line == 0 ) if( *line == 0 )
return 0; return 0;
line++; line++;
Text = line; Text = line;
/* recherche fin de texte */ /* recherche fin de texte */
...@@ -877,23 +876,23 @@ static bool GetLibEntryField( EDA_LibComponentStruct* LibEntry, char* line ) ...@@ -877,23 +876,23 @@ static bool GetLibEntryField( EDA_LibComponentStruct* LibEntry, char* line )
if( *line == 0 ) if( *line == 0 )
return 0; return 0;
*line = 0; *line = 0;
line++; line++;
FieldUserName[0] = 0; FieldUserName[0] = 0;
nbparam = sscanf( line, " %d %d %d %c %c %c %c", nbparam = sscanf( line, " %d %d %d %c %c %c %c",
&posx, &posy, &size, Char1, Char2, Char3, Char4 ); &posx, &posy, &size, Char1, Char2, Char3, Char4 );
orient = TEXT_ORIENT_HORIZ; orient = TEXT_ORIENT_HORIZ;
if( Char1[0] == 'V' ) if( Char1[0] == 'V' )
orient = TEXT_ORIENT_VERT; orient = TEXT_ORIENT_VERT;
draw = TRUE; if( Char2[0] == 'I' ) draw = TRUE; if( Char2[0] == 'I' )
draw = FALSE; draw = FALSE;
hjustify = GR_TEXT_HJUSTIFY_CENTER; hjustify = GR_TEXT_HJUSTIFY_CENTER;
vjustify = GR_TEXT_VJUSTIFY_CENTER; vjustify = GR_TEXT_VJUSTIFY_CENTER;
if( nbparam >= 6 ) if( nbparam >= 6 )
{ {
if( *Char3 == 'L' ) if( *Char3 == 'L' )
...@@ -921,7 +920,7 @@ static bool GetLibEntryField( EDA_LibComponentStruct* LibEntry, char* line ) ...@@ -921,7 +920,7 @@ static bool GetLibEntryField( EDA_LibComponentStruct* LibEntry, char* line )
default: default:
if( NumOfField >= NUMBER_OF_FIELDS ) if( NumOfField >= NUMBER_OF_FIELDS )
break; break;
Field = new LibDrawField( NumOfField ); Field = new LibDrawField( NumOfField );
Field->Pnext = LibEntry->Fields; Field->Pnext = LibEntry->Fields;
...@@ -934,19 +933,19 @@ static bool GetLibEntryField( EDA_LibComponentStruct* LibEntry, char* line ) ...@@ -934,19 +933,19 @@ static bool GetLibEntryField( EDA_LibComponentStruct* LibEntry, char* line )
Field->m_Pos.x = posx; Field->m_Pos.y = posy; Field->m_Pos.x = posx; Field->m_Pos.y = posy;
Field->m_Orient = orient; Field->m_Orient = orient;
if( draw == FALSE ) if( draw == FALSE )
Field->m_Attributs |= TEXT_NO_VISIBLE; Field->m_Attributs |= TEXT_NO_VISIBLE;
Field->m_Size.x = Field->m_Size.y = size; Field->m_Size.x = Field->m_Size.y = size;
Field->m_Text = CONV_FROM_UTF8( Text ); Field->m_Text = CONV_FROM_UTF8( Text );
if( NumOfField >= FIELD1 ) if( NumOfField >= FIELD1 )
{ {
ReadDelimitedText( FieldUserName, line, sizeof(FieldUserName) ); ReadDelimitedText( FieldUserName, line, sizeof(FieldUserName) );
Field->m_Name = CONV_FROM_UTF8( FieldUserName ); Field->m_Name = CONV_FROM_UTF8( FieldUserName );
} }
Field->m_HJustify = hjustify; Field->m_HJustify = hjustify;
Field->m_VJustify = vjustify; Field->m_VJustify = vjustify;
return TRUE; return TRUE;
...@@ -987,7 +986,7 @@ static void InsertAlias( PriorQue** PQ, EDA_LibComponentStruct* LibEntry, ...@@ -987,7 +986,7 @@ static void InsertAlias( PriorQue** PQ, EDA_LibComponentStruct* LibEntry,
unsigned ii; unsigned ii;
if( LibEntry->m_AliasList.GetCount() == 0 ) if( LibEntry->m_AliasList.GetCount() == 0 )
return;/* No alias for this component */ return; /* No alias for this component */
for( ii = 0; ii < LibEntry->m_AliasList.GetCount(); ii++ ) for( ii = 0; ii < LibEntry->m_AliasList.GetCount(); ii++ )
{ {
...@@ -1020,7 +1019,7 @@ int LoadDocLib( WinEDA_DrawFrame* frame, const wxString& FullDocLibName, const w ...@@ -1020,7 +1019,7 @@ int LoadDocLib( WinEDA_DrawFrame* frame, const wxString& FullDocLibName, const w
return 0; return 0;
if( GetLine( f, Line, &LineNum, sizeof(Line) ) == NULL ) if( GetLine( f, Line, &LineNum, sizeof(Line) ) == NULL )
{ {
/* pas de lignes utiles */ /* pas de lignes utiles */
fclose( f ); fclose( f );
return 0; return 0;
...@@ -1122,20 +1121,20 @@ void EDA_LibComponentStruct::SortDrawItems() ...@@ -1122,20 +1121,20 @@ void EDA_LibComponentStruct::SortDrawItems()
int ii, nbitems; int ii, nbitems;
if( Entry == NULL ) if( Entry == NULL )
return; /* Pas d'alias pour ce composant */ return; /* Pas d'alias pour ce composant */
/* calcul du nombre d'items */ /* calcul du nombre d'items */
for( nbitems = 0; Entry != NULL; Entry = Entry->Next() ) for( nbitems = 0; Entry != NULL; Entry = Entry->Next() )
nbitems++; nbitems++;
BufentryBase = BufentryBase =
(LibEDA_BaseStruct**) MyZMalloc( (nbitems + 1) * sizeof(LibEDA_BaseStruct *) ); (LibEDA_BaseStruct**) MyZMalloc( (nbitems + 1) * sizeof(LibEDA_BaseStruct*) );
/* memorisation du chainage : */ /* memorisation du chainage : */
for( Entry = m_Drawings, ii = 0; Entry != NULL; Entry = Entry->Next() ) for( Entry = m_Drawings, ii = 0; Entry != NULL; Entry = Entry->Next() )
BufentryBase[ii++] = Entry; BufentryBase[ii++] = Entry;
/* Tri du chainage */ /* Tri du chainage */
qsort( BufentryBase, nbitems, sizeof(LibEDA_BaseStruct *), SortItemsFct ); qsort( BufentryBase, nbitems, sizeof(LibEDA_BaseStruct*), SortItemsFct );
/* Mise a jour du chainage. Remarque: /* Mise a jour du chainage. Remarque:
* le dernier element de BufEntryBase (BufEntryBase[nbitems]) est NULL*/ * le dernier element de BufEntryBase (BufEntryBase[nbitems]) est NULL*/
......
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