• Welcome to Jose's Read Only Forum 2023.
 

(Phoenix) The EDM32 (Richedit-Replacement)

Started by Theo Gottwald, May 19, 2007, 03:33:45 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Theo Gottwald

Dominic just announced, that Phoenix supports the EDM32-Control, which was originally written by Borje Hagsten as a replacement for the slow and often difficult to use Richtext-Control.
Especially for those who want to use it for a Code-Editor, the EDM32 is the Alternative to the Richedit.

Phoenix-Visual Designer Forum

' March 23, 2007 <Begin changes by  Dominic Mitchell>
'                Check added for existence of control-specific data buffer
'                in WM_DESTROY before acessing members of the EDM32DATA structure.
'
'                Adressed the incompatible behaviour between the edmSetFontEditor helper
'                function and the WM_SETFONT/WM_GETFONT message. The control now saves
'                the handle of the font set via the WM_SETFONT message, and only destroys
'                fonts created using the edmSetFontEditor function.
'
'                Readded edmSetFontEditor hEdm, "Fixedsys", ....
'                to CreateEdm32edit to allow the proper initialization of state variables.
'
'                Changed EDM_SETINFO from a message to a notification code(EDN_SETINFO)
'                sent via the WM_NOTIFY message to eliminate message conflicts.
'                <End changes by  Dominic Mitchell>
'
' Jan 19, 2006  Replaced all occurances of \ used instead of /
'                 (it GPF's otherwise - something like differences between
'                  treatment of \ in different compiler versions and divide
'                  by zero - to clever for me)
'               Adjust wnHeight as a result of change from \ to /
'               Isolate create from initilize
'               Change edmGetSubs to parse both "function" and "FUNCTION"
'               Added some entries to syntax color data
'------------------------------------------------------------------------------
' Free of charge, released into Public Domain in July 2001.
'------------------------------------------------------------------------------
' Some of many features:
'   Asm Text Case handling routines, edmUCASE, edmLCASE edmMCASE, edmTCASE
'   Asm Word Count routine, edmWordCount
'   Bookmarks, toggling on/off, moving between, etc.
'   Built-in file loading routine
'   Built-in font handling via edmSetFontEditor and edmMakeFont
'   Built-in keyboard shortcuts for basic edit commands
'   Built-in line handling routines, like sorting, (un)commenting, in/outdenting
'   Built-in Search and Replace all -functions.
'   Built-in Sub/Function finder routine for PB code
'   Dynamic memory manager(s), handles "unlimited" line sizes..
'   Fully configurable via messages, for color settings, etc.
'   Line number label on thumbtrack scroll (can be turned off)
'   Syntax color parser for PB/DLL code files (.BAS/.INC)
'   Syntax color parser for PB resource files (.RC)
'   Tab-key indents/outdents when several lines are selected
'   Unlimited file sizes (memory dependent, of course)
'   Unlimited Undo/Redo  (also memory dependent)
'------------------------------------------------------------------------------
' Known "issues"
'   Many "Replace all" operations on a large file eats memory, since
'   entire text is saved in Undo buffer for this command. Will rewrite
'   this some day, but for now this will have to do.
'------------------------------------------------------------------------------
' How To:  (a few "how to's", not covered in sample program.)
'   Get entire contents into a string:           txt = edmTxtGetSelText(hEdit, 0)
'   Get selected text into a string:             txt = edmTxtGetSelText(hEdit, 1)
'   Get a line into a string (first line = 0):   txt = edmTxtGetLine(hEdit, LineNum)
'   Select a line (line feeds not included):     Sendmessage hEdit, %EDM_SELECTLINE, 5, 1
'   Get length of line (line feed not included): ln = SendMessage(hEdit, %EDM_GETLINELEN, LineNum, 0)
'   reset undo buffer (some like this on save):  SendMessage hEdit %EDM_UNDOCLEAR, 0, 0
'   change text color (here to blue):            SendMessage hEdit %EDM_SETCOLORTXT, RGB(0,0,255), 1
'   find next occurrence of search text:         pos = edmTxtFindNext(hEdit, SearchTxt, sDirection, sMatchCase, sWWordsOnly, 1)
'   replace all occurrences of search text:      cnt = edmTxtReplaceAll(hEdit, SearchTxt, ReplaceTxt, MatchCase, WWordsOnly, 0)
'   count all occurrences of search text:        cnt = edmTxtReplaceAll(hEdit, SearchTxt, "", MatchCase, WWordsOnly, 1)
'¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

'#RESOURCE "EDM32.PBR"                'resource file, containing right-hand cursor. Best placed in main code.

'------------------------------------------------------------------------------
'FILE RELATED MESSAGES
%EDM_LOADFILE        = %WM_USER + 100   'wParam = pointer to File name string/asciiz, lParam is focus flag
%EDM_GETFILETYPE     = %WM_USER + 107   'returns @ed.FileType
%EDM_ISUNTITLED      = %WM_USER + 108   'sets/returns untitled file status. wParam sets flag if lParam <> 0
%EDM_SETFILETYPE     = %WM_USER + 109   'wParam sets @ed.FileType, 2=BAS, 3=HTML, 4=RC, lParam = redraw

