The Settings dialog now correctly enables/disables the mouse Configure button depending on whether or not the selected mouse has configuration.

This commit is contained in:
OBattler
2018-01-26 13:35:50 +01:00
parent 376eb952f2
commit 65438d5271
3 changed files with 42 additions and 9 deletions

View File

@@ -11,13 +11,13 @@
* TODO: Add the Genius bus- and serial mouse. * TODO: Add the Genius bus- and serial mouse.
* Remove the '3-button' flag from mouse types. * Remove the '3-button' flag from mouse types.
* *
* Version: @(#)mouse.c 1.0.18 2017/12/14 * Version: @(#)mouse.c 1.0.19 2018/01/26
* *
* Authors: Miran Grca, <mgrca8@gmail.com> * Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com> * Fred N. van Kempen, <decwiz@yahoo.com>
* *
* Copyright 2016,2017 Miran Grca. * Copyright 2016-2018 Miran Grca.
* Copyright 2017 Fred N. van Kempen. * Copyright 2017,2018 Fred N. van Kempen.
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
@@ -198,6 +198,15 @@ mouse_get_from_internal_name(char *s)
} }
int
mouse_has_config(int mouse)
{
if (mouse_devices[mouse].device == NULL) return(0);
return(mouse_devices[mouse].device->config ? 1 : 0);
}
device_t * device_t *
mouse_get_device(int mouse) mouse_get_device(int mouse)
{ {

View File

@@ -8,13 +8,13 @@
* *
* Definitions for the mouse driver. * Definitions for the mouse driver.
* *
* Version: @(#)mouse.h 1.0.11 2017/12/09 * Version: @(#)mouse.h 1.0.12 2018/01/26
* *
* Authors: Miran Grca, <mgrca8@gmail.com> * Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com> * Fred N. van Kempen, <decwiz@yahoo.com>
* *
* Copyright 2016,2017 Miran Grca. * Copyright 2016-2018 Miran Grca.
* Copyright 2017 Fred N. van Kempen. * Copyright 2017,2018 Fred N. van Kempen.
*/ */
#ifndef EMU_MOUSE_H #ifndef EMU_MOUSE_H
# define EMU_MOUSE_H # define EMU_MOUSE_H
@@ -69,6 +69,7 @@ extern void mouse_poll(void);
extern char *mouse_get_name(int mouse); extern char *mouse_get_name(int mouse);
extern char *mouse_get_internal_name(int mouse); extern char *mouse_get_internal_name(int mouse);
extern int mouse_get_from_internal_name(char *s); extern int mouse_get_from_internal_name(char *s);
extern int mouse_has_config(int mouse);
extern int mouse_get_type(int mouse); extern int mouse_get_type(int mouse);
extern int mouse_get_ndev(void); extern int mouse_get_ndev(void);
extern int mouse_get_buttons(void); extern int mouse_get_buttons(void);

View File

@@ -8,7 +8,7 @@
* *
* Windows 86Box Settings dialog handler. * Windows 86Box Settings dialog handler.
* *
* Version: @(#)win_settings.c 1.0.33 2018/01/24 * Version: @(#)win_settings.c 1.0.34 2018/01/26
* *
* Author: Miran Grca, <mgrca8@gmail.com> * Author: Miran Grca, <mgrca8@gmail.com>
* *
@@ -859,7 +859,7 @@ win_settings_video_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
gfx = video_card_getid(stransi); gfx = video_card_getid(stransi);
h = GetDlgItem(hdlg, IDC_CONFIGURE_VID); h = GetDlgItem(hdlg, IDC_CONFIGURE_VID);
if (video_card_has_config(gfx)) if (video_card_has_config(temp_gfxcard))
{ {
EnableWindow(h, TRUE); EnableWindow(h, TRUE);
} }
@@ -996,8 +996,16 @@ win_settings_input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
} }
SendMessage(h, CB_SETCURSEL, settings_mouse_to_list[temp_mouse], 0); SendMessage(h, CB_SETCURSEL, settings_mouse_to_list[temp_mouse], 0);
h = GetDlgItem(hdlg, IDC_CONFIGURE_MOUSE); h = GetDlgItem(hdlg, IDC_CONFIGURE_MOUSE);
if (mouse_has_config(temp_mouse))
{
EnableWindow(h, TRUE); EnableWindow(h, TRUE);
}
else
{
EnableWindow(h, FALSE);
}
h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK); h = GetDlgItem(hdlg, IDC_COMBO_JOYSTICK);
c = 0; c = 0;
@@ -1023,6 +1031,21 @@ win_settings_input_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
case WM_COMMAND: case WM_COMMAND:
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
case IDC_COMBO_MOUSE:
h = GetDlgItem(hdlg, IDC_COMBO_MOUSE);
temp_mouse = settings_list_to_mouse[SendMessage(h, CB_GETCURSEL, 0, 0)];
h = GetDlgItem(hdlg, IDC_CONFIGURE_MOUSE);
if (mouse_has_config(temp_mouse))
{
EnableWindow(h, TRUE);
}
else
{
EnableWindow(h, FALSE);
}
break;
case IDC_CONFIGURE_MOUSE: case IDC_CONFIGURE_MOUSE:
h = GetDlgItem(hdlg, IDC_COMBO_MOUSE); h = GetDlgItem(hdlg, IDC_COMBO_MOUSE);
temp_mouse = settings_list_to_mouse[SendMessage(h, CB_GETCURSEL, 0, 0)]; temp_mouse = settings_list_to_mouse[SendMessage(h, CB_GETCURSEL, 0, 0)];