Commit 61159202 authored by Dick Hollenbeck's avatar Dick Hollenbeck

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

parent e2e4fc48
...@@ -315,10 +315,11 @@ char* STRING_LINE_READER::ReadLine() throw( IO_ERROR ) ...@@ -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;
} }
......
...@@ -25,7 +25,7 @@ ...@@ -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 @@ ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 )
......
...@@ -481,7 +481,7 @@ void DISPLAY_FOOTPRINTS_FRAME::InitDisplay() ...@@ -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() )
{ {
......
This diff is collapsed.
...@@ -56,8 +56,6 @@ const wxString FootprintAliasFileExtension( wxT( "equ" ) ); ...@@ -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()
......
...@@ -21,6 +21,5 @@ extern const wxString RetroFileExtension; ...@@ -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__ */
...@@ -60,9 +60,9 @@ class CVPCB_MAINFRAME : public KIWAY_PLAYER ...@@ -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;
......
...@@ -49,23 +49,22 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName ) ...@@ -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 ) ...@@ -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 ) ...@@ -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() ...@@ -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() ...@@ -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() ...@@ -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() ...@@ -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();
......
...@@ -155,7 +155,6 @@ protected: ...@@ -155,7 +155,6 @@ protected:
return false; return false;
} }
#endif #endif
public: public:
......
...@@ -432,8 +432,9 @@ public: ...@@ -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
}; };
......
...@@ -2708,7 +2708,7 @@ LAYER_ID EAGLE_PLUGIN::kicad_layer( int aEagleLayer ) const ...@@ -2708,7 +2708,7 @@ LAYER_ID EAGLE_PLUGIN::kicad_layer( int aEagleLayer ) const
} }
} }
return ToLAYER_ID( kiLayer ); return LAYER_ID( kiLayer );
} }
......
...@@ -221,7 +221,7 @@ MODULE* GITHUB_PLUGIN::FootprintLoad( const wxString& aLibraryPath, ...@@ -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
......
...@@ -79,14 +79,15 @@ void PCB_PARSER::init() ...@@ -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 ) ...@@ -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 );
......
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