+ chg: refactoring delayed messages queue

This commit is contained in:
Rainer Kottenhoff 2021-04-01 13:06:56 +02:00
parent c8e8727c1b
commit ac87c68fc1
3 changed files with 132 additions and 135 deletions

View File

@ -146,41 +146,50 @@ static CmdMessageQueue_t* MessageQueue = NULL;
static int msgcmp(void* mqc1, void* mqc2)
{
CmdMessageQueue_t* const pMQC1 = (CmdMessageQueue_t*)mqc1;
CmdMessageQueue_t* const pMQC2 = (CmdMessageQueue_t*)mqc2;
const CmdMessageQueue_t* const pMQC1 = (CmdMessageQueue_t*)mqc1;
const CmdMessageQueue_t* const pMQC2 = (CmdMessageQueue_t*)mqc2;
if ((pMQC1->hwnd == pMQC2->hwnd)
&& (pMQC1->cmd == pMQC2->cmd)
&& (pMQC1->wparam == pMQC2->wparam)
&& (pMQC1->lparam == pMQC2->lparam)) {
return FALSE;
if ((pMQC1->cmd == pMQC2->cmd)
&& (pMQC1->hwnd == pMQC2->hwnd)
&& (pMQC1->wparam == pMQC2->wparam)
&& (pMQC1->lparam == pMQC2->lparam)
) {
return 0;
}
return 1;
}
// ----------------------------------------------------------------------------
#define _MQ_ms(T) ((T) / USER_TIMER_MINIMUM)
#define _MQ_TIMER_CYCLE (USER_TIMER_MINIMUM << 1)
#define _MQ_ms2cycl(T) (((T) + USER_TIMER_MINIMUM) / _MQ_TIMER_CYCLE)
#define _MQ_STD (_MQ_TIMER_CYCLE << 2)
static void _MQ_AppendCmd(CmdMessageQueue_t* const pMsgQCmd, int cycles)
{
if (!pMsgQCmd) { return; }
cycles = clampi(cycles, 0, _MQ_ms2cycl(60000));
if (0 == cycles) {
SendMessage(pMsgQCmd->hwnd, pMsgQCmd->cmd, pMsgQCmd->wparam, pMsgQCmd->lparam);
return;
}
CmdMessageQueue_t* pmqc = NULL;
DL_SEARCH(MessageQueue, pmqc, pMsgQCmd, msgcmp);
if (!pmqc) { // NOT found
if (!pmqc) { // NOT found, create new one
pmqc = AllocMem(sizeof(CmdMessageQueue_t), HEAP_ZERO_MEMORY);
pmqc->hwnd = pMsgQCmd->hwnd;
pmqc->cmd = pMsgQCmd->cmd;
pmqc->wparam = pMsgQCmd->wparam;
pmqc->lparam = pMsgQCmd->lparam;
pmqc->delay = cycles;
DL_APPEND(MessageQueue, pmqc);
}
if (cycles < 2) {
pmqc->delay = -1; // execute now (do not use PostMessage() here)
SendMessage(pMsgQCmd->hwnd, pMsgQCmd->cmd, pMsgQCmd->wparam, pMsgQCmd->lparam);
if (pmqc) {
*pmqc = *pMsgQCmd;
pmqc->delay = cycles;
DL_APPEND(MessageQueue, pmqc);
}
} else {
pmqc->delay = (pmqc->delay + cycles) / 2; // increase delay
if (pmqc->delay > 0) {
pmqc->delay = (pmqc->delay + cycles) >> 1; // median delay
} else {
pmqc->delay = cycles;
}
}
}
// ----------------------------------------------------------------------------
@ -194,8 +203,9 @@ static void _MQ_RemoveCmd(CmdMessageQueue_t* const pMsgQCmd)
{
if ((pMsgQCmd->hwnd == pmqc->hwnd)
&& (pMsgQCmd->cmd == pmqc->cmd)
&& (pMsgQCmd->wparam == pmqc->wparam))
{
&& (pMsgQCmd->wparam == pmqc->wparam)
&& (pMsgQCmd->lparam == pmqc->lparam)
) {
pmqc->delay = -1;
}
}
@ -214,14 +224,15 @@ static void CALLBACK MQ_ExecuteNext(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWOR
UNREFERENCED_PARAMETER(idEvent); // must be IDT_TIMER_MRKALL
UNREFERENCED_PARAMETER(dwTime); // This is the value returned by the GetTickCount function
CmdMessageQueue_t* pmqc;
CmdMessageQueue_t *pmqc;
DL_FOREACH(MessageQueue, pmqc) {
if (pmqc->delay >= 0) {
--(pmqc->delay);
}
if (pmqc->delay == 0) {
pmqc->delay = -1;
SendMessage(pmqc->hwnd, pmqc->cmd, pmqc->wparam, pmqc->lparam);
} else if (pmqc->delay >= 0) {
pmqc->delay -= 1;
pmqc->lparam = (LPARAM)Sci_GetDocEndPosition();
}
}
}
@ -5682,13 +5693,14 @@ static RegExResult_t _FindHasMatch(HWND hwnd, LPEDITFINDREPLACE lpefr, DocPos iS
// _DelayMarkAll()
//
//
static void _DelayMarkAll(HWND hwnd, int delay, DocPos iStartPos)
static void _DelayMarkAll(HWND hwnd, int delay)
{
static CmdMessageQueue_t mqc = MQ_WM_CMD_INIT(IDT_TIMER_MAIN_MRKALL, 0);
mqc.hwnd = hwnd;
mqc.lparam = (LPARAM)iStartPos;
_MQ_AppendCmd(&mqc, (UINT)(delay <= 0 ? 0 : _MQ_ms(delay)));
static CmdMessageQueue_t mqc = MQ_WM_CMD_INIT(IDT_TIMER_MAIN_MRKALL, 0LL);
if (!mqc.hwnd) {
mqc.hwnd = hwnd;
mqc.lparam = 0LL; // start position always 0
}
_MQ_AppendCmd(&mqc, _MQ_ms2cycl(delay));
}
//=============================================================================
@ -5808,7 +5820,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
}
#endif
SetTimer(hwnd, IDT_TIMER_MRKALL, USER_TIMER_MINIMUM, MQ_ExecuteNext);
SetTimer(hwnd, IDT_TIMER_MRKALL, _MQ_TIMER_CYCLE, MQ_ExecuteNext);
SET_INITIAL_ANCHORS()
s_InitialTopLine = SciCall_GetFirstVisibleLine();
@ -5957,7 +5969,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
DialogEnableControl(hwnd, IDC_TOGGLE_VISIBILITY, s_pEfrDataDlg->bMarkOccurences);
_DelayMarkAll(hwnd, 50, 0);
_DelayMarkAll(hwnd, _MQ_STD);
PostMessage(hwnd, WM_THEMECHANGED, 0, 0);
}
@ -6149,7 +6161,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
bool const bEnableReplInSel = !(SciCall_IsSelectionEmpty() || Sci_IsMultiOrRectangleSelection());
DialogEnableControl(hwnd, IDC_REPLACEINSEL, bEnableReplInSel);
_DelayMarkAll(hwnd, 100, 0);
_DelayMarkAll(hwnd, _MQ_STD);
if (!SciCall_IsSelectionEmpty()) {
EditEnsureSelectionVisible();
@ -6175,7 +6187,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
s_InitialSearchStart = SciCall_GetSelectionStart();
s_InitialTopLine = -1; // reset
s_pEfrDataDlg->bStateChanged = true;
_DelayMarkAll(hwnd, 100, 0);
_DelayMarkAll(hwnd, _MQ_STD);
break;
@ -6279,7 +6291,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
SciCall_SetFirstVisibleLine(s_InitialTopLine);
}
}
_DelayMarkAll(hwnd, 50, 0);
_DelayMarkAll(hwnd, _MQ_STD);
}
break;
@ -6312,7 +6324,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
if (IsButtonChecked(hwnd, IDC_ALL_OCCURRENCES)) {
DialogEnableControl(hwnd, IDC_TOGGLE_VISIBILITY, true);
_DelayMarkAll(hwnd, 50, 0);
_DelayMarkAll(hwnd, _MQ_STD);
} else { // switched OFF
DialogEnableControl(hwnd, IDC_TOGGLE_VISIBILITY, false);
if (FocusedView.HideNonMatchedLines) {
@ -6332,7 +6344,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
s_pEfrDataDlg->bStateChanged = true;
s_InitialTopLine = -1; // reset
EditClearAllOccurrenceMarkers(s_pEfrDataDlg->hwnd);
_DelayMarkAll(hwnd, 50, 0);
_DelayMarkAll(hwnd, _MQ_STD);
}
}
break;
@ -6351,12 +6363,12 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, SetBtn(s_pEfrDataDlg->bTransformBS));
}
_SetSearchFlags(hwnd, s_pEfrDataDlg);
_DelayMarkAll(hwnd, 50, 0);
_DelayMarkAll(hwnd, _MQ_STD);
break;
case IDC_DOT_MATCH_ALL:
_SetSearchFlags(hwnd, s_pEfrDataDlg);
_DelayMarkAll(hwnd, 50, 0);
_DelayMarkAll(hwnd, _MQ_STD);
break;
case IDC_WILDCARDSEARCH: {
@ -6372,34 +6384,34 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, SetBtn(s_pEfrDataDlg->bTransformBS));
}
_SetSearchFlags(hwnd, s_pEfrDataDlg);
_DelayMarkAll(hwnd, 50, 0);
_DelayMarkAll(hwnd, _MQ_STD);
}
break;
case IDC_FIND_OVERLAPPING:
_SetSearchFlags(hwnd, s_pEfrDataDlg);
_DelayMarkAll(hwnd, 50, 0);
_DelayMarkAll(hwnd, _MQ_STD);
break;
case IDC_FINDTRANSFORMBS: {
_SetSearchFlags(hwnd, s_pEfrDataDlg);
_DelayMarkAll(hwnd, 50, 0);
_DelayMarkAll(hwnd, _MQ_STD);
}
break;
case IDC_FINDCASE:
_SetSearchFlags(hwnd, s_pEfrDataDlg);
_DelayMarkAll(hwnd, 50, 0);
_DelayMarkAll(hwnd, _MQ_STD);
break;
case IDC_FINDWORD:
_SetSearchFlags(hwnd, s_pEfrDataDlg);
_DelayMarkAll(hwnd, 50, 0);
_DelayMarkAll(hwnd, _MQ_STD);
break;
case IDC_FINDSTART:
_SetSearchFlags(hwnd, s_pEfrDataDlg);
_DelayMarkAll(hwnd, 50, 0);
_DelayMarkAll(hwnd, _MQ_STD);
break;
case IDC_TRANSPARENT:
@ -6518,7 +6530,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
DestroyWindow(hwnd);
}
}
_DelayMarkAll(hwnd, 50, 0);
_DelayMarkAll(hwnd, _MQ_STD);
break;
@ -6548,7 +6560,7 @@ static INT_PTR CALLBACK EditFindReplaceDlgProc(HWND hwnd, UINT umsg, WPARAM wPar
SetDlgItemTextW(hwnd, IDC_REPLACETEXT, wszFind);
Globals.FindReplaceMatchFoundState = FND_NOP;
_SetSearchFlags(hwnd, s_pEfrDataDlg);
_DelayMarkAll(hwnd, 50, 0);
_DelayMarkAll(hwnd, _MQ_STD);
}
break;

