mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-11 05:52:19 +02:00
fixed rest of info items
This commit is contained in:
@@ -16,15 +16,22 @@ namespace FancyZonesEditor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class CanvasZone : UserControl
|
public partial class CanvasZone : UserControl
|
||||||
{
|
{
|
||||||
|
public CanvasLayoutModel Model { get; set; }
|
||||||
|
|
||||||
|
public int ZoneIndex { get; set; }
|
||||||
|
|
||||||
|
private readonly Settings _settings = ((App)Application.Current).ZoneSettings;
|
||||||
|
|
||||||
|
private static readonly int _minZoneWidth = 64;
|
||||||
|
private static readonly int _minZoneHeight = 72;
|
||||||
|
private static int _zIndex = 0;
|
||||||
|
|
||||||
public CanvasZone()
|
public CanvasZone()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Panel.SetZIndex(this, _zIndex++);
|
Panel.SetZIndex(this, _zIndex++);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CanvasLayoutModel Model;
|
|
||||||
public int ZoneIndex;
|
|
||||||
|
|
||||||
private void Move(double xDelta, double yDelta)
|
private void Move(double xDelta, double yDelta)
|
||||||
{
|
{
|
||||||
Int32Rect rect = Model.Zones[ZoneIndex];
|
Int32Rect rect = Model.Zones[ZoneIndex];
|
||||||
@@ -138,10 +145,6 @@ namespace FancyZonesEditor
|
|||||||
Model.Zones[ZoneIndex] = rect;
|
Model.Zones[ZoneIndex] = rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int _zIndex = 0;
|
|
||||||
private static int _minZoneWidth = 64;
|
|
||||||
private static int _minZoneHeight = 72;
|
|
||||||
|
|
||||||
protected override void OnPreviewMouseDown(MouseButtonEventArgs e)
|
protected override void OnPreviewMouseDown(MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
Panel.SetZIndex(this, _zIndex++);
|
Panel.SetZIndex(this, _zIndex++);
|
||||||
@@ -200,7 +203,5 @@ namespace FancyZonesEditor
|
|||||||
((Panel)Parent).Children.Remove(this);
|
((Panel)Parent).Children.Remove(this);
|
||||||
Model.RemoveZoneAt(ZoneIndex);
|
Model.RemoveZoneAt(ZoneIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Settings _settings = ((App)Application.Current).ZoneSettings;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ namespace FancyZonesEditor.Converters
|
|||||||
{
|
{
|
||||||
public class BooleanToBrushConverter : IValueConverter
|
public class BooleanToBrushConverter : IValueConverter
|
||||||
{
|
{
|
||||||
private static Brush _selectedBrush = new SolidColorBrush(Color.FromRgb(0x00, 0x78, 0xD7));
|
private static readonly Brush _selectedBrush = new SolidColorBrush(Color.FromRgb(0x00, 0x78, 0xD7));
|
||||||
private static Brush _normalBrush = new SolidColorBrush(Color.FromRgb(0xF2, 0xF2, 0xF2));
|
private static readonly Brush _normalBrush = new SolidColorBrush(Color.FromRgb(0xF2, 0xF2, 0xF2));
|
||||||
|
|
||||||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ namespace FancyZonesEditor
|
|||||||
public partial class EditorOverlay : Window
|
public partial class EditorOverlay : Window
|
||||||
{
|
{
|
||||||
public static EditorOverlay Current { get; set; }
|
public static EditorOverlay Current { get; set; }
|
||||||
|
private readonly Settings _settings = ((App)Application.Current).ZoneSettings;
|
||||||
|
private LayoutPreview _layoutPreview;
|
||||||
|
private UserControl _editor;
|
||||||
|
|
||||||
public Int32Rect[] GetZoneRects()
|
public Int32Rect[] GetZoneRects()
|
||||||
{
|
{
|
||||||
@@ -128,9 +131,5 @@ namespace FancyZonesEditor
|
|||||||
|
|
||||||
Content = _editor;
|
Content = _editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Settings _settings = ((App)Application.Current).ZoneSettings;
|
|
||||||
private LayoutPreview _layoutPreview;
|
|
||||||
private UserControl _editor;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,13 @@ namespace FancyZonesEditor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class GridResizer : Thumb
|
public partial class GridResizer : Thumb
|
||||||
{
|
{
|
||||||
|
private static readonly RotateTransform _rotateTransform = new RotateTransform(90, 24, 24);
|
||||||
|
|
||||||
|
public int Index;
|
||||||
|
public LayoutModel Model;
|
||||||
|
|
||||||
|
private Orientation _orientation;
|
||||||
|
|
||||||
public GridResizer()
|
public GridResizer()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -44,12 +51,5 @@ namespace FancyZonesEditor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static RotateTransform _rotateTransform = new RotateTransform(90, 24, 24);
|
|
||||||
|
|
||||||
public int Index;
|
|
||||||
public LayoutModel Model;
|
|
||||||
|
|
||||||
private Orientation _orientation;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace FancyZonesEditor
|
|||||||
|
|
||||||
public double[] HorizontalSnapPoints { get; set; }
|
public double[] HorizontalSnapPoints { get; set; }
|
||||||
|
|
||||||
private Rectangle _splitter;
|
private readonly Rectangle _splitter;
|
||||||
private bool _switchOrientation = false;
|
private bool _switchOrientation = false;
|
||||||
private Point _lastPos = new Point(-1, -1);
|
private Point _lastPos = new Point(-1, -1);
|
||||||
private Point _mouseDownPos = new Point(-1, -1);
|
private Point _mouseDownPos = new Point(-1, -1);
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ namespace FancyZonesEditor
|
|||||||
{
|
{
|
||||||
public static readonly DependencyProperty IsActualSizeProperty = DependencyProperty.Register("IsActualSize", typeof(bool), typeof(LayoutPreview), new PropertyMetadata(false));
|
public static readonly DependencyProperty IsActualSizeProperty = DependencyProperty.Register("IsActualSize", typeof(bool), typeof(LayoutPreview), new PropertyMetadata(false));
|
||||||
|
|
||||||
|
private LayoutModel _model;
|
||||||
|
|
||||||
public LayoutPreview()
|
public LayoutPreview()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -192,7 +194,5 @@ namespace FancyZonesEditor
|
|||||||
frame.Children.Add(rect);
|
frame.Children.Add(rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private LayoutModel _model;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,9 +19,12 @@ namespace FancyZonesEditor
|
|||||||
{
|
{
|
||||||
// TODO: share the constants b/w C# Editor and FancyZoneLib
|
// TODO: share the constants b/w C# Editor and FancyZoneLib
|
||||||
public const int MaxZones = 40;
|
public const int MaxZones = 40;
|
||||||
private static string _defaultNamePrefix = "Custom Layout ";
|
private readonly Settings _settings = ((App)Application.Current).ZoneSettings;
|
||||||
|
private static readonly string _defaultNamePrefix = "Custom Layout ";
|
||||||
private bool _editing = false;
|
private bool _editing = false;
|
||||||
|
|
||||||
|
public int WrapPanelItemSize { get; set; } = 262;
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -33,7 +36,7 @@ namespace FancyZonesEditor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int WrapPanelItemSize { get; set; } = 262;
|
|
||||||
|
|
||||||
private void DecrementZones_Click(object sender, RoutedEventArgs e)
|
private void DecrementZones_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
@@ -51,8 +54,6 @@ namespace FancyZonesEditor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Settings _settings = ((App)Application.Current).ZoneSettings;
|
|
||||||
|
|
||||||
private void NewCustomLayoutButton_Click(object sender, RoutedEventArgs e)
|
private void NewCustomLayoutButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
WindowLayout window = new WindowLayout();
|
WindowLayout window = new WindowLayout();
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ namespace FancyZonesEditor.Models
|
|||||||
// Free form Layout Model, which specifies independent zone rects
|
// Free form Layout Model, which specifies independent zone rects
|
||||||
public class CanvasLayoutModel : LayoutModel
|
public class CanvasLayoutModel : LayoutModel
|
||||||
{
|
{
|
||||||
|
private static readonly ushort _latestVersion = 0;
|
||||||
|
|
||||||
public CanvasLayoutModel(ushort version, string name, ushort id, byte[] data)
|
public CanvasLayoutModel(ushort version, string name, ushort id, byte[] data)
|
||||||
: base(name, id)
|
: base(name, id)
|
||||||
{
|
{
|
||||||
@@ -180,7 +182,5 @@ namespace FancyZonesEditor.Models
|
|||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ushort _latestVersion = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace FancyZonesEditor.Models
|
|||||||
// Grid-styled Layout Model, which specifies rows, columns, percentage sizes, and row/column spans
|
// Grid-styled Layout Model, which specifies rows, columns, percentage sizes, and row/column spans
|
||||||
public class GridLayoutModel : LayoutModel
|
public class GridLayoutModel : LayoutModel
|
||||||
{
|
{
|
||||||
private static ushort _latestVersion = 0;
|
private static readonly ushort _latestVersion = 0;
|
||||||
|
|
||||||
// Rows - number of rows in the Grid
|
// Rows - number of rows in the Grid
|
||||||
public int Rows
|
public int Rows
|
||||||
|
|||||||
@@ -18,6 +18,39 @@ namespace FancyZonesEditor
|
|||||||
// Other UIs in the editor will subscribe to change events on the properties to stay up to date as these properties change
|
// Other UIs in the editor will subscribe to change events on the properties to stay up to date as these properties change
|
||||||
public class Settings : INotifyPropertyChanged
|
public class Settings : INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
|
private readonly CanvasLayoutModel _blankCustomModel;
|
||||||
|
private readonly CanvasLayoutModel _focusModel;
|
||||||
|
private readonly GridLayoutModel _rowsModel;
|
||||||
|
private readonly GridLayoutModel _columnsModel;
|
||||||
|
private readonly GridLayoutModel _gridModel;
|
||||||
|
private readonly GridLayoutModel _priorityGridModel;
|
||||||
|
|
||||||
|
private static readonly ushort _focusModelId = 0xFFFF;
|
||||||
|
private static readonly ushort _rowsModelId = 0xFFFE;
|
||||||
|
private static readonly ushort _columnsModelId = 0xFFFD;
|
||||||
|
private static readonly ushort _gridModelId = 0xFFFC;
|
||||||
|
private static readonly ushort _priorityGridModelId = 0xFFFB;
|
||||||
|
private static readonly ushort _blankCustomModelId = 0xFFFA;
|
||||||
|
private static readonly ushort _lastPrefinedId = _blankCustomModelId;
|
||||||
|
|
||||||
|
// hard coded data for all the "Priority Grid" configurations that are unique to "Grid"
|
||||||
|
private static readonly byte[][] _priorityData = new byte[][]
|
||||||
|
{
|
||||||
|
new byte[] { 0, 0, 0, 0, 0, 1, 1, 39, 16, 39, 16, 0 },
|
||||||
|
new byte[] { 0, 0, 0, 0, 0, 1, 2, 39, 16, 26, 11, 13, 5, 0, 1 },
|
||||||
|
new byte[] { 0, 0, 0, 0, 0, 1, 3, 39, 16, 9, 196, 19, 136, 9, 196, 0, 1, 2 },
|
||||||
|
new byte[] { 0, 0, 0, 0, 0, 2, 3, 19, 136, 19, 136, 9, 196, 19, 136, 9, 196, 0, 1, 2, 0, 1, 3 },
|
||||||
|
new byte[] { 0, 0, 0, 0, 0, 2, 3, 19, 136, 19, 136, 9, 196, 19, 136, 9, 196, 0, 1, 2, 3, 1, 4 },
|
||||||
|
new byte[] { 0, 0, 0, 0, 0, 3, 3, 13, 5, 13, 6, 13, 5, 9, 196, 19, 136, 9, 196, 0, 1, 2, 0, 1, 3, 4, 1, 5 },
|
||||||
|
new byte[] { 0, 0, 0, 0, 0, 3, 3, 13, 5, 13, 6, 13, 5, 9, 196, 19, 136, 9, 196, 0, 1, 2, 3, 1, 4, 5, 1, 6 },
|
||||||
|
new byte[] { 0, 0, 0, 0, 0, 3, 4, 13, 5, 13, 6, 13, 5, 9, 196, 9, 196, 9, 196, 9, 196, 0, 1, 2, 3, 4, 1, 2, 5, 6, 1, 2, 7 },
|
||||||
|
new byte[] { 0, 0, 0, 0, 0, 3, 4, 13, 5, 13, 6, 13, 5, 9, 196, 9, 196, 9, 196, 9, 196, 0, 1, 2, 3, 4, 1, 2, 5, 6, 1, 7, 8 },
|
||||||
|
new byte[] { 0, 0, 0, 0, 0, 3, 4, 13, 5, 13, 6, 13, 5, 9, 196, 9, 196, 9, 196, 9, 196, 0, 1, 2, 3, 4, 1, 5, 6, 7, 1, 8, 9 },
|
||||||
|
new byte[] { 0, 0, 0, 0, 0, 3, 4, 13, 5, 13, 6, 13, 5, 9, 196, 9, 196, 9, 196, 9, 196, 0, 1, 2, 3, 4, 1, 5, 6, 7, 8, 9, 10 },
|
||||||
|
};
|
||||||
|
|
||||||
|
private const int _multiplier = 10000;
|
||||||
|
|
||||||
public bool IsCustomLayoutActive
|
public bool IsCustomLayoutActive
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -378,38 +411,5 @@ namespace FancyZonesEditor
|
|||||||
{
|
{
|
||||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
}
|
}
|
||||||
|
|
||||||
private CanvasLayoutModel _focusModel;
|
|
||||||
private GridLayoutModel _rowsModel;
|
|
||||||
private GridLayoutModel _columnsModel;
|
|
||||||
private GridLayoutModel _gridModel;
|
|
||||||
private GridLayoutModel _priorityGridModel;
|
|
||||||
private CanvasLayoutModel _blankCustomModel;
|
|
||||||
|
|
||||||
private static readonly ushort _focusModelId = 0xFFFF;
|
|
||||||
private static readonly ushort _rowsModelId = 0xFFFE;
|
|
||||||
private static readonly ushort _columnsModelId = 0xFFFD;
|
|
||||||
private static readonly ushort _gridModelId = 0xFFFC;
|
|
||||||
private static readonly ushort _priorityGridModelId = 0xFFFB;
|
|
||||||
private static readonly ushort _blankCustomModelId = 0xFFFA;
|
|
||||||
private static readonly ushort _lastPrefinedId = _blankCustomModelId;
|
|
||||||
|
|
||||||
// hard coded data for all the "Priority Grid" configurations that are unique to "Grid"
|
|
||||||
private static byte[][] _priorityData = new byte[][]
|
|
||||||
{
|
|
||||||
new byte[] { 0, 0, 0, 0, 0, 1, 1, 39, 16, 39, 16, 0 },
|
|
||||||
new byte[] { 0, 0, 0, 0, 0, 1, 2, 39, 16, 26, 11, 13, 5, 0, 1 },
|
|
||||||
new byte[] { 0, 0, 0, 0, 0, 1, 3, 39, 16, 9, 196, 19, 136, 9, 196, 0, 1, 2 },
|
|
||||||
new byte[] { 0, 0, 0, 0, 0, 2, 3, 19, 136, 19, 136, 9, 196, 19, 136, 9, 196, 0, 1, 2, 0, 1, 3 },
|
|
||||||
new byte[] { 0, 0, 0, 0, 0, 2, 3, 19, 136, 19, 136, 9, 196, 19, 136, 9, 196, 0, 1, 2, 3, 1, 4 },
|
|
||||||
new byte[] { 0, 0, 0, 0, 0, 3, 3, 13, 5, 13, 6, 13, 5, 9, 196, 19, 136, 9, 196, 0, 1, 2, 0, 1, 3, 4, 1, 5 },
|
|
||||||
new byte[] { 0, 0, 0, 0, 0, 3, 3, 13, 5, 13, 6, 13, 5, 9, 196, 19, 136, 9, 196, 0, 1, 2, 3, 1, 4, 5, 1, 6 },
|
|
||||||
new byte[] { 0, 0, 0, 0, 0, 3, 4, 13, 5, 13, 6, 13, 5, 9, 196, 9, 196, 9, 196, 9, 196, 0, 1, 2, 3, 4, 1, 2, 5, 6, 1, 2, 7 },
|
|
||||||
new byte[] { 0, 0, 0, 0, 0, 3, 4, 13, 5, 13, 6, 13, 5, 9, 196, 9, 196, 9, 196, 9, 196, 0, 1, 2, 3, 4, 1, 2, 5, 6, 1, 7, 8 },
|
|
||||||
new byte[] { 0, 0, 0, 0, 0, 3, 4, 13, 5, 13, 6, 13, 5, 9, 196, 9, 196, 9, 196, 9, 196, 0, 1, 2, 3, 4, 1, 5, 6, 7, 1, 8, 9 },
|
|
||||||
new byte[] { 0, 0, 0, 0, 0, 3, 4, 13, 5, 13, 6, 13, 5, 9, 196, 9, 196, 9, 196, 9, 196, 0, 1, 2, 3, 4, 1, 5, 6, 7, 8, 9, 10 },
|
|
||||||
};
|
|
||||||
|
|
||||||
private const int _multiplier = 10000;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user