mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-19 22:37:58 +08:00
Merge remote-tracking branch 'origin/main' into dev/snickler/net8-upgrade
This commit is contained in:
commit
ce5e0d7981
10
.github/actions/spell-check/expect.txt
vendored
10
.github/actions/spell-check/expect.txt
vendored
@ -112,7 +112,7 @@ AUTHN
|
||||
AUTHZ
|
||||
AUTOHIDE
|
||||
AUTOMATIONPROPERTIES
|
||||
Autorun
|
||||
autorun
|
||||
AUTOUPDATE
|
||||
AValid
|
||||
awakeness
|
||||
@ -144,7 +144,7 @@ Blockquotes
|
||||
blogs
|
||||
Blt
|
||||
BLUEGRAY
|
||||
Bluetooth
|
||||
bluetooth
|
||||
BLURBEHIND
|
||||
BLURREGION
|
||||
bmi
|
||||
@ -564,7 +564,6 @@ FARPROC
|
||||
fdw
|
||||
feimage
|
||||
fff
|
||||
fileapi
|
||||
FILEEXPLORER
|
||||
FILEFLAGS
|
||||
FILEFLAGSMASK
|
||||
@ -606,9 +605,9 @@ FZE
|
||||
gabime
|
||||
GAC
|
||||
gacutil
|
||||
Galaxi
|
||||
Gaeilge
|
||||
Gaidhlig
|
||||
Galaxi
|
||||
GBarm
|
||||
Gbits
|
||||
Gbps
|
||||
@ -620,6 +619,7 @@ gdi
|
||||
gdiplus
|
||||
GDISCALED
|
||||
GEmoji
|
||||
GETCLIENTAREAANIMATION
|
||||
GETDESKWALLPAPER
|
||||
GETDLGCODE
|
||||
GETDPISCALEDSIZE
|
||||
@ -1569,7 +1569,6 @@ renamable
|
||||
RENAMEONCOLLISION
|
||||
Renamer
|
||||
reparent
|
||||
reparented
|
||||
reparenting
|
||||
reparse
|
||||
reportbug
|
||||
@ -1882,7 +1881,6 @@ talynone
|
||||
TApp
|
||||
TApplication
|
||||
TApplied
|
||||
Taras
|
||||
targ
|
||||
TARGETAPPHEADER
|
||||
TARGETDIR
|
||||
|
2
.github/policies/resourceManagement.yml
vendored
2
.github/policies/resourceManagement.yml
vendored
@ -212,7 +212,7 @@ configuration:
|
||||
- addLabel:
|
||||
label: Resolution-Helped User
|
||||
- addReply:
|
||||
reply: This issue is now marked as resolved. If you have any follow-up questions, please don't hesitate to ask. You can find out more about PowerToys functionalities in our [end-user documentation](https://aka.ms/powertoy-docs].
|
||||
reply: This issue is now marked as resolved. If you have any follow-up questions, please don't hesitate to ask. You can find out more about PowerToys functionalities in our [end-user documentation](https://aka.ms/powertoy-docs).
|
||||
- closeIssue
|
||||
description:
|
||||
- if:
|
||||
|
@ -281,6 +281,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "utils", "utils", "{B39DC643
|
||||
src\common\utils\logger_helper.h = src\common\utils\logger_helper.h
|
||||
src\common\utils\modulesRegistry.h = src\common\utils\modulesRegistry.h
|
||||
src\common\utils\MsiUtils.h = src\common\utils\MsiUtils.h
|
||||
src\common\utils\MsWindowsSettings.h = src\common\utils\MsWindowsSettings.h
|
||||
src\common\utils\os-detect.h = src\common\utils\os-detect.h
|
||||
src\common\utils\package.h = src\common\utils\package.h
|
||||
src\common\utils\ProcessWaiter.h = src\common\utils\ProcessWaiter.h
|
||||
|
168
README.md
168
README.md
@ -39,19 +39,19 @@ Microsoft PowerToys is a set of utilities for power users to tune and streamline
|
||||
Go to [Microsoft PowerToys GitHub releases page][github-release-link], click on `Assets` at the bottom to show the files available in the release. Please use the appropriate PowerToys installer that matches your machine's architecture and install scope. For most, it is `x64` and per-user.
|
||||
|
||||
<!-- items that need to be updated release to release -->
|
||||
[github-next-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F46
|
||||
[github-current-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F45
|
||||
[ptUserX64]: https://github.com/microsoft/PowerToys/releases/download/v0.72.0/PowerToysUserSetup-0.72.0-x64.exe
|
||||
[ptUserArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.72.0/PowerToysUserSetup-0.72.0-arm64.exe
|
||||
[ptMachineX64]: https://github.com/microsoft/PowerToys/releases/download/v0.72.0/PowerToysSetup-0.72.0-x64.exe
|
||||
[ptMachineArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.72.0/PowerToysSetup-0.72.0-arm64.exe
|
||||
[github-next-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F47
|
||||
[github-current-release-work]: https://github.com/microsoft/PowerToys/issues?q=project%3Amicrosoft%2FPowerToys%2F46
|
||||
[ptUserX64]: https://github.com/microsoft/PowerToys/releases/download/v0.73.0/PowerToysUserSetup-0.73.0-x64.exe
|
||||
[ptUserArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.73.0/PowerToysUserSetup-0.73.0-arm64.exe
|
||||
[ptMachineX64]: https://github.com/microsoft/PowerToys/releases/download/v0.73.0/PowerToysSetup-0.73.0-x64.exe
|
||||
[ptMachineArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.73.0/PowerToysSetup-0.73.0-arm64.exe
|
||||
|
||||
| Description | Filename | sha256 hash |
|
||||
|----------------|----------|-------------|
|
||||
| Per user - x64 | [PowerToysUserSetup-0.72.0-x64.exe][ptUserX64] | 9925894D797458C78A8C3DF6FE4BD748580638B01BB43680477763662915109A |
|
||||
| Per user - ARM64 | [PowerToysUserSetup-0.72.0-arm64.exe][ptUserArm64] | 2E68139C22C56648E64514E4E8E0A0D12882F6CF30B48EB20ECC66B4CCDD5909 |
|
||||
| Machine wide - x64 | [PowerToysSetup-0.72.0-x64.exe][ptMachineX64] | 788EE4D828169F092737A739030B218CEFEC79583E42858BB8F9F036B701BE6F |
|
||||
| Machine wide - ARM64 | [PowerToysSetup-0.72.0-arm64.exe][ptMachineArm64] | 39C1D430A538B0F3D7869D39DF7F636A64AAFAD8DFB3C82059A97F4EBD3369C4 |
|
||||
| Per user - x64 | [PowerToysUserSetup-0.73.0-x64.exe][ptUserX64] | BA55D245BDD734FD6F19803DD706A3AB8E0ABC491591195534997CF2122D3B7E |
|
||||
| Per user - ARM64 | [PowerToysUserSetup-0.73.0-arm64.exe][ptUserArm64] | FBFA40EA5FFA05236A7CCDD05E5142EE0C93D7485B965784196ED9B086BFEBF4 |
|
||||
| Machine wide - x64 | [PowerToysSetup-0.73.0-x64.exe][ptMachineX64] | 7FDA06292C7C2E6DA5AEF88D8E9D3DE89D331E9E356A232289F9B37CE4503894 |
|
||||
| Machine wide - ARM64 | [PowerToysSetup-0.73.0-arm64.exe][ptMachineArm64] | 4260AA30A1F52F194EE07E9E7ECD9E9F4CF35289267F213BC933F7A5191AC17C |
|
||||
|
||||
This is our preferred method.
|
||||
|
||||
@ -97,130 +97,138 @@ For guidance on developing for PowerToys, please read the [developer docs](/doc/
|
||||
|
||||
Our [prioritized roadmap][roadmap] of features and utilities that the core team is focusing on.
|
||||
|
||||
### 0.72 - July 2023 Update
|
||||
### 0.73 - August 2023 Update
|
||||
|
||||
In this release, we focused on stability and improvements.
|
||||
In this release, we focused on releasing new features, stability and improvements.
|
||||
|
||||
**Highlights**
|
||||
|
||||
- Greatly reduced the PowerToys installed space by having utilities share the same installed path. When compared to 0.71, the 0.72 x64 machine installed version of PowerToys reduces the size reported in the Installed Apps screen from 1.15GB to 785 MB and the size in File Explorer properties for the installation folder from 3.10GB to 554 MB.
|
||||
- Value Generator - A new PowerToys Run plugin that generates hashes and GUID values. Thanks [@IHorvalds](https://github.com/IHorvalds)!
|
||||
- Mouse Highlighter has a new feature to have a highlight always follow the mouse pointer. Thanks [@hayatogh](https://github.com/hayatogh)!
|
||||
- PowerRename was reworked to support a bigger number of files without crashing.
|
||||
|
||||
### Known issues
|
||||
|
||||
- Due to changing paths in the installation folder, the Mouse Without Borders service might be pointing to the wrong place. Users not running as admin will have to enable service mode again after install. A toast notification will appear if Mouse Without Borders is unable to start the service correctly.
|
||||
- File Explorer extensions changed paths might not be loaded correctly until File Explorer and Preview Host processes are restarted, so we advise restarting the computer when possible after updating PowerToys.
|
||||
- Keyboard manager now supports Numpad. Note, with previously bound hotkeys stored in settings.json would only react to non-Numpad keys now. If a user wishes to restore the previous behavior, it could be done by manually adding another binding for the Numpad variant.
|
||||
- New utility: Crop And Lock allows you to crop a current application into a smaller window or just create a thumbnail. Focus the target window and press the shortcut to start cropping.
|
||||
- FancyZones code improvements and refactor.
|
||||
- Modernized ImageResizer UX.
|
||||
- PowerRename advanced counter functionality.
|
||||
|
||||
### General
|
||||
|
||||
- Shared dependencies between applications in order to greatly reduce the installed size.
|
||||
- Added missing icons and icon sizes. Thanks [@niels9001](https://github.com/niels9001)!
|
||||
- Added missing CoUninitialize call in elevation logic. Thanks [@sredna](https://github.com/sredna)!
|
||||
- New utility: Crop And Lock. Thanks [@robmikh](https://github.com/robmikh)! and [@kevinguo305](https://github.com/kevinguo305)!
|
||||
- Added new /helped fabric bot command to GitHub repo. Thanks [@Aaron-Junker](https://github.com/Aaron-Junker)!
|
||||
- Fixed crashes caused by invalid settings. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
|
||||
### Always On Top
|
||||
|
||||
- Added border transparency.
|
||||
|
||||
### FancyZones
|
||||
|
||||
- Fixed an issue where FancyZones wouldn't register a change to the "Switch between windows in the current zone" setting.
|
||||
- Added a Setting to enable the behavior of clicking the middle mouse button to toggle multiple zone spanning.
|
||||
- Fixed issue causing canvas zones being drawn only when dragging in zone area.
|
||||
- Fixed user-defined default layout highlighting issue.
|
||||
- Refactored and improved code quality.
|
||||
- Fixed issue causing wrong layout to be applied when duplicating non-selected layout.
|
||||
|
||||
### File Locksmith
|
||||
|
||||
- Fixed a File Explorer crash when deleting a file, updating PowerToys and then trying to right-click the background of a folder in File Explorer.
|
||||
- UI tweaks. Thanks [@Jay-o-Way](https://github.com/Jay-o-Way)!
|
||||
|
||||
- Icon update. Thanks [@jmaraujouy](https://github.com/jmaraujouy)!
|
||||
|
||||
### File Explorer add-ons
|
||||
|
||||
- Updated the Monaco dependency for Developer Files Preview, supporting new file extensions and fixing issues. Thanks [@Aaron-Junker](https://github.com/Aaron-Junker)!
|
||||
|
||||
### Hosts File Editor
|
||||
|
||||
- Consolidated the way the Hosts application is launched. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- UI tweaks. Thanks [@Jay-o-Way](https://github.com/Jay-o-Way)!
|
||||
- Fixed issue causing thumbnail previewers to lock files.
|
||||
- Open URIs from developer files in default browser. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
|
||||
### Installer
|
||||
|
||||
- Refactored the Monaco dependency inclusion. What to install is now being generated automatically.
|
||||
- Removed hardlinks and simplified the installer files, now that many utilities use the same paths.
|
||||
- Fixed PowerToys autorun after installing as SYSTEM user.
|
||||
- Removed CreateScheduledTask custom action to handle task creation only from runner code.
|
||||
|
||||
### Image Resizer
|
||||
|
||||
- Moved from ModernWPF to WpfUI to refresh and modernize UI/UX. Thanks [@niels9001](https://github.com/niels9001)!
|
||||
|
||||
### Keyboard Manager
|
||||
|
||||
- Rephrased labels to enhance clarity. Thanks [@Jay-o-Way](https://github.com/Jay-o-Way)!
|
||||
- Keyboard manager now supports Numpad. Note, with previously bound hotkeys stored in settings.json would only react to non-Numpad keys now. If a user wishes to restore the previous behavior, it could be done by manually adding another binding for the Numpad variant.
|
||||
|
||||
### Mouse Highlighter
|
||||
|
||||
- Added a feature so that a highlight follows the mouse even if no mouse button is being pressed. Thanks [@hayatogh](https://github.com/hayatogh)!
|
||||
- Fixed highlighter being invisible issue for Always on Top windows.
|
||||
- Added settings for automatic activation on startup. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
|
||||
### Mouse Pointer Crosshairs
|
||||
|
||||
- Added a setting to hide the crosshairs when the mouse pointer is also hidden. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Added a setting to select a fixed length for the crosshairs, which also spans across screens. Thanks [@Epp-code](https://github.com/Epp-code)!
|
||||
|
||||
### Mouse Without Borders
|
||||
|
||||
- Switched to a UWP mouse input API to fix mouse pointer lag issues that were reported.
|
||||
- A toast notification will appear when the service can't be started and Mouse Without Borders will try to start in non-service mode instead.
|
||||
- Fixed a bug where the service path wouldn't update to the new binary path when trying to re-enable service mode.
|
||||
- Fixed some grammar errors in the Mouse Without Borders user facing strings. Thanks [@KhurramJalil](https://github.com/KhurramJalil)!
|
||||
- Allow changing the shortcuts in the same way as other utilities and changed them to better defaults to avoid conflicting with Alt Gr+letter combos on international layouts.
|
||||
- Added settings for automatic activation on startup. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
|
||||
### Peek
|
||||
|
||||
- Also benefits from the Monaco dependency update when peeking into files supported by the Developer Files Preview. Thanks [@Aaron-Junker](https://github.com/Aaron-Junker)!
|
||||
- Fixed a flash on PowerToys starting due to the Peek window activating and hiding right away. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Updated icon design. Thanks [@niels9001](https://github.com/niels9001)!
|
||||
- Fixed flipped content issues on systems with RTL languages.
|
||||
- Show correct file type for shortcuts. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Fixed issue causing wrong file size to be displayed. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Show 1 byte instead of 1 bytes file size. Thanks [@Deepak-Sangle](https://github.com/Deepak-Sangle)!
|
||||
- Open URIs from developer files in default browser. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Show thumbnail and fallback to icon for unsupported files. Thanks [@pedrolamas](https://github.com/pedrolamas)!
|
||||
|
||||
### PowerRename
|
||||
|
||||
- Reworked the UI and resource consumption to fix crashes and hangs when trying to rename a huge number of files.
|
||||
- Added the Mica background material and some UI tweaks. Thanks [@niels9001](https://github.com/niels9001)!
|
||||
- Updated OOBE gif. Thanks [@ChaseKnowlden](https://github.com/ChaseKnowlden)!
|
||||
- Localized renamed parts combo box.
|
||||
- Introduced advanced counter functionality.
|
||||
- Added remember last window size logic and optimized items sorting.
|
||||
- Enable "Enumerate items" option by default.
|
||||
|
||||
### PowerToys Run
|
||||
|
||||
- New plugin: Value Generator - generates values like hashes and GUIDs. Thanks [@IHorvalds](https://github.com/IHorvalds)!
|
||||
- The default input smoothing values were changed to the recommended values. Thanks [@SamMercer172](https://github.com/SamMercer172)!
|
||||
- Fixed tab navigation issues when using Shift+Tab to go backwards. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Fixed a crash caused by images not being found in the image cache due to racing conditions.
|
||||
- Fixed synchronization issues in the WindowWalker plugin. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Fixed a synchronization crash when getting localized system paths.
|
||||
- The PowerToys plugin is now activated by default. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
|
||||
### Quick Accent
|
||||
- Added the ("ḍ", U+1E0D) unicode character. Thanks [@SamMercer172](https://github.com/SamMercer172)!
|
||||
- Fixed an issue causing the left and right keys being discarded even when Quick Accent didn't activate.
|
||||
- Fixed issue causing original search to be abandoned when cycling through results.
|
||||
- Updated device and bluetooth results for Settings plugin. Thanks [@htcfreek](https://github.com/htcfreek)!
|
||||
- Fixed InvalidOperationException exception thrown. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Add Base64 Decoding function to the Value Generator plugin. Thanks [@LeagueOfPoro](https://github.com/LeagueOfPoro)!
|
||||
- Added Keep shell open option for Shell plugin.
|
||||
- Added Crop And Lock to PowerToys plugin. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
|
||||
### Registry Preview
|
||||
|
||||
- Fixed a bug causing DWORD values to not be shown correctly. Thanks [@randyrants](https://github.com/randyrants)!
|
||||
- UI tweaks. Thanks [@Jay-o-Way](https://github.com/Jay-o-Way)!
|
||||
- Updated AppBarButtons to use an explicit AppBarButton.Icon. Thanks [@randyrants](https://github.com/randyrants)!
|
||||
- Fixed crash on clicking Save As button.
|
||||
|
||||
### Runner
|
||||
|
||||
- Show a warning asking the user to restart the computer after updating the PowerToys version.
|
||||
- Removed unneeded RegisterWindowMessage from tray icon logic. Thanks [@sredna](https://github.com/sredna)!
|
||||
- Fixed startup looping issue.
|
||||
- Improved old logs and installers cleanup logic. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
|
||||
### Screen Ruler
|
||||
|
||||
- UI tweaks. Thanks [@Jay-o-Way](https://github.com/Jay-o-Way)!
|
||||
- Use proper resources file.
|
||||
|
||||
### Settings
|
||||
|
||||
- Fix an unused Expander in the File Locksmith settings page.
|
||||
- Added an info box to better explain what the extended context menu is.
|
||||
- Fixed issue causing problems with modifier keys and ShortcutControl. Thanks [@sh0ckj0ckey](https://github.com/sh0ckj0ckey)!
|
||||
- Fixed crash when clicking "Windows color settings" link.
|
||||
- Added support for launching Settings app directly.
|
||||
- Fixed issue causing DisplayDescription not showing for PowerToys Run PluginAdditionalOption.
|
||||
- Fixed issue causing FileLocksmith 'Show File Locksmith in' setting not showing correct value.
|
||||
- Fixed issue causing Awake on/off toggle in Settings flyout not to work when Settings Awake page is opened.
|
||||
|
||||
### Documentation
|
||||
|
||||
- Added documentation for PowerToys Run third-party plugins. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Fixed broken links in keyboardmanagerui.md. Thanks [@shubhsardana29](https://github.com/shubhsardana29)!
|
||||
- Updated core team in COMMUNITY.md.
|
||||
- Fixed broken links in ui-architecture.md. Thanks [@SamB](https://github.com/SamB)!
|
||||
- Updated community.valuegenerator.md with Base64DecodeRequest description.
|
||||
|
||||
### Development
|
||||
|
||||
- Projects were restructured to allow sharing the same folder and dependencies and to avoid resource name conflicts.
|
||||
- Added scripts to CI to guard against applications having conflicting resources.
|
||||
- Added scripts to CI to guard against depending on different versions of the same dependency.
|
||||
- Test projects now build to a separate path.
|
||||
- Dependencies updated across the solution to ensure every project is using the same dependencies.
|
||||
- Updated test packages and StyleCop. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Condense NuGet Restore into MSBuild Tasks. Thanks [@snickler](https://github.com/snickler)!
|
||||
|
||||
#### What is being planned for version 0.73
|
||||
#### What is being planned for version 0.74
|
||||
|
||||
For [v0.73][github-next-release-work], we'll work on below:
|
||||
For [v0.74][github-next-release-work], we'll work on below:
|
||||
|
||||
- New utility: Crop and Lock
|
||||
- Language selection
|
||||
- PowerRename enumeration keywords
|
||||
- Modernize and refresh UX of PowerToys based on WPF
|
||||
- Stability / bug fixes
|
||||
- Peek: UI improvements
|
||||
- Peek: UI improvements
|
||||
|
||||
## PowerToys Community
|
||||
|
||||
|
@ -145,6 +145,7 @@ void LayoutMap::LayoutMapImpl::UpdateLayout()
|
||||
keyboardLayoutMap[VK_RETURN | numpadOriginBit] = L"Enter (Numpad)";
|
||||
keyboardLayoutMap[VK_DIVIDE | numpadOriginBit] = L"/ (Numpad)";
|
||||
|
||||
keyboardLayoutMap[VK_SUBTRACT] = L"- (Substract)";
|
||||
keyboardLayoutMap[VK_SELECT] = L"Select";
|
||||
keyboardLayoutMap[VK_PRINT] = L"Print";
|
||||
keyboardLayoutMap[VK_EXECUTE] = L"Execute";
|
||||
|
13
src/common/utils/MsWindowsSettings.h
Normal file
13
src/common/utils/MsWindowsSettings.h
Normal file
@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
inline bool GetAnimationsEnabled()
|
||||
{
|
||||
BOOL enabled = 0;
|
||||
BOOL fResult;
|
||||
fResult = SystemParametersInfo(SPI_GETCLIENTAREAANIMATION, 0, &enabled, 0);
|
||||
if (!fResult)
|
||||
{
|
||||
Logger::error("SystemParametersInfo SPI_GETCLIENTAREAANIMATION failed.");
|
||||
}
|
||||
return enabled;
|
||||
}
|
@ -76,6 +76,8 @@ namespace Hosts.Tests
|
||||
[DataRow("host 10.1.1.1")]
|
||||
[DataRow("# comment 10.1.1.1 host # comment")]
|
||||
[DataRow("10.1.1.1 host01 host02 host03 host04 host05 host06 host07 host08 host09 host10")]
|
||||
[DataRow("102.54.94.97 rhino.acme.com # source server")]
|
||||
[DataRow("38.25.63.10 x.acme.com # x client host")]
|
||||
public void Not_Valid_Entry(string line)
|
||||
{
|
||||
var entry = new Entry(0, line);
|
||||
|
@ -448,7 +448,7 @@
|
||||
ScrollViewer.IsVerticalRailEnabled="True"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Visible"
|
||||
ScrollViewer.VerticalScrollMode="Enabled"
|
||||
Text="{Binding Comment, Mode=TwoWay}" />
|
||||
Text="{Binding Comment, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<ToggleSwitch
|
||||
x:Uid="Active"
|
||||
IsOn="{Binding Active, Mode=TwoWay}"
|
||||
|
@ -44,6 +44,7 @@ namespace Hosts.Models
|
||||
}
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedFor(nameof(Valid))]
|
||||
private string _comment;
|
||||
|
||||
[ObservableProperty]
|
||||
@ -153,7 +154,19 @@ namespace Hosts.Models
|
||||
|
||||
public bool Validate(bool validateHostsLength)
|
||||
{
|
||||
if (Equals("102.54.94.97", "rhino.acme.com", "source server") || Equals("38.25.63.10", "x.acme.com", "x client host"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return Type != AddressType.Invalid && ValidationHelper.ValidHosts(Hosts, validateHostsLength);
|
||||
}
|
||||
|
||||
private bool Equals(string address, string hosts, string comment)
|
||||
{
|
||||
return string.Equals(Address, address, StringComparison.Ordinal)
|
||||
&& string.Equals(Hosts, hosts, StringComparison.Ordinal)
|
||||
&& string.Equals(Comment, comment, StringComparison.Ordinal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,12 @@
|
||||
//
|
||||
#include "pch.h"
|
||||
#include "FindMyMouse.h"
|
||||
#include "WinHookEventIDs.h"
|
||||
#include "trace.h"
|
||||
#include "common/utils/game_mode.h"
|
||||
#include "common/utils/process_path.h"
|
||||
#include "common/utils/excluded_apps.h"
|
||||
#include "common/utils/MsWindowsSettings.h"
|
||||
#include <vector>
|
||||
|
||||
#ifdef COMPOSITION
|
||||
@ -246,6 +248,18 @@ LRESULT SuperSonar<D>::BaseWndProc(UINT message, WPARAM wParam, LPARAM lParam) n
|
||||
return HTTRANSPARENT;
|
||||
}
|
||||
|
||||
if (message == WM_PRIV_SHORTCUT)
|
||||
{
|
||||
if (m_sonarStart == NoSonar)
|
||||
{
|
||||
StartSonar();
|
||||
}
|
||||
else
|
||||
{
|
||||
StopSonar();
|
||||
}
|
||||
}
|
||||
|
||||
return DefWindowProc(m_hwnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
@ -291,26 +305,27 @@ void SuperSonar<D>::OnSonarInput(WPARAM flags, HRAWINPUT hInput)
|
||||
template<typename D>
|
||||
void SuperSonar<D>::OnSonarKeyboardInput(RAWINPUT const& input)
|
||||
{
|
||||
if ( m_activationMethod != FindMyMouseActivationMethod::DoubleControlKey || input.data.keyboard.VKey != VK_CONTROL)
|
||||
// Don't stop the sonar when the shortcut is released
|
||||
if (m_activationMethod == FindMyMouseActivationMethod::Shortcut && (input.data.keyboard.Flags & RI_KEY_BREAK) != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ((m_activationMethod != FindMyMouseActivationMethod::DoubleRightControlKey && m_activationMethod != FindMyMouseActivationMethod::DoubleLeftControlKey)
|
||||
|| input.data.keyboard.VKey != VK_CONTROL)
|
||||
{
|
||||
StopSonar();
|
||||
return;
|
||||
}
|
||||
|
||||
bool pressed = (input.data.keyboard.Flags & RI_KEY_BREAK) == 0;
|
||||
bool rightCtrl = (input.data.keyboard.Flags & RI_KEY_E0) != 0;
|
||||
|
||||
// Deal with rightCtrl first.
|
||||
if (rightCtrl)
|
||||
bool leftCtrlPressed = (input.data.keyboard.Flags & RI_KEY_E0) == 0;
|
||||
bool rightCtrlPressed = (input.data.keyboard.Flags & RI_KEY_E0) != 0;
|
||||
|
||||
if ((m_activationMethod == FindMyMouseActivationMethod::DoubleRightControlKey && !rightCtrlPressed)
|
||||
|| (m_activationMethod == FindMyMouseActivationMethod::DoubleLeftControlKey && !leftCtrlPressed))
|
||||
{
|
||||
/*
|
||||
* SuperSonar originally exited when pressing right control after pressing left control twice.
|
||||
* We take care of exiting FindMyMouse through module disabling in PowerToys settings instead.
|
||||
if (m_sonarState == SonarState::ControlUp2)
|
||||
{
|
||||
Terminate();
|
||||
}
|
||||
*/
|
||||
StopSonar();
|
||||
return;
|
||||
}
|
||||
@ -634,6 +649,8 @@ struct CompositionSpotlight : SuperSonar<CompositionSpotlight>
|
||||
void SetSonarVisibility(bool visible)
|
||||
{
|
||||
m_batch = m_compositor.GetCommitBatch(winrt::CompositionBatchTypes::Animation);
|
||||
BOOL isEnabledAnimations = GetAnimationsEnabled();
|
||||
m_animation.Duration(std::chrono::milliseconds{ isEnabledAnimations ? m_fadeDuration : 1 });
|
||||
m_batch.Completed([hwnd = m_hwnd](auto&&, auto&&) {
|
||||
PostMessage(hwnd, WM_OPACITY_ANIMATION_COMPLETED, 0, 0);
|
||||
});
|
||||
@ -644,6 +661,11 @@ struct CompositionSpotlight : SuperSonar<CompositionSpotlight>
|
||||
}
|
||||
}
|
||||
|
||||
HWND GetHwnd() noexcept
|
||||
{
|
||||
return m_hwnd;
|
||||
}
|
||||
|
||||
private:
|
||||
bool OnCompositionCreate()
|
||||
try
|
||||
@ -1057,6 +1079,8 @@ int FindMyMouseMain(HINSTANCE hinst, const FindMyMouseSettings& settings)
|
||||
m_sonar = &sonar;
|
||||
Logger::info("Initialized the sonar instance.");
|
||||
|
||||
InitializeWinhookEventIds();
|
||||
|
||||
MSG msg;
|
||||
|
||||
// Main message loop:
|
||||
@ -1072,4 +1096,14 @@ int FindMyMouseMain(HINSTANCE hinst, const FindMyMouseSettings& settings)
|
||||
return (int)msg.wParam;
|
||||
}
|
||||
|
||||
HWND GetSonarHwnd() noexcept
|
||||
{
|
||||
if (m_sonar != nullptr)
|
||||
{
|
||||
return m_sonar->GetHwnd();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#pragma endregion Super_Sonar_API
|
||||
|
@ -3,9 +3,11 @@
|
||||
|
||||
enum struct FindMyMouseActivationMethod : int
|
||||
{
|
||||
DoubleControlKey = 0,
|
||||
ShakeMouse = 1,
|
||||
EnumElements = 2, // number of elements in the enum, not counting this
|
||||
DoubleLeftControlKey = 0,
|
||||
DoubleRightControlKey = 1,
|
||||
ShakeMouse = 2,
|
||||
Shortcut = 3,
|
||||
EnumElements = 4, // number of elements in the enum, not counting this
|
||||
};
|
||||
|
||||
constexpr bool FIND_MY_MOUSE_DEFAULT_DO_NOT_ACTIVATE_ON_GAME_MODE = true;
|
||||
@ -15,7 +17,7 @@ constexpr int FIND_MY_MOUSE_DEFAULT_OVERLAY_OPACITY = 50;
|
||||
constexpr int FIND_MY_MOUSE_DEFAULT_SPOTLIGHT_RADIUS = 100;
|
||||
constexpr int FIND_MY_MOUSE_DEFAULT_ANIMATION_DURATION_MS = 500;
|
||||
constexpr int FIND_MY_MOUSE_DEFAULT_SPOTLIGHT_INITIAL_ZOOM = 9;
|
||||
constexpr FindMyMouseActivationMethod FIND_MY_MOUSE_DEFAULT_ACTIVATION_METHOD = FindMyMouseActivationMethod::DoubleControlKey;
|
||||
constexpr FindMyMouseActivationMethod FIND_MY_MOUSE_DEFAULT_ACTIVATION_METHOD = FindMyMouseActivationMethod::DoubleLeftControlKey;
|
||||
constexpr int FIND_MY_MOUSE_DEFAULT_SHAKE_MINIMUM_DISTANCE = 1000;
|
||||
|
||||
struct FindMyMouseSettings
|
||||
@ -36,3 +38,4 @@ int FindMyMouseMain(HINSTANCE hinst, const FindMyMouseSettings& settings);
|
||||
void FindMyMouseDisable();
|
||||
bool FindMyMouseIsEnabled();
|
||||
void FindMyMouseApplySettings(const FindMyMouseSettings& settings);
|
||||
HWND GetSonarHwnd() noexcept;
|
@ -93,6 +93,7 @@
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="trace.h" />
|
||||
<ClInclude Include="WinHookEventIDs.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp" />
|
||||
@ -101,6 +102,7 @@
|
||||
<PrecompiledHeader Condition="'$(CIBuild)'!='true'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="trace.cpp" />
|
||||
<ClCompile Include="WinHookEventIDs.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\common\logger\logger.vcxproj">
|
||||
|
@ -30,6 +30,9 @@
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="WinHookEventIDs.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="pch.h">
|
||||
@ -44,6 +47,9 @@
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="WinHookEventIDs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="FindMyMouse.rc">
|
||||
|
14
src/modules/MouseUtils/FindMyMouse/WinHookEventIDs.cpp
Normal file
14
src/modules/MouseUtils/FindMyMouse/WinHookEventIDs.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "pch.h"
|
||||
|
||||
#include "WinHookEventIDs.h"
|
||||
|
||||
UINT WM_PRIV_SHORTCUT;
|
||||
|
||||
std::once_flag init_flag;
|
||||
|
||||
void InitializeWinhookEventIds()
|
||||
{
|
||||
std::call_once(init_flag, [&] {
|
||||
WM_PRIV_SHORTCUT = RegisterWindowMessage(L"{1365FFC7-A44E-4171-9692-A3EEF378AE60}");
|
||||
});
|
||||
}
|
5
src/modules/MouseUtils/FindMyMouse/WinHookEventIDs.h
Normal file
5
src/modules/MouseUtils/FindMyMouse/WinHookEventIDs.h
Normal file
@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
extern UINT WM_PRIV_SHORTCUT; // Shortcut is pressed
|
||||
|
||||
void InitializeWinhookEventIds();
|
@ -3,6 +3,7 @@
|
||||
#include <common/SettingsAPI/settings_objects.h>
|
||||
#include "trace.h"
|
||||
#include "FindMyMouse.h"
|
||||
#include "WinHookEventIDs.h"
|
||||
#include <thread>
|
||||
#include <common/utils/logger_helper.h>
|
||||
#include <common/utils/color.h>
|
||||
@ -22,6 +23,7 @@ namespace
|
||||
const wchar_t JSON_KEY_SPOTLIGHT_INITIAL_ZOOM[] = L"spotlight_initial_zoom";
|
||||
const wchar_t JSON_KEY_EXCLUDED_APPS[] = L"excluded_apps";
|
||||
const wchar_t JSON_KEY_SHAKING_MINIMUM_DISTANCE[] = L"shaking_minimum_distance";
|
||||
const wchar_t JSON_KEY_ACTIVATION_SHORTCUT[] = L"activation_shortcut";
|
||||
}
|
||||
|
||||
extern "C" IMAGE_DOS_HEADER __ImageBase;
|
||||
@ -58,6 +60,9 @@ private:
|
||||
// The PowerToy state.
|
||||
bool m_enabled = false;
|
||||
|
||||
// Hotkey to invoke the module
|
||||
HotkeyEx m_hotkey;
|
||||
|
||||
// Find My Mouse specific settings
|
||||
FindMyMouseSettings m_findMyMouseSettings;
|
||||
|
||||
@ -157,6 +162,27 @@ public:
|
||||
{
|
||||
return m_enabled;
|
||||
}
|
||||
|
||||
virtual std::optional<HotkeyEx> GetHotkeyEx() override
|
||||
{
|
||||
Logger::trace("GetHotkeyEx()");
|
||||
if (m_findMyMouseSettings.activationMethod == FindMyMouseActivationMethod::Shortcut)
|
||||
{
|
||||
return m_hotkey;
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
virtual void OnHotkeyEx() override
|
||||
{
|
||||
Logger::trace("OnHotkeyEx()");
|
||||
HWND hwnd = GetSonarHwnd();
|
||||
if (hwnd != nullptr)
|
||||
{
|
||||
PostMessageW(hwnd, WM_PRIV_SHORTCUT, NULL, NULL);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Load the settings file.
|
||||
@ -188,7 +214,15 @@ void FindMyMouse::parse_settings(PowerToysSettings::PowerToyValues& settings)
|
||||
int value = static_cast<int>(jsonPropertiesObject.GetNamedNumber(JSON_KEY_VALUE));
|
||||
if (value < static_cast<int>(FindMyMouseActivationMethod::EnumElements) && value >= 0)
|
||||
{
|
||||
findMyMouseSettings.activationMethod = static_cast<FindMyMouseActivationMethod>(value);
|
||||
std::wstring version = (std::wstring)settingsObject.GetNamedString(L"version");
|
||||
if (version == L"1.0" && value == 1)
|
||||
{
|
||||
findMyMouseSettings.activationMethod = FindMyMouseActivationMethod::ShakeMouse;
|
||||
}
|
||||
else
|
||||
{
|
||||
findMyMouseSettings.activationMethod = static_cast<FindMyMouseActivationMethod>(value);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -362,6 +396,46 @@ void FindMyMouse::parse_settings(PowerToysSettings::PowerToyValues& settings)
|
||||
{
|
||||
Logger::warn("Failed to initialize Shaking Minimum Distance from settings. Will use default value");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// Parse HotKey
|
||||
auto jsonPropertiesObject = settingsObject.GetNamedObject(JSON_KEY_PROPERTIES).GetNamedObject(JSON_KEY_ACTIVATION_SHORTCUT);
|
||||
auto hotkey = PowerToysSettings::HotkeyObject::from_json(jsonPropertiesObject);
|
||||
m_hotkey = HotkeyEx();
|
||||
if (hotkey.win_pressed())
|
||||
{
|
||||
m_hotkey.modifiersMask |= MOD_WIN;
|
||||
}
|
||||
|
||||
if (hotkey.ctrl_pressed())
|
||||
{
|
||||
m_hotkey.modifiersMask |= MOD_CONTROL;
|
||||
}
|
||||
|
||||
if (hotkey.shift_pressed())
|
||||
{
|
||||
m_hotkey.modifiersMask |= MOD_SHIFT;
|
||||
}
|
||||
|
||||
if (hotkey.alt_pressed())
|
||||
{
|
||||
m_hotkey.modifiersMask |= MOD_ALT;
|
||||
}
|
||||
|
||||
m_hotkey.vkCode = static_cast<WORD>(hotkey.get_code());
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
Logger::warn("Failed to initialize Activation Shortcut from settings. Will use default value");
|
||||
}
|
||||
|
||||
if (!m_hotkey.modifiersMask)
|
||||
{
|
||||
Logger::info("Using default Activation Shortcut");
|
||||
m_hotkey.modifiersMask = MOD_SHIFT | MOD_WIN;
|
||||
m_hotkey.vkCode = 0x46; // F key
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "start_visible.h"
|
||||
#include <common/utils/resources.h>
|
||||
#include <common/utils/window.h>
|
||||
#include <common/utils/MsWindowsSettings.h>
|
||||
|
||||
#include "shortcut_guide.h"
|
||||
#include "trace.h"
|
||||
@ -269,11 +270,12 @@ D2D1_RECT_F D2DOverlaySVG::get_snap_right() const
|
||||
|
||||
D2DOverlayWindow::D2DOverlayWindow() :
|
||||
total_screen({}),
|
||||
background_animation(0.3),
|
||||
global_windows_shortcuts_animation(0.3),
|
||||
taskbar_icon_shortcuts_animation(0.3),
|
||||
D2DWindow()
|
||||
{
|
||||
BOOL isEnabledAnimations = GetAnimationsEnabled();
|
||||
background_animation = isEnabledAnimations? 0.3f : 0.f;
|
||||
global_windows_shortcuts_animation = isEnabledAnimations ? 0.3f : 0.f;
|
||||
taskbar_icon_shortcuts_animation = isEnabledAnimations ? 0.3f : 0.f;
|
||||
tasklist_thread = std::thread([&] {
|
||||
while (running)
|
||||
{
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 101 KiB |
@ -124,6 +124,14 @@ bool WorkArea::Snap(HWND window, const ZoneIndexSet& zones, bool updatePosition)
|
||||
return false;
|
||||
}
|
||||
|
||||
for (ZoneIndex zone : zones)
|
||||
{
|
||||
if (static_cast<size_t>(zone) >= m_layout->Zones().size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
m_layoutWindows.Assign(window, zones);
|
||||
AppZoneHistory::instance().SetAppLastZones(window, m_uniqueId, m_layout->Id(), zones);
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include <common/logger/logger.h>
|
||||
#include <common/utils/MsWindowsSettings.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
@ -125,6 +126,12 @@ ZonesOverlay::RenderResult ZonesOverlay::Render()
|
||||
return RenderResult::AnimationEnded;
|
||||
}
|
||||
|
||||
BOOL isEnabledAnimations = GetAnimationsEnabled();
|
||||
if (!isEnabledAnimations)
|
||||
{
|
||||
animationAlpha = 1.f;
|
||||
}
|
||||
|
||||
m_renderTarget->BeginDraw();
|
||||
|
||||
// Draw backdrop
|
||||
|
@ -316,6 +316,28 @@ namespace FancyZonesUnitTests
|
||||
Assert::IsTrue(expected == layoutWindows.GetZoneIndexSetFromWindow(window));
|
||||
}
|
||||
|
||||
TEST_METHOD(SnapEmptyZones)
|
||||
{
|
||||
const auto workArea = WorkArea::Create(m_hInst, m_workAreaId, m_parentUniqueId, m_workAreaRect);
|
||||
const auto window = Mocks::WindowCreate(m_hInst);
|
||||
|
||||
Assert::IsFalse(workArea->Snap(window, {}));
|
||||
}
|
||||
|
||||
TEST_METHOD(SnapToIncorrectZone)
|
||||
{
|
||||
const auto workArea = WorkArea::Create(m_hInst, m_workAreaId, m_parentUniqueId, m_workAreaRect);
|
||||
const auto window = Mocks::WindowCreate(m_hInst);
|
||||
|
||||
const ZoneIndexSet zones = { 10 };
|
||||
Assert::IsFalse(workArea->Snap(window, zones));
|
||||
|
||||
const auto processPath = get_process_path(window);
|
||||
const auto history = AppZoneHistory::instance().GetZoneHistory(processPath, m_workAreaId);
|
||||
|
||||
Assert::IsFalse(history.has_value());
|
||||
}
|
||||
|
||||
TEST_METHOD (UnsnapPropertyTest)
|
||||
{
|
||||
const auto workArea = WorkArea::Create(m_hInst, m_workAreaId, m_parentUniqueId, m_workAreaRect);
|
||||
|
@ -19,12 +19,13 @@ namespace FancyZonesEditor
|
||||
|
||||
private CanvasLayoutModel _model;
|
||||
|
||||
public CanvasEditor()
|
||||
public CanvasEditor(CanvasLayoutModel layout)
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += OnLoaded;
|
||||
Unloaded += OnUnloaded;
|
||||
KeyDown += CanvasEditor_KeyDown;
|
||||
_model = layout;
|
||||
}
|
||||
|
||||
private void CanvasEditor_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
|
||||
@ -47,17 +48,8 @@ namespace FancyZonesEditor
|
||||
|
||||
private void OnLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
CanvasLayoutModel model = (CanvasLayoutModel)DataContext;
|
||||
if (model != null)
|
||||
{
|
||||
_model = model;
|
||||
|
||||
var workArea = App.Overlay.WorkArea;
|
||||
|
||||
UpdateZoneRects();
|
||||
|
||||
_model.PropertyChanged += OnModelChanged;
|
||||
}
|
||||
UpdateZoneRects();
|
||||
_model.PropertyChanged += OnModelChanged;
|
||||
}
|
||||
|
||||
private void OnUnloaded(object sender, RoutedEventArgs e)
|
||||
|
@ -11,39 +11,28 @@ namespace FancyZonesEditor
|
||||
{
|
||||
public partial class CanvasEditorWindow : EditorWindow
|
||||
{
|
||||
private CanvasLayoutModel _model;
|
||||
private CanvasLayoutModel _stashedModel;
|
||||
|
||||
public CanvasEditorWindow()
|
||||
public CanvasEditorWindow(CanvasLayoutModel layout)
|
||||
: base(layout)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
KeyUp += CanvasEditorWindow_KeyUp;
|
||||
KeyDown += CanvasEditorWindow_KeyDown;
|
||||
|
||||
_model = App.Overlay.CurrentDataContext as CanvasLayoutModel;
|
||||
_stashedModel = (CanvasLayoutModel)_model.Clone();
|
||||
}
|
||||
|
||||
public LayoutModel Model
|
||||
{
|
||||
get
|
||||
{
|
||||
return _model;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnAddZone(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Logger.LogInfo("Add zone");
|
||||
_model.AddZone();
|
||||
if (EditingLayout is CanvasLayoutModel canvas)
|
||||
{
|
||||
canvas.AddZone();
|
||||
}
|
||||
}
|
||||
|
||||
protected new void OnCancel(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Logger.LogInfo("Cancel changes");
|
||||
base.OnCancel(sender, e);
|
||||
_stashedModel.RestoreTo(_model);
|
||||
}
|
||||
|
||||
private void CanvasEditorWindow_KeyUp(object sender, KeyEventArgs e)
|
||||
|
@ -11,29 +11,35 @@ namespace FancyZonesEditor
|
||||
{
|
||||
public class EditorWindow : Window
|
||||
{
|
||||
public LayoutModel EditingLayout { get; set; }
|
||||
|
||||
public EditorWindow(LayoutModel editingLayout)
|
||||
{
|
||||
EditingLayout = editingLayout;
|
||||
}
|
||||
|
||||
protected void OnSaveApplyTemplate(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Logger.LogTrace();
|
||||
var mainEditor = App.Overlay;
|
||||
if (mainEditor.CurrentDataContext is LayoutModel model)
|
||||
|
||||
// If new custom Canvas layout is created (i.e. edited Blank layout),
|
||||
// it's type needs to be updated
|
||||
if (EditingLayout.Type == LayoutType.Blank)
|
||||
{
|
||||
// If new custom Canvas layout is created (i.e. edited Blank layout),
|
||||
// it's type needs to be updated
|
||||
if (model.Type == LayoutType.Blank)
|
||||
{
|
||||
model.Type = LayoutType.Custom;
|
||||
}
|
||||
|
||||
model.Persist();
|
||||
|
||||
MainWindowSettingsModel settings = ((App)Application.Current).MainWindowSettings;
|
||||
settings.SetAppliedModel(model);
|
||||
App.Overlay.Monitors[App.Overlay.CurrentDesktop].SetLayoutSettings(model);
|
||||
EditingLayout.Type = LayoutType.Custom;
|
||||
}
|
||||
|
||||
EditingLayout.Persist();
|
||||
|
||||
MainWindowSettingsModel settings = ((App)Application.Current).MainWindowSettings;
|
||||
settings.SetAppliedModel(EditingLayout);
|
||||
App.Overlay.Monitors[App.Overlay.CurrentDesktop].SetLayoutSettings(EditingLayout);
|
||||
|
||||
App.FancyZonesEditorIO.SerializeLayoutTemplates();
|
||||
App.FancyZonesEditorIO.SerializeCustomLayouts();
|
||||
App.FancyZonesEditorIO.SerializeAppliedLayouts();
|
||||
App.FancyZonesEditorIO.SerializeDefaultLayouts();
|
||||
App.FancyZonesEditorIO.SerializeLayoutHotkeys();
|
||||
|
||||
Close();
|
||||
}
|
||||
@ -46,7 +52,7 @@ namespace FancyZonesEditor
|
||||
protected void OnCancel(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// restore backup, clean up
|
||||
App.Overlay.EndEditing(true);
|
||||
App.Overlay.EndEditing(EditingLayout);
|
||||
|
||||
// select and draw applied layout
|
||||
var settings = ((App)Application.Current).MainWindowSettings;
|
||||
|
@ -36,7 +36,7 @@ namespace FancyZonesEditor
|
||||
|
||||
private GridData _data;
|
||||
|
||||
public GridEditor()
|
||||
public GridEditor(GridLayoutModel layoutModel)
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += GridEditor_Loaded;
|
||||
@ -44,6 +44,9 @@ namespace FancyZonesEditor
|
||||
KeyDown += GridEditor_KeyDown;
|
||||
KeyUp += GridEditor_KeyUp;
|
||||
gridEditorUniqueId = ++gridEditorUniqueIdCounter;
|
||||
|
||||
_data = new GridData(layoutModel);
|
||||
Model = layoutModel;
|
||||
}
|
||||
|
||||
public void FocusZone()
|
||||
@ -58,16 +61,6 @@ namespace FancyZonesEditor
|
||||
private void GridEditor_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
((App)Application.Current).MainWindowSettings.PropertyChanged += ZoneSettings_PropertyChanged;
|
||||
|
||||
GridLayoutModel model = (GridLayoutModel)DataContext;
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_data = new GridData(model);
|
||||
|
||||
Model = model;
|
||||
Model.PropertyChanged += OnGridDimensionsChanged;
|
||||
SetupUI();
|
||||
}
|
||||
|
@ -10,7 +10,8 @@ namespace FancyZonesEditor
|
||||
{
|
||||
public partial class GridEditorWindow : EditorWindow
|
||||
{
|
||||
public GridEditorWindow()
|
||||
public GridEditorWindow(GridLayoutModel model)
|
||||
: base(model)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
|
@ -3,14 +3,15 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using FancyZonesEditor.Models;
|
||||
using FancyZonesEditor.Utils;
|
||||
|
||||
namespace FancyZonesEditor
|
||||
{
|
||||
public class LayoutBackup
|
||||
{
|
||||
private LayoutModel _backup;
|
||||
private string _hotkeyBackup;
|
||||
private List<LayoutModel> _defaultLayoutsBackup;
|
||||
|
||||
public LayoutBackup()
|
||||
@ -28,32 +29,31 @@ namespace FancyZonesEditor
|
||||
_backup = new CanvasLayoutModel(canvas);
|
||||
}
|
||||
|
||||
_hotkeyBackup = MainWindowSettingsModel.LayoutHotkeys.Key(model.Uuid);
|
||||
_defaultLayoutsBackup = new List<LayoutModel>(MainWindowSettingsModel.DefaultLayouts.Layouts);
|
||||
}
|
||||
|
||||
public void Restore()
|
||||
public void Restore(LayoutModel layoutToRestore)
|
||||
{
|
||||
if (_backup != null)
|
||||
if (_backup != null && layoutToRestore != null)
|
||||
{
|
||||
var settings = ((App)Application.Current).MainWindowSettings;
|
||||
var selectedModel = settings.SelectedModel;
|
||||
|
||||
if (selectedModel == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_backup is GridLayoutModel grid)
|
||||
{
|
||||
grid.RestoreTo((GridLayoutModel)selectedModel);
|
||||
grid.RestoreTo((GridLayoutModel)layoutToRestore);
|
||||
grid.InitTemplateZones();
|
||||
}
|
||||
else if (_backup is CanvasLayoutModel canvas)
|
||||
{
|
||||
canvas.RestoreTo((CanvasLayoutModel)selectedModel);
|
||||
canvas.RestoreTo((CanvasLayoutModel)layoutToRestore);
|
||||
canvas.InitTemplateZones();
|
||||
}
|
||||
}
|
||||
|
||||
if (_hotkeyBackup != null)
|
||||
{
|
||||
MainWindowSettingsModel.LayoutHotkeys.SelectKey(_hotkeyBackup, layoutToRestore.Uuid);
|
||||
}
|
||||
|
||||
if (_defaultLayoutsBackup != null)
|
||||
{
|
||||
MainWindowSettingsModel.DefaultLayouts.Restore(_defaultLayoutsBackup);
|
||||
@ -63,6 +63,7 @@ namespace FancyZonesEditor
|
||||
public void Clear()
|
||||
{
|
||||
_backup = null;
|
||||
_hotkeyBackup = null;
|
||||
_defaultLayoutsBackup = null;
|
||||
}
|
||||
}
|
||||
|
@ -146,29 +146,17 @@ namespace FancyZonesEditor
|
||||
|
||||
private void DecrementZones_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var mainEditor = App.Overlay;
|
||||
if (mainEditor.CurrentDataContext is not LayoutModel model)
|
||||
if (_settings.SelectedModel.TemplateZoneCount > 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (model.TemplateZoneCount > 1)
|
||||
{
|
||||
model.TemplateZoneCount--;
|
||||
_settings.SelectedModel.TemplateZoneCount--;
|
||||
}
|
||||
}
|
||||
|
||||
private void IncrementZones_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var mainEditor = App.Overlay;
|
||||
if (mainEditor.CurrentDataContext is not LayoutModel model)
|
||||
if (_settings.SelectedModel.IsZoneAddingAllowed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (model.IsZoneAddingAllowed)
|
||||
{
|
||||
model.TemplateZoneCount++;
|
||||
_settings.SelectedModel.TemplateZoneCount++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -303,25 +291,23 @@ namespace FancyZonesEditor
|
||||
private void Apply()
|
||||
{
|
||||
Logger.LogTrace();
|
||||
var mainEditor = App.Overlay;
|
||||
if (mainEditor.CurrentDataContext is LayoutModel model)
|
||||
{
|
||||
_settings.SetAppliedModel(model);
|
||||
App.Overlay.Monitors[App.Overlay.CurrentDesktop].SetLayoutSettings(model);
|
||||
App.FancyZonesEditorIO.SerializeAppliedLayouts();
|
||||
App.FancyZonesEditorIO.SerializeCustomLayouts();
|
||||
}
|
||||
|
||||
LayoutModel model = _settings.SelectedModel;
|
||||
_settings.SetAppliedModel(model);
|
||||
App.Overlay.Monitors[App.Overlay.CurrentDesktop].SetLayoutSettings(model);
|
||||
App.FancyZonesEditorIO.SerializeAppliedLayouts();
|
||||
App.FancyZonesEditorIO.SerializeCustomLayouts();
|
||||
}
|
||||
|
||||
private void OnClosing(object sender, EventArgs e)
|
||||
{
|
||||
Logger.LogTrace();
|
||||
App.Overlay.EndEditing(true);
|
||||
|
||||
App.FancyZonesEditorIO.SerializeAppliedLayouts();
|
||||
App.FancyZonesEditorIO.SerializeCustomLayouts();
|
||||
App.FancyZonesEditorIO.SerializeLayoutHotkeys();
|
||||
App.FancyZonesEditorIO.SerializeLayoutTemplates();
|
||||
App.FancyZonesEditorIO.SerializeDefaultLayouts();
|
||||
App.Overlay.CloseLayoutWindow();
|
||||
App.Current.Shutdown();
|
||||
}
|
||||
@ -345,7 +331,8 @@ namespace FancyZonesEditor
|
||||
|
||||
var dataContext = ((FrameworkElement)sender).DataContext;
|
||||
Select((LayoutModel)dataContext);
|
||||
App.Overlay.StartEditing((LayoutModel)dataContext);
|
||||
|
||||
App.Overlay.StartEditing(_settings.SelectedModel);
|
||||
|
||||
Keyboard.ClearFocus();
|
||||
EditLayoutDialogTitle.Text = string.Format(CultureInfo.CurrentCulture, Properties.Resources.Edit_Template, ((LayoutModel)dataContext).Name);
|
||||
@ -358,16 +345,8 @@ namespace FancyZonesEditor
|
||||
var dataContext = ((FrameworkElement)sender).DataContext;
|
||||
Select((LayoutModel)dataContext);
|
||||
EditLayoutDialog.Hide();
|
||||
var mainEditor = App.Overlay;
|
||||
if (mainEditor.CurrentDataContext is not LayoutModel model)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_settings.SetSelectedModel(model);
|
||||
|
||||
Hide();
|
||||
mainEditor.OpenEditor(model);
|
||||
App.Overlay.OpenEditor(_settings.SelectedModel);
|
||||
}
|
||||
|
||||
private void ScrollViewer_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
|
||||
@ -438,7 +417,7 @@ namespace FancyZonesEditor
|
||||
// EditLayout: Cancel changes
|
||||
private void EditLayoutDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
|
||||
{
|
||||
App.Overlay.EndEditing(false);
|
||||
App.Overlay.EndEditing(_settings.SelectedModel);
|
||||
Select(_settings.AppliedModel);
|
||||
}
|
||||
|
||||
@ -447,13 +426,8 @@ namespace FancyZonesEditor
|
||||
{
|
||||
Logger.LogTrace();
|
||||
|
||||
var mainEditor = App.Overlay;
|
||||
if (mainEditor.CurrentDataContext is not LayoutModel model)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
mainEditor.EndEditing(false);
|
||||
App.Overlay.EndEditing(null);
|
||||
LayoutModel model = _settings.SelectedModel;
|
||||
|
||||
// update current settings
|
||||
if (model == _settings.AppliedModel)
|
||||
@ -465,6 +439,7 @@ namespace FancyZonesEditor
|
||||
App.FancyZonesEditorIO.SerializeCustomLayouts();
|
||||
App.FancyZonesEditorIO.SerializeLayoutTemplates();
|
||||
App.FancyZonesEditorIO.SerializeLayoutHotkeys();
|
||||
App.FancyZonesEditorIO.SerializeDefaultLayouts();
|
||||
|
||||
// reset selected model
|
||||
Select(_settings.AppliedModel);
|
||||
@ -653,7 +628,6 @@ namespace FancyZonesEditor
|
||||
if (dataContext is LayoutModel model)
|
||||
{
|
||||
MainWindowSettingsModel.DefaultLayouts.Set(model, MonitorConfigurationType.Vertical);
|
||||
App.FancyZonesEditorIO.SerializeDefaultLayouts();
|
||||
}
|
||||
}
|
||||
|
||||
@ -663,7 +637,6 @@ namespace FancyZonesEditor
|
||||
if (dataContext is LayoutModel model)
|
||||
{
|
||||
MainWindowSettingsModel.DefaultLayouts.Set(model, MonitorConfigurationType.Horizontal);
|
||||
App.FancyZonesEditorIO.SerializeDefaultLayouts();
|
||||
}
|
||||
}
|
||||
|
||||
@ -673,7 +646,6 @@ namespace FancyZonesEditor
|
||||
if (dataContext is LayoutModel model)
|
||||
{
|
||||
MainWindowSettingsModel.DefaultLayouts.Reset(MonitorConfigurationType.Horizontal);
|
||||
App.FancyZonesEditorIO.SerializeDefaultLayouts();
|
||||
}
|
||||
}
|
||||
|
||||
@ -683,7 +655,6 @@ namespace FancyZonesEditor
|
||||
if (dataContext is LayoutModel model)
|
||||
{
|
||||
MainWindowSettingsModel.DefaultLayouts.Reset(MonitorConfigurationType.Vertical);
|
||||
App.FancyZonesEditorIO.SerializeDefaultLayouts();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -184,6 +184,8 @@ namespace FancyZonesEditor.Models
|
||||
|
||||
public void RestoreTo(CanvasLayoutModel other)
|
||||
{
|
||||
base.RestoreTo(other);
|
||||
|
||||
other.Zones.Clear();
|
||||
foreach (Int32Rect zone in Zones)
|
||||
{
|
||||
@ -191,7 +193,6 @@ namespace FancyZonesEditor.Models
|
||||
}
|
||||
|
||||
other._topLeft = _topLeft;
|
||||
other.SensitivityRadius = SensitivityRadius;
|
||||
other.CanvasRect = CanvasRect;
|
||||
other.UpdateLayout();
|
||||
}
|
||||
|
@ -280,6 +280,8 @@ namespace FancyZonesEditor.Models
|
||||
|
||||
public void RestoreTo(GridLayoutModel layout)
|
||||
{
|
||||
base.RestoreTo(layout);
|
||||
|
||||
int rows = Rows;
|
||||
int cols = Columns;
|
||||
|
||||
@ -315,7 +317,6 @@ namespace FancyZonesEditor.Models
|
||||
|
||||
layout.ShowSpacing = ShowSpacing;
|
||||
layout.Spacing = Spacing;
|
||||
layout.SensitivityRadius = SensitivityRadius;
|
||||
|
||||
layout.FirePropertyChanged();
|
||||
}
|
||||
|
@ -68,6 +68,19 @@ namespace FancyZonesEditor.Models
|
||||
return true;
|
||||
}
|
||||
|
||||
public string Key(string uuid)
|
||||
{
|
||||
foreach (var pair in SelectedKeys)
|
||||
{
|
||||
if (pair.Value == uuid)
|
||||
{
|
||||
return pair.Key;
|
||||
}
|
||||
}
|
||||
|
||||
return Properties.Resources.Quick_Key_None;
|
||||
}
|
||||
|
||||
public void CleanUp()
|
||||
{
|
||||
var keys = SelectedKeys.Keys.ToList();
|
||||
|
@ -339,6 +339,12 @@ namespace FancyZonesEditor.Models
|
||||
}
|
||||
}
|
||||
|
||||
public void RestoreTo(LayoutModel layout)
|
||||
{
|
||||
layout.SensitivityRadius = SensitivityRadius;
|
||||
layout.TemplateZoneCount = TemplateZoneCount;
|
||||
}
|
||||
|
||||
// Adds new custom Layout
|
||||
public void AddCustomLayout(LayoutModel model)
|
||||
{
|
||||
|
@ -186,26 +186,19 @@ namespace FancyZonesEditor
|
||||
Logger.LogTrace();
|
||||
|
||||
_layoutPreview = null;
|
||||
if (CurrentDataContext is GridLayoutModel)
|
||||
if (model is GridLayoutModel grid)
|
||||
{
|
||||
_editorLayout = new GridEditor();
|
||||
_editorLayout = new GridEditor(grid);
|
||||
_editorWindow = new GridEditorWindow(grid);
|
||||
}
|
||||
else if (CurrentDataContext is CanvasLayoutModel)
|
||||
else if (model is CanvasLayoutModel canvas)
|
||||
{
|
||||
_editorLayout = new CanvasEditor();
|
||||
_editorLayout = new CanvasEditor(canvas);
|
||||
_editorWindow = new CanvasEditorWindow(canvas);
|
||||
}
|
||||
|
||||
CurrentLayoutWindow.Content = _editorLayout;
|
||||
|
||||
if (model is GridLayoutModel)
|
||||
{
|
||||
_editorWindow = new GridEditorWindow();
|
||||
}
|
||||
else
|
||||
{
|
||||
_editorWindow = new CanvasEditorWindow();
|
||||
}
|
||||
|
||||
_editorWindow.Owner = Monitors[App.Overlay.CurrentDesktop].Window;
|
||||
_editorWindow.DataContext = model;
|
||||
_editorWindow.Show();
|
||||
@ -267,11 +260,11 @@ namespace FancyZonesEditor
|
||||
_layoutBackup.Backup(model);
|
||||
}
|
||||
|
||||
public void EndEditing(bool restoreBackup)
|
||||
public void EndEditing(LayoutModel modelToRestore)
|
||||
{
|
||||
if (restoreBackup)
|
||||
if (modelToRestore != null)
|
||||
{
|
||||
_layoutBackup.Restore();
|
||||
_layoutBackup.Restore(modelToRestore);
|
||||
}
|
||||
|
||||
_layoutBackup.Clear();
|
||||
|
@ -1019,6 +1019,45 @@ namespace FancyZonesEditor.Utils
|
||||
continue;
|
||||
}
|
||||
|
||||
LayoutType layoutType = JsonTagToLayoutType(layout.AppliedLayout.Type);
|
||||
LayoutSettings settings = new LayoutSettings
|
||||
{
|
||||
ZonesetUuid = layout.AppliedLayout.Uuid,
|
||||
ShowSpacing = layout.AppliedLayout.ShowSpacing,
|
||||
Spacing = layout.AppliedLayout.Spacing,
|
||||
Type = layoutType,
|
||||
ZoneCount = layout.AppliedLayout.ZoneCount,
|
||||
SensitivityRadius = layout.AppliedLayout.SensitivityRadius,
|
||||
};
|
||||
|
||||
// check if the custom layout exists
|
||||
bool existingLayout = layoutType != LayoutType.Custom;
|
||||
if (layoutType == LayoutType.Custom)
|
||||
{
|
||||
foreach (LayoutModel custom in MainWindowSettingsModel.CustomModels)
|
||||
{
|
||||
if (custom.Uuid == layout.AppliedLayout.Uuid)
|
||||
{
|
||||
existingLayout = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// replace deleted layout with the Blank layout
|
||||
if (!existingLayout)
|
||||
{
|
||||
LayoutModel blankLayout = MainWindowSettingsModel.TemplateModels[(int)LayoutType.Blank];
|
||||
settings.ZonesetUuid = blankLayout.Uuid;
|
||||
settings.Type = blankLayout.Type;
|
||||
settings.ZoneCount = blankLayout.TemplateZoneCount;
|
||||
settings.SensitivityRadius = blankLayout.SensitivityRadius;
|
||||
|
||||
// grid layout settings, just resetting them
|
||||
settings.ShowSpacing = false;
|
||||
settings.Spacing = 0;
|
||||
}
|
||||
|
||||
bool unused = true;
|
||||
foreach (Monitor monitor in monitors)
|
||||
{
|
||||
@ -1028,16 +1067,6 @@ namespace FancyZonesEditor.Utils
|
||||
(monitor.Device.VirtualDesktopId == layout.Device.VirtualDesktop ||
|
||||
layout.Device.VirtualDesktop == DefaultVirtualDesktopGuid))
|
||||
{
|
||||
var settings = new LayoutSettings
|
||||
{
|
||||
ZonesetUuid = layout.AppliedLayout.Uuid,
|
||||
ShowSpacing = layout.AppliedLayout.ShowSpacing,
|
||||
Spacing = layout.AppliedLayout.Spacing,
|
||||
Type = JsonTagToLayoutType(layout.AppliedLayout.Type),
|
||||
ZoneCount = layout.AppliedLayout.ZoneCount,
|
||||
SensitivityRadius = layout.AppliedLayout.SensitivityRadius,
|
||||
};
|
||||
|
||||
monitor.Settings = settings;
|
||||
unused = false;
|
||||
break;
|
||||
|
@ -239,7 +239,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests
|
||||
|
||||
// Act
|
||||
// Using en-us culture to have a fixed number style
|
||||
var result = engine.Interpret(input, new CultureInfo("en-us"), out _);
|
||||
var result = engine.Interpret(input, new CultureInfo("en-us", false), out _);
|
||||
|
||||
// Assert
|
||||
Assert.IsNotNull(result);
|
||||
|
@ -46,7 +46,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests
|
||||
public void Translate_ThrowError_WhenCalledNull(string input)
|
||||
{
|
||||
// Arrange
|
||||
var translator = NumberTranslator.Create(new CultureInfo("de-DE"), new CultureInfo("en-US"));
|
||||
var translator = NumberTranslator.Create(new CultureInfo("de-DE", false), new CultureInfo("en-US", false));
|
||||
|
||||
// Act
|
||||
Assert.ThrowsException<ArgumentNullException>(() => translator.Translate(input));
|
||||
@ -58,7 +58,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests
|
||||
public void Translate_WhenCalledEmpty(string input)
|
||||
{
|
||||
// Arrange
|
||||
var translator = NumberTranslator.Create(new CultureInfo("de-DE"), new CultureInfo("en-US"));
|
||||
var translator = NumberTranslator.Create(new CultureInfo("de-DE", false), new CultureInfo("en-US", false));
|
||||
|
||||
// Act
|
||||
var result = translator.Translate(input);
|
||||
@ -76,7 +76,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests
|
||||
public void Translate_NoErrors_WhenCalled(string input, string expectedResult)
|
||||
{
|
||||
// Arrange
|
||||
var translator = NumberTranslator.Create(new CultureInfo("de-DE"), new CultureInfo("en-US"));
|
||||
var translator = NumberTranslator.Create(new CultureInfo("de-DE", false), new CultureInfo("en-US", false));
|
||||
|
||||
// Act
|
||||
var result = translator.Translate(input);
|
||||
@ -95,7 +95,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests
|
||||
public void TranslateBack_NoErrors_WhenCalled(string input, string expectedResult)
|
||||
{
|
||||
// Arrange
|
||||
var translator = NumberTranslator.Create(new CultureInfo("de-DE"), new CultureInfo("en-US"));
|
||||
var translator = NumberTranslator.Create(new CultureInfo("de-DE", false), new CultureInfo("en-US", false));
|
||||
|
||||
// Act
|
||||
var result = translator.TranslateBack(input);
|
||||
@ -113,7 +113,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests
|
||||
public void Translate_RemoveNumberGroupSeparator_WhenCalled(string decimalSeparator, string groupSeparator, string input, string expectedResult)
|
||||
{
|
||||
// Arrange
|
||||
var sourceCulture = new CultureInfo("en-US")
|
||||
var sourceCulture = new CultureInfo("en-US", false)
|
||||
{
|
||||
NumberFormat =
|
||||
{
|
||||
@ -121,7 +121,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests
|
||||
NumberGroupSeparator = groupSeparator,
|
||||
},
|
||||
};
|
||||
var translator = NumberTranslator.Create(sourceCulture, new CultureInfo("en-US"));
|
||||
var translator = NumberTranslator.Create(sourceCulture, new CultureInfo("en-US", false));
|
||||
|
||||
// Act
|
||||
var result = translator.Translate(input);
|
||||
@ -137,7 +137,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.UnitTests
|
||||
public void Translate_NoRemovalOfLeadingZeroesOnEdgeCases(string input, string expectedResult)
|
||||
{
|
||||
// Arrange
|
||||
var translator = NumberTranslator.Create(new CultureInfo("de-de"), new CultureInfo("en-US"));
|
||||
var translator = NumberTranslator.Create(new CultureInfo("de-de", false), new CultureInfo("en-US", false));
|
||||
|
||||
// Act
|
||||
var result = translator.Translate(input);
|
||||
|
@ -143,15 +143,13 @@ namespace Microsoft.PowerToys.Run.Plugin.System.Components
|
||||
/// <returns>List containing all network adapters</returns>
|
||||
internal static List<NetworkConnectionProperties> GetList()
|
||||
{
|
||||
List<NetworkConnectionProperties> list = new List<NetworkConnectionProperties>();
|
||||
|
||||
var interfaces = NetworkInterface.GetAllNetworkInterfaces().Where(x => x.NetworkInterfaceType != NetworkInterfaceType.Loopback && x.GetPhysicalAddress() != null);
|
||||
foreach (NetworkInterface i in interfaces)
|
||||
{
|
||||
list.Add(new NetworkConnectionProperties(i));
|
||||
}
|
||||
|
||||
return list;
|
||||
var interfaces = NetworkInterface.GetAllNetworkInterfaces()
|
||||
.Where(x => x.NetworkInterfaceType != NetworkInterfaceType.Loopback && x.GetPhysicalAddress() != null)
|
||||
.Select(i => new NetworkConnectionProperties(i))
|
||||
.OrderByDescending(i => i.IPv4) // list IPv4 first
|
||||
.ThenBy(i => i.IPv6Primary) // then IPv6
|
||||
.ToList();
|
||||
return interfaces;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -24,9 +24,9 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests
|
||||
|
||||
// Set culture to 'en-us'
|
||||
originalCulture = CultureInfo.CurrentCulture;
|
||||
CultureInfo.CurrentCulture = new CultureInfo("en-us");
|
||||
CultureInfo.CurrentCulture = new CultureInfo("en-us", false);
|
||||
originalUiCulture = CultureInfo.CurrentUICulture;
|
||||
CultureInfo.CurrentUICulture = new CultureInfo("en-us");
|
||||
CultureInfo.CurrentUICulture = new CultureInfo("en-us", false);
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
|
@ -25,9 +25,9 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests
|
||||
|
||||
// Set culture to 'en-us'
|
||||
originalCulture = CultureInfo.CurrentCulture;
|
||||
CultureInfo.CurrentCulture = new CultureInfo("en-us");
|
||||
CultureInfo.CurrentCulture = new CultureInfo("en-us", false);
|
||||
originalUiCulture = CultureInfo.CurrentUICulture;
|
||||
CultureInfo.CurrentUICulture = new CultureInfo("en-us");
|
||||
CultureInfo.CurrentUICulture = new CultureInfo("en-us", false);
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
|
@ -20,9 +20,9 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests
|
||||
{
|
||||
// Set culture to 'en-us'
|
||||
originalCulture = CultureInfo.CurrentCulture;
|
||||
CultureInfo.CurrentCulture = new CultureInfo("en-us");
|
||||
CultureInfo.CurrentCulture = new CultureInfo("en-us", false);
|
||||
originalUiCulture = CultureInfo.CurrentUICulture;
|
||||
CultureInfo.CurrentUICulture = new CultureInfo("en-us");
|
||||
CultureInfo.CurrentUICulture = new CultureInfo("en-us", false);
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
|
@ -21,14 +21,22 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests
|
||||
{
|
||||
// Set culture to 'en-us'
|
||||
originalCulture = CultureInfo.CurrentCulture;
|
||||
CultureInfo.CurrentCulture = new CultureInfo("en-us");
|
||||
CultureInfo.CurrentCulture = new CultureInfo("en-us", false);
|
||||
originalUiCulture = CultureInfo.CurrentUICulture;
|
||||
CultureInfo.CurrentUICulture = new CultureInfo("en-us");
|
||||
CultureInfo.CurrentUICulture = new CultureInfo("en-us", false);
|
||||
}
|
||||
|
||||
private DateTime GetDateTimeForTest()
|
||||
private DateTime GetDateTimeForTest(bool embedUtc = false)
|
||||
{
|
||||
return new DateTime(2022, 03, 02, 22, 30, 45);
|
||||
var dateTime = new DateTime(2022, 03, 02, 22, 30, 45);
|
||||
if (embedUtc)
|
||||
{
|
||||
return DateTime.SpecifyKind(dateTime, DateTimeKind.Utc);
|
||||
}
|
||||
else
|
||||
{
|
||||
return dateTime;
|
||||
}
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
@ -181,8 +189,8 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests
|
||||
public void UtcFormatsWithShortTimeAndShortDate(string formatLabel, string expectedFormat)
|
||||
{
|
||||
// Setup
|
||||
var helperResults = AvailableResultsList.GetList(true, false, false, GetDateTimeForTest());
|
||||
var expectedResult = GetDateTimeForTest().ToUniversalTime().ToString(expectedFormat, CultureInfo.CurrentCulture);
|
||||
var helperResults = AvailableResultsList.GetList(true, false, false, GetDateTimeForTest(true));
|
||||
var expectedResult = GetDateTimeForTest().ToString(expectedFormat, CultureInfo.CurrentCulture);
|
||||
|
||||
// Act
|
||||
var result = helperResults.FirstOrDefault(x => x.Label.Equals(formatLabel, StringComparison.OrdinalIgnoreCase));
|
||||
@ -201,8 +209,8 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests
|
||||
public void UtcFormatsWithShortTimeAndLongDate(string formatLabel, string expectedFormat)
|
||||
{
|
||||
// Setup
|
||||
var helperResults = AvailableResultsList.GetList(true, false, true, GetDateTimeForTest());
|
||||
var expectedResult = GetDateTimeForTest().ToUniversalTime().ToString(expectedFormat, CultureInfo.CurrentCulture);
|
||||
var helperResults = AvailableResultsList.GetList(true, false, true, GetDateTimeForTest(true));
|
||||
var expectedResult = GetDateTimeForTest().ToString(expectedFormat, CultureInfo.CurrentCulture);
|
||||
|
||||
// Act
|
||||
var result = helperResults.FirstOrDefault(x => x.Label.Equals(formatLabel, StringComparison.OrdinalIgnoreCase));
|
||||
@ -221,8 +229,8 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests
|
||||
public void UtcFormatsWithLongTimeAndShortDate(string formatLabel, string expectedFormat)
|
||||
{
|
||||
// Setup
|
||||
var helperResults = AvailableResultsList.GetList(true, true, false, GetDateTimeForTest());
|
||||
var expectedResult = GetDateTimeForTest().ToUniversalTime().ToString(expectedFormat, CultureInfo.CurrentCulture);
|
||||
var helperResults = AvailableResultsList.GetList(true, true, false, GetDateTimeForTest(true));
|
||||
var expectedResult = GetDateTimeForTest().ToString(expectedFormat, CultureInfo.CurrentCulture);
|
||||
|
||||
// Act
|
||||
var result = helperResults.FirstOrDefault(x => x.Label.Equals(formatLabel, StringComparison.OrdinalIgnoreCase));
|
||||
@ -241,8 +249,8 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests
|
||||
public void UtcFormatsWithLongTimeAndLongDate(string formatLabel, string expectedFormat)
|
||||
{
|
||||
// Setup
|
||||
var helperResults = AvailableResultsList.GetList(true, true, true, GetDateTimeForTest());
|
||||
var expectedResult = GetDateTimeForTest().ToUniversalTime().ToString(expectedFormat, CultureInfo.CurrentCulture);
|
||||
var helperResults = AvailableResultsList.GetList(true, true, true, GetDateTimeForTest(true));
|
||||
var expectedResult = GetDateTimeForTest().ToString(expectedFormat, CultureInfo.CurrentCulture);
|
||||
|
||||
// Act
|
||||
var result = helperResults.FirstOrDefault(x => x.Label.Equals(formatLabel, StringComparison.OrdinalIgnoreCase));
|
||||
|
@ -18,6 +18,7 @@ namespace Peek.FilePreviewer.Previewers.Helpers
|
||||
public static async Task<BitmapSource> GetBitmapFromHBitmapAsync(IntPtr hbitmap, bool isSupportingTransparency, CancellationToken cancellationToken)
|
||||
{
|
||||
Bitmap? bitmap = null;
|
||||
Bitmap? tempBitmapForDeletion = null;
|
||||
|
||||
try
|
||||
{
|
||||
@ -32,7 +33,8 @@ namespace Peek.FilePreviewer.Previewers.Helpers
|
||||
|
||||
var transparentBitmap = new Bitmap(bitmapData.Width, bitmapData.Height, bitmapData.Stride, PixelFormat.Format32bppArgb, bitmapData.Scan0);
|
||||
|
||||
bitmap.Dispose();
|
||||
// Can't dispose of original bitmap yet as that causes crashes on png files. Saving it for later disposal after saving to stream.
|
||||
tempBitmapForDeletion = bitmap;
|
||||
bitmap = transparentBitmap;
|
||||
}
|
||||
|
||||
@ -53,6 +55,7 @@ namespace Peek.FilePreviewer.Previewers.Helpers
|
||||
finally
|
||||
{
|
||||
bitmap?.Dispose();
|
||||
tempBitmapForDeletion?.Dispose();
|
||||
|
||||
// delete HBitmap to avoid memory leaks
|
||||
NativeMethods.DeleteObject(hbitmap);
|
||||
|
@ -83,52 +83,37 @@ namespace PowerAccent.Core
|
||||
// All
|
||||
private static string[] GetDefaultLetterKeyALL(LetterKey letter)
|
||||
{
|
||||
return letter switch
|
||||
{
|
||||
LetterKey.VK_0 => new[] { "₀", "⁰" },
|
||||
LetterKey.VK_1 => new[] { "₁", "¹" },
|
||||
LetterKey.VK_2 => new[] { "₂", "²" },
|
||||
LetterKey.VK_3 => new[] { "₃", "³" },
|
||||
LetterKey.VK_4 => new[] { "₄", "⁴" },
|
||||
LetterKey.VK_5 => new[] { "₅", "⁵" },
|
||||
LetterKey.VK_6 => new[] { "₆", "⁶" },
|
||||
LetterKey.VK_7 => new[] { "₇", "⁷" },
|
||||
LetterKey.VK_8 => new[] { "₈", "⁸" },
|
||||
LetterKey.VK_9 => new[] { "₉", "⁹" },
|
||||
LetterKey.VK_A => new[] { "á", "à", "ä", "â", "ă", "å", "α", "ā", "ą", "ȧ", "ã", "ǎ", "æ" },
|
||||
LetterKey.VK_B => new[] { "ḃ", "β" },
|
||||
LetterKey.VK_C => new[] { "ç", "ć", "ĉ", "č", "ċ", "¢", "χ", "°C", "©", "ℂ" },
|
||||
LetterKey.VK_D => new[] { "ď", "ḍ", "ḋ", "đ", "δ", "ð" },
|
||||
LetterKey.VK_E => new[] { "é", "è", "ê", "ë", "ě", "ē", "ę", "ė", "ε", "η", "€", "∈" },
|
||||
LetterKey.VK_F => new[] { "ƒ", "ḟ", "°F" },
|
||||
LetterKey.VK_G => new[] { "ğ", "ģ", "ǧ", "ġ", "ĝ", "ǥ", "γ" },
|
||||
LetterKey.VK_H => new[] { "ḣ", "ĥ", "ħ" },
|
||||
LetterKey.VK_I => new[] { "ï", "î", "í", "ì", "ī", "į", "ı", "İ", "ι", "ǐ" },
|
||||
LetterKey.VK_J => new[] { "ĵ" },
|
||||
LetterKey.VK_K => new[] { "ķ", "ǩ", "κ" },
|
||||
LetterKey.VK_L => new[] { "ĺ", "ľ", "ļ", "ł", "₺", "λ" },
|
||||
LetterKey.VK_M => new[] { "ṁ", "μ" },
|
||||
LetterKey.VK_N => new[] { "ñ", "ń", "ŋ", "ň", "ņ", "ṅ", "ⁿ", "ν", "ℕ" },
|
||||
LetterKey.VK_O => new[] { "ô", "ó", "ö", "ő", "ò", "ō", "ȯ", "ø", "õ", "œ", "ω", "ο", "ǒ" },
|
||||
LetterKey.VK_P => new[] { "ṗ", "₽", "π", "φ", "ψ", "℗" },
|
||||
LetterKey.VK_Q => new[] { "ℚ" },
|
||||
LetterKey.VK_R => new[] { "ŕ", "ř", "ṙ", "₹", "ρ", "®", "ℝ" },
|
||||
LetterKey.VK_S => new[] { "ś", "ş", "š", "ș", "ṡ", "ŝ", "ß", "σ", "$", "\u00A7" },
|
||||
LetterKey.VK_T => new[] { "ţ", "ť", "ț", "ṫ", "ŧ", "θ", "τ", "þ", "™" },
|
||||
LetterKey.VK_U => new[] { "û", "ú", "ü", "ŭ", "ű", "ù", "ů", "ū", "ų", "ǔ", "υ", "ǖ", "ǘ", "ǚ", "ǜ" },
|
||||
LetterKey.VK_V => new[] { "V̇" },
|
||||
LetterKey.VK_W => new[] { "ẇ", "ŵ", "₩" },
|
||||
LetterKey.VK_X => new[] { "ẋ", "ξ", "×" },
|
||||
LetterKey.VK_Y => new[] { "ÿ", "ŷ", "ý", "ẏ" },
|
||||
LetterKey.VK_Z => new[] { "ź", "ž", "ż", "ʒ", "ǯ", "ζ", "ℤ" },
|
||||
LetterKey.VK_COMMA => new[] { "¿", "¡", "∙", "₋", "⁻", "–", "≤", "≥", "≠", "≈", "≙", "±", "₊", "⁺" },
|
||||
LetterKey.VK_PERIOD => new[] { "\u0300", "\u0301", "\u0302", "\u0303", "\u0304", "\u0308", "\u030C" },
|
||||
LetterKey.VK_MINUS => new[] { "~", "‐", "‑", "‒", "–", "—", "―", "⁓", "−", "⸺", "⸻" },
|
||||
LetterKey.VK_SLASH_ => new[] { "÷" },
|
||||
LetterKey.VK_DIVIDE_ => new[] { "÷" },
|
||||
LetterKey.VK_MULTIPLY_ => new[] { "×", "⋅" },
|
||||
_ => Array.Empty<string>(),
|
||||
};
|
||||
// would be even better to loop through Languages and call these functions dynamically, but I don't know how to do that!
|
||||
return GetDefaultLetterKeyCA(letter)
|
||||
.Union(GetDefaultLetterKeyCUR(letter))
|
||||
.Union(GetDefaultLetterKeyCY(letter))
|
||||
.Union(GetDefaultLetterKeyCZ(letter))
|
||||
.Union(GetDefaultLetterKeyGA(letter))
|
||||
.Union(GetDefaultLetterKeyGD(letter))
|
||||
.Union(GetDefaultLetterKeyDE(letter))
|
||||
.Union(GetDefaultLetterKeyEST(letter))
|
||||
.Union(GetDefaultLetterKeyFR(letter))
|
||||
.Union(GetDefaultLetterKeyHR(letter))
|
||||
.Union(GetDefaultLetterKeyHE(letter))
|
||||
.Union(GetDefaultLetterKeyHU(letter))
|
||||
.Union(GetDefaultLetterKeyIS(letter))
|
||||
.Union(GetDefaultLetterKeyIT(letter))
|
||||
.Union(GetDefaultLetterKeyKU(letter))
|
||||
.Union(GetDefaultLetterKeyLT(letter))
|
||||
.Union(GetDefaultLetterKeyMK(letter))
|
||||
.Union(GetDefaultLetterKeyMI(letter))
|
||||
.Union(GetDefaultLetterKeyNL(letter))
|
||||
.Union(GetDefaultLetterKeyNO(letter))
|
||||
.Union(GetDefaultLetterKeyPI(letter))
|
||||
.Union(GetDefaultLetterKeyPL(letter))
|
||||
.Union(GetDefaultLetterKeyPT(letter))
|
||||
.Union(GetDefaultLetterKeyRO(letter))
|
||||
.Union(GetDefaultLetterKeySK(letter))
|
||||
.Union(GetDefaultLetterKeySP(letter))
|
||||
.Union(GetDefaultLetterKeySR(letter))
|
||||
.Union(GetDefaultLetterKeySV(letter))
|
||||
.Union(GetDefaultLetterKeyTK(letter))
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
// Currencies (source: https://www.eurochange.co.uk/travel-money/world-currency-abbreviations-symbols-and-codes-travel-money)
|
||||
|
@ -503,7 +503,6 @@
|
||||
<ToggleButton
|
||||
x:Name="toggleButton_enumItems"
|
||||
x:Uid="ToggleButton_EnumItems"
|
||||
IsChecked="True"
|
||||
Height="32"
|
||||
Content=""
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}" />
|
||||
|
@ -282,6 +282,7 @@ namespace winrt::PowerRenameUI::implementation
|
||||
}
|
||||
|
||||
button_rename().IsEnabled(false);
|
||||
toggleButton_enumItems().IsChecked(true);
|
||||
InitAutoComplete();
|
||||
SearchReplaceChanged();
|
||||
InvalidateItemListViewState();
|
||||
|
@ -178,6 +178,9 @@
|
||||
<data name="RegistryJumpToKeyButton.Label" xml:space="preserve">
|
||||
<value>Open Key</value>
|
||||
</data>
|
||||
<data name="SaveDialogTitle" xml:space="preserve">
|
||||
<value>Save As</value>
|
||||
</data>
|
||||
<data name="SaveAsButton.Label" xml:space="preserve">
|
||||
<value>Save as…</value>
|
||||
</data>
|
||||
|
@ -3,6 +3,7 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
@ -14,6 +15,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
ExtendedContextMenuOnly = false;
|
||||
}
|
||||
|
||||
[JsonPropertyName("showInExtendedContextMenu")]
|
||||
public bool ExtendedContextMenuOnly { get; set; }
|
||||
|
||||
public string ToJsonString()
|
||||
|
@ -8,9 +8,14 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
{
|
||||
public class FindMyMouseProperties
|
||||
{
|
||||
public HotkeySettings DefaultActivationShortcut => new HotkeySettings(true, false, false, true, 0x46);
|
||||
|
||||
[JsonPropertyName("activation_method")]
|
||||
public IntProperty ActivationMethod { get; set; }
|
||||
|
||||
[JsonPropertyName("activation_shortcut")]
|
||||
public HotkeySettings ActivationShortcut { get; set; }
|
||||
|
||||
[JsonPropertyName("do_not_activate_on_game_mode")]
|
||||
public BoolProperty DoNotActivateOnGameMode { get; set; }
|
||||
|
||||
@ -41,6 +46,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
public FindMyMouseProperties()
|
||||
{
|
||||
ActivationMethod = new IntProperty(0);
|
||||
ActivationShortcut = DefaultActivationShortcut;
|
||||
DoNotActivateOnGameMode = new BoolProperty(true);
|
||||
BackgroundColor = new StringProperty("#000000");
|
||||
SpotlightColor = new StringProperty("#FFFFFF");
|
||||
|
@ -18,7 +18,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
{
|
||||
Name = ModuleName;
|
||||
Properties = new FindMyMouseProperties();
|
||||
Version = "1.0";
|
||||
Version = "1.1";
|
||||
}
|
||||
|
||||
public string GetModuleName()
|
||||
@ -29,6 +29,17 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
// This can be utilized in the future if the settings.json file is to be modified/deleted.
|
||||
public bool UpgradeSettingsConfiguration()
|
||||
{
|
||||
if (Version == "1.0")
|
||||
{
|
||||
if (Properties.ActivationMethod.Value == 1)
|
||||
{
|
||||
Properties.ActivationMethod = new IntProperty(2);
|
||||
}
|
||||
|
||||
Version = "1.1";
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -3,26 +3,20 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Converters
|
||||
{
|
||||
public sealed class FindMyMouseActivationShakeMouseIntToVisibilityConverter : IValueConverter
|
||||
public sealed class FindMyMouseActivationIntToVisibilityConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
var activationShake = (int)value;
|
||||
var selectedActivation = (int)value;
|
||||
var expectedActivation = int.Parse(parameter as string, CultureInfo.InvariantCulture);
|
||||
|
||||
// Assumes 1 is the index for the shake mouse option in the activation method combo box
|
||||
if (activationShake == 1)
|
||||
{
|
||||
return Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Visibility.Collapsed;
|
||||
}
|
||||
return selectedActivation == expectedActivation ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
@ -182,6 +182,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
|
||||
public void RefreshEnabledState()
|
||||
{
|
||||
UpdateEnabledState(_generalSettingsRepository.SettingsConfig.Enabled.Awake);
|
||||
ViewModel.RefreshEnabledState();
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
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:labs="using:CommunityToolkit.Labs.WinUI"
|
||||
xmlns:localConverters="using:Microsoft.PowerToys.Settings.UI.Converters"
|
||||
@ -11,7 +12,9 @@
|
||||
AutomationProperties.LandmarkType="Main"
|
||||
mc:Ignorable="d">
|
||||
<Page.Resources>
|
||||
<localConverters:FindMyMouseActivationShakeMouseIntToVisibilityConverter x:Key="FindMyMouseActivationShakeMouseIntToVisibilityConverter" />
|
||||
<localConverters:FindMyMouseActivationIntToVisibilityConverter x:Key="FindMyMouseActivationIntToVisibilityConverter" />
|
||||
<converters:NegativeBoolToVisibilityConverter
|
||||
x:Key="BoolToInvertedVisibilityConverter" />
|
||||
</Page.Resources>
|
||||
<controls:SettingsPageControl
|
||||
x:Uid="MouseUtils"
|
||||
@ -42,12 +45,14 @@
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
SelectedIndex="{x:Bind Path=ViewModel.FindMyMouseActivationMethod, Mode=TwoWay}">
|
||||
<ComboBoxItem x:Uid="MouseUtils_FindMyMouse_ActivationDoubleControlPress" />
|
||||
<ComboBoxItem x:Uid="MouseUtils_FindMyMouse_ActivationDoubleRightControlPress" />
|
||||
<ComboBoxItem x:Uid="MouseUtils_FindMyMouse_ActivationShakeMouse" />
|
||||
<ComboBoxItem x:Uid="MouseUtils_FindMyMouse_ActivationCustomizedShortcut" />
|
||||
</ComboBox>
|
||||
<labs:SettingsExpander.Items>
|
||||
<labs:SettingsCard
|
||||
x:Uid="MouseUtils_FindMyMouse_ShakingMinimumDistance"
|
||||
Visibility="{x:Bind Mode=OneWay, Path=ViewModel.FindMyMouseActivationMethod, Converter={StaticResource FindMyMouseActivationShakeMouseIntToVisibilityConverter}}">
|
||||
Visibility="{x:Bind Mode=OneWay, Path=ViewModel.FindMyMouseActivationMethod, Converter={StaticResource FindMyMouseActivationIntToVisibilityConverter}, ConverterParameter=2}">
|
||||
<NumberBox
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
LargeChange="1000"
|
||||
@ -57,6 +62,14 @@
|
||||
SpinButtonPlacementMode="Compact"
|
||||
Value="{x:Bind Mode=TwoWay, Path=ViewModel.FindMyMouseShakingMinimumDistance}" />
|
||||
</labs:SettingsCard>
|
||||
<labs:SettingsCard
|
||||
x:Uid="MouseUtils_FindMyMouse_ActivationShortcut"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily}, Glyph=}"
|
||||
Visibility="{x:Bind Mode=OneWay, Path=ViewModel.FindMyMouseActivationMethod, Converter={StaticResource FindMyMouseActivationIntToVisibilityConverter}, ConverterParameter=3}">
|
||||
<controls:ShortcutControl
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
HotkeySettings="{x:Bind Path=ViewModel.FindMyMouseActivationShortcut, Mode=TwoWay}" />
|
||||
</labs:SettingsCard>
|
||||
<labs:SettingsCard ContentAlignment="Left">
|
||||
<CheckBox
|
||||
x:Uid="MouseUtils_Prevent_Activation_On_Game_Mode"
|
||||
@ -64,7 +77,6 @@
|
||||
</labs:SettingsCard>
|
||||
</labs:SettingsExpander.Items>
|
||||
</labs:SettingsExpander>
|
||||
|
||||
<labs:SettingsExpander
|
||||
x:Uid="Appearance_Behavior"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily}, Glyph=}"
|
||||
@ -107,11 +119,17 @@
|
||||
Minimum="0"
|
||||
SmallChange="10"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsAnimationEnabledBySystem}"
|
||||
Value="{x:Bind Mode=TwoWay, Path=ViewModel.FindMyMouseAnimationDurationMs}" />
|
||||
</labs:SettingsCard>
|
||||
</labs:SettingsExpander.Items>
|
||||
</labs:SettingsExpander>
|
||||
|
||||
<InfoBar
|
||||
x:Uid="MouseUtils_FindMyMouse_AnimationDurationMs_Disabled"
|
||||
IsClosable="False"
|
||||
IsOpen="True"
|
||||
Severity="Informational"
|
||||
Visibility="{x:Bind Mode=OneWay, Path=ViewModel.IsAnimationEnabledBySystem, Converter={StaticResource BoolToInvertedVisibilityConverter}}" />
|
||||
<labs:SettingsExpander
|
||||
x:Uid="MouseUtils_FindMyMouse_ExcludedApps"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily}, Glyph=}"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
@ -1148,7 +1148,7 @@
|
||||
<value>Use a shortcut or press the Windows key for some time to activate</value>
|
||||
</data>
|
||||
<data name="Radio_ShortcutGuide_ActivationMethod_CustomizedShortcut.Content" xml:space="preserve">
|
||||
<value>Customized shortcut</value>
|
||||
<value>Custom shortcut</value>
|
||||
</data>
|
||||
<data name="Radio_ShortcutGuide_ActivationMethod_LongPressWindowsKey.Content" xml:space="preserve">
|
||||
<value>Hold down Windows key</value>
|
||||
@ -2384,7 +2384,7 @@ From there, simply click on one of the supported files in the File Explorer and
|
||||
<comment>Mouse as in the hardware peripheral</comment>
|
||||
</data>
|
||||
<data name="Oobe_MouseUtils_FindMyMouse_Description.Text" xml:space="preserve">
|
||||
<value>Shake the mouse or press the left Ctrl key twice to focus the mouse pointer.</value>
|
||||
<value>Focus the mouse pointer pressing the Ctrl key twice, using a custom shortcut or shaking the mouse.</value>
|
||||
<comment>Mouse as in the hardware peripheral. Key as in a keyboard key</comment>
|
||||
</data>
|
||||
<data name="Oobe_MouseUtils_MouseHighlighter.Text" xml:space="preserve">
|
||||
@ -2512,7 +2512,7 @@ Right-click to remove the key combination, thereby deactivating the shortcut.</v
|
||||
<comment>Refers to the utility name</comment>
|
||||
</data>
|
||||
<data name="MouseUtils_FindMyMouse.Description" xml:space="preserve">
|
||||
<value>Find My Mouse highlights the position of the cursor when shaking the mouse or pressing the left Ctrl key twice.</value>
|
||||
<value>Find My Mouse highlights the position of the cursor when pressing the Ctrl key twice, using a custom shortcut or when shaking the mouse.</value>
|
||||
<comment>"Ctrl" is a keyboard key. "Find My Mouse" is the name of the utility</comment>
|
||||
</data>
|
||||
<data name="MouseUtils_Enable_FindMyMouse.Header" xml:space="preserve">
|
||||
@ -2570,6 +2570,9 @@ Right-click to remove the key combination, thereby deactivating the shortcut.</v
|
||||
<value>Time before the spotlight appears (ms)</value>
|
||||
<comment>ms = milliseconds</comment>
|
||||
</data>
|
||||
<data name="MouseUtils_FindMyMouse_AnimationDurationMs_Disabled.Message" xml:space="preserve">
|
||||
<value>Animations are disabled by OS. See Settings > Accessibility > Visual effects</value>
|
||||
</data>
|
||||
<data name="MouseUtils_FindMyMouse_ShakingMinimumDistance.Header" xml:space="preserve">
|
||||
<value>Shake minimum distance</value>
|
||||
</data>
|
||||
@ -3658,4 +3661,17 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<data name="AlwaysOnTop_FrameOpacity.Header" xml:space="preserve">
|
||||
<value>Opacity (%)</value>
|
||||
</data>
|
||||
<data name="MouseUtils_FindMyMouse_ActivationCustomizedShortcut.Content" xml:space="preserve">
|
||||
<value>Custom shortcut</value>
|
||||
</data>
|
||||
<data name="MouseUtils_FindMyMouse_ActivationDoubleRightControlPress.Content" xml:space="preserve">
|
||||
<value>Press Right Control twice</value>
|
||||
<comment>Right control is the physical key on the keyboard.</comment>
|
||||
</data>
|
||||
<data name="MouseUtils_FindMyMouse_ActivationShortcut.Description" xml:space="preserve">
|
||||
<value>Customize the shortcut to turn on or off this mode</value>
|
||||
</data>
|
||||
<data name="MouseUtils_FindMyMouse_ActivationShortcut.Header" xml:space="preserve">
|
||||
<value>Activation shortcut</value>
|
||||
</data>
|
||||
</root>
|
@ -22,5 +22,11 @@ namespace Microsoft.PowerToys.Settings.Utilities
|
||||
|
||||
[System.Runtime.InteropServices.DllImport("User32.dll")]
|
||||
public static extern bool IsIconic(IntPtr handle);
|
||||
|
||||
[DllImport("user32.dll", EntryPoint = "SystemParametersInfo")]
|
||||
internal static extern bool SystemParametersInfo(int uiAction, int uiParam, ref int pvParam, int fWinIni);
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Interop object")]
|
||||
public const int SPI_GETCLIENTAREAANIMATION = 0x1042;
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ using global::PowerToys.GPOWrapper;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
using Microsoft.PowerToys.Settings.Utilities;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
@ -42,7 +43,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
ArgumentNullException.ThrowIfNull(findMyMouseSettingsRepository);
|
||||
|
||||
FindMyMouseSettingsConfig = findMyMouseSettingsRepository.SettingsConfig;
|
||||
_findMyMouseActivationMethod = FindMyMouseSettingsConfig.Properties.ActivationMethod.Value < 2 ? FindMyMouseSettingsConfig.Properties.ActivationMethod.Value : 0;
|
||||
_findMyMouseActivationMethod = FindMyMouseSettingsConfig.Properties.ActivationMethod.Value < 4 ? FindMyMouseSettingsConfig.Properties.ActivationMethod.Value : 0;
|
||||
_findMyMouseDoNotActivateOnGameMode = FindMyMouseSettingsConfig.Properties.DoNotActivateOnGameMode.Value;
|
||||
|
||||
string backgroundColor = FindMyMouseSettingsConfig.Properties.BackgroundColor.Value;
|
||||
@ -99,6 +100,10 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
_mousePointerCrosshairsFixedLength = MousePointerCrosshairsSettingsConfig.Properties.CrosshairsFixedLength.Value;
|
||||
_mousePointerCrosshairsAutoActivate = MousePointerCrosshairsSettingsConfig.Properties.AutoActivate.Value;
|
||||
|
||||
int isEnabled = 0;
|
||||
NativeMethods.SystemParametersInfo(NativeMethods.SPI_GETCLIENTAREAANIMATION, 0, ref isEnabled, 0);
|
||||
_isAnimationEnabledBySystem = isEnabled != 0;
|
||||
|
||||
// set the callback functions value to handle outgoing IPC message.
|
||||
SendConfigMSG = ipcMSGCallBackFunc;
|
||||
}
|
||||
@ -203,6 +208,23 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public HotkeySettings FindMyMouseActivationShortcut
|
||||
{
|
||||
get
|
||||
{
|
||||
return FindMyMouseSettingsConfig.Properties.ActivationShortcut;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (FindMyMouseSettingsConfig.Properties.ActivationShortcut != value)
|
||||
{
|
||||
FindMyMouseSettingsConfig.Properties.ActivationShortcut = value ?? FindMyMouseSettingsConfig.Properties.DefaultActivationShortcut;
|
||||
NotifyFindMyMousePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool FindMyMouseDoNotActivateOnGameMode
|
||||
{
|
||||
get
|
||||
@ -295,6 +317,19 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsAnimationEnabledBySystem
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isAnimationEnabledBySystem;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_isAnimationEnabledBySystem = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int FindMyMouseAnimationDurationMs
|
||||
{
|
||||
get
|
||||
@ -938,5 +973,6 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
private bool _mousePointerCrosshairsIsFixedLengthEnabled;
|
||||
private int _mousePointerCrosshairsFixedLength;
|
||||
private bool _mousePointerCrosshairsAutoActivate;
|
||||
private bool _isAnimationEnabledBySystem;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user