1 /* 2 * UIDriver.cpp 3 * Copyright 1999-2000 Y.Takagi. All Rights Reserved. 4 */ 5 6 #include <Message.h> 7 8 #include "UIDriver.h" 9 #include "JobData.h" 10 #include "PrinterData.h" 11 #include "JobSetupDlg.h" 12 #include "PageSetupDlg.h" 13 #include "DbgMsg.h" 14 15 16 UIDriver::UIDriver(BMessage* message, PrinterData *printerData, 17 const PrinterCap *printerCap) 18 : 19 fMsg(message), 20 fPrinterData(printerData), 21 fPrinterCap(printerCap) 22 { 23 } 24 25 26 UIDriver::~UIDriver() 27 { 28 } 29 30 31 BMessage* 32 UIDriver::ConfigPage() 33 { 34 BMessage *clonedMessage = new BMessage(*fMsg); 35 JobData *jobData = new JobData(clonedMessage, fPrinterCap, 36 JobData::kPageSettings); 37 38 if (PageSetup(jobData, fPrinterData, fPrinterCap) < 0) { 39 delete clonedMessage; 40 clonedMessage = NULL; 41 } else { 42 clonedMessage->what = 'okok'; 43 } 44 45 delete jobData; 46 return clonedMessage; 47 } 48 49 50 BMessage* 51 UIDriver::ConfigJob() 52 { 53 BMessage *clonedMessage = new BMessage(*fMsg); 54 JobData *jobData = new JobData(clonedMessage, fPrinterCap, 55 JobData::kJobSettings); 56 57 if (JobSetup(jobData, fPrinterData, fPrinterCap) < 0) { 58 delete clonedMessage; 59 clonedMessage = NULL; 60 } else { 61 clonedMessage->what = 'okok'; 62 } 63 64 delete jobData; 65 return clonedMessage; 66 } 67 68 69 status_t 70 UIDriver::PageSetup(JobData* jobData, PrinterData* printerData, 71 const PrinterCap* printerCap) 72 { 73 PageSetupDlg *dialog = new PageSetupDlg(jobData, printerData, printerCap); 74 return dialog->Go(); 75 } 76 77 78 status_t 79 UIDriver::JobSetup(JobData *jobData, PrinterData *printerData, 80 const PrinterCap *printerCap) 81 { 82 JobSetupDlg *dialog = new JobSetupDlg(jobData, printerData, printerCap); 83 return dialog->Go(); 84 } 85