Commit d1e44864 authored by jerryjacobs's avatar jerryjacobs

Closed bug 2802441, see CHANGELOG.txt

parent f7265b0a
...@@ -4,6 +4,13 @@ KiCad ChangeLog 2009 ...@@ -4,6 +4,13 @@ KiCad ChangeLog 2009
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.
2009-july-05 UPDATE Jerry Jacobs <jerkejacobs@gmail.com
================================================================================
+ Closing bug 2802441, No single error messages any more, 2009-06-07 over2there.
Fixed this both in eeschema and cvpcb, for now printing wxstring in a
messagebox. Should make a nice textctrl dialog.
+ Added cvpcb directory to Doxyfile
2009-june-19 UPDATE Jerry Jacobs <jerkejacobs@gmail.com> 2009-june-19 UPDATE Jerry Jacobs <jerkejacobs@gmail.com>
================================================================================ ================================================================================
Added Hauptmech patch. Added Hauptmech patch.
......
...@@ -78,6 +78,7 @@ WARN_LOGFILE = ...@@ -78,6 +78,7 @@ WARN_LOGFILE =
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
INPUT = kicad \ INPUT = kicad \
pcbnew \ pcbnew \
cvpcb \
eeschema \ eeschema \
3d-viewer \ 3d-viewer \
common \ common \
......
...@@ -20,6 +20,12 @@ ...@@ -20,6 +20,12 @@
#include "protos.h" #include "protos.h"
/* Bla */
wxString mdc_files_not_found;
wxString mdc_files_invalid;
/* routines locales : */ /* routines locales : */
static void ReadDocLib( const wxString& ModLibName, FOOTPRINT_LIST& list ); static void ReadDocLib( const wxString& ModLibName, FOOTPRINT_LIST& list );
...@@ -39,19 +45,19 @@ static void ReadDocLib( const wxString& ModLibName, FOOTPRINT_LIST& list ); ...@@ -39,19 +45,19 @@ static void ReadDocLib( const wxString& ModLibName, FOOTPRINT_LIST& list );
bool LoadFootprintFiles( const wxArrayString& libNames, bool LoadFootprintFiles( const wxArrayString& libNames,
FOOTPRINT_LIST& list ) FOOTPRINT_LIST& list )
{ {
FILE* file; /* pour lecture librairie */ FILE* file; /* pour lecture librairie */
char buffer[1024]; char buffer[1024];
wxFileName fn; wxFileName filename;
int end; int end;
FOOTPRINT* ItemLib; FOOTPRINT* ItemLib;
unsigned ii; unsigned i;
wxString tmp, msg; wxString tmp, msg;
if( !list.empty() ) /* Check if footprint list is not empty */
{ if( !list.empty() )
list.clear(); list.clear();
}
/* Check if there are footprint libraries in project file */
if( libNames.GetCount() == 0 ) if( libNames.GetCount() == 0 )
{ {
wxMessageBox( _( "No PCB foot print libraries are listed in the current project file." ), wxMessageBox( _( "No PCB foot print libraries are listed in the current project file." ),
...@@ -59,24 +65,25 @@ bool LoadFootprintFiles( const wxArrayString& libNames, ...@@ -59,24 +65,25 @@ bool LoadFootprintFiles( const wxArrayString& libNames,
return false; return false;
} }
/* Lecture des Librairies */ /* Parse Libraries Listed */
for( ii = 0; ii < libNames.GetCount(); ii++ ) for( i = 0; i < libNames.GetCount(); i++ )
{ {
/* Calcul du nom complet de la librairie */ /* Calcul du nom complet de la librairie */
fn = libNames[ii]; filename = libNames[i];
fn.SetExt( ModuleFileExtension ); filename.SetExt( ModuleFileExtension );
tmp = wxGetApp().FindLibraryPath( filename );
tmp = wxGetApp().FindLibraryPath( fn );
if( !tmp ) if( !tmp )
{ {
msg.Printf( _( "PCB foot print library file <%s> could not be found in the default search paths." ), msg.Printf( _( "PCB foot print library file <%s> could not be found in the default search paths." ),
fn.GetFullName().c_str() ); filename.GetFullName().c_str() );
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR ); wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR );
continue; continue;
} }
/* acces a une librairie */ /* Open library file */
file = wxFopen( tmp, wxT( "rt" ) ); file = wxFopen( tmp, wxT( "rt" ) );
if( file == NULL ) if( file == NULL )
...@@ -87,7 +94,7 @@ bool LoadFootprintFiles( const wxArrayString& libNames, ...@@ -87,7 +94,7 @@ bool LoadFootprintFiles( const wxArrayString& libNames,
continue; continue;
} }
/* Controle du type de la librairie : */ /* Check if library type is valid */
fgets( buffer, 32, file ); fgets( buffer, 32, file );
if( strncmp( buffer, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) != 0 ) if( strncmp( buffer, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) != 0 )
{ {
...@@ -98,10 +105,10 @@ bool LoadFootprintFiles( const wxArrayString& libNames, ...@@ -98,10 +105,10 @@ bool LoadFootprintFiles( const wxArrayString& libNames,
continue; continue;
} }
/* Lecture du nombre de composants */ /* TODO Lecture du nombre de composants */
fseek( file, 0, 0 ); fseek( file, 0, 0 );
/* lecture nom des composants : */ /* TODO lecture nom des composants : */
end = 0; end = 0;
while( !end && fgets( buffer, 255, file ) != NULL ) while( !end && fgets( buffer, 255, file ) != NULL )
{ {
...@@ -134,86 +141,108 @@ bool LoadFootprintFiles( const wxArrayString& libNames, ...@@ -134,86 +141,108 @@ bool LoadFootprintFiles( const wxArrayString& libNames,
ReadDocLib( tmp, list ); ReadDocLib( tmp, list );
} }
list.sort(); /* Display if there are mdc files not found */
if( mdc_files_not_found != wxT(""))
return true; {
wxString message = _("The following mdc files could not be found:\n\n");
message += mdc_files_not_found;
wxMessageBox( message, _("Load error!"), wxOK | wxICON_ERROR );
}
/* Display if there are mdc files invalid */
if( mdc_files_invalid != wxT(""))
{
wxString message = _("The following mdc files are invalid:\n\n");
message += mdc_files_invalid;
wxMessageBox( message, _("Load error!"), wxOK | wxICON_ERROR );
}
list.sort();
return true;
} }
/* Routine de lecture du fichier Doc associe a la librairie ModLibName. /**
* Routine de lecture du fichier Doc associe a la librairie ModLibName.
* Cree en memoire la chaine liste des docs pointee par MList * Cree en memoire la chaine liste des docs pointee par MList
* ModLibName = full file Name de la librairie Modules * ModLibName = full file Name de la librairie Modules
*/ */
static void ReadDocLib( const wxString& ModLibName, FOOTPRINT_LIST& list ) static void
ReadDocLib( const wxString& ModLibName,
FOOTPRINT_LIST& list )
{ {
FOOTPRINT* NewMod; FOOTPRINT* NewMod;
char Line[1024]; char Line[1024];
wxString ModuleName; wxString ModuleName;
wxString msg; FILE* mdc_file;
FILE* LibDoc; wxFileName mdc_filename = ModLibName;
wxFileName fn = ModLibName;
/* Set mdc filename extension */
fn.SetExt( wxT( "mdc" ) ); mdc_filename.SetExt( wxT( "mdc" ) );
if( ( LibDoc = wxFopen( fn.GetFullPath(), wxT( "rt" ) ) ) == NULL ) /* Check if mdc file exists and can be opened */
{ if( ( mdc_file = wxFopen( mdc_filename.GetFullPath(), wxT( "rt" ) ) ) == NULL )
msg.Printf( _( "Could not open PCB foot print library document file <%s>." ), {
fn.GetFullPath().c_str() ); mdc_files_not_found += mdc_filename.GetFullPath() + wxT("\n");
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR ); return;
return; }
}
/* Check if mdc file is valid */
GetLine( LibDoc, Line, NULL, sizeof(Line) - 1 ); GetLine( mdc_file, Line, NULL, sizeof(Line) - 1 );
if( strnicmp( Line, ENTETE_LIBDOC, L_ENTETE_LIB ) != 0 ) if( strnicmp( Line, ENTETE_LIBDOC, L_ENTETE_LIB ) != 0 )
{ {
msg.Printf( _( "<%s> is not a valid PCB foot print library document file." ), mdc_files_invalid += mdc_filename.GetFullPath() + wxT("\n");
fn.GetFullPath().c_str() ); return;
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR ); }
return;
} /* Read the mdc file */
while( GetLine( mdc_file, Line, NULL, sizeof(Line) - 1 ) )
/* Lecture de la librairie */ {
while( GetLine( LibDoc, Line, NULL, sizeof(Line) - 1 ) ) NewMod = NULL;
{ if( Line[0] != '$' )
NewMod = NULL; continue;
if( Line[0] != '$' ) if( Line[1] == 'E' )
continue; break;
if( Line[1] == 'E' ) if( Line[1] == 'M' ) /* 1 module description */
break;; {
if( Line[1] == 'M' ) /* Debut decription 1 module */ /* Parse file line by line */
{ while( GetLine( mdc_file, Line, NULL, sizeof(Line) - 1 ) )
while( GetLine( LibDoc, Line, NULL, sizeof(Line) - 1 ) ) {
{ /* $EndMODULE */
if( Line[0] == '$' ) /* $EndMODULE */ if( Line[0] == '$' )
break; break;
switch( Line[0] )
{ switch( Line[0] )
case 'L': /* LibName */ {
ModuleName = CONV_FROM_UTF8( StrPurge( Line + 3 ) ); /* LibName */
BOOST_FOREACH( FOOTPRINT& footprint, list ) case 'L': /* LibName */
{ ModuleName = CONV_FROM_UTF8( StrPurge( Line + 3 ) );
if( ModuleName == footprint.m_Module ) BOOST_FOREACH( FOOTPRINT& footprint, list )
{ {
NewMod = &footprint; if( ModuleName == footprint.m_Module )
break; {
} NewMod = &footprint;
} break;
}
break; }
break;
case 'K': /* KeyWords */
if( NewMod && (!NewMod->m_KeyWord) ) /* KeyWords */
NewMod->m_KeyWord = CONV_FROM_UTF8( StrPurge( Line + 3 ) ); case 'K':
break; if( NewMod && (!NewMod->m_KeyWord) )
NewMod->m_KeyWord = CONV_FROM_UTF8( StrPurge( Line + 3 ) );
case 'C': /* Doc */ break;
if( NewMod && ( !NewMod->m_Doc ) )
NewMod->m_Doc = CONV_FROM_UTF8( StrPurge( Line + 3 ) ); /* Doc */
break; case 'C':
} if( NewMod && ( !NewMod->m_Doc ) )
} NewMod->m_Doc = CONV_FROM_UTF8( StrPurge( Line + 3 ) );
} /* lecture 1 descr module */ break;
} /* Fin lecture librairie */ }
}
fclose( LibDoc ); } /* Parsed one module documentation */
} /* Parsed complete library documentation */
fclose( mdc_file );
} }
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
/* Functions to handle component library files : read functions */ /* Functions to handle component library files : read functions */
/*****************************************************************/ /*****************************************************************/
#include <iostream>
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
...@@ -109,6 +111,7 @@ void LoadLibraries( WinEDA_SchematicFrame* frame ) ...@@ -109,6 +111,7 @@ void LoadLibraries( WinEDA_SchematicFrame* frame )
{ {
wxFileName fn; wxFileName fn;
wxString msg, tmp; wxString msg, tmp;
wxString libraries_not_found;
unsigned ii, iimax = frame->m_ComponentLibFiles.GetCount(); unsigned ii, iimax = frame->m_ComponentLibFiles.GetCount();
// Free the unwanted libraries (i.e. not in list) but keep the cache lib // Free the unwanted libraries (i.e. not in list) but keep the cache lib
...@@ -139,8 +142,7 @@ void LoadLibraries( WinEDA_SchematicFrame* frame ) ...@@ -139,8 +142,7 @@ void LoadLibraries( WinEDA_SchematicFrame* frame )
tmp = wxGetApp().FindLibraryPath( fn ); tmp = wxGetApp().FindLibraryPath( fn );
if( !tmp ) if( !tmp )
{ {
msg.Printf( _( "Library file <%s> not found." ), fn.GetName().c_str() ); libraries_not_found += fn.GetName() + _("\n");
wxMessageBox( msg, _( "Library Load Error" ), wxOK | wxICON_ERROR, frame );
continue; continue;
} }
} }
...@@ -161,6 +163,16 @@ void LoadLibraries( WinEDA_SchematicFrame* frame ) ...@@ -161,6 +163,16 @@ void LoadLibraries( WinEDA_SchematicFrame* frame )
frame->PrintMsg( msg ); frame->PrintMsg( msg );
} }
/* Print the libraries not found */
if(libraries_not_found != _(""))
{
wxString message = _("The following libraries could not be found:\n\n");
message += libraries_not_found;
wxMessageBox( message, _("Load error!"), wxOK | wxICON_ERROR, frame );
}
// reorder the linked list to match the order filename list: // reorder the linked list to match the order filename list:
int NumOfLibs; int NumOfLibs;
for( NumOfLibs = 0, lib = g_LibraryList; lib != NULL; lib = lib->m_Pnext ) for( NumOfLibs = 0, lib = g_LibraryList; lib != NULL; lib = lib->m_Pnext )
......
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