~registry/codeblocks/trunk

« back to all changes in this revision

Viewing changes to src/sdk/cbproject.h

  • Committer: mandrav
  • Date: 2007-02-12 14:55:28 UTC
  • Revision ID: svn-v4:98b59c6a-2706-0410-b7d6-d2fa1a1880c9:trunk:3594
* First part of directories layout re-organization: moved all sdk header files to a new dir named "include".

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef CBPROJECT_H
2
 
#define CBPROJECT_H
3
 
 
4
 
#include <wx/datetime.h>
5
 
#include <wx/dynarray.h>
6
 
#include <wx/hashmap.h>
7
 
#include <wx/treectrl.h>
8
 
 
9
 
#include "settings.h"
10
 
#include "openfilestree.h"
11
 
#include "compiletargetbase.h"
12
 
#include "cbplugin.h"
13
 
#include "projectbuildtarget.h"
14
 
 
15
 
#include <map>
16
 
 
17
 
// forward decl
18
 
class cbProject;
19
 
class ProjectBuildTarget;
20
 
class ProjectFile;
21
 
class FilesGroupsAndMasks;
22
 
 
23
 
// hashmap for fast searches in cbProject::GetFileByFilename()
24
 
WX_DECLARE_STRING_HASH_MAP(ProjectFile*, ProjectFiles);
25
 
 
26
 
typedef std::map<wxString, wxArrayString> VirtualBuildTargetsMap;
27
 
 
28
 
class DLLIMPORT FileTreeData : public MiscTreeItemData
29
 
{
30
 
    public:
31
 
        /// The kind of tree node
32
 
        enum FileTreeDataKind
33
 
        {
34
 
            ftdkUndefined = 0,
35
 
            ftdkProject,
36
 
            ftdkFolder,
37
 
            ftdkFile,
38
 
            ftdkVirtualGroup, // wilcard matching
39
 
            ftdkVirtualFolder
40
 
        };
41
 
 
42
 
        FileTreeData(cbProject* project, FileTreeDataKind kind = ftdkUndefined)
43
 
            : m_Index(-1),
44
 
            m_Project(project),
45
 
            m_file(0),
46
 
            m_kind(kind)
47
 
        {}
48
 
 
49
 
        FileTreeDataKind GetKind() const { return m_kind; }
50
 
        cbProject* GetProject() const { return m_Project; }
51
 
        int GetFileIndex() const { return m_Index; }
52
 
        ProjectFile* GetProjectFile() const { return m_file; }
53
 
        const wxString& GetFolder() const { return m_folder; }
54
 
 
55
 
        void SetKind(FileTreeDataKind kind){ m_kind = kind; }
56
 
        void SetProject(cbProject* project){ m_Project = project; }
57
 
        // only valid for file selections
58
 
        void SetFileIndex(int index){ m_Index = index; }
59
 
        void SetProjectFile(ProjectFile* file){ m_file = file; }
60
 
        // only valid for folder selections
61
 
        void SetFolder(const wxString& folder){ m_folder = folder; }
62
 
    private:
63
 
        int m_Index;
64
 
        cbProject* m_Project;
65
 
        ProjectFile* m_file;
66
 
        wxString m_folder;
67
 
        FileTreeDataKind m_kind;
68
 
};
69
 
 
70
 
/** Precompiled headers mode.
71
 
  * Defines where and how are the project's precompiled headers generated.
72
 
  * Currently implemented only for GCC (3.4 and above).
73
 
  */
74
 
enum PCHMode
75
 
{
76
 
    pchSourceDir = 0,   /// In a dir (named by the PCH) on the same level as the source header (default).
77
 
    pchObjectDir,       /// In the objects output dir, along with other object files.
78
 
    pchSourceFile,      /// In a file alongside the source header (with .gch appended).
79
 
};
80
 
 
81
 
