Permalink
Browse files

Merged SharpDevelop patches into a new branch for further review.

  • Loading branch information...
lextm committed May 26, 2012
1 parent 101b2f2 commit 84213f6cb5c575dc7b2f906511eff5dd0cadd9f3
@@ -704,7 +704,9 @@ internal void SetVisible()
else
visible = Form.Visible;
- if (Form.Visible != visible)
+ // when Form.Parent.Visible==false, Form.Visible cannot be read correctly (but returns always false),
+ // so we have to always assign the new visibility in those cases
+ if (Form.Visible != visible || (Form.Parent != null && !Form.Parent.Visible))

This comment has been minimized.

Show comment
Hide comment
@roken

roken Jun 17, 2012

Member

Rather than make the check more complicated, there is no reason to make the check at all. Simply make the assignment, the framework will discard the new value if the core visible value is not changing.

@roken

roken Jun 17, 2012

Member

Rather than make the check more complicated, there is no reason to make the check at all. Simply make the assignment, the framework will discard the new value if the core visible value is not changing.

Form.Visible = visible;
}
@@ -758,6 +760,8 @@ public void Show(DockPanel dockPanel)
if (DockState == DockState.Unknown)
Show(dockPanel, DefaultShowState);
+ else if (Pane == null)
+ Show(dockPanel, DockState == DockState.Hidden ? DefaultShowState : DockState);

This comment has been minimized.

Show comment
Hide comment
@roken

roken Jun 17, 2012

Member

This may be the only "fix" in here. However, I have yet to determine what situation it was addressing.

@roken

roken Jun 17, 2012

Member

This may be the only "fix" in here. However, I have yet to determine what situation it was addressing.

else
Activate();
}
@@ -165,9 +165,13 @@ public void Activate(IDockContent content)
ContentActivating = content;
return;
}
-
+
if (content == null)
return;
+
+ if (content.IsDisposed)
+ return;

This comment has been minimized.

Show comment
Hide comment
@roken

roken Jun 17, 2012

Member

This IsDiposed check already exists in the current baseline.

@roken

roken Jun 17, 2012

Member

This IsDiposed check already exists in the current baseline.

+
DockContentHandler handler = content.DockHandler;
if (handler.Form.IsDisposed)
return; // Should not reach here, but better than throwing an exception
@@ -637,9 +637,8 @@ protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
- Graphics g = e.Graphics;
- SolidBrush bgBrush = new SolidBrush(DockBackColor);
- g.FillRectangle(bgBrush, ClientRectangle);
+ Graphics g = e.Graphics;
+ g.FillRectangle(SystemBrushes.AppWorkspace, ClientRectangle);

This comment has been minimized.

Show comment
Hide comment
@roken

roken Jun 17, 2012

Member

This color change, if desired, should be done by updating DockBackColor, not by hardcoding it into the dockpanel.

@roken

roken Jun 17, 2012

Member

This color change, if desired, should be done by updating DockBackColor, not by hardcoding it into the dockpanel.

}
internal void AddContent(IDockContent content)
@@ -1003,4 +1002,4 @@ protected virtual void OnContentRemoved(DockContentEventArgs e)
handler(this, e);
}
}
-}
+}
@@ -7,6 +7,7 @@ namespace WeifenLuo.WinFormsUI.Docking
public interface IDockContent
{
DockContentHandler DockHandler { get; }
+ bool IsDisposed { get; }

This comment has been minimized.

Show comment
Hide comment
@roken

roken Jun 17, 2012

Member

Unnecessary, not used within docking library. If end user needs access to this field they will simply need to cast the IDockContent to a Form.

@roken

roken Jun 17, 2012

Member

Unnecessary, not used within docking library. If end user needs access to this field they will simply need to cast the IDockContent to a Form.

}
public interface INestedPanesContainer
@@ -373,6 +373,7 @@ private void DrawCaption(Graphics g)
{
g.FillRectangle(brush, ClientRectangle);
}
+ g.DrawRectangle(SystemPens.ControlDark, new Rectangle(0, 0, ClientSize.Width - 1, ClientSize.Height - 1));

This comment has been minimized.

Show comment
Hide comment
@roken

