[NEW_FEATURE] Make Recent File List totally customizable (terminated).

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@783 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2011-06-27 22:26:02 +00:00
parent 5905eac7b3
commit f002d94ff9

View File

@ -47,16 +47,18 @@ void LastRecentFileList::switchMode()
//Remove all menu items //Remove all menu items
::RemoveMenu(_hMenu, IDM_OPEN_ALL_RECENT_FILE, MF_BYCOMMAND); ::RemoveMenu(_hMenu, IDM_OPEN_ALL_RECENT_FILE, MF_BYCOMMAND);
::RemoveMenu(_hMenu, IDM_CLEAN_RECENT_FILE_LIST, MF_BYCOMMAND); ::RemoveMenu(_hMenu, IDM_CLEAN_RECENT_FILE_LIST, MF_BYCOMMAND);
for(int i = 0; i < _size; i++) for(int i = 0; i < _size; i++)
{ {
::RemoveMenu(_hMenu, _lrfl.at(i)._id, MF_BYCOMMAND); ::RemoveMenu(_hMenu, _lrfl.at(i)._id, MF_BYCOMMAND);
} }
if (_hParentMenu == NULL) // mode main menu if (_hParentMenu == NULL) // mode main menu
{ { if (_size > 0)
::RemoveMenu(_hMenu, _posBase, MF_BYPOSITION); {
::RemoveMenu(_hMenu, _posBase, MF_BYPOSITION); ::RemoveMenu(_hMenu, _posBase, MF_BYPOSITION);
::RemoveMenu(_hMenu, _posBase, MF_BYPOSITION);
}
// switch to sub-menu mode // switch to sub-menu mode
_hParentMenu = _hMenu; _hParentMenu = _hMenu;
_hMenu = ::CreatePopupMenu(); _hMenu = ::CreatePopupMenu();
@ -64,9 +66,11 @@ void LastRecentFileList::switchMode()
} }
else // mode sub-menu else // mode sub-menu
{ {
::RemoveMenu(_hParentMenu, _posBase, MF_BYPOSITION); if (_size > 0)
::RemoveMenu(_hParentMenu, _posBase, MF_BYPOSITION); {
::RemoveMenu(_hParentMenu, _posBase, MF_BYPOSITION);
::RemoveMenu(_hParentMenu, _posBase, MF_BYPOSITION);
}
// switch to main menu mode // switch to main menu mode
::DestroyMenu(_hMenu); ::DestroyMenu(_hMenu);
_hMenu = _hParentMenu; _hMenu = _hParentMenu;