Removed string resources from the settings.cpp file

This commit is contained in:
Alekhya Kommuru
2020-01-17 11:25:42 -08:00
parent 44ac22c0de
commit a504a75166
3 changed files with 43 additions and 136 deletions

View File

@@ -1,73 +0,0 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#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 9, 1
#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
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
STRINGTABLE
BEGIN
IDS_ROOT_PATH L"Software\\Microsoft\\PowerRename"
IDS_SEARCH_PATH L"SearchMRU"
IDS_REPLACE_PATH L"ReplaceMRU"
IDS_ENABLED L"Enabled"
IDS_SHOW_ICON L"ShowIcon"
IDS_CONTEXT_MENU L"ExtendedContextMenuOnly"
IDS_PERSIST_STATE L"PersistState"
IDS_MAX_MRU_SIZE L"MaxMRUSize"
IDS_FLAGS L"Flags"
IDS_SEARCH_TEXT L"SearchText"
IDS_REPLACE_TEXT L"ReplaceText"
IDS_MRU_ENABLED L"MRUEnabled"
END
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -3,21 +3,21 @@
#include <commctrl.h>
#include "Settings.h"
#include "PowerRenameInterfaces.h"
#include "resource.h"
#include <common.h>
const wchar_t* c_rootRegPath = GET_RESOURCE_STRING(IDS_ROOT_PATH).c_str();
const wchar_t* c_mruSearchRegPath = GET_RESOURCE_STRING(IDS_SEARCH_PATH).c_str();
const wchar_t* c_mruReplaceRegPath = GET_RESOURCE_STRING(IDS_REPLACE_PATH).c_str();
const wchar_t* c_enabled = GET_RESOURCE_STRING(IDS_ENABLED).c_str();
const wchar_t* c_showIconOnMenu = GET_RESOURCE_STRING(IDS_SHOW_ICON).c_str();
const wchar_t* c_extendedContextMenuOnly = GET_RESOURCE_STRING(IDS_CONTEXT_MENU).c_str();
const wchar_t* c_persistState = GET_RESOURCE_STRING(IDS_PERSIST_STATE).c_str();
const wchar_t* c_maxMRUSize = GET_RESOURCE_STRING(IDS_MAX_MRU_SIZE).c_str();
const wchar_t* c_flags = GET_RESOURCE_STRING(IDS_FLAGS).c_str();
const wchar_t* c_searchText = GET_RESOURCE_STRING(IDS_SEARCH_TEXT).c_str();
const wchar_t* c_replaceText = GET_RESOURCE_STRING(IDS_REPLACE_TEXT).c_str();
const wchar_t* c_mruEnabled = GET_RESOURCE_STRING(IDS_MRU_ENABLED).c_str();
// Note: Not moving these strings to the resource file as these are internal and used as IDs
const wchar_t c_rootRegPath[] = L"Software\\Microsoft\\PowerRename";
const wchar_t c_mruSearchRegPath[] = L"SearchMRU";
const wchar_t c_mruReplaceRegPath[] = L"ReplaceMRU";
const wchar_t c_enabled[] = L"Enabled";
const wchar_t c_showIconOnMenu[] = L"ShowIcon";
const wchar_t c_extendedContextMenuOnly[] = L"ExtendedContextMenuOnly";
const wchar_t c_persistState[] = L"PersistState";
const wchar_t c_maxMRUSize[] = L"MaxMRUSize";
const wchar_t c_flags[] = L"Flags";
const wchar_t c_searchText[] = L"SearchText";
const wchar_t c_replaceText[] = L"ReplaceText";
const wchar_t c_mruEnabled[] = L"MRUEnabled";
const bool c_enabledDefault = true;
const bool c_showIconOnMenuDefault = true;
@@ -167,15 +167,15 @@ bool CSettings::GetRegStringValue(_In_ PCWSTR valueName, __out_ecount(cchBuf) PW
return (SUCCEEDED(HRESULT_FROM_WIN32(SHGetValue(HKEY_CURRENT_USER, c_rootRegPath, valueName, &type, value, &cb) == ERROR_SUCCESS)));
}
typedef int(CALLBACK* MRUCMPPROC)(LPCWSTR, LPCWSTR);
typedef int (CALLBACK* MRUCMPPROC)(LPCWSTR, LPCWSTR);
typedef struct {
DWORD cbSize;
UINT uMax;
UINT fFlags;
HKEY hKey;
LPCTSTR lpszSubKey;
typedef struct
{
DWORD cbSize;
UINT uMax;
UINT fFlags;
HKEY hKey;
LPCTSTR lpszSubKey;
MRUCMPPROC lpfnCompare;
} MRUINFO;
@@ -190,15 +190,21 @@ class CRenameMRU :
{
public:
// IUnknown
IFACEMETHODIMP_(ULONG) AddRef();
IFACEMETHODIMP_(ULONG) Release();
IFACEMETHODIMP_(ULONG)
AddRef();
IFACEMETHODIMP_(ULONG)
Release();
IFACEMETHODIMP QueryInterface(_In_ REFIID riid, _Outptr_ void** ppv);
// IEnumString
IFACEMETHODIMP Next(__in ULONG celt, __out_ecount_part(celt, *pceltFetched) LPOLESTR* rgelt, __out_opt ULONG* pceltFetched);
IFACEMETHODIMP Skip(__in ULONG) { return E_NOTIMPL; }
IFACEMETHODIMP Reset();
IFACEMETHODIMP Clone(__deref_out IEnumString** ppenum) { *ppenum = nullptr; return E_NOTIMPL; }
IFACEMETHODIMP Clone(__deref_out IEnumString** ppenum)
{
*ppenum = nullptr;
return E_NOTIMPL;
}
// IPowerRenameMRU
IFACEMETHODIMP AddMRUString(_In_ PCWSTR entry);
@@ -215,19 +221,20 @@ private:
int _EnumMRUList(_In_ int nItem, _Out_ void* lpData, _In_ UINT uLen);
void _FreeMRUList();
long m_refCount = 0;
HKEY m_hKey = NULL;
ULONG m_maxMRUSize = 0;
ULONG m_mruIndex = 0;
ULONG m_mruSize = 0;
long m_refCount = 0;
HKEY m_hKey = NULL;
ULONG m_maxMRUSize = 0;
ULONG m_mruIndex = 0;
ULONG m_mruSize = 0;
HANDLE m_mruHandle = NULL;
HMODULE m_hComctl32Dll = NULL;
PWSTR m_regPath = nullptr;
PWSTR m_regPath = nullptr;
};
CRenameMRU::CRenameMRU() :
m_refCount(1)
{}
{
}
CRenameMRU::~CRenameMRU()
{
@@ -270,12 +277,14 @@ HRESULT CRenameMRU::CreateInstance(_In_ PCWSTR regPathMRU, _In_ ULONG maxMRUSize
}
// IUnknown
IFACEMETHODIMP_(ULONG) CRenameMRU::AddRef()
IFACEMETHODIMP_(ULONG)
CRenameMRU::AddRef()
{
return InterlockedIncrement(&m_refCount);
}
IFACEMETHODIMP_(ULONG) CRenameMRU::Release()
IFACEMETHODIMP_(ULONG)
CRenameMRU::Release()
{
long refCount = InterlockedDecrement(&m_refCount);
@@ -466,7 +475,6 @@ void CRenameMRU::_FreeMRUList()
{
pfnFreeMRUList(m_mruHandle);
}
}
m_mruHandle = NULL;
}

View File

@@ -1,28 +0,0 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by PowerRenameLib.rc
#define IDS_ROOT_PATH 100
#define IDS_SEARCH_PATH 101
#define IDS_REPLACE_PATH 102
#define IDS_ENABLED 103
#define IDS_SHOW_ICON 104
#define IDS_CONTEXT_MENU 105
#define IDS_PERSIST_STATE 106
#define IDS_MAX_MRU_SIZE 107
#define IDS_FLAGS 108
#define IDS_SEARCH_TEXT 109
#define IDS_REPLACE_TEXT 110
#define IDS_MRU_ENABLED 111
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif