Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Savablz 🎉 #210

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Dragablz.Test/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Dragablz.Test")]
Expand All @@ -14,8 +14,8 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

Expand All @@ -25,11 +25,11 @@
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
Expand Down
21 changes: 20 additions & 1 deletion Dragablz.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2026
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dragablz.net45", "Dragablz\Dragablz.net45.csproj", "{7B11011C-7FD7-4AB0-A1AD-04E940B026DE}"
ProjectSection(ProjectDependencies) = postProject
{B127C87D-C212-40D1-895E-3B6341E81C21} = {B127C87D-C212-40D1-895E-3B6341E81C21}
Expand All @@ -14,6 +16,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dragablz.net40", "Dragablz\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DragablzDemo.net40", "DragablzDemo\DragablzDemo.net40.csproj", "{B127C87D-C212-40D1-895E-3B6341E81C21}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DragablzSaveDemo", "DragablzSaveDemo\DragablzSaveDemo.csproj", "{6709408B-A312-4CA3-B687-0FD22B5BFCF8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -74,8 +78,23 @@ Global
{B127C87D-C212-40D1-895E-3B6341E81C21}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{B127C87D-C212-40D1-895E-3B6341E81C21}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{B127C87D-C212-40D1-895E-3B6341E81C21}.Release|x86.ActiveCfg = Release|Any CPU
{6709408B-A312-4CA3-B687-0FD22B5BFCF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6709408B-A312-4CA3-B687-0FD22B5BFCF8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6709408B-A312-4CA3-B687-0FD22B5BFCF8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{6709408B-A312-4CA3-B687-0FD22B5BFCF8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{6709408B-A312-4CA3-B687-0FD22B5BFCF8}.Debug|x86.ActiveCfg = Debug|Any CPU
{6709408B-A312-4CA3-B687-0FD22B5BFCF8}.Debug|x86.Build.0 = Debug|Any CPU
{6709408B-A312-4CA3-B687-0FD22B5BFCF8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6709408B-A312-4CA3-B687-0FD22B5BFCF8}.Release|Any CPU.Build.0 = Release|Any CPU
{6709408B-A312-4CA3-B687-0FD22B5BFCF8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{6709408B-A312-4CA3-B687-0FD22B5BFCF8}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{6709408B-A312-4CA3-B687-0FD22B5BFCF8}.Release|x86.ActiveCfg = Release|Any CPU
{6709408B-A312-4CA3-B687-0FD22B5BFCF8}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {14740FC0-D2AE-4AD5-A428-D00E52009FFD}
EndGlobalSection
EndGlobal
8 changes: 4 additions & 4 deletions Dragablz/CanvasOrganiser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class CanvasOrganiser : IItemsOrganiser
{
public virtual void Organise(DragablzItemsControl requestor, Size measureBounds, IEnumerable<DragablzItem> items)
{

}

public virtual void Organise(DragablzItemsControl requestor, Size measureBounds, IOrderedEnumerable<DragablzItem> items)
Expand All @@ -31,17 +31,17 @@ public virtual void OrganiseOnMouseDownWithin(DragablzItemsControl requestor, Si

public virtual void OrganiseOnDragStarted(DragablzItemsControl requestor, Size measureBounds, IEnumerable<DragablzItem> siblingItems, DragablzItem dragItem)
{

}

public virtual void OrganiseOnDrag(DragablzItemsControl requestor, Size measureBounds, IEnumerable<DragablzItem> siblingItems, DragablzItem dragItem)
{

}

public virtual void OrganiseOnDragCompleted(DragablzItemsControl requestor, Size measureBounds, IEnumerable<DragablzItem> siblingItems, DragablzItem dragItem)
{

}

public virtual Point ConstrainLocation(DragablzItemsControl requestor, Size measureBounds, Point itemCurrentLocation, Size itemCurrentSize, Point itemDesiredLocation, Size itemDesiredSize)
Expand Down
6 changes: 3 additions & 3 deletions Dragablz/Converters/BooleanAndToVisibilityConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ public object Convert(object[] values, Type targetType, object parameter, Cultur
{
if (values == null)
return Visibility.Collapsed;
return values.Select(GetBool).All(b => b)

return values.Select(GetBool).All(b => b)
? Visibility.Visible
: Visibility.Collapsed;
}
Expand All @@ -29,7 +29,7 @@ private static bool GetBool(object value)
{
return (bool)value;
}

return false;
}
}
Expand Down
6 changes: 3 additions & 3 deletions Dragablz/Converters/ShowDefaultCloseButtonConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ public class ShowDefaultCloseButtonConverter : IMultiValueConverter
/// <returns></returns>
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
return ((values[0] == DependencyProperty.UnsetValue ? false : (bool)values[0]) &&
(values[2] == DependencyProperty.UnsetValue ? 0 : (int)values[2]) >=
return ((values[0] == DependencyProperty.UnsetValue ? false : (bool)values[0]) &&
(values[2] == DependencyProperty.UnsetValue ? 0 : (int)values[2]) >=
(values[1] == DependencyProperty.UnsetValue ? 0 : (int)values[1])) ? Visibility.Visible : Visibility.Collapsed;
}

public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
return null;
return null;
}
}
}
6 changes: 3 additions & 3 deletions Dragablz/Core/CollectionTeaser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ internal class CollectionTeaser
private readonly Action<object> _removeMethod;

private CollectionTeaser(Action<object> addMethod, Action<object> removeMethod)
{
{
_addMethod = addMethod;
_removeMethod = removeMethod;
}
Expand All @@ -23,7 +23,7 @@ public static bool TryCreate(object items, out CollectionTeaser collectionTeaser
var list = items as IList;
if (list != null)
{
collectionTeaser = new CollectionTeaser(i => list.Add(i), list.Remove);
collectionTeaser = new CollectionTeaser(i => list.Add(i), list.Remove);
}
else if (items != null)
{
Expand All @@ -48,7 +48,7 @@ public static bool TryCreate(object items, out CollectionTeaser collectionTeaser
i => removeMethodInfo.Invoke(items, new[] {i}));
}
}

return collectionTeaser != null;
}

Expand Down
14 changes: 7 additions & 7 deletions Dragablz/Core/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ public static IEnumerable<TContainer> Containers<TContainer>(this ItemsControl i
#endif
#if NET40
var fieldInfo = typeof(ItemContainerGenerator).GetField("_items", BindingFlags.NonPublic | BindingFlags.Instance);
var list = (IList)fieldInfo.GetValue(itemsControl.ItemContainerGenerator);
var list = (IList)fieldInfo.GetValue(itemsControl.ItemContainerGenerator);
for (var i = 0; i < list.Count; i++)
#endif
{
var container = itemsControl.ItemContainerGenerator.ContainerFromIndex(i) as TContainer;
if (container != null)
yield return container;
}
}
}

public static IEnumerable<TObject> Except<TObject>(this IEnumerable<TObject> first, params TObject[] second)
Expand All @@ -41,7 +41,7 @@ public static IEnumerable<object> LogicalTreeDepthFirstTraversal(this Dependency
yield return node;

foreach (var child in LogicalTreeHelper.GetChildren(node).OfType<DependencyObject>()
.SelectMany(depObj => depObj.LogicalTreeDepthFirstTraversal()))
.SelectMany(depObj => depObj.LogicalTreeDepthFirstTraversal()))
yield return child;
}

