diff --git a/src/config.c b/src/config.c index 08969bc3f..9525dc7e2 100644 --- a/src/config.c +++ b/src/config.c @@ -532,7 +532,9 @@ load_general(void) } sound_gain = config_get_int(cat, "sound_gain", 0); + kbd_req_capture = config_get_int(cat, "kbd_req_capture", 0); + hide_status_bar = config_get_int(cat, "hide_status_bar", 0); confirm_reset = config_get_int(cat, "confirm_reset", 1); confirm_exit = config_get_int(cat, "confirm_exit", 1); @@ -1972,6 +1974,7 @@ config_load(void) plat_langid = 0x0409; #endif kbd_req_capture = 0; + hide_status_bar = 0; scale = 1; machine = machine_get_machine_from_internal_name("ibmpc"); @@ -2150,6 +2153,11 @@ save_general(void) else config_delete_var(cat, "kbd_req_capture"); + if (hide_status_bar != 0) + config_set_int(cat, "hide_status_bar", hide_status_bar); + else + config_delete_var(cat, "hide_status_bar"); + if (confirm_reset != 1) config_set_int(cat, "confirm_reset", confirm_reset); else diff --git a/src/include/86box/plat.h b/src/include/86box/plat.h index 208d7d3bd..301d9a4ef 100644 --- a/src/include/86box/plat.h +++ b/src/include/86box/plat.h @@ -80,7 +80,7 @@ extern int update_icons; extern int unscaled_size_x, /* current unscaled size X */ unscaled_size_y; /* current unscaled size Y */ -extern int kbd_req_capture; +extern int kbd_req_capture, hide_status_bar; /* System-related functions. */ extern char *fix_exe_path(char *str); diff --git a/src/include/86box/resource.h b/src/include/86box/resource.h index 91291dfd8..7ce6edd18 100644 --- a/src/include/86box/resource.h +++ b/src/include/86box/resource.h @@ -307,8 +307,7 @@ #define IDM_ACTION_TRACE 40020 #endif #define IDM_CONFIG 40020 -#define IDM_CONFIG_LOAD 40021 -#define IDM_CONFIG_SAVE 40022 +#define IDM_VID_HIDE_STATUS_BAR 40021 #define IDM_UPDATE_ICONS 40030 #define IDM_VID_RESIZE 40040 #define IDM_VID_REMEMBER 40041 diff --git a/src/win/86Box.rc b/src/win/86Box.rc index c5205f85f..2ee41aec1 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -59,6 +59,8 @@ BEGIN END POPUP "&View" BEGIN + MENUITEM "&Hide status bar", IDM_VID_HIDE_STATUS_BAR + MENUITEM SEPARATOR MENUITEM "&Resizeable window", IDM_VID_RESIZE MENUITEM "R&emember size && position", IDM_VID_REMEMBER MENUITEM SEPARATOR diff --git a/src/win/win.c b/src/win/win.c index 12655373e..ff7726459 100644 --- a/src/win/win.c +++ b/src/win/win.c @@ -1075,7 +1075,10 @@ plat_setfullscreen(int on) GetClientRect(hwndMain, &rect); temp_x = rect.right - rect.left + 1; - temp_y = rect.bottom - rect.top + 1 - sbar_height; + if (hide_status_bar) + temp_y = rect.bottom - rect.top + 1; + else + temp_y = rect.bottom - rect.top + 1 - sbar_height; } else { if (dpi_scale) { temp_x = MulDiv((vid_resize & 2) ? fixed_size_x : unscaled_size_x, dpi, 96); @@ -1086,7 +1089,10 @@ plat_setfullscreen(int on) } /* Main Window. */ - ResizeWindowByClientArea(hwndMain, temp_x, temp_y + sbar_height); + if (hide_status_bar) + ResizeWindowByClientArea(hwndMain, temp_x, temp_y); + else + ResizeWindowByClientArea(hwndMain, temp_x, temp_y + sbar_height); } /* Render window. */ diff --git a/src/win/win_ui.c b/src/win/win_ui.c index 237324d0b..251892832 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -68,6 +68,7 @@ int rctrl_is_lalt = 0; int user_resize = 0; int fixed_size_x = 0, fixed_size_y = 0; int kbd_req_capture = 0; +int hide_status_bar = 0; extern char openfilestring[512]; extern WCHAR wopenfilestring[512]; @@ -705,6 +706,18 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) config_save(); break; + case IDM_VID_HIDE_STATUS_BAR: + hide_status_bar ^= 1; + CheckMenuItem(hmenu, IDM_VID_HIDE_STATUS_BAR, hide_status_bar ? MF_CHECKED : MF_UNCHECKED); + ShowWindow(hwndSBAR, hide_status_bar ? SW_HIDE : SW_SHOW); + GetWindowRect(hwnd, &rect); + if (hide_status_bar) + MoveWindow(hwnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top - sbar_height, TRUE); + else + MoveWindow(hwnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top + sbar_height, TRUE); + config_save(); + break; + case IDM_VID_RESIZE: vid_resize ^= 1; CheckMenuItem(hmenu, IDM_VID_RESIZE, (vid_resize & 1) ? MF_CHECKED : MF_UNCHECKED); @@ -723,7 +736,10 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) temp_y = unscaled_size_y; } - ResizeWindowByClientArea(hwnd, temp_x, temp_y + sbar_height); + if (hide_status_bar) + ResizeWindowByClientArea(hwnd, temp_x, temp_y); + else + ResizeWindowByClientArea(hwnd, temp_x, temp_y + sbar_height); if (mouse_capture) { ClipCursor(&rect); @@ -1009,7 +1025,10 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) } /* Main Window. */ - ResizeWindowByClientArea(hwndMain, temp_x, temp_y + sbar_height); + if (hide_status_bar) + ResizeWindowByClientArea(hwndMain, temp_x, temp_y); + else + ResizeWindowByClientArea(hwndMain, temp_x, temp_y + sbar_height); } else if (!user_resize) doresize = 1; break; @@ -1039,8 +1058,12 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) if (!(pos->flags & SWP_NOSIZE) || !user_resize) { plat_vidapi_enable(0); - MoveWindow(hwndSBAR, 0, rect.bottom - sbar_height, sbar_height, rect.right, TRUE); - MoveWindow(hwndRender, 0, 0, rect.right, rect.bottom - sbar_height, TRUE); + if (hide_status_bar) + MoveWindow(hwndRender, 0, 0, rect.right, rect.bottom, TRUE); + else { + MoveWindow(hwndSBAR, 0, rect.bottom - sbar_height, sbar_height, rect.right, TRUE); + MoveWindow(hwndRender, 0, 0, rect.right, rect.bottom - sbar_height, TRUE); + } GetClientRect(hwndRender, &rect); if (dpi_scale) { @@ -1423,6 +1446,8 @@ ui_init(int nCmdShow) /* Get the actual height of the status bar */ GetWindowRect(hwndSBAR, &sbar_rect); sbar_height = sbar_rect.bottom - sbar_rect.top; + if (hide_status_bar) + ShowWindow(hwndSBAR, SW_HIDE); /* Set up main window for resizing if configured. */ if (vid_resize == 1) @@ -1445,7 +1470,10 @@ ui_init(int nCmdShow) scrnsz_x = fixed_size_x; scrnsz_y = fixed_size_y; } - ResizeWindowByClientArea(hwndMain, scrnsz_x, scrnsz_y + sbar_height); + if (hide_status_bar) + ResizeWindowByClientArea(hwndMain, scrnsz_x, scrnsz_y); + else + ResizeWindowByClientArea(hwndMain, scrnsz_x, scrnsz_y + sbar_height); } /* Reset all menus to their defaults. */ @@ -1689,7 +1717,10 @@ plat_resize(int x, int y) x = MulDiv(x, dpi, 96); y = MulDiv(y, dpi, 96); } - ResizeWindowByClientArea(hwndMain, x, y + sbar_height); + if (hide_status_bar) + ResizeWindowByClientArea(hwndMain, x, y); + else + ResizeWindowByClientArea(hwndMain, x, y + sbar_height); } }