[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-ebc06183d4e3pull/343/head^2
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.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
|
||||
|
|
|
@ -4828,30 +4828,46 @@ void Notepad_plus::docGotoAnotherEditView(FileTransferMode mode)
|
|||
//_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);
|
||||
bool reload = pBuf->getNeedReload();
|
||||
if (reload) {
|
||||
if (reload)
|
||||
{
|
||||
MainFileManager->reloadBuffer(id);
|
||||
pBuf->setNeedReload(false);
|
||||
}
|
||||
if (whichOne == MAIN_VIEW) {
|
||||
if (whichOne == MAIN_VIEW)
|
||||
{
|
||||
if (_mainDocTab.activateBuffer(id)) //only activate if possible
|
||||
_mainEditView.activateBuffer(id);
|
||||
else
|
||||
return false;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_subDocTab.activateBuffer(id))
|
||||
_subEditView.activateBuffer(id);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
if (reload) {
|
||||
if (reload)
|
||||
{
|
||||
performPostReload(whichOne);
|
||||
}
|
||||
|
||||
notifyBufferActivated(id, whichOne);
|
||||
scnN.nmhdr.code = NPPN_DOCSWITCHINGIN;
|
||||
scnN.nmhdr.hwndFrom = _hSelf;
|
||||
scnN.nmhdr.idFrom = id;
|
||||
_pluginsManager.notify(&scnN);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue