-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPRINTOUT.C
More file actions
125 lines (109 loc) · 2.64 KB
/
Copy pathPRINTOUT.C
File metadata and controls
125 lines (109 loc) · 2.64 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*
*
* Printer output module
*
* by Micro-Ed
*
*/
#include "Micro-Ed.H"
int InitPrinterOutput (void)
{
char szTmp [80] ;
int nPrinters, nPrtSelected, k, kasc, kext ;
static bAlreadyDone = FALSE ;
ScrPush () ;
DrawMenuBar (NO_DROP_DOWNS, FALSE, FALSE) ;
nPrtSelected = 1 ;
if ((nPrinters = PrtInstalled ()) == 0)
{
GenericErrorBox ("This computer does not have a printer attached; unable to print") ;
ScrPop (1) ;
return (FALSE) ;
}
else
if (nPrinters > 1 && !bAlreadyDone)
{
ScrPush () ;
DrawBox ("Output to printer", 9, 0, 12, 79) ;
CText ("This computer has more than one parallel (printer) port; please specify",
nColours [C_ID_NORM], 0, 79, 10) ;
CText ("which port the printer is attached to, LPT1, LPT2 or LPT3: (1/2/3)",
nColours [C_ID_NORM], 0, 79, 11) ;
do
{
kasc = (k = KbdGetC ()) & 0x00ff ;
kext = k >> 8 ;
if (kext == HELP_KEY && kasc == 0)
{
nHelpContext = H_INIT_PRINTER_OUTPUT_QUERY_PORT ;
Help () ;
}
if (kasc == ESC_KEY)
{
ScrPop (1) ;
DrawMenuBar (NO_DROP_DOWNS, TRUE, FALSE) ;
return (FALSE) ;
}
nPrtSelected = kasc - '0' ;
}
while (nPrtSelected < 1 || nPrtSelected > nPrinters) ;
PrtSwap (nPrtSelected) ;
bAlreadyDone = TRUE ;
ScrPop (1) ;
}
PrtTimeout (20) ;
ScrPush () ;
while (!PrtReady ())
{
DrawBox ("Output to printer", 9, 0, 12, 79) ;
sprintf (szTmp, "The printer on LPT%d is not ready; ready it before continuing", nPrtSelected) ;
CText (szTmp, nColours [C_ID_NORM], 0, 79, 10) ;
CText ("Press any key", nColours [C_ID_HILIGHT], 0, 79, 11) ;
for (;;)
{
kasc = (k = KbdGetC ()) & 0x00ff ;
kext = k >> 8 ;
if (kext == HELP_KEY && kasc == 0)
{
nHelpContext = H_INIT_PRINTER_OUTPUT_READY ;
Help () ;
continue ;
}
if (kasc == ESC_KEY)
{
ScrPop (1) ;
ScrPop (1) ;
return (FALSE) ;
}
break ;
}
}
ScrPop (1) ;
PrtInit () ;
sprintf (szTmp, "%cl%c", 27, 5) ; // Set left margin to 5 chars
if (!PrtPutS (szTmp))
{
ScrPop (1) ;
return (FALSE) ;
}
sprintf (szTmp, "%cQ%c", 27, 5) ; // Set right margin to 5 chars
PrtPutS (szTmp) ;
sprintf (szTmp, "%cN%c", 27, 5) ; // Set skip over perforation
PrtPutS (szTmp) ;
sprintf (szTmp, "%cGM i c r o - E d%cH Value-Added Educational Software" , 27, 27) ;
PrinterOutputLine (szTmp) ;
PrinterOutputLine ("") ;
ScrPop (1) ;
return (TRUE) ;
}
int PrinterOutputLine (char * szLine)
{
char szOutputLine [80] ;
StripHighlightMarkers (szLine, szOutputLine) ;
strcat (szOutputLine, "\n") ;
return (PrtPutS (szOutputLine)) ;
}
void RestPrinterOutput (void)
{
PrtTimeout (20) ;
}