Initial Commit

This commit is contained in:
Armando Rivera 2023-01-13 01:26:52 -05:00
parent ba2e818c8b
commit 74f4c26714
17 changed files with 6691 additions and 0 deletions

285
Aide.bas Normal file
View File

@ -0,0 +1,285 @@
$ACCELERATOR ghAccTable
GUI "Color_Tab", PIXELS, ICON, 6666
$include "raedit.inc"
CONST fWidth = 900
CONST fHeight = 600
CONST nTabs = 20
GLOBAL ghMainFrm AS CONTROL
GLOBAL ghMainTab AS CONTROL
GLOBAL ghStatus AS CONTROL
GLOBAL ghTab[nTabs] AS HWND
GLOBAL ghEdit[nTabs] AS HWND
SET gTabPage$[nTabs]
"<Untitled.bas>"
END SET
ENUM
mnuNew = 9000
mnuOpen
mnuSave
mnuCut
mnuCopy
mnuPaste
mnuUNDO
mnuREDO
mnuSELECTALL
mnuAbout
mnuEXIT
ID_TAB
ID_EDIT1
END ENUM
'================================================================
SUB FORMLOAD()
IF FINDFIRSTINSTANCE(BCX_CLASSNAME$) THEN PostQuitMessage(0)
SET sAccel[] AS ACCEL
FCONTROL OR FVIRTKEY, ASC("N"), mnuNew,
FCONTROL OR FVIRTKEY, ASC("O"), mnuOpen,
FCONTROL OR FVIRTKEY, ASC("S"), mnuSave,
FCONTROL OR FVIRTKEY, ASC("Q"), mnuEXIT
END SET
GLOBAL AS HACCEL ghAccTable
ghAccTable = CreateAcceleratorTable(sAccel, 4)
InstallRAEdit(BCX_hInstance, FALSE)
ghMainFrm = BCX_FORM("AIDE Demo", 0, 0, fWidth, fHeight)
DIM rc AS RECT
GetClientRect (ghMainFrm, &rc)
AdjustWindowRect (&rc, 0, 0)
ghMainTab = BCX_TAB(ghMainFrm, ID_TAB, 1, ghTab, gTabPage$, 0, 0, fWidth, fHeight-26,NULL)
BCX_SET_FONT(ghMainTab, "Verdana", 9)
ghEdit[0] = BCX_CONTROL("RAEdit", ghTab[0], "This is Page ", 6000, rc.left,rc.top,rc.right-rc.left-8,rc.bottom-rc.top-46, _
WS_CHILD OR WS_VISIBLE OR WS_BORDER OR ES_LEFT OR ES_MULTILINE OR STYLE_AUTOSIZELINENUM OR STYLE_NOLINENUMBER OR STYLE_DRAGDROP)
RaConfigEditor(ghEdit[0])
SetupMenu(ghMainFrm)
ghStatus = BCX_STATUS("Ready", ghMainFrm)
'Generate a WM_SIZE message
MoveWindow(ghMainFrm, 0, 0, fWidth, fHeight, TRUE) 'Force a WM_SIZE
CENTER(ghMainFrm)
SHOW(ghMainFrm)
' SetFocus(ghEdit[0])
END SUB
SUB SetupMenu(parent as HWND)
GLOBAL AS HMENU MainMenu, FileMenu, EditMenu, HelpMenu
MainMenu = CreateMenu()
FileMenu = CreateMenu()
EditMenu = CreateMenu()
HelpMenu = CreateMenu()
InsertMenu(MainMenu, 0, MF_POPUP, FileMenu, "&File")
AppendMenu(FileMenu, MF_STRING, mnuNew, E"New\tCtrl-N")
AppendMenu(FileMenu, MF_STRING, mnuOpen, E"Open\tCtrl-O")
AppendMenu(FileMenu, MF_STRING, mnuSave, E"Save\tCtrl-S")
AppendMenu(FileMenu, MF_SEPARATOR, 0, NULL)
AppendMenu(FileMenu, MF_STRING, mnuEXIT, E"Exit\tAlt-F4")
Insertmenu(MainMenu, 1, MF_POPUP, EditMenu, "&Edit")
AppendMenu(EditMenu, MF_STRING, mnuCut, E"Cut\tCtrl-X")
AppendMenu(EditMenu, MF_STRING, mnuCopy, E"Copy\tCtrl-C")
AppendMenu(EditMenu, MF_STRING, mnuPaste, E"Paste\tCtrl-V")
AppendMenu(EditMenu, MF_SEPARATOR, 0, NULL)
AppendMenu(EditMenu, MF_STRING, mnuSELECTALL, E"Select All\tCtrl-A")
AppendMenu(EditMenu, MF_SEPARATOR, 0, NULL)
AppendMenu(EditMenu, MF_STRING, mnuUNDO, E"Undo\tCtrl-Z")
AppendMenu(EditMenu, MF_STRING, mnuREDO, E"Redo\tCtrl-Y")
Insertmenu(MainMenu, 2, MF_POPUP, HelpMenu, "Help")
AppendMenu(HelpMenu, MF_STRING, mnuAbout, "About")
SetMenu(parent, MainMenu)
END SUB
FUNCTION GetTabLabelText$(index AS INTEGER)
DIM AS TCITEM tabItem
DIM tabLabel$
tabItem.mask = TCIF_TEXT
tabItem.pszText = tabLabel
tabItem.cchTextMax = sizeof(tabLabel)
TabCtrl_GetItem(ghMainTab, index, &tabItem)
FUNCTION = TRIM$(tabLabel)
END FUNCTION
SUB SetTabLabelText(fname$, index AS INTEGER)
DIM AS TCITEM tabItem
tabItem.mask=TCIF_TEXT
tabItem.pszText = BCXSPLITPATH$(fname$,FNAME OR FEXT)
tabItem.cchTextMax = BCXSTRSIZE
TabCtrl_SetItem(ghMainTab, index, &tabItem)
END SUB
'================================================================
BEGIN EVENTS
SELECT CASE CBMSG
CASE WM_SHOWWINDOW
' RaNewEdit()
CASE WM_COMMAND
SELECT CASE CBCTL
CASE mnuOpen
dim fname$
IF TRIM$(GetTabLabelText(TabCtrl_GetCurSel(ghMainTab))) <> "<Untitled.bas>" THEN
RaNewEdit()
END IF
fname$ = RaLoadFile(ghEdit[TabCtrl_GetCurSel(ghMainTab)])
IF *fname$ THEN
SetTabLabelText(fname$, TabCtrl_GetCurSel(ghMainTab))
END IF
CASE mnuNew
RaNewEdit()
CASE mnuCut
RaCut(ghEdit[TabCtrl_GetCurSel(ghMainTab)])
CASE mnuCopy
RaCopy(ghEdit[TabCtrl_GetCurSel(ghMainTab)])
CASE mnuPaste
RaPaste(ghEdit[TabCtrl_GetCurSel(ghMainTab)])
CASE mnuSELECTALL
RaSelectAll(ghEdit[TabCtrl_GetCurSel(ghMainTab)])
CASE mnuUNDO
RaUndo(ghEdit[TabCtrl_GetCurSel(ghMainTab)])
CASE mnuREDO
RaRedo(ghEdit[TabCtrl_GetCurSel(ghMainTab)])
CASE mnuEXIT
PostMessage(hWnd, WM_CLOSE, 0, 0)
END SELECT
CASE WM_SIZE
DIM cxClient%
DIM cyClient%
DIM rc AS RECT
cxClient=LOWORD(lParam)
cyClient=HIWORD(lParam)
MoveWindow(ghMainTab, 0, 2, cxClient+1, cyClient-22, TRUE)
GetClientRect (ghMainTab, &rc)
AdjustWindowRect (&rc, 0, 0)
FOR INTEGER i = 0 to sizeof(ghEdit)/sizeof(ghEdit[0])
IF ghEdit[i] THEN
SetWindowPos(ghEdit[i], NULL, rc.left, rc.top+2, (rc.right - rc.left)-8, (rc.bottom - rc.top)-24, SWP_NOZORDER OR SWP_NOMOVE )
END IF
NEXT
SendMessage(ghStatus, WM_SIZE, 0, 0)
CASE WM_NOTIFY
DIM LPNMHDR AS NMHDR*
DIM PageNo AS LONG
DIM bm, buff$
DIM AS RASELCHANGE PTR lpRASELCHANGE = (RASELCHANGE PTR)lParam
LPNMHDR = (NMHDR*)lParam
IF LPNMHDR->code >= TCN_LAST && LPNMHDR->code <= TCN_FIRST THEN
SELECT CASE LPNMHDR->code
CASE TCN_SELCHANGE
PageNo = TabCtrl_GetCurSel(ghMainTab)
SetFocus(ghEdit[PageNo])
END SELECT
END IF
IF LPNMHDR->hwndFrom = ghEdit[TabCtrl_GetCurSel(ghMainTab)] THEN
IF LPNMHDR->code = EN_SELCHANGE THEN
' Update statusbar
SPRINT buff,"Line:", lpRASELCHANGE->line+1, ", Column:", lpRASELCHANGE->chrg.cpMin - lpRASELCHANGE->cpLine+1
SetWindowText(ghStatus, buff)
END IF
IF lpRASELCHANGE->seltyp = SEL_OBJECT THEN
' Bookmark clicked
bm=SendMessage(ghEdit[TabCtrl_GetCurSel(ghMainTab)],REM_GETBOOKMARK, lpRASELCHANGE->line,0)
SELECT CASE bm
CASE 1
' Collapse
SendMessage(ghEdit[TabCtrl_GetCurSel(ghMainTab)],REM_COLLAPSE, lpRASELCHANGE->line,0)
CASE 2
' Expand
SendMessage(ghEdit[TabCtrl_GetCurSel(ghMainTab)],REM_EXPAND, lpRASELCHANGE->line,0)
END SELECT
ELSE
' Selection changed
IF lpRASELCHANGE->fchanged THEN
' Update block bookmarks
SendMessage(ghEdit[TabCtrl_GetCurSel(ghMainTab)],REM_SETBLOCKS,0,0)
END IF
END IF
END IF
CASE WM_CLOSE
DestroyWindow(hWnd)
CASE WM_DESTROY
PostQuitMessage(0)
Case WM_CONTEXTMENU
DIM AS POINT pt
If wParam=(WPARAM)ghTab[TabCtrl_GetCurSel(ghMainTab)] Then
pt.x = LOWORD(lParam)
pt.y = HIWORD(lParam)
TrackPopupMenu( GetSubMenu( GetMenu(hWnd), 1 ), TPM_LEFTALIGN or TPM_RIGHTBUTTON, pt.x, pt.y, 0, hWnd, 0 )
EndIf
CASE WM_GETMINMAXINFO
DIM AS LPMINMAXINFO mm = cast(LPMINMAXINFO,lParam)
DIM AS UINT wDpi = GetDpiForWindow(hWnd)
DIM AS DOUBLE scalingFactor = (double)wDpi / 96
DIM AS POINT defDims
defDims.x = fWidth + wDpi + scalingFactor '+ (fWidth * scalingFactor)
defDims.y = fHeight + wDpi + scalingFactor '+ (fHeight * scalingFactor)
mm->ptMinTrackSize = defDims
END SELECT
END EVENTS

15
Aide.rc Normal file
View File

@ -0,0 +1,15 @@
#include <windows.h>
#include "raedit.h"
IDI_ICON ICON DISCARDABLE "resource/demo.ico"
IDB_RAEDITBUTTON BITMAP DISCARDABLE "resource/Button.bmp"
IDC_HSPLITTCUR CURSOR DISCARDABLE "resource/SplitH.cur"
IDB_BOOKMARK BITMAP DISCARDABLE "resource/Bookmark.bmp"
IDC_SELECTCUR CURSOR DISCARDABLE "resource/Select.cur"
IDB_LINENUMBER BITMAP DISCARDABLE "resource/Linenumber.bmp"
IDB_EXPAND BITMAP DISCARDABLE "resource/Expand.bmp"
IDB_COLLAPSE BITMAP DISCARDABLE "resource/Collapse.bmp"
IDB_LOCK BITMAP DISCARDABLE "resource/Lock.bmp"
RC_KEYWORDS RCDATA DISCARDABLE "resource/keywords.txt"
RC_WINAPI RCDATA DISCARDABLE "resource/winapi.txt"

319
lib/RAEdit.h Normal file
View File

@ -0,0 +1,319 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <windows.h>
#include <commctrl.h>
#include <richedit.h>
#pragma pack(push, 1)
// Default colors
#define BCKCLR 0x00C0F0F0
#define TXTCLR 0x00000000
#define SELBCKCLR 0x00800000
#define SELTXTCLR 0x00FFFFFF
#define CMNTCLR 0x02008000
#define STRCLR 0x00A00000
#define OPRCLR 0x000000A0
#define HILITE1 0x00F0C0C0
#define HILITE2 0x00C0F0C0
#define HILITE3 0x00C0C0F0
#define SELBARCLR 0x00C0C0C0
#define SELBARPEN 0x00808080
#define LNRCLR 0x00800000
#define NUMCLR 0x00808080
#define CMNTBCK 0x00C0F0F0
#define STRBCK 0x00C0F0F0
#define NUMBCK 0x00C0F0F0
#define OPRBCK 0x00C0F0F0
#define CHANGEDCLR 0x0000F0F0
#define CHANGESAVEDCLR 0x0000F000
// Window styles
#define STYLE_NOSPLITT 0x0001 // No splitt button
#define STYLE_NOLINENUMBER 0x0002 // No linenumber button
#define STYLE_NOCOLLAPSE 0x0004 // No expand/collapse buttons
#define STYLE_NOHSCROLL 0x0008 // No horizontal scrollbar
#define STYLE_NOVSCROLL 0x0010 // No vertical scrollbar
#define STYLE_NOHILITE 0x0020 // No color hiliting
#define STYLE_NOSIZEGRIP 0x0040 // No size grip
#define STYLE_NODBLCLICK 0x0080 // No action on double clicks
#define STYLE_READONLY 0x0100 // Text is locked
#define STYLE_NODIVIDERLINE 0x0200 // Blocks are not divided by line
#define STYLE_NOBACKBUFFER 0x0400 // Drawing directly to screen DC
#define STYLE_NOSTATE 0x0800 // No state indicator
#define STYLE_DRAGDROP 0x1000 // Drag & Drop support, app must load ole
#define STYLE_SCROLLTIP 0x2000 // Scrollbar tooltip
#define STYLE_HILITECOMMENT 0x4000 // Comments are hilited
#define STYLE_AUTOSIZELINENUM 0x8000 // Line number column autosizes
// Styles used with REM_SETSTYLEEX message
#define STYLEEX_LOCK 0x0001 // Show lock button
#define STYLEEX_BLOCKGUIDE 0x0002 // Show block guiders
#define STILEEX_LINECHANGED 0x0004 // Show line changed state
#define STILEEX_STRINGMODEFB 0x0008 // FreeBasic
#define STILEEX_STRINGMODEC 0x0010 // C/C++
// Edit modes
#define MODE_NORMAL 0 // Normal
#define MODE_BLOCK 1 // Block select
#define MODE_OVERWRITE 2 // Overwrite
// REM_COMMAND commands
#define CMD_LEFT 1
#define CMD_RIGHT 2
#define CMD_LINE_UP 3
#define CMD_LINE_DOWN 4
#define CMD_PAGE_UP 5
#define CMD_PAGE_DOWN 6
#define CMD_HOME 7
#define CMD_END 8
#define CMD_INSERT 9
#define CMD_DELETE 10
#define CMD_BACKSPACE 11
// REM_COMMAND modifyers
#define CMD_ALT 256
#define CMD_CTRL 512
#define CMD_SHIFT 1024
// 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=0
#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=0
#define REM_COLLAPSEALL (REM_BASE+17) // wParam=0, lParam=0
#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, Returns line number
#define REM_SETSEGMENTBLOCK (REM_BASE+54) // wParam=nLine, lParam=TRUE/FALSE
#define REM_GETMODE (REM_BASE+55) // wParam=0, lParam=0
#define REM_SETMODE (REM_BASE+56) // wParam=nMode, lParam=0
#define REM_GETBLOCK (REM_BASE+57) // wParam=0, lParam=lpBLOCKRANGE
#define REM_SETBLOCK (REM_BASE+58) // wParam=0, lParam=lpBLOCKRANGE
#define REM_BLOCKINSERT (REM_BASE+59) // wParam=0, lParam=lpText
#define REM_LOCKUNDOID (REM_BASE+60) // wParam=TRUE/FALSE, lParam=0
#define REM_ADDBLOCKDEF (REM_BASE+61) // wParam=0, lParam=lpRABLOCKDEF
#define REM_CONVERT (REM_BASE+62) // wParam=nType, lParam=0
#define REM_BRACKETMATCH (REM_BASE+63) // wParam=0, lParam=lpDef {[(,}]),_
#define REM_COMMAND (REM_BASE+64) // wParam=nCommand, lParam=0
#define REM_CASEWORD (REM_BASE+65) // wParam=cp, lParam=lpWord
#define REM_GETBLOCKEND (REM_BASE+66) // wParam=Line, lParam=0
#define REM_SETLOCK (REM_BASE+67) // wParam=TRUE/FALSE, lParam=0
#define REM_GETLOCK (REM_BASE+68) // wParam=0, lParam=0
#define REM_GETWORDFROMPOS (REM_BASE+69) // wParam=cp, lParam=lpBuff
#define REM_SETNOBLOCKLINE (REM_BASE+70) // wParam=Line, lParam=TRUE/FALSE
#define REM_ISLINENOBLOCK (REM_BASE+71) // wParam=Line, lParam=0
#define REM_SETALTHILITELINE (REM_BASE+72) // wParam=Line, lParam=TRUE/FALSE
#define REM_ISLINEALTHILITE (REM_BASE+73) // wParam=Line, lParam=0
#define REM_SETCURSORWORDTYPE (REM_BASE+74) // wParam=nType, lParam=0
#define REM_SETBREAKPOINT (REM_BASE+75) // wParam=nLine, lParam=TRUE/FALSE
#define REM_NEXTBREAKPOINT (REM_BASE+76) // wParam=nLine, lParam=0
#define REM_GETLINESTATE (REM_BASE+77) // wParam=nLine, lParam=0
#define REM_SETERROR (REM_BASE+78) // wParam=nLine, lParam=nErrID
#define REM_GETERROR (REM_BASE+79) // wParam=nLine, lParam=0
#define REM_NEXTERROR (REM_BASE+80) // wParam=nLine, lParam=0
#define REM_CHARTABINIT (REM_BASE+81) // wParam=0, lParam=0
#define REM_LINEREDTEXT (REM_BASE+82) // wParam=nLine, lParam=TRUE/FALSE
#define REM_SETSTYLEEX (REM_BASE+83) // wParam=nStyleEx, lParam=0
#define REM_GETUNICODE (REM_BASE+84) // wParam=0, lParam=0
#define REM_SETUNICODE (REM_BASE+85) // wParam=TRUE/FALSE, lParam=0
#define REM_SETCHANGEDSTATE (REM_BASE+86) // wParam=TRUE/FALSE, lParam=0
#define REM_SETTOOLTIP (REM_BASE+87) // wParam=n (1-6), lParam=lpText
#define REM_HILITEACTIVELINE (REM_BASE+88) // wParam=0, lParam=nColor
#define REM_GETUNDO (REM_BASE+89) // wParam=nSize, lParam=lpMem
#define REM_SETUNDO (REM_BASE+90) // wParam=nSize, lParam=lpMem
#define REM_GETLINEBEGIN (REM_BASE+91) // wParam=nLine, lParam=0
// Convert types
#define CONVERT_TABTOSPACE 0
#define CONVERT_SPACETOTAB 1
#define CONVERT_UPPERCASE 2
#define CONVERT_LOWERCASE 3
// 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 0x00
#define STATE_BM1 0x10
#define STATE_BM2 0x20
#define STATE_BM3 0x30
#define STATE_BM4 0x40
#define STATE_BM5 0x50
#define STATE_BM6 0x60
#define STATE_BM7 0x70
#define STATE_BM8 0x80
#define STATE_BMMASK 0x0F0
// Line states
#define STATE_LOCKED 0x00000100
#define STATE_HIDDEN 0x00000200
#define STATE_COMMENT 0x00000400
#define STATE_DIVIDERLINE 0x00000800
#define STATE_SEGMENTBLOCK 0x00001000
#define STATE_NOBLOCK 0x00002000
#define STATE_ALTHILITE 0x00004000
#define STATE_BREAKPOINT 0x00008000
#define STATE_BLOCKSTART 0x00010000
#define STATE_BLOCK 0x00020000
#define STATE_BLOCKEND 0x00040000
#define STATE_REDTEXT 0x00080000
#define STATE_COMMENTNEST 0x00100000
#define STATE_CHANGED 0x00200000
#define STATE_CHANGESAVED 0x00400000
#define STATE_GARBAGE 0x80000000
// 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
#define CT_CMNTINITCHAR 7
// Find
#define FR_IGNOREWHITESPACE 0x8000000
struct tagRAFONT {
HFONT hFont; // Code edit normal
HFONT hIFont; // Code edit italics
HFONT hLnrFont; // Line numbers
};
typedef struct tagRAFONT RAFONT;
struct tagRACOLOR {
COLORREF bckcol; // Back color
COLORREF txtcol; // Text color
COLORREF selbckcol; // Sel back color
COLORREF seltxtcol; // Sel text color
COLORREF cmntcol; // Comment color
COLORREF strcol; // String color
COLORREF oprcol; // Operator color
COLORREF hicol1; // Line hilite 1
COLORREF hicol2; // Line hilite 2
COLORREF hicol3; // Line hilite 3
COLORREF selbarbck; // Selection bar
COLORREF selbarpen; // Selection bar pen
COLORREF lnrcol; // Line numbers color
COLORREF numcol; // Numbers & hex color
COLORREF cmntback; // Comment back color
COLORREF strback; // String back color
COLORREF numback; // Numbers & hex back color
COLORREF oprback; // Operator back color
COLORREF changed; // Line changed indicator
COLORREF changesaved; // Line saved chane indicator
};
typedef struct tagRACOLOR RACOLOR;
struct tagRASELCHANGE {
NMHDR nmhdr;
CHARRANGE chrg; // Current selection
WORD seltyp; // SEL_TEXT or SEL_OBJECT
DWORD line; // Line number
DWORD cpLine; // Character position of first character
HANDLE lpLine; // Pointer to line
DWORD nlines; // Total number of lines
DWORD nhidden; // Total number of hidden lines
BOOL fchanged; // TRUE if changed since last
DWORD npage; // Page number
DWORD nWordGroup; // Hilite word group(0-15)
};
typedef struct tagRASELCHANGE RASELCHANGE;
#define BD_NONESTING 0x01 // Set to true for non nested blocks
#define BD_DIVIDERLINE 0x02 // Draws a divider line
#define BD_INCLUDELAST 0x04 // lpszEnd line is also collapsed
#define BD_LOOKAHEAD 0x08 // Look 500 lines ahead for the ending
#define BD_SEGMENTBLOCK 0x10 // Segment block, collapse till next segmentblock
#define BD_COMMENTBLOCK 0x20 // Comment block
#define BD_NOBLOCK 0x40 //
#define BD_ALTHILITE 0x80 // Adds 1 to the current word group for syntax coloring.
struct tagRABLOCKDEF {
LPTSTR lpszStart; // Block start
LPTSTR lpszEnd; // Block end
LPTSTR lpszNot1; // Dont hide line containing this or set to NULL
LPTSTR lpszNot2; // Dont hide line containing this or set to NULL
DWORD flag; // High word is WordGroup(0-15)
};
typedef struct tagRABLOCKDEF RABLOCKDEF;
struct tagLINERANGE {
DWORD lnMin; // Starting line
DWORD lnMax; // Ending line
};
typedef struct tagLINERANGE LINERANGE;
struct tagBLOCKRANGE {
DWORD lnMin; // Starting line
DWORD clMin; // Starting column
DWORD lnMax; // Ending line
DWORD clMax; // Ending column
};
typedef struct tagBLOCKRANGE BLOCKRANGE;
void WINAPI InstallRAEdit(HINSTANCE hInst, BOOL fGlobal);
void WINAPI UnInstallRAEdit(void);
#ifdef __cplusplus
}
#endif
#pragma pack(pop)

11
raedit.h Normal file
View File

@ -0,0 +1,11 @@
#define IDI_ICON 6666
#define IDB_RAEDITBUTTON 100
#define IDC_HSPLITTCUR 101
#define IDB_BOOKMARK 102
#define IDC_SELECTCUR 103
#define IDB_LINENUMBER 104
#define IDB_EXPAND 105
#define IDB_COLLAPSE 106
#define IDB_LOCK 107
#define RC_KEYWORDS 108
#define RC_WINAPI 109

188
raedit.inc Normal file
View File

@ -0,0 +1,188 @@
#include "lib/RAEdit.h"
#include "raEdit.h"
$PRAGMA lib "lib/libRAEditC.a"
SUB RaNewEdit()
DIM pn
DIM AS RECT rc
pn = TabCtrl_GetItemCount(ghMainTab)
GetClientRect (ghMainTab, &rc)
AdjustWindowRect (&rc, 0, 0)
IF pn THEN
BCX_ADDTAB(ghMainTab, pn, "<Untitled.bas>")
ghEdit[pn] = BCX_CONTROL("RAEdit", ghTab[pn], "This is Page ", pn+6000, rc.left,rc.top,rc.right-rc.left-8,rc.bottom-rc.top-46, _
WS_CHILD OR WS_VISIBLE OR WS_BORDER OR ES_LEFT OR ES_MULTILINE OR STYLE_AUTOSIZELINENUM OR STYLE_NOLINENUMBER OR STYLE_DRAGDROP)
END IF
RaConfigEditor(ghEdit[pn])
END SUB
SUB RaConfigEditor(hEDT as HWND)
' Set Editor Font
BCX_SET_FONT(hEDT, "Consolas", 12)
' Enable Line Numbers
CheckDlgButton(hEDT,-2,TRUE)
SendMessage(hEDT, WM_COMMAND, -2, 0)
' Highlite Active Line in Editor
SendMessage(hEDT, REM_HILITEACTIVELINE, 0, 2)
' Set the comment character
SendMessage(hEDT, REM_SETCHARTAB, ASC(";"), CT_OPER)
SendMessage(hEDT, REM_SETCHARTAB, ASC("'"), CT_CMNTCHAR)
' Enable Block Guides
SendMessage(hEDT, REM_SETSTYLEEX, STYLEEX_BLOCKGUIDE,0)
' Set up tabbing; 4 spaces, also convert to spaces on load?
SendMessage(hEDT, CONVERT_TABTOSPACE, 0, 0)
SendMessage(hEDT, REM_TABWIDTH, 4, TRUE)
' SendMEssage(RAEdit, REM_CONVERT, CONVERT_UPPERCASE, 0)
SendMessage(hEDT, REM_SETSTYLEEX, STILEEX_STRINGMODEFB, 0)
' Set Colors and Keywords
RaSetColors(hEDT)
RaLoadKeyWords(hEDT)
' Set Folding Words, minimal list
' [$] is a placeholder, [!] disable folding if following word is at eol?
' Optional Number or define at end of function call specifies the type of styling
RaSetBlocks(hEDT,"begin events", "end events",0)
RaSetBlocks(hEDT,"begin dialog", "end dialog",0)
RaSetBlocks(hEDT,"begin modal dialog", "end dialog",0)
RaSetBlocks(hEDT,"%private %public Function $","end Function")
RaSetBlocks(hEDT,"if $! then", "EndIf|End If")
RaSetBlocks(hEDT,"with $", "end with")
RaSetBlocks(hEDT,"select case !end select","End Select")
RaSetBlocks(hEDT,"%private %public sub $","end sub")
RaSetBlocks(hEDT,"enum", "end enum",0)
RaSetBlocks(hEDT,"while $ !wend", "wend",0)
RaSetBlocks(hEDT,"type!as","End Type",0)
RaSetBlocks(hEDT,"do!loop","Loop",0)
RaSetBlocks(hEDT,"while $ !wend","wend",0)
RaSetBlocks(hEDT,"for $ !next","next",0)
SetFocus(hEDT)
END SUB
' Sets keyword blocks for folding
Function RaSetBlocks OPTIONAL (hEDT as HWND, start_block AS STRING, end_block AS STRING, flag AS INTEGER = 0) AS INTEGER
DIM AS RABLOCKDEF blockdef
SendMessage(hEDT, REM_SETBLOCKS,0,0)
WITH blockdef
.lpszStart = start_block
.lpszEnd = end_block
.lpszNot1 = 0
.lpszNot2 = 0
.flag = flag
END WITH
FUNCTION = SendMessage(hEDT, REM_ADDBLOCKDEF, 0, &blockdef)
END FUNCTION
Function RaLoadKeyWords(hEDT AS HWND) As INTEGER
DIM AS INTEGER r
DIM AS DWORD rcSize
r = SendMessage(hEDT, REM_SETHILITEWORDS, 0xc48a4c, (LPCSTR)GetResource(RC_KEYWORDS, RT_RCDATA, &rcSize))
r = SendMessage(hEDT, REM_SETHILITEWORDS, 0x5f5fce, (LPCSTR)GetResource(RC_WINAPI, RT_RCDATA, &rcSize))
FUNCTION = r
End Function
' Configure color scheme for RAEdit object
SUB RaSetColors(hEDT as HWND)
DIM AS RACOLOR colors
WITH colors
.bckcol = QBCOLOR(0) ' Back color
.txtcol = QBCOLOR(11) ' Text color
.selbckcol = 0xd89f62 ' Sel back color
.seltxtcol = SELTXTCLR ' Sel text color
.cmntcol = QBCOLOR(24) ' Comment color
.strcol = RGB(0,193,0) ' String color
.oprcol = 0x5f5fce ' Operator color
.hicol1 = HILITE1 ' Line hilite 1 [ current line color option 1 ]
.hicol2 = 0x303030 ' Line hilite 2 [ current line color option 2 ]
.hicol3 = HILITE3 ' Line hilite 3 [ current line color option 3 ]
.selbarbck = RGB(20,20,20) ' Line numbers panel background
.selbarpen = SELBARPEN ' Selection bar pen
.lnrcol = 0xffffff ' Line numbers color
.numcol = 0x5f5fce ' Numbers & hex color
.cmntback = QBCOLOR(0) ' Comment back color
.strback = QBCOLOR(0) ' String back color
.numback = QBCOLOR(0) ' Numbers & hex back color
.oprback = QBCOLOR(0) ' Operator back color
.changed = CHANGEDCLR ' Line changed indicator
.changesaved = CHANGESAVEDCLR ' Line saved chane indicator
END WITH
SendMessage(hEDT, REM_SETCOLOR, 0, &colors)
END SUB
' Loads file into RAEdit object
FUNCTION RaLoadFile(edt AS HWND) AS STRING
DIM RetStr$
DIM AS CHARRANGE chrg
RetStr$ = GetFileName$("Open File...", "BCX Files|*.BAS;*.INC;*.bi;*.bci")
IF Len(RetStr$) THEN
EDITLOADFILE(edt, RetStr$)
chrg.cpMin = 0
chrg.cpMax = 0
SendMessage(edt, EM_EXSETSEL, 0, &chrg)
SendMessage(edt, EM_SCROLLCARET, 0, 0)
SendMessage(edt, REM_HILITEACTIVELINE, 0, 2)
SetFocus(edt)
END IF
FUNCTION = RetStr$
END FUNCTION
SUB RaGotoLine(hEDT as HWND, Line AS INTEGER)
Dim chrg As CHARRANGE
DIM GotoLine
GotoLine = SendMessage(hEDT, EM_LINEINDEX, Line, 0)
chrg.cpMin = GotoLine
chrg.cpMax = GotoLine
SendMessage(hEDT, EM_EXSETSEL, 0, &chrg)
SendMessage(hEDT, EM_SCROLLCARET, 0, 0)
END SUB
SUB RaCut(hEDT as HWND)
SendMessage(hEDT, WM_CUT, 0, 0)
SetFocus(hEDT)
END SUB
SUB RaCopy(hEDT as HWND)
SendMessage(hEDT, WM_COPY, 0, 0)
SetFocus(hEDT)
END SUB
SUB RaPaste(hEDT as HWND)
SendMessage(hEDT, WM_PASTE, 0, 0)
SetFocus(hEDT)
END SUB
SUB RaSelectAll(hEDT as HWND)
SendMessage(hEDT, EM_SETSEL, 0, -1)
SetFocus(hEDT)
END SUB
SUB RaUndo(hEDT as HWND)
SendMessage(hEDT, EM_UNDO, 0, 0)
SetFocus(hEDT)
END SUB
SUB RaRedo(hEDT as HWND)
SendMessage(hEDT, EM_REDO, 0, 0)
SetFocus(hEDT)
END SUB

