GNOME Bugzilla – Bug 67822
Gnumeric printing 'Fit-to' feature not implemented
Last modified: 2004-12-22 21:47:04 UTC
'fit-to' is the last major area of the printing dialog which isn't implemented yet.
Created attachment 6325 [details] [review] Implement fit-to - cvs diff -u > patch.diff
The above patch is a first attempt at making fit-to work. It works pretty nice on my build. All the code is documented, and code conforms to the gnumeric style (I hope). The basic idea is I split the scaling into x and y. Then I make the pages fit-to by calculating the correct scaling needed to fit to the users requested pages wide and high. This patch might take a few attempts to get it just right. But I hope the basic method is ok.
hmmm my changes to the xml-io will require changes to the gnumeric.xsd file. I don't really fully get this stuff yet. But probably something like: Index: gnumeric.xsd =================================================================== RCS file: /cvs/gnome/gnumeric/gnumeric.xsd,v retrieving revision 1.5 diff -u -r1.5 gnumeric.xsd --- gnumeric.xsd 2001/10/25 19:25:27 1.5 +++ gnumeric.xsd 2002/01/02 01:09:37 @@ -202,7 +202,8 @@ <xsd:element name="Scale"> <xsd:complexType> <xsd:attribute name="type" type="xsd:string" use="required"/> - <xsd:attribute name="percentage" type="xsd:double" /> + <xsd:attribute name="x_percentage" type="xsd:double" /> + <xsd:attribute name="y_percentage" type="xsd:double" /> <xsd:attribute name="cols" type="xsd:integer" /> <xsd:attribute name="rows" type="xsd:integer" /> </xsd:complexType>
Oh, the patch breaks 2 plugins also. Damn.
Created attachment 6326 [details] [review] fix plugins diff
This patch is not ready for prime time. 1) We don't need to persist distinct x/y scale factors. They are only generated when the fit-to option is used in which case we should not persist the scale factors at all. The driving element is the fit-to selection. 2) I'm not convinced that the calculation of the factors is correct in the face of repeated cols/rows. Please give it some more work. We can test it in 1.1 and back port to 1.0 if things work out.
Created attachment 6432 [details] [review] version 2 of scaling patch
ok jody I have remassaged the patch a bit. I have made it so it only uses the x and y percentages internally. It does not save the x + y percentages to the gnumeric file. When it is simple percentage scaling mode, we simply make sure that the x + y percentages are equal. We only save the x percentage to the file. This also fixes a few other minor bugs I found. The only problem remaining is the repeated rows and cols... The code for working out the repeated rows and cols space is taken from the same function... so in theory it should be right if that code is right. In practice it seems to work ok for me in most cases... I haven't used repeated rows very much so I have to make sure that is not a bug in the original code (eg: in the simple non-scaling case). Could you please compile the patch and tell me what you think?
*** Bug 87937 has been marked as a duplicate of this bug. ***
I'd like to get this in before 1.2. Any chance that you could rework the patch for the development tree ?
hi Jody I have not hacked gnumeric for a while... I have not hacked much for a while... When I finish exams in two weeks I will have a bit more time for hacking.. I will focus my efforts on getting my gnumeric 1.1 cvs version compiling and getting this feature implemented. are you still aiming for a december release? I may not make it, we'll see... it shouldn't be too hard if gnumeric code is still as nice as it was last year.
Created attachment 12879 [details] [review] Version 3 of fit-to patch for gnumeric 1.1.x
ok. I applied each part of the old patch manually. It didn't need much changing for it to compile in 1.1.x. It is not ready for committing yet. There may be some bugs to iron out. I still need to make it reload the saved 'fit-to' values into the dialog. Jody: Can you have a quick read of the patch. Are you happy with my general approach of having the x and y scaling in the print-info header? eg: What I'm asking is - if this patch worked fully (as it nearly does), would you commit it? Or are their design issues you are unhappy with?
Created attachment 12881 [details] Sample sheet that I find useful for testing the fit-to feature
It is a decent approach given our current printing infrastructure. The main failing is that the fit to calc ignores the repeated rows cols. Tidy that up and it can go in.
Jody, with my cvs copy of gnumeric 1.1.x I can't seem to get repeated rows working in any case. Has my patch broken repeated rows for the normal case (with no fit-to)....? Does repeated rows work in your copy of 1.1.x (without my patch applied) ?
Ok the patch will be in 1.1.16. Repeated cols/rows are working with general printing but your measurement to decide how to scale things looks fishy to me when they are around. We'll also need to work on the persistence of this. As things stand we just save a percentage, which is not what we want if fit-to is selected. The entire print measuring mechanism will need to be reworked during 1.3 to allow user selectable page bounds, hard page breaks, and disaply of print regions. Lets close this one for now and open new bugs for the missing bits. Thanks for your work and patience.