37#include <boost/property_tree/ptree.hpp>
40#include <wx/choicdlg.h>
41#include <wx/filedlg.h>
48 bool isChanged =
false;
49 bool appendToUndoList =
false;
60 CPTREE& back_anno = doc.get_child(
"cvpcb_netlist" );
63 for( PTREE::const_iterator ref = back_anno.begin(); ref != back_anno.end(); ++ref )
65 wxASSERT( ref->first ==
"ref" );
67 wxString reference = (
UTF8&) ref->second.front().first;
70 if( ref->second.get_child(
"fpid" ).size() )
72 wxString tmp = (
UTF8&) ref->second.get_child(
"fpid" ).front().first;
79 for(
unsigned ii = 0; ii < refs.
GetCount(); ++ii )
81 if( reference == refs[ii].GetRef() )
90 wxString oldfp = refs[ii].GetFootprint();
95 if( oldfp != footprint )
98 SCH_SCREEN* screen = refs[ii].GetSheetPath().LastScreen();
101 appendToUndoList,
false );
102 appendToUndoList =
true;
126 bool aForceVisibilityState,
127 bool aVisibilityState )
133 FILE* cmpFile = wxFopen( aFullFilename, wxT(
"rt" ) );
135 if( cmpFile ==
nullptr )
152 if( !buffer.StartsWith( wxT(
"BeginCmp" ) ) )
163 if( buffer.StartsWith( wxT(
"EndCmp" ) ) )
167 value = buffer.AfterFirst(
'=' );
168 value = value.BeforeLast(
';' );
172 if( buffer.StartsWith( wxT(
"Reference" ) ) )
174 else if( buffer.StartsWith( wxT(
"IdModule" ) ) )
180 if( reference.IsEmpty() )
184 for(
unsigned ii = 0; ii < referencesList.
GetCount(); ii++ )
186 if( reference == referencesList[ii].GetRef() )
191 SCH_SYMBOL* symbol = referencesList[ ii ].GetSymbol();
195 if( aForceVisibilityState )
209 wxFileDialog dlg(
m_frame,
_(
"Load Symbol Footprint Link File" ),
212 wxFD_OPEN | wxFD_FILE_MUST_EXIST );
214 if( dlg.ShowModal() == wxID_CANCEL )
217 wxString filename = dlg.GetPath();
219 wxArrayString choices;
220 choices.Add(
_(
"Keep existing footprint field visibility" ) );
221 choices.Add(
_(
"Show all footprint fields" ) );
222 choices.Add(
_(
"Hide all footprint fields" ) );
224 wxSingleChoiceDialog choiceDlg(
m_frame,
_(
"Select the footprint field visibility setting." ),
225 _(
"Change Visibility" ), choices );
227 if( choiceDlg.ShowModal() == wxID_CANCEL )
230 bool forceVisibility = (choiceDlg.GetSelection() != 0 );
231 bool visibilityState = (choiceDlg.GetSelection() == 1 );
235 wxString msg = wxString::Format(
_(
"Failed to open symbol-footprint link file '%s'." ),
236 filename.GetData() );
Implement a lexical analyzer for the SPECCTRA DSN file format.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
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.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
char * Line() const
Return a pointer to the last line that was read in.
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
SCH_SHEET_LIST Hierarchy() const override
Return the full schematic flattened hierarchical sheet list.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void SyncView()
Mark all items for refresh.
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 OnModify() override
Must be called after a schematic change in order to set the "modify" flag and update other data struc...
void SaveCopyInUndoList(SCH_SCREEN *aScreen, SCH_ITEM *aItemToCopy, UNDO_REDO aTypeCommand, bool aAppend, bool aDirtyConnectivity=true)
Create a copy of the current schematic item, and put it in the undo list.
SCHEMATIC & Schematic() const
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used ...
void GetSymbols(SCH_REFERENCE_LIST &aReferences, bool aIncludePowerSymbols=true, bool aForceIncludeOrphanSymbols=false) const
Add a SCH_REFERENCE object to aReferences for each symbol in the list of sheets.
SCH_FIELD * GetField(MANDATORY_FIELD_T aFieldType)
Return a mandatory field in this symbol.
void SetFootprintFieldText(const wxString &aFootprint)
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, int aDisplayTime)
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)
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
Field Name Module PCB, i.e. "16DIP300".
Definition of file extensions used in Kicad.