mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
[FancyZones Editor] New UX for the FZ editor. (#9325)
* Removed MetroWindow, added theming support and modernWPF * Rmoved MahApps refs * Removed MahApps * Updated canvas zones * Updated GridEditor * Fixes * UI updates * New layout type selection dialog * New editor UI * Updates * Fix * UI enhancements * Updated UI * Added styles to layoutpreview * Accesibility improvements * Accesibility and styling improvements * Fix * Cleaned up brushes * Updated UX * Updated UI * Added no layouts description * Fix * UI fixes * [FZ Editor] Serialize/deserialize settings (#8615) * conflicts fix * [FZ Editor] Parse json file instead of command line args (#8649) * [FZ Editor] Serialize/deserialize settings fix (#8707) * [FZ Editor] Hide unsupported settings in custom layouts flyouts (#8716) * [FZ Editor] Duplicate custom layouts (#8718) * [FZ Editor] Duplicate layout behavior (#8720) * New UX proposal * Updated spacing * Switching to toggleswitches * Revert toggleswitch * Updated colorbrush * Updated string for saving label * Updated UI * Dark theme color fixes * Removed space * [FZ Editor] Bind dialog properties (#9199) * Resize editor window to fit the content in single-monitor mode (#9203) * Editor opening fix (#9207) * Disable "Create" button if the Name textbox is empty (#9212) * [FZ Editor] Changed edit dialog for template layouts. (#9233) * [FZ Editor] Small fixes and refactoring. (#9236) * new layout creation refactoring * "Save and apply" applies the layout * number of zones header hide * [FZ Editor] Empty layout template. (#9237) * [FZ Editor] Move "Duplicate" and "Delete" buttons to the Edit dialog. (#9272) * [FZ Editor] Preview the applied layout after editing another layout. (#9278) * Fixed "Save and apply" button behavior (#9286) * [FZ Editor] Save template layouts in the settings. (#9283) * Added default custom layout name (#9291) * close dialog before opening zones editor (#9302) * Pressing Esc closes dialogs (#9301) * [FZ Editor] Reset applied layout to "No layout" if it was deleted. (#9315) * [FZ Editor] Dark theme colors (#9317) * "Number of zones" buttons colors. (#9321) * rebase fix * added ModernWpf.dll * address PR comments: updated colors * added comments, replaced magic numbers * refactoring * merge zones crash fix * removed redundant using directive Co-authored-by: Niels Laute <niels9001@hotmail.com> Co-authored-by: Niels Laute <niels.laute@live.nl>
This commit is contained in:
@@ -13,7 +13,6 @@ namespace FancyZonesEditor
|
||||
public class Overlay
|
||||
{
|
||||
private MainWindow _mainWindow;
|
||||
|
||||
private LayoutPreview _layoutPreview;
|
||||
private UserControl _editor;
|
||||
|
||||
@@ -28,7 +27,7 @@ namespace FancyZonesEditor
|
||||
return Monitors[CurrentDesktop].Device.WorkAreaRect;
|
||||
}
|
||||
|
||||
return default(Rect);
|
||||
return default;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +53,7 @@ namespace FancyZonesEditor
|
||||
return Monitors[CurrentDesktop].Window;
|
||||
}
|
||||
|
||||
return default(Window);
|
||||
return default;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,14 +99,13 @@ namespace FancyZonesEditor
|
||||
return;
|
||||
}
|
||||
|
||||
var prevSettings = CurrentLayoutSettings;
|
||||
_currentDesktop = value;
|
||||
|
||||
MainWindowSettingsModel settings = ((App)Application.Current).MainWindowSettings;
|
||||
if (settings != null)
|
||||
{
|
||||
settings.ResetAppliedModel();
|
||||
settings.UpdateDesktopDependantProperties(prevSettings);
|
||||
settings.SetAppliedModel(null);
|
||||
settings.UpdateDefaultModels();
|
||||
}
|
||||
|
||||
Update();
|
||||
@@ -130,8 +128,8 @@ namespace FancyZonesEditor
|
||||
|
||||
if (_spanZonesAcrossMonitors)
|
||||
{
|
||||
Rect workArea = default(Rect);
|
||||
Rect bounds = default(Rect);
|
||||
Rect workArea = default;
|
||||
Rect bounds = default;
|
||||
|
||||
foreach (Monitor monitor in Monitors)
|
||||
{
|
||||
@@ -174,7 +172,7 @@ namespace FancyZonesEditor
|
||||
_layoutPreview = new LayoutPreview
|
||||
{
|
||||
IsActualSize = true,
|
||||
Opacity = 0.5,
|
||||
Opacity = 1,
|
||||
};
|
||||
|
||||
ShowLayout();
|
||||
@@ -201,6 +199,30 @@ namespace FancyZonesEditor
|
||||
}
|
||||
}
|
||||
|
||||
public void SetLayoutSettings(Monitor monitor, LayoutModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
monitor.Settings.ZonesetUuid = model.Uuid;
|
||||
monitor.Settings.Type = model.Type;
|
||||
monitor.Settings.SensitivityRadius = model.SensitivityRadius;
|
||||
monitor.Settings.ZoneCount = model.TemplateZoneCount;
|
||||
|
||||
if (model is GridLayoutModel grid)
|
||||
{
|
||||
monitor.Settings.ShowSpacing = grid.ShowSpacing;
|
||||
monitor.Settings.Spacing = grid.Spacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
monitor.Settings.ShowSpacing = false;
|
||||
monitor.Settings.Spacing = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void OpenEditor(LayoutModel model)
|
||||
{
|
||||
_layoutPreview = null;
|
||||
@@ -216,11 +238,10 @@ namespace FancyZonesEditor
|
||||
CurrentLayoutWindow.Content = _editor;
|
||||
|
||||
EditorWindow window;
|
||||
bool isGrid = false;
|
||||
|
||||
if (model is GridLayoutModel)
|
||||
{
|
||||
window = new GridEditorWindow();
|
||||
isGrid = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -230,14 +251,6 @@ namespace FancyZonesEditor
|
||||
window.Owner = Monitors[App.Overlay.CurrentDesktop].Window;
|
||||
window.DataContext = model;
|
||||
window.Show();
|
||||
|
||||
if (isGrid)
|
||||
{
|
||||
(window as GridEditorWindow).NameTextBox().Focus();
|
||||
}
|
||||
|
||||
window.LeftWindowCommands = null;
|
||||
window.RightWindowCommands = null;
|
||||
}
|
||||
|
||||
public void CloseEditor()
|
||||
@@ -246,7 +259,7 @@ namespace FancyZonesEditor
|
||||
_layoutPreview = new LayoutPreview
|
||||
{
|
||||
IsActualSize = true,
|
||||
Opacity = 0.5,
|
||||
Opacity = 1,
|
||||
};
|
||||
|
||||
CurrentLayoutWindow.Content = _layoutPreview;
|
||||
@@ -318,8 +331,6 @@ namespace FancyZonesEditor
|
||||
_mainWindow.ShowActivated = true;
|
||||
_mainWindow.Topmost = true;
|
||||
_mainWindow.Show();
|
||||
_mainWindow.LeftWindowCommands = null;
|
||||
_mainWindow.RightWindowCommands = null;
|
||||
|
||||
// window is set to topmost to make sure it shows on top of PowerToys settings page
|
||||
// we can reset topmost flag now
|
||||
|
||||
Reference in New Issue
Block a user