From aebd7657efb465ffb005441ab1c9604dc70b39ea Mon Sep 17 00:00:00 2001 From: Arjun Balgovind <32061677+arjunbalgovind@users.noreply.github.com> Date: Mon, 24 Aug 2020 17:50:41 -0700 Subject: [PATCH] [Localization] Migrate resources to resx for FancyZones (#6106) * Added localization code to pipeline and created one LocProject json for Settings * Fixed typo * Reordered nuget source * Moved nuget install to restore step * Added FZ.rc file to LocProj * Added FZ resx file and modified rc file --- .../fancyzones/dll/FancyZonesModule.vcxproj | 2 +- .../dll/FancyZonesModule.vcxproj.filters | 14 +- src/modules/fancyzones/dll/dllmain.cpp | 2 +- .../fancyzones/lib/FancyZonesLib.vcxproj | 12 +- .../lib/FancyZonesLib.vcxproj.filters | 25 +- src/modules/fancyzones/lib/LocProject.json | 14 ++ src/modules/fancyzones/lib/Resources.resx | 216 ++++++++++++++++++ src/modules/fancyzones/lib/fancyzones.base.rc | 40 ++++ src/modules/fancyzones/lib/fancyzones.rc | 72 ------ src/modules/fancyzones/lib/pch.h | 2 +- src/modules/fancyzones/lib/resource.base.h | 13 ++ src/modules/fancyzones/lib/resource.h | 46 ---- 12 files changed, 325 insertions(+), 133 deletions(-) create mode 100644 src/modules/fancyzones/lib/LocProject.json create mode 100644 src/modules/fancyzones/lib/Resources.resx create mode 100644 src/modules/fancyzones/lib/fancyzones.base.rc delete mode 100644 src/modules/fancyzones/lib/fancyzones.rc create mode 100644 src/modules/fancyzones/lib/resource.base.h delete mode 100644 src/modules/fancyzones/lib/resource.h diff --git a/src/modules/fancyzones/dll/FancyZonesModule.vcxproj b/src/modules/fancyzones/dll/FancyZonesModule.vcxproj index ed6379e60c..85adb7f0b4 100644 --- a/src/modules/fancyzones/dll/FancyZonesModule.vcxproj +++ b/src/modules/fancyzones/dll/FancyZonesModule.vcxproj @@ -124,7 +124,7 @@ - + diff --git a/src/modules/fancyzones/dll/FancyZonesModule.vcxproj.filters b/src/modules/fancyzones/dll/FancyZonesModule.vcxproj.filters index d90f9e60e7..c7ebbe4263 100644 --- a/src/modules/fancyzones/dll/FancyZonesModule.vcxproj.filters +++ b/src/modules/fancyzones/dll/FancyZonesModule.vcxproj.filters @@ -23,11 +23,19 @@ {2f10207d-d8d1-4a42-8027-8ca597b3cb23} - - - + + {a4241930-ecae-44e2-be82-25eff2499fcd} + + + {8d479404-964b-4eb1-8fe8-554be3e68c9b} + + + + Generated Files + + \ No newline at end of file diff --git a/src/modules/fancyzones/dll/dllmain.cpp b/src/modules/fancyzones/dll/dllmain.cpp index 8c5ff082cc..5850b74e72 100644 --- a/src/modules/fancyzones/dll/dllmain.cpp +++ b/src/modules/fancyzones/dll/dllmain.cpp @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/modules/fancyzones/lib/FancyZonesLib.vcxproj b/src/modules/fancyzones/lib/FancyZonesLib.vcxproj index 8d40d85356..29c395eaa0 100644 --- a/src/modules/fancyzones/lib/FancyZonesLib.vcxproj +++ b/src/modules/fancyzones/lib/FancyZonesLib.vcxproj @@ -11,6 +11,9 @@ x64 + + + 16.0 {F9C68EDF-AC74-4B77-9AF1-005D9C9F6A99} @@ -109,7 +112,8 @@ - + + @@ -141,11 +145,15 @@ - + + + + + diff --git a/src/modules/fancyzones/lib/FancyZonesLib.vcxproj.filters b/src/modules/fancyzones/lib/FancyZonesLib.vcxproj.filters index ceede79abc..620e7c6e82 100644 --- a/src/modules/fancyzones/lib/FancyZonesLib.vcxproj.filters +++ b/src/modules/fancyzones/lib/FancyZonesLib.vcxproj.filters @@ -13,6 +13,9 @@ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + {093625ff-2415-4c2c-842c-0ee7fcb1d203} + @@ -36,9 +39,6 @@ Header Files - - Header Files - Header Files @@ -69,6 +69,8 @@ Header Files + + Generated Files Header Files @@ -124,11 +126,20 @@ - - Source Files - + + + Header Files + + + Resource Files + + + Resource Files + - + + Generated Files + \ No newline at end of file diff --git a/src/modules/fancyzones/lib/LocProject.json b/src/modules/fancyzones/lib/LocProject.json new file mode 100644 index 0000000000..3d87019387 --- /dev/null +++ b/src/modules/fancyzones/lib/LocProject.json @@ -0,0 +1,14 @@ +{ + "Projects": [ + { + "LanguageSet": "Azure_Languages", + "LocItems": [ + { + "SourceFile": "src\\modules\\fancyzones\\lib\\Resources.resx", + "CopyOption": "LangIDOnName", + "OutputPath": "src\\modules\\fancyzones\\lib" + } + ] + } + ] +} diff --git a/src/modules/fancyzones/lib/Resources.resx b/src/modules/fancyzones/lib/Resources.resx new file mode 100644 index 0000000000..5bf4d4b2bb --- /dev/null +++ b/src/modules/fancyzones/lib/Resources.resx @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Create window layouts to help make multi-tasking easy + + + Hold Shift key to activate zones while dragging + + + Use a non-primary mouse button to toggle zone activation + + + Override Windows Snap hotkeys (Win + Arrow) to move windows between zones + + + Move windows between zones across all monitors when snapping with (Win + Arrow) + + + Move windows based on their position when snapping with (Win + Arrow) + + + Keep windows in their zones when the screen resolution changes + + + During zone layout changes, windows assigned to a zone will match new size/positions + + + Flash zones when the active FancyZones layout changes + + + Show zones on all monitors while dragging a window + + + Allow zones to span across monitors + + + Make dragged window transparent + + + Zone inactive color (Default #F5FCFF) + + + Zone border color (Default #FFFFFF) + + + Zone highlight color (Default #008CFF) + + + Follow mouse cursor instead of focus when launching editor in a multi screen environment + + + Move newly created windows to their last known zone + + + Move newly created windows to the current active monitor [EXPERIMENTAL] + + + Restore the original size of windows when unsnapping + + + Zone configuration + + + Edit zones + + + To launch the zone editor, select the Edit zones button below or press the zone editor hotkey anytime + + + Configure the zone editor hotkey + + + To exclude an application from snapping to zones add its name here (one per line). Excluded apps will react to the Windows Snap regardless of all other settings. + + + Zone opacity (%) + + + FancyZones + + + We've detected an application running with administrator privileges. This blocks some functionality in PowerToys. Visit our wiki page to learn more. + + + Learn more + + + Don't show again + + + Cannot install keyboard listener. + + + Cannot install Windows event listener. + + + PowerToys - FancyZones + + \ No newline at end of file diff --git a/src/modules/fancyzones/lib/fancyzones.base.rc b/src/modules/fancyzones/lib/fancyzones.base.rc new file mode 100644 index 0000000000..097910d703 --- /dev/null +++ b/src/modules/fancyzones/lib/fancyzones.base.rc @@ -0,0 +1,40 @@ +#include +#include "resource.h" +#include "../../../../common/version.h" + +#define APSTUDIO_READONLY_SYMBOLS +#include "winres.h" +#undef APSTUDIO_READONLY_SYMBOLS + +1 VERSIONINFO + FILEVERSION FILE_VERSION + PRODUCTVERSION PRODUCT_VERSION + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS_NT_WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE VFT2_UNKNOWN +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", COMPANY_NAME + VALUE "FileDescription", FILE_DESCRIPTION + VALUE "FileVersion", FILE_VERSION_STRING + VALUE "InternalName", INTERNAL_NAME + VALUE "LegalCopyright", COPYRIGHT_NOTE + VALUE "OriginalFilename", ORIGINAL_FILENAME + VALUE "ProductName", PRODUCT_NAME + VALUE "ProductVersion", PRODUCT_VERSION_STRING + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/src/modules/fancyzones/lib/fancyzones.rc b/src/modules/fancyzones/lib/fancyzones.rc deleted file mode 100644 index 21d82f1e3d..0000000000 --- a/src/modules/fancyzones/lib/fancyzones.rc +++ /dev/null @@ -1,72 +0,0 @@ -#include -#include "resource.h" -#include "../../../common/version.h" - -STRINGTABLE -BEGIN - IDS_SETTING_DESCRIPTION "Create window layouts to help make multi-tasking easy" - IDS_SETTING_DESCRIPTION_SHIFTDRAG "Hold Shift key to activate zones while dragging" - IDS_SETTING_DESCRIPTION_MOUSESWITCH "Use a non-primary mouse button to toggle zone activation" - IDS_SETTING_DESCRIPTION_OVERRIDE_SNAP_HOTKEYS "Override Windows Snap hotkeys (Win + Arrow) to move windows between zones" - IDS_SETTING_DESCRIPTION_MOVE_WINDOW_ACROSS_MONITORS "Move windows between zones across all monitors when snapping with (Win + Arrow)" - IDS_SETTING_DESCRIPTION_MOVE_WINDOWS_BASED_ON_POSITION "Move windows based on their position when snapping with (Win + Arrow)" - IDS_SETTING_DESCRIPTION_DISPLAYCHANGE_MOVEWINDOWS "Keep windows in their zones when the screen resolution changes" - IDS_SETTING_DESCRIPTION_ZONESETCHANGE_MOVEWINDOWS "During zone layout changes, windows assigned to a zone will match new size/positions" - IDS_SETTING_DESCRIPTION_ZONESETCHANGE_FLASHZONES "Flash zones when the active FancyZones layout changes" - IDS_SETTING_DESCRIPTION_SHOW_FANCY_ZONES_ON_ALL_MONITORS "Show zones on all monitors while dragging a window" - IDS_SETTING_DESCRIPTION_SPAN_ZONES_ACROSS_MONITORS "Allow zones to span across monitors" - IDS_SETTING_DESCRIPTION_MAKE_DRAGGED_WINDOW_TRANSPARENT "Make dragged window transparent" - IDS_SETTING_DESCRIPTION_ZONECOLOR "Zone inactive color (Default #F5FCFF)" - IDS_SETTING_DESCRIPTION_ZONE_BORDER_COLOR "Zone border color (Default #FFFFFF)" - IDS_SETTING_DESCRIPTION_ZONEHIGHLIGHTCOLOR "Zone highlight color (Default #008CFF)" - IDS_SETTING_DESCRIPTION_USE_CURSORPOS_EDITOR_STARTUPSCREEN "Follow mouse cursor instead of focus when launching editor in a multi screen environment" - IDS_SETTING_DESCRIPTION_APPLASTZONE_MOVEWINDOWS "Move newly created windows to their last known zone" - IDS_SETTING_DESCRIPTION_OPEN_WINDOW_ON_ACTIVE_MONITOR "Move newly created windows to the current active monitor [EXPERIMENTAL]" - IDS_SETTING_DESCRIPTION_RESTORESIZE "Restore the original size of windows when unsnapping" - IDS_SETTING_LAUNCH_EDITOR_LABEL "Zone configuration" - IDS_SETTING_LAUNCH_EDITOR_BUTTON "Edit zones" - IDS_SETTING_LAUNCH_EDITOR_DESCRIPTION "To launch the zone editor, select the Edit zones button below or press the zone editor hotkey anytime" - IDS_SETTING_LAUNCH_EDITOR_HOTKEY_LABEL "Configure the zone editor hotkey" - IDS_SETTING_EXCLUDED_APPS_DESCRIPTION "To exclude an application from snapping to zones add its name here (one per line). Excluded apps will react to the Windows Snap regardless of all other settings." - IDS_SETTINGS_HIGHLIGHT_OPACITY "Zone opacity (%)" - IDS_FANCYZONES "FancyZones" - IDS_CANT_DRAG_ELEVATED "We've detected an application running with administrator privileges. This blocks some functionality in PowerToys. Visit our wiki page to learn more." - IDS_CANT_DRAG_ELEVATED_LEARN_MORE "Learn more" - IDS_CANT_DRAG_ELEVATED_DIALOG_DONT_SHOW_AGAIN "Don't show again" - IDS_KEYBOARD_LISTENER_ERROR "Cannot install keyboard listener." - IDS_WINDOW_EVENT_LISTENER_ERROR "Cannot install Windows event listener." - IDS_POWERTOYS_FANCYZONES "PowerToys - FancyZones" -END - -1 VERSIONINFO - FILEVERSION FILE_VERSION - PRODUCTVERSION PRODUCT_VERSION - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -#ifdef _DEBUG - FILEFLAGS VS_FF_DEBUG -#else - FILEFLAGS 0x0L -#endif - FILEOS VOS_NT_WINDOWS32 - FILETYPE VFT_DLL - FILESUBTYPE VFT2_UNKNOWN -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", COMPANY_NAME - VALUE "FileDescription", FILE_DESCRIPTION - VALUE "FileVersion", FILE_VERSION_STRING - VALUE "InternalName", INTERNAL_NAME - VALUE "LegalCopyright", COPYRIGHT_NOTE - VALUE "OriginalFilename", ORIGINAL_FILENAME - VALUE "ProductName", PRODUCT_NAME - VALUE "ProductVersion", PRODUCT_VERSION_STRING - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END diff --git a/src/modules/fancyzones/lib/pch.h b/src/modules/fancyzones/lib/pch.h index 3d41836071..be7d22ea39 100644 --- a/src/modules/fancyzones/lib/pch.h +++ b/src/modules/fancyzones/lib/pch.h @@ -1,5 +1,5 @@ #pragma once -#include "resource.h" +#include "Generated Files/resource.h" #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #include diff --git a/src/modules/fancyzones/lib/resource.base.h b/src/modules/fancyzones/lib/resource.base.h new file mode 100644 index 0000000000..75649eba85 --- /dev/null +++ b/src/modules/fancyzones/lib/resource.base.h @@ -0,0 +1,13 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by fancyzones.rc + +////////////////////////////// +// Non-localizable + +#define FILE_DESCRIPTION "PowerToys FancyZones" +#define INTERNAL_NAME "fancyzones" +#define ORIGINAL_FILENAME "fancyzones.dll" + +// Non-localizable +////////////////////////////// diff --git a/src/modules/fancyzones/lib/resource.h b/src/modules/fancyzones/lib/resource.h deleted file mode 100644 index 17dce9b4e8..0000000000 --- a/src/modules/fancyzones/lib/resource.h +++ /dev/null @@ -1,46 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by fancyzones.rc - -////////////////////////////// -// Non-localizable - -#define FILE_DESCRIPTION "PowerToys FancyZones" -#define INTERNAL_NAME "fancyzones" -#define ORIGINAL_FILENAME "fancyzones.dll" - -// Non-localizable -////////////////////////////// - -#define IDS_SETTING_DESCRIPTION_SHIFTDRAG 101 -#define IDS_SETTING_DESCRIPTION_MOUSESWITCH 102 -#define IDS_SETTING_DESCRIPTION_OVERRIDE_SNAP_HOTKEYS 103 -#define IDS_SETTING_DESCRIPTION_MOVE_WINDOW_ACROSS_MONITORS 104 -#define IDS_SETTING_DESCRIPTION_MOVE_WINDOWS_BASED_ON_POSITION 105 -#define IDS_SETTING_DESCRIPTION_DISPLAYCHANGE_MOVEWINDOWS 106 -#define IDS_SETTING_DESCRIPTION_ZONESETCHANGE_MOVEWINDOWS 107 -#define IDS_SETTING_DESCRIPTION_ZONESETCHANGE_FLASHZONES 108 -#define IDS_SETTING_DESCRIPTION_SHOW_FANCY_ZONES_ON_ALL_MONITORS 109 -#define IDS_SETTING_DESCRIPTION_SPAN_ZONES_ACROSS_MONITORS 110 -#define IDS_SETTING_DESCRIPTION_MAKE_DRAGGED_WINDOW_TRANSPARENT 111 -#define IDS_SETTING_DESCRIPTION_ZONECOLOR 112 -#define IDS_SETTING_DESCRIPTION_ZONE_BORDER_COLOR 113 -#define IDS_SETTING_DESCRIPTION_ZONEHIGHLIGHTCOLOR 114 -#define IDS_SETTING_DESCRIPTION_APPLASTZONE_MOVEWINDOWS 115 -#define IDS_SETTING_DESCRIPTION_OPEN_WINDOW_ON_ACTIVE_MONITOR 116 -#define IDS_SETTING_DESCRIPTION_RESTORESIZE 117 -#define IDS_SETTING_DESCRIPTION_USE_CURSORPOS_EDITOR_STARTUPSCREEN 118 -#define IDS_SETTING_DESCRIPTION 119 -#define IDS_SETTING_LAUNCH_EDITOR_LABEL 120 -#define IDS_SETTING_LAUNCH_EDITOR_BUTTON 121 -#define IDS_SETTING_LAUNCH_EDITOR_DESCRIPTION 122 -#define IDS_SETTING_LAUNCH_EDITOR_HOTKEY_LABEL 123 -#define IDS_SETTING_EXCLUDED_APPS_DESCRIPTION 124 -#define IDS_SETTINGS_HIGHLIGHT_OPACITY 125 -#define IDS_FANCYZONES 126 -#define IDS_CANT_DRAG_ELEVATED 127 -#define IDS_CANT_DRAG_ELEVATED_LEARN_MORE 128 -#define IDS_CANT_DRAG_ELEVATED_DIALOG_DONT_SHOW_AGAIN 129 -#define IDS_KEYBOARD_LISTENER_ERROR 130 -#define IDS_WINDOW_EVENT_LISTENER_ERROR 131 -#define IDS_POWERTOYS_FANCYZONES 132