Add sub-menu bullets for cascaded Encoding and Language menus
Fix #8327, close #8328
This commit is contained in:
parent
9b36ba102a
commit
b73721f0b4
@ -2091,23 +2091,24 @@ void Notepad_plus::checkSyncState()
|
|||||||
enableCommand(IDM_VIEW_SYNSCROLLH, canDoSync, MENU | TOOLBAR);
|
enableCommand(IDM_VIEW_SYNSCROLLH, canDoSync, MENU | TOOLBAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
void doCheck(HMENU mainHandle, int id)
|
bool doCheck(HMENU mainHandle, int id)
|
||||||
{
|
{
|
||||||
MENUITEMINFO mii;
|
MENUITEMINFO mii;
|
||||||
mii.cbSize = sizeof(MENUITEMINFO);
|
mii.cbSize = sizeof(MENUITEMINFO);
|
||||||
mii.fMask = MIIM_SUBMENU | MIIM_FTYPE | MIIM_ID | MIIM_STATE;
|
mii.fMask = MIIM_SUBMENU | MIIM_FTYPE | MIIM_ID | MIIM_STATE;
|
||||||
|
|
||||||
|
bool found = false;
|
||||||
int count = ::GetMenuItemCount(mainHandle);
|
int count = ::GetMenuItemCount(mainHandle);
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
::GetMenuItemInfo(mainHandle, i, MF_BYPOSITION, &mii);
|
::GetMenuItemInfo(mainHandle, i, MF_BYPOSITION, &mii);
|
||||||
if (mii.fType == MFT_RADIOCHECK || mii.fType == MFT_STRING)
|
if (mii.fType == MFT_RADIOCHECK || mii.fType == MFT_STRING)
|
||||||
{
|
{
|
||||||
if (mii.hSubMenu == 0)
|
bool checked = mii.hSubMenu ? doCheck(mii.hSubMenu, id) : (mii.wID == (unsigned int)id);
|
||||||
{
|
if (checked)
|
||||||
if (mii.wID == (unsigned int)id)
|
|
||||||
{
|
{
|
||||||
::CheckMenuRadioItem(mainHandle, 0, count, i, MF_BYPOSITION);
|
::CheckMenuRadioItem(mainHandle, 0, count, i, MF_BYPOSITION);
|
||||||
|
found = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2115,12 +2116,8 @@ void doCheck(HMENU mainHandle, int id)
|
|||||||
::SetMenuItemInfo(mainHandle, i, MF_BYPOSITION, &mii);
|
::SetMenuItemInfo(mainHandle, i, MF_BYPOSITION, &mii);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
doCheck(mii.hSubMenu, id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Notepad_plus::checkLangsMenu(int id) const
|
void Notepad_plus::checkLangsMenu(int id) const
|
||||||
@ -3914,8 +3911,7 @@ void Notepad_plus::checkUnicodeMenuItems() const
|
|||||||
{
|
{
|
||||||
// Uncheck all in the sub encoding menu
|
// Uncheck all in the sub encoding menu
|
||||||
HMENU _formatMenuHandle = ::GetSubMenu(_mainMenuHandle, MENUINDEX_FORMAT);
|
HMENU _formatMenuHandle = ::GetSubMenu(_mainMenuHandle, MENUINDEX_FORMAT);
|
||||||
doCheck(_formatMenuHandle, IDM_FORMAT_ENCODE);
|
doCheck(_formatMenuHandle, -1);
|
||||||
::CheckMenuItem(_mainMenuHandle, IDM_FORMAT_ENCODE, MF_UNCHECKED | MF_BYCOMMAND);
|
|
||||||
|
|
||||||
if (id == -1) //um == uni16BE_NoBOM || um == uni16LE_NoBOM
|
if (id == -1) //um == uni16BE_NoBOM || um == uni16LE_NoBOM
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user