📄 menu.c
字号:
d->items[1].data = (void *)&bugs->allow_blacklist; d->items[2].type = D_CHECKBOX; d->items[2].gid = 0; d->items[2].dlen = sizeof(int); d->items[2].data = (void *)&bugs->bug_302_redirect; d->items[3].type = D_CHECKBOX; d->items[3].gid = 0; d->items[3].dlen = sizeof(int); d->items[3].data = (void *)&bugs->bug_post_no_keepalive; d->items[4].type = D_CHECKBOX; d->items[4].gid = 0; d->items[4].dlen = sizeof(int); d->items[4].data = (void *)&bugs->no_accept_charset; d->items[5].type = D_CHECKBOX; d->items[5].gid = 0; d->items[5].dlen = sizeof(int); d->items[5].data = (void *)&bugs->no_compression; d->items[6].type = D_CHECKBOX; d->items[6].gid = 0; d->items[6].dlen = sizeof(int); d->items[6].data = (void *)&bugs->retry_internal_errors; d->items[7].type = D_CHECKBOX; d->items[7].gid = 1; d->items[7].gnum = REFERER_NONE; d->items[7].dlen = sizeof(int); d->items[7].data = (void *)&bugs->referer; d->items[8].type = D_CHECKBOX; d->items[8].gid = 1; d->items[8].gnum = REFERER_SAME_URL; d->items[8].dlen = sizeof(int); d->items[8].data = (void *)&bugs->referer; d->items[9].type = D_CHECKBOX; d->items[9].gid = 1; d->items[9].gnum = REFERER_FAKE; d->items[9].dlen = sizeof(int); d->items[9].data = (void *)&bugs->referer; d->items[10].type = D_CHECKBOX; d->items[10].gid = 1; d->items[10].gnum = REFERER_REAL_SAME_SERVER; d->items[10].dlen = sizeof(int); d->items[10].data = (void *)&bugs->referer; d->items[11].type = D_CHECKBOX; d->items[11].gid = 1; d->items[11].gnum = REFERER_REAL; d->items[11].dlen = sizeof(int); d->items[11].data = (void *)&bugs->referer; d->items[12].type = D_FIELD; d->items[12].dlen = MAX_STR_LEN; d->items[12].data = bugs->fake_useragent; d->items[13].type = D_FIELD; d->items[13].dlen = MAX_STR_LEN; d->items[13].data = bugs->fake_referer; d->items[14].type = D_BUTTON; d->items[14].gid = B_ENTER; d->items[14].fn = ok_dialog; d->items[14].text = TEXT(T_OK); d->items[15].type = D_BUTTON; d->items[15].gid = B_ESC; d->items[15].fn = cancel_dialog; d->items[15].text = TEXT(T_CANCEL); d->items[16].type = D_END; do_dialog(dlg->win->term, d, getml(d, NULL)); return 0;}unsigned char *ftp_texts[] = { TEXT(T_PASSWORD_FOR_ANONYMOUS_LOGIN), TEXT(T_USE_PASSIVE_FTP), TEXT(T_USE_FAST_FTP), TEXT(T_SET_TYPE_OF_SERVICE), NULL };void ftpopt_fn(struct dialog_data *dlg){ struct terminal *term = dlg->win->term; int max = 0, min = 0; int w, rw; int y = 0; if (dlg->win->term->spec->braille) y += gf_val(1, G_BFU_FONT_SIZE); max_text_width(term, ftp_texts[0], &max, AL_LEFT); min_text_width(term, ftp_texts[0], &min, AL_LEFT); checkboxes_width(term, ftp_texts + 1, &max, max_text_width); checkboxes_width(term, ftp_texts + 1, &min, min_text_width); max_buttons_width(term, dlg->items + dlg->n - 2, 2, &max); min_buttons_width(term, dlg->items + dlg->n - 2, 2, &min); w = term->x * 9 / 10 - 2 * DIALOG_LB; if (w > max) w = max; if (w < min) w = min; if (w > term->x - 2 * DIALOG_LB) w = term->x - 2 * DIALOG_LB; if (w < 5) w = 5; rw = 0; dlg_format_text_and_field(dlg, NULL, ftp_texts[0], dlg->items, 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT); dlg_format_checkboxes(dlg, NULL, dlg->items + 1, dlg->n - 3, 0, &y, w, &rw, ftp_texts + 1); y += gf_val(1, 1 * G_BFU_FONT_SIZE); dlg_format_buttons(dlg, NULL, dlg->items + dlg->n - 2, 2, 0, &y, w, &rw, AL_CENTER); w = rw; dlg->xw = rw + 2 * DIALOG_LB; dlg->yw = y + 2 * DIALOG_TB; center_dlg(dlg); draw_dlg(dlg); y = dlg->y + DIALOG_TB; if (dlg->win->term->spec->braille) y += gf_val(1, G_BFU_FONT_SIZE); dlg_format_text_and_field(dlg, term, ftp_texts[0], dlg->items, dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT); y += gf_val(1, G_BFU_FONT_SIZE); dlg_format_checkboxes(dlg, term, dlg->items + 1, dlg->n - 3, dlg->x + DIALOG_LB, &y, w, NULL, ftp_texts + 1); y += gf_val(1, G_BFU_FONT_SIZE); dlg_format_buttons(dlg, term, dlg->items + dlg->n - 2, 2, dlg->x + DIALOG_LB, &y, w, &rw, AL_CENTER);}int dlg_ftp_options(struct dialog_data *dlg, struct dialog_item_data *di){ int a; struct ftp_options *ftp_options = (struct ftp_options *)di->cdata; struct dialog *d; d = mem_calloc(sizeof(struct dialog) + 6 * sizeof(struct dialog_item)); d->title = TEXT(T_FTP_OPTIONS); d->fn = ftpopt_fn; d->items[0].type = D_FIELD; d->items[0].dlen = MAX_STR_LEN; d->items[0].data = ftp_options->anon_pass; d->items[1].type = D_CHECKBOX; d->items[1].dlen = sizeof(int); d->items[1].data = (void*)&ftp_options->passive_ftp; d->items[1].gid = 0; d->items[2].type = D_CHECKBOX; d->items[2].dlen = sizeof(int); d->items[2].data = (void*)&ftp_options->fast_ftp;#ifdef HAVE_IPTOS d->items[3].type = D_CHECKBOX; d->items[3].dlen = sizeof(int); d->items[3].data = (void*)&ftp_options->set_tos; a = 4;#else a = 3;#endif d->items[a].type = D_BUTTON; d->items[a].gid = B_ENTER; d->items[a].fn = ok_dialog; d->items[a].text = TEXT(T_OK); a++; d->items[a].type = D_BUTTON; d->items[a].gid = B_ESC; d->items[a].fn = cancel_dialog; d->items[a].text = TEXT(T_CANCEL); a++; d->items[a].type = D_END; do_dialog(dlg->win->term, d, getml(d, NULL)); return 0;}#ifdef G#define VO_GAMMA_LEN 9unsigned char disp_red_g[VO_GAMMA_LEN];unsigned char disp_green_g[VO_GAMMA_LEN];unsigned char disp_blue_g[VO_GAMMA_LEN];unsigned char user_g[VO_GAMMA_LEN];unsigned char aspect_str[VO_GAMMA_LEN];int gamma_stamp; /* stamp counter for gamma changes */void refresh_video(struct session *ses){ struct rect r = {0, 0, 0, 0}; struct terminal *term; display_red_gamma=atof(disp_red_g); display_green_gamma=atof(disp_green_g); display_blue_gamma=atof(disp_blue_g); user_gamma=atof(user_g); bfu_aspect=atof(aspect_str); update_aspect(); gamma_stamp++; /* Flush font cache */ destroy_font_cache(); /* Flush dip_get_color cache */ gamma_cache_rgb = -2; /* Recompute dithering tables for the new gamma */ init_dither(drv->depth); shutdown_bfu(); init_bfu(); init_grview(); html_interpret_recursive(ses->screen); draw_formatted(ses); /* Redraw all terminals */ foreach(term, terminals){ memcpy(&r, &term->dev->size, sizeof r); t_redraw(term->dev, &r); }}unsigned char *video_msg[] = { TEXT(T_VIDEO_OPTIONS_TEXT), TEXT(T_RED_DISPLAY_GAMMA), TEXT(T_GREEN_DISPLAY_GAMMA), TEXT(T_BLUE_DISPLAY_GAMMA), TEXT(T_USER_GAMMA), TEXT(T_ASPECT_RATIO), TEXT(T_ASPECT_CORRECTION_ON), TEXT(T_DISPLAY_OPTIMIZATION_CRT), TEXT(T_DISPLAY_OPTIMIZATION_LCD_RGB), TEXT(T_DISPLAY_OPTIMIZATION_LCD_BGR), TEXT(T_DITHER_LETTERS), TEXT(T_DITHER_IMAGES), TEXT(T_8_BIT_GAMMA_CORRECTION), TEXT(T_16_BIT_GAMMA_CORRECTION), TEXT(T_AUTO_GAMMA_CORRECTION),};void videoopt_fn(struct dialog_data *dlg){ struct terminal *term = dlg->win->term; int max = 0, min = 0; int w, rw; int y = gf_val(-1, -G_BFU_FONT_SIZE); max_text_width(term, video_msg[0], &max, AL_LEFT); min_text_width(term, video_msg[0], &min, AL_LEFT); max_group_width(term, video_msg + 1, dlg->items, 14, &max); min_group_width(term, video_msg + 1, dlg->items, 14, &min); max_buttons_width(term, dlg->items + 14, 2, &max); min_buttons_width(term, dlg->items + 14, 2, &min); w = dlg->win->term->x * 9 / 10 - 2 * DIALOG_LB; if (w > max) w = max; if (w < min) w = min; if (w > dlg->win->term->x - 2 * DIALOG_LB) w = dlg->win->term->x - 2 * DIALOG_LB; if (w < 1) w = 1; rw = 0; dlg_format_text(dlg, NULL, video_msg[0], 0, &y, w, &rw, COLOR_DIALOG_TEXT, AL_LEFT); y += gf_val(1, G_BFU_FONT_SIZE); dlg_format_group(dlg, NULL, video_msg + 1, dlg->items, 5, 0, &y, w, &rw); y += gf_val(1, G_BFU_FONT_SIZE); dlg_format_checkboxes(dlg, NULL, dlg->items+5, 9, dlg->x + DIALOG_LB, &y, w, &rw, video_msg+6); y += gf_val(1, G_BFU_FONT_SIZE); dlg_format_buttons(dlg, NULL, dlg->items + 14, 2, 0, &y, w, &rw, AL_CENTER); w = rw; dlg->xw = w + 2 * DIALOG_LB; dlg->yw = y + 2 * DIALOG_TB; center_dlg(dlg); draw_dlg(dlg); y = dlg->y + DIALOG_TB; dlg_format_text(dlg, term, video_msg[0], dlg->x + DIALOG_LB, &y, w, NULL, COLOR_DIALOG_TEXT, AL_LEFT); y += gf_val(2, G_BFU_FONT_SIZE); dlg_format_group(dlg, term, video_msg + 1, dlg->items, 5, dlg->x + DIALOG_LB, &y, w, NULL); y += gf_val(1, G_BFU_FONT_SIZE); dlg_format_checkboxes(dlg, term, dlg->items+5, 9, dlg->x + DIALOG_LB, &y, w, NULL, video_msg+6); y += gf_val(1, G_BFU_FONT_SIZE); dlg_format_buttons(dlg, term, &dlg->items[14], 2, dlg->x + DIALOG_LB, &y, w, NULL, AL_CENTER);}void remove_zeroes(unsigned char *string){ int l=strlen(string); while(l&&(string[l-1]=='0')){ l--; string[l]=0; }}void video_options(struct terminal *term, void *xxx, struct session *ses){ struct dialog *d; snprintf(disp_red_g, VO_GAMMA_LEN, "%f", display_red_gamma); remove_zeroes(disp_red_g); snprintf(disp_green_g, VO_GAMMA_LEN, "%f", display_green_gamma); remove_zeroes(disp_green_g); snprintf(disp_blue_g, VO_GAMMA_LEN, "%f", display_blue_gamma); remove_zeroes(disp_blue_g); snprintf(user_g, VO_GAMMA_LEN, "%f", user_gamma); remove_zeroes(user_g); snprintf(aspect_str, VO_GAMMA_LEN, "%f", bfu_aspect); remove_zeroes(aspect_str); d = mem_calloc(sizeof(struct dialog) + 17 * sizeof(struct dialog_item)); d->title = TEXT(T_VIDEO_OPTIONS); d->fn = videoopt_fn; d->refresh = (void (*)(void *))refresh_video; d->refresh_data = ses; d->items[0].type = D_FIELD; d->items[0].dlen = VO_GAMMA_LEN; d->items[0].data = disp_red_g; d->items[0].fn = check_float; d->items[0].gid = 1; d->items[0].gnum = 10000; d->items[1].type = D_FIELD; d->items[1].dlen = VO_GAMMA_LEN; d->items[1].data = disp_green_g; d->items[1].fn = check_float; d->items[1].gid = 1; d->items[1].gnum = 10000; d->items[2].type = D_FIELD; d->items[2].dlen = VO_GAMMA_LEN; d->items[2].data = disp_blue_g; d->items[2].fn = check_float; d->items[2].gid = 1; d->items[2].gnum = 10000; d->items[3].type = D_FIELD; d->items[3].dlen = VO_GAMMA_LEN; d->items[3].data = user_g; d->items[3].fn = check_float; d->items[3].gid = 1; d->items[3].gnum = 10000; d->items[4].type = D_FIELD; d->items[4].dlen = VO_GAMMA_LEN; d->items[4].data = aspect_str; d->items[4].fn = check_float; d->items[4].gid = 25; d->items[4].gnum = 400; d->items[5].type = D_CHECKBOX; d->items[5].dlen = sizeof(int); d->items[5].data = (void *)&aspect_on; d->items[6].type = D_CHECKBOX; d->items[6].gid = 1; d->items[6].gnum = 0; /* CRT */ d->items[6].dlen = sizeof(int); d->items[6].data = (void *)&display_optimize; d->items[7].type = D_CHECKBOX; d->items[7].gid = 1; d->items[7].gnum = 1; /* LCD RGB */ d->items[7].dlen = sizeof(int); d->items[7].data = (void *)&display_optimize; d->items[8].type = D_CHECKBOX; d->items[8].gid = 1; d->items[8].gnum = 2; /* LCD BGR*/ d->items[8].dlen = sizeof(int); d->items[8].data = (void *)&display_optimize; d->items[9].type = D_CHECKBOX; d->items[9].gid = 0; d->items[9].dlen = sizeof(int); d->items[9].data = (void *)&dither_letters; d->items[10].type = D_CHECKBOX; d->items[10].gid = 0; d->items[10].dlen = sizeof(int); d->items[10].data = (void *)&dither_images; d->items[11].type = D_CHECKBOX; d->items[11].gid = 2; d->items[11].gnum = 0; d->items[11].dlen = sizeof(int); d->items[11].data = (void *)&gamma_bits; d->items[12].type = D_CHECKBOX; d->items[12].gid = 2; d->items[12].gnum = 1; d->items[12].dlen = sizeof(int); d->items[12].data = (void *)&gamma_bits; d->items[13].type = D_CHECKBOX; d->items[13].gid = 2; d->items[13].gnum = 2; d->items[13].dlen = sizeof(int); d->items[13].data = (void *)&gamma_bits; d->items[14].type = D_BUTTON; d->items[14].gid = B_ENTER; d->items[14].fn = ok_dialog; d->items[14].text = TEXT(T_OK); d->items[15].type = D_BUTTON; d->items[15].gid = B_ESC; d->items[15].fn = cancel_dialog; d->items[15].text = TEXT(T_CANCEL); d->items[16].type = D_END; do_dialog(term, d, getml(d, NULL));}#endifunsigned char max_c_str[3];unsigned char max_cth_str[3];unsigned char max_t_str[3];unsigned char time_str[5];unsigned char unrtime_str[5];void refresh_net(void *xxx){ /*abort_all_connections();*/ max_connections = atoi(max_c_str); max_connections_to_host = atoi(max_cth_str); max_tries = atoi(max_t_str); receive_timeout = atoi(time_str); unrestartable_receive_timeout = atoi(unrtime_str); abort_all_keepalive_connections(); register_bottom_half(check_queue, NULL);}unsigned char *proxy_msg[] = { TEXT(T_HTTP_PROXY__HOST_PORT), TEXT(T_FTP_PROXY__HOST_PORT),
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -