Browse Source

SD2-693 - ToolstripContainer designer loading problem. Applied Christian Hornung's patch that adds a Deselecting event handler for the IBaseViewContent interface, which is called before the view has been deselected, allowing the forms designer to read the correct ToolStripPanelVisible properties before the designed form is hidden.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1172 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Matt Ward 20 years ago
parent
commit
af3c2e2d76
  1. 6
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs
  2. 4
      src/Main/Base/Project/Src/Gui/AbstractBaseViewContent.cs
  3. 6
      src/Main/Base/Project/Src/Gui/IBaseViewContent.cs
  4. 46
      src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs

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

@ -347,17 +347,17 @@ namespace ICSharpCode.FormsDesigner @@ -347,17 +347,17 @@ namespace ICSharpCode.FormsDesigner
{
disposing = true;
if (IsFormsDesignerVisible) {
Deselected();
Deselecting();
}
base.Dispose();
}
public override void Deselected()
public override void Deselecting()
{
// can happen if form designer is disposed and then deselected
if (!IsFormsDesignerVisible)
return;
LoggingService.Info("Deselected form designer, unloading..." + viewContent.TitleName);
LoggingService.Info("Deselecting form designer, unloading..." + viewContent.TitleName);
PropertyPad.PropertyValueChanged -= PropertyValueChanged;
propertyContainer.Clear();
IsFormsDesignerVisible = false;

4
src/Main/Base/Project/Src/Gui/AbstractBaseViewContent.cs

@ -55,6 +55,10 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -55,6 +55,10 @@ namespace ICSharpCode.SharpDevelop.Gui
public virtual void Deselected()
{
}
public virtual void Deselecting()
{
}
public virtual void RedrawContent()
{

6
src/Main/Base/Project/Src/Gui/IBaseViewContent.cs

@ -50,6 +50,12 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -50,6 +50,12 @@ namespace ICSharpCode.SharpDevelop.Gui
/// tab. NOT when the windows is selected.
/// </summary>
void Selected();
/// <summary>
/// Is called just before the view content is deselected inside the window
/// tab before the other window is selected. NOT when the windows is deselected.
/// </summary>
void Deselecting();
/// <summary>
/// Is called when the view content is deselected inside the window

46
src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs

@ -136,7 +136,9 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -136,7 +136,9 @@ namespace ICSharpCode.SharpDevelop.Gui
viewTabControl = new TabControl();
viewTabControl.Alignment = TabAlignment.Bottom;
viewTabControl.Dock = DockStyle.Fill;
viewTabControl.SelectedIndexChanged += new EventHandler(viewTabControlIndexChanged);
viewTabControl.Selected += viewTabControlSelected;
viewTabControl.Deselecting += viewTabControlDeselecting;
viewTabControl.Deselected += viewTabControlDeselected;
}
internal void InitControls()
@ -200,11 +202,6 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -200,11 +202,6 @@ namespace ICSharpCode.SharpDevelop.Gui
WorkbenchSingleton.SafeThreadAsyncCall(new MethodInvoker(this.RefreshSecondaryViewContents));
}
void LeaveTabPage(object sender, EventArgs e)
{
OnWindowDeselected(EventArgs.Empty);
}
public IViewContent ViewContent {
get {
return content;
@ -260,6 +257,9 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -260,6 +257,9 @@ namespace ICSharpCode.SharpDevelop.Gui
if (viewTabControl != null) {
foreach (TabPage page in viewTabControl.TabPages) {
if (viewTabControl.SelectedTab == page && page.Tag is IBaseViewContent) {
((IBaseViewContent)page.Tag).Deselecting();
}
page.Controls.Clear();
if (viewTabControl.SelectedTab == page && page.Tag is IBaseViewContent) {
((IBaseViewContent)page.Tag).Deselected();
@ -319,28 +319,40 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -319,28 +319,40 @@ namespace ICSharpCode.SharpDevelop.Gui
return content.SecondaryViewContents[index - 1];
}
int oldIndex = 0;
void viewTabControlIndexChanged(object sender, EventArgs e)
void viewTabControlSelected(object sender, TabControlEventArgs e)
{
if (oldIndex >= 0) {
IBaseViewContent secondaryViewContent = GetSubViewContent(oldIndex);
if (e.Action == TabControlAction.Selected && e.TabPageIndex >= 0) {
IBaseViewContent secondaryViewContent = GetSubViewContent(e.TabPageIndex);
if (secondaryViewContent != null) {
secondaryViewContent.Deselected();
}
}
if (viewTabControl.SelectedIndex >= 0) {
IBaseViewContent secondaryViewContent = GetSubViewContent(viewTabControl.SelectedIndex);
if (secondaryViewContent != null) {
secondaryViewContent.SwitchedTo();
secondaryViewContent.Selected();
}
}
oldIndex = viewTabControl.SelectedIndex;
WorkbenchSingleton.Workbench.WorkbenchLayout.OnActiveWorkbenchWindowChanged(EventArgs.Empty);
ActiveViewContent.Control.Focus();
}
void viewTabControlDeselecting(object sender, TabControlCancelEventArgs e)
{
if (e.Action == TabControlAction.Deselecting && e.TabPageIndex >= 0) {
IBaseViewContent secondaryViewContent = GetSubViewContent(e.TabPageIndex);
if (secondaryViewContent != null) {
secondaryViewContent.Deselecting();
}
}
}
void viewTabControlDeselected(object sender, TabControlEventArgs e)
{
if (e.Action == TabControlAction.Deselected && e.TabPageIndex >= 0) {
IBaseViewContent secondaryViewContent = GetSubViewContent(e.TabPageIndex);
if (secondaryViewContent != null) {
secondaryViewContent.Deselected();
}
}
}
public virtual void RedrawContent()
{
if (viewTabControl != null) {

Loading…
Cancel
Save