'EDIT RELATED MESSAGES
%EDM_UNDO            = %WM_USER + 120  'undo edit operation
%EDM_REDO            = %WM_USER + 121  'redo undo action
%EDM_CANUNDO         = %WM_USER + 122  'returns number of possible undo actions
%EDM_CANREDO         = %WM_USER + 123  'returns number of possible redo actions
%EDM_UNDOCLEAR       = %WM_USER + 124  'empties undo buffer via UndoInit
%EDM_COPY            = %WM_USER + 131  'copies selected or whole text (if no selection exists)
%EDM_PASTE           = %WM_USER + 132  'adjusts and pastes clipboard contents at carets place in text
%EDM_DELETE          = %WM_USER + 133  'wParam <>0, delete all, else delete selected text
%EDM_GETTEXT         = %WM_USER + 140  'get all text. wParam must be pointer to string, lParam allocated length
%EDM_GETTEXTLEN      = %WM_USER + 141  'returns length of text in editor
%EDM_GETLINELEN      = %WM_USER + 142  'returns length of wParam line in editor (not counting line feeds)

%EDM_SETSEL          = %WM_USER + 150  'wParam < 0, reset sel. lParam < 0, sel all. Else wParam = start and lParam = end of selection.
%EDM_SELECTLINE      = %WM_USER + 151  'wParam < 0, select current line - else wParam is line number, lParam is redraw flag
%EDM_RESETSEL        = %WM_USER + 152  'reset selection, lParam holds redraw flag
%EDM_REPLACESEL      = %WM_USER + 153  'wParam is pointer to replace text, lParam is redraw flag
%EDM_REFRESH         = %WM_USER + 160  'lParam = setfocus flag
%EDM_SETCHANGED      = %WM_USER + 161  'lParam sets changed-flag
%EDM_GETCHANGED      = %WM_USER + 162  'returns changed-flag

'BOOKMARK MESSAGES
%EDM_SETBMARK        = %WM_USER + 170  'if lParam is zero, bookmark current line, else lParam is line number
%EDM_RESETBMARKSALL  = %WM_USER + 171  'resets all bookmarks
%EDM_SETBMCOLOR      = %WM_USER + 172  'wParam holds new color, lParam is redraw flag
%EDM_NEXTBMARK       = %WM_USER + 173  'go to next bookmark, looking from line number lParam - if zero, looking from caret's line
%EDM_PREVBMARK       = %WM_USER + 174  'go to previous bookmark, looking from line number lParam - if zero, looking from caret's line
%EDM_GETBMARKCOUNT   = %WM_USER + 175  'returns number of set bookmarks
%EDM_GETBMARK        = %WM_USER + 176  'returns bookmark status for line number given in lParam

'SETTINGS MESSAGES
%EDM_SETCOLORGRIDLINE     = %WM_USER + 182 'wParam sets gridline color
%EDM_SETCOLORSYNTAXASM    = %WM_USER + 183 'wParam sets syntax color for inline Asm code - default RED
%EDM_SETCOLORSYNTAXCODE   = %WM_USER + 184 'wParam sets syntax color for PB code - default BLUE
%EDM_SETCOLORSYNTAXREM    = %WM_USER + 185 'wParam sets syntax color for uncommented code (rem) - default GREEN
%EDM_SETCOLORSYNTAXSTRING = %WM_USER + 186 'wParam sets syntax color for strings - default RED
%EDM_SETCOLORPAGE         = %WM_USER + 190 'wParam sets window color - default %COLOR_WINDOW, lParam is redraw flag
%EDM_SETCOLORTXT          = %WM_USER + 191 'wParam sets text color - default %COLOR_WINDOWTEXT, lParam is redraw flag
%EDM_SETCOLORTXTBK        = %WM_USER + 192 'wParam sets text background color - default %COLOR_WINDOW, lParam is redraw flag
%EDM_SETGRID              = %WM_USER + 200 'wParam sets grid-lines on/off, 0 = OFF, else ON
%EDM_SETINSERTMODE        = %WM_USER + 202 'toggles Insert/Overwrite mode
%EDM_SETKBSHORTCUTS       = %WM_USER + 204 'wParam sets internal keyboad shortcuts on/off
%EDM_SETKWCASE            = %WM_USER + 206 'wParam sets KeyWord case status, 0 = ignore case, else auto UCASE
%EDM_SETSHOWNONPRINT      = %WM_USER + 210 'wParam sets show-status of non-visual characters, 0 = SHOW, else HIDE
%EDM_SETSYNTAXONOFF       = %WM_USER + 212 'wParam sets syntax coloring on/off, 0 = OFF, else ON
%EDM_SETWORDWRAP          = %WM_USER + 214 'wParam sets WordWrap On/Off
%EDM_SHOWSCROLLINFO       = %WM_USER + 216 'wParam sets thumbtrack scrollinfo label on/off
%EDM_SETAUTOINDENT        = %WM_USER + 218 'wParam sets auto indent on/off

%EDM_GETCOLORGRIDLINE     = %WM_USER + 232 'returns gridline color
%EDM_GETCOLORSYNTAXASM    = %WM_USER + 233 'returns syntax color for inline Asm code - default RED
%EDM_GETCOLORSYNTAXCODE   = %WM_USER + 234 'returns syntax color for PB code - default BLUE
%EDM_GETCOLORSYNTAXREM    = %WM_USER + 235 'returns syntax color for uncommented code (rem) - default GREEN
%EDM_GETCOLORSYNTAXSTRING = %WM_USER + 236 'returns syntax color for strings - default RED
%EDM_GETCOLORPAGE         = %WM_USER + 240 'returns window color - default %COLOR_WINDOW
%EDM_GETCOLORTXT          = %WM_USER + 241 'returns text color - default %COLOR_WINDOWTEXT
%EDM_GETCOLORTXTBK        = %WM_USER + 242 'returns text background color - default %COLOR_WINDOW
%EDM_GETGRID              = %WM_USER + 250 'returns flag for grid-lines on/off status
%EDM_GETINSERTMODE        = %WM_USER + 252 'returns flag for Insert/Overwrite mode
%EDM_GETKWCASE            = %WM_USER + 256 'returns KeyWord case status, auto UCASE or not..
%EDM_GETSHOWNONPRINT      = %WM_USER + 260 'returns flag for show-status of non-visual characters
%EDM_GETSYNTAXONOFF       = %WM_USER + 262 'returns flag for syntax coloring on/off
%EDM_GETWORDWRAP          = %WM_USER + 264 'returns flag for WordWrap On/Off

'CUSTOM FUNCTION MESSAGES
%EDM_UCASE           = %WM_USER + 300  ' make selection UPPER CASE
%EDM_MCASE           = %WM_USER + 301  ' make selection Mixed Case
%EDM_LCASE           = %WM_USER + 302  ' make selection lower case
%EDM_TCASE           = %WM_USER + 303  ' make selection tOGGLED cASE
%EDM_SORTLINES       = %WM_USER + 310  ' wParam = 0-Asc. 1-Asc, ignore case. 2-Desc. 3-Desc. ignore case
%EDM_COMMENT         = %WM_USER + 312  ' lParam = 0-comment out. 1-remove rem out. 2-Indent. 3-outdent.
%EDM_ISKEYWORD       = %WM_USER + 314  ' word as strptr in lParam. Returns %TRUE if word is keyword
%EDM_SETREADONLY     = %WM_USER + 320  ' wParam sets ReadOnly mode, <> 0 = ReadOnly
%EDM_GETREADONLY     = %WM_USER + 321  ' returns ReadOnly status

'INFORMATION MESSAGES
%EDM_GETCARETPOS     = %WM_USER + 400  ' returns linear caret position
%EDM_GETCARETX       = %WM_USER + 401  ' returns caret's X-position on line
%EDM_GETCARETY       = %WM_USER + 402  ' returns caret's Y-position (line)
%EDM_SETCARETPOS     = %WM_USER + 404  ' wParam sets linear position in text
%EDM_SETCARETX       = %WM_USER + 405  ' wParam sets caret's X-position on line
%EDM_SETCARETY       = %WM_USER + 406  ' wParam sets caret's Y-position (line)

%EDM_GETSELPOSSTART  = %WM_USER + 410  ' returns linear selStart position
%EDM_GETSELPOSEND    = %WM_USER + 411  ' returns linear selEnd position
%EDM_GETSELSTARTX    = %WM_USER + 412  ' returns selstart's X-position on line
%EDM_GETSELSTARTY    = %WM_USER + 413  ' returns selstart's Y-position (line)
%EDM_GETSELENDX      = %WM_USER + 414  ' returns selend's X-position on line
%EDM_GETSELENDY      = %WM_USER + 415  ' returns selend's Y-position (line)
%EDM_GETSELLENGTH    = %WM_USER + 416  ' returns selection's length

%EDM_SETSELPOSSTART  = %WM_USER + 420   ' wParam sets linear selstart position in text
%EDM_SETSELPOSEND    = %WM_USER + 421   ' wParam sets linear selend position in text
%EDM_SETSELSTARTX    = %WM_USER + 422   ' wParam sets selstart's X-position on line
%EDM_SETSELSTARTY    = %WM_USER + 423   ' wParam sets selstart's Y-position (line)
%EDM_SETSELENDX      = %WM_USER + 424   ' wParam sets selend's X-position on line
%EDM_SETSELENDY      = %WM_USER + 425   ' wParam sets selend's Y-position (line)

%EDM_GETTOPLINE      = %WM_USER + 450   ' returns top line (First visible line)
%EDM_LINELENWINDOW   = %WM_USER + 451   ' returns max number of characters a window can show on a line
%EDM_LINESPERWINDOW  = %WM_USER + 452   ' returns max number of full lines a window can show
%EDM_GETLINECOUNT    = %WM_USER + 453   ' returns number of lines in text
%EDM_GETWORDCOUNT    = %WM_USER + 454   ' returns number of words in text
%EDM_GETHSCROLL      = %WM_USER + 456   ' returns horizontal scrollbar's current value
%EDM_GETHSCROLLMAX   = %WM_USER + 457   ' returns horizontal scrollbar's max value
%EDM_GETCHARHEIGHT   = %WM_USER + 460   ' returns character height = line height for selected font
%EDM_GETCHARWIDTH    = %WM_USER + 461   ' returns character width for selected font

%EDM_SETTOPLINE      = %WM_USER + 480   ' wParam sets top line (First visible line). lParam is redraw flag
%EDM_SETHSCROLL      = %WM_USER + 482   ' wParam sets horizontal scroll position
%EDM_GOTOLINE        = %WM_USER + 483   ' wParam is line number, lParam is redraw flag

%EDM_SETTABSIZE      = %WM_USER + 484   ' wParam sets Tab width (number of spaces that replaces a tab)
%EDM_GETTABSIZE      = %WM_USER + 485   ' returns Tab width (number of spaces that replaces a tab)
%EDM_GETLEFTMARGIN   = %WM_USER + 487   ' returns width of left side's selection/bookmark field (margin)
%EDM_SETLEFTMARGIN   = %WM_USER + 488   ' sets width: wParam = width, lParam = redraw flag
%EDM_GETAUTOINDENT   = %WM_USER + 489   ' returns auto indent on/off

%EDM_GETCAPSLOCK     = %WM_USER + 500   ' returns status for CapsLock key (0-off, 1-active)
%EDM_GETNUMLOCK      = %WM_USER + 501   ' returns status for NumLock key (0-off, 1-active)
%EDM_GETSCROLLOCK    = %WM_USER + 502   ' returns status for ScrollLock key (0-off, 1-active)

'INTERNAL CONTROL MESSAGES
%EDM_CHECKBOUNDS     = %WM_USER + 520   ' internal use, checks bounds for TopLine (first visible line)
%EDM_CARETHANDLER    = %WM_USER + 530   ' internal use, checks bounds for caret and sets scrollbar, etc.

'NOTIFICATION MESSAGES
'%EDM_SETINFO         = %WM_USER + 600   'sent to parent - notification message on all caret movements, etc

' The notification scheme is rewritten because it is dangerous as is.
' The notification is now sent via WM_NOTIFY.
%EDN_SETINFO         = 100              'sent to parent - notification message on all caret movements, etc

TYPE NMSETINFO
  hdr     AS NMHDR
  lInfo   AS LONG     ' caret movements, etc
END TYPE

'------------------------------------------------------------------------------
'Following two UDT's can be freely customized to meet extended needs
'------------------------------------------------------------------------------
TYPE UNDODATA             'User-defined type for undo/redo actions
  uAction         AS LONG ' for type of undo/redo action, 1 = insert text, 2 = delete text
  uActionCount    AS LONG ' for number of undo/redo actions to be done in one take
  uActionStartX   AS LONG ' for x startpos of undo/redo action
  uActionStartY   AS LONG ' for y startpos of undo/redo action
  uActionEndX     AS LONG ' for x endpos of undo/redo action
  uActionEndY     AS LONG ' for y endpos of undo/redo action
  uActionLen      AS LONG ' for endpos of undo/redo action
  uTxtBlockStart  AS LONG ' for startpos in undo/redo text memory block
  uTxtBlockEnd    AS LONG ' for length of text in undo/redo text memory block
  uDescription    AS LONG ' for description of undo/redo action
END TYPE

TYPE EDM32DATA                   'User-defined type for control-specific data
  hWnd               AS DWORD     'control's handle
  id                 AS LONG      'control's id
  hInst              AS DWORD     'control's instance handle
  hParent            AS DWORD     'control's parent's handle
  isUntitled         AS LONG      'flag for untitled (new) status
  memDC              AS DWORD     'memDC used in WM_PAINT
  hBit               AS DWORD     'memDC's bitmap
  CursArrow          AS DWORD     'handle of normal arrow cursor
  CursArrowRigth     AS DWORD     'handle of custom right-arrow cursor
  CursIBeam          AS DWORD     'handle of normal beam cursor
  CursDragDrop       AS DWORD     'handle of drag&drop cursor - not implemented yet..
  autoIndent         AS LONG      'auto indent mode flag
  cInsOvr            AS LONG      'Insert or Overwrite..
  dClicked           AS LONG      'for different ways to handle double-click
  charHeight         AS LONG      'character height is same as Line height
  charWidth          AS LONG      'character width
  confineCaret       AS LONG      'if to confine caret to line's legth or not - not implemented yet
  wnWidth            AS LONG      'editor's width (window width)
  wnHeight           AS LONG      'editor's height (window height)
  TopLine            AS LONG      'current first visible line
  OldTopLine         AS LONG      'previous first visible line
  lMargin            AS LONG      'Left margin, equals width of left selection/bookmark field.
  xPos               AS LONG      'xPos = @ed.lMargin + @ed.charWidth * (- @ed.iHscrollPos)
  OldHscrollPos      AS LONG      'previous horizontal scroll pos, used in WM_PAINT
  iHscrollPos        AS LONG      'current horizontal scroll pos
  iHscrollMax        AS LONG      'max horizontal scroll pos
  hTimer             AS DWORD     'timer for scroll when mouse has capture above/below control
  hScrollLabel       AS DWORD     'handle for scroll info label
  showScrollInfo     AS LONG      'flag for scroll info label
  infoLeadText       AS ASCIIZ * 10 'lead text for scroll info label
  xCaretOld          AS LONG      'caret's previous x-pos
  xCaret             AS LONG      'caret's current x-pos
  yCaret             AS LONG      'caret's current y-pos (line pos)
  SelStartX          AS LONG      'selection's start x-pos
  SelStartY          AS LONG      'selection's start y-pos (line)
  SelEndX            AS LONG      'selection's end x-pos
  SelEndY            AS LONG      'selection's end y-pos (line)
  SelClickedY        AS LONG      'selection's absolute start y-pos (line)
  dSelStartX         AS LONG      'selection's start x-pos on double-clicked word
  dSelStartY         AS LONG      'selection's start y-pos on double-clicked word
  dSelEndX           AS LONG      'selection's end x-pos on double-clicked word
  SelLen             AS LONG      'selection length
  ColorPage          AS LONG      'editor's page color
  ColorTxtBk         AS LONG      'text background color
  ColorTxt           AS LONG      'text color
  ColorSyntaxAsm     AS LONG      'syntax color for inline Asm code - default RED
  ColorSyntaxCode    AS LONG      'syntax color for PB code - default BLUE
  ColorSyntaxPBForms AS LONG      'syntax color for PBForms statement line - default BROWN
  ColorSyntaxRem     AS LONG      'syntax color for uncommented code (rem) - default GREEN
  ColorSyntaxString  AS LONG      'syntax color for strings - default RED
  ColorGridLine      AS LONG      'gridline color
  hFont              AS DWORD     'editor font handle
  fUserFont          AS LONG      ' if zero, the control owns the font
  hBrushBMark        AS DWORD
  hBrushScrlBar      AS DWORD
  Changed            AS LONG      'flag for changed or not (for save needs)
  FileType           AS LONG      'file type value
  kbShortCuts        AS LONG      'flag for built-in keyboard shortcuts (in WM_CHAR)
  ReadOnly           AS LONG      'flag for readonly mode
  LineUpdate         AS LONG      'internal flag for WM_PAINT.
  ScrollMode         AS LONG      'flag for ScrollLock key
  ShowGridLines      AS LONG      'flag for show/hide gridlines
  ShowNonPrintChars  AS LONG      'flag for show/hide non-printable characters
  ShowSyntaxColor    AS LONG      'flag for syntax coloring on/off
  WordWrap           AS LONG      'flag for static wordWrap when loading a file
  heapbMarks         AS DWORD     'handle to heap, bMarks memory block
  heapTxt            AS DWORD     'handle to heap, txt memory block
  heapLineEnd        AS DWORD     'handle to heap, LineEnd memory block
  heapUndo           AS DWORD     'handle to heap, Undo structure memory block
  heapUndotxt        AS DWORD     'handle to heap, Undo text memory block
  bMarks             AS DWORD     'pointer to bookmarks memory block, Longs, 4 byte boundary
  LineEnd            AS DWORD     'pointer to line end memory block, Longs, 4 byte boundary
  txt                AS DWORD     'pointer to main text memory block (dynamic block length)
  txtLen             AS LONG      'holds text length, main text
  UBtxBuf            AS LONG      'holds number of lines in main text (Ubound txt)
  kwCase             AS LONG      'if all keywords shall be converted to UCASE or not on syntax parsing
  pData              AS DWORD     'pointer to PB keywords array, dynamic strings, fixed block length
  pDataEndPos        AS DWORD     'pointer to PB keywords end points in memory block
  pStartCount        AS DWORD     'pointer to PB keywords index, Startcount (A, B, C, etc,)
  pEndCount          AS DWORD     'pointer to PB keywords index, Endcount
  hData              AS DWORD     'pointer to HTML keywords array, dynamic strings, fixed block length
  hDataEndPos        AS DWORD     'pointer to HTML keywords end points in memory block
  hStartCount        AS DWORD     'pointer to HTML keywords index, Startcount (A, B, C, etc,)
  hEndCount          AS DWORD     'pointer to HTML keywords index, Endcount
  rData              AS DWORD     'pointer to RC keywords array, dynamic strings, fixed block length
  rDataEndPos        AS DWORD     'pointer to RC keywords end points in memory block
  rStartCount        AS DWORD     'pointer to RC keywords index, Startcount (A, B, C, etc,)
  rEndCount          AS DWORD     'pointer to RC keywords index, Endcount
  tabSize            AS LONG      'default tab size is set to 4 space characters
  undoCount          AS LONG      'counter for undo/redo actions
  undoPos            AS LONG      'position for undo/redo action
  undotxt            AS DWORD     'pointer to undo/redo text
  undo               AS UNDODATA PTR ' pointer to undo/redo data
  fName              AS ASCIIZ * %MAX_PATH  'this enables control to store loaded file's path and name
