Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
punker76 committed Sep 8, 2022
2 parents cdb5251 + a193f96 commit ac024bb
Show file tree
Hide file tree
Showing 40 changed files with 777 additions and 12,000 deletions.
2 changes: 1 addition & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
assembly-versioning-scheme: Major
assembly-file-versioning-scheme: MajorMinorPatchTag
next-version: 3.1.0
next-version: 3.2.0
mode: ContinuousDeployment
branches:
master:
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<div align="center">
[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://vshymanskyy.github.io/StandWithUkraine)

<div align="center">
<br />
<a href="https://github.com/punker76/gong-wpf-dragdrop">
<img alt="gong-wpf-dragdrop" width="700" heigth="142" src="./GongSolutions.Wpf.DragDrop.Full.png">
</a>
Expand Down Expand Up @@ -42,7 +44,6 @@
</a>
<br />
<br />

</div>

## Features
Expand Down
5 changes: 3 additions & 2 deletions XamlStyler/Options/XAMLStyler.json → Settings.XAMLStyler
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"IndentSize": 4,
"AttributesTolerance": 2,
"KeepFirstAttributeOnSameLine": true,
"MaxAttributeCharatersPerLine": 0,
"MaxAttributeCharactersPerLine": 0,
"MaxAttributesPerLine": 1,
"NewlineExemptionElements": "RadialGradientBrush, GradientStop, LinearGradientBrush, ScaleTransform, SkewTransform, RotateTransform, TranslateTransform, Trigger, MultiTrigger, DataTrigger, MultiDataTrigger, Condition, Setter, SolidColorBrush",
"NewlineExemptionElements": "RadialGradientBrush, GradientStop, LinearGradientBrush, ScaleTransform, SkewTransform, RotateTransform, TranslateTransform, Trigger, MultiTrigger, DataTrigger, MultiDataTrigger, Condition, Setter, SolidColorBrush, Pen",
"SeparateByGroups": false,
"AttributeIndentation": 0,
"AttributeIndentationStyle": 1,
Expand All @@ -15,6 +15,7 @@
"xmlns, xmlns:x",
"xmlns:*",
"x:Key, Key, x:Name, Name, x:Uid, Uid, Title",
"TargetType, BasedOn",
"Grid.Row, Grid.RowSpan, Grid.Column, Grid.ColumnSpan, Canvas.Left, Canvas.Top, Canvas.Right, Canvas.Bottom",
"Width, Height, MinWidth, MinHeight, MaxWidth, MaxHeight",
"Margin, Padding, HorizontalAlignment, VerticalAlignment, HorizontalContentAlignment, VerticalContentAlignment, Panel.ZIndex",
Expand Down
Binary file removed XamlStyler/CommandLine.dll
Binary file not shown.
1,390 changes: 0 additions & 1,390 deletions XamlStyler/CommandLine.xml

This file was deleted.

Binary file removed XamlStyler/Irony.dll
Binary file not shown.
753 changes: 0 additions & 753 deletions XamlStyler/Irony.xml

This file was deleted.

Binary file removed XamlStyler/Newtonsoft.Json.dll
Binary file not shown.
9,112 changes: 0 additions & 9,112 deletions XamlStyler/Newtonsoft.Json.xml

This file was deleted.

41 changes: 0 additions & 41 deletions XamlStyler/Options/DefaultSettings.json

This file was deleted.

41 changes: 0 additions & 41 deletions XamlStyler/Settings.XamlStyler

This file was deleted.

Binary file removed XamlStyler/XamlStyler.Core.dll
Binary file not shown.
1 change: 0 additions & 1 deletion XamlStyler/format_all_xaml.cmd

This file was deleted.

Binary file removed XamlStyler/xstyler.exe
Binary file not shown.
6 changes: 0 additions & 6 deletions XamlStyler/xstyler.exe.config

This file was deleted.

17 changes: 17 additions & 0 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#tool dotnet:?package=AzureSignTool&version=3.0.0
#tool dotnet:?package=GitReleaseManager.Tool&version=0.12.1
#tool dotnet:?package=GitVersion.Tool&version=5.6.3
#tool dotnet:?package=XamlStyler.Console&version=3.2008.4

#tool vswhere&version=2.8.4
#addin nuget:?package=Cake.Figlet&version=2.0.1
Expand All @@ -26,6 +27,9 @@ var srcDir = baseDir + "/src";
var solution = srcDir + "/GongSolutions.WPF.DragDrop.sln";
var publishDir = baseDir + "/Publish";

var styler = Context.Tools.Resolve("xstyler.exe");
var stylerFile = baseDir + "/Settings.XAMLStyler";

public class BuildData
{
public string Configuration { get; }
Expand Down Expand Up @@ -360,6 +364,18 @@ Task("Zip")
Zip($"./src/Showcase/bin/{data.Configuration}", $"{publishDir}/Showcase.DragDrop.{data.Configuration}-v" + data.GitVersion.NuGetVersion + ".zip");
});

Task("StyleXaml")
.Description("Ensures XAML Formatting is Clean")
.Does(() =>
{
Func<IFileSystemInfo, bool> exclude_Dir =
fileSystemInfo => !fileSystemInfo.Path.Segments.Contains("obj");

var files = GetFiles(srcDir + "/**/*.xaml", new GlobberSettings { Predicate = exclude_Dir });
Information("\nChecking " + files.Count() + " file(s) for XAML Structure");
StartProcess(styler, "-f \"" + string.Join(",", files.Select(f => f.ToString())) + "\" -c \"" + stylerFile + "\"");
});

Task("CreateRelease")
.WithCriteria<BuildData>((context, data) => !data.IsPullRequest)
.Does<BuildData>(data =>
Expand All @@ -386,6 +402,7 @@ Task("CreateRelease")
Task("Default")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.IsDependentOn("StyleXaml")
.IsDependentOn("Build")
;

Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "6.0.100",
"rollForward": "latestFeature"
"version": "6.0.300",
"rollForward": "feature"
}
}
11 changes: 10 additions & 1 deletion src/GongSolutions.WPF.DragDrop/DefaultDropHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,11 @@ public virtual void Drop(IDropInfo dropInfo)
var obj2Insert = o;
if (cloneData)
{
if (o is ICloneable cloneable)
if (o is ICloneableDragItem cloneableItem)
{
obj2Insert = cloneableItem.CloneItem(dropInfo);
}
else if (o is ICloneable cloneable)
{
obj2Insert = cloneable.Clone();
}
Expand All @@ -322,6 +326,11 @@ public virtual void Drop(IDropInfo dropInfo)
{
destinationList.Insert(insertIndex++, obj2Insert);
}

if (obj2Insert is IDragItemSource dragItemSource)
{
dragItemSource.ItemDropped(dropInfo);
}
}

SelectDroppedItems(dropInfo, objects2Insert);
Expand Down
19 changes: 10 additions & 9 deletions src/GongSolutions.WPF.DragDrop/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,29 @@

<!-- SourceLink -->
<PropertyGroup>
<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>

<!-- Optional: Declare that the Repository URL can be published to NuSpec -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>

<!-- Optional: Embed source files that are not tracked by the source control manager to the PDB -->
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<!-- By using EmbedAllSources we don't need SourceLink itself -->
<!-- https://github.com/dotnet/sourcelink/blob/master/docs/README.md#embedallsources -->
<EmbedAllSources>true</EmbedAllSources>
</PropertyGroup>

<!-- Optional: Build symbol package (.snupkg) to distribute the PDB containing Source Link -->
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<!-- PDB-Options -->
<PropertyGroup>
<DebugSymbols>true</DebugSymbols>
<DebugType>Embedded</DebugType>
</PropertyGroup>

<!-- reference includes -->
<ItemGroup>
<!-- <ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

-->
<ItemGroup>
<SourceRoot Include="$(NuGetPackageRoot)" Condition="'$(NuGetPackageRoot)' != ''" />
</ItemGroup>
Expand Down
19 changes: 12 additions & 7 deletions src/GongSolutions.WPF.DragDrop/DragDrop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ private static void DragSourceDown(object sender, DragInfo dragInfo, InputEventA
// already selected item does not change the selection, otherwise dragging multiple items
// is made impossible.
if ((Keyboard.Modifiers & ModifierKeys.Shift) == 0
&& (Keyboard.Modifiers & ModifierKeys.Control) == 0
//&& (Keyboard.Modifiers & ModifierKeys.Control) == 0 // #432
&& dragInfo.VisualSourceItem != null
&& sender is ItemsControl itemsControl
&& itemsControl.CanSelectMultipleItems())
Expand Down Expand Up @@ -627,8 +627,6 @@ private static void DoDragSourceMove(object sender, Func<IInputElement, Point> g
dataObject = new DataObject(dragInfo.DataFormat.Name, dragInfo.Data);
}

var hookId = IntPtr.Zero;

try
{
_dragInProgress = true;
Expand All @@ -639,10 +637,17 @@ private static void DoDragSourceMove(object sender, Func<IInputElement, Point> g
DragDropPreview?.Move(getPosition(DragDropPreview.PlacementTarget));
}

hookId = MouseHelper.HookMouseMove(point =>
MouseHelper.HookMouseMove(point =>
{
DragDropPreview?.Move(CursorHelper.GetCurrentCursorPosition(DragDropPreview.PlacementTarget, point));
DragDropEffectPreview?.Move(CursorHelper.GetCurrentCursorPosition(DragDropEffectPreview.PlacementTarget, point));
if (DragDropPreview?.PlacementTarget != null)
{
DragDropPreview.Move(DragDropPreview.PlacementTarget.PointFromScreen(point));
}

if (DragDropEffectPreview?.PlacementTarget != null)
{
DragDropEffectPreview.Move(DragDropEffectPreview.PlacementTarget.PointFromScreen(point));
}
});

var dragDropHandler = dragInfo.DragDropHandler ?? System.Windows.DragDrop.DoDragDrop;
Expand All @@ -663,7 +668,7 @@ private static void DoDragSourceMove(object sender, Func<IInputElement, Point> g
}
finally
{
MouseHelper.RemoveHook(hookId);
MouseHelper.UnHook();
_dragInProgress = false;
_dragInfo = null;
}
Expand Down
Loading

0 comments on commit ac024bb

Please sign in to comment.