mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-11 21:03:05 +08:00
+ upd: merging Scintilla Lib v5.0.1 (part II)
This commit is contained in:
parent
124474f67b
commit
c901684932
@ -19,16 +19,14 @@ extern "C" {
|
||||
// ==============================================================
|
||||
// --- needed to bind Scintilla as dynamic link library (DLL) ---
|
||||
// ==============================================================
|
||||
typedef struct _dpi_t { unsigned x; unsigned y; } DPI_T;
|
||||
typedef struct _wrct_t { long left; long top; long right; long bottom; } WRCT_T;
|
||||
__declspec(dllexport) void Scintilla_LoadDpiForWindow(void);
|
||||
__declspec(dllexport) int Scintilla_RegisterClasses(void *hInstance);
|
||||
__declspec(dllexport) int Scintilla_ReleaseResources(void);
|
||||
__declspec(dllexport) int Scintilla_InputCodePage(void);
|
||||
__declspec(dllexport) DPI_T Scintilla_GetWindowDPI(void* hwnd);
|
||||
__declspec(dllexport) int Scintilla_GetSystemMetricsForDpi(int nIndex, DPI_T dpi);
|
||||
__declspec(dllexport) int Scintilla_GetSystemMetricsForDpi(int nIndex, DPI_T dpi);
|
||||
__declspec(dllexport) int Scintilla_AdjustWindowRectForDpi(WRCT_T* lpRect, unsigned long dwStyle, unsigned long dwExStyle, DPI_T dpi);
|
||||
typedef struct _wrct_t { long left; long top; long right; long bottom; } WRECT, *LPWRECT; // Windows RECT
|
||||
__declspec(dllexport) int Scintilla_RegisterClasses(void *hInstance);
|
||||
__declspec(dllexport) int Scintilla_ReleaseResources(void);
|
||||
__declspec(dllexport) int Scintilla_InputCodePage(void);
|
||||
__declspec(dllexport) unsigned Scintilla_GetWindowDPI(void* hwnd);
|
||||
__declspec(dllexport) int Scintilla_GetSystemMetricsForDpi(int nIndex, unsigned dpi);
|
||||
__declspec(dllexport) int Scintilla_GetSystemMetricsForDpi(int nIndex, unsigned dpi);
|
||||
__declspec(dllexport) int Scintilla_AdjustWindowRectForDpi(LPWRECT lpRect, unsigned long dwStyle, unsigned long dwExStyle, unsigned dpi);
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#define VC_EXTRALEAN 1
|
||||
#include <windows.h>
|
||||
|
||||
#include "Geometry.h"
|
||||
#include "Platform.h"
|
||||
#include "Scintilla.h"
|
||||
#include "ILexer.h"
|
||||
|
||||
@ -2368,10 +2368,10 @@ void Document::AnnotationSetText(Sci::Line line, const char *text) {
|
||||
|
||||
void Document::AnnotationSetStyle(Sci::Line line, int style) {
|
||||
if (line >= 0 && line < LinesTotal()) {
|
||||
Annotations()->SetStyle(line, style);
|
||||
const DocModification mh(SC_MOD_CHANGEANNOTATION, LineStart(line),
|
||||
Annotations()->SetStyle(line, style);
|
||||
const DocModification mh(SC_MOD_CHANGEANNOTATION, LineStart(line),
|
||||
0, 0, 0, line);
|
||||
NotifyModified(mh);
|
||||
NotifyModified(mh);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2410,10 +2410,10 @@ void Document::EOLAnnotationSetText(Sci::Line line, const char *text) {
|
||||
|
||||
void Document::EOLAnnotationSetStyle(Sci::Line line, int style) {
|
||||
if (line >= 0 && line < LinesTotal()) {
|
||||
EOLAnnotations()->SetStyle(line, style);
|
||||
const DocModification mh(SC_MOD_CHANGEEOLANNOTATION, LineStart(line),
|
||||
EOLAnnotations()->SetStyle(line, style);
|
||||
const DocModification mh(SC_MOD_CHANGEEOLANNOTATION, LineStart(line),
|
||||
0, 0, 0, line);
|
||||
NotifyModified(mh);
|
||||
NotifyModified(mh);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2169,9 +2169,7 @@ void Editor::CopyAllowLine() {
|
||||
void Editor::Cut() {
|
||||
pdoc->CheckReadOnly();
|
||||
if (!pdoc->IsReadOnly() && !SelectionContainsProtected()) {
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
Copy(false);
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
Copy();
|
||||
ClearSelection();
|
||||
}
|
||||
}
|
||||
@ -5205,7 +5203,7 @@ void Editor::QueueIdleWork(WorkItems items, Sci::Position upTo) {
|
||||
workNeeded.Need(items, upTo);
|
||||
}
|
||||
|
||||
int Editor::SupportsFeature(int feature) {
|
||||
int Editor::SupportsFeature(int feature) const noexcept {
|
||||
AutoSurface surface(this);
|
||||
return surface->Supports(feature);
|
||||
}
|
||||
@ -5721,30 +5719,24 @@ void Editor::StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam
|
||||
break;
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
case SCI_STYLESETBOLD:
|
||||
vs.fontsValid = false;
|
||||
vs.styles[wParam].weight = lParam != 0 ? SC_WEIGHT_BOLD : SC_WEIGHT_NORMAL;
|
||||
break;
|
||||
case SCI_STYLESETWEIGHT:
|
||||
vs.fontsValid = false;
|
||||
vs.styles[wParam].weight = static_cast<int>(lParam);
|
||||
break;
|
||||
case SCI_STYLESETSTRETCH:
|
||||
vs.fontsValid = false;
|
||||
vs.styles[wParam].stretch = static_cast<int>(lParam);
|
||||
break;
|
||||
case SCI_STYLESETITALIC:
|
||||
vs.fontsValid = false;
|
||||
vs.styles[wParam].italic = lParam != 0;
|
||||
break;
|
||||
case SCI_STYLESETEOLFILLED:
|
||||
vs.styles[wParam].eolFilled = lParam != 0;
|
||||
break;
|
||||
case SCI_STYLESETSIZE:
|
||||
vs.fontsValid = false;
|
||||
vs.styles[wParam].size = static_cast<int>(lParam * SC_FONT_SIZE_MULTIPLIER);
|
||||
break;
|
||||
case SCI_STYLESETSIZEFRACTIONAL:
|
||||
vs.fontsValid = false;
|
||||
vs.styles[wParam].size = static_cast<int>(lParam);
|
||||
break;
|
||||
case SCI_STYLESETFONT:
|
||||
@ -5763,7 +5755,6 @@ void Editor::StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam
|
||||
vs.styles[wParam].caseForce = static_cast<Style::CaseForce>(lParam);
|
||||
break;
|
||||
case SCI_STYLESETCHARACTERSET:
|
||||
vs.fontsValid = false;
|
||||
vs.styles[wParam].characterSet = static_cast<int>(lParam);
|
||||
pdoc->SetCaseFolder(nullptr);
|
||||
break;
|
||||
@ -5928,7 +5919,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
break;
|
||||
|
||||
case SCI_COPY:
|
||||
Copy(false);
|
||||
Copy();
|
||||
break;
|
||||
|
||||
case SCI_COPYALLOWLINE:
|
||||
@ -5956,7 +5947,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
break;
|
||||
|
||||
case SCI_PASTE:
|
||||
Paste(false);
|
||||
Paste();
|
||||
if ((caretSticky == SC_CARETSTICKY_OFF) || (caretSticky == SC_CARETSTICKY_WHITESPACE)) {
|
||||
SetLastXChosen();
|
||||
}
|
||||
@ -6637,9 +6628,6 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
case SCI_SETFONTQUALITY:
|
||||
vs.extraFontFlag &= ~SC_EFF_QUALITY_MASK;
|
||||
vs.extraFontFlag |= (wParam & SC_EFF_QUALITY_MASK);
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
vs.fontsValid = false;
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
InvalidateStyleRedraw();
|
||||
break;
|
||||
|
||||
@ -6873,7 +6861,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
return caretSticky;
|
||||
|
||||
case SCI_TOGGLECARETSTICKY:
|
||||
caretSticky = !caretSticky;
|
||||
caretSticky = caretSticky ? SC_CARETSTICKY_OFF : SC_CARETSTICKY_ON;
|
||||
break;
|
||||
|
||||
case SCI_GETCOLUMN:
|
||||
@ -6957,7 +6945,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
return static_cast<sptr_t>(imeIsInModeCJK);
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
|
||||
case SCI_SETBIDIRECTIONAL:
|
||||
case SCI_SETBIDIRECTIONAL:
|
||||
// SCI_SETBIDIRECTIONAL is implemented on platform subclasses if they support bidirectional text.
|
||||
break;
|
||||
|
||||
@ -7805,7 +7793,6 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
if (zoomLevel != vs.zoomLevel) {
|
||||
vs.zoomLevel = zoomLevel;
|
||||
vs.fontsValid = false;
|
||||
InvalidateStyleRedraw();
|
||||
NotifyZoom();
|
||||
}
|
||||
|
||||
@ -419,12 +419,10 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
void ClearDocumentStyle();
|
||||
virtual void Cut();
|
||||
void PasteRectangular(SelectionPosition pos, const char *ptr, Sci::Position len);
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
virtual void Copy(bool asBinary) = 0;
|
||||
virtual void Copy() = 0;
|
||||
virtual void CopyAllowLine();
|
||||
virtual bool CanPaste();
|
||||
virtual void Paste(bool asBinary) = 0;
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
virtual void Paste() = 0;
|
||||
void Clear();
|
||||
virtual void SelectAll();
|
||||
virtual void Undo();
|
||||
@ -549,7 +547,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
|
||||
virtual int SupportsFeature(int feature) const noexcept;
|
||||
virtual bool PaintContains(PRectangle rc) const noexcept;
|
||||
bool PaintContainsMargin();
|
||||
bool PaintContainsMargin() const noexcept;
|
||||
void CheckForChangeOutsidePaint(Range r);
|
||||
void SetBraceHighlight(Sci::Position pos0, Sci::Position pos1, int matchStyle);
|
||||
|
||||
@ -665,8 +663,7 @@ public:
|
||||
AutoSurface(SurfaceID sid, Editor *ed, int technology = -1, bool printing = false) {
|
||||
if (ed->wMain.GetID()) {
|
||||
surf = Surface::Allocate(technology != -1 ? technology : ed->technology);
|
||||
//~surf->Init(sid, ed->wMain.GetID(), printing);
|
||||
surf->Init(sid, ed->wMain.GetID());
|
||||
surf->Init(sid, ed->wMain.GetID()/* @@@, printing*/);
|
||||
surf->SetMode(SurfaceMode(ed->CodePage(), ed->BidirectionalR2L()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,8 @@
|
||||
// Copyright 1998-2009 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
#pragma once
|
||||
#ifndef PLATFORM_H
|
||||
#define PLATFORM_H
|
||||
|
||||
// PLAT_GTK = GTK+ on Linux or Win32
|
||||
// PLAT_GTK_WIN32 is defined additionally when running PLAT_GTK under Win32
|
||||
@ -74,47 +76,15 @@
|
||||
|
||||
#endif
|
||||
|
||||
// use __vectorcall to pass float/double arguments such as Point and PRectangle.
|
||||
#if defined(_WIN64) && defined(NDEBUG)
|
||||
#if defined(_MSC_BUILD)
|
||||
#define SCICALL __vectorcall
|
||||
#elif defined(__INTEL_COMPILER_BUILD_DATE)
|
||||
//#define SCICALL __regcall
|
||||
#define SCICALL
|
||||
#else
|
||||
#define SCICALL
|
||||
#endif
|
||||
#else
|
||||
#define SCICALL
|
||||
#endif
|
||||
|
||||
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <string_view>
|
||||
#include <optional>
|
||||
//#include <memory>
|
||||
//#include <vector>
|
||||
//#include <string_view>
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
|
||||
namespace Scintilla {
|
||||
|
||||
// official Scintilla use dynamic_cast, which requires RTTI.
|
||||
#ifdef NDEBUG
|
||||
#define USE_RTTI 0
|
||||
#else
|
||||
#define USE_RTTI 1
|
||||
#endif
|
||||
|
||||
template<typename DerivedPointer, class Base>
|
||||
inline DerivedPointer down_cast(Base* ptr) noexcept {
|
||||
#if USE_RTTI
|
||||
return dynamic_cast<DerivedPointer>(ptr);
|
||||
#else
|
||||
return static_cast<DerivedPointer>(ptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
typedef double XYACCUMULATOR;
|
||||
|
||||
// Underlying the implementation of the platform classes are platform specific types.
|
||||
// Sometimes these need to be passed around by client code so they are defined here
|
||||
|
||||
@ -125,8 +95,6 @@ typedef void *TickerID;
|
||||
typedef void *Function;
|
||||
typedef void *IdlerID;
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Font management.
|
||||
*/
|
||||
@ -198,7 +166,7 @@ public:
|
||||
|
||||
class IScreenLineLayout {
|
||||
public:
|
||||
virtual ~IScreenLineLayout() = default;
|
||||
virtual ~IScreenLineLayout() noexcept = default;
|
||||
virtual size_t PositionFromX(XYPOSITION xDistance, bool charPosition) = 0;
|
||||
virtual XYPOSITION XFromPosition(size_t caretPosition) noexcept = 0;
|
||||
virtual std::vector<Interval> FindRangeIntervals(size_t start, size_t end) = 0;
|
||||
@ -244,45 +212,51 @@ public:
|
||||
|
||||
virtual void Release() noexcept = 0;
|
||||
virtual int Supports(int feature) noexcept=0;
|
||||
virtual bool Initialised() const noexcept = 0;
|
||||
virtual void PenColour(ColourDesired fore) = 0;
|
||||
virtual int LogPixelsY() const noexcept = 0;
|
||||
virtual int DeviceHeightFont(int points) const noexcept = 0;
|
||||
virtual void SCICALL MoveTo(int x_, int y_) noexcept = 0;
|
||||
virtual void SCICALL LineTo(int x_, int y_) noexcept = 0;
|
||||
virtual void SCICALL Polygon(const Point *pts, size_t npts, ColourDesired fore, ColourDesired back) = 0;
|
||||
virtual void SCICALL RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back) = 0;
|
||||
virtual void SCICALL FillRectangle(PRectangle rc, ColourDesired back) = 0;
|
||||
virtual void SCICALL FillRectangle(PRectangle rc, Surface &surfacePattern) = 0;
|
||||
virtual void SCICALL RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back) = 0;
|
||||
virtual void SCICALL AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fill, int alphaFill,
|
||||
ColourDesired outline, int alphaOutline, int flags) = 0;
|
||||
enum class GradientOptions {
|
||||
leftToRight, topToBottom
|
||||
};
|
||||
virtual void SCICALL GradientRectangle(PRectangle rc, const std::vector<ColourStop> &stops, GradientOptions options) = 0;
|
||||
virtual void SCICALL DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage) = 0;
|
||||
virtual void SCICALL Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back) = 0;
|
||||
virtual void SCICALL Copy(PRectangle rc, Point from, Surface &surfaceSource) = 0;
|
||||
virtual bool Initialised()=0;
|
||||
virtual int LogPixelsY()=0;
|
||||
virtual int PixelDivisions()=0;
|
||||
virtual int DeviceHeightFont(int points)=0;
|
||||
virtual void LineDraw(Point start, Point end, Stroke stroke)=0;
|
||||
virtual void PolyLine(const Point *pts, size_t npts, Stroke stroke)=0;
|
||||
virtual void Polygon(const Point *pts, size_t npts, FillStroke fillStroke)=0;
|
||||
virtual void RectangleDraw(PRectangle rc, FillStroke fillStroke)=0;
|
||||
virtual void RectangleFrame(PRectangle rc, Stroke stroke)=0;
|
||||
virtual void FillRectangle(PRectangle rc, Fill fill)=0;
|
||||
virtual void FillRectangleAligned(PRectangle rc, Fill fill)=0;
|
||||
virtual void FillRectangle(PRectangle rc, Surface &surfacePattern)=0;
|
||||
virtual void RoundedRectangle(PRectangle rc, FillStroke fillStroke)=0;
|
||||
virtual void AlphaRectangle(PRectangle rc, XYPOSITION cornerSize, FillStroke fillStroke)=0;
|
||||
enum class GradientOptions { leftToRight, topToBottom };
|
||||
virtual void GradientRectangle(PRectangle rc, const std::vector<ColourStop> &stops, GradientOptions options)=0;
|
||||
virtual void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage) = 0;
|
||||
virtual void Ellipse(PRectangle rc, FillStroke fillStroke)=0;
|
||||
virtual void Stadium(PRectangle rc, FillStroke fillStroke, Ends ends)=0;
|
||||
virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource)=0;
|
||||
|
||||
virtual std::unique_ptr<IScreenLineLayout> Layout(const IScreenLine *screenLine) = 0;
|
||||
|
||||
virtual void SCICALL DrawTextNoClip(PRectangle rc, const Font &font_, XYPOSITION ybase, std::string_view text, ColourDesired fore, ColourDesired back) = 0;
|
||||
virtual void SCICALL DrawTextClipped(PRectangle rc, const Font &font_, XYPOSITION ybase, std::string_view text, ColourDesired fore, ColourDesired back) = 0;
|
||||
virtual void SCICALL DrawTextTransparent(PRectangle rc, const Font &font_, XYPOSITION ybase, std::string_view text, ColourDesired fore) = 0;
|
||||
virtual void SCICALL MeasureWidths(const Font &font_, std::string_view text, XYPOSITION *positions) = 0;
|
||||
virtual XYPOSITION WidthText(const Font &font_, std::string_view text) = 0;
|
||||
virtual XYPOSITION Ascent(const Font &font_) noexcept = 0;
|
||||
virtual XYPOSITION Descent(const Font &font_) noexcept = 0;
|
||||
virtual XYPOSITION InternalLeading(const Font &font_) noexcept = 0;
|
||||
virtual XYPOSITION Height(const Font &font_) noexcept = 0;
|
||||
virtual XYPOSITION AverageCharWidth(const Font &font_) = 0;
|
||||
virtual void DrawTextNoClip(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore, ColourAlpha back) = 0;
|
||||
virtual void DrawTextClipped(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore, ColourAlpha back) = 0;
|
||||
virtual void DrawTextTransparent(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore) = 0;
|
||||
virtual void MeasureWidths(const Font *font_, std::string_view text, XYPOSITION *positions) = 0;
|
||||
virtual XYPOSITION WidthText(const Font *font_, std::string_view text) = 0;
|
||||
|
||||
virtual void SCICALL SetClip(PRectangle rc) noexcept = 0;
|
||||
virtual void DrawTextNoClipUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore, ColourAlpha back) = 0;
|
||||
virtual void DrawTextClippedUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore, ColourAlpha back) = 0;
|
||||
virtual void DrawTextTransparentUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, std::string_view text, ColourAlpha fore) = 0;
|
||||
virtual void MeasureWidthsUTF8(const Font *font_, std::string_view text, XYPOSITION *positions) = 0;
|
||||
virtual XYPOSITION WidthTextUTF8(const Font *font_, std::string_view text) = 0;
|
||||
|
||||
virtual XYPOSITION Ascent(const Font *font_)=0;
|
||||
virtual XYPOSITION Descent(const Font *font_)=0;
|
||||
virtual XYPOSITION InternalLeading(const Font *font_)=0;
|
||||
virtual XYPOSITION Height(const Font *font_)=0;
|
||||
virtual XYPOSITION AverageCharWidth(const Font *font_)=0;
|
||||
|
||||
virtual void SetClip(PRectangle rc)=0;
|
||||
virtual void PopClip()=0;
|
||||
virtual void FlushCachedState() noexcept = 0;
|
||||
virtual void FlushCachedState()=0;
|
||||
virtual void FlushDrawing()=0;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
@ -292,9 +266,9 @@ public:
|
||||
class Window {
|
||||
protected:
|
||||
WindowID wid;
|
||||
|
||||
public:
|
||||
Window() noexcept : wid(nullptr), cursorLast(Cursor::invalid) {}
|
||||
Window() noexcept : wid(nullptr), cursorLast(Cursor::invalid) {
|
||||
}
|
||||
Window(const Window &source) = delete;
|
||||
Window(Window &&) = delete;
|
||||
Window &operator=(WindowID wid_) noexcept {
|
||||
@ -304,28 +278,20 @@ public:
|
||||
}
|
||||
Window &operator=(const Window &) = delete;
|
||||
Window &operator=(Window &&) = delete;
|
||||
virtual ~Window();
|
||||
WindowID GetID() const noexcept {
|
||||
return wid;
|
||||
}
|
||||
bool Created() const noexcept {
|
||||
return wid != nullptr;
|
||||
}
|
||||
virtual ~Window() noexcept;
|
||||
WindowID GetID() const noexcept { return wid; }
|
||||
bool Created() const noexcept { return wid != nullptr; }
|
||||
void Destroy() noexcept;
|
||||
PRectangle GetPosition() const noexcept;
|
||||
void SCICALL SetPosition(PRectangle rc) noexcept;
|
||||
void SCICALL SetPositionRelative(PRectangle rc, const Window *relativeTo) noexcept;
|
||||
PRectangle GetClientPosition() const noexcept;
|
||||
void Show(bool show = true) const noexcept;
|
||||
void InvalidateAll() noexcept;
|
||||
void SCICALL InvalidateRectangle(PRectangle rc) noexcept;
|
||||
virtual void SetFont(const Font &font) noexcept;
|
||||
enum class Cursor {
|
||||
invalid, text, arrow, up, wait, horiz, vert, reverseArrow, hand
|
||||
};
|
||||
void SetCursor(Cursor curs) noexcept;
|
||||
PRectangle SCICALL GetMonitorRect(Point pt) const noexcept;
|
||||
|
||||
PRectangle GetPosition() const;
|
||||
void SetPosition(PRectangle rc);
|
||||
void SetPositionRelative(PRectangle rc, const Window *relativeTo);
|
||||
PRectangle GetClientPosition() const;
|
||||
void Show(bool show=true);
|
||||
void InvalidateAll();
|
||||
void InvalidateRectangle(PRectangle rc);
|
||||
enum class Cursor { invalid, text, arrow, up, wait, horizontal, vertical, reverseArrow, hand };
|
||||
void SetCursor(Cursor curs);
|
||||
PRectangle GetMonitorRect(Point pt);
|
||||
private:
|
||||
Cursor cursorLast;
|
||||
};
|
||||
@ -337,15 +303,14 @@ private:
|
||||
// ScintillaBase implements IListBoxDelegate to receive ListBoxEvents from a ListBox
|
||||
|
||||
struct ListBoxEvent {
|
||||
enum class EventType {
|
||||
selectionChange, doubleClick
|
||||
} event;
|
||||
explicit ListBoxEvent(EventType event_) noexcept : event(event_) {}
|
||||
enum class EventType { selectionChange, doubleClick } event;
|
||||
ListBoxEvent(EventType event_) noexcept : event(event_) {
|
||||
}
|
||||
};
|
||||
|
||||
class IListBoxDelegate {
|
||||
public:
|
||||
virtual void ListNotify(ListBoxEvent *plbe) = 0;
|
||||
virtual void ListNotify(ListBoxEvent *plbe)=0;
|
||||
};
|
||||
|
||||
struct ListOptions {
|
||||
@ -358,29 +323,29 @@ struct ListOptions {
|
||||
class ListBox : public Window {
|
||||
public:
|
||||
ListBox() noexcept;
|
||||
~ListBox() override;
|
||||
static ListBox *Allocate();
|
||||
virtual ~ListBox() noexcept override;
|
||||
static std::unique_ptr<ListBox> Allocate();
|
||||
|
||||
void SetFont(const Font &font) noexcept override = 0;
|
||||
virtual void SetColour(ColourDesired fore, ColourDesired back) noexcept = 0;
|
||||
virtual void SCICALL Create(Window &parent, int ctrlID, Point location, int lineHeight_, bool unicodeMode_, int technology_) noexcept = 0;
|
||||
virtual void SetAverageCharWidth(int width) noexcept = 0;
|
||||
virtual void SetVisibleRows(int rows) noexcept = 0;
|
||||
virtual int GetVisibleRows() const noexcept = 0;
|
||||
virtual PRectangle GetDesiredRect() = 0;
|
||||
virtual int CaretFromEdge() const = 0;
|
||||
virtual void Clear() noexcept = 0;
|
||||
virtual void Append(const char *s, int type = -1) const noexcept = 0;
|
||||
virtual int Length() const noexcept = 0;
|
||||
virtual void Select(int n) = 0;
|
||||
virtual int GetSelection() const noexcept = 0;
|
||||
virtual int Find(const char *prefix) const noexcept = 0;
|
||||
virtual void GetValue(int n, char *value, int len) const noexcept = 0;
|
||||
virtual void RegisterImage(int type, const char *xpm_data) = 0;
|
||||
virtual void SetFont(const Font *font)=0;
|
||||
virtual void Create(Window &parent, int ctrlID, Point location, int lineHeight_, bool unicodeMode_, int technology_)=0;
|
||||
virtual void SetAverageCharWidth(int width)=0;
|
||||
virtual void SetVisibleRows(int rows)=0;
|
||||
virtual int GetVisibleRows() const=0;
|
||||
virtual PRectangle GetDesiredRect()=0;
|
||||
virtual int CaretFromEdge()=0;
|
||||
virtual void Clear() noexcept=0;
|
||||
virtual void Append(char *s, int type = -1)=0;
|
||||
virtual int Length()=0;
|
||||
virtual void Select(int n)=0;
|
||||
virtual int GetSelection()=0;
|
||||
virtual int Find(const char *prefix)=0;
|
||||
virtual std::string GetValue(int n)=0;
|
||||
virtual void RegisterImage(int type, const char *xpm_data)=0;
|
||||
virtual void RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage) = 0;
|
||||
virtual void ClearRegisteredImages() noexcept = 0;
|
||||
virtual void SetDelegate(IListBoxDelegate *lbDelegate) noexcept = 0;
|
||||
virtual void SetList(const char* list, char separator, char typesep) = 0;
|
||||
virtual void ClearRegisteredImages()=0;
|
||||
virtual void SetDelegate(IListBoxDelegate *lbDelegate)=0;
|
||||
virtual void SetList(const char* list, char separator, char typesep)=0;
|
||||
virtual void SetOptions(ListOptions options_)=0;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -390,39 +355,31 @@ class Menu {
|
||||
MenuID mid;
|
||||
public:
|
||||
Menu() noexcept;
|
||||
MenuID GetID() const noexcept {
|
||||
return mid;
|
||||
}
|
||||
void CreatePopUp() noexcept;
|
||||
MenuID GetID() const noexcept { return mid; }
|
||||
void CreatePopUp();
|
||||
void Destroy() noexcept;
|
||||
void SCICALL Show(Point pt, const Window &w) noexcept;
|
||||
void Show(Point pt, const Window &w);
|
||||
};
|
||||
|
||||
/**
|
||||
* Dynamic Library (DLL/SO/...) loading
|
||||
* Platform namespace used to retrieve system wide parameters such as double click speed
|
||||
* and chrome colour.
|
||||
*/
|
||||
class DynamicLibrary {
|
||||
public:
|
||||
virtual ~DynamicLibrary() = default;
|
||||
namespace Platform {
|
||||
|
||||
/// @return Pointer to function "name", or NULL on failure.
|
||||
virtual Function FindFunction(const char *name) = 0;
|
||||
|
||||
/// @return true if the library was loaded successfully.
|
||||
virtual bool IsValid() = 0;
|
||||
|
||||
/// @return An instance of a DynamicLibrary subclass with "modulePath" loaded.
|
||||
static DynamicLibrary *Load(const char *modulePath);
|
||||
};
|
||||
|
||||
#if defined(__clang__)
|
||||
#if __has_feature(attribute_analyzer_noreturn)
|
||||
#define CLANG_ANALYZER_NORETURN __attribute__((analyzer_noreturn))
|
||||
#else
|
||||
#define CLANG_ANALYZER_NORETURN
|
||||
#endif
|
||||
#else
|
||||
#define CLANG_ANALYZER_NORETURN
|
||||
#endif
|
||||
ColourDesired Chrome();
|
||||
ColourDesired ChromeHighlight();
|
||||
const char *DefaultFont();
|
||||
int DefaultFontSize();
|
||||
unsigned int DoubleClickTime();
|
||||
constexpr long LongFromTwoShorts(short a,short b) noexcept {
|
||||
return (a) | ((b) << 16);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
||||
|
||||
@ -305,9 +305,6 @@ void ScintillaBase::AutoCompleteStart(Sci::Position lenEntered, const char *list
|
||||
rcac.right = rcac.left + widthLB;
|
||||
rcac.bottom = static_cast<XYPOSITION>(std::min(static_cast<int>(rcac.top) + heightLB, static_cast<int>(rcPopupBounds.bottom)));
|
||||
ac.lb->SetPositionRelative(rcac, &wMain);
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
ac.lb->SetColour(vs.styles[STYLE_DEFAULT].fore, vs.styles[STYLE_DEFAULT].back);
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
ac.lb->SetFont(vs.styles[STYLE_DEFAULT].font.get());
|
||||
const unsigned int aveCharWidth = static_cast<unsigned int>(vs.styles[STYLE_DEFAULT].aveCharWidth);
|
||||
ac.lb->SetAverageCharWidth(aveCharWidth);
|
||||
@ -514,13 +511,15 @@ void ScintillaBase::CallTipClick() {
|
||||
NotifyParent(scn);
|
||||
}
|
||||
|
||||
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
#if SCI_EnablePopupMenu
|
||||
|
||||
bool ScintillaBase::ShouldDisplayPopup(Point ptInWindowCoordinates) const {
|
||||
return (displayPopupMenu == SC_POPUP_ALL ||
|
||||
(displayPopupMenu == SC_POPUP_TEXT && !PointInSelMargin(ptInWindowCoordinates)));
|
||||
}
|
||||
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
#if SCI_EnablePopupMenu
|
||||
void ScintillaBase::ContextMenu(Point pt) {
|
||||
if (displayPopupMenu) {
|
||||
const bool writable = !WndProc(SCI_GETREADONLY, 0, 0);
|
||||
@ -537,9 +536,11 @@ void ScintillaBase::ContextMenu(Point pt) {
|
||||
popup.Show(pt, wMain);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
|
||||
|
||||
void ScintillaBase::CancelModes() {
|
||||
AutoCompleteCancel();
|
||||
ct.CallTipCancel();
|
||||
|
||||
@ -78,11 +78,10 @@ protected:
|
||||
void CallTipShow(Point pt, const char *defn);
|
||||
virtual void CreateCallTipWindow(PRectangle rc) = 0;
|
||||
|
||||
bool ShouldDisplayPopup(Point ptInWindowCoordinates) const;
|
||||
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
#if SCI_EnablePopupMenu
|
||||
virtual void AddToPopUp(const char *label, int cmd=0, bool enabled=true) = 0;
|
||||
bool ShouldDisplayPopup(Point ptInWindowCoordinates) const;
|
||||
void ContextMenu(Point pt);
|
||||
#endif
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
|
||||
@ -286,39 +286,33 @@ void ViewStyle::Init(size_t stylesSize_) {
|
||||
}
|
||||
|
||||
void ViewStyle::Refresh(Surface &surface, int tabInChars) {
|
||||
if (!fontsValid) {
|
||||
fontsValid = true;
|
||||
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 (std::pair<const FontSpecification, std::unique_ptr<FontRealised>> &font : fonts) {
|
||||
font.second->Realise(surface, zoomLevel, technology, font.first);
|
||||
}
|
||||
|
||||
// Set the platform font handle and measurements for each style.
|
||||
for (Style &style : styles) {
|
||||
FontRealised *fr = Find(style);
|
||||
style.Copy(fr->font, *fr);
|
||||
}
|
||||
|
||||
aveCharWidth = styles[STYLE_DEFAULT].aveCharWidth;
|
||||
spaceWidth = styles[STYLE_DEFAULT].spaceWidth;
|
||||
}
|
||||
fonts.clear();
|
||||
|
||||
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 (std::pair<const FontSpecification, std::unique_ptr<FontRealised>> &font : fonts) {
|
||||
font.second->Realise(surface, zoomLevel, technology, font.first);
|
||||
}
|
||||
|
||||
// Set the platform font handle and measurements for each style.
|
||||
for (Style &style : styles) {
|
||||
FontRealised *fr = Find(style);
|
||||
style.Copy(fr->font, *fr);
|
||||
}
|
||||
|
||||
indicatorsDynamic = std::any_of(indicators.cbegin(), indicators.cend(),
|
||||
[](const Indicator &indicator) noexcept { return indicator.IsDynamic(); });
|
||||
|
||||
@ -362,9 +356,6 @@ void ViewStyle::ReleaseAllExtendedStyles() noexcept {
|
||||
}
|
||||
|
||||
int ViewStyle::AllocateExtendedStyles(int numberStyles) {
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
fontsValid = false;
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
const int startRange = nextExtendedStyle;
|
||||
nextExtendedStyle += numberStyles;
|
||||
EnsureStyle(nextExtendedStyle);
|
||||
@ -381,9 +372,6 @@ void ViewStyle::EnsureStyle(size_t index) {
|
||||
}
|
||||
|
||||
void ViewStyle::ResetDefaultStyle() {
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
fontsValid = false;
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
styles[STYLE_DEFAULT].Clear(ColourDesired(0,0,0),
|
||||
ColourDesired(0xff,0xff,0xff),
|
||||
Platform::DefaultFontSize() * SC_FONT_SIZE_MULTIPLIER, fontNames.Save(Platform::DefaultFont()),
|
||||
@ -392,9 +380,6 @@ void ViewStyle::ResetDefaultStyle() {
|
||||
}
|
||||
|
||||
void ViewStyle::ClearStyles() {
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
fontsValid = false;
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
// Reset all styles to be like the default style
|
||||
for (size_t i=0; i<styles.size(); i++) {
|
||||
if (i != STYLE_DEFAULT) {
|
||||
@ -409,9 +394,6 @@ void ViewStyle::ClearStyles() {
|
||||
}
|
||||
|
||||
void ViewStyle::SetStyleFontName(int styleIndex, const char *name) {
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
fontsValid = false;
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
styles[styleIndex].fontName = fontNames.Save(name);
|
||||
}
|
||||
|
||||
@ -631,7 +613,6 @@ bool ViewStyle::ZoomIn() noexcept {
|
||||
level = std::min(level, SC_MAX_ZOOM_LEVEL);
|
||||
if (level != zoomLevel) {
|
||||
zoomLevel = level;
|
||||
fontsValid = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -650,7 +631,6 @@ bool ViewStyle::ZoomOut() noexcept {
|
||||
level = std::max(level, SC_MIN_ZOOM_LEVEL);
|
||||
if (level != zoomLevel) {
|
||||
zoomLevel = level;
|
||||
fontsValid = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -659,9 +639,6 @@ bool ViewStyle::ZoomOut() noexcept {
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
|
||||
void ViewStyle::AllocStyles(size_t sizeNew) {
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
fontsValid = false;
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
size_t i=styles.size();
|
||||
styles.resize(sizeNew);
|
||||
if (styles.size() > STYLE_DEFAULT) {
|
||||
|
||||
@ -96,7 +96,6 @@ public:
|
||||
std::vector<Indicator> indicators;
|
||||
bool indicatorsDynamic;
|
||||
bool indicatorsSetFore;
|
||||
bool fontsValid;
|
||||
int technology;
|
||||
int lineHeight;
|
||||
int lineOverlap;
|
||||
@ -157,8 +156,8 @@ public:
|
||||
int eolAnnotationVisible;
|
||||
int eolAnnotationStyleOffset;
|
||||
bool braceHighlightIndicatorSet;
|
||||
bool braceBadLightIndicatorSet;
|
||||
int braceHighlightIndicator;
|
||||
bool braceBadLightIndicatorSet;
|
||||
int braceBadLightIndicator;
|
||||
int edgeState;
|
||||
EdgeProperties theEdge;
|
||||
|
||||
@ -69,8 +69,8 @@ public:
|
||||
hr = CLSIDFromProgID(OLESTR("mshjdic.hanjadic"), &CLSID_HanjaDic);
|
||||
if (SUCCEEDED(hr)) {
|
||||
hr = CoCreateInstance(CLSID_HanjaDic, nullptr,
|
||||
CLSCTX_INPROC_SERVER, IID_IHanjaDic,
|
||||
(LPVOID *)& HJinterface);
|
||||
CLSCTX_INPROC_SERVER, IID_IHanjaDic,
|
||||
(LPVOID *)& HJinterface);
|
||||
if (SUCCEEDED(hr)) {
|
||||
hr = HJinterface->OpenMainDic();
|
||||
}
|
||||
|
||||
@ -6,6 +6,8 @@
|
||||
// Copyright 2015 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
#pragma once
|
||||
#ifndef HANJADIC_H
|
||||
#define HANJADIC_H
|
||||
|
||||
namespace Scintilla {
|
||||
|
||||
@ -16,3 +18,5 @@ int GetHangulOfHanja(wchar_t *inout) noexcept;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -4,60 +4,18 @@
|
||||
**/
|
||||
// Copyright 1998-2011 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
#pragma once
|
||||
|
||||
// sdkddkver.h
|
||||
#ifndef _WIN32_WINNT_VISTA
|
||||
#define _WIN32_WINNT_VISTA 0x0600
|
||||
#endif
|
||||
#ifndef _WIN32_WINNT_WIN7
|
||||
#define _WIN32_WINNT_WIN7 0x0601
|
||||
#endif
|
||||
#ifndef _WIN32_WINNT_WIN8
|
||||
#define _WIN32_WINNT_WIN8 0x0602
|
||||
#endif
|
||||
#ifndef _WIN32_WINNT_WINBLUE
|
||||
#define _WIN32_WINNT_WINBLUE 0x0603
|
||||
#endif
|
||||
#ifndef _WIN32_WINNT_WIN10
|
||||
#define _WIN32_WINNT_WIN10 0x0A00
|
||||
#endif
|
||||
#ifndef PLATWIN_H
|
||||
#define PLATWIN_H
|
||||
|
||||
namespace Scintilla {
|
||||
|
||||
#ifndef USER_DEFAULT_SCREEN_DPI
|
||||
#define USER_DEFAULT_SCREEN_DPI 96
|
||||
#endif
|
||||
|
||||
#if !defined(DISABLE_D2D)
|
||||
#define USE_D2D 1
|
||||
#endif
|
||||
|
||||
#if defined(USE_D2D)
|
||||
#if defined(_MSC_BUILD) && (VER_PRODUCTVERSION_W <= _WIN32_WINNT_WIN7)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4458)
|
||||
// d2d1helper.h(677,19): warning C4458: declaration of 'a' hides class member
|
||||
#endif
|
||||
#include <d2d1.h>
|
||||
#include <dwrite.h>
|
||||
#if defined(_MSC_BUILD) && (VER_PRODUCTVERSION_W <= _WIN32_WINNT_WIN7)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
DPI_T GetWindowDPI(HWND hwnd);
|
||||
int SystemMetricsForDpi(int nIndex, unsigned dpi);
|
||||
BOOL AdjustWindowRectForDpi(LPRECT lpRect, DWORD dwStyle, DWORD dwExStyle, unsigned dpi);
|
||||
#else
|
||||
extern "C" DPI_T GetWindowDPI(HWND hwnd);
|
||||
extern "C" int SystemMetricsForDpi(int nIndex, unsigned dpi);
|
||||
extern "C" BOOL AdjustWindowRectForDpi(LPRECT lpRect, DWORD dwStyle, DWORD dwExStyle, unsigned dpi);
|
||||
#endif // !__cplusplus
|
||||
|
||||
|
||||
namespace Scintilla {
|
||||
|
||||
extern void Platform_Initialise(void *hInstance) noexcept;
|
||||
|
||||
extern void Platform_Finalise(bool fromDllMain) noexcept;
|
||||
|
||||
constexpr RECT RectFromPRectangle(PRectangle prc) noexcept {
|
||||
@ -67,7 +25,7 @@ constexpr RECT RectFromPRectangle(PRectangle prc) noexcept {
|
||||
}
|
||||
|
||||
constexpr POINT POINTFromPoint(Point pt) noexcept {
|
||||
return POINT { static_cast<LONG>(pt.x), static_cast<LONG>(pt.y) };
|
||||
return POINT{ static_cast<LONG>(pt.x), static_cast<LONG>(pt.y) };
|
||||
}
|
||||
|
||||
constexpr Point PointFromPOINT(POINT pt) noexcept {
|
||||
@ -82,21 +40,13 @@ inline HWND HwndFromWindow(const Window &w) noexcept {
|
||||
return HwndFromWindowID(w.GetID());
|
||||
}
|
||||
|
||||
inline void *PointerFromWindow(HWND hWnd) noexcept {
|
||||
return reinterpret_cast<void *>(::GetWindowLongPtr(hWnd, 0));
|
||||
}
|
||||
|
||||
inline void SetWindowPointer(HWND hWnd, void *ptr) noexcept {
|
||||
::SetWindowLongPtr(hWnd, 0, reinterpret_cast<LONG_PTR>(ptr));
|
||||
}
|
||||
void *PointerFromWindow(HWND hWnd) noexcept;
|
||||
void SetWindowPointer(HWND hWnd, void *ptr) noexcept;
|
||||
|
||||
/// Find a function in a DLL and convert to a function pointer.
|
||||
/// This avoids undefined and conditionally defined behaviour.
|
||||
template<typename T>
|
||||
inline T DLLFunction(HMODULE hModule, LPCSTR lpProcName) noexcept {
|
||||
#if 1
|
||||
return reinterpret_cast<T>(::GetProcAddress(hModule, lpProcName));
|
||||
#else
|
||||
T DLLFunction(HMODULE hModule, LPCSTR lpProcName) noexcept {
|
||||
if (!hModule) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -105,39 +55,44 @@ inline T DLLFunction(HMODULE hModule, LPCSTR lpProcName) noexcept {
|
||||
T fp;
|
||||
memcpy(&fp, &function, sizeof(T));
|
||||
return fp;
|
||||
#endif
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline T DLLFunctionEx(LPCWSTR lpDllName, LPCSTR lpProcName) noexcept {
|
||||
return DLLFunction<T>(::GetModuleHandleW(lpDllName), lpProcName);
|
||||
}
|
||||
|
||||
// Release an IUnknown* and set to nullptr.
|
||||
// While IUnknown::Release must be noexcept, it isn't marked as such so produces
|
||||
// warnings which are avoided by the catch.
|
||||
template <class T>
|
||||
inline void ReleaseUnknown(T *&ppUnknown) noexcept {
|
||||
void ReleaseUnknown(T *&ppUnknown) noexcept {
|
||||
if (ppUnknown) {
|
||||
try {
|
||||
ppUnknown->Release();
|
||||
} catch (...) {
|
||||
}
|
||||
catch (...) {
|
||||
// Never occurs
|
||||
}
|
||||
ppUnknown = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
inline UINT DpiYForWindow(WindowID wid) noexcept {
|
||||
return GetWindowDPI(HwndFromWindowID(wid)).y;
|
||||
}
|
||||
|
||||
HCURSOR LoadReverseArrowCursor(DPI_T dpi) noexcept;
|
||||
UINT DpiForWindow(WindowID wid) noexcept;
|
||||
|
||||
int SystemMetricsForDpi(int nIndex, UINT dpi) noexcept;
|
||||
|
||||
// >>>>>>>>>>>>>>> BEG NON STD SCI PATCH >>>>>>>>>>>>>>>
|
||||
#ifndef AlphaBlend
|
||||
#define AlphaBlend GdiAlphaBlend
|
||||
#endif
|
||||
BOOL AdjustWindowRectForDpi(LPRECT lpRect, DWORD dwStyle, DWORD dwExStyle, UINT dpi) noexcept;
|
||||
// <<<<<<<<<<<<<<< END NON STD SCI PATCH <<<<<<<<<<<<<<<
|
||||
|
||||
HCURSOR LoadReverseArrowCursor(UINT dpi) noexcept;
|
||||
|
||||
#if defined(USE_D2D)
|
||||
extern bool LoadD2D() noexcept;
|
||||
extern bool LoadD2D();
|
||||
extern ID2D1Factory *pD2DFactory;
|
||||
extern IDWriteFactory *pIDWriteFactory;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#define VERSION_SCINTILLA "5.0.0"
|
||||
#define VERSION_WORDS 5, 0, 0, 0
|
||||
#define VERSION_SCINTILLA "5.0.1"
|
||||
#define VERSION_WORDS 5, 0, 1, 0
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION VERSION_WORDS
|
||||
@ -30,7 +30,7 @@ BEGIN
|
||||
VALUE "FileDescription", "Scintilla.DLL - a Source Editing Component vNP3\0"
|
||||
VALUE "FileVersion", VERSION_SCINTILLA "\0"
|
||||
VALUE "InternalName", "Scintilla vNP3\0"
|
||||
VALUE "LegalCopyright", "Copyright 1998-2020 by Neil Hodgson\0"
|
||||
VALUE "LegalCopyright", "Copyright 1998-2021 by Neil Hodgson\0"
|
||||
VALUE "OriginalFilename", "Scintilla.DLL\0"
|
||||
VALUE "ProductName", "Scintilla vNP3\0"
|
||||
VALUE "ProductVersion", VERSION_SCINTILLA "\0"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,11 @@ HanjaDic.o: \
|
||||
HanjaDic.h
|
||||
PlatWin.o: \
|
||||
PlatWin.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/Scintilla.h \
|
||||
../include/Sci_Position.h \
|
||||
../src/XPM.h \
|
||||
../src/UniConversion.h \
|
||||
../src/DBCS.h \
|
||||
@ -18,7 +22,9 @@ ScintillaDLL.o: \
|
||||
ScintillaWin.h
|
||||
ScintillaWin.o: \
|
||||
ScintillaWin.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/ILoader.h \
|
||||
../include/Sci_Position.h \
|
||||
../include/ILexer.h \
|
||||
@ -57,7 +63,9 @@ ScintillaWin.o: \
|
||||
ScintillaWin.h
|
||||
AutoComplete.o: \
|
||||
../src/AutoComplete.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/Scintilla.h \
|
||||
../include/Sci_Position.h \
|
||||
../src/CharacterSet.h \
|
||||
@ -65,11 +73,12 @@ AutoComplete.o: \
|
||||
../src/AutoComplete.h
|
||||
CallTip.o: \
|
||||
../src/CallTip.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/Scintilla.h \
|
||||
../include/Sci_Position.h \
|
||||
../src/Position.h \
|
||||
../src/IntegerRectangle.h \
|
||||
../src/CallTip.h
|
||||
CaseConvert.o: \
|
||||
../src/CaseConvert.cxx \
|
||||
@ -81,7 +90,7 @@ CaseFolder.o: \
|
||||
../src/CaseConvert.h
|
||||
CellBuffer.o: \
|
||||
../src/CellBuffer.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../include/Scintilla.h \
|
||||
../include/Sci_Position.h \
|
||||
../src/Position.h \
|
||||
@ -101,7 +110,7 @@ CharClassify.o: \
|
||||
../src/CharClassify.h
|
||||
ContractionState.o: \
|
||||
../src/ContractionState.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Position.h \
|
||||
../src/UniqueString.h \
|
||||
../src/SplitVector.h \
|
||||
@ -114,7 +123,7 @@ DBCS.o: \
|
||||
../src/DBCS.h
|
||||
Decoration.o: \
|
||||
../src/Decoration.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../include/Scintilla.h \
|
||||
../include/Sci_Position.h \
|
||||
../src/Position.h \
|
||||
@ -124,7 +133,7 @@ Decoration.o: \
|
||||
../src/Decoration.h
|
||||
Document.o: \
|
||||
../src/Document.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../include/ILoader.h \
|
||||
../include/Sci_Position.h \
|
||||
../include/ILexer.h \
|
||||
@ -146,7 +155,9 @@ Document.o: \
|
||||
../src/ElapsedPeriod.h
|
||||
EditModel.o: \
|
||||
../src/EditModel.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/ILoader.h \
|
||||
../include/Sci_Position.h \
|
||||
../include/ILexer.h \
|
||||
@ -174,7 +185,9 @@ EditModel.o: \
|
||||
../src/EditModel.h
|
||||
Editor.o: \
|
||||
../src/Editor.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/ILoader.h \
|
||||
../include/Sci_Position.h \
|
||||
../include/ILexer.h \
|
||||
@ -208,7 +221,9 @@ Editor.o: \
|
||||
../src/ElapsedPeriod.h
|
||||
EditView.o: \
|
||||
../src/EditView.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/ILoader.h \
|
||||
../include/Sci_Position.h \
|
||||
../include/ILexer.h \
|
||||
@ -216,7 +231,6 @@ EditView.o: \
|
||||
../src/CharacterSet.h \
|
||||
../src/CharacterCategory.h \
|
||||
../src/Position.h \
|
||||
../src/IntegerRectangle.h \
|
||||
../src/UniqueString.h \
|
||||
../src/SplitVector.h \
|
||||
../src/Partitioning.h \
|
||||
@ -240,38 +254,45 @@ EditView.o: \
|
||||
../src/MarginView.h \
|
||||
../src/EditView.h \
|
||||
../src/ElapsedPeriod.h
|
||||
Geometry.o: \
|
||||
../src/Geometry.cxx \
|
||||
../src/Geometry.h
|
||||
Indicator.o: \
|
||||
../src/Indicator.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/Scintilla.h \
|
||||
../include/Sci_Position.h \
|
||||
../src/IntegerRectangle.h \
|
||||
../src/Indicator.h \
|
||||
../src/XPM.h
|
||||
KeyMap.o: \
|
||||
../src/KeyMap.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../include/Scintilla.h \
|
||||
../include/Sci_Position.h \
|
||||
../src/KeyMap.h
|
||||
LineMarker.o: \
|
||||
../src/LineMarker.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/Scintilla.h \
|
||||
../include/Sci_Position.h \
|
||||
../src/IntegerRectangle.h \
|
||||
../src/XPM.h \
|
||||
../src/LineMarker.h
|
||||
../src/LineMarker.h \
|
||||
../src/UniConversion.h
|
||||
MarginView.o: \
|
||||
../src/MarginView.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/ILoader.h \
|
||||
../include/Sci_Position.h \
|
||||
../include/ILexer.h \
|
||||
../include/Scintilla.h \
|
||||
../src/CharacterCategory.h \
|
||||
../src/Position.h \
|
||||
../src/IntegerRectangle.h \
|
||||
../src/UniqueString.h \
|
||||
../src/SplitVector.h \
|
||||
../src/Partitioning.h \
|
||||
@ -295,7 +316,9 @@ MarginView.o: \
|
||||
../src/EditView.h
|
||||
PerLine.o: \
|
||||
../src/PerLine.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/Scintilla.h \
|
||||
../include/Sci_Position.h \
|
||||
../src/Position.h \
|
||||
@ -305,7 +328,9 @@ PerLine.o: \
|
||||
../src/PerLine.h
|
||||
PositionCache.o: \
|
||||
../src/PositionCache.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/ILoader.h \
|
||||
../include/Sci_Position.h \
|
||||
../include/ILexer.h \
|
||||
@ -337,7 +362,7 @@ RESearch.o: \
|
||||
../src/RESearch.h
|
||||
RunStyles.o: \
|
||||
../src/RunStyles.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../include/Scintilla.h \
|
||||
../include/Sci_Position.h \
|
||||
../src/Position.h \
|
||||
@ -346,7 +371,9 @@ RunStyles.o: \
|
||||
../src/RunStyles.h
|
||||
ScintillaBase.o: \
|
||||
../src/ScintillaBase.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/ILoader.h \
|
||||
../include/Sci_Position.h \
|
||||
../include/ILexer.h \
|
||||
@ -379,7 +406,9 @@ ScintillaBase.o: \
|
||||
../src/ScintillaBase.h
|
||||
ScintillaBaseL.o: \
|
||||
../src/ScintillaBase.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/ILoader.h \
|
||||
../include/Sci_Position.h \
|
||||
../include/ILexer.h \
|
||||
@ -412,14 +441,16 @@ ScintillaBaseL.o: \
|
||||
../src/ScintillaBase.h
|
||||
Selection.o: \
|
||||
../src/Selection.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../include/Scintilla.h \
|
||||
../include/Sci_Position.h \
|
||||
../src/Position.h \
|
||||
../src/Selection.h
|
||||
Style.o: \
|
||||
../src/Style.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/Scintilla.h \
|
||||
../include/Sci_Position.h \
|
||||
../src/Style.h
|
||||
@ -431,7 +462,9 @@ UniqueString.o: \
|
||||
../src/UniqueString.h
|
||||
ViewStyle.o: \
|
||||
../src/ViewStyle.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/Scintilla.h \
|
||||
../include/Sci_Position.h \
|
||||
../src/Position.h \
|
||||
@ -443,5 +476,7 @@ ViewStyle.o: \
|
||||
../src/ViewStyle.h
|
||||
XPM.o: \
|
||||
../src/XPM.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../src/XPM.h
|
||||
|
||||
@ -96,6 +96,7 @@ SRC_OBJS = \
|
||||
EditModel.o \
|
||||
Editor.o \
|
||||
EditView.o \
|
||||
Geometry.o \
|
||||
Indicator.o \
|
||||
KeyMap.o \
|
||||
LineMarker.o \
|
||||
|
||||
@ -5,7 +5,11 @@ $(DIR_O)/HanjaDic.obj: \
|
||||
HanjaDic.h
|
||||
$(DIR_O)/PlatWin.obj: \
|
||||
PlatWin.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/Scintilla.h \
|
||||
../include/Sci_Position.h \
|
||||
../src/XPM.h \
|
||||
../src/UniConversion.h \
|
||||
../src/DBCS.h \
|
||||
@ -18,7 +22,9 @@ $(DIR_O)/ScintillaDLL.obj: \
|
||||
ScintillaWin.h
|
||||
$(DIR_O)/ScintillaWin.obj: \
|
||||
ScintillaWin.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/ILoader.h \
|
||||
../include/Sci_Position.h \
|
||||
../include/ILexer.h \
|
||||
@ -57,7 +63,9 @@ $(DIR_O)/ScintillaWin.obj: \
|
||||
ScintillaWin.h
|
||||
$(DIR_O)/AutoComplete.obj: \
|
||||
../src/AutoComplete.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/Scintilla.h \
|
||||
../include/Sci_Position.h \
|
||||
../src/CharacterSet.h \
|
||||
@ -65,11 +73,12 @@ $(DIR_O)/AutoComplete.obj: \
|
||||
../src/AutoComplete.h
|
||||
$(DIR_O)/CallTip.obj: \
|
||||
../src/CallTip.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/Scintilla.h \
|
||||
../include/Sci_Position.h \
|
||||
../src/Position.h \
|
||||
../src/IntegerRectangle.h \
|
||||
../src/CallTip.h
|
||||
$(DIR_O)/CaseConvert.obj: \
|
||||
../src/CaseConvert.cxx \
|
||||
@ -81,7 +90,7 @@ $(DIR_O)/CaseFolder.obj: \
|
||||
../src/CaseConvert.h
|
||||
$(DIR_O)/CellBuffer.obj: \
|
||||
../src/CellBuffer.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../include/Scintilla.h \
|
||||
../include/Sci_Position.h \
|
||||
../src/Position.h \
|
||||
@ -101,7 +110,7 @@ $(DIR_O)/CharClassify.obj: \
|
||||
../src/CharClassify.h
|
||||
$(DIR_O)/ContractionState.obj: \
|
||||
../src/ContractionState.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Position.h \
|
||||
../src/UniqueString.h \
|
||||
../src/SplitVector.h \
|
||||
@ -114,7 +123,7 @@ $(DIR_O)/DBCS.obj: \
|
||||
../src/DBCS.h
|
||||
$(DIR_O)/Decoration.obj: \
|
||||
../src/Decoration.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../include/Scintilla.h \
|
||||
../include/Sci_Position.h \
|
||||
../src/Position.h \
|
||||
@ -124,7 +133,7 @@ $(DIR_O)/Decoration.obj: \
|
||||
../src/Decoration.h
|
||||
$(DIR_O)/Document.obj: \
|
||||
../src/Document.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../include/ILoader.h \
|
||||
../include/Sci_Position.h \
|
||||
../include/ILexer.h \
|
||||
@ -146,7 +155,9 @@ $(DIR_O)/Document.obj: \
|
||||
../src/ElapsedPeriod.h
|
||||
$(DIR_O)/EditModel.obj: \
|
||||
../src/EditModel.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/ILoader.h \
|
||||
../include/Sci_Position.h \
|
||||
../include/ILexer.h \
|
||||
@ -174,7 +185,9 @@ $(DIR_O)/EditModel.obj: \
|
||||
../src/EditModel.h
|
||||
$(DIR_O)/Editor.obj: \
|
||||
../src/Editor.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/ILoader.h \
|
||||
../include/Sci_Position.h \
|
||||
../include/ILexer.h \
|
||||
@ -208,7 +221,9 @@ $(DIR_O)/Editor.obj: \
|
||||
../src/ElapsedPeriod.h
|
||||
$(DIR_O)/EditView.obj: \
|
||||
../src/EditView.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/ILoader.h \
|
||||
../include/Sci_Position.h \
|
||||
../include/ILexer.h \
|
||||
@ -216,7 +231,6 @@ $(DIR_O)/EditView.obj: \
|
||||
../src/CharacterSet.h \
|
||||
../src/CharacterCategory.h \
|
||||
../src/Position.h \
|
||||
../src/IntegerRectangle.h \
|
||||
../src/UniqueString.h \
|
||||
../src/SplitVector.h \
|
||||
../src/Partitioning.h \
|
||||
@ -240,38 +254,45 @@ $(DIR_O)/EditView.obj: \
|
||||
../src/MarginView.h \
|
||||
../src/EditView.h \
|
||||
../src/ElapsedPeriod.h
|
||||
$(DIR_O)/Geometry.obj: \
|
||||
../src/Geometry.cxx \
|
||||
../src/Geometry.h
|
||||
$(DIR_O)/Indicator.obj: \
|
||||
../src/Indicator.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/Scintilla.h \
|
||||
../include/Sci_Position.h \
|
||||
../src/IntegerRectangle.h \
|
||||
../src/Indicator.h \
|
||||
../src/XPM.h
|
||||
$(DIR_O)/KeyMap.obj: \
|
||||
../src/KeyMap.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../include/Scintilla.h \
|
||||
../include/Sci_Position.h \
|
||||
../src/KeyMap.h
|
||||
$(DIR_O)/LineMarker.obj: \
|
||||
../src/LineMarker.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/Scintilla.h \
|
||||
../include/Sci_Position.h \
|
||||
../src/IntegerRectangle.h \
|
||||
../src/XPM.h \
|
||||
../src/LineMarker.h
|
||||
../src/LineMarker.h \
|
||||
../src/UniConversion.h
|
||||
$(DIR_O)/MarginView.obj: \
|
||||
../src/MarginView.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/ILoader.h \
|
||||
../include/Sci_Position.h \
|
||||
../include/ILexer.h \
|
||||
../include/Scintilla.h \
|
||||
../src/CharacterCategory.h \
|
||||
../src/Position.h \
|
||||
../src/IntegerRectangle.h \
|
||||
../src/UniqueString.h \
|
||||
../src/SplitVector.h \
|
||||
../src/Partitioning.h \
|
||||
@ -295,7 +316,9 @@ $(DIR_O)/MarginView.obj: \
|
||||
../src/EditView.h
|
||||
$(DIR_O)/PerLine.obj: \
|
||||
../src/PerLine.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/Scintilla.h \
|
||||
../include/Sci_Position.h \
|
||||
../src/Position.h \
|
||||
@ -305,7 +328,9 @@ $(DIR_O)/PerLine.obj: \
|
||||
../src/PerLine.h
|
||||
$(DIR_O)/PositionCache.obj: \
|
||||
../src/PositionCache.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/ILoader.h \
|
||||
../include/Sci_Position.h \
|
||||
../include/ILexer.h \
|
||||
@ -337,7 +362,7 @@ $(DIR_O)/RESearch.obj: \
|
||||
../src/RESearch.h
|
||||
$(DIR_O)/RunStyles.obj: \
|
||||
../src/RunStyles.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../include/Scintilla.h \
|
||||
../include/Sci_Position.h \
|
||||
../src/Position.h \
|
||||
@ -346,7 +371,9 @@ $(DIR_O)/RunStyles.obj: \
|
||||
../src/RunStyles.h
|
||||
$(DIR_O)/ScintillaBase.obj: \
|
||||
../src/ScintillaBase.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/ILoader.h \
|
||||
../include/Sci_Position.h \
|
||||
../include/ILexer.h \
|
||||
@ -379,7 +406,9 @@ $(DIR_O)/ScintillaBase.obj: \
|
||||
../src/ScintillaBase.h
|
||||
$(DIR_O)/ScintillaBaseL.obj: \
|
||||
../src/ScintillaBase.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/ILoader.h \
|
||||
../include/Sci_Position.h \
|
||||
../include/ILexer.h \
|
||||
@ -412,14 +441,16 @@ $(DIR_O)/ScintillaBaseL.obj: \
|
||||
../src/ScintillaBase.h
|
||||
$(DIR_O)/Selection.obj: \
|
||||
../src/Selection.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../include/Scintilla.h \
|
||||
../include/Sci_Position.h \
|
||||
../src/Position.h \
|
||||
../src/Selection.h
|
||||
$(DIR_O)/Style.obj: \
|
||||
../src/Style.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/Scintilla.h \
|
||||
../include/Sci_Position.h \
|
||||
../src/Style.h
|
||||
@ -431,7 +462,9 @@ $(DIR_O)/UniqueString.obj: \
|
||||
../src/UniqueString.h
|
||||
$(DIR_O)/ViewStyle.obj: \
|
||||
../src/ViewStyle.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../include/Scintilla.h \
|
||||
../include/Sci_Position.h \
|
||||
../src/Position.h \
|
||||
@ -443,5 +476,7 @@ $(DIR_O)/ViewStyle.obj: \
|
||||
../src/ViewStyle.h
|
||||
$(DIR_O)/XPM.obj: \
|
||||
../src/XPM.cxx \
|
||||
../include/Platform.h \
|
||||
../src/Debugging.h \
|
||||
../src/Geometry.h \
|
||||
../src/Platform.h \
|
||||
../src/XPM.h
|
||||
|
||||
@ -89,6 +89,7 @@ SRC_OBJS=\
|
||||
$(DIR_O)\EditModel.obj \
|
||||
$(DIR_O)\Editor.obj \
|
||||
$(DIR_O)\EditView.obj \
|
||||
$(DIR_O)\Geometry.obj \
|
||||
$(DIR_O)\Indicator.obj \
|
||||
$(DIR_O)\KeyMap.obj \
|
||||
$(DIR_O)\LineMarker.obj \
|
||||
|
||||
188
src/Dialogs.c
188
src/Dialogs.c
@ -227,7 +227,7 @@ static INT_PTR CALLBACK _InfoBoxLngDlgProc(HWND hwnd, UINT umsg, WPARAM wParam,
|
||||
{
|
||||
static HBITMAP hIconBmp = NULL;
|
||||
static HICON hBoxIcon = NULL;
|
||||
static DPI_T dpi = {USER_DEFAULT_SCREEN_DPI, USER_DEFAULT_SCREEN_DPI};
|
||||
static UINT dpi = USER_DEFAULT_SCREEN_DPI;
|
||||
|
||||
switch (umsg) {
|
||||
case WM_INITDIALOG: {
|
||||
@ -296,15 +296,14 @@ static INT_PTR CALLBACK _InfoBoxLngDlgProc(HWND hwnd, UINT umsg, WPARAM wParam,
|
||||
|
||||
|
||||
case WM_DPICHANGED: {
|
||||
dpi.x = LOWORD(wParam);
|
||||
dpi.y = HIWORD(wParam);
|
||||
dpi = LOWORD(wParam);
|
||||
int const scxb = Scintilla_GetSystemMetricsForDpi(SM_CXICON, dpi);
|
||||
int const scyb = Scintilla_GetSystemMetricsForDpi(SM_CYICON, dpi);
|
||||
hIconBmp = ResampleIconToBitmap(hwnd, hIconBmp, hBoxIcon, scxb, scyb);
|
||||
if (hIconBmp) {
|
||||
SetBitmapControl(hwnd, IDC_INFOBOXICON, hIconBmp);
|
||||
}
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, NULL);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, 0);
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
@ -757,7 +756,7 @@ static INT_PTR CALLBACK CmdLineHelpProc(HWND hwnd, UINT umsg, WPARAM wParam, LPA
|
||||
return TRUE;
|
||||
|
||||
case WM_DPICHANGED:
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, NULL);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, 0);
|
||||
return TRUE;
|
||||
|
||||
#ifdef D_NP3_WIN10_DARK_MODE
|
||||
@ -958,7 +957,7 @@ INT_PTR CALLBACK AboutDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam
|
||||
static HFONT hVersionFont = NULL;
|
||||
static char pAboutResource[8192] = { '\0' };
|
||||
static char* pAboutInfo = NULL;
|
||||
static DPI_T dpi = { 0, 0 };
|
||||
static UINT dpi = USER_DEFAULT_SCREEN_DPI;
|
||||
static HBRUSH hbrBkgnd = NULL;
|
||||
|
||||
switch (umsg) {
|
||||
@ -1064,15 +1063,15 @@ INT_PTR CALLBACK AboutDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam
|
||||
}
|
||||
SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_STREAMIN, SF_RTF, (LPARAM)&editStreamIn);
|
||||
}
|
||||
SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_SHOWSCROLLBAR, SB_HORZ, (LPARAM)(dpi.y > USER_DEFAULT_SCREEN_DPI));
|
||||
SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_SHOWSCROLLBAR, SB_HORZ, (LPARAM)(dpi > USER_DEFAULT_SCREEN_DPI));
|
||||
|
||||
// RichEdit-Ctrl DPI-BUG: it initially uses the DPI setting of
|
||||
// the main(1) screen instead it's current parent window screen DPI
|
||||
DPI_T const dpiPrime = Scintilla_GetWindowDPI(NULL);
|
||||
SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_SETZOOM, (WPARAM)dpi.y, (LPARAM)dpiPrime.y);
|
||||
UINT const dpiPrime = Scintilla_GetWindowDPI(NULL);
|
||||
SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_SETZOOM, (WPARAM)dpi, (LPARAM)dpiPrime);
|
||||
|
||||
int const width = ScaleIntByDPI(136, dpi.x);
|
||||
int const height = ScaleIntByDPI(41, dpi.y);
|
||||
int const width = ScaleIntByDPI(136, dpi);
|
||||
int const height = ScaleIntByDPI(41, dpi);
|
||||
HBITMAP hBmp = LoadImage(Globals.hInstance, MAKEINTRESOURCE(IDR_RIZBITMAP), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION);
|
||||
SetBitmapControlResample(hwnd, IDC_RIZONEBMP, hBmp, width, height);
|
||||
DeleteObject(hBmp);
|
||||
@ -1087,8 +1086,8 @@ INT_PTR CALLBACK AboutDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam
|
||||
break;
|
||||
|
||||
case WM_DPICHANGED: {
|
||||
dpi.x = LOWORD(wParam);
|
||||
dpi.y = HIWORD(wParam);
|
||||
dpi = LOWORD(wParam);
|
||||
//dpi.y = HIWORD(wParam);
|
||||
|
||||
// render rich-edit control text again
|
||||
if (!StrIsEmptyA(pAboutResource)) {
|
||||
@ -1099,11 +1098,11 @@ INT_PTR CALLBACK AboutDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam
|
||||
}
|
||||
SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_STREAMIN, SF_RTF, (LPARAM)&editStreamIn);
|
||||
}
|
||||
SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_SHOWSCROLLBAR, SB_HORZ, (LPARAM)(dpi.y > USER_DEFAULT_SCREEN_DPI));
|
||||
SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_SHOWSCROLLBAR, SB_HORZ, (LPARAM)(dpi > USER_DEFAULT_SCREEN_DPI));
|
||||
//~SendDlgItemMessage(hwnd, IDC_RICHEDITABOUT, EM_SETZOOM, (WPARAM)dpi.y, (LPARAM)USER_DEFAULT_SCREEN_DPI);
|
||||
|
||||
int const width = ScaleIntByDPI(136, dpi.x);
|
||||
int const height = ScaleIntByDPI(41, dpi.y);
|
||||
int const width = ScaleIntByDPI(136, dpi);
|
||||
int const height = ScaleIntByDPI(41, dpi);
|
||||
HBITMAP hBmp = LoadImage(Globals.hInstance, MAKEINTRESOURCE(IDR_RIZBITMAP), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION);
|
||||
SetBitmapControlResample(hwnd, IDC_RIZONEBMP, hBmp, width, height);
|
||||
DeleteObject(hBmp);
|
||||
@ -1122,7 +1121,7 @@ INT_PTR CALLBACK AboutDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam
|
||||
SendDlgItemMessageW(hwnd, IDC_VERSION, WM_SETFONT, (WPARAM)hVersionFont, true);
|
||||
}
|
||||
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, NULL);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1179,13 +1178,13 @@ CASE_WM_CTLCOLOR_SET:
|
||||
SetMapMode(hdc, MM_TEXT);
|
||||
|
||||
int const iconSize = 128;
|
||||
int const dpiWidth = ScaleIntByDPI(iconSize, dpi.x);
|
||||
int const dpiHeight = ScaleIntByDPI(iconSize, dpi.y);
|
||||
int const dpiWidth = ScaleIntByDPI(iconSize, dpi);
|
||||
int const dpiHeight = ScaleIntByDPI(iconSize, dpi);
|
||||
HICON const hicon = (dpiHeight > 128) ? Globals.hDlgIcon256 : Globals.hDlgIcon128;
|
||||
if (hicon) {
|
||||
//RECT rc = {0};
|
||||
//MapWindowPoints(GetDlgItem(hwnd, IDC_INFO_GROUPBOX), hwnd, (LPPOINT)&rc, 2);
|
||||
DrawIconEx(hdc, ScaleIntByDPI(10, dpi.x), ScaleIntByDPI(10, dpi.x), hicon, dpiWidth, dpiHeight, 0, NULL, DI_NORMAL);
|
||||
DrawIconEx(hdc, ScaleIntByDPI(10, dpi), ScaleIntByDPI(10, dpi), hicon, dpiWidth, dpiHeight, 0, NULL, DI_NORMAL);
|
||||
}
|
||||
|
||||
ReleaseDC(hwnd, hdc);
|
||||
@ -1305,7 +1304,7 @@ CASE_WM_CTLCOLOR_SET:
|
||||
StringCchPrintf(wchBuf, COUNTOF(wchBuf), L"\n- Screen-Resolution -> %i x %i [pix]", ResX, ResY);
|
||||
StringCchCat(wchVerInfo, COUNTOF(wchVerInfo), wchBuf);
|
||||
|
||||
StringCchPrintf(wchBuf, COUNTOF(wchBuf), L"\n- Display-DPI -> %i x %i (Scale: %i%%).", dpi.x, dpi.y, ScaleIntToDPI_X(hwnd, 100));
|
||||
StringCchPrintf(wchBuf, COUNTOF(wchBuf), L"\n- Display-DPI -> %i x %i (Scale: %i%%).", dpi, dpi, ScaleIntToDPI(hwnd, 100));
|
||||
StringCchCat(wchVerInfo, COUNTOF(wchVerInfo), wchBuf);
|
||||
|
||||
StringCchPrintf(wchBuf, COUNTOF(wchBuf), L"\n- Rendering-Technology -> '%s'", Settings.RenderingTechnology ? L"DIRECT-WRITE" : L"GDI");
|
||||
@ -1370,7 +1369,7 @@ static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM l
|
||||
|
||||
|
||||
case WM_DPICHANGED:
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, NULL);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, 0);
|
||||
return TRUE;
|
||||
|
||||
|
||||
@ -1588,7 +1587,7 @@ static INT_PTR CALLBACK OpenWithDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM
|
||||
|
||||
|
||||
case WM_DPICHANGED:
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, NULL);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, 0);
|
||||
return TRUE;
|
||||
|
||||
|
||||
@ -1821,7 +1820,7 @@ static INT_PTR CALLBACK FavoritesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
|
||||
|
||||
|
||||
case WM_DPICHANGED:
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, NULL);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, 0);
|
||||
return TRUE;
|
||||
|
||||
|
||||
@ -2026,7 +2025,7 @@ static INT_PTR CALLBACK AddToFavDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPA
|
||||
|
||||
|
||||
case WM_DPICHANGED:
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, NULL);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, 0);
|
||||
break;
|
||||
|
||||
|
||||
@ -2306,7 +2305,7 @@ static INT_PTR CALLBACK FileMRUDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPAR
|
||||
return TRUE;
|
||||
|
||||
case WM_DPICHANGED:
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, NULL);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, 0);
|
||||
return TRUE;
|
||||
|
||||
case WM_DESTROY: {
|
||||
@ -2725,7 +2724,7 @@ static INT_PTR CALLBACK ChangeNotifyDlgProc(HWND hwnd, UINT umsg, WPARAM wParam,
|
||||
return TRUE;
|
||||
|
||||
case WM_DPICHANGED:
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, NULL);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, 0);
|
||||
return TRUE;
|
||||
|
||||
#ifdef D_NP3_WIN10_DARK_MODE
|
||||
@ -2883,7 +2882,7 @@ static INT_PTR CALLBACK ColumnWrapDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, L
|
||||
|
||||
|
||||
case WM_DPICHANGED:
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, NULL);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, 0);
|
||||
return TRUE;
|
||||
|
||||
|
||||
@ -3030,7 +3029,7 @@ static INT_PTR CALLBACK WordWrapSettingsDlgProc(HWND hwnd, UINT umsg, WPARAM wPa
|
||||
|
||||
|
||||
case WM_DPICHANGED:
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, NULL);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, 0);
|
||||
return TRUE;
|
||||
|
||||
|
||||
@ -3174,7 +3173,7 @@ static INT_PTR CALLBACK LongLineSettingsDlgProc(HWND hwnd, UINT umsg, WPARAM wPa
|
||||
|
||||
|
||||
case WM_DPICHANGED:
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, NULL);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, 0);
|
||||
return TRUE;
|
||||
|
||||
|
||||
@ -3332,7 +3331,7 @@ static INT_PTR CALLBACK TabSettingsDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPA
|
||||
|
||||
|
||||
case WM_DPICHANGED:
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, NULL);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, 0);
|
||||
return TRUE;
|
||||
|
||||
|
||||
@ -3507,7 +3506,7 @@ static INT_PTR CALLBACK SelectDefEncodingDlgProc(HWND hwnd, UINT umsg, WPARAM wP
|
||||
|
||||
|
||||
case WM_DPICHANGED:
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, NULL);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, 0);
|
||||
return TRUE;
|
||||
|
||||
|
||||
@ -3704,7 +3703,7 @@ static INT_PTR CALLBACK SelectEncodingDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,
|
||||
|
||||
|
||||
case WM_DPICHANGED:
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, NULL);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, 0);
|
||||
return TRUE;
|
||||
|
||||
|
||||
@ -3934,7 +3933,7 @@ static INT_PTR CALLBACK SelectDefLineEndingDlgProc(HWND hwnd,UINT umsg,WPARAM wP
|
||||
|
||||
|
||||
case WM_DPICHANGED:
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, NULL);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, 0);
|
||||
return TRUE;
|
||||
|
||||
|
||||
@ -5128,7 +5127,7 @@ void GetDlgPos(HWND hDlg, LPINT xDlg, LPINT yDlg)
|
||||
return;
|
||||
}
|
||||
|
||||
DPI_T const dpi = Scintilla_GetWindowDPI(hDlg);
|
||||
UINT const dpi = Scintilla_GetWindowDPI(hDlg);
|
||||
|
||||
RECT rcDlg;
|
||||
GetWindowRect(hDlg, &rcDlg);
|
||||
@ -5139,10 +5138,10 @@ void GetDlgPos(HWND hDlg, LPINT xDlg, LPINT yDlg)
|
||||
|
||||
// return positions relative to parent window (normalized DPI)
|
||||
if (xDlg) {
|
||||
*xDlg = MulDiv((rcDlg.left - rcParent.left), USER_DEFAULT_SCREEN_DPI, (dpi.x ? dpi.x : USER_DEFAULT_SCREEN_DPI));
|
||||
*xDlg = MulDiv((rcDlg.left - rcParent.left), USER_DEFAULT_SCREEN_DPI, (dpi ? dpi : USER_DEFAULT_SCREEN_DPI));
|
||||
}
|
||||
if (yDlg) {
|
||||
*yDlg = MulDiv((rcDlg.top - rcParent.top), USER_DEFAULT_SCREEN_DPI, (dpi.y ? dpi.y : USER_DEFAULT_SCREEN_DPI));
|
||||
*yDlg = MulDiv((rcDlg.top - rcParent.top), USER_DEFAULT_SCREEN_DPI, (dpi ? dpi : USER_DEFAULT_SCREEN_DPI));
|
||||
}
|
||||
}
|
||||
|
||||
@ -5157,7 +5156,7 @@ void SetDlgPos(HWND hDlg, int xDlg, int yDlg)
|
||||
return;
|
||||
}
|
||||
|
||||
DPI_T const dpi = Scintilla_GetWindowDPI(hDlg);
|
||||
UINT const dpi = Scintilla_GetWindowDPI(hDlg);
|
||||
|
||||
RECT rcDlg;
|
||||
GetWindowRect(hDlg, &rcDlg);
|
||||
@ -5178,8 +5177,8 @@ void SetDlgPos(HWND hDlg, int xDlg, int yDlg)
|
||||
int const yMax = (mi.rcWork.bottom) - (rcDlg.bottom - rcDlg.top);
|
||||
|
||||
// desired positions relative to parent window (normalized DPI)
|
||||
int const x = rcParent.left + MulDiv(xDlg, dpi.x, USER_DEFAULT_SCREEN_DPI);
|
||||
int const y = rcParent.top + MulDiv(yDlg, dpi.y, USER_DEFAULT_SCREEN_DPI);
|
||||
int const x = rcParent.left + MulDiv(xDlg, dpi, USER_DEFAULT_SCREEN_DPI);
|
||||
int const y = rcParent.top + MulDiv(yDlg, dpi, USER_DEFAULT_SCREEN_DPI);
|
||||
|
||||
SetWindowPos(hDlg, NULL, clampi(x, xMin, xMax), clampi(y, yMin, yMax), 0, 0, SWP_NOZORDER | SWP_NOSIZE);
|
||||
}
|
||||
@ -5197,7 +5196,7 @@ void SetDlgPos(HWND hDlg, int xDlg, int yDlg)
|
||||
|
||||
typedef struct _resizeDlg {
|
||||
int direction;
|
||||
DPI_T dpi;
|
||||
UINT dpi;
|
||||
int cxClient;
|
||||
int cyClient;
|
||||
int mmiPtMinX;
|
||||
@ -5222,16 +5221,7 @@ void ResizeDlg_InitEx(HWND hwnd, int cxFrame, int cyFrame, int nIdGrip, RSZ_DLG_
|
||||
|
||||
const DWORD style = (pm->direction < 0) ? (GetWindowStyle(hwnd) & ~WS_THICKFRAME) : (GetWindowStyle(hwnd) | WS_THICKFRAME);
|
||||
|
||||
WRCT_T wrc = { 0 };
|
||||
wrc.left = rc.left;
|
||||
wrc.top = rc.top;
|
||||
wrc.right = rc.right;
|
||||
wrc.bottom = rc.bottom;
|
||||
Scintilla_AdjustWindowRectForDpi(&wrc, style, 0, pm->dpi);
|
||||
rc.left = wrc.left;
|
||||
rc.top = wrc.top;
|
||||
rc.right = wrc.right;
|
||||
rc.bottom = wrc.bottom;
|
||||
Scintilla_AdjustWindowRectForDpi((LPWRECT)&rc, style, 0, pm->dpi);
|
||||
|
||||
pm->mmiPtMinX = rc.right - rc.left;
|
||||
pm->mmiPtMinY = rc.bottom - rc.top;
|
||||
@ -5294,17 +5284,17 @@ void ResizeDlg_Size(HWND hwnd, LPARAM lParam, int* cx, int* cy)
|
||||
const int cxClient = LOWORD(lParam);
|
||||
const int cyClient = HIWORD(lParam);
|
||||
#if NP3_ENABLE_RESIZEDLG_TEMP_FIX
|
||||
const DPI_T dpi = Scintilla_GetWindowDPI(hwnd);
|
||||
const DPI_T old = pm->dpi;
|
||||
const UINT dpi = Scintilla_GetWindowDPI(hwnd);
|
||||
const UINT old = pm->dpi;
|
||||
if (cx) {
|
||||
*cx = cxClient - MulDiv(pm->cxClient, dpi.x, old.x);
|
||||
*cx = cxClient - MulDiv(pm->cxClient, dpi, old);
|
||||
}
|
||||
if (cy) {
|
||||
*cy = cyClient - MulDiv(pm->cyClient, dpi.y, old.y);
|
||||
*cy = cyClient - MulDiv(pm->cyClient, dpi, old);
|
||||
}
|
||||
// store in original DPI.
|
||||
pm->cxClient = MulDiv(cxClient, old.x, dpi.x);
|
||||
pm->cyClient = MulDiv(cyClient, old.y, dpi.y);
|
||||
pm->cxClient = MulDiv(cxClient, old, dpi);
|
||||
pm->cyClient = MulDiv(cyClient, old, dpi);
|
||||
#else
|
||||
if (cx) {
|
||||
*cx = cxClient - pm->cxClient;
|
||||
@ -5322,20 +5312,20 @@ void ResizeDlg_GetMinMaxInfo(HWND hwnd, LPARAM lParam)
|
||||
LPCRESIZEDLG pm = (LPCRESIZEDLG)GetProp(hwnd, RESIZEDLG_PROP_KEY);
|
||||
LPMINMAXINFO lpmmi = (LPMINMAXINFO)lParam;
|
||||
#if NP3_ENABLE_RESIZEDLG_TEMP_FIX
|
||||
DPI_T const dpi = Scintilla_GetWindowDPI(hwnd);
|
||||
DPI_T const old = pm->dpi;
|
||||
UINT const dpi = Scintilla_GetWindowDPI(hwnd);
|
||||
UINT const old = pm->dpi;
|
||||
|
||||
lpmmi->ptMinTrackSize.x = MulDiv(pm->mmiPtMinX, dpi.x, old.x);
|
||||
lpmmi->ptMinTrackSize.y = MulDiv(pm->mmiPtMinY, dpi.y, old.y);
|
||||
lpmmi->ptMinTrackSize.x = MulDiv(pm->mmiPtMinX, dpi, old);
|
||||
lpmmi->ptMinTrackSize.y = MulDiv(pm->mmiPtMinY, dpi, old);
|
||||
|
||||
// only one direction
|
||||
switch (pm->direction) {
|
||||
case RSZ_ONLY_X:
|
||||
lpmmi->ptMaxTrackSize.y = MulDiv(pm->mmiPtMaxY, dpi.x, old.x);
|
||||
lpmmi->ptMaxTrackSize.y = MulDiv(pm->mmiPtMaxY, dpi, old);
|
||||
break;
|
||||
|
||||
case RSZ_ONLY_Y:
|
||||
lpmmi->ptMaxTrackSize.x = MulDiv(pm->mmiPtMaxX, dpi.y, old.y);
|
||||
lpmmi->ptMaxTrackSize.x = MulDiv(pm->mmiPtMaxX, dpi, old);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
@ -5392,9 +5382,9 @@ int ResizeDlg_CalcDeltaY2(HWND hwnd, int dy, int cy, int nCtlId1, int nCtlId2)
|
||||
}
|
||||
const LPCRESIZEDLG pm = (LPCRESIZEDLG)GetProp(hwnd, RESIZEDLG_PROP_KEY);
|
||||
#if NP3_ENABLE_RESIZEDLG_TEMP_FIX
|
||||
DPI_T const dpi = Scintilla_GetWindowDPI(hwnd);
|
||||
int const hMinX = MulDiv(pm->attrs[0], dpi.x, pm->dpi.x);
|
||||
int const hMinY = MulDiv(pm->attrs[1], dpi.y, pm->dpi.y);
|
||||
UINT const dpi = Scintilla_GetWindowDPI(hwnd);
|
||||
int const hMinX = MulDiv(pm->attrs[0], dpi, pm->dpi);
|
||||
int const hMinY = MulDiv(pm->attrs[1], dpi, pm->dpi);
|
||||
#else
|
||||
int const hMinX = pm->attrs[0];
|
||||
int const hMinY = pm->attrs[1];
|
||||
@ -5701,12 +5691,11 @@ int Toolbar_SetButtons(HANDLE hwnd, int cmdBase, LPCWSTR lpszButtons, LPCTBBUTTO
|
||||
// GetCurrentPPI()
|
||||
// (font size) points per inch
|
||||
//
|
||||
DPI_T GetCurrentPPI(HWND hwnd)
|
||||
{
|
||||
UINT GetCurrentPPI(HWND hwnd) {
|
||||
HDC const hDC = GetDC(hwnd);
|
||||
DPI_T ppi = { 0, 0 };
|
||||
ppi.x = max_u(GetDeviceCaps(hDC, LOGPIXELSX), USER_DEFAULT_SCREEN_DPI);
|
||||
ppi.y = max_u(GetDeviceCaps(hDC, LOGPIXELSY), USER_DEFAULT_SCREEN_DPI);
|
||||
UINT ppi = 0;
|
||||
//ppi.x = max_u(GetDeviceCaps(hDC, LOGPIXELSX), USER_DEFAULT_SCREEN_DPI);
|
||||
ppi = max_u(GetDeviceCaps(hDC, LOGPIXELSY), USER_DEFAULT_SCREEN_DPI);
|
||||
ReleaseDC(hwnd, hDC);
|
||||
return ppi;
|
||||
}
|
||||
@ -5761,7 +5750,7 @@ bool GetThemedDialogFont(LPWSTR lpFaceName, WORD* wSize)
|
||||
|
||||
if (!bSucceed) {
|
||||
if (IsAppThemed()) {
|
||||
unsigned const iLogPixelsY = GetCurrentPPI(NULL).y - DIALOG_FONT_SIZE_INCR;
|
||||
unsigned const iLogPixelsY = GetCurrentPPI(NULL) - DIALOG_FONT_SIZE_INCR;
|
||||
|
||||
HTHEME hTheme = OpenThemeData(NULL, L"WINDOWSTYLE;WINDOW");
|
||||
if (hTheme) {
|
||||
@ -5782,7 +5771,7 @@ bool GetThemedDialogFont(LPWSTR lpFaceName, WORD* wSize)
|
||||
}
|
||||
|
||||
if (!bSucceed) {
|
||||
unsigned const iLogPixelsY = GetCurrentPPI(NULL).y - DIALOG_FONT_SIZE_INCR;
|
||||
unsigned const iLogPixelsY = GetCurrentPPI(NULL) - DIALOG_FONT_SIZE_INCR;
|
||||
|
||||
NONCLIENTMETRICS ncm = { 0 };
|
||||
ncm.cbSize = sizeof(NONCLIENTMETRICS) - sizeof(ncm.iPaddedBorderWidth);
|
||||
@ -6033,12 +6022,12 @@ HBITMAP ResampleIconToBitmap(HWND hwnd, HBITMAP hOldBmp, const HICON hIcon, cons
|
||||
//
|
||||
void SetUACIcon(HWND hwnd, const HMENU hMenu, const UINT nItem)
|
||||
{
|
||||
static DPI_T dpi = { 0, 0 };
|
||||
static UINT dpi = USER_DEFAULT_SCREEN_DPI;
|
||||
static MENUITEMINFO mii = { 0 };
|
||||
|
||||
DPI_T const cur_dpi = Scintilla_GetWindowDPI(hwnd);
|
||||
UINT const cur_dpi = Scintilla_GetWindowDPI(hwnd);
|
||||
|
||||
if ((dpi.x != cur_dpi.x) || (dpi.y != cur_dpi.y)) {
|
||||
if (dpi != cur_dpi) {
|
||||
dpi = cur_dpi;
|
||||
int const scx = Scintilla_GetSystemMetricsForDpi(SM_CXSMICON, dpi);
|
||||
int const scy = Scintilla_GetSystemMetricsForDpi(SM_CYSMICON, dpi);
|
||||
@ -6064,35 +6053,24 @@ void SetUACIcon(HWND hwnd, const HMENU hMenu, const UINT nItem)
|
||||
//
|
||||
// UpdateWindowLayoutForDPI()
|
||||
//
|
||||
inline WRCT_T _ConvWinRectW(const RECT* pRC)
|
||||
{
|
||||
WRCT_T wrc;
|
||||
wrc.left = pRC->left;
|
||||
wrc.top = pRC->top;
|
||||
wrc.right = pRC->right;
|
||||
wrc.bottom = pRC->bottom;
|
||||
return wrc;
|
||||
}
|
||||
void UpdateWindowLayoutForDPI(HWND hwnd, const RECT *pNewRect, const UINT adpi) {
|
||||
|
||||
void UpdateWindowLayoutForDPI(HWND hwnd, const RECT* prc, const DPI_T* pdpi)
|
||||
{
|
||||
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);
|
||||
return;
|
||||
if (pNewRect) {
|
||||
SetWindowPos(hwnd, NULL, pNewRect->left, pNewRect->top,
|
||||
(pNewRect->right - pNewRect->left), (pNewRect->bottom - pNewRect->top), uWndFlags);
|
||||
} else {
|
||||
RECT rc = { 0 };
|
||||
GetWindowRect(hwnd, &rc);
|
||||
//~MapWindowPoints(NULL, hWnd, (LPPOINT)&rc, 2);
|
||||
UINT const dpi = adpi ? adpi : Scintilla_GetWindowDPI(hwnd);
|
||||
Scintilla_AdjustWindowRectForDpi((LPWRECT)&rc, uWndFlags, 0, dpi);
|
||||
SetWindowPos(hwnd, NULL, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), uWndFlags);
|
||||
}
|
||||
|
||||
DPI_T const dpi = pdpi ? *pdpi : Scintilla_GetWindowDPI(hwnd);
|
||||
|
||||
RECT rc;
|
||||
GetWindowRect(hwnd, &rc);
|
||||
//~MapWindowPoints(NULL, hWnd, (LPPOINT)&rc, 2);
|
||||
WRCT_T wrc = _ConvWinRectW(prc);
|
||||
Scintilla_AdjustWindowRectForDpi(&wrc, uWndFlags, 0, dpi);
|
||||
SetWindowPos(hwnd, NULL, wrc.left, wrc.top, (wrc.right - wrc.left), (wrc.bottom - wrc.top), uWndFlags);
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// ResampleImageBitmap() (resample_delete_orig)
|
||||
@ -6104,9 +6082,9 @@ HBITMAP ResampleImageBitmap(HWND hwnd, HBITMAP hbmp, int width, int height)
|
||||
BITMAP bmp = { 0 };
|
||||
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);
|
||||
UINT const dpi = Scintilla_GetWindowDPI(hwnd);
|
||||
width = ScaleIntByDPI(bmp.bmWidth, dpi);
|
||||
height = ScaleIntByDPI(bmp.bmHeight, dpi);
|
||||
}
|
||||
if (((LONG)width != bmp.bmWidth) || ((LONG)height != bmp.bmHeight)) {
|
||||
#if TRUE
|
||||
@ -6153,8 +6131,8 @@ HFONT CreateAndSetFontDlgItemDPI(HWND hdlg, const int idDlgItem, int fontSize, b
|
||||
ncm.cbSize = sizeof(NONCLIENTMETRICSW);
|
||||
if (SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSW), &ncm, 0)) {
|
||||
HDC const hdcSys = GetDC(NULL);
|
||||
DPI_T const dpiSys = Scintilla_GetWindowDPI(NULL);
|
||||
DPI_T const dpiDlg = Scintilla_GetWindowDPI(hdlg);
|
||||
UINT const dpiSys = Scintilla_GetWindowDPI(NULL);
|
||||
UINT const dpiDlg = Scintilla_GetWindowDPI(hdlg);
|
||||
if (fontSize <= 0) {
|
||||
fontSize = (ncm.lfMessageFont.lfHeight < 0) ? -ncm.lfMessageFont.lfHeight : ncm.lfMessageFont.lfHeight;
|
||||
if (fontSize == 0) {
|
||||
@ -6163,7 +6141,7 @@ HFONT CreateAndSetFontDlgItemDPI(HWND hdlg, const int idDlgItem, int fontSize, b
|
||||
}
|
||||
fontSize <<= 10; // precision
|
||||
fontSize = MulDiv(fontSize, USER_DEFAULT_SCREEN_DPI, dpiSys.y); // correction
|
||||
fontSize = ScaleIntByDPI(fontSize, dpiDlg.y);
|
||||
fontSize = ScaleIntByDPI(fontSize, dpiDlg);
|
||||
ncm.lfMessageFont.lfHeight = -(MulDiv(fontSize, GetDeviceCaps(hdcSys, LOGPIXELSY), 72) >> 10);
|
||||
ncm.lfMessageFont.lfWeight = bold ? FW_BOLD : FW_NORMAL;
|
||||
HFONT const hFont = CreateFontIndirectW(&ncm.lfMessageFont);
|
||||
|
||||
@ -181,36 +181,26 @@ inline int GetDlgCtrlHeight(HWND hwndDlg, int nCtrlId)
|
||||
return (rc.bottom - rc.top);
|
||||
}
|
||||
|
||||
DPI_T GetCurrentPPI(HWND hwnd);
|
||||
UINT GetCurrentPPI(HWND hwnd);
|
||||
|
||||
inline int ScaleIntByDPI(int val, unsigned dpi)
|
||||
{
|
||||
return MulDiv(val, dpi, USER_DEFAULT_SCREEN_DPI);
|
||||
}
|
||||
inline int ScaleIntToDPI_X(HWND hwnd, int val)
|
||||
inline int ScaleIntToDPI(HWND hwnd, int val)
|
||||
{
|
||||
DPI_T const dpi = Scintilla_GetWindowDPI(hwnd);
|
||||
return ScaleIntByDPI(val, dpi.x);
|
||||
}
|
||||
inline int ScaleIntToDPI_Y(HWND hwnd, int val)
|
||||
{
|
||||
DPI_T const dpi = Scintilla_GetWindowDPI(hwnd);
|
||||
return ScaleIntByDPI(val, dpi.y);
|
||||
UINT const dpi = Scintilla_GetWindowDPI(hwnd);
|
||||
return ScaleIntByDPI(val, dpi);
|
||||
}
|
||||
|
||||
inline int ScaleFloatByDPI(float fVal, unsigned dpi)
|
||||
{
|
||||
return (int)lroundf((fVal * dpi) / (float)USER_DEFAULT_SCREEN_DPI);
|
||||
}
|
||||
inline int ScaleFloatToDPI_X(HWND hwnd, float fVal)
|
||||
inline int ScaleFloatToDPI(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);
|
||||
UINT const dpi = Scintilla_GetWindowDPI(hwnd);
|
||||
return ScaleFloatByDPI(fVal, dpi);
|
||||
}
|
||||
|
||||
inline unsigned LargeIconDPI()
|
||||
@ -223,9 +213,9 @@ inline unsigned LargeIconDPI()
|
||||
HBITMAP ConvertIconToBitmap(const HICON hIcon, const int cx, const int cy);
|
||||
HBITMAP ResampleIconToBitmap(HWND hwnd, HBITMAP hOldBmp, 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); }
|
||||
void UpdateWindowLayoutForDPI(HWND hwnd, const RECT *pRC, const UINT dpi);
|
||||
//#define HandleDpiChangedMessage(hW,wP,lP) { UINT dpi; dpi = LOWORD(wP); /*dpi = HIWORD(wP);*/ \
|
||||
// UpdateWindowLayoutForDPI(hW, (RECT*)lP, dpi); }
|
||||
|
||||
# define BMP_RESAMPLE_FILTER STOCK_FILTER_LANCZOS8
|
||||
//#define BMP_RESAMPLE_FILTER STOCK_FILTER_QUADRATICBSPLINE
|
||||
|
||||
29
src/Edit.c
29
src/Edit.c
@ -6049,10 +6049,8 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
|
||||
|
||||
|
||||
case WM_DPICHANGED: {
|
||||
DPI_T dpi = { 0, 0 };
|
||||
dpi.x = LOWORD(wParam);
|
||||
dpi.y = HIWORD(wParam);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, &dpi);
|
||||
UINT const dpi = LOWORD(wParam);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT *)lParam, dpi);
|
||||
}
|
||||
return TRUE; // further processing
|
||||
|
||||
@ -8018,10 +8016,8 @@ static INT_PTR CALLBACK EditLinenumDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPA
|
||||
|
||||
|
||||
case WM_DPICHANGED: {
|
||||
DPI_T dpi = { 0, 0 };
|
||||
dpi.x = LOWORD(wParam);
|
||||
dpi.y = HIWORD(wParam);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, &dpi);
|
||||
UINT const dpi = LOWORD(wParam);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT *)lParam, dpi);
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -8200,10 +8196,7 @@ static INT_PTR CALLBACK EditModifyLinesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam
|
||||
return true;
|
||||
|
||||
case WM_DPICHANGED: {
|
||||
DPI_T dpi = { 0, 0 };
|
||||
dpi.x = LOWORD(wParam);
|
||||
dpi.y = HIWORD(wParam);
|
||||
|
||||
//UINT const dpi = LOWORD(wParam);
|
||||
HFONT const hFont = (HFONT)SendDlgItemMessage(hwnd, 200, WM_GETFONT, 0, 0);
|
||||
if (hFont) {
|
||||
LOGFONT lf = { 0 };
|
||||
@ -8215,8 +8208,8 @@ static INT_PTR CALLBACK EditModifyLinesDlgProc(HWND hwnd,UINT umsg,WPARAM wParam
|
||||
}
|
||||
hFontHover = CreateFontIndirectW(&lf);
|
||||
}
|
||||
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, &dpi);
|
||||
//@@@UpdateWindowLayoutForDPI(hwnd, NULL, dpi);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, 0);
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
@ -8429,7 +8422,7 @@ static INT_PTR CALLBACK EditAlignDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
|
||||
return true;
|
||||
|
||||
case WM_DPICHANGED:
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, NULL);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, 0);
|
||||
return true;
|
||||
|
||||
#ifdef D_NP3_WIN10_DARK_MODE
|
||||
@ -8550,7 +8543,7 @@ static INT_PTR CALLBACK EditEncloseSelectionDlgProc(HWND hwnd,UINT umsg,WPARAM w
|
||||
return TRUE;
|
||||
|
||||
case WM_DPICHANGED:
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, NULL);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, 0);
|
||||
return TRUE;
|
||||
|
||||
#ifdef D_NP3_WIN10_DARK_MODE
|
||||
@ -8678,7 +8671,7 @@ static INT_PTR CALLBACK EditInsertTagDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,L
|
||||
return false;
|
||||
|
||||
case WM_DPICHANGED:
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, NULL);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, 0);
|
||||
return true;
|
||||
|
||||
#ifdef D_NP3_WIN10_DARK_MODE
|
||||
@ -8901,7 +8894,7 @@ static INT_PTR CALLBACK EditSortDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM
|
||||
return true;
|
||||
|
||||
case WM_DPICHANGED:
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, NULL);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, 0);
|
||||
return true;
|
||||
|
||||
#ifdef D_NP3_WIN10_DARK_MODE
|
||||
|
||||
@ -867,7 +867,7 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
|
||||
|
||||
//SetProcessDPIAware(); -> .manifest
|
||||
//SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE);
|
||||
Scintilla_LoadDpiForWindow();
|
||||
//~Scintilla_LoadDpiForWindow(); done in Sci::Platform_Initialize();
|
||||
|
||||
// ----------------------------------------------------
|
||||
// MultiLingual
|
||||
@ -2416,16 +2416,14 @@ static HIMAGELIST CreateScaledImageListFromBitmap(HWND hWnd, HBITMAP hBmp)
|
||||
HIMAGELIST himl = ImageList_Create(cx, cy, ILC_COLOR32 | ILC_MASK, NUMTOOLBITMAPS, NUMTOOLBITMAPS);
|
||||
ImageList_AddMasked(himl, hBmp, CLR_DEFAULT);
|
||||
|
||||
DPI_T dpi = Scintilla_GetWindowDPI(hWnd);
|
||||
if (!Settings.DpiScaleToolBar ||
|
||||
((dpi.x == USER_DEFAULT_SCREEN_DPI) && (dpi.y == USER_DEFAULT_SCREEN_DPI))) {
|
||||
UINT const dpi = Scintilla_GetWindowDPI(hWnd);
|
||||
if (!Settings.DpiScaleToolBar || (dpi == USER_DEFAULT_SCREEN_DPI)) {
|
||||
return himl; // default DPI, we are done
|
||||
}
|
||||
|
||||
|
||||
// Scale button icons/images
|
||||
int const scx = ScaleIntToDPI_X(hWnd, cx);
|
||||
int const scy = ScaleIntToDPI_Y(hWnd, cy);
|
||||
int const scx = ScaleIntToDPI(hWnd, cx);
|
||||
int const scy = ScaleIntToDPI(hWnd, cy);
|
||||
|
||||
HIMAGELIST hsciml = ImageList_Create(scx, scy, ILC_COLOR32 | ILC_MASK | ILC_HIGHQUALITYSCALE, NUMTOOLBITMAPS, NUMTOOLBITMAPS);
|
||||
|
||||
@ -2461,8 +2459,8 @@ void CreateBars(HWND hwnd, HINSTANCE hInstance)
|
||||
DWORD dwToolbarExStyle = TBSTYLE_EX_DOUBLEBUFFER /* | TBSTYLE_EX_HIDECLIPPEDBUTTONS */;
|
||||
|
||||
if (Settings.ToolBarTheme < 0) { // undefined: determine High DPI screen
|
||||
DPI_T const dpi = Scintilla_GetWindowDPI(hwnd);
|
||||
Settings.ToolBarTheme = (dpi.y < LargeIconDPI()) ? 0 : 1;
|
||||
UINT const dpi = Scintilla_GetWindowDPI(hwnd);
|
||||
Settings.ToolBarTheme = (dpi < LargeIconDPI()) ? 0 : 1;
|
||||
}
|
||||
|
||||
if (Globals.hwndToolbar) {
|
||||
@ -2794,15 +2792,13 @@ LRESULT MsgEndSession(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
|
||||
//
|
||||
LRESULT MsgDPIChanged(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
//DPI_T dpi;
|
||||
//dpi.x = LOWORD(wParam);
|
||||
//dpi.y = HIWORD(wParam);
|
||||
//UINT const dpi = LOWORD(wParam);
|
||||
UNREFERENCED_PARAMETER(wParam);
|
||||
//const RECT* const rc = (RECT*)lParam;
|
||||
|
||||
DocPos const pos = SciCall_GetCurrentPos();
|
||||
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, NULL);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, 0);
|
||||
|
||||
SendMessage(Globals.hwndEdit, WM_DPICHANGED, wParam, lParam);
|
||||
|
||||
|
||||
@ -93,7 +93,7 @@ static UINT_PTR CALLBACK _LPPrintHookProc(HWND hwnd, UINT uiMsg, WPARAM wParam,
|
||||
break;
|
||||
|
||||
case WM_DPICHANGED:
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT *)lParam, NULL);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, 0);
|
||||
break;
|
||||
|
||||
#ifdef D_NP3_WIN10_DARK_MODE
|
||||
@ -609,7 +609,7 @@ static UINT_PTR CALLBACK _LPSetupHookProc(HWND hwnd, UINT uiMsg, WPARAM wParam,
|
||||
break;
|
||||
|
||||
case WM_DPICHANGED:
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT *)lParam, NULL);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT *)lParam, 0);
|
||||
break;
|
||||
|
||||
#ifdef D_NP3_WIN10_DARK_MODE
|
||||
|
||||
@ -461,7 +461,6 @@ DeclareSciCallV1(SetVScrollbar, SETVSCROLLBAR, bool, visible);
|
||||
// Style definition
|
||||
//
|
||||
DeclareSciCallR0(GetLexer, GETLEXER, int);
|
||||
DeclareSciCallV1(SetLexer, SETLEXER, int, lexerid); // deprecated
|
||||
DeclareSciCallV01(SetILexer, SETILEXER, void*, lexerPtr); // ILexer5*
|
||||
|
||||
DeclareSciCallV1(SetIdleStyling, SETIDLESTYLING, int, idlestyle);
|
||||
|
||||
48
src/Styles.c
48
src/Styles.c
@ -42,7 +42,7 @@
|
||||
extern COLORREF g_colorCustom[16];
|
||||
|
||||
// removed from project, not MUI language compatible with ChooseFont()
|
||||
//~bool ChooseFontDirectWrite(HWND hwnd, const WCHAR* localeName, DPI_T dpi, LPCHOOSEFONT lpCF);
|
||||
//~bool ChooseFontDirectWrite(HWND hwnd, const WCHAR* localeName, UINT dpi, LPCHOOSEFONT lpCF);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@ -1095,15 +1095,13 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
|
||||
SciCall_SetILexer(CreateLexer(pLexNew->lexerName));
|
||||
|
||||
int const iNewLexer = SciCall_GetLexer();
|
||||
if ((pLexNew->lexerID > SCLEX_NULL) && (iNewLexer != pLexNew->lexerID)) {
|
||||
#ifdef _DEBUG
|
||||
if ((pLexNew->lexerID > SCLEX_NULL) && (iNewLexer != pLexNew->lexerID)) {
|
||||
WCHAR msg[256] = { L'\0' };
|
||||
StringCchPrintf(msg, COUNTOF(msg), L"Failed to set desired Lexer (#%i), got Lexer #%i!", pLexNew->lexerID, iNewLexer);
|
||||
DbgMsgBoxLastError(msg, ERROR_DLL_INIT_FAILED);
|
||||
#endif
|
||||
// try to use old method
|
||||
SciCall_SetLexer(pLexNew->lexerID); // mixing lexers might cause problems
|
||||
}
|
||||
#endif
|
||||
|
||||
// Lexer very specific styles
|
||||
Style_SetLexerSpecificProperties(pLexNew->lexerID);
|
||||
@ -1800,7 +1798,7 @@ void Style_HighlightCurrentLine(HWND hwnd, int iHiLitCurLn)
|
||||
if (!Style_StrGetSizeInt(szValue, &iFrameSize)) {
|
||||
iFrameSize = 2;
|
||||
}
|
||||
iFrameSize = max_i(1, ScaleIntToDPI_Y(hwnd, iFrameSize));
|
||||
iFrameSize = max_i(1, ScaleIntToDPI(hwnd, iFrameSize));
|
||||
SciCall_SetCaretLineFrame(iFrameSize);
|
||||
}
|
||||
|
||||
@ -1822,7 +1820,7 @@ static int _GetMarkerMarginWidth(HWND hwnd)
|
||||
Style_StrGetSize(GetCurrentStdLexer()->Styles[STY_MARGIN].szValue, &fSize); // relative to LineNumber
|
||||
Style_StrGetSize(GetCurrentStdLexer()->Styles[STY_BOOK_MARK].szValue, &fSize); // settings
|
||||
float const zoomPercent = (float)SciCall_GetZoom();
|
||||
return ScaleFloatToDPI_X(hwnd, (fSize * zoomPercent) / 100.0f);
|
||||
return ScaleFloatToDPI(hwnd, (fSize * zoomPercent) / 100.0f);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -3495,7 +3493,7 @@ bool Style_SelectFont(HWND hwnd,LPWSTR lpszStyle,int cchStyle, LPCWSTR sLexerNam
|
||||
}
|
||||
#else
|
||||
if (Settings.RenderingTechnology > 0) {
|
||||
DPI_T const dpi = Scintilla_GetWindowDPI(hwnd);
|
||||
UINT const dpi = Scintilla_GetWindowDPI(hwnd);
|
||||
const WCHAR* const localName = Settings2.PreferredLanguageLocaleName;
|
||||
if (!ChooseFontDirectWrite(Globals.hwndMain, localName, dpi, &cf) || StrIsEmpty(lf.lfFaceName)) {
|
||||
return false;
|
||||
@ -4147,7 +4145,7 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
|
||||
SetWindowTheme(GetDlgItem(hwnd, IDC_INFO_GROUPBOX), L"", L"");
|
||||
}
|
||||
#endif
|
||||
DPI_T const dpi = Scintilla_GetWindowDPI(hwnd);
|
||||
UINT const dpi = Scintilla_GetWindowDPI(hwnd);
|
||||
|
||||
GetLngString(IDS_MUI_STYLEEDIT_HELP, tchTmpBuffer, COUNTOF(tchTmpBuffer));
|
||||
SetDlgItemText(hwnd, IDC_STYLEEDIT_HELP, tchTmpBuffer);
|
||||
@ -4174,7 +4172,7 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
|
||||
|
||||
TreeView_SetExtendedStyle(hwndTV, TVS_EX_DOUBLEBUFFER, TVS_EX_DOUBLEBUFFER);
|
||||
|
||||
UINT const flagIconSize = (dpi.y >= LargeIconDPI()) ? SHGFI_LARGEICON : SHGFI_SMALLICON;
|
||||
UINT const flagIconSize = (dpi >= LargeIconDPI()) ? SHGFI_LARGEICON : SHGFI_SMALLICON;
|
||||
TreeView_SetImageList(hwndTV,
|
||||
(HIMAGELIST)SHGetFileInfoW(L"C:\\", FILE_ATTRIBUTE_DIRECTORY, &shfi, sizeof(SHFILEINFO),
|
||||
flagIconSize | SHGFI_SYSICONINDEX | SHGFI_USEFILEATTRIBUTES),
|
||||
@ -4252,12 +4250,10 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
|
||||
return TRUE;
|
||||
|
||||
case WM_DPICHANGED: {
|
||||
DPI_T dpi = { 0, 0 };
|
||||
dpi.x = LOWORD(wParam);
|
||||
dpi.y = HIWORD(wParam);
|
||||
UINT const dpi = LOWORD(wParam);
|
||||
|
||||
SHFILEINFO shfi = { 0 };
|
||||
UINT const flagIconSize = (dpi.y >= LargeIconDPI()) ? SHGFI_LARGEICON : SHGFI_SMALLICON;
|
||||
UINT const flagIconSize = (dpi >= LargeIconDPI()) ? SHGFI_LARGEICON : SHGFI_SMALLICON;
|
||||
TreeView_SetImageList(hwndTV,
|
||||
(HIMAGELIST)SHGetFileInfoW(L"C:\\", FILE_ATTRIBUTE_DIRECTORY, &shfi, sizeof(SHFILEINFO),
|
||||
flagIconSize | SHGFI_SYSICONINDEX | SHGFI_USEFILEATTRIBUTES),
|
||||
@ -4282,7 +4278,7 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
|
||||
MakeBitmapButton(hwnd, IDC_PREVSTYLE, IDB_PREV, -1, -1);
|
||||
MakeBitmapButton(hwnd, IDC_NEXTSTYLE, IDB_NEXT, -1, -1);
|
||||
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, NULL);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, 0);
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
@ -4292,16 +4288,15 @@ INT_PTR CALLBACK Style_CustomizeSchemesDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
|
||||
if (hdc) {
|
||||
BeginPaint(hwnd, &ps);
|
||||
|
||||
DPI_T const dpi = Scintilla_GetWindowDPI(hwnd);
|
||||
UINT const dpi = Scintilla_GetWindowDPI(hwnd);
|
||||
|
||||
int const iconSize = 64;
|
||||
int const dpiWidth = ScaleIntByDPI(iconSize, dpi.x);
|
||||
int const dpiHeight = ScaleIntByDPI(iconSize, dpi.y);
|
||||
HICON const hicon = (dpiHeight > 128) ? Globals.hDlgIconPrefs256 : ((dpiHeight > 64) ? Globals.hDlgIconPrefs128 : Globals.hDlgIconPrefs64);
|
||||
int const dpiSize = ScaleIntByDPI(iconSize, dpi);
|
||||
HICON const hicon = (dpiSize > 128) ? Globals.hDlgIconPrefs256 : ((dpiSize > 64) ? Globals.hDlgIconPrefs128 : Globals.hDlgIconPrefs64);
|
||||
if (hicon) {
|
||||
RECT rc = {0};
|
||||
MapWindowPoints(GetDlgItem(hwnd, IDC_INFO_GROUPBOX), hwnd, (LPPOINT)&rc, 2);
|
||||
DrawIconEx(hdc, rc.left + ScaleIntByDPI(10, dpi.x), rc.top + ScaleIntByDPI(20, dpi.y), hicon, dpiWidth, dpiHeight, 0, NULL, DI_NORMAL);
|
||||
DrawIconEx(hdc, rc.left + ScaleIntByDPI(10, dpi), rc.top + ScaleIntByDPI(20, dpi), hicon, dpiSize, dpiSize, 0, NULL, DI_NORMAL);
|
||||
}
|
||||
|
||||
ReleaseDC(hwnd, hdc);
|
||||
@ -4861,7 +4856,7 @@ INT_PTR CALLBACK Style_SelectLexerDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPAR
|
||||
}
|
||||
#endif
|
||||
|
||||
DPI_T const dpi = Scintilla_GetWindowDPI(hwnd);
|
||||
UINT const dpi = Scintilla_GetWindowDPI(hwnd);
|
||||
|
||||
hwndLV = GetDlgItem(hwnd,IDC_STYLELIST);
|
||||
InitWindowCommon(hwndLV, true);
|
||||
@ -4869,7 +4864,7 @@ INT_PTR CALLBACK Style_SelectLexerDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPAR
|
||||
|
||||
SHFILEINFO shfi = { 0 };
|
||||
|
||||
UINT const flagIconSize = (dpi.y >= LargeIconDPI()) ? SHGFI_LARGEICON : SHGFI_SMALLICON;
|
||||
UINT const flagIconSize = (dpi >= LargeIconDPI()) ? SHGFI_LARGEICON : SHGFI_SMALLICON;
|
||||
ListView_SetImageList(hwndLV,
|
||||
(HIMAGELIST)SHGetFileInfo(L"C:\\",FILE_ATTRIBUTE_DIRECTORY,
|
||||
&shfi, sizeof(SHFILEINFO), flagIconSize | SHGFI_SYSICONINDEX | SHGFI_USEFILEATTRIBUTES),
|
||||
@ -4915,14 +4910,11 @@ INT_PTR CALLBACK Style_SelectLexerDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPAR
|
||||
|
||||
|
||||
case WM_DPICHANGED: {
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, NULL);
|
||||
|
||||
DPI_T dpi = { 0, 0 };
|
||||
dpi.x = LOWORD(wParam);
|
||||
dpi.y = HIWORD(wParam);
|
||||
UpdateWindowLayoutForDPI(hwnd, (RECT*)lParam, 0);
|
||||
|
||||
UINT const dpi = LOWORD(wParam);
|
||||
SHFILEINFO shfi = { 0 };
|
||||
UINT const flagIconSize = (dpi.y >= LargeIconDPI()) ? SHGFI_LARGEICON : SHGFI_SMALLICON;
|
||||
UINT const flagIconSize = (dpi >= LargeIconDPI()) ? SHGFI_LARGEICON : SHGFI_SMALLICON;
|
||||
ListView_SetImageList(hwndLV,
|
||||
(HIMAGELIST)SHGetFileInfo(L"C:\\", FILE_ATTRIBUTE_DIRECTORY,
|
||||
&shfi, sizeof(SHFILEINFO), flagIconSize | SHGFI_SYSICONINDEX | SHGFI_USEFILEATTRIBUTES),
|
||||
|
||||
@ -153,11 +153,11 @@ INT_PTR CALLBACK SetKeysDlgProc(HWND hDlg, UINT umsg, WPARAM wParam, LPARAM lPar
|
||||
// Don't use: SetFocus( GetDlgItem( hDlg, IDC_PWD_EDIT1 ) );
|
||||
SetDialogFocus(hDlg, GetDlgItem(hDlg, IDC_PWD_EDIT1));
|
||||
}
|
||||
return true;
|
||||
return TRUE;
|
||||
|
||||
case WM_DPICHANGED:
|
||||
UpdateWindowLayoutForDPI(hDlg, (RECT*)lParam, NULL);
|
||||
return !0;
|
||||
UpdateWindowLayoutForDPI(hDlg, (RECT*)lParam, 0);
|
||||
return TRUE;
|
||||
|
||||
//#define WM_CTLCOLORMSGBOX 0x0132
|
||||
//#define WM_CTLCOLOREDIT 0x0133
|
||||
@ -352,7 +352,7 @@ INT_PTR CALLBACK GetKeysDlgProc(HWND hDlg, UINT umsg, WPARAM wParam, LPARAM lPar
|
||||
return !0;
|
||||
|
||||
case WM_DPICHANGED:
|
||||
UpdateWindowLayoutForDPI(hDlg, (RECT*)lParam, NULL);
|
||||
UpdateWindowLayoutForDPI(hDlg, (RECT*)lParam, 0);
|
||||
return !0;
|
||||
|
||||
#ifdef D_NP3_WIN10_DARK_MODE
|
||||
|
||||
Loading…
Reference in New Issue
Block a user