[NEW_FEATURE] Automatic Backup System (in progress).

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1213 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2014-04-03 18:38:09 +00:00
parent 026aaf94a4
commit db0489c8ed
4 changed files with 40 additions and 26 deletions

View File

@ -235,7 +235,7 @@ public:
}; };
bool fileClose(BufferID id = BUFFER_INVALID, int curView = -1); //use curView to override view to close from bool fileClose(BufferID id = BUFFER_INVALID, int curView = -1); //use curView to override view to close from
bool fileCloseAll(bool doDeleteBackup); bool fileCloseAll(bool doDeleteBackup, bool isBackupMode = false);
bool fileCloseAllButCurrent(); bool fileCloseAllButCurrent();
bool fileCloseAllGiven(const std::vector<int> &krvecBufferIndexes); bool fileCloseAllGiven(const std::vector<int> &krvecBufferIndexes);
bool fileCloseAllToLeft(); bool fileCloseAllToLeft();

View File

@ -1407,7 +1407,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
//Causing them to show on restart even though they are loaded by session //Causing them to show on restart even though they are loaded by session
_lastRecentFileList.setLock(true); //only lock when the session is remembered _lastRecentFileList.setLock(true); //only lock when the session is remembered
} }
bool allClosed = fileCloseAll(false); //try closing files before doing anything else bool allClosed = fileCloseAll(false, true); //try closing files before doing anything else
if (nppgui._rememberLastSession) if (nppgui._rememberLastSession)
{ {

View File

@ -117,7 +117,7 @@ void Notepad_plus::command(int id)
break; break;
case IDM_FILE_CLOSEALL: case IDM_FILE_CLOSEALL:
fileCloseAll(true); fileCloseAll(true, false);
checkDocState(); checkDocState();
break; break;

View File

@ -582,7 +582,7 @@ bool Notepad_plus::fileClose(BufferID id, int curView)
return true; return true;
} }
bool Notepad_plus::fileCloseAll(bool doDeleteBackup) bool Notepad_plus::fileCloseAll(bool doDeleteBackup, bool isBackupMode)
{ {
//closes all documents, makes the current view the only one visible //closes all documents, makes the current view the only one visible
@ -596,6 +596,12 @@ bool Notepad_plus::fileCloseAll(bool doDeleteBackup)
// Do nothing // Do nothing
} }
else if (buf->isDirty()) else if (buf->isDirty())
{
if (isBackupMode)
{
}
else
{ {
activateBuffer(id, MAIN_VIEW); activateBuffer(id, MAIN_VIEW);
if(!activateBuffer(id, SUB_VIEW)) if(!activateBuffer(id, SUB_VIEW))
@ -613,6 +619,7 @@ bool Notepad_plus::fileCloseAll(bool doDeleteBackup)
} }
} }
} }
}
for(int i = 0; i < _subDocTab.nbItem(); ++i) for(int i = 0; i < _subDocTab.nbItem(); ++i)
{ {
BufferID id = _subDocTab.getBufferByIndex(i); BufferID id = _subDocTab.getBufferByIndex(i);
@ -622,6 +629,12 @@ bool Notepad_plus::fileCloseAll(bool doDeleteBackup)
// Do nothing // Do nothing
} }
else if (buf->isDirty()) else if (buf->isDirty())
{
if (isBackupMode)
{
}
else
{ {
activateBuffer(id, SUB_VIEW); activateBuffer(id, SUB_VIEW);
switchEditViewTo(SUB_VIEW); switchEditViewTo(SUB_VIEW);
@ -639,6 +652,7 @@ bool Notepad_plus::fileCloseAll(bool doDeleteBackup)
} }
} }
} }
}
//Then start closing, inactive view first so the active is left open //Then start closing, inactive view first so the active is left open
if (bothActive()) if (bothActive())