KiCad PCB EDA Suite
Loading...
Searching...
No Matches
kicad_clipboard.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.TXT for contributors.
5 * @author Kristoffer Ödmark
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#include <wx/clipbrd.h>
26#include <wx/log.h>
27
28#include <board.h>
29#include <build_version.h>
30#include <core/ignore.h>
31#include <font/fontconfig.h>
32#include <pad.h>
33#include <pcb_group.h>
34#include <pcb_generator.h>
35#include <pcb_text.h>
36#include <pcb_table.h>
37#include <zone.h>
38#include <locale_io.h>
41#include <kicad_clipboard.h>
42#include <kidialog.h>
44
53
54
58
59
61{
62 m_board = aBoard;
63}
64
65
66void CLIPBOARD_IO::clipboardWriter( const wxString& aData )
67{
68 wxLogNull doNotLog; // disable logging of failed clipboard actions
69 auto clipboard = wxTheClipboard;
70 wxClipboardLocker clipboardLock( clipboard );
71
72 if( !clipboardLock || !clipboard->IsOpened() )
73 return;
74
75 clipboard->SetData( new wxTextDataObject( aData ) );
76
77 clipboard->Flush();
78
79#ifndef __WXOSX__
80 // This section exists to return the clipboard data, ensuring it has fully
81 // been processed by the system clipboard. This appears to be needed for
82 // extremely large clipboard copies on asynchronous linux clipboard managers
83 // such as KDE's Klipper. However, a read back of the data on OSX before the
84 // clipboard is closed seems to cause an ASAN error (heap-buffer-overflow)
85 // since it uses the cached version of the clipboard data and not the system
86 // clipboard data.
87 if( clipboard->IsSupported( wxDF_TEXT ) || clipboard->IsSupported( wxDF_UNICODETEXT ) )
88 {
89 wxTextDataObject data;
90 clipboard->GetData( data );
91 ignore_unused( data.GetText() );
92 }
93#endif
94}
95
96
98{
99 wxLogNull doNotLog; // disable logging of failed clipboard actions
100
101 auto clipboard = wxTheClipboard;
102 wxClipboardLocker clipboardLock( clipboard );
103
104 if( !clipboardLock )
105 return wxEmptyString;
106
107 if( clipboard->IsSupported( wxDF_TEXT ) || clipboard->IsSupported( wxDF_UNICODETEXT ) )
108 {
109 wxTextDataObject data;
110 clipboard->GetData( data );
111 return data.GetText();
112 }
113
114 return wxEmptyString;
115}
116
117
118void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootprintEditor )
119{
120 VECTOR2I refPoint( 0, 0 );
121
122 // dont even start if the selection is empty
123 if( aSelected.Empty() )
124 return;
125
126 if( aSelected.HasReferencePoint() )
127 refPoint = aSelected.GetReferencePoint();
128
129 auto deleteUnselectedCells =
130 []( PCB_TABLE* aTable )
131 {
132 int minCol = aTable->GetColCount();
133 int maxCol = -1;
134 int minRow = aTable->GetRowCount();
135 int maxRow = -1;
136
137 for( int row = 0; row < aTable->GetRowCount(); ++row )
138 {
139 for( int col = 0; col < aTable->GetColCount(); ++col )
140 {
141 PCB_TABLECELL* cell = aTable->GetCell( row, col );
142
143 if( cell->IsSelected() )
144 {
145 minRow = std::min( minRow, row );
146 maxRow = std::max( maxRow, row );
147 minCol = std::min( minCol, col );
148 maxCol = std::max( maxCol, col );
149 }
150 else
151 {
152 cell->SetFlags( STRUCT_DELETED );
153 }
154 }
155 }
156
157 wxCHECK_MSG( maxCol >= minCol && maxRow >= minRow, /*void*/,
158 wxT( "No selected cells!" ) );
159
160 // aTable is always a clone in the clipboard case
161 int destRow = 0;
162
163 for( int row = minRow; row <= maxRow; row++ )
164 aTable->SetRowHeight( destRow++, aTable->GetRowHeight( row ) );
165
166 int destCol = 0;
167
168 for( int col = minCol; col <= maxCol; col++ )
169 aTable->SetColWidth( destCol++, aTable->GetColWidth( col ) );
170
171 aTable->DeleteMarkedCells();
172 aTable->SetColCount( ( maxCol - minCol ) + 1 );
173 aTable->Normalize();
174 };
175
176 std::set<PCB_TABLE*> promotedTables;
177
178 auto parentIsPromoted =
179 [&]( PCB_TABLECELL* cell ) -> bool
180 {
181 for( PCB_TABLE* table : promotedTables )
182 {
183 if( table->m_Uuid == cell->GetParent()->m_Uuid )
184 return true;
185 }
186
187 return false;
188 };
189
190 if( aSelected.Size() == 1 && aSelected.Front()->Type() == PCB_FOOTPRINT_T )
191 {
192 // make the footprint safe to transfer to other pcbs
193 const FOOTPRINT* footprint = static_cast<FOOTPRINT*>( aSelected.Front() );
194 // Do not modify existing board
195 FOOTPRINT newFootprint( *footprint );
196
197 for( PAD* pad : newFootprint.Pads() )
198 pad->SetNetCode( 0 );
199
200 // locked means "locked in place"; copied items therefore can't be locked
201 newFootprint.SetLocked( false );
202
203 // locate the reference point at (0, 0) in the copied items
204 newFootprint.Move( VECTOR2I( -refPoint.x, -refPoint.y ) );
205
206 Format( static_cast<BOARD_ITEM*>( &newFootprint ) );
207
208 newFootprint.SetParent( nullptr );
209 newFootprint.SetParentGroup( nullptr );
210 }
211 else if( isFootprintEditor )
212 {
213 FOOTPRINT partialFootprint( m_board );
214
215 // Useful to copy the selection to the board editor (if any), and provides
216 // a dummy lib id.
217 // Perhaps not a good Id, but better than a empty id
218 KIID dummy;
219 LIB_ID id( "clipboard", dummy.AsString() );
220 partialFootprint.SetFPID( id );
221
222 for( EDA_ITEM* item : aSelected )
223 {
224 if( !item->IsBOARD_ITEM() )
225 continue;
226
227 BOARD_ITEM* boardItem = static_cast<BOARD_ITEM*>( item );
228 BOARD_ITEM* copy = nullptr;
229
230 if( PCB_FIELD* field = dynamic_cast<PCB_FIELD*>( item ) )
231 {
232 if( field->IsMandatory() )
233 continue;
234 }
235
236 if( boardItem->Type() == PCB_GROUP_T )
237 {
238 copy = static_cast<PCB_GROUP*>( boardItem )->DeepClone();
239 }
240 else if( boardItem->Type() == PCB_GENERATOR_T )
241 {
242 copy = static_cast<PCB_GENERATOR*>( boardItem )->DeepClone();
243 }
244 else if( item->Type() == PCB_TABLECELL_T )
245 {
246 if( parentIsPromoted( static_cast<PCB_TABLECELL*>( item ) ) )
247 continue;
248
249 copy = static_cast<BOARD_ITEM*>( item->GetParent()->Clone() );
250 promotedTables.insert( static_cast<PCB_TABLE*>( copy ) );
251 }
252 else
253 {
254 copy = static_cast<BOARD_ITEM*>( boardItem->Clone() );
255 }
256
257 // If it is only a footprint, clear the nets from the pads
258 if( PAD* pad = dynamic_cast<PAD*>( copy ) )
259 pad->SetNetCode( 0 );
260
261 // Don't copy group membership information for the 1st level objects being copied
262 // since the group they belong to isn't being copied.
263 copy->SetParentGroup( nullptr );
264
265 // Add the pad to the new footprint before moving to ensure the local coords are
266 // correct
267 partialFootprint.Add( copy );
268
269 // A list of not added items, when adding items to the footprint
270 // some PCB_TEXT (reference and value) cannot be added to the footprint
271 std::vector<BOARD_ITEM*> skipped_items;
272
273 // Will catch at least PCB_GROUP_T and PCB_GENERATOR_T
274 if( PCB_GROUP* group = dynamic_cast<PCB_GROUP*>( copy ) )
275 {
276 group->RunOnChildren(
277 [&]( BOARD_ITEM* descendant )
278 {
279 // One cannot add an additional mandatory field to a given footprint:
280 // only one is allowed. So add only non-mandatory fields.
281 bool can_add = true;
282
283 if( const PCB_FIELD* field = dynamic_cast<const PCB_FIELD*>( item ) )
284 {
285 if( field->IsMandatory() )
286 can_add = false;
287 }
288
289 if( can_add )
290 partialFootprint.Add( descendant );
291 else
292 skipped_items.push_back( descendant );
293 },
295 }
296
297 // locate the reference point at (0, 0) in the copied items
298 copy->Move( -refPoint );
299
300 // Now delete items, duplicated but not added:
301 for( BOARD_ITEM* skipped_item : skipped_items )
302 {
303 static_cast<PCB_GROUP*>( copy )->RemoveItem( skipped_item );
304 skipped_item->SetParentGroup( nullptr );
305 delete skipped_item;
306 }
307 }
308
309 // Set the new relative internal local coordinates of copied items
310 FOOTPRINT* editedFootprint = m_board->Footprints().front();
311 VECTOR2I moveVector = partialFootprint.GetPosition() + editedFootprint->GetPosition();
312
313 partialFootprint.MoveAnchorPosition( moveVector );
314
315 for( PCB_TABLE* table : promotedTables )
316 deleteUnselectedCells( table );
317
318 Format( &partialFootprint );
319
320 partialFootprint.SetParent( nullptr );
321 }
322 else
323 {
324 // we will fake being a .kicad_pcb to get the full parser kicking
325 // This means we also need layers and nets
326 LOCALE_IO io;
327
328 m_formatter.Print( "(kicad_pcb (version %d) (generator \"pcbnew\") (generator_version %s)",
330 m_formatter.Quotew( GetMajorMinorVersion() ).c_str() );
331
333
334 for( EDA_ITEM* item : aSelected )
335 {
336 if( !item->IsBOARD_ITEM() )
337 continue;
338
339 BOARD_ITEM* boardItem = static_cast<BOARD_ITEM*>( item );
340 BOARD_ITEM* copy = nullptr;
341
342 wxCHECK2( boardItem, continue );
343
344 if( boardItem->Type() == PCB_FIELD_T )
345 {
346 PCB_FIELD* field = static_cast<PCB_FIELD*>( boardItem );
347 copy = new PCB_TEXT( m_board );
348
349 PCB_TEXT* textItem = static_cast<PCB_TEXT*>( copy );
350 textItem->SetPosition( field->GetPosition() );
351 textItem->SetLayer( field->GetLayer() );
352 textItem->SetHyperlink( field->GetHyperlink() );
353 textItem->SetText( field->GetText() );
354 textItem->SetAttributes( field->GetAttributes() );
355 textItem->SetTextAngle( field->GetDrawRotation() );
356
357 if ( textItem->GetText() == wxT( "${VALUE}" ) )
358 textItem->SetText( boardItem->GetParentFootprint()->GetValue() );
359 else if ( textItem->GetText() == wxT( "${REFERENCE}" ) )
360 textItem->SetText( boardItem->GetParentFootprint()->GetReference() );
361
362 }
363 else if( boardItem->Type() == PCB_TEXT_T )
364 {
365 copy = static_cast<BOARD_ITEM*>( boardItem->Clone() );
366
367 PCB_TEXT* textItem = static_cast<PCB_TEXT*>( copy );
368
369 if( textItem->GetText() == wxT( "${VALUE}" ) )
370 textItem->SetText( boardItem->GetParentFootprint()->GetValue() );
371 else if( textItem->GetText() == wxT( "${REFERENCE}" ) )
372 textItem->SetText( boardItem->GetParentFootprint()->GetReference() );
373 }
374 else if( boardItem->Type() == PCB_GROUP_T )
375 {
376 copy = static_cast<PCB_GROUP*>( boardItem )->DeepClone();
377 }
378 else if( boardItem->Type() == PCB_GENERATOR_T )
379 {
380 copy = static_cast<PCB_GENERATOR*>( boardItem )->DeepClone();
381 }
382 else if( item->Type() == PCB_TABLECELL_T )
383 {
384 if( parentIsPromoted( static_cast<PCB_TABLECELL*>( item ) ) )
385 continue;
386
387 copy = static_cast<BOARD_ITEM*>( item->GetParent()->Clone() );
388 promotedTables.insert( static_cast<PCB_TABLE*>( copy ) );
389 }
390 else
391 {
392 copy = static_cast<BOARD_ITEM*>( boardItem->Clone() );
393 }
394
395 if( copy )
396 {
397 if( copy->Type() == PCB_FIELD_T || copy->Type() == PCB_PAD_T )
398 {
399 // Create a parent footprint to own the copied item
400 FOOTPRINT* footprint = new FOOTPRINT( m_board );
401
402 footprint->SetPosition( copy->GetPosition() );
403 footprint->Add( copy );
404
405 // Convert any mandatory fields to user fields. The destination footprint
406 // will already have its own mandatory fields.
407 if( PCB_FIELD* field = dynamic_cast<PCB_FIELD*>( copy ) )
408 {
409 if( field->IsMandatory() )
410 field->SetOrdinal( footprint->GetNextFieldOrdinal() );
411 }
412
413 copy = footprint;
414 }
415
416 copy->SetLocked( false );
417 copy->SetParent( m_board );
418 copy->SetParentGroup( nullptr );
419
420 // locate the reference point at (0, 0) in the copied items
421 copy->Move( -refPoint );
422
423 if( copy->Type() == PCB_TABLE_T )
424 {
425 PCB_TABLE* table = static_cast<PCB_TABLE*>( copy );
426
427 if( promotedTables.count( table ) )
428 deleteUnselectedCells( table );
429 }
430
431 Format( copy );
432
433 if( copy->Type() == PCB_GROUP_T || copy->Type() == PCB_GENERATOR_T )
434 {
435 copy->RunOnChildren(
436 [&]( BOARD_ITEM* descendant )
437 {
438 descendant->SetLocked( false );
439 Format( descendant );
440 },
442 }
443
444 delete copy;
445 }
446 }
447
448 m_formatter.Print( ")" );
449 }
450
451 std::string prettyData = m_formatter.GetString();
452 KICAD_FORMAT::Prettify( prettyData, KICAD_FORMAT::FORMAT_MODE::COMPACT_TEXT_PROPERTIES );
453
454 // These are placed at the end to minimize the open time of the clipboard
455 m_writer( wxString( prettyData.c_str(), wxConvUTF8 ) );
456}
457
458
460{
461 BOARD_ITEM* item;
462 wxString result = m_reader();
463
464 try
465 {
467 }
468 catch (...)
469 {
470 item = nullptr;
471 }
472
473 return item;
474}
475
476
477void CLIPBOARD_IO::SaveBoard( const wxString& aFileName, BOARD* aBoard,
478 const std::map<std::string, UTF8>* aProperties )
479{
480 init( aProperties );
481
482 m_board = aBoard; // after init()
483
484 m_formatter.Print( "(kicad_pcb (version %d) (generator \"pcbnew\") (generator_version %s)",
486 m_formatter.Quotew( GetMajorMinorVersion() ).c_str() );
487
488 Format( aBoard );
489
490 m_formatter.Print( ")" );
491
492 std::string prettyData = m_formatter.GetString();
493 KICAD_FORMAT::Prettify( prettyData, KICAD_FORMAT::FORMAT_MODE::COMPACT_TEXT_PROPERTIES );
494
495 m_writer( wxString( prettyData.c_str(), wxConvUTF8 ) );
496}
497
498
499BOARD* CLIPBOARD_IO::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
500 const std::map<std::string, UTF8>* aProperties, PROJECT* aProject )
501{
502 std::string result( m_reader().mb_str() );
503
504 std::function<bool( wxString, int, wxString, wxString )> queryUser =
505 [&]( wxString aTitle, int aIcon, wxString aMessage, wxString aAction ) -> bool
506 {
507 KIDIALOG dlg( nullptr, aMessage, aTitle, wxOK | wxCANCEL | aIcon );
508
509 if( !aAction.IsEmpty() )
510 dlg.SetOKLabel( aAction );
511
512 dlg.DoNotShowCheckbox( aMessage, 0 );
513
514 return dlg.ShowModal() == wxID_OK;
515 };
516
517 STRING_LINE_READER reader( result, wxT( "clipboard" ) );
518 PCB_IO_KICAD_SEXPR_PARSER parser( &reader, aAppendToMe, queryUser );
519
520 init( aProperties );
521
522 BOARD_ITEM* item;
523 BOARD* board;
524
525 try
526 {
527 item = parser.Parse();
528 }
529 catch( const FUTURE_FORMAT_ERROR& )
530 {
531 // Don't wrap a FUTURE_FORMAT_ERROR in another
532 throw;
533 }
534 catch( const PARSE_ERROR& parse_error )
535 {
536 if( parser.IsTooRecent() )
537 throw FUTURE_FORMAT_ERROR( parse_error, parser.GetRequiredVersion() );
538 else
539 throw;
540 }
541
542 if( item->Type() != PCB_T )
543 {
544 // The parser loaded something that was valid, but wasn't a board.
545 THROW_PARSE_ERROR( _( "Clipboard content is not KiCad compatible" ), parser.CurSource(),
546 parser.CurLine(), parser.CurLineNumber(), parser.CurOffset() );
547 }
548 else
549 {
550 board = dynamic_cast<BOARD*>( item );
551 }
552
553 // Give the filename to the board if it's new
554 if( board && !aAppendToMe )
555 board->SetFileName( aFileName );
556
557 return board;
558}
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...
Definition board_item.h:79
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition board_item.h:232
void SetLocked(bool aLocked) override
Definition board_item.h:323
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition board_item.h:280
FOOTPRINT * GetParentFootprint() const
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:322
void SetFileName(const wxString &aFileName)
Definition board.h:357
void SaveSelection(const PCB_SELECTION &selected, bool isFootprintEditor)
STRING_FORMATTER m_formatter
BOARD_ITEM * Parse()
void SaveBoard(const wxString &aFileName, BOARD *aBoard, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Write aBoard to a storage file in a format that this PCB_IO implementation knows about or it can be u...
static void clipboardWriter(const wxString &aData)
static wxString clipboardReader()
void SetBoard(BOARD *aBoard)
std::function< wxString()> m_reader
BOARD * LoadBoard(const wxString &aFileName, BOARD *aAppendToMe, const std::map< std::string, UTF8 > *aProperties=nullptr, PROJECT *aProject=nullptr) override
Load information from some input file format that this PCB_IO implementation knows about into either ...
std::function< void(const wxString &)> m_writer
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition eda_item.h:142
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
virtual void SetParentGroup(EDA_GROUP *aGroup)
Definition eda_item.h:115
bool IsSelected() const
Definition eda_item.h:127
virtual void SetParent(EDA_ITEM *aParent)
Definition eda_item.h:113
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition eda_item.cpp:118
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition eda_text.h:98
void SetAttributes(const EDA_TEXT &aSrc, bool aSetPosition=true)
Set the text attributes from another instance.
Definition eda_text.cpp:444
wxString GetHyperlink() const
Definition eda_text.h:401
const TEXT_ATTRIBUTES & GetAttributes() const
Definition eda_text.h:231
void SetHyperlink(wxString aLink)
Definition eda_text.h:402
virtual void SetText(const wxString &aText)
Definition eda_text.cpp:281
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
Definition eda_text.cpp:310
void SetPosition(const VECTOR2I &aPos) override
void SetFPID(const LIB_ID &aFPID)
Definition footprint.h:270
void SetLocked(bool isLocked) override
Set the #MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition footprint.h:464
int GetNextFieldOrdinal() const
Return the next ordinal for a user field for this footprint.
void MoveAnchorPosition(const VECTOR2I &aMoveVector)
Move the reference point of the footprint.
std::deque< PAD * > & Pads()
Definition footprint.h:224
void Move(const VECTOR2I &aMoveVector) override
Move this object.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
const wxString & GetValue() const
Definition footprint.h:683
const wxString & GetReference() const
Definition footprint.h:661
VECTOR2I GetPosition() const override
Definition footprint.h:245
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
Definition kidialog.h:42
void DoNotShowCheckbox(wxString file, int line)
Shows the 'do not show again' checkbox.
Definition kidialog.cpp:55
int ShowModal() override
Definition kidialog.cpp:93
Definition kiid.h:49
A logical library item identifier and consists of various portions much like a URI.
Definition lib_id.h:49
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition locale_io.h:41
Definition pad.h:54
A set of BOARD_ITEMs (i.e., without duplicates).
Definition pcb_group.h:53
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.
void formatBoardLayers(const BOARD *aBoard) const
formats the board layer information
BOARD_ITEM * Parse(const wxString &aClipboardSourceInput)
void init(const std::map< std::string, UTF8 > *aProperties)
void Format(const BOARD_ITEM *aItem) const
Output aItem to aFormatter in s-expression format.
PCB_IO_KICAD_SEXPR(int aControlFlags=CTL_FOR_BOARD)
OUTPUTFORMATTER * m_out
output any Format()s to this, no ownership
BOARD * m_board
The board BOARD being worked on, no ownership here.
Definition pcb_io.h:324
virtual VECTOR2I GetPosition() const override
Definition pcb_text.h:84
virtual void SetPosition(const VECTOR2I &aPos) override
Definition pcb_text.h:89
EDA_ANGLE GetDrawRotation() const override
Definition pcb_text.cpp:184
Container for project specific data.
Definition project.h:66
VECTOR2I GetReferencePoint() const
EDA_ITEM * Front() const
Definition selection.h:177
int Size() const
Returns the number of selected parts.
Definition selection.h:121
bool Empty() const
Checks if there is anything selected.
Definition selection.h:115
bool HasReferencePoint() const
Definition selection.h:216
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
Definition richio.h:254
#define _(s)
@ RECURSE
Definition eda_item.h:51
#define STRUCT_DELETED
flag indication structures to be erased
void ignore_unused(const T &)
Definition ignore.h:24
#define THROW_PARSE_ERROR(aProblem, aSource, aInputLine, aLineNumber, aByteIndex)
void Prettify(std::string &aSource, FORMAT_MODE aMode)
Pretty-prints s-expression text according to KiCad format rules.
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
Variant of PARSE_ERROR indicating that a syntax or related error was likely caused by a file generate...
A filename or source description, a problem input line, a line number, a byte offset,...
wxString result
Test unit parsing edge cases and error handling.
@ PCB_T
Definition typeinfo.h:82
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
Definition typeinfo.h:91
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
Definition typeinfo.h:111
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
Definition typeinfo.h:92
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
Definition typeinfo.h:90
@ PCB_TABLECELL_T
class PCB_TABLECELL, PCB_TEXTBOX for use in tables
Definition typeinfo.h:95
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition typeinfo.h:86
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition typeinfo.h:87
@ PCB_TABLE_T
class PCB_TABLE, table of PCB_TABLECELLs
Definition typeinfo.h:94
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:695