--- np2/win9x/menu.cpp 2007/10/26 14:38:34 1.27 +++ np2/win9x/menu.cpp 2007/10/26 22:48:28 1.28 @@ -10,73 +10,8 @@ #define MFCHECK(a) ((a)?MF_CHECKED:MF_UNCHECKED) -typedef struct { - UINT16 id; - UINT16 str; -} MENUITEMS; - - -// これってAPIあるのか? -void menu_addmenubar(HMENU popup, HMENU menubar) { - - UINT cnt; - UINT pos; - UINT i; - MENUITEMINFO mii; - TCHAR str[128]; - HMENU hSubMenu; - - cnt = GetMenuItemCount(menubar); - pos = 0; - for (i=0; iid) { - insertresmenu(menu, pos, MF_BYPOSITION | MF_STRING, - item->id, item->str); - } - else { - InsertMenu(menu, pos, MF_BYPOSITION | MF_SEPARATOR, 0, NULL); - } - item++; - pos++; - } -} - -static BOOL searchchildmenu(HMENU hMenu, UINT uID, HMENU *phmenuRet, UINT *puPos) +static BOOL searchchildmenu(HMENU hMenu, UINT uID, + HMENU *phmenuRet, UINT *puPos) { UINT nCount; UINT i; @@ -102,7 +37,8 @@ static BOOL searchchildmenu(HMENU hMenu, } return TRUE; } - else if ((mii.hSubMenu) && (searchchildmenu(mii.hSubMenu, uID, phmenuRet, puPos))) + else if ((mii.hSubMenu) && + (searchchildmenu(mii.hSubMenu, uID, phmenuRet, puPos))) { return TRUE; } @@ -111,7 +47,8 @@ static BOOL searchchildmenu(HMENU hMenu, return FALSE; } -static BOOL searchsubmenu(HMENU hMenu, HMENU hmenuTarget, HMENU *phmenuRet, UINT *puPos) +static BOOL searchsubmenu(HMENU hMenu, HMENU hmenuTarget, + HMENU *phmenuRet, UINT *puPos) { UINT nCount; UINT i; @@ -146,48 +83,118 @@ static BOOL searchsubmenu(HMENU hMenu, H return FALSE; } +// これってAPIあるのか? +static UINT addmenu(HMENU hMenu, UINT uPos, HMENU hmenuAdd, BOOL bSeparator) +{ + UINT uCount; + UINT uAdded; + UINT i; + MENUITEMINFO mii; + TCHAR szString[128]; + HMENU hmenuSub; + + uCount = GetMenuItemCount(hmenuAdd); + uAdded = 0; + for (i=0; iitem, smi->items); - insertresmenu(hMenu, pos, MF_BYPOSITION | MF_POPUP, - (UINT)hSubMenu, smi->title); -} - - -#if defined(SUPPORT_STATSAVE) -static const TCHAR xmenu_stat[] = _T("S&tat"); -static const TCHAR xmenu_statsave[] = _T("Save %u"); -static const TCHAR xmenu_statload[] = _T("Load %u"); - -static void addstatsavemenu(HMENU hMenu, UINT pos) { - - HMENU hSubMenu; - UINT i; - TCHAR buf[16]; - - hSubMenu = CreatePopupMenu(); - for (i=0; i0;) { - i--; - if (np2cfg.fddequip & (1 << i)) { - insdiskmenu(hMenu, 1, fddmenu + i); - } - } +#if defined(SUPPORT_WAVEREC) + (void)addmenubyid(hMenu, IDM_S98LOGGING, IDR_WAVEREC); +#endif -#if defined(SUPPORT_STATSAVE) - if (np2oscfg.statsave) { - addstatsavemenu(hMenu, 1); + if (np2oscfg.I286SAVE) + { + (void)addmenubyid(hMenu, IDM_SSTP, IDR_CPUSAVE); } -#endif } void xmenu_disablewindow(void) {