Index: trunk/src/include/editormanager.h
===================================================================
--- trunk/src/include/editormanager.h (revision 8127)
+++ trunk/src/include/editormanager.h (working copy)
@@ -122,9 +122,11 @@
// If file is modified, queries to save (yes/no/cancel).
// Returns false on "cancel".
bool QueryClose(EditorBase* editor);
+ bool QueryCloseProject(cbProject* project);
bool QueryCloseAll();
- bool CloseAll(bool dontsave=false);
- bool CloseAllExcept(EditorBase* editor, bool dontsave=false);
+ bool CloseProject(cbProject* project, bool dontsave = false);
+ bool CloseAll(bool dontsave = false);
+ bool CloseAllExcept(EditorBase* editor, bool dontsave = false);
bool Save(const wxString& filename);
bool Save(int index);
bool SaveActive();
Index: trunk/src/include/projectmanager.h
===================================================================
--- trunk/src/include/projectmanager.h (revision 8127)
+++ trunk/src/include/projectmanager.h (working copy)
@@ -522,6 +522,7 @@
void OnRenameFile(wxCommandEvent& event);
void OnSaveProject(wxCommandEvent& event);
void OnCloseProject(wxCommandEvent& event);
+ void OnCloseProjectFiles(wxCommandEvent& event);
void OnSaveFile(wxCommandEvent& event);
void OnCloseFile(wxCommandEvent& event);
void OnOpenFile(wxCommandEvent& event);
Index: trunk/src/sdk/editormanager.cpp
===================================================================
--- trunk/src/sdk/editormanager.cpp (revision 8127)
+++ trunk/src/sdk/editormanager.cpp (working copy)
@@ -686,11 +686,48 @@
return true;
}
+bool EditorManager::CloseProject(cbProject* project, bool dontsave)
+{
+ if(!dontsave)
+ if(!QueryCloseProject(project))
+ return false;
+
+ m_pNotebook->Freeze();
+ for (int i = m_pNotebook->GetPageCount() - 1; i >= 0; --i)
+ {
+ EditorBase* eb = InternalGetEditorBase(i);
+ if(eb && eb->IsBuiltinEditor())
+ {
+ ProjectFile* prjf = ((cbEditor*)eb)->GetProjectFile();
+ if(prjf && (prjf->GetParentProject() == project))
+ Close(eb, true);
+ }
+ }
+ m_pNotebook->Thaw();
+ return true;
+}
+
bool EditorManager::CloseAll(bool dontsave)
{
return CloseAllExcept(GetEditor(_("Start here")), dontsave);
}
+bool EditorManager::QueryCloseProject(cbProject* project)
+{
+ for (int i = m_pNotebook->GetPageCount() - 1; i >= 0; --i)
+ {
+ EditorBase* eb = InternalGetEditorBase(i);
+ if(eb && eb->IsBuiltinEditor())
+ {
+ ProjectFile* prjf = ((cbEditor*)eb)->GetProjectFile();
+ if(prjf && (prjf->GetParentProject() == project))
+ if (!QueryClose(eb))
+ return false; // aborted
+ }
+ }
+ return true;
+}
+
bool EditorManager::QueryCloseAll()
{
for (int i = m_pNotebook->GetPageCount() - 1; i >= 0; --i)
Index: trunk/src/sdk/projectmanager.cpp
===================================================================
--- trunk/src/sdk/projectmanager.cpp (revision 8127)
+++ trunk/src/sdk/projectmanager.cpp (working copy)
@@ -79,6 +79,7 @@
int idMenuSaveProject = wxNewId();
int idMenuSaveFile = wxNewId();
int idMenuCloseProject = wxNewId();
+int idMenuCloseProjectFiles = wxNewId();
int idMenuCloseFile = wxNewId();
int idMenuAddFilePopup = wxNewId();
int idMenuAddFilesRecursivelyPopup = wxNewId();
@@ -338,6 +339,7 @@
EVT_MENU(idMenuSaveProject, ProjectManager::OnSaveProject)
EVT_MENU(idMenuSaveFile, ProjectManager::OnSaveFile)
EVT_MENU(idMenuCloseProject, ProjectManager::OnCloseProject)
+ EVT_MENU(idMenuCloseProjectFiles, ProjectManager::OnCloseProjectFiles)
EVT_MENU(idMenuCloseFile, ProjectManager::OnCloseFile)
EVT_MENU(idMenuOpenFile, ProjectManager::OnOpenFile)
EVT_MENU(idMenuProjectNotes, ProjectManager::OnNotes)
@@ -717,6 +719,7 @@
menu.Enable(idMenuSaveProject, PopUpMenuOption);
menu.Append(idMenuCloseProject, _("Close project"));
menu.Enable(idMenuCloseProject, PopUpMenuOption);
+ menu.Append(idMenuCloseProjectFiles, _("Close all project files"));
menu.AppendSeparator();
menu.Append(idMenuAddFilePopup, _("Add files..."));
menu.Enable(idMenuAddFilePopup, PopUpMenuOption);
@@ -2537,6 +2540,22 @@
Manager::Get()->GetAppWindow()->Refresh();
}
+void ProjectManager::OnCloseProjectFiles(wxCommandEvent& WXUNUSED(event))
+{
+ wxTreeItemId sel = GetTreeSelection();
+ if (!sel.IsOk())
+ return;
+
+ FileTreeData* ftd = (FileTreeData*)m_pTree->GetItemData(sel);
+ cbProject *proj = 0;
+ if (ftd)
+ proj = ftd->GetProject();
+
+ if(proj)
+ Manager::Get()->GetEditorManager()->CloseProject(proj);
+ Manager::
download for full patch...