Skip to content
Browse files

Merged SharpDevelop patches into a new branch for further review.

  • Loading branch information...
1 parent 101b2f2 commit 84213f6cb5c575dc7b2f906511eff5dd0cadd9f3 @lextm lextm committed May 26, 2012
View
6 WinFormsUI/Docking/DockContentHandler.cs
@@ -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))
@roken
DockPanel Suite member
roken added a note Jun 17, 2012

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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);
@roken
DockPanel Suite member
roken added a note Jun 17, 2012

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
else
Activate();
}
View
6 WinFormsUI/Docking/DockPanel.FocusManager.cs
@@ -165,9 +165,13 @@ public void Activate(IDockContent content)
ContentActivating = content;
return;
}
-
+
if (content == null)
return;
+
+ if (content.IsDisposed)
+ return;
@roken
DockPanel Suite member
roken added a note Jun 17, 2012

This IsDiposed check already exists in the current baseline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+
DockContentHandler handler = content.DockHandler;
if (handler.Form.IsDisposed)
return; // Should not reach here, but better than throwing an exception
View
7 WinFormsUI/Docking/DockPanel.cs
@@ -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);
@roken
DockPanel Suite member
roken added a note Jun 17, 2012

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
}
internal void AddContent(IDockContent content)
@@ -1003,4 +1002,4 @@ protected virtual void OnContentRemoved(DockContentEventArgs e)
handler(this, e);
}
}
-}
+}
View
1 WinFormsUI/Docking/Interfaces.cs
@@ -7,6 +7,7 @@ namespace WeifenLuo.WinFormsUI.Docking
public interface IDockContent
{
DockContentHandler DockHandler { get; }
+ bool IsDisposed { get; }
@roken
DockPanel Suite member
roken added a note Jun 17, 2012

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
}
public interface INestedPanesContainer
View
3 WinFormsUI/Docking/VS2005DockPaneCaption.cs
@@ -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));
@roken
DockPanel Suite member
roken added a note Jun 17, 2012

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.

@lextm
DockPanel Suite member
lextm added a note Jun 18, 2012

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
}
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;
@roken
DockPanel Suite member
roken added a note May 29, 2012

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
}
private void Options_Click(object sender, EventArgs e)
View
73 WinFormsUI/Docking/VS2005DockPaneStrip.cs
@@ -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; }
@lextm
DockPanel Suite member
lextm added a note Jun 3, 2012

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.

@roken
DockPanel Suite member
roken added a note Jun 17, 2012

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
DockPanel Suite member
roken added a note Jun 17, 2012

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
}
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.
Something went wrong with that request. Please try again.