36#include <wx/choicdlg.h> 
   38#include <wx/textdlg.h> 
   54    wxString msg = wxString::Format( 
_( 
"Design block '%s' already exists in library '%s'." ), newName.GetData(),
 
   57    if( 
OKOrCancelDialog( aFrame, 
_( 
"Confirmation" ), msg, 
_( 
"Overwrite existing design block?" ), 
_( 
"Overwrite" ) )
 
 
   71    if( 
OKOrCancelDialog( aFrame, 
_( 
"Confirmation" ), msg, 
_( 
"Overwrite existing layout?" ), 
_( 
"Overwrite" ) )
 
 
   87    wxFileName pcbFileName( aFileName );
 
   93            DisplayError( 
this, wxString::Format( 
_( 
"Insufficient permissions to write file '%s'." ),
 
   94                                                  pcbFileName.GetFullPath() ) );
 
  103        wxASSERT( pcbFileName.IsAbsolute() );
 
  105        pi->SaveBoard( pcbFileName.GetFullPath(), aBoard, 
nullptr );
 
  111            DisplayError( 
this, wxString::Format( 
_( 
"Error saving board file '%s'.\n%s" ), pcbFileName.GetFullPath(),
 
 
  132    wxFileName   fn = wxFileNameFromPath( 
GetBoard()->GetFileName() );
 
  144    if( 
Prj().DesignBlockLibs()->DesignBlockExists( libName, newName ) && !
checkOverwriteDb( 
this, libName, newName ) )
 
  150    wxString tempFile = wxFileName::CreateTempFileName( 
"design_block" );
 
  155        wxRemoveFile( tempFile );
 
  161    bool success = 
false;
 
  174    wxRemoveFile( tempFile );
 
 
  192    std::unique_ptr<DESIGN_BLOCK> blk;
 
  208    wxString tempFile = wxFileName::CreateTempFileName( 
"design_block" );
 
  213        wxRemoveFile( tempFile );
 
  217    blk->SetBoardFile( tempFile );
 
  219    bool success = 
false;
 
  232    wxRemoveFile( tempFile );
 
 
  251    auto addNetIfNeeded =
 
  266                            cItem->
SetNet( existingInfo );
 
  270                            tempBoard->
Add( newNet );
 
  280                if( !aItem->IsBOARD_ITEM() )
 
  296        copy->SetParentGroup( 
nullptr );
 
  311            addNetIfNeeded( 
copy );
 
  314    wxString tempFile = wxFileName::CreateTempFileName( 
"design_block" );
 
  319        wxRemoveFile( tempFile );
 
  325    bool success = 
false;
 
  338    wxRemoveFile( tempFile );
 
 
  359    if( selection.
Empty() )
 
  366    wxFileName   fn = wxFileNameFromPath( 
GetBoard()->GetFileName() );
 
  378    if( 
Prj().DesignBlockLibs()->DesignBlockExists( libName, newName ) && !
checkOverwriteDb( 
this, libName, newName ) )
 
 
  399    if( selection.
Empty() )
 
  408    if( selection.
Size() == 1 )
 
  423    std::unique_ptr<DESIGN_BLOCK> blk;
 
  448        if( !
group->HasDesignBlockLink() )
 
  453            group->SetDesignBlockLibId( aLibId );
 
  455            commit.
Push( 
"Set Group Design Block Link" );
 
 
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...
 
Information pertinent to a Pcbnew printed circuit board.
 
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
 
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
 
void SetDesignSettings(const BOARD_DESIGN_SETTINGS &aSettings)
 
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
 
void SynchronizeProperties()
Copy the current project's text variables into the boards property cache.
 
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
 
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
 
bool IsWritable(const wxFileName &aFileName, bool aVerbose=true)
Check if aFileName can be written.
 
A base class for most all the KiCad significant classes used in schematics and boards.
 
KICAD_T Type() const
Returns the type of object.
 
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.
 
bool IsValid() const
Check if this LID_ID is valid.
 
const wxString GetUniStringLibItemName() const
Get strings for display messages in dialogs.
 
const UTF8 & GetLibItemName() const
 
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
 
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
 
Handle the data for a net.
 
const wxString & GetNetname() 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 SaveBoardToDesignBlock(const LIB_ID &aLibId)
 
bool saveSelectionToDesignBlock(const wxString &aNickname, PCB_SELECTION &aSelection, DESIGN_BLOCK &aBlock)
 
bool SavePcbCopy(const wxString &aFileName, bool aCreateProject=false, bool aHeadless=false)
Write the board data structures to aFileName.
 
bool SaveSelectionAsDesignBlock(const wxString &aLibraryName)
 
bool SaveSelectionToDesignBlock(const LIB_ID &aLibId)
 
bool SaveBoardAsDesignBlock(const wxString &aLibraryName)
 
PCB_DESIGN_BLOCK_PANE * m_designBlocksPane
 
A set of BOARD_ITEMs (i.e., without duplicates).
 
static PCB_IO * PluginFind(PCB_FILE_T aFileType)
Return a #PLUGIN which the caller can use to import, export, save, or load design documents.
 
@ KICAD_SEXP
S-expression Pcbnew file format.
 
virtual DESIGN_BLOCK_LIBRARY_ADAPTER * DesignBlockLibs()
Return the table of design block libraries.
 
virtual void Add(EDA_ITEM *aItem)
 
virtual void Remove(EDA_ITEM *aItem)
 
virtual void Clear() override
Remove all the stored items from the group.
 
int Size() const
Returns the number of selected parts.
 
bool Empty() const
Checks if there is anything selected.
 
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.
 
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
 
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
 
This file is part of the common library.
 
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.
 
bool checkOverwriteDb(wxWindow *aFrame, wxString &libname, wxString &newName)
 
bool checkOverwriteDbLayout(wxWindow *aFrame, const LIB_ID &aLibId)
 
Class to handle a set of BOARD_ITEMs.
 
bool checkOverwriteDb(wxWindow *aFrame, wxString &libname, wxString &newName)
 
std::vector< FAB_LAYER_COLOR > dummy
 
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
 
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
 
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
 
Definition of file extensions used in Kicad.