From 2564b6f24d03c38d10490326712efd989d786800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Sun, 26 Apr 2020 17:59:17 +0200 Subject: [PATCH] win: Switched status bar to the new media menus --- src/include/86box/win.h | 4 ++++ src/win/win_media_menu.c | 24 ++++++++++++++++++++++++ src/win/win_stbar.c | 24 ++++++++++++++++++++++-- 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/src/include/86box/win.h b/src/include/86box/win.h index 262bb1f8a..f73956656 100644 --- a/src/include/86box/win.h +++ b/src/include/86box/win.h @@ -190,6 +190,10 @@ extern wchar_t *BrowseFolder(wchar_t *saved_path, wchar_t *title); extern void media_menu_init(); extern void media_menu_reset(); extern int media_menu_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); +extern HMENU media_menu_get_floppy(int id); +extern HMENU media_menu_get_cdrom(int id); +extern HMENU media_menu_get_zip(int id); +extern HMENU media_menu_get_mo(int id); extern void media_menu_update_floppy(int id); extern void media_menu_update_cdrom(int id); extern void media_menu_update_zip(int id); diff --git a/src/win/win_media_menu.c b/src/win/win_media_menu.c index 02d15475e..c71c28b59 100644 --- a/src/win/win_media_menu.c +++ b/src/win/win_media_menu.c @@ -421,4 +421,28 @@ media_menu_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) } return(1); +} + +HMENU +media_menu_get_floppy(int id) +{ + return menus[FDD_FIRST + id]; +} + +HMENU +media_menu_get_cdrom(int id) +{ + return menus[CDROM_FIRST + id]; +} + +HMENU +media_menu_get_zip(int id) +{ + return menus[ZIP_FIRST + id]; +} + +HMENU +media_menu_get_mo(int id) +{ + return menus[MO_FIRST + id]; } \ No newline at end of file diff --git a/src/win/win_stbar.c b/src/win/win_stbar.c index 33039f270..fd67edad2 100644 --- a/src/win/win_stbar.c +++ b/src/win/win_stbar.c @@ -917,12 +917,32 @@ ui_sb_update_panes(void) static VOID APIENTRY StatusBarPopupMenu(HWND hwnd, POINT pt, int id) { + HMENU menu; + if (id >= (sb_parts - 1)) return; pt.x = id * SB_ICON_WIDTH; /* Justify to the left. */ pt.y = 0; /* Justify to the top. */ ClientToScreen(hwnd, (LPPOINT) &pt); - TrackPopupMenu(sb_menu_handles[id], + + switch(sb_part_meanings[id] & 0xF0) { + case SB_FLOPPY: + menu = media_menu_get_floppy(sb_part_meanings[id] & 0x0F); + break; + case SB_CDROM: + menu = media_menu_get_cdrom(sb_part_meanings[id] & 0x0F); + break; + case SB_ZIP: + menu = media_menu_get_zip(sb_part_meanings[id] & 0x0F); + break; + case SB_MO: + menu = media_menu_get_mo(sb_part_meanings[id] & 0x0F); + break; + default: + return; + } + + TrackPopupMenu(menu, TPM_LEFTALIGN | TPM_BOTTOMALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, hwndSBAR, NULL); } @@ -1185,7 +1205,7 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) switch (message) { case WM_COMMAND: - MediaMenuHandler(hwnd, message, wParam, lParam); + media_menu_proc(hwnd, message, wParam, lParam); return(0); case WM_LBUTTONDOWN: