Mario,
My comments are below:
On Mon, 2005-08-29 at 14:45 +0200, Mario Sopena wrote:
> Hello,
>
> On 8/28/05, Rafael Ferreira <[EMAIL PROTECTED]> wrote:
> > Hey everyone,
> >
> > This patch creates a basic infrastructure for printing in monodoc. The
> > patch is composed of:
> >
> > * docbrowser.patch - Minor changes to browser.cs / browser.glade to add
> > printing support
> > * IPrintManager.cs - Printing interface to allow for different printing
> > back ends
> > * GtkHTMLPrintManager.cs - GtkHtml implementation of IPrintManager.cs
>
> It's better to integrate everything in the patch file (just my
> opinion). Just use svn add file_name for adding those .cs files and
> then, when you make the patch, svn will integrate them. For the
> Changelog, label the new files with the word added, so everyone will
> know that file was added at that point (look at the other entries in
> the Changelog).
Fixed. I didn't know I could do a "svn add" while in anonymous svn mode.
I also updated the Changelog, let me know if it looks any better.
>
> Also, the diff to the glade file shows you are including a lots of things
> like:
>
> +name="ellipsize">PANGO_ELLIPSIZE_NONE
> + -1
> + False
> + 0
>
> that are probably automatically added by glade but are not necessary,
> so try to leave them out. You have also some changes to some icons or
> images..are those necessary? Can you explain why?
I have no clue what those "ellipsize" glade tags are. I played around
with glade for a while to see if I could remove those with no luck.
Aside from manually editing the xml I have no idea how to make them go
away. But to answer your question, the only other change I made to this
file (besides adding the gtk-stock-print menu item) is to enforce that
the About menu item is using the gtk-stock-about icon. Originally
FC4/Clearlooks was having problems saving the glade file because it
could not find the About icon.
Let me know what you think,
- raf
>
> Mario
>
> >
> > Currently the GtkHtml implementation is fully functional in all of its
> > css-less glory. The lack of css support will cause the printed html to
> > not look identical to the "on-screen" html if the user is using the
> > gecko rendering engine. This can be easily corrected/improved by
> > implementing a Gecko based print manager once gecko-sharp catches up to
> > printing.
> >
> > As always, feedback is appreciated.
> >
> > - raf
> >
> >
> >
> >
> >
> >
> > ___
> > Mono-docs-list maillist - Mono-docs-list@lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-docs-list
> >
> >
> >
> >
>
Index: GtkHTMLPrintManager.cs
===
--- GtkHTMLPrintManager.cs (revision 0)
+++ GtkHTMLPrintManager.cs (revision 0)
@@ -0,0 +1,56 @@
+//
+// GtkHTMLPrintManager.cs: Handles monodoc printing on Gnome using GtkHTML
+// Author:
+// Rafael Ferreira <[EMAIL PROTECTED]>
+//
+// (C) 2005 Rafael Ferreira
+//
+namespace Monodoc {
+ using System;
+ using Gtk;
+ using Gnome;
+
+ public class GtkHTMLPrintManager : IPrintManager {
+ public void Print(string Html, string Css, string Caption) {
+
+ if (Html == null) {
+Console.WriteLine("empty print");
+return;
+ }
+
+ if (Caption==null)
+Caption="Monodoc Printing";
+
+ PrintJob pj = new PrintJob (PrintConfig.Default ());
+ PrintDialog dialog = new PrintDialog (pj, Caption, 0);
+
+ Gtk.HTML gtk_html = new Gtk.HTML(Html);
+ gtk_html.PrintSetMaster(pj);
+
+ 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;
+ }
+ }
+}
Index: browser.cs
===
--- browser.cs (revision 48356)
+++ browser.cs (working copy)
@@ -167,7 +167,10 @@
this.Url = url;
}
}
+ // handles printing
+ IPrintManager print_manager = null;
+
public ArrayList bookList;
public Browser (bool UseGecko)
@@ -230,6 +233,9 @@
bookList = new ArrayList ();
index_browser = IndexBrowser.MakeIndexBrowser (this);
+
+ // print manager logic
+ print_manager = (IPrintManager) new GtkHTMLPrintManager();
AddTab();
MainWindow.ShowAll();
@@ -489,6 +495,12 @@
{
Application.Quit ();
}
+
+ void on_print_activate (object sender, EventArgs e) {
+ Node n;
+ // sending Html to the printed.
+ print_manager.Print(help_tree.RenderUrl (CurrentUrl, out n),null,n.Caption);
+ }
void OnCommentsActivate