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_services.h>
31#include <kiway.h>
34#include <lockfile.h>
35#include <macros.h>
37#include <git/kigit_ssh_keys.h>
39#include <git2.h>
40#include <project.h>
42
44
46#include <trace_helpers.h>
50#include <title_block.h>
51#include <local_history.h>
52
53
54
56 m_readOnly( false ),
57 m_lockOverrideGranted( false ),
60 m_projectFile( nullptr ),
61 m_localSettings( nullptr )
62{
63 m_elems.fill( nullptr );
64}
65
66
68{
69 // careful here, this should work, but the virtual destructor may not
70 // be in the same link image as PROJECT.
71 for( unsigned i = 0; i < m_elems.size(); ++i )
72 {
73 SetElem( static_cast<PROJECT::ELEM>( i ), nullptr );
74 }
75}
76
77
83
84
85std::shared_ptr<KIGIT_COMMON> PROJECT::GetGitCommon() const
86{
87 if( !m_gitCommon )
88 m_gitCommon = std::make_shared<KIGIT_COMMON>( nullptr, GetProjectPath() );
89
90 return m_gitCommon;
91}
92
93
95{
96 std::shared_ptr<KIGIT_COMMON> common = GetGitCommon();
97
98 if( common->GetRepo() )
99 return true;
100
101 if( m_localSettings && m_localSettings->m_GitIntegrationDisabled )
102 return false;
103
104 // First attach only, or every panel refresh would undo what the credentials prompt
105 // corrected on the live session.
106 if( m_localSettings )
107 common->SetSSHKey( KIGIT::PrivateKeyPath( m_localSettings->m_GitSSHKey ) );
108
109 wxFileName fn( GetProjectFullName() );
110 wxString projectDir = fn.GetPath();
111 wxString attachError;
112 wxString trustCommand;
113 git_repository* repo =
114 KIGIT::PROJECT_GIT_UTILS::GetRepositoryForFile( TO_UTF8( projectDir ), &attachError, &trustCommand );
115
116 common->SetAttachError( attachError, trustCommand );
117
118 if( !repo )
119 return false;
120
121 // A bare repository has no files on disk to show or commit, so attaching to one would
122 // report the project as having no changes while every operation on it failed.
123 if( !git_repository_workdir( repo ) )
124 {
125 git_repository_free( repo );
126 common->SetAttachError( _( "The git repository holding this project has no working folder, so "
127 "KiCad cannot use it. Clone the repository normally and open the "
128 "project from the clone." ) );
129 return false;
130 }
131
132 common->SetRepo( repo );
133 common->SetShuttingDown( false );
134
135 const char* canonicalWorkDir = git_repository_workdir( repo );
136
137 if( canonicalWorkDir )
138 {
140 projectDir, wxString::FromUTF8( canonicalWorkDir ) );
141 common->SetProjectDir( symlinkWorkDir );
142 }
143
144 common->UpdateCurrentBranchInfo();
145
146 wxString remote = common->GetRemote();
147
148 // The address names no transport, so the one picked in the credential prompt stands in
149 if( m_localSettings && !remote.IsEmpty()
151 {
152 if( m_localSettings->m_GitRepoType == wxS( "ssh" ) )
153 common->SetConnType( KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_SSH );
154 else if( m_localSettings->m_GitRepoType == wxS( "https" ) )
155 common->SetConnType( KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_HTTPS );
156 }
157
158 // Reading the URL clears a username it does not name, and one it does name wins
159 if( m_localSettings && common->GetUsername().IsEmpty() )
160 common->SetUsername( m_localSettings->m_GitRepoUsername );
161
162 return true;
163}
164
165
167{
168 if( !m_gitCommon )
169 return;
170
171 std::shared_ptr<KIGIT_COMMON> old = std::move( m_gitCommon );
172
173 std::string label = "release " + GetProjectPath().ToStdString();
174 KIGIT::PROJECT_GIT_UTILS::SafeFreeRepository( std::move( old ), label );
175}
176
177
178bool PROJECT::TextVarResolver( wxString* aToken ) const
179{
180 if( !m_projectFile )
181 return false;
182
183 if( aToken->IsSameAs( wxT( "PROJECTNAME" ) ) )
184 {
185 *aToken = GetProjectName();
186 return true;
187 }
188 else if( aToken->IsSameAs( wxT( "CURRENT_DATE" ) ) )
189 {
190 *aToken = TITLE_BLOCK::GetCurrentDate();
191 return true;
192 }
193 else if( aToken->IsSameAs( wxT( "CURRENT_TIME_HH_MM_SS" ) ) )
194 {
196 return true;
197 }
198 else if( aToken->IsSameAs( wxT( "CURRENT_TIME_LOCALE" ) ) )
199 {
201 return true;
202 }
203 else if( aToken->IsSameAs( wxT( "VCSHASH" ) ) )
204 {
206 return true;
207 }
208 else if( aToken->IsSameAs( wxT( "VCSSHORTHASH" ) ) )
209 {
211 return true;
212 }
213 else if( GetTextVars().count( *aToken ) > 0 )
214 {
215 *aToken = GetTextVars().at( *aToken );
216 return true;
217 }
218
219 return false;
220}
221
222
223std::map<wxString, wxString>& PROJECT::GetTextVars() const
224{
225 return GetProjectFile().m_TextVars;
226}
227
228
229void PROJECT::ApplyTextVars( const std::map<wxString, wxString>& aVarsMap )
230{
231 if( aVarsMap.size() == 0 )
232 return;
233
234 std::map<wxString, wxString>& existingVarsMap = GetTextVars();
235
236 for( const auto& var : aVarsMap )
237 {
238 // create or update the existing vars
239 existingVarsMap[var.first] = var.second;
240 }
241}
242
243
244void PROJECT::setProjectFullName( const wxString& aFullPathAndName )
245{
246 // Compare paths, rather than inodes, to be less surprising to the user.
247 // Create a temporary wxFileName to normalize the path
248 wxFileName candidate_path( aFullPathAndName );
249
250 // Edge transitions only. This is what clears the project
251 // data using the Clear() function.
252 if( m_project_name.GetFullPath() != candidate_path.GetFullPath() )
253 {
255 Clear(); // clear the data when the project changes.
256
257 wxLogTrace( tracePathsAndFiles, "%s: old:'%s' new:'%s'", __func__,
258 TO_UTF8( GetProjectFullName() ), TO_UTF8( aFullPathAndName ) );
259
260 m_project_name = aFullPathAndName;
261
262 wxASSERT( m_project_name.IsAbsolute() );
263 wxString ext = m_project_name.GetExt();
264
265 if( !ext.IsEmpty() && ext != FILEEXT::ProjectFileExtension )
267 }
268}
269
270
271const wxString PROJECT::GetProjectFullName() const
272{
273 return m_project_name.GetFullPath();
274}
275
276
277const wxString PROJECT::GetProjectPath() const
278{
279 return m_project_name.GetPathWithSep();
280}
281
282
283const wxString PROJECT::GetProjectDirectory() const
284{
285 return m_project_name.GetPath();
286}
287
288
289const wxString PROJECT::GetProjectName() const
290{
291 return m_project_name.GetName();
292}
293
294
296{
297 return m_project_name.GetName().IsEmpty();
298}
299
300
305
306
311
312
317
318
319void PROJECT::PinLibrary( const wxString& aLibrary, enum LIB_TYPE_T aLibType )
320{
322 std::vector<wxString>* pinnedLibsCfg = nullptr;
323 std::vector<wxString>* pinnedLibsFile = nullptr;
324
325 switch( aLibType )
326 {
328 pinnedLibsFile = &m_projectFile->m_PinnedSymbolLibs;
329 pinnedLibsCfg = &cfg->m_Session.pinned_symbol_libs;
330 break;
332 pinnedLibsFile = &m_projectFile->m_PinnedFootprintLibs;
333 pinnedLibsCfg = &cfg->m_Session.pinned_fp_libs;
334 break;
336 pinnedLibsFile = &m_projectFile->m_PinnedDesignBlockLibs;
337 pinnedLibsCfg = &cfg->m_Session.pinned_design_block_libs;
338 break;
339 default:
340 wxFAIL_MSG( "Cannot pin library: invalid library type" );
341 return;
342 }
343
344 if( !alg::contains( *pinnedLibsFile, aLibrary ) )
345 pinnedLibsFile->push_back( aLibrary );
346
348
349 if( !alg::contains( *pinnedLibsCfg, aLibrary ) )
350 pinnedLibsCfg->push_back( aLibrary );
351
352 cfg->SaveToFile( Pgm().GetSettingsManager().GetPathForSettingsFile( cfg ) );
353}
354
355
356void PROJECT::UnpinLibrary( const wxString& aLibrary, enum LIB_TYPE_T aLibType )
357{
359 std::vector<wxString>* pinnedLibsCfg = nullptr;
360 std::vector<wxString>* pinnedLibsFile = nullptr;
361
362 switch( aLibType )
363 {
365 pinnedLibsFile = &m_projectFile->m_PinnedSymbolLibs;
366 pinnedLibsCfg = &cfg->m_Session.pinned_symbol_libs;
367 break;
369 pinnedLibsFile = &m_projectFile->m_PinnedFootprintLibs;
370 pinnedLibsCfg = &cfg->m_Session.pinned_fp_libs;
371 break;
373 pinnedLibsFile = &m_projectFile->m_PinnedDesignBlockLibs;
374 pinnedLibsCfg = &cfg->m_Session.pinned_design_block_libs;
375 break;
376 default:
377 wxFAIL_MSG( "Cannot unpin library: invalid library type" );
378 return;
379 }
380
381 std::erase( *pinnedLibsFile, aLibrary );
383
384 std::erase( *pinnedLibsCfg, aLibrary );
385 cfg->SaveToFile( Pgm().GetSettingsManager().GetPathForSettingsFile( cfg ) );
386}
387
388
389const wxString PROJECT::libTableName( const wxString& aLibTableName ) const
390{
391 wxFileName fn = GetProjectFullName();
392 wxString path = fn.GetPath();
393
394 // if there's no path to the project name, or the name as a whole is bogus or its not
395 // write-able then use a template file.
396 if( !fn.GetDirCount() || !fn.IsOk() || !wxFileName::IsDirWritable( path ) )
397 {
398 // return a template filename now.
399
400 // this next line is likely a problem now, since it relies on an
401 // application title which is no longer constant or known. This next line needs
402 // to be re-thought out.
403
404#ifdef __WXMAC__
405 fn.AssignDir( KIPLATFORM::ENV::GetUserConfigPath() );
406#else
407 // don't pollute home folder, temp folder seems to be more appropriate
408 fn.AssignDir( wxStandardPaths::Get().GetTempDir() );
409#endif
410
411#if defined( __WINDOWS__ )
412 fn.AppendDir( wxT( "kicad" ) );
413#endif
414
415 /*
416 * The library table name used when no project file is passed to the appropriate
417 * code. This is used temporarily to store the project specific library table
418 * until the project file being edited is saved. It is then moved to the correct
419 * file in the folder where the project file is saved.
420 */
421 fn.SetName( wxS( "prj-" ) + aLibTableName );
422 }
423 else // normal path.
424 {
425 fn.SetName( aLibTableName );
426 }
427
428 fn.ClearExt();
429
430 return fn.GetFullPath();
431}
432
433
434const wxString PROJECT::GetSheetName( const KIID& aSheetID )
435{
436 if( m_sheetNames.empty() )
437 {
438 for( const std::pair<KIID, wxString>& pair : GetProjectFile().GetSheets() )
439 m_sheetNames[pair.first] = pair.second;
440 }
441
442 if( m_sheetNames.count( aSheetID ) )
443 return m_sheetNames.at( aSheetID );
444 else
445 return aSheetID.AsString();
446}
447
448
449void PROJECT::SetRString( RSTRING_T aIndex, const wxString& aString )
450{
451 unsigned ndx = unsigned( aIndex );
452
453 if( ndx < m_rstrings.size() )
454 m_rstrings[ndx] = aString;
455 else
456 wxASSERT( 0 ); // bad index
457}
458
459
460const wxString& PROJECT::GetRString( RSTRING_T aIndex )
461{
462 unsigned ndx = unsigned( aIndex );
463
464 if( ndx < m_rstrings.size() )
465 {
466 return m_rstrings[ndx];
467 }
468 else
469 {
470 static wxString no_cookie_for_you;
471
472 wxASSERT( 0 ); // bad index
473
474 return no_cookie_for_you;
475 }
476}
477
478
480{
481 // This is virtual, so implement it out of line
482
483 if( static_cast<unsigned>( aIndex ) < m_elems.size() )
484 return m_elems[static_cast<unsigned>( aIndex )];
485
486 return nullptr;
487}
488
489
491{
492 // This is virtual, so implement it out of line
493 if( static_cast<unsigned>( aIndex ) < m_elems.size() )
494 {
495 delete m_elems[static_cast<unsigned>(aIndex)];
496 m_elems[static_cast<unsigned>( aIndex )] = aElem;
497 }
498}
499
500
501const wxString PROJECT::AbsolutePath( const wxString& aFileName ) const
502{
503 wxFileName fn = aFileName;
504
505 // Paths which start with an unresolved variable reference are more likely to be
506 // absolute than relative.
507 if( aFileName.StartsWith( wxT( "${" ) ) )
508 return aFileName;
509
510 if( !fn.IsAbsolute() )
511 {
512 wxString pro_dir = wxPathOnly( GetProjectFullName() );
513 fn.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS, pro_dir );
514 }
515
516 return fn.GetFullPath();
517}
518
519
525
526
528{
529 std::scoped_lock lock( m_designBlockLibsMutex );
530
532 std::optional<LIBRARY_MANAGER_ADAPTER*> adapter = mgr.Adapter( LIBRARY_TABLE_TYPE::DESIGN_BLOCK );
533
534 if( !adapter )
535 {
537 std::make_unique<DESIGN_BLOCK_LIBRARY_ADAPTER>( mgr ) );
538
539 std::optional<LIBRARY_MANAGER_ADAPTER*> created = mgr.Adapter( LIBRARY_TABLE_TYPE::DESIGN_BLOCK );
540 wxCHECK( created && ( *created )->Type() == LIBRARY_TABLE_TYPE::DESIGN_BLOCK, nullptr );
541 return static_cast<DESIGN_BLOCK_LIBRARY_ADAPTER*>( *created );
542 }
543
544 wxCHECK( ( *adapter )->Type() == LIBRARY_TABLE_TYPE::DESIGN_BLOCK, nullptr );
545 return static_cast<DESIGN_BLOCK_LIBRARY_ADAPTER*>( *adapter );
546}
547
548
550{
551 return m_project_lock.get();
552}
553
554
556{
557 m_project_lock.reset( aLockFile );
558}
559
560
561void PROJECT::SaveToHistory( const wxString& aProjectPath, std::vector<HISTORY_FILE_DATA>& aFileData )
562{
563 wxString projectFile = GetProjectFullName();
564
565 if( projectFile.IsEmpty() )
566 return;
567
568 wxFileName projectFn( projectFile );
569 wxFileName requestedDir = wxFileName::DirName( aProjectPath );
570 // wxPATH_NORM_ALL is now deprecated.
571 // So define a similar option
572 int norm_opt = wxPATH_NORM_ENV_VARS|wxPATH_NORM_DOTS|wxPATH_NORM_TILDE|wxPATH_NORM_ABSOLUTE
573 |wxPATH_NORM_LONG|wxPATH_NORM_SHORTCUT;
574
575 if( !projectFn.Normalize( norm_opt ) || !requestedDir.Normalize( norm_opt ) )
576 return;
577
578 // Savers are handed the project directory, not the project file
579 if( projectFn.GetPath() != requestedDir.GetPath() )
580 return;
581
582 HISTORY_FILE_DATA proEntry;
583 proEntry.relativePath = projectFn.GetFullName();
584
585 // Board Setup edits live only in RAM until a real save, so snapshot the live state.
586 if( m_projectFile )
587 proEntry.content = m_projectFile->SerializeToString();
588
589 if( proEntry.content.empty() )
590 proEntry.sourcePath = projectFile;
591
592 aFileData.push_back( std::move( proEntry ) );
593
594 // Board Setup writes the rules file and the table editors write the tables, so the disk copies are current
595 const wxString dir = projectFn.GetPath();
596 const wxString name = projectFn.GetName();
597
598 for( const wxFileName& file : { wxFileName( dir, name, FILEEXT::ProjectLocalSettingsFileExtension ),
599 wxFileName( dir, name, FILEEXT::DesignRulesFileExtension ),
601 wxFileName( dir, FILEEXT::SymbolLibraryTableFileName ) } )
602 {
603 HISTORY_FILE_DATA entry;
604 entry.relativePath = file.GetFullName();
605
606 if( file.FileExists() )
607 entry.sourcePath = file.GetFullPath();
608 else
609 entry.removed = true;
610
611 aFileData.push_back( std::move( entry ) );
612 }
613}
const char * name
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:216
@ 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:600
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition pgm_base.h:124
virtual LIBRARY_MANAGER & GetLibraryManager() const
Definition pgm_base.h:126
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:555
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:85
LOCKFILE * GetProjectLock() const
Definition project.cpp:549
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:271
virtual void SetElem(PROJECT::ELEM aIndex, _ELEM *aElem)
Definition project.cpp:490
virtual const wxString DesignBlockLibTblName() const
Return the path and file name of this projects design block library table.
Definition project.cpp:313
void PinLibrary(const wxString &aLibrary, enum LIB_TYPE_T aLibType)
Definition project.cpp:319
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:277
virtual const wxString GetProjectName() const
Return the short name of the project.
Definition project.cpp:289
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:301
virtual _ELEM * GetElem(PROJECT::ELEM aIndex)
Get and set the elements for this project.
Definition project.cpp:479
virtual ~PROJECT()
Definition project.cpp:78
virtual void ApplyTextVars(const std::map< wxString, wxString > &aVarsMap)
Applies the given var map, it will create or update existing vars.
Definition project.cpp:229
virtual bool AttachGitRepository()
Find the Git repository containing the project directory and bind it to the session.
Definition project.cpp:94
virtual void ReleaseGitCommon()
Safely release the session's repository handle and drop the session.
Definition project.cpp:166
virtual DESIGN_BLOCK_LIBRARY_ADAPTER * DesignBlockLibs()
Return the table of design block libraries.
Definition project.cpp:527
virtual bool TextVarResolver(wxString *aToken) const
Definition project.cpp:178
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:434
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:67
virtual const wxString FootprintLibTblName() const
Returns the path and filename of this project's footprint library table.
Definition project.cpp:307
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:449
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:520
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:501
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:561
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:356
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:389
virtual void setProjectFullName(const wxString &aFullPathAndName)
Set the full directory, basename, and extension of the project.
Definition project.cpp:244
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:283
virtual std::map< wxString, wxString > & GetTextVars() const
Definition project.cpp:223
PROJECT()
Definition project.cpp:55
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:460
virtual bool IsNullProject() const
Check if this project is a null project (i.e.
Definition project.cpp:295
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
static const std::string DesignRulesFileExtension
const wxChar *const tracePathsAndFiles
Flag to enable path and file name debug output.
Service::Type GetKifaceService(KIFACE *aKiface)
Look up a service exported by a KIFACE.
This file contains miscellaneous commonly used macros and functions.
APIEXPORT wxString PrivateKeyPath(const wxString &aPicked)
The private key for a path picked in a file dialog, which may be the key's .pub file.
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
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
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)
bool removed
The file no longer exists and leaves the snapshot.
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