From c2efb99ab1cf24f02a1aa07df8499a51ec35a773 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Thu, 18 Jun 2020 11:07:31 +0200 Subject: [PATCH 1/6] + fix: hardening commit_id.txt file input for version string assembling --- Version.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Version.ps1 b/Version.ps1 index df6a8e530..cb3e455bc 100644 --- a/Version.ps1 +++ b/Version.ps1 @@ -58,6 +58,7 @@ try $Build = $Build + 1 # locally: we have no commit ID, create an arificial one $CommitID = [string](Get-Content "Versions\commit_id.txt") + if (!$CommitID) { $CommitID = "---" } if ($CommitID -eq "computername") { $length = ([string]($env:computername)).length $CommitID = ([string]($env:computername)).substring(0,[math]::min($length,8)).ToLower() @@ -68,6 +69,9 @@ try } } if (!$CommitID) { $CommitID = "---" } + $CommitID = $CommitID -replace '"', '' + $CommitID = $CommitID -replace "'", '' + if (!$CommitID) { $CommitID = "---" } $Build | Set-Content "Versions\build.txt" $CompleteVer = "$Major.$Minor.$Revis.$Build" From bcf52f3cce7a0719d6dd74aa16769a7655fda8e6 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Thu, 18 Jun 2020 11:28:55 +0200 Subject: [PATCH 2/6] + fix: keep current line on reverting file --- Notepad3.sln | 3 +++ src/.clang-format | 14 +++++++------- src/Notepad3.c | 8 ++++---- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Notepad3.sln b/Notepad3.sln index a1b857ab1..ce1ce1793 100644 --- a/Notepad3.sln +++ b/Notepad3.sln @@ -215,6 +215,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mp_it_it", "minipath\langua EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Notepad3", "Notepad3", "{C3735E17-6EAE-4CC5-980E-30BCEF094862}" + ProjectSection(SolutionItems) = preProject + src\.clang-format = src\.clang-format + EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MiniPath", "MiniPath", "{D21C1F85-6FA3-4695-82CD-DDC5690E2D66}" ProjectSection(SolutionItems) = preProject diff --git a/src/.clang-format b/src/.clang-format index 07056def7..34fdd5dbe 100644 --- a/src/.clang-format +++ b/src/.clang-format @@ -12,7 +12,7 @@ AllowAllParametersOfDeclarationOnNextLine: true AllowShortBlocksOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false AllowShortFunctionsOnASingleLine: All -AllowShortIfStatementsOnASingleLine: false +AllowShortIfStatementsOnASingleLine: true AllowShortLoopsOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterReturnType: None @@ -23,10 +23,10 @@ BinPackParameters: true BraceWrapping: AfterCaseLabel: true AfterClass: true - AfterControlStatement: true + AfterControlStatement: false AfterEnum: true AfterFunction: true - AfterNamespace: true + AfterNamespace: false AfterObjCDeclaration: true AfterStruct: true AfterUnion: true @@ -48,8 +48,8 @@ ColumnLimit: 0 CommentPragmas: '^ IWYU pragma:' CompactNamespaces: false ConstructorInitializerAllOnOneLineOrOnePerLine: false -ConstructorInitializerIndentWidth: 4 -ContinuationIndentWidth: 4 +ConstructorInitializerIndentWidth: 2 +ContinuationIndentWidth: 2 Cpp11BracedListStyle: true DerivePointerAlignment: true DisableFormat: false @@ -69,7 +69,7 @@ IncludeCategories: IncludeIsMainRegex: '(Test)?$' IndentCaseLabels: true IndentPPDirectives: AfterHash -IndentWidth: 4 +IndentWidth: 2 IndentWrappedFunctionNames: true JavaScriptQuotes: Leave JavaScriptWrapImports: true @@ -127,7 +127,7 @@ SpacesInCStyleCastParentheses: false SpacesInParentheses: false SpacesInSquareBrackets: false Standard: Cpp11 -TabWidth: 4 +TabWidth: 2 UseTab: Never ... diff --git a/src/Notepad3.c b/src/Notepad3.c index c9ba658b1..d5e9778f7 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -9717,15 +9717,15 @@ bool FileRevert(LPCWSTR szFileName, bool bIgnoreCmdLnEnc) } } - if (bPreserveView) { - EditJumpTo(curLineNum, 0); - } - SciCall_SetSavePoint(); UpdateToolbar(); UpdateStatusbar(true); UpdateMarginWidth(); + if (bPreserveView) { + EditJumpTo(curLineNum + 1, 0); + } + return true; } From 6fd44b146f2cd46c71f1f843fe5afe8a1b7a0c46 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Thu, 18 Jun 2020 12:11:43 +0200 Subject: [PATCH 3/6] + fix: crash if "close after find" is enabled --- src/Edit.c | 30 ++++++++++++------------------ src/Notepad3.vcxproj | 1 + src/Notepad3.vcxproj.filters | 1 + 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/Edit.c b/src/Edit.c index c3a1161a6..ee8849289 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -5047,15 +5047,16 @@ void EditEnsureSelectionVisible() // void EditJumpTo(DocLn iNewLine, DocPos iNewCol) { + // Line maximum is iMaxLine - 1 (doc line count starts with 0) + DocLn const iMaxLine = SciCall_GetLineCount() - 1; + // jump to end with line set to -1 - if (iNewLine < 0) { + if ((iNewLine < 0) || (iNewLine > iMaxLine)) { SciCall_DocumentEnd(); return; } if (iNewLine == 0) { iNewLine = 1; } - DocLn const iMaxLine = SciCall_GetLineCount(); - // Line maximum is iMaxLine - 1 (doc line count starts with 0) iNewLine = (min_ln(iNewLine, iMaxLine) - 1); DocPos const iLineEndPos = SciCall_GetLineEndPosition(iNewLine); @@ -5065,7 +5066,6 @@ void EditJumpTo(DocLn iNewLine, DocPos iNewCol) const DocPos iNewPos = SciCall_FindColumn(iNewLine, iNewCol); SciCall_GotoPos(iNewPos); - EditEnsureSelectionVisible(); } @@ -6335,18 +6335,6 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd,UINT umsg,WPARAM wParam if (!s_bSwitchedFindReplace) { SendMessage(hwnd, WM_NEXTDLGCTL, (WPARAM)(GetFocus()), 1); } - bool bCloseDlg = false; - if (bIsFindDlg) { - bCloseDlg = sg_pefrData->bFindClose; - } - else if (LOWORD(wParam) != IDOK) { - bCloseDlg = sg_pefrData->bReplaceClose; - } - - if (bCloseDlg) { - //EndDialog(hwnd,LOWORD(wParam)); - DestroyWindow(hwnd); - } switch (LOWORD(wParam)) { case IDOK: // find next @@ -6388,14 +6376,20 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd,UINT umsg,WPARAM wParam } break; } + + if (bIsFindDlg && (sg_pefrData->bFindClose)) { + DestroyWindow(hwnd); //~EndDialog(hwnd,LOWORD(wParam)); + } + else if ((LOWORD(wParam) != IDOK) && sg_pefrData->bReplaceClose) { + DestroyWindow(hwnd); //~EndDialog(hwnd, LOWORD(wParam)); + } } _DelayMarkAll(hwnd, 50, s_InitialSearchStart); break; case IDCANCEL: - //EndDialog(hwnd,IDCANCEL); - DestroyWindow(hwnd); + DestroyWindow(hwnd); //~EndDialog(hwnd,IDCANCEL); break; case IDC_SWAPSTRG: diff --git a/src/Notepad3.vcxproj b/src/Notepad3.vcxproj index aacc1d3a4..d3e005072 100644 --- a/src/Notepad3.vcxproj +++ b/src/Notepad3.vcxproj @@ -583,6 +583,7 @@ + diff --git a/src/Notepad3.vcxproj.filters b/src/Notepad3.vcxproj.filters index 01b3b7fd2..d30192703 100644 --- a/src/Notepad3.vcxproj.filters +++ b/src/Notepad3.vcxproj.filters @@ -616,6 +616,7 @@ Source Files\uchardet\LangModels + From f73ee84064113096ec560df321ccc9e0c9cd0703 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Thu, 18 Jun 2020 12:44:22 +0200 Subject: [PATCH 4/6] + fix: reset of toolbar configuration dialog --- src/Edit.c | 9 ++++++--- src/Notepad3.c | 8 +++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Edit.c b/src/Edit.c index ee8849289..d4e01533e 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -6378,10 +6378,12 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd,UINT umsg,WPARAM wParam } if (bIsFindDlg && (sg_pefrData->bFindClose)) { - DestroyWindow(hwnd); //~EndDialog(hwnd,LOWORD(wParam)); + //~EndDialog(hwnd, LOWORD(wParam)); ~ not running own message loop + DestroyWindow(hwnd); } else if ((LOWORD(wParam) != IDOK) && sg_pefrData->bReplaceClose) { - DestroyWindow(hwnd); //~EndDialog(hwnd, LOWORD(wParam)); + //~EndDialog(hwnd, LOWORD(wParam)); ~ not running own message loop + DestroyWindow(hwnd); } } _DelayMarkAll(hwnd, 50, s_InitialSearchStart); @@ -6389,7 +6391,8 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd,UINT umsg,WPARAM wParam case IDCANCEL: - DestroyWindow(hwnd); //~EndDialog(hwnd,IDCANCEL); + //~EndDialog(hwnd, IDCANCEL); ~ not running own message loop + DestroyWindow(hwnd); break; case IDC_SWAPSTRG: diff --git a/src/Notepad3.c b/src/Notepad3.c index d5e9778f7..f0d49455e 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -7388,11 +7388,13 @@ LRESULT MsgNotify(HWND hwnd, WPARAM wParam, LPARAM lParam) case TBN_RESET: { - int i; int c = (int)SendMessage(Globals.hwndToolbar, TB_BUTTONCOUNT, 0, 0); - for (i = 0; i < c; i++) { + int const count = (int)SendMessage(Globals.hwndToolbar, TB_BUTTONCOUNT, 0, 0); + for (int i = 0; i < count; i++) { SendMessage(Globals.hwndToolbar, TB_DELETEBUTTON, 0, 0); } - SendMessage(Globals.hwndToolbar, TB_ADDBUTTONS, COUNTOF(s_tbbMainWnd), (LPARAM)s_tbbMainWnd); + if (Toolbar_SetButtons(Globals.hwndToolbar, IDT_FILE_NEW, Settings.ToolbarButtons, s_tbbMainWnd, COUNTOF(s_tbbMainWnd)) == 0) { + SendMessage(Globals.hwndToolbar, TB_ADDBUTTONS, COUNTOF(s_tbbMainWnd), (LPARAM)s_tbbMainWnd); + } } GUARD_RETURN(0); From 3ab734aa81496b48bf22e35416b3e7e91e0c0578 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Thu, 18 Jun 2020 16:56:02 +0200 Subject: [PATCH 5/6] + chg: system MessageBox "save before close" positioning --- scintilla/win32/PlatWin.cxx | 20 ++++---- src/Dialogs.c | 93 ++++++++++++++++++------------------- 2 files changed, 57 insertions(+), 56 deletions(-) diff --git a/scintilla/win32/PlatWin.cxx b/scintilla/win32/PlatWin.cxx index 928ea6941..db3241870 100644 --- a/scintilla/win32/PlatWin.cxx +++ b/scintilla/win32/PlatWin.cxx @@ -122,15 +122,17 @@ DPI_T GetWindowDPI(HWND hwnd) { DPI_T _dpi; _dpi.x = g_uSystemDPI; _dpi.y = g_uSystemDPI; - if (fnGetDpiForWindow) { - _dpi.y = fnGetDpiForWindow(hwnd); - _dpi.x = _dpi.y; - } - else if (pfnGetDpiForMonitor) { - HMONITOR hMonitor = ::MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); - if (FAILED(pfnGetDpiForMonitor(hMonitor, MDT_EFFECTIVE_DPI, &(_dpi.x), &(_dpi.y)))) { - _dpi.x = g_uSystemDPI; - _dpi.y = g_uSystemDPI; + if (hwnd) { + if (fnGetDpiForWindow) { + _dpi.y = fnGetDpiForWindow(hwnd); + _dpi.x = _dpi.y; + } + else if (pfnGetDpiForMonitor) { + HMONITOR hMonitor = ::MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); + if (FAILED(pfnGetDpiForMonitor(hMonitor, MDT_EFFECTIVE_DPI, &(_dpi.x), &(_dpi.y)))) { + _dpi.x = g_uSystemDPI; + _dpi.y = g_uSystemDPI; + } } } return _dpi; diff --git a/src/Dialogs.c b/src/Dialogs.c index 79fd3d836..c900e54ab 100644 --- a/src/Dialogs.c +++ b/src/Dialogs.c @@ -67,42 +67,54 @@ // static HHOOK s_hCBThook = NULL; -static LRESULT CALLBACK CenterInParentHook(INT nCode, WPARAM wParam, LPARAM lParam) +static LRESULT CALLBACK SetPosRelatedToParent_Hook(INT nCode, WPARAM wParam, LPARAM lParam) { // notification that a window is about to be activated - if (nCode == HCBT_CREATEWND) + if (nCode == HCBT_CREATEWND) { - // get window handles - LPCREATESTRUCT const pCreateStructure = ((LPCBT_CREATEWND)lParam)->lpcs; - HWND const hThisWnd = (HWND)wParam; - HWND const hParentWnd = pCreateStructure->hwndParent; // GetParent(hThisWnd); + if (hThisWnd) { + // set Notepad3 dialog icon + SET_NP3_DLG_ICON_SMALL(hThisWnd); - if (hParentWnd && hThisWnd) - { - RECT rcParent; GetWindowRect(hParentWnd, &rcParent); + // get window handles + LPCREATESTRUCT const pCreateStructure = ((LPCBT_CREATEWND)lParam)->lpcs; + HWND const hParentWnd = pCreateStructure->hwndParent; // GetParent(hThisWnd); - RECT rcDlg; - rcDlg.left = pCreateStructure->x; - rcDlg.top = pCreateStructure->y; - rcDlg.right = pCreateStructure->x + pCreateStructure->cx; - rcDlg.bottom = pCreateStructure->y + pCreateStructure->cy; - - POINT ptTopLeft = GetCenterOfDlgInParent(&rcDlg, &rcParent); + if (hParentWnd) { + RECT rcParent; + GetWindowRect(hParentWnd, &rcParent); - // set new coordinates - pCreateStructure->x = ptTopLeft.x; - pCreateStructure->y = ptTopLeft.y; + // set new coordinates + DPI_T const dpi = Scintilla_GetWindowDPI(hParentWnd); + + if (dpi.y == USER_DEFAULT_SCREEN_DPI) { + + RECT rcDlg; + rcDlg.left = pCreateStructure->x; + rcDlg.top = pCreateStructure->y; + rcDlg.right = pCreateStructure->x + pCreateStructure->cx; + rcDlg.bottom = pCreateStructure->y + pCreateStructure->cy; + + POINT const ptTL = GetCenterOfDlgInParent(&rcDlg, &rcParent); + + pCreateStructure->x = ptTL.x; + pCreateStructure->y = ptTL.y; + } + else { + // don't know how to handle DPI Awareness + //pCreateStructure->x = rcParent.left + 20; + //pCreateStructure->y = rcParent.top + 20; + //pCreateStructure->x = MulDiv(rcParent.left + (rcParent.right - rcParent.left)/8, USER_DEFAULT_SCREEN_DPI, dpi.x); + //pCreateStructure->y = MulDiv(rcParent.top + (rcParent.bottom - rcParent.top)/2, USER_DEFAULT_SCREEN_DPI, dpi.y); + } + } // we are done if (s_hCBThook) { UnhookWindowsHookEx(s_hCBThook); s_hCBThook = NULL; } - - // set Notepad3 dialog icon - SET_NP3_DLG_ICON_SMALL(hThisWnd); - } else if (s_hCBThook) { // continue with any possible chained hooks @@ -134,7 +146,7 @@ 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, &CenterInParentHook, 0, GetCurrentThreadId()); + s_hCBThook = SetWindowsHookEx(WH_CBT, &SetPosRelatedToParent_Hook, 0, GetCurrentThreadId()); return MessageBoxEx(hwnd, szText, szTitle, uType, Globals.iPrefLANGID); } @@ -174,7 +186,7 @@ DWORD MsgBoxLastError(LPCWSTR lpszMessage, DWORD dwErrID) // center message box to main HWND focus = GetFocus(); HWND hwnd = focus ? focus : Globals.hwndMain; - s_hCBThook = SetWindowsHookEx(WH_CBT, &CenterInParentHook, 0, GetCurrentThreadId()); + s_hCBThook = SetWindowsHookEx(WH_CBT, &SetPosRelatedToParent_Hook, 0, GetCurrentThreadId()); MessageBoxEx(hwnd, lpDisplayBuf, _W(SAPPNAME) L" - ERROR", MB_ICONERROR, Globals.iPrefLANGID); @@ -3836,31 +3848,19 @@ void SetWindowTransparentMode(HWND hwnd, bool bTransparentMode, int iOpacityLeve POINT GetCenterOfDlgInParent(const RECT* rcDlg, const RECT* rcParent) { HMONITOR const hMonitor = MonitorFromRect(rcParent, MONITOR_DEFAULTTONEAREST); - MONITORINFO mi; mi.cbSize = sizeof(MONITORINFO); GetMonitorInfo(hMonitor, &mi); int const xMin = mi.rcWork.left; - int const yMin = mi.rcWork.top; - int const xMax = (mi.rcWork.right) - (rcDlg->right - rcDlg->left); + int const yMin = mi.rcWork.top; 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 + 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; - } + int const x = rcParent->left + max_i(20, ((rcParent->right - rcParent->left) - (rcDlg->right - rcDlg->left)) / 2); + int const y = rcParent->top + max_i(20, ((rcParent->bottom - rcParent->top) - (rcDlg->bottom - rcDlg->top)) / 2); - POINT ptRet; ptRet.x = clampi(x, xMin, xMax); ptRet.y = clampi(y, yMin, yMax); + POINT ptRet; + ptRet.x = clampi(x, xMin, xMax); + ptRet.y = clampi(y, yMin, yMax); return ptRet; } @@ -3879,10 +3879,9 @@ void CenterDlgInParent(HWND hDlg, HWND hDlgParent) RECT rcParent; BOOL const bFoundRect = hParent ? GetWindowRect(hParent, &rcParent) : GetWindowRect(GetDesktopWindow(), &rcParent); - if (bFoundRect) - { + if (bFoundRect) { POINT const ptTopLeft = GetCenterOfDlgInParent(&rcDlg, &rcParent); - SetWindowPos(hDlg, NULL, ptTopLeft.x, ptTopLeft.y, 0, 0, SWP_NOZORDER | SWP_FRAMECHANGED | SWP_NOSIZE); + SetWindowPos(hDlg, NULL, ptTopLeft.x, ptTopLeft.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE); //~SnapToDefaultButton(hDlg); } } @@ -4618,7 +4617,7 @@ void SetUACIcon(const HMENU hMenu, const UINT nItem) // void UpdateWindowLayoutForDPI(HWND hWnd, RECT* pRC, DPI_T* pDPI) { - UINT const uWndFlags = SWP_NOZORDER | SWP_NOACTIVATE; //~ | SWP_NOMOVE | SWP_NOSIZE | SWP_NOREPOSITION | SWP_FRAMECHANGED + UINT const uWndFlags = SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED; //~ SWP_NOMOVE | SWP_NOSIZE | SWP_NOREPOSITION if (pRC) { SetWindowPos(hWnd, NULL, pRC->left, pRC->top, (pRC->right - pRC->left), (pRC->bottom - pRC->top), uWndFlags); //~InvalidateRect(hWnd, NULL, TRUE); From c71fc18b4135e7ed0884db47fef062cc1e4336c5 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Thu, 18 Jun 2020 17:53:47 +0200 Subject: [PATCH 6/6] + fix: printing scaling problem related to DPI awareness changes --- scintilla/src/Editor.cxx | 4 ++-- scintilla/src/Editor.h | 4 ++-- scintilla/win32/PlatWin.cxx | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx index 5c236aed2..37dbadda9 100644 --- a/scintilla/src/Editor.cxx +++ b/scintilla/src/Editor.cxx @@ -1813,10 +1813,10 @@ Sci::Position Editor::FormatRange(bool draw, const Sci_RangeToFormat *pfr) { if (!pfr) return 0; - AutoSurface surface(pfr->hdc, this, SC_TECHNOLOGY_DEFAULT); + AutoSurface surface(pfr->hdc, this, SC_TECHNOLOGY_DEFAULT, true); if (!surface) return 0; - AutoSurface surfaceMeasure(pfr->hdcTarget, this, SC_TECHNOLOGY_DEFAULT); + AutoSurface surfaceMeasure(pfr->hdcTarget, this, SC_TECHNOLOGY_DEFAULT, true); if (!surfaceMeasure) { return 0; } diff --git a/scintilla/src/Editor.h b/scintilla/src/Editor.h index 2fa7ba961..24b2a8cd2 100644 --- a/scintilla/src/Editor.h +++ b/scintilla/src/Editor.h @@ -655,10 +655,10 @@ public: surf->SetBidiR2L(ed->BidirectionalR2L()); } } - AutoSurface(SurfaceID sid, Editor *ed, int technology = -1) { + AutoSurface(SurfaceID sid, Editor *ed, int technology = -1, bool printing = false) { if (ed->wMain.GetID()) { surf.reset(Surface::Allocate(technology != -1 ? technology : ed->technology)); - surf->Init(sid, ed->wMain.GetID()); + surf->Init(sid, ed->wMain.GetID(), printing); surf->SetUnicodeMode(SC_CP_UTF8 == ed->CodePage()); //~surf->SetDBCSMode(ed->CodePage()); surf->SetBidiR2L(ed->BidirectionalR2L()); diff --git a/scintilla/win32/PlatWin.cxx b/scintilla/win32/PlatWin.cxx index db3241870..29719461f 100644 --- a/scintilla/win32/PlatWin.cxx +++ b/scintilla/win32/PlatWin.cxx @@ -573,7 +573,7 @@ public: ~SurfaceGDI() noexcept override; void Init(WindowID wid) noexcept override; - void Init(SurfaceID sid, WindowID wid, bool printing) noexcept override; + void Init(SurfaceID sid, WindowID wid, bool printing = false) noexcept override; void InitPixMap(int width, int height, Surface *surface_, WindowID wid) noexcept override; void Release() noexcept override; @@ -668,7 +668,7 @@ void SurfaceGDI::Init(WindowID wid) noexcept { ::SetTextAlign(hdc, TA_BASELINE); } -void SurfaceGDI::Init(SurfaceID sid, WindowID wid, bool printing) noexcept { +void SurfaceGDI::Init(SurfaceID sid, WindowID wid, bool printing /*=false*/) noexcept { Release(); hdc = static_cast(sid); // Windows on screen are scaled but printers are not. @@ -1343,9 +1343,9 @@ void SurfaceD2D::Init(WindowID wid) noexcept { logPixelsY = DpiYForWindow(wid); } -void SurfaceD2D::Init(SurfaceID sid, WindowID wid, bool /*printing*/) noexcept { +void SurfaceD2D::Init(SurfaceID sid, WindowID wid, bool printing /*=false*/) noexcept { Release(); - // printing always using GDI + // printing always using GDI technology logPixelsY = DpiYForWindow(wid); pRenderTarget = static_cast(sid); }