Re: [gedit-list] First pass hack of gedit and gtksourceview port to gtkprintoperation

On Mon, 8 May 2006, Paolo Maggi wrote:

> Hi,
> > 
> > Adding a specific "print current selection" feature should be quite
> > easy, although it will require some work to implement the win32 side i
> > think. However, how do you propose a generic mechanism for this would
> > work? (That also would work in the native print dialogs on win32 and
> > OSX.)
> I have started working on the implementation, but looking at the code of
> gtkprintoperation.c I have seen that the real problem is not pagination,
> but the fact the printing is always mostly a sync operation also when
> gtk_print_operation_run_async is used.
> What I mean is that the real printing is done in the print_pages
> function. In that function a "draw_page" signal is emitted for each page
> and in order to not block the UI the "while (gtk_events_pending ())
> gtk_main_iteration ();" trick is used (may be it is me, but I don't like
> very much the main loop iteration stuff )
> What about modifying the print_page function in order to install a "idle
> handler" that prints a single page and remove the handler when there are
> no more pages to print?

That would work I guess. Although keeping the state of the print loop gets 
a bit more complicated.
> In this way we could also implement "print canceling" (at least in the
> async way).

Yeah. At some point we should maybe add a way to (try to) cancel the job 
after it has been spooled too. (I filed a bug about this.)

> P.S. It is not clear to me how the "request_page_setup" signal is
> supposed to be used.

Its so you can change e.g. the orientation or paper size on a per-page 
basis. The testprint.c example shows this in use.
> P.P.S. May be "draw_page" should return a boolean so we can print
> without knowing a priori the number of pages. 

Initially I thought about doing something like this, but it gets really 
complicated when you need to drive the printing loop in a more complicated 
way (reverse, specific ranges, multiple copies, etc.)

 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's an obese flyboy firefighter trapped in a world he never made. She's a 
radical snooty magician's assistant from beyond the grave. They fight crime! 

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