diff --git a/src/86box.c b/src/86box.c index 393ce90af..0970a6cb6 100644 --- a/src/86box.c +++ b/src/86box.c @@ -1068,7 +1068,13 @@ void update_mouse_msg() if (wcp) /* remove parentheses */ *(wcp - 1) = L'\0'; mbstowcs(wcpu, cpu_s->name, strlen(cpu_s->name)+1); - +#ifdef _WIN32 + swprintf(mouse_msg[0], sizeof_w(mouse_msg[0]), L"%%i%%%% - %ls", + plat_get_string(IDS_2077)); + swprintf(mouse_msg[1], sizeof_w(mouse_msg[1]), L"%%i%%%% - %ls", + (mouse_get_buttons() > 2) ? plat_get_string(IDS_2078) : plat_get_string(IDS_2079)); + wcsncpy(mouse_msg[2], L"%i%%", sizeof_w(mouse_msg[2])); +#else swprintf(mouse_msg[0], sizeof_w(mouse_msg[0]), L"%ls v%ls - %%i%%%% - %ls - %ls/%ls - %ls", EMU_NAME_W, EMU_VERSION_FULL_W, wmachine, wcpufamily, wcpu, plat_get_string(IDS_2077)); @@ -1077,6 +1083,7 @@ void update_mouse_msg() (mouse_get_buttons() > 2) ? plat_get_string(IDS_2078) : plat_get_string(IDS_2079)); swprintf(mouse_msg[2], sizeof_w(mouse_msg[2]), L"%ls v%ls - %%i%%%% - %ls - %ls/%ls", EMU_NAME_W, EMU_VERSION_FULL_W, wmachine, wcpufamily, wcpu); +#endif } void diff --git a/src/include/86box/language.h b/src/include/86box/language.h index 467a5704c..f9da499be 100644 --- a/src/include/86box/language.h +++ b/src/include/86box/language.h @@ -127,6 +127,13 @@ #define IDS_2151 2151 // "Cartridge images (*.JRC)\0*.JRC\0..." #define IDS_2152 2152 // "Error initializing renderer" #define IDS_2153 2153 // "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." +#define IDS_2154 2154 // "Resume execution" +#define IDS_2155 2155 // "Pause execution" +#define IDS_2156 2156 // "Press Ctrl+Alt+Del" +#define IDS_2157 2157 // "Press Ctrl+Alt+Esc" +#define IDS_2158 2158 // "Hard reset" +#define IDS_2159 2159 // "ACPI shutdown" +#define IDS_2160 2160 // "Settings" #define IDS_4096 4096 // "Hard disk (%s)" #define IDS_4097 4097 // "%01i:%01i" 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/include/86box/win.h b/src/include/86box/win.h index d776cccdf..4fb6a7d00 100644 --- a/src/include/86box/win.h +++ b/src/include/86box/win.h @@ -107,7 +107,7 @@ extern HANDLE ghMutex; extern HICON hIcon[256]; extern int dpi; extern RECT oldclip; -extern int sbar_height, user_resize; +extern int sbar_height, tbar_height, user_resize; extern int acp_utf8; // extern int status_is_open; @@ -213,6 +213,13 @@ extern void StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst extern int MediaMenuHandler(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); +/* Functions in win_toolbar.c */ +extern HWND hwndRebar; +extern void ToolBarCreate(HWND hwndParent, HINSTANCE hInst); +extern void ToolBarLoadIcons(); +extern void ToolBarUpdatePause(int paused); + + /* Functions in win_dialog.c: */ /* Pass NULL in the title param to use the default title. */ extern int file_dlg_w(HWND hwnd, WCHAR *f, WCHAR *fn, WCHAR *title, int save); diff --git a/src/win/86Box.rc b/src/win/86Box.rc index 1b48edb03..8b34c5c09 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -139,6 +139,13 @@ END 185 ICON DISCARDABLE ICON_PATH "icons/mo_empty_active.ico" 192 ICON DISCARDABLE ICON_PATH "icons/cassette_empty.ico" 193 ICON DISCARDABLE ICON_PATH "icons/cassette_empty_active.ico" +200 ICON DISCARDABLE ICON_PATH "icons/run.ico" +201 ICON DISCARDABLE ICON_PATH "icons/pause.ico" +202 ICON DISCARDABLE ICON_PATH "icons/send_cad.ico" +203 ICON DISCARDABLE ICON_PATH "icons/send_cae.ico" +204 ICON DISCARDABLE ICON_PATH "icons/hard_reset.ico" +205 ICON DISCARDABLE ICON_PATH "icons/acpi_shutdown.ico" +206 ICON DISCARDABLE ICON_PATH "icons/settings.ico" 232 ICON DISCARDABLE ICON_PATH "icons/cartridge_empty.ico" 240 ICON DISCARDABLE ICON_PATH "icons/machine.ico" 241 ICON DISCARDABLE ICON_PATH "icons/display.ico" diff --git a/src/win/CMakeLists.txt b/src/win/CMakeLists.txt index 36c3dc9ac..0d1fb00cc 100644 --- a/src/win/CMakeLists.txt +++ b/src/win/CMakeLists.txt @@ -21,7 +21,7 @@ add_library(plat OBJECT win.c win_dynld.c win_cdrom.c win_keyboard.c add_library(ui OBJECT win_ui.c win_icon.c win_stbar.c win_sdl.c win_dialog.c win_about.c win_settings.c win_devconf.c win_snd_gain.c win_specify_dim.c win_new_floppy.c win_jsconf.c win_media_menu.c win_preferences.c win_discord.c glad.c win_opengl.c - win_opengl_glslp.c 86Box.rc) + win_opengl_glslp.c win_toolbar.c 86Box.rc) if(NOT CPPTHREADS) target_sources(plat PRIVATE win_thread.c) diff --git a/src/win/Makefile.mingw b/src/win/Makefile.mingw index 303e13961..de29effc5 100644 --- a/src/win/Makefile.mingw +++ b/src/win/Makefile.mingw @@ -691,7 +691,7 @@ UIOBJ := win_ui.o win_icon.o win_stbar.o win_discord.o \ win_dialog.o win_about.o \ win_settings.o win_devconf.o win_snd_gain.o win_specify_dim.o win_preferences.o \ win_new_floppy.o win_jsconf.o \ - win_media_menu.o + win_media_menu.o win_toolbar.o ifeq ($(DINPUT), y) PLATOBJ += win_joystick.o diff --git a/src/win/icons/acpi_shutdown.ico b/src/win/icons/acpi_shutdown.ico new file mode 100644 index 000000000..a2493b803 Binary files /dev/null and b/src/win/icons/acpi_shutdown.ico differ diff --git a/src/win/icons/hard_reset.ico b/src/win/icons/hard_reset.ico new file mode 100644 index 000000000..d0494f40b Binary files /dev/null and b/src/win/icons/hard_reset.ico differ diff --git a/src/win/icons/pause.ico b/src/win/icons/pause.ico new file mode 100644 index 000000000..a57bc0a08 Binary files /dev/null and b/src/win/icons/pause.ico differ diff --git a/src/win/icons/run.ico b/src/win/icons/run.ico new file mode 100644 index 000000000..90a7f2886 Binary files /dev/null and b/src/win/icons/run.ico differ diff --git a/src/win/icons/send_cad.ico b/src/win/icons/send_cad.ico new file mode 100644 index 000000000..e3e64a743 Binary files /dev/null and b/src/win/icons/send_cad.ico differ diff --git a/src/win/icons/send_cae.ico b/src/win/icons/send_cae.ico new file mode 100644 index 000000000..757f38d35 Binary files /dev/null and b/src/win/icons/send_cae.ico differ diff --git a/src/win/icons/settings.ico b/src/win/icons/settings.ico new file mode 100644 index 000000000..ed64740b2 Binary files /dev/null and b/src/win/icons/settings.ico differ diff --git a/src/win/languages/cs-CZ.rc b/src/win/languages/cs-CZ.rc index b63d8a176..f9b128819 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 @@ -532,6 +533,13 @@ BEGIN IDS_2151 "Obrazy cartridge (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0Všechny soubory (*.*)\0*.*\0" IDS_2152 "Error initializing renderer" IDS_2153 "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." + IDS_2154 "Obnovit" + IDS_2155 "Pozastavit" + IDS_2156 "Stisknout Ctrl+Alt+Delete" + IDS_2157 "Stisknout Ctrl+Alt+Esc" + IDS_2158 "Resetovat" + IDS_2159 "Vypnout skrze rozhraní ACPI" + IDS_2160 "Nastavení" END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/de-DE.rc b/src/win/languages/de-DE.rc index 5a5ca5914..9a89beb24 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 @@ -532,6 +533,13 @@ BEGIN IDS_2151 "Cartridgeimages (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0Alle Dateien (*.*)\0*.*\0" IDS_2152 "Fehler bei der Rendererinitialisierung" IDS_2153 "Der OpenGL (3.0-Kern)-Renderer konnte nicht initialisiert werden. Bitte benutzen Sie einen anderen Renderer." + IDS_2154 "Resume execution" + IDS_2155 "Pause execution" + IDS_2156 "Press Ctrl+Alt+Del" + IDS_2157 "Press Ctrl+Alt+Esc" + IDS_2158 "Hard reset" + IDS_2159 "ACPI shutdown" + IDS_2160 "Settings" END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/en-GB.rc b/src/win/languages/en-GB.rc index 61749d954..936a05e17 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 @@ -532,6 +533,13 @@ BEGIN IDS_2151 "Cartridge images (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0All files (*.*)\0*.*\0" IDS_2152 "Error initializing renderer" IDS_2153 "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." + IDS_2154 "Resume execution" + IDS_2155 "Pause execution" + IDS_2156 "Press Ctrl+Alt+Del" + IDS_2157 "Press Ctrl+Alt+Esc" + IDS_2158 "Hard reset" + IDS_2159 "ACPI shutdown" + IDS_2160 "Settings" END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/en-US.rc b/src/win/languages/en-US.rc index 3bee70556..0266397a4 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 @@ -532,6 +533,13 @@ BEGIN IDS_2151 "Cartridge images (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0All files (*.*)\0*.*\0" IDS_2152 "Error initializing renderer" IDS_2153 "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." + IDS_2154 "Resume execution" + IDS_2155 "Pause execution" + IDS_2156 "Press Ctrl+Alt+Del" + IDS_2157 "Press Ctrl+Alt+Esc" + IDS_2158 "Hard reset" + IDS_2159 "ACPI shutdown" + IDS_2160 "Settings" END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/es-ES.rc b/src/win/languages/es-ES.rc index 2232e69c5..52cb60c6b 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 @@ -532,6 +533,13 @@ BEGIN IDS_2151 "Imágenes de Cartucho (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0All files (*.*)\0*.*\0" IDS_2152 "Error initializing renderer" IDS_2153 "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." + IDS_2154 "Resume execution" + IDS_2155 "Pause execution" + IDS_2156 "Press Ctrl+Alt+Del" + IDS_2157 "Press Ctrl+Alt+Esc" + IDS_2158 "Hard reset" + IDS_2159 "ACPI shutdown" + IDS_2160 "Settings" END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/fi-FI.rc b/src/win/languages/fi-FI.rc index 56430464d..5513977af 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 @@ -532,6 +533,13 @@ BEGIN IDS_2151 "ROM-moduulikuvat (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0Kaikki tiedostot (*.*)\0*.*\0" IDS_2152 "Virhe renderöijän alustuksessa" IDS_2153 "OpenGL (3.0 Core) renderöijän alustus epäonnistui. Käytä toista renderöijää." + IDS_2154 "Resume execution" + IDS_2155 "Pause execution" + IDS_2156 "Press Ctrl+Alt+Del" + IDS_2157 "Press Ctrl+Alt+Esc" + IDS_2158 "Hard reset" + IDS_2159 "ACPI shutdown" + IDS_2160 "Settings" END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/fr-FR.rc b/src/win/languages/fr-FR.rc index 6b58bd593..460283b0d 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 @@ -532,6 +533,13 @@ BEGIN IDS_2151 "Images cartouche (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0Tous les fichiers (*.*)\0*.*\0" IDS_2152 "Error initializing renderer" IDS_2153 "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." + IDS_2154 "Resume execution" + IDS_2155 "Pause execution" + IDS_2156 "Press Ctrl+Alt+Del" + IDS_2157 "Press Ctrl+Alt+Esc" + IDS_2158 "Hard reset" + IDS_2159 "ACPI shutdown" + IDS_2160 "Settings" END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/hr-HR.rc b/src/win/languages/hr-HR.rc index 61fc0c475..575d0ba1d 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 @@ -532,6 +533,13 @@ BEGIN IDS_2151 "Slike kasete (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0Sve datoteke (*.*)\0*.*\0" IDS_2152 "Nije moguće inicijalizirati renderer" IDS_2153 "Nije moguće inicijalizirati OpenGL (3.0 jezgra) renderer. Molimte koristite drugi renderer." + IDS_2154 "Resume execution" + IDS_2155 "Pause execution" + IDS_2156 "Press Ctrl+Alt+Del" + IDS_2157 "Press Ctrl+Alt+Esc" + IDS_2158 "Hard reset" + IDS_2159 "ACPI shutdown" + IDS_2160 "Settings" END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/hu-HU.rc b/src/win/languages/hu-HU.rc index 731ef0e42..ae7e51924 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 @@ -534,6 +535,13 @@ BEGIN IDS_2151 "ROM-kazetta képek (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0Minden fájl (*.*)\0*.*\0" IDS_2152 "Hiba történt a renderelő inicializálásakor" IDS_2153 "Az OpenGL (3.0 Core) megjelenítő-motort nem sikerült inicializálni. Kérem használjon másik renderelőt." + IDS_2154 "Resume execution" + IDS_2155 "Pause execution" + IDS_2156 "Press Ctrl+Alt+Del" + IDS_2157 "Press Ctrl+Alt+Esc" + IDS_2158 "Hard reset" + IDS_2159 "ACPI shutdown" + IDS_2160 "Settings" END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/it-IT.rc b/src/win/languages/it-IT.rc index 461b76e71..2ee1cb0a8 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 @@ -532,6 +533,13 @@ BEGIN IDS_2151 "Immagini cartuccia (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0Tutti i file (*.*)\0*.*\0" IDS_2152 "Error initializing renderer" IDS_2153 "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." + IDS_2154 "Resume execution" + IDS_2155 "Pause execution" + IDS_2156 "Press Ctrl+Alt+Del" + IDS_2157 "Press Ctrl+Alt+Esc" + IDS_2158 "Hard reset" + IDS_2159 "ACPI shutdown" + IDS_2160 "Settings" END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/ja-JP.rc b/src/win/languages/ja-JP.rc index e88e1822c..47d7184f2 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 @@ -532,6 +533,13 @@ BEGIN IDS_2151 "カートリッジイメージ (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0すべてのファイル (*.*)\0*.*\0" IDS_2152 "レンダラーの初期化エラー" IDS_2153 "OpenGL(3.0コア)レンダラーが初期化できませんでした。別のレンダラーを使用してください。" + IDS_2154 "Resume execution" + IDS_2155 "Pause execution" + IDS_2156 "Press Ctrl+Alt+Del" + IDS_2157 "Press Ctrl+Alt+Esc" + IDS_2158 "Hard reset" + IDS_2159 "ACPI shutdown" + IDS_2160 "Settings" END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/ko-KR.rc b/src/win/languages/ko-KR.rc index a46c8f6d7..b2e86d0ac 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 @@ -532,6 +533,13 @@ BEGIN IDS_2151 "카트리지 이미지 (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0모든 파일 (*.*)\0*.*\0" IDS_2152 "Error initializing renderer" IDS_2153 "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." + IDS_2154 "Resume execution" + IDS_2155 "Pause execution" + IDS_2156 "Press Ctrl+Alt+Del" + IDS_2157 "Press Ctrl+Alt+Esc" + IDS_2158 "Hard reset" + IDS_2159 "ACPI shutdown" + IDS_2160 "Settings" END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/pt-BR.rc b/src/win/languages/pt-BR.rc index 2e64edef4..5732494e6 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 @@ -535,6 +536,13 @@ BEGIN IDS_2151 "Imagens de cartucho (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0Todos os arquivos (*.*)\0*.*\0" IDS_2152 "Erro ao inicializar o renderizador" IDS_2153 "O renderizador OpenGL (Núcleo 3.0) não pôde ser inicializado. Use outro renderizador." + IDS_2154 "Resume execution" + IDS_2155 "Pause execution" + IDS_2156 "Press Ctrl+Alt+Del" + IDS_2157 "Press Ctrl+Alt+Esc" + IDS_2158 "Hard reset" + IDS_2159 "ACPI shutdown" + IDS_2160 "Settings" END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/pt-PT.rc b/src/win/languages/pt-PT.rc index a424ad141..cc50665b1 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 @@ -532,6 +533,13 @@ BEGIN IDS_2151 "Imagens de cartucho (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0Todos os ficheiros (*.*)\0*.*\0" IDS_2152 "Error initializing renderer" IDS_2153 "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." + IDS_2154 "Resume execution" + IDS_2155 "Pause execution" + IDS_2156 "Press Ctrl+Alt+Del" + IDS_2157 "Press Ctrl+Alt+Esc" + IDS_2158 "Hard reset" + IDS_2159 "ACPI shutdown" + IDS_2160 "Settings" END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/ru-RU.rc b/src/win/languages/ru-RU.rc index 413b0c5f3..6bb1f222a 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 @@ -532,6 +533,13 @@ BEGIN IDS_2151 "Образы картриджей (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0Все файлы (*.*)\0*.*\0" IDS_2152 "Error initializing renderer" IDS_2153 "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." + IDS_2154 "Resume execution" + IDS_2155 "Pause execution" + IDS_2156 "Press Ctrl+Alt+Del" + IDS_2157 "Press Ctrl+Alt+Esc" + IDS_2158 "Hard reset" + IDS_2159 "ACPI shutdown" + IDS_2160 "Settings" END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/sl-SI.rc b/src/win/languages/sl-SI.rc index fb1c80b8b..cdc00fc4a 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 @@ -532,6 +533,13 @@ BEGIN IDS_2151 "Slike spominskega vložka (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0Vse datoteke (*.*)\0*.*\0" IDS_2152 "Error initializing renderer" IDS_2153 "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." + IDS_2154 "Resume execution" + IDS_2155 "Pause execution" + IDS_2156 "Press Ctrl+Alt+Del" + IDS_2157 "Press Ctrl+Alt+Esc" + IDS_2158 "Hard reset" + IDS_2159 "ACPI shutdown" + IDS_2160 "Settings" END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/tr-TR.rc b/src/win/languages/tr-TR.rc index 5d2ef2c50..eca2767dc 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 @@ -532,6 +533,13 @@ BEGIN IDS_2151 "Kartuş imajları (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0Tüm dosyalar (*.*)\0*.*\0" IDS_2152 "Error initializing renderer" IDS_2153 "OpenGL (3.0 Core) renderer could not be initialized. Use another renderer." + IDS_2154 "Resume execution" + IDS_2155 "Pause execution" + IDS_2156 "Press Ctrl+Alt+Del" + IDS_2157 "Press Ctrl+Alt+Esc" + IDS_2158 "Hard reset" + IDS_2159 "ACPI shutdown" + IDS_2160 "Settings" END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/zh-CN.rc b/src/win/languages/zh-CN.rc index 37c5621ab..00ec3bc29 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 @@ -532,6 +533,13 @@ BEGIN IDS_2151 "卡带镜像 (*.A;*.B;*.JRC)\0*.A;*.B;*.JRC\0所有文件 (*.*)\0*.*\0" IDS_2152 "初始化渲染器时出错" IDS_2153 "无法初始化 OpenGL (3.0 核心) 渲染器。请使用其他渲染器。" + IDS_2154 "Resume execution" + IDS_2155 "Pause execution" + IDS_2156 "Press Ctrl+Alt+Del" + IDS_2157 "Press Ctrl+Alt+Esc" + IDS_2158 "Hard reset" + IDS_2159 "ACPI shutdown" + IDS_2160 "Settings" END STRINGTABLE DISCARDABLE diff --git a/src/win/win.c b/src/win/win.c index a4854f65f..7d127efa6 100644 --- a/src/win/win.c +++ b/src/win/win.c @@ -1118,10 +1118,7 @@ plat_setfullscreen(int on) GetClientRect(hwndMain, &rect); temp_x = rect.right - rect.left + 1; - if (hide_status_bar) - temp_y = rect.bottom - rect.top + 1; - else - temp_y = rect.bottom - rect.top + 1 - sbar_height; + temp_y = rect.bottom - rect.top + 1 - (hide_status_bar ? 0 : sbar_height) - (hide_tool_bar ? 0 : tbar_height); } else { if (dpi_scale) { temp_x = MulDiv((vid_resize & 2) ? fixed_size_x : unscaled_size_x, dpi, 96); @@ -1135,10 +1132,7 @@ plat_setfullscreen(int on) if (vid_resize >= 2) MoveWindow(hwndMain, window_x, window_y, window_w, window_h, TRUE); - if (hide_status_bar) - ResizeWindowByClientArea(hwndMain, temp_x, temp_y); - else - ResizeWindowByClientArea(hwndMain, temp_x, temp_y + sbar_height); + ResizeWindowByClientArea(hwndMain, temp_x, temp_y + (hide_status_bar ? 0 : sbar_height) + (hide_tool_bar ? 0 : tbar_height)); } /* Render window. */ diff --git a/src/win/win_icon.c b/src/win/win_icon.c index 9b0d5ef23..33a5932ef 100644 --- a/src/win/win_icon.c +++ b/src/win/win_icon.c @@ -87,6 +87,13 @@ const _ICON_DATA icon_files[] = {185, "mo_empty_active.ico"}, {192, "cassette_empty.ico"}, {193, "cassette_empty_active.ico"}, + {200, "run.ico"}, + {201, "pause.ico"}, + {202, "send_cad.ico"}, + {203, "send_cae.ico"}, + {204, "hard_reset.ico"}, + {205, "acpi_shutdown.ico"}, + {206, "settings.ico"}, {232, "cartridge_empty.ico"}, {240, "machine.ico"}, {241, "display.ico"}, @@ -120,9 +127,11 @@ void win_load_icon_set() win_clear_icon_set(); win_system_icon_set(); - if (strlen(icon_set) == 0) + if (strlen(icon_set) == 0) { + ToolBarLoadIcons(); return; - + } + char path_root[2048] = {0}, temp[2048] = {0}; wchar_t wtemp[2048] = {0}; @@ -150,4 +159,6 @@ void win_load_icon_set() uint32_t curr_lang = lang_id; lang_id = 0; set_language(curr_lang); + + ToolBarLoadIcons(); } \ No newline at end of file diff --git a/src/win/win_specify_dim.c b/src/win/win_specify_dim.c index 96ae0403c..64a95cef4 100644 --- a/src/win/win_specify_dim.c +++ b/src/win/win_specify_dim.c @@ -119,7 +119,7 @@ SpecifyDimensionsDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM temp_y = MulDiv(temp_y, dpi, 96); } - ResizeWindowByClientArea(hwndMain, temp_x, temp_y + sbar_height); + ResizeWindowByClientArea(hwndMain, temp_x, temp_y + sbar_height + tbar_height); if (vid_resize) { CheckMenuItem(hmenu, IDM_VID_SCALE_1X + scale, MF_UNCHECKED); diff --git a/src/win/win_stbar.c b/src/win/win_stbar.c index afc906215..29985aaf3 100644 --- a/src/win/win_stbar.c +++ b/src/win/win_stbar.c @@ -54,10 +54,6 @@ #include <86box/ui.h> #include <86box/win.h> -#ifndef GWL_WNDPROC -#define GWL_WNDPROC GWLP_WNDPROC -#endif - HWND hwndSBAR; int update_icons = 1, reset_occurred = 1; @@ -992,7 +988,7 @@ StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst) /* Replace the original procedure with ours. */ OriginalProcedure = GetWindowLongPtr(hwndSBAR, GWLP_WNDPROC); - SetWindowLongPtr(hwndSBAR, GWL_WNDPROC, (LONG_PTR)&StatusBarProcedure); + SetWindowLongPtr(hwndSBAR, GWLP_WNDPROC, (LONG_PTR)&StatusBarProcedure); SendMessage(hwndSBAR, SB_SETMINHEIGHT, (WPARAM)17, (LPARAM)0); diff --git a/src/win/win_toolbar.c b/src/win/win_toolbar.c new file mode 100644 index 000000000..71e9a02c3 --- /dev/null +++ b/src/win/win_toolbar.c @@ -0,0 +1,219 @@ +#define UNICODE +#include +#include +#include +#include +#include +#include <86box/86box.h> +#include <86box/plat.h> +#include <86box/resource.h> +#include <86box/ui.h> +#include <86box/win.h> + +HWND hwndRebar = NULL; +static HWND hwndToolbar = NULL; +static HIMAGELIST hImageList = NULL; +static wchar_t wTitle[512] = { 0 }; +static WNDPROC pOriginalProcedure = NULL; + + +enum image_index { + RUN, + PAUSE, + CTRL_ALT_DEL, + CTRL_ALT_ESC, + HARD_RESET, + ACPI_SHUTDOWN, + SETTINGS +}; + + +void +ToolBarLoadIcons() +{ + if (!hwndToolbar) + return; + + if (hImageList) + ImageList_Destroy(hImageList); + + hImageList = ImageList_Create(win_get_system_metrics(SM_CXSMICON, dpi), + win_get_system_metrics(SM_CYSMICON, dpi), + ILC_MASK | ILC_COLOR32, 1, 1); + + // The icons must be loaded in the same order as the `image_index` + // enumeration above. + + ImageList_AddIcon(hImageList, hIcon[200]); // Run + ImageList_AddIcon(hImageList, hIcon[201]); // Pause + ImageList_AddIcon(hImageList, hIcon[202]); // Ctrl+Alt+Delete + ImageList_AddIcon(hImageList, hIcon[203]); // Ctrl+Alt+Esc + ImageList_AddIcon(hImageList, hIcon[204]); // Hard reset + ImageList_AddIcon(hImageList, hIcon[205]); // ACPI shutdown + ImageList_AddIcon(hImageList, hIcon[206]); // Settings + + SendMessage(hwndToolbar, TB_SETIMAGELIST, 0, (LPARAM) hImageList); +} + + +int +ToolBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) { + case WM_NOTIFY: + switch (((LPNMHDR) lParam)->code) { + case TTN_GETDISPINFO: { + LPTOOLTIPTEXT lpttt = (LPTOOLTIPTEXT)lParam; + + // Set the instance of the module that contains the resource. + lpttt->hinst = hinstance; + + uintptr_t idButton = lpttt->hdr.idFrom; + + switch (idButton) { + case IDM_ACTION_PAUSE: + if (dopause) + lpttt->lpszText = MAKEINTRESOURCE(IDS_2154); + else + lpttt->lpszText = MAKEINTRESOURCE(IDS_2155); + break; + + case IDM_ACTION_RESET_CAD: + lpttt->lpszText = MAKEINTRESOURCE(IDS_2156); + break; + + case IDM_ACTION_CTRL_ALT_ESC: + lpttt->lpszText = MAKEINTRESOURCE(IDS_2157); + break; + + case IDM_ACTION_HRESET: + lpttt->lpszText = MAKEINTRESOURCE(IDS_2158); + break; + + case IDM_CONFIG: + lpttt->lpszText = MAKEINTRESOURCE(IDS_2160); + break; + } + + return TRUE; + } + } + } + + return(CallWindowProc(pOriginalProcedure, hwnd, message, wParam, lParam)); +} + + +void +ToolBarUpdatePause(int pause) +{ + TBBUTTONINFO tbbi; + + tbbi.cbSize = sizeof(tbbi); + tbbi.dwMask = TBIF_IMAGE; + tbbi.iImage = pause ? RUN : PAUSE; + + SendMessage(hwndToolbar, TB_SETBUTTONINFO, IDM_ACTION_PAUSE, (LPARAM) &tbbi); +} + + +static TBBUTTON buttons[] = { + { PAUSE, IDM_ACTION_PAUSE, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, + { HARD_RESET, IDM_ACTION_HRESET, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, + { ACPI_SHUTDOWN, 0, TBSTATE_INDETERMINATE, BTNS_BUTTON, { 0 }, 0, 0 }, + { 0, 0, TBSTATE_INDETERMINATE, BTNS_SEP, { 0 }, 0, 0 }, + { CTRL_ALT_DEL, IDM_ACTION_RESET_CAD, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, + { CTRL_ALT_ESC, IDM_ACTION_CTRL_ALT_ESC, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, + { 0, 0, TBSTATE_INDETERMINATE, BTNS_SEP, { 0 }, 0, 0 }, + { SETTINGS, IDM_CONFIG, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 } +}; + + +void +ToolBarCreate(HWND hwndParent, HINSTANCE hInst) +{ + REBARINFO rbi = { 0 }; + REBARBANDINFO rbbi = { 0 }; + int btnSize; + + // Create the toolbar. + hwndToolbar = CreateWindowEx(WS_EX_PALETTEWINDOW, TOOLBARCLASSNAME, NULL, + WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | + WS_CLIPSIBLINGS | TBSTYLE_TOOLTIPS | + TBSTYLE_FLAT | CCS_TOP | BTNS_AUTOSIZE | + CCS_NOPARENTALIGN | CCS_NORESIZE | + CCS_NODIVIDER, + 0, 0, 0, 0, + hwndParent, NULL, hInst, NULL); + + ToolBarLoadIcons(); + + // Add buttons. + SendMessage(hwndToolbar, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); + SendMessage(hwndToolbar, TB_ADDBUTTONS, sizeof(buttons) / sizeof(TBBUTTON), (LPARAM) &buttons); + + // Autosize the toolbar and determine its size. + btnSize = LOWORD(SendMessage(hwndToolbar, TB_GETBUTTONSIZE, 0,0)); + + // Replace the original procedure with ours. + pOriginalProcedure = (WNDPROC) GetWindowLongPtr(hwndToolbar, GWLP_WNDPROC); + SetWindowLongPtr(hwndToolbar, GWLP_WNDPROC, (LONG_PTR)&ToolBarProcedure); + + // Make sure the Pause button is in the correct state. + ToolBarUpdatePause(dopause); + + // Create the containing Rebar. + hwndRebar = CreateWindowEx(0, REBARCLASSNAME, NULL, + WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | + WS_CLIPCHILDREN | RBS_VARHEIGHT | + CCS_NODIVIDER | CCS_NOPARENTALIGN, + 0, 0, scrnsz_x, 0, + hwndParent, NULL, hInst, NULL); + + // Create and send the REBARINFO structure. + rbi.cbSize = sizeof(rbi); + SendMessage(hwndRebar, RB_SETBARINFO, 0, (LPARAM)&rbi); + + // Add the toolbar to the rebar. + rbbi.cbSize = sizeof(rbbi); + rbbi.fMask = RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_STYLE; + rbbi.hwndChild = hwndToolbar; + rbbi.cxMinChild = 0; + rbbi.cyMinChild = btnSize; + rbbi.fStyle = RBBS_NOGRIPPER; + SendMessage(hwndRebar, RB_INSERTBAND, -1, (LPARAM)&rbbi); + + // Add a label for machine information. + rbbi.fMask = RBBIM_TEXT | RBBIM_STYLE; + rbbi.lpText = TEXT("Test"); + rbbi.fStyle = RBBS_NOGRIPPER; + SendMessage(hwndRebar, RB_INSERTBAND, -1, (LPARAM)&rbbi); + + SendMessage(hwndRebar, RB_MAXIMIZEBAND, 0, 0); + ShowWindow(hwndRebar, TRUE); + + return; +} + + +wchar_t * +ui_window_title(wchar_t *s) +{ + REBARBANDINFO rbbi = { 0 }; + if (! video_fullscreen) { + if (s != NULL) { + wcsncpy(wTitle, s, sizeof_w(wTitle) - 1); + } else + s = wTitle; + + rbbi.cbSize = sizeof(rbbi); + rbbi.fMask = RBBIM_TEXT; + rbbi.lpText = s; + SendMessage(hwndRebar, RB_SETBANDINFO, 1, (LPARAM) &rbbi); + } else { + if (s == NULL) + s = wTitle; + } + + return(s); +} diff --git a/src/win/win_ui.c b/src/win/win_ui.c index c2740f0c7..099540ccb 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -58,6 +58,7 @@ HWND hwndMain = NULL, /* application main window */ HMENU menuMain; /* application main menu */ RECT oldclip; /* mouse rect */ int sbar_height = 23; /* statusbar height */ +int tbar_height = 23; /* toolbar height */ int minimized = 0; int infocus = 1, button_down = 0; int rctrl_is_lalt = 0; @@ -73,7 +74,6 @@ extern WCHAR wopenfilestring[512]; /* Local data. */ -static wchar_t wTitle[512]; static int manager_wm = 0; static int save_window_pos = 0, pause_state = 0; static int padded_frame = 0; @@ -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); @@ -659,10 +676,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) temp_y = unscaled_size_y; } - if (hide_status_bar) - ResizeWindowByClientArea(hwnd, temp_x, temp_y); - else - ResizeWindowByClientArea(hwnd, temp_x, temp_y + sbar_height); + ResizeWindowByClientArea(hwnd, temp_x, temp_y + (hide_status_bar ? 0 : sbar_height) + (hide_tool_bar ? 0 : tbar_height)); if (mouse_capture) { ClipCursor(&rect); @@ -940,6 +954,8 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) dpi = HIWORD(wParam); GetWindowRect(hwndSBAR, &rect); sbar_height = rect.bottom - rect.top; + GetWindowRect(hwndRebar, &rect); + tbar_height = rect.bottom - rect.top; rect_p = (RECT*)lParam; if (vid_resize == 1) MoveWindow(hwnd, rect_p->left, rect_p->top, rect_p->right - rect_p->left, rect_p->bottom - rect_p->top, TRUE); @@ -952,10 +968,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) } /* Main Window. */ - if (hide_status_bar) - ResizeWindowByClientArea(hwndMain, temp_x, temp_y); - else - ResizeWindowByClientArea(hwndMain, temp_x, temp_y + sbar_height); + ResizeWindowByClientArea(hwndMain, temp_x, temp_y + (hide_status_bar ? 0 : sbar_height) + (hide_tool_bar ? 0 : tbar_height)); } else if (!user_resize) atomic_flag_clear(&doresize); break; @@ -990,12 +1003,13 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) if (!(pos->flags & SWP_NOSIZE) || !user_resize) { plat_vidapi_enable(0); - if (hide_status_bar) - MoveWindow(hwndRender, 0, 0, rect.right, rect.bottom, TRUE); - else { + if (!hide_status_bar) 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_tool_bar) + MoveWindow(hwndRebar, 0, 0, rect.right, tbar_height, TRUE); + + MoveWindow(hwndRender, 0, hide_tool_bar ? 0 : tbar_height, rect.right, rect.bottom - (hide_status_bar ? 0 : sbar_height) - (hide_tool_bar ? 0 : tbar_height), TRUE); GetClientRect(hwndRender, &rect); if (dpi_scale) { @@ -1255,7 +1269,7 @@ ui_init(int nCmdShow) MSG messages = {0}; /* received-messages buffer */ HWND hwnd = NULL; /* handle for our window */ HACCEL haccel; /* handle to accelerator table */ - RECT sbar_rect; /* RECT of the status bar */ + RECT rect; int bRet; TASKDIALOGCONFIG tdconfig = {0}; TASKDIALOG_BUTTON tdbuttons[] = {{IDCANCEL, MAKEINTRESOURCE(IDS_2119)}}; @@ -1341,7 +1355,7 @@ ui_init(int nCmdShow) return(2); /* Now create our main window. */ - mbstowcs(title, emu_version, sizeof_w(title)); + swprintf_s(title, sizeof_w(title), L"%hs - %s %s", vm_name, EMU_NAME_W, EMU_VERSION_FULL_W); hwnd = CreateWindowEx ( 0, /* no extended possibilites */ CLASS_NAME, /* class name */ @@ -1369,11 +1383,20 @@ ui_init(int nCmdShow) StatusBarCreate(hwndMain, IDC_STATUS, hinstance); /* Get the actual height of the status bar */ - GetWindowRect(hwndSBAR, &sbar_rect); - sbar_height = sbar_rect.bottom - sbar_rect.top; + GetWindowRect(hwndSBAR, &rect); + sbar_height = rect.bottom - rect.top; if (hide_status_bar) ShowWindow(hwndSBAR, SW_HIDE); + /* Create the toolbar window. */ + ToolBarCreate(hwndMain, hinstance); + + /* Get the actual height of the toolbar */ + GetWindowRect(hwndRebar, &rect); + tbar_height = rect.bottom - rect.top; + if (hide_tool_bar) + ShowWindow(hwndRebar, SW_HIDE); + /* Set up main window for resizing if configured. */ if (vid_resize == 1) SetWindowLongPtr(hwnd, GWL_STYLE, @@ -1564,25 +1587,6 @@ ui_init(int nCmdShow) } -wchar_t * -ui_window_title(wchar_t *s) -{ - if (! video_fullscreen) { - if (s != NULL) { - wcsncpy(wTitle, s, sizeof_w(wTitle) - 1); - } else - s = wTitle; - - SetWindowText(hwndMain, s); - } else { - if (s == NULL) - s = wTitle; - } - - return(s); -} - - /* We should have the language ID as a parameter. */ void plat_pause(int p) @@ -1626,6 +1630,9 @@ plat_pause(int p) if (enable_discord) discord_update_activity(dopause); + /* Update the toolbar */ + ToolBarUpdatePause(p); + /* Send the WM to a manager if needed. */ if (source_hwnd) PostMessage((HWND) (uintptr_t) source_hwnd, WM_SENDSTATUS, (WPARAM) !!dopause, (LPARAM) hwndMain); @@ -1643,10 +1650,7 @@ plat_resize(int x, int y) x = MulDiv(x, dpi, 96); y = MulDiv(y, dpi, 96); } - if (hide_status_bar) - ResizeWindowByClientArea(hwndMain, x, y); - else - ResizeWindowByClientArea(hwndMain, x, y + sbar_height); + ResizeWindowByClientArea(hwndMain, x, y + (hide_status_bar ? 0 : sbar_height) + (hide_tool_bar ? 0 : tbar_height)); } }