From 17f76af5eaaeeb37d0fda10deaaa884e966df1ff Mon Sep 17 00:00:00 2001 From: Michael Pfeiffer Date: Sun, 23 Jan 2005 12:28:25 +0000 Subject: [PATCH] Set default values for printable/paper/physical rect. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10974 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../print/drivers/shared/libprint/JobData.cpp | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/add-ons/print/drivers/shared/libprint/JobData.cpp b/src/add-ons/print/drivers/shared/libprint/JobData.cpp index 0e421a5275..d968e53c07 100644 --- a/src/add-ons/print/drivers/shared/libprint/JobData.cpp +++ b/src/add-ons/print/drivers/shared/libprint/JobData.cpp @@ -119,11 +119,14 @@ void JobData::load(BMessage *msg, const PrinterCap *cap, Settings settings) fMsg = msg; fSettings = settings; + const PaperCap *paperCap = NULL; + if (msg->HasInt32(kJDPaper)) fPaper = (Paper)msg->FindInt32(kJDPaper); - else if (cap->isSupport(PrinterCap::kPaper)) - fPaper = ((const PaperCap *)cap->getDefaultCap(PrinterCap::kPaper))->paper; - else + else if (cap->isSupport(PrinterCap::kPaper)) { + paperCap = (const PaperCap *)cap->getDefaultCap(PrinterCap::kPaper); + fPaper = paperCap->paper; + } else fPaper = kA4; if (msg->HasInt64(kJDXRes)) { @@ -160,26 +163,38 @@ void JobData::load(BMessage *msg, const PrinterCap *cap, Settings settings) if (msg->HasRect(kJDPaperRect)) { fPaperRect = msg->FindRect(kJDPaperRect); + } else if (paperCap != NULL) { + fPaperRect = paperCap->paper_rect; } if (msg->HasRect(kJDScaledPaperRect)) { fScaledPaperRect = msg->FindRect(kJDScaledPaperRect); + } else { + fScaledPaperRect = fPaperRect; } if (msg->HasRect(kJDPrintableRect)) { fPrintableRect = msg->FindRect(kJDPrintableRect); + } else if (paperCap != NULL) { + fPrintableRect = paperCap->physical_rect; } if (msg->HasRect(kJDScaledPrintableRect)) { fScaledPrintableRect = msg->FindRect(kJDScaledPrintableRect); + } else { + fScaledPrintableRect = fPrintableRect; } if (msg->HasRect(kJDPhysicalRect)) { fPhysicalRect = msg->FindRect(kJDPhysicalRect); + } else if (paperCap != NULL) { + fPhysicalRect = paperCap->physical_rect; } if (msg->HasRect(kJDScaledPhysicalRect)) { fScaledPhysicalRect = msg->FindRect(kJDScaledPhysicalRect); + } else { + fScaledPhysicalRect = fPhysicalRect; } if (msg->HasInt32(kJDFirstPage))