gtk+ r19994 - in branches/gtk-2-12: . demos/gtk-demo docs/reference gtk tests
- From: bratsche svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk+ r19994 - in branches/gtk-2-12: . demos/gtk-demo docs/reference gtk tests
- Date: Fri, 11 Apr 2008 14:51:12 +0100 (BST)
Author: bratsche
Date: Fri Apr 11 14:51:11 2008
New Revision: 19994
URL: http://svn.gnome.org/viewvc/gtk+?rev=19994&view=rev
Log:
Move my documentation changelog entries to the right changelog.
Modified:
branches/gtk-2-12/ChangeLog
branches/gtk-2-12/demos/gtk-demo/printing.c
branches/gtk-2-12/docs/reference/ChangeLog
branches/gtk-2-12/gtk/gtkprintoperation-win32.c
branches/gtk-2-12/tests/simple.c
Modified: branches/gtk-2-12/demos/gtk-demo/printing.c
==============================================================================
--- branches/gtk-2-12/demos/gtk-demo/printing.c (original)
+++ branches/gtk-2-12/demos/gtk-demo/printing.c Fri Apr 11 14:51:11 2008
@@ -68,6 +68,8 @@
PangoFontDescription *desc;
gchar *page_str;
+ g_print ("************** Create print context....\n");
+
cr = gtk_print_context_get_cairo_context (context);
width = gtk_print_context_get_width (context);
Modified: branches/gtk-2-12/gtk/gtkprintoperation-win32.c
==============================================================================
--- branches/gtk-2-12/gtk/gtkprintoperation-win32.c (original)
+++ branches/gtk-2-12/gtk/gtkprintoperation-win32.c Fri Apr 11 14:51:11 2008
@@ -455,6 +455,9 @@
GtkPrintContext *print_context)
{
GtkPrintOperationWin32 *op_win32 = op->priv->platform_data;
+
+ cairo_surface_show_page (op_win32->surface);
+
EndPage (op_win32->hdc);
}
@@ -486,6 +489,8 @@
GtkPrintOperationWin32 *op_win32 = op->priv->platform_data;
LPDEVNAMES devnames;
HANDLE printerHandle = 0;
+
+ cairo_surface_finish (op_win32->surface);
EndDoc (op_win32->hdc);
@@ -501,7 +506,6 @@
GlobalFree(op_win32->devmode);
GlobalFree(op_win32->devnames);
- cairo_surface_finish (op_win32->surface);
cairo_surface_destroy (op_win32->surface);
op_win32->surface = NULL;
@@ -1601,7 +1605,8 @@
*do_print = TRUE;
- op_win32->surface = cairo_win32_surface_create (printdlgex->hDC);
+ op_win32->surface = cairo_win32_printing_surface_create (printdlgex->hDC);
+
dpi_x = (double)GetDeviceCaps (printdlgex->hDC, LOGPIXELSX);
dpi_y = (double)GetDeviceCaps (printdlgex->hDC, LOGPIXELSY);
@@ -1619,7 +1624,7 @@
job_id = StartDocW(printdlgex->hDC, &docinfo);
g_free ((void *)docinfo.lpszDocName);
if (job_id <= 0)
- {
+ {
result = GTK_PRINT_OPERATION_RESULT_ERROR;
g_set_error (&priv->error,
GTK_PRINT_ERROR,
@@ -1703,8 +1708,9 @@
cairo_surface_t *surface,
cairo_t *cr)
{
- /* TODO: This doesn't actually seem to work.
- * Do enhanced metafiles really support multiple pages?
+ cairo_surface_show_page (cr);
+
+ /* TODO: Enhanced metafiles don't support multiple pages.
*/
HDC dc = cairo_win32_surface_get_dc (surface);
EndPage (dc);
@@ -1758,7 +1764,7 @@
*dpi_x = (double)GetDeviceCaps (metafile_dc, LOGPIXELSX);
*dpi_y = (double)GetDeviceCaps (metafile_dc, LOGPIXELSY);
- return cairo_win32_surface_create (metafile_dc);
+ return cairo_win32_printing_surface_create (metafile_dc);
}
void
Modified: branches/gtk-2-12/tests/simple.c
==============================================================================
--- branches/gtk-2-12/tests/simple.c (original)
+++ branches/gtk-2-12/tests/simple.c Fri Apr 11 14:51:11 2008
@@ -1,62 +1,32 @@
-/* simple.c
- * Copyright (C) 1997 Red Hat, Inc
- * Author: Elliot Lee
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#include <config.h>
#include <gtk/gtk.h>
-
-void
-hello (void)
+static void
+draw_page_cb(GtkPrintOperation *operation, GtkPrintContext *context,
+ gint page_nr, gpointer user_data)
{
- g_print ("hello world\n");
+ cairo_t *cr = gtk_print_context_get_cairo_context(context);
+
+ cairo_rectangle(cr, 50, 50, 50, 50);
+ cairo_stroke(cr);
}
+
int
-main (int argc, char *argv[])
+main(int argc, char **argv)
{
- GtkWidget *window;
- GtkWidget *button;
+ gtk_init(&argc, &argv);
+
+ GtkPrintOperation *print;
- /* FIXME: This is not allowable - what is this supposed to be? */
- /* gdk_progclass = g_strdup ("XTerm"); */
- gtk_init (&argc, &argv);
-
- window = g_object_connect (gtk_widget_new (gtk_window_get_type (),
- "user_data", NULL,
- "type", GTK_WINDOW_TOPLEVEL,
- "title", "hello world",
- "allow_grow", FALSE,
- "allow_shrink", FALSE,
- "border_width", 10,
- NULL),
- "signal::destroy", gtk_main_quit, NULL,
- NULL);
- button = g_object_connect (gtk_widget_new (gtk_button_get_type (),
- "GtkButton::label", "hello world",
- "GtkWidget::parent", window,
- "GtkWidget::visible", TRUE,
- NULL),
- "signal::clicked", hello, NULL,
- NULL);
- gtk_widget_show (window);
+ print = gtk_print_operation_new();
+ gtk_print_operation_set_use_full_page(print, FALSE);
+ gtk_print_operation_set_unit(print, GTK_UNIT_POINTS);
+ gtk_print_operation_set_n_pages(print, 1);
+ g_signal_connect(print, "draw_page", G_CALLBACK(draw_page_cb), NULL);
- gtk_main ();
+ gtk_print_operation_run(print, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
+ NULL, NULL);
+ g_object_unref(print);
- return 0;
+ return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]