diff --git a/minipath/res/MiniPath.exe.manifest b/minipath/res/MiniPath.exe.manifest index 79682f9e6..1535eea5d 100644 --- a/minipath/res/MiniPath.exe.manifest +++ b/minipath/res/MiniPath.exe.manifest @@ -20,16 +20,22 @@ - - - - - - + + + + + + - - - false - - + + + true/PM + + + PerMonitorV2,PerMonitor + + + false + + \ No newline at end of file diff --git a/minipath/src/Dialogs.c b/minipath/src/Dialogs.c index 207e300b5..bab7b98d5 100644 --- a/minipath/src/Dialogs.c +++ b/minipath/src/Dialogs.c @@ -431,6 +431,14 @@ INT_PTR CALLBACK GotoDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam) return TRUE; + case WM_DPICHANGED: { + const RECT* rect = (RECT*)lParam; + SetWindowPos(hwnd, NULL, rect->left, rect->top, rect->right - rect->left, rect->bottom - rect->top, SWP_NOZORDER | SWP_NOACTIVATE); + RedrawWindow(hwnd, NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_ERASE | RDW_INTERNALPAINT | RDW_ALLCHILDREN | RDW_UPDATENOW); + } + return TRUE; + + case WM_GETMINMAXINFO: { LPMINMAXINFO lpmmi = (LPMINMAXINFO)lParam; lpmmi->ptMinTrackSize.x = mmiPtMinX; @@ -1724,6 +1732,12 @@ INT_PTR CALLBACK CopyMoveDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam } return TRUE; + case WM_DPICHANGED: { + const RECT* rect = (RECT*)lParam; + SetWindowPos(hwnd, NULL, rect->left, rect->top, rect->right - rect->left, rect->bottom - rect->top, SWP_NOZORDER | SWP_NOACTIVATE); + RedrawWindow(hwnd, NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_ERASE | RDW_INTERNALPAINT | RDW_ALLCHILDREN | RDW_UPDATENOW); + } + return TRUE; case WM_GETMINMAXINFO: { LPMINMAXINFO lpmmi = (LPMINMAXINFO)lParam; @@ -1999,6 +2013,12 @@ INT_PTR CALLBACK OpenWithDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam } return TRUE; + case WM_DPICHANGED: { + const RECT* rect = (RECT*)lParam; + SetWindowPos(hwnd, NULL, rect->left, rect->top, rect->right - rect->left, rect->bottom - rect->top, SWP_NOZORDER | SWP_NOACTIVATE); + RedrawWindow(hwnd, NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_ERASE | RDW_INTERNALPAINT | RDW_ALLCHILDREN | RDW_UPDATENOW); + } + return TRUE; case WM_GETMINMAXINFO: { LPMINMAXINFO lpmmi = (LPMINMAXINFO)lParam; diff --git a/minipath/src/minipath.c b/minipath/src/minipath.c index 4bcb6ca90..32762b03b 100644 --- a/minipath/src/minipath.c +++ b/minipath/src/minipath.c @@ -835,6 +835,14 @@ CASE_WM_CTLCOLOR_SET: break; + case WM_DPICHANGED: { + const RECT* rect = (RECT*)lParam; + SetWindowPos(hwnd, NULL, rect->left, rect->top, rect->right - rect->left, rect->bottom - rect->top, SWP_NOZORDER | SWP_NOACTIVATE); + RedrawWindow(hwnd, NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_ERASE | RDW_INTERNALPAINT | RDW_ALLCHILDREN | RDW_UPDATENOW); + } + return TRUE; + + case WM_SETFOCUS: SetFocus(GetDlgItem(hwnd, nIdFocus)); break; @@ -2406,13 +2414,8 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam) case IDM_VIEW_TOOLBAR: - if (Settings.bShowToolbar) { - ShowWindow(hwndReBar,SW_HIDE); - Settings.bShowToolbar = 0; - } else { - ShowWindow(hwndReBar,SW_SHOW); - Settings.bShowToolbar = 1; - } + Settings.bShowToolbar = !Settings.bShowToolbar; + ShowWindow(hwndReBar, Settings.bShowToolbar ? SW_SHOW : SW_HIDE); SendWMSize(hwnd); break; diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx index e87e9a0fb..b6c61bc2f 100644 --- a/scintilla/src/Editor.cxx +++ b/scintilla/src/Editor.cxx @@ -1825,10 +1825,14 @@ Sci::Position Editor::FormatRange(bool draw, const Sci_RangeToFormat *pfr) { if (!pfr) return 0; + // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> AutoSurface surface(pfr->hdc, this, SC_TECHNOLOGY_DEFAULT, true); + // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< if (!surface) return 0; + // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> AutoSurface surfaceMeasure(pfr->hdcTarget, this, SC_TECHNOLOGY_DEFAULT, true); + // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< if (!surfaceMeasure) { return 0; } diff --git a/scintilla/src/ViewStyle.cxx b/scintilla/src/ViewStyle.cxx index c85850762..75ed58183 100644 --- a/scintilla/src/ViewStyle.cxx +++ b/scintilla/src/ViewStyle.cxx @@ -37,13 +37,13 @@ MarginStyle::MarginStyle(int style_, int width_, int mask_) noexcept : style(style_), width(width_), mask(mask_), sensitive(false), cursor(SC_CURSORREVERSEARROW) { } +// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> void FontRealised::Realise(Surface &surface, int zoomLevel, int technology, const FontSpecification &fs, const char *localeName) { PLATFORM_ASSERT(fs.fontName); - // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> sizeZoomed = GetFontSizeZoomed(fs.size, zoomLevel); - // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< const float deviceHeight = static_cast(surface.DeviceHeightFont(sizeZoomed)); const FontParameters fp(fs.fontName, deviceHeight / SC_FONT_SIZE_MULTIPLIER, fs.weight, fs.italic, fs.extraFontFlag, technology, fs.characterSet, localeName); +// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< font = Font::Allocate(fp); ascent = static_cast(surface.Ascent(font.get())); @@ -282,40 +282,48 @@ void ViewStyle::Init(size_t stylesSize_) { wrapVisualFlagsLocation = 0; wrapVisualStartIndent = 0; wrapIndentMode = SC_WRAPINDENT_FIXED; - + // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> localeName = localeNameDefault; + // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< } void ViewStyle::Refresh(Surface &surface, int tabInChars) { + // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> if (!fontsValid) { fontsValid = true; - fonts.clear(); + +fonts.clear(); + + // Apply the extra font flag which controls text drawing quality to each style. + for (Style &style : styles) { + style.extraFontFlag = extraFontFlag; + } + + // Create a FontRealised object for each unique font in the styles. + CreateAndAddFont(styles[STYLE_DEFAULT]); + for (const Style &style : styles) { + CreateAndAddFont(style); + } + + // Ask platform to allocate each unique font. + for (auto &font : fonts) { + font.second->Realise(surface, zoomLevel, technology, font.first, localeName.c_str()); + } + + // Set the platform font handle and measurements for each style. + for (Style &style : styles) { + const FontRealised *fr = Find(style); + style.Copy(fr->font, *fr); + } + + aveCharWidth = styles[STYLE_DEFAULT].aveCharWidth; + spaceWidth = styles[STYLE_DEFAULT].spaceWidth; } + // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< + selbar = Platform::Chrome(); selbarlight = Platform::ChromeHighlight(); - // Apply the extra font flag which controls text drawing quality to each style. - for (Style &style : styles) { - style.extraFontFlag = extraFontFlag; - } - - // Create a FontRealised object for each unique font in the styles. - CreateAndAddFont(styles[STYLE_DEFAULT]); - for (const Style &style : styles) { - CreateAndAddFont(style); - } - - // Ask platform to allocate each unique font. - for (auto &font : fonts) { - font.second->Realise(surface, zoomLevel, technology, font.first, localeName.c_str()); - } - - // Set the platform font handle and measurements for each style. - for (Style &style : styles) { - const FontRealised *fr = Find(style); - style.Copy(fr->font, *fr); - } - indicatorsDynamic = std::any_of(indicators.cbegin(), indicators.cend(), [](const Indicator &indicator) noexcept { return indicator.IsDynamic(); }); @@ -328,7 +336,9 @@ void ViewStyle::Refresh(Surface &surface, int tabInChars) { maxAscent += extraAscent; maxDescent += extraDescent; lineHeight = maxAscent + maxDescent; + // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> lineOverlap = std::clamp(lineHeight / 10, 2, lineHeight); + // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< someStylesProtected = std::any_of(styles.cbegin(), styles.cend(), [](const Style &style) noexcept { return style.IsProtected(); }); @@ -336,9 +346,10 @@ void ViewStyle::Refresh(Surface &surface, int tabInChars) { someStylesForceCase = std::any_of(styles.cbegin(), styles.cend(), [](const Style &style) noexcept { return style.caseForce != Style::CaseForce::mixed; }); - aveCharWidth = styles[STYLE_DEFAULT].aveCharWidth; - spaceWidth = styles[STYLE_DEFAULT].spaceWidth; - tabWidth = spaceWidth * tabInChars; + // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> + //~tabWidth = spaceWidth * tabInChars; + tabWidth = aveCharWidth * tabInChars; + // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< controlCharWidth = 0.0; if (controlCharSymbol >= 32) { @@ -388,6 +399,7 @@ void ViewStyle::ClearStyles() { } } styles[STYLE_LINENUMBER].back = Platform::Chrome(); + // Set call tip fore/back to match the values previously set for call tips styles[STYLE_CALLTIP].back = ColourDesired(0xff, 0xff, 0xff); styles[STYLE_CALLTIP].fore = ColourDesired(0x80, 0x80, 0x80); @@ -398,10 +410,12 @@ void ViewStyle::SetStyleFontName(int styleIndex, const char *name) { styles[styleIndex].fontName = fontNames.Save(name); } +// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> void ViewStyle::SetFontLocaleName(const char *name) { fontsValid = false; localeName = name; } +// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< bool ViewStyle::ProtectionActive() const noexcept { return someStylesProtected; diff --git a/scintilla/src/ViewStyle.h b/scintilla/src/ViewStyle.h index 289bc5603..cf4e3beaa 100644 --- a/scintilla/src/ViewStyle.h +++ b/scintilla/src/ViewStyle.h @@ -37,7 +37,9 @@ public: FontRealised &operator=(const FontRealised &) = delete; FontRealised &operator=(FontRealised &&) = delete; virtual ~FontRealised() noexcept = default; + // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> void Realise(Surface &surface, int zoomLevel, int technology, const FontSpecification &fs, const char *localeName); + // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< }; enum class IndentView {none, real, lookForward, lookBoth}; @@ -96,7 +98,9 @@ public: std::vector indicators; bool indicatorsDynamic; bool indicatorsSetFore; + // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> bool fontsValid; + // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< int technology; int lineHeight; int lineOverlap; @@ -131,7 +135,9 @@ public: int fixedColumnWidth; ///< Total width of margins bool marginInside; ///< true: margin included in text view, false: separate views int textStart; ///< Starting x position of text within the view + // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> int zoomLevel; /// @ 2018-09-06 Changed to a percent value + // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< WhiteSpace viewWhitespace; TabDrawMode tabDrawMode; int whitespaceSize; @@ -176,7 +182,6 @@ public: int wrapVisualFlagsLocation; int wrapVisualStartIndent; int wrapIndentMode; // SC_WRAPINDENT_FIXED, _SAME, _INDENT - // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> std::string localeName; // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< diff --git a/scintilla/win32/PlatWin.cxx b/scintilla/win32/PlatWin.cxx index 1b27dff80..9fa1dbfb2 100644 --- a/scintilla/win32/PlatWin.cxx +++ b/scintilla/win32/PlatWin.cxx @@ -361,9 +361,8 @@ struct FontDirectWrite : public FontWin { const std::wstring wsFace = WStringFromUTF8(fp.faceName); const std::wstring wsLocale = WStringFromUTF8(fp.localeName); const FLOAT fHeight = static_cast(fp.size); - DWRITE_FONT_STYLE style = fp.italic ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL; - // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> + DWRITE_FONT_STYLE style = fp.italic ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL; std::wstring wsFamily; DWRITE_FONT_WEIGHT weight = static_cast(fp.weight); DWRITE_FONT_STRETCH stretch = DWRITE_FONT_STRETCH_NORMAL; @@ -379,11 +378,10 @@ struct FontDirectWrite : public FontWin { // static_cast(fp.weight), // style, // DWRITE_FONT_STRETCH_NORMAL, fHeight, wsLocale.c_str(), &pTextFormat); - // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< - if (SUCCEEDED(hr)) { pTextFormat->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP); + IDWriteTextLayout *pTextLayout = nullptr; hr = pIDWriteFactory->CreateTextLayout(L"X", 1, pTextFormat, 100.0f, 100.0f, &pTextLayout); @@ -511,12 +509,14 @@ int SystemMetricsForDpi(int nIndex, UINT dpi) noexcept { return value; } +// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> BOOL AdjustWindowRectForDpi(LPRECT lpRect, DWORD dwStyle, DWORD dwExStyle, UINT dpi) noexcept { if (fnAdjustWindowRectExForDpi) { return fnAdjustWindowRectExForDpi(lpRect, dwStyle, FALSE, dwExStyle, dpi); } return ::AdjustWindowRectEx(lpRect, dwStyle, FALSE, dwExStyle); } +// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< class SurfaceGDI : public Surface { SurfaceMode mode; @@ -554,7 +554,9 @@ public: ~SurfaceGDI() noexcept override; void Init(WindowID wid) override; + // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> void Init(SurfaceID sid, WindowID wid, bool printing = false) override; + // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< std::unique_ptr AllocatePixMap(int width, int height) override; void SetMode(SurfaceMode mode_) override; @@ -681,7 +683,9 @@ void SurfaceGDI::Init(WindowID wid) { logPixelsY = DpiForWindow(wid); } +// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> void SurfaceGDI::Init(SurfaceID sid, WindowID wid, bool printing) { +// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< Release(); hdc = static_cast(sid); ::SetTextAlign(hdc, TA_BASELINE); @@ -1397,7 +1401,9 @@ public: void SetScale(WindowID wid) noexcept; void Init(WindowID wid) override; + // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> void Init(SurfaceID sid, WindowID wid, bool printing = false) override; + // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< std::unique_ptr AllocatePixMap(int width, int height) override; void SetMode(SurfaceMode mode_) override; @@ -1429,7 +1435,9 @@ public: std::unique_ptr Layout(const IScreenLine *screenLine) override; + // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> void DrawTextCommon(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, int codePageOverride, UINT fuOptions); + // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< void DrawTextNoClip(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore, ColourAlpha back) override; void DrawTextClipped(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore, ColourAlpha back) override; @@ -1524,11 +1532,13 @@ void SurfaceD2D::Init(WindowID wid) { SetScale(wid); } +// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> void SurfaceD2D::Init(SurfaceID sid, WindowID wid, bool /*printing*/) { Release(); SetScale(wid); // printing always using GDI pRenderTarget = static_cast(sid); } +// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< std::unique_ptr SurfaceD2D::AllocatePixMap(int width, int height) { return std::make_unique(pRenderTarget, width, height, mode, logPixelsY); @@ -2378,7 +2388,9 @@ std::unique_ptr SurfaceD2D::Layout(const IScreenLine *screenL return std::make_unique(screenLine); } +// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> void SurfaceD2D::DrawTextCommon(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, int codePageOverride, UINT fuOptions) { +// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< SetFont(font_); // Use Unicode calls @@ -2416,7 +2428,9 @@ void SurfaceD2D::DrawTextNoClip(PRectangle rc, const Font *font_, XYPOSITION yba if (pRenderTarget) { FillRectangleAligned(rc, back); D2DPenColourAlpha(fore); + // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> DrawTextCommon(rc, font_, ybase, text, 0, ETO_OPAQUE); + // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< } } @@ -2425,7 +2439,9 @@ void SurfaceD2D::DrawTextClipped(PRectangle rc, const Font *font_, XYPOSITION yb if (pRenderTarget) { FillRectangleAligned(rc, back); D2DPenColourAlpha(fore); + // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> DrawTextCommon(rc, font_, ybase, text, 0, ETO_OPAQUE | ETO_CLIPPED); + // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< } } @@ -2436,7 +2452,9 @@ void SurfaceD2D::DrawTextTransparent(PRectangle rc, const Font *font_, XYPOSITIO if (ch != ' ') { if (pRenderTarget) { D2DPenColourAlpha(fore); + // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> DrawTextCommon(rc, font_, ybase, text, 0, 0); + // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< } return; } @@ -3953,7 +3971,9 @@ void Platform_Finalise(bool fromDllMain) noexcept { if (!fromDllMain) { ReleaseUnknown(defaultRenderingParams); ReleaseUnknown(customClearTypeRenderingParams); + // >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>> ReleaseUnknown(gdiInterop); + // <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<< ReleaseUnknown(pIDWriteFactory); ReleaseUnknown(pD2DFactory); if (hDLLDWrite) {