BIN
resource/Bookmark.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 690 B

BIN
resource/Button.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
resource/Collapse.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

BIN
resource/Expand.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

BIN
resource/Linenumber.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

BIN
resource/Lock.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

BIN
resource/Select.cur Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

BIN
resource/SplitH.cur Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

BIN
resource/SplitV.cur Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

BIN
resource/demo.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

604
resource/keywords.txt Normal file
View File

@ -0,0 +1,604 @@
accelerator
asm
bcx$
bcx_resource
bcxversion
catch
ccode
class
comment
compiler
cpp
define
dll
else
elseif
endclass
endif
endtry
file$
filetest
fill
fsstatic
genfree
header
hscroll
if
ifdef
ifndef
ifnotbcx
include
iprint_off
iprint_on
lcc$
leanandmean
library
linker
mt
multithread
namespace
noini
nolibmain
nolibrary
nomain
nowin
onentry
onexit
optimizeroff
optimizeron
pack
pelles
pelles$
pp
pragma
prj
prjuse
project
rems
resource
source
test
trace
try
turbo
typedef
vscroll
warnings
warnings_on
warnings_off
zap
abs
acos
acosh
addressof
alias
and
andalso
ansitowide
appactivate
append
appexename$
appexepath$
argc
argv
argv$
as
asc
ascending
asin
asinh
atanh
atn
auto
band
bcx_arc
bcx_bitmap
bcx_blackrect
bcx_bmpbutton
bcx_bmpheight
bcx_bmpwidth
bcx_button
bcx_checkbox
bcx_circle
bcx_colordlg
bcx_combobox
bcx_control
bcx_cursor
bcx_datepick
bcx_dialog
bcx_edit
bcx_ellipse
bcx_floodfill
bcx_fontdlg
bcx_form
bcx_get
bcx_get_text$
bcx_get_updown
bcx_getpixel
bcx_grayrect
bcx_group
bcx_hinstance
bcx_icon
bcx_input
bcx_label
bcx_line
bcx_lineto
bcx_listbox
bcx_listview
bcx_loadbmp
bcx_loadimage
bcx_mdialog
bcx_mdichild
bcx_mdiclass
bcx_mdiclient
bcx_olepicture
bcx_polybezier
bcx_polygon
bcx_polyline
bcx_popconsolesize
bcx_preset
bcx_print
bcx_progressbar
bcx_pset
bcx_pushconsolesize
bcx_put
bcx_radio
bcx_rectangle
bcx_repeat
bcx_resize
bcx_resource
bcx_richedit
bcx_roundrect
bcx_scalex
bcx_scaley
bcx_set_edit_color
bcx_set_font
bcx_set_form_color
bcx_set_label_color
bcx_set_text
bcx_setclientsize
bcx_setcolor
bcx_setconsolesize
bcx_setsplitpos
bcx_slider
bcx_splitter
bcx_status
bcx_str
bcx_stricmp
bcx_tab
bcx_thread
bcx_threadend
bcx_threadkill
bcx_threadresume
bcx_threadsuspend
bcx_threadwait
bcx_tile
bcx_toolbar
bcx_treeview
bcx_updown
bcx_whiterect
bcxfont
bcxlib
bcxpath$
bcxsplitpath$
begin
bel$
bff$
bin$
bin2dec
binary
bnot
bool$
bor
bs$
bstr
by
byref
byte_at
c_declare
call
callback
case
cbctl
cbctlmsg
cbhndl
cbhwnd
cblparam
cbmsg
cbool
cbwparam
cdbl
center
chdir
chdrive
chr$
cint
class
clear
clipboard_gettext$
clipboard_gettextsize
clipboard_reset
clipboard_settext
clng
close
closedialog
cls
color
color_bg
color_fg
com
comboboxloadfile
command$
comset
concat
console
const
containedin
control
copyfile
cos
cosh
cosl
cpad$
cr$
createregint
createregstring
crlf$
csng
csrlin
curdir$
cursorx
cursory
cvd
cvi
cvl
cvs
data
data$
date$
declare
decr
del$
delay
delete
deleteregkey
descending
dialog
dim
do
doevents
double
download
dpi
dq$
drawtransbmp
dsplit
dynamic
each
editloadfile
ejectpage
else
elseif
enc$
end
endif
enum
environ$
eof
eof$
esc$
events
exist
exit
exp
export
extern
extract$
false
ff$
filelocked
fill
fillarray
findfirst$
findfirstinstance
findintype
findnext$
finput
fix
flush
for
for_each
formload
fprint
frac
free
freefile
freeglobals
function
fwrite
genfree$
get$
getattr
getbmp
getbvalue
getc
getdrive
getfilename$
getgvalue
getresource
getrvalue
gettextsize
global
gosub
goto
gui
hex$
hex2dec
hide
hiword
hypot
icompare
icon
if
iif
iif$
imod
in
inchr
incr
infobox
inkey
inkey$
inp
input
inputbox$
inputbuffer
inputnumber
inpw
ins$
instat
instr
instrrev
int
integer
iremove
iremove$
ireplace
ireplace$
is
isfalse
isfile
isfolder
ishidden
isodate$
isptr
isreadonly
issystem
istrue
iszero
iterate
join$
keypress
kill
lcase$
lccpath$
ldouble
left$
leftstr
len
lf$
lib
like
line
listboxloadfile
load_dll
loadfile$
loadlibrary
loc
local
locate
lof
log
log10
long
longestline
loop
loword
lpad$
lprint
ltrim$
macro
main
max
mcase$
mdigui
memsize
method
mid$
min
mkd$
mkdir
mki$
mkl$
mks$
mod
modal
modstyle
msgbox
nest
new
next
next_each
nextlinelen
not
nothing
notzero
now$
nul$
object
object
oct$
on
open
optional
or
or
osversion
outp
output
outpw
overloaded
panel
pause
peek$
pellespath$
pixels
playwav
poke
popcolors
pos
pow
powl
preserve
print
printer
private
program
property
propget
propset
ptr
pushcolors
put$
qbcolor
qsort
qsortidx
randomize
raw
read
read$
rec
reccount
reclen
record
redim
refresh
regint
register
regstring$
rem
remain$
remove
remove$
rename
repeat
repeat$
replace
replace$
retain$
return
reverse$
rewind
rgb
right$
rightstr
rmdir
rnd
round
rpad$
rtrim$
run
savebmp
scanerror
screen
searchpath$
seek
select
set
set_bcx_bitmap
set_bcx_bitmap2
set_bcx_bmpbutton
set_bcx_icon
setattr
setdialogscale
seteof
setformcolor
setwindowrtftext
sgn
shared
sharedset
shell
show
sin
single
sinh
sinl
sizeof
sleep
sound
space$
spc$
split
sprint
sqr
sqrt
sqrtl
static
stdcall
step
str$
strarray
strim$
string
string$
strptr
strtoken$
sub
swap
sysdir$
sysstr
tab$
tally
tan
tanh
tanl
tempdir$
tempfilename$
textmode
then
this
time$
timer
to
trim$
true
type
ubound
ucase$
uncom
union
until
unwrap$
using$
val
vbs_addcode
vbs_eval_num
vbs_eval_str$
vbs_reset
vbs_run_script
vbs_start
vbs_stop
vchr$
verify
vt$
wend
while
widetoansi$
windir$
with
wrap$
write
xfor
xnext
xor

5269
resource/winapi.txt Normal file

File diff suppressed because it is too large Load Diff