KiCad PCB EDA Suite
Loading...
Searching...
No Matches
project.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, see <https://www.gnu.org/licenses/>.
18 */
19
20#include <wx/log.h>
21#include <wx/stdpaths.h> // required on Mac
23
24#include <algorithm>
25#include <pgm_base.h>
26#include <confirm.h>
27#include <core/kicad_algo.h>
29#include <string_utils.h>
30#include <kiface_ids.h>
31#include <kiway.h>
34#include <lockfile.h>
35#include <macros.h>
38#include <git2.h>
39#include <project.h>
41
43
45#include <trace_helpers.h>
49#include <title_block.h>
50#include <local_history.h>
51
52
53
55 m_readOnly( false ),
56 m_lockOverrideGranted( false ),
59 m_projectFile( nullptr ),
60 m_localSettings( nullptr )
61{
62 m_elems.fill( nullptr );
63}
64
65
67{
68 // careful here, this should work, but the virtual destructor may not
69 // be in the same link image as PROJECT.
70 for( unsigned i = 0; i < m_elems.size(); ++i )
71 {
72 SetElem( static_cast<PROJECT::ELEM>( i ), nullptr );
73 }
74}
75
76
82
83
84std::shared_ptr<KIGIT_COMMON> PROJECT::GetGitCommon() const
85{
86 if( !m_gitCommon )
87 m_gitCommon = std::make_shared<KIGIT_COMMON>( nullptr, GetProjectPath() );
88
89 return m_gitCommon;
90}
91
92
94{
95 std::shared_ptr<KIGIT_COMMON> common = GetGitCommon();
96
97 if( common->GetRepo() )
98 return true;
99
100 if( m_localSettings && m_localSettings->m_GitIntegrationDisabled )
101 return false;
102
103 // First attach only, or every panel refresh would undo what the credentials prompt
104 // corrected on the live session.
105 if( m_localSettings )
106 common->SetSSHKey( m_localSettings->m_GitSSHKey );
107
108 wxFileName fn( GetProjectFullName() );
109 wxString projectDir = fn.GetPath();
110 wxString attachError;
111 wxString trustCommand;
112 git_repository* repo =
113 KIGIT::PROJECT_GIT_UTILS::GetRepositoryForFile( TO_UTF8( projectDir ), &attachError, &trustCommand );
114
115 common->SetAttachError( attachError, trustCommand );
116
117 if( !repo )
118 return false;
119
120 // A bare repository has no files on disk to show or commit, so attaching to one would
121 // report the project as having no changes while every operation on it failed.
122 if( !git_repository_workdir( repo ) )
123 {
124 git_repository_free( repo );
125 common->SetAttachError( _( "The git repository holding this project has no working folder, so "
126 "KiCad cannot use it. Clone the repository normally and open the "
127 "project from the clone." ) );
128 return false;
129 }
130
131 common->SetRepo( repo );
132 common->SetShuttingDown( false );
133
134 const char* canonicalWorkDir = git_repository_workdir( repo );
135
136 if( canonicalWorkDir )
137 {
139 projectDir, wxString::FromUTF8( canonicalWorkDir ) );
140 common->SetProjectDir( symlinkWorkDir );
141 }
142
143 common->UpdateCurrentBranchInfo();
144
145 wxString remote = common->GetRemote();
146
147 // The address names no transport, so the one picked in the credential prompt stands in
148 if( m_localSettings && !remote.IsEmpty()
150 {
151 if( m_localSettings->m_GitRepoType == wxS( "ssh" ) )
152 common->SetConnType( KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_SSH );
153 else if( m_localSettings->m_GitRepoType == wxS( "https" ) )
154 common->SetConnType( KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_HTTPS );
155 }
156
157 // Reading the URL clears a username it does not name, and one it does name wins
158 if( m_localSettings && common->GetUsername().IsEmpty() )
159 common->SetUsername( m_localSettings->m_GitRepoUsername );
160
161 return true;
162}
163
164
166{
167 if( !m_gitCommon )
168 return;
169
170 std::shared_ptr<KIGIT_COMMON> old = std::move( m_gitCommon );
171
172 std::string label = "release " + GetProjectPath().ToStdString();
173 KIGIT::PROJECT_GIT_UTILS::SafeFreeRepository( std::move( old ), label );
174}
175
176
177bool PROJECT::TextVarResolver( wxString* aToken ) const
178{
179 if( !m_projectFile )
180 return false;
181
182 if( aToken->IsSameAs( wxT( "PROJECTNAME" ) ) )
183 {
184 *aToken = GetProjectName();
185 return true;
186 }
187 else if( aToken->IsSameAs( wxT( "CURRENT_DATE" ) ) )
188 {
189 *aToken = TITLE_BLOCK::GetCurrentDate();
190 return true;
191 }
192 else if( aToken->IsSameAs( wxT( "CURRENT_TIME_HH_MM_SS" ) ) )
193 {
195 return true;
196 }
197 else if( aToken->IsSameAs( wxT( "CURRENT_TIME_LOCALE" ) ) )
198 {
200 return true;
201 }
202 else if( aToken->IsSameAs( wxT( "VCSHASH" ) ) )
203 {
205 return true;
206 }
207 else if( aToken->IsSameAs( wxT( "VCSSHORTHASH" ) ) )
208 {
210 return true;
211 }
212 else if( GetTextVars().count( *aToken ) > 0 )
213 {
214 *aToken = GetTextVars().at( *aToken );
215 return true;
216 }
217
218 return false;
219}
220
221
222std::map<wxString, wxString>& PROJECT::GetTextVars() const
223{
224 return GetProjectFile().m_TextVars;
225}
226
227
228void PROJECT::ApplyTextVars( const std::map<wxString, wxString>& aVarsMap )
229{
230 if( aVarsMap.size() == 0 )
231 return;
232
233 std::map<wxString, wxString>& existingVarsMap = GetTextVars();
234
235 for( const auto& var : aVarsMap )
236 {
237 // create or update the existing vars
238 existingVarsMap[var.first] = var.second;
239 }
240}
241
242
243void PROJECT::setProjectFullName( const wxString& aFullPathAndName )
244{
245 // Compare paths, rather than inodes, to be less surprising to the user.
246 // Create a temporary wxFileName to normalize the path
247 wxFileName candidate_path( aFullPathAndName );
248
249 // Edge transitions only. This is what clears the project
250 // data using the Clear() function.
251 if( m_project_name.GetFullPath() != candidate_path.GetFullPath() )
252 {
254 Clear(); // clear the data when the project changes.
255
256 wxLogTrace( tracePathsAndFiles, "%s: old:'%s' new:'%s'", __func__,
257 TO_UTF8( GetProjectFullName() ), TO_UTF8( aFullPathAndName ) );
258
259 m_project_name = aFullPathAndName;
260
261 wxASSERT( m_project_name.IsAbsolute() );
262 wxString ext = m_project_name.GetExt();
263
264 if( !ext.IsEmpty() && ext != FILEEXT::ProjectFileExtension )
266 }
267}
268
269
270const wxString PROJECT::GetProjectFullName() const
271{
272 return m_project_name.GetFullPath();
273}
274
275
276const wxString PROJECT::GetProjectPath() const
277{
278 return m_project_name.GetPathWithSep();
279}
280
281
282const wxString PROJECT::GetProjectDirectory() const
283{
284 return m_project_name.GetPath();
285}
286
287
288const wxString PROJECT::GetProjectName() const
289{
290 return m_project_name.GetName();
291}
292
293
295{
296 return m_project_name.GetName().IsEmpty();
297}
298
299
304
305
310
311
316
317
318void PROJECT::PinLibrary( const wxString& aLibrary, enum LIB_TYPE_T aLibType )
319{
321 std::vector<wxString>* pinnedLibsCfg = nullptr;
322 std::vector<wxString>* pinnedLibsFile = nullptr;
323
324 switch( aLibType )
325 {
327 pinnedLibsFile = &m_projectFile->m_PinnedSymbolLibs;
328 pinnedLibsCfg = &cfg->m_Session.pinned_symbol_libs;
329 break;
331 pinnedLibsFile = &m_projectFile->m_PinnedFootprintLibs;
332 pinnedLibsCfg = &cfg->m_Session.pinned_fp_libs;
333 break;
335 pinnedLibsFile = &m_projectFile->m_PinnedDesignBlockLibs;
336 pinnedLibsCfg = &cfg->m_Session.pinned_design_block_libs;
337 break;
338 default:
339 wxFAIL_MSG( "Cannot pin library: invalid library type" );
340 return;
341 }
342
343 if( !alg::contains( *pinnedLibsFile, aLibrary ) )
344 pinnedLibsFile->push_back( aLibrary );
345
347
348 if( !alg::contains( *pinnedLibsCfg, aLibrary ) )
349 pinnedLibsCfg->push_back( aLibrary );
350
351 cfg->SaveToFile( Pgm().GetSettingsManager().GetPathForSettingsFile( cfg ) );
352}
353
354
355void PROJECT::UnpinLibrary( const wxString& aLibrary, enum LIB_TYPE_T aLibType )
356{
358 std::vector<wxString>* pinnedLibsCfg = nullptr;
359 std::vector<wxString>* pinnedLibsFile = nullptr;
360
361 switch( aLibType )
362 {
364 pinnedLibsFile = &m_projectFile->m_PinnedSymbolLibs;
365 pinnedLibsCfg = &cfg->m_Session.pinned_symbol_libs;
366 break;
368 pinnedLibsFile = &m_projectFile->m_PinnedFootprintLibs;
369 pinnedLibsCfg = &cfg->m_Session.pinned_fp_libs;
370 break;
372 pinnedLibsFile = &m_projectFile->m_PinnedDesignBlockLibs;
373 pinnedLibsCfg = &cfg->m_Session.pinned_design_block_libs;
374 break;
375 default:
376 wxFAIL_MSG( "Cannot unpin library: invalid library type" );
377 return;
378 }
379
380 std::erase( *pinnedLibsFile, aLibrary );
382
383 std::erase( *pinnedLibsCfg, aLibrary );
384 cfg->SaveToFile( Pgm().GetSettingsManager().GetPathForSettingsFile( cfg ) );
385}
386
387
388const wxString PROJECT::libTableName( const wxString& aLibTableName ) const
389{
390 wxFileName fn = GetProjectFullName();
391 wxString path = fn.GetPath();
392
393 // if there's no path to the project name, or the name as a whole is bogus or its not
394 // write-able then use a template file.
395 if( !fn.GetDirCount() || !fn.IsOk() || !wxFileName::IsDirWritable( path ) )
396 {
397 // return a template filename now.
398
399 // this next line is likely a problem now, since it relies on an
400 // application title which is no longer constant or known. This next line needs
401 // to be re-thought out.
402
403#ifdef __WXMAC__
404 fn.AssignDir( KIPLATFORM::ENV::GetUserConfigPath() );
405#else
406 // don't pollute home folder, temp folder seems to be more appropriate
407 fn.AssignDir( wxStandardPaths::Get().GetTempDir() );
408#endif
409
410#if defined( __WINDOWS__ )
411 fn.AppendDir( wxT( "kicad" ) );
412#endif
413
414 /*
415 * The library table name used when no project file is passed to the appropriate
416 * code. This is used temporarily to store the project specific library table
417 * until the project file being edited is saved. It is then moved to the correct
418 * file in the folder where the project file is saved.
419 */
420 fn.SetName( wxS( "prj-" ) + aLibTableName );
421 }
422 else // normal path.
423 {
424 fn.SetName( aLibTableName );
425 }
426
427 fn.ClearExt();
428
429 return fn.GetFullPath();
430}
431
432
433const wxString PROJECT::GetSheetName( const KIID& aSheetID )
434{
435 if( m_sheetNames.empty() )
436 {
437 for( const std::pair<KIID, wxString>& pair : GetProjectFile().GetSheets() )
438 m_sheetNames[pair.first] = pair.second;
439 }
440
441 if( m_sheetNames.count( aSheetID ) )
442 return m_sheetNames.at( aSheetID );
443 else
444 return aSheetID.AsString();
445}
446
447
448void PROJECT::SetRString( RSTRING_T aIndex, const wxString& aString )
449{
450 unsigned ndx = unsigned( aIndex );
451
452 if( ndx < m_rstrings.size() )
453 m_rstrings[ndx] = aString;
454 else
455 wxASSERT( 0 ); // bad index
456}
457
458
459const wxString& PROJECT::GetRString( RSTRING_T aIndex )
460{
461 unsigned ndx = unsigned( aIndex );
462
463 if( ndx < m_rstrings.size() )
464 {
465 return m_rstrings[ndx];
466 }
467 else
468 {
469 static wxString no_cookie_for_you;
470
471 wxASSERT( 0 ); // bad index
472
473 return no_cookie_for_you;
474 }
475}
476
477
479{
480 // This is virtual, so implement it out of line
481
482 if( static_cast<unsigned>( aIndex ) < m_elems.size() )
483 return m_elems[static_cast<unsigned>( aIndex )];
484
485 return nullptr;
486}
487
488
490{
491 // This is virtual, so implement it out of line
492 if( static_cast<unsigned>( aIndex ) < m_elems.size() )
493 {
494 delete m_elems[static_cast<unsigned>(aIndex)];
495 m_elems[static_cast<unsigned>( aIndex )] = aElem;
496 }
497}
498
499
500const wxString PROJECT::AbsolutePath( const wxString& aFileName ) const
501{
502 wxFileName fn = aFileName;
503
504 // Paths which start with an unresolved variable reference are more likely to be
505 // absolute than relative.
506 if( aFileName.StartsWith( wxT( "${" ) ) )
507 return aFileName;
508
509 if( !fn.IsAbsolute() )
510 {
511 wxString pro_dir = wxPathOnly( GetProjectFullName() );
512 fn.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS, pro_dir );
513 }
514
515 return fn.GetFullPath();
516}
517
518
524
525
527{
528 std::scoped_lock lock( m_designBlockLibsMutex );
529
531 std::optional<LIBRARY_MANAGER_ADAPTER*> adapter = mgr.Adapter( LIBRARY_TABLE_TYPE::DESIGN_BLOCK );
532
533 if( !adapter )
534 {
536 std::make_unique<DESIGN_BLOCK_LIBRARY_ADAPTER>( mgr ) );
537
538 std::optional<LIBRARY_MANAGER_ADAPTER*> created = mgr.Adapter( LIBRARY_TABLE_TYPE::DESIGN_BLOCK );
539 wxCHECK( created && ( *created )->Type() == LIBRARY_TABLE_TYPE::DESIGN_BLOCK, nullptr );
540 return static_cast<DESIGN_BLOCK_LIBRARY_ADAPTER*>( *created );
541 }
542
543 wxCHECK( ( *adapter )->Type() == LIBRARY_TABLE_TYPE::DESIGN_BLOCK, nullptr );
544 return static_cast<DESIGN_BLOCK_LIBRARY_ADAPTER*>( *adapter );
545}
546
547
549{
550 return m_project_lock.get();
551}
552
553
555{
556 m_project_lock.reset( aLockFile );
557}
558
559
560void PROJECT::SaveToHistory( const wxString& aProjectPath, std::vector<HISTORY_FILE_DATA>& aFileData )
561{
562 wxString projectFile = GetProjectFullName();
563
564 if( projectFile.IsEmpty() )
565 return;
566
567 wxFileName projectFn( projectFile );
568 wxFileName requestedFn( aProjectPath );
569 // wxPATH_NORM_ALL is now deprecated.
570 // So define a similar option
571 int norm_opt = wxPATH_NORM_ENV_VARS|wxPATH_NORM_DOTS|wxPATH_NORM_TILDE|wxPATH_NORM_ABSOLUTE
572 |wxPATH_NORM_LONG|wxPATH_NORM_SHORTCUT;
573
574 if( !projectFn.Normalize( norm_opt ) || !requestedFn.Normalize( norm_opt ) )
575 return;
576
577 if( projectFn.GetFullPath() != requestedFn.GetFullPath() )
578 return;
579
580 HISTORY_FILE_DATA proEntry;
581 proEntry.relativePath = projectFn.GetFullName();
582
583 // Board Setup edits live only in RAM until a real save, so snapshot the live state.
584 if( m_projectFile )
585 proEntry.content = m_projectFile->SerializeToString();
586
587 if( proEntry.content.empty() )
588 proEntry.sourcePath = projectFile;
589
590 aFileData.push_back( std::move( proEntry ) );
591
592 wxFileName prlFile( projectFn.GetPath(), projectFn.GetName(),
594
595 if( prlFile.FileExists() )
596 {
597 HISTORY_FILE_DATA prlEntry;
598 prlEntry.relativePath = prlFile.GetFullName();
599 prlEntry.sourcePath = prlFile.GetFullPath();
600 aFileData.push_back( std::move( prlEntry ) );
601 }
602}
An interface to the global shared library manager that is schematic-specific and linked to one projec...
virtual bool SaveToFile(const wxString &aDirectory="", bool aForce=false)
Calls Store() and then writes the contents of the JSON document to a file.
static wxString GetCurrentHash(const wxString &aProjectFile, bool aShort)
Return the current HEAD commit hash for the repository containing aProjectFile.
static git_repository * GetRepositoryForFile(const char *aFilename, wxString *aError=nullptr, wxString *aTrustCommand=nullptr)
Discover and open the repository that contains the given file.
static void SafeFreeRepository(std::shared_ptr< KIGIT_COMMON > aCommon, const std::string &aLabel)
Free the session's repository handle without pulling it out from under a running operation.
static wxString ComputeSymlinkPreservingWorkDir(const wxString &aUserProjectPath, const wxString &aCanonicalWorkDir)
Compute a working directory path that preserves symlinks from the user's project path.
static REMOTE_URL ParseRemoteURL(const wxString &aURL)
Definition kiid.h:46
wxString AsString() const
Definition kiid.cpp:264
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:348
virtual KIFACE * KiFACE(FACE_T aFaceId, bool doLoad=true)
Return the KIFACE* given a FACE_T.
Definition kiway.cpp:214
@ FACE_PCB
pcbnew DSO
Definition kiway.h:356
std::optional< LIBRARY_MANAGER_ADAPTER * > Adapter(LIBRARY_TABLE_TYPE aType) const
void RegisterAdapter(LIBRARY_TABLE_TYPE aType, std::unique_ptr< LIBRARY_MANAGER_ADAPTER > &&aAdapter)
Advisory lock over a file, taken by writing a sibling lock file and holding an exclusive lock on it f...
Definition lockfile.h:54
virtual COMMON_SETTINGS * GetCommonSettings() const
Definition pgm_base.cpp:562
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition pgm_base.h:123
virtual LIBRARY_MANAGER & GetLibraryManager() const
Definition pgm_base.h:125
A PROJECT can hold stuff it knows nothing about, in the form of _ELEM derivatives.
Definition project.h:90
std::map< wxString, wxString > m_TextVars
PROJECT_FILE * m_projectFile
Backing store for project data – owned by SETTINGS_MANAGER.
Definition project.h:392
void SetProjectLock(LOCKFILE *aLockFile)
Definition project.cpp:554
bool m_lockOverrideGranted
User granted override at project level.
Definition project.h:387
virtual std::shared_ptr< KIGIT_COMMON > GetGitCommon() const
This project's Git session, created empty on first use.
Definition project.cpp:84
LOCKFILE * GetProjectLock() const
Definition project.cpp:548
std::shared_ptr< KIGIT_COMMON > m_gitCommon
Git session for the repository containing this project, created on first use.
Definition project.h:398
@ SYMBOL_LIB
Definition project.h:191
@ DESIGN_BLOCK_LIB
Definition project.h:193
@ FOOTPRINT_LIB
Definition project.h:192
virtual const wxString GetProjectFullName() const
Return the full path and name of the project.
Definition project.cpp:270
virtual void SetElem(PROJECT::ELEM aIndex, _ELEM *aElem)
Definition project.cpp:489
virtual const wxString DesignBlockLibTblName() const
Return the path and file name of this projects design block library table.
Definition project.cpp:312
void PinLibrary(const wxString &aLibrary, enum LIB_TYPE_T aLibType)
Definition project.cpp:318
RSTRING_T
Retain a number of project specific wxStrings, enumerated here:
Definition project.h:233
std::map< KIID, wxString > m_sheetNames
Definition project.h:400
std::unique_ptr< LOCKFILE > m_project_lock
Lock.
Definition project.h:409
virtual const wxString GetProjectPath() const
Return the full path of the project.
Definition project.cpp:276
virtual const wxString GetProjectName() const
Return the short name of the project.
Definition project.cpp:288
int m_netclassesTicker
Update counter on netclasses.
Definition project.h:389
virtual const wxString SymbolLibTableName() const
Return the path and file name of this projects symbol library table.
Definition project.cpp:300
virtual _ELEM * GetElem(PROJECT::ELEM aIndex)
Get and set the elements for this project.
Definition project.cpp:478
virtual ~PROJECT()
Definition project.cpp:77
virtual void ApplyTextVars(const std::map< wxString, wxString > &aVarsMap)
Applies the given var map, it will create or update existing vars.
Definition project.cpp:228
virtual bool AttachGitRepository()
Find the Git repository containing the project directory and bind it to the session.
Definition project.cpp:93
virtual void ReleaseGitCommon()
Safely release the session's repository handle and drop the session.
Definition project.cpp:165
virtual DESIGN_BLOCK_LIBRARY_ADAPTER * DesignBlockLibs()
Return the table of design block libraries.
Definition project.cpp:526
virtual bool TextVarResolver(wxString *aToken) const
Definition project.cpp:177
virtual PROJECT_FILE & GetProjectFile() const
Definition project.h:201
virtual const wxString GetSheetName(const KIID &aSheetID)
Return the name of the sheet identified by the given UUID.
Definition project.cpp:433
std::mutex m_designBlockLibsMutex
Synchronise access to DesignBlockLibs()
Definition project.h:412
std::array< _ELEM *, static_cast< unsigned int >(PROJECT::ELEM::COUNT)> m_elems
Definition project.h:406
virtual void elemsClear()
Delete all the _ELEMs and set their pointers to NULL.
Definition project.cpp:66
virtual const wxString FootprintLibTblName() const
Returns the path and filename of this project's footprint library table.
Definition project.cpp:306
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...
Definition project.cpp:448
wxFileName m_project_name
<fullpath>/<basename>.pro
Definition project.h:384
void Clear()
Clear the _ELEMs and RSTRINGs.
Definition project.h:288
virtual FOOTPRINT_LIBRARY_ADAPTER * FootprintLibAdapter(KIWAY &aKiway)
Fetches the footprint library adapter from the PCB editor instance.
Definition project.cpp:519
PROJECT_LOCAL_SETTINGS * m_localSettings
Backing store for project local settings – owned by SETTINGS_MANAGER.
Definition project.h:395
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.
Definition project.cpp:500
void SaveToHistory(const wxString &aProjectPath, std::vector< HISTORY_FILE_DATA > &aFileData)
Produce HISTORY_FILE_DATA entries for project files (.kicad_pro and .kicad_prl).
Definition project.cpp:560
int m_textVarsTicker
Update counter on text vars.
Definition project.h:388
void UnpinLibrary(const wxString &aLibrary, enum LIB_TYPE_T aLibType)
Definition project.cpp:355
std::array< wxString, RSTRING_COUNT > m_rstrings
Definition project.h:403
const wxString libTableName(const wxString &aLibTableName) const
Return the full path and file name of the project specific library table aLibTableName.
Definition project.cpp:388
virtual void setProjectFullName(const wxString &aFullPathAndName)
Set the full directory, basename, and extension of the project.
Definition project.cpp:243
bool m_readOnly
No project files will be written to disk.
Definition project.h:386
virtual const wxString GetProjectDirectory() const
Return the full path of the project DIRECTORY.
Definition project.cpp:282
virtual std::map< wxString, wxString > & GetTextVars() const
Definition project.cpp:222
PROJECT()
Definition project.cpp:54
virtual const wxString & GetRString(RSTRING_T aStringId)
Return a "retained string", which is any session and project specific string identified in enum RSTRI...
Definition project.cpp:459
virtual bool IsNullProject() const
Check if this project is a null project (i.e.
Definition project.cpp:294
ELEM
The set of _ELEM objects that a PROJECT can hold.
Definition project.h:69
bool SaveProject(const wxString &aFullPath=wxEmptyString, PROJECT *aProject=nullptr)
Save a loaded project.
static wxString GetCurrentTimeLocale()
static wxString GetCurrentTimeHHMMSS()
static wxString GetCurrentDate()
This file is part of the common library.
#define _(s)
static const std::string SymbolLibraryTableFileName
static const std::string ProjectFileExtension
static const std::string ProjectLocalSettingsFileExtension
static const std::string DesignBlockLibraryTableFileName
static const std::string FootprintLibraryTableFileName
const wxChar *const tracePathsAndFiles
Flag to enable path and file name debug output.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition idf_helpers.h:37
@ KIFACE_FOOTPRINT_LIBRARY_ADAPTER
Definition kiface_ids.h:30
This file contains miscellaneous commonly used macros and functions.
wxString GetUserConfigPath()
Retrieves the operating system specific path for a user's configuration store.
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition kicad_algo.h:96
PGM_BASE & Pgm()
The global program "get" accessor.
see class PGM_BASE
std::vector< wxString > pinned_design_block_libs
std::vector< wxString > pinned_fp_libs
std::vector< wxString > pinned_symbol_libs
Data produced by a registered saver on the UI thread, consumed by either the background local-history...
wxString sourcePath
For file-copy savers (small files like .kicad_pro)
std::string content
Serialized content (mutually exclusive with sourcePath)
wxString relativePath
Destination path relative to the project root.
Implement a participant in the KIWAY alchemy.
Definition kiway.h:153
IFACE KIFACE_BASE kiface("pcb_test_frame", KIWAY::FACE_PCB)
std::string path
wxLogTrace helper definitions.
Definition of file extensions used in Kicad.
#define FN_NORMALIZE_FLAGS
Default flags to pass to wxFileName::Normalize().
Definition wx_filename.h:35