* Store resolution ID in libprint specific field in JobData;

as the pair of x/y resolutions might not be unique in all
  supported Gutenprint printer models 


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39142 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Pfeiffer
2010-10-25 14:46:26 +00:00
parent f53abcbdf8
commit f412257ccb
3 changed files with 30 additions and 12 deletions
+17
View File
@@ -38,6 +38,7 @@ static const char* kJDPageSelection = "JJJJ_page_selection";
static const char* kJDMarginUnit = "JJJJ_margin_unit";
static const char* kJDPhysicalRect = "JJJJ_physical_rect";
static const char* kJDScaledPhysicalRect = "JJJJ_scaled_physical_rect";
static const char* kJDResolution = "JJJJ_resolution";
JobData::JobData(BMessage *msg, const PrinterCap *cap, Settings settings)
{
@@ -52,6 +53,7 @@ JobData::JobData(const JobData &job_data)
{
fShowPreview = job_data.fShowPreview;
fPaper = job_data.fPaper;
fResolutionID = job_data.fResolutionID;
fXRes = job_data.fXRes;
fYRes = job_data.fYRes;
fOrientation = job_data.fOrientation;
@@ -86,6 +88,7 @@ JobData &JobData::operator = (const JobData &job_data)
{
fShowPreview = job_data.fShowPreview;
fPaper = job_data.fPaper;
fResolutionID = job_data.fResolutionID;
fXRes = job_data.fXRes;
fYRes = job_data.fYRes;
fOrientation = job_data.fOrientation;
@@ -137,6 +140,17 @@ void JobData::load(BMessage *msg, const PrinterCap *cap, Settings settings)
} else
fPaper = kA4;
if (msg->HasInt32(kJDResolution)) {
int32 resolution;
msg->FindInt32(kJDResolution, &resolution);
fResolutionID = resolution;
} else if (cap->isSupport(PrinterCap::kResolution)) {
fResolutionID = cap->getDefaultCap(PrinterCap::kResolution)->ID();
} else {
// should not reach here!
fResolutionID = 0;
}
if (msg->HasInt64(kJDXRes)) {
int64 xres64;
msg->FindInt64(kJDXRes, &xres64);
@@ -311,6 +325,9 @@ void JobData::save(BMessage *msg)
msg->RemoveName(kJDPaper);
msg->AddInt32(kJDPaper, fPaper);
msg->RemoveName(kJDResolution);
msg->AddInt32(kJDResolution, fResolutionID);
msg->RemoveName(kJDXRes);
msg->AddInt64(kJDXRes, fXRes);