[Mono-docs-list] monodoc and gtkmozembed
John Luke
jluke@cfl.rr.com
25 Jun 2003 15:33:01 -0400
--=-n+0vgrnzuFP5SvZ7gbx5
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Hello,
Here is a patch to use gtkmozembed instead of gtkhtml in monodoc
intended for possible inclusion after the next release. However, gecko
converts URI's like T:System.String to t:System.String and breaks the
links. I tried to make it case insensitive but couldn't get it to work,
perhaps the xsl currently only looks for upper case?
Also, I was not sure if you wanted it to replace gtkhtml, or does it
need to allow for using either.
Last, I am using this with the mozilla version shipped with XD2, except
I have to add /usr/lib/mozilla-1.3.1 to LD_LIBRARY_CONFIG for
gtkmozembed# to work (/usr/lib/mozilla-1.3.1/TestGtkEmbed will not work
without doing this either).
Thanks,
John Luke
--=-n+0vgrnzuFP5SvZ7gbx5
Content-Disposition: attachment; filename=monodoc-moz.diff
Content-Type: text/plain; name=monodoc-moz.diff; charset=UTF-8
Content-Transfer-Encoding: 7bit
? menusupport.diff
? monodoc-icon.patch
? monodoc-moz.diff
? removemenus.diff
? browser/browser.gladep
Index: browser/ChangeLog
===================================================================
RCS file: /cvs/public/monodoc/browser/ChangeLog,v
retrieving revision 1.38
diff -u -r1.38 ChangeLog
--- browser/ChangeLog 25 Jun 2003 19:14:31 -0000 1.38
+++ browser/ChangeLog 25 Jun 2003 19:25:26 -0000
@@ -1,3 +1,7 @@
+2003-06-25 John Luke <jluke@cfl.rr.com>
+ * browser.cs: use GtkMozEmbed instead of gtkhtml
+ * Makefile.am: reference GtkMozEmbed
+
2003-06-25 Duncan Mak <duncan@ximian.com>
* Makefile.am: Add 'monodoc.png' to EXTRA_DIST and also as
@@ -6,7 +10,6 @@
* browser.cs: Set the window icon of MainWindow to 'monodoc.png'.
2003-06-23 John Luke <jluke@cfl.rr.com>
-
* browser.cs: switch to new treeview style
2003-06-23 Miguel de Icaza <miguel@ximian.com>
Index: browser/Makefile.am
===================================================================
RCS file: /cvs/public/monodoc/browser/Makefile.am,v
retrieving revision 1.15
diff -u -r1.15 Makefile.am
--- browser/Makefile.am 25 Jun 2003 19:14:31 -0000 1.15
+++ browser/Makefile.am 25 Jun 2003 19:25:27 -0000
@@ -6,7 +6,13 @@
assembler_sources = $(srcdir)/assembler.cs $(shared_sources)
dump_sources = $(srcdir)/dump.cs $(shared_sources)
browser_sources = $(srcdir)/browser.cs $(srcdir)/list.cs $(srcdir)/history.cs $(shared_sources)
-browser_assemblies = -r:gtk-sharp.dll -r:glade-sharp.dll -r:glib-sharp.dll -r:ICSharpCode.SharpZipLib.dll -r:pango-sharp.dll -r:gdk-sharp.dll
+browser_assemblies = -r:gtk-sharp.dll \
+ -r:glade-sharp.dll \
+ -r:glib-sharp.dll \
+ -r:ICSharpCode.SharpZipLib.dll \
+ -r:pango-sharp.dll \
+ -r:gdk-sharp.dll \
+ -r:gtkmozembed-sharp.dll
EXTRA_DIST = $(assembler_sources) $(dump_sources) $(browser_sources) browser.glade monodoc.xml mono-ecma.xsl monodoc.png
Index: browser/browser.cs
===================================================================
RCS file: /cvs/public/monodoc/browser/browser.cs,v
retrieving revision 1.30
diff -u -r1.30 browser.cs
--- browser/browser.cs 25 Jun 2003 19:14:31 -0000 1.30
+++ browser/browser.cs 25 Jun 2003 19:25:27 -0000
@@ -14,6 +14,8 @@
//
using Gtk;
using GtkSharp;
+using GtkMozEmbed;
+using GtkMozEmbedSharp;
using Glade;
using System;
using System.IO;
@@ -59,12 +61,10 @@
}
}
- Application.Init ();
- Browser browser = new Browser ();
-
+
+ Browser browser = new Browser (args);
if (args.Length > 0)
browser.LoadUrl (topic);
- Application.Run ();
return 0;
}
@@ -79,7 +79,7 @@
public History history;
- HTML html;
+ EmbedWidget html;
TreeBrowser tree_browser;
RootTree help_tree;
@@ -96,8 +96,10 @@
BigList match_list;
IndexEntry current_entry = null;
- Browser ()
+ Browser (string[] args)
{
+ Application.Init ();
+
ui = new Glade.XML (null, "browser.glade", "window1", null);
ui.Autoconnect (this);
@@ -112,17 +114,19 @@
help_tree = RootTree.LoadTree ();
tree_browser = new TreeBrowser (help_tree, reference_tree, this);
- html = new HTML ();
+ html = new EmbedWidget ("/tmp/monodoc", "MonoDoc");
html.Show ();
- html_container.Add (html);
- html.LinkClicked += new LinkClickedHandler (LinkClicked);
- html.OnUrl += new OnUrlHandler (OnUrl);
- html.UrlRequested += new UrlRequestedHandler (UrlRequested);
+ html_container.AddWithViewport (html);
+ html.OpenUri += new OpenUriHandler (LinkClicked);
+ html.LinkMessage += new EventHandler (OnUrl);
+
context_id = statusbar.GetContextId ("");
history = new History (back_button, forward_button);
SetupIndex ();
+
+ Application.Run ();
}
Stream GetResourceImage (string name)
@@ -171,9 +175,15 @@
}
}
- void LinkClicked (object o, LinkClickedArgs args)
+ void LinkClicked (object o, OpenUriArgs args)
{
- LoadUrl (args.Url);
+ LoadUrl (args.AURI);
+ // Mozilla needs a TRUE return value here.
+ // This stops Gecko from processing the URI
+ // Note, this needs fixing. Should return a bool
+ // type, not an int. Argh!
+ SignalArgs sa = (SignalArgs) args;
+ sa.RetVal = 1;
}
public void LoadUrl (string url)
@@ -181,7 +191,7 @@
if (url.StartsWith("#"))
{
// FIXME: This doesn't deal with whether anchor jumps should go in the history
- html.JumpToAnchor(url.Substring(1));
+ //html.JumpToAnchor(url.Substring(1));
return;
}
@@ -212,11 +222,14 @@
//
public void Render (string text, Node matched_node, string url)
{
- Gtk.HTMLStream stream = html.BeginContent ("text/html");
+ string hdr = "<html><title></title><body>";
+ string ftr = "</body></html>";
- stream.Write ("<html><body>");
- stream.Write (text);
- stream.Write ("</body></html>");
+ html.OpenStream("file://", "text/html");
+ html.AppendData(hdr, (uint)hdr.Length);
+ html.AppendData(text, (uint)text.Length);
+ html.AppendData(ftr, (uint)ftr.Length);
+ html.CloseStream();
if (matched_node == null){
Console.Error.WriteLine ("[{0}] No matching node", url);
@@ -231,9 +244,9 @@
// Invoked when the mouse is over a link
//
string last_url = "";
- void OnUrl (object o, OnUrlArgs args)
+ void OnUrl (object o, EventArgs args)
{
- string new_url = args.Url;
+ string new_url = html.GeckoLinkMessage;
if (new_url == null)
new_url = "";
--=-n+0vgrnzuFP5SvZ7gbx5--