26#include <wx/clipbrd.h>
68 if( aSelected.
Empty() )
77 auto deleteUnselectedCells =
80 int minCol = aTable->GetColCount();
82 int minRow = aTable->GetRowCount();
85 for(
int row = 0; row < aTable->GetRowCount(); ++row )
87 for(
int col = 0; col < aTable->GetColCount(); ++col )
93 minRow = std::min( minRow, row );
94 maxRow = std::max( maxRow, row );
95 minCol = std::min( minCol, col );
96 maxCol = std::max( maxCol, col );
105 wxCHECK_MSG( maxCol >= minCol && maxRow >= minRow, ,
106 wxT(
"No selected cells!" ) );
111 for(
int row = minRow; row <= maxRow; row++ )
112 aTable->SetRowHeight( destRow++, aTable->GetRowHeight( row ) );
116 for(
int col = minCol; col <= maxCol; col++ )
117 aTable->SetColWidth( destCol++, aTable->GetColWidth( col ) );
119 aTable->DeleteMarkedCells();
120 aTable->SetColCount( ( maxCol - minCol ) + 1 );
124 std::set<PCB_TABLE*> promotedTables;
126 auto parentIsPromoted =
131 if( table->m_Uuid == cell->GetParent()->m_Uuid )
146 pad->SetNetCode( 0 );
159 else if( isFootprintEditor )
168 partialFootprint.
SetFPID(
id );
175 wxCHECK2( boardItem,
continue );
179 if( field->IsMandatoryField() )
193 if( parentIsPromoted(
static_cast<PCB_TABLECELL*
>( item ) ) )
206 pad->SetNetCode( 0 );
210 copy->SetParentGroup(
nullptr );
218 std::vector<BOARD_ITEM*> skipped_items;
222 copy->RunOnDescendants(
231 if( field->IsMandatoryField() )
236 partialFootprint.
Add( descendant );
238 skipped_items.push_back( descendant );
243 copy->Move( -refPoint );
246 for(
BOARD_ITEM* skipped_item : skipped_items )
261 deleteUnselectedCells( table );
263 Format( &partialFootprint, 0 );
273 m_formatter.
Print( 0,
"(kicad_pcb (version %d) (generator \"pcbnew\") (generator_version \"%s\")\n",
288 wxCHECK2( boardItem,
continue );
296 if( textItem->
GetText() == wxT(
"${VALUE}" ) )
298 else if( textItem->
GetText() == wxT(
"${REFERENCE}" ) )
311 if( parentIsPromoted(
static_cast<PCB_TABLECELL*
>( item ) ) )
336 if( field->IsMandatoryField() )
343 copy->SetLocked(
false );
346 copy->Move( -refPoint );
352 if( promotedTables.count( table ) )
353 deleteUnselectedCells( table );
360 copy->RunOnDescendants(
368 copy->SetParentGroup(
nullptr );
378 auto clipboard = wxTheClipboard;
379 wxClipboardLocker clipboardLock( clipboard );
381 if( !clipboardLock || !clipboard->IsOpened() )
397 if( clipboard->IsSupported( wxDF_TEXT ) || clipboard->IsSupported( wxDF_UNICODETEXT ) )
399 wxTextDataObject data;
400 clipboard->GetData( data );
414 auto clipboard = wxTheClipboard;
415 wxClipboardLocker clipboardLock( clipboard );
420 if( clipboard->IsSupported( wxDF_TEXT ) || clipboard->IsSupported( wxDF_UNICODETEXT ) )
422 wxTextDataObject data;
423 clipboard->GetData( data );
424 result = data.GetText();
462 auto clipboard = wxTheClipboard;
463 wxClipboardLocker clipboardLock( clipboard );
468 clipboard->SetData(
new wxTextDataObject(
476 if( clipboard->IsSupported( wxDF_TEXT ) || clipboard->IsSupported( wxDF_UNICODETEXT ) )
478 wxTextDataObject data;
479 clipboard->GetData( data );
492 auto clipboard = wxTheClipboard;
493 wxClipboardLocker clipboardLock( clipboard );
498 if( clipboard->IsSupported( wxDF_TEXT ) || clipboard->IsSupported( wxDF_UNICODETEXT ) )
500 wxTextDataObject data;
501 clipboard->GetData( data );
503 result = data.GetText().mb_str();
506 std::function<bool( wxString,
int, wxString, wxString )> queryUser =
507 [&]( wxString aTitle,
int aIcon, wxString aMessage, wxString aAction ) ->
bool
509 KIDIALOG dlg(
nullptr, aMessage, aTitle, wxOK | wxCANCEL | aIcon );
511 if( !aAction.IsEmpty() )
512 dlg.SetOKLabel( aAction );
529 item = parser.
Parse();
547 THROW_PARSE_ERROR(
_(
"Clipboard content is not KiCad compatible" ), parser.CurSource(),
548 parser.CurLine(), parser.CurLineNumber(), parser.CurOffset() );
552 board =
dynamic_cast<BOARD*
>( item );
556 if( board && !aAppendToMe )
wxString GetMajorMinorVersion()
Get only the major and minor version in a string major.minor.
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)
FOOTPRINT * GetParentFootprint() const
Information pertinent to a Pcbnew printed circuit board.
void SetFileName(const wxString &aFileName)
const FOOTPRINTS & Footprints() const
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) override
Load information from some input file format that this PCB_IO 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 PCB_IO 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.
void SetFlags(EDA_ITEM_FLAGS aMask)
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.
NETINFO_MAPPING * m_mapping
mapping for net codes, so only not empty net codes are stored with consecutive integers as net codes
void init(const STRING_UTF8_MAP *aProperties)
void formatNetInformation(const BOARD *aBoard, int aNestLevel=0) const
formats the Nets and Netclasses
void Format(const BOARD_ITEM *aItem, int aNestLevel=0) const
Output aItem to aFormatter in s-expression format.
BOARD_ITEM * Parse(const wxString &aClipboardSourceInput)
void formatBoardLayers(const BOARD *aBoard, int aNestLevel=0) const
formats the board layer information
OUTPUTFORMATTER * m_out
output any Format()s to this, no ownership
BOARD * m_board
The board BOARD being worked on, no ownership here.
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.
#define STRUCT_DELETED
flag indication structures to be erased
void ignore_unused(const T &)
#define THROW_PARSE_ERROR(aProblem, aSource, aInputLine, aLineNumber, aByteIndex)
Class to handle a set of BOARD_ITEMs.
#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.
Pcbnew s-expression file format parser definition.
std::vector< FAB_LAYER_COLOR > dummy
A filename or source description, a problem input line, a line number, a byte offset,...
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
@ 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_TABLECELL_T
class PCB_TABLECELL, PCB_TEXTBOX for use in tables
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
@ PCB_PAD_T
class PAD, a pad in a footprint
@ PCB_TABLE_T
class PCB_TABLE, table of PCB_TABLECELLs