home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
MLEVIEW.ZIP
/
MLEVIEW.C
< prev
next >
Wrap
Text File
|
1991-04-04
|
51KB
|
1,252 lines
#pragma title("MLEView - A Text File Browser")
/*--------------------------------------------------------------------*/
/* MLEView -- A Text File View Utility */
/* Copyright (C) W. David Ashley, 1991 */
/*--------------------------------------------------------------------*/
#define INCL_DOS
#define INCL_WIN
#define INCL_WINHELP
#define INCL_WINMLE
#define INCL_GPI
#define INCL_GPILCIDS
#include <os2.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <filedlg.h>
#include "MLEView.h"
#include "ezfonts.h"
#define LCID_MYFONT 199
MRESULT EXPENTRY ClientProc (HWND, USHORT, MPARAM, MPARAM);
MRESULT EXPENTRY AboutDlgProc (HWND, USHORT, MPARAM, MPARAM);
MRESULT EXPENTRY SetFontDlgProc (HWND, USHORT, MPARAM, MPARAM);
MRESULT EXPENTRY SampleTextProc (HWND, USHORT, MPARAM, MPARAM);
MRESULT EXPENTRY SetColorDlgProc (HWND, USHORT, MPARAM, MPARAM);
MRESULT EXPENTRY SampleColorProc (HWND, USHORT, MPARAM, MPARAM);
MRESULT EXPENTRY FindDlgProc (HWND, USHORT, MPARAM, MPARAM);
static VOID MLEInit (VOID);
static VOID MLELoad (VOID);
static VOID FillFontListBox (HWND);
static VOID FillSizeListBox (HWND);
static VOID FillForgListBox (HWND);
static VOID FillBakgListBox (HWND);
HAB hab; /* application anchor block */
ULONG flFrameFlags = FCF_STANDARD; /* frame style flags */
PSZ pszFile = NULL; /* select dlg filename */
PSZ Filename = NULL; /* viewed file name */
HFILE hFile = 0; /* viewed file handle */
HWND hwndFrame, hwndClient; /* handles of app wnds */
HWND hwndMLE; /* handles of MLE wnd */
HWND hwndTitleBar; /* handle of title bar wnd */
HWND hwndMenu; /* handle of menu bar wnd */
HWND hwndFont; /* handle of font dlg wnd */
HWND hwndColor; /* handle of color dlg wnd */
PCHAR szMLEViewClass = "MLEViewClss";/* class for main client wnd */
PCHAR szSampleClass = "SampleClass"; /* class for sample text wnd */
PCHAR szSColorClass = "SColorClass"; /* class for color text wnd */
CHAR szTitle [] = "MLEView - "; /* title bar prefix text */
PCHAR szTitleText; /* title bar text */
HELPINIT hmiHelpData; /* help init strucs */
HWND hwndHelpInstance; /* handle of help window */
SHORT sFacenameIndex, sSizeIndex; /* indexes into Ezf font array*/
HINI hiniProfile; /* profile handle */
PCHAR szProfilePath; /* full pathname to profile */
ULONG ulProfileSize; /* size of Profile struct */
struct _PROFILE { /* profile struct */
COLOR clrText;
COLOR clrBackground;
BOOL fWordWrap;
BOOL fCase;
BOOL fWrap;
FATTRS fatFont;
} Profile = {CLR_CYAN, CLR_BLACK, FALSE, TRUE, FALSE,
/* FATTRS init */
{0, 0, 0, "NULL", 0, 0, 0, 0, 0, 0}};
FATTRS fat;
FONTMETRICS fm;
struct _COLORTABLE { /* for use by set color dlg */
LONG clr;
PCHAR szColor;
} ColorTable [17] = {CLR_BLACK, "Black",
CLR_BLUE, "Blue",
CLR_BROWN, "Brown",
CLR_CYAN, "Cyan",
CLR_DARKBLUE, "Dark blue",
CLR_DARKCYAN, "Dark cyan",
CLR_DARKGRAY, "Dark gray",
CLR_DARKGREEN, "Dark green",
CLR_DARKPINK, "Dark pink",
CLR_DARKRED, "Dark red",
CLR_DEFAULT, "Default",
CLR_GREEN, "Green",
CLR_PALEGRAY, "Pale gray",
CLR_PINK, "Pink",
CLR_RED, "Red",
CLR_WHITE, "White",
CLR_YELLOW, "Yellow"};
#pragma subtitle ("main Procedure")
#pragma page()
int cdecl main (int argc, CHAR * argv []) {
HMQ hmq;
QMSG qmsg;
USHORT usVersion;
USHORT usAction;
USHORT usMaxPathLen;
SWP swp;
/* do file system initialization */
DosQSysInfo (0, (PBYTE) &usMaxPathLen, sizeof (usMaxPathLen));
szProfilePath = malloc ((size_t) usMaxPathLen);
szTitleText = malloc ((size_t) (usMaxPathLen + strlen (szTitle)));
strcpy (szTitleText, "MLEView");
Filename = malloc ((size_t) usMaxPathLen);
/* do PM initialization */
hab = WinInitialize (0);
hmq = WinCreateMsgQueue (hab, 0);
WinRegisterClass (hab, szMLEViewClass, ClientProc,
CS_SIZEREDRAW, 0);
WinRegisterClass (hab, szSampleClass, SampleTextProc,
CS_SIZEREDRAW, 0);
WinRegisterClass (hab, szSColorClass, SampleColorProc,
CS_SIZEREDRAW, 0);
/* initialize IPF structure */
hmiHelpData.cb = sizeof (HELPINIT);
hmiHelpData.ulReturnCode = 0;
hmiHelpData.pszTutorialName = 0;
hmiHelpData.phtHelpTable = MAKEP (0xFFFF, IDHT_HELPTABLE);
hmiHelpData.hmodAccelActionBarModule = 0;
hmiHelpData.idAccelTable = 0;
hmiHelpData.idActionBar = 0;
hmiHelpData.pszHelpWindowTitle = "MLEView Help Window";
hmiHelpData.hmodHelpTableModule = 0;
hmiHelpData.usShowPanelId = CMIC_HIDE_PANEL_ID;
hmiHelpData.pszHelpLibraryName = "MLEView.HLP";
/* get profile data */
if (DosSearchPath (SEARCH_ENVIRONMENT, "DPATH", "MLEVIEW.INI",
szProfilePath, usMaxPathLen) > 0)
strcpy (szProfilePath, "MLEVIEW.INI");
if ((hiniProfile = PrfOpenProfile (hab, szProfilePath)) != NULL) {
PrfQueryProfileSize (hiniProfile, "MLEView", "ViewProfile",
&ulProfileSize);
if (ulProfileSize == sizeof (Profile))
PrfQueryProfileData (hiniProfile, "MLEView", "ViewProfile",
&Profile, &ulProfileSize);
else
WinMessageBox (HWND_DESKTOP, HWND_DESKTOP,
"Default Profile in use. This profile\n"
"will be saved in the current directory.",
"Profile Open/Creation Error",
1, MB_OK | MB_APPLMODAL | MB_MOVEABLE);
}
else
WinMessageBox (HWND_DESKTOP, HWND_DESKTOP,
"Default Profile in use. This profile\n"
"will be saved in the current directory.",
"Profile Open/Creation Error",
1, MB_OK | MB_APPLMODAL | MB_MOVEABLE);
/* create instance of IPF */
hwndHelpInstance = WinCreateHelpInstance (hab, &hmiHelpData);
if (!hwndHelpInstance)
WinMessageBox (HWND_DESKTOP, HWND_DESKTOP,
"Help Not Available.",
"Help Creation Error",
1, MB_OK | MB_APPLMODAL | MB_MOVEABLE);
else if (hmiHelpData.ulReturnCode) {
WinMessageBox (HWND_DESKTOP, HWND_DESKTOP,
"Help Terminated Due to Error.",
"Help Creation Error",
1, MB_OK | MB_APPLMODAL | MB_MOVEABLE);
WinDestroyHelpInstance (hwndHelpInstance);
}
/* create main frame and client windows */
hwndFrame = WinCreateStdWindow (HWND_DESKTOP, 0L,
&flFrameFlags, szMLEViewClass,
NULL, WS_VISIBLE,
0, ID_RESOURCE, &hwndClient);
WinQueryWindowPos (hwndClient, &swp);
hwndMLE = WinCreateWindow (hwndClient, WC_MLE, NULL,
MLS_HSCROLL | MLS_VSCROLL |
MLS_READONLY | WS_VISIBLE,
0, 0, swp.cx, swp.cy,
hwndClient, HWND_BOTTOM, 1, NULL, NULL);
WinSetFocus (HWND_DESKTOP, hwndMLE);
/* associate instance of IPF */
if (hwndHelpInstance)
WinAssociateHelpInstance (hwndHelpInstance, hwndFrame);
/* set initial text in the frame title bar */
hwndTitleBar = WinWindowFromID (hwndFrame, FID_TITLEBAR);
WinSetWindowText (hwndTitleBar, szTitleText);
/* get frame window menu bar handle and initialize MLE window */
hwndMenu = WinWindowFromID (WinQueryWindow (hwndClient, QW_PARENT,
FALSE), FID_MENU);
MLEInit ();
/* if a filename was passed as an input argument, process it */
if (argc > 1) {
Filename = argv [1];
DosOpen (Filename, &hFile, &usAction, 0, 0, FILE_OPEN,
OPEN_ACCESS_READONLY | OPEN_SHARE_DENYWRITE, 0);
WinPostMsg (hwndClient, WM_USER_LOADFILE, NULL, NULL);
}
/* window was created invisible, so now show it */
WinShowWindow (hwndFrame, TRUE);
/* main message loop */
while (WinGetMsg (hab, &qmsg, NULL, 0, 0))
WinDispatchMsg (hab, &qmsg);
WinDestroyWindow (hwndFrame);
WinDestroyMsgQueue (hmq);
WinTerminate (hab);
return 0;
}
#pragma subtitle ("ClientProc Procedure")
#pragma page()
/*--------------------------------------------------------------------*/
/* ClientProc - This is the main client window procedure. */
/*--------------------------------------------------------------------*/
MRESULT EXPENTRY ClientProc (HWND hwnd, USHORT msg, MPARAM mp1,
MPARAM mp2) {
LONG lTextLen; /* text length of MLE */
LONG lStart, lEnd; /* selected text length of MLE*/
USHORT usAction; /* file open action */
USHORT usResult; /* file open result */
SWP swp; /* window position */
switch (msg) {
case WM_INITMENU:
switch (SHORT1FROMMP (mp1)) {
case IDM_EDIT:
/* Check to see if any text is selected */
lStart = (LONG) WinSendMsg (hwndMLE, MLM_QUERYSEL,
(MPARAM) MLFQS_MINSEL, 0L);
lEnd = (LONG) WinSendMsg (hwndMLE, MLM_QUERYSEL,
(MPARAM) MLFQS_MAXSEL, 0L);
if (lEnd - lStart > 0L)
/* enable copy menu option */
WinSendMsg (hwndMenu, MM_SETITEMATTR,
MPFROM2SHORT (IDM_COPY, TRUE),
MPFROM2SHORT (MIA_DISABLED, 0));
else
/* disable copy menu option */
WinSendMsg (hwndMenu, MM_SETITEMATTR,
MPFROM2SHORT (IDM_COPY, TRUE),
MPFROM2SHORT (MIA_DISABLED, MIA_DISABLED));
return 0;
default:
break;
}
case WM_COMMAND:
switch (COMMANDMSG (&msg) -> cmd) {
case IDM_OPEN:
/* File open menu item chosen */
usResult = FileOpenDlg (HWND_DESKTOP, NULL, NULL,
"*.*", FILE_NORMAL, NULL,
Filename, &hFile, 0L, &usAction,
FILE_NORMAL, FILE_OPEN,
OPEN_ACCESS_READONLY |
OPEN_SHARE_DENYWRITE,
0l);
if (usResult == FDLG_OK) {
WinDestroyWindow (hwndMLE);
WinQueryWindowPos (hwndClient, &swp);
hwndMLE = WinCreateWindow (hwndClient, WC_MLE, NULL,
MLS_HSCROLL | MLS_VSCROLL |
MLS_READONLY | WS_VISIBLE,
0, 0, swp.cx, swp.cy,
hwnd, HWND_BOTTOM, 1, NULL, NULL);
WinSetFocus (HWND_DESKTOP, hwndMLE);
MLEInit ();
WinSendMsg (hwnd, WM_USER_LOADFILE, 0L, 0L);
}
return 0;
case IDM_SETFONT:
/* Set font menu item chosen */
WinDlgBox (HWND_DESKTOP, hwnd, SetFontDlgProc, 0,
IDD_SETFONT, NULL);
return 0;
case IDM_SETCOLORS:
/* Set colors menu item chosen */
WinDlgBox (HWND_DESKTOP, hwnd, SetColorDlgProc, 0,
IDD_SETCOLORS, NULL);
return 0;
case IDM_WORDWRAP:
/* Toggle word wrap menu item */
if (Profile.fWordWrap) {
Profile.fWordWrap = FALSE;
WinSendMsg (hwndMenu, MM_SETITEMATTR,
MPFROM2SHORT (IDM_WORDWRAP, TRUE),
MPFROM2SHORT (MIA_CHECKED, 0));
WinSendMsg (hwndMLE, MLM_SETWRAP,
MPFROMSHORT (Profile.fWordWrap), 0);
}
else {
Profile.fWordWrap = TRUE;
WinSendMsg (hwndMenu, MM_SETITEMATTR,
MPFROM2SHORT (IDM_WORDWRAP, TRUE),
MPFROM2SHORT (MIA_CHECKED, MIA_CHECKED));
WinSendMsg (hwndMLE, MLM_SETWRAP,
MPFROMSHORT (Profile.fWordWrap), 0);
}
return 0;
case IDM_COPY:
/* Copy menu item chosen */
WinSendMsg (hwndMLE, MLM_COPY, 0L, 0L);
return 0;
case IDM_FIND:
/* Find menu item chosen */
WinDlgBox (HWND_DESKTOP, hwnd, FindDlgProc, 0,
IDD_FIND, NULL);
return 0;
case IDM_SELECTALL:
/* Copy menu item chosen */
lTextLen = (LONG) WinSendMsg (hwndMLE, MLM_QUERYTEXTLENGTH,
0L, 0L);
WinSendMsg (hwndMLE, MLM_SETSEL, 0L, MPFROMLONG (lTextLen));
return 0;
case IDM_EXIT:
/* Exit menu item chosen */
WinSendMsg (hwnd, WM_CLOSE, 0L, 0L);
return 0;
case IDM_HELPFORHELP:
/* show help for IPF system */
if (hwndHelpInstance)
WinSendMsg (hwndHelpInstance, HM_DISPLAY_HELP, 0L, 0L);
break;
case IDM_HELPFORVIEW:
/* show help for MLEView */
if (hwndHelpInstance)
WinSendMsg (hwndHelpInstance, HM_EXT_HELP, 0L, 0L);
break;
case IDM_KEYS:
/* show help for keys */
if (hwndHelpInstance)
WinSendMsg (hwndHelpInstance, HM_KEYS_HELP, 0L, 0L);
break;
case IDM_INDEX:
/* show help index */
if (hwndHelpInstance)
WinSendMsg (hwndHelpInstance, HM_HELP_INDEX, 0L, 0L);
break;
case IDM_ABOUT:
/* About menu item chosen */
WinDlgBox (HWND_DESKTOP, hwnd, AboutDlgProc,
0, IDD_ABOUT, NULL);
return 0;
default:
break;
}
break;
case HM_QUERY_KEYS_HELP:
/* show keys help panel */
return ((MRESULT) IDXH_KEYSHELP);
case WM_HELP:
/* All WM_HELP messages should be processed by the default */
/* window procedure. */
break;
case HM_ERROR:
/* there was an error during the display of help */
if (hwndHelpInstance) {
switch (LONGFROMMP (mp1)) {
case HMERR_HELPITEM_NOT_FOUND:
WinMessageBox (HWND_DESKTOP, HWND_DESKTOP,
"Help not available for this resource.",
"Help Note", 1,
MB_OK | MB_APPLMODAL | MB_MOVEABLE);
break;
default:
WinMessageBox (HWND_DESKTOP, HWND_DESKTOP,
"Help terminated due to error.",
"Help Error", 1,
MB_OK | MB_APPLMODAL | MB_MOVEABLE);
WinDestroyHelpInstance (hwndHelpInstance);
break;
}
}
break;
case HM_HELPSUBITEM_NOT_FOUND:
/* no associated panel id could be found in help lib */
if (hwndHelpInstance) {
WinMessageBox (HWND_DESKTOP, HWND_DESKTOP,
"Help not available for this resource.",
"Help Note", 1,
MB_OK | MB_APPLMODAL | MB_MOVEABLE);
return (MRESULT) TRUE;
}
break;
case WM_SIZE:
WinSetWindowPos (hwndMLE, NULL, 0, 0,
SHORT1FROMMP (mp2),
SHORT2FROMMP (mp2),
SWP_MOVE | SWP_SIZE);
return 0;
case WM_CLOSE:
/* cleanup */
if (hwndHelpInstance)
WinDestroyHelpInstance (hwndHelpInstance);
if (hiniProfile != 0) {
PrfWriteProfileData (hiniProfile, "MLEView", "ViewProfile",
&Profile, sizeof (Profile));
PrfCloseProfile (hiniProfile);
}
else
WinMessageBox (HWND_DESKTOP, hwnd,
"Profile not saved.",
"Profile Open/Creation Error",
1, MB_OK | MB_APPLMODAL | MB_MOVEABLE);
break;
case WM_USER_LOADFILE:
MLELoad ();
return 0;
default:
break;
}
return WinDefWindowProc (hwnd, msg, mp1, mp2);
}
#pragma subtitle ("AboutDlgProc Procedure")
#pragma page()
/*--------------------------------------------------------------------*/
/* AboutDlgProc - This procedure handles the About menu selection. */
/*--------------------------------------------------------------------*/
MRESULT EXPENTRY AboutDlgProc (HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2) {
switch (msg) {
case WM_COMMAND:
switch (COMMANDMSG (&msg) -> cmd) {
case DID_OK:
case DID_CANCEL:
WinDismissDlg (hwnd, TRUE);
return 0;
}
break;
}
return WinDefDlgProc (hwnd, msg, mp1, mp2);
}
#pragma subtitle ("MLEInit Procedure")
#pragma page()
/*--------------------------------------------------------------------*/
/* MLEInit - initialize the MLE window from the profile. */
/*--------------------------------------------------------------------*/
static VOID MLEInit (VOID) {
HPS hps;
/* set text limit to infinity */
WinSendMsg (hwndMLE, MLM_SETTEXTLIMIT, (MPARAM) -1, NULL);
/* set the MLE format to match the clipboard text format */
WinSendMsg (hwndMLE, MLM_FORMAT, MLFIE_CFTEXT, NULL);
/* set the MLE word wrap */
WinSendMsg (hwndMLE, MLM_SETWRAP, MPFROMSHORT (Profile.fWordWrap),
NULL);
if (Profile.fWordWrap)
WinSendMsg (hwndMenu, MM_SETITEMATTR,
MPFROM2SHORT (IDM_WORDWRAP, Profile.fWordWrap),
MPFROM2SHORT (MIA_CHECKED, MIA_CHECKED));
else
WinSendMsg (hwndMenu, MM_SETITEMATTR,
MPFROM2SHORT (IDM_WORDWRAP, Profile.fWordWrap),
MPFROM2SHORT (MIA_CHECKED, 0));
/* set the MLE font */
if (strcmp (Profile.fatFont.szFacename, "NULL") == 0)
/* no font specified in profile so copy the default font */
WinSendMsg (hwndMLE, MLM_QUERYFONT, &Profile.fatFont, NULL);
else
WinSendMsg (hwndMLE, MLM_SETFONT, &Profile.fatFont, NULL);
/* set text and background colors */
WinSendMsg (hwndMLE, MLM_SETTEXTCOLOR,
MPFROMLONG (Profile.clrText), NULL);
WinSendMsg (hwndMLE, MLM_SETBACKCOLOR,
MPFROMLONG (Profile.clrBackground), NULL);
/* get font attributes */
hps = WinGetPS (hwndMLE);
EzfQueryFonts (hps);
WinReleasePS (hps);
}
#pragma subtitle ("MLELoad Procedure")
#pragma page()
/*--------------------------------------------------------------------*/
/* MLELoad - loads a file into the MLE window and enables/disables */
/* menu options. */
/*--------------------------------------------------------------------*/
static VOID MLELoad (VOID) {
static USHORT usBufSize = 65535;
SEL selBuffer;
PVOID pBuffer;
IPT iptTextLength;
USHORT usBytesRead;
/* allocate a buffer for DosRead and the MLE import */
DosAllocSeg (usBufSize, &selBuffer, SEG_NONSHARED);
pBuffer = MAKEP (selBuffer, 0);
WinSendMsg (hwndMLE, MLM_SETIMPORTEXPORT, pBuffer,
MPFROMSHORT (usBufSize));
/* disable refresh of the MLE window while we load it */
WinSendMsg (hwndMLE, MLM_DISABLEREFRESH, NULL, NULL);
/* clear the current contents of the MLE */
iptTextLength = (IPT) WinSendMsg (hwndMLE, MLM_QUERYTEXTLENGTH,
NULL, NULL);
WinSendMsg (hwndMLE, MLM_DELETE, 0, (MPARAM) iptTextLength);
/* the file is already open so read it and import till done */
iptTextLength = 0;
DosRead (hFile, pBuffer, usBufSize, &usBytesRead);
while (usBytesRead > 0) {
WinSendMsg (hwndMLE, MLM_IMPORT, (MPARAM) &iptTextLength,
MPFROMSHORT (usBytesRead));
DosRead (hFile, pBuffer, usBufSize, &usBytesRead);
}
/* delete the DosRead buffer and close file */
DosFreeSeg (selBuffer);
DosClose (hFile);
hFile = 0;
/* enable MLE refreshes */
WinSendMsg (hwndMLE, MLM_ENABLEREFRESH, NULL, NULL);
/* enable the menu Edit options if text was loaded */
if (iptTextLength > 0) {
WinSendMsg (hwndMenu, MM_SETITEMATTR,
MPFROM2SHORT (IDM_FIND, TRUE),
MPFROM2SHORT (MIA_DISABLED, 0));
WinSendMsg (hwndMenu, MM_SETITEMATTR,
MPFROM2SHORT (IDM_SELECTALL, TRUE),
MPFROM2SHORT (MIA_DISABLED, 0));
}
/* set the title window text */
strcpy (szTitleText, szTitle);
strcat (szTitleText, Filename);
WinSetWindowText (hwndTitleBar, szTitleText);
}
#pragma subtitle ("SetFontDlgProc Procedure")
#pragma page()
/*--------------------------------------------------------------------*/
/* SetFontDlgProc - This procedure handles the selection of fonts. */
/*--------------------------------------------------------------------*/
MRESULT EXPENTRY SetFontDlgProc (HWND hwnd, USHORT msg, MPARAM mp1, MPARAM mp2) {
static HWND hwndSample = 0;
SHORT sCntr, sSelect;
CHAR szItemText[FACESIZE];
RECTL rcl;
HWND hwndSampGB;
SWP swp;
switch (msg) {
case WM_INITDLG:
/* get current font attributes */
hwndFont = hwnd;
WinSendMsg (hwndMLE, MLM_QUERYFONT, MPFROMP(&fat), 0);
memmove (&fat, &Profile.fatFont, sizeof (FATTRS));
strcpy (fm.szFacename, fat.szFacename);
/* fill our list boxes */
FillFontListBox (hwnd);
FillSizeListBox (hwnd);
/* fill our check boxes */
if ((fat.fsSelection & FATTR_SEL_BOLD) > 0)
WinSendDlgItemMsg (hwnd, IDD_BOLD_CB, BM_SETCHECK,
MPFROMSHORT (1), 0);
else
WinSendDlgItemMsg (hwnd, IDD_BOLD_CB, BM_SETCHECK,
MPFROMSHORT (0), 0);
if ((fat.fsSelection & FATTR_SEL_ITALIC) > 0)
WinSendDlgItemMsg (hwnd, IDD_ITALIC_CB, BM_SETCHECK,
MPFROMSHORT (1), 0);
else
WinSendDlgItemMsg (hwnd, IDD_ITALIC_CB, BM_SETCHECK,
MPFROMSHORT (0), 0);
if ((fat.fsSelection & FATTR_SEL_UNDERSCORE) > 0)
WinSendDlgItemMsg (hwnd, IDD_UNDERS_CB, BM_SETCHECK,
MPFROMSHORT (1), 0);
else
WinSendDlgItemMsg (hwnd, IDD_UNDERS_CB, BM_SETCHECK,
MPFROMSHORT (0), 0);
if ((fat.fsSelection & FATTR_SEL_STRIKEOUT) > 0)
WinSendDlgItemMsg (hwnd, IDD_STRIKE_CB, BM_SETCHECK,
MPFROMSHORT (1), 0);
else
WinSendDlgItemMsg (hwnd, IDD_STRIKE_CB, BM_SETCHECK,
MPFROMSHORT (0), 0);
/* create sample text display window */
hwndSampGB = WinWindowFromID (hwnd, IDW_SAMPLETEXT);
WinQueryWindowPos (hwndSampGB, &swp);
hwndSample = WinCreateWindow (hwnd,
szSampleClass, "", WS_VISIBLE,
swp.x + 5, swp.y + 5,
swp.cx - 10,
swp.cy - 25,
WinQueryWindow (hwnd,
QW_PARENT,
FALSE),
HWND_TOP, IDW_SAMPLETEXT1,
NULL, NULL);
WinEnableWindow (WinWindowFromID (hwnd, IDD_APPLY_BT), FALSE);
WinEnableWindow (WinWindowFromID (hwnd, DID_OK), FALSE);
return 0;
case WM_CONTROL:
switch (SHORT1FROMMP (mp1)) {
case IDD_FONT_LB:
if (SHORT2FROMMP (mp1) == LN_SELECT) {
FillSizeListBox (hwnd);
WinQueryWindowRect (hwndSample, &rcl);
WinInvalidateRect (hwndSample, &rcl, FALSE);
WinEnableWindow (WinWindowFromID (hwnd,
IDD_APPLY_BT), TRUE);
WinEnableWindow (WinWindowFromID (hwnd, DID_OK),
TRUE);
return 0;
}
else
break;
case IDD_SIZE_LB:
if (SHORT2FROMMP (mp1) == LN_SELECT) {
WinEnableWindow (WinWindowFromID (hwnd,
IDD_APPLY_BT), TRUE);
WinEnableWindow (WinWindowFromID (hwnd, DID_OK),
TRUE);
WinQueryWindowRect (hwndSample, &rcl);
WinInvalidateRect (hwndSample, &rcl, FALSE);
return 0;
}
else
break;
case IDD_BOLD_CB:
if ((SHORT) WinSendDlgItemMsg (hwnd, IDD_BOLD_CB,
BM_QUERYCHECK, 0, 0) == 1)
fat.fsSelection |= FATTR_SEL_BOLD;
else
fat.fsSelection &= ~FATTR_SEL_BOLD;
WinQueryWindowRect (hwndSample, &rcl);
WinInvalidateRect (hwndSample, &rcl, FALSE);
WinEnableWindow (WinWindowFromID (hwnd,
IDD_APPLY_BT), TRUE);
WinEnableWindow (WinWindowFromID (hwnd, DID_OK), TRUE);
return 0;
case IDD_ITALIC_CB:
if ((SHORT) WinSendDlgItemMsg (hwnd, IDD_ITALIC_CB,
BM_QUERYCHECK, 0, 0) == 1)
fat.fsSelection |= FATTR_SEL_ITALIC;
else
fat.fsSelection &= ~FATTR_SEL_ITALIC;
WinQueryWindowRect (hwndSample, &rcl);
WinInvalidateRect (hwndSample, &rcl, FALSE);
WinEnableWindow (WinWindowFromID (hwnd,
IDD_APPLY_BT), TRUE);
WinEnableWindow (WinWindowFromID (hwnd, DID_OK), TRUE);
return 0;
case IDD_UNDERS_CB:
if ((SHORT) WinSendDlgItemMsg (hwnd, IDD_UNDERS_CB,
BM_QUERYCHECK, 0, 0) == 1)
fat.fsSelection |= FATTR_SEL_UNDERSCORE;
else
fat.fsSelection &= ~FATTR_SEL_UNDERSCORE;
WinQueryWindowRect (hwndSample, &rcl);
WinInvalidateRect (hwndSample, &rcl, FALSE);
WinEnableWindow (WinWindowFromID (hwnd,
IDD_APPLY_BT), TRUE);
WinEnableWindow (WinWindowFromID (hwnd, DID_OK), TRUE);
return 0;
case IDD_STRIKE_CB:
if ((SHORT) WinSendDlgItemMsg (hwnd, IDD_STRIKE_CB,
BM_QUERYCHECK, 0, 0) == 1)
fat.fsSelection |= FATTR_SEL_STRIKEOUT;
else
fat.fsSelection &= ~FATTR_SEL_STRIKEOUT;
WinQueryWindowRect (hwndSample, &rcl);
WinInvalidateRect (hwndSample, &rcl, FALSE);
WinEnableWindow (WinWindowFromID (hwnd,
IDD_APPLY_BT), TRUE);
WinEnableWindow (WinWindowFromID (hwnd, DID_OK), TRUE);
return 0;
default:
break;
}
break;
case WM_COMMAND:
switch (COMMANDMSG (&msg) -> cmd) {
case IDD_APPLY_BT:
Profile.fatFont.usRecordLength = sizeof (FATTRS);
Profile.fatFont.fsSelection = fat.fsSelection;
Profile.fatFont.lMatch = fm.lMatch;
strcpy (Profile.fatFont.szFacename, fm.szFacename);
Profile.fatFont.idRegistry = 0;
Profile.fatFont.usCodePage = fm.usCodePage;
Profile.fatFont.lMaxBaselineExt = 0;
Profile.fatFont.lAveCharWidth = 0;
Profile.fatFont.fsType = 0;
WinSendMsg (hwndMLE, MLM_SETFONT,
MPFROMP (&Profile.fatFont), 0);
WinEnableWindow (WinWindowFromID (hwnd,
IDD_APPLY_BT), FALSE);
WinEnableWindow (WinWindowFromID (hwnd, DID_OK), FALSE);
return 0;
case DID_OK:
Profile.fatFont.usRecordLength = sizeof (FATTRS);
Profile.fatFont.fsSelection = fat.fsSelection;
Profile.fatFont.lMatch = fm.lMatch;
strcpy (Profile.fatFont.szFacename, fm.szFacename);
Profile.fatFont.idRegistry = 0;
Profile.fatFont.usCodePage = fm.usCodePage;
Profile.fatFont.lMaxBaselineExt = 0;
Profile.fatFont.lAveCharWidth = 0;
Profile.fatFont.fsType = 0;
WinSendMsg (hwndMLE, MLM_SETFONT,
MPFROMP (&Profile.fatFont), 0);
WinDismissDlg (hwnd, TRUE);
return 0;
case DID_CANCEL:
WinDismissDlg (hwnd, TRUE);
return 0;
}
break;
default:
break;
}
return WinDefDlgProc (hwnd, msg, mp1, mp2);
}
#pragma subtitle ("FillFontListBox Procedure")
#pragma page()
/*--------------------------------------------------------------------*/
/* FillFontListBox - fills the font list box in the Set font dialog. */
/*--------------------------------------------------------------------*/
static VOID FillFontListBox (HWND hwnd) {
SHORT sCntr;
PCHAR sFacename;
WinSendDlgItemMsg (hwnd, IDD_FONT_LB, LM_DELETEALL, 0, 0);
/* insert each face name */
for (sCntr = 0; sCntr < EZF_NUMFONTFACES; sCntr++) {
sFacename = EzfQueryFacename (sCntr);
WinSendDlgItemMsg (hwnd, IDD_FONT_LB, LM_INSERTITEM,
MPFROMSHORT (LIT_END),
MPFROMP (sFacename));
/* try to match inserted facename with current facename */
if (strncmp (sFacename, fm.szFacename, strlen (sFacename)) == 0)
WinSendDlgItemMsg (hwnd, IDD_FONT_LB, LM_SELECTITEM,
MPFROMSHORT (sCntr),
MPFROMSHORT ((BOOL) TRUE));
}
}
#pragma subtitle ("FillSizeListBox Procedure")
#pragma page()
/*--------------------------------------------------------------------*/
/* FillSizeListBox - fills the size list box in the Set font dialog. */
/*--------------------------------------------------------------------*/
static VOID FillSizeListBox (HWND hwnd) {
SHORT sFaceIndex, sCntr, sSize, sItemsInserted = 0;
BOOL fItemSelected = FALSE;
CHAR szValue [5];
sFaceIndex = (SHORT) WinSendDlgItemMsg (hwnd, IDD_FONT_LB,
LM_QUERYSELECTION,
MPFROMSHORT (LIT_FIRST), 0);
WinSendDlgItemMsg (hwnd, IDD_SIZE_LB, LM_DELETEALL, 0, 0);
for (sCntr = 0; sCntr < EZF_NUMSIZES; sCntr++) {
/* insert only valid sizes for the selected font */
if (EzfQueryMatchNum (sFaceIndex, sCntr) != 0L) {
sSize = EzfQuerySize (sCntr);
sprintf (szValue, "%2d", sSize / 10);
WinSendDlgItemMsg (hwnd, IDD_SIZE_LB, LM_INSERTITEM,
MPFROMSHORT (LIT_END),
MPFROMP (szValue));
/* try to match the inserted size with old size */
if (sSize == fm.sNominalPointSize) {
WinSendDlgItemMsg (hwnd, IDD_SIZE_LB, LM_SELECTITEM,
MPFROMSHORT (sItemsInserted),
MPFROMSHORT ((BOOL) TRUE));
fItemSelected = TRUE;
}
sItemsInserted++;
}
}
if (fItemSelected == FALSE)
/* if no item was selected above then select the first item */
WinSendDlgItemMsg (hwnd, IDD_SIZE_LB, LM_SELECTITEM,
MPFROMSHORT (0), MPFROMSHORT ((BOOL) TRUE));
}
#pragma subtitle ("SampleTextProc Procedure")
#pragma page()
/*--------------------------------------------------------------------*/
/* SampleTextProc - window procedure to display some sample text */
/* of a particular font size and style on the */
/* set font dialog box window. */
/*--------------------------------------------------------------------*/
MRESULT EXPENTRY SampleTextProc (HWND hwnd, USHORT msg, MPARAM mp1,
MPARAM mp2) {
static CHAR szAlphabet [27] = "aBcDeFgHiJkLmNoPqRsTuVwXyZ";
HPS hps;
POINTL ptl;
SHORT sFacenameIndex, sSizeIndex, sSize, sSelected;
CHAR szSizeText[5];
switch (msg) {
case WM_PAINT:
hps = WinBeginPaint (hwnd, 0, NULL);
GpiErase (hps);
sFacenameIndex = (SHORT) WinSendDlgItemMsg (hwndFont,
IDD_FONT_LB, LM_QUERYSELECTION,
MPFROMSHORT (LIT_FIRST), 0);
sSelected = (SHORT) WinSendDlgItemMsg (hwndFont, IDD_SIZE_LB,
LM_QUERYSELECTION, 0, 0);
WinSendDlgItemMsg (hwndFont, IDD_SIZE_LB, LM_QUERYITEMTEXT,
MPFROM2SHORT (sSelected, 5), szSizeText);
sSize = atoi (szSizeText) * 10;
sSizeIndex = EzfQuerySizeIndex (sSize);
EzfCreateLogFont (hps, LCID_MYFONT, sFacenameIndex, sSizeIndex,
fat.fsSelection);
GpiSetCharSet (hps, LCID_MYFONT);
GpiQueryFontMetrics (hps, (LONG) sizeof fm, &fm);
ptl.x = 0;
ptl.y = fm.lMaxDescender;
GpiCharStringAt (hps, &ptl, (LONG) strlen (szAlphabet),
szAlphabet);
GpiSetCharSet (hps, LCID_DEFAULT);
GpiDeleteSetId (hps, LCID_MYFONT);
WinEndPaint (hps);
return 0;
default:
break;
}
return WinDefWindowProc (hwnd, msg, mp1, mp2);
}
#pragma subtitle ("SetColorDlgProc Procedure")
#pragma page()
/*--------------------------------------------------------------------*/
/* SetColorDlgProc - This procedure handles the selection of colors. */
/*--------------------------------------------------------------------*/
MRESULT EXPENTRY SetColorDlgProc (HWND hwnd, USHORT msg, MPARAM mp1,
MPARAM mp2) {
static HWND hwndSample = 0;
RECTL rcl;
HWND hwndSampGB;
SWP swp;
LONG clrNewB, clrNewT;
SHORT sClrIndex;
switch (msg) {
case WM_INITDLG:
hwndColor = hwnd;
/* fill our list boxes */
FillForgListBox (hwnd);
FillBakgListBox (hwnd);
/* create sample text display window */
hwndSampGB = WinWindowFromID (hwnd, IDW_COLORTEXT);
WinQueryWindowPos (hwndSampGB, &swp);
hwndSample = WinCreateWindow (hwnd,
szSColorClass, "", WS_VISIBLE,
swp.x + 5, swp.y + 5,
swp.cx - 10,
swp.cy - 27,
WinQueryWindow (hwnd,
QW_PARENT,
FALSE),
HWND_TOP, IDW_COLORTEXT1,
NULL, NULL);
WinEnableWindow (WinWindowFromID (hwnd, IDD_APPLYC_BT), FALSE);
WinEnableWindow (WinWindowFromID (hwnd, DID_OK), FALSE);
return 0;
case WM_CONTROL:
switch (SHORT1FROMMP (mp1)) {
case IDD_FORG_LB:
if (SHORT2FROMMP (mp1) == LN_SELECT) {
WinQueryWindowRect (hwndSample, &rcl);
WinInvalidateRect (hwndSample, &rcl, FALSE);
WinEnableWindow (WinWindowFromID (hwnd,
IDD_APPLYC_BT), TRUE);
WinEnableWindow (WinWindowFromID (hwnd, DID_OK),
TRUE);
return 0;
}
else
break;
case IDD_BAKG_LB:
if (SHORT2FROMMP (mp1) == LN_SELECT) {
WinEnableWindow (WinWindowFromID (hwnd,
IDD_APPLYC_BT), TRUE);
WinEnableWindow (WinWindowFromID (hwnd, DID_OK),
TRUE);
WinQueryWindowRect (hwndSample, &rcl);
WinInvalidateRect (hwndSample, &rcl, FALSE);
return 0;
}
else
break;
default:
break;
}
break;
case WM_COMMAND:
switch (COMMANDMSG (&msg) -> cmd) {
case IDD_APPLYC_BT:
WinEnableWindow (WinWindowFromID (hwnd,
IDD_APPLYC_BT), FALSE);
WinEnableWindow (WinWindowFromID (hwnd, DID_OK), FALSE);
sClrIndex = (SHORT) WinSendDlgItemMsg (hwndColor,
IDD_FORG_LB, LM_QUERYSELECTION, 0, 0);
clrNewT = ColorTable[sClrIndex].clr;
sClrIndex = (SHORT) WinSendDlgItemMsg (hwndColor,
IDD_BAKG_LB, LM_QUERYSELECTION, 0, 0);
clrNewB = ColorTable[sClrIndex].clr;
Profile.clrText = clrNewT;
Profile.clrBackground = clrNewB;
WinSendMsg (hwndMLE, MLM_SETBACKCOLOR,
MPFROMLONG (clrNewB), 0);
WinSendMsg (hwndMLE, MLM_SETTEXTCOLOR,
MPFROMLONG (clrNewT), 0);
return 0;
case DID_OK:
sClrIndex = (SHORT) WinSendDlgItemMsg (hwndColor,
IDD_FORG_LB, LM_QUERYSELECTION, 0, 0);
clrNewT = ColorTable[sClrIndex].clr;
sClrIndex = (SHORT) WinSendDlgItemMsg (hwndColor,
IDD_BAKG_LB, LM_QUERYSELECTION, 0, 0);
clrNewB = ColorTable[sClrIndex].clr;
Profile.clrText = clrNewT;
Profile.clrBackground = clrNewB;
WinSendMsg (hwndMLE, MLM_SETBACKCOLOR,
MPFROMLONG (clrNewB), 0);
WinSendMsg (hwndMLE, MLM_SETTEXTCOLOR,
MPFROMLONG (clrNewT), 0);
WinDismissDlg (hwnd, TRUE);
return 0;
case DID_CANCEL:
WinDismissDlg (hwnd, TRUE);
return 0;
}
break;
default:
break;
}
return WinDefDlgProc (hwnd, msg, mp1, mp2);
}
#pragma subtitle ("FindDlgProc Procedure")
#pragma page()
/*--------------------------------------------------------------------*/
/* FindDlgProc - This procedure handles the Find text dialog. */
/*--------------------------------------------------------------------*/
MRESULT EXPENTRY FindDlgProc (HWND hwnd, USHORT msg, MPARAM mp1,
MPARAM mp2) {
static CHAR szFindText [81] = "\0";
static MLE_SEARCHDATA MLE_SearchData;
LONG lTextLen, lCursorPos;
USHORT fResult;
switch (msg) {
case WM_INITDLG:
if (strlen (szFindText) == 0)
WinSendDlgItemMsg (hwnd, IDD_FINDENTRY, EM_SETTEXTLIMIT,
MPFROMSHORT (80), 0);
else {
WinSetDlgItemText (hwnd, IDD_FINDENTRY, szFindText);
WinSendDlgItemMsg (hwnd, IDD_FINDENTRY, EM_SETSEL,
MPFROM2SHORT (0,
strlen (szFindText)), 0);
}
WinSendDlgItemMsg (hwnd, IDD_CASESEN,
BM_SETCHECK, MPFROMSHORT (Profile.fCase), 0);
WinSendDlgItemMsg (hwnd, IDD_FINDWRAP,
BM_SETCHECK, MPFROMSHORT (Profile.fWrap), 0);
return 0;
case WM_CONTROL:
switch (SHORT1FROMMP (mp1)) {
case IDD_CASESEN:
if (Profile.fCase)
Profile.fCase = FALSE;
else
Profile.fCase = TRUE;
WinSendDlgItemMsg (hwnd, IDD_CASESEN, BM_SETCHECK,
MPFROMSHORT (Profile.fCase), 0);
return 0;
case IDD_FINDWRAP:
if (Profile.fWrap)
Profile.fWrap = FALSE;
else
Profile.fWrap = TRUE;
WinSendDlgItemMsg (hwnd, IDD_FINDWRAP, BM_SETCHECK,
MPFROMSHORT (Profile.fWrap), 0);
return 0;
default:
break;
}
break;
case WM_COMMAND:
switch (COMMANDMSG (&msg) -> cmd) {
case DID_OK:
WinQueryDlgItemText (hwnd, IDD_FINDENTRY, 80,
MPFROMP (&szFindText));
if (strlen (szFindText) == 0) {
WinMessageBox (HWND_DESKTOP, hwnd,
"There is no text in the \"Find:\" field.",
"Find Notification",
1, MB_OK | MB_APPLMODAL | MB_MOVEABLE);
return 0;
}
MLE_SearchData.cb = sizeof (MLE_SEARCHDATA);
MLE_SearchData.pchFind = szFindText;
MLE_SearchData.pchReplace = NULL;
MLE_SearchData.cchFind = 0;
MLE_SearchData.cchReplace = 0;
MLE_SearchData.iptStart = -1;
MLE_SearchData.iptStop = -1;
MLE_SearchData.cchFound = 0;
if (Profile.fCase)
fResult = (USHORT) WinSendMsg (hwndMLE, MLM_SEARCH,
(MPARAM) (LONG) (MLFSEARCH_CASESENSITIVE |
MLFSEARCH_SELECTMATCH),
MPFROMP (&MLE_SearchData));
else
fResult = (USHORT) WinSendMsg (hwndMLE, MLM_SEARCH,
(MPARAM) (LONG) MLFSEARCH_SELECTMATCH,
MPFROMP (&MLE_SearchData));
if ((fResult == FALSE) && (Profile.fWrap == TRUE)) {
MLE_SearchData.iptStart = 0;
if (Profile.fCase)
fResult = (USHORT) WinSendMsg (hwndMLE, MLM_SEARCH,
(MPARAM) (LONG) (MLFSEARCH_CASESENSITIVE |
MLFSEARCH_SELECTMATCH),
MPFROMP (&MLE_SearchData));
else
fResult = (USHORT) WinSendMsg (hwndMLE, MLM_SEARCH,
(MPARAM) (LONG) MLFSEARCH_SELECTMATCH,
MPFROMP (&MLE_SearchData));
}
if (!fResult) {
lCursorPos = (LONG) WinSendMsg (hwndMLE,
MLM_QUERYSEL,
(MPARAM) (LONG) MLFQS_CURSORSEL, 0);
WinSendMsg (hwndMLE, MLM_SETSEL,
MPFROMLONG (lCursorPos),
MPFROMLONG (lCursorPos));
WinMessageBox (HWND_DESKTOP, hwnd,
"The text in the \"Find:\" field cannot be found.",
"Find Notification",
1, MB_OK | MB_APPLMODAL | MB_MOVEABLE);
}
return 0;
case DID_CANCEL:
WinDismissDlg (hwnd, TRUE);
return 0;
}
break;
default:
break;
}
return WinDefDlgProc (hwnd, msg, mp1, mp2);
}
#pragma subtitle ("FillFontListBox Procedure")
#pragma page()
/*--------------------------------------------------------------------*/
/* FillForgListBox - fills the foreground list box in the Set Color */
/* dialog. */
/*--------------------------------------------------------------------*/
static VOID FillForgListBox (HWND hwnd) {
SHORT sCntr;
WinSendDlgItemMsg (hwnd, IDD_BAKG_LB, LM_DELETEALL, 0, 0);
/* insert each face name */
for (sCntr = 0; sCntr < 17; sCntr++) {
WinSendDlgItemMsg (hwnd, IDD_FORG_LB, LM_INSERTITEM,
MPFROMSHORT (LIT_END),
MPFROMP (ColorTable[sCntr].szColor));
/* try to match inserted color with current color */
if (ColorTable[sCntr].clr == Profile.clrText)
WinSendDlgItemMsg (hwnd, IDD_FORG_LB, LM_SELECTITEM,
MPFROMSHORT (sCntr),
MPFROMSHORT ((BOOL) TRUE));
}
}
#pragma subtitle ("FillSizeListBox Procedure")
#pragma page()
/*--------------------------------------------------------------------*/
/* FillBakgListBox - fills the background list box in the Set color */
/* dialog. */
/*--------------------------------------------------------------------*/
static VOID FillBakgListBox (HWND hwnd) {
SHORT sCntr;
WinSendDlgItemMsg (hwnd, IDD_BAKG_LB, LM_DELETEALL, 0, 0);
for (sCntr = 0; sCntr < 17; sCntr++) {
WinSendDlgItemMsg (hwnd, IDD_BAKG_LB, LM_INSERTITEM,
MPFROMSHORT (LIT_END),
MPFROMP (ColorTable[sCntr].szColor));
/* try to match the inserted color with old color */
if (ColorTable[sCntr].clr == Profile.clrBackground)
WinSendDlgItemMsg (hwnd, IDD_BAKG_LB, LM_SELECTITEM,
MPFROMSHORT (sCntr),
MPFROMSHORT ((BOOL) TRUE));
}
}
#pragma subtitle ("SampleTextProc Procedure")
#pragma page()
/*--------------------------------------------------------------------*/
/* SampleColorProc - window procedure to display some sample text */
/* of a particular color on the set color dialog */
/* bow window. */
/*--------------------------------------------------------------------*/
MRESULT EXPENTRY SampleColorProc (HWND hwnd, USHORT msg, MPARAM mp1,
MPARAM mp2) {
static PCHAR szText1 = "This is an example of text.";
static PCHAR szText2 = "This is an example of selected text.";
HPS hps;
POINTL ptl;
SHORT sClrIndex;
LONG clrNewB, clrNewT;
RECTL rcl;
switch (msg) {
case WM_PAINT:
hps = WinBeginPaint (hwnd, 0, &rcl);
GpiSetCharMode (hps, CM_MODE1);
GpiQueryFontMetrics (hps, sizeof fm, &fm);
/* set background color and fill window with that color */
sClrIndex = (SHORT) WinSendDlgItemMsg (hwndColor,
IDD_BAKG_LB, LM_QUERYSELECTION, 0, 0);
clrNewB = ColorTable[sClrIndex].clr;
GpiSetBackColor (hps, clrNewB);
WinFillRect (hps, &rcl, clrNewB);
/* set foreground color */
sClrIndex = (SHORT) WinSendDlgItemMsg (hwndColor,
IDD_FORG_LB, LM_QUERYSELECTION, 0, 0);
clrNewT = ColorTable[sClrIndex].clr;
GpiSetColor (hps, clrNewT);
/* draw the sample text on the screen */
ptl.x = 5;
ptl.y = (fm.lMaxDescender * 2) + fm.lMaxBaselineExt;
GpiCharStringAt (hps, &ptl, (LONG) strlen (szText1),
szText1);
/* draw the "selected" sample text on the screen */
ptl.x = 5;
ptl.y = fm.lMaxDescender * 2;
GpiSetMix (hps, FM_NOTCOPYSRC);
GpiSetBackMix (hps, BM_XOR);
GpiCharStringAt (hps, &ptl, (LONG) strlen (szText2),
szText2);
WinEndPaint (hps);
return 0;
default:
break;
}
return WinDefWindowProc (hwnd, msg, mp1, mp2);
}