diff --git a/src/win/languages/dialogs.rc b/src/win/languages/dialogs.rc index ef3b8ac62..83d81e074 100644 --- a/src/win/languages/dialogs.rc +++ b/src/win/languages/dialogs.rc @@ -402,23 +402,67 @@ FONT FONT_SIZE, FONT_NAME BEGIN LTEXT STR_NET_TYPE, IDT_NET_TYPE, CFG_HMARGIN, CFG_VMARGIN, CFG_PANE_LTEXT_PRI_WIDTH, CFG_PANE_LTEXT_HEIGHT - COMBOBOX IDC_COMBO_NET1_TYPE, - CFG_COMBO_BOX_LEFT, 7, CFG_COMBO_NOBTN_WIDTH, CFG_COMBO_HEIGHT, - CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT STR_PCAP, IDT_PCAP, - CFG_HMARGIN, 28, CFG_PANE_LTEXT_PRI_WIDTH, CFG_PANE_LTEXT_HEIGHT - COMBOBOX IDC_COMBO_PCAP1, - CFG_COMBO_BOX_LEFT, 26, CFG_COMBO_NOBTN_WIDTH, CFG_COMBO_HEIGHT, + CFG_HMARGIN + CFG_PANE_LTEXT_PRI_WIDTH - 10, CFG_VMARGIN, CFG_PANE_LTEXT_PRI_WIDTH, CFG_PANE_LTEXT_HEIGHT + LTEXT STR_NET, IDT_NET, + CFG_HMARGIN + (CFG_PANE_LTEXT_PRI_WIDTH * 2) + 20, CFG_VMARGIN, CFG_PANE_LTEXT_PRI_WIDTH, CFG_PANE_LTEXT_HEIGHT + + COMBOBOX IDC_COMBO_NET1_TYPE, + CFG_HMARGIN, 28, 32, CFG_COMBO_HEIGHT, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + + COMBOBOX IDC_COMBO_PCAP1, + CFG_HMARGIN + CFG_PANE_LTEXT_PRI_WIDTH - 10, 28, 110, CFG_COMBO_HEIGHT, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT STR_NET, IDT_NET, - CFG_HMARGIN, 47, CFG_PANE_LTEXT_PRI_WIDTH, CFG_PANE_LTEXT_HEIGHT COMBOBOX IDC_COMBO_NET1, - CFG_COMBO_BOX_LEFT, 45, CFG_COMBO_BTN_WIDTH, CFG_COMBO_HEIGHT, + CFG_HMARGIN + (CFG_PANE_LTEXT_PRI_WIDTH * 2) + 20, 28, 110, CFG_COMBO_HEIGHT, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP PUSHBUTTON STR_CONFIGURE, IDC_CONFIGURE_NET1, - CFG_COMBO_BTN_LEFT, 44, CFG_BTN_WIDTH, CFG_BTN_HEIGHT + CFG_HMARGIN + (CFG_PANE_LTEXT_PRI_WIDTH * 3) + 50, 27, CFG_BTN_WIDTH, CFG_BTN_HEIGHT + + COMBOBOX IDC_COMBO_NET2_TYPE, + CFG_HMARGIN, 49, 32, CFG_COMBO_HEIGHT, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + + COMBOBOX IDC_COMBO_PCAP2, + CFG_HMARGIN + CFG_PANE_LTEXT_PRI_WIDTH - 10, 49, 110, CFG_COMBO_HEIGHT, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + + COMBOBOX IDC_COMBO_NET2, + CFG_HMARGIN + (CFG_PANE_LTEXT_PRI_WIDTH * 2) + 20, 49, 110, CFG_COMBO_HEIGHT, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON STR_CONFIGURE, IDC_CONFIGURE_NET2, + CFG_HMARGIN + (CFG_PANE_LTEXT_PRI_WIDTH * 3) + 50, 48, CFG_BTN_WIDTH, CFG_BTN_HEIGHT + + COMBOBOX IDC_COMBO_NET3_TYPE, + CFG_HMARGIN, 70, 32, CFG_COMBO_HEIGHT, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + + COMBOBOX IDC_COMBO_PCAP3, + CFG_HMARGIN + CFG_PANE_LTEXT_PRI_WIDTH - 10, 70, 110, CFG_COMBO_HEIGHT, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + + COMBOBOX IDC_COMBO_NET3, + CFG_HMARGIN + (CFG_PANE_LTEXT_PRI_WIDTH * 2) + 20, 70, 110, CFG_COMBO_HEIGHT, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON STR_CONFIGURE, IDC_CONFIGURE_NET3, + CFG_HMARGIN + (CFG_PANE_LTEXT_PRI_WIDTH * 3) + 50, 69, CFG_BTN_WIDTH, CFG_BTN_HEIGHT + + COMBOBOX IDC_COMBO_NET4_TYPE, + CFG_HMARGIN, 91, 32, CFG_COMBO_HEIGHT, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + + COMBOBOX IDC_COMBO_PCAP4, + CFG_HMARGIN + CFG_PANE_LTEXT_PRI_WIDTH - 10, 91, 110, CFG_COMBO_HEIGHT, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + + COMBOBOX IDC_COMBO_NET4, + CFG_HMARGIN + (CFG_PANE_LTEXT_PRI_WIDTH * 2) + 20, 91, 110, CFG_COMBO_HEIGHT, + CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON STR_CONFIGURE, IDC_CONFIGURE_NET4, + CFG_HMARGIN + (CFG_PANE_LTEXT_PRI_WIDTH * 3) + 50, 90, CFG_BTN_WIDTH, CFG_BTN_HEIGHT + END DLG_CFG_PORTS DIALOG DISCARDABLE CFG_PANE_LEFT, CFG_PANE_TOP, CFG_PANE_WIDTH, CFG_PANE_HEIGHT diff --git a/src/win/win_settings.c b/src/win/win_settings.c index 104ae0078..ceee9fa37 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -2037,16 +2037,12 @@ network_recalc_combos(HWND hdlg) { ignore_change = 1; -#if 0 for (uint8_t i = 0; i < NET_CARD_MAX; i++) { -#endif - settings_enable_window(hdlg, IDC_COMBO_PCAP1, temp_net_type[0] == NET_TYPE_PCAP); - settings_enable_window(hdlg, IDC_COMBO_NET1, - (temp_net_type[0] == NET_TYPE_SLIRP) || ((temp_net_type[0] == NET_TYPE_PCAP) && (network_dev_to_id(temp_pcap_dev[0]) > 0))); - settings_enable_window(hdlg, IDC_CONFIGURE_NET1, network_card_has_config(temp_net_card[0]) && ((temp_net_type[0] == NET_TYPE_SLIRP) || ((temp_net_type[0] == NET_TYPE_PCAP) && (network_dev_to_id(temp_pcap_dev[0]) > 0)))); -#if 0 + settings_enable_window(hdlg, IDC_COMBO_PCAP1 + i, temp_net_type[i] == NET_TYPE_PCAP); + settings_enable_window(hdlg, IDC_COMBO_NET1 + i, + (temp_net_type[i] == NET_TYPE_SLIRP) || ((temp_net_type[i] == NET_TYPE_PCAP) && (network_dev_to_id(temp_pcap_dev[i]) > 0))); + settings_enable_window(hdlg, IDC_CONFIGURE_NET1 + i, network_card_has_config(temp_net_card[i]) && ((temp_net_type[i] == NET_TYPE_SLIRP) || ((temp_net_type[i] == NET_TYPE_PCAP) && (network_dev_to_id(temp_pcap_dev[i]) > 0)))); } -#endif ignore_change = 0; } @@ -2065,73 +2061,80 @@ win_settings_network_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) case WM_INITDIALOG: lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR)); -#if 0 for (uint8_t i = 0; i < NET_CARD_MAX; i++) { -#endif - settings_add_string(hdlg, IDC_COMBO_NET1_TYPE, (LPARAM) L"None"); - settings_add_string(hdlg, IDC_COMBO_NET1_TYPE, (LPARAM) L"SLiRP"); - settings_add_string(hdlg, IDC_COMBO_NET1_TYPE, (LPARAM) L"PCap"); - settings_set_cur_sel(hdlg, IDC_COMBO_NET1_TYPE, temp_net_type[0]); - settings_enable_window(hdlg, IDC_COMBO_PCAP1, temp_net_type[0] == NET_TYPE_PCAP); + settings_add_string(hdlg, IDC_COMBO_NET1_TYPE + i, (LPARAM) L"None"); + settings_add_string(hdlg, IDC_COMBO_NET1_TYPE + i, (LPARAM) L"SLiRP"); + settings_add_string(hdlg, IDC_COMBO_NET1_TYPE + i, (LPARAM) L"PCap"); + settings_set_cur_sel(hdlg, IDC_COMBO_NET1_TYPE + i, temp_net_type[i]); + settings_enable_window(hdlg, IDC_COMBO_PCAP1 + i, temp_net_type[i] == NET_TYPE_PCAP); - for (c = 0; c < network_ndev; c++) { - mbstowcs(lptsTemp, network_devs[c].description, strlen(network_devs[c].description) + 1); - settings_add_string(hdlg, IDC_COMBO_PCAP1, (LPARAM) lptsTemp); - } - settings_set_cur_sel(hdlg, IDC_COMBO_PCAP1, network_dev_to_id(temp_pcap_dev[0])); + for (c = 0; c < network_ndev; c++) { + mbstowcs(lptsTemp, network_devs[c].description, strlen(network_devs[c].description) + 1); + settings_add_string(hdlg, IDC_COMBO_PCAP1 + i, (LPARAM) lptsTemp); + } + settings_set_cur_sel(hdlg, IDC_COMBO_PCAP1 + i, network_dev_to_id(temp_pcap_dev[i])); - /* NIC config */ - c = d = 0; - settings_reset_content(hdlg, IDC_COMBO_NET1); - while (1) { - generate_device_name(network_card_getdevice(c), network_card_get_internal_name(c), 1); + /* NIC config */ + c = d = 0; + settings_reset_content(hdlg, IDC_COMBO_NET1 + i); + while (1) { + generate_device_name(network_card_getdevice(c), network_card_get_internal_name(c), 1); - if (device_name[0] == L'\0') - break; + if (device_name[0] == L'\0') + break; - if (network_card_available(c) && device_is_valid(network_card_getdevice(c), temp_machine)) { - if (c == 0) - settings_add_string(hdlg, IDC_COMBO_NET1, win_get_string(IDS_2104)); - else - settings_add_string(hdlg, IDC_COMBO_NET1, (LPARAM) device_name); - settings_list_to_device[0][d] = c; - if ((c == 0) || (c == temp_net_card[0])) - settings_set_cur_sel(hdlg, IDC_COMBO_NET1, d); - d++; + if (network_card_available(c) && device_is_valid(network_card_getdevice(c), temp_machine)) { + if (c == 0) + settings_add_string(hdlg, IDC_COMBO_NET1 + i, win_get_string(IDS_2104)); + else + settings_add_string(hdlg, IDC_COMBO_NET1 + i, (LPARAM) device_name); + settings_list_to_device[0][d] = c; + if ((c == 0) || (c == temp_net_card[i])) + settings_set_cur_sel(hdlg, IDC_COMBO_NET1 + i, d); + d++; + } + + c++; } - c++; + settings_enable_window(hdlg, IDC_COMBO_NET1 + i, d); + network_recalc_combos(hdlg); } - - settings_enable_window(hdlg, IDC_COMBO_NET1, d); - network_recalc_combos(hdlg); free(lptsTemp); -#if 0 - } -#endif return TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_COMBO_NET1_TYPE: -#if 0 - case IDC_COMBO_NET2_TYPE: - case IDC_COMBO_NET3_TYPE: - case IDC_COMBO_NET4_TYPE: -#endif if (ignore_change) return FALSE; temp_net_type[0] = settings_get_cur_sel(hdlg, IDC_COMBO_NET1_TYPE); network_recalc_combos(hdlg); break; + case IDC_COMBO_NET2_TYPE: + if (ignore_change) + return FALSE; + + temp_net_type[1] = settings_get_cur_sel(hdlg, IDC_COMBO_NET2_TYPE); + network_recalc_combos(hdlg); + break; + case IDC_COMBO_NET3_TYPE: + if (ignore_change) + return FALSE; + + temp_net_type[2] = settings_get_cur_sel(hdlg, IDC_COMBO_NET3_TYPE); + network_recalc_combos(hdlg); + break; + case IDC_COMBO_NET4_TYPE: + if (ignore_change) + return FALSE; + + temp_net_type[3] = settings_get_cur_sel(hdlg, IDC_COMBO_NET4_TYPE); + network_recalc_combos(hdlg); + break; case IDC_COMBO_PCAP1: -#if 0 - case IDC_COMBO_PCAP2: - case IDC_COMBO_PCAP3: - case IDC_COMBO_PCAP4: -#endif if (ignore_change) return FALSE; @@ -2139,46 +2142,98 @@ win_settings_network_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) strcpy(temp_pcap_dev[0], network_devs[settings_get_cur_sel(hdlg, IDC_COMBO_PCAP1)].device); network_recalc_combos(hdlg); break; + case IDC_COMBO_PCAP2: + if (ignore_change) + return FALSE; + + memset(temp_pcap_dev[1], '\0', sizeof(temp_pcap_dev[1])); + strcpy(temp_pcap_dev[1], network_devs[settings_get_cur_sel(hdlg, IDC_COMBO_PCAP2)].device); + network_recalc_combos(hdlg); + break; + case IDC_COMBO_PCAP3: + if (ignore_change) + return FALSE; + + memset(temp_pcap_dev[2], '\0', sizeof(temp_pcap_dev[2])); + strcpy(temp_pcap_dev[2], network_devs[settings_get_cur_sel(hdlg, IDC_COMBO_PCAP3)].device); + network_recalc_combos(hdlg); + break; + case IDC_COMBO_PCAP4: + if (ignore_change) + return FALSE; + + memset(temp_pcap_dev[3], '\0', sizeof(temp_pcap_dev[3])); + strcpy(temp_pcap_dev[3], network_devs[settings_get_cur_sel(hdlg, IDC_COMBO_PCAP4)].device); + network_recalc_combos(hdlg); + break; case IDC_COMBO_NET1: -#if 0 - case IDC_COMBO_NET2: - case IDC_COMBO_NET3: - case IDC_COMBO_NET4: -#endif if (ignore_change) return FALSE; temp_net_card[0] = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_NET1)]; network_recalc_combos(hdlg); break; + case IDC_COMBO_NET2: + if (ignore_change) + return FALSE; + + temp_net_card[1] = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_NET2)]; + network_recalc_combos(hdlg); + break; + case IDC_COMBO_NET3: + if (ignore_change) + return FALSE; + + temp_net_card[2] = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_NET3)]; + network_recalc_combos(hdlg); + break; + case IDC_COMBO_NET4: + if (ignore_change) + return FALSE; + + temp_net_card[3] = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_NET4)]; + network_recalc_combos(hdlg); + break; case IDC_CONFIGURE_NET1: -#if 0 - case IDC_CONFIGURE_NET2: - case IDC_CONFIGURE_NET3: - case IDC_CONFIGURE_NET4: -#endif if (ignore_change) return FALSE; temp_net_card[0] = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_NET1)]; temp_deviceconfig |= deviceconfig_open(hdlg, (void *) network_card_getdevice(temp_net_card[0])); break; + case IDC_CONFIGURE_NET2: + if (ignore_change) + return FALSE; + + temp_net_card[1] = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_NET2)]; + temp_deviceconfig |= deviceconfig_open(hdlg, (void *) network_card_getdevice(temp_net_card[1])); + break; + case IDC_CONFIGURE_NET3: + if (ignore_change) + return FALSE; + + temp_net_card[2] = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_NET3)]; + temp_deviceconfig |= deviceconfig_open(hdlg, (void *) network_card_getdevice(temp_net_card[2])); + break; + case IDC_CONFIGURE_NET4: + if (ignore_change) + return FALSE; + + temp_net_card[3] = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_NET4)]; + temp_deviceconfig |= deviceconfig_open(hdlg, (void *) network_card_getdevice(temp_net_card[3])); + break; } return FALSE; case WM_SAVESETTINGS: -#if 0 for (uint8_t i = 0; i < NET_CARD_MAX; i++) { -#endif - temp_net_type[0] = settings_get_cur_sel(hdlg, IDC_COMBO_NET1_TYPE); - memset(temp_pcap_dev[0], '\0', sizeof(temp_pcap_dev[0])); - strcpy(temp_pcap_dev[0], network_devs[settings_get_cur_sel(hdlg, IDC_COMBO_PCAP1)].device); - temp_net_card[0] = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_NET1)]; -#if 0 + temp_net_type[i] = settings_get_cur_sel(hdlg, IDC_COMBO_NET1_TYPE + i); + memset(temp_pcap_dev[i], '\0', sizeof(temp_pcap_dev[i])); + strcpy(temp_pcap_dev[i], network_devs[settings_get_cur_sel(hdlg, IDC_COMBO_PCAP1 + i)].device); + temp_net_card[i] = settings_list_to_device[0][settings_get_cur_sel(hdlg, IDC_COMBO_NET1 + i)]; } -#endif default: return FALSE; }