mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-11 21:03:05 +08:00
+ fix: 1st part of BeginWaitCursor() cleanup
This commit is contained in:
parent
7016470eb6
commit
01e103bf8b
38
src/Edit.c
38
src/Edit.c
@ -477,10 +477,7 @@ BOOL EditSetNewEncoding(HWND hwnd,int iNewEncoding,BOOL bNoUI,BOOL bSetSavePoint
|
||||
BOOL doNewEncoding = (!bNoUI) ? (InfoBox(MBYESNO, L"MsgConv1", IDS_ASK_ENCODING) == IDYES) : TRUE;
|
||||
|
||||
if (doNewEncoding) {
|
||||
BeginWaitCursor(NULL);
|
||||
BOOL result = EditConvertText(hwnd,iCurrentEncoding,iNewEncoding,FALSE);
|
||||
EndWaitCursor();
|
||||
return result;
|
||||
return EditConvertText(hwnd,iCurrentEncoding,iNewEncoding,FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3680,7 +3677,6 @@ void EditRemoveBlankLines(HWND hwnd,BOOL bMerge)
|
||||
if (iSelStart > SciCall_PositionFromLine(iLineStart)) { ++iLineStart; }
|
||||
if ((iSelEnd <= SciCall_PositionFromLine(iLineEnd)) && (iLineEnd != SciCall_GetLineCount() - 1)) { --iLineEnd; }
|
||||
|
||||
IgnoreNotifyChangeEvent();
|
||||
EditEnterTargetTransaction();
|
||||
|
||||
for (DocLn iLine = iLineStart; iLine <= iLineEnd; )
|
||||
@ -3705,7 +3701,6 @@ void EditRemoveBlankLines(HWND hwnd,BOOL bMerge)
|
||||
}
|
||||
|
||||
EditLeaveTargetTransaction();
|
||||
ObserveNotifyChangeEvent();
|
||||
}
|
||||
|
||||
|
||||
@ -5764,8 +5759,6 @@ int EditReplaceAllInRange(HWND hwnd, LPCEDITFINDREPLACE lpefr, BOOL bShowInfo, D
|
||||
DocPos start = iStartPos;
|
||||
DocPos end = iEndPos;
|
||||
|
||||
BeginWaitCursor(NULL);
|
||||
|
||||
DocPos iPos = EditFindInTarget(hwnd, szFind, slen, (int)(lpefr->fuFlags), &start, &end, FALSE);
|
||||
|
||||
if ((iPos < -1) && (lpefr->fuFlags & SCFIND_REGEXP)) {
|
||||
@ -5821,10 +5814,6 @@ int EditReplaceAllInRange(HWND hwnd, LPCEDITFINDREPLACE lpefr, BOOL bShowInfo, D
|
||||
EditLeaveTargetTransaction();
|
||||
}
|
||||
|
||||
ObserveNotifyChangeEvent();
|
||||
|
||||
EndWaitCursor();
|
||||
|
||||
utarray_clear(ReplPosUTArray);
|
||||
utarray_free(ReplPosUTArray);
|
||||
LocalFree(pszReplace);
|
||||
@ -5846,8 +5835,10 @@ int EditReplaceAllInRange(HWND hwnd, LPCEDITFINDREPLACE lpefr, BOOL bShowInfo, D
|
||||
//
|
||||
BOOL EditReplaceAll(HWND hwnd, LPCEDITFINDREPLACE lpefr, BOOL bShowInfo)
|
||||
{
|
||||
DocPos start = 0;
|
||||
DocPos end = SciCall_GetTextLength();
|
||||
const DocPos start = 0;
|
||||
const DocPos end = SciCall_GetTextLength();
|
||||
|
||||
BeginWaitCursor(NULL);
|
||||
|
||||
int token = BeginUndoAction();
|
||||
|
||||
@ -5855,6 +5846,8 @@ BOOL EditReplaceAll(HWND hwnd, LPCEDITFINDREPLACE lpefr, BOOL bShowInfo)
|
||||
|
||||
EndUndoAction(token);
|
||||
|
||||
EndWaitCursor();
|
||||
|
||||
return (iReplacedOccurrences > 0) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
@ -5870,8 +5863,14 @@ BOOL EditReplaceAllInSelection(HWND hwnd, LPCEDITFINDREPLACE lpefr, BOOL bShowIn
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DocPos start = SciCall_GetSelectionStart();
|
||||
DocPos end = SciCall_GetSelectionEnd();
|
||||
const DocPos start = SciCall_GetSelectionStart();
|
||||
const DocPos end = SciCall_GetSelectionEnd();
|
||||
bool bWaitCursor = false;
|
||||
|
||||
if ((end - start) > (512 * 512)) {
|
||||
BeginWaitCursor(NULL);
|
||||
bWaitCursor = true;
|
||||
}
|
||||
|
||||
int token = BeginUndoAction();
|
||||
|
||||
@ -5879,9 +5878,12 @@ BOOL EditReplaceAllInSelection(HWND hwnd, LPCEDITFINDREPLACE lpefr, BOOL bShowIn
|
||||
|
||||
EndUndoAction(token);
|
||||
|
||||
if (iReplacedOccurrences <= 0)
|
||||
if (bWaitCursor) {
|
||||
EndWaitCursor();
|
||||
}
|
||||
if (iReplacedOccurrences <= 0) {
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@ -78,11 +78,10 @@ __inline BOOL IniSectionSetBool(LPWSTR lpCachedIniSection, LPCWSTR lpName, BOOL
|
||||
return IniSectionSetInt(lpCachedIniSection, lpName, (b ? 1 : 0));
|
||||
}
|
||||
|
||||
|
||||
//extern HWND g_hwndEdit;
|
||||
#define BeginWaitCursor(TCH) { SendMessage(g_hwndEdit,SCI_SETCURSOR,(WPARAM)SC_CURSORWAIT,0); StatusSetText(g_hwndStatus,STATUS_HELP,(TCH)); }
|
||||
#define BeginWaitCursorID(UID) { SendMessage(g_hwndEdit,SCI_SETCURSOR,(WPARAM)SC_CURSORWAIT,0); StatusSetTextID(g_hwndStatus,STATUS_HELP,(UID)); }
|
||||
#define EndWaitCursor() { POINT pt; SendMessage(g_hwndEdit,SCI_SETCURSOR,(WPARAM)SC_CURSORNORMAL,0); GetCursorPos(&pt); SetCursorPos(pt.x,pt.y); StatusSetSimple(g_hwndStatus,FALSE); UpdateStatusbar(); }
|
||||
#define BeginWaitCursor(TCH) { SciCall_SetCursor(SC_CURSORWAIT); StatusSetText(g_hwndStatus,STATUS_HELP,(TCH)); IgnoreNotifyChangeEvent(); }
|
||||
#define BeginWaitCursorID(UID) { SciCall_SetCursor(SC_CURSORWAIT); StatusSetTextID(g_hwndStatus,STATUS_HELP,(UID)); IgnoreNotifyChangeEvent(); }
|
||||
#define EndWaitCursor() { POINT pt; SciCall_SetCursor(SC_CURSORNORMAL); GetCursorPos(&pt); SetCursorPos(pt.x,pt.y); StatusSetSimple(g_hwndStatus,FALSE); ObserveNotifyChangeEvent(); UpdateStatusbar(); }
|
||||
|
||||
|
||||
//#define Is2k() (g_uWinVer >= 0x0500)
|
||||
|
||||
@ -2683,6 +2683,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
}
|
||||
|
||||
BeginWaitCursor(NULL);
|
||||
if (EditSetNewEncoding(g_hwndEdit,
|
||||
iNewEncoding,
|
||||
(flagSetEncoding),
|
||||
@ -2697,10 +2698,10 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
Encoding_HasChanged(CPI_NONE);
|
||||
Encoding_Current(iNewEncoding);
|
||||
}
|
||||
|
||||
UpdateToolbar();
|
||||
UpdateStatusbar();
|
||||
}
|
||||
EndWaitCursor();
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
@ -4613,7 +4614,7 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
WideCharToMultiByteStrg(cp,wchReplace,efrTS.szReplace);
|
||||
|
||||
if (!SendMessage(g_hwndEdit, SCI_GETSELECTIONEMPTY, 0, 0))
|
||||
EditReplaceAllInSelection(g_hwndEdit,&efrTS,TRUE);
|
||||
EditReplaceAllInSelection(g_hwndEdit, &efrTS, TRUE);
|
||||
else
|
||||
EditReplaceAll(g_hwndEdit,&efrTS,TRUE);
|
||||
}
|
||||
|
||||
@ -178,7 +178,10 @@ BEGIN
|
||||
MENUITEM "&Join Lines\tCtrl+J", IDM_EDIT_JOINLINES
|
||||
MENUITEM "&Fuse Lines\tCtrl+Alt+J", IDM_EDIT_JOINLN_NOSP
|
||||
MENUITEM "&Preserve Paragraphs\tCtrl+Shift+J", IDM_EDIT_JOINLINES_PARA
|
||||
END
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Merge &Blank Lines\tAlt+Y", IDM_EDIT_MERGEBLANKLINES
|
||||
MENUITEM "&Remove Blank Lines\tAlt+R", IDM_EDIT_REMOVEBLANKLINES
|
||||
END
|
||||
POPUP "&Block"
|
||||
BEGIN
|
||||
MENUITEM "&Indent", IDM_EDIT_INDENT
|
||||
@ -204,8 +207,6 @@ BEGIN
|
||||
MENUITEM "Strip &Last Character\tAlt+U", IDM_EDIT_STRIPLASTCHAR
|
||||
MENUITEM "Strip &Trailing Blanks\tAlt+W", IDM_EDIT_TRIMLINES
|
||||
MENUITEM "Compress &Whitespace\tAlt+P", IDM_EDIT_COMPRESSWS
|
||||
MENUITEM "Merge &Blank Lines\tAlt+Y", IDM_EDIT_MERGEBLANKLINES
|
||||
MENUITEM "&Remove Blank Lines\tAlt+R", IDM_EDIT_REMOVEBLANKLINES
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Modify Lines...\tAlt+M", IDM_EDIT_MODIFYLINES
|
||||
MENUITEM "&Align Lines...\tAlt+J", IDM_EDIT_ALIGN
|
||||
|
||||
@ -220,6 +220,13 @@ DeclareSciCallV1(EnsureVisible, ENSUREVISIBLE, DocLn, line);
|
||||
DeclareSciCallV2(SetProperty, SETPROPERTY, const char *, key, const char *, value);
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// Cursor
|
||||
//
|
||||
DeclareSciCallV1(SetCursor, SETCURSOR, int, flags);
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// Undo/Redo Stack
|
||||
|
||||
BIN
src/Version.h
BIN
src/Version.h
Binary file not shown.
Loading…
Reference in New Issue
Block a user