83
pchSourceDir = 0, /// In a dir (named by the PCH) on the same level as the source header (default).
84
pchObjectDir, /// In the objects output dir, along with other object files.
85
pchSourceFile, /// In a file alongside the source header (with .gch appended).
85
pchSourceDir = 0, /// In a dir (named by the PCH) on the same level as the source header (default).
86
pchObjectDir, /// In the objects output dir, along with other object files.
87
pchSourceFile /// In a file alongside the source header (with .gch appended).
88
90
/** @brief Represents a Code::Blocks project.
105
107
/** (Re)build the project tree.
106
108
* @param tree The wxTreeCtrl to use.
107
109
* @param root The tree item to use as root. The project is built as a child of this item.
108
* @param categorize If true, use virtual folders like "Sources", "Headers", etc.
109
* @param useFolders If true, create folders as needed. If false, the list is flat.
110
* @param ptvs The visual style of the project tree
110
111
* @param fgam If not NULL, use these file groups and masks for virtual folders.
112
void BuildTree(wxTreeCtrl* tree, const wxTreeItemId& root, bool categorize, bool useFolders, FilesGroupsAndMasks* fgam = 0L);
113
void BuildTree(cbTreeCtrl* tree, const wxTreeItemId& root, int ptvs, FilesGroupsAndMasks* fgam = 0L);
114
115
/** This resets the project to a clear state. Like it's just been new'ed. */
115
116
void ClearAllProperties();
146
147
ProjectFile* GetFileByFilename(const wxString& filename, bool isRelative = true, bool isUnixFilename = false);
148
149
/** @return The number of files in the project. */
149
int GetFilesCount(){ return m_Files.GetCount(); }
150
int GetFilesCount(){ return m_Files.size(); }
151
152
/** Set the Makefile filename used when exporting a Makefile for the project,
152
153
* or when using a custom Makefile to build the project.
204
205
void SetDefaultExecuteTarget(const wxString& name);
206
207
/** @return The number of build targets this project contains. */
207
int GetBuildTargetsCount(){ return m_Targets.GetCount(); }
208
int GetBuildTargetsCount() { return m_Targets.GetCount(); }
209
210
/** Access a build target.
210
211
* @param index The build target index. Must be greater or equal to zero and less than GetBuildTargetsCount().
326
327
/** Close all project files.
327
328
* @param dontsave If true, no project file will be saved even if modified.
328
329
* If false, any modified file will be saved (default).
329
* @return True if succesfull, false otherwise.
330
* @return True if successful, false otherwise.
331
332
bool CloseAllFiles(bool dontsave=false);
333
334
/** Save all project files.
334
* @return True if succesfull, false otherwise.
335
* @return True if successful, false otherwise.
336
337
bool SaveAllFiles();
338
339
/** Save the project.
339
* @return True if succesfull, false otherwise.
340
* @return True if successful, false otherwise.
343
344
/** Save the project under a different name.
344
345
* A dialog pops up for the user to choose a new filename for the project.
345
* @return True if succesfull, false otherwise.
346
* @return True if successful, false otherwise.
349
350
/** Save the project's layout.
350
351
* Layout is the list of open project files, which one is active,
351
352
* where the cursor is located on each one of those, etc.
352
* @return True if succesfull, false otherwise.
353
* @return True if successful, false otherwise.
354
355
bool SaveLayout();
356
357
/** Load the project's layout.
357
358
* @see SaveLayout() for info.
358
* @return True if succesfull, false otherwise.
359
* @return True if successful, false otherwise.
360
361
bool LoadLayout();
362
363
/** Notify that file(s) will be added shortly.
363
364
* This function should be called before calling AddFile().
364
365
* When done calling AddFile() as many times as needed, call
367
368
* This sequence of function calls ensures proper events dispatching.
368
369
* This function broadcasts the cbEVT_PROJECT_BEGIN_ADD_FILES event.
370
void BeginAddFiles();
371
void BeginAddFiles();
372
373
/** Notify that file(s) addition finished.
373
374
* This function should be called when done calling AddFile() as many times as needed.
386
387
* This sequence of function calls ensures proper events dispatching.
387
388
* This function broadcasts the cbEVT_PROJECT_BEGIN_REMOVE_FILES event.
389
void BeginRemoveFiles();
390
void BeginRemoveFiles();
391
392
/** Notify that file(s) removal finished.
392
393
* This function should be called when done calling RemoveFile() as many times as needed.
395
396
* This function broadcasts the cbEVT_PROJECT_END_REMOVE_FILES event.
396
397
* @see BeginRemoveFiles().
398
void EndRemoveFiles();
399
void EndRemoveFiles();
400
401
/** Add a file to the project.
401
402
* This variation, takes a target name as first parameter.
420
421
ProjectFile* AddFile(int targetIndex, const wxString& filename, bool compile = true, bool link = true, unsigned short int weight = 50);
422
423
/** Remove a file from the project.
423
* @param index The index of the file.
424
* @return True if @c index was valid, false if not.
426
bool RemoveFile(int index);
428
/** Remove a file from the project.
429
424
* @param pf The pointer to ProjectFile.
430
425
* @return True if @c pf was a valid project file, false if not.
432
427
bool RemoveFile(ProjectFile* pf);
434
Glob(const wxString& path, const wxString& wildCard, bool recursive) : m_Path(path), m_WildCard(wildCard), m_Recursive(recursive) {}
437
/** 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
438
* @param globs the globs to add to the project.
440
void SetGlobs(const std::vector<Glob>& globs);
442
/** Retrieve the current globs from the project
443
* @return globs the globs to add to the project.
445
std::vector<Glob> GetGlobs() const;
434
447
/** Display the project options dialog.
435
448
* @return True if the dialog was closed with "OK", false if closed with "Cancel".
439
452
/** Convenience function for remembering the project's tree state when refreshing it.
440
453
* @return An array of strings containing the tree-path names of expanded nodes.
442
const wxArrayString& ExpandedNodes(){ return m_ExpandedNodes; }
455
const wxArrayString& ExpandedNodes() { return m_ExpandedNodes; }
444
457
/** Convenience function for remembering the project's tree state when refreshing it.
445
458
* Adds an expanded node in this internal list.
446
459
* @param path The tree-path to add.
448
void AddExpandedNode(const wxString& path){ m_ExpandedNodes.Add(path); }
461
void AddExpandedNode(const wxString& path) { m_ExpandedNodes.Add(path); }
450
463
/** Convenience function for remembering the project's tree state when refreshing it.
451
464
* @param tree The tree control to save its expanded state.
478
491
* @return While the project is being built, this function returns the currently building
479
492
* target. For all other times, NULL is returned.
481
ProjectBuildTarget* GetCurrentlyCompilingTarget(){ return m_CurrentlyCompilingTarget; }
494
ProjectBuildTarget* GetCurrentlyCompilingTarget() { return m_CurrentlyCompilingTarget; }
483
496
/** Set the currently compiling target.
484
497
* @note This function is for internal use by compilers only.
559
572
bool CanDragNode(wxTreeCtrl* tree, wxTreeItemId node);
561
/** Notify that a specific tree node has been dragged.
574
/** Notify that an array of tree nodes has been dragged.
563
576
* @note Called by ProjectManager.
564
577
* @return True if succeeded, false if not.
566
bool NodeDragged(wxTreeCtrl* tree, wxTreeItemId from, wxTreeItemId to);
579
bool NodeDragged(wxTreeCtrl* tree, wxArrayTreeItemIds& fromArray, wxTreeItemId to);
568
581
/** Notify that a virtual folder has been added.
569
582
* @return True if it is allowed, false if not. */
678
691
* instead of re-using the existing one (if any).
680
693
virtual void AddToExtensions(const wxString& stringDesc);
682
695
/** Internal use only.
683
696
* Updates the internal hashmap of project files.
685
698
virtual void ProjectFileRenamed(ProjectFile* pf);
700
/** Provides an easy way to iterate all the files belonging in this target.
701
* @return A list of files belonging in this target.
703
virtual FilesList& GetFilesList(){ return m_Files; }
689
707
void ExpandVirtualBuildTargetGroup(const wxString& alias, wxArrayString& result) const;
695
713
void NotifyPlugins(wxEventType type, const wxString& targetName = wxEmptyString, const wxString& oldTargetName = wxEmptyString);
696
714
void CopyTreeNodeRecursively(wxTreeCtrl* tree, const wxTreeItemId& item, const wxTreeItemId& new_parent);
697
715
bool VirtualFolderDragged(wxTreeCtrl* tree, wxTreeItemId from, wxTreeItemId to);
716
void SortChildrenRecursive(cbTreeCtrl* tree, const wxTreeItemId& parent);
700
719
VirtualBuildTargetsMap m_VirtualTargets;
701
BuildTargets m_Targets;
702
wxString m_ActiveTarget;
703
wxString m_LastSavedActiveTarget;
704
wxString m_DefaultExecuteTarget;
706
bool m_CustomMakefile;
707
mutable wxString m_MakefileExecutionDir;
720
BuildTargets m_Targets;
721
wxString m_ActiveTarget;
722
wxString m_LastSavedActiveTarget;
723
wxString m_DefaultExecuteTarget;
725
bool m_CustomMakefile;
726
mutable wxString m_MakefileExecutionDir;
710
wxArrayString m_ExpandedNodes;
712
wxTreeItemId m_ProjectNode;
728
std::vector<Glob> m_Globs;
730
ProjectFileArray m_FileArray;
731
wxArrayString m_ExpandedNodes;
732
wxArrayString m_SelectedNodes;
734
wxTreeItemId m_ProjectNode;
714
736
wxArrayString m_VirtualFolders; // not saved, just used throughout cbProject's lifetime
716
bool m_CurrentlyLoading;
738
bool m_CurrentlyLoading;
717
739
wxString m_CommonTopLevelPath;
718
740
wxString m_BasePath;
720
742
PCHMode m_PCHMode;
722
744
// hashmap for fast searches in cbProject::GetFileByFilename()
723
ProjectFiles m_ProjectFilesMap; // keeps UnixFilename(ProjectFile::relativeFilename)
745
ProjectFiles m_ProjectFilesMap; // keeps UnixFilename(ProjectFile::relativeFilename)
724
746
ProjectBuildTarget* m_CurrentlyCompilingTarget;
726
748
wxDateTime m_LastModified;
728
bool m_ExtendedObjectNamesGeneration;
750
bool m_ExtendedObjectNamesGeneration;
729
751
wxString m_Notes;
730
bool m_AutoShowNotesOnLoad;
752
bool m_AutoShowNotesOnLoad;
732
754
// copy of <Extensions> element, in case certain plugins are disabled
733
755
// so that the contents are not lost