parent
ee003180bc
commit
6910df3972
|
@ -149,14 +149,8 @@ found in the default search paths." ),
|
||||||
if( alias.m_Name.CmpNoCase( component.m_Value ) != 0 )
|
if( alias.m_Name.CmpNoCase( component.m_Value ) != 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
BOOST_FOREACH( FOOTPRINT_INFO& footprint, m_footprints )
|
if( m_footprints.GetModuleInfo( alias.m_FootprintName ) )
|
||||||
{
|
SetNewPkg( alias.m_FootprintName );
|
||||||
if( alias.m_FootprintName.CmpNoCase( footprint.m_Module ) == 0 )
|
|
||||||
{
|
|
||||||
SetNewPkg( footprint.m_Module );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( component.m_Module.IsEmpty() )
|
if( component.m_Module.IsEmpty() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,17 +12,6 @@
|
||||||
#include "cvstruct.h"
|
#include "cvstruct.h"
|
||||||
|
|
||||||
|
|
||||||
FOOTPRINT_INFO* GetModuleDescrByName( const wxString& FootprintName, FOOTPRINT_LIST& list )
|
|
||||||
{
|
|
||||||
BOOST_FOREACH( FOOTPRINT_INFO & footprint, list )
|
|
||||||
{
|
|
||||||
if( footprint.m_Module == FootprintName )
|
|
||||||
return &footprint;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***************************************/
|
/***************************************/
|
||||||
/* ListBox handling the footprint list */
|
/* ListBox handling the footprint list */
|
||||||
/***************************************/
|
/***************************************/
|
||||||
|
@ -127,9 +116,11 @@ void FOOTPRINTS_LISTBOX::SetFootprintFullList( FOOTPRINT_LIST& list )
|
||||||
|
|
||||||
m_FullFootprintList.Clear();
|
m_FullFootprintList.Clear();
|
||||||
|
|
||||||
BOOST_FOREACH( FOOTPRINT_INFO & footprint, list ) {
|
for( unsigned ii = 0; ii < list.GetCount(); ii++ )
|
||||||
|
{
|
||||||
|
FOOTPRINT_INFO & footprint = list.GetItem(ii);
|
||||||
msg.Printf( wxT( "%3d %s" ), m_FullFootprintList.GetCount() + 1,
|
msg.Printf( wxT( "%3d %s" ), m_FullFootprintList.GetCount() + 1,
|
||||||
footprint.m_Module.GetData() );
|
GetChars(footprint.m_Module) );
|
||||||
m_FullFootprintList.Add( msg );
|
m_FullFootprintList.Add( msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +136,6 @@ void FOOTPRINTS_LISTBOX::SetFootprintFullList( FOOTPRINT_LIST& list )
|
||||||
void FOOTPRINTS_LISTBOX::SetFootprintFilteredList( COMPONENT* Component,
|
void FOOTPRINTS_LISTBOX::SetFootprintFilteredList( COMPONENT* Component,
|
||||||
FOOTPRINT_LIST& list )
|
FOOTPRINT_LIST& list )
|
||||||
{
|
{
|
||||||
FOOTPRINT_LIST::iterator i;
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
unsigned jj;
|
unsigned jj;
|
||||||
int OldSelection = GetSelection();
|
int OldSelection = GetSelection();
|
||||||
|
@ -153,7 +143,9 @@ void FOOTPRINTS_LISTBOX::SetFootprintFilteredList( COMPONENT* Component,
|
||||||
|
|
||||||
m_FilteredFootprintList.Clear();
|
m_FilteredFootprintList.Clear();
|
||||||
|
|
||||||
BOOST_FOREACH( FOOTPRINT_INFO & footprint, list ) {
|
for( unsigned ii = 0; ii < list.GetCount(); ii++ )
|
||||||
|
{
|
||||||
|
FOOTPRINT_INFO& footprint = list.GetItem(ii);
|
||||||
/* Search for matching footprints */
|
/* Search for matching footprints */
|
||||||
for( jj = 0; jj < Component->m_FootprintFilter.GetCount(); jj++ )
|
for( jj = 0; jj < Component->m_FootprintFilter.GetCount(); jj++ )
|
||||||
{
|
{
|
||||||
|
@ -250,7 +242,7 @@ void FOOTPRINTS_LISTBOX::OnLeftClick( wxListEvent& event )
|
||||||
FOOTPRINT_INFO* Module;
|
FOOTPRINT_INFO* Module;
|
||||||
wxString FootprintName = GetSelectedFootprint();
|
wxString FootprintName = GetSelectedFootprint();
|
||||||
|
|
||||||
Module = GetModuleDescrByName( FootprintName, GetParent()->m_footprints );
|
Module = GetParent()->m_footprints.GetModuleInfo( FootprintName );
|
||||||
wxASSERT(Module);
|
wxASSERT(Module);
|
||||||
if( GetParent()->DrawFrame )
|
if( GetParent()->DrawFrame )
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
#include "dialog_cvpcb_config.h"
|
#include "dialog_cvpcb_config.h"
|
||||||
#include "class_DisplayFootprintsFrame.h"
|
#include "class_DisplayFootprintsFrame.h"
|
||||||
#include "cvpcb_id.h"
|
#include "cvpcb_id.h"
|
||||||
|
#include "dialog_load_error.h"
|
||||||
|
|
||||||
|
|
||||||
#include "build_version.h"
|
#include "build_version.h"
|
||||||
|
|
||||||
|
@ -603,3 +605,46 @@ void CVPCB_MAINFRAME::DisplayStatus()
|
||||||
msg.Empty();
|
msg.Empty();
|
||||||
SetStatusText( msg, 2 );
|
SetStatusText( msg, 2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read the list of libraries (*.mod files) and populates m_footprints
|
||||||
|
* ( list of availaible modules in libs ).
|
||||||
|
* for each module are stored
|
||||||
|
* the module name
|
||||||
|
* documentation string
|
||||||
|
* associated keywords
|
||||||
|
*/
|
||||||
|
bool CVPCB_MAINFRAME::LoadFootprintFiles( )
|
||||||
|
{
|
||||||
|
/* Check if there are footprint libraries in project file */
|
||||||
|
if( m_ModuleLibNames.GetCount() == 0 )
|
||||||
|
{
|
||||||
|
wxMessageBox( _( "No PCB footprint libraries are listed in the current project file." ),
|
||||||
|
_( "Project File Error" ), wxOK | wxICON_ERROR );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_footprints.ReadFootprintFiles(m_ModuleLibNames);
|
||||||
|
|
||||||
|
/* Display error messages, if any */
|
||||||
|
if( !m_footprints.m_filesNotFound.IsEmpty() || !m_footprints.m_filesInvalid.IsEmpty() )
|
||||||
|
{
|
||||||
|
DIALOG_LOAD_ERROR dialog(NULL);
|
||||||
|
if( !m_footprints.m_filesNotFound.IsEmpty() )
|
||||||
|
{
|
||||||
|
wxString message = _("Some files could not be found!");
|
||||||
|
dialog.MessageSet(message);
|
||||||
|
dialog.ListSet(m_footprints.m_filesNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Display if there are invalid files */
|
||||||
|
if( !m_footprints.m_filesInvalid.IsEmpty() )
|
||||||
|
{
|
||||||
|
dialog.MessageSet( _("Some files are invalid!"));
|
||||||
|
dialog.ListSet(m_footprints.m_filesInvalid);
|
||||||
|
}
|
||||||
|
dialog.ShowModal();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
@ -27,7 +27,76 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef boost::ptr_vector< FOOTPRINT_INFO > FOOTPRINT_LIST;
|
class FOOTPRINT_LIST
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
boost::ptr_vector< FOOTPRINT_INFO > m_List;
|
||||||
|
wxString m_filesNotFound;
|
||||||
|
wxString m_filesInvalid;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function GetCount
|
||||||
|
* @return the number of items stored in list
|
||||||
|
*/
|
||||||
|
unsigned GetCount() { return m_List.size(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function GetModuleInfo
|
||||||
|
* @return the item stored in list if found
|
||||||
|
* @param aFootprintName = the name of item
|
||||||
|
*/
|
||||||
|
FOOTPRINT_INFO * GetModuleInfo( const wxString & aFootprintName )
|
||||||
|
{
|
||||||
|
BOOST_FOREACH( FOOTPRINT_INFO& footprint, m_List )
|
||||||
|
{
|
||||||
|
if( aFootprintName.CmpNoCase( footprint.m_Module ) == 0 )
|
||||||
|
return &footprint;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function GetItem
|
||||||
|
* @return the aIdx item in list
|
||||||
|
* @param aIdx = index of the given item
|
||||||
|
*/
|
||||||
|
FOOTPRINT_INFO & GetItem( unsigned aIdx )
|
||||||
|
{
|
||||||
|
return m_List[aIdx];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function AddItem
|
||||||
|
* add aItem in list
|
||||||
|
* @param aItem = item to add
|
||||||
|
*/
|
||||||
|
void AddItem( FOOTPRINT_INFO* aItem )
|
||||||
|
{
|
||||||
|
m_List.push_back( aItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function ReadFootprintFiles
|
||||||
|
* Read the list of libraries (*.mod files) and populates m_List ( list of availaible modules in libs ).
|
||||||
|
* for each module, are stored
|
||||||
|
* the module name
|
||||||
|
* documentation string
|
||||||
|
* associated keywords
|
||||||
|
* library name
|
||||||
|
* Module description format:
|
||||||
|
* $MODULE c64acmd First line of module description
|
||||||
|
* Li c64acmd DIN connector Library reference
|
||||||
|
* Cd Europe 96 AC male vertical documentation string
|
||||||
|
* Kw PAD_CONN DIN associated keywords
|
||||||
|
* ...... other data (pads, outlines ..)
|
||||||
|
* $Endmodule
|
||||||
|
*
|
||||||
|
* @param aFootprintsLibNames = an array string giving the list of libraries to load
|
||||||
|
*/
|
||||||
|
bool ReadFootprintFiles( wxArrayString & aFootprintsLibNames );
|
||||||
|
};
|
||||||
|
|
||||||
/* FOOTPRINT object list sort function. */
|
/* FOOTPRINT object list sort function. */
|
||||||
inline bool operator<( const FOOTPRINT_INFO& item1, const FOOTPRINT_INFO& item2 )
|
inline bool operator<( const FOOTPRINT_INFO& item1, const FOOTPRINT_INFO& item2 )
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Functions to read footprint libraries and fill m_footprints by availlable footprints names
|
* Functions to read footprint libraries and fill m_footprints by available footprints names
|
||||||
* and their documentation (comments and keywords)
|
* and their documentation (comments and keywords)
|
||||||
*/
|
*/
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
|
@ -20,14 +20,13 @@
|
||||||
#include "filter_reader.h"
|
#include "filter_reader.h"
|
||||||
#include "footprint_info.h"
|
#include "footprint_info.h"
|
||||||
|
|
||||||
#include "dialog_load_error.h"
|
|
||||||
|
|
||||||
/*
|
/* Read the list of libraries (*.mod files)
|
||||||
* Read the list of libraries (*.mod files) and populates m_footprints ( list of availaible modules in libs ).
|
|
||||||
* for each module are stored
|
* for each module are stored
|
||||||
* the module name
|
* the module name
|
||||||
* documentation string
|
* documentation string
|
||||||
* associated keywords
|
* associated keywords
|
||||||
|
* lib name
|
||||||
* Module description format:
|
* Module description format:
|
||||||
* $MODULE c64acmd First line of module description
|
* $MODULE c64acmd First line of module description
|
||||||
* Li c64acmd DIN connector Library reference
|
* Li c64acmd DIN connector Library reference
|
||||||
|
@ -35,39 +34,29 @@
|
||||||
* Kw PAD_CONN DIN associated keywords
|
* Kw PAD_CONN DIN associated keywords
|
||||||
* ...... other data (pads, outlines ..)
|
* ...... other data (pads, outlines ..)
|
||||||
* $Endmodule
|
* $Endmodule
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
bool CVPCB_MAINFRAME::LoadFootprintFiles( )
|
bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString & aFootprintsLibNames )
|
||||||
{
|
{
|
||||||
FILE* file;
|
FILE* file;
|
||||||
wxFileName filename;
|
wxFileName filename;
|
||||||
wxString libname;
|
wxString libname;
|
||||||
wxString files_not_found;
|
|
||||||
wxString files_invalid;
|
|
||||||
|
|
||||||
/* Check if footprint m_footprints is not empty */
|
// Clear data before reading files
|
||||||
if( !m_footprints.empty() )
|
m_filesNotFound.Empty();
|
||||||
m_footprints.clear();
|
m_filesInvalid.Empty();
|
||||||
|
m_List.clear();
|
||||||
/* Check if there are footprint libraries in project file */
|
|
||||||
if( m_ModuleLibNames.GetCount() == 0 )
|
|
||||||
{
|
|
||||||
wxMessageBox( _( "No PCB footprint libraries are listed in the current project file." ),
|
|
||||||
_( "Project File Error" ), wxOK | wxICON_ERROR );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Parse Libraries Listed */
|
/* Parse Libraries Listed */
|
||||||
for( unsigned ii = 0; ii < m_ModuleLibNames.GetCount(); ii++ )
|
for( unsigned ii = 0; ii < aFootprintsLibNames.GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
filename = m_ModuleLibNames[ii];
|
filename = aFootprintsLibNames[ii];
|
||||||
filename.SetExt( ModuleFileExtension );
|
filename.SetExt( ModuleFileExtension );
|
||||||
|
|
||||||
libname = wxGetApp().FindLibraryPath( filename );
|
libname = wxGetApp().FindLibraryPath( filename );
|
||||||
|
|
||||||
if( libname.IsEmpty() )
|
if( libname.IsEmpty() )
|
||||||
{
|
{
|
||||||
files_not_found << filename.GetFullName() << wxT("\n");
|
m_filesNotFound << filename.GetFullName() << wxT("\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +65,7 @@ bool CVPCB_MAINFRAME::LoadFootprintFiles( )
|
||||||
|
|
||||||
if( file == NULL )
|
if( file == NULL )
|
||||||
{
|
{
|
||||||
files_invalid << libname << _(" (file cannot be opened)") << wxT("\n");
|
m_filesInvalid << libname << _(" (file cannot be opened)") << wxT("\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +82,7 @@ bool CVPCB_MAINFRAME::LoadFootprintFiles( )
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf( _( "<%s> is not a valid Kicad PCB footprint library." ),
|
msg.Printf( _( "<%s> is not a valid Kicad PCB footprint library." ),
|
||||||
GetChars( libname ) );
|
GetChars( libname ) );
|
||||||
files_invalid << msg << wxT("\n");
|
m_filesInvalid << msg << wxT("\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +104,7 @@ bool CVPCB_MAINFRAME::LoadFootprintFiles( )
|
||||||
FOOTPRINT_INFO* ItemLib = new FOOTPRINT_INFO();
|
FOOTPRINT_INFO* ItemLib = new FOOTPRINT_INFO();
|
||||||
ItemLib->m_Module = CONV_FROM_UTF8( StrPurge( line ) );
|
ItemLib->m_Module = CONV_FROM_UTF8( StrPurge( line ) );
|
||||||
ItemLib->m_LibName = libname;
|
ItemLib->m_LibName = libname;
|
||||||
m_footprints.push_back( ItemLib );
|
AddItem( ItemLib );
|
||||||
|
|
||||||
while( reader.ReadLine() )
|
while( reader.ReadLine() )
|
||||||
{
|
{
|
||||||
|
@ -143,30 +132,11 @@ bool CVPCB_MAINFRAME::LoadFootprintFiles( )
|
||||||
|
|
||||||
if( !end )
|
if( !end )
|
||||||
{
|
{
|
||||||
files_invalid << libname << _(" (Unexpected end of file)") << wxT("\n");
|
m_filesInvalid << libname << _(" (Unexpected end of file)") << wxT("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_footprints.sort();
|
|
||||||
|
|
||||||
/* Display error messages, if any */
|
m_List.sort();
|
||||||
if( !files_not_found.IsEmpty() || !files_invalid.IsEmpty() )
|
|
||||||
{
|
|
||||||
DIALOG_LOAD_ERROR dialog(NULL);
|
|
||||||
if( !files_not_found.IsEmpty() )
|
|
||||||
{
|
|
||||||
wxString message = _("Some files could not be found!");
|
|
||||||
dialog.MessageSet(message);
|
|
||||||
dialog.ListSet(files_not_found);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Display if there are invalid files */
|
|
||||||
if( !files_invalid.IsEmpty() )
|
|
||||||
{
|
|
||||||
dialog.MessageSet( _("Some files are invalid!"));
|
|
||||||
dialog.ListSet(files_invalid);
|
|
||||||
}
|
|
||||||
dialog.ShowModal();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,6 @@
|
||||||
#include "3d_viewer.h"
|
#include "3d_viewer.h"
|
||||||
|
|
||||||
|
|
||||||
extern FOOTPRINT_INFO* GetModuleDescrByName( const wxString& FootprintName, FOOTPRINT_LIST& list );
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create or Update the frame showing the current highlighted footprint
|
* Create or Update the frame showing the current highlighted footprint
|
||||||
* and (if showed) the 3D display frame
|
* and (if showed) the 3D display frame
|
||||||
|
@ -48,7 +46,7 @@ void CVPCB_MAINFRAME::CreateScreenCmp()
|
||||||
{
|
{
|
||||||
msg = _( "Footprint: " ) + FootprintName;
|
msg = _( "Footprint: " ) + FootprintName;
|
||||||
DrawFrame->SetTitle( msg );
|
DrawFrame->SetTitle( msg );
|
||||||
FOOTPRINT_INFO* Module = GetModuleDescrByName( FootprintName, m_footprints );
|
FOOTPRINT_INFO* Module = m_footprints.GetModuleInfo( FootprintName );
|
||||||
msg = _( "Lib: " );
|
msg = _( "Lib: " );
|
||||||
|
|
||||||
if( Module )
|
if( Module )
|
||||||
|
|
|
@ -208,6 +208,7 @@ enum main_id
|
||||||
ID_TB_OPTIONS_SELECT_CURSOR,
|
ID_TB_OPTIONS_SELECT_CURSOR,
|
||||||
ID_TB_OPTIONS_SHOW_POLAR_COORD,
|
ID_TB_OPTIONS_SHOW_POLAR_COORD,
|
||||||
ID_TB_OPTIONS_SHOW_GRID,
|
ID_TB_OPTIONS_SHOW_GRID,
|
||||||
|
ID_TB_OPTIONS_SHOW_PADS_SKETCH,
|
||||||
|
|
||||||
ID_TB_OPTIONS_SHOW_ZONES,
|
ID_TB_OPTIONS_SHOW_ZONES,
|
||||||
ID_TB_OPTIONS_SHOW_ZONES_DISABLE,
|
ID_TB_OPTIONS_SHOW_ZONES_DISABLE,
|
||||||
|
@ -222,7 +223,6 @@ enum main_id
|
||||||
|
|
||||||
ID_TB_OPTIONS_HIDDEN_PINS,
|
ID_TB_OPTIONS_HIDDEN_PINS,
|
||||||
ID_TB_OPTIONS_BUS_WIRES_ORIENT,
|
ID_TB_OPTIONS_BUS_WIRES_ORIENT,
|
||||||
ID_TB_OPTIONS_SHOW_PADS_SKETCH,
|
|
||||||
ID_TB_OPTIONS_SHOW_VIAS_SKETCH,
|
ID_TB_OPTIONS_SHOW_VIAS_SKETCH,
|
||||||
ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
|
ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
|
||||||
ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
|
ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
|
||||||
|
|
|
@ -78,11 +78,8 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_DRAWSEGMENT:
|
case TYPE_DRAWSEGMENT:
|
||||||
if( m_ID_current_state == 0 )
|
Place_DrawItem( (DRAWSEGMENT*) DrawStruct, aDC );
|
||||||
{
|
exit = true;
|
||||||
Place_DrawItem( (DRAWSEGMENT*) DrawStruct, aDC );
|
|
||||||
exit = true;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_DIMENSION:
|
case TYPE_DIMENSION:
|
||||||
|
|
Loading…
Reference in New Issue