fixed rest of info items

This commit is contained in:
Clint Rutkas
2019-12-12 15:00:24 -08:00
parent 63cb5ab883
commit 360a22c537
10 changed files with 66 additions and 65 deletions

View File

@@ -16,15 +16,22 @@ namespace FancyZonesEditor
/// </summary>
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()
{
InitializeComponent();
Panel.SetZIndex(this, _zIndex++);
}
public CanvasLayoutModel Model;
public int ZoneIndex;
private void Move(double xDelta, double yDelta)
{
Int32Rect rect = Model.Zones[ZoneIndex];
@@ -138,10 +145,6 @@ namespace FancyZonesEditor
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)
{
Panel.SetZIndex(this, _zIndex++);
@@ -200,7 +203,5 @@ namespace FancyZonesEditor
((Panel)Parent).Children.Remove(this);
Model.RemoveZoneAt(ZoneIndex);
}
private Settings _settings = ((App)Application.Current).ZoneSettings;
}
}

View File

@@ -10,8 +10,8 @@ namespace FancyZonesEditor.Converters
{
public class BooleanToBrushConverter : IValueConverter
{
private static Brush _selectedBrush = new SolidColorBrush(Color.FromRgb(0x00, 0x78, 0xD7));
private static Brush _normalBrush = new SolidColorBrush(Color.FromRgb(0xF2, 0xF2, 0xF2));
private static readonly Brush _selectedBrush = new SolidColorBrush(Color.FromRgb(0x00, 0x78, 0xD7));
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)
{

View File

@@ -15,6 +15,9 @@ namespace FancyZonesEditor
public partial class EditorOverlay : Window
{
public static EditorOverlay Current { get; set; }
private readonly Settings _settings = ((App)Application.Current).ZoneSettings;
private LayoutPreview _layoutPreview;
private UserControl _editor;
public Int32Rect[] GetZoneRects()
{
@@ -128,9 +131,5 @@ namespace FancyZonesEditor
Content = _editor;
}
private Settings _settings = ((App)Application.Current).ZoneSettings;
private LayoutPreview _layoutPreview;
private UserControl _editor;
}
}

View File

@@ -15,6 +15,13 @@ namespace FancyZonesEditor
/// </summary>
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()
{
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;
}
}

View File

@@ -31,7 +31,7 @@ namespace FancyZonesEditor
public double[] HorizontalSnapPoints { get; set; }
private Rectangle _splitter;
private readonly Rectangle _splitter;
private bool _switchOrientation = false;
private Point _lastPos = new Point(-1, -1);
private Point _mouseDownPos = new Point(-1, -1);

View File

@@ -18,6 +18,8 @@ namespace FancyZonesEditor
{
public static readonly DependencyProperty IsActualSizeProperty = DependencyProperty.Register("IsActualSize", typeof(bool), typeof(LayoutPreview), new PropertyMetadata(false));
private LayoutModel _model;
public LayoutPreview()
{
InitializeComponent();
@@ -192,7 +194,5 @@ namespace FancyZonesEditor
frame.Children.Add(rect);
}
}
private LayoutModel _model;
}
}

View File

@@ -19,9 +19,12 @@ namespace FancyZonesEditor
{
// TODO: share the constants b/w C# Editor and FancyZoneLib
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;
public int WrapPanelItemSize { get; set; } = 262;
public MainWindow()
{
InitializeComponent();
@@ -33,7 +36,7 @@ namespace FancyZonesEditor
}
}
public int WrapPanelItemSize { get; set; } = 262;
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)
{
WindowLayout window = new WindowLayout();

View File

@@ -11,6 +11,8 @@ namespace FancyZonesEditor.Models
// Free form Layout Model, which specifies independent zone rects
public class CanvasLayoutModel : LayoutModel
{
private static readonly ushort _latestVersion = 0;
public CanvasLayoutModel(ushort version, string name, ushort id, byte[] data)
: base(name, id)
{
@@ -180,7 +182,5 @@ namespace FancyZonesEditor.Models
return data;
}
private static ushort _latestVersion = 0;
}
}

View File

@@ -10,7 +10,7 @@ namespace FancyZonesEditor.Models
// Grid-styled Layout Model, which specifies rows, columns, percentage sizes, and row/column spans
public class GridLayoutModel : LayoutModel
{
private static ushort _latestVersion = 0;
private static readonly ushort _latestVersion = 0;
// Rows - number of rows in the Grid
public int Rows

View File

@@ -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
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
{
get
@@ -378,38 +411,5 @@ namespace FancyZonesEditor
{
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;
}
}