SF.net SVN: geany: [2050] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Sat Nov 17 14:04:27 UTC 2007


Revision: 2050
          http://geany.svn.sourceforge.net/geany/?rev=2050&view=rev
Author:   eht16
Date:     2007-11-17 06:04:27 -0800 (Sat, 17 Nov 2007)

Log Message:
-----------
Add native GTK printing support.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/TODO
    trunk/configure.in
    trunk/doc/geany.html
    trunk/doc/geany.txt
    trunk/geany.glade
    trunk/src/Makefile.am
    trunk/src/callbacks.c
    trunk/src/callbacks.h
    trunk/src/document.c
    trunk/src/document.h
    trunk/src/interface.c
    trunk/src/keyfile.c
    trunk/src/main.c
    trunk/src/makefile.win32
    trunk/src/prefs.c
    trunk/src/prefs.h
    trunk/src/ui_utils.c
    trunk/src/ui_utils.h

Added Paths:
-----------
    trunk/src/printing.c
    trunk/src/printing.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-11-17 13:09:19 UTC (rev 2049)
+++ trunk/ChangeLog	2007-11-17 14:04:27 UTC (rev 2050)
@@ -3,6 +3,12 @@
  * src/templates.c, src/utils.c, src/utils.h:
    Fix possible memory leak and add time_t argument in
    utils_get_date_time() to pass a time pointer to use.
+ * configure.in, geany.glade, TODO, doc/geany.html, doc/geany.txt,
+   src/callbacks.c, src/callbacks.h, src/document.c, src/document.h,
+   src/interface.c, src/keyfile.c, src/main.c, src/Makefile.am,
+   src/makefile.win32, src/prefs.c, src/prefs.h, src/printing.c,
+   src/printing.h, src/ui_utils.c, src/ui_utils.h:
+   Add native GTK printing support.
 
 
 2007-11-14  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/TODO
===================================================================
--- trunk/TODO	2007-11-17 13:09:19 UTC (rev 2049)
+++ trunk/TODO	2007-11-17 14:04:27 UTC (rev 2050)
@@ -30,7 +30,6 @@
 	o (better tags support for popular languages? - this is a moving
 	  target...)
 	o (tango-like icons for the symbol list)
-	o (GTK+ 2.10 printing support)
 	o (show autocompletion symbol icons - see SCI_REGISTERIMAGE)
 
 

Modified: trunk/configure.in
===================================================================
--- trunk/configure.in	2007-11-17 13:09:19 UTC (rev 2049)
+++ trunk/configure.in	2007-11-17 14:04:27 UTC (rev 2050)
@@ -85,7 +85,7 @@
 
 
 # Plugins support
-AC_ARG_ENABLE(plugins, [AC_HELP_STRING([--disable-plugins], [compile without plugin support])], , enable_plugins=yes)
+AC_ARG_ENABLE(plugins, [AC_HELP_STRING([--disable-plugins], [compile without plugin support  [[default=no]]])], , enable_plugins=yes)
 
 if test "x$enable_plugins" = "xyes" ; then
 	AC_DEFINE(HAVE_PLUGINS, 1, [Define if plugins are enabled.])
@@ -110,6 +110,16 @@
 
 GTK_VERSION=`$PKG_CONFIG --modversion gtk+-2.0`
 
+
+# GTK 2.10 printing support
+$PKG_CONFIG --exists 'gtk+-2.0 >= 2.10.0'
+if test "x$?" = "x0" ; then
+	enable_printing="yes"
+else
+	enable_printing="no (GTK >= 2.10 necessary)"
+fi
+
+
 # just for a laugh (it has absolutely no effect)
 AC_ARG_ENABLE(the-force, AC_HELP_STRING([--enable-the-force],
      [enable if you are Luke Skywalker and the force is with you [[default=no]]]), [be_luke="$enableval"], [be_luke="no"])
@@ -128,6 +138,7 @@
 ALL_LINGUAS="`sed -e '/^#/d' $srcdir/po/LINGUAS`" # take all languages found in file po/LINGUAS
 
 AM_GLIB_GNU_GETTEXT
+# workaround for intltool bug (http://bugzilla.gnome.org/show_bug.cgi?id=490845)
 if test "x$MSGFMT" = "xno"; then
 	AC_MSG_ERROR([msgfmt not found. Please install the gettext package.])
 fi
@@ -176,6 +187,7 @@
 	echo "Building Geany for                 : ${target}"
 fi
 echo "Using GTK version                  : ${GTK_VERSION}"
+echo "Build with GTK printing support    : ${enable_printing}"
 echo "Build with plugin support          : ${enable_plugins}"
 echo "Use virtual terminal support       : ${want_vte}"
 echo "Use (UNIX domain) socket support   : ${want_socket}"

Modified: trunk/doc/geany.html
===================================================================
--- trunk/doc/geany.html	2007-11-17 13:09:19 UTC (rev 2049)
+++ trunk/doc/geany.html	2007-11-17 14:04:27 UTC (rev 2050)
@@ -6,7 +6,7 @@
 <meta name="generator" content="Docutils 0.4.1: http://docutils.sourceforge.net/" />
 <title>Geany</title>
 <meta name="authors" content="Enrico Tröger  Nick Treleaven  Frank Lanitz" />
