win: Add a placeholder menuitem for the Media menu

This makes it possible to change the position of the menu by only editing the resource script itself.
This commit is contained in:
David Hrdlička
2020-04-23 12:58:19 +02:00
parent e3296f4529
commit 3b85d4f0c7
3 changed files with 26 additions and 6 deletions

View File

@@ -300,6 +300,8 @@
#define IDM_VID_GRAY_GREEN 40083
#define IDM_VID_GRAY_WHITE 40084
#define IDM_MEDIA 40085
#ifdef USE_DISCORD
#define IDM_DISCORD 40090
#endif

View File

@@ -112,6 +112,7 @@ BEGIN
MENUITEM "CGA/PCjr/Tandy/E&GA/(S)VGA overscan", IDM_VID_OVERSCAN
MENUITEM "Change contrast for &monochrome display", IDM_VID_CGACON
END
MENUITEM "&Media", IDM_MEDIA
POPUP "&Tools"
BEGIN
MENUITEM "&Settings...", IDM_CONFIG

View File

@@ -1215,6 +1215,27 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
}
void
MediaMenuCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst)
{
HMENU hmenu;
LPWSTR lpMenuName;
hmenu = GetMenu(hwndParent);
hmenuMedia = CreatePopupMenu();
int len = GetMenuString(hmenu, IDM_MEDIA, NULL, 0, MF_BYCOMMAND);
lpMenuName = malloc((len + 1) * sizeof(WCHAR));
GetMenuString(hmenu, IDM_MEDIA, lpMenuName, len + 1, MF_BYCOMMAND);
InsertMenu(hmenu, IDM_MEDIA, MF_BYCOMMAND | MF_STRING | MF_POPUP, (UINT_PTR)hmenuMedia, lpMenuName);
RemoveMenu(hmenu, IDM_MEDIA, MF_BYCOMMAND);
DrawMenuBar(hwndParent);
free(lpMenuName);
}
/* API: Create and set up the Status Bar window. */
void
StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst)
@@ -1222,7 +1243,6 @@ StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst)
RECT rectDialog;
int dw, dh;
uint8_t i;
HMENU hmenu;
/* Load our icons into the cache for faster access. */
for (i = 16; i < 18; i++)
@@ -1305,11 +1325,8 @@ StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst)
SendMessage(hwndSBAR, SB_SETTEXT, 0 | SBT_NOBORDERS,
(LPARAM)L"Welcome to 86Box !");
hmenu = GetMenu(hwndParent);
hmenuMedia = CreatePopupMenu();
InsertMenu(hmenu, 2, MF_BYPOSITION | MF_STRING | MF_POPUP, (UINT_PTR)hmenuMedia, plat_get_string(IDS_2126));
DrawMenuBar(hwndParent);
MediaMenuCreate(hwndParent, idStatus, hInst);
sb_ready = 1;
}