Merge branch 'microsoft-master'

This commit is contained in:
Den Delimarsky
2021-04-07 17:13:45 -07:00
610 changed files with 21033 additions and 18367 deletions

View File

@@ -1,38 +0,0 @@
---
name: 🐛 Bug report
about: Report errors or unexpected behavior
title: ''
labels: Issue-Bug,Triage-Needed
assignees: ''
---
<!--
**Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**.
Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue.
-->
## Computer information
- PowerToys version:
- PowerToy Utility:
- Running PowerToys as Admin:
- Windows build number: [run "winver"]
## 📝 Provide detailed reproduction steps (if any)
1.
2.
3.
### ✔️ Expected result
_What is the expected result of the above steps?_
### ❌ Actual result
_What is the actual result of the above steps?_
## 📷 Screenshots
_Are there any useful screenshots? WinKey+Shift+S and then just paste them directly into the form_

87
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View File

@@ -0,0 +1,87 @@
name: "🐛 Bug report"
description: Report errors or unexpected behavior
title: ''
labels:
- Issue-Bug
- Triage-Needed
assignees: ''
issue_body: true
body:
- type: markdown
attributes:
value: |
Please make sure to [search for existing issues](https://github.com/microsoft/PowerToys/issues) before filing a new one!
- type: input
attributes:
label: Microsoft PowerToys version
placeholder: |
"0.33.1"
description: |
Hover over system tray icon or look at Settings
validations:
required: true
- type: checkboxes
attributes:
label: Running as admin
description: Are you running PowerToys as Admin?
options:
- label: "Yes"
- type: dropdown
attributes:
label: Area(s) with issue?
description: What things had an issue? Check all that apply.
multiple: true
options:
- General
- ColorPicker
- FancyZones
- FancyZones Editor
- Image Resizer
- Keyboard Manager
- MD Preview
- PowerRename
- PowerToys Run
- Shortcut Guide
- SVG Preview
- SVG Thumbnail
- Settings
- Welcome / PowerToys Tour window
- System tray interaction
- Installer
validations:
required: true
- type: textarea
attributes:
label: Steps to reproduce
description: We highly suggest including a screenshots and a bug report log (System tray->Report bug). To include, paste them into the markdown editor below the form or follow up with a separate comment.
placeholder: Tell us the steps required to trigger your bug.
validations:
required: true
- type: textarea
attributes:
label: ✔️ Expected Behavior
placeholder: What were you expecting?
validations:
required: false
- type: textarea
attributes:
label: ❌ Actual Behavior
placeholder: What happened instead?
validations:
required: true
- type: textarea
attributes:
label: Other Software
description: If you're reporting a bug about our interaction with other software, what software? What versions?
placeholder: |
vim 8.2 (inside WSL)
OpenSSH_for_Windows_8.1p1
My Cool Application v0.3 (include a code snippet if it would help!)
validations:
required: false

View File

@@ -1,30 +0,0 @@
---
name: 📖 Localization/Translation issue
about: Report incorrect translations.
title: ''
labels: Issue-Bug,Area-Localization,Issue-Translation,Triage-Needed
assignees: ''
---
## Computer information
- PowerToys version:
- PowerToy utility:
- Language:
## 📝 Provide where the issue is / 📷 Screenshots
_Are there any useful screenshots? WinKey+Shift+S and then just paste them directly into the form_
### ❌ Actual phrase(s)
_What is there?_
### ✔️ Expected phrase(s)
_What do you expect?_
### Why is the current translation wrong
_If it is opinion based issue, why do you feel this is incorrect? Example: term is outdated_

View File

@@ -0,0 +1,71 @@
name: "🌐 Localization/Translation issue"
description: Report incorrect translations.
title: ''
labels:
- Issue-Bug
- Area-Localization
- Issue-Translation
- Triage-Needed
assignees: ''
issue_body: true
body:
- type: markdown
attributes:
value: |
Please make sure to [search for existing issues](https://github.com/microsoft/PowerTOys/issues) before filing a new one!
- type: input
attributes:
label: Microsoft PowerToys version
placeholder: "0.33.1"
description: |
Hover over system tray icon or look at Settings
validations:
required: true
- type: dropdown
attributes:
label: Utility with translation issue
description: |
Please include a screenshot as that is extremely helpful. To include, paste them into the markdown editor below the form or follow up with a separate comment.
options:
- General
- ColorPicker
- FancyZones
- FancyZones Editor
- Image Resizer
- Keyboard Manager
- MD Preview
- PowerRename
- PowerToys Run
- Shortcut Guide
- SVG Preview
- SVG Thumbnail
- Settings
- Welcome / PowerToys Tour window
- System tray interaction
- Installer
validations:
required: true
- type: input
attributes:
label: 🌐 Language affected
placeholder: "German"
validations:
required: true
- type: textarea
attributes:
label: ❌ Actual phrase(s)
placeholder: What is there?
validations:
required: true
- type: textarea
attributes:
label: ✔️ Expected phrase(s)
placeholder: What was expected?
validations:
required: true
- type: textarea
attributes:
label: Why is the current translation wrong
placeholder: Why do you feel this is incorrect?
validations:
required: true

View File

@@ -1,3 +1,13 @@
# See https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-excludes
(?:^|/)(?i)COPYRIGHT
(?:^|/)(?i)LICEN[CS]E
(?:^|/)package(?:-lock)\.json$
(?:^|/)vendor/
/package(?:-lock|)\.json$
/pinyindb/
/settings-html/
ignore$
[/.][a-z]{2}(?:-[a-zA-Z]{2}|)\.
\.ai$ \.ai$
\.bmp$ \.bmp$
\.dat$ \.dat$
@@ -7,13 +17,13 @@
\.ico$ \.ico$
\.jpg$ \.jpg$
\.lcl$ \.lcl$
\.lock$
\.min\.
\.mod$
\.pdf$ \.pdf$
\.png$ \.png$
\.PNG$ \.PNG$
\.woff$ \.woff$
\.zip$ \.zip$
^\.github/
^\.github/actions/spell-check/ ^\.github/actions/spell-check/
/package(?:-lock|)\.json$
/pinyindb/
/settings-html/
[/.][a-z]{2}(?:-[a-zA-Z]{2}|)\.

View File

@@ -3,13 +3,10 @@ AAD
abcd abcd
abcdef abcdef
abcdefgh abcdefgh
ABCDEFGHIJKLMNOPQRSTUVWXYZ
abgr abgr
ABlocked ABlocked
Abug Abug
acb
accctrl accctrl
accd
Acceleratorkeys Acceleratorkeys
ACCEPTFILES ACCEPTFILES
accessibile accessibile
@@ -20,13 +17,15 @@ AColumn
acos acos
acrt acrt
Actioncenter Actioncenter
actioned
activatable activatable
ACTIVATEAPP ACTIVATEAPP
activationaction
Addavirtualdesktop Addavirtualdesktop
Addins Addins
addrum
ADDUNDORECORD ADDUNDORECORD
ADifferent ADifferent
ADMINS
adopsinsider adopsinsider
advapi advapi
advfirewall advfirewall
@@ -51,9 +50,10 @@ amd
Amicrosoft Amicrosoft
AMirror AMirror
AModifier AModifier
AMPROPERTY
AMPROPSETID
anges anges
ansicolor ansicolor
ansicpg
antialiased antialiased
ANull ANull
AOC AOC
@@ -121,7 +121,6 @@ aumid
AUTHN AUTHN
AUTOAPPEND AUTOAPPEND
autocomplete autocomplete
autogenerated
autogenerates autogenerates
AUTOHIDE AUTOHIDE
AUTOMATIONPROPERTIES AUTOMATIONPROPERTIES
@@ -131,18 +130,14 @@ autoupdate
AValid AValid
azurecr azurecr
azurewebsites azurewebsites
baae
baccda
backend backend
backtracer backtracer
bak bak
bbe
bbwe bbwe
bc bc
bcc bcc
bck bck
Bcl Bcl
bddac
BEGINLABELEDIT BEGINLABELEDIT
betadele betadele
betsegaw betsegaw
@@ -169,8 +164,10 @@ BLURREGION
bmi bmi
bmp bmp
bms bms
BNumber
Bokm Bokm
BOKMAL BOKMAL
Bools
bootstrapper bootstrapper
BOTTOMALIGN BOTTOMALIGN
BPBF BPBF
@@ -180,9 +177,7 @@ bricelam
BRIGHTGREEN BRIGHTGREEN
Browsable Browsable
bsd bsd
BSODs
bstr bstr
BText
bti bti
Btn Btn
BTNFACE BTNFACE
@@ -202,7 +197,6 @@ Captureascreenshot
CAPTURECHANGED CAPTURECHANGED
CASESENSITIVE CASESENSITIVE
CAtl CAtl
cbfbad
CCDDEE CCDDEE
ccf ccf
cch cch
@@ -210,20 +204,20 @@ CCom
CContext CContext
CDATA CDATA
CDBECF CDBECF
cde
cdecl cdecl
CDeclaration CDeclaration
CDEF
cdpx cdpx
cdpxwin cdpxwin
CENTERALIGN CENTERALIGN
cfg cfg
changecursor cguid
Changemove
charconv charconv
charset charset
chdir chdir
checkbox checkbox
checkboxes checkboxes
CHECKCANCELED
Checkedin Checkedin
checknetisolation checknetisolation
Chicklet Chicklet
@@ -237,7 +231,6 @@ chrono
chrzan chrzan
CHT CHT
CImage CImage
cimv
cinttypes cinttypes
cla cla
clangformat clangformat
@@ -261,12 +254,12 @@ CMDARG
cmder cmder
Cmdlet Cmdlet
cmdline cmdline
Cmds
CMIC CMIC
CMINVOKECOMMANDINFO CMINVOKECOMMANDINFO
CMINVOKECOMMANDINFOEX CMINVOKECOMMANDINFOEX
CMock CMock
CMONITORS CMONITORS
cmpr
cmyk cmyk
cn cn
cnt cnt
@@ -274,13 +267,10 @@ coclass
codebase codebase
codecvt codecvt
codeofconduct codeofconduct
codeql
codereview codereview
Codespaces Codespaces
COINIT COINIT
colorconv colorconv
colorhistory
colorhistorylimit
colorpicker colorpicker
colorpickerref colorpickerref
COLORREF COLORREF
@@ -317,7 +307,6 @@ CONTROLL
CONTROLPARENT CONTROLPARENT
Controlz Controlz
coords coords
copiedcolorrepresentation
COPYDATASTRUCT COPYDATASTRUCT
corehr corehr
cortana cortana
@@ -347,7 +336,6 @@ critsec
crlf crlf
CRM CRM
crmcustomerinsightsapp crmcustomerinsightsapp
cron
CRSEL CRSEL
crutkas crutkas
CSearch CSearch
@@ -370,12 +358,12 @@ ctime
CTLCOLORSTATIC CTLCOLORSTATIC
ctor ctor
CTRLALTDEL CTRLALTDEL
Ctrls
Ctx Ctx
CUI CUI
currentculture currentculture
CURSORINFO CURSORINFO
cursorpos cursorpos
customaction
CUSTOMACTIONTEST CUSTOMACTIONTEST
cvd cvd
cw cw
@@ -427,8 +415,6 @@ DEFAULTTONEAREST
DEFAULTTONULL DEFAULTTONULL
DEFAULTTOPRIMARY DEFAULTTOPRIMARY
DEFERERASE DEFERERASE
deff
deflang
DEFPUSHBUTTON DEFPUSHBUTTON
deinitialization deinitialization
DELA DELA
@@ -453,7 +439,8 @@ DEU
Devagya Devagya
devblogs devblogs
devdocs devdocs
devenv devenum
DEVMON
df df
DFactory DFactory
Dialpad Dialpad
@@ -506,6 +493,7 @@ drivedetectionwarning
DRM DRM
dropdown dropdown
dropref dropref
dshow
dst dst
DSVG DSVG
DText DText
@@ -554,7 +542,7 @@ EBE
EBEC EBEC
EBEE EBEE
EBEF EBEF
ebf EBF
EBFC EBFC
ECAA ECAA
ECAB ECAB
@@ -567,6 +555,7 @@ ECDC
ECDE ECDE
ECDF ECDF
ECEB ECEB
ECED
ECEE ECEE
ecef ecef
ECFE ECFE
@@ -627,7 +616,7 @@ EFBA
EFC EFC
EFDA EFDA
EFDE EFDE
efe EFE
EFEB EFEB
EFFC EFFC
EFFE EFFE
@@ -646,6 +635,7 @@ endregion
Enque Enque
ENTERSIZEMOVE ENTERSIZEMOVE
Entireitemname Entireitemname
Entitlements
entrypoint entrypoint
ENU ENU
enum enum
@@ -709,12 +699,9 @@ FANCYZONESEDITOR
Farbraum Farbraum
FARPROC FARPROC
Favicon Favicon
fcharset
fd fd
fda
feimage feimage
ffcd ffcd
ffd
FFDDDDDD FFDDDDDD
fff fff
figcaption figcaption
@@ -735,17 +722,16 @@ finalizer
findstr findstr
FIXEDFILEINFO FIXEDFILEINFO
FLASHZONES FLASHZONES
FLASHZONESONQUICKSWITCH
Fle Fle
fluentui fluentui
flyout flyout
fmtlib fmtlib
fnil
fody fody
FOF FOF
FOFX FOFX
FOLDERID FOLDERID
folderpath folderpath
fonttbl
FORCEOFFLINE FORCEOFFLINE
foreach foreach
formatetc formatetc
@@ -774,8 +760,6 @@ gdi
gdiplus gdiplus
GDISCALED GDISCALED
generatesqlfromuserquery generatesqlfromuserquery
getancestor
getasynckeystate
GETDISPINFO GETDISPINFO
GETDLGCODE GETDLGCODE
GETEMPTYMARKUP GETEMPTYMARKUP
@@ -793,17 +777,16 @@ githubusercontent
gitignore gitignore
globals globals
gmx gmx
GNumber
google google
GPTR GPTR
grayscale grayscale
GText
gui gui
guiddef guiddef
GUITHREADINFO GUITHREADINFO
GValue GValue
gwl gwl
GWLP GWLP
gwmi
HACCEL HACCEL
hangeul hangeul
hanja hanja
@@ -904,6 +887,7 @@ IAppx
IAsync IAsync
IAuto IAuto
IBackground IBackground
IBase
IBeam IBeam
IBind IBind
icase icase
@@ -918,11 +902,11 @@ IComparer
ICONERROR ICONERROR
ICONINFORMATION ICONINFORMATION
ICONQUESTION ICONQUESTION
Iconsempty
Iconset Iconset
IContext IContext
ICONWARNING ICONWARNING
ICore ICore
ICreate
IData IData
IDCANCEL IDCANCEL
IDD IDD
@@ -968,20 +952,20 @@ Iindex
IInitialize IInitialize
IInput IInput
IInspectable IInspectable
IIO
IItem IItem
IJson IJson
IKs
IList IList
ILogon ILogon
IMAGEHLP IMAGEHLP
imageresizer imageresizer
IMAGERESIZEREXT IMAGERESIZEREXT
imageresizersettings
IMain IMain
IMarkdown IMarkdown
ime ime
imeutil imeutil
img img
IMoniker
IMonitor IMonitor
IMouse IMouse
impl impl
@@ -997,7 +981,7 @@ inheritdoc
ini ini
INITCOMMONCONTROLSEX INITCOMMONCONTROLSEX
INITDIALOG INITDIALOG
INITGUID initguid
inl inl
Inlines Inlines
inorder inorder
@@ -1007,7 +991,6 @@ inout
INPC INPC
inprivate inprivate
inproc inproc
inputdev
INPUTHARDWARE INPUTHARDWARE
INPUTKEYBOARD INPUTKEYBOARD
INPUTLANGCHANGED INPUTLANGCHANGED
@@ -1020,7 +1003,6 @@ INSTALLLOCATION
INSTALLLOGATTRIBUTES INSTALLLOGATTRIBUTES
INSTALLLOGMODE INSTALLLOGMODE
INSTALLMESSAGE INSTALLMESSAGE
installpath
INSTALLPROPERTY INSTALLPROPERTY
INSTALLSTARTMENUSHORTCUT INSTALLSTARTMENUSHORTCUT
INSTALLSTATE INSTALLSTATE
@@ -1047,15 +1029,17 @@ ipc
ipcmanager ipcmanager
ipconfig ipconfig
IPersist IPersist
IPin
IPlugin IPlugin
IPower IPower
ipp ipp
IPreview IPreview
ipreviewhandler
ipreviewhandlertranslateaccelerator ipreviewhandlertranslateaccelerator
ipreviewhandlervisualssetfont ipreviewhandlervisualssetfont
IPrincipal IPrincipal
IProgram IProgram
IProgress
IProperty
IPublic IPublic
IQuery IQuery
IRead IRead
@@ -1074,9 +1058,9 @@ isetting
isfinite isfinite
IShell IShell
ISingle ISingle
ISmart
ismethod ismethod
isocpp isocpp
issuecomment
IStorage IStorage
IStream IStream
istreambuf istreambuf
@@ -1092,7 +1076,6 @@ ith
IThrottled IThrottled
IThumbnail IThumbnail
ITrigger ITrigger
itsme
IUI IUI
IUnknown IUnknown
IUri IUri
@@ -1109,7 +1092,6 @@ IZoom
JArray JArray
jarro jarro
Jarryd Jarryd
javascript
jfif jfif
jgeosdfsdsgmkedfgdfgdfgbkmhcgcflmi jgeosdfsdsgmkedfgdfgdfgbkmhcgcflmi
jjw jjw
@@ -1118,9 +1100,9 @@ jp
jpe jpe
jpeg jpeg
jpg jpg
jsoref
JPN JPN
json json
JSONOf
jsonval jsonval
jsx jsx
junja junja
@@ -1265,6 +1247,7 @@ LVHT
LVIF LVIF
LVIS LVIS
LVN LVN
LVS
LVSIL LVSIL
LWA LWA
lwin lwin
@@ -1273,6 +1256,7 @@ lzw
mailto mailto
MAINICON MAINICON
Mainwindow Mainwindow
majortype
makeappx makeappx
MAKEINTRESOURCE MAKEINTRESOURCE
MAKEINTRESOURCEW MAKEINTRESOURCEW
@@ -1284,6 +1268,7 @@ MAPPEDTOSAMEKEY
MAPTOSAMESHORTCUT MAPTOSAMESHORTCUT
MAPVK MAPVK
Markdig Markdig
MARQUEEPROGRESS
martinchrzan martinchrzan
martinmoene martinmoene
MATCHALLOCCURENCES MATCHALLOCCURENCES
@@ -1291,6 +1276,7 @@ MATCHMODE
MAXIMIZEBOX MAXIMIZEBOX
MAXSHORTCUTSIZE MAXSHORTCUTSIZE
maxversiontested maxversiontested
mayitbeegh
MBUTTON MBUTTON
MBUTTONDBLCLK MBUTTONDBLCLK
MBUTTONDOWN MBUTTONDOWN
@@ -1299,6 +1285,8 @@ Mdb
MDICHILD MDICHILD
MDL MDL
mdpreviewhandler mdpreviewhandler
MEDIASUBTYPE
MEDIATYPE
Melman Melman
memcpy memcpy
memset memset
@@ -1306,7 +1294,6 @@ Mensching
menuitem menuitem
MENUITEMINFO MENUITEMINFO
MENUITEMINFOW MENUITEMINFOW
menurc
messagebox messagebox
messageboxes messageboxes
METACHARSET METACHARSET
@@ -1326,6 +1313,7 @@ miniz
MINMAXINFO MINMAXINFO
Miracast Miracast
mixin mixin
MJPG
mkdir mkdir
MLogo MLogo
MMI MMI
@@ -1360,7 +1348,7 @@ msclr
mscoree mscoree
mscorlib mscorlib
msdata msdata
msdn MSDN
msedge msedge
mshtmdid mshtmdid
msi msi
@@ -1412,7 +1400,7 @@ NCMBUTTONDOWN
NCMBUTTONUP NCMBUTTONUP
NCMOUSELEAVE NCMOUSELEAVE
NCMOUSEMOVE NCMOUSEMOVE
ncol NCol
NCPAINT NCPAINT
NCRBUTTONDBLCLK NCRBUTTONDBLCLK
NCRBUTTONDOWN NCRBUTTONDOWN
@@ -1424,7 +1412,6 @@ NESW
netcore netcore
netcoreapp netcoreapp
netframework netframework
NETFX
netsh netsh
netstandard netstandard
Neue Neue
@@ -1432,8 +1419,7 @@ newcolor
newitem newitem
newpath newpath
newrow newrow
newtonsoft Newtonsoft
nf
niels niels
nielslaute nielslaute
NIF NIF
@@ -1494,7 +1480,6 @@ npmjs
npos npos
NResize NResize
ntdll ntdll
NTFS
NTSTATUS NTSTATUS
nuget nuget
nullopt nullopt
@@ -1525,9 +1510,7 @@ oldpath
oldtheme oldtheme
oleaut oleaut
OLECHAR OLECHAR
oledb OLEDB
oledbcommand
oledbconnection
OLIVEGREEN OLIVEGREEN
OLogo OLogo
Onboarding Onboarding
@@ -1552,15 +1535,12 @@ ostringstream
OSVERSIONINFOEXW OSVERSIONINFOEXW
osx osx
otating otating
ouicompat
OUTOFCONTEXT OUTOFCONTEXT
OUTOFMEMORY OUTOFMEMORY
Outptr Outptr
outro outro
outsettings
OVERLAPPEDWINDOW OVERLAPPEDWINDOW
overlaywindow overlaywindow
owidctlpar
OWNDC OWNDC
PACL PACL
PAINTSTRUCT PAINTSTRUCT
@@ -1577,7 +1557,6 @@ PARENTRELATIVEPARSING
parray parray
PARTIALCONFIRMATIONDIALOGTITLE PARTIALCONFIRMATIONDIALOGTITLE
pathcch pathcch
pavelzw
pb pb
pbc pbc
Pbgra Pbgra
@@ -1610,6 +1589,7 @@ phwnd
pici pici
pid pid
pidl pidl
PINDIR
pinfo pinfo
pinvoke pinvoke
Pipelinhttps Pipelinhttps
@@ -1668,7 +1648,7 @@ PREMULTIPLIED
prevhost prevhost
previewer previewer
PREVIEWGROUP PREVIEWGROUP
previewhandlerframeinfo PREVIEWHANDLERFRAMEINFO
previewpane previewpane
PREVIOUSVERSIONSINSTALLED PREVIOUSVERSIONSINSTALLED
prevpane prevpane
@@ -1678,9 +1658,9 @@ PRINTCLIENT
printf printf
Printfax Printfax
prm prm
proactively
PROCESSKEY PROCESSKEY
PRODUCTVERSION PRODUCTVERSION
PROGDLG
Progman Progman
programdata programdata
PROGRAMFILES PROGRAMFILES
@@ -1689,6 +1669,7 @@ Proj
projectname projectname
propkey propkey
propvarutil propvarutil
prpui
Prt Prt
prui prui
prvpane prvpane
@@ -1725,12 +1706,11 @@ qianlifeng
qit qit
QITAB QITAB
QITABENT QITABENT
qryidx
Queryable Queryable
QUERYENDSESSION QUERYENDSESSION
queryfocus
QUERYOPEN QUERYOPEN
QUEUESYNC QUEUESYNC
QUICKLAYOUTSWITCH
qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm
qword qword
qwrtyuiopsghjklzxvnm qwrtyuiopsghjklzxvnm
@@ -1756,6 +1736,7 @@ READWRITE
RECTDESTINATION RECTDESTINATION
RECTL RECTL
rectp rectp
rects
recyclebin recyclebin
redirectedfrom redirectedfrom
refactor refactor
@@ -1791,16 +1772,15 @@ rescap
resgen resgen
resheader resheader
Resizable Resizable
resizers
resmimetype resmimetype
RESOURCEID RESOURCEID
resourcemanager
RESTORESIZE RESTORESIZE
RESTORETOMAXIMIZED RESTORETOMAXIMIZED
restrictedcapabilities restrictedcapabilities
resultlist resultlist
resw resw
resx resx
returnvalue
retval retval
rexit rexit
rfind rfind
@@ -1812,26 +1792,25 @@ Rgn
rgs rgs
rhs rhs
ricardosantos ricardosantos
Riched
Richtext Richtext
RIGHTSCROLLBAR RIGHTSCROLLBAR
riid riid
riverar riverar
RKey RKey
RMENU RMENU
RNumber
roadmap roadmap
Roboto Roboto
roslyn roslyn
royvou royvou
rpc rpc
RRF RRF
rshift
RSHIFT RSHIFT
rshift
Rsp Rsp
rst rst
Rstrtmgr Rstrtmgr
RTB RTB
RText
rtf rtf
Rtl Rtl
RTLREADING RTLREADING
@@ -1860,7 +1839,6 @@ SAMESHORTCUTPREVIOUSLYMAPPED
SAVEFAILED SAVEFAILED
scancode scancode
scanled scanled
Schd
Scn Scn
SCOPEID SCOPEID
screenshot screenshot
@@ -1872,15 +1850,12 @@ sdk
SDKDDK SDKDDK
searchbox searchbox
SEARCHFOR SEARCHFOR
searchqueryhelper
SEARCHREPLACEGROUP SEARCHREPLACEGROUP
searchterm searchterm
Secur Secur
securityoverview Segoe
segoe
Sekan Sekan
SENDCHANGE SENDCHANGE
sendinput
sendvirtualinput sendvirtualinput
serializationexception serializationexception
serializer serializer
@@ -1892,7 +1867,6 @@ SETFOCUS
SETFOREGROUND SETFOREGROUND
SETICON SETICON
setlocal setlocal
setnt
SETRANGE SETRANGE
Setrect Setrect
SETREDRAW SETREDRAW
@@ -1901,10 +1875,8 @@ SETTEXT
SETTINGCHANGE SETTINGCHANGE
settingsheader settingsheader
settingshotkeycontrol settingshotkeycontrol
settingsui
settingsv settingsv
Setttings Setttings
setwindowpos
SETWORKAREA SETWORKAREA
sfgao sfgao
SFGAOF SFGAOF
@@ -1937,18 +1909,15 @@ SHORTCUTSTARTWITHMODIFIER
Shortcuttool Shortcuttool
shortdate shortdate
SHORTPATH SHORTPATH
showcolorname
SHOWDEFAULT SHOWDEFAULT
SHOWELEVATIONPROMPT SHOWELEVATIONPROMPT
SHOWMAXIMIZED SHOWMAXIMIZED
SHOWMINIMIZED SHOWMINIMIZED
SHOWNA SHOWNA
SHOWNORMAL SHOWNORMAL
showwindow SHOWWINDOW
shtypes shtypes
sid sid
sideload
sideloading
sidepanel sidepanel
siex siex
SIGABRT SIGABRT
@@ -1979,7 +1948,7 @@ sln
SLogo SLogo
SMALLICON SMALLICON
SMTO SMTO
snd Snd
somil somil
SORTDOWN SORTDOWN
SOURCECLIENTAREAONLY SOURCECLIENTAREAONLY
@@ -1990,9 +1959,10 @@ spdth
spec'ing spec'ing
spesi spesi
spinbuttonref spinbuttonref
splitee
splitwstring splitwstring
spoprod spoprod
sppd
sppre
spsi spsi
spsia spsia
spsrif spsrif
@@ -2024,7 +1994,7 @@ STARTUPINFOEX
STARTUPINFOW STARTUPINFOW
startupscreen startupscreen
STATEIMAGEMASK STATEIMAGEMASK
statflag STATFLAG
STATICEDGE STATICEDGE
STATSTG STATSTG
stdafx stdafx
@@ -2054,6 +2024,7 @@ stringify
STRINGIZE STRINGIZE
stringtable stringtable
stringval stringval
Strmiids
strsafe strsafe
strutil strutil
sttngs sttngs
@@ -2091,10 +2062,9 @@ SYSCOLORCHANGE
SYSCOMMAND SYSCOMMAND
SYSDEADCHAR SYSDEADCHAR
SYSICONINDEX SYSICONINDEX
sysinfo
SYSKEY SYSKEY
syskeydown syskeydown
syskeyup SYSKEYUP
syslog syslog
SYSMENU SYSMENU
systemd systemd
@@ -2126,7 +2096,6 @@ tcscpy
TCustom TCustom
td td
TDevice TDevice
technet
Telemarketer Telemarketer
Templated Templated
templatenamespace templatenamespace
@@ -2141,7 +2110,6 @@ textblock
textbox textbox
TEXTINCLUDE TEXTINCLUDE
textref textref
tf
TFVC TFVC
tga tga
thead thead
@@ -2152,9 +2120,11 @@ thre
tif tif
TILEDWINDOW TILEDWINDOW
Timeline Timeline
TIMERID
timeunion timeunion
timeutil timeutil
titlecase titlecase
TLayout
tlb tlb
tlbimp tlbimp
tmp tmp
@@ -2167,7 +2137,6 @@ toggleref
toggleright toggleright
toggleswitch toggleswitch
toolbar toolbar
Toolchain
toolset toolset
tooltip tooltip
toolwindow toolwindow
@@ -2180,7 +2149,6 @@ towupper
tracelogging tracelogging
traies traies
TRAYMOUSEMESSAGE TRAYMOUSEMESSAGE
TRCA
TRK TRK
trl trl
truetype truetype
@@ -2206,10 +2174,8 @@ Tz
UAC UAC
UAL UAL
uap uap
ubuntu
udit udit
UIA UIA
uiauto
Uid Uid
uifabric uifabric
uifabricicons uifabricicons
@@ -2257,7 +2223,6 @@ unremapped
unsubscribe unsubscribe
Unsync Unsync
Untag Untag
upd
Updatelayout Updatelayout
UPDOWNKEYDROPSLIST UPDOWNKEYDROPSLIST
UPGRADINGPRODUCTCODE UPGRADINGPRODUCTCODE
@@ -2306,18 +2271,16 @@ Versioning
VFT VFT
vh vh
vid vid
VIDEOINFOHEADER
viewbox viewbox
viewkind
viewmodel viewmodel
virtualization virtualization
visiblecolorformats
Visibletrue Visibletrue
Visio Visio
visualbrush visualbrush
visualstudio visualstudio
vk vk
VKey VKey
VKTAB
vm vm
vmax vmax
vmin vmin
@@ -2327,6 +2290,7 @@ VREDRAW
VSC VSC
VSCBD VSCBD
vscode vscode
vsconfig
VSCROLL VSCROLL
vse vse
vsonline vsonline
@@ -2355,11 +2319,10 @@ wcslen
wcsncmp wcsncmp
wcsnicmp wcsnicmp
wdp wdp
wds
wdupenv wdupenv
weakme weakme
webapp webapp
Webcam webcam
webclient webclient
webkit webkit
webp webp
@@ -2379,7 +2342,6 @@ wikipedia
wil wil
wildcards wildcards
winapi winapi
winauto
wincolor wincolor
windef windef
windevbuildagents windevbuildagents
@@ -2404,7 +2366,6 @@ Winhook
winkey winkey
WINL WINL
winmd winmd
winmsg
winnt winnt
winres winres
winrt winrt
@@ -2413,9 +2374,8 @@ winsdkver
winspool winspool
winstore winstore
winui winui
winuser
winver
winxamlmanager winxamlmanager
wistd
withinrafael withinrafael
Withscript Withscript
wix wix
@@ -2450,7 +2410,6 @@ wprintf
wprp wprp
wregex wregex
WResize WResize
wrl
wsf wsf
wsh wsh
wsl wsl
@@ -2461,7 +2420,6 @@ wstringstream
wsz wsz
WTS WTS
WTSAT WTSAT
wtypes
wu wu
Wwan Wwan
www www
@@ -2472,7 +2430,6 @@ xaml
XAngle XAngle
XAttribute XAttribute
xbf xbf
XBind
XBUTTON XBUTTON
XBUTTONDBLCLK XBUTTONDBLCLK
XBUTTONDOWN XBUTTONDOWN
@@ -2498,7 +2455,7 @@ XStr
XToolset XToolset
xunit xunit
XY XY
yaml Yaml
YAngle YAngle
YDiff YDiff
YESNO YESNO
@@ -2507,7 +2464,10 @@ yinwang
YLogo YLogo
yml yml
YOffset YOffset
YourUserName
YStr YStr
YUY
YUYV
yy yy
Zc Zc
ZEROINIT ZEROINIT

View File

@@ -1,11 +1,25 @@
# See https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-patterns
https?://(?:(?:www\.|)youtube\.com|youtu.be)/[-a-zA-Z0-9?&=]* https?://(?:(?:www\.|)youtube\.com|youtu.be)/[-a-zA-Z0-9?&=]*
# GitHub SHAs
\bapi.github\.com/repos/[^/]+/[^/]+/[^/]+/[0-9a-f]+\b
://github\.(?:com|blog)/[^\w")]+ ://github\.(?:com|blog)/[^\w")]+
(?:\[[0-9a-f]+\]\(https:/|)/github\.com/[^/]+/[^/]+/[^/]+/[0-9a-f]+(?:[-0-9a-zA-Z/#.]*|)\b
# githubusercontent
://githubusercontent\.com/[^\w")]+ ://githubusercontent\.com/[^\w")]+
# gist github
/gist\.github\.com/[^/]+/[0-9a-f]+
# msdn
\b(?:download\.visualstudio|docs|msdn)\.microsoft\.com/[-_a-zA-Z0-9()=./]*
data:[a-zA-Z=;,/0-9+-]+ data:[a-zA-Z=;,/0-9+-]+
0x[0-9a-fA-F](?:\.[0-9a-fA-F]*|)[pP] 0x[0-9a-fA-F](?:\.[0-9a-fA-F]*|)[pP]
(?:0[Xx]|U\+|#)[a-f0-9A-FGgRr]{2,}[Uu]?[Ll]{0,2}\b (?:0[Xx]|U\+|#)[a-f0-9A-FGgRr]{2,}[Uu]?[Ll]{0,2}\b
[{"][0-9a-fA-F]{8}-(?:[0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}[}"] # uuid:
\b([A-Za-z])\1{3,}\b [-<({"'>][0-9a-fA-F]{8}-(?:[0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}[<'"})>]
# ignore long runs of a single character:
\b([A-Za-z])\g{-1}{3,}\b
(?:L"[abAB]+", ){3}L"[abAB]+" (?:L"[abAB]+", ){3}L"[abAB]+"
"Lorem[^"]+?\." "Lorem[^"]+?\."
TestCase\("[^"]+" TestCase\("[^"]+"
@@ -45,3 +59,5 @@ TestCase\("[^"]+"
# marker for ignoring a comment to the end of the line # marker for ignoring a comment to the end of the line
^.*/\* #no-spell-check-line \*/.*$ ^.*/\* #no-spell-check-line \*/.*$
// #no-spell-check.*$ // #no-spell-check.*$
http://tes/

View File

@@ -1,20 +1,24 @@
name: Spell checking name: Spell checking
on: on:
pull_request_target:
push: push:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '15 * * * *'
jobs: jobs:
build: build:
name: Spell checking name: Spell checking
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2.0.0 - name: checkout-merge
if: "contains(github.event_name, 'pull_request')"
uses: actions/checkout@v2.0.0
with:
ref: refs/pull/${{github.event.pull_request.number}}/merge
fetch-depth: 5
- name: checkout
if: "!contains(github.event_name, 'pull_request')"
uses: actions/checkout@v2.0.0
with: with:
fetch-depth: 5 fetch-depth: 5
- uses: check-spelling/check-spelling@0.0.16-alpha - uses: check-spelling/check-spelling@0.0.17-alpha
env: with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} config: .github/actions/spell-check
bucket: .github/actions
project: spell-check

2
.gitignore vendored
View File

@@ -342,3 +342,5 @@ src/common/Telemetry/*.etl
!**/MergeModules/Release/ !**/MergeModules/Release/
!**/MergeModules/Debug/ !**/MergeModules/Debug/
/src/modules/previewpane/SvgThumbnailProvider/$(SolutionDir)$(Platform)/$(Configuration)/modules/FileExplorerPreview/SvgThumbnailProvider.xml /src/modules/previewpane/SvgThumbnailProvider/$(SolutionDir)$(Platform)/$(Configuration)/modules/FileExplorerPreview/SvgThumbnailProvider.xml
/src/modules/powerrename/ui/RCa24464
/src/modules/powerrename/ui/RCb24464

View File

@@ -7,4 +7,3 @@ set SolutionDir=%cd%
popd popd
SET IsPipeline=1 SET IsPipeline=1
call msbuild ../tools/BugReportTool/BugReportTool.sln /p:Configuration=Release /p:Platform=x64 /p:CIBuild=true || exit /b 1 call msbuild ../tools/BugReportTool/BugReportTool.sln /p:Configuration=Release /p:Platform=x64 /p:CIBuild=true || exit /b 1

View File

@@ -55,6 +55,25 @@ steps:
msbuildArgs: ${{ parameters.additionalBuildArguments }} msbuildArgs: ${{ parameters.additionalBuildArguments }}
maximumCpuCount: true maximumCpuCount: true
- task: NuGetCommand@2
displayName: Restore NuGet packages for WebcamReportTool.sln
inputs:
command: restore
feedsToUse: config
configPath: NuGet.config
restoreSolution: tools\WebcamReportTool\WebcamReportTool.sln
restoreDirectory: '$(Build.SourcesDirectory)\tools\WebcamReportTool\packages'
- task: VSBuild@1
displayName: 'Build WebcamReportTool.sln'
inputs:
solution: '**\WebcamReportTool.sln'
vsVersion: 16.0
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
msbuildArgs: ${{ parameters.additionalBuildArguments }}
maximumCpuCount: true
- task: NuGetCommand@2 - task: NuGetCommand@2
displayName: Restore NuGet packages for PowerToysSetup.sln displayName: Restore NuGet packages for PowerToysSetup.sln
inputs: inputs:
@@ -93,40 +112,52 @@ steps:
msbuildArgs: ${{ parameters.additionalBuildArguments }} msbuildArgs: ${{ parameters.additionalBuildArguments }}
maximumCpuCount: true maximumCpuCount: true
# directly not doing WinAppDriver testing # directly not doing WinAppDriver testing
- task: VSTest@2 - task: VSTest@2
displayName: 'Run .Net Core Tests 1' displayName: 'MS Tests'
inputs: inputs:
platform: '$(BuildPlatform)' platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)' configuration: '$(BuildConfiguration)'
testSelector: 'testAssemblies' testSelector: 'testAssemblies'
testAssemblyVer2: | testAssemblyVer2: |
**\Microsoft.Plugin.Folder.UnitTest.dll **\UnitTests-SvgThumbnailProvider.dll
**\Microsoft.PowerToys.Settings.UI.UnitTests.dll
**\UnitTests-SvgPreviewHandler.dll
**\UnitTests-PreviewHandlerCommon.dll
**\PreviewPaneUnitTests.dll
**\Microsoft.PowerToys.Run.Plugin.Registry.UnitTests.dll
**\UnitTest-ColorPickerUI.dll
**\Microsoft.Interop.Tests.dll
!**\obj\**
- task: VSTest@2
displayName: 'XUnit Tests'
inputs:
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
testSelector: 'testAssemblies'
testAssemblyVer2: |
**\ImageResizer.Test.dll
!**\obj\**
- task: VSTest@2
displayName: 'NUnit Tests'
inputs:
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
testSelector: 'testAssemblies'
testAssemblyVer2: |
**\Microsoft.Plugin.Folder.UnitTests.dll
**\Microsoft.Plugin.Program.UnitTests.dll **\Microsoft.Plugin.Program.UnitTests.dll
**\Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest.dll **\Microsoft.PowerToys.Run.Plugin.Calculator.UnitTest.dll
**\Microsoft.Plugin.Uri.UnitTests.dll **\Microsoft.Plugin.Uri.UnitTests.dll
**\Wox.Test.dll **\Wox.Test.dll
**\Microsoft.PowerToys.Settings.UI.UnitTests.dll **\Microsoft.PowerToys.Run.Plugin.System.UnitTests.dll
**\UnitTest-ColorPickerUI.dll
**\Microsoft.Interop.Tests.dll
!**\obj\**
- task: VSTest@2
displayName: 'Run .Net Core Tests 2'
inputs:
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
testSelector: 'testAssemblies'
testAssemblyVer2: |
**\PreviewPaneUnitTests.dll #this is the markdown tests
**\UnitTests-PreviewHandlerCommon.dll
**\UnitTests-SvgPreviewHandler.dll
**\ImageResizer.Test.dll
**\powerpreviewTest.dll
!**\obj\** !**\obj\**
# Native dlls # Native dlls
- task: VSTest@2 - task: VSTest@2
displayName: 'Run Native Tests' displayName: 'Native Tests'
inputs: inputs:
platform: '$(BuildPlatform)' platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)' configuration: '$(BuildConfiguration)'
@@ -135,4 +166,5 @@ steps:
**\KeyboardManagerTest.dll **\KeyboardManagerTest.dll
**\UnitTests-CommonLib.dll **\UnitTests-CommonLib.dll
**\PowerRenameUnitTests.dll **\PowerRenameUnitTests.dll
**\powerpreviewTest.dll
!**\obj\** !**\obj\**

View File

@@ -150,7 +150,6 @@ build:
- 'os-detection.dll' - 'os-detection.dll'
- 'PowerToys.exe' - 'PowerToys.exe'
- 'PowerToysInterop.dll' - 'PowerToysInterop.dll'
- 'PowerToysSettings.exe'
- 'Settings\Microsoft.PowerToys.Settings.UI.exe' - 'Settings\Microsoft.PowerToys.Settings.UI.exe'
- 'Settings\Microsoft.PowerToys.Settings.UI.Lib.dll' - 'Settings\Microsoft.PowerToys.Settings.UI.Lib.dll'
- 'Settings\PowerToys.Settings.dll' - 'Settings\PowerToys.Settings.dll'

15
.vsconfig Normal file
View File

@@ -0,0 +1,15 @@
{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Component.CoreEditor",
"Microsoft.VisualStudio.Workload.CoreEditor",
"Microsoft.VisualStudio.Workload.NativeDesktop",
"Microsoft.VisualStudio.Workload.ManagedDesktop",
"Microsoft.VisualStudio.Workload.Universal",
"Microsoft.VisualStudio.Component.Windows10SDK.17134",
"Microsoft.VisualStudio.Component.Windows10SDK.18362",
"Microsoft.VisualStudio.ComponentGroup.UWP.VC",
"Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre",
"Microsoft.VisualStudio.Component.VC.ATL.Spectre"
]
}

File diff suppressed because it is too large Load Diff

View File

@@ -24,8 +24,9 @@ Microsoft PowerToys is a set of utilities for power users to tune and streamline
### Requirements ### Requirements
- Windows 10 v1903 (build 18362) or better preferred, Windows 10 v1803 (build 17134) minimum. - Windows 10 v1903 (build 18362) or newer preferred, Windows 10 v1803 (build 17134) minimum.
- Have [.NET Core 3.1 Desktop Runtime](https://dotnet.microsoft.com/download/dotnet-core/thank-you/runtime-desktop-3.1.11-windows-x64-installer). The installer should handle this but we want to directly make people aware. - ⚠️ PowerToys minimum version of Windows 10 will be increased to v1903 starting with the 0.37 release
- Have [.NET Core 3.1.13 Desktop Runtime](https://dotnet.microsoft.com/download/dotnet-core/thank-you/runtime-desktop-3.1.13-windows-x64-installer). The installer should handle this but we want to directly make people aware.
### Via GitHub with EXE [Recommended] ### Via GitHub with EXE [Recommended]
@@ -41,7 +42,7 @@ To install the Video Conference mute, please use the [v0.28 pre-release experime
We hope to have an updated version in February 2021 with the new DirectShow driver. We hope to have an updated version in February 2021 with the new DirectShow driver.
### Via WinGet (Preview) ### Via WinGet (Preview)
Download PowerToys from [WinGet](https://github.com/microsoft/winget-cli/releases). To install PowerToys, run the following command from the command line / PowerShell: Download PowerToys from [WinGet](https://github.com/microsoft/winget-cli#installing-the-client). To install PowerToys, run the following command from the command line / PowerShell:
```powershell ```powershell
WinGet install powertoys WinGet install powertoys
@@ -75,65 +76,71 @@ 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. Our [prioritized roadmap][roadmap] of features and utilities that the core team is focusing on.
### 0.33 - February 2021 Update ### 0.35 - March 2021 Update
Our goals for [v0.33 release cycle][github-release-link] was to add in some critical new functionality into the new user experience as well as a plug-in manager for PowerToys Run. In addition, we feel we are near ready to add in Video Conference mute into the stable release pending feedback from the pending 0.34 experimental release. The 0.34 experimental release will happen week of March 8th toward the end of the week pending testing. Our goals for the [v0.35 release cycle][github-release-link] were to add in new functionality to support quick swapping layouts for FancyZones, wrap up work for the DirectShow migration for Video Conference Mute so we can migrate into the main dev branch as well as fixing bugs. The 0.36 experimental release will happen the week of April 5th toward the end of the week pending testing. Throughout these efforts, we continue working towards stability across all PowerToys utilities.
Our [prioritized roadmap][roadmap] of features and utilities that the core team is focusing on for the near future. We fixed a lot of localization issues from our initial release but we may not still be perfect. If you find an issue, please file a [localization bug][loc-bug]. Our [prioritized roadmap][roadmap] of features and utilities will dictate what the core team is focusing on for the near future.
#### Highlights from v0.33 Stable/0.34 Experimental #### Highlights from v0.35 Stable/0.36 Experimental
**General** **General**
- Updated overview links to be language agnostic to the docs site. - PowerToys will start requiring Windows 10 v1903 or greater after 0.35.x release. The v1 settings, which supports older Windows versions, will be removed in 0.37.
- 'First time load' experience. The hope is a quick, light way to learn about basic functionality. We have some more work to do and want to also use the same framework for teaching about updates as well. - Note: We may be able to bring back support when we migrate to WinUI3 but as of now, we will be increasing the minimum version of Windows to 1903 or greater.
- Localization corrections - Localization corrections
- Improved GitHub report bug template.
- Increased .NET Core to 3.1.13
- Fixed installer 'run as user' regression
**Color Picker**
- UX adjustments to editor. Thanks [@niels9001](https://github.com/niels9001)!
- `Esc` can now be used to exit the editor. Thanks [@BenConstable9](https://github.com/BenConstable9)!
**FancyZones** **FancyZones**
- Adjusted editor UX based on feedback. Thanks [@niels9001](https://github.com/niels9001)! - Added hotkeys and quick swap functionality for custom layouts! Users can now assign a hotkey in the editor and use it to quickly set a desktop's zones with `Ctrl + Win + Alt + NUMBER` key binding, or by pressing the hotkey while dragging a window.
- New options to change zone activation algorithm. - UX updates. Thanks [@niels9001](https://github.com/niels9001)!
- Fixed zone placement algorithm for when the Taskbar is vertical
**File Explorer** - Bug fixes
- Improved how SVG images are previewed in the preview pane, thanks[@Drakula44](https://github.com/Drakula44)!
- [@Aaron-Junker](Aaron-Junker) has created a proof of concept for using [Monaco editor](https://github.com/microsoft/monaco-editor) for previewing dev files. This will enable over 125+ file types.
**PowerToys Run** **PowerToys Run**
- Plugin Manager now is in settings. You can directly turn on / off, include items in general search, and change the action key! Thanks [@htcfreek](https://github.com/htcfreek) for the great feedback! - Users can specify where to show the launcher window. Thanks [@addrum](https://github.com/addrum)!
- Improved support for additional window managers by abstracting out shell process calls. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! - New plugin added to support opening previously used Visual Studio Code workspaces, remote machines (SSH or Codespaces), and containers! When enabled, use `{` to query for available workspaces. Thanks [@ricardosantos9521](https://github.com/ricardosantos9521)! Please note, this plugin is off by default.
- Fix for PT Run registering the hotkey on non-supported OS versions. - Shell history now saves the raw command instead of the resolved command. A command like `%appdata%` would now save in the Shell history as is instead of `C:\Users\YourUserName\AppData\Roaming`. Thanks [@mayitbeegh](https://github.com/mayitbeegh)!
- `~` will now act as the user home directory in Folder plugin. Thanks [@davidegiacometti](https://github.com/davidegiacometti) - Better logging to try to track down some bugs
- Service plugin has adjusted status messages - Bug fixes
**Video Conference Mute (Experimental)** **Video Conference Mute (Experimental)**
- Adjust video muting to leverage DirectShow. - Tracking work remaining at issue [#7944](https://github.com/microsoft/PowerToys/issues/7944)
- Goal is to have 0.34 experimental release week of March 8th. - Goal is to have 0.36 experimental release week of April 5th (Yes, we've stated this before, we know)
**Settings** **Contributor workflow**
- When restarting as admin, the settings now will reopen. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! - Main project now has a vsconfig which will prompt you to install needed items versus having to use a script. This will aid in keeping you up-to-date when something changes.
- Updated spell checker. Thanks [@jsoref](https://github.com/jsoref)!
**ARM64 Progress**
- Investigation on how we'll accomplish Settings with the XAML Island and WPF app.
#### Community contributions #### Community contributions
We'd like to directly mention (in alphabetical order) for their continued community support this month and helping directly make PowerToys a better piece of software. We'd like to directly mention (in alphabetical order) for their continued community support this month and helping directly make PowerToys a better piece of software.
[@Aaron-Junker](https://github.com/Aaron-Junker), [@Aaron-Junker](https://github.com/Aaron-Junker),
[@davidegiacometti](https://github.com/davidegiacometti), [@addrum](https://github.com/addrum),
[@Drakula44](https://github.com/Drakula44), [@BenConstable9](https://github.com/BenConstable9),
[@htcfreek](https://github.com/htcfreek), [@htcfreek](https://github.com/htcfreek),
[@Jay-o-Way](https://github.com/Jay-o-Way), [@Jay-o-Way](https://github.com/Jay-o-Way),
[@jsoref](https://github.com/jsoref),
[@mayitbeegh](https://github.com/mayitbeegh),
[@niels9001](https://github.com/niels9001), [@niels9001](https://github.com/niels9001),
[@pc-v2](https://github.com/pc-v2),
and and
[@notDevagya](https://github.com/notDevagya) [@ricardosantos9521](https://github.com/ricardosantos9521)
#### What is being planned for v0.35 - March 2021 #### What is being planned for v0.37 - April 2021
For [v0.35][github-next-release-work], we are planning to work on: For [v0.37][github-next-release-work], we are planning to work on:
- Stability and bug fixes - Stability and bug fixes
- FZ Editor hotkey layout swap support - Adding VCM to the stable release
- Integrating VCM in main release - Removing v1 Settings / PT minimum version will become Windows 10 v1903
- Start process for removal support for old settings system and migrating our minimum OS version to Windows 10 1903. - Post-update guidance prompt work
## PowerToys Community ## PowerToys Community
@@ -158,5 +165,5 @@ The application logs basic telemetry. Our Telemetry Data page (Coming Soon) has
[usingPowerToys-docs-link]: https://docs.microsoft.com/windows/powertoys/ [usingPowerToys-docs-link]: https://docs.microsoft.com/windows/powertoys/
<!-- items that need to be updated release to release --> <!-- items that need to be updated release to release -->
[github-next-release-work]: https://github.com/microsoft/PowerToys/issues?q=is%3Aopen+is%3Aissue+project%3Amicrosoft%2FPowerToys%2F18 [github-next-release-work]: https://github.com/microsoft/PowerToys/issues?q=is%3Aopen+is%3Aissue+project%3Amicrosoft%2FPowerToys%2F19
[github-prerelease-link]: https://github.com/microsoft/PowerToys/releases/tag/v0.28.0 [github-prerelease-link]: https://github.com/microsoft/PowerToys/releases/tag/v0.28.0

View File

@@ -64,28 +64,7 @@ Various tools used by PowerToys. Includes the Visual Studio 2019 project templat
1. Windows 10 April 2018 Update (version 1803) or newer 1. Windows 10 April 2018 Update (version 1803) or newer
2. Visual Studio Community/Professional/Enterprise 2019 2. Visual Studio Community/Professional/Enterprise 2019
3. Run the command below in cmd/terminal to install all the workloads and components for VS. 3. Once you've cloned and started the `PowerToys.sln`, in the solution explorer, if you see a dialog that says `install extra components`, click `install`
```shell
cd "%ProgramFiles(x86)%\Microsoft Visual Studio\2019"
SET targetFolder="\"
IF EXIST Preview\NUL (SET targetFolder=Preview)
IF EXIST Enterprise\NUL (SET targetFolder=Enterprise)
IF EXIST Professional\NUL (SET targetFolder=Professional)
IF EXIST Community\NUL (SET targetFolder=Community)
ECHO %targetFolder%
"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vs_installer.exe" ^
modify --installpath "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\%targetFolder%" ^
--add Microsoft.VisualStudio.Workload.NativeDesktop ^
--add Microsoft.VisualStudio.Workload.ManagedDesktop ^
--add Microsoft.VisualStudio.Workload.Universal ^
--add Microsoft.VisualStudio.Component.Windows10SDK.17134 ^
--add Microsoft.VisualStudio.ComponentGroup.UWP.VC ^
--add Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre ^
--add Microsoft.VisualStudio.Component.VC.ATL.Spectre
```
### Compile source code ### Compile source code
@@ -101,25 +80,37 @@ Our installer is two parts, an EXE and an MSI. The EXE (Bootstrapper) contains
The installer can only be compiled in `Release` mode, step 1 and 2 must be done before the MSI will be able to be compiled. The installer can only be compiled in `Release` mode, step 1 and 2 must be done before the MSI will be able to be compiled.
1. Compile PowerToys.sln. Instructions are listed above. 1. Compile `PowerToys.sln`. Instructions are listed above.
2. Compile Bug reporting tool. Path from root: `tools\BugReportTool\BugReportTool.sln` (details listed below) 2. Compile `BugReportTool.sln` tool. Path from root: `tools\BugReportTool\BugReportTool.sln` (details listed below)
3. Compile PowerToysSetup.sln Path from root: `installer\PowerToysSetup.sln` (details listed below) 3. Compile `PowerToysSetup.sln` Path from root: `installer\PowerToysSetup.sln` (details listed below)
4. Compile `PowerToysBootstrapper.sln` Path from root: `installer\PowerToysBootstrapper\PowerToysBootstrapper.sln` (details listed below)
### Prerequisites for building the MSI installer ### Prerequisites for building the MSI installer
1. Build `tools\BugReportTool\BugReportTool.sln`: in Visual Studio, in the `Solutions Configuration` drop-down menu select `Release`, from the `Build` menu choose `Build Solution`. 1. Install the [WiX Toolset Visual Studio 2019 Extension](https://marketplace.visualstudio.com/items?itemName=RobMensching.WiXToolset).
2. Install the [WiX Toolset Visual Studio 2019 Extension](https://marketplace.visualstudio.com/items?itemName=RobMensching.WiXToolset). 2. Install the [WiX Toolset build tools](https://wixtoolset.org/releases/).
3. Install the [WiX Toolset build tools](https://wixtoolset.org/releases/).
### Locally compiling the Bug reporting tool
1. Open `tools\BugReportTool\BugReportTool.sln`
1. In Visual Studio, in the `Solutions Configuration` drop-down menu select `Release`
2. From the `Build` menu, choose `Build Solution`.
### Locally compiling the .MSI installer ### Locally compiling the .MSI installer
- Open `installer\PowerToysSetup.sln`: in Visual Studio, in the `Solutions Configuration` drop-down menu select `Release`, from the `Build` menu choose `Build Solution`. 1. Open `installer\PowerToysSetup.sln`
- The resulting `PowerToysSetup.msi` installer will be available in the `installer\PowerToysSetup\x64\Release\` folder. 2. In Visual Studio, in the `Solutions Configuration` drop-down menu select `Release`
3. From the `Build` menu choose `Build Solution`.
The resulting `PowerToysSetup.msi` installer will be available in the `installer\PowerToysSetup\x64\Release\` folder.
### Locally compiling the .EXE Bootstrapper installer ### Locally compiling the .EXE Bootstrapper installer
- Open `installer\PowerToysBootstrapper\PowerToysBootstrapper.sln`: in Visual Studio, in the `Solutions Configuration` drop-down menu select `Release`, from the `Build` menu choose `Build Solution`. 1. Open `installer\PowerToysBootstrapper\PowerToysBootstrapper.sln`
- The `PowerToysSetup-0.0.1-x64.exe` binary is created in the `installer\PowerToysBootstrapper\x64\Release\` folder. 2. In Visual Studio, in the `Solutions Configuration` drop-down menu select `Release`
3. From the `Build` menu choose `Build Solution`.
The `PowerToysSetup-0.0.1-x64.exe` binary is created in the `installer\PowerToysBootstrapper\x64\Release\` folder.
#### Supported arguments for the .EXE Bootstrapper installer #### Supported arguments for the .EXE Bootstrapper installer

Binary file not shown.

Before

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 273 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

View File

@@ -158,4 +158,7 @@
<data name="NEWER_VERSION_ERROR" xml:space="preserve"> <data name="NEWER_VERSION_ERROR" xml:space="preserve">
<value>A newer version is already installed.</value> <value>A newer version is already installed.</value>
</data> </data>
<data name="OLD_WINDOWS_ERROR" xml:space="preserve">
<value>PowerToys requires Windows 10 version 1903 (May 2019 Update) or newer to run.</value>
</data>
</root> </root>

View File

@@ -12,6 +12,7 @@
#include <common/utils/resources.h> #include <common/utils/resources.h>
#include <common/utils/window.h> #include <common/utils/window.h>
#include <common/utils/winapi_error.h> #include <common/utils/winapi_error.h>
#include <common/SettingsAPI/settings_helpers.h>
#include <runner/action_runner_utils.h> #include <runner/action_runner_utils.h>
@@ -79,6 +80,27 @@ void SetupLogger(fs::path directory, const spdlog::level::level_enum severity)
} }
} }
void CleanupSettingsFromOlderVersions()
{
try
{
const auto logSettingsFile = fs::path{ PTSettingsHelper::get_root_save_folder_location() } / PTSettingsHelper::log_settings_filename;
if (fs::is_regular_file(logSettingsFile))
{
fs::remove(logSettingsFile);
spdlog::info("Removed old log settings file");
}
else
{
spdlog::info("Old log settings file wasn't found");
}
}
catch(...)
{
spdlog::error("Failed to cleanup old log settings");
}
}
void ShowMessageBoxError(const wchar_t* message) void ShowMessageBoxError(const wchar_t* message)
{ {
if (!g_Silent) if (!g_Silent)
@@ -152,8 +174,6 @@ int Bootstrapper(HINSTANCE hInstance)
const auto installDirArg = cmdArgs["install_dir"].as<std::string>(); const auto installDirArg = cmdArgs["install_dir"].as<std::string>();
const bool extract_msi_only = cmdArgs["extract_msi"].as<bool>(); const bool extract_msi_only = cmdArgs["extract_msi"].as<bool>();
spdlog::level::level_enum severity = spdlog::level::off;
std::wstring installFolderProp; std::wstring installFolderProp;
if (!installDirArg.empty()) if (!installDirArg.empty())
{ {
@@ -185,6 +205,7 @@ int Bootstrapper(HINSTANCE hInstance)
{ {
} }
spdlog::level::level_enum severity = spdlog::level::off;
if (logLevel == "debug") if (logLevel == "debug")
{ {
severity = spdlog::level::debug; severity = spdlog::level::debug;
@@ -197,6 +218,16 @@ int Bootstrapper(HINSTANCE hInstance)
SetupLogger(logDir, severity); SetupLogger(logDir, severity);
spdlog::debug("PowerToys Bootstrapper is launched\nnoFullUI: {}\nsilent: {}\nno_start_pt: {}\nskip_dotnet_install: {}\nlog_level: {}\ninstall_dir: {}\nextract_msi: {}\n", noFullUI, g_Silent, noStartPT, skipDotnetInstall, logLevel, installDirArg, extract_msi_only); spdlog::debug("PowerToys Bootstrapper is launched\nnoFullUI: {}\nsilent: {}\nno_start_pt: {}\nskip_dotnet_install: {}\nlog_level: {}\ninstall_dir: {}\nextract_msi: {}\n", noFullUI, g_Silent, noStartPT, skipDotnetInstall, logLevel, installDirArg, extract_msi_only);
const VersionHelper myVersion(VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION);
// Do not support installing on Windows < 1903
if (myVersion >= VersionHelper{0, 36, 0} && updating::is_old_windows_version())
{
ShowMessageBoxError(IDS_OLD_WINDOWS_ERROR);
spdlog::error("PowerToys {} requires at least Windows 1903 to run.", myVersion.toString());
return 1;
}
// If a user requested an MSI -> extract it and exit // If a user requested an MSI -> extract it and exit
if (extract_msi_only) if (extract_msi_only)
{ {
@@ -212,7 +243,6 @@ int Bootstrapper(HINSTANCE hInstance)
} }
// Check if there's a newer version installed // Check if there's a newer version installed
const VersionHelper myVersion(VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION);
const auto installedVersion = updating::get_installed_powertoys_version(); const auto installedVersion = updating::get_installed_powertoys_version();
if (installedVersion && *installedVersion >= myVersion) if (installedVersion && *installedVersion >= myVersion)
{ {
@@ -372,6 +402,8 @@ int Bootstrapper(HINSTANCE hInstance)
ShowMessageBoxError(IDS_DOTNET_INSTALL_ERROR); ShowMessageBoxError(IDS_DOTNET_INSTALL_ERROR);
} }
CleanupSettingsFromOlderVersions();
// At this point, there's no reason to show progress bar window, since MSI installers have their own // At this point, there's no reason to show progress bar window, since MSI installers have their own
CloseProgressBarDialog(); CloseProgressBarDialog();

View File

@@ -283,6 +283,15 @@
</Str> </Str>
<Disp Icon="Str" /> <Disp Icon="Str" />
</Item> </Item>
<Item ItemId=";OLD_WINDOWS_ERROR" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[PowerToys requires Windows 10 version 1903 (May 2019 Update) or newer to run.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Aby se sada PowerToys dala spustit, vyžaduje Windows 10 verze 1903 (aktualizace z května 2019) nebo novější.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true"> <Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text"> <Str Cat="Text">
<Val><![CDATA[Snooze]]></Val> <Val><![CDATA[Snooze]]></Val>

View File

@@ -283,6 +283,15 @@
</Str> </Str>
<Disp Icon="Str" /> <Disp Icon="Str" />
</Item> </Item>
<Item ItemId=";OLD_WINDOWS_ERROR" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[PowerToys requires Windows 10 version 1903 (May 2019 Update) or newer to run.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[PowerToys erfordert zur Ausführung Windows 10, Version 1903 (May 2019 Update) oder höher.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true"> <Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text"> <Str Cat="Text">
<Val><![CDATA[Snooze]]></Val> <Val><![CDATA[Snooze]]></Val>

View File

@@ -283,6 +283,15 @@
</Str> </Str>
<Disp Icon="Str" /> <Disp Icon="Str" />
</Item> </Item>
<Item ItemId=";OLD_WINDOWS_ERROR" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[PowerToys requires Windows 10 version 1903 (May 2019 Update) or newer to run.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[PowerToys requiere Windows 10 versión 1903 (actualización de mayo de 2019) o posterior para ejecutarse.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true"> <Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text"> <Str Cat="Text">
<Val><![CDATA[Snooze]]></Val> <Val><![CDATA[Snooze]]></Val>

View File

@@ -283,6 +283,15 @@
</Str> </Str>
<Disp Icon="Str" /> <Disp Icon="Str" />
</Item> </Item>
<Item ItemId=";OLD_WINDOWS_ERROR" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[PowerToys requires Windows 10 version 1903 (May 2019 Update) or newer to run.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[PowerToys nécessite Windows 10 version 1903 (mise à jour de mai 2019) ou plus récent pour s'exécuter.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true"> <Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text"> <Str Cat="Text">
<Val><![CDATA[Snooze]]></Val> <Val><![CDATA[Snooze]]></Val>

View File

@@ -283,6 +283,15 @@
</Str> </Str>
<Disp Icon="Str" /> <Disp Icon="Str" />
</Item> </Item>
<Item ItemId=";OLD_WINDOWS_ERROR" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[PowerToys requires Windows 10 version 1903 (May 2019 Update) or newer to run.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[A PowerToys futtatásához a Windows 10 legalább 1903-as verziója (2019. májusi frissítés) szükséges.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true"> <Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text"> <Str Cat="Text">
<Val><![CDATA[Snooze]]></Val> <Val><![CDATA[Snooze]]></Val>

View File

@@ -283,6 +283,15 @@
</Str> </Str>
<Disp Icon="Str" /> <Disp Icon="Str" />
</Item> </Item>
<Item ItemId=";OLD_WINDOWS_ERROR" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[PowerToys requires Windows 10 version 1903 (May 2019 Update) or newer to run.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[PowerToys richiede Windows 10 versione 1903 (aggiornamento di maggio 2019) o versione successiva.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true"> <Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text"> <Str Cat="Text">
<Val><![CDATA[Snooze]]></Val> <Val><![CDATA[Snooze]]></Val>

View File

@@ -283,6 +283,15 @@
</Str> </Str>
<Disp Icon="Str" /> <Disp Icon="Str" />
</Item> </Item>
<Item ItemId=";OLD_WINDOWS_ERROR" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[PowerToys requires Windows 10 version 1903 (May 2019 Update) or newer to run.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Powertoy を実行するには、Windows 10 バージョン 1903 (2019 年 5 月の更新プログラム) 以降が必要です。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true"> <Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text"> <Str Cat="Text">
<Val><![CDATA[Snooze]]></Val> <Val><![CDATA[Snooze]]></Val>

View File

@@ -283,6 +283,15 @@
</Str> </Str>
<Disp Icon="Str" /> <Disp Icon="Str" />
</Item> </Item>
<Item ItemId=";OLD_WINDOWS_ERROR" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[PowerToys requires Windows 10 version 1903 (May 2019 Update) or newer to run.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[PowerToys를 사용하려면 Windows 10 버전 1903(2019년 5월 업데이트) 이상을 실행해야 합니다.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true"> <Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text"> <Str Cat="Text">
<Val><![CDATA[Snooze]]></Val> <Val><![CDATA[Snooze]]></Val>

View File

@@ -283,6 +283,15 @@
</Str> </Str>
<Disp Icon="Str" /> <Disp Icon="Str" />
</Item> </Item>
<Item ItemId=";OLD_WINDOWS_ERROR" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[PowerToys requires Windows 10 version 1903 (May 2019 Update) or newer to run.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Windows 10 versie 1903 (update van mei 2019) of nieuwer is vereist om PowerToys te kunnen uitvoeren.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true"> <Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text"> <Str Cat="Text">
<Val><![CDATA[Snooze]]></Val> <Val><![CDATA[Snooze]]></Val>

View File

@@ -283,6 +283,15 @@
</Str> </Str>
<Disp Icon="Str" /> <Disp Icon="Str" />
</Item> </Item>
<Item ItemId=";OLD_WINDOWS_ERROR" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[PowerToys requires Windows 10 version 1903 (May 2019 Update) or newer to run.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Program PowerToys wymaga do działania systemu Windows 10 w wersji 1903 (aktualizacja z maja 2019 r.) lub nowszej.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true"> <Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text"> <Str Cat="Text">
<Val><![CDATA[Snooze]]></Val> <Val><![CDATA[Snooze]]></Val>

View File

@@ -283,6 +283,15 @@
</Str> </Str>
<Disp Icon="Str" /> <Disp Icon="Str" />
</Item> </Item>
<Item ItemId=";OLD_WINDOWS_ERROR" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[PowerToys requires Windows 10 version 1903 (May 2019 Update) or newer to run.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Os PowerToys exigem o Windows 10 versão 1903 (Atualização de maio de 2019) ou mais recente para serem executados.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true"> <Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text"> <Str Cat="Text">
<Val><![CDATA[Snooze]]></Val> <Val><![CDATA[Snooze]]></Val>

View File

@@ -283,6 +283,15 @@
</Str> </Str>
<Disp Icon="Str" /> <Disp Icon="Str" />
</Item> </Item>
<Item ItemId=";OLD_WINDOWS_ERROR" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[PowerToys requires Windows 10 version 1903 (May 2019 Update) or newer to run.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[O PowerToys requer a versão 1903 do Windows 10 (Atualização de maio de 2019) ou mais recente para ser executado.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true"> <Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text"> <Str Cat="Text">
<Val><![CDATA[Snooze]]></Val> <Val><![CDATA[Snooze]]></Val>

View File

@@ -283,6 +283,15 @@
</Str> </Str>
<Disp Icon="Str" /> <Disp Icon="Str" />
</Item> </Item>
<Item ItemId=";OLD_WINDOWS_ERROR" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[PowerToys requires Windows 10 version 1903 (May 2019 Update) or newer to run.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Для запуска PowerToys требуется Windows 10 версии 1903 (обновление за май 2019 года) или более поздней.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true"> <Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text"> <Str Cat="Text">
<Val><![CDATA[Snooze]]></Val> <Val><![CDATA[Snooze]]></Val>

View File

@@ -283,6 +283,15 @@
</Str> </Str>
<Disp Icon="Str" /> <Disp Icon="Str" />
</Item> </Item>
<Item ItemId=";OLD_WINDOWS_ERROR" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[PowerToys requires Windows 10 version 1903 (May 2019 Update) or newer to run.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[PowerToys kräver Windows 10 version 1903 (uppdateringen från maj 2019) eller senare för att köras.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true"> <Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text"> <Str Cat="Text">
<Val><![CDATA[Snooze]]></Val> <Val><![CDATA[Snooze]]></Val>

View File

@@ -283,6 +283,15 @@
</Str> </Str>
<Disp Icon="Str" /> <Disp Icon="Str" />
</Item> </Item>
<Item ItemId=";OLD_WINDOWS_ERROR" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[PowerToys requires Windows 10 version 1903 (May 2019 Update) or newer to run.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[PowerToys'un çalışabilmesi için Windows 10 sürüm 1903 (Mayıs 2019 Güncelleştirmesi) veya daha yeni bir sürümü gereklidir.]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true"> <Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text"> <Str Cat="Text">
<Val><![CDATA[Snooze]]></Val> <Val><![CDATA[Snooze]]></Val>

View File

@@ -283,6 +283,15 @@
</Str> </Str>
<Disp Icon="Str" /> <Disp Icon="Str" />
</Item> </Item>
<Item ItemId=";OLD_WINDOWS_ERROR" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[PowerToys requires Windows 10 version 1903 (May 2019 Update) or newer to run.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[PowerToys 需要 Windows 10 版本 1903 (2019 年 5 月更新)或更高版本才能运行。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true"> <Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text"> <Str Cat="Text">
<Val><![CDATA[Snooze]]></Val> <Val><![CDATA[Snooze]]></Val>

View File

@@ -283,6 +283,15 @@
</Str> </Str>
<Disp Icon="Str" /> <Disp Icon="Str" />
</Item> </Item>
<Item ItemId=";OLD_WINDOWS_ERROR" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[PowerToys requires Windows 10 version 1903 (May 2019 Update) or newer to run.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[PowerToys 需要 Windows 10 1903 版 (2019 年 5 月更新) 或更新版本才能執行。]]></Val>
</Tgt>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true"> <Item ItemId=";SNOOZE_BUTTON" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text"> <Str Cat="Text">
<Val><![CDATA[Snooze]]></Val> <Val><![CDATA[Snooze]]></Val>

View File

@@ -103,7 +103,6 @@
<CustomAction <CustomAction
Id="TerminateProcesses" Id="TerminateProcesses"
Return="ignore" Return="ignore"
Impersonate="no"
Execute="immediate" Execute="immediate"
BinaryKey="PTCustomActions" BinaryKey="PTCustomActions"
DllEntry="TerminateProcessesCA" /> DllEntry="TerminateProcessesCA" />
@@ -282,13 +281,12 @@
<Directory Id="SettingsV2XamlAssetsInstallFolder" Name="Assets" /> <Directory Id="SettingsV2XamlAssetsInstallFolder" Name="Assets" />
</Directory> </Directory>
</Directory> </Directory>
<Directory Id="SettingsHtmlInstallFolder" Name="settings-html">
<Directory Id="SettingsHtmlDistInstallFolder" Name="dist"/>
</Directory> </Directory>
</Directory> </Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="PowerToys (Preview)"/>
</Directory> </Directory>
<Directory Id="ProgramMenuFolder"/> <Directory Id="DesktopFolder" Name="Desktop" />
<Directory Id="DesktopFolder" Name="Desktop"/>
</Directory> </Directory>
</Fragment> </Fragment>
@@ -302,20 +300,7 @@
</RegistryKey> </RegistryKey>
</Component> </Component>
<Component Id="powertoys_exe" Guid="A2C66D91-3485-4D00-B04D-91844E6B345B" Win64="yes"> <Component Id="powertoys_exe" Guid="A2C66D91-3485-4D00-B04D-91844E6B345B" Win64="yes">
<File Id="PowerToys.exe" KeyPath="yes" Checksum="yes"> <File Id="PowerToys.exe" KeyPath="yes" Checksum="yes" />
<Shortcut Id="ApplicationStartMenuShortcut"
Name="PowerToys (Preview)"
Description="PowerToys - Windows system utilities to maximize productivity"
Directory="ProgramMenuFolder"
Icon="powertoys.exe"
IconIndex="0"
Advertise="yes">
<ShortcutProperty Key="System.AppUserModel.ID" Value="Microsoft.PowerToysWin32"/>
<!-- ToastActivatorCLSID is used only by toast background activation, which currently isn't used, but causes MSI warning 1946 to display for a small share of users -->
<!-- <ShortcutProperty Key="System.AppUserModel.ToastActivatorCLSID" Value="{DD5CACDA-7C2E-4997-A62A-04A597B58F76}"/> -->
</Shortcut>
</File>
<RegistryKey Root="HKCR" Key="powertoys"> <RegistryKey Root="HKCR" Key="powertoys">
<RegistryValue Type="string" Name="URL Protocol" Value=""/> <RegistryValue Type="string" Name="URL Protocol" Value=""/>
<RegistryValue Type="string" Value="URL:PowerToys custom internal URI protocol"/> <RegistryValue Type="string" Value="URL:PowerToys custom internal URI protocol"/>
@@ -326,13 +311,6 @@
<RegistryValue Type="string" Value="&quot;[INSTALLFOLDER]PowerToys.exe&quot; &quot;%1&quot;" /> <RegistryValue Type="string" Value="&quot;[INSTALLFOLDER]PowerToys.exe&quot; &quot;%1&quot;" />
</RegistryKey> </RegistryKey>
</RegistryKey> </RegistryKey>
</Component>
<Component Id="settings_exe" Guid="A5A461A9-7097-4CBA-9D39-3DBBB6B7B80C" Win64="yes">
<File Id="PowerToysSettings.exe" KeyPath="yes" Checksum="yes" />
</Component> </Component>
<Component Id="BackgroundActivator_dll" Guid="23B25EE4-BCA2-45DF-BBCD-82FBDF01C5AB" Win64="yes"> <Component Id="BackgroundActivator_dll" Guid="23B25EE4-BCA2-45DF-BBCD-82FBDF01C5AB" Win64="yes">
<File Id="BackgroundActivatorDLL.dll" KeyPath="yes" Checksum="yes" /> <File Id="BackgroundActivatorDLL.dll" KeyPath="yes" Checksum="yes" />
@@ -356,6 +334,24 @@
<?endforeach?> <?endforeach?>
</Component> </Component>
</DirectoryRef> </DirectoryRef>
<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="PowerToysStartMenuShortcut" Guid="336AB4F9-078C-4DCA-B69F-3808A9FFD758">
<Shortcut Id="ApplicationStartMenuShortcut"
Name="PowerToys (Preview)"
Description="PowerToys - Windows system utilities to maximize productivity"
Icon="powertoys.exe"
IconIndex="0"
Target="[!PowerToys.exe]"
WorkingDirectory="INSTALLFOLDER">
<ShortcutProperty Key="System.AppUserModel.ID" Value="Microsoft.PowerToysWin32"/>
</Shortcut>
<RemoveFolder Id="CleanUpStartMenuShortCut" Directory="ApplicationProgramsFolder" On="uninstall"/>
<!-- ApplicationStartMenuShortcut is implicitly installed in HKCU, so WIX won't allow changing this reg value to HKLM. -->
<RegistryValue Root="HKCU" Key="Software\Microsoft\PowerToys" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<DirectoryRef Id="SvgsInstallFolder" FileSource="$(var.BinX64Dir)svgs\"> <DirectoryRef Id="SvgsInstallFolder" FileSource="$(var.BinX64Dir)svgs\">
<Component Id="PowerToysSvgs" Guid="7C4D4EED-9338-423D-992C-DCE02F3E2D35" Win64="yes"> <Component Id="PowerToysSvgs" Guid="7C4D4EED-9338-423D-992C-DCE02F3E2D35" Win64="yes">
<File Source="$(var.BinX64Dir)svgs\0.svg" /> <File Source="$(var.BinX64Dir)svgs\0.svg" />
@@ -378,6 +374,7 @@
<File Source="$(var.BinX64Dir)modules\$(var.FancyZonesProjectName)\fancyzones.dll" KeyPath="yes" /> <File Source="$(var.BinX64Dir)modules\$(var.FancyZonesProjectName)\fancyzones.dll" KeyPath="yes" />
<File Source="$(var.BinX64Dir)modules\$(var.FancyZonesProjectName)\FancyZonesEditor.dll" /> <File Source="$(var.BinX64Dir)modules\$(var.FancyZonesProjectName)\FancyZonesEditor.dll" />
<File Source="$(var.BinX64Dir)modules\$(var.FancyZonesProjectName)\FancyZonesEditor.runtimeconfig.json" /> <File Source="$(var.BinX64Dir)modules\$(var.FancyZonesProjectName)\FancyZonesEditor.runtimeconfig.json" />
<File Source="$(var.BinX64Dir)modules\$(var.FancyZonesProjectName)\FancyZonesEditor.deps.json" />
<File Source="$(var.BinX64Dir)modules\$(var.FancyZonesProjectName)\FancyZonesEditor.exe" /> <File Source="$(var.BinX64Dir)modules\$(var.FancyZonesProjectName)\FancyZonesEditor.exe" />
<File Source="$(var.BinX64Dir)modules\$(var.FancyZonesProjectName)\ControlzEx.dll" /> <File Source="$(var.BinX64Dir)modules\$(var.FancyZonesProjectName)\ControlzEx.dll" />
<File Source="$(var.BinX64Dir)modules\$(var.FancyZonesProjectName)\Microsoft.Xaml.Behaviors.dll" /> <File Source="$(var.BinX64Dir)modules\$(var.FancyZonesProjectName)\Microsoft.Xaml.Behaviors.dll" />
@@ -740,23 +737,10 @@
</Component> </Component>
</DirectoryRef> </DirectoryRef>
<DirectoryRef Id="SettingsHtmlInstallFolder" FileSource="$(var.RepoDir)\settings\settings-html\">
<Component Id="settings_html" Guid="87881A99-E917-4B0D-B1D8-5C6EB9709F96" Win64="yes">
<File Source="$(var.RepoDir)\src\settings\settings-html\index.html" KeyPath="yes" />
</Component>
<Component Id="settings_dark_html" Guid="855866C7-2F13-4B08-B5C1-B507354C2760" Win64="yes">
<File Source="$(var.RepoDir)\src\settings\settings-html\index-dark.html" KeyPath="yes" />
</Component>
</DirectoryRef>
<DirectoryRef Id="SettingsHtmlDistInstallFolder" FileSource="$(var.RepoDir)\settings\settings-html\dist\">
<Component Id="settings_js_bundle" Guid="9EF539C1-2F50-421E-B074-C58ED3A9785C" Win64="yes">
<File Source="$(var.RepoDir)\src\settings\settings-html\dist\bundle.js" KeyPath="yes" />
</Component>
</DirectoryRef>
<DirectoryRef Id="DesktopFolder"> <DirectoryRef Id="DesktopFolder">
<Component Id="DesktopShortcut" Guid="87321F2B-CC48-4326-881E-9C62CC260DC8"> <Component Id="DesktopShortcut" Guid="87321F2B-CC48-4326-881E-9C62CC260DC8">
<Condition>INSTALLDESKTOPSHORTCUT</Condition> <Condition>INSTALLDESKTOPSHORTCUT</Condition>
<!-- DesktopShortcutId is implicitly installed in HKCU, so WIX won't allow changing this reg value to HKLM. -->
<RegistryValue Root="HKCU" <RegistryValue Root="HKCU"
Key="Software\[Manufacturer]\[ProductName]" Key="Software\[Manufacturer]\[ProductName]"
Name="desktopshorcutinstalled" Name="desktopshorcutinstalled"
@@ -777,6 +761,7 @@
<Fragment> <Fragment>
<ComponentGroup Id="CoreComponents" Directory="INSTALLFOLDER"> <ComponentGroup Id="CoreComponents" Directory="INSTALLFOLDER">
<ComponentRef Id="powertoys_exe" /> <ComponentRef Id="powertoys_exe" />
<ComponentRef Id="PowerToysStartMenuShortcut"/>
<ComponentRef Id="BackgroundActivator_dll" /> <ComponentRef Id="BackgroundActivator_dll" />
<ComponentRef Id="action_runner_exe" /> <ComponentRef Id="action_runner_exe" />
<ComponentRef Id="powertoys_toast_clsid" /> <ComponentRef Id="powertoys_toast_clsid" />
@@ -806,10 +791,6 @@
<ComponentRef Id="SettingsV2Styles" /> <ComponentRef Id="SettingsV2Styles" />
<ComponentRef Id="SettingsV2Views" /> <ComponentRef Id="SettingsV2Views" />
<ComponentRef Id="SettingsV2XamlAssets" /> <ComponentRef Id="SettingsV2XamlAssets" />
<ComponentRef Id="settings_exe" />
<ComponentRef Id="settings_html" />
<ComponentRef Id="settings_dark_html" />
<ComponentRef Id="settings_js_bundle" />
</ComponentGroup> </ComponentGroup>
<ComponentGroup Id="ToolComponents" Directory="ToolsFolder"> <ComponentGroup Id="ToolComponents" Directory="ToolsFolder">
<ComponentRef Id="BugReportTool_exe" /> <ComponentRef Id="BugReportTool_exe" />
@@ -917,15 +898,15 @@
</Fragment> </Fragment>
<Fragment> <Fragment>
<ComponentGroup Id="LauncherComponents"> <ComponentGroup Id="LauncherComponents">
<Component Id="launcherShortcutComponent" Directory="LauncherInstallFolder" Guid="8824006B-CD06-4D87-8AC4-1B40C71DB4D7">
<Component Id="launcherInstallComponent" Directory="LauncherInstallFolder" Guid="5E688DB4-C522-4268-BA54-ED1CDFFE9DB6">
<!-- Toast Notification AUMID --> <!-- Toast Notification AUMID -->
<RegistryKey Root="HKCU" Key="SOFTWARE\Classes\AppUserModelId\PowerToysRun"> <RegistryKey Root="HKLM" Key="SOFTWARE\Classes\AppUserModelId\PowerToysRun">
<RegistryValue Type="string" Name="DisplayName" Value="PowerToys Run" /> <RegistryValue Type="string" Name="DisplayName" Value="PowerToys Run" />
<RegistryValue Type="string" Name="IconUri" Value="[LauncherImagesFolder]RunAsset.ico" /> <RegistryValue Type="string" Name="IconUri" Value="[LauncherImagesFolder]RunAsset.ico" />
</RegistryKey> </RegistryKey>
</Component>
<Component Id="launcherInstallComponent" Directory="LauncherInstallFolder" Guid="5E688DB4-C522-4268-BA54-ED1CDFFE9DB6">
<File Source="$(var.BinX64Dir)modules\Launcher\Microsoft.Launcher.dll" /> <File Source="$(var.BinX64Dir)modules\Launcher\Microsoft.Launcher.dll" />
<?foreach File in concrt140_app.dll;ICSharpCode.SharpZipLib.dll;JetBrains.Annotations.dll;Mages.Core.dll;Microsoft.Search.Interop.dll;Mono.Cecil.dll;Mono.Cecil.Mdb.dll;Mono.Cecil.Pdb.dll;Mono.Cecil.Rocks.dll;msvcp140_1_app.dll;msvcp140_2_app.dll;msvcp140_app.dll;Newtonsoft.Json.dll;NLog.dll;NLog.Extensions.Logging.dll;PowerLauncher.deps.json;PowerLauncher.dll;PowerLauncher.exe;Microsoft.Xaml.Behaviors.dll;System.Text.Json.dll;PowerLauncher.runtimeconfig.json;System.Data.OleDb.dll;vcamp140_app.dll;vccorlib140_app.dll;vcomp140_app.dll;vcruntime140_1_app.dll;vcruntime140_app.dll;Wox.Infrastructure.dll;Wox.Plugin.dll;PowerToysInterop.dll;ManagedTelemetry.dll;PowerLauncher.Telemetry.dll;Microsoft.Extensions.Configuration.Abstractions.dll;Microsoft.Extensions.Configuration.Binder.dll;Microsoft.Extensions.Configuration.dll;Microsoft.Extensions.DependencyInjection.Abstractions.dll;Microsoft.Extensions.DependencyInjection.dll;Microsoft.Extensions.Logging.Abstractions.dll;Microsoft.Extensions.Logging.dll;Microsoft.Extensions.Options.dll;Microsoft.Extensions.Primitives.dll;ControlzEx.dll;ManagedCommon.dll;System.IO.Abstractions.dll;Microsoft.PowerToys.Common.UI.dll;System.ServiceProcess.ServiceController.dll;Microsoft.Toolkit.Uwp.Notifications.dll;ModernWpf.Controls.dll;ModernWpf.dll?> <?foreach File in concrt140_app.dll;ICSharpCode.SharpZipLib.dll;JetBrains.Annotations.dll;Mages.Core.dll;Microsoft.Search.Interop.dll;Mono.Cecil.dll;Mono.Cecil.Mdb.dll;Mono.Cecil.Pdb.dll;Mono.Cecil.Rocks.dll;msvcp140_1_app.dll;msvcp140_2_app.dll;msvcp140_app.dll;Newtonsoft.Json.dll;NLog.dll;NLog.Extensions.Logging.dll;PowerLauncher.deps.json;PowerLauncher.dll;PowerLauncher.exe;Microsoft.Xaml.Behaviors.dll;System.Text.Json.dll;PowerLauncher.runtimeconfig.json;System.Data.OleDb.dll;vcamp140_app.dll;vccorlib140_app.dll;vcomp140_app.dll;vcruntime140_1_app.dll;vcruntime140_app.dll;Wox.Infrastructure.dll;Wox.Plugin.dll;PowerToysInterop.dll;ManagedTelemetry.dll;PowerLauncher.Telemetry.dll;Microsoft.Extensions.Configuration.Abstractions.dll;Microsoft.Extensions.Configuration.Binder.dll;Microsoft.Extensions.Configuration.dll;Microsoft.Extensions.DependencyInjection.Abstractions.dll;Microsoft.Extensions.DependencyInjection.dll;Microsoft.Extensions.Logging.Abstractions.dll;Microsoft.Extensions.Logging.dll;Microsoft.Extensions.Options.dll;Microsoft.Extensions.Primitives.dll;ControlzEx.dll;ManagedCommon.dll;System.IO.Abstractions.dll;Microsoft.PowerToys.Common.UI.dll;System.ServiceProcess.ServiceController.dll;Microsoft.Toolkit.Uwp.Notifications.dll;ModernWpf.Controls.dll;ModernWpf.dll?>
<File Id="File_$(var.File)" Source="$(var.BinX64Dir)modules\launcher\$(var.File)" /> <File Id="File_$(var.File)" Source="$(var.BinX64Dir)modules\launcher\$(var.File)" />

View File

@@ -3,6 +3,7 @@
#include <ProjectTelemetry.h> #include <ProjectTelemetry.h>
#include "../../src/common/updating/installer.h" #include "../../src/common/updating/installer.h"
#include "../../src/common/version/version.h"
using namespace std; using namespace std;
@@ -416,6 +417,7 @@ UINT __stdcall TelemetryLogInstallSuccessCA(MSIHANDLE hInstall)
TraceLoggingWrite( TraceLoggingWrite(
g_hProvider, g_hProvider,
"Install_Success", "Install_Success",
TraceLoggingWideString(get_product_version().c_str(), "Version"),
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance), ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"), TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE)); TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
@@ -436,6 +438,7 @@ UINT __stdcall TelemetryLogInstallCancelCA(MSIHANDLE hInstall)
TraceLoggingWrite( TraceLoggingWrite(
g_hProvider, g_hProvider,
"Install_Cancel", "Install_Cancel",
TraceLoggingWideString(get_product_version().c_str(), "Version"),
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance), ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"), TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE)); TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
@@ -456,6 +459,7 @@ UINT __stdcall TelemetryLogInstallFailCA(MSIHANDLE hInstall)
TraceLoggingWrite( TraceLoggingWrite(
g_hProvider, g_hProvider,
"Install_Fail", "Install_Fail",
TraceLoggingWideString(get_product_version().c_str(), "Version"),
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance), ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"), TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE)); TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
@@ -476,6 +480,7 @@ UINT __stdcall TelemetryLogUninstallSuccessCA(MSIHANDLE hInstall)
TraceLoggingWrite( TraceLoggingWrite(
g_hProvider, g_hProvider,
"UnInstall_Success", "UnInstall_Success",
TraceLoggingWideString(get_product_version().c_str(), "Version"),
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance), ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"), TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE)); TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
@@ -496,6 +501,7 @@ UINT __stdcall TelemetryLogUninstallCancelCA(MSIHANDLE hInstall)
TraceLoggingWrite( TraceLoggingWrite(
g_hProvider, g_hProvider,
"UnInstall_Cancel", "UnInstall_Cancel",
TraceLoggingWideString(get_product_version().c_str(), "Version"),
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance), ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"), TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE)); TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
@@ -516,6 +522,7 @@ UINT __stdcall TelemetryLogUninstallFailCA(MSIHANDLE hInstall)
TraceLoggingWrite( TraceLoggingWrite(
g_hProvider, g_hProvider,
"UnInstall_Fail", "UnInstall_Fail",
TraceLoggingWideString(get_product_version().c_str(), "Version"),
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance), ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"), TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE)); TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
@@ -536,6 +543,7 @@ UINT __stdcall TelemetryLogRepairCancelCA(MSIHANDLE hInstall)
TraceLoggingWrite( TraceLoggingWrite(
g_hProvider, g_hProvider,
"Repair_Cancel", "Repair_Cancel",
TraceLoggingWideString(get_product_version().c_str(), "Version"),
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance), ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"), TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE)); TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));
@@ -556,6 +564,7 @@ UINT __stdcall TelemetryLogRepairFailCA(MSIHANDLE hInstall)
TraceLoggingWrite( TraceLoggingWrite(
g_hProvider, g_hProvider,
"Repair_Fail", "Repair_Fail",
TraceLoggingWideString(get_product_version().c_str(), "Version"),
ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance), ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance),
TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"), TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"),
TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE)); TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE));

View File

@@ -48,6 +48,7 @@
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<OutDir>$(Platform)\$(Configuration)\</OutDir> <OutDir>$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)$(ProjectName)\$(Platform)\$(Configuration)\obj\</IntDir> <IntDir>$(SolutionDir)$(ProjectName)\$(Platform)\$(Configuration)\obj\</IntDir>
<IncludePath>..\..\src\common\Telemetry;$(IncludePath)</IncludePath>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup> <ItemDefinitionGroup>
<ClCompile> <ClCompile>

View File

@@ -1,6 +0,0 @@
#pragma once
#include <TraceLoggingProvider.h>
#include <TraceLoggingDefines.h>
TRACELOGGING_DECLARE_PROVIDER(g_hProvider);

View File

@@ -1,6 +0,0 @@
#pragma once
#define TraceLoggingOptionProjectTelemetry() TraceLoggingOptionGroup(0x42749043, 0x438c, 0x46a2, 0x82, 0xbe, 0xc6, 0xcb, 0xeb, 0x19, 0x2f, 0xf2)
#define ProjectTelemetryPrivacyDataTag(tag) TraceLoggingUInt64((tag), "Ignore")
#define ProjectTelemetryTag_ProductAndServicePerformance 0x0u
#define PROJECT_KEYWORD_MEASURE 0x0

View File

@@ -0,0 +1,13 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace ManagedCommon
{
public enum StartupPosition
{
Cursor,
PrimaryMonitor,
Focus,
}
}

View File

@@ -16,6 +16,8 @@ namespace Microsoft.PowerToys.Telemetry.Events
{ {
public bool UTCReplace_AppSessionGuid => true; public bool UTCReplace_AppSessionGuid => true;
public string EventName { get; set; }
private string _version; private string _version;
public string Version public string Version

View File

@@ -37,7 +37,7 @@ namespace Microsoft.PowerToys.Telemetry
where T : EventBase, IEvent where T : EventBase, IEvent
{ {
this.Write<T>( this.Write<T>(
null, telemetryEvent.EventName,
new EventSourceOptions() new EventSourceOptions()
{ {
Keywords = ProjectKeywordMeasure, Keywords = ProjectKeywordMeasure,

View File

@@ -4,7 +4,6 @@
namespace PTSettingsHelper namespace PTSettingsHelper
{ {
constexpr inline const wchar_t* settings_filename = L"\\settings.json"; constexpr inline const wchar_t* settings_filename = L"\\settings.json";
constexpr inline const wchar_t* log_settings_filename = L"log_settings.json";
constexpr inline const wchar_t* oobe_filename = L"oobe_settings.json"; constexpr inline const wchar_t* oobe_filename = L"oobe_settings.json";
std::wstring get_root_save_folder_location() std::wstring get_root_save_folder_location()

View File

@@ -6,6 +6,8 @@
namespace PTSettingsHelper namespace PTSettingsHelper
{ {
constexpr inline const wchar_t* log_settings_filename = L"log_settings.json";
std::wstring get_module_save_folder_location(std::wstring_view powertoy_name); std::wstring get_module_save_folder_location(std::wstring_view powertoy_name);
std::wstring get_root_save_folder_location(); std::wstring get_root_save_folder_location();

View File

@@ -52,10 +52,13 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
<PackageReference Include="MSTest.TestAdapter" Version="2.1.2" /> <PackageReference Include="MSTest.TestAdapter" Version="2.2.3" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" /> <PackageReference Include="MSTest.TestFramework" Version="2.2.3" />
<PackageReference Include="coverlet.collector" Version="1.3.0" /> <PackageReference Include="coverlet.collector" Version="3.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -135,10 +135,24 @@ public
public: public:
literal int VK_WIN_BOTH = CommonSharedConstants::VK_WIN_BOTH; literal int VK_WIN_BOTH = CommonSharedConstants::VK_WIN_BOTH;
static String ^ AppDataPath() {
auto localPath = Environment::GetFolderPath(Environment::SpecialFolder::LocalApplicationData);
auto powerToysPath = gcnew String(CommonSharedConstants::APPDATA_PATH);
return System::IO::Path::Combine(localPath, powerToysPath);
}
static String ^ PowerLauncherSharedEvent() { static String ^ PowerLauncherSharedEvent() {
return gcnew String(CommonSharedConstants::POWER_LAUNCHER_SHARED_EVENT); return gcnew String(CommonSharedConstants::POWER_LAUNCHER_SHARED_EVENT);
} }
static String ^ RunSendSettingsTelemetryEvent() {
return gcnew String(CommonSharedConstants::RUN_SEND_SETTINGS_TELEMETRY_EVENT);
}
static String ^ ColorPickerSendSettingsTelemetryEvent() {
return gcnew String(CommonSharedConstants::COLOR_PICKER_SEND_SETTINGS_TELEMETRY_EVENT);
}
static String ^ ShowColorPickerSharedEvent() { static String ^ ShowColorPickerSharedEvent() {
return gcnew String(CommonSharedConstants::SHOW_COLOR_PICKER_SHARED_EVENT); return gcnew String(CommonSharedConstants::SHOW_COLOR_PICKER_SHARED_EVENT);
} }

View File

@@ -10,9 +10,15 @@ namespace CommonSharedConstants
// Fake key code to represent VK_WIN. // Fake key code to represent VK_WIN.
inline const int VK_WIN_BOTH = 0x104; inline const int VK_WIN_BOTH = 0x104;
const wchar_t APPDATA_PATH[] = L"Microsoft\\PowerToys";
// Path to the event used by PowerLauncher // Path to the event used by PowerLauncher
const wchar_t POWER_LAUNCHER_SHARED_EVENT[] = L"Local\\PowerToysRunInvokeEvent-30f26ad7-d36d-4c0e-ab02-68bb5ff3c4ab"; const wchar_t POWER_LAUNCHER_SHARED_EVENT[] = L"Local\\PowerToysRunInvokeEvent-30f26ad7-d36d-4c0e-ab02-68bb5ff3c4ab";
const wchar_t RUN_SEND_SETTINGS_TELEMETRY_EVENT[] = L"Local\\PowerToysRunInvokeEvent-638ec522-0018-4b96-837d-6bd88e06f0d6";
const wchar_t COLOR_PICKER_SEND_SETTINGS_TELEMETRY_EVENT[] = L"Local\\ColorPickerSettingsTelemetryEvent-6c7071d8-4014-46ec-b687-913bd8a422f1";
// Path to the event used to show Color Picker // Path to the event used to show Color Picker
const wchar_t SHOW_COLOR_PICKER_SHARED_EVENT[] = L"Local\\ShowColorPickerEvent-8c46be2a-3e05-4186-b56b-4ae986ef2525"; const wchar_t SHOW_COLOR_PICKER_SHARED_EVENT[] = L"Local\\ShowColorPickerEvent-8c46be2a-3e05-4186-b56b-4ae986ef2525";

View File

@@ -38,7 +38,7 @@ level_enum getLogLevel(std::wstring_view logSettingsPath)
return result; return result;
} }
std::shared_ptr<spdlog::logger> Logger::logger; std::shared_ptr<spdlog::logger> Logger::logger = spdlog::null_logger_mt("null");
bool Logger::wasLogFailedShown() bool Logger::wasLogFailedShown()
{ {

View File

@@ -4,16 +4,18 @@
struct LogSettings struct LogSettings
{ {
// The following strings are not localizable // The following strings are not localizable
inline const static std::wstring defaultLogLevel = L"warn"; inline const static std::wstring defaultLogLevel = L"trace";
inline const static std::wstring logLevelOption = L"logLevel"; inline const static std::wstring logLevelOption = L"logLevel";
inline const static std::string runnerLoggerName = "runner"; inline const static std::string runnerLoggerName = "runner";
inline const static std::wstring logPath = L"Logs\\";
inline const static std::wstring runnerLogPath = L"RunnerLogs\\runner-log.txt"; inline const static std::wstring runnerLogPath = L"RunnerLogs\\runner-log.txt";
inline const static std::string actionRunnerLoggerName = "action-runner"; inline const static std::string actionRunnerLoggerName = "action-runner";
inline const static std::wstring actionRunnerLogPath = L"RunnerLogs\\action-runner-log.txt"; inline const static std::wstring actionRunnerLogPath = L"RunnerLogs\\action-runner-log.txt";
inline const static std::string launcherLoggerName = "launcher"; inline const static std::string launcherLoggerName = "launcher";
inline const static std::wstring launcherLogPath = L"LogsModuleInterface\\launcher-log.txt"; inline const static std::wstring launcherLogPath = L"LogsModuleInterface\\launcher-log.txt";
inline const static std::string fancyZonesLoggerName = "fancyzones"; inline const static std::string fancyZonesLoggerName = "fancyzones";
inline const static std::wstring fancyZonesLogPath = L"FancyZonesLogs\\fancyzones-log.txt"; inline const static std::wstring fancyZonesLogPath = L"fancyzones-log.txt";
inline const static std::wstring fancyZonesOldLogPath = L"FancyZonesLogs\\"; // needed to clean up old logs
inline const static std::string shortcutGuideLoggerName = "shortcut-guide"; inline const static std::string shortcutGuideLoggerName = "shortcut-guide";
inline const static std::wstring shortcutGuideLogPath = L"ShortcutGuideLogs\\shortcut-guide-log.txt"; inline const static std::wstring shortcutGuideLogPath = L"ShortcutGuideLogs\\shortcut-guide-log.txt";
inline const static std::string keyboardManagerLoggerName = "keyboard-manager"; inline const static std::string keyboardManagerLoggerName = "keyboard-manager";

View File

@@ -10,7 +10,7 @@ namespace fs = std::filesystem;
namespace updating namespace updating
{ {
constexpr size_t REQUIRED_MINIMAL_PATCH = 11; constexpr size_t REQUIRED_MINIMAL_PATCH = 13;
bool dotnet_is_installed() bool dotnet_is_installed()
{ {
@@ -46,7 +46,7 @@ namespace updating
std::optional<fs::path> download_dotnet() std::optional<fs::path> download_dotnet()
{ {
const wchar_t DOTNET_DESKTOP_DOWNLOAD_LINK[] = L"https://download.visualstudio.microsoft.com/download/pr/3f1cc4f7-0c1a-48ca-9551-a8447fa55892/ed9809822448f55b649858920afb35cb/windowsdesktop-runtime-3.1.11-win-x64.exe"; const wchar_t DOTNET_DESKTOP_DOWNLOAD_LINK[] = L"https://download.visualstudio.microsoft.com/download/pr/aa717f57-3ae5-48fa-a3ab-0018338d0726/fb37276b1575772461701339110e7a54/windowsdesktop-runtime-3.1.13-win-x64.exe";
const wchar_t DOTNET_DESKTOP_FILENAME[] = L"windowsdesktop-runtime.exe"; const wchar_t DOTNET_DESKTOP_FILENAME[] = L"windowsdesktop-runtime.exe";
auto dotnet_download_path = fs::temp_directory_path() / DOTNET_DESKTOP_FILENAME; auto dotnet_download_path = fs::temp_directory_path() / DOTNET_DESKTOP_FILENAME;

View File

@@ -3,6 +3,7 @@
#include "installer.h" #include "installer.h"
#include <common/version/version.h> #include <common/version/version.h>
#include <common/notifications/notifications.h> #include <common/notifications/notifications.h>
#include <common/utils/os-detect.h>
#include "utils/winapi_error.h" #include "utils/winapi_error.h"
namespace // Strings in this namespace should not be localized namespace // Strings in this namespace should not be localized
@@ -192,4 +193,8 @@ namespace updating
co_return false; co_return false;
} }
bool is_old_windows_version()
{
return !Is19H1OrHigher();
}
} }

View File

@@ -16,4 +16,6 @@ namespace updating
std::optional<VersionHelper> get_installed_powertoys_version(); std::optional<VersionHelper> get_installed_powertoys_version();
std::future<bool> uninstall_previous_msix_version_async(); std::future<bool> uninstall_previous_msix_version_async();
bool is_old_windows_version();
} }

View File

@@ -7,9 +7,10 @@
#include "notifications.h" #include "notifications.h"
#include "updating.h" #include "updating.h"
#include <common/utils/json.h>
#include <common/SettingsAPI/settings_helpers.h>
#include <common/notifications/notifications.h> #include <common/notifications/notifications.h>
#include <common/SettingsAPI/settings_helpers.h>
#include <common/utils/json.h>
#include <common/utils/os-detect.h>
namespace // Strings in this namespace should not be localized namespace // Strings in this namespace should not be localized
{ {
@@ -68,12 +69,17 @@ namespace updating
{ {
co_return nonstd::make_unexpected(strings.GITHUB_NEW_VERSION_USING_LOCAL_BUILD_ERROR); co_return nonstd::make_unexpected(strings.GITHUB_NEW_VERSION_USING_LOCAL_BUILD_ERROR);
} }
try try
{ {
http::HttpClient client; http::HttpClient client;
json::JsonObject release_object; json::JsonObject release_object;
const VersionHelper current_version(VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION); const VersionHelper current_version(VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION);
VersionHelper github_version = current_version; VersionHelper github_version = current_version;
// On a <1903 system, block updates to 0.36+
const bool blockNonPatchReleases = current_version.major == 0 && current_version.minor == 35 && !Is19H1OrHigher();
if (prerelease) if (prerelease)
{ {
const auto body = co_await client.request(Uri{ ALL_RELEASES_ENDPOINT }); const auto body = co_await client.request(Uri{ ALL_RELEASES_ENDPOINT });
@@ -102,6 +108,11 @@ namespace updating
} }
} }
if (blockNonPatchReleases && github_version >= VersionHelper{ 0, 36, 0 })
{
co_return version_up_to_date{};
}
if (github_version <= current_version) if (github_version <= current_version)
{ {
co_return version_up_to_date{}; co_return version_up_to_date{};

View File

@@ -0,0 +1,55 @@
#pragma once
#include <filesystem>
#include <common/version/version.h>
namespace LoggerHelpers
{
inline std::filesystem::path get_log_folder_path(std::wstring_view appPath)
{
std::filesystem::path logFolderPath(appPath);
logFolderPath.append(LogSettings::logPath);
logFolderPath.append(get_product_version());
return logFolderPath;
}
inline bool delete_old_log_folder(const std::filesystem::path& logFolderPath)
{
try
{
std::filesystem::remove_all(logFolderPath);
return true;
}
catch (std::filesystem::filesystem_error& e)
{
Logger::error("Failed to delete old log folder: {}", e.what());
}
return false;
}
inline bool delete_other_versions_log_folders(std::wstring_view appPath, const std::filesystem::path& currentVersionLogFolder)
{
bool result = true;
std::filesystem::path logFolderPath(appPath);
logFolderPath.append(LogSettings::logPath);
for (const auto& dir : std::filesystem::directory_iterator(logFolderPath))
{
if (dir != currentVersionLogFolder)
{
try
{
std::filesystem::remove_all(dir);
}
catch (std::filesystem::filesystem_error& e)
{
Logger::error("Failed to delete previous version log folder: {}", e.what());
result = false;
}
}
}
return result;
}
}

View File

@@ -2,7 +2,7 @@
#include <winrt/Windows.Foundation.Metadata.h> #include <winrt/Windows.Foundation.Metadata.h>
// The following three helper functions determine if the user has a build version higher than or equal to 19h1, as that is a requirement for xaml islands // The following three helper functions determine if the user has a build version higher than or equal to 19h1 (aka 1903), as that is a requirement for xaml islands
// Source : Microsoft-ui-xaml github // Source : Microsoft-ui-xaml github
// Link: https://github.com/microsoft/microsoft-ui-xaml/blob/c045cde57c5c754683d674634a0baccda34d58c4/dev/dll/SharedHelpers.cpp // Link: https://github.com/microsoft/microsoft-ui-xaml/blob/c045cde57c5c754683d674634a0baccda34d58c4/dev/dll/SharedHelpers.cpp
template<uint16_t APIVersion> template<uint16_t APIVersion>

View File

@@ -39,3 +39,14 @@ std::wstring VersionHelper::toWstring() const
result += std::to_wstring(revision); result += std::to_wstring(revision);
return result; return result;
} }
std::string VersionHelper::toString() const
{
std::string result{ "v" };
result += std::to_string(major);
result += '.';
result += std::to_string(minor);
result += '.';
result += std::to_string(revision);
return result;
}

View File

@@ -15,4 +15,5 @@ struct VersionHelper
size_t revision; size_t revision;
std::wstring toWstring() const; std::wstring toWstring() const;
std::string toString() const;
}; };

View File

@@ -54,6 +54,9 @@
<ClCompile Include="trace.cpp" /> <ClCompile Include="trace.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\common\logger\logger.vcxproj">
<Project>{d9b8fc84-322a-4f9f-bbb9-20915c47ddfd}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\common\SettingsAPI\SetttingsAPI.vcxproj"> <ProjectReference Include="..\..\..\common\SettingsAPI\SetttingsAPI.vcxproj">
<Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project> <Project>{6955446d-23f7-4023-9bb3-8657f904af99}</Project>
</ProjectReference> </ProjectReference>
@@ -69,6 +72,7 @@
<None Include="Resources.resx" /> <None Include="Resources.resx" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<Import Project="..\..\..\..\deps\spdlog.props" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
<Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets')" /> <Import Project="..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.200729.8\build\native\Microsoft.Windows.CppWinRT.targets')" />
</ImportGroup> </ImportGroup>

View File

@@ -4,11 +4,13 @@
#include <interface/powertoy_module_interface.h> #include <interface/powertoy_module_interface.h>
#include "trace.h" #include "trace.h"
#include "Generated Files/resource.h" #include "Generated Files/resource.h"
#include <common/logger/logger.h>
#include <common/SettingsAPI/settings_objects.h> #include <common/SettingsAPI/settings_objects.h>
#include <common/utils/os-detect.h> #include <common/utils/os-detect.h>
#include <common/utils/resources.h> #include <common/utils/resources.h>
#include <colorPicker/ColorPicker/ColorPickerConstants.h> #include <colorPicker/ColorPicker/ColorPickerConstants.h>
#include <common/interop/shared_constants.h>
BOOL APIENTRY DllMain(HMODULE hModule, BOOL APIENTRY DllMain(HMODULE hModule,
DWORD ul_reason_for_call, DWORD ul_reason_for_call,
@@ -28,6 +30,17 @@ BOOL APIENTRY DllMain(HMODULE hModule,
return TRUE; return TRUE;
} }
namespace
{
const wchar_t JSON_KEY_PROPERTIES[] = L"properties";
const wchar_t JSON_KEY_WIN[] = L"win";
const wchar_t JSON_KEY_ALT[] = L"alt";
const wchar_t JSON_KEY_CTRL[] = L"ctrl";
const wchar_t JSON_KEY_SHIFT[] = L"shift";
const wchar_t JSON_KEY_CODE[] = L"code";
const wchar_t JSON_KEY_ACTIVATION_SHORTCUT[] = L"ActivationShortcut";
}
struct ModuleSettings struct ModuleSettings
{ {
} g_settings; } g_settings;
@@ -47,11 +60,103 @@ private:
// Time to wait for process to close after sending WM_CLOSE signal // Time to wait for process to close after sending WM_CLOSE signal
static const int MAX_WAIT_MILLISEC = 10000; static const int MAX_WAIT_MILLISEC = 10000;
HANDLE send_telemetry_event;
Hotkey m_hotkey;
// Handle to event used to invoke ColorPicker
HANDLE m_hInvokeEvent;
void parse_hotkey(PowerToysSettings::PowerToyValues& settings)
{
auto settingsObject = settings.get_raw_json();
if (settingsObject.GetView().Size())
{
try
{
auto jsonHotkeyObject = settingsObject.GetNamedObject(JSON_KEY_PROPERTIES).GetNamedObject(JSON_KEY_ACTIVATION_SHORTCUT);
m_hotkey.win = jsonHotkeyObject.GetNamedBoolean(JSON_KEY_WIN);
m_hotkey.alt = jsonHotkeyObject.GetNamedBoolean(JSON_KEY_ALT);
m_hotkey.shift = jsonHotkeyObject.GetNamedBoolean(JSON_KEY_SHIFT);
m_hotkey.ctrl = jsonHotkeyObject.GetNamedBoolean(JSON_KEY_CTRL);
m_hotkey.key = static_cast<unsigned char>(jsonHotkeyObject.GetNamedNumber(JSON_KEY_CODE));
}
catch (...)
{
Logger::error("Failed to initialize ColorPicker start shortcut");
}
}
else
{
Logger::info("ColorPicker settings are empty");
}
if (!m_hotkey.key)
{
Logger::info("ColorPicker is going to use default shortcut");
m_hotkey.win = true;
m_hotkey.alt = false;
m_hotkey.shift = true;
m_hotkey.ctrl = false;
m_hotkey.key = 'C';
}
}
bool is_process_running()
{
return WaitForSingleObject(m_hProcess, 0) == WAIT_TIMEOUT;
}
void launch_process()
{
Logger::trace(L"Launching ColorPicker process");
unsigned long powertoys_pid = GetCurrentProcessId();
std::wstring executable_args = L"";
executable_args.append(std::to_wstring(powertoys_pid));
SHELLEXECUTEINFOW sei{ sizeof(sei) };
sei.fMask = { SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI };
sei.lpFile = L"modules\\ColorPicker\\ColorPickerUI.exe";
sei.nShow = SW_SHOWNORMAL;
sei.lpParameters = executable_args.data();
if (!ShellExecuteExW(&sei))
{
DWORD error = GetLastError();
std::wstring message = L"ColorPicker failed to start with error = ";
message += std::to_wstring(error);
Logger::error(message);
}
m_hProcess = sei.hProcess;
}
// Load the settings file.
void init_settings()
{
try
{
// Load and parse the settings file for this PowerToy.
PowerToysSettings::PowerToyValues settings =
PowerToysSettings::PowerToyValues::load_from_settings_file(get_key());
parse_hotkey(settings);
}
catch (std::exception ex)
{
Logger::warn(L"An exception occurred while loading the settings file");
// Error while loading from the settings file. Let default values stay as they are.
}
}
public: public:
ColorPicker() ColorPicker()
{ {
app_name = GET_RESOURCE_STRING(IDS_COLORPICKER_NAME); app_name = GET_RESOURCE_STRING(IDS_COLORPICKER_NAME);
app_key = ColorPickerConstants::ModuleKey; app_key = ColorPickerConstants::ModuleKey;
send_telemetry_event = CreateDefaultEvent(CommonSharedConstants::COLOR_PICKER_SEND_SETTINGS_TELEMETRY_EVENT);
m_hInvokeEvent = CreateDefaultEvent(CommonSharedConstants::SHOW_COLOR_PICKER_SHARED_EVENT);
init_settings();
} }
~ColorPicker() ~ColorPicker()
@@ -105,6 +210,7 @@ public:
PowerToysSettings::PowerToyValues values = PowerToysSettings::PowerToyValues values =
PowerToysSettings::PowerToyValues::from_json_string(config, get_key()); PowerToysSettings::PowerToyValues::from_json_string(config, get_key());
parse_hotkey(values);
// If you don't need to do any custom processing of the settings, proceed // If you don't need to do any custom processing of the settings, proceed
// to persists the values calling: // to persists the values calling:
values.save_to_settings_file(); values.save_to_settings_file();
@@ -119,23 +225,12 @@ public:
virtual void enable() virtual void enable()
{ {
ResetEvent(send_telemetry_event);
ResetEvent(m_hInvokeEvent);
// use only with new settings? // use only with new settings?
if (UseNewSettings()) if (UseNewSettings())
{ {
unsigned long powertoys_pid = GetCurrentProcessId(); launch_process();
std::wstring executable_args = L"";
executable_args.append(std::to_wstring(powertoys_pid));
SHELLEXECUTEINFOW sei{ sizeof(sei) };
sei.fMask = { SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI };
sei.lpFile = L"modules\\ColorPicker\\ColorPickerUI.exe";
sei.nShow = SW_SHOWNORMAL;
sei.lpParameters = executable_args.data();
ShellExecuteExW(&sei);
m_hProcess = sei.hProcess;
m_enabled = true; m_enabled = true;
} }
}; };
@@ -144,16 +239,57 @@ public:
{ {
if (m_enabled) if (m_enabled)
{ {
ResetEvent(send_telemetry_event);
ResetEvent(m_hInvokeEvent);
TerminateProcess(m_hProcess, 1); TerminateProcess(m_hProcess, 1);
} }
m_enabled = false; m_enabled = false;
} }
virtual bool on_hotkey(size_t hotkeyId) override
{
if (m_enabled)
{
Logger::trace(L"ColorPicker hotkey pressed");
if (!is_process_running())
{
launch_process();
}
SetEvent(m_hInvokeEvent);
return true;
}
return false;
}
virtual size_t get_hotkeys(Hotkey* hotkeys, size_t buffer_size) override
{
if (m_hotkey.key)
{
if (hotkeys && buffer_size >= 1)
{
hotkeys[0] = m_hotkey;
}
return 1;
}
else
{
return 0;
}
}
virtual bool is_enabled() override virtual bool is_enabled() override
{ {
return m_enabled; return m_enabled;
} }
virtual void send_settings_telemetry() override
{
SetEvent(send_telemetry_event);
}
}; };
extern "C" __declspec(dllexport) PowertoyModuleIface* __cdecl powertoy_create() extern "C" __declspec(dllexport) PowertoyModuleIface* __cdecl powertoy_create()

View File

@@ -18,7 +18,7 @@ namespace ColorPickerUI
{ {
private Mutex _instanceMutex; private Mutex _instanceMutex;
private static string[] _args; private static string[] _args;
private int _powerToysPid; private int _powerToysRunnerPid;
private bool disposedValue; private bool disposedValue;
private ThemeManager _themeManager; private ThemeManager _themeManager;
@@ -27,23 +27,27 @@ namespace ColorPickerUI
_args = e?.Args; _args = e?.Args;
// allow only one instance of color picker // allow only one instance of color picker
_instanceMutex = new Mutex(true, @"Global\ColorPicker", out bool createdNew); _instanceMutex = new Mutex(true, @"Local\PowerToys_ColorPicker_InstanceMutex", out bool createdNew);
if (!createdNew) if (!createdNew)
{ {
_instanceMutex = null; _instanceMutex = null;
Application.Current.Shutdown(); Environment.Exit(0);
return; return;
} }
if (_args?.Length > 0) if (_args?.Length > 0)
{ {
_ = int.TryParse(_args[0], out _powerToysPid); _ = int.TryParse(_args[0], out _powerToysRunnerPid);
}
RunnerHelper.WaitForPowerToysRunner(_powerToysPid, () => RunnerHelper.WaitForPowerToysRunner(_powerToysRunnerPid, () =>
{ {
Environment.Exit(0); Environment.Exit(0);
}); });
}
else
{
_powerToysRunnerPid = -1;
}
_themeManager = new ThemeManager(this); _themeManager = new ThemeManager(this);
base.OnStartup(e); base.OnStartup(e);
@@ -83,5 +87,10 @@ namespace ColorPickerUI
Dispose(disposing: true); Dispose(disposing: true);
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
} }
public bool IsRunningDetachedFromPowerToys()
{
return _powerToysRunnerPid == -1;
}
} }
} }

View File

@@ -2,19 +2,8 @@
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using ColorPicker.Helpers;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace ColorPicker namespace ColorPicker
{ {
@@ -23,16 +12,19 @@ namespace ColorPicker
/// </summary> /// </summary>
public partial class ColorEditorWindow : Window public partial class ColorEditorWindow : Window
{ {
public ColorEditorWindow() private readonly AppStateHandler _appStateHandler;
public ColorEditorWindow(AppStateHandler appStateHandler)
{ {
InitializeComponent(); InitializeComponent();
_appStateHandler = appStateHandler;
Closing += ColorEditorWindow_Closing; Closing += ColorEditorWindow_Closing;
} }
private void ColorEditorWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) private void ColorEditorWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{ {
e.Cancel = true; e.Cancel = true;
this.Hide(); _appStateHandler.EndUserSession();
} }
} }
} }

View File

@@ -56,6 +56,7 @@ namespace ColorPicker.Controls
private void CopyToClipboardButton_Click(object sender, RoutedEventArgs e) private void CopyToClipboardButton_Click(object sender, RoutedEventArgs e)
{ {
ClipboardHelper.CopyToClipboard(ColorTextRepresentationTextBlock.Text); ClipboardHelper.CopyToClipboard(ColorTextRepresentationTextBlock.Text);
SessionEventHelper.Event.EditorColorCopiedToClipboard = true;
if (!_copyIndicatorVisible) if (!_copyIndicatorVisible)
{ {
AppearCopiedIndicator(); AppearCopiedIndicator();

View File

@@ -32,7 +32,8 @@
Background="LightPink" Background="LightPink"
Click="ColorVariationButton_Click" Click="ColorVariationButton_Click"
AutomationProperties.Name="Color shade 1" AutomationProperties.Name="Color shade 1"
Style="{DynamicResource ColorShadeButtonStyle}"/> Style="{DynamicResource ColorShadeButtonStyle}"
ToolTipService.ToolTip="{x:Static p:Resources.Select_color}"/>
<Button x:Name="colorVariation2Button" <Button x:Name="colorVariation2Button"
Grid.Column="1" Grid.Column="1"
ui:ControlHelper.CornerRadius="0" ui:ControlHelper.CornerRadius="0"
@@ -40,7 +41,8 @@
Background="LightPink" Background="LightPink"
Click="ColorVariationButton_Click" Click="ColorVariationButton_Click"
AutomationProperties.Name="Color shade 2" AutomationProperties.Name="Color shade 2"
Style="{DynamicResource ColorShadeButtonStyle}"/> Style="{DynamicResource ColorShadeButtonStyle}"
ToolTipService.ToolTip="{x:Static p:Resources.Select_color}"/>
<Button x:Name="colorVariation3Button" <Button x:Name="colorVariation3Button"
Grid.Column="3" Grid.Column="3"
TabIndex="7" TabIndex="7"
@@ -48,7 +50,8 @@
Background="LightPink" Background="LightPink"
Click="ColorVariationButton_Click" Click="ColorVariationButton_Click"
AutomationProperties.Name="Color shade 3" AutomationProperties.Name="Color shade 3"
Style="{DynamicResource ColorShadeButtonStyle}"/> Style="{DynamicResource ColorShadeButtonStyle}"
ToolTipService.ToolTip="{x:Static p:Resources.Select_color}"/>
<Button x:Name="colorVariation4Button" <Button x:Name="colorVariation4Button"
Grid.Column="4" Grid.Column="4"
TabIndex="8" TabIndex="8"
@@ -56,7 +59,8 @@
Background="LightPink" Background="LightPink"
Click="ColorVariationButton_Click" Click="ColorVariationButton_Click"
AutomationProperties.Name="Color shade 5" AutomationProperties.Name="Color shade 5"
Style="{DynamicResource ColorShadeButtonStyle}"/> Style="{DynamicResource ColorShadeButtonStyle}"
ToolTipService.ToolTip="{x:Static p:Resources.Select_color}"/>
<Button x:Name="CurrentColorButton" <Button x:Name="CurrentColorButton"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Grid.Column="0" Grid.Column="0"
@@ -72,7 +76,8 @@
AutomationProperties.HelpText="{x:Static p:Resources.Selected_color_helptext}" AutomationProperties.HelpText="{x:Static p:Resources.Selected_color_helptext}"
ToolTipService.ToolTip="{x:Static p:Resources.Selected_color_tooltip}" ToolTipService.ToolTip="{x:Static p:Resources.Selected_color_tooltip}"
Click="CurrentColorButton_Click" Click="CurrentColorButton_Click"
Style="{DynamicResource ColorShadeButtonStyle}"/> Style="{DynamicResource ColorShadeButtonStyle}">
</Button>
</Grid> </Grid>
<!--Details panel--> <!--Details panel-->
@@ -202,71 +207,73 @@
</Border> </Border>
</Grid> </Grid>
<Grid HorizontalAlignment="Stretch" Margin="12,16,12,8"> <Grid HorizontalAlignment="Stretch"
Margin="12,16,12,8">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="20"/> <ColumnDefinition Width="20" />
<ColumnDefinition Width="68"/> <ColumnDefinition Width="86" />
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*" />
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="36"/> <RowDefinition Height="36" />
<RowDefinition Height="36"/> <RowDefinition Height="36" />
<RowDefinition Height="36"/> <RowDefinition Height="36" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Text="R" <TextBlock Text="R"
FontWeight="SemiBold" FontWeight="SemiBold"
VerticalAlignment="Center"/> VerticalAlignment="Center" />
<TextBox x:Name="RTextBox" <ui:NumberBox x:Name="RNumberBox"
Margin="0,0,0,0"
Grid.Column="1" Grid.Column="1"
Height="32" Height="32"
AutomationProperties.Name="{x:Static p:Resources.Red_value}" AutomationProperties.Name="{x:Static p:Resources.Red_value}"
TextChanged="RGBTextBoxes_TextChanged" ValueChanged="RGBNumberBox_ValueChanged"
TextWrapping="Wrap"/> Minimum="0"
Maximum="255" />
<TextBlock Text="G" <TextBlock Text="G"
FontWeight="SemiBold" FontWeight="SemiBold"
Grid.Row="1" Grid.Row="1"
VerticalAlignment="Center"/> VerticalAlignment="Center" />
<TextBox x:Name="GTextBox" <ui:NumberBox x:Name="GNumberBox"
Width="68"
Height="32" Height="32"
Grid.Row="1" Grid.Row="1"
Grid.Column="1" Grid.Column="1"
AutomationProperties.Name="{x:Static p:Resources.Green_value}" AutomationProperties.Name="{x:Static p:Resources.Green_value}"
TextChanged="RGBTextBoxes_TextChanged" ValueChanged="RGBNumberBox_ValueChanged"
TextWrapping="Wrap"/> Minimum="0"
Maximum="255" />
<TextBlock Text="B" <TextBlock Text="B"
FontWeight="SemiBold" FontWeight="SemiBold"
Grid.Row="2" Grid.Row="2"
VerticalAlignment="Center"/> VerticalAlignment="Center" />
<TextBox x:Name="BTextBox" <ui:NumberBox x:Name="BNumberBox"
Width="68"
Height="32" Height="32"
Grid.Column="1" Grid.Column="1"
Grid.Row="2" Grid.Row="2"
AutomationProperties.Name="{x:Static p:Resources.Blue_value}" AutomationProperties.Name="{x:Static p:Resources.Blue_value}"
TextChanged="RGBTextBoxes_TextChanged" ValueChanged="RGBNumberBox_ValueChanged"
TextWrapping="Wrap"/> Minimum="0"
Maximum="255" />
<TextBlock Text="HEX" <TextBlock Text="HEX"
Grid.Column="2" Grid.Column="2"
HorizontalAlignment="Right" HorizontalAlignment="Right"
FontWeight="SemiBold" FontWeight="SemiBold"
VerticalAlignment="Center"/> VerticalAlignment="Center" />
<TextBox x:Name="HexCode" <TextBox x:Name="HexCode"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
Margin="8,0,0,0" Margin="8,0,0,0"
Height="32" Height="32"
Grid.Column="3" Grid.Column="3"
AutomationProperties.Name="{x:Static p:Resources.Hex_value}" AutomationProperties.Name="{x:Static p:Resources.Hex_value}"
GotKeyboardFocus="HexCode_GotKeyboardFocus"
TextChanged="HexCode_TextChanged" TextChanged="HexCode_TextChanged"
TextWrapping="Wrap"/> TextWrapping="Wrap" />
</Grid> </Grid>
<WrapPanel HorizontalAlignment="Right" <WrapPanel HorizontalAlignment="Right"
Margin="0,0,0,0" Margin="0,0,0,0"

View File

@@ -56,20 +56,24 @@ namespace ColorPicker.Controls
private static void SelectedColorPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void SelectedColorPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
var control = (ColorPickerControl)d;
var newColor = (Color)e.NewValue; var newColor = (Color)e.NewValue;
((ColorPickerControl)d)._originalColor = ((ColorPickerControl)d)._currentColor = newColor;
var newColorBackground = new SolidColorBrush(newColor);
((ColorPickerControl)d).CurrentColorButton.Background = newColorBackground;
((ColorPickerControl)d)._ignoreHexChanges = true; control._originalColor = control._currentColor = newColor;
((ColorPickerControl)d)._ignoreRGBChanges = true; var newColorBackground = new SolidColorBrush(newColor);
((ColorPickerControl)d).HexCode.Text = ColorToHex(newColor); control.CurrentColorButton.Background = newColorBackground;
((ColorPickerControl)d).RTextBox.Text = newColor.R.ToString(CultureInfo.InvariantCulture);
((ColorPickerControl)d).GTextBox.Text = newColor.G.ToString(CultureInfo.InvariantCulture); control._ignoreHexChanges = true;
((ColorPickerControl)d).BTextBox.Text = newColor.B.ToString(CultureInfo.InvariantCulture); control._ignoreRGBChanges = true;
((ColorPickerControl)d).SetColorFromTextBoxes(System.Drawing.Color.FromArgb(newColor.R, newColor.G, newColor.B));
((ColorPickerControl)d)._ignoreRGBChanges = false; control.HexCode.Text = ColorToHex(newColor);
((ColorPickerControl)d)._ignoreHexChanges = false; control.RNumberBox.Text = newColor.R.ToString(CultureInfo.InvariantCulture);
control.GNumberBox.Text = newColor.G.ToString(CultureInfo.InvariantCulture);
control.BNumberBox.Text = newColor.B.ToString(CultureInfo.InvariantCulture);
control.SetColorFromTextBoxes(System.Drawing.Color.FromArgb(newColor.R, newColor.G, newColor.B));
control._ignoreRGBChanges = false;
control._ignoreHexChanges = false;
var hsv = ColorHelper.ConvertToHSVColor(System.Drawing.Color.FromArgb(newColor.R, newColor.G, newColor.B)); var hsv = ColorHelper.ConvertToHSVColor(System.Drawing.Color.FromArgb(newColor.R, newColor.G, newColor.B));
@@ -107,12 +111,13 @@ namespace ColorPicker.Controls
} }
var s = hsv.saturation; var s = hsv.saturation;
var control = (ColorPickerControl)d;
((ColorPickerControl)d).colorVariation1Button.Background = new SolidColorBrush(HSVColor.RGBFromHSV(Math.Min(hsv.hue + (hueCoefficient * 8), 360), s, Math.Min(hsv.value + 0.3, 1))); control.colorVariation1Button.Background = new SolidColorBrush(HSVColor.RGBFromHSV(Math.Min(hsv.hue + (hueCoefficient * 8), 360), s, Math.Min(hsv.value + 0.3, 1)));
((ColorPickerControl)d).colorVariation2Button.Background = new SolidColorBrush(HSVColor.RGBFromHSV(Math.Min(hsv.hue + (hueCoefficient * 4), 360), s, Math.Min(hsv.value + 0.15, 1))); control.colorVariation2Button.Background = new SolidColorBrush(HSVColor.RGBFromHSV(Math.Min(hsv.hue + (hueCoefficient * 4), 360), s, Math.Min(hsv.value + 0.15, 1)));
((ColorPickerControl)d).colorVariation3Button.Background = new SolidColorBrush(HSVColor.RGBFromHSV(Math.Max(hsv.hue - (hueCoefficient2 * 4), 0), s, Math.Max(hsv.value - 0.2, 0))); control.colorVariation3Button.Background = new SolidColorBrush(HSVColor.RGBFromHSV(Math.Max(hsv.hue - (hueCoefficient2 * 4), 0), s, Math.Max(hsv.value - 0.2, 0)));
((ColorPickerControl)d).colorVariation4Button.Background = new SolidColorBrush(HSVColor.RGBFromHSV(Math.Max(hsv.hue - (hueCoefficient2 * 8), 0), s, Math.Max(hsv.value - 0.3, 0))); control.colorVariation4Button.Background = new SolidColorBrush(HSVColor.RGBFromHSV(Math.Max(hsv.hue - (hueCoefficient2 * 8), 0), s, Math.Max(hsv.value - 0.3, 0)));
} }
private void UpdateValueColorGradient(double posX) private void UpdateValueColorGradient(double posX)
@@ -161,9 +166,9 @@ namespace ColorPicker.Controls
if (!_ignoreRGBChanges) if (!_ignoreRGBChanges)
{ {
RTextBox.Text = currentColor.R.ToString(CultureInfo.InvariantCulture); RNumberBox.Text = currentColor.R.ToString(CultureInfo.InvariantCulture);
GTextBox.Text = currentColor.G.ToString(CultureInfo.InvariantCulture); GNumberBox.Text = currentColor.G.ToString(CultureInfo.InvariantCulture);
BTextBox.Text = currentColor.B.ToString(CultureInfo.InvariantCulture); BNumberBox.Text = currentColor.B.ToString(CultureInfo.InvariantCulture);
} }
_currentColor = currentColor; _currentColor = currentColor;
@@ -200,6 +205,7 @@ namespace ColorPicker.Controls
detailsStackPanel.BeginAnimation(StackPanel.OpacityProperty, opacityAppear); detailsStackPanel.BeginAnimation(StackPanel.OpacityProperty, opacityAppear);
detailsGrid.BeginAnimation(Grid.HeightProperty, resize); detailsGrid.BeginAnimation(Grid.HeightProperty, resize);
CurrentColorButton.IsEnabled = false; CurrentColorButton.IsEnabled = false;
SessionEventHelper.Event.EditorAdjustColorOpened = true;
} }
} }
@@ -234,8 +240,8 @@ namespace ColorPicker.Controls
private void OKButton_Click(object sender, RoutedEventArgs e) private void OKButton_Click(object sender, RoutedEventArgs e)
{ {
HideDetails(); HideDetails();
SelectedColorChangedCommand.Execute(_currentColor); SelectedColorChangedCommand.Execute(_currentColor);
SessionEventHelper.Event.EditorColorAdjusted = true;
} }
private void CancelButton_Click(object sender, RoutedEventArgs e) private void CancelButton_Click(object sender, RoutedEventArgs e)
@@ -253,6 +259,7 @@ namespace ColorPicker.Controls
{ {
var selectedColor = ((SolidColorBrush)((Button)sender).Background).Color; var selectedColor = ((SolidColorBrush)((Button)sender).Background).Color;
SelectedColorChangedCommand.Execute(selectedColor); SelectedColorChangedCommand.Execute(selectedColor);
SessionEventHelper.Event.EditorSimilarColorPicked = true;
} }
private void ValueGradientGrid_MouseMove(object sender, MouseEventArgs e) private void ValueGradientGrid_MouseMove(object sender, MouseEventArgs e)
@@ -357,19 +364,15 @@ namespace ColorPicker.Controls
} }
} }
private void RGBTextBoxes_TextChanged(object sender, TextChangedEventArgs e) #pragma warning disable CA1801 // Review unused parameters
private void RGBNumberBox_ValueChanged(ModernWpf.Controls.NumberBox sender, ModernWpf.Controls.NumberBoxValueChangedEventArgs args)
#pragma warning restore CA1801 // Review unused parameters
{ {
var validNumber = int.TryParse((sender as TextBox).Text, out int result);
if (!validNumber || result < 0 || result > 255)
{
return;
}
if (!_ignoreRGBChanges) if (!_ignoreRGBChanges)
{ {
var r = byte.Parse(RTextBox.Text, CultureInfo.InvariantCulture); var r = byte.Parse(RNumberBox.Text, CultureInfo.InvariantCulture);
var g = byte.Parse(GTextBox.Text, CultureInfo.InvariantCulture); var g = byte.Parse(GNumberBox.Text, CultureInfo.InvariantCulture);
var b = byte.Parse(BTextBox.Text, CultureInfo.InvariantCulture); var b = byte.Parse(BNumberBox.Text, CultureInfo.InvariantCulture);
_ignoreRGBChanges = true; _ignoreRGBChanges = true;
SetColorFromTextBoxes(System.Drawing.Color.FromArgb(r, g, b)); SetColorFromTextBoxes(System.Drawing.Color.FromArgb(r, g, b));
_ignoreRGBChanges = false; _ignoreRGBChanges = false;
@@ -397,5 +400,10 @@ namespace ColorPicker.Controls
{ {
return "#" + BitConverter.ToString(new byte[] { color.R, color.G, color.B }).Replace("-", string.Empty, StringComparison.InvariantCulture); return "#" + BitConverter.ToString(new byte[] { color.R, color.G, color.B }).Replace("-", string.Empty, StringComparison.InvariantCulture);
} }
private void HexCode_GotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
{
(sender as TextBox).SelectAll();
}
} }
} }

View File

@@ -5,7 +5,9 @@
using System; using System;
using System.ComponentModel.Composition; using System.ComponentModel.Composition;
using System.Windows; using System.Windows;
using ColorPicker.Settings;
using ColorPicker.ViewModelContracts; using ColorPicker.ViewModelContracts;
using Microsoft.PowerToys.Settings.UI.Library.Enumerations;
namespace ColorPicker.Helpers namespace ColorPicker.Helpers
{ {
@@ -13,15 +15,17 @@ namespace ColorPicker.Helpers
public class AppStateHandler public class AppStateHandler
{ {
private readonly IColorEditorViewModel _colorEditorViewModel; private readonly IColorEditorViewModel _colorEditorViewModel;
private readonly IUserSettings _userSettings;
private ColorEditorWindow _colorEditorWindow; private ColorEditorWindow _colorEditorWindow;
private bool _colorPickerShown; private bool _colorPickerShown;
private object _colorPickerVisibilityLock = new object(); private object _colorPickerVisibilityLock = new object();
[ImportingConstructor] [ImportingConstructor]
public AppStateHandler(IColorEditorViewModel colorEditorViewModel) public AppStateHandler(IColorEditorViewModel colorEditorViewModel, IUserSettings userSettings)
{ {
Application.Current.MainWindow.Closed += MainWindow_Closed; Application.Current.MainWindow.Closed += MainWindow_Closed;
_colorEditorViewModel = colorEditorViewModel; _colorEditorViewModel = colorEditorViewModel;
_userSettings = userSettings;
} }
public event EventHandler AppShown; public event EventHandler AppShown;
@@ -30,9 +34,70 @@ namespace ColorPicker.Helpers
public event EventHandler AppClosed; public event EventHandler AppClosed;
public void ShowColorPicker() public void StartUserSession()
{ {
lock (_colorPickerVisibilityLock) lock (_colorPickerVisibilityLock)
{
if (!_colorPickerShown && !IsColorPickerEditorVisible())
{
SessionEventHelper.Start(_userSettings.ActivationAction.Value);
}
if (_userSettings.ActivationAction.Value == ColorPickerActivationAction.OpenEditor)
{
ShowColorPickerEditor();
}
else
{
ShowColorPicker();
}
}
}
public void EndUserSession()
{
lock (_colorPickerVisibilityLock)
{
if (IsColorPickerEditorVisible() || _colorPickerShown)
{
if (IsColorPickerEditorVisible())
{
HideColorPickerEditor();
}
else
{
HideColorPicker();
}
SessionEventHelper.End();
}
}
}
public void OnColorPickerMouseDown()
{
if (_userSettings.ActivationAction.Value == ColorPickerActivationAction.OpenColorPickerAndThenEditor || _userSettings.ActivationAction.Value == ColorPickerActivationAction.OpenEditor)
{
lock (_colorPickerVisibilityLock)
{
HideColorPicker();
}
ShowColorPickerEditor();
}
else
{
EndUserSession();
}
}
public static void SetTopMost()
{
Application.Current.MainWindow.Topmost = false;
Application.Current.MainWindow.Topmost = true;
}
private void ShowColorPicker()
{ {
if (!_colorPickerShown) if (!_colorPickerShown)
{ {
@@ -42,11 +107,8 @@ namespace ColorPicker.Helpers
_colorPickerShown = true; _colorPickerShown = true;
} }
} }
}
public void HideColorPicker() private void HideColorPicker()
{
lock (_colorPickerVisibilityLock)
{ {
if (_colorPickerShown) if (_colorPickerShown)
{ {
@@ -56,25 +118,42 @@ namespace ColorPicker.Helpers
_colorPickerShown = false; _colorPickerShown = false;
} }
} }
}
public void ShowColorPickerEditor() private void ShowColorPickerEditor()
{ {
if (_colorEditorWindow == null) if (_colorEditorWindow == null)
{ {
_colorEditorWindow = new ColorEditorWindow(); _colorEditorWindow = new ColorEditorWindow(this);
_colorEditorWindow.Content = _colorEditorViewModel; _colorEditorWindow.Content = _colorEditorViewModel;
_colorEditorViewModel.OpenColorPickerRequested += ColorEditorViewModel_OpenColorPickerRequested; _colorEditorViewModel.OpenColorPickerRequested += ColorEditorViewModel_OpenColorPickerRequested;
_colorEditorViewModel.OpenColorPickerRequested += (object sender, EventArgs e) =>
{
SessionEventHelper.Event.EditorColorPickerOpened = true;
};
} }
_colorEditorViewModel.Initialize(); _colorEditorViewModel.Initialize();
_colorEditorWindow.Show(); _colorEditorWindow.Show();
SessionEventHelper.Event.EditorOpened = true;
} }
public static void SetTopMost() private void HideColorPickerEditor()
{ {
Application.Current.MainWindow.Topmost = false; if (_colorEditorWindow != null)
Application.Current.MainWindow.Topmost = true; {
_colorEditorWindow.Hide();
}
}
private bool IsColorPickerEditorVisible()
{
if (_colorEditorWindow != null)
{
// Check if we are visible and on top. Using focus producing unreliable results the first time the picker is opened.
return _colorEditorWindow.Topmost && _colorEditorWindow.IsVisible;
}
return false;
} }
private void MainWindow_Closed(object sender, EventArgs e) private void MainWindow_Closed(object sender, EventArgs e)
@@ -83,8 +162,12 @@ namespace ColorPicker.Helpers
} }
private void ColorEditorViewModel_OpenColorPickerRequested(object sender, EventArgs e) private void ColorEditorViewModel_OpenColorPickerRequested(object sender, EventArgs e)
{
lock (_colorPickerVisibilityLock)
{ {
ShowColorPicker(); ShowColorPicker();
}
_colorEditorWindow.Hide(); _colorEditorWindow.Hide();
} }
} }

View File

@@ -5,14 +5,16 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.IO;
using System.IO.Abstractions; using System.IO.Abstractions;
using interop;
namespace ColorPicker.Helpers namespace ColorPicker.Helpers
{ {
public static class Logger public static class Logger
{ {
private static readonly IFileSystem _fileSystem = new FileSystem(); private static readonly IFileSystem _fileSystem = new FileSystem();
private static readonly string ApplicationLogPath = _fileSystem.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ColorPicker"); private static readonly string ApplicationLogPath = Path.Combine(Constants.AppDataPath(), "ColorPicker\\Logs");
static Logger() static Logger()
{ {

View File

@@ -3,25 +3,13 @@
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System; using System;
using System.ComponentModel.Composition;
using System.Threading; using System.Threading;
using System.Windows; using System.Windows;
using interop;
namespace ColorPicker.Helpers namespace ColorPicker.Helpers
{ {
[Export(typeof(NativeEventWaiter))] public static class NativeEventWaiter
public class NativeEventWaiter
{ {
private AppStateHandler _appStateHandler;
[ImportingConstructor]
public NativeEventWaiter(AppStateHandler appStateHandler)
{
_appStateHandler = appStateHandler;
WaitForEventLoop(Constants.ShowColorPickerSharedEvent(), _appStateHandler.ShowColorPicker);
}
public static void WaitForEventLoop(string eventName, Action callback) public static void WaitForEventLoop(string eventName, Action callback)
{ {
new Thread(() => new Thread(() =>
@@ -31,7 +19,7 @@ namespace ColorPicker.Helpers
{ {
if (eventHandle.WaitOne()) if (eventHandle.WaitOne())
{ {
Logger.LogInfo("Successfully waited for SHOW_COLOR_PICKER_EVENT"); Logger.LogInfo($"Successfully waited for {eventName}");
Application.Current.Dispatcher.Invoke(callback); Application.Current.Dispatcher.Invoke(callback);
} }
} }

View File

@@ -0,0 +1,39 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using ColorPicker.Telemetry;
using Microsoft.PowerToys.Settings.UI.Library.Enumerations;
using Microsoft.PowerToys.Telemetry;
namespace ColorPicker.Helpers
{
public static class SessionEventHelper
{
public static ColorPickerSession Event { get; private set; }
public static void Start(ColorPickerActivationAction startedAs)
{
Event = new ColorPickerSession();
Event.StartedAs = startedAs.ToString();
_startTime = DateTime.Now;
}
public static void End()
{
if (_startTime == null)
{
Logger.LogError("Failed to send ColorPickerSessionEvent");
return;
}
var duration = DateTime.Now - _startTime.Value;
Event.Duration = duration.Seconds + (duration.Milliseconds == 0 ? 0 : 1);
_startTime = null;
PowerToysTelemetry.Log.WriteEvent(Event);
}
private static DateTime? _startTime;
}
}

View File

@@ -179,7 +179,7 @@ namespace ColorPicker.Helpers
{ {
_zoomWindow.Left = _lastLeft + 1; _zoomWindow.Left = _lastLeft + 1;
_zoomWindow.Top = _lastTop + 1; _zoomWindow.Top = _lastTop + 1;
PowerToysTelemetry.Log.WriteEvent(new ColorPickerZoomOpenedEvent()); SessionEventHelper.Event.ZoomUsed = true;
} }
_throttledActionInvoker.ScheduleAction( _throttledActionInvoker.ScheduleAction(

View File

@@ -5,7 +5,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.Composition; using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Windows.Input; using System.Windows.Input;
using ColorPicker.Helpers; using ColorPicker.Helpers;
using ColorPicker.Settings; using ColorPicker.Settings;
@@ -22,7 +21,7 @@ namespace ColorPicker.Keyboard
{ {
private readonly AppStateHandler _appStateHandler; private readonly AppStateHandler _appStateHandler;
private readonly IUserSettings _userSettings; private readonly IUserSettings _userSettings;
private List<string> _previouslyPressedKeys; private List<string> _previouslyPressedKeys = new List<string>();
private List<string> _activationKeys = new List<string>(); private List<string> _activationKeys = new List<string>();
private GlobalKeyboardHook _keyboardHook; private GlobalKeyboardHook _keyboardHook;
@@ -73,11 +72,12 @@ namespace ColorPicker.Keyboard
// ESC pressed // ESC pressed
if (virtualCode == KeyInterop.VirtualKeyFromKey(Key.Escape)) if (virtualCode == KeyInterop.VirtualKeyFromKey(Key.Escape))
{ {
_appStateHandler.HideColorPicker(); _appStateHandler.EndUserSession();
PowerToysTelemetry.Log.WriteEvent(new ColorPickerCancelledEvent());
return; return;
} }
if ((System.Windows.Application.Current as ColorPickerUI.App).IsRunningDetachedFromPowerToys())
{
var name = Helper.GetKeyName((uint)virtualCode); var name = Helper.GetKeyName((uint)virtualCode);
// If the last key pressed is a modifier key, then currentlyPressedKeys cannot possibly match with _activationKeys // If the last key pressed is a modifier key, then currentlyPressedKeys cannot possibly match with _activationKeys
@@ -107,13 +107,8 @@ namespace ColorPicker.Keyboard
if (!_activationShortcutPressed) if (!_activationShortcutPressed)
{ {
_activationShortcutPressed = true; _activationShortcutPressed = true;
if (_userSettings.ActivationAction.Value == ColorPickerActivationAction.OpenEditor)
{ _appStateHandler.StartUserSession();
_appStateHandler.ShowColorPickerEditor();
}
else
{
_appStateHandler.ShowColorPicker();
} }
} }
} }

View File

@@ -114,6 +114,7 @@ namespace ColorPicker.Mouse
{ {
MouseDevice mouseDev = InputManager.Current.PrimaryMouseDevice; MouseDevice mouseDev = InputManager.Current.PrimaryMouseDevice;
MouseWheel.Invoke(null, new MouseWheelEventArgs(mouseDev, Environment.TickCount, (int)mouseHookStruct.mouseData >> 16)); MouseWheel.Invoke(null, new MouseWheelEventArgs(mouseDev, Environment.TickCount, (int)mouseHookStruct.mouseData >> 16));
return new IntPtr(-1);
} }
} }
} }

View File

@@ -195,6 +195,15 @@ namespace ColorPicker.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to Select color.
/// </summary>
public static string Select_color {
get {
return ResourceManager.GetString("Select_color", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Selected color. /// Looks up a localized string similar to Selected color.
/// </summary> /// </summary>

View File

@@ -361,4 +361,7 @@
<value>Plum</value> <value>Plum</value>
<comment>Plum color</comment> <comment>Plum color</comment>
</data> </data>
<data name="Select_color" xml:space="preserve">
<value>Select color</value>
</data>
</root> </root>

View File

@@ -105,6 +105,7 @@
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Focusable="False" Focusable="False"
Opacity="0"
RecognizesAccessKey="True" RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border> </Border>
@@ -113,12 +114,12 @@
<Trigger Property="IsMouseOver" Value="True"> <Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Background" Property="Opacity" Value="0.8" /> <Setter TargetName="Background" Property="Opacity" Value="0.8" />
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ButtonBorderBrushPointerOver}" /> <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ButtonBorderBrushPointerOver}" />
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource ButtonForegroundPointerOver}" /> <Setter TargetName="ContentPresenter" Property="Opacity" Value="1" />
</Trigger> </Trigger>
<Trigger Property="IsPressed" Value="True"> <Trigger Property="IsPressed" Value="True">
<Setter TargetName="Background" Property="Opacity" Value="0.9" /> <Setter TargetName="Background" Property="Opacity" Value="0.9" />
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ButtonBorderBrushPressed}" /> <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ButtonBorderBrushPressed}" />
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource ButtonForegroundPressed}" /> <Setter TargetName="ContentPresenter" Property="Opacity" Value="1" />
</Trigger> </Trigger>
</ControlTemplate.Triggers> </ControlTemplate.Triggers>
</ControlTemplate> </ControlTemplate>

View File

@@ -25,5 +25,7 @@ namespace ColorPicker.Settings
ObservableCollection<string> VisibleColorFormats { get; } ObservableCollection<string> VisibleColorFormats { get; }
SettingItem<bool> ShowColorName { get; } SettingItem<bool> ShowColorName { get; }
void SendSettingsTelemetry();
} }
} }

View File

@@ -13,6 +13,7 @@ using ColorPicker.Common;
using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.Library.Enumerations; using Microsoft.PowerToys.Settings.UI.Library.Enumerations;
using Microsoft.PowerToys.Settings.UI.Library.Utilities; using Microsoft.PowerToys.Settings.UI.Library.Utilities;
using Microsoft.PowerToys.Telemetry;
namespace ColorPicker.Settings namespace ColorPicker.Settings
{ {
@@ -160,5 +161,27 @@ namespace ColorPicker.Settings
} }
} }
} }
public void SendSettingsTelemetry()
{
Logger.LogInfo("Sending settings telemetry");
var settings = _settingsUtils.GetSettingsOrDefault<ColorPickerSettings>(ColorPickerModuleName);
var properties = settings?.Properties;
if (properties == null)
{
Logger.LogError("Failed to send settings telemetry");
return;
}
var telemetrySettings = new Telemetry.ColorPickerSettings(properties.VisibleColorFormats)
{
ActivationShortcut = properties.ActivationShortcut.ToString(),
ActivationBehaviour = properties.ActivationAction.ToString(),
ColorFormatForClipboard = properties.CopiedColorRepresentation.ToString(),
ShowColorName = properties.ShowColorName,
};
PowerToysTelemetry.Log.WriteEvent(telemetrySettings);
}
} }
} }

View File

@@ -1,16 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Diagnostics.Tracing;
using Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events;
namespace ColorPicker.Telemetry
{
[EventData]
public class ColorPickerCancelledEvent : EventBase, IEvent
{
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
}
}

View File

@@ -0,0 +1,44 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics.Tracing;
using Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events;
namespace ColorPicker.Telemetry
{
[EventData]
public class ColorPickerSession : EventBase, IEvent
{
public ColorPickerSession()
{
EventName = "ColorPicker_Session";
}
public string StartedAs { get; set; }
public bool ZoomUsed { get; set; }
public bool EditorOpened { get; set; }
public bool EditorColorPickerOpened { get; set; }
public bool EditorAdjustColorOpened { get; set; }
public bool EditorColorAdjusted { get; set; }
public bool EditorSimilarColorPicked { get; set; }
public bool EditorHistoryColorPicked { get; set; }
public bool EditorHistoryColorRemoved { get; set; }
public bool EditorColorCopiedToClipboard { get; set; }
public int Duration { get; set; }
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
}
}

View File

@@ -0,0 +1,33 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.Diagnostics.Tracing;
using Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events;
namespace ColorPicker.Telemetry
{
[EventData]
public class ColorPickerSettings : EventBase, IEvent
{
public ColorPickerSettings(IDictionary<string, bool> editorFormats)
{
EditorFormats = editorFormats;
EventName = "ColorPicker_Settings";
}
public string ActivationShortcut { get; set; }
public string ActivationBehaviour { get; set; }
public string ColorFormatForClipboard { get; set; }
public bool ShowColorName { get; set; }
public IDictionary<string, bool> EditorFormats { get; }
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
}
}

View File

@@ -1,16 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Diagnostics.Tracing;
using Microsoft.PowerToys.Telemetry;
using Microsoft.PowerToys.Telemetry.Events;
namespace ColorPicker.Telemetry
{
[EventData]
public class ColorPickerShowEvent : EventBase, IEvent
{
public PartA_PrivTags PartA_PrivTags => PartA_PrivTags.ProductAndServiceUsage;
}
}

View File

@@ -134,6 +134,7 @@ namespace ColorPicker.ViewModels
var indexToSelect = SelectedColorIndex == ColorsHistory.Count - 1 ? ColorsHistory.Count - 2 : SelectedColorIndex; var indexToSelect = SelectedColorIndex == ColorsHistory.Count - 1 ? ColorsHistory.Count - 2 : SelectedColorIndex;
ColorsHistory.RemoveAt(SelectedColorIndex); ColorsHistory.RemoveAt(SelectedColorIndex);
SelectedColorIndex = indexToSelect; SelectedColorIndex = indexToSelect;
SessionEventHelper.Event.EditorHistoryColorRemoved = true;
} }
private void SetupAllColorRepresentations() private void SetupAllColorRepresentations()

View File

@@ -15,6 +15,7 @@ using ColorPicker.Mouse;
using ColorPicker.Settings; using ColorPicker.Settings;
using ColorPicker.Telemetry; using ColorPicker.Telemetry;
using ColorPicker.ViewModelContracts; using ColorPicker.ViewModelContracts;
using interop;
using Microsoft.PowerToys.Settings.UI.Library.Enumerations; using Microsoft.PowerToys.Settings.UI.Library.Enumerations;
using Microsoft.PowerToys.Telemetry; using Microsoft.PowerToys.Telemetry;
@@ -26,7 +27,6 @@ namespace ColorPicker.ViewModels
private readonly ZoomWindowHelper _zoomWindowHelper; private readonly ZoomWindowHelper _zoomWindowHelper;
private readonly AppStateHandler _appStateHandler; private readonly AppStateHandler _appStateHandler;
private readonly IUserSettings _userSettings; private readonly IUserSettings _userSettings;
private readonly NativeEventWaiter _nativeEventWaiter;
/// <summary> /// <summary>
/// Backing field for <see cref="OtherColor"/> /// Backing field for <see cref="OtherColor"/>
@@ -49,13 +49,13 @@ namespace ColorPicker.ViewModels
ZoomWindowHelper zoomWindowHelper, ZoomWindowHelper zoomWindowHelper,
AppStateHandler appStateHandler, AppStateHandler appStateHandler,
KeyboardMonitor keyboardMonitor, KeyboardMonitor keyboardMonitor,
NativeEventWaiter nativeEventWaiter,
IUserSettings userSettings) IUserSettings userSettings)
{ {
_zoomWindowHelper = zoomWindowHelper; _zoomWindowHelper = zoomWindowHelper;
_appStateHandler = appStateHandler; _appStateHandler = appStateHandler;
_userSettings = userSettings; _userSettings = userSettings;
_nativeEventWaiter = nativeEventWaiter; NativeEventWaiter.WaitForEventLoop(Constants.ShowColorPickerSharedEvent(), _appStateHandler.StartUserSession);
NativeEventWaiter.WaitForEventLoop(Constants.ColorPickerSendSettingsTelemetryEvent(), _userSettings.SendSettingsTelemetry);
if (mouseInfoProvider != null) if (mouseInfoProvider != null)
{ {
@@ -140,14 +140,7 @@ namespace ColorPicker.ViewModels
_userSettings.ColorHistory.RemoveAt(_userSettings.ColorHistory.Count - 1); _userSettings.ColorHistory.RemoveAt(_userSettings.ColorHistory.Count - 1);
} }
_appStateHandler.HideColorPicker(); _appStateHandler.OnColorPickerMouseDown();
if (_userSettings.ActivationAction.Value == ColorPickerActivationAction.OpenColorPickerAndThenEditor || _userSettings.ActivationAction.Value == ColorPickerActivationAction.OpenEditor)
{
_appStateHandler.ShowColorPickerEditor();
}
PowerToysTelemetry.Log.WriteEvent(new ColorPickerShowEvent());
} }
private string GetColorString() private string GetColorString()

View File

@@ -20,13 +20,16 @@
<!-- Side bar --> <!-- Side bar -->
<Grid Background="{DynamicResource SecondaryBackgroundBrush}"> <Grid Background="{DynamicResource SecondaryBackgroundBrush}">
<ui:ListView Margin="0,48,0,0" <ui:ListView x:Name="HistoryColors"
Margin="0,48,0,0"
Grid.Row="1" Grid.Row="1"
Padding="0" Padding="0"
TabIndex="3" TabIndex="3"
ItemsSource="{Binding ColorsHistory}" ItemsSource="{Binding ColorsHistory}"
SelectedIndex="{Binding SelectedColorIndex}" SelectedIndex="{Binding SelectedColorIndex}"
ItemContainerStyle="{DynamicResource ColorHistoryListViewStyle}"> ItemContainerStyle="{DynamicResource ColorHistoryListViewStyle}"
IsItemClickEnabled="True"
ItemClick="HistoryColors_ItemClick">
<ui:ListView.ContextMenu> <ui:ListView.ContextMenu>
<ContextMenu Visibility="{Binding ColorsHistory.Count, Converter={StaticResource numberToVisibilityConverter}}"> <ContextMenu Visibility="{Binding ColorsHistory.Count, Converter={StaticResource numberToVisibilityConverter}}">
<MenuItem Header="{x:Static p:Resources.Remove}" <MenuItem Header="{x:Static p:Resources.Remove}"

View File

@@ -2,20 +2,8 @@
// The Microsoft Corporation licenses this file to you under the MIT license. // The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data; using ColorPicker.Helpers;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace ColorPicker.Views namespace ColorPicker.Views
{ {
@@ -26,5 +14,12 @@ namespace ColorPicker.Views
{ {
public ColorEditorView() => public ColorEditorView() =>
InitializeComponent(); InitializeComponent();
private void HistoryColors_ItemClick(object sender, ModernWpf.Controls.ItemClickEventArgs e)
{
// Note: it does not handle clicking on the same color.
// More appropriate event would be SelectionChanged but we can not distinguish between user action and program action inside of it.
SessionEventHelper.Event.EditorHistoryColorPicked = true;
}
} }
} }

View File

@@ -28,13 +28,13 @@
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
<PackageReference Include="coverlet.collector" Version="1.3.0"> <PackageReference Include="coverlet.collector" Version="3.0.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> </PackageReference>
<PackageReference Include="MSTest.TestAdapter" Version="2.1.2" /> <PackageReference Include="MSTest.TestAdapter" Version="2.2.3" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" /> <PackageReference Include="MSTest.TestFramework" Version="2.2.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -14,6 +14,7 @@
#include <lib/FancyZonesWinHookEventIDs.h> #include <lib/FancyZonesWinHookEventIDs.h>
#include <lib/FancyZonesData.cpp> #include <lib/FancyZonesData.cpp>
#include <common/logger/logger.h> #include <common/logger/logger.h>
#include <common/utils/logger_helper.h>
#include <common/utils/resources.h> #include <common/utils/resources.h>
#include <common/utils/winapi_error.h> #include <common/utils/winapi_error.h>
#include <common/utils/window.h> #include <common/utils/window.h>
@@ -156,9 +157,19 @@ public:
{ {
app_name = GET_RESOURCE_STRING(IDS_FANCYZONES); app_name = GET_RESOURCE_STRING(IDS_FANCYZONES);
app_key = NonLocalizable::FancyZonesStr; app_key = NonLocalizable::FancyZonesStr;
std::filesystem::path logFilePath(PTSettingsHelper::get_module_save_folder_location(app_key)); const auto appFolder = PTSettingsHelper::get_module_save_folder_location(app_key);
const std::filesystem::path logFolder = LoggerHelpers::get_log_folder_path(appFolder);
std::filesystem::path logFilePath(logFolder);
logFilePath.append(LogSettings::fancyZonesLogPath); logFilePath.append(LogSettings::fancyZonesLogPath);
Logger::init(LogSettings::fancyZonesLoggerName, logFilePath.wstring(), PTSettingsHelper::get_log_settings_file_location()); Logger::init(LogSettings::fancyZonesLoggerName, logFilePath.wstring(), PTSettingsHelper::get_log_settings_file_location());
std::filesystem::path oldLogFolder(appFolder);
oldLogFolder.append(LogSettings::fancyZonesOldLogPath);
LoggerHelpers::delete_old_log_folder(oldLogFolder);
LoggerHelpers::delete_other_versions_log_folders(appFolder, logFolder);
m_settings = MakeFancyZonesSettings(reinterpret_cast<HINSTANCE>(&__ImageBase), FancyZonesModule::get_name(), FancyZonesModule::get_key()); m_settings = MakeFancyZonesSettings(reinterpret_cast<HINSTANCE>(&__ImageBase), FancyZonesModule::get_name(), FancyZonesModule::get_key());
FancyZonesDataInstance().LoadFancyZonesData(); FancyZonesDataInstance().LoadFancyZonesData();
s_instance = this; s_instance = this;

View File

@@ -135,15 +135,7 @@ namespace FancyZonesEditor
sb.AppendLine(ParsingErrorDataTag); sb.AppendLine(ParsingErrorDataTag);
sb.AppendLine(parseResult.MalformedData); sb.AppendLine(parseResult.MalformedData);
string message = parseResult.Message + Environment.NewLine + Environment.NewLine + FancyZonesEditor.Properties.Resources.Error_Parsing_Zones_Settings_User_Choice; MessageBox.Show(parseResult.Message, FancyZonesEditor.Properties.Resources.Error_Parsing_Zones_Settings_Title, MessageBoxButton.OK);
if (MessageBox.Show(message, FancyZonesEditor.Properties.Resources.Error_Parsing_Zones_Settings_Title, MessageBoxButton.YesNo) == MessageBoxResult.No)
{
// TODO: log error
ShowExceptionReportMessageBox(sb.ToString());
Environment.Exit(0);
}
ShowExceptionReportMessageBox(sb.ToString());
} }
MainWindowSettingsModel settings = ((App)Current).MainWindowSettings; MainWindowSettingsModel settings = ((App)Current).MainWindowSettings;

View File

@@ -16,7 +16,12 @@
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="{x:Type Thumb}"> <ControlTemplate TargetType="{x:Type Thumb}">
<Border x:Name="ThumbBorder" Opacity="0" BorderBrush="{DynamicResource SystemControlBackgroundAccentBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"> <Border x:Name="ThumbBorder"
Opacity="0"
CornerRadius="0"
BorderBrush="{DynamicResource SystemControlBackgroundAccentBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}">
<VisualStateManager.VisualStateGroups> <VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates" > <VisualStateGroup x:Name="CommonStates" >
<VisualStateGroup.Transitions> <VisualStateGroup.Transitions>
@@ -64,7 +69,9 @@
</Border> </Border>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
<Trigger Property="IsDefaulted" Value="true"> <Trigger Property="IsDefaulted" Value="true">
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource SystemControlBackgroundAccentBrush}"/> <Setter Property="BorderBrush"
TargetName="border"
Value="{DynamicResource SystemControlBackgroundAccentBrush}"/>
</Trigger> </Trigger>
<Trigger Property="IsMouseOver" Value="true"> <Trigger Property="IsMouseOver" Value="true">
<Setter Property="Opacity" TargetName="contentPresenter" Value="0.6"/> <Setter Property="Opacity" TargetName="contentPresenter" Value="0.6"/>
@@ -79,10 +86,9 @@
</Style> </Style>
</UserControl.Resources> </UserControl.Resources>
<Border BorderBrush="{DynamicResource LayoutPreviewZoneBorderBrush}" <Border BorderBrush="{DynamicResource SystemControlBackgroundAccentBrush}"
Background="{DynamicResource CanvasZoneBackgroundBrush}" Background="{DynamicResource CanvasZoneBackgroundBrush}"
CornerRadius="4" CornerRadius="0"
Effect="{StaticResource ZoneDropShadow}"
BorderThickness="1"> BorderThickness="1">
<Grid x:Name="Frame"> <Grid x:Name="Frame">
<Grid.RowDefinitions> <Grid.RowDefinitions>
@@ -129,15 +135,15 @@
<Thumb x:Name="Caption" Cursor="SizeAll" Background="Transparent" BorderThickness="3" Padding="4" Grid.Column="0" Grid.ColumnSpan="5" Margin="-1" Grid.Row="0" Grid.RowSpan="5" DragDelta="UniversalDragDelta" DragStarted="Caption_DragStarted" Style="{DynamicResource CanvasZoneThumbStyle}"/> <Thumb x:Name="Caption" Cursor="SizeAll" Background="Transparent" BorderThickness="3" Padding="4" Grid.Column="0" Grid.ColumnSpan="5" Margin="-1" Grid.Row="0" Grid.RowSpan="5" DragDelta="UniversalDragDelta" DragStarted="Caption_DragStarted" Style="{DynamicResource CanvasZoneThumbStyle}"/>
<Thumb x:Name="NResize" Cursor="SizeNS" BorderThickness="0,3,0,0" Grid.ColumnSpan="5" DragDelta="UniversalDragDelta" DragStarted="NResize_DragStarted" Style="{DynamicResource CanvasZoneThumbStyle}"/> <Thumb x:Name="NResize" Cursor="SizeNS" BorderThickness="0,2,0,0" Grid.ColumnSpan="5" DragDelta="UniversalDragDelta" DragStarted="NResize_DragStarted" Style="{DynamicResource CanvasZoneThumbStyle}"/>
<Thumb x:Name="SResize" Cursor="SizeNS" BorderThickness="0,0,0,3" Grid.Row="4" Grid.ColumnSpan="5" DragDelta="UniversalDragDelta" DragStarted="SResize_DragStarted" Style="{DynamicResource CanvasZoneThumbStyle}"/> <Thumb x:Name="SResize" Cursor="SizeNS" BorderThickness="0,0,0,2" Grid.Row="4" Grid.ColumnSpan="5" DragDelta="UniversalDragDelta" DragStarted="SResize_DragStarted" Style="{DynamicResource CanvasZoneThumbStyle}"/>
<Thumb x:Name="WResize" Cursor="SizeWE" BorderThickness="3,0,0,0" Grid.RowSpan="5" DragDelta="UniversalDragDelta" DragStarted="WResize_DragStarted" Style="{DynamicResource CanvasZoneThumbStyle}"/> <Thumb x:Name="WResize" Cursor="SizeWE" BorderThickness="2,0,0,0" Grid.RowSpan="5" DragDelta="UniversalDragDelta" DragStarted="WResize_DragStarted" Style="{DynamicResource CanvasZoneThumbStyle}"/>
<Thumb x:Name="EResize" Cursor="SizeWE" BorderThickness="0,0,3,0" Grid.Column="4" Grid.RowSpan="5" DragDelta="UniversalDragDelta" DragStarted="EResize_DragStarted" Style="{DynamicResource CanvasZoneThumbStyle}"/> <Thumb x:Name="EResize" Cursor="SizeWE" BorderThickness="0,0,2,0" Grid.Column="4" Grid.RowSpan="5" DragDelta="UniversalDragDelta" DragStarted="EResize_DragStarted" Style="{DynamicResource CanvasZoneThumbStyle}"/>
<Thumb x:Name="NWResize" Cursor="SizeNWSE" BorderThickness="3,3,0,0" Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" Grid.ColumnSpan="2" DragDelta="UniversalDragDelta" DragStarted="NWResize_DragStarted" Style="{DynamicResource CanvasZoneThumbStyle}"/> <Thumb x:Name="NWResize" Cursor="SizeNWSE" BorderThickness="2,2,0,0" Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" Grid.ColumnSpan="2" DragDelta="UniversalDragDelta" DragStarted="NWResize_DragStarted" Style="{DynamicResource CanvasZoneThumbStyle}"/>
<Thumb x:Name="NEResize" Cursor="SizeNESW" BorderThickness="0,3,3,0" Grid.Row="0" Grid.Column="3" Grid.RowSpan="2" Grid.ColumnSpan="2" DragDelta="UniversalDragDelta" DragStarted="NEResize_DragStarted" Style="{DynamicResource CanvasZoneThumbStyle}"/> <Thumb x:Name="NEResize" Cursor="SizeNESW" BorderThickness="0,2,2,0" Grid.Row="0" Grid.Column="3" Grid.RowSpan="2" Grid.ColumnSpan="2" DragDelta="UniversalDragDelta" DragStarted="NEResize_DragStarted" Style="{DynamicResource CanvasZoneThumbStyle}"/>
<Thumb x:Name="SWResize" Cursor="SizeNESW" BorderThickness="3,0,0,3" Grid.Row="3" Grid.Column="0" Grid.RowSpan="2" Grid.ColumnSpan="2" DragDelta="UniversalDragDelta" DragStarted="SWResize_DragStarted" Style="{DynamicResource CanvasZoneThumbStyle}"/> <Thumb x:Name="SWResize" Cursor="SizeNESW" BorderThickness="2,0,0,2" Grid.Row="3" Grid.Column="0" Grid.RowSpan="2" Grid.ColumnSpan="2" DragDelta="UniversalDragDelta" DragStarted="SWResize_DragStarted" Style="{DynamicResource CanvasZoneThumbStyle}"/>
<Thumb x:Name="SEResize" Cursor="SizeNWSE" BorderThickness="0,0,3,3" Grid.Row="3" Grid.Column="3" Grid.RowSpan="2" Grid.ColumnSpan="2" DragDelta="UniversalDragDelta" DragStarted="SEResize_DragStarted" Style="{DynamicResource CanvasZoneThumbStyle}"/> <Thumb x:Name="SEResize" Cursor="SizeNWSE" BorderThickness="0,0,2,2" Grid.Row="3" Grid.Column="3" Grid.RowSpan="2" Grid.ColumnSpan="2" DragDelta="UniversalDragDelta" DragStarted="SEResize_DragStarted" Style="{DynamicResource CanvasZoneThumbStyle}"/>
<Button Content="&#xE894;" <Button Content="&#xE894;"
BorderThickness="0" BorderThickness="0"

View File

@@ -71,7 +71,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="System.IO.Abstractions" Version="12.2.5" /> <PackageReference Include="System.IO.Abstractions" Version="12.2.5" />
<PackageReference Include="System.Text.Json" Version="4.7.2" /> <PackageReference Include="System.Text.Json" Version="5.0.1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="images\FancyZonesEditor.ico" /> <Resource Include="images\FancyZonesEditor.ico" />

File diff suppressed because it is too large Load Diff

View File

@@ -1,604 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using FancyZonesEditor.Models;
namespace FancyZonesEditor
{
public class GridDragHandles
{
public GridDragHandles(UIElementCollection resizers, Action<object, DragDeltaEventArgs> dragDelta, Action<object, DragCompletedEventArgs> dragCompleted)
{
_resizers = resizers;
_dragDelta = dragDelta;
_dragCompleted = dragCompleted;
}
public void InitDragHandles(GridLayoutModel model)
{
if (_resizers.Count == 0)
{
int[,] indices = model.CellChildMap;
// horizontal resizers
for (int row = 0; row < model.Rows - 1; row++)
{
for (int col = 0; col < model.Columns; col++)
{
if (indices[row, col] != indices[row + 1, col])
{
int endCol = col + 1;
while (endCol < model.Columns && indices[row, endCol] != indices[row + 1, endCol])
{
endCol++;
}
AddDragHandle(Orientation.Horizontal, row, row + 1, col, endCol, row);
col = endCol - 1;
}
}
}
// vertical resizers
for (int col = 0; col < model.Columns - 1; col++)
{
for (int row = 0; row < model.Rows; row++)
{
if (indices[row, col] != indices[row, col + 1])
{
int endRow = row + 1;
while (endRow < model.Rows && indices[endRow, col] != indices[endRow, col + 1])
{
endRow++;
}
AddDragHandle(Orientation.Vertical, row, endRow, col, col + 1, col + model.Rows - 1);
row = endRow - 1;
}
}
}
}
}
public void AddDragHandle(Orientation orientation, int foundRow, int foundCol, GridLayoutModel model)
{
int[,] indices = model.CellChildMap;
int endRow = foundRow + 1;
while (endRow < model.Rows && indices[endRow, foundCol] == indices[endRow - 1, foundCol])
{
endRow++;
}
int endCol = foundCol + 1;
while (endCol < model.Columns && indices[foundRow, endCol] == indices[foundRow, endCol - 1])
{
endCol++;
}
int index = (orientation == Orientation.Horizontal) ? foundRow : foundCol + model.Rows - 1;
AddDragHandle(orientation, foundRow, endRow, foundCol, endCol, index);
}
public void AddDragHandle(Orientation orientation, int rowStart, int rowEnd, int colStart, int colEnd, int index)
{
GridResizer resizer = new GridResizer
{
Orientation = orientation,
StartRow = rowStart,
EndRow = rowEnd,
StartCol = colStart,
EndCol = colEnd,
};
resizer.DragDelta += (obj, eventArgs) => _dragDelta(obj, eventArgs);
resizer.DragCompleted += (obj, eventArgs) => _dragCompleted(obj, eventArgs);
if (index > _resizers.Count)
{
index = _resizers.Count;
}
_resizers.Insert(index, resizer);
}
public void UpdateForExistingVerticalSplit(GridLayoutModel model, int foundRow, int splitCol)
{
Func<GridResizer, bool> cmpr = (GridResizer resizer) =>
{
return resizer.Orientation == Orientation.Vertical && resizer.StartCol == splitCol;
};
Func<GridResizer, bool> endCmpr = (GridResizer resizer) =>
{
return resizer.EndRow == foundRow;
};
Func<GridResizer, bool> startCmpr = (GridResizer resizer) =>
{
return resizer.StartRow == foundRow + 1;
};
if (!UpdateDragHandlerForExistingSplit(Orientation.Vertical, cmpr, endCmpr, startCmpr))
{
AddDragHandle(Orientation.Vertical, foundRow, splitCol, model);
}
}
public void UpdateForExistingHorizontalSplit(GridLayoutModel model, int splitRow, int foundCol)
{
Func<GridResizer, bool> cmpr = (GridResizer resizer) =>
{
return resizer.Orientation == Orientation.Horizontal && resizer.StartRow == splitRow;
};
Func<GridResizer, bool> endCmpr = (GridResizer resizer) =>
{
return resizer.EndCol == foundCol;
};
Func<GridResizer, bool> startCmpr = (GridResizer resizer) =>
{
return resizer.StartCol == foundCol + 1;
};
if (!UpdateDragHandlerForExistingSplit(Orientation.Horizontal, cmpr, endCmpr, startCmpr))
{
AddDragHandle(Orientation.Horizontal, splitRow, foundCol, model);
}
}
/**
* Has to be called on split before adding new drag handle
*/
public void UpdateAfterVerticalSplit(int foundCol)
{
foreach (GridResizer r in _resizers)
{
if (r.StartCol > foundCol || (r.StartCol == foundCol && r.Orientation == Orientation.Vertical))
{
r.StartCol++;
}
if (r.EndCol > foundCol)
{
r.EndCol++;
}
}
}
/**
* Has to be called on split before adding new drag handle
*/
public void UpdateAfterHorizontalSplit(int foundRow)
{
foreach (GridResizer r in _resizers)
{
if (r.StartRow > foundRow || (r.StartRow == foundRow && r.Orientation == Orientation.Horizontal))
{
r.StartRow++;
}
if (r.EndRow > foundRow)
{
r.EndRow++;
}
}
}
public void UpdateAfterSwap(GridResizer resizer, double delta)
{
Orientation orientation = resizer.Orientation;
bool isHorizontal = orientation == Orientation.Horizontal;
bool isDeltaNegative = delta < 0;
List<GridResizer> swappedResizers = new List<GridResizer>();
if (isDeltaNegative)
{
DecreaseResizerValues(resizer, orientation);
}
else
{
IncreaseResizerValues(resizer, orientation);
}
// same orientation resizers update
foreach (GridResizer r in _resizers)
{
if (r.Orientation == orientation)
{
if ((isHorizontal && r.StartRow == resizer.StartRow && r.StartCol != resizer.StartCol) ||
(!isHorizontal && r.StartCol == resizer.StartCol && r.StartRow != resizer.StartRow))
{
if (isDeltaNegative)
{
IncreaseResizerValues(r, orientation);
}
else
{
DecreaseResizerValues(r, orientation);
}
swappedResizers.Add(r);
}
}
}
// different orientation resizers update
foreach (GridResizer r in _resizers)
{
if (r.Orientation != resizer.Orientation)
{
if (isHorizontal)
{
// vertical resizers corresponding to dragged resizer
if (r.StartCol >= resizer.StartCol && r.EndCol < resizer.EndCol)
{
if (r.StartRow == resizer.StartRow + 2 && isDeltaNegative)
{
r.StartRow--;
}
if (r.EndRow == resizer.EndRow + 1 && isDeltaNegative)
{
r.EndRow--;
}
if (r.StartRow == resizer.StartRow && !isDeltaNegative)
{
r.StartRow++;
}
if (r.EndRow == resizer.EndRow - 1 && !isDeltaNegative)
{
r.EndRow++;
}
}
else
{
// vertical resizers corresponding to swapped resizers
foreach (GridResizer sr in swappedResizers)
{
if (r.StartCol >= sr.StartCol && r.EndCol <= sr.EndCol)
{
if (r.StartRow == resizer.StartRow + 1 && isDeltaNegative)
{
r.StartRow++;
}
if (r.EndRow == resizer.EndRow && isDeltaNegative)
{
r.EndRow++;
}
if (r.StartRow == resizer.StartRow + 1 && !isDeltaNegative)
{
r.StartRow--;
}
if (r.EndRow == resizer.EndRow && !isDeltaNegative)
{
r.EndRow--;
}
}
}
}
}
else
{
// horizontal resizers corresponding to dragged resizer
if (r.StartRow >= resizer.StartRow && r.EndRow < resizer.EndRow)
{
if (r.StartCol == resizer.StartCol + 3 && isDeltaNegative)
{
r.StartCol--;
}
if (r.EndCol == resizer.EndCol + 1 && isDeltaNegative)
{
r.EndCol--;
}
if (r.StartCol == resizer.StartCol && !isDeltaNegative)
{
r.StartCol++;
}
if (r.EndCol == resizer.EndCol - 1 && !isDeltaNegative)
{
r.EndCol++;
}
}
else
{
// horizontal resizers corresponding to swapped resizers
foreach (GridResizer sr in swappedResizers)
{
if (r.StartRow >= sr.StartRow && r.EndRow <= sr.EndRow)
{
if (r.StartCol == resizer.StartCol + 1 && isDeltaNegative)
{
r.StartCol++;
}
if (r.EndCol == resizer.EndCol && isDeltaNegative)
{
r.EndCol++;
}
if (r.StartCol == resizer.StartCol + 1 && !isDeltaNegative)
{
r.StartCol--;
}
if (r.EndCol == resizer.EndCol && !isDeltaNegative)
{
r.EndCol--;
}
}
}
}
}
}
}
}
public void UpdateAfterDetach(GridResizer resizer, double delta)
{
bool isDeltaNegative = delta < 0;
Orientation orientation = resizer.Orientation;
foreach (GridResizer r in _resizers)
{
bool notEqual = r.StartRow != resizer.StartRow || r.EndRow != resizer.EndRow || r.StartCol != resizer.StartCol || r.EndCol != resizer.EndCol;
if (r.Orientation == orientation && notEqual)
{
if (orientation == Orientation.Horizontal)
{
if (r.StartRow > resizer.StartRow || (r.StartRow == resizer.StartRow && isDeltaNegative))
{
r.StartRow++;
}
if (r.EndRow > resizer.EndRow || (r.EndRow == resizer.EndRow && isDeltaNegative))
{
r.EndRow++;
}
}
else
{
if (r.StartCol > resizer.StartCol || (r.StartCol == resizer.StartCol && isDeltaNegative))
{
r.StartCol++;
}
if (r.EndCol > resizer.EndCol || (r.EndCol == resizer.EndCol && isDeltaNegative))
{
r.EndCol++;
}
}
}
}
if (!isDeltaNegative)
{
IncreaseResizerValues(resizer, orientation);
}
foreach (GridResizer r in _resizers)
{
if (r.Orientation != orientation)
{
if (orientation == Orientation.Vertical)
{
if (isDeltaNegative)
{
bool isRowNonAdjacent = r.EndRow < resizer.StartRow || r.StartRow > resizer.EndRow;
if (r.StartCol > resizer.StartCol + 1 || (r.StartCol == resizer.StartCol + 1 && isRowNonAdjacent))
{
r.StartCol++;
}
if (r.EndCol > resizer.EndCol || (r.EndCol == resizer.EndCol && isRowNonAdjacent))
{
r.EndCol++;
}
}
else
{
if (r.StartCol > resizer.StartCol || (r.StartCol == resizer.StartCol && r.StartRow >= resizer.StartRow && r.EndRow <= resizer.EndRow))
{
r.StartCol++;
}
if (r.EndCol > resizer.EndCol - 1 || (r.EndCol == resizer.EndCol - 1 && r.StartRow >= resizer.StartRow && r.EndRow <= resizer.EndRow))
{
r.EndCol++;
}
}
}
else
{
if (isDeltaNegative)
{
bool isColNonAdjacent = r.EndCol < resizer.StartCol || r.StartCol > resizer.EndCol;
if (r.StartRow > resizer.StartRow + 1 || (r.StartRow == resizer.StartRow + 1 && isColNonAdjacent))
{
r.StartRow++;
}
if (r.EndRow > resizer.EndRow || (r.EndRow == resizer.EndRow && isColNonAdjacent))
{
r.EndRow++;
}
}
else
{
if (r.StartRow > resizer.StartRow || (r.StartRow == resizer.StartRow && r.StartCol >= resizer.StartCol && r.EndCol <= resizer.EndCol))
{
r.StartRow++;
}
if (r.EndRow > resizer.EndRow - 1 || (r.EndRow == resizer.EndRow - 1 && r.StartCol >= resizer.StartCol && r.EndCol <= resizer.EndCol))
{
r.EndRow++;
}
}
}
}
}
}
public void RemoveDragHandles()
{
_resizers.Clear();
}
public bool HasSnappedNonAdjacentResizers(GridResizer resizer)
{
/**
* Resizers between zones 0,1 and 4,5 are snapped to each other and not adjacent.
* ------------------------------
* | 0 | 1 |
* ------------------------------
* | 2 | 3 |
* ------------------------------
* | 4 | 5 |
* ------------------------------
*
* Resizers between zones 0,1 and 2,3 are snapped to each other and adjacent.
* ------------------------------
* | 0 | 1 |
* ------------------------------
* | 2 | 3 |
* ------------------------------
* | 4 | 5 |
* ------------------------------
*
* Vertical resizers should have same StartColumn and different StartRow.
* Horizontal resizers should have same StartRow and different StartColumn.
* Difference between rows or columns should be more than 1.
*/
foreach (GridResizer r in _resizers)
{
if (r.Orientation == resizer.Orientation)
{
bool isHorizontalSnapped = resizer.Orientation == Orientation.Horizontal && r.StartRow == resizer.StartRow && (Math.Abs(resizer.StartCol - r.StartCol) > 1);
bool isVerticalSnapped = resizer.Orientation == Orientation.Vertical && r.StartCol == resizer.StartCol && (Math.Abs(resizer.StartRow - r.StartRow) > 1);
if (isHorizontalSnapped || isVerticalSnapped)
{
return true;
}
}
}
return false;
}
private static void IncreaseResizerValues(GridResizer resizer, Orientation orientation)
{
if (orientation == Orientation.Vertical)
{
resizer.StartCol++;
resizer.EndCol++;
}
else
{
resizer.StartRow++;
resizer.EndRow++;
}
}
private static void DecreaseResizerValues(GridResizer resizer, Orientation orientation)
{
if (orientation == Orientation.Vertical)
{
resizer.StartCol--;
resizer.EndCol--;
}
else
{
resizer.StartRow--;
resizer.EndRow--;
}
}
private bool UpdateDragHandlerForExistingSplit(Orientation orientation, Func<GridResizer, bool> cmpr, Func<GridResizer, bool> endCmpr, Func<GridResizer, bool> startCmpr)
{
bool updCurrentResizers = false;
GridResizer leftNeighbour = null;
GridResizer rightNeighbour = null;
for (int i = 0; i < _resizers.Count && (leftNeighbour == null || rightNeighbour == null); i++)
{
GridResizer resizer = (GridResizer)_resizers[i];
if (cmpr(resizer))
{
if (leftNeighbour == null && endCmpr(resizer))
{
leftNeighbour = resizer;
updCurrentResizers = true;
}
if (rightNeighbour == null && startCmpr(resizer))
{
rightNeighbour = resizer;
updCurrentResizers = true;
}
}
}
if (updCurrentResizers)
{
if (leftNeighbour != null && rightNeighbour != null)
{
if (orientation == Orientation.Vertical)
{
leftNeighbour.EndRow = rightNeighbour.EndRow;
}
else
{
leftNeighbour.EndCol = rightNeighbour.EndCol;
}
_resizers.Remove(rightNeighbour);
}
else if (leftNeighbour != null)
{
if (orientation == Orientation.Vertical)
{
leftNeighbour.EndRow++;
}
else
{
leftNeighbour.EndCol++;
}
}
else if (rightNeighbour != null)
{
if (orientation == Orientation.Vertical)
{
rightNeighbour.StartRow--;
}
else
{
rightNeighbour.StartCol--;
}
}
}
return updCurrentResizers;
}
private readonly UIElementCollection _resizers;
private readonly Action<object, DragDeltaEventArgs> _dragDelta;
private readonly Action<object, DragCompletedEventArgs> _dragCompleted;
}
}

View File

@@ -4,6 +4,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Input; using System.Windows.Input;
@@ -20,6 +21,9 @@ namespace FancyZonesEditor
private const string PropertyRowsChangedID = "Rows"; private const string PropertyRowsChangedID = "Rows";
private const string PropertyColumnsChangedID = "Columns"; private const string PropertyColumnsChangedID = "Columns";
private const string ObjectDependencyID = "Model"; private const string ObjectDependencyID = "Model";
private const string PropertyIsShiftKeyPressedID = "IsShiftKeyPressed";
private const int MinZoneSize = 100;
public static readonly DependencyProperty ModelProperty = DependencyProperty.Register(ObjectDependencyID, typeof(GridLayoutModel), typeof(GridEditor), new PropertyMetadata(null, OnGridDimensionsChanged)); public static readonly DependencyProperty ModelProperty = DependencyProperty.Register(ObjectDependencyID, typeof(GridLayoutModel), typeof(GridEditor), new PropertyMetadata(null, OnGridDimensionsChanged));
@@ -27,13 +31,15 @@ namespace FancyZonesEditor
private int gridEditorUniqueId; private int gridEditorUniqueId;
private GridData _data;
public GridEditor() public GridEditor()
{ {
InitializeComponent(); InitializeComponent();
Loaded += GridEditor_Loaded; Loaded += GridEditor_Loaded;
Unloaded += GridEditor_Unloaded; Unloaded += GridEditor_Unloaded;
((App)Application.Current).MainWindowSettings.PropertyChanged += ZoneSettings_PropertyChanged;
gridEditorUniqueId = ++gridEditorUniqueIdCounter; gridEditorUniqueId = ++gridEditorUniqueIdCounter;
((App)Application.Current).MainWindowSettings.PropertyChanged += ZoneSettings_PropertyChanged;
} }
private void GridEditor_Loaded(object sender, RoutedEventArgs e) private void GridEditor_Loaded(object sender, RoutedEventArgs e)
@@ -45,21 +51,127 @@ namespace FancyZonesEditor
} }
_data = new GridData(model); _data = new GridData(model);
_dragHandles = new GridDragHandles(AdornerLayer.Children, Resizer_DragDelta, Resizer_DragCompleted);
_dragHandles.InitDragHandles(model);
Model = model; Model = model;
Model.PropertyChanged += OnGridDimensionsChanged; Model.PropertyChanged += OnGridDimensionsChanged;
SetupUI();
int zoneCount = _data.ZoneCount;
for (int i = 0; i < zoneCount; i++)
{
AddZone();
} }
Rect workingArea = App.Overlay.WorkArea; private void PlaceResizer(GridResizer resizerThumb)
Size actualSize = new Size(workingArea.Width, workingArea.Height); {
ArrangeGridRects(actualSize); var leftZone = Preview.Children[resizerThumb.LeftReferenceZone];
var rightZone = Preview.Children[resizerThumb.RightReferenceZone];
var topZone = Preview.Children[resizerThumb.TopReferenceZone];
var bottomZone = Preview.Children[resizerThumb.BottomReferenceZone];
double left = Canvas.GetLeft(leftZone);
double right = Canvas.GetLeft(rightZone) + (rightZone as GridZone).MinWidth;
double top = Canvas.GetTop(topZone);
double bottom = Canvas.GetTop(bottomZone) + (bottomZone as GridZone).MinHeight;
double x = (left + right) / 2.0;
double y = (top + bottom) / 2.0;
Canvas.SetLeft(resizerThumb, x - 24);
Canvas.SetTop(resizerThumb, y - 24);
}
private void SetZonePanelSize(GridZone panel, GridData.Zone zone)
{
Size actualSize = WorkAreaSize();
double spacing = Model.ShowSpacing ? Model.Spacing : 0;
double topSpacing = zone.Top == 0 ? spacing : spacing / 2;
double bottomSpacing = zone.Bottom == GridData.Multiplier ? spacing : spacing / 2;
double leftSpacing = zone.Left == 0 ? spacing : spacing / 2;
double rightSpacing = zone.Right == GridData.Multiplier ? spacing : spacing / 2;
Canvas.SetTop(panel, (actualSize.Height * zone.Top / GridData.Multiplier) + topSpacing);
Canvas.SetLeft(panel, (actualSize.Width * zone.Left / GridData.Multiplier) + leftSpacing);
panel.MinWidth = Math.Max(1, (actualSize.Width * (zone.Right - zone.Left) / GridData.Multiplier) - leftSpacing - rightSpacing);
panel.MinHeight = Math.Max(1, (actualSize.Height * (zone.Bottom - zone.Top) / GridData.Multiplier) - topSpacing - bottomSpacing);
}
private void SetupUI()
{
Size actualSize = WorkAreaSize();
if (actualSize.Width < 1 || _data == null || Model == null)
{
return;
}
int spacing = Model.ShowSpacing ? Model.Spacing : 0;
_data.MinZoneWidth = Convert.ToInt32(GridData.Multiplier / actualSize.Width * (MinZoneSize + (2 * spacing)));
_data.MinZoneHeight = Convert.ToInt32(GridData.Multiplier / actualSize.Height * (MinZoneSize + (2 * spacing)));
Preview.Children.Clear();
AdornerLayer.Children.Clear();
Preview.Width = actualSize.Width;
Preview.Height = actualSize.Height;
MagneticSnap snapX = new MagneticSnap(GridData.PrefixSum(Model.ColumnPercents).GetRange(1, Model.ColumnPercents.Count - 1), actualSize.Width);
MagneticSnap snapY = new MagneticSnap(GridData.PrefixSum(Model.RowPercents).GetRange(1, Model.RowPercents.Count - 1), actualSize.Height);
for (int zoneIndex = 0; zoneIndex < _data.Zones.Count(); zoneIndex++)
{
// this is needed for the lambda
int zoneIndexCopy = zoneIndex;
var zone = _data.Zones[zoneIndex];
var zonePanel = new GridZone(spacing, snapX, snapY, (orientation, offset) => _data.CanSplit(zoneIndexCopy, offset, orientation), zone);
zonePanel.UpdateShiftState(((App)Application.Current).MainWindowSettings.IsShiftKeyPressed);
Preview.Children.Add(zonePanel);
zonePanel.Split += OnSplit;
zonePanel.MergeDrag += OnMergeDrag;
zonePanel.MergeComplete += OnMergeComplete;
SetZonePanelSize(zonePanel, zone);
zonePanel.LabelID.Content = zoneIndex + 1;
}
foreach (var resizer in _data.Resizers)
{
var resizerThumb = new GridResizer();
resizerThumb.DragStarted += Resizer_DragStarted;
resizerThumb.DragDelta += Resizer_DragDelta;
resizerThumb.DragCompleted += Resizer_DragCompleted;
resizerThumb.Orientation = resizer.Orientation;
AdornerLayer.Children.Add(resizerThumb);
if (resizer.Orientation == Orientation.Horizontal)
{
resizerThumb.LeftReferenceZone = resizer.PositiveSideIndices[0];
resizerThumb.RightReferenceZone = resizer.PositiveSideIndices.Last();
resizerThumb.TopReferenceZone = resizer.PositiveSideIndices[0];
resizerThumb.BottomReferenceZone = resizer.NegativeSideIndices[0];
}
else
{
resizerThumb.LeftReferenceZone = resizer.PositiveSideIndices[0];
resizerThumb.RightReferenceZone = resizer.NegativeSideIndices[0];
resizerThumb.TopReferenceZone = resizer.PositiveSideIndices[0];
resizerThumb.BottomReferenceZone = resizer.PositiveSideIndices.Last();
}
PlaceResizer(resizerThumb);
}
}
private void OnSplit(object sender, SplitEventArgs args)
{
MergeCancelClick(null, null);
var zonePanel = sender as GridZone;
int zoneIndex = Preview.Children.IndexOf(zonePanel);
if (_data.CanSplit(zoneIndex, args.Offset, args.Orientation))
{
_data.Split(zoneIndex, args.Offset, args.Orientation);
SetupUI();
}
} }
private void GridEditor_Unloaded(object sender, RoutedEventArgs e) private void GridEditor_Unloaded(object sender, RoutedEventArgs e)
@@ -67,16 +179,10 @@ namespace FancyZonesEditor
gridEditorUniqueId = -1; gridEditorUniqueId = -1;
} }
private void ZoneSettings_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) private Size WorkAreaSize()
{ {
Rect workingArea = App.Overlay.WorkArea; Rect workingArea = App.Overlay.WorkArea;
Size actualSize = new Size(workingArea.Width, workingArea.Height); return new Size(workingArea.Width, workingArea.Height);
// Only enter if this is the newest instance
if (actualSize.Width > 0 && gridEditorUniqueId == gridEditorUniqueIdCounter)
{
ArrangeGridRects(actualSize);
}
} }
public GridLayoutModel Model public GridLayoutModel Model
@@ -90,258 +196,6 @@ namespace FancyZonesEditor
get { return Preview; } get { return Preview; }
} }
private void OnFullSplit(object o, SplitEventArgs e)
{
UIElementCollection previewChildren = Preview.Children;
UIElement splitee = (UIElement)o;
GridLayoutModel model = Model;
int spliteeIndex = previewChildren.IndexOf(splitee);
int rows = model.Rows;
int cols = model.Columns;
_startRow = -1;
_startCol = -1;
for (int row = rows - 1; row >= 0; row--)
{
for (int col = cols - 1; col >= 0; col--)
{
if (model.CellChildMap[row, col] == spliteeIndex)
{
_dragHandles.RemoveDragHandles();
_startRow = _endRow = row;
_startCol = _endCol = col;
ExtendRangeToHaveEvenCellEdges();
for (row = _startRow; row <= _endRow; row++)
{
for (col = _startCol; col <= _endCol; col++)
{
if ((row != _startRow) || (col != _startCol))
{
model.CellChildMap[row, col] = AddZone();
}
}
}
OnGridDimensionsChanged();
return;
}
}
}
}
private void ExtendRangeToHaveEvenCellEdges()
{
// As long as there is an edge of the 2D range such that some zone crosses its boundary, extend
// that boundary. A single pass is not enough, a while loop is needed. This results in the unique
// smallest rectangle containing the initial range such that no zone is "broken", meaning that
// some part of it is inside the 2D range, and some part is outside.
GridLayoutModel model = Model;
bool possiblyBroken = true;
while (possiblyBroken)
{
possiblyBroken = false;
for (int col = _startCol; col <= _endCol; col++)
{
if (_startRow > 0 && model.CellChildMap[_startRow - 1, col] == model.CellChildMap[_startRow, col])
{
_startRow--;
possiblyBroken = true;
break;
}
if (_endRow < model.Rows - 1 && model.CellChildMap[_endRow + 1, col] == model.CellChildMap[_endRow, col])
{
_endRow++;
possiblyBroken = true;
break;
}
}
for (int row = _startRow; row <= _endRow; row++)
{
if (_startCol > 0 && model.CellChildMap[row, _startCol - 1] == model.CellChildMap[row, _startCol])
{
_startCol--;
possiblyBroken = true;
break;
}
if (_endCol < model.Columns - 1 && model.CellChildMap[row, _endCol + 1] == model.CellChildMap[row, _endCol])
{
_endCol++;
possiblyBroken = true;
break;
}
}
}
}
private void OnSplit(object o, SplitEventArgs e)
{
MergeCancelClick(null, null);
UIElementCollection previewChildren = Preview.Children;
GridZone splitee = (GridZone)o;
int spliteeIndex = previewChildren.IndexOf(splitee);
GridLayoutModel model = Model;
int rows = model.Rows;
int cols = model.Columns;
Tuple<int, int> rowCol = _data.RowColByIndex(spliteeIndex);
int foundRow = rowCol.Item1;
int foundCol = rowCol.Item2;
int newChildIndex = AddZone();
double offset = e.Offset;
double space = e.Space;
if (e.Orientation == Orientation.Vertical)
{
if (splitee.VerticalSnapPoints != null)
{
offset += Canvas.GetLeft(splitee);
int count = splitee.VerticalSnapPoints.Length;
bool foundExistingSplit = false;
int splitCol = foundCol;
for (int i = 0; i <= count; i++)
{
if (foundExistingSplit)
{
int walkRow = foundRow;
while ((walkRow < rows) && (_data.GetIndex(walkRow, foundCol + i) == spliteeIndex))
{
_data.SetIndex(walkRow++, foundCol + i, newChildIndex);
}
}
if (_data.ColumnBottom(foundCol + i) == offset)
{
foundExistingSplit = true;
splitCol = foundCol + i;
// use existing division
}
}
if (foundExistingSplit)
{
_data.ReplaceIndicesToMaintainOrder(Preview.Children.Count);
_dragHandles.UpdateForExistingVerticalSplit(model, foundRow, splitCol);
OnGridDimensionsChanged();
return;
}
while (_data.ColumnBottom(foundCol) < offset)
{
foundCol++;
}
offset -= _data.ColumnTop(foundCol);
}
_dragHandles.UpdateAfterVerticalSplit(foundCol);
_data.SplitColumn(foundCol, spliteeIndex, newChildIndex, space, offset, App.Overlay.WorkArea.Width);
_dragHandles.AddDragHandle(Orientation.Vertical, foundRow, foundCol, model);
}
else
{
// Horizontal
if (splitee.HorizontalSnapPoints != null)
{
offset += Canvas.GetTop(splitee);
int count = splitee.HorizontalSnapPoints.Length;
bool foundExistingSplit = false;
int splitRow = foundRow;
for (int i = 0; i <= count; i++)
{
if (foundExistingSplit)
{
int walkCol = foundCol;
while ((walkCol < cols) && (_data.GetIndex(foundRow + i, walkCol) == spliteeIndex))
{
_data.SetIndex(foundRow + i, walkCol++, newChildIndex);
}
}
if (_data.RowEnd(foundRow + i) == offset)
{
foundExistingSplit = true;
splitRow = foundRow + i;
// use existing division
}
}
if (foundExistingSplit)
{
_data.ReplaceIndicesToMaintainOrder(Preview.Children.Count);
_dragHandles.UpdateForExistingHorizontalSplit(model, splitRow, foundCol);
OnGridDimensionsChanged();
return;
}
while (_data.RowEnd(foundRow) < offset)
{
foundRow++;
}
offset -= _data.RowStart(foundRow);
}
_dragHandles.UpdateAfterHorizontalSplit(foundRow);
_data.SplitRow(foundRow, spliteeIndex, newChildIndex, space, offset, App.Overlay.WorkArea.Height);
_dragHandles.AddDragHandle(Orientation.Horizontal, foundRow, foundCol, model);
}
var workArea = App.Overlay.WorkArea;
Size actualSize = new Size(workArea.Width, workArea.Height);
ArrangeGridRects(actualSize);
}
private void DeleteZone(int index)
{
Preview.Children.RemoveAt(index);
}
private int AddZone()
{
GridZone zone;
if (Model != null)
{
IList<int> freeZones = Model.FreeZones;
// first check free list
if (freeZones.Count > 0)
{
int freeIndex = freeZones[0];
freeZones.RemoveAt(0);
zone = (GridZone)Preview.Children[freeIndex];
zone.Visibility = Visibility.Visible;
return freeIndex;
}
zone = new GridZone(Model.ShowSpacing ? Model.Spacing : 0);
zone.Split += OnSplit;
zone.MergeDrag += OnMergeDrag;
zone.MergeComplete += OnMergeComplete;
zone.FullSplit += OnFullSplit;
Preview.Children.Add(zone);
return Preview.Children.Count - 1;
}
return 0;
}
private void OnGridDimensionsChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) private void OnGridDimensionsChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{ {
// Only enter if this is the newest instance // Only enter if this is the newest instance
@@ -351,230 +205,201 @@ namespace FancyZonesEditor
} }
} }
private void ZoneSettings_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if ((e.PropertyName == PropertyIsShiftKeyPressedID) && gridEditorUniqueId == gridEditorUniqueIdCounter)
{
foreach (var child in Preview.Children)
{
var zone = child as GridZone;
zone.UpdateShiftState(((App)Application.Current).MainWindowSettings.IsShiftKeyPressed);
}
}
}
private static void OnGridDimensionsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) private static void OnGridDimensionsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{ {
((GridEditor)d).OnGridDimensionsChanged(); ((GridEditor)d).SetupUI();
} }
private void OnGridDimensionsChanged() private void OnGridDimensionsChanged()
{ {
Rect workingArea = App.Overlay.WorkArea; SetupUI();
Size actualSize = new Size(workingArea.Width, workingArea.Height);
if (actualSize.Width > 0)
{
ArrangeGridRects(actualSize);
}
} }
private void ArrangeGridRects(Size arrangeSize) private double _dragX = 0;
private double _dragY = 0;
private void Resizer_DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e)
{ {
var workArea = App.Overlay.WorkArea; _dragX = 0;
Preview.Width = workArea.Width; _dragY = 0;
Preview.Height = workArea.Height;
GridLayoutModel model = Model;
if (model == null || _data == null)
{
return;
}
if (model.Rows != model.RowPercents.Count || model.Columns != model.ColumnPercents.Count)
{
// Merge was not finished
return;
}
int spacing = model.ShowSpacing ? model.Spacing : 0;
_data.RecalculateZones(spacing, arrangeSize);
_data.ArrangeZones(Preview.Children, spacing);
_dragHandles.InitDragHandles(model);
_data.ArrangeResizers(AdornerLayer.Children, spacing);
} }
private void Resizer_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) private void Resizer_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e)
{ {
MergeCancelClick(null, null); MergeCancelClick(null, null);
_dragX += e.HorizontalChange;
_dragY += e.VerticalChange;
GridResizer resizer = (GridResizer)sender; GridResizer resizer = (GridResizer)sender;
int resizerIndex = AdornerLayer.Children.IndexOf(resizer);
double delta = (resizer.Orientation == Orientation.Vertical) ? e.HorizontalChange : e.VerticalChange; Size actualSize = WorkAreaSize();
if (delta == 0)
{
return;
}
GridData.ResizeInfo resizeInfo = _data.CalculateResizeInfo(resizer, delta); int delta;
if (resizeInfo.IsResizeAllowed)
{
if (_dragHandles.HasSnappedNonAdjacentResizers(resizer))
{
double spacing = 0;
GridLayoutModel model = Model;
if (model.ShowSpacing)
{
spacing = model.Spacing;
}
_data.SplitOnDrag(resizer, delta, spacing); if (resizer.Orientation == Orientation.Vertical)
_dragHandles.UpdateAfterDetach(resizer, delta); {
delta = Convert.ToInt32(_dragX / actualSize.Width * GridData.Multiplier);
} }
else else
{ {
_data.DragResizer(resizer, resizeInfo); delta = Convert.ToInt32(_dragY / actualSize.Height * GridData.Multiplier);
if (_data.SwapNegativePercents(resizer.Orientation, resizer.StartRow, resizer.EndRow, resizer.StartCol, resizer.EndCol))
{
_dragHandles.UpdateAfterSwap(resizer, delta);
}
}
} }
Rect workingArea = App.Overlay.WorkArea; if (_data.CanDrag(resizerIndex, delta))
Size actualSize = new Size(workingArea.Width, workingArea.Height); {
ArrangeGridRects(actualSize); // Just update the UI, don't tell _data
AdornerLayer.UpdateLayout(); if (resizer.Orientation == Orientation.Vertical)
{
_data.Resizers[resizerIndex].PositiveSideIndices.ForEach((zoneIndex) =>
{
var zone = Preview.Children[zoneIndex];
Canvas.SetLeft(zone, Canvas.GetLeft(zone) + e.HorizontalChange);
(zone as GridZone).MinWidth -= e.HorizontalChange;
});
_data.Resizers[resizerIndex].NegativeSideIndices.ForEach((zoneIndex) =>
{
var zone = Preview.Children[zoneIndex];
Canvas.SetRight(zone, Canvas.GetRight(zone) + e.HorizontalChange);
(zone as GridZone).MinWidth += e.HorizontalChange;
});
Canvas.SetLeft(resizer, Canvas.GetLeft(resizer) + e.HorizontalChange);
}
else
{
_data.Resizers[resizerIndex].PositiveSideIndices.ForEach((zoneIndex) =>
{
var zone = Preview.Children[zoneIndex];
Canvas.SetTop(zone, Canvas.GetTop(zone) + e.VerticalChange);
(zone as GridZone).MinHeight -= e.VerticalChange;
});
_data.Resizers[resizerIndex].NegativeSideIndices.ForEach((zoneIndex) =>
{
var zone = Preview.Children[zoneIndex];
Canvas.SetBottom(zone, Canvas.GetBottom(zone) + e.VerticalChange);
(zone as GridZone).MinHeight += e.VerticalChange;
});
Canvas.SetTop(resizer, Canvas.GetTop(resizer) + e.VerticalChange);
}
foreach (var child in AdornerLayer.Children)
{
GridResizer resizerThumb = child as GridResizer;
if (resizerThumb != resizer)
{
PlaceResizer(resizerThumb);
}
}
}
else
{
// Undo changes
_dragX -= e.HorizontalChange;
_dragY -= e.VerticalChange;
}
} }
private void Resizer_DragCompleted(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e) private void Resizer_DragCompleted(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e)
{ {
GridResizer resizer = (GridResizer)sender; GridResizer resizer = (GridResizer)sender;
int index = _data.SwappedIndexAfterResize(resizer); int resizerIndex = AdornerLayer.Children.IndexOf(resizer);
if (index != -1) Size actualSize = WorkAreaSize();
{
Rect workingArea = App.Overlay.WorkArea;
Size actualSize = new Size(workingArea.Width, workingArea.Height);
ArrangeGridRects(actualSize);
}
}
private Point _startDragPos = new Point(-1, -1); double pixelDelta = resizer.Orientation == Orientation.Vertical ?
_dragX / actualSize.Width * GridData.Multiplier :
_dragY / actualSize.Height * GridData.Multiplier;
_data.Drag(resizerIndex, Convert.ToInt32(pixelDelta));
SetupUI();
}
private void OnMergeComplete(object o, MouseButtonEventArgs e) private void OnMergeComplete(object o, MouseButtonEventArgs e)
{ {
Point mousePoint = e.GetPosition(Preview); _inMergeDrag = false;
_startDragPos = new Point(-1, -1);
int mergedIndex = Model.CellChildMap[_startRow, _startCol]; var selectedIndices = new List<int>();
for (int zoneIndex = 0; zoneIndex < _data.Zones.Count; zoneIndex++)
for (int row = _startRow; row <= _endRow; row++)
{ {
for (int col = _startCol; col <= _endCol; col++) if ((Preview.Children[zoneIndex] as GridZone).IsSelected)
{ {
if (Model.CellChildMap[row, col] != mergedIndex) selectedIndices.Add(zoneIndex);
{
// selection is more than one cell, merge is valid
MergePanel.Visibility = Visibility.Visible;
Canvas.SetTop(MergeButtons, mousePoint.Y);
Canvas.SetLeft(MergeButtons, mousePoint.X);
return;
}
} }
} }
// merge is only one zone. cancel merge; if (selectedIndices.Count <= 1)
{
ClearSelection(); ClearSelection();
} }
else
{
Point mousePoint = e.GetPosition(Preview);
MergePanel.Visibility = Visibility.Visible;
Canvas.SetLeft(MergeButtons, mousePoint.X);
Canvas.SetTop(MergeButtons, mousePoint.Y);
}
}
private bool _inMergeDrag;
private Point _mergeDragStart;
private void OnMergeDrag(object o, MouseEventArgs e) private void OnMergeDrag(object o, MouseEventArgs e)
{ {
if (_startDragPos.X == -1) Point dragPosition = e.GetPosition(Preview);
Size actualSize = WorkAreaSize();
if (!_inMergeDrag)
{ {
_startDragPos = e.GetPosition(Preview); _inMergeDrag = true;
_mergeDragStart = dragPosition;
} }
GridLayoutModel model = Model; // Find the new zone, if any
int dataLowX = Convert.ToInt32(Math.Min(_mergeDragStart.X, dragPosition.X) / actualSize.Width * GridData.Multiplier);
int dataHighX = Convert.ToInt32(Math.Max(_mergeDragStart.X, dragPosition.X) / actualSize.Width * GridData.Multiplier);
int dataLowY = Convert.ToInt32(Math.Min(_mergeDragStart.Y, dragPosition.Y) / actualSize.Height * GridData.Multiplier);
int dataHighY = Convert.ToInt32(Math.Max(_mergeDragStart.Y, dragPosition.Y) / actualSize.Height * GridData.Multiplier);
if (_startDragPos.X != -1) var selectedIndices = new List<int>();
{
Point dragPos = e.GetPosition(Preview);
_startRow = -1;
_endRow = -1;
_startCol = -1;
_endCol = -1;
int rows = model.Rows; for (int zoneIndex = 0; zoneIndex < _data.Zones.Count(); zoneIndex++)
int cols = model.Columns; {
var zoneData = _data.Zones[zoneIndex];
double minX, maxX; bool selected = Math.Max(zoneData.Left, dataLowX) <= Math.Min(zoneData.Right, dataHighX) &&
if (dragPos.X < _startDragPos.X) Math.Max(zoneData.Top, dataLowY) <= Math.Min(zoneData.Bottom, dataHighY);
{
minX = dragPos.X;
maxX = _startDragPos.X;
}
else
{
minX = _startDragPos.X;
maxX = dragPos.X;
}
double minY, maxY; // Check whether the zone intersects the selected rectangle
if (dragPos.Y < _startDragPos.Y) (Preview.Children[zoneIndex] as GridZone).IsSelected = selected;
{
minY = dragPos.Y;
maxY = _startDragPos.Y;
}
else
{
minY = _startDragPos.Y;
maxY = dragPos.Y;
}
for (int row = 0; row < rows; row++) if (selected)
{ {
if (_startRow == -1) selectedIndices.Add(zoneIndex);
{
if (_data.RowEnd(row) > minY)
{
_startRow = row;
}
}
else if (_data.RowStart(row) > maxY)
{
_endRow = row - 1;
break;
} }
} }
if ((_startRow >= 0) && (_endRow == -1)) // Compute the closure
_data.MergeClosureIndices(selectedIndices).ForEach((zoneIndex) =>
{ {
_endRow = rows - 1; (Preview.Children[zoneIndex] as GridZone).IsSelected = true;
} });
for (int col = 0; col < cols; col++)
{
if (_startCol == -1)
{
if (_data.ColumnBottom(col) > minX)
{
_startCol = col;
}
}
else if (_data.ColumnTop(col) > maxX)
{
_endCol = col - 1;
break;
}
}
if ((_startCol >= 0) && (_endCol == -1))
{
_endCol = cols - 1;
}
ExtendRangeToHaveEvenCellEdges();
for (int row = 0; row < rows; row++)
{
for (int col = 0; col < cols; col++)
{
((GridZone)Preview.Children[model.CellChildMap[row, col]]).IsSelected = (row >= _startRow) && (row <= _endRow) && (col >= _startCol) && (col <= _endCol);
}
}
e.Handled = true;
}
OnPreviewMouseMove(e);
} }
private void ClearSelection() private void ClearSelection()
@@ -583,22 +408,27 @@ namespace FancyZonesEditor
{ {
((GridZone)zone).IsSelected = false; ((GridZone)zone).IsSelected = false;
} }
_inMergeDrag = false;
} }
private void MergeClick(object sender, RoutedEventArgs e) private void MergeClick(object sender, RoutedEventArgs e)
{ {
MergePanel.Visibility = Visibility.Collapsed; MergePanel.Visibility = Visibility.Collapsed;
Action<int> deleteAction = (index) => var selectedIndices = new List<int>();
{
DeleteZone(index); for (int zoneIndex = 0; zoneIndex < _data.Zones.Count(); zoneIndex++)
}; {
_data.MergeZones(_startRow, _endRow, _startCol, _endCol, deleteAction, Preview.Children.Count); if ((Preview.Children[zoneIndex] as GridZone).IsSelected)
_dragHandles.RemoveDragHandles(); {
_dragHandles.InitDragHandles(Model); selectedIndices.Add(zoneIndex);
}
}
OnGridDimensionsChanged();
ClearSelection(); ClearSelection();
_data.DoMerge(selectedIndices);
SetupUI();
} }
private void MergeCancelClick(object sender, RoutedEventArgs e) private void MergeCancelClick(object sender, RoutedEventArgs e)
@@ -615,17 +445,9 @@ namespace FancyZonesEditor
protected override Size ArrangeOverride(Size arrangeBounds) protected override Size ArrangeOverride(Size arrangeBounds)
{ {
Size returnSize = base.ArrangeOverride(arrangeBounds); Size returnSize = base.ArrangeOverride(arrangeBounds);
ArrangeGridRects(arrangeBounds); SetupUI();
return returnSize; return returnSize;
} }
private GridData _data;
private GridDragHandles _dragHandles;
private int _startRow = -1;
private int _endRow = -1;
private int _startCol = -1;
private int _endCol = -1;
} }
} }

Some files were not shown because too many files have changed in this diff Show More