Re: Print preview widget

2008-05-09 Thread Calum Benson

On 17 Apr 2008, at 23:03, Sven Neumann wrote:

> Hi,
>
> On Wed, 2008-04-16 at 11:23 -0700, Brian J. Tarricone wrote:
>
>> Hooking this up on MacOS X would be easy -- all apps I've used there
>> that have a print preview just generate a pdf (or ps?) and open it  
>> with
>> Preview.app.
>
> Which is exactly what the current GTK+ Print preview code on Mac OS X
> does by default (if you are using the native build), see bug #518624.

Sorry I'm coming a bit late to this, but FWIW this is no longer the  
way print previews are done in OS X (since 10.5)... now you get a  
scaled down preview right in the Print dialog, that you can page  
through.



Cheeri,
Calum.

-- 
CALUM BENSON, Usability Engineer   Sun Microsystems Ireland
mailto:[EMAIL PROTECTED]GNOME Desktop Team
http://blogs.sun.com/calum +353 1 819 9771

Any opinions are personal and not necessarily those of Sun Microsystems


___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Print preview widget

2008-04-18 Thread Gustavo J. A. M. Carneiro
On Thu, 2008-04-17 at 17:10 -0400, Jody Goldberg wrote:
> On Wed, Apr 16, 2008 at 12:46:22PM -0500, Cody Russell wrote:
> > I was thinking that it would be nice if there was an integrated print
> > preview widget in GTK+, that would be available cross-platform and
> > wanted to check with people here before I commit much time to this.
> > Right now we're spawning another process to do this, and I think an
> > integrated widget would be much nicer.
> > 
> > Thoughts?
> 
> +1
> 
> 1) It allows user modification from within previewer
> - page re-ordering
> - inserting page breaks
> 
> 2) It would help get preview working on win32, generating an emf is
>and using the viewer is not workable.
> 
> The main upside to the current approach is that it avoids the
> unacceptably vast memory footprint from libgnomeprintui's preview.
> It would record a stream of drawing cmds _in memory_ and replay them
> for the preview.   For a large or complex file (eg a spreadsheet
> with gridlines) that can get very large very quickly.  An external
> backing store avoids that problem by pushing it off to the viewer,
> and assuming that it is efficient about loading only the required
> elements.  A cross platform preview would be very nice, as long as
> it avoided that pitfall.

Sure, but this would be easy to accomplish if the printing interface was
based on per page callbacks, like:

void render_page_cb (cairo_t cr, int page_number)
{
  ...
}

The problem here is that for the application to know what to render for
each page it may need to do the "pagination", which sometimes involves
actually simulating rendering of all the previous pages, which can be a
performance problem.  This problem can be worked around, although it is
not easy on the programmer...

-- 
Gustavo J. A. M. Carneiro
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
"The universe is always one step beyond logic" -- Frank Herbert

___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Print preview widget

2008-04-17 Thread Yevgen Muntyan
Cody Russell wrote:
> I was thinking that it would be nice if there was an integrated print
> preview widget in GTK+, that would be available cross-platform and
> wanted to check with people here before I commit much time to this.
> Right now we're spawning another process to do this, and I think an
> integrated widget would be much nicer.
>
> Thoughts?
>   

+million, for GTK+ to suck less (or rock more,
whichever half glass you prefer). External preview
was done because it could be implemented easily
and nobody implemented internal preview, no?

Yevgen

___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Print preview widget

2008-04-17 Thread Sven Neumann
Hi,

On Wed, 2008-04-16 at 11:23 -0700, Brian J. Tarricone wrote:

> Hooking this up on MacOS X would be easy -- all apps I've used there 
> that have a print preview just generate a pdf (or ps?) and open it with 
> Preview.app.

Which is exactly what the current GTK+ Print preview code on Mac OS X
does by default (if you are using the native build), see bug #518624.


Sven


___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Print preview widget

2008-04-17 Thread Behdad Esfahbod
On Thu, 2008-04-17 at 17:10 -0400, Jody Goldberg wrote:
> 
> The main upside to the current approach is that it avoids the
> unacceptably vast memory footprint from libgnomeprintui's preview.
> It would record a stream of drawing cmds _in memory_ and replay them
> for the preview.

If we "print" straight to a cairo_t for the preview widget, drawing
commands won't be recorded.  If we do a PS/PDF/SVG then they are
recorded inside cairo, and emitted when the page is done.

-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
-- Benjamin Franklin, 1759

___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Print preview widget

2008-04-17 Thread Jody Goldberg
On Wed, Apr 16, 2008 at 12:46:22PM -0500, Cody Russell wrote:
> I was thinking that it would be nice if there was an integrated print
> preview widget in GTK+, that would be available cross-platform and
> wanted to check with people here before I commit much time to this.
> Right now we're spawning another process to do this, and I think an
> integrated widget would be much nicer.
> 
> Thoughts?

+1

1) It allows user modification from within previewer
- page re-ordering
- inserting page breaks

2) It would help get preview working on win32, generating an emf is
   and using the viewer is not workable.

The main upside to the current approach is that it avoids the
unacceptably vast memory footprint from libgnomeprintui's preview.
It would record a stream of drawing cmds _in memory_ and replay them
for the preview.   For a large or complex file (eg a spreadsheet
with gridlines) that can get very large very quickly.  An external
backing store avoids that problem by pushing it off to the viewer,
and assuming that it is efficient about loading only the required
elements.  A cross platform preview would be very nice, as long as
it avoided that pitfall.
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Print preview widget

2008-04-17 Thread Mathias Hasselmann

Am Donnerstag, den 17.04.2008, 14:20 -0400 schrieb Behdad Esfahbod:
> On Thu, 2008-04-17 at 11:14 -0700, Carl Worth wrote:
> > 
> > I can write a program where both of these are correct:
> > 
> > Display to screen: App->Cairo->Screen
> > Print to PDF:  App->Cairo->PDF
> > 
> > But the following is totally broken:
> > 
> > Print preview: App->Cairo->PDF->Cairo->Screen
> > 
> > And that's simply because there are bugs in poppler, which does the
> > PDF->Cairo step, and poppler isn't actually involved in either the
> > display-to-screen or print-to-pdf scenarios.
> 
> Sure.  But if you are printing to PDF and sending that PDF over to
> someone, there's advantage in the preview showing what your friend will
> be seeing when opening the PDF in evince...
> 
> All these said, not sure what GTK-printing actually generates.  If it's
> PS, it may be hitting a completely different set of bugs...

The problem with using an external application for print previews is,
that you cannot embed it into your own UI, that you cannot remote
control it. You absolutely need that features when integrating the print
preview into some kind of work-flow, like order processing for instance.
Using an external application really doesn't work here.

The round trip testing argument is artificial. You use test suites for
round trip management. For print preview there are situations were you
want ultimate control over the preview canvas.

Ciao,
Mathias
-- 
Mathias Hasselmann <[EMAIL PROTECTED]>
Openismus GmbH: http://www.openismus.com/
Personal Site: http://taschenorakel.de/


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Print preview widget

2008-04-17 Thread Behdad Esfahbod
On Thu, 2008-04-17 at 11:14 -0700, Carl Worth wrote:
> 
> I can write a program where both of these are correct:
> 
> Display to screen: App->Cairo->Screen
> Print to PDF:  App->Cairo->PDF
> 
> But the following is totally broken:
> 
> Print preview: App->Cairo->PDF->Cairo->Screen
> 
> And that's simply because there are bugs in poppler, which does the
> PDF->Cairo step, and poppler isn't actually involved in either the
> display-to-screen or print-to-pdf scenarios.

Sure.  But if you are printing to PDF and sending that PDF over to
someone, there's advantage in the preview showing what your friend will
be seeing when opening the PDF in evince...

All these said, not sure what GTK-printing actually generates.  If it's
PS, it may be hitting a completely different set of bugs...

-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
-- Benjamin Franklin, 1759

___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Print preview widget

2008-04-17 Thread Carl Worth
On Thu, 17 Apr 2008 13:15:42 -0400, Behdad Esfahbod wrote:
> On Thu, 2008-04-17 at 18:07 +0100, Gustavo J. A. M. Carneiro wrote:
> > > +1 too.  Though opening the actual generated PDF in evince is always
> > > going to be a more reliable preview than rendering to a widget.  There
> > > always will be bugs here and there, you know...
...
> Because as I said, "There always will be bugs here and there".

I think the "always" in Behdad's "there always will be bugs" is much
stronger than in his "[using evince] is always going to be a more
reliable preview".

> > You could claim quite the reverse.  If print preview does not go through
> > App->Cairo->PDF->Cairo->Screen layers (would be only
> > App->Cairo->Screen), then users will not catch PDF/PS generation bugs so
> > soon, they only see the bugs appear on paper, and then it will be
> > convoluted by printer driver bugs, etc.
>
> That's what I meant.

Right. We do get to test more layers by doing the full
round-trip. And I also agree that's a good thing.

Interestingly, though, some of those layers can show bugs that are
unique to this preview environment. So here's at least one concrete
example where doing preview this way is actually less reliable.

I can write a program where both of these are correct:

Display to screen: App->Cairo->Screen
Print to PDF:  App->Cairo->PDF

But the following is totally broken:

Print preview: App->Cairo->PDF->Cairo->Screen

And that's simply because there are bugs in poppler, which does the
PDF->Cairo step, and poppler isn't actually involved in either the
display-to-screen or print-to-pdf scenarios.

That's not to single out poppler. There are certainly bugs in any of
the stages, (App->Cairo, Cairo->Screen, or Cairo->PDF). And we
definitely need to just use this full-round-trip process and make it
as bomb-proof as possible.

And we do do that kind of round-trip testing within cairo's test
suite, and it does find poppler bugs in the PDF->Cairo stage. Here's
our tracking bug that shows what issues we've found so far:

Poppler does not yet handle everything in the cairo test suite
https://bugs.freedesktop.org/show_bug.cgi?id=12143

Any help on fixing those will be greatly appreciated of course, (and
will make any poppler-based print preview much more reliable).

-Carl


pgpOniaRfwYyG.pgp
Description: PGP signature
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Print preview widget

2008-04-17 Thread Behdad Esfahbod
On Thu, 2008-04-17 at 18:07 +0100, Gustavo J. A. M. Carneiro wrote:
> > 
> > +1 too.  Though opening the actual generated PDF in evince is always
> > going to be a more reliable preview than rendering to a widget.  There
> > always will be bugs here and there, you know...
> 
> _If_ gtk+ printing has to go through a cairo layer, I don't see why this
> would be so.  Cairo should render the same content to screen as it does
> to a PS/PDF file.  By explicit goal of the Cairo project, this _must
> work_.

Because as I said, "There always will be bugs here and there".  For
example, pango keeps glyph extents in a 22.10 fixed format.  Cairo keeps
as double in device space.  There will be rounding bugs here and there.
They may add up and change your text layout.  I do have plans to fix
this properly.  That has just not happened yet.

> You could claim quite the reverse.  If print preview does not go through
> App->Cairo->PDF->Cairo->Screen layers (would be only
> App->Cairo->Screen), then users will not catch PDF/PS generation bugs so
> soon, they only see the bugs appear on paper, and then it will be
> convoluted by printer driver bugs, etc.

That's what I meant.  One way around it would be to "print" to a cairo
PDF surface, then paint that surface to the actual widget surface.  This
would avoid the issues I mentioned above, at the cost of being heavier
on memory and processor.

> Anyway, +1 from me too.
> 
-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
-- Benjamin Franklin, 1759

___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Print preview widget

