[Monodevelop-patches-list] r1149 - in trunk/MonoDevelop: build/AddIns src/Main/Base src/Main/Base/Gui/Pads/HelpBrowser src/Main/Base/Services

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Thu Mar 11 17:24:22 EST 2004


Author: tberman
Date: 2004-03-11 17:24:22 -0500 (Thu, 11 Mar 2004)
New Revision: 1149

Added:
   trunk/MonoDevelop/src/Main/Base/Services/MonodocService.cs
Modified:
   trunk/MonoDevelop/build/AddIns/SharpDevelopCore.addin
   trunk/MonoDevelop/src/Main/Base/Gui/Pads/HelpBrowser/HelpViewer.cs
   trunk/MonoDevelop/src/Main/Base/Gui/Pads/HelpBrowser/MonodocTreePad.cs
   trunk/MonoDevelop/src/Main/Base/Makefile.am
Log:
now you can click on links and they work properly.


Modified: trunk/MonoDevelop/build/AddIns/SharpDevelopCore.addin
===================================================================
--- trunk/MonoDevelop/build/AddIns/SharpDevelopCore.addin	2004-03-11 21:50:12 UTC (rev 1148)
+++ trunk/MonoDevelop/build/AddIns/SharpDevelopCore.addin	2004-03-11 22:24:22 UTC (rev 1149)
@@ -32,6 +32,8 @@
 	<Extension path = "/Workspace/Services">
 		<Class id    = "DebuggingService"
 		       class = "MonoDevelop.Services.DebuggingService"/>
+		<Class id    = "MonodocService"
+		       class = "MonoDevelop.Services.MonodocService"/>
 		<Class id    = "ProjectService"
 		       class = "MonoDevelop.Services.DefaultProjectService"/>
 		<Class id    = "FileService"

Modified: trunk/MonoDevelop/src/Main/Base/Gui/Pads/HelpBrowser/HelpViewer.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Pads/HelpBrowser/HelpViewer.cs	2004-03-11 21:50:12 UTC (rev 1148)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Pads/HelpBrowser/HelpViewer.cs	2004-03-11 22:24:22 UTC (rev 1149)
@@ -1,9 +1,12 @@
 using System;
+using System.IO;
 
 using Gtk;
 using Monodoc;
 
 using MonoDevelop.Gui;
+using MonoDevelop.Core.Services;
+using MonoDevelop.Services;
 
 namespace MonoDevelop.Gui
 {
@@ -16,6 +19,8 @@
 
 		ScrolledWindow scroller = new ScrolledWindow ();
 
+		MonodocService mds;
+
 		public override Gtk.Widget Control {
 			get { return scroller; }
 		}
@@ -26,24 +31,27 @@
 
 		public HelpViewer ()
 		{
-	                //html_viewer.LinkClicked += new LinkClickedHandler (LinkClicked);
-	                //html_viewer.UrlRequested += new UrlRequestedHandler (UrlRequested);
+
+			mds = (MonodocService)ServiceManager.Services.GetService (typeof (MonodocService));
+	
+	                html_viewer.LinkClicked += new LinkClickedHandler (LinkClicked);
+	                html_viewer.UrlRequested += new UrlRequestedHandler (UrlRequested);
 			scroller.Add (html_viewer);
 		}
 
-		/*void UrlRequested (object sender, UrlRequestedArgs args)
+		void UrlRequested (object sender, UrlRequestedArgs args)
 		{
 			Console.WriteLine ("Image requested: " + args.Url);
-			Stream s = help_tree.GetImage (args.Url);
+			Stream s = mds.HelpTree.GetImage (args.Url);
 			
-			if (s == null)
+			/*if (s == null)
 				s = GetResourceImage ("monodoc.png");
 				byte [] buffer = new byte [8192];
 				int n;
 
 				while ((n = s.Read (buffer, 0, 8192)) != 0) {
 				args.Handle.Write (buffer, n);
-			}
+			}*/
 			args.Handle.Close (HTMLStreamStatus.Ok);
 		}
 
@@ -62,11 +70,11 @@
 
 			Node node;
 			
