gtk+ r20030 - in branches/gtk-2-12: . demos/gtk-demo gdk gtk tests



Author: hans
Date: Sun Apr 20 21:16:08 2008
New Revision: 20030
URL: http://svn.gnome.org/viewvc/gtk+?rev=20030&view=rev

Log:
2008-04-20  Hans Breuer  <hans breuer org>

	* demos/gtk-demo/printing.c gtk/gtkprintoperation-win32.c
	  tests/simple.c : reverted unintentional commit from revision 19994

	* gdk/makefile.msc : define WTKIT if not done before

	* gtk/gtkfilechooserdefault.c : #include <locale.h> for LC_ALL



Modified:
   branches/gtk-2-12/ChangeLog
   branches/gtk-2-12/demos/gtk-demo/printing.c
   branches/gtk-2-12/gdk/makefile.msc
   branches/gtk-2-12/gtk/gtkfilechooserdefault.c
   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	Sun Apr 20 21:16:08 2008
@@ -68,8 +68,6 @@
   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/gdk/makefile.msc
==============================================================================
--- branches/gtk-2-12/gdk/makefile.msc	(original)
+++ branches/gtk-2-12/gdk/makefile.msc	Sun Apr 20 21:16:08 2008
@@ -11,7 +11,9 @@
 
 # Location of the Wintab toolkit. Downloadable from http://www.pointing.com.
 # definition should possibly go to build/win32/module.def, too.
-WTKIT = ..\..\wtkit126
+!IFNDEF WTKIT
+WTKIT = $(TOP)\wtkit126
+!ENDIF
 
 ###############################################################
 

Modified: branches/gtk-2-12/gtk/gtkfilechooserdefault.c
==============================================================================
--- branches/gtk-2-12/gtk/gtkfilechooserdefault.c	(original)
+++ branches/gtk-2-12/gtk/gtkfilechooserdefault.c	Sun Apr 20 21:16:08 2008
@@ -84,7 +84,7 @@
 #include <time.h>
 #include <sys/stat.h>
 #include <sys/types.h>
-
+#include <locale.h> /* LC_ALL */
 
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>

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	Sun Apr 20 21:16:08 2008
@@ -455,9 +455,6 @@
 		GtkPrintContext *print_context)
 {
   GtkPrintOperationWin32 *op_win32 = op->priv->platform_data;
-
-  cairo_surface_show_page (op_win32->surface);
-
   EndPage (op_win32->hdc);
 }
 
@@ -489,8 +486,6 @@
   GtkPrintOperationWin32 *op_win32 = op->priv->platform_data;
   LPDEVNAMES devnames;
   HANDLE printerHandle = 0;
-
-  cairo_surface_finish (op_win32->surface);
   
   EndDoc (op_win32->hdc);
 
@@ -506,6 +501,7 @@
   GlobalFree(op_win32->devmode);
   GlobalFree(op_win32->devnames);
 
+  cairo_surface_finish (op_win32->surface);
   cairo_surface_destroy (op_win32->surface);
   op_win32->surface = NULL;
 
@@ -1605,8 +1601,7 @@
       
       *do_print = TRUE;
 
-      op_win32->surface = cairo_win32_printing_surface_create (printdlgex->hDC);
-
+      op_win32->surface = cairo_win32_surface_create (printdlgex->hDC);
       dpi_x = (double)GetDeviceCaps (printdlgex->hDC, LOGPIXELSX);
       dpi_y = (double)GetDeviceCaps (printdlgex->hDC, LOGPIXELSY);
 
@@ -1624,7 +1619,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,
@@ -1708,9 +1703,8 @@
 							cairo_surface_t *surface,
 							cairo_t *cr)
 {
-  cairo_surface_show_page (cr);
-
-  /* TODO: Enhanced metafiles don't support multiple pages.
+  /* TODO: This doesn't actually seem to work.
+   * Do enhanced metafiles really support multiple pages?
    */
   HDC dc = cairo_win32_surface_get_dc (surface);
   EndPage (dc);
@@ -1764,7 +1758,7 @@
   *dpi_x = (double)GetDeviceCaps (metafile_dc, LOGPIXELSX);
   *dpi_y = (double)GetDeviceCaps (metafile_dc, LOGPIXELSY);
 
-  return cairo_win32_printing_surface_create (metafile_dc);
+  return cairo_win32_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	Sun Apr 20 21:16:08 2008
@@ -1,32 +1,62 @@
+/* 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>
 
-static void
-draw_page_cb(GtkPrintOperation *operation, GtkPrintContext *context,
-             gint page_nr, gpointer user_data)
-{
-    cairo_t *cr = gtk_print_context_get_cairo_context(context);
 
-    cairo_rectangle(cr, 50, 50, 50, 50);
-    cairo_stroke(cr);
+void
+hello (void)
+{
+  g_print ("hello world\n");
 }
 
-
 int
-main(int argc, char **argv)
+main (int argc, char *argv[])
 {
-    gtk_init(&argc, &argv);
-
-    GtkPrintOperation *print;
+  GtkWidget *window;
+  GtkWidget *button;
 
-    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);
+  /* 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);
 
-    gtk_print_operation_run(print, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
-                            NULL, NULL);
-    g_object_unref(print);
+  gtk_main ();
 
-    return 0;
+  return 0;
 }



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