2008-04-17 Thread Gustavo J. A. M. Carneiro
On Wed, 2008-04-16 at 14:02 -0400, Behdad Esfahbod wrote:
> On Wed, 2008-04-16 at 19:54 +0200, Mathias Hasselmann wrote:
> > Am Mittwoch, den 16.04.2008, 12:46 -0500 schrieb Cody Russell:
> > > I was thinking that it would be nice if there was an integrated print
> > > preview widget in GTK+, that would be available cross-platform and
> > > wanted to check with people here before I commit much time to this.
> > > Right now we're spawning another process to do this, and I think an
> > > integrated widget would be much nicer.
> > 
> > I fully agree with you.
> 
> +1 too.  Though opening the actual generated PDF in evince is always
> going to be a more reliable preview than rendering to a widget.  There
> always will be bugs here and there, you know...

_If_ gtk+ printing has to go through a cairo layer, I don't see why this
would be so.  Cairo should render the same content to screen as it does
to a PS/PDF file.  By explicit goal of the Cairo project, this _must
work_.

You could claim quite the reverse.  If print preview does not go through
App->Cairo->PDF->Cairo->Screen layers (would be only
App->Cairo->Screen), then users will not catch PDF/PS generation bugs so
soon, they only see the bugs appear on paper, and then it will be
convoluted by printer driver bugs, etc.

Anyway, +1 from me too.

-- 
Gustavo J. A. M. Carneiro
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
"The universe is always one step beyond logic" -- Frank Herbert

___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Print preview widget

2008-04-16 Thread Cody Russell
The way I'm thinking of this, using the integrated print preview widget
would be up to the application.. if the developer wants to continue
using an external process (e.g., evince or Preview.app) or maybe wants
to use their own print preview widget, they should be able to.

On Wed, 2008-04-16 at 14:19 -0400, Yu Feng wrote:
> Hmm,
> 
> What about embedding different PDF viewers into the widget, on
> different
> platform? Or else will it be a lot of redundant work?
> 
> 
> On Wed, 2008-04-16 at 12:46 -0500, Cody Russell wrote:
> > I was thinking that it would be nice if there was an integrated
> print
> > preview widget in GTK+, that would be available cross-platform and
> > wanted to check with people here before I commit much time to this.
> > Right now we're spawning another process to do this, and I think an
> > integrated widget would be much nicer.
> > 
> > Thoughts?

___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Print preview widget

2008-04-16 Thread Brian J. Tarricone
Ghee Teo wrote:
> Cody Russell wrote:
>> I was thinking that it would be nice if there was an integrated print
>> preview widget in GTK+, that would be available cross-platform and
>> wanted to check with people here before I commit much time to this.
>> Right now we're spawning another process to do this, and I think an
>> integrated widget would be much nicer.
>>
>> Thoughts?
>>   
>Will be most interested in your idea to achieve cross-platform (which 
> I presume are
> windows, MacOS, Linux/Unix), though the latter are pretty much based on 
> a layer
> above X.
>   Definitely a+1 here.

Hooking this up on MacOS X would be easy -- all apps I've used there 
that have a print preview just generate a pdf (or ps?) and open it with 
Preview.app.

Basically the same as just launching evince on Linux, but of course 
you're more or less guaranteed to have Preview.app available on MacOS; 
not so much with evince on Linux.  I'd love to see an integrated print 
preview on Linux, though, that doesn't have external dependencies.

-brian
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Print preview widget

2008-04-16 Thread Yu Feng
Hmm,

What about embedding different PDF viewers into the widget, on different
platform? Or else will it be a lot of redundant work?


On Wed, 2008-04-16 at 12:46 -0500, Cody Russell wrote:
> I was thinking that it would be nice if there was an integrated print
> preview widget in GTK+, that would be available cross-platform and
> wanted to check with people here before I commit much time to this.
> Right now we're spawning another process to do this, and I think an
> integrated widget would be much nicer.
> 
> Thoughts?
> 
> ___
> gtk-devel-list mailing list
> gtk-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list

___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Print preview widget

2008-04-16 Thread Ghee Teo
Cody Russell wrote:
> I was thinking that it would be nice if there was an integrated print
> preview widget in GTK+, that would be available cross-platform and
> wanted to check with people here before I commit much time to this.
> Right now we're spawning another process to do this, and I think an
> integrated widget would be much nicer.
>
> Thoughts?
>   
   Will be most interested in your idea to achieve cross-platform (which 
I presume are
windows, MacOS, Linux/Unix), though the latter are pretty much based on 
a layer
above X.
  Definitely a+1 here.