-<meta name="date" content="2007-11-01" />
+<meta name="date" content="2007-11-12" />
 <style type="text/css">
 
 /*
@@ -133,7 +133,7 @@
 <br />Nick Treleaven
 <br />Frank Lanitz</td></tr>
 <tr><th class="docinfo-name">Date:</th>
-<td>2007-11-01</td></tr>
+<td>2007-11-12</td></tr>
 <tr><th class="docinfo-name">Version:</th>
 <td>0.13</td></tr>
 </tbody>
@@ -1476,9 +1476,35 @@
 </div>
 <div class="section">
 <h2><a class="toc-backref" href="#id80" id="printing-support" name="printing-support">Printing support</a></h2>
-<p>Geany has basic printing support. This means you can print a file by
-passing the filename of the current file to a command which actually
-prints the file. However, the printed document contains no syntax
+<p>Since Geany 0.13 there is full printing support using GTK's printing API.
+The printed page(s) will look nearly the same as on your screen in Geany.
+Additionally, there are some options to modify the printed page(s). You
+can define whether to print line numbers, page numbers at the bottom of
+each page and whether to print a page header on each page. This header
+contains the filename of the printed document, the current page number and
+the date and time of printing. By default, the file name of the document
+is added with full path information to the header. If you prefer to add
+only the basename of the file(without any path information) you can set it
+in the preferences dialog. You can also adjust the format of the date and
+time added to the page header. The available conversion specifiers are the
+same as the ones which can be used with the ANSI C strftime function.
+All of these settings can also be changed in the print dialog just before
+actual printing is done.
+On Unix-like systems the provided print dialog offers a print preview. The
+preview file is opened with a PDF viewer and by default GTK uses <tt class="docutils literal"><span class="pre">evince</span></tt>
+for print preview. If you don't have installed evince or just want to use
+another PDF viewer, you can change the program to use in the file
+<tt class="docutils literal"><span class="pre">.gtkrc-2.0</span></tt> (usually found in your home directory). Simply add a line
+like:</p>
+<pre class="literal-block">
+gtk-print-preview-command = "epdfview %f"
+</pre>
+<p>at the end of the file. Of course, you can also use xpdf, kpdf or whatever.</p>
+<p>Unfortunately, native GTK printing support is only available if Geany was
+built against GTK 2.10 (or above) <strong>and</strong> is running with GTK 2.10 (or above).
+If not, Geany provides basic printing support. This means you can print a
+file by passing the filename of the current file to a command which
+actually prints the file. However, the printed document contains no syntax
 highlighting. You can adjust the command to which the filename is
 passed in the preferences dialog. The default command is:</p>
 <pre class="literal-block">
@@ -1494,13 +1520,7 @@
 </pre>
 <p>But this depends on a2ps and xfprint4. As a replacement for xfprint4,
 gtklp or similar programs can be used.</p>
-<div class="note">
-<p class="first admonition-title">Note</p>
-<p class="last">The printing support of Geany will be improved in the future. With
-GTK 2.10, better printing (including syntax highlighting) will be
-possible.</p>
 </div>
-</div>
 <div class="section">
 <h2><a class="toc-backref" href="#id81" id="plugins" name="plugins">Plugins</a></h2>
 <p>Plugins are loaded at startup, if the <em>Enable plugin support</em>
@@ -3107,7 +3127,7 @@
 <div class="footer">
 <hr class="footer" />
 <a class="reference" href="geany.txt">View document source</a>.
-Generated on: 2007-11-12 09:15 UTC.
+Generated on: 2007-11-17 13:39 UTC.
 Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
 
 </div>

Modified: trunk/doc/geany.txt
===================================================================
--- trunk/doc/geany.txt	2007-11-17 13:09:19 UTC (rev 2049)
+++ trunk/doc/geany.txt	2007-11-17 14:04:27 UTC (rev 2050)
@@ -1368,9 +1368,37 @@
 Printing support
 ----------------
 
-Geany has basic printing support. This means you can print a file by
-passing the filename of the current file to a command which actually
-prints the file. However, the printed document contains no syntax
+Since Geany 0.13 there is full printing support using GTK's printing API.
+The printed page(s) will look nearly the same as on your screen in Geany.
+Additionally, there are some options to modify the printed page(s). You
+can define whether to print line numbers, page numbers at the bottom of
+each page and whether to print a page header on each page. This header
+contains the filename of the printed document, the current page number and
+the date and time of printing. By default, the file name of the document
+is added with full path information to the header. If you prefer to add
+only the basename of the file(without any path information) you can set it
+in the preferences dialog. You can also adjust the format of the date and
+time added to the page header. The available conversion specifiers are the
+same as the ones which can be used with the ANSI C strftime function.
+All of these settings can also be changed in the print dialog just before
+actual printing is done.
+On Unix-like systems the provided print dialog offers a print preview. The
+preview file is opened with a PDF viewer and by default GTK uses ``evince``
+for print preview. If you don't have installed evince or just want to use
+another PDF viewer, you can change the program to use in the file
+``.gtkrc-2.0`` (usually found in your home directory). Simply add a line
+like::
+
+    gtk-print-preview-command = "epdfview %f"
+
+at the end of the file. Of course, you can also use xpdf, kpdf or whatever
+as the print preview command.
+
+Unfortunately, native GTK printing support is only available if Geany was
+built against GTK 2.10 (or above) **and** is running with GTK 2.10 (or above).
+If not, Geany provides basic printing support. This means you can print a
+file by passing the filename of the current file to a command which
+actually prints the file. However, the printed document contains no syntax
 highlighting. You can adjust the command to which the filename is
 passed in the preferences dialog. The default command is::
 
@@ -1388,13 +1416,8 @@
 But this depends on a2ps and xfprint4. As a replacement for xfprint4,
 gtklp or similar programs can be used.
 
-.. note::
-    The printing support of Geany will be improved in the future. With
-    GTK 2.10, better printing (including syntax highlighting) will be
-    possible.
 
 
-
 Plugins
 -------
 

Modified: trunk/geany.glade
===================================================================
--- trunk/geany.glade	2007-11-17 13:09:19 UTC (rev 2049)
+++ trunk/geany.glade	2007-11-17 14:04:27 UTC (rev 2050)
@@ -58,7 +58,7 @@
 		      <property name="use_underline">True</property>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2282">
+			<widget class="GtkImage" id="image2299">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-new</property>
 			  <property name="icon_size">1</property>
@@ -148,7 +148,7 @@
 		      <signal name="activate" handler="on_save_all1_activate" last_modification_time="Thu, 02 Jun 2005 14:15:30 GMT"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2283">
+			<widget class="GtkImage" id="image2300">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-save</property>
 			  <property name="icon_size">1</property>
@@ -169,7 +169,7 @@
 		      <signal name="activate" handler="on_toolbutton23_clicked" last_modification_time="Mon, 24 Jul 2006 19:26:04 GMT"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2284">
+			<widget class="GtkImage" id="image2301">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-revert-to-saved</property>
 			  <property name="icon_size">1</property>
@@ -189,7 +189,7 @@
 		      <property name="use_underline">True</property>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2285">
+			<widget class="GtkImage" id="image2302">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-revert-to-saved</property>
 			  <property name="icon_size">1</property>
@@ -252,6 +252,15 @@
 		  </child>
 
 		  <child>
+		    <widget class="GtkMenuItem" id="page_setup1">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">Page set_up</property>
+		      <property name="use_underline">True</property>
+		      <signal name="activate" handler="on_page_setup1_activate" last_modification_time="Thu, 15 Nov 2007 21:11:31 GMT"/>
+		    </widget>
+		  </child>
+
+		  <child>
 		    <widget class="GtkImageMenuItem" id="print1">
 		      <property name="visible">True</property>
 		      <property name="tooltip" translatable="yes">Prints the current file</property>
@@ -285,7 +294,7 @@
 		      <signal name="activate" handler="on_close_all1_activate" last_modification_time="Thu, 02 Jun 2005 14:15:30 GMT"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2286">
+			<widget class="GtkImage" id="image2303">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-close</property>
 			  <property name="icon_size">1</property>
@@ -484,7 +493,7 @@
 			      <signal name="activate" handler="on_menu_increase_indent1_activate" last_modification_time="Tue, 01 Aug 2006 10:28:54 GMT"/>
 
 			      <child internal-child="image">
-				<widget class="GtkImage" id="image2287">
+				<widget class="GtkImage" id="image2304">
 				  <property name="visible">True</property>
 				  <property name="stock">gtk-indent</property>
 				  <property name="icon_size">1</property>
@@ -505,7 +514,7 @@
 			      <signal name="activate" handler="on_menu_decrease_indent1_activate" last_modification_time="Tue, 01 Aug 2006 10:28:54 GMT"/>
 
 			      <child internal-child="image">
-				<widget class="GtkImage" id="image2288">
+				<widget class="GtkImage" id="image2305">
 				  <property name="visible">True</property>
 				  <property name="stock">gtk-unindent</property>
 				  <property name="icon_size">1</property>
@@ -561,7 +570,7 @@
 		      <property name="use_underline">True</property>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2289">
+			<widget class="GtkImage" id="image2306">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-add</property>
 			  <property name="icon_size">1</property>
@@ -646,7 +655,7 @@
 		      <property name="use_underline">True</property>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2290">
+			<widget class="GtkImage" id="image2307">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-add</property>
 			  <property name="icon_size">1</property>
@@ -678,7 +687,7 @@
 		      <property name="use_underline">True</property>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2291">
+			<widget class="GtkImage" id="image2308">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-add</property>
 			  <property name="icon_size">1</property>
@@ -775,7 +784,7 @@
 		      <signal name="activate" handler="on_replace1_activate" last_modification_time="Sun, 23 Oct 2005 13:22:36 GMT"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2292">
+			<widget class="GtkImage" id="image2309">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-find-and-replace</property>
 			  <property name="icon_size">1</property>
@@ -841,7 +850,7 @@
 		      <signal name="activate" handler="on_go_to_line1_activate" last_modification_time="Tue, 23 May 2006 17:10:49 GMT"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2293">
+			<widget class="GtkImage" id="image2310">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-jump-to</property>
 			  <property name="icon_size">1</property>
@@ -876,7 +885,7 @@
 		      <signal name="activate" handler="on_change_font1_activate" last_modification_time="Fri, 22 Apr 2005 18:58:45 GMT"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2294">
+			<widget class="GtkImage" id="image2311">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-select-font</property>
 			  <property name="icon_size">1</property>
@@ -1285,7 +1294,7 @@
 		      <signal name="activate" handler="on_project_new1_activate" last_modification_time="Thu, 18 Jan 2007 22:16:24 GMT"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2295">
+			<widget class="GtkImage" id="image2312">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-new</property>
 			  <property name="icon_size">1</property>
@@ -1306,7 +1315,7 @@
 		      <signal name="activate" handler="on_project_open1_activate" last_modification_time="Mon, 15 Jan 2007 17:34:17 GMT"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2296">
+			<widget class="GtkImage" id="image2313">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-open</property>
 			  <property name="icon_size">1</property>
@@ -1327,7 +1336,7 @@
 		      <signal name="activate" handler="on_project_close1_activate" last_modification_time="Mon, 15 Jan 2007 17:34:17 GMT"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2297">
+			<widget class="GtkImage" id="image2314">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-close</property>
 			  <property name="icon_size">1</property>
@@ -1385,7 +1394,7 @@
 		      <signal name="activate" handler="on_show_color_chooser1_activate" last_modification_time="Wed, 22 Jun 2005 18:10:21 GMT"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2298">
+			<widget class="GtkImage" id="image2315">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-select-color</property>
 			  <property name="icon_size">1</property>
@@ -1429,7 +1438,7 @@
 		      <signal name="activate" handler="on_help1_activate" last_modification_time="Sun, 24 Jul 2005 15:23:11 GMT"/>
 
 		      <child internal-child="image">
-			<widget class="GtkImage" id="image2299">
+			<widget class="GtkImage" id="image2316">
 			  <property name="visible">True</property>
 			  <property name="stock">gtk-help</property>
 			  <property name="icon_size">1</property>
@@ -7077,66 +7086,15 @@
 			  <property name="column_spacing">6</property>
 
 			  <child>
-			    <widget class="GtkEntry" id="entry_print">
+			    <widget class="GtkLabel" id="label189">
 			      <property name="visible">True</property>
-			      <property name="tooltip" translatable="yes">Path to the command for printing files (use %f for the filename).</property>
-			      <property name="can_focus">True</property>
-			      <property name="editable">True</property>
-			      <property name="visibility">True</property>
-			      <property name="max_length">0</property>
-			      <property name="text" translatable="yes"></property>
-			      <property name="has_frame">True</property>
-			      <property name="invisible_char">*</property>
-			      <property name="activates_default">False</property>
-			    </widget>
-			    <packing>
-			      <property name="left_attach">1</property>
-			      <property name="right_attach">2</property>
-			      <property name="top_attach">0</property>
-			      <property name="bottom_attach">1</property>
-			      <property name="y_options"></property>
-			    </packing>
-			  </child>
-
-			  <child>
-			    <widget class="GtkButton" id="button_print">
-			      <property name="visible">True</property>
-			      <property name="can_focus">True</property>
-			      <property name="relief">GTK_RELIEF_NORMAL</property>
-			      <property name="focus_on_click">True</property>
-
-			      <child>
-				<widget class="GtkImage" id="image763">
-				  <property name="visible">True</property>
-				  <property name="stock">gtk-open</property>
-				  <property name="icon_size">4</property>
-				  <property name="xalign">0.5</property>
-				  <property name="yalign">0.5</property>
-				  <property name="xpad">0</property>
-				  <property name="ypad">0</property>
-				</widget>
-			      </child>
-			    </widget>
-			    <packing>
-			      <property name="left_attach">2</property>
-			      <property name="right_attach">3</property>
-			      <property name="top_attach">0</property>
-			      <property name="bottom_attach">1</property>
-			      <property name="x_options">fill</property>
-			      <property name="y_options"></property>
-			    </packing>
-			  </child>
-
-			  <child>
-			    <widget class="GtkLabel" id="label154">
-			      <property name="visible">True</property>
-			      <property name="label" translatable="yes">Print:</property>
+			      <property name="label" translatable="yes">Context action:</property>
 			      <property name="use_underline">False</property>
 			      <property name="use_markup">False</property>
 			      <property name="justify">GTK_JUSTIFY_LEFT</property>
 			      <property name="wrap">False</property>
 			      <property name="selectable">False</property>
-			      <property name="xalign">0</property>
+			      <property name="xalign">0.5</property>
 			      <property name="yalign">0.5</property>
 			      <property name="xpad">0</property>
 			      <property name="ypad">0</property>
@@ -7171,41 +7129,13 @@
 			    <packing>
 			      <property name="left_attach">1</property>
 			      <property name="right_attach">2</property>
-			      <property name="top_attach">1</property>
-			      <property name="bottom_attach">2</property>
+			      <property name="top_attach">0</property>
+			      <property name="bottom_attach">1</property>
 			      <property name="y_options"></property>
 			    </packing>
 			  </child>
 
 			  <child>
-			    <widget class="GtkLabel" id="label189">
-			      <property name="visible">True</property>
-			      <property name="label" translatable="yes">Context action:</property>
-			      <property name="use_underline">False</property>
-			      <property name="use_markup">False</property>
-			      <property name="justify">GTK_JUSTIFY_LEFT</property>
-			      <property name="wrap">False</property>
-			      <property name="selectable">False</property>
-			      <property name="xalign">0.5</property>
-			      <property name="yalign">0.5</property>
-			      <property name="xpad">0</property>
-			      <property name="ypad">0</property>
-			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-			      <property name="width_chars">-1</property>
-			      <property name="single_line_mode">False</property>
-			      <property name="angle">0</property>
-			    </widget>
-			    <packing>
-			      <property name="left_attach">0</property>
-			      <property name="right_attach">1</property>
-			      <property name="top_attach">1</property>
-			      <property name="bottom_attach">2</property>
-			      <property name="x_options">fill</property>
-			      <property name="y_options"></property>
-			    </packing>
-			  </child>
-
-			  <child>
 			    <widget class="GtkButton" id="button_contextaction">
 			      <property name="visible">True</property>
 			      <property name="can_focus">True</property>
@@ -7227,8 +7157,8 @@
 			    <packing>
 			      <property name="left_attach">2</property>
 			      <property name="right_attach">3</property>
-			      <property name="top_attach">1</property>
-			      <property name="bottom_attach">2</property>
+			      <property name="top_attach">0</property>
+			      <property name="bottom_attach">1</property>
 			      <property name="x_options">fill</property>
 			      <property name="y_options"></property>
 			    </packing>
@@ -7859,6 +7789,418 @@
 	      <property name="type">tab</property>
 	    </packing>
 	  </child>
+
+	  <child>
+	    <widget class="GtkVBox" id="vbox27">
+	      <property name="visible">True</property>
+	      <property name="homogeneous">False</property>
+	      <property name="spacing">0</property>
+
+	      <child>
+		<widget class="GtkFrame" id="frame32">
+		  <property name="visible">True</property>
+		  <property name="label_xalign">0</property>
+		  <property name="label_yalign">0.5</property>
+		  <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+		  <child>
+		    <widget class="GtkAlignment" id="alignment35">
+		      <property name="visible">True</property>
+		      <property name="xalign">0.5</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xscale">1</property>
+		      <property name="yscale">1</property>
+		      <property name="top_padding">0</property>
+		      <property name="bottom_padding">0</property>
+		      <property name="left_padding">12</property>
+		      <property name="right_padding">0</property>
+
+		      <child>
+			<widget class="GtkHBox" id="hbox9">
+			  <property name="visible">True</property>
+			  <property name="homogeneous">False</property>
+			  <property name="spacing">5</property>
+
+			  <child>
+			    <widget class="GtkLabel" id="label202">
+			      <property name="visible">True</property>
+			      <property name="label" translatable="yes">Command:</property>
+			      <property name="use_underline">False</property>
+			      <property name="use_markup">False</property>
+			      <property name="justify">GTK_JUSTIFY_LEFT</property>
+			      <property name="wrap">False</property>
+			      <property name="selectable">False</property>
+			      <property name="xalign">0.5</property>
+			      <property name="yalign">0.5</property>
+			      <property name="xpad">0</property>
+			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
+
+			  <child>
+			    <widget class="GtkEntry" id="entry_print_external_cmd">
+			      <property name="visible">True</property>
+			      <property name="tooltip" translatable="yes">Path to the command for printing files (use %f for the filename).</property>
+			      <property name="can_focus">True</property>
+			      <property name="editable">True</property>
+			      <property name="visibility">True</property>
+			      <property name="max_length">0</property>
+			      <property name="text" translatable="yes"></property>
+			      <property name="has_frame">True</property>
+			      <property name="invisible_char">*</property>
+			      <property name="activates_default">False</property>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">True</property>
+			      <property name="fill">True</property>
+			    </packing>
+			  </child>
+
+			  <child>
+			    <widget class="GtkButton" id="button_print_external_cmd">
+			      <property name="visible">True</property>
+			      <property name="can_focus">True</property>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
+			      <property name="focus_on_click">True</property>
+
+			      <child>
+				<widget class="GtkImage" id="image763">
+				  <property name="visible">True</property>
+				  <property name="stock">gtk-open</property>
+				  <property name="icon_size">4</property>
+				  <property name="xalign">0.5</property>
+				  <property name="yalign">0.5</property>
+				  <property name="xpad">0</property>
+				  <property name="ypad">0</property>
+				</widget>
+			      </child>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
+			</widget>
+		      </child>
+		    </widget>
+		  </child>
+
+		  <child>
+		    <widget class="GtkRadioButton" id="radio_print_external">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="label" translatable="yes">Use an external command for printing</property>
+		      <property name="use_underline">True</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</property>
+		      <property name="focus_on_click">False</property>
+		      <property name="active">False</property>
+		      <property name="inconsistent">False</property>
+		      <property name="draw_indicator">True</property>
+		    </widget>
+		    <packing>
+		      <property name="type">label_item</property>
+		    </packing>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkFrame" id="frame31">
+		  <property name="visible">True</property>
+		  <property name="label_xalign">0</property>
+		  <property name="label_yalign">0.5</property>
+		  <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+		  <child>
+		    <widget class="GtkAlignment" id="alignment34">
+		      <property name="visible">True</property>
+		      <property name="xalign">0.5</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xscale">1</property>
+		      <property name="yscale">1</property>
+		      <property name="top_padding">0</property>
+		      <property name="bottom_padding">0</property>
+		      <property name="left_padding">12</property>
+		      <property name="right_padding">0</property>
+
+		      <child>
+			<widget class="GtkVBox" id="vbox29">
+			  <property name="visible">True</property>
+			  <property name="homogeneous">False</property>
+			  <property name="spacing">0</property>
+
+			  <child>
+			    <widget class="GtkCheckButton" id="check_print_linenumbers">
+			      <property name="visible">True</property>
+			      <property name="tooltip" translatable="yes">Add line numbers to the printed page.</property>
+			      <property name="can_focus">True</property>
+			      <property name="label" translatable="yes">Print line numbers</property>
+			      <property name="use_underline">True</property>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
+			      <property name="focus_on_click">False</property>
+			      <property name="active">False</property>
+			      <property name="inconsistent">False</property>
+			      <property name="draw_indicator">True</property>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
+
+			  <child>
+			    <widget class="GtkCheckButton" id="check_print_pagenumbers">
+			      <property name="visible">True</property>
+			      <property name="tooltip" translatable="yes">Add page numbers at the bottom of each page. It takes 2 lines of the page.</property>
+			      <property name="can_focus">True</property>
+			      <property name="label" translatable="yes">Print page numbers</property>
+			      <property name="use_underline">True</property>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
+			      <property name="focus_on_click">False</property>
+			      <property name="active">False</property>
+			      <property name="inconsistent">False</property>
+			      <property name="draw_indicator">True</property>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
+
+			  <child>
+			    <widget class="GtkCheckButton" id="check_print_pageheader">
+			      <property name="visible">True</property>
+			      <property name="tooltip" translatable="yes">Adds a little header to every page containing the page number, the filename and the current date(see below). It takes 3 lines of the page.</property>
+			      <property name="can_focus">True</property>
+			      <property name="label" translatable="yes">Print page header</property>
+			      <property name="use_underline">True</property>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
+			      <property name="focus_on_click">False</property>
+			      <property name="active">False</property>
+			      <property name="inconsistent">False</property>
+			      <property name="draw_indicator">True</property>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
+
+			  <child>
+			    <widget class="GtkFrame" id="frame33">
+			      <property name="visible">True</property>
+			      <property name="label_xalign">0</property>
+			      <property name="label_yalign">0</property>
+			      <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+			      <child>
+				<widget class="GtkAlignment" id="alignment36">
+				  <property name="visible">True</property>
+				  <property name="xalign">0</property>
+				  <property name="yalign">0.5</property>
+				  <property name="xscale">1</property>
+				  <property name="yscale">1</property>
+				  <property name="top_padding">0</property>
+				  <property name="bottom_padding">0</property>
+				  <property name="left_padding">12</property>
+				  <property name="right_padding">0</property>
+
+				  <child>
+				    <widget class="GtkVBox" id="vbox30">
+				      <property name="visible">True</property>
+				      <property name="homogeneous">False</property>
+				      <property name="spacing">1</property>
+
+				      <child>
+					<widget class="GtkCheckButton" id="check_print_basename">
+					  <property name="visible">True</property>
+					  <property name="tooltip" translatable="yes">Print only the basename(without the path) of the printed file.</property>
+					  <property name="can_focus">True</property>
+					  <property name="label" translatable="yes">Use the basename of the printed file</property>
+					  <property name="use_underline">True</property>
+					  <property name="relief">GTK_RELIEF_NORMAL</property>
+					  <property name="focus_on_click">False</property>
+					  <property name="active">False</property>
+					  <property name="inconsistent">False</property>
+					  <property name="draw_indicator">True</property>
+					</widget>
+					<packing>
+					  <property name="padding">0</property>
+					  <property name="expand">False</property>
+					  <property name="fill">False</property>
+					</packing>
+				      </child>
+
+				      <child>
+					<widget class="GtkHBox" id="hbox10">
+					  <property name="visible">True</property>
+					  <property name="homogeneous">False</property>
+					  <property name="spacing">5</property>
+
+					  <child>
+					    <widget class="GtkLabel" id="label203">
+					      <property name="visible">True</property>
+					      <property name="label" translatable="yes">Date format:</property>
+					      <property name="use_underline">False</property>
+					      <property name="use_markup">False</property>
+					      <property name="justify">GTK_JUSTIFY_LEFT</property>
+					      <property name="wrap">False</property>
+					      <property name="selectable">False</property>
+					      <property name="xalign">0.5</property>
+					      <property name="yalign">0.5</property>
+					      <property name="xpad">0</property>
+					      <property name="ypad">0</property>
+					      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+					      <property name="width_chars">-1</property>
+					      <property name="single_line_mode">False</property>
+					      <property name="angle">0</property>
+					    </widget>
+					    <packing>
+					      <property name="padding">0</property>
+					      <property name="expand">False</property>
+					      <property name="fill">False</property>
+					    </packing>
+					  </child>
+
+					  <child>
+					    <widget class="GtkEntry" id="entry_print_dateformat">
+					      <property name="visible">True</property>
+					      <property name="tooltip" translatable="yes">Specify a format for the date and time stamp which is added to the page header on each page. You can use any conversion specifiers which can be used with the ANSI C strftime function.</property>
+					      <property name="can_focus">True</property>
+					      <property name="editable">True</property>
+					      <property name="visibility">True</property>
+					      <property name="max_length">0</property>
+					      <property name="text" translatable="yes"></property>
+					      <property name="has_frame">True</property>
+					      <property name="invisible_char">●</property>
+					      <property name="activates_default">False</property>
+					    </widget>
+					    <packing>
+					      <property name="padding">0</property>
+					      <property name="expand">True</property>
+					      <property name="fill">True</property>
+					    </packing>
+					  </child>
+					</widget>
+					<packing>
+					  <property name="padding">0</property>
+					  <property name="expand">True</property>
+					  <property name="fill">True</property>
+					</packing>
+				      </child>
+				    </widget>
+				  </child>
+				</widget>
+			      </child>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">True</property>
+			      <property name="fill">True</property>
+			    </packing>
+			  </child>
+			</widget>
+		      </child>
+		    </widget>
+		  </child>
+
+		  <child>
+		    <widget class="GtkRadioButton" id="radio_print_gtk">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="label" translatable="yes">Use native GTK printing</property>
+		      <property name="use_underline">True</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</property>
+		      <property name="focus_on_click">False</property>
+		      <property name="active">False</property>
+		      <property name="inconsistent">False</property>
+		      <property name="draw_indicator">True</property>
+		      <property name="group">radio_print_external</property>
+		    </widget>
+		    <packing>
+		      <property name="type">label_item</property>
+		    </packing>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">True</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkLabel" id="label204">
+		  <property name="visible">True</property>
+		  <property name="label" translatable="yes"><i>Notice: Native GTK printing is only available if Geany was built against GTK 2.10 (or above) <b>and</b> Geany is running with GTK 2.10 (or above).</i></property>
+		  <property name="use_underline">False</property>
+		  <property name="use_markup">True</property>
+		  <property name="justify">GTK_JUSTIFY_LEFT</property>
+		  <property name="wrap">True</property>
+		  <property name="selectable">False</property>
+		  <property name="xalign">0.0500000007451</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xpad">0</property>
+		  <property name="ypad">0</property>
+		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		  <property name="width_chars">-1</property>
+		  <property name="single_line_mode">False</property>
+		  <property name="angle">0</property>
+		</widget>
+		<packing>
+		  <property name="padding">5</property>
+		  <property name="expand">False</property>
+		  <property name="fill">True</property>
+		</packing>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="tab_expand">False</property>
+	      <property name="tab_fill">True</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkLabel" id="label201">
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes">Printing</property>
+	      <property name="use_underline">False</property>
+	      <property name="use_markup">False</property>
+	      <property name="justify">GTK_JUSTIFY_LEFT</property>
+	      <property name="wrap">False</property>
+	      <property name="selectable">False</property>
+	      <property name="xalign">0.5</property>
+	      <property name="yalign">0.5</property>
+	      <property name="xpad">0</property>
+	      <property name="ypad">0</property>
+	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+	      <property name="width_chars">-1</property>
+	      <property name="single_line_mode">False</property>
+	      <property name="angle">0</property>
+	    </widget>
+	    <packing>
+	      <property name="type">tab</property>
+	    </packing>
+	  </child>
 	</widget>
 	<packing>
 	  <property name="padding">6</property>

Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am	2007-11-17 13:09:19 UTC (rev 2049)
+++ trunk/src/Makefile.am	2007-11-17 14:04:27 UTC (rev 2050)
@@ -26,6 +26,7 @@
 	notebook.c notebook.h \
 	plugins.c plugins.h \
 	prefs.c prefs.h \
+	printing.c printing.h \
 	project.c project.h \
 	sciwrappers.c sciwrappers.h \
 	search.c search.h \

Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c	2007-11-17 13:09:19 UTC (rev 2049)
+++ trunk/src/callbacks.c	2007-11-17 14:04:27 UTC (rev 2050)
@@ -61,7 +61,7 @@
 #include "tools.h"
 #include "project.h"
 #include "navqueue.h"
-//#include "printing.h"
+#include "printing.h"
 
 #include "geanyobject.h"
 
@@ -298,6 +298,12 @@
 {
 	gtk_widget_set_sensitive(ui_widgets.recent_files_menuitem,
 						g_queue_get_length(ui_prefs.recent_queue) > 0);
+#if GTK_CHECK_VERSION(2, 10, 0)
+	// hide Page setup when GTK printing is not used
+	// (on GTK < 2.10 the menu item is hidden completely)
+	ui_widget_show_hide(ui_widgets.print_page_setup,
+		printing_prefs.use_gtk_printing || gtk_check_version(2, 10, 0) != NULL);
+#endif
 }
 
 
@@ -1618,8 +1624,7 @@
 	gint idx = document_get_cur_idx();
 	if (! DOC_IDX_VALID(idx))
 		return;
-	//printing_print_doc(idx);
-	document_print(idx);
+	printing_print_doc(idx);
 }
 
 
@@ -2131,3 +2136,13 @@
 	document_strip_trailing_spaces(idx);
 }
 
+
+void
+on_page_setup1_activate                (GtkMenuItem     *menuitem,
+                                        gpointer         user_data)
+{
+#if GTK_CHECK_VERSION(2, 10, 0)
+	printing_page_setup_gtk();
+#endif
+}
+

Modified: trunk/src/callbacks.h
===================================================================
--- trunk/src/callbacks.h	2007-11-17 13:09:19 UTC (rev 2049)
+++ trunk/src/callbacks.h	2007-11-17 14:04:27 UTC (rev 2050)
@@ -591,3 +591,7 @@
 void
 on_strip_trailing_spaces1_activate     (GtkMenuItem     *menuitem,
                                         gpointer         user_data);
+
+void
+on_page_setup1_activate                (GtkMenuItem     *menuitem,
+                                        gpointer         user_data);

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2007-11-17 13:09:19 UTC (rev 2049)
+++ trunk/src/document.c	2007-11-17 14:04:27 UTC (rev 2050)
@@ -1995,49 +1995,6 @@
 }
 
 
-/* simple file print */
-void document_print(gint idx)
-{
-	gchar *cmdline;
-
-	if (! DOC_IDX_VALID(idx) || doc_list[idx].file_name == NULL)
-		return;
-
-	cmdline = g_strdup(prefs.tools_print_cmd);
-	cmdline = utils_str_replace(cmdline, "%f", doc_list[idx].file_name);
-
-	if (dialogs_show_question(
-			_("The file \"%s\" will be printed with the following command:\n\n%s"),
-			doc_list[idx].file_name, cmdline))
-	{
-		GError *error = NULL;
-
-#ifdef G_OS_WIN32
-		gchar *tmp_cmdline = cmdline;
-#else
-		// /bin/sh -c emulates the system() call and makes complex commands possible
-		// but only needed on non-win32 systems due to the lack of win32's shell capabilities
-		gchar *tmp_cmdline = g_strconcat("/bin/sh -c \"", cmdline, "\"", NULL);
-#endif
-
-		if (! g_spawn_command_line_async(tmp_cmdline, &error))
-		{
-			dialogs_show_msgbox(GTK_MESSAGE_ERROR, _("Printing of \"%s\" failed (return code: %s)."),
-								doc_list[idx].file_name, error->message);
-			g_error_free(error);
-		}
-		else
-		{
-			ui_set_statusbar(TRUE, _("File %s printed."), doc_list[idx].file_name);
-		}
-#ifndef G_OS_WIN32
-		g_free(tmp_cmdline);
-#endif
-	}
-	g_free(cmdline);
-}
-
-
 void document_replace_tabs(gint idx)
 {
 	gint search_pos, pos_in_line, current_tab_true_length;

Modified: trunk/src/document.h
===================================================================
--- trunk/src/document.h	2007-11-17 13:09:19 UTC (rev 2049)
+++ trunk/src/document.h	2007-11-17 14:04:27 UTC (rev 2050)
@@ -186,9 +186,6 @@
 
 void document_clear_indicators(gint idx);
 
-/* simple file print */
-void document_print(gint idx);
-
 void document_replace_tabs(gint idx);
 
 void document_strip_line_trailing_spaces(gint idx, gint line);

Modified: trunk/src/interface.c
===================================================================
--- trunk/src/interface.c	2007-11-17 13:09:19 UTC (rev 2049)
+++ trunk/src/interface.c	2007-11-17 14:04:27 UTC (rev 2050)
@@ -37,7 +37,7 @@
   GtkWidget *file1_menu;
   GtkWidget *menu_new1;
   GtkWidget *menu_new_with_template1;
-  GtkWidget *image2282;
+  GtkWidget *image2299;
   GtkWidget *menu_new_with_template1_menu;
   GtkWidget *invisible2;
   GtkWidget *separator12;
@@ -48,11 +48,11 @@
   GtkWidget *menu_save1;
   GtkWidget *menu_save_as1;
   GtkWidget *menu_save_all1;
-  GtkWidget *image2283;
+  GtkWidget *image2300;
   GtkWidget *menu_reload1;
-  GtkWidget *image2284;
+  GtkWidget *image2301;
   GtkWidget *menu_reload_as1;
-  GtkWidget *image2285;
+  GtkWidget *image2302;
   GtkWidget *menu_reload_as1_menu;
   GtkWidget *invisible7;
   GtkWidget *separator21;
@@ -60,11 +60,12 @@
   GtkWidget *separator39;
   GtkWidget *preferences2;
   GtkWidget *separator24;
+  GtkWidget *page_setup1;
   GtkWidget *print1;
   GtkWidget *separator14;
   GtkWidget *menu_close1;
   GtkWidget *menu_close_all1;
-  GtkWidget *image2286;
+  GtkWidget *image2303;
   GtkWidget *menu_separatormenuitem1;
   GtkWidget *menu_quit1;
   GtkWidget *edit1;
@@ -89,16 +90,16 @@
   GtkWidget *menu_duplicate_line1;
   GtkWidget *separator29;
   GtkWidget *menu_increase_indent1;
-  GtkWidget *image2287;
+  GtkWidget *image2304;
   GtkWidget *menu_decrease_indent1;
-  GtkWidget *image2288;
+  GtkWidget *image2305;
   GtkWidget *separator37;
   GtkWidget *send_selection_to2;
   GtkWidget *send_selection_to2_menu;
   GtkWidget *invisible13;
   GtkWidget *separator18;
   GtkWidget *add_comments1;
-  GtkWidget *image2289;
+  GtkWidget *image2306;
   GtkWidget *add_comments1_menu;
   GtkWidget *menu_add_changelog_entry1;
   GtkWidget *insert_file_header1;
@@ -107,11 +108,11 @@
   GtkWidget *insert_gpl_notice2;
   GtkWidget *insert_bsd_license_notice2;
   GtkWidget *insert_date1;
-  GtkWidget *image2290;
+  GtkWidget *image2307;
   GtkWidget *insert_date1_menu;
   GtkWidget *invisible8;
   GtkWidget *insert_include2;
-  GtkWidget *image2291;
+  GtkWidget *image2308;
   GtkWidget *insert_include2_menu;
   GtkWidget *invisible4;
   GtkWidget *separator9;
@@ -123,7 +124,7 @@
   GtkWidget *find_previous1;
   GtkWidget *find_in_files1;
   GtkWidget *replace1;
-  GtkWidget *image2292;
+  GtkWidget *image2309;
   GtkWidget *separator33;
   GtkWidget *find_nextsel1;
   GtkWidget *find_prevsel1;
@@ -131,11 +132,11 @@
   GtkWidget *next_message1;
   GtkWidget *separator32;
   GtkWidget *go_to_line1;
-  GtkWidget *image2293;
+  GtkWidget *image2310;
   GtkWidget *menu_view1;
   GtkWidget *menu_view1_menu;
   GtkWidget *menu_change_font1;
-  GtkWidget *image2294;
+  GtkWidget *image2311;
   GtkWidget *menu_separator4;
   GtkWidget *menu_toggle_all_additional_widgets1;
   GtkWidget *menu_fullscreen1;
@@ -185,23 +186,23 @@
   GtkWidget *menu_project1;
   GtkWidget *menu_project1_menu;
   GtkWidget *project_new1;
-  GtkWidget *image2295;
+  GtkWidget *image2312;
   GtkWidget *project_open1;
-  GtkWidget *image2296;
+  GtkWidget *image2313;
   GtkWidget *project_close1;
-  GtkWidget *image2297;
+  GtkWidget *image2314;
   GtkWidget *separator34;
   GtkWidget *project_properties1;
   GtkWidget *menu_build1;
   GtkWidget *tools1;
   GtkWidget *tools1_menu;
   GtkWidget *menu_choose_color1;
-  GtkWidget *image2298;
+  GtkWidget *image2315;
   GtkWidget *menu_count_words1;
   GtkWidget *menu_help1;
   GtkWidget *menu_help1_menu;
   GtkWidget *help1;
-  GtkWidget *image2299;
+  GtkWidget *image2316;
   GtkWidget *keyboard_shortcuts1;
   GtkWidget *website1;
   GtkWidget *separator16;
@@ -301,9 +302,9 @@
   gtk_widget_show (menu_new_with_template1);
   gtk_container_add (GTK_CONTAINER (file1_menu), menu_new_with_template1);
 
-  image2282 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2282);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_new_with_template1), image2282);
+  image2299 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2299);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_new_with_template1), image2299);
 
   menu_new_with_template1_menu = gtk_menu_new ();
   gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_new_with_template1), menu_new_with_template1_menu);
@@ -346,25 +347,25 @@
   gtk_container_add (GTK_CONTAINER (file1_menu), menu_save_all1);
   gtk_tooltips_set_tip (tooltips, menu_save_all1, _("Saves all open files"), NULL);
 
-  image2283 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2283);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_all1), image2283);
+  image2300 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2300);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_all1), image2300);
 
   menu_reload1 = gtk_image_menu_item_new_with_mnemonic (_("_Reload"));
   gtk_widget_show (menu_reload1);
   gtk_container_add (GTK_CONTAINER (file1_menu), menu_reload1);
 
-  image2284 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2284);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload1), image2284);
+  image2301 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2301);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload1), image2301);
 
   menu_reload_as1 = gtk_image_menu_item_new_with_mnemonic (_("R_eload As"));
   gtk_widget_show (menu_reload_as1);
   gtk_container_add (GTK_CONTAINER (file1_menu), menu_reload_as1);
 
-  image2285 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2285);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload_as1), image2285);
+  image2302 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2302);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload_as1), image2302);
 
   menu_reload_as1_menu = gtk_menu_new ();
   gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_reload_as1), menu_reload_as1_menu);
@@ -396,6 +397,10 @@
   gtk_container_add (GTK_CONTAINER (file1_menu), separator24);
   gtk_widget_set_sensitive (separator24, FALSE);
 
