blob: 037543bcec1b64ae8a3758543f601f3cdd55723c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
/******************************************************************************
* tbdisp.cpp - code for class 'tbdisp'. tbdisp writes module output to a
* MSWindows TextBox (or any other control that takes a
* SetDialogItemText
*/
#include <swmodule.h>
#include <tbdisp.h>
#include <windows.h>
#include <string.h>
SWORD_NAMESPACE_START
/******************************************************************************
* TBDisp Constructor - sets up an instance of TBDisp for use
*
* ENT: iwnd - window id on which control resides
* ictrlid - control id in which to display module text
*/
TBDisp::TBDisp(HWND iwnd, int ictrlid)
{
wnd = iwnd;
ctrlid = ictrlid;
}
/******************************************************************************
* SWDisplay::Display - casts a module to a character pointer and displays it in
* an MSWindows control
*
* ENT: imodule - module to display
*
* RET: error status
*/
char TBDisp::Display(SWModule &imodule)
{
char *buf, *to;
const char *mtext;
mtext = (const char *)imodule;
buf = new char [ strlen(mtext) + 100 ];
for (to = buf; *mtext; mtext++) {
if (*mtext == '\n')
*to++ = '\r';
*to++ = *mtext;
}
*to = 0;
SetDlgItemText(wnd, ctrlid, buf);
delete [] buf;
return 0;
}
SWORD_NAMESPACE_END
|