From 929ee5123446d619617929cab1cc74fdfafea071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Sun, 9 Jan 2022 18:38:18 +0100 Subject: [PATCH 01/18] Add a toolbar to the Windows GUI --- src/include/86box/win.h | 7 +++- src/win/CMakeLists.txt | 2 +- src/win/win.c | 10 +---- src/win/win_specify_dim.c | 2 +- src/win/win_toolbar.c | 85 +++++++++++++++++++++++++++++++++++++++ src/win/win_ui.c | 44 +++++++++++--------- 6 files changed, 119 insertions(+), 31 deletions(-) create mode 100644 src/win/win_toolbar.c diff --git a/src/include/86box/win.h b/src/include/86box/win.h index d776cccdf..6c061ef4a 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,11 @@ 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); + + /* 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/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/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_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_toolbar.c b/src/win/win_toolbar.c new file mode 100644 index 000000000..faf9712f8 --- /dev/null +++ b/src/win/win_toolbar.c @@ -0,0 +1,85 @@ +#define UNICODE +#include +#include +#include +#include +#include +#include <86box/86box.h> +#include <86box/resource.h> +#include <86box/ui.h> +#include <86box/win.h> + +HWND hwndRebar; +static HWND hwndToolbar; +static HIMAGELIST hImageList; + +static TBBUTTON buttons[] = { + { 0, IDM_ACTION_PAUSE, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, // Pause + { 0, 0, TBSTATE_INDETERMINATE, BTNS_SEP, { 0 }, 0, 0 }, + { 0, IDM_ACTION_RESET_CAD, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, // Ctrl+Alt+Del + { 0, IDM_ACTION_CTRL_ALT_ESC, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, // Ctrl+Alt+Esc + { 0, IDM_ACTION_HRESET, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, // Hard reset + { 0, 0, TBSTATE_INDETERMINATE, BTNS_BUTTON, { 0 }, 0, 0 }, // ACPI shutdown + { 0, 0, TBSTATE_INDETERMINATE, BTNS_SEP, { 0 }, 0, 0 }, + { 0, IDM_CONFIG, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 } // Settings +}; + +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); + + // Create the image list. + hImageList = ImageList_Create(win_get_system_metrics(SM_CXSMICON, dpi), + win_get_system_metrics(SM_CYSMICON, dpi), + ILC_MASK | ILC_COLOR32, 1, 1); + + ImageList_AddIcon(hImageList, hIcon[241]); + + SendMessage(hwndToolbar, TB_SETIMAGELIST, 0, (LPARAM) hImageList); + + // 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)); + + // Create the containing Rebar. + hwndRebar = CreateWindowEx(0, REBARCLASSNAME, NULL, + WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | + WS_CLIPCHILDREN | RBS_VARHEIGHT | + RBS_BANDBORDERS | CCS_NODIVIDER | + CCS_NOPARENTALIGN, + 0, 0, 0, 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; + rbbi.hwndChild = hwndToolbar; + rbbi.cxMinChild = 0; + rbbi.cyMinChild = btnSize; + SendMessage(hwndRebar, RB_INSERTBAND, -1, (LPARAM)&rbbi); + SendMessage(hwndRebar, RB_MAXIMIZEBAND, 0, 0); + + ShowWindow(hwndRebar, TRUE); + + return; +} \ No newline at end of file diff --git a/src/win/win_ui.c b/src/win/win_ui.c index f866ed5bf..362ab3343 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; @@ -658,10 +659,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); @@ -939,6 +937,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); @@ -951,10 +951,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; @@ -986,12 +983,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) { @@ -1244,7 +1242,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)}}; @@ -1358,11 +1356,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, @@ -1632,10 +1639,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)); } } From e5b56e882096c0cd6256ce8c0948b8f389078fbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Sun, 9 Jan 2022 19:12:08 +0100 Subject: [PATCH 02/18] Move machine information to the toolbar --- src/win/win_toolbar.c | 40 +++++++++++++++++++++++++++++++++++----- src/win/win_ui.c | 22 +--------------------- 2 files changed, 36 insertions(+), 26 deletions(-) diff --git a/src/win/win_toolbar.c b/src/win/win_toolbar.c index faf9712f8..e2addf3e5 100644 --- a/src/win/win_toolbar.c +++ b/src/win/win_toolbar.c @@ -5,6 +5,7 @@ #include #include #include <86box/86box.h> +#include <86box/plat.h> #include <86box/resource.h> #include <86box/ui.h> #include <86box/win.h> @@ -12,6 +13,7 @@ HWND hwndRebar; static HWND hwndToolbar; static HIMAGELIST hImageList; +static wchar_t wTitle[512]; static TBBUTTON buttons[] = { { 0, IDM_ACTION_PAUSE, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, // Pause @@ -61,8 +63,7 @@ ToolBarCreate(HWND hwndParent, HINSTANCE hInst) hwndRebar = CreateWindowEx(0, REBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | RBS_VARHEIGHT | - RBS_BANDBORDERS | CCS_NODIVIDER | - CCS_NOPARENTALIGN, + CCS_NODIVIDER | CCS_NOPARENTALIGN, 0, 0, 0, 0, hwndParent, NULL, hInst, NULL); @@ -72,14 +73,43 @@ ToolBarCreate(HWND hwndParent, HINSTANCE hInst) // Add the toolbar to the rebar. rbbi.cbSize = sizeof(rbbi); - rbbi.fMask = RBBIM_CHILD | RBBIM_CHILDSIZE; + 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); - SendMessage(hwndRebar, RB_MAXIMIZEBAND, 0, 0); + // 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; -} \ No newline at end of file +} + +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 362ab3343..95061cbf6 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -74,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; @@ -1328,7 +1327,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 - %hs", vm_name, EMU_NAME); hwnd = CreateWindowEx ( 0, /* no extended possibilites */ CLASS_NAME, /* class name */ @@ -1560,25 +1559,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) From b1664a258d8830ca115bd081e2791f9fdc6cd631 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Sun, 9 Jan 2022 19:56:53 +0100 Subject: [PATCH 03/18] Fix blank space between toolbar and render area --- src/win/win_toolbar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/win/win_toolbar.c b/src/win/win_toolbar.c index e2addf3e5..7a4d75011 100644 --- a/src/win/win_toolbar.c +++ b/src/win/win_toolbar.c @@ -64,7 +64,7 @@ ToolBarCreate(HWND hwndParent, HINSTANCE hInst) WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | RBS_VARHEIGHT | CCS_NODIVIDER | CCS_NOPARENTALIGN, - 0, 0, 0, 0, + 0, 0, scrnsz_x, 0, hwndParent, NULL, hInst, NULL); // Create and send the REBARINFO structure. From 9abdb1e048f09332a08b095e9e16004db8c91a11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Sun, 9 Jan 2022 19:58:06 +0100 Subject: [PATCH 04/18] Add the toolbar code to the MinGW makefile --- src/win/Makefile.mingw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From a284ddd45bab70fb20c79c076a8c8d9dfd170aa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Mon, 10 Jan 2022 01:20:21 +0100 Subject: [PATCH 05/18] Reduce the status message to speed and mouse capture --- src/86box.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 From 529889d21ea6038e94da019c4356ac0f7bc673c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Mon, 10 Jan 2022 01:25:35 +0100 Subject: [PATCH 06/18] Show full version string in the title bar --- src/win/win_ui.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/win/win_ui.c b/src/win/win_ui.c index 17005ca7c..863701b2d 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -1328,7 +1328,7 @@ ui_init(int nCmdShow) return(2); /* Now create our main window. */ - swprintf_s(title, sizeof_w(title), L"%hs - %hs", vm_name, EMU_NAME); + 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 */ 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 07/18] 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); From cd616b407ccecc92685df8cb2941ebfbdc9dc31b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Wed, 12 Jan 2022 22:01:41 +0100 Subject: [PATCH 08/18] Add tooltips to the toolbar buttons --- src/win/win_toolbar.c | 52 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/src/win/win_toolbar.c b/src/win/win_toolbar.c index 7a4d75011..d5d2c87cb 100644 --- a/src/win/win_toolbar.c +++ b/src/win/win_toolbar.c @@ -14,6 +14,7 @@ HWND hwndRebar; static HWND hwndToolbar; static HIMAGELIST hImageList; static wchar_t wTitle[512]; +static WNDPROC pOriginalProcedure; static TBBUTTON buttons[] = { { 0, IDM_ACTION_PAUSE, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, // Pause @@ -26,6 +27,52 @@ static TBBUTTON buttons[] = { { 0, IDM_CONFIG, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 } // Settings }; + +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: + lpttt->lpszText = L"Pause execution"; + break; + + case IDM_ACTION_RESET_CAD: + lpttt->lpszText = L"Press Ctrl+Alt+Delete"; + break; + + case IDM_ACTION_CTRL_ALT_ESC: + lpttt->lpszText = L"Press Ctrl+Alt+Esc"; + break; + + case IDM_ACTION_HRESET: + lpttt->lpszText = L"Hard reset"; + break; + + case IDM_CONFIG: + lpttt->lpszText = L"Settings"; + break; + } + + return TRUE; + } + } + } + + return(CallWindowProc(pOriginalProcedure, hwnd, message, wParam, lParam)); +} + + void ToolBarCreate(HWND hwndParent, HINSTANCE hInst) { @@ -59,6 +106,10 @@ ToolBarCreate(HWND hwndParent, HINSTANCE hInst) // 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, GWL_WNDPROC, (LONG_PTR)&ToolBarProcedure); + // Create the containing Rebar. hwndRebar = CreateWindowEx(0, REBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | @@ -92,6 +143,7 @@ ToolBarCreate(HWND hwndParent, HINSTANCE hInst) return; } + wchar_t * ui_window_title(wchar_t *s) { From 8d0c1dec81d5242033564dd0e3468e867ee22d89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Wed, 12 Jan 2022 23:15:33 +0100 Subject: [PATCH 09/18] Add taskbar tooltips to the resources for localization --- src/include/86box/language.h | 7 +++++++ src/win/languages/cs-CZ.rc | 7 +++++++ src/win/languages/de-DE.rc | 7 +++++++ src/win/languages/en-GB.rc | 7 +++++++ src/win/languages/en-US.rc | 7 +++++++ src/win/languages/es-ES.rc | 7 +++++++ src/win/languages/fi-FI.rc | 7 +++++++ src/win/languages/fr-FR.rc | 7 +++++++ src/win/languages/hr-HR.rc | 7 +++++++ src/win/languages/hu-HU.rc | 7 +++++++ src/win/languages/it-IT.rc | 7 +++++++ src/win/languages/ja-JP.rc | 7 +++++++ src/win/languages/ko-KR.rc | 7 +++++++ src/win/languages/pt-BR.rc | 7 +++++++ src/win/languages/pt-PT.rc | 7 +++++++ src/win/languages/ru-RU.rc | 7 +++++++ src/win/languages/sl-SI.rc | 7 +++++++ src/win/languages/tr-TR.rc | 7 +++++++ src/win/languages/zh-CN.rc | 7 +++++++ src/win/win_toolbar.c | 10 +++++----- 20 files changed, 138 insertions(+), 5 deletions(-) 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/win/languages/cs-CZ.rc b/src/win/languages/cs-CZ.rc index d9f392cc9..6ad1d8788 100644 --- a/src/win/languages/cs-CZ.rc +++ b/src/win/languages/cs-CZ.rc @@ -533,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_2159 "Nastavení" END STRINGTABLE DISCARDABLE diff --git a/src/win/languages/de-DE.rc b/src/win/languages/de-DE.rc index 38a562cd5..9a89beb24 100644 --- a/src/win/languages/de-DE.rc +++ b/src/win/languages/de-DE.rc @@ -533,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 939d96f5c..936a05e17 100644 --- a/src/win/languages/en-GB.rc +++ b/src/win/languages/en-GB.rc @@ -533,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 c010e9a90..0266397a4 100644 --- a/src/win/languages/en-US.rc +++ b/src/win/languages/en-US.rc @@ -533,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 44fadfc6e..52cb60c6b 100644 --- a/src/win/languages/es-ES.rc +++ b/src/win/languages/es-ES.rc @@ -533,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 bedc9d3f7..5513977af 100644 --- a/src/win/languages/fi-FI.rc +++ b/src/win/languages/fi-FI.rc @@ -533,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 a59c78dab..460283b0d 100644 --- a/src/win/languages/fr-FR.rc +++ b/src/win/languages/fr-FR.rc @@ -533,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 ba384f5a6..575d0ba1d 100644 --- a/src/win/languages/hr-HR.rc +++ b/src/win/languages/hr-HR.rc @@ -533,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 1b7dfbe43..ae7e51924 100644 --- a/src/win/languages/hu-HU.rc +++ b/src/win/languages/hu-HU.rc @@ -535,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 2656a2d5d..2ee1cb0a8 100644 --- a/src/win/languages/it-IT.rc +++ b/src/win/languages/it-IT.rc @@ -533,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 c74b99d81..47d7184f2 100644 --- a/src/win/languages/ja-JP.rc +++ b/src/win/languages/ja-JP.rc @@ -533,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 510bc8c60..b2e86d0ac 100644 --- a/src/win/languages/ko-KR.rc +++ b/src/win/languages/ko-KR.rc @@ -533,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 e2a9a856e..5732494e6 100644 --- a/src/win/languages/pt-BR.rc +++ b/src/win/languages/pt-BR.rc @@ -536,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 c30f6d50d..cc50665b1 100644 --- a/src/win/languages/pt-PT.rc +++ b/src/win/languages/pt-PT.rc @@ -533,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 72b4e7e66..6bb1f222a 100644 --- a/src/win/languages/ru-RU.rc +++ b/src/win/languages/ru-RU.rc @@ -533,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 815c08603..cdc00fc4a 100644 --- a/src/win/languages/sl-SI.rc +++ b/src/win/languages/sl-SI.rc @@ -533,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 91ee1480e..eca2767dc 100644 --- a/src/win/languages/tr-TR.rc +++ b/src/win/languages/tr-TR.rc @@ -533,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 628ce1210..00ec3bc29 100644 --- a/src/win/languages/zh-CN.rc +++ b/src/win/languages/zh-CN.rc @@ -533,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_toolbar.c b/src/win/win_toolbar.c index d5d2c87cb..c6f22644c 100644 --- a/src/win/win_toolbar.c +++ b/src/win/win_toolbar.c @@ -44,23 +44,23 @@ ToolBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) switch (idButton) { case IDM_ACTION_PAUSE: - lpttt->lpszText = L"Pause execution"; + lpttt->lpszText = MAKEINTRESOURCE(IDS_2155); break; case IDM_ACTION_RESET_CAD: - lpttt->lpszText = L"Press Ctrl+Alt+Delete"; + lpttt->lpszText = MAKEINTRESOURCE(IDS_2156); break; case IDM_ACTION_CTRL_ALT_ESC: - lpttt->lpszText = L"Press Ctrl+Alt+Esc"; + lpttt->lpszText = MAKEINTRESOURCE(IDS_2157); break; case IDM_ACTION_HRESET: - lpttt->lpszText = L"Hard reset"; + lpttt->lpszText = MAKEINTRESOURCE(IDS_2158); break; case IDM_CONFIG: - lpttt->lpszText = L"Settings"; + lpttt->lpszText = MAKEINTRESOURCE(IDS_2160); break; } From e5bf6ea015676621f5c14245c1e7e1ffbfb56446 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Wed, 12 Jan 2022 23:40:40 +0100 Subject: [PATCH 10/18] Add support for icon set switching to the toolbar --- src/include/86box/win.h | 1 + src/win/win_icon.c | 8 ++++-- src/win/win_toolbar.c | 54 +++++++++++++++++++++++++++-------------- 3 files changed, 43 insertions(+), 20 deletions(-) diff --git a/src/include/86box/win.h b/src/include/86box/win.h index 6c061ef4a..0bbc99642 100644 --- a/src/include/86box/win.h +++ b/src/include/86box/win.h @@ -216,6 +216,7 @@ extern int MediaMenuHandler(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPara /* Functions in win_toolbar.c */ extern HWND hwndRebar; extern void ToolBarCreate(HWND hwndParent, HINSTANCE hInst); +extern void ToolBarLoadIcons(); /* Functions in win_dialog.c: */ diff --git a/src/win/win_icon.c b/src/win/win_icon.c index 9b0d5ef23..8d3ec9590 100644 --- a/src/win/win_icon.c +++ b/src/win/win_icon.c @@ -120,9 +120,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 +152,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_toolbar.c b/src/win/win_toolbar.c index c6f22644c..aa1d60cd6 100644 --- a/src/win/win_toolbar.c +++ b/src/win/win_toolbar.c @@ -10,21 +10,21 @@ #include <86box/ui.h> #include <86box/win.h> -HWND hwndRebar; -static HWND hwndToolbar; -static HIMAGELIST hImageList; -static wchar_t wTitle[512]; -static WNDPROC pOriginalProcedure; +HWND hwndRebar = NULL; +static HWND hwndToolbar = NULL; +static HIMAGELIST hImageList = NULL; +static wchar_t wTitle[512] = { 0 }; +static WNDPROC pOriginalProcedure = NULL; static TBBUTTON buttons[] = { { 0, IDM_ACTION_PAUSE, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, // Pause { 0, 0, TBSTATE_INDETERMINATE, BTNS_SEP, { 0 }, 0, 0 }, - { 0, IDM_ACTION_RESET_CAD, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, // Ctrl+Alt+Del - { 0, IDM_ACTION_CTRL_ALT_ESC, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, // Ctrl+Alt+Esc - { 0, IDM_ACTION_HRESET, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, // Hard reset - { 0, 0, TBSTATE_INDETERMINATE, BTNS_BUTTON, { 0 }, 0, 0 }, // ACPI shutdown + { 1, IDM_ACTION_RESET_CAD, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, // Ctrl+Alt+Del + { 2, IDM_ACTION_CTRL_ALT_ESC, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, // Ctrl+Alt+Esc + { 3, IDM_ACTION_HRESET, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, // Hard reset + { 4, 0, TBSTATE_INDETERMINATE, BTNS_BUTTON, { 0 }, 0, 0 }, // ACPI shutdown { 0, 0, TBSTATE_INDETERMINATE, BTNS_SEP, { 0 }, 0, 0 }, - { 0, IDM_CONFIG, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 } // Settings + { 5, IDM_CONFIG, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 } // Settings }; @@ -73,6 +73,31 @@ ToolBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) } +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); + + ImageList_AddIcon(hImageList, hIcon[16]); // Run + ImageList_AddIcon(hImageList, hIcon[24]); // Pause + ImageList_AddIcon(hImageList, hIcon[32]); // Ctrl+Alt+Delete + ImageList_AddIcon(hImageList, hIcon[40]); // Ctrl+Alt+Esc + ImageList_AddIcon(hImageList, hIcon[48]); // Hard reset + ImageList_AddIcon(hImageList, hIcon[56]); // ACPI shutdown + ImageList_AddIcon(hImageList, hIcon[64]); // Settings + + SendMessage(hwndToolbar, TB_SETIMAGELIST, 0, (LPARAM) hImageList); +} + + void ToolBarCreate(HWND hwndParent, HINSTANCE hInst) { @@ -90,14 +115,7 @@ ToolBarCreate(HWND hwndParent, HINSTANCE hInst) 0, 0, 0, 0, hwndParent, NULL, hInst, NULL); - // Create the image list. - hImageList = ImageList_Create(win_get_system_metrics(SM_CXSMICON, dpi), - win_get_system_metrics(SM_CYSMICON, dpi), - ILC_MASK | ILC_COLOR32, 1, 1); - - ImageList_AddIcon(hImageList, hIcon[241]); - - SendMessage(hwndToolbar, TB_SETIMAGELIST, 0, (LPARAM) hImageList); + ToolBarLoadIcons(); // Add buttons. SendMessage(hwndToolbar, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); From 88037d9bdaf1335b218c6eb07c1b0ae6bc135bb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Thu, 13 Jan 2022 00:08:06 +0100 Subject: [PATCH 11/18] Change the Pause icon if paused --- src/include/86box/win.h | 1 + src/win/win_toolbar.c | 25 +++++++++++++++++++------ src/win/win_ui.c | 3 +++ 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/include/86box/win.h b/src/include/86box/win.h index 0bbc99642..4fb6a7d00 100644 --- a/src/include/86box/win.h +++ b/src/include/86box/win.h @@ -217,6 +217,7 @@ extern int MediaMenuHandler(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPara extern HWND hwndRebar; extern void ToolBarCreate(HWND hwndParent, HINSTANCE hInst); extern void ToolBarLoadIcons(); +extern void ToolBarUpdatePause(int paused); /* Functions in win_dialog.c: */ diff --git a/src/win/win_toolbar.c b/src/win/win_toolbar.c index aa1d60cd6..b4ebab0c6 100644 --- a/src/win/win_toolbar.c +++ b/src/win/win_toolbar.c @@ -17,14 +17,14 @@ static wchar_t wTitle[512] = { 0 }; static WNDPROC pOriginalProcedure = NULL; static TBBUTTON buttons[] = { - { 0, IDM_ACTION_PAUSE, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, // Pause + { 1, IDM_ACTION_PAUSE, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, // Pause { 0, 0, TBSTATE_INDETERMINATE, BTNS_SEP, { 0 }, 0, 0 }, - { 1, IDM_ACTION_RESET_CAD, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, // Ctrl+Alt+Del - { 2, IDM_ACTION_CTRL_ALT_ESC, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, // Ctrl+Alt+Esc - { 3, IDM_ACTION_HRESET, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, // Hard reset - { 4, 0, TBSTATE_INDETERMINATE, BTNS_BUTTON, { 0 }, 0, 0 }, // ACPI shutdown + { 2, IDM_ACTION_RESET_CAD, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, // Ctrl+Alt+Del + { 3, IDM_ACTION_CTRL_ALT_ESC, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, // Ctrl+Alt+Esc + { 4, IDM_ACTION_HRESET, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, // Hard reset + { 5, 0, TBSTATE_INDETERMINATE, BTNS_BUTTON, { 0 }, 0, 0 }, // ACPI shutdown { 0, 0, TBSTATE_INDETERMINATE, BTNS_SEP, { 0 }, 0, 0 }, - { 5, IDM_CONFIG, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 } // Settings + { 6, IDM_CONFIG, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 } // Settings }; @@ -98,6 +98,19 @@ ToolBarLoadIcons() } +void +ToolBarUpdatePause(int pause) +{ + TBBUTTONINFO tbbi; + + tbbi.cbSize = sizeof(tbbi); + tbbi.dwMask = TBIF_IMAGE; + tbbi.iImage = pause ? 0 : 1; + + SendMessage(hwndToolbar, TB_SETBUTTONINFO, IDM_ACTION_PAUSE, (LPARAM) &tbbi); +} + + void ToolBarCreate(HWND hwndParent, HINSTANCE hInst) { diff --git a/src/win/win_ui.c b/src/win/win_ui.c index 0c1fbc930..099540ccb 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -1630,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); From b6d033481f62626cf7bb8861b4657f1cd8d3539e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Thu, 13 Jan 2022 00:09:45 +0100 Subject: [PATCH 12/18] Change tooltip for Pause button if paused --- src/win/win_toolbar.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/win/win_toolbar.c b/src/win/win_toolbar.c index b4ebab0c6..03b796059 100644 --- a/src/win/win_toolbar.c +++ b/src/win/win_toolbar.c @@ -43,8 +43,11 @@ ToolBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) uintptr_t idButton = lpttt->hdr.idFrom; switch (idButton) { - case IDM_ACTION_PAUSE: - lpttt->lpszText = MAKEINTRESOURCE(IDS_2155); + case IDM_ACTION_PAUSE: + if (dopause) + lpttt->lpszText = MAKEINTRESOURCE(IDS_2154); + else + lpttt->lpszText = MAKEINTRESOURCE(IDS_2155); break; case IDM_ACTION_RESET_CAD: From 6a98625e28d675f4f056bfc30febd31382db3a2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Thu, 13 Jan 2022 00:14:01 +0100 Subject: [PATCH 13/18] Fix 64-bit build due to no `GWL_WNDPROC` constant --- src/win/win_stbar.c | 6 +----- src/win/win_toolbar.c | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) 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 index 03b796059..15bc6ceea 100644 --- a/src/win/win_toolbar.c +++ b/src/win/win_toolbar.c @@ -142,7 +142,7 @@ ToolBarCreate(HWND hwndParent, HINSTANCE hInst) // Replace the original procedure with ours. pOriginalProcedure = (WNDPROC) GetWindowLongPtr(hwndToolbar, GWLP_WNDPROC); - SetWindowLongPtr(hwndToolbar, GWL_WNDPROC, (LONG_PTR)&ToolBarProcedure); + SetWindowLongPtr(hwndToolbar, GWLP_WNDPROC, (LONG_PTR)&ToolBarProcedure); // Create the containing Rebar. hwndRebar = CreateWindowEx(0, REBARCLASSNAME, NULL, From dc8c94814ec0560f69d0753090e84aed0d320373 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Thu, 13 Jan 2022 00:43:01 +0100 Subject: [PATCH 14/18] Initialize the Pause button to the correct state on start --- src/win/win_toolbar.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/win/win_toolbar.c b/src/win/win_toolbar.c index 15bc6ceea..dd484658f 100644 --- a/src/win/win_toolbar.c +++ b/src/win/win_toolbar.c @@ -144,6 +144,9 @@ ToolBarCreate(HWND hwndParent, HINSTANCE hInst) 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 | From 318875bf09fa4f54fcf140a0503c125485db4052 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Thu, 13 Jan 2022 00:47:14 +0100 Subject: [PATCH 15/18] Add proper icons --- src/win/86Box.rc | 7 +++++++ src/win/icons/acpi_shutdown.ico | Bin 0 -> 9622 bytes src/win/icons/hard_reset.ico | Bin 0 -> 9622 bytes src/win/icons/pause.ico | Bin 0 -> 9622 bytes src/win/icons/run.ico | Bin 0 -> 9622 bytes src/win/icons/send_cad.ico | Bin 0 -> 9622 bytes src/win/icons/send_cae.ico | Bin 0 -> 9622 bytes src/win/icons/settings.ico | Bin 0 -> 9622 bytes src/win/win_icon.c | 7 +++++++ src/win/win_toolbar.c | 14 +++++++------- 10 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 src/win/icons/acpi_shutdown.ico create mode 100644 src/win/icons/hard_reset.ico create mode 100644 src/win/icons/pause.ico create mode 100644 src/win/icons/run.ico create mode 100644 src/win/icons/send_cad.ico create mode 100644 src/win/icons/send_cae.ico create mode 100644 src/win/icons/settings.ico 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/icons/acpi_shutdown.ico b/src/win/icons/acpi_shutdown.ico new file mode 100644 index 0000000000000000000000000000000000000000..a2493b8031b6a7b5de4dff93d43e32c184d5336c GIT binary patch literal 9622 zcmeHNJ#HR15Tzi)Lg2zKT)30Ul)iyo%&-nYXiV zXNDZ^&!@z85d!q=k~8nU8FINRS*2W*C*{S9BKD@dds50zrIeR1_5QD?rTi&luU_f> zZ$Fgs%d=8$ZuI^SiThi8f0P)x6a*a?Q{GD4&Q`@Q>s#S-%tx_VUoaCK?_VW8>-3p$ z9LC4`{(b9DUs^wpF^}Qn)xS2)@&S&I_pz80;nHUO#p)R1sDl_jp0VDK{_WgWJm!5r z8n6DQ`)kCrZkijo(PAE~2lK}^h&5#GHJb6 z-+PmQ`5#>`_+;Jc;A66DzwZ9J_kFmo^>kJ1-DRz}7us!)`kZYZzKB6A&KWswrt=2p z725A|MjdR+b0Ts6`XCHrea`-x^P8}<2FAuZSbaFZhD#q<;`lLt-Of+Ajo5atmU{oG zrd{`o$87P&Sj{>t`0JP+Pj%Uzr4CxH8MGTFYC(-XR`ex~w^oZDv&S1pX1rQU)u?6{wKp! z>^e8Y03X-6)kaLkv-br3GkrS8cY)?Z9B;wZ;_CA?$4t5mNBuoQejRZcPpf%PdFJ86 zQS!HT7*M|8eIxIuQ~6Nu%A2X*mg|aM%JZ~yp8kjh2C(qnl27RJS~}lbKg+lDnN9fH zdQbOf!cAcgv#k^F1LpxQ#?x{SwwCj-d-G|Z7hrlEf9?79aJ1Np#pkfK#!H?xjuzXV z#}>D}SDrPFZS1+etaD2-*Kow)@uP0T^>ttB5O^$)Wq#gMIlk2w{?tZGKGT!qkFjyi z^tkPqYGool$M=HIdeAbDe@lN>XK;K^_|Ow|+8W1kxanL!u6siB(hZugG4_P*hYZKY zqOZpWgU9c4P(6mV&Ph%FJZ@Nq^+2T>Uf3 zIr_GBC$6^{#|WReuzRq{qa4V^@|o64aA@Pt=<_%Mc39}qPM+3se%8JNbL3)NM=|TK zwSJcGtq1wex|i>)Q@N6FuS@yvx>&lfy1Ll4_dyI|fdMRF0vq39H`3oq=XcmGesTHu zmTD4Mjz6BEMgIYWoXi9GFo=6$b?7?X|z8v3(< z9I&G`h(2C3bnMlTb9+vncdhk4s`IFZo?9{P3~xC{_lP^DVeCKR*cv~kq2<>#%Q)t> z_9DDg=Y|EM5_c=ri z&+l_*4pD!M&G_1}Eq>#P*n8qyuF?G#7Hi=1--0L-tYbXjvD&+O2CtP=r>oNul*c9 z`w;kmMZI-Bpd)J0IpyWL7^nKu=Ky8uN}Q;Ln!GhVi1{y?X^C7MKgL<_pHF{)@THUw wpG$f3P|Eea{KwC!l&iZ^F41r0R|xE7qtOrcZjL_*7BGPg4scC>6d~OI0KJFdkpKVy literal 0 HcmV?d00001 diff --git a/src/win/icons/hard_reset.ico b/src/win/icons/hard_reset.ico new file mode 100644 index 0000000000000000000000000000000000000000..d0494f40bb8220eaf8babada5cc3db648f6a67cd GIT binary patch literal 9622 zcmc(lF>V}35Jj7yV8U=91qzgrp+nz5ihK@7hHoJ{bLe9@a%^Qh3gH6?bYuc1cU-?` z-t6Dn?wQ%81vgNv?y6t^*L2Se2b4;=D6h(!HzoW{`RP?D-tWQDL;Nw%FWHV{w?Z02lm^jiD@v5@o?os)NLF?;99m;UTbb|%g{38JmPWur%z=V zhGPRW@yr~G3$HqA!MX>dm~(i&FylHX(*Wo7#H34HWfTAGp#l$0`h&L!BONsGwZMKT4xi>>bxw>>a0E=Ie2VKyze#=IrGmoAhfR#JtA&JkGVs8|L7;#m(?q@E&tMIFj3|;vQ2SXXyT1zTTO(&T~tD^eil+)jxaaIci%m=OWMbkLwXZj=knSBrcCOUX_Yt zuEjo37d3Tg&E7>|eugz~4aHT%Ib}YPIwx4e@l4HHOI*&!H8@_pZsgcg^(&4%r~yY^ z_T<55p1cM}UH0U2-P)SE?3e0x`h63>pYF@Y;jX-|c3Z9oSt+lZMjpIs#UU>J-ilA? z@?99ew|Wb}$Zoeg&{@-1<8Hm1h_z}J^Yd83i0Aq5&)^SyPh$&zIKr`_o^4&i4mrQfr?7S>;~h*ZnPHh!gWzZ{NhNQG1!r zPV)#=gNrqs^2CJkGuPZW0yYlC=mTErSO@ZeS8*_S#U|Xuym!i>0p2}2EneZ4xKUZt za6O-I;m#VmmZj?^Tm9kk<>R22pv&u*D;zV-8otl1 zdFtnw>9k1IbsfL=TXV-+FQ=&n+IdG!bOL-0oe5t#0&>Rb69 zFPuCOJzP&8UDaX4avv>j#U^}hp@s4L$MCgIYgxvC^Bxq_J(;oSxAKlwJyh~ahOv}T~9<(&Tv~uE9DNk%BkL;P(>_-}?<+mD{E~J{zqJSAkS6BqmZoBk&3n$;cqBWIR?muI z^lkOCUXaweW6{gr>St{x%IRLpHF=Fr_8FJgOWLRQkh#~^TeQDa52tA79=4oE@7h%> z3r^X|gY$)FOD~S4{$$})0FS)$x8{ybH2=xc`CIc-MTUph@v^)acBOoLD&_rSDc2A2 n4?p*%T-}v&DZ7n7Az)=?fRn$Q>hFU~oZ^;-wCaC~21jLZBci;e=fOs=gZqGMs zd%E2<4-i7MCF^y&-}h?9(?9MpyJKf|er~QidwFK|%*-w>%KqnjW}kfQ^0Mr|ePH(D zq1kR%_CGlH!@ZB4@l8)C<1TjP+@K{t)_3gvc;0W@t1rpwUb2d(9?#qLF;aZ|-M5tN zqxar3I=1nLIo{^)-#>ryZ#eyq^)<3T|7VX?=YMnkm22p5ZY&+Uev{I#^n9Q3+s$;p z$@i<=-updj(766acD-tinWkCC~F zc(%ObXXYt$a*B8RJ^qXHdHAg9&X=Lr&zG6|E(xs;yw^8R)9>v0x#de}d*Yqv)^lG= z4;s&(UI)l@sQ0tqa`WFkd&e!xx$p3-npHR>Z5 zjdD>RxoDJ&`p8A2T+~M{8s(xsa?vOk^^uE4xu}m^G|EMNLVA8a#0_-Xq1ck z$VH=E)JHBF<)S`v(I^-7k&8yTy^poh^ei5|t9JRToaY~{v+~$lTj9Q@yXjB%ybjxW zzw*vH>~;R*a@<%$E$NuPJ-Wm*e(S8amgcO?cV=Tv&2g?-%jNalDQh}DotmR^)J4@C zm7^}I=BONXQ8h>9sEevODo0&Z%~3h(qH2!HQ5RKnRF1l+nxk^mMb#XYqb{oEs2p`s zHAm&Bi>f&)M_p9SQ90_OYL3cL7gcjqj=HFtqjJ=INRdZC1x~Q6?a@0lD9F?Oks^+L1bx}2E&(;44uI?VC< Xv;Q?P&i7kW{7YK#-yhxF|C{|MaKmbx literal 0 HcmV?d00001 diff --git a/src/win/icons/run.ico b/src/win/icons/run.ico new file mode 100644 index 0000000000000000000000000000000000000000..90a7f28866ea609d94cf0c3c6d62b174f2d7ee21 GIT binary patch literal 9622 zcmc&)F>>255Il`M(PUD{g$s95nKD0+tGpvsCcltUC1rl#HdX4R(@Y+aC+G)xLYQ5F zXC6U71VB)NW(OpQ+ub|T04-Z&A$M|rFX*@O=}zRmh&(*F^PjIoeqikJ(Vc&NE%Nb= z$ad?_za#E1=DtM?4#D8Y(a96yBCWwVQPvKKB^*aS4`cZ$<m?`N-6_4_E|-*e8|U=9I*i5lpN%d~k7DswQ|E?yKip8>|8yn-dyqufcV*FEi)rZeti`VC` z&Fk|skCOT-PpqGb_jEd)f5#uZcdgoYtMhx;4)0oPU z8khQ7`c^kq>yVEc`l+?9t#5MEqhC{3y`<>Rp_{5tZF-zqXVvrj zSpGI=Kc?onuWxnd%Gvr?{cG#02i0ePjeJ#C`y1*0X`1FYa3prX2Eca;NBob%5r6wR m$_7{iOF)P{umM)UvIUPh#%qn6%NWLjgIwe!H#HikN$vj&jY=>8 literal 0 HcmV?d00001 diff --git a/src/win/icons/send_cad.ico b/src/win/icons/send_cad.ico new file mode 100644 index 0000000000000000000000000000000000000000..e3e64a74349af9f14f900b0cf1d5dcd7b37e024f GIT binary patch literal 9622 zcmeI1J#HLF5QUqdV8U=f1qzsvp+nz5ihK@5hHs$}U>FX43`dToj7K4S0D+E7z$C}@ zy64+{)7w3}!zJy+4b)cuRK555XL^UrlupvC^!jxQf0cfGmD2Yqr8jR%`_oq`{T_W6 z7p48n*D3w*O-ff+rTtsveTmp_BPXhXQ2N8AcaismGDeQup%6J|7}DrwSX~^C|NJ?P zZj4PhO$^11<2ElEn<6ZY_wrl0@B`Ar7=|HZJ2$y_VH}$8e8=R&>3FR*kpAoI>&+bM zJld^XHp17SwGQf&RqIb1pTxmlkRwmO^9if)4&>){>EGr|x=GDmc`BNBnR~(L_0N){ z(TnT#xAMhHQ9WX^{#JjTueP|{i19wv>32V#kK_I6INqHUyN&I+af|-ju%99(MXcM; zm*c2=Ca#-&-{`(l`8DpSCzj3rMZVY9!cA*9-+MbdVDH5xM_$jMpGE4#Oq#oxic`+^ zS#IkiM)6CSj;EZ`<|J)BaZ7l__}wIgiGSlkCBBErICCXV-c9%_#1mI9BIB(+s5#c) zv2L!ZUjH?C=vR&kx`ioQJKq`)O!TU)0uS-^`l(F}8t?^S`>B5LRS%=s?_q9Zra8z_>x)uDbR&w2g3l{o%criX{F1Y05HSSo4;w|z0 z8+iVGBP}ZG(|oj!OXIaZ=DfSV!)9$-W9n;RjUUJHF?|^C)7$YbU1qzDFQb-ed3b_)q0@I^d~dyvcj+Tb@Z`O({gJQ*lk-)3<6O&=b%Mt|T6@OV@Q@=9 zUhG1gs9j^6oQY>~E{YWvxvG<2dymuDKKvfGo`+Vc2m4$q~31|AKMQNHF}+jHRySA4ax&d2I!j+#5AH9z*i z$H-k;A7UIE4A!i)O9W#+uNq%%;^d>5lksY(A1lav_m*dFbKkJ`!j(A}n0Ut7cVeSI zv<_4L5EyRd+@Q0X^NyYtHu%y}H0!iw?zsi(iA^U&sCUy>}b&qhI*@;?Rv(ek;ed zf`3RHxbDTVWW+ATXpA`bnz^APP5&mlX(9+iFdEmG>r{mDdLNrg+Jf1 z;r(TP54#G&cVWDT4f^5oWlCtsXRP)w!&Xo?T-)U{Rpa5n3$K1}B={<_RE9K-Uu&%<68w&tH)#4$|9{25%>9rR)-lYZ z_W*GIlkv16iuW_QX8!)(SZi=x)n#zX)Atna$j?Q4Ft^<^?)Y%Zdp~v42nBwoJvw{s zI2X$r;HrI(Tk{j&e4h2ZOUyQ|XyB~ZT(lXNpXL;9Uc}3J>1l|JtPihv%?EQHuQNW) zeNH^J;1{OOTg%Yp{2uQ-URQjR)HT)SS)MYqnicx&U0 zs#yh3bM6(5DJ}rAXRQv2Z<1Q4aF@8@Pz?NQ;*F|Xm4-tMfJ0&xL;R8-^$#Ha`J;dO u+{6zO*YN{`erO1LjGqtg1E6CX!%idiEPi7+kMPT|w_$nBdVaV#8UF#0;gaA0 literal 0 HcmV?d00001 diff --git a/src/win/icons/send_cae.ico b/src/win/icons/send_cae.ico new file mode 100644 index 0000000000000000000000000000000000000000..757f38d351d3992669ae6dbdf051571b4731c873 GIT binary patch literal 9622 zcmeHNF>WL`5adD!3&t7H1qWDxfmP_xKae87Ly_TM+$cFa^fMeecDN7lBlH48p@W6! zswRumLy?@>yA@yq*FdXDc6U{?$(dd0E`(ip6W+ZGus7l7HzE8OLU{i^&Hwx=gg>x$ zeVyjNejUP3Z$r4bN%P;4_cvm{M-GNSNb4}+4tXa^%<;5d*I}k91}gJ3mQ7fF48&0a zHIK_YujP8$7%t!PGB3vz;dU?zXQ^K-4)=u*F_YtIa-5paT8XLNbG%$rWoA8p*{9-_ zt9j!Ln147N%KjG^oIpnWEP@zy9Vv4@ON4PxUgkY|A8Yo?49=Yx7jkGdhP#aGb(d;G z`YGHuRT#bX*T^TY#QLA>Z>`t-oU>N1it%e4Yu(%DUt&C7#Q4t+io<=nkMWU;x%3JC zkKf|_u9o_7A0yv0c-`3hhVLuNZ+J(YLE3j>JMc1}`}gYa*&3$L(-;SacC9`SFQAc6 zDY<#9HCd}Q)!00@j9Z>n;wd)|7jxrN?Tx+X`;qQ{RiokNT+dN3J9x@dPBXsZa{FGi z&gyfq1(S7oeizfjBCy93maNN5cLol(wx~;!8c$fVmd{#=C9P{0Sgz0B1&qmi5|*rR z%6x!FXx1ogVG@VZJf~EfdR<$4FQ@GJCppA}^u;}99bBXJn&ZknWWJPf=1&&GS?Hs% zXI_=F=AV($Xf1xt|9`~upEo*1yMy_hM*e!goU=zQRcy=0HTk`bPpBw-h|kbt*yFS6 zDn3!aq3$uhh0@Y@8y^sdvYYzwkUqEY6*~L?)#uhdzDu83(tS;Lzqzjy_=KgD@>~S= zEcNZvIFvtQBs{iUI{U=G%_5Joz#&#%E56h5tw!ckh({5wpO^KSqweKmFZm7@{1%px z6H~%`O2Nr>EY|7gdgp9~Z|`O0!%ALYWyfND1z#NO zlaw_{JeJmIx!$Q=`{~*8{h`J-JkMSAh4rylv@Okjw7Pt)RN6zxYq-m;Ynf;rmrcx|{HK1L_0j7f||k z_ov2z8Dx3ABd7#8n|z}~0+vzBv9Yk!Fk zm(bqXvgfTK@oH}~_JW(wL8)Pm`Me%@&KjS-ye4khvz!6&3!aVA{`?yGHLq<|!|C_I z@z>Z}=cNYrs`1Vo9!}=p%GHar8sIFo3`rNyu;mb!((85d_WimeYy4C05v`OtBX0Vo z!#FrCZg2*ZxEPahdzeiujh_!Iek{od52`tGJ04C^y$*uu?wKz?zPvli9U>x1IGe=E1{A!}&q8n^M}9aYuwm8hrJoX%Ljnd=h{^)D%)34=xi?gw-Au*(%+`BLp$2E+b!dMEN z-5TVRRlMO6yVi`wc<4~XPfXsomNJG4AhV36v|_pDyMGFGw$@6`A&{NoOs+Rszt z$L#-|^XJ{`iS9J^QttoO_$~V%VW}p@i2s!MHGcYerdw24TVffb_>sl`O!yGv<83_R yj|Tilo=4~*yoK(d;Tg$C)9+wScbH#hy@2JM_7bsI({D};Nvm@My-haRRmG+>60{*K!t3zRq3&Po{TekG0wLuQ!bjAdX)*6-^ga*MburLcr?FzfYGYs@ zEztA0pXXfGQ^#=iR+o7>rU|!+p?cPNt;!RlTuVxNy;Y8h`VMP!o!9DzJc)CdGgj8o zw%cuA&-nm@*vfJ2&gJW^F5?X_IDr{Pqu%rj*I}f})HB1-9*FSVgLN!my(JN4dFL*3-D(yK=VJ z`1Aa8jE7~6PYXCM_vtal9ej&?L&z5ud~BaU9PaR`ofX>rIQ- zlg57FQ2h}j z;j!iNdjer|_*W4GqMl=~*j$kIi+% zz+N2n=$wz&bc28zVv|Go#FTk1uJ@idv^Z+`;t)oa14+-xJ;rf7-{cv%pWJlv$VyC~ zH$BDY1M6w(J)>dzeR)rbZFrvB*Fb#@dkSA#8Hvq$yKBZY?t8)k*J)mR6+dl0-YM#O z>;d9%(!wt|Oe6P7$0^uJQqpgSXq3i5cRDFc&dsxRGF2B6- z{!0JytchXpoCtVLn(>S>kgo=ftge zl{)}_k7uKFKA$7M=4C82u!rZF<1evKo%b5pt8-rung3L-);`mK#a_!fT{uAld1;e( z!SxsPpovY)?6Vrq;h({*o&_~64b)$)8Qw+zJ~trNi+imjkm)(ojOa5 za$Y@4rLNFAdJl?|QQs59Uvidnr=jm#_1um39XV;@RTRI+D!DZ`4ZyL;B+S=Y{sMk! zNQgts5l6u}TBp8>hOTjb_CfrnKkxJBDmmunhI63?!+wE=7B}B|-9!(_%XK+6Gc~wh zKexqVoi(lA6PKpfosV1_)Xi`kPu@dJ-qjR0_s~42AGi2fGkP6(tzJXrzUO)_4I}Y?`=Q(P^-|u(`0yIAUohPUWXA?v>Ycnx;mdTMAh7bn*Nlh3CmH8CcQtMS3A>D1zedC_1{?hM<{=&)*Z2`(9e40;cne>^1Ln!QyKo41 zVIS@mNZnwGzJznWgx_?xVHIv)t;5~&0aM%uJ^g<17vcf)C;Zm&^a}rHT0X>Q{NLz5 DqNwaW literal 0 HcmV?d00001 diff --git a/src/win/win_icon.c b/src/win/win_icon.c index 8d3ec9590..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"}, diff --git a/src/win/win_toolbar.c b/src/win/win_toolbar.c index dd484658f..cf461e4c1 100644 --- a/src/win/win_toolbar.c +++ b/src/win/win_toolbar.c @@ -89,13 +89,13 @@ ToolBarLoadIcons() win_get_system_metrics(SM_CYSMICON, dpi), ILC_MASK | ILC_COLOR32, 1, 1); - ImageList_AddIcon(hImageList, hIcon[16]); // Run - ImageList_AddIcon(hImageList, hIcon[24]); // Pause - ImageList_AddIcon(hImageList, hIcon[32]); // Ctrl+Alt+Delete - ImageList_AddIcon(hImageList, hIcon[40]); // Ctrl+Alt+Esc - ImageList_AddIcon(hImageList, hIcon[48]); // Hard reset - ImageList_AddIcon(hImageList, hIcon[56]); // ACPI shutdown - ImageList_AddIcon(hImageList, hIcon[64]); // Settings + 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); } From 6746bbce7deb6e15a35ea0659701150191c9168b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Thu, 13 Jan 2022 00:52:48 +0100 Subject: [PATCH 16/18] Fix duplicate string ID --- src/win/languages/cs-CZ.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/win/languages/cs-CZ.rc b/src/win/languages/cs-CZ.rc index 6ad1d8788..f9b128819 100644 --- a/src/win/languages/cs-CZ.rc +++ b/src/win/languages/cs-CZ.rc @@ -539,7 +539,7 @@ BEGIN IDS_2157 "Stisknout Ctrl+Alt+Esc" IDS_2158 "Resetovat" IDS_2159 "Vypnout skrze rozhraní ACPI" - IDS_2159 "Nastavení" + IDS_2160 "Nastavení" END STRINGTABLE DISCARDABLE From 5e51e28f6e89cef9c062ea79923c906255cb069e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Thu, 13 Jan 2022 01:14:58 +0100 Subject: [PATCH 17/18] Reorder the toolbar buttons --- src/win/win_toolbar.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/src/win/win_toolbar.c b/src/win/win_toolbar.c index cf461e4c1..8ba1e4911 100644 --- a/src/win/win_toolbar.c +++ b/src/win/win_toolbar.c @@ -16,15 +16,27 @@ static HIMAGELIST hImageList = NULL; static wchar_t wTitle[512] = { 0 }; static WNDPROC pOriginalProcedure = NULL; +// Used for image list indices +// Don't shuffle the values up without updating `ToolBarLoadIcons` to follow suit! +enum image_index { + RUN, + PAUSE, + CTRL_ALT_DEL, + CTRL_ALT_ESC, + HARD_RESET, + ACPI_SHUTDOWN, + SETTINGS +}; + static TBBUTTON buttons[] = { - { 1, IDM_ACTION_PAUSE, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, // Pause - { 0, 0, TBSTATE_INDETERMINATE, BTNS_SEP, { 0 }, 0, 0 }, - { 2, IDM_ACTION_RESET_CAD, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, // Ctrl+Alt+Del - { 3, IDM_ACTION_CTRL_ALT_ESC, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, // Ctrl+Alt+Esc - { 4, IDM_ACTION_HRESET, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 }, // Hard reset - { 5, 0, TBSTATE_INDETERMINATE, BTNS_BUTTON, { 0 }, 0, 0 }, // ACPI shutdown - { 0, 0, TBSTATE_INDETERMINATE, BTNS_SEP, { 0 }, 0, 0 }, - { 6, IDM_CONFIG, TBSTATE_ENABLED, BTNS_BUTTON, { 0 }, 0, 0 } // Settings + { 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 } }; @@ -89,6 +101,9 @@ ToolBarLoadIcons() 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 on top of the source file. + ImageList_AddIcon(hImageList, hIcon[200]); // Run ImageList_AddIcon(hImageList, hIcon[201]); // Pause ImageList_AddIcon(hImageList, hIcon[202]); // Ctrl+Alt+Delete @@ -108,7 +123,7 @@ ToolBarUpdatePause(int pause) tbbi.cbSize = sizeof(tbbi); tbbi.dwMask = TBIF_IMAGE; - tbbi.iImage = pause ? 0 : 1; + tbbi.iImage = pause ? RUN : PAUSE; SendMessage(hwndToolbar, TB_SETBUTTONINFO, IDM_ACTION_PAUSE, (LPARAM) &tbbi); } From 691aa95cd111260b65ce044304ee672e01107acc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Thu, 13 Jan 2022 01:17:27 +0100 Subject: [PATCH 18/18] Slight function reordering --- src/win/win_toolbar.c | 80 +++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/src/win/win_toolbar.c b/src/win/win_toolbar.c index 8ba1e4911..71e9a02c3 100644 --- a/src/win/win_toolbar.c +++ b/src/win/win_toolbar.c @@ -16,8 +16,7 @@ static HIMAGELIST hImageList = NULL; static wchar_t wTitle[512] = { 0 }; static WNDPROC pOriginalProcedure = NULL; -// Used for image list indices -// Don't shuffle the values up without updating `ToolBarLoadIcons` to follow suit! + enum image_index { RUN, PAUSE, @@ -28,16 +27,33 @@ enum image_index { SETTINGS }; -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 +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 @@ -88,34 +104,6 @@ ToolBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) } -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 on top of the source file. - - 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); -} - - void ToolBarUpdatePause(int pause) { @@ -129,6 +117,18 @@ ToolBarUpdatePause(int pause) } +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) {