Author: mkestner
Date: 2007-11-08 17:56:32 -0500 (Thu, 08 Nov 2007)
New Revision: 89284
Added:
trunk/mono-tools/docbrowser/PrintManager.cs
Modified:
trunk/mono-tools/ChangeLog
trunk/mono-tools/configure.in
trunk/mono-tools/docbrowser/ChangeLog
trunk/mono-tools/docbrowser/GeckoHtmlRender.cs
trunk/mono-tools/docbrowser/GtkHtmlHtmlRender.cs
trunk/mono-tools/docbrowser/Makefile.am
Log:
2007-11-08 Mike Kestner <[EMAIL PROTECTED]>
* configure.in: configure checks for gtkhtml-sharp-3.14
with fallback to 2.0.
2007-11-08 Mike Kestner <[EMAIL PROTECTED]>
* PrintManager.cs: extracted existing duplicated print
code from the two renderers and put it here, along with a
new Gtk.Print based implementation for gtkhtml-sharp 3.14
and beyond.
* GeckoHtmlRender.cs: refactor to use PrintManager.
* GtkHtmlHtmlRender.cs : ditto.
* Makefile.am : add some gtkhtml library install magic.
Modified: trunk/mono-tools/ChangeLog
===================================================================
--- trunk/mono-tools/ChangeLog 2007-11-08 22:56:23 UTC (rev 89283)
+++ trunk/mono-tools/ChangeLog 2007-11-08 22:56:32 UTC (rev 89284)
@@ -1,3 +1,8 @@
+2007-11-08 Mike Kestner <[EMAIL PROTECTED]>
+
+ * configure.in: configure checks for gtkhtml-sharp-3.14
+ with fallback to 2.0.
+
2007-04-19 Wade Berrier <[EMAIL PROTECTED]>
* configure.in: version bump -> 1.2.4
Modified: trunk/mono-tools/configure.in
===================================================================
--- trunk/mono-tools/configure.in 2007-11-08 22:56:23 UTC (rev 89283)
+++ trunk/mono-tools/configure.in 2007-11-08 22:56:32 UTC (rev 89284)
@@ -42,11 +42,20 @@
AC_SUBST(GTK_SHARP_LIBS)
+PKG_CHECK_MODULES(GTKHTML_SHARP, gtkhtml-sharp-3.14, enable_gtkhtml=yes,
enable_gtkhtml=no)
+if test "x$enable_gtkhtml" = "xyes"; then
+GTKHTMLDLLCOPY=`pkg-config --variable=Libraries gtkhtml-sharp-3.14`
+CSHARP_FLAGS="-d:GTKHTML_SHARP_3_14"
+else
PKG_CHECK_MODULES(GTKHTML_SHARP, gtkhtml-sharp-2.0, enable_gtkhtml=yes,
enable_gtkhtml=no)
+CSHARP_FLAGS=
+GTKHTMLDLLCOPY=
+fi
AC_SUBST(GTKHTML_SHARP_LIBS)
+AC_SUBST(GTKHTMLDLLCOPY)
+AC_SUBST(CSHARP_FLAGS)
AM_CONDITIONAL(ENABLE_GTKHTML, test "x$enable_gtkhtml" = "xyes")
-
PKG_CHECK_MODULES(GECKO_SHARP, gecko-sharp-2.0, enable_gecko=yes,
enable_gecko=no)
AC_SUBST(GECKO_SHARP_LIBS)
AM_CONDITIONAL(ENABLE_GECKO, test "x$enable_gecko" = "xyes")
Modified: trunk/mono-tools/docbrowser/ChangeLog
===================================================================
--- trunk/mono-tools/docbrowser/ChangeLog 2007-11-08 22:56:23 UTC (rev
89283)
+++ trunk/mono-tools/docbrowser/ChangeLog 2007-11-08 22:56:32 UTC (rev
89284)
@@ -1,3 +1,13 @@
+2007-11-08 Mike Kestner <[EMAIL PROTECTED]>
+
+ * PrintManager.cs: extracted existing duplicated print
+ code from the two renderers and put it here, along with a
+ new Gtk.Print based implementation for gtkhtml-sharp 3.14
+ and beyond.
+ * GeckoHtmlRender.cs: refactor to use PrintManager.
+ * GtkHtmlHtmlRender.cs : ditto.
+ * Makefile.am : add some gtkhtml library install magic.
+
2007-10-01 Raja R Harinath <[EMAIL PROTECTED]>
* Makefile.am (browser_sources): Move AssemblyInfo.cs ...
Modified: trunk/mono-tools/docbrowser/GeckoHtmlRender.cs
===================================================================
--- trunk/mono-tools/docbrowser/GeckoHtmlRender.cs 2007-11-08 22:56:23 UTC
(rev 89283)
+++ trunk/mono-tools/docbrowser/GeckoHtmlRender.cs 2007-11-08 22:56:32 UTC
(rev 89284)
@@ -182,7 +182,9 @@
}
Console.WriteLine ("XXXX");
-#if !USE_GTKHTML_PRINT
+#if USE_GTKHTML_PRINT
+ PrintManager.Print (Html);
+#else
MessageDialog md = new MessageDialog (null,
DialogFlags.DestroyWithParent,
MessageType.Error,
@@ -190,37 +192,6 @@
int result = md.Run ();
md.Destroy();
-#else
- string Caption = "Monodoc Printing";
-
- Gnome.PrintJob pj = new Gnome.PrintJob (PrintConfig.Default ());
- PrintDialog dialog = new PrintDialog (pj, Caption, 0);
-
- Gtk.HTML gtk_html = new Gtk.HTML (Html);
- gtk_html.PrintSetMaster (pj);
-
- Gnome.PrintContext ctx = pj.Context;
- gtk_html.Print (ctx);
-
- pj.Close ();
-
- // hello user
- int response = dialog.Run ();
-
- if (response == (int) PrintButtons.Cancel) {
- dialog.Hide ();
- dialog.Dispose ();
- return;
- } else if (response == (int) PrintButtons.Print) {
- pj.Print ();
- } else if (response == (int) PrintButtons.Preview) {
- new PrintJobPreview (pj, Caption).Show ();
- }
-
- ctx.Close ();
- dialog.Hide ();
- dialog.Dispose ();
- return;
#endif
}
}
Modified: trunk/mono-tools/docbrowser/GtkHtmlHtmlRender.cs
===================================================================
--- trunk/mono-tools/docbrowser/GtkHtmlHtmlRender.cs 2007-11-08 22:56:23 UTC
(rev 89283)
+++ trunk/mono-tools/docbrowser/GtkHtmlHtmlRender.cs 2007-11-08 22:56:32 UTC
(rev 89284)
@@ -106,36 +106,7 @@
return;
}
- string Caption = "Monodoc Printing";
-
- Gnome.PrintJob pj = new Gnome.PrintJob (PrintConfig.Default ());
- PrintDialog dialog = new PrintDialog (pj, Caption, 0);
-
- Gtk.HTML gtk_html = new Gtk.HTML (Html);
- gtk_html.PrintSetMaster (pj);
-
- Gnome.PrintContext ctx = pj.Context;
- gtk_html.Print (ctx);
-
- pj.Close ();
-
- // hello user
- int response = dialog.Run ();
-
- if (response == (int) PrintButtons.Cancel) {
- dialog.Hide ();
- dialog.Dispose ();
- return;
- } else if (response == (int) PrintButtons.Print) {
- pj.Print ();
- } else if (response == (int) PrintButtons.Preview) {
- new PrintJobPreview (pj, Caption).Show ();
- }
-
- ctx.Close ();
- dialog.Hide ();
- dialog.Dispose ();
- return;
+ PrintManager.Print (Html);
}
}
}
Modified: trunk/mono-tools/docbrowser/Makefile.am
===================================================================
--- trunk/mono-tools/docbrowser/Makefile.am 2007-11-08 22:56:23 UTC (rev
89283)
+++ trunk/mono-tools/docbrowser/Makefile.am 2007-11-08 22:56:32 UTC (rev
89284)
@@ -12,7 +12,7 @@
endif
CLEANFILES = browser.exe browser.exe.mdb admin.exe admin.exe.mdb
$(GECKO_TARGET) $(GECKO_TARGET).mdb $(GTKHTML_TARGET) $(GTKHTML_TARGET).mdb
monodoc.desktop
-monodoc_DATA = browser.exe $(GECKO_TARGET) $(GTKHTML_TARGET)
+monodoc_DATA = browser.exe $(GECKO_TARGET) $(GTKHTML_TARGET) $(GTKHTMLDLLCOPY)
DISTCLEANFILES = AssemblyInfo.cs monodoc.desktop monodoc
@@ -31,10 +31,12 @@
browser_built_sources = AssemblyInfo.cs
-geckorender_sources = \
+geckorender_sources = \
+ $(srcdir)/PrintManager.cs \
$(srcdir)/GeckoHtmlRender.cs
-gtkhtmlrender_sources = \
+gtkhtmlrender_sources = \
+ $(srcdir)/PrintManager.cs \
$(srcdir)/GtkHtmlHtmlRender.cs
admin_sources = \
@@ -68,10 +70,10 @@
$(MCS) -debug -out:browser.exe $(browser_sources)
$(browser_built_sources) -resource:$(srcdir)/monodoc.png,monodoc.png
-resource:$(srcdir)/browser.glade,browser.glade $(browser_assemblies)
GeckoHtmlRender.dll : $(geckorender_sources) browser.exe
- $(MCS) -debug -target:library -out:$@ $(geckorender_sources)
$(geckorender_assemblies) $(GECKO_PRINTING_DEF)
+ $(MCS) -debug -target:library -out:$@ $(geckorender_sources)
$(geckorender_assemblies) $(GECKO_PRINTING_DEF) $(CSHARP_FLAGS)
GtkHtmlHtmlRender.dll : $(gtkhtmlrender_sources) browser.exe
- $(MCS) -debug -target:library -out:$@ $(gtkhtmlrender_sources)
$(gtkhtmlrender_assemblies)
+ $(MCS) -debug -target:library -out:$@ $(gtkhtmlrender_sources)
$(gtkhtmlrender_assemblies) $(CSHARP_FLAGS)
b: browser.exe
MONO_PATH=. $(RUNTIME) --debug browser.exe
Added: trunk/mono-tools/docbrowser/PrintManager.cs
===================================================================
--- trunk/mono-tools/docbrowser/PrintManager.cs 2007-11-08 22:56:23 UTC (rev
89283)
+++ trunk/mono-tools/docbrowser/PrintManager.cs 2007-11-08 22:56:32 UTC (rev
89284)
@@ -0,0 +1,59 @@
+//
+//
+// PrintManager.cs: GtkHTML version dependent printing support.
+//
+// Authors: Mario Sopena
+// Rafael Ferreira <[EMAIL PROTECTED]>
+// Mike Kestner <[EMAIL PROTECTED]>
+//
+
+using System;
+using Gtk;
+using Gnome;
+
+namespace Monodoc {
+ class PrintManager {
+
+#if GTKHTML_SHARP_3_14
+ public static void Print (string html)
+ {
+ new Gtk.HTML (html).PrintOperationRun (new
PrintOperation (), PrintOperationAction.PrintDialog, null, null, null, null,
null);
+ }
+#else
+ // Fallback to the original GNOME Print API.
+ public static void Print (string html)
+ {
+ string caption = "Monodoc Printing";
+
+ Gnome.PrintJob pj = new Gnome.PrintJob
(PrintConfig.Default ());
+ PrintDialog dialog = new PrintDialog (pj, caption, 0);
+
+ Gtk.HTML gtk_html = new Gtk.HTML (html);
+ gtk_html.PrintSetMaster (pj);
+
+ Gnome.PrintContext ctx = pj.Context;
+ gtk_html.Print (ctx);
+
+ pj.Close ();
+
+ // hello user
+ int response = dialog.Run ();
+
+ if (response == (int) PrintButtons.Cancel) {
+ dialog.Hide ();
+ dialog.Destroy ();
+ return;
+ } else if (response == (int) PrintButtons.Print) {
+ pj.Print ();
+ } else if (response == (int) PrintButtons.Preview) {
+ new PrintJobPreview (pj, caption).Show ();
+ }
+
+ ctx.Close ();
+ dialog.Hide ();
+ dialog.Destroy ();
+ }
+#endif
+ }
+}
+
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches