| 2735 | } |
| 2736 | |
| 2737 | void CMainFrame::UpdateMenu(CMenu *pMenu) |
| 2738 | { |
| 2739 | CAccelerator *pAccel = FTEnv.GetAccelerator(); |
| 2740 | |
| 2741 | for (UINT i = 0; i < static_cast<unsigned int>(pMenu->GetMenuItemCount()); ++i) { // // // |
| 2742 | UINT state = pMenu->GetMenuState(i, MF_BYPOSITION); |
| 2743 | if (state & MF_POPUP) { |
| 2744 | // Update sub menu |
| 2745 | UpdateMenu(pMenu->GetSubMenu(i)); |
| 2746 | } |
| 2747 | else if ((state & MFT_SEPARATOR) == 0) { |
| 2748 | // Change menu name |
| 2749 | UINT id = pMenu->GetMenuItemID(i); |
| 2750 | |
| 2751 | if (CStringW shortcut = pAccel->GetShortcutString(id); !shortcut.IsEmpty()) { // // // |
| 2752 | CStringW string; |
| 2753 | pMenu->GetMenuStringW(i, string, MF_BYPOSITION); |
| 2754 | |
| 2755 | int tab = string.Find(L'\t'); |
| 2756 | |
| 2757 | if (tab != -1) { |
| 2758 | string = string.Left(tab); |
| 2759 | } |
| 2760 | |
| 2761 | string += shortcut; |
| 2762 | pMenu->ModifyMenuW(i, MF_BYPOSITION, id, string); |
| 2763 | } |
| 2764 | } |
| 2765 | } |
| 2766 | } |
| 2767 | |
| 2768 | void CMainFrame::OnEditCut() |
| 2769 | { |
no test coverage detected