1 /* 2 * PSEntry.cpp 3 * Copyright 1999-2000 Y.Takagi. All Rights Reserved. 4 * Copyright 2003 Michael Pfeiffer. 5 * Copyright 2010 Ithamar Adema. 6 */ 7 8 9 #include <Entry.h> 10 #include <Path.h> 11 12 #include "PrinterDriver.h" 13 #include "PS.h" 14 #include "PSCap.h" 15 #include "PSData.h" 16 #include "SelectPPDDlg.h" 17 18 19 class PSPrinterDriver : public PrinterDriver { 20 public: 21 PSPrinterDriver(BNode* printerFolder) 22 : 23 PrinterDriver(printerFolder) 24 { 25 } 26 27 const char* GetSignature() const 28 { 29 return "application/x-vnd.PS-compatible"; 30 } 31 32 const char* GetDriverName() const 33 { 34 return "PS compatible"; 35 } 36 37 const char* GetVersion() const 38 { 39 return "0.1"; 40 } 41 42 const char* GetCopyright() const 43 { 44 return "PS driver Copyright © 2003,04 Michael Pfeiffer.\n"; 45 } 46 47 char* AddPrinter(char *printerName) 48 { 49 BPath path; 50 if (find_directory(B_SYSTEM_DATA_DIRECTORY, &path) == B_OK 51 && path.Append("ppd") == B_OK 52 && BEntry(path.Path()).Exists()) { 53 SelectPPDDlg* dialog = 54 new SelectPPDDlg(dynamic_cast<PSData*> 55 (GetPrinterData())); 56 if (dialog->Go() != B_OK) 57 return NULL; 58 } 59 return printerName; 60 } 61 62 PrinterData* InstantiatePrinterData(BNode* node) 63 { 64 return new PSData(node); 65 } 66 67 PrinterCap* InstantiatePrinterCap(PrinterData* printerData) 68 { 69 return new PSCap(printerData); 70 } 71 72 GraphicsDriver* InstantiateGraphicsDriver(BMessage* settings, 73 PrinterData* printerData, PrinterCap* printerCap) 74 { 75 return new PSDriver(settings, printerData, printerCap); 76 } 77 }; 78 79 80 PrinterDriver * 81 instantiate_printer_driver(BNode* printerFolder) 82 { 83 return new PSPrinterDriver(printerFolder); 84 } 85