[Monodevelop-patches-list] r549 - in trunk/MonoDevelop: samples/HtmlControl src/AddIns/Misc/StartPage src/Main/Base/Gui/BrowserDisplayBinding src/Main/Base/Gui/HtmlControl

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Sun Jan 18 15:16:23 EST 2004


Author: jluke
Date: 2004-01-18 15:16:23 -0500 (Sun, 18 Jan 2004)
New Revision: 549

Added:
   trunk/MonoDevelop/samples/HtmlControl/test.css
Modified:
   trunk/MonoDevelop/samples/HtmlControl/Test.cs
   trunk/MonoDevelop/src/AddIns/Misc/StartPage/Main.cs
   trunk/MonoDevelop/src/AddIns/Misc/StartPage/StartPage.cs
   trunk/MonoDevelop/src/Main/Base/Gui/BrowserDisplayBinding/HtmlViewPane.cs
   trunk/MonoDevelop/src/Main/Base/Gui/HtmlControl/MozillaControl.cs
Log:
connect some more events in Html stuff
allow the base_uri to be set when Rendering local html


Modified: trunk/MonoDevelop/samples/HtmlControl/Test.cs
===================================================================
--- trunk/MonoDevelop/samples/HtmlControl/Test.cs	2004-01-18 20:14:44 UTC (rev 548)
+++ trunk/MonoDevelop/samples/HtmlControl/Test.cs	2004-01-18 20:16:23 UTC (rev 549)
@@ -70,9 +70,8 @@
 		html.NetStart += new EventHandler (OnNetStart);
 		html.NetStop += new EventHandler (OnNetStop);
 		html.Title += new EventHandler (OnTitleChanged);
-		//html.Control.Title += new EventHandler (OnHtmlTitle);
-		// this loads html from a string
-		html.Html = "<html><body>testing</body></html>";
+		html.LinkMessage += new EventHandler (OnLinkMessage);
+		html.Html = "<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"test.css\" /></head><body>testing</body></html>";
 		
 		html.ShowAll ();
 		vbox.PackStart (html, true, true, 0);
@@ -82,7 +81,7 @@
 		
 		win.Add (vbox);
 		win.ShowAll ();
-		html.DelayedInitialize ();
+		html.InitializeWithBase ("file://");
 	}
 
 	void OnWinDelete (object o, DeleteEventArgs args)
@@ -90,6 +89,11 @@
 		Application.Quit ();
 	}
 
+	void OnLinkMessage (object o, EventArgs args)
+	{
+		status.Push (1, html.GeckoLinkMessage);
+	}
+	
 	void OnNetStart (object o, EventArgs args)
 	{
 		status.Push (1, "Loading ...");
@@ -117,7 +121,7 @@
 
 	void OnHtmlTitle (object o, EventArgs args)
 	{
-		//win.Title = "";
+		win.Title = html.GeckoTitle;
 	}
 
 	void OnBackClicked (object o, EventArgs args)

Added: trunk/MonoDevelop/samples/HtmlControl/test.css
===================================================================
--- trunk/MonoDevelop/samples/HtmlControl/test.css	2004-01-18 20:14:44 UTC (rev 548)
+++ trunk/MonoDevelop/samples/HtmlControl/test.css	2004-01-18 20:16:23 UTC (rev 549)
@@ -0,0 +1 @@
+body { background: red; }

Modified: trunk/MonoDevelop/src/AddIns/Misc/StartPage/Main.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/Misc/StartPage/Main.cs	2004-01-18 20:14:44 UTC (rev 548)
+++ trunk/MonoDevelop/src/AddIns/Misc/StartPage/Main.cs	2004-01-18 20:16:23 UTC (rev 549)
@@ -1,10 +1,12 @@
 // project created on 16.07.2002 at 18:07
 using System;
+using System.IO;
 using System.Drawing;
 
 using ICSharpCode.Core.AddIns;
 using ICSharpCode.Core.AddIns.Codons;
 using ICSharpCode.SharpDevelop.Gui;
+using ICSharpCode.Core.Services;
 
 namespace ICSharpCode.StartPage {
 	
@@ -21,8 +23,13 @@
 			//if (SharpDevelopMain.CommandLineArgs != null) {
 				//StartPageView spv = new StartPageView ();
 				//WorkbenchSingleton.Workbench.ShowView(spv);
-				//spv.DelayedInitialize ();
-				
+
+				//PropertyService ps = (PropertyService) ServiceManager.Services.GetService (typeof(PropertyService));
+				//string base_uri = ps.DataDirectory + Path.DirectorySeparatorChar +                                                                                
+				//".." + Path.DirectorySeparatorChar +
+				//"data" + Path.DirectorySeparatorChar +
+				//"resources" + Path.DirectorySeparatorChar +                             "startpage";
+				//spv.DelayedInitialize ("file://" + base_uri);
 			//}
 		}
 	}

Modified: trunk/MonoDevelop/src/AddIns/Misc/StartPage/StartPage.cs
===================================================================
--- trunk/MonoDevelop/src/AddIns/Misc/StartPage/StartPage.cs	2004-01-18 20:14:44 UTC (rev 548)
+++ trunk/MonoDevelop/src/AddIns/Misc/StartPage/StartPage.cs	2004-01-18 20:16:23 UTC (rev 549)
@@ -74,11 +74,11 @@
 		{
 			htmlControl = new MozillaControl ();
 			PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
-			//htmlControl.CascadingStyleSheet = propertyService.DataDirectory + Path.DirectorySeparatorChar +
+			//htmlControl.Css = propertyService.DataDirectory + Path.DirectorySeparatorChar +
 			//                                  "resources" + Path.DirectorySeparatorChar +
-			 //                                 "startpage" + Path.DirectorySeparatorChar +
-			  //                                "Layout" + Path.DirectorySeparatorChar +
-			    //                              "default.css";
+			//                                  "startpage" + Path.DirectorySeparatorChar +
+			//                                  "Layout" + Path.DirectorySeparatorChar +
+			//                                  "default.css";
 			
 			htmlControl.Html = page.Render(curSection);
 			htmlControl.ShowAll ();
@@ -92,9 +92,9 @@
 			projectService.CombineOpened += new CombineEventHandler(HandleCombineOpened);
 		}
 		
-		public void DelayedInitialize ()
+		public void DelayedInitialize (string base_uri)
 		{
-			htmlControl.DelayedInitialize ();
+			htmlControl.InitializeWithBase (base_uri);
 		}
 		
 		void HandleCombineOpened(object sender, CombineEventArgs e)
@@ -102,8 +102,9 @@
 			WorkbenchWindow.CloseWindow(true);
 		}
 		
-		void HtmlControlBeforeNavigate(object sender, OpenUriArgs e)
+		void HtmlControlBeforeNavigate (object sender, OpenUriArgs e)
 		{
+			Console.WriteLine (e.AURI);
 			e.RetVal = true;
 			if (e.AURI.StartsWith("project://")) {
 				try {
@@ -115,7 +116,8 @@
 						IProjectService projectService = (IProjectService)ICSharpCode.Core.Services.ServiceManager.Services.GetService(typeof(IProjectService));
 						
 						string prjNumber = e.AURI.Substring("project://".Length);
-						prjNumber = prjNumber.Substring(0, prjNumber.Length - 1);
+						// wrong (jluke)
+						//prjNumber = prjNumber.Substring(0, prjNumber.Length - 1);
 			
 						string projectFile = page.projectFiles[int.Parse(prjNumber)];
 			
@@ -127,6 +129,7 @@
 					}
 				} catch (Exception ex) {
 					//MessageBox.Show("Could not access project service or load project:\n\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+				Console.WriteLine (ex.ToString ());
 				}
 			} else if (e.AURI.EndsWith("/opencombine")) {
 				OpenBtnClicked(this, EventArgs.Empty);
@@ -142,7 +145,7 @@
 					htmlControl.Html = page.Render(curSection);
 				}
 			} else {
-				System.Diagnostics.Process.Start(e.AURI);
+				//System.Diagnostics.Process.Start(e.AURI);
 			}
 		}
 		

Modified: trunk/MonoDevelop/src/Main/Base/Gui/BrowserDisplayBinding/HtmlViewPane.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/BrowserDisplayBinding/HtmlViewPane.cs	2004-01-18 20:14:44 UTC (rev 548)
+++ trunk/MonoDevelop/src/Main/Base/Gui/BrowserDisplayBinding/HtmlViewPane.cs	2004-01-18 20:16:23 UTC (rev 549)
@@ -23,7 +23,8 @@
 	public class BrowserPane : AbstractViewContent
 	{	
 		protected HtmlViewPane htmlViewPane;
-		
+		string title;
+
 		public override Widget Control {
 			get {
 				return htmlViewPane;
@@ -47,7 +48,7 @@
 		protected BrowserPane(bool showNavigation) //: base (type)
 		{
 			htmlViewPane = new HtmlViewPane(showNavigation);
-			//htmlViewPane.HtmlControl.TitleChange += new DWebBrowserEvents2_TitleChangeEventHandler(TitleChange);
+			htmlViewPane.MozillaControl.Title += new EventHandler (OnTitleChanged);
 		}
 		
 		public BrowserPane() : this(true)
@@ -69,10 +70,10 @@
 			Load(url);
 		}
 		
-		//void TitleChange(object sender, DWebBrowserEvents2_TitleChangeEvent e)
-		//{
-		//	ContentName = e.text;
-		//}
+		private void OnTitleChanged (object o, EventArgs args)
+		{
+			ContentName = htmlViewPane.MozillaControl.GeckoTitle; 
+		}
 	}
 	
 	public class HtmlViewPane : Gtk.Frame
@@ -151,7 +152,6 @@
 			htmlControl = new MozillaControl ();
 			htmlControl.NetStart += new EventHandler (OnNetStart);
 			htmlControl.NetStop += new EventHandler (OnNetStop);
-			htmlControl.Title += new EventHandler (OnTitleChanged);
 			htmlControl.ShowAll ();
 
 			mainbox.PackStart (htmlControl);
@@ -197,11 +197,6 @@
 			status.Push (1, "Done.");
 		}
 
-		private void OnTitleChanged (object o, EventArgs args)
-		{
-			Console.WriteLine ("title: " + htmlControl.GeckoTitle); 
-		}
-		
 		private void OnBackClicked (object o, EventArgs args)
 		{
 			htmlControl.GoBack ();

Modified: trunk/MonoDevelop/src/Main/Base/Gui/HtmlControl/MozillaControl.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/HtmlControl/MozillaControl.cs	2004-01-18 20:14:44 UTC (rev 548)
+++ trunk/MonoDevelop/src/Main/Base/Gui/HtmlControl/MozillaControl.cs	2004-01-18 20:16:23 UTC (rev 549)
@@ -16,6 +16,7 @@
 	{
 		private static GLib.GType type;
 		private string html;
+		private string css;
 		
 		static MozillaControl ()
 		{
@@ -80,13 +81,25 @@
 			get { return html; }
 			set { html = value; }
 		}
+		
+		public string Css
+		{
+			get { return css; }
+			set { css = value; }
+		}
 
-		public void DelayedInitialize ()
+		public void InitializeWithBase (string base_uri)
 		{
+			Console.WriteLine (base_uri);
 			if (html.Length > 0)
 			{
-				this.RenderData (html, "file://", "text/html");
+				this.RenderData (html, base_uri, "text/html");
 			}
 		}
+		
+		public void DelayedInitialize ()
+		{
+			InitializeWithBase ("file://");
+		}
 	}
 }




More information about the Monodevelop-patches-list mailing list