[Gnome-print] GnomePrintSettings



GnomePrintSettings
==================

Now that gnome-print-admin is (sorta) working, I've been giving a little
thought about the PaperSize/PaperOrientation & Negotiation beetween the
application and the printing system. 

So here is a first shoot at the api for doing that (We should be able
to be backwards compatible with the current stuff)


<brain storm>
We create a new Object called "GnomePrintSettings", which is an opaque
object. The widgets for Paper Orientation, Print Margins & Paper size
can be created by gnome-print from this Object. When the "Properties"
button on the  print dialog is poped up, the GnomePrintSettings object
is updated.  This object also has methods to read/writer printer
settings to xml.

When a new document is created it contains a pointer to a
GnomePrintSettings object, this object is created with :

GnomePrintSettings * gnome_print_settings_new ()

Since we want this settings to be stored inside a document, we provide
XML functions to read/write them. (Ascii functions as well ? Maybe)

void               gnome_print_settings_xml_write (XmlNodePtr parent);
GnomePrintSettings gnome_print_settings_xml_read (XmlNodePtr node);

in _write the parent node ('Say "PrintSettings" is already created) we
do everything below that node. So the app would do something like :

node = xmlNewChild (node, gmr, "PrinterSettings", NULL);
if (!gnome_print_settings_xml_write (node))
       return NULL;

[Opposite for reading].

When the app needs to pop up a "Paper Settings" or "Print Settings"
dialog, it uses the GnomePrintSettings for creating the widgets. To
create PaperOrientation, PaperSize & Paper Margins widgets from this
object. We would call :

a) GtkWidget* gnome_print_settings_paper_size_widget_new
                          (GnomePrintSettings *gps,
                           GnomePrintPaperSizeWidgetType type); 
b) GtkWidget* gnome_print_settings_paper_orientation_widget_new
                          (GnomePrintSettings *gps,
                           GnomePrintPaperOrientationWidgetType type);
c) GtkWidget* gnome_print_settings_paper_widget_new
                          (GnomePrintSettings *gps);
                                           
(c) = (a) + (b) + visual representation of paper

[ Yes, lauris I know you like short function/enums names, this is just
to get the ideas down, we can use shorter names :-)]

I think we need to use a type argument because there are different
layouts for this widgets. One can set a Paper Size that includes a Visual
representation of the  paper, or the orientation in a GtkOptionMenu or
GtkRadio buttons etc..

At the time of poping up the print dialog, we pass this object to
GnomePrint.
[Please note that thie GnomePrintSettings object, contains the Printer
Choosen for that document.]

There rest is handled internally by gnome-print. I just want to get the 
API agreed upon and then start thinking about the internals.

When the app prints
===================
Since the App no longer handles print orientaion/Paper Size. Before it
prints it queries gnome-print for the print Bounding Box (margins 
substracted / margins NOT substracted ). With :

void     gnome_print_get_print_bbox (GnomePrintContext *pc,
                                     gboolean substract_margins,
                                     gdouble *widht,
                                     gdouble *height);

(do we need the substract margins ??? )

The substract_margins is a flag to get the Page size, v.s. the printable
size. I am not sure we need this, but there needs to be a way for the
app to get the area in which it can actually draw inside the paper.

Where should this go ?
======================

I think we are going to have to add this to gnome-print-admin, if we
don't, gnome-print will always depend on gtk. 

</brainstorm>

regards,
Chema




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]