* build fix, removed leftover debug var...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24533 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
PrintJobReader
|
PrintJobReader
|
||||||
|
|
||||||
Copyright (c) 2002 OpenBeOS.
|
Copyright (c) 2002 OpenBeOS.
|
||||||
|
|
||||||
Author:
|
Author:
|
||||||
Michael Pfeiffer
|
Michael Pfeiffer
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
the Software without restriction, including without limitation the rights to
|
the Software without restriction, including without limitation the rights to
|
||||||
@@ -32,6 +32,7 @@ THE SOFTWARE.
|
|||||||
|
|
||||||
#include <File.h>
|
#include <File.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
|
#include <Picture.h>
|
||||||
|
|
||||||
class PrintJobPage {
|
class PrintJobPage {
|
||||||
BFile fJobFile; // the job file
|
BFile fJobFile; // the job file
|
||||||
@@ -39,17 +40,17 @@ class PrintJobPage {
|
|||||||
int32 fNumberOfPictures; // of this page
|
int32 fNumberOfPictures; // of this page
|
||||||
int32 fPicture; // the picture returned by NextPicture()
|
int32 fPicture; // the picture returned by NextPicture()
|
||||||
status_t fStatus;
|
status_t fStatus;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PrintJobPage();
|
PrintJobPage();
|
||||||
PrintJobPage(const PrintJobPage& copy);
|
PrintJobPage(const PrintJobPage& copy);
|
||||||
PrintJobPage(BFile* jobFile, off_t start);
|
PrintJobPage(BFile* jobFile, off_t start);
|
||||||
status_t InitCheck() const;
|
status_t InitCheck() const;
|
||||||
|
|
||||||
int32 NumberOfPictures() const { return fNumberOfPictures; }
|
int32 NumberOfPictures() const { return fNumberOfPictures; }
|
||||||
|
|
||||||
status_t NextPicture(BPicture& picture, BPoint& p, BRect& r);
|
status_t NextPicture(BPicture& picture, BPoint& p, BRect& r);
|
||||||
|
|
||||||
PrintJobPage& operator=(const PrintJobPage& copy);
|
PrintJobPage& operator=(const PrintJobPage& copy);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -65,10 +66,10 @@ class PrintJobReader {
|
|||||||
public:
|
public:
|
||||||
PrintJobReader(BFile* jobFile);
|
PrintJobReader(BFile* jobFile);
|
||||||
virtual ~PrintJobReader();
|
virtual ~PrintJobReader();
|
||||||
|
|
||||||
// test after construction if this is a valid job file
|
// test after construction if this is a valid job file
|
||||||
status_t InitCheck() const;
|
status_t InitCheck() const;
|
||||||
|
|
||||||
// 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 { return fFirstPage; }
|
||||||
@@ -78,7 +79,7 @@ public:
|
|||||||
BRect PrintableRect() const;
|
BRect PrintableRect() const;
|
||||||
void GetResolution(int32 *xdpi, int32 *ydpi) const;
|
void GetResolution(int32 *xdpi, int32 *ydpi) const;
|
||||||
float GetScale() const;
|
float GetScale() const;
|
||||||
|
|
||||||
// retrieve page
|
// retrieve page
|
||||||
status_t GetPage(int32 no, PrintJobPage& pjp);
|
status_t GetPage(int32 no, PrintJobPage& pjp);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
PrintJobReader
|
PrintJobReader
|
||||||
|
|
||||||
Copyright (c) 2002 OpenBeOS.
|
Copyright (c) 2002 OpenBeOS.
|
||||||
|
|
||||||
Author:
|
Author:
|
||||||
Michael Pfeiffer
|
Michael Pfeiffer
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
the Software without restriction, including without limitation the rights to
|
the Software without restriction, including without limitation the rights to
|
||||||
@@ -45,7 +45,7 @@ PrintJobPage::PrintJobPage()
|
|||||||
, fNumberOfPictures(0)
|
, fNumberOfPictures(0)
|
||||||
, fPicture(0)
|
, fPicture(0)
|
||||||
, fStatus(B_ERROR)
|
, fStatus(B_ERROR)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ PrintJobPage& PrintJobPage::operator=(const PrintJobPage& copy)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PrintJobPage::PrintJobPage(BFile* jobFile, off_t start)
|
PrintJobPage::PrintJobPage(BFile* jobFile, off_t start)
|
||||||
: fJobFile(*jobFile)
|
: fJobFile(*jobFile)
|
||||||
, fPicture(0)
|
, fPicture(0)
|
||||||
, fStatus(B_ERROR)
|
, fStatus(B_ERROR)
|
||||||
@@ -84,7 +84,6 @@ PrintJobPage::PrintJobPage(BFile* jobFile, off_t start)
|
|||||||
if (fJobFile.Seek(start, SEEK_SET) != start)
|
if (fJobFile.Seek(start, SEEK_SET) != start)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
off_t nextPage;
|
|
||||||
if (fJobFile.Read(&fNumberOfPictures, sizeof(int32)) == sizeof(int32)) {
|
if (fJobFile.Read(&fNumberOfPictures, sizeof(int32)) == sizeof(int32)) {
|
||||||
// (sizeof(int32) * 10) == padding in _page_header_
|
// (sizeof(int32) * 10) == padding in _page_header_
|
||||||
fJobFile.Seek(sizeof(off_t) + sizeof(int32) * 10, SEEK_CUR);
|
fJobFile.Seek(sizeof(off_t) + sizeof(int32) * 10, SEEK_CUR);
|
||||||
@@ -105,13 +104,13 @@ status_t PrintJobPage::NextPicture(BPicture& picture, BPoint& point, BRect& rect
|
|||||||
if (fPicture >= fNumberOfPictures)
|
if (fPicture >= fNumberOfPictures)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
fPicture++;
|
fPicture++;
|
||||||
|
|
||||||
fJobFile.Seek(fNextPicture, SEEK_SET);
|
fJobFile.Seek(fNextPicture, SEEK_SET);
|
||||||
fJobFile.Read(&point, sizeof(BPoint));
|
fJobFile.Read(&point, sizeof(BPoint));
|
||||||
fJobFile.Read(&rect, sizeof(BRect));
|
fJobFile.Read(&rect, sizeof(BRect));
|
||||||
status_t rc = picture.Unflatten(&fJobFile);
|
status_t rc = picture.Unflatten(&fJobFile);
|
||||||
fNextPicture = fJobFile.Position();
|
fNextPicture = fJobFile.Position();
|
||||||
|
|
||||||
if (rc != B_OK)
|
if (rc != B_OK)
|
||||||
fPicture = fNumberOfPictures;
|
fPicture = fNumberOfPictures;
|
||||||
|
|
||||||
@@ -122,7 +121,7 @@ status_t PrintJobPage::NextPicture(BPicture& picture, BPoint& point, BRect& rect
|
|||||||
// # pragma mark --- PrintJobReader
|
// # pragma mark --- PrintJobReader
|
||||||
|
|
||||||
|
|
||||||
PrintJobReader::PrintJobReader(BFile* jobFile)
|
PrintJobReader::PrintJobReader(BFile* jobFile)
|
||||||
: fJobFile(*jobFile)
|
: fJobFile(*jobFile)
|
||||||
, fNumberOfPages(-1)
|
, fNumberOfPages(-1)
|
||||||
, fPageIndex(NULL)
|
, fPageIndex(NULL)
|
||||||
|
|||||||
Reference in New Issue
Block a user