[NEW] Add NPPN_FILEBEFORELOAD and NPPN_FILELOADFAILED messages.
[BUG_FIXED] Fix New document not be switched while db clicking in Find in files result panel. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@446 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
4826c0b011
commit
91b9b03ff7
@ -329,7 +329,6 @@ enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV
|
|||||||
// INT NPPM_GETCURRENTCOLUMN(0, 0)
|
// INT NPPM_GETCURRENTCOLUMN(0, 0)
|
||||||
// return the caret current position column
|
// return the caret current position column
|
||||||
|
|
||||||
|
|
||||||
#define VAR_NOT_RECOGNIZED 0
|
#define VAR_NOT_RECOGNIZED 0
|
||||||
#define FULL_CURRENT_PATH 1
|
#define FULL_CURRENT_PATH 1
|
||||||
#define CURRENT_DIRECTORY 2
|
#define CURRENT_DIRECTORY 2
|
||||||
@ -416,4 +415,14 @@ enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV
|
|||||||
// UCHAR _key;
|
// UCHAR _key;
|
||||||
//};
|
//};
|
||||||
|
|
||||||
|
#define NPPN_FILEBEFORELOAD (NPPN_FIRST + 14) // To notify plugins that the current file is about to be loaded
|
||||||
|
//scnNotification->nmhdr.code = NPPN_FILEBEFOREOPEN;
|
||||||
|
//scnNotification->nmhdr.hwndFrom = hwndNpp;
|
||||||
|
//scnNotification->nmhdr.idFrom = NULL;
|
||||||
|
|
||||||
|
#define NPPN_FILELOADFAILED (NPPN_FIRST + 15) // To notify plugins that file open operation failed
|
||||||
|
//scnNotification->nmhdr.code = NPPN_FILEOPENFAILED;
|
||||||
|
//scnNotification->nmhdr.hwndFrom = hwndNpp;
|
||||||
|
//scnNotification->nmhdr.idFrom = BufferID;
|
||||||
|
|
||||||
#endif //NOTEPAD_PLUS_MSGS_H
|
#endif //NOTEPAD_PLUS_MSGS_H
|
||||||
|
@ -633,12 +633,26 @@ bool Notepad_plus::loadSession(Session & session)
|
|||||||
BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly)
|
BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly)
|
||||||
{
|
{
|
||||||
TCHAR longFileName[MAX_PATH];
|
TCHAR longFileName[MAX_PATH];
|
||||||
|
|
||||||
::GetFullPathName(fileName, MAX_PATH, longFileName, NULL);
|
::GetFullPathName(fileName, MAX_PATH, longFileName, NULL);
|
||||||
::GetLongPathName(longFileName, longFileName, MAX_PATH);
|
::GetLongPathName(longFileName, longFileName, MAX_PATH);
|
||||||
|
|
||||||
_lastRecentFileList.remove(longFileName);
|
_lastRecentFileList.remove(longFileName);
|
||||||
|
|
||||||
BufferID test = MainFileManager->getBufferFromName(longFileName);
|
const TCHAR * fileName2Find;
|
||||||
|
generic_string gs_fileName = fileName;
|
||||||
|
size_t res = gs_fileName.find_first_of(UNTITLED_STR);
|
||||||
|
|
||||||
|
if (res != string::npos && res == 0)
|
||||||
|
{
|
||||||
|
fileName2Find = fileName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fileName2Find = longFileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
BufferID test = MainFileManager->getBufferFromName(fileName2Find);
|
||||||
if (test != BUFFER_INVALID)
|
if (test != BUFFER_INVALID)
|
||||||
{
|
{
|
||||||
//switchToFile(test);
|
//switchToFile(test);
|
||||||
@ -655,11 +669,14 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly)
|
|||||||
return test;
|
return test;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isFileSession(longFileName) && PathFileExists(longFileName)) {
|
if (isFileSession(longFileName) && PathFileExists(longFileName))
|
||||||
|
{
|
||||||
fileLoadSession(longFileName);
|
fileLoadSession(longFileName);
|
||||||
return BUFFER_INVALID;
|
return BUFFER_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!PathFileExists(longFileName))
|
if (!PathFileExists(longFileName))
|
||||||
{
|
{
|
||||||
TCHAR str2display[MAX_PATH*2];
|
TCHAR str2display[MAX_PATH*2];
|
||||||
@ -693,6 +710,14 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Notify plugins that current file is about to load
|
||||||
|
// Plugins can should use this notification to filter SCN_MODIFIED
|
||||||
|
SCNotification scnN;
|
||||||
|
scnN.nmhdr.code = NPPN_FILEBEFORELOAD;
|
||||||
|
scnN.nmhdr.hwndFrom = _hSelf;
|
||||||
|
scnN.nmhdr.idFrom = NULL;
|
||||||
|
_pluginsManager.notify(&scnN);
|
||||||
|
|
||||||
BufferID buffer = MainFileManager->loadFile(longFileName);
|
BufferID buffer = MainFileManager->loadFile(longFileName);
|
||||||
if (buffer != BUFFER_INVALID)
|
if (buffer != BUFFER_INVALID)
|
||||||
{
|
{
|
||||||
@ -703,10 +728,8 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly)
|
|||||||
if (isReadOnly)
|
if (isReadOnly)
|
||||||
buf->setUserReadOnly(true);
|
buf->setUserReadOnly(true);
|
||||||
|
|
||||||
// Notify plugins that current file is just opened
|
// Notify plugins that current file is about to open
|
||||||
SCNotification scnN;
|
|
||||||
scnN.nmhdr.code = NPPN_FILEBEFOREOPEN;
|
scnN.nmhdr.code = NPPN_FILEBEFOREOPEN;
|
||||||
scnN.nmhdr.hwndFrom = _hSelf;
|
|
||||||
scnN.nmhdr.idFrom = (uptr_t)buffer;
|
scnN.nmhdr.idFrom = (uptr_t)buffer;
|
||||||
_pluginsManager.notify(&scnN);
|
_pluginsManager.notify(&scnN);
|
||||||
|
|
||||||
@ -763,6 +786,9 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly)
|
|||||||
lstrcat(msg, TEXT("\"."));
|
lstrcat(msg, TEXT("\"."));
|
||||||
::MessageBox(_hSelf, msg, TEXT("ERR"), MB_OK);
|
::MessageBox(_hSelf, msg, TEXT("ERR"), MB_OK);
|
||||||
_isFileOpening = false;
|
_isFileOpening = false;
|
||||||
|
|
||||||
|
scnN.nmhdr.code = NPPN_FILELOADFAILED;
|
||||||
|
_pluginsManager.notify(&scnN);
|
||||||
}
|
}
|
||||||
return BUFFER_INVALID;
|
return BUFFER_INVALID;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
FileManager * FileManager::_pSelf = new FileManager();
|
FileManager * FileManager::_pSelf = new FileManager();
|
||||||
|
|
||||||
const int blockSize = 128 * 1024 + 4;
|
const int blockSize = 128 * 1024 + 4;
|
||||||
const TCHAR UNTITLED_STR[] = TEXT("new ");
|
|
||||||
|
|
||||||
// Ordre important!! Ne le changes pas!
|
// Ordre important!! Ne le changes pas!
|
||||||
//SC_EOL_CRLF (0), SC_EOL_CR (1), or SC_EOL_LF (2).
|
//SC_EOL_CRLF (0), SC_EOL_CR (1), or SC_EOL_LF (2).
|
||||||
@ -173,7 +172,6 @@ bool Buffer::checkFileState() { //returns true if the status has been changed (i
|
|||||||
doNotify(BufferChangeStatus | BufferChangeReadonly | BufferChangeTimestamp);
|
doNotify(BufferChangeStatus | BufferChangeReadonly | BufferChangeTimestamp);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!generic_stat(_fullPathName, &buf))
|
if (!generic_stat(_fullPathName, &buf))
|
||||||
|
@ -55,6 +55,7 @@ struct HeaderLineState {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const int userLangNameMax = 16;
|
const int userLangNameMax = 16;
|
||||||
|
const TCHAR UNTITLED_STR[] = TEXT("new ");
|
||||||
|
|
||||||
//File manager class maintains all buffers
|
//File manager class maintains all buffers
|
||||||
class Buffer;
|
class Buffer;
|
||||||
|
Loading…
Reference in New Issue
Block a user