From 513100b7206abb4619a885602b622b01fcefb6ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Mon, 10 Jan 2022 01:49:00 +0100 Subject: [PATCH] Add a menu option to hide the toolbar --- src/include/86box/resource.h | 1 + src/win/languages/cs-CZ.rc | 1 + src/win/languages/de-DE.rc | 1 + src/win/languages/en-GB.rc | 1 + src/win/languages/en-US.rc | 1 + src/win/languages/es-ES.rc | 1 + src/win/languages/fi-FI.rc | 1 + src/win/languages/fr-FR.rc | 1 + src/win/languages/hr-HR.rc | 1 + src/win/languages/hu-HU.rc | 1 + src/win/languages/it-IT.rc | 1 + src/win/languages/ja-JP.rc | 1 + src/win/languages/ko-KR.rc | 1 + src/win/languages/pt-BR.rc | 1 + src/win/languages/pt-PT.rc | 1 + src/win/languages/ru-RU.rc | 1 + src/win/languages/sl-SI.rc | 1 + src/win/languages/tr-TR.rc | 1 + src/win/languages/zh-CN.rc | 1 + src/win/win_ui.c | 17 +++++++++++++++++ 20 files changed, 36 insertions(+) diff --git a/src/include/86box/resource.h b/src/include/86box/resource.h index b5a67b85b..f35be6465 100644 --- a/src/include/86box/resource.h +++ b/src/include/86box/resource.h @@ -313,6 +313,7 @@ #endif #define IDM_CONFIG 40020 #define IDM_VID_HIDE_STATUS_BAR 40021 +#define IDM_VID_HIDE_TOOLBAR 40022 #define IDM_UPDATE_ICONS 40030 #define IDM_SND_GAIN 40031 #define IDM_VID_RESIZE 40040 diff --git a/src/win/languages/cs-CZ.rc b/src/win/languages/cs-CZ.rc index b63d8a176..d9f392cc9 100644 --- a/src/win/languages/cs-CZ.rc +++ b/src/win/languages/cs-CZ.rc @@ -32,6 +32,7 @@ BEGIN POPUP "&Zobrazení" BEGIN MENUITEM "&Schovat stavový řádek", IDM_VID_HIDE_STATUS_BAR + MENUITEM "Schovat panel &nástrojů", IDM_VID_HIDE_TOOLBAR MENUITEM SEPARATOR MENUITEM "&Měnitelná velikost okna", IDM_VID_RESIZE MENUITEM "&Pamatovat velikost a pozici", IDM_VID_REMEMBER diff --git a/src/win/languages/de-DE.rc b/src/win/languages/de-DE.rc index 5a5ca5914..38a562cd5 100644 --- a/src/win/languages/de-DE.rc +++ b/src/win/languages/de-DE.rc @@ -32,6 +32,7 @@ BEGIN POPUP "&Ansicht" BEGIN MENUITEM "&Statusleiste ausblenden", IDM_VID_HIDE_STATUS_BAR + MENUITEM "Hide &toolbar", IDM_VID_HIDE_TOOLBAR MENUITEM SEPARATOR MENUITEM "&Größenverstellbares Fenster", IDM_VID_RESIZE MENUITEM "&Größe && Position merken", IDM_VID_REMEMBER diff --git a/src/win/languages/en-GB.rc b/src/win/languages/en-GB.rc index 61749d954..939d96f5c 100644 --- a/src/win/languages/en-GB.rc +++ b/src/win/languages/en-GB.rc @@ -32,6 +32,7 @@ BEGIN POPUP "&View" BEGIN MENUITEM "&Hide status bar", IDM_VID_HIDE_STATUS_BAR + MENUITEM "Hide &toolbar", IDM_VID_HIDE_TOOLBAR MENUITEM SEPARATOR MENUITEM "&Resizeable window", IDM_VID_RESIZE MENUITEM "R&emember size && position", IDM_VID_REMEMBER diff --git a/src/win/languages/en-US.rc b/src/win/languages/en-US.rc index 3bee70556..c010e9a90 100644 --- a/src/win/languages/en-US.rc +++ b/src/win/languages/en-US.rc @@ -32,6 +32,7 @@ BEGIN POPUP "&View" BEGIN MENUITEM "&Hide status bar", IDM_VID_HIDE_STATUS_BAR + MENUITEM "Hide &toolbar", IDM_VID_HIDE_TOOLBAR MENUITEM SEPARATOR MENUITEM "&Resizeable window", IDM_VID_RESIZE MENUITEM "R&emember size && position", IDM_VID_REMEMBER diff --git a/src/win/languages/es-ES.rc b/src/win/languages/es-ES.rc index 2232e69c5..44fadfc6e 100644 --- a/src/win/languages/es-ES.rc +++ b/src/win/languages/es-ES.rc @@ -32,6 +32,7 @@ BEGIN POPUP "&Vista" BEGIN MENUITEM "&Ocultar barra de estado", IDM_VID_HIDE_STATUS_BAR + MENUITEM "Hide &toolbar", IDM_VID_HIDE_TOOLBAR MENUITEM SEPARATOR MENUITEM "&Ventana redimensionable", IDM_VID_RESIZE MENUITEM "&Recordar tamaño y posición", IDM_VID_REMEMBER diff --git a/src/win/languages/fi-FI.rc b/src/win/languages/fi-FI.rc index 56430464d..bedc9d3f7 100644 --- a/src/win/languages/fi-FI.rc +++ b/src/win/languages/fi-FI.rc @@ -32,6 +32,7 @@ BEGIN POPUP "&Näytä" BEGIN MENUITEM "&Piilota tilapalkki", IDM_VID_HIDE_STATUS_BAR + MENUITEM "Hide &toolbar", IDM_VID_HIDE_TOOLBAR MENUITEM SEPARATOR MENUITEM "&Salli koon muuttaminen", IDM_VID_RESIZE MENUITEM "&Muista koko ja sijainti", IDM_VID_REMEMBER diff --git a/src/win/languages/fr-FR.rc b/src/win/languages/fr-FR.rc index 6b58bd593..a59c78dab 100644 --- a/src/win/languages/fr-FR.rc +++ b/src/win/languages/fr-FR.rc @@ -32,6 +32,7 @@ BEGIN POPUP "&Vue" BEGIN MENUITEM "&Masquer la barre de status", IDM_VID_HIDE_STATUS_BAR + MENUITEM "Hide &toolbar", IDM_VID_HIDE_TOOLBAR MENUITEM SEPARATOR MENUITEM "Fenètre &Retaillable", IDM_VID_RESIZE MENUITEM "S&auvegarder taille && position", IDM_VID_REMEMBER diff --git a/src/win/languages/hr-HR.rc b/src/win/languages/hr-HR.rc index 61fc0c475..ba384f5a6 100644 --- a/src/win/languages/hr-HR.rc +++ b/src/win/languages/hr-HR.rc @@ -32,6 +32,7 @@ BEGIN POPUP "&Pogled" BEGIN MENUITEM "&Sakrij statusni redak", IDM_VID_HIDE_STATUS_BAR + MENUITEM "Hide &toolbar", IDM_VID_HIDE_TOOLBAR MENUITEM SEPARATOR MENUITEM "&Prozor s promjenjivim veličinama", IDM_VID_RESIZE MENUITEM "&Zapamtite veličinu i položaj", IDM_VID_REMEMBER diff --git a/src/win/languages/hu-HU.rc b/src/win/languages/hu-HU.rc index 731ef0e42..1b7dfbe43 100644 --- a/src/win/languages/hu-HU.rc +++ b/src/win/languages/hu-HU.rc @@ -35,6 +35,7 @@ BEGIN POPUP "&Nézet" BEGIN MENUITEM "Állapotsor &elrejtése", IDM_VID_HIDE_STATUS_BAR + MENUITEM "Hide &toolbar", IDM_VID_HIDE_TOOLBAR MENUITEM SEPARATOR MENUITEM "&Átméretezhető ablak", IDM_VID_RESIZE MENUITEM "Méret és pozíció &megjegyzése", IDM_VID_REMEMBER diff --git a/src/win/languages/it-IT.rc b/src/win/languages/it-IT.rc index 461b76e71..2656a2d5d 100644 --- a/src/win/languages/it-IT.rc +++ b/src/win/languages/it-IT.rc @@ -32,6 +32,7 @@ BEGIN POPUP "&Visualizza" BEGIN MENUITEM "&Nascondi barra di stato", IDM_VID_HIDE_STATUS_BAR + MENUITEM "Hide &toolbar", IDM_VID_HIDE_TOOLBAR MENUITEM SEPARATOR MENUITEM "&Finestra ridimensionabile", IDM_VID_RESIZE MENUITEM "R&icorda dimensioni e posizione", IDM_VID_REMEMBER diff --git a/src/win/languages/ja-JP.rc b/src/win/languages/ja-JP.rc index e88e1822c..c74b99d81 100644 --- a/src/win/languages/ja-JP.rc +++ b/src/win/languages/ja-JP.rc @@ -32,6 +32,7 @@ BEGIN POPUP "表示(&V)" BEGIN MENUITEM "ステータスバーを隠す(&H)", IDM_VID_HIDE_STATUS_BAR + MENUITEM "Hide &toolbar", IDM_VID_HIDE_TOOLBAR MENUITEM SEPARATOR MENUITEM "ウィンドウのサイズを変更可能にする(&R)", IDM_VID_RESIZE MENUITEM "ウィンドウのサイズと位置を記憶する(&E)", IDM_VID_REMEMBER diff --git a/src/win/languages/ko-KR.rc b/src/win/languages/ko-KR.rc index a46c8f6d7..510bc8c60 100644 --- a/src/win/languages/ko-KR.rc +++ b/src/win/languages/ko-KR.rc @@ -32,6 +32,7 @@ BEGIN POPUP "표시(&V)" BEGIN MENUITEM "상태 바 숨기기(&H)", IDM_VID_HIDE_STATUS_BAR + MENUITEM "Hide &toolbar", IDM_VID_HIDE_TOOLBAR MENUITEM SEPARATOR MENUITEM "창 크기 조절 가능하게 하기(&R)", IDM_VID_RESIZE MENUITEM "창 크기와 위치를 기억하기(&E)", IDM_VID_REMEMBER diff --git a/src/win/languages/pt-BR.rc b/src/win/languages/pt-BR.rc index 06a000458..58ae5f6b4 100644 --- a/src/win/languages/pt-BR.rc +++ b/src/win/languages/pt-BR.rc @@ -35,6 +35,7 @@ BEGIN POPUP "&Exibir" BEGIN MENUITEM "&Ocultar barra de status", IDM_VID_HIDE_STATUS_BAR + MENUITEM "Hide &toolbar", IDM_VID_HIDE_TOOLBAR MENUITEM SEPARATOR MENUITEM "&Janela redimensionável", IDM_VID_RESIZE MENUITEM "&Lembrar tamanho e posição", IDM_VID_REMEMBER diff --git a/src/win/languages/pt-PT.rc b/src/win/languages/pt-PT.rc index a424ad141..c30f6d50d 100644 --- a/src/win/languages/pt-PT.rc +++ b/src/win/languages/pt-PT.rc @@ -32,6 +32,7 @@ BEGIN POPUP "&Ver" BEGIN MENUITEM "&Ocultar barra de estado", IDM_VID_HIDE_STATUS_BAR + MENUITEM "Hide &toolbar", IDM_VID_HIDE_TOOLBAR MENUITEM SEPARATOR MENUITEM "&Janela redimensionável", IDM_VID_RESIZE MENUITEM "&Lembrar tamanho e posição", IDM_VID_REMEMBER diff --git a/src/win/languages/ru-RU.rc b/src/win/languages/ru-RU.rc index 413b0c5f3..72b4e7e66 100644 --- a/src/win/languages/ru-RU.rc +++ b/src/win/languages/ru-RU.rc @@ -32,6 +32,7 @@ BEGIN POPUP "&Вид" BEGIN MENUITEM "&Скрыть строку статуса", IDM_VID_HIDE_STATUS_BAR + MENUITEM "Hide &toolbar", IDM_VID_HIDE_TOOLBAR MENUITEM SEPARATOR MENUITEM "&Изменяемый размер окна", IDM_VID_RESIZE MENUITEM "&Запомнить размер и положение", IDM_VID_REMEMBER diff --git a/src/win/languages/sl-SI.rc b/src/win/languages/sl-SI.rc index fb1c80b8b..815c08603 100644 --- a/src/win/languages/sl-SI.rc +++ b/src/win/languages/sl-SI.rc @@ -32,6 +32,7 @@ BEGIN POPUP "&Pogled" BEGIN MENUITEM "&Skrij statusno vrstico", IDM_VID_HIDE_STATUS_BAR + MENUITEM "Hide &toolbar", IDM_VID_HIDE_TOOLBAR MENUITEM SEPARATOR MENUITEM "S&premenljiva velikost okna", IDM_VID_RESIZE MENUITEM "&Zapomni si velikost in položaj", IDM_VID_REMEMBER diff --git a/src/win/languages/tr-TR.rc b/src/win/languages/tr-TR.rc index 5d2ef2c50..91ee1480e 100644 --- a/src/win/languages/tr-TR.rc +++ b/src/win/languages/tr-TR.rc @@ -32,6 +32,7 @@ BEGIN POPUP "&Görüntüleme" BEGIN MENUITEM "&Durum çubuğunu gizle", IDM_VID_HIDE_STATUS_BAR + MENUITEM "Hide &toolbar", IDM_VID_HIDE_TOOLBAR MENUITEM SEPARATOR MENUITEM "&Yeniden boyutlandırılabilir pencere", IDM_VID_RESIZE MENUITEM "&Pencere boyut ve pozisyonunu hatırla", IDM_VID_REMEMBER diff --git a/src/win/languages/zh-CN.rc b/src/win/languages/zh-CN.rc index 37c5621ab..628ce1210 100644 --- a/src/win/languages/zh-CN.rc +++ b/src/win/languages/zh-CN.rc @@ -32,6 +32,7 @@ BEGIN POPUP "查看(&V)" BEGIN MENUITEM "隐藏状态栏(&H)", IDM_VID_HIDE_STATUS_BAR + MENUITEM "Hide &toolbar", IDM_VID_HIDE_TOOLBAR MENUITEM SEPARATOR MENUITEM "窗口大小可调(&R)", IDM_VID_RESIZE MENUITEM "记住窗口大小和位置(&E)", IDM_VID_REMEMBER diff --git a/src/win/win_ui.c b/src/win/win_ui.c index 863701b2d..63b3c64b8 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -276,6 +276,7 @@ ResetAllMenus(void) #endif CheckMenuItem(menuMain, IDM_VID_HIDE_STATUS_BAR, MF_UNCHECKED); + CheckMenuItem(menuMain, IDM_VID_HIDE_TOOLBAR, MF_UNCHECKED); CheckMenuItem(menuMain, IDM_VID_FORCE43, MF_UNCHECKED); CheckMenuItem(menuMain, IDM_VID_OVERSCAN, MF_UNCHECKED); CheckMenuItem(menuMain, IDM_VID_INVERT, MF_UNCHECKED); @@ -344,6 +345,7 @@ ResetAllMenus(void) #endif CheckMenuItem(menuMain, IDM_VID_HIDE_STATUS_BAR, hide_status_bar ? MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(menuMain, IDM_VID_HIDE_TOOLBAR, hide_tool_bar ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(menuMain, IDM_VID_FORCE43, force_43?MF_CHECKED:MF_UNCHECKED); CheckMenuItem(menuMain, IDM_VID_OVERSCAN, enable_overscan?MF_CHECKED:MF_UNCHECKED); CheckMenuItem(menuMain, IDM_VID_INVERT, invert_display ? MF_CHECKED : MF_UNCHECKED); @@ -641,6 +643,21 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) config_save(); break; + case IDM_VID_HIDE_TOOLBAR: + hide_tool_bar ^= 1; + CheckMenuItem(hmenu, IDM_VID_HIDE_TOOLBAR, hide_tool_bar ? MF_CHECKED : MF_UNCHECKED); + ShowWindow(hwndRebar, hide_tool_bar ? SW_HIDE : SW_SHOW); + GetWindowRect(hwnd, &rect); + if (hide_tool_bar) { + MoveWindow(hwnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top - tbar_height, TRUE); + SetWindowPos(hwndRender, NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); + } else { + MoveWindow(hwnd, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top + tbar_height, TRUE); + SetWindowPos(hwndRender, NULL, 0, tbar_height, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); + } + config_save(); + break; + case IDM_VID_RESIZE: vid_resize ^= 1; CheckMenuItem(hmenu, IDM_VID_RESIZE, (vid_resize & 1) ? MF_CHECKED : MF_UNCHECKED);