[BUG_FIXED] Fix file association Unicode bug.

[BUG_FIXED] Fix WindowDlg close file bug.
[BUG_FIXED] Add html.xml, sql.xml and rc.xml into installer.
[CHANGE] Change the reload from disk behaviour.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@337 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2008-10-05 20:20:17 +00:00
parent 22f25219e2
commit af23902b82
11 changed files with 168 additions and 127 deletions

View File

@ -2,16 +2,33 @@ Notepad++ v5.1 fixed bugs and added features (from v5.0.3) :
1. Make Notepad++ Unicode-compliant application(Unicode path supported). 1. Make Notepad++ Unicode-compliant application(Unicode path supported).
2. Fix crash issue due to the incoherent modification/creation date. 2. Fix crash issue due to the incoherent modification/creation date.
3. Fix tag match highlighting mismatched bug. 3. Enhance Find in files feature : launch in thread, stop as wish.
4. Make tag match highlighting on non html zone optional. 4. Fix tag match highlighting mismatched bug.
5. Refine the Save/Open file directory settings (follow tab/last operation/user defined dir). 5. Make tag match highlighting on non html zone optional.
6. Add "Doc go to new instance" and "Doc open in new instance" features. 6. Fix cpu high consumption bug while document is cloned with smart highlighting and xml matched highlighting features activating.
7. Add new pluin notification NPPN_DOCACTIVATED and NPPN_LANGCHANGED. 7. Refine the Save/Open file directory settings (follow tab/last operation/user defined dir).
8. Fix context menu incorrect setting crash bug. 8. Add "Doc go to new instance" and "Doc open in new instance" features.
9. Fix a problem with Incremental search+UTF8 in win9x. 9. Move document to another instance of Notepad++ via drag and drop document tab.
10. Fix bug with CPP lexer keyword list. 10. Add new pluin notification NPPN_DOCACTIVATED and NPPN_LANGCHANGED.
11. Fix context menu incorrect setting crash bug.
12. Fix crash problem while typing Chinese character in ANSI CSS document under Chinese environment.
13. Fix a problem with Incremental search+UTF8 in win9x.
14. Fix the User defined language not working in Unicode version bug.
15. Fix bug with CPP lexer keyword list.
16. Fix auto-completion not woring for HTML, SQL and RC problem.
17. Remove all the comic sans font (finally :) ).
Included plugins (Unicode):
1. TexFX v0.24a
2. MIME Tools v1.5
3. NppExport v0.2.8
4. Doc Monitor v2.2
5. NppAutoIndent 1.2
6. FTP_synchronize v0.9.6
7. NppAutoIndent 1.2
Included plugins (ANSI): Included plugins (ANSI):
1. TexFX v0.24a 1. TexFX v0.24a
@ -24,10 +41,3 @@ Included plugins (ANSI):
8. Light Explorer v1.5 8. Light Explorer v1.5
9. Doc Monitor v2.2 9. Doc Monitor v2.2
10. NppAutoIndent 1.2 10. NppAutoIndent 1.2
Included plugins (Unicode):
1. MIME Tools v1.5
2. NppExport v0.2.8
3. Doc Monitor v2.2
4. NppAutoIndent 1.2
5. FTP_synchronize v0.9.6

View File

@ -571,6 +571,16 @@ SubSection "Auto-completion Files" autoCompletionComponent
File "..\bin\plugins\APIs\html.xml" File "..\bin\plugins\APIs\html.xml"
SectionEnd SectionEnd
Section RC
SetOutPath "$INSTDIR\plugins\APIs"
File "..\bin\plugins\APIs\rc.xml"
SectionEnd
Section SQL
SetOutPath "$INSTDIR\plugins\APIs"
File "..\bin\plugins\APIs\sql.xml"
SectionEnd
Section PHP Section PHP
SetOutPath "$INSTDIR\plugins\APIs" SetOutPath "$INSTDIR\plugins\APIs"
File "..\bin\plugins\APIs\php.xml" File "..\bin\plugins\APIs\php.xml"
@ -816,6 +826,21 @@ SubSection un.autoCompletionComponent
RMDir "$INSTDIR\plugins\APIs\" RMDir "$INSTDIR\plugins\APIs\"
SectionEnd SectionEnd
Section un.HTML
Delete "$INSTDIR\plugins\APIs\html.xml"
RMDir "$INSTDIR\plugins\APIs\"
SectionEnd
Section un.SQL
Delete "$INSTDIR\plugins\APIs\sql.xml"
RMDir "$INSTDIR\plugins\APIs\"
SectionEnd
Section un.RC
Delete "$INSTDIR\plugins\APIs\rc.xml"
RMDir "$INSTDIR\plugins\APIs\"
SectionEnd
Section un.VB Section un.VB
Delete "$INSTDIR\plugins\APIs\vb.xml" Delete "$INSTDIR\plugins\APIs\vb.xml"
RMDir "$INSTDIR\plugins\APIs\" RMDir "$INSTDIR\plugins\APIs\"

View File

