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 <footprint.h>
32#include <font/fontconfig.h>
33#include <pad.h>
34#include <pcb_group.h>
35#include <pcb_generator.h>
36#include <pcb_text.h>
37#include <pcb_table.h>
38#include <zone.h>
39#include <locale_io.h>
42#include <kicad_clipboard.h>
43#include <kidialog.h>
45
54
55
59
60
62{
63 m_board = aBoard;
64}
65
66
67void CLIPBOARD_IO::clipboardWriter( const wxString& aData )
68{
69 wxLogNull doNotLog; // disable logging of failed clipboard actions
70 auto clipboard = wxTheClipboard;
71 wxClipboardLocker clipboardLock( clipboard );
72
73 if( !clipboardLock || !clipboard->IsOpened() )
74 return;
75
76 clipboard->SetData( new wxTextDataObject( aData ) );
77
78 clipboard->Flush();
79
80#ifndef __WXOSX__
81 // This section exists to return the clipboard data, ensuring it has fully
82 // been processed by the system clipboard. This appears to be needed for
83 // extremely large clipboard copies on asynchronous linux clipboard managers
84 // such as KDE's Klipper. However, a read back of the data on OSX before the
85 // clipboard is closed seems to cause an ASAN error (heap-buffer-overflow)
86 // since it uses the cached version of the clipboard data and not the system
87 // clipboard data.
88 if( clipboard->IsSupported( wxDF_TEXT ) || clipboard->IsSupported( wxDF_UNICODETEXT ) )
89 {
90 wxTextDataObject data;
91 clipboard->GetData( data );
92 ignore_unused( data.GetText() );
93 }
94#endif
95}
96
97
99{
100 wxLogNull doNotLog; // disable logging of failed clipboard actions
101
102 auto clipboard = wxTheClipboard;
103 wxClipboardLocker clipboardLock( clipboard );
104
105 if( !clipboardLock )
106 return wxEmptyString;
107
108 if( clipboard->IsSupported( wxDF_TEXT ) || clipboard->IsSupported( wxDF_UNICODETEXT ) )
109 {
110 wxTextDataObject data;
111 clipboard->GetData( data );
112 return data.GetText();
113 }
114
115 return wxEmptyString;
116}
117
118
119void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootprintEditor )
120{
121 VECTOR2I refPoint( 0, 0 );
122
123 // dont even start if the selection is empty
124 if( aSelected.Empty() )
125 return;
126
127 if( aSelected.HasReferencePoint() )
128 refPoint = aSelected.GetReferencePoint();
129
130 auto deleteUnselectedCells =
131 []( PCB_TABLE* aTable )
132 {
133 int minCol = aTable->GetColCount();
134 int maxCol = -1;
135 int minRow = aTable->GetRowCount();
136 int maxRow = -1;
137
138 for( int row = 0; row < aTable->GetRowCount(); ++row )
139 {
140 for( int col = 0; col < aTable->GetColCount(); ++col )
141 {
142 PCB_TABLECELL* cell = aTable->GetCell( row, col );
143
144 if( cell->IsSelected() )
145 {
146 minRow = std::min( minRow, row );
147 maxRow = std::max( maxRow, row );
148 minCol = std::min( minCol, col );
149 maxCol = std::max( maxCol, col );
150 }
151 else
152 {
153 cell->SetFlags( STRUCT_DELETED );
154 }
155 }
156 }
157
158 wxCHECK_MSG( maxCol >= minCol && maxRow >= minRow, /*void*/,
159 wxT( "No selected cells!" ) );
160
161 // aTable is always a clone in the clipboard case
162 int destRow = 0;
163
164 for( int row = minRow; row <= maxRow; row++ )
165 aTable->SetRowHeight( destRow++, aTable->GetRowHeight( row ) );
166
167 int destCol = 0;
168
169 for( int col = minCol; col <= maxCol; col++ )
170 aTable->SetColWidth( destCol++, aTable->GetColWidth( col ) );
171
172 aTable->DeleteMarkedCells();
173 aTable->SetColCount( ( maxCol - minCol ) + 1 );
174 aTable->Normalize();
175 };
176
177 std::set<PCB_TABLE*> promotedTables;
178
179 auto parentIsPromoted =
180 [&]( PCB_TABLECELL* cell ) -> bool
181 {
182 for( PCB_TABLE* table : promotedTables )
183 {
184 if( table->m_Uuid == cell->GetParent()->m_Uuid )
185 return true;
186 }
187
188 return false;
189 };
190
191 if( aSelected.Size() == 1 && aSelected.Front()->Type() == PCB_FOOTPRINT_T )
192 {
193 // make the footprint safe to transfer to other pcbs
194 const FOOTPRINT* footprint = static_cast<FOOTPRINT*>( aSelected.Front() );
195 // Do not modify existing board
196 FOOTPRINT newFootprint( *footprint );
197
198 for( PAD* pad : newFootprint.Pads() )
199 pad->SetNetCode( 0 );
200
201 // locked means "locked in place"; copied items therefore can't be locked
202 newFootprint.SetLocked( false );
203
204 // locate the reference point at (0, 0) in the copied items
205 newFootprint.Move( VECTOR2I( -refPoint.x, -refPoint.y ) );
206
207 Format( static_cast<BOARD_ITEM*>( &newFootprint ) );
208
209 newFootprint.SetParent( nullptr );
210 newFootprint.SetParentGroup( nullptr );
211 }
212 else if( isFootprintEditor )
213 {
214 FOOTPRINT partialFootprint( m_board );
215
216 // Useful to copy the selection to the board editor (if any), and provides
217 // a dummy lib id.
218 // Perhaps not a good Id, but better than a empty id
219 KIID dummy;
220 LIB_ID id( "clipboard", dummy.AsString() );
221 partialFootprint.SetFPID( id );
222
223 for( EDA_ITEM* item : aSelected )
224 {
225 if( !item->IsBOARD_ITEM() )
226 continue;
227
228 BOARD_ITEM* boardItem = static_cast<BOARD_ITEM*>( item );
229 BOARD_ITEM* copy = nullptr;
230
231 if( PCB_FIELD* field = dynamic_cast<PCB_FIELD*>( item ) )
232 {
233 if( field->IsMandatory() )
234 continue;
235 }
236
237 if( boardItem->Type() == PCB_GROUP_T )
238 {
239 copy = static_cast<PCB_GROUP*>( boardItem )->DeepClone();
240 }
241 else if( boardItem->Type() == PCB_GENERATOR_T )
242 {
243 copy = static_cast<PCB_GENERATOR*>( boardItem )->DeepClone();
244 }
245 else if( item->Type() == PCB_TABLECELL_T )
246 {
247 if( parentIsPromoted( static_cast<PCB_TABLECELL*>( item ) ) )
248 continue;
249
250 copy = static_cast<BOARD_ITEM*>( item->GetParent()->Clone() );
251 promotedTables.insert( static_cast<PCB_TABLE*>( copy ) );
252 }
253 else
254 {
255 copy = static_cast<BOARD_ITEM*>( boardItem->Clone() );
256 }
257
258 // If it is only a footprint, clear the nets from the pads
259 if( PAD* pad = dynamic_cast<PAD*>( copy ) )
260 pad->SetNetCode( 0 );
261
262 // Don't copy group membership information for the 1st level objects being copied
263 // since the group they belong to isn't being copied.
264 copy->SetParentGroup( nullptr );
265
266 // Add the pad to the new footprint before moving to ensure the local coords are
267 // correct
268 partialFootprint.Add( copy );
269
270 // A list of not added items, when adding items to the footprint
271 // some PCB_TEXT (reference and value) cannot be added to the footprint
272 std::vector<BOARD_ITEM*> skipped_items;
273
274 // Will catch at least PCB_GROUP_T and PCB_GENERATOR_T
275 if( PCB_GROUP* group = dynamic_cast<PCB_GROUP*>( copy ) )
276 {
277 group->RunOnChildren(
278 [&]( BOARD_ITEM* descendant )
279 {
280 // One cannot add an additional mandatory field to a given footprint:
281 // only one is allowed. So add only non-mandatory fields.
282 bool can_add = true;
283
284 if( const PCB_FIELD* field = dynamic_cast<const PCB_FIELD*>( item ) )
285 {
286 if( field->IsMandatory() )
287 can_add = false;
288 }
289
290 if( can_add )
291 partialFootprint.Add( descendant );
292 else
293 skipped_items.push_back( descendant );
294 },
296 }
297
298 // locate the reference point at (0, 0) in the copied items
299 copy->Move( -refPoint );
300
301 // Now delete items, duplicated but not added:
302 for( BOARD_ITEM* skipped_item : skipped_items )
303 {
304 static_cast<PCB_GROUP*>( copy )->RemoveItem( skipped_item );
305 skipped_item->SetParentGroup( nullptr );
306 delete skipped_item;
307 }
308 }
309
310 // Set the new relative internal local coordinates of copied items
311 FOOTPRINT* editedFootprint = m_board->Footprints().front();
312 VECTOR2I moveVector = partialFootprint.GetPosition() + editedFootprint->GetPosition();
313
314 partialFootprint.MoveAnchorPosition( moveVector );
315
316 for( PCB_TABLE* table : promotedTables )
317 deleteUnselectedCells( table );
318
319 Format( &partialFootprint );
320
321 partialFootprint.SetParent( nullptr );
322 }
323 else
324 {
325 // we will fake being a .kicad_pcb to get the full parser kicking
326 // This means we also need layers and nets
327 LOCALE_IO io;
328
329 m_formatter.Print( "(kicad_pcb (version %d) (generator \"pcbnew\") (generator_version %s)",
331 m_formatter.Quotew( GetMajorMinorVersion() ).c_str() );
332
334
335 for( EDA_ITEM* item : aSelected )
336 {
337 if( !item->IsBOARD_ITEM() )
338 continue;
339
340 BOARD_ITEM* boardItem = static_cast<BOARD_ITEM*>( item );
341 BOARD_ITEM* copy = nullptr;
342
343 wxCHECK2( boardItem, continue );
344
345 if( boardItem->Type() == PCB_FIELD_T )
346 {
347 PCB_FIELD* field = static_cast<PCB_FIELD*>( boardItem );
348 copy = new PCB_TEXT( m_board );
349
350 PCB_TEXT* textItem = static_cast<PCB_TEXT*>( copy );
351 textItem->SetPosition( field->GetPosition() );
352 textItem->SetLayer( field->GetLayer() );
353 textItem->SetHyperlink( field->GetHyperlink() );
354 textItem->SetText( field->GetText() );
355 textItem->SetAttributes( field->GetAttributes() );
356 textItem->SetTextAngle( field->GetDrawRotation() );
357
358 if ( textItem->GetText() == wxT( "${VALUE}" ) )
359 textItem->SetText( boardItem->GetParentFootprint()->GetValue() );
360 else if ( textItem->GetText() == wxT( "${REFERENCE}" ) )
361 textItem->SetText( boardItem->GetParentFootprint()->GetReference() );
362
363 }
364 else if( boardItem->Type() == PCB_TEXT_T )
365 {
366 copy = static_cast<BOARD_ITEM*>( boardItem->Clone() );
367
368 PCB_TEXT* textItem = static_cast<PCB_TEXT*>( copy );
369
370 if( textItem->GetText() == wxT( "${VALUE}" ) )
371 textItem->SetText( boardItem->GetParentFootprint()->GetValue() );
372 else if( textItem->GetText() == wxT( "${REFERENCE}" ) )
373 textItem->SetText( boardItem->GetParentFootprint()->GetReference() );
374 }
375 else if( boardItem->Type() == PCB_GROUP_T )
376 {
377 copy = static_cast<PCB_GROUP*>( boardItem )->DeepClone();
378 }
379 else if( boardItem->Type() == PCB_GENERATOR_T )
380 {
381 copy = static_cast<PCB_GENERATOR*>( boardItem )->DeepClone();
382 }
383 else if( item->Type() == PCB_TABLECELL_T )
384 {
385 if( parentIsPromoted( static_cast<PCB_TABLECELL*>( item ) ) )
386 continue;
387
388 copy = static_cast<BOARD_ITEM*>( item->GetParent()->Clone() );
389 promotedTables.insert( static_cast<PCB_TABLE*>( copy ) );
390 }
391 else
392 {
393 copy = static_cast<BOARD_ITEM*>( boardItem->Clone() );
394 }
395
396 if( copy )
397 {
398 if( copy->Type() == PCB_FIELD_T || copy->Type() == PCB_PAD_T )
399 {
400 // Create a parent footprint to own the copied item
401 FOOTPRINT* footprint = new FOOTPRINT( m_board );
402
403 footprint->SetPosition( copy->GetPosition() );
404 footprint->Add( copy );
405
406 // Convert any mandatory fields to user fields. The destination footprint
407 // will already have its own mandatory fields.
408 if( PCB_FIELD* field = dynamic_cast<PCB_FIELD*>( copy ) )
409 {
410 if( field->IsMandatory() )
411 field->SetOrdinal( footprint->GetNextFieldOrdinal() );
412 }
413
414 copy = footprint;
415 }
416
417 copy->SetLocked( false );
418 copy->SetParent( m_board );
419 copy->SetParentGroup( nullptr );
420
421 // locate the reference point at (0, 0) in the copied items
422 copy->Move( -refPoint );
423
424 if( copy->Type() == PCB_TABLE_T )
425 {
426 PCB_TABLE* table = static_cast<PCB_TABLE*>( copy );
427
428 if( promotedTables.count( table ) )
429 deleteUnselectedCells( table );
430 }
431
432 Format( copy );
433
434 if( copy->Type() == PCB_GROUP_T || copy->Type() == PCB_GENERATOR_T )
435 {
436 copy->RunOnChildren(
437 [&]( BOARD_ITEM* descendant )
438 {
439 descendant->SetLocked( false );
440 Format( descendant );
441 },
443 }
444
445 delete copy;
446 }
447 }
448
449 m_formatter.Print( ")" );
450 }
451
452 std::string prettyData = m_formatter.GetString();
453 KICAD_FORMAT::Prettify( prettyData, KICAD_FORMAT::FORMAT_MODE::COMPACT_TEXT_PROPERTIES );
454
455 // These are placed at the end to minimize the open time of the clipboard
456 m_writer( wxString( prettyData.c_str(), wxConvUTF8 ) );
457}
458
459
461{
462 BOARD_ITEM* item;
463 wxString result = m_reader();
464
465 try
466 {
468 }
469 catch (...)
470 {
471 item = nullptr;
472 }
473
474 return item;
475}
476
477
478void CLIPBOARD_IO::SaveBoard( const wxString& aFileName, BOARD* aBoard,
479 const std::map<std::string, UTF8>* aProperties )
480{
481 init( aProperties );
482
483 m_board = aBoard; // after init()
484
485 m_formatter.Print( "(kicad_pcb (version %d) (generator \"pcbnew\") (generator_version %s)",
487 m_formatter.Quotew( GetMajorMinorVersion() ).c_str() );
488
489 Format( aBoard );
490
491 m_formatter.Print( ")" );
492
493 std::string prettyData = m_formatter.GetString();
494 KICAD_FORMAT::Prettify( prettyData, KICAD_FORMAT::FORMAT_MODE::COMPACT_TEXT_PROPERTIES );
495
496 m_writer( wxString( prettyData.c_str(), wxConvUTF8 ) );
497}
498
499
500BOARD* CLIPBOARD_IO::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
501 const std::map<std::string, UTF8>* aProperties, PROJECT* aProject )
502{
503 std::string result( m_reader().mb_str() );
504
505 std::function<bool( wxString, int, wxString, wxString )> queryUser =
506 [&]( wxString aTitle, int aIcon, wxString aMessage, wxString aAction ) -> bool
507 {
508 KIDIALOG dlg( nullptr, aMessage, aTitle, wxOK | wxCANCEL | aIcon );
509
510 if( !aAction.IsEmpty() )
511 dlg.SetOKLabel( aAction );
512
513 dlg.DoNotShowCheckbox( aMessage, 0 );
514
515 return dlg.ShowModal() == wxID_OK;
516 };
517
518 STRING_LINE_READER reader( result, wxT( "clipboard" ) );
519 PCB_IO_KICAD_SEXPR_PARSER parser( &reader, aAppendToMe, queryUser );
520
521 init( aProperties );
522
523 BOARD_ITEM* item;
524 BOARD* board;
525
526 try
527 {
528 item = parser.Parse();
529 }
530 catch( const FUTURE_FORMAT_ERROR& )
531 {
532 // Don't wrap a FUTURE_FORMAT_ERROR in another
533 throw;
534 }
535 catch( const PARSE_ERROR& parse_error )
536 {
537 if( parser.IsTooRecent() )
538 throw FUTURE_FORMAT_ERROR( parse_error, parser.GetRequiredVersion() );
539 else
540 throw;
541 }
542
543 if( item->Type() != PCB_T )
544 {
545 // The parser loaded something that was valid, but wasn't a board.
546 THROW_PARSE_ERROR( _( "Clipboard content is not KiCad compatible" ), parser.CurSource(),
547 parser.CurLine(), parser.CurLineNumber(), parser.CurOffset() );
548 }
549 else
550 {
551 board = dynamic_cast<BOARD*>( item );
552 }
553
554 // Give the filename to the board if it's new
555 if( board && !aAppendToMe )
556 board->SetFileName( aFileName );
557
558 return board;
559}
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:84
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition board_item.h:237
void SetLocked(bool aLocked) override
Definition board_item.h:328
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition board_item.h:285
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:99
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition eda_item.h:148
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:111
virtual void SetParentGroup(EDA_GROUP *aGroup)
Definition eda_item.h:116
bool IsSelected() const
Definition eda_item.h:128
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition eda_item.cpp:128
virtual void SetParent(EDA_ITEM *aParent)
Definition eda_item.cpp:93
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:447
wxString GetHyperlink() const
Definition eda_text.h:403
const TEXT_ATTRIBUTES & GetAttributes() const
Definition eda_text.h:231
void SetHyperlink(wxString aLink)
Definition eda_text.h:404
virtual void SetText(const wxString &aText)
Definition eda_text.cpp:284
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
Definition eda_text.cpp:313
void SetPosition(const VECTOR2I &aPos) override
void SetFPID(const LIB_ID &aFPID)
Definition footprint.h:352
void SetLocked(bool isLocked) override
Set the #MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition footprint.h:554
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:306
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:773
const wxString & GetReference() const
Definition footprint.h:751
VECTOR2I GetPosition() const override
Definition footprint.h:327
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:55
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:344
virtual VECTOR2I GetPosition() const override
Definition pcb_text.h:82
virtual void SetPosition(const VECTOR2I &aPos) override
Definition pcb_text.h:84
EDA_ANGLE GetDrawRotation() const override
Definition pcb_text.cpp:184
Container for project specific data.
Definition project.h:65
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:226
#define _(s)
@ RECURSE
Definition eda_item.h:52
#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