Get first and last page from job settings instead of print_file_header. In print_filer_header first_page is an offset into the spool file (the field is unused or reserved on BeOS R5 and is always -1) and page_count is the number of pages in the spool file. In the job settings first/last page is the page number of the first/last page as specified in the page setup dialog.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24536 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -57,7 +57,6 @@ public:
|
|||||||
class PrintJobReader {
|
class PrintJobReader {
|
||||||
BFile fJobFile; // the job file
|
BFile fJobFile; // the job file
|
||||||
int32 fNumberOfPages; // the number of pages in the job file
|
int32 fNumberOfPages; // the number of pages in the job file
|
||||||
off_t fFirstPage; // the page number of the first page
|
|
||||||
BMessage fJobSettings; // the settings extracted from the job file
|
BMessage fJobSettings; // the settings extracted from the job file
|
||||||
off_t* fPageIndex; // start positions of pages in the job file
|
off_t* fPageIndex; // start positions of pages in the job file
|
||||||
|
|
||||||
@@ -72,8 +71,8 @@ public:
|
|||||||
|
|
||||||
// accessors to informations from job file
|
// accessors to informations from job file
|
||||||
int32 NumberOfPages() const { return fNumberOfPages; }
|
int32 NumberOfPages() const { return fNumberOfPages; }
|
||||||
int32 FirstPage() const { return fFirstPage; }
|
int32 FirstPage() const;
|
||||||
int32 LastPage() const { return fFirstPage + fNumberOfPages - 1; }
|
int32 LastPage() const;
|
||||||
const BMessage* JobSettings() const { return &fJobSettings; }
|
const BMessage* JobSettings() const { return &fJobSettings; }
|
||||||
BRect PaperRect() const;
|
BRect PaperRect() const;
|
||||||
BRect PrintableRect() const;
|
BRect PrintableRect() const;
|
||||||
|
|||||||
@@ -135,7 +135,6 @@ PrintJobReader::PrintJobReader(BFile* jobFile)
|
|||||||
if (fJobFile.Read(&header, sizeof(header)) == sizeof(header)) {
|
if (fJobFile.Read(&header, sizeof(header)) == sizeof(header)) {
|
||||||
if (fJobSettings.Unflatten(&fJobFile) == B_OK) {
|
if (fJobSettings.Unflatten(&fJobFile) == B_OK) {
|
||||||
fNumberOfPages = header.page_count;
|
fNumberOfPages = header.page_count;
|
||||||
fFirstPage = header.first_page;
|
|
||||||
fPageIndex = new off_t[fNumberOfPages];
|
fPageIndex = new off_t[fNumberOfPages];
|
||||||
|
|
||||||
BuildPageIndex();
|
BuildPageIndex();
|
||||||
@@ -189,6 +188,22 @@ status_t PrintJobReader::GetPage(int32 page, PrintJobPage& pjp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32 PrintJobReader::FirstPage() const
|
||||||
|
{
|
||||||
|
int32 firstPage = -1;
|
||||||
|
fJobSettings.FindInt32("first_page", &firstPage);
|
||||||
|
return firstPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32 PrintJobReader::LastPage() const
|
||||||
|
{
|
||||||
|
int32 lastPage = -1;
|
||||||
|
fJobSettings.FindInt32("last_page", &lastPage);
|
||||||
|
return lastPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BRect PrintJobReader::PaperRect() const
|
BRect PrintJobReader::PaperRect() const
|
||||||
{
|
{
|
||||||
BRect r;
|
BRect r;
|
||||||
@@ -211,6 +226,7 @@ void PrintJobReader::GetResolution(int32 *xdpi, int32 *ydpi) const
|
|||||||
fJobSettings.FindInt32("yres", ydpi);
|
fJobSettings.FindInt32("yres", ydpi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float PrintJobReader::GetScale() const
|
float PrintJobReader::GetScale() const
|
||||||
{
|
{
|
||||||
float scale = 1.0;
|
float scale = 1.0;
|
||||||
|
|||||||
Reference in New Issue
Block a user