57#include <wx/choicdlg.h>
58#include <wx/filedlg.h>
59#include <wx/fswatcher.h>
66 _(
"Writing/modifying legacy libraries (.mod files) is not allowed\n"\
67 "Please save the current library to the new .pretty format\n"\
68 "and update your footprint lib table\n"\
69 "to save your footprint (a .kicad_mod file) in the .pretty library folder" ) );
72 _(
"Modifying legacy libraries (.mod files) is not allowed\n"\
73 "Please save the current library under the new .pretty format\n"\
74 "and update your footprint lib table\n"\
75 "before deleting a footprint" ) );
89 static int lastFilterIndex = 0;
90 wxString fileFiltersStr;
91 std::vector<std::string> allExtensions;
92 std::set<wxString> allWildcardsSet;
106 if( !fileFiltersStr.IsEmpty() )
107 fileFiltersStr += wxChar(
'|' );
113 allExtensions.emplace_back( ext );
118 wxString allWildcardsStr;
119 for(
const wxString& wildcard : allWildcardsSet )
120 allWildcardsStr << wildcard;
122 fileFiltersStr =
_(
"All supported formats" ) + wxT(
"|" ) + allWildcardsStr + wxT(
"|" )
125 wxFileDialog dlg(
this,
_(
"Import Footprint" ),
m_mruPath, wxEmptyString, fileFiltersStr,
126 wxFD_OPEN | wxFD_FILE_MUST_EXIST );
128 dlg.SetFilterIndex( lastFilterIndex );
130 if( dlg.ShowModal() == wxID_CANCEL )
133 lastFilterIndex = dlg.GetFilterIndex();
141 if( !wxFileExists( fn.GetFullPath() ) )
143 wxString msg = wxString::Format(
_(
"File '%s' not found." ), fn.GetFullPath() );
159 if( pi->GetLibraryFileDesc().m_FileExtensions.empty() )
162 if( pi->CanReadFootprint( fn.GetFullPath() ) )
176 wxString footprintName;
182 footprint = pi->ImportFootprint( fn.GetFullPath(), footprintName);
186 wxString msg = wxString::Format(
_(
"Unable to load footprint '%s' from '%s'" ),
187 footprintName, fn.GetFullPath() );
205 footprint->
SetFPID(
LIB_ID( wxEmptyString, footprintName ) );
242 wxFileDialog dlg(
this,
_(
"Export Footprint" ), fn.GetPath(), fn.GetFullName(),
243 wildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
245 if( dlg.ShowModal() == wxID_CANCEL )
265 pcb_io.
Format( aFootprint );
267 FILE* fp = wxFopen( dlg.GetPath(), wxT(
"wt" ) );
271 DisplayErrorMessage(
this, wxString::Format(
_(
"Insufficient permissions to write file '%s'." ),
285 wxString msg = wxString::Format(
_(
"Footprint exported to file '%s'." ), dlg.GetPath() );
291 const wxString& aProposedName )
298 const wxString& aProposedName )
307 const wxString& aProposedName,
314 if( aTable ==
nullptr )
315 return wxEmptyString;
317 wxString initialPath = aProposedName.IsEmpty() ?
Prj().
GetProjectPath() : aProposedName;
322 if( aLibName.IsEmpty() )
330 return wxEmptyString;
339 if( !fn.IsAbsolute() )
341 fn.SetName( aLibName );
342 fn.MakeAbsolute( initialPath );
348 wxString libPath = fn.GetFullPath();
354 bool writable =
false;
359 writable = pi->IsLibraryWritable( libPath );
371 wxString msg = wxString::Format(
_(
"Library %s is read only." ), libPath );
373 return wxEmptyString;
377 wxString msg = wxString::Format(
_(
"Library %s already exists." ), libPath );
378 KIDIALOG dlg(
this, msg,
_(
"Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
379 dlg.SetOKLabel(
_(
"Overwrite" ) );
383 return wxEmptyString;
385 pi->DeleteLibrary( libPath );
389 pi->CreateLibrary( libPath );
394 return wxEmptyString;
407 if(
Prj().IsNullProject() )
413 wxMessageDialog dlg(
this,
_(
"Add the library to the global library table?" ),
414 _(
"Add To Global Library Table" ), wxYES_NO );
416 if( dlg.ShowModal() != wxID_OK )
423 wxArrayString libTableNames;
424 libTableNames.Add(
_(
"Global" ) );
425 libTableNames.Add(
_(
"Project" ) );
427 wxSingleChoiceDialog dlg(
this,
_(
"Choose the Library Table to add the library to:" ),
428 _(
"Add To Library Table" ), libTableNames );
432 dlg.FindWindow( wxID_CANCEL )->SetLabel(
_(
"Skip" ) );
433 dlg.FindWindow( wxID_OK )->SetLabel(
_(
"Add" ) );
436 if( dlg.ShowModal() != wxID_OK )
439 switch( dlg.GetSelection() )
443 default:
return nullptr;
450 if( aTable ==
nullptr )
453 if( aTable ==
nullptr )
454 return wxEmptyString;
458 wxFileName fn( aFilename );
460 if( aFilename.IsEmpty() )
470 wxString libPath = fn.GetFullPath();
471 wxString libName = fn.GetName();
473 if( libName.IsEmpty() )
487 libName = fn.GetFullName();
512 LIB_ID libID( libName, wxEmptyString );
513 editor->SyncLibraryTree(
true );
514 editor->FocusOnLibID( libID );
520 viewer->ReCreateLibraryList();
546 wxString msg = wxString::Format(
_(
"Library '%s' is read only." ), nickname );
552 wxString msg = wxString::Format(
_(
"Delete footprint '%s' from library '%s'?" ),
554 nickname.GetData() );
556 if( aConfirm && !
IsOK(
this, msg ) )
569 msg.Printf(
_(
"Footprint '%s' deleted from library '%s'" ),
571 nickname.GetData() );
573 SetStatusText( msg );
582 if(
GetBoard()->GetFirstFootprint() ==
nullptr )
588 wxString footprintName;
590 auto resetReference =
593 aFootprint->SetReference(
"REF**" );
600 parentGroup->RemoveItem( aFootprint );
606 for(
ZONE* zone : aFootprint->Zones() )
607 zone->Move( -aFootprint->GetPosition() );
610 if( !aStoreInNewLib )
620 bool map =
IsOK(
this, wxString::Format(
_(
"Update footprints on board to refer to %s?" ),
631 if( !footprint->GetFPID().GetLibItemName().empty() )
636 resetReference( fpCopy );
637 resetGroup( fpCopy );
638 resetZones( fpCopy );
652 LIB_ID id = footprint->GetFPID();
654 footprint->SetFPID(
id );
664 if( libPath.IsEmpty() )
670 wxString libNickname;
671 bool map =
IsOK(
this,
_(
"Update footprints on board to refer to new library?" ) );
688 if( !footprint->GetFPID().GetLibItemName().empty() )
693 resetReference( fpCopy );
694 resetGroup( fpCopy );
695 resetZones( fpCopy );
697 pi->FootprintSave( libPath, fpCopy );
709 LIB_ID id = footprint->GetFPID();
711 footprint->SetFPID(
id );
744 else if( libraryName.IsEmpty() || footprintName.IsEmpty() )
762 wxString libfullname;
817 wxString newName = footprintName;
821 newName.Printf(
"%s_%d", footprintName, i++ );
825 if( aFootprint->
GetValue() == footprintName )
833 const wxString& aLibraryName )
843 if( aFootprint ==
GetBoard()->GetFirstFootprint() )
864 if( pcbframe ==
nullptr )
878 sourceFootprint =
nullptr;
882 if( editorFootprint->
GetLink() == candidate->m_Uuid )
884 sourceFootprint = candidate;
890 if( !aAddNew && sourceFootprint ==
nullptr )
892 DisplayError(
this,
_(
"Unable to find the footprint on the main board.\nCannot save." ) );
900 DisplayError(
this,
_(
"Previous footprint placement still in progress." ) );
922 fixUuid(
const_cast<KIID&
>( newFootprint->
m_Uuid ) );
927 fixUuid(
const_cast<KIID&
>( aChild->
m_Uuid ) );
935 if( sourceFootprint )
941 commit.
Push(
_(
"Update Footprint" ) );
948 commit.
Add( newFootprint );
954 commit.
Push(
_(
"Insert Footprint" ) );
973 const wxString& aLibraryPreselect,
974 std::function<
bool( wxString libName, wxString fpName )> aValidator ) :
982 wxArrayString headers;
983 std::vector<wxArrayString> itemsToDisplay;
985 headers.Add(
_(
"Nickname" ) );
986 headers.Add(
_(
"Description" ) );
988 for(
const wxString& nickname : nicknames )
997 itemsToDisplay.push_back( item );
1001 for(
const wxString& nickname : nicknames )
1008 item.Add( nickname );
1010 itemsToDisplay.push_back( item );
1013 initDialog( headers, itemsToDisplay, aLibraryPreselect );
1018 wxBoxSizer* bNameSizer =
new wxBoxSizer( wxHORIZONTAL );
1020 wxStaticText* label =
new wxStaticText(
this, wxID_ANY,
_(
"Name:" ) );
1021 bNameSizer->Add( label, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
1023 m_fpNameCtrl =
new wxTextCtrl(
this, wxID_ANY, aFootprintName );
1024 bNameSizer->Add(
m_fpNameCtrl, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1026 wxTextValidator nameValidator( wxFILTER_EXCLUDE_CHAR_LIST );
1032 m_ButtonsSizer->Prepend( newLibraryButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 10 );
1034 GetSizer()->Prepend( bNameSizer, 0, wxEXPAND|wxTOP|wxLEFT|wxRIGHT, 5 );
1037 [
this]( wxCommandEvent& )
1051 GetSizer()->Fit(
this );
1059 footprintName.Trim(
true );
1060 footprintName.Trim(
false );
1061 return footprintName;
1078 if( aFootprint ==
nullptr )
1087 bool updateValue = aFootprint->
GetValue() == footprintName;
1089 bool footprintExists =
false;
1094 [&](
const wxString& newLib,
const wxString& newName )
1096 if( newLib.IsEmpty() )
1098 wxMessageBox( _(
"A library must be specified." ) );
1102 if( newName.IsEmpty() )
1104 wxMessageBox( _(
"Footprint must have a name." ) );
1122 if( footprintExists )
1124 wxString msg = wxString::Format(
_(
"Footprint %s already exists in %s." ),
1128 KIDIALOG errorDlg(
this, msg,
_(
"Confirmation" ),
1129 wxOK | wxCANCEL | wxICON_WARNING );
1130 errorDlg.SetOKLabel(
_(
"Overwrite" ) );
1138 int ret = dlg.ShowModal();
1140 if( ret == wxID_CANCEL )
1144 else if( ret == wxID_OK )
1147 libraryName = dlg.GetTextSelection();
1153 libraryName = newLibrary.GetName();
1157 aFootprint->
SetFPID(
LIB_ID( libraryName, footprintName ) );
1160 aFootprint->
SetValue( footprintName );
1168 wxString fmt = footprintExists ?
_(
"Footprint '%s' replaced in '%s'" )
1169 :
_(
"Footprint '%s' added to '%s'" );
1171 wxString msg = wxString::Format( fmt, footprintName.GetData(), libraryName.GetData() );
1172 SetStatusText( msg );
1184 wxString msg = wxString::Format(
_(
"Revert '%s' to last version saved?" ),
1214 std::function<
bool( wxString newName )> aValidator ) :
1216 aName,
_(
"Footprint type:" ),
1217 {
_(
"Through hole" ),
_(
"SMD" ),
_(
"Other" ) },
1225 name.Trim(
true ).Trim(
false );
1241 const wxString& aLibName,
bool aQuiet )
1244 wxString footprintName = aFootprintName;
1248 static int footprintType = 1;
1249 int footprintTranslated =
FP_SMD;
1252 if( footprintName.IsEmpty() && !aQuiet )
1255 [&]( wxString newName )
1257 if( newName.IsEmpty() )
1259 wxMessageBox( _(
"Footprint must have a name." ) );
1263 if( !aLibName.IsEmpty() && tbl->
FootprintExists( aLibName, newName ) )
1265 msg = wxString::Format( _(
"Footprint '%s' already exists in library '%s'." ),
1266 newName, aLibName );
1268 KIDIALOG errorDlg( this, msg, _(
"Confirmation" ),
1269 wxOK | wxCANCEL | wxICON_WARNING );
1270 errorDlg.SetOKLabel( _(
"Overwrite" ) );
1272 return errorDlg.ShowModal() == wxID_OK;
1280 if( dlg.ShowModal() != wxID_OK )
1283 footprintName = dlg.GetFPName();
1284 footprintType = dlg.GetChoice();
1286 switch( footprintType )
1289 case 1: footprintTranslated =
FP_SMD;
break;
1290 default: footprintTranslated = 0;
break;
1298 footprint->
SetFPID(
LIB_ID( wxEmptyString, footprintName ) );
1338 if( footprint->
GetValue().IsEmpty() )
1339 footprint->
SetValue( footprintName );
1363 wxArrayString headers;
1365 headers.Add(
_(
"Nickname" ) );
1366 headers.Add(
_(
"Description" ) );
1371 std::vector< wxArrayString > itemsToDisplay;
1374 for(
const wxString& nickname : nicknames )
1383 itemsToDisplay.push_back( item );
1387 for(
const wxString& nickname : nicknames )
1394 item.Add( nickname );
1396 itemsToDisplay.push_back( item );
1400 EDA_LIST_DIALOG dlg(
this,
_(
"Select Library" ), headers, itemsToDisplay, aNicknameExisting,
1403 if( dlg.ShowModal() != wxID_OK )
1404 return wxEmptyString;
void SetContentModified(bool aModified=true)
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
Container for design settings for a BOARD object.
std::vector< TEXT_ITEM_INFO > m_DefaultFPTextItems
bool GetTextUpright(PCB_LAYER_ID aLayer) const
int GetTextThickness(PCB_LAYER_ID aLayer) const
Return the default text thickness from the layer class for the given layer.
bool GetTextItalic(PCB_LAYER_ID aLayer) const
VECTOR2I GetTextSize(PCB_LAYER_ID aLayer) const
Return the default text size from the layer class for the given layer.
Handle actions specific to the board editor in PcbNew.
bool PlacingFootprint() const
Re-entrancy checker for above.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
PCB_GROUP * GetParentGroup() const
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Information pertinent to a Pcbnew printed circuit board.
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
const FOOTPRINTS & Footprints() const
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Notify observers that aItem has been added.
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
void SetupStandardButtons(std::map< int, wxString > aLabels={})
virtual void ClearUndoRedoList()
Clear the undo and redo list using ClearUndoORRedoList()
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false, WX_INFOBAR::MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left o...
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
bool LibraryFileBrowser(bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory=false, bool aIsGlobal=false, const wxString &aGlobalPath=wxEmptyString)
virtual void Zoom_Automatique(bool aWarpPointer)
Redraw the screen with best zoom level and the best centering that shows all the page or the board.
KIGFX::VIEW_CONTROLS * GetViewControls() const
Return a pointer to the #VIEW_CONTROLS instance used in the panel.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
KICAD_T Type() const
Returns the type of object.
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
virtual void SetParent(EDA_ITEM *aParent)
wxBoxSizer * m_ButtonsSizer
void SetOKLabel(const wxString &aLabel)
void initDialog(const wxArrayString &aItemHeaders, const std::vector< wxArrayString > &aItemList, const wxString &aPreselectText)
wxString GetTextSelection(int aColumn=0)
Return the selected text from aColumn in the wxListCtrl in the dialog.
void SetListLabel(const wxString &aLabel)
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true)
virtual void SetVisible(bool aVisible)
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
void SetKeepUpright(bool aKeepUpright)
virtual void SetText(const wxString &aText)
void SetItalic(bool aItalic)
Hold a record identifying a library accessed by the appropriate footprint library #PLUGIN object in t...
const FP_LIB_TABLE_ROW * FindRow(const wxString &aNickName, bool aCheckIfEnabled=false)
Return an FP_LIB_TABLE_ROW if aNickName is found in this table or in any chained fall back table frag...
void FootprintDelete(const wxString &aNickname, const wxString &aFootprintName)
Delete the aFootprintName from the library given by aNickname.
bool FootprintExists(const wxString &aNickname, const wxString &aFootprintName)
Indicates whether or not the given footprint already exists in the given library.
SAVE_T FootprintSave(const wxString &aNickname, const FOOTPRINT *aFootprint, bool aOverwrite=true)
Write aFootprint to an existing library given by aNickname.
static wxString GetGlobalTableFileName()
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()
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
void DoNotShowCheckbox(wxString file, int line)
Checks the 'do not show again' setting for the dialog.
An interface for classes handling user events controlling the view behavior such as zooming,...
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Move the graphic crosshair cursor to the requested position expressed in world coordinates.
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
virtual PROJECT & Prj() const
Return the PROJECT associated with this KIWAY.
A logical library item identifier and consists of various portions much like a URI.
bool IsValid() const
Check if this LID_ID is valid.
int SetLibNickname(const UTF8 &aLibNickname)
Override the logical library name portion of the LIB_ID to aLibNickname.
const UTF8 & GetLibItemName() const
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Hold a record identifying a library accessed by the appropriate plug in object in the LIB_TABLE.
const wxString & GetNickName() const
const wxString GetFullURI(bool aSubstituted=false) const
Return the full location specifying URI for the LIB, either in original UI form or in environment var...
const wxString GetDescription(const wxString &aNickname)
std::vector< wxString > GetLogicalLibs()
Return the logical library names, all of them that are pertinent to a look up done on this LIB_TABLE.
bool InsertRow(LIB_TABLE_ROW *aRow, bool doReplace=false)
Adds aRow if it does not already exist or if doReplace is true.
wxString GetFullURI(const wxString &aLibNickname, bool aExpandEnvVars=true) const
Return the full URI of the library mapped to aLibNickname.
const LIB_TABLE_ROW * FindRowByURI(const wxString &aURI)
void Save(const wxString &aFileName) const
Write this library table to aFileName in s-expression form.
static const wxString GetPinningSymbol()
NEW_FP_DIALOG(PCB_BASE_FRAME *aParent, const wxString &aName, int aFootprintType, std::function< bool(wxString newName)> aValidator)
std::function< bool(wxString newName)> m_validator
bool TransferDataFromWindow() override
static wxString GetDefaultUserFootprintsPath()
Gets the default path we point users to create projects.
static TOOL_ACTION recombinePad
static TOOL_ACTION selectionClear
Clear the current selection.
static TOOL_ACTION placeFootprint
bool AddLibrary(const wxString &aLibName=wxEmptyString, FP_LIB_TABLE *aTable=nullptr)
Add an existing library to either the global or project library table.
wxString CreateNewLibrary(const wxString &aLibName=wxEmptyString, const wxString &aProposedName=wxEmptyString)
If a library name is given, creates a new footprint library in the project folder with the given name...
wxString createNewLibrary(const wxString &aLibName, const wxString &aProposedName, FP_LIB_TABLE *aTable)
Create a new library in the given table (presumed to be either the global or project library table).
wxString CreateNewProjectLibrary(const wxString &aLibName=wxEmptyString, const wxString &aProposedName=wxEmptyString)
FP_LIB_TABLE * selectLibTable(bool aOptional=false)
Prompts a user to select global or project library tables.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
void setFPWatcher(FOOTPRINT *aFootprint)
Creates (or removes) a watcher on the specified footprint.
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
wxString SelectLibrary(const wxString &aNicknameExisting)
Put up a dialog and allows the user to pick a library, for unspecified use.
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
void PlaceFootprint(FOOTPRINT *aFootprint, bool aRecreateRatsnest=true)
Places aFootprint at the current cursor position and updates footprint coordinates with the new posit...
FOOTPRINT * CreateNewFootprint(const wxString &aFootprintName, const wxString &aLibName, bool aQuiet)
Creates a new footprint, at position 0,0.
virtual void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
The main frame for Pcbnew.
void ExportFootprintsToLibrary(bool aStoreInNewLib, const wxString &aLibName=wxEmptyString, wxString *aLibPath=nullptr)
Save footprints in a library:
void ExchangeFootprint(FOOTPRINT *aExisting, FOOTPRINT *aNew, BOARD_COMMIT &aCommit, bool deleteExtraTexts=true, bool resetTextLayers=true, bool resetTextEffects=true, bool resetFabricationAttrs=true, bool reset3DModels=true, bool *aUpdated=nullptr)
Replace aExisting footprint by aNew footprint using the Existing footprint settings (position,...
A set of BOARD_ITEMs (i.e., without duplicates).
A #PLUGIN derivation for saving and loading Pcbnew s-expression formatted files.
void Format(const BOARD_ITEM *aItem, int aNestLevel=0) const
Output aItem to aFormatter in s-expression format.
std::string GetStringOutput(bool doClear)
static PLUGIN_REGISTRY * Instance()
static PCB_IO * PluginFind(PCB_FILE_T aFileType)
Return a #PLUGIN which the caller can use to import, export, save, or load design documents.
PCB_FILE_T
The set of file types that the PCB_IO_MGR knows about, and for which there has been a plugin written,...
@ KICAD_SEXP
S-expression Pcbnew file format.
@ LEGACY
Legacy Pcbnew file formats prior to s-expression.
static PCB_FILE_T GuessPluginTypeFromLibPath(const wxString &aLibPath, int aCtl=0)
Return a plugin type given a footprint library's libPath.
static const wxString ShowType(PCB_FILE_T aFileType)
Return a brief name for a plugin given aFileType enum.
virtual void SetPosition(const VECTOR2I &aPos) override
virtual COMMON_SETTINGS * GetCommonSettings() const
The backing store for a PROJECT, in JSON format.
static FP_LIB_TABLE * PcbFootprintLibs(PROJECT *aProject)
Return the table of footprint libraries without Kiway.
Container for project specific data.
virtual const wxString GetProjectPath() const
Return the full path of the project.
virtual PROJECT_FILE & GetProjectFile() const
virtual void SetRString(RSTRING_T aStringId, const wxString &aString)
Store a "retained string", which is any session and project specific string identified in enum RSTRIN...
virtual const wxString & GetRString(RSTRING_T aStringId)
Return a "retained string", which is any session and project specific string identified in enum RSTRI...
bool TransferDataFromWindow() override
SAVE_AS_DIALOG(FOOTPRINT_EDIT_FRAME *aParent, const wxString &aFootprintName, const wxString &aLibraryPreselect, std::function< bool(wxString libName, wxString fpName)> aValidator)
std::function< bool(wxString libName, wxString symbolName)> m_validator
wxTextCtrl * m_fpNameCtrl
std::function< bool(wxString libName, wxString fpName)> m_validator
A KICAD version of wxTextEntryDialog which supports the various improvements/work-arounds from DIALOG...
void SetTextValidator(wxTextValidatorStyle style)
Handle a list of polygons defining a copper zone.
wxString EnsureFileExtension(const wxString &aFilename, const wxString &aExtension)
It's annoying to throw up nag dialogs when the extension isn't right.
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
bool ConfirmRevertDialog(wxWindow *parent, const wxString &aMessage)
Display a confirmation dialog for a revert action.
This file is part of the common library.
FP_LIB_TABLE GFootprintTable
The global footprint library table.
wxString NormalizePath(const wxFileName &aFilePath, const ENV_VAR_MAP *aEnvVars, const wxString &aProjectPath)
Normalize a file path to an environmental variable, if possible.
static const std::string KiCadFootprintLibPathExtension
static const std::string KiCadFootprintFileExtension
static wxString KiCadFootprintLibFileWildcard()
static wxString KiCadFootprintLibPathWildcard()
std::unique_ptr< T > IO_RELEASER
Helper to hold and release an IO_BASE object when exceptions are thrown.
This file is part of the common library.
PCB_LAYER_ID
A quick note on layer IDs:
This file contains miscellaneous commonly used macros and functions.
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Class to handle a set of BOARD_ITEMs.
#define CTL_FOR_LIBRARY
Format output for a footprint library instead of clipboard or BOARD.
PGM_BASE & Pgm()
The global Program "get" accessor.
KIWAY Kiway(KFCTL_STANDALONE)
MODEL3D_FORMAT_TYPE fileType(const char *aFileName)
std::vector< wxString > pinned_fp_libs
Container that describes file type info.
std::vector< std::string > m_FileExtensions
Filter used for file pickers if m_IsFile is true.
wxString FileFilter() const
static int ID_MAKE_NEW_LIBRARY
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
Custom text control validator definitions.
VECTOR2< double > VECTOR2D
wxString formatWildcardExt(const wxString &aWildcard)
Format wildcard extension to support case sensitive file dialogs.
Definition of file extensions used in Kicad.