mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-23 05:45:00 +02:00
Add NPPM_SETFILENAME.
Implement 3 TODO messages. Fix bug if plugin doesnt clean up Scintilla handles. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@327 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
576ee8ea8c
commit
56563f000d
@ -223,13 +223,22 @@ enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV
|
||||
// allocate fullFilePath with the return values + 1, then call it again to get full path file name
|
||||
|
||||
#define NPPM_GETBUFFERIDFROMPOS (NPPMSG + 59)
|
||||
// TODO
|
||||
//wParam: Position of document
|
||||
//lParam: View to use, 0 = Main, 1 = Secondary
|
||||
//Returns 0 if invalid
|
||||
|
||||
#define NPPM_GETCURRENTBUFFERID (NPPMSG + 60)
|
||||
// TODO
|
||||
//Returns active Buffer
|
||||
|
||||
#define NPPM_RELOADBUFFERID (NPPMSG + 61)
|
||||
// TODO
|
||||
//Reloads Buffer
|
||||
//wParam: Buffer to reload
|
||||
//lParam: 0 if no alert, else alert
|
||||
|
||||
#define NPPM_SETFILENAME (NPPMSG + 63)
|
||||
//wParam: BufferID to rename
|
||||
//lParam: name to set (TCHAR*)
|
||||
//Buffer must have been previously unnamed (eg "new 1" document types)
|
||||
|
||||
/*
|
||||
#define NPPM_ADDREBAR (NPPMSG + 57)
|
||||
|
@ -6719,6 +6719,51 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
||||
}
|
||||
break;
|
||||
|
||||
case NPPM_SETFILENAME:
|
||||
{
|
||||
if (!lParam && !wParam)
|
||||
return FALSE;
|
||||
BufferID id = (BufferID)wParam;
|
||||
Buffer * b = MainFileManager->getBufferByID(id);
|
||||
if (b && b->getStatus() == DOC_UNNAMED) {
|
||||
b->setFileName((const TCHAR*)lParam);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
case NPPM_GETBUFFERIDFROMPOS:
|
||||
{
|
||||
DocTabView * pView = NULL;
|
||||
if (lParam == MAIN_VIEW) {
|
||||
pView = &_mainDocTab;
|
||||
} else if (lParam == SUB_VIEW) {
|
||||
pView = &_subDocTab;
|
||||
} else {
|
||||
return (LRESULT)BUFFER_INVALID;
|
||||
}
|
||||
if ((int)wParam < pView->nbItem()) {
|
||||
return (LRESULT)(pView->getBufferByIndex((int)wParam));
|
||||
}
|
||||
return (LRESULT)BUFFER_INVALID;
|
||||
}
|
||||
break;
|
||||
|
||||
case NPPM_GETCURRENTBUFFERID:
|
||||
{
|
||||
return (LRESULT)(_pEditView->getCurrentBufferID());
|
||||
}
|
||||
break;
|
||||
|
||||
case NPPM_RELOADBUFFERID:
|
||||
{
|
||||
if (!wParam)
|
||||
return FALSE;
|
||||
return doReload((BufferID)wParam, lParam != 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case NPPM_RELOADFILE:
|
||||
{
|
||||
BufferID id = MainFileManager->getBufferFromName((const TCHAR *)lParam);
|
||||
|
@ -335,6 +335,7 @@ private:
|
||||
void destroy() {
|
||||
for (size_t i = 0 ; i < _scintVector.size() ; i++)
|
||||
{
|
||||
_scintVector[i]->destroy();
|
||||
delete _scintVector[i];
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user