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

📄 edit.h

📁 具有IDE功能的编辑器
💻 H
📖 第 1 页 / 共 2 页
字号:
/* edit.h - main include file   Copyright (C) 1996-2000 the Free Software Foundation   Authors: 1996, 1997 Paul Sheer   This program is free software; you can redistribute it and/or modify   it under the terms of the GNU General Public License as published by   the Free Software Foundation; either version 2 of the License, or   (at your option) any later version.   This program is distributed in the hope that it will be useful,   but WITHOUT ANY WARRANTY; without even the implied warranty of   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   GNU General Public License for more details.   You should have received a copy of the GNU General Public License   along with this program; if not, write to the Free Software   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA   02111-1307, USA.*/#ifndef __EDIT_H#define __EDIT_H#ifdef MIDNIGHT#ifdef HAVE_SLANG#define HAVE_SYNTAXH 1#endif#    include <stdio.h>#    include <stdarg.h>#    include <sys/types.h>#    ifdef HAVE_UNISTD_H#    	 include <unistd.h>#    endif#    include <string.h>#    include <ctype.h>#    include <errno.h>#    include "src/tty.h"#    include <sys/stat.h>#    include <errno.h>#    include <fcntl.h>#    include <stdlib.h>#    include <malloc.h>#else       /* ! MIDNIGHT */#    include "global.h"#    include <stdio.h>#    include <stdarg.h>#    include <sys/types.h>#    ifdef HAVE_WCHAR_H#    include <wchar.h>#    endif     #    	 ifdef HAVE_UNISTD_H#    	     include <unistd.h>#    	 endif     #ifdef GTK#    include <string.h>#else#    include <my_string.h>#endif#    include <ctype.h>#    include <errno.h>#    include <sys/stat.h>     #    ifdef HAVE_FCNTL_H#    	 include <fcntl.h>#    endif     #    include <stdlib.h>#    include <stdarg.h>#    if TIME_WITH_SYS_TIME#    	 include <sys/time.h>#    	 include <time.h>#    else#    	 if HAVE_SYS_TIME_H#    	     include <sys/time.h>#    	 else#    	     include <time.h>#    	 endif#    endif #    include "regex.h"#endif#ifndef MIDNIGHT#    include <signal.h>#    include <X11/Xlib.h>#    include <X11/Xutil.h>#    include <X11/Xresource.h>#    include "lkeysym.h"#ifndef GTK#    include "coolwidget.h"#    include "app_glob.c"#    include "coollocal.h"#    include "stringtools.h"#else#    include "gtk/gtk.h"#    include "gdk/gdkprivate.h"#    include "gdk/gdk.h"#    include "gtkedit.h"#    include "editcmddef.h"#    ifndef _#        define _(x) x#        define N_(x) x#    endif#endif#else#    include "src/global.h"#    include "src/main.h"		/* for char *shell */#    include "src/mad.h"#    include "src/dlg.h"#    include "src/widget.h"#    include "src/color.h"#    include "src/dialog.h"#    include "src/mouse.h"#    include "src/help.h"#    include "src/key.h"#    include "src/wtools.h"		/* for QuickWidgets */#    include "src/win.h"#    include "vfs/vfs.h"#    include "src/menu.h"#    include <regex.h>#    define WANT_WIDGETS     #    define WIDGET_COMMAND (WIDGET_USER + 10)#    define N_menus 5#endif#ifdef GTK/* unistd.h defines _POSIX_VERSION on POSIX.1 systems. */#if defined(HAVE_DIRENT_H) || defined(_POSIX_VERSION)#   include <dirent.h>#   define NLENGTH(dirent) (strlen ((dirent)->d_name))#else#   define dirent direct#   define NLENGTH(dirent) ((dirent)->d_namlen)#   ifdef HAVE_SYS_NDIR_H#       include <sys/ndir.h>#   endif /* HAVE_SYS_NDIR_H */#   ifdef HAVE_SYS_DIR_H#       include <sys/dir.h>#   endif /* HAVE_SYS_DIR_H */#   ifdef HAVE_NDIR_H#       include <ndir.h>#   endif /* HAVE_NDIR_H */#endif /* not (HAVE_DIRENT_H or _POSIX_VERSION) */#   ifndef _#      define _(x) x#      define N_(x) x#   endif#include "vfs/vfs.h"#    define CDisplay gdk_display#    define CRoot gdk_root_parent#    define Window GtkEdit *#endif#define SEARCH_DIALOG_OPTION_NO_SCANF	1#define SEARCH_DIALOG_OPTION_NO_REGEX	2#define SEARCH_DIALOG_OPTION_NO_CASE	4#define SEARCH_DIALOG_OPTION_BACKWARDS	8#define SEARCH_DIALOG_OPTION_BOOKMARK	16#define SYNTAX_FILE "/.cedit/Syntax"#define CLIP_FILE "/.cedit/cooledit.clip"#define MACRO_FILE "/.cedit/cooledit.macros"#define PARMESS_FILE "/.cedit/no_para_highlight_mess"#define BLOCK_FILE "/.cedit/cooledit.block"#define ERROR_FILE "/.cedit/cooledit.error"#define TEMP_FILE "/.cedit/cooledit.temp"#define SCRIPT_FILE "/.cedit/cooledit.script"#define EDIT_DIR "/.cedit"#define EDIT_KEY_EMULATION_NORMAL 0#define EDIT_KEY_EMULATION_EMACS  1#define REDRAW_LINE          (1 << 0)#define REDRAW_LINE_ABOVE    (1 << 1)#define REDRAW_LINE_BELOW    (1 << 2)#define REDRAW_AFTER_CURSOR  (1 << 3)#define REDRAW_BEFORE_CURSOR (1 << 4)#define REDRAW_PAGE          (1 << 5)#define REDRAW_IN_BOUNDS     (1 << 6)#define REDRAW_CHAR_ONLY     (1 << 7)#define REDRAW_COMPLETELY    (1 << 8)#define MOD_ABNORMAL		(1 << 0)#define MOD_UNDERLINED		(1 << 1)#define MOD_BOLD		(1 << 2)#define MOD_HIGHLIGHTED		(1 << 3)#define MOD_MARKED		(1 << 4)#define MOD_ITALIC		(1 << 5)#define MOD_CURSOR		(1 << 6)#define MOD_INVERSE		(1 << 7)#define MOD_TAB			(1 << 8)#define MOD_PIXMAP		(1 << 9)#define MOD_REVERSE		(1 << 10)#ifndef MIDNIGHT#    ifdef GTK#        define EDIT_TEXT_HORIZONTAL_OFFSET 0#        define EDIT_TEXT_VERTICAL_OFFSET 0#    else#        define EDIT_TEXT_HORIZONTAL_OFFSET 4#        define EDIT_TEXT_VERTICAL_OFFSET 3#    endif#else#    define EDIT_TEXT_HORIZONTAL_OFFSET 0#    define EDIT_TEXT_VERTICAL_OFFSET 1#    define FONT_OFFSET_X 0#    define FONT_OFFSET_Y 0#endif#define EDIT_RIGHT_EXTREME option_edit_right_extreme#define EDIT_LEFT_EXTREME option_edit_left_extreme#define EDIT_TOP_EXTREME option_edit_top_extreme#define EDIT_BOTTOM_EXTREME option_edit_bottom_extreme#define MAX_MACRO_LENGTH 1024/*there are a maximum of ... */#define MAXBUFF 1024/*... edit buffers, each of which is ... */#define EDIT_BUF_SIZE 0x10000/* ...bytes in size. *//*x / EDIT_BUF_SIZE equals x >> ... */#define S_EDIT_BUF_SIZE 16/* x % EDIT_BUF_SIZE is equal to x && ... */#define M_EDIT_BUF_SIZE 0xFFFF#define SIZE_LIMIT (EDIT_BUF_SIZE * (MAXBUFF - 2))/* Note a 16k stack is 64k of data and enough to hold (usually) around 10   pages of undo info. *//* undo stack */#define START_STACK_SIZE 32/*some codes that may be pushed onto or returned from the undo stack: */#define CURS_LEFT 601#define CURS_RIGHT 602#define DELETE 603#define BACKSPACE 604#define STACK_BOTTOM 605#define CURS_LEFT_LOTS 606#define CURS_RIGHT_LOTS 607#define COLUMN_ON 608#define COLUMN_OFF 609#define MARK_1 1000#define MARK_2 700000000#define KEY_PRESS 1400000000/*Tabs spaces: (sofar only HALF_TAB_SIZE is used: */#define TAB_SIZE		option_tab_spacing#define HALF_TAB_SIZE		((int) option_tab_spacing / 2)struct macro {    int command;    long ch;};/* this must be the same as struct edit_selection from rxvtlib.h */struct selection {   unsigned char * text;   int len;};struct mb_rule {    long ch;    char end;#ifdef HAVE_WCHAR_H    mbstate_t shift_state;#else    long shift_state;#endif};struct _mb_marker {    long offset;    struct mb_rule rule;    struct _mb_marker *next;};#define wc_isgraph(c) (isgraph(c & 0xFF) && (unsigned long) c < 0x100UL)#define wc_isprint(c) (isprint(c & 0xFF) && (unsigned long) c < 0x100UL)#define wc_isspace(c) (isspace(c & 0xFF) && (unsigned long) c < 0x100UL)struct syntax_rule {    unsigned short keyword;    unsigned char end;    unsigned char context;    unsigned char _context;#define RULE_ON_LEFT_BORDER 1#define RULE_ON_RIGHT_BORDER 2    unsigned char border;};#define MAX_WORDS_PER_CONTEXT	1024#define MAX_CONTEXTS		128struct key_word {    char *keyword;    unsigned char first;    char *whole_word_chars_left;    char *whole_word_chars_right;    time_t time;#define NO_COLOR 0x7FFFFFFF#define SPELLING_ERROR 0x7EFEFEFE    int line_start;    int bg;    int fg;};struct context_rule {    char *left;    unsigned char first_left;    char *right;    unsigned char first_right;    char line_start_left;    char line_start_right;    int single_char;    int between_delimiters;    char *whole_word_chars_left;    char *whole_word_chars_right;    char *keyword_first_chars;    int spelling;/* first word is word[1] */    struct key_word **keyword;};struct _syntax_marker {    long offset;    struct syntax_rule rule;    struct _syntax_marker *next;};struct _book_mark {    int line;		/* line number */#if 0#define BOOK_MARK_COLOR ((0 << 8) | 26)		/* black on white */#endif#define BOOK_MARK_COLOR ((25 << 8) | 5)#define BOOK_MARK_FOUND_COLOR ((26 << 8) | 4)    int c;		/* colour */    struct _book_mark *next;    struct _book_mark *prev;};struct editor_widget {#ifdef MIDNIGHT    Widget widget;#elif defined(GTK)    GtkEdit *widget;#else    struct cool_widget *widget;#endif#define from_here num_widget_lines    int num_widget_lines;    int num_widget_columns;#ifdef MIDNIGHT    int have_frame;#else    int stopped;#endif    char *filename;		/* Name of the file */    char *dir;			/* current directory *//* dynamic buffers and cursor position for editor: */    long curs1;			/*position of the cursor from the beginning of the file. */    long curs2;			/*position from the end of the file */    unsigned char *buffers1[MAXBUFF + 1];	/*all data up to curs1 */    unsigned char *buffers2[MAXBUFF + 1];	/*all data from end of file down to curs2 *//* search variables */    long search_start;		/* First character to start searching from */    int found_len;		/* Length of found string or 0 if none was found */    long found_start;		/* the found word from a search - start position *//* display information */    long last_byte;		/* Last byte of file */    long start_display;		/* First char displayed */    long start_col;		/* First displayed column, negative */    long max_column;		/* The maximum cursor position ever reached used to calc hori scroll bar */    long curs_row;		/*row position of cursor on the screen */    long curs_col;		/*column position on screen */    int force;			/* how much of the screen do we redraw? */    unsigned char overwrite;    unsigned char modified;	/*has the file been changed?: 1 if char inserted or				   deleted at all since last load or save */    unsigned char screen_modified;	/* has the file been changed since the last screen draw? */#if defined(MIDNIGHT) || defined(GTK)    int delete_file;			/* has the file been created in edit_load_file? Delete			           it at end of editing when it hasn't been modified 				   or saved */#endif				       unsigned char highlight;    long prev_col;		/*recent column position of the cursor - used when moving				   up or down past lines that are shorter than the current line */    long curs_line;		/*line number of the cursor. */    long start_line;		/*line nummber of the top of the page *//* file info */    long total_lines;		/*total lines in the file */    long mark1;			/*position of highlight start */    long mark2;			/*position of highlight end */    int column1;			/*position of column highlight start */    int column2;			/*position of column highlight end */    long bracket;		/*position of a matching bracket *//* cache speedup for line lookups */#define N_LINE_CACHES	32    int caches_valid;    int line_numbers[N_LINE_CACHES];    long line_offsets[N_LINE_CACHES];    struct _book_mark *book_mark;/* undo stack and pointers */    unsigned long stack_pointer;    long *undo_stack;    unsigned long stack_size;    unsigned long stack_size_mask;    unsigned long stack_bottom;    struct stat stat;/* syntax higlighting */    struct _syntax_marker *syntax_marker;    struct context_rule **rules;    long last_get_rule;    struct syntax_rule rule;    int syntax_invalidate;    char *syntax_type;		/* description of syntax highlighting type being used */    int explicit_syntax;	/* have we forced the syntax hi. type in spite of the filename? */    struct _mb_marker *mb_marker;    long last_get_mb_rule;    struct mb_rule mb_rule;    int mb_invalidate;    struct shell_job {	char *name;	pid_t pid;	int in, out, close_on_error;	struct shell_job *next;    } *jobs;    int to_here;		/* dummy marker *//* macro stuff */    int macro_i;		/* -1 if not recording index to macro[] otherwise */    struct macro macro[MAX_MACRO_LENGTH];};typedef struct editor_widget WEdit;#ifndef MIDNIGHT

⌨️ 快捷键说明

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