2007-09-19 [colin] 3.0.1cvs8
authorColin Leroy <colin@colino.net>
Wed, 19 Sep 2007 07:02:06 +0000 (07:02 +0000)
committerColin Leroy <colin@colino.net>
Wed, 19 Sep 2007 07:02:06 +0000 (07:02 +0000)
* src/prefs_common.c
* src/prefs_common.h
* src/printing.c
Add scrolledwindow, default allocation and
size saving to the print preview window.

ChangeLog
PATCHSETS
configure.ac
src/prefs_common.c
src/prefs_common.h
src/printing.c

index db4891bde4d1963bada01cff360c952390359900..df7e562391f9da4098fc43379a895c2ff1e02f5e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-09-19 [colin]     3.0.1cvs8
+
+       * src/prefs_common.c
+       * src/prefs_common.h
+       * src/printing.c
+               Add scrolledwindow, default allocation and
+               size saving to the print preview window.
+
 2007-09-18 [colin]     3.0.1cvs7
 
        * src/prefs_common.c
index d2991e33e7dc13a2f37d2dc87cc1606cbd69b0bc..041672901e50be38864744e4f91da137a5f1355c 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.36.2.111 -r 1.36.2.112 src/common/utils.c;  ) > 3.0.1cvs5.patchset
 ( cvs diff -u -r 1.100.2.52 -r 1.100.2.53 AUTHORS;  cvs diff -u -r 1.1.2.39 -r 1.1.2.40 src/gtk/authors.h;  ) > 3.0.1cvs6.patchset
 ( cvs diff -u -r 1.204.2.147 -r 1.204.2.148 src/prefs_common.c;  cvs diff -u -r 1.103.2.93 -r 1.103.2.94 src/prefs_common.h;  cvs diff -u -r 1.1.2.9 -r 1.1.2.10 src/prefs_image_viewer.c;  cvs diff -u -r 1.1.2.2 -r 1.1.2.3 src/printing.c;  ) > 3.0.1cvs7.patchset
+( cvs diff -u -r 1.204.2.148 -r 1.204.2.149 src/prefs_common.c;  cvs diff -u -r 1.103.2.94 -r 1.103.2.95 src/prefs_common.h;  cvs diff -u -r 1.1.2.3 -r 1.1.2.4 src/printing.c;  ) > 3.0.1cvs8.patchset
index ae08fa77af01afa59ce255982c038e7e1b8bb96f..72a3279bdde2b3d36c5aab324c6352c26784c8b9 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=0
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=7
+EXTRA_VERSION=8
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 3d46370cd97fe60f16d26e3e970ed122d29eaa99..2e89616bf3f5ead026f6f521bf5ebaedbbeb1864 100644 (file)
@@ -1066,6 +1066,10 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"print_imgs", "1", &prefs_common.print_imgs, P_INT,
         NULL, NULL, NULL},
+       {"print_previewwin_width", "600", &prefs_common.print_previewwin_width, P_INT,
+        NULL, NULL, NULL},
+       {"print_previewwin_height", "-1", &prefs_common.print_previewwin_height, P_INT,
+        NULL, NULL, NULL},
 
        {NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
 };
index 648eb575a43cca51c03a21c7ee3d411379ff64de..c66eb7b8ee28bb8bc078650e107dac5c73eb1da0 100644 (file)
@@ -471,6 +471,8 @@ struct _PrefsCommon
        gint print_use_reverse;
        gint print_use_duplex;
        gint print_imgs;
+       gint print_previewwin_width;
+       gint print_previewwin_height;
 };
 
 extern PrefsCommon prefs_common;
index f4ab09d031917ad3cc13d4dbb50a0642205bda6d..7a337775b25260b75ba62b87b0d701141a94b0ae 100644 (file)
@@ -82,6 +82,15 @@ static gboolean preview_close(GtkWidget *widget, GdkEventAny *event,
        return FALSE;
 }
 
+static void preview_size_allocate_cb(GtkWidget *widget,
+                                        GtkAllocation *allocation)
+{
+       g_return_if_fail(allocation != NULL);
+
+       prefs_common.print_previewwin_width = allocation->width;
+       prefs_common.print_previewwin_height = allocation->height;
+}
+
 static gboolean cb_preview (GtkPrintOperation        *operation,
                                      GtkPrintOperationPreview *preview,
                                      GtkPrintContext          *context,
@@ -105,8 +114,9 @@ static gboolean cb_preview (GtkPrintOperation        *operation,
   cairo_status_t   status;
   gchar           *fname;
   GtkWidget *dialog = NULL;
-  GtkWidget *image, *notebook;
+  GtkWidget *image, *notebook, *scrolled_window;
   GSList *pages = NULL, *cur;
+  static GdkGeometry geometry;
 
   paper_size      = gtk_page_setup_get_paper_size    (page_setup);
   paper_width     = gtk_paper_size_get_width         (paper_size, GTK_UNIT_INCH);
@@ -171,6 +181,17 @@ static gboolean cb_preview (GtkPrintOperation        *operation,
   pages = g_slist_reverse(pages);
   
   dialog = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "print_preview");
+
+  if (!geometry.min_height) {
+         geometry.min_width = 600;
+         geometry.min_height = 400;
+  }
+
+  gtk_window_set_geometry_hints(GTK_WINDOW(dialog), NULL, &geometry,
+                               GDK_HINT_MIN_SIZE);
+  gtk_widget_set_size_request(dialog, prefs_common.print_previewwin_width,
+                             prefs_common.print_previewwin_height);
+
   gtk_window_set_title(GTK_WINDOW(dialog), _("Print preview"));
   notebook = gtk_notebook_new();
   gtk_container_add(GTK_CONTAINER(dialog), notebook);
@@ -178,8 +199,15 @@ static gboolean cb_preview (GtkPrintOperation        *operation,
   for (cur = pages; cur; cur = cur->next) {
     image = (GtkImage *)cur->data;
     if (gtk_print_operation_preview_is_selected(preview, i)) {
+      scrolled_window = gtk_scrolled_window_new(NULL, NULL);
+      gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
+                                      GTK_POLICY_AUTOMATIC,
+                                      GTK_POLICY_AUTOMATIC);
+      gtk_scrolled_window_add_with_viewport
+             (GTK_SCROLLED_WINDOW(scrolled_window),
+              image);
       debug_print("page %d sel\n", i);
-      gtk_notebook_append_page(GTK_NOTEBOOK(notebook), image, NULL);
+      gtk_notebook_append_page(GTK_NOTEBOOK(notebook), scrolled_window, NULL);
     }
     i++;
   }
@@ -191,6 +219,8 @@ static gboolean cb_preview (GtkPrintOperation        *operation,
                     G_CALLBACK (preview_destroy), preview);
   g_signal_connect (dialog, "key_press_event",
                     G_CALLBACK (preview_close), preview);
+ g_signal_connect(G_OBJECT(dialog), "size_allocate",
+                 G_CALLBACK(preview_size_allocate_cb), NULL);
   
   return TRUE;
 }