@ -230,7 +230,7 @@ void RegExtDlg::getRegisteredExts()
{ {
//TCHAR valName[extNameLen]; //TCHAR valName[extNameLen];
TCHAR valData[extNameLen]; TCHAR valData[extNameLen];
int valDataLen = extNameLen; int valDataLen = extNameLen * sizeof(TCHAR);
int valType; int valType;
HKEY hKey2Check; HKEY hKey2Check;
extNameActualLen = extNameLen; extNameActualLen = extNameLen;
@ -269,17 +269,16 @@ void RegExtDlg::addExt(TCHAR *ext)
if (nRet == ERROR_SUCCESS) if (nRet == ERROR_SUCCESS)
{ {
int valDataLen = 256; TCHAR valData[MAX_PATH];
TCHAR valData[256]; int valDataLen = MAX_PATH * sizeof(TCHAR);
if (dwDisp == REG_OPENED_EXISTING_KEY) if (dwDisp == REG_OPENED_EXISTING_KEY)
{ {
int res = ::RegQueryValueEx(hKey, TEXT(""), NULL, NULL, (LPBYTE)valData, (LPDWORD)&valDataLen); int res = ::RegQueryValueEx(hKey, TEXT(""), NULL, NULL, (LPBYTE)valData, (LPDWORD)&valDataLen);
if (res == ERROR_SUCCESS) if (res == ERROR_SUCCESS)
::RegSetValueEx(hKey, nppBackup, 0, REG_SZ, (LPBYTE)valData, valDataLen+1); ::RegSetValueEx(hKey, nppBackup, 0, REG_SZ, (LPBYTE)valData, valDataLen);
} }
::RegSetValueEx(hKey, NULL, 0, REG_SZ, (LPBYTE)nppName, lstrlen(nppName)+1); ::RegSetValueEx(hKey, NULL, 0, REG_SZ, (LPBYTE)nppName, (lstrlen(nppName)+1)*sizeof(TCHAR));
::RegCloseKey(hKey); ::RegCloseKey(hKey);
} }
@ -302,7 +301,7 @@ bool RegExtDlg::deleteExts(const TCHAR *ext2Delete)
else else
{ {
TCHAR valData[extNameLen]; TCHAR valData[extNameLen];
int valDataLen = extNameLen; int valDataLen = extNameLen*sizeof(TCHAR);
int valType; int valType;
int res = ::RegQueryValueEx(hKey, nppBackup, NULL, (LPDWORD)&valType, (LPBYTE)valData, (LPDWORD)&valDataLen); int res = ::RegQueryValueEx(hKey, nppBackup, NULL, (LPDWORD)&valType, (LPBYTE)valData, (LPDWORD)&valDataLen);
@ -344,7 +343,7 @@ void RegExtDlg::writeNppPath()
{ {
// Write the value for new document // Write the value for new document
::RegOpenKeyEx(HKEY_CLASSES_ROOT, nppName, 0, KEY_ALL_ACCESS, &hRootKey); ::RegOpenKeyEx(HKEY_CLASSES_ROOT, nppName, 0, KEY_ALL_ACCESS, &hRootKey);
::RegSetValueEx(hRootKey, NULL, 0, REG_SZ, (LPBYTE)nppDoc, lstrlen(nppDoc)+1); ::RegSetValueEx(hRootKey, NULL, 0, REG_SZ, (LPBYTE)nppDoc, (lstrlen(nppDoc)+1)*sizeof(TCHAR));
TCHAR nppPath[MAX_PATH]; TCHAR nppPath[MAX_PATH];
::GetModuleFileName(_hInst, nppPath, MAX_PATH); ::GetModuleFileName(_hInst, nppPath, MAX_PATH);
@ -352,7 +351,7 @@ void RegExtDlg::writeNppPath()
TCHAR nppPathParam[256] = TEXT("\""); TCHAR nppPathParam[256] = TEXT("\"");
lstrcat(lstrcat(nppPathParam, nppPath), TEXT("\" \"%1\"")); lstrcat(lstrcat(nppPathParam, nppPath), TEXT("\" \"%1\""));
::RegSetValueEx(hKey, NULL, 0, REG_SZ, (LPBYTE)nppPathParam, lstrlen(nppPathParam)+1); ::RegSetValueEx(hKey, NULL, 0, REG_SZ, (LPBYTE)nppPathParam, (lstrlen(nppPathParam)+1)*sizeof(TCHAR));
} }
RegCloseKey(hKey); RegCloseKey(hKey);
} }

View File

@ -722,7 +722,7 @@ bool Notepad_plus::doReload(BufferID id, bool alert)
*/ */
if (alert) if (alert)
{ {
if (::MessageBox(_hSelf, TEXT("Do you want to reload the current file?"), TEXT("Reload"), MB_YESNO | MB_ICONQUESTION | MB_APPLMODAL) != IDYES) if (::MessageBox(_hSelf, TEXT("Are you sure you want to reload the current file and lose the changes made in Notepad++?"), TEXT("Reload"), MB_YESNO | MB_ICONEXCLAMATION | MB_APPLMODAL) != IDYES)
return false; return false;
} }
@ -793,9 +793,9 @@ void Notepad_plus::doClose(BufferID id, int whichOne) {
_pluginsManager.notify(&scnN); _pluginsManager.notify(&scnN);
//add to recent files if its an existing file //add to recent files if its an existing file
if (!buf->isUntitled() && PathFileExists(buf->getFilePath())) if (!buf->isUntitled() && PathFileExists(buf->getFullPathName()))
{ {
_lastRecentFileList.add(buf->getFilePath()); _lastRecentFileList.add(buf->getFullPathName());
} }
int nrDocs = whichOne==MAIN_VIEW?(_mainDocTab.nbItem()):(_subDocTab.nbItem()); int nrDocs = whichOne==MAIN_VIEW?(_mainDocTab.nbItem()):(_subDocTab.nbItem());
@ -823,7 +823,7 @@ void Notepad_plus::fileNew()
bool Notepad_plus::fileReload() bool Notepad_plus::fileReload()
{ {
BufferID buf = _pEditView->getCurrentBufferID(); BufferID buf = _pEditView->getCurrentBufferID();
return doReload(buf, true); return doReload(buf, buf->isDirty());
} }
generic_string exts2Filters(generic_string exts) { generic_string exts2Filters(generic_string exts) {
@ -985,7 +985,7 @@ bool Notepad_plus::fileSave(BufferID id)
if (!buf->getFileReadOnly() && buf->isDirty()) //cannot save if readonly if (!buf->getFileReadOnly() && buf->isDirty()) //cannot save if readonly
{ {
const TCHAR *fn = buf->getFilePath(); const TCHAR *fn = buf->getFullPathName();
if (buf->isUntitled()) if (buf->isUntitled())
{ {
return fileSaveAs(id); return fileSaveAs(id);
@ -1062,7 +1062,7 @@ bool Notepad_plus::fileSave(BufferID id)
::CopyFile(fn, fn_dateTime_bak.c_str(), FALSE); ::CopyFile(fn, fn_dateTime_bak.c_str(), FALSE);
} }
return doSave(bufferID, buf->getFilePath(), false); return doSave(bufferID, buf->getFullPathName(), false);
} }
} }
return false; return false;
@ -1152,7 +1152,7 @@ bool Notepad_plus::fileDelete(BufferID id, int curView)
bufferID = _pEditView->getCurrentBufferID(); bufferID = _pEditView->getCurrentBufferID();
Buffer * buf = MainFileManager->getBufferByID(bufferID); Buffer * buf = MainFileManager->getBufferByID(bufferID);
const TCHAR *fileNamePath = buf->getFilePath(); const TCHAR *fileNamePath = buf->getFullPathName();
if (PathFileExists(fileNamePath)) if (PathFileExists(fileNamePath))
return false; return false;
@ -1174,7 +1174,7 @@ bool Notepad_plus::fileDelete(BufferID id, int curView)
bufferID = _pEditView->getCurrentBufferID(); bufferID = _pEditView->getCurrentBufferID();
Buffer * buf = MainFileManager->getBufferByID(bufferID); Buffer * buf = MainFileManager->getBufferByID(bufferID);
const TCHAR *fileNamePath = buf->getFilePath(); const TCHAR *fileNamePath = buf->getFullPathName();
if (doDeleteOrNot(fileNamePath) == IDYES) if (doDeleteOrNot(fileNamePath) == IDYES)
{ {
@ -1200,7 +1200,7 @@ bool Notepad_plus::fileClose(BufferID id, int curView)
int res; int res;
//process the fileNamePath into LRF //process the fileNamePath into LRF
const TCHAR *fileNamePath = buf->getFilePath(); const TCHAR *fileNamePath = buf->getFullPathName();
if (buf->isDirty()) if (buf->isDirty())
{ {
@ -1242,7 +1242,7 @@ bool Notepad_plus::fileCloseAll()
BufferID id = _mainDocTab.getBufferByIndex(i); BufferID id = _mainDocTab.getBufferByIndex(i);
Buffer * buf = MainFileManager->getBufferByID(id); Buffer * buf = MainFileManager->getBufferByID(id);
if (buf->isDirty()) { if (buf->isDirty()) {
int res = doSaveOrNot(buf->getFilePath()); int res = doSaveOrNot(buf->getFullPathName());
if (res == IDYES) { if (res == IDYES) {
if (!fileSave(id)) if (!fileSave(id))
return false; //abort entire procedure return false; //abort entire procedure
@ -1256,7 +1256,7 @@ bool Notepad_plus::fileCloseAll()
BufferID id = _subDocTab.getBufferByIndex(i); BufferID id = _subDocTab.getBufferByIndex(i);
Buffer * buf = MainFileManager->getBufferByID(id); Buffer * buf = MainFileManager->getBufferByID(id);
if (buf->isDirty()) { if (buf->isDirty()) {
int res = doSaveOrNot(buf->getFilePath()); int res = doSaveOrNot(buf->getFullPathName());
if (res == IDYES) { if (res == IDYES) {
if (!fileSave(id)) if (!fileSave(id))
return false; //abort entire procedure return false; //abort entire procedure
@ -1298,7 +1298,7 @@ bool Notepad_plus::fileCloseAllButCurrent()
continue; continue;
Buffer * buf = MainFileManager->getBufferByID(id); Buffer * buf = MainFileManager->getBufferByID(id);
if (buf->isDirty()) { if (buf->isDirty()) {
int res = doSaveOrNot(buf->getFilePath()); int res = doSaveOrNot(buf->getFullPathName());
if (res == IDYES) { if (res == IDYES) {
if (!fileSave(id)) if (!fileSave(id))
return false; //abort entire procedure return false; //abort entire procedure
@ -1314,7 +1314,7 @@ bool Notepad_plus::fileCloseAllButCurrent()
if (id == current) if (id == current)
continue; continue;
if (buf->isDirty()) { if (buf->isDirty()) {
int res = doSaveOrNot(buf->getFilePath()); int res = doSaveOrNot(buf->getFullPathName());
if (res == IDYES) { if (res == IDYES) {
if (!fileSave(id)) if (!fileSave(id))
return false; //abort entire procedure return false; //abort entire procedure
@ -1635,7 +1635,7 @@ bool Notepad_plus::findInOpenedFiles() {
{ {
pBuf = MainFileManager->getBufferByID(_mainDocTab.getBufferByIndex(i)); pBuf = MainFileManager->getBufferByID(_mainDocTab.getBufferByIndex(i));
_invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument()); _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument());
nbTotal += _findReplaceDlg.processAll(ProcessFindAll, NULL, NULL, isEntireDoc, pBuf->getFilePath()); nbTotal += _findReplaceDlg.processAll(ProcessFindAll, NULL, NULL, isEntireDoc, pBuf->getFullPathName());
} }
} }
@ -1645,7 +1645,7 @@ bool Notepad_plus::findInOpenedFiles() {
{ {
pBuf = MainFileManager->getBufferByID(_subDocTab.getBufferByIndex(i)); pBuf = MainFileManager->getBufferByID(_subDocTab.getBufferByIndex(i));
_invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument()); _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument());
nbTotal += _findReplaceDlg.processAll(ProcessFindAll, NULL, NULL, isEntireDoc, pBuf->getFilePath()); nbTotal += _findReplaceDlg.processAll(ProcessFindAll, NULL, NULL, isEntireDoc, pBuf->getFullPathName());
} }
} }
@ -1701,7 +1701,7 @@ void Notepad_plus::checkDocState()
bool isCurrentDirty = curBuf->isDirty(); bool isCurrentDirty = curBuf->isDirty();
bool isSeveralDirty = isCurrentDirty; bool isSeveralDirty = isCurrentDirty;
bool isFileExisting = PathFileExists(curBuf->getFilePath()) != FALSE; bool isFileExisting = PathFileExists(curBuf->getFullPathName()) != FALSE;
if (!isCurrentDirty) if (!isCurrentDirty)
{ {
for(int i = 0; i < MainFileManager->getNrBuffers(); i++) for(int i = 0; i < MainFileManager->getNrBuffers(); i++)
@ -1977,7 +1977,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
else else
{ {
generic_string quotFileName = TEXT("\""); generic_string quotFileName = TEXT("\"");
quotFileName += _pEditView->getCurrentBuffer()->getFilePath(); quotFileName += _pEditView->getCurrentBuffer()->getFullPathName();
quotFileName += TEXT("\""); quotFileName += TEXT("\"");
COPYDATASTRUCT fileNamesData; COPYDATASTRUCT fileNamesData;
fileNamesData.dwData = COPYDATA_FILENAMES; fileNamesData.dwData = COPYDATA_FILENAMES;
@ -1995,7 +1995,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
int iView = isFromPrimary?MAIN_VIEW:SUB_VIEW; int iView = isFromPrimary?MAIN_VIEW:SUB_VIEW;
if (buf->isDirty()) if (buf->isDirty())
{ {
::MessageBox(_hSelf, TEXT("Buffer can not be dirty"), TEXT(""), MB_OK); ::MessageBox(_hSelf, TEXT("Document is modified, save it then try again."), TEXT("Go to another Notepad++ instance"), MB_OK);
} }
else else
{ {
@ -2339,7 +2339,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
_tabPopupMenu.enableItem(IDM_EDIT_SETREADONLY, !isSysReadOnly); _tabPopupMenu.enableItem(IDM_EDIT_SETREADONLY, !isSysReadOnly);
_tabPopupMenu.enableItem(IDM_EDIT_CLEARREADONLY, isSysReadOnly); _tabPopupMenu.enableItem(IDM_EDIT_CLEARREADONLY, isSysReadOnly);
bool isFileExisting = PathFileExists(buf->getFilePath()) != FALSE; bool isFileExisting = PathFileExists(buf->getFullPathName()) != FALSE;
_tabPopupMenu.enableItem(IDM_FILE_DELETE, isFileExisting); _tabPopupMenu.enableItem(IDM_FILE_DELETE, isFileExisting);
_tabPopupMenu.enableItem(IDM_FILE_RENAME, isFileExisting); _tabPopupMenu.enableItem(IDM_FILE_RENAME, isFileExisting);
@ -2450,13 +2450,13 @@ BOOL Notepad_plus::notify(SCNotification *notification)
{ {
BufferID idd = _mainDocTab.getBufferByIndex(id); BufferID idd = _mainDocTab.getBufferByIndex(id);
Buffer * buf = MainFileManager->getBufferByID(idd); Buffer * buf = MainFileManager->getBufferByID(idd);
tip = buf->getFilePath(); tip = buf->getFullPathName();
} }
else if (hWin == _subDocTab.getHSelf()) else if (hWin == _subDocTab.getHSelf())
{ {
BufferID idd = _subDocTab.getBufferByIndex(id); BufferID idd = _subDocTab.getBufferByIndex(id);
Buffer * buf = MainFileManager->getBufferByID(idd); Buffer * buf = MainFileManager->getBufferByID(idd);
tip = buf->getFilePath(); tip = buf->getFullPathName();
} }
else else
break; break;
@ -3072,10 +3072,10 @@ void Notepad_plus::command(int id)
{ {
Buffer * buf = _pEditView->getCurrentBuffer(); Buffer * buf = _pEditView->getCurrentBuffer();
if (id == IDM_EDIT_FULLPATHTOCLIP) { if (id == IDM_EDIT_FULLPATHTOCLIP) {
str2Cliboard(buf->getFilePath()); str2Cliboard(buf->getFullPathName());
} else if (id == IDM_EDIT_CURRENTDIRTOCLIP) { } else if (id == IDM_EDIT_CURRENTDIRTOCLIP) {
TCHAR dir[MAX_PATH]; TCHAR dir[MAX_PATH];
lstrcpy(dir, buf->getFilePath()); lstrcpy(dir, buf->getFullPathName());
PathRemoveFileSpec((TCHAR *)dir); PathRemoveFileSpec((TCHAR *)dir);
str2Cliboard(dir); str2Cliboard(dir);
} else if (id == IDM_EDIT_FILENAMETOCLIP) { } else if (id == IDM_EDIT_FILENAMETOCLIP) {
@ -4548,7 +4548,7 @@ void Notepad_plus::setTitle()
if (buf->isDirty()) { if (buf->isDirty()) {
result += TEXT("*"); result += TEXT("*");
} }
result += buf->getFilePath(); result += buf->getFullPathName();
result += TEXT(" - "); result += TEXT(" - ");
result += _className; result += _className;
::SetWindowText(_hSelf, result.c_str()); ::SetWindowText(_hSelf, result.c_str());
@ -6204,14 +6204,14 @@ void Notepad_plus::getTaskListInfo(TaskListInfo *tli)
BufferID bufID = _pDocTab->getBufferByIndex(i); BufferID bufID = _pDocTab->getBufferByIndex(i);
Buffer * b = MainFileManager->getBufferByID(bufID); Buffer * b = MainFileManager->getBufferByID(bufID);
int status = b->isReadOnly()?tb_ro:(b->isDirty()?tb_unsaved:tb_saved); int status = b->isReadOnly()?tb_ro:(b->isDirty()?tb_unsaved:tb_saved);
tli->_tlfsLst.push_back(TaskLstFnStatus(currentView(), i, b->getFilePath(), status)); tli->_tlfsLst.push_back(TaskLstFnStatus(currentView(), i, b->getFullPathName(), status));
} }
for (size_t i = 0 ; i < nonCurrentNbDoc ; i++) for (size_t i = 0 ; i < nonCurrentNbDoc ; i++)
{ {
BufferID bufID = _pNonDocTab->getBufferByIndex(i); BufferID bufID = _pNonDocTab->getBufferByIndex(i);
Buffer * b = MainFileManager->getBufferByID(bufID); Buffer * b = MainFileManager->getBufferByID(bufID);
int status = b->isReadOnly()?tb_ro:(b->isDirty()?tb_unsaved:tb_saved); int status = b->isReadOnly()?tb_ro:(b->isDirty()?tb_unsaved:tb_saved);
tli->_tlfsLst.push_back(TaskLstFnStatus(otherView(), i, b->getFilePath(), status)); tli->_tlfsLst.push_back(TaskLstFnStatus(otherView(), i, b->getFullPathName(), status));
} }
} }
@ -6983,7 +6983,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
{ {
TCHAR str[MAX_PATH]; TCHAR str[MAX_PATH];
// par defaut : NPPM_GETCURRENTDIRECTORY // par defaut : NPPM_GETCURRENTDIRECTORY
TCHAR *fileStr = lstrcpy(str, _pEditView->getCurrentBuffer()->getFilePath()); TCHAR *fileStr = lstrcpy(str, _pEditView->getCurrentBuffer()->getFullPathName());
if (Message == NPPM_GETCURRENTDIRECTORY) if (Message == NPPM_GETCURRENTDIRECTORY)
PathRemoveFileSpec(str); PathRemoveFileSpec(str);
@ -7116,7 +7116,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
{ {
BufferID id = _mainDocTab.getBufferByIndex(i); BufferID id = _mainDocTab.getBufferByIndex(i);
Buffer * buf = MainFileManager->getBufferByID(id); Buffer * buf = MainFileManager->getBufferByID(id);
lstrcpy(fileNames[j++], buf->getFilePath()); lstrcpy(fileNames[j++], buf->getFullPathName());
} }
} }
if (Message != NPPM_GETOPENFILENAMESPRIMARY) { if (Message != NPPM_GETOPENFILENAMESPRIMARY) {
@ -7124,7 +7124,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
{ {
BufferID id = _subDocTab.getBufferByIndex(i); BufferID id = _subDocTab.getBufferByIndex(i);
Buffer * buf = MainFileManager->getBufferByID(id); Buffer * buf = MainFileManager->getBufferByID(id);
lstrcpy(fileNames[j++], buf->getFilePath()); lstrcpy(fileNames[j++], buf->getFullPathName());
} }
} }
return j; return j;
@ -8117,9 +8117,10 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
{ {
//loop through nmdlg->nItems, get index and close it //loop through nmdlg->nItems, get index and close it
for (int i = 0; i < (int)nmdlg->nItems; i++) { for (int i = 0; i < (int)nmdlg->nItems; i++) {
fileClose(_pDocTab->getBufferByIndex(i), currentView()); fileClose(_pDocTab->getBufferByIndex(nmdlg->Items[i]), currentView());
nmdlg->Items[i] = 0xFFFFFFFF; // indicate file was closed
UINT pos = nmdlg->Items[i]; UINT pos = nmdlg->Items[i];
nmdlg->Items[i] = 0xFFFFFFFF; // indicate file was closed
for (int j=i+1; j<(int)nmdlg->nItems; ++j) for (int j=i+1; j<(int)nmdlg->nItems; ++j)
if (nmdlg->Items[j] > pos) if (nmdlg->Items[j] > pos)
--nmdlg->Items[j]; --nmdlg->Items[j];
@ -8179,8 +8180,6 @@ LRESULT CALLBACK Notepad_plus::Notepad_plus_Proc(HWND hwnd, UINT Message, WPARAM
void Notepad_plus::fullScreenToggle() void Notepad_plus::fullScreenToggle()
{ {
HMONITOR currentMonitor; //Handle to monitor where fullscreen should go
MONITORINFO mi; //Info of that monitor
RECT fullscreenArea; //RECT used to calculate window fullscrene size RECT fullscreenArea; //RECT used to calculate window fullscrene size
_isfullScreen = !_isfullScreen; _isfullScreen = !_isfullScreen;
@ -8195,6 +8194,10 @@ void Notepad_plus::fullScreenToggle()
fullscreenArea.right = GetSystemMetrics(SM_CXSCREEN); fullscreenArea.right = GetSystemMetrics(SM_CXSCREEN);
fullscreenArea.bottom = GetSystemMetrics(SM_CYSCREEN); fullscreenArea.bottom = GetSystemMetrics(SM_CYSCREEN);
//if (_winVersion != WV_NT)
{
HMONITOR currentMonitor; //Handle to monitor where fullscreen should go
MONITORINFO mi; //Info of that monitor
//Caution, this will not work on windows 95, so probably add some checking of some sorts like Unicode checks, IF 95 were to be supported //Caution, this will not work on windows 95, so probably add some checking of some sorts like Unicode checks, IF 95 were to be supported
currentMonitor = MonitorFromWindow(_hSelf, MONITOR_DEFAULTTONEAREST); //should always be valid monitor handle currentMonitor = MonitorFromWindow(_hSelf, MONITOR_DEFAULTTONEAREST); //should always be valid monitor handle
mi.cbSize = sizeof(MONITORINFO); mi.cbSize = sizeof(MONITORINFO);
@ -8204,7 +8207,7 @@ void Notepad_plus::fullScreenToggle()
fullscreenArea.right -= fullscreenArea.left; fullscreenArea.right -= fullscreenArea.left;
fullscreenArea.bottom -= fullscreenArea.top; fullscreenArea.bottom -= fullscreenArea.top;
} }
}
//Hide menu //Hide menu
::SetMenu(_hSelf, NULL); ::SetMenu(_hSelf, NULL);
@ -8375,12 +8378,12 @@ void Notepad_plus::getCurrentOpenedFiles(Session & session)
{ {
BufferID bufID = _mainDocTab.getBufferByIndex(i); BufferID bufID = _mainDocTab.getBufferByIndex(i);
Buffer * buf = MainFileManager->getBufferByID(bufID); Buffer * buf = MainFileManager->getBufferByID(bufID);
if (!buf->isUntitled() && PathFileExists(buf->getFilePath())) if (!buf->isUntitled() && PathFileExists(buf->getFullPathName()))
{ {
generic_string languageName = getLangFromMenu( buf ); generic_string languageName = getLangFromMenu( buf );
const TCHAR *langName = languageName.c_str(); const TCHAR *langName = languageName.c_str();
sessionFileInfo sfi(buf->getFilePath(), langName, buf->getPosition(&_mainEditView)); sessionFileInfo sfi(buf->getFullPathName(), langName, buf->getPosition(&_mainEditView));
//_mainEditView.activateBuffer(buf->getID()); //_mainEditView.activateBuffer(buf->getID());
_invisibleEditView.execute(SCI_SETDOCPOINTER, 0, buf->getDocument()); _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, buf->getDocument());
@ -8400,12 +8403,12 @@ void Notepad_plus::getCurrentOpenedFiles(Session & session)
{ {
BufferID bufID = _subDocTab.getBufferByIndex(i); BufferID bufID = _subDocTab.getBufferByIndex(i);
Buffer * buf = MainFileManager->getBufferByID(bufID); Buffer * buf = MainFileManager->getBufferByID(bufID);
if (!buf->isUntitled() && PathFileExists(buf->getFilePath())) if (!buf->isUntitled() && PathFileExists(buf->getFullPathName()))
{ {
generic_string languageName = getLangFromMenu( buf ); generic_string languageName = getLangFromMenu( buf );
const TCHAR *langName = languageName.c_str(); const TCHAR *langName = languageName.c_str();
sessionFileInfo sfi(buf->getFilePath(), langName, buf->getPosition(&_subEditView)); sessionFileInfo sfi(buf->getFullPathName(), langName, buf->getPosition(&_subEditView));
_invisibleEditView.execute(SCI_SETDOCPOINTER, 0, buf->getDocument()); _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, buf->getDocument());
int maxLine = _invisibleEditView.execute(SCI_GETLINECOUNT); int maxLine = _invisibleEditView.execute(SCI_GETLINECOUNT);
@ -8659,10 +8662,10 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask) {
case DOC_MODIFIED: //ask for reloading case DOC_MODIFIED: //ask for reloading
{ {
bool autoUpdate = (nppGUI._fileAutoDetection == cdAutoUpdate) || (nppGUI._fileAutoDetection == cdAutoUpdateGo2end); bool autoUpdate = (nppGUI._fileAutoDetection == cdAutoUpdate) || (nppGUI._fileAutoDetection == cdAutoUpdateGo2end);
if (!autoUpdate) if (!autoUpdate || buffer->isDirty())
{ {
didDialog = true; didDialog = true;
if (doReloadOrNot(buffer->getFilePath()) != IDYES) if (doReloadOrNot(buffer->getFullPathName(), buffer->isDirty()) != IDYES)
break; //abort break; //abort
} }
//activateBuffer(buffer->getID(), iView); //activate the buffer in the first view possible //activateBuffer(buffer->getID(), iView); //activate the buffer in the first view possible
@ -8681,7 +8684,7 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask) {
iView = otherView(); iView = otherView();
//activateBuffer(buffer->getID(), iView); //activate the buffer in the first view possible //activateBuffer(buffer->getID(), iView); //activate the buffer in the first view possible
didDialog = true; didDialog = true;
if (doCloseOrNot(buffer->getFilePath()) == IDNO) if (doCloseOrNot(buffer->getFullPathName()) == IDNO)
{ {
//close in both views, doing current view last since that has to remain opened //close in both views, doing current view last since that has to remain opened
doClose(buffer->getID(), otherView()); doClose(buffer->getID(), otherView());
@ -8723,7 +8726,7 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask) {
checkDocState(); checkDocState();
setTitle(); setTitle();
TCHAR dir[MAX_PATH]; TCHAR dir[MAX_PATH];
lstrcpy(dir, buffer->getFilePath()); lstrcpy(dir, buffer->getFullPathName());
PathRemoveFileSpec(dir); PathRemoveFileSpec(dir);
setWorkingDir(dir); setWorkingDir(dir);
} }
@ -8777,7 +8780,7 @@ void Notepad_plus::notifyBufferActivated(BufferID bufid, int view) {
setDisplayFormat(buf->getFormat()); setDisplayFormat(buf->getFormat());
enableConvertMenuItems(buf->getFormat()); enableConvertMenuItems(buf->getFormat());
TCHAR dir[MAX_PATH]; TCHAR dir[MAX_PATH];
lstrcpy(dir, buf->getFilePath()); lstrcpy(dir, buf->getFullPathName());
PathRemoveFileSpec(dir); PathRemoveFileSpec(dir);
setWorkingDir(dir); setWorkingDir(dir);
setTitle(); setTitle();

View File

@ -394,11 +394,13 @@ private:
return doActionOrNot(TEXT("Save"), phrase, MB_YESNOCANCEL | MB_ICONQUESTION | MB_APPLMODAL); return doActionOrNot(TEXT("Save"), phrase, MB_YESNOCANCEL | MB_ICONQUESTION | MB_APPLMODAL);
}; };
int doReloadOrNot(const TCHAR *fn) { int doReloadOrNot(const TCHAR *fn, bool dirty) {
TCHAR pattern[128] = TEXT("The file \"%s\" is modified by another program.\rReload this file?"); TCHAR* pattern = TEXT("%s\r\rThis file has been modified by another program.\rDo you want to reload it%s?");
TCHAR* lose_info_str = dirty ? TEXT(" and lose the changes made in Notepad++") : TEXT("");
TCHAR phrase[512]; TCHAR phrase[512];
wsprintf(phrase, pattern, fn); wsprintf(phrase, pattern, fn, lose_info_str);
return doActionOrNot(TEXT("Reload"), phrase, MB_YESNO | MB_ICONQUESTION | MB_APPLMODAL); int icon = dirty ? MB_ICONEXCLAMATION : MB_ICONQUESTION;
return doActionOrNot(TEXT("Reload"), phrase, MB_YESNO | MB_APPLMODAL | icon);
}; };
int doCloseOrNot(const TCHAR *fn) { int doCloseOrNot(const TCHAR *fn) {

View File

@ -423,7 +423,7 @@ bool FileManager::reloadBuffer(BufferID id) {
Document doc = buf->getDocument(); Document doc = buf->getDocument();
Utf8_16_Read UnicodeConvertor; Utf8_16_Read UnicodeConvertor;
buf->_canNotify = false; //disable notify during file load, we dont want dirty to be triggered buf->_canNotify = false; //disable notify during file load, we dont want dirty to be triggered
bool res = loadFileData(doc, buf->getFilePath(), &UnicodeConvertor, buf->getLangType()); bool res = loadFileData(doc, buf->getFullPathName(), &UnicodeConvertor, buf->getLangType());
buf->_canNotify = true; buf->_canNotify = true;
if (res) { if (res) {
if (UnicodeConvertor.getNewBuf()) { if (UnicodeConvertor.getNewBuf()) {
@ -446,7 +446,7 @@ bool FileManager::reloadBufferDeferred(BufferID id) {
bool FileManager::deleteFile(BufferID id) bool FileManager::deleteFile(BufferID id)
{ {
Buffer * buf = getBufferByID(id); Buffer * buf = getBufferByID(id);
const TCHAR *fileNamePath = buf->getFilePath(); const TCHAR *fileNamePath = buf->getFullPathName();
if (!PathFileExists(fileNamePath)) if (!PathFileExists(fileNamePath))
return false; return false;
return ::DeleteFile(fileNamePath) != 0; return ::DeleteFile(fileNamePath) != 0;
@ -455,7 +455,7 @@ bool FileManager::deleteFile(BufferID id)
bool FileManager::moveFile(BufferID id, const TCHAR * newFileName) bool FileManager::moveFile(BufferID id, const TCHAR * newFileName)
{ {
Buffer * buf = getBufferByID(id); Buffer * buf = getBufferByID(id);
const TCHAR *fileNamePath = buf->getFilePath(); const TCHAR *fileNamePath = buf->getFullPathName();
if (!PathFileExists(fileNamePath)) if (!PathFileExists(fileNamePath))
return false; return false;
@ -622,7 +622,7 @@ BufferID FileManager::getBufferFromName(const TCHAR * name) {
::GetFullPathName(name, MAX_PATH, fullpath, NULL); ::GetFullPathName(name, MAX_PATH, fullpath, NULL);
::GetLongPathName(fullpath, fullpath, MAX_PATH); ::GetLongPathName(fullpath, fullpath, MAX_PATH);
for(size_t i = 0; i < _buffers.size(); i++) { for(size_t i = 0; i < _buffers.size(); i++) {
if (!lstrcmpi(name, _buffers.at(i)->getFilePath())) if (!lstrcmpi(name, _buffers.at(i)->getFullPathName()))
return _buffers.at(i)->getID(); return _buffers.at(i)->getID();
} }
return BUFFER_INVALID; return BUFFER_INVALID;
@ -649,6 +649,6 @@ int FileManager::getFileNameFromBuffer(BufferID id, TCHAR * fn2copy) {
return -1; return -1;
Buffer * buf = getBufferByID(id); Buffer * buf = getBufferByID(id);
if (fn2copy) if (fn2copy)
lstrcpy(fn2copy, buf->getFilePath()); lstrcpy(fn2copy, buf->getFullPathName());
return lstrlen(buf->getFilePath()); return lstrlen(buf->getFullPathName());
} }

View File

@ -160,7 +160,7 @@ public :
// 3. gets the last modified time // 3. gets the last modified time
void setFileName(const TCHAR *fn, LangType defaultLang = L_TXT); void setFileName(const TCHAR *fn, LangType defaultLang = L_TXT);
const TCHAR * getFilePath() const { const TCHAR * getFullPathName() const {
return _fullPathName; return _fullPathName;
}; };

View File

@ -75,7 +75,7 @@ BufferID DocTabView::findBufferByName(const TCHAR * fullfilename) { //-1 if not
::SendMessage(_hSelf, TCM_GETITEM, i, reinterpret_cast<LPARAM>(&tie)); ::SendMessage(_hSelf, TCM_GETITEM, i, reinterpret_cast<LPARAM>(&tie));
BufferID id = (BufferID)tie.lParam; BufferID id = (BufferID)tie.lParam;
Buffer * buf = MainFileManager->getBufferByID(id); Buffer * buf = MainFileManager->getBufferByID(id);
if (!lstrcmp(fullfilename, buf->getFilePath())) { if (!lstrcmp(fullfilename, buf->getFullPathName())) {
return id; return id;
} }
} }

View File

@ -178,7 +178,7 @@ size_t Printer::doPrint(bool justDoIt)
DOCINFO docInfo; DOCINFO docInfo;
docInfo.cbSize = sizeof(DOCINFO); docInfo.cbSize = sizeof(DOCINFO);
docInfo.lpszDocName = _pSEView->getCurrentBuffer()->getFilePath(); docInfo.lpszDocName = _pSEView->getCurrentBuffer()->getFullPathName();
docInfo.lpszOutput = NULL; docInfo.lpszOutput = NULL;
if (::StartDoc(_pdlg.hDC, &docInfo) < 0) if (::StartDoc(_pdlg.hDC, &docInfo) < 0)

View File

@ -118,8 +118,8 @@ struct BufferEquivalent
} }
else if (_iColumn == 1) else if (_iColumn == 1)
{ {
const TCHAR *s1 = b1->getFilePath(); const TCHAR *s1 = b1->getFullPathName();
const TCHAR *s2 = b2->getFilePath(); const TCHAR *s2 = b2->getFullPathName();
return _strequiv(s1, s2); //we can compare the full path to sort on directory, since after sorting directories sorting files is the second thing to do (if directories are the same that is) return _strequiv(s1, s2); //we can compare the full path to sort on directory, since after sorting directories sorting files is the second thing to do (if directories are the same that is)
} }
else if (_iColumn == 2) else if (_iColumn == 2)
@ -270,7 +270,7 @@ BOOL CALLBACK WindowsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam
} }
else if (pLvdi->item.iSubItem == 1) // directory else if (pLvdi->item.iSubItem == 1) // directory
{ {
const TCHAR *fullName = buf->getFilePath(); const TCHAR *fullName = buf->getFullPathName();
const TCHAR *fileName = buf->getFileName(); const TCHAR *fileName = buf->getFileName();
int len = lstrlen(fullName)-lstrlen(fileName); int len = lstrlen(fullName)-lstrlen(fileName);
if (!len) { if (!len) {
@ -656,6 +656,7 @@ void WindowsDlg::doClose()
for(UINT i=-1, j=0;; ++j) { for(UINT i=-1, j=0;; ++j) {
i = ListView_GetNextItem(_hList, i, LVNI_SELECTED); i = ListView_GetNextItem(_hList, i, LVNI_SELECTED);
if (i == -1) break; if (i == -1) break;
ListView_SetItemState(_hList, i, 0, LVIS_SELECTED); // deselect
nmdlg.Items[j] = _idxMap[i]; nmdlg.Items[j] = _idxMap[i];
key[j] = i; key[j] = i;
} }
@ -683,7 +684,13 @@ void WindowsDlg::doClose()
doRefresh(true); doRefresh(true);
else else
{ {
ListView_RedrawItems(_hList, 0, ListView_GetSelectedCount(_hList)); // select first previously selected item (or last one if only the last one was removed)
if (index == _idxMap.size()) index --;
if (index >= 0)
{
ListView_SetItemState(_hList, index, LVIS_SELECTED, LVIS_SELECTED);
ListView_RedrawItems(_hList, 0, _idxMap.size() - 1);
}
ListView_SetItemCount(_hList, _idxMap.size()); ListView_SetItemCount(_hList, _idxMap.size());
} }
} }

View File

@ -1,7 +1,7 @@
// Scintilla source code edit control // Scintilla source code edit control
/** @file LexCSS.cxx /** @file LexCSS.cxx
** Lexer for Cascading Style Sheets ** Lexer for Cascading Style Sheets
** Written by Jakub Vrána ** Written by Jakub Vr?na
** Improved by Philippe Lhoste (CSS2) ** Improved by Philippe Lhoste (CSS2)
**/ **/
// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org> // Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
@ -31,8 +31,8 @@ static inline bool IsAWordChar(const unsigned int ch) {
return (isalnum(ch) || ch == '-' || ch == '_' || ch >= 161); // _ is not in fact correct CSS word-character return (isalnum(ch) || ch == '-' || ch == '_' || ch >= 161); // _ is not in fact correct CSS word-character
} }
inline bool IsCssOperator(const char ch) { inline bool IsCssOperator(const int ch) {
if (!isalnum(ch) && if (!((ch < 0x80) && isalnum(ch)) &&
(ch == '{' || ch == '}' || ch == ':' || ch == ',' || ch == ';' || (ch == '{' || ch == '}' || ch == ':' || ch == ',' || ch == ';' ||
ch == '.' || ch == '#' || ch == '!' || ch == '@' || ch == '.' || ch == '#' || ch == '!' || ch == '@' ||
/* CSS2 */ /* CSS2 */
@ -194,19 +194,14 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
s2++; s2++;
switch (sc.state) { switch (sc.state) {
case SCE_CSS_IDENTIFIER: case SCE_CSS_IDENTIFIER:
if (!keywords.InList(s2)) { case SCE_CSS_IDENTIFIER2:
if (keywords2.InList(s2)) {
sc.ChangeState(SCE_CSS_IDENTIFIER2);
} else {
sc.ChangeState(SCE_CSS_UNKNOWN_IDENTIFIER);
}
}
break;
case SCE_CSS_UNKNOWN_IDENTIFIER: case SCE_CSS_UNKNOWN_IDENTIFIER:
if (keywords.InList(s2)) if (keywords.InList(s2))
sc.ChangeState(SCE_CSS_IDENTIFIER); sc.ChangeState(SCE_CSS_IDENTIFIER);
else if (keywords2.InList(s2)) else if (keywords2.InList(s2))
sc.ChangeState(SCE_CSS_IDENTIFIER2); sc.ChangeState(SCE_CSS_IDENTIFIER2);
else
sc.ChangeState(SCE_CSS_UNKNOWN_IDENTIFIER);
break; break;
case SCE_CSS_PSEUDOCLASS: case SCE_CSS_PSEUDOCLASS:
if (!pseudoClasses.InList(s2)) if (!pseudoClasses.InList(s2))
@ -232,7 +227,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
sc.Forward(); sc.Forward();
} else if (sc.state == SCE_CSS_VALUE && (sc.ch == '\"' || sc.ch == '\'')) { } else if (sc.state == SCE_CSS_VALUE && (sc.ch == '\"' || sc.ch == '\'')) {
sc.SetState((sc.ch == '\"' ? SCE_CSS_DOUBLESTRING : SCE_CSS_SINGLESTRING)); sc.SetState((sc.ch == '\"' ? SCE_CSS_DOUBLESTRING : SCE_CSS_SINGLESTRING));
} else if (IsCssOperator(static_cast<char>(sc.ch)) } else if (IsCssOperator(sc.ch)
&& (sc.state != SCE_CSS_ATTRIBUTE || sc.ch == ']') && (sc.state != SCE_CSS_ATTRIBUTE || sc.ch == ']')
&& (sc.state != SCE_CSS_VALUE || sc.ch == ';' || sc.ch == '}' || sc.ch == '!') && (sc.state != SCE_CSS_VALUE || sc.ch == ';' || sc.ch == '}' || sc.ch == '!')
&& (sc.state != SCE_CSS_DIRECTIVE || sc.ch == ';' || sc.ch == '{') && (sc.state != SCE_CSS_DIRECTIVE || sc.ch == ';' || sc.ch == '{')