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