⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lyoptions.c

📁 基于rtos开发的浏览器!
💻 C
📖 第 1 页 / 共 5 页
字号:
			    local_exec = FALSE;			    local_exec_on_local_files = FALSE;			    break;			case 1:			    local_exec = FALSE;			    local_exec_on_local_files = TRUE;			    break;#ifndef NEVER_ALLOW_REMOTE_EXEC			case 2:			    local_exec = TRUE;			    local_exec_on_local_files = FALSE;			    break;#endif /* !NEVER_ALLOW_REMOTE_EXEC */		    } /* end switch */		}		response = ' ';		if (LYSelectPopups) {#if !defined(VMS) || defined(USE_SLANG)		    if (exec_frozen || term_options) {			term_options = FALSE;		    } else {			AddValueAccepted = TRUE;		    }		    goto draw_options;#else		    term_options = FALSE;#endif /* !VMS || USE_SLANG */		}		break;#endif /* ALLOW_USERS_TO_CHANGE_EXEC_WITHIN_OPTIONS */	    case '>':	/* Save current options to RC file. */		if (!no_option_save) {		    option_statusline(SAVING_OPTIONS);		    if (save_rc()) {			LYrcShowColor = LYChosenShowColor;			option_statusline(OPTIONS_SAVED);		    } else {			HTAlert(OPTIONS_NOT_SAVED);		    }		} else {		    option_statusline(R_TO_RETURN_TO_LYNX);		    /*		     *	Change response so that we don't exit		     *	the options menu.		     */		    response = ' ';		}		break;	    case 'r':	/* Return to document (quit options menu). */	    case 'R':		break;	    default:		if (!no_option_save) {		    option_statusline(SAVE_OR_R_TO_RETURN_TO_LYNX);		} else {		    option_statusline(R_TO_RETURN_TO_LYNX);		}	}  /* end switch */    }  /* end while */    term_options = FALSE;    signal(SIGINT, cleanup_sig);}/* *  Take a boolean status,prompt the user for a new status, *  and return it. */PRIVATE int boolean_choice ARGS4(	int,		cur_choice,	int,		line,	int,		column,	char **,	choices){    int response = 0;    int cmd = 0;    int number = 0;    int col = (column >= 0 ? column : COL_OPTION_VALUES);    int orig_choice = cur_choice;#ifdef VMS    extern BOOLEAN HadVMSInterrupt; /* Flag from cleanup_sig() AST */#endif /* VMS */    /*     *	Get the number of choices and then make     *	number zero-based.     */    for (number = 0; choices[number] != NULL; number++)	;  /* empty loop body */    number--;    /*     *	Update the statusline.     */    option_statusline(ANY_KEY_CHANGE_RET_ACCEPT);    /*     *	Highlight the current choice.     */    move(line, col);    start_reverse();    addstr(choices[cur_choice]);    if (LYShowCursor)	move(line, (col - 1));    refresh();    /*     *	Get the keyboard entry, and leave the     *	cursor at the choice, to indicate that     *	it can be changed, until the user accepts     *	the current choice.     */    term_options = FALSE;    while (1) {	move(line, col);	if (term_options == FALSE) {	    response = LYgetch();	}	if (term_options || response == 7 || response == 3) {	     /*	      *  Control-C or Control-G.	      */	    response = '\n';	    term_options = TRUE;	    cur_choice = orig_choice;	}#ifdef VMS	if (HadVMSInterrupt) {	    HadVMSInterrupt = FALSE;	    response = '\n';	    term_options = TRUE;	    cur_choice = orig_choice;	}#endif /* VMS */	if ((response != '\n' && response != '\r') &&	    (cmd = keymap[response+1]) != LYK_ACTIVATE) {	    switch (cmd) {		case LYK_HOME:		    cur_choice = 0;		    break;		case LYK_END:		    cur_choice = number;		    break;		case LYK_REFRESH:		    lynx_force_repaint();		    refresh();		    break;		case LYK_QUIT:		case LYK_ABORT:		case LYK_PREV_DOC:		    cur_choice = orig_choice;		    term_options = TRUE;		    break;		case LYK_PREV_PAGE:		case LYK_UP_HALF:		case LYK_UP_TWO:		case LYK_PREV_LINK:		case LYK_UP_LINK:		case LYK_LEFT_LINK:		    if (cur_choice == 0)			cur_choice = number;  /* go back to end */		    else			cur_choice--;		    break;		case LYK_1:		case LYK_2:		case LYK_3:		case LYK_4:		case LYK_5:		case LYK_6:		case LYK_7:		case LYK_8:		case LYK_9:		    if((cmd - LYK_1 + 1) <= number) {			cur_choice = cmd -LYK_1 + 1;			break;		    }  /* else fall through! */		default:		    if (cur_choice == number)			cur_choice = 0;  /* go over the top and around */		    else			cur_choice++;	    }  /* end of switch */	    addstr(choices[cur_choice]);	    if (LYShowCursor)		move(line, (col - 1));	    refresh();	} else {	    /*	     *	Unhighlight choice.	     */	    move(line, col);	    stop_reverse();	    addstr(choices[cur_choice]);	    if (term_options) {		term_options = FALSE;		option_statusline(CANCELLED);		sleep(InfoSecs);		option_statusline("");	    } else {		option_statusline(VALUE_ACCEPTED);	    }	    return(cur_choice);	}    }}PRIVATE void terminate_options ARGS1(	int,		sig GCC_UNUSED){    term_options = TRUE;    /*     *	Reassert the AST.     */    signal(SIGINT, terminate_options);#ifdef VMS    /*     *	Refresh the screen to get rid of the "interrupt" message.     */    if (!dump_output_immediately) {	lynx_force_repaint();	refresh();    }#endif /* VMS */}/* *  Multi-Bookmark On-Line editing support. - FMG & FM */PUBLIC void edit_bookmarks NOARGS{    int response = 0, def_response = 0, ch;    int MBM_current = 1;#define MULTI_OFFSET 8    int a; /* misc counter */    char MBM_tmp_line[256]; /* buffer for LYgetstr */    char ehead_buffer[265];    /*     *	We need (MBM_V_MAXFILES + MULTI_OFFSET) lines to display     *	the whole list at once.  Otherwise break it up into two     *	segments.  We know it won't be less than that because     *	'o'ptions needs 23-24 at LEAST.     */    term_options = FALSE;    signal(SIGINT, terminate_options);draw_bookmark_list:    /*     *	Display menu of bookmarks.  NOTE that we avoid printw()'s     *	to increase the chances that any non-ASCII or multibyte/CJK     *	characters will be handled properly. - FM     */#if defined(FANCY_CURSES) || defined (USE_SLANG)    if (enable_scrollback) {	clear();    } else {	erase();    }#else    clear();#endif /* FANCY_CURSES || USE_SLANG */    move(0, 5);    lynx_start_h1_color ();    if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET)) {	sprintf(ehead_buffer, MULTIBOOKMARKS_EHEAD_MASK, MBM_current);	addstr(ehead_buffer);    } else {	addstr(MULTIBOOKMARKS_EHEAD);    }    lynx_stop_h1_color ();    if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET)) {	for (a = ((MBM_V_MAXFILES/2 + 1) * (MBM_current - 1));		      a <= ((float)MBM_V_MAXFILES/2 * MBM_current); a++) {	    move((3 + a) - ((MBM_V_MAXFILES/2 + 1)*(MBM_current - 1)), 5);	    addch((unsigned char)(a + 'A'));	    addstr(" : ");	    if (MBM_A_subdescript[a])		addstr(MBM_A_subdescript[a]);	    move((3 + a) - ((MBM_V_MAXFILES/2 + 1)*(MBM_current - 1)), 35);	    addstr("| ");	    if (MBM_A_subbookmark[a]) {		addstr(MBM_A_subbookmark[a]);	    }	}    } else {	for (a = 0; a <= MBM_V_MAXFILES; a++) {	    move(3 + a, 5);	    addch((unsigned char)(a + 'A'));	    addstr(" : ");	    if (MBM_A_subdescript[a])		addstr(MBM_A_subdescript[a]);	    move(3 + a, 35);	    addstr("| ");	    if (MBM_A_subbookmark[a]) {		addstr(MBM_A_subbookmark[a]);	    }	}    }    /*     *	Only needed when we have 2 screens.     */    if (LYlines < MBM_V_MAXFILES + MULTI_OFFSET) {	move((LYlines - 4), 0);	addstr("'");	start_bold();	addstr("[");	stop_bold();	addstr("' ");	addstr(PREVIOUS);	addstr(", '");	start_bold();	addstr("]");	stop_bold();	addstr("' ");	addstr(NEXT_SCREEN);    }    move((LYlines - 3), 0);    if (!no_option_save) {	addstr("'");	start_bold();	addstr(">");	stop_bold();	addstr("'");	addstr(TO_SAVE_SEGMENT);    }    addstr(OR_SEGMENT);    addstr("'");    start_bold();    addstr("^G");    stop_bold();    addstr("'");    addstr(TO_RETURN_SEGMENT);    while (!term_options &&	   !LYisNonAlnumKeyname(response, LYK_PREV_DOC) &&	   response != 7 && response != 3 &&	   response != '>') {	move((LYlines - 2), 0);	lynx_start_prompt_color ();	addstr(MULTIBOOKMARKS_LETTER);	lynx_stop_prompt_color ();	refresh();	response = (def_response ? def_response : LYgetch());	def_response = 0;	/*	 *  Check for a cancel.	 */	if (term_options ||	    response == 7 || response == 3 ||	    LYisNonAlnumKeyname(response, LYK_PREV_DOC))	    continue;	/*	 *  Check for a save.	 */	if (response == '>') {	    if (!no_option_save) {		option_statusline(SAVING_OPTIONS);		if (save_rc())		    option_statusline(OPTIONS_SAVED);		else		    HTAlert(OPTIONS_NOT_SAVED);	    } else {		option_statusline(R_TO_RETURN_TO_LYNX);		/*		 *  Change response so that we don't exit		 *  the options menu.		 */		response = ' ';	    }	    continue;	}	/*	 *  Check for a refresh.	 */	if (LYisNonAlnumKeyname(response, LYK_REFRESH)) {	    lynx_force_repaint();	    continue;	}	/*	 *  Move between the screens - if we can't show it all at once.	 */	if ((response == ']' ||	     LYisNonAlnumKeyname(response, LYK_NEXT_PAGE)) &&	    LYlines < (MBM_V_MAXFILES + MULTI_OFFSET)) {	    MBM_current++;	    if (MBM_current >= 3)		MBM_current = 1;	    goto draw_bookmark_list;	}	if ((response == '[' ||	     LYisNonAlnumKeyname(response, LYK_PREV_PAGE)) &&	    LYlines < (MBM_V_MAXFILES + MULTI_OFFSET)) {	    MBM_current--;	    if (MBM_current <= 0)		MBM_current = 2;	    goto draw_bookmark_list;	}	/*	 *  Instead of using 26 case statements, we set up	 *  a scan through the letters and edit the lines	 *  that way.	 */	for (a = 0; a <= MBM_V_MAXFILES; a++) {	    if ((TOUPPER(response) - 'A') == a) {		if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET)) {		    if (MBM_current == 1 && a > (MBM_V_MAXFILES/2)) {			MBM_current = 2;			def_response = response;			goto draw_bookmark_list;		    }		    if (MBM_current == 2 && a < (MBM_V_MAXFILES/2)) {			MBM_current = 1;			def_response = response;			goto draw_bookmark_list;		    }		}		option_statusline(ACCEPT_DATA);		if (a > 0) {		    start_bold();		    if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET))			move(			 (3 + a) - ((MBM_V_MAXFILES/2 + 1)*(MBM_current - 1)),			     9);		    else			move((3 + a), 9);		    strcpy(MBM_tmp_line,			   (!MBM_A_subdescript[a] ?					       "" : MBM_A_subdescript[a]));		    ch = LYgetstr(MBM_tmp_line, VISIBLE,				  sizeof(MBM_tmp_line), NORECALL);		    stop_bold();		    if (strlen(MBM_tmp_line) < 1) {			FREE(MBM_A_subdescript[a]);		    } else {			StrAllocCopy(MBM_A_subdescript[a], MBM_tmp_line);		    }		    if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET))			move(			 (3 + a) - ((MBM_V_MAXFILES/2 + 1)*(MBM_current - 1)),			     5);		    else			move((3 + a), 5);		    addch((unsigned char)(a + 'A'));		    addstr(" : ");		    if (MBM_A_subdescript[a])			addstr(MBM_A_subdescript[a]);		    clrtoeol();		    refresh();		}		if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET))		    move((3 + a) - ((MBM_V_MAXFILES/2 + 1)*(MBM_current - 1)),			 35);		else		    move((3 + a), 35);		addstr("| ");		start_bold();		strcpy(MBM_tmp_line,		       (!MBM_A_subbookmark[a] ? "" : MBM_A_subbookmark[a]));		ch = LYgetstr(MBM_tmp_line, VISIBLE,			      sizeof(MBM_tmp_line), NORECALL);		stop_bold();		if (*MBM_tmp_line == '\0') {		    if (a == 0)			StrAllocCopy(MBM_A_subbookmark[a], bookmark_page);		    else			FREE(MBM_A_subbookmark[a]);		} else if (!LYPathOffHomeOK(MBM_tmp_line,					    sizeof(MBM_tmp_line))) {			LYMBM_statusline(USE_PATH_OFF_HOME);			sleep(AlertSecs);		} else {		    StrAllocCopy(MBM_A_subbookmark[a], MBM_tmp_line);		    if (a == 0) {			StrAllocCopy(bookmark_page, MBM_A_subbookmark[a]);		    }		}		if (LYlines < (MBM_V_MAXFILES + MULTI_OFFSET))		    move((3 + a) - ((MBM_V_MAXFILES/2 + 1)*(MBM_current-1)),			 35);		else		    move((3 + a), 35);		addstr("| ");		if (MBM_A_subbookmark[a])		    addstr(MBM_A_subbookmark[a]);		clrtoeol();		move(LYlines-1, 0);		clrtoeol();		break;	    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -