mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-14 21:09:05 +08:00
+ chg: bring back system MessageBox() (incl. not mutable system beep) for "not saved" warning on modified files
This commit is contained in:
parent
74556ccbb3
commit
579c3cfbfe
@ -1 +1 @@
|
||||
2681
|
||||
2682
|
||||
|
||||
@ -118,7 +118,7 @@ INT_PTR CALLBACK SetKeysDlgProc(HWND hDlg, UINT umsg, WPARAM wParam, LPARAM lPar
|
||||
CheckDlgButton(hDlg, IDC_PWD_CHECK3, SetBtn(hasMasterFileKey));
|
||||
CheckDlgButton(hDlg, IDC_PWD_CHECK2, SetBtn(hasBinFileKey | useFileKey));
|
||||
CheckDlgButton(hDlg, IDC_PWD_CHECK1, SetBtn(useMasterKey));
|
||||
CenterDlgInParent(hDlg);
|
||||
CenterDlgInParent(hDlg, NULL);
|
||||
// Don't use: SetFocus( GetDlgItem( hDlg, IDC_PWD_EDIT1 ) );
|
||||
SetDialogFocus(hDlg, GetDlgItem(hDlg, IDC_PWD_EDIT1));
|
||||
}
|
||||
@ -245,7 +245,7 @@ INT_PTR CALLBACK GetKeysDlgProc(HWND hDlg, UINT umsg, WPARAM wParam, LPARAM lPar
|
||||
//@@@SetDlgItemText( hDlg, IDC_PWD_EDIT3, fileKey );
|
||||
SetDlgItemText(hDlg, IDC_PWD_EDIT3, unicodeFileKey);
|
||||
CheckDlgButton(hDlg, IDC_PWD_CHECK3, BST_UNCHECKED);
|
||||
CenterDlgInParent(hDlg);
|
||||
CenterDlgInParent(hDlg, NULL);
|
||||
// Don't use: SetFocus( GetDlgItem( hDlg, IDC_PWD_EDIT3 ) );
|
||||
SetDialogFocus(hDlg, GetDlgItem(hDlg, IDC_PWD_EDIT3));
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<assemblyIdentity
|
||||
name="Notepad3"
|
||||
processorArchitecture="*"
|
||||
version="5.19.1120.2681"
|
||||
version="5.19.1121.2682"
|
||||
type="win32"
|
||||
/>
|
||||
<description>Notepad3 BETA</description>
|
||||
|
||||
201
src/Dialogs.c
201
src/Dialogs.c
@ -44,40 +44,63 @@
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// MsgBoxLng()
|
||||
// MessageBoxLng()
|
||||
//
|
||||
static HHOOK s_hhkMsgBox = NULL;
|
||||
|
||||
static LRESULT CALLBACK _MsgBoxProc(INT nCode, WPARAM wParam, LPARAM lParam)
|
||||
static LRESULT CALLBACK CenterInParentHook(INT nCode, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
// notification that a window is about to be activated
|
||||
if (nCode == HCBT_ACTIVATE) {
|
||||
// set window handles
|
||||
HWND hParentWnd = GetForegroundWindow();
|
||||
HWND hChildWnd = (HWND)wParam; // window handle is wParam
|
||||
HWND const hChildWnd = (HWND)wParam; // window handle is wParam
|
||||
HWND const hParentWnd = GetParent(hChildWnd);
|
||||
|
||||
RECT rParent, rChild, rDesktop;
|
||||
if ((hParentWnd != NULL) && (hChildWnd != NULL) &&
|
||||
(GetWindowRect(GetDesktopWindow(), &rDesktop) != 0) &&
|
||||
(GetWindowRect(hParentWnd, &rParent) != 0) &&
|
||||
(GetWindowRect(hChildWnd, &rChild) != 0)) {
|
||||
|
||||
CenterDlgInParent(hChildWnd);
|
||||
if ((hParentWnd && hChildWnd) &&
|
||||
(GetWindowRect(GetDesktopWindow(), &rDesktop) == TRUE) &&
|
||||
(GetWindowRect(hParentWnd, &rParent) == TRUE) &&
|
||||
(GetWindowRect(hChildWnd, &rChild) == TRUE))
|
||||
{
|
||||
if (s_hhkMsgBox) {
|
||||
UnhookWindowsHookEx(s_hhkMsgBox);
|
||||
s_hhkMsgBox = NULL;
|
||||
}
|
||||
CenterDlgInParent(hChildWnd, hParentWnd);
|
||||
}
|
||||
PostMessage(hChildWnd, WM_SETFOCUS, 0, 0);
|
||||
|
||||
// exit _MsgBoxProc hook
|
||||
UnhookWindowsHookEx(s_hhkMsgBox);
|
||||
}
|
||||
else // otherwise, continue with any possible chained hooks
|
||||
{
|
||||
CallNextHookEx(s_hhkMsgBox, nCode, wParam, lParam);
|
||||
}
|
||||
return 0;
|
||||
// continue with any possible chained hooks
|
||||
return s_hhkMsgBox ? CallNextHookEx(s_hhkMsgBox, nCode, wParam, lParam) : 0;
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
int MessageBoxLng(HWND hwnd, UINT uType, UINT uidMsg, ...)
|
||||
{
|
||||
WCHAR szFormat[HUGE_BUFFER] = { L'\0' };
|
||||
if (!GetLngString(uidMsg, szFormat, COUNTOF(szFormat))) { return -1; }
|
||||
|
||||
WCHAR szTitle[128] = { L'\0' };
|
||||
GetLngString(IDS_MUI_APPTITLE, szTitle, COUNTOF(szTitle));
|
||||
|
||||
WCHAR szText[HUGE_BUFFER] = { L'\0' };
|
||||
const PUINT_PTR argp = (PUINT_PTR)&uidMsg + 1;
|
||||
if (argp && *argp) {
|
||||
StringCchVPrintfW(szText, COUNTOF(szText), szFormat, (LPVOID)argp);
|
||||
}
|
||||
else {
|
||||
StringCchCopy(szText, COUNTOF(szText), szFormat);
|
||||
}
|
||||
|
||||
uType |= (MB_TOPMOST | MB_SETFOREGROUND);
|
||||
|
||||
// center message box to focus or main
|
||||
s_hhkMsgBox = SetWindowsHookEx(WH_CBT, &CenterInParentHook, 0, GetCurrentThreadId());
|
||||
|
||||
return MessageBoxEx(hwnd, szText, szTitle, uType, Globals.iPrefLANGID);
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// GetLastErrorToMsgBox()
|
||||
@ -97,7 +120,7 @@ DWORD GetLastErrorToMsgBox(LPWSTR lpszFunction, DWORD dwErrID)
|
||||
NULL,
|
||||
dwErrID,
|
||||
Globals.iPrefLANGID,
|
||||
(LPTSTR)& lpMsgBuf,
|
||||
(LPTSTR)&lpMsgBuf,
|
||||
0, NULL);
|
||||
|
||||
if (lpMsgBuf) {
|
||||
@ -112,7 +135,7 @@ DWORD GetLastErrorToMsgBox(LPWSTR lpszFunction, DWORD dwErrID)
|
||||
// center message box to main
|
||||
HWND focus = GetFocus();
|
||||
HWND hwnd = focus ? focus : Globals.hwndMain;
|
||||
s_hhkMsgBox = SetWindowsHookEx(WH_CBT, &_MsgBoxProc, 0, GetCurrentThreadId());
|
||||
s_hhkMsgBox = SetWindowsHookEx(WH_CBT, &CenterInParentHook, 0, GetCurrentThreadId());
|
||||
|
||||
MessageBoxEx(hwnd, lpDisplayBuf, L"Notepad3 - ERROR", MB_ICONERROR, Globals.iPrefLANGID);
|
||||
|
||||
@ -124,54 +147,6 @@ DWORD GetLastErrorToMsgBox(LPWSTR lpszFunction, DWORD dwErrID)
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// MessageBoxLng()
|
||||
//
|
||||
int MessageBoxLng(UINT uType, UINT uidMsg, ...)
|
||||
{
|
||||
WCHAR szFormat[HUGE_BUFFER] = { L'\0' };
|
||||
if (!GetLngString(uidMsg, szFormat, COUNTOF(szFormat))) { return -1; }
|
||||
|
||||
WCHAR szTitle[64] = { L'\0' };
|
||||
GetLngString(IDS_MUI_APPTITLE, szTitle, COUNTOF(szTitle));
|
||||
|
||||
WCHAR szText[HUGE_BUFFER] = { L'\0' };
|
||||
const PUINT_PTR argp = (PUINT_PTR)&uidMsg + 1;
|
||||
if (argp && *argp) {
|
||||
StringCchVPrintfW(szText, COUNTOF(szText), szFormat, (LPVOID)argp);
|
||||
}
|
||||
else {
|
||||
StringCchCopy(szText, COUNTOF(szText), szFormat);
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
int iIcon = MB_ICONHAND;
|
||||
switch (iType) {
|
||||
|
||||
case MBINFO: iIcon = MB_ICONINFORMATION | MB_OK; break;
|
||||
case MBWARN: iIcon = MB_ICONWARNING | MB_OK; break;
|
||||
case MBYESNO: iIcon = MB_ICONQUESTION | MB_YESNO; break;
|
||||
case MBYESNOCANCEL: iIcon = MB_ICONINFORMATION | MB_YESNOCANCEL; break;
|
||||
case MBYESNOWARN: iIcon = MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON1; break;
|
||||
case MBOKCANCEL: iIcon = MB_ICONEXCLAMATION | MB_OKCANCEL; break;
|
||||
case MBRETRYCANCEL: iIcon = MB_ICONQUESTION | MB_RETRYCANCEL; break;
|
||||
default: iIcon = MB_ICONSTOP | MB_OK; break;
|
||||
}
|
||||
#endif
|
||||
|
||||
uType |= (MB_TOPMOST | MB_SETFOREGROUND);
|
||||
|
||||
// center message box to main
|
||||
HWND focus = GetFocus();
|
||||
HWND hwnd = focus ? focus : Globals.hwndMain;
|
||||
s_hhkMsgBox = SetWindowsHookEx(WH_CBT, &_MsgBoxProc, 0, GetCurrentThreadId());
|
||||
|
||||
return MessageBoxEx(hwnd, szText, szTitle, uType, Globals.iPrefLANGID);
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// _InfoBoxLngDlgProc()
|
||||
@ -225,7 +200,7 @@ static INT_PTR CALLBACK _InfoBoxLngDlgProc(HWND hwnd, UINT umsg, WPARAM wParam,
|
||||
DialogHideControl(hwnd, IDC_INFOBOXCHECK, true);
|
||||
}
|
||||
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
AttentionBeep(lpMsgBox->uType);
|
||||
|
||||
FreeMem(lpMsgBox->lpstrMessage);
|
||||
@ -427,7 +402,7 @@ static INT_PTR CALLBACK CmdLineHelpProc(HWND hwnd, UINT umsg, WPARAM wParam, LPA
|
||||
WCHAR szText[4096] = { L'\0' };
|
||||
GetLngString(IDS_MUI_CMDLINEHELP, szText, COUNTOF(szText));
|
||||
SetDlgItemText(hwnd, IDC_CMDLINEHELP, szText);
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -782,7 +757,7 @@ INT_PTR CALLBACK AboutDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam
|
||||
|
||||
#endif
|
||||
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -927,7 +902,7 @@ static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM l
|
||||
SetDlgItemText(hwnd, IDC_COMMANDLINE, (LPCWSTR)lParam);
|
||||
SHAutoComplete(GetDlgItem(hwnd, IDC_COMMANDLINE), SHACF_FILESYSTEM);
|
||||
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -1107,7 +1082,7 @@ static INT_PTR CALLBACK OpenWithDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM
|
||||
|
||||
MakeBitmapButton(hwnd,IDC_GETOPENWITHDIR,Globals.hInstance,IDB_OPEN);
|
||||
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -1307,7 +1282,7 @@ static INT_PTR CALLBACK FavoritesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
|
||||
|
||||
MakeBitmapButton(hwnd,IDC_GETFAVORITESDIR,Globals.hInstance,IDB_OPEN);
|
||||
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -1474,7 +1449,7 @@ static INT_PTR CALLBACK AddToFavDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPA
|
||||
SendDlgItemMessage(hwnd, IDC_ADDFAV_FILES, EM_LIMITTEXT, MAX_PATH - 1, 0);
|
||||
SetDlgItemText(hwnd, IDC_ADDFAV_FILES, pszName);
|
||||
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -1717,7 +1692,7 @@ static INT_PTR CALLBACK FileMRUDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM
|
||||
// DialogEnableWindow(hwnd,IDC_REMEMBERSEARCHPATTERN, false);
|
||||
//}
|
||||
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -2050,7 +2025,7 @@ static INT_PTR CALLBACK ChangeNotifyDlgProc(HWND hwnd, UINT umsg, WPARAM wParam,
|
||||
if (Settings.ResetFileWatching) {
|
||||
CheckDlgButton(hwnd, 103, BST_CHECKED);
|
||||
}
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -2130,7 +2105,7 @@ static INT_PTR CALLBACK ColumnWrapDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, L
|
||||
UINT const uiNumber = *((UINT*)lParam);
|
||||
SetDlgItemInt(hwnd, IDC_COLUMNWRAP, uiNumber, false);
|
||||
SendDlgItemMessage(hwnd, IDC_COLUMNWRAP, EM_LIMITTEXT, 15, 0);
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -2233,7 +2208,7 @@ static INT_PTR CALLBACK WordWrapSettingsDlgProc(HWND hwnd, UINT umsg, WPARAM wPa
|
||||
SendDlgItemMessage(hwnd, 102, CB_SETCURSEL, (WPARAM)(Settings.ShowWordWrapSymbols ? ((Settings.WordWrapSymbols % 100) - (Settings.WordWrapSymbols % 10)) / 10 : 0), 0);
|
||||
SendDlgItemMessage(hwnd, 103, CB_SETCURSEL, (WPARAM)Settings.WordWrapMode, 0);
|
||||
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -2329,7 +2304,7 @@ static INT_PTR CALLBACK LongLineSettingsDlgProc(HWND hwnd, UINT umsg, WPARAM wPa
|
||||
else {
|
||||
CheckRadioButton(hwnd, 101, 102, 101);
|
||||
}
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
|
||||
}
|
||||
return true;
|
||||
@ -2425,7 +2400,7 @@ static INT_PTR CALLBACK TabSettingsDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPA
|
||||
CheckDlgButton(hwnd,IDC_WARN_INCONSISTENT_INDENTS, SetBtn(Settings.WarnInconsistentIndents));
|
||||
CheckDlgButton(hwnd,IDC_AUTO_DETECT_INDENTS, SetBtn(Settings.AutoDetectIndentSettings));
|
||||
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -2557,7 +2532,7 @@ static INT_PTR CALLBACK SelectDefEncodingDlgProc(HWND hwnd, UINT umsg, WPARAM wP
|
||||
|
||||
DialogEnableControl(hwnd, IDC_USEASREADINGFALLBACK, Encoding_IsASCII(s_iEnc));
|
||||
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -2726,7 +2701,7 @@ static INT_PTR CALLBACK SelectEncodingDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,
|
||||
|
||||
ListView_SetColumnWidth(hwndLV,0,LVSCW_AUTOSIZE_USEHEADER);
|
||||
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -2921,7 +2896,7 @@ static INT_PTR CALLBACK SelectDefLineEndingDlgProc(HWND hwnd,UINT umsg,WPARAM wP
|
||||
CheckDlgButton(hwnd,IDC_CONSISTENT_EOLS, SetBtn(Settings.FixLineEndings));
|
||||
CheckDlgButton(hwnd,IDC_AUTOSTRIPBLANKS, SetBtn(Settings.FixTrailingBlanks));
|
||||
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -3009,7 +2984,7 @@ static INT_PTR CALLBACK WarnLineEndingDlgProc(HWND hwnd, UINT umsg, WPARAM wPara
|
||||
}
|
||||
|
||||
CheckDlgButton(hwnd, IDC_WARN_INCONSISTENT_EOLS, SetBtn(Settings.WarnInconsistEOLs));
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
|
||||
AttentionBeep(MB_ICONEXCLAMATION);
|
||||
}
|
||||
@ -3109,7 +3084,7 @@ static INT_PTR CALLBACK WarnIndentationDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
|
||||
|
||||
CheckDlgButton(hwnd, Globals.fvCurFile.bTabsAsSpaces ? IDC_INDENT_BY_SPCS : IDC_INDENT_BY_TABS, true);
|
||||
CheckDlgButton(hwnd, IDC_WARN_INCONSISTENT_INDENTS, SetBtn(Settings.WarnInconsistentIndents));
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
|
||||
AttentionBeep(MB_ICONEXCLAMATION);
|
||||
}
|
||||
@ -3630,44 +3605,46 @@ void SetWindowTransparentMode(HWND hwnd, bool bTransparentMode, int iOpacityLeve
|
||||
//
|
||||
// CenterDlgInParent()
|
||||
//
|
||||
void CenterDlgInParent(HWND hDlg)
|
||||
void CenterDlgInParent(HWND hDlg, HWND hDlgParent /* = NULL */)
|
||||
{
|
||||
if (!hDlg) { return; }
|
||||
|
||||
RECT rcDlg;
|
||||
GetWindowRect(hDlg, &rcDlg);
|
||||
|
||||
HWND const hParent = GetParent(hDlg);
|
||||
HWND const hParent = hDlgParent ? hDlgParent : GetParent(hDlg);
|
||||
RECT rcParent;
|
||||
if (hParent)
|
||||
GetWindowRect(hParent, &rcParent);
|
||||
else
|
||||
GetWindowRect(GetDesktopWindow(), &rcParent);
|
||||
BOOL const bFoundRect = hParent ? GetWindowRect(hParent, &rcParent) : GetWindowRect(GetDesktopWindow(), &rcParent);
|
||||
|
||||
HMONITOR const hMonitor = MonitorFromRect(&rcParent, MONITOR_DEFAULTTONEAREST);
|
||||
if (bFoundRect)
|
||||
{
|
||||
HMONITOR const hMonitor = MonitorFromRect(&rcParent, MONITOR_DEFAULTTONEAREST);
|
||||
|
||||
MONITORINFO mi;
|
||||
mi.cbSize = sizeof(MONITORINFO);
|
||||
GetMonitorInfo(hMonitor, &mi);
|
||||
MONITORINFO mi;
|
||||
mi.cbSize = sizeof(MONITORINFO);
|
||||
GetMonitorInfo(hMonitor, &mi);
|
||||
|
||||
int const xMin = mi.rcWork.left;
|
||||
int const yMin = mi.rcWork.top;
|
||||
int const xMin = mi.rcWork.left;
|
||||
int const yMin = mi.rcWork.top;
|
||||
|
||||
int const xMax = (mi.rcWork.right) - (rcDlg.right - rcDlg.left);
|
||||
int const yMax = (mi.rcWork.bottom) - (rcDlg.bottom - rcDlg.top);
|
||||
int const xMax = (mi.rcWork.right) - (rcDlg.right - rcDlg.left);
|
||||
int const yMax = (mi.rcWork.bottom) - (rcDlg.bottom - rcDlg.top);
|
||||
|
||||
int x;
|
||||
if ((rcParent.right - rcParent.left) - (rcDlg.right - rcDlg.left) > 20)
|
||||
x = rcParent.left + (((rcParent.right - rcParent.left) - (rcDlg.right - rcDlg.left)) / 2);
|
||||
else
|
||||
x = rcParent.left + 70;
|
||||
int x;
|
||||
if ((rcParent.right - rcParent.left) - (rcDlg.right - rcDlg.left) > 20)
|
||||
x = rcParent.left + (((rcParent.right - rcParent.left) - (rcDlg.right - rcDlg.left)) / 2);
|
||||
else
|
||||
x = rcParent.left + 70;
|
||||
|
||||
int y;
|
||||
if ((rcParent.bottom - rcParent.top) - (rcDlg.bottom - rcDlg.top) > 20)
|
||||
y = rcParent.top + (((rcParent.bottom - rcParent.top) - (rcDlg.bottom - rcDlg.top)) / 2);
|
||||
else
|
||||
y = rcParent.top + 60;
|
||||
int y;
|
||||
if ((rcParent.bottom - rcParent.top) - (rcDlg.bottom - rcDlg.top) > 20)
|
||||
y = rcParent.top + (((rcParent.bottom - rcParent.top) - (rcDlg.bottom - rcDlg.top)) / 2);
|
||||
else
|
||||
y = rcParent.top + 60;
|
||||
|
||||
SetWindowPos(hDlg, NULL, clampi(x, xMin, xMax), clampi(y, yMin, yMax), 0, 0, SWP_NOZORDER | SWP_NOSIZE);
|
||||
SetWindowPos(hDlg, NULL, clampi(x, xMin, xMax), clampi(y, yMin, yMax), 0, 0, SWP_NOZORDER | SWP_NOSIZE);
|
||||
|
||||
}
|
||||
//~SnapToDefaultButton(hDlg);
|
||||
}
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ void DialogNewWindow(HWND hwnd,bool,bool);
|
||||
void DialogFileBrowse(HWND hwnd);
|
||||
void DialogAdminExe(HWND hwnd,bool);
|
||||
|
||||
int MessageBoxLng(UINT uType, UINT uIdMsg, ...);
|
||||
int MessageBoxLng(HWND hwnd, UINT uType, UINT uIdMsg, ...);
|
||||
INT_PTR InfoBoxLng(UINT uType, LPCWSTR lpstrSetting, UINT uidMessage, ...);
|
||||
DWORD GetLastErrorToMsgBox(LPWSTR lpszFunction, DWORD dwErrID);
|
||||
|
||||
@ -57,7 +57,7 @@ bool SetWindowTitle(HWND hwnd, UINT uIDAppName, bool, UINT uIDUntitled, LPCWSTR
|
||||
void SetAdditionalTitleInfo(LPCWSTR lpszAddTitleInfo);
|
||||
void AppendAdditionalTitleInfo(LPCWSTR lpszAddTitleInfo);
|
||||
void SetWindowTransparentMode(HWND hwnd, bool bTransparentMode, int iOpacityLevel);
|
||||
void CenterDlgInParent(HWND hDlg);
|
||||
void CenterDlgInParent(HWND hDlg, HWND hDlgParent);
|
||||
void GetDlgPos(HWND hDlg, LPINT xDlg, LPINT yDlg);
|
||||
void SetDlgPos(HWND hDlg, int xDlg, int yDlg);
|
||||
//void SnapToDefaultButton(HWND);
|
||||
@ -117,7 +117,7 @@ inline void AttentionBeep(UINT uType) { if (!Settings.MuteMessageBeep) { Message
|
||||
#define DialogHideControl(hdlg, id, b) { HWND hctrl = GetDlgItem((hdlg),(id)); if (!(b)) { \
|
||||
if (GetFocus() == hctrl) { SendMessage((hdlg), WM_NEXTDLGCTL, 0, false); } }; ShowWindow(hctrl, (b)?SW_HIDE:SW_SHOW); }
|
||||
|
||||
|
||||
|
||||
// --- Themed Dialogs ---------------------------------------------------------
|
||||
|
||||
#ifndef DLGTEMPLATEEX
|
||||
|
||||
22
src/Edit.c
22
src/Edit.c
@ -5437,7 +5437,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara
|
||||
|
||||
if (!s_bSwitchedFindReplace) {
|
||||
if (Settings.FindReplaceDlgPosX == CW_USEDEFAULT || Settings.FindReplaceDlgPosY == CW_USEDEFAULT)
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
else
|
||||
SetDlgPos(hwnd, Settings.FindReplaceDlgPosX, Settings.FindReplaceDlgPosY);
|
||||
}
|
||||
@ -6042,7 +6042,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara
|
||||
break;
|
||||
|
||||
case IDACC_RESETPOS:
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
Settings.FindReplaceDlgPosX = Settings.FindReplaceDlgPosY = CW_USEDEFAULT;
|
||||
break;
|
||||
|
||||
@ -6118,13 +6118,13 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara
|
||||
}
|
||||
// Display help messages in the find/replace windows
|
||||
else if (pnmhdr->idFrom == IDC_BACKSLASHHELP) {
|
||||
MessageBoxLng(MB_ICONINFORMATION, IDS_MUI_BACKSLASHHELP);
|
||||
MessageBoxLng(hwnd, MB_ICONINFORMATION, IDS_MUI_BACKSLASHHELP);
|
||||
}
|
||||
else if (pnmhdr->idFrom == IDC_REGEXPHELP) {
|
||||
MessageBoxLng(MB_ICONINFORMATION, IDS_MUI_REGEXPHELP);
|
||||
MessageBoxLng(hwnd, MB_ICONINFORMATION, IDS_MUI_REGEXPHELP);
|
||||
}
|
||||
else if (pnmhdr->idFrom == IDC_WILDCARDHELP) {
|
||||
MessageBoxLng(MB_ICONINFORMATION, IDS_MUI_WILDCARDHELP);
|
||||
MessageBoxLng(hwnd, MB_ICONINFORMATION, IDS_MUI_WILDCARDHELP);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -7419,7 +7419,7 @@ static INT_PTR CALLBACK EditLinenumDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPA
|
||||
SetDlgItemInt(hwnd, IDC_COLNUM, (int)clampp(iCurColumn, 0, INT_MAX), false);
|
||||
SendDlgItemMessage(hwnd,IDC_LINENUM,EM_LIMITTEXT,80,0);
|
||||
SendDlgItemMessage(hwnd,IDC_COLNUM,EM_LIMITTEXT,80,0);
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -7565,7 +7565,7 @@ static INT_PTR CALLBACK EditModifyLinesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam
|
||||
SendDlgItemMessage(hwnd,100,EM_LIMITTEXT,255,0);
|
||||
SetDlgItemTextW(hwnd,101,pdata->pwsz2);
|
||||
SendDlgItemMessage(hwnd,101,EM_LIMITTEXT,255,0);
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -7745,7 +7745,7 @@ static INT_PTR CALLBACK EditAlignDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
|
||||
piAlignMode = (int*)lParam;
|
||||
if (Globals.hDlgIcon) { SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)Globals.hDlgIcon); }
|
||||
CheckRadioButton(hwnd,100,104,*piAlignMode+100);
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -7829,7 +7829,7 @@ static INT_PTR CALLBACK EditEncloseSelectionDlgProc(HWND hwnd,UINT umsg,WPARAM w
|
||||
SetDlgItemTextW(hwnd,100,pdata->pwsz1);
|
||||
SendDlgItemMessage(hwnd,101,EM_LIMITTEXT,255,0);
|
||||
SetDlgItemTextW(hwnd,101,pdata->pwsz2);
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -7916,7 +7916,7 @@ static INT_PTR CALLBACK EditInsertTagDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,L
|
||||
SetDlgItemInt(hwnd, 102, pdata->repeat, FALSE);
|
||||
SetFocus(GetDlgItem(hwnd,100));
|
||||
PostMessage(GetDlgItem(hwnd,100),EM_SETSEL,1,(int)(StringCchLen(wchOpenTagStrg,0)-1));
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
}
|
||||
return false;
|
||||
|
||||
@ -8106,7 +8106,7 @@ static INT_PTR CALLBACK EditSortDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM
|
||||
*piSortFlags |= SORT_COLUMN;
|
||||
CheckDlgButton(hwnd,112,BST_CHECKED);
|
||||
}
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
}
|
||||
return true;
|
||||
|
||||
|
||||
@ -9992,7 +9992,9 @@ bool FileSave(bool bSaveAlways, bool bAsk, bool bSaveAs, bool bSaveCopy, bool bP
|
||||
GetLngString(IDS_MUI_UNTITLED, tch, COUNTOF(tch));
|
||||
}
|
||||
|
||||
switch (InfoBoxLng(MB_YESNOCANCEL | MB_ICONWARNING, NULL, IDS_MUI_ASK_SAVE, tch)) {
|
||||
//switch (InfoBoxLng(MB_YESNOCANCEL | MB_ICONWARNING, NULL, IDS_MUI_ASK_SAVE, tch))
|
||||
switch (MessageBoxLng(Globals.hwndMain, MB_YESNOCANCEL | MB_ICONWARNING, IDS_MUI_ASK_SAVE, tch))
|
||||
{
|
||||
case IDCANCEL:
|
||||
return false;
|
||||
case IDNO:
|
||||
|
||||
@ -3823,7 +3823,7 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam
|
||||
|
||||
if (Settings.CustomSchemesDlgPosX == CW_USEDEFAULT || Settings.CustomSchemesDlgPosY == CW_USEDEFAULT)
|
||||
{
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
}
|
||||
else {
|
||||
SetDlgPos(hwnd, Settings.CustomSchemesDlgPosX, Settings.CustomSchemesDlgPosY);
|
||||
@ -4370,7 +4370,7 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam
|
||||
break;
|
||||
|
||||
case IDACC_RESETPOS:
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
Settings.CustomSchemesDlgPosX = Settings.CustomSchemesDlgPosY = CW_USEDEFAULT;
|
||||
break;
|
||||
|
||||
@ -4506,7 +4506,7 @@ INT_PTR CALLBACK Style_SelectLexerDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPAR
|
||||
iInternalDefault = _s_idefaultLexer;
|
||||
CheckDlgButton(hwnd,IDC_AUTOSELECT, SetBtn(s_bAutoSelect));
|
||||
|
||||
CenterDlgInParent(hwnd);
|
||||
CenterDlgInParent(hwnd, NULL);
|
||||
}
|
||||
return true;
|
||||
|
||||
|
||||
@ -8,8 +8,8 @@
|
||||
#define SAPPNAME "Notepad3"
|
||||
#define VERSION_MAJOR 5
|
||||
#define VERSION_MINOR 19
|
||||
#define VERSION_REV 1120
|
||||
#define VERSION_BUILD 2681
|
||||
#define VERSION_REV 1121
|
||||
#define VERSION_BUILD 2682
|
||||
#define SCINTILLA_VER 421
|
||||
#define ONIGURUMA_REGEX_VER 6.9.4
|
||||
#define UCHARDET_VER 2018.09.27
|
||||
|
||||
Loading…
Reference in New Issue
Block a user