From 6ccd37856d1dd8b401411939b8728328910dd6c5 Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Sat, 5 Jul 2014 15:42:59 -0500 Subject: [PATCH] fix Inner1.Cu in pcb_parser.cpp, start cvpcb work. --- common/richio.cpp | 3 +- cvpcb/autosel.cpp | 30 +++--- cvpcb/class_DisplayFootprintsFrame.cpp | 2 +- cvpcb/cvframe.cpp | 138 ++++++++++++------------- cvpcb/cvpcb.cpp | 2 - cvpcb/cvpcb.h | 1 - cvpcb/cvpcb_mainframe.h | 6 +- cvpcb/readwrite_dlgs.cpp | 29 +++--- include/dsnlexer.h | 1 - include/richio.h | 3 +- pcbnew/eagle_plugin.cpp | 2 +- pcbnew/github/github_plugin.cpp | 2 +- pcbnew/pcb_parser.cpp | 20 ++-- pcbnew/pcb_parser.h | 4 +- 14 files changed, 125 insertions(+), 118 deletions(-) diff --git a/common/richio.cpp b/common/richio.cpp index 5ce7ed2af3..ec1cf8c57d 100644 --- a/common/richio.cpp +++ b/common/richio.cpp @@ -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; } diff --git a/cvpcb/autosel.cpp b/cvpcb/autosel.cpp index 9a96a02457..bdee3e4d8b 100644 --- a/cvpcb/autosel.cpp +++ b/cvpcb/autosel.cpp @@ -25,7 +25,7 @@ * @file autosel.cpp */ -/* Routines for automatic selection of modules. */ +// Routines for automatic selection of modules. #include #include @@ -40,7 +40,10 @@ #include #include -#define QUOTE '\'' +#define QUOTE '\'' + +#define FMT_TITLE_LIB_LOAD_ERROR _( "Library Load Error" ) + class FOOTPRINT_ALIAS { @@ -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 ) diff --git a/cvpcb/class_DisplayFootprintsFrame.cpp b/cvpcb/class_DisplayFootprintsFrame.cpp index 9ccef06ec1..541c464737 100644 --- a/cvpcb/class_DisplayFootprintsFrame.cpp +++ b/cvpcb/class_DisplayFootprintsFrame.cpp @@ -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() ) { diff --git a/cvpcb/cvframe.cpp b/cvpcb/cvframe.cpp index 88b3aa688c..71c7ac7ed5 100644 --- a/cvpcb/cvframe.cpp +++ b/cvpcb/cvframe.cpp @@ -108,9 +108,9 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) : wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, CVPCB_MAINFRAME_NAME ) { m_FrameName = CVPCB_MAINFRAME_NAME; - m_ListCmp = NULL; - m_FootprintList = NULL; - m_LibraryList = NULL; + m_compListBox = NULL; + m_footprintListBox = NULL; + m_libListBox = NULL; m_mainToolBar = NULL; m_modified = false; m_isEESchemaNetlist = false; @@ -175,18 +175,18 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) : m_auimgr.AddPane( m_mainToolBar, wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top() ); - if( m_ListCmp ) - m_auimgr.AddPane( m_ListCmp, - wxAuiPaneInfo( horiz ).Name( wxT( "m_ListCmp" ) ).CentrePane() ); + if( m_compListBox ) + m_auimgr.AddPane( m_compListBox, + wxAuiPaneInfo( horiz ).Name( wxT( "m_compListBox" ) ).CentrePane() ); - if( m_LibraryList) - m_auimgr.AddPane( m_LibraryList, - wxAuiPaneInfo( info ).Name( wxT( "m_LibraryList" ) ). + if( m_libListBox) + m_auimgr.AddPane( m_libListBox, + wxAuiPaneInfo( info ).Name( wxT( "m_libListBox" ) ). Left().BestSize( (int) ( m_FrameSize.x * 0.20 ), m_FrameSize.y ) ); - if( m_FootprintList ) - m_auimgr.AddPane( m_FootprintList, - wxAuiPaneInfo( info ).Name( wxT( "m_FootprintList" ) ). + if( m_footprintListBox ) + m_auimgr.AddPane( m_footprintListBox, + wxAuiPaneInfo( info ).Name( wxT( "m_footprintListBox" ) ). Right().BestSize( (int) ( m_FrameSize.x * 0.30 ), m_FrameSize.y ) ); m_auimgr.Update(); @@ -302,21 +302,21 @@ void CVPCB_MAINFRAME::ChangeFocus( bool aMoveRight ) if( aMoveRight ) { - if( hasFocus == m_LibraryList ) - m_ListCmp->SetFocus(); - else if( hasFocus == m_ListCmp ) - m_FootprintList->SetFocus(); - else if( hasFocus == m_FootprintList ) - m_LibraryList->SetFocus(); + if( hasFocus == m_libListBox ) + m_compListBox->SetFocus(); + else if( hasFocus == m_compListBox ) + m_footprintListBox->SetFocus(); + else if( hasFocus == m_footprintListBox ) + m_libListBox->SetFocus(); } else { - if( hasFocus == m_LibraryList ) - m_FootprintList->SetFocus(); - else if( hasFocus == m_ListCmp ) - m_LibraryList->SetFocus(); - else if( hasFocus == m_FootprintList ) - m_ListCmp->SetFocus(); + if( hasFocus == m_libListBox ) + m_footprintListBox->SetFocus(); + else if( hasFocus == m_compListBox ) + m_libListBox->SetFocus(); + else if( hasFocus == m_footprintListBox ) + m_compListBox->SetFocus(); } } @@ -326,7 +326,7 @@ void CVPCB_MAINFRAME::ToFirstNA( wxCommandEvent& event ) if( m_netlist.IsEmpty() ) return; - long selection = m_ListCmp->GetFirstSelected(); + long selection = m_compListBox->GetFirstSelected(); if( selection < 0 ) 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() ) { - m_ListCmp->SetSelection( wxNOT_FOUND, false ); // Remove all selections - m_ListCmp->SetSelection( jj ); + m_compListBox->SetSelection( wxNOT_FOUND, false ); // Remove all selections + m_compListBox->SetSelection( jj ); SendMessageToEESCHEMA(); return; } @@ -349,20 +349,20 @@ void CVPCB_MAINFRAME::ToPreviousNA( wxCommandEvent& event ) if( m_netlist.IsEmpty() ) return; - int selection = m_ListCmp->GetFirstSelected(); + int selection = m_compListBox->GetFirstSelected(); if( selection < 0 ) - selection = m_ListCmp->GetCount(); + selection = m_compListBox->GetCount(); else - while( m_ListCmp->GetNextSelected( selection ) >= 0 ) - selection = m_ListCmp->GetNextSelected( selection ); + while( m_compListBox->GetNextSelected( selection ) >= 0 ) + selection = m_compListBox->GetNextSelected( selection ); for( int kk = selection-1; kk >= 0; kk-- ) { if( m_netlist.GetComponent( kk )->GetFPID().empty() ) { - m_ListCmp->SetSelection( wxNOT_FOUND, false ); // Remove all selections - m_ListCmp->SetSelection( kk ); + m_compListBox->SetSelection( wxNOT_FOUND, false ); // Remove all selections + m_compListBox->SetSelection( kk ); SendMessageToEESCHEMA(); return; } @@ -392,7 +392,7 @@ void CVPCB_MAINFRAME::DelAssociations( wxCommandEvent& event ) if( IsOK( this, _( "Delete selections" ) ) ) { m_skipComponentSelect = true; - m_ListCmp->SetSelection( 0 ); + m_compListBox->SetSelection( 0 ); for( unsigned i = 0; i < m_netlist.GetCount(); i++ ) { @@ -403,7 +403,7 @@ void CVPCB_MAINFRAME::DelAssociations( wxCommandEvent& event ) } m_skipComponentSelect = false; - m_ListCmp->SetSelection( 0 ); + m_compListBox->SetSelection( 0 ); m_undefinedComponentCnt = m_netlist.GetCount(); } @@ -562,8 +562,8 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event ) filter |= FOOTPRINTS_LISTBOX::BY_LIBRARY; component = GetSelectedComponent(); - libraryName = m_LibraryList->GetSelectedLibrary(); - m_FootprintList->SetFootprints( m_footprints, libraryName, component, filter ); + libraryName = m_libListBox->GetSelectedLibrary(); + m_footprintListBox->SetFootprints( m_footprints, libraryName, component, filter ); // Tell AuiMgr that objects are changed ! 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. // If the selection is made from the footprint list, do not change the current // 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() ); bool found = false; - for( int ii = 0; ii < m_FootprintList->GetCount(); ii++ ) + for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ ) { wxString footprintName; - wxString msg = m_FootprintList->OnGetItemText( ii, 0 ); + wxString msg = m_footprintListBox->OnGetItemText( ii, 0 ); msg.Trim( true ); msg.Trim( false ); footprintName = msg.AfterFirst( wxChar( ' ' ) ); if( module.Cmp( footprintName ) == 0 ) { - m_FootprintList->SetSelection( ii, true ); + m_footprintListBox->SetSelection( ii, true ); found = true; break; } @@ -602,10 +602,10 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event ) if( !found ) { - int ii = m_FootprintList->GetSelection(); + int ii = m_footprintListBox->GetSelection(); if ( ii >= 0 ) - m_FootprintList->SetSelection( ii, false ); + m_footprintListBox->SetSelection( ii, false ); if( GetFpViewerFrame() ) { @@ -638,7 +638,7 @@ void CVPCB_MAINFRAME::DisplayStatus() wxString msg; 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(), m_undefinedComponentCnt ); @@ -665,7 +665,7 @@ void CVPCB_MAINFRAME::DisplayStatus() } else { - wxString footprintName = m_FootprintList->GetSelectedFootprint(); + wxString footprintName = m_footprintListBox->GetSelectedFootprint(); FOOTPRINT_INFO* module = m_footprints.GetModuleInfo( footprintName ); @@ -681,7 +681,7 @@ void CVPCB_MAINFRAME::DisplayStatus() msg.Empty(); - if( m_FootprintList ) + if( m_footprintListBox ) { if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) ) msg = _( "key words" ); @@ -707,7 +707,7 @@ void CVPCB_MAINFRAME::DisplayStatus() else msg = _( "Filtered by " ) + msg; - msg << wxT( ": " ) << m_FootprintList->GetCount(); + msg << wxT( ": " ) << m_footprintListBox->GetCount(); SetStatusText( msg, 2 ); } @@ -762,7 +762,7 @@ void CVPCB_MAINFRAME::SendMessageToEESCHEMA() if( m_netlist.IsEmpty() ) return; - int selection = m_ListCmp->GetSelection(); + int selection = m_compListBox->GetSelection(); if ( selection < 0 ) selection = 0; @@ -914,17 +914,17 @@ void CVPCB_MAINFRAME::BuildFOOTPRINTS_LISTBOX() { 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 ); - m_FootprintList->SetFont( wxFont( guiFont.GetPointSize(), + m_footprintListBox->SetFont( wxFont( guiFont.GetPointSize(), wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL ) ); } - m_FootprintList->SetFootprints( m_footprints, wxEmptyString, NULL, + m_footprintListBox->SetFootprints( m_footprints, wxEmptyString, NULL, FOOTPRINTS_LISTBOX::UNFILTERED ); DisplayStatus(); } @@ -936,34 +936,34 @@ void CVPCB_MAINFRAME::BuildCmpListBox() COMPONENT* component; 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 ); - m_ListCmp->SetFont( wxFont( guiFont.GetPointSize(), + m_compListBox->SetFont( wxFont( guiFont.GetPointSize(), wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL ) ); } - m_ListCmp->m_ComponentList.Clear(); + m_compListBox->m_ComponentList.Clear(); for( unsigned i = 0; i < m_netlist.GetCount(); 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->GetValue() ), 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_ListCmp->SetSelection( 0, true ); - m_ListCmp->RefreshItems( 0L, m_ListCmp->m_ComponentList.Count()-1 ); + m_compListBox->SetItemCount( m_compListBox->m_ComponentList.Count() ); + m_compListBox->SetSelection( 0, true ); + m_compListBox->RefreshItems( 0L, m_compListBox->m_ComponentList.Count()-1 ); #if defined (__WXGTK__ ) // @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 // 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. - m_ListCmp->SetColumnWidth( -1, wxLIST_AUTOSIZE ); + m_compListBox->SetColumnWidth( -1, wxLIST_AUTOSIZE ); #else - m_ListCmp->SetColumnWidth( 0, wxLIST_AUTOSIZE ); + m_compListBox->SetColumnWidth( 0, wxLIST_AUTOSIZE ); #endif } } @@ -983,11 +983,11 @@ void CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX() { 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 ); - m_LibraryList->SetFont( wxFont( guiFont.GetPointSize(), + m_libListBox->SetFont( wxFont( guiFont.GetPointSize(), wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL ) ); @@ -1004,14 +1004,14 @@ void CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX() for( unsigned ii = 0; ii < libNickNames.size(); ii++ ) libNames.Add( libNickNames[ii] ); - m_LibraryList->SetLibraryList( libNames ); + m_libListBox->SetLibraryList( libNames ); } } COMPONENT* CVPCB_MAINFRAME::GetSelectedComponent() { - int selection = m_ListCmp->GetSelection(); + int selection = m_compListBox->GetSelection(); if( selection >= 0 && selection < (int) m_netlist.GetCount() ) return m_netlist.GetComponent( selection ); diff --git a/cvpcb/cvpcb.cpp b/cvpcb/cvpcb.cpp index 317ef82631..18dbed29d5 100644 --- a/cvpcb/cvpcb.cpp +++ b/cvpcb/cvpcb.cpp @@ -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() diff --git a/cvpcb/cvpcb.h b/cvpcb/cvpcb.h index 5b91f21640..f5f76f433b 100644 --- a/cvpcb/cvpcb.h +++ b/cvpcb/cvpcb.h @@ -21,6 +21,5 @@ extern const wxString RetroFileExtension; extern const wxString FootprintAliasFileWildcard; -extern const wxString titleLibLoadError; #endif /* __CVPCB_H__ */ diff --git a/cvpcb/cvpcb_mainframe.h b/cvpcb/cvpcb_mainframe.h index 359c7e20b9..86580b1503 100644 --- a/cvpcb/cvpcb_mainframe.h +++ b/cvpcb/cvpcb_mainframe.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; diff --git a/cvpcb/readwrite_dlgs.cpp b/cvpcb/readwrite_dlgs.cpp index 939abc7acb..efcb59d0f7 100644 --- a/cvpcb/readwrite_dlgs.cpp +++ b/cvpcb/readwrite_dlgs.cpp @@ -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(); diff --git a/include/dsnlexer.h b/include/dsnlexer.h index fcb4433d6c..24674fd665 100644 --- a/include/dsnlexer.h +++ b/include/dsnlexer.h @@ -155,7 +155,6 @@ protected: return false; } - #endif public: diff --git a/include/richio.h b/include/richio.h index 64c842fcb2..677c1d0e7e 100644 --- a/include/richio.h +++ b/include/richio.h @@ -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 }; diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index b79e51b944..1d307e9ede 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -2708,7 +2708,7 @@ LAYER_ID EAGLE_PLUGIN::kicad_layer( int aEagleLayer ) const } } - return ToLAYER_ID( kiLayer ); + return LAYER_ID( kiLayer ); } diff --git a/pcbnew/github/github_plugin.cpp b/pcbnew/github/github_plugin.cpp index 894c6ec322..4b2f6946eb 100644 --- a/pcbnew/github/github_plugin.cpp +++ b/pcbnew/github/github_plugin.cpp @@ -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 diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index 6d1154efa3..475a844948 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -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 ); diff --git a/pcbnew/pcb_parser.h b/pcbnew/pcb_parser.h index 4b223fc62c..3d8d6918b2 100644 --- a/pcbnew/pcb_parser.h +++ b/pcbnew/pcb_parser.h @@ -62,8 +62,8 @@ struct LAYER; */ class PCB_PARSER : public PCB_LEXER { - typedef boost::unordered_map< std::string, LAYER_ID > LAYER_ID_MAP; - typedef boost::unordered_map< std::string, LSET > LSET_MAP; + typedef boost::unordered_map< std::string, LAYER_ID > LAYER_ID_MAP; + typedef boost::unordered_map< std::string, LSET > LSET_MAP; BOARD* m_board; LAYER_ID_MAP m_layerIndices; ///< map layer name to it's index