From f80915b8a53d8dfbdc2734cb8a1afc5752e39c02 Mon Sep 17 00:00:00 2001 From: Rainer Kottenhoff Date: Fri, 27 Sep 2019 12:23:53 +0200 Subject: [PATCH] + chg: initial default big toolbar only for monitors > Full-HD + opt: LexerSQLNumberSignAsComment [Settings2] --- Build/Notepad3.ini | 1 + Versions/build.txt | 2 +- res/Notepad3.exe.manifest.conf | 2 +- src/Config/Config.cpp | 8 ++++++-- src/Helpers.h | 9 +++++---- src/Styles.c | 2 +- src/TypeDefs.h | 1 + src/VersionEx.h | 2 +- 8 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Build/Notepad3.ini b/Build/Notepad3.ini index 4b38d4d7f..4bbf08c5e 100644 --- a/Build/Notepad3.ini +++ b/Build/Notepad3.ini @@ -50,6 +50,7 @@ SettingsVersion=4 ;AdministrationTool.exe= ;DevDebugMode=0 ;AnalyzeReliableConfidenceLevel=50 +;LexerSQLNumberSignAsComment=1 [Statusbar Settings] ;VisibleSections=0 1 12 14 2 4 5 6 7 8 9 10 11 ;SectionPrefixes=Ln ,Col ,Sel ,Sb ,SLn ,Occ ,,,,,,,Ch ,Repl ,Eval , diff --git a/Versions/build.txt b/Versions/build.txt index 7a54e98f6..c84d894f7 100644 --- a/Versions/build.txt +++ b/Versions/build.txt @@ -1 +1 @@ -2654 +2655 diff --git a/res/Notepad3.exe.manifest.conf b/res/Notepad3.exe.manifest.conf index 793dceda2..a451897a1 100644 --- a/res/Notepad3.exe.manifest.conf +++ b/res/Notepad3.exe.manifest.conf @@ -3,7 +3,7 @@ Notepad3 BETA diff --git a/src/Config/Config.cpp b/src/Config/Config.cpp index 773ee7b2f..5e27fbab1 100644 --- a/src/Config/Config.cpp +++ b/src/Config/Config.cpp @@ -824,6 +824,10 @@ void LoadSettings() StringCchCopyW(Defaults2.WebTemplate2, COUNTOF(Defaults2.WebTemplate2), L"https://en.wikipedia.org/w/index.php?search=%s"); IniSectionGetString(Settings2_Section, L"WebTemplate2", Defaults2.WebTemplate2, Settings2.WebTemplate2, COUNTOF(Settings2.WebTemplate2)); + Defaults2.LexerSQLNumberSignAsComment = true; + Settings2.LexerSQLNumberSignAsComment = IniSectionGetBool(Settings2_Section, L"LexerSQLNumberSignAsComment", Defaults2.LexerSQLNumberSignAsComment); + + // -------------------------------------------------------------------------- const WCHAR* const Settings_Section = L"Settings"; // -------------------------------------------------------------------------- @@ -1072,8 +1076,8 @@ void LoadSettings() StringCchPrintf(tchHighDpiToolBar, COUNTOF(tchHighDpiToolBar), L"%ix%i HighDpiToolBar", ResX, ResY); s_iToolBarTheme = IniSectionGetInt(Window_Section, tchHighDpiToolBar, -1); s_iToolBarTheme = clampi(s_iToolBarTheme, -1, StrIsEmpty(s_tchToolbarBitmap) ? 1 : 2); - if (s_iToolBarTheme < 0) { // undefined: determine high DPI (higher than Full-HD) - s_iToolBarTheme = IsFullHDOrHigher(Globals.hwndMain, ResX, ResY) ? 1 : 0; + if (s_iToolBarTheme < 0) { // undefined: determine higher than Full-HD + s_iToolBarTheme = (IsFullHD(Globals.hwndMain, -1, -1) <= 0) ? 0 : 1; } // -------------------------------------------------------------- diff --git a/src/Helpers.h b/src/Helpers.h index f2c10c32e..d568ce5df 100644 --- a/src/Helpers.h +++ b/src/Helpers.h @@ -231,16 +231,17 @@ inline void GetCurrentMonitorResolution(HWND hwnd, int* pCXScreen, int* pCYScree *pCYScreen = (mi.rcMonitor.bottom - mi.rcMonitor.top); } -inline bool IsFullHDOrHigher(HWND hwnd, int resX, int resY) +// FullHD? => 0:'==', -1:'<', +1:'>' +inline int IsFullHD(HWND hwnd, int resX, int resY) { int cxScreen, cyScreen; GetCurrentMonitorResolution(hwnd, &cxScreen, &cyScreen); if (resX <= 0) { resX = cxScreen; } - if (resY <= 0) { resY = cxScreen; } - return ((resX >= 1920) && (resY >= 1080)); + if (resY <= 0) { resY = cyScreen; } + return ((resX == 1920) && (resY == 1080)) ? 0 : (((resX < 1920) || (resY < 1080)) ? -1 : +1); } -inline float GetBaseFontSize(HWND hwnd) { return (IsFullHDOrHigher(hwnd, -1, -1) ? 11.0f : 10.0f); } +inline float GetBaseFontSize(HWND hwnd) { return ((IsFullHD(hwnd, -1, -1) < 0) ? 10.0f : 11.0f); } // ---------------------------------------------------------------------------- diff --git a/src/Styles.c b/src/Styles.c index ad4a86566..d8d217641 100644 --- a/src/Styles.c +++ b/src/Styles.c @@ -891,7 +891,7 @@ void Style_SetLexerSpecificProperties(const int lexerId) case SCLEX_SQL: SciCall_SetProperty("sql.backslash.escapes", "1"); SciCall_SetProperty("lexer.sql.backticks.identifier", "1"); - SciCall_SetProperty("lexer.sql.numbersign.comment", "1"); + SciCall_SetProperty("lexer.sql.numbersign.comment", Settings2.LexerSQLNumberSignAsComment ? "1" : "0"); break; case SCLEX_NSIS: diff --git a/src/TypeDefs.h b/src/TypeDefs.h index 1182dd4a8..6e304b1b0 100644 --- a/src/TypeDefs.h +++ b/src/TypeDefs.h @@ -502,6 +502,7 @@ typedef struct _settings2_t int CurrentLineVerticalSlop; bool NoCopyLineOnEmptySelection; bool NoCutLineOnEmptySelection; + bool LexerSQLNumberSignAsComment; float AnalyzeReliableConfidenceLevel; //~float ReliableCEDConfidenceMapping; // = 0.85f; diff --git a/src/VersionEx.h b/src/VersionEx.h index cc2abe7f6..04fe4d693 100644 --- a/src/VersionEx.h +++ b/src/VersionEx.h @@ -8,7 +8,7 @@ #define VERSION_MAJOR 5 #define VERSION_MINOR 19 #define VERSION_REV 927 -#define VERSION_BUILD 2654 +#define VERSION_BUILD 2655 #define SCINTILLA_VER 420 #define ONIGURUMA_REGEX_VER 6.9.3 #define UCHARDET_VER 2018.09.27