mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-11 21:03:05 +08:00
several minor fixes
This commit is contained in:
parent
afce69957e
commit
b7b30563c6
@ -1222,7 +1222,7 @@ void LoadSettings()
|
||||
|
||||
IniSectionGetStringNoQuotes(IniSecSettings2, L"DefaultDirectory", L"", pPathBuffer, PATHLONG_MAX_CCH);
|
||||
Path_Reset(Settings2.DefaultDirectory, pPathBuffer);
|
||||
Path_ExpandEnvironmentStrings(Settings2.DefaultDirectory);
|
||||
Path_ExpandEnvStrings(Settings2.DefaultDirectory);
|
||||
|
||||
IniSectionGetStringNoQuotes(IniSecSettings2, L"FileDlgFilters", L"", pPathBuffer, XHUGE_BUFFER);
|
||||
StrgReset(Settings2.FileDlgFilters, pPathBuffer);
|
||||
@ -1308,15 +1308,15 @@ void LoadSettings()
|
||||
|
||||
IniSectionGetStringNoQuotes(IniSecSettings2, L"filebrowser.exe", L"", pPathBuffer, PATHLONG_MAX_CCH);
|
||||
Path_Reset(Settings2.FileBrowserPath, pPathBuffer);
|
||||
Path_ExpandEnvironmentStrings(Settings2.FileBrowserPath);
|
||||
Path_ExpandEnvStrings(Settings2.FileBrowserPath);
|
||||
|
||||
IniSectionGetStringNoQuotes(IniSecSettings2, L"grepWin.exe", L"", pPathBuffer, PATHLONG_MAX_CCH);
|
||||
Path_Reset(Settings2.GrepWinPath, pPathBuffer);
|
||||
Path_ExpandEnvironmentStrings(Settings2.GrepWinPath);
|
||||
Path_ExpandEnvStrings(Settings2.GrepWinPath);
|
||||
|
||||
IniSectionGetStringNoQuotes(IniSecSettings2, L"AdministrationTool.exe", L"", pPathBuffer, PATHLONG_MAX_CCH);
|
||||
Path_Reset(Settings2.AdministrationTool, pPathBuffer);
|
||||
Path_ExpandEnvironmentStrings(Settings2.AdministrationTool);
|
||||
Path_ExpandEnvStrings(Settings2.AdministrationTool);
|
||||
|
||||
if (StrIsEmpty(Settings2.AppUserModelID)) { // set via CmdLine ?
|
||||
IniSectionGetString(IniSecSettings2, L"ShellAppUserModelID", _W("Rizonesoft." SAPPNAME), Settings2.AppUserModelID, COUNTOF(Settings2.AppUserModelID));
|
||||
|
||||
@ -1447,7 +1447,7 @@ CASE_WM_CTLCOLOR_SET:
|
||||
|
||||
bool bQuickExit = false;
|
||||
|
||||
Path_ExpandEnvironmentStrings(hfile_pth);
|
||||
Path_ExpandEnvStrings(hfile_pth);
|
||||
ExtractFirstArgument(file_buf, file_buf, args_buf, (int)Path_GetBufCount(hfile_pth));
|
||||
Path_Sanitize(hfile_pth);
|
||||
StrgSanitize(hargs_str);
|
||||
|
||||
@ -235,6 +235,14 @@ inline bool Char2Int(LPCWSTR str, int *value) {
|
||||
*value = (int)wcstol(str, &end, 10);
|
||||
return (str != end);
|
||||
}
|
||||
|
||||
inline bool Char2Float(LPCWSTR str, float* value)
|
||||
{
|
||||
LPWSTR end;
|
||||
*value = (float)wcstod(str, &end);
|
||||
return (str != end);
|
||||
}
|
||||
|
||||
bool StrToFloat(WCHAR *wnumber, float *fresult);
|
||||
void FloatToStr(float fValue, LPWSTR lpszStrg, int cchSize);
|
||||
|
||||
|
||||
@ -1267,6 +1267,11 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
|
||||
UndoRedoReset();
|
||||
SetSaveDone();
|
||||
|
||||
// drag-n-drop into elevated process even does not work using:
|
||||
///ChangeWindowMessageFilter(WM_DROPFILES, MSGFLT_ADD);
|
||||
///ChangeWindowMessageFilter(WM_COPYDATA, MSGFLT_ADD);
|
||||
///ChangeWindowMessageFilter(0x0049, MSGFLT_ADD);
|
||||
|
||||
MSG msg;
|
||||
while (GetMessage(&msg,NULL,0,0)) {
|
||||
|
||||
@ -9206,6 +9211,17 @@ void ParseCommandLine()
|
||||
StringCchCopy(s_lpOrigFileArg, fileArgLen + 1, lp3);
|
||||
|
||||
Path_Reset(s_pthArgFilePath, lp3);
|
||||
|
||||
//assert(false);
|
||||
//if (!Path_IsRelative(s_pthArgFilePath) && !Path_IsUNC(s_pthArgFilePath) && (Path_GetDriveNumber(s_pthArgFilePath) == -1))
|
||||
//{
|
||||
// HPATHL pthAdjustPath = Path_Copy(Paths.WorkingDirectory);
|
||||
// Path_StripToRoot(pthAdjustPath);
|
||||
// Path_Append(pthAdjustPath, Path_Get(s_pthArgFilePath));
|
||||
// Path_Reset(s_pthArgFilePath, Path_Get(pthAdjustPath));
|
||||
// Path_Release(pthAdjustPath);
|
||||
//}
|
||||
|
||||
Path_NormalizeEx(s_pthArgFilePath, Paths.WorkingDirectory, true, true);
|
||||
|
||||
HPATHL pthAddFile = Path_Allocate(NULL);
|
||||
|
||||
@ -1286,7 +1286,7 @@ bool PTHAPI Path_QuoteSpaces(HPATHL hpth_in_out, bool bForceQuotes)
|
||||
void PTHAPI Path_UnQuoteSpaces(HPATHL hpth_in_out)
|
||||
{
|
||||
HSTRINGW hstr_io = ToHStrgW(hpth_in_out);
|
||||
if (!hstr_io)
|
||||
if (!hstr_io || StrgIsEmpty(hstr_io))
|
||||
return;
|
||||
|
||||
StrgTrimLeft(hstr_io, L'"');
|
||||
@ -1299,19 +1299,38 @@ int PTHAPI Path_GetDriveNumber(const HPATHL hpth)
|
||||
{
|
||||
int res = -1;
|
||||
HSTRINGW hstr = ToHStrgW(hpth);
|
||||
if (!hstr)
|
||||
if (!hstr || StrgIsEmpty(hstr))
|
||||
return res;
|
||||
|
||||
LPWSTR const colon = wcschr(StrgGet(hstr), L':');
|
||||
|
||||
if (colon && (colon > StrgGet(hstr))) {
|
||||
res = max_i(-1, ((int)_wcsupr_s((colon - 1), 1) - (int)L'A'));
|
||||
res = (res > 25) ? -1 : res;
|
||||
LPCWSTR const lpszPath = StrgGet(hstr);
|
||||
LPCWSTR const colon = wcschr(lpszPath, L':');
|
||||
if (colon && ((colon - 1) == lpszPath)) {
|
||||
WCHAR buf[2] = { 0 };
|
||||
StringCchCopy(buf, COUNTOF(buf), lpszPath);
|
||||
if (_wcsupr_s(buf, COUNTOF(buf)) == 0) {
|
||||
res = (int)buf[0] - (int)L'A';
|
||||
res = (res > 25) ? -1 : res;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
bool PTHAPI Path_IsUNC(const HPATHL hpth)
|
||||
{
|
||||
HSTRINGW hstr = ToHStrgW(hpth);
|
||||
if (!hstr || StrgIsEmpty(hstr))
|
||||
return false;
|
||||
|
||||
WCHAR maxPath[MAX_PATH];
|
||||
StringCchCopy(maxPath, COUNTOF(maxPath), StrgGet(hstr));
|
||||
|
||||
return PathIsUNC(maxPath);
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
wchar_t PTHAPI Path_GetDriveLetterByNumber(const int number)
|
||||
{
|
||||
wchar_t const DriveLetter[27] = L"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
@ -1335,6 +1354,24 @@ bool PTHAPI Path_SetFileAttributes(HPATHL hpth, DWORD dwAttributes)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
bool PTHAPI Path_StripToRoot(HPATHL hpth_in_out)
|
||||
{
|
||||
HSTRINGW hstr_io = ToHStrgW(hpth_in_out);
|
||||
if (!hstr_io)
|
||||
return false;
|
||||
|
||||
WCHAR maxPath[MAX_PATH];
|
||||
StringCchCopy(maxPath, COUNTOF(maxPath), StrgGet(hstr_io));
|
||||
|
||||
if (PathStripToRoot(maxPath)) {
|
||||
Path_Reset(hpth_in_out, maxPath);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
bool PTHAPI Path_GetCurrentDirectory(HPATHL hpth_out)
|
||||
{
|
||||
static HPATHL wrk_path = NULL;
|
||||
@ -2080,8 +2117,10 @@ void PTHAPI ExpandEnvironmentStrgs(HSTRINGW hstr_in_out, bool bStripQ)
|
||||
StrgTrim(hstr_in_out, L'"');
|
||||
StrgTrim(hstr_in_out, L'\'');
|
||||
}
|
||||
|
||||
//StrgReplace(hstr_in_out, L"~", L"%USERPROFILE%");
|
||||
|
||||
size_t const min_len = ExpandEnvironmentStringsW(StrgGet(hstr_in_out), NULL, 0);
|
||||
size_t const min_len = ExpandEnvironmentStrings(StrgGet(hstr_in_out), NULL, 0);
|
||||
LPWSTR buf_io = StrgWriteAccessBuf(hstr_in_out, min_len);
|
||||
DWORD const cch_io = (DWORD)StrgGetAllocLength(hstr_in_out);
|
||||
|
||||
@ -2092,14 +2131,6 @@ void PTHAPI ExpandEnvironmentStrgs(HSTRINGW hstr_in_out, bool bStripQ)
|
||||
}
|
||||
StrgDestroy(hstr_cpy);
|
||||
}
|
||||
|
||||
void PTHAPI Path_ExpandEnvironmentStrings(HPATHL hpth_in_out)
|
||||
{
|
||||
HSTRINGW hstr_io = ToHStrgW(hpth_in_out);
|
||||
if (!hstr_io)
|
||||
return;
|
||||
ExpandEnvironmentStrgs(hstr_io, true);
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@ -115,9 +115,11 @@ LPCWSTR PTHAPI Path_FindExtension(const HPATHL hpth);
|
||||
bool PTHAPI Path_QuoteSpaces(HPATHL hpth_in_out, bool bForceQuotes);
|
||||
void PTHAPI Path_UnQuoteSpaces(HPATHL hpth_in_out);
|
||||
int PTHAPI Path_GetDriveNumber(const HPATHL hpth);
|
||||
bool PTHAPI Path_IsUNC(const HPATHL hpth);
|
||||
wchar_t PTHAPI Path_GetDriveLetterByNumber(const int number);
|
||||
DWORD PTHAPI Path_GetFileAttributes(const HPATHL hpth);
|
||||
bool PTHAPI Path_SetFileAttributes(HPATHL hpth, DWORD dwAttributes);
|
||||
bool PTHAPI Path_StripToRoot(HPATHL hpth_in_out);
|
||||
bool PTHAPI Path_GetCurrentDirectory(HPATHL hpth_out);
|
||||
size_t PTHAPI Path_ToShortPathName(HPATHL hpth_in_out); // use only, if neccessary
|
||||
size_t PTHAPI Path_GetLongPathNameEx(HPATHL hpth_in_out);
|
||||
@ -136,7 +138,6 @@ void PTHAPI Path_RelativeToApp(HPATHL hpth_in_out, bool bSrcIsFile, b
|
||||
bool PTHAPI Path_GetKnownFolder(REFKNOWNFOLDERID rfid, HPATHL hpth_out);
|
||||
|
||||
void PTHAPI ExpandEnvironmentStrgs(HSTRINGW hstr, bool bStripQ);
|
||||
void PTHAPI Path_ExpandEnvironmentStrings(HPATHL hpth_in_out);
|
||||
|
||||
|
||||
// ============================================================================
|
||||
|
||||
@ -622,6 +622,7 @@ DeclareSciCallV2(SetMarginBackN, SETMARGINBACKN, uintptr_t, margin, COLORREF, co
|
||||
DeclareSciCallV2(SetMarginCursorN, SETMARGINCURSORN, uintptr_t, margin, int, cursor);
|
||||
DeclareSciCallV2(SetFoldMarginColour, SETFOLDMARGINCOLOUR, bool, useSetting, COLORREF, colour);
|
||||
DeclareSciCallV2(SetFoldMarginHiColour, SETFOLDMARGINHICOLOUR, bool, useSetting, COLORREF, colour);
|
||||
DeclareSciCallV01(SetDefaultFoldDisplayText, SETDEFAULTFOLDDISPLAYTEXT, const char*, text);
|
||||
|
||||
DeclareSciCallR2(TextWidth, TEXTWIDTH, int, int, styleNumber, const char *, text);
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ typedef struct _editlexer
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// Default Style (styleLexStandard.c) Indices
|
||||
typedef enum
|
||||
typedef enum LexDefaultStyles
|
||||
{
|
||||
STY_DEFAULT = 0,
|
||||
STY_MARGIN = 1,
|
||||
|
||||
@ -20,7 +20,7 @@ EDITLEXER lexStandard =
|
||||
/* 9 */ { {_STYLE_GETSTYLEID(STY_CARET)}, IDS_LEX_STD_CARET, L"Caret (Color, Size 1-3)", L"", L"" },
|
||||
/* 10 */ { {_STYLE_GETSTYLEID(STY_LONG_LN_MRK)}, IDS_LEX_STD_LONG_LN, L"Long Line Marker (Colors)", L"fore:#FFC000", L"" },
|
||||
/* 11 */ { {_STYLE_GETSTYLEID(STY_X_LN_SPACE)}, IDS_LEX_STD_X_SPC, L"Extra Line Spacing (Size)", L"size:2", L"" },
|
||||
/* 12 */ { {_STYLE_GETSTYLEID(STY_BOOK_MARK)}, IDS_LEX_STD_BKMRK, L"Bookmarks and Folding (Colors, Size)", L"size:+2; fore:#000000; back:#00DC00; alpha:100", L"" },
|
||||
/* 12 */ { {_STYLE_GETSTYLEID(STY_BOOK_MARK)}, IDS_LEX_STD_BKMRK, L"Bookmarks and Folding (Colors, Size)", L"fore:#000000; back:#00DC00; alpha:100", L"" },
|
||||
/* 13 */ { {_STYLE_GETSTYLEID(STY_MARK_OCC)}, IDS_LEX_STR_63262, L"Mark Occurrences (Indicator)", L"fore:#3399FF; alpha:60; alpha2:60; indic_roundbox", L"" },
|
||||
/* 14 */ { {_STYLE_GETSTYLEID(STY_URL_HOTSPOT)}, IDS_LEX_STR_63264, L"Hyperlink Hotspots", L"fore:#0000E0; back:#0060B0; indic_plain", L"" },
|
||||
/* 15 */ { {_STYLE_GETSTYLEID(STY_UNICODE_HOTSPOT)}, IDS_LEX_STR_63367, L"Unicode-Point Hover", L"fore:#00FA00; alpha:60; alpha2:180; indic_compositionthick", L""},
|
||||
@ -50,7 +50,7 @@ EDITLEXER lexStandard2nd =
|
||||
/* 9 */ { {_STYLE_GETSTYLEID(STY_CARET)}, IDS_LEX_2ND_CARET, L"2nd Caret (Color, Size 1-3)", L"", L"" },
|
||||
/* 10 */ { {_STYLE_GETSTYLEID(STY_LONG_LN_MRK)}, IDS_LEX_2ND_LONG_LN, L"2nd Long Line Marker (Colors)", L"fore:#FFC000", L"" },
|
||||
/* 11 */ { {_STYLE_GETSTYLEID(STY_X_LN_SPACE)}, IDS_LEX_2ND_X_SPC, L"2nd Extra Line Spacing (Size)", L"", L"" },
|
||||
/* 12 */ { {_STYLE_GETSTYLEID(STY_BOOK_MARK)}, IDS_LEX_2ND_BKMRK, L"2nd Bookmarks and Folding (Colors, Size)", L"size:+2; charset:2; fore:#000000; back:#00DC00; case:U; alpha:100", L"" },
|
||||
/* 12 */ { {_STYLE_GETSTYLEID(STY_BOOK_MARK)}, IDS_LEX_2ND_BKMRK, L"2nd Bookmarks and Folding (Colors, Size)", L"charset:2; fore:#000000; back:#00DC00; case:U; alpha:100", L"" },
|
||||
/* 13 */ { {_STYLE_GETSTYLEID(STY_MARK_OCC)}, IDS_LEX_STR_63263, L"2nd Mark Occurrences (Indicator)", L"fore:#0000FF; alpha:60; alpha2:60; indic_box", L"" },
|
||||
/* 14 */ { {_STYLE_GETSTYLEID(STY_URL_HOTSPOT)}, IDS_LEX_STR_63265, L"2nd Hyperlink Hotspots", L"fore:#00D000; back:#009C00; alpha:180; indic_compositionthin", L"" },
|
||||
/* 15 */ { {_STYLE_GETSTYLEID(STY_UNICODE_HOTSPOT)}, IDS_LEX_STR_63368, L"2nd Unicode-Point Hover", L"fore:#0000FA; alpha:60; alpha2:180; indic_compositionthick", L""},
|
||||
|
||||
74
src/Styles.c
74
src/Styles.c
@ -630,7 +630,7 @@ float Style_GetBaseFontSize()
|
||||
{
|
||||
LPCWSTR const lpszStyle = GetCurrentStdLexer()->Styles[STY_DEFAULT].szValue;
|
||||
float fFontSize = GLOBAL_INITIAL_FONTSIZE;
|
||||
Style_StrGetSizeFloat(lpszStyle, &fFontSize);
|
||||
Style_StrGetSizeFloatEx(lpszStyle, &fFontSize);
|
||||
return max_f(0.5f, fFontSize);
|
||||
}
|
||||
|
||||
@ -644,7 +644,7 @@ float Style_GetCurrentLexerFontSize()
|
||||
float fFontSize = Style_GetBaseFontSize();
|
||||
if (!IsLexerStandard(Style_GetCurrentLexerPtr())) {
|
||||
LPCWSTR const lpszStyle = Style_GetCurrentLexerPtr()->Styles[STY_DEFAULT].szValue;
|
||||
Style_StrGetSizeFloat(lpszStyle, &fFontSize);
|
||||
Style_StrGetSizeFloatEx(lpszStyle, &fFontSize);
|
||||
}
|
||||
return max_f(0.5f, fFontSize);
|
||||
}
|
||||
@ -1293,7 +1293,7 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
|
||||
// apply default settings
|
||||
float fBaseFontSize = IsLexerStandard(pLexNew) ? GLOBAL_INITIAL_FONTSIZE : Style_GetBaseFontSize();
|
||||
Style_SetStyles(hwnd, STYLE_DEFAULT, mergedDefaultStyles, fBaseFontSize);
|
||||
Style_StrGetSizeFloat(mergedDefaultStyles, &fBaseFontSize); // get scheme base font size
|
||||
Style_StrGetSizeFloatEx(mergedDefaultStyles, &fBaseFontSize); // get scheme base font size
|
||||
|
||||
// Broadcast STYLE_DEFAULT as base style to all other styles
|
||||
SciCall_StyleClearAll();
|
||||
@ -1523,9 +1523,8 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
|
||||
wchSpecificStyle[0] = L'\0'; // empty
|
||||
|
||||
iValue = 2; // default whitespace size
|
||||
float fValue = 0.0;
|
||||
if (Style_StrGetSizeFloat(pCurrentStandard->Styles[STY_WHITESPACE].szValue, &fValue)) {
|
||||
iValue = clampi(f2int(fValue), 1, 12);
|
||||
if (Style_StrGetSizeInt(pCurrentStandard->Styles[STY_WHITESPACE].szValue, &iValue)) {
|
||||
iValue = clampi(iValue, 1, 12);
|
||||
StringCchPrintf(wchSpecificStyle, COUNTOF(wchSpecificStyle), L"size:%i", iValue);
|
||||
}
|
||||
SciCall_SetWhiteSpaceSize(iValue);
|
||||
@ -1592,9 +1591,8 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
|
||||
SciCall_SetCaretStyle(CARETSTYLE_LINE | ovrstrk_mode);
|
||||
|
||||
iValue = 1; // don't allow invisible 0
|
||||
fValue = 0.0f;
|
||||
if (Style_StrGetSizeFloat(pCurrentStandard->Styles[STY_CARET].szValue, &fValue)) {
|
||||
iValue = clampi(f2int(fValue), 1, 20);
|
||||
if (Style_StrGetSizeInt(pCurrentStandard->Styles[STY_CARET].szValue, &iValue)) {
|
||||
iValue = clampi(iValue, 1, 20);
|
||||
if (iValue != 1) {
|
||||
StringCchPrintf(wch, COUNTOF(wch), L"; size:%i", iValue);
|
||||
StringCchCat(wchSpecificStyle, COUNTOF(wchSpecificStyle), wch);
|
||||
@ -1737,7 +1735,7 @@ void Style_FillRelatedStyles(HWND hwnd, const PEDITLEXER pLexer) {
|
||||
//bool const bIsLexerStd = IsLexerStandard(pLexer);
|
||||
|
||||
float fBaseFontSize = IsLexerStandard(pLexer) ? GLOBAL_INITIAL_FONTSIZE : Style_GetBaseFontSize();
|
||||
Style_StrGetSizeFloat(pLexer->Styles[STY_DEFAULT].szValue, &fBaseFontSize);
|
||||
Style_StrGetSizeFloatEx(pLexer->Styles[STY_DEFAULT].szValue, &fBaseFontSize);
|
||||
|
||||
// -----------------------------------------------
|
||||
int i = 1; // don't re-apply lexer's default style
|
||||
@ -2019,20 +2017,21 @@ void Style_HighlightCurrentLine(HWND hwnd, int iHiLitCurLn)
|
||||
//
|
||||
// _GetMarkerMarginWidth()
|
||||
//
|
||||
static int _GetMarkerMarginWidth(HWND hwnd)
|
||||
static int _GetMarkerMarginWidth(HWND hwnd, const float scale)
|
||||
{
|
||||
float ftotal = Style_GetBaseFontSize();
|
||||
float ftotal = 0.0f;
|
||||
float const fbase = Style_GetBaseFontSize();
|
||||
|
||||
float fSize = 0.0f;
|
||||
Style_StrGetSizeFloat(GetCurrentStdLexer()->Styles[STY_MARGIN].szValue, &fSize); // relative to LineNumber
|
||||
float fSize = fbase;
|
||||
Style_StrGetSizeFloatEx(GetCurrentStdLexer()->Styles[STY_MARGIN].szValue, &fSize); // linenumber
|
||||
ftotal += fSize;
|
||||
|
||||
fSize = 0.0f;
|
||||
Style_StrGetSizeFloat(GetCurrentStdLexer()->Styles[STY_BOOK_MARK].szValue, &fSize); // settings
|
||||
fSize = fbase;
|
||||
Style_StrGetSizeFloatEx(GetCurrentStdLexer()->Styles[STY_BOOK_MARK].szValue, &fSize); // settings
|
||||
ftotal += fSize;
|
||||
|
||||
float const zoomPercent = (float)SciCall_GetZoom();
|
||||
return ScaleFloatToDPI(hwnd, (ftotal * zoomPercent) / 100.0f);
|
||||
return ScaleFloatToDPI(hwnd, (ftotal * zoomPercent * scale) / 100.0f);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -2041,7 +2040,7 @@ static int _GetMarkerMarginWidth(HWND hwnd)
|
||||
//
|
||||
void Style_UpdateFoldingMargin(HWND hwnd, bool bShowMargin)
|
||||
{
|
||||
SciCall_SetMarginWidthN(MARGIN_SCI_FOLDING, (bShowMargin ? _GetMarkerMarginWidth(hwnd) : 0));
|
||||
SciCall_SetMarginWidthN(MARGIN_SCI_FOLDING, (bShowMargin ? _GetMarkerMarginWidth(hwnd, 0.5f) : 0));
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -2050,7 +2049,7 @@ void Style_UpdateFoldingMargin(HWND hwnd, bool bShowMargin)
|
||||
//
|
||||
void Style_UpdateBookmarkMargin(HWND hwnd)
|
||||
{
|
||||
SciCall_SetMarginWidthN(MARGIN_SCI_BOOKMRK, (Settings.ShowBookmarkMargin ? _GetMarkerMarginWidth(hwnd) + 4 : 0));
|
||||
SciCall_SetMarginWidthN(MARGIN_SCI_BOOKMRK, (Settings.ShowBookmarkMargin ? _GetMarkerMarginWidth(hwnd, 0.7f) : 0));
|
||||
}
|
||||
|
||||
|
||||
@ -2061,7 +2060,7 @@ void Style_UpdateBookmarkMargin(HWND hwnd)
|
||||
void Style_UpdateChangeHistoryMargin(HWND hwnd)
|
||||
{
|
||||
bool const bShowMargin = Settings.ChangeHistoryMargin && ((Settings.ChangeHistoryMode & ChgHist_ON) && (Settings.ChangeHistoryMode & ChgHist_MARGIN));
|
||||
SciCall_SetMarginWidthN(MARGIN_SCI_CHGHIST, (bShowMargin ? _GetMarkerMarginWidth(hwnd) + 4 : 0));
|
||||
SciCall_SetMarginWidthN(MARGIN_SCI_CHGHIST, (bShowMargin ? _GetMarkerMarginWidth(hwnd, 0.7f) : 0));
|
||||
}
|
||||
|
||||
|
||||
@ -2258,7 +2257,8 @@ void Style_SetMargin(HWND hwnd, LPCWSTR lpszStyle) /// iStyle == STYLE_LINENUMBE
|
||||
// background
|
||||
SciCall_SetFoldMarginColour(true, clrFoldMarginBack); // background
|
||||
SciCall_SetFoldMarginHiColour(true, clrFoldMarginBack); // (!)
|
||||
//SciCall_FoldDisplayTextSetStyle(SC_FOLDDISPLAYTEXT_HIDDEN);
|
||||
//SciCall_FoldDisplayTextSetStyle(SC_FOLDDISPLAYTEXT_BOXED);
|
||||
//SciCall_SetDefaultFoldDisplayText("...");
|
||||
|
||||
int fldStyleLn = 0;
|
||||
Style_StrGetCharSet(wchBookMarkStyleStrg, &fldStyleLn);
|
||||
@ -2770,14 +2770,8 @@ void Style_SetIndentGuides(HWND hwnd,bool bShow)
|
||||
//
|
||||
void Style_SetExtraLineSpace(HWND hwnd, LPWSTR lpszStyle, int cch)
|
||||
{
|
||||
float fValue = 0.0f;
|
||||
bool const bHasLnSpaceDef = Style_StrGetSizeFloat(lpszStyle, &fValue);
|
||||
|
||||
int iAscent = 0;
|
||||
int iDescent = 0;
|
||||
|
||||
if (bHasLnSpaceDef) {
|
||||
int const iValue = f2int(fValue);
|
||||
int iValue = 0, iAscent = 0, iDescent = 0;
|
||||
if (Style_StrGetSizeInt(lpszStyle, &iValue)) {
|
||||
const int iCurFontSizeDbl = f2int(Style_GetCurrentLexerFontSize() * 2.0f);
|
||||
int iValAdj = clampi(iValue, (0 - iCurFontSizeDbl), 256 * iCurFontSizeDbl);
|
||||
if ((iValAdj != iValue) && (cch > 0)) {
|
||||
@ -3040,7 +3034,7 @@ bool Style_StrGetCharSet(LPCWSTR lpszStyle, int* i)
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// Style_StrGetIntSizeInt()
|
||||
// Style_StrGetSizeInt()
|
||||
//
|
||||
bool Style_StrGetSizeInt(LPCWSTR lpszStyle, int* i)
|
||||
{
|
||||
@ -3058,6 +3052,22 @@ bool Style_StrGetSizeInt(LPCWSTR lpszStyle, int* i)
|
||||
// Style_StrGetSizeFloat()
|
||||
//
|
||||
bool Style_StrGetSizeFloat(LPCWSTR lpszStyle, float* f)
|
||||
{
|
||||
WCHAR *p = StrStr(lpszStyle, L"size:");
|
||||
if (p) {
|
||||
p += CONSTSTRGLEN(L"size:");
|
||||
return Char2Float(p, f);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// Style_StrGetSizeFloatEx()
|
||||
// Adds parsed value to given one if relative (+/-)
|
||||
//
|
||||
bool Style_StrGetSizeFloatEx(LPCWSTR lpszStyle, float* f)
|
||||
{
|
||||
WCHAR *p = StrStr(lpszStyle, L"size:");
|
||||
if (p) {
|
||||
@ -3638,7 +3648,7 @@ bool Style_SelectFont(HWND hwnd, LPWSTR lpszStyle, int cchStyle, LPCWSTR sLexerN
|
||||
break;
|
||||
case DFS_GENERIC_USE:
|
||||
default:
|
||||
Style_StrGetSizeFloat(lpszStyle, &fFontSize);
|
||||
Style_StrGetSizeFloatEx(lpszStyle, &fFontSize);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -3951,7 +3961,7 @@ void Style_SetStyles(HWND hwnd, const int iStyle, LPCWSTR lpszStyle, const float
|
||||
|
||||
// Size values are relative to BaseFontSize/CurrentFontSize
|
||||
float fFontSize = fBaseFontSize;
|
||||
Style_StrGetSizeFloat(lpszStyle, &fFontSize);
|
||||
Style_StrGetSizeFloatEx(lpszStyle, &fFontSize);
|
||||
SendMessage(hwnd, SCI_STYLESETSIZEFRACTIONAL, iStyle, f2int(fFontSize * SC_FONT_SIZE_MULTIPLIER));
|
||||
|
||||
char localeNameA[LOCALE_NAME_MAX_LENGTH] = "en-us\0";
|
||||
|
||||
@ -86,7 +86,8 @@ bool Style_StrGetFontName(LPCWSTR lpszStyle,LPWSTR lpszFont,int cchFont);
|
||||
bool Style_StrGetFontQuality(LPCWSTR lpszStyle, LPWSTR lpszQuality, int cchQuality, int* iSciQuality_out);
|
||||
bool Style_StrGetCharSet(LPCWSTR lpszStyle,int* i);
|
||||
bool Style_StrGetSizeInt(LPCWSTR lpszStyle, int* i);
|
||||
bool Style_StrGetSizeFloat(LPCWSTR lpszStyle,float* f);
|
||||
bool Style_StrGetSizeFloat(LPCWSTR lpszStyle, float* f);
|
||||
bool Style_StrGetSizeFloatEx(LPCWSTR lpszStyle,float* f);
|
||||
bool Style_StrGetSizeStr(LPCWSTR lpszStyle,LPWSTR lpszSize,int cchSize);
|
||||
void Style_AppendSizeAttribute(LPWSTR lpszSize, int cchSize, const float fFontSize, const float fBaseFontSize);
|
||||
bool Style_StrGetWeightValue(LPCWSTR lpszWeight, int *weight);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user