--- xmil/win9x/menu.cpp 2004/08/12 17:57:36 1.12 +++ xmil/win9x/menu.cpp 2004/08/18 11:46:57 1.15 @@ -4,6 +4,7 @@ #include "dosio.h" #include "scrnmng.h" #include "sysmng.h" +#include "extclass.h" #include "pccore.h" #include "ini.h" #include "menu.h" @@ -104,6 +105,51 @@ void sysmenu_setbgsound(UINT8 value) { // ---- +typedef struct { + UINT16 title; + UINT16 items; +const MENUITEMS *item; +} SUBMENUI; + +static const MENUITEMS fddsitem[4][3] = { + { {IDM_FDD0OPEN, IDS_OPEN}, + {0, 0}, + {IDM_FDD0EJECT, IDS_EJECT}}, + { {IDM_FDD1OPEN, IDS_OPEN}, + {0, 0}, + {IDM_FDD1EJECT, IDS_EJECT}}, + { {IDM_FDD2OPEN, IDS_OPEN}, + {0, 0}, + {IDM_FDD2EJECT, IDS_EJECT}}, + { {IDM_FDD3OPEN, IDS_OPEN}, + {0, 0}, + {IDM_FDD3EJECT, IDS_EJECT}}}; + +static const SUBMENUI fddmenu[4] = { + {IDS_FDD0, 3, fddsitem[0]}, + {IDS_FDD1, 3, fddsitem[1]}, + {IDS_FDD2, 3, fddsitem[2]}, + {IDS_FDD3, 3, fddsitem[3]}}; + +static const MENUITEMS dbgsitem[4] = { + {IDM_WIDTH40, IDS_WIDTH40}, + {IDM_WIDTH80, IDS_WIDTH80}, + {0, 0}, + {IDM_Z80SAVE, IDS_Z80SAVE}}; + +static const SUBMENUI dbgmenu = {IDS_DEBUG, 4, dbgsitem}; + + +static void insertsubmenu(HMENU hMenu, UINT pos, const SUBMENUI *sm) { + + HMENU hSubMenu; + + hSubMenu = CreatePopupMenu(); + insertresmenus(hSubMenu, 0, sm->item, sm->items); + insertresmenu(hMenu, pos, MF_BYPOSITION | MF_POPUP, + (UINT)hSubMenu, sm->title); +} + #if defined(SUPPORT_STATSAVE) static const OEMCHAR xmenu_stat[] = OEMTEXT("S&tat"); static const OEMCHAR xmenu_statsave[] = OEMTEXT("Save %u"); @@ -133,26 +179,33 @@ static void addstatsavemenu(HMENU hMenu, void menu_initialize(void) { HMENU hMenu; +#if defined(SUPPORT_WAVEREC) || defined(SUPPORT_TURBOZ) HMENU hSubMenu; -// UINT i; +#endif + UINT i; hMenu = GetMenu(hWndMain); - if (xmiloscfg.Z80SAVE) { - hSubMenu = GetSubMenu(hMenu, 7); - insertresmenu(hSubMenu, 6, MF_BYPOSITION | MF_STRING, - IDM_Z80SAVE, IDS_Z80SAVE); - } #if defined(SUPPORT_WAVEREC) - hSubMenu = GetSubMenu(hMenu, 7); + hSubMenu = GetSubMenu(hMenu, 5); insertresmenu(hSubMenu, 2, MF_BYPOSITION | MF_STRING, IDM_WAVEREC, IDS_WAVEREC); #endif -// for (i=4; i--;) { -// if (np2cfg.fddequip & (1 << i)) { -// insdiskmenu(hMenu, 1, fddmenu + i); -// } -// } + if (xmiloscfg.Z80SAVE) { + insertsubmenu(hMenu, 5, &dbgmenu); + } + +#if defined(SUPPORT_TURBOZ) + hSubMenu = GetSubMenu(hMenu, 1); + insertresmenu(hSubMenu, 2, MF_BYPOSITION | MF_STRING, + IDM_TURBOZ, IDS_TURBOZ); +#endif + + for (i=4; i--;) { + if (xmilcfg.fddequip & (1 << i)) { + insertsubmenu(hMenu, 1, fddmenu + i); + } + } #if defined(SUPPORT_STATSAVE) if (xmiloscfg.statsave) { @@ -165,7 +218,7 @@ void menu_disablewindow(void) { HMENU hmenu; - hmenu = GetMenu(hWndMain); + hmenu = extclass_gethmenu(hWndMain); EnableMenuItem(hmenu, IDM_WINDOW, MF_GRAYED); EnableMenuItem(hmenu, IDM_FULLSCREEN, MF_GRAYED); } @@ -174,7 +227,7 @@ void menu_setiplrom(UINT8 num) { HMENU hmenu; - hmenu = GetMenu(hWndMain); + hmenu = extclass_gethmenu(hWndMain); xmilcfg.ROM_TYPE = num; CheckMenuItem(hmenu, IDM_TURBOZ, MFCHECK(num == 3)); CheckMenuItem(hmenu, IDM_TURBO, MFCHECK(num == 2)); @@ -185,7 +238,7 @@ void menu_setbootmedia(UINT8 value) { HMENU hmenu; - hmenu = GetMenu(hWndMain); + hmenu = extclass_gethmenu(hWndMain); value &= DIPSW_BOOTMEDIA; xmilcfg.DIP_SW &= ~DIPSW_BOOTMEDIA; xmilcfg.DIP_SW |= value; @@ -197,7 +250,7 @@ void menu_setresolute(UINT8 value) { HMENU hmenu; - hmenu = GetMenu(hWndMain); + hmenu = extclass_gethmenu(hWndMain); value &= DIPSW_RESOLUTE; xmilcfg.DIP_SW &= ~DIPSW_RESOLUTE; xmilcfg.DIP_SW |= value; @@ -209,7 +262,7 @@ void menu_setwidth(UINT8 value) { HMENU hmenu; - hmenu = GetMenu(hWndMain); + hmenu = extclass_gethmenu(hWndMain); CheckMenuItem(hmenu, IDM_WIDTH80, MFCHECK(!value)); CheckMenuItem(hmenu, IDM_WIDTH40, MFCHECK(value)); } @@ -218,28 +271,28 @@ void menu_setdispmode(UINT8 value) { value &= 1; xmilcfg.DISPSYNC = value; - CheckMenuItem(GetMenu(hWndMain), IDM_DISPSYNC, MFCHECK(value)); + CheckMenuItem(extclass_gethmenu(hWndMain), IDM_DISPSYNC, MFCHECK(value)); } void menu_setraster(UINT8 value) { value &= 1; xmilcfg.RASTER = value; - CheckMenuItem(GetMenu(hWndMain), IDM_RASTER, MFCHECK(value)); + CheckMenuItem(extclass_gethmenu(hWndMain), IDM_RASTER, MFCHECK(value)); } void menu_setwaitflg(UINT8 value) { value &= 1; xmiloscfg.NOWAIT = value; - CheckMenuItem(GetMenu(hWndMain), IDM_NOWAIT, MFCHECK(value)); + CheckMenuItem(extclass_gethmenu(hWndMain), IDM_NOWAIT, MFCHECK(value)); } void menu_setframe(UINT8 value) { HMENU hmenu; - hmenu = GetMenu(hWndMain); + hmenu = extclass_gethmenu(hWndMain); xmiloscfg.DRAW_SKIP = value; CheckMenuItem(hmenu, IDM_AUTOFPS, MFCHECK(!value)); CheckMenuItem(hmenu, IDM_60FPS, MFCHECK(value == 1)); @@ -252,7 +305,7 @@ void menu_setkey(UINT8 value) { HMENU hmenu; - hmenu = GetMenu(hWndMain); + hmenu = extclass_gethmenu(hWndMain); if (value >= 3) { value = 0; } @@ -265,14 +318,14 @@ void menu_setkey(UINT8 value) { void menu_setsound(UINT8 value) { xmilcfg.SOUND_SW = value; - CheckMenuItem(GetMenu(hWndMain), IDM_FMBOARD, MFCHECK(value)); + CheckMenuItem(extclass_gethmenu(hWndMain), IDM_FMBOARD, MFCHECK(value)); } void menu_setjoystick(UINT8 value) { HMENU hmenu; - hmenu = GetMenu(hWndMain); + hmenu = extclass_gethmenu(hWndMain); xmiloscfg.JOYSTICK &= 0x80; xmiloscfg.JOYSTICK |= (value & 0x7f); if (value & 2) { @@ -287,26 +340,26 @@ void menu_setmouse(UINT8 value) { value &= 1; xmilcfg.MOUSE_SW = value; - CheckMenuItem(GetMenu(hWndMain), IDM_MOUSE, MFCHECK(value)); + CheckMenuItem(extclass_gethmenu(hWndMain), IDM_MOUSE, MFCHECK(value)); } void menu_setmotorflg(UINT8 value) { value &= 1; xmilcfg.MOTOR = value; - CheckMenuItem(GetMenu(hWndMain), IDM_SEEKSND, MFCHECK(value)); + CheckMenuItem(extclass_gethmenu(hWndMain), IDM_SEEKSND, MFCHECK(value)); } void menu_opmlog(UINT8 value) { - CheckMenuItem(GetMenu(hWndMain), IDM_OPMLOG, MFCHECK(value)); + CheckMenuItem(extclass_gethmenu(hWndMain), IDM_OPMLOG, MFCHECK(value)); } void menu_setdispclk(UINT8 value) { HMENU hmenu; - hmenu = GetMenu(hWndMain); + hmenu = extclass_gethmenu(hWndMain); value &= 3; xmiloscfg.DISPCLK = value; CheckMenuItem(hmenu, IDM_DISPCLOCK, MFCHECK(value & 1)); @@ -319,13 +372,13 @@ void menu_setbtnmode(UINT8 value) { value &= 1; xmilcfg.BTN_MODE = value; - CheckMenuItem(GetMenu(hWndMain), IDM_JOYX, MFCHECK(value)); + CheckMenuItem(extclass_gethmenu(hWndMain), IDM_JOYX, MFCHECK(value)); } void menu_setbtnrapid(UINT8 value) { value &= 1; xmilcfg.BTN_RAPID = value; - CheckMenuItem(GetMenu(hWndMain), IDM_RAPID, MFCHECK(value)); + CheckMenuItem(extclass_gethmenu(hWndMain), IDM_RAPID, MFCHECK(value)); }