mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-26 15:24:35 +02:00
[NEW] Add 2 notification (NPPN_DOCSWITCHINGIN and NPPN_DOCSWITCHINGOFF)messages.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@310 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
521c53918f
commit
2b44819492
@ -326,4 +326,14 @@ 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.hwndFrom = hwndNpp;
|
||||||
//scnNotification->nmhdr.idFrom = 0;
|
//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;
|
||||||
|
//scnNotification->nmhdr.hwndFrom = hwndNpp;
|
||||||
|
//scnNotification->nmhdr.idFrom = currentBufferID;
|
||||||
|
|
||||||
|
#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;
|
||||||
|
|
||||||
#endif //NOTEPAD_PLUS_MSGS_H
|
#endif //NOTEPAD_PLUS_MSGS_H
|
||||||
|
@ -4828,30 +4828,46 @@ void Notepad_plus::docGotoAnotherEditView(FileTransferMode mode)
|
|||||||
//_linkTriggered = true;
|
//_linkTriggered = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Notepad_plus::activateBuffer(BufferID id, int whichOne) {
|
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 = oldBuf;
|
||||||
|
_pluginsManager.notify(&scnN);
|
||||||
|
|
||||||
Buffer * pBuf = MainFileManager->getBufferByID(id);
|
Buffer * pBuf = MainFileManager->getBufferByID(id);
|
||||||
bool reload = pBuf->getNeedReload();
|
bool reload = pBuf->getNeedReload();
|
||||||
if (reload) {
|
if (reload)
|
||||||
|
{
|
||||||
MainFileManager->reloadBuffer(id);
|
MainFileManager->reloadBuffer(id);
|
||||||
pBuf->setNeedReload(false);
|
pBuf->setNeedReload(false);
|
||||||
}
|
}
|
||||||
if (whichOne == MAIN_VIEW) {
|
if (whichOne == MAIN_VIEW)
|
||||||
|
{
|
||||||
if (_mainDocTab.activateBuffer(id)) //only activate if possible
|
if (_mainDocTab.activateBuffer(id)) //only activate if possible
|
||||||
_mainEditView.activateBuffer(id);
|
_mainEditView.activateBuffer(id);
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (_subDocTab.activateBuffer(id))
|
if (_subDocTab.activateBuffer(id))
|
||||||
_subEditView.activateBuffer(id);
|
_subEditView.activateBuffer(id);
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reload) {
|
if (reload)
|
||||||
|
{
|
||||||
performPostReload(whichOne);
|
performPostReload(whichOne);
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyBufferActivated(id, whichOne);
|
notifyBufferActivated(id, whichOne);
|
||||||
|
scnN.nmhdr.code = NPPN_DOCSWITCHINGIN;
|
||||||
|
scnN.nmhdr.hwndFrom = _hSelf;
|
||||||
|
scnN.nmhdr.idFrom = id;
|
||||||
|
_pluginsManager.notify(&scnN);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user