[878] | 1 | /***********************************************************************
|
---|
[2] | 2 |
|
---|
[878] | 3 | $Id: mle.h 902 2008-01-05 02:47:56Z stevenhl $
|
---|
| 4 |
|
---|
| 5 | headers for internal viewer/editor
|
---|
| 6 |
|
---|
| 7 | Copyright (c) 1993-98 M. Kimes
|
---|
[902] | 8 | Copyright (c) 2002, 2008 Steven H. Levine
|
---|
[878] | 9 |
|
---|
| 10 | 26 Nov 07 Add items to XMLEWNDPTR struct for "Save as" & readonly file handling
|
---|
[902] | 11 | 04 Jan 08 SHL Allow standalone usage
|
---|
[878] | 12 |
|
---|
| 13 | ***********************************************************************/
|
---|
| 14 |
|
---|
[902] | 15 | #if !defined(MLE_H)
|
---|
| 16 | #define MLE_H
|
---|
| 17 |
|
---|
| 18 | #if !defined(OS2_INCLUDED)
|
---|
| 19 | #define INCL_WINMLE
|
---|
| 20 | #include <os2.h>
|
---|
| 21 | #else
|
---|
| 22 | #if !defined(INCL_WINMLE)
|
---|
| 23 | #error INCL_WINMLE required
|
---|
| 24 | #endif
|
---|
| 25 | #endif // OS2_INCLUDED
|
---|
| 26 |
|
---|
[2] | 27 | /* MLE support macros */
|
---|
| 28 |
|
---|
| 29 | /* return number of lines in file */
|
---|
| 30 | #define MLEnumlines(h) (LONG)WinSendMsg((h),MLM_QUERYLINECOUNT,\
|
---|
| 31 | MPVOID,MPVOID)
|
---|
| 32 |
|
---|
| 33 | /* return line # from position i */
|
---|
| 34 | #define MLElinefrompos(h,i) (LONG)WinSendMsg((h),MLM_LINEFROMCHAR,\
|
---|
| 35 | MPFROMLONG((LONG)(i)),MPVOID)
|
---|
| 36 |
|
---|
| 37 | /* return current position of cursor */
|
---|
| 38 | #define MLEcurpos(h) (IPT)WinSendMsg((h),MLM_QUERYSEL,\
|
---|
| 39 | MPFROM2SHORT(MLFQS_CURSORSEL,0),MPVOID)
|
---|
| 40 |
|
---|
| 41 | /* return current position of anchor */
|
---|
| 42 | #define MLEancpos(h) (IPT)WinSendMsg((h),MLM_QUERYSEL,\
|
---|
| 43 | MPFROM2SHORT(MLFQS_ANCHORSEL,0),MPVOID)
|
---|
| 44 |
|
---|
| 45 | /* return current line # cursor is on */
|
---|
| 46 | #define MLEcurline(h) (LONG)WinSendMsg((h),MLM_LINEFROMCHAR,\
|
---|
| 47 | MPFROMLONG(WinSendMsg((h),MLM_QUERYSEL,\
|
---|
| 48 | MPFROM2SHORT(MLFQS_CURSORSEL,0),MPVOID)),MPVOID)
|
---|
| 49 |
|
---|
| 50 | /* return current line # anchor is on */
|
---|
| 51 | #define MLEancline(h) (LONG)WinSendMsg((h),MLM_LINEFROMCHAR,\
|
---|
| 52 | MPFROMLONG(WinSendMsg((h),MLM_QUERYSEL,\
|
---|
| 53 | MPFROM2SHORT(MLFQS_CURSORSEL,0),MPVOID)),MPVOID)
|
---|
| 54 |
|
---|
| 55 | /* return len of remainder of line at cursor position */
|
---|
| 56 | #define MLEcurlenleft(h) (LONG)WinSendMsg((h),MLM_QUERYFORMATLINELENGTH,\
|
---|
| 57 | MPFROMLONG(-1L),MPVOID)
|
---|
| 58 |
|
---|
| 59 | /* return len of remainder of line at position i */
|
---|
| 60 | #define MLElinelenleft(h,i) (LONG)WinSendMsg((h),MLM_QUERYFORMATLINELENGTH,\
|
---|
| 61 | MPFROMLONG((LONG)i),MPVOID)
|
---|
| 62 |
|
---|
| 63 | /* return total len of current line */
|
---|
| 64 | #define MLEcurlinelen(h) (LONG)WinSendMsg((h),MLM_QUERYFORMATLINELENGTH,\
|
---|
| 65 | MPFROMLONG(WinSendMsg((h),MLM_CHARFROMLINE,\
|
---|
| 66 | MPFROMLONG(-1L),MPVOID)),MPVOID)
|
---|
| 67 |
|
---|
| 68 | /* return total len of line # l */
|
---|
| 69 | #define MLElinelen(h,l) (LONG)WinSendMsg((h),MLM_QUERYFORMATLINELENGTH,\
|
---|
| 70 | MPFROMLONG(WinSendMsg((h),MLM_CHARFROMLINE,\
|
---|
| 71 | MPFROMLONG((l)),MPVOID)),MPVOID)
|
---|
| 72 |
|
---|
| 73 | /* return start pos of current line cursor is on */
|
---|
| 74 | #define MLEstartofcurline(h) (IPT)WinSendMsg((h),MLM_CHARFROMLINE,\
|
---|
| 75 | MPFROMLONG(-1L),MPVOID)
|
---|
| 76 |
|
---|
| 77 | /* return start pos of line l */
|
---|
| 78 | #define MLEstartofline(h,l) (IPT)WinSendMsg((h),MLM_CHARFROMLINE,\
|
---|
| 79 | MPFROMLONG((l)),MPVOID)
|
---|
| 80 |
|
---|
| 81 | /* copy selected text into buffer b, return len of text copied */
|
---|
| 82 | #define MLEgetseltext(h,b) (LONG)WinSendMsg((h),MLM_QUERYSELTEXT,\
|
---|
| 83 | MPFROMP((b)),MPVOID)
|
---|
| 84 |
|
---|
| 85 | /* insert text s into selection */
|
---|
| 86 | #define MLEinsert(h,s) WinSendMsg((h),MLM_INSERT,MPFROMP((s)),MPVOID)
|
---|
| 87 |
|
---|
| 88 | /* delete text from pos f to pos t */
|
---|
| 89 | #define MLEdelete(h,f,t) (LONG)WinSendMsg(h,MLM_DELETE,\
|
---|
| 90 | MPFROMLONG((IPT)(f)),\
|
---|
| 91 | MPFROMLONG((LONG)(t)))
|
---|
| 92 |
|
---|
| 93 | /* set current cursor (and anchor) position to i */
|
---|
| 94 | #define MLEsetcurpos(h,i) WinSendMsg((h),MLM_SETSEL,\
|
---|
| 95 | MPFROMLONG((LONG)(i)),MPFROMLONG((LONG)(i)))
|
---|
| 96 |
|
---|
| 97 | /* set current cursor position to i, don't move anchor */
|
---|
| 98 | #define MLEsetcurposc(h,i) WinSendMsg((h),MLM_SETSEL,\
|
---|
| 99 | MPFROMLONG((LONG)(i)),MPFROMLONG(-1L))
|
---|
| 100 |
|
---|
| 101 | /* set current anchor position to i, don't move cursor */
|
---|
| 102 | #define MLEsetcurposa(h,i) WinSendMsg((h),MLM_SETSEL,\
|
---|
| 103 | MPFROMLONG(-1L),MPFROMLONG((LONG)(i)))
|
---|
| 104 |
|
---|
| 105 | /* set first line in window to line # l */
|
---|
| 106 | #define MLEsettopline(h,l) WinSendMsg((h),MLM_SETFIRSTCHAR,(MPARAM)\
|
---|
| 107 | WinSendMsg((h),MLM_CHARFROMLINE,\
|
---|
| 108 | WinSendMsg((h),MLM_LINEFROMCHAR,\
|
---|
| 109 | MPFROMLONG((LONG)(l)),MPVOID),\
|
---|
| 110 | MPVOID),MPVOID)
|
---|
| 111 |
|
---|
| 112 | /* set changed flag to boolean state b */
|
---|
| 113 | #define MLEsetchanged(h,b) WinSendMsg((h),MLM_SETCHANGED,\
|
---|
| 114 | MPFROM2SHORT((b),0),MPVOID)
|
---|
| 115 |
|
---|
| 116 | /* get changed flag */
|
---|
| 117 | #define MLEgetchanged(h) (BOOL)WinSendMsg((h),MLM_QUERYCHANGED,MPVOID,MPVOID)
|
---|
| 118 |
|
---|
| 119 | /* set MLE wrap to boolean state b */
|
---|
| 120 | #define MLEsetwrap(h,b) WinSendMsg((h),MLM_SETWRAP,MPFROM2SHORT((b),0),\
|
---|
| 121 | MPVOID)
|
---|
| 122 |
|
---|
| 123 | /* return MLE wrap boolean state */
|
---|
| 124 | #define MLEgetwrap(h) (BOOL)WinSendMsg((h),MLM_QUERYWRAP,MPVOID,MPVOID)
|
---|
| 125 |
|
---|
| 126 | /* set MLE readonly to boolean state b */
|
---|
| 127 | #define MLEsetreadonly(h,b) WinSendMsg((h),MLM_SETREADONLY,\
|
---|
| 128 | MPFROM2SHORT((b),0),MPVOID)
|
---|
| 129 |
|
---|
| 130 | /* return MLE readonly boolean state */
|
---|
| 131 | #define MLEgetreadonly(h) (BOOL)WinSendMsg((h),MLM_QUERYREADONLY,MPVOID,MPVOID)
|
---|
| 132 |
|
---|
| 133 | /* set text limit to l */
|
---|
| 134 | #define MLEsetlimit(h,l) WinSendMsg((h),MLM_SETTEXTLIMIT,\
|
---|
| 135 | MPFROMLONG((LONG)(l)),MPVOID)
|
---|
| 136 |
|
---|
| 137 | /* return text limit */
|
---|
| 138 | #define MLEgetlimit(h) (LONG)WinSendMsg((h),MLM_QUERYFORMATTEXTLIMIT,MPVOID,MPVOID)
|
---|
| 139 |
|
---|
| 140 | /* set format to format f */
|
---|
| 141 | #define MLEsetformat(h,f) WinSendMsg((h),MLM_FORMAT,\
|
---|
| 142 | MPFROM2SHORT((f),0), MPVOID)
|
---|
| 143 |
|
---|
| 144 | /* disable MLE refresh */
|
---|
| 145 | #define MLEdisable(h) WinSendMsg((h),MLM_DISABLEREFRESH,MPVOID,MPVOID)
|
---|
| 146 |
|
---|
| 147 | /* enable MLE refresh */
|
---|
| 148 | #define MLEenable(h) WinSendMsg((h),MLM_ENABLEREFRESH,MPVOID,MPVOID)
|
---|
| 149 |
|
---|
| 150 | /* clear (cut and discard) current selection */
|
---|
| 151 | #define MLEclear(h) WinSendMsg((h),MLM_CLEAR,MPVOID,MPVOID)
|
---|
| 152 |
|
---|
| 153 | /* cut current selection to clipboard */
|
---|
| 154 | #define MLEcut(h) WinSendMsg((h),MLM_CUT,MPVOID,MPVOID)
|
---|
| 155 |
|
---|
| 156 | /* copy current selection to clipboard */
|
---|
| 157 | #define MLEcopy(h) WinSendMsg((h),MLM_COPY,MPVOID,MPVOID)
|
---|
| 158 |
|
---|
| 159 | /* paste clipboard into current selection */
|
---|
| 160 | #define MLEpaste(h) WinSendMsg((h),MLM_PASTE,MPVOID,MPVOID)
|
---|
| 161 |
|
---|
| 162 | /* undo last MLE operation */
|
---|
| 163 | #define MLEundo(h) WinSendMsg((h),MLM_UNDO,MPVOID,MPVOID)
|
---|
| 164 |
|
---|
| 165 | /* return length of text in MLE */
|
---|
| 166 | #define MLEgetlen(h) (LONG)WinSendMsg((h),MLM_QUERYFORMATTEXTLENGTH,\
|
---|
| 167 | MPFROMLONG(0),MPFROMLONG((LONG)WinSendMsg((h),\
|
---|
| 168 | MLM_QUERYTEXTLENGTH,MPVOID,MPVOID)))
|
---|
| 169 |
|
---|
| 170 | /* select all text in MLE */
|
---|
| 171 | #define MLEselectall(h) WinSendMsg((h),MLM_SETSEL,MPFROMLONG(0L),\
|
---|
| 172 | (MPARAM)WinSendMsg((h),MLM_QUERYFORMATTEXTLENGTH,\
|
---|
| 173 | MPFROMLONG(0),MPFROMLONG(0xfffffffe)))
|
---|
| 174 |
|
---|
| 175 | /* select all text in MLE from cursor to end of file */
|
---|
| 176 | #define MLEselecttoeof(h) WinSendMsg((h),MLM_SETSEL,\
|
---|
| 177 | (IPT)WinSendMsg((h),MLM_QUERYSEL,\
|
---|
| 178 | MPFROM2SHORT(MLFQS_CURSORSEL,0),MPVOID),\
|
---|
| 179 | (MPARAM)WinSendMsg((h),MLM_QUERYFORMATTEXTLENGTH,\
|
---|
| 180 | MPFROMLONG(0),MPFROMLONG(0xfffffffe)))
|
---|
| 181 |
|
---|
| 182 | /* set anchor point equal to cursor point (no text will be selected) */
|
---|
| 183 | #define MLEanctocur(h) WinSendMsg((h),MLM_SETSEL,\
|
---|
| 184 | MPFROMLONG((LONG)WinSendMsg((h),MLM_QUERYSEL,\
|
---|
| 185 | MPFROM2SHORT(MLFQS_CURSORSEL,0),MPVOID)),\
|
---|
| 186 | MPFROMLONG(-1L))
|
---|
| 187 |
|
---|
| 188 | /* set cursor point equal to anchor point (no text will be selected) */
|
---|
| 189 | #define MLEcurtoanc(h) WinSendMsg((h),MLM_SETSEL,MPFROMLONG(-1L),\
|
---|
| 190 | MPFROMLONG((LONG)WinSendMsg((h),MLM_QUERYSEL,\
|
---|
| 191 | MPFROM2SHORT(MLFQS_ANCHORSEL,0),MPVOID)))
|
---|
| 192 |
|
---|
| 193 | /* swap cursor point with anchor point */
|
---|
| 194 | #define MLEswappoints(h) WinSendMsg((h),MLM_SETSEL,\
|
---|
| 195 | MPFROMLONG((LONG)WinSendMsg((h),MLM_QUERYSEL,\
|
---|
| 196 | MPFROM2SHORT(MLFQS_ANCHORSEL,0),MPVOID)),\
|
---|
| 197 | MPFROMLONG((LONG)WinSendMsg((h),MLM_QUERYSEL,\
|
---|
| 198 | MPFROM2SHORT(MLFQS_CURSORSEL,0),MPVOID)))
|
---|
| 199 |
|
---|
| 200 | /* declarations of functions in mle.c */
|
---|
[551] | 201 | LONG MLEgetlinetext(HWND h, LONG l, CHAR * buf, INT maxlen);
|
---|
| 202 | LONG MLEdeleteline(HWND h, LONG l);
|
---|
| 203 | LONG MLEdeletecurline(HWND h);
|
---|
| 204 | LONG MLEdeletetoeol(HWND h);
|
---|
| 205 | VOID MLEclearall(HWND h);
|
---|
| 206 | LONG MLEtextatcursor(HWND h, CHAR * buffer, INT buflen);
|
---|
| 207 | LONG MLEtextatpos(HWND h, IPT i, CHAR * buffer, INT buflen);
|
---|
| 208 | LONG MLEsizeofsel(HWND h);
|
---|
| 209 | BOOL MLEdoblock(HWND h, INT action, CHAR * filename);
|
---|
| 210 | BOOL MLEquotepara(HWND h, CHAR * initials, BOOL fQuoteOld);
|
---|
| 211 | BOOL MLEinsertfile(HWND h, CHAR * filename);
|
---|
| 212 | BOOL MLEHexLoad(HWND h, CHAR * filename);
|
---|
| 213 | BOOL MLEloadfile(HWND h, CHAR * filename);
|
---|
| 214 | INT MLEbackgroundload(HWND hwndReport, ULONG msg, HWND h, CHAR * filename,
|
---|
| 215 | INT hex);
|
---|
| 216 | BOOL MLEexportfile(HWND h, CHAR * filename, INT tabspaces,
|
---|
| 217 | BOOL striptraillines, BOOL striptrailspaces);
|
---|
| 218 | typedef struct
|
---|
| 219 | {
|
---|
| 220 | USHORT size;
|
---|
| 221 | BOOL fInsensitive;
|
---|
| 222 | BOOL sandr;
|
---|
| 223 | BOOL rall;
|
---|
| 224 | HWND hwndmle;
|
---|
[2] | 225 | MLE_SEARCHDATA se;
|
---|
[551] | 226 | CHAR search[258];
|
---|
| 227 | CHAR replace[258];
|
---|
| 228 | }
|
---|
| 229 | SRCHPTR;
|
---|
| 230 | MRESULT EXPENTRY SandRDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
| 231 | BOOL MLEfindfirst(HWND hwnd, SRCHPTR * vw);
|
---|
| 232 | INT MLEfindnext(HWND hwnd, SRCHPTR * vw);
|
---|
| 233 | VOID MLEinternet(HWND h, BOOL ftp);
|
---|
[2] | 234 |
|
---|
| 235 | /* declarations of functions in mlefont.c */
|
---|
[551] | 236 | FATTRS *SetMLEFont(HWND hwndMLE, FATTRS * fattrs, ULONG flags);
|
---|
[2] | 237 |
|
---|
| 238 | /* struct used by MLE editor/viewer, saved in window pointer */
|
---|
| 239 |
|
---|
[551] | 240 | typedef struct
|
---|
| 241 | {
|
---|
| 242 | USHORT size;
|
---|
| 243 | USHORT hex;
|
---|
| 244 | HAB hab;
|
---|
| 245 | BOOL fWrap;
|
---|
| 246 | SRCHPTR srch;
|
---|
| 247 | HWND hwndMenu;
|
---|
| 248 | HWND hwndPopupMenu;
|
---|
| 249 | HACCEL accel;
|
---|
| 250 | BOOL ch;
|
---|
| 251 | BOOL fStripTrail;
|
---|
| 252 | BOOL fStripTrailLines;
|
---|
| 253 | INT ExpandTabs;
|
---|
| 254 | INT TabStops;
|
---|
| 255 | CHAR exportfilename[1027];
|
---|
| 256 | CHAR importfilename[1027];
|
---|
[878] | 257 | BOOL fileattrreadonly;
|
---|
[551] | 258 | FATTRS fattrs;
|
---|
| 259 | ULONG cp;
|
---|
| 260 | INT busy;
|
---|
| 261 | ULONG lastpos;
|
---|
| 262 | BOOL killme;
|
---|
[878] | 263 | BOOL saveas;
|
---|
[551] | 264 | BOOL dontclose;
|
---|
| 265 | HWND hwndRestore, hwndFrame, hwndParent;
|
---|
| 266 | }
|
---|
| 267 | XMLEWNDPTR;
|
---|
[2] | 268 |
|
---|
| 269 | /* declarations of functions in mlemain.c */
|
---|
[551] | 270 | HWND StartMLEEditor(HWND hwnd, INT flags, CHAR * filename, HWND hwndRestore);
|
---|
| 271 | MRESULT EXPENTRY MLEEditorProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
[2] | 272 |
|
---|
| 273 | /* MLEdoblock() actions */
|
---|
| 274 |
|
---|
| 275 | #define UPPERCASE 1
|
---|
| 276 | #define LOWERCASE 2
|
---|
| 277 | #define TOGGLECASE 3
|
---|
| 278 | #define ROT13 4
|
---|
| 279 | #define FORMAT 5
|
---|
| 280 | #define XOR 6
|
---|
| 281 | #define WRITE 7
|
---|
| 282 | #define APPENDCLIP 8
|
---|
| 283 |
|
---|
| 284 | #define ParentOf(hwnd) WinQueryWindow((hwnd),QW_PARENT)
|
---|
| 285 | #define GrandparentOf(hwnd) WinQueryWindow(WinQueryWindow(hwnd,QW_PARENT),QW_PARENT)
|
---|
[902] | 286 |
|
---|
| 287 | #endif // MLE_H
|
---|