Patch #2044 2007-06-09 13:26

raph_

Save all
Download
2044-Save_all.patch (6.4 KB)
Category
Application::FeatureAdd
Status
Accepted
Close date
2007-07-03 10:41
Assigned to
 
Index: src/sdk/editormanager.cpp
===================================================================
--- src/sdk/editormanager.cpp    (revision 4079)
+++ src/sdk/editormanager.cpp    (working copy)
@@ -913,7 +913,7 @@
     for (int i = 0; i < m_pNotebook->GetPageCount(); ++i)
     {
         EditorBase* ed = InternalGetEditorBase(i);
-        if (ed && !ed->Save())
+        if (ed && ed->GetModified() && !ed->Save())
         {
             wxString msg;
             msg.Printf(_("File %s could not be saved..."), ed->GetFilename().c_str());
Index: src/sdk/projectmanager.cpp
===================================================================
--- src/sdk/projectmanager.cpp    (revision 4079)
+++ src/sdk/projectmanager.cpp    (working copy)
@@ -1015,7 +1015,8 @@
     for (int i = 0; i < prjCount; ++i)
     {
         cbProject* project = m_pProjects->Item(i);
-        if (SaveProject(project))
+        bool isModified = project->GetModified();
+        if (isModified && SaveProject(project))
             ++count;
     }
     UnfreezeTree(true);
Index: src/src/main.cpp
===================================================================
--- src/src/main.cpp    (revision 4079)
+++ src/src/main.cpp    (working copy)
@@ -127,6 +127,7 @@
 int idFileOpenDefWorkspace = XRCID("idFileOpenDefWorkspace");
 int idFileSaveWorkspace = XRCID("idFileSaveWorkspace");
 int idFileSaveWorkspaceAs = XRCID("idFileSaveWorkspaceAs");
+int idFileSaveAll = XRCID("idFileSaveAll");
 int idFileCloseWorkspace = XRCID("idFileCloseWorkspace");
 int idFileClose = XRCID("idFileClose");
 int idFileCloseAll = XRCID("idFileCloseAll");
@@ -264,6 +265,7 @@
     EVT_UPDATE_UI(idFileSaveProjectAs, MainFrame::OnProjectMenuUpdateUI)
     EVT_UPDATE_UI(idFileSaveProjectAllProjects, MainFrame::OnProjectMenuUpdateUI)
     EVT_UPDATE_UI(idFileSaveProjectTemplate, MainFrame::OnProjectMenuUpdateUI)
+    EVT_UPDATE_UI(idFileSaveAll, MainFrame::OnProjectMenuUpdateUI)
     EVT_UPDATE_UI(idFileCloseProject, MainFrame::OnProjectMenuUpdateUI)
     EVT_UPDATE_UI(idFileCloseAllProjects, MainFrame::OnProjectMenuUpdateUI)
 
@@ -339,6 +341,7 @@
     EVT_MENU(idFileOpenDefWorkspace,  MainFrame::OnFileOpenDefWorkspace)
     EVT_MENU(idFileSaveWorkspace,  MainFrame::OnFileSaveWorkspace)
     EVT_MENU(idFileSaveWorkspaceAs,  MainFrame::OnFileSaveWorkspaceAs)
+    EVT_MENU(idFileSaveAll,  MainFrame::OnFileSaveAll)
     EVT_MENU(idFileCloseWorkspace,  MainFrame::OnFileCloseWorkspace)
     EVT_MENU(idFileClose,  MainFrame::OnFileClose)
     EVT_MENU(idFileCloseAll,  MainFrame::OnFileCloseAll)
@@ -2337,6 +2340,20 @@
     DoUpdateAppTitle();
 }
 
+void MainFrame::OnFileSaveAll(wxCommandEvent& event)
+{
+    Manager::Get()->GetEditorManager()->SaveAll();
+    Manager::Get()->GetProjectManager()->SaveAllProjects();
+
+    if (Manager::Get()->GetProjectManager()->GetWorkspace()->GetModified()
+        && Manager::Get()->GetProjectManager()->SaveWorkspace())
+    {
+        AddToRecentProjectsHistory(Manager::Get()->GetProjectManager()->GetWorkspace()->GetFilename());
+    }
+    DoUpdateStatusBar();
+    DoUpdateAppTitle();
+}
+
 void MainFrame::OnFileSaveProjectTemplate(wxCommandEvent& event)
 {
     TemplateManager::Get()->SaveUserTemplate(Manager::Get()->GetProjectManager()->GetActiveProject());
Index: src/src/main.h
===================================================================
--- src/src/main.h    (revision 4079)
+++ src/src/main.h    (working copy)
@@ -81,6 +81,7 @@
         void OnFileOpenDefWorkspace(wxCommandEvent& event);
         void OnFileSaveWorkspace(wxCommandEvent& event);
         void OnFileSaveWorkspaceAs(wxCommandEvent& event);
+        void OnFileSaveAll(wxCommandEvent& event);
         void OnFileCloseWorkspace(wxCommandEvent& event);
         void OnFileClose(wxCommandEvent& event);
         void OnFileCloseAll(wxCommandEvent& event);
Index: src/src/resources/main_menu.xrc
===================================================================
--- src/src/resources/main_menu.xrc    (revision 4079)
+++ src/src/resources/main_menu.xrc    (working copy)
@@ -101,8 +101,7 @@
         <help>Save the active file under a different name</help>
       </object>
       <object class="wxMenuItem" name="idFileSaveAllFiles">
-        <label>Save a&amp;ll files</label>
-        <accel>Ctrl-Shift-S</accel>
+        <label>Save all files</label>
         <help>Save all modified files</help>
       </object>
       <object class="separator"/>
@@ -136,6 +135,13 @@
         <help>Close current workspace</help>
       </object>
       <object class="separator"/>
+      <object class="wxMenuItem" name="idFileSaveAll">
+        <label>Save a&amp;ll</label>
+        <bitmap>images\16x16\filesaveall.png</bitmap>
+        <accel>Ctrl-Shift-S</accel>
+        <help>Save all files, projects and the workspace</help>
+      </object>
+      <object class="separator"/>
       <object class="wxMenuItem" name="idFileClose">
         <label>&amp;Close file</label>
         <bitmap>images\16
download for full patch...
raph_ 2007-06-09 13:27
mandrav 2007-07-03 10:41

The shortcut to "Save all" has been changed to Alt-Shift-S.