Moved settings category #define's to win.h and added the win_settings_open_ex() function to open the Settings dialog with a specific category page displayed.

This commit is contained in:
OBattler
2019-02-11 01:54:00 +01:00
parent 1a4d1f32f8
commit a3fb51acd8
2 changed files with 30 additions and 17 deletions

View File

@@ -8,7 +8,7 @@
*
* Platform support defintions for Win32.
*
* Version: @(#)win.h 1.0.24 2018/10/23
* Version: @(#)win.h 1.0.25 2019/02/11
*
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com>
@@ -126,8 +126,6 @@ extern uint8_t joystickconfig_open(HWND hwnd, int joy_nr, int type);
extern int getfile(HWND hwnd, char *f, char *fn);
extern int getsfile(HWND hwnd, char *f, char *fn);
extern void win_settings_open(HWND hwnd);
extern void hard_disk_add_open(HWND hwnd, int is_existing);
extern int hard_disk_was_added(void);
@@ -149,6 +147,22 @@ extern void SoundGainDialogCreate(HWND hwnd);
extern void NewFloppyDialogCreate(HWND hwnd, int id, int part);
/* Functions in win_settings.c: */
#define SETTINGS_PAGE_MACHINE 0
#define SETTINGS_PAGE_VIDEO 1
#define SETTINGS_PAGE_INPUT 2
#define SETTINGS_PAGE_SOUND 3
#define SETTINGS_PAGE_NETWORK 4
#define SETTINGS_PAGE_PORTS 5
#define SETTINGS_PAGE_PERIPHERALS 6
#define SETTINGS_PAGE_HARD_DISKS 7
#define SETTINGS_PAGE_FLOPPY_DRIVES 8
#define SETTINGS_PAGE_OTHER_REMOVABLE_DEVICES 9
extern void win_settings_open(HWND hwnd);
extern void win_settings_open_ex(HWND hwnd, int category);
/* Functions in win_stbar.c: */
extern HWND hwndSBAR;
extern void StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst);

View File

@@ -8,7 +8,7 @@
*
* Windows 86Box Settings dialog handler.
*
* Version: @(#)win_settings.c 1.0.74 2018/11/04
* Version: @(#)win_settings.c 1.0.54 2019/02/11
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* David Hrdlička, <hrdlickadavid@outlook.com>
@@ -64,21 +64,12 @@
#include "win.h"
#define SETTINGS_PAGE_MACHINE 0
#define SETTINGS_PAGE_VIDEO 1
#define SETTINGS_PAGE_INPUT 2
#define SETTINGS_PAGE_SOUND 3
#define SETTINGS_PAGE_NETWORK 4
#define SETTINGS_PAGE_PORTS 5
#define SETTINGS_PAGE_PERIPHERALS 6
#define SETTINGS_PAGE_HARD_DISKS 7
#define SETTINGS_PAGE_FLOPPY_DRIVES 8
#define SETTINGS_PAGE_OTHER_REMOVABLE_DEVICES 9
/* Icon, Bus, File, C, H, S, Size */
#define C_COLUMNS_HARD_DISKS 6
static int first_cat = 0;
/* Machine category */
static int temp_machine, temp_cpu_m, temp_cpu, temp_wait_states, temp_fpu, temp_sync;
static uint32_t temp_mem_size;
@@ -4553,7 +4544,7 @@ win_settings_main_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
h = GetDlgItem(hdlg, IDC_SETTINGSCATLIST);
image_list_init(h, (const uint8_t *) cat_icons);
win_settings_main_insert_categories(h);
ListView_SetItemState(h, 0, LVIS_FOCUSED | LVIS_SELECTED, 0x000F);
ListView_SetItemState(h, first_cat, LVIS_FOCUSED | LVIS_SELECTED, 0x000F);
return TRUE;
case WM_NOTIFY:
if ((((LPNMHDR)lParam)->code == LVN_ITEMCHANGED) && (((LPNMHDR)lParam)->idFrom == IDC_SETTINGSCATLIST)) {
@@ -4591,12 +4582,20 @@ win_settings_main_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
void
win_settings_open(HWND hwnd)
win_settings_open_ex(HWND hwnd, int category)
{
plat_pause(1);
if (source_hwnd)
PostMessage((HWND) (uintptr_t) source_hwnd, WM_SENDSSTATUS, (WPARAM) 1, (LPARAM) hwndMain);
first_cat = category;
DialogBox(hinstance, (LPCWSTR)DLG_CONFIG, hwnd, win_settings_main_proc);
}
void
win_settings_open(HWND hwnd)
{
win_settings_open_ex(hwnd, SETTINGS_PAGE_MACHINE);
}