87 if (target && (target->
m_Files.find(
this) == target->
m_Files.end()))
125 FilesList::iterator it = target->
m_Files.find(
this);
126 if (it != target->
m_Files.end())
182 if (extendedObjectNames)
213 if (extendedObjectNames)
224 if (extendedObjectNames)
258 for (
int x = 0; x < tcount; ++x)
276 pfd->
Update(target,
this);
316 customBuild[compilerId].useCustomBuildCommand = useCustomBuildCommand;
321 customBuild[compilerId].buildCommand = newBuildCommand;
326 return customBuild[compilerId].useCustomBuildCommand;
384 size_t len = new_gch.
Length();
385 for (
size_t i = 0; i < len; ++i)
388 if (c ==
_T(
'/') || c ==
_T(
'\\') || c ==
_T(
'.'))
389 new_gch[i] =
_T(
'_');
393 object_file_native = fn.
GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR) +
397 object_file_flat_native = object_file_native;
403 object_file_native = objOut + sep + obj_name.GetFullPath();
404 object_file_flat_native = objOut + sep + obj_name.GetFullName();
411 object_file_flat_native = object_file_native;
440 bool diffVolume =
false;
442 if ( platform::windows
446 obj_file_full_path = obj_file_full_path.
AfterFirst(
_T(
'\\'));
454 object_file_native = objOut + sep + obj_file_full_path;
455 object_file_flat_native = objOut + sep + fname.
GetFullName();
467 object_file_native = objOut + sep + obj_file_path;
468 object_file_flat_native = objOut + sep + fname.
GetFullName();
474 object_file_native = obj_file_full_path;
479 cbMessageBox(
_(
"You have added a static/dynamic library to the project files and enabled to link against it. " 480 "This is likely to fail as Code::Blocks cannot control the link order which is relevant.\n" 481 "Instead, add the library to the project linker options."),
_(
"Error"),
wxICON_ERROR |
wxOK);
483 object_file_native = obj_file_full_path;
490 object_file_native = objOut + sep + obj_file_full_path;
491 object_file_flat_native = objOut + sep + fname.
GetFullName();
507 object_file_native = objOut + sep + obj_file_path;
508 object_file_flat_native = objOut + sep + fname.
GetFullName();
515 wxFileName o_file_flat(object_file_flat_native);
519 object_dir_native = o_file.
GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
520 object_dir_flat_native = o_file_flat.
GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
521 object_file_absolute_native = o_file.
GetFullPath();
522 object_file_flat_absolute_native = o_file_flat.
GetFullPath();
524 obj_name.SetExt(
_T(
"depend"));
525 dep_file_native = depsOut + sep + obj_name.GetFullPath();
529 dep_dir_native = d_file.
GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
538 object_file_flat =
UnixFilename(object_file_flat_native);
FileVisualState
These are valid values for the state of each project file.
wxString relativeToCommonTopLevelPath
The relative filename to the common top-level path.
bool GetUseCustomBuildCommand(const wxString &compilerId)
Read 'Use custom command to build this file' for a compilerId.
wxString relativeFilename
The relative (to the project) filename of this file.
void Assign(const wxFileName &filepath)
virtual wxString GetDepsOutput() const
Read the target's dependencies output dir.
static Manager * Get()
Use Manager::Get() to get a pointer to its instance Manager::Get() is guaranteed to never return an i...
bool ShowOptions(wxWindow *parent)
Show the file properties dialog.
const wxString & GetObjName()
wxFileName file
The full filename of this file.
static Compiler * GetDefaultCompiler()
wxString GetCustomBuildCommand(const wxString &compilerId)
Read customBuild command for a compilerId.
bool compile
Compile flag.
int Index(const wxString &sz, bool bCase=true, bool bFromEnd=false) const
void SetModified(bool modified=true) override
Mark the project as modified or not.
PCHMode GetModeForPCH() const
static Compiler * GetCompiler(size_t index)
FileType
Known file types.
wxString BeforeLast(wxUniChar ch, wxString *rest=NULL) const
const DLLIMPORT wxString RESOURCEBIN_EXT
cbProjectManagerUI & GetUI()
DLLIMPORT FileType FileTypeOf(const wxString &filename)
const DLLIMPORT wxString RESOURCEBIN_DOT_EXT
void CalculateCommonTopLevelPath()
Calculates the top-level path common to all project files.
wxString AfterFirst(wxUniChar ch) const
void UpdateFileDetails(ProjectBuildTarget *target=nullptr)
This is called automatically when adding/removing build targets.
Represents a file in a Code::Blocks project.
In the objects output dir, along with other object files.
ProjectFileArray m_FileArray
virtual cbProject * GetParentProject()
wxUSE_UNICODE_dependent wxChar
ProjectManager * GetProjectManager() const
Functions returning pointers to the respective sub-manager instances.
virtual void ProjectFileRenamed(ProjectFile *pf)
Internal use only.
DLLIMPORT wxString UnixFilename(const wxString &filename, wxPathFormat format=wxPATH_NATIVE)
wxTreeItemId m_TreeItemId
Represents a Code::Blocks project.
void RenameBuildTarget(const wxString &oldTargetName, const wxString &newTargetName)
Rename a build target this file belongs in.
virtual const wxString & GetTitle() const
Read the target's title.
void RemoveBuildTarget(const wxString &targetName)
Remove this file from the specified build target.
wxString GetVolume() const
bool IsSameAs(const wxString &s, bool caseSensitive=true) const
virtual cbTreeCtrl * GetTree()=0
Retrieve a pointer to the project manager's tree (GUI).
pfCustomBuildMap customBuild
A map for custom builds.
This is a helper class that caches various filenames for one ProjectFile.
const pfDetails & GetFileDetails(ProjectBuildTarget *target)
Access the file details for this project file for the specified target.
virtual wxString GetBasePath() const
Read the target's base path, e.g. if GetFilename() returns "/usr/local/bin/xxx", base path will retur...
static int CompareProjectFiles(ProjectFile *item1, ProjectFile *item2)
Compare relative names of projectfiles.
MacrosManager * GetMacrosManager() const
void SetCustomBuildCommand(const wxString &compilerId, const wxString &newBuildCommand)
Modify customBuild command for a compilerId.
const wxString & _(const wxString &string)
DLLIMPORT void QuoteStringIfNeeded(wxString &str)
void ReplaceMacros(wxString &buffer, ProjectBuildTarget *target=nullptr, bool subrequest=false)
int GetBuildTargetsCount()
In a dir (named by the PCH) on the same level as the source header (default).
ProjectFilesVector generatedFiles
Auto-generated files when compiling this file.
ProjectBuildTarget * GetBuildTarget(int index)
Access a build target.
Abstract base class for compilers.
pfDetails(ProjectBuildTarget *target, ProjectFile *pf)
bool GetExtendedObjectNamesGeneration() const
Gets object names generation mode (extended/normal).
wxString & Append(const char *psz)
FileVisualState GetFileState() const
DLLIMPORT void PlaceWindow(wxTopLevelWindow *w, cbPlaceDialogMode mode=pdlBest, bool enforce=false)
wxString GetBaseName() const
wxString GetPath(int flags=wxPATH_GET_VOLUME, wxPathFormat format=wxPATH_NATIVE) const
virtual const wxString & GetCompilerID() const
Read the target's compiler.
void ReplaceEnvVars(wxString &buffer)
void Rename(const wxString &new_name)
Change filename of the file.
void DoUpdateFileDetails(ProjectBuildTarget *target)
~ProjectFile()
Destructor.
wxString GetFullName() const
FileVisualState m_VisualState
virtual const CompilerSwitches & GetSwitches() const
Get the compiler's generic switches.
void SetExt(const wxString &ext)
size_t Add(const wxString &str, size_t copies=1)
cbProject * GetParentProject()
Represents a Code::Blocks project build target.
void SetUseCustomBuildCommand(const wxString &compilerId, bool useCustomBuildCommand)
Modify 'Use custom command to build this file' for a compilerId.
const wxArrayString & GetBuildTargets() const
virtual void SetItemImage(const wxTreeItemId &item, int image, wxTreeItemIcon which=wxTreeItemIcon_Normal)
bool MakeAbsolute(const wxString &cwd=wxEmptyString, wxPathFormat format=wxPATH_NATIVE)
void RemoveAt(size_t nIndex, size_t count=1)
void AddBuildTarget(const wxString &targetName)
Make this file belong to an additional build target.
void SetFileState(FileVisualState state)
Set the visual state (modified, read-only, etc).
void SetName(const wxString &name)
virtual wxString GetObjectOutput() const
Read the target's objects output dir.
wxString GetFullPath(wxPathFormat format=wxPATH_NATIVE) const
void Update(ProjectBuildTarget *target, ProjectFile *pf)
ProjectFile(cbProject *prj)
Constructor.
DLLIMPORT int cbMessageBox(const wxString &message, const wxString &caption=wxEmptyString, int style=wxOK, wxWindow *parent=NULL, int x=-1, int y=-1)
wxMessageBox wrapper.
void SetObjName(const wxString &name)
Set the generated object filename.
wxArrayString buildTargets
An array of strings, containing the names of all the build targets this file belongs to...