mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-14 21:09:05 +08:00
Merge pull request #3031 from RaiKoHoff/Dev_Lexilla
Iinitial start screen resolution independent fixed base font size
This commit is contained in:
commit
06e06d8ba1
@ -1468,7 +1468,7 @@ void LoadSettings()
|
||||
//int const zoomScale = 100;
|
||||
int const baseZoom = 100;
|
||||
int const prtFontSize = 10;
|
||||
int const zoomScale = MulDiv(baseZoom, prtFontSize, Globals.InitialFontSize);
|
||||
int const zoomScale = MulDiv(baseZoom, prtFontSize, float2int(GLOBAL_INITIAL_FONTSIZE));
|
||||
Defaults.PrintZoom = (Globals.iCfgVersionRead < CFG_VER_0001) ? (zoomScale / 10) : zoomScale;
|
||||
int iPrintZoom = clampi(IniSectionGetInt(IniSecSettings, L"PrintZoom", Defaults.PrintZoom), 0, SC_MAX_ZOOM_LEVEL);
|
||||
if (Globals.iCfgVersionRead < CFG_VER_0001) {
|
||||
@ -1713,7 +1713,7 @@ void LoadSettings()
|
||||
|
||||
CloseSettingsFile(bDirtyFlag, true); // keep cached
|
||||
|
||||
Style_Init(); // Scintilla Styles
|
||||
Style_Load(); // Scintilla Styles from .ini
|
||||
|
||||
ResetIniFileCache(); // clear cache
|
||||
}
|
||||
|
||||
@ -650,7 +650,6 @@ static void _InitGlobals()
|
||||
Globals.bDocHasInconsistentEOLs = false;
|
||||
Globals.idxLightModeTheme = 1; // Default(0), Standard(1)
|
||||
Globals.idxDarkModeTheme = 1; // buildin Standard(1)
|
||||
Globals.InitialFontSize = (IsFullHD(NULL, -1, -1) < 0) ? 10 : 11;
|
||||
|
||||
Flags.bHugeFileLoadState = DefaultFlags.bHugeFileLoadState = false;
|
||||
Flags.bDevDebugMode = DefaultFlags.bDevDebugMode = false;
|
||||
|
||||
22
src/Styles.c
22
src/Styles.c
@ -406,7 +406,7 @@ bool Style_IsCurLexerStandard()
|
||||
//
|
||||
static float _SetBaseFontSize(float fSize)
|
||||
{
|
||||
static float fBaseFontSize = 11.0f;
|
||||
static float fBaseFontSize = GLOBAL_INITIAL_FONTSIZE;
|
||||
|
||||
if (fSize >= 0.0f) {
|
||||
fBaseFontSize = Round10th(fSize);
|
||||
@ -420,7 +420,7 @@ static float _SetBaseFontSize(float fSize)
|
||||
//
|
||||
float Style_GetBaseFontSize()
|
||||
{
|
||||
return _SetBaseFontSize(-1.0);
|
||||
return _SetBaseFontSize(-1.0); // neg. value indicate getter
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -429,7 +429,7 @@ float Style_GetBaseFontSize()
|
||||
//
|
||||
static float _SetCurrentFontSize(float fSize)
|
||||
{
|
||||
static float fCurrentFontSize = 11.0f;
|
||||
static float fCurrentFontSize = GLOBAL_INITIAL_FONTSIZE;
|
||||
|
||||
if (signbit(fSize) == 0) {
|
||||
float const fSizeR10th = Round10th(fSize);
|
||||
@ -440,7 +440,7 @@ static float _SetCurrentFontSize(float fSize)
|
||||
|
||||
float Style_GetCurrentFontSize()
|
||||
{
|
||||
return _SetCurrentFontSize(-1.0f);
|
||||
return _SetCurrentFontSize(-1.0f); // neg. value indicate getter
|
||||
}
|
||||
|
||||
|
||||
@ -461,12 +461,12 @@ int Style_RgbAlpha(int rgbFore, int rgbBack, int alpha)
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// Style_Init()
|
||||
// Style_Load()
|
||||
//
|
||||
void Style_Init()
|
||||
void Style_Load()
|
||||
{
|
||||
_SetBaseFontSize((float)Globals.InitialFontSize);
|
||||
_SetCurrentFontSize((float)Globals.InitialFontSize);
|
||||
_SetBaseFontSize(GLOBAL_INITIAL_FONTSIZE);
|
||||
_SetCurrentFontSize(GLOBAL_INITIAL_FONTSIZE);
|
||||
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
g_colorCustom[i] = s_colorDefault[i];
|
||||
@ -1136,8 +1136,8 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
|
||||
//~Style_SetACPfromCharSet(hwnd);
|
||||
|
||||
// --- apply/init default style ---
|
||||
_SetBaseFontSize((float)Globals.InitialFontSize);
|
||||
_SetCurrentFontSize((float)Globals.InitialFontSize);
|
||||
_SetBaseFontSize(GLOBAL_INITIAL_FONTSIZE);
|
||||
_SetCurrentFontSize(GLOBAL_INITIAL_FONTSIZE);
|
||||
|
||||
const WCHAR* const wchStandardStyleStrg = pCurrentStandard->Styles[STY_DEFAULT].szValue;
|
||||
|
||||
@ -3378,7 +3378,7 @@ bool Style_SelectFont(HWND hwnd,LPWSTR lpszStyle,int cchStyle, LPCWSTR sLexerNam
|
||||
// is "size:" definition relative ?
|
||||
bool const bRelFontSize = (!StrStr(lpszStyle, L"size:") || StrStr(lpszStyle, L"size:+") || StrStr(lpszStyle, L"size:-"));
|
||||
|
||||
float const fBaseFontSize = (bGlobalDefaultStyle ? (float)Globals.InitialFontSize :
|
||||
float const fBaseFontSize = (bGlobalDefaultStyle ? GLOBAL_INITIAL_FONTSIZE :
|
||||
(bCurrentDefaultStyle ? Style_GetBaseFontSize() : Style_GetCurrentFontSize()));
|
||||
|
||||
// Font Height
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
#define NUMLEXERS 53
|
||||
#define AVG_NUM_OF_STYLES_PER_LEXER 20
|
||||
|
||||
void Style_Init();
|
||||
void Style_Load();
|
||||
bool Style_Import(HWND hwnd);
|
||||
bool Style_ImportTheme(const unsigned iThemeIdx);
|
||||
void Style_LoadLexerFileExtensions();
|
||||
|
||||
@ -161,6 +161,9 @@ typedef enum
|
||||
#define MB_ICONSHIELD 0x000000B0L
|
||||
|
||||
#define COLORREF_MAX (DWORD_MAX)
|
||||
|
||||
#define GLOBAL_INITIAL_FONTSIZE 11.0f
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
typedef enum { CT_NONE = 0, CT_ZOOM, CT_ZEROLEN_MATCH, CT_ENC_INFO, CT_DWELL } CALLTIPTYPE;
|
||||
@ -365,7 +368,6 @@ typedef struct _globals_t
|
||||
CALLTIPTYPE CallTipType;
|
||||
FILEVARS fvCurFile;
|
||||
int iWrapCol;
|
||||
int InitialFontSize;
|
||||
|
||||
bool CmdLnFlag_PosParam;
|
||||
int CmdLnFlag_WindowPos;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user