Author: fejj
Date: 2007-03-30 17:05:39 -0500 (Fri, 30 Mar 2007)
New Revision: 75237

Added:
   
trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/NavigationHistory.cs
Modified:
   trunk/monodevelop/Core/src/MonoDevelop.Ide/ChangeLog
   trunk/monodevelop/Core/src/MonoDevelop.Ide/Makefile.am
   
trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/NavigationService.cs
   trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.addin.xml
   trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.mdp
Log:
2007-03-30  Jeffrey Stedfast  <[EMAIL PROTECTED]>

        * MonoDevelop.Ide.Gui/NavigationHistory.cs: New widget
        implementing the Back
        (and someday Forward?) custom history navigation widget.

        * MonoDevelop.Ide.addin.xml: Changed the info for the NavigateBack
        button, it is now a custom widget.



Modified: trunk/monodevelop/Core/src/MonoDevelop.Ide/ChangeLog
===================================================================
--- trunk/monodevelop/Core/src/MonoDevelop.Ide/ChangeLog        2007-03-30 
20:19:07 UTC (rev 75236)
+++ trunk/monodevelop/Core/src/MonoDevelop.Ide/ChangeLog        2007-03-30 
22:05:39 UTC (rev 75237)
@@ -1,6 +1,16 @@
+2007-03-30  Jeffrey Stedfast  <[EMAIL PROTECTED]>
+
+       * MonoDevelop.Ide.Gui/NavigationHistory.cs: New widget
+       implementing the Back
+       (and someday Forward?) custom history navigation widget.
+
+       * MonoDevelop.Ide.addin.xml: Changed the info for the NavigateBack
+       button, it is now a custom widget.
+
 2007-03-29  Jeffrey Stedfast  <[EMAIL PROTECTED]>
 
-       * MonoDevelop.Ide.Gui/Workbench.cs (OpenDocument): Log the 
NavigationPoint.
+       * MonoDevelop.Ide.Gui/Workbench.cs (OpenDocument): Log the
+       NavigationPoint.
 
        * MonoDevelop.Ide.Gui/ViewContentEventHandler.cs: New source file.
 

Modified: trunk/monodevelop/Core/src/MonoDevelop.Ide/Makefile.am
===================================================================
--- trunk/monodevelop/Core/src/MonoDevelop.Ide/Makefile.am      2007-03-30 
20:19:07 UTC (rev 75236)
+++ trunk/monodevelop/Core/src/MonoDevelop.Ide/Makefile.am      2007-03-30 
22:05:39 UTC (rev 75237)
@@ -68,8 +68,8 @@
        MonoDevelop.Ide.ExternalTools/ExternalTool.cs \
        MonoDevelop.Ide.ExternalTools/ToolLoader.cs \
        MonoDevelop.Ide.Gui.BrowserDisplayBinding/BrowserDisplayBinding.cs \
+       MonoDevelop.Ide.Gui.BrowserDisplayBinding/HTMLInterfaces.cs \
        MonoDevelop.Ide.Gui.BrowserDisplayBinding/HtmlViewPane.cs \
-       MonoDevelop.Ide.Gui.BrowserDisplayBinding/HTMLInterfaces.cs \
        MonoDevelop.Ide.Gui.Content/IBookmarkBuffer.cs \
        MonoDevelop.Ide.Gui.Content/IClipboardHandler.cs \
        MonoDevelop.Ide.Gui.Content/ICodeStyleOperations.cs \
@@ -225,6 +225,7 @@
        MonoDevelop.Ide.Gui/IWorkbenchLayout.cs \
        MonoDevelop.Ide.Gui/IWorkbenchWindow.cs \
        MonoDevelop.Ide.Gui/LayoutComboBox.cs \
+       MonoDevelop.Ide.Gui/NavigationHistory.cs \
        MonoDevelop.Ide.Gui/NavigationService.cs \
        MonoDevelop.Ide.Gui/OutputProgressMonitor.cs \
        MonoDevelop.Ide.Gui/Pad.cs \

Added: 
trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/NavigationHistory.cs
===================================================================
--- 
trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/NavigationHistory.cs
 2007-03-30 20:19:07 UTC (rev 75236)
+++ 
trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/NavigationHistory.cs
 2007-03-30 22:05:39 UTC (rev 75237)
@@ -0,0 +1,151 @@
+//   Jeffrey Stedfast
+//
+// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+
+using Gtk;
+using MonoDevelop.Core;
+
+namespace MonoDevelop.Ide.Gui {
+       public abstract class NavigationHistory : Alignment {
+               protected MenuToolButton button;
+               protected Hashtable navpoints;
+               
+               public NavigationHistory (string stock_id) : base (0.5f, 0.5f, 
1.0f, 0.0f)
+               {
+                       LeftPadding = 3;
+                       RightPadding = 3;
+                       
+                       navpoints = new Hashtable ();
+                       
+                       button = new MenuToolButton (stock_id);
+                       button.Clicked += new EventHandler (ButtonClicked);
+                       button.Show ();
+                       Add (button);
+                       
+                       NavigationService.HistoryChanged += new EventHandler 
(HistoryChanged);
+               }
+               
+               protected virtual void Go ()
+               {
+                       throw new NotImplementedException ();
+               }
+               
+               void ButtonClicked (object sender, EventArgs e)
+               {
+                       Go ();
+               }
+               
+               protected void GoTo (object sender, EventArgs e)
+               {
+                       if (!navpoints.Contains (sender))
+                               return;
+                       
+                       INavigationPoint point = (INavigationPoint) 
navpoints[sender];
+                       NavigationService.Go (point);
+               }
+               
+               void ClearHistory (object sender, EventArgs e)
+               {
+                       NavigationService.ClearHistory (false);
+               }
+               
+               protected virtual void UpdateHistory ()
+               {
+                       MenuItem item;
+                       
+                       item = new SeparatorMenuItem ();
+                       item.Show ();
+                       
+                       ((MenuShell) button.Menu).Append (item);
+                       
+                       item = new MenuItem ("Clear History");
+                       item.Activated += new EventHandler (ClearHistory);
+                       item.Show ();
+                       
+                       ((MenuShell) button.Menu).Append (item);
+               }
+               
+               void HistoryChanged (object sender, EventArgs e)
+               {
+                       UpdateHistory ();
+               }
+       }
+       
+       public class NavigationHistoryBack : NavigationHistory {
+               public NavigationHistoryBack () : base ("gtk-go-back")
+               {
+                       UpdateHistory ();
+               }
+               
+               protected override void Go ()
+               {
+                       NavigationService.Go (-1);
+               }
+               
+               protected override void UpdateHistory ()
+               {
+                       Menu menu = new Menu ();
+                       
+                       navpoints.Clear ();
+                       
+                       if (NavigationService.CanNavigateBack) {
+                               List<INavigationPoint> points;
+                               INavigationPoint point;
+                               MenuItem item;
+                               int i;
+                               
+                               points = new List<INavigationPoint> 
(NavigationService.Points);
+                               
+                               for (i = 0; i < points.Count; i++) {
+                                       point = points[i];
+                                       if (point == 
NavigationService.CurrentPosition) {
+                                               i--;
+                                               break;
+                                       }
+                               }
+                               
+                               while (i >= 0) {
+                                       point = points[i--];
+                                       item = new MenuItem 
(point.FullDescription);
+                                       item.Activated += new EventHandler 
(GoTo);
+                                       navpoints.Add (item, point);
+                                       item.Show ();
+                                       
+                                       ((MenuShell) menu).Append (item);
+                               }
+                               
+                               this.Sensitive = true;
+                       } else {
+                               this.Sensitive = false;
+                       }
+                       
+                       menu.Show ();
+                       button.Menu = menu;
+                       base.UpdateHistory ();
+               }
+       }
+}

Modified: 
trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/NavigationService.cs
===================================================================
--- 
trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/NavigationService.cs
 2007-03-30 20:19:07 UTC (rev 75236)
+++ 
trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/NavigationService.cs
 2007-03-30 22:05:39 UTC (rev 75237)
@@ -313,7 +313,7 @@
 #endregion
                
 #region Public Events
-               public static event System.EventHandler HistoryChanged;
+               public static event EventHandler HistoryChanged;
                
                static void OnHistoryChanged ()
                {

Modified: trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.addin.xml
===================================================================
--- trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.addin.xml        
2007-03-30 20:19:07 UTC (rev 75236)
+++ trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.addin.xml        
2007-03-30 22:05:39 UTC (rev 75237)
@@ -135,15 +135,15 @@
                <!-- NavigationCommands -->
 
                <Command id = 
"MonoDevelop.Ide.Commands.NavigationCommands.NavigateBack"
-                               defaultHandler = 
"MonoDevelop.Ide.Commands.NavigateBack"
-                               _label = "_Back" 
-                               icon = "gtk-go-back" 
-                               _description = "Go back in time"/>
+                               type = "custom"
+                               widget = 
"MonoDevelop.Ide.Gui.NavigationHistoryBack"
+                               _label = "_Back"
+                               _description = "Navigate Back"/>
                <Command id = 
"MonoDevelop.Ide.Commands.NavigationCommands.NavigateForward"
                                defaultHandler = 
"MonoDevelop.Ide.Commands.NavigateForward"
                                _label = "_Forward" 
                                icon = "gtk-go-forward" 
-                               _description = "Go back to the future"/>
+                               _description = "Navigate Forward"/>
 
                <!-- ProjectCommands -->
                                

Modified: trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.mdp
===================================================================
--- trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.mdp      
2007-03-30 20:19:07 UTC (rev 75236)
+++ trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.mdp      
2007-03-30 22:05:39 UTC (rev 75237)
@@ -276,6 +276,7 @@
     <File name="./MonoDevelop.Ide.Gui/DefaultNavigationPoint.cs" 
subtype="Code" buildaction="Compile" />
     <File name="./MonoDevelop.Ide.Gui/ViewContentEventHandler.cs" 
subtype="Code" buildaction="Compile" />
     <File name="./MonoDevelop.Ide.Commands/NavigationCommands.cs" 
subtype="Code" buildaction="Compile" />
+    <File name="./MonoDevelop.Ide.Gui/NavigationHistory.cs" subtype="Code" 
buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="False" refto="gecko-sharp, 
Version=2.0.0.0, Culture=neutral, PublicKeyToken=ccf7d78a55e9f021" />

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to