mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 09:46:54 +02:00
[ZoomIt] Show users full hotkey list in settings (#43073)
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request This PR enhances the ZoomIt settings UI by refactoring some of the XAML code and putting instructions as part of the settingsexpanders. Additionally, the alternate hotkey combinations are now shown too and will be updated based on the configured hotkey. so that **Users will now be able to see all the hotkeys**. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] Closes: #42236 - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed ### ZoomIt Extended (Derived) Hotkeys Feature | Base Key Property | Default Base Key | Derived Key Property | XOR Logic | Default Derived Key | Description -- | -- | -- | -- | -- | -- | -- LiveZoom | LiveZoomToggleKey | Ctrl+4 | LiveZoomToggleKeyDraw | XOR Shift | Ctrl+Shift+4 | Enter drawing mode in LiveZoom Record | RecordToggleKey | Ctrl+5 | RecordToggleKeyCrop | XOR Shift | Ctrl+Shift+5 | Record selected region (crop) Record | RecordToggleKey | Ctrl+5 | RecordToggleKeyWindow | XOR Alt | Ctrl+Alt+5 | Record specific window Snip | SnipToggleKey | Ctrl+6 | SnipToggleKeySave | XOR Shift | Ctrl+Shift+6 | Snip and save to file DemoType | DemoTypeToggleKey | Ctrl+7 | DemoTypeToggleKeyReset | XOR Shift | Ctrl+Shift+7 | Rewind to previous segment <img width="832" height="3679" alt="Frame 2018778631" src="https://github.com/user-attachments/assets/bebddcd8-d705-4582-ae8a-c847cb1c3e88" /> --------- Signed-off-by: check-spelling-bot <check-spelling-bot@users.noreply.github.com> Co-authored-by: Niels Laute <niels.laute@live.nl> Co-authored-by: Kai Tao <vanzue@users.noreply.github.com>
This commit is contained in:
@@ -237,11 +237,32 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
_zoomItSettings.Properties.LiveZoomToggleKey.Value = value ?? ZoomItProperties.DefaultLiveZoomToggleKey;
|
||||
OnPropertyChanged(nameof(LiveZoomToggleKey));
|
||||
OnPropertyChanged(nameof(LiveZoomToggleKeyDraw));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings LiveZoomToggleKeyDraw
|
||||
{
|
||||
get
|
||||
{
|
||||
var baseKey = _zoomItSettings.Properties.LiveZoomToggleKey.Value;
|
||||
if (baseKey == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// XOR with Shift: if Shift is present, remove it; if absent, add it
|
||||
return new HotkeySettings(
|
||||
baseKey.Win,
|
||||
baseKey.Ctrl,
|
||||
baseKey.Alt,
|
||||
!baseKey.Shift, // XOR with Shift
|
||||
baseKey.Code);
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings DrawToggleKey
|
||||
{
|
||||
get => _zoomItSettings.Properties.DrawToggleKey.Value;
|
||||
@@ -265,11 +286,53 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
_zoomItSettings.Properties.RecordToggleKey.Value = value ?? ZoomItProperties.DefaultRecordToggleKey;
|
||||
OnPropertyChanged(nameof(RecordToggleKey));
|
||||
OnPropertyChanged(nameof(RecordToggleKeyCrop));
|
||||
OnPropertyChanged(nameof(RecordToggleKeyWindow));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings RecordToggleKeyCrop
|
||||
{
|
||||
get
|
||||
{
|
||||
var baseKey = _zoomItSettings.Properties.RecordToggleKey.Value;
|
||||
if (baseKey == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// XOR with Shift: if Shift is present, remove it; if absent, add it
|
||||
return new HotkeySettings(
|
||||
baseKey.Win,
|
||||
baseKey.Ctrl,
|
||||
baseKey.Alt,
|
||||
!baseKey.Shift, // XOR with Shift
|
||||
baseKey.Code);
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings RecordToggleKeyWindow
|
||||
{
|
||||
get
|
||||
{
|
||||
var baseKey = _zoomItSettings.Properties.RecordToggleKey.Value;
|
||||
if (baseKey == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// XOR with Alt: if Alt is present, remove it; if absent, add it
|
||||
return new HotkeySettings(
|
||||
baseKey.Win,
|
||||
baseKey.Ctrl,
|
||||
!baseKey.Alt, // XOR with Alt
|
||||
baseKey.Shift,
|
||||
baseKey.Code);
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings SnipToggleKey
|
||||
{
|
||||
get => _zoomItSettings.Properties.SnipToggleKey.Value;
|
||||
@@ -279,11 +342,31 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
_zoomItSettings.Properties.SnipToggleKey.Value = value ?? ZoomItProperties.DefaultSnipToggleKey;
|
||||
OnPropertyChanged(nameof(SnipToggleKey));
|
||||
OnPropertyChanged(nameof(SnipToggleKeySave));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings SnipToggleKeySave
|
||||
{
|
||||
get
|
||||
{
|
||||
var baseKey = _zoomItSettings.Properties.SnipToggleKey.Value;
|
||||
if (baseKey == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new HotkeySettings(
|
||||
baseKey.Win,
|
||||
baseKey.Ctrl,
|
||||
baseKey.Alt,
|
||||
!baseKey.Shift, // Toggle Shift: if Shift is present, remove it; if absent, add it
|
||||
baseKey.Code);
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings BreakTimerKey
|
||||
{
|
||||
get => _zoomItSettings.Properties.BreakTimerKey.Value;
|
||||
@@ -307,11 +390,32 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
_zoomItSettings.Properties.DemoTypeToggleKey.Value = value ?? ZoomItProperties.DefaultDemoTypeToggleKey;
|
||||
OnPropertyChanged(nameof(DemoTypeToggleKey));
|
||||
OnPropertyChanged(nameof(DemoTypeToggleKeyReset));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings DemoTypeToggleKeyReset
|
||||
{
|
||||
get
|
||||
{
|
||||
var baseKey = _zoomItSettings.Properties.DemoTypeToggleKey.Value;
|
||||
if (baseKey == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// XOR with Shift: if Shift is present, remove it; if absent, add it
|
||||
return new HotkeySettings(
|
||||
baseKey.Win,
|
||||
baseKey.Ctrl,
|
||||
baseKey.Alt,
|
||||
!baseKey.Shift, // XOR with Shift
|
||||
baseKey.Code);
|
||||
}
|
||||
}
|
||||
|
||||
private LOGFONT _typeFont;
|
||||
|
||||
public LOGFONT TypeFont
|
||||
@@ -546,20 +650,20 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public int BreakTimerOpacityIndex
|
||||
public double BreakTimerOpacity
|
||||
{
|
||||
get
|
||||
{
|
||||
return Math.Clamp((_zoomItSettings.Properties.BreakOpacity.Value / 10) - 1, 0, 9);
|
||||
return Math.Clamp(_zoomItSettings.Properties.BreakOpacity.Value, 1, 100);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
int newValue = (value + 1) * 10;
|
||||
if (_zoomItSettings.Properties.BreakOpacity.Value != newValue)
|
||||
int intValue = (int)value;
|
||||
if (_zoomItSettings.Properties.BreakOpacity.Value != intValue)
|
||||
{
|
||||
_zoomItSettings.Properties.BreakOpacity.Value = newValue;
|
||||
OnPropertyChanged(nameof(BreakTimerOpacityIndex));
|
||||
_zoomItSettings.Properties.BreakOpacity.Value = intValue;
|
||||
OnPropertyChanged(nameof(BreakTimerOpacity));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
@@ -588,26 +692,69 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
_zoomItSettings.Properties.BreakShowBackgroundFile.Value = value;
|
||||
OnPropertyChanged(nameof(BreakShowBackgroundFile));
|
||||
OnPropertyChanged(nameof(BreakBackgroundSelectionIndex));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int BreakShowDesktopOrImageFileIndex
|
||||
public bool BreakShowDesktop
|
||||
{
|
||||
get => _zoomItSettings.Properties.BreakShowDesktop.Value ? 0 : 1;
|
||||
get => _zoomItSettings.Properties.BreakShowDesktop.Value;
|
||||
set
|
||||
{
|
||||
bool newValue = value == 0;
|
||||
if (_zoomItSettings.Properties.BreakShowDesktop.Value != newValue)
|
||||
if (_zoomItSettings.Properties.BreakShowDesktop.Value != value)
|
||||
{
|
||||
_zoomItSettings.Properties.BreakShowDesktop.Value = newValue;
|
||||
OnPropertyChanged(nameof(BreakShowDesktopOrImageFileIndex));
|
||||
_zoomItSettings.Properties.BreakShowDesktop.Value = value;
|
||||
OnPropertyChanged(nameof(BreakShowDesktop));
|
||||
OnPropertyChanged(nameof(BreakBackgroundSelectionIndex));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int BreakBackgroundSelectionIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!BreakShowBackgroundFile)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return BreakShowDesktop ? 1 : 2;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
int clampedValue = Math.Clamp(value, 0, 2);
|
||||
switch (clampedValue)
|
||||
{
|
||||
case 0:
|
||||
BreakShowBackgroundFile = false;
|
||||
break;
|
||||
case 1:
|
||||
if (!BreakShowBackgroundFile)
|
||||
{
|
||||
BreakShowBackgroundFile = true;
|
||||
}
|
||||
|
||||
BreakShowDesktop = true;
|
||||
break;
|
||||
case 2:
|
||||
if (!BreakShowBackgroundFile)
|
||||
{
|
||||
BreakShowBackgroundFile = true;
|
||||
}
|
||||
|
||||
BreakShowDesktop = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string BreakBackgroundFile
|
||||
{
|
||||
get => _zoomItSettings.Properties.BreakBackgroundFile.Value;
|
||||
@@ -636,20 +783,20 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public int RecordScalingIndex
|
||||
public double RecordScaling
|
||||
{
|
||||
get
|
||||
{
|
||||
return Math.Clamp((_zoomItSettings.Properties.RecordScaling.Value / 10) - 1, 0, 9);
|
||||
return Math.Clamp(_zoomItSettings.Properties.RecordScaling.Value / 100.0, 0.1, 1.0);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
int newValue = (value + 1) * 10;
|
||||
int newValue = (int)(value * 100);
|
||||
if (_zoomItSettings.Properties.RecordScaling.Value != newValue)
|
||||
{
|
||||
_zoomItSettings.Properties.RecordScaling.Value = newValue;
|
||||
OnPropertyChanged(nameof(RecordScalingIndex));
|
||||
OnPropertyChanged(nameof(RecordScaling));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
@@ -697,7 +844,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
if (reloaded != null && reloaded.Properties != null)
|
||||
{
|
||||
_zoomItSettings.Properties.RecordScaling.Value = reloaded.Properties.RecordScaling.Value;
|
||||
OnPropertyChanged(nameof(RecordScalingIndex));
|
||||
OnPropertyChanged(nameof(RecordScaling));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user