Browse Source

Property pad now works correctly with the Windows Forms designer.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2645 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 18 years ago
parent
commit
07741ea018
  1. 2
      src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixDialogDesigner.cs
  2. 6
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs
  3. 6
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/FormKeyHandler.cs
  4. 6
      src/Main/Base/Project/Src/Gui/Pads/PropertyPad/PropertyContainer.cs
  5. 25
      src/Main/Base/Project/Src/Gui/Pads/PropertyPad/PropertyPad.cs

2
src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixDialogDesigner.cs

@ -69,7 +69,7 @@ namespace ICSharpCode.WixBinding @@ -69,7 +69,7 @@ namespace ICSharpCode.WixBinding
public void OpenDialog(string id)
{
JumpToDialogElement(id);
if (base.IsFormsDesignerVisible) {
if (base.Host != null) {
// Reload so the correct dialog is displayed.
base.SaveToPrimary();
DialogId = id;

6
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs

@ -151,6 +151,8 @@ namespace ICSharpCode.FormsDesigner @@ -151,6 +151,8 @@ namespace ICSharpCode.FormsDesigner
ShowTabOrder();
}
UpdatePropertyPad();
LoggingService.Info("Form Designer: END INITIALIZE");
}
@ -383,7 +385,7 @@ namespace ICSharpCode.FormsDesigner @@ -383,7 +385,7 @@ namespace ICSharpCode.FormsDesigner
protected void UpdatePropertyPad()
{
if (IsFormsDesignerVisible && Host != null) {
if (Host != null) {
propertyContainer.Host = Host;
propertyContainer.SelectableObjects = Host.Container.Components;
ISelectionService selectionService = (ISelectionService)Host.GetService(typeof(ISelectionService));
@ -393,8 +395,6 @@ namespace ICSharpCode.FormsDesigner @@ -393,8 +395,6 @@ namespace ICSharpCode.FormsDesigner
}
}
public bool IsFormsDesignerVisible = false;
#region IUndoHandler implementation
public bool EnableUndo {
get {

6
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/FormKeyHandler.cs

@ -77,11 +77,7 @@ namespace ICSharpCode.FormsDesigner @@ -77,11 +77,7 @@ namespace ICSharpCode.FormsDesigner
FormsDesignerViewContent formDesigner = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ActiveViewContent as FormsDesignerViewContent;
if (formDesigner == null) {
return false;
}
if (!formDesigner.IsFormsDesignerVisible) {
if (formDesigner == null || formDesigner.Host == null) {
return false;
}

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

@ -39,9 +39,11 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -39,9 +39,11 @@ namespace ICSharpCode.SharpDevelop.Gui
/// Creates a new PropertyContainer instance.
/// This has the side effect of constructing the PropertyPad if necessary.
/// </summary>
public PropertyContainer()
public PropertyContainer() : this(true) { }
internal PropertyContainer(bool createPadOnConstruction)
{
if (WorkbenchSingleton.Workbench != null) {
if (createPadOnConstruction && WorkbenchSingleton.Workbench != null) {
PadDescriptor desc = WorkbenchSingleton.Workbench.GetPad(typeof(PropertyPad));
if (desc != null) desc.CreatePad();
}

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

@ -21,6 +21,9 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -21,6 +21,9 @@ namespace ICSharpCode.SharpDevelop.Gui
{
static PropertyPad instance;
// an empty container used to reset the property grid
readonly PropertyContainer emptyContainer = new PropertyContainer(false);
PropertyContainer activeContainer;
void SetActiveContainer(PropertyContainer pc)
@ -28,7 +31,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -28,7 +31,7 @@ namespace ICSharpCode.SharpDevelop.Gui
if (activeContainer == pc)
return;
if (pc == null)
return;
pc = emptyContainer;
activeContainer = pc;
UpdateHostIfActive(pc);
@ -120,15 +123,29 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -120,15 +123,29 @@ namespace ICSharpCode.SharpDevelop.Gui
}
}
IHasPropertyContainer previousContent;
void WorkbenchActiveContentChanged(object sender, EventArgs e)
{
IHasPropertyContainer c = WorkbenchSingleton.Workbench.ActiveContent as IHasPropertyContainer;
if (c == null) {
c = WorkbenchSingleton.Workbench.ActiveViewContent as IHasPropertyContainer;
if (previousContent == null) {
c = WorkbenchSingleton.Workbench.ActiveViewContent as IHasPropertyContainer;
} else {
// if the previous content is no longer visible, we have to remove the active container
if (previousContent is IViewContent && previousContent != WorkbenchSingleton.Workbench.ActiveViewContent) {
c = null;
} else {
c = previousContent;
}
}
}
if (c != null) {
SetActiveContainer(c.PropertyContainer);
} else {
SetActiveContainer(null);
}
previousContent = c;
}
public PropertyPad()
@ -170,8 +187,8 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -170,8 +187,8 @@ namespace ICSharpCode.SharpDevelop.Gui
LoggingService.Debug("PropertyPad created");
WorkbenchSingleton.Workbench.ActiveContentChanged += WorkbenchActiveContentChanged;
// it is possible that ActiveContent changes fires before ActiveViewContent.
// if we listen the new content is not a IHasPropertyContainer and we listen only to ActiveContentChanged,
// we might display the ToolsControl of a no longer active view content
// if the new content is not a IHasPropertyContainer and we listen only to ActiveContentChanged,
// we might display the PropertyPad of a no longer active view content
WorkbenchSingleton.Workbench.ActiveViewContentChanged += WorkbenchActiveContentChanged;
WorkbenchActiveContentChanged(null, null);
}

Loading…
Cancel
Save