xref: /haiku/src/add-ons/print/drivers/pcl5/PCL5Entry.cpp (revision d5cd5d63ff0ad395989db6cf4841a64d5b545d1d)
1 /*
2  * PCL5Entry.cpp
3  * Copyright 1999-2000 Y.Takagi. All Rights Reserved.
4  * Copyright 2003 Michael Pfeiffer.
5  */
6 
7 #include <File.h>
8 #include <Message.h>
9 #include <Node.h>
10 
11 #include "Exports.h"
12 #include "PCL5.h"
13 #include "PrinterData.h"
14 #include "PCL5Cap.h"
15 #include "UIDriver.h"
16 #include "AboutBox.h"
17 #include "DbgMsg.h"
18 
19 char *add_printer(char *printer_name)
20 {
21 	DBGMSG((">PCL5: add_printer\n"));
22 	DBGMSG(("\tprinter_name: %s\n", printer_name));
23 	DBGMSG(("<PCL5: add_printer\n"));
24 	return printer_name;
25 }
26 
27 BMessage *config_page(BNode *node, BMessage *msg)
28 {
29 	DBGMSG((">PCL5: config_page\n"));
30 	DUMP_BMESSAGE(msg);
31 	DUMP_BNODE(node);
32 
33 	PrinterData printer_data(node);
34 	PCL5Cap printer_cap(&printer_data);
35 	UIDriver drv(msg, &printer_data, &printer_cap);
36 	BMessage *result = drv.configPage();
37 
38 	DUMP_BMESSAGE(result);
39 	DBGMSG(("<PCL5: config_page\n"));
40 	return result;
41 }
42 
43 BMessage *config_job(BNode *node, BMessage *msg)
44 {
45 	DBGMSG((">PCL5: config_job\n"));
46 	DUMP_BMESSAGE(msg);
47 	DUMP_BNODE(node);
48 
49 	PrinterData printer_data(node);
50 	PCL5Cap printer_cap(&printer_data);
51 	UIDriver drv(msg, &printer_data, &printer_cap);
52 	BMessage *result = drv.configJob();
53 
54 	DUMP_BMESSAGE(result);
55 	DBGMSG(("<PCL5: config_job\n"));
56 	return result;
57 }
58 
59 BMessage *take_job(BFile *spool, BNode *node, BMessage *msg)
60 {
61 	DBGMSG((">PCL5: take_job\n"));
62 	DUMP_BMESSAGE(msg);
63 	DUMP_BNODE(node);
64 
65 	PrinterData printer_data(node);
66 	PCL5Cap printer_cap(&printer_data);
67 	PCL5Driver drv(msg, &printer_data, &printer_cap);
68 	BMessage *result = drv.takeJob(spool);
69 
70 //	DUMP_BMESSAGE(result);
71 	DBGMSG(("<PCL5: take_job\n"));
72 	return result;
73 }
74 
75 int main()
76 {
77 	AboutBox app("application/x-vnd.PCL5-compatible", "PCL5 Compatible", "0.1",
78 	"libprint Copyright © 1999-2000 Y.Takagi\n"
79 	"PCL5 driver Copyright © 2003 Michael Pfeiffer.\n"
80 	"All Rights Reserved.");
81 	app.Run();
82 	return 0;
83 }
84