roken Jun 17, 2012

Member

This border does not exist in Visual Studio 2005 but does in 2008. If we want to include the border we should include it for the active caption as well and provide access to the color via the skin.

@roken

roken Jun 17, 2012

Member

This border does not exist in Visual Studio 2005 but does in 2008. If we want to include the border we should include it for the active caption as well and provide access to the color via the skin.

This comment has been minimized.

Show comment
Hide comment
@lextm

lextm Jun 18, 2012

Member

So we might consider this border once we are going to provide a Visual Studio 2008 skin. Agreed not to merge this to master.

@lextm

lextm Jun 18, 2012

Member

So we might consider this border once we are going to provide a Visual Studio 2008 skin. Agreed not to merge this to master.

}
Rectangle rectCaption = ClientRectangle;
@@ -470,6 +471,8 @@ private void Close_Click(object sender, EventArgs e)
private void AutoHide_Click(object sender, EventArgs e)
{
DockPane.DockState = DockHelper.ToggleAutoHideState(DockPane.DockState);
+ if (DockHelper.IsDockStateAutoHide(DockPane.DockState))
+ DockPane.DockPanel.ActiveAutoHideContent = null;

This comment has been minimized.

Show comment
Hide comment
@roken

roken May 29, 2012

Member

These two lines are addressing the same issue that has already been resolved by commit 34efe35 in v2.6 and need not be included.

@roken

roken May 29, 2012

Member

These two lines are addressing the same issue that has already been resolved by commit 34efe35 in v2.6 and need not be included.

}
private void Options_Click(object sender, EventArgs e)
@@ -308,7 +308,7 @@ private TextFormatFlags ToolWindowTextFormat
return textFormat;
}
}
-
+
private static int DocumentStripGapTop
{
get { return _DocumentStripGapTop; }
@@ -322,18 +322,36 @@ private static int DocumentStripGapBottom
private TextFormatFlags DocumentTextFormat
{
get
- {
- TextFormatFlags textFormat = TextFormatFlags.EndEllipsis |
+ {
+ TextFormatFlags textFormat = TextFormatFlags.PathEllipsis |
TextFormatFlags.SingleLine |
TextFormatFlags.VerticalCenter |
+ TextFormatFlags.PreserveGraphicsClipping |
TextFormatFlags.HorizontalCenter;
- if (RightToLeft == RightToLeft.Yes)
- return textFormat | TextFormatFlags.RightToLeft;
- else
- return textFormat;
+ if (RightToLeft == RightToLeft.Yes)
+ return textFormat | TextFormatFlags.RightToLeft;
+ else
+ return textFormat;
}
}
-
+
+ private StringFormat DocumentStringFormat
+ {
+ get
+ {
+ StringFormat format = new StringFormat();
+ format.Alignment = StringAlignment.Center;
+ format.LineAlignment = StringAlignment.Center;
+ format.FormatFlags = StringFormatFlags.NoWrap | StringFormatFlags.NoClip;
+ format.Trimming = StringTrimming.EllipsisPath;
+
+ if (RightToLeft == RightToLeft.Yes)
+ format.FormatFlags |= StringFormatFlags.DirectionRightToLeft;
+
+ return format;
+ }
+ }
+
private static int DocumentTabMaxWidth
{
get { return _DocumentTabMaxWidth; }
@@ -421,7 +439,7 @@ private static Pen PenDocumentTabInactiveBorder
private static Brush BrushToolWindowActiveBackground
{
- get { return SystemBrushes.Control; }
+ get { return SystemBrushes.ControlLightLight; }

This comment has been minimized.

Show comment
Hide comment
@lextm

lextm Jun 3, 2012

Member

This color change seems to be very useful to me, as it matches Visual Studio's style. I'd like to see this being merged.

@lextm

lextm Jun 3, 2012

Member

This color change seems to be very useful to me, as it matches Visual Studio's style. I'd like to see this being merged.

This comment has been minimized.

Show comment
Hide comment
@roken

roken Jun 17, 2012

Member

Thie BrushToolWindowActiveBackground property seems to have been removed since SharpDevelop made their branch. In general, the diffs for this file seem to undo changes made a while back.

@roken

roken Jun 17, 2012

Member

Thie BrushToolWindowActiveBackground property seems to have been removed since SharpDevelop made their branch. In general, the diffs for this file seem to undo changes made a while back.

This comment has been minimized.

Show comment
Hide comment
@roken

roken Jun 17, 2012

Member

This seems to be the only actual change between the current baseline and the changes SharpDevelop made in their branch. I believe the other changes were to fix the tab text from being cut off, which was fixed by commit 58aef08 after they made their branch.

That said, this property no longer exists.

@roken

roken Jun 17, 2012

Member

This seems to be the only actual change between the current baseline and the changes SharpDevelop made in their branch. I believe the other changes were to fix the tab text from being cut off, which was fixed by commit 58aef08 after they made their branch.

That said, this property no longer exists.

}
private static Brush BrushDocumentActiveBackground
@@ -833,7 +851,11 @@ private int GetMaxTabWidth_Document(int index)
int height = GetTabRectangle_Document(index).Height;
- Size sizeText = TextRenderer.MeasureText(content.DockHandler.TabText, BoldFont, new Size(DocumentTabMaxWidth, height), DocumentTextFormat);
+ Size sizeText;
+ using (Graphics g = CreateGraphics()) {
+ SizeF sizeTextF = g.MeasureString(content.DockHandler.TabText, BoldFont, new Size(DocumentTabMaxWidth, height), DocumentStringFormat);
+ sizeText = new Size((int)Math.Ceiling(sizeTextF.Width), (int)Math.Ceiling(sizeTextF.Height));
+ }
if (DockPane.DockPanel.ShowDocumentIcon)
return sizeText.Width + DocumentIconWidth + DocumentIconGapLeft + DocumentIconGapRight + DocumentTextGapRight;
@@ -1043,7 +1065,7 @@ private void DrawTab_ToolWindow(Graphics g, TabVS2005 tab, Rectangle rect)
{
g.FillPath(BrushToolWindowActiveBackground, path);
g.DrawPath(PenToolWindowTabBorder, path);
- TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText, ColorToolWindowActiveText, ToolWindowTextFormat);
+ TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText, ColorToolWindowActiveText, ToolWindowTextFormat);
}
else
{
@@ -1089,17 +1111,24 @@ private void DrawTab_Document(Graphics g, TabVS2005 tab, Rectangle rect)
{
g.FillPath(BrushDocumentActiveBackground, path);
g.DrawPath(PenDocumentTabActiveBorder, path);
- if (DockPane.IsActiveDocumentPane)
- TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, BoldFont, rectText, ColorDocumentActiveText, DocumentTextFormat);
- else
- TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText, ColorDocumentActiveText, DocumentTextFormat);
- }
- else
- {
- g.FillPath(BrushDocumentInactiveBackground, path);
- g.DrawPath(PenDocumentTabInactiveBorder, path);
- TextRenderer.DrawText(g, tab.Content.DockHandler.TabText, TextFont, rectText, ColorDocumentInactiveText, DocumentTextFormat);
- }
+ if (DockPane.IsActiveDocumentPane) {
+ using (SolidBrush brush = new SolidBrush(ColorDocumentActiveText))
+ g.DrawString(tab.Content.DockHandler.TabText, BoldFont, brush,
+ rectText, DocumentStringFormat);
+ } else {
+ using (SolidBrush brush = new SolidBrush(ColorDocumentActiveText))
+ g.DrawString(tab.Content.DockHandler.TabText, TextFont, brush,
+ rectText, DocumentStringFormat);
+ }
+ }
+ else
+ {
+ g.FillPath(BrushDocumentInactiveBackground, path);
+ g.DrawPath(PenDocumentTabInactiveBorder, path);
+ using (SolidBrush brush = new SolidBrush(ColorDocumentInactiveText))
+ g.DrawString(tab.Content.DockHandler.TabText, TextFont, brush,
+ rectText, DocumentStringFormat);
+ }
if (rectTab.Contains(rectIcon) && DockPane.DockPanel.ShowDocumentIcon)
g.DrawIcon(tab.Content.DockHandler.Icon, rectIcon);

0 comments on commit 84213f6

Please sign in to comment.