+  page_setup1 = gtk_menu_item_new_with_mnemonic (_("Page set_up"));
+  gtk_widget_show (page_setup1);
+  gtk_container_add (GTK_CONTAINER (file1_menu), page_setup1);
+
   print1 = gtk_image_menu_item_new_from_stock ("gtk-print", accel_group);
   gtk_widget_show (print1);
   gtk_container_add (GTK_CONTAINER (file1_menu), print1);
@@ -415,9 +420,9 @@
   gtk_container_add (GTK_CONTAINER (file1_menu), menu_close_all1);
   gtk_tooltips_set_tip (tooltips, menu_close_all1, _("Closes all open files"), NULL);
 
-  image2286 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2286);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_close_all1), image2286);
+  image2303 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2303);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_close_all1), image2303);
 
   menu_separatormenuitem1 = gtk_separator_menu_item_new ();
   gtk_widget_show (menu_separatormenuitem1);
@@ -521,17 +526,17 @@
   gtk_widget_show (menu_increase_indent1);
   gtk_container_add (GTK_CONTAINER (menu_format1_menu), menu_increase_indent1);
 
-  image2287 = gtk_image_new_from_stock ("gtk-indent", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2287);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_increase_indent1), image2287);
+  image2304 = gtk_image_new_from_stock ("gtk-indent", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2304);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_increase_indent1), image2304);
 
   menu_decrease_indent1 = gtk_image_menu_item_new_with_mnemonic (_("_Decrease Indent"));
   gtk_widget_show (menu_decrease_indent1);
   gtk_container_add (GTK_CONTAINER (menu_format1_menu), menu_decrease_indent1);
 
-  image2288 = gtk_image_new_from_stock ("gtk-unindent", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2288);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_decrease_indent1), image2288);
+  image2305 = gtk_image_new_from_stock ("gtk-unindent", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2305);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_decrease_indent1), image2305);
 
   separator37 = gtk_separator_menu_item_new ();
   gtk_widget_show (separator37);
@@ -557,9 +562,9 @@
   gtk_widget_show (add_comments1);
   gtk_container_add (GTK_CONTAINER (edit1_menu), add_comments1);
 
-  image2289 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2289);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_comments1), image2289);
+  image2306 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2306);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_comments1), image2306);
 
   add_comments1_menu = gtk_menu_new ();
   gtk_menu_item_set_submenu (GTK_MENU_ITEM (add_comments1), add_comments1_menu);
@@ -598,9 +603,9 @@
   gtk_widget_show (insert_date1);
   gtk_container_add (GTK_CONTAINER (edit1_menu), insert_date1);
 
-  image2290 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2290);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_date1), image2290);
+  image2307 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2307);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_date1), image2307);
 
   insert_date1_menu = gtk_menu_new ();
   gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_date1), insert_date1_menu);
@@ -612,9 +617,9 @@
   gtk_widget_show (insert_include2);
   gtk_container_add (GTK_CONTAINER (edit1_menu), insert_include2);
 
-  image2291 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2291);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include2), image2291);
+  image2308 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2308);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include2), image2308);
 
   insert_include2_menu = gtk_menu_new ();
   gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_include2), insert_include2_menu);
@@ -658,9 +663,9 @@
   gtk_widget_show (replace1);
   gtk_container_add (GTK_CONTAINER (search1_menu), replace1);
 
-  image2292 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2292);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (replace1), image2292);
+  image2309 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2309);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (replace1), image2309);
 
   separator33 = gtk_separator_menu_item_new ();
   gtk_widget_show (separator33);
@@ -693,9 +698,9 @@
   gtk_widget_show (go_to_line1);
   gtk_container_add (GTK_CONTAINER (search1_menu), go_to_line1);
 
-  image2293 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2293);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line1), image2293);
+  image2310 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2310);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line1), image2310);
 
   menu_view1 = gtk_menu_item_new_with_mnemonic (_("_View"));
   gtk_widget_show (menu_view1);
@@ -709,9 +714,9 @@
   gtk_container_add (GTK_CONTAINER (menu_view1_menu), menu_change_font1);
   gtk_tooltips_set_tip (tooltips, menu_change_font1, _("Change the default font"), NULL);
 
-  image2294 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2294);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_change_font1), image2294);
+  image2311 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2311);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_change_font1), image2311);
 
   menu_separator4 = gtk_separator_menu_item_new ();
   gtk_widget_show (menu_separator4);
@@ -927,25 +932,25 @@
   gtk_widget_show (project_new1);
   gtk_container_add (GTK_CONTAINER (menu_project1_menu), project_new1);
 
-  image2295 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2295);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_new1), image2295);
+  image2312 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2312);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_new1), image2312);
 
   project_open1 = gtk_image_menu_item_new_with_mnemonic (_("_Open"));
   gtk_widget_show (project_open1);
   gtk_container_add (GTK_CONTAINER (menu_project1_menu), project_open1);
 
-  image2296 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2296);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_open1), image2296);
+  image2313 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2313);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_open1), image2313);
 
   project_close1 = gtk_image_menu_item_new_with_mnemonic (_("_Close"));
   gtk_widget_show (project_close1);
   gtk_container_add (GTK_CONTAINER (menu_project1_menu), project_close1);
 
-  image2297 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2297);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_close1), image2297);
+  image2314 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2314);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (project_close1), image2314);
 
   separator34 = gtk_separator_menu_item_new ();
   gtk_widget_show (separator34);
@@ -972,9 +977,9 @@
   gtk_container_add (GTK_CONTAINER (tools1_menu), menu_choose_color1);
   gtk_tooltips_set_tip (tooltips, menu_choose_color1, _("Open a color chooser dialog, to interactively pick colors from a palette."), NULL);
 
-  image2298 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2298);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_choose_color1), image2298);
+  image2315 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2315);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_choose_color1), image2315);
 
   menu_count_words1 = gtk_menu_item_new_with_mnemonic (_("_Word Count"));
   gtk_widget_show (menu_count_words1);
@@ -992,9 +997,9 @@
   gtk_widget_show (help1);
   gtk_container_add (GTK_CONTAINER (menu_help1_menu), help1);
 
-  image2299 = gtk_image_new_from_stock ("gtk-help", GTK_ICON_SIZE_MENU);
-  gtk_widget_show (image2299);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (help1), image2299);
+  image2316 = gtk_image_new_from_stock ("gtk-help", GTK_ICON_SIZE_MENU);
+  gtk_widget_show (image2316);
+  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (help1), image2316);
 
   keyboard_shortcuts1 = gtk_menu_item_new_with_mnemonic (_("_Keyboard Shortcuts"));
   gtk_widget_show (keyboard_shortcuts1);
@@ -1337,6 +1342,9 @@
   g_signal_connect ((gpointer) preferences2, "activate",
                     G_CALLBACK (on_file_properties_activate),
                     NULL);
+  g_signal_connect ((gpointer) page_setup1, "activate",
+                    G_CALLBACK (on_page_setup1_activate),
+                    NULL);
   g_signal_connect ((gpointer) print1, "activate",
                     G_CALLBACK (on_print1_activate),
                     NULL);
@@ -1647,7 +1655,7 @@
   GLADE_HOOKUP_OBJECT (window1, file1_menu, "file1_menu");
   GLADE_HOOKUP_OBJECT (window1, menu_new1, "menu_new1");
   GLADE_HOOKUP_OBJECT (window1, menu_new_with_template1, "menu_new_with_template1");
-  GLADE_HOOKUP_OBJECT (window1, image2282, "image2282");
+  GLADE_HOOKUP_OBJECT (window1, image2299, "image2299");
   GLADE_HOOKUP_OBJECT (window1, menu_new_with_template1_menu, "menu_new_with_template1_menu");
   GLADE_HOOKUP_OBJECT (window1, invisible2, "invisible2");
   GLADE_HOOKUP_OBJECT (window1, separator12, "separator12");
@@ -1658,11 +1666,11 @@
   GLADE_HOOKUP_OBJECT (window1, menu_save1, "menu_save1");
   GLADE_HOOKUP_OBJECT (window1, menu_save_as1, "menu_save_as1");
   GLADE_HOOKUP_OBJECT (window1, menu_save_all1, "menu_save_all1");
-  GLADE_HOOKUP_OBJECT (window1, image2283, "image2283");
+  GLADE_HOOKUP_OBJECT (window1, image2300, "image2300");
   GLADE_HOOKUP_OBJECT (window1, menu_reload1, "menu_reload1");
-  GLADE_HOOKUP_OBJECT (window1, image2284, "image2284");
+  GLADE_HOOKUP_OBJECT (window1, image2301, "image2301");
   GLADE_HOOKUP_OBJECT (window1, menu_reload_as1, "menu_reload_as1");
-  GLADE_HOOKUP_OBJECT (window1, image2285, "image2285");
+  GLADE_HOOKUP_OBJECT (window1, image2302, "image2302");
   GLADE_HOOKUP_OBJECT (window1, menu_reload_as1_menu, "menu_reload_as1_menu");
   GLADE_HOOKUP_OBJECT (window1, invisible7, "invisible7");
   GLADE_HOOKUP_OBJECT (window1, separator21, "separator21");
@@ -1670,11 +1678,12 @@
   GLADE_HOOKUP_OBJECT (window1, separator39, "separator39");
   GLADE_HOOKUP_OBJECT (window1, preferences2, "preferences2");
   GLADE_HOOKUP_OBJECT (window1, separator24, "separator24");
+  GLADE_HOOKUP_OBJECT (window1, page_setup1, "page_setup1");
   GLADE_HOOKUP_OBJECT (window1, print1, "print1");
   GLADE_HOOKUP_OBJECT (window1, separator14, "separator14");
   GLADE_HOOKUP_OBJECT (window1, menu_close1, "menu_close1");
   GLADE_HOOKUP_OBJECT (window1, menu_close_all1, "menu_close_all1");
-  GLADE_HOOKUP_OBJECT (window1, image2286, "image2286");
+  GLADE_HOOKUP_OBJECT (window1, image2303, "image2303");
   GLADE_HOOKUP_OBJECT (window1, menu_separatormenuitem1, "menu_separatormenuitem1");
   GLADE_HOOKUP_OBJECT (window1, menu_quit1, "menu_quit1");
   GLADE_HOOKUP_OBJECT (window1, edit1, "edit1");
@@ -1699,16 +1708,16 @@
   GLADE_HOOKUP_OBJECT (window1, menu_duplicate_line1, "menu_duplicate_line1");
   GLADE_HOOKUP_OBJECT (window1, separator29, "separator29");
   GLADE_HOOKUP_OBJECT (window1, menu_increase_indent1, "menu_increase_indent1");
-  GLADE_HOOKUP_OBJECT (window1, image2287, "image2287");
+  GLADE_HOOKUP_OBJECT (window1, image2304, "image2304");
   GLADE_HOOKUP_OBJECT (window1, menu_decrease_indent1, "menu_decrease_indent1");
-  GLADE_HOOKUP_OBJECT (window1, image2288, "image2288");
+  GLADE_HOOKUP_OBJECT (window1, image2305, "image2305");
   GLADE_HOOKUP_OBJECT (window1, separator37, "separator37");
   GLADE_HOOKUP_OBJECT (window1, send_selection_to2, "send_selection_to2");
   GLADE_HOOKUP_OBJECT (window1, send_selection_to2_menu, "send_selection_to2_menu");
   GLADE_HOOKUP_OBJECT (window1, invisible13, "invisible13");
   GLADE_HOOKUP_OBJECT (window1, separator18, "separator18");
   GLADE_HOOKUP_OBJECT (window1, add_comments1, "add_comments1");
-  GLADE_HOOKUP_OBJECT (window1, image2289, "image2289");
+  GLADE_HOOKUP_OBJECT (window1, image2306, "image2306");
   GLADE_HOOKUP_OBJECT (window1, add_comments1_menu, "add_comments1_menu");
   GLADE_HOOKUP_OBJECT (window1, menu_add_changelog_entry1, "menu_add_changelog_entry1");
   GLADE_HOOKUP_OBJECT (window1, insert_file_header1, "insert_file_header1");
@@ -1717,11 +1726,11 @@
   GLADE_HOOKUP_OBJECT (window1, insert_gpl_notice2, "insert_gpl_notice2");
   GLADE_HOOKUP_OBJECT (window1, insert_bsd_license_notice2, "insert_bsd_license_notice2");
   GLADE_HOOKUP_OBJECT (window1, insert_date1, "insert_date1");
-  GLADE_HOOKUP_OBJECT (window1, image2290, "image2290");
+  GLADE_HOOKUP_OBJECT (window1, image2307, "image2307");
   GLADE_HOOKUP_OBJECT (window1, insert_date1_menu, "insert_date1_menu");
   GLADE_HOOKUP_OBJECT (window1, invisible8, "invisible8");
   GLADE_HOOKUP_OBJECT (window1, insert_include2, "insert_include2");
-  GLADE_HOOKUP_OBJECT (window1, image2291, "image2291");
+  GLADE_HOOKUP_OBJECT (window1, image2308, "image2308");
   GLADE_HOOKUP_OBJECT (window1, insert_include2_menu, "insert_include2_menu");
   GLADE_HOOKUP_OBJECT (window1, invisible4, "invisible4");
   GLADE_HOOKUP_OBJECT (window1, separator9, "separator9");
@@ -1733,7 +1742,7 @@
   GLADE_HOOKUP_OBJECT (window1, find_previous1, "find_previous1");
   GLADE_HOOKUP_OBJECT (window1, find_in_files1, "find_in_files1");
   GLADE_HOOKUP_OBJECT (window1, replace1, "replace1");
-  GLADE_HOOKUP_OBJECT (window1, image2292, "image2292");
+  GLADE_HOOKUP_OBJECT (window1, image2309, "image2309");
   GLADE_HOOKUP_OBJECT (window1, separator33, "separator33");
   GLADE_HOOKUP_OBJECT (window1, find_nextsel1, "find_nextsel1");
   GLADE_HOOKUP_OBJECT (window1, find_prevsel1, "find_prevsel1");
@@ -1741,11 +1750,11 @@
   GLADE_HOOKUP_OBJECT (window1, next_message1, "next_message1");
   GLADE_HOOKUP_OBJECT (window1, separator32, "separator32");
   GLADE_HOOKUP_OBJECT (window1, go_to_line1, "go_to_line1");
-  GLADE_HOOKUP_OBJECT (window1, image2293, "image2293");
+  GLADE_HOOKUP_OBJECT (window1, image2310, "image2310");
   GLADE_HOOKUP_OBJECT (window1, menu_view1, "menu_view1");
   GLADE_HOOKUP_OBJECT (window1, menu_view1_menu, "menu_view1_menu");
   GLADE_HOOKUP_OBJECT (window1, menu_change_font1, "menu_change_font1");
-  GLADE_HOOKUP_OBJECT (window1, image2294, "image2294");
+  GLADE_HOOKUP_OBJECT (window1, image2311, "image2311");
   GLADE_HOOKUP_OBJECT (window1, menu_separator4, "menu_separator4");
   GLADE_HOOKUP_OBJECT (window1, menu_toggle_all_additional_widgets1, "menu_toggle_all_additional_widgets1");
   GLADE_HOOKUP_OBJECT (window1, menu_fullscreen1, "menu_fullscreen1");
@@ -1793,23 +1802,23 @@
   GLADE_HOOKUP_OBJECT (window1, menu_project1, "menu_project1");
   GLADE_HOOKUP_OBJECT (window1, menu_project1_menu, "menu_project1_menu");
   GLADE_HOOKUP_OBJECT (window1, project_new1, "project_new1");
-  GLADE_HOOKUP_OBJECT (window1, image2295, "image2295");
+  GLADE_HOOKUP_OBJECT (window1, image2312, "image2312");
   GLADE_HOOKUP_OBJECT (window1, project_open1, "project_open1");
-  GLADE_HOOKUP_OBJECT (window1, image2296, "image2296");
+  GLADE_HOOKUP_OBJECT (window1, image2313, "image2313");
   GLADE_HOOKUP_OBJECT (window1, project_close1, "project_close1");
-  GLADE_HOOKUP_OBJECT (window1, image2297, "image2297");
+  GLADE_HOOKUP_OBJECT (window1, image2314, "image2314");
   GLADE_HOOKUP_OBJECT (window1, separator34, "separator34");
   GLADE_HOOKUP_OBJECT (window1, project_properties1, "project_properties1");
   GLADE_HOOKUP_OBJECT (window1, menu_build1, "menu_build1");
   GLADE_HOOKUP_OBJECT (window1, tools1, "tools1");
   GLADE_HOOKUP_OBJECT (window1, tools1_menu, "tools1_menu");
   GLADE_HOOKUP_OBJECT (window1, menu_choose_color1, "menu_choose_color1");
-  GLADE_HOOKUP_OBJECT (window1, image2298, "image2298");
+  GLADE_HOOKUP_OBJECT (window1, image2315, "image2315");
   GLADE_HOOKUP_OBJECT (window1, menu_count_words1, "menu_count_words1");
   GLADE_HOOKUP_OBJECT (window1, menu_help1, "menu_help1");
   GLADE_HOOKUP_OBJECT (window1, menu_help1_menu, "menu_help1_menu");
   GLADE_HOOKUP_OBJECT (window1, help1, "help1");
-  GLADE_HOOKUP_OBJECT (window1, image2299, "image2299");
+  GLADE_HOOKUP_OBJECT (window1, image2316, "image2316");
   GLADE_HOOKUP_OBJECT (window1, keyboard_shortcuts1, "keyboard_shortcuts1");
   GLADE_HOOKUP_OBJECT (window1, website1, "website1");
   GLADE_HOOKUP_OBJECT (window1, separator16, "separator16");
