diff --git a/src/common/common.h b/src/common/common.h index 81525f9361..5fdcc9d451 100644 --- a/src/common/common.h +++ b/src/common/common.h @@ -77,4 +77,4 @@ std::wstring get_resource_string(UINT resource_id, HINSTANCE instance, const wch // Requires that // extern "C" IMAGE_DOS_HEADER __ImageBase; // is added to the .cpp file. -#define GET_RESOURCE_STRING(resource_id) get_resource_string(resource_id, reinterpret_cast(&__ImageBase), L#resource_id) \ No newline at end of file +#define GET_RESOURCE_STRING(resource_id) get_resource_string(resource_id, reinterpret_cast(&__ImageBase), L#resource_id) diff --git a/src/modules/powerrename/dll/PowerRenameExt.cpp b/src/modules/powerrename/dll/PowerRenameExt.cpp index d7d4f05eaf..898fc92db1 100644 --- a/src/modules/powerrename/dll/PowerRenameExt.cpp +++ b/src/modules/powerrename/dll/PowerRenameExt.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -20,6 +21,7 @@ struct InvokeStruct CPowerRenameMenu::CPowerRenameMenu() { ModuleAddRef(); + app_name = GET_RESOURCE_STRING(IDS_POWERRENAME); } CPowerRenameMenu::~CPowerRenameMenu() @@ -196,7 +198,7 @@ DWORD WINAPI CPowerRenameMenu::s_PowerRenameUIThreadProc(_In_ void* pData) HRESULT __stdcall CPowerRenameMenu::GetTitle(IShellItemArray* /*psiItemArray*/, LPWSTR* ppszName) { - return SHStrDup(L"PowerRename", ppszName); + return SHStrDup(app_name.c_str(), ppszName); } HRESULT __stdcall CPowerRenameMenu::GetIcon(IShellItemArray* /*psiItemArray*/, LPWSTR* ppszIcon) diff --git a/src/modules/powerrename/dll/PowerRenameExt.h b/src/modules/powerrename/dll/PowerRenameExt.h index 8e6258b1a3..01906d14ab 100644 --- a/src/modules/powerrename/dll/PowerRenameExt.h +++ b/src/modules/powerrename/dll/PowerRenameExt.h @@ -71,4 +71,5 @@ private: std::atomic m_refCount = 1; HBITMAP m_hbmpIcon = nullptr; CComPtr m_spdo; + std::wstring app_name; }; diff --git a/src/modules/powerrename/dll/PowerRenameExt.rc b/src/modules/powerrename/dll/PowerRenameExt.rc index 1f6fd72364..57c3116be9 100644 --- a/src/modules/powerrename/dll/PowerRenameExt.rc +++ b/src/modules/powerrename/dll/PowerRenameExt.rc @@ -91,7 +91,14 @@ STRINGTABLE BEGIN - IDS_POWERRENAME "PowerRename" + IDS_POWERRENAME "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://github.com/microsoft/PowerToys/tree/master/src/modules/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 diff --git a/src/modules/powerrename/dll/dllmain.cpp b/src/modules/powerrename/dll/dllmain.cpp index 4d1f82a298..14f37fd56e 100644 --- a/src/modules/powerrename/dll/dllmain.cpp +++ b/src/modules/powerrename/dll/dllmain.cpp @@ -4,7 +4,8 @@ #include #include #include - +#include +#include "resource.h" #include std::atomic g_dwModuleRefCount = 0; @@ -160,12 +161,13 @@ class PowerRenameModule : public PowertoyModuleIface private: // Enabled by default bool m_enabled = true; + std::wstring app_name; public: // Return the display name of the powertoy, this will be cached virtual PCWSTR get_name() override { - return L"PowerRename"; + return app_name.c_str(); } // Enable the powertoy @@ -203,25 +205,25 @@ public: // Create a Settings object. PowerToysSettings::Settings settings(hinstance, get_name()); - settings.set_description(L"A Windows Shell Extension for more advanced bulk renaming using search and replace or regular expressions."); + settings.set_description(GET_RESOURCE_STRING(IDS_SETTINGS_DESCRIPTION)); settings.set_icon_key(L"pt-power-rename"); // Link to the GitHub PowerRename sub-page - settings.set_overview_link(L"https://github.com/microsoft/PowerToys/tree/master/src/modules/powerrename"); + settings.set_overview_link(GET_RESOURCE_STRING(IDS_OVERVIEW_LINK)); settings.add_bool_toogle( L"bool_persist_input", - L"Restore search, replace and flags values on launch from previous run.", + GET_RESOURCE_STRING(IDS_RESTORE_SEARCH), CSettings::GetPersistState()); settings.add_bool_toogle( L"bool_mru_enabled", - L"Enable autocomplete and autosuggest of recently used inputs for search and replace values.", + GET_RESOURCE_STRING(IDS_ENABLE_AUTO), CSettings::GetMRUEnabled()); settings.add_int_spinner( L"int_max_mru_size", - L"Maximum number of items to show in recently used list for autocomplete dropdown.", + GET_RESOURCE_STRING(IDS_MAX_ITEMS), CSettings::GetMaxMRUSize(), 0, 20, @@ -229,12 +231,12 @@ public: settings.add_bool_toogle( L"bool_show_icon_on_menu", - L"Show icon on context menu.", + GET_RESOURCE_STRING(IDS_ICON_CONTEXT_MENU), CSettings::GetShowIconOnMenu()); settings.add_bool_toogle( L"bool_show_extended_menu", - L"Only show the PowerRename menu item on the extended context menu (SHIFT + Right-click).", + GET_RESOURCE_STRING(IDS_EXTENDED_MENU_INFO), CSettings::GetExtendedContextMenuOnly()); return settings.serialize_to_buffer(buffer, buffer_size); @@ -298,7 +300,10 @@ public: PowerRenameModule() { init_settings(); + app_name = GET_RESOURCE_STRING(IDS_POWERRENAME); } + + ~PowerRenameModule(){}; }; extern "C" __declspec(dllexport) PowertoyModuleIface* __cdecl powertoy_create() diff --git a/src/modules/powerrename/dll/resource.h b/src/modules/powerrename/dll/resource.h index 8bc71ee4e1..cf00d79cce 100644 --- a/src/modules/powerrename/dll/resource.h +++ b/src/modules/powerrename/dll/resource.h @@ -1,13 +1,22 @@ #define IDS_POWERRENAME 801 #define IDI_RENAME 132 +#define IDS_SETTINGS_DESCRIPTION 2101 +#define IDS_OVERVIEW_LINK 2102 +#define IDS_RESTORE_SEARCH 2103 +#define IDS_ENABLE_AUTO 2104 +#define IDS_MAX_ITEMS 2105 +#define IDS_ICON_CONTEXT_MENU 2106 +#define IDS_EXTENDED_MENU_INFO 2107 // 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 +#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/lib/Settings.cpp b/src/modules/powerrename/lib/Settings.cpp index 7921e7f901..230cd2f2f8 100644 --- a/src/modules/powerrename/lib/Settings.cpp +++ b/src/modules/powerrename/lib/Settings.cpp @@ -1,4 +1,3 @@ - #include "stdafx.h" #include #include "Settings.h" diff --git a/src/modules/powerrename/testapp/PowerRenameTest.cpp b/src/modules/powerrename/testapp/PowerRenameTest.cpp index 370795df50..529eb0c2f4 100644 --- a/src/modules/powerrename/testapp/PowerRenameTest.cpp +++ b/src/modules/powerrename/testapp/PowerRenameTest.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")