void StressTest::Finished(bool success) { win->stressTest = nullptr; // make sure we're not double-deleted if (success) { int secs = SecsSinceSystemTime(stressStartTime); AutoFreeW tm(FormatTime(secs)); AutoFreeW s(str::Format(L"Stress test complete, rendered %d files in %s", filesCount, tm)); win->ShowNotification(s, NOS_PERSIST, NG_STRESS_TEST_SUMMARY); } CloseWindow(win, exitWhenDone && MayCloseWindow(win)); delete this; }
static LRESULT CALLBACK WndProcTocTree(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { WindowInfo *win = FindWindowInfoByHwnd(hwnd); if (!win) return CallWindowProc(DefWndProcTocTree, hwnd, message, wParam, lParam); switch (message) { case WM_ERASEBKGND: return FALSE; case WM_CHAR: if (VK_ESCAPE == wParam && gGlobalPrefs->escToExit && MayCloseWindow(win)) CloseWindow(win, true); break; case WM_KEYDOWN: // consistently expand/collapse whole (sub)trees if (VK_MULTIPLY == wParam && IsShiftPressed()) TreeView_ExpandRecursively(hwnd, TreeView_GetRoot(hwnd), TVE_EXPAND); else if (VK_MULTIPLY == wParam) TreeView_ExpandRecursively(hwnd, TreeView_GetSelection(hwnd), TVE_EXPAND, true); else if (VK_DIVIDE == wParam && IsShiftPressed()) { HTREEITEM root = TreeView_GetRoot(hwnd); if (!TreeView_GetNextSibling(hwnd, root)) root = TreeView_GetChild(hwnd, root); TreeView_ExpandRecursively(hwnd, root, TVE_COLLAPSE); } else if (VK_DIVIDE == wParam) TreeView_ExpandRecursively(hwnd, TreeView_GetSelection(hwnd), TVE_COLLAPSE, true); else break; TreeView_EnsureVisible(hwnd, TreeView_GetSelection(hwnd)); return 0; case WM_MOUSEWHEEL: case WM_MOUSEHWHEEL: // scroll the canvas if the cursor isn't over the ToC tree if (!IsCursorOverWindow(win->hwndTocTree)) return SendMessage(win->hwndCanvas, message, wParam, lParam); break; #ifdef DISPLAY_TOC_PAGE_NUMBERS case WM_SIZE: case WM_HSCROLL: // Repaint the ToC so that RelayoutTocItem is called for all items PostMessage(hwnd, WM_APP_REPAINT_TOC, 0, 0); break; case WM_APP_REPAINT_TOC: InvalidateRect(hwnd, nullptr, TRUE); UpdateWindow(hwnd); break; #endif } return CallWindowProc(DefWndProcTocTree, hwnd, message, wParam, lParam); }
static LRESULT CALLBACK WndProcFavTree(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { WindowInfo* win = FindWindowInfoByHwnd(hwnd); if (!win) return CallWindowProc(DefWndProcFavTree, hwnd, msg, wParam, lParam); switch (msg) { case WM_ERASEBKGND: return FALSE; case WM_CHAR: if (VK_ESCAPE == wParam && gGlobalPrefs->escToExit && MayCloseWindow(win)) CloseWindow(win, true); break; case WM_MOUSEWHEEL: case WM_MOUSEHWHEEL: // scroll the canvas if the cursor isn't over the ToC tree if (!IsCursorOverWindow(win->hwndFavTree)) return SendMessage(win->hwndCanvas, msg, wParam, lParam); break; } return CallWindowProc(DefWndProcFavTree, hwnd, msg, wParam, lParam); }