Code::Blocks
SVN r11506
|
A workspace class. More...
#include <cbworkspace.h>
Public Member Functions | |
cbWorkspace (const wxString &filename=DEFAULT_WORKSPACE) | |
Constructor. More... | |
virtual | ~cbWorkspace () |
Destructor. More... | |
virtual bool | Save (bool force=false) |
Save the workspace. More... | |
virtual bool | SaveAs (const wxString &filename) |
Save the workspace under a different filename. More... | |
virtual wxString | GetFilename () const |
Get the workspace file's name. More... | |
virtual wxString | GetTitle () const |
Get the workspace's title. More... | |
virtual void | SetTitle (const wxString &title) |
Set the workspace's title. More... | |
virtual bool | IsOK () const |
Was this workspace loaded successfully? More... | |
virtual bool | IsDefault () const |
Is this workspace the Code::Blocks default? More... | |
virtual bool | GetModified () const |
Is this workspace modified? More... | |
virtual void | SetModified (bool modified) |
Mark the workspace as modified or not. More... | |
void | SetPreferredTarget (const wxString &target) |
Set the preferred target for this workspace. More... | |
wxString | GetPreferredTarget () const |
Get the preferred target for this workspace. More... | |
void | ActiveProjectChanged () |
bool | SaveLayout () |
Private Member Functions | |
void | Load () |
bool | LoadLayout () |
Private Attributes | |
bool | m_IsOK |
bool | m_IsDefault |
bool | m_Modified |
wxFileName | m_Filename |
wxString | m_Title |
wxString | m_PreferredTargetName |
A workspace class.
Workspaces are just collections of projects. By loading a workspace, all the projects it contains are loaded.
There is always a workspace open. The default one does not contain any projects.
Currently, no inter-project dependencies are supported but at some point they will be ;)
Definition at line 26 of file cbworkspace.h.
cbWorkspace::cbWorkspace | ( | const wxString & | filename = DEFAULT_WORKSPACE | ) |
Constructor.
filename | The file from which to load the workspace. If this parameter is empty, the default workspace is loaded. |
Definition at line 26 of file cbworkspace.cpp.
References DEFAULT_WORKSPACE, ConfigManager::GetConfigFolder(), wxString::IsEmpty(), Load(), m_Filename, m_IsDefault, wxString::Matches(), wxDirExists(), and wxMkdir().
|
virtual |
Destructor.
Definition at line 58 of file cbworkspace.cpp.
void cbWorkspace::ActiveProjectChanged | ( | ) |
Definition at line 170 of file cbworkspace.cpp.
References SaveLayout().
Referenced by ProjectManager::SetProject().
|
inlinevirtual |
Get the workspace file's name.
Definition at line 60 of file cbworkspace.h.
Referenced by MacrosManager::ClearProjectKeys(), CompilerGCC::InitBuildLog(), MainFrame::OnFileSaveAll(), MainFrame::OnFileSaveWorkspace(), MainFrame::OnFileSaveWorkspaceAs(), and ProjectManagerUI::RebuildTree().
|
inlinevirtual |
Is this workspace modified?
Definition at line 102 of file cbworkspace.h.
Referenced by MainFrame::OnFileMenuUpdateUI(), MainFrame::OnFileSaveAll(), ProjectManagerUI::QueryCloseWorkspace(), and ProjectManager::ReloadProject().
wxString cbWorkspace::GetPreferredTarget | ( | ) | const |
Get the preferred target for this workspace.
Definition at line 165 of file cbworkspace.cpp.
References m_PreferredTargetName.
|
inlinevirtual |
Get the workspace's title.
Definition at line 69 of file cbworkspace.h.
Referenced by MacrosManager::ClearProjectKeys(), ProjectManager::EndLoadingWorkspace(), CompilerGCC::InitBuildLog(), ProjectManagerUI::OnRenameWorkspace(), ProjectManagerUI::QueryCloseWorkspace(), and ProjectManagerUI::RebuildTree().
|
inlinevirtual |
Is this workspace the Code::Blocks default?
Definition at line 93 of file cbworkspace.h.
Referenced by MainFrame::OnFileOpenDefWorkspace(), MainFrame::OnFileSaveAll(), and ProjectManagerUI::QueryCloseWorkspace().
|
inlinevirtual |
Was this workspace loaded successfully?
Definition at line 87 of file cbworkspace.h.
Referenced by ProjectManager::EndLoadingWorkspace(), and ProjectManager::LoadWorkspace().
|
private |
Definition at line 62 of file cbworkspace.cpp.
References _(), _T, wxString::c_str(), cbMessageBox(), LogManager::DebugLog(), F(), wxFileName::FileExists(), FileTypeOf(), ftCodeBlocksWorkspace, Manager::Get(), wxFileName::GetFullPath(), Manager::GetLogManager(), wxString::IsEmpty(), LoadLayout(), m_Filename, m_IsDefault, m_IsOK, m_Title, IBaseWorkspaceLoader::Open(), wxString::Printf(), wxFileName::SetExt(), SetModified(), FileFilters::WORKSPACE_EXT, wxString::wx_str(), wxCENTRE, wxICON_ERROR, and wxOK.
Referenced by cbWorkspace().
|
private |
Definition at line 190 of file cbworkspace.cpp.
References _T, LogManager::DebugLog(), F(), wxFileName::FileExists(), Manager::Get(), wxFileName::GetFullPath(), Manager::GetLogManager(), WorkspaceLoader::LoadLayout(), m_Filename, wxFileName::SetExt(), and wxString::wx_str().
Referenced by Load().
|
virtual |
Save the workspace.
force | If false (the default), the workspace will not be written to disk, if it is not marked as modified. |
Definition at line 102 of file cbworkspace.cpp.
References _(), _T, cbMessageBox(), LogManager::DebugLog(), F(), Manager::Get(), wxFileName::GetFullPath(), Manager::GetLogManager(), wxString::IsEmpty(), m_Filename, m_Modified, m_Title, WorkspaceLoader::Save(), SaveAs(), SaveLayout(), SetModified(), wxString::wx_str(), and wxICON_WARNING.
Referenced by SaveAs(), and ProjectManager::SaveWorkspace().
|
virtual |
Save the workspace under a different filename.
filename | The name of the file to save. |
Definition at line 123 of file cbworkspace.cpp.
References _(), _T, DEFAULT_WORKSPACE, Manager::Get(), wxFileName::GetExt(), FileFilters::GetFilterString(), wxFileName::GetFullName(), wxFileName::GetPath(), m_Filename, m_IsDefault, wxString::Matches(), PlaceWindow(), Save(), wxFileName::SetExt(), FileFilters::WORKSPACE_EXT, wxEmptyString, wxFD_OVERWRITE_PROMPT, wxFD_SAVE, and wxID_OK.
Referenced by Save(), and ProjectManager::SaveWorkspaceAs().
bool cbWorkspace::SaveLayout | ( | ) |
Definition at line 175 of file cbworkspace.cpp.
References _T, LogManager::DebugLog(), F(), Manager::Get(), wxFileName::GetFullPath(), Manager::GetLogManager(), m_Filename, WorkspaceLoader::SaveLayout(), wxFileName::SetExt(), and wxString::wx_str().
Referenced by ActiveProjectChanged(), ProjectManagerUI::QueryCloseWorkspace(), and Save().
|
virtual |
Mark the workspace as modified or not.
modified | If true, the workspace will be marked as modified. If false, the workspace will be marked as unmodified. |
Definition at line 153 of file cbworkspace.cpp.
References m_Modified.
Referenced by ProjectManager::AddProjectDependency(), ProjectManager::ClearProjectDependencies(), ProjectManager::CloseProject(), ProjectManager::EndLoadingProject(), ProjectManager::GetWorkspace(), Load(), ProjectManagerUI::MoveProjectDown(), ProjectManagerUI::MoveProjectUp(), ProjectManager::ReloadProject(), ProjectManager::RemoveProjectDependency(), ProjectManager::RemoveProjectFromAllDependencies(), Save(), and SetTitle().
void cbWorkspace::SetPreferredTarget | ( | const wxString & | target | ) |
Set the preferred target for this workspace.
Definition at line 159 of file cbworkspace.cpp.
References wxString::IsEmpty(), and m_PreferredTargetName.
Referenced by WorkspaceLoader::LoadLayout(), and CompilerGCC::OnSelectTarget().
|
virtual |
Set the workspace's title.
title | The new title. |
Definition at line 147 of file cbworkspace.cpp.
References m_Title, and SetModified().
Referenced by ProjectManager::GetWorkspace(), and ProjectManagerUI::OnRenameWorkspace().
|
private |
Definition at line 126 of file cbworkspace.h.
Referenced by cbWorkspace(), Load(), LoadLayout(), Save(), SaveAs(), and SaveLayout().
|
private |
Definition at line 124 of file cbworkspace.h.
Referenced by cbWorkspace(), Load(), and SaveAs().
|
private |
Definition at line 123 of file cbworkspace.h.
Referenced by Load().
|
private |
Definition at line 125 of file cbworkspace.h.
Referenced by Save(), and SetModified().
|
private |
Definition at line 128 of file cbworkspace.h.
Referenced by GetPreferredTarget(), and SetPreferredTarget().
|
private |
Definition at line 127 of file cbworkspace.h.
Referenced by Load(), Save(), and SetTitle().