📄 nedit.h
字号:
/* $Id: nedit.h,v 1.39.2.1 2003/08/13 23:34:39 slobasso Exp $ */#ifndef NEDIT_NEDIT_H_INCLUDED#define NEDIT_NEDIT_H_INCLUDED/******************************************************************************** ** nedit.h -- Nirvana Editor common include file ** ********************************************************************************/#include "textBuf.h"#include <X11/Intrinsic.h>#include <Xm/Xm.h>#include <Xm/XmStrDefs.h>#ifdef VMS#include "../util/VMSparam.h"#else#ifndef __MVS__#include <sys/param.h>#endif#endif /*VMS*//* Some default colors */#define NEDIT_DEFAULT_FG "black"#define NEDIT_DEFAULT_TEXT_BG "rgb:e5/e5/e5"#define NEDIT_DEFAULT_SEL_FG "black"#define NEDIT_DEFAULT_SEL_BG "rgb:cc/cc/cc"#define NEDIT_DEFAULT_HI_FG "white" /* These are colors for flashing */#define NEDIT_DEFAULT_HI_BG "red" /* matching parens. */#define NEDIT_DEFAULT_LINENO_FG "black"#define NEDIT_DEFAULT_CURSOR_FG "black"#define NEDIT_DEFAULT_HELP_FG "black"#define NEDIT_DEFAULT_HELP_BG "rgb:cc/cc/cc"/* Tuning parameters */#define SEARCHMAX 511 /* Maximum length of search/replace strings */#define MAX_SEARCH_HISTORY 100 /* Maximum length of search string history */#define MAX_PANES 6 /* Max # of ADDITIONAL text editing panes that can be added to a window */#ifndef VMS#define AUTOSAVE_CHAR_LIMIT 30 /* number of characters user can type before NEdit generates a new backup file */#else#define AUTOSAVE_CHAR_LIMIT 80 /* set higher on VMS becaus saving is slower */#endif /*VMS*/#define AUTOSAVE_OP_LIMIT 8 /* number of distinct editing operations user can do before NEdit gens. new backup file */#define MAX_FONT_LEN 100 /* maximum length for a font name */#define MAX_COLOR_LEN 30 /* maximum length for a color name */#define MAX_MARKS 36 /* max. # of bookmarks (one per letter & #) */#define MIN_LINE_NUM_COLS 4 /* Min. # of columns in line number display */#define APP_NAME "nedit" /* application name for loading resources */#define APP_CLASS "NEdit" /* application class for loading resources */#ifdef SGI_CUSTOM#define SGI_WINDOW_TITLE "nedit: " /* part of window title string for sgi */#define SGI_WINDOW_TITLE_LEN 7 /* length of SGI_WINDOW_TITLE */#endif/* The accumulated list of undo operations can potentially consume huge amounts of memory. These tuning parameters determine how much undo infor- mation is retained. Normally, the list is kept between UNDO_OP_LIMIT and UNDO_OP_TRIMTO in length (when the list reaches UNDO_OP_LIMIT, it is trimmed to UNDO_OP_TRIMTO then allowed to grow back to UNDO_OP_LIMIT). When there are very large amounts of saved text held in the list, UNDO_WORRY_LIMIT and UNDO_PURGE_LIMIT take over and cause the list to be trimmed back further to keep its size down. */#define UNDO_PURGE_LIMIT 15000000 /* If undo list gets this large (in bytes), trim it to length of UNDO_PURGE_TRIMTO */#define UNDO_PURGE_TRIMTO 1 /* Amount to trim the undo list in a purge */#define UNDO_WORRY_LIMIT 2000000 /* If undo list gets this large (in bytes), trim it to length of UNDO_WORRY_TRIMTO */#define UNDO_WORRY_TRIMTO 5 /* Amount to trim the undo list when memory use begins to get serious */#define UNDO_OP_LIMIT 400 /* normal limit for length of undo list */#define UNDO_OP_TRIMTO 200 /* size undo list is normally trimmed to when it exceeds UNDO_OP_TRIMTO in length */#ifdef SGI_CUSTOM#define MAX_SHORTENED_ITEMS 80 /* max. number of items excluded in short- */#endif /* menus mode */enum indentStyle {NO_AUTO_INDENT, AUTO_INDENT, SMART_INDENT};enum wrapStyle {NO_WRAP, NEWLINE_WRAP, CONTINUOUS_WRAP};enum showMatchingStyle {NO_FLASH, FLASH_DELIMIT, FLASH_RANGE};enum virtKeyOverride { VIRT_KEY_OVERRIDE_NEVER, VIRT_KEY_OVERRIDE_AUTO, VIRT_KEY_OVERRIDE_ALWAYS };#define NO_FLASH_STRING "off"#define FLASH_DELIMIT_STRING "delimiter"#define FLASH_RANGE_STRING "range"#define CHARSET (XmStringCharSet)XmSTRING_DEFAULT_CHARSET#define MKSTRING(string) \ XmStringCreateLtoR(string, XmSTRING_DEFAULT_CHARSET) #define SET_ONE_RSRC(widget, name, newValue) \{ \ static Arg args[1] = {{name, (XtArgVal)0}}; \ args[0].value = (XtArgVal)newValue; \ XtSetValues(widget, args, 1); \} #define GET_ONE_RSRC(widget, name, valueAddr) \{ \ static Arg args[1] = {{name, (XtArgVal)0}}; \ args[0].value = (XtArgVal)valueAddr; \ XtGetValues(widget, args, 1); \}/* This handles all the different reasons files can be locked */#define USER_LOCKED_BIT 0#define PERM_LOCKED_BIT 1#define TOO_MUCH_BINARY_DATA_LOCKED_BIT 2#define LOCKED_BIT_TO_MASK(bitNum) (1 << (bitNum))#define SET_LOCKED_BY_REASON(reasons, onOrOff, reasonBit) ((onOrOff) ? \ ((reasons) |= LOCKED_BIT_TO_MASK(reasonBit)) : \ ((reasons) &= ~LOCKED_BIT_TO_MASK(reasonBit)))#define IS_USER_LOCKED(reasons) (((reasons) & LOCKED_BIT_TO_MASK(USER_LOCKED_BIT)) != 0)#define SET_USER_LOCKED(reasons, onOrOff) SET_LOCKED_BY_REASON(reasons, onOrOff, USER_LOCKED_BIT)#define IS_PERM_LOCKED(reasons) (((reasons) & LOCKED_BIT_TO_MASK(PERM_LOCKED_BIT)) != 0)#define SET_PERM_LOCKED(reasons, onOrOff) SET_LOCKED_BY_REASON(reasons, onOrOff, PERM_LOCKED_BIT)#define IS_TMBD_LOCKED(reasons) (((reasons) & LOCKED_BIT_TO_MASK(TOO_MUCH_BINARY_DATA_LOCKED_BIT)) != 0)#define SET_TMBD_LOCKED(reasons, onOrOff) SET_LOCKED_BY_REASON(reasons, onOrOff, TOO_MUCH_BINARY_DATA_LOCKED_BIT)#define IS_ANY_LOCKED_IGNORING_USER(reasons) (((reasons) & ~LOCKED_BIT_TO_MASK(USER_LOCKED_BIT)) != 0)#define IS_ANY_LOCKED_IGNORING_PERM(reasons) (((reasons) & ~LOCKED_BIT_TO_MASK(PERM_LOCKED_BIT)) != 0)#define IS_ANY_LOCKED(reasons) ((reasons) != 0)#define CLEAR_ALL_LOCKS(reasons) ((reasons) = 0)/* determine a safe size for a string to hold an integer-like number contained in xType */#define TYPE_INT_STR_SIZE(xType) ((sizeof(xType) * 3) + 2)/* Record on undo list */typedef struct _UndoInfo { struct _UndoInfo *next; /* pointer to the next undo record */ int type; int startPos; int endPos; int oldLen; char *oldText; char inUndo; /* flag to indicate undo command on this record in progress. Redirects SaveUndoInfo to save the next mod- ifications on the redo list instead of the undo list. */ char restoresToSaved; /* flag to indicate undoing this operation will restore file to last saved (unmodified) state */} UndoInfo;/* Element in bookmark table */typedef struct { char label; int cursorPos; selection sel;} Bookmark;/* Identifiers for the different colors that can be adjusted. */enum colorTypes { TEXT_FG_COLOR, TEXT_BG_COLOR, SELECT_FG_COLOR, SELECT_BG_COLOR, HILITE_FG_COLOR, HILITE_BG_COLOR, LINENO_FG_COLOR, CURSOR_FG_COLOR, NUM_COLORS};typedef struct _WindowInfo { struct _WindowInfo *next; Widget shell; /* application shell of window */ Widget splitPane; /* paned win. for splitting text area */ Widget textArea; /* the first text editing area widget */ Widget textPanes[MAX_PANES]; /* additional ones created on demand */ Widget lastFocus; /* the last pane to have kbd. focus */ Widget statsLine; /* file stats information display */ Widget statsLineForm; Widget statsLineColNo; /* Line/Column information display */ Widget iSearchForm; /* incremental search line widgets */ Widget iSearchText; Widget iSearchRegexToggle; Widget iSearchCaseToggle; Widget iSearchRevToggle; Widget menuBar; /* the main menu bar */ Widget replaceDlog; /* replace dialog */ Widget replaceText; /* replace dialog settable widgets... */ Widget replaceWithText; Widget replaceCaseToggle; Widget replaceWordToggle; Widget replaceRegexToggle; Widget replaceRevToggle; Widget replaceKeepBtn; Widget replaceBtns; Widget replaceBtn; Widget replaceAllBtn;#ifndef REPLACE_SCOPE Widget replaceInWinBtn; Widget replaceInSelBtn;#endif Widget replaceSearchTypeBox; Widget replaceFindBtn; Widget replaceAndFindBtn; Widget findDlog; /* find dialog */ Widget findText; /* find dialog settable widgets... */ Widget findCaseToggle; Widget findWordToggle; Widget findRegexToggle; Widget findRevToggle; Widget findKeepBtn; Widget findBtns; Widget findBtn; Widget findSearchTypeBox; Widget replaceMultiFileDlog; /* Replace in multiple files */ Widget replaceMultiFileList;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -