Skip to content

Commit

Permalink
- Remove TFM below 462
Browse files Browse the repository at this point in the history
- Remove API Manipulation to support TFM below 462
- Fix Fallout from API removal
- Fix a few Compiler warning messages
Implements #290
  • Loading branch information
Smurf-IV committed Aug 24, 2021
1 parent 783bc4e commit 79fb4e2
Show file tree
Hide file tree
Showing 121 changed files with 4,048 additions and 5,067 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=DC/@EntryIndexedValue">DC</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=RI/@EntryIndexedValue">RI</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Coghlan/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Colour/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Wagnerp/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,8 @@ public void ShowPages(string[] uniqueNames)
}
}

using (DockingMultiUpdate update = new(this))
{
base.PropogateAction(DockingPropogateAction.ShowPages, uniqueNames);
}
using DockingMultiUpdate update = new(this);
base.PropogateAction(DockingPropogateAction.ShowPages, uniqueNames);
}
}

Expand All @@ -209,10 +207,8 @@ public void ShowPages(string[] uniqueNames)
/// </summary>
public void ShowAllPages()
{
using (DockingMultiUpdate update = new(this))
{
base.PropogateAction(DockingPropogateAction.ShowAllPages, (string[])null);
}
using DockingMultiUpdate update = new(this);
base.PropogateAction(DockingPropogateAction.ShowAllPages, (string[])null);
}

/// <summary>
Expand Down Expand Up @@ -307,10 +303,8 @@ public void HidePages(string[] uniqueNames)
}
}

using (DockingMultiUpdate update = new(this))
{
base.PropogateAction(DockingPropogateAction.HidePages, uniqueNames);
}
using DockingMultiUpdate update = new(this);
base.PropogateAction(DockingPropogateAction.HidePages, uniqueNames);
}
}

Expand All @@ -319,10 +313,8 @@ public void HidePages(string[] uniqueNames)
/// </summary>
public void HideAllPages()
{
using (DockingMultiUpdate update = new(this))
{
base.PropogateAction(DockingPropogateAction.HideAllPages, (string[])null);
}
using DockingMultiUpdate update = new(this);
base.PropogateAction(DockingPropogateAction.HideAllPages, (string[])null);
}

/// <summary>
Expand Down Expand Up @@ -409,10 +401,8 @@ public void RemovePages(string[] uniqueNames, bool disposePage)
}

// Remove page details from all parts of the hierarchy
using (DockingMultiUpdate update = new(this))
{
base.PropogateAction(disposePage ? DockingPropogateAction.RemoveAndDisposePages : DockingPropogateAction.RemovePages, uniqueNames);
}
using DockingMultiUpdate update = new(this);
base.PropogateAction(disposePage ? DockingPropogateAction.RemoveAndDisposePages : DockingPropogateAction.RemovePages, uniqueNames);
}
}

Expand All @@ -423,10 +413,8 @@ public void RemovePages(string[] uniqueNames, bool disposePage)
public void RemoveAllPages(bool disposePage)
{
// Remove all details about all pages from all parts of the hierarchy
using (DockingMultiUpdate update = new(this))
{
base.PropogateAction(disposePage ? DockingPropogateAction.RemoveAndDisposeAllPages : DockingPropogateAction.RemoveAllPages, (string[])null);
}
using DockingMultiUpdate update = new(this);
base.PropogateAction(disposePage ? DockingPropogateAction.RemoveAndDisposeAllPages : DockingPropogateAction.RemoveAllPages, (string[])null);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,8 @@ public void ShowPages(string[] uniqueNames)
}
}

using (DockingMultiUpdate update = new(this))
{
base.PropogateAction(DockingPropogateAction.ShowPages, uniqueNames);
}
using DockingMultiUpdate update = new(this);
base.PropogateAction(DockingPropogateAction.ShowPages, uniqueNames);
}
}

Expand All @@ -176,10 +174,8 @@ public void ShowPages(string[] uniqueNames)
/// </summary>
public void ShowAllPages()
{
using (DockingMultiUpdate update = new(this))
{
base.PropogateAction(DockingPropogateAction.ShowAllPages, (string[])null);
}
using DockingMultiUpdate update = new(this);
base.PropogateAction(DockingPropogateAction.ShowAllPages, (string[])null);
}

/// <summary>
Expand Down Expand Up @@ -274,10 +270,8 @@ public void HidePages(string[] uniqueNames)
}
}

using (DockingMultiUpdate update = new(this))
{
base.PropogateAction(DockingPropogateAction.HidePages, uniqueNames);
}
using DockingMultiUpdate update = new(this);
base.PropogateAction(DockingPropogateAction.HidePages, uniqueNames);
}
}

Expand All @@ -286,10 +280,8 @@ public void HidePages(string[] uniqueNames)
/// </summary>
public void HideAllPages()
{
using (DockingMultiUpdate update = new(this))
{
base.PropogateAction(DockingPropogateAction.HideAllPages, (string[])null);
}
using DockingMultiUpdate update = new(this);
base.PropogateAction(DockingPropogateAction.HideAllPages, (string[])null);
}

/// <summary>
Expand Down Expand Up @@ -376,10 +368,8 @@ public void RemovePages(string[] uniqueNames, bool disposePage)
}

// Remove page details from all parts of the hierarchy
using (DockingMultiUpdate update = new(this))
{
base.PropogateAction(disposePage ? DockingPropogateAction.RemoveAndDisposePages : DockingPropogateAction.RemovePages, uniqueNames);
}
using DockingMultiUpdate update = new(this);
base.PropogateAction(disposePage ? DockingPropogateAction.RemoveAndDisposePages : DockingPropogateAction.RemovePages, uniqueNames);
}
}

Expand All @@ -390,10 +380,8 @@ public void RemovePages(string[] uniqueNames, bool disposePage)
public void RemoveAllPages(bool disposePage)
{
// Remove all details about all pages from all parts of the hierarchy
using (DockingMultiUpdate update = new(this))
{
base.PropogateAction(disposePage ? DockingPropogateAction.RemoveAndDisposeAllPages : DockingPropogateAction.RemoveAllPages, (string[])null);
}
using DockingMultiUpdate update = new(this);
base.PropogateAction(disposePage ? DockingPropogateAction.RemoveAndDisposeAllPages : DockingPropogateAction.RemoveAllPages, (string[])null);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<Choose>
<When Condition="'$(TFMs)' == 'all'">
<PropertyGroup>
<TargetFrameworks>net462;net47;net471;net472;net48;netcoreapp3.1;net5.0-windows;net6.0-windows</TargetFrameworks>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<TargetFrameworks>net48;netcoreapp3.1;net5.0-windows;net6.0-windows</TargetFrameworks>
</PropertyGroup>
</Otherwise>
</Choose>
<PropertyGroup>
<TargetFrameworks>net462;net47;net471;net472;net48;netcoreapp3.1;net5.0-windows;net6.0-windows</TargetFrameworks>
<OutputType>Library</OutputType>
<RootNamespace>Krypton.Docking</RootNamespace>
<AssemblyName>Krypton.Docking</AssemblyName>
Expand Down Expand Up @@ -41,10 +30,6 @@
<SpecificVersion>True</SpecificVersion>
<Version>6.0.0.0</Version>
</Reference>
<Reference Include="System.Design" Condition="'$(TargetFramework)' == 'net35'">
<!--TODO: Need to specify version here-->
<!--<Version>6.0.0.0</Version>-->
</Reference>
</ItemGroup>

<PropertyGroup>
Expand Down Expand Up @@ -91,5 +76,5 @@
<PropertyGroup>
<NoWarn>1701;1702</NoWarn>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -133,22 +133,20 @@ protected override void OnLayout(LayoutEventArgs levent)
base.OnLayout(levent);

// Need a render context for accessing the renderer
using (RenderContext context = new(this, null, ClientRectangle, Renderer))
{
// Grab a path that is the outside edge of the border
Rectangle borderRect = ClientRectangle;
GraphicsPath borderPath1 = Renderer.RenderStandardBorder.GetOutsideBorderPath(context, borderRect, _navigator.StateNormal.HeaderGroup.Border, VisualOrientation.Top, PaletteState.Normal);
borderRect.Inflate(-1, -1);
GraphicsPath borderPath2 = Renderer.RenderStandardBorder.GetOutsideBorderPath(context, borderRect, _navigator.StateNormal.HeaderGroup.Border, VisualOrientation.Top, PaletteState.Normal);
borderRect.Inflate(-1, -1);
GraphicsPath borderPath3 = Renderer.RenderStandardBorder.GetOutsideBorderPath(context, borderRect, _navigator.StateNormal.HeaderGroup.Border, VisualOrientation.Top, PaletteState.Normal);

// Update the region of the popup to be the border path
Region = new Region(borderPath1);

// Inform the shadow to use the same paths for drawing the shadow
DefineShadowPaths(borderPath1, borderPath2, borderPath3);
}
using RenderContext context = new(this, null, ClientRectangle, Renderer);
// Grab a path that is the outside edge of the border
Rectangle borderRect = ClientRectangle;
GraphicsPath borderPath1 = Renderer.RenderStandardBorder.GetOutsideBorderPath(context, borderRect, _navigator.StateNormal.HeaderGroup.Border, VisualOrientation.Top, PaletteState.Normal);
borderRect.Inflate(-1, -1);
GraphicsPath borderPath2 = Renderer.RenderStandardBorder.GetOutsideBorderPath(context, borderRect, _navigator.StateNormal.HeaderGroup.Border, VisualOrientation.Top, PaletteState.Normal);
borderRect.Inflate(-1, -1);
GraphicsPath borderPath3 = Renderer.RenderStandardBorder.GetOutsideBorderPath(context, borderRect, _navigator.StateNormal.HeaderGroup.Border, VisualOrientation.Top, PaletteState.Normal);

// Update the region of the popup to be the border path
Region = new Region(borderPath1);

// Inform the shadow to use the same paths for drawing the shadow
DefineShadowPaths(borderPath1, borderPath2, borderPath3);
}
#endregion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,59 +219,57 @@ private void UpdateLayeredWindow(Rectangle rect)
{
// Draw onto a bitmap that is then used as the window display
Bitmap memoryBitmap = new(rect.Width, rect.Height, PixelFormat.Format32bppArgb);
using (Graphics g = Graphics.FromImage(memoryBitmap))
using Graphics g = Graphics.FromImage(memoryBitmap);
// Perform actual painting onto the bitmap
Rectangle area = new(0, 0, rect.Width, rect.Height);
using (RenderContext context = new(null, g, area, _renderer))
{
// Perform actual painting onto the bitmap
Rectangle area = new(0, 0, rect.Width, rect.Height);
using (RenderContext context = new(null, g, area, _renderer))
{
_renderer.RenderGlyph.DrawDragDropDockingGlyph(context, _dragData, _paletteDragDrop, PaletteDragFeedback.Rounded);
}

// Get hold of the screen DC
IntPtr hDC = PI.GetDC(IntPtr.Zero);

// Create a memory based DC compatible with the screen DC
IntPtr memoryDC = PI.CreateCompatibleDC(hDC);

// Get access to the bitmap handle contained in the Bitmap object
IntPtr hBitmap = memoryBitmap.GetHbitmap(Color.FromArgb(0));

// Select this bitmap for updating the window presentation
IntPtr oldBitmap = PI.SelectObject(memoryDC, hBitmap);

// New window size
PI.SIZE ulwsize;
ulwsize.cx = rect.Width;
ulwsize.cy = rect.Height;

// New window position
PI.POINT topPos = new(rect.Left,rect.Top);
// Offset into memory bitmap is always zero
PI.POINT pointSource = new(0, 0);

// We want to make the entire bitmap opaque
PI.BLENDFUNCTION blend = new()
{
BlendOp = PI.AC_SRC_OVER,
BlendFlags = 0,
SourceConstantAlpha = 255,
AlphaFormat = PI.AC_SRC_ALPHA
};

// Tell operating system to use our bitmap for painting
PI.UpdateLayeredWindow(Handle, hDC, ref topPos, ref ulwsize,
memoryDC, ref pointSource, 0, ref blend,
PI.ULW_ALPHA);

// Put back the old bitmap handle
PI.SelectObject(memoryDC, oldBitmap);

// Cleanup resources
PI.ReleaseDC(IntPtr.Zero, hDC);
PI.DeleteObject(hBitmap);
PI.DeleteDC(memoryDC);
_renderer.RenderGlyph.DrawDragDropDockingGlyph(context, _dragData, _paletteDragDrop, PaletteDragFeedback.Rounded);
}

// Get hold of the screen DC
IntPtr hDC = PI.GetDC(IntPtr.Zero);

// Create a memory based DC compatible with the screen DC
IntPtr memoryDC = PI.CreateCompatibleDC(hDC);

// Get access to the bitmap handle contained in the Bitmap object
IntPtr hBitmap = memoryBitmap.GetHbitmap(Color.FromArgb(0));

// Select this bitmap for updating the window presentation
IntPtr oldBitmap = PI.SelectObject(memoryDC, hBitmap);

// New window size
PI.SIZE ulwsize;
ulwsize.cx = rect.Width;
ulwsize.cy = rect.Height;

// New window position
PI.POINT topPos = new(rect.Left,rect.Top);
// Offset into memory bitmap is always zero
PI.POINT pointSource = new(0, 0);

// We want to make the entire bitmap opaque
PI.BLENDFUNCTION blend = new()
{
BlendOp = PI.AC_SRC_OVER,
BlendFlags = 0,
SourceConstantAlpha = 255,
AlphaFormat = PI.AC_SRC_ALPHA
};

// Tell operating system to use our bitmap for painting
PI.UpdateLayeredWindow(Handle, hDC, ref topPos, ref ulwsize,
memoryDC, ref pointSource, 0, ref blend,
PI.ULW_ALPHA);

// Put back the old bitmap handle
PI.SelectObject(memoryDC, oldBitmap);

// Cleanup resources
PI.ReleaseDC(IntPtr.Zero, hDC);
PI.DeleteObject(hBitmap);
PI.DeleteDC(memoryDC);
}
}
#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,19 +176,15 @@ public void MouseReset()
#region Implementation
private void DropIndicators_Paint(object sender, PaintEventArgs e)
{
using(RenderContext context = new(this, e.Graphics, e.ClipRectangle, _renderer))
{
_renderer.RenderGlyph.DrawDragDropDockingGlyph(context, _dragData, _paletteDragDrop, PaletteDragFeedback.Square);
}
using RenderContext context = new(this, e.Graphics, e.ClipRectangle, _renderer);
_renderer.RenderGlyph.DrawDragDropDockingGlyph(context, _dragData, _paletteDragDrop, PaletteDragFeedback.Square);
}

private void DrawPath(Graphics g, Color baseColor, GraphicsPath path)
{
// Draw a smooth outline around the circle
using(Pen outline = new(baseColor))
{
g.DrawPath(outline, path);
}
using Pen outline = new(baseColor);
g.DrawPath(outline, path);
}
#endregion
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,8 @@ protected override void OnPaint(PaintEventArgs e)
// If we have a solid rectangle to draw
if (!SolidRect.IsEmpty)
{
using (RenderContext context = new(this, e.Graphics, e.ClipRectangle, _renderer))
{
_renderer.RenderGlyph.DrawDragDropSolidGlyph(context, ClientRectangle, _paletteDragDrop);
}
using RenderContext context = new(this, e.Graphics, e.ClipRectangle, _renderer);
_renderer.RenderGlyph.DrawDragDropSolidGlyph(context, ClientRectangle, _paletteDragDrop);
}
}

Expand Down
Loading

0 comments on commit 79fb4e2

Please sign in to comment.