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 )
}
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 ),
m_stream( aStream )
{
source = aSource;
}
......
......@@ -25,7 +25,7 @@
* @file autosel.cpp
*/
/* Routines for automatic selection of modules. */
// Routines for automatic selection of modules.
#include <fctsys.h>
#include <common.h>
......@@ -42,6 +42,9 @@
#define QUOTE '\''
#define FMT_TITLE_LIB_LOAD_ERROR _( "Library Load Error" )
class FOOTPRINT_ALIAS
{
public:
......@@ -93,7 +96,7 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
if( m_netlist.IsEmpty() )
return;
/* Find equivalents in all available files. */
// Find equivalents in all available files.
for( ii = 0; ii < m_AliasLibNames.GetCount(); ii++ )
{
fn = m_AliasLibNames[ii];
......@@ -107,6 +110,7 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
{
fn.SetExt( fn.GetExt() + wxT( "." ) + FootprintAliasFileExtension );
}
tmp = search.FindValidPath( fn.GetFullPath() );
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 "
"default search paths." ),
GetChars( fn.GetFullName() ) );
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR );
wxMessageBox( msg, FMT_TITLE_LIB_LOAD_ERROR, wxOK | wxICON_ERROR );
continue;
}
......@@ -122,8 +126,8 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
if( file == NULL )
{
msg.Printf( _( "Error opening alias library <%s>." ), GetChars( tmp ) );
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR );
msg.Printf( _( "Error opening alias library '%s'." ), GetChars( tmp ) );
wxMessageBox( msg, FMT_TITLE_LIB_LOAD_ERROR, wxOK | wxICON_ERROR );
continue;
}
......@@ -153,7 +157,7 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
fclose( file );
}
/* Display the number of footprint aliases. */
// Display the number of footprint aliases.
msg.Printf( _( "%d footprint aliases found." ), aliases.size() );
SetStatusText( msg, 0 );
......@@ -165,7 +169,7 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
component = m_netlist.GetComponent( kk );
bool found = false;
m_ListCmp->SetSelection( ii++, true );
m_compListBox->SetSelection( ii++, true );
if( !component->GetFPID().empty() )
continue;
......@@ -176,8 +180,8 @@ void CVPCB_MAINFRAME::AssocieModule( wxCommandEvent& event )
if( alias.m_Name.CmpNoCase( component->GetValue() ) != 0 )
continue;
/* filter alias so one can use multiple aliases (for polar and nonpolar caps for
* example) */
// filter alias so one can use multiple aliases (for polar and
// nonpolar caps for example)
const FOOTPRINT_INFO *module = m_footprints.GetModuleInfo( alias.m_FootprintName );
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() )
{
/* we do not need to analyse wildcards: single footprint do not contain them */
/* and if there are wildcards it just will not match any */
// we do not need to analyse wildcards: single footprint do not
// contain them and if there are wildcards it just will not match any
const FOOTPRINT_INFO* module = m_footprints.GetModuleInfo( component->GetFootprintFilters()[0] );
if( module )
......
......@@ -481,7 +481,7 @@ void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
CVPCB_MAINFRAME* parentframe = (CVPCB_MAINFRAME *) GetParent();
wxString footprintName = parentframe->m_FootprintList->GetSelectedFootprint();
wxString footprintName = parentframe->m_footprintListBox->GetSelectedFootprint();
if( !footprintName.IsEmpty() )
{
......
This diff is collapsed.
......@@ -56,8 +56,6 @@ const wxString FootprintAliasFileExtension( wxT( "equ" ) );
// Wildcard for schematic retroannotation (import footprint names in schematic):
const wxString FootprintAliasFileWildcard( _( "KiCad footprint alias files (*.equ)|*.equ" ) );
const wxString titleLibLoadError( _( "Library Load Error" ) );
#if 0 // add this logic to OpenProjectFiles()
......
......@@ -21,6 +21,5 @@ extern const wxString RetroFileExtension;
extern const wxString FootprintAliasFileWildcard;
extern const wxString titleLibLoadError;
#endif /* __CVPCB_H__ */
......@@ -60,9 +60,9 @@ class CVPCB_MAINFRAME : public KIWAY_PLAYER
public:
bool m_KeepCvpcbOpen;
FOOTPRINTS_LISTBOX* m_FootprintList;
LIBRARY_LISTBOX* m_LibraryList;
COMPONENTS_LISTBOX* m_ListCmp;
FOOTPRINTS_LISTBOX* m_footprintListBox;
LIBRARY_LISTBOX* m_libListBox;
COMPONENTS_LISTBOX* m_compListBox;
wxAuiToolBar* m_mainToolBar;
wxFileName m_NetlistFileName;
wxArrayString m_ModuleLibNames;
......
......@@ -49,23 +49,22 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
COMPONENT* component;
bool hasFootprint = false;
int componentIndex;
wxString description;
if( m_netlist.IsEmpty() )
return;
// If no component is selected, select the first one
if( m_ListCmp->GetFirstSelected() < 0 )
if( m_compListBox->GetFirstSelected() < 0 )
{
componentIndex = 0;
m_ListCmp->SetSelection( componentIndex, true );
m_compListBox->SetSelection( componentIndex, true );
}
// iterate over the selection
while( m_ListCmp->GetFirstSelected() != -1 )
while( m_compListBox->GetFirstSelected() != -1 )
{
// Get the component for the current iteration
componentIndex = m_ListCmp->GetFirstSelected();
componentIndex = m_compListBox->GetFirstSelected();
component = m_netlist.GetComponent( componentIndex );
if( component == NULL )
......@@ -86,7 +85,7 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
component->SetFPID( fpid );
// create the new component description
description.Printf( CMP_FORMAT, componentIndex + 1,
wxString description = wxString::Format( CMP_FORMAT, componentIndex + 1,
GetChars( component->GetReference() ),
GetChars( component->GetValue() ),
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
m_ListCmp->SetString( componentIndex, description );
m_ListCmp->SetSelection( componentIndex, false );
m_compListBox->SetString( componentIndex, description );
m_compListBox->SetSelection( componentIndex, false );
}
// Mark this "session" as modified
m_modified = true;
// select the next component, if there is one
if( componentIndex < (m_ListCmp->GetCount() - 1) )
if( componentIndex < (m_compListBox->GetCount() - 1) )
componentIndex++;
m_ListCmp->SetSelection( componentIndex, true );
m_compListBox->SetSelection( componentIndex, true );
// update the statusbar
DisplayStatus();
......@@ -166,7 +165,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
ReadSchematicNetlist();
if( m_ListCmp == NULL )
if( m_compListBox == NULL )
return false;
LoadProjectFile( m_NetlistFileName.GetFullPath() );
......@@ -175,7 +174,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
BuildFOOTPRINTS_LISTBOX();
BuildLIBRARY_LISTBOX();
m_ListCmp->Clear();
m_compListBox->Clear();
m_undefinedComponentCnt = 0;
if( m_netlist.AnyFootprintsLinked() )
......@@ -295,12 +294,12 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
{
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->GetValue() ),
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
m_ListCmp->AppendLine( msg );
m_compListBox->AppendLine( msg );
if( component->GetFPID().empty() )
{
......@@ -310,7 +309,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
}
if( !m_netlist.IsEmpty() )
m_ListCmp->SetSelection( 0, true );
m_compListBox->SetSelection( 0, true );
DisplayStatus();
......
......@@ -155,7 +155,6 @@ protected:
return false;
}
#endif
public:
......
......@@ -432,8 +432,9 @@ public:
* Constructor WXINPUTSTREAM_LINE_READER
*
* @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
};
......
......@@ -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,
if( zis.OpenEntry( *entry ) )
{
INPUTSTREAM_LINE_READER reader( &zis );
INPUTSTREAM_LINE_READER reader( &zis, aLibraryPath );
#if 1
// I am a PCB_IO derivative with my own PCB_PARSER
m_parser->SetLineReader( &reader ); // ownership not passed
......
......@@ -79,14 +79,15 @@ void PCB_PARSER::init()
m_layerMasks[ "*.Fab" ] = LSET( 2, B_Fab, F_Fab );
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
// sequence reversed from the In1_Cu-In30_Cu version 2 pretty numbering scheme.
// Version 2 brought in an additional 16 Cu layers and flipped the cu stack but
// This is for the first pretty & *.kicad_pcb formats, which had
// Inner1_Cu - Inner14_Cu with the numbering sequence
// 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.
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 ) );
}
......@@ -867,9 +868,14 @@ T PCB_PARSER::lookUpLayer( const M& aMap ) throw( PARSE_ERROR, IO_ERROR )
}
#endif
wxString error = wxString::Format(
_( "Layer '%s' in file <%s> at line %d, position %d, was not defined in the layers section" ),
GetChars( FROM_UTF8( CurText() ) ), GetChars( CurSource() ),
wxString error = wxString::Format( _(
"Layer '%s' in file\n"
"'%s'\n"
"at line %d, position %d\n"
"was not defined in the layers section"
),
GetChars( FROM_UTF8( CurText() ) ),
GetChars( CurSource() ),
CurLineNumber(), CurOffset() );
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