Code::Blocks  SVN r11506
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
cbProject Class Reference

Represents a Code::Blocks project. More...

#include <cbproject.h>

Inheritance diagram for cbProject:
Collaboration diagram for cbProject:

Classes

struct  Glob
 

Public Member Functions

 cbProject (const wxString &filename=wxEmptyString)
 Constructor. More...
 
 ~cbProject () override
 Destructor. More...
 
bool IsLoaded () const
 
void ClearAllProperties ()
 This resets the project to a clear state. More...
 
void CalculateCommonTopLevelPath ()
 Calculates the top-level path common to all project files. More...
 
wxString GetCommonTopLevelPath () const
 
bool GetModified () const override
 
void SetModified (bool modified=true) override
 Mark the project as modified or not. More...
 
ProjectFileGetFile (int index)
 Access a file of the project. More...
 
ProjectFileGetFileByFilename (const wxString &filename, bool isRelative=true, bool isUnixFilename=false)
 Access a file of the project. More...
 
int GetFilesCount ()
 
void SetMakefile (const wxString &makefile)
 Set the Makefile filename used when exporting a Makefile for the project, or when using a custom Makefile to build the project. More...
 
const wxStringGetMakefile ()
 
void SetMakefileCustom (bool custom)
 Mark if the project should use a custom Makefile for compilation. More...
 
bool IsMakefileCustom ()
 
void SetMakefileExecutionDir (const wxString &dir)
 Allow the specification of specific execution directory if the project use a custom Makefile. More...
 
wxString GetMakefileExecutionDir ()
 
wxString GetExecutionDir ()
 
bool BuildTargetValid (const wxString &name, bool virtuals_too=true) const
 Is there a build target (virtual or real) by name? More...
 
wxString GetFirstValidBuildTargetName (bool virtuals_too=true) const
 
const wxStringGetDefaultExecuteTarget () const
 
void SetDefaultExecuteTarget (const wxString &name)
 Set the build target index which will be pre-selected when the "Select target" dialog appears when running the project. More...
 
int GetBuildTargetsCount ()
 
ProjectBuildTargetGetBuildTarget (int index)
 Access a build target. More...
 
ProjectBuildTargetGetBuildTarget (const wxString &targetName)
 Access a build target. More...
 
ProjectBuildTargetAddBuildTarget (const wxString &targetName)
 Add a new build target. More...
 
bool RenameBuildTarget (int index, const wxString &targetName)
 Rename a build target. More...
 
bool RenameBuildTarget (const wxString &oldTargetName, const wxString &newTargetName)
 Rename a build target. More...
 
ProjectBuildTargetDuplicateBuildTarget (int index, const wxString &newName=wxEmptyString)
 Duplicate a build target. More...
 
ProjectBuildTargetDuplicateBuildTarget (const wxString &targetName, const wxString &newName=wxEmptyString)
 Duplicate a build target. More...
 
bool ExportTargetAsProject (int index)
 Export a target as a new project. More...
 
bool ExportTargetAsProject (const wxString &targetName)
 Export a target as a new project. More...
 
bool RemoveBuildTarget (int index)
 Remove a build target. More...
 
bool RemoveBuildTarget (const wxString &targetName)
 Remove a build target. More...
 
void ReOrderTargets (const wxArrayString &nameOrder)
 Reorder the list of build targets. More...
 
bool SetActiveBuildTarget (const wxString &name)
 Set the active build target. More...
 
const wxStringGetActiveBuildTarget () const
 
PCHMode GetModeForPCH () const
 
void SetModeForPCH (PCHMode mode)
 Set the mode to handle precompiled headers. More...
 
void SetCompilerID (const wxString &id) override
 ! Set the flag if the host app should be run in terminal More...
 
wxTreeItemId GetProjectNode ()
 
void SetProjectNode (wxTreeItemId node)
 Sets the root item of this item, should not be called by user's code! More...
 
bool QueryCloseAllFiles ()
 Act like closing all project files, but don't do it. More...
 
bool CloseAllFiles (bool dontsave=false)
 Close all project files. More...
 
bool SaveAllFiles ()
 Save all project files. More...
 
bool Save ()
 Save the project. More...
 
bool SaveAs ()
 Save the project under a different name. More...
 
bool SaveLayout ()
 Save the project's layout. More...
 
bool LoadLayout ()
 Load the project's layout. More...
 
void BeginAddFiles ()
 Notify that file(s) will be added shortly. More...
 
void EndAddFiles ()
 Notify that file(s) addition finished. More...
 
void BeginRemoveFiles ()
 Notify that file(s) will be removed shortly. More...
 
void EndRemoveFiles ()
 Notify that file(s) removal finished. More...
 
ProjectFileAddFile (const wxString &targetName, const wxString &filename, bool compile=true, bool link=true, unsigned short int weight=50)
 Add a file to the project. More...
 
ProjectFileAddFile (int targetIndex, const wxString &filename, bool compile=true, bool link=true, unsigned short int weight=50)
 Add a file to the project. More...
 
bool RemoveFile (ProjectFile *pf)
 Remove a file from the project. More...
 
void SetGlobs (const std::vector< Glob > &globs)
 Set the globs to the project, this are directory paths do retrieve files from to be added to the project, the path can be searched recursively. More...
 
std::vector< GlobGetGlobs () const
 Retrieve the current globs from the project. More...
 
const wxArrayStringExpandedNodes ()
 Convenience function for remembering the project's tree state when refreshing it. More...
 
void AddExpandedNode (const wxString &path)
 Convenience function for remembering the project's tree state when refreshing it. More...
 
void SaveTreeState (wxTreeCtrl *tree)
 Convenience function for remembering the project's tree state when refreshing it. More...
 
void RestoreTreeState (wxTreeCtrl *tree)
 Convenience function for remembering the project's tree state when refreshing it. More...
 
int SelectTarget (int initial=-1, bool evenIfOne=false)
 Displays a target selection dialog. More...
 
ProjectBuildTargetGetCurrentlyCompilingTarget ()
 Get a pointer to the currently compiling target. More...
 
void SetCurrentlyCompilingTarget (ProjectBuildTarget *bt)
 Set the currently compiling target. More...
 
bool DefineVirtualBuildTarget (const wxString &alias, const wxArrayString &targets)
 Define a new virtual build target. More...
 
bool HasVirtualBuildTarget (const wxString &alias) const
 Does a virtual build target exist? More...
 
bool RemoveVirtualBuildTarget (const wxString &alias)
 Remove a virtual build target. More...
 
wxArrayString GetVirtualBuildTargets () const
 Get a list of all defined virtual build targets. More...
 
const wxArrayStringGetVirtualBuildTargetGroup (const wxString &alias) const
 Access a virtual build target's group of build targets. More...
 
wxArrayString GetExpandedVirtualBuildTargetGroup (const wxString &alias) const
 Access a virtual build target's expanded group of build targets. More...
 
bool CanAddToVirtualBuildTarget (const wxString &alias, const wxString &target)
 Checks if a build target (virtual or real) can be added to a virtual build target, without causing a circular-reference. More...
 
const wxArrayStringGetVirtualFolders () const
 Get a list of the virtual folders. More...
 
void SetVirtualFolders (const wxArrayString &folders)
 Set the virtual folders list. More...
 
bool AppendUniqueVirtualFolder (const wxString &folder)
 Appends a new virtual folder to the end of the list only if it doesn't exists. More...
 
void RemoveVirtualFolders (const wxString &folder)
 Remove all virtual folders starting with folder. More...
 
void ReplaceVirtualFolder (const wxString &oldFolder, const wxString &newFolder)
 Replaced the oldFolder with newFolder or appends newFolder to the end of the list if oldFolder is not found. More...
 
wxDateTime GetLastModificationTime () const
 Returns the last modification time for the file. More...
 
void Touch ()
 Sets the last modification time for the project to 'now'. More...
 
void SetExtendedObjectNamesGeneration (bool ext)
 Sets object names generation to extended/normal mode. More...
 
bool GetExtendedObjectNamesGeneration () const
 Gets object names generation mode (extended/normal). More...
 
void SetNotes (const wxString &notes)
 Set notes on the project. More...
 
const wxStringGetNotes () const
 Get notes on the project. More...
 
void SetShowNotesOnLoad (bool show)
 Set show project notes on load automatically. More...
 
bool GetShowNotesOnLoad () const
 Get show project notes on load automatically. More...
 
void SetCheckForExternallyModifiedFiles (bool check)
 Set check for externally modified files. More...
 
bool GetCheckForExternallyModifiedFiles () const
 Get check for externally modified files. More...
 
void ShowNotes (bool nonEmptyOnly, bool editable=false)
 Show project notes now. More...
 
void SetTitle (const wxString &title) override
 Changes project title. More...
 
virtual TiXmlNode * GetExtensionsNode ()
 Access the <Extensions> XML node of this project. More...
 
virtual void AddToExtensions (const wxString &stringDesc)
 Convenience function (mainly for scripts) to add nodes/attributes under the <Extensions> node. More...
 
virtual void ProjectFileRenamed (ProjectFile *pf)
 Internal use only. More...
 
virtual FilesList & GetFilesList ()
 Provides an easy way to iterate all the files belonging in this target. More...
 
- Public Member Functions inherited from CompileTargetBase
 CompileTargetBase ()
 
 ~CompileTargetBase () override
 
virtual void SetTargetFilenameGenerationPolicy (TargetFilenameGenerationPolicy prefix, TargetFilenameGenerationPolicy extension)
 A target's filename can either be auto-generated based on the running platform, or completely specified by the user. More...
 
virtual void GetTargetFilenameGenerationPolicy (TargetFilenameGenerationPolicy &prefixOut, TargetFilenameGenerationPolicy &extensionOut) const
 
virtual const wxStringGetFilename () const
 
virtual const wxStringGetTitle () const
 Read the target's title. More...
 
virtual void SetOutputFilename (const wxString &filename)
 Set the target's output filename. More...
 
virtual void SetImportLibraryFilename (const wxString &filename)
 Set the target's import library filename. More...
 
virtual void SetDefinitionFileFilename (const wxString &filename)
 Set the target's definition file filename. More...
 
virtual void SetWorkingDir (const wxString &dirname)
 Set the target's working dir on execution (valid only for executable targets) More...
 
virtual void SetObjectOutput (const wxString &dirname)
 Set the target's objects output dir. More...
 
virtual void SetDepsOutput (const wxString &dirname)
 Set the target's dependencies output dir. More...
 
virtual OptionsRelation GetOptionRelation (OptionsRelationType type) const
 Read the target's options relation for type. More...
 
virtual void SetOptionRelation (OptionsRelationType type, OptionsRelation rel)
 Set the target's options relation for type to rel. More...
 
virtual wxString GetWorkingDir ()
 Read the target's working dir for execution (valid only for executable targets) More...
 
virtual wxString GetObjectOutput () const
 Read the target's objects output dir. More...
 
virtual wxString GetDepsOutput () const
 Read the target's dependencies output dir. More...
 
virtual wxString GetOutputFilename ()
 Read the target's output filename. More...
 
virtual wxString SuggestOutputFilename ()
 Suggest a filename based on the target's type. More...
 
virtual wxString GetExecutableFilename () const
 Read the target's executable filename (produced if target type is ttExecutable) More...
 
virtual wxString GetDynamicLibFilename ()
 Read the target's dynamic library filename (produced if target type is ttDynamicLib) More...
 
virtual wxString GetDynamicLibImportFilename ()
 Read the target's dynamic library import filename (produced if target type is ttDynamicLib) More...
 
virtual wxString GetDynamicLibDefFilename ()
 Read the target's dynamic library definition file filename (produced if target type is ttDynamicLib) More...
 
virtual wxString GetStaticLibFilename ()
 Read the target's static library filename (produced if target type is ttStaticLib) More...
 
virtual wxString GetNativeFilename ()
 Read the target's native filename (produced if target type is ttNative) More...
 
virtual wxString GetBasePath () const
 Read the target's base path, e.g. if GetFilename() returns "/usr/local/bin/xxx", base path will return "/usr/local/bin". More...
 
virtual void SetTargetType (TargetType pt)
 Set the target's type to pt. More...
 
virtual TargetType GetTargetType () const
 Read the target's type. More...
 
virtual const wxStringGetExecutionParameters () const
 Read the target's execution parameters. More...
 
virtual void SetExecutionParameters (const wxString &params)
 Set the target's execution parameters to params. More...
 
virtual const wxStringGetHostApplication () const
 Read the target's host application. More...
 
virtual void SetHostApplication (const wxString &app)
 Set the target's host application to app. More...
 
virtual bool GetRunHostApplicationInTerminal () const
 Get the flag if the host app should be run in terminal. More...
 
virtual void SetRunHostApplicationInTerminal (bool in_terminal)
 
virtual const wxStringGetCompilerID () const
 Read the target's compiler. More...
 
virtual wxString GetMakeCommandFor (MakeCommand cmd) const
 Get the "make" command used for cmd. More...
 
virtual void SetMakeCommandFor (MakeCommand cmd, const wxString &make)
 Set the "make" command used for cmd. More...
 
virtual bool MakeCommandsModified () const
 True if any of the "make" commands is modified. More...
 
- Public Member Functions inherited from CompileOptionsBase
 CompileOptionsBase ()
 
virtual ~CompileOptionsBase ()
 
virtual void AddPlatform (int platform)
 
virtual void RemovePlatform (int platform)
 
virtual void SetPlatforms (int platforms)
 
virtual int GetPlatforms () const
 
virtual bool SupportsCurrentPlatform () const
 
virtual void SetLinkerOptions (const wxArrayString &linkerOpts)
 
virtual const wxArrayStringGetLinkerOptions () const
 
virtual void AddLinkerOption (const wxString &option)
 
virtual void ReplaceLinkerOption (const wxString &option, const wxString &new_option)
 
virtual void RemoveLinkerOption (const wxString &option)
 
virtual void SetLinkLibs (const wxArrayString &linkLibs)
 
virtual const wxArrayStringGetLinkLibs () const
 
virtual void AddLinkLib (const wxString &option)
 
virtual void ReplaceLinkLib (const wxString &option, const wxString &new_option)
 
virtual void RemoveLinkLib (const wxString &option)
 
virtual void SetCompilerOptions (const wxArrayString &compilerOpts)
 
virtual const wxArrayStringGetCompilerOptions () const
 
virtual void AddCompilerOption (const wxString &option)
 
virtual void ReplaceCompilerOption (const wxString &option, const wxString &new_option)
 
virtual void RemoveCompilerOption (const wxString &option)
 
virtual void SetResourceCompilerOptions (const wxArrayString &resourceCompilerOpts)
 
virtual const wxArrayStringGetResourceCompilerOptions () const
 
virtual void AddResourceCompilerOption (const wxString &option)
 
virtual void ReplaceResourceCompilerOption (const wxString &option, const wxString &new_option)
 
virtual void RemoveResourceCompilerOption (const wxString &option)
 
virtual void SetIncludeDirs (const wxArrayString &includeDirs)
 
virtual const wxArrayStringGetIncludeDirs () const
 
virtual void AddIncludeDir (const wxString &option)
 
virtual void ReplaceIncludeDir (const wxString &option, const wxString &new_option)
 
virtual void RemoveIncludeDir (const wxString &option)
 
virtual void SetResourceIncludeDirs (const wxArrayString &resIncludeDirs)
 
virtual const wxArrayStringGetResourceIncludeDirs () const
 
virtual void AddResourceIncludeDir (const wxString &option)
 
virtual void ReplaceResourceIncludeDir (const wxString &option, const wxString &new_option)
 
virtual void RemoveResourceIncludeDir (const wxString &option)
 
virtual void SetLibDirs (const wxArrayString &libDirs)
 
virtual const wxArrayStringGetLibDirs () const
 
virtual void AddLibDir (const wxString &option)
 
virtual void ReplaceLibDir (const wxString &option, const wxString &new_option)
 
virtual void RemoveLibDir (const wxString &option)
 
virtual void SetCommandsBeforeBuild (const wxArrayString &commands)
 
virtual const wxArrayStringGetCommandsBeforeBuild () const
 
virtual void AddCommandsBeforeBuild (const wxString &command)
 
virtual void RemoveCommandsBeforeBuild (const wxString &command)
 
virtual void SetCommandsAfterBuild (const wxArrayString &commands)
 
virtual const wxArrayStringGetCommandsAfterBuild () const
 
virtual void AddCommandsAfterBuild (const wxString &command)
 
virtual void RemoveCommandsAfterBuild (const wxString &command)
 
virtual void SetBuildScripts (const wxArrayString &scripts)
 
virtual const wxArrayStringGetBuildScripts () const
 
virtual void AddBuildScript (const wxString &script)
 
virtual void RemoveBuildScript (const wxString &script)
 
virtual bool GetAlwaysRunPostBuildSteps () const
 
virtual void SetAlwaysRunPostBuildSteps (bool always)
 
virtual bool SetVar (const wxString &key, const wxString &value, bool onlyIfExists=false)
 
virtual bool UnsetVar (const wxString &key)
 
virtual void UnsetAllVars ()
 
virtual bool HasVar (const wxString &key) const
 
virtual const wxStringGetVar (const wxString &key) const
 
virtual const StringHash & GetAllVars () const
 

Private Member Functions

void Open ()
 
void ExpandVirtualBuildTargetGroup (const wxString &alias, wxArrayString &result) const
 
ProjectBuildTargetAddDefaultBuildTarget ()
 
int IndexOfBuildTargetName (const wxString &targetName) const
 
wxString CreateUniqueFilename ()
 
void NotifyPlugins (wxEventType type, const wxString &targetName=wxEmptyString, const wxString &oldTargetName=wxEmptyString)
 

Private Attributes

VirtualBuildTargetsMap m_VirtualTargets
 
BuildTargets m_Targets
 
wxString m_ActiveTarget
 
wxString m_LastSavedActiveTarget
 
wxString m_DefaultExecuteTarget
 
wxString m_Makefile
 
bool m_CustomMakefile
 
wxString m_MakefileExecutionDir
 
std::vector< Globm_Globs
 
FilesList m_Files
 
ProjectFileArray m_FileArray
 
wxArrayString m_ExpandedNodes
 
wxArrayString m_SelectedNodes
 
bool m_Loaded
 
wxTreeItemId m_ProjectNode
 
wxArrayString m_VirtualFolders
 
bool m_CurrentlyLoading
 
wxString m_CommonTopLevelPath
 
wxString m_BasePath
 
PCHMode m_PCHMode
 
ProjectFiles m_ProjectFilesMap
 
ProjectBuildTargetm_CurrentlyCompilingTarget
 
wxDateTime m_LastModified
 
bool m_ExtendedObjectNamesGeneration
 
wxString m_Notes
 
bool m_AutoShowNotesOnLoad
 
bool m_CheckForExternallyModifiedFiles
 
TiXmlElement * m_pExtensionsElement
 

Additional Inherited Members

- Protected Attributes inherited from CompileTargetBase
wxString m_Filename
 
wxString m_Title
 
wxString m_OutputFilename
 
wxString m_ImportLibraryFilename
 
wxString m_DefinitionFileFilename
 
wxString m_WorkingDir
 
wxString m_ObjectOutput
 
wxString m_DepsOutput
 
wxString m_ExecutionParameters
 
wxString m_HostApplication
 
OptionsRelation m_OptionsRelation [ortLast]
 
TargetType m_TargetType
 
wxString m_CompilerId
 
wxString m_MakeCommands [mcLast]
 
bool m_MakeCommandsModified
 
bool m_RunHostApplicationInTerminal
 
TargetFilenameGenerationPolicy m_PrefixGenerationPolicy
 
TargetFilenameGenerationPolicy m_ExtensionGenerationPolicy
 
- Protected Attributes inherited from CompileOptionsBase
int m_Platform
 
wxArrayString m_LinkerOptions
 
wxArrayString m_LinkLibs
 
wxArrayString m_CompilerOptions
 
wxArrayString m_ResourceCompilerOptions
 
wxArrayString m_IncludeDirs
 
wxArrayString m_ResIncludeDirs
 
wxArrayString m_LibDirs
 
wxArrayString m_CmdsBefore
 
wxArrayString m_CmdsAfter
 
wxArrayString m_Scripts
 
bool m_Modified
 
bool m_AlwaysRunPostCmds
 
StringHash m_Vars
 

Detailed Description

Represents a Code::Blocks project.

A project is a collection of build targets and files. Each project can contain any number of build targets and files.

See also
ProjectBuildTarget, ProjectFile.

Definition at line 96 of file cbproject.h.

Constructor & Destructor Documentation

◆ cbProject()

cbProject::cbProject ( const wxString filename = wxEmptyString)

◆ ~cbProject()

cbProject::~cbProject ( )
override

Destructor.

Definition at line 111 of file cbproject.cpp.

References ClearAllProperties().

Member Function Documentation

◆ AddBuildTarget()

ProjectBuildTarget * cbProject::AddBuildTarget ( const wxString targetName)

◆ AddDefaultBuildTarget()

ProjectBuildTarget * cbProject::AddDefaultBuildTarget ( )
private

Definition at line 1145 of file cbproject.cpp.

References _T, and AddBuildTarget().

Referenced by AddFile(), Open(), and SaveAs().

◆ AddExpandedNode()

void cbProject::AddExpandedNode ( const wxString path)
inline

Convenience function for remembering the project's tree state when refreshing it.

Adds an expanded node in this internal list.

Parameters
pathThe tree-path to add.

Definition at line 451 of file cbproject.h.

References RestoreTreeState(), and SaveTreeState().

◆ AddFile() [1/2]

ProjectFile * cbProject::AddFile ( const wxString targetName,
const wxString filename,
bool  compile = true,
bool  link = true,
unsigned short int  weight = 50 
)

Add a file to the project.

This variation, takes a target name as first parameter.

Parameters
targetNameThe name of the build target to add this file to.
filenameThe file's filename. This must be a filename relative to the project's path.
compileIf true this file is compiled when building the project.
linkIf true this file is linked when building the project.
weightA value between zero and 100 (defaults to 50). Smaller weight, makes the file compile earlier than those with larger weight.
Returns
The newly added file or NULL if something went wrong.

Definition at line 621 of file cbproject.cpp.

References _T, wxFile::Access(), ProjectFile::AddBuildTarget(), AddDefaultBuildTarget(), wxFileName::Assign(), FileFilters::C_EXT, wxString::c_str(), CalculateCommonTopLevelPath(), ProjectFile::compile, ProjectFile::compilerVar, ctCompileObjectCmd, ctCompileResourceCmd, LogManager::DebugLog(), ProjectFile::file, FileTypeOf(), ftObject, ftResource, ftResourceBin, ftSource, ftStaticLib, fvsMissing, fvsReadOnly, ProjectFile::generatedFiles, CompilerTool::generatedFiles, Manager::Get(), CompileTargetBase::GetBasePath(), wxString::GetChar(), CompilerFactory::GetCompiler(), CompileTargetBase::GetCompilerID(), Compiler::GetCompilerTool(), wxArrayString::GetCount(), wxFileName::GetExt(), GetFileByFilename(), wxFileName::GetFullName(), wxFileName::GetFullPath(), Manager::GetLogManager(), Manager::GetMacrosManager(), wxFileName::GetName(), wxFileName::GetPath(), wxFileName::GetVolume(), IndexOfBuildTargetName(), wxFileName::IsAbsolute(), wxString::IsSameAs(), wxString::Length(), ProjectFile::link, m_CommonTopLevelPath, m_CurrentlyLoading, m_FileArray, CompileTargetBase::m_Filename, m_Files, m_ProjectFilesMap, m_Targets, wxFileName::MakeRelativeTo(), wxFileName::Normalize(), realpath(), ProjectFile::relativeFilename, ProjectFile::relativeToCommonTopLevelPath, wxString::Replace(), MacrosManager::ReplaceMacros(), FileFilters::RESOURCE_EXT, wxString::Right(), ProjectFile::SetAutoGeneratedBy(), ProjectFile::SetFileState(), wxFileName::SetFullName(), SetModified(), wxString::StartsWith(), UnixFilename(), wxFile::write, wxFileExists(), wxPATH_NORM_DOTS, and wxPATH_NORM_TILDE.

Referenced by ScriptBindings::cbProject_AddFile(), ProjectManager::DoAddFileToProject(), and ProjectLoader::DoUnits().

◆ AddFile() [2/2]

ProjectFile* cbProject::AddFile ( int  targetIndex,
const wxString filename,
bool  compile = true,
bool  link = true,
unsigned short int  weight = 50 
)

Add a file to the project.

This variation, takes a target index as first parameter.

Parameters
targetIndexThe index of the build target to add this file to.
filenameThe file's filename. This must be a filename relative to the project's path.
compileIf true this file is compiled when building the project.
linkIf true this file is linked when building the project.
weightA value between zero and 100 (defaults to 50). Smaller weight, makes the file compile earlier than those with larger weight.
Returns
The newly added file or NULL if something went wrong.

◆ AddToExtensions()

void cbProject::AddToExtensions ( const wxString stringDesc)
virtual

Convenience function (mainly for scripts) to add nodes/attributes under the <Extensions> node.

It is mainly useful for scripts that can't otherwise access the XML node. For C++ code, using GetExtensionsNode() is recommended instead (which is much faster).

Parameters
stringDescA string representation of the nodes/attributes to add/edit under <Extensions>. stringDesc is a string of the form: "node/subnode/.../+subnode:attr=val"

The ":attr=val" part is optional. The node/subnode structure will be created if not there. To set more than one attribute, call this function more than once, using the same node/subnode structure. If a node begins with the "plus" sign (+), then this forces adding a new node instead of re-using the existing one (if any).

Definition at line 1666 of file cbproject.cpp.

References _T, cbU2C(), wxString::GetChar(), GetExtensionsNode(), wxString::IsEmpty(), wxString::Length(), wxString::Mid(), wxString::Remove(), and SetModified().

Referenced by ScriptBindings::RegisterBindings().

◆ AppendUniqueVirtualFolder()

bool cbProject::AppendUniqueVirtualFolder ( const wxString folder)

Appends a new virtual folder to the end of the list only if it doesn't exists.

Returns
True if folder has been appended, false if not.

Definition at line 913 of file cbproject.cpp.

References wxArrayString::Index(), m_VirtualFolders, and wxNOT_FOUND.

Referenced by ProjectManagerUI::BuildProjectTree(), and ProjectManagerUI::CheckForExternallyModifiedProjects().

◆ BeginAddFiles()

void cbProject::BeginAddFiles ( )

Notify that file(s) will be added shortly.

This function should be called before calling AddFile(). When done calling AddFile() as many times as needed, call EndAddFiles().

This sequence of function calls ensures proper events dispatching. This function broadcasts the cbEVT_PROJECT_BEGIN_ADD_FILES event.

Definition at line 593 of file cbproject.cpp.

References cbEVT_PROJECT_BEGIN_ADD_FILES, Manager::Get(), and Manager::ProcessEvent().

Referenced by ProjectManager::AddMultipleFilesToProject(), Wiz::CopyFiles(), ProjectLoader::DoUnits(), and Wiz::RunProjectWizard().

◆ BeginRemoveFiles()

void cbProject::BeginRemoveFiles ( )

Notify that file(s) will be removed shortly.

This function should be called before calling RemoveFile(). When done calling RemoveFile() as many times as needed, call EndRemoveFiles().

This sequence of function calls ensures proper events dispatching. This function broadcasts the cbEVT_PROJECT_BEGIN_REMOVE_FILES event.

Definition at line 607 of file cbproject.cpp.

References cbEVT_PROJECT_BEGIN_REMOVE_FILES, Manager::Get(), and Manager::ProcessEvent().

Referenced by ProjectManagerUI::OnRemoveFileFromProject().

◆ BuildTargetValid()

bool cbProject::BuildTargetValid ( const wxString name,
bool  virtuals_too = true 
) const

Is there a build target (virtual or real) by name?

Parameters
nameThe build target's name.
virtuals_tooInclude virtual build targets in query.
Returns
True if exists a build target (virtual or real) by that name, false if not.

Definition at line 1335 of file cbproject.cpp.

References HasVirtualBuildTarget(), and IndexOfBuildTargetName().

Referenced by DebuggerGDB::DoDebug(), DebuggerManager::FindTargetsDebugger(), ScriptBindings::RegisterBindings(), and SetActiveBuildTarget().

◆ CalculateCommonTopLevelPath()

void cbProject::CalculateCommonTopLevelPath ( )

◆ CanAddToVirtualBuildTarget()

bool cbProject::CanAddToVirtualBuildTarget ( const wxString alias,
const wxString target 
)

Checks if a build target (virtual or real) can be added to a virtual build target, without causing a circular-reference.

Parameters
aliasThe "parent" virtual build target to add the build target in.
targetThe build target to add in the alias virtual build target.
Returns
True if a circular reference is not detected, false if it is.

Definition at line 1519 of file cbproject.cpp.

References wxArrayString::GetCount(), GetVirtualBuildTargetGroup(), HasVirtualBuildTarget(), wxArrayString::Index(), and wxNOT_FOUND.

Referenced by ScriptBindings::RegisterBindings().

◆ ClearAllProperties()

void cbProject::ClearAllProperties ( )

◆ CloseAllFiles()

bool cbProject::CloseAllFiles ( bool  dontsave = false)

Close all project files.

Parameters
dontsaveIf true, no project file will be saved even if modified. If false, any modified file will be saved (default).
Returns
True if successful, false otherwise.

Definition at line 1094 of file cbproject.cpp.

References EditorManager::Close(), ProjectFile::file, Manager::Get(), Manager::GetEditorManager(), wxFileName::GetFullPath(), EditorManager::HideNotebook(), m_FileArray, m_Files, QueryCloseAllFiles(), and EditorManager::ShowNotebook().

Referenced by ProjectManager::CloseProject(), and ScriptBindings::RegisterBindings().

◆ CreateUniqueFilename()

wxString cbProject::CreateUniqueFilename ( )
private

◆ DefineVirtualBuildTarget()

bool cbProject::DefineVirtualBuildTarget ( const wxString alias,
const wxArrayString targets 
)

Define a new virtual build target.

A virtual build target is not really a build target itself but it is an alias for a group of other build targets, real or virtual. An example is the "All" virtual build target which means "all build targets".

Parameters
aliasThe virtual build target's name.
targetsA list of build target names to include in this virtual build target. They can be real or other virtual build targets.
Returns
True for success, false for failure. The only reason for this function to return false is if a real build target exists with the same name as alias (or if you pass an empty targets array).
Note
Every time you call this function with the same alias parameter, the virtual build target is re-defined. In other words, it's not an error if alias is already defined.

Definition at line 1449 of file cbproject.cpp.

References _T, cbEVT_PROJECT_TARGETS_MODIFIED, F(), Manager::Get(), GetBuildTarget(), wxArrayString::GetCount(), Manager::GetLogManager(), LogManager::LogWarning(), m_VirtualTargets, NotifyPlugins(), SetModified(), and wxString::wx_str().

Referenced by ProjectLoader::DoVirtualTargets(), ProjectLoader::Open(), ScriptBindings::RegisterBindings(), and VirtualBuildTargetsDlg::SetVirtualTarget().

◆ DuplicateBuildTarget() [1/2]

ProjectBuildTarget * cbProject::DuplicateBuildTarget ( int  index,
const wxString newName = wxEmptyString 
)

Duplicate a build target.

Parameters
indexThe index of the build target to duplicate.
newNameThe name for the new build target. If empty, it will be named like "Copy of <base_target_name>".
Returns
The new build target if index was valid, NULL if not (or something went wrong).

Definition at line 1216 of file cbproject.cpp.

References _(), ProjectFile::AddBuildTarget(), cbEVT_BUILDTARGET_ADDED, cbEVT_PROJECT_TARGETS_MODIFIED, GetBuildTarget(), ProjectBuildTarget::GetFilesList(), CompileTargetBase::GetTitle(), wxString::IsEmpty(), m_Targets, NotifyPlugins(), SetModified(), and CompileTargetBase::SetTitle().

Referenced by ScriptBindings::cbProject_DuplicateBuildTarget(), DuplicateBuildTarget(), and ProjectOptionsDlg::OnCopyBuildTargetClick().

◆ DuplicateBuildTarget() [2/2]

ProjectBuildTarget * cbProject::DuplicateBuildTarget ( const wxString targetName,
const wxString newName = wxEmptyString 
)

Duplicate a build target.

Parameters
targetNameThe name of the build target to duplicate.
newNameThe name for the new build target. If empty, it will be named like "Copy of <base_target_name>".
Returns
The new build target if index was valid, NULL if not (or something went wrong).

Definition at line 1241 of file cbproject.cpp.

References DuplicateBuildTarget(), and IndexOfBuildTargetName().

◆ EndAddFiles()

void cbProject::EndAddFiles ( )

Notify that file(s) addition finished.

This function should be called when done calling AddFile() as many times as needed.

This sequence of function calls ensures proper events dispatching. This function broadcasts the cbEVT_PROJECT_END_ADD_FILES event.

See also
BeginAddFiles().

Definition at line 600 of file cbproject.cpp.

References cbEVT_PROJECT_END_ADD_FILES, Manager::Get(), and Manager::ProcessEvent().

Referenced by ProjectManager::AddMultipleFilesToProject(), Wiz::CopyFiles(), ProjectLoader::DoUnits(), and Wiz::RunProjectWizard().

◆ EndRemoveFiles()

void cbProject::EndRemoveFiles ( )

Notify that file(s) removal finished.

This function should be called when done calling RemoveFile() as many times as needed.

This sequence of function calls ensures proper events dispatching. This function broadcasts the cbEVT_PROJECT_END_REMOVE_FILES event.

See also
BeginRemoveFiles().

Definition at line 614 of file cbproject.cpp.

References cbEVT_PROJECT_END_REMOVE_FILES, Manager::Get(), and Manager::ProcessEvent().

Referenced by ProjectManagerUI::OnRemoveFileFromProject().

◆ ExpandedNodes()

const wxArrayString& cbProject::ExpandedNodes ( )
inline

Convenience function for remembering the project's tree state when refreshing it.

Returns
An array of strings containing the tree-path names of expanded nodes.

Definition at line 445 of file cbproject.h.

Referenced by ProjectLayoutLoader::Save().

◆ ExpandVirtualBuildTargetGroup()

void cbProject::ExpandVirtualBuildTargetGroup ( const wxString alias,
wxArrayString result 
) const
private

◆ ExportTargetAsProject() [1/2]

bool cbProject::ExportTargetAsProject ( int  index)

Export a target as a new project.

In other words, save a copy of the project containing only the specified target. The user will be prompted with a dialog to select the new project name.

Parameters
indexThe index of the build target to export.
Returns
True on success, false on failure (or dialog cancellation).
Note
The dialog to select the new project name is not a file dialog because the user is not allowed to save anywhere. The new project must remain "operational" (assuming the target to export, was "operational") so the new project must be saved in the same directory as the original to preserve relative paths.

Definition at line 1246 of file cbproject.cpp.

References GetBuildTarget(), and CompileTargetBase::GetTitle().

Referenced by ScriptBindings::cbProject_ExportTargetAsProject(), and ProjectOptionsDlg::OnExportTargetClick().

◆ ExportTargetAsProject() [2/2]

bool cbProject::ExportTargetAsProject ( const wxString targetName)

Export a target as a new project.

In other words, save a copy of the project containing only the specified target. The user will be prompted with a dialog to select the new project name.

Parameters
targetNameThe name of the build target to export.
Returns
True on success, false on failure (or dialog cancellation).
See also
ExportTargetAsProject(int).

Definition at line 1254 of file cbproject.cpp.

References _(), cbGetTextFromUser(), ProjectLoader::ExportTargetAsProject(), GetBuildTarget(), CompileTargetBase::GetFilename(), wxFileName::GetFullPath(), GetModified(), CompileTargetBase::GetTitle(), wxString::IsEmpty(), m_pExtensionsElement, Save(), SetModified(), wxFileName::SetName(), and SetTitle().

◆ GetActiveBuildTarget()

const wxString & cbProject::GetActiveBuildTarget ( ) const

◆ GetBuildTarget() [1/2]

ProjectBuildTarget * cbProject::GetBuildTarget ( int  index)

Access a build target.

Parameters
indexThe build target index. Must be greater or equal to zero and less than GetBuildTargetsCount().
Returns
The build target or NULL if not found.

Definition at line 1392 of file cbproject.cpp.

References m_Targets.

Referenced by ProjectFile::AddBuildTarget(), AddBuildTarget(), NativeParser::AddCompilerDirs(), NativeParser::AddProjectDefinedMacros(), ProjectManagerUI::AskForBuildTargetIndex(), ProjectManagerUI::AskForMultiBuildTargetIndex(), CodeBlocksApp::BatchJob(), ProjectOptionsDlg::BuildScriptsTree(), ScriptBindings::cbProject_GetBuildTarget(), VirtualBuildTargetsDlg::CheckTargets(), EditorManager::CollectDefines(), CompilerOptionsDlg::CompilerOptionsDlg(), ProjectLoader::ConvertVersion_Pre_1_1(), DefineVirtualBuildTarget(), ProjectManager::DoAddFileToProject(), ProjectOptionsDlg::DoBeforeTargetChange(), CompilerGCC::DoBuild(), DebuggerGDB::DoDebug(), CompilerOptionsDlg::DoFillTree(), ProjectOptionsDlg::DoTargetChange(), ProjectLoader::DoUnitOptions(), DuplicateBuildTarget(), CompilerGCC::ExpandTargets(), ProjectLoader::ExportTargetAsProject(), ExportTargetAsProject(), FilePathPanel::FilePathPanel(), ProjectOptionsDlg::FillBuildTargets(), ProjectOptionsDlg::FillScripts(), FindReplace::FindInFiles(), FindReplaceDlg::FindReplaceDlg(), DebuggerManager::FindTargetsDebugger(), GetBuildTarget(), DirectCommands::GetCleanCommands(), DirectCommands::GetCompileCommands(), NativeParser::GetCompilerStandardGCC(), DirectCommands::GetLinkCommands(), FindReplaceDlg::GetTarget(), CompilerGCC::GetTargetIndexFromName(), CompilerCommandGenerator::Init(), CompilerGCC::IsValidTarget(), DebuggerOptionsProjectDlg::LoadCurrentRemoteDebuggingRecord(), TemplateManager::NewProjectFromUserTemplate(), VirtualBuildTargetsDlg::OnAddClick(), ProjectOptionsDlg::OnAddScript(), ProjectOptionsDlg::OnBuildOrderClick(), DebuggerOptionsProjectDlg::OnBuildTargetAdded(), DebuggerOptionsProjectDlg::OnBuildTargetRemoved(), ProjectOptionsDlg::OnCheckScripts(), CompilerGCC::OnCompileFileRequest(), ProjectOptionsDlg::OnCopyBuildTargetClick(), CompilerOptionsDlg::OnCopyDirsClick(), CompilerOptionsDlg::OnCopyLibsClick(), ProjectOptionsDlg::OnCreateDefFileClick(), ProjectOptionsDlg::OnCreateImportFileClick(), ProjectOptionsDlg::OnEditBuildTargetClick(), VirtualBuildTargetsDlg::OnEditClick(), ProjectOptionsDlg::OnEditDepsClick(), ProjectOptionsDlg::OnExportTargetClick(), ProjectOptionsDlg::OnFileMarkOffClick(), ProjectOptionsDlg::OnFileMarkOnClick(), ProjectOptionsDlg::OnFileToggleMarkClick(), WizBuildTargetPanel::OnPageChanging(), CompilerGCC::OnProjectCompilerOptions(), DebuggerGDB::OnProjectLoadingHook(), ProjectOptionsDlg::OnProjectTypeChanged(), ProjectOptionsDlg::OnRemoveScript(), ProjectOptionsDlg::OnScriptMoveDown(), ProjectOptionsDlg::OnScriptMoveUp(), FindReplaceDlg::OnSearchProject(), FindReplaceDlg::OnSelectTarget(), ProjectOptionsDlg::OnTargetBuildOptionsClick(), ProjectLoader::Open(), CompilerGCC::PreprocessJob(), ProjectFileOptionsDlg::ProjectFileOptionsDlg(), MacrosManager::RecalcVars(), ProjectFile::RemoveBuildTarget(), RemoveBuildTarget(), RenameBuildTarget(), ReOrderTargets(), FindReplace::ReplaceInFiles(), MacrosManager::ReplaceMacros(), DebuggerOptionsProjectDlg::SaveCurrentRemoteDebuggingRecord(), EditorManager::SwapActiveHeaderSource(), CompilerOptionsDlg::UpdateCompilerForTargets(), ProjectFile::UpdateFileDetails(), CompilerGCC::UpdateProjectTargets(), and ProjectOptionsDlg::ValidateTargetName().

◆ GetBuildTarget() [2/2]

ProjectBuildTarget * cbProject::GetBuildTarget ( const wxString targetName)

Access a build target.

Parameters
targetNameThe build target name.
Returns
The build target or NULL if not found.

Definition at line 1399 of file cbproject.cpp.

References GetBuildTarget(), and IndexOfBuildTargetName().

◆ GetBuildTargetsCount()

int cbProject::GetBuildTargetsCount ( )
inline
Returns
The number of build targets this project contains.

Definition at line 200 of file cbproject.h.

References wxEmptyString.

Referenced by NativeParser::AddCompilerDirs(), ProjectManagerUI::AskForBuildTargetIndex(), ProjectManagerUI::AskForMultiBuildTargetIndex(), CodeBlocksApp::BatchJob(), ProjectOptionsDlg::BuildScriptsTree(), VirtualBuildTargetsDlg::CheckTargets(), CompilerOptionsDlg::CompilerOptionsDlg(), ProjectLoader::ConvertVersion_Pre_1_1(), Wiz::CopyFiles(), ProjectManager::DoAddFileToProject(), CompilerOptionsDlg::DoFillTree(), ProjectLoader::DoUnitOptions(), ProjectLoader::ExportTargetAsProject(), FilePathPanel::FilePathPanel(), ProjectOptionsDlg::FillBuildTargets(), FindReplaceDlg::FindReplaceDlg(), DirectCommands::GetCleanCommands(), DirectCommands::GetCompileCommands(), NativeParser::GetCompilerStandardGCC(), DirectCommands::GetLinkCommands(), FindReplaceDlg::GetTarget(), CompilerGCC::GetTargetIndexFromName(), CompilerCommandGenerator::Init(), TemplateManager::NewProjectFromUserTemplate(), ProjectManagerUI::OnAddFilesToProjectRecursively(), ProjectManagerUI::OnAddFileToProject(), ProjectOptionsDlg::OnBuildOrderClick(), ProjectOptionsDlg::OnCheckScripts(), CompilerOptionsDlg::OnCopyDirsClick(), CompilerOptionsDlg::OnCopyLibsClick(), FindReplaceDlg::OnSearchProject(), FindReplaceDlg::OnSelectTarget(), ProjectLoader::Open(), ProjectFileOptionsDlg::ProjectFileOptionsDlg(), MacrosManager::RecalcVars(), ScriptBindings::RegisterBindings(), Wiz::RunProjectWizard(), SelectTarget(), EditorManager::SwapActiveHeaderSource(), CompilerOptionsDlg::UpdateCompilerForTargets(), ProjectFile::UpdateFileDetails(), and CompilerGCC::UpdateProjectTargets().

◆ GetCheckForExternallyModifiedFiles()

bool cbProject::GetCheckForExternallyModifiedFiles ( ) const

Get check for externally modified files.

Returns
True if check for externally modified files is set, false if not.

Definition at line 1628 of file cbproject.cpp.

References m_CheckForExternallyModifiedFiles.

Referenced by EditorManager::CheckForExternallyModifiedFiles(), ProjectLoader::ExportTargetAsProject(), and ScriptBindings::RegisterBindings().

◆ GetCommonTopLevelPath()

wxString cbProject::GetCommonTopLevelPath ( ) const

◆ GetCurrentlyCompilingTarget()

ProjectBuildTarget* cbProject::GetCurrentlyCompilingTarget ( )
inline

◆ GetDefaultExecuteTarget()

const wxString & cbProject::GetDefaultExecuteTarget ( ) const
Returns
The build target index which will be pre-selected when the "Select target" dialog appears when running the project. Valid only for multi-target projects.

Definition at line 1387 of file cbproject.cpp.

References m_DefaultExecuteTarget.

Referenced by ProjectLoader::ExportTargetAsProject(), and ScriptBindings::RegisterBindings().

◆ GetExecutionDir()

wxString cbProject::GetExecutionDir ( )
Returns
Either the execution directory for the custom Makefile or the projects base path. Defaults to the projects base path, if no custom makefile is used. Used to unify the call to the function.

Definition at line 1023 of file cbproject.cpp.

References CompileTargetBase::GetBasePath(), GetMakefileExecutionDir(), and m_CustomMakefile.

Referenced by CompilerQueue::Add(), and CompilerGCC::AddOutputLine().

◆ GetExpandedVirtualBuildTargetGroup()

wxArrayString cbProject::GetExpandedVirtualBuildTargetGroup ( const wxString alias) const

Access a virtual build target's expanded group of build targets.

The difference from GetVirtualBuildTargetGroup() lies in that this function returns the full list of real build targets in this group (by recursively expanding virtual build targets in the group).

Parameters
aliasThe virtual build target's name.
Returns
The expanded list of all real build targets under the alias alias.

Definition at line 1507 of file cbproject.cpp.

References ExpandVirtualBuildTargetGroup(), and m_VirtualTargets.

Referenced by NativeParser::AddProjectDefinedMacros(), CompilerGCC::ExpandTargets(), and ScriptBindings::RegisterBindings().

◆ GetExtendedObjectNamesGeneration()

bool cbProject::GetExtendedObjectNamesGeneration ( ) const

Gets object names generation mode (extended/normal).

Returns
True for extended mode, false for normal mode.
See also
SetExtendedObjectNamesGeneration.

Definition at line 1586 of file cbproject.cpp.

References m_ExtendedObjectNamesGeneration.

Referenced by ProjectLoader::ExportTargetAsProject(), ScriptBindings::RegisterBindings(), ProjectFile::SetObjName(), and pfDetails::Update().

◆ GetExtensionsNode()

TiXmlNode * cbProject::GetExtensionsNode ( )
virtual

Access the <Extensions> XML node of this project.

This function is for advanced users only. Use at your own risk (and respect other plugins authors work under this node).

Returns
The <Extensions> XML node.
Note
This function will never return NULL.

Definition at line 1659 of file cbproject.cpp.

References _T, cbU2C(), and m_pExtensionsElement.

Referenced by AddToExtensions().

◆ GetFile()

ProjectFile * cbProject::GetFile ( int  index)

Access a file of the project.

Parameters
indexThe index of the file. Must be greater or equal than zero and less than GetFilesCount().
Returns
A pointer to the file or NULL if not found.

Definition at line 1031 of file cbproject.cpp.

References m_FileArray, m_Files, and NULL.

Referenced by ScriptBindings::RegisterBindings().

◆ GetFileByFilename()

ProjectFile * cbProject::GetFileByFilename ( const wxString filename,
bool  isRelative = true,
bool  isUnixFilename = false 
)

◆ GetFilesCount()

int cbProject::GetFilesCount ( )
inline
Returns
The number of files in the project.

Definition at line 142 of file cbproject.h.

Referenced by CodeCompletion::OnProjectActivated(), ScriptBindings::RegisterBindings(), and TemplateManager::SaveUserTemplate().

◆ GetFilesList()

virtual FilesList& cbProject::GetFilesList ( )
inlinevirtual

◆ GetFirstValidBuildTargetName()

wxString cbProject::GetFirstValidBuildTargetName ( bool  virtuals_too = true) const
Returns
The first valid (virtual or real) build target.

Definition at line 1345 of file cbproject.cpp.

References CompileTargetBase::GetTitle(), m_Targets, m_VirtualTargets, and wxEmptyString.

Referenced by ProjectLoader::ExportTargetAsProject(), ScriptBindings::RegisterBindings(), and SetActiveBuildTarget().

◆ GetGlobs()

std::vector< cbProject::Glob > cbProject::GetGlobs ( ) const

Retrieve the current globs from the project.

Returns
globs the globs to add to the project.

Definition at line 1750 of file cbproject.cpp.

References m_Globs.

Referenced by ProjectLoader::ExportTargetAsProject().

◆ GetLastModificationTime()

wxDateTime cbProject::GetLastModificationTime ( ) const
inline

Returns the last modification time for the file.

Used to detect modifications outside the Program.

Definition at line 569 of file cbproject.h.

Referenced by ProjectManagerUI::CheckForExternallyModifiedProjects().

◆ GetMakefile()

const wxString & cbProject::GetMakefile ( )

◆ GetMakefileExecutionDir()

wxString cbProject::GetMakefileExecutionDir ( )
Returns
The execution directory for the custom Makefile. Defaults to the projects base path, if no custom makefile is used.

Definition at line 1013 of file cbproject.cpp.

References CompileTargetBase::GetBasePath(), wxFileName::GetFullPath(), wxString::IsEmpty(), and m_MakefileExecutionDir.

Referenced by ProjectLoader::ExportTargetAsProject(), and GetExecutionDir().

◆ GetModeForPCH()

PCHMode cbProject::GetModeForPCH ( ) const
inline

◆ GetModified()

bool cbProject::GetModified ( ) const
overridevirtual

◆ GetNotes()

const wxString & cbProject::GetNotes ( ) const

Get notes on the project.

Returns
Simple text notes about the project.

Definition at line 1600 of file cbproject.cpp.

References m_Notes.

Referenced by ProjectManager::EndLoadingWorkspace(), ProjectLoader::ExportTargetAsProject(), and ScriptBindings::RegisterBindings().

◆ GetProjectNode()

wxTreeItemId cbProject::GetProjectNode ( )
inline

◆ GetShowNotesOnLoad()

bool cbProject::GetShowNotesOnLoad ( ) const

Get show project notes on load automatically.

Returns
True if show project notes on load is set, false if not.

Definition at line 1614 of file cbproject.cpp.

References m_AutoShowNotesOnLoad.

Referenced by ProjectManager::EndLoadingProject(), ProjectManager::EndLoadingWorkspace(), ProjectLoader::ExportTargetAsProject(), and ScriptBindings::RegisterBindings().

◆ GetVirtualBuildTargetGroup()

const wxArrayString & cbProject::GetVirtualBuildTargetGroup ( const wxString alias) const

Access a virtual build target's group of build targets.

Parameters
aliasThe virtual build target's name.
Returns
The list of all build targets under the alias alias.

Definition at line 1496 of file cbproject.cpp.

References m_VirtualTargets.

Referenced by CanAddToVirtualBuildTarget(), VirtualBuildTargetsDlg::CheckTargets(), ExpandVirtualBuildTargetGroup(), ProjectLoader::ExportTargetAsProject(), and ScriptBindings::RegisterBindings().

◆ GetVirtualBuildTargets()

wxArrayString cbProject::GetVirtualBuildTargets ( ) const

Get a list of all defined virtual build targets.

Returns
A list of all defined virtual build targets.

Definition at line 1487 of file cbproject.cpp.

References wxArrayString::Add(), and m_VirtualTargets.

Referenced by ProjectLoader::ExportTargetAsProject(), ScriptBindings::RegisterBindings(), and CompilerGCC::UpdateProjectTargets().

◆ GetVirtualFolders()

const wxArrayString & cbProject::GetVirtualFolders ( ) const

Get a list of the virtual folders.

Normally used by the project loader only.

Definition at line 908 of file cbproject.cpp.

References m_VirtualFolders.

Referenced by ProjectManagerUI::BuildProjectTree(), ProjectManagerUI::CheckForExternallyModifiedProjects(), and ProjectLoader::ExportTargetAsProject().

◆ HasVirtualBuildTarget()

bool cbProject::HasVirtualBuildTarget ( const wxString alias) const

Does a virtual build target exist?

Parameters
aliasThe virtual build target's name.
Returns
True if the virtual build target exists, false if not.

Definition at line 1470 of file cbproject.cpp.

References m_VirtualTargets.

Referenced by AddBuildTarget(), BuildTargetValid(), CanAddToVirtualBuildTarget(), ProjectLoader::Open(), ScriptBindings::RegisterBindings(), and ProjectOptionsDlg::ValidateTargetName().

◆ IndexOfBuildTargetName()

int cbProject::IndexOfBuildTargetName ( const wxString targetName) const
private

◆ IsLoaded()

bool cbProject::IsLoaded ( ) const
inline
Returns
True if the project fully loaded, false if not.

Definition at line 105 of file cbproject.h.

References CompileOptionsBase::GetModified(), and CompileOptionsBase::SetModified().

Referenced by ProjectManager::LoadProject().

◆ IsMakefileCustom()

bool cbProject::IsMakefileCustom ( )
inline
Returns
True if the project is using a custom Makefile for compilation, false if not.

Definition at line 159 of file cbproject.h.

Referenced by CompilerOptionsDlg::CompilerOptionsDlg(), ProjectLoader::ExportTargetAsProject(), CompilerOptionsDlg::OnTreeSelectionChange(), ScriptBindings::RegisterBindings(), and CompilerGCC::UseMake().

◆ LoadLayout()

bool cbProject::LoadLayout ( )

◆ NotifyPlugins()

void cbProject::NotifyPlugins ( wxEventType  type,
const wxString targetName = wxEmptyString,
const wxString oldTargetName = wxEmptyString 
)
private

◆ Open()

void cbProject::Open ( )
private

◆ ProjectFileRenamed()

void cbProject::ProjectFileRenamed ( ProjectFile pf)
virtual

Internal use only.

Updates the internal hashmap of project files.

Definition at line 1730 of file cbproject.cpp.

References m_ProjectFilesMap, ProjectFile::relativeFilename, and UnixFilename().

Referenced by ProjectFile::Rename().

◆ QueryCloseAllFiles()

bool cbProject::QueryCloseAllFiles ( )

Act like closing all project files, but don't do it.

Used to check if any of the project files need saving.

Returns
True if even one project file needs to be saved, false if not.

Definition at line 1078 of file cbproject.cpp.

References ProjectFile::file, Manager::Get(), Manager::GetEditorManager(), wxFileName::GetFullPath(), cbEditor::GetModified(), EditorManager::IsBuiltinOpen(), m_Files, and EditorManager::QueryClose().

Referenced by CloseAllFiles(), and ProjectManagerUI::QueryCloseProject().

◆ RemoveBuildTarget() [1/2]

bool cbProject::RemoveBuildTarget ( int  index)

◆ RemoveBuildTarget() [2/2]

bool cbProject::RemoveBuildTarget ( const wxString targetName)

Remove a build target.

Parameters
targetNameThe build target name.
Returns
True if the targetName was valid, false if not.

Definition at line 1319 of file cbproject.cpp.

References IndexOfBuildTargetName(), and RemoveBuildTarget().

◆ RemoveFile()

bool cbProject::RemoveFile ( ProjectFile pf)

◆ RemoveVirtualBuildTarget()

bool cbProject::RemoveVirtualBuildTarget ( const wxString alias)

Remove a virtual build target.

Parameters
aliasThe virtual build target's name.
Returns
True if the virtual build target was removed, false if not.

Definition at line 1475 of file cbproject.cpp.

References cbEVT_PROJECT_TARGETS_MODIFIED, m_VirtualTargets, NotifyPlugins(), and SetModified().

Referenced by AddBuildTarget(), VirtualBuildTargetsDlg::OnEditClick(), VirtualBuildTargetsDlg::OnRemoveClick(), and ScriptBindings::RegisterBindings().

◆ RemoveVirtualFolders()

void cbProject::RemoveVirtualFolders ( const wxString folder)

◆ RenameBuildTarget() [1/2]

bool cbProject::RenameBuildTarget ( int  index,
const wxString targetName 
)

Rename a build target.

Parameters
indexThe build target's index to rename.
targetNameThe new name for the build target.
Returns
True if index was valid, false if not.

Definition at line 1178 of file cbproject.cpp.

References cbEVT_BUILDTARGET_RENAMED, cbEVT_PROJECT_TARGETS_MODIFIED, GetBuildTarget(), CompileTargetBase::GetTitle(), wxArrayString::Index(), m_Files, m_VirtualTargets, NotifyPlugins(), ProjectFile::RenameBuildTarget(), SetModified(), and CompileTargetBase::SetTitle().

Referenced by ScriptBindings::cbProject_RenameBuildTarget(), ProjectOptionsDlg::OnEditBuildTargetClick(), and RenameBuildTarget().

◆ RenameBuildTarget() [2/2]

bool cbProject::RenameBuildTarget ( const wxString oldTargetName,
const wxString newTargetName 
)

Rename a build target.

Parameters
oldTargetNameThe build target's old name.
newTargetNameThe new name for the build target.
Returns
True if oldTargetName was valid, false if not.

Definition at line 1211 of file cbproject.cpp.

References IndexOfBuildTargetName(), and RenameBuildTarget().

◆ ReOrderTargets()

void cbProject::ReOrderTargets ( const wxArrayString nameOrder)

Reorder the list of build targets.

This is useful, so that when the special build target "All" is being built targets are built in the desired order.

Parameters
nameOrderAn array of strings containing build target names in the order you desire. The number of array elements must be equal to GetBuildTargetsCount().

Definition at line 1405 of file cbproject.cpp.

References _T, LogManager::DebugLog(), F(), Manager::Get(), GetBuildTarget(), wxArrayString::GetCount(), Manager::GetLogManager(), wxArrayString::Index(), wxArrayString::Insert(), m_Targets, m_VirtualTargets, wxArrayString::Remove(), SetModified(), and wxNOT_FOUND.

Referenced by ProjectOptionsDlg::OnBuildOrderClick().

◆ ReplaceVirtualFolder()

void cbProject::ReplaceVirtualFolder ( const wxString oldFolder,
const wxString newFolder 
)

Replaced the oldFolder with newFolder or appends newFolder to the end of the list if oldFolder is not found.

Definition at line 945 of file cbproject.cpp.

References wxArrayString::Add(), wxArrayString::Index(), wxString::IsEmpty(), m_Files, m_VirtualFolders, wxString::Replace(), SetModified(), wxString::StartsWith(), ProjectFile::virtual_path, and wxNOT_FOUND.

Referenced by ProjectManagerUI::CheckForExternallyModifiedProjects().

◆ RestoreTreeState()

void cbProject::RestoreTreeState ( wxTreeCtrl tree)

Convenience function for remembering the project's tree state when refreshing it.

Parameters
treeThe tree control to restore its expanded state to a previously saved.

Definition at line 983 of file cbproject.cpp.

References m_ExpandedNodes, m_ProjectNode, and m_SelectedNodes.

◆ Save()

bool cbProject::Save ( )

◆ SaveAllFiles()

bool cbProject::SaveAllFiles ( )

◆ SaveAs()

bool cbProject::SaveAs ( )

◆ SaveLayout()

bool cbProject::SaveLayout ( )

Save the project's layout.

Layout is the list of open project files, which one is active, where the cursor is located on each one of those, etc.

Returns
True if successful, false otherwise.

Definition at line 499 of file cbproject.cpp.

References _T, Manager::Get(), Manager::GetConfigManager(), wxFileName::GetFullPath(), wxString::IsEmpty(), CompileTargetBase::m_Filename, ConfigManager::ReadBool(), ProjectLayoutLoader::Save(), and wxFileName::SetExt().

Referenced by ProjectManager::CloseProject(), and ScriptBindings::RegisterBindings().

◆ SaveTreeState()

void cbProject::SaveTreeState ( wxTreeCtrl tree)

Convenience function for remembering the project's tree state when refreshing it.

Parameters
treeThe tree control to save its expanded state.

Definition at line 978 of file cbproject.cpp.

References m_ExpandedNodes, m_ProjectNode, and m_SelectedNodes.

◆ SelectTarget()

int cbProject::SelectTarget ( int  initial = -1,
bool  evenIfOne = false 
)

Displays a target selection dialog.

When invoked, a selection dialog is presented to the user so that he/she can select one target from the list of this project's targets.

Parameters
initialThe index of the pre-selected target when the dialog is displayed. Defaults to none (-1).
evenIfOneIf true, the dialog is still shown even if the project contains only one target. The default behaviour is to not show the dialog if the project has only one target.
Returns
The target's index that the user selected or -1 if the dialog was cancelled.

Definition at line 1130 of file cbproject.cpp.

References GetBuildTargetsCount(), SelectTargetDlg::GetSelection(), PlaceWindow(), wxDialog::ShowModal(), and wxID_OK.

Referenced by CodeBlocksApp::BatchJob(), DebuggerGDB::DoDebug(), ProjectManagerUI::OnExecParameters(), and ScriptBindings::RegisterBindings().

◆ SetActiveBuildTarget()

bool cbProject::SetActiveBuildTarget ( const wxString name)

Set the active build target.

Parameters
nameThe build target name to set as active. If name does not exist, then the first virtual target is set or the first real target, depending which is valid.
Returns
True if name was valid, false if not.

Definition at line 1355 of file cbproject.cpp.

References BuildTargetValid(), cbEVT_BUILDTARGET_SELECTED, GetFirstValidBuildTargetName(), m_ActiveTarget, and NotifyPlugins().

Referenced by ProjectLayoutLoader::Open(), and ScriptBindings::RegisterBindings().

◆ SetCheckForExternallyModifiedFiles()

void cbProject::SetCheckForExternallyModifiedFiles ( bool  check)

Set check for externally modified files.

Parameters
Trueif check for externally modified files is set, false if not.

Definition at line 1619 of file cbproject.cpp.

References m_CheckForExternallyModifiedFiles, and SetModified().

Referenced by ProjectLoader::DoProjectOptions(), ProjectOptionsDlg::EndModal(), and ScriptBindings::RegisterBindings().

◆ SetCompilerID()

void cbProject::SetCompilerID ( const wxString id)
overridevirtual

◆ SetCurrentlyCompilingTarget()

void cbProject::SetCurrentlyCompilingTarget ( ProjectBuildTarget bt)

Set the currently compiling target.

Note
This function is for internal use by compilers only. Using this function in any other place results in undefined behaviour!
Parameters
btThe build target that is currently building.

Definition at line 1444 of file cbproject.cpp.

References m_CurrentlyCompilingTarget.

Referenced by ScriptBindings::RegisterBindings().

◆ SetDefaultExecuteTarget()

void cbProject::SetDefaultExecuteTarget ( const wxString name)

Set the build target index which will be pre-selected when the "Select target" dialog appears when running the project.

Parameters
nameThe build target's name.

Definition at line 1378 of file cbproject.cpp.

References m_DefaultExecuteTarget, and SetModified().

Referenced by ProjectLoader::DoProjectOptions(), ProjectLoader::Open(), and ScriptBindings::RegisterBindings().

◆ SetExtendedObjectNamesGeneration()

void cbProject::SetExtendedObjectNamesGeneration ( bool  ext)

Sets object names generation to extended/normal mode.

In normal mode (the default), the file foo.cpp generates the foo.o object file. In extended mode, the file foo.cpp generates the foo.cpp.o object file.

This option is useful for large projects containing similarly named files (in the same directory) differing only on their extensions. Using the extended mode with said projects guarantees that each object name will be unique.

Parameters
extSet to true to switch to extended mode, false for normal mode.

Definition at line 1565 of file cbproject.cpp.

References m_ExtendedObjectNamesGeneration, m_Files, ProjectFile::relativeToCommonTopLevelPath, SetModified(), ProjectFile::SetObjName(), and ProjectFile::UpdateFileDetails().

Referenced by ProjectLoader::DoProjectOptions(), ProjectOptionsDlg::EndModal(), and ScriptBindings::RegisterBindings().

◆ SetGlobs()

void cbProject::SetGlobs ( const std::vector< Glob > &  globs)

Set the globs to the project, this are directory paths do retrieve files from to be added to the project, the path can be searched recursively.

Parameters
globsthe globs to add to the project.

Definition at line 1745 of file cbproject.cpp.

References m_Globs.

Referenced by ProjectLoader::DoUnits().

◆ SetMakefile()

void cbProject::SetMakefile ( const wxString makefile)
inline

Set the Makefile filename used when exporting a Makefile for the project, or when using a custom Makefile to build the project.

Parameters
makefileThe filename for the Makefile.

Definition at line 148 of file cbproject.h.

References CompileOptionsBase::SetModified().

Referenced by ProjectLoader::DoProjectOptions(), ProjectOptionsDlg::EndModal(), and ScriptBindings::RegisterBindings().

◆ SetMakefileCustom()

void cbProject::SetMakefileCustom ( bool  custom)

Mark if the project should use a custom Makefile for compilation.

Parameters
customIf true, use a custom Makefile for compilation. If false, use direct C::B build mode.

Definition at line 194 of file cbproject.cpp.

References m_CustomMakefile, and SetModified().

Referenced by ProjectLoader::DoProjectOptions(), ProjectOptionsDlg::EndModal(), and ScriptBindings::RegisterBindings().

◆ SetMakefileExecutionDir()

void cbProject::SetMakefileExecutionDir ( const wxString dir)

Allow the specification of specific execution directory if the project use a custom Makefile.

Defaults to the projects base path, if no custom makefile is used.

Parameters
dirThe directory the custom Makefile should be executed from.

Definition at line 1004 of file cbproject.cpp.

References m_MakefileExecutionDir, and SetModified().

Referenced by ProjectLoader::DoProjectOptions(), and ProjectOptionsDlg::EndModal().

◆ SetModeForPCH()

void cbProject::SetModeForPCH ( PCHMode  mode)
inline

Set the mode to handle precompiled headers.

Parameters
modeThe desired PCH mode.

Definition at line 306 of file cbproject.h.

References CompileTargetBase::SetCompilerID(), and CompileOptionsBase::SetModified().

Referenced by ProjectLoader::DoProjectOptions(), ProjectOptionsDlg::EndModal(), and ScriptBindings::RegisterBindings().

◆ SetModified()

void cbProject::SetModified ( bool  modified = true)
overridevirtual

◆ SetNotes()

void cbProject::SetNotes ( const wxString notes)

Set notes on the project.

Parameters
notesSimple text notes about the project.

Definition at line 1591 of file cbproject.cpp.

References m_Notes, and SetModified().

Referenced by ProjectLoader::DoProjectOptions(), ProjectOptionsDlg::EndModal(), ScriptBindings::RegisterBindings(), and ShowNotes().

◆ SetProjectNode()

void cbProject::SetProjectNode ( wxTreeItemId  node)
inline

Sets the root item of this item, should not be called by user's code!

Definition at line 314 of file cbproject.h.

References ScriptBindings::IOLib::RemoveFile().

Referenced by ProjectManagerUI::BuildProjectTree().

◆ SetShowNotesOnLoad()

void cbProject::SetShowNotesOnLoad ( bool  show)

Set show project notes on load automatically.

Parameters
showIf true show project notes on load.

Definition at line 1605 of file cbproject.cpp.

References m_AutoShowNotesOnLoad, and SetModified().

Referenced by ProjectLoader::DoProjectOptions(), ProjectOptionsDlg::EndModal(), and ScriptBindings::RegisterBindings().

◆ SetTitle()

void cbProject::SetTitle ( const wxString title)
overridevirtual

Changes project title.

This function overrides CompileTargetBase::SetTitle. It sends additional notification event to plugins and than calls base function.

Reimplemented from CompileTargetBase.

Definition at line 1650 of file cbproject.cpp.

References cbEVT_PROJECT_RENAMED, CompileTargetBase::GetTitle(), NotifyPlugins(), and CompileTargetBase::SetTitle().

Referenced by ProjectLoader::DoProjectOptions(), ProjectOptionsDlg::EndModal(), ExportTargetAsProject(), TemplateManager::NewProjectFromUserTemplate(), ScriptBindings::RegisterBindings(), and Wiz::RunProjectWizard().

◆ SetVirtualFolders()

void cbProject::SetVirtualFolders ( const wxArrayString folders)

Set the virtual folders list.

Normally used by the project loader only.

Definition at line 968 of file cbproject.cpp.

References _T, wxArrayString::GetCount(), and m_VirtualFolders.

Referenced by ProjectManagerUI::CheckForExternallyModifiedProjects(), and ProjectLoader::DoProjectOptions().

◆ ShowNotes()

void cbProject::ShowNotes ( bool  nonEmptyOnly,
bool  editable = false 
)

Show project notes now.

Parameters
nonEmptyOnlyIf true, show notes only if non-empty.
editableIf true, the notes will be editable.
Note
If editable is true, the nonEmptyOnly parameter is ignored...

Definition at line 1633 of file cbproject.cpp.

References _(), Manager::Get(), GenericMultiLineNotesDlg::GetNotes(), wxString::IsEmpty(), m_Notes, CompileTargetBase::m_Title, PlaceWindow(), SetNotes(), wxDialog::ShowModal(), and wxID_OK.

Referenced by ProjectManager::EndLoadingProject(), ProjectManager::EndLoadingWorkspace(), and ScriptBindings::RegisterBindings().

◆ Touch()

void cbProject::Touch ( )

Sets the last modification time for the project to 'now'.

Used to detect modifications outside the Program.

Definition at line 428 of file cbproject.cpp.

References m_LastModified, and wxDateTime::Now().

Referenced by ProjectManagerUI::CheckForExternallyModifiedProjects().

Member Data Documentation

◆ m_ActiveTarget

wxString cbProject::m_ActiveTarget
private

Definition at line 698 of file cbproject.h.

Referenced by GetActiveBuildTarget(), SetActiveBuildTarget(), and SetModified().

◆ m_AutoShowNotesOnLoad

bool cbProject::m_AutoShowNotesOnLoad
private

Definition at line 729 of file cbproject.h.

Referenced by GetShowNotesOnLoad(), and SetShowNotesOnLoad().

◆ m_BasePath

wxString cbProject::m_BasePath
private

Definition at line 717 of file cbproject.h.

Referenced by CalculateCommonTopLevelPath(), and cbProject().

◆ m_CheckForExternallyModifiedFiles

bool cbProject::m_CheckForExternallyModifiedFiles
private

◆ m_CommonTopLevelPath

wxString cbProject::m_CommonTopLevelPath
private

◆ m_CurrentlyCompilingTarget

ProjectBuildTarget* cbProject::m_CurrentlyCompilingTarget
private

Definition at line 723 of file cbproject.h.

Referenced by SetCurrentlyCompilingTarget().

◆ m_CurrentlyLoading

bool cbProject::m_CurrentlyLoading
private

Definition at line 715 of file cbproject.h.

Referenced by AddFile(), and Open().

◆ m_CustomMakefile

bool cbProject::m_CustomMakefile
private

Definition at line 702 of file cbproject.h.

Referenced by GetExecutionDir(), and SetMakefileCustom().

◆ m_DefaultExecuteTarget

wxString cbProject::m_DefaultExecuteTarget
private

Definition at line 700 of file cbproject.h.

Referenced by GetDefaultExecuteTarget(), and SetDefaultExecuteTarget().

◆ m_ExpandedNodes

wxArrayString cbProject::m_ExpandedNodes
private

Definition at line 708 of file cbproject.h.

Referenced by RestoreTreeState(), and SaveTreeState().

◆ m_ExtendedObjectNamesGeneration

bool cbProject::m_ExtendedObjectNamesGeneration
private

◆ m_FileArray

ProjectFileArray cbProject::m_FileArray
private

Definition at line 707 of file cbproject.h.

Referenced by AddFile(), cbProject(), ClearAllProperties(), CloseAllFiles(), GetFile(), and RemoveFile().

◆ m_Files

FilesList cbProject::m_Files
private

◆ m_Globs

std::vector<Glob> cbProject::m_Globs
private

Definition at line 705 of file cbproject.h.

Referenced by GetGlobs(), and SetGlobs().

◆ m_LastModified

wxDateTime cbProject::m_LastModified
private

Definition at line 725 of file cbproject.h.

Referenced by Open(), Save(), SaveAs(), and Touch().

◆ m_LastSavedActiveTarget

wxString cbProject::m_LastSavedActiveTarget
private

Definition at line 699 of file cbproject.h.

Referenced by SetModified().

◆ m_Loaded

bool cbProject::m_Loaded
private

Definition at line 710 of file cbproject.h.

Referenced by cbProject(), Open(), and SaveAs().

◆ m_Makefile

wxString cbProject::m_Makefile
private

Definition at line 701 of file cbproject.h.

Referenced by GetMakefile().

◆ m_MakefileExecutionDir

wxString cbProject::m_MakefileExecutionDir
mutableprivate

Definition at line 703 of file cbproject.h.

Referenced by GetMakefileExecutionDir(), and SetMakefileExecutionDir().

◆ m_Notes

wxString cbProject::m_Notes
private

Definition at line 728 of file cbproject.h.

Referenced by GetNotes(), SetNotes(), and ShowNotes().

◆ m_PCHMode

PCHMode cbProject::m_PCHMode
private

Definition at line 719 of file cbproject.h.

◆ m_pExtensionsElement

TiXmlElement* cbProject::m_pExtensionsElement
private

◆ m_ProjectFilesMap

ProjectFiles cbProject::m_ProjectFilesMap
private

Definition at line 722 of file cbproject.h.

Referenced by AddFile(), GetFileByFilename(), Open(), ProjectFileRenamed(), and RemoveFile().

◆ m_ProjectNode

wxTreeItemId cbProject::m_ProjectNode
private

Definition at line 711 of file cbproject.h.

Referenced by RestoreTreeState(), and SaveTreeState().

◆ m_SelectedNodes

wxArrayString cbProject::m_SelectedNodes
private

Definition at line 709 of file cbproject.h.

Referenced by RestoreTreeState(), and SaveTreeState().

◆ m_Targets

BuildTargets cbProject::m_Targets
private

◆ m_VirtualFolders

wxArrayString cbProject::m_VirtualFolders
private

◆ m_VirtualTargets

VirtualBuildTargetsMap cbProject::m_VirtualTargets
private

The documentation for this class was generated from the following files: