Moved the Sound Gain control option from the Tools menu to a new Sound icon on the status bar;

LPT2 and LPT3 devices can now be selected.
This commit is contained in:
OBattler
2018-02-06 19:53:34 +01:00
parent 086a786f12
commit 437b519d94
10 changed files with 202 additions and 149 deletions

View File

@@ -8,7 +8,7 @@
* *
* Configuration file handler. * Configuration file handler.
* *
* Version: @(#)config.c 1.0.39 2018/01/27 * Version: @(#)config.c 1.0.40 2018/02/06
* *
* Authors: Sarah Walker, * Authors: Sarah Walker,
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -686,9 +686,21 @@ load_ports(void)
p = (char *)config_get_string(cat, "lpt1_device", NULL); p = (char *)config_get_string(cat, "lpt1_device", NULL);
if (p != NULL) if (p != NULL)
strcpy(lpt1_device_name, p); strcpy(lpt_device_names[0], p);
else else
strcpy(lpt1_device_name, "none"); strcpy(lpt_device_names[0], "none");
p = (char *)config_get_string(cat, "lpt2_device", NULL);
if (p != NULL)
strcpy(lpt_device_names[1], p);
else
strcpy(lpt_device_names[1], "none");
p = (char *)config_get_string(cat, "lpt3_device", NULL);
if (p != NULL)
strcpy(lpt_device_names[2], p);
else
strcpy(lpt_device_names[2], "none");
} }
@@ -1779,10 +1791,20 @@ save_ports(void)
else else
config_set_int(cat, "lpt_enabled", lpt_enabled); config_set_int(cat, "lpt_enabled", lpt_enabled);
if (!strcmp(lpt1_device_name, "none")) if (!strcmp(lpt_device_names[0], "none"))
config_delete_var(cat, "lpt1_device"); config_delete_var(cat, "lpt1_device");
else else
config_set_string(cat, "lpt1_device", lpt1_device_name); config_set_string(cat, "lpt1_device", lpt_device_names[0]);
if (!strcmp(lpt_device_names[1], "none"))
config_delete_var(cat, "lpt2_device");
else
config_set_string(cat, "lpt2_device", lpt_device_names[1]);
if (!strcmp(lpt_device_names[2], "none"))
config_delete_var(cat, "lpt3_device");
else
config_set_string(cat, "lpt3_device", lpt_device_names[2]);
delete_section_if_empty(cat); delete_section_if_empty(cat);
} }

140
src/lpt.c
View File

@@ -12,7 +12,7 @@
#include "sound/snd_lpt_dss.h" #include "sound/snd_lpt_dss.h"
char lpt1_device_name[16]; char lpt_device_names[3][16];
static struct static struct
@@ -42,118 +42,102 @@ char *lpt_device_get_internal_name(int id)
return lpt_devices[id].internal_name; return lpt_devices[id].internal_name;
} }
static lpt_device_t *lpt1_device; static lpt_device_t *lpt_device_ts[3];
static void *lpt1_device_p; static void *lpt_device_ps[3];
void lpt1_device_init() void lpt_devices_init()
{ {
int i = 0;
int c = 0; int c = 0;
while (strcmp(lpt_devices[c].internal_name, lpt1_device_name) && strlen(lpt_devices[c].internal_name) != 0) for (i = 0; i < 3; i++) {
while (strcmp(lpt_devices[c].internal_name, lpt_device_names[i]) && strlen(lpt_devices[c].internal_name) != 0)
c++; c++;
if (strlen(lpt_devices[c].internal_name) == 0) if (strlen(lpt_devices[c].internal_name) == 0)
lpt1_device = NULL; lpt_device_ts[i] = NULL;
else else
{ {
lpt1_device = lpt_devices[c].device; lpt_device_ts[i] = lpt_devices[c].device;
if (lpt1_device) if (lpt_device_ts[i])
lpt1_device_p = lpt1_device->init(); lpt_device_ps[i] = lpt_device_ts[i]->init();
}
} }
} }
void lpt1_device_close() void lpt_devices_close()
{ {
if (lpt1_device) int i = 0;
lpt1_device->close(lpt1_device_p);
lpt1_device = NULL; for (i = 0; i < 3; i++) {
if (lpt_device_ts[i])
lpt_device_ts[i]->close(lpt_device_ps[i]);
lpt_device_ts[i] = NULL;
}
} }
static uint8_t lpt1_dat, lpt2_dat, lpt3_dat; static uint8_t lpt_dats[3], lpt_ctrls[3];
static uint8_t lpt1_ctrl, lpt2_ctrl, lpt3_ctrl;
void lpt_write(int i, uint16_t port, uint8_t val, void *priv)
{
switch (port & 3)
{
case 0:
if (lpt_device_ts[i])
lpt_device_ts[i]->write_data(val, lpt_device_ps[i]);
lpt_dats[i] = val;
break;
case 2:
if (lpt_device_ts[i])
lpt_device_ts[i]->write_ctrl(val, lpt_device_ps[i]);
lpt_ctrls[i] = val;
break;
}
}
uint8_t lpt_read(int i, uint16_t port, void *priv)
{
switch (port & 3)
{
case 0:
return lpt_dats[i];
case 1:
if (lpt_device_ts[i])
return lpt_device_ts[i]->read_status(lpt_device_ps[i]);
return 0;
case 2:
return lpt_ctrls[i];
}
return 0xff;
}
void lpt1_write(uint16_t port, uint8_t val, void *priv) void lpt1_write(uint16_t port, uint8_t val, void *priv)
{ {
switch (port & 3) lpt_write(0, port, val, priv);
{
case 0:
if (lpt1_device)
lpt1_device->write_data(val, lpt1_device_p);
lpt1_dat = val;
break;
case 2:
if (lpt1_device)
lpt1_device->write_ctrl(val, lpt1_device_p);
lpt1_ctrl = val;
break;
}
} }
uint8_t lpt1_read(uint16_t port, void *priv) uint8_t lpt1_read(uint16_t port, void *priv)
{ {
switch (port & 3) return lpt_read(0, port, priv);
{
case 0:
return lpt1_dat;
case 1:
if (lpt1_device)
return lpt1_device->read_status(lpt1_device_p);
return 0;
case 2:
return lpt1_ctrl;
}
return 0xff;
} }
void lpt2_write(uint16_t port, uint8_t val, void *priv) void lpt2_write(uint16_t port, uint8_t val, void *priv)
{ {
switch (port & 3) lpt_write(1, port, val, priv);
{
case 0:
lpt2_dat = val;
break;
case 2:
lpt2_ctrl = val;
break;
}
} }
uint8_t lpt2_read(uint16_t port, void *priv) uint8_t lpt2_read(uint16_t port, void *priv)
{ {
switch (port & 3) return lpt_read(1, port, priv);
{
case 0:
return lpt2_dat;
case 1:
return 0;
case 2:
return lpt2_ctrl;
}
return 0xff;
} }
void lpt3_write(uint16_t port, uint8_t val, void *priv) void lpt3_write(uint16_t port, uint8_t val, void *priv)
{ {
switch (port & 3) lpt_write(2, port, val, priv);
{
case 0:
lpt3_dat = val;
break;
case 2:
lpt3_ctrl = val;
break;
}
} }
uint8_t lpt3_read(uint16_t port, void *priv) uint8_t lpt3_read(uint16_t port, void *priv)
{ {
switch (port & 3) return lpt_read(2, port, priv);
{
case 0:
return lpt3_dat;
case 1:
return 0;
case 2:
return lpt3_ctrl;
}
return 0xff;
} }
uint16_t lpt_addr[3] = { 0x378, 0x278, 0x3bc }; uint16_t lpt_addr[3] = { 0x378, 0x278, 0x3bc };

View File

@@ -7,13 +7,13 @@ extern void lpt2_remove_ams();
extern void lpt3_init(uint16_t port); extern void lpt3_init(uint16_t port);
extern void lpt3_remove(); extern void lpt3_remove();
void lpt1_device_init(); void lpt_devices_init();
void lpt1_device_close(); void lpt_devices_close();
char *lpt_device_get_name(int id); char *lpt_device_get_name(int id);
char *lpt_device_get_internal_name(int id); char *lpt_device_get_internal_name(int id);
extern char lpt1_device_name[16]; extern char lpt_device_names[3][16];
typedef struct typedef struct
{ {

View File

@@ -8,7 +8,7 @@
* *
* Main emulator module where most things are controlled. * Main emulator module where most things are controlled.
* *
* Version: @(#)pc.c 1.0.56 2018/01/29 * Version: @(#)pc.c 1.0.57 2018/02/06
* *
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/> * Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -751,6 +751,8 @@ pc_reset_hard_close(void)
mouse_close(); mouse_close();
lpt_devices_close();
device_close_all(); device_close_all();
midi_close(); midi_close();
@@ -810,7 +812,7 @@ pc_reset_hard_init(void)
/* Reset some basic devices. */ /* Reset some basic devices. */
speaker_init(); speaker_init();
serial_reset(); serial_reset();
lpt1_device_init(); lpt_devices_init();
/* Reset keyboard and/or mouse. */ /* Reset keyboard and/or mouse. */
// FIXME: do we really have to reset the *AT* keyboard?? --FvK // FIXME: do we really have to reset the *AT* keyboard?? --FvK
@@ -944,6 +946,8 @@ pc_close(thread_t *ptr)
plat_mouse_capture(0); plat_mouse_capture(0);
lpt_devices_close();
for (i=0; i<ZIP_NUM; i++) for (i=0; i<ZIP_NUM; i++)
zip_close(i); zip_close(i);
@@ -959,8 +963,6 @@ pc_close(thread_t *ptr)
video_close(); video_close();
lpt1_device_close();
device_close_all(); device_close_all();
midi_close(); midi_close();

View File

@@ -8,7 +8,7 @@
* *
* Define the various UI functions. * Define the various UI functions.
* *
* Version: @(#)ui.h 1.0.12 2018/01/22 * Version: @(#)ui.h 1.0.13 2018/02/06
* *
* 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>
@@ -48,7 +48,8 @@ extern void ui_check_menu_item(int id, int checked);
#define SB_RDISK 0x30 #define SB_RDISK 0x30
#define SB_HDD 0x50 #define SB_HDD 0x50
#define SB_NETWORK 0x60 #define SB_NETWORK 0x60
#define SB_TEXT 0x70 #define SB_SOUND 0x70
#define SB_TEXT 0x80
extern wchar_t *ui_window_title(wchar_t *s); extern wchar_t *ui_window_title(wchar_t *s);
extern void ui_status_update(void); extern void ui_status_update(void);

View File

@@ -8,7 +8,7 @@
* *
* Application resource script for Windows. * Application resource script for Windows.
* *
* Version: @(#)86Box.rc 1.0.27 2018/01/27 * Version: @(#)86Box.rc 1.0.28 2018/02/06
* *
* 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>
@@ -119,8 +119,6 @@ BEGIN
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "S&tatus", IDM_STATUS MENUITEM "S&tatus", IDM_STATUS
MENUITEM "Take s&creenshot\tCtrl+F11", IDM_ACTION_SCREENSHOT MENUITEM "Take s&creenshot\tCtrl+F11", IDM_ACTION_SCREENSHOT
MENUITEM SEPARATOR
MENUITEM "S&ound gain...", IDM_SND_GAIN
END END
#if defined(ENABLE_LOG_TOGGLES) || defined(ENABLE_LOG_COMMANDS) #if defined(ENABLE_LOG_TOGGLES) || defined(ENABLE_LOG_COMMANDS)
POPUP "&Logging" POPUP "&Logging"
@@ -415,7 +413,7 @@ BEGIN
PUSHBUTTON "Configure",IDC_CONFIGURE_NET,214,43,46,12 PUSHBUTTON "Configure",IDC_CONFIGURE_NET,214,43,46,12
END END
DLG_CFG_PORTS DIALOG DISCARDABLE 97, 0, 267, 61 DLG_CFG_PORTS DIALOG DISCARDABLE 97, 0, 267, 99
STYLE DS_CONTROL | WS_CHILD STYLE DS_CONTROL | WS_CHILD
FONT 9, "Segoe UI" FONT 9, "Segoe UI"
BEGIN BEGIN
@@ -423,13 +421,21 @@ BEGIN
COMBOBOX IDC_COMBO_LPT1,71,7,189,120,CBS_DROPDOWNLIST | COMBOBOX IDC_COMBO_LPT1,71,7,189,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP WS_VSCROLL | WS_TABSTOP
LTEXT "LPT2 Device:",IDT_1717,7,27,61,10
COMBOBOX IDC_COMBO_LPT2,71,26,189,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "LPT3 Device:",IDT_1718,7,46,61,10
COMBOBOX IDC_COMBO_LPT3,71,45,189,120,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
CONTROL "Serial port 1",IDC_CHECK_SERIAL1,"Button", CONTROL "Serial port 1",IDC_CHECK_SERIAL1,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,26,94,10 BS_AUTOCHECKBOX | WS_TABSTOP,7,64,94,10
CONTROL "Serial port 2",IDC_CHECK_SERIAL2,"Button", CONTROL "Serial port 2",IDC_CHECK_SERIAL2,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,147,26,94,10 BS_AUTOCHECKBOX | WS_TABSTOP,147,64,94,10
CONTROL "Parallel port",IDC_CHECK_PARALLEL,"Button", CONTROL "Parallel port",IDC_CHECK_PARALLEL,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,44,94,10 BS_AUTOCHECKBOX | WS_TABSTOP,7,82,94,10
END END
DLG_CFG_PERIPHERALS DIALOG DISCARDABLE 97, 0, 267, 97 DLG_CFG_PERIPHERALS DIALOG DISCARDABLE 97, 0, 267, 97

View File

@@ -8,7 +8,7 @@
* *
* Windows resource defines. * Windows resource defines.
* *
* Version: @(#)resource.h 1.0.19 2018/01/26 * Version: @(#)resource.h 1.0.19 2018/02/06
* *
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/> * Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -148,9 +148,11 @@
#define IDC_COMBO_NET 1092 #define IDC_COMBO_NET 1092
#define IDC_COMBO_LPT1 1110 /* ports config */ #define IDC_COMBO_LPT1 1110 /* ports config */
#define IDC_CHECK_SERIAL1 1111 #define IDC_COMBO_LPT2 1111
#define IDC_CHECK_SERIAL2 1112 #define IDC_COMBO_LPT3 1112
#define IDC_CHECK_PARALLEL 1113 #define IDC_CHECK_SERIAL1 1113
#define IDC_CHECK_SERIAL2 1114
#define IDC_CHECK_PARALLEL 1115
#define IDC_OTHER_PERIPH 1120 /* other periph config */ #define IDC_OTHER_PERIPH 1120 /* other periph config */
#define IDC_COMBO_SCSI 1121 #define IDC_COMBO_SCSI 1121
@@ -237,7 +239,6 @@
#define IDM_CONFIG_LOAD 40021 #define IDM_CONFIG_LOAD 40021
#define IDM_CONFIG_SAVE 40022 #define IDM_CONFIG_SAVE 40022
#define IDM_STATUS 40030 #define IDM_STATUS 40030
#define IDM_SND_GAIN 40040
#define IDM_VID_RESIZE 40050 #define IDM_VID_RESIZE 40050
#define IDM_VID_REMEMBER 40051 #define IDM_VID_REMEMBER 40051
#define IDM_VID_DDRAW 40060 #define IDM_VID_DDRAW 40060

View File

@@ -8,7 +8,7 @@
* *
* Windows 86Box Settings dialog handler. * Windows 86Box Settings dialog handler.
* *
* Version: @(#)win_settings.c 1.0.36 2018/01/27 * Version: @(#)win_settings.c 1.0.37 2018/02/06
* *
* Author: Miran Grca, <mgrca8@gmail.com> * Author: Miran Grca, <mgrca8@gmail.com>
* *
@@ -77,7 +77,7 @@ static int temp_net_type, temp_net_card;
static char temp_pcap_dev[520]; static char temp_pcap_dev[520];
/* Ports category */ /* Ports category */
static char temp_lpt1_device_name[16]; static char temp_lpt_device_names[3][16];
static int temp_serial[2], temp_lpt; static int temp_serial[2], temp_lpt;
/* Other peripherals category */ /* Other peripherals category */
@@ -177,7 +177,8 @@ static void win_settings_init(void)
temp_net_card = network_card; temp_net_card = network_card;
/* Ports category */ /* Ports category */
strncpy(temp_lpt1_device_name, lpt1_device_name, sizeof(temp_lpt1_device_name) - 1); for (i = 0; i < 3; i++)
strncpy(temp_lpt_device_names[i], lpt_device_names[i], sizeof(temp_lpt_device_names[i]) - 1);
temp_serial[0] = serial_enabled[0]; temp_serial[0] = serial_enabled[0];
temp_serial[1] = serial_enabled[1]; temp_serial[1] = serial_enabled[1];
temp_lpt = lpt_enabled; temp_lpt = lpt_enabled;
@@ -292,7 +293,8 @@ static int win_settings_changed(void)
i = i || (network_card != temp_net_card); i = i || (network_card != temp_net_card);
/* Ports category */ /* Ports category */
i = i || strncmp(temp_lpt1_device_name, lpt1_device_name, sizeof(temp_lpt1_device_name) - 1); for (i = 0; i < 3; i++)
i = i || strncmp(temp_lpt_device_names[i], lpt_device_names[i], sizeof(temp_lpt_device_names[i]) - 1);
i = i || (temp_serial[0] != serial_enabled[0]); i = i || (temp_serial[0] != serial_enabled[0]);
i = i || (temp_serial[1] != serial_enabled[1]); i = i || (temp_serial[1] != serial_enabled[1]);
i = i || (temp_lpt != lpt_enabled); i = i || (temp_lpt != lpt_enabled);
@@ -395,7 +397,8 @@ static void win_settings_save(void)
network_card = temp_net_card; network_card = temp_net_card;
/* Ports category */ /* Ports category */
strncpy(lpt1_device_name, temp_lpt1_device_name, sizeof(temp_lpt1_device_name) - 1); for (i = 0; i < 3; i++)
strncpy(lpt_device_names[i], temp_lpt_device_names[i], sizeof(temp_lpt_device_names[i]) - 1);
serial_enabled[0] = temp_serial[0]; serial_enabled[0] = temp_serial[0];
serial_enabled[1] = temp_serial[1]; serial_enabled[1] = temp_serial[1];
lpt_enabled = temp_lpt; lpt_enabled = temp_lpt;
@@ -1427,41 +1430,36 @@ win_settings_ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
int d = 0; int d = 0;
char *s; char *s;
LPTSTR lptsTemp; LPTSTR lptsTemp;
int i;
switch (message) switch (message)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
lptsTemp = (LPTSTR) malloc(512); lptsTemp = (LPTSTR) malloc(512);
h = GetDlgItem(hdlg, IDC_COMBO_LPT1); for (i = 0; i < 3; i++) {
h = GetDlgItem(hdlg, IDC_COMBO_LPT1 + i);
c = d = 0; c = d = 0;
while (1) while (1) {
{
s = lpt_device_get_name(c); s = lpt_device_get_name(c);
if (!s) if (!s)
{
break; break;
}
if (c == 0) if (c == 0) {
{
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) plat_get_string(IDS_2152)); SendMessage(h, CB_ADDSTRING, 0, (LPARAM) plat_get_string(IDS_2152));
} } else {
else
{
mbstowcs(lptsTemp, s, strlen(s) + 1); mbstowcs(lptsTemp, s, strlen(s) + 1);
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp); SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp);
} }
if (!strcmp(temp_lpt1_device_name, lpt_device_get_internal_name(c))) if (!strcmp(temp_lpt_device_names[i], lpt_device_get_internal_name(c)))
{
d = c; d = c;
}
c++; c++;
} }
SendMessage(h, CB_SETCURSEL, d, 0); SendMessage(h, CB_SETCURSEL, d, 0);
}
h=GetDlgItem(hdlg, IDC_CHECK_SERIAL1); h=GetDlgItem(hdlg, IDC_CHECK_SERIAL1);
SendMessage(h, BM_SETCHECK, temp_serial[0], 0); SendMessage(h, BM_SETCHECK, temp_serial[0], 0);
@@ -1477,9 +1475,11 @@ win_settings_ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
return TRUE; return TRUE;
case WM_SAVESETTINGS: case WM_SAVESETTINGS:
h = GetDlgItem(hdlg, IDC_COMBO_LPT1); for (i = 0; i < 3; i++) {
h = GetDlgItem(hdlg, IDC_COMBO_LPT1 + i);
c = SendMessage(h, CB_GETCURSEL, 0, 0); c = SendMessage(h, CB_GETCURSEL, 0, 0);
strcpy(temp_lpt1_device_name, lpt_device_get_internal_name(c)); strcpy(temp_lpt_device_names[i], lpt_device_get_internal_name(c));
}
h = GetDlgItem(hdlg, IDC_CHECK_SERIAL1); h = GetDlgItem(hdlg, IDC_CHECK_SERIAL1);
temp_serial[0] = SendMessage(h, BM_GETCHECK, 0, 0); temp_serial[0] = SendMessage(h, BM_GETCHECK, 0, 0);

View File

@@ -8,7 +8,7 @@
* *
* Implement the application's Status Bar. * Implement the application's Status Bar.
* *
* Version: @(#)win_stbar.c 1.0.12 2018/01/29 * Version: @(#)win_stbar.c 1.0.13 2018/02/06
* *
* 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>
@@ -465,6 +465,20 @@ StatusBarCreateNetworkTip(int part)
} }
static void
StatusBarCreateSoundTip(int part)
{
WCHAR tempTip[512];
_swprintf(tempTip, plat_get_string(IDS_2068));
if (sbTips[part] != NULL)
free(sbTips[part]);
sbTips[part] = (WCHAR *)malloc((wcslen(tempTip) << 1) + 2);
wcscpy(sbTips[part], tempTip);
}
/* API */ /* API */
void void
ui_sb_update_tip(int meaning) ui_sb_update_tip(int meaning)
@@ -506,6 +520,10 @@ ui_sb_update_tip(int meaning)
StatusBarCreateNetworkTip(part); StatusBarCreateNetworkTip(part);
break; break;
case SB_SOUND:
StatusBarCreateSoundTip(part);
break;
default: default:
break; break;
} }
@@ -692,7 +710,7 @@ ui_sb_update_panes(void)
if (do_net) { if (do_net) {
sb_parts++; sb_parts++;
} }
sb_parts++; sb_parts += 2;
iStatusWidths = (int *)malloc(sb_parts * sizeof(int)); iStatusWidths = (int *)malloc(sb_parts * sizeof(int));
memset(iStatusWidths, 0, sb_parts * sizeof(int)); memset(iStatusWidths, 0, sb_parts * sizeof(int));
@@ -809,11 +827,16 @@ ui_sb_update_panes(void)
sb_parts++; sb_parts++;
} }
edge += SB_ICON_WIDTH;
iStatusWidths[sb_parts] = edge;
sb_part_meanings[sb_parts] = SB_SOUND;
sb_parts++;
if (sb_parts) if (sb_parts)
iStatusWidths[sb_parts - 1] += (24 - SB_ICON_WIDTH); iStatusWidths[sb_parts - 1] += (24 - SB_ICON_WIDTH);
iStatusWidths[sb_parts] = -1; iStatusWidths[sb_parts] = -1;
sb_part_meanings[sb_parts] = SB_TEXT; sb_part_meanings[sb_parts] = SB_TEXT;
sb_parts++; sb_parts ++;
SendMessage(hwndSBAR, SB_SETPARTS, (WPARAM)sb_parts, (LPARAM)iStatusWidths); SendMessage(hwndSBAR, SB_SETPARTS, (WPARAM)sb_parts, (LPARAM)iStatusWidths);
@@ -874,6 +897,11 @@ ui_sb_update_panes(void)
StatusBarCreateNetworkTip(i); StatusBarCreateNetworkTip(i);
break; break;
case SB_SOUND: /* Sound */
sb_part_icons[i] = 259;
StatusBarCreateSoundTip(i);
break;
case SB_TEXT: /* Status text */ case SB_TEXT: /* Status text */
SendMessage(hwndSBAR, SB_SETTEXT, i | SBT_NOBORDERS, (LPARAM)L""); SendMessage(hwndSBAR, SB_SETTEXT, i | SBT_NOBORDERS, (LPARAM)L"");
sb_part_icons[i] = -1; sb_part_icons[i] = -1;
@@ -1189,6 +1217,17 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
StatusBarPopupMenu(hwnd, pt, (pt.x / SB_ICON_WIDTH)); StatusBarPopupMenu(hwnd, pt, (pt.x / SB_ICON_WIDTH));
break; break;
case WM_LBUTTONDBLCLK:
GetClientRect(hwnd, (LPRECT)& rc);
pt.x = GET_X_LPARAM(lParam);
pt.y = GET_Y_LPARAM(lParam);
item_id = (pt.x / SB_ICON_WIDTH);
if (PtInRect((LPRECT) &rc, pt) && (item_id < sb_parts)) {
if (sb_part_meanings[item_id] == SB_SOUND)
SoundGainDialogCreate(hwndMain);
}
break;
default: default:
return(CallWindowProc((WNDPROC)OriginalProcedure, return(CallWindowProc((WNDPROC)OriginalProcedure,
hwnd, message, wParam, lParam)); hwnd, message, wParam, lParam));
@@ -1221,6 +1260,8 @@ StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst)
hIcon[i] = LoadIconEx((PCTSTR) i); hIcon[i] = LoadIconEx((PCTSTR) i);
for (i = 224; i < 226; i++) for (i = 224; i < 226; i++)
hIcon[i] = LoadIconEx((PCTSTR) i); hIcon[i] = LoadIconEx((PCTSTR) i);
for (i = 259; i < 260; i++)
hIcon[i] = LoadIconEx((PCTSTR) i);
for (i = 384; i < 386; i++) for (i = 384; i < 386; i++)
hIcon[i] = LoadIconEx((PCTSTR) i); hIcon[i] = LoadIconEx((PCTSTR) i);
for (i = 400; i < 402; i++) for (i = 400; i < 402; i++)

View File

@@ -8,7 +8,7 @@
* *
* user Interface module for WinAPI on Windows. * user Interface module for WinAPI on Windows.
* *
* Version: @(#)win_ui.c 1.0.15 2018/02/01 * Version: @(#)win_ui.c 1.0.16 2018/02/06
* *
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/> * Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -311,10 +311,6 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
win_settings_open(hwnd); win_settings_open(hwnd);
break; break;
case IDM_SND_GAIN:
SoundGainDialogCreate(hwnd);
break;
case IDM_ABOUT: case IDM_ABOUT:
AboutDialogCreate(hwnd); AboutDialogCreate(hwnd);
break; break;