From 44c291aee58cc1a238b4a6f233b24a757e13fa64 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Sat, 26 Jul 2014 09:47:14 +0000 Subject: [PATCH] [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 --- .../src/MISC/PluginsManager/Notepad_plus_msgs.h | 7 ++++++- PowerEditor/src/NppIO.cpp | 14 ++++++++++++++ PowerEditor/src/ScitillaComponent/Buffer.cpp | 1 + 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h b/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h index e8aecc172..9a822c351 100644 --- a/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h +++ b/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h @@ -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 diff --git a/PowerEditor/src/NppIO.cpp b/PowerEditor/src/NppIO.cpp index 66e6ad925..d22be5e95 100644 --- a/PowerEditor/src/NppIO.cpp +++ b/PowerEditor/src/NppIO.cpp @@ -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 { diff --git a/PowerEditor/src/ScitillaComponent/Buffer.cpp b/PowerEditor/src/ScitillaComponent/Buffer.cpp index f37ca3a12..f51a3ee04 100644 --- a/PowerEditor/src/ScitillaComponent/Buffer.cpp +++ b/PowerEditor/src/ScitillaComponent/Buffer.cpp @@ -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;