diff --git a/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h b/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h index d96537991..6d2ad3888 100644 --- a/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h +++ b/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h @@ -320,25 +320,21 @@ enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV //scnNotification->nmhdr.hwndFrom = hwndNpp; //scnNotification->nmhdr.idFrom = BufferID; - #define NPPN_SHUTDOWN (NPPN_FIRST + 9) // To notify plugins that Notepad++ is about to be shutdowned. //scnNotification->nmhdr.code = NPPN_SHUTDOWN; //scnNotification->nmhdr.hwndFrom = hwndNpp; //scnNotification->nmhdr.idFrom = 0; - #define NPPN_DOCSWITCHINGOFF (NPPN_FIRST + 10) // To notify plugins that current doc is about to be switched off. - //scnNotification->nmhdr.code = NPPN_DOCSWITCHINGOFF; + #define NPPN_BUFFERACTIVATED (NPPN_FIRST + 10) // To notify plugins that a buffer was activated (put to foreground). + //scnNotification->nmhdr.code = NPPN_BUFFERACTIVATED; //scnNotification->nmhdr.hwndFrom = hwndNpp; - //scnNotification->nmhdr.idFrom = currentBufferID; + //scnNotification->nmhdr.idFrom = activatedBufferID; - #define NPPN_DOCSWITCHINGIN (NPPN_FIRST + 11) // To notify plugins that current doc is about to be switched in. - //scnNotification->nmhdr.code = NPPN_DOCSWITCHINGIN; - //scnNotification->nmhdr.hwndFrom = hwndNpp; - //scnNotification->nmhdr.idFrom = newBufferID; - - #define NPPN_LANGCHANGED (NPPN_FIRST + 12) // To notify plugins that the language in the current doc is just changed. + #define NPPN_LANGCHANGED (NPPN_FIRST + 11) // To notify plugins that the language in the current doc is just changed. //scnNotification->nmhdr.code = NPPN_LANGCHANGED; //scnNotification->nmhdr.hwndFrom = hwndNpp; //scnNotification->nmhdr.idFrom = currentBufferID; + + #endif //NOTEPAD_PLUS_MSGS_H diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 27d1bbb5d..1eb570600 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -4892,12 +4892,7 @@ void Notepad_plus::docGotoAnotherEditView(FileTransferMode mode) bool Notepad_plus::activateBuffer(BufferID id, int whichOne) { - BufferID oldBuf = _pEditView->getCurrentBufferID(); - SCNotification scnN; - scnN.nmhdr.code = NPPN_DOCSWITCHINGOFF; - scnN.nmhdr.hwndFrom = _hSelf; - scnN.nmhdr.idFrom = (uptr_t)oldBuf; - _pluginsManager.notify(&scnN); + //scnN.nmhdr.code = NPPN_DOCSWITCHINGOFF; //superseeded by NPPN_BUFFERACTIVATED Buffer * pBuf = MainFileManager->getBufferByID(id); bool reload = pBuf->getNeedReload(); @@ -4926,10 +4921,8 @@ bool Notepad_plus::activateBuffer(BufferID id, int whichOne) performPostReload(whichOne); } notifyBufferActivated(id, whichOne); - scnN.nmhdr.code = NPPN_DOCSWITCHINGIN; - //scnN.nmhdr.hwndFrom = _hSelf; - scnN.nmhdr.idFrom = (uptr_t)id; - _pluginsManager.notify(&scnN); + + //scnN.nmhdr.code = NPPN_DOCSWITCHINGIN; //superseeded by NPPN_BUFFERACTIVATED return true; } @@ -8649,6 +8642,12 @@ void Notepad_plus::notifyBufferActivated(BufferID bufid, int view) { ::InvalidateRect(_mainDocTab.getHSelf(), NULL, FALSE); ::InvalidateRect(_subDocTab.getHSelf(), NULL, FALSE); + SCNotification scnN; + scnN.nmhdr.code = NPPN_BUFFERACTIVATED; + scnN.nmhdr.hwndFrom = _hSelf; + scnN.nmhdr.idFrom = (uptr_t)bufid; + _pluginsManager.notify(&scnN); + _linkTriggered = true; }