Commit d1e44864 authored by jerryjacobs's avatar jerryjacobs

Closed bug 2802441, see CHANGELOG.txt

parent f7265b0a
......@@ -4,6 +4,13 @@ KiCad ChangeLog 2009
Please add newer entries at the top, list the date and your name with
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>
================================================================================
Added Hauptmech patch.
......
......@@ -78,6 +78,7 @@ WARN_LOGFILE =
#---------------------------------------------------------------------------
INPUT = kicad \
pcbnew \
cvpcb \
eeschema \
3d-viewer \
common \
......
......@@ -20,6 +20,12 @@
#include "protos.h"
/* Bla */
wxString mdc_files_not_found;
wxString mdc_files_invalid;
/* routines locales : */
static void ReadDocLib( const wxString& ModLibName, FOOTPRINT_LIST& list );
......@@ -41,17 +47,17 @@ bool LoadFootprintFiles( const wxArrayString& libNames,
{
FILE* file; /* pour lecture librairie */
char buffer[1024];
wxFileName fn;
wxFileName filename;
int end;
FOOTPRINT* ItemLib;
unsigned ii;
unsigned i;
wxString tmp, msg;
/* Check if footprint list is not empty */
if( !list.empty() )
{
list.clear();
}
/* Check if there are footprint libraries in project file */
if( libNames.GetCount() == 0 )
{
wxMessageBox( _( "No PCB foot print libraries are listed in the current project file." ),
......@@ -59,24 +65,25 @@ bool LoadFootprintFiles( const wxArrayString& libNames,
return false;
}
/* Lecture des Librairies */
for( ii = 0; ii < libNames.GetCount(); ii++ )
/* Parse Libraries Listed */
for( i = 0; i < libNames.GetCount(); i++ )
{
/* Calcul du nom complet de la librairie */
fn = libNames[ii];
fn.SetExt( ModuleFileExtension );
filename = libNames[i];
filename.SetExt( ModuleFileExtension );
tmp = wxGetApp().FindLibraryPath( filename );
tmp = wxGetApp().FindLibraryPath( fn );
if( !tmp )
{
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 );
continue;
}
/* acces a une librairie */
/* Open library file */
file = wxFopen( tmp, wxT( "rt" ) );
if( file == NULL )
......@@ -87,7 +94,7 @@ bool LoadFootprintFiles( const wxArrayString& libNames,
continue;
}
/* Controle du type de la librairie : */
/* Check if library type is valid */
fgets( buffer, 32, file );
if( strncmp( buffer, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) != 0 )
{
......@@ -98,10 +105,10 @@ bool LoadFootprintFiles( const wxArrayString& libNames,
continue;
}
/* Lecture du nombre de composants */
/* TODO Lecture du nombre de composants */
fseek( file, 0, 0 );
/* lecture nom des composants : */
/* TODO lecture nom des composants : */
end = 0;
while( !end && fgets( buffer, 255, file ) != NULL )
{
......@@ -134,60 +141,81 @@ bool LoadFootprintFiles( const wxArrayString& libNames,
ReadDocLib( tmp, list );
}
/* Display if there are mdc files not found */
if( mdc_files_not_found != wxT(""))
{
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
* 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;
char Line[1024];
wxString ModuleName;
wxString msg;
FILE* LibDoc;
wxFileName fn = ModLibName;
FILE* mdc_file;
wxFileName mdc_filename = ModLibName;
fn.SetExt( wxT( "mdc" ) );
/* Set mdc filename extension */
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() );
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR );
mdc_files_not_found += mdc_filename.GetFullPath() + wxT("\n");
return;
}
GetLine( LibDoc, Line, NULL, sizeof(Line) - 1 );
/* Check if mdc file is valid */
GetLine( mdc_file, Line, NULL, sizeof(Line) - 1 );
if( strnicmp( Line, ENTETE_LIBDOC, L_ENTETE_LIB ) != 0 )
{
msg.Printf( _( "<%s> is not a valid PCB foot print library document file." ),
fn.GetFullPath().c_str() );
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR );
mdc_files_invalid += mdc_filename.GetFullPath() + wxT("\n");
return;
}
/* Lecture de la librairie */
while( GetLine( LibDoc, Line, NULL, sizeof(Line) - 1 ) )
/* Read the mdc file */
while( GetLine( mdc_file, Line, NULL, sizeof(Line) - 1 ) )
{
NewMod = NULL;
if( Line[0] != '$' )
continue;
if( Line[1] == 'E' )
break;;
if( Line[1] == 'M' ) /* Debut decription 1 module */
break;
if( Line[1] == 'M' ) /* 1 module description */
{
while( GetLine( LibDoc, Line, NULL, sizeof(Line) - 1 ) )
/* Parse file line by line */
while( GetLine( mdc_file, Line, NULL, sizeof(Line) - 1 ) )
{
if( Line[0] == '$' ) /* $EndMODULE */
/* $EndMODULE */
if( Line[0] == '$' )
break;
switch( Line[0] )
{
/* LibName */
case 'L': /* LibName */
ModuleName = CONV_FROM_UTF8( StrPurge( Line + 3 ) );
BOOST_FOREACH( FOOTPRINT& footprint, list )
......@@ -198,22 +226,23 @@ static void ReadDocLib( const wxString& ModLibName, FOOTPRINT_LIST& list )
break;
}
}
break;
case 'K': /* KeyWords */
/* KeyWords */
case 'K':
if( NewMod && (!NewMod->m_KeyWord) )
NewMod->m_KeyWord = CONV_FROM_UTF8( StrPurge( Line + 3 ) );
break;
case 'C': /* Doc */
/* Doc */
case 'C':
if( NewMod && ( !NewMod->m_Doc ) )
NewMod->m_Doc = CONV_FROM_UTF8( StrPurge( Line + 3 ) );
break;
}
}
} /* lecture 1 descr module */
} /* Fin lecture librairie */
} /* Parsed one module documentation */
} /* Parsed complete library documentation */
fclose( LibDoc );
fclose( mdc_file );
}
......@@ -2,6 +2,8 @@
/* Functions to handle component library files : read functions */
/*****************************************************************/
#include <iostream>
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
......@@ -109,6 +111,7 @@ void LoadLibraries( WinEDA_SchematicFrame* frame )
{
wxFileName fn;
wxString msg, tmp;
wxString libraries_not_found;
unsigned ii, iimax = frame->m_ComponentLibFiles.GetCount();
// Free the unwanted libraries (i.e. not in list) but keep the cache lib
......@@ -139,8 +142,7 @@ void LoadLibraries( WinEDA_SchematicFrame* frame )
tmp = wxGetApp().FindLibraryPath( fn );
if( !tmp )
{
msg.Printf( _( "Library file <%s> not found." ), fn.GetName().c_str() );
wxMessageBox( msg, _( "Library Load Error" ), wxOK | wxICON_ERROR, frame );
libraries_not_found += fn.GetName() + _("\n");
continue;
}
}
......@@ -161,6 +163,16 @@ void LoadLibraries( WinEDA_SchematicFrame* frame )
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:
int NumOfLibs;
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