gedit r6058 - branches/printing/gedit



Author: pborelli
Date: Mon Jan  7 07:51:33 2008
New Revision: 6058
URL: http://svn.gnome.org/viewvc/gedit?rev=6058&view=rev

Log:
get the right set of pages to display in multipage case


Modified:
   branches/printing/gedit/gedit-print-preview.c

Modified: branches/printing/gedit/gedit-print-preview.c
==============================================================================
--- branches/printing/gedit/gedit-print-preview.c	(original)
+++ branches/printing/gedit/gedit-print-preview.c	Mon Jan  7 07:51:33 2008
@@ -785,6 +785,7 @@
 {
 	GeditPrintPreviewPrivate *priv;	
 	cairo_t *cr;
+	gint pg;
 	gint i, j;
 
 	priv = preview->priv;
@@ -797,25 +798,29 @@
 	gdk_cairo_rectangle (cr, &event->area);
 	cairo_clip (cr);
 
+	/* get the first page to display */
+	pg = priv->cur_page - priv->cur_page % (priv->cols * priv->rows);
+
 	for (i = 0; i < priv->cols; ++i)
 	{
 		for (j = 0; j < priv->rows; ++j)
 		{
-			gint pg;
-
-			pg = priv->cur_page + j + i * priv->rows;
-
 			if (!gtk_print_operation_preview_is_selected (priv->gtk_preview,
 								      pg))
 			{
 				continue;
 			}
 
+			if (pg == priv->n_pages)
+				break;
+
 			draw_page (cr,
 				   j * priv->tile_w,
 				   i * priv->tile_h,
 				   pg,
 				   preview);
+
+			++pg;
 		}
 	}
 	cairo_destroy (cr);



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