-			string res = help_tree.RenderUrl (url, out node);
+			string res = mds.HelpTree.RenderUrl (url, out node);
 			if (res != null) {
 				Render (res, node, url);
 			}
-                }*/
+                }
 
         	public void Render (string text, Node matched_node, string url)
         	{

Modified: trunk/MonoDevelop/src/Main/Base/Gui/Pads/HelpBrowser/MonodocTreePad.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Pads/HelpBrowser/MonodocTreePad.cs	2004-03-11 21:50:12 UTC (rev 1148)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Pads/HelpBrowser/MonodocTreePad.cs	2004-03-11 22:24:22 UTC (rev 1149)
@@ -13,38 +13,36 @@
 
 using MonoDevelop.Gui;
 
+using MonoDevelop.Core.Services;
+using MonoDevelop.Services;
+
 namespace MonoDevelop.Gui.Pads
 {
 
 	public class HelpTree : AbstractPadContent
 	{
+
+		MonodocService mds;
 	
-		RootTree root_tree;
 		TreeStore store;
 		TreeView  tree_view;
 
 		ScrolledWindow scroller;
 
 		TreeIter root_iter;
-		Hashtable iter_to_node;
-		Hashtable node_to_iter;
-		Hashtable node_parent;
 	
 		public HelpTree () : base ("Help", Gtk.Stock.Help)
 		{
-			root_tree = RootTree.LoadTree ();
+
+			mds = (MonodocService)ServiceManager.Services.GetService (typeof (MonodocService));
 			tree_view = new TreeView ();
 
-			iter_to_node = new Hashtable ();
-			node_to_iter = new Hashtable ();
-			node_parent  = new Hashtable ();
-
 			tree_view.AppendColumn ("name_col", new CellRendererText (), "text", 0);
 	                tree_view.RowExpanded += new Gtk.RowExpandedHandler (RowExpanded);
         	        tree_view.Selection.Changed += new EventHandler (RowActivated);
 
 			store = new TreeStore (typeof (string), typeof (Node));
-			root_iter = store.AppendValues ("Mono Documentation", root_tree);
+			root_iter = store.AppendValues ("Mono Documentation", mds.HelpTree);
 
 			PopulateNode (root_iter);
 
@@ -95,7 +93,7 @@
 					}
 				}
 
-				s = root_tree.RenderUrl (url, out match);
+				s = mds.HelpTree.RenderUrl (url, out match);
 				if (s != null) {
 					ShowDocs (s, match, url);
 					return;

Modified: trunk/MonoDevelop/src/Main/Base/Makefile.am
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Makefile.am	2004-03-11 21:50:12 UTC (rev 1148)
+++ trunk/MonoDevelop/src/Main/Base/Makefile.am	2004-03-11 22:24:22 UTC (rev 1149)
@@ -202,6 +202,7 @@
 ./Services/StockIcons.cs \
 ./Services/MessageService.cs \
 ./Services/Toolbar/ToolbarService.cs \
+./Services/MonodocService.cs \
 ./Internal/Undo/IUndoableOperation.cs \
 ./Internal/Undo/UndoStack.cs \
 ./Internal/Undo/UndoQueue.cs \

Added: trunk/MonoDevelop/src/Main/Base/Services/MonodocService.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Services/MonodocService.cs	2004-03-11 21:50:12 UTC (rev 1148)
+++ trunk/MonoDevelop/src/Main/Base/Services/MonodocService.cs	2004-03-11 22:24:22 UTC (rev 1149)
@@ -0,0 +1,26 @@
+using System;
+
+using Monodoc;
+
+using MonoDevelop.Core.Services;
+
+namespace MonoDevelop.Services
+{
+
+	public class MonodocService : AbstractService
+	{
+
+		RootTree helpTree;
+
+		public MonodocService () : base ()
+		{
+			helpTree = RootTree.LoadTree ();
+		}
+
+		public RootTree HelpTree {
+			get { return helpTree; }
+		}
+
+	}
+
+}




More information about the Monodevelop-patches-list mailing list