26#include <wx/clipbrd.h>
69 if( aSelected.
Empty() )
99 else if( isFootprintEditor )
108 partialFootprint.
SetFPID(
id );
110 for(
const EDA_ITEM* item : aSelected )
116 wxCHECK2( boardItem,
continue );
120 if( field->IsMandatoryField() )
130 if(
PAD*
pad =
dynamic_cast<PAD*
>( clone ) )
131 pad->SetNetCode( 0 );
139 partialFootprint.
Add( clone );
143 std::vector<BOARD_ITEM*> skipped_items;
147 static_cast<PCB_GROUP*
>( clone )->RunOnDescendants(
156 if( field->IsMandatoryField() )
161 partialFootprint.
Add( descendant );
163 skipped_items.push_back( descendant );
168 clone->
Move( -refPoint );
173 skp_item->SetParentGroup(
nullptr );
184 Format( &partialFootprint, 0 );
209 wxCHECK2( boardItem,
continue );
217 if( textItem->
GetText() == wxT(
"${VALUE}" ) )
219 else if( textItem->
GetText() == wxT(
"${REFERENCE}" ) )
251 copy->Move( -refPoint );
257 static_cast<PCB_GROUP*
>(
copy )->RunOnDescendants( prepItem );
264 copy->SetParentGroup(
nullptr );
273 auto clipboard = wxTheClipboard;
274 wxClipboardLocker clipboardLock( clipboard );
276 if( !clipboardLock || !clipboard->IsOpened() )
292 if( clipboard->IsSupported( wxDF_TEXT ) || clipboard->IsSupported( wxDF_UNICODETEXT ) )
294 wxTextDataObject data;
295 clipboard->GetData( data );
309 auto clipboard = wxTheClipboard;
310 wxClipboardLocker clipboardLock( clipboard );
315 if( clipboard->IsSupported( wxDF_TEXT ) || clipboard->IsSupported( wxDF_UNICODETEXT ) )
317 wxTextDataObject data;
318 clipboard->GetData( data );
319 result = data.GetText();
357 auto clipboard = wxTheClipboard;
358 wxClipboardLocker clipboardLock( clipboard );
363 clipboard->SetData(
new wxTextDataObject(
371 if( clipboard->IsSupported( wxDF_TEXT ) || clipboard->IsSupported( wxDF_UNICODETEXT ) )
373 wxTextDataObject data;
374 clipboard->GetData( data );
388 auto clipboard = wxTheClipboard;
389 wxClipboardLocker clipboardLock( clipboard );
394 if( clipboard->IsSupported( wxDF_TEXT ) || clipboard->IsSupported( wxDF_UNICODETEXT ) )
396 wxTextDataObject data;
397 clipboard->GetData( data );
399 result = data.GetText().mb_str();
402 std::function<bool( wxString,
int, wxString, wxString )> queryUser =
403 [&]( wxString aTitle,
int aIcon, wxString aMessage, wxString aAction ) ->
bool
405 KIDIALOG dlg(
nullptr, aMessage, aTitle, wxOK | wxCANCEL | aIcon );
407 if( !aAction.IsEmpty() )
408 dlg.SetOKLabel( aAction );
416 PCB_PARSER parser( &reader, aAppendToMe, queryUser );
425 item = parser.
Parse();
443 THROW_PARSE_ERROR(
_(
"Clipboard content is not KiCad compatible" ), parser.CurSource(),
444 parser.CurLine(), parser.CurLineNumber(), parser.CurOffset() );
448 board =
dynamic_cast<BOARD*
>( item );
452 if( board && !aAppendToMe )
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
void SetParentGroup(PCB_GROUP *aGroup)
virtual void SetLocked(bool aLocked)
virtual void Move(const VECTOR2I &aMoveVector)
Move this object.
FOOTPRINT * GetParentFootprint() const
Information pertinent to a Pcbnew printed circuit board.
void SetFileName(const wxString &aFileName)
FOOTPRINTS & Footprints()
void SaveSelection(const PCB_SELECTION &selected, bool isFootprintEditor)
STRING_FORMATTER m_formatter
BOARD * LoadBoard(const wxString &aFileName, BOARD *aAppendToMe, const STRING_UTF8_MAP *aProperties=nullptr, PROJECT *aProject=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr) override
Load information from some input file format that this PLUGIN implementation knows about into either ...
void SaveBoard(const wxString &aFileName, BOARD *aBoard, const STRING_UTF8_MAP *aProperties=nullptr) override
Write aBoard to a storage file in a format that this PLUGIN implementation knows about or it can be u...
void SetBoard(BOARD *aBoard)
A base class for most all the KiCad significant classes used in schematics and boards.
KICAD_T Type() const
Returns the type of object.
virtual void SetParent(EDA_ITEM *aParent)
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual void SetText(const wxString &aText)
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
void DoNotShowCheckbox(wxString file, int line)
Checks the 'do not show again' setting for the dialog.
A logical library item identifier and consists of various portions much like a URI.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
void SetBoard(const BOARD *aBoard)
Set a BOARD object that is used to prepare the net code map.
A set of BOARD_ITEMs (i.e., without duplicates).
Read a Pcbnew s-expression formatted LINE_READER object and returns the appropriate BOARD_ITEM object...
bool IsTooRecent()
Return whether a version number, if any was parsed, was too recent.
wxString GetRequiredVersion()
Return a string representing the version of KiCad required to open this file.
A PLUGIN derivation for saving and loading Pcbnew s-expression formatted files.
BOARD * m_board
which BOARD, no ownership here
void init(const STRING_UTF8_MAP *aProperties)
BOARD_ITEM * Parse(const wxString &aClipboardSourceInput)
OUTPUTFORMATTER * m_out
output any Format()s to this, no ownership
NETINFO_MAPPING * m_mapping
mapping for net codes, so only not empty net codes are stored with consecutive integers as net codes
void formatNetInformation(const BOARD *aBoard, int aNestLevel=0) const
formats the Nets and Netclasses
void formatBoardLayers(const BOARD *aBoard, int aNestLevel=0) const
formats the board layer information
void Format(const BOARD_ITEM *aItem, int aNestLevel=0) const
Output aItem to aFormatter in s-expression format.
A progress reporter interface for use in multi-threaded environments.
Container for project specific data.
VECTOR2I GetReferencePoint() const
int Size() const
Returns the number of selected parts.
bool Empty() const
Checks if there is anything selected.
bool HasReferencePoint() const
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
A name/value tuple with unique names and optional values.
This file is part of the common library.
void ignore_unused(const T &)
#define THROW_PARSE_ERROR(aProblem, aSource, aInputLine, aLineNumber, aByteIndex)
Class to handle a set of BOARD_ITEMs.
Pcbnew s-expression file format parser definition.
#define CTL_FOR_CLIPBOARD
Format output for the clipboard instead of footprint library or BOARD.
#define SEXPR_BOARD_FILE_VERSION
Current s-expression file format version. 2 was the last legacy format version.
std::vector< FAB_LAYER_COLOR > dummy
A filename or source description, a problem input line, a line number, a byte offset,...
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
@ PCB_PAD_T
class PAD, a pad in a footprint