Merge pull request #2595 from RaiKoHoff/Dev_NewFeatures

DPI-Awareness issues
This commit is contained in:
Rainer Kottenhoff 2020-08-02 20:23:10 +02:00 committed by GitHub
commit e34a28f20e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 294 additions and 150 deletions

View File

@ -54,6 +54,7 @@ SettingsVersion=4
;LexerSQLNumberSignAsComment=1
;ExitOnESCSkipLevel=2
;ZoomTooltipTimeout=3200
;LargeIconScalePrecent=150
[Statusbar Settings]
;VisibleSections=0 1 12 14 2 4 5 6 7 8 9 10 11
;SectionPrefixes=Ln ,Col ,Sel ,Sb ,SLn ,Occ ,,,,,,,Ch ,Repl ,Eval ,

View File

@ -565,8 +565,9 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM
CAPTION "Notepad3"
FONT 9, "Segoe UI", 400, 0, 0x1
BEGIN
ICON IDR_MAINWND,IDC_INFOBOXICON,7,7,21,20
LTEXT "",IDC_INFOBOXTEXT,35,7,222,41,SS_EDITCONTROL | SS_NOPREFIX
//ICON IDR_MAINWND,IDC_INFOBOXICON,7,7,0,0
CONTROL IDR_MAINWND, IDC_INFOBOXICON, "Static", SS_BITMAP | SS_NOTIFY, 7, 7, 24, 24, WS_EX_TRANSPARENT
LTEXT "",IDC_INFOBOXTEXT,35,7,222,41,SS_EDITCONTROL | SS_NOPREFIX | SS_LEFT
DEFPUSHBUTTON "&OK",IDOK,207,50,50,14
CONTROL "&Diese Nachricht nicht nochmals anzeigen.",IDC_INFOBOXCHECK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,54,140,10
@ -577,8 +578,9 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM
CAPTION "Notepad3"
FONT 9, "Segoe UI", 400, 0, 0x1
BEGIN
ICON IDR_MAINWND,IDC_INFOBOXICON,7,7,21,20
LTEXT "",IDC_INFOBOXTEXT,35,7,222,41,SS_EDITCONTROL | SS_NOPREFIX
//ICON IDR_MAINWND,IDC_INFOBOXICON,7,7,0,0
CONTROL IDR_MAINWND, IDC_INFOBOXICON, "Static", SS_BITMAP | SS_NOTIFY, 7, 7, 24, 24, WS_EX_TRANSPARENT
LTEXT "",IDC_INFOBOXTEXT,35,7,222,41,SS_EDITCONTROL | SS_NOPREFIX | SS_LEFT
PUSHBUTTON "&Ja",IDYES,151,50,50,14
PUSHBUTTON "&Nein",IDNO,207,50,50,14
CONTROL "&Diese Nachricht nicht nochmals anzeigen.",IDC_INFOBOXCHECK,
@ -590,8 +592,9 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM
CAPTION "Notepad3"
FONT 9, "Segoe UI", 400, 0, 0x1
BEGIN
ICON IDR_MAINWND,IDC_INFOBOXICON,7,7,21,20
LTEXT "",IDC_INFOBOXTEXT,35,7,222,41,SS_EDITCONTROL | SS_NOPREFIX
//ICON IDR_MAINWND,IDC_INFOBOXICON,7,7,0,0
CONTROL IDR_MAINWND, IDC_INFOBOXICON, "Static", SS_BITMAP | SS_NOTIFY, 7, 7, 24, 24, WS_EX_TRANSPARENT
LTEXT "",IDC_INFOBOXTEXT,35,7,222,41,SS_EDITCONTROL | SS_NOPREFIX | SS_LEFT
DEFPUSHBUTTON "&OK",IDOK,151,50,50,14
PUSHBUTTON "&Abbrechen",IDCANCEL,207,50,50,14
CONTROL "&Diese Nachricht nicht nochmals anzeigen.",IDC_INFOBOXCHECK,
@ -603,8 +606,9 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM
CAPTION "Notepad3"
FONT 9, "Segoe UI", 400, 0, 0x1
BEGIN
ICON IDR_MAINWND,IDC_INFOBOXICON,7,7,21,20
LTEXT "",IDC_INFOBOXTEXT,35,7,126,41,SS_EDITCONTROL | SS_NOPREFIX
//ICON IDR_MAINWND,IDC_INFOBOXICON,7,7,0,0
CONTROL IDR_MAINWND, IDC_INFOBOXICON, "Static", SS_BITMAP | SS_NOTIFY, 7, 7, 24, 24, WS_EX_TRANSPARENT
LTEXT "",IDC_INFOBOXTEXT,35,7,126,41,SS_EDITCONTROL | SS_NOPREFIX | SS_LEFT
DEFPUSHBUTTON "&Ja",IDOK,7,70,50,14
PUSHBUTTON "&Nein",IDNO,61,70,50,14
PUSHBUTTON "&Abbrechen",IDCANCEL,115,70,50,14
@ -617,8 +621,9 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM
CAPTION "Notepad3"
FONT 9, "Segoe UI", 400, 0, 0x1
BEGIN
ICON IDR_MAINWND,IDC_INFOBOXICON,7,7,21,20
LTEXT "",IDC_INFOBOXTEXT,35,7,202,41,SS_EDITCONTROL | SS_NOPREFIX
//ICON IDR_MAINWND,IDC_INFOBOXICON,7,7,0,0
CONTROL IDR_MAINWND, IDC_INFOBOXICON, "Static", SS_BITMAP | SS_NOTIFY, 7, 7, 24, 24, WS_EX_TRANSPARENT
LTEXT "",IDC_INFOBOXTEXT,35,7,202,41,SS_EDITCONTROL | SS_NOPREFIX | SS_LEFT
DEFPUSHBUTTON "Wiederholen",IDRETRY,131,50,50,14
PUSHBUTTON "&Abbrechen",IDCANCEL,187,50,50,14
CONTROL "&Diese Nachricht nicht nochmals anzeigen.",IDC_INFOBOXCHECK,

View File

@ -565,8 +565,9 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM
CAPTION "Notepad3"
FONT 9, "Segoe UI", 400, 0, 0x1
BEGIN
ICON IDR_MAINWND,IDC_INFOBOXICON,7,7,21,20
LTEXT "",IDC_INFOBOXTEXT,35,7,202,41,SS_EDITCONTROL | SS_NOPREFIX
//ICON IDR_MAINWND,IDC_INFOBOXICON,7,7,0,0
CONTROL IDR_MAINWND, IDC_INFOBOXICON, "Static", SS_BITMAP | SS_NOTIFY, 7, 7, 24, 24, WS_EX_TRANSPARENT
LTEXT "",IDC_INFOBOXTEXT,35,7,202,41,SS_EDITCONTROL | SS_NOPREFIX | SS_LEFT
DEFPUSHBUTTON "&OK",IDOK,187,50,50,14
CONTROL "&Don't display this message again.",IDC_INFOBOXCHECK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,54,122,10
@ -577,8 +578,9 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM
CAPTION "Notepad3"
FONT 9, "Segoe UI", 400, 0, 0x1
BEGIN
ICON IDR_MAINWND,IDC_INFOBOXICON,7,7,21,20
LTEXT "",IDC_INFOBOXTEXT,35,7,202,41,SS_EDITCONTROL | SS_NOPREFIX
//ICON IDR_MAINWND,IDC_INFOBOXICON,7,7,0,0
CONTROL IDR_MAINWND, IDC_INFOBOXICON, "Static", SS_BITMAP | SS_NOTIFY, 7, 7, 24, 24, WS_EX_TRANSPARENT
LTEXT "",IDC_INFOBOXTEXT,35,7,202,41,SS_EDITCONTROL | SS_NOPREFIX | SS_LEFT
PUSHBUTTON "&Yes",IDYES,131,50,50,14
PUSHBUTTON "&No",IDNO,187,50,50,14
CONTROL "&Don't display this message again.",IDC_INFOBOXCHECK,
@ -590,8 +592,9 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM
CAPTION "Notepad3"
FONT 9, "Segoe UI", 400, 0, 0x1
BEGIN
ICON IDR_MAINWND,IDC_INFOBOXICON,7,7,21,20
LTEXT "",IDC_INFOBOXTEXT,35,7,202,41,SS_EDITCONTROL | SS_NOPREFIX
//ICON IDR_MAINWND,IDC_INFOBOXICON,7,7,0,0
CONTROL IDR_MAINWND, IDC_INFOBOXICON, "Static", SS_BITMAP | SS_NOTIFY, 7, 7, 24, 24, WS_EX_TRANSPARENT
LTEXT "",IDC_INFOBOXTEXT,35,7,202,41,SS_EDITCONTROL | SS_NOPREFIX | SS_LEFT
DEFPUSHBUTTON "&OK",IDOK,131,50,50,14
PUSHBUTTON "&Cancel",IDCANCEL,187,50,50,14
CONTROL "&Don't display this message again.",IDC_INFOBOXCHECK,
@ -603,8 +606,9 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM
CAPTION "Notepad3"
FONT 9, "Segoe UI", 400, 0, 0x1
BEGIN
ICON IDR_MAINWND,IDC_INFOBOXICON,7,7,21,20
LTEXT "",IDC_INFOBOXTEXT,35,7,126,41,SS_EDITCONTROL | SS_NOPREFIX
//ICON IDR_MAINWND,IDC_INFOBOXICON,7,7,0,0
CONTROL IDR_MAINWND, IDC_INFOBOXICON, "Static", SS_BITMAP | SS_NOTIFY, 7, 7, 24, 24, WS_EX_TRANSPARENT
LTEXT "",IDC_INFOBOXTEXT,35,7,126,41,SS_EDITCONTROL | SS_NOPREFIX | SS_LEFT
DEFPUSHBUTTON "&Yes",IDOK,7,70,50,14
PUSHBUTTON "&No",IDNO,61,70,50,14
PUSHBUTTON "&Cancel",IDCANCEL,115,70,50,14
@ -617,8 +621,9 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM
CAPTION "Notepad3"
FONT 9, "Segoe UI", 400, 0, 0x1
BEGIN
ICON IDR_MAINWND,IDC_INFOBOXICON,7,7,21,20
LTEXT "",IDC_INFOBOXTEXT,35,7,202,41,SS_EDITCONTROL | SS_NOPREFIX
//ICON IDR_MAINWND,IDC_INFOBOXICON,7,7,0,0
CONTROL IDR_MAINWND, IDC_INFOBOXICON, "Static", SS_BITMAP | SS_NOTIFY, 7, 7, 24, 24, WS_EX_TRANSPARENT
LTEXT "",IDC_INFOBOXTEXT,35,7,202,41,SS_EDITCONTROL | SS_NOPREFIX | SS_LEFT
DEFPUSHBUTTON "Retry",IDRETRY,131,50,50,14
PUSHBUTTON "&Cancel",IDCANCEL,187,50,50,14
CONTROL "&Don't display this message again.",IDC_INFOBOXCHECK,

View File

@ -1290,6 +1290,9 @@ void LoadSettings()
Defaults2.ZoomTooltipTimeout = 3200;
Settings2.ZoomTooltipTimeout = clampi(IniSectionGetInt(IniSecSettings2, L"ZoomTooltipTimeout", Defaults2.ZoomTooltipTimeout), 0, 10000);
Defaults2.LargeIconScalePrecent = 150;
Settings2.LargeIconScalePrecent = clampi(IniSectionGetInt(IniSecSettings2, L"LargeIconScalePrecent", Defaults2.LargeIconScalePrecent), 100, 1000);
// --------------------------------------------------------------------------
// Settings: IniSecSettings
// --------------------------------------------------------------------------

View File

@ -132,7 +132,7 @@ static LRESULT CALLBACK SetPosRelatedToParent_Hook(INT nCode, WPARAM wParam, LPA
// -----------------------------------------------------------------------------
int MessageBoxLng(HWND hwnd, UINT uType, UINT uidMsg, ...)
int MessageBoxLng(UINT uType, UINT uidMsg, ...)
{
WCHAR szFormat[HUGE_BUFFER] = { L'\0' };
if (!GetLngString(uidMsg, szFormat, COUNTOF(szFormat))) { return -1; }
@ -152,7 +152,9 @@ int MessageBoxLng(HWND hwnd, UINT uType, UINT uidMsg, ...)
uType |= MB_SETFOREGROUND; //~ not MB_TOPMOST
// center message box to focus or main
s_hCBThook = SetWindowsHookEx(WH_CBT, &SetPosRelatedToParent_Hook, 0, GetCurrentThreadId());
HWND const focus = GetFocus();
HWND const hwnd = focus ? focus : Globals.hwndMain;
s_hCBThook = SetWindowsHookEx(WH_CBT, &SetPosRelatedToParent_Hook, 0, GetCurrentThreadId());
return MessageBoxEx(hwnd, szText, szTitle, uType, Globals.iPrefLANGID);
}
@ -190,8 +192,8 @@ DWORD MsgBoxLastError(LPCWSTR lpszMessage, DWORD dwErrID)
GetLngString(IDS_MUI_ERR_DLG_FORMAT, msgFormat, COUNTOF(msgFormat));
StringCchPrintf(lpDisplayBuf, len, msgFormat, lpszMessage, (LPCWSTR)lpMsgBuf, dwErrID);
// center message box to main
HWND focus = GetFocus();
HWND hwnd = focus ? focus : Globals.hwndMain;
HWND const focus = GetFocus();
HWND const hwnd = focus ? focus : Globals.hwndMain;
s_hCBThook = SetWindowsHookEx(WH_CBT, &SetPosRelatedToParent_Hook, 0, GetCurrentThreadId());
MessageBoxEx(hwnd, lpDisplayBuf, _W(SAPPNAME) L" - ERROR", MB_ICONERROR, Globals.iPrefLANGID);
@ -230,6 +232,10 @@ typedef struct _infbox {
static INT_PTR CALLBACK _InfoBoxLngDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
{
static HBITMAP hIconBmp = NULL;
static HICON hBoxIcon = NULL;
static DPI_T dpi = {USER_DEFAULT_SCREEN_DPI, USER_DEFAULT_SCREEN_DPI};
switch (umsg)
{
case WM_INITDIALOG:
@ -239,28 +245,37 @@ static INT_PTR CALLBACK _InfoBoxLngDlgProc(HWND hwnd, UINT umsg, WPARAM wParam,
LPINFOBOXLNG const lpMsgBox = (LPINFOBOXLNG)lParam;
dpi = Scintilla_GetWindowDPI(hwnd);
int const scxb = ScaleIntByDPI(GetSystemMetrics(SM_CXICON), dpi.x);
int const scyb = ScaleIntByDPI(GetSystemMetrics(SM_CYICON), dpi.y);
switch (lpMsgBox->uType & MB_ICONMASK)
{
case MB_ICONQUESTION:
SendDlgItemMessage(hwnd, IDC_INFOBOXICON, STM_SETICON, (WPARAM)Globals.hIconMsgQuest, 0);
hBoxIcon = Globals.hIconMsgQuest;
break;
case MB_ICONWARNING: // = MB_ICONEXCLAMATION
SendDlgItemMessage(hwnd, IDC_INFOBOXICON, STM_SETICON, (WPARAM)Globals.hIconMsgWarn, 0);
hBoxIcon = Globals.hIconMsgWarn;
break;
case MB_ICONERROR: // = MB_ICONSTOP, MB_ICONHAND
SendDlgItemMessage(hwnd, IDC_INFOBOXICON, STM_SETICON, (WPARAM)Globals.hIconMsgError, 0);
hBoxIcon = Globals.hIconMsgError;
break;
case MB_ICONSHIELD:
SendDlgItemMessage(hwnd, IDC_INFOBOXICON, STM_SETICON, (WPARAM)Globals.hIconMsgShield, 0);
hBoxIcon = Globals.hIconMsgShield;
break;
case MB_USERICON:
SendDlgItemMessage(hwnd, IDC_INFOBOXICON, STM_SETICON, (WPARAM)Globals.hIconMsgUser, 0);
hBoxIcon = Globals.hIconMsgUser;
break;
case MB_ICONINFORMATION: // = MB_ICONASTERISK
default:
SendDlgItemMessage(hwnd, IDC_INFOBOXICON, STM_SETICON, (WPARAM)Globals.hIconMsgInfo, 0);
hBoxIcon = Globals.hIconMsgInfo;
break;
}
hIconBmp = ResampleIconToBitmap(hwnd, hBoxIcon, scxb, scyb);
if (hIconBmp) {
SetBitmapControl(hwnd, IDC_INFOBOXICON, hIconBmp);
}
SetDlgItemText(hwnd, IDC_INFOBOXTEXT, lpMsgBox->lpstrMessage);
@ -274,13 +289,28 @@ static INT_PTR CALLBACK _InfoBoxLngDlgProc(HWND hwnd, UINT umsg, WPARAM wParam,
FreeMem(lpMsgBox->lpstrMessage);
}
return !0;
return !0;
case WM_DPICHANGED:
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, NULL);
{
dpi.x = LOWORD(wParam);
dpi.y = HIWORD(wParam);
int const scxb = ScaleIntByDPI(GetSystemMetrics(SM_CXICON), dpi.x);
int const scyb = ScaleIntByDPI(GetSystemMetrics(SM_CYICON), dpi.y);
hIconBmp = ResampleIconToBitmap(hwnd, hBoxIcon, scxb, scyb);
if (hIconBmp) {
SetBitmapControl(hwnd, IDC_INFOBOXICON, hIconBmp);
}
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, NULL);
}
return !0;
case WM_DESTROY:
if (hIconBmp) {
DeleteObject(hIconBmp);
}
return !0;
case WM_COMMAND:
{
@ -301,7 +331,7 @@ static INT_PTR CALLBACK _InfoBoxLngDlgProc(HWND hwnd, UINT umsg, WPARAM wParam,
case IDCLOSE:
case IDCANCEL:
EndDialog(hwnd, LOWORD(wParam));
return true;
break;
case IDC_INFOBOXCHECK:
DialogEnableControl(hwnd, IDNO, !IsButtonChecked(hwnd, IDC_INFOBOXCHECK));
@ -313,8 +343,8 @@ static INT_PTR CALLBACK _InfoBoxLngDlgProc(HWND hwnd, UINT umsg, WPARAM wParam,
default:
break;
}
return !0;
}
return !0;
}
return 0;
}
@ -737,8 +767,9 @@ INT_PTR CALLBACK AboutDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam
int const width = ScaleIntByDPI(136, dpi.x);
int const height = ScaleIntByDPI(41, dpi.y);
SetBitmapControl(hwnd, IDC_RIZONEBMP, Globals.hInstance, IDR_RIZBITMAP, width, height);
HBITMAP hBmp = LoadImage(Globals.hInstance, MAKEINTRESOURCE(IDR_RIZBITMAP), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION);
SetBitmapControlResample(hwnd, IDC_RIZONEBMP, hBmp, width, height);
DeleteObject(hBmp);
}
break;
@ -762,7 +793,9 @@ INT_PTR CALLBACK AboutDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam
int const width = ScaleIntByDPI(136, dpi.x);
int const height = ScaleIntByDPI(41, dpi.y);
SetBitmapControl(hwnd, IDC_RIZONEBMP, Globals.hInstance, IDR_RIZBITMAP, width, height);
HBITMAP hBmp = LoadImage(Globals.hInstance, MAKEINTRESOURCE(IDR_RIZBITMAP), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION);
SetBitmapControlResample(hwnd, IDC_RIZONEBMP, hBmp, width, height);
DeleteObject(hBmp);
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, NULL);
}
@ -784,9 +817,10 @@ INT_PTR CALLBACK AboutDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam
if (hVersionFont) { DeleteObject(hVersionFont); }
hVersionFont = GetStockObject(DEFAULT_GUI_FONT);
LOGFONT lf; GetObject(hVersionFont, sizeof(LOGFONT), &lf);
int const newWidth = -MulDiv(MulDiv(lf.lfWidth, 3, 2), GetDeviceCaps(hDC, LOGPIXELSX), 72);
int const newHeight = -MulDiv(MulDiv(lf.lfHeight, 3, 2), GetDeviceCaps(hDC, LOGPIXELSY), 72);
lf.lfWeight = FW_BOLD;
lf.lfWidth = ScaleIntByDPI(6, dpi.x); // =0: the aspect ratio of the device is matched against the digitization aspect ratio of the available fonts
lf.lfWidth = ScaleIntByDPI(newWidth, dpi.x); // =0: the aspect ratio of the device is matched against the digitization aspect ratio of the available fonts
lf.lfHeight = ScaleIntByDPI(newHeight, dpi.y);
//~StringCchCopy(lf.lfFaceName, LF_FACESIZE, L"Tahoma");
hVersionFont = CreateFontIndirect(&lf);
@ -944,7 +978,7 @@ static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM l
{
SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR)lParam);
SetDialogIconNP3(hwnd);
// MakeBitmapButton(hwnd,IDC_SEARCHEXE,Globals.hInstance,IDB_OPEN);
// MakeBitmapButton(hwnd,IDC_SEARCHEXE,IDB_OPEN, -1, -1);
SendDlgItemMessage(hwnd, IDC_COMMANDLINE, EM_LIMITTEXT, MAX_PATH - 1, 0);
SetDlgItemText(hwnd, IDC_COMMANDLINE, (LPCWSTR)lParam);
SHAutoComplete(GetDlgItem(hwnd, IDC_COMMANDLINE), SHACF_FILESYSTEM);
@ -1129,7 +1163,7 @@ static INT_PTR CALLBACK OpenWithDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM
DirList_StartIconThread(GetDlgItem(hwnd,IDC_OPENWITHDIR));
ListView_SetItemState(GetDlgItem(hwnd,IDC_OPENWITHDIR),0,LVIS_FOCUSED,LVIS_FOCUSED);
MakeBitmapButton(hwnd,IDC_GETOPENWITHDIR,Globals.hInstance,IDB_OPEN, -1, -1);
MakeBitmapButton(hwnd,IDC_GETOPENWITHDIR,IDB_OPEN, -1, -1);
CenterDlgInParent(hwnd, NULL);
}
@ -1327,7 +1361,7 @@ static INT_PTR CALLBACK FavoritesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
DirList_StartIconThread(GetDlgItem(hwnd,IDC_FAVORITESDIR));
ListView_SetItemState(GetDlgItem(hwnd,IDC_FAVORITESDIR),0,LVIS_FOCUSED,LVIS_FOCUSED);
MakeBitmapButton(hwnd,IDC_GETFAVORITESDIR,Globals.hInstance,IDB_OPEN, -1, -1);
MakeBitmapButton(hwnd,IDC_GETFAVORITESDIR,IDB_OPEN, -1, -1);
CenterDlgInParent(hwnd, NULL);
}
@ -2582,7 +2616,7 @@ static INT_PTR CALLBACK SelectDefEncodingDlgProc(HWND hwnd, UINT umsg, WPARAM wP
PENCODEDLG const pdd = (PENCODEDLG)lParam;
HBITMAP hbmp = LoadImage(Globals.hInstance, MAKEINTRESOURCE(IDB_ENCODING), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION);
hbmp = ResizeImageBitmap(hwnd, hbmp, -1, -1);
hbmp = ResampleImageBitmap(hwnd, hbmp, -1, -1);
HIMAGELIST himl = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 0);
ImageList_AddMasked(himl, hbmp, CLR_DEFAULT);
@ -2738,7 +2772,7 @@ static INT_PTR CALLBACK SelectEncodingDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,
hwndLV = GetDlgItem(hwnd,IDC_ENCODINGLIST);
HBITMAP hbmp = LoadImage(Globals.hInstance,MAKEINTRESOURCE(IDB_ENCODING),IMAGE_BITMAP,0,0,LR_CREATEDIBSECTION);
hbmp = ResizeImageBitmap(hwnd, hbmp, -1, -1);
hbmp = ResampleImageBitmap(hwnd, hbmp, -1, -1);
HIMAGELIST himl = ImageList_Create(16,16,ILC_COLOR32|ILC_MASK,0,0);
ImageList_AddMasked(himl,hbmp,CLR_DEFAULT);
@ -4194,52 +4228,64 @@ void ResizeDlgCtl(HWND hwndDlg, int nCtlId, int dx, int dy) {
//=============================================================================
//
// SetBitmapControl()
//
void SetBitmapControl(HWND hwnd, int nCtrlId, HBITMAP hBmp)
{
HBITMAP hBmpOld = (HBITMAP)SendDlgItemMessage(hwnd, nCtrlId, STM_GETIMAGE, IMAGE_BITMAP, 0);
if (hBmpOld) {
DeleteObject(hBmpOld);
}
SendDlgItemMessage(hwnd, nCtrlId, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBmp);
}
//=============================================================================
//
// SetBitmapControlResample()
// if width|height <= 0 : scale bitmap to current dpi
//
void SetBitmapControl(HWND hwnd, int nCtrlId, HINSTANCE hInstance, WORD uBmpId, int width, int height)
void SetBitmapControlResample(HWND hwnd, int nCtrlId, HBITMAP hBmp, int width, int height)
{
HBITMAP hBmp = LoadImage(hInstance, MAKEINTRESOURCE(uBmpId), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION);
if ((width == 0) || (height == 0))
{
width = GetDlgCtrlWidth(hwnd, nCtrlId);
height = GetDlgCtrlHeight(hwnd, nCtrlId);
}
hBmp = ResizeImageBitmap(hwnd, hBmp, width, height);
hBmp = ResampleImageBitmap(hwnd, hBmp, width, height);
HBITMAP hBmpOld = (HBITMAP)SendDlgItemMessage(hwnd, nCtrlId, STM_GETIMAGE, IMAGE_BITMAP, 0);
if (hBmpOld) {
//BITMAP bmp; GetObject(hBmpOld, sizeof(BITMAP), &bmp);
DeleteObject(hBmpOld);
}
SendDlgItemMessage(hwnd, nCtrlId, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hBmp);
SetBitmapControl(hwnd, nCtrlId, hBmp);
}
//=============================================================================
//
// MakeBitmapButton()
// if width|height <= 0 : scale bitmap to current dpi
//
void MakeBitmapButton(HWND hwnd, int nCtrlId, HINSTANCE hInstance, WORD uBmpId, int width, int height)
void MakeBitmapButton(HWND hwnd, int nCtrlId, WORD uBmpId, int width, int height)
{
HWND const hwndCtrl = GetDlgItem(hwnd, nCtrlId);
HBITMAP hBmp = LoadImage(hInstance, MAKEINTRESOURCE(uBmpId), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION);
if ((width == 0) || (height == 0)) {
width = GetDlgCtrlWidth(hwnd, nCtrlId);
height = GetDlgCtrlHeight(hwnd, nCtrlId);
}
hBmp = ResizeImageBitmap(hwnd, hBmp, width, height);
HBITMAP hBmp = LoadImage(Globals.hInstance, MAKEINTRESOURCE(uBmpId), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION);
hBmp = ResampleImageBitmap(hwnd, hBmp, width, height);
BITMAP bmp;
GetObject(hBmp, sizeof(BITMAP), &bmp);
BUTTON_IMAGELIST bi;
bi.himl = ImageList_Create(bmp.bmWidth, bmp.bmHeight, ILC_COLOR32 | ILC_MASK, 1, 0);
ImageList_AddMasked(bi.himl, hBmp, CLR_DEFAULT);
DeleteObject(hBmp);
SetRect(&bi.margin, 0, 0, 0, 0);
bi.uAlign = BUTTON_IMAGELIST_ALIGN_CENTER;
SendMessage(hwndCtrl, BCM_SETIMAGELIST, 0, (LPARAM)&bi);
}
//=============================================================================
//
// MakeColorPickButton()
@ -4441,7 +4487,7 @@ Based on code of MFC helper class CDialogTemplate
bool GetThemedDialogFont(LPWSTR lpFaceName, WORD* wSize)
{
bool bSucceed = false;
int const iLogPixelsY = GetCurrentPPI(NULL).y;
int const iLogPixelsY = GetCurrentPPI(NULL).y - DIALOG_FONT_SIZE_INCR;
HTHEME hTheme = OpenThemeData(NULL, L"WINDOWSTYLE;WINDOW");
if (hTheme) {
LOGFONT lf;
@ -4450,13 +4496,13 @@ bool GetThemedDialogFont(LPWSTR lpFaceName, WORD* wSize)
lf.lfHeight = -lf.lfHeight;
}
*wSize = (WORD)MulDiv(lf.lfHeight, 72, iLogPixelsY);
if (*wSize == 0) { *wSize = 9; }
if (*wSize == 0) { *wSize = 10; }
StringCchCopyN(lpFaceName, LF_FACESIZE, lf.lfFaceName, LF_FACESIZE);
bSucceed = true;
}
CloseThemeData(hTheme);
}
return(bSucceed);
return bSucceed;
}
@ -4580,21 +4626,63 @@ HWND CreateThemedDialogParam(HINSTANCE hInstance, LPCTSTR lpTemplate, HWND hWndP
}
//=============================================================================
//
// _GetIconInfo()
//
static void _GetIconInfo(HICON hIcon, int* width, int* height, WORD* bitsPerPix)
{
ICONINFO info = {0};
if (!GetIconInfo(hIcon, &info)) {
return;
}
if (info.hbmColor) {
BITMAP bmp = {0};
if (GetObject(info.hbmColor, sizeof(bmp), &bmp) > 0) {
if (width) { *width = (int)bmp.bmWidth; }
if (height) { *height = (int)bmp.bmHeight; }
if (bitsPerPix) { *bitsPerPix = bmp.bmBitsPixel; }
}
}
else if (info.hbmMask) {
// Icon has no color plane, image data stored in mask
BITMAP bmp = {0};
if (GetObject(info.hbmMask, sizeof(bmp), &bmp) > 0) {
if (width) { *width = (int)bmp.bmWidth; }
if (height) { *height = (int)(bmp.bmHeight > 1); }
if (bitsPerPix) { *bitsPerPix = 1; }
}
}
if (info.hbmColor) {
DeleteObject(info.hbmColor);
}
if (info.hbmMask) {
DeleteObject(info.hbmMask);
}
}
//=============================================================================
//
// ConvertIconToBitmap()
// cx/cy = 0 => use resource width/height
//
HBITMAP ConvertIconToBitmap(const HICON hIcon, const int cx, const int cy)
HBITMAP ConvertIconToBitmap(HWND hwnd, const HICON hIcon, const int cx, const int cy)
{
const HDC hScreenDC = GetDC(NULL);
const HBITMAP hbmpTmp = CreateCompatibleBitmap(hScreenDC, cx, cy);
const HDC hMemDC = CreateCompatibleDC(hScreenDC);
const HBITMAP hOldBmp = SelectObject(hMemDC, hbmpTmp);
DrawIconEx(hMemDC, 0, 0, hIcon, cx, cy, 0, NULL, DI_NORMAL);
UNUSED(hwnd);
int wdc = cx;
int hdc = cy;
if ((cx == 0) || (cy == 0)) {
_GetIconInfo(hIcon, &wdc, &hdc, NULL);
}
HDC const hScreenDC = GetDC(NULL);
HBITMAP const hbmpTmp = CreateCompatibleBitmap(hScreenDC, wdc, hdc);
HDC const hMemDC = CreateCompatibleDC(hScreenDC);
HBITMAP const hOldBmp = SelectObject(hMemDC, hbmpTmp);
DrawIconEx(hMemDC, 0, 0, hIcon, cx, cy, 0, NULL, DI_NORMAL /*&~DI_DEFAULTSIZE*/ );
SelectObject(hMemDC, hOldBmp);
const HBITMAP hDibBmp = (HBITMAP)CopyImage((HANDLE)hbmpTmp, IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE | LR_CREATEDIBSECTION);
HBITMAP const hDibBmp = (HBITMAP)CopyImage((HANDLE)hbmpTmp, IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE | LR_CREATEDIBSECTION);
DeleteObject(hbmpTmp);
DeleteDC(hMemDC);
@ -4603,25 +4691,36 @@ HBITMAP ConvertIconToBitmap(const HICON hIcon, const int cx, const int cy)
return hDibBmp;
}
//=============================================================================
//
// ResampleIconToBitmap()
//
HBITMAP ResampleIconToBitmap(HWND hwnd, const HICON hIcon, const int cx, const int cy)
{
HBITMAP const hBmp = ConvertIconToBitmap(hwnd, hIcon, 0, 0);
return ResampleImageBitmap(hwnd, hBmp, cx, cy);
}
//=============================================================================
//
// SetUACIcon()
//
void SetUACIcon(const HMENU hMenu, const UINT nItem)
void SetUACIcon(HWND hwnd, const HMENU hMenu, const UINT nItem)
{
static bool bInitialized = false;
if (bInitialized) { return; }
int const cx = GetSystemMetrics(SM_CXSMICON);
int const cy = GetSystemMetrics(SM_CYSMICON);
DPI_T const dpi = Scintilla_GetWindowDPI(hwnd);
int const cx = ScaleIntByDPI(GetSystemMetrics(SM_CXSMICON), dpi.x);
int const cy = ScaleIntByDPI(GetSystemMetrics(SM_CYSMICON), dpi.y);
if (Globals.hIconMsgShieldSmall)
{
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
mii.cbSize = sizeof(MENUITEMINFO);
mii.fMask = MIIM_BITMAP;
mii.hbmpItem = ConvertIconToBitmap(Globals.hIconMsgShieldSmall, cx, cy);
mii.hbmpItem = ConvertIconToBitmap(hwnd, Globals.hIconMsgShieldSmall, cx, cy);
SetMenuItemInfo(hMenu, nItem, FALSE, &mii);
}
bInitialized = true;
@ -4655,6 +4754,55 @@ void UpdateWindowLayoutForDPI(HWND hwnd, const RECT* pRC, const DPI_T* pDPI)
SetWindowPos(hwnd, NULL, dpiScaledX, dpiScaledY, dpiScaledWidth, dpiScaledHeight, uWndFlags);
}
//=============================================================================
//
// ResampleImageBitmap()
// if width|height <= 0 : scale bitmap to current dpi
//
HBITMAP ResampleImageBitmap(HWND hwnd, HBITMAP hbmp, int width, int height)
{
if (hbmp) {
BITMAP bmp;
if (GetObject(hbmp, sizeof(BITMAP), &bmp)) {
if ((width <= 0) || (height <= 0)) {
DPI_T const dpi = Scintilla_GetWindowDPI(hwnd);
width = ScaleIntByDPI(bmp.bmWidth, dpi.x);
height = ScaleIntByDPI(bmp.bmHeight, dpi.y);
}
if (((LONG)width != bmp.bmWidth) || ((LONG)height != bmp.bmHeight)) {
#if FALSE
//HBITMAP hCopy = CopyImage(hbmp, IMAGE_BITMAP, width, height, LR_CREATEDIBSECTION | LR_COPYRETURNORG | LR_COPYDELETEORG);
#else
HDC const hdc = GetDC(hwnd);
HBITMAP hCopy = CreateResampledBitmap(hdc, hbmp, width, height, BMP_RESAMPLE_FILTER);
ReleaseDC(hwnd, hdc);
#endif
if (hCopy && (hCopy != hbmp)) {
DeleteObject(hbmp);
hbmp = hCopy;
}
}
}
}
return hbmp;
}
//=============================================================================
//
// SendWMSize()
//
LRESULT SendWMSize(HWND hwnd, RECT* rc)
{
if (rc) {
return SendMessage(hwnd, WM_SIZE, SIZE_RESTORED, MAKELPARAM(rc->right, rc->bottom));
}
RECT wndrc;
GetClientRect(hwnd, &wndrc);
return SendMessage(hwnd, WM_SIZE, SIZE_RESTORED, MAKELPARAM(wndrc.right, wndrc.bottom));
}
//=============================================================================
#if 0
void Handle_WM_PAINT(HWND hwnd)
@ -4738,51 +4886,5 @@ void Handle_WM_PAINT(HWND hwnd)
#endif
//=============================================================================
//
// ResizeImageBitmap()
// if width|height <= 0 : scale bitmap to current dpi
//
HBITMAP ResizeImageBitmap(HWND hwnd, HBITMAP hbmp, int width, int height)
{
if (hbmp) {
BITMAP bmp;
if (GetObject(hbmp, sizeof(BITMAP), &bmp)) {
if ((width <= 0) || (height <= 0)) {
width = ScaleIntToDPI_X(hwnd, bmp.bmWidth);
height = ScaleIntToDPI_Y(hwnd, bmp.bmHeight);
}
if (((LONG)width != bmp.bmWidth) || ((LONG)height != bmp.bmHeight)) {
#if FALSE
//HBITMAP hCopy = CopyImage(hbmp, IMAGE_BITMAP, width, height, LR_CREATEDIBSECTION | LR_COPYRETURNORG | LR_COPYDELETEORG);
#else
HDC const hdc = GetDC(hwnd);
HBITMAP hCopy = CreateResampledBitmap(hdc, hbmp, width, height, BMP_RESAMPLE_FILTER);
ReleaseDC(hwnd, hdc);
#endif
if (hCopy && (hCopy != hbmp)) {
DeleteObject(hbmp);
hbmp = hCopy;
}
}
}
}
return hbmp;
}
//=============================================================================
//
// SendWMSize()
//
LRESULT SendWMSize(HWND hwnd, RECT* rc)
{
if (rc) {
return SendMessage(hwnd, WM_SIZE, SIZE_RESTORED, MAKELPARAM(rc->right, rc->bottom));
}
RECT wndrc;
GetClientRect(hwnd, &wndrc);
return SendMessage(hwnd, WM_SIZE, SIZE_RESTORED, MAKELPARAM(wndrc.right, wndrc.bottom));
}
// End of Dialogs.c

