KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_design_block_utils.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 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#include <pgm_base.h>
25#include <kiway.h>
26#include <board_commit.h>
27#include <design_block.h>
29#include <footprint.h>
30#include <pad.h>
31#include <pcb_group.h>
33#include <pcb_edit_frame.h>
34#include <pcb_io/pcb_io.h>
35#include <pcb_io/pcb_io_mgr.h>
36#include <wx/choicdlg.h>
37#include <wx/msgdlg.h>
38#include <wx/textdlg.h>
40#include <paths.h>
41#include <env_paths.h>
42#include <common.h>
43#include <confirm.h>
44#include <kidialog.h>
45#include <locale_io.h>
46#include <netinfo.h>
47#include <tool/actions.h>
48#include <tool/tool_manager.h>
51#include <json_common.h>
52
53bool checkOverwriteDb( wxWindow* aFrame, wxString& libname, wxString& newName )
54{
55 wxString msg = wxString::Format( _( "Design block '%s' already exists in library '%s'." ), newName.GetData(),
56 libname.GetData() );
57
58 if( OKOrCancelDialog( aFrame, _( "Confirmation" ), msg, _( "Overwrite existing design block?" ), _( "Overwrite" ) )
59 != wxID_OK )
60 {
61 return false;
62 }
63
64 return true;
65}
66
67
68bool checkOverwriteDbLayout( wxWindow* aFrame, const LIB_ID& aLibId )
69{
70 wxString msg = wxString::Format( _( "Design block '%s' already has a layout." ), aLibId.GetUniStringLibItemName() );
71
72 if( OKOrCancelDialog( aFrame, _( "Confirmation" ), msg, _( "Overwrite existing layout?" ), _( "Overwrite" ) )
73 != wxID_OK )
74 {
75 return false;
76 }
77
78 return true;
79}
80
81
82bool PCB_EDIT_FRAME::saveBoardAsFile( BOARD* aBoard, const wxString& aFileName, bool aHeadless )
83{
84 // Ensure the "C" locale is temporary set, before saving any file
85 // It also avoid wxWidget alerts about locale issues, later, when using Python 3
87
88 wxFileName pcbFileName( aFileName );
89
90 if( !IsWritable( pcbFileName ) )
91 {
92 if( !aHeadless )
93 {
94 DisplayError( this, wxString::Format( _( "Insufficient permissions to write file '%s'." ),
95 pcbFileName.GetFullPath() ) );
96 }
97 return false;
98 }
99
100 try
101 {
103
104 wxASSERT( pcbFileName.IsAbsolute() );
105
106 pi->SaveBoard( pcbFileName.GetFullPath(), aBoard, nullptr );
107 }
108 catch( const IO_ERROR& ioe )
109 {
110 if( !aHeadless )
111 {
112 DisplayError( this, wxString::Format( _( "Error saving board file '%s'.\n%s" ), pcbFileName.GetFullPath(),
113 ioe.What() ) );
114 }
115
116 return false;
117 }
118
119 return true;
120}
121
122
123bool PCB_EDIT_FRAME::SaveBoardAsDesignBlock( const wxString& aLibraryName )
124{
125 // Make sure the user has selected a library to save into
126 if( m_designBlocksPane->GetSelectedLibId().GetLibNickname().empty() )
127 {
128 DisplayErrorMessage( this, _( "Please select a library to save the design block to." ) );
129 return false;
130 }
131
132 DESIGN_BLOCK blk;
133 wxFileName fn = wxFileNameFromPath( GetBoard()->GetFileName() );
134
135 blk.SetLibId( LIB_ID( aLibraryName, fn.GetName() ) );
136
137 DIALOG_DESIGN_BLOCK_PROPERTIES dlg( this, &blk );
138
139 if( dlg.ShowModal() != wxID_OK )
140 return false;
141
142 wxString libName = blk.GetLibId().GetLibNickname();
143 wxString newName = blk.GetLibId().GetLibItemName();
144
145 if( Prj().DesignBlockLibs()->DesignBlockExists( libName, newName ) && !checkOverwriteDb( this, libName, newName ) )
146 {
147 return false;
148 }
149
150 // Save a temporary copy of the schematic file, as the plugin is just going to move it
151 wxString tempFile = wxFileName::CreateTempFileName( "design_block" );
152
153 if( !SavePcbCopy( tempFile, false, false ) )
154 {
155 DisplayErrorMessage( this, _( "Error saving temporary board file to create design block." ) );
156 wxRemoveFile( tempFile );
157 return false;
158 }
159
160 blk.SetBoardFile( tempFile );
161
162 bool success = false;
163
164 try
165 {
166 success = Prj().DesignBlockLibs()->SaveDesignBlock( aLibraryName, &blk )
168 }
169 catch( const IO_ERROR& ioe )
170 {
171 DisplayError( this, ioe.What() );
172 }
173
174 // Clean up the temporary file
175 wxRemoveFile( tempFile );
176
177 m_designBlocksPane->RefreshLibs();
178 m_designBlocksPane->SelectLibId( blk.GetLibId() );
179
180 return success;
181}
182
183
185{
186 // Make sure the user has selected a library to save into
187 if( m_designBlocksPane->GetSelectedLibId().GetLibNickname().empty() )
188 {
189 DisplayErrorMessage( this, _( "Please select a library to save the design block to." ) );
190 return false;
191 }
192
193 std::unique_ptr<DESIGN_BLOCK> blk;
194
195 try
196 {
197 blk.reset( Prj().DesignBlockLibs()->LoadDesignBlock( aLibId.GetLibNickname(), aLibId.GetLibItemName() ) );
198 }
199 catch( const IO_ERROR& ioe )
200 {
201 DisplayError( this, ioe.What() );
202 return false;
203 }
204
205 if( !blk->GetBoardFile().IsEmpty() && !checkOverwriteDbLayout( this, aLibId ) )
206 return false;
207
208 // Save a temporary copy of the schematic file, as the plugin is just going to move it
209 wxString tempFile = wxFileName::CreateTempFileName( "design_block" );
210
211 if( !SavePcbCopy( tempFile, false, false ) )
212 {
213 DisplayErrorMessage( this, _( "Error saving temporary board file to create design block." ) );
214 wxRemoveFile( tempFile );
215 return false;
216 }
217
218 blk->SetBoardFile( tempFile );
219
220 bool success = false;
221
222 try
223 {
224 success = Prj().DesignBlockLibs()->SaveDesignBlock( aLibId.GetLibNickname(), blk.get() )
226 }
227 catch( const IO_ERROR& ioe )
228 {
229 DisplayError( this, ioe.What() );
230 }
231
232 // Clean up the temporary file
233 wxRemoveFile( tempFile );
234
235 m_designBlocksPane->RefreshLibs();
236 m_designBlocksPane->SelectLibId( blk->GetLibId() );
237
238 return success;
239}
240
241
242bool PCB_EDIT_FRAME::saveSelectionToDesignBlock( const wxString& aNickname, PCB_SELECTION& aSelection,
243 DESIGN_BLOCK& aBlock )
244{
245 // Create a temporary board
246 BOARD* tempBoard = new BOARD();
248 tempBoard->SetProject( &Prj(), true );
249 tempBoard->SynchronizeProperties();
250
251 // For copying net info of selected items into the new board
252 auto addNetIfNeeded =
253 [&]( EDA_ITEM* aItem )
254 {
255 BOARD_CONNECTED_ITEM* cItem = dynamic_cast<BOARD_CONNECTED_ITEM*>( aItem );
256
257 if( cItem )
258 {
259 NETINFO_ITEM* netinfo = cItem->GetNet();
260
261 if( netinfo )
262 {
263 NETINFO_ITEM* existingInfo = tempBoard->FindNet( netinfo->GetNetname() );
264
265 // If the net has already been added to the new board, update our info to match
266 if( existingInfo )
267 cItem->SetNet( existingInfo );
268 else
269 {
270 NETINFO_ITEM* newNet = new NETINFO_ITEM( tempBoard, netinfo->GetNetname() );
271 tempBoard->Add( newNet );
272 cItem->SetNet( newNet );
273 }
274 }
275 }
276 };
277
278 auto cloneAndAdd =
279 [&] ( EDA_ITEM* aItem )
280 {
281 if( !aItem->IsBOARD_ITEM() )
282 return static_cast<BOARD_ITEM*>( nullptr );
283
284 BOARD_ITEM* copy = static_cast<BOARD_ITEM*>( aItem->Clone() );
285 tempBoard->Add( copy, ADD_MODE::APPEND, false );
286 return copy;
287 };
288
289 // Copy the selected items to the temporary board
290 for( EDA_ITEM* item : aSelection )
291 {
292 BOARD_ITEM* copy = cloneAndAdd( item );
293
294 if( !copy )
295 continue;
296
297 copy->SetParentGroup( nullptr );
298
299 if( copy->Type() == PCB_FOOTPRINT_T )
300 {
301 static_cast<FOOTPRINT*>( copy )->RunOnChildren( addNetIfNeeded, RECURSE_MODE::NO_RECURSE );
302 }
303 else if( copy->Type() == PCB_GROUP_T || copy->Type() == PCB_GENERATOR_T )
304 {
305 PCB_GROUP* group = static_cast<PCB_GROUP*>( item );
306
307 // Groups also need their children copied
308 group->RunOnChildren( cloneAndAdd, RECURSE_MODE::RECURSE );
309 group->RunOnChildren( addNetIfNeeded, RECURSE_MODE::RECURSE );
310 }
311 else
312 addNetIfNeeded( copy );
313 }
314
315 wxString tempFile = wxFileName::CreateTempFileName( "design_block" );
316
317 if( !saveBoardAsFile( tempBoard, tempFile, false ) )
318 {
319 DisplayErrorMessage( this, _( "Error saving temporary board file to create design block." ) );
320 wxRemoveFile( tempFile );
321 return false;
322 }
323
324 aBlock.SetBoardFile( tempFile );
325
326 bool success = false;
327
328 try
329 {
330 success = Prj().DesignBlockLibs()->SaveDesignBlock( aNickname, &aBlock )
332 }
333 catch( const IO_ERROR& ioe )
334 {
335 DisplayError( this, ioe.What() );
336 }
337
338 // Clean up the temporary file
339 wxRemoveFile( tempFile );
340
341 m_designBlocksPane->RefreshLibs();
342 m_designBlocksPane->SelectLibId( aBlock.GetLibId() );
343
344 return success;
345}
346
347
348bool PCB_EDIT_FRAME::SaveSelectionAsDesignBlock( const wxString& aLibraryName )
349{
350 // Make sure the user has selected a library to save into
351 if( m_designBlocksPane->GetSelectedLibId().GetLibNickname().empty() )
352 {
353 DisplayErrorMessage( this, _( "Please select a library to save the design block to." ) );
354 return false;
355 }
356
357 // Get all selected items
358 PCB_SELECTION selection = m_toolManager->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
359
360 if( selection.Empty() )
361 {
362 DisplayErrorMessage( this, _( "Please select some items to save as a design block." ) );
363 return false;
364 }
365
366 DESIGN_BLOCK blk;
367 PCB_GROUP* group = nullptr;
368
369 if( selection.Size() == 1 && selection.HasType( PCB_GROUP_T ) )
370 group = static_cast<PCB_GROUP*>( selection.Front() );
371
372 if( group && !group->GetName().IsEmpty() )
373 // If the user has selected a single group, they probably want the design block named after the group
374 blk.SetLibId( LIB_ID( aLibraryName, group->GetName() ) );
375 else
376 {
377 // Otherwise, use the current screen name
378 wxFileName fn = wxFileNameFromPath( GetBoard()->GetFileName() );
379 blk.SetLibId( LIB_ID( aLibraryName, fn.GetName() ) );
380 }
381
382 DIALOG_DESIGN_BLOCK_PROPERTIES dlg( this, &blk );
383
384 if( dlg.ShowModal() != wxID_OK )
385 return false;
386
387 wxString libName = blk.GetLibId().GetLibNickname();
388 wxString newName = blk.GetLibId().GetLibItemName();
389
390 if( Prj().DesignBlockLibs()->DesignBlockExists( libName, newName ) && !checkOverwriteDb( this, libName, newName ) )
391 {
392 return false;
393 }
394
395 // If we have a single group, we want to strip the group and select the children
396 if( group )
397 {
398 selection.Remove( group );
399
400 // Don't recurse; if we have a group of groups the user probably intends the inner groups to be saved
401 group->RunOnChildren(
402 [&]( EDA_ITEM* aItem )
403 {
404 selection.Add( aItem );
405 },
407 }
408
409 bool success = saveSelectionToDesignBlock( libName, selection, blk );
410
411 if( success && !group )
412 {
413 BOARD_COMMIT commit( m_toolManager );
414
415 PCB_GROUP* newGroup = new PCB_GROUP( GetBoard() );
416 newGroup->SetName( blk.GetLibId().GetUniStringLibItemName() );
417 newGroup->SetDesignBlockLibId( blk.GetLibId() );
418
419 bool added = false;
420
421 for( EDA_ITEM* edaItem : selection )
422 {
423 if( !edaItem->IsBOARD_ITEM() )
424 continue;
425
426 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( edaItem );
427
428 if( item->GetParentFootprint() )
429 continue;
430
431 if( !item->IsGroupableType() )
432 continue;
433
434 if( EDA_GROUP* existingGroup = item->GetParentGroup() )
435 commit.Modify( existingGroup->AsEdaItem(), nullptr, RECURSE_MODE::NO_RECURSE );
436
437 commit.Modify( item, nullptr, RECURSE_MODE::NO_RECURSE );
438 newGroup->AddItem( item );
439 added = true;
440 }
441
442 if( added )
443 {
444 commit.Add( newGroup );
445 commit.Push( _( "Group Items" ) );
446
448 m_toolManager->RunAction( ACTIONS::selectItem, newGroup->AsEdaItem() );
449 }
450 else
451 {
452 delete newGroup;
453 }
454 }
455
456 if( success && group && !group->HasDesignBlockLink() )
457 {
458 BOARD_COMMIT commit( m_toolManager );
459
460 commit.Modify( group, nullptr, RECURSE_MODE::NO_RECURSE );
461 group->SetDesignBlockLibId( blk.GetLibId() );
462
463 commit.Push( _( "Set Group Design Block Link" ) );
464 }
465
466 return success;
467}
468
469
471{
472 // Make sure the user has selected a library to save into
473 if( !aLibId.IsValid() )
474 {
475 DisplayErrorMessage( this, _( "Please select a library to save the design block to." ) );
476 return false;
477 }
478
479 // Get all selected items
480 PCB_SELECTION selection = m_toolManager->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
481
482 if( selection.Empty() )
483 {
484 DisplayErrorMessage( this, _( "Please select some items to save as a design block." ) );
485 return false;
486 }
487
488 // If we have a single group, we want to strip the group and select the children
489 PCB_GROUP* group = nullptr;
490
491 if( selection.Size() == 1 )
492 {
493 EDA_ITEM* item = selection.Front();
494
495 if( item->Type() == PCB_GROUP_T || item->Type() == PCB_GENERATOR_T )
496 {
497 group = static_cast<PCB_GROUP*>( item );
498
499 selection.Remove( item );
500
501 // Don't recurse; if we have a group of groups the user probably intends the inner groups to be saved
502 group->RunOnChildren( [&]( EDA_ITEM* aItem ) { selection.Add( aItem ); }, RECURSE_MODE::NO_RECURSE );
503 }
504 }
505
506 std::unique_ptr<DESIGN_BLOCK> blk;
507
508 try
509 {
510 blk.reset( Prj().DesignBlockLibs()->LoadDesignBlock( aLibId.GetLibNickname(), aLibId.GetLibItemName() ) );
511 }
512 catch( const IO_ERROR& ioe )
513 {
514 DisplayError( this, ioe.What() );
515 return false;
516 }
517
518 if( !blk->GetBoardFile().IsEmpty() && !checkOverwriteDbLayout( this, aLibId ) )
519 return false;
520
521 if( !saveSelectionToDesignBlock( aLibId.GetLibNickname(), selection, *blk ) )
522 return false;
523
524 // If we had a group, we need to reselect it
525 if( group )
526 {
527 selection.Clear();
528 selection.Add( group );
529
530 // If we didn't have a design block link before, add one for convenience
531 if( !group->HasDesignBlockLink() )
532 {
533 BOARD_COMMIT commit( m_toolManager );
534
535 commit.Modify( group, nullptr, RECURSE_MODE::NO_RECURSE );
536 group->SetDesignBlockLibId( aLibId );
537
538 commit.Push( _( "Set Group Design Block Link" ) );
539 }
540 }
541 else
542 {
543 BOARD_COMMIT commit( m_toolManager );
544
545 PCB_GROUP* newGroup = new PCB_GROUP( GetBoard() );
546 newGroup->SetName( aLibId.GetUniStringLibItemName() );
547 newGroup->SetDesignBlockLibId( aLibId );
548
549 bool added = false;
550
551 for( EDA_ITEM* edaItem : selection )
552 {
553 if( !edaItem->IsBOARD_ITEM() )
554 continue;
555
556 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( edaItem );
557
558 if( item->GetParentFootprint() )
559 continue;
560
561 if( !item->IsGroupableType() )
562 continue;
563
564 if( EDA_GROUP* existingGroup = item->GetParentGroup() )
565 commit.Modify( existingGroup->AsEdaItem(), nullptr, RECURSE_MODE::NO_RECURSE );
566
567 commit.Modify( item, nullptr, RECURSE_MODE::NO_RECURSE );
568 newGroup->AddItem( item );
569 added = true;
570 }
571
572 if( added )
573 {
574 commit.Add( newGroup );
575 commit.Push( _( "Group Items" ) );
576
578 m_toolManager->RunAction( ACTIONS::selectItem, newGroup->AsEdaItem() );
579 }
580 else
581 {
582 delete newGroup;
583 }
584 }
585
586 return true;
587}
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
Definition actions.h:227
static TOOL_ACTION selectionClear
Clear the current selection.
Definition actions.h:224
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
NETINFO_ITEM * GetNet() const
Return #NET_INFO object for a given item.
void SetNet(NETINFO_ITEM *aNetInfo)
Set a NET_INFO object for the item.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:83
bool IsGroupableType() const
FOOTPRINT * GetParentFootprint() const
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:322
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition board.cpp:1222
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition board.cpp:2358
void SetDesignSettings(const BOARD_DESIGN_SETTINGS &aSettings)
Definition board.cpp:1088
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
Definition board.cpp:202
void SynchronizeProperties()
Copy the current project's text variables into the boards property cache.
Definition board.cpp:2478
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
Definition commit.h:106
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Add a new item to the model.
Definition commit.h:78
SAVE_T SaveDesignBlock(const wxString &aNickname, const DESIGN_BLOCK *aDesignBlock, bool aOverwrite=true)
Write aDesignBlock to an existing library given by aNickname.
void SetBoardFile(const wxString &aFile)
void SetLibId(const LIB_ID &aName)
const LIB_ID & GetLibId() const
int ShowModal() override
bool IsWritable(const wxFileName &aFileName, bool aVerbose=true)
Check if aFileName can be written.
A set of EDA_ITEMs (i.e., without duplicates).
Definition eda_group.h:46
void SetDesignBlockLibId(const LIB_ID &aLibId)
Definition eda_group.h:72
void AddItem(EDA_ITEM *aItem)
Add item to group.
Definition eda_group.cpp:27
void SetName(const wxString &aName)
Definition eda_group.h:52
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
virtual EDA_GROUP * GetParentGroup() const
Definition eda_item.h:116
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
virtual const wxString What() const
A composite of Problem() and Where()
A logical library item identifier and consists of various portions much like a URI.
Definition lib_id.h:49
bool IsValid() const
Check if this LID_ID is valid.
Definition lib_id.h:172
const wxString GetUniStringLibItemName() const
Get strings for display messages in dialogs.
Definition lib_id.h:112
const UTF8 & GetLibItemName() const
Definition lib_id.h:102
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition lib_id.h:87
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition locale_io.h:41
Handle the data for a net.
Definition netinfo.h:54
const wxString & GetNetname() const
Definition netinfo.h:112
BOARD * GetBoard() const
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Return the BOARD_DESIGN_SETTINGS for the open project.
bool saveBoardAsFile(BOARD *aBoard, const wxString &aFileName, bool aHeadless=false)
Save a board object to a file.
bool saveSelectionToDesignBlock(const wxString &aNickname, PCB_SELECTION &aSelection, DESIGN_BLOCK &aBlock)
bool UpdateDesignBlockFromBoard(const LIB_ID &aLibId)
bool UpdateDesignBlockFromSelection(const LIB_ID &aLibId)
bool SavePcbCopy(const wxString &aFileName, bool aCreateProject=false, bool aHeadless=false)
Write the board data structures to aFileName.
bool SaveSelectionAsDesignBlock(const wxString &aLibraryName)
bool SaveBoardAsDesignBlock(const wxString &aLibraryName)
PCB_DESIGN_BLOCK_PANE * m_designBlocksPane
A set of BOARD_ITEMs (i.e., without duplicates).
Definition pcb_group.h:53
EDA_ITEM * AsEdaItem() override
Definition pcb_group.h:60
@ KICAD_SEXP
S-expression Pcbnew file format.
Definition pcb_io_mgr.h:58
static PCB_IO * FindPlugin(PCB_FILE_T aFileType)
Return a #PLUGIN which the caller can use to import, export, save, or load design documents.
The selection tool: currently supports:
virtual DESIGN_BLOCK_LIBRARY_ADAPTER * DesignBlockLibs()
Return the table of design block libraries.
Definition project.cpp:417
virtual void Add(EDA_ITEM *aItem)
Definition selection.cpp:42
virtual void Remove(EDA_ITEM *aItem)
Definition selection.cpp:60
EDA_ITEM * Front() const
Definition selection.h:177
virtual void Clear() override
Remove all the stored items from the group.
Definition selection.h:98
bool HasType(KICAD_T aType) const
Checks if there is at least one item of requested kind.
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
TOOL_MANAGER * m_toolManager
The common library.
int OKOrCancelDialog(wxWindow *aParent, const wxString &aWarning, const wxString &aMessage, const wxString &aDetailedMessage, const wxString &aOKLabel, const wxString &aCancelLabel, bool *aApplyToAll)
Display a warning dialog with aMessage and returns the user response.
Definition confirm.cpp:150
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition confirm.cpp:202
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
Definition confirm.cpp:177
This file is part of the common library.
#define _(s)
@ RECURSE
Definition eda_item.h:51
@ NO_RECURSE
Definition eda_item.h:52
Helper functions to substitute paths with environmental variables.
std::unique_ptr< T > IO_RELEASER
Helper to hold and release an IO_BASE object when exceptions are thrown.
Definition io_mgr.h:33
PROJECT & Prj()
Definition kicad.cpp:637
bool checkOverwriteDb(wxWindow *aFrame, wxString &libname, wxString &newName)
bool checkOverwriteDbLayout(wxWindow *aFrame, const LIB_ID &aLibId)
Class to handle a set of BOARD_ITEMs.
see class PGM_BASE
bool checkOverwriteDb(wxWindow *aFrame, wxString &libname, wxString &newName)
std::vector< FAB_LAYER_COLOR > dummy
@ 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_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition typeinfo.h:86
Definition of file extensions used in Kicad.