fix Inner1.Cu in pcb_parser.cpp, start cvpcb work.

This commit is contained in:
Dick Hollenbeck 2014-07-05 15:42:59 -05:00
parent e2e4fc4830
commit 611592029f
14 changed files with 125 additions and 118 deletions

View File

@ -315,10 +315,11 @@ char* STRING_LINE_READER::ReadLine() throw( IO_ERROR )
} }
INPUTSTREAM_LINE_READER::INPUTSTREAM_LINE_READER( wxInputStream* aStream ) : INPUTSTREAM_LINE_READER::INPUTSTREAM_LINE_READER( wxInputStream* aStream, const wxString& aSource ) :
LINE_READER( LINE_READER_LINE_DEFAULT_MAX ), LINE_READER( LINE_READER_LINE_DEFAULT_MAX ),
m_stream( aStream ) m_stream( aStream )
{ {
source = aSource;
} }

View File

@ -25,7 +25,7 @@
* @file autosel.cpp * @file autosel.cpp
*/ */
/* Routines for automatic selection of modules. */ // Routines for automatic selection of modules.
#include <fctsys.h> #include <fctsys.h>
#include <common.h> #include <common.h>
@ -42,6 +42,9 @@
#define QUOTE '\'' #define QUOTE '\''
#define FMT_TITLE_LIB_LOAD_ERROR _( "Library Load Error" )
class FOOTPRINT_ALIAS class FOOTPRINT_ALIAS
{ {
public: public:
@ -93,7 +96,7 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
if( m_netlist.IsEmpty() ) if( m_netlist.IsEmpty() )
return; return;
/* Find equivalents in all available files. */ // Find equivalents in all available files.
for( ii = 0; ii < m_AliasLibNames.GetCount(); ii++ ) for( ii = 0; ii < m_AliasLibNames.GetCount(); ii++ )
{ {
fn = m_AliasLibNames[ii]; fn = m_AliasLibNames[ii];
@ -107,6 +110,7 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
{ {
fn.SetExt( fn.GetExt() + wxT( "." ) + FootprintAliasFileExtension ); fn.SetExt( fn.GetExt() + wxT( "." ) + FootprintAliasFileExtension );
} }
tmp = search.FindValidPath( fn.GetFullPath() ); tmp = search.FindValidPath( fn.GetFullPath() );
if( !tmp ) if( !tmp )
@ -114,7 +118,7 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
msg.Printf( _( "Footprint alias library file '%s' could not be found in the " msg.Printf( _( "Footprint alias library file '%s' could not be found in the "
"default search paths." ), "default search paths." ),
GetChars( fn.GetFullName() ) ); GetChars( fn.GetFullName() ) );
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR ); wxMessageBox( msg, FMT_TITLE_LIB_LOAD_ERROR, wxOK | wxICON_ERROR );
continue; continue;
} }
@ -122,8 +126,8 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
if( file == NULL ) if( file == NULL )
{ {
msg.Printf( _( "Error opening alias library <%s>." ), GetChars( tmp ) ); msg.Printf( _( "Error opening alias library '%s'." ), GetChars( tmp ) );
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR ); wxMessageBox( msg, FMT_TITLE_LIB_LOAD_ERROR, wxOK | wxICON_ERROR );
continue; continue;
} }
@ -153,7 +157,7 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
fclose( file ); fclose( file );
} }
/* Display the number of footprint aliases. */ // Display the number of footprint aliases.
msg.Printf( _( "%d footprint aliases found." ), aliases.size() ); msg.Printf( _( "%d footprint aliases found." ), aliases.size() );
SetStatusText( msg, 0 ); SetStatusText( msg, 0 );
@ -165,7 +169,7 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
component = m_netlist.GetComponent( kk ); component = m_netlist.GetComponent( kk );
bool found = false; bool found = false;
m_ListCmp->SetSelection( ii++, true ); m_compListBox->SetSelection( ii++, true );
if( !component->GetFPID().empty() ) if( !component->GetFPID().empty() )
continue; continue;
@ -176,8 +180,8 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
if( alias.m_Name.CmpNoCase( component->GetValue() ) != 0 ) if( alias.m_Name.CmpNoCase( component->GetValue() ) != 0 )
continue; continue;
/* filter alias so one can use multiple aliases (for polar and nonpolar caps for // filter alias so one can use multiple aliases (for polar and
* example) */ // nonpolar caps for example)
const FOOTPRINT_INFO *module = m_footprints.GetModuleInfo( alias.m_FootprintName ); const FOOTPRINT_INFO *module = m_footprints.GetModuleInfo( alias.m_FootprintName );
if( module ) if( module )
@ -207,11 +211,11 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
} }
/* obviously the last chance: there's only one filter matching one footprint */ // obviously the last chance: there's only one filter matching one footprint
if( !found && 1 == component->GetFootprintFilters().GetCount() ) if( !found && 1 == component->GetFootprintFilters().GetCount() )
{ {
/* we do not need to analyse wildcards: single footprint do not contain them */ // we do not need to analyse wildcards: single footprint do not
/* and if there are wildcards it just will not match any */ // contain them and if there are wildcards it just will not match any
const FOOTPRINT_INFO* module = m_footprints.GetModuleInfo( component->GetFootprintFilters()[0] ); const FOOTPRINT_INFO* module = m_footprints.GetModuleInfo( component->GetFootprintFilters()[0] );
if( module ) if( module )

View File

@ -481,7 +481,7 @@ void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
CVPCB_MAINFRAME* parentframe = (CVPCB_MAINFRAME *) GetParent(); CVPCB_MAINFRAME* parentframe = (CVPCB_MAINFRAME *) GetParent();
wxString footprintName = parentframe->m_FootprintList->GetSelectedFootprint(); wxString footprintName = parentframe->m_footprintListBox->GetSelectedFootprint();
if( !footprintName.IsEmpty() ) if( !footprintName.IsEmpty() )
{ {

View File

@ -108,9 +108,9 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, CVPCB_MAINFRAME_NAME ) wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, CVPCB_MAINFRAME_NAME )
{ {
m_FrameName = CVPCB_MAINFRAME_NAME; m_FrameName = CVPCB_MAINFRAME_NAME;
m_ListCmp = NULL; m_compListBox = NULL;
m_FootprintList = NULL; m_footprintListBox = NULL;
m_LibraryList = NULL; m_libListBox = NULL;
m_mainToolBar = NULL; m_mainToolBar = NULL;
m_modified = false; m_modified = false;
m_isEESchemaNetlist = false; m_isEESchemaNetlist = false;
@ -175,18 +175,18 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_auimgr.AddPane( m_mainToolBar, m_auimgr.AddPane( m_mainToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top() ); wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top() );
if( m_ListCmp ) if( m_compListBox )
m_auimgr.AddPane( m_ListCmp, m_auimgr.AddPane( m_compListBox,
wxAuiPaneInfo( horiz ).Name( wxT( "m_ListCmp" ) ).CentrePane() ); wxAuiPaneInfo( horiz ).Name( wxT( "m_compListBox" ) ).CentrePane() );
if( m_LibraryList) if( m_libListBox)
m_auimgr.AddPane( m_LibraryList, m_auimgr.AddPane( m_libListBox,
wxAuiPaneInfo( info ).Name( wxT( "m_LibraryList" ) ). wxAuiPaneInfo( info ).Name( wxT( "m_libListBox" ) ).
Left().BestSize( (int) ( m_FrameSize.x * 0.20 ), m_FrameSize.y ) ); Left().BestSize( (int) ( m_FrameSize.x * 0.20 ), m_FrameSize.y ) );
if( m_FootprintList ) if( m_footprintListBox )
m_auimgr.AddPane( m_FootprintList, m_auimgr.AddPane( m_footprintListBox,
wxAuiPaneInfo( info ).Name( wxT( "m_FootprintList" ) ). wxAuiPaneInfo( info ).Name( wxT( "m_footprintListBox" ) ).
Right().BestSize( (int) ( m_FrameSize.x * 0.30 ), m_FrameSize.y ) ); Right().BestSize( (int) ( m_FrameSize.x * 0.30 ), m_FrameSize.y ) );
m_auimgr.Update(); m_auimgr.Update();
@ -302,21 +302,21 @@ void CVPCB_MAINFRAME::ChangeFocus( bool aMoveRight )
if( aMoveRight ) if( aMoveRight )
{ {
if( hasFocus == m_LibraryList ) if( hasFocus == m_libListBox )
m_ListCmp->SetFocus(); m_compListBox->SetFocus();
else if( hasFocus == m_ListCmp ) else if( hasFocus == m_compListBox )
m_FootprintList->SetFocus(); m_footprintListBox->SetFocus();
else if( hasFocus == m_FootprintList ) else if( hasFocus == m_footprintListBox )
m_LibraryList->SetFocus(); m_libListBox->SetFocus();
} }
else else
{ {
if( hasFocus == m_LibraryList ) if( hasFocus == m_libListBox )
m_FootprintList->SetFocus(); m_footprintListBox->SetFocus();
else if( hasFocus == m_ListCmp ) else if( hasFocus == m_compListBox )
m_LibraryList->SetFocus(); m_libListBox->SetFocus();
else if( hasFocus == m_FootprintList ) else if( hasFocus == m_footprintListBox )
m_ListCmp->SetFocus(); m_compListBox->SetFocus();
} }
} }
@ -326,7 +326,7 @@ void CVPCB_MAINFRAME::ToFirstNA( wxCommandEvent& event )
if( m_netlist.IsEmpty() ) if( m_netlist.IsEmpty() )
return; return;
long selection = m_ListCmp->GetFirstSelected(); long selection = m_compListBox->GetFirstSelected();
if( selection < 0 ) if( selection < 0 )
selection = -1; // We will start to 0 for the first search , if no item selected selection = -1; // We will start to 0 for the first search , if no item selected
@ -335,8 +335,8 @@ void CVPCB_MAINFRAME::ToFirstNA( wxCommandEvent& event )
{ {
if( m_netlist.GetComponent( jj )->GetFPID().empty() ) if( m_netlist.GetComponent( jj )->GetFPID().empty() )
{ {
m_ListCmp->SetSelection( wxNOT_FOUND, false ); // Remove all selections m_compListBox->SetSelection( wxNOT_FOUND, false ); // Remove all selections
m_ListCmp->SetSelection( jj ); m_compListBox->SetSelection( jj );
SendMessageToEESCHEMA(); SendMessageToEESCHEMA();
return; return;
} }
@ -349,20 +349,20 @@ void CVPCB_MAINFRAME::ToPreviousNA( wxCommandEvent& event )
if( m_netlist.IsEmpty() ) if( m_netlist.IsEmpty() )
return; return;
int selection = m_ListCmp->GetFirstSelected(); int selection = m_compListBox->GetFirstSelected();
if( selection < 0 ) if( selection < 0 )
selection = m_ListCmp->GetCount(); selection = m_compListBox->GetCount();
else else
while( m_ListCmp->GetNextSelected( selection ) >= 0 ) while( m_compListBox->GetNextSelected( selection ) >= 0 )
selection = m_ListCmp->GetNextSelected( selection ); selection = m_compListBox->GetNextSelected( selection );
for( int kk = selection-1; kk >= 0; kk-- ) for( int kk = selection-1; kk >= 0; kk-- )
{ {
if( m_netlist.GetComponent( kk )->GetFPID().empty() ) if( m_netlist.GetComponent( kk )->GetFPID().empty() )
{ {
m_ListCmp->SetSelection( wxNOT_FOUND, false ); // Remove all selections m_compListBox->SetSelection( wxNOT_FOUND, false ); // Remove all selections
m_ListCmp->SetSelection( kk ); m_compListBox->SetSelection( kk );
SendMessageToEESCHEMA(); SendMessageToEESCHEMA();
return; return;
} }
@ -392,7 +392,7 @@ void CVPCB_MAINFRAME::DelAssociations( wxCommandEvent& event )
if( IsOK( this, _( "Delete selections" ) ) ) if( IsOK( this, _( "Delete selections" ) ) )
{ {
m_skipComponentSelect = true; m_skipComponentSelect = true;
m_ListCmp->SetSelection( 0 ); m_compListBox->SetSelection( 0 );
for( unsigned i = 0; i < m_netlist.GetCount(); i++ ) for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
{ {
@ -403,7 +403,7 @@ void CVPCB_MAINFRAME::DelAssociations( wxCommandEvent& event )
} }
m_skipComponentSelect = false; m_skipComponentSelect = false;
m_ListCmp->SetSelection( 0 ); m_compListBox->SetSelection( 0 );
m_undefinedComponentCnt = m_netlist.GetCount(); m_undefinedComponentCnt = m_netlist.GetCount();
} }
@ -562,8 +562,8 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
filter |= FOOTPRINTS_LISTBOX::BY_LIBRARY; filter |= FOOTPRINTS_LISTBOX::BY_LIBRARY;
component = GetSelectedComponent(); component = GetSelectedComponent();
libraryName = m_LibraryList->GetSelectedLibrary(); libraryName = m_libListBox->GetSelectedLibrary();
m_FootprintList->SetFootprints( m_footprints, libraryName, component, filter ); m_footprintListBox->SetFootprints( m_footprints, libraryName, component, filter );
// Tell AuiMgr that objects are changed ! // Tell AuiMgr that objects are changed !
if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized
@ -578,23 +578,23 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
// but only if the selection is made from the component list or the library list. // but only if the selection is made from the component list or the library list.
// If the selection is made from the footprint list, do not change the current // If the selection is made from the footprint list, do not change the current
// selected footprint. // selected footprint.
if( FindFocus() == m_ListCmp || FindFocus() == m_LibraryList ) if( FindFocus() == m_compListBox || FindFocus() == m_libListBox )
{ {
wxString module = FROM_UTF8( component->GetFPID().Format().c_str() ); wxString module = FROM_UTF8( component->GetFPID().Format().c_str() );
bool found = false; bool found = false;
for( int ii = 0; ii < m_FootprintList->GetCount(); ii++ ) for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ )
{ {
wxString footprintName; wxString footprintName;
wxString msg = m_FootprintList->OnGetItemText( ii, 0 ); wxString msg = m_footprintListBox->OnGetItemText( ii, 0 );
msg.Trim( true ); msg.Trim( true );
msg.Trim( false ); msg.Trim( false );
footprintName = msg.AfterFirst( wxChar( ' ' ) ); footprintName = msg.AfterFirst( wxChar( ' ' ) );
if( module.Cmp( footprintName ) == 0 ) if( module.Cmp( footprintName ) == 0 )
{ {
m_FootprintList->SetSelection( ii, true ); m_footprintListBox->SetSelection( ii, true );
found = true; found = true;
break; break;
} }
@ -602,10 +602,10 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
if( !found ) if( !found )
{ {
int ii = m_FootprintList->GetSelection(); int ii = m_footprintListBox->GetSelection();
if ( ii >= 0 ) if ( ii >= 0 )
m_FootprintList->SetSelection( ii, false ); m_footprintListBox->SetSelection( ii, false );
if( GetFpViewerFrame() ) if( GetFpViewerFrame() )
{ {
@ -638,7 +638,7 @@ void CVPCB_MAINFRAME::DisplayStatus()
wxString msg; wxString msg;
COMPONENT* component; COMPONENT* component;
if( wxWindow::FindFocus() == m_ListCmp || wxWindow::FindFocus() == m_LibraryList ) if( wxWindow::FindFocus() == m_compListBox || wxWindow::FindFocus() == m_libListBox )
{ {
msg.Printf( _( "Components: %d, unassigned: %d" ), (int) m_netlist.GetCount(), msg.Printf( _( "Components: %d, unassigned: %d" ), (int) m_netlist.GetCount(),
m_undefinedComponentCnt ); m_undefinedComponentCnt );
@ -665,7 +665,7 @@ void CVPCB_MAINFRAME::DisplayStatus()
} }
else else
{ {
wxString footprintName = m_FootprintList->GetSelectedFootprint(); wxString footprintName = m_footprintListBox->GetSelectedFootprint();
FOOTPRINT_INFO* module = m_footprints.GetModuleInfo( footprintName ); FOOTPRINT_INFO* module = m_footprints.GetModuleInfo( footprintName );
@ -681,7 +681,7 @@ void CVPCB_MAINFRAME::DisplayStatus()
msg.Empty(); msg.Empty();
if( m_FootprintList ) if( m_footprintListBox )
{ {
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) ) if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) )
msg = _( "key words" ); msg = _( "key words" );
@ -707,7 +707,7 @@ void CVPCB_MAINFRAME::DisplayStatus()
else else
msg = _( "Filtered by " ) + msg; msg = _( "Filtered by " ) + msg;
msg << wxT( ": " ) << m_FootprintList->GetCount(); msg << wxT( ": " ) << m_footprintListBox->GetCount();
SetStatusText( msg, 2 ); SetStatusText( msg, 2 );
} }
@ -762,7 +762,7 @@ void CVPCB_MAINFRAME::SendMessageToEESCHEMA()
if( m_netlist.IsEmpty() ) if( m_netlist.IsEmpty() )
return; return;
int selection = m_ListCmp->GetSelection(); int selection = m_compListBox->GetSelection();
if ( selection < 0 ) if ( selection < 0 )
selection = 0; selection = 0;
@ -914,17 +914,17 @@ void CVPCB_MAINFRAME::BuildFOOTPRINTS_LISTBOX()
{ {
wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
if( m_FootprintList == NULL ) if( m_footprintListBox == NULL )
{ {
m_FootprintList = new FOOTPRINTS_LISTBOX( this, ID_CVPCB_FOOTPRINT_LIST, m_footprintListBox = new FOOTPRINTS_LISTBOX( this, ID_CVPCB_FOOTPRINT_LIST,
wxDefaultPosition, wxDefaultSize ); wxDefaultPosition, wxDefaultSize );
m_FootprintList->SetFont( wxFont( guiFont.GetPointSize(), m_footprintListBox->SetFont( wxFont( guiFont.GetPointSize(),
wxFONTFAMILY_MODERN, wxFONTFAMILY_MODERN,
wxFONTSTYLE_NORMAL, wxFONTSTYLE_NORMAL,
wxFONTWEIGHT_NORMAL ) ); wxFONTWEIGHT_NORMAL ) );
} }
m_FootprintList->SetFootprints( m_footprints, wxEmptyString, NULL, m_footprintListBox->SetFootprints( m_footprints, wxEmptyString, NULL,
FOOTPRINTS_LISTBOX::UNFILTERED ); FOOTPRINTS_LISTBOX::UNFILTERED );
DisplayStatus(); DisplayStatus();
} }
@ -936,34 +936,34 @@ void CVPCB_MAINFRAME::BuildCmpListBox()
COMPONENT* component; COMPONENT* component;
wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
if( m_ListCmp == NULL ) if( m_compListBox == NULL )
{ {
m_ListCmp = new COMPONENTS_LISTBOX( this, ID_CVPCB_COMPONENT_LIST, m_compListBox = new COMPONENTS_LISTBOX( this, ID_CVPCB_COMPONENT_LIST,
wxDefaultPosition, wxDefaultSize ); wxDefaultPosition, wxDefaultSize );
m_ListCmp->SetFont( wxFont( guiFont.GetPointSize(), m_compListBox->SetFont( wxFont( guiFont.GetPointSize(),
wxFONTFAMILY_MODERN, wxFONTFAMILY_MODERN,
wxFONTSTYLE_NORMAL, wxFONTSTYLE_NORMAL,
wxFONTWEIGHT_NORMAL ) ); wxFONTWEIGHT_NORMAL ) );
} }
m_ListCmp->m_ComponentList.Clear(); m_compListBox->m_ComponentList.Clear();
for( unsigned i = 0; i < m_netlist.GetCount(); i++ ) for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
{ {
component = m_netlist.GetComponent( i ); component = m_netlist.GetComponent( i );
msg.Printf( CMP_FORMAT, m_ListCmp->GetCount() + 1, msg.Printf( CMP_FORMAT, m_compListBox->GetCount() + 1,
GetChars( component->GetReference() ), GetChars( component->GetReference() ),
GetChars( component->GetValue() ), GetChars( component->GetValue() ),
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) ); GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
m_ListCmp->m_ComponentList.Add( msg ); m_compListBox->m_ComponentList.Add( msg );
} }
if( m_ListCmp->m_ComponentList.Count() ) if( m_compListBox->m_ComponentList.Count() )
{ {
m_ListCmp->SetItemCount( m_ListCmp->m_ComponentList.Count() ); m_compListBox->SetItemCount( m_compListBox->m_ComponentList.Count() );
m_ListCmp->SetSelection( 0, true ); m_compListBox->SetSelection( 0, true );
m_ListCmp->RefreshItems( 0L, m_ListCmp->m_ComponentList.Count()-1 ); m_compListBox->RefreshItems( 0L, m_compListBox->m_ComponentList.Count()-1 );
#if defined (__WXGTK__ ) #if defined (__WXGTK__ )
// @bug On GTK and wxWidgets 2.8.x, this will assert in debug builds because the // @bug On GTK and wxWidgets 2.8.x, this will assert in debug builds because the
@ -971,9 +971,9 @@ void CVPCB_MAINFRAME::BuildCmpListBox()
// ellipsizing long strings down to a few characters. It still doesn't set // ellipsizing long strings down to a few characters. It still doesn't set
// the scroll bars correctly (too short) but it's better than any of the // the scroll bars correctly (too short) but it's better than any of the
// other alternatives. If someone knows how to fix this, please do. // other alternatives. If someone knows how to fix this, please do.
m_ListCmp->SetColumnWidth( -1, wxLIST_AUTOSIZE ); m_compListBox->SetColumnWidth( -1, wxLIST_AUTOSIZE );
#else #else
m_ListCmp->SetColumnWidth( 0, wxLIST_AUTOSIZE ); m_compListBox->SetColumnWidth( 0, wxLIST_AUTOSIZE );
#endif #endif
} }
} }
@ -983,11 +983,11 @@ void CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX()
{ {
wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
if( m_LibraryList == NULL ) if( m_libListBox == NULL )
{ {
m_LibraryList = new LIBRARY_LISTBOX( this, ID_CVPCB_LIBRARY_LIST, m_libListBox = new LIBRARY_LISTBOX( this, ID_CVPCB_LIBRARY_LIST,
wxDefaultPosition, wxDefaultSize ); wxDefaultPosition, wxDefaultSize );
m_LibraryList->SetFont( wxFont( guiFont.GetPointSize(), m_libListBox->SetFont( wxFont( guiFont.GetPointSize(),
wxFONTFAMILY_MODERN, wxFONTFAMILY_MODERN,
wxFONTSTYLE_NORMAL, wxFONTSTYLE_NORMAL,
wxFONTWEIGHT_NORMAL ) ); wxFONTWEIGHT_NORMAL ) );
@ -1004,14 +1004,14 @@ void CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX()
for( unsigned ii = 0; ii < libNickNames.size(); ii++ ) for( unsigned ii = 0; ii < libNickNames.size(); ii++ )
libNames.Add( libNickNames[ii] ); libNames.Add( libNickNames[ii] );
m_LibraryList->SetLibraryList( libNames ); m_libListBox->SetLibraryList( libNames );
} }
} }
COMPONENT* CVPCB_MAINFRAME::GetSelectedComponent() COMPONENT* CVPCB_MAINFRAME::GetSelectedComponent()
{ {
int selection = m_ListCmp->GetSelection(); int selection = m_compListBox->GetSelection();
if( selection >= 0 && selection < (int) m_netlist.GetCount() ) if( selection >= 0 && selection < (int) m_netlist.GetCount() )
return m_netlist.GetComponent( selection ); return m_netlist.GetComponent( selection );

View File

@ -56,8 +56,6 @@ const wxString FootprintAliasFileExtension( wxT( "equ" ) );
// Wildcard for schematic retroannotation (import footprint names in schematic): // Wildcard for schematic retroannotation (import footprint names in schematic):
const wxString FootprintAliasFileWildcard( _( "KiCad footprint alias files (*.equ)|*.equ" ) ); const wxString FootprintAliasFileWildcard( _( "KiCad footprint alias files (*.equ)|*.equ" ) );
const wxString titleLibLoadError( _( "Library Load Error" ) );
#if 0 // add this logic to OpenProjectFiles() #if 0 // add this logic to OpenProjectFiles()

View File

@ -21,6 +21,5 @@ extern const wxString RetroFileExtension;
extern const wxString FootprintAliasFileWildcard; extern const wxString FootprintAliasFileWildcard;
extern const wxString titleLibLoadError;
#endif /* __CVPCB_H__ */ #endif /* __CVPCB_H__ */

View File

@ -60,9 +60,9 @@ class CVPCB_MAINFRAME : public KIWAY_PLAYER
public: public:
bool m_KeepCvpcbOpen; bool m_KeepCvpcbOpen;
FOOTPRINTS_LISTBOX* m_FootprintList; FOOTPRINTS_LISTBOX* m_footprintListBox;
LIBRARY_LISTBOX* m_LibraryList; LIBRARY_LISTBOX* m_libListBox;
COMPONENTS_LISTBOX* m_ListCmp; COMPONENTS_LISTBOX* m_compListBox;
wxAuiToolBar* m_mainToolBar; wxAuiToolBar* m_mainToolBar;
wxFileName m_NetlistFileName; wxFileName m_NetlistFileName;
wxArrayString m_ModuleLibNames; wxArrayString m_ModuleLibNames;

View File

@ -49,23 +49,22 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
COMPONENT* component; COMPONENT* component;
bool hasFootprint = false; bool hasFootprint = false;
int componentIndex; int componentIndex;
wxString description;
if( m_netlist.IsEmpty() ) if( m_netlist.IsEmpty() )
return; return;
// If no component is selected, select the first one // If no component is selected, select the first one
if( m_ListCmp->GetFirstSelected() < 0 ) if( m_compListBox->GetFirstSelected() < 0 )
{ {
componentIndex = 0; componentIndex = 0;
m_ListCmp->SetSelection( componentIndex, true ); m_compListBox->SetSelection( componentIndex, true );
} }
// iterate over the selection // iterate over the selection
while( m_ListCmp->GetFirstSelected() != -1 ) while( m_compListBox->GetFirstSelected() != -1 )
{ {
// Get the component for the current iteration // Get the component for the current iteration
componentIndex = m_ListCmp->GetFirstSelected(); componentIndex = m_compListBox->GetFirstSelected();
component = m_netlist.GetComponent( componentIndex ); component = m_netlist.GetComponent( componentIndex );
if( component == NULL ) if( component == NULL )
@ -86,7 +85,7 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
component->SetFPID( fpid ); component->SetFPID( fpid );
// create the new component description // create the new component description
description.Printf( CMP_FORMAT, componentIndex + 1, wxString description = wxString::Format( CMP_FORMAT, componentIndex + 1,
GetChars( component->GetReference() ), GetChars( component->GetReference() ),
GetChars( component->GetValue() ), GetChars( component->GetValue() ),
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) ); GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
@ -101,18 +100,18 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
} }
// Set the new description and deselect the processed component // Set the new description and deselect the processed component
m_ListCmp->SetString( componentIndex, description ); m_compListBox->SetString( componentIndex, description );
m_ListCmp->SetSelection( componentIndex, false ); m_compListBox->SetSelection( componentIndex, false );
} }
// Mark this "session" as modified // Mark this "session" as modified
m_modified = true; m_modified = true;
// select the next component, if there is one // select the next component, if there is one
if( componentIndex < (m_ListCmp->GetCount() - 1) ) if( componentIndex < (m_compListBox->GetCount() - 1) )
componentIndex++; componentIndex++;
m_ListCmp->SetSelection( componentIndex, true ); m_compListBox->SetSelection( componentIndex, true );
// update the statusbar // update the statusbar
DisplayStatus(); DisplayStatus();
@ -166,7 +165,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
ReadSchematicNetlist(); ReadSchematicNetlist();
if( m_ListCmp == NULL ) if( m_compListBox == NULL )
return false; return false;
LoadProjectFile( m_NetlistFileName.GetFullPath() ); LoadProjectFile( m_NetlistFileName.GetFullPath() );
@ -175,7 +174,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
BuildFOOTPRINTS_LISTBOX(); BuildFOOTPRINTS_LISTBOX();
BuildLIBRARY_LISTBOX(); BuildLIBRARY_LISTBOX();
m_ListCmp->Clear(); m_compListBox->Clear();
m_undefinedComponentCnt = 0; m_undefinedComponentCnt = 0;
if( m_netlist.AnyFootprintsLinked() ) if( m_netlist.AnyFootprintsLinked() )
@ -295,12 +294,12 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
{ {
COMPONENT* component = m_netlist.GetComponent( i ); COMPONENT* component = m_netlist.GetComponent( i );
msg.Printf( CMP_FORMAT, m_ListCmp->GetCount() + 1, msg.Printf( CMP_FORMAT, m_compListBox->GetCount() + 1,
GetChars( component->GetReference() ), GetChars( component->GetReference() ),
GetChars( component->GetValue() ), GetChars( component->GetValue() ),
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) ); GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
m_ListCmp->AppendLine( msg ); m_compListBox->AppendLine( msg );
if( component->GetFPID().empty() ) if( component->GetFPID().empty() )
{ {
@ -310,7 +309,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
} }
if( !m_netlist.IsEmpty() ) if( !m_netlist.IsEmpty() )
m_ListCmp->SetSelection( 0, true ); m_compListBox->SetSelection( 0, true );
DisplayStatus(); DisplayStatus();

View File

@ -155,7 +155,6 @@ protected:
return false; return false;
} }
#endif #endif
public: public:

View File

@ -432,8 +432,9 @@ public:
* Constructor WXINPUTSTREAM_LINE_READER * Constructor WXINPUTSTREAM_LINE_READER
* *
* @param aStream A pointer to a wxInputStream object to read. * @param aStream A pointer to a wxInputStream object to read.
* @param aSource The name of the stream source, for error reporting purposes.
*/ */
INPUTSTREAM_LINE_READER( wxInputStream* aStream ); INPUTSTREAM_LINE_READER( wxInputStream* aStream, const wxString& aSource );
char* ReadLine() throw( IO_ERROR ); // see LINE_READER::ReadLine() description char* ReadLine() throw( IO_ERROR ); // see LINE_READER::ReadLine() description
}; };

View File

@ -2708,7 +2708,7 @@ LAYER_ID EAGLE_PLUGIN::kicad_layer( int aEagleLayer ) const
} }
} }
return ToLAYER_ID( kiLayer ); return LAYER_ID( kiLayer );
} }

View File

@ -221,7 +221,7 @@ MODULE* GITHUB_PLUGIN::FootprintLoad( const wxString& aLibraryPath,
if( zis.OpenEntry( *entry ) ) if( zis.OpenEntry( *entry ) )
{ {
INPUTSTREAM_LINE_READER reader( &zis ); INPUTSTREAM_LINE_READER reader( &zis, aLibraryPath );
#if 1 #if 1
// I am a PCB_IO derivative with my own PCB_PARSER // I am a PCB_IO derivative with my own PCB_PARSER
m_parser->SetLineReader( &reader ); // ownership not passed m_parser->SetLineReader( &reader ); // ownership not passed

View File

@ -79,14 +79,15 @@ void PCB_PARSER::init()
m_layerMasks[ "*.Fab" ] = LSET( 2, B_Fab, F_Fab ); m_layerMasks[ "*.Fab" ] = LSET( 2, B_Fab, F_Fab );
m_layerMasks[ "*.CrtYd" ] = LSET( 2, B_CrtYd, F_CrtYd ); m_layerMasks[ "*.CrtYd" ] = LSET( 2, B_CrtYd, F_CrtYd );
// This is for the first pretty format, which had Inner1_Cu-Inner14_Cu with the numbering // This is for the first pretty & *.kicad_pcb formats, which had
// sequence reversed from the In1_Cu-In30_Cu version 2 pretty numbering scheme. // Inner1_Cu - Inner14_Cu with the numbering sequence
// Version 2 brought in an additional 16 Cu layers and flipped the cu stack but // reversed from the subsequent format's In1_Cu - In30_Cu numbering scheme.
// The newer format brought in an additional 16 Cu layers and flipped the cu stack but
// kept the gap between one of the outside layers and the last cu internal. // kept the gap between one of the outside layers and the last cu internal.
for( int i=1; i<=14; ++i ) for( int i=1; i<=14; ++i )
{ {
std::string key = StrPrintf( "Inner%d", i ); std::string key = StrPrintf( "Inner%d.Cu", i );
m_layerMasks[ key ] = LSET( LAYER_ID( In15_Cu - i ) ); m_layerMasks[ key ] = LSET( LAYER_ID( In15_Cu - i ) );
} }
@ -867,9 +868,14 @@ T PCB_PARSER::lookUpLayer( const M& aMap ) throw( PARSE_ERROR, IO_ERROR )
} }
#endif #endif
wxString error = wxString::Format( wxString error = wxString::Format( _(
_( "Layer '%s' in file <%s> at line %d, position %d, was not defined in the layers section" ), "Layer '%s' in file\n"
GetChars( FROM_UTF8( CurText() ) ), GetChars( CurSource() ), "'%s'\n"
"at line %d, position %d\n"
"was not defined in the layers section"
),
GetChars( FROM_UTF8( CurText() ) ),
GetChars( CurSource() ),
CurLineNumber(), CurOffset() ); CurLineNumber(), CurOffset() );
THROW_IO_ERROR( error ); THROW_IO_ERROR( error );