+ feature: 1st draft of "Toggle Visible" (hide non occurences lines)

This commit is contained in:
Rainer Kottenhoff 2018-04-03 20:35:40 +02:00
parent a0f535ee07
commit ccbef6535f
8 changed files with 708 additions and 563 deletions

View File

@ -281,6 +281,7 @@ void EditSetNewText(HWND hwnd,char* lpstrText,DWORD cbText)
UndoRedoActionMap(-1,NULL);
SendMessage(hwnd,SCI_CLEARALL,0,0);
SendMessage(hwnd,SCI_MARKERDELETEALL,(WPARAM)MARKER_NP3_BOOKMARK,0);
SendMessage(hwnd,SCI_MARKERDELETEALL,(WPARAM)MARKER_NP3_OCCUR_LINE,0);
SendMessage(hwnd,SCI_SETSCROLLWIDTH, GetSystemMetrics(SM_CXSCREEN), 0);
SendMessage(hwnd,SCI_SETXOFFSET,0,0);
@ -321,6 +322,7 @@ BOOL EditConvertText(HWND hwnd, int encSource, int encDest, BOOL bSetSavePoint)
UndoRedoActionMap(-1,NULL);
SendMessage(hwnd,SCI_CLEARALL,0,0);
SendMessage(hwnd,SCI_MARKERDELETEALL,(WPARAM)MARKER_NP3_BOOKMARK,0);
SendMessage(hwnd,SCI_MARKERDELETEALL,(WPARAM)MARKER_NP3_OCCUR_LINE,0);
SendMessage(hwnd,SCI_SETUNDOCOLLECTION,(WPARAM)1,0);
SendMessage(hwnd,SCI_GOTOPOS,0,0);
SendMessage(hwnd,SCI_CHOOSECARETX,0,0);
@ -359,6 +361,7 @@ BOOL EditConvertText(HWND hwnd, int encSource, int encDest, BOOL bSetSavePoint)
UndoRedoActionMap(-1,NULL);
SendMessage(hwnd,SCI_CLEARALL,0,0);
SendMessage(hwnd,SCI_MARKERDELETEALL,(WPARAM)MARKER_NP3_BOOKMARK,0);
SendMessage(hwnd, SCI_MARKERDELETEALL, (WPARAM)MARKER_NP3_OCCUR_LINE, 0);
SendMessage(hwnd,SCI_ADDTEXT,cbText,(LPARAM)pchText);
SendMessage(hwnd,SCI_SETUNDOCOLLECTION,(WPARAM)1,0);
SendMessage(hwnd,SCI_GOTOPOS,0,0);
@ -4552,9 +4555,7 @@ static void __fastcall _SetSearchFlags(HWND hwnd, LPEDITFINDREPLACE lpefr)
}
lpefr->bTransformBS = (IsDlgButtonChecked(hwnd, IDC_FINDTRANSFORMBS) == BST_CHECKED) ? TRUE : FALSE;
lpefr->bMarkOccurences = (IsDlgButtonChecked(hwnd, IDC_ALL_OCCURRENCES) == BST_CHECKED) ? TRUE : FALSE;
lpefr->bNoFindWrap = (IsDlgButtonChecked(hwnd, IDC_NOWRAP) == BST_CHECKED) ? TRUE : FALSE;
}
@ -4621,6 +4622,7 @@ static int __fastcall _EditGetFindStrg(HWND hwnd, LPCEDITFINDREPLACE lpefr, LPST
}
else {
GetFindPatternMB(szFind, cchCnt);
StringCchCopyA(lpefr->szFind, COUNTOF(lpefr->szFind), szFind);
}
if (!StringCchLenA(szFind, cchCnt)) { return 0; }
@ -4734,7 +4736,7 @@ static RegExResult_t __fastcall _FindHasMatch(HWND hwnd, LPCEDITFINDREPLACE lpef
//=============================================================================
//
// EditFindReplaceDlgProcW()
// _SetTimerMarkAll()
//
static void __fastcall _SetTimerMarkAll(HWND hwnd, int delay)
{
@ -4762,6 +4764,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
static RegExResult_t regexMatch = INVALID;
static BOOL bFlagsChanged = TRUE;
static bool bHideNonMatchedLines = false;
static COLORREF rgbRed = RGB(255, 170, 170);
static COLORREF rgbGreen = RGB(170, 255, 170);
@ -4776,31 +4779,38 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
WCHAR tchBuf[FNDRPL_BUFFER] = { L'\0' };
switch(umsg)
switch (umsg)
{
case WM_INITDIALOG:
case WM_INITDIALOG:
{
SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR)lParam);
lpefr = (LPEDITFINDREPLACE)lParam;
iReplacedOccurrences = 0;
bHideNonMatchedLines = false;
g_FindReplaceMatchFoundState = FND_NOP;
iSaveMarkOcc = iMarkOccurrences;
bSaveOccVisible = bMarkOccurrencesMatchVisible;
if (lpefr->bMarkOccurences) {
iSaveMarkOcc = iMarkOccurrences;
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_ONOFF, FALSE);
iMarkOccurrences = 0;
bSaveOccVisible = bMarkOccurrencesMatchVisible;
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_VISIBLE, FALSE);
bMarkOccurrencesMatchVisible = FALSE;
CheckDlgButton(hwnd, IDC_ALL_OCCURRENCES, BST_CHECKED);
DialogEnableWindow(hwnd, IDC_TOGGLE_VISIBILITY, TRUE);
}
else {
iSaveMarkOcc = -1;
bSaveOccVisible = bMarkOccurrencesMatchVisible;
iMarkOccurrences = iSaveMarkOcc;
bMarkOccurrencesMatchVisible = bSaveOccVisible;
if (iMarkOccurrences >= 0) {
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_ONOFF, TRUE);
}
CheckDlgButton(hwnd, IDC_ALL_OCCURRENCES, BST_UNCHECKED);
DialogEnableWindow(hwnd, IDC_TOGGLE_VISIBILITY, FALSE);
EditClearAllMarks(g_hwndEdit, 0, -1);
}
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_VISIBLE, bMarkOccurrencesMatchVisible);
//const WORD wTabSpacing = (WORD)SendMessage(lpefr->hwnd, SCI_GETTABWIDTH, 0, 0);; // dialog box units
//SendDlgItemMessage(hwnd, IDC_FINDTEXT, EM_SETTABSTOPS, 1, (LPARAM)&wTabSpacing);
@ -4862,6 +4872,10 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
if (lpefr->bMarkOccurences) {
CheckDlgButton(hwnd, IDC_ALL_OCCURRENCES, BST_CHECKED);
DialogEnableWindow(hwnd, IDC_TOGGLE_VISIBILITY, TRUE);
}
else {
DialogEnableWindow(hwnd, IDC_TOGGLE_VISIBILITY, FALSE);
}
if (lpefr->fuFlags & SCFIND_REGEXP) {
@ -4937,25 +4951,30 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
lpefr = (LPEDITFINDREPLACE)GetWindowLongPtr(hwnd, DWLP_USER);
lpefr->szFind[0] = '\0';
if (iSaveMarkOcc >= 0) {
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_ONOFF, TRUE);
if (iSaveMarkOcc != 0) {
SendMessage(g_hwndMain, WM_COMMAND, (WPARAM)MAKELONG(IDM_VIEW_MARKOCCUR_ONOFF, 1), 0);
}
EditClearAllMarks(g_hwndEdit, 0, -1);
if (bHideNonMatchedLines) {
Style_ResetCurrentLexer(g_hwndEdit);
bHideNonMatchedLines = false;
}
iMarkOccurrences = iSaveMarkOcc;
bMarkOccurrencesMatchVisible = bSaveOccVisible;
if (iMarkOccurrences >= 0) {
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_ONOFF, TRUE);
}
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_VISIBLE, bMarkOccurrencesMatchVisible);
iReplacedOccurrences = 0;
g_FindReplaceMatchFoundState = FND_NOP;
//EditScrollTo(hwnd, Sci_GetCurrentLine(), false);
EditEnsureSelectionVisible(hwnd);
//EditScrollTo(g_hwndEdit, Sci_GetCurrentLine(), false);
EditEnsureSelectionVisible(g_hwndEdit);
}
KillTimer(hwnd, IDT_TIMER_MRKALL);
DeleteObject(hBrushRed);
DeleteObject(hBrushGreen);
DeleteObject(hBrushBlue);
KillTimer(hwnd, IDT_TIMER_MRKALL);
}
return FALSE;
@ -4965,8 +4984,8 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
if (LOWORD(wParam) == IDT_TIMER_MRKALL)
{
if (TEST_AND_RESET(TIMER_BIT_MARK_OCC)) {
PostMessage(hwnd, WM_COMMAND, MAKELONG(IDC_MARKALL_OCC, 1), 0);
KillTimer(hwnd, IDT_TIMER_MRKALL);
PostMessage(hwnd, WM_COMMAND, MAKELONG(IDC_MARKALL_OCC, 1), 0);
}
return TRUE;
}
@ -5076,6 +5095,14 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
break;
case IDC_TOGGLE_VISIBILITY:
bHideNonMatchedLines = bHideNonMatchedLines ? FALSE : TRUE;
if (!bHideNonMatchedLines) {
SendMessage(g_hwndEdit, SCI_MARKERDELETEALL, (WPARAM)MARKER_NP3_OCCUR_LINE, 0);
Style_ResetCurrentLexer(g_hwndEdit);
}
// fall-through
case IDC_ALL_OCCURRENCES:
{
if (IsDlgButtonChecked(hwnd, IDC_ALL_OCCURRENCES) == BST_CHECKED)
@ -5085,29 +5112,32 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_ONOFF, FALSE);
iMarkOccurrences = 0;
bSaveOccVisible = bMarkOccurrencesMatchVisible;
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_VISIBLE, FALSE);
bMarkOccurrencesMatchVisible = FALSE;
DialogEnableWindow(hwnd, IDC_TOGGLE_VISIBILITY, TRUE);
}
else { // switched OFF
lpefr->bMarkOccurences = FALSE;
if (iSaveMarkOcc >= 0) {
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_ONOFF, TRUE);
if (iSaveMarkOcc != 0) {
SendMessage(g_hwndMain, WM_COMMAND, (WPARAM)MAKELONG(IDM_VIEW_MARKOCCUR_ONOFF, 1), 0);
}
if (bHideNonMatchedLines) {
bHideNonMatchedLines = false;
SendMessage(g_hwndEdit, SCI_MARKERDELETEALL, (WPARAM)MARKER_NP3_OCCUR_LINE, 0);
Style_ResetCurrentLexer(g_hwndEdit);
}
iSaveMarkOcc = -1;
iMarkOccurrences = iSaveMarkOcc;
bMarkOccurrencesMatchVisible = bSaveOccVisible;
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_VISIBLE, bMarkOccurrencesMatchVisible);
bSaveOccVisible = FALSE;
if (iMarkOccurrences >= 0) {
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_ONOFF, TRUE);
}
DialogEnableWindow(hwnd, IDC_TOGGLE_VISIBILITY, FALSE);
EditClearAllMarks(g_hwndEdit, 0, -1);
InvalidateRect(GetDlgItem(hwnd, IDC_FINDTEXT), NULL, TRUE);
}
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_VISIBLE, bMarkOccurrencesMatchVisible);
bFlagsChanged = TRUE;
_SetTimerMarkAll(hwnd,0);
}
break;
// called on timer trigger
case IDC_MARKALL_OCC:
{
@ -5124,9 +5154,10 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
_FindHasMatch(g_hwndEdit, lpefr, FALSE, TRUE);
bFlagsChanged = FALSE;
InvalidateRect(GetDlgItem(hwnd, IDC_FINDTEXT), NULL, TRUE);
EditHideNotMarkedLineRange(g_hwndEdit, -1, -1, bHideNonMatchedLines);
UpdateToolbar();
UpdateStatusbar();
}
UpdateToolbar();
UpdateStatusbar();
}
}
break;
@ -6055,6 +6086,8 @@ void EditClearAllMarks(HWND hwnd, DocPos iRangeStart, DocPos iRangeEnd)
}
SendMessage(hwnd, SCI_SETINDICATORCURRENT, INDIC_NP3_MARK_OCCURANCE, 0);
SendMessage(hwnd, SCI_INDICATORCLEARRANGE, iRangeStart, iRangeEnd);
// clear occurrences line marker
SendMessage(hwnd, SCI_MARKERDELETEALL, (WPARAM)MARKER_NP3_OCCUR_LINE, 0);
}
@ -6148,8 +6181,9 @@ void EditMarkAll(HWND hwnd, char* pszFind, int flags, DocPos rangeStart, DocPos
if (iPos < 0)
break; // not found
//// mark this match if not done before
// mark this match if not done before
SciCall_IndicatorFillRange(iPos, (end - start));
SciCall_MarkerAdd(SciCall_LineFromPosition(iPos), MARKER_NP3_OCCUR_LINE);
start = end;
end = rangeEnd;
@ -6349,6 +6383,84 @@ void EditUpdateUrlHotspots(HWND hwnd, DocPos startPos, DocPos endPos, BOOL bActi
}
//=============================================================================
//
// EditHideNotMarkedLineRange()
//
void EditHideNotMarkedLineRange(HWND hwnd, DocPos iStartPos, DocPos iEndPos, bool bHide)
{
static bool bLastState = true;
//UNUSED(hwnd);
if (!bHide) {
//SendMessage(hwnd, SCI_FOLDALL, (WPARAM)SC_FOLDACTION_EXPAND, 0);
bLastState = bHide;
return;
}
if (iEndPos < iStartPos) {
swapos(&iStartPos, &iEndPos);
}
if (iStartPos < 0 || iEndPos < 0) {
iStartPos = 0;
iEndPos = SciCall_GetTextLength();
}
IgnoreNotifyChangeEvent();
SciCall_SetFoldFlags(0);
// 1st apply current lexer style
EditFinalizeStyling(hwnd, iStartPos);
// hide lines without indicator
const int iOccurrenceBit = (1 << MARKER_NP3_OCCUR_LINE);
const int iStyleHideID = Style_GetInvisibleStyleID();
const DocLn iStartLine = SciCall_LineFromPosition(iStartPos);
const DocLn iEndLine = SciCall_LineFromPosition(iEndPos);
const int baseLevel = SC_FOLDLEVELBASE;
const int hiddenLevel = SC_FOLDLEVELBASE + 1;
bool bHdrFlag = false;
for (DocLn iLine = iStartLine; iLine <= iEndLine; ++iLine)
{
const bool bIsHidden = ((SciCall_MarkerGet(iLine) & iOccurrenceBit) == 0);
if (bIsHidden) {
SciCall_StartStyling(SciCall_PositionFromLine(iLine));
SciCall_SetStyling((DocPosCR)SciCall_LineLength(iLine), iStyleHideID);
}
if (bIsHidden) {
if (!bHdrFlag) {
SendMessage(hwnd, SCI_SETFOLDLEVEL, (WPARAM)iLine, (LPARAM)(baseLevel | SC_FOLDLEVELHEADERFLAG));
bHdrFlag = true;
}
else
SendMessage(hwnd, SCI_SETFOLDLEVEL, (WPARAM)iLine, (LPARAM)hiddenLevel);
}
else {
SendMessage(hwnd, SCI_SETFOLDLEVEL, (WPARAM)iLine, (LPARAM)baseLevel);
bHdrFlag = false;
}
}
if (iEndPos < SciCall_GetTextLength()) {
SciCall_StartStyling(SciCall_GetLineEndPosition(iEndPos));
EditFinalizeStyling(hwnd, SciCall_GetTextLength());
}
ObserveNotifyChangeEvent();
SendMessage(hwnd, SCI_FOLDALL, (WPARAM)SC_FOLDACTION_CONTRACT, 0);
}
//=============================================================================
//
// EditHighlightIfBrace()

View File

@ -28,12 +28,12 @@ typedef struct _editfindreplace
char szReplace[FNDRPL_BUFFER];
UINT fuFlags;
BOOL bTransformBS;
BOOL bObsolete /* was bFindUp */;
BOOL bFindClose;
BOOL bReplaceClose;
BOOL bNoFindWrap;
BOOL bWildcardSearch;
BOOL bMarkOccurences;
BOOL bHideNonMatchedLines;
BOOL bDotMatchAll;
HWND hwnd;
@ -46,6 +46,7 @@ typedef struct _editfindreplace
#define IDMSG_SWITCHTOREPLACE 301
#define MARKER_NP3_BOOKMARK 0
#define MARKER_NP3_OCCUR_LINE 1
#define INDIC_NP3_MARK_OCCURANCE 1
#define INDIC_NP3_MATCH_BRACE 2
@ -138,6 +139,7 @@ void EditFinalizeStyling(HWND, DocPos);
void EditMarkAllOccurrences();
void EditUpdateVisibleUrlHotspot(BOOL);
void EditHideNotMarkedLineRange(HWND, DocPos, DocPos, bool);
void EditEnterTargetTransaction();
void EditLeaveTargetTransaction();

View File

@ -4111,7 +4111,6 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
else
SendMessage(g_hwndEdit,SCI_SETWRAPMODE,(iWordWrapMode == 0) ? SC_WRAP_WHITESPACE : SC_WRAP_CHAR,0);
bWordWrapG = bWordWrap;
//EditApplyLexerStyle(g_hwndEdit, 0, -1);
UpdateToolbar();
break;
@ -5432,6 +5431,7 @@ LRESULT MsgNotify(HWND hwnd,WPARAM wParam,LPARAM lParam)
// {
// int lineNumber = SciCall_LineFromPosition(SciCall_GetEndStyled());
// EditUpdateUrlHotspots(g_hwndEdit, SciCall_PositionFromLine(lineNumber), (int)scn->position, bHyperlinkHotspot);
// EditUpdateHiddenLineRange(hwnd, &g_efrData, 0, SciCall_GetLineCount());
// }
// break;
@ -5492,7 +5492,9 @@ LRESULT MsgNotify(HWND hwnd,WPARAM wParam,LPARAM lParam)
}
}
else if (scn->modificationType & SC_MOD_CHANGESTYLE) {
EditUpdateUrlHotspots(g_hwndEdit, (int)scn->position, (int)(scn->position + scn->length), bHyperlinkHotspot);
const DocPos iStartPos = (DocPos)scn->position;
const DocPos iEndPos = (DocPos)(scn->position + scn->length);
EditUpdateUrlHotspots(g_hwndEdit, iStartPos, iEndPos, bHyperlinkHotspot);
}
if (iMarkOccurrences) {
@ -5873,27 +5875,18 @@ void LoadSettings()
bEnableSaveSettings = TRUE;
bSaveSettings = IniSectionGetBool(pIniSection,L"SaveSettings",TRUE);
bSaveRecentFiles = IniSectionGetBool(pIniSection,L"SaveRecentFiles",FALSE);
bPreserveCaretPos = IniSectionGetBool(pIniSection, L"PreserveCaretPos",FALSE);
bSaveFindReplace = IniSectionGetBool(pIniSection,L"SaveFindReplace",FALSE);
g_efrData.bFindClose = IniSectionGetBool(pIniSection,L"CloseFind", FALSE);
g_efrData.bReplaceClose = IniSectionGetBool(pIniSection,L"CloseReplace", FALSE);
g_efrData.bNoFindWrap = IniSectionGetBool(pIniSection,L"NoFindWrap", FALSE);
g_efrData.bTransformBS = IniSectionGetBool(pIniSection,L"FindTransformBS", FALSE);
g_efrData.bWildcardSearch = IniSectionGetBool(pIniSection,L"WildcardSearch",FALSE);
g_efrData.bMarkOccurences = IniSectionGetBool(pIniSection, L"FindMarkAllOccurrences", FALSE);
g_efrData.bHideNonMatchedLines = IniSectionGetBool(pIniSection, L"HideNonMatchedLines", FALSE);
g_efrData.bDotMatchAll = IniSectionGetBool(pIniSection, L"RegexDotMatchesAll", FALSE);
g_efrData.fuFlags = IniSectionGetUInt(pIniSection, L"efrData_fuFlags", 0);
if (!IniSectionGetString(pIniSection, L"OpenWithDir", L"", tchOpenWithDir, COUNTOF(tchOpenWithDir))) {
@ -6264,6 +6257,7 @@ void SaveSettings(BOOL bSaveSettingsNow) {
IniSectionSetBool(pIniSection, L"FindTransformBS", g_efrData.bTransformBS);
IniSectionSetBool(pIniSection, L"WildcardSearch", g_efrData.bWildcardSearch);
IniSectionSetBool(pIniSection, L"FindMarkAllOccurrences", g_efrData.bMarkOccurences);
IniSectionSetBool(pIniSection, L"HideNonMatchedLines", g_efrData.bHideNonMatchedLines);
IniSectionSetBool(pIniSection, L"RegexDotMatchesAll", g_efrData.bDotMatchAll);
IniSectionSetInt(pIniSection, L"efrData_fuFlags", g_efrData.fuFlags);
PathRelativeToApp(tchOpenWithDir, wchTmp, COUNTOF(wchTmp), FALSE, TRUE, flagPortableMyDocs);

View File

@ -169,10 +169,10 @@ BEGIN
MENUITEM "Move &Up\tCtrl+Shift+Up", IDM_EDIT_MOVELINEUP
MENUITEM "&Move Down\tCtrl+Shift+Down", IDM_EDIT_MOVELINEDOWN
MENUITEM SEPARATOR
MENUITEM "Cut &Line\tCtrl[+Shift]+X", IDM_EDIT_CUTLINE
MENUITEM "&Copy Line\tCtrl[+Shift]+C", IDM_EDIT_COPYLINE
MENUITEM "Cut &Line\tCtrl[+Shift]+X", IDM_EDIT_CUTLINE
MENUITEM "&Copy Line\tCtrl[+Shift]+C", IDM_EDIT_COPYLINE
MENUITEM "&Duplicate Line\tCtrl+D", IDM_EDIT_DUPLICATELINE
MENUITEM "D&elete Line\tCtrl+Shift+D", IDM_EDIT_DELETELINE
MENUITEM "D&elete Line\tCtrl+Shift+D", IDM_EDIT_DELETELINE
MENUITEM SEPARATOR
MENUITEM "Delete Line Left\tCtrl+Shift+Back", IDM_EDIT_DELETELINELEFT
MENUITEM "Delete Line Right\tCtrl+Shift+Del", IDM_EDIT_DELETELINERIGHT
@ -185,7 +185,7 @@ BEGIN
MENUITEM SEPARATOR
MENUITEM "Mer&ge Empty Lines\tAlt+Y", IDM_EDIT_MERGEEMPTYLINES
MENUITEM "Merge Whitespace Lines\tCtrl+Alt+Y", IDM_EDIT_MERGEBLANKLINES
MENUITEM "&Remove Empty Lines\tAlt+R", IDM_EDIT_REMOVEEMPTYLINES
MENUITEM "&Remove Empty Lines\tAlt+R", IDM_EDIT_REMOVEEMPTYLINES
MENUITEM "Remove Whitespace Lines\tCtrl+Alt+B", IDM_EDIT_REMOVEBLANKLINES
MENUITEM "Rem&ove Duplicate Lines\tCtrl+Alt+D", IDM_EDIT_REMOVEDUPLICATELINES
END
@ -286,7 +286,7 @@ BEGIN
MENUITEM "Save Find Text\tAlt+F3", IDM_EDIT_SAVEFIND
MENUITEM "Find Ne&xt\tF3", IDM_EDIT_FINDNEXT
MENUITEM "Find Pre&vious\tShift+F3", IDM_EDIT_FINDPREV
MENUITEM "Find Next Selected\tCtrl+F3", CMD_FINDNEXTSEL
MENUITEM "Find Next Selected\tCtrl+F3", CMD_FINDNEXTSEL
MENUITEM "Find Previous Selected\tCtrl+Shift+F3", CMD_FINDPREVSEL
MENUITEM "&Replace...\tCtrl+H", IDM_EDIT_REPLACE
MENUITEM "Replace Ne&xt\tF4", IDM_EDIT_REPLACENEXT
@ -340,8 +340,8 @@ BEGIN
MENUITEM "Zoom &Out\tCtrl+-", IDM_VIEW_ZOOMOUT
MENUITEM "Reset &Zoom\tCtrl+0", IDM_VIEW_RESETZOOM
MENUITEM SEPARATOR
MENUITEM "Copy Position Args\tCtrl+Shift+K", CMD_COPYWINPOS
MENUITEM "Snap to Default Position\tCtrl+Shift+P", CMD_DEFAULTWINPOS
MENUITEM "Copy Position Args\tCtrl+Shift+K", CMD_COPYWINPOS
MENUITEM "Snap to Default Position\tCtrl+Shift+P", CMD_DEFAULTWINPOS
MENUITEM "Scroll Past End of &File", IDM_VIEW_SCROLLPASTEOF
END
POPUP "&Settings"
@ -699,6 +699,7 @@ BEGIN
CONTROL "<a>(?)</a>",IDC_BACKSLASHHELP,"SysLink",0x0,106,73,14,10
CONTROL "<a>(?)</a>",IDC_WILDCARDHELP,"SysLink",0x0,191,85,14,10
CONTROL "",IDS_FR_STATUS_TEXT,"Static",SS_LEFTNOWORDWRAP,7,117,259,9,WS_EX_STATICEDGE
PUSHBUTTON "Toggle Visibility",IDC_TOGGLE_VISIBILITY,211,65,55,14
END
IDD_REPLACE DIALOGEX 0, 0, 273, 156
@ -721,10 +722,10 @@ BEGIN
CONTROL "Mark &Occurrences",IDC_ALL_OCCURRENCES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,90,73,10
CONTROL "W&ildcard Search",IDC_WILDCARDSEARCH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,114,63,10
DEFPUSHBUTTON "&Find Next",IDOK,211,7,55,14
PUSHBUTTON "Find &Previous",IDC_FINDPREV,211,24,55,14
PUSHBUTTON "&Replace",IDC_REPLACE,211,53,55,14
PUSHBUTTON "In &Selection",IDC_REPLACEINSEL,211,70,55,14
PUSHBUTTON "Replace &All",IDC_REPLACEALL,211,88,55,14
PUSHBUTTON "Find &Previous",IDC_FINDPREV,211,23,55,14
PUSHBUTTON "&Replace",IDC_REPLACE,211,43,55,14
PUSHBUTTON "In &Selection",IDC_REPLACEINSEL,211,59,55,14
PUSHBUTTON "Replace &All",IDC_REPLACEALL,211,75,55,14
PUSHBUTTON "Swap Strings",IDC_SWAPSTRG,149,32,49,12
PUSHBUTTON "Close",IDCANCEL,211,126,55,14
CONTROL "<a>Goto Find (Ctrl+F)</a>",IDC_TOGGLEFINDREPLACE,
@ -733,6 +734,7 @@ BEGIN
CONTROL "<a>(?)</a>",IDC_REGEXPHELP,"SysLink",0x0,107,114,14,10
CONTROL "<a>(?)</a>",IDC_WILDCARDHELP,"SysLink",0x0,191,114,14,10
CONTROL "",IDS_FR_STATUS_TEXT,"Static",SS_LEFTNOWORDWRAP,7,144,259,9,WS_EX_STATICEDGE
PUSHBUTTON "Toggle Visibility",IDC_TOGGLE_VISIBILITY,211,94,55,14
END
IDD_RUN DIALOGEX 0, 0, 229, 96

View File

@ -278,9 +278,11 @@ DeclareSciCallV2(SetFoldMarginHiColour, SETFOLDMARGINHICOLOUR, bool, useSetting,
//
// Markers
//
DeclareSciCallR1(MarkerGet, MARKERGET, int, DocLn, line)
DeclareSciCallV2(MarkerDefine, MARKERDEFINE, int, markerNumber, int, markerSymbols)
DeclareSciCallV2(MarkerSetFore, MARKERSETFORE, int, markerNumber, COLORREF, colour)
DeclareSciCallV2(MarkerSetBack, MARKERSETBACK, int, markerNumber, COLORREF, colour)
DeclareSciCallV2(MarkerAdd, MARKERADD, DocLn, line, int, markerNumber)
//=============================================================================
@ -299,6 +301,7 @@ DeclareSciCallV2(IndicatorFillRange, INDICATORFILLRANGE, DocPos, position, DocPo
DeclareSciCallR1(GetLineVisible, GETLINEVISIBLE, bool, DocLn, line)
DeclareSciCallR1(GetFoldLevel, GETFOLDLEVEL, int, DocLn, line)
DeclareSciCallV1(SetFoldFlags, SETFOLDFLAGS, int, flags)
DeclareSciCallV1(FoldDisplayTextSetStyle, FOLDDISPLAYTEXTSETSTYLE, int, flags)
DeclareSciCallR1(GetFoldParent, GETFOLDPARENT, int, DocLn, line)
DeclareSciCallR1(GetFoldExpanded, GETFOLDEXPANDED, int, DocLn, line)
DeclareSciCallV1(ToggleFold, TOGGLEFOLD, DocLn, line)

View File

@ -47,6 +47,7 @@ extern HINSTANCE g_hInstance;
extern HWND g_hwndMain;
extern HWND g_hwndDlgCustomizeSchemes;
extern EDITFINDREPLACE g_efrData;
extern int iSciFontQuality;
extern const int FontQuality[4];
@ -123,7 +124,8 @@ enum LexDefaultStyles {
STY_X_LN_SPACE = 11,
STY_BOOK_MARK = 12,
STY_MARK_OCC = 13,
STY_URL_HOTSPOT = 14
STY_URL_HOTSPOT = 14,
STY_INVISIBLE = 15
};
@ -3387,7 +3389,7 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
Style_SetFontQuality(hwnd, wchStandardStyleStrg);
SendMessage(hwnd, SCI_STYLESETVISIBLE, STYLE_DEFAULT, (LPARAM)TRUE);
SendMessage(hwnd, SCI_STYLESETHOTSPOT, STYLE_DEFAULT, (LPARAM)FALSE); // default hotspot off
// customizable
@ -3834,15 +3836,18 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
}
}
Style_SetInvisible(hwnd, true); // set fixed invisible style
// apply lexer styles
Style_SetUrlHotSpot(hwnd, FALSE);
EditApplyLexerStyle(g_hwndEdit, 0, -1);
EditApplyLexerStyle(hwnd, 0, -1);
// update UI for hotspots
if (bHyperlinkHotspot) {
Style_SetUrlHotSpot(hwnd, bHyperlinkHotspot);
EditUpdateUrlHotspots(hwnd, 0, SciCall_GetTextLength(), bHyperlinkHotspot);
}
UpdateLineNumberWidth();
}
@ -3904,6 +3909,28 @@ void Style_SetUrlHotSpot(HWND hwnd, BOOL bHotSpot)
}
//=============================================================================
//
// Style_GetInvisibleStyleID()
//
int Style_GetInvisibleStyleID()
{
return (STYLE_LASTPREDEFINED + STY_INVISIBLE);
}
//=============================================================================
//
// Style_SetInvisible()
//
void Style_SetInvisible(HWND hwnd, bool bInvisible)
{
SendMessage(hwnd, SCI_MARKERDEFINE, MARKER_NP3_OCCUR_LINE, SC_MARK_EMPTY); // occurrences marker
SendMessage(hwnd, SCI_STYLESETVISIBLE, Style_GetInvisibleStyleID(), (LPARAM)!bInvisible);
}
//=============================================================================
//
// Style_SetLongLineColors()
@ -4090,6 +4117,8 @@ void Style_SetMargin(HWND hwnd, int iStyle, LPCWSTR lpszStyle)
SciCall_SetFoldMarginColour(TRUE, clrBack); // background
SciCall_SetFoldMarginHiColour(TRUE, clrBack); // (!)
SciCall_FoldDisplayTextSetStyle(SC_FOLDDISPLAYTEXT_HIDDEN);
for (int i = 0; i < COUNTOF(iMarkerIDs); ++i) {
SciCall_MarkerSetBack(iMarkerIDs[i], bmkFore);
SciCall_MarkerSetFore(iMarkerIDs[i], bmkBack);

View File

@ -71,6 +71,7 @@ BOOL Style_Import(HWND);
BOOL Style_Export(HWND);
void Style_SetLexer(HWND,PEDITLEXER);
void Style_SetUrlHotSpot(HWND, BOOL);
void Style_SetInvisible(HWND, bool);
void Style_SetLongLineColors(HWND);
void Style_SetCurrentLineBackground(HWND, BOOL);
void Style_SetFolding(HWND, BOOL);
@ -116,6 +117,7 @@ HWND Style_CustomizeSchemesDlg(HWND);
INT_PTR CALLBACK Style_SelectLexerDlgProc(HWND,UINT,WPARAM,LPARAM);
void Style_SelectLexerDlg(HWND);
int Style_GetHotspotStyleID();
int Style_GetInvisibleStyleID();
int Style_StrGetWeightValue(LPCWSTR,int*);
void Style_AppendWeightStr(LPWSTR, int, int);

File diff suppressed because it is too large Load Diff