View File

@ -93,6 +93,7 @@ void DbgLog(const char *fmt, ...);
inline int min_i(const int x, const int y) _RETCMPMIN_
inline unsigned int min_u(const unsigned int x, const unsigned int y) _RETCMPMIN_
inline long min_l(const long x, const long y) _RETCMPMIN_
inline long long min_ll(const long long x, const long long y) _RETCMPMIN_
inline long min_dw(const DWORD x, const DWORD y) _RETCMPMIN_
inline size_t min_s(const size_t x, const size_t y) _RETCMPMIN_
inline DocPos min_p(const DocPos x, const DocPos y) _RETCMPMIN_
@ -105,6 +106,7 @@ inline float min_f(float x, float y) _RETCMPMIN_
inline int max_i(int x, int y) _RETCMPMAX_
inline unsigned int max_u(unsigned int x, unsigned int y) _RETCMPMAX_
inline long max_l(const long x, const long y) _RETCMPMAX_
inline long long max_ll(const long long x, const long long y) _RETCMPMAX_
inline long max_dw(const DWORD x, const DWORD y) _RETCMPMAX_
inline size_t max_s(const size_t x, const size_t y) _RETCMPMAX_
inline DocPos max_p(const DocPos x, const DocPos y) _RETCMPMAX_

View File

