+ fix: minor bugfixes for "Focused View"

This commit is contained in:
Rainer Kottenhoff 2019-05-03 10:53:34 +02:00
parent 21cdc6d3e6
commit 273f117fad
9 changed files with 155 additions and 97 deletions

View File

@ -30,7 +30,7 @@ UCD - (UCD)ARDET is an Encoding Detector Library
==================================================
Current Version 5.19.502.build (2019-May 2)
Current Version 5.19.503.build (2019-May 3)
==================================================
--------------------------------------------------
@ -62,7 +62,6 @@ CHANGES:
- Make "Add to Favorites" dialog resizable
- Make Custom.Schemes and Find/Replace dialog resizable
- Allow Hyperlink Hotspots also in "Focused View"
- BOOKMARK (margin flag) style changed to vertical flavor
- Auto-Save after elevating user right
- Support Compiler version 192027508 (VS2019 v16.0.(0-3)

View File

@ -1 +1 @@
1687
1688

View File

@ -3,7 +3,7 @@
<assemblyIdentity
name="Notepad3"
processorArchitecture="*"
version="5.19.502.1687"
version="5.19.503.1688"
type="win32"
/>
<description>Notepad3 RC</description>

View File

@ -316,7 +316,7 @@ void _ClearTextBuffer(HWND hwnd)
if (SciCall_GetReadOnly()) { SciCall_SetReadOnly(false); }
EditClearAllOccurrenceMarkers();
if (Globals.bHideNonMatchedLines) { EditToggleView(hwnd); }
if (FocusedView.bHideNonMatchedLines) { EditToggleView(hwnd); }
SendMessage(hwnd, SCI_CLEARALL, 0, 0);
SendMessage(hwnd, SCI_MARKERDELETEALL, (WPARAM)MARKER_NP3_BOOKMARK, 0);
@ -5263,7 +5263,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara
Globals.iReplacedOccurrences = 0;
Globals.FindReplaceMatchFoundState = FND_NOP;
if (Globals.bHideNonMatchedLines) { EditToggleView(hwnd); }
if (FocusedView.bHideNonMatchedLines) { EditToggleView(hwnd); }
MarkAllOccurrences(50, true);
if (s_InitialTopLine >= 0) {
@ -5487,7 +5487,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara
if (sg_pefrData->bMarkOccurences) {
if (sg_pefrData->bStateChanged || (StringCchCompareXA(s_lastFind, sg_pefrData->szFind) != 0)) {
_IGNORE_NOTIFY_CHANGE_;
if (Globals.bHideNonMatchedLines) { _DeleteLineStateAll(LINESTATE_OCCURRENCE_MARK); }
if (FocusedView.bHideNonMatchedLines) { _DeleteLineStateAll(LINESTATE_OCCURRENCE_MARK); }
StringCchCopyA(s_lastFind, COUNTOF(s_lastFind), sg_pefrData->szFind);
RegExResult_t match = _FindHasMatch(Globals.hwndEdit, sg_pefrData, 0, (sg_pefrData->bMarkOccurences), false);
if (s_anyMatch != match) { s_anyMatch = match; }
@ -5510,7 +5510,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara
EditSetSelectionEx(Globals.hwndEdit, s_InitialAnchorPos, s_InitialCaretPos, -1, -1);
}
}
if (Globals.bHideNonMatchedLines) { EditHideNotMarkedLineRange(Globals.hwndEdit, true); }
if (FocusedView.bHideNonMatchedLines) { EditHideNotMarkedLineRange(Globals.hwndEdit, true); }
_OBSERVE_NOTIFY_CHANGE_;
}
}
@ -5543,7 +5543,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara
Settings.MarkOccurrencesMatchVisible = bSaveOccVisible;
//DialogEnableWindow(hwnd, IDC_TOGGLE_VISIBILITY, (Settings.MarkOccurrences > 0) && !Settings.MarkOccurrencesMatchVisible);
DialogEnableWindow(hwnd, IDC_TOGGLE_VISIBILITY, false);
if (Globals.bHideNonMatchedLines) {
if (FocusedView.bHideNonMatchedLines) {
PostMessage(hwnd, WM_COMMAND, MAKELONG(IDC_TOGGLE_VISIBILITY, 1), 0);
}
InvalidateRect(GetDlgItem(hwnd, IDC_FINDTEXT), NULL, true);
@ -5558,7 +5558,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wPara
case IDC_TOGGLE_VISIBILITY:
if (Globals.bHideNonMatchedLines) {
if (FocusedView.bHideNonMatchedLines) {
EditToggleView(hwnd);
sg_pefrData->bStateChanged = true;
s_InitialTopLine = -1; // reset
@ -6179,7 +6179,7 @@ void EditApplyVisibleStyle(HWND hwnd)
EditUpdateUrlHotspots(hwnd, SciCall_PositionFromLine(iStartLine), SciCall_GetLineEndPosition(iEndLine), true);
_OBSERVE_NOTIFY_CHANGE_;
}
else if (!Globals.bHideNonMatchedLines) {
else if (!FocusedView.bHideNonMatchedLines) {
Sci_ApplyLexerStyle(SciCall_PositionFromLine(iStartLine), SciCall_GetLineEndPosition(iEndLine));
}
}
@ -6483,26 +6483,14 @@ void EditClearAllOccurrenceMarkers()
//
void EditToggleView(HWND hwnd)
{
static bool bSaveFoldingAvailable = false;
static bool bSaveShowFolding = false;
bool const bWaitCursor = ((Globals.iMarkOccurrencesCount > 1000) || (SciCall_GetLineCount() > 2000)) ? true : false;
if (bWaitCursor) { BeginWaitCursor(NULL); }
if (!Globals.bHideNonMatchedLines) {
bSaveFoldingAvailable = Globals.bCodeFoldingAvailable;
bSaveShowFolding = Settings.ShowCodeFolding;
}
else {
Globals.bCodeFoldingAvailable = bSaveFoldingAvailable;
Settings.ShowCodeFolding = bSaveShowFolding;
}
FocusedView.bHideNonMatchedLines = !FocusedView.bHideNonMatchedLines; // toggle
Globals.bHideNonMatchedLines = !Globals.bHideNonMatchedLines; // toggle
EditHideNotMarkedLineRange(hwnd, FocusedView.bHideNonMatchedLines);
EditHideNotMarkedLineRange(hwnd, Globals.bHideNonMatchedLines);
if (Globals.bHideNonMatchedLines) {
if (FocusedView.bHideNonMatchedLines) {
EditScrollTo(hwnd, 0, false);
SciCall_SetReadOnly(true);
}
@ -6849,7 +6837,7 @@ bool EditAutoCompleteWord(HWND hwnd, bool autoInsert)
//
void EditUpdateUrlHotspots(HWND hwnd, DocPos startPos, DocPos endPos, bool bActiveHotspot)
{
if (Globals.bHideNonMatchedLines) { return; }
if (FocusedView.bHideNonMatchedLines) { return; }
if (endPos < 0) {
endPos = Sci_GetDocEndPosition() - 1;
@ -6925,10 +6913,12 @@ void EditHideNotMarkedLineRange(HWND hwnd, bool bHideLines)
DocPos const iEndPos = Sci_GetDocEndPosition();
if (!bHideLines) {
// reset
Style_SetFoldingAvailability(Style_GetCurrentLexerPtr());
FocusedView.ShowCodeFolding = Settings.ShowCodeFolding;
_DeleteLineStateAll(LINESTATE_OCCURRENCE_MARK);
if (!Globals.bCodeFoldingAvailable) { SciCall_SetProperty("fold", "0"); }
SciCall_SetFoldFlags(0);
Style_SetFolding(hwnd, Globals.bCodeFoldingAvailable && Settings.ShowCodeFolding);
Style_SetFoldingProperties(FocusedView.CodeFoldingAvailable);
Style_SetFolding(hwnd, FocusedView.CodeFoldingAvailable && FocusedView.ShowCodeFolding);
SciCall_FoldAll(EXPAND);
Sci_ApplyLexerStyle(0, -1);
EditUpdateUrlHotspots(hwnd, 0, -1, Settings.HyperlinkHotspot);
@ -6936,20 +6926,14 @@ void EditHideNotMarkedLineRange(HWND hwnd, bool bHideLines)
else // ===== hide lines without marker =====
{
// prepare hidden (folding) settings
Globals.bCodeFoldingAvailable = true; // saved before
Settings.ShowCodeFolding = true; // saved before
SciCall_SetProperty("fold", "1");
SciCall_SetProperty("fold.foldsyntaxbased", "1");
SciCall_SetProperty("fold.comment", "1");
SciCall_SetProperty("fold.preprocessor", "1");
SciCall_SetProperty("fold.compact", "0");
FocusedView.CodeFoldingAvailable = true;
FocusedView.ShowCodeFolding = true;
Style_SetFoldingProperties(FocusedView.CodeFoldingAvailable);
SciCall_SetProperty("fold.foldsyntaxbased", "0");
Style_SetFolding(hwnd, true);
SciCall_SetFoldFlags(0);
//SciCall_SetFoldFlags(SC_FOLDFLAG_LEVELNUMBERS | SC_FOLDFLAG_LINESTATE); // Debug
Sci_ApplyLexerStyle(0, -1);
EditMarkAllOccurrences(hwnd, false); // restore - Lexers destroy the LineState bitset
EditUpdateUrlHotspots(hwnd, 0, -1, Settings.HyperlinkHotspot);
DocLn const iStartLine = SciCall_LineFromPosition(iStartPos);
DocLn const iEndLine = SciCall_LineFromPosition(iEndPos);
@ -8355,7 +8339,7 @@ void EditFoldClick(DocLn ln, int mode)
void EditFoldAltArrow(FOLD_MOVE move, FOLD_ACTION action)
{
if (Globals.bCodeFoldingAvailable && Settings.ShowCodeFolding)
if (FocusedView.CodeFoldingAvailable && FocusedView.ShowCodeFolding)
{
DocLn ln = SciCall_LineFromPosition(SciCall_GetCurrentPos());

View File

@ -61,6 +61,8 @@ SETTINGS_T Defaults;
SETTINGS2_T Settings2;
static SETTINGS2_T Defaults2;
FOCUSEDVIEW_T FocusedView;
// ------------------------------------
static WCHAR s_wchWndClass[16] = _W(SAPPNAME);
@ -470,7 +472,6 @@ static void _InitGlobals()
Globals.CallTipType = CT_NONE;
Globals.iAvailLngCount = 1;
Globals.iWrapCol = 0;
Globals.bCodeFoldingAvailable = false;
Globals.bForceReLoadAsUTF8 = false;
Globals.DOSEncoding = CPI_NONE;
Globals.bZeroBasedColumnIndex = false;
@ -483,7 +484,6 @@ static void _InitGlobals()
Globals.bIniFileFromScratch = false;
Globals.bFindReplCopySelOrClip = true;
Globals.bReplaceInitialized = false;
Globals.bHideNonMatchedLines = false;
Globals.FindReplaceMatchFoundState = FND_NOP;
Flags.bDevDebugMode = DefaultFlags.bDevDebugMode = false;
@ -501,6 +501,10 @@ static void _InitGlobals()
Flags.NoFileVariables = DefaultFlags.NoFileVariables = false;
Flags.ShellUseSystemMRU = DefaultFlags.ShellUseSystemMRU = true;
Flags.PrintFileAndLeave = DefaultFlags.PrintFileAndLeave = 0;
FocusedView.bHideNonMatchedLines = false;
FocusedView.CodeFoldingAvailable = false;
FocusedView.ShowCodeFolding = true;
}
@ -2343,7 +2347,7 @@ LRESULT MsgThemeChanged(HWND hwnd, WPARAM wParam ,LPARAM lParam)
SendWMSize(hwnd, NULL);
if (Globals.bHideNonMatchedLines) { EditToggleView(Globals.hwndEdit); }
if (FocusedView.bHideNonMatchedLines) { EditToggleView(Globals.hwndEdit); }
MarkAllOccurrences(0, true);
EditUpdateUrlHotspots(Globals.hwndEdit, 0, -1, Settings.HyperlinkHotspot);
UpdateUI();
@ -2985,13 +2989,13 @@ LRESULT MsgInitMenu(HWND hwnd, WPARAM wParam, LPARAM lParam)
EnableCmd(hmenu, IDM_VIEW_FONT, !IsWindow(Globals.hwndDlgCustomizeSchemes));
EnableCmd(hmenu, IDM_VIEW_CURRENTSCHEME, !IsWindow(Globals.hwndDlgCustomizeSchemes));
EnableCmd(hmenu, IDM_VIEW_FOLDING, Globals.bCodeFoldingAvailable);
CheckCmd(hmenu, IDM_VIEW_FOLDING, (Globals.bCodeFoldingAvailable && Settings.ShowCodeFolding));
EnableCmd(hmenu,IDM_VIEW_TOGGLEFOLDS,!e && (Globals.bCodeFoldingAvailable && Settings.ShowCodeFolding));
EnableCmd(hmenu, IDM_VIEW_FOLDING, FocusedView.CodeFoldingAvailable && !FocusedView.bHideNonMatchedLines);
CheckCmd(hmenu, IDM_VIEW_FOLDING, (FocusedView.CodeFoldingAvailable && FocusedView.ShowCodeFolding));
EnableCmd(hmenu,IDM_VIEW_TOGGLEFOLDS,!e && (FocusedView.CodeFoldingAvailable && FocusedView.ShowCodeFolding));
bool const bF = (SC_FOLDLEVELBASE < (SciCall_GetFoldLevel(iCurLine) & SC_FOLDLEVELNUMBERMASK));
bool const bH = (SciCall_GetFoldLevel(iCurLine) & SC_FOLDLEVELHEADERFLAG);
EnableCmd(hmenu,IDM_VIEW_TOGGLE_CURRENT_FOLD, !e && (Globals.bCodeFoldingAvailable && Settings.ShowCodeFolding) && (bF || bH));
EnableCmd(hmenu,IDM_VIEW_TOGGLE_CURRENT_FOLD, !e && (FocusedView.CodeFoldingAvailable && FocusedView.ShowCodeFolding) && (bF || bH));
CheckCmd(hmenu,IDM_VIEW_USE2NDDEFAULT,Style_GetUse2ndDefault());
@ -3015,7 +3019,7 @@ LRESULT MsgInitMenu(HWND hwnd, WPARAM wParam, LPARAM lParam)
CheckCmd(hmenu, IDM_VIEW_MARKOCCUR_CASE, Settings.MarkOccurrencesMatchCase);
EnableCmd(hmenu, IDM_VIEW_TOGGLE_VIEW, (Settings.MarkOccurrences > 0) && !Settings.MarkOccurrencesMatchVisible);
CheckCmd(hmenu, IDM_VIEW_TOGGLE_VIEW, Globals.bHideNonMatchedLines);
CheckCmd(hmenu, IDM_VIEW_TOGGLE_VIEW, FocusedView.bHideNonMatchedLines);
if (Settings.MarkOccurrencesMatchWholeWords) {
i = IDM_VIEW_MARKOCCUR_WORD;
@ -4933,14 +4937,14 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
break;
case IDM_VIEW_TOGGLE_VIEW:
if (Globals.bHideNonMatchedLines) {
if (FocusedView.bHideNonMatchedLines) {
EditToggleView(Globals.hwndEdit);
MarkAllOccurrences(0, true);
}
else {
EditToggleView(Globals.hwndEdit);
}
CheckCmd(GetMenu(hwnd), IDM_VIEW_TOGGLE_VIEW, Globals.bHideNonMatchedLines);
CheckCmd(GetMenu(hwnd), IDM_VIEW_TOGGLE_VIEW, FocusedView.bHideNonMatchedLines);
UpdateToolbar();
break;
@ -4969,8 +4973,9 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
case IDM_VIEW_FOLDING:
Settings.ShowCodeFolding = !Settings.ShowCodeFolding;
Style_SetFolding(Globals.hwndEdit, Settings.ShowCodeFolding);
if (!Settings.ShowCodeFolding) { EditToggleFolds(EXPAND, true); }
FocusedView.ShowCodeFolding = Settings.ShowCodeFolding;
Style_SetFolding(Globals.hwndEdit, FocusedView.ShowCodeFolding);
if (!FocusedView.ShowCodeFolding) { EditToggleFolds(EXPAND, true); }
UpdateToolbar();
break;
@ -6459,7 +6464,7 @@ LRESULT MsgNotify(HWND hwnd, WPARAM wParam, LPARAM lParam)
_SetSaveNeededFlag(true);
}
else if (pnmh->code == SCN_MODIFYATTEMPTRO) {
if (Globals.bHideNonMatchedLines) { EditToggleView(Globals.hwndEdit); }
if (FocusedView.bHideNonMatchedLines) { EditToggleView(Globals.hwndEdit); }
}
}
return TRUE;
@ -7152,7 +7157,7 @@ void LoadSettings()
GET_INT_VALUE_FROM_INISECTION(LongLineMode, EDGE_LINE, EDGE_LINE, EDGE_BACKGROUND);
GET_BOOL_VALUE_FROM_INISECTION(ShowSelectionMargin, true);
GET_BOOL_VALUE_FROM_INISECTION(ShowLineNumbers, true);
GET_BOOL_VALUE_FROM_INISECTION(ShowCodeFolding, true);
GET_BOOL_VALUE_FROM_INISECTION(ShowCodeFolding, true); FocusedView.ShowCodeFolding = Settings.ShowCodeFolding;
GET_INT_VALUE_FROM_INISECTION(MarkOccurrences, 1, 0, 3);
GET_BOOL_VALUE_FROM_INISECTION(MarkOccurrencesMatchVisible, false);
GET_BOOL_VALUE_FROM_INISECTION(MarkOccurrencesMatchCase, false);
@ -8435,7 +8440,7 @@ static void _UpdateToolbarDelayed()
bool b1 = SciCall_IsSelectionEmpty();
bool b2 = (bool)(SciCall_GetTextLength() > 0);
bool ro = SciCall_GetReadOnly();
bool tv = Globals.bHideNonMatchedLines;
bool tv = FocusedView.bHideNonMatchedLines;
EnableTool(IDT_EDIT_UNDO, SciCall_CanUndo() && !ro);
EnableTool(IDT_EDIT_REDO, SciCall_CanRedo() && !ro);
@ -8453,7 +8458,7 @@ static void _UpdateToolbarDelayed()
EnableTool(IDT_EDIT_COPY, !b1 && !ro);
EnableTool(IDT_EDIT_CLEAR, !b1 && !ro);
EnableTool(IDT_VIEW_TOGGLEFOLDS, b2 && (Globals.bCodeFoldingAvailable && Settings.ShowCodeFolding));
EnableTool(IDT_VIEW_TOGGLEFOLDS, b2 && (FocusedView.CodeFoldingAvailable && FocusedView.ShowCodeFolding));
EnableTool(IDT_VIEW_TOGGLE_VIEW, b2 && ((Settings.MarkOccurrences > 0) && !Settings.MarkOccurrencesMatchVisible));
CheckTool(IDT_VIEW_TOGGLE_VIEW, tv);
@ -9177,10 +9182,8 @@ void UpdateMarginWidth()
SciCall_SetMarginWidthN(MARGIN_SCI_LINENUM, 0);
}
if (!Globals.bHideNonMatchedLines) {
Style_SetBookmark(Globals.hwndEdit, Settings.ShowSelectionMargin);
Style_SetFolding(Globals.hwndEdit, (Globals.bCodeFoldingAvailable && Settings.ShowCodeFolding));
}
Style_SetBookmark(Globals.hwndEdit, Settings.ShowSelectionMargin);
Style_SetFolding(Globals.hwndEdit, (FocusedView.CodeFoldingAvailable && FocusedView.ShowCodeFolding));
}
@ -9593,7 +9596,7 @@ bool FileLoad(bool bDontSave, bool bNew, bool bReload,
fioStatus.iEncoding = CPI_ANSI_DEFAULT;
if (bNew || bReload) {
if (Globals.bHideNonMatchedLines) { EditToggleView(Globals.hwndEdit); }
if (FocusedView.bHideNonMatchedLines) { EditToggleView(Globals.hwndEdit); }
}
if (!bDontSave)

View File

@ -774,6 +774,50 @@ DWORD Style_ExportToFile(const WCHAR* szFile, bool bForceAll)
}
//=============================================================================
//
// Style_SetFoldingAvailability()
//
void Style_SetFoldingAvailability(PEDITLEXER pLexer)
{
switch (pLexer->lexerID)
{
case SCLEX_NULL:
case SCLEX_CONTAINER:
case SCLEX_BATCH:
case SCLEX_CONF:
case SCLEX_MAKEFILE:
case SCLEX_MARKDOWN:
FocusedView.CodeFoldingAvailable = false;
break;
default:
FocusedView.CodeFoldingAvailable = true;
break;
}
}
//=============================================================================
//
// Style_SetFoldingProperties()
//
void Style_SetFoldingProperties(bool active)
{
if (active) {
SciCall_SetProperty("fold", "1");
SciCall_SetProperty("fold.foldsyntaxbased", "1");
SciCall_SetProperty("fold.compact", "0");
SciCall_SetProperty("fold.comment", "1");
SciCall_SetProperty("fold.html", "1");
SciCall_SetProperty("fold.preprocessor", "1");
SciCall_SetProperty("fold.cpp.comment.explicit", "0");
}
else {
SciCall_SetProperty("fold", "0");
}
}
//=============================================================================
//
// Style_SetLexer()
@ -832,30 +876,16 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
SciCall_SetProperty("json.allow.comments", "1");
SciCall_SetProperty("json.escape.sequence", "1");
}
// Code folding
switch (pLexNew->lexerID)
{
case SCLEX_NULL:
case SCLEX_CONTAINER:
case SCLEX_BATCH:
case SCLEX_CONF:
case SCLEX_MAKEFILE:
case SCLEX_MARKDOWN:
Globals.bCodeFoldingAvailable = false;
SciCall_SetProperty("fold", "0");
break;
default:
Globals.bCodeFoldingAvailable = true;
SciCall_SetProperty("fold", "1");
SciCall_SetProperty("fold.compact", "0");
SciCall_SetProperty("fold.comment", "1");
SciCall_SetProperty("fold.html", "1");
SciCall_SetProperty("fold.preprocessor", "1");
SciCall_SetProperty("fold.cpp.comment.explicit", "0");
break;
else if (pLexNew->lexerID == SCLEX_PYTHON) {
SciCall_SetProperty("tab.timmy.whinge.level", "1");
}
// Code folding
Style_SetFoldingAvailability(pLexNew);
Style_SetFoldingProperties(FocusedView.CodeFoldingAvailable);
// Add KeyWord Lists
for (int i = 0; i < (KEYWORDSET_MAX + 1); i++) {
SciCall_SetKeywords(i, pLexNew->pKeyWords->pszKeyWords[i]);
@ -1009,7 +1039,10 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
SendMessage(hwnd, SCI_INDICSETFORE, _SC_INDIC_IME_UNKNOWN, dColor);
}
// More default values...
SendMessage(hwnd, SCI_INDICSETFORE, _SC_INDIC_IME_INPUT, dColor);
SendMessage(hwnd, SCI_INDICSETFORE, _SC_INDIC_IME_TARGET, dColor);
SendMessage(hwnd, SCI_INDICSETFORE, _SC_INDIC_IME_CONVERTED, dColor);
SendMessage(hwnd, SCI_INDICSETFORE, _SC_INDIC_IME_UNKNOWN, dColor);
if (pLexNew != &lexANSI) {
Style_SetStyles(hwnd, pCurrentStandard->Styles[STY_CTRL_CHR].iStyle, pCurrentStandard->Styles[STY_CTRL_CHR].szValue, false); // control char
@ -1307,6 +1340,29 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
}
}
// Lexer reserved indicator styles
switch (s_pLexCurrent->lexerID)
{
case SCLEX_PYTHON:
SendMessage(hwnd, SCI_INDICSETSTYLE, 1, INDIC_ROUNDBOX);
SendMessage(hwnd, SCI_INDICSETFORE, 1, (LPARAM)RGB(255, 0, 0)); // (light red)
//SendMessage(hwnd, SCI_INDICSETALPHA, 1, 40);
//SendMessage(hwnd, SCI_INDICSETOUTLINEALPHA, 1, 100);
break;
default:
//SendMessage(hwnd, SCI_INDICSETSTYLE, 0, INDIC_SQUIGGLE);
//SendMessage(hwnd, SCI_INDICSETSTYLE, 1, INDIC_TT);
//SendMessage(hwnd, SCI_INDICSETSTYLE, 2, INDIC_PLAIN);
//SendMessage(hwnd, SCI_INDICSETFORE, 0, (LPARAM)RGB(0, 0x7f, 0)); // (dark green)
//SendMessage(hwnd, SCI_INDICSETFORE, 1, (LPARAM)RGB(0, 0, 0xff)); // (light blue)
//SendMessage(hwnd, SCI_INDICSETFORE, 2, (LPARAM)RGB(0xff, 0, 0)); // (light red)
//for (int sty = 3; sty < INDIC_CONTAINER; ++sty) {
// SendMessage(hwnd, SCI_INDICSETSTYLE, sty, INDIC_ROUNDBOX);
//}
break;
}
Style_SetInvisible(hwnd, false); // set fixed invisible style
Style_SetUrlHotSpot(hwnd, Settings.HyperlinkHotspot);
@ -1602,22 +1658,26 @@ void Style_SetMargin(HWND hwnd, int iStyle, LPCWSTR lpszStyle)
int fldStyleLn = 0;
Style_StrGetCharSet(wchBookMarkStyleStrg, &fldStyleLn);
int const _debug_flags = 0;
//int const _debug_flags = (SC_FOLDFLAG_LEVELNUMBERS | SC_FOLDFLAG_LINESTATE); // !extend margin width
switch (fldStyleLn)
{
case 1:
SciCall_SetFoldFlags(SC_FOLDFLAG_LINEBEFORE_CONTRACTED);
SciCall_SetFoldFlags(SC_FOLDFLAG_LINEBEFORE_CONTRACTED | _debug_flags);
break;
case 2:
SciCall_SetFoldFlags(SC_FOLDFLAG_LINEBEFORE_CONTRACTED | SC_FOLDFLAG_LINEAFTER_CONTRACTED);
SciCall_SetFoldFlags(SC_FOLDFLAG_LINEBEFORE_CONTRACTED | SC_FOLDFLAG_LINEAFTER_CONTRACTED | _debug_flags);
break;
default:
SciCall_SetFoldFlags(SC_FOLDFLAG_LINEAFTER_CONTRACTED);
SciCall_SetFoldFlags(SC_FOLDFLAG_LINEAFTER_CONTRACTED | _debug_flags);
break;
}
// set width
Style_SetBookmark(hwnd, Settings.ShowSelectionMargin);
Style_SetFolding(hwnd, (Globals.bCodeFoldingAvailable && Settings.ShowCodeFolding));
Style_SetFolding(hwnd, (FocusedView.CodeFoldingAvailable && FocusedView.ShowCodeFolding));
}

View File

@ -42,6 +42,8 @@ bool Style_InsertThemesMenu(HMENU hMenuBar);
void Style_DynamicThemesMenuCmd(int cmd, bool bEnableSaveSettings);
float Style_GetCurrentFontSize();
void Style_SetFoldingAvailability(PEDITLEXER pLexer);
void Style_SetFoldingProperties(bool active);
void Style_SetLexer(HWND hwnd,PEDITLEXER pLexNew);
void Style_SetUrlHotSpot(HWND hwnd, bool);
void Style_SetInvisible(HWND hwnd, bool);

View File

@ -247,11 +247,11 @@ typedef struct _cmq
#define MARKER_NP3_BOOKMARK 1
#define LINESTATE_OCCURRENCE_MARK (1 << 13)
#define LINESTATE_OCCURRENCE_MARK (1 << 17)
#define INDIC_NP3_MARK_OCCURANCE 1
#define INDIC_NP3_MATCH_BRACE 2
#define INDIC_NP3_BAD_BRACE 3
#define INDIC_NP3_MARK_OCCURANCE (INDIC_CONTAINER + 1)
#define INDIC_NP3_MATCH_BRACE (INDIC_CONTAINER + 2)
#define INDIC_NP3_BAD_BRACE (INDIC_CONTAINER + 3)
//=============================================================================
@ -297,7 +297,6 @@ typedef struct _globals_t
FILEVARS fvCurFile;
FILEVARS fvBackup;
int iWrapCol;
bool bCodeFoldingAvailable;
bool bForceReLoadAsUTF8;
bool bZeroBasedColumnIndex;
bool bZeroBasedCharacterCount;
@ -309,7 +308,6 @@ typedef struct _globals_t
bool bIniFileFromScratch;
bool bFindReplCopySelOrClip;
bool bReplaceInitialized;
bool bHideNonMatchedLines;
FR_STATES FindReplaceMatchFoundState;
@ -500,6 +498,18 @@ extern SETTINGS2_T Settings2;
//=============================================================================
typedef struct _focusedview_t
{
bool bHideNonMatchedLines;
bool CodeFoldingAvailable; // = true; // saved before
bool ShowCodeFolding; // = true; // saved before
} FOCUSEDVIEW_T, * PFOCUSEDVIEW_T;
extern FOCUSEDVIEW_T FocusedView;
//=============================================================================
typedef enum { I_TAB_LN = 0, I_SPC_LN = 1, I_MIX_LN = 2, I_TAB_MOD_X = 3, I_SPC_MOD_X = 4 } INDENT_TYPE;
typedef struct _editfileiostatus

View File

@ -7,8 +7,8 @@
#define SAPPNAME "Notepad3"
#define VERSION_MAJOR 5
#define VERSION_MINOR 19
#define VERSION_REV 502
#define VERSION_BUILD 1687
#define VERSION_REV 503
#define VERSION_BUILD 1688
#define SCINTILLA_VER 415
#define ONIGMO_REGEX_VER 6.2.0
#define VERSION_PATCH RC