~ubuntu-branches/ubuntu/oneiric/codeblocks/oneiric

« back to all changes in this revision

Viewing changes to src/include/cbworkspace.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Casadevall
  • Date: 2008-07-17 04:39:23 UTC
  • Revision ID: james.westby@ubuntu.com-20080717043923-gmsy5cwkdjswghkm
Tags: upstream-8.02
ImportĀ upstreamĀ versionĀ 8.02

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
6
#ifndef CBWORKSPACE_H
 
7
#define CBWORKSPACE_H
 
8
 
 
9
#include <wx/string.h>
 
10
#include <wx/filename.h>
 
11
 
 
12
#include "globals.h"
 
13
 
 
14
/**
 
15
  * @brief A workspace class.
 
16
  *
 
17
  * Workspaces are just collections of projects. By loading a workspace,
 
18
  * all the projects it contains are loaded.\n
 
19
  * There is always a workspace open. The default one does not contain any projects.\n
 
20
  * Currently, no inter-project dependencies are supported but at some point
 
21
  * they will be ;)
 
22
  *
 
23
  * @note The way WorkspaceLoader works now, requires that you save and delete the
 
24
  * loaded workspace *before* creating a new one...
 
25
  */
 
26
class cbWorkspace
 
27
{
 
28
    public:
 
29
        /** @brief Constructor
 
30
          *
 
31
          * @param filename The file from which to load the workspace. If this
 
32
          *        parameter is empty, the default workspace is loaded.
 
33
          */
 
34
        cbWorkspace(const wxString& filename = DEFAULT_WORKSPACE);
 
35
 
 
36
        /** @brief Destructor */
 
37
        virtual ~cbWorkspace();
 
38
 
 
39
        /** @brief Save the workspace
 
40
          *
 
41
          * @param force If false (the default), the workspace will not be written to disk,
 
42
          * if it is not marked as modified.
 
43
          * @return True if saving succeeded, false if not.
 
44
          */
 
45
        virtual bool Save(bool force = false);
 
46
 
 
47
        /** @brief Save the workspace under a different filename
 
48
          *
 
49
          * @param filename The name of the file to save.
 
50
          * @return True if saving succeeded, false if not.
 
51
          * @note If the filename parameter is empty, a file dialog to choose
 
52
          * the filename to save will be displayed.
 
53
          */
 
54
        virtual bool SaveAs(const wxString& filename);
 
55
 
 
56
        /** @brief Get the workspace file's name
 
57
          *
 
58
          * @return The name of the file this workspace was loaded from.
 
59
          */
 
60
        virtual wxString GetFilename() const
 
61
        {
 
62
          return m_Filename.GetFullPath();
 
63
        }
 
64
 
 
65
        /** @brief Get the workspace's title
 
66
          *
 
67
          * @return The title of the workspace.
 
68
          */
 
69
        virtual wxString GetTitle() const
 
70
        {
 
71
          return m_Title;
 
72
        }
 
73
 
 
74
        /** @brief Set the workspace's title
 
75
          *
 
76
          * @param title The new title.
 
77
          */
 
78
        virtual void SetTitle(const wxString& title);
 
79
 
 
80
        /** @brief Was this workspace loaded succesfully?
 
81
          *
 
82
          * @return True if the workspace was loaded succesfully, false if not.
 
83
          * @note Because the only way to load a workspace is through its
 
84
          * constructor, and because we don't use exceptions, this is the only
 
85
          * way to know if loading succeeded.
 
86
          */
 
87
        virtual bool IsOK() const { return m_IsOK; }
 
88
 
 
89
        /** @brief Is this workspace the Code::Blocks default?
 
90
          *
 
91
          * @return True if the workspace is the default, false if not.
 
92
          */
 
93
        virtual bool IsDefault() const { return m_IsDefault; }
 
94
 
 
95
        /** @brief Is this workspace modified?
 
96
          *
 
97
          * @return True if the workspace is modified, false if not.
 
98
          * @note A workspace is considered modified when projects
 
99
          * are added-to/removed-from it, when the project's order
 
100
          * is changed or when the active project is changed.
 
101
          */
 
102
        virtual bool GetModified() const { return m_Modified; }
 
103
 
 
104
        /** @brief Mark the workspace as modified or not
 
105
          *
 
106
          * @param modified If true, the workspace will be marked as modified. If
 
107
          * false, the workspace will be marked as unmodified.
 
108
          */
 
109
        virtual void SetModified(bool modified);
 
110
    private:
 
111
        bool m_IsOK; // succeeded loading?
 
112
        bool m_IsDefault; // is this the Code::Blocks default workspace?
 
113
        bool m_Modified; // is it modified?
 
114
        wxFileName m_Filename; // filename
 
115
        wxString m_Title; // title
 
116
 
 
117
        void Load(); // utility function
 
118
};
 
119
 
 
120
#endif // CBWORKSPACE_H