From: <mcu...@us...> - 2008-11-20 08:09:08
|
Revision: 1338 http://orm.svn.sourceforge.net/orm/?rev=1338&view=rev Author: mcurland Date: 2008-11-20 08:09:04 +0000 (Thu, 20 Nov 2008) Log Message: ----------- Modify the selection container tracking routines to allow a covered toolwindow that is an ORM selection container (currently this set is the model browser and diagram spy) to provide the selection for other toolwindows. Previously, the selection could jump back to the current document window when the tool window was deactivated, which made these containers unusable for toolwindow-based edits. refs #376 Modified Paths: -------------- trunk/ORMModel/Framework/Shell/ToolWindowActivator.cs trunk/ORMModel/Shell/ORMDiagramSpy.cs trunk/ORMModel/Shell/ORMModelBrowser.cs Modified: trunk/ORMModel/Framework/Shell/ToolWindowActivator.cs =================================================================== --- trunk/ORMModel/Framework/Shell/ToolWindowActivator.cs 2008-11-19 22:47:15 UTC (rev 1337) +++ trunk/ORMModel/Framework/Shell/ToolWindowActivator.cs 2008-11-20 08:09:04 UTC (rev 1338) @@ -85,6 +85,7 @@ ClearContentsOnSelectionChanged, } #endregion // CoveredFrameContentActions enum + #region INotifyToolWindowActivation interface /// <summary> /// Callback interface provided by consumers of the <see cref="T:ToolWindowActivationHelper"/> class. /// </summary> @@ -122,7 +123,21 @@ /// <param name="docData">The document to detach from</param> void ActivatorDetachEventHandlers(DocDataType docData); } - + #endregion // INotifyToolWindowActivation interface + #region ICurrentFrameVisibility interface + /// <summary> + /// Provide the current frame visibility. Implement this interface + /// on a selection container tool window to enable maintaining the tool + /// window as a selection container even when it is hidden. + /// </summary> + public interface IProvideFrameVisibility + { + /// <summary> + /// The current <see cref="FrameVisibility"/> for this container + /// </summary> + FrameVisibility CurrentFrameVisibility { get;} + } + #endregion // ICurrentFrameVisibility interface #region ToolWindowActivationHelper class /// <summary> /// Helper class to enable tool window implementations to track changes selection @@ -410,7 +425,7 @@ } } /// <summary> - /// Clear the contents of the tool window associated with thie <see cref="T:ToolWindowActivationHelper"/> + /// Clear the contents of the tool window associated with this <see cref="T:ToolWindowActivationHelper"/> /// </summary> protected virtual void ClearContents() { @@ -602,7 +617,16 @@ private void MonitorSelectionChanged(object sender, MonitorSelectionEventArgs e) { IMonitorSelectionService monitor = (IMonitorSelectionService)sender; - CurrentSelectionContainer = monitor.CurrentSelectionContainer as SelectionContainerType ?? monitor.CurrentDocumentView as SelectionContainerType; + SelectionContainerType newContainer = monitor.CurrentSelectionContainer as SelectionContainerType; + if (newContainer == null) + { + IProvideFrameVisibility visibility = myCurrentSelectionContainer as IProvideFrameVisibility; + if (visibility == null || visibility.CurrentFrameVisibility == FrameVisibility.Hidden) + { + newContainer = monitor.CurrentDocumentView as SelectionContainerType; + } + } + CurrentSelectionContainer = newContainer; } /// <summary> /// Handles the DocumentWindowChanged event on the IMonitorSelectionService Modified: trunk/ORMModel/Shell/ORMDiagramSpy.cs =================================================================== --- trunk/ORMModel/Shell/ORMDiagramSpy.cs 2008-11-19 22:47:15 UTC (rev 1337) +++ trunk/ORMModel/Shell/ORMDiagramSpy.cs 2008-11-20 08:09:04 UTC (rev 1338) @@ -41,7 +41,7 @@ /// </summary> [Guid("19A5C15D-14D4-4A88-9891-A3294077BE56")] [CLSCompliant(false)] - public class ORMDiagramSpyWindow : ORMToolWindow, IORMSelectionContainer, IORMDesignerView + public class ORMDiagramSpyWindow : ORMToolWindow, IORMSelectionContainer, IProvideFrameVisibility, IORMDesignerView { #region Member Variables private ToolWindowDiagramView myDiagramView; @@ -557,6 +557,15 @@ } } #endregion // IORMDesignerView Implementation + #region IProvideFrameVisibility Implementation + FrameVisibility IProvideFrameVisibility.CurrentFrameVisibility + { + get + { + return CurrentFrameVisibility; + } + } + #endregion // IProvideFrameVisibility Implementation #region ORMDiagramSpyToolWindow specific /// <summary> /// Loads the SurveyTreeControl from the current document Modified: trunk/ORMModel/Shell/ORMModelBrowser.cs =================================================================== --- trunk/ORMModel/Shell/ORMModelBrowser.cs 2008-11-19 22:47:15 UTC (rev 1337) +++ trunk/ORMModel/Shell/ORMModelBrowser.cs 2008-11-20 08:09:04 UTC (rev 1338) @@ -32,6 +32,7 @@ using System.Runtime.InteropServices; using Neumont.Tools.Modeling.Design; using Microsoft.VisualStudio.Modeling.Diagrams; +using Neumont.Tools.Modeling.Shell; using Neumont.Tools.ORM.ShapeModel; using MSOLE = Microsoft.VisualStudio.OLE.Interop; using Microsoft.VisualStudio; @@ -44,9 +45,17 @@ /// </summary> [Guid("DD2334C3-AFDB-4FC5-9E8A-17D19A8CC97A")] [CLSCompliant(false)] - public partial class ORMModelBrowserToolWindow : ORMToolWindow, IORMSelectionContainer + public partial class ORMModelBrowserToolWindow : ORMToolWindow, IORMSelectionContainer, IProvideFrameVisibility { + #region Member Variables private SurveyTreeContainer myTreeContainer; + private ORMDesignerCommands myVisibleCommands; + private ORMDesignerCommands myCheckedCommands; + private ORMDesignerCommands myCheckableCommands; + private ORMDesignerCommands myEnabledCommands; + private object myCommandSet; + #endregion // Member Variables + #region Constructor /// <summary> /// public constructor /// </summary> @@ -55,12 +64,7 @@ : base(serviceProvider) { } - private ORMDesignerCommands myVisibleCommands; - private ORMDesignerCommands myCheckedCommands; - private ORMDesignerCommands myCheckableCommands; - private ORMDesignerCommands myEnabledCommands; - private object myCommandSet; - + #endregion // Constructor #region MenuService, MonitorSelectionService, and SelectedNode properties private static bool myCommandsPopulated; /// <summary> @@ -477,5 +481,14 @@ } } #endregion //ORMToolWindow overrides + #region IProvideFrameVisibility Implementation + FrameVisibility IProvideFrameVisibility.CurrentFrameVisibility + { + get + { + return CurrentFrameVisibility; + } + } + #endregion // IProvideFrameVisibility Implementation } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |