Re: Gtk+ print support - request for feedback
- From: Alex Graveley <alex beatniksoftware com>
- To: Alexander Larsson <alexl redhat com>
- Cc: till kamppeter gmx net, "gtk-devel-list gnome org" <gtk-devel-list gnome org>, mike easysw com
- Subject: Re: Gtk+ print support - request for feedback
- Date: Fri, 03 Mar 2006 09:45:12 -0800
Thought it would be vauable to get some non-gtk eyes on this great work.
I've cc'd Till Kamppeter, who leads linuxprinting.org, and Michael
Sweet, the CUPS dude.
-Alex
Alexander Larsson wrote:
Its no secret that John Palmieri and I have been working on print
support for Gtk+ a while now. We're moving forward, and while its not
yet finished we now at least have something that is mostly
working. So, we think the time has now come to get some feedback from
the community.
The code is availible in libegg/libegg/print-operation. You need to
use the autogen.sh inside that directory, because the toplevel libegg
configure doesn't work on win32.
The code consists of several parts. First we have the highlevel
portable print API that most apps are supposed to use, plus
implementations for win32 and unix. Then we have the code for the Unix
print dialog which is used for the unix implementation of the
highlevel code, but is also availible on unix only for apps like OOo
and Firefox to use as a "native" print dialog. The dialog is split
into common code and code implementing cups support. The cups support
is hidden behind a backend interface, and the long term plan is to
make it a module (like immodules or pixbuf loaders). However at the
moment its just linked in.
Here is a highlevel walktrough of the sources:
Highlevel API
=============
* eggprint.h
General include file which is meant to pull in all interesting headers
for printing.
* eggprintoperation.[ch]
* eggprintoperation-private.h
This defines the main object you interact with when printing. When the
user selects print you allocate an EggPrintOperation, set some data
like page size, old print settings, nr of pages, current page, etc and
kick it off. It will then show a dialog, let the user select a printer
and options. When the user finished the dialog various signals will be
emited on the EggPrintOperation, the main one being draw_page() which
you are supposed to catch and render the page using cairo.
* eggprintcontext.[ch]
* eggprintcontext-private.h
This is an object that gets passed to the begin_print,
request_page_setup, draw_page and end_print signals on the print
operation. It lets you get the cairo context and important rendering
information like page size and resolution. It also lets you easily
create pango layoungs/contexts that match the font metrics of the
cairo surface.
* eggprintersettings.[ch]
This object represents the settings of a print dialog in a
system-independent way. Its basically a key-string = value-string
hashtable with some predefined keys that you can use for conveniency
(although an implementation can use more keys than the predefined
ones). The main use for this object is that once you've printed you
can get a settings object that represents the settings the user chose,
and the next time you print you can pass that in so that the user
doesn't have to re-set all his settings. Its also possible to
enumerate the settings so that you can easily save the settings for
the next time your app runs, or even in a document. The predefined
keys try to use shared values as much as possible so that moving such
a document between systems still works.
* eggpapersize.[ch]
* paper_names.c
Object that handles paper sizes. We use a standard called "PWG
5101.1-2002 PWG: Standard for Media Standardized Names" to name the
page sizes (and to get the data for the page sizes).
* eggpagesetup.[ch]
This object stored the page size, orientation and margins. The idea is
that you can pass/get one of these from the page setup dialog and then
send it to the print object when printing.
* eggprintenums.h
Various enums needed for printing
* eggprintoperation-win32.c
* eggprint-win32.[ch]
Win32 implementation of the highlevel API
* eggprintoperation-unix.c
Unix implementation of the highlevel API
Unix Print Dialog
=================
* eggprintunixdialog.[ch]
The print dialog code. The header is availible only on unix systems. I
think it will be put in a separate include directory and have its own
pkg-config module that you can use to get the headers.
* eggprintbackend.[ch]
* eggprinter.[ch]
* eggprinter-private.h
A printer backend implements the EggPrintBackend interface, which
hands out EggPrinter objects to the dialog.
* eggprintbackendsetting.[ch]
* eggprintbackendsettingset.[ch]
The backend hands the dialog code a set of EggPrintBackendSettings
that describe the possible settings that a printer has. For instance,
the cups implementation generates these from the ppd file for the
printer.
* eggprintsettingwidget.[ch]
Widget that can display an EggPrintBackendSetting
*eggprintjob.[ch]
*eggprintjob-private.h
Code to handle sending a print job to the printer
* eggcupsutils.[ch]
* eggprintbackendcups.[ch]
* eggprintercups.[ch]
* eggprintercups-private.h
Cups backend.
Test Code
=========
* printedit.c
A simple editor that lets you print
* testprintfileoperation.[ch]
And example of how you can derive from EggPrintOperation to implement
printing.
* testprint.c
A small test app that shows how you print using the high level api,
using both g_signal_connect and using TestPrintFileOperation.
* testshowdialog.c
Just shows a print dialog
The current status of the code is that on both win32 and unix (using
cups) you can select a printer and print to it, and most options in
the dialog work. However there is still lots of work to do. Here are
some of the things we're planning:
Highlevel API:
==============
We want to add an API for showing a page setup dialog. This is
something that most other platforms has, and makes sense for
page-oriented applications. It's used to allow the user to set the page
size and orientation before the print dialog, which is important in
e.g. a DTP application.
Add some form of simple feedback of the job progress after
printing. This would be in the form of some sort of callbacks on the
print operation object so that you can know when the print job
finished so you can display some form of progress icon/bar/whatever.
Add API that allows you to add per-application specific settings to
the print dialog. Given the support in the various platforms this is
best done by allowing you to add a custom tab to the dialog.
Unix/Cups implementation:
=========================
Need to figure out the details of exactly how to handle page sizes,
page orientation and margins. We're currently mostly ignoring this
because I'm not yet sure what the best way to handle it is.
The settings in the "Job" tab aren't sent to the printer.
We need to add more custom translations for wellknown PPD options so
that we can get known good and sane texts in the UI.
The dialog needs some general UI review and polish, including HIGified
padding.
Win32:
======
The dialogs currently block the mainloop. We need to use threads or
something like that, so that the other windows in the app repaint
while the print dialog is up.
It would be nice if some people could take a look at this and give us
feedback on it. The earlier we get feedback, the easier it is to
incorporate it.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Alexander Larsson Red Hat, Inc
alexl redhat com alla lysator liu se
He's a gun-slinging hunchbacked cat burglar on his last day in the job. She's
a cynical Buddhist vampire in the wrong place at the wrong time. They fight
crime!
_______________________________________________
gtk-devel-list mailing list
gtk-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]