//	Base on RAEdit.Inc dated 17-8-2003

//Default colors
#define DEFBCKCOLOR				00FFFFFFh
#define DEFTXTCOLOR				00000000h
#define DEFSELBCKCOLOR			00800000h
#define DEFSELTXTCOLOR			00FFFFFFh
#define DEFCMNTCOLOR			02008000h
#define DEFSTRCOLOR				00A00000h
#define DEFOPRCOLOR				000000A0h
#define DEFHILITE1				00F0C0C0h
#define DEFHILITE2				00C0F0C0h
#define DEFHILITE3				00C0C0F0h
#define DEFSELBARCOLOR			00C0C0C0h
#define DEFSELBARPEN			00808080h
#define DEFLNRCOLOR				00800000h

//Window styles
#define STYLE_NOSPLITT			001h			//No splitt button
#define STYLE_NOLINENUMBER		002h			//No linenumber button
#define STYLE_NOCOLLAPSE		004h			//No expand/collapse buttons
#define STYLE_NOHSCROLL			008h			//No horizontal scrollbar
#define STYLE_NOVSCROLL			010h			//No vertical scrollbar
#define STYLE_NOHILITE			020h			//No color hiliting
#define STYLE_NOSIZEGRIP		040h			//No size grip
#define STYLE_NODBLCLICK		080h			//No action on double clicks
#define STYLE_READONLY			100h			//Text is locked
#define STYLE_NODIVIDERLINE		200h			//Blocks are not divided by line
#define STYLE_NOBACKBUFFER		400h			//Drawing directly to screen DC
#define STYLE_NOSTATE			800h			//No state indicator

//Private edit messages
#define REM_RAINIT				WM_USER+9999	//wParam=0, lParam=pointer to controls DIALOG struct
#define REM_BASE				WM_USER+1000
#define REM_SETHILITEWORDS		REM_BASE+0		//wParam=Color, lParam=lpszWords
#define REM_SETFONT				REM_BASE+1		//wParam=nLineSpacing, lParam=lpRAFONT
#define REM_GETFONT				REM_BASE+2		//wParam=0, lParam=lpRAFONT
#define REM_SETCOLOR			REM_BASE+3		//wParam=0, lParam=lpRACOLOR
#define REM_GETCOLOR			REM_BASE+4		//wParam=0, lParam=lpRACOLOR
#define REM_SETHILITELINE		REM_BASE+5		//wParam=Line, lParam=Color
#define REM_GETHILITELINE		REM_BASE+6		//wParam=Line, lParam=0
#define REM_SETBOOKMARK			REM_BASE+7		//wParam=Line, lParam=Type
#define REM_GETBOOKMARK			REM_BASE+8		//wParam=Line, lParam=0
#define REM_CLRBOOKMARKS		REM_BASE+9		//wParam=0, lParam=Type
#define REM_NXTBOOKMARK			REM_BASE+10		//wParam=Line, lParam=Type
#define REM_PRVBOOKMARK			REM_BASE+11		//wParam=Line, lParam=Type
#define REM_FINDBOOKMARK		REM_BASE+12		//wParam=BmID, lParam=0
#define REM_SETBLOCKS			REM_BASE+13		//wParam=[lpLINERANGE], lParam=lpRABLOCKDEF
#define REM_ISLINE				REM_BASE+14		//wParam=Line, lParam=lpszDef
#define REM_GETWORD				REM_BASE+15		//wParam=BuffSize, lParam=lpBuff
#define REM_COLLAPSE			REM_BASE+16		//wParam=Line, lParam=lpRABLOCKDEF
#define REM_COLLAPSEALL			REM_BASE+17		//wParam=0, lParam=lpRABLOCKDEF
#define REM_EXPAND				REM_BASE+18		//wParam=Line, lParam=0
#define REM_EXPANDALL			REM_BASE+19		//wParam=0, lParam=0
#define REM_LOCKLINE			REM_BASE+20		//wParam=Line, lParam=TRUE/FALSE
#define REM_ISLINELOCKED		REM_BASE+21		//wParam=Line, lParam=0
#define REM_HIDELINE			REM_BASE+22		//wParam=Line, lParam=TRUE/FALSE
#define REM_ISLINEHIDDEN		REM_BASE+23		//wParam=Line, lParam=0
#define REM_AUTOINDENT			REM_BASE+24		//wParam=0, lParam=TRUE/FALSE
#define REM_TABWIDTH			REM_BASE+25		//wParam=nChars, lParam=TRUE/FALSE (Expand tabs)
#define REM_SELBARWIDTH			REM_BASE+26		//wParam=nWidth, lParam=0
#define REM_LINENUMBERWIDTH		REM_BASE+27		//wParam=nWidth, lParam=0
#define REM_MOUSEWHEEL			REM_BASE+28		//wParam=nLines, lParam=0
#define REM_SUBCLASS			REM_BASE+29		//wParam=0, lParam=lpWndProc
#define REM_SETSPLIT			REM_BASE+30		//wParam=nSplit, lParam=0
#define REM_GETSPLIT			REM_BASE+31		//wParam=0, lParam=0
#define REM_VCENTER				REM_BASE+32		//wParam=0, lParam=0
#define REM_REPAINT				REM_BASE+33		//wParam=0, lParam=TRUE/FALSE (Paint Now)
#define REM_BMCALLBACK			REM_BASE+34		//wParam=0, lParam=lpBmProc
#define REM_READONLY			REM_BASE+35		//wParam=0, lParam=TRUE/FALSE
#define REM_INVALIDATELINE		REM_BASE+36		//wParam=Line, lParam=0
#define REM_SETPAGESIZE			REM_BASE+37		//wParam=nLines, lParam=0
#define REM_GETPAGESIZE			REM_BASE+38		//wParam=0, lParam=0
#define REM_GETCHARTAB			REM_BASE+39		//wParam=nChar, lParam=0
#define REM_SETCHARTAB			REM_BASE+40		//wParam=nChar, lParam=nValue
#define REM_SETCOMMENTBLOCKS	REM_BASE+41		//wParam=lpStart, lParam=lpEnd
#define REM_SETWORDGROUP		REM_BASE+42		//wParam=0, lParam=nGroup (0-15)
#define REM_GETWORDGROUP		REM_BASE+43		//wParam=0, lParam=0
#define REM_SETBMID				REM_BASE+44		//wParam=nLine, lParam=nBmID
#define REM_GETBMID				REM_BASE+45		//wParam=nLine, lParam=0
#define REM_ISCHARPOS			REM_BASE+46		//wParam=CP, lParam=0, returns 1 if comment block, 2 if comment, 3 if string
#define REM_HIDELINES			REM_BASE+47		//wParam=nLine, lParam=nLines
#define REM_SETDIVIDERLINE		REM_BASE+48		//wParam=nLine, lParam=TRUE/FALSE
#define REM_ISINBLOCK			REM_BASE+49		//wParam=nLine, lParam=lpRABLOCKDEF
#define REM_TRIMSPACE			REM_BASE+50		//wParam=nLine, lParam=fLeft
#define REM_SAVESEL				REM_BASE+51		//wParam=0, lParam=0
#define REM_RESTORESEL			REM_BASE+52		//wParam=0, lParam=0
#define REM_GETCURSORWORD		REM_BASE+53		//wParam=BuffSize, lParam=lpBuff

//Line hiliting
#define STATE_HILITEOFF			0
#define STATE_HILITE1			1
#define STATE_HILITE2			2
#define STATE_HILITE3			3
#define STATE_HILITEMASK		3

//Bookmarks
#define STATE_BMOFF				00h
#define STATE_BM1				10h
#define STATE_BM2				20h
#define STATE_BM3				30h
#define STATE_BM4				40h
#define STATE_BM5				50h
#define STATE_BM6				60h
#define STATE_BM7				70h
#define STATE_BM8				80h
#define STATE_BMMASK			0F0h

//Line states
#define STATE_LOCKED			100h
#define STATE_HIDDEN			200h
#define STATE_COMMENT			400h
#define STATE_DIVIDERLINE		800h
#define STATE_GARBAGE			80000000h

//Character table types
#define CT_NONE					0
#define CT_CHAR					1
#define CT_OPER					2
#define CT_HICHAR				3
#define CT_CMNTCHAR				4
#define CT_STRING				5
#define CT_CMNTDBLCHAR			6

struct	RAFONT 
{
	dword	hFont;						//Code edit normal
	dword	hIFont;						//Code edit italics
	dword	hLnrFont;					//Line numbers
};

struct	RACOLOR 
{
	dword	bckcol;						//Back color
	dword	txtcol;						//Text color
	dword	selbckcol;					//Sel back color
	dword	seltxtcol;					//Sel text color
	dword	cmntcol;					//Comment color
	dword	strcol;						//String color
	dword	oprcol;						//Operator color
	dword	hicol1;						//Line hilite 1
	dword	hicol2;						//Line hilite 2
	dword	hicol3;						//Line hilite 3
	dword	selbarbck;					//Selection bar
	dword	selbarpen;					//Selection bar pen
	dword	lnrcol;						//Line numbers color
};

struct	RASELCHANGE 
{
	NMHDR	nmhdr;
	CHARRANGE	chrg;					//Current selection
	word	seltyp;						//SEL_TEXT or SEL_OBJECT
	dword	line;						//Line number
	dword	cpLine;						//Character position of first character
	dword	lpLine;						//Pointer to line
	dword	nlines;						//Total number of lines
	dword	nhidden;					//Total number of hidden lines
	dword	fchanged;					//TRUE if changed since last
	dword	npage;						//Page number
	dword	nWordGroup;					//Hilite word group
};

#define BD_NONESTING			1		//Set to true for non nested blocks
#define BD_DIVIDERLINE			2		//Draws a divider line
#define BD_INCLUDELAST			4		//lpszEnd line is also collapsed
#define BD_LOOKAHEAD			8		//Look 500 lines ahead for the ending

struct	RABLOCKDEF 
{
	dword	lpszStart;					//Block start
	dword	lpszEnd;					//Block end
	dword	lpszNot1;					//Dont hide line containing this or set to NULL
	dword	lpszNot2;					//Dont hide line containing this or set to NULL
	dword	flag;						//
};

struct	LINERANGE 
{
	dword	lnMin;						//Starting line
	dword	lnMax;						//Ending line
};

byte	szClassName = "RAEDIT";