@@ -2659,12 +2668,8 @@
   GtkWidget *frame26;
   GtkWidget *alignment29;
   GtkWidget *table12;
-  GtkWidget *entry_print;
-  GtkWidget *button_print;
-  GtkWidget *image763;
-  GtkWidget *label154;
+  GtkWidget *label189;
   GtkWidget *entry_contextaction;
-  GtkWidget *label189;
   GtkWidget *button_contextaction;
   GtkWidget *image1919;
   GtkWidget *label193;
@@ -2697,6 +2702,32 @@
   GtkWidget *button2;
   GtkWidget *label181;
   GtkWidget *label151;
+  GtkWidget *vbox27;
+  GtkWidget *frame32;
+  GtkWidget *alignment35;
+  GtkWidget *hbox9;
+  GtkWidget *label202;
+  GtkWidget *entry_print_external_cmd;
+  GtkWidget *button_print_external_cmd;
+  GtkWidget *image763;
+  GtkWidget *radio_print_external;
+  GSList *radio_print_external_group = NULL;
+  GtkWidget *frame31;
+  GtkWidget *alignment34;
+  GtkWidget *vbox29;
+  GtkWidget *check_print_linenumbers;
+  GtkWidget *check_print_pagenumbers;
+  GtkWidget *check_print_pageheader;
+  GtkWidget *frame33;
+  GtkWidget *alignment36;
+  GtkWidget *vbox30;
+  GtkWidget *check_print_basename;
+  GtkWidget *hbox10;
+  GtkWidget *label203;
+  GtkWidget *entry_print_dateformat;
+  GtkWidget *radio_print_gtk;
+  GtkWidget *label204;
+  GtkWidget *label201;
   GtkWidget *dialog_action_area3;
   GtkWidget *button3;
   GtkWidget *button4;
@@ -3995,47 +4026,23 @@
   gtk_table_set_row_spacings (GTK_TABLE (table12), 3);
   gtk_table_set_col_spacings (GTK_TABLE (table12), 6);
 
-  entry_print = gtk_entry_new ();
-  gtk_widget_show (entry_print);
-  gtk_table_attach (GTK_TABLE (table12), entry_print, 1, 2, 0, 1,
-                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
-                    (GtkAttachOptions) (0), 0, 0);
-  gtk_tooltips_set_tip (tooltips, entry_print, _("Path to the command for printing files (use %f for the filename)."), NULL);
-
-  button_print = gtk_button_new ();
-  gtk_widget_show (button_print);
-  gtk_table_attach (GTK_TABLE (table12), button_print, 2, 3, 0, 1,
+  label189 = gtk_label_new (_("Context action:"));
+  gtk_widget_show (label189);
+  gtk_table_attach (GTK_TABLE (table12), label189, 0, 1, 0, 1,
                     (GtkAttachOptions) (GTK_FILL),
                     (GtkAttachOptions) (0), 0, 0);
 
-  image763 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_BUTTON);
-  gtk_widget_show (image763);
-  gtk_container_add (GTK_CONTAINER (button_print), image763);
-
-  label154 = gtk_label_new (_("Print:"));
-  gtk_widget_show (label154);
-  gtk_table_attach (GTK_TABLE (table12), label154, 0, 1, 0, 1,
-                    (GtkAttachOptions) (GTK_FILL),
-                    (GtkAttachOptions) (0), 0, 0);
-  gtk_misc_set_alignment (GTK_MISC (label154), 0, 0.5);
-
   entry_contextaction = gtk_entry_new ();
   gtk_widget_show (entry_contextaction);
-  gtk_table_attach (GTK_TABLE (table12), entry_contextaction, 1, 2, 1, 2,
+  gtk_table_attach (GTK_TABLE (table12), entry_contextaction, 1, 2, 0, 1,
                     (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                     (GtkAttachOptions) (0), 0, 0);
   gtk_tooltips_set_tip (tooltips, entry_contextaction, _("Context action command. The currently selected word can be used with %s. It can appear anywhere in the given command and will be replaced before execution."), NULL);
   gtk_entry_set_invisible_char (GTK_ENTRY (entry_contextaction), 9679);
 
-  label189 = gtk_label_new (_("Context action:"));
-  gtk_widget_show (label189);
-  gtk_table_attach (GTK_TABLE (table12), label189, 0, 1, 1, 2,
-                    (GtkAttachOptions) (GTK_FILL),
-                    (GtkAttachOptions) (0), 0, 0);
-
   button_contextaction = gtk_button_new ();
   gtk_widget_show (button_contextaction);
-  gtk_table_attach (GTK_TABLE (table12), button_contextaction, 2, 3, 1, 2,
+  gtk_table_attach (GTK_TABLE (table12), button_contextaction, 2, 3, 0, 1,
                     (GtkAttachOptions) (GTK_FILL),
                     (GtkAttachOptions) (0), 0, 0);
 
@@ -4215,6 +4222,133 @@
   gtk_widget_show (label151);
   gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook2), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook2), 8), label151);
 
+  vbox27 = gtk_vbox_new (FALSE, 0);
+  gtk_widget_show (vbox27);
+  gtk_container_add (GTK_CONTAINER (notebook2), vbox27);
+
+  frame32 = gtk_frame_new (NULL);
+  gtk_widget_show (frame32);
+  gtk_box_pack_start (GTK_BOX (vbox27), frame32, FALSE, FALSE, 0);
+  gtk_frame_set_shadow_type (GTK_FRAME (frame32), GTK_SHADOW_NONE);
+
+  alignment35 = gtk_alignment_new (0.5, 0.5, 1, 1);
+  gtk_widget_show (alignment35);
+  gtk_container_add (GTK_CONTAINER (frame32), alignment35);
+  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment35), 0, 0, 12, 0);
+
+  hbox9 = gtk_hbox_new (FALSE, 5);
+  gtk_widget_show (hbox9);
+  gtk_container_add (GTK_CONTAINER (alignment35), hbox9);
+
+  label202 = gtk_label_new (_("Command:"));
+  gtk_widget_show (label202);
+  gtk_box_pack_start (GTK_BOX (hbox9), label202, FALSE, FALSE, 0);
+
+  entry_print_external_cmd = gtk_entry_new ();
+  gtk_widget_show (entry_print_external_cmd);
+  gtk_box_pack_start (GTK_BOX (hbox9), entry_print_external_cmd, TRUE, TRUE, 0);
+  gtk_tooltips_set_tip (tooltips, entry_print_external_cmd, _("Path to the command for printing files (use %f for the filename)."), NULL);
+
+  button_print_external_cmd = gtk_button_new ();
+  gtk_widget_show (button_print_external_cmd);
+  gtk_box_pack_start (GTK_BOX (hbox9), button_print_external_cmd, FALSE, FALSE, 0);
+
+  image763 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_BUTTON);
+  gtk_widget_show (image763);
+  gtk_container_add (GTK_CONTAINER (button_print_external_cmd), image763);
+
+  radio_print_external = gtk_radio_button_new_with_mnemonic (NULL, _("Use an external command for printing"));
+  gtk_widget_show (radio_print_external);
+  gtk_frame_set_label_widget (GTK_FRAME (frame32), radio_print_external);
+  gtk_button_set_focus_on_click (GTK_BUTTON (radio_print_external), FALSE);
+  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_print_external), radio_print_external_group);
+  radio_print_external_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_print_external));
+
+  frame31 = gtk_frame_new (NULL);
+  gtk_widget_show (frame31);
+  gtk_box_pack_start (GTK_BOX (vbox27), frame31, FALSE, TRUE, 0);
+  gtk_frame_set_shadow_type (GTK_FRAME (frame31), GTK_SHADOW_NONE);
+
+  alignment34 = gtk_alignment_new (0.5, 0.5, 1, 1);
+  gtk_widget_show (alignment34);
+  gtk_container_add (GTK_CONTAINER (frame31), alignment34);
+  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment34), 0, 0, 12, 0);
+
+  vbox29 = gtk_vbox_new (FALSE, 0);
+  gtk_widget_show (vbox29);
+  gtk_container_add (GTK_CONTAINER (alignment34), vbox29);
+
+  check_print_linenumbers = gtk_check_button_new_with_mnemonic (_("Print line numbers"));
+  gtk_widget_show (check_print_linenumbers);
+  gtk_box_pack_start (GTK_BOX (vbox29), check_print_linenumbers, FALSE, FALSE, 0);
+  gtk_tooltips_set_tip (tooltips, check_print_linenumbers, _("Add line numbers to the printed page."), NULL);
+  gtk_button_set_focus_on_click (GTK_BUTTON (check_print_linenumbers), FALSE);
+
+  check_print_pagenumbers = gtk_check_button_new_with_mnemonic (_("Print page numbers"));
+  gtk_widget_show (check_print_pagenumbers);
+  gtk_box_pack_start (GTK_BOX (vbox29), check_print_pagenumbers, FALSE, FALSE, 0);
+  gtk_tooltips_set_tip (tooltips, check_print_pagenumbers, _("Add page numbers at the bottom of each page. It takes 2 lines of the page."), NULL);
+  gtk_button_set_focus_on_click (GTK_BUTTON (check_print_pagenumbers), FALSE);
+
+  check_print_pageheader = gtk_check_button_new_with_mnemonic (_("Print page header"));
+  gtk_widget_show (check_print_pageheader);
+  gtk_box_pack_start (GTK_BOX (vbox29), check_print_pageheader, FALSE, FALSE, 0);
+  gtk_tooltips_set_tip (tooltips, check_print_pageheader, _("Adds a little header to every page containing the page number, the filename and the current date(see below). It takes 3 lines of the page."), NULL);
+  gtk_button_set_focus_on_click (GTK_BUTTON (check_print_pageheader), FALSE);
+
+  frame33 = gtk_frame_new (NULL);
+  gtk_widget_show (frame33);
+  gtk_box_pack_start (GTK_BOX (vbox29), frame33, TRUE, TRUE, 0);
+  gtk_frame_set_label_align (GTK_FRAME (frame33), 0, 0);
+  gtk_frame_set_shadow_type (GTK_FRAME (frame33), GTK_SHADOW_NONE);
+
+  alignment36 = gtk_alignment_new (0, 0.5, 1, 1);
+  gtk_widget_show (alignment36);
+  gtk_container_add (GTK_CONTAINER (frame33), alignment36);
+  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment36), 0, 0, 12, 0);
+
+  vbox30 = gtk_vbox_new (FALSE, 1);
+  gtk_widget_show (vbox30);
+  gtk_container_add (GTK_CONTAINER (alignment36), vbox30);
+
+  check_print_basename = gtk_check_button_new_with_mnemonic (_("Use the basename of the printed file"));
+  gtk_widget_show (check_print_basename);
+  gtk_box_pack_start (GTK_BOX (vbox30), check_print_basename, FALSE, FALSE, 0);
+  gtk_tooltips_set_tip (tooltips, check_print_basename, _("Print only the basename(without the path) of the printed file."), NULL);
+  gtk_button_set_focus_on_click (GTK_BUTTON (check_print_basename), FALSE);
+
+  hbox10 = gtk_hbox_new (FALSE, 5);
+  gtk_widget_show (hbox10);
+  gtk_box_pack_start (GTK_BOX (vbox30), hbox10, TRUE, TRUE, 0);
+
+  label203 = gtk_label_new (_("Date format:"));
+  gtk_widget_show (label203);
+  gtk_box_pack_start (GTK_BOX (hbox10), label203, FALSE, FALSE, 0);
+
+  entry_print_dateformat = gtk_entry_new ();
+  gtk_widget_show (entry_print_dateformat);
+  gtk_box_pack_start (GTK_BOX (hbox10), entry_print_dateformat, TRUE, TRUE, 0);
+  gtk_tooltips_set_tip (tooltips, entry_print_dateformat, _("Specify a format for the date and time stamp which is added to the page header on each page. You can use any conversion specifiers which can be used with the ANSI C strftime function."), NULL);
+  gtk_entry_set_invisible_char (GTK_ENTRY (entry_print_dateformat), 9679);
+
+  radio_print_gtk = gtk_radio_button_new_with_mnemonic (NULL, _("Use native GTK printing"));
+  gtk_widget_show (radio_print_gtk);
+  gtk_frame_set_label_widget (GTK_FRAME (frame31), radio_print_gtk);
+  gtk_button_set_focus_on_click (GTK_BUTTON (radio_print_gtk), FALSE);
+  gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_print_gtk), radio_print_external_group);
+  radio_print_external_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_print_gtk));
+
+  label204 = gtk_label_new (_("<i>Notice: Native GTK printing is only available if Geany was built against GTK 2.10 (or above) <b>and</b> Geany is running with GTK 2.10 (or above).</i>"));
+  gtk_widget_show (label204);
+  gtk_box_pack_start (GTK_BOX (vbox27), label204, FALSE, TRUE, 5);
+  gtk_label_set_use_markup (GTK_LABEL (label204), TRUE);
+  gtk_label_set_line_wrap (GTK_LABEL (label204), TRUE);
+  gtk_misc_set_alignment (GTK_MISC (label204), 0.05, 0.5);
+
+  label201 = gtk_label_new (_("Printing"));
+  gtk_widget_show (label201);
+  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook2), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook2), 9), label201);
+
   dialog_action_area3 = GTK_DIALOG (prefs_dialog)->action_area;
   gtk_widget_show (dialog_action_area3);
   gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area3), GTK_BUTTONBOX_END);
