Code::Blocks  SVN r11506
projectfile.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
3  * http://www.gnu.org/licenses/lgpl-3.0.html
4  *
5  * $Revision: 10383 $
6  * $Id: projectfile.cpp 10383 2015-08-08 08:37:54Z fuscated $
7  * $HeadURL: https://svn.code.sf.net/p/codeblocks/code/trunk/src/sdk/projectfile.cpp $
8  */
9 
10 #include "sdk_precomp.h"
11 
12 #ifndef CB_PRECOMP
13  #include "projectfile.h"
14  #include "projectbuildtarget.h"
15  #include "cbproject.h"
16  #include "compilerfactory.h"
17  #include "manager.h"
18  #include "projectmanager.h"
19  #include "macrosmanager.h"
20  #include "globals.h"
21 #endif
22 
23 #include "projectfileoptionsdlg.h"
24 #include "filefilters.h"
25 
27  compile(false),
28  link(false),
29  weight(50),
30  editorOpen(false),
31  editorSplit(0),
32  editorSplitActive(1),
33  editorSplitPos(0),
34  editorPos(0),
35  editorTopLine(0),
36  editorZoom(0),
37  editorPos_2(0),
38  editorTopLine_2(0),
39  editorZoom_2(0),
40  editorTabPos(0),
41  autoGeneratedBy(nullptr),
42  project(prj),
43  m_VisualState(fvsNormal)
44 {
45 }
46 
48 {
49  // clear PFDMap
50  for (PFDMap::iterator it = m_PFDMap.begin(); it != m_PFDMap.end(); ++it)
51  {
52  delete it->second;
53  }
54  m_PFDMap.clear();
55 }
56 
57 void ProjectFile::Rename(const wxString& new_name)
58 {
59  wxString path = file.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
60 
61  file.Assign(path + new_name);
62  relativeFilename = relativeFilename.BeforeLast(wxFILE_SEP_PATH);
64  {
65  relativeFilename.Append(wxFILE_SEP_PATH);
66  }
67  relativeFilename.Append(new_name);
68 
69  if (project)
70  {
73  project->SetModified(true);
74  }
76 }
77 
78 void ProjectFile::AddBuildTarget(const wxString& targetName)
79 {
80  if (buildTargets.Index(targetName) == wxNOT_FOUND)
81  buildTargets.Add(targetName);
82 
83  // add this file to the target's list of files
84  if (project)
85  {
86  ProjectBuildTarget* target = project->GetBuildTarget(targetName);
87  if (target && (target->m_Files.find(this) == target->m_Files.end()))
88  {
89  target->m_Files.insert(this);
90  // Only add the file, if we are not currently loading the project and m_FileArray is already initialised
91  // initialising is done in the getter-function (GetFile(index), to save time, if it is not needed
92  if ( target->m_FileArray.GetCount() > 0 )
93  target->m_FileArray.Add(this);
94  }
95  }
96 
97  // also do this for auto-generated files
98  for (size_t i = 0; i < generatedFiles.size(); ++i)
99  generatedFiles[i]->AddBuildTarget(targetName);
100 }
101 
102 void ProjectFile::RenameBuildTarget(const wxString& oldTargetName, const wxString& newTargetName)
103 {
104  int idx = buildTargets.Index(oldTargetName);
105  if (idx != wxNOT_FOUND)
106  buildTargets[idx] = newTargetName;
107 
108  // also do this for auto-generated files
109  for (size_t i = 0; i < generatedFiles.size(); ++i)
110  generatedFiles[i]->RenameBuildTarget(oldTargetName, newTargetName);
111 }
112 
114 {
115  int idx = buildTargets.Index(targetName);
116  if (idx != wxNOT_FOUND)
117  buildTargets.RemoveAt(idx);
118 
119  // remove this file from the target's list of files
120  if (project)
121  {
122  ProjectBuildTarget* target = project->GetBuildTarget(targetName);
123  if (target)
124  {
125  FilesList::iterator it = target->m_Files.find(this);
126  if (it != target->m_Files.end())
127  {
128  int item = target->m_FileArray.Index(*it);
129  if (item != wxNOT_FOUND)
130  target->m_FileArray.RemoveAt(item);
131  target->m_Files.erase(it);
132  }
133  }
134  }
135 
136  // also do this for auto-generated files
137  for (size_t i = 0; i < generatedFiles.size(); ++i)
138  generatedFiles[i]->RemoveBuildTarget(targetName);
139 }
140 
142 {
143  return buildTargets;
144 }
145 
147 {
148  ProjectFileOptionsDlg dlg(parent, this);
149  PlaceWindow(&dlg);
150  return dlg.ShowModal() == wxID_OK;
151 }
152 
154 {
156  fname.SetExt(wxEmptyString);
157  return fname.GetFullPath();
158 }
159 
161 {
162  if (generatedFiles.size())
163  {
164  // for files generating other files,
165  // report the first generated file's "object name"
166  return generatedFiles[0]->GetObjName();
167  }
168 
169  if (m_ObjName.IsEmpty())
171  return m_ObjName;
172 }
173 
175 {
176  bool extendedObjectNames = project->GetExtendedObjectNamesGeneration();
177  wxFileName fname(name);
178  m_ObjName = name;
179  FileType ft = FileTypeOf(name);
180  if (ft == ftResource || ft == ftResourceBin)
181  {
182  if (extendedObjectNames)
184  else
185  {
187  m_ObjName = fname.GetFullPath();
188  }
189  }
190  else if (ft == ftHeader) // support precompiled headers?
191  {
193  if (compiler && compiler->GetSwitches().supportsPCH)
194  {
195  // PCHs are always using the extended name mode (at least for GCC)
196  // the extension is set to "h.gch" for .h files
198  fname.Assign(relativeFilename);
199  // Make the current file extension part of the filename
200  fname.SetName(fname.GetFullName());
201  // PCHExtension will contain, for example, 'gch'
202  fname.SetExt(compiler->GetSwitches().PCHExtension);
203  m_ObjName = fname.GetFullPath();
204  }
205  }
206  else
207  {
208  if (project)
209  {
211  if (compiler)
212  {
213  if (extendedObjectNames)
214  m_ObjName += _T('.') + compiler->GetSwitches().objectExtension;
215  else
216  {
217  fname.SetExt(compiler->GetSwitches().objectExtension);
218  m_ObjName = fname.GetFullPath();
219  }
220  }
221  }
222  else
223  {
224  if (extendedObjectNames)
225  m_ObjName += _T(".o"); // fallback?
226  else
227  {
228  fname.SetExt(_T(".o"));
229  m_ObjName = fname.GetFullPath();
230  }
231  }
232  }
233 //#ifdef __WXMSW__
234 // // special case for windows and files on a different drive
235 // if (name.Length() > 1 && name.GetChar(1) == _T(':'))
236 // {
237 // m_ObjName.Remove(1, 1); // NOTE (mandrav): why remove the colon???
238 // }
239 //#endif
240 }
241 
242 // map target to pfDetails
244 {
245  if (!project)
246  return;
247 
248  if (!compile && !link)
249  return;
250 
251  // update PCH output name (in case project PCH mode was changed)
254 
255  if (!target) // update all targets
256  {
257  int tcount = project->GetBuildTargetsCount();
258  for (int x = 0; x < tcount; ++x)
259  {
262  }
263  }
264  else
265  DoUpdateFileDetails(target);
266 }
267 
269 {
270  // if we don't belong in this target, abort
271  if (!target || buildTargets.Index(target->GetTitle()) == wxNOT_FOUND)
272  return;
273  // delete old PFD
274  pfDetails* pfd = m_PFDMap[target];
275  if (pfd)
276  pfd->Update(target, this);
277  else
278  {
279  pfd = new pfDetails(target, this);
280  m_PFDMap[target] = pfd;
281  }
282 }
283 
285 {
286  pfDetails* pfd = m_PFDMap[target];
287  if (!pfd)
288  {
289  DoUpdateFileDetails(target);
290  pfd = m_PFDMap[target];
291  }
292  return *pfd;
293 }
294 
296 {
297  return m_VisualState;
298 }
299 
301 {
302  if (state != m_VisualState)
303  {
304  m_VisualState = state;
306  if (tree && m_TreeItemId.IsOk())
307  {
308  tree->SetItemImage(m_TreeItemId, (int)state, wxTreeItemIcon_Normal);
310  }
311  }
312 }
313 
314 void ProjectFile::SetUseCustomBuildCommand(const wxString& compilerId, bool useCustomBuildCommand)
315 {
316  customBuild[compilerId].useCustomBuildCommand = useCustomBuildCommand;
317 }
318 
319 void ProjectFile::SetCustomBuildCommand(const wxString& compilerId, const wxString& newBuildCommand)
320 {
321  customBuild[compilerId].buildCommand = newBuildCommand;
322 }
323 
325 {
326  return customBuild[compilerId].useCustomBuildCommand;
327 }
328 
330 {
331  return customBuild[compilerId].buildCommand;
332 }
333 
335 {
336  return wxStrcmp(item1->relativeFilename, item2->relativeFilename);
337 }
338 
340 // pfDetails
342 
344 {
345  Update(target, pf);
346 }
347 
349 {
350  wxString sep = wxFILE_SEP_PATH;
351 
352  wxFileName prjbase(target->GetParentProject()->GetBasePath());
353 
354  wxString objOut = target ? target->GetObjectOutput() : _T(".");
355  wxString depsOut = target ? target->GetDepsOutput() : _T(".");
356 
357  // we must replace any macros here early because if the macros expand
358  // to absolute paths (like global vars usually do), we 're gonna create
359  // invalid filenames below
360  Manager::Get()->GetMacrosManager()->ReplaceMacros(objOut, target);
361  Manager::Get()->GetMacrosManager()->ReplaceMacros(depsOut, target);
362 
363  source_file_native = pf->relativeFilename;
364  source_file_absolute_native = pf->file.GetFullPath();
365 
366  wxFileName obj_name( pf->GetObjName() );
368 
369  Compiler* compiler = target ? CompilerFactory::GetCompiler(target->GetCompilerID())
371 
372  // support for precompiled headers
373  if (target && ft == ftHeader && compiler && compiler->GetSwitches().supportsPCH)
374  {
375  switch (target->GetParentProject()->GetModeForPCH())
376  {
377  case pchSourceDir:
378  {
379  // if PCH is for a file called all.h, we create
380  // all.h.gch/<target>_all.h.gch
381  // (that's right: a directory)
382  wxString new_gch = target->GetTitle() + _T('_') + pf->GetObjName();
383  // make sure we 're not generating subdirs
384  size_t len = new_gch.Length();
385  for (size_t i = 0; i < len; ++i)
386  {
387  wxChar c = new_gch[i];
388  if (c == _T('/') || c == _T('\\') || c == _T('.'))
389  new_gch[i] = _T('_');
390  }
391 
392  wxFileName fn(source_file_native);
393  object_file_native = fn.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR) +
394  fn.GetFullName() + _T('.') + compiler->GetSwitches().PCHExtension +
395  wxFILE_SEP_PATH +
396  new_gch;
397  object_file_flat_native = object_file_native;
398  break;
399  }
400 
401  case pchObjectDir:
402  {
403  object_file_native = objOut + sep + obj_name.GetFullPath();
404  object_file_flat_native = objOut + sep + obj_name.GetFullName();
405  break;
406  }
407 
408  case pchSourceFile:
409  {
410  object_file_native = pf->GetObjName();
411  object_file_flat_native = object_file_native;
412  break;
413  }
414 
415  default:
416  break;
417  }
418  }
419  else
420  {
421  if (pf->GetParentProject())
422  {
424  if (pf->generatedFiles.size())
425  {
426  // for files generating other files,
427  // use the first generated file's "object name"
428  fname.Assign(pf->generatedFiles[0]->relativeToCommonTopLevelPath);
429  }
430  /* NOTE: In case the source file resides in a different volume
431  * than the volume where project file is,
432  * then the object file will be created as follows.
433  *
434  * Project object output dir: C:\Foo\obj\Debug
435  * Source: D:\Source\foo.cpp
436  * Obj file: C:\Foo\obj\Debug\D\Source\foo.o
437  */
438  wxString fileVol = fname.GetVolume();
439  wxString obj_file_full_path = fname.GetFullPath();
440  bool diffVolume = false;
441 
442  if ( platform::windows
443  && (!fileVol.IsEmpty() && !fileVol.IsSameAs(prjbase.GetVolume())) )
444  {
445  objOut += fileVol;
446  obj_file_full_path = obj_file_full_path.AfterFirst(_T('\\'));
447  diffVolume = true;
448  }
449 
450  if (ft == ftResource || ft == ftResourceBin)
451  {
453  {
454  object_file_native = objOut + sep + obj_file_full_path;
455  object_file_flat_native = objOut + sep + fname.GetFullName();
456 
457  object_file_native += FileFilters::RESOURCEBIN_DOT_EXT;
458  object_file_flat_native += FileFilters::RESOURCEBIN_DOT_EXT;
459  }
460  else
461  {
463  wxString obj_file_path = fname.GetFullPath();
464  if (diffVolume)
465  obj_file_path = obj_file_path.AfterFirst(_T('\\'));
466 
467  object_file_native = objOut + sep + obj_file_path;
468  object_file_flat_native = objOut + sep + fname.GetFullName();
469  }
470  }
471  else if (ft == ftObject)
472  {
473  // TODO (Morten#1#): Does this work in all cases (flat objects, extended object generation, generated files...)?
474  object_file_native = obj_file_full_path;
475  object_file_flat_native = fname.GetFullName();
476  }
477  else if (ft == ftStaticLib || ft == ftDynamicLib)
478  {
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);
482  // This will be wrong and most likely not working but spoil the build process
483  object_file_native = obj_file_full_path;
484  object_file_flat_native = fname.GetFullName();
485  }
486  else
487  {
489  {
490  object_file_native = objOut + sep + obj_file_full_path;
491  object_file_flat_native = objOut + sep + fname.GetFullName();
492 
493  if (compiler)
494  {
495  object_file_native += _T('.') + compiler->GetSwitches().objectExtension;
496  object_file_flat_native += _T('.') + compiler->GetSwitches().objectExtension;
497  }
498  }
499  else
500  {
501  if (compiler)
502  fname.SetExt(compiler->GetSwitches().objectExtension);
503  wxString obj_file_path = fname.GetFullPath();
504  if (diffVolume)
505  obj_file_path = obj_file_path.AfterFirst(_T('\\'));
506 
507  object_file_native = objOut + sep + obj_file_path;
508  object_file_flat_native = objOut + sep + fname.GetFullName();
509  }
510  }
511  }
512  }
513 
514  wxFileName o_file(object_file_native);
515  wxFileName o_file_flat(object_file_flat_native);
516  o_file.MakeAbsolute(prjbase.GetFullPath());
517  o_file_flat.MakeAbsolute(prjbase.GetFullPath());
518 
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();
523 
524  obj_name.SetExt(_T("depend"));
525  dep_file_native = depsOut + sep + obj_name.GetFullPath();
526 
527  wxFileName d_file(dep_file_native);
528  d_file.MakeAbsolute(prjbase.GetFullPath());
529  dep_dir_native = d_file.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
530  dep_file_absolute_native = o_file.GetFullPath();
531 
532  source_file = UnixFilename(source_file_native);
533  QuoteStringIfNeeded(source_file);
534 
535  object_file = UnixFilename(object_file_native);
536  QuoteStringIfNeeded(object_file);
537 
538  object_file_flat = UnixFilename(object_file_flat_native);
539  QuoteStringIfNeeded(object_file_flat);
540 
541  dep_file = UnixFilename(dep_file_native);
542  QuoteStringIfNeeded(dep_file);
543 
544  object_dir = UnixFilename(object_dir_native);
545  QuoteStringIfNeeded(object_dir);
546 
547  object_dir_flat = UnixFilename(object_dir_flat_native);
548  QuoteStringIfNeeded(object_dir_flat);
549 
550  dep_dir = UnixFilename(dep_dir_native);
551  QuoteStringIfNeeded(dep_dir);
552 
553  Manager::Get()->GetMacrosManager()->ReplaceEnvVars(object_file_native);
554  Manager::Get()->GetMacrosManager()->ReplaceEnvVars(object_file_flat_native);
555  Manager::Get()->GetMacrosManager()->ReplaceEnvVars(object_dir_native);
556  Manager::Get()->GetMacrosManager()->ReplaceEnvVars(object_dir_flat_native);
557  Manager::Get()->GetMacrosManager()->ReplaceEnvVars(object_file_absolute_native);
558  Manager::Get()->GetMacrosManager()->ReplaceEnvVars(object_file_flat_absolute_native);
559  Manager::Get()->GetMacrosManager()->ReplaceEnvVars(dep_file_native);
560  Manager::Get()->GetMacrosManager()->ReplaceEnvVars(dep_dir_native);
561  Manager::Get()->GetMacrosManager()->ReplaceEnvVars(dep_file_absolute_native);
563  Manager::Get()->GetMacrosManager()->ReplaceEnvVars(object_dir);
564  Manager::Get()->GetMacrosManager()->ReplaceEnvVars(object_dir_flat);
566  Manager::Get()->GetMacrosManager()->ReplaceEnvVars(object_file);
567  Manager::Get()->GetMacrosManager()->ReplaceEnvVars(object_file_flat);
568  Manager::Get()->GetMacrosManager()->ReplaceEnvVars(source_file);
569 }
FileVisualState
These are valid values for the state of each project file.
Definition: globals.h:81
wxString relativeToCommonTopLevelPath
The relative filename to the common top-level path.
Definition: projectfile.h:135
wxString PCHExtension
Definition: compiler.h:229
bool GetUseCustomBuildCommand(const wxString &compilerId)
Read &#39;Use custom command to build this file&#39; for a compilerId.
wxString relativeFilename
The relative (to the project) filename of this file.
Definition: projectfile.h:131
void Assign(const wxFileName &filepath)
bool IsOk() const
virtual wxString GetDepsOutput() const
Read the target&#39;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...
Definition: manager.cpp:182
bool ShowOptions(wxWindow *parent)
Show the file properties dialog.
#define wxICON_ERROR
const wxString & GetObjName()
wxFileName file
The full filename of this file.
Definition: projectfile.h:126
static Compiler * GetDefaultCompiler()
wxString GetCustomBuildCommand(const wxString &compilerId)
Read customBuild command for a compilerId.
cbProject * project
Definition: projectfile.h:227
bool compile
Compile flag.
Definition: projectfile.h:138
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.
Definition: cbproject.cpp:179
PCHMode GetModeForPCH() const
Definition: cbproject.h:301
size_t Length() const
static Compiler * GetCompiler(size_t index)
#define _T(string)
FileType
Known file types.
Definition: globals.h:49
wxString BeforeLast(wxUniChar ch, wxString *rest=NULL) const
const DLLIMPORT wxString RESOURCEBIN_EXT
cbProjectManagerUI & GetUI()
DLLIMPORT FileType FileTypeOf(const wxString &filename)
Definition: globals.cpp:285
const DLLIMPORT wxString RESOURCEBIN_DOT_EXT
void CalculateCommonTopLevelPath()
Calculates the top-level path common to all project files.
Definition: cbproject.cpp:319
wxString AfterFirst(wxUniChar ch) const
void UpdateFileDetails(ProjectBuildTarget *target=nullptr)
This is called automatically when adding/removing build targets.
#define wxNOT_FOUND
Represents a file in a Code::Blocks project.
Definition: projectfile.h:39
In the objects output dir, along with other object files.
Definition: cbproject.h:87
ProjectFileArray m_FileArray
virtual cbProject * GetParentProject()
wxUSE_UNICODE_dependent wxChar
ProjectManager * GetProjectManager() const
Functions returning pointers to the respective sub-manager instances.
Definition: manager.cpp:429
virtual void ProjectFileRenamed(ProjectFile *pf)
Internal use only.
Definition: cbproject.cpp:1730
DLLIMPORT wxString UnixFilename(const wxString &filename, wxPathFormat format=wxPATH_NATIVE)
Definition: globals.cpp:228
wxTreeItemId m_TreeItemId
Definition: projectfile.h:229
Represents a Code::Blocks project.
Definition: cbproject.h:96
void RenameBuildTarget(const wxString &oldTargetName, const wxString &newTargetName)
Rename a build target this file belongs in.
null_pointer_t nullptr
Definition: nullptr.cpp:16
wxString objectExtension
Definition: compiler.h:217
virtual const wxString & GetTitle() const
Read the target&#39;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
static const wxString sep
virtual cbTreeCtrl * GetTree()=0
Retrieve a pointer to the project manager&#39;s tree (GUI).
pfCustomBuildMap customBuild
A map for custom builds.
Definition: projectfile.h:184
This is a helper class that caches various filenames for one ProjectFile.
Definition: projectfile.h:241
const pfDetails & GetFileDetails(ProjectBuildTarget *target)
Access the file details for this project file for the specified target.
virtual wxString GetBasePath() const
Read the target&#39;s base path, e.g. if GetFilename() returns "/usr/local/bin/xxx", base path will retur...
PFDMap m_PFDMap
Definition: projectfile.h:231
virtual int ShowModal()
wxString wxEmptyString
#define wxOK
static int CompareProjectFiles(ProjectFile *item1, ProjectFile *item2)
Compare relative names of projectfiles.
MacrosManager * GetMacrosManager() const
Definition: manager.cpp:454
void SetCustomBuildCommand(const wxString &compilerId, const wxString &newBuildCommand)
Modify customBuild command for a compilerId.
const wxString & _(const wxString &string)
DLLIMPORT void QuoteStringIfNeeded(wxString &str)
Definition: globals.cpp:260
void ReplaceMacros(wxString &buffer, ProjectBuildTarget *target=nullptr, bool subrequest=false)
int GetBuildTargetsCount()
Definition: cbproject.h:200
In a dir (named by the PCH) on the same level as the source header (default).
Definition: cbproject.h:86
ProjectFilesVector generatedFiles
Auto-generated files when compiling this file.
Definition: projectfile.h:207
ProjectBuildTarget * GetBuildTarget(int index)
Access a build target.
Definition: cbproject.cpp:1392
Abstract base class for compilers.
Definition: compiler.h:274
pfDetails(ProjectBuildTarget *target, ProjectFile *pf)
bool GetExtendedObjectNamesGeneration() const
Gets object names generation mode (extended/normal).
Definition: cbproject.cpp:1586
wxString & Append(const char *psz)
FileVisualState GetFileState() const
bool IsEmpty() const
DLLIMPORT void PlaceWindow(wxTopLevelWindow *w, cbPlaceDialogMode mode=pdlBest, bool enforce=false)
Definition: globals.cpp:1177
wxString GetBaseName() const
wxString GetPath(int flags=wxPATH_GET_VOLUME, wxPathFormat format=wxPATH_NATIVE) const
virtual const wxString & GetCompilerID() const
Read the target&#39;s compiler.
void ReplaceEnvVars(wxString &buffer)
Definition: macrosmanager.h:32
void Rename(const wxString &new_name)
Change filename of the file.
Definition: projectfile.cpp:57
void DoUpdateFileDetails(ProjectBuildTarget *target)
~ProjectFile()
Destructor.
Definition: projectfile.cpp:47
wxString GetFullName() const
FileVisualState m_VisualState
Definition: projectfile.h:228
virtual const CompilerSwitches & GetSwitches() const
Get the compiler&#39;s generic switches.
Definition: compiler.h:301
void SetExt(const wxString &ext)
size_t Add(const wxString &str, size_t copies=1)
cbProject * GetParentProject()
Definition: projectfile.h:93
Represents a Code::Blocks project build target.
void SetUseCustomBuildCommand(const wxString &compilerId, bool useCustomBuildCommand)
Modify &#39;Use custom command to build this file&#39; 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.
Definition: projectfile.cpp:78
void SetFileState(FileVisualState state)
Set the visual state (modified, read-only, etc).
void SetName(const wxString &name)
virtual wxString GetObjectOutput() const
Read the target&#39;s objects output dir.
wxString GetFullPath(wxPathFormat format=wxPATH_NATIVE) const
void Update(ProjectBuildTarget *target, ProjectFile *pf)
ProjectFile(cbProject *prj)
Constructor.
Definition: projectfile.cpp:26
wxString m_ObjName
Definition: projectfile.h:230
DLLIMPORT int cbMessageBox(const wxString &message, const wxString &caption=wxEmptyString, int style=wxOK, wxWindow *parent=NULL, int x=-1, int y=-1)
wxMessageBox wrapper.
Definition: globals.cpp:1395
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...
Definition: projectfile.h:190