Discussion:
Print Kit Progress Report
Michael Pfeiffer
2002-10-22 16:38:30 UTC
Permalink
Hi all,

print_server beta 3 is around the corner. The cvs repository contains
the latest version. This allows to select a printer from within an
application. The settings which printer an application
uses are persistent, also the page setup and job setup
settings are persistent for each printer.

Know bug: does not start correctly from Tracker!

The Be print_server, when called from Terminal, does not start
twice if it is already running. OBOS print_server behaves the
same. This is handled in main() (PrintServerApp.cpp).
It checks if an instance of print_server is already running and exits if so.
For some reason, if started from Tracker, it seems that it blocks somewhere
in main() (probably in be_roster->IsRunning(PSRV_SIGNATURE_TYPE)).
Any help how this should be done correctly is appreciated.

BPrintJob progresses slowly (not in cvs). Most of its methods are implemented.
The print job is created, but not in the printer spooler directory and
child views of a view are not added to the job file. I don't fully
understand the semantic of BPrintJob::DrawView(view, rect, point)
with regard to child views.
I can find it out, but it would help if someone could explain how
point and rect influences the rectangle that is passed to child views
via call to BView::Draw(rect).

Some byproducts that have been created for testing are (not
in repository yet):

The class PicturePrinter that extends the class PictureIterator from PDF Writer and
prints a BPicture to stdout in human readable form.

PrintJobReader for reading data from a print job. It allows to directly
access the pages of a print job and allows to iterate through the
BPictures of a page.

The test application DumpPrintJob prints the contents of a print job
using both classes from above.

The test application Preview that shows the contents of a print job
similarly to the Preview printer. It uses the class PrintJobReader.

Anyone want to extend it to a preview printer add-on?

That's all,

- Michael
Philippe Houdoin
2002-10-22 17:38:45 UTC
Permalink
Post by Michael Pfeiffer
print_server beta 3 is around the corner. The cvs repository contains
the latest version. This allows to select a printer from within an
application. The settings which printer an application
uses are persistent, also the page setup and job setup
settings are persistent for each printer.
Woa!
I should look at these great new features, that are way belong R1
requirements BTW. You've made a great job here.
Again!
Post by Michael Pfeiffer
BPrintJob progresses slowly (not in cvs). Most of its methods are implemented.
The print job is created, but not in the printer spooler directory and
child views of a view are not added to the job file. I don't fully
understand the semantic of BPrintJob::DrawView(view, rect, point)
with regard to child views.
I can find it out, but it would help if someone could explain how
point and rect influences the rectangle that is passed to child views
via call to BView::Draw(rect).
I'm not sure myself, but here a pseudo-code of my understood
off DrawView() behavior:

draw_view_hierarchy(BView * view, BRect rect) {
BView * child;

if (!view)
return;

if (!view->IsVisible())
return;

if ((view->Flags() & B_WILL_DRAW) == 0)
return;

view->SetPrintingMode(true); // Well, should be some protected BView method
view->Draw(rect);
view->SetPrintingMode(false);

if (child = view->ChildAt(0)) {
while(child) {
draw_one_view(child, rect);
child = child->NextSibling();
};
};
}

BPrintJob::DrawView(BView * view, BRect rect, BPoint point)
{
BPicture * picture;

view->BeginPicture(new BPicture());
draw_view_hierarchy(view, rect);
picture = view->EndPicture();

write_picture_to_spool(picture, point);
}

In spool job page structure, each flatten bpicture come from one
DrawView, I bet. When SpoolPage() comes, it *close* the current page block in the spool job.

BTW, give a look at some R5 limitations of DrawView:
http://bang.dhs.org/be/bebook/The%20Interface%20Kit/PrintJob.html#DrawView
Post by Michael Pfeiffer
PrintJobReader for reading data from a print job. It allows to
directly
access the pages of a print job and allows to iterate through the
BPictures of a page.
The test application DumpPrintJob prints the contents of a print job
using both classes from above.
The test application Preview that shows the contents of a print job
similarly to the Preview printer. It uses the class PrintJobReader.
Anyone want to extend it to a preview printer add-on?
I'll give a look at this Preview test application to see how much work
is needed to mute it to a Preview print driver.

BTW, for Preview at least, we should add some support to let know
that a specific printer driver addon don't require a transport.
Hardcoding this kind of specific right in the Add Printer dialog sounds
ugly to me. Some special boolean attribut "transport_aware" in the binary addon file?
Not that's that much urgent...

-Philippe
Philippe Houdoin
2002-10-22 17:46:45 UTC
Permalink
Post by Philippe Houdoin
draw_view_hierarchy(BView * view, BRect rect) {
[...]
Post by Philippe Houdoin
if (child = view->ChildAt(0)) {
while(child) {
draw_one_view(child, rect);
Ooops, should be draw_view_hierarchy(child, rect); here, for obvious
reason.
Post by Philippe Houdoin
child = child->NextSibling();
};
};
}
Reading some specific behavior when drawing in printing mode, I guess
our BView implementation will have to make some adujustement as his Draw()
generic code to NOT draw the view bitmap in this case.
Same thing in our BBitmap when it's a overlay one...
And last but not least, BScrollBar don't draw anything when IsPrinting()
is true.
Here some meat for Interface team I guess.

Philippe.
Michael Pfeiffer
2002-10-22 18:30:04 UTC
Permalink
Hi Philippe,
Post by Philippe Houdoin
I'm not sure myself, but here a pseudo-code of my understood
[code snipped]

Thanks will examine it later.
Post by Philippe Houdoin
Post by Michael Pfeiffer
Anyone want to extend it to a preview printer add-on?
I'll give a look at this Preview test application to see how much work
is needed to mute it to a Preview print driver.
Have commited the stuff to cvs: src/tests/kit/interface/picture
Post by Philippe Houdoin
BTW, for Preview at least, we should add some support to let know
that a specific printer driver addon don't require a transport.
Hardcoding this kind of specific right in the Add Printer dialog sounds
ugly to me.
Some special boolean attribut "transport_aware" in the binary addon file?
Agree.
Post by Philippe Houdoin
Not that's that much urgent...
Agree too :)

- Michael
Philippe Houdoin
2002-10-23 09:47:11 UTC
Permalink
Post by Michael Pfeiffer
The Be print_server, when called from Terminal, does not start
twice if it is already running. OBOS print_server behaves the
same. This is handled in main() (PrintServerApp.cpp).
It checks if an instance of print_server is already running and exits if so.
For some reason, if started from Tracker, it seems that it blocks somewhere
in main() (probably in be_roster->IsRunning(PSRV_SIGNATURE_TYPE)).
Any help how this should be done correctly is appreciated.
I can't check it here from office, but did you set print_server's "
Background App" application flag? Oh, and the "Single Launch" mode, too?

-Philippe
Michael Pfeiffer
2002-10-23 15:33:13 UTC
Permalink
Post by Philippe Houdoin
Post by Michael Pfeiffer
The Be print_server, when called from Terminal, does not start
twice if it is already running. OBOS print_server behaves the
same. This is handled in main() (PrintServerApp.cpp).
It checks if an instance of print_server is already running and exits if so.
For some reason, if started from Tracker, it seems that it blocks somewhere
in main() (probably in be_roster->IsRunning(PSRV_SIGNATURE_TYPE)).
Any help how this should be done correctly is appreciated.
I can't check it here from office, but did you set print_server's "
Background App" application flag? Oh, and the "Single Launch" mode, too?
The flags are set correctly.

I have removed the code that checks if the print_server is already running
and now everything works as expected. I had added this code, because
the print_server could be start several times from Terminal on my machine.

- Michael
Philippe Houdoin
2002-10-23 15:45:14 UTC
Permalink
Post by Michael Pfeiffer
Post by Philippe Houdoin
I can't check it here from office, but did you set print_server's "
Background App" application flag? Oh, and the "Single Launch" mode, too?
The flags are set correctly.
I have removed the code that checks if the print_server is already
running and now everything works as expected. I had added this
code, because the print_server could be start several times from
Terminal on my machine.
But does it still be started several times from Terminal now?

-Philippe
Michael Pfeiffer
2002-10-23 16:54:20 UTC
Permalink
Post by Philippe Houdoin
Post by Michael Pfeiffer
I have removed the code that checks if the print_server is already
running and now everything works as expected. I had added this
code, because the print_server could be start several times from
Terminal on my machine.
But does it still be started several times from Terminal now?
No. I am not sure why I could start it serval times. Maybe recent
changes in Jamrules have fixed the problem?

- Michael

Loading...