38#include <boost/property_tree/ptree.hpp> 
   41#include <wx/choicdlg.h> 
   42#include <wx/filedlg.h> 
   50    bool               isChanged = 
false;
 
   52    m_frame->Schematic().Hierarchy().GetSymbols( refs, 
false );
 
   61        CPTREE& back_anno = doc.get_child( 
"cvpcb_netlist" );
 
   64        for( PTREE::const_iterator ref = back_anno.begin();  ref != back_anno.end();  ++ref )
 
   66            wxASSERT( ref->first == 
"ref" );
 
   68            wxString reference = 
UTF8( ref->second.front().first );
 
   71            if( ref->second.get_child( 
"fpid" ).size() )
 
   73                wxString tmp = 
UTF8( ref->second.get_child( 
"fpid" ).front().first );
 
   80            for( 
unsigned ii = 0;  ii < refs.
GetCount();  ++ii )
 
   82                if( reference == refs[ii].GetRef() )
 
   91                    wxString        oldfp = refs[ii].GetFootprint();
 
   94                    if( oldfp.IsEmpty() && footprintField->
IsVisible() )
 
   97                    if( oldfp != footprint )
 
  100                        SCH_SCREEN* screen = refs[ii].GetSheetPath().LastScreen();
 
  103                        footprintField->
SetText( footprint );
 
  118        commit.
Push( wxS( 
"Assign Footprints" ) );
 
 
  124                                                        bool aForceVisibilityState,
 
  125                                                        bool aVisibilityState )
 
  129    m_frame->Schematic().Hierarchy().GetSymbols( referencesList, 
false );
 
  131    FILE* cmpFile = wxFopen( aFullFilename, wxT( 
"rt" ) );
 
  133    if( cmpFile == 
nullptr )
 
  150        if( !buffer.StartsWith( wxT( 
"BeginCmp" ) ) )
 
  161            if( buffer.StartsWith( wxT( 
"EndCmp" ) ) )
 
  165            value = buffer.AfterFirst( 
'=' );
 
  166            value = value.BeforeLast( 
';' );
 
  170            if( buffer.StartsWith( wxT( 
"Reference" ) ) )
 
  172            else if( buffer.StartsWith( wxT( 
"IdModule" ) ) )
 
  178        if( reference.IsEmpty() )
 
  182        for( 
unsigned ii = 0;  ii < referencesList.
GetCount();  ii++ )
 
  184            if( reference == referencesList[ii].GetRef() )
 
  189                SCH_SYMBOL* symbol = referencesList[ ii ].GetSymbol();
 
  193                if( aForceVisibilityState )
 
 
  205    wxString 
path = wxPathOnly( 
m_frame->Prj().GetProjectFullName() );
 
  207    wxFileDialog dlg( 
m_frame, 
_( 
"Load Symbol Footprint Link File" ),
 
  210                      wxFD_OPEN | wxFD_FILE_MUST_EXIST );
 
  212    if( dlg.ShowModal() == wxID_CANCEL )
 
  215    wxString filename = dlg.GetPath();
 
  217    wxArrayString choices;
 
  218    choices.Add( 
_( 
"Keep existing footprint field visibility" ) );
 
  219    choices.Add( 
_( 
"Show all footprint fields" ) );
 
  220    choices.Add( 
_( 
"Hide all footprint fields" ) );
 
  222    wxSingleChoiceDialog choiceDlg( 
m_frame, 
_( 
"Select the footprint field visibility setting." ),
 
  223                                    _( 
"Change Visibility" ), choices );
 
  225    if( choiceDlg.ShowModal() == wxID_CANCEL )
 
  228    bool forceVisibility = (choiceDlg.GetSelection() != 0 );
 
  229    bool visibilityState = (choiceDlg.GetSelection() == 1 );
 
  233        wxString msg = wxString::Format( 
_( 
"Failed to open symbol-footprint link file '%s'." ),
 
  234                                         filename.GetData() );
 
  241    m_frame->GetCanvas()->Refresh();
 
 
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
 
Implement a lexical analyzer for the SPECCTRA DSN file format.
 
virtual bool IsVisible() const
 
virtual void SetVisible(bool aVisible)
 
A LINE_READER that reads from an open file.
 
char * ReadLine() override
Read a line of text into the buffer and increments the line number counter.
 
char * Line() const
Return a pointer to the last line that was read in.
 
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Execute the changes.
 
void AssignFootprints(const std::string &aChangedSetOfReferences)
 
int ImportFPAssignments(const TOOL_EVENT &aEvent)
 
bool processCmpToFootprintLinkFile(const wxString &aFullFilename, bool aForceVisibilityState, bool aVisibilityState)
Read the footprint info from each line in the stuff file by reference designator.
 
void SetText(const wxString &aText) override
 
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
 
void SetFootprintFieldText(const wxString &aFootprint)
 
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
 
An 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to and fro...
 
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
 
This file is part of the common library.
 
static wxString FootprintAssignmentFileWildcard()
 
#define THROW_IO_ERROR(msg)
macro which captures the "call site" values of FILE_, __FUNCTION & LINE
 
void Scan(PTREE *aTree, DSNLEXER *aLexer)
Fill an empty PTREE with information from a KiCad s-expression stream.
 
boost::property_tree::ptree_error PTREE_ERROR
 
boost::property_tree::ptree PTREE
 
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
 
wxString From_UTF8(const char *cstring)
 
@ FOOTPRINT
Field Name Module PCB, i.e. "16DIP300".
 
Definition of file extensions used in Kicad.