/** @brief Represents a Code::Blocks project.
82
 
  *
83
 
  * A project is a collection of build targets and files.
84
 
  * Each project can contain any number of build targets and files.
85
 
  * @see ProjectBuildTarget, ProjectFile.
86
 
  */
87
 
class DLLIMPORT cbProject : public CompileTargetBase
88
 
{
89
 
     public:
90
 
        /// Constructor
91
 
        cbProject(const wxString& filename = wxEmptyString);
92
 
        /// Destructor
93
 
        ~cbProject();
94
 
 
95
 
        /** @return True if the project fully loaded, false if not. */
96
 
        bool IsLoaded(){ return m_Loaded; }
97
 
 
98
 
        /** (Re)build the project tree.
99
 
          * @param tree The wxTreeCtrl to use.
100
 
          * @param root The tree item to use as root. The project is built as a child of this item.
101
 
          * @param categorize If true, use virtual folders like "Sources", "Headers", etc.
102
 
          * @param useFolders If true, create folders as needed. If false, the list is flat.
103
 
          * @param fgam If not NULL, use these file groups and masks for virtual folders.
104
 
          */
105
 
        void BuildTree(wxTreeCtrl* tree, const wxTreeItemId& root, bool categorize, bool useFolders, FilesGroupsAndMasks* fgam = 0L);
106
 
 
107
 
        /** This resets the project to a clear state. Like it's just been new'ed. */
108
 
        void ClearAllProperties();
109
 
 
110
 
        /** Calculates the top-level path common to all project files.
111
 
          * This is called automatically (no need for you to call it) and is used
112
 
          * to find the top-level folder for building the tree.
113
 
          */
114
 
        void CalculateCommonTopLevelPath();
115
 
 
116
 
        /** @return the top-level path common to all project files. */
117
 
        wxString GetCommonTopLevelPath();
118
 
 
119
 
        /** @return True if the project is modified in any way. */
120
 
        bool GetModified();
121
 
 
122
 
        /** Mark the project as modified or not.
123
 
          * @param modified If true, the project is marked as modified. If false, as not-modified.
124
 
          */
125
 
        void SetModified(bool modified = true);
126
 
 
127
 
        /** Access a file of the project.
128
 
          * @param index The index of the file. Must be greater or equal than zero and less than GetFilesCount().
129
 
          * @return A pointer to the file or NULL if not found.
130
 
          */
131
 
        ProjectFile* GetFile(int index);
132
 
 
133
 
        /** Access a file of the project.
134
 
          * @param filename The filename of the file.
135
 
          * @param isRelative True if @c filename is a relative filename, false if not.
136
 
          * @param isUnixFilename True if @c filename is already normalized with UnixFilename(), false if not.
137
 
          * @return A pointer to the file or NULL if not found.
138
 
          */
139
 
        ProjectFile* GetFileByFilename(const wxString& filename, bool isRelative = true, bool isUnixFilename = false);
140
 
 
141
 
        /** @return The number of files in the project. */
142
 
        int GetFilesCount(){ return m_Files.GetCount(); }
143
 
 
144
 
        /** Set the Makefile filename used when exporting a Makefile for the project,
145
 
          * or when using a custom Makefile to build the project.
146
 
          * @param makefile The filename for the Makefile.
147
 
          */
148
 
        void SetMakefile(const wxString& makefile){ m_Makefile = makefile; SetModified(true); }
149
 
 
150
 
        /** @return The filename for the Makefile. */
151
 
        const wxString& GetMakefile();
152
 
 
153
 
        /** Mark if the project should use a custom Makefile for compilation.
154
 
          * @param custom If true, use a custom Makefile for compilation. If false, use direct C::B build mode.
155
 
          */
156
 
        void SetMakefileCustom(bool custom);
157
 
 
158
 
        /** @return True if the project is using a custom Makefile for compilation, false if not. */
159
 
        bool IsMakefileCustom(){ return m_CustomMakefile; }
160
 
 
161
 
        /** Is there a build target (virtual or real) by @c name?
162
 
          * @param name The build target's name.
163
 
          * @param virtuals_too Include virtual build targets in query.
164
 
          * @return True if exists a build target (virtual or real) by that name, false if not.
165
 
          */
166
 
        bool BuildTargetValid(const wxString& name, bool virtuals_too = true) const;
167
 
 
168
 
        /** @return The first valid (virtual or real) build target. */
169
 
        wxString GetFirstValidBuildTargetName(bool virtuals_too = true) const;
170
 
 
171
 
        /** @return The build target index which will be pre-selected when the "Select target"
172
 
          * dialog appears when running the project. Valid only for multi-target projects. */
173
 
        const wxString& GetDefaultExecuteTarget() const;
174
 
 
175
 
        /** Set the build target index which will be pre-selected when the "Select target"
176
 
          * dialog appears when running the project.
177
 
          * @param name The build target's name.
178
 
          */
179
 
        void SetDefaultExecuteTarget(const wxString& name);
180
 
 
181
 
        /** @return The number of build targets this project contains. */
182
 
        int GetBuildTargetsCount(){ return m_Targets.GetCount(); }
183
 
 
184
 
        /** Access a build target.
185
 
          * @param index The build target index. Must be greater or equal to zero and less than GetBuildTargetsCount().
186
 
          * @return The build target or NULL if not found.
187
 
          */
188
 
        ProjectBuildTarget* GetBuildTarget(int index);
189
 
 
190
 
        /** Access a build target.
191
 
          * @param targetName The build target name.
192
 
          * @return The build target or NULL if not found.
193
 
          */
194
 
        ProjectBuildTarget* GetBuildTarget(const wxString& targetName);
195
 
 
196
 
        /** Add a new build target.
197
 
          * @param targetName The build target name.
198
 
          * @return The build target that was just created.
199
 
          */
200
 
        ProjectBuildTarget* AddBuildTarget(const wxString& targetName);
201
 
 
202
 
        /** Rename a build target.
203
 
          * @param index The build target's index to rename.
204
 
          * @param targetName The new name for the build target.
205
 
          * @return True if @c index was valid, false if not.
206
 
          */
207
 
        bool RenameBuildTarget(int index, const wxString& targetName);
208
 
 
209
 
        /** Rename a build target.
210
 
          * @param oldTargetName The build target's old name.
211
 
          * @param newTargetName The new name for the build target.
212
 
          * @return True if @c oldTargetName was valid, false if not.
213
 
          */
214
 
        bool RenameBuildTarget(const wxString& oldTargetName, const wxString& newTargetName);
215
 
 
216
 
        /** Duplicate a build target.
217
 
          * @param index The index of the build target to duplicate.
218
 
          * @param newName The name for the new build target. If empty, it will be named like "Copy of <base_target_name>".
219
 
          * @return The new build target if @c index was valid, NULL if not (or something went wrong).
220
 
          */
221
 
        ProjectBuildTarget* DuplicateBuildTarget(int index, const wxString& newName = wxEmptyString);
222
 
 
223
 
        /** Duplicate a build target.
224
 
          * @param targetName The name of the build target to duplicate.
225
 
          * @param newName The name for the new build target. If empty, it will be named like "Copy of <base_target_name>".
226
 
          * @return The new build target if @c index was valid, NULL if not (or something went wrong).
227
 
          */
228
 
        ProjectBuildTarget* DuplicateBuildTarget(const wxString& targetName, const wxString& newName = wxEmptyString);
229
 
 
230
 
        /** Export a target as a new project.
231
 
          * In other words, save a copy of the project containing only the specified target.
232
 
          * The user will be prompted with a dialog to select the new project name.
233
 
          * @param index The index of the build target to export.
234
 
          * @return True on success, false on failure (or dialog cancellation).
235
 
          * @note The dialog to select the new project name is not a file dialog because
236
 
          * the user is not allowed to save anywhere. The new project must remain "operational"
237
 
          * (assuming the target to export, was "operational") so the new project must be saved
238
 
          * in the same directory as the original to preserve relative paths.
239
 
          */
240
 
        bool ExportTargetAsProject(int index);
241
 
 
242
 
        /** Export a target as a new project.
243
 
          * In other words, save a copy of the project containing only the specified target.
244
 
          * The user will be prompted with a dialog to select the new project name.
245
 
          * @param targetName The name of the build target to export.
246
 
          * @return True on success, false on failure (or dialog cancellation).
247
 
          * @see ExportTargetAsProject(int).
248
 
          */
249
 
        bool ExportTargetAsProject(const wxString& targetName);
250
 
 
251
 
        /** Remove a build target.
252
 
          * @param index The index of the build target to remove.
253
 
          * @return True if @c index was valid, false if not.
254
 
          */
255
 
        bool RemoveBuildTarget(int index);
256
 
 
257
 
        /** Remove a build target.
258
 
          * @param targetName The build target name.
259
 
          * @return True if the @c targetName was valid, false if not.
260
 
          */
261
 
        bool RemoveBuildTarget(const wxString& targetName);
262
 
 
263
 
        /** Reorder the list of build targets.
264
 
          * This is useful, so that when the special build target "All" is being built
265
 
          * targets are built in the desired order.
266
 
          * @param nameOrder An array of strings containing build target names in the order you desire.
267
 
          * The number of array elements must be equal to GetBuildTargetsCount().
268
 
          */
269
 
        void ReOrderTargets(const wxArrayString& nameOrder);
270
 
 
271
 
        /** Set the active build target. Mainly used by the compiler.
272
 
          * @param name The build target name to set as active. If @c name does
273
 
          *             not exist, then the first virtual target is set
274
 
          *             or the first real target, depending which is valid.
275
 
          * @return True if @c name was valid, false if not.
276
 
          */
277
 
        bool SetActiveBuildTarget(const wxString& name);
278
 
 
279
 
        /** @return The active build target name. Note that this might be a virtual target. */
280
 
        const wxString& GetActiveBuildTarget() const;
281
 
 
282
 
        /** @return The mode precompiled headers are handled. */
283
 
        PCHMode GetModeForPCH() const { return m_PCHMode; }
284
 
 
285
 
        /** Set the mode to handle precompiled headers.
286
 
          * @param mode The desired PCH mode.
287
 
          */
288
 
        void SetModeForPCH(PCHMode mode){ m_PCHMode = mode; SetModified(true); }
289
 
 
290
 
        void SetCompilerID(const wxString& id); // overriden
291
 
 
292
 
        /** @return The root item of this project in the project manager's tree. */
293
 
        wxTreeItemId GetProjectNode(){ return m_ProjectNode; }
294
 
 
295
 
        /** Act like closing all project files, but don't do it.
296
 
          * Used to check if any of the project files need saving.
297
 
          * @return True if even one project file needs to be saved, false if not.
298
 
          */
299
 
        bool QueryCloseAllFiles();
300
 
 
301
 
        /** Close all project files.
302
 
          * @param dontsave If true, no project file will be saved even if modified.
303
 
          * If false, any modified file will be saved (default).
304
 
          * @return True if succesfull, false otherwise.
305
 
          */
306
 
        bool CloseAllFiles(bool dontsave=false);
307
 
 
308
 
        /** Save all project files.
309
 
          * @return True if succesfull, false otherwise.
310
 
          */
311
 
        bool SaveAllFiles();
312
 
 
313
 
        /** Save the project.
314
 
          * @return True if succesfull, false otherwise.
315
 
          */
316
 
        bool Save();
317
 
 
318
 
        /** Save the project under a different name.
319
 
          * A dialog pops up for the user to choose a new filename for the project.
320
 
          * @return True if succesfull, false otherwise.
321
 
          */
322
 
        bool SaveAs();
323
 
 
324
 
        /** Save the project's layout.
325
 
          * Layout is the list of open project files, which one is active,
326
 
          * where the cursor is located on each one of those, etc.
327
 
          * @return True if succesfull, false otherwise.
328
 
          */
329
 
        bool SaveLayout();
330
 
 
331
 
        /** Load the project's layout.
332
 
          * @see SaveLayout() for info.
333
 
          * @return True if succesfull, false otherwise.
334
 
          */
335
 
        bool LoadLayout();
336
 
 
337
 
        /** Add a file to the project.
338
 
          * This variation, takes a target name as first parameter.
339
 
          * @param targetName The name of the build target to add this file to.
340
 
          * @param filename The file's filename. This *must* be a filename relative to the project's path.
341
 
          * @param compile If true this file is compiled when building the project.
342
 
          * @param link If true this file is linked when building the project.
343
 
          * @param weight A value between zero and 100 (defaults to 50). Smaller weight, makes the file compile earlier than those with larger weight.
344
 
          * @return The newly added file or NULL if something went wrong.
345
 
          */
346
 
        ProjectFile* AddFile(const wxString& targetName, const wxString& filename, bool compile = true, bool link = true, unsigned short int weight = 50);
347
 
 
348
 
        /** Add a file to the project.
349
 
          * This variation, takes a target index as first parameter.
350
 
          * @param targetIndex The index of the build target to add this file to.
351
 
          * @param filename The file's filename. This *must* be a filename relative to the project's path.
352
 
          * @param compile If true this file is compiled when building the project.
353
 
          * @param link If true this file is linked when building the project.
354
 
          * @param weight A value between zero and 100 (defaults to 50). Smaller weight, makes the file compile earlier than those with larger weight.
355
 
          * @return The newly added file or NULL if something went wrong.
356
 
          */
357
 
        ProjectFile* AddFile(int targetIndex, const wxString& filename, bool compile = true, bool link = true, unsigned short int weight = 50);
358
 
 
359
 
        /** Remove a file from the project.
360
 
          * @param index The index of the file.
361
 
          * @return True if @c index was valid, false if not.
362
 
          */
363
 
        bool RemoveFile(int index);
364
 
 
365
 
        /** Remove a file from the project.
366
 
          * @param pf The pointer to ProjectFile.
367
 
          * @return True if @c pf was a valid project file, false if not.
368
 
          */
369
 
        bool RemoveFile(ProjectFile* pf);
370
 
 
371
 
        /** Display the project options dialog.
372
 
          * @return True if the dialog was closed with "OK", false if closed with "Cancel".
373
 
          */
374
 
        bool ShowOptions();
375
 
 
376
 
        /** Convenience function for remembering the project's tree state when refreshing it.
377
 
          * @return An array of strings containing the tree-path names of expanded nodes.
378
 
          */
379
 
        const wxArrayString& ExpandedNodes(){ return m_ExpandedNodes; }
380
 
 
381
 
        /** Convenience function for remembering the project's tree state when refreshing it.
382
 
          * Adds an expanded node in this internal list.
383
 
          * @param path The tree-path to add.
384
 
          */
385
 
        void AddExpandedNode(const wxString& path){ m_ExpandedNodes.Add(path); }
386
 
 
387
 
        /** Convenience function for remembering the project's tree state when refreshing it.
388
 
          * @param tree The tree control to save its expanded state.
389
 
          */
390
 
        void SaveTreeState(wxTreeCtrl* tree);
391
 
 
392
 
        /** Convenience function for remembering the project's tree state when refreshing it.
393
 
          * @param tree The tree control to restore its expanded state to a previously saved.
394
 
          */
395
 
        void RestoreTreeState(wxTreeCtrl* tree);
396
 
 
397
 
        /** Displays a target selection dialog.
398
 
          * When invoked, a selection dialog is presented to the user so that he/she
399
 
          * can select one target from the list of this project's targets.
400
 
          * @param initial The index of the pre-selected target when the dialog is displayed.
401
 
          * Defaults to none (-1).
402
 
          * @param evenIfOne If true, the dialog is still shown even if the project contains only one target.
403
 
          * The default behaviour is to not show the dialog if the project has only one target.
404
 
          * @return The target's index that the user selected or -1 if the dialog was cancelled.
405
 
          */
406
 
        int SelectTarget(int initial = -1, bool evenIfOne = false);
407
 
 
408
 
        /** Rename the project's title in the tree.
409
 
          * @param newname The new title for the project.
410
 
          * @note This does *not* actually alter the project's title. It just changes it on the tree.
411
 
          */
412
 
        void RenameInTree(const wxString &newname);
413
 
 
414
 
        /** Get a pointer to the currently compiling target.
415
 
          * @return While the project is being built, this function returns the currently building
416
 
          * target. For all other times, NULL is returned.
417
 
          */
418
 
        ProjectBuildTarget* GetCurrentlyCompilingTarget(){ return m_CurrentlyCompilingTarget; }
419
 
 
420
 
        /** Set the currently compiling target.
421
 
          * @note This function is for internal use by compilers only.
422
 
          * Using this function in any other place results in undefined behaviour!
423
 
          * @param bt The build target that is currently building.
424
 
          */
425
 
        void SetCurrentlyCompilingTarget(ProjectBuildTarget* bt);
426
 
 
427
 
        /** Define a new virtual build target.
428
 
          *
429
 
          * A virtual build target is not really a build target itself but it is an alias
430
 
          * for a group of other build targets, real or virtual.
431
 
          * An example is the "All" virtual build target which means "all build targets".
432
 
          *
433
 
          * @param alias The virtual build target's name.
434
 
          * @param targets A list of build target names to include in this virtual build target.
435
 
          *                They can be real or other virtual build targets.
436
 
          * @return True for success, false for failure. The only reason for this function
437
 
          *         to return false is if a *real* build target exists with the same name as @c alias
438
 
          *         (or if you pass an empty @c targets array).
439
 
          * @note Every time you call this function with the same @c alias parameter, the virtual
440
 
          *       build target is re-defined. In other words, it's not an error if @c alias is already
441
 
          *       defined.
442
 
          */
443
 
        bool DefineVirtualBuildTarget(const wxString& alias, const wxArrayString& targets);
444
 
 
445
 
        /** Does a virtual build target exist?
446
 
          *
447
 
          * @param alias The virtual build target's name.
448
 
          * @return True if the virtual build target exists, false if not.
449
 
          */
450
 
        bool HasVirtualBuildTarget(const wxString& alias) const;
451
 
 
452
 
        /** Remove a virtual build target.
453
 
          *
454
 
          * @param alias The virtual build target's name.
455
 
          * @return True if the virtual build target was removed, false if not.
456
 
          */
457
 
        bool RemoveVirtualBuildTarget(const wxString& alias);
458
 
 
459
 
        /** Get a list of all defined virtual build targets.
460
 
          *
461
 
          * @return A list of all defined virtual build targets.
462
 
          */
463
 
        wxArrayString GetVirtualBuildTargets() const;
464
 
 
465
 
        /** Access a virtual build target's group of build targets.
466
 
          *
467
 
          * @param alias The virtual build target's name.
468
 
          * @return The list of all build targets under the alias @c alias.
469
 
          */
470
 
        const wxArrayString& GetVirtualBuildTargetGroup(const wxString& alias) const;
471
 
 
472
 
        /** Access a virtual build target's expanded group of build targets.
473
 
          *
474
 
          * The difference from GetVirtualBuildTargetGroup() lies in that this function
475
 
          * returns the full list of real build targets in this group (by recursively
476
 
          * expanding virtual build targets in the group).
477
 
          * @param alias The virtual build target's name.
478
 
          * @return The expanded list of all real build targets under the alias @c alias.
479
 
          */
480
 
        wxArrayString GetExpandedVirtualBuildTargetGroup(const wxString& alias) const;
481
 
 
482
 
        /** Checks if a build target (virtual or real) can be added to a virtual build target,
483
 
          * without causing a circular-reference.
484
 
          *
485
 
          * @param alias The "parent" virtual build target to add the build target in.
486
 
          * @param target The build target to add in the @c alias virtual build target.
487
 
          * @return True if a circular reference is not detected, false if it is.
488
 
          */
489
 
        bool CanAddToVirtualBuildTarget(const wxString& alias, const wxString& target);
490
 
 
491
 
        /** Request if a specific tree node can be dragged.
492
 
          *
493
 
          * @note Called by ProjectManager.
494
 
          * @return True if it is allowed to drag this node, false not.
495
 
          */
496
 
        bool CanDragNode(wxTreeCtrl* tree, wxTreeItemId node);
497
 
 
498
 
        /** Notify that a specific tree node has been dragged.
499
 
          *
500
 
          * @note Called by ProjectManager.
501
 
          * @return True if succeeded, false if not.
502
 
          */
503
 
        bool NodeDragged(wxTreeCtrl* tree, wxTreeItemId from, wxTreeItemId to);
504
 
 
505
 
        /** Notify that a virtual folder has been added.
506
 
          * @return True if it is allowed, false if not. */
507
 
        bool VirtualFolderAdded(wxTreeCtrl* tree, wxTreeItemId parent_node, const wxString& virtual_folder);
508
 
 
509
 
        /** Notify that a virtual folder has been deleted. */
510
 
        void VirtualFolderDeleted(wxTreeCtrl* tree, wxTreeItemId node);
511
 
 
512
 
        /** Notify that a virtual folder has been renamed.
513
 
          * @return True if the renaming is allowed, false if not. */
514
 
        bool VirtualFolderRenamed(wxTreeCtrl* tree, wxTreeItemId node, const wxString& new_name);
515
 
 
516
 
        /** Get a list of the virtual folders. Normally used by the project loader only.*/
517
 
        const wxArrayString& GetVirtualFolders() const;
518
 
 
519
 
        /** Set the virtual folders list. Normally used by the project loader only. */
520
 
        void SetVirtualFolders(const wxArrayString& folders);
521
 
 
522
 
        /** Returns the last modification time for the file. Used to detect modifications outside the Program. */
523
 
        wxDateTime GetLastModificationTime() const { return m_LastModified; }
524
 
 
525
 
        /** Sets the last modification time for the project to 'now'. Used to detect modifications outside the Program. */
526
 
        void Touch();
527
 
 
528
 
        /** Sets object names generation to extended/normal mode.
529
 
          *
530
 
          * In normal mode (the default), the file @c foo.cpp generates the @c foo.o object file.
531
 
          * In extended mode, the file @c foo.cpp generates the @c foo.cpp.o object file.
532
 
          *
533
 
          * This option is useful for large projects containing similarly named files
534
 
          * (in the same directory) differing only on their extensions. Using the
535
 
          * extended mode with said projects guarantees that each object name will
536
 
          * be unique.
537
 
          *
538
 
          * @param ext Set to true to switch to extended mode, false for normal mode.
539
 
          */
540
 
        void SetExtendedObjectNamesGeneration(bool ext);
541
 
 
542
 
        /** Gets object names generation mode (extended/normal).
543
 
          * @return True for extended mode, false for normal mode.
544
 
          * @see SetExtendedObjectNamesGeneration.
545
 
          */
546
 
        bool GetExtendedObjectNamesGeneration() const;
547
 
 
548
 
        /** Set notes on the project.
549
 
          *
550
 
          * @param notes Simple text notes about the project.
551
 
          */
552
 
        void SetNotes(const wxString& notes);
553
 
 
554
 
        /** Get notes on the project.
555
 
          *
556
 
          * @return Simple text notes about the project.
557
 
          */
558
 
        const wxString& GetNotes() const;
559
 
 
560
 
        /** Set show project notes on load automatically.
561
 
          *
562
 
          * @param show If true show project notes on load.
563
 
          */
564
 
        void SetShowNotesOnLoad(bool show);
565
 
 
566
 
        /** Get show project notes on load automatically.
567
 
          *
568
 
          * @return True if show project notes on load is set, false if not.
569
 
          */
570
 
        bool GetShowNotesOnLoad() const;
571
 
 
572
 
        /** Show project notes now.
573
 
          *
574
 
          * @param nonEmptyOnly If true, show notes only if non-empty.
575
 
          * @param editable If true, the notes will be editable.
576
 
          *
577
 
          * @note If @c editable is true, the @c nonEmptyOnly parameter is ignored...
578
 
          */
579
 
        void ShowNotes(bool nonEmptyOnly, bool editable = false);
580
 
 
581
 
        /** Changes project title
582
 
          *
583
 
          * This function overrides CompileTargetBase::SetTitle.
584
 
          * It sends additional notification event to plugins
585
 
          * and than calls base function.
586
 
          */
587
 
        virtual void SetTitle(const wxString& title);
588
 
 
589
 
    private:
590
 
        void Open();
591
 
        void ExpandVirtualBuildTargetGroup(const wxString& alias, wxArrayString& result) const;
592
 
        wxTreeItemId AddTreeNode(wxTreeCtrl* tree, const wxString& text, const wxTreeItemId& parent, bool useFolders, FileTreeData::FileTreeDataKind folders_kind, bool compiles, int image, FileTreeData* data = 0L);
593
 
        wxTreeItemId FindNodeToInsertAfter(wxTreeCtrl* tree, const wxString& text, const wxTreeItemId& parent, bool in_folders); // alphabetical sorting
594
 
        ProjectBuildTarget* AddDefaultBuildTarget();
595
 
        int IndexOfBuildTargetName(const wxString& targetName) const;
596
 
        wxString CreateUniqueFilename();
597
 
        void NotifyPlugins(wxEventType type);
598
 
        void CopyTreeNodeRecursively(wxTreeCtrl* tree, const wxTreeItemId& item, const wxTreeItemId& new_parent);
599
 
 
600
 
        // properties
601
 
        VirtualBuildTargetsMap m_VirtualTargets;
602
 
        BuildTargets m_Targets;
603
 
        wxString m_ActiveTarget;
604
 
        wxString  m_LastSavedActiveTarget;
605
 
        wxString m_DefaultExecuteTarget;
606
 
        wxString m_Makefile;
607
 
        bool m_CustomMakefile;
608
 
 
609
 
        FilesList m_Files;
610
 
        wxArrayString m_ExpandedNodes;
611
 
        bool m_Loaded;
612
 
        wxTreeItemId m_ProjectNode;
613
 
 
614
 
        wxArrayString m_VirtualFolders; // not saved, just used throughout cbProject's lifetime
615
 
 
616
 
        bool m_CurrentlyLoading;
617
 
        wxString m_CommonTopLevelPath;
618
 
        wxString m_BasePath;
619
 
 
620
 
        PCHMode m_PCHMode;
621
 
 
622
 
        // hashmap for fast searches in cbProject::GetFileByFilename()
623
 
        ProjectFiles m_ProjectFilesMap; // keeps UnixFilename(ProjectFile::relativeFilename)
624
 
        ProjectBuildTarget* m_CurrentlyCompilingTarget;
625
 
 
626
 
        wxDateTime m_LastModified;
627
 
 
628
 
        bool m_ExtendedObjectNamesGeneration;
629
 
        wxString m_Notes;
630
 
        bool m_AutoShowNotesOnLoad;
631
 
};
632
 
 
633
 
#endif // CBPROJECT_H
634
 
 
635