mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
[New utility]Sysinternals ZoomIt (#35880)
* ZoomIt initial code dump * Change vcxproj to normalize dependency versions * Fix code quality to build * Add to PowerToys solution * Clean out C-style casts * Fix some more analyzer errors * Constexpr a function * Disable some warnings locally that it seemed better not to touch * Add ZoomIt module interface * Add GPO * Add Settings page with Enable button * Output as PowerToys.ZoomIt.exe * Extract ZoomIt Settings definition to its own header * Make ZoomItModuleInterface build with ZoomItSettings too * WinRT C++ interop for ZoomItSettings * From Registry To PowerToys Json * Properly fix const_cast analyzer error * Initial Settings page loading from registry * Zoom mode settings * Save settings * Add file picker and DemoType file support * Remaining DemoType settings * Have ZoomIt properly reloading Settings and exiting * Remove context menu entries for Options and Exit * ZoomIt simple Break Options * Break advanced options * Simple Record settings * Record Microphone setting * Fix break background file picker title * Font setting * Fix build issues after merge * Add ZoomIt conflict warning to Settings * Exclude Eula from spell checking * Fix spellcheck errors * Fix spell check for accelerated menu items * Remove cursor files from spellcheck. They're binary * Fix forbidden patterns * Fix XAML style * Fix C# analyzers * Fix signing * Also sign module interface dll * Use actual ZoomIt icon * Add OOBE page for ZoomIt * ZoomIt image for Settings * Flyout and Dashboard entries * Fix type speed slider labels * Correctly load default Font * Correctly register shortcuts on ZoomIt startup first run * Fix modifier keys not changing until restart * Show MsgBox on taken shortcut * Start PowerToys Settings * Normalize ZoomIt file properties with rest of PowerToys * Add attribution * Add ZoomIt team to Community.md * More copyright adjustments * Fix spellcheck * Fix MsgBox simultaneous instance to the front * Add mention of capturevideosample code use * Add ZoomIt to process lists * Add telemetry * Add logging * React to gpo * Normalize code to space identation * Fix installer build * Localize percent setting * Fix XAML styling * Update src/settings-ui/Settings.UI/Strings/en-us/Resources.resw Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> * Fix spellcheck * One more spellcheck fix * Integrate LiveDraw feature changes from upstream * Fix name reuse in same scope * Fix c-style casts * Also register LIVEDRAW_HOTKEY * Fix newLiveZoomToggleKey * Update LiveZoom description in Settings to take LiveDraw into account * Fix spellcheck * Fix more spellcheck * Fix Sysinternals capitalization * Fix ARM64 Debug build * Support Sysinternals build (#36873) * Remove unneeded files * Make build compatible with Sysinternals * Separate PowerToys ZoomIt product name (#36887) * Separate PowerToys ZoomIt product name To help maintain the Sysinternals branding in the standalone version. * Clarify branding-related includes * Remove ZoomIt.sln * Add foxmsft to spell-check names * Add ZoomIt to README * Add ZoomIt to GH templates * Add ZoomIt events to DATA_AND_PRIVACY.md * Remove publish_config.json * Remove publish_config.json from vcxproj too --------- Co-authored-by: Mark Russinovich <markruss@microsoft.com> Co-authored-by: Alex Mihaiuc <69110671+foxmsft@users.noreply.github.com> Co-authored-by: John Stephens <johnstep@microsoft.com> Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com>
This commit is contained in:
BIN
src/settings-ui/Settings.UI/Assets/Settings/Icons/ZoomIt.png
Normal file
BIN
src/settings-ui/Settings.UI/Assets/Settings/Icons/ZoomIt.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.0 MiB |
BIN
src/settings-ui/Settings.UI/Assets/Settings/Modules/ZoomIt.png
Normal file
BIN
src/settings-ui/Settings.UI/Assets/Settings/Modules/ZoomIt.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
@@ -0,0 +1,34 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Converters
|
||||
{
|
||||
public sealed partial class ZoomItInitialZoomConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
string targetValue = string.Empty;
|
||||
int zoomLevel = System.Convert.ToInt32((double)value);
|
||||
|
||||
// Should match the zoom values expected by ZoomIt internal logic.
|
||||
switch (zoomLevel)
|
||||
{
|
||||
case 0: targetValue = "1.25"; break;
|
||||
case 1: targetValue = "1.5"; break;
|
||||
case 2: targetValue = "1.75"; break;
|
||||
case 3: targetValue = "2.0"; break;
|
||||
case 4: targetValue = "3.0"; break;
|
||||
case 5: targetValue = "4.0"; break;
|
||||
}
|
||||
|
||||
return targetValue;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Converters
|
||||
{
|
||||
public sealed partial class ZoomItTypeSpeedSliderConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
string targetValue = string.Empty;
|
||||
int zoomLevel = System.Convert.ToInt32((double)value);
|
||||
string explanation = ResourceLoaderInstance.ResourceLoader.GetString("ZoomIt_DemoType_SpeedSlider_Thumbnail_Explanation");
|
||||
|
||||
targetValue = $"{zoomLevel} ({explanation})";
|
||||
|
||||
return targetValue;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
70
src/settings-ui/Settings.UI/Helpers/CHOOSEFONT.cs
Normal file
70
src/settings-ui/Settings.UI/Helpers/CHOOSEFONT.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1307:Accessible fields should begin with upper-case letter", Justification = "Keep original names from original structure")]
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1306:Field names should begin with lower-case letter", Justification = "Keep original names from original structure")]
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:Fields should be private", Justification = "Structure used for win32 interop. We need to access the fields")]
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1805:Do not initialize unnecessarily", Justification = "Let's have initializations be explicit for these win32 interop types")]
|
||||
|
||||
// Class to select the Dialog options to call ChooseFont.
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
|
||||
public class CHOOSEFONT
|
||||
{
|
||||
public int lStructSize = Marshal.SizeOf(typeof(CHOOSEFONT));
|
||||
public IntPtr hwndOwner = IntPtr.Zero;
|
||||
public IntPtr hDC = IntPtr.Zero;
|
||||
public IntPtr lpLogFont = IntPtr.Zero;
|
||||
public int iPointSize = 0;
|
||||
public int Flags = 0;
|
||||
public int rgbColors = 0;
|
||||
public IntPtr lCustData = IntPtr.Zero;
|
||||
public IntPtr lpfnHook = IntPtr.Zero;
|
||||
public string lpTemplateName = null;
|
||||
public IntPtr hInstance = IntPtr.Zero;
|
||||
public string lpszStyle = null;
|
||||
public short nFontType;
|
||||
private short __MISSING_ALIGNMENT__;
|
||||
public int nSizeMin;
|
||||
public int nSizeMax;
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum CHOOSE_FONT_FLAGS
|
||||
{
|
||||
CF_SCREENFONTS = 0x00000001,
|
||||
CF_PRINTER_FONTS = 0x00000002,
|
||||
CF_BOTH = CF_SCREENFONTS | CF_PRINTER_FONTS,
|
||||
CF_SHOW_HELP = 0x00000004,
|
||||
CF_ENABLE_HOOK = 0x00000008,
|
||||
CF_ENABLETEMPLATE = 0x00000010,
|
||||
CF_ENABLETEMPLATE_HANDLE = 0x00000020,
|
||||
CF_INITTOLOGFONTSTRUCT = 0x00000040,
|
||||
CF_USE_STYLE = 0x00000080,
|
||||
CF_EFFECTS = 0x00000100,
|
||||
CF_APPLY = 0x00000200,
|
||||
CF_ANSI_ONLY = 0x00000400,
|
||||
CF_SCRIPTS_ONLY = CF_ANSI_ONLY,
|
||||
CF_NO_VECTOR_FONTS = 0x00000800,
|
||||
CF_NO_OEM_FONTS = CF_NO_VECTOR_FONTS,
|
||||
CF_NO_SIMULATIONS = 0x00001000,
|
||||
CF_LIMITSIZE = 0x00002000,
|
||||
CF_FIXED_PITCH_ONLY = 0x00004000,
|
||||
CF_WYSIWYG = 0x00008000,
|
||||
CF_FORCE_FONT_EXIST = 0x00010000,
|
||||
CF_SCALABLE_ONLY = 0x00020000,
|
||||
CF_TT_ONLY = 0x00040000,
|
||||
CF_NO_FACE_SEL = 0x00080000,
|
||||
CF_NO_STYLE_SEL = 0x00100000,
|
||||
CF_NO_SIZE_SEL = 0x00200000,
|
||||
CF_SELECT_SCRIPT = 0x00400000,
|
||||
CF_NO_SCRIPT_SEL = 0x00800000,
|
||||
CF_NO_VERT_FONTS = 0x01000000,
|
||||
CF_INACTIVE_FONTS = 0x02000000,
|
||||
}
|
||||
}
|
||||
125
src/settings-ui/Settings.UI/Helpers/LOGFONT.cs
Normal file
125
src/settings-ui/Settings.UI/Helpers/LOGFONT.cs
Normal file
@@ -0,0 +1,125 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1307:Accessible fields should begin with upper-case letter", Justification = "Keep original names from original structure")]
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:Fields should be private", Justification = "Structure used for win32 interop. We need to access the fields")]
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1805:Do not initialize unnecessarily", Justification = "Let's have initializations be explicit for these win32 interop types")]
|
||||
|
||||
// Result from calling ChooseFont.
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
|
||||
public class LOGFONT
|
||||
{
|
||||
public int lfHeight = 0;
|
||||
public int lfWidth = 0;
|
||||
public int lfEscapement = 0;
|
||||
public int lfOrientation = 0;
|
||||
public int lfWeight = 0;
|
||||
public byte lfItalic = 0;
|
||||
public byte lfUnderline = 0;
|
||||
public byte lfStrikeOut = 0;
|
||||
public byte lfCharSet = 0;
|
||||
public byte lfOutPrecision = 0;
|
||||
public byte lfClipPrecision = 0;
|
||||
public byte lfQuality = 0;
|
||||
public byte lfPitchAndFamily = 0;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
|
||||
public string lfFaceName = string.Empty;
|
||||
}
|
||||
|
||||
public enum FontWeight : int
|
||||
{
|
||||
FW_DONT_CARE = 0,
|
||||
FW_THIN = 100,
|
||||
FW_EXTRALIGHT = 200,
|
||||
FW_LIGHT = 300,
|
||||
FW_NORMAL = 400,
|
||||
FW_MEDIUM = 500,
|
||||
FW_SEMIBOLD = 600,
|
||||
FW_BOLD = 700,
|
||||
FW_EXTRABOLD = 800,
|
||||
FW_HEAVY = 900,
|
||||
}
|
||||
|
||||
public enum FontCharSet : byte
|
||||
{
|
||||
ANSI_CHARSET = 0,
|
||||
DEFAULT_CHARSET = 1,
|
||||
SYMBOL_CHARSET = 2,
|
||||
SHIFT_JIS_CHARSET = 128,
|
||||
HANGEUL_CHARSET = 129,
|
||||
HANGUL_CHARSET = HANGEUL_CHARSET,
|
||||
GB2312_CHARSET = 134,
|
||||
CHINESE_BIG5_CHARSET = 136,
|
||||
OEM_CHARSET = 255,
|
||||
JOHAB_CHARSET = 130,
|
||||
HEBREW_CHARSET = 177,
|
||||
ARABIC_CHARSET = 178,
|
||||
GREEK_CHARSET = 161,
|
||||
TURKISH_CHARSET = 162,
|
||||
VIETNAMESE_CHARSET = 163,
|
||||
THAI_CHARSET = 222,
|
||||
EAST_EUROPE_CHARSET = 238,
|
||||
RUSSIAN_CHARSET = 204,
|
||||
MAC_CHARSET = 77,
|
||||
BALTIC_CHARSET = 186,
|
||||
}
|
||||
|
||||
public enum FontPrecision : byte
|
||||
{
|
||||
OUT_DEFAULT_PRECIS = 0,
|
||||
OUT_STRING_PRECIS = 1,
|
||||
OUT_CHARACTER_PRECIS = 2,
|
||||
OUT_STROKE_PRECIS = 3,
|
||||
OUT_TT_PRECIS = 4,
|
||||
OUT_DEVICE_PRECIS = 5,
|
||||
OUT_RASTER_PRECIS = 6,
|
||||
OUT_TT_ONLY_PRECIS = 7,
|
||||
OUT_OUTLINE_PRECIS = 8,
|
||||
OUT_SCREEN_OUTLINE_PRECIS = 9,
|
||||
OUT_PS_ONLY_PRECIS = 10,
|
||||
}
|
||||
|
||||
public enum FontClipPrecision : byte
|
||||
{
|
||||
CLIP_DEFAULT_PRECIS = 0,
|
||||
CLIP_CHARACTER_PRECIS = 1,
|
||||
CLIP_STROKE_PRECIS = 2,
|
||||
CLIP_MASK = 0xf,
|
||||
CLIP_LH_ANGLES = 1 << 4,
|
||||
CLIP_TT_ALWAYS = 2 << 4,
|
||||
CLIP_DFA_DISABLE = 4 << 4,
|
||||
CLIP_EMBEDDED = 8 << 4,
|
||||
}
|
||||
|
||||
public enum FontQuality : byte
|
||||
{
|
||||
DEFAULT_QUALITY = 0,
|
||||
DRAFT_QUALITY = 1,
|
||||
PROOF_QUALITY = 2,
|
||||
NONANTIALIASED_QUALITY = 3,
|
||||
ANTIALIASED_QUALITY = 4,
|
||||
CLEAR_TYPE_QUALITY = 5,
|
||||
CLEAR_TYPE_NATURAL_QUALITY = 6,
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum FontPitchAndFamily : byte
|
||||
{
|
||||
DEFAULT_PITCH = 0,
|
||||
FIXED_PITCH = 1,
|
||||
VARIABLE_PITCH = 2,
|
||||
FF_DONT_CARE = DEFAULT_PITCH,
|
||||
FF_ROMAN = 1 << 4,
|
||||
FF_SWISS = 2 << 4,
|
||||
FF_MODERN = 3 << 4,
|
||||
FF_SCRIPT = 4 << 4,
|
||||
FF_DECORATIVE = 5 << 4,
|
||||
}
|
||||
}
|
||||
@@ -72,6 +72,7 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
case ModuleType.MeasureTool: return generalSettingsConfig.Enabled.MeasureTool;
|
||||
case ModuleType.ShortcutGuide: return generalSettingsConfig.Enabled.ShortcutGuide;
|
||||
case ModuleType.PowerOCR: return generalSettingsConfig.Enabled.PowerOcr;
|
||||
case ModuleType.ZoomIt: return generalSettingsConfig.Enabled.ZoomIt;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
@@ -106,6 +107,7 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
case ModuleType.MeasureTool: generalSettingsConfig.Enabled.MeasureTool = isEnabled; break;
|
||||
case ModuleType.ShortcutGuide: generalSettingsConfig.Enabled.ShortcutGuide = isEnabled; break;
|
||||
case ModuleType.PowerOCR: generalSettingsConfig.Enabled.PowerOcr = isEnabled; break;
|
||||
case ModuleType.ZoomIt: generalSettingsConfig.Enabled.ZoomIt = isEnabled; break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,6 +141,7 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
case ModuleType.MeasureTool: return GPOWrapper.GetConfiguredScreenRulerEnabledValue();
|
||||
case ModuleType.ShortcutGuide: return GPOWrapper.GetConfiguredShortcutGuideEnabledValue();
|
||||
case ModuleType.PowerOCR: return GPOWrapper.GetConfiguredTextExtractorEnabledValue();
|
||||
case ModuleType.ZoomIt: return GPOWrapper.GetConfiguredZoomItEnabledValue();
|
||||
default: return GpoRuleConfigured.Unavailable;
|
||||
}
|
||||
}
|
||||
@@ -173,6 +176,7 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
ModuleType.MeasureTool => typeof(MeasureToolPage),
|
||||
ModuleType.ShortcutGuide => typeof(ShortcutGuidePage),
|
||||
ModuleType.PowerOCR => typeof(PowerOcrPage),
|
||||
ModuleType.ZoomIt => typeof(ZoomItPage),
|
||||
_ => typeof(DashboardPage), // never called, all values listed above
|
||||
};
|
||||
}
|
||||
|
||||
@@ -48,6 +48,12 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers
|
||||
[DllImport("Comdlg32.dll", CharSet = CharSet.Unicode)]
|
||||
internal static extern bool GetOpenFileName([In, Out] OpenFileName openFileName);
|
||||
|
||||
[DllImport("comdlg32.dll", CharSet = CharSet.Auto, EntryPoint = "ChooseFont", SetLastError = true)]
|
||||
internal static extern bool ChooseFont(IntPtr lpChooseFont);
|
||||
|
||||
[DllImport("comdlg32.dll", SetLastError = true)]
|
||||
internal static extern int CommDlgExtendedError();
|
||||
|
||||
#pragma warning disable CA1401 // P/Invokes should not be visible
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool ShowWindow(System.IntPtr hWnd, int nCmdShow);
|
||||
|
||||
@@ -33,5 +33,6 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Enums
|
||||
WhatsNew,
|
||||
RegistryPreview,
|
||||
NewPlus,
|
||||
ZoomIt,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
<!-- See https://learn.microsoft.com/windows/apps/develop/platform/csharp-winrt/net-projection-from-cppwinrt-component for more info -->
|
||||
<PropertyGroup>
|
||||
<CsWinRTIncludes>PowerToys.GPOWrapper</CsWinRTIncludes>
|
||||
<CsWinRTIncludes>PowerToys.GPOWrapper;PowerToys.ZoomItSettingsInterop</CsWinRTIncludes>
|
||||
<CsWinRTGeneratedFilesDir>$(OutDir)</CsWinRTGeneratedFilesDir>
|
||||
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
|
||||
</PropertyGroup>
|
||||
@@ -87,6 +87,7 @@
|
||||
<ProjectReference Include="..\..\common\AllExperiments\AllExperiments.csproj" />
|
||||
<ProjectReference Include="..\..\common\GPOWrapper\GPOWrapper.vcxproj" />
|
||||
<ProjectReference Include="..\..\common\interop\PowerToys.Interop.vcxproj" />
|
||||
<ProjectReference Include="..\..\modules\ZoomIt\ZoomItSettingsInterop\ZoomItSettingsInterop.vcxproj" />
|
||||
<ProjectReference Include="..\..\common\ManagedCommon\ManagedCommon.csproj" />
|
||||
<ProjectReference Include="..\..\common\ManagedTelemetry\Telemetry\ManagedTelemetry.csproj" />
|
||||
<ProjectReference Include="..\..\modules\MouseUtils\MouseJump.Common\MouseJump.Common.csproj" />
|
||||
|
||||
@@ -448,6 +448,7 @@ namespace Microsoft.PowerToys.Settings.UI
|
||||
case "EnvironmentVariables": return typeof(EnvironmentVariablesPage);
|
||||
case "NewPlus": return typeof(NewPlusPage);
|
||||
case "Workspaces": return typeof(WorkspacesPage);
|
||||
case "ZoomIt": return typeof(ZoomItPage);
|
||||
default:
|
||||
// Fallback to Dashboard
|
||||
Debug.Assert(false, "Unexpected SettingsWindow argument value");
|
||||
|
||||
@@ -161,6 +161,10 @@
|
||||
x:Uid="Shell_Workspaces"
|
||||
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/Workspaces.png}"
|
||||
Tag="Workspaces" />
|
||||
<NavigationViewItem
|
||||
x:Uid="Shell_ZoomIt"
|
||||
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/ZoomIt.png}"
|
||||
Tag="ZoomIt" />
|
||||
</NavigationView.MenuItems>
|
||||
<NavigationView.FooterMenuItems>
|
||||
<NavigationViewItem
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
Modules.Insert((int)PowerToysModules.CmdNotFound, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = "CmdNotFound",
|
||||
IsNew = true,
|
||||
IsNew = false,
|
||||
});
|
||||
Modules.Insert((int)PowerToysModules.ColorPicker, new OobePowerToysModule()
|
||||
{
|
||||
@@ -101,12 +101,12 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
Modules.Insert((int)PowerToysModules.CropAndLock, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = "CropAndLock",
|
||||
IsNew = true,
|
||||
IsNew = false,
|
||||
});
|
||||
Modules.Insert((int)PowerToysModules.EnvironmentVariables, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = "EnvironmentVariables",
|
||||
IsNew = true,
|
||||
IsNew = false,
|
||||
});
|
||||
Modules.Insert((int)PowerToysModules.FancyZones, new OobePowerToysModule()
|
||||
{
|
||||
@@ -116,7 +116,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
Modules.Insert((int)PowerToysModules.FileLocksmith, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = "FileLocksmith",
|
||||
IsNew = true,
|
||||
IsNew = false,
|
||||
});
|
||||
Modules.Insert((int)PowerToysModules.FileExplorer, new OobePowerToysModule()
|
||||
{
|
||||
@@ -141,12 +141,12 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
Modules.Insert((int)PowerToysModules.MouseWithoutBorders, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = "MouseWithoutBorders",
|
||||
IsNew = true,
|
||||
IsNew = false,
|
||||
});
|
||||
Modules.Insert((int)PowerToysModules.Peek, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = "Peek",
|
||||
IsNew = true,
|
||||
IsNew = false,
|
||||
});
|
||||
Modules.Insert((int)PowerToysModules.PowerRename, new OobePowerToysModule()
|
||||
{
|
||||
@@ -183,13 +183,13 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
Modules.Insert((int)PowerToysModules.Hosts, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = "Hosts",
|
||||
IsNew = true,
|
||||
IsNew = false,
|
||||
});
|
||||
|
||||
Modules.Insert((int)PowerToysModules.Workspaces, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = "Workspaces",
|
||||
IsNew = false,
|
||||
IsNew = true,
|
||||
});
|
||||
|
||||
Modules.Insert((int)PowerToysModules.WhatsNew, new OobePowerToysModule()
|
||||
@@ -201,7 +201,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
Modules.Insert((int)PowerToysModules.RegistryPreview, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = "RegistryPreview",
|
||||
IsNew = true,
|
||||
IsNew = false,
|
||||
});
|
||||
|
||||
Modules.Insert((int)PowerToysModules.NewPlus, new OobePowerToysModule()
|
||||
@@ -209,6 +209,12 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
ModuleName = "NewPlus",
|
||||
IsNew = true,
|
||||
});
|
||||
|
||||
Modules.Insert((int)PowerToysModules.ZoomIt, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = "ZoomIt",
|
||||
IsNew = true,
|
||||
});
|
||||
}
|
||||
|
||||
public void OnClosing()
|
||||
@@ -288,6 +294,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
case "Peek": NavigationFrame.Navigate(typeof(OobePeek)); break;
|
||||
case "NewPlus": NavigationFrame.Navigate(typeof(OobeNewPlus)); break;
|
||||
case "Workspaces": NavigationFrame.Navigate(typeof(OobeWorkspaces)); break;
|
||||
case "ZoomIt": NavigationFrame.Navigate(typeof(OobeZoomIt)); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<Page
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeZoomIt"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:tk7controls="using:CommunityToolkit.WinUI.UI.Controls"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<controls:OOBEPageControl x:Uid="Oobe_ZoomIt" HeroImage="ms-appx:///Assets/Settings/Modules/OOBE/ZoomIt.gif">
|
||||
<controls:OOBEPageControl.PageContent>
|
||||
<StackPanel Orientation="Vertical" Spacing="12">
|
||||
<TextBlock x:Uid="Oobe_HowToUse" Style="{ThemeResource OobeSubtitleStyle}" />
|
||||
|
||||
<tk7controls:MarkdownTextBlock x:Uid="Oobe_ZoomIt_HowToUse" Background="Transparent" />
|
||||
|
||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||
<Button x:Uid="OOBE_Settings" Click="SettingsLaunchButton_Click" />
|
||||
<HyperlinkButton NavigateUri="https://aka.ms/PowerToysOverview_ZoomIt" Style="{StaticResource TextButtonStyle}">
|
||||
<TextBlock x:Uid="LearnMore_ZoomIt" TextWrapping="Wrap" />
|
||||
</HyperlinkButton>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</controls:OOBEPageControl.PageContent>
|
||||
</controls:OOBEPageControl>
|
||||
</Page>
|
||||
@@ -0,0 +1,45 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Navigation;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
{
|
||||
public sealed partial class OobeZoomIt : Page
|
||||
{
|
||||
public OobePowerToysModule ViewModel { get; set; }
|
||||
|
||||
public OobeZoomIt()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
ViewModel = new OobePowerToysModule(OobeShellPage.OobeShellHandler.Modules[(int)PowerToysModules.ZoomIt]);
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
|
||||
private void SettingsLaunchButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
if (OobeShellPage.OpenMainWindowCallback != null)
|
||||
{
|
||||
OobeShellPage.OpenMainWindowCallback(typeof(ZoomItPage));
|
||||
}
|
||||
|
||||
ViewModel.LogOpeningSettingsEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogOpeningModuleEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogClosingModuleEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -139,6 +139,10 @@
|
||||
x:Uid="Shell_TextExtractor"
|
||||
helpers:NavHelper.NavigateTo="views:PowerOcrPage"
|
||||
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/TextExtractor.png}" />
|
||||
<NavigationViewItem
|
||||
x:Uid="Shell_ZoomIt"
|
||||
helpers:NavHelper.NavigateTo="views:ZoomItPage"
|
||||
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/ZoomIt.png}" />
|
||||
</NavigationViewItem.MenuItems>
|
||||
</NavigationViewItem>
|
||||
|
||||
|
||||
233
src/settings-ui/Settings.UI/SettingsXAML/Views/ZoomItPage.xaml
Normal file
233
src/settings-ui/Settings.UI/SettingsXAML/Views/ZoomItPage.xaml
Normal file
@@ -0,0 +1,233 @@
|
||||
<Page
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.Views.ZoomItPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
xmlns:converters="using:Microsoft.PowerToys.Settings.UI.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls"
|
||||
xmlns:ui="using:CommunityToolkit.WinUI"
|
||||
AutomationProperties.LandmarkType="Main"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Page.Resources>
|
||||
<converters:ZoomItInitialZoomConverter x:Key="ZoomItInitialZoomConverter" />
|
||||
<converters:ZoomItTypeSpeedSliderConverter x:Key="ZoomItTypeSpeedSliderConverter" />
|
||||
</Page.Resources>
|
||||
|
||||
<controls:SettingsPageControl
|
||||
x:Uid="ZoomIt"
|
||||
IsTabStop="False"
|
||||
ModuleImageSource="ms-appx:///Assets/Settings/Modules/ZoomIt.png">
|
||||
<controls:SettingsPageControl.ModuleContent>
|
||||
<StackPanel ChildrenTransitions="{StaticResource SettingsCardsAnimations}" Orientation="Vertical">
|
||||
<tkcontrols:SettingsCard
|
||||
x:Uid="ZoomIt_EnableToggleControl_HeaderText"
|
||||
HeaderIcon="{ui:BitmapIcon Source=/Assets/Settings/Icons/ZoomIt.png}"
|
||||
IsEnabled="{x:Bind ViewModel.IsEnabledGpoConfigured, Mode=OneWay, Converter={StaticResource BoolNegationConverter}}">
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.IsEnabled, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<InfoBar
|
||||
x:Uid="GPO_SettingIsManaged"
|
||||
IsClosable="False"
|
||||
IsOpen="{x:Bind ViewModel.IsEnabledGpoConfigured, Mode=OneWay}"
|
||||
IsTabStop="{x:Bind ViewModel.IsEnabledGpoConfigured, Mode=OneWay}"
|
||||
Severity="Informational" />
|
||||
<InfoBar
|
||||
x:Uid="ZoomIt_SimultaneousStandaloneZoomItWarning"
|
||||
IsClosable="False"
|
||||
IsOpen="True"
|
||||
IsTabStop="True"
|
||||
Severity="Informational" />
|
||||
<controls:SettingsGroup x:Uid="ZoomIt_BehaviorGroup" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
|
||||
<tkcontrols:SettingsCard x:Uid="ZoomIt_Toggle_ShowTrayIcon">
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.ShowTrayIcon, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
</controls:SettingsGroup>
|
||||
<controls:SettingsGroup x:Uid="ZoomIt_ZoomGroup" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
|
||||
<tkcontrols:SettingsCard x:Uid="ZoomIt_Zoom_Shortcut" HeaderIcon="{ui:FontIcon Glyph=}">
|
||||
<controls:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind Path=ViewModel.ZoomToggleKey, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Uid="ZoomIt_Toggle_AnimateZoom">
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.AnimateZoom, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Uid="ZoomIt_Slider_InitialMagnification">
|
||||
<Slider
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
Maximum="5"
|
||||
Minimum="0"
|
||||
ThumbToolTipValueConverter="{StaticResource ZoomItInitialZoomConverter}"
|
||||
TickFrequency="1"
|
||||
TickPlacement="Outside"
|
||||
Value="{x:Bind ViewModel.ZoominSliderLevel, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
</controls:SettingsGroup>
|
||||
<controls:SettingsGroup x:Uid="ZoomIt_LiveZoomGroup" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
|
||||
<tkcontrols:SettingsCard x:Uid="ZoomIt_LiveZoom_Shortcut" HeaderIcon="{ui:FontIcon Glyph=}">
|
||||
<controls:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind Path=ViewModel.LiveZoomToggleKey, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
</controls:SettingsGroup>
|
||||
<controls:SettingsGroup x:Uid="ZoomIt_DrawGroup" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
|
||||
<tkcontrols:SettingsCard x:Uid="ZoomIt_Draw_Shortcut" HeaderIcon="{ui:FontIcon Glyph=}">
|
||||
<controls:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind Path=ViewModel.DrawToggleKey, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
</controls:SettingsGroup>
|
||||
<controls:SettingsGroup x:Uid="ZoomIt_TypeGroup" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
|
||||
<tkcontrols:SettingsCard x:Uid="ZoomIt_Type_TextFont">
|
||||
<tkcontrols:SettingsCard.Description>
|
||||
<TextBlock
|
||||
FontFamily="{x:Bind ViewModel.DemoSampleFontFamily, Mode=OneWay}"
|
||||
FontSize="{x:Bind ViewModel.DemoSampleFontSize, Mode=OneWay}"
|
||||
FontStyle="{x:Bind ViewModel.DemoSampleFontStyle, Mode=OneWay}"
|
||||
FontWeight="{x:Bind ViewModel.DemoSampleFontWeight, Mode=OneWay}"
|
||||
Text="Sample"
|
||||
TextDecorations="{x:Bind ViewModel.DemoSampleTextDecoration, Mode=OneWay}" />
|
||||
</tkcontrols:SettingsCard.Description>
|
||||
<Button x:Uid="ZoomIt_Type_Font_Button" Command="{x:Bind ViewModel.SelectTypeFontCommand, Mode=OneWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
</controls:SettingsGroup>
|
||||
<controls:SettingsGroup x:Uid="ZoomIt_DemoTypeGroup" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
|
||||
<tkcontrols:SettingsCard x:Uid="ZoomIt_DemoType_File" Description="{x:Bind ViewModel.DemoTypeFile, Mode=OneWay}">
|
||||
<Button x:Uid="ZoomIt_DemoType_File_BrowseButton" Command="{x:Bind ViewModel.SelectDemoTypeFileCommand, Mode=OneWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Uid="ZoomIt_DemoType_Shortcut" HeaderIcon="{ui:FontIcon Glyph=}">
|
||||
<controls:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind Path=ViewModel.DemoTypeToggleKey, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Uid="ZoomIt_DemoType_Toggle_UserDrivenMode">
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.DemoTypeUserDrivenMode, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Uid="ZoomIt_DemoType_SpeedSlider" Description="{x:Bind ViewModel.DemoTypeSpeedSlider, Mode=OneWay}">
|
||||
<Slider
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
Maximum="{x:Bind ViewModel.DemoTypeMinTypingSpeed, Mode=OneWay}"
|
||||
Minimum="{x:Bind ViewModel.DemoTypeMaxTypingSpeed, Mode=OneWay}"
|
||||
ThumbToolTipValueConverter="{StaticResource ZoomItTypeSpeedSliderConverter}"
|
||||
Value="{x:Bind ViewModel.DemoTypeSpeedSlider, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
</controls:SettingsGroup>
|
||||
<controls:SettingsGroup x:Uid="ZoomIt_BreakGroup" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
|
||||
<tkcontrols:SettingsCard x:Uid="ZoomIt_Break_Shortcut" HeaderIcon="{ui:FontIcon Glyph=}">
|
||||
<controls:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind Path=ViewModel.BreakTimerKey, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Uid="ZoomIt_Break_Timeout">
|
||||
<NumberBox
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
LargeChange="10"
|
||||
Maximum="99"
|
||||
Minimum="1"
|
||||
SmallChange="1"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
Value="{x:Bind ViewModel.BreakTimeout, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Uid="ZoomIt_Break_ShowExpiredTime">
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.BreakShowExpiredTime, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
|
||||
<tkcontrols:SettingsExpander x:Uid="ZoomIt_Break_PlaySoundsFile" IsExpanded="True">
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.BreakPlaySoundFile, Mode=TwoWay}" />
|
||||
<tkcontrols:SettingsExpander.Items>
|
||||
<tkcontrols:SettingsCard
|
||||
x:Uid="ZoomIt_Break_SoundFile"
|
||||
Description="{x:Bind ViewModel.BreakSoundFile, Mode=OneWay}"
|
||||
IsEnabled="{x:Bind ViewModel.BreakPlaySoundFile, Mode=OneWay}">
|
||||
<Button x:Uid="ZoomIt_Break_SoundFile_BrowseButton" Command="{x:Bind ViewModel.SelectBreakSoundFileCommand, Mode=OneWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
</tkcontrols:SettingsExpander.Items>
|
||||
</tkcontrols:SettingsExpander>
|
||||
<tkcontrols:SettingsCard x:Uid="ZoomIt_Break_TimerOpacity">
|
||||
<ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind Path=ViewModel.BreakTimerOpacityIndex, Mode=TwoWay}">
|
||||
<ComboBoxItem x:Uid="ZoomIt_Break_TimerOpacity_10Percent" />
|
||||
<ComboBoxItem x:Uid="ZoomIt_Break_TimerOpacity_20Percent" />
|
||||
<ComboBoxItem x:Uid="ZoomIt_Break_TimerOpacity_30Percent" />
|
||||
<ComboBoxItem x:Uid="ZoomIt_Break_TimerOpacity_40Percent" />
|
||||
<ComboBoxItem x:Uid="ZoomIt_Break_TimerOpacity_50Percent" />
|
||||
<ComboBoxItem x:Uid="ZoomIt_Break_TimerOpacity_60Percent" />
|
||||
<ComboBoxItem x:Uid="ZoomIt_Break_TimerOpacity_70Percent" />
|
||||
<ComboBoxItem x:Uid="ZoomIt_Break_TimerOpacity_80Percent" />
|
||||
<ComboBoxItem x:Uid="ZoomIt_Break_TimerOpacity_90Percent" />
|
||||
<ComboBoxItem x:Uid="ZoomIt_Break_TimerOpacity_100Percent" />
|
||||
</ComboBox>
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Uid="ZoomIt_Break_TimerPosition">
|
||||
<ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind Path=ViewModel.BreakTimerPosition, Mode=TwoWay}">
|
||||
<ComboBoxItem x:Uid="ZoomIt_Break_TimerPosition_TopLeftCorner" />
|
||||
<ComboBoxItem x:Uid="ZoomIt_Break_TimerPosition_TopCenter" />
|
||||
<ComboBoxItem x:Uid="ZoomIt_Break_TimerPosition_TopRightCorner" />
|
||||
<ComboBoxItem x:Uid="ZoomIt_Break_TimerPosition_Left" />
|
||||
<ComboBoxItem x:Uid="ZoomIt_Break_TimerPosition_Center" />
|
||||
<ComboBoxItem x:Uid="ZoomIt_Break_TimerPosition_Right" />
|
||||
<ComboBoxItem x:Uid="ZoomIt_Break_TimerPosition_BottomLeftCorner" />
|
||||
<ComboBoxItem x:Uid="ZoomIt_Break_TimerPosition_BottomCenter" />
|
||||
<ComboBoxItem x:Uid="ZoomIt_Break_TimerPosition_BottomRightCorner" />
|
||||
</ComboBox>
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsExpander x:Uid="ZoomIt_Break_ShowBackgroundBitmap" IsExpanded="True">
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.BreakShowBackgroundFile, Mode=TwoWay}" />
|
||||
<tkcontrols:SettingsExpander.Items>
|
||||
<tkcontrols:SettingsCard x:Uid="ZoomIt_Break_ShowDesktopOrImageFile" IsEnabled="{x:Bind ViewModel.BreakShowBackgroundFile, Mode=OneWay}">
|
||||
<RadioButtons SelectedIndex="{x:Bind ViewModel.BreakShowDesktopOrImageFileIndex, Mode=TwoWay}">
|
||||
<RadioButton x:Uid="ZoomIt_Break_ShowFadedDesktop" />
|
||||
<RadioButton x:Uid="ZoomIt_Break_ShowImageFile" />
|
||||
</RadioButtons>
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard
|
||||
x:Uid="ZoomIt_Break_BackgroundFile"
|
||||
Description="{x:Bind ViewModel.BreakBackgroundFile, Mode=OneWay}"
|
||||
IsEnabled="{x:Bind ViewModel.BreakShowBackgroundFile, Mode=OneWay}">
|
||||
<Button x:Uid="ZoomIt_Break_BackgroundFile_BrowseButton" Command="{x:Bind ViewModel.SelectBreakBackgroundFileCommand, Mode=OneWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Uid="ZoomIt_Break_BackgroundStretch">
|
||||
<ToggleSwitch
|
||||
x:Uid="ToggleSwitch"
|
||||
IsEnabled="{x:Bind ViewModel.BreakShowBackgroundFile, Mode=OneWay}"
|
||||
IsOn="{x:Bind ViewModel.BreakBackgroundStretch, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
</tkcontrols:SettingsExpander.Items>
|
||||
</tkcontrols:SettingsExpander>
|
||||
</controls:SettingsGroup>
|
||||
<controls:SettingsGroup x:Uid="ZoomIt_RecordGroup" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
|
||||
<tkcontrols:SettingsCard x:Uid="ZoomIt_Record_Shortcut" HeaderIcon="{ui:FontIcon Glyph=}">
|
||||
<controls:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind Path=ViewModel.RecordToggleKey, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Uid="ZoomIt_Record_Scaling">
|
||||
<ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind Path=ViewModel.RecordScalingIndex, Mode=TwoWay}">
|
||||
<ComboBoxItem>0.1</ComboBoxItem>
|
||||
<ComboBoxItem>0.2</ComboBoxItem>
|
||||
<ComboBoxItem>0.3</ComboBoxItem>
|
||||
<ComboBoxItem>0.4</ComboBoxItem>
|
||||
<ComboBoxItem>0.5</ComboBoxItem>
|
||||
<ComboBoxItem>0.6</ComboBoxItem>
|
||||
<ComboBoxItem>0.7</ComboBoxItem>
|
||||
<ComboBoxItem>0.8</ComboBoxItem>
|
||||
<ComboBoxItem>0.9</ComboBoxItem>
|
||||
<ComboBoxItem>1.0</ComboBoxItem>
|
||||
</ComboBox>
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Uid="ZoomIt_Record_CaptureAudio">
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.RecordCaptureAudio, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
<tkcontrols:SettingsCard x:Uid="ZoomIt_Record_Microphone">
|
||||
<ComboBox
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
DisplayMemberPath="Item2"
|
||||
ItemsSource="{x:Bind ViewModel.MicrophoneList}"
|
||||
SelectedValue="{x:Bind Path=ViewModel.RecordMicrophoneDeviceId, Mode=TwoWay}"
|
||||
SelectedValuePath="Item1" />
|
||||
</tkcontrols:SettingsCard>
|
||||
</controls:SettingsGroup>
|
||||
<controls:SettingsGroup x:Uid="ZoomIt_SnipGroup" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
|
||||
<tkcontrols:SettingsCard x:Uid="ZoomIt_Snip_Shortcut" HeaderIcon="{ui:FontIcon Glyph=}">
|
||||
<controls:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind Path=ViewModel.SnipToggleKey, Mode=TwoWay}" />
|
||||
</tkcontrols:SettingsCard>
|
||||
</controls:SettingsGroup>
|
||||
</StackPanel>
|
||||
</controls:SettingsPageControl.ModuleContent>
|
||||
<controls:SettingsPageControl.PrimaryLinks>
|
||||
<controls:PageLink x:Uid="LearnMore_ZoomIt" Link="https://aka.ms/PowerToysOverview_ZoomIt" />
|
||||
</controls:SettingsPageControl.PrimaryLinks>
|
||||
<controls:SettingsPageControl.SecondaryLinks>
|
||||
<controls:PageLink Link="https://learn.microsoft.com/en-us/sysinternals/downloads/zoomit" Text="Sysinternals Zoomit by Mark Russinovich, Alex Mihaiuc, John Stephens" />
|
||||
</controls:SettingsPageControl.SecondaryLinks>
|
||||
</controls:SettingsPageControl>
|
||||
</Page>
|
||||
@@ -0,0 +1,117 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using ManagedCommon;
|
||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
{
|
||||
public sealed partial class ZoomItPage : Page, IRefreshablePage
|
||||
{
|
||||
private ZoomItViewModel ViewModel { get; set; }
|
||||
|
||||
private const int MaxPath = 260; // ZoomIt doesn't support LONG_PATHS. We need to change it here once it does.
|
||||
|
||||
private static string PickFileDialog(string filter, string title, string initialDir = null, int initialFilter = 0)
|
||||
{
|
||||
// this code was changed to solve the problem with WinUI3 that prevents to select a file
|
||||
// while running elevated, when the issue is solved in WinUI3 it should be changed back
|
||||
OpenFileName openFileName = new OpenFileName();
|
||||
openFileName.StructSize = Marshal.SizeOf(openFileName);
|
||||
openFileName.Filter = filter;
|
||||
|
||||
// make buffer double MAX_PATH since it can use 2 chars per char.
|
||||
openFileName.File = new string(new char[MaxPath * 2]);
|
||||
openFileName.MaxFile = openFileName.File.Length;
|
||||
openFileName.FileTitle = new string(new char[MaxPath * 2]);
|
||||
openFileName.MaxFileTitle = openFileName.FileTitle.Length;
|
||||
openFileName.InitialDir = initialDir;
|
||||
openFileName.Title = title;
|
||||
openFileName.FilterIndex = initialFilter;
|
||||
openFileName.DefExt = null;
|
||||
IntPtr windowHandle = WinRT.Interop.WindowNative.GetWindowHandle(App.GetSettingsWindow());
|
||||
openFileName.Hwnd = windowHandle;
|
||||
|
||||
bool result = NativeMethods.GetOpenFileName(openFileName);
|
||||
if (result)
|
||||
{
|
||||
return openFileName.File;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static LOGFONT PickFontDialog(LOGFONT font)
|
||||
{
|
||||
IntPtr pLogFont = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(LOGFONT)));
|
||||
if (font != null)
|
||||
{
|
||||
font.lfHeight = -21;
|
||||
Marshal.StructureToPtr(font, pLogFont, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGFONT logFont = new LOGFONT();
|
||||
logFont.lfHeight = -21;
|
||||
Marshal.StructureToPtr(logFont, pLogFont, false);
|
||||
}
|
||||
|
||||
CHOOSEFONT chooseFont = new CHOOSEFONT();
|
||||
IntPtr windowHandle = WinRT.Interop.WindowNative.GetWindowHandle(App.GetSettingsWindow());
|
||||
chooseFont.hwndOwner = windowHandle;
|
||||
chooseFont.Flags = (int)(CHOOSE_FONT_FLAGS.CF_SCREENFONTS | CHOOSE_FONT_FLAGS.CF_INITTOLOGFONTSTRUCT | CHOOSE_FONT_FLAGS.CF_LIMITSIZE);
|
||||
chooseFont.rgbColors = 0;
|
||||
chooseFont.lCustData = 0;
|
||||
chooseFont.nSizeMin = 16;
|
||||
chooseFont.nSizeMax = 16;
|
||||
chooseFont.nFontType = 0x2000; // SCREEN_FONTTYPE as in the original ZoomIt source.
|
||||
chooseFont.hInstance = Marshal.GetHINSTANCE(typeof(ZoomItPage).Module);
|
||||
|
||||
// TODO: chooseFont.lpTemplateName = FORMATDLGORD31; and CHOOSE_FONT_FLAGS.CF_ENABLETEMPLATE
|
||||
chooseFont.lpLogFont = pLogFont;
|
||||
|
||||
IntPtr pChooseFont = Marshal.AllocHGlobal(Marshal.SizeOf(chooseFont));
|
||||
Marshal.StructureToPtr(chooseFont, pChooseFont, false);
|
||||
|
||||
bool callResult = NativeMethods.ChooseFont(pChooseFont);
|
||||
if (!callResult)
|
||||
{
|
||||
int error = NativeMethods.CommDlgExtendedError();
|
||||
if (error > 0)
|
||||
{
|
||||
Logger.LogError($"ChooseFont failed with extended error code {error}");
|
||||
}
|
||||
|
||||
Marshal.FreeHGlobal(pLogFont);
|
||||
Marshal.FreeHGlobal(pChooseFont);
|
||||
return null;
|
||||
}
|
||||
|
||||
CHOOSEFONT dialogResult = Marshal.PtrToStructure<CHOOSEFONT>(pChooseFont);
|
||||
LOGFONT result = Marshal.PtrToStructure<LOGFONT>(dialogResult.lpLogFont);
|
||||
|
||||
Marshal.FreeHGlobal(pLogFont);
|
||||
Marshal.FreeHGlobal(pChooseFont);
|
||||
return result;
|
||||
}
|
||||
|
||||
public ZoomItPage()
|
||||
{
|
||||
var settingsUtils = new SettingsUtils();
|
||||
ViewModel = new ZoomItViewModel(settingsUtils, SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage, PickFileDialog, PickFontDialog);
|
||||
DataContext = ViewModel;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void RefreshEnabledState()
|
||||
{
|
||||
ViewModel.RefreshEnabledState();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4428,6 +4428,314 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<data name="Workspaces_ShortDescription" xml:space="preserve">
|
||||
<value>Create and launch Workspaces</value>
|
||||
</data>
|
||||
<data name="Shell_ZoomIt.Content" xml:space="preserve">
|
||||
<value>ZoomIt</value>
|
||||
<comment>{Locked="ZoomIt"}</comment>
|
||||
</data>
|
||||
<data name="ZoomIt_EnableToggleControl_HeaderText.Header" xml:space="preserve">
|
||||
<value>Enable ZoomIt</value>
|
||||
<comment>{Locked="ZoomIt"}</comment>
|
||||
</data>
|
||||
<data name="ZoomIt.ModuleDescription" xml:space="preserve">
|
||||
<value>ZoomIt is a screen zoom, annotation, and recording tool for technical presentations and demos. You can also use ZoomIt to snip screenshots to the clipboard or to a file.</value>
|
||||
<comment>{Locked="ZoomIt"}</comment>
|
||||
</data>
|
||||
<data name="ZoomIt_ShortDescription" xml:space="preserve">
|
||||
<value>A screen zoom, annotation, and recording tool for technical presentations and demos.</value>
|
||||
</data>
|
||||
<data name="ZoomIt.ModuleTitle" xml:space="preserve">
|
||||
<value>ZoomIt</value>
|
||||
<comment>{Locked="ZoomIt"}</comment>
|
||||
</data>
|
||||
<data name="LearnMore_ZoomIt.Text" xml:space="preserve">
|
||||
<value>Learn more about ZoomIt</value>
|
||||
<comment>{Locked="ZoomIt"}</comment>
|
||||
</data>
|
||||
<data name="ZoomIt.SecondaryLinksHeader" xml:space="preserve">
|
||||
<value>Attribution</value>
|
||||
<comment>giving credit to the projects this utility was based on</comment>
|
||||
</data>
|
||||
<data name="ZoomIt_SimultaneousStandaloneZoomItWarning.Title" xml:space="preserve">
|
||||
<value>Running ZoomIt through PowerToys and the classical standalone ZoomIt executable at the same time is not supported. Please exit the original ZoomIt before enabling it here.</value>
|
||||
</data>
|
||||
<data name="ZoomIt_BehaviorGroup.Header" xml:space="preserve">
|
||||
<value>Behavior</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Toggle_ShowTrayIcon.Header" xml:space="preserve">
|
||||
<value>Show tray icon</value>
|
||||
</data>
|
||||
<data name="ZoomIt_ZoomGroup.Header" xml:space="preserve">
|
||||
<value>Zoom</value>
|
||||
</data>
|
||||
<data name="ZoomIt_ZoomGroup.Description" xml:space="preserve">
|
||||
<value>After toggling ZoomIt you can zoom in with the mouse wheel or up and down arrow keys. Exit zoom mode with Escape or by pressing the right mouse button.
|
||||
|
||||
Copy a zoomed screen with Ctrl+C or save it by typing Ctrl+S. Crop the copy or save region by entering Ctrl+Shift instead of Ctrl.</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Zoom_Shortcut.Header" xml:space="preserve">
|
||||
<value>Zoom Toggle Hotkey</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Toggle_AnimateZoom.Header" xml:space="preserve">
|
||||
<value>Animate zoom in and zoom out</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Slider_InitialMagnification.Header" xml:space="preserve">
|
||||
<value>Specify the initial level of magnification when zooming in</value>
|
||||
</data>
|
||||
<data name="ZoomIt_LiveZoomGroup.Header" xml:space="preserve">
|
||||
<value>Live Zoom</value>
|
||||
</data>
|
||||
<data name="ZoomIt_LiveZoomGroup.Description" xml:space="preserve">
|
||||
<value>LiveZoom mode supports window updates to show while zoomed.
|
||||
|
||||
Note that in LiveZoom you must use Ctrl+Up and Ctrl+Down to control the zoom level. To enter drawing mode, use the standard zoom-without-draw hotkey and then escape to go back to LiveZoom.
|
||||
|
||||
Use LiveDraw to draw and annotate the live desktop. To activate LiveDraw, enter the hotkey with the Shift key in the opposite mode. You can remove LiveDraw annotations by activating LiveDraw and enter the escape key.
|
||||
|
||||
To enter and exit LiveZoom, enter the hotkey specified below.</value>
|
||||
</data>
|
||||
<data name="ZoomIt_LiveZoom_Shortcut.Header" xml:space="preserve">
|
||||
<value>Live Zoom Toggle Hotkey</value>
|
||||
</data>
|
||||
<data name="ZoomIt_DrawGroup.Header" xml:space="preserve">
|
||||
<value>Draw</value>
|
||||
</data>
|
||||
<data name="ZoomIt_DrawGroup.Description" xml:space="preserve">
|
||||
<value>Once zoomed, toggle drawing mode by pressing the left mouse button. Undo with Ctrl+Z and all drawing by pressing E. Center the cursor with the space bar. Exit drawing mode by pressing the right mouse button.
|
||||
|
||||
Pen Control - Change the pen width by pressing left Ctrl and using the mouse wheel or the up and down arrow keys.
|
||||
|
||||
Colors - Change the pen color by pressing R (red), G (green), B (blue), O (orange), Y (yellow) or P (pink).
|
||||
|
||||
Highlight and Blur - Hold Shift while pressing a color key for a translucent highlighter color. Press X for blur or Shift+X for a stronger blur.
|
||||
|
||||
Shapes - Draw a line by holding down the Shift key, a rectangle with the Ctrl key, an ellipse with the Tab key and an arrow with Shift+Ctrl.
|
||||
|
||||
Screen - Clear the screen for a sketch pad by pressing W (white) or K (black). Copy a zoomed screen with Ctrl+C or save it by typing Ctrl+S. Crop the copy or save region by entering Ctrl+Shift instead of Ctrl.</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Draw_Shortcut.Header" xml:space="preserve">
|
||||
<value>Draw without Zoom Hotkey</value>
|
||||
</data>
|
||||
<data name="ZoomIt_TypeGroup.Header" xml:space="preserve">
|
||||
<value>Type</value>
|
||||
</data>
|
||||
<data name="ZoomIt_TypeGroup.Description" xml:space="preserve">
|
||||
<value>Once in drawing mode, type 't' to enter typing mode or shift+'t' to enter typing mode with right-aligned input. Exit typing mode by pressing escape or the left mouse button. Use the mouse wheel or up and down arrow keys to change the font size.
|
||||
|
||||
The text color is the current drawing color.</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Type_TextFont.Header" xml:space="preserve">
|
||||
<value>Text font</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Type_Font_Button.Content" xml:space="preserve">
|
||||
<value>Choose Font</value>
|
||||
<comment>Font refers to text font</comment>
|
||||
</data>
|
||||
<data name="ZoomIt_DemoTypeGroup.Header" xml:space="preserve">
|
||||
<value>Demo Type</value>
|
||||
</data>
|
||||
<data name="ZoomIt_DemoTypeGroup.Description" xml:space="preserve">
|
||||
<value>Use DemoType to have ZoomIt type text specified in the input file when you enter the DemoType toggle. You can also pull input from the clipboard if it is prefixed with the [start] keyword.
|
||||
|
||||
Separate snippets with the [end] keyword and insert pauses into the text output with the [pause:n] keyword where 'n' is seconds. Send text via the clipboard with [paste] and [/paste]. Send keystrokes with [enter], [up], [down], [left] and [right].
|
||||
|
||||
You can have ZoomIt send text automatically, or select the option to drive input with typing. ZoomIt will block keyboard input while sending output.
|
||||
|
||||
When driving input, hit the space bar to unblock keyboard input at the end of a snippet. In auto mode, control will be returned upon completion.
|
||||
|
||||
When you reach the end of the file, ZoomIt will reload the file and start at the beginning. Enter the hotkey with the Shift key in the opposite mode to step back to the last [end].</value>
|
||||
</data>
|
||||
<data name="ZoomIt_DemoType_Shortcut.Header" xml:space="preserve">
|
||||
<value>Demo Type Toggle Hotkey</value>
|
||||
</data>
|
||||
<data name="ZoomIt_DemoType_File.Header" xml:space="preserve">
|
||||
<value>Input file</value>
|
||||
</data>
|
||||
<data name="ZoomIt_DemoType_File_BrowseButton.Content" xml:space="preserve">
|
||||
<value>Browse</value>
|
||||
</data>
|
||||
<data name="ZoomIt_DemoType_File_Picker_Dialog_Title" xml:space="preserve">
|
||||
<value>Specify DemoType file...</value>
|
||||
</data>
|
||||
<data name="FilePicker_AllFilesFilter" xml:space="preserve">
|
||||
<value>All Files</value>
|
||||
</data>
|
||||
<data name="ZoomIt_DemoType_Toggle_UserDrivenMode.Header" xml:space="preserve">
|
||||
<value>Drive input with typing</value>
|
||||
</data>
|
||||
<data name="ZoomIt_DemoType_SpeedSlider.Header" xml:space="preserve">
|
||||
<value>DemoType typing speed</value>
|
||||
</data>
|
||||
<data name="ZoomIt_DemoType_SpeedSlider_Thumbnail_Explanation" xml:space="preserve">
|
||||
<value>bigger is faster</value>
|
||||
</data>
|
||||
<data name="ZoomIt_BreakGroup.Header" xml:space="preserve">
|
||||
<value>Break</value>
|
||||
</data>
|
||||
<data name="ZoomIt_BreakGroup.Description" xml:space="preserve">
|
||||
<value>Enter timer mode by using the ZoomIt tray icon's Break menu item. Increase and decrease time with the arrow keys. If you Alt-Tab away from the timer window, reactivate it by left-clicking on the ZoomIt tray icon. Exit timer mode with Escape.
|
||||
|
||||
Change the break timer color using the same keys that the drawing color. The break timer font is the same as text font.</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_Shortcut.Header" xml:space="preserve">
|
||||
<value>Start Break Timer Hotkey</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_Timeout.Header" xml:space="preserve">
|
||||
<value>Timer (minutes)</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_ShowExpiredTime.Header" xml:space="preserve">
|
||||
<value>Show Time Elapsed After Expiration</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_PlaySoundsFile.Header" xml:space="preserve">
|
||||
<value>Play Sound on Expiration</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_SoundFile.Header" xml:space="preserve">
|
||||
<value>Alarm Sound File</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_SoundFile_BrowseButton.Content" xml:space="preserve">
|
||||
<value>Browse</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_SoundFile_Picker_Dialog_Title" xml:space="preserve">
|
||||
<value>Specify sound file...</value>
|
||||
</data>
|
||||
<data name="FilePicker_ZoomIt_SoundsFilter" xml:space="preserve">
|
||||
<value>Sounds</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_TimerOpacity.Header" xml:space="preserve">
|
||||
<value>Timer Opacity</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_TimerOpacity_10Percent.Content" xml:space="preserve">
|
||||
<value>10%</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_TimerOpacity_20Percent.Content" xml:space="preserve">
|
||||
<value>20%</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_TimerOpacity_30Percent.Content" xml:space="preserve">
|
||||
<value>30%</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_TimerOpacity_40Percent.Content" xml:space="preserve">
|
||||
<value>40%</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_TimerOpacity_50Percent.Content" xml:space="preserve">
|
||||
<value>50%</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_TimerOpacity_60Percent.Content" xml:space="preserve">
|
||||
<value>60%</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_TimerOpacity_70Percent.Content" xml:space="preserve">
|
||||
<value>70%</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_TimerOpacity_80Percent.Content" xml:space="preserve">
|
||||
<value>80%</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_TimerOpacity_90Percent.Content" xml:space="preserve">
|
||||
<value>90%</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_TimerOpacity_100Percent.Content" xml:space="preserve">
|
||||
<value>100%</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_TimerPosition.Header" xml:space="preserve">
|
||||
<value>Timer Position</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_TimerPosition_TopLeftCorner.Content" xml:space="preserve">
|
||||
<value>Top left corner</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_TimerPosition_TopCenter.Content" xml:space="preserve">
|
||||
<value>Top center</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_TimerPosition_TopRightCorner.Content" xml:space="preserve">
|
||||
<value>Top right corner</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_TimerPosition_Left.Content" xml:space="preserve">
|
||||
<value>Left</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_TimerPosition_Center.Content" xml:space="preserve">
|
||||
<value>Center</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_TimerPosition_Right.Content" xml:space="preserve">
|
||||
<value>Right</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_TimerPosition_BottomLeftCorner.Content" xml:space="preserve">
|
||||
<value>Bottom left corner</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_TimerPosition_BottomCenter.Content" xml:space="preserve">
|
||||
<value>Bottom center</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_TimerPosition_BottomRightCorner.Content" xml:space="preserve">
|
||||
<value>Bottom right corner</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_ShowBackgroundBitmap.Header" xml:space="preserve">
|
||||
<value>Show Background Bitmap</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_ShowFadedDesktop.Content" xml:space="preserve">
|
||||
<value>Use faded desktop as background</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_ShowImageFile.Content" xml:space="preserve">
|
||||
<value>Use image file as background</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_BackgroundFile.Header" xml:space="preserve">
|
||||
<value>Background Image File</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_BackgroundFile_BrowseButton.Content" xml:space="preserve">
|
||||
<value>Browse</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_BackgroundFile_Picker_Dialog_Title" xml:space="preserve">
|
||||
<value>Specify background file...</value>
|
||||
</data>
|
||||
<data name="FilePicker_ZoomIt_BitmapFilesFilter" xml:space="preserve">
|
||||
<value>Bitmap Files</value>
|
||||
</data>
|
||||
<data name="FilePicker_ZoomIt_AllPicturesFilter" xml:space="preserve">
|
||||
<value>All Picture Files</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Break_BackgroundStretch.Header" xml:space="preserve">
|
||||
<value>Scale to screen</value>
|
||||
</data>
|
||||
<data name="ZoomIt_RecordGroup.Header" xml:space="preserve">
|
||||
<value>Record</value>
|
||||
</data>
|
||||
<data name="ZoomIt_RecordGroup.Description" xml:space="preserve">
|
||||
<value>Record video of the unzoomed live screen or a static zoomed session by entering the recording hot key and finish the recording by entering it again.
|
||||
|
||||
To crop the portion of the screen that will be recorded, enter the hotkey with the Shift key in the opposite mode.
|
||||
|
||||
To record a specific window, enter the hotkey with the Alt key in the opposite mode.</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Record_Shortcut.Header" xml:space="preserve">
|
||||
<value>Record Toggle Hotkey</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Record_Scaling.Header" xml:space="preserve">
|
||||
<value>Scaling</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Record_CaptureAudio.Header" xml:space="preserve">
|
||||
<value>Capture audio input</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Record_Microphone.Header" xml:space="preserve">
|
||||
<value>Microphone</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Record_Microphones_Default_Name" xml:space="preserve">
|
||||
<value>Default</value>
|
||||
</data>
|
||||
<data name="ZoomIt_SnipGroup.Header" xml:space="preserve">
|
||||
<value>Snip</value>
|
||||
</data>
|
||||
<data name="ZoomIt_SnipGroup.Description" xml:space="preserve">
|
||||
<value>Copy a region of the screen to the clipboard or enter the hotkey with the Shift key in the opposite mode to save it to a file.</value>
|
||||
</data>
|
||||
<data name="ZoomIt_Snip_Shortcut.Header" xml:space="preserve">
|
||||
<value>Snip Toggle Hotkey</value>
|
||||
</data>
|
||||
<data name="Oobe_ZoomIt.Description" xml:space="preserve">
|
||||
<value>ZoomIt is a screen zoom, annotation, and recording tool for technical presentations and demos. You can also use ZoomIt to snip screenshots to the clipboard or to a file.</value>
|
||||
<comment>{Locked="ZoomIt"}</comment>
|
||||
</data>
|
||||
<data name="Oobe_ZoomIt.Title" xml:space="preserve">
|
||||
<value>ZoomIt</value>
|
||||
<comment>{Locked="ZoomIt"}</comment>
|
||||
</data>
|
||||
<data name="Oobe_ZoomIt_HowToUse.Text" xml:space="preserve">
|
||||
<value>Enable ZoomIt from the Settings page and check available shortcuts and modes.</value>
|
||||
<comment>{Locked="ZoomIt"}</comment>
|
||||
</data>
|
||||
<data name="MouseWithoutBorders_PolicyIPAddressMappingInfo.Title" xml:space="preserve">
|
||||
<value>Rules defined by your organization</value>
|
||||
</data>
|
||||
|
||||
@@ -195,6 +195,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
ModuleType.ShortcutGuide => GetModuleItemsShortcutGuide(),
|
||||
ModuleType.PowerOCR => GetModuleItemsPowerOCR(),
|
||||
ModuleType.NewPlus => GetModuleItemsNewPlus(),
|
||||
ModuleType.ZoomIt => GetModuleItemsZoomIt(),
|
||||
_ => new ObservableCollection<DashboardModuleItem>(), // never called, all values listed above
|
||||
};
|
||||
}
|
||||
@@ -521,6 +522,15 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
return new ObservableCollection<DashboardModuleItem>(list);
|
||||
}
|
||||
|
||||
private ObservableCollection<DashboardModuleItem> GetModuleItemsZoomIt()
|
||||
{
|
||||
var list = new List<DashboardModuleItem>
|
||||
{
|
||||
new DashboardModuleTextItem() { Label = resourceLoader.GetString("ZoomIt_ShortDescription") },
|
||||
};
|
||||
return new ObservableCollection<DashboardModuleItem>(list);
|
||||
}
|
||||
|
||||
internal void SWVersionButtonClicked()
|
||||
{
|
||||
NavigationService.Navigate(typeof(GeneralPage));
|
||||
|
||||
764
src/settings-ui/Settings.UI/ViewModels/ZoomItViewModel.cs
Normal file
764
src/settings-ui/Settings.UI/ViewModels/ZoomItViewModel.cs
Normal file
@@ -0,0 +1,764 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text.Json;
|
||||
using AllExperiments;
|
||||
using global::PowerToys.GPOWrapper;
|
||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.ViewModels.Commands;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
using Microsoft.Windows.ApplicationModel.Resources;
|
||||
using Windows.Devices.Enumeration;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class ZoomItViewModel : Observable
|
||||
{
|
||||
private ISettingsUtils SettingsUtils { get; set; }
|
||||
|
||||
private GeneralSettings GeneralSettingsConfig { get; set; }
|
||||
|
||||
private readonly ZoomItSettings _zoomItSettings;
|
||||
|
||||
private Func<string, int> SendConfigMSG { get; }
|
||||
|
||||
private Func<string, string, string, int, string> PickFileDialog { get; }
|
||||
|
||||
private Func<LOGFONT, LOGFONT> PickFontDialog { get; }
|
||||
|
||||
public ButtonClickCommand SelectDemoTypeFileCommand { get; set; }
|
||||
|
||||
public ButtonClickCommand SelectBreakSoundFileCommand { get; set; }
|
||||
|
||||
public ButtonClickCommand SelectBreakBackgroundFileCommand { get; set; }
|
||||
|
||||
public ButtonClickCommand SelectTypeFontCommand { get; set; }
|
||||
|
||||
// These values should track what's in DemoType.h
|
||||
public int DemoTypeMaxTypingSpeed { get; } = 10;
|
||||
|
||||
public int DemoTypeMinTypingSpeed { get; } = 100;
|
||||
|
||||
public ObservableCollection<Tuple<string, string>> MicrophoneList { get; set; } = new ObservableCollection<Tuple<string, string>>();
|
||||
|
||||
private async void LoadMicrophoneList()
|
||||
{
|
||||
ResourceLoader resourceLoader = ResourceLoaderInstance.ResourceLoader;
|
||||
string recordDefaultMicrophone = resourceLoader.GetString("ZoomIt_Record_Microphones_Default_Name");
|
||||
MicrophoneList.Add(new Tuple<string, string>(string.Empty, recordDefaultMicrophone));
|
||||
var microphones = await DeviceInformation.FindAllAsync(DeviceClass.AudioCapture);
|
||||
foreach (var microphone in microphones)
|
||||
{
|
||||
MicrophoneList.Add(new Tuple<string, string>(microphone.Id, microphone.Name));
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly JsonSerializerOptions _serializerOptions = new JsonSerializerOptions
|
||||
{
|
||||
MaxDepth = 0,
|
||||
IncludeFields = true,
|
||||
};
|
||||
|
||||
public ZoomItViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc, Func<string, string, string, int, string> pickFileDialog, Func<LOGFONT, LOGFONT> pickFontDialog)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(settingsUtils);
|
||||
|
||||
SettingsUtils = settingsUtils;
|
||||
|
||||
// To obtain the general settings configurations of PowerToys Settings.
|
||||
ArgumentNullException.ThrowIfNull(settingsRepository);
|
||||
|
||||
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
||||
|
||||
var zoomItSettings = global::PowerToys.ZoomItSettingsInterop.ZoomItSettings.LoadSettingsJson();
|
||||
_zoomItSettings = JsonSerializer.Deserialize<ZoomItSettings>(zoomItSettings, _serializerOptions);
|
||||
|
||||
InitializeEnabledValue();
|
||||
|
||||
// set the callback functions value to handle outgoing IPC message for the enabled value.
|
||||
SendConfigMSG = ipcMSGCallBackFunc;
|
||||
|
||||
// set the callback for when we need the user to pick a file.
|
||||
PickFileDialog = pickFileDialog;
|
||||
|
||||
// set the callback for when we need the user to pick a font.
|
||||
PickFontDialog = pickFontDialog;
|
||||
|
||||
_typeFont = TypeFont;
|
||||
|
||||
SelectDemoTypeFileCommand = new ButtonClickCommand(SelectDemoTypeFileAction);
|
||||
SelectBreakSoundFileCommand = new ButtonClickCommand(SelectBreakSoundFileAction);
|
||||
SelectBreakBackgroundFileCommand = new ButtonClickCommand(SelectBreakBackgroundFileAction);
|
||||
SelectTypeFontCommand = new ButtonClickCommand(SelectTypeFontAction);
|
||||
|
||||
LoadMicrophoneList();
|
||||
}
|
||||
|
||||
private void InitializeEnabledValue()
|
||||
{
|
||||
_enabledGpoRuleConfiguration = GPOWrapper.GetConfiguredZoomItEnabledValue();
|
||||
if (_enabledGpoRuleConfiguration == GpoRuleConfigured.Disabled || _enabledGpoRuleConfiguration == GpoRuleConfigured.Enabled)
|
||||
{
|
||||
// Get the enabled state from GPO.
|
||||
_enabledStateIsGPOConfigured = true;
|
||||
_isEnabled = _enabledGpoRuleConfiguration == GpoRuleConfigured.Enabled;
|
||||
}
|
||||
else
|
||||
{
|
||||
_isEnabled = GeneralSettingsConfig.Enabled.ZoomIt;
|
||||
}
|
||||
}
|
||||
|
||||
private void SendCustomAction(string actionName)
|
||||
{
|
||||
SendConfigMSG("{\"action\":{\"ZoomIt\":{\"action_name\":\"" + actionName + "\", \"value\":\"\"}}}");
|
||||
}
|
||||
|
||||
public bool IsEnabled
|
||||
{
|
||||
get => _isEnabled;
|
||||
|
||||
set
|
||||
{
|
||||
if (_enabledStateIsGPOConfigured)
|
||||
{
|
||||
// If it's GPO configured, shouldn't be able to change this state.
|
||||
return;
|
||||
}
|
||||
|
||||
if (value != _isEnabled)
|
||||
{
|
||||
_isEnabled = value;
|
||||
|
||||
// Set the status in the general settings configuration
|
||||
GeneralSettingsConfig.Enabled.ZoomIt = value;
|
||||
OutGoingGeneralSettings snd = new OutGoingGeneralSettings(GeneralSettingsConfig);
|
||||
|
||||
SendConfigMSG(snd.ToString());
|
||||
OnPropertyChanged(nameof(IsEnabled));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsEnabledGpoConfigured
|
||||
{
|
||||
get => _enabledStateIsGPOConfigured;
|
||||
}
|
||||
|
||||
public bool ShowTrayIcon
|
||||
{
|
||||
get => _zoomItSettings.Properties.ShowTrayIcon.Value;
|
||||
set
|
||||
{
|
||||
if (_zoomItSettings.Properties.ShowTrayIcon.Value != value)
|
||||
{
|
||||
_zoomItSettings.Properties.ShowTrayIcon.Value = value;
|
||||
OnPropertyChanged(nameof(ShowTrayIcon));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings ZoomToggleKey
|
||||
{
|
||||
get => _zoomItSettings.Properties.ToggleKey.Value;
|
||||
set
|
||||
{
|
||||
if (_zoomItSettings.Properties.ToggleKey.Value != value)
|
||||
{
|
||||
_zoomItSettings.Properties.ToggleKey.Value = value ?? ZoomItProperties.DefaultToggleKey;
|
||||
OnPropertyChanged(nameof(ZoomToggleKey));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool AnimateZoom
|
||||
{
|
||||
get => _zoomItSettings.Properties.AnimnateZoom.Value;
|
||||
set
|
||||
{
|
||||
if (_zoomItSettings.Properties.AnimnateZoom.Value != value)
|
||||
{
|
||||
_zoomItSettings.Properties.AnimnateZoom.Value = value;
|
||||
OnPropertyChanged(nameof(AnimateZoom));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int ZoominSliderLevel
|
||||
{
|
||||
get => _zoomItSettings.Properties.ZoominSliderLevel.Value;
|
||||
set
|
||||
{
|
||||
if (_zoomItSettings.Properties.ZoominSliderLevel.Value != value)
|
||||
{
|
||||
_zoomItSettings.Properties.ZoominSliderLevel.Value = value;
|
||||
OnPropertyChanged(nameof(ZoominSliderLevel));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings LiveZoomToggleKey
|
||||
{
|
||||
get => _zoomItSettings.Properties.LiveZoomToggleKey.Value;
|
||||
set
|
||||
{
|
||||
if (_zoomItSettings.Properties.LiveZoomToggleKey.Value != value)
|
||||
{
|
||||
_zoomItSettings.Properties.LiveZoomToggleKey.Value = value ?? ZoomItProperties.DefaultLiveZoomToggleKey;
|
||||
OnPropertyChanged(nameof(LiveZoomToggleKey));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings DrawToggleKey
|
||||
{
|
||||
get => _zoomItSettings.Properties.DrawToggleKey.Value;
|
||||
set
|
||||
{
|
||||
if (_zoomItSettings.Properties.DrawToggleKey.Value != value)
|
||||
{
|
||||
_zoomItSettings.Properties.DrawToggleKey.Value = value ?? ZoomItProperties.DefaultDrawToggleKey;
|
||||
OnPropertyChanged(nameof(DrawToggleKey));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings RecordToggleKey
|
||||
{
|
||||
get => _zoomItSettings.Properties.RecordToggleKey.Value;
|
||||
set
|
||||
{
|
||||
if (_zoomItSettings.Properties.RecordToggleKey.Value != value)
|
||||
{
|
||||
_zoomItSettings.Properties.RecordToggleKey.Value = value ?? ZoomItProperties.DefaultRecordToggleKey;
|
||||
OnPropertyChanged(nameof(RecordToggleKey));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings SnipToggleKey
|
||||
{
|
||||
get => _zoomItSettings.Properties.SnipToggleKey.Value;
|
||||
set
|
||||
{
|
||||
if (_zoomItSettings.Properties.SnipToggleKey.Value != value)
|
||||
{
|
||||
_zoomItSettings.Properties.SnipToggleKey.Value = value ?? ZoomItProperties.DefaultSnipToggleKey;
|
||||
OnPropertyChanged(nameof(SnipToggleKey));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings BreakTimerKey
|
||||
{
|
||||
get => _zoomItSettings.Properties.BreakTimerKey.Value;
|
||||
set
|
||||
{
|
||||
if (_zoomItSettings.Properties.BreakTimerKey.Value != value)
|
||||
{
|
||||
_zoomItSettings.Properties.BreakTimerKey.Value = value ?? ZoomItProperties.DefaultBreakTimerKey;
|
||||
OnPropertyChanged(nameof(BreakTimerKey));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings DemoTypeToggleKey
|
||||
{
|
||||
get => _zoomItSettings.Properties.DemoTypeToggleKey.Value;
|
||||
set
|
||||
{
|
||||
if (_zoomItSettings.Properties.DemoTypeToggleKey.Value != value)
|
||||
{
|
||||
_zoomItSettings.Properties.DemoTypeToggleKey.Value = value ?? ZoomItProperties.DefaultDemoTypeToggleKey;
|
||||
OnPropertyChanged(nameof(DemoTypeToggleKey));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private LOGFONT _typeFont;
|
||||
|
||||
public LOGFONT TypeFont
|
||||
{
|
||||
get
|
||||
{
|
||||
var encodedFont = _zoomItSettings.Properties.Font.Value;
|
||||
byte[] decodedFont = Convert.FromBase64String(encodedFont);
|
||||
int size = Marshal.SizeOf(typeof(LOGFONT));
|
||||
if (size != decodedFont.Length)
|
||||
{
|
||||
throw new InvalidOperationException("Expected byte array from saved Settings doesn't match the LOGFONT structure size");
|
||||
}
|
||||
|
||||
// Allocate unmanaged memory to hold the byte array
|
||||
IntPtr ptr = Marshal.AllocHGlobal(size);
|
||||
try
|
||||
{
|
||||
// Copy the byte array into unmanaged memory
|
||||
Marshal.Copy(decodedFont, 0, ptr, size);
|
||||
|
||||
// Marshal the unmanaged memory back to a LOGFONT structure
|
||||
return (LOGFONT)Marshal.PtrToStructure(ptr, typeof(LOGFONT));
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Free the unmanaged memory
|
||||
Marshal.FreeHGlobal(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_typeFont = value;
|
||||
int size = Marshal.SizeOf(typeof(LOGFONT));
|
||||
byte[] bytes = new byte[size];
|
||||
|
||||
// Allocate unmanaged memory for the LOGFONT structure
|
||||
IntPtr ptr = Marshal.AllocHGlobal(size);
|
||||
try
|
||||
{
|
||||
// Marshal the LOGFONT structure to the unmanaged memory
|
||||
Marshal.StructureToPtr(value, ptr, false);
|
||||
|
||||
// Copy the unmanaged memory into the managed byte array
|
||||
Marshal.Copy(ptr, bytes, 0, size);
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Free the unmanaged memory
|
||||
Marshal.FreeHGlobal(ptr);
|
||||
}
|
||||
|
||||
_zoomItSettings.Properties.Font.Value = Convert.ToBase64String(bytes);
|
||||
OnPropertyChanged(nameof(DemoSampleFontFamily));
|
||||
OnPropertyChanged(nameof(DemoSampleFontSize));
|
||||
OnPropertyChanged(nameof(DemoSampleFontWeight));
|
||||
OnPropertyChanged(nameof(DemoSampleFontStyle));
|
||||
OnPropertyChanged(nameof(DemoSampleTextDecoration));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public FontFamily DemoSampleFontFamily
|
||||
{
|
||||
get
|
||||
{
|
||||
return new FontFamily(_typeFont.lfFaceName);
|
||||
}
|
||||
}
|
||||
|
||||
public double DemoSampleFontSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return _typeFont.lfHeight <= 0 ? 16 : _typeFont.lfHeight; // 16 is always the height we expect?
|
||||
}
|
||||
}
|
||||
|
||||
public global::Windows.UI.Text.FontWeight DemoSampleFontWeight
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_typeFont.lfWeight <= (int)FontWeight.FW_DONT_CARE)
|
||||
{
|
||||
return Microsoft.UI.Text.FontWeights.Normal;
|
||||
}
|
||||
else if (_typeFont.lfWeight <= (int)FontWeight.FW_THIN)
|
||||
{
|
||||
return Microsoft.UI.Text.FontWeights.Thin;
|
||||
}
|
||||
else if (_typeFont.lfWeight <= (int)FontWeight.FW_EXTRALIGHT)
|
||||
{
|
||||
return Microsoft.UI.Text.FontWeights.ExtraLight;
|
||||
}
|
||||
else if (_typeFont.lfWeight <= (int)FontWeight.FW_LIGHT)
|
||||
{
|
||||
return Microsoft.UI.Text.FontWeights.Light;
|
||||
}
|
||||
else if (_typeFont.lfWeight <= (int)FontWeight.FW_NORMAL)
|
||||
{
|
||||
return Microsoft.UI.Text.FontWeights.Normal;
|
||||
}
|
||||
else if (_typeFont.lfWeight <= (int)FontWeight.FW_MEDIUM)
|
||||
{
|
||||
return Microsoft.UI.Text.FontWeights.Medium;
|
||||
}
|
||||
else if (_typeFont.lfWeight <= (int)FontWeight.FW_SEMIBOLD)
|
||||
{
|
||||
return Microsoft.UI.Text.FontWeights.SemiBold;
|
||||
}
|
||||
else if (_typeFont.lfWeight <= (int)FontWeight.FW_BOLD)
|
||||
{
|
||||
return Microsoft.UI.Text.FontWeights.Bold;
|
||||
}
|
||||
else if (_typeFont.lfWeight <= (int)FontWeight.FW_EXTRABOLD)
|
||||
{
|
||||
return Microsoft.UI.Text.FontWeights.ExtraBold;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Microsoft.UI.Text.FontWeights.Black; // FW_HEAVY
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public global::Windows.UI.Text.FontStyle DemoSampleFontStyle
|
||||
{
|
||||
get => _typeFont.lfItalic != 0 ? global::Windows.UI.Text.FontStyle.Italic : global::Windows.UI.Text.FontStyle.Normal;
|
||||
}
|
||||
|
||||
public global::Windows.UI.Text.TextDecorations DemoSampleTextDecoration
|
||||
{
|
||||
get => _typeFont.lfUnderline != 0 ? global::Windows.UI.Text.TextDecorations.Underline : global::Windows.UI.Text.TextDecorations.None;
|
||||
}
|
||||
|
||||
public string DemoTypeFile
|
||||
{
|
||||
get => _zoomItSettings.Properties.DemoTypeFile.Value;
|
||||
set
|
||||
{
|
||||
if (_zoomItSettings.Properties.DemoTypeFile.Value != value)
|
||||
{
|
||||
_zoomItSettings.Properties.DemoTypeFile.Value = value;
|
||||
OnPropertyChanged(nameof(DemoTypeFile));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool DemoTypeUserDrivenMode
|
||||
{
|
||||
get => _zoomItSettings.Properties.DemoTypeUserDrivenMode.Value;
|
||||
set
|
||||
{
|
||||
if (_zoomItSettings.Properties.DemoTypeUserDrivenMode.Value != value)
|
||||
{
|
||||
_zoomItSettings.Properties.DemoTypeUserDrivenMode.Value = value;
|
||||
OnPropertyChanged(nameof(DemoTypeUserDrivenMode));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int DemoTypeSpeedSlider
|
||||
{
|
||||
get => _zoomItSettings.Properties.DemoTypeSpeedSlider.Value;
|
||||
set
|
||||
{
|
||||
if (_zoomItSettings.Properties.DemoTypeSpeedSlider.Value != value)
|
||||
{
|
||||
_zoomItSettings.Properties.DemoTypeSpeedSlider.Value = value;
|
||||
OnPropertyChanged(nameof(DemoTypeSpeedSlider));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int BreakTimeout
|
||||
{
|
||||
get => _zoomItSettings.Properties.BreakTimeout.Value;
|
||||
set
|
||||
{
|
||||
if (_zoomItSettings.Properties.BreakTimeout.Value != value)
|
||||
{
|
||||
_zoomItSettings.Properties.BreakTimeout.Value = value;
|
||||
OnPropertyChanged(nameof(BreakTimeout));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool BreakShowExpiredTime
|
||||
{
|
||||
get => _zoomItSettings.Properties.ShowExpiredTime.Value;
|
||||
set
|
||||
{
|
||||
if (_zoomItSettings.Properties.ShowExpiredTime.Value != value)
|
||||
{
|
||||
_zoomItSettings.Properties.ShowExpiredTime.Value = value;
|
||||
OnPropertyChanged(nameof(BreakShowExpiredTime));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool BreakPlaySoundFile
|
||||
{
|
||||
get => _zoomItSettings.Properties.BreakPlaySoundFile.Value;
|
||||
set
|
||||
{
|
||||
if (_zoomItSettings.Properties.BreakPlaySoundFile.Value != value)
|
||||
{
|
||||
_zoomItSettings.Properties.BreakPlaySoundFile.Value = value;
|
||||
OnPropertyChanged(nameof(BreakPlaySoundFile));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string BreakSoundFile
|
||||
{
|
||||
get => _zoomItSettings.Properties.BreakSoundFile.Value;
|
||||
set
|
||||
{
|
||||
if (_zoomItSettings.Properties.BreakSoundFile.Value != value)
|
||||
{
|
||||
_zoomItSettings.Properties.BreakSoundFile.Value = value;
|
||||
OnPropertyChanged(nameof(BreakSoundFile));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int BreakTimerOpacityIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return Math.Clamp((_zoomItSettings.Properties.BreakOpacity.Value / 10) - 1, 0, 9);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
int newValue = (value + 1) * 10;
|
||||
if (_zoomItSettings.Properties.BreakOpacity.Value != newValue)
|
||||
{
|
||||
_zoomItSettings.Properties.BreakOpacity.Value = newValue;
|
||||
OnPropertyChanged(nameof(BreakTimerOpacityIndex));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int BreakTimerPosition
|
||||
{
|
||||
get => _zoomItSettings.Properties.BreakTimerPosition.Value;
|
||||
set
|
||||
{
|
||||
if (_zoomItSettings.Properties.BreakTimerPosition.Value != value)
|
||||
{
|
||||
_zoomItSettings.Properties.BreakTimerPosition.Value = value;
|
||||
OnPropertyChanged(nameof(BreakTimerPosition));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool BreakShowBackgroundFile
|
||||
{
|
||||
get => _zoomItSettings.Properties.BreakShowBackgroundFile.Value;
|
||||
set
|
||||
{
|
||||
if (_zoomItSettings.Properties.BreakShowBackgroundFile.Value != value)
|
||||
{
|
||||
_zoomItSettings.Properties.BreakShowBackgroundFile.Value = value;
|
||||
OnPropertyChanged(nameof(BreakShowBackgroundFile));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int BreakShowDesktopOrImageFileIndex
|
||||
{
|
||||
get => _zoomItSettings.Properties.BreakShowDesktop.Value ? 0 : 1;
|
||||
set
|
||||
{
|
||||
bool newValue = value == 0;
|
||||
if (_zoomItSettings.Properties.BreakShowDesktop.Value != newValue)
|
||||
{
|
||||
_zoomItSettings.Properties.BreakShowDesktop.Value = newValue;
|
||||
OnPropertyChanged(nameof(BreakShowDesktopOrImageFileIndex));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string BreakBackgroundFile
|
||||
{
|
||||
get => _zoomItSettings.Properties.BreakBackgroundFile.Value;
|
||||
set
|
||||
{
|
||||
if (_zoomItSettings.Properties.BreakBackgroundFile.Value != value)
|
||||
{
|
||||
_zoomItSettings.Properties.BreakBackgroundFile.Value = value;
|
||||
OnPropertyChanged(nameof(BreakBackgroundFile));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool BreakBackgroundStretch
|
||||
{
|
||||
get => _zoomItSettings.Properties.BreakBackgroundStretch.Value;
|
||||
set
|
||||
{
|
||||
if (_zoomItSettings.Properties.BreakBackgroundStretch.Value != value)
|
||||
{
|
||||
_zoomItSettings.Properties.BreakBackgroundStretch.Value = value;
|
||||
OnPropertyChanged(nameof(BreakBackgroundStretch));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int RecordScalingIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return Math.Clamp((_zoomItSettings.Properties.RecordScaling.Value / 10) - 1, 0, 9);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
int newValue = (value + 1) * 10;
|
||||
if (_zoomItSettings.Properties.RecordScaling.Value != newValue)
|
||||
{
|
||||
_zoomItSettings.Properties.RecordScaling.Value = newValue;
|
||||
OnPropertyChanged(nameof(RecordScalingIndex));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool RecordCaptureAudio
|
||||
{
|
||||
get => _zoomItSettings.Properties.CaptureAudio.Value;
|
||||
set
|
||||
{
|
||||
if (_zoomItSettings.Properties.CaptureAudio.Value != value)
|
||||
{
|
||||
_zoomItSettings.Properties.CaptureAudio.Value = value;
|
||||
OnPropertyChanged(nameof(RecordCaptureAudio));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string RecordMicrophoneDeviceId
|
||||
{
|
||||
get => _zoomItSettings.Properties.MicrophoneDeviceId.Value;
|
||||
set
|
||||
{
|
||||
if (_zoomItSettings.Properties.MicrophoneDeviceId.Value != value)
|
||||
{
|
||||
_zoomItSettings.Properties.MicrophoneDeviceId.Value = value ?? string.Empty; // If we're trying to save a null, just default to empty string, which means default microphone.
|
||||
OnPropertyChanged(nameof(RecordMicrophoneDeviceId));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void NotifySettingsChanged()
|
||||
{
|
||||
global::PowerToys.ZoomItSettingsInterop.ZoomItSettings.SaveSettingsJson(
|
||||
JsonSerializer.Serialize(_zoomItSettings));
|
||||
SendCustomAction("refresh_settings");
|
||||
}
|
||||
|
||||
private void SelectDemoTypeFileAction()
|
||||
{
|
||||
try
|
||||
{
|
||||
ResourceLoader resourceLoader = ResourceLoaderInstance.ResourceLoader;
|
||||
string title = resourceLoader.GetString("ZoomIt_DemoType_File_Picker_Dialog_Title");
|
||||
string allFilesFilter = resourceLoader.GetString("FilePicker_AllFilesFilter");
|
||||
string pickedFile = PickFileDialog($"{allFilesFilter}\0*.*\0\0", title, null, 0);
|
||||
if (pickedFile != null)
|
||||
{
|
||||
DemoTypeFile = pickedFile;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError("Error picking Demo Type file.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void SelectBreakSoundFileAction()
|
||||
{
|
||||
try
|
||||
{
|
||||
ResourceLoader resourceLoader = ResourceLoaderInstance.ResourceLoader;
|
||||
string title = resourceLoader.GetString("ZoomIt_Break_SoundFile_Picker_Dialog_Title");
|
||||
string soundFilesFilter = resourceLoader.GetString("FilePicker_ZoomIt_SoundsFilter");
|
||||
string allFilesFilter = resourceLoader.GetString("FilePicker_AllFilesFilter");
|
||||
string initialDirectory = Environment.ExpandEnvironmentVariables("%WINDIR%\\Media");
|
||||
string pickedFile = PickFileDialog($"{soundFilesFilter}\0*.wav\0{allFilesFilter}\0*.*\0\0", title, initialDirectory, 0);
|
||||
if (pickedFile != null)
|
||||
{
|
||||
BreakSoundFile = pickedFile;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError("Error picking Break Sound file.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void SelectBreakBackgroundFileAction()
|
||||
{
|
||||
try
|
||||
{
|
||||
ResourceLoader resourceLoader = ResourceLoaderInstance.ResourceLoader;
|
||||
string title = resourceLoader.GetString("ZoomIt_Break_BackgroundFile_Picker_Dialog_Title");
|
||||
string bitmapFilesFilter = resourceLoader.GetString("FilePicker_ZoomIt_BitmapFilesFilter");
|
||||
string allPictureFilesFilter = resourceLoader.GetString("FilePicker_ZoomIt_AllPicturesFilter");
|
||||
string allFilesFilter = resourceLoader.GetString("FilePicker_AllFilesFilter");
|
||||
string initialDirectory = Environment.ExpandEnvironmentVariables("%USERPROFILE%\\Pictures");
|
||||
string pickedFile = PickFileDialog($"{bitmapFilesFilter} (*.bmp;*.dib)\0*.bmp;*.dib\0PNG (*.png)\0*.png\0JPEG (*.jpg;*.jpeg;*.jpe;*.jfif)\0*.jpg;*.jpeg;*.jpe;*.jfif\0GIF (*.gif)\0*.gif\0{allPictureFilesFilter}\0*.bmp;*.dib;*.png;*.jpg;*.jpeg;*.jpe;*.jfif;*.gif\0{allFilesFilter}\0*.*\0\0", title, initialDirectory, 5);
|
||||
if (pickedFile != null)
|
||||
{
|
||||
BreakBackgroundFile = pickedFile;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError("Error picking Break Background file.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void SelectTypeFontAction()
|
||||
{
|
||||
try
|
||||
{
|
||||
LOGFONT result = PickFontDialog(_typeFont);
|
||||
if (result != null)
|
||||
{
|
||||
TypeFont = result;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError("Error picking Type font.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void RefreshEnabledState()
|
||||
{
|
||||
InitializeEnabledValue();
|
||||
OnPropertyChanged(nameof(IsEnabled));
|
||||
}
|
||||
|
||||
private GpoRuleConfigured _enabledGpoRuleConfiguration;
|
||||
private bool _enabledStateIsGPOConfigured;
|
||||
private bool _isEnabled;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user