From 3ede1a0b53e8e52167f247536edaf2dc24f95399 Mon Sep 17 00:00:00 2001 From: Arjun Balgovind <32061677+arjunbalgovind@users.noreply.github.com> Date: Mon, 24 Aug 2020 17:51:48 -0700 Subject: [PATCH] [Localization] Migrate resources to resx for PowerRename (#6112) * 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 * Fixed file names * Changed to check folder for LocProject files * Updated folder * Changed directory * Changed to src directory * Changed language set and name format, removed rc file localization * Added all projects with resx/resw files * Added newline to end of file * Removed nuget source as it is not used * Updated comments * Updated keyboard manager to use resx file * Tweaked resources.resx and added it to project files * Added comments and added in string table to resx script * Remove change from bad merge * Fix syntax error in convert stringtable * Changed file type to None * Migrated color picker's resources * Migrated resources for Microsoft.Launcher * Migrated resources for fancy zones * Revert fancyzones changes * Migrated resources for ImageResizer and modified script to add language specific code * Added try catch and checks for modification to avoid unnecessary file creation * Changed tab insertion to 4 spaces to avoid mixed file types in rc file * Migrated resources for power preview project * Added LocProject.json file for 5 projects * added resgen exception check * Moved non-localizable strings out of resx for powerpreview * Move out hardcoded strings from dialog box and set them at runtime from string table * Migrated resources for powerrename * Added locproj * Added missing ImageBase extern declaration * Added build script in UWP UI project since PowerRenameExt is not referenced * Resolved merge conflicts --- .../powerrename/UWPui/PowerRenameUWPUI.rc | 4 +- .../UWPui/PowerRenameUWPUI.vcxproj | 3 + src/modules/powerrename/dll/LocProject.json | 14 ++ .../powerrename/dll/PowerRenameExt.base.rc | 63 ++++++ .../powerrename/dll/PowerRenameExt.cpp | 2 +- src/modules/powerrename/dll/PowerRenameExt.rc | 113 ---------- .../powerrename/dll/PowerRenameExt.vcxproj | 12 +- .../dll/PowerRenameExt.vcxproj.filters | 30 ++- src/modules/powerrename/dll/Resources.resx | 144 +++++++++++++ src/modules/powerrename/dll/dllmain.cpp | 2 +- src/modules/powerrename/dll/resource.base.h | 15 ++ src/modules/powerrename/dll/resource.h | 36 ---- src/modules/powerrename/ui/LocProject.json | 14 ++ .../powerrename/ui/PowerRenameUI.base.rc | 84 ++++++++ src/modules/powerrename/ui/PowerRenameUI.cpp | 46 +++- src/modules/powerrename/ui/PowerRenameUI.h | 1 + src/modules/powerrename/ui/PowerRenameUI.rc | 155 -------------- .../powerrename/ui/PowerRenameUI.vcxproj | 12 +- .../ui/PowerRenameUI.vcxproj.filters | 57 +++-- src/modules/powerrename/ui/Resources.resx | 202 ++++++++++++++++++ src/modules/powerrename/ui/resource.base.h | 33 +++ src/modules/powerrename/ui/resource.h | 51 ----- tools/build/convert-resx-to-rc.ps1 | 12 +- 23 files changed, 712 insertions(+), 393 deletions(-) create mode 100644 src/modules/powerrename/dll/LocProject.json create mode 100644 src/modules/powerrename/dll/PowerRenameExt.base.rc delete mode 100644 src/modules/powerrename/dll/PowerRenameExt.rc create mode 100644 src/modules/powerrename/dll/Resources.resx create mode 100644 src/modules/powerrename/dll/resource.base.h delete mode 100644 src/modules/powerrename/dll/resource.h create mode 100644 src/modules/powerrename/ui/LocProject.json create mode 100644 src/modules/powerrename/ui/PowerRenameUI.base.rc delete mode 100644 src/modules/powerrename/ui/PowerRenameUI.rc create mode 100644 src/modules/powerrename/ui/Resources.resx create mode 100644 src/modules/powerrename/ui/resource.base.h delete mode 100644 src/modules/powerrename/ui/resource.h diff --git a/src/modules/powerrename/UWPui/PowerRenameUWPUI.rc b/src/modules/powerrename/UWPui/PowerRenameUWPUI.rc index 58c53031ad..46b3bf1232 100644 --- a/src/modules/powerrename/UWPui/PowerRenameUWPUI.rc +++ b/src/modules/powerrename/UWPui/PowerRenameUWPUI.rc @@ -3,9 +3,9 @@ #include "../../../common/version.h" // We need both DLL and UI resource files for UWP UI. -#include "../dll/PowerRenameExt.rc" +#include "../dll/Generated Files/PowerRenameExt.rc" #undef IDC_STATIC -#include "../ui/PowerRenameUI.rc" +#include "../ui/Generated Files/PowerRenameUI.rc" 2 VERSIONINFO FILEVERSION FILE_VERSION diff --git a/src/modules/powerrename/UWPui/PowerRenameUWPUI.vcxproj b/src/modules/powerrename/UWPui/PowerRenameUWPUI.vcxproj index 9d763c9604..879ef77530 100644 --- a/src/modules/powerrename/UWPui/PowerRenameUWPUI.vcxproj +++ b/src/modules/powerrename/UWPui/PowerRenameUWPUI.vcxproj @@ -11,6 +11,9 @@ x64 + + + 16.0 {0485F45C-EA7A-4BB5-804B-3E8D14699387} diff --git a/src/modules/powerrename/dll/LocProject.json b/src/modules/powerrename/dll/LocProject.json new file mode 100644 index 0000000000..2109393849 --- /dev/null +++ b/src/modules/powerrename/dll/LocProject.json @@ -0,0 +1,14 @@ +{ + "Projects": [ + { + "LanguageSet": "Azure_Languages", + "LocItems": [ + { + "SourceFile": "src\\modules\\powerrename\\dll\\Resources.resx", + "CopyOption": "LangIDOnName", + "OutputPath": "src\\modules\\powerrename\\dll" + } + ] + } + ] +} diff --git a/src/modules/powerrename/dll/PowerRenameExt.base.rc b/src/modules/powerrename/dll/PowerRenameExt.base.rc new file mode 100644 index 0000000000..9d9a78e5de --- /dev/null +++ b/src/modules/powerrename/dll/PowerRenameExt.base.rc @@ -0,0 +1,63 @@ +ÿþ#include <windows.h> +#include "resource.h" +#include "../../../../common/version.h" + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +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" // US English (0x0409), Unicode (0x04B0) charset + 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 // US English (0x0409), Unicode (1200) charset + END +END + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +////////////////////////////// +// Non-localizable + +STRINGTABLE +BEGIN + IDS_OVERVIEW_LINK L"https://aka.ms/PowerToysOverview_PowerRename" +END + +// Non-localizable +////////////////////////////// + \ No newline at end of file diff --git a/src/modules/powerrename/dll/PowerRenameExt.cpp b/src/modules/powerrename/dll/PowerRenameExt.cpp index 718532b738..fae0f38f86 100644 --- a/src/modules/powerrename/dll/PowerRenameExt.cpp +++ b/src/modules/powerrename/dll/PowerRenameExt.cpp @@ -8,7 +8,7 @@ #include #include #include -#include "resource.h" +#include "Generated Files/resource.h" extern HINSTANCE g_hInst; diff --git a/src/modules/powerrename/dll/PowerRenameExt.rc b/src/modules/powerrename/dll/PowerRenameExt.rc deleted file mode 100644 index 2ed4706a7a..0000000000 --- a/src/modules/powerrename/dll/PowerRenameExt.rc +++ /dev/null @@ -1,113 +0,0 @@ -ÿþ#include <windows.h> -#include "resource.h" -#include "../../../common/version.h" - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -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" // US English (0x0409), Unicode (0x04B0) charset - 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 // US English (0x0409), Unicode (1200) charset - END -END - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (United States) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_POWERRENAME "Po&werRename" - IDS_POWERRENAME_APP_NAME "PowerRename" - IDS_SETTINGS_DESCRIPTION L"A Windows Shell extension for more advanced bulk renaming using search and replace or regular expressions." - IDS_OVERVIEW_LINK L"https://aka.ms/PowerToysOverview_PowerRename" - IDS_RESTORE_SEARCH L"Restore search, replace and flags values on launch from previous run." - IDS_ENABLE_AUTO L"Enable autocomplete and autosuggest of recently used inputs for search and replace values." - IDS_MAX_ITEMS L"Maximum number of items to show in recently used list for autocomplete dropdown." - IDS_ICON_CONTEXT_MENU L"Show icon on context menu." - IDS_EXTENDED_MENU_INFO L"Only show the PowerRename menu item on the extended context menu (Shift + Right-click)." -END - -#endif // English (United States) resources -///////////////////////////////////////////////////////////////////////////// - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - \ No newline at end of file diff --git a/src/modules/powerrename/dll/PowerRenameExt.vcxproj b/src/modules/powerrename/dll/PowerRenameExt.vcxproj index 06a01972df..4644f17a96 100644 --- a/src/modules/powerrename/dll/PowerRenameExt.vcxproj +++ b/src/modules/powerrename/dll/PowerRenameExt.vcxproj @@ -19,6 +19,9 @@ x64 + + + 15.0 {B25AC7A5-FB9F-4789-B392-D5C85E948670} @@ -174,13 +177,15 @@ - + + - + + @@ -204,6 +209,9 @@ {0e072714-d127-460b-afad-b4c40b412798} + + + diff --git a/src/modules/powerrename/dll/PowerRenameExt.vcxproj.filters b/src/modules/powerrename/dll/PowerRenameExt.vcxproj.filters index a8b06ef642..e5dfb83b56 100644 --- a/src/modules/powerrename/dll/PowerRenameExt.vcxproj.filters +++ b/src/modules/powerrename/dll/PowerRenameExt.vcxproj.filters @@ -13,14 +13,14 @@ {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 + + {1691b4f2-4b67-4188-9cfd-1ac61e78279f} + Header Files - - Header Files - Header Files @@ -30,11 +30,12 @@ Header Files - - - - Resource Files - + + Generated Files + + + Header Files + @@ -53,4 +54,17 @@ + + + Generated Files + + + Resource Files + + + + + Resource Files + + \ No newline at end of file diff --git a/src/modules/powerrename/dll/Resources.resx b/src/modules/powerrename/dll/Resources.resx new file mode 100644 index 0000000000..2193bf5e15 --- /dev/null +++ b/src/modules/powerrename/dll/Resources.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + Po&werRename + + + PowerRename + + + A Windows Shell extension for more advanced bulk renaming using search and replace or regular expressions. + + + Restore search, replace and flags values on launch from previous run. + + + Enable autocomplete and autosuggest of recently used inputs for search and replace values. + + + Maximum number of items to show in recently used list for autocomplete dropdown. + + + Show icon on context menu. + + + Only show the PowerRename menu item on the extended context menu (Shift + Right-click). + + \ No newline at end of file diff --git a/src/modules/powerrename/dll/dllmain.cpp b/src/modules/powerrename/dll/dllmain.cpp index 577eef9606..00069bf084 100644 --- a/src/modules/powerrename/dll/dllmain.cpp +++ b/src/modules/powerrename/dll/dllmain.cpp @@ -5,7 +5,7 @@ #include #include #include -#include "resource.h" +#include "Generated Files/resource.h" #include std::atomic g_dwModuleRefCount = 0; diff --git a/src/modules/powerrename/dll/resource.base.h b/src/modules/powerrename/dll/resource.base.h new file mode 100644 index 0000000000..a82d7a33fa --- /dev/null +++ b/src/modules/powerrename/dll/resource.base.h @@ -0,0 +1,15 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by PowerRenameExt.rc + +////////////////////////////// +// Non-localizable + +#define FILE_DESCRIPTION "PowerToys PowerRenameExt" +#define INTERNAL_NAME "PowerRenameExt" +#define ORIGINAL_FILENAME "PowerRenameExt.dll" +#define IDI_RENAME 2001 +#define IDS_OVERVIEW_LINK 2002 + +// Non-localizable +////////////////////////////// diff --git a/src/modules/powerrename/dll/resource.h b/src/modules/powerrename/dll/resource.h deleted file mode 100644 index de17c7c45e..0000000000 --- a/src/modules/powerrename/dll/resource.h +++ /dev/null @@ -1,36 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by PowerRenameExt.rc - -////////////////////////////// -// Non-localizable - -#define FILE_DESCRIPTION "PowerToys PowerRenameExt" -#define INTERNAL_NAME "PowerRenameExt" -#define ORIGINAL_FILENAME "PowerRenameExt.dll" - -// Non-localizable -////////////////////////////// - -#define IDS_POWERRENAME 801 -#define IDI_RENAME 132 -#define IDS_POWERRENAME_APP_NAME 2101 -#define IDS_SETTINGS_DESCRIPTION 2102 -#define IDS_OVERVIEW_LINK 2103 -#define IDS_RESTORE_SEARCH 2104 -#define IDS_ENABLE_AUTO 2105 -#define IDS_MAX_ITEMS 2106 -#define IDS_ICON_CONTEXT_MENU 2107 -#define IDS_EXTENDED_MENU_INFO 2108 - -// Next default values for new objects -// - -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 102 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/src/modules/powerrename/ui/LocProject.json b/src/modules/powerrename/ui/LocProject.json new file mode 100644 index 0000000000..1b7bce6bfd --- /dev/null +++ b/src/modules/powerrename/ui/LocProject.json @@ -0,0 +1,14 @@ +{ + "Projects": [ + { + "LanguageSet": "Azure_Languages", + "LocItems": [ + { + "SourceFile": "src\\modules\\powerrename\\ui\\Resources.resx", + "CopyOption": "LangIDOnName", + "OutputPath": "src\\modules\\powerrename\\ui" + } + ] + } + ] +} diff --git a/src/modules/powerrename/ui/PowerRenameUI.base.rc b/src/modules/powerrename/ui/PowerRenameUI.base.rc new file mode 100644 index 0000000000..182ba42eb2 --- /dev/null +++ b/src/modules/powerrename/ui/PowerRenameUI.base.rc @@ -0,0 +1,84 @@ +ÿþ// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#ifndef APSTUDIO_INVOKED +#include "targetver.h" +#endif +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_RENAME ICON "PowerRename.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_MAIN DIALOGEX 0, 0, 364, 317 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME +CAPTION "" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + EDITTEXT IDC_EDIT_SEARCHFOR,71,20,259,13,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_REPLACEWITH,71,38,259,13,ES_AUTOHSCROLL + CONTROL "",IDC_CHECK_USEREGEX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,21,83,98,10 + CONTROL "",IDC_CHECK_CASESENSITIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,21,95,98,10 + CONTROL "",IDC_CHECK_MATCHALLOCCURENCES, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,21,107,98,10 + CONTROL "", IDC_TRANSFORM_UPPERCASE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 21, 119, 98, 10 + CONTROL "",IDC_CHECK_EXCLUDEFILES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,132,83,98,10 + CONTROL "",IDC_CHECK_EXCLUDEFOLDERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,132,95,98,10 + CONTROL "",IDC_CHECK_EXCLUDESUBFOLDERS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,132,107,98,10 + CONTROL "", IDC_TRANSFORM_LOWERCASE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 132, 119, 98, 10 + CONTROL "",IDC_CHECK_ENUMITEMS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,83,98,10 + CONTROL "",IDC_CHECK_NAMEONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,95,98,10 + CONTROL "",IDC_CHECK_EXTENSIONONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,107,98,10 CONTROL "", IDC_TRANSFORM_TITLECASE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 241, 119, 98, 10 + CONTROL "",IDC_LIST_PREVIEW,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | LVS_OWNERDATA | WS_BORDER | WS_TABSTOP,22,160,308,116 + DEFPUSHBUTTON "",ID_RENAME,178,295,50,14 + PUSHBUTTON "",ID_ABOUT,234,295,50,14 + PUSHBUTTON "",IDCANCEL,290,295,50,14 + RTEXT "",IDC_SEARCH_FOR,25,23,39,8 + LTEXT "",IDC_REPLACE_WITH,21,40,43,8 + LTEXT "",IDC_STATUS_MESSAGE,11,295,137,13 + GROUPBOX "",IDC_OPTIONSGROUP,11,68,329,70 + GROUPBOX "",IDC_PREVIEWGROUP,11,145,329,142 + GROUPBOX "",IDC_SEARCHREPLACEGROUP,11,7,329,55 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_MAIN, DIALOG + BEGIN + LEFTMARGIN, 11 + RIGHTMARGIN, 340 + TOPMARGIN, 7 + BOTTOMMARGIN, 297 + END +END +#endif // APSTUDIO_INVOKED + \ No newline at end of file diff --git a/src/modules/powerrename/ui/PowerRenameUI.cpp b/src/modules/powerrename/ui/PowerRenameUI.cpp index 65bad0d29b..8615ec5699 100644 --- a/src/modules/powerrename/ui/PowerRenameUI.cpp +++ b/src/modules/powerrename/ui/PowerRenameUI.cpp @@ -1,5 +1,5 @@ #include "pch.h" -#include "resource.h" +#include "Generated Files/resource.h" #include "PowerRenameUI.h" #include "dpi_aware.h" #include @@ -9,13 +9,9 @@ #include #include -extern HINSTANCE g_hInst; +extern "C" IMAGE_DOS_HEADER __ImageBase; -int g_rgnMatchModeResIDs[] = { - IDS_ENTIREITEMNAME, - IDS_NAMEONLY, - IDS_EXTENSIONONLY -}; +extern HINSTANCE g_hInst; enum { @@ -599,6 +595,9 @@ INT_PTR CPowerRenameUI::_DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) void CPowerRenameUI::_OnInitDlg() { + // Load text in the dialog controls + _InitDlgText(); + m_hwndLV = GetDlgItem(m_hwnd, IDC_LIST_PREVIEW); m_listview.Init(m_hwndLV); @@ -652,6 +651,39 @@ void CPowerRenameUI::_OnInitDlg() m_initialized = true; } +void UpdateDlgControl(HWND dlg, int item_id, int string_id) +{ + HWND control = GetDlgItem(dlg, item_id); + SetWindowText(control, GET_RESOURCE_STRING(string_id).c_str()); +} + +void CPowerRenameUI::_InitDlgText() +{ + // load strings + SetWindowText(m_hwnd, GET_RESOURCE_STRING(IDS_APP_TITLE).c_str()); + UpdateDlgControl(m_hwnd, IDC_CHECK_USEREGEX, IDS_USE_REGEX); + UpdateDlgControl(m_hwnd, IDC_CHECK_CASESENSITIVE, IDS_CASE_SENSITIVE); + UpdateDlgControl(m_hwnd, IDC_CHECK_MATCHALLOCCURENCES, IDS_MATCH_ALL); + UpdateDlgControl(m_hwnd, IDC_TRANSFORM_UPPERCASE, IDS_MAKE_UPPERCASE); + UpdateDlgControl(m_hwnd, IDC_CHECK_EXCLUDEFILES, IDS_EXCLUDE_FILES); + UpdateDlgControl(m_hwnd, IDC_CHECK_EXCLUDEFOLDERS, IDS_EXCLUDE_FOLDERS); + UpdateDlgControl(m_hwnd, IDC_CHECK_EXCLUDESUBFOLDERS, IDS_EXCLUDE_SUBFOLDER); + UpdateDlgControl(m_hwnd, IDC_TRANSFORM_LOWERCASE, IDS_MAKE_LOWERCASE); + UpdateDlgControl(m_hwnd, IDC_CHECK_ENUMITEMS, IDS_ENUMERATE_ITEMS); + UpdateDlgControl(m_hwnd, IDC_CHECK_NAMEONLY, IDS_ITEM_NAME_ONLY); + UpdateDlgControl(m_hwnd, IDC_CHECK_EXTENSIONONLY, IDS_ITEM_EXTENSION_ONLY); + UpdateDlgControl(m_hwnd, IDC_TRANSFORM_TITLECASE, IDS_MAKE_TITLECASE); + UpdateDlgControl(m_hwnd, ID_RENAME, IDS_RENAME_BUTTON); + UpdateDlgControl(m_hwnd, ID_ABOUT, IDS_HELP_BUTTON); + UpdateDlgControl(m_hwnd, IDCANCEL, IDS_CANCEL_BUTTON); + UpdateDlgControl(m_hwnd, IDC_SEARCH_FOR, IDS_SEARCH_FOR); + UpdateDlgControl(m_hwnd, IDC_REPLACE_WITH, IDS_REPLACE_WITH); + UpdateDlgControl(m_hwnd, IDC_STATUS_MESSAGE, IDS_ITEMS_SELECTED); + UpdateDlgControl(m_hwnd, IDC_OPTIONSGROUP, IDS_OPTIONS); + UpdateDlgControl(m_hwnd, IDC_PREVIEWGROUP, IDS_PREVIEW); + UpdateDlgControl(m_hwnd, IDC_SEARCHREPLACEGROUP, IDS_RENAME_CRITERIA); +} + void CPowerRenameUI::_OnCommand(_In_ WPARAM wParam, _In_ LPARAM lParam) { switch (LOWORD(wParam)) diff --git a/src/modules/powerrename/ui/PowerRenameUI.h b/src/modules/powerrename/ui/PowerRenameUI.h index df46fc6a0a..09a9732008 100644 --- a/src/modules/powerrename/ui/PowerRenameUI.h +++ b/src/modules/powerrename/ui/PowerRenameUI.h @@ -122,6 +122,7 @@ private: void _OnSize(_In_ WPARAM wParam); void _OnGetMinMaxInfo(_In_ LPARAM lParam); void _OnInitDlg(); + void _InitDlgText(); void _OnRename(); void _OnAbout(); void _OnCloseDlg(); diff --git a/src/modules/powerrename/ui/PowerRenameUI.rc b/src/modules/powerrename/ui/PowerRenameUI.rc deleted file mode 100644 index fa2ac45497..0000000000 --- a/src/modules/powerrename/ui/PowerRenameUI.rc +++ /dev/null @@ -1,155 +0,0 @@ -ÿþ// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#ifndef APSTUDIO_INVOKED -#include "targetver.h" -#endif -#define APSTUDIO_HIDDEN_SYMBOLS -#include "windows.h" -#undef APSTUDIO_HIDDEN_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (United States) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_MAIN DIALOGEX 0, 0, 364, 317 -STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME -CAPTION "PowerRename" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - EDITTEXT IDC_EDIT_SEARCHFOR,71,20,259,13,ES_AUTOHSCROLL - EDITTEXT IDC_EDIT_REPLACEWITH,71,38,259,13,ES_AUTOHSCROLL - CONTROL "Use Regular Expressions",IDC_CHECK_USEREGEX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,21,83,98,10 - CONTROL "Case Sensitive",IDC_CHECK_CASESENSITIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,21,95,98,10 - CONTROL "Match All Occurrences",IDC_CHECK_MATCHALLOCCURENCES, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,21,107,98,10 - CONTROL "Make Uppercase", IDC_TRANSFORM_UPPERCASE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 21, 119, 98, 10 - CONTROL "Exclude Files",IDC_CHECK_EXCLUDEFILES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,132,83,98,10 - CONTROL "Exclude Folders",IDC_CHECK_EXCLUDEFOLDERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,132,95,98,10 - CONTROL "Exclude Subfolder Items",IDC_CHECK_EXCLUDESUBFOLDERS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,132,107,98,10 - CONTROL "Make Lowercase", IDC_TRANSFORM_LOWERCASE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 132, 119, 98, 10 - CONTROL "Enumerate Items",IDC_CHECK_ENUMITEMS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,83,98,10 - CONTROL "Item Name Only",IDC_CHECK_NAMEONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,95,98,10 - CONTROL "Item Extension Only",IDC_CHECK_EXTENSIONONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,107,98,10 - CONTROL "Make Titlecase", IDC_TRANSFORM_TITLECASE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 241, 119, 98, 10 - CONTROL "",IDC_LIST_PREVIEW,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | LVS_OWNERDATA | WS_BORDER | WS_TABSTOP,22,160,308,116 - DEFPUSHBUTTON "&Rename",ID_RENAME,178,295,50,14 - PUSHBUTTON "&Help",ID_ABOUT,234,295,50,14 - PUSHBUTTON "&Cancel",IDCANCEL,290,295,50,14 - RTEXT "Search for:",IDC_STATIC,25,23,39,8 - LTEXT "Replace with:",IDC_STATIC,21,40,43,8 - LTEXT "Items Selected: 0 | Renaming: 0",IDC_STATUS_MESSAGE,11,295,137,13 - GROUPBOX "Options",IDC_OPTIONSGROUP,11,68,329,70 - GROUPBOX "Preview",IDC_PREVIEWGROUP,11,145,329,142 - GROUPBOX "Enter the criteria below to rename the items",IDC_SEARCHREPLACEGROUP,11,7,329,55 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_MAIN, DIALOG - BEGIN - LEFTMARGIN, 11 - RIGHTMARGIN, 340 - TOPMARGIN, 7 - BOTTOMMARGIN, 297 - END -END -#endif // APSTUDIO_INVOKED - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#ifndef APSTUDIO_INVOKED\r\n" - "#include ""targetver.h""\r\n" - "#endif\r\n" - "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" - "#include ""windows.h""\r\n" - "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_RENAME ICON "PowerRename.ico" - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_APP_TITLE "PowerRename" - IDS_RENAMED "Renamed" - IDS_ORIGINAL "Original" - IDS_LISTVIEW_EMPTY "All items have been filtered out.\nPlease select from the options above to show items." - IDS_ENTIREITEMNAME "Item Name and Extension" - IDS_COUNTSLABELFMT "Items Selected: %u | Renaming: %u" -END - -#endif // English (United States) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - - \ No newline at end of file diff --git a/src/modules/powerrename/ui/PowerRenameUI.vcxproj b/src/modules/powerrename/ui/PowerRenameUI.vcxproj index f30f48a117..2c260294d7 100644 --- a/src/modules/powerrename/ui/PowerRenameUI.vcxproj +++ b/src/modules/powerrename/ui/PowerRenameUI.vcxproj @@ -11,6 +11,9 @@ x64 + + + {0E072714-D127-460B-AFAD-B4C40B412798} Win32Proj @@ -164,8 +167,9 @@ - + + @@ -175,7 +179,8 @@ - + + @@ -183,6 +188,9 @@ + + + diff --git a/src/modules/powerrename/ui/PowerRenameUI.vcxproj.filters b/src/modules/powerrename/ui/PowerRenameUI.vcxproj.filters index 263bb52ebb..585144c762 100644 --- a/src/modules/powerrename/ui/PowerRenameUI.vcxproj.filters +++ b/src/modules/powerrename/ui/PowerRenameUI.vcxproj.filters @@ -1,19 +1,29 @@  - - + + Source Files + + + Source Files + - - - - + + Generated Files + + + Header Files + + + Header Files + + + Header Files + + Header Files - - - @@ -22,13 +32,32 @@ {dc9de3c4-d79b-45f9-9a5c-671f310928a3} - - - - Resource Files - + + {3eee15a8-a99a-423b-8420-a76aa4458c4a} + + + {1bd24b81-b44b-4577-be0b-d492cf0d43fe} + + + + Generated Files + + + Resource Files + + + + + Resource Files + + + + + Resource Files + + \ No newline at end of file diff --git a/src/modules/powerrename/ui/Resources.resx b/src/modules/powerrename/ui/Resources.resx new file mode 100644 index 0000000000..c278b9c056 --- /dev/null +++ b/src/modules/powerrename/ui/Resources.resx @@ -0,0 +1,202 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + PowerRename + + + Renamed + + + Original + + + All items have been filtered out. +Please select from the options above to show items. + + + Item Name and Extension + + + Items Selected: %u | Renaming: %u + + + Use Regular Expressions + + + Case Sensitive + + + Match All Occurrences + + + Make Uppercase + + + Exclude Files + + + Exclude Folders + + + Exclude Subfolder Items + + + Make Lowercase + + + Enumerate Items + + + Item Name Only + + + Item Extension Only + + + Make Titlecase + + + &Rename + + + &Help + + + &Cancel + + + Search for: + + + Replace with: + + + Items Selected: 0 | Renaming: 0 + + + Options + + + Preview + + + Enter the criteria below to rename the items + + \ No newline at end of file diff --git a/src/modules/powerrename/ui/resource.base.h b/src/modules/powerrename/ui/resource.base.h new file mode 100644 index 0000000000..34b94ea1d9 --- /dev/null +++ b/src/modules/powerrename/ui/resource.base.h @@ -0,0 +1,33 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by PowerRenameUI.rc +// +#define IDC_MYICON 7 +#define ID_RENAME 8 +#define ID_ABOUT 9 +#define IDD_POWERRENAME_DIALOG 3001 +#define IDC_EDIT_SEARCHFOR 3002 +#define IDC_EDIT_REPLACEWITH 3003 +#define IDC_LIST_PREVIEW 3004 +#define IDC_CHECK_USEREGEX 3005 +#define IDC_STATUS_MESSAGE 3006 +#define IDC_CHECK_EXCLUDESUBFOLDERS 3007 +#define IDC_CHECK_ENUMITEMS 3008 +#define IDC_CHECK_EXCLUDEFILES 3009 +#define IDC_CHECK_CASESENSITIVE 3010 +#define IDC_CHECK_MATCHALLOCCURENCES 3011 +#define IDC_CHECK_EXCLUDEFOLDERS 3012 +#define IDC_CHECK_NAMEONLY 3013 +#define IDC_CHECK_EXTENSIONONLY 3014 +#define IDC_PREVIEWGROUP 3015 +#define IDC_OPTIONSGROUP 3016 +#define IDC_SEARCHREPLACEGROUP 3017 +#define IDC_TRANSFORM_UPPERCASE 3018 +#define IDC_TRANSFORM_LOWERCASE 3019 +#define IDC_TRANSFORM_TITLECASE 3020 +#define IDC_SEARCH_FOR 3021 +#define IDC_REPLACE_WITH 3022 +#define IDC_STATIC -1 +#define IDR_MAINFRAME 3023 +#define IDD_MAIN 3024 +#define IDI_RENAME 2001 diff --git a/src/modules/powerrename/ui/resource.h b/src/modules/powerrename/ui/resource.h deleted file mode 100644 index ef9e1dd78a..0000000000 --- a/src/modules/powerrename/ui/resource.h +++ /dev/null @@ -1,51 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by PowerRenameUI.rc -// -#define IDC_MYICON 7 -#define ID_RENAME 8 -#define ID_ABOUT 9 -#define IDD_POWERRENAME_DIALOG 102 -#define IDS_APP_TITLE 103 -#define IDS_RENAMED 104 -#define IDS_ORIGINAL 105 -#define IDS_LISTVIEW_EMPTY 106 -#define IDS_ENTIREITEMNAME 107 -#define IDS_NAMEONLY 108 -#define IDS_EXTENSIONONLY 109 -#define IDS_COUNTSLABELFMT 111 -#define IDR_MAINFRAME 128 -#define IDD_MAIN 129 -#define IDI_RENAME 132 -#define IDC_EDIT_SEARCHFOR 1002 -#define IDC_EDIT_REPLACEWITH 1003 -#define IDC_LIST_PREVIEW 1004 -#define IDC_CHECK_USEREGEX 1005 -#define IDC_STATUS_MESSAGE 1006 -#define IDC_CHECK_EXCLUDESUBFOLDERS 1007 -#define IDC_CHECK_ENUMITEMS 1008 -#define IDC_CHECK_EXCLUDEFILES 1009 -#define IDC_CHECK_CASESENSITIVE 1010 -#define IDC_CHECK_MATCHALLOCCURENCES 1011 -#define IDC_CHECK_EXCLUDEFOLDERS 1012 -#define IDC_CHECK_NAMEONLY 1013 -#define IDC_CHECK_EXTENSIONONLY 1014 -#define IDC_PREVIEWGROUP 1015 -#define IDC_OPTIONSGROUP 1016 -#define IDC_SEARCHREPLACEGROUP 1017 -#define IDC_TRANSFORM_UPPERCASE 1018 -#define IDC_TRANSFORM_LOWERCASE 1019 -#define IDC_TRANSFORM_TITLECASE 1020 -#define IDC_STATIC -1 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NO_MFC 1 -#define _APS_NEXT_RESOURCE_VALUE 133 -#define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1007 -#define _APS_NEXT_SYMED_VALUE 110 -#endif -#endif diff --git a/tools/build/convert-resx-to-rc.ps1 b/tools/build/convert-resx-to-rc.ps1 index 767f5606ba..2b86379ee0 100644 --- a/tools/build/convert-resx-to-rc.ps1 +++ b/tools/build/convert-resx-to-rc.ps1 @@ -15,6 +15,16 @@ $baseRCFileName = $args[3] # Target file name of the resource rc file, which will be used in code - Example: ProjectName.rc $generatedRCFileName = $args[4] +# Optional argument: Initial resource id in the resource header file. By default it is 101 +if ($args.Count -eq 6) +{ + $initResourceID = $args[5] +} +else +{ + $initResourceID = 101 +} + # Temporary file created used for resgen $tempFile = "temporaryResourceFile.txt" @@ -92,7 +102,7 @@ Foreach-Object { $newLinesForRCFile = "" $newLinesForHeaderFile = "" - $count = 101 + $count = $initResourceID try { foreach ($line in (Get-Content $tempFile -Encoding unicode)) {