Pcbnew: remove support of .mdc files (now useless) (already done in cvpcb).
This commit is contained in:
parent
8d0605c378
commit
0132ceb3a1
|
@ -75,6 +75,7 @@ add_library(common ${COMMON_SRCS})
|
||||||
|
|
||||||
set(PCB_COMMON_SRCS
|
set(PCB_COMMON_SRCS
|
||||||
pcbcommon.cpp
|
pcbcommon.cpp
|
||||||
|
footprint_info.cpp
|
||||||
../pcbnew/basepcbframe.cpp
|
../pcbnew/basepcbframe.cpp
|
||||||
../pcbnew/class_board.cpp
|
../pcbnew/class_board.cpp
|
||||||
../pcbnew/class_board_connected_item.cpp
|
../pcbnew/class_board_connected_item.cpp
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef KICAD_BUILD_VERSION
|
#ifndef KICAD_BUILD_VERSION
|
||||||
#define KICAD_BUILD_VERSION "(2011-02-20 BZR 2825)"
|
#define KICAD_BUILD_VERSION "(2011-02-22 BZR 2835)"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#define VERSION_STABILITY "stable"
|
//#define VERSION_STABILITY "stable"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* @file listlib.cpp
|
* @file footprint_info.cpp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,9 +13,8 @@
|
||||||
#include "kicad_string.h"
|
#include "kicad_string.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
#include "appl_wxstruct.h"
|
#include "appl_wxstruct.h"
|
||||||
|
#include "pcbstruct.h"
|
||||||
#include "cvpcb.h"
|
#include "pcbcommon.h"
|
||||||
#include "cvpcb_mainframe.h"
|
|
||||||
#include "richio.h"
|
#include "richio.h"
|
||||||
#include "filter_reader.h"
|
#include "filter_reader.h"
|
||||||
#include "footprint_info.h"
|
#include "footprint_info.h"
|
|
@ -34,7 +34,6 @@ set(CVPCB_SRCS
|
||||||
genequiv.cpp
|
genequiv.cpp
|
||||||
init.cpp
|
init.cpp
|
||||||
listboxes.cpp
|
listboxes.cpp
|
||||||
listlib.cpp
|
|
||||||
loadcmp.cpp
|
loadcmp.cpp
|
||||||
menubar.cpp
|
menubar.cpp
|
||||||
readschematicnetlist.cpp
|
readschematicnetlist.cpp
|
||||||
|
|
|
@ -19,12 +19,11 @@
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Analyze the libraries to find the module.
|
* Read libraries to find a module.
|
||||||
* If this module is found, copy it into memory, and
|
* If this module is found, copy it into memory
|
||||||
* string end of the list of modules.
|
|
||||||
*
|
*
|
||||||
* @param CmpName - Module name
|
* @param CmpName - Module name
|
||||||
* @return - Module if found otherwise NULL.
|
* @return - a pointer to the loaded module or NULL.
|
||||||
*/
|
*/
|
||||||
MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& CmpName )
|
MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& CmpName )
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
#ifndef _FOOTPRINT_INFO_H_
|
#ifndef _FOOTPRINT_INFO_H_
|
||||||
#define _FOOTPRINT_INFO_H_
|
#define _FOOTPRINT_INFO_H_
|
||||||
|
|
||||||
|
#include <boost/ptr_container/ptr_vector.hpp>
|
||||||
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
#include "kicad_string.h"
|
#include "kicad_string.h"
|
||||||
|
|
||||||
/*
|
/*
|
|
@ -12,9 +12,7 @@
|
||||||
|
|
||||||
// Definitions relatives aux libraries
|
// Definitions relatives aux libraries
|
||||||
#define ENTETE_LIBRAIRIE "PCBNEW-LibModule-V1"
|
#define ENTETE_LIBRAIRIE "PCBNEW-LibModule-V1"
|
||||||
#define ENTETE_LIBDOC "PCBNEW-LibDoc----V1"
|
|
||||||
#define L_ENTETE_LIB 18
|
#define L_ENTETE_LIB 18
|
||||||
#define EXT_DOC wxT( "mdc" )
|
|
||||||
|
|
||||||
class NETINFO_ITEM;
|
class NETINFO_ITEM;
|
||||||
class MARKER_PCB;
|
class MARKER_PCB;
|
||||||
|
|
|
@ -202,14 +202,12 @@ public:
|
||||||
* abort an existing footprint is found
|
* abort an existing footprint is found
|
||||||
* @param aDisplayDialog = true to display a dialog to enter or confirm the
|
* @param aDisplayDialog = true to display a dialog to enter or confirm the
|
||||||
* footprint name
|
* footprint name
|
||||||
* @param aCreateDocFile = true to creates the associated doc file
|
* @return : true if OK, false if abort
|
||||||
* @return : 1 if OK,0 if abort
|
|
||||||
*/
|
*/
|
||||||
int Save_Module_In_Library( const wxString& aLibName,
|
bool Save_Module_In_Library( const wxString& aLibName,
|
||||||
MODULE* aModule,
|
MODULE* aModule,
|
||||||
bool aOverwrite,
|
bool aOverwrite,
|
||||||
bool aDisplayDialog,
|
bool aDisplayDialog );
|
||||||
bool aCreateDocFile );
|
|
||||||
|
|
||||||
void Archive_Modules( const wxString& LibName,
|
void Archive_Modules( const wxString& LibName,
|
||||||
bool NewModulesOnly );
|
bool NewModulesOnly );
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
; General Product Description Definitions
|
; General Product Description Definitions
|
||||||
!define PRODUCT_NAME "KiCad"
|
!define PRODUCT_NAME "KiCad"
|
||||||
!define PRODUCT_VERSION "2011.02.20"
|
!define PRODUCT_VERSION "2011.02.22"
|
||||||
!define PRODUCT_WEB_SITE "http://iut-tice.ujf-grenoble.fr/kicad/"
|
!define PRODUCT_WEB_SITE "http://iut-tice.ujf-grenoble.fr/kicad/"
|
||||||
!define SOURCEFORGE_WEB_SITE "http://kicad.sourceforge.net/"
|
!define SOURCEFORGE_WEB_SITE "http://kicad.sourceforge.net/"
|
||||||
!define COMPANY_NAME ""
|
!define COMPANY_NAME ""
|
||||||
|
|
|
@ -35,9 +35,6 @@ static const wxString ModExportFileWildcard(
|
||||||
_( "Kicad foot print export files (*.emp)|*.emp" ) );
|
_( "Kicad foot print export files (*.emp)|*.emp" ) );
|
||||||
|
|
||||||
|
|
||||||
static bool CreateDocLibrary( const wxString& LibName );
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Function Import_Module
|
* Function Import_Module
|
||||||
* Read a file containing only one footprint.
|
* Read a file containing only one footprint.
|
||||||
|
@ -389,8 +386,6 @@ void WinEDA_ModuleEditFrame::Delete_Module_In_Library( const wxString& aLibname
|
||||||
msg.Printf( _( "Component %s deleted in library %s" ), GetChars( CmpName ),
|
msg.Printf( _( "Component %s deleted in library %s" ), GetChars( CmpName ),
|
||||||
GetChars( oldFileName.GetFullPath() ) );
|
GetChars( oldFileName.GetFullPath() ) );
|
||||||
SetStatusText( msg );
|
SetStatusText( msg );
|
||||||
|
|
||||||
CreateDocLibrary( oldFileName.GetFullPath() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -473,15 +468,13 @@ void WinEDA_BasePcbFrame::Archive_Modules( const wxString& LibName,
|
||||||
{
|
{
|
||||||
if( Save_Module_In_Library( fileName, Module,
|
if( Save_Module_In_Library( fileName, Module,
|
||||||
NewModulesOnly ? false : true,
|
NewModulesOnly ? false : true,
|
||||||
false, false ) == 0 )
|
false ) == 0 )
|
||||||
break;
|
break;
|
||||||
DisplayActivity( (int) ( ii * Pas ), wxEmptyString );
|
DisplayActivity( (int) ( ii * Pas ), wxEmptyString );
|
||||||
/* Check for request to stop backup (ESCAPE key actuated) */
|
/* Check for request to stop backup (ESCAPE key actuated) */
|
||||||
if( DrawPanel->m_AbortRequest )
|
if( DrawPanel->m_AbortRequest )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateDocLibrary( fileName );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -494,14 +487,12 @@ void WinEDA_BasePcbFrame::Archive_Modules( const wxString& LibName,
|
||||||
* an existing footprint is found
|
* an existing footprint is found
|
||||||
* @param aDisplayDialog = true to display a dialog to enter or confirm the
|
* @param aDisplayDialog = true to display a dialog to enter or confirm the
|
||||||
* footprint name
|
* footprint name
|
||||||
* @param aCreateDocFile = true to creates the associated doc file
|
* @return : true if OK, false if abort
|
||||||
* @return : 1 if OK, 0 if abort
|
|
||||||
*/
|
*/
|
||||||
int WinEDA_BasePcbFrame::Save_Module_In_Library( const wxString& aLibName,
|
bool WinEDA_BasePcbFrame::Save_Module_In_Library( const wxString& aLibName,
|
||||||
MODULE* aModule,
|
MODULE* aModule,
|
||||||
bool aOverwrite,
|
bool aOverwrite,
|
||||||
bool aDisplayDialog,
|
bool aDisplayDialog )
|
||||||
bool aCreateDocFile )
|
|
||||||
{
|
{
|
||||||
wxFileName oldFileName;
|
wxFileName oldFileName;
|
||||||
wxFileName newFileName;
|
wxFileName newFileName;
|
||||||
|
@ -519,7 +510,7 @@ int WinEDA_BasePcbFrame::Save_Module_In_Library( const wxString& aLibName,
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Library %s not found" ), GetChars( aLibName ) );
|
msg.Printf( _( "Library %s not found" ), GetChars( aLibName ) );
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ask for the footprint name in lib */
|
/* Ask for the footprint name in lib */
|
||||||
|
@ -542,7 +533,7 @@ int WinEDA_BasePcbFrame::Save_Module_In_Library( const wxString& aLibName,
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Unable to open %s" ), GetChars( aLibName ) );
|
msg.Printf( _( "Unable to open %s" ), GetChars( aLibName ) );
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read library file : library header */
|
/* Read library file : library header */
|
||||||
|
@ -553,7 +544,7 @@ int WinEDA_BasePcbFrame::Save_Module_In_Library( const wxString& aLibName,
|
||||||
msg.Printf( _( "File %s is not a eeschema library" ),
|
msg.Printf( _( "File %s is not a eeschema library" ),
|
||||||
GetChars( aLibName ) );
|
GetChars( aLibName ) );
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read footprints in lib: - search for an existing footprint */
|
/* Read footprints in lib: - search for an existing footprint */
|
||||||
|
@ -603,7 +594,7 @@ int WinEDA_BasePcbFrame::Save_Module_In_Library( const wxString& aLibName,
|
||||||
if( ( lib_module = wxFopen( aLibName, wxT( "rt" ) ) ) == NULL )
|
if( ( lib_module = wxFopen( aLibName, wxT( "rt" ) ) ) == NULL )
|
||||||
{
|
{
|
||||||
DisplayError( this, wxT( "Librairi.cpp: Error oldlib not found" ) );
|
DisplayError( this, wxT( "Librairi.cpp: Error oldlib not found" ) );
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
newFileName = aLibName;
|
newFileName = aLibName;
|
||||||
|
@ -614,7 +605,7 @@ int WinEDA_BasePcbFrame::Save_Module_In_Library( const wxString& aLibName,
|
||||||
fclose( lib_module );
|
fclose( lib_module );
|
||||||
msg = _( "Unable to create " ) + newFileName.GetFullPath();
|
msg = _( "Unable to create " ) + newFileName.GetFullPath();
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBeginBusyCursor();
|
wxBeginBusyCursor();
|
||||||
|
@ -702,13 +693,9 @@ int WinEDA_BasePcbFrame::Save_Module_In_Library( const wxString& aLibName,
|
||||||
if( !wxRenameFile( newFileName.GetFullPath(), aLibName ) )
|
if( !wxRenameFile( newFileName.GetFullPath(), aLibName ) )
|
||||||
{
|
{
|
||||||
DisplayError( this, wxT( "Librairi.cpp: rename NewLib err" ) );
|
DisplayError( this, wxT( "Librairi.cpp: rename NewLib err" ) );
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* creates the new .dcm doc file corresponding to the new library */
|
|
||||||
if( aCreateDocFile )
|
|
||||||
CreateDocLibrary( aLibName );
|
|
||||||
|
|
||||||
if( aDisplayDialog )
|
if( aDisplayDialog )
|
||||||
{
|
{
|
||||||
msg = _( "Component " ); msg += Name_Cmp;
|
msg = _( "Component " ); msg += Name_Cmp;
|
||||||
|
@ -717,7 +704,7 @@ int WinEDA_BasePcbFrame::Save_Module_In_Library( const wxString& aLibName,
|
||||||
SetStatusText( msg );
|
SetStatusText( msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -840,107 +827,3 @@ int WinEDA_ModuleEditFrame::Create_Librairie( const wxString& LibName )
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Synch. Dcm combines a library Libname
|
|
||||||
* (Full file name)
|
|
||||||
*/
|
|
||||||
static bool CreateDocLibrary( const wxString& LibName )
|
|
||||||
{
|
|
||||||
char Line[1024];
|
|
||||||
char cbuf[256];
|
|
||||||
wxString Name, Doc, KeyWord;
|
|
||||||
wxFileName fn;
|
|
||||||
FILE* LibMod, * LibDoc;
|
|
||||||
|
|
||||||
fn = LibName;
|
|
||||||
fn.SetExt( EXT_DOC );
|
|
||||||
|
|
||||||
LibMod = wxFopen( LibName, wxT( "rt" ) );
|
|
||||||
if( LibMod == NULL )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/* Read library header. */
|
|
||||||
GetLine( LibMod, Line, NULL, sizeof(Line) - 1 );
|
|
||||||
if( strnicmp( Line, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) != 0 )
|
|
||||||
{
|
|
||||||
fclose( LibMod );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
LibDoc = wxFopen( fn.GetFullPath(), wxT( "wt" ) );
|
|
||||||
if( LibDoc == NULL )
|
|
||||||
{
|
|
||||||
fclose( LibMod );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
fprintf( LibDoc, ENTETE_LIBDOC );
|
|
||||||
fprintf( LibDoc, " %s\n", DateAndTime( cbuf ) );
|
|
||||||
|
|
||||||
/* Read library. */
|
|
||||||
Name = Doc = KeyWord = wxEmptyString;
|
|
||||||
while( GetLine( LibMod, Line, NULL, sizeof(Line) - 1 ) )
|
|
||||||
{
|
|
||||||
if( Line[0] != '$' )
|
|
||||||
continue;
|
|
||||||
if( strnicmp( Line, "$MODULE", 6 ) == 0 )
|
|
||||||
{
|
|
||||||
while( GetLine( LibMod, Line, NULL, sizeof(Line) - 1 ) )
|
|
||||||
{
|
|
||||||
if( Line[0] == '$' )
|
|
||||||
{
|
|
||||||
if( Line[1] == 'E' )
|
|
||||||
break;
|
|
||||||
if( Line[1] == 'P' ) /* Pad Descr */
|
|
||||||
{
|
|
||||||
while( GetLine( LibMod, Line, NULL, sizeof(Line) - 1 ) )
|
|
||||||
{
|
|
||||||
if( (Line[0] == '$') && (Line[1] == 'E') )
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if( Line[0] == 'L' ) /* LibName */
|
|
||||||
Name = CONV_FROM_UTF8( StrPurge( Line + 3 ) );
|
|
||||||
|
|
||||||
if( Line[0] == 'K' ) /* KeyWords */
|
|
||||||
KeyWord = CONV_FROM_UTF8( StrPurge( Line + 3 ) );
|
|
||||||
|
|
||||||
if( Line[0] == 'C' ) /* Doc */
|
|
||||||
Doc = CONV_FROM_UTF8( StrPurge( Line + 3 ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Generate the module the documentation. */
|
|
||||||
if( ( Name != wxEmptyString )
|
|
||||||
&& ( ( Doc != wxEmptyString ) || ( KeyWord != wxEmptyString ) ) )
|
|
||||||
{
|
|
||||||
fprintf( LibDoc, "#\n$MODULE %s\n", CONV_TO_UTF8( Name ) );
|
|
||||||
fprintf( LibDoc, "Li %s\n", CONV_TO_UTF8( Name ) );
|
|
||||||
if( Doc != wxEmptyString )
|
|
||||||
fprintf( LibDoc, "Cd %s\n", CONV_TO_UTF8( Doc ) );
|
|
||||||
|
|
||||||
if( KeyWord != wxEmptyString )
|
|
||||||
fprintf( LibDoc, "Kw %s\n", CONV_TO_UTF8( KeyWord ) );
|
|
||||||
|
|
||||||
fprintf( LibDoc, "$EndMODULE\n" );
|
|
||||||
}
|
|
||||||
Name = Doc = KeyWord = wxEmptyString;
|
|
||||||
} /* End read 1 module */
|
|
||||||
|
|
||||||
if( strnicmp( Line, "$INDEX", 6 ) == 0 )
|
|
||||||
{
|
|
||||||
while( GetLine( LibMod, Line, NULL, sizeof(Line) - 1 ) )
|
|
||||||
{
|
|
||||||
if( strnicmp( Line, "$EndINDEX", 9 ) == 0 )
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* End read INDEX */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose( LibMod );
|
|
||||||
fprintf( LibDoc, "#\n$EndLIBDOC\n" );
|
|
||||||
fclose( LibDoc );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
|
@ -19,30 +19,12 @@
|
||||||
#include "dialog_helpers.h"
|
#include "dialog_helpers.h"
|
||||||
#include "richio.h"
|
#include "richio.h"
|
||||||
#include "filter_reader.h"
|
#include "filter_reader.h"
|
||||||
|
#include "footprint_info.h"
|
||||||
class FOOTPRINT_ITEM
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
FOOTPRINT_ITEM* Next;
|
|
||||||
wxString m_Name, m_Doc, m_KeyWord;
|
|
||||||
|
|
||||||
public:
|
|
||||||
FOOTPRINT_ITEM()
|
|
||||||
{
|
|
||||||
Next = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
~FOOTPRINT_ITEM()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static void DisplayCmpDoc( wxString& Name );
|
static void DisplayCmpDoc( wxString& Name );
|
||||||
static void ReadDocLib( const wxString& ModLibName );
|
|
||||||
|
|
||||||
|
static FOOTPRINT_LIST MList;
|
||||||
static FOOTPRINT_ITEM* MList;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Load_Module_From_BOARD
|
* Function Load_Module_From_BOARD
|
||||||
|
@ -371,144 +353,42 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow
|
||||||
const wxString& aMask,
|
const wxString& aMask,
|
||||||
const wxString& aKeyWord )
|
const wxString& aKeyWord )
|
||||||
{
|
{
|
||||||
unsigned ii;
|
|
||||||
char* Line;
|
|
||||||
wxFileName fn;
|
|
||||||
static wxString OldName; /* Save the name of the last module loaded. */
|
static wxString OldName; /* Save the name of the last module loaded. */
|
||||||
wxString CmpName;
|
wxString CmpName;
|
||||||
wxString libFullName;
|
|
||||||
FILE* file;
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
wxArrayString itemslist;
|
wxArrayString libnames_list;
|
||||||
|
|
||||||
wxBeginBusyCursor();
|
if( aLibraryFullFilename.IsEmpty() )
|
||||||
|
libnames_list = g_LibName_List;
|
||||||
|
else
|
||||||
|
libnames_list.Add( aLibraryFullFilename );
|
||||||
|
|
||||||
/* Find modules in libraries. */
|
/* Find modules in libraries. */
|
||||||
for( ii = 0; ii < g_LibName_List.GetCount(); ii++ )
|
MList.ReadFootprintFiles( libnames_list );
|
||||||
{
|
|
||||||
/* Calculate the full file name of the library. */
|
|
||||||
if( aLibraryFullFilename.IsEmpty() )
|
|
||||||
{
|
|
||||||
fn = wxFileName( wxEmptyString, g_LibName_List[ii],
|
|
||||||
ModuleFileExtension );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
fn = aLibraryFullFilename;
|
|
||||||
|
|
||||||
libFullName = wxGetApp().FindLibraryPath( fn );
|
|
||||||
|
|
||||||
if( libFullName.IsEmpty() )
|
|
||||||
{
|
|
||||||
msg.Printf( _( "PCB footprint library file <%s> not found in search paths." ),
|
|
||||||
GetChars( fn.GetFullName() ) );
|
|
||||||
wxMessageBox( msg, _( "Library Load Error" ),
|
|
||||||
wxOK | wxICON_ERROR, this );
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ReadDocLib( libFullName );
|
|
||||||
|
|
||||||
if( !aKeyWord.IsEmpty() ) /* Don't read the library if selection
|
|
||||||
* by keywords, already read. */
|
|
||||||
{
|
|
||||||
if( !aLibraryFullFilename.IsEmpty() )
|
|
||||||
break;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
file = wxFopen( libFullName, wxT( "rt" ) );
|
|
||||||
|
|
||||||
if( file == NULL )
|
|
||||||
{
|
|
||||||
if( !aLibraryFullFilename.IsEmpty() )
|
|
||||||
break;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
FILE_LINE_READER fileReader( file, libFullName );
|
|
||||||
|
|
||||||
FILTER_READER reader( fileReader );
|
|
||||||
|
|
||||||
// Statusbar library loaded message
|
|
||||||
msg = _( "Library " ) + fn.GetFullPath() + _( " loaded" );
|
|
||||||
SetStatusText( msg );
|
|
||||||
|
|
||||||
/* Read header. */
|
|
||||||
reader.ReadLine();
|
|
||||||
Line = reader.Line();
|
|
||||||
|
|
||||||
if( strnicmp( Line, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) != 0 )
|
|
||||||
{
|
|
||||||
msg.Printf( _( "<%s> is not a valid Kicad PCB footprint library file." ),
|
|
||||||
GetChars( libFullName ) );
|
|
||||||
wxMessageBox( msg, _( "Library Load Error" ), wxOK | wxICON_ERROR, this );
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Read library. */
|
|
||||||
while( reader.ReadLine() )
|
|
||||||
{
|
|
||||||
Line = reader.Line();
|
|
||||||
if( Line[0] != '$' )
|
|
||||||
continue;
|
|
||||||
if( strnicmp( Line, "$MODULE", 6 ) == 0 )
|
|
||||||
break;
|
|
||||||
if( strnicmp( Line, "$INDEX", 6 ) == 0 )
|
|
||||||
{
|
|
||||||
while( reader.ReadLine() )
|
|
||||||
{
|
|
||||||
Line = reader.Line();
|
|
||||||
if( strnicmp( Line, "$EndINDEX", 9 ) == 0 )
|
|
||||||
break;
|
|
||||||
strupper( Line );
|
|
||||||
msg = CONV_FROM_UTF8( StrPurge( Line ) );
|
|
||||||
if( aMask.IsEmpty() )
|
|
||||||
itemslist.Add( msg );
|
|
||||||
else if( WildCompareString( aMask, msg, false ) )
|
|
||||||
itemslist.Add( msg );
|
|
||||||
}
|
|
||||||
} /* End read INDEX */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* End read library. */
|
|
||||||
file = NULL;
|
|
||||||
|
|
||||||
if( !aLibraryFullFilename.IsEmpty() )
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
wxArrayString footprint_names_list;
|
||||||
/* Create list of modules if search by keyword. */
|
/* Create list of modules if search by keyword. */
|
||||||
if( !aKeyWord.IsEmpty() )
|
if( !aKeyWord.IsEmpty() )
|
||||||
{
|
{
|
||||||
FOOTPRINT_ITEM* ItemMod = MList;
|
for( unsigned ii = 0; ii < MList.GetCount(); ii++ )
|
||||||
while( ItemMod != NULL )
|
|
||||||
{
|
{
|
||||||
if( KeyWordOk( aKeyWord, ItemMod->m_KeyWord ) )
|
if( KeyWordOk( aKeyWord, MList.GetItem(ii).m_KeyWord ) )
|
||||||
itemslist.Add( ItemMod->m_Name );
|
footprint_names_list.Add( MList.GetItem(ii).m_Module );
|
||||||
ItemMod = ItemMod->Next;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
for( unsigned ii = 0; ii < MList.GetCount(); ii++ )
|
||||||
|
footprint_names_list.Add( MList.GetItem(ii).m_Module );
|
||||||
|
|
||||||
wxEndBusyCursor();
|
msg.Printf( _( "Modules [%d items]" ), footprint_names_list.GetCount() );
|
||||||
|
WinEDAListBox dlg( aWindow, msg, footprint_names_list, OldName,
|
||||||
msg.Printf( _( "Modules [%d items]" ), itemslist.GetCount() );
|
|
||||||
WinEDAListBox dlg( aWindow, msg, itemslist, OldName,
|
|
||||||
DisplayCmpDoc, GetComponentDialogPosition() );
|
DisplayCmpDoc, GetComponentDialogPosition() );
|
||||||
|
|
||||||
dlg.SortList();
|
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxID_OK )
|
if( dlg.ShowModal() == wxID_OK )
|
||||||
CmpName = dlg.GetTextSelection();
|
CmpName = dlg.GetTextSelection();
|
||||||
else
|
else
|
||||||
CmpName.Empty();
|
CmpName.Empty();
|
||||||
|
|
||||||
while( MList != NULL )
|
|
||||||
{
|
|
||||||
FOOTPRINT_ITEM* NewMod = MList->Next;
|
|
||||||
delete MList;
|
|
||||||
MList = NewMod;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( CmpName != wxEmptyString )
|
if( CmpName != wxEmptyString )
|
||||||
OldName = CmpName;
|
OldName = CmpName;
|
||||||
|
|
||||||
|
@ -521,93 +401,17 @@ wxString WinEDA_BasePcbFrame::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow
|
||||||
*/
|
*/
|
||||||
static void DisplayCmpDoc( wxString& Name )
|
static void DisplayCmpDoc( wxString& Name )
|
||||||
{
|
{
|
||||||
FOOTPRINT_ITEM* Mod = MList;
|
FOOTPRINT_INFO* module_info = MList.GetModuleInfo( Name );
|
||||||
|
|
||||||
if( !Mod )
|
if( !module_info )
|
||||||
{
|
{
|
||||||
Name.Empty();
|
Name.Empty();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while( Mod )
|
Name = module_info->m_Doc.IsEmpty() ? wxT( "No Doc" ) : module_info->m_Doc;
|
||||||
{
|
Name += wxT( "\nKeyW: " );
|
||||||
if( !Mod->m_Name.IsEmpty() && ( Mod->m_Name.CmpNoCase( Name ) == 0 ) )
|
Name += module_info->m_KeyWord.IsEmpty() ? wxT( "No Keyword" ) : module_info->m_KeyWord;
|
||||||
break;
|
|
||||||
Mod = Mod->Next;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( Mod )
|
|
||||||
{
|
|
||||||
Name = !Mod->m_Doc.IsEmpty() ? Mod->m_Doc : wxT( "No Doc" );
|
|
||||||
Name += wxT( "\nKeyW: " );
|
|
||||||
Name += !Mod->m_KeyWord.IsEmpty() ? Mod->m_KeyWord : wxT( "No Keyword" );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Name = wxEmptyString;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Read the doc file and combine with a library ModLibName.
|
|
||||||
* Load in memory the list of docs string pointed to by mlist
|
|
||||||
* ModLibName = full file name of the library modules
|
|
||||||
*/
|
|
||||||
static void ReadDocLib( const wxString& ModLibName )
|
|
||||||
{
|
|
||||||
FOOTPRINT_ITEM* NewMod;
|
|
||||||
char* Line;
|
|
||||||
FILE* LibDoc;
|
|
||||||
wxFileName fn = ModLibName;
|
|
||||||
|
|
||||||
fn.SetExt( EXT_DOC );
|
|
||||||
|
|
||||||
if( ( LibDoc = wxFopen( fn.GetFullPath(), wxT( "rt" ) ) ) == NULL )
|
|
||||||
return;
|
|
||||||
|
|
||||||
FILE_LINE_READER fileReader( LibDoc, fn.GetFullPath() );
|
|
||||||
|
|
||||||
FILTER_READER reader( fileReader );
|
|
||||||
|
|
||||||
reader.ReadLine();
|
|
||||||
Line = reader.Line();
|
|
||||||
if( strnicmp( Line, ENTETE_LIBDOC, L_ENTETE_LIB ) != 0 )
|
|
||||||
return;
|
|
||||||
|
|
||||||
while( reader.ReadLine() )
|
|
||||||
{
|
|
||||||
Line = reader.Line();
|
|
||||||
if( Line[0] != '$' )
|
|
||||||
continue;
|
|
||||||
if( Line[1] == 'E' )
|
|
||||||
break; ;
|
|
||||||
if( Line[1] == 'M' ) /* Debut decription 1 module */
|
|
||||||
{
|
|
||||||
NewMod = new FOOTPRINT_ITEM();
|
|
||||||
NewMod->Next = MList;
|
|
||||||
MList = NewMod;
|
|
||||||
while( reader.ReadLine() )
|
|
||||||
{
|
|
||||||
Line = reader.Line();
|
|
||||||
if( Line[0] == '$' ) /* $EndMODULE */
|
|
||||||
break;
|
|
||||||
|
|
||||||
switch( Line[0] )
|
|
||||||
{
|
|
||||||
case 'L': /* LibName */
|
|
||||||
NewMod->m_Name = CONV_FROM_UTF8( StrPurge( Line + 3 ) );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'K': /* KeyWords */
|
|
||||||
NewMod->m_KeyWord = CONV_FROM_UTF8( StrPurge( Line + 3 ) );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'C': /* Doc */
|
|
||||||
NewMod->m_Doc = CONV_FROM_UTF8( StrPurge( Line + 3 ) );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} /* End read 1 module. */
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -264,8 +264,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
wxFileName fn;
|
wxFileName fn;
|
||||||
fn = wxFileName( wxEmptyString, m_CurrentLib, ModuleFileExtension );
|
fn = wxFileName( wxEmptyString, m_CurrentLib, ModuleFileExtension );
|
||||||
wxString full_filename = wxGetApp().FindLibraryPath( fn );
|
wxString full_filename = wxGetApp().FindLibraryPath( fn );
|
||||||
Save_Module_In_Library( full_filename, GetBoard()->m_Modules,
|
Save_Module_In_Library( full_filename, GetBoard()->m_Modules, true, true );
|
||||||
true, true, true );
|
|
||||||
GetScreen()->ClrModify();
|
GetScreen()->ClrModify();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
release version:
|
release version:
|
||||||
2011 feb 20
|
2011 feb 22
|
||||||
files (.zip,.tgz):
|
files (.zip,.tgz):
|
||||||
kicad-2011-02-20
|
kicad-2011-02-22
|
||||||
|
|
Loading…
Reference in New Issue