Hi guys,

   long time no code... well, I've come with a patch for
mono-tools/docbrowser that fixes 2 bugs (#324305 and #322097) and
resurrects the css-enabled documentation which was disabled by mistake
(I think so, I didn't call CSI to investigate further, :-P).

See what do you think and If I should commit the patch.
Index: browser.cs
===================================================================
--- browser.cs	(revisión: 89406)
+++ browser.cs	(copia de trabajo)
@@ -161,6 +161,7 @@
 	[Glade.Widget] public MenuItem cut1;
 	[Glade.Widget] public MenuItem paste1;
 	[Glade.Widget] public MenuItem print;
+	[Glade.Widget] public MenuItem close_tab;
 	public Notebook tabs_nb;
 	public Tab CurrentTab;
 	bool HoldCtrl;
@@ -383,6 +384,7 @@
 		search_tree.Model = search_store;
 		search_tree.AppendColumn ("Searches", new CellRendererText(), "text", 0);
 		search_tree.Selection.Changed += new EventHandler (ShowSearchResult);
+		search_tree.FocusOutEvent += new FocusOutEventHandler(LostFocus);
 
 		vbox1.ShowAll ();
 		search_vbox.ShowAll ();
@@ -394,6 +396,7 @@
 		CurrentTab = new Tab (this);
 		tabs_nb.AppendPage (CurrentTab, CurrentTab.TabLabel);
 		tabs_nb.ShowTabs = (tabs_nb.NPages > 1);
+		close_tab.Sensitive = (tabs_nb.NPages > 1);
 		tabs_nb.ShowAll (); //Needed to show the new tab
 		tabs_nb.CurrentPage = tabs_nb.PageNum (CurrentTab);
 		//Show root node
@@ -405,6 +408,14 @@
 		}
 		
 	}
+
+	void CloseTab ()
+	{
+		tabs_nb.RemovePage(tabs_nb.CurrentPage);
+		bool multiple_tabs = (tabs_nb.NPages > 1);
+		tabs_nb.ShowTabs = multiple_tabs;
+		close_tab.Sensitive = multiple_tabs;
+	}
 	
 	//Called when the user changes the active Tab
 	void ChangeTab(object o, SwitchPageArgs args) 
@@ -463,7 +474,16 @@
 		search_tree.Selection.SelectPath (p);
 		search_term.Editable = true;	
 	}
+
 	//
+	// Invoked when the search results panel losts focus
+	//
+	void LostFocus(object sender, FocusOutEventArgs a)
+	{
+		search_tree.Selection.UnselectAll();
+	}
+
+	//
 	// Invoked when the user click on one of the search results
 	//
 	void ShowSearchResult (object sender, EventArgs a)
@@ -1610,6 +1630,14 @@
 	{
 		AddTab();
 	}
+
+	//
+	// Invoked by Close Tab menu entry.
+	//
+	public void OnCloseTab (object sender, EventArgs a)
+	{
+		CloseTab();
+	}
 	
 }
 
@@ -2275,12 +2303,14 @@
 		if (browser.UseGecko) {
 			html = GetRenderer ("GeckoHtmlRender.dll", "Monodoc.GeckoHtmlRender", browser);
 			html_preview = GetRenderer ("GeckoHtmlRender.dll", "Monodoc.GeckoHtmlRender", browser);
+			HelpSource.use_css = true;
 		}
 		
 		if (html == null || html_preview == null) {
 			html = GetRenderer ("GtkHtmlHtmlRender.dll", "Monodoc.GtkHtmlHtmlRender", browser);
 			html_preview = GetRenderer ("GtkHtmlHtmlRender.dll", "Monodoc.GtkHtmlHtmlRender", browser);
 			browser.UseGecko = false;
+			HelpSource.use_css = false;
 		}
 
 		if (html == null || html_preview == null)
@@ -2389,7 +2419,7 @@
 		tabClose.Add(img);
 		tabClose.Relief = Gtk.ReliefStyle.None;
 		tabClose.SetSizeRequest (18, 18);
-		tabClose.Clicked += new EventHandler (OnTabClose);
+		tabClose.Clicked += new EventHandler (browser.OnCloseTab);
 		
 		//Icon showed when the Tab is in Edit Mode
 		EditImg = new Image (Stock.Convert, IconSize.SmallToolbar);
@@ -2538,11 +2568,6 @@
 			return false;
 		});
 	}
-	void OnTabClose (object sender, EventArgs a)
-	{
-		browser.tabs_nb.RemovePage(browser.tabs_nb.PageNum(this));
-		browser.tabs_nb.ShowTabs = (browser.tabs_nb.NPages > 1);
-	}
 	
 }
 }
Index: ChangeLog
===================================================================
--- ChangeLog	(revisión: 89406)
+++ ChangeLog	(copia de trabajo)
@@ -1,3 +1,12 @@
+2007-11-10  Mario Sopena <[EMAIL PROTECTED]>
+	* browser.cs: 
+	  - fix #324305. Now, when search results panel lost focus,
+	    unselects the selected search result
+	  - fix #322097. Solution based on the patch provided 
+	    by [EMAIL PROTECTED]
+	  - Use CSS when gecko is used as renderer
+	
+
 2007-11-09  Wade Berrier  <[EMAIL PROTECTED]>
 
 	* AssemblyInfo.cs.in: use TOOLS_VERSION because it is
Index: browser.glade
===================================================================
--- browser.glade	(revisión: 89406)
+++ browser.glade	(copia de trabajo)
@@ -111,6 +111,28 @@
 		  </child>
 
 		  <child>
+		    <widget class="GtkImageMenuItem" id="close_tab">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">_Close Tab</property>
+		      <property name="use_underline">True</property>
+		      <signal name="activate" handler="OnCloseTab" last_modification_time="Sat, 10 Nov 2007 15:30:32 GMT"/>
+		      <accelerator key="W" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+
+		      <child internal-child="image">
+			<widget class="GtkImage" id="image144">
+			  <property name="visible">True</property>
+			  <property name="stock">gtk-close</property>
+			  <property name="icon_size">1</property>
+			  <property name="xalign">0.5</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			</widget>
+		      </child>
+		    </widget>
+		  </child>
+
+		  <child>
 		    <widget class="GtkImageMenuItem" id="quit1">
 		      <property name="visible">True</property>
 		      <property name="label" translatable="yes">Quit</property>
_______________________________________________
Mono-docs-list maillist  -  Mono-docs-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-docs-list

Reply via email to