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

📄 xif.c

📁 aee是一种易使用的文本编辑器。你可以不用说明书来使用它。它提供终端接口和本地的X-windows接口。它的特性包括即弹的菜单
💻 C
📖 第 1 页 / 共 2 页
字号:
/* | xif.c | $Revision $ *//* |	Copyright (c) 1987, 1988, 1991 - 1996 Hugh Mahon. */#include "Xcurse.h"#include <X11/Xutil.h>#include <X11/cursorfont.h>#include "aee.h"#include <sys/time.h>#include <sys/types.h>#include <unistd.h>/* |	definitions for xif.c */char num_string[10];int in_char;Cursor ae_cursor;Cursor blank_cursor;Pixmap blank_pix;int cursor_on;char *aeMenuTitle = "ae menu";char *aemenuitems[] = {			"commands", 			"functions", 			"help", 			"settings", 			"file operations", 			"search/replace", 			"mark/paste text" 			};char *file_menutitle = "file operations";char *file_menuitems[] = {			"read file", 			"write file" 			};char *sr_menutitle = "search/replace";char *sr_menuitems[] = {			"search for ...", 			"search", 			"replace" 			};char *mp_menutitle = "mark/paste text";char *mp_menuitems[] = {			"mark text", 			"mark append", 			"mark prefix", 			"copy", 			"cut", 			"paste" 			};char *com_menutitle = "commands";char *com_menuitems[] = {			"buffer (create/move to)", 			"define key", 			"character", 			"delete current buffer", 			"current line number is", 			"resequence line numbers", 			"exit (save changes)", 			"quit (no changes)" 			};char *com_strings[] = {	"buffer ", "define ", "character", "delete", 	"line", "resequence", "exit", "quit"	};char *func_menutitle = "functions";char *func_menuitems[] = {			"next page", 			"previous page", 			"next buffer", 			"previous buffer", 			"delete line", 			"delete word", 			"delete char", 			"undelete line", 			"undelete word", 			"undelete char", 			"begin of line", 			"end of line", 			"begin of text", 			"end of text", 			"insert line", 			"next line", 			"next word", 			"previous word", 			"match () [] <> {}", 			"redraw screen" 			};XFontStruct *panelfont;/* |	definitions from Xcurse.c */extern int fontheight, fontwidth;extern Display *dp;		/* display pointer			*/extern int Xscreen;		/* screen 				*/extern XEvent event;		/* event				*/extern Colormap colormap;	/* colormap of display			*/extern XColor Back_color;	/* struct holding background color values */extern WINDOW *last_window_refreshed;/* end of definitions from Xcurse.c	*/extern Window wid;extern XFontStruct *xaefont;XButtonEvent *eventbutton;XMotionEvent *eventmotion;/* ----- radio button declaration section ----- */short case_rb_button = 1;char *case_rblabels[] = {			"not case sensitive ", 			"case sensitive " 			};short eight_rb_button = 0;char *eight_rblabels[] = {			"don't display eight bit characters", 			"display eight bit characters" 			};short expand_rb_button = 0;char *expand_rblabels[] = {			"do not expand tabs", 			"expand tabs to spaces"			};short indent_rb_button = 0;char *indent_rblabels[] = {			"do not indent ", 			"automatically indent "			};short liter_rb_button = 0;char *liter_rblabels[] = {			"metacharacters allowed", 			"literal search"			};short over_rb_button = 0;char *over_rblabels[] = {			"insert characters ", 			"replace characters "			};short stat_rb_button = 0;char *stat_rblabels[] = {			"no status line", 			"display status line"			};short window_rb_button = 1;char *window_rblabels[] = {			"display only one buffer", 			"display multiple buffers"			};short wrap_rb_button = 1;char *wrap_rblabels[] = {			"cut off line at right margin", 			"allow line of any length"			};short forward_rb_button = 0;char *forward_rblabels[] = {			"search reverse", 			"search forward"			};char *pblabel[] = {			"settings OK", 			"cancel"			};short srch_fwd_rb_button = 0;char *srch_fwd_rblabels[] = {			"search reverse", 			"search forward"			};short srch_lit_rb_button = 0;char *srch_lit_rblabels[] = {			"allow metacharacters",			"literal search"			};short srch_cas_rb_button = 0;char *srch_cas_rblabels[] = {			"not case sensitive search", 			"case sensitive search"			};char *srch_pblabel[] = {			"settings OK", 			"cancel"			};char *xsrch_string;/* ----- replace panel declarations ----- */short rpl_fwd_rb_button = 0;char *rpl_fwd_rblabels[] = {			"search reverse", 			"search forward"			};short rpl_lit_rb_button = 0;char *rpl_lit_rblabels[] = {			"allow metacharacters",			"literal search"			};short rpl_cas_rb_button = 0;char *rpl_cas_rblabels[] = {			"not case sensitive search", 			"case sensitive search"			};char *rpl_pblabel[] = {			"settings OK", 			"cancel"			};char *xold_string;char *xnew_string;int tempx, tempy;int wheight, wwidth;/* ----- read panel declarations ----- */char *read_pblabel[] = {			"OK", 			"cancel"			};char *xread_string;/* -----write panel declarations ----- */char *write_pblabel[] = {			"OK", 			"cancel"			};char *xwrite_string;/* ----- buffer panel declarations ----- */char *buff_pblabel[] = {			"OK", 			"cancel"			};char *xbuff_string;/* ----- define key panel declarations ----- */char *defkey_pblabel[] = {			"OK", 			"cancel"			};char *xdefkey_string;int menu_active;char *menubackground;	/* name of background color	*/char *menuforeground;	/* name of foreground color	*/int menufore_pixel;	/* the pixel value of the foreground color	*/int menuback_pixel;	/* the pixel value of the background color	*/XColor menuFore_color;	/* structure which holds foreground color values */XColor menuBack_color;	/* structure which holds background color values */static unsigned int xae_window_height, xae_window_width;#define icon_width 48#define icon_height 48static int xfd;static int number_of_events;static fd_set ttymask;static struct timeval timeout;static char xae_in_focus = TRUE;void event_init(){	XSelectInput(dp, wid, (KeyPressMask | ButtonPressMask | ButtonReleaseMask | 	    ExposureMask | ButtonMotionMask | PointerMotionMask | StructureNotifyMask | 	    FocusChangeMask));	in_char = 0;	xae_window_height = LINES * fontheight;	xae_window_width = COLS * fontwidth;	eventbutton = (XButtonEvent *) &event;	eventmotion = (XMotionEvent *) &event;#ifdef hide_cursor	ae_cursor = XCreateFontCursor(dp, XC_arrow);	XDefineCursor(dp, wid, ae_cursor);	cursor_on = TRUE;	blank_pix = XCreateBitmapFromData(dp, wid, blank_bits, 1, 1, Back_color, Back_color, XDefaultDepth(dp, Xscreen));	blank_cursor = XCreatePixmapCursor(dp, blank_pix, None, 0, 0, 0, 0);#endif	panelfont = xaefont;	xfd = ConnectionNumber(dp);}void event_manage()		/* manage X-windows events for xae	*/{	int valid;	int tempy;	int tempx;	int cut_paste;	/* mark text to put in X buffer	*/	int counter;	int buff_counter;	int temp_indent;  /* if indent must be set FALSE, store original value here */	char *temp_point;	char *temp_buff;	int temp;	valid = FALSE;	cut_paste = FALSE;	do {#ifndef XIF_DEBUG		number_of_events = XPending(dp);		if ((xae_in_focus) && (number_of_events == 0))		{			do 			{				timeout.tv_sec = 0;

⌨️ 快捷键说明

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