Sync dev/imageResizer with master (#1105)

* tweaking language

* adjusting elevated permission verbiage to match Windows

* npm audit fix to update stuff

* slight bump for fabric ui

* Remove unwanted files (#1037)

Add temp build files to gitignore

* Ensure previous search and replace texts are evaluated and updated in the UI at startup (#1043)

Ensure stored settings get evaluated after initial enumeration

There was a bug where the list view was not getting updated with the results of the search and replace on launch when we are using a stored search or replace text from a previous session.

* adding fancy zone opacity setting, enhancement #631 (#1008)

* adding fancy zone opacity setting, enhancement #631

* applying zone opacity setting to all zones during zone selection

* changing opacity setting to percentage

* runner: show message box when restarting with different elevation fails (#1061)

Also make the message box appear on top of the settings window.

* Fix misaligned display of zones in layout priview and grid editor (#1010)

Fix misaligned display of zones in layout preview and grid editor

* MSIX: Extract MSIX building functionality from msix_reinstall.ps1 to a separate script (#1068)

* MSIX: label PowerToys as Preview (#1090)

* MSIX: Code sign msixbundle (#1093)

* Update to MSIX README.md (#1095)

* Update README.md

few adjustments

* Update README.md

* Update README.md

* adding in privacy statement, removing About in dialog (#1087)

* adding in privacy statement, removing About in dialog

* added Preview

* Revert "Fix misaligned display of zones in layout priview and grid editor (#1010)" (#1097)

This reverts commit d03690cffd.

* Fix reversed order of zones in layout (#1071)

* Shifted three functions to common (#1101)

Co-authored-by: Clint Rutkas <clint@rutkas.com>
Co-authored-by: Enrico Giordani <enricogior@users.noreply.github.com>
Co-authored-by: Chris Davis <chrisdavis@outlook.com>
Co-authored-by: Yosef Durr <yodurr@microsoft.com>
Co-authored-by: Bartosz Sosnowski <bzoz@users.noreply.github.com>
Co-authored-by: vldmr11080 <57061786+vldmr11080@users.noreply.github.com>
Co-authored-by: yuyoyuppe <yuyoyuppe@users.noreply.github.com>
This commit is contained in:
Arjun Balgovind 2020-01-17 17:42:17 -08:00 committed by GitHub
parent f65b9fd2a7
commit db7f15541f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 425 additions and 267 deletions

4
.gitignore vendored
View file

@ -330,3 +330,7 @@ ASALocalRun/
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Temp build files
src/settings/settings-html/200.html
src/settings/settings-html/404.html

View file

@ -26,7 +26,7 @@
</Capabilities>
<Applications>
<Application Id="PowerToys" Executable="PowerToys.exe" EntryPoint="Windows.FullTrustApplication">
<uap:VisualElements DisplayName="PowerToys" Description="Windows system utilities to maximize productivity" Square150x150Logo="Images\logo150.png" Square44x44Logo="Images\logo44.png" BackgroundColor="transparent" />
<uap:VisualElements DisplayName="PowerToys (Preview)" Description="Windows system utilities to maximize productivity" Square150x150Logo="Images\logo150.png" Square44x44Logo="Images\logo44.png" BackgroundColor="transparent" />
<Extensions>
<uap5:Extension Category="windows.startupTask" Executable="PowerToys.exe" EntryPoint="Windows.FullTrustApplication">
<uap5:StartupTask TaskId="PowerToysStartupTaskID" Enabled="true" DisplayName="PowerToys" />

View file

@ -0,0 +1 @@
makeappx build /v /overwrite /f PackagingLayout.xml /id "PowerToys-x64" /op bin\

View file

@ -1,6 +1,11 @@
taskkill /f /im explorer.exe
Get-AppxPackage -Name 'PowerToys' | select -ExpandProperty "PackageFullName" | Remove-AppxPackage
makeappx build /v /overwrite /f PackagingLayout.xml /id "PowerToys-x64" /op bin\
.\build_msix.ps1
signtool sign /debug /a /fd SHA256 /f PowerToys_TemporaryKey.pfx /p 12345 bin\PowerToys-x64.msix
signtool sign /debug /a /fd SHA256 /f PowerToys_TemporaryKey.pfx /p 12345 bin\PowerToys.msixbundle
Add-AppxPackage .\bin\PowerToys-x64.msix
start $Env:windir\explorer.exe

View file

@ -7,14 +7,21 @@
* The resulting installer will be built to `PowerToysSetup\bin\Release\PowerToysSetup.msi`.
## Building and installing self-signed PowerToys MSIX package
For the first-time installation, you should generate a self-signed certificate and add it to the [TRCA store](https://docs.microsoft.com/en-us/windows-hardware/drivers/install/trusted-root-certification-authorities-certificate-store). That could be done by simply running `
generate_self_sign_cert.ps1` from a powershell admin. After that:
For the first-time installation, you'll need to generate a self-signed certificate. The script below will generate and add a cert to your [TRCA store](https://docs.microsoft.com/en-us/windows-hardware/drivers/install/trusted-root-certification-authorities-certificate-store).
1. Open `Developer PowerShell for VS` as an Admin
2. Navigate to your repo's `installer\MSIX`
3. Run `.\generate_self_sign_cert.ps1`
* Make sure you've built the `Release` configuration of `powertoys.sln`
* Launch `msix_reinstall.ps1` from the devenv powershell
## To Build
1. Make sure you've built the `Release` configuration of `powertoys.sln`
2. Open `Developer PowerShell for VS`
3. Navigate to your repo's `installer\MSIX`
4. Run `.\msix_reinstall.ps1` from the devenv powershell
### What msix_reinstall.ps1 does
`msix_reinstall.ps1` removes the current PowerToys installation, restarts explorer.exe (to update PowerRename shell extension), builds `PowerToys-x64.msix` package, signs it with a PowerToys_TemporaryKey.pfx, and finally installs it.
## Removing all .msi/.msix PowerToys installations
#### Removing all .msi/.msix PowerToys installations
```ps
$name='PowerToys'
Get-AppxPackage -Name $name | select -ExpandProperty "PackageFullName" | Remove-AppxPackage

View file

@ -310,6 +310,33 @@ bool run_non_elevated(const std::wstring& file, const std::wstring& params) {
return succedded;
}
bool run_same_elevation(const std::wstring& file, const std::wstring& params) {
auto executable_args = file;
if (!params.empty()) {
executable_args += L" " + params;
}
STARTUPINFO si = { 0 };
PROCESS_INFORMATION pi = { 0 };
auto succedded = CreateProcessW(file.c_str(),
const_cast<LPWSTR>(executable_args.c_str()),
nullptr,
nullptr,
FALSE,
0,
nullptr,
nullptr,
&si,
&pi);
if (pi.hProcess) {
CloseHandle(pi.hProcess);
}
if (pi.hThread) {
CloseHandle(pi.hThread);
}
return succedded;
}
std::wstring get_process_path(HWND window) noexcept {
const static std::wstring app_frame_host = L"ApplicationFrameHost.exe";
DWORD pid{};

View file

@ -58,6 +58,9 @@ bool run_elevated(const std::wstring& file, const std::wstring& params);
// Run command as non-elevated user, returns true if succeeded
bool run_non_elevated(const std::wstring& file, const std::wstring& params);
// Run command with the same elevation, returns true if succedded
bool run_same_elevation(const std::wstring& file, const std::wstring& params);
// Get the executable path or module name for modern apps
std::wstring get_process_path(DWORD pid) noexcept;
// Get the executable path or module name for modern apps

View file

@ -97,6 +97,8 @@
<ClInclude Include="d2d_text.h" />
<ClInclude Include="d2d_window.h" />
<ClInclude Include="dpi_aware.h" />
<ClInclude Include="window_helpers.h" />
<ClInclude Include="icon_helpers.h" />
<ClInclude Include="hwnd_data_cache.h" />
<ClInclude Include="json.h" />
<ClInclude Include="monitors.h" />
@ -130,10 +132,12 @@
</ClCompile>
<ClCompile Include="settings_helpers.cpp" />
<ClCompile Include="settings_objects.cpp" />
<ClCompile Include="icon_helpers.cpp" />
<ClCompile Include="start_visible.cpp" />
<ClCompile Include="tasklist_positions.cpp" />
<ClCompile Include="common.cpp" />
<ClCompile Include="windows_colors.cpp" />
<ClCompile Include="window_helpers.cpp" />
<ClCompile Include="winstore.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View file

@ -81,6 +81,12 @@
<ClInclude Include="winstore.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="icon_helpers.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="window_helpers.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="d2d_svg.cpp">
@ -132,5 +138,11 @@
<ClCompile Include="winstore.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="icon_helpers.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="window_helpers.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View file

@ -0,0 +1,90 @@
#include "icon_helpers.h"
#include "pch.h"
HRESULT GetIconIndexFromPath(_In_ PCWSTR path, _Out_ int* index)
{
*index = 0;
HRESULT hr = E_FAIL;
SHFILEINFO shFileInfo = { 0 };
if (!PathIsRelative(path))
{
DWORD attrib = GetFileAttributes(path);
HIMAGELIST himl = (HIMAGELIST)SHGetFileInfo(path, attrib, &shFileInfo, sizeof(shFileInfo), (SHGFI_SYSICONINDEX | SHGFI_SMALLICON | SHGFI_USEFILEATTRIBUTES));
if (himl)
{
*index = shFileInfo.iIcon;
// We shouldn't free the HIMAGELIST.
hr = S_OK;
}
}
return hr;
}
HBITMAP CreateBitmapFromIcon(_In_ HICON hIcon, _In_opt_ UINT width, _In_opt_ UINT height)
{
HBITMAP hBitmapResult = NULL;
// Create compatible DC
HDC hDC = CreateCompatibleDC(NULL);
if (hDC != NULL)
{
// Get bitmap rectangle size
RECT rc = { 0 };
rc.left = 0;
rc.right = (width != 0) ? width : GetSystemMetrics(SM_CXSMICON);
rc.top = 0;
rc.bottom = (height != 0) ? height : GetSystemMetrics(SM_CYSMICON);
// Create bitmap compatible with DC
BITMAPINFO BitmapInfo;
ZeroMemory(&BitmapInfo, sizeof(BITMAPINFO));
BitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
BitmapInfo.bmiHeader.biWidth = rc.right;
BitmapInfo.bmiHeader.biHeight = rc.bottom;
BitmapInfo.bmiHeader.biPlanes = 1;
BitmapInfo.bmiHeader.biBitCount = 32;
BitmapInfo.bmiHeader.biCompression = BI_RGB;
HDC hDCBitmap = GetDC(NULL);
HBITMAP hBitmap = CreateDIBSection(hDCBitmap, &BitmapInfo, DIB_RGB_COLORS, NULL, NULL, 0);
ReleaseDC(NULL, hDCBitmap);
if (hBitmap != NULL)
{
// Select bitmap into DC
HBITMAP hBitmapOld = (HBITMAP)SelectObject(hDC, hBitmap);
if (hBitmapOld != NULL)
{
// Draw icon into DC
if (DrawIconEx(hDC, 0, 0, hIcon, rc.right, rc.bottom, 0, NULL, DI_NORMAL))
{
// Restore original bitmap in DC
hBitmapResult = (HBITMAP)SelectObject(hDC, hBitmapOld);
hBitmapOld = NULL;
hBitmap = NULL;
}
if (hBitmapOld != NULL)
{
SelectObject(hDC, hBitmapOld);
}
}
if (hBitmap != NULL)
{
DeleteObject(hBitmap);
}
}
DeleteDC(hDC);
}
return hBitmapResult;
}

View file

@ -0,0 +1,5 @@
#pragma once
#include "common.h"
HRESULT GetIconIndexFromPath(_In_ PCWSTR path, _Out_ int* index);
HBITMAP CreateBitmapFromIcon(_In_ HICON hIcon, _In_opt_ UINT width = 0, _In_opt_ UINT height = 0);

View file

@ -0,0 +1,30 @@
#include "window_helpers.h"
#include "pch.h"
HWND CreateMsgWindow(_In_ HINSTANCE hInst, _In_ WNDPROC pfnWndProc, _In_ void* p)
{
WNDCLASS wc = { 0 };
PCWSTR wndClassName = L"MsgWindow";
wc.lpfnWndProc = DefWindowProc;
wc.cbWndExtra = sizeof(void*);
wc.hInstance = hInst;
wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wc.lpszClassName = wndClassName;
RegisterClass(&wc);
HWND hwnd = CreateWindowEx(
0, wndClassName, nullptr, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, hInst, nullptr);
if (hwnd)
{
SetWindowLongPtr(hwnd, 0, (LONG_PTR)p);
if (pfnWndProc)
{
SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)pfnWndProc);
}
}
return hwnd;
}

View file

@ -0,0 +1,4 @@
#pragma once
#include "common.h"
HWND CreateMsgWindow(_In_ HINSTANCE hInst, _In_ WNDPROC pfnWndProc, _In_ void* p);

View file

@ -68,6 +68,10 @@ public:
}
return GUID_NULL;
}
IFACEMETHODIMP_(int) GetZoneHighlightOpacity() noexcept
{
return m_settings->GetSettings().zoneHighlightOpacity;
}
LRESULT WndProc(HWND, UINT, WPARAM, LPARAM) noexcept;
void OnDisplayChange(DisplayChangeType changeType) noexcept;
@ -321,7 +325,6 @@ void FancyZones::ToggleEditor() noexcept
monitor = MonitorFromWindow(foregroundWindow, MONITOR_DEFAULTTOPRIMARY);
}
if (!monitor)
{
return;
@ -352,7 +355,7 @@ void FancyZones::ToggleEditor() noexcept
const auto taskbar_x_offset = MulDiv(mi.rcWork.left - mi.rcMonitor.left, DPIAware::DEFAULT_DPI, dpi_x);
const auto taskbar_y_offset = MulDiv(mi.rcWork.top - mi.rcMonitor.top, DPIAware::DEFAULT_DPI, dpi_y);
// Do not scale window params by the dpi, that will be done in the editor - see LayoutModel.Apply
const auto x = mi.rcMonitor.left + taskbar_x_offset;
const auto y = mi.rcMonitor.top + taskbar_y_offset;

View file

@ -36,6 +36,7 @@ interface __declspec(uuid("{5C8D99D6-34B2-4F4A-A8E5-7483F6869775}")) IZoneWindow
IFACEMETHOD_(void, MoveWindowsOnActiveZoneSetChange)() = 0;
IFACEMETHOD_(COLORREF, GetZoneHighlightColor)() = 0;
IFACEMETHOD_(GUID, GetCurrentMonitorZoneSetId)(HMONITOR monitor) = 0;
IFACEMETHOD_(int, GetZoneHighlightOpacity)() = 0;
};
winrt::com_ptr<IFancyZones> MakeFancyZones(HINSTANCE hinstance, IFancyZonesSettings* settings) noexcept;

View file

@ -49,6 +49,7 @@ private:
const std::wstring m_zoneHiglightName = L"fancyzones_zoneHighlightColor";
const std::wstring m_editorHotkeyName = L"fancyzones_editor_hotkey";
const std::wstring m_excludedAppsName = L"fancyzones_excluded_apps";
const std::wstring m_zoneHighlightOpacity = L"fancyzones_highlight_opacity";
};
IFACEMETHODIMP_(bool) FancyZonesSettings::GetConfig(_Out_ PWSTR buffer, _Out_ int *buffer_size) noexcept
@ -76,6 +77,7 @@ IFACEMETHODIMP_(bool) FancyZonesSettings::GetConfig(_Out_ PWSTR buffer, _Out_ in
settings.add_bool_toogle(setting.name, setting.resourceId, *setting.value);
}
settings.add_int_spinner(m_zoneHighlightOpacity, IDS_SETTINGS_HIGHLIGHT_OPACITY, m_settings.zoneHighlightOpacity, 0, 100, 1);
settings.add_color_picker(m_zoneHiglightName, IDS_SETTING_DESCRIPTION_ZONEHIGHLIGHTCOLOR, m_settings.zoneHightlightColor);
settings.add_multiline_string(m_excludedAppsName, IDS_SETTING_EXCLCUDED_APPS_DESCRIPTION, m_settings.excludedApps);
@ -153,6 +155,11 @@ void FancyZonesSettings::LoadSettings(PCWSTR config, bool fromFile) noexcept try
}
}
}
if (auto val = values.get_int_value(m_zoneHighlightOpacity))
{
m_settings.zoneHighlightOpacity = *val;
}
}
CATCH_LOG();
@ -166,6 +173,7 @@ void FancyZonesSettings::SaveSettings() noexcept try
}
values.add_property(m_zoneHiglightName, m_settings.zoneHightlightColor);
values.add_property(m_zoneHighlightOpacity, m_settings.zoneHighlightOpacity);
values.add_property(m_editorHotkeyName, m_settings.editorHotkey.get_json());
values.add_property(m_excludedAppsName, m_settings.excludedApps);

View file

@ -15,6 +15,7 @@ struct Settings
bool appLastZone_moveWindows = false;
bool use_cursorpos_editor_startupscreen = true;
std::wstring zoneHightlightColor = L"#0078D7";
int zoneHighlightOpacity = 90;
PowerToysSettings::HotkeyObject editorHotkey = PowerToysSettings::HotkeyObject::from_settings(true, false, false, false, VK_OEM_3);
std::wstring excludedApps = L"";
std::vector<std::wstring> excludedAppsArray;

View file

@ -49,7 +49,7 @@ IFACEMETHODIMP_(winrt::com_ptr<IZone>) ZoneSet::ZoneFromPoint(POINT pt) noexcept
winrt::com_ptr<IZone> smallestKnownZone = nullptr;
// To reduce redundant calculations, we will store the last known zones area.
int smallestKnownZoneArea = INT32_MAX;
for (auto iter = m_zones.begin(); iter != m_zones.end(); iter++)
for (auto iter = m_zones.rbegin(); iter != m_zones.rend(); iter++)
{
if (winrt::com_ptr<IZone> zone = iter->try_as<IZone>())
{

View file

@ -546,14 +546,14 @@ void ZoneWindow::DrawActiveZoneSet(wil::unique_hdc& hdc, RECT const& clientRect)
// { fillAlpha, fill, borderAlpha, border, thickness }
ColorSetting const colorHints { 225, RGB(81, 92, 107), 255, RGB(104, 118, 138), -2 };
ColorSetting colorViewer { 225, 0, 255, RGB(40, 50, 60), -2 };
ColorSetting colorHighlight { 225, 0, 255, 0, -2 };
ColorSetting colorViewer { OpacitySettingToAlpha(m_host->GetZoneHighlightOpacity()), 0, 255, RGB(40, 50, 60), -2 };
ColorSetting colorHighlight { OpacitySettingToAlpha(m_host->GetZoneHighlightOpacity()), 0, 255, 0, -2 };
ColorSetting const colorFlash { 200, RGB(81, 92, 107), 200, RGB(104, 118, 138), -2 };
auto zones = m_activeZoneSet->GetZones();
const size_t maxColorIndex = min(size(zones) - 1, size(colors) - 1);
size_t colorIndex = maxColorIndex;
for (auto iter = zones.rbegin(); iter != zones.rend(); iter++)
for (auto iter = zones.begin(); iter != zones.end(); iter++)
{
winrt::com_ptr<IZone> zone = iter->try_as<IZone>();
if (!zone)

View file

@ -20,6 +20,7 @@
IDS_SETTING_LAUNCH_EDITOR_DESCRIPTION "To launch the zone editor, select the Edit zones button below or press the zone editor hotkey anytime"
IDS_SETTING_LAUNCH_EDITOR_HOTKEY_LABEL "Configure the zone editor hotkey"
IDS_SETTING_EXCLCUDED_APPS_DESCRIPTION "To exclude an application from snapping to zones add its name here (one per line)"
IDS_SETTINGS_HIGHLIGHT_OPACITY "Zone Highlight Opacity (%)"
END
1 VERSIONINFO

View file

@ -13,3 +13,4 @@
#define IDS_SETTING_LAUNCH_EDITOR_DESCRIPTION 113
#define IDS_SETTING_LAUNCH_EDITOR_HOTKEY_LABEL 114
#define IDS_SETTING_EXCLCUDED_APPS_DESCRIPTION 115
#define IDS_SETTINGS_HIGHLIGHT_OPACITY 116

View file

@ -133,3 +133,9 @@ inline void ParseDeviceId(PCWSTR deviceId, PWSTR parsedId, size_t size)
StringCchCopy(parsedId, size, L"FallbackDevice");
}
}
inline int OpacitySettingToAlpha(int opacity)
{
// convert percentage to a 0-255 alpha value
return opacity * 2.55;
}

View file

@ -22,6 +22,11 @@ namespace FancyZonesUnitTests
{
return m_guid;
}
IFACEMETHODIMP_(int)
GetZoneHighlightOpacity() noexcept
{
return 100;
}
GUID m_guid;
};

View file

@ -5,6 +5,7 @@
#include <PowerRenameManager.h>
#include <trace.h>
#include <Helpers.h>
#include <icon_helpers.h>
#include <Settings.h>
#include "resource.h"

View file

@ -2,94 +2,6 @@
#include "Helpers.h"
#include <ShlGuid.h>
HRESULT GetIconIndexFromPath(_In_ PCWSTR path, _Out_ int* index)
{
*index = 0;
HRESULT hr = E_FAIL;
SHFILEINFO shFileInfo = { 0 };
if (!PathIsRelative(path))
{
DWORD attrib = GetFileAttributes(path);
HIMAGELIST himl = (HIMAGELIST)SHGetFileInfo(path, attrib, &shFileInfo, sizeof(shFileInfo), (SHGFI_SYSICONINDEX | SHGFI_SMALLICON | SHGFI_USEFILEATTRIBUTES));
if (himl)
{
*index = shFileInfo.iIcon;
// We shouldn't free the HIMAGELIST.
hr = S_OK;
}
}
return hr;
}
HBITMAP CreateBitmapFromIcon(_In_ HICON hIcon, _In_opt_ UINT width, _In_opt_ UINT height)
{
HBITMAP hBitmapResult = NULL;
// Create compatible DC
HDC hDC = CreateCompatibleDC(NULL);
if (hDC != NULL)
{
// Get bitmap rectangle size
RECT rc = { 0 };
rc.left = 0;
rc.right = (width != 0) ? width : GetSystemMetrics(SM_CXSMICON);
rc.top = 0;
rc.bottom = (height != 0) ? height : GetSystemMetrics(SM_CYSMICON);
// Create bitmap compatible with DC
BITMAPINFO BitmapInfo;
ZeroMemory(&BitmapInfo, sizeof(BITMAPINFO));
BitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
BitmapInfo.bmiHeader.biWidth = rc.right;
BitmapInfo.bmiHeader.biHeight = rc.bottom;
BitmapInfo.bmiHeader.biPlanes = 1;
BitmapInfo.bmiHeader.biBitCount = 32;
BitmapInfo.bmiHeader.biCompression = BI_RGB;
HDC hDCBitmap = GetDC(NULL);
HBITMAP hBitmap = CreateDIBSection(hDCBitmap, &BitmapInfo, DIB_RGB_COLORS, NULL, NULL, 0);
ReleaseDC(NULL, hDCBitmap);
if (hBitmap != NULL)
{
// Select bitmap into DC
HBITMAP hBitmapOld = (HBITMAP)SelectObject(hDC, hBitmap);
if (hBitmapOld != NULL)
{
// Draw icon into DC
if (DrawIconEx(hDC, 0, 0, hIcon, rc.right, rc.bottom, 0, NULL, DI_NORMAL))
{
// Restore original bitmap in DC
hBitmapResult = (HBITMAP)SelectObject(hDC, hBitmapOld);
hBitmapOld = NULL;
hBitmap = NULL;
}
if (hBitmapOld != NULL)
{
SelectObject(hDC, hBitmapOld);
}
}
if (hBitmap != NULL)
{
DeleteObject(hBitmap);
}
}
DeleteDC(hDC);
}
return hBitmapResult;
}
HRESULT _ParseEnumItems(_In_ IEnumShellItems* pesi, _In_ IPowerRenameManager* psrm, _In_ int depth = 0)
{
HRESULT hr = E_INVALIDARG;
@ -167,33 +79,6 @@ HRESULT EnumerateDataObject(_In_ IUnknown* dataSource, _In_ IPowerRenameManager*
return hr;
}
HWND CreateMsgWindow(_In_ HINSTANCE hInst, _In_ WNDPROC pfnWndProc, _In_ void* p)
{
WNDCLASS wc = { 0 };
PWSTR wndClassName = L"MsgWindow";
wc.lpfnWndProc = DefWindowProc;
wc.cbWndExtra = sizeof(void*);
wc.hInstance = hInst;
wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wc.lpszClassName = wndClassName;
RegisterClass(&wc);
HWND hwnd = CreateWindowEx(
0, wndClassName, nullptr, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, hInst, nullptr);
if (hwnd)
{
SetWindowLongPtr(hwnd, 0, (LONG_PTR)p);
if (pfnWndProc)
{
SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)pfnWndProc);
}
}
return hwnd;
}
BOOL GetEnumeratedFileName(__out_ecount(cchMax) PWSTR pszUniqueName, UINT cchMax, __in PCWSTR pszTemplate, __in_opt PCWSTR pszDir, unsigned long ulMinLong, __inout unsigned long* pulNumUsed)
{
PWSTR pszName = nullptr;

View file

@ -4,9 +4,6 @@
#include <lib/PowerRenameInterfaces.h>
HRESULT EnumerateDataObject(_In_ IUnknown* pdo, _In_ IPowerRenameManager* psrm);
HRESULT GetIconIndexFromPath(_In_ PCWSTR path, _Out_ int* index);
HBITMAP CreateBitmapFromIcon(_In_ HICON hIcon, _In_opt_ UINT width = 0, _In_opt_ UINT height = 0);
HWND CreateMsgWindow(_In_ HINSTANCE hInst, _In_ WNDPROC pfnWndProc, _In_ void* p);
BOOL GetEnumeratedFileName(
__out_ecount(cchMax) PWSTR pszUniqueName,
UINT cchMax,

View file

@ -1,6 +1,6 @@
#include "stdafx.h"
#include "PowerRenameItem.h"
#include "helpers.h"
#include "icon_helpers.h"
int CPowerRenameItem::s_id = 0;

View file

@ -4,6 +4,7 @@
#include <algorithm>
#include <shlobj.h>
#include "helpers.h"
#include "window_helpers.h"
#include <filesystem>
#include "trace.h"

View file

@ -185,6 +185,11 @@
<ItemGroup>
<ResourceCompile Include="PowerRenameTest.rc" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\common\common.vcxproj">
<Project>{74485049-c722-400f-abe5-86ac52d929b3}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View file

@ -585,45 +585,21 @@ INT_PTR CPowerRenameUI::_DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
void CPowerRenameUI::_OnInitDlg()
{
// Initialize from stored settings
_ReadSettings();
m_hwndLV = GetDlgItem(m_hwnd, IDC_LIST_PREVIEW);
m_listview.Init(m_hwndLV);
// Initialize checkboxes from flags
if (m_spsrm)
{
// Check if we should read flags from settings
// or the defaults from the manager.
DWORD flags = 0;
if (CSettings::GetPersistState())
{
flags = CSettings::GetFlags();
wchar_t buffer[MAX_INPUT_STRING_LEN];
buffer[0] = L'\0';
CSettings::GetSearchText(buffer, ARRAYSIZE(buffer));
SetDlgItemText(m_hwnd, IDC_EDIT_SEARCHFOR, buffer);
buffer[0] = L'\0';
CSettings::GetReplaceText(buffer, ARRAYSIZE(buffer));
SetDlgItemText(m_hwnd, IDC_EDIT_REPLACEWITH, buffer);
}
else
{
m_spsrm->get_flags(&flags);
}
_SetCheckboxesFromFlags(flags);
}
if (m_dataSource)
{
// Populate the manager from the data object
_EnumerateItems(m_dataSource);
}
// Initialize from stored settings. Do this now in case we have
// restored a previous search or replace text that needs to be
// evaluated against the items we just enumerated.
_ReadSettings();
// Load the main icon
LoadIconWithScaleDown(g_hInst, MAKEINTRESOURCE(IDI_RENAME), 32, 32, &m_iconMain);

View file

@ -192,6 +192,11 @@
<ClCompile Include="PowerRenameRegExTests.cpp" />
<ClCompile Include="TestFileHelper.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\common\common.vcxproj">
<Project>{74485049-c722-400f-abe5-86ac52d929b3}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View file

@ -80,7 +80,7 @@ int runner()
catch (std::runtime_error& err)
{
std::string err_what = err.what();
MessageBoxW(NULL, std::wstring(err_what.begin(), err_what.end()).c_str(), L"Error", MB_OK | MB_ICONERROR);
MessageBoxW(nullptr, std::wstring(err_what.begin(), err_what.end()).c_str(), GET_RESOURCE_STRING(IDS_ERROR).c_str(), MB_OK | MB_ICONERROR | MB_SETFOREGROUND);
result = -1;
}
Trace::UnregisterProvider();
@ -92,8 +92,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
WCHAR username[UNLEN + 1];
DWORD username_length = UNLEN + 1;
GetUserNameW(username, &username_length);
auto runner_mutex = CreateMutexW(NULL, TRUE, (std::wstring(L"Local\\PowerToyRunMutex") + username).c_str());
if (runner_mutex == NULL || GetLastError() == ERROR_ALREADY_EXISTS)
auto runner_mutex = CreateMutexW(nullptr, TRUE, (std::wstring(L"Local\\PowerToyRunMutex") + username).c_str());
if (runner_mutex == nullptr || GetLastError() == ERROR_ALREADY_EXISTS)
{
// The app is already running
return 0;
@ -124,7 +124,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
catch (std::runtime_error& err)
{
std::string err_what = err.what();
MessageBoxW(NULL, std::wstring(err_what.begin(), err_what.end()).c_str(), GET_RESOURCE_STRING(IDS_ERROR).c_str(), MB_OK | MB_ICONERROR);
MessageBoxW(nullptr, std::wstring(err_what.begin(), err_what.end()).c_str(), GET_RESOURCE_STRING(IDS_ERROR).c_str(), MB_OK | MB_ICONERROR);
result = -1;
}
ReleaseMutex(runner_mutex);
@ -135,7 +135,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
{
auto text = is_process_elevated() ? GET_RESOURCE_STRING(IDS_COULDNOT_RESTART_NONELEVATED) :
GET_RESOURCE_STRING(IDS_COULDNOT_RESTART_ELEVATED);
MessageBoxW(NULL, text.c_str(), GET_RESOURCE_STRING(IDS_ERROR).c_str(), MB_OK | MB_ICONERROR);
MessageBoxW(nullptr, text.c_str(), GET_RESOURCE_STRING(IDS_ERROR).c_str(), MB_OK | MB_ICONERROR | MB_SETFOREGROUND);
restart_same_elevation();
result = -1;
}
}

View file

@ -41,3 +41,11 @@ bool restart_if_scheduled()
return false;
}
}
bool restart_same_elevation()
{
constexpr DWORD exe_path_size = 0xFFFF;
auto exe_path = std::make_unique<wchar_t[]>(exe_path_size);
GetModuleFileNameW(nullptr, exe_path.get(), exe_path_size);
return run_same_elevation(exe_path.get(), {});
}

View file

@ -3,3 +3,4 @@ void schedule_restart_as_elevated();
void schedule_restart_as_non_elevated();
bool is_restart_scheduled();
bool restart_if_scheduled();
bool restart_same_elevation();

View file

@ -5,9 +5,9 @@
STRINGTABLE
BEGIN
IDS_COULDNOT_RESTART_NONELEVATED "Could not restart PowerToys as a non-elevated process!"
IDS_COULDNOT_RESTART_ELEVATED "Could not restart PowerToys as an elevated process!"
IDS_ERROR "Error"
IDS_COULDNOT_RESTART_NONELEVATED "Could not start PowerToys as a user!"
IDS_COULDNOT_RESTART_ELEVATED "Could not start PowerToys as an administrator!"
IDS_ERROR "PowerToys Error"
END
@ -18,7 +18,7 @@
POPUP "POPUP"
BEGIN
MENUITEM "Settings", ID_SETTINGS_MENU_COMMAND
MENUITEM "About", ID_ABOUT_MENU_COMMAND
//MENUITEM "About", ID_ABOUT_MENU_COMMAND
MENUITEM SEPARATOR
MENUITEM "Exit", ID_EXIT_MENU_COMMAND
END

View file

@ -1139,9 +1139,9 @@
}
},
"@microsoft/load-themed-styles": {
"version": "1.10.12",
"resolved": "https://registry.npmjs.org/@microsoft/load-themed-styles/-/load-themed-styles-1.10.12.tgz",
"integrity": "sha512-1qdD1Cff3DZHk8dn5SIupiIyDdB1nHWn/Ig/0tosJatD0ly4WlaSQwBDKeu+Ta2CAw7BxFf1U9K19yOrDT+Nog=="
"version": "1.10.26",
"resolved": "https://registry.npmjs.org/@microsoft/load-themed-styles/-/load-themed-styles-1.10.26.tgz",
"integrity": "sha512-N//pFTBL/iCSrMuDoLvBLpgGjlk+MgKX2kyFI3bJVb+LRozeyWCOZVRcR8aMKiYHdqwy5isu2Frp8drvWx7RbA=="
},
"@microsoft/package-deps-hash": {
"version": "2.2.159",
@ -1411,33 +1411,25 @@
"dev": true
},
"@uifabric/azure-themes": {
"version": "7.0.9",
"resolved": "https://registry.npmjs.org/@uifabric/azure-themes/-/azure-themes-7.0.9.tgz",
"integrity": "sha512-pTZO8lyvCjPhc3WTDln5bSGqbvQpb+iL9NTwGlOgNSOKWNbPzxh6IvQdGVmFCUiwYl8psaQbCGdCH5+tsEofFQ==",
"version": "7.0.10",
"resolved": "https://registry.npmjs.org/@uifabric/azure-themes/-/azure-themes-7.0.10.tgz",
"integrity": "sha512-ZKGxiz2ZjL3exOrF3bROlt8veoujn44jK/bJlto/i/WOrK07OMB4Am9hgsXTah1099aGxljgBJ/79D6eY9NEOA==",
"requires": {
"@uifabric/merge-styles": "^7.5.1",
"@uifabric/merge-styles": "^7.8.0",
"@uifabric/set-version": "^7.0.2",
"office-ui-fabric-react": "^7.31.3",
"tslib": "^1.7.1"
}
},
"@uifabric/example-data": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/@uifabric/example-data/-/example-data-7.0.1.tgz",
"integrity": "sha512-HWw2lAbF5Fn1NhmxxEpzgWrprEsQ7+Ut71zpAHdCJoVCVeesHl03gY/obBIz8ogrufW0RIlkrNSredy6uRzYDQ==",
"requires": {
"office-ui-fabric-react": "^7.59.0",
"tslib": "^1.7.1"
}
},
"@uifabric/foundation": {
"version": "7.4.4",
"resolved": "https://registry.npmjs.org/@uifabric/foundation/-/foundation-7.4.4.tgz",
"integrity": "sha512-I4zrJXq2B00+LIzxcCDyi3+lx/sm0DzDdSFvQQp3DS9eiL8TzcjZTneRr32TQuVlA0Q7nFQClIXjglEo8+quFA==",
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/@uifabric/foundation/-/foundation-7.5.0.tgz",
"integrity": "sha512-eymMyV3e+MFCkcfC1AFIAzVP/h6/QvDcYb1l6K3IaG1QG47ZwijJJXseEvNDjimfUiJhez9H7cSsRZPIIJ5MaQ==",
"requires": {
"@uifabric/merge-styles": "^7.7.0",
"@uifabric/merge-styles": "^7.8.0",
"@uifabric/set-version": "^7.0.2",
"@uifabric/styling": "^7.7.2",
"@uifabric/utilities": "^7.4.0",
"@uifabric/utilities": "^7.5.0",
"tslib": "^1.7.1"
}
},
@ -1452,9 +1444,9 @@
}
},
"@uifabric/merge-styles": {
"version": "7.7.0",
"resolved": "https://registry.npmjs.org/@uifabric/merge-styles/-/merge-styles-7.7.0.tgz",
"integrity": "sha512-VMLSHKNp4dFDOZTdXeXhNvkrdmxjTwP4MaUf6yLeMkD1qf36/uFAN4nQ7jVAr6RC5cVMklmxN6FtNj+6+bHGfA==",
"version": "7.8.1",
"resolved": "https://registry.npmjs.org/@uifabric/merge-styles/-/merge-styles-7.8.1.tgz",
"integrity": "sha512-DJBXNsYfrYQ3wCjOE197JqXTkqwfPlGJhQkhYMBwO76ovKBQyJxT8m6NL8og5F9blnIBdCJPrvRUz/21/WlUGg==",
"requires": {
"@uifabric/set-version": "^7.0.2",
"tslib": "^1.7.1"
@ -1479,23 +1471,23 @@
}
},
"@uifabric/styling": {
"version": "7.7.2",
"resolved": "https://registry.npmjs.org/@uifabric/styling/-/styling-7.7.2.tgz",
"integrity": "sha512-5xQbz5r4+XeWjb1omHara/1Hdk+dsNSUkZAw6sp/tnv/cGFea4+hMuSmSaTG6T78Osiy59UG+qw7Ax/spfr2EQ==",
"version": "7.8.0",
"resolved": "https://registry.npmjs.org/@uifabric/styling/-/styling-7.8.0.tgz",
"integrity": "sha512-mRNQUvfasOWW0/RJARA5mPHmPMORJXrNDoOpjoTNt+J6uj1/sA8km0l/AQtZ6b36bqo6kkaQgB9+msRobmdpiQ==",
"requires": {
"@microsoft/load-themed-styles": "^1.7.13",
"@uifabric/merge-styles": "^7.7.0",
"@uifabric/merge-styles": "^7.8.1",
"@uifabric/set-version": "^7.0.2",
"@uifabric/utilities": "^7.2.0",
"@uifabric/utilities": "^7.8.0",
"tslib": "^1.7.1"
}
},
"@uifabric/utilities": {
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/@uifabric/utilities/-/utilities-7.5.0.tgz",
"integrity": "sha512-h9XwZVaKyLN3Ss4G+bXFWsmCzExID/SKbO64XPjsCIhuxVYsTg6/hDrvyU4TCEx06/ehXfdHRmyjCYL1PNdDMg==",
"version": "7.8.0",
"resolved": "https://registry.npmjs.org/@uifabric/utilities/-/utilities-7.8.0.tgz",
"integrity": "sha512-ow3v9arBhe5C8GvklIuqD3PZMSNnY04HC7JoQVW301Q/gH+BGVECLTBzrFm/m66GCetMksDOMnkoBQSk0poPOQ==",
"requires": {
"@uifabric/merge-styles": "^7.7.0",
"@uifabric/merge-styles": "^7.8.1",
"@uifabric/set-version": "^7.0.2",
"prop-types": "^15.5.10",
"tslib": "^1.7.1"
@ -3039,9 +3031,9 @@
}
},
"commander": {
"version": "2.20.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz",
"integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==",
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true
},
"commondir": {
@ -5536,9 +5528,9 @@
"dev": true
},
"handlebars": {
"version": "4.4.2",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.4.2.tgz",
"integrity": "sha512-cIv17+GhL8pHHnRJzGu2wwcthL5sb8uDKBHvZ2Dtu5s1YNt0ljbzKbamnc+gr69y7bzwQiBdr5+hOpRd5pnOdg==",
"version": "4.5.3",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.3.tgz",
"integrity": "sha512-3yPecJoJHK/4c6aZhSvxOyG4vJKDshV36VHp0iVCDVh7o9w2vwi3NSnL2MMPj3YdduqaBcu7cGbggJQM0br9xA==",
"dev": true,
"requires": {
"neo-async": "^2.6.0",
@ -5943,12 +5935,12 @@
"dev": true
},
"https-proxy-agent": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz",
"integrity": "sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ==",
"version": "2.2.4",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz",
"integrity": "sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg==",
"dev": true,
"requires": {
"agent-base": "^4.1.0",
"agent-base": "^4.3.0",
"debug": "^3.1.0"
}
},
@ -6061,6 +6053,12 @@
"integrity": "sha1-8w9xbI4r00bHtn0985FVZqfAVgc=",
"dev": true
},
"infer-owner": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz",
"integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==",
"dev": true
},
"inflight": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
@ -8478,19 +8476,18 @@
"dev": true
},
"office-ui-fabric-react": {
"version": "7.51.0",
"resolved": "https://registry.npmjs.org/office-ui-fabric-react/-/office-ui-fabric-react-7.51.0.tgz",
"integrity": "sha512-tvcx80RbJhn7C2HsDrLjw6B20AFEH7LF/iHBC4pcElHEBVDepaoQuRuIuaJqL/S9gZJt/92nVJijWynCvwsUug==",
"version": "7.76.2",
"resolved": "https://registry.npmjs.org/office-ui-fabric-react/-/office-ui-fabric-react-7.76.2.tgz",
"integrity": "sha512-rWQrkv1o4jOdYhNk3GsLDxJw8mo1+6HspGNILiodRj7RfJx/OmSyVM4KT2gGJ5k2PZGNCdp7f7kp1JuICd31Mg==",
"requires": {
"@microsoft/load-themed-styles": "^1.7.13",
"@uifabric/example-data": "^7.0.1",
"@uifabric/foundation": "^7.4.4",
"@uifabric/foundation": "^7.5.0",
"@uifabric/icons": "^7.3.0",
"@uifabric/merge-styles": "^7.7.0",
"@uifabric/merge-styles": "^7.8.1",
"@uifabric/react-hooks": "^7.0.1",
"@uifabric/set-version": "^7.0.2",
"@uifabric/styling": "^7.7.2",
"@uifabric/utilities": "^7.5.0",
"@uifabric/styling": "^7.8.0",
"@uifabric/utilities": "^7.8.0",
"prop-types": "^15.5.10",
"tslib": "^1.7.1"
}
@ -10337,9 +10334,9 @@
}
},
"serialize-javascript": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-1.7.0.tgz",
"integrity": "sha512-ke8UG8ulpFOxO8f8gRYabHQe/ZntKlcig2Mp+8+URDP1D8vJZ0KUt7LYo07q25Z/+JVSgpr/cui9PIp5H6/+nA==",
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-2.1.2.tgz",
"integrity": "sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ==",
"dev": true
},
"serve-index": {
@ -11187,32 +11184,75 @@
}
},
"terser": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/terser/-/terser-4.0.2.tgz",
"integrity": "sha512-IWLuJqTvx97KP3uTYkFVn93cXO+EtlzJu8TdJylq+H0VBDlPMIfQA9MBS5Vc5t3xTEUG1q0hIfHMpAP2R+gWTw==",
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/terser/-/terser-4.4.3.tgz",
"integrity": "sha512-0ikKraVtRDKGzHrzkCv5rUNDzqlhmhowOBqC0XqUHFpW+vJ45+20/IFBcebwKfiS2Z9fJin6Eo+F1zLZsxi8RA==",
"dev": true,
"requires": {
"commander": "^2.19.0",
"commander": "^2.20.0",
"source-map": "~0.6.1",
"source-map-support": "~0.5.10"
"source-map-support": "~0.5.12"
}
},
"terser-webpack-plugin": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.3.0.tgz",
"integrity": "sha512-W2YWmxPjjkUcOWa4pBEv4OP4er1aeQJlSo2UhtCFQCuRXEHjOFscO8VyWHj9JLlA0RzQb8Y2/Ta78XZvT54uGg==",
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.4.3.tgz",
"integrity": "sha512-QMxecFz/gHQwteWwSo5nTc6UaICqN1bMedC5sMtUc7y3Ha3Q8y6ZO0iCR8pq4RJC8Hjf0FEPEHZqcMB/+DFCrA==",
"dev": true,
"requires": {
"cacache": "^11.3.2",
"find-cache-dir": "^2.0.0",
"cacache": "^12.0.2",
"find-cache-dir": "^2.1.0",
"is-wsl": "^1.1.0",
"loader-utils": "^1.2.3",
"schema-utils": "^1.0.0",
"serialize-javascript": "^1.7.0",
"serialize-javascript": "^2.1.2",
"source-map": "^0.6.1",
"terser": "^4.0.0",
"webpack-sources": "^1.3.0",
"terser": "^4.1.2",
"webpack-sources": "^1.4.0",
"worker-farm": "^1.7.0"
},
"dependencies": {
"cacache": {
"version": "12.0.3",
"resolved": "https://registry.npmjs.org/cacache/-/cacache-12.0.3.tgz",
"integrity": "sha512-kqdmfXEGFepesTuROHMs3MpFLWrPkSSpRqOw80RCflZXy/khxaArvFrQ7uJxSUduzAufc6G0g1VUCOZXxWavPw==",
"dev": true,
"requires": {
"bluebird": "^3.5.5",
"chownr": "^1.1.1",
"figgy-pudding": "^3.5.1",
"glob": "^7.1.4",
"graceful-fs": "^4.1.15",
"infer-owner": "^1.0.3",
"lru-cache": "^5.1.1",
"mississippi": "^3.0.0",
"mkdirp": "^0.5.1",
"move-concurrently": "^1.0.1",
"promise-inflight": "^1.0.1",
"rimraf": "^2.6.3",
"ssri": "^6.0.1",
"unique-filename": "^1.1.1",
"y18n": "^4.0.0"
}
},
"rimraf": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
"integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
"dev": true,
"requires": {
"glob": "^7.1.3"
}
},
"webpack-sources": {
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.4.3.tgz",
"integrity": "sha512-lgTS3Xhv1lCOKo7SA5TjKXMjpSM4sBjNV5+q2bqesbSPs5FjGmU6jjtBSkX9b4qW87vDIsCIlUPOEhbZrMdjeQ==",
"dev": true,
"requires": {
"source-list-map": "^2.0.0",
"source-map": "~0.6.1"
}
}
}
},
"test-exclude": {
@ -11513,14 +11553,23 @@
"dev": true
},
"uglify-js": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.0.tgz",
"integrity": "sha512-W+jrUHJr3DXKhrsS7NUVxn3zqMOFn0hL/Ei6v0anCIMoKC93TjcflTagwIHLW7SfMFfiQuktQyFVCFHGUE0+yg==",
"version": "3.7.3",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.7.3.tgz",
"integrity": "sha512-7tINm46/3puUA4hCkKYo4Xdts+JDaVC9ZPRcG8Xw9R4nhO/gZgUM3TENq8IF4Vatk8qCig4MzP/c8G4u2BkVQg==",
"dev": true,
"optional": true,
"requires": {
"commander": "~2.20.0",
"commander": "~2.20.3",
"source-map": "~0.6.1"
},
"dependencies": {
"commander": {
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"dev": true,
"optional": true
}
}
},
"undertaker": {

View file

@ -29,8 +29,8 @@
},
"dependencies": {
"@svgr/webpack": "^4.3.3",
"@uifabric/azure-themes": "^7.0.9",
"office-ui-fabric-react": "^7.51.0",
"@uifabric/azure-themes": "^7.0.10",
"office-ui-fabric-react": "^7.76.2",
"react": "~16.8.0",
"react-dom": "~16.8.0"
},

View file

@ -122,12 +122,12 @@ export class GeneralSettings extends React.Component <any, any> {
<Separator />
<Text variant='xLarge'>General</Text>
<BoolToggleSettingsControl
setting={{display_name: 'Start at login', value: this.state.settings.general.startup}}
setting={{display_name: 'Run at Startup', value: this.state.settings.general.startup}}
on_change={this.parent_on_change}
ref={(input) => {this.startup_reference=input;}}
/>
<BoolToggleSettingsControl
setting={{display_name: 'Run PowerToys with elevated privileges', value: this.state.settings.general.run_elevated}}
setting={{display_name: 'Always run as administrator', value: this.state.settings.general.run_elevated}}
on_change={this.parent_on_change}
ref={(input) => {this.elevated_reference=input;}}
/>
@ -135,11 +135,11 @@ export class GeneralSettings extends React.Component <any, any> {
setting={{
display_name: '',
value: this.state.settings.general.is_elevated ?
'PowerToys is currently running with elevated privileges. You can restart it to run non-elevated only for this session, without changing the default setting.' :
'PowerToys is currently running without elevated privileges. You can restart it to run elevated only for this session, without changing the default setting.',
'Running as administrator. Do you wish to run as user instead?' :
'Running as user. Do you wish to run as administrator instead?',
button_text: this.state.settings.general.is_elevated ?
'Restart without elevated privileges' :
'Restart with elevated privileges'
'Restart as user' :
'Restart as administrator'
}}
action_name={'restart_elevation'}
action_callback={(action_name: any, value:any) => {
@ -225,16 +225,26 @@ export class GeneralSettings extends React.Component <any, any> {
ref={(input) => {this.theme_reference=input;}}
/>
<Stack>
<Label>Version {this.state.settings.general.powertoys_version}</Label>
<PrimaryButton
styles={{
<Text variant='xLarge'>About PowerToys (Preview)</Text>
<Label>Version {this.state.settings.general.powertoys_version}</Label>
<PrimaryButton
styles={{
root: {
alignSelf: "start"
}
}}
href='https://github.com/microsoft/PowerToys/releases'
target='_blank'
>Check for updates</PrimaryButton>
<Link
href="https://github.com/microsoft/PowerToys#privacy-statement"
target='_blank'
styles = {{
root: {
alignSelf: "start"
paddingTop: '10px'
}
}}
href='https://github.com/microsoft/PowerToys/releases'
target='_blank'
>Check for updates</PrimaryButton>
}}
>Privacy statement</Link>
</Stack>
{/* An empty span to always give 30px padding in Edge. */}
<span/>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long