[NEW] Add new notification NPPN_SNAPSHOTDIRTYFILELOADED to notify plugins that a snapshot dirty file is loaded on startup.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1265 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2014-07-26 09:47:14 +00:00
parent d4127c6094
commit 44c291aee5
3 changed files with 21 additions and 1 deletions

View File

@ -531,9 +531,14 @@ enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV
#define DOCSTAUS_READONLY 1
#define DOCSTAUS_BUFFERDIRTY 2
#define NPPN_DOCORDERCHANGED (NPPN_FIRST + 16) // To notify plugins that document order is changed
#define NPPN_DOCORDERCHANGED (NPPN_FIRST + 17) // To notify plugins that document order is changed
//scnNotification->nmhdr.code = NPPN_DOCORDERCHANGED;
//scnNotification->nmhdr.hwndFrom = newIndex;
//scnNotification->nmhdr.idFrom = BufferID;
#define NPPN_SNAPSHOTDIRTYFILELOADED (NPPN_FIRST + 18) // To notify plugins that a snapshot dirty file is loaded on startup
//scnNotification->nmhdr.code = NPPN_SNAPSHOTDIRTYFILELOADED;
//scnNotification->nmhdr.hwndFrom = NULL;
//scnNotification->nmhdr.idFrom = BufferID;
#endif //NOTEPAD_PLUS_MSGS_H

View File

@ -154,6 +154,20 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isRecursive, bool isRe
if (isSnapshotMode)
{
buffer = MainFileManager->loadFile(longFileName, NULL, encoding, backupFileName, fileNameTimestamp);
if (buffer != BUFFER_INVALID)
{
bool isSnapshotMode = backupFileName != NULL && PathFileExists(backupFileName);
if (isSnapshotMode)
{
// To notify plugins that a snapshot dirty file is loaded on startup
SCNotification scnN;
scnN.nmhdr.hwndFrom = 0;
scnN.nmhdr.idFrom = (uptr_t)buffer;
scnN.nmhdr.code = NPPN_SNAPSHOTDIRTYFILELOADED;
_pluginsManager.notify(&scnN);
}
}
}
else
{

View File

@ -538,6 +538,7 @@ BufferID FileManager::loadFile(const TCHAR * filename, Document doc, int encodin
buf->setUnicodeMode(uniCookie);
buf->setFormat(format);
}
//determine buffer properties
++_nextBufferID;
return id;