[open-beos-printing] Code change notice

Before I commit the code I just want to let everyone know what I have done...

1) Added default=5Fsettings() to Driver.cpp to use PrinterSettings class that
 controls settings

- accorting to the scheme above I have found no code that calls page setup
 before calling ConfigPage(), so the default=5Fsettings() function never gets 
called
 resulting in a badly formated message (has the wrong set of data fields we
 need) being sent to PageSetupWindow constructor. Therefore, on the council of
 Philippe, I have added a Validate() method to the PrinterSettings class that
 validates the structure of the message and adds constructs the message to be 
correct
 for PageSetupWindow. This means that PageSetupWindow will always get a good
 message, and I have taken out the code in the PageSetupWindow constructor to 
check
 for the presence of the data fields it needs. However, the result of the
 initial problem, that default=5Fsettings() is not called, resulted in my adding
 these Validate calls to both config=5Fpage() and config=5Fjob() functions, 
which
 really they should not be there... 

- what is really needed is a test app with a bunch of test harnesses to check
 all combination of app based printing scenarios, and also test for bad coding
 errors that an app may perform, rather than using StyleEdit and Gobe to test 
the
 driver.

NOTE: depending on the app that causes config=5Fpage() to be called, the
 message will have different configurations of data fields. StyledEdit passes 
only a
 single field, while Gobe passes a bunch. The issue is that config=5Fpage()
 cannot simply call default=5Fsettings() in the case where the message does not 
have
 the data fields we want, since we will wipe them out with the new default one.
 So rather than calling default=5Fsettings() from config=5Fpage(), I just add
 the data fields we need with a call to PrinterSettings::ReadSettings(), or
 PrinterSettings::GetDefaults() if there are no previously saved settings.

2) Code now does the following:

a) Reads BNode to check if there is a previous BFS attibute called
 printer=5Fsettings that has the latest default settings

b) If no attib printer=5Fsettings, then reads pdf=5Fdefault=5Fsettings file in
 /home/config/settings for initial defaults. If pdf=5Fdefault=5Fsettings not
 there, it uses hard coded values, writes the pdf=5Fdefault=5Fsettings file and
 saves BMessage to spool BNode as a BFS attribute called printer=5Fsettings

c) If pdf=5Fdefault=5Fsettings are there it uses these values, then saves
 BMessage to spool BNode as a BFS attribute called printer=5Fsettings

d) PageSetupWindow::UpdateSetupMessage() will call the PrinterSettings class to
 write the new settings created in the dialog to the spooler BNode attribute
 printer=5Fsettings

3) Added a debug MessagePrinter class that prints the contents of a BMessage to
 a text file on the desktop with the name of the message as the name of the
 file. If there are BMessages in the BMessage it will print these too, but in
 seperate files. You can see the use of this class in the code commented out in
 Driver.cpp, which should be removed at some later time, and perhaps put in a 
printer
 testing app.

Cheers

---------------------
 Simon Gauvin,
 Dalhousie University
 gauvins@xxxxxxxxx


Other related posts: