* 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:
@@ -226,6 +226,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
bool fShowPreview;
|
bool fShowPreview;
|
||||||
Paper fPaper;
|
Paper fPaper;
|
||||||
|
int32 fResolutionID;
|
||||||
int32 fXRes;
|
int32 fXRes;
|
||||||
int32 fYRes;
|
int32 fYRes;
|
||||||
Orientation fOrientation;
|
Orientation fOrientation;
|
||||||
@@ -271,6 +272,9 @@ public:
|
|||||||
Paper getPaper() const { return fPaper; }
|
Paper getPaper() const { return fPaper; }
|
||||||
void setPaper(Paper paper) { fPaper = paper; }
|
void setPaper(Paper paper) { fPaper = paper; }
|
||||||
|
|
||||||
|
int32 getResolutionID() const { return fResolutionID; }
|
||||||
|
void setResolutionID(int32 resolution) { fResolutionID = resolution; }
|
||||||
|
|
||||||
int32 getXres() const { return fXRes; }
|
int32 getXres() const { return fXRes; }
|
||||||
void setXres(int32 xres) { fXRes = xres; }
|
void setXres(int32 xres) { fXRes = xres; }
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ static const char* kJDPageSelection = "JJJJ_page_selection";
|
|||||||
static const char* kJDMarginUnit = "JJJJ_margin_unit";
|
static const char* kJDMarginUnit = "JJJJ_margin_unit";
|
||||||
static const char* kJDPhysicalRect = "JJJJ_physical_rect";
|
static const char* kJDPhysicalRect = "JJJJ_physical_rect";
|
||||||
static const char* kJDScaledPhysicalRect = "JJJJ_scaled_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)
|
JobData::JobData(BMessage *msg, const PrinterCap *cap, Settings settings)
|
||||||
{
|
{
|
||||||
@@ -52,6 +53,7 @@ JobData::JobData(const JobData &job_data)
|
|||||||
{
|
{
|
||||||
fShowPreview = job_data.fShowPreview;
|
fShowPreview = job_data.fShowPreview;
|
||||||
fPaper = job_data.fPaper;
|
fPaper = job_data.fPaper;
|
||||||
|
fResolutionID = job_data.fResolutionID;
|
||||||
fXRes = job_data.fXRes;
|
fXRes = job_data.fXRes;
|
||||||
fYRes = job_data.fYRes;
|
fYRes = job_data.fYRes;
|
||||||
fOrientation = job_data.fOrientation;
|
fOrientation = job_data.fOrientation;
|
||||||
@@ -86,6 +88,7 @@ JobData &JobData::operator = (const JobData &job_data)
|
|||||||
{
|
{
|
||||||
fShowPreview = job_data.fShowPreview;
|
fShowPreview = job_data.fShowPreview;
|
||||||
fPaper = job_data.fPaper;
|
fPaper = job_data.fPaper;
|
||||||
|
fResolutionID = job_data.fResolutionID;
|
||||||
fXRes = job_data.fXRes;
|
fXRes = job_data.fXRes;
|
||||||
fYRes = job_data.fYRes;
|
fYRes = job_data.fYRes;
|
||||||
fOrientation = job_data.fOrientation;
|
fOrientation = job_data.fOrientation;
|
||||||
@@ -137,6 +140,17 @@ void JobData::load(BMessage *msg, const PrinterCap *cap, Settings settings)
|
|||||||
} else
|
} else
|
||||||
fPaper = kA4;
|
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)) {
|
if (msg->HasInt64(kJDXRes)) {
|
||||||
int64 xres64;
|
int64 xres64;
|
||||||
msg->FindInt64(kJDXRes, &xres64);
|
msg->FindInt64(kJDXRes, &xres64);
|
||||||
@@ -311,6 +325,9 @@ void JobData::save(BMessage *msg)
|
|||||||
msg->RemoveName(kJDPaper);
|
msg->RemoveName(kJDPaper);
|
||||||
msg->AddInt32(kJDPaper, fPaper);
|
msg->AddInt32(kJDPaper, fPaper);
|
||||||
|
|
||||||
|
msg->RemoveName(kJDResolution);
|
||||||
|
msg->AddInt32(kJDResolution, fResolutionID);
|
||||||
|
|
||||||
msg->RemoveName(kJDXRes);
|
msg->RemoveName(kJDXRes);
|
||||||
msg->AddInt64(kJDXRes, fXRes);
|
msg->AddInt64(kJDXRes, fXRes);
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
#include <Box.h>
|
#include <Box.h>
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
|
#include <Debug.h>
|
||||||
#include <Font.h>
|
#include <Font.h>
|
||||||
#include <GridView.h>
|
#include <GridView.h>
|
||||||
#include <GroupLayout.h>
|
#include <GroupLayout.h>
|
||||||
@@ -266,18 +267,14 @@ PageSetupView::UpdateJobData()
|
|||||||
BRect physical_rect = paperCap->fPhysicalRect;
|
BRect physical_rect = paperCap->fPhysicalRect;
|
||||||
fJobData->setPaper(paperCap->fPaper);
|
fJobData->setPaper(paperCap->fPaper);
|
||||||
|
|
||||||
int count;
|
const char *resolutionLabel = fResolution->FindMarked()->Label();
|
||||||
|
const ResolutionCap* resolution = static_cast<const ResolutionCap*>(
|
||||||
count = fPrinterCap->countCap(PrinterCap::kResolution);
|
fPrinterCap->findCap(PrinterCap::kResolution, resolutionLabel));
|
||||||
ResolutionCap **resolution_cap = (ResolutionCap **)fPrinterCap->enumCap(PrinterCap::kResolution);
|
ASSERT(resolution != NULL);
|
||||||
const char *resolution_label = fResolution->FindMarked()->Label();
|
if (resolution != NULL) {
|
||||||
while (count--) {
|
fJobData->setXres(resolution->fXResolution);
|
||||||
if (!strcmp((*resolution_cap)->fLabel.c_str(), resolution_label)) {
|
fJobData->setYres(resolution->fYResolution);
|
||||||
fJobData->setXres((*resolution_cap)->fXResolution);
|
fJobData->setResolutionID(resolution->ID());
|
||||||
fJobData->setYres((*resolution_cap)->fYResolution);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
resolution_cap++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// rotate paper and physical rectangle if landscape orientation
|
// rotate paper and physical rectangle if landscape orientation
|
||||||
|
|||||||
Reference in New Issue
Block a user