Commit 619125f9 authored by jean-pierre charras's avatar jean-pierre charras

Changes for CvPcb to eeschema stuff file: the stuff file generation from CvPcb...

Changes for CvPcb to eeschema stuff file: the stuff file generation from CvPcb is removed. Eeschema now imports footprints names from the .cmp usual file created by CvPcb or by Pcbnew (Why to use 2 file formats for the same thing?) .
Pcbnew: in netlist dialog: The user now can choose between the netlist and the .cmp file to import footprints names.
Therfore no need to delete the .cmp file when exists to use only the netlist.
This is useful for users who use CvPcb only once to fill footprints fields in schematic, and after edit/modify the footprints fields in schematic outside CvPcb.
parent 638decaf
...@@ -80,6 +80,7 @@ const wxString LegacyFootprintLibPathWildcard( _( "Legacy footprint library file ...@@ -80,6 +80,7 @@ const wxString LegacyFootprintLibPathWildcard( _( "Legacy footprint library file
const wxString EagleFootprintLibPathWildcard( _( "Eagle ver. 6.x XML library files (*.lbr)|*.lbr" ) ); const wxString EagleFootprintLibPathWildcard( _( "Eagle ver. 6.x XML library files (*.lbr)|*.lbr" ) );
const wxString GedaPcbFootprintLibFileWildcard( _( "Geda PCB footprint library file (*.fp)|*.fp" ) ); const wxString GedaPcbFootprintLibFileWildcard( _( "Geda PCB footprint library file (*.fp)|*.fp" ) );
const wxString MacrosFileWildcard( _( "KiCad recorded macros (*.mcr)|*.mcr" ) ); const wxString MacrosFileWildcard( _( "KiCad recorded macros (*.mcr)|*.mcr" ) );
const wxString ComponentFileExtensionWildcard( _( "Component-footprint link file (*.cmp)|*cmp" ) );
// generic: // generic:
const wxString AllFilesWildcard( _( "All files (*)|*" ) ); const wxString AllFilesWildcard( _( "All files (*)|*" ) );
......
...@@ -80,7 +80,6 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, EDA_BASE_FRAME ) ...@@ -80,7 +80,6 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, EDA_BASE_FRAME )
EVT_TOOL( ID_CVPCB_GOTO_PREVIOUSNA, CVPCB_MAINFRAME::ToPreviousNA ) EVT_TOOL( ID_CVPCB_GOTO_PREVIOUSNA, CVPCB_MAINFRAME::ToPreviousNA )
EVT_TOOL( ID_CVPCB_DEL_ASSOCIATIONS, CVPCB_MAINFRAME::DelAssociations ) EVT_TOOL( ID_CVPCB_DEL_ASSOCIATIONS, CVPCB_MAINFRAME::DelAssociations )
EVT_TOOL( ID_CVPCB_AUTO_ASSOCIE, CVPCB_MAINFRAME::AssocieModule ) EVT_TOOL( ID_CVPCB_AUTO_ASSOCIE, CVPCB_MAINFRAME::AssocieModule )
EVT_TOOL( ID_CVPCB_CREATE_STUFF_FILE, CVPCB_MAINFRAME::WriteStuffList )
EVT_TOOL( ID_PCB_DISPLAY_FOOTPRINT_DOC, CVPCB_MAINFRAME::DisplayDocFile ) EVT_TOOL( ID_PCB_DISPLAY_FOOTPRINT_DOC, CVPCB_MAINFRAME::DisplayDocFile )
EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
CVPCB_MAINFRAME::OnSelectFilteringFootprint ) CVPCB_MAINFRAME::OnSelectFilteringFootprint )
......
...@@ -26,7 +26,6 @@ enum id_cvpcb_frm ...@@ -26,7 +26,6 @@ enum id_cvpcb_frm
ID_CVPCB_AUTO_ASSOCIE, ID_CVPCB_AUTO_ASSOCIE,
ID_CVPCB_COMPONENT_LIST, ID_CVPCB_COMPONENT_LIST,
ID_CVPCB_FOOTPRINT_LIST, ID_CVPCB_FOOTPRINT_LIST,
ID_CVPCB_CREATE_STUFF_FILE,
ID_CVPCB_SHOW3D_FRAME, ID_CVPCB_SHOW3D_FRAME,
ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST,
ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
......
...@@ -112,15 +112,6 @@ public: ...@@ -112,15 +112,6 @@ public:
*/ */
void AssocieModule( wxCommandEvent& event ); void AssocieModule( wxCommandEvent& event );
/**
* Function WriteStuffList
* Creates a file for Eeschema, import footprint selections
* in schematic
* the file format is
* comp = "<reference>" module = "<footprint name">
*/
void WriteStuffList( wxCommandEvent& event );
void DisplayDocFile( wxCommandEvent& event ); void DisplayDocFile( wxCommandEvent& event );
/** /**
......
...@@ -76,7 +76,7 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName ) ...@@ -76,7 +76,7 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
component->m_Footprint = aFootprintName; component->m_Footprint = aFootprintName;
// create the new component description // create the new component description
description.Printf( CMP_FORMAT, componentIndex + 1, description.Printf( CMP_FORMAT, componentIndex + 1,
GetChars( component->m_Reference ), GetChars( component->m_Reference ),
GetChars( component->m_Value ), GetChars( component->m_Value ),
...@@ -85,7 +85,7 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName ) ...@@ -85,7 +85,7 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
// if the component hasn't had a footprint associated with it // if the component hasn't had a footprint associated with it
// it now has, so we decrement the count of components without // it now has, so we decrement the count of components without
// a footprint assigned. // a footprint assigned.
if( !hasFootprint ) if( !hasFootprint )
{ {
hasFootprint = true; hasFootprint = true;
...@@ -233,48 +233,3 @@ int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName ) ...@@ -233,48 +233,3 @@ int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName )
SetStatusText( msg ); SetStatusText( msg );
return 1; return 1;
} }
/* Creates a file for Eeschema, import footprint selections in schematic
* the file format is
* comp = "<reference>" module = "<footprint name">
*/
void CVPCB_MAINFRAME::WriteStuffList( wxCommandEvent& event )
{
FILE* FileEquiv;
wxString Line;
wxFileName fn = m_NetlistFileName;
if( m_components.empty() )
return;
fn.SetExt( RetroFileExtension );
wxFileDialog dlg( this, wxT( "Save Stuff File" ), fn.GetPath(),
fn.GetFullName(), RetroFileWildcard,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL )
return;
FileEquiv = wxFopen( dlg.GetPath(), wxT( "wt" ) );
if( FileEquiv == 0 )
{
Line = _( "Unable to create " ) + dlg.GetPath();
DisplayError( this, Line, 30 );
return;
}
BOOST_FOREACH( COMPONENT_INFO& component, m_components )
{
if( component.m_Footprint.empty() )
continue;
fprintf( FileEquiv, "comp = %s module = %s\n",
EscapedUTF8( component.m_Reference ).c_str(),
EscapedUTF8( component.m_Footprint ).c_str() );
}
fclose( FileEquiv );
}
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2007-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2007-2013 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -83,12 +83,6 @@ void CVPCB_MAINFRAME::ReCreateHToolbar() ...@@ -83,12 +83,6 @@ void CVPCB_MAINFRAME::ReCreateHToolbar()
KiBitmap( delete_association_xpm ), KiBitmap( delete_association_xpm ),
_( "Delete all associations" ) ); _( "Delete all associations" ) );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_CVPCB_CREATE_STUFF_FILE, wxEmptyString,
KiBitmap( export_footprint_names_xpm ),
_( "Create export file (component/footprint list, \
used by Eeschema to fill the footprint field of components)" ) );
m_mainToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_PCB_DISPLAY_FOOTPRINT_DOC, wxEmptyString, m_mainToolBar->AddTool( ID_PCB_DISPLAY_FOOTPRINT_DOC, wxEmptyString,
KiBitmap( datasheet_xpm ), KiBitmap( datasheet_xpm ),
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <appl_wxstruct.h> #include <appl_wxstruct.h>
#include <wxEeschemaStruct.h> #include <wxEeschemaStruct.h>
#include <build_version.h> #include <build_version.h>
#include <wildcards_and_files_ext.h>
#include <general.h> #include <general.h>
#include <sch_sheet_path.h> #include <sch_sheet_path.h>
...@@ -42,90 +43,120 @@ ...@@ -42,90 +43,120 @@
#include <netlist.h> #include <netlist.h>
const wxString BackAnnotateFileWildcard( wxT( "Eeschema Back Annotation File (*.stf)|*.stf" ) );
bool SCH_EDIT_FRAME::ProcessCmpToFootprintLinkFile( wxString& aFullFilename,
bool SCH_EDIT_FRAME::ProcessStuffFile( FILE* aFile, bool aSetFieldAttributeToVisible ) bool aSetFieldAttributeToVisible )
{ {
int LineNum = 0;
char* cp, Ref[256], FootPrint[256], Line[1024];
SCH_SHEET_LIST SheetList;
wxString reference;
wxString footprint;
// Build a flat list of components in schematic: // Build a flat list of components in schematic:
SCH_REFERENCE_LIST referencesList; SCH_REFERENCE_LIST referencesList;
SCH_SHEET_LIST SheetList;
SheetList.GetComponents( referencesList, false ); SheetList.GetComponents( referencesList, false );
// Now, foe each component found in file, FILE* cmpFile = wxFopen( aFullFilename, wxT( "rt" ) );
if( cmpFile == NULL )
return false;
// cmpFileReader dtor will close cmpFile
FILE_LINE_READER cmpFileReader( cmpFile, aFullFilename );
// Now, for each component found in file,
// replace footprint field value by the new value: // replace footprint field value by the new value:
while( GetLine( aFile, Line, &LineNum, sizeof(Line) ) ) wxString reference;
wxString footprint;
wxString buffer;
wxString value;
while( cmpFileReader.ReadLine() )
{ {
if( sscanf( Line, "comp = \"%s module = \"%s", Ref, FootPrint ) == 2 ) buffer = FROM_UTF8( cmpFileReader.Line() );
if( ! buffer.StartsWith( wxT("BeginCmp") ) )
continue;
// Begin component description.
reference.Empty();
footprint.Empty();
while( cmpFileReader.ReadLine() )
{ {
for( cp = Ref; *cp; cp++ ) buffer = FROM_UTF8( cmpFileReader.Line() );
if( *cp == '"' )
*cp = 0;
for( cp = FootPrint; *cp; cp++ ) if( buffer.StartsWith( wxT("EndCmp") ) )
if( *cp == '"' ) break;
*cp = 0;
reference = FROM_UTF8( Ref ); // store string value, stored between '=' and ';' delimiters.
footprint = FROM_UTF8( FootPrint ); value = buffer.AfterFirst( '=' );
value = value.BeforeLast( ';');
value.Trim(true);
value.Trim(false);
// Search the component in the flat list if( buffer.StartsWith( wxT("Reference") ) )
for( unsigned ii = 0; ii < referencesList.GetCount(); ii++ )
{ {
if( reference.CmpNoCase( referencesList[ii].GetRef() ) == 0 ) reference = value;
continue;
}
if( buffer.StartsWith( wxT("IdModule =" ) ) )
{
footprint = value;
continue;
}
}
// A block is read: initialize the footprint field of the correponding component
// if the footprint name is not empty
if( reference.IsEmpty() )
continue;
// Search the component in the flat list
for( unsigned ii = 0; ii < referencesList.GetCount(); ii++ )
{
if( reference.CmpNoCase( referencesList[ii].GetRef() ) == 0 )
{
// We have found a candidate.
// Note: it can be not unique (multiple parts per package)
// So we *do not* stop the search here
SCH_COMPONENT* component = referencesList[ii].GetComponent();
SCH_FIELD * fpfield = component->GetField( FOOTPRINT );
/* Give a reasonable value to the field position and
* orientation, if the text is empty at position 0, because
* it is probably not yet initialized
*/
if( fpfield->m_Text.IsEmpty() &&
( fpfield->GetPosition() == component->GetPosition() ) )
{ {
// We have found a candidate. fpfield->m_Orient = component->GetField( VALUE )->m_Orient;
// Note: it can be not unique (multiple parts per package) fpfield->SetPosition( component->GetField( VALUE )->GetPosition() );
// So we do not stop the search here fpfield->m_Size = component->GetField( VALUE )->m_Size;
SCH_COMPONENT* component = referencesList[ii].GetComponent();
SCH_FIELD * fpfield = component->GetField( FOOTPRINT ); if( fpfield->m_Orient == 0 )
/* Give a reasonable value to the field position and fpfield->m_Pos.y += 100;
* orientation, if the text is empty at position 0, because
* it is probably not yet initialized
*/
if( fpfield->m_Text.IsEmpty()
&& ( fpfield->GetPosition() == component->GetPosition() ) )
{
fpfield->m_Orient = component->GetField( VALUE )->m_Orient;
fpfield->SetPosition( component->GetField( VALUE )->GetPosition() );
fpfield->m_Size = component->GetField( VALUE )->m_Size;
if( fpfield->m_Orient == 0 )
fpfield->m_Pos.y += 100;
else
fpfield->m_Pos.x += 100;
}
fpfield->m_Text = footprint;
if( aSetFieldAttributeToVisible )
component->GetField( FOOTPRINT )->m_Attributs &= ~TEXT_NO_VISIBLE;
else else
component->GetField( FOOTPRINT )->m_Attributs |= TEXT_NO_VISIBLE; fpfield->m_Pos.x += 100;
} }
fpfield->m_Text = footprint;
if( aSetFieldAttributeToVisible )
component->GetField( FOOTPRINT )->m_Attributs &= ~TEXT_NO_VISIBLE;
else
component->GetField( FOOTPRINT )->m_Attributs |= TEXT_NO_VISIBLE;
} }
} }
} }
fclose( aFile );
return true; return true;
} }
bool SCH_EDIT_FRAME::ReadInputStuffFile() bool SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile()
{ {
wxString title, filename; wxString title, filename;
FILE* file;
wxString msg; wxString msg;
bool visible = false; bool visible = false;
wxFileDialog dlg( this, _( "Load Back Annotate File" ), wxEmptyString, wxEmptyString, wxFileDialog dlg( this, _( "Load Component-Footprint Link File" ),
BackAnnotateFileWildcard, wxFD_OPEN | wxFD_FILE_MUST_EXIST ); wxEmptyString, wxEmptyString,
ComponentFileExtensionWildcard,
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return false; return false;
...@@ -145,16 +176,12 @@ bool SCH_EDIT_FRAME::ReadInputStuffFile() ...@@ -145,16 +176,12 @@ bool SCH_EDIT_FRAME::ReadInputStuffFile()
if( response == wxYES ) if( response == wxYES )
visible = true; visible = true;
file = wxFopen( filename, wxT( "rt" ) ); if( ! ProcessCmpToFootprintLinkFile( filename, visible ) )
if( file == NULL )
{ {
msg.Printf( _( "Failed to open back annotate file <%s>" ), filename.GetData() ); msg.Printf( _( "Failed to open component-footprint link file <%s>" ), filename.GetData() );
DisplayError( this, msg ); DisplayError( this, msg );
return false; return false;
} }
ProcessStuffFile( file, visible );
return true; return true;
} }
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -121,7 +121,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME ) ...@@ -121,7 +121,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_TOOL( ID_GET_TOOLS, SCH_EDIT_FRAME::OnCreateBillOfMaterials ) EVT_TOOL( ID_GET_TOOLS, SCH_EDIT_FRAME::OnCreateBillOfMaterials )
EVT_TOOL( ID_FIND_ITEMS, SCH_EDIT_FRAME::OnFindItems ) EVT_TOOL( ID_FIND_ITEMS, SCH_EDIT_FRAME::OnFindItems )
EVT_TOOL( wxID_REPLACE, SCH_EDIT_FRAME::OnFindItems ) EVT_TOOL( wxID_REPLACE, SCH_EDIT_FRAME::OnFindItems )
EVT_TOOL( ID_BACKANNO_ITEMS, SCH_EDIT_FRAME::OnLoadStuffFile ) EVT_TOOL( ID_BACKANNO_ITEMS, SCH_EDIT_FRAME::OnLoadCmpToFootprintLinkFile )
EVT_TOOL( ID_SCH_MOVE_ITEM, SCH_EDIT_FRAME::OnMoveItem ) EVT_TOOL( ID_SCH_MOVE_ITEM, SCH_EDIT_FRAME::OnMoveItem )
EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp ) EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp )
EVT_MENU( wxID_INDEX, EDA_DRAW_FRAME::GetKicadHelp ) EVT_MENU( wxID_INDEX, EDA_DRAW_FRAME::GetKicadHelp )
...@@ -718,9 +718,9 @@ void SCH_EDIT_FRAME::OnLoadFile( wxCommandEvent& event ) ...@@ -718,9 +718,9 @@ void SCH_EDIT_FRAME::OnLoadFile( wxCommandEvent& event )
} }
void SCH_EDIT_FRAME::OnLoadStuffFile( wxCommandEvent& event ) void SCH_EDIT_FRAME::OnLoadCmpToFootprintLinkFile( wxCommandEvent& event )
{ {
ReadInputStuffFile(); LoadCmpToFootprintLinkFile();
m_canvas->Refresh(); m_canvas->Refresh();
} }
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 20012 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2007-2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2007-2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2008-2012 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008-2012 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -68,6 +68,7 @@ extern const wxString KiCadFootprintFileExtension; ...@@ -68,6 +68,7 @@ extern const wxString KiCadFootprintFileExtension;
extern const wxString KiCadFootprintLibPathExtension; extern const wxString KiCadFootprintLibPathExtension;
extern const wxString GedaPcbFootprintLibFileExtension; extern const wxString GedaPcbFootprintLibFileExtension;
extern const wxString EagleFootprintLibPathExtension; extern const wxString EagleFootprintLibPathExtension;
extern const wxString ComponentFileExtensionWildcard;
/// Proper wxFileDialog wild card definitions. /// Proper wxFileDialog wild card definitions.
extern const wxString SchematicSymbolFileWildcard; extern const wxString SchematicSymbolFileWildcard;
......
...@@ -652,25 +652,34 @@ public: ...@@ -652,25 +652,34 @@ public:
*/ */
bool LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFileName, bool append = false ); bool LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFileName, bool append = false );
bool ReadInputStuffFile(); /**
* Function ReadCmpToFootprintLinkFile
* Loads a .cmp file from CvPcb and update the footprin field
* of components
* Prepares parameters and calls ProcessCmpToFootprintLinkFile
* to actually read the file and update Fp fields
*/
bool LoadCmpToFootprintLinkFile();
/** /**
* Function ProcessStuffFile * Function ProcessStuffFile
* gets footprint info from each line in the Stuff File by Ref Desg * gets footprint info from each line in the Stuff File by Ref Desg
* *
* Read a "stuff" file created by CvPcb. * Read a Cmp To Footprint Link file created by CvPcb (the .cmp file).
* That file has lines like: * That file has lines like:
* comp = "C1" module = "CP6" * BeginCmp
* comp = "C2" module = "C1" * TimeStamp = /32307DE2/AA450F67;
* comp = "C3" module = "C1" * Reference = C1;
* "comp =" gives the component reference * ValeurCmp = 47uF;
* "module =" gives the footprint name * IdModule = CP6;
* EndCmp
* *
* @param aFilename The file to read from. * @param aFullFilename = the full filename to read
* @param aSetFieldsAttributeToVisible = true to set the footprint field flag to visible * @param aSetFieldsAttributeToVisible = true to set the footprint field flag to visible
* @return bool - true if success, else true. * @return bool = true if success.
*/ */
bool ProcessStuffFile( FILE* aFilename, bool aSetFieldsAttributeToVisible ); bool ProcessCmpToFootprintLinkFile( wxString& aFullFilename,
bool aSetFieldsAttributeToVisible );
/** /**
* Function SaveEEFile * Function SaveEEFile
...@@ -753,7 +762,7 @@ private: ...@@ -753,7 +762,7 @@ private:
void OnFindReplace( wxFindDialogEvent& aEvent ); void OnFindReplace( wxFindDialogEvent& aEvent );
void OnLoadFile( wxCommandEvent& event ); void OnLoadFile( wxCommandEvent& event );
void OnLoadStuffFile( wxCommandEvent& event ); void OnLoadCmpToFootprintLinkFile( wxCommandEvent& event );
void OnNewProject( wxCommandEvent& event ); void OnNewProject( wxCommandEvent& event );
void OnLoadProject( wxCommandEvent& event ); void OnLoadProject( wxCommandEvent& event );
void OnAppendProject( wxCommandEvent& event ); void OnAppendProject( wxCommandEvent& event );
......
...@@ -90,11 +90,13 @@ protected: ...@@ -90,11 +90,13 @@ protected:
PCB_LAYER_WIDGET* m_Layers; PCB_LAYER_WIDGET* m_Layers;
DRC* m_drc; ///< the DRC controller, see drc.cpp DRC* m_drc; ///< the DRC controller, see drc.cpp
PARAM_CFG_ARRAY m_configSettings; ///< List of Pcbnew configuration settings. PARAM_CFG_ARRAY m_configSettings; ///< List of Pcbnew configuration settings.
wxString m_lastNetListRead; ///< Last net list read with relative path. wxString m_lastNetListRead; ///< Last net list read with relative path.
bool m_useCmpFileForFpNames; ///< is true, use the .cmp file from CvPcb, else use the netlist
// to know the footprint name of components.
// we'll use lower case function names for private member functions. // we'll use lower case function names for private member functions.
void createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu* aPopMenu ); void createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu* aPopMenu );
...@@ -392,6 +394,26 @@ public: ...@@ -392,6 +394,26 @@ public:
*/ */
void SetLastNetListRead( const wxString& aNetListFile ); void SetLastNetListRead( const wxString& aNetListFile );
/**
* @return true if the .cmp file created by CvPcb should be used to know the
* footprint associated to components, false to use the netlist file only
*/
bool GetUseCmpFileForFpNames() { return m_useCmpFileForFpNames; }
/**
* Set the default option to use or not the .cmp file craeted by CvPcb
* should be used to know the footprints associated to components when
* reading a netlist
* When the .cmp netlist is not used, footprint names are read from the netlist.
* This imply the user has filled the footprint fields in schematic
* @param aUseCmpfile = true to use the .cmp file,
* false to use the netlist file only
*/
void SetUseCmpFileForFpNames( bool aUseCmpfile)
{
m_useCmpFileForFpNames = aUseCmpfile;
}
/** /**
* Function Test_Duplicate_Missing_And_Extra_Footprints * Function Test_Duplicate_Missing_And_Extra_Footprints
* Build a list of duplicate, missing and extra footprints * Build a list of duplicate, missing and extra footprints
...@@ -1393,7 +1415,7 @@ public: ...@@ -1393,7 +1415,7 @@ public:
* Update connectivity info, references, values and "TIME STAMP" * Update connectivity info, references, values and "TIME STAMP"
* @param aNetlistFullFilename = netlist file name (*.net) * @param aNetlistFullFilename = netlist file name (*.net)
* @param aCmpFullFileName = cmp/footprint link file name (*.cmp). * @param aCmpFullFileName = cmp/footprint link file name (*.cmp).
* if not found, only the netlist will be used * if not found or empty, only the netlist will be used
* @param aMessageWindow = a reference to a wxTextCtrl where to display messages. * @param aMessageWindow = a reference to a wxTextCtrl where to display messages.
* can be NULL * can be NULL
* @param aChangeFootprint if true, footprints that have changed in netlist will be changed * @param aChangeFootprint if true, footprints that have changed in netlist will be changed
......
...@@ -42,10 +42,11 @@ ...@@ -42,10 +42,11 @@
#include <dialog_netlist.h> #include <dialog_netlist.h>
void PCB_EDIT_FRAME::InstallNetlistFrame( wxDC* DC ) void PCB_EDIT_FRAME::InstallNetlistFrame( wxDC* DC )
{ {
/* Setup the netlist file name to the last net list file read or the board file /* Setup the netlist file name to the last netlist file read,
* name if no last file read is not set. * or the board file name if the last filename is empty or last file not existing.
*/ */
wxFileName fn = GetLastNetListRead(); wxFileName fn = GetLastNetListRead();
wxString lastNetlistName = GetLastNetListRead(); wxString lastNetlistName = GetLastNetListRead();
...@@ -57,13 +58,20 @@ void PCB_EDIT_FRAME::InstallNetlistFrame( wxDC* DC ) ...@@ -57,13 +58,20 @@ void PCB_EDIT_FRAME::InstallNetlistFrame( wxDC* DC )
lastNetlistName = fn.GetFullPath(); lastNetlistName = fn.GetFullPath();
} }
DIALOG_NETLIST frame( this, DC, lastNetlistName ); DIALOG_NETLIST dlg( this, DC, lastNetlistName );
frame.ShowModal(); dlg.ShowModal();
// Save project settings if needed. // Save project settings if needed.
// Project settings are saved in the corresponding <board name>.pro file // Project settings are saved in the corresponding <board name>.pro file
if( lastNetlistName != GetLastNetListRead() && bool configChanged = lastNetlistName != GetLastNetListRead();
if( dlg.UseCmpFileForFpNames() != GetUseCmpFileForFpNames() )
{
SetUseCmpFileForFpNames( dlg.UseCmpFileForFpNames() );
configChanged = true;
}
if( configChanged &&
!GetBoard()->GetFileName().IsEmpty() && !GetBoard()->GetFileName().IsEmpty() &&
IsOK(NULL, _("Project config has changed. Save it ?") ) ) IsOK(NULL, _("Project config has changed. Save it ?") ) )
{ {
...@@ -82,18 +90,11 @@ DIALOG_NETLIST::DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, wxDC * aDC, ...@@ -82,18 +90,11 @@ DIALOG_NETLIST::DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, wxDC * aDC,
m_parent = aParent; m_parent = aParent;
m_dc = aDC; m_dc = aDC;
m_NetlistFilenameCtrl->SetValue( aNetlistFullFilename ); m_NetlistFilenameCtrl->SetValue( aNetlistFullFilename );
m_cmpNameSourceOpt->SetSelection( m_parent->GetUseCmpFileForFpNames() ? 1 : 0 );
Init();
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
} }
void DIALOG_NETLIST::Init()
{
SetFocus();
}
void DIALOG_NETLIST::OnOpenNetlistClick( wxCommandEvent& event ) void DIALOG_NETLIST::OnOpenNetlistClick( wxCommandEvent& event )
{ {
wxString lastPath = wxFileName::GetCwd(); wxString lastPath = wxFileName::GetCwd();
...@@ -125,11 +126,16 @@ void DIALOG_NETLIST::OnOpenNetlistClick( wxCommandEvent& event ) ...@@ -125,11 +126,16 @@ void DIALOG_NETLIST::OnOpenNetlistClick( wxCommandEvent& event )
void DIALOG_NETLIST::OnReadNetlistFileClick( wxCommandEvent& event ) void DIALOG_NETLIST::OnReadNetlistFileClick( wxCommandEvent& event )
{ {
wxFileName fn = m_NetlistFilenameCtrl->GetValue(); wxString fullNetfileName = m_NetlistFilenameCtrl->GetValue();
fn.SetExt( ComponentFileExtension ); wxString cmpFilename;
if( UseCmpFileForFpNames() )
{
wxFileName fn = m_NetlistFilenameCtrl->GetValue();
fn.SetExt( ComponentFileExtension );
cmpFilename = fn.GetFullPath();
}
m_parent->ReadPcbNetlist( m_NetlistFilenameCtrl->GetValue(), m_parent->ReadPcbNetlist( fullNetfileName, cmpFilename, m_MessageWindow,
fn.GetFullPath(), m_MessageWindow,
m_ChangeExistingFootprintCtrl->GetSelection() == 1 ? true : false, m_ChangeExistingFootprintCtrl->GetSelection() == 1 ? true : false,
m_DeleteBadTracks->GetSelection() == 1 ? true : false, m_DeleteBadTracks->GetSelection() == 1 ? true : false,
m_RemoveExtraFootprintsCtrl->GetSelection() == 1 ? true : false, m_RemoveExtraFootprintsCtrl->GetSelection() == 1 ? true : false,
......
...@@ -37,21 +37,25 @@ private: ...@@ -37,21 +37,25 @@ private:
PCB_EDIT_FRAME * m_parent; PCB_EDIT_FRAME * m_parent;
wxDC * m_dc; wxDC * m_dc;
public: public:
DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, wxDC * aDC, DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, wxDC * aDC,
const wxString & aNetlistFullFilename ); const wxString & aNetlistFullFilename );
~DIALOG_NETLIST() {}; ~DIALOG_NETLIST() {};
// return true if the user choice is tu use the .cmp file
// created by CvPcb to know footprin names associated to components
// and false tu use the netlist only
bool UseCmpFileForFpNames()
{
return m_cmpNameSourceOpt->GetSelection() == 1;
}
private: private:
void Init(); // Virtual event handlers:
// Virtual event handlers, overide them in your derived class
void OnOpenNetlistClick( wxCommandEvent& event ); void OnOpenNetlistClick( wxCommandEvent& event );
void OnReadNetlistFileClick( wxCommandEvent& event ); void OnReadNetlistFileClick( wxCommandEvent& event );
void OnTestFootprintsClick( wxCommandEvent& event ); void OnTestFootprintsClick( wxCommandEvent& event );
void OnCompileRatsnestClick( wxCommandEvent& event ); void OnCompileRatsnestClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
}; };
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012) // C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -28,7 +28,15 @@ DIALOG_NETLIST_FBP::DIALOG_NETLIST_FBP( wxWindow* parent, wxWindowID id, const w ...@@ -28,7 +28,15 @@ DIALOG_NETLIST_FBP::DIALOG_NETLIST_FBP( wxWindow* parent, wxWindowID id, const w
m_Select_By_Timestamp->SetSelection( 0 ); m_Select_By_Timestamp->SetSelection( 0 );
m_Select_By_Timestamp->SetToolTip( _("Select how footprints are recognized:\nby their reference (U1, R3...) (normal setting)\nor their time stamp (special setting after a full schematic reannotation)") ); m_Select_By_Timestamp->SetToolTip( _("Select how footprints are recognized:\nby their reference (U1, R3...) (normal setting)\nor their time stamp (special setting after a full schematic reannotation)") );
bLeftSizer->Add( m_Select_By_Timestamp, 0, wxALL|wxEXPAND, 5 ); bLeftSizer->Add( m_Select_By_Timestamp, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
wxString m_cmpNameSourceOptChoices[] = { _("From netlist"), _("From separate .cmp file") };
int m_cmpNameSourceOptNChoices = sizeof( m_cmpNameSourceOptChoices ) / sizeof( wxString );
m_cmpNameSourceOpt = new wxRadioBox( this, wxID_ANY, _("Module Name Source:"), wxDefaultPosition, wxDefaultSize, m_cmpNameSourceOptNChoices, m_cmpNameSourceOptChoices, 1, wxRA_SPECIFY_COLS );
m_cmpNameSourceOpt->SetSelection( 0 );
m_cmpNameSourceOpt->SetToolTip( _("Source of footprints names for component:\n- the netlist (if you have filled the footprint field of each component in schematic)\n- the .cmp file created by CvPcb") );
bLeftSizer->Add( m_cmpNameSourceOpt, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
wxString m_ChangeExistingFootprintCtrlChoices[] = { _("Keep"), _("Change") }; wxString m_ChangeExistingFootprintCtrlChoices[] = { _("Keep"), _("Change") };
int m_ChangeExistingFootprintCtrlNChoices = sizeof( m_ChangeExistingFootprintCtrlChoices ) / sizeof( wxString ); int m_ChangeExistingFootprintCtrlNChoices = sizeof( m_ChangeExistingFootprintCtrlChoices ) / sizeof( wxString );
...@@ -36,7 +44,7 @@ DIALOG_NETLIST_FBP::DIALOG_NETLIST_FBP( wxWindow* parent, wxWindowID id, const w ...@@ -36,7 +44,7 @@ DIALOG_NETLIST_FBP::DIALOG_NETLIST_FBP( wxWindow* parent, wxWindowID id, const w
m_ChangeExistingFootprintCtrl->SetSelection( 0 ); m_ChangeExistingFootprintCtrl->SetSelection( 0 );
m_ChangeExistingFootprintCtrl->SetToolTip( _("Keep or change an existing footprint when the netlist gives a different footprint") ); m_ChangeExistingFootprintCtrl->SetToolTip( _("Keep or change an existing footprint when the netlist gives a different footprint") );
bLeftSizer->Add( m_ChangeExistingFootprintCtrl, 0, wxALL|wxEXPAND, 5 ); bLeftSizer->Add( m_ChangeExistingFootprintCtrl, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
bUpperSizer->Add( bLeftSizer, 1, wxEXPAND, 5 ); bUpperSizer->Add( bLeftSizer, 1, wxEXPAND, 5 );
...@@ -50,7 +58,7 @@ DIALOG_NETLIST_FBP::DIALOG_NETLIST_FBP( wxWindow* parent, wxWindowID id, const w ...@@ -50,7 +58,7 @@ DIALOG_NETLIST_FBP::DIALOG_NETLIST_FBP( wxWindow* parent, wxWindowID id, const w
m_DeleteBadTracks->SetSelection( 0 ); m_DeleteBadTracks->SetSelection( 0 );
m_DeleteBadTracks->SetToolTip( _("Keep or delete bad tracks after a netlist change") ); m_DeleteBadTracks->SetToolTip( _("Keep or delete bad tracks after a netlist change") );
bMiddleSizer->Add( m_DeleteBadTracks, 0, wxALL|wxEXPAND, 5 ); bMiddleSizer->Add( m_DeleteBadTracks, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
wxString m_RemoveExtraFootprintsCtrlChoices[] = { _("Keep"), _("Delete") }; wxString m_RemoveExtraFootprintsCtrlChoices[] = { _("Keep"), _("Delete") };
int m_RemoveExtraFootprintsCtrlNChoices = sizeof( m_RemoveExtraFootprintsCtrlChoices ) / sizeof( wxString ); int m_RemoveExtraFootprintsCtrlNChoices = sizeof( m_RemoveExtraFootprintsCtrlChoices ) / sizeof( wxString );
...@@ -67,23 +75,23 @@ DIALOG_NETLIST_FBP::DIALOG_NETLIST_FBP( wxWindow* parent, wxWindowID id, const w ...@@ -67,23 +75,23 @@ DIALOG_NETLIST_FBP::DIALOG_NETLIST_FBP( wxWindow* parent, wxWindowID id, const w
bRightSizerButtons = new wxBoxSizer( wxVERTICAL ); bRightSizerButtons = new wxBoxSizer( wxVERTICAL );
m_buttonBrowse = new wxButton( this, ID_OPEN_NELIST, _("Browse Netlist Files"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonBrowse = new wxButton( this, ID_OPEN_NELIST, _("Browse Netlist Files"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizerButtons->Add( m_buttonBrowse, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); bRightSizerButtons->Add( m_buttonBrowse, 0, wxEXPAND|wxALL, 5 );
m_buttonRead = new wxButton( this, ID_READ_NETLIST_FILE, _("Read Current Netlist"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonRead = new wxButton( this, ID_READ_NETLIST_FILE, _("Read Current Netlist"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonRead->SetDefault(); m_buttonRead->SetDefault();
m_buttonRead->SetToolTip( _("Read the current netlist and update connections and connectivity info") ); m_buttonRead->SetToolTip( _("Read the current netlist and update connections and connectivity info") );
bRightSizerButtons->Add( m_buttonRead, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); bRightSizerButtons->Add( m_buttonRead, 0, wxEXPAND|wxALL, 5 );
m_buttonFPTest = new wxButton( this, ID_TEST_NETLIST, _("Footprints Test"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonFPTest = new wxButton( this, ID_TEST_NETLIST, _("Footprints Test"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonFPTest->SetToolTip( _("Read the current neltist file and list missing and extra footprints") ); m_buttonFPTest->SetToolTip( _("Read the current neltist file and list missing and extra footprints") );
bRightSizerButtons->Add( m_buttonFPTest, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); bRightSizerButtons->Add( m_buttonFPTest, 0, wxEXPAND|wxALL, 5 );
m_buttonRebild = new wxButton( this, ID_COMPILE_RATSNEST, _("Rebuild Board Connectivity"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonRebild = new wxButton( this, ID_COMPILE_RATSNEST, _("Rebuild Board Connectivity"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonRebild->SetToolTip( _("Rebuild the full ratsnest (usefull after a manual pad netname edition)") ); m_buttonRebild->SetToolTip( _("Rebuild the full ratsnest (usefull after a manual pad netname edition)") );
bRightSizerButtons->Add( m_buttonRebild, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); bRightSizerButtons->Add( m_buttonRebild, 0, wxEXPAND|wxALL, 5 );
m_buttonClose = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonClose = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizerButtons->Add( m_buttonClose, 0, wxALL|wxEXPAND, 5 ); bRightSizerButtons->Add( m_buttonClose, 0, wxALL|wxEXPAND, 5 );
...@@ -102,6 +110,7 @@ DIALOG_NETLIST_FBP::DIALOG_NETLIST_FBP( wxWindow* parent, wxWindowID id, const w ...@@ -102,6 +110,7 @@ DIALOG_NETLIST_FBP::DIALOG_NETLIST_FBP( wxWindow* parent, wxWindowID id, const w
bMainSizer->Add( m_staticTextNetfilename, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); bMainSizer->Add( m_staticTextNetfilename, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_NetlistFilenameCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_NetlistFilenameCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_NetlistFilenameCtrl->SetMaxLength( 0 );
bMainSizer->Add( m_NetlistFilenameCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bMainSizer->Add( m_NetlistFilenameCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText1 = new wxStaticText( this, wxID_ANY, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 );
...@@ -109,6 +118,7 @@ DIALOG_NETLIST_FBP::DIALOG_NETLIST_FBP( wxWindow* parent, wxWindowID id, const w ...@@ -109,6 +118,7 @@ DIALOG_NETLIST_FBP::DIALOG_NETLIST_FBP( wxWindow* parent, wxWindowID id, const w
bMainSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); bMainSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_MessageWindow = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_CHARWRAP|wxTE_MULTILINE|wxTE_READONLY|wxTE_WORDWRAP ); m_MessageWindow = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_CHARWRAP|wxTE_MULTILINE|wxTE_READONLY|wxTE_WORDWRAP );
m_MessageWindow->SetMaxLength( 0 );
m_MessageWindow->SetMinSize( wxSize( -1,200 ) ); m_MessageWindow->SetMinSize( wxSize( -1,200 ) );
bMainSizer->Add( m_MessageWindow, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bMainSizer->Add( m_MessageWindow, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
......
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxRadioBox" expanded="1"> <object class="wxRadioBox" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
...@@ -201,7 +201,97 @@ ...@@ -201,7 +201,97 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxRadioBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices">&quot;From netlist&quot; &quot;From separate .cmp file&quot;</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Module Name Source:</property>
<property name="majorDimension">1</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_cmpNameSourceOpt</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">0</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Source of footprints names for component:&#x0A;- the netlist (if you have filled the footprint field of each component in schematic)&#x0A;- the .cmp file created by CvPcb</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRadioBox"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxRadioBox" expanded="1"> <object class="wxRadioBox" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
...@@ -302,7 +392,7 @@ ...@@ -302,7 +392,7 @@
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxRadioBox" expanded="1"> <object class="wxRadioBox" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
...@@ -493,7 +583,7 @@ ...@@ -493,7 +583,7 @@
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property> <property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxButton" expanded="1"> <object class="wxButton" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
...@@ -581,7 +671,7 @@ ...@@ -581,7 +671,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property> <property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxButton" expanded="1"> <object class="wxButton" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
...@@ -669,7 +759,7 @@ ...@@ -669,7 +759,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property> <property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxButton" expanded="1"> <object class="wxButton" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
...@@ -757,7 +847,7 @@ ...@@ -757,7 +847,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property> <property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxButton" expanded="1"> <object class="wxButton" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012) // C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h" #include "dialog_shim.h"
#include <wx/string.h> #include <wx/string.h>
#include <wx/radiobox.h> #include <wx/radiobox.h>
...@@ -44,6 +46,7 @@ class DIALOG_NETLIST_FBP : public DIALOG_SHIM ...@@ -44,6 +46,7 @@ class DIALOG_NETLIST_FBP : public DIALOG_SHIM
}; };
wxRadioBox* m_Select_By_Timestamp; wxRadioBox* m_Select_By_Timestamp;
wxRadioBox* m_cmpNameSourceOpt;
wxRadioBox* m_ChangeExistingFootprintCtrl; wxRadioBox* m_ChangeExistingFootprintCtrl;
wxRadioBox* m_DeleteBadTracks; wxRadioBox* m_DeleteBadTracks;
wxRadioBox* m_RemoveExtraFootprintsCtrl; wxRadioBox* m_RemoveExtraFootprintsCtrl;
......
...@@ -87,25 +87,25 @@ static FILE* OpenNetlistFile( const wxString& aFullFileName ) ...@@ -87,25 +87,25 @@ static FILE* OpenNetlistFile( const wxString& aFullFileName )
/** /* Update footprints (load missing footprints and delete on request extra footprints)
* Function ReadPcbNetlist
* Update footprints (load missing footprints and delete on request extra
* footprints)
* Update connectivity info ( Net Name list ) * Update connectivity info ( Net Name list )
* Update Reference, value and "TIME STAMP" * Update Reference, value and "TIME STAMP"
* @param aNetlistFullFilename = netlist file name (*.net) * param aNetlistFullFilename = netlist file name (*.net)
* @param aCmpFullFileName = cmp/footprint list file name (*.cmp) if not found, * param aCmpFullFileName = cmp/footprint list file name (*.cmp) if not found,
* @param aMessageWindow = a wxTextCtrl to print messages (can be NULL). * param aMessageWindow = a wxTextCtrl to print messages (can be NULL).
* @param aChangeFootprint = true to change existing footprints * param aChangeFootprint = true to change existing footprints
* when the netlist gives a different footprint. * when the netlist gives a different footprint.
* false to keep existing footprints * false to keep existing footprints
* @param aDeleteBadTracks - true to erase erroneous tracks after updating connectivity info. * param aDeleteBadTracks - true to erase erroneous tracks after updating connectivity info.
* @param aDeleteExtraFootprints - true to remove unlocked footprints found on board but not * param aDeleteExtraFootprints - true to remove unlocked footprints found on board but not
* in netlist. * in netlist.
* @param aSelect_By_Timestamp - true to use schematic timestamps instead of schematic references * param aSelect_By_Timestamp - true to use schematic timestamps instead of schematic references
* to identify footprints on board * to identify footprints on board
* (Must be used after a full reannotation in schematic). * (Must be used after a full reannotation in schematic).
* @return true if Ok * param aUseCmpFileForFootprintsNames = false to use only the netlist to know the
* fontprint names of each component.
* = true to use the .cmp file created by CvPcb
* return true if Ok
*/ */
bool PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFullFilename, bool PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFullFilename,
const wxString& aCmpFullFileName, const wxString& aCmpFullFileName,
...@@ -121,8 +121,7 @@ bool PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFullFilename, ...@@ -121,8 +121,7 @@ bool PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFullFilename,
return false; return false;
SetLastNetListRead( aNetlistFullFilename ); SetLastNetListRead( aNetlistFullFilename );
bool useCmpfile = !aCmpFullFileName.IsEmpty() && wxFileExists( aCmpFullFileName );
bool useCmpfile = ! aCmpFullFileName.IsEmpty() && wxFileExists( aCmpFullFileName );
if( aMessageWindow ) if( aMessageWindow )
{ {
......
...@@ -393,7 +393,7 @@ MODULE* NETLIST_READER::FindModule( const wxString& aId ) ...@@ -393,7 +393,7 @@ MODULE* NETLIST_READER::FindModule( const wxString& aId )
* *
* Sample file: * Sample file:
* *
* Cmp-Mod V01 Genere by Pcbnew 29/10/2003-13: 11:6 * * Cmp-Mod V01 Genere by CvPcb 29/10/2003-13: 11:6 *
* BeginCmp * BeginCmp
* TimeStamp = /32307DE2/AA450F67; * TimeStamp = /32307DE2/AA450F67;
* Reference = C1; * Reference = C1;
......
...@@ -289,6 +289,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title, ...@@ -289,6 +289,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
m_hasAutoSave = true; m_hasAutoSave = true;
m_RecordingMacros = -1; m_RecordingMacros = -1;
m_microWaveToolBar = NULL; m_microWaveToolBar = NULL;
m_useCmpFileForFpNames = true;
#ifdef KICAD_SCRIPTING_WXPYTHON #ifdef KICAD_SCRIPTING_WXPYTHON
m_pythonPanel = NULL; m_pythonPanel = NULL;
#endif #endif
......
...@@ -303,6 +303,8 @@ PARAM_CFG_ARRAY PCB_EDIT_FRAME::GetProjectFileParameters() ...@@ -303,6 +303,8 @@ PARAM_CFG_ARRAY PCB_EDIT_FRAME::GetProjectFileParameters()
pca.push_back( new PARAM_CFG_FILENAME( wxT( "LastNetListRead" ), pca.push_back( new PARAM_CFG_FILENAME( wxT( "LastNetListRead" ),
&m_lastNetListRead ) ); &m_lastNetListRead ) );
pca.push_back( new PARAM_CFG_BOOL( wxT( "UseCmpFile" ),
&m_useCmpFileForFpNames, true ) );
GetBoard()->GetDesignSettings().AppendConfigs( &pca ); GetBoard()->GetDesignSettings().AppendConfigs( &pca );
return pca; return pca;
......
...@@ -456,13 +456,11 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ) ...@@ -456,13 +456,11 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
// In very rare cases, the next calculation crashes when Pcbnew is in nanometers. // In very rare cases, the next calculation crashes when Pcbnew is in nanometers.
// the crash is inside boost::polygon (tested with version 1.49 and 1.53, // the crash is inside boost::polygon (tested with version 1.49 and 1.53,
// so this crash is nearly impossible to fix // so this crash is nearly impossible to fix
// However it seems happen when subtracting polygons having exactly the sane edges // and a workaround is here to combine the polygons to substract, to modify
// and a workaround therefore is to slightly expand the polygons to substract. // the geometry of the polygons to substract, because
// This is not so bad, because it ensures stubs are fully removed. // the 2 known cases are related to 2 rectangular overlapping rect to substract
// The shapes are expanded by 1 micrometer, so this creates no noticeable change // with a given geometry
const int expand_value = (int) (0.001 * IU_PER_MM ); KI_POLYGON_SET dummy; polyset_holes += dummy;
if( expand_value )
polyset_holes += expand_value;
// Remove unconnected stubs // Remove unconnected stubs
polyset_zone_solid_areas -= polyset_holes; polyset_zone_solid_areas -= polyset_holes;
......
...@@ -116,7 +116,8 @@ void BuildUnconnectedThermalStubsPolygonList( std::vector<CPolyPt>& aCornerBuffe ...@@ -116,7 +116,8 @@ void BuildUnconnectedThermalStubsPolygonList( std::vector<CPolyPt>& aCornerBuffe
startpoint.x /= 2; startpoint.x /= 2;
startpoint.y /= 2; startpoint.y /= 2;
// This is CIRCLE pad tweak (for circle pads the thermal stubs are at 45 deg) // This is a CIRCLE pad tweak
// for circle pads, the thermal stubs orientation is 45 deg
int fAngle = pad->GetOrientation(); int fAngle = pad->GetOrientation();
if( pad->GetShape() == PAD_CIRCLE ) if( pad->GetShape() == PAD_CIRCLE )
{ {
......
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