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
47 m_formatter(),
48 m_writer( &CLIPBOARD_IO::clipboardWriter ),
49 m_reader( &CLIPBOARD_IO::clipboardReader )
50{
52}
53
54
56{
57}
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 // Prepare net mapping that assures that net codes saved in a file are consecutive integers
131
132 auto deleteUnselectedCells =
133 []( PCB_TABLE* aTable )
134 {
135 int minCol = aTable->GetColCount();
136 int maxCol = -1;
137 int minRow = aTable->GetRowCount();
138 int maxRow = -1;
139
140 for( int row = 0; row < aTable->GetRowCount(); ++row )
141 {
142 for( int col = 0; col < aTable->GetColCount(); ++col )
143 {
144 PCB_TABLECELL* cell = aTable->GetCell( row, col );
145
146 if( cell->IsSelected() )
147 {
148 minRow = std::min( minRow, row );
149 maxRow = std::max( maxRow, row );
150 minCol = std::min( minCol, col );
151 maxCol = std::max( maxCol, col );
152 }
153 else
154 {
155 cell->SetFlags( STRUCT_DELETED );
156 }
157 }
158 }
159
160 wxCHECK_MSG( maxCol >= minCol && maxRow >= minRow, /*void*/,
161 wxT( "No selected cells!" ) );
162
163 // aTable is always a clone in the clipboard case
164 int destRow = 0;
165
166 for( int row = minRow; row <= maxRow; row++ )
167 aTable->SetRowHeight( destRow++, aTable->GetRowHeight( row ) );
168
169 int destCol = 0;
170
171 for( int col = minCol; col <= maxCol; col++ )
172 aTable->SetColWidth( destCol++, aTable->GetColWidth( col ) );
173
174 aTable->DeleteMarkedCells();
175 aTable->SetColCount( ( maxCol - minCol ) + 1 );
176 aTable->Normalize();
177 };
178
179 std::set<PCB_TABLE*> promotedTables;
180
181 auto parentIsPromoted =
182 [&]( PCB_TABLECELL* cell ) -> bool
183 {
184 for( PCB_TABLE* table : promotedTables )
185 {
186 if( table->m_Uuid == cell->GetParent()->m_Uuid )
187 return true;
188 }
189
190 return false;
191 };
192
193 if( aSelected.Size() == 1 && aSelected.Front()->Type() == PCB_FOOTPRINT_T )
194 {
195 // make the footprint safe to transfer to other pcbs
196 const FOOTPRINT* footprint = static_cast<FOOTPRINT*>( aSelected.Front() );
197 // Do not modify existing board
198 FOOTPRINT newFootprint( *footprint );
199
200 for( PAD* pad : newFootprint.Pads() )
201 pad->SetNetCode( 0 );
202
203 // locked means "locked in place"; copied items therefore can't be locked
204 newFootprint.SetLocked( false );
205
206 // locate the reference point at (0, 0) in the copied items
207 newFootprint.Move( VECTOR2I( -refPoint.x, -refPoint.y ) );
208
209 Format( static_cast<BOARD_ITEM*>( &newFootprint ) );
210
211 newFootprint.SetParent( nullptr );
212 newFootprint.SetParentGroup( nullptr );
213 }
214 else if( isFootprintEditor )
215 {
216 FOOTPRINT partialFootprint( m_board );
217
218 // Useful to copy the selection to the board editor (if any), and provides
219 // a dummy lib id.
220 // Perhaps not a good Id, but better than a empty id
221 KIID dummy;
222 LIB_ID id( "clipboard", dummy.AsString() );
223 partialFootprint.SetFPID( id );
224
225 for( EDA_ITEM* item : aSelected )
226 {
227 if( !item->IsBOARD_ITEM() )
228 continue;
229
230 BOARD_ITEM* boardItem = static_cast<BOARD_ITEM*>( item );
231 BOARD_ITEM* copy = nullptr;
232
233 if( PCB_FIELD* field = dynamic_cast<PCB_FIELD*>( item ) )
234 {
235 if( field->IsMandatoryField() )
236 continue;
237 }
238
239 if( boardItem->Type() == PCB_GROUP_T )
240 {
241 copy = static_cast<PCB_GROUP*>( boardItem )->DeepClone();
242 }
243 else if( boardItem->Type() == PCB_GENERATOR_T )
244 {
245 copy = static_cast<PCB_GENERATOR*>( boardItem )->DeepClone();
246 }
247 else if( item->Type() == PCB_TABLECELL_T )
248 {
249 if( parentIsPromoted( static_cast<PCB_TABLECELL*>( item ) ) )
250 continue;
251
252 copy = static_cast<BOARD_ITEM*>( item->GetParent()->Clone() );
253 promotedTables.insert( static_cast<PCB_TABLE*>( copy ) );
254 }
255 else
256 {
257 copy = static_cast<BOARD_ITEM*>( boardItem->Clone() );
258 }
259
260 // If it is only a footprint, clear the nets from the pads
261 if( PAD* pad = dynamic_cast<PAD*>( copy ) )
262 pad->SetNetCode( 0 );
263
264 // Don't copy group membership information for the 1st level objects being copied
265 // since the group they belong to isn't being copied.
266 copy->SetParentGroup( nullptr );
267
268 // Add the pad to the new footprint before moving to ensure the local coords are
269 // correct
270 partialFootprint.Add( copy );
271
272 // A list of not added items, when adding items to the footprint
273 // some PCB_TEXT (reference and value) cannot be added to the footprint
274 std::vector<BOARD_ITEM*> skipped_items;
275
276 if( copy->Type() == PCB_GROUP_T || copy->Type() == PCB_GENERATOR_T )
277 {
278 copy->RunOnDescendants(
279 [&]( BOARD_ITEM* descendant )
280 {
281 // One cannot add an additional mandatory field to a given footprint:
282 // only one is allowed. So add only non-mandatory fields.
283 bool can_add = true;
284
285 if( const PCB_FIELD* field = dynamic_cast<const PCB_FIELD*>( item ) )
286 {
287 if( field->IsMandatoryField() )
288 can_add = false;
289 }
290
291 if( can_add )
292 partialFootprint.Add( descendant );
293 else
294 skipped_items.push_back( descendant );
295 } );
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)",
332
335
336 for( EDA_ITEM* item : aSelected )
337 {
338 if( !item->IsBOARD_ITEM() )
339 continue;
340
341 BOARD_ITEM* boardItem = static_cast<BOARD_ITEM*>( item );
342 BOARD_ITEM* copy = nullptr;
343
344 wxCHECK2( boardItem, continue );
345
346 if( boardItem->Type() == PCB_FIELD_T )
347 {
348 PCB_FIELD* field = static_cast<PCB_FIELD*>( boardItem );
349 copy = new PCB_TEXT( m_board );
350
351 PCB_TEXT* textItem = static_cast<PCB_TEXT*>( copy );
352 textItem->SetPosition( field->GetPosition() );
353 textItem->SetLayer( field->GetLayer() );
354 textItem->SetHyperlink( field->GetHyperlink() );
355 textItem->SetText( field->GetText() );
356 textItem->SetAttributes( field->GetAttributes() );
357 textItem->SetTextAngle( field->GetDrawRotation() );
358
359 if ( textItem->GetText() == wxT( "${VALUE}" ) )
360 textItem->SetText( boardItem->GetParentFootprint()->GetValue() );
361 else if ( textItem->GetText() == wxT( "${REFERENCE}" ) )
362 textItem->SetText( boardItem->GetParentFootprint()->GetReference() );
363
364 }
365 else if( boardItem->Type() == PCB_TEXT_T )
366 {
367 copy = static_cast<BOARD_ITEM*>( boardItem->Clone() );
368
369 PCB_TEXT* textItem = static_cast<PCB_TEXT*>( copy );
370
371 if( textItem->GetText() == wxT( "${VALUE}" ) )
372 textItem->SetText( boardItem->GetParentFootprint()->GetValue() );
373 else if( textItem->GetText() == wxT( "${REFERENCE}" ) )
374 textItem->SetText( boardItem->GetParentFootprint()->GetReference() );
375 }
376 else if( boardItem->Type() == PCB_GROUP_T )
377 {
378 copy = static_cast<PCB_GROUP*>( boardItem )->DeepClone();
379 }
380 else if( boardItem->Type() == PCB_GENERATOR_T )
381 {
382 copy = static_cast<PCB_GENERATOR*>( boardItem )->DeepClone();
383 }
384 else if( item->Type() == PCB_TABLECELL_T )
385 {
386 if( parentIsPromoted( static_cast<PCB_TABLECELL*>( item ) ) )
387 continue;
388
389 copy = static_cast<BOARD_ITEM*>( item->GetParent()->Clone() );
390 promotedTables.insert( static_cast<PCB_TABLE*>( copy ) );
391 }
392 else
393 {
394 copy = static_cast<BOARD_ITEM*>( boardItem->Clone() );
395 }
396
397 if( copy )
398 {
399 if( copy->Type() == PCB_FIELD_T || copy->Type() == PCB_PAD_T )
400 {
401 // Create a parent footprint to own the copied item
402 FOOTPRINT* footprint = new FOOTPRINT( m_board );
403
404 footprint->SetPosition( copy->GetPosition() );
405 footprint->Add( copy );
406
407 // Convert any mandatory fields to user fields. The destination footprint
408 // will already have its own mandatory fields.
409 if( PCB_FIELD* field = dynamic_cast<PCB_FIELD*>( copy ) )
410 {
411 if( field->IsMandatoryField() )
412 field->SetId( footprint->GetNextFieldId() );
413 }
414
415 copy = footprint;
416 }
417
418 copy->SetLocked( false );
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->RunOnDescendants(
436 [&]( BOARD_ITEM* descendant )
437 {
438 descendant->SetLocked( false );
439 Format( descendant );
440 } );
441 }
442
443 copy->SetParentGroup( nullptr );
444 delete copy;
445 }
446 }
447
448 m_formatter.Print( ")" );
449 }
450
451 std::string prettyData = m_formatter.GetString();
452 KICAD_FORMAT::Prettify( prettyData, true );
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 {
466 item = PCB_IO_KICAD_SEXPR::Parse( result );
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 // Prepare net mapping that assures that net codes saved in a file are consecutive integers
485 m_mapping->SetBoard( aBoard );
486
487 m_formatter.Print( "(kicad_pcb (version %d) (generator \"pcbnew\") (generator_version %s)",
490
491 Format( aBoard );
492
493 m_formatter.Print( ")" );
494
495 std::string prettyData = m_formatter.GetString();
496 KICAD_FORMAT::Prettify( prettyData, true );
497
498 m_writer( wxString( prettyData.c_str(), wxConvUTF8 ) );
499}
500
501
502BOARD* CLIPBOARD_IO::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
503 const std::map<std::string, UTF8>* aProperties, PROJECT* aProject )
504{
505 std::string result( m_reader().mb_str() );
506
507 std::function<bool( wxString, int, wxString, wxString )> queryUser =
508 [&]( wxString aTitle, int aIcon, wxString aMessage, wxString aAction ) -> bool
509 {
510 KIDIALOG dlg( nullptr, aMessage, aTitle, wxOK | wxCANCEL | aIcon );
511
512 if( !aAction.IsEmpty() )
513 dlg.SetOKLabel( aAction );
514
515 dlg.DoNotShowCheckbox( aMessage, 0 );
516
517 return dlg.ShowModal() == wxID_OK;
518 };
519
520 STRING_LINE_READER reader( result, wxT( "clipboard" ) );
521 PCB_IO_KICAD_SEXPR_PARSER parser( &reader, aAppendToMe, queryUser );
522
523 init( aProperties );
524
525 BOARD_ITEM* item;
526 BOARD* board;
527
528 try
529 {
530 item = parser.Parse();
531 }
532 catch( const FUTURE_FORMAT_ERROR& )
533 {
534 // Don't wrap a FUTURE_FORMAT_ERROR in another
535 throw;
536 }
537 catch( const PARSE_ERROR& parse_error )
538 {
539 if( parser.IsTooRecent() )
540 throw FUTURE_FORMAT_ERROR( parse_error, parser.GetRequiredVersion() );
541 else
542 throw;
543 }
544
545 if( item->Type() != PCB_T )
546 {
547 // The parser loaded something that was valid, but wasn't a board.
548 THROW_PARSE_ERROR( _( "Clipboard content is not KiCad compatible" ), parser.CurSource(),
549 parser.CurLine(), parser.CurLineNumber(), parser.CurOffset() );
550 }
551 else
552 {
553 board = dynamic_cast<BOARD*>( item );
554 }
555
556 // Give the filename to the board if it's new
557 if( board && !aAppendToMe )
558 board->SetFileName( aFileName );
559
560 return board;
561}
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:239
void SetParentGroup(PCB_GROUP *aGroup)
Definition: board_item.h:89
virtual void SetLocked(bool aLocked)
Definition: board_item.h:330
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:290
FOOTPRINT * GetParentFootprint() const
Definition: board_item.cpp:298
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:295
void SetFileName(const wxString &aFileName)
Definition: board.h:330
const FOOTPRINTS & Footprints() const
Definition: board.h:336
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:387
const TEXT_ATTRIBUTES & GetAttributes() const
Definition: eda_text.h:218
void SetHyperlink(wxString aLink)
Definition: eda_text.h:388
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:268
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
Definition: eda_text.cpp:290
void SetPosition(const VECTOR2I &aPos) override
Definition: footprint.cpp:2451
void SetFPID(const LIB_ID &aFPID)
Definition: footprint.h:247
void SetLocked(bool isLocked) override
Set the #MODULE_is_LOCKED bit in the m_ModuleStatus.
Definition: footprint.h:419
int GetNextFieldId() const
Return the next ID for a field for this footprint.
Definition: footprint.h:742
void MoveAnchorPosition(const VECTOR2I &aMoveVector)
Move the reference point of the footprint.
Definition: footprint.cpp:2485
std::deque< PAD * > & Pads()
Definition: footprint.h:204
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: footprint.cpp:2344
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: footprint.cpp:1079
const wxString & GetValue() const
Definition: footprint.h:642
const wxString & GetReference() const
Definition: footprint.h:620
VECTOR2I GetPosition() const override
Definition: footprint.h:222
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
Definition: kidialog.h:43
void DoNotShowCheckbox(wxString file, int line)
Shows the 'do not show again' checkbox.
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:545
int PRINTF_FUNC_N Print(int nestLevel, const char *fmt,...)
Format and write text to the output stream.
Definition: richio.cpp:460
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:169
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:695