Expand Down Expand Up @@ -73,7 +73,7 @@ public static IEnumerable<DependencyObject> VisualTreeAncestory(this DependencyO
{
yield return dependencyObject;
dependencyObject = VisualTreeHelper.GetParent(dependencyObject);
}
}
}

/// <summary>
Expand All @@ -91,9 +91,9 @@ public static IEnumerable<DependencyObject> LogicalTreeAncestory(this Dependency
dependencyObject = LogicalTreeHelper.GetParent(dependencyObject);
}
}

/// <summary>
/// Returns the actual Left of the Window independently from the WindowState
/// Returns the actual Left of the Window independently from the LayoutWindowState
/// </summary>
/// <param name="window"></param>
/// <returns></returns>
Expand All @@ -109,7 +109,7 @@ public static double GetActualLeft(this Window window)
}

/// <summary>
/// Returns the actual Top of the Window independently from the WindowState
/// Returns the actual Top of the Window independently from the LayoutWindowState
/// </summary>
/// <param name="window"></param>
/// <returns></returns>
Expand Down
2 changes: 1 addition & 1 deletion Dragablz/Core/FuncComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ internal class FuncComparer<TObject> : IComparer<TObject>
public FuncComparer(Func<TObject, TObject, int> comparer)
{
if (comparer == null) throw new ArgumentNullException("comparer");

_comparer = comparer;
}

Expand Down
2 changes: 1 addition & 1 deletion Dragablz/Core/InterTabTransfer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ internal class InterTabTransfer
private readonly Size _itemSize;
private readonly IList<FloatingItemSnapShot> _floatingItemSnapShots;
private readonly bool _isTransposing;
private readonly InterTabTransferReason _transferReason;
private readonly InterTabTransferReason _transferReason;

public InterTabTransfer(object item, DragablzItem originatorContainer, Orientation breachOrientation, Point dragStartWindowOffset, Point dragStartItemOffset, Point itemPositionWithinHeader, Size itemSize, IList<FloatingItemSnapShot> floatingItemSnapShots, bool isTransposing)
{
Expand Down
10 changes: 5 additions & 5 deletions Dragablz/Core/MultiComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ internal class MultiComparer<TObject> : IComparer<TObject>
{
private readonly IList<FuncComparer<TObject>> _attributeComparers;

private MultiComparer(FuncComparer<TObject> firstComparer)
private MultiComparer(FuncComparer<TObject> firstComparer)
{
_attributeComparers = new List<FuncComparer<TObject>>
{
firstComparer
};
}

public static MultiComparer<TObject> Ascending<TAttribute>(Func<TObject, TAttribute> accessor)
public static MultiComparer<TObject> Ascending<TAttribute>(Func<TObject, TAttribute> accessor)
where TAttribute : IComparable
{
if (accessor == null) throw new ArgumentNullException("accessor");
if (accessor == null) throw new ArgumentNullException("accessor");

return new MultiComparer<TObject>(BuildAscendingComparer(accessor));
}

public static MultiComparer<TObject> Descending<TAttribute>(Func<TObject, TAttribute> accessor)
public static MultiComparer<TObject> Descending<TAttribute>(Func<TObject, TAttribute> accessor)
where TAttribute : IComparable
{
if (accessor == null) throw new ArgumentNullException("accessor");
Expand Down Expand Up @@ -64,7 +64,7 @@ private static FuncComparer<TObject> BuildAscendingComparer<TAttribute>(Func<TOb
{
//TODO handle ref types better
return new FuncComparer<TObject>((x, y) => accessor(x).CompareTo(accessor(y)));

}

private static FuncComparer<TObject> BuildDescendingComparer<TAttribute>(Func<TObject, TAttribute> accessor)
Expand Down
6 changes: 3 additions & 3 deletions Dragablz/Core/Native.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public struct RECT
public int top;
public int right;
public int bottom;
}
}

[DllImport("user32.dll")]
private static extern bool GetCursorPos(out POINT lpPoint);
Expand Down Expand Up @@ -58,7 +58,7 @@ public static Point GetCursorPos()

public static Point ToWpf(this Point pixelPoint)
{
var desktop = GetDC(IntPtr.Zero);
var desktop = GetDC(IntPtr.Zero);
var dpi = GetDeviceCaps(desktop, 88);
ReleaseDC(IntPtr.Zero, desktop);

Expand Down Expand Up @@ -104,7 +104,7 @@ public struct WINDOWPLACEMENT
public POINT minPosition;
public POINT maxPosition;
public RECT normalPosition;
}
}

[DllImport("user32.dll", CharSet = CharSet.Auto)]
internal static extern IntPtr SendMessage(IntPtr hWnd, WindowMessage msg, IntPtr wParam, IntPtr lParam);
Expand Down
2 changes: 1 addition & 1 deletion Dragablz/Core/TabHeaderDragStartInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ internal class TabHeaderDragStartInformation
{
private readonly DragablzItem _dragItem;
private readonly double _dragablzItemsControlHorizontalOffset;
private readonly double _dragablzItemControlVerticalOffset;
private readonly double _dragablzItemControlVerticalOffset;
private readonly double _dragablzItemHorizontalOffset;
private readonly double _dragablzItemVerticalOffset;

Expand Down
10 changes: 5 additions & 5 deletions Dragablz/DefaultInterLayoutClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace Dragablz
{
/// <summary>
/// Provides a simple implementation of <see cref="IInterLayoutClient"/>, but only really useful if
/// Provides a simple implementation of <see cref="IInterLayoutClient"/>, but only really useful if
/// <see cref="TabItem"/> instances are specified in XAML. If you are binding via ItemsSource then
/// you most likely want to create your own implementation of <see cref="IInterLayoutClient"/>.
/// </summary>
Expand All @@ -27,7 +27,7 @@ public INewTabHost<UIElement> GetNewHost(object partition, TabablzControl source
Partition = source.InterTabController.Partition
};
Clone(source.InterTabController, newInterTabController);
tabablzControl.SetCurrentValue(TabablzControl.InterTabControllerProperty, newInterTabController);
tabablzControl.SetCurrentValue(TabablzControl.InterTabControllerProperty, newInterTabController);

return new NewTabHost<UIElement>(tabablzControl, tabablzControl);
}
Expand All @@ -39,10 +39,10 @@ private static void Clone(DependencyObject from, DependencyObject to)
{
if (localValueEnumerator.Current.Property.ReadOnly ||
localValueEnumerator.Current.Value is FrameworkElement) continue;

if (!(localValueEnumerator.Current.Value is BindingExpressionBase))
to.SetCurrentValue(localValueEnumerator.Current.Property, localValueEnumerator.Current.Value);
}
to.SetCurrentValue(localValueEnumerator.Current.Property, localValueEnumerator.Current.Value);
}
}
}
}
4 changes: 2 additions & 2 deletions Dragablz/DefaultInterTabClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace Dragablz
{
public class DefaultInterTabClient : IInterTabClient
{
{
public virtual INewTabHost<Window> GetNewHost(IInterTabClient interTabClient, object partition, TabablzControl source)
{
if (source == null) throw new ArgumentNullException("source");
Expand All @@ -23,7 +23,7 @@ public virtual INewTabHost<Window> GetNewHost(IInterTabClient interTabClient, ob
if (newTabablzControl.ItemsSource == null)
newTabablzControl.Items.Clear();

return new NewTabHost<Window>(newWindow, newTabablzControl);
return new NewTabHost<Window>(newWindow, newTabablzControl);
}

public virtual TabEmptiedResponse TabEmptiedHandler(TabablzControl tabControl, Window window)
Expand Down
2 changes: 1 addition & 1 deletion Dragablz/Dockablz/Branch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public GridLength SecondItemLength
{
get { return (GridLength) GetValue(SecondItemLengthProperty); }
set { SetValue(SecondItemLengthProperty, value); }
}
}

/// <summary>
/// Gets the proportional size of the first item, between 0 and 1, where 1 would represent the entire size of the branch.
Expand Down
Loading