[NEW_BEHAVIOUR] File detection : Switch to modified or deleted file while user is asked to reload or keep the file.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@631 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2010-04-20 19:30:50 +00:00
parent 5aab10a730
commit 0bb88d079b
3 changed files with 17 additions and 3 deletions

View File

@ -3926,11 +3926,19 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask) {
bool autoUpdate = (nppGUI._fileAutoDetection == cdAutoUpdate) || (nppGUI._fileAutoDetection == cdAutoUpdateGo2end); bool autoUpdate = (nppGUI._fileAutoDetection == cdAutoUpdate) || (nppGUI._fileAutoDetection == cdAutoUpdateGo2end);
if (!autoUpdate || buffer->isDirty()) if (!autoUpdate || buffer->isDirty())
{ {
// if file updating is not silently, we switch to the file to update.
int index = _pDocTab->getIndexByBuffer(buffer->getID());
int iView = currentView();
if (index == -1)
iView = otherView();
activateBuffer(buffer->getID(), iView); //activate the buffer in the first view possible
// Then we ask user to update
didDialog = true; didDialog = true;
if (doReloadOrNot(buffer->getFullPathName(), buffer->isDirty()) != IDYES) if (doReloadOrNot(buffer->getFullPathName(), buffer->isDirty()) != IDYES)
break; //abort break; //abort
} }
//activateBuffer(buffer->getID(), iView); //activate the buffer in the first view possible
doReload(buffer->getID(), false); doReload(buffer->getID(), false);
if (mainActive || subActive) if (mainActive || subActive)
{ {
@ -3944,7 +3952,8 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask) {
int iView = currentView(); int iView = currentView();
if (index == -1) if (index == -1)
iView = otherView(); iView = otherView();
//activateBuffer(buffer->getID(), iView); //activate the buffer in the first view possible
activateBuffer(buffer->getID(), iView); //activate the buffer in the first view possible
didDialog = true; didDialog = true;
if (doCloseOrNot(buffer->getFullPathName()) == IDNO) if (doCloseOrNot(buffer->getFullPathName()) == IDNO)
{ {

View File

@ -182,6 +182,11 @@ public:
LRESULT init(HWND hwnd); LRESULT init(HWND hwnd);
LRESULT process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam); LRESULT process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
void killAllChildren(); void killAllChildren();
/*
HWND getWindowHandle() const {
return _pPublicInterface->getHSelf();
};
*/
enum comment_mode {cm_comment, cm_uncomment, cm_toggle}; enum comment_mode {cm_comment, cm_uncomment, cm_toggle};