[open-beos-printing] Re: Printing Question

  • From: "Ithamar R. Adema" <ithamar@xxxxxxxxx>
  • To: open-beos-printing@xxxxxxxxxxxxx
  • Date: Sun, 20 Jan 2002 11:08:28 +0100

>
>>
>>Hi,
>>
>>about the stuff you're asking up on a website soon, but I'll do a 
quick 
>>answer for ya here:
>
>Ithamar, thanks for the reply.
>
>Ok. I have a better understanding, but more questions as a result:
>
>1) There is no default=3D5Fsettings(BNode* printer) method in 
Driver.cpp, or
> anywhere in the code. I assume that you will want me to add this 
method to
> Driver.cpp=3D3F
>

Yeah, it is a new method defined since R4.5, but is was never really 
documented. There is a BNewsLetter about it, but can't find the 
reference at the moment. It should be added sometime. I must be fair 
and say that I haven't found many apps that trigger it to be called 
yet, but it =5Fcould=5F be called, sure.

>2) default=3D5Fsettings() should write the attributes to the printer 
BNode and
> return them in the BMessage=3D3F

Hmmm, I guess the default settings could be written to the BNode in 
add=5Fprinter()  (is directly called after the printer has been created), 
and read and returned from default=5Fsettings(). It are the "global" 
default settings, before any config=5Fpage() or config=5Fjob() has been 
done.

>3) where should the 'actual' default setting values be located, with 
'hard
> coded' defaults in the code, or in a settings file like ~/config/
printer=3D5Fdefaults
> =3D3F

Good question. Personally, the last made settings from a Page Setup 
=5Fshould=5F be stored by the app in every document. An app can request the 
settings by calling BPrintJob::Settings(), which are either the default 
settings if ConfigPage() / ConfigJob() has not been called on the 
BPrintJob object, or the result of these dialogs if they have been 
called. So, if you want to store it, it would almost be the cleanest to 
store it on a per-app basis. The problem is, that you don't know what 
app requested the dialogs from the driver, so that is a real problem.

>4) config=3D5Fpage() could be called with an empty settings BMessage, 
which
> should then call default=3D5Fsettings()=3D3F

Good question again. I guess BPrintJob should be handling this, but I 
do not think it is doing that for R5 :( This might however be a good 
addition for the OBOS print=5Fserver :) I guess you could do this for R5, 
yeah.....

Please note however, the message is never going to be empty. AFAIK, 
there will always be a "current=5Fprinter" element in the settings, which 
is added by the BPrintJob code. But you should be able to test that 
quite easily in your code.

>5) The constructor for PageSetupWindow class gets the settings 
BMessage pre-set
> from these previous calls, but what saves these settings back to the 
BNode so
> that other applications can use them=3D3F  

If you want to make the settings global, the easiest way to do this is 
to simply flatten the BMessage and write it as an attribute using 
BNode::WriteAttr. You could overwrite the attribute used in 
add=5Fprinter, so any call to default=5Fsettings() will also return these 
settings.

However, I would give the user the option to save those settings using 
a button named something like "Save as Default" or something simular.

Regards,

Ithamar.



Other related posts: