58#include <wx/filedlg.h>
59#include <wx/fswatcher.h>
69 _(
"Writing/modifying legacy libraries (.mod files) is not allowed\n"\
70 "Please save the current library to the new .pretty format\n"\
71 "and update your footprint lib table\n"\
72 "to save your footprint (a .kicad_mod file) in the .pretty library folder" ) );
75 _(
"Modifying legacy libraries (.mod files) is not allowed\n"\
76 "Please save the current library under the new .pretty format\n"\
77 "and update your footprint lib table\n"\
78 "before deleting a footprint" ) );
92 static int lastFilterIndex = 0;
93 wxString fileFiltersStr;
94 std::vector<std::string> allExtensions;
95 std::set<wxString> allWildcardsSet;
109 if( !fileFiltersStr.IsEmpty() )
110 fileFiltersStr += wxChar(
'|' );
116 allExtensions.emplace_back( ext );
121 wxString allWildcardsStr;
123 for(
const wxString& wildcard : allWildcardsSet )
124 allWildcardsStr << wildcard;
126 fileFiltersStr =
_(
"All supported formats" ) + wxT(
"|" ) + allWildcardsStr + wxT(
"|" )
129 wxFileDialog dlg(
this,
_(
"Import Footprint" ),
m_mruPath, wxEmptyString, fileFiltersStr,
130 wxFD_OPEN | wxFD_FILE_MUST_EXIST );
132 wxArrayString dummy1, dummy2;
133 const int nWildcards = wxParseCommonDialogsFilter( fileFiltersStr, dummy1, dummy2 );
135 if( lastFilterIndex >= 0 && lastFilterIndex < nWildcards )
136 dlg.SetFilterIndex( lastFilterIndex );
140 if( dlg.ShowModal() == wxID_CANCEL )
143 lastFilterIndex = dlg.GetFilterIndex();
151 if( !wxFileExists( fn.GetFullPath() ) )
153 wxString msg = wxString::Format(
_(
"File '%s' not found." ), fn.GetFullPath() );
169 if( pi->GetLibraryFileDesc().m_FileExtensions.empty() )
172 if( pi->CanReadFootprint( fn.GetFullPath() ) )
185 std::unique_ptr<FOOTPRINT> footprint;
186 wxString footprintName;
196 footprint = pi->ImportFootprint( fn.GetFullPath(), footprintName );
200 wxString msg = wxString::Format(
_(
"Unable to load footprint '%s' from '%s'" ),
201 footprintName, fn.GetFullPath() );
219 footprint->SetFPID(
LIB_ID( wxEmptyString, footprintName ) );
225 footprint->SetParent(
nullptr );
270 wxFileDialog dlg(
this,
_(
"Export Footprint" ), fn.GetPath(), fn.GetFullName(),
271 wildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
275 if( dlg.ShowModal() == wxID_CANCEL )
299 FILE* fp = wxFopen( fn.GetFullPath(), wxT(
"wt" ) );
303 DisplayErrorMessage(
this, wxString::Format(
_(
"Insufficient permissions to write file '%s'." ),
304 fn.GetFullPath() ) );
311 if( fprintf( fp,
"%s", prettyData.c_str() ) < 0 || fclose( fp ) != 0 )
313 DisplayErrorMessage(
this, wxString::Format(
_(
"Error writing file '%s'." ), fn.GetFullPath() ) );
323 wxString msg = wxString::Format(
_(
"Footprint exported to file '%s'." ), fn.GetFullPath() );
341 const wxString& aInitialPath, std::optional<LIBRARY_TABLE_SCOPE> aScope )
349 bool isGlobal =
false;
354 fileDlgHook =
nullptr;
356 if( aLibName.IsEmpty() )
363 return wxEmptyString;
378 if( !fn.IsAbsolute() )
380 fn.SetName( aLibName );
381 fn.MakeAbsolute(
Prj().GetProjectPath() );
387 wxString libPath = fn.GetFullPath();
393 bool writable =
false;
398 writable = pi->IsLibraryWritable( libPath );
410 wxString msg = wxString::Format(
_(
"Library %s is read only." ), libPath );
412 return wxEmptyString;
416 wxString msg = wxString::Format(
_(
"Library %s already exists." ), libPath );
417 KIDIALOG dlg(
this, msg,
_(
"Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
418 dlg.SetOKLabel(
_(
"Overwrite" ) );
422 return wxEmptyString;
424 pi->DeleteLibrary( libPath );
428 pi->CreateLibrary( libPath );
433 return wxEmptyString;
436 if( doAdd && !
AddLibrary( aDialogTitle, libPath, aScope ) )
437 return wxEmptyString;
444 const std::vector<std::pair<wxString, bool*>>& aExtraCheckboxes )
449 wxArrayString headers;
450 std::vector<wxArrayString> itemsToDisplay;
456 EDA_LIST_DIALOG dlg(
this, aDialogTitle, headers, itemsToDisplay, libraryName,
false );
459 for(
const auto& [label, val] : aExtraCheckboxes )
464 dlg.
m_ButtonsSizer->Prepend( newLibraryButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 10 );
466 newLibraryButton->Bind( wxEVT_BUTTON,
467 [&dlg]( wxCommandEvent& )
473 dlg.GetSizer()->Fit( &dlg );
480 return wxEmptyString;
493 if( !fn.GetFullPath().IsEmpty() )
509 std::optional<LIBRARY_TABLE_SCOPE> aScope )
513 bool isGlobal =
false;
520 fileDlgHook =
nullptr;
523 wxFileName fn( aFilename );
525 if( aFilename.IsEmpty() )
539 wxString libPath = fn.GetFullPath();
540 wxString libName = fn.GetName();
542 if( libName.IsEmpty() )
555 libName = fn.GetFullName();
576 table->Save().map_error(
579 wxMessageBox(
_(
"Error saving library table:\n\n" ) + aError.
message,
580 _(
"File Save Error" ), wxOK | wxICON_ERROR );
592 manager.
ReloadTables( aScope.value(), { LIBRARY_TABLE_TYPE::FOOTPRINT } );
598 LIB_ID libID( libName, wxEmptyString );
599 editor->SyncLibraryTree(
true );
600 editor->FocusOnLibID( libID );
606 viewer->ReCreateLibraryList();
623 wxString libfullname;
628 libfullname = *optUri;
640 wxString msg = wxString::Format(
_(
"Library '%s' is read only." ), nickname );
646 wxString msg = wxString::Format(
_(
"Delete footprint '%s' from library '%s'?" ),
648 nickname.GetData() );
650 if( aConfirm && !
IsOK(
this, msg ) )
663 msg.Printf(
_(
"Footprint '%s' deleted from library '%s'" ),
665 nickname.GetData() );
667 SetStatusText( msg );
675 if(
GetBoard()->GetFirstFootprint() ==
nullptr )
689 if( fn.GetFullPath().IsEmpty() )
693 nickname = fn.GetName();
694 map =
IsOK(
this,
_(
"Update footprints on board to refer to new library?" ) );
698 nickname =
SelectLibrary(
_(
"Export Footprints" ),
_(
"Export footprints to library:" ),
699 { {
_(
"Update board footprints to link to exported footprints" ), &map } } );
715 if( !footprint->GetFPID().GetLibItemName().empty() )
717 std::unique_ptr<FOOTPRINT> fpCopy(
722 fpCopy->SetReference(
"REF**" );
723 fpCopy->SetParentGroup(
nullptr );
725 for(
ZONE* zone : fpCopy->Zones() )
726 zone->Move( -fpCopy->GetPosition() );
740 LIB_ID id = footprint->GetFPID();
742 footprint->SetFPID(
id );
769 else if( libraryName.IsEmpty() || footprintName.IsEmpty() )
787 wxString libfullname;
790 libfullname = *optUri;
843 wxString newName = footprintName;
847 newName.Printf(
"%s_%d", footprintName, i++ );
851 if( aFootprint->
GetValue() == footprintName )
859 const wxString& aLibraryName )
879 DisplayError(
this, wxString::Format(
_(
"Footprint '%s' could not be saved to library '%s'." ),
887 if( aFootprint ==
GetBoard()->GetFirstFootprint() )
908 if( pcbframe ==
nullptr )
918 if( !editorFootprint )
925 sourceFootprint =
nullptr;
929 if( editorFootprint->
GetLink() == candidate->m_Uuid )
931 sourceFootprint = candidate;
937 if( !aAddNew && sourceFootprint ==
nullptr )
939 DisplayError(
this,
_(
"Unable to find the footprint on the main board.\nCannot save." ) );
947 DisplayError(
this,
_(
"Previous footprint placement still in progress." ) );
999 if( it != netmap.end() )
1000 conn->SetNet( it->second );
1012 if( sourceFootprint )
1020 commit.
Push(
_(
"Update Footprint" ) );
1027 commit.
Add( newFootprint );
1033 commit.
Push(
_(
"Insert Footprint" ) );
1049 const wxString& aLibraryPreselect,
1050 std::function<
bool( wxString libName, wxString fpName )> aValidator ) :
1056 wxArrayString headers;
1057 std::vector<wxArrayString> itemsToDisplay;
1060 initDialog( headers, itemsToDisplay, aLibraryPreselect );
1065 wxBoxSizer* bNameSizer =
new wxBoxSizer( wxHORIZONTAL );
1067 wxStaticText* label =
new wxStaticText(
this, wxID_ANY,
_(
"Name:" ) );
1068 bNameSizer->Add( label, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
1070 m_fpNameCtrl =
new wxTextCtrl(
this, wxID_ANY, aFootprintName );
1071 bNameSizer->Add(
m_fpNameCtrl, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1073 wxTextValidator nameValidator( wxFILTER_EXCLUDE_CHAR_LIST );
1079 m_ButtonsSizer->Prepend( newLibraryButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 10 );
1081 GetSizer()->Prepend( bNameSizer, 0, wxEXPAND|wxTOP|wxLEFT|wxRIGHT, 5 );
1084 if( !aFootprintName.IsEmpty() )
1088 [
this]( wxCommandEvent& )
1102 GetSizer()->Fit(
this );
1110 footprintName.Trim(
true );
1111 footprintName.Trim(
false );
1112 return footprintName;
1118 wxCommandEvent
dummy;
1137 if( aFootprint ==
nullptr )
1148 bool updateValue = aFootprint->
GetValue() == footprintName;
1150 bool footprintExists =
false;
1155 [&](
const wxString& newLib,
const wxString& newName )
1157 if( newLib.IsEmpty() )
1159 wxMessageBox(
_(
"A library must be specified." ) );
1163 if( newName.IsEmpty() )
1165 wxMessageBox(
_(
"Footprint must have a name." ) );
1186 if( footprintExists )
1188 wxString msg = wxString::Format(
_(
"Footprint %s already exists in %s." ),
1192 KIDIALOG errorDlg(
this, msg,
_(
"Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING );
1193 errorDlg.SetOKLabel(
_(
"Overwrite" ) );
1203 if( ret == wxID_CANCEL )
1207 else if( ret == wxID_OK )
1209 footprintName = dlg.GetFPName();
1210 libraryName = dlg.GetTextSelection();
1218 if( fn.GetFullPath().IsEmpty() )
1223 libraryName = fn.GetName();
1227 aFootprint->
SetFPID(
LIB_ID( libraryName, footprintName ) );
1230 aFootprint->
SetValue( footprintName );
1240 wxString fmt = footprintExists ?
_(
"Footprint '%s' replaced in '%s'" )
1241 :
_(
"Footprint '%s' added to '%s'" );
1243 wxString msg = wxString::Format( fmt, footprintName.GetData(), libraryName.GetData() );
1244 SetStatusText( msg );
1261 msg.Printf(
_(
"Revert '%s' to last version saved?" ),
GetLoadedFPID().GetLibItemName().wx_str() );
1299 if( aFootprintName.IsEmpty() )
1300 aFootprintName =
_(
"Untitled" );
1302 int footprintAttrs =
FP_SMD;
1304 if( !aLibName.IsEmpty() )
1307 std::vector<wxString> fpnames;
1308 wxString baseName = aFootprintName;
1313 aFootprintName = baseName + wxString::Format( wxS(
"_%d" ), idx++ );
1320 if( !fpnames.empty() )
1322 std::unique_ptr<FOOTPRINT> fp( adapter->
LoadFootprint( aLibName, fpnames.back(),
false ) );
1325 footprintAttrs = fp->GetAttributes();
1338 footprint->
SetFPID(
LIB_ID( wxEmptyString, aFootprintName ) );
1385 if( footprint->
GetValue().IsEmpty() )
1386 footprint->
SetValue( aFootprintName );
1410 std::vector<wxArrayString>& aItemsToDisplay )
1412 aHeaders.
Add(
_(
"Library" ) );
1413 aHeaders.Add(
_(
"Description" ) );
1419 std::vector<wxArrayString> unpinned;
1421 for(
const wxString& nickname : nicknames )
1430 item.Add( description );
1431 aItemsToDisplay.push_back( item );
1435 item.Add( nickname );
1436 item.Add( description );
1437 unpinned.push_back( item );
1441 std::sort( aItemsToDisplay.begin(), aItemsToDisplay.end(),
1442 [](
const wxArrayString& a,
const wxArrayString& b )
1444 return StrNumCmp( a[0], b[0], CMP_T::IGNORE_CASE ) < 0;
1447 std::sort( unpinned.begin(), unpinned.end(),
1448 [](
const wxArrayString& a,
const wxArrayString& b )
1450 return StrNumCmp( a[0], b[0], CMP_T::IGNORE_CASE ) < 0;
1453 std::ranges::copy( unpinned, std::back_inserter( aItemsToDisplay ) );
static TOOL_ACTION selectionClear
Clear the current selection.
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,...
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...
void SetUuid(const KIID &aUuid)
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Information pertinent to a Pcbnew printed circuit board.
const NETINFO_LIST & GetNetInfo() const
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
void ExchangeFootprint(FOOTPRINT *aExisting, FOOTPRINT *aNew, BOARD_COMMIT &aCommit, FLIP_DIRECTION aFlipDirection, bool aMatchPadPositions, bool aDeleteExtraTexts=true, bool aResetTextLayers=true, bool aResetTextEffects=true, bool aResetTextPositions=true, bool aResetTextContent=true, bool aResetFabricationAttrs=true, bool aResetClearanceOverrides=true, bool aReset3DModels=true, bool aResetTransform=false, bool *aUpdated=nullptr, bool *aShifted=nullptr)
Replace aExisting with aNew, preserving connectivity and metadata.
const FOOTPRINTS & Footprints() const
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Add a new item to the model.
void OptOut(wxWindow *aWindow)
Opt out of control state saving.
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={})
UNDO_REDO_CONTAINER m_undoList
virtual void ClearUndoRedoList()
Clear the undo and redo list using ClearUndoORRedoList()
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false, INFOBAR_MESSAGE_TYPE aType=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...
UNDO_REDO_CONTAINER m_redoList
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
virtual void ReCreateHToolbar()
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.
bool LibraryFileBrowser(const wxString &aTitle, bool doOpen, wxFileName &aFilename, const wxString &wildcard, const wxString &ext, bool isDirectory, FILEDLG_HOOK_NEW_LIBRARY *aFileDlgHook=nullptr)
KIGFX::VIEW_CONTROLS * GetViewControls() const
Return a pointer to the KIGFX::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 textChangeInFilterBox(wxCommandEvent &event) override
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 AddExtraCheckbox(const wxString &aLabel, bool *aValuePtr)
Add a checkbox value to the dialog.
void GetExtraCheckboxValues()
Fills in the value pointers from the checkboxes after the dialog has run.
EDA_LIST_DIALOG(wxWindow *aParent, const wxString &aTitle, const wxArrayString &aItemHeaders, const std::vector< wxArrayString > &aItemList, const wxString &aPreselectText=wxEmptyString, bool aSortList=true)
virtual void SetVisible(bool aVisible)
void SetKeepUpright(bool aKeepUpright)
virtual void SetText(const wxString &aText)
void SetItalic(bool aItalic)
Set the text to be italic - this will also update the font if needed.
bool GetUseGlobalTable() const
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)
Shows the 'do not show again' checkbox.
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.
std::optional< wxString > GetLibraryDescription(const wxString &aNickname) const
std::vector< wxString > GetLibraryNames() const
Returns a list of library nicknames that are available (skips any that failed to load)
void ReloadTables(LIBRARY_TABLE_SCOPE aScope, std::initializer_list< LIBRARY_TABLE_TYPE > aTablesToLoad={})
std::optional< LIBRARY_TABLE * > Table(LIBRARY_TABLE_TYPE aType, LIBRARY_TABLE_SCOPE aScope)
Retrieves a given table; creating a new empty project table if a valid project is loaded and the give...
std::optional< wxString > GetFullURI(LIBRARY_TABLE_TYPE aType, const wxString &aNickname, bool aSubstituted=false)
Return the full location specifying URI for the LIB, either in original UI form or in environment var...
void SetNickname(const wxString &aNickname)
void SetType(const wxString &aType)
void SetURI(const wxString &aUri)
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 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.
static const wxString GetPinningSymbol()
Handle the data for a net.
const wxString & GetNetname() const
const NETNAMES_MAP & NetsByName() const
Return the name map, at least for python.
FLIP_DIRECTION m_FlipDirection
static TOOL_ACTION placeFootprint
wxString CreateNewLibrary(const wxString &aDialogTitle, const wxString &aInitialPath=wxEmptyString)
If a library name is given, creates a new footprint library in the project folder with the given name...
wxString SelectLibrary(const wxString &aDialogTitle, const wxString &aListLabel, const std::vector< std::pair< wxString, bool * > > &aExtraCheckboxes={})
Put up a dialog and allows the user to pick a library, for unspecified use.
wxString createNewLibrary(const wxString &aDialogTitle, const wxString &aLibName, const wxString &aInitialPath, std::optional< LIBRARY_TABLE_SCOPE > aScope=std::nullopt)
Create a new library in the given table.
wxString CreateNewProjectLibrary(const wxString &aDialogTitle, const wxString &aLibName)
bool AddLibrary(const wxString &aDialogTitle, const wxString &aLibName=wxEmptyString, std::optional< LIBRARY_TABLE_SCOPE > aScope=std::nullopt)
Add an existing library to either the global or project library table.
void setFPWatcher(FOOTPRINT *aFootprint)
Create or removes a watcher on the specified footprint.
FOOTPRINT * CreateNewFootprint(wxString aFootprintName, const wxString &aLibName)
Create a new footprint at position 0,0.
PCBNEW_SETTINGS * GetPcbNewSettings() const
void GetLibraryItemsForListDialog(wxArrayString &aHeaders, std::vector< wxArrayString > &aItemsToDisplay)
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Return the BOARD_DESIGN_SETTINGS for the open project.
void PlaceFootprint(FOOTPRINT *aFootprint, bool aRecreateRatsnest=true, std::optional< VECTOR2I > aPosition=std::nullopt)
Place aFootprint at the current cursor position (or provided one) and updates footprint coordinates w...
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)
Save footprints in a library:
A PCB_IO derivation for saving and loading Pcbnew s-expression formatted files.
void FormatFootprintLibFile(FOOTPRINT *aFootprint) const
Output aFootprint as a complete footprint library file.
std::string GetStringOutput(bool doClear)
static PLUGIN_REGISTRY * Instance()
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_IO * FindPlugin(PCB_FILE_T aFileType)
Return a PCB_IO which the caller can use to import, export, save, or load design documents.
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.
void SetTextThickness(int aWidth) override
The TextThickness is that set by the user.
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true) override
void SetPosition(const VECTOR2I &aPos) override
virtual COMMON_SETTINGS * GetCommonSettings() const
virtual LIBRARY_MANAGER & GetLibraryManager() const
The backing store for a PROJECT, in JSON format.
static FOOTPRINT_LIBRARY_ADAPTER * FootprintLibAdapter(PROJECT *aProject)
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)
bool TransferDataToWindow() override
wxTextCtrl * m_fpNameCtrl
std::function< bool(wxString libName, wxString fpName)> m_validator
static REPORTER & GetInstance()
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 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.
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
This file is part of the common library.
#define IGNORE_PARENT_GROUP
wxString NormalizePath(const wxFileName &aFilePath, const ENV_VAR_MAP *aEnvVars, const wxString &aProjectPath)
Normalize a file path to an environmental variable, if possible.
Helper functions to substitute paths with environmental variables.
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.
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.
static std::string normalizedPath(std::string aPath)
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)
std::vector< FAB_LAYER_COLOR > dummy
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
@ 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< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D
wxString formatWildcardExt(const wxString &aWildcard)
Format wildcard extension to support case sensitive file dialogs.
Definition of file extensions used in Kicad.