+ refactoring: create a better "delayed command message queue"

This commit is contained in:
Rainer Kottenhoff 2018-04-16 19:27:49 +02:00
parent 2503f4027c
commit a05b7dfa07
3 changed files with 266 additions and 124 deletions

View File

@ -41,6 +41,7 @@
#include "resource.h"
#include "../crypto/crypto.h"
#include "../uthash/utarray.h"
#include "../uthash/utlist.h"
//#include "../uthash/utstring.h"
#include "helpers.h"
#include "encoding.h"
@ -165,7 +166,7 @@ extern bool bMarkOccurrencesMatchWords;
// Timer bitfield
static volatile LONG g_lTargetTransactionBits = 0;
#define BIT_TIMER_MARK_OCC 1L
//#define BIT_TIMER_MARK_OCC 1L
#define BIT_MARK_OCC_IN_PROGRESS 2L
#define BLOCK_BIT_TARGET_TRANSACTION 4L
@ -194,6 +195,80 @@ bool EditIsInTargetTransaction() {
}
//=============================================================================
//
// Delay Message Queue Handling (TODO: MultiThreading)
//
static CmdMessageQueue_t* MessageQueue = NULL;
// ----------------------------------------------------------------------------
static int msgcmp(void* mqc1, void* mqc2)
{
const CmdMessageQueue_t* pMQC1 = (CmdMessageQueue_t*)mqc1;
const CmdMessageQueue_t* pMQC2 = (CmdMessageQueue_t*)mqc2;
if ((pMQC1->hwnd == pMQC2->hwnd)
&& (pMQC1->cmd == pMQC2->cmd)
&& (pMQC1->wparam == pMQC2->wparam)
&& (pMQC1->lparam == pMQC2->lparam)) {
return 0;
}
return 1;
}
// ----------------------------------------------------------------------------
static void __fastcall _MQ_AppendCmd(CmdMessageQueue_t* pMsgQCmd, int delay)
{
CmdMessageQueue_t* pmqc = NULL;
DL_SEARCH(MessageQueue, pmqc, pMsgQCmd, msgcmp);
if (!pmqc) { // NOT found
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 = 0;
DL_APPEND(MessageQueue, pmqc);
}
if (delay < 2) {
pmqc->delay = 0; // execute next
PostMessage(pMsgQCmd->hwnd, pMsgQCmd->cmd, pMsgQCmd->wparam, pMsgQCmd->lparam);
}
else {
pmqc->delay = (pmqc->delay + delay) / 2; // increase delay
}
}
// ----------------------------------------------------------------------------
//
// called by Timer(IDT_TIMER_MRKALL)
//
static void CALLBACK MQ_ExecuteNext(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
{
UNUSED(hwnd); // must be main wnd
UNUSED(uMsg); // must be WM_TIMER
UNUSED(idEvent); // must be IDT_TIMER_MRKALL
UNUSED(dwTime); // This is the value returned by the GetTickCount function
CmdMessageQueue_t* pmqc;
DL_FOREACH(MessageQueue, pmqc)
{
if (pmqc->delay == 0) {
SendMessage(pmqc->hwnd, pmqc->cmd, pmqc->wparam, pmqc->lparam);
}
if (pmqc->delay >= 0) {
pmqc->delay -= 1;
}
}
}
//=============================================================================
//
// EditSetWordDelimiter()
@ -4892,19 +4967,14 @@ static RegExResult_t __fastcall _FindHasMatch(HWND hwnd, LPCEDITFINDREPLACE lpef
//=============================================================================
//
// _SetTimerMarkAll()
// _DelayMarkAll()
//
//
static void __fastcall _SetTimerMarkAll(HWND hwnd, int delay)
static void __fastcall _DelayMarkAll(HWND hwnd, int delay)
{
TEST_AND_SET(BIT_TIMER_MARK_OCC); // flag to swollow multi-timer calls
if (delay < USER_TIMER_MINIMUM) {
PostMessage(hwnd, WM_TIMER, MAKELONG(IDT_TIMER_MRKALL, 1), 0); // direct timer event
}
else {
SetTimer(hwnd, IDT_TIMER_MRKALL, delay, NULL);
}
static CmdMessageQueue_t mqc = { NULL, WM_COMMAND, (WPARAM)MAKELONG(IDT_TIMER_MAIN_MRKALL, 1), (LPARAM)0 , 0 };
mqc.hwnd = hwnd;
_MQ_AppendCmd(&mqc, (UINT)(delay <= 0 ? 0 : delay));
}
@ -5093,8 +5163,10 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
EditEnsureSelectionVisible(hwnd);
SetTimer(hwnd, IDT_TIMER_MRKALL, USER_TIMER_MINIMUM, MQ_ExecuteNext);
_SetSearchFlags(hwnd, sg_pefrData);
_SetTimerMarkAll(hwnd, 50);
_DelayMarkAll(hwnd, 5);
}
return true;
@ -5104,7 +5176,6 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
if (!bSwitchedFindReplace)
{
sg_pefrData->szFind[0] = '\0';
KillTimer(hwnd, IDT_TIMER_MRKALL);
g_iMarkOccurrences = iSaveMarkOcc;
g_bMarkOccurrencesMatchVisible = bSaveOccVisible;
@ -5118,59 +5189,29 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
iReplacedOccurrences = 0;
g_FindReplaceMatchFoundState = FND_NOP;
if ((g_iMarkOccurrences <= 0) || g_bMarkOccurrencesMatchVisible) {
if (EditToggleView(g_hwndEdit, false)) {
EditToggleView(g_hwndEdit, true);
EditClearAllOccurrenceMarkers(g_hwndEdit, 0, -1);
}
}
EditEnsureSelectionVisible(g_hwndEdit);
}
KillTimer(hwnd, IDT_TIMER_MRKALL);
DeleteObject(hBrushRed);
DeleteObject(hBrushGreen);
DeleteObject(hBrushBlue);
}
return false;
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(BIT_TIMER_MARK_OCC)) {
KillTimer(hwnd, IDT_TIMER_MRKALL);
if (!TEST_AND_SET(BIT_MARK_OCC_IN_PROGRESS))
{
iMarkOccurrencesCount = 0;
_SetSearchFlags(hwnd, sg_pefrData);
if (sg_pefrData->bMarkOccurences) {
if (sg_pefrData->bStateChanged || (StringCchCompareXA(g_lastFind, sg_pefrData->szFind) != 0)) {
IgnoreNotifyChangeEvent();
if (EditToggleView(g_hwndEdit, false)) { SciCall_MarkerDeleteAll(MARKER_NP3_OCCUR_LINE); }
StringCchCopyA(g_lastFind, COUNTOF(g_lastFind), sg_pefrData->szFind);
RegExResult_t match = _FindHasMatch(g_hwndEdit, sg_pefrData, (sg_pefrData->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, sg_pefrData, false, true);
sg_pefrData->bStateChanged = false;
InvalidateRect(GetDlgItem(hwnd, IDC_FINDTEXT), NULL, true);
if (EditToggleView(g_hwndEdit, false)) { EditHideNotMarkedLineRange(g_hwndEdit, -1, -1, true); }
ObserveNotifyChangeEvent();
}
}
TEST_AND_RESET(BIT_MARK_OCC_IN_PROGRESS); // done
}
}
return true;
}
}
return false;
case WM_ACTIVATE:
{
DialogEnableWindow(hwnd, IDC_REPLACEINSEL, !SciCall_IsSelectionEmpty());
if (sg_pefrData->bMarkOccurences) {
_SetTimerMarkAll(hwnd,50);
_DelayMarkAll(hwnd,5);
}
//if (LOWORD(wParam) == WA_INACTIVE) {
@ -5270,11 +5311,39 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
}
_SetSearchFlags(hwnd, sg_pefrData);
_SetTimerMarkAll(hwnd, 50);
_DelayMarkAll(hwnd, 5);
}
break;
case IDT_TIMER_MAIN_MRKALL:
{
if (!TEST_AND_SET(BIT_MARK_OCC_IN_PROGRESS)) {
iMarkOccurrencesCount = 0;
_SetSearchFlags(hwnd, sg_pefrData);
if (sg_pefrData->bMarkOccurences) {
if (sg_pefrData->bStateChanged || (StringCchCompareXA(g_lastFind, sg_pefrData->szFind) != 0)) {
IgnoreNotifyChangeEvent();
if (EditToggleView(g_hwndEdit, false)) { SciCall_MarkerDeleteAll(MARKER_NP3_OCCUR_LINE); }
StringCchCopyA(g_lastFind, COUNTOF(g_lastFind), sg_pefrData->szFind);
RegExResult_t match = _FindHasMatch(g_hwndEdit, sg_pefrData, (sg_pefrData->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, sg_pefrData, false, true);
sg_pefrData->bStateChanged = false;
InvalidateRect(GetDlgItem(hwnd, IDC_FINDTEXT), NULL, true);
if (EditToggleView(g_hwndEdit, false)) { EditHideNotMarkedLineRange(g_hwndEdit, -1, -1, true); }
ObserveNotifyChangeEvent();
}
}
TEST_AND_RESET(BIT_MARK_OCC_IN_PROGRESS); // done
}
}
return false;
case IDC_ALL_OCCURRENCES:
{
_SetSearchFlags(hwnd, sg_pefrData);
@ -5304,7 +5373,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_MARKOCCUR_VISIBLE, g_bMarkOccurrencesMatchVisible);
EnableCmd(GetMenu(g_hwndMain), IDM_VIEW_TOGGLE_VIEW, (g_iMarkOccurrences > 0) && !g_bMarkOccurrencesMatchVisible);
_SetTimerMarkAll(hwnd,0);
_DelayMarkAll(hwnd,0);
}
break;
@ -5314,7 +5383,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
EditToggleView(g_hwndEdit, true);
EditClearAllOccurrenceMarkers(g_hwndEdit, 0, -1);
sg_pefrData->bStateChanged = true;
_SetTimerMarkAll(hwnd, 0);
_DelayMarkAll(hwnd, 0);
}
else {
EditToggleView(g_hwndEdit, true);
@ -5336,12 +5405,12 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, (sg_pefrData->bTransformBS) ? BST_CHECKED : BST_UNCHECKED);
}
_SetSearchFlags(hwnd, sg_pefrData);
_SetTimerMarkAll(hwnd,0);
_DelayMarkAll(hwnd,0);
break;
case IDC_DOT_MATCH_ALL:
_SetSearchFlags(hwnd, sg_pefrData);
_SetTimerMarkAll(hwnd,0);
_DelayMarkAll(hwnd,0);
break;
case IDC_WILDCARDSEARCH:
@ -5357,7 +5426,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
CheckDlgButton(hwnd, IDC_FINDTRANSFORMBS, (sg_pefrData->bTransformBS) ? BST_CHECKED : BST_UNCHECKED);
}
_SetSearchFlags(hwnd, sg_pefrData);
_SetTimerMarkAll(hwnd,0);
_DelayMarkAll(hwnd,0);
break;
case IDC_FINDTRANSFORMBS:
@ -5368,22 +5437,22 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
bSaveTFBackSlashes = false;
}
_SetSearchFlags(hwnd, sg_pefrData);
_SetTimerMarkAll(hwnd,0);
_DelayMarkAll(hwnd,0);
break;
case IDC_FINDCASE:
_SetSearchFlags(hwnd, sg_pefrData);
_SetTimerMarkAll(hwnd,0);
_DelayMarkAll(hwnd,0);
break;
case IDC_FINDWORD:
_SetSearchFlags(hwnd, sg_pefrData);
_SetTimerMarkAll(hwnd,0);
_DelayMarkAll(hwnd,0);
break;
case IDC_FINDSTART:
_SetSearchFlags(hwnd, sg_pefrData);
_SetTimerMarkAll(hwnd,0);
_DelayMarkAll(hwnd,0);
break;
@ -5507,7 +5576,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
break;
}
}
_SetTimerMarkAll(hwnd,50);
_DelayMarkAll(hwnd,5);
break;
@ -5526,7 +5595,7 @@ INT_PTR CALLBACK EditFindReplaceDlgProcW(HWND hwnd,UINT umsg,WPARAM wParam,LPARA
SetDlgItemTextW(hwnd, IDC_REPLACETEXT, wszFind);
g_FindReplaceMatchFoundState = FND_NOP;
_SetSearchFlags(hwnd, sg_pefrData);
_SetTimerMarkAll(hwnd,50);
_DelayMarkAll(hwnd,5);
}
break;

View File

@ -44,6 +44,7 @@
#include "resource.h"
#include "../crypto/crypto.h"
#include "../uthash/utarray.h"
#include "../uthash/utlist.h"
#include "encoding.h"
#include "helpers.h"
#include "SciCall.h"
@ -335,22 +336,20 @@ static char g_pTempLineBufferMain[TEMPLINE_BUFFER];
static UT_icd UndoRedoSelection_icd = { sizeof(UndoRedoSelection_t), NULL, NULL, NULL };
static UT_array* UndoRedoSelectionUTArray = NULL;
static CLIPFORMAT cfDrpF = CF_HDROP;
static POINTL ptDummy = { 0, 0 };
static PDROPTARGET pDropTarget = NULL;
static DWORD DropFilesProc(CLIPFORMAT cf, HGLOBAL hData, HWND hWnd, DWORD dwKeyState, POINTL pt, void *pUserData);
// Timer bitfield
static volatile LONG g_lInterlockBits = 0;
#define BIT_TIMER_MARK_OCC 1L
#define BIT_MARK_OCC_IN_PROGRESS 2L
//static volatile LONG g_lInterlockBits = 0;
//#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 BIT_TIMER_UPDATE_HYPER 4L
#define BIT_UPDATE_HYPER_IN_PROGRESS 8L
#define TEST_AND_SET(B) InterlockedBitTestAndSet(&g_lInterlockBits, B)
#define TEST_AND_RESET(B) InterlockedBitTestAndReset(&g_lInterlockBits, B)
//#define TEST_AND_SET(B) InterlockedBitTestAndSet(&g_lInterlockBits, B)
//#define TEST_AND_RESET(B) InterlockedBitTestAndReset(&g_lInterlockBits, B)
//=============================================================================
@ -382,6 +381,80 @@ bool CheckNotifyChangeEvent() {
#define SC_UPDATE_NP3_INTERNAL_NOTIFY (SC_UPDATE_H_SCROLL << 1)
//=============================================================================
//
// Delay Message Queue Handling (TODO: MultiThreading)
//
static CmdMessageQueue_t* MessageQueue = NULL;
// ----------------------------------------------------------------------------
static int msgcmp(void* mqc1, void* mqc2)
{
const CmdMessageQueue_t* pMQC1 = (CmdMessageQueue_t*)mqc1;
const CmdMessageQueue_t* pMQC2 = (CmdMessageQueue_t*)mqc2;
if ((pMQC1->hwnd == pMQC2->hwnd)
&& (pMQC1->cmd == pMQC2->cmd)
&& (pMQC1->wparam == pMQC2->wparam)
&& (pMQC1->lparam == pMQC2->lparam))
{
return 0;
}
return 1;
}
// ----------------------------------------------------------------------------
static void __fastcall _MQ_AppendCmd(CmdMessageQueue_t* pMsgQCmd, int delay)
{
CmdMessageQueue_t* pmqc = NULL;
DL_SEARCH(MessageQueue, pmqc, pMsgQCmd, msgcmp);
if (!pmqc) { // NOT found
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 = 0;
DL_APPEND(MessageQueue, pmqc);
}
if (delay < 2) {
pmqc->delay = 0; // execute next
PostMessage(pMsgQCmd->hwnd, pMsgQCmd->cmd, pMsgQCmd->wparam, pMsgQCmd->lparam);
}
else {
pmqc->delay = (pmqc->delay + delay) / 2; // increase delay
}
}
// ----------------------------------------------------------------------------
//
// called by Timer(IDT_TIMER_MRKALL)
//
static void CALLBACK MQ_ExecuteNext(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
{
UNUSED(hwnd); // must be main wnd
UNUSED(uMsg); // must be WM_TIMER
UNUSED(idEvent); // must be IDT_TIMER_MRKALL
UNUSED(dwTime); // This is the value returned by the GetTickCount function
CmdMessageQueue_t* pmqc;
DL_FOREACH(MessageQueue, pmqc)
{
if (pmqc->delay == 0) {
SendMessage(pmqc->hwnd, pmqc->cmd, pmqc->wparam, pmqc->lparam);
}
if (pmqc->delay >= 0) {
pmqc->delay -= 1;
}
}
}
//=============================================================================
//
// Flags
@ -577,6 +650,8 @@ int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInst,LPSTR lpCmdLine,int n
UpdateLineNumberWidth();
ObserveNotifyChangeEvent();
SetTimer(hwnd, IDT_TIMER_MRKALL, USER_TIMER_MINIMUM, MQ_ExecuteNext);
while (GetMessage(&msg,NULL,0,0))
{
if (IsWindow(g_hwndDlgFindReplace) && ((msg.hwnd == g_hwndDlgFindReplace) || IsChild(g_hwndDlgFindReplace, msg.hwnd)))
@ -594,8 +669,18 @@ int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInst,LPSTR lpCmdLine,int n
TranslateMessage(&msg);
DispatchMessage(&msg);
}
//MQ_ExecuteNext(); // delayed messages
}
CmdMessageQueue_t* pmqc = NULL;
CmdMessageQueue_t* dummy;
DL_FOREACH_SAFE(MessageQueue, pmqc, dummy)
{
DL_DELETE(MessageQueue, pmqc);
FreeMem(pmqc);
}
KillTimer(hwnd, IDT_TIMER_MRKALL);
// Save Settings is done elsewhere
Scintilla_ReleaseResources();
@ -1082,38 +1167,6 @@ LRESULT CALLBACK MainWndProc(HWND hwnd,UINT umsg,WPARAM wParam,LPARAM lParam)
UpdateVisibleUrlHotspot(0);
return DefWindowProc(hwnd,umsg,wParam,lParam);
case WM_TIMER:
{
// The KillTimer function does not remove WM_TIMER messages already posted to the message queue.
if (LOWORD(wParam) == IDT_TIMER_MAIN_MRKALL)
{
if (TEST_AND_RESET(BIT_TIMER_MARK_OCC)) {
KillTimer(hwnd, IDT_TIMER_MAIN_MRKALL);
if (!TEST_AND_SET(BIT_MARK_OCC_IN_PROGRESS))
{
EditMarkAllOccurrences();
TEST_AND_RESET(BIT_MARK_OCC_IN_PROGRESS); // done
}
}
return true;
}
else if (LOWORD(wParam) == IDT_TIMER_UPDATE_HOTSPOT)
{
if (TEST_AND_RESET(BIT_TIMER_UPDATE_HYPER)) {
KillTimer(hwnd, IDT_TIMER_UPDATE_HOTSPOT);
if (!TEST_AND_SET(BIT_UPDATE_HYPER_IN_PROGRESS))
{
EditUpdateVisibleUrlHotspot(g_bHyperlinkHotspot);
TEST_AND_RESET(BIT_UPDATE_HYPER_IN_PROGRESS); // done
}
}
return true;
}
}
break;
case WM_SIZE:
MsgSize(hwnd,wParam,lParam);
break;
@ -2590,6 +2643,17 @@ LRESULT MsgCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
{
switch(LOWORD(wParam))
{
case IDT_TIMER_MAIN_MRKALL:
EditMarkAllOccurrences();
break;
case IDT_TIMER_UPDATE_HOTSPOT:
EditUpdateVisibleUrlHotspot(g_bHyperlinkHotspot);
break;
case IDM_FILE_NEW:
FileLoad(false,true,false,bSkipUnicodeDetection,bSkipANSICodePageDetection,L"");
break;
@ -6180,10 +6244,10 @@ void LoadSettings()
iMarkOccurrencesMaxCount = (iMarkOccurrencesMaxCount <= 0) ? INT_MAX : iMarkOccurrencesMaxCount;
iUpdateDelayHyperlinkStyling = IniSectionGetInt(pIniSection, L"UpdateDelayHyperlinkStyling", 100);
iUpdateDelayHyperlinkStyling = max(min(iUpdateDelayHyperlinkStyling, 10000), 0);
iUpdateDelayHyperlinkStyling = max(min(iUpdateDelayHyperlinkStyling, 10000), 10) / (int)USER_TIMER_MINIMUM;
iUpdateDelayMarkAllCoccurrences = IniSectionGetInt(pIniSection, L"UpdateDelayMarkAllCoccurrences", 50);
iUpdateDelayMarkAllCoccurrences = max(min(iUpdateDelayMarkAllCoccurrences, 10000), 0);
iUpdateDelayMarkAllCoccurrences = max(min(iUpdateDelayMarkAllCoccurrences, 10000), 10) / (int)USER_TIMER_MINIMUM;
bDenyVirtualSpaceAccess = IniSectionGetBool(pIniSection, L"DenyVirtualSpaceAccess", false);
bUseOldStyleBraceMatching = IniSectionGetBool(pIniSection, L"UseOldStyleBraceMatching", false);
@ -7117,14 +7181,9 @@ int CreateIniFileEx(LPCWSTR lpszIniFile) {
//
void MarkAllOccurrences(int delay)
{
TEST_AND_SET(BIT_TIMER_MARK_OCC); // raise flag to swollow next calls
if (delay < USER_TIMER_MINIMUM) {
PostMessage(g_hwndMain, WM_TIMER, MAKELONG(IDT_TIMER_MAIN_MRKALL, 1), 0); // direct timer event
}
else {
SetTimer(g_hwndMain, IDT_TIMER_MAIN_MRKALL, delay, NULL);
}
static CmdMessageQueue_t mqc = { NULL, WM_COMMAND, (WPARAM)MAKELONG(IDT_TIMER_MAIN_MRKALL, 1), (LPARAM)0 , 0 };
mqc.hwnd = g_hwndMain;
_MQ_AppendCmd(&mqc, (UINT)(delay <= 0 ? 0 : delay));
}
@ -7134,14 +7193,9 @@ void MarkAllOccurrences(int delay)
//
void UpdateVisibleUrlHotspot(int delay)
{
TEST_AND_SET(BIT_TIMER_UPDATE_HYPER); // raise flag to swollow next calls
if (delay < USER_TIMER_MINIMUM) {
PostMessage(g_hwndMain, WM_TIMER, MAKELONG(IDT_TIMER_UPDATE_HOTSPOT, 1), 0); // direct timer event
}
else {
SetTimer(g_hwndMain, IDT_TIMER_UPDATE_HOTSPOT, delay, NULL);
}
static CmdMessageQueue_t mqc = { NULL, WM_COMMAND, (WPARAM)MAKELONG(IDT_TIMER_UPDATE_HOTSPOT, 1), (LPARAM)0 , 0 };
mqc.hwnd = g_hwndMain;
_MQ_AppendCmd(&mqc, (UINT)(delay <= 0 ? 0 : delay));
}

View File

@ -97,6 +97,25 @@ typedef struct _editfindreplace
#define IDMSG_SWITCHTOFIND 300
#define IDMSG_SWITCHTOREPLACE 301
// --------------------------------------------------------------------------
typedef struct _cmq
{
HWND hwnd;
UINT cmd;
WPARAM wparam;
LPARAM lparam;
int delay;
struct _cmq* next;
struct _cmq* prev;
} CmdMessageQueue_t;
#define MESSAGE_QUEUE_INIT = { NULL, WM_COMMAND, NULL, NULL, -1 };
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
#define MARKER_NP3_BOOKMARK 1