本文整理汇总了C++中DisplayModel::GetRotation方法的典型用法代码示例。如果您正苦于以下问题:C++ DisplayModel::GetRotation方法的具体用法?C++ DisplayModel::GetRotation怎么用?C++ DisplayModel::GetRotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DisplayModel
的用法示例。
在下文中一共展示了DisplayModel::GetRotation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: CopySelectionToClipboard
void CopySelectionToClipboard(WindowInfo* win) {
if (!win->currentTab || !win->currentTab->selectionOnPage)
return;
CrashIf(win->currentTab->selectionOnPage->size() == 0 && win->mouseAction != MouseAction::SelectingText);
if (win->currentTab->selectionOnPage->size() == 0)
return;
CrashIf(!win->AsFixed());
if (!win->AsFixed())
return;
if (!OpenClipboard(nullptr))
return;
EmptyClipboard();
DisplayModel* dm = win->AsFixed();
#ifndef DISABLE_DOCUMENT_RESTRICTIONS
if (!dm->GetEngine()->AllowsCopyingText())
win->ShowNotification(_TR("Copying text was denied (copying as image only)"));
else
#endif
if (!dm->GetEngine()->IsImageCollection()) {
AutoFreeW selText;
bool isTextSelection = dm->textSelection->result.len > 0;
if (isTextSelection) {
selText.Set(dm->textSelection->ExtractText(L"\r\n"));
} else {
WStrVec selections;
for (SelectionOnPage& sel : *win->currentTab->selectionOnPage) {
WCHAR* text = dm->GetTextInRegion(sel.pageNo, sel.rect);
if (text)
selections.Push(text);
}
selText.Set(selections.Join());
}
// don't copy empty text
if (!str::IsEmpty(selText.Get()))
CopyTextToClipboard(selText, true);
if (isTextSelection) {
// don't also copy the first line of a text selection as an image
CloseClipboard();
return;
}
}
/* also copy a screenshot of the current selection to the clipboard */
SelectionOnPage* selOnPage = &win->currentTab->selectionOnPage->at(0);
RenderedBitmap* bmp = dm->GetEngine()->RenderBitmap(selOnPage->pageNo, dm->GetZoomReal(), dm->GetRotation(),
&selOnPage->rect, RenderTarget::Export);
if (bmp)
CopyImageToClipboard(bmp->GetBitmap(), true);
delete bmp;
CloseClipboard();
}
示例3: OnMenuPrint
//.........这里部分代码省略.........
pd.nMaxPageRanges = MAXPAGERANGES;
PRINTPAGERANGE *ppr = AllocArray<PRINTPAGERANGE>(MAXPAGERANGES);
pd.lpPageRanges = ppr;
ppr->nFromPage = 1;
ppr->nToPage = dm->PageCount();
pd.nMinPage = 1;
pd.nMaxPage = dm->PageCount();
pd.nStartPage = START_PAGE_GENERAL;
Print_Advanced_Data advanced(PrintRangeAll, defaultScaleAdv, defaultAsImage);
ScopedMem<DLGTEMPLATE> dlgTemplate; // needed for RTL languages
HPROPSHEETPAGE hPsp = CreatePrintAdvancedPropSheet(&advanced, dlgTemplate);
pd.lphPropertyPages = &hPsp;
pd.nPropertyPages = 1;
// restore remembered settings
if (defaultDevMode) {
DEVMODE *p = defaultDevMode.Get();
pd.hDevMode = GlobalMemDup(p, p->dmSize + p->dmDriverExtra);
}
if (PrintDlgEx(&pd) != S_OK) {
if (CommDlgExtendedError() != 0) {
/* if PrintDlg was cancelled then
CommDlgExtendedError is zero, otherwise it returns the
error code, which we could look at here if we wanted.
for now just warn the user that printing has stopped
becasue of an error */
MessageBoxWarning(win->hwndFrame, _TR("Couldn't initialize printer"),
_TR("Printing problem."));
}
goto Exit;
}
if (pd.dwResultAction == PD_RESULT_PRINT || pd.dwResultAction == PD_RESULT_APPLY) {
// remember settings for this process
LPDEVMODE devMode = (LPDEVMODE)GlobalLock(pd.hDevMode);
if (devMode) {
defaultDevMode.Set((LPDEVMODE)memdup(devMode, devMode->dmSize + devMode->dmDriverExtra));
GlobalUnlock(pd.hDevMode);
}
defaultScaleAdv = advanced.scale;
defaultAsImage = advanced.asImage;
}
if (pd.dwResultAction != PD_RESULT_PRINT)
goto Exit;
if (pd.Flags & PD_CURRENTPAGE) {
PRINTPAGERANGE pr = { dm->CurrentPageNo(), dm->CurrentPageNo() };
ranges.Append(pr);
} else if (win->selectionOnPage && (pd.Flags & PD_SELECTION)) {
printSelection = true;
} else if (!(pd.Flags & PD_PAGENUMS)) {
PRINTPAGERANGE pr = { 1, dm->PageCount() };
ranges.Append(pr);
} else {
assert(pd.nPageRanges > 0);
for (DWORD i = 0; i < pd.nPageRanges; i++)
ranges.Append(pd.lpPageRanges[i]);
}
LPDEVNAMES devNames = (LPDEVNAMES)GlobalLock(pd.hDevNames);
LPDEVMODE devMode = (LPDEVMODE)GlobalLock(pd.hDevMode);
if (devNames) {
printerInfo.pDriverName = (LPWSTR)devNames + devNames->wDriverOffset;
printerInfo.pPrinterName = (LPWSTR)devNames + devNames->wDeviceOffset;
printerInfo.pPortName = (LPWSTR)devNames + devNames->wOutputOffset;
}
PrintData *data = new PrintData(dm->engine(), &printerInfo, devMode, ranges, advanced,
dm->GetRotation(), printSelection ? win->selectionOnPage : NULL);
if (devNames)
GlobalUnlock(pd.hDevNames);
if (devMode)
GlobalUnlock(pd.hDevMode);
// if a file is missing and the engine can't thus be cloned,
// we print using the original engine on the main thread
// so that the document can't be closed and the original engine
// unexpectedly deleted
// TODO: instead prevent closing the document so that printing
// can still happen on a separate thread and be interruptible
bool failedEngineClone = dm->engine() && !data->engine;
if (failedEngineClone)
data->engine = dm->engine();
if (!waitForCompletion && !failedEngineClone)
PrintToDeviceOnThread(win, data);
else {
PrintToDevice(*data);
if (failedEngineClone)
data->engine = NULL;
delete data;
}
Exit:
free(ppr);
GlobalFree(pd.hDevNames);
GlobalFree(pd.hDevMode);
}