25#include <wx/stdpaths.h>
46 m_textVarsTicker( 0 ),
47 m_netclassesTicker( 0 ),
48 m_projectFile( nullptr ),
49 m_localSettings( nullptr )
92 if( aVarsMap.size() == 0 )
95 std::map<wxString, wxString>& existingVarsMap =
GetTextVars();
97 for(
const auto& var : aVarsMap )
100 existingVarsMap[var.first] = var.second;
109 wxFileName candidate_path( aFullPathAndName );
113 if(
m_project_name.GetFullPath() != candidate_path.GetFullPath() )
178 pinnedLibs->push_back( aLibrary );
180 Pgm().GetSettingsManager().SaveProject();
186 pinnedLibs->push_back( aLibrary );
199 Pgm().GetSettingsManager().SaveProject();
212 wxString
path = fn.GetPath();
216 if( !fn.GetDirCount() || !fn.IsOk() || !wxFileName::IsDirWritable(
path ) )
228 fn.AssignDir( wxStandardPaths::Get().GetTempDir() );
231#if defined( __WINDOWS__ )
232 fn.AppendDir( wxT(
"kicad" ) );
241 fn.SetName( wxS(
"prj-" ) + aLibTableName );
245 fn.SetName( aLibTableName );
250 return fn.GetFullPath();
258 for(
const std::pair<KIID, wxString>& pair :
GetProjectFile().GetSheets() )
271 unsigned ndx = unsigned( aIndex );
282 unsigned ndx = unsigned( aIndex );
290 static wxString no_cookie_for_you;
294 return no_cookie_for_you;
322 wxFileName fn = aFileName;
326 if( aFileName.StartsWith( wxT(
"${" ) ) )
329 if( !fn.IsAbsolute() )
335 return fn.GetFullPath();
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
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()
virtual bool SaveToFile(const wxString &aDirectory="", bool aForce=false)
Calls Store() and then writes the contents of the JSON document to a file.
wxString AsString() const
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
virtual KIFACE * KiFACE(FACE_T aFaceId, bool doLoad=true)
Return the KIFACE* given a FACE_T.
void Load(const wxString &aFileName)
Load the library table using the path defined by aFileName aFallBackTable.
A PROJECT can hold stuff it knows nothing about, in the form of _ELEM derivatives.
std::map< wxString, wxString > m_TextVars
std::vector< wxString > m_PinnedFootprintLibs
The list of pinned footprint libraries.
std::vector< wxString > m_PinnedSymbolLibs
Below are project-level settings that have not been moved to a dedicated file.
PROJECT_FILE * m_projectFile
Backing store for project data – owned by SETTINGS_MANAGER.
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
void UnpinLibrary(const wxString &aLibrary, bool isSymbolLibrary)
RSTRING_T
Retain a number of project specific wxStrings, enumerated here:
std::map< KIID, wxString > m_sheetNames
virtual const wxString GetProjectPath() const
Return the full path of the project.
virtual const wxString GetProjectName() const
Return the short name of the project.
virtual const wxString SymbolLibTableName() const
Return the path and file name of this projects symbol library table.
virtual FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
virtual void ApplyTextVars(const std::map< wxString, wxString > &aVarsMap)
Applies the given var map, it will create or update existing vars.
virtual void ElemsClear()
Delete all the _ELEMs and set their pointers to NULL.
void PinLibrary(const wxString &aLibrary, bool isSymbolLibrary)
virtual bool TextVarResolver(wxString *aToken) const
virtual PROJECT_FILE & GetProjectFile() const
virtual const wxString GetSheetName(const KIID &aSheetID)
Return the name of the sheet identified by the given UUID.
wxString m_rstrings[RSTRING_COUNT]
virtual const wxString FootprintLibTblName() const
Returns the path and filename of this project's footprint library table.
virtual _ELEM * GetElem(ELEM_T aIndex)
Get and set the elements for this project.
_ELEM * m_elems[ELEM_COUNT]
virtual void SetElem(ELEM_T aIndex, _ELEM *aElem)
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...
wxFileName m_project_name
<fullpath>/<basename>.pro
void Clear()
Clear the _ELEMs and RSTRINGs.
virtual const wxString AbsolutePath(const wxString &aFileName) const
Fix up aFileName if it is relative to the project's directory to be an absolute path and filename.
const wxString libTableName(const wxString &aLibTableName) const
Return the full path and file name of the project specific library table aLibTableName.
virtual void setProjectFullName(const wxString &aFullPathAndName)
Set the full directory, basename, and extension of the project.
virtual const wxString GetProjectDirectory() const
Return the full path of the project DIRECTORY.
virtual std::map< wxString, wxString > & GetTextVars() const
virtual const wxString & GetRString(RSTRING_T aStringId)
Return a "retained string", which is any session and project specific string identified in enum RSTRI...
ELEM_T
The set of #_ELEMs that a PROJECT can hold.
virtual bool IsNullProject() const
Check if this project is a null project (i.e.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
This file is part of the common library.
static const std::string ProjectFileExtension
const wxChar *const tracePathsAndFiles
Flag to enable path and file name debug output.
@ KIFACE_NEW_FOOTPRINT_TABLE
Return a new FP_LIB_TABLE with the global table installed as a fallback.
This file contains miscellaneous commonly used macros and functions.
void delete_matching(_Container &__c, _Value __value)
Covers for the horrifically named std::remove and std::remove_if (neither of which remove anything).
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
SETTINGS_MANAGER * GetSettingsManager()
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
std::vector< wxString > pinned_fp_libs
std::vector< wxString > pinned_symbol_libs
void * IfaceOrAddress(int aDataId) override
Return a pointer to the requested object.
Implement a participant in the KIWAY alchemy.
IFACE KIFACE_BASE kiface("pcb_test_frame", KIWAY::FACE_PCB)
wxLogTrace helper definitions.
Definition of file extensions used in Kicad.
#define FN_NORMALIZE_FLAGS
Default flags to pass to wxFileName::Normalize().