mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-27 07:44:24 +02:00
[BUG_FIXED] Avoid delete/rename operation on New file.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@266 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
608265a3ca
commit
9a2cebbd6e
@ -1662,9 +1662,13 @@ void Notepad_plus::checkDocState()
|
|||||||
|
|
||||||
bool isCurrentDirty = curBuf->isDirty();
|
bool isCurrentDirty = curBuf->isDirty();
|
||||||
bool isSeveralDirty = isCurrentDirty;
|
bool isSeveralDirty = isCurrentDirty;
|
||||||
if (!isCurrentDirty) {
|
bool isFileExisting = PathFileExists(curBuf->getFilePath()) != FALSE;
|
||||||
for(int i = 0; i < MainFileManager->getNrBuffers(); i++) {
|
if (!isCurrentDirty)
|
||||||
if (MainFileManager->getBufferByIndex(i)->isDirty()) {
|
{
|
||||||
|
for(int i = 0; i < MainFileManager->getNrBuffers(); i++)
|
||||||
|
{
|
||||||
|
if (MainFileManager->getBufferByIndex(i)->isDirty())
|
||||||
|
{
|
||||||
isSeveralDirty = true;
|
isSeveralDirty = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1688,6 +1692,8 @@ void Notepad_plus::checkDocState()
|
|||||||
bool isUserReadOnly = curBuf->getUserReadOnly();
|
bool isUserReadOnly = curBuf->getUserReadOnly();
|
||||||
::CheckMenuItem(_mainMenuHandle, IDM_EDIT_SETREADONLY, MF_BYCOMMAND | (isUserReadOnly?MF_CHECKED:MF_UNCHECKED));
|
::CheckMenuItem(_mainMenuHandle, IDM_EDIT_SETREADONLY, MF_BYCOMMAND | (isUserReadOnly?MF_CHECKED:MF_UNCHECKED));
|
||||||
}
|
}
|
||||||
|
enableCommand(IDM_FILE_DELETE, isFileExisting, MENU);
|
||||||
|
enableCommand(IDM_FILE_RENAME, isFileExisting, MENU);
|
||||||
|
|
||||||
enableConvertMenuItems(curBuf->getFormat());
|
enableConvertMenuItems(curBuf->getFormat());
|
||||||
checkUnicodeMenuItems(curBuf->getUnicodeMode());
|
checkUnicodeMenuItems(curBuf->getUnicodeMode());
|
||||||
@ -2081,7 +2087,6 @@ BOOL Notepad_plus::notify(SCNotification *notification)
|
|||||||
pRename = element->Attribute("name"); break;
|
pRename = element->Attribute("name"); break;
|
||||||
case 11 :
|
case 11 :
|
||||||
pRemove = element->Attribute("name"); break;
|
pRemove = element->Attribute("name"); break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2110,7 +2115,6 @@ BOOL Notepad_plus::notify(SCNotification *notification)
|
|||||||
pRename = rename;
|
pRename = rename;
|
||||||
if (!pRemove || !pRemove[0])
|
if (!pRemove || !pRemove[0])
|
||||||
pRemove = remove;
|
pRemove = remove;
|
||||||
|
|
||||||
}
|
}
|
||||||
vector<MenuItemUnit> itemUnitArray;
|
vector<MenuItemUnit> itemUnitArray;
|
||||||
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_CLOSE, pClose));
|
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_CLOSE, pClose));
|
||||||
@ -2146,8 +2150,11 @@ 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);
|
||||||
|
|
||||||
_tabPopupMenu.display(p);
|
bool isFileExisting = PathFileExists(buf->getFilePath()) != FALSE;
|
||||||
|
_tabPopupMenu.enableItem(IDM_FILE_DELETE, isFileExisting);
|
||||||
|
_tabPopupMenu.enableItem(IDM_FILE_RENAME, isFileExisting);
|
||||||
|
|
||||||
|
_tabPopupMenu.display(p);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user