+ chg: grepWinNP3: alpha transparency on losing focus

This commit is contained in:
RaiKoHoff 2020-08-31 15:53:05 +02:00
parent c5525b7d97
commit 72a9d1ef8e
3 changed files with 26 additions and 1 deletions

View File

@ -168,6 +168,7 @@ CSearchDlg::CSearchDlg(HWND hParent)
, m_regDate2Low(L"Software\\grepWinNP3\\Date2Low", 0)
, m_regDate2High(L"Software\\grepWinNP3\\Date2High", 0)
, m_regShowContent(L"Software\\grepWinNP3\\ShowContent", 0)
, m_regTranspAlphaNoFocus(L"Software\\grepWinNP3\\TranspAlphaNoFocus", 100)
, m_AutoCompleteFilePatterns(bPortable ? &g_iniFile : nullptr)
, m_AutoCompleteExcludeDirsPatterns(bPortable ? &g_iniFile : nullptr)
, m_AutoCompleteSearchPatterns(bPortable ? &g_iniFile : nullptr)
@ -207,6 +208,7 @@ LRESULT CSearchDlg::DlgFunc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
{
case WM_INITDIALOG:
{
SetTransparency(ALPHA_OPAQUE);
SHAutoComplete(GetDlgItem(*this, IDC_SEARCHPATH), SHACF_FILESYSTEM|SHACF_AUTOSUGGEST_FORCE_ON);
m_AutoCompleteFilePatterns.Load(L"Software\\grepWinNP3\\History", L"FilePattern");
@ -395,6 +397,8 @@ LRESULT CSearchDlg::DlgFunc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
m_bUseRegex = (bPortable ? g_iniFile.GetBoolValue(L"global", L"UseRegex", false) : DWORD(m_regUseRegex));
m_TranspAlphaNoFocus = (BYTE)(bPortable ? g_iniFile.GetLongValue(L"global", L"TranspAlphaNoFocus", 80) : DWORD(m_regTranspAlphaNoFocus));
SendDlgItemMessage(hwndDlg, IDC_SIZECOMBO, CB_SETCURSEL, m_sizeCmp, 0);
SendDlgItemMessage(hwndDlg, IDC_INCLUDESUBFOLDERS, BM_SETCHECK, m_bIncludeSubfolders ? BST_CHECKED : BST_UNCHECKED, 0);
@ -903,6 +907,20 @@ LRESULT CSearchDlg::DlgFunc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
}
}
break;
case WM_ACTIVATE:
switch (LOWORD(wParam))
{
case WA_INACTIVE:
SetTransparency(m_TranspAlphaNoFocus);
break;
case WA_CLICKACTIVE:
// mouse click activation
case WA_ACTIVE:
SetTransparency(ALPHA_OPAQUE);
break;
}
break;
default:
return FALSE;
}

View File

@ -41,7 +41,9 @@
#define SEARCH_END (WM_APP+3)
#define WM_GREPWIN_THREADEND (WM_APP+4)
#define ID_ABOUTBOX 0x0010
#define ID_ABOUTBOX (0x0010)
#define ALPHA_OPAQUE (255)
enum ExecuteAction
{
@ -203,6 +205,7 @@ private:
bool m_bConfirmationOnReplace;
bool m_showContent;
bool m_showContentSet;
BYTE m_TranspAlphaNoFocus;
std::vector<CSearchInfo> m_items;
std::vector<std::tuple<int, int>> m_listItems;
@ -262,4 +265,5 @@ private:
CRegStdDWORD m_regDate2Low;
CRegStdDWORD m_regDate2High;
CRegStdDWORD m_regShowContent;
CRegStdDWORD m_regTranspAlphaNoFocus;
};

View File

@ -3764,6 +3764,9 @@ void DialogGrepWin(HWND hwnd, LPCWSTR searchPattern)
StringCchPrintf(tchTemp, COUNTOF(tchTemp), L"%s /%%mode%% \"%%pattern%%\" /g %%line%% - %%path%%", tchNotepad3Path);
IniSectionSetString(globalSection, L"editorcmd", tchTemp);
long const iTranspAlpha = IniSectionGetLong(globalSection, L"TranspAlphaNoFocus", MulDiv(Settings2.FindReplaceOpacityLevel, 255, 100));
IniSectionSetLong(globalSection, L"TranspAlphaNoFocus", iTranspAlpha);
// [settings]
const WCHAR *const settingsSection = L"settings";