Ejemplo n.º 1
0
static void MyChangeMenu(HMENU menuLoc, int level, int menuIndex)
{
  CMenu menu;
  menu.Attach(menuLoc);
  for (int i = 0;; i++)
  {
    CMenuItem item;
    item.fMask = Get_fMask_for_String() | MIIM_SUBMENU | MIIM_ID;
    item.fType = MFT_STRING;
    if (!menu.GetItem(i, true, item))
      break;
    {
      UString newString;
      if (item.hSubMenu)
      {
        UInt32 langID = 0;
        if (level == 1 && menuIndex == kMenuIndex_Bookmarks)
          langID = kAddToFavoritesLangID;
        else
        {
          MyChangeMenu(item.hSubMenu, level + 1, i);
          if (level == 1 && menuIndex == kMenuIndex_View)
            langID = kToolbarsLangID;
          else if (level == 0 && i < ARRAY_SIZE(kTopMenuLangIDs))
            langID = kTopMenuLangIDs[i];
          else
            continue;
        }
        LangString_OnlyFromLangFile(langID, newString);
        if (newString.IsEmpty())
          continue;
      }
      else
      {
        if (item.IsSeparator())
          continue;
        int langPos = FindLangItem(item.wID);

        // we don't need lang change for CRC items!!!
        LangString_OnlyFromLangFile(langPos >= 0 ? kIDLangPairs[langPos].LangID : item.wID, newString);
        if (newString.IsEmpty())
          continue;

        int tabPos = item.StringValue.ReverseFind(L'\t');
        if (tabPos >= 0)
          newString += item.StringValue.Ptr(tabPos);
      }
      {
        item.StringValue = newString;
        item.fMask = Get_fMask_for_String();
        item.fType = MFT_STRING;
        menu.SetItem(i, true, item);
      }
    }
  }
}
Ejemplo n.º 2
0
static void MyChangeMenu(HMENU menuLoc, int level, int menuIndex)
{
  CMenu menu;
  menu.Attach(menuLoc);
  for (int i = 0;; i++)
  {
    CMenuItem item;
    item.fMask = Get_fMaskForString() | MIIM_SUBMENU | MIIM_ID;
    item.fType = MFT_STRING;
    if (!menu.GetItem(i, true, item))
      break;
    {
      UString newString;
      if (item.hSubMenu)
      {
        UInt32 langID = 0;
        if (level == 1 && menuIndex == kMenuIndex_Bookmarks)
          langID = kAddToFavoritesLangID;
        else
        {
          MyChangeMenu(item.hSubMenu, level + 1, i);
          if (level == 1 && menuIndex == kMenuIndex_View)
            langID = kToolbarsLangID;
          else if (level == 0 && i < sizeof(kTopMenuLangIDs) / sizeof(kTopMenuLangIDs[0]))
            langID = kTopMenuLangIDs[i];
          else
            continue;
        }
        newString = LangString(langID);
        if (newString.IsEmpty())
          continue;
      }
      else
      {
        int langPos = FindLangItem(item.wID);
        if (langPos < 0)
          continue;
        newString = LangString(kIDLangPairs[langPos].LangID);
        if (newString.IsEmpty())
          continue;
        UString shorcutString = item.StringValue;
        int tabPos = shorcutString.ReverseFind(wchar_t('\t'));
        if (tabPos >= 0)
          newString += shorcutString.Mid(tabPos);
      }
      {
        item.StringValue = newString;
        item.fMask = Get_fMaskForString();
        item.fType = MFT_STRING;
        menu.SetItem(i, true, item);
      }
    }
  }
}