mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
[PowerRename] Fluent UX (#13678)
* PowerRename new UI * Add scrollviewer * Don't deploy PowerRenameUI_new * Visual updates * Visual updates * Updates * Update Resources.resw * Added docs button * Update MainWindow.xaml * Wire Docs button * RegEx -> regular expressions * Update Show only renamed list on search/replace text changed * Update Show only renamed list on search/replace text changed - proper fix Set searchTerm to NULL when cleared - fix Show only renamed files on clear searchTerm * Files/folders input error handling * Fix renaming with keeping UI window opened After renaming folder, all of it's children need path update. Without path update, further renaming of children items would fail. * Update only children, not all items with greater depth * Fix dictionary false positives * Remove .NET dep * Rename PowerRenameUI_new to PowerRenameUILib Rename executable PowerRenameUIHost to PowerRename Co-authored-by: Laute <Niels.Laute@philips.com>
This commit is contained in:
@@ -5,13 +5,16 @@
|
||||
#include "PowerRenameTest.h"
|
||||
#include <PowerRenameInterfaces.h>
|
||||
#include <PowerRenameItem.h>
|
||||
#include <PowerRenameUI.h>
|
||||
#include <PowerRenameManager.h>
|
||||
#include <Shobjidl.h>
|
||||
#include <atlfile.h>
|
||||
#include <atlstr.h>
|
||||
|
||||
#include <common/utils/process_path.h>
|
||||
|
||||
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||
|
||||
HINSTANCE g_hInst;
|
||||
HINSTANCE g_hostHInst;
|
||||
void ModuleAddRef() {}
|
||||
void ModuleRelease() {}
|
||||
|
||||
@@ -29,34 +32,52 @@ int APIENTRY wWinMain(
|
||||
_In_ PWSTR lpCmdLine,
|
||||
_In_ int nCmdShow)
|
||||
{
|
||||
g_hInst = hInstance;
|
||||
g_hostHInst = hInstance;
|
||||
HRESULT hr = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
// Create the rename manager
|
||||
CComPtr<IPowerRenameManager> spsrm;
|
||||
if (SUCCEEDED(CPowerRenameManager::s_CreateInstance(&spsrm)))
|
||||
{
|
||||
// Create the factory for our items
|
||||
CComPtr<IPowerRenameItemFactory> spsrif;
|
||||
if (SUCCEEDED(CPowerRenameItem::s_CreateInstance(nullptr, IID_PPV_ARGS(&spsrif))))
|
||||
{
|
||||
// Pass the factory to the manager
|
||||
if (SUCCEEDED(spsrm->PutRenameItemFactory(spsrif)))
|
||||
{
|
||||
// Create the rename UI instance and pass the manager
|
||||
CComPtr<IPowerRenameUI> spsrui;
|
||||
if (SUCCEEDED(CPowerRenameUI::s_CreateInstance(spsrm, nullptr, true, &spsrui)))
|
||||
{
|
||||
// Call blocks until we are done
|
||||
spsrui->Show(NULL);
|
||||
spsrui->Close();
|
||||
// Set the application path based on the location of the dll
|
||||
std::wstring path = get_module_folderpath(g_hostHInst);
|
||||
path = path + L"\\PowerRename.exe";
|
||||
LPTSTR lpApplicationName = (LPTSTR)path.c_str();
|
||||
|
||||
// Need to call shutdown to break circular dependencies
|
||||
spsrm->Shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
CString commandLine;
|
||||
commandLine.Format(_T("\"%s\""), lpApplicationName);
|
||||
|
||||
int nSize = commandLine.GetLength() + 1;
|
||||
LPTSTR lpszCommandLine = new TCHAR[nSize];
|
||||
_tcscpy_s(lpszCommandLine, nSize, commandLine);
|
||||
|
||||
STARTUPINFO startupInfo;
|
||||
ZeroMemory(&startupInfo, sizeof(STARTUPINFO));
|
||||
startupInfo.cb = sizeof(STARTUPINFO);
|
||||
startupInfo.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
|
||||
startupInfo.wShowWindow = SW_SHOWNORMAL;
|
||||
|
||||
PROCESS_INFORMATION processInformation;
|
||||
|
||||
// Start the resizer
|
||||
CreateProcess(
|
||||
NULL,
|
||||
lpszCommandLine,
|
||||
NULL,
|
||||
NULL,
|
||||
TRUE,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
&startupInfo,
|
||||
&processInformation);
|
||||
delete[] lpszCommandLine;
|
||||
if (!CloseHandle(processInformation.hProcess))
|
||||
{
|
||||
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||
return hr;
|
||||
}
|
||||
if (!CloseHandle(processInformation.hThread))
|
||||
{
|
||||
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||
return hr;
|
||||
}
|
||||
CoUninitialize();
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>$(OutDir)PowerRenameLib.lib;$(OutDir)PowerRenameUI.lib;Pathcch.lib;comctl32.lib;$(SolutionDir)$(Platform)\$(Configuration)\obj\PowerRenameUI\PowerRenameUI.res;shlwapi.lib;shcore.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>$(OutDir)PowerRenameLib.lib;Pathcch.lib;comctl32.lib;shlwapi.lib;shcore.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user