From 74ec34dad3b0e4251c8a1f9acac2f072d45be9cf Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Sat, 5 Aug 2017 22:01:46 +0200 Subject: [PATCH] integrate Scintillas DirectWrite technology: - Settings: SciDirectWriteTech, SciFontQuality + values according to Scintilla documentation + values = -1 (or not set) - don't call SCI API anyway - should be the same as DEFAULT technology settings (values = 0) SC_TECHNOLOGY_DEFAULT = 0, SC_TECHNOLOGY_DIRECTWRITE = 1, SC_TECHNOLOGY_DIRECTWRITERETAIN = 2, SC_TECHNOLOGY_DIRECTWRITEDC = 3 SC_EFF_QUALITY_DEFAULT = 0, SC_EFF_QUALITY_NON_ANTIALIASED = 1, SC_EFF_QUALITY_ANTIALIASED = 2, SC_EFF_QUALITY_LCD_OPTIMIZED = 3 --- distrib/Notepad3.ini | Bin 942 -> 1022 bytes src/Notepad3.c | 32 ++++++++++++++++++++++++++++++++ src/SciCall.h | 16 ++++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/distrib/Notepad3.ini b/distrib/Notepad3.ini index db904acf420db17f40052599f8ee941613f9a557..41f9603bf5aef0f042c28004bdb492fa83a76d3c 100644 GIT binary patch delta 88 zcmZ3-{*QgbHb(DYhGd3J1{WYMVn_wDOBlj|tV|%C$`Aq;$zZT$Fl69m;9`KNbz{h9 a$OFm;GL$kTGUR~ORsz)+Z{EoGmk|Ja!xL=) delta 12 TcmeyzzK(svHpb0tOg|U_BU%L3 diff --git a/src/Notepad3.c b/src/Notepad3.c index 1f2bec603..88b08f603 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -170,6 +170,23 @@ BOOL bTransparentMode; BOOL bTransparentModeAvailable; BOOL bShowToolbar; BOOL bShowStatusbar; +int iSciDirectWriteTech; +int iSciFontQuality; + +const int DirectWriteTechnology[] = { + SC_TECHNOLOGY_DEFAULT + , SC_TECHNOLOGY_DIRECTWRITE + , SC_TECHNOLOGY_DIRECTWRITERETAIN + , SC_TECHNOLOGY_DIRECTWRITEDC +}; + +const int FontQuality[] = { + SC_EFF_QUALITY_DEFAULT + , SC_EFF_QUALITY_NON_ANTIALIASED + , SC_EFF_QUALITY_ANTIALIASED + , SC_EFF_QUALITY_LCD_OPTIMIZED +}; + typedef struct _wi { @@ -687,6 +704,13 @@ int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInst,LPSTR lpCmdLine,int n if (!(hwnd = InitInstance(hInstance,lpCmdLine,nCmdShow))) return FALSE; + + if (IsVista()) { + if (iSciDirectWriteTech >= 0) + SciCall_SetTechnology(DirectWriteTechnology[iSciDirectWriteTech]); + if (iSciFontQuality >= 0) + SciCall_SetFontQuality(FontQuality[iSciFontQuality]); + } hAccMain = LoadAccelerators(hInstance,MAKEINTRESOURCE(IDR_MAINWND)); hAccFindReplace = LoadAccelerators(hInstance,MAKEINTRESOURCE(IDR_ACCFINDREPLACE)); @@ -5807,6 +5831,12 @@ void LoadSettings() xFindReplaceDlg = IniSectionGetInt(pIniSection,L"FindReplaceDlgPosX",0); yFindReplaceDlg = IniSectionGetInt(pIniSection,L"FindReplaceDlgPosY",0); + iSciDirectWriteTech = IniSectionGetInt(pIniSection,L"SciDirectWriteTech",-1); + iSciDirectWriteTech = max(min(iSciDirectWriteTech,3),-1); + + iSciFontQuality = IniSectionGetInt(pIniSection,L"SciFontQuality",-1); + iSciFontQuality = max(min(iSciFontQuality,3),-1); + LoadIniSection(L"Settings2",pIniSection,cchIniSection); bStickyWinPos = IniSectionGetInt(pIniSection,L"StickyWindowPosition",0); @@ -5988,6 +6018,8 @@ void SaveSettings(BOOL bSaveSettingsNow) IniSectionSetInt(pIniSection,L"FavoritesDlgSizeY",cyFavoritesDlg); IniSectionSetInt(pIniSection,L"FindReplaceDlgPosX",xFindReplaceDlg); IniSectionSetInt(pIniSection,L"FindReplaceDlgPosY",yFindReplaceDlg); + IniSectionSetInt(pIniSection, L"SciDrawTechnology",iSciDirectWriteTech); + IniSectionSetInt(pIniSection, L"SciFontQuality",iSciFontQuality); SaveIniSection(L"Settings",pIniSection); LocalFree(pIniSection); diff --git a/src/SciCall.h b/src/SciCall.h index 8ba899686..d6244ebe2 100644 --- a/src/SciCall.h +++ b/src/SciCall.h @@ -148,3 +148,19 @@ DeclareSciCallV1(EnsureVisible, ENSUREVISIBLE, int, line); // // DeclareSciCallV2(SetProperty, SETPROPERTY, const char *, key, const char *, value); + + +//============================================================================= +// +// SetTechnology +// +// +DeclareSciCallV1(SetTechnology, SETTECHNOLOGY, int, technology); + + +//============================================================================= +// +// SetFontQuality +// +// +DeclareSciCallV1(SetFontQuality, SETFONTQUALITY, int, quality);