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 (C) 2017 KiCad Developers, see AUTHORS.TXT for contributors.
5 * Copyright (C) 2017-2023 KiCad Developers, see AUTHORS.txt for contributors.
6 * @author Kristoffer Ödmark
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, you may find one here:
20 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21 * or you may search the http://www.gnu.org website for the version 2 license,
22 * or you may write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 */
25
26#include <wx/clipbrd.h>
27#include <wx/log.h>
28
29#include <board.h>
30#include <build_version.h>
31#include <core/ignore.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
48 m_formatter(),
49 m_writer( &CLIPBOARD_IO::clipboardWriter ),
50 m_reader( &CLIPBOARD_IO::clipboardReader )
51{
53}
54
55
57{
58}
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 // Prepare net mapping that assures that net codes saved in a file are consecutive integers
132
133 auto deleteUnselectedCells =
134 []( PCB_TABLE* aTable )
135 {
136 int minCol = aTable->GetColCount();
137 int maxCol = -1;
138 int minRow = aTable->GetRowCount();
139 int maxRow = -1;
140
141 for( int row = 0; row < aTable->GetRowCount(); ++row )
142 {
143 for( int col = 0; col < aTable->GetColCount(); ++col )
144 {
145 PCB_TABLECELL* cell = aTable->GetCell( row, col );
146
147 if( cell->IsSelected() )
148 {
149 minRow = std::min( minRow, row );
150 maxRow = std::max( maxRow, row );
151 minCol = std::min( minCol, col );
152 maxCol = std::max( maxCol, col );
153 }
154 else
155 {
156 cell->SetFlags( STRUCT_DELETED );
157 }
158 }
159 }
160
161 wxCHECK_MSG( maxCol >= minCol && maxRow >= minRow, /*void*/,
162 wxT( "No selected cells!" ) );
163
164 // aTable is always a clone in the clipboard case
165 int destRow = 0;
166
167 for( int row = minRow; row <= maxRow; row++ )
168 aTable->SetRowHeight( destRow++, aTable->GetRowHeight( row ) );
169
170 int destCol = 0;
171
172 for( int col = minCol; col <= maxCol; col++ )
173 aTable->SetColWidth( destCol++, aTable->GetColWidth( col ) );
174
175 aTable->DeleteMarkedCells();
176 aTable->SetColCount( ( maxCol - minCol ) + 1 );
177 aTable->Normalize();
178 };
179
180 std::set<PCB_TABLE*> promotedTables;
181
182 auto parentIsPromoted =
183 [&]( PCB_TABLECELL* cell ) -> bool
184 {
185 for( PCB_TABLE* table : promotedTables )
186 {
187 if( table->m_Uuid == cell->GetParent()->m_Uuid )
188 return true;
189 }
190
191 return false;
192 };
193
194 if( aSelected.Size() == 1 && aSelected.Front()->Type() == PCB_FOOTPRINT_T )
195 {
196 // make the footprint safe to transfer to other pcbs
197 const FOOTPRINT* footprint = static_cast<FOOTPRINT*>( aSelected.Front() );
198 // Do not modify existing board
199 FOOTPRINT newFootprint( *footprint );
200
201 for( PAD* pad : newFootprint.Pads() )
202 pad->SetNetCode( 0 );
203
204 // locked means "locked in place"; copied items therefore can't be locked
205 newFootprint.SetLocked( false );
206
207 // locate the reference point at (0, 0) in the copied items
208 newFootprint.Move( VECTOR2I( -refPoint.x, -refPoint.y ) );
209
210 Format( static_cast<BOARD_ITEM*>( &newFootprint ) );
211
212 newFootprint.SetParent( nullptr );
213 newFootprint.SetParentGroup( nullptr );
214 }
215 else if( isFootprintEditor )
216 {
217 FOOTPRINT partialFootprint( m_board );
218
219 // Useful to copy the selection to the board editor (if any), and provides
220 // a dummy lib id.
221 // Perhaps not a good Id, but better than a empty id
222 KIID dummy;
223 LIB_ID id( "clipboard", dummy.AsString() );
224 partialFootprint.SetFPID( id );
225
226 for( EDA_ITEM* item : aSelected )
227 {
228 if( !item->IsBOARD_ITEM() )
229 continue;
230
231 BOARD_ITEM* boardItem = static_cast<BOARD_ITEM*>( item );
232 BOARD_ITEM* copy = nullptr;
233
234 if( PCB_FIELD* field = dynamic_cast<PCB_FIELD*>( item ) )
235 {
236 if( field->IsMandatoryField() )
237 continue;
238 }
239
240 if( boardItem->Type() == PCB_GROUP_T )
241 {
242 copy = static_cast<PCB_GROUP*>( boardItem )->DeepClone();
243 }
244 else if( boardItem->Type() == PCB_GENERATOR_T )
245 {
246 copy = static_cast<PCB_GENERATOR*>( boardItem )->DeepClone();
247 }
248 else if( item->Type() == PCB_TABLECELL_T )
249 {
250 if( parentIsPromoted( static_cast<PCB_TABLECELL*>( item ) ) )
251 continue;
252
253 copy = static_cast<BOARD_ITEM*>( item->GetParent()->Clone() );
254 promotedTables.insert( static_cast<PCB_TABLE*>( copy ) );
255 }
256 else
257 {
258 copy = static_cast<BOARD_ITEM*>( boardItem->Clone() );
259 }
260
261 // If it is only a footprint, clear the nets from the pads
262 if( PAD* pad = dynamic_cast<PAD*>( copy ) )
263 pad->SetNetCode( 0 );
264
265 // Don't copy group membership information for the 1st level objects being copied
266 // since the group they belong to isn't being copied.
267 copy->SetParentGroup( nullptr );
268
269 // Add the pad to the new footprint before moving to ensure the local coords are
270 // correct
271 partialFootprint.Add( copy );
272
273 // A list of not added items, when adding items to the footprint
274 // some PCB_TEXT (reference and value) cannot be added to the footprint
275 std::vector<BOARD_ITEM*> skipped_items;
276
277 if( copy->Type() == PCB_GROUP_T || copy->Type() == PCB_GENERATOR_T )
278 {
279 copy->RunOnDescendants(
280 [&]( BOARD_ITEM* descendant )
281 {
282 // One cannot add an additional mandatory field to a given footprint:
283 // only one is allowed. So add only non-mandatory fields.
284 bool can_add = true;
285
286 if( const PCB_FIELD* field = dynamic_cast<const PCB_FIELD*>( item ) )
287 {
288 if( field->IsMandatoryField() )
289 can_add = false;
290 }
291
292 if( can_add )
293 partialFootprint.Add( descendant );
294 else
295 skipped_items.push_back( descendant );
296 } );
297 }
298
299 // locate the reference point at (0, 0) in the copied items
300 copy->Move( -refPoint );
301
302 // Now delete items, duplicated but not added:
303 for( BOARD_ITEM* skipped_item : skipped_items )
304 {
305 static_cast<PCB_GROUP*>( copy )->RemoveItem( skipped_item );
306 skipped_item->SetParentGroup( nullptr );
307 delete skipped_item;
308 }
309 }
310
311 // Set the new relative internal local coordinates of copied items
312 FOOTPRINT* editedFootprint = m_board->Footprints().front();
313 VECTOR2I moveVector = partialFootprint.GetPosition() + editedFootprint->GetPosition();
314
315 partialFootprint.MoveAnchorPosition( moveVector );
316
317 for( PCB_TABLE* table : promotedTables )
318 deleteUnselectedCells( table );
319
320 Format( &partialFootprint );
321
322 partialFootprint.SetParent( nullptr );
323 }
324 else
325 {
326 // we will fake being a .kicad_pcb to get the full parser kicking
327 // This means we also need layers and nets
328 LOCALE_IO io;
329
330 m_formatter.Print( "(kicad_pcb (version %d) (generator \"pcbnew\") (generator_version %s)",
333
336
337 for( EDA_ITEM* item : aSelected )
338 {
339 if( !item->IsBOARD_ITEM() )
340 continue;
341
342 BOARD_ITEM* boardItem = static_cast<BOARD_ITEM*>( item );
343 BOARD_ITEM* copy = nullptr;
344
345 wxCHECK2( boardItem, continue );
346
347 if( boardItem->Type() == PCB_FIELD_T )
348 {
349 PCB_FIELD* field = static_cast<PCB_FIELD*>( boardItem );
350 copy = new PCB_TEXT( m_board );
351
352 PCB_TEXT* textItem = static_cast<PCB_TEXT*>( copy );
353 textItem->SetPosition( field->GetPosition() );
354 textItem->SetLayer( field->GetLayer() );
355 textItem->SetHyperlink( field->GetHyperlink() );
356 textItem->SetText( field->GetText() );
357 textItem->SetAttributes( field->GetAttributes() );
358 textItem->SetTextAngle( field->GetDrawRotation() );
359
360 if ( textItem->GetText() == wxT( "${VALUE}" ) )
361 textItem->SetText( boardItem->GetParentFootprint()->GetValue() );
362 else if ( textItem->GetText() == wxT( "${REFERENCE}" ) )
363 textItem->SetText( boardItem->GetParentFootprint()->GetReference() );
364
365 }
366 else if( boardItem->Type() == PCB_TEXT_T )
367 {
368 copy = static_cast<BOARD_ITEM*>( boardItem->Clone() );
369
370 PCB_TEXT* textItem = static_cast<PCB_TEXT*>( copy );
371
372 if( textItem->GetText() == wxT( "${VALUE}" ) )
373 textItem->SetText( boardItem->GetParentFootprint()->GetValue() );
374 else if( textItem->GetText() == wxT( "${REFERENCE}" ) )
375 textItem->SetText( boardItem->GetParentFootprint()->GetReference() );
376 }
377 else if( boardItem->Type() == PCB_GROUP_T )
378 {
379 copy = static_cast<PCB_GROUP*>( boardItem )->DeepClone();
380 }
381 else if( boardItem->Type() == PCB_GENERATOR_T )
382 {
383 copy = static_cast<PCB_GENERATOR*>( boardItem )->DeepClone();
384 }
385 else if( item->Type() == PCB_TABLECELL_T )
386 {
387 if( parentIsPromoted( static_cast<PCB_TABLECELL*>( item ) ) )
388 continue;
389
390 copy = static_cast<BOARD_ITEM*>( item->GetParent()->Clone() );
391 promotedTables.insert( static_cast<PCB_TABLE*>( copy ) );
392 }
393 else
394 {
395 copy = static_cast<BOARD_ITEM*>( boardItem->Clone() );
396 }
397
398 if( copy )
399 {
400 if( copy->Type() == PCB_FIELD_T || copy->Type() == PCB_PAD_T )
401 {
402 // Create a parent footprint to own the copied item
403 FOOTPRINT* footprint = new FOOTPRINT( m_board );
404
405 footprint->SetPosition( copy->GetPosition() );
406 footprint->Add( copy );
407
408 // Convert any mandatory fields to user fields. The destination footprint
409 // will already have its own mandatory fields.
410 if( PCB_FIELD* field = dynamic_cast<PCB_FIELD*>( copy ) )
411 {
412 if( field->IsMandatoryField() )
413 field->SetId( footprint->GetFieldCount() );
414 }
415
416 copy = footprint;
417 }
418
419 copy->SetLocked( false );
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->RunOnDescendants(
437 [&]( BOARD_ITEM* descendant )
438 {
439 descendant->SetLocked( false );
440 Format( descendant );
441 } );
442 }
443
444 copy->SetParentGroup( nullptr );
445 delete copy;
446 }
447 }
448
449 m_formatter.Print( ")" );
450 }
451
452 std::string prettyData = m_formatter.GetString();
453 KICAD_FORMAT::Prettify( prettyData, true );
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 {
467 item = PCB_IO_KICAD_SEXPR::Parse( result );
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 // Prepare net mapping that assures that net codes saved in a file are consecutive integers
486 m_mapping->SetBoard( aBoard );
487
488 m_formatter.Print( "(kicad_pcb (version %d) (generator \"pcbnew\") (generator_version %s)",
491
492 Format( aBoard );
493
494 m_formatter.Print( ")" );
495
496 std::string prettyData = m_formatter.GetString();
497 KICAD_FORMAT::Prettify( prettyData, true );
498
499 m_writer( wxString( prettyData.c_str(), wxConvUTF8 ) );
500}
501
502
503BOARD* CLIPBOARD_IO::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
504 const std::map<std::string, UTF8>* aProperties, PROJECT* aProject )
505{
506 std::string result( m_reader().mb_str() );
507
508 std::function<bool( wxString, int, wxString, wxString )> queryUser =
509 [&]( wxString aTitle, int aIcon, wxString aMessage, wxString aAction ) -> bool
510 {
511 KIDIALOG dlg( nullptr, aMessage, aTitle, wxOK | wxCANCEL | aIcon );
512
513 if( !aAction.IsEmpty() )
514 dlg.SetOKLabel( aAction );
515
516 dlg.DoNotShowCheckbox( aMessage, 0 );
517
518 return dlg.ShowModal() == wxID_OK;
519 };
520
521 STRING_LINE_READER reader( result, wxT( "clipboard" ) );
522 PCB_IO_KICAD_SEXPR_PARSER parser( &reader, aAppendToMe, queryUser );
523
524 init( aProperties );
525
526 BOARD_ITEM* item;
527 BOARD* board;
528
529 try
530 {
531 item = parser.Parse();
532 }
533 catch( const FUTURE_FORMAT_ERROR& )
534 {
535 // Don't wrap a FUTURE_FORMAT_ERROR in another
536 throw;
537 }
538 catch( const PARSE_ERROR& parse_error )
539 {
540 if( parser.IsTooRecent() )
541 throw FUTURE_FORMAT_ERROR( parse_error, parser.GetRequiredVersion() );
542 else
543 throw;
544 }
545
546 if( item->Type() != PCB_T )
547 {
548 // The parser loaded something that was valid, but wasn't a board.
549 THROW_PARSE_ERROR( _( "Clipboard content is not KiCad compatible" ), parser.CurSource(),
550 parser.CurLine(), parser.CurLineNumber(), parser.CurOffset() );
551 }
552 else
553 {
554 board = dynamic_cast<BOARD*>( item );
555 }
556
557 // Give the filename to the board if it's new
558 if( board && !aAppendToMe )
559 board->SetFileName( aFileName );
560
561 return board;
562}
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:237
void SetParentGroup(PCB_GROUP *aGroup)
Definition: board_item.h:89
virtual void SetLocked(bool aLocked)
Definition: board_item.h:328
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:288
FOOTPRINT * GetParentFootprint() const
Definition: board_item.cpp:298
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:290
void SetFileName(const wxString &aFileName)
Definition: board.h:325
const FOOTPRINTS & Footprints() const
Definition: board.h:331
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:89
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:127
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:101
bool IsSelected() const
Definition: eda_item.h:110
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:104
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
Definition: eda_item.cpp:85
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:424
wxString GetHyperlink() const
Definition: eda_text.h:384
const TEXT_ATTRIBUTES & GetAttributes() const
Definition: eda_text.h:218
void SetHyperlink(wxString aLink)
Definition: eda_text.h:385
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:269
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
Definition: eda_text.cpp:291
void SetPosition(const VECTOR2I &aPos) override
Definition: footprint.cpp:2388
void SetFPID(const LIB_ID &aFPID)
Definition: footprint.h:249
int GetFieldCount() const
Return the number of fields in this symbol.
Definition: footprint.h:738
void SetLocked(bool isLocked) override
Set the #MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition: footprint.h:421
void MoveAnchorPosition(const VECTOR2I &aMoveVector)
Move the reference point of the footprint.
Definition: footprint.cpp:2414
std::deque< PAD * > & Pads()
Definition: footprint.h:206
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: footprint.cpp:2284
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: footprint.cpp:1025
const wxString & GetValue() const
Definition: footprint.h:644
const wxString & GetReference() const
Definition: footprint.h:622
VECTOR2I GetPosition() const override
Definition: footprint.h:224
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
Definition: kidialog.h:43
void DoNotShowCheckbox(wxString file, int line)
Checks the 'do not show again' setting for the dialog.
Definition: kidialog.cpp:51
int ShowModal() override
Definition: kidialog.cpp:95
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:49
void SetBoard(const BOARD *aBoard)
Set a BOARD object that is used to prepare the net code map.
Definition: netinfo.h:223
std::string Quotew(const wxString &aWrapee) const
Definition: richio.cpp:543
int PRINTF_FUNC_N Print(int nestLevel, const char *fmt,...)
Format and write text to the output stream.
Definition: richio.cpp:458
Definition: pad.h:54
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:52
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 formatNetInformation(const BOARD *aBoard) const
formats the Nets and Netclasses
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.
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:342
virtual VECTOR2I GetPosition() const override
Definition: pcb_text.h:82
virtual void SetPosition(const VECTOR2I &aPos) override
Definition: pcb_text.h:87
EDA_ANGLE GetDrawRotation() const override
Definition: pcb_text.cpp:175
Container for project specific data.
Definition: project.h:64
VECTOR2I GetReferencePoint() const
Definition: selection.cpp:171
EDA_ITEM * Front() const
Definition: selection.h:172
int Size() const
Returns the number of selected parts.
Definition: selection.h:116
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:110
bool HasReferencePoint() const
Definition: selection.h:211
const std::string & GetString()
Definition: richio.h:472
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
Definition: richio.h:253
#define _(s)
#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)
Definition: ki_exception.h:165
This file is part of the common library.
void Prettify(std::string &aSource, bool aCompactSave)
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...
Definition: ki_exception.h:176
A filename or source description, a problem input line, a line number, a byte offset,...
Definition: ki_exception.h:120
@ 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:110
@ 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:691