virtual void UpdateProgress(int current, int total) { uitask::Post([=] { if (WindowInfoStillValid(win) && win->notifications->Contains(wnd)) { wnd->UpdateProgress(current, total); } }); }
virtual void Execute() { if (WindowInfoStillValid(win) && !win->findCanceled) { if (win->notifications->Contains(wnd)) { wnd->UpdateProgress(current, total); } else { // the search has been canceled by closing the notification win->findCanceled = true; } } }
void HideUI(bool success, bool loopedAround) { LPARAM enable = (LPARAM)MAKELONG(1, 0); SendMessage(win->hwndToolbar, TB_ENABLEBUTTON, IDM_FIND_PREV, enable); SendMessage(win->hwndToolbar, TB_ENABLEBUTTON, IDM_FIND_NEXT, enable); SendMessage(win->hwndToolbar, TB_ENABLEBUTTON, IDM_FIND_MATCH, enable); if (!win->notifications->Contains(wnd)) /* our notification has been replaced or closed (or never created) */; else if (!success && !loopedAround) // i.e. canceled win->notifications->RemoveNotification(wnd); else if (!success && loopedAround) wnd->UpdateMessage(_TR("No matches were found"), 3000); else { ScopedMem<WCHAR> label(win->dm->engine->GetPageLabel(win->dm->textSearch->GetCurrentPageNo())); ScopedMem<WCHAR> buf(str::Format(_TR("Found text at page %s"), label)); if (loopedAround) buf.Set(str::Format(_TR("Found text at page %s (again)"), label)); wnd->UpdateMessage(buf, 3000, loopedAround); } }
virtual void Execute() { if (WindowInfoStillValid(win) && win->notifications->Contains(wnd)) wnd->UpdateProgress(current, total); }