本文整理汇总了C++中WindowInfo::AsFixed方法的典型用法代码示例。如果您正苦于以下问题:C++ WindowInfo::AsFixed方法的具体用法?C++ WindowInfo::AsFixed怎么用?C++ WindowInfo::AsFixed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WindowInfo
的用法示例。
在下文中一共展示了WindowInfo::AsFixed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: args
static WindowInfo *LoadOnStartup(const WCHAR *filePath, CommandLineInfo& i, bool isFirstWin)
{
LoadArgs args(filePath);
args.showWin = !(i.printDialog && i.exitWhenDone) && !gPluginMode;
WindowInfo *win = LoadDocument(args);
if (!win)
return win;
if (win->IsDocLoaded() && i.destName && isFirstWin) {
win->linkHandler->GotoNamedDest(i.destName);
} else if (win->IsDocLoaded() && i.pageNumber > 0 && isFirstWin) {
if (win->ctrl->ValidPageNo(i.pageNumber))
win->ctrl->GoToPage(i.pageNumber, false);
}
if (i.hwndPluginParent)
MakePluginWindow(*win, i.hwndPluginParent);
if (!win->IsDocLoaded() || !isFirstWin)
return win;
if (i.enterPresentation || i.enterFullScreen) {
if (i.enterPresentation && win->isFullScreen || i.enterFullScreen && win->presentation)
ExitFullScreen(*win);
EnterFullScreen(*win, i.enterPresentation);
}
if (i.startView != DM_AUTOMATIC)
SwitchToDisplayMode(win, i.startView);
if (i.startZoom != INVALID_ZOOM)
ZoomToSelection(win, i.startZoom);
if ((i.startScroll.x != -1 || i.startScroll.y != -1) && win->AsFixed()) {
DisplayModel *dm = win->AsFixed();
ScrollState ss = dm->GetScrollState();
ss.x = i.startScroll.x;
ss.y = i.startScroll.y;
dm->SetScrollState(ss);
}
if (i.forwardSearchOrigin && i.forwardSearchLine && win->AsFixed() && win->AsFixed()->pdfSync) {
UINT page;
Vec<RectI> rects;
ScopedMem<WCHAR> sourcePath(path::Normalize(i.forwardSearchOrigin));
int ret = win->AsFixed()->pdfSync->SourceToDoc(sourcePath, i.forwardSearchLine, 0, &page, rects);
ShowForwardSearchResult(win, sourcePath, i.forwardSearchLine, 0, ret, page, rects);
}
return win;
}
示例2: OnTimer
void StressTest::OnTimer(int timerIdGot)
{
CrashIf(timerId != timerIdGot);
KillTimer(win->hwndFrame, timerId);
if (!win->IsDocLoaded()) {
if (!GoToNextFile()) {
Finished(true);
return;
}
TickTimer();
return;
}
// chm documents aren't rendered and we block until we show them
// so we can assume previous page has been shown and go to next page
if (!win->AsFixed()) {
if (!GoToNextPage())
return;
goto Next;
}
// For non-image files, we detect if a page was rendered by checking the cache
// (but we don't wait more than 3 seconds).
// Image files are always fully rendered in WM_PAINT, so we know the page
// has already been rendered.
DisplayModel *dm = win->AsFixed();
bool didRender = gRenderCache.Exists(dm, currPage, dm->GetRotation());
if (!didRender && dm->ShouldCacheRendering(currPage)) {
double timeInMs = currPageRenderTime.GetTimeInMs();
if (timeInMs > 3.0 * 1000) {
if (!GoToNextPage())
return;
}
}
else if (!GoToNextPage()) {
return;
}
MakeRandomSelection(win, currPage);
Next:
TickTimer();
}
示例3: OpenFile
bool StressTest::OpenFile(const WCHAR *fileName)
{
wprintf(L"%s\n", fileName);
fflush(stdout);
LoadArgs args(fileName);
args.forceReuse = rand() % 3 != 1;
WindowInfo *w = LoadDocument(args);
if (!w)
return false;
if (w == win) { // WindowInfo reused
if (!win->IsDocLoaded())
return false;
} else if (!w->IsDocLoaded()) { // new WindowInfo
CloseWindow(w, false);
return false;
}
// transfer ownership of stressTest object to a new window and close the
// current one
assert(this == win->stressTest);
if (w != win) {
if (win->IsDocLoaded()) {
// try to provoke a crash in RenderCache cleanup code
ClientRect rect(win->hwndFrame);
rect.Inflate(rand() % 10, rand() % 10);
SendMessage(win->hwndFrame, WM_SIZE, 0, MAKELONG(rect.dx, rect.dy));
if (win->AsFixed())
win->cbHandler->RequestRendering(1);
win->RepaintAsync();
}
WindowInfo *toClose = win;
w->stressTest = win->stressTest;
win->stressTest = nullptr;
win = w;
CloseWindow(toClose, false);
}
if (!win->IsDocLoaded())
return false;
win->ctrl->SetDisplayMode(DM_CONTINUOUS);
win->ctrl->SetZoomVirtual(ZOOM_FIT_PAGE);
win->ctrl->GoToFirstPage();
if (win->tocVisible || gGlobalPrefs->showFavorites)
SetSidebarVisibility(win, win->tocVisible, gGlobalPrefs->showFavorites);
currPage = pageRanges.At(0).start;
win->ctrl->GoToPage(currPage, false);
currPageRenderTime.Start();
++filesCount;
pageForSearchStart = (rand() % win->ctrl->PageCount()) + 1;
// search immediately in single page documents
if (1 == pageForSearchStart) {
// use text that is unlikely to be found, so that we search all pages
win::SetText(win->hwndFindBox, L"!z_yt");
FindTextOnThread(win, FIND_FORWARD, true);
}
int secs = SecsSinceSystemTime(stressStartTime);
ScopedMem<WCHAR> tm(FormatTime(secs));
ScopedMem<WCHAR> s(str::Format(L"File %d: %s, time: %s", filesCount, fileName, tm));
win->ShowNotification(s, NOS_PERSIST, NG_STRESS_TEST_SUMMARY);
return true;
}