@ -368,15 +368,21 @@ static void CopyUndoRedoSelection(void* dst, const void* src)
static UT_icd UndoRedoSelection_icd = { sizeof(UndoRedoSelection_t), InitUndoRedoSelection, CopyUndoRedoSelection, DelUndoRedoSelection };
static UT_array* UndoRedoSelectionUTArray = NULL;
static bool _InUndoRedoTransaction();
static inline bool _InUndoRedoTransaction();
static void _SaveRedoSelection(int token);
static int _SaveUndoSelection();
static int _UndoRedoActionMap(int token, const UndoRedoSelection_t** selection);
static void _SplitUndoTransaction();
// => _BEGIN_UNDO_ACTION_
// => _END_UNDO_ACTION_
static inline void _SplitUndoTransaction() {
if (!_InUndoRedoTransaction()) {
SciCall_BeginUndoAction();
/* noop */
SciCall_EndUndoAction();
}
}
// ----------------------------------------------------------------------------
static void _DelayClearCallTip(const int delay);
@ -436,46 +442,53 @@ static CmdMessageQueue_t* MessageQueue = NULL;
static int msgcmp(void* mqc1, void* mqc2)
{
CmdMessageQueue_t* const pMQC1 = (CmdMessageQueue_t*)mqc1;
CmdMessageQueue_t* const pMQC2 = (CmdMessageQueue_t*)mqc2;
const CmdMessageQueue_t* const pMQC1 = (CmdMessageQueue_t*)mqc1;
const CmdMessageQueue_t* const pMQC2 = (CmdMessageQueue_t*)mqc2;
if ((pMQC1->cmd == pMQC2->cmd)
//&& (pMQC1->hwnd == pMQC2->hwnd)
&& (pMQC1->wparam == pMQC2->wparam) // command
&& (pMQC1->lparam == pMQC2->lparam) // true/false
) {
return FALSE;
&& (pMQC1->hwnd == pMQC2->hwnd)
&& (pMQC1->wparam == pMQC2->wparam) // command
&& (pMQC1->lparam == pMQC2->lparam) // true/false
) {
return 0; // equal
}
return 1;
return (pMQC1->delay < pMQC2->delay) ? -1 : 1;
}
// ----------------------------------------------------------------------------
#define _MQ_IMMEDIATE (2 * USER_TIMER_MINIMUM - 1)
#define _MQ_FAST (USER_TIMER_MINIMUM << 2)
#define _MQ_STD (USER_TIMER_MINIMUM << 3)
#define _MQ_LAZY (USER_TIMER_MINIMUM << 4)
#define _MQ_ms(T) ((T) / USER_TIMER_MINIMUM)
#define _MQ_TIMER_CYCLE (USER_TIMER_MINIMUM << 1) // 20ms cycle
#define _MQ_ms2cycl(T) (((T) + USER_TIMER_MINIMUM) / _MQ_TIMER_CYCLE)
#define _MQ_IMMEDIATE (_MQ_TIMER_CYCLE - 1)
#define _MQ_FAST (_MQ_TIMER_CYCLE << 1)
#define _MQ_STD (_MQ_TIMER_CYCLE << 2)
#define _MQ_LAZY (_MQ_TIMER_CYCLE << 3)
static void _MQ_AppendCmd(CmdMessageQueue_t* const pMsgQCmd, int cycles)
{
if (!pMsgQCmd) {
if (!pMsgQCmd) { return; }
cycles = clampi(cycles, 0, _MQ_ms2cycl(60000));
if (0 == cycles) {
SendMessage(pMsgQCmd->hwnd, pMsgQCmd->cmd, pMsgQCmd->wparam, pMsgQCmd->lparam);
return;
}
CmdMessageQueue_t* pmqc = NULL;
CmdMessageQueue_t *pmqc = NULL;
DL_SEARCH(MessageQueue, pmqc, pMsgQCmd, msgcmp);
if (!pmqc) { // NOT found
pmqc = pMsgQCmd;
pmqc->delay = cycles;
DL_APPEND(MessageQueue, pmqc);
if (!pmqc) { // NOT found, create one
pmqc = AllocMem(sizeof(CmdMessageQueue_t), HEAP_ZERO_MEMORY);
if (pmqc) {
*pmqc = *pMsgQCmd;
pmqc->delay = cycles;
DL_APPEND(MessageQueue, pmqc);
}
} else {
pmqc->delay = (pmqc->delay + cycles) / 2; // increase delay
}
if (pmqc->delay < 2) {
// execute now (do not use PostMessage() here)
SendMessage(pMsgQCmd->hwnd, pMsgQCmd->cmd, pMsgQCmd->wparam, pMsgQCmd->lparam);
pmqc->delay = -1;
if (pmqc->delay > 0) {
pmqc->delay = (pmqc->delay + cycles) >> 1; // median delay
} else {
pmqc->delay = cycles;
}
}
}
// ----------------------------------------------------------------------------
@ -487,8 +500,8 @@ static void _MQ_RemoveCmd(CmdMessageQueue_t* const pMsgQCmd)
DL_FOREACH(MessageQueue, pmqc)
{
if ((pMsgQCmd->hwnd == pmqc->hwnd)
&& (pMsgQCmd->cmd == pmqc->cmd)
if ((pMsgQCmd->cmd == pmqc->cmd)
&& (pMsgQCmd->hwnd == pmqc->hwnd)
&& (pMsgQCmd->wparam == pmqc->wparam)
&& (pMsgQCmd->lparam == pmqc->lparam))
{
@ -514,11 +527,11 @@ static void CALLBACK MQ_ExecuteNext(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWOR
CmdMessageQueue_t* pmqc;
DL_FOREACH(MessageQueue, pmqc) {
if (pmqc->delay >= 0) {
--(pmqc->delay);
}
if (pmqc->delay == 0) {
SendMessage(pmqc->hwnd, pmqc->cmd, pmqc->wparam, pmqc->lparam);
pmqc->delay = -1;
} else if (pmqc->delay >= 0) {
pmqc->delay -= 1; // decrease
}
}
}
@ -704,9 +717,8 @@ static void _CleanUpResources(const HWND hwnd, bool bIsInitialized)
CmdMessageQueue_t* dummy;
DL_FOREACH_SAFE(MessageQueue, pmqc, dummy) {
DL_DELETE(MessageQueue, pmqc);
//~FreeMem(pmqc); // No AllocMem Anymore
FreeMem(pmqc);
}
if (UndoRedoSelectionUTArray != NULL) {
utarray_clear(UndoRedoSelectionUTArray);
utarray_free(UndoRedoSelectionUTArray);
@ -980,7 +992,7 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
HACCEL const hAccFindReplace = LoadAccelerators(hInstance,MAKEINTRESOURCE(IDR_ACCFINDREPLACE));
HACCEL const hAccCoustomizeSchemes = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDR_ACCCUSTOMSCHEMES));
SetTimer(hwnd, IDT_TIMER_MRKALL, USER_TIMER_MINIMUM, (TIMERPROC)MQ_ExecuteNext);
SetTimer(hwnd, IDT_TIMER_MRKALL, _MQ_TIMER_CYCLE, (TIMERPROC)MQ_ExecuteNext);
#if defined(HAVE_DYN_LOAD_LIBS_MUI_LNGS)
if (Globals.bPrefLngNotAvail) {
@ -6559,10 +6571,10 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
case IDT_EDIT_CUT:
if (IsCmdEnabled(hwnd,IDM_EDIT_CUT)) {
SendWMCommand(hwnd, IDM_EDIT_CUT);
//~SendWMCommand(hwnd, IDM_EDIT_CUTLINE);
} else {
SimpleBeep();
}
//~SendWMCommand(hwnd, IDM_EDIT_CUTLINE);
break;
@ -7390,13 +7402,9 @@ inline static LRESULT _MsgNotifyLean(const SCNotification *const scn, bool* bMod
}
if (*bModified) {
DWORD const timeout = Settings2.UndoTransactionTimeout;
bool const bUndoRedo = ((iModType & SC_PERFORMED_UNDO) || (iModType & SC_PERFORMED_REDO));
if ((timeout != 0UL) && !bUndoRedo) {
if (timeout > _MQ_IMMEDIATE) {
_DelaySplitUndoTransaction(timeout);
} else {
_SplitUndoTransaction();
}
if (timeout != 0UL) {
bool const bInUndoRedo = ((iModType & SC_PERFORMED_UNDO) || (iModType & SC_PERFORMED_REDO));
_DelaySplitUndoTransaction(bInUndoRedo ? max_dw(_MQ_FAST, timeout) : timeout);
}
}
} else if (pnmh->code == SCN_SAVEPOINTREACHED) {
@ -7447,7 +7455,8 @@ static LRESULT _MsgNotifyFromEdit(HWND hwnd, const SCNotification* const scn)
EditUpdateVisibleIndicators();
if (scn->linesAdded != 0) {
if (Settings.SplitUndoTypingSeqOnLnBreak && (scn->linesAdded > 0)) {
if (!((iModType & SC_PERFORMED_UNDO) || (iModType & SC_PERFORMED_REDO))) {
bool const bInUndoRedo = ((iModType & SC_PERFORMED_UNDO) || (iModType & SC_PERFORMED_REDO));
if (!bInUndoRedo) {
_SplitUndoTransaction();
}
}
@ -8391,18 +8400,12 @@ void ParseCommandLine()
//
static void _DelayUpdateStatusbar(const int delay, const bool bForceRedraw)
{
static CmdMessageQueue_t mqc_t = MQ_WM_CMD_INIT(IDT_TIMER_UPDATE_STATUSBAR, TRUE);
static CmdMessageQueue_t mqc_f = MQ_WM_CMD_INIT(IDT_TIMER_UPDATE_STATUSBAR, FALSE);
if (!mqc_t.hwnd || !mqc_f.hwnd) {
mqc_t.hwnd = Globals.hwndMain;
mqc_f.hwnd = Globals.hwndMain;
}
if (bForceRedraw) {
_MQ_AppendCmd(&mqc_t, (UINT)(delay <= 0 ? 0 : _MQ_ms(delay)));
} else {
_MQ_AppendCmd(&mqc_f, (UINT)(delay <= 0 ? 0 : _MQ_ms(delay)));
static CmdMessageQueue_t mqc = MQ_WM_CMD_INIT(IDT_TIMER_UPDATE_STATUSBAR, 0);
if (!mqc.hwnd) {
mqc.hwnd = Globals.hwndMain;
}
mqc.lparam = (LPARAM)bForceRedraw;
_MQ_AppendCmd(&mqc, _MQ_ms2cycl(delay));
}
@ -8417,7 +8420,7 @@ static void _DelayUpdateToolbar(const int delay)
if (!mqc.hwnd) {
mqc.hwnd = Globals.hwndMain;
}
_MQ_AppendCmd(&mqc, (UINT)(delay <= 0 ? 0 : _MQ_ms(delay)));
_MQ_AppendCmd(&mqc, _MQ_ms2cycl(delay));
}
@ -8432,7 +8435,7 @@ static void _DelayClearCallTip(const int delay)
if (!mqc.hwnd) {
mqc.hwnd = Globals.hwndMain;
}
_MQ_AppendCmd(&mqc, (UINT)(delay <= 0 ? 0 : _MQ_ms(delay)));
_MQ_AppendCmd(&mqc, _MQ_ms2cycl(delay));
}
@ -8447,7 +8450,7 @@ static void _DelaySplitUndoTransaction(const int delay)
if (!mqc.hwnd) {
mqc.hwnd = Globals.hwndMain;
}
_MQ_AppendCmd(&mqc, (UINT)(delay <= 0 ? 0 : _MQ_ms(delay)));
_MQ_AppendCmd(&mqc, _MQ_ms2cycl(delay));
}
@ -8457,18 +8460,12 @@ static void _DelaySplitUndoTransaction(const int delay)
//
void MarkAllOccurrences(const int delay, const bool bForceClear)
{
static CmdMessageQueue_t mqc_t = MQ_WM_CMD_INIT(IDT_TIMER_MAIN_MRKALL, TRUE);
static CmdMessageQueue_t mqc_f = MQ_WM_CMD_INIT(IDT_TIMER_MAIN_MRKALL, FALSE);
if (!mqc_t.hwnd || !mqc_f.hwnd) {
mqc_t.hwnd = Globals.hwndMain;
mqc_f.hwnd = Globals.hwndMain;
}
if (bForceClear) {
_MQ_AppendCmd(&mqc_t, (UINT)(delay <= 0 ? 0 : _MQ_ms(delay)));
} else {
_MQ_AppendCmd(&mqc_f, (UINT)(delay <= 0 ? 0 : _MQ_ms(delay)));
static CmdMessageQueue_t mqc = MQ_WM_CMD_INIT(IDT_TIMER_MAIN_MRKALL, 0);
if (!mqc.hwnd) {
mqc.hwnd = Globals.hwndMain;
}
mqc.lparam = (LPARAM)bForceClear;
_MQ_AppendCmd(&mqc, _MQ_ms2cycl(delay));
}
@ -9314,7 +9311,7 @@ static volatile LONG UndoActionToken = UNDOREDO_BLOCKED; // block
//=============================================================================
static bool _InUndoRedoTransaction()
static inline bool _InUndoRedoTransaction()
{
return (InterlockedOr(&UndoActionToken, 0L) != UNDOREDO_FREE);
}
@ -9717,20 +9714,6 @@ static int _UndoRedoActionMap(int token, const UndoRedoSelection_t** selection)
}
//=============================================================================
//
// _SplitUndoTransaction()
//
//
static void _SplitUndoTransaction()
{
if (!_InUndoRedoTransaction()) {
SciCall_BeginUndoAction();
SciCall_EndUndoAction();
}
}
//=============================================================================
//
// FileIO()