View File

@ -21,6 +21,12 @@
#include "TypeDefs.h"
#include "Scintilla.h"
// ----------------------------------------------------------------------------
# define DIALOG_FONT_SIZE_INCR 0 // will increase default dialog font size
// ----------------------------------------------------------------------------
INT_PTR DisplayCmdLineHelp(HWND hwnd);
bool GetDirectory(HWND hwndParent,int uiTitle,LPWSTR pszFolder,LPCWSTR pszBase,bool);
INT_PTR CALLBACK AboutDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam);
@ -52,7 +58,7 @@ void DialogFileBrowse(HWND hwnd);
void DialogGrepWin(HWND hwnd, LPCWSTR searchPattern);
void DialogAdminExe(HWND hwnd,bool);
int MessageBoxLng(HWND hwnd, UINT uType, UINT uidMsg, ...);
int MessageBoxLng(UINT uType, UINT uidMsg, ...);
INT_PTR InfoBoxLng(UINT uType, LPCWSTR lpstrSetting, UINT uidMsg, ...);
DWORD MsgBoxLastError(LPCWSTR lpszMessage, DWORD dwErrID);
DWORD DbgMsgBoxLastError(LPCWSTR lpszMessage, DWORD dwErrID);
@ -104,8 +110,9 @@ void ResizeDlgCtl(HWND hwndDlg, int nCtlId, int dx, int dy);
HDWP DeferCtlPos(HDWP hdwp, HWND hwndDlg, int nCtlId, int dx, int dy, UINT uFlags);
void SetBitmapControl(HWND hwnd, int nCtrlId, HINSTANCE hInstance, WORD uBmpId, int width, int height);
void MakeBitmapButton(HWND hwnd, int nCtrlId, HINSTANCE hInstance, WORD uBmpId, int width, int height);
void SetBitmapControl(HWND hwnd, int nCtrlId, HBITMAP hBmp);
void SetBitmapControlResample(HWND hwnd, int nCtrlId, HBITMAP hBmp, int width, int height);
void MakeBitmapButton(HWND hwnd, int nCtrlId, WORD uBmpId, int width, int height);
void MakeColorPickButton(HWND hwnd, int nCtrlId, HINSTANCE hInstance, COLORREF crColor);
void DeleteBitmapButton(HWND hwnd, int nCtrlId);
@ -141,21 +148,20 @@ inline int ScaleFloatByDPI(float fVal, unsigned dpi) { return (int)lroundf((fVal
inline int ScaleFloatToDPI_X(HWND hwnd, float fVal) { DPI_T const dpi = Scintilla_GetWindowDPI(hwnd); return ScaleFloatByDPI(fVal, dpi.x); }
inline int ScaleFloatToDPI_Y(HWND hwnd, float fVal) { DPI_T const dpi = Scintilla_GetWindowDPI(hwnd); return ScaleFloatByDPI(fVal, dpi.y); }
//inline unsigned LargeIconDPI() { return (unsigned)MulDiv(USER_DEFAULT_SCREEN_DPI, 3, 2); }; // 150%
//inline unsigned LargeIconDPI() { return (unsigned)MulDiv(USER_DEFAULT_SCREEN_DPI, 7, 4); }; // 175%
inline unsigned LargeIconDPI() { return (unsigned)MulDiv(USER_DEFAULT_SCREEN_DPI, 2, 1); }; // 200%
inline unsigned LargeIconDPI() { return (unsigned)MulDiv(USER_DEFAULT_SCREEN_DPI, Settings2.LargeIconScalePrecent, 100); };
// ----------------------------------------------------------------------------
HBITMAP ConvertIconToBitmap(const HICON hIcon, const int cx, const int cy);
void SetUACIcon(const HMENU hMenu, const UINT nItem);
HBITMAP ConvertIconToBitmap(HWND hwnd, const HICON hIcon, const int cx, const int cy);
HBITMAP ResampleIconToBitmap(HWND hwnd, const HICON hIcon, const int cx, const int cy);
void SetUACIcon(HWND hwnd, const HMENU hMenu, const UINT nItem);
void UpdateWindowLayoutForDPI(HWND hwnd, const RECT* pRC, const DPI_T* pDPI);
//#define HandleDpiChangedMessage(hW,wP,lP) { DPI_T dpi; dpi.x = LOWORD(wP); dpi.y = HIWORD(wP); \
// UpdateWindowLayoutForDPI(hW, (RECT*)lP, &dpi); }
# define BMP_RESAMPLE_FILTER STOCK_FILTER_LANCZOS8
//#define BMP_RESAMPLE_FILTER STOCK_FILTER_QUADRATICBSPLINE
HBITMAP ResizeImageBitmap(HWND hwnd, HBITMAP hbmp, int width, int height);
HBITMAP ResampleImageBitmap(HWND hwnd, HBITMAP hbmp, int width, int height);
LRESULT SendWMSize(HWND hwnd, RECT* rc);
// ----------------------------------------------------------------------------

View File

@ -6455,13 +6455,13 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd,UINT umsg,WPARAM wParam
}
// Display help messages in the find/replace windows
else if (pnmhdr->idFrom == IDC_BACKSLASHHELP) {
MessageBoxLng(hwnd, MB_ICONINFORMATION, IDS_MUI_BACKSLASHHELP);
MessageBoxLng(MB_ICONINFORMATION, IDS_MUI_BACKSLASHHELP);
}
else if (pnmhdr->idFrom == IDC_REGEXPHELP) {
MessageBoxLng(hwnd, MB_ICONINFORMATION, IDS_MUI_REGEXPHELP);
MessageBoxLng(MB_ICONINFORMATION, IDS_MUI_REGEXPHELP);
}
else if (pnmhdr->idFrom == IDC_WILDCARDHELP) {
MessageBoxLng(hwnd, MB_ICONINFORMATION, IDS_MUI_WILDCARDHELP);
MessageBoxLng(MB_ICONINFORMATION, IDS_MUI_WILDCARDHELP);
}
break;

View File

@ -893,7 +893,7 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
LoadIconWithScaleDown(NULL, IDI_SHIELD, cxb, cyb, &(Globals.hIconMsgShield));
}
if (!Globals.hIconMsgShieldSmall) {
LoadIconWithScaleDown(NULL, IDI_SHIELD, cxs, cys, &(Globals.hIconMsgShieldSmall));
LoadIconWithScaleDown(NULL, IDI_SHIELD, cxb, cyb, &(Globals.hIconMsgShieldSmall));
}
//if (!Globals.hIconMsgWinLogo) {
// LoadIconWithScaleDown(NULL, IDI_WINLOGO, cxl, cyl, &(Globals.hIconMsgWinLogo));
@ -3162,7 +3162,8 @@ LRESULT MsgInitMenu(HWND hwnd, WPARAM wParam, LPARAM lParam)
if (!hmenu) { return 0; }
bool const sav = Globals.bCanSaveIniFile;
bool const ro = SciCall_GetReadOnly();
bool const ro = SciCall_GetReadOnly(); // scintilla mode read-only
bool const faro = s_bFileReadOnly; // file attrib read-only
DocPos const iCurPos = SciCall_GetCurrentPos();
DocLn const iCurLine = SciCall_LineFromPosition(iCurPos);
bool const bPosInSel = Sci_IsPosInSelection(iCurPos);
@ -3185,7 +3186,7 @@ LRESULT MsgInitMenu(HWND hwnd, WPARAM wParam, LPARAM lParam)
EnableCmd(hmenu, CMD_RECODEGB18030, cf);
EnableCmd(hmenu, IDM_FILE_LAUNCH, cf);
SetUACIcon(hmenu, IDM_FILE_LAUNCH_ELEVATED);
SetUACIcon(hwnd, hmenu, IDM_FILE_LAUNCH_ELEVATED);
CheckCmd(hmenu, IDM_FILE_LAUNCH_ELEVATED, s_bIsProcessElevated);
EnableCmd(hmenu, IDM_FILE_LAUNCH_ELEVATED, !s_bIsProcessElevated);
@ -3200,7 +3201,7 @@ LRESULT MsgInitMenu(HWND hwnd, WPARAM wParam, LPARAM lParam)
EnableCmd(hmenu, IDM_EDIT_INSERT_PATHNAME, cf);
EnableCmd(hmenu, IDM_ENCODING_RECODE, cf);
CheckCmd(hmenu, IDM_FILE_READONLY, s_bFileReadOnly);
CheckCmd(hmenu, IDM_FILE_READONLY, faro);
CheckCmd(hmenu, IDM_FILE_PRESERVE_FILEMODTIME, Flags.bPreserveFileModTime);
EnableCmd(hmenu, IDM_ENCODING_UNICODEREV, !ro);
@ -3358,6 +3359,8 @@ LRESULT MsgInitMenu(HWND hwnd, WPARAM wParam, LPARAM lParam)
EnableCmd(hmenu, IDM_EDIT_FINDMATCHINGBRACE, !te);
EnableCmd(hmenu, IDM_EDIT_SELTOMATCHINGBRACE, !te);
CheckCmd(hmenu, IDM_VIEW_SPLIT_UNDOTYPSEQ_LNBRK, Settings.SplitUndoTypingSeqOnLnBreak);
EnableCmd(hmenu, BME_EDIT_BOOKMARKPREV, !te);
EnableCmd(hmenu, BME_EDIT_BOOKMARKNEXT, !te);
EnableCmd(hmenu, BME_EDIT_BOOKMARKTOGGLE, !te);
@ -3480,7 +3483,8 @@ LRESULT MsgInitMenu(HWND hwnd, WPARAM wParam, LPARAM lParam)
EnableCmd(hmenu, IDM_SET_BIDIRECTIONAL_R2L, (Settings.RenderingTechnology > 0));
CheckCmd(hmenu, IDM_VIEW_MUTE_MESSAGEBEEP, Settings.MuteMessageBeep);
CheckCmd(hmenu, IDM_VIEW_SPLIT_UNDOTYPSEQ_LNBRK, Settings.SplitUndoTypingSeqOnLnBreak);
CheckCmd(hmenu, IDM_VIEW_SAVEBEFORERUNNINGTOOLS, Settings.SaveBeforeRunningTools);
//~EnableCmd(hmenu, IDM_VIEW_SAVEBEFORERUNNINGTOOLS, !faro);
CheckCmd(hmenu, IDM_VIEW_NOSAVERECENT, Settings.SaveRecentFiles);
EnableCmd(hmenu, IDM_VIEW_NOSAVERECENT, sav);
@ -3488,10 +3492,9 @@ LRESULT MsgInitMenu(HWND hwnd, WPARAM wParam, LPARAM lParam)
EnableCmd(hmenu, IDM_VIEW_NOPRESERVECARET, Settings.SaveRecentFiles && sav);
CheckCmd(hmenu, IDM_VIEW_NOSAVEFINDREPL, Settings.SaveFindReplace);
EnableCmd(hmenu, IDM_VIEW_NOSAVEFINDREPL, sav);
CheckCmd(hmenu, IDM_VIEW_SAVEBEFORERUNNINGTOOLS, Settings.SaveBeforeRunningTools);
CheckCmd(hmenu, IDM_VIEW_EVALTINYEXPRONSEL, Settings.EvalTinyExprOnSelection);
EnableCmd(hmenu, IDM_VIEW_SAVEBEFORERUNNINGTOOLS, sav);
CheckCmd(hmenu, IDM_VIEW_EVALTINYEXPRONSEL, Settings.EvalTinyExprOnSelection);
CheckCmd(hmenu, IDM_VIEW_CHANGENOTIFY, Settings.FileWatchingMode);
if (StringCchLenW(s_wchTitleExcerpt, COUNTOF(s_wchTitleExcerpt)))
@ -9820,8 +9823,8 @@ bool DoElevatedRelaunch(EditFileIOStatus* pFioStatus, bool bAutoSaveOnRelaunch)
const WCHAR* szCurFile = StrIsNotEmpty(Globals.CurrentFile) ? Globals.CurrentFile : L".\\Untitled.txt";
WCHAR tchBase[MAX_PATH] = { L'\0' };
StringCchCopy(tchBase, COUNTOF(tchBase), szCurFile);
PathStripPath(tchBase);
StringCchCopy(tchBase, COUNTOF(tchBase), PathFindFileName(szCurFile)); // eq. PathStripPath(tchBase);
if (GetTempPath(MAX_PATH, lpTempPathBuffer) && GetTempFileName(lpTempPathBuffer, TEXT("NP3"), 0, szTempFileName))
{
@ -9923,14 +9926,17 @@ bool FileSave(bool bSaveAlways, bool bAsk, bool bSaveAs, bool bSaveCopy, bool bP
// File or "Untitled" ...
WCHAR tch[MAX_PATH] = { L'\0' };
if (StrIsNotEmpty(Globals.CurrentFile)) {
StringCchCopy(tch, COUNTOF(tch), PathFindFileName(Globals.CurrentFile));
PathStripPath(tch);
StringCchCopy(tch, COUNTOF(tch), PathFindFileName(Globals.CurrentFile)); // eq. PathStripPath(tch);
}
else {
GetLngString(IDS_MUI_UNTITLED, tch, COUNTOF(tch));
}
switch (InfoBoxLng(MB_YESNOCANCEL | MB_ICONWARNING, NULL, IDS_MUI_ASK_SAVE, tch))
INT_PTR const answer = (Settings.MuteMessageBeep) ?
InfoBoxLng(MB_YESNOCANCEL | MB_ICONWARNING, NULL, IDS_MUI_ASK_SAVE, tch) :
MessageBoxLng(MB_YESNOCANCEL | MB_ICONWARNING, IDS_MUI_ASK_SAVE, tch);
switch (answer)
//switch ()
{
case IDCANCEL:
return false;
@ -9948,7 +9954,9 @@ bool FileSave(bool bSaveAlways, bool bAsk, bool bSaveAs, bool bSaveCopy, bool bP
DWORD const dwFileAttributes = GetFileAttributes(Globals.CurrentFile);
s_bFileReadOnly = (dwFileAttributes == INVALID_FILE_ATTRIBUTES) || (dwFileAttributes & FILE_ATTRIBUTE_READONLY);
if (s_bFileReadOnly) {
INT_PTR const answer = InfoBoxLng(MB_YESNO | MB_ICONWARNING, NULL, IDS_MUI_READONLY_SAVE, PathFindFileName(Globals.CurrentFile));
INT_PTR const answer = (Settings.MuteMessageBeep) ?
InfoBoxLng(MB_YESNO | MB_ICONWARNING, NULL, IDS_MUI_READONLY_SAVE, PathFindFileName(Globals.CurrentFile)) :
MessageBoxLng(MB_YESNO | MB_ICONWARNING, IDS_MUI_READONLY_SAVE, Globals.CurrentFile);
if ((IDOK == answer) || (IDYES == answer)) {
bSaveAs = true;
}
@ -10051,7 +10059,9 @@ bool FileSave(bool bSaveAlways, bool bAsk, bool bSaveAs, bool bSaveCopy, bool bP
if (!s_bIsProcessElevated && (Globals.dwLastError == ERROR_ACCESS_DENIED))
{
INT_PTR const answer = InfoBoxLng(MB_YESNO | MB_ICONSHIELD, NULL, IDS_MUI_ERR_ACCESSDENIED, currentFileName, _W(SAPPNAME));
INT_PTR const answer = (Settings.MuteMessageBeep) ?
InfoBoxLng(MB_YESNO | MB_ICONSHIELD, NULL, IDS_MUI_ERR_ACCESSDENIED, currentFileName, _W(SAPPNAME)) :
MessageBoxLng(MB_YESNO | MB_ICONSHIELD, IDS_MUI_ERR_ACCESSDENIED, Globals.CurrentFile, _W(SAPPNAME));
if ((IDOK == answer) || (IDYES == answer))
{
if (DoElevatedRelaunch(&fioStatus, true))
@ -10060,12 +10070,22 @@ bool FileSave(bool bSaveAlways, bool bAsk, bool bSaveAs, bool bSaveCopy, bool bP
}
else {
s_flagAppIsClosing = false;
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_ERR_SAVEFILE, currentFileName);
if (Settings.MuteMessageBeep) {
InfoBoxLng(MB_ICONWARNING, NULL, IDS_MUI_ERR_SAVEFILE, currentFileName);
}
else {
MessageBoxLng(MB_ICONWARNING, IDS_MUI_ERR_SAVEFILE, Globals.CurrentFile);
}
}
}
}
else {
InfoBoxLng(MB_ICONERROR, NULL, IDS_MUI_ERR_SAVEFILE, currentFileName);
if (Settings.MuteMessageBeep) {
InfoBoxLng(MB_ICONERROR, NULL, IDS_MUI_ERR_SAVEFILE, currentFileName);
}
else {
MessageBoxLng(MB_ICONERROR, IDS_MUI_ERR_SAVEFILE, Globals.CurrentFile);
}
}
}
return fSuccess;

View File

@ -4053,8 +4053,8 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
SendDlgItemMessage(hwnd, IDC_STYLEEDIT, EM_LIMITTEXT, max(BUFSIZE_STYLE_VALUE, BUFZIZE_STYLE_EXTENTIONS) - 1, 0);
MakeBitmapButton(hwnd, IDC_PREVSTYLE, Globals.hInstance, IDB_PREV, -1, -1);
MakeBitmapButton(hwnd, IDC_NEXTSTYLE, Globals.hInstance, IDB_NEXT, -1, -1);
MakeBitmapButton(hwnd, IDC_PREVSTYLE, IDB_PREV, -1, -1);
MakeBitmapButton(hwnd, IDC_NEXTSTYLE, IDB_NEXT, -1, -1);
if (Settings.CustomSchemesDlgPosX == CW_USEDEFAULT || Settings.CustomSchemesDlgPosY == CW_USEDEFAULT)
{
@ -4097,8 +4097,8 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
flagIconSize | SHGFI_SYSICONINDEX | SHGFI_USEFILEATTRIBUTES),
TVSIL_NORMAL);
MakeBitmapButton(hwnd, IDC_PREVSTYLE, Globals.hInstance, IDB_PREV, -1, -1);
MakeBitmapButton(hwnd, IDC_NEXTSTYLE, Globals.hInstance, IDB_NEXT, -1, -1);
MakeBitmapButton(hwnd, IDC_PREVSTYLE, IDB_PREV, -1, -1);
MakeBitmapButton(hwnd, IDC_NEXTSTYLE, IDB_NEXT, -1, -1);
}
return !0;
@ -4120,9 +4120,10 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
if (hFontTitle) { DeleteObject(hFontTitle); }
hFontTitle = GetStockObject(DEFAULT_GUI_FONT);
LOGFONT lf; GetObject(hFontTitle, sizeof(LOGFONT), &lf);
int const newWidth = -MulDiv(MulDiv(lf.lfWidth,3,2), GetDeviceCaps(hDC, LOGPIXELSX), 72);
int const newHeight = -MulDiv(MulDiv(lf.lfHeight,3,2), GetDeviceCaps(hDC, LOGPIXELSY), 72);
lf.lfWeight = FW_BOLD;
lf.lfWidth = ScaleIntByDPI(8, dpi.x); // =0: the aspect ratio of the device is matched against the digitization aspect ratio of the available fonts
lf.lfWidth = ScaleIntByDPI(newWidth, dpi.x); // =0: the aspect ratio of the device is matched against the digitization aspect ratio of the available fonts
lf.lfHeight = ScaleIntByDPI(newHeight, dpi.y);
//~StringCchCopy(lf.lfFaceName, LF_FACESIZE, L"Tahoma");
hFontTitle = CreateFontIndirect(&lf);

View File

@ -531,6 +531,7 @@ typedef struct _settings2_t
bool LexerSQLNumberSignAsComment;
int ExitOnESCSkipLevel;
int ZoomTooltipTimeout;
int LargeIconScalePrecent;
float AnalyzeReliableConfidenceLevel;
float LocaleAnsiCodePageAnalysisBonus;