END TYPE

'------------------------------------------------------------------------------
DECLARE FUNCTION CreateEdm32edit(BYVAL hWnd AS DWORD, BYVAL CtrlId AS LONG, _
                                 BYVAL vLeft AS LONG, BYVAL vTop AS LONG, _
                                 BYVAL vWidth AS LONG, BYVAL vHeight AS LONG, _
                                 BYVAL wStyle AS LONG, BYVAL wStyleEx AS LONG, _
                                 BYVAL DDTstyle AS LONG) AS DWORD

DECLARE FUNCTION ctlWndProc(BYVAL hWnd   AS DWORD, BYVAL wMsg   AS DWORD,_
                            BYVAL wParam AS LONG, BYVAL lParam AS LONG) AS LONG
DECLARE FUNCTION ctmCaretHandler(BYVAL hWnd AS DWORD, BYVAL wParam AS LONG, BYVAL lParam AS LONG) AS LONG
DECLARE FUNCTION ctmChar(BYVAL hWnd AS DWORD, BYVAL wParam AS LONG, BYVAL lParam AS LONG) AS LONG
DECLARE FUNCTION ctmCommand(BYVAL hWnd AS DWORD, BYVAL wParam AS LONG, BYVAL lParam AS LONG) AS LONG
DECLARE FUNCTION ctmCreate(BYVAL hWnd AS DWORD, BYVAL lParam AS LONG) AS LONG
DECLARE FUNCTION ctmCtlColorStatic(BYVAL hWnd AS DWORD, BYVAL wParam AS LONG, BYVAL lParam AS LONG) AS LONG
DECLARE FUNCTION ctmDestroy(BYVAL hWnd AS DWORD) AS LONG
DECLARE FUNCTION ctmHscroll(BYVAL hWnd AS DWORD, BYVAL wParam AS LONG, BYVAL lParam AS LONG) AS LONG
DECLARE FUNCTION ctmKeyDown(BYVAL hWnd AS DWORD, BYVAL wParam AS LONG, BYVAL lParam AS LONG) AS LONG
DECLARE FUNCTION ctmKeyUp(BYVAL hWnd AS DWORD, BYVAL wParam AS LONG, BYVAL lParam AS LONG) AS LONG
DECLARE FUNCTION ctmKillFocus(BYVAL hWnd AS DWORD, BYVAL wParam AS LONG) AS LONG
DECLARE FUNCTION ctmMouseLButtonDblClk(BYVAL hWnd AS DWORD, BYVAL wParam AS LONG, BYVAL lParam AS LONG) AS LONG
DECLARE FUNCTION ctmMouseLButtonDown(BYVAL hWnd AS DWORD, BYVAL wParam AS LONG, BYVAL lParam AS LONG) AS LONG
DECLARE FUNCTION ctmMouseLButtonUp(BYVAL hWnd AS DWORD, BYVAL wParam AS LONG, BYVAL lParam AS LONG) AS LONG
DECLARE FUNCTION ctmMouseMove(BYVAL hWnd AS DWORD, BYVAL wParam AS LONG, BYVAL lParam AS LONG) AS LONG
DECLARE FUNCTION ctmMouseRButtonDown(BYVAL hWnd AS DWORD, BYVAL wParam AS LONG, BYVAL lParam AS LONG) AS LONG
DECLARE FUNCTION ctmMouseRButtonDblClk(BYVAL hWnd   AS DWORD, BYVAL wParam AS LONG, BYVAL lParam AS LONG) AS LONG
DECLARE FUNCTION ctmMouseWheel(BYVAL hWnd AS DWORD, BYVAL wParam AS LONG, BYVAL lParam AS LONG) AS LONG
DECLARE FUNCTION ctmPaint(BYVAL hWnd AS DWORD, BYVAL wParam AS LONG) AS LONG
DECLARE FUNCTION ctmSetFocus(BYVAL hWnd AS DWORD, BYVAL wParam AS LONG) AS LONG
DECLARE FUNCTION ctmSetFont(BYVAL hWnd AS DWORD, BYVAL wParam AS LONG, BYVAL lParam AS LONG) AS LONG
DECLARE FUNCTION ctmSize(BYVAL hWnd AS DWORD, BYVAL wParam AS LONG, BYVAL lParam AS LONG) AS LONG
DECLARE FUNCTION ctmTimer(BYVAL hWnd AS DWORD, BYVAL wParam AS LONG, BYVAL lParam AS LONG) AS LONG
DECLARE FUNCTION ctmVscroll(BYVAL hWnd AS DWORD, BYVAL wParam AS LONG, BYVAL lParam AS LONG) AS LONG

DECLARE FUNCTION edmArrayScan(BYVAL txt AS STRING, BYVAL mb AS LONG, BYVAL Idx AS LONG, _
                              BYVAL dStart AS LONG, BYVAL dEnd AS LONG) AS LONG
DECLARE FUNCTION edmBookMarked(BYVAL hWnd AS DWORD, BYVAL y AS LONG) AS LONG
DECLARE FUNCTION edmBookMarkGetCount(BYVAL hWnd AS DWORD) AS LONG
DECLARE FUNCTION edmBookMarkGetNext(BYVAL hWnd AS DWORD, BYVAL y AS LONG) AS LONG
DECLARE FUNCTION edmBookMarkGetPrev(BYVAL hWnd AS DWORD, BYVAL y AS LONG) AS LONG
DECLARE FUNCTION edmBookMarksToList(BYVAL hWnd AS DWORD, BYVAL lsthWnd AS LONG) AS LONG
DECLARE FUNCTION edmClipboardGetText () AS STRING
DECLARE FUNCTION edmClipboardPutText (BYVAL txt AS STRING) AS LONG
DECLARE FUNCTION edmFullLineProc(BYVAL hWnd AS DWORD, BYVAL wParam AS LONG, BYVAL lParam AS LONG) AS LONG
DECLARE FUNCTION edmGetFileName(BYVAL hWnd AS DWORD) AS STRING
DECLARE FUNCTION edmGetWordLimits(BYVAL hWnd AS DWORD, BYVAL StartOrEnd AS LONG, ed AS EDM32DATA) AS LONG
DECLARE FUNCTION edmLoadFile(BYVAL hWnd AS DWORD, BYVAL wParam AS LONG, BYVAL lParam AS LONG) AS LONG
DECLARE FUNCTION edmMakeFont(BYVAL FontName AS STRING, BYVAL PointSize AS LONG, BYVAL fBold AS LONG, _
                             BYVAL fItalic AS LONG, BYVAL fUnderline AS LONG) AS DWORD
DECLARE FUNCTION edmSetFontEditor(BYVAL hWnd AS DWORD, BYVAL FontName AS STRING, BYVAL PointSize AS LONG, _
                                  BYVAL fBold AS LONG, BYVAL fItalic AS LONG, BYVAL fUnderline AS LONG) AS DWORD
DECLARE FUNCTION edmTxtFindCRLF(BYVAL s AS STRING) AS STRING
DECLARE FUNCTION edmTxtFindNext(BYVAL hWnd AS DWORD, BYVAL s AS STRING, BYVAL dr AS LONG, _
                                BYVAL mc AS LONG, BYVAL wo AS LONG, BYVAL eRedraw AS LONG) AS LONG
DECLARE FUNCTION edmTxtReplaceAll(BYVAL hWnd AS DWORD, BYVAL s AS STRING, BYVAL r AS STRING, _
                                  BYVAL mc AS LONG, BYVAL wo AS LONG, CountOnly AS LONG) AS LONG
DECLARE FUNCTION edmTxtGetLine(BYVAL hWnd AS DWORD, BYVAL y AS LONG) AS STRING
DECLARE FUNCTION edmTxtGetLineLen(ed AS EDM32DATA, BYVAL y AS LONG) AS LONG
DECLARE FUNCTION edmTxtGetLineStart(ed AS EDM32DATA, BYVAL y AS LONG) AS LONG
DECLARE FUNCTION edmTxtGetMaxLineLen(BYVAL hWnd AS DWORD) AS LONG
DECLARE FUNCTION edmTxtGetPos(BYVAL hWnd AS DWORD, BYVAL x AS LONG, BYVAL y AS LONG) AS LONG
DECLARE FUNCTION edmTxtGetSelLength(ed AS EDM32DATA) AS LONG
DECLARE FUNCTION edmTxtGetSelText(BYVAL hWnd AS DWORD, BYVAL selFlag AS LONG) AS STRING
DECLARE FUNCTION edmTxtGetFileSummary(BYVAL hWnd AS DWORD) AS STRING
DECLARE FUNCTION edmTxtInit(ed AS EDM32DATA) AS DWORD
DECLARE FUNCTION edmUndoGetDescription(BYVAL hWnd AS DWORD, BYVAL UndoOrRedo AS LONG) AS STRING
DECLARE FUNCTION edmUndoGetString(BYVAL iType AS LONG) AS STRING
DECLARE FUNCTION edmUndoInit(ed AS EDM32DATA) AS DWORD
DECLARE FUNCTION edmUCASER(BYVAL st AS STRING) AS STRING
DECLARE FUNCTION edmWordCount(a$) AS LONG
DECLARE FUNCTION edmWrapText(BYVAL txt AS STRING, BYVAL nw AS LONG, BYVAL strip AS LONG) AS STRING
DECLARE FUNCTION LoadPBdata(ed AS EDM32DATA) AS LONG
DECLARE FUNCTION LoadHTMLdata(ed AS EDM32DATA) AS LONG
DECLARE FUNCTION LoadRCdata(ed AS EDM32DATA) AS LONG
DECLARE FUNCTION MakeScrlBitMap(BYVAL hDlg AS DWORD) AS DWORD
DECLARE FUNCTION MakeScrollInfoLabel(BYVAL hParent AS DWORD) AS DWORD

DECLARE SUB edmBookMarkDelete(ed AS EDM32DATA, BYVAL POS AS LONG, BYVAL Count AS LONG)
DECLARE SUB edmBookMarkInitialize(BYVAL hWnd AS DWORD)
DECLARE SUB edmBookMarkInsert(ed AS EDM32DATA, BYVAL POS AS LONG, BYVAL Count AS LONG)
DECLARE SUB edmBookMarkResetAll(BYVAL hWnd AS DWORD)
DECLARE SUB edmBookMarkSet(BYVAL hWnd AS DWORD, BYVAL y AS LONG, BYVAL bmVal AS LONG)
DECLARE SUB edmCheckXYbounds(ed AS EDM32DATA)
DECLARE SUB edmLCASE(a$)
DECLARE SUB edmMCASE(a$)
DECLARE SUB edmTCASE(a$)
DECLARE SUB edmUCASE(a$)
DECLARE SUB edmGetSubs(BYVAL hWnd AS DWORD, BYVAL hCombo AS DWORD, BYVAL hList AS DWORD)
DECLARE SUB ctmPaintBasic(BYVAL hWnd AS DWORD, BYVAL Buf AS STRING, BYVAL yLine AS LONG)
DECLARE SUB ctmPaintHtml(BYVAL hWnd AS DWORD, BYVAL Buf AS STRING, BYVAL yLine AS LONG)
DECLARE SUB ctmPaintRc(BYVAL hWnd AS DWORD, BYVAL Buf AS STRING, BYVAL yLine AS LONG)
DECLARE SUB ctmPaintSelection(BYVAL hWnd AS DWORD)
DECLARE SUB edmSelectSub(BYVAL hWnd AS DWORD, KeepSelect AS LONG, ed AS EDM32DATA)
DECLARE SUB edmSelectWord(BYVAL hWnd AS DWORD, KeepSelect AS LONG, ed AS EDM32DATA)
DECLARE SUB edmSetFileName(BYVAL hWnd AS DWORD, BYVAL fName AS STRING)
DECLARE SUB edmSetScrollData(BYVAL hWnd AS DWORD, BYVAL vhPage AS LONG, BYVAL vhMax AS LONG, _
                             BYVAL vhPos AS LONG, BYVAL vhBar AS LONG)
DECLARE SUB edmSetText(BYVAL hWnd AS DWORD, BYVAL txt AS STRING)
DECLARE SUB edmTxtAddToLineEnds(ed AS EDM32DATA, BYVAL addThis AS LONG)
DECLARE SUB edmTxtDeleteSel(ed AS EDM32DATA, BYVAL selFlag AS LONG, BYVAL uFlag AS LONG, BYVAL iType AS LONG)
DECLARE SUB edmTxtGetXYpos(ed AS EDM32DATA, BYVAL POS AS LONG, x AS LONG, y AS LONG)
DECLARE SUB edmTxtLineEndResize(ed AS EDM32DATA, BYVAL ii AS LONG)
DECLARE SUB edmTxtPutString(ed AS EDM32DATA, BYVAL s AS STRING, BYVAL x AS LONG, BYVAL y AS LONG, _
                            BYVAL mFlag AS LONG, BYVAL uFlag AS LONG, BYVAL iType AS LONG)
DECLARE SUB edmTxtResizeBlocks(ed AS EDM32DATA, BYVAL nSize AS LONG)
DECLARE SUB edmTxtUpDateLineEnds(ed AS EDM32DATA, BYVAL xp AS LONG, BYVAL lp AS LONG)
DECLARE SUB edmUndoAdd(ed AS EDM32DATA, BYVAL act AS LONG, BYVAL iType AS LONG, BYVAL txt AS STRING, _
                       BYVAL x1 AS LONG, BYVAL y1 AS LONG, BYVAL x2 AS LONG, BYVAL y2 AS LONG)
DECLARE SUB edmUndoDoRedo(ed AS EDM32DATA)
DECLARE SUB edmUndoDoUndo(ed AS EDM32DATA)
DECLARE SUB edmUndoRedoFillList(BYVAL lsthWnd AS DWORD, BYVAL edhWnd AS DWORD, BYVAL UndoOrRedo AS LONG)