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.
This commit is contained in:
Colin Leroy 2007-09-19 07:02:06 +00:00
parent 3929cc2624
commit 29bf47ae4f
6 changed files with 48 additions and 3 deletions

View file

@ -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

View file

@ -2871,3 +2871,4 @@
( 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

View 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=

View 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}
};

View 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;

View 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;
}