diff --git a/src/Dialogs.c b/src/Dialogs.c index 0977dbd39..b381b8ff0 100644 --- a/src/Dialogs.c +++ b/src/Dialogs.c @@ -1901,7 +1901,7 @@ INT_PTR CALLBACK LongLineSettingsDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARA BOOL fTranslated; - int iNewNumber = GetDlgItemInt(hwnd,100,&fTranslated,FALSE); + UINT iNewNumber = GetDlgItemInt(hwnd,100,&fTranslated,FALSE); if (fTranslated) { @@ -2009,8 +2009,8 @@ INT_PTR CALLBACK TabSettingsDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lPa BOOL fTranslated1,fTranslated2; - int iNewTabWidth = GetDlgItemInt(hwnd,100,&fTranslated1,FALSE); - int iNewIndentWidth = GetDlgItemInt(hwnd,101,&fTranslated2,FALSE); + UINT iNewTabWidth = GetDlgItemInt(hwnd,100,&fTranslated1,FALSE); + UINT iNewIndentWidth = GetDlgItemInt(hwnd,101,&fTranslated2,FALSE); if (fTranslated1 && fTranslated2) { diff --git a/src/Dialogs.h b/src/Dialogs.h index a95624fb9..056821a03 100644 --- a/src/Dialogs.h +++ b/src/Dialogs.h @@ -15,7 +15,8 @@ #pragma once #ifndef _NP3_DIALOGS_H_ #define _NP3_DIALOGS_H_ -#include + +#include "TypeDefs.h" #define MBINFO 0 #define MBWARN 1 @@ -44,15 +45,6 @@ bool RecodeDlg(HWND,int *); bool SelectDefLineEndingDlg(HWND,int *); -typedef struct _wi -{ - int x; - int y; - int cx; - int cy; - int max; -} WININFO; - WININFO GetMyWindowPlacement(HWND,MONITORINFO *); void DialogNewWindow(HWND,bool,bool); diff --git a/src/Edit.c b/src/Edit.c index abf1f7a59..991e4c59f 100644 --- a/src/Edit.c +++ b/src/Edit.c @@ -164,10 +164,12 @@ extern bool bMarkOccurrencesMatchWords; // Timer bitfield static volatile LONG g_lTargetTransactionBits = 0; -#define TIMER_BIT_MARK_OCC 1L -#define BLOCK_BIT_TARGET_TRANSACTION 2L -#define TEST_AND_SET(B) InterlockedBitTestAndSet(&g_lTargetTransactionBits, B) -#define TEST_AND_RESET(B) InterlockedBitTestAndReset(&g_lTargetTransactionBits, B) +#define BIT_TIMER_MARK_OCC 1L +#define BIT_MARK_OCC_IN_PROGRESS 2L +#define BLOCK_BIT_TARGET_TRANSACTION 4L + +#define TEST_AND_SET(BIT) InterlockedBitTestAndSet(&g_lTargetTransactionBits, BIT) +#define TEST_AND_RESET(BIT) InterlockedBitTestAndReset(&g_lTargetTransactionBits, BIT) //============================================================================= @@ -4326,7 +4328,7 @@ void EditSelectEx(HWND hwnd, DocPos iAnchorPos, DocPos iCurrentPos, int vSpcAnch if (abs(iNewLine - iAnchorLine) < SciCall_LinesOnScreen()) { - EditScrollTo(hwnd, (iAnchorLine + iNewLine) / 2, true); // center small selection + EditScrollTo(hwnd, (iAnchorLine + iNewLine) / 2, -1); // center small selection } // remember x-pos for moving caret vertically SciCall_ChooseCaretX(); @@ -4368,26 +4370,16 @@ void EditEnsureSelectionVisible(HWND hwnd) // // EditScrollTo() // -void EditScrollTo(HWND hwnd, DocLn iScrollToLine, bool bForceCenter) +void EditScrollTo(HWND hwnd, DocLn iScrollToLine, int iSlop) { UNUSED(hwnd); - const DocLn iVisTopLine = SciCall_GetFirstVisibleLine(); const int iXoff = SciCall_GetXoffset(); - const DocLn iMaxLine = SciCall_GetLineCount() - 1; + const int iLinesOnScreen = SciCall_LinesOnScreen(); + const DocLn iSlopLines = ((iSlop < 0) || (iSlop >= iLinesOnScreen)) ? (iLinesOnScreen/2) : iSlop; - iScrollToLine = min(iScrollToLine, iMaxLine); - const DocPos iViewPos = SciCall_PositionFromLine(iScrollToLine); - - SciCall_ScrollRange(iViewPos, iViewPos); - - // center line in view (if not already in view) - const DocLn iNewVisTopLine = SciCall_GetFirstVisibleLine(); - if ((iNewVisTopLine != iVisTopLine) || bForceCenter) { - const DocLn iScrollLines = SciCall_LinesOnScreen() / 2; - const int iScrollCnt = (iScrollToLine - iNewVisTopLine - iScrollLines); - if (iScrollCnt != 0) { SciCall_LineScroll(0, iScrollCnt); } - } + SciCall_SetVisiblePolicy((VISIBLE_SLOP | VISIBLE_STRICT), iSlopLines); + SciCall_EnsureVisibleEnforcePolicy(iScrollToLine); SciCall_SetXoffset(iXoff); } @@ -4412,7 +4404,7 @@ void EditJumpTo(HWND hwnd, DocLn iNewLine, DocPos iNewCol) const DocPos iNewPos = SciCall_FindColumn(iNewLine, iNewCol); SciCall_GotoPos(iNewPos); - EditScrollTo(hwnd, iNewLine, false); + EditScrollTo(hwnd, iNewLine, -1); // remember x-pos for moving caret vertically SciCall_ChooseCaretX(); @@ -4722,14 +4714,14 @@ static RegExResult_t __fastcall _FindHasMatch(HWND hwnd, LPCEDITFINDREPLACE lpef if (iPos >= 0) { const DocLn scrollToLn = SciCall_LineFromPosition(iPos); if (scrollToLn != lastScrollToLn) { - EditScrollTo(hwnd, scrollToLn, true); + EditScrollTo(hwnd, scrollToLn, -1); lastScrollToLn = scrollToLn; } } else { const DocLn scrollToLn = SciCall_LineFromPosition(iStart); if (scrollToLn != lastScrollToLn) { - EditScrollTo(hwnd, scrollToLn, false); + EditScrollTo(hwnd, scrollToLn, -1); lastScrollToLn = scrollToLn; } } @@ -4750,17 +4742,23 @@ static RegExResult_t __fastcall _FindHasMatch(HWND hwnd, LPCEDITFINDREPLACE lpef //============================================================================= // // _SetTimerMarkAll() +// // static void __fastcall _SetTimerMarkAll(HWND hwnd, int delay) { + if (TEST_AND_RESET(BIT_TIMER_MARK_OCC)) { + TEST_AND_SET(BIT_TIMER_MARK_OCC); // in progress + return; + } + + TEST_AND_SET(BIT_TIMER_MARK_OCC); // raise flag to swollow next calls + if (delay < USER_TIMER_MINIMUM) { - TEST_AND_RESET(TIMER_BIT_MARK_OCC); - KillTimer(hwnd, IDT_TIMER_MRKALL); - SendMessage(hwnd, WM_COMMAND, MAKELONG(IDC_MARKALL_OCC, 1), 0); - return; + SendMessage(hwnd, WM_TIMER, MAKELONG(IDT_TIMER_MRKALL, 1), 0); // direct timer event + } + else { + SetTimer(hwnd, IDT_TIMER_MRKALL, delay, NULL); } - TEST_AND_SET(TIMER_BIT_MARK_OCC); - SetTimer(hwnd, IDT_TIMER_MRKALL, delay, NULL); } @@ -4986,12 +4984,34 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA case WM_TIMER: { + // The KillTimer function does not remove WM_TIMER messages already posted to the message queue. if (LOWORD(wParam) == IDT_TIMER_MRKALL) { - if (TEST_AND_RESET(TIMER_BIT_MARK_OCC)) { - KillTimer(hwnd, IDT_TIMER_MRKALL); - PostMessage(hwnd, WM_COMMAND, MAKELONG(IDC_MARKALL_OCC, 1), 0); + KillTimer(hwnd, IDT_TIMER_MRKALL); + if (!TEST_AND_RESET(BIT_MARK_OCC_IN_PROGRESS)) // stay in progress + { + TEST_AND_SET(BIT_MARK_OCC_IN_PROGRESS); // start progress + iMarkOccurrencesCount = 0; + _SetSearchFlags(hwnd, lpefr); + if (lpefr->bMarkOccurences) { + if (bFlagsChanged || (StringCchCompareXA(g_lastFind, lpefr->szFind) != 0)) { + StringCchCopyA(g_lastFind, COUNTOF(g_lastFind), lpefr->szFind); + RegExResult_t match = _FindHasMatch(g_hwndEdit, lpefr, (lpefr->bMarkOccurences), false); + if (regexMatch != match) { + regexMatch = match; + } + // we have to set Sci's regex instance to first find (have substitution in place) + _FindHasMatch(g_hwndEdit, lpefr, false, true); + bFlagsChanged = false; + InvalidateRect(GetDlgItem(hwnd, IDC_FINDTEXT), NULL, true); + if (bHideNonMatchedLines) { EditHideNotMarkedLineRange(g_hwndEdit, -1, -1, true); } + UpdateToolbar(); + UpdateStatusbar(); + } + } + TEST_AND_RESET(BIT_MARK_OCC_IN_PROGRESS); // done } + TEST_AND_RESET(BIT_TIMER_MARK_OCC); // ready for new events return true; } } @@ -5004,6 +5024,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA lpefr = (LPEDITFINDREPLACE)GetWindowLongPtr(hwnd, DWLP_USER); if (lpefr->bMarkOccurences) { + bFlagsChanged = true; // main window has been edited maybe _SetTimerMarkAll(hwnd,50); } //if (LOWORD(wParam) == WA_INACTIVE) { @@ -5096,10 +5117,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA SendDlgItemMessage(hwnd, LOWORD(wParam), CB_SETEDITSEL, 0, MAKELPARAM(lSelEnd, lSelEnd)); } - if (lpefr->bMarkOccurences) { - _SetTimerMarkAll(hwnd, 50); - } - + _SetTimerMarkAll(hwnd, 50); } break; @@ -5140,33 +5158,10 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA break; - // called on timer trigger - case IDC_MARKALL_OCC: - { - iMarkOccurrencesCount = 0; - _SetSearchFlags(hwnd, lpefr); - if (lpefr->bMarkOccurences) { - if (bFlagsChanged || (StringCchCompareXA(g_lastFind, lpefr->szFind) != 0)) { - StringCchCopyA(g_lastFind, COUNTOF(g_lastFind), lpefr->szFind); - RegExResult_t match = _FindHasMatch(g_hwndEdit, lpefr, (lpefr->bMarkOccurences), false); - if (regexMatch != match) { - regexMatch = match; - } - // we have to set Sci's regex instance to first find (have substitution in place) - _FindHasMatch(g_hwndEdit, lpefr, false, true); - bFlagsChanged = false; - InvalidateRect(GetDlgItem(hwnd, IDC_FINDTEXT), NULL, true); - if (bHideNonMatchedLines) { EditHideNotMarkedLineRange(g_hwndEdit, -1, -1, true); } - UpdateToolbar(); - UpdateStatusbar(); - } - } - } - break; - - case IDC_TOGGLE_VISIBILITY: { + BeginWaitCursor(NULL); + bHideNonMatchedLines = bHideNonMatchedLines ? false : true; EditClearAllMarks(g_hwndEdit, 0, -1); if (bHideNonMatchedLines) { @@ -5188,6 +5183,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA EditScrollTo(g_hwndEdit, Sci_GetCurrentLine(), true); SendMessage(g_hwndEdit, SCI_SETREADONLY, false, 0); } + EndWaitCursor(); } break; @@ -5783,6 +5779,7 @@ void EditMarkAllOccurrences() if (EditIsInTargetTransaction()) { return; } // do not block, next event occurs for sure + BeginWaitCursor(NULL); IgnoreNotifyChangeEvent(); EditEnterTargetTransaction(); @@ -5807,6 +5804,7 @@ void EditMarkAllOccurrences() } EditLeaveTargetTransaction(); ObserveNotifyChangeEvent(); + EndWaitCursor(); } else { @@ -5825,6 +5823,9 @@ void EditUpdateVisibleUrlHotspot(bool bEnabled) { if (EditIsInTargetTransaction()) { return; } // do not block, next event occurs for sure + BeginWaitCursor(NULL); + EditEnterTargetTransaction(); + // get visible lines for update DocLn iFirstVisibleLine = SciCall_DocLineFromVisible(SciCall_GetFirstVisibleLine()); @@ -5837,6 +5838,7 @@ void EditUpdateVisibleUrlHotspot(bool bEnabled) EditUpdateUrlHotspots(g_hwndEdit, iPosStart, iPosEnd, bEnabled); EditLeaveTargetTransaction(); + EndWaitCursor(); } } @@ -6447,10 +6449,11 @@ void EditHideNotMarkedLineRange(HWND hwnd, DocPos iStartPos, DocPos iEndPos, boo IgnoreNotifyChangeEvent(); g_bCodeFoldingAvailable = true; + SciCall_SetFoldFlags(0); + //SciCall_SetFoldFlags(SC_FOLDFLAG_LEVELNUMBERS | SC_FOLDFLAG_LINESTATE); // Debug + SciCall_SetProperty("fold", "1"); //SciCall_SetProperty("fold.compact", "1"); - //SciCall_SetFoldFlags(0); - SciCall_SetFoldFlags(SC_FOLDFLAG_LEVELNUMBERS | SC_FOLDFLAG_LINESTATE); // 1st apply current lexer style EditFinalizeStyling(hwnd, iStartPos); @@ -6459,16 +6462,30 @@ void EditHideNotMarkedLineRange(HWND hwnd, DocPos iStartPos, DocPos iEndPos, boo const int iOccBitMask = (1 << MARKER_NP3_OCCUR_LINE); const int iStyleHideID = Style_GetInvisibleStyleID(); - const int baseLevel = SC_FOLDLEVELBASE; - const int headerLevel = (baseLevel) | SC_FOLDLEVELHEADERFLAG; - const int hiddenLevel = (baseLevel + 1) | SC_FOLDLEVELWHITEFLAG; + //const int baseLevel = SC_FOLDLEVELBASE; + //const int headerLevel = (baseLevel) | SC_FOLDLEVELHEADERFLAG; + //const int hiddenLevel = (baseLevel + 1) | SC_FOLDLEVELWHITEFLAG; const DocLn iStartLine = SciCall_LineFromPosition(iStartPos); const DocLn iEndLine = SciCall_LineFromPosition(iEndPos); - bool bHdrFlag = false; + const int baseLevel = SciCall_GetFoldLevel(iStartLine) & SC_FOLDLEVELNUMBERMASK; + // clear levels to avoid multi rearangements on existing lexer provided levels for (DocLn iLine = iStartLine; iLine <= iEndLine; ++iLine) + { + SciCall_SetFoldLevel(iLine, baseLevel); + } + + // 1st line + if ((SciCall_MarkerGet(iStartLine) & iOccBitMask) == 0) + { // hide + SciCall_StartStyling(SciCall_PositionFromLine(iStartLine)); + SciCall_SetStyling((DocPosCR)SciCall_LineLength(iStartLine), iStyleHideID); + } + + int level = baseLevel; + for (DocLn iLine = iStartLine + 1; iLine <= iEndLine; ++iLine) { const int markerSet = SciCall_MarkerGet(iLine); if (markerSet != -1) @@ -6476,20 +6493,18 @@ void EditHideNotMarkedLineRange(HWND hwnd, DocPos iStartPos, DocPos iEndPos, boo const bool bIsVisible = (markerSet & iOccBitMask); if (bIsVisible) { - SciCall_SetFoldLevel(iLine, baseLevel); - bHdrFlag = false; + while (level > baseLevel) { --level; } + SciCall_SetFoldLevel(iLine, level); } - else { + else // hide line + { SciCall_StartStyling(SciCall_PositionFromLine(iLine)); SciCall_SetStyling((DocPosCR)SciCall_LineLength(iLine), iStyleHideID); - if (!bHdrFlag) { - SciCall_SetFoldLevel(iLine, headerLevel); - bHdrFlag = true; - } - else { - SciCall_SetFoldLevel(iLine, hiddenLevel); + if (level == baseLevel) { + SciCall_SetFoldLevel(iLine - 1, SC_FOLDLEVELHEADERFLAG | level++); } + SciCall_SetFoldLevel(iLine, SC_FOLDLEVELWHITEFLAG | level); } } } @@ -6624,14 +6639,14 @@ INT_PTR CALLBACK EditLinenumDlgProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lPa case IDOK: { BOOL fTranslated = TRUE; - int iNewLine = (int)GetDlgItemInt(hwnd,IDC_LINENUM,&fTranslated,FALSE); + DocLn iNewLine = (DocLn)GetDlgItemInt(hwnd,IDC_LINENUM,&fTranslated,FALSE); DocLn iMaxLine = (DocLn)SendMessage(g_hwndEdit,SCI_GETLINECOUNT,0,0); DocPos iNewCol = 1; BOOL fTranslated2 = TRUE; if (SendDlgItemMessage(hwnd, IDC_COLNUM, WM_GETTEXTLENGTH, 0, 0) > 0) { - iNewCol = GetDlgItemInt(hwnd, IDC_COLNUM, &fTranslated2, FALSE); + iNewCol = (DocPos)GetDlgItemInt(hwnd, IDC_COLNUM, &fTranslated2, FALSE); } if (!fTranslated || !fTranslated2) diff --git a/src/Edit.h b/src/Edit.h index 79cb8636c..2f823b20c 100644 --- a/src/Edit.h +++ b/src/Edit.h @@ -104,7 +104,7 @@ void EditJoinLinesEx(HWND,bool,bool); void EditSortLines(HWND,int); void EditJumpTo(HWND, DocLn, DocPos); -void EditScrollTo(HWND, DocLn, bool); +void EditScrollTo(HWND, DocLn, int); void EditSelectEx(HWND, DocPos, DocPos, int, int); void EditFixPositions(HWND); void EditEnsureSelectionVisible(HWND); diff --git a/src/Helpers.c b/src/Helpers.c index 6da49f5f4..5aec6eb24 100644 --- a/src/Helpers.c +++ b/src/Helpers.c @@ -469,18 +469,18 @@ int CALLBACK EnumFontsProc(CONST LOGFONT *plf,CONST TEXTMETRIC *ptm,DWORD FontTy UNUSED(plf); UNUSED(ptm); UNUSED(FontType); - return(false); + return 0; } bool IsFontAvailable(LPCWSTR lpszFontName) { - bool fFound = false; + BOOL fFound = FALSE; HDC hDC = GetDC(NULL); EnumFonts(hDC,lpszFontName,EnumFontsProc,(LPARAM)&fFound); ReleaseDC(NULL,hDC); - return(fFound); + return (bool)(fFound); } diff --git a/src/Notepad3.c b/src/Notepad3.c index c3e69fb00..8474684fa 100644 --- a/src/Notepad3.c +++ b/src/Notepad3.c @@ -342,9 +342,14 @@ static DWORD DropFilesProc(CLIPFORMAT cf, HGLOBAL hData, HWND hWnd, DWORD dwKeyS // Timer bitfield static volatile LONG g_lInterlockBits = 0; -#define TIMER_BIT_MARK_OCC 1L -#define TIMER_BIT_UPDATE_HYPER 2L -#define LOCK_NOTIFY_CHANGE 4L +#define BIT_TIMER_MARK_OCC 1L +#define BIT_MARK_OCC_IN_PROGRESS 2L + +#define BIT_TIMER_UPDATE_HYPER 4L +#define BIT_UPDATE_HYPER_IN_PROGRESS 8L + +#define LOCK_NOTIFY_CHANGE 16L + #define TEST_AND_SET(B) InterlockedBitTestAndSet(&g_lInterlockBits, B) #define TEST_AND_RESET(B) InterlockedBitTestAndReset(&g_lInterlockBits, B) @@ -1071,23 +1076,38 @@ LRESULT CALLBACK MainWndProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam) UpdateVisibleUrlHotspot(0); return DefWindowProc(hwnd,umsg,wParam,lParam); + case WM_TIMER: - if (LOWORD(wParam) == IDT_TIMER_MAIN_MRKALL) { - if (TEST_AND_RESET(TIMER_BIT_MARK_OCC)) { + { + // The KillTimer function does not remove WM_TIMER messages already posted to the message queue. + if (LOWORD(wParam) == IDT_TIMER_MAIN_MRKALL) + { KillTimer(hwnd, IDT_TIMER_MAIN_MRKALL); - PostMessage(hwnd, WM_COMMAND, MAKELONG(IDC_MAIN_MARKALL_OCC, 1), 0); + if (!TEST_AND_RESET(BIT_MARK_OCC_IN_PROGRESS)) // stay in progress + { + TEST_AND_SET(BIT_MARK_OCC_IN_PROGRESS); // start progress + EditMarkAllOccurrences(); + TEST_AND_RESET(BIT_MARK_OCC_IN_PROGRESS); // done + } + TEST_AND_RESET(BIT_TIMER_MARK_OCC); // ready for new events + return true; } - return true; - } - else if (LOWORD(wParam) == IDT_TIMER_UPDATE_HOTSPOT) { - if (TEST_AND_RESET(TIMER_BIT_UPDATE_HYPER)) { + else if (LOWORD(wParam) == IDT_TIMER_UPDATE_HOTSPOT) + { KillTimer(hwnd, IDT_TIMER_UPDATE_HOTSPOT); - PostMessage(hwnd, WM_COMMAND, MAKELONG(IDC_CALL_UPDATE_HOTSPOT, 1), 0); + if (!TEST_AND_RESET(BIT_UPDATE_HYPER_IN_PROGRESS)) // stay in progress + { + TEST_AND_SET(BIT_UPDATE_HYPER_IN_PROGRESS); // start progress + EditUpdateVisibleUrlHotspot(bHyperlinkHotspot); + TEST_AND_RESET(BIT_UPDATE_HYPER_IN_PROGRESS); // done + } + TEST_AND_RESET(BIT_TIMER_UPDATE_HYPER); // ready for new events + return true; } - return true; } break; + case WM_SIZE: MsgSize(hwnd,wParam,lParam); break; @@ -2552,14 +2572,6 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam) { switch(LOWORD(wParam)) { - case IDC_MAIN_MARKALL_OCC: - EditMarkAllOccurrences(); - break; - - case IDC_CALL_UPDATE_HOTSPOT: - EditUpdateVisibleUrlHotspot(bHyperlinkHotspot); - break; - case IDM_FILE_NEW: FileLoad(false,true,false,bSkipUnicodeDetection,bSkipANSICodePageDetection,L""); break; @@ -5466,7 +5478,7 @@ LRESULT MsgNotify(HWND hwnd,WPARAM wParam,LPARAM lParam) } else if (scn->updated & SC_UPDATE_V_SCROLL) { - if (iMarkOccurrences > 0) { + if ((iMarkOccurrences > 0) && bMarkOccurrencesMatchVisible) { MarkAllOccurrences(iUpdateDelayMarkAllCoccurrences); } if (bHyperlinkHotspot) { @@ -7055,26 +7067,41 @@ int CreateIniFileEx(LPCWSTR lpszIniFile) { // void MarkAllOccurrences(int delay) { - if (delay < USER_TIMER_MINIMUM) { - EditMarkAllOccurrences(); + if (TEST_AND_RESET(BIT_TIMER_MARK_OCC)) { + TEST_AND_SET(BIT_TIMER_MARK_OCC); // in progress return; } - TEST_AND_SET(TIMER_BIT_MARK_OCC); - SetTimer(g_hwndMain, IDT_TIMER_MAIN_MRKALL, delay, NULL); + + TEST_AND_SET(BIT_TIMER_MARK_OCC); // raise flag to swollow next calls + + if (delay < USER_TIMER_MINIMUM) { + SendMessage(g_hwndMain, WM_TIMER, MAKELONG(IDT_TIMER_MAIN_MRKALL, 1), 0); // direct timer event + } + else { + SetTimer(g_hwndMain, IDT_TIMER_MAIN_MRKALL, delay, NULL); + } } + //============================================================================= // // UpdateVisibleUrlHotspot() // void UpdateVisibleUrlHotspot(int delay) { - if (delay < USER_TIMER_MINIMUM) { - EditUpdateVisibleUrlHotspot(bHyperlinkHotspot); + if (TEST_AND_RESET(BIT_TIMER_UPDATE_HYPER)) { + TEST_AND_SET(BIT_TIMER_UPDATE_HYPER); // in progress return; } - TEST_AND_SET(TIMER_BIT_UPDATE_HYPER); - SetTimer(g_hwndMain, IDT_TIMER_UPDATE_HOTSPOT, delay, NULL); + + TEST_AND_SET(BIT_TIMER_UPDATE_HYPER); // raise flag to swollow next calls + + if (delay < USER_TIMER_MINIMUM) { + SendMessage(g_hwndMain, WM_TIMER, MAKELONG(IDT_TIMER_UPDATE_HOTSPOT, 1), 0); // direct timer event + } + else { + SetTimer(g_hwndMain, IDT_TIMER_UPDATE_HOTSPOT, delay, NULL); + } } @@ -7312,7 +7339,7 @@ void UpdateLineNumberWidth() int iLineMarginWidthFit = (int)SendMessage(g_hwndEdit, SCI_TEXTWIDTH, STYLE_LINENUMBER, (LPARAM)chLines); if (iLineMarginWidthNow != iLineMarginWidthFit) { - SendMessage(g_hwndEdit, SCI_SETMARGINWIDTHN, MARGIN_SCI_LINENUM, iLineMarginWidthFit + 60); + SendMessage(g_hwndEdit, SCI_SETMARGINWIDTHN, MARGIN_SCI_LINENUM, iLineMarginWidthFit); } } else { @@ -8198,7 +8225,7 @@ BOOL CALLBACK EnumWndProc(HWND hwnd,LPARAM lParam) bContinue = FALSE; } } - return(bContinue); + return bContinue; } BOOL CALLBACK EnumWndProc2(HWND hwnd,LPARAM lParam) @@ -8225,7 +8252,7 @@ BOOL CALLBACK EnumWndProc2(HWND hwnd,LPARAM lParam) bContinue = TRUE; } } - return(bContinue); + return bContinue; } bool ActivatePrevInst() diff --git a/src/Notepad3.rc b/src/Notepad3.rc index d4c800e7f..080aa2eaa 100644 --- a/src/Notepad3.rc +++ b/src/Notepad3.rc @@ -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 diff --git a/src/SciCall.h b/src/SciCall.h index 3574d545b..5f9c9a3e8 100644 --- a/src/SciCall.h +++ b/src/SciCall.h @@ -236,6 +236,7 @@ DeclareSciCallV0(NewLine, NEWLINE) // // Scrolling and automatic scrolling // +DeclareSciCallV2(SetVisiblePolicy, SETVISIBLEPOLICY, int, flags, DocLn, lines) DeclareSciCallV0(ChooseCaretX, CHOOSECARETX) DeclareSciCallV0(ScrollCaret, SCROLLCARET) DeclareSciCallV2(LineScroll, LINESCROLL, DocPos, columns, DocLn, lines) @@ -310,6 +311,7 @@ DeclareSciCallR1(GetFoldExpanded, GETFOLDEXPANDED, int, DocLn, line) DeclareSciCallV1(ToggleFold, TOGGLEFOLD, DocLn, line) DeclareSciCallV1(FoldAll, FOLDALL, int, flags) DeclareSciCallV1(EnsureVisible, ENSUREVISIBLE, DocLn, line) +DeclareSciCallV1(EnsureVisibleEnforcePolicy, ENSUREVISIBLEENFORCEPOLICY, DocLn, line) //============================================================================= diff --git a/src/Styles.c b/src/Styles.c index d924389b5..e3fe9c1e5 100644 --- a/src/Styles.c +++ b/src/Styles.c @@ -3390,7 +3390,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 diff --git a/src/TypeDefs.h b/src/TypeDefs.h index 987b25cad..eac68ca50 100644 --- a/src/TypeDefs.h +++ b/src/TypeDefs.h @@ -40,6 +40,18 @@ #endif + // -------------------------------------------------------------------------- + + typedef struct _wi + { + int x; + int y; + int cx; + int cy; + int max; + } WININFO; + + // -------------------------------------------------------------------------- typedef enum BufferSizes { diff --git a/src/Version.h b/src/Version.h index 1c72af22e..e7309a8e6 100644 Binary files a/src/Version.h and b/src/Version.h differ diff --git a/src/resource.h b/src/resource.h index 8942ad78c..57657ac6a 100644 --- a/src/resource.h +++ b/src/resource.h @@ -118,27 +118,24 @@ #define IDD_INFOBOX3 214 #define IDT_TIMER_MRKALL 215 #define IDC_ALL_OCCURRENCES 216 -#define IDC_MARKALL_OCC 217 -#define IDC_DOT_MATCH_ALL 218 -#define IDT_TIMER_MAIN_MRKALL 219 -#define IDC_MAIN_MARKALL_OCC 220 -#define IDT_TIMER_UPDATE_HOTSPOT 221 -#define IDC_CALL_UPDATE_HOTSPOT 222 -#define IDC_BACKSLASHHELP 223 -#define IDC_REGEXPHELP 224 -#define IDC_WILDCARDHELP 225 -#define IDC_WILDCARDSEARCH 226 -#define IDC_SCI_VERSION 227 -#define IDR_MAINWNDTB 228 -#define IDC_REMOVE 229 -#define IDC_SWAPSTRG 230 -#define IDC_CHECK_OCC 231 -#define IDC_PRINTER 232 -#define IDC_USEASREADINGFALLBACK 233 -#define IDR_ACCCUSTOMSCHEMES 234 -#define IDC_NOANSICPDETECTION 235 -#define IDC_REMEMBERSEARCHPATTERN 236 -#define IDC_TOGGLE_VISIBILITY 237 +#define IDC_DOT_MATCH_ALL 217 +#define IDT_TIMER_MAIN_MRKALL 218 +#define IDT_TIMER_UPDATE_HOTSPOT 219 +#define IDC_BACKSLASHHELP 220 +#define IDC_REGEXPHELP 221 +#define IDC_WILDCARDHELP 222 +#define IDC_WILDCARDSEARCH 223 +#define IDC_SCI_VERSION 224 +#define IDR_MAINWNDTB 225 +#define IDC_REMOVE 226 +#define IDC_SWAPSTRG 227 +#define IDC_CHECK_OCC 228 +#define IDC_PRINTER 229 +#define IDC_USEASREADINGFALLBACK 230 +#define IDR_ACCCUSTOMSCHEMES 231 +#define IDC_NOANSICPDETECTION 232 +#define IDC_REMEMBERSEARCHPATTERN 233 +#define IDC_TOGGLE_VISIBILITY 234 #define IDACC_FIND 302 #define IDACC_REPLACE 303 #define IDACC_SAVEPOS 304