aboutsummaryrefslogtreecommitdiff
path: root/Linux_C_12/cCrossCallPrinter_121.c
blob: c0150369456ccdea56a133476ae3e0fe3bac940f (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
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
/********************************************************************************************
    Clean OS Windows library module version 1.2.1.
    This module is part of the Clean Object I/O library, version 1.2.1,
    for the Windows platform.
********************************************************************************************/

/********************************************************************************************
    About this module:
    Routines related to printer handling.
********************************************************************************************/

#include "cCrossCallPrinter_121.h"

#if 0

#include "cCrossCall_121.h"
#include "cprinter_121.h"

extern BOOL bUserAbort;
extern HWND hDlgPrint;		/* MW: hDlgPrint is the handle of the "Cancel Printing" dialog. */
extern HWND hwndText;		/* MW: hwndText  is the handle of the page count text in the dialog. */


/*	Cross call procedure implementations.
    Eval<nr> corresponds with a CrossCallEntry generated by NewCrossCallEntry (nr,Eval<nr>).
*/
void EvalCcRqDO_PRINT_SETUP (CrossCallInfo *pcci)
{	int ok;
    PRINTDLG *pdPtr;
    printSetup(0, pcci->p1,
                (char*) pcci->p2, (char*) pcci->p3, (char*) pcci->p4, (char*) pcci->p5,
                &ok, &pdPtr);
    MakeReturn2Cci (pcci, ok, (int) pdPtr);
}

void EvalCcRqGET_PRINTER_DC (CrossCallInfo *pcci)
{	int doDialog,emulateScreenRes,
        err,first,last,copies,pPrintDlg,deviceContext;

    // unpack doDialog and emulateScreenRes
    doDialog			= (pcci->p1) & 1;
    emulateScreenRes	= (pcci->p1) & 2;

    getDC(	doDialog,emulateScreenRes,FALSE,pcci->p2,
            (char*) pcci->p3,(char*) pcci->p4,(char*) pcci->p5,(char*) pcci->p6,
            &err,&first,&last,&copies,(PRINTDLG**)&pPrintDlg,&deviceContext);
    MakeReturn6Cci (pcci,err,first,last,copies,pPrintDlg,deviceContext);
}

void EvalCcRqSTARTDOC (CrossCallInfo *pcci)
{
    HDC hdc = (HDC) pcci->p1;
    int err;

    EnableWindow (ghMainWindow, FALSE) ;
    hDlgPrint = CreateCancelDialog ();
    SetAbortProc (hdc, AbortProc) ;
    err = startDoc((int) hdc);
    if (err<=0 && ghMainWindow!=NULL && !bUserAbort)
    {
        EnableWindow (ghMainWindow, TRUE) ;
        DestroyWindow (hDlgPrint) ;
    };
    MakeReturn1Cci (pcci,err);
}

void EvalCcRqENDDOC (CrossCallInfo *pcci)
{
    HDC hdc = (HDC) pcci->p1;

    endDoc((int) hdc);
    if (ghMainWindow!=NULL && !bUserAbort)
    {
        EnableWindow (ghMainWindow, TRUE) ;
        DestroyWindow (hDlgPrint) ;
    };
    MakeReturn0Cci (pcci);
}

void EvalCcRqDISPATCH_MESSAGES_WHILE_PRINTING (CrossCallInfo *pcci)
{
    MSG   msg ;
    char *pageMessage= (char *) (pcci->p1);

    SetWindowText(hwndText,pageMessage);

    while (!bUserAbort && PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
    {
        if (!hDlgPrint || !IsDialogMessage (hDlgPrint, &msg))
        {
            TranslateMessage (&msg) ;
            DispatchMessage (&msg) ;
        }
    }
    MakeReturn0Cci (pcci);
}


/*	Install the cross call procedures in the gCrossCallProcedureTable of cCrossCall_121.
*/
void InstallCrossCallPrinter ()
{
    CrossCallProcedureTable newTable;

    newTable = EmptyCrossCallProcedureTable ();
    AddCrossCallEntry (newTable, CcRqDO_PRINT_SETUP,                   EvalCcRqDO_PRINT_SETUP);
    AddCrossCallEntry (newTable, CcRqGET_PRINTER_DC,                   EvalCcRqGET_PRINTER_DC);
    AddCrossCallEntry (newTable, CcRqSTARTDOC,                         EvalCcRqSTARTDOC);
    AddCrossCallEntry (newTable, CcRqENDDOC,                           EvalCcRqENDDOC);
    AddCrossCallEntry (newTable, CcRqDISPATCH_MESSAGES_WHILE_PRINTING, EvalCcRqDISPATCH_MESSAGES_WHILE_PRINTING);
    AddCrossCallEntries (gCrossCallProcedureTable, newTable);
}

#else

OS InstallCrossCallPrinter (OS ios)
{
        return ios;
}

#endif