@@ -4457,12 +4591,8 @@
   GLADE_HOOKUP_OBJECT (prefs_dialog, frame26, "frame26");
   GLADE_HOOKUP_OBJECT (prefs_dialog, alignment29, "alignment29");
   GLADE_HOOKUP_OBJECT (prefs_dialog, table12, "table12");
-  GLADE_HOOKUP_OBJECT (prefs_dialog, entry_print, "entry_print");
-  GLADE_HOOKUP_OBJECT (prefs_dialog, button_print, "button_print");
-  GLADE_HOOKUP_OBJECT (prefs_dialog, image763, "image763");
-  GLADE_HOOKUP_OBJECT (prefs_dialog, label154, "label154");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, label189, "label189");
   GLADE_HOOKUP_OBJECT (prefs_dialog, entry_contextaction, "entry_contextaction");
-  GLADE_HOOKUP_OBJECT (prefs_dialog, label189, "label189");
   GLADE_HOOKUP_OBJECT (prefs_dialog, button_contextaction, "button_contextaction");
   GLADE_HOOKUP_OBJECT (prefs_dialog, image1919, "image1919");
   GLADE_HOOKUP_OBJECT (prefs_dialog, label193, "label193");
@@ -4495,6 +4625,31 @@
   GLADE_HOOKUP_OBJECT (prefs_dialog, button2, "button2");
   GLADE_HOOKUP_OBJECT (prefs_dialog, label181, "label181");
   GLADE_HOOKUP_OBJECT (prefs_dialog, label151, "label151");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, vbox27, "vbox27");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, frame32, "frame32");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, alignment35, "alignment35");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, hbox9, "hbox9");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, label202, "label202");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, entry_print_external_cmd, "entry_print_external_cmd");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, button_print_external_cmd, "button_print_external_cmd");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, image763, "image763");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, radio_print_external, "radio_print_external");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, frame31, "frame31");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, alignment34, "alignment34");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, vbox29, "vbox29");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, check_print_linenumbers, "check_print_linenumbers");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, check_print_pagenumbers, "check_print_pagenumbers");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, check_print_pageheader, "check_print_pageheader");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, frame33, "frame33");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, alignment36, "alignment36");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, vbox30, "vbox30");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, check_print_basename, "check_print_basename");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, hbox10, "hbox10");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, label203, "label203");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, entry_print_dateformat, "entry_print_dateformat");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, radio_print_gtk, "radio_print_gtk");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, label204, "label204");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, label201, "label201");
   GLADE_HOOKUP_OBJECT_NO_REF (prefs_dialog, dialog_action_area3, "dialog_action_area3");
   GLADE_HOOKUP_OBJECT (prefs_dialog, button3, "button3");
   GLADE_HOOKUP_OBJECT (prefs_dialog, button4, "button4");

Modified: trunk/src/keyfile.c
===================================================================
--- trunk/src/keyfile.c	2007-11-17 13:09:19 UTC (rev 2049)
+++ trunk/src/keyfile.c	2007-11-17 14:04:27 UTC (rev 2050)
@@ -51,6 +51,7 @@
 #include "search.h"
 #include "project.h"
 #include "editor.h"
+#include "printing.h"
 
 
 static gchar *scribble_text = NULL;
@@ -233,10 +234,18 @@
 	g_key_file_set_string(config, "tools", "make_cmd", prefs.tools_make_cmd ? prefs.tools_make_cmd : "");
 	g_key_file_set_string(config, "tools", "term_cmd", prefs.tools_term_cmd ? prefs.tools_term_cmd : "");
 	g_key_file_set_string(config, "tools", "browser_cmd", prefs.tools_browser_cmd ? prefs.tools_browser_cmd : "");
-	g_key_file_set_string(config, "tools", "print_cmd", prefs.tools_print_cmd ? prefs.tools_print_cmd : "");
 	g_key_file_set_string(config, "tools", "grep_cmd", prefs.tools_grep_cmd ? prefs.tools_grep_cmd : "");
 	g_key_file_set_string(config, PACKAGE, "context_action_cmd", prefs.context_action_cmd);
 
+	// printing
+	g_key_file_set_string(config, "printing", "print_cmd", printing_prefs.external_print_cmd ? printing_prefs.external_print_cmd : "");
+	g_key_file_set_boolean(config, "printing", "use_gtk_printing", printing_prefs.use_gtk_printing);
+	g_key_file_set_boolean(config, "printing", "print_line_numbers", printing_prefs.print_line_numbers);
+	g_key_file_set_boolean(config, "printing", "print_page_numbers", printing_prefs.print_page_numbers);
+	g_key_file_set_boolean(config, "printing", "print_page_header", printing_prefs.print_page_header);
+	g_key_file_set_boolean(config, "printing", "page_header_basename", printing_prefs.page_header_basename);
+	g_key_file_set_string(config, "printing", "page_header_datefmt", printing_prefs.page_header_datefmt);
+
 	// VTE
 #ifdef HAVE_VTE
 	g_key_file_set_boolean(config, "VTE", "load_vte", vte_info.load_vte);
@@ -598,6 +607,13 @@
 	prefs.tools_browser_cmd = utils_get_setting_string(config, "tools", "browser_cmd", tmp_string);
 	g_free(tmp_string);
 
+	tmp_string = g_find_program_in_path(GEANY_DEFAULT_TOOLS_GREP);
+	prefs.tools_grep_cmd = utils_get_setting_string(config, "tools", "grep_cmd", tmp_string);
+	g_free(tmp_string);
+
+	prefs.context_action_cmd = utils_get_setting_string(config, PACKAGE, "context_action_cmd", "");
+
+	// printing
 	tmp_string2 = g_find_program_in_path(GEANY_DEFAULT_TOOLS_PRINTCMD);
 #ifdef G_OS_WIN32
 	// single quote paths on Win32 for g_spawn_command_line_async
@@ -605,15 +621,20 @@
 #else
 	tmp_string = g_strconcat(tmp_string2, " %f", NULL);
 #endif
-	prefs.tools_print_cmd = utils_get_setting_string(config, "tools", "print_cmd", tmp_string);
+	printing_prefs.external_print_cmd = utils_get_setting_string(config, "printing", "print_cmd", tmp_string);
 	g_free(tmp_string);
 	g_free(tmp_string2);
 
-	tmp_string = g_find_program_in_path(GEANY_DEFAULT_TOOLS_GREP);
-	prefs.tools_grep_cmd = utils_get_setting_string(config, "tools", "grep_cmd", tmp_string);
-	g_free(tmp_string);
-
-	prefs.context_action_cmd = utils_get_setting_string(config, PACKAGE, "context_action_cmd", "");
+#if GTK_CHECK_VERSION(2, 10, 0)
+	printing_prefs.use_gtk_printing = utils_get_setting_boolean(config, "printing", "use_gtk_printing", TRUE);
+#else
+	printing_prefs.use_gtk_printing = utils_get_setting_boolean(config, "printing", "use_gtk_printing", FALSE);
+#endif
+	printing_prefs.print_line_numbers = utils_get_setting_boolean(config, "printing", "print_line_numbers", TRUE);
+	printing_prefs.print_page_numbers = utils_get_setting_boolean(config, "printing", "print_page_numbers", TRUE);
+	printing_prefs.print_page_header = utils_get_setting_boolean(config, "printing", "print_page_header", TRUE);
+	printing_prefs.page_header_basename = utils_get_setting_boolean(config, "printing", "page_header_basename", FALSE);
+	printing_prefs.page_header_datefmt = utils_get_setting_string(config, "printing", "page_header_datefmt", "%c");
 }
 
 

Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c	2007-11-17 13:09:19 UTC (rev 2049)
+++ trunk/src/main.c	2007-11-17 14:04:27 UTC (rev 2050)
@@ -67,6 +67,7 @@
 #include "tools.h"
 #include "navqueue.h"
 #include "plugins.h"
+#include "printing.h"
 
 #ifdef HAVE_SOCKET
 # include "socket.h"
@@ -293,13 +294,14 @@
 	gtk_menu_item_set_submenu(GTK_MENU_ITEM(ui_widgets.recent_files_menuitem),
 							ui_widgets.recent_files_menubar);
 
-	// store important pointers in the GeanyApp structure
+	// store important pointers for later reference
 	app->toolbar = lookup_widget(app->window, "toolbar1");
 	app->treeview_notebook = lookup_widget(app->window, "notebook3");
 	app->notebook = lookup_widget(app->window, "notebook1");
 	app->statusbar = lookup_widget(app->window, "statusbar");
 	app->popup_menu = create_edit_menu1();
 	ui_widgets.toolbar_menu = create_toolbar_popup_menu1();
+	ui_widgets.print_page_setup = lookup_widget(app->window, "page_setup1");
 	ui_widgets.popup_goto_items[0] = lookup_widget(app->popup_menu, "goto_tag_definition1");
 	ui_widgets.popup_goto_items[1] = lookup_widget(app->popup_menu, "goto_tag_declaration1");
 	ui_widgets.popup_goto_items[2] = lookup_widget(app->popup_menu, "find_usage1");
@@ -328,6 +330,12 @@
 	gtk_widget_set_name(app->window, "GeanyMainWindow");
 	gtk_widget_set_name(ui_widgets.toolbar_menu, "GeanyToolbarMenu");
 	gtk_widget_set_name(app->popup_menu, "GeanyEditMenu");
+
+#if ! GTK_CHECK_VERSION(2, 10, 0)
+	// hide Page setup menu item, it isn't supported with non-GTK printing
+	gtk_widget_hide(ui_widgets.print_page_setup);
+#endif
+
 }
 
 
@@ -825,8 +833,9 @@
 	g_free(prefs.tools_make_cmd);
 	g_free(prefs.tools_term_cmd);
 	g_free(prefs.tools_browser_cmd);
-	g_free(prefs.tools_print_cmd);
 	g_free(prefs.tools_grep_cmd);
+	g_free(printing_prefs.external_print_cmd);
+	g_free(printing_prefs.page_header_datefmt);
 	g_strfreev(ui_prefs.custom_commands);
 	while (! g_queue_is_empty(ui_prefs.recent_queue))
 	{

Modified: trunk/src/makefile.win32
===================================================================
--- trunk/src/makefile.win32	2007-11-17 13:09:19 UTC (rev 2049)
+++ trunk/src/makefile.win32	2007-11-17 14:04:27 UTC (rev 2050)
@@ -36,18 +36,23 @@
 	-L"$(PREFIX)/lib" \
 	-lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lgdi32 \
 	-lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0 -lintl -liconv
-	#-lcairo -lpangocairo-1.0
 	# these things are for GTK >= 2.8
 	# (should be same as with MSYS: pkg-config --libs gtk+-2.0 gthread-2.0)
 	#"$(PREFIX)/lib/libcairo.dll.a" \
 	#"$(PREFIX)/lib/asprintf.lib" \
 	#"$(PREFIX)/lib/charset.lib" \
 
+ifdef GTK210
+PRINTING_LIBS=-lcairo -lpangocairo-1.0
+else
+PRINTING_LIBS=
+endif
+
 CCFLAGS=-Wall -O2 -g -mms-bitfields $(DEFINES) $(INCLUDEDIRS)
 
 OBJS =	about.o build.o callbacks.o dialogs.o document.o editor.o encodings.o filetypes.o \
 		geanyobject.o highlighting.o interface.o keybindings.o keyfile.o main.o msgwindow.o \
-		navqueue.o notebook.o plugins.o prefs.o project.o sciwrappers.o search.o \
+		navqueue.o notebook.o plugins.o prefs.o printing.o project.o sciwrappers.o search.o \
 		socket.o support.o symbols.o templates.o treeviews.o tools.o ui_utils.o utils.o win32.o
 
 .c.o:
@@ -72,7 +77,7 @@
 
 $(TARGET): $(OBJS) $(RES) ../scintilla/scintilla.a ../tagmanager/tagmanager.a
 	$(CXX) $(OBJS) $(RES) -o $(TARGET) \
-	../scintilla/scintilla.a ../tagmanager/tagmanager.a $(ALL_GTK_LIBS) \
+	../scintilla/scintilla.a ../tagmanager/tagmanager.a $(ALL_GTK_LIBS) $(PRINTING_LIBS) \
 	 -mwindows -lkernel32 -limm32 -lshell32 -lole32 -luuid -lcomdlg32 -lcomctl32 -liberty -lwsock32
 
 deps.mak:

Modified: trunk/src/prefs.c
===================================================================
--- trunk/src/prefs.c	2007-11-17 13:09:19 UTC (rev 2049)
+++ trunk/src/prefs.c	2007-11-17 14:04:27 UTC (rev 2050)
@@ -47,6 +47,7 @@
 #include "editor.h"
 #include "main.h"
 #include "treeviews.h"
+#include "printing.h"
 
 #ifdef HAVE_VTE
 # include "vte.h"
@@ -77,6 +78,8 @@
 static void on_use_folding_toggled(GtkToggleButton *togglebutton, gpointer user_data);
 static void on_open_encoding_toggled(GtkToggleButton *togglebutton, gpointer user_data);
 static void on_openfiles_visible_toggled(GtkToggleButton *togglebutton, gpointer user_data);
+static void on_prefs_print_radio_button_toggled(GtkToggleButton *togglebutton, gpointer user_data);
+static void on_prefs_print_page_header_toggled(GtkToggleButton *togglebutton, gpointer user_data);
 
 
 enum
@@ -411,9 +414,6 @@
 	if (prefs.tools_browser_cmd)
 		gtk_entry_set_text(GTK_ENTRY(lookup_widget(ui_widgets.prefs_dialog, "entry_browser")), prefs.tools_browser_cmd);
 
-	if (prefs.tools_print_cmd)
-		gtk_entry_set_text(GTK_ENTRY(lookup_widget(ui_widgets.prefs_dialog, "entry_print")), prefs.tools_print_cmd);
-
 	if (prefs.tools_grep_cmd)
 		gtk_entry_set_text(GTK_ENTRY(lookup_widget(ui_widgets.prefs_dialog, "entry_grep")), prefs.tools_grep_cmd);
 
@@ -438,6 +438,49 @@
 	// Keybindings
 	init_keybindings();
 
+	// Printing
+	{
+		GtkWidget *widget_gtk = lookup_widget(ui_widgets.prefs_dialog, "radio_print_gtk");
+		if (printing_prefs.use_gtk_printing)
+			widget = widget_gtk;
+		else
+			widget = lookup_widget(ui_widgets.prefs_dialog, "radio_print_external");
+
+#if GTK_CHECK_VERSION(2, 10, 0)
+		if (gtk_check_version(2, 10, 0) != NULL)
+#endif
+		{
+			gtk_widget_set_sensitive(widget_gtk, FALSE); // disable the whole option block
+			widget = lookup_widget(ui_widgets.prefs_dialog, "radio_print_external");
+		}
+		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
+
+		on_prefs_print_radio_button_toggled(GTK_TOGGLE_BUTTON(widget_gtk), NULL);
+	}
+	if (printing_prefs.external_print_cmd)
+		gtk_entry_set_text(
+			GTK_ENTRY(lookup_widget(ui_widgets.prefs_dialog, "entry_print_external_cmd")),
+			printing_prefs.external_print_cmd);
+
+	widget = lookup_widget(ui_widgets.prefs_dialog, "check_print_linenumbers");
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), printing_prefs.print_line_numbers);
+
+	widget = lookup_widget(ui_widgets.prefs_dialog, "check_print_pagenumbers");
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), printing_prefs.print_page_numbers);
+
+	widget = lookup_widget(ui_widgets.prefs_dialog, "check_print_pageheader");
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), printing_prefs.print_page_header);
+	on_prefs_print_page_header_toggled(GTK_TOGGLE_BUTTON(widget), NULL);
+
+	widget = lookup_widget(ui_widgets.prefs_dialog, "check_print_basename");
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), printing_prefs.page_header_basename);
+
+	if (printing_prefs.page_header_datefmt)
+		gtk_entry_set_text(
+			GTK_ENTRY(lookup_widget(ui_widgets.prefs_dialog, "entry_print_dateformat")),
+			printing_prefs.page_header_datefmt);
+
+
 #ifndef HAVE_PLUGINS
 	gtk_widget_set_sensitive(lookup_widget(ui_widgets.prefs_dialog, "check_plugins"), FALSE);
 #endif
@@ -748,10 +791,6 @@
 		g_free(prefs.tools_browser_cmd);
 		prefs.tools_browser_cmd = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
 
-		widget = lookup_widget(ui_widgets.prefs_dialog, "entry_print");
-		g_free(prefs.tools_print_cmd);
-		prefs.tools_print_cmd = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
-
 		widget = lookup_widget(ui_widgets.prefs_dialog, "entry_grep");
 		g_free(prefs.tools_grep_cmd);
 		prefs.tools_grep_cmd = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
@@ -782,6 +821,32 @@
 		// Keybindings
 		if (edited) keybindings_write_to_file();
 
+
+		// Printing
+		widget = lookup_widget(ui_widgets.prefs_dialog, "radio_print_gtk");
+		printing_prefs.use_gtk_printing = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+
+		widget = lookup_widget(ui_widgets.prefs_dialog, "entry_print_external_cmd");
+		g_free(printing_prefs.external_print_cmd);
+		printing_prefs.external_print_cmd = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
+
+		widget = lookup_widget(ui_widgets.prefs_dialog, "check_print_linenumbers");
+		printing_prefs.print_line_numbers = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+
+		widget = lookup_widget(ui_widgets.prefs_dialog, "check_print_pagenumbers");
+		printing_prefs.print_page_numbers = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+
+		widget = lookup_widget(ui_widgets.prefs_dialog, "check_print_pageheader");
+		printing_prefs.print_page_header = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+
+		widget = lookup_widget(ui_widgets.prefs_dialog, "check_print_basename");
+		printing_prefs.page_header_basename = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+
+		widget = lookup_widget(ui_widgets.prefs_dialog, "entry_print_dateformat");
+		g_free(printing_prefs.page_header_datefmt);
+		printing_prefs.page_header_datefmt = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
+
+
 #ifdef HAVE_VTE
 		widget = lookup_widget(ui_widgets.prefs_dialog, "check_vte");
 		vte_info.load_vte = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
@@ -1198,6 +1263,24 @@
 }
 
 
+static void on_prefs_print_radio_button_toggled(GtkToggleButton *togglebutton, gpointer user_data)
+{
+	gboolean sens = gtk_toggle_button_get_active(togglebutton);
+
+	gtk_widget_set_sensitive(lookup_widget(ui_widgets.prefs_dialog, "vbox29"), sens);
+	gtk_widget_set_sensitive(lookup_widget(ui_widgets.prefs_dialog, "hbox9"), ! sens);
+}
+
+
+static void on_prefs_print_page_header_toggled(GtkToggleButton *togglebutton, gpointer user_data)
+{
+	gboolean sens = gtk_toggle_button_get_active(togglebutton);
+
+	gtk_widget_set_sensitive(lookup_widget(ui_widgets.prefs_dialog, "check_print_basename"), sens);
+	gtk_widget_set_sensitive(lookup_widget(ui_widgets.prefs_dialog, "entry_print_dateformat"), sens);
+}
+
+
 void prefs_show_dialog(void)
 {
 	if (ui_widgets.prefs_dialog == NULL)
@@ -1254,11 +1337,19 @@
 				"clicked", G_CALLBACK(on_prefs_tools_button_clicked), lookup_widget(ui_widgets.prefs_dialog, "entry_grep"));
 
 		// tools commands
-		g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "button_print"),
-				"clicked", G_CALLBACK(on_prefs_tools_button_clicked), lookup_widget(ui_widgets.prefs_dialog, "entry_print"));
 		g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "button_contextaction"),
-				"clicked", G_CALLBACK(on_prefs_tools_button_clicked), lookup_widget(ui_widgets.prefs_dialog, "entry_contextaction"));
+			"clicked", G_CALLBACK(on_prefs_tools_button_clicked), lookup_widget(ui_widgets.prefs_dialog, "entry_contextaction"));
+		g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "button_contextaction"),
+			"clicked", G_CALLBACK(on_prefs_tools_button_clicked), lookup_widget(ui_widgets.prefs_dialog, "entry_contextaction"));
 
+		// printing
+		g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "button_print_external_cmd"),
+			"clicked", G_CALLBACK(on_prefs_tools_button_clicked), lookup_widget(ui_widgets.prefs_dialog, "entry_print_external_cmd"));
+		g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "radio_print_gtk"),
+			"toggled", G_CALLBACK(on_prefs_print_radio_button_toggled), NULL);
+		g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "check_print_pageheader"),
+			"toggled", G_CALLBACK(on_prefs_print_page_header_toggled), NULL);
+
 		g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "check_toolbar_show"),
 				"toggled", G_CALLBACK(on_toolbar_show_toggled), NULL);
 		g_signal_connect((gpointer) lookup_widget(ui_widgets.prefs_dialog, "check_show_notebook_tabs"),

Modified: trunk/src/prefs.h
===================================================================
--- trunk/src/prefs.h	2007-11-17 13:09:19 UTC (rev 2049)
+++ trunk/src/prefs.h	2007-11-17 14:04:27 UTC (rev 2050)
@@ -25,7 +25,7 @@
 #define GEANY_PREFS_H 1
 
 /* Preferences dialog settings.
- * (See also EditorPrefs in editor.h).
+ * (See also EditorPrefs in editor.h and PrintingPrefs in printing.h).
  * Remember to increment abi_version in plugindata.h when changing items. */
 typedef struct GeanyPrefs
 {
@@ -82,7 +82,7 @@
 	gchar			*tools_browser_cmd;
 	gchar			*tools_make_cmd;
 	gchar			*tools_term_cmd;
-	gchar			*tools_print_cmd;
+	gchar			*tools_print_cmd; /// TODO unused: remove this at next abi_verison change
 	gchar			*tools_grep_cmd;
 	gchar			*context_action_cmd;
 

Added: trunk/src/printing.c
===================================================================
--- trunk/src/printing.c	                        (rev 0)
+++ trunk/src/printing.c	2007-11-17 14:04:27 UTC (rev 2050)
@@ -0,0 +1,839 @@
+/*
+ *      printing.c - this file is part of Geany, a fast and lightweight IDE
+ *
+ *      Copyright 2007 Enrico Tröger <enrico.troeger at uvena.de>
+ *      Copyright 2007 Nick Treleaven <nick.treleaven at btinternet.com>
+ *
+ *      This program is free software; you can redistribute it and/or modify
+ *      it under the terms of the GNU General Public License as published by
+ *      the Free Software Foundation; either version 2 of the License, or
+ *      (at your option) any later version.
+ *
+ *      This program 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 General Public License for more details.
+ *
+ *      You should have received a copy of the GNU General Public License
+ *      along with this program; if not, write to the Free Software
+ *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $Id$
+ */
+
+
+/*
+ * GTK 2.10 printing support
+ * (basic code layout were adopted from Sylpheed's printing implementation, thanks)
+ */
+
+#include <math.h>
+#include <time.h>
+#include <string.h>
+
+#include "geany.h"
+#include "printing.h"
+#include "prefs.h"
+#include "document.h"
+#include "sciwrappers.h"
+#include "editor.h"
+#include "sciwrappers.h"
+#include "utils.h"
+#include "support.h"
+#include "dialogs.h"
+#include "utils.h"
+#include "msgwindow.h"
+
+
+PrintingPrefs printing_prefs;
+
+
+#if GTK_CHECK_VERSION(2, 10, 0)
+
+
+#define ROTATE_RGB(color) \
+	(((color) & 0xFF0000) >> 16) + ((color) & 0x00FF00) + (((color) & 0x0000FF) << 16)
+#define ADD_ATTR(l, a) \
+	pango_attr_list_insert((l), (a)); \
+	(a)->start_index = 0; \
+	(a)->end_index = -1;
+
+
+enum
+{
+	FORE = 0,
+	BACK,
+	BOLD,
+	ITALIC,
+	MAX_TYPES
+};
+
+
+// document-related variables
+typedef struct
+{
+	gint idx;
+	gint font_width;
+	gint lines;
+	gint n_pages;
+	gint lines_per_page;
+	gint max_line_number_margin;
+	gint cur_line;
+	gint cur_pos;
+	gint styles[STYLE_MAX + 1][MAX_TYPES];
+	gdouble line_height;
+	gboolean long_line; // whether we have a wrapped line on page end to take care of on next page

@@ Diff output truncated at 100000 characters. @@

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list