static INT_PTR CALLBACK dialog_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { int command; switch (msg) { case WM_COMMAND: command = LOWORD(wparam); switch (command) { case IDC_DS12C887RTC_ENABLE: enable_ds12c887rtc_controls(hwnd); break; case IDOK: end_ds12c887rtc_dialog(hwnd); case IDCANCEL: EndDialog(hwnd, 0); return TRUE; } return FALSE; case WM_CLOSE: EndDialog(hwnd, 0); return TRUE; case WM_INITDIALOG: init_ds12c887rtc_dialog(hwnd); return TRUE; } return FALSE; }
static void init_ds12c887rtc_dialog(HWND hwnd) { HWND temp_hwnd; int res_value; int res_value_loop; int active_value; int xsize, ysize; int *ui_ds12c887rtc_base; if (machine_class == VICE_MACHINE_VIC20) { ui_ds12c887rtc_base = ui_vic20_ds12c887rtc_base; } else if (machine_class == VICE_MACHINE_C128) { ui_ds12c887rtc_base = ui_c128_ds12c887rtc_base; } else { ui_ds12c887rtc_base = ui_c64_ds12c887rtc_base; } uilib_localize_dialog(hwnd, ds12c887rtc_dialog); uilib_adjust_group_width(hwnd, ds12c887rtc_left_total_group); uilib_get_group_extent(hwnd, ds12c887rtc_leftgroup, &xsize, &ysize); uilib_adjust_group_width(hwnd, ds12c887rtc_leftgroup); uilib_move_group(hwnd, ds12c887rtc_rightgroup, xsize + 30); resources_get_int("DS12C887RTC", &res_value); CheckDlgButton(hwnd, IDC_DS12C887RTC_ENABLE, res_value ? BST_CHECKED : BST_UNCHECKED); resources_get_int("DS12C887RTCRunMode", &res_value); CheckDlgButton(hwnd, IDC_DS12C887RTC_RUNMODE, res_value ? BST_CHECKED : BST_UNCHECKED); resources_get_int("DS12C887RTCSave", &res_value); CheckDlgButton(hwnd, IDC_DS12C887RTC_SAVE, res_value ? BST_CHECKED : BST_UNCHECKED); temp_hwnd = GetDlgItem(hwnd, IDC_DS12C887RTC_BASE); for (res_value_loop = 0; ui_ds12c887rtc_base[res_value_loop] != -1; res_value_loop++) { TCHAR st[40]; _stprintf(st, "$%X", ui_ds12c887rtc_base[res_value_loop]); SendMessage(temp_hwnd, CB_ADDSTRING, 0, (LPARAM)st); } resources_get_int("DS12C887RTCbase", &res_value); active_value = 0; for (res_value_loop = 0; ui_ds12c887rtc_base[res_value_loop] != -1; res_value_loop++) { if (ui_ds12c887rtc_base[res_value_loop] == res_value) { active_value = res_value_loop; } } SendMessage(temp_hwnd, CB_SETCURSEL, (WPARAM)active_value, 0); enable_ds12c887rtc_controls(hwnd); }