25 #include <wx/clipbrd.h> 64 if( aSelected.
Empty() )
76 const FOOTPRINT* footprint = static_cast<FOOTPRINT*>( aSelected.
Front() );
80 for(
PAD* pad : newFootprint.Pads() )
84 newFootprint.SetLocked(
false );
87 newFootprint.Move( wxPoint( -refPoint.
x, -refPoint.
y ) );
89 Format( static_cast<BOARD_ITEM*>( &newFootprint ) );
91 else if( isFootprintEditor )
100 partialFootprint.
SetFPID(
id );
102 for(
const EDA_ITEM* item : aSelected )
104 const PCB_GROUP* group = dynamic_cast<const PCB_GROUP*>( item );
108 clone = static_cast<BOARD_ITEM*>( group->
DeepClone() );
110 clone = static_cast<BOARD_ITEM*>( item->Clone() );
113 if(
PAD* pad = dyn_cast<PAD*>( clone ) )
114 pad->SetNetCode( 0 );
118 partialFootprint.
Add( clone );
122 static_cast<PCB_GROUP*>( clone )->RunOnDescendants(
125 partialFootprint.
Add( descendant );
130 clone->Move( (wxPoint) -refPoint );
139 Format( &partialFootprint, 0 );
159 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( i );
172 FP_TEXT* fp_text = static_cast<FP_TEXT*>( item );
175 if( fp_text->GetText() ==
"${VALUE}" )
177 else if( fp_text->GetText() ==
"${REFERENCE}" )
183 pcb_text->
SetLayer( fp_text->GetLayer() );
194 footprint->
Add( pad );
206 copy = static_cast<PCB_GROUP*>( item )->DeepClone();
210 copy = static_cast<BOARD_ITEM*>( item->
Clone() );
223 copy->
Move( (wxPoint) -refPoint );
229 static_cast<PCB_GROUP*>( copy )->RunOnDescendants( prepItem );
230 static_cast<PCB_GROUP*>( copy )->RunOnDescendants( [&](
BOARD_ITEM* titem )
244 auto clipboard = wxTheClipboard;
245 wxClipboardLocker clipboardLock( clipboard );
247 if( !clipboardLock || !clipboard->IsOpened() )
263 if( clipboard->IsSupported( wxDF_TEXT ) )
265 wxTextDataObject data;
266 clipboard->GetData( data );
267 ( void )data.GetText();
280 auto clipboard = wxTheClipboard;
281 wxClipboardLocker clipboardLock( clipboard );
286 if( clipboard->IsSupported( wxDF_TEXT ) )
288 wxTextDataObject data;
289 clipboard->GetData( data );
290 result = data.GetText();
328 auto clipboard = wxTheClipboard;
329 wxClipboardLocker clipboardLock( clipboard );
334 clipboard->SetData(
new wxTextDataObject(
342 if( clipboard->IsSupported( wxDF_TEXT ) )
344 wxTextDataObject data;
345 clipboard->GetData( data );
346 ( void )data.GetText();
358 auto clipboard = wxTheClipboard;
359 wxClipboardLocker clipboardLock( clipboard );
364 if( clipboard->IsSupported( wxDF_TEXT ) )
366 wxTextDataObject data;
367 clipboard->GetData( data );
369 result = data.GetText().mb_str();
408 board = dynamic_cast<BOARD*>( item );
412 if( board && !aAppendToMe )
VECTOR2I GetReferencePoint() const
OUTPUTFORMATTER * m_out
output any Format()s to this, no ownership
BOARD_ITEM * Parse(const wxString &aClipboardSourceInput)
A PLUGIN derivation for saving and loading Pcbnew s-expression formatted files.
class FP_TEXT, text in a footprint
Container for project specific data.
void formatBoardLayers(const BOARD *aBoard, int aNestLevel=0) const
formats the board layer information
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
void CopyText(const EDA_TEXT &aSrc)
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
class PCB_GROUP, a set of BOARD_ITEMs
void Save(const wxString &aFileName, BOARD *aBoard, const PROPERTIES *aProperties=nullptr) override
Write aBoard to a storage file in a format that this PLUGIN implementation knows about or it can be u...
A set of BOARD_ITEMs (i.e., without duplicates).
void init(const PROPERTIES *aProperties)
void SetEffects(const EDA_TEXT &aSrc)
Set the text effects from another instance.
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
PCB_GROUP * DeepClone() const
class FP_SHAPE, a footprint edge
class PAD, a pad in a footprint
virtual void SetLocked(bool aLocked)
Modify the 'lock' status for of the item.
STRING_FORMATTER m_formatter
A logical library item identifier and consists of various portions much like a URI.
A name/value tuple with unique names and optional values.
void SetBoard(BOARD *aBoard)
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
void SetBoard(const BOARD *aBoard)
Set a BOARD object that is used to prepare the net code map.
#define CTL_FOR_CLIPBOARD
Format output for the clipboard instead of footprint library or BOARD.
wxString GetRequiredVersion()
Return a string representing the version of KiCad required to open this file.
#define THROW_PARSE_ERROR(aProblem, aSource, aInputLine, aLineNumber, aByteIndex)
void SetBoard(BOARD *aBoard)
virtual void SetText(const wxString &aText)
void SetPos0(const wxPoint &aPos)
virtual void Move(const wxPoint &aMoveVector)
Move this object.
FOOTPRINTS & Footprints()
void formatNetInformation(const BOARD *aBoard, int aNestLevel=0) const
formats the Nets and Netclasses
void InitDataFromSrcInCopyCtor(const ZONE &aZone)
Copy aZone data to me.
ZONE handles a list of polygons defining a copper zone.
void SetFileName(const wxString &aFileName)
BOARD * Load(const wxString &aFileName, BOARD *aAppendToMe, const PROPERTIES *aProperties=nullptr, PROJECT *aProject=nullptr) override
Load information from some input file format that this PLUGIN implementation knows about into either ...
NETINFO_MAPPING * m_mapping
mapping for net codes, so only not empty net codes are stored with consecutive integers as net codes
LINE_READER * SetLineReader(LINE_READER *aReader)
Set aLineReader into the parser, and returns the previous one, if any.
bool Empty() const
Checks if there is anything selected.
class FOOTPRINT, a footprint
void Format(const BOARD_ITEM *aItem, int aNestLevel=0) const
Output aItem to aFormatter in s-expression format.
bool IsTooRecent()
Return whether a version number, if any was parsed, was too recent.
A filename or source description, a problem input line, a line number, a byte offset,...
bool HasReferencePoint() const
wxPoint GetPosition() const override
Information pertinent to a Pcbnew printed circuit board.
#define SEXPR_BOARD_FILE_VERSION
Current s-expression file format version. 2 was the last legacy format version.
class ZONE, managed by a footprint
BOARD * m_board
which BOARD, no ownership here
int Size() const
Returns the number of selected parts.
A base class for most all the KiCad significant classes used in schematics and boards.
Pcbnew s-expression file format parser definition.
void SaveSelection(const PCB_SELECTION &selected, bool isFootprintEditor)
BOARD_ITEM_CONTAINER * GetParent() const
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
KICAD_T Type() const
Returns the type of object.