Commit d1e44864 authored by jerryjacobs's avatar jerryjacobs
Browse files

Closed bug 2802441, see CHANGELOG.txt

parent f7265b0a
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -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.
+1 −0
Original line number Original line Diff line number Diff line
@@ -78,6 +78,7 @@ WARN_LOGFILE =
#---------------------------------------------------------------------------
#---------------------------------------------------------------------------
INPUT                  = kicad \
INPUT                  = kicad \
                         pcbnew \
                         pcbnew \
                         cvpcb \
                         eeschema \
                         eeschema \
                         3d-viewer \
                         3d-viewer \
                         common \
                         common \
+127 −98
Original line number Original line Diff line number Diff line
@@ -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 );


@@ -41,17 +47,17 @@ bool LoadFootprintFiles( const wxArrayString& libNames,
{
{
	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;


	/* Check if footprint list is not empty */
	if( !list.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,
        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,
            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,
            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,60 +141,81 @@ bool LoadFootprintFiles( const wxArrayString& libNames,
        ReadDocLib( tmp, list );
        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();
	list.sort();


	return true;
	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;


    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>." ),
		mdc_files_not_found += mdc_filename.GetFullPath() + wxT("\n");
                    fn.GetFullPath().c_str() );
        wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR );
		return;
		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 )
	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() );
        wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR );
		return;
		return;
	}
	}


    /* Lecture de la librairie */
	/* Read the mdc file */
    while( GetLine( LibDoc, Line, NULL, sizeof(Line) - 1 ) )
	while( GetLine( mdc_file, Line, NULL, sizeof(Line) - 1 ) )
	{
	{
		NewMod = NULL;
		NewMod = NULL;
		if( Line[0] != '$' )
		if( Line[0] != '$' )
			continue;
			continue;
		if( Line[1] == 'E' )
		if( Line[1] == 'E' )
            break;;
			break;
        if( Line[1] == 'M' )    /* Debut decription 1 module */
		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;
					break;

				switch( Line[0] )
				switch( Line[0] )
				{
				{
					/* LibName */
					case 'L':       /* LibName */
					case 'L':       /* LibName */
						ModuleName = CONV_FROM_UTF8( StrPurge( Line + 3 ) );
						ModuleName = CONV_FROM_UTF8( StrPurge( Line + 3 ) );
						BOOST_FOREACH( FOOTPRINT& footprint, list )
						BOOST_FOREACH( FOOTPRINT& footprint, list )
@@ -198,22 +226,23 @@ static void ReadDocLib( const wxString& ModLibName, FOOTPRINT_LIST& list )
								break;
								break;
							}
							}
						}
						}

					break;
					break;


                case 'K':       /* KeyWords */
					/* KeyWords */
					case 'K':
						if( NewMod && (!NewMod->m_KeyWord) )
						if( NewMod && (!NewMod->m_KeyWord) )
						NewMod->m_KeyWord = CONV_FROM_UTF8( StrPurge( Line + 3 ) );
						NewMod->m_KeyWord = CONV_FROM_UTF8( StrPurge( Line + 3 ) );
					break;
					break;


                case 'C':       /* Doc */
					/* Doc */
					case 'C':
						if( NewMod && ( !NewMod->m_Doc ) )
						if( NewMod && ( !NewMod->m_Doc ) )
						NewMod->m_Doc = CONV_FROM_UTF8( StrPurge( Line + 3 ) );
						NewMod->m_Doc = CONV_FROM_UTF8( StrPurge( Line + 3 ) );
					break;
					break;
				}
				}
			}
			}
        }       /* lecture 1 descr module */
		} /* Parsed one module documentation */
    }           /* Fin lecture librairie */
	} /* Parsed complete library documentation */


    fclose( LibDoc );
	fclose( mdc_file );
}
}
+14 −2
Original line number Original line Diff line number Diff line
@@ -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 )
{
{
    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 )
            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 )
        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 )