+ enh: add switch and opacity level settings2 for Find/Replace dialog

This commit is contained in:
Rainer Kottenhoff 2018-10-31 15:00:24 +01:00
parent 5952236d95
commit bcd6451d39
24 changed files with 44 additions and 29 deletions

Binary file not shown.

View File

@ -1 +1 @@
1335
1338

View File

@ -276,6 +276,7 @@
#define IDC_COPYVERSTRG 18090
#define IDC_RICHEDITABOUT 18091
#define IDC_TRANSL_AUTH 18092
#define IDC_TRANSPARENT 18093
#define CMD_ESCAPE 20000
#define CMD_SHIFTESC 20001

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -553,17 +553,11 @@ void DeleteBitmapButton(HWND hwnd,int nCtlId)
//
// SetWindowTransparentMode()
//
void SetWindowTransparentMode(HWND hwnd,BOOL bTransparentMode)
void SetWindowTransparentMode(HWND hwnd, BOOL bTransparentMode, int iOpacityLevel)
{
if (bTransparentMode) {
SetWindowLongPtr(hwnd, GWL_EXSTYLE, GetWindowLongPtr(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);
// get opacity level from registry
int iAlphaPercent = IniGetInt(L"Settings2", L"OpacityLevel", 75);
iAlphaPercent = clampi(iAlphaPercent, 0, 100);
BYTE const bAlpha = (BYTE)MulDiv(iAlphaPercent, 255, 100);
BYTE const bAlpha = (BYTE)MulDiv(iOpacityLevel, 255, 100);
SetLayeredWindowAttributes(hwnd, 0, bAlpha, LWA_ALPHA);
}
else

View File

@ -68,7 +68,7 @@ BOOL SetWindowPathTitle(HWND,LPCWSTR);
void CenterDlgInParent(HWND);
void MakeBitmapButton(HWND hwnd, int nCtlId, HINSTANCE hInstance, WORD uBmpId);
void DeleteBitmapButton(HWND,int);
void SetWindowTransparentMode(HWND,BOOL);
void SetWindowTransparentMode(HWND hwnd, BOOL bTransparentMode, int iOpacityLevel);
#define StatusSetSimple(hwnd,b) SendMessage(hwnd,SB_SIMPLE,(WPARAM)b,0)
BOOL StatusSetText(HWND,UINT,LPCWSTR);

View File

@ -504,8 +504,10 @@ HWND InitInstance(HINSTANCE hInstance,LPWSTR pszCmdLine,int nCmdShow)
if (bAlwaysOnTop)
SetWindowPos(hwndMain,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
if (g_bTransparentMode)
SetWindowTransparentMode(hwndMain,TRUE);
if (g_bTransparentMode) {
int const iAlphaPercent = IniGetInt(L"Settings2", L"OpacityLevel", 75);
SetWindowTransparentMode(hwndMain, TRUE, clampi(iAlphaPercent, 0, 100));
}
if (!flagStartAsTrayIcon) {
ShowWindow(hwndMain,nCmdShow);
@ -2257,8 +2259,9 @@ LRESULT MsgCommand(HWND hwnd,WPARAM wParam,LPARAM lParam)
case ACC_SWITCHTRANSPARENCY:
g_bTransparentMode = g_bTransparentMode ? 0 : 1;
SetWindowTransparentMode(hwnd,g_bTransparentMode);
g_bTransparentMode = !g_bTransparentMode;
int const iAlphaPercent = IniGetInt(L"Settings2", L"OpacityLevel", 75);
SetWindowTransparentMode(hwndMain, g_bTransparentMode, clampi(iAlphaPercent, 0, 100));
break;

View File

@ -3,8 +3,8 @@
<assemblyIdentity
name="Notepad3"
processorArchitecture="*"
version="5.18.1030.1334"
version="5.18.1031.1338"
type="win32"
/>
<description>Notepad3 RC_NewMenu</description>
<description>Notepad3 RC NewMenu</description>
</assembly>

View File

@ -2985,13 +2985,12 @@ bool SetWindowTitle(HWND hwnd, UINT uIDAppName, bool bIsElevated, UINT uIDUntitl
//
// SetWindowTransparentMode()
//
void SetWindowTransparentMode(HWND hwnd, bool bTransparentMode)
void SetWindowTransparentMode(HWND hwnd, bool bTransparentMode, int iOpacityLevel)
{
if (bTransparentMode) {
SetWindowLongPtr(hwnd, GWL_EXSTYLE, GetWindowLongPtr(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);
// get opacity level from registry
int const iAlphaPercent = Settings2.OpacityLevel;
BYTE const bAlpha = (BYTE)MulDiv(iAlphaPercent, 255, 100);
BYTE const bAlpha = (BYTE)MulDiv(iOpacityLevel, 255, 100);
SetLayeredWindowAttributes(hwnd, 0, bAlpha, LWA_ALPHA);
return;
}

View File

@ -49,7 +49,7 @@ void DialogAdminExe(HWND hwnd,bool);
INT_PTR InfoBoxLng(int iType, LPCWSTR lpstrSetting, int uidMessage, ...);
bool SetWindowTitle(HWND hwnd, UINT uIDAppName, bool, UINT uIDUntitled, LPCWSTR lpszFile, int iFormat, bool, UINT uIDReadOnly, bool, LPCWSTR lpszExcerpt);
void SetWindowTransparentMode(HWND hwnd, bool);
void SetWindowTransparentMode(HWND hwnd, bool bTransparentMode, int iOpacityLevel);
void CenterDlgInParent(HWND hDlg);
void GetDlgPos(HWND hDlg, LPINT xDlg, LPINT yDlg);
void SetDlgPos(HWND hDlg, int xDlg, int yDlg);

View File

@ -5125,6 +5125,8 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
}
}
CheckDlgButton(hwnd, IDC_TRANSPARENT, Settings.FindReplaceTransparentMode ? BST_CHECKED : BST_UNCHECKED);
if (!s_bSwitchedFindReplace) {
if (Settings.FindReplaceDlgPosX == CW_USEDEFAULT || Settings.FindReplaceDlgPosY == CW_USEDEFAULT)
CenterDlgInParent(hwnd);
@ -5137,7 +5139,8 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
CopyMemory(sg_pefrData, &s_efrSave, sizeof(EDITFINDREPLACE));
}
_SetSearchFlags(hwnd, sg_pefrData); // sync
s_anyMatch = s_fwrdMatch = NO_MATCH;
s_fwrdMatch = NO_MATCH;
s_anyMatch = (SciCall_IsSelectionRectangle() || SciCall_IsSelectionEmpty() ? NO_MATCH : MATCH);
HMENU hmenu = GetSystemMenu(hwnd, false);
GetLngString(IDS_MUI_SAVEPOS, tchBuf, COUNTOF(tchBuf));
@ -5150,6 +5153,11 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
hBrushGreen = CreateSolidBrush(rgbGreenColorRef);
hBrushBlue = CreateSolidBrush(rgbBlueColorRef);
// find first occurrence of clip-board text
//if (!SciCall_IsSelectionRectangle() && SciCall_IsSelectionEmpty()) {
// PostMessage(hwnd, WM_COMMAND, MAKELONG(IDOK, 1), 0);
//}
SetTimer(hwnd, IDT_TIMER_MRKALL, USER_TIMER_MINIMUM, MQ_ExecuteNext);
}
return true;
@ -5220,13 +5228,13 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
case WA_INACTIVE:
//~s_InitialTopLine = -1;
//~g_bFindReplCopySelOrClip = true;
SetWindowTransparentMode(hwnd, true);
SetWindowTransparentMode(hwnd, Settings.FindReplaceTransparentMode, Settings2.FindReplaceOpacityLevel);
break;
case WA_CLICKACTIVE:
// mouse click activation
case WA_ACTIVE:
SetWindowTransparentMode(hwnd, false);
SetWindowTransparentMode(hwnd, false, 100);
default:
s_fwrdMatch = NO_MATCH;
s_InitialSearchStart = SciCall_GetSelectionStart();
@ -5501,6 +5509,9 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
_DelayMarkAll(hwnd, 0, s_InitialSearchStart);
break;
case IDC_TRANSPARENT:
Settings.FindReplaceTransparentMode = (IsDlgButtonChecked(hwnd, IDC_TRANSPARENT) == BST_CHECKED);
break;
case IDC_REPLACE:
case IDC_REPLACEALL:

View File

@ -1023,7 +1023,7 @@ HWND InitInstance(HINSTANCE hInstance,LPCWSTR pszCmdLine,int nCmdShow)
}
if (Settings.TransparentMode) {
SetWindowTransparentMode(Globals.hwndMain, true);
SetWindowTransparentMode(Globals.hwndMain, true, Settings2.OpacityLevel);
}
if (s_WinInfo.zoom) {
@ -4927,7 +4927,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
case IDM_VIEW_TRANSPARENT:
Settings.TransparentMode = !Settings.TransparentMode;
SetWindowTransparentMode(hwnd,Settings.TransparentMode);
SetWindowTransparentMode(hwnd,Settings.TransparentMode, Settings2.OpacityLevel);
break;
case IDM_SET_RENDER_TECH_DEFAULT:
@ -6704,7 +6704,10 @@ void LoadSettings()
Settings2.FileLoadWarningMB = clampi(IniSectionGetInt(pIniSection, L"FileLoadWarningMB", Defaults2.FileLoadWarningMB), 0, 2048);
Defaults2.OpacityLevel = 75;
Settings2.OpacityLevel = clampi(IniSectionGetInt(pIniSection, L"OpacityLevel", Defaults2.OpacityLevel), 0, 100);
Settings2.OpacityLevel = clampi(IniSectionGetInt(pIniSection, L"OpacityLevel", Defaults2.OpacityLevel), 10, 100);
Defaults2.FindReplaceOpacityLevel = 50;
Settings2.FindReplaceOpacityLevel = clampi(IniSectionGetInt(pIniSection, L"FindReplaceOpacityLevel", Defaults2.FindReplaceOpacityLevel), 10, 100);
Defaults2.FileBrowserPath[0] = L'\0';
IniSectionGetString(pIniSection, L"filebrowser.exe", Defaults2.FileBrowserPath, Settings2.FileBrowserPath, COUNTOF(Settings2.FileBrowserPath));
@ -6877,6 +6880,7 @@ void LoadSettings()
GET_BOOL_VALUE_FROM_INISECTION(AlwaysOnTop, false);
GET_BOOL_VALUE_FROM_INISECTION(MinimizeToTray, false);
GET_BOOL_VALUE_FROM_INISECTION(TransparentMode, false);
GET_BOOL_VALUE_FROM_INISECTION(FindReplaceTransparentMode, true);
GET_INT_VALUE_FROM_INISECTION(RenderingTechnology, Defaults.RenderingTechnology, 0, 3); // set before
GET_INT_VALUE_FROM_INISECTION(Bidirectional, Defaults.Bidirectional, 0, 2); // set before
///~Settings2.IMEInteraction = clampi(IniSectionGetInt(pIniSection, L"IMEInteraction", Settings2.IMEInteraction), SC_IME_WINDOWED, SC_IME_INLINE);
@ -7231,6 +7235,7 @@ void SaveSettings(bool bSaveSettingsNow)
SAVE_VALUE_IF_NOT_EQ_DEFAULT(Bool, AlwaysOnTop);
SAVE_VALUE_IF_NOT_EQ_DEFAULT(Bool, MinimizeToTray);
SAVE_VALUE_IF_NOT_EQ_DEFAULT(Bool, TransparentMode);
SAVE_VALUE_IF_NOT_EQ_DEFAULT(Bool, FindReplaceTransparentMode);
SAVE_VALUE_IF_NOT_EQ_DEFAULT(Int, RenderingTechnology);
SAVE_VALUE_IF_NOT_EQ_DEFAULT(Int, Bidirectional);
///~IniSectionSetInt(pIniSection, L"IMEInteraction", Settings2.IMEInteraction);

View File

@ -317,6 +317,7 @@ typedef struct _settings_t
bool AlwaysOnTop;
bool MinimizeToTray;
bool TransparentMode;
bool FindReplaceTransparentMode;
int RenderingTechnology;
int Bidirectional;
bool ShowToolbar;
@ -352,6 +353,7 @@ typedef struct _settings2_t
{
int FileLoadWarningMB;
int OpacityLevel;
int FindReplaceOpacityLevel;
DWORD FileCheckInverval;
DWORD AutoReloadTimeout;
int IMEInteraction;

View File

@ -6,8 +6,8 @@
#define APPNAME "Notepad3"
#define VERSION_MAJOR 5
#define VERSION_MINOR 18
#define VERSION_REV 1030
#define VERSION_BUILD 1334
#define VERSION_REV 1031
#define VERSION_BUILD 1338
#define SCINTILLA_VER 412
#define ONIGMO_REGEX_VER 6.1.3
#define VERSION_PATCH " RC_NewMenu"
#define VERSION_PATCH " RC NewMenu"