-Ghee

> ___
> gtk-devel-list mailing list
> gtk-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list
>   

___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Print preview widget

2008-04-16 Thread Luis Ariel Lecca
I cant see an easy wayto do this...It depends of your print configuration, if 
you use a print service or not and what kind of pinter do you have...
  I would like that the Print preview widget dont use any print configuration.
  I did my own Print preview parsing a raw file (.prn) to the screen. Of course 
it works only for my printer. But it would be great if the new widget dont use 
any extern print configuration.
  
Mathias Hasselmann <[EMAIL PROTECTED]> escribió:
  
Am Mittwoch, den 16.04.2008, 12:46 -0500 schrieb Cody Russell:
> I was thinking that it would be nice if there was an integrated print
> preview widget in GTK+, that would be available cross-platform and
> wanted to check with people here before I commit much time to this.
> Right now we're spawning another process to do this, and I think an
> integrated widget would be much nicer.

I fully agree with you.

Ciao,
Mathias
-- 
Mathias Hasselmann 
Openismus GmbH: http://www.openismus.com/
Personal Site: http://taschenorakel.de/
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


   
-

Yahoo! Encuentros
Ahora encontrar pareja es mucho más fácil, probá el nuevo Yahoo! Encuentros.
 Visitá http://yahoo.cupidovirtual.com/servlet/NewRegistration___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Print preview widget

2008-04-16 Thread Behdad Esfahbod
On Wed, 2008-04-16 at 19:54 +0200, Mathias Hasselmann wrote:
> Am Mittwoch, den 16.04.2008, 12:46 -0500 schrieb Cody Russell:
> > I was thinking that it would be nice if there was an integrated print
> > preview widget in GTK+, that would be available cross-platform and
> > wanted to check with people here before I commit much time to this.
> > Right now we're spawning another process to do this, and I think an
> > integrated widget would be much nicer.
> 
> I fully agree with you.

+1 too.  Though opening the actual generated PDF in evince is always
going to be a more reliable preview than rendering to a widget.  There
always will be bugs here and there, you know...

-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
-- Benjamin Franklin, 1759

___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Print preview widget

2008-04-16 Thread Cody Russell
On Wed, 2008-04-16 at 19:54 +0200, Mathias Hasselmann wrote:
> Am Mittwoch, den 16.04.2008, 12:46 -0500 schrieb Cody Russell:
> > I was thinking that it would be nice if there was an integrated
> print
> > preview widget in GTK+, that would be available cross-platform and
> > wanted to check with people here before I commit much time to this.
> > Right now we're spawning another process to do this, and I think an
> > integrated widget would be much nicer.
> 
> I fully agree with you.

I talked to pbor on irc briefly.. he wrote the print preview widget for
gedit, and he seemed to think there would not be any problem with
relicensing that code so that it could be ported into gtk+.

___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Print preview widget

2008-04-16 Thread Mathias Hasselmann

Am Mittwoch, den 16.04.2008, 12:46 -0500 schrieb Cody Russell:
> I was thinking that it would be nice if there was an integrated print
> preview widget in GTK+, that would be available cross-platform and
> wanted to check with people here before I commit much time to this.
> Right now we're spawning another process to do this, and I think an
> integrated widget would be much nicer.

I fully agree with you.

Ciao,
Mathias
-- 
Mathias Hasselmann <[EMAIL PROTECTED]>
Openismus GmbH: http://www.openismus.com/
Personal Site: http://taschenorakel.de/


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Print preview widget

2008-04-16 Thread Cody Russell
I was thinking that it would be nice if there was an integrated print
preview widget in GTK+, that would be available cross-platform and
wanted to check with people here before I commit much time to this.
Right now we're spawning another process to do this, and I think an
integrated widget would be much nicer.

Thoughts?

___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list