📄 ext.h
字号:
/*** ext.h - extension definitions
*
* Copyright <C> 1988-1990, Microsoft Corporation
*
*
*************************************************************************/
//************************************************************************
//
// Macro Definitions
//
// Common Definitions
//
#include <stddef.h> // get definition of NULL
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
//
// PNULL - NULL PFILE
//
#define PNULL ((PFILE) NULL)
//
// BUFLEN is the maximum line length that can be passed or will be returned
// by the editor. MAX_PATH is the maximum path length supported.
//
#define BUFLEN 251
#define MAX_PATH 200
//
// EXPORT defines the attributes required for extension functions. _loadds
// is used such that extensions can be compiled /Aw as well as /Au.
//
#define EXPORT _loadds far
#define EXTERNAL _loadds far
//
// PWBFUNC defines the return value and characteristics of extension defined
// editing functions.
//
#define PWBFUNC flagType pascal _loadds far
//
// RQ_... are various request types supported for Get/Set EditorObject
//
#define RQ_FILE 0x1000 // GetEditorObject: File request
#define RQ_FILE_HANDLE 0x1000 // File Handle
#define RQ_FILE_NAME 0x1100 // ASCIIZ filename
#define RQ_FILE_FLAGS 0x1200 // flags
#define RQ_FILE_REFCNT 0x1300 // reference count
#define RQ_FILE_FREEZE 0x1400 // freeze count
#define RQ_WIN 0x2000 // Window request
#define RQ_WIN_HANDLE 0x2000 // Window Handle
#define RQ_WIN_CONTENTS 0x2100 // Window Contents
#define RQ_WIN_CUR 0x2200 // Current Window
#define RQ_WIN_MAXED 0x2300 // Zoomed flag
#define RQ_MISC 0x3000 // Misc requests
#define RQ_SCREENSIZE 0x3100 // screen size
#define RQ_SEARCHINFO 0x3200 // search state information
#define RQ_COLOR 0x9000 // Color request
#define RQ_NAME 0xd000 // editor name
#define RQ_TOOLSINI 0xe000 // tools.ini PFILE
#define RQ_CLIP 0xf000 // clipboard type
//
// toPif is used when placing numeric or boolean switches in the swiDesc
// table to eliminate C 5.X compiler warnings.
//
// For example: { "Switchname", toPIF(switchvar), SWI_BOOLEAN },
//
#define toPIF(x) (PIF)(long)(void far *)&x
//
// Editor color table indicies. (Colors USERCOLORMIN - USERCOLORMAX are
// unassigned and available for extension use).
//
#define Background 0 // all backgrounds (unused in PWB)
#define Hilite 1 // Hilited items
#define Greyed 2 // greyed items
#define Enabled 3 // enabled items
#define Disabled 4 // disabled items
#define Alert 5 // for MessageBox alerts
#define DialogBox 6 // background for dialogs
#define PushButton 7 // push button color
#define ButtonDown 8 // pushed button color
#define ListBox 9 // listbox background
#define Scrollbar 10 // scroll bar Background & arrows
#define Elevator 11 // scroll bar elevator
#define MenuBox 12 // background for menus
#define Menu 13 // menu bar color
#define MenuSelected 14 // Selected menus
#define MenuHilite 15 // for single character
#define MenuHiliteSel 16 // for single character (under selection)
#define ItemHiliteSel 17 // for single character (under selection)
#define DialogAccel 18 // dialog accelerators
#define DialogAccelBor 19 // dialog accelerator border
#define Shadow 20 // shadows
#define FGCOLOR 21 // foreground (normal) color
#define HGCOLOR 22 // highlighted region color
#define INFCOLOR 23 // information color
#define SELCOLOR 24 // selection color
#define WDCOLOR 25 // window border color
#define STACOLOR 26 // status line color
// 27 // internal: used by PWB
#define USERCOLORMIN 28 // begining of extension colors
#define USERCOLORMAX 35 // end of extension colors
//
// Attributes for ForFile
//
#define FORFILE_RO 1 // read only
#define FORFILE_H 2 // hidden
#define FORFILE_S 4 // system
#define FORFILE_V 8 // volume id
#define FORFILE_D 16 // directory
#define FORFILE_A 32 // archive
#define FORFILE_MOD (FORFILE_RO|FORFILE_H|FORFILE_S|FORFILE_A) // changeable attributes
#define FORFILE_ALL (FORFILE_RO|FORFILE_H|FORFILE_S|FORFILE_V|FORFILE_D|FORFILE_A)
//
// Menu ID's
#define MID_FILE 0x0000
#define MID_NEW (MID_FILE + 1)
#define MID_OPEN (MID_FILE + 2)
#define MID_MERGE (MID_FILE + 3)
#define MID_NEXT (MID_FILE + 4)
#define MID_SAVE (MID_FILE + 5)
#define MID_SAVEAS (MID_FILE + 6)
#define MID_SAVEALL (MID_FILE + 7)
#define MID_FCLOSE (MID_FILE + 8)
#define MID_PRINT (MID_FILE + 10)
#define MID_SHELL (MID_FILE + 11)
#define MID_EXIT (MID_FILE + 13)
#define MID_FILE1 (MID_FILE + 0x80 + 0)
#define MID_FILE2 (MID_FILE + 0x80 + 1)
#define MID_FILE3 (MID_FILE + 0x80 + 2)
#define MID_FILE4 (MID_FILE + 0x80 + 3)
#define MID_FILE5 (MID_FILE + 0x80 + 4)
#define MID_FILE6 (MID_FILE + 0x80 + 5)
#define MID_MORE (MID_FILE + 0x80 + 6)
#define MID_EDIT 0x0100
#define MID_UNDO (MID_EDIT + 1)
#define MID_REDO (MID_EDIT + 2)
#define MID_REPEAT (MID_EDIT + 3)
#define MID_CUT (MID_EDIT + 5)
#define MID_COPY (MID_EDIT + 6)
#define MID_PASTE (MID_EDIT + 7)
#define MID_CLEAR (MID_EDIT + 8)
#define MID_DROPANCHOR (MID_EDIT + 10)
#define MID_ANCHOR (MID_EDIT + 11)
#define MID_BOXMODE (MID_EDIT + 13)
#define MID_READONLY (MID_EDIT + 14)
#define MID_SETREC (MID_EDIT + 16)
#define MID_RECORD (MID_EDIT + 17)
#define MID_EDITMACROS (MID_EDIT + 18)
#define MID_VIEW 0x0200
#define MID_SPLITH (MID_VIEW + 1)
#define MID_SPLITV (MID_VIEW + 2)
#define MID_SIZE (MID_VIEW + 3)
#define MID_MAXIMIZE (MID_VIEW + 4)
#define MID_CLOSE (MID_VIEW + 5)
#define MID_ERRWIN (MID_VIEW + 7)
#define MID_SEARCH 0x0300
#define MID_FIND (MID_SEARCH + 1)
#define MID_FINDSEL (MID_SEARCH + 2)
#define MID_FINDLAST (MID_SEARCH + 3)
#define MID_REPLACE (MID_SEARCH + 4)
#define MID_FINDFILE (MID_SEARCH + 5)
#define MID_NEXTERR (MID_SEARCH + 7)
#define MID_PREVERR (MID_SEARCH + 8)
#define MID_SETERR (MID_SEARCH + 9)
#define MID_GOTOMARK (MID_SEARCH + 11)
#define MID_DEFMARK (MID_SEARCH + 12)
#define MID_SETMARK (MID_SEARCH + 13)
#define MID_MAKE 0x0400
#define MID_COMPILE (MID_MAKE + 1)
#define MID_BUILD (MID_MAKE + 2)
#define MID_REBUILD (MID_MAKE + 3)
#define MID_TARGET (MID_MAKE + 4)
#define MID_SETLIST (MID_MAKE + 6)
#define MID_EDITLIST (MID_MAKE + 7)
#define MID_CLEARLIST (MID_MAKE + 8)
#define MID_RUN 0x0500
#define MID_EXECUTE (MID_RUN + 1)
#define MID_CMDLINE (MID_RUN + 2)
#define MID_DEBUG (MID_RUN + 3)
#define MID_RUNAPP (MID_RUN + 5)
#define MID_CUSTOM (MID_RUN + 6)
#define MID_USER1 (MID_RUN + 0x80 + 0)
#define MID_USER2 (MID_RUN + 0x80 + 1)
#define MID_USER3 (MID_RUN + 0x80 + 2)
#define MID_USER4 (MID_RUN + 0x80 + 3)
#define MID_USER5 (MID_RUN + 0x80 + 4)
#define MID_USER6 (MID_RUN + 0x80 + 5)
#define MID_OPTIONS 0x0600
#define MID_ENVIRONMENT (MID_OPTIONS + 1)
#define MID_ASSIGNKEY (MID_OPTIONS + 2)
#define MID_SETSWITCH (MID_OPTIONS + 3)
#define MID_BUILDOPTIONS (MID_OPTIONS + 5)
#define MID_EXTENSION 0x700
//************************************************************************
//
// General type Definitions
//
typedef char flagType; // Boolean value
typedef int COL; // column or position with line
typedef long LINE; // line number within file
typedef unsigned PFILE; // editor file handle
#ifndef EXTINT
typedef unsigned PWND; // editor window handle
#endif
typedef char buffer[BUFLEN]; // miscellaneous buffer
typedef char linebuf[BUFLEN]; // line buffer
typedef char pathbuf[BUFLEN]; // Pathname buffer
typedef struct { // file location
LINE lin; // - line number
COL col; // - column
} fl;
typedef struct { // screen location
int lin; // - line number
int col; // - column
} sl;
typedef struct { // file range
fl flFirst; // - Lower line, or leftmost col
fl flLast; // - Higher, or rightmost
} rn;
typedef struct lineAttr { // Line color attribute info
unsigned char attr; // - Attribute of piece
unsigned char len; // - Bytes in colored piece
} la;
typedef unsigned char BYTE;
typedef struct _arc
{
BYTE axLeft;
BYTE ayTop;
BYTE axRight;
BYTE ayBottom;
} ARC;
//************************************************************************
//
// Argument definition structures.
//
// We define a structure for each of the argument types that may be passed
// to an extension function. Then, we define the structure argType which is
// used to pass these arguments around in a union.
//
struct noargType { // no argument specified
LINE y; // - cursor line
COL x; // - cursor column
};
struct textargType { // text argument specified
int cArg; // - count of <arg>s pressed
LINE y; // - cursor line
COL x; // - cursor column
char far *pText; // - ptr to text of arg
};
struct nullargType { // null argument specified
int cArg; // - count of <arg>s pressed
LINE y; // - cursor line
COL x; // - cursor column
};
struct lineargType { // line argument specified
int cArg; // - count of <arg>s pressed
LINE yStart; // - starting line of range
LINE yEnd; // - ending line of range
};
struct streamargType { // stream argument specified
int cArg; // - count of <arg>s pressed
LINE yStart; // - starting line of region
COL xStart; // - starting column of region
LINE yEnd; // - ending line of region
COL xEnd; // - ending column of region
};
struct boxargType { // box argument specified
int cArg; // - count of <arg>s pressed
LINE yTop; // - top line of box
LINE yBottom; // - bottom line of bix
COL xLeft; // - left column of box
COL xRight; // - right column of box
};
struct argType {
int argType;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -