Browse Source

Fixed bug that prevented the PropertyPad from displaying the properties of elements in pads.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2460 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
bb8c9fadf9
  1. 2
      src/Main/Base/Project/Src/Gui/IWorkbenchLayout.cs
  2. 16
      src/Main/Base/Project/Src/Gui/Pads/PropertyPad/PropertyContainer.cs
  3. 9
      src/Main/Base/Project/Src/Gui/Pads/PropertyPad/PropertyPad.cs
  4. 10
      src/Main/Base/Project/Src/Gui/Workbench/DefaultWorkbench.cs
  5. 6
      src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs

2
src/Main/Base/Project/Src/Gui/IWorkbenchLayout.cs

@ -20,7 +20,7 @@ namespace ICSharpCode.SharpDevelop.Gui
/// <summary> /// <summary>
/// The active workbench window. /// The active workbench window.
/// </summary> /// </summary>
IWorkbenchWindow ActiveWorkbenchwindow { IWorkbenchWindow ActiveWorkbenchWindow {
get; get;
} }

16
src/Main/Base/Project/Src/Gui/Pads/PropertyPad/PropertyContainer.cs

@ -11,6 +11,12 @@ using System.ComponentModel.Design;
namespace ICSharpCode.SharpDevelop.Gui namespace ICSharpCode.SharpDevelop.Gui
{ {
/// <summary>
/// A IViewContent or IPadContent can implement this interface to display a set of properties in
/// the property grid when it has focus.
/// One view/pad content instance has to always return the same property container instance
/// and has to change only the properties on that PropertyContainer.
/// </summary>
public interface IHasPropertyContainer public interface IHasPropertyContainer
{ {
PropertyContainer PropertyContainer { get; } PropertyContainer PropertyContainer { get; }
@ -28,6 +34,16 @@ namespace ICSharpCode.SharpDevelop.Gui
/// </summary> /// </summary>
public sealed class PropertyContainer public sealed class PropertyContainer
{ {
/// <summary>
/// Creates a new PropertyContainer instance.
/// This has the side effect of constructing the PropertyPad if necessary.
/// </summary>
public PropertyContainer()
{
PadDescriptor desc = WorkbenchSingleton.Workbench.GetPad(typeof(PropertyPad));
if (desc != null) desc.CreatePad();
}
object selectedObject; object selectedObject;
object[] selectedObjects; object[] selectedObjects;

9
src/Main/Base/Project/Src/Gui/Pads/PropertyPad/PropertyPad.cs

@ -21,12 +21,6 @@ namespace ICSharpCode.SharpDevelop.Gui
{ {
static PropertyPad instance; static PropertyPad instance;
public static PropertyPad Instance {
get {
return instance;
}
}
PropertyContainer activeContainer; PropertyContainer activeContainer;
void SetActiveContainer(PropertyContainer pc) void SetActiveContainer(PropertyContainer pc)
@ -81,6 +75,9 @@ namespace ICSharpCode.SharpDevelop.Gui
PropertyGrid grid; PropertyGrid grid;
IDesignerHost host; IDesignerHost host;
/// <summary>
/// Gets the underlying property grid. Returns null if the property pad has not yet been created.
/// </summary>
public static PropertyGrid Grid { public static PropertyGrid Grid {
get { get {
if (instance == null) if (instance == null)

10
src/Main/Base/Project/Src/Gui/Workbench/DefaultWorkbench.cs

@ -137,7 +137,7 @@ namespace ICSharpCode.SharpDevelop.Gui
if (layout == null) { if (layout == null) {
this.ActiveWorkbenchWindow = null; this.ActiveWorkbenchWindow = null;
} else { } else {
this.ActiveWorkbenchWindow = layout.ActiveWorkbenchwindow; this.ActiveWorkbenchWindow = layout.ActiveWorkbenchWindow;
} }
} }
@ -158,9 +158,11 @@ namespace ICSharpCode.SharpDevelop.Gui
activeWorkbenchWindow.ActiveViewContentChanged += OnWorkbenchActiveViewContentChanged; activeWorkbenchWindow.ActiveViewContentChanged += OnWorkbenchActiveViewContentChanged;
} }
OnWorkbenchActiveViewContentChanged(null, null); OnWorkbenchActiveViewContentChanged(null, null);
if (ActiveWorkbenchWindowChanged != null) { }
ActiveWorkbenchWindowChanged(this, EventArgs.Empty); // raise even when activeWorkbenchWindow didn't change because we also use
} // ActiveWorkbenchWindowChanged to signal changes in ActiveContent (when switching between pads)
if (ActiveWorkbenchWindowChanged != null) {
ActiveWorkbenchWindowChanged(this, EventArgs.Empty);
} }
} }
} }

6
src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs

@ -33,7 +33,7 @@ namespace ICSharpCode.SharpDevelop.Gui
static bool firstTimeError = true; // TODO: Debug statement only, remove me static bool firstTimeError = true; // TODO: Debug statement only, remove me
#endif #endif
public IWorkbenchWindow ActiveWorkbenchwindow { public IWorkbenchWindow ActiveWorkbenchWindow {
get { get {
if (dockPanel == null) { if (dockPanel == null) {
return null; return null;
@ -253,7 +253,7 @@ namespace ICSharpCode.SharpDevelop.Gui
if (dockPanel != null) { if (dockPanel != null) {
LockWindowUpdate(wbForm.Handle); LockWindowUpdate(wbForm.Handle);
try { try {
IWorkbenchWindow activeWindow = this.ActiveWorkbenchwindow; IWorkbenchWindow activeWindow = this.ActiveWorkbenchWindow;
dockPanel.ActiveDocumentChanged -= new EventHandler(ActiveMdiChanged); dockPanel.ActiveDocumentChanged -= new EventHandler(ActiveMdiChanged);
DetachPadContents(false); DetachPadContents(false);
@ -607,7 +607,7 @@ namespace ICSharpCode.SharpDevelop.Gui
internal void OnActiveWorkbenchWindowChanged(EventArgs e) internal void OnActiveWorkbenchWindowChanged(EventArgs e)
{ {
IWorkbenchWindow newWindow = this.ActiveWorkbenchwindow; IWorkbenchWindow newWindow = this.ActiveWorkbenchWindow;
if (newWindow == null || newWindow.ActiveViewContent != null) { if (newWindow == null || newWindow.ActiveViewContent != null) {
if (ActiveWorkbenchWindowChanged != null) { if (ActiveWorkbenchWindowChanged != null) {
ActiveWorkbenchWindowChanged(this, e); ActiveWorkbenchWindowChanged(this, e);

Loading…
Cancel
Save