37 #include <boost/property_tree/ptree.hpp> 38 #include <wx/choicdlg.h> 47 bool isChanged =
false;
58 CPTREE& back_anno = doc.get_child(
"cvpcb_netlist" );
61 for( PTREE::const_iterator ref = back_anno.begin(); ref != back_anno.end(); ++ref )
63 wxASSERT( ref->first ==
"ref" );
65 wxString reference = (
UTF8&) ref->second.front().first;
68 if( ref->second.get_child(
"fpid" ).size() )
70 wxString tmp = (
UTF8&) ref->second.get_child(
"fpid" ).front().first;
77 for(
unsigned ii = 0; ii < refs.
GetCount(); ++ii )
79 if( reference == refs[ii].GetRef() )
88 wxString oldfp = refs[ii].GetFootprint();
93 if( oldfp != footprint )
118 bool aForceVisibilityState,
119 bool aVisibilityState )
125 sheetList.
GetSymbols( referencesList,
false );
127 FILE* cmpFile = wxFopen( aFullFilename, wxT(
"rt" ) );
129 if( cmpFile ==
NULL )
146 if( !buffer.StartsWith( wxT(
"BeginCmp" ) ) )
157 if( buffer.StartsWith( wxT(
"EndCmp" ) ) )
161 value = buffer.AfterFirst(
'=' );
162 value = value.BeforeLast(
';' );
166 if( buffer.StartsWith( wxT(
"Reference" ) ) )
168 else if( buffer.StartsWith( wxT(
"IdModule" ) ) )
174 if( reference.IsEmpty() )
178 for(
unsigned ii = 0; ii < referencesList.
GetCount(); ii++ )
180 if( reference == referencesList[ii].GetRef() )
190 if( aForceVisibilityState )
204 wxFileDialog dlg(
m_frame,
_(
"Load Symbol Footprint Link File" ),
207 wxFD_OPEN | wxFD_FILE_MUST_EXIST );
209 if( dlg.ShowModal() == wxID_CANCEL )
212 wxString filename = dlg.GetPath();
214 wxArrayString choices;
215 choices.Add(
_(
"Keep existing footprint field visibility" ) );
216 choices.Add(
_(
"Show all footprint fields" ) );
217 choices.Add(
_(
"Hide all footprint fields" ) );
219 wxSingleChoiceDialog choiceDlg(
m_frame,
_(
"Select the footprint field visibility setting." ),
220 _(
"Change Visibility" ), choices );
222 if( choiceDlg.ShowModal() == wxID_CANCEL )
225 bool forceVisibility = (choiceDlg.GetSelection() != 0 );
226 bool visibilityState = (choiceDlg.GetSelection() == 1 );
230 wxString msg =
wxString::Format(
_(
"Failed to open component-footprint link file \"%s\"" ),
231 filename.GetData() );
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
An 8 bit string that is assuredly encoded in UTF8, and supplies special conversion support to and fro...
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
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.
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
SCH_FIELD * GetField(MANDATORY_FIELD_T aFieldType)
Returns a mandatory field in this symbol.
void GetSymbols(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanComponents=false) const
Add a SCH_REFERENCE object to aReferences for each component in the list of sheets.
This file is part of the common library.
wxString ComponentFileWildcard()
void Scan(PTREE *aTree, DSNLEXER *aLexer)
Fill an empty PTREE with information from a KiCad s-expression stream.
void SetVisible(bool aVisible)
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
boost::property_tree::ptree PTREE
A LINE_READER that reads from an open file.
void SyncView()
Mark all items for refresh.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
bool processCmpToFootprintLinkFile(const wxString &aFullFilename, bool aForceVisibilityState, bool aVisibilityState)
Read the footprint info from each line in the stuff file by reference designator.
SCHEMATIC & Schematic() const
Definition of file extensions used in Kicad.
int ImportFPAssignments(const TOOL_EVENT &aEvent)
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
boost::property_tree::ptree_error PTREE_ERROR
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
unsigned GetCount() const
SCH_SHEET_LIST GetSheets() const override
Builds and returns an updated schematic hierarchy TODO: can this be cached?
void AssignFootprints(const std::string &aChangedSetOfReferences)
void OnModify() override
Must be called after a schematic change in order to set the "modify" flag of the current screen and u...
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
#define THROW_IO_ERROR(msg)
Implement a lexical analyzer for the SPECCTRA DSN file format.
void SetFootprint(const SCH_SHEET_PATH *sheet, const wxString &aFootprint)
Field Name Module PCB, i.e. "16DIP300".