这篇教程C++ CrashIf函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CrashIf函数的典型用法代码示例。如果您正苦于以下问题:C++ CrashIf函数的具体用法?C++ CrashIf怎么用?C++ CrashIf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CrashIf函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: CrashIfvoid EbookController::HandleMobiLayoutDone(EbookFormattingTask *ld){ if (formattingThreadNo != ld->threadNo) { // this is a message from cancelled thread, we can disregard //lf("EbookController::MobiLayout() thread msg discarded, curr thread: %d, sending thread: %d", layoutThreadNo, ld->threadNo); return; } //lf("EbookController::HandleMobiLayoutMsg() %d pages, ld=0x%x", ld->pageCount, (int)ld); HtmlPage *pageToShow = NULL; if (!ld->fromBeginning) { // if this is the first page sent, we're currently showing a page // formatted for old window size. Replace that page with new page if (0 == formattingTemp.pagesFromPage.Count()) { CrashIf(0 == ld->pageCount); pageToShow = ld->pages[0]; } formattingTemp.pagesFromPage.Append(ld->pages, ld->pageCount); if (pageToShow) { CrashIf(pageToShow->reparseIdx != pageShown->reparseIdx); ShowPage(pageToShow, false); } //lf("Got %d pages from page, total %d", ld->pageCount, formattingTemp.pagesFromPage.Count()); //UpdateStatus(); return; } // we're showing pages from the beginning if (-1 != startReparseIdx) { // we're formatting a book for which we need to restore // page from previous session CrashIf(formattingTemp.reparseIdx != 0); for (size_t i = 0; i < ld->pageCount; i++) { HtmlPage *pd = ld->pages[i]; if (pd->reparseIdx == startReparseIdx) { pageToShow = pd; } else if (pd->reparseIdx >= startReparseIdx) { // this is the first page whose reparseIdx is greater than // the one we're looking for, so previous page has the data if (i > 0) { pageToShow = ld->pages[i]; //lf("showing page %d", i); } else { if (0 == formattingTemp.pagesFromBeginning.Count()) { pageToShow = ld->pages[0]; } else { size_t pageNo = formattingTemp.pagesFromBeginning.Count() - 1; //lf("showing page %d from formattingTemp.pagesFromBeginning", (int)pageNo); pageToShow = formattingTemp.pagesFromBeginning.At(pageNo); } } } if (pageToShow) { startReparseIdx = -1; break; } } } else { if (0 == formattingTemp.pagesFromBeginning.Count()) { CrashIf(0 == ld->pageCount); pageToShow = ld->pages[0]; //lf("showing ld->pages[0], pageCount = %d", ld->pageCount); } } formattingTemp.pagesFromBeginning.Append(ld->pages, ld->pageCount); //lf("Got %d pages from beginning, total %d", ld->pageCount, formattingTemp.pagesFromBeginning.Count()); if (0 == formattingTemp.reparseIdx) { // if we're starting from the beginning, show the first page as // quickly as we can if (pageToShow) ShowPage(pageToShow, false); } if (ld->finished) { CrashIf(pagesFromBeginning || pagesFromPage); pagesFromBeginning = new Vec<HtmlPage *>(formattingTemp.pagesFromBeginning); formattingTemp.pagesFromBeginning.Reset(); size_t pageCount = formattingTemp.pagesFromPage.Count(); if (pageCount > 0) { pagesFromPage = new Vec<HtmlPage *>(formattingTemp.pagesFromPage); formattingTemp.pagesFromPage.Reset(); } StopFormattingThread(); } UpdateStatus();}
开发者ID:Jshauk,项目名称:sumatrapdf,代码行数:89,
示例2: CrashIfRectF TextRenderGdiplus::Measure(const WCHAR *s, size_t sLen) { CrashIf(!currFont); return MeasureText(gfx, currFont->font, s, sLen, measureAlgo);}
开发者ID:qingzhengzhuma,项目名称:sumatrapdf,代码行数:4,
示例3: EbookFormattingData EbookFormattingData(HtmlPage **pages, size_t pageCount, bool finished, LONG threadNo) : pageCount(pageCount), finished(finished), threadNo(threadNo) { CrashIf(pageCount > MAX_PAGES); memcpy(this->pages, pages, pageCount * sizeof(*pages)); }
开发者ID:jayceefun,项目名称:sumatrapdf,代码行数:5,
示例4: CrashIfvoid HwndWrapper::OnPaint(HWND hwnd){ CrashIf(hwnd != hwndParent); painter->Paint(hwnd, repaintRequested); repaintRequested = false;}
开发者ID:Jshauk,项目名称:sumatrapdf,代码行数:6,
示例5: AddStylePropstatic void AddStyleProp(Style *style, TxtNode *prop){ ScopedMem<char> tmp(prop->ValDup()); if (prop->IsTextWithKey("name")) { style->SetName(tmp); return; } if (prop->IsTextWithKey("bg_col")) { style->Set(Prop::AllocColorSolid(PropBgColor, tmp)); return; } if (prop->IsTextWithKey("col")) { style->Set(Prop::AllocColorSolid(PropColor, tmp)); return; } if (prop->IsTextWithKey("parent")) { Style *parentStyle = StyleByName(tmp); CrashIf(!parentStyle); style->SetInheritsFrom(parentStyle); return; } if (prop->IsTextWithKey("border_width")) { style->SetBorderWidth(ParseFloat(tmp)); return; } if (prop->IsTextWithKey("padding")) { ParsedPadding padding = { 0 }; ParsePadding(tmp, padding); style->SetPadding(padding.top, padding.right, padding.bottom, padding.left); return; } if (prop->IsTextWithKey("stroke_width")) { style->Set(Prop::AllocWidth(PropStrokeWidth, ParseFloat(tmp))); return; } if (prop->IsTextWithKey("fill")) { style->Set(Prop::AllocColorSolid(PropFill, tmp)); return; } if (prop->IsTextWithKey("vert_align")) { style->Set(Prop::AllocAlign(PropVertAlign, ParseElAlign(tmp))); return; } if (prop->IsTextWithKey("text_align")) { style->Set(Prop::AllocTextAlign(ParseAlignAttr(tmp))); return; } if (prop->IsTextWithKey("font_size")) { style->Set(Prop::AllocFontSize(ParseFloat(tmp))); return; } if (prop->IsTextWithKey("font_weight")) { style->Set(Prop::AllocFontWeight(ParseFontWeight(tmp))); return; } CrashIf(true);}
开发者ID:Nargesf,项目名称:Sumatrapdf,代码行数:70,
示例6: BitmapSizeFromData// adapted from http://cpansearch.perl.org/src/RJRAY/Image-Size-3.230/lib/Image/Size.pmSize BitmapSizeFromData(const char* data, size_t len) { Size result; ByteReader r(data, len); switch (GfxFormatFromData(data, len)) { case Img_BMP: if (len >= sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER)) { BITMAPINFOHEADER bmi; bool ok = r.UnpackLE(&bmi, sizeof(bmi), "3d2w6d", sizeof(BITMAPFILEHEADER)); CrashIf(!ok); result.Width = bmi.biWidth; result.Height = bmi.biHeight; } break; case Img_GIF: if (len >= 13) { // find the first image's actual size instead of using the // "logical screen" size which is sometimes too large size_t ix = 13; // skip the global color table if ((r.Byte(10) & 0x80)) ix += 3 * (1 << ((r.Byte(10) & 0x07) + 1)); while (ix + 8 < len) { if (r.Byte(ix) == 0x2C) { result.Width = r.WordLE(ix + 5); result.Height = r.WordLE(ix + 7); break; } else if (r.Byte(ix) == 0x21 && r.Byte(ix + 1) == 0xF9) ix += 8; else if (r.Byte(ix) == 0x21 && r.Byte(ix + 1) == 0xFE) { const char* commentEnd = r.Find(ix + 2, 0x00); ix = commentEnd ? commentEnd - data + 1 : len; } else if (r.Byte(ix) == 0x21 && r.Byte(ix + 1) == 0x01 && ix + 15 < len) { const char* textDataEnd = r.Find(ix + 15, 0x00); ix = textDataEnd ? textDataEnd - data + 1 : len; } else if (r.Byte(ix) == 0x21 && r.Byte(ix + 1) == 0xFF && ix + 14 < len) { const char* applicationDataEnd = r.Find(ix + 14, 0x00); ix = applicationDataEnd ? applicationDataEnd - data + 1 : len; } else break; } } break; case Img_JPEG: // find the last start of frame marker for non-differential Huffman/arithmetic coding for (size_t ix = 2; ix + 9 < len && r.Byte(ix) == 0xFF;) { if (0xC0 <= r.Byte(ix + 1) && r.Byte(ix + 1) <= 0xC3 || 0xC9 <= r.Byte(ix + 1) && r.Byte(ix + 1) <= 0xCB) { result.Width = r.WordBE(ix + 7); result.Height = r.WordBE(ix + 5); } ix += r.WordBE(ix + 2) + 2; } break; case Img_JXR: case Img_TIFF: if (len >= 10) { bool isBE = r.Byte(0) == 'M', isJXR = r.Byte(2) == 0xBC; CrashIf(!isBE && r.Byte(0) != 'I' || isJXR && isBE); const WORD WIDTH = isJXR ? 0xBC80 : 0x0100, HEIGHT = isJXR ? 0xBC81 : 0x0101; size_t idx = r.DWord(4, isBE); WORD count = idx <= len - 2 ? r.Word(idx, isBE) : 0; for (idx += 2; count > 0 && idx <= len - 12; count--, idx += 12) { WORD tag = r.Word(idx, isBE), type = r.Word(idx + 2, isBE); if (r.DWord(idx + 4, isBE) != 1) continue; else if (WIDTH == tag && 4 == type) result.Width = r.DWord(idx + 8, isBE); else if (WIDTH == tag && 3 == type) result.Width = r.Word(idx + 8, isBE); else if (WIDTH == tag && 1 == type) result.Width = r.Byte(idx + 8); else if (HEIGHT == tag && 4 == type) result.Height = r.DWord(idx + 8, isBE); else if (HEIGHT == tag && 3 == type) result.Height = r.Word(idx + 8, isBE); else if (HEIGHT == tag && 1 == type) result.Height = r.Byte(idx + 8); } } break; case Img_PNG: if (len >= 24 && str::StartsWith(data + 12, "IHDR")) { result.Width = r.DWordBE(16); result.Height = r.DWordBE(20); } break; case Img_TGA: if (len >= 16) { result.Width = r.WordLE(12); result.Height = r.WordLE(14); } break; case Img_WebP: if (len >= 30 && str::StartsWith(data + 12, "VP8 ")) { result.Width = r.WordLE(26) & 0x3fff; result.Height = r.WordLE(28) & 0x3fff; } else { result = webp::SizeFromData(data, len); }//.........这里部分代码省略.........
开发者ID:sambhare,项目名称:sumatrapdf,代码行数:101,
示例7: GetPropsstatic void GetProps(Doc doc, PropertiesLayout *layoutData, DisplayModel *dm, bool extended){ CrashIf(!doc.IsEngine() && !doc.IsEbook()); DocType docType = doc.GetDocType(); EngineType engineType = (docType >= Doc_BaseEngine) ? (EngineType)(docType - Doc_BaseEngine) : Engine_None; WCHAR *str = str::Dup(gPluginMode ? gPluginURL : doc.GetFilePath()); layoutData->AddProperty(_TR("File:"), str); str = doc.GetProperty(Prop_Title); layoutData->AddProperty(_TR("Title:"), str); str = doc.GetProperty(Prop_Subject); layoutData->AddProperty(_TR("Subject:"), str); str = doc.GetProperty(Prop_Author); layoutData->AddProperty(_TR("Author:"), str); str = doc.GetProperty(Prop_Copyright); layoutData->AddProperty(_TR("Copyright:"), str); str = doc.GetProperty(Prop_CreationDate); if (Engine_PDF == engineType) ConvDateToDisplay(&str, PdfDateParse); else ConvDateToDisplay(&str, IsoDateParse); layoutData->AddProperty(_TR("Created:"), str); str = doc.GetProperty(Prop_ModificationDate); if (Engine_PDF == engineType) ConvDateToDisplay(&str, PdfDateParse); else ConvDateToDisplay(&str, IsoDateParse); layoutData->AddProperty(_TR("Modified:"), str); str = doc.GetProperty(Prop_CreatorApp); layoutData->AddProperty(_TR("Application:"), str); str = doc.GetProperty(Prop_PdfProducer); layoutData->AddProperty(_TR("PDF Producer:"), str); str = doc.GetProperty(Prop_PdfVersion); layoutData->AddProperty(_TR("PDF Version:"), str); str = FormatPdfFileStructure(doc); layoutData->AddProperty(_TR("PDF Optimizations:"), str); int64 fileSize = file::GetSize(doc.GetFilePath()); if (-1 == fileSize && doc.IsEngine()) { size_t fileSizeT; if (ScopedMem<unsigned char>(doc.AsEngine()->GetFileData(&fileSizeT))) fileSize = fileSizeT; } if (-1 != fileSize) { str = FormatFileSize((size_t)fileSize); layoutData->AddProperty(_TR("File Size:"), str); } if (doc.IsEngine()) { str = str::Format(L"%d", doc.AsEngine()->PageCount()); layoutData->AddProperty(_TR("Number of Pages:"), str); } if (dm && dm->engineType != Engine_Chm) { str = FormatPageSize(dm->engine, dm->CurrentPageNo(), dm->Rotation()); if (IsUIRightToLeft() && IsVistaOrGreater()) { // ensure that the size remains ungarbled left-to-right // (note: XP doesn't know about /u202A.../u202C) str = str::Format(L"/u202A%s/u202C", ScopedMem<WCHAR>(str)); } layoutData->AddProperty(_TR("Page Size:"), str); } str = FormatPermissions(doc); layoutData->AddProperty(_TR("Denied Permissions:"), str);#if defined(DEBUG) || defined(ENABLE_EXTENDED_PROPERTIES) if (extended) { // TODO: FontList extraction can take a while str = doc.GetProperty(Prop_FontList); if (str) { // add a space between basic and extended file properties layoutData->AddProperty(L" ", str::Dup(L" ")); } layoutData->AddProperty(_TR("Fonts:"), str); }#endif}
开发者ID:tin-pot,项目名称:sumatrapdf,代码行数:88,
示例8: CrashIf// Requests the window to draw itself on a Graphics canvas.// offX and offY is a position of this window within// Graphics canvas (pos is relative to that offset)void Control::Paint(Graphics *gfx, int offX, int offY){ CrashIf(!IsVisible());}
开发者ID:azaleafisitania,项目名称:sumatrapdf,代码行数:7,
示例9: ParseSvgPathDatastatic bool ParseSvgPathData(const char* s, VecSegmented<SvgPathInstr>& instr) { s = skipWs(s); while (*s) { SvgPathInstr i(GetInstructionType(*s++)); switch (i.type) { case PathInstr::Close: case PathInstr::Close2: break; case PathInstr::HLineAbs: case PathInstr::HLineRel: case PathInstr::VLineAbs: case PathInstr::VLineRel: s = str::Parse(s, "%f", &i.v[0]); break; case PathInstr::MoveAbs: case PathInstr::MoveRel: case PathInstr::LineToAbs: case PathInstr::LineToRel: case PathInstr::BezierTAbs: case PathInstr::BezierTRel: s = str::Parse(s, "%f%_%?,%_%f", &i.v[0], &i.v[1]); break; case PathInstr::BezierSAbs: case PathInstr::BezierSRel: case PathInstr::BezierQAbs: case PathInstr::BezierQRel: s = str::Parse(s, "%f%_%?,%_%f,%f%_%?,%_%f", &i.v[0], &i.v[1], &i.v[2], &i.v[3]); break; case PathInstr::BezierCAbs: case PathInstr::BezierCRel: s = str::Parse(s, "%f%_%?,%_%f,%f%_%?,%_%f,%f%_%?,%_%f", &i.v[0], &i.v[1], &i.v[2], &i.v[3], &i.v[4], &i.v[5]); break; case PathInstr::ArcAbs: case PathInstr::ArcRel: { int largeArc, sweep; s = str::Parse(s, "%f%_%?,%_%f%_%?,%_%f%_%?,%_%d%_%?,%_%d%_%?,%_%f%_%?,%_%f", &i.v[0], &i.v[1], &i.v[2], &largeArc, &sweep, &i.v[3], &i.v[4]); i.largeArc = (largeArc != 0); i.sweep = (sweep != 0); } break; default: CrashIf(true); return false; } if (!s) { return false; } instr.Append(i); s = skipWs(s); } return true;}
开发者ID:seancassell,项目名称:sumatrapdf,代码行数:63,
示例10: if// Returns next part of html or NULL if finishedHtmlToken *HtmlPullParser::Next(){ if (currPos >= end) return NULL;Next: const char *start = currPos; if (*currPos != '<' || currPos + 1 < end && !IsValidTagStart(*++currPos)) { // this must be text between tags if (!SkipUntil(currPos, end, '<') && IsSpaceOnly(start, currPos)) { // ignore whitespace after the last tag return NULL; } currToken.SetText(start, currPos); return &currToken; } // '<' - tag begins ++start; // skip <? and <! (processing instructions and comments) if (start < end && (('?' == *start) || ('!' == *start))) { if ('!' == *start && start + 2 < end && str::StartsWith(start, "!--")) { currPos = start + 3; if (!SkipUntil(currPos, end, "-->")) { currToken.SetError(HtmlToken::UnclosedTag, start); return &currToken; } currPos += 2; } else if (!SkipUntil(currPos, end, '>')) { currToken.SetError(HtmlToken::UnclosedTag, start); return &currToken; } ++currPos; goto Next; } if (!SkipUntilTagEnd(currPos, end)) { currToken.SetError(HtmlToken::UnclosedTag, start); return &currToken; } CrashIf('>' != *currPos); if (currPos == start || currPos == start + 1 && *start == '/') { // skip empty tags (</>), because we're lenient ++currPos; goto Next; } if (('/' == *start) && ('/' == currPos[-1])) { // </foo/> currToken.SetError(HtmlToken::InvalidTag, start); } else if ('/' == *start) { // </foo> currToken.SetTag(HtmlToken::EndTag, start + 1, currPos); } else if ('/' == currPos[-1]) { // <foo/> currToken.SetTag(HtmlToken::EmptyElementTag, start, currPos - 1); } else { currToken.SetTag(HtmlToken::StartTag, start, currPos); } ++currPos; return &currToken;}
开发者ID:Nargesf,项目名称:Sumatrapdf,代码行数:63,
示例11: Find// TODO: conceptually, RenderCache is not the right place for code that paints// (this is the only place that knows about Tiles, though)UINT RenderCache::PaintTile(HDC hdc, RectI bounds, DisplayModel *dm, int pageNo, TilePosition tile, RectI tileOnScreen, bool renderMissing, bool *renderOutOfDateCue, bool *renderedReplacement){ BitmapCacheEntry *entry = Find(dm, pageNo, dm->Rotation(), dm->ZoomReal(), &tile); UINT renderDelay = 0; if (!entry) { if (!isRemoteSession) { if (renderedReplacement) *renderedReplacement = true; entry = Find(dm, pageNo, dm->Rotation(), INVALID_ZOOM, &tile); } renderDelay = GetRenderDelay(dm, pageNo, tile); if (renderMissing && RENDER_DELAY_UNDEFINED == renderDelay && !IsRenderQueueFull()) RequestRendering(dm, pageNo, tile); } RenderedBitmap *renderedBmp = entry ? entry->bitmap : NULL; HBITMAP hbmp = renderedBmp ? renderedBmp->GetBitmap() : NULL; if (!hbmp) { if (entry && !(renderedBmp && ReduceTileSize())) renderDelay = RENDER_DELAY_FAILED; else if (0 == renderDelay) renderDelay = 1; if (entry) DropCacheEntry(entry); return renderDelay; } HDC bmpDC = CreateCompatibleDC(hdc); if (bmpDC) { SizeI bmpSize = renderedBmp->Size(); int xSrc = -min(tileOnScreen.x, 0); int ySrc = -min(tileOnScreen.y, 0); float factor = min(1.0f * bmpSize.dx / tileOnScreen.dx, 1.0f * bmpSize.dy / tileOnScreen.dy); SelectObject(bmpDC, hbmp); if (factor != 1.0f) StretchBlt(hdc, bounds.x, bounds.y, bounds.dx, bounds.dy, bmpDC, (int)(xSrc * factor), (int)(ySrc * factor), (int)(bounds.dx * factor), (int)(bounds.dy * factor), SRCCOPY); else BitBlt(hdc, bounds.x, bounds.y, bounds.dx, bounds.dy, bmpDC, xSrc, ySrc, SRCCOPY); DeleteDC(bmpDC);#ifdef SHOW_TILE_LAYOUT HPEN pen = CreatePen(PS_SOLID, 1, RGB(0xff, 0xff, 0x00)); HGDIOBJ oldPen = SelectObject(hdc, pen); PaintRect(hdc, bounds); DeletePen(SelectObject(hdc, oldPen));#endif } if (entry->outOfDate) { if (renderOutOfDateCue) *renderOutOfDateCue = true; CrashIf(renderedReplacement && !*renderedReplacement); } DropCacheEntry(entry); return 0;}
开发者ID:DavidWiberg,项目名称:sumatrapdf,代码行数:67,
示例12: CrashIf// Requests the window to draw itself on a Graphics canvas.// offX and offY is a position of this window within// Graphics canvas (pos is relative to that offset)void Control::Paint(Graphics *, int, int){ CrashIf(!IsVisible());}
开发者ID:kindleStudy,项目名称:sumatrapdf,代码行数:8,
示例13: TabBarProcstatic LRESULT CALLBACK TabBarProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) { PAINTSTRUCT ps; HDC hdc; int index; LPTCITEM tcs; UNUSED(uIdSubclass); UNUSED(dwRefData); TabPainter* tab = (TabPainter*)GetWindowLongPtr(hwnd, GWLP_USERDATA); if (WM_NCDESTROY == msg) { RemoveWindowSubclass(GetParent(hwnd), TabBarParentProc, 0); RemoveWindowSubclass(hwnd, TabBarProc, 0); return DefSubclassProc(hwnd, msg, wp, lp); } switch (msg) { case WM_DESTROY: delete tab; SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)0); break; case TCM_INSERTITEM: index = (int)wp; tcs = (LPTCITEM)lp; CrashIf(!(TCIF_TEXT & tcs->mask)); tab->Insert(index, tcs->pszText); if (index <= tab->selectedTabIdx) tab->selectedTabIdx++; tab->xClicked = -1; InvalidateRgn(hwnd, nullptr, FALSE); UpdateWindow(hwnd); break; case TCM_SETITEM: index = (int)wp; tcs = (LPTCITEM)lp; if (TCIF_TEXT & tcs->mask) { if (tab->Set(index, tcs->pszText)) { tab->Invalidate(index); } } break; case TCM_DELETEITEM: index = (int)wp; if (tab->Delete(index)) { if (index < tab->selectedTabIdx) { tab->selectedTabIdx--; } else if (index == tab->selectedTabIdx) { tab->selectedTabIdx = -1; } tab->xClicked = -1; if (tab->Count()) { InvalidateRgn(hwnd, nullptr, FALSE); UpdateWindow(hwnd); } } break; case TCM_DELETEALLITEMS: tab->DeleteAll(); tab->selectedTabIdx = -1; tab->highlighted = -1; tab->xClicked = -1; tab->xHighlighted = -1; break; case TCM_SETITEMSIZE: if (tab->Reshape(LOWORD(lp), HIWORD(lp))) { tab->xClicked = -1; if (tab->Count()) { InvalidateRgn(hwnd, nullptr, FALSE); UpdateWindow(hwnd); } } break; case TCM_GETCURSEL: return tab->selectedTabIdx; case TCM_SETCURSEL: { index = (int)wp; if (index >= tab->Count()) { return -1; } int previous = tab->selectedTabIdx; if (index != tab->selectedTabIdx) { tab->Invalidate(tab->selectedTabIdx); tab->Invalidate(index); tab->selectedTabIdx = index; UpdateWindow(hwnd); } return previous; } case WM_NCHITTEST: { if (!tab->inTitlebar || hwnd == GetCapture()) {//.........这里部分代码省略.........
开发者ID:jingyu9575,项目名称:sumatrapdf,代码行数:101,
示例14: NextEndpoint // return false when cannot be moved virtual bool NextEndpoint() const { // HACK: Declaring these as pure virtual causes "unreferenced local variable" warnings ==> define a dummy body to get rid of warnings CrashIf(true); return false; }
开发者ID:jra101,项目名称:sumatrapdf,代码行数:6,
示例15: GetPropsstatic void GetProps(Controller *ctrl, PropertiesLayout *layoutData, bool extended){ CrashIf(!ctrl); WCHAR *str = str::Dup(gPluginMode ? gPluginURL : ctrl->FilePath()); layoutData->AddProperty(_TR("File:"), str, true); str = ctrl->GetProperty(Prop_Title); layoutData->AddProperty(_TR("Title:"), str); str = ctrl->GetProperty(Prop_Subject); layoutData->AddProperty(_TR("Subject:"), str); str = ctrl->GetProperty(Prop_Author); layoutData->AddProperty(_TR("Author:"), str); str = ctrl->GetProperty(Prop_Copyright); layoutData->AddProperty(_TR("Copyright:"), str); str = ctrl->GetProperty(Prop_CreationDate); if (str && ctrl->AsFixed() && Engine_PDF == ctrl->AsFixed()->engineType) ConvDateToDisplay(&str, PdfDateParse); else ConvDateToDisplay(&str, IsoDateParse); layoutData->AddProperty(_TR("Created:"), str); str = ctrl->GetProperty(Prop_ModificationDate); if (str && ctrl->AsFixed() && Engine_PDF == ctrl->AsFixed()->engineType) ConvDateToDisplay(&str, PdfDateParse); else ConvDateToDisplay(&str, IsoDateParse); layoutData->AddProperty(_TR("Modified:"), str); str = ctrl->GetProperty(Prop_CreatorApp); layoutData->AddProperty(_TR("Application:"), str); str = ctrl->GetProperty(Prop_PdfProducer); layoutData->AddProperty(_TR("PDF Producer:"), str); str = ctrl->GetProperty(Prop_PdfVersion); layoutData->AddProperty(_TR("PDF Version:"), str); str = FormatPdfFileStructure(ctrl); layoutData->AddProperty(_TR("PDF Optimizations:"), str); int64 fileSize = file::GetSize(ctrl->FilePath()); if (-1 == fileSize && ctrl->AsFixed()) { size_t fileSizeT; if (ScopedMem<unsigned char>(ctrl->AsFixed()->GetEngine()->GetFileData(&fileSizeT))) fileSize = fileSizeT; } if (-1 != fileSize) { str = FormatFileSize((size_t)fileSize); layoutData->AddProperty(_TR("File Size:"), str); } // TODO: display page count per current layout for ebooks? if (!ctrl->AsEbook()) { str = str::Format(L"%d", ctrl->PageCount()); layoutData->AddProperty(_TR("Number of Pages:"), str); } if (ctrl->AsFixed()) { str = FormatPageSize(ctrl->AsFixed()->GetEngine(), ctrl->CurrentPageNo(), ctrl->AsFixed()->GetRotation()); if (IsUIRightToLeft() && IsVistaOrGreater()) { // ensure that the size remains ungarbled left-to-right // (note: XP doesn't know about /u202A.../u202C) WCHAR *tmp = str; str = str::Format(L"/u202A%s/u202C", tmp); free(tmp); } layoutData->AddProperty(_TR("Page Size:"), str); } str = FormatPermissions(ctrl); layoutData->AddProperty(_TR("Denied Permissions:"), str);#if defined(DEBUG) || defined(ENABLE_EXTENDED_PROPERTIES) if (extended) { // TODO: FontList extraction can take a while str = ctrl->GetProperty(Prop_FontList); if (str) { // add a space between basic and extended file properties layoutData->AddProperty(L" ", str::Dup(L" ")); } layoutData->AddProperty(_TR("Fonts:"), str); }#else UNUSED(extended);#endif}
开发者ID:Kaybarax,项目名称:sumatrapdf,代码行数:91,
示例16: PrevEndpoint virtual bool PrevEndpoint() const { CrashIf(true); return false; }
开发者ID:jra101,项目名称:sumatrapdf,代码行数:4,
示例17: CrashIfstatic TxtNode *GetRootArray(TxtParser* parser){ TxtNode *root = parser->nodes.At(0); CrashIf(!root->IsArray()); return root;}
开发者ID:Nargesf,项目名称:Sumatrapdf,代码行数:6,
示例18: CrashIfvoid HwndWrapper::SetHwnd(HWND hwnd) { CrashIf(nullptr != hwndParent); hwndParent = hwnd; evtMgr = new EventMgr(this); painter = new Painter(this);}
开发者ID:sambhare,项目名称:sumatrapdf,代码行数:6,
示例19: docEbookFormattingThread::EbookFormattingThread(Doc doc, HtmlFormatterArgs *args, EbookController *ctrl, int reparseIdx, ControllerCallback *cb) : doc(doc), formatterArgs(args), cb(cb), controller(ctrl), pageCount(0), reparseIdx(reparseIdx), pagesAfterReparseIdx(0){ CrashIf(reparseIdx < 0); AssertCrash(doc.IsDocLoaded() || (doc.IsNone() && (nullptr != args->htmlStr)));}
开发者ID:jayceefun,项目名称:sumatrapdf,代码行数:6,
示例20: PercFromIntfloat PercFromInt(int total, int n) { CrashIf(n > total); if (0 == total) return 0.f; return (float)n / (float)total;}
开发者ID:Andy-Amoy,项目名称:sumatrapdf,代码行数:6,
示例21: assertvoid LinkHandler::GotoLink(PageDestination *link){ assert(owner && owner->linkHandler == this); if (!link) return; if (!engine()) return; DisplayModel *dm = owner->dm; ScopedMem<WCHAR> path(link->GetDestValue()); PageDestType type = link->GetDestType(); if (Dest_ScrollTo == type) { // TODO: respect link->ld.gotor.new_window for PDF documents ? ScrollTo(link); } else if (Dest_LaunchURL == type) { if (!path) /* ignore missing URLs */; else if (!str::FindChar(path, ':')) { // treat relative URIs as file paths // LaunchFile will reject unsupported file types LaunchFile(path, NULL); } else { // LaunchBrowser will reject unsupported URI schemes LaunchBrowser(path); } } else if (Dest_LaunchEmbedded == type) { // open embedded PDF documents in a new window if (path && str::StartsWith(path.Get(), dm->FilePath())) { WindowInfo *newWin = FindWindowInfoByFile(path); if (!newWin) { LoadArgs args(path, owner); newWin = LoadDocument(args); } if (newWin) newWin->Focus(); } // offer to save other attachments to a file else link->SaveEmbedded(LinkSaver(*owner, path)); } else if (Dest_LaunchFile == type) { if (path) { // LaunchFile only opens files inside SumatraPDF // (except for allowed perceived file types) LaunchFile(path, link); } } // predefined named actions else if (Dest_NextPage == type) dm->GoToNextPage(0); else if (Dest_PrevPage == type) dm->GoToPrevPage(0); else if (Dest_FirstPage == type) dm->GoToFirstPage(); else if (Dest_LastPage == type) dm->GoToLastPage(); // Adobe Reader extensions to the spec, cf. http://www.tug.org/applications/hyperref/manual.html else if (Dest_FindDialog == type) PostMessage(owner->hwndFrame, WM_COMMAND, IDM_FIND_FIRST, 0); else if (Dest_FullScreen == type) PostMessage(owner->hwndFrame, WM_COMMAND, IDM_VIEW_PRESENTATION_MODE, 0); else if (Dest_GoBack == type) dm->Navigate(-1); else if (Dest_GoForward == type) dm->Navigate(1); else if (Dest_GoToPageDialog == type) PostMessage(owner->hwndFrame, WM_COMMAND, IDM_GOTO_PAGE, 0); else if (Dest_PrintDialog == type) PostMessage(owner->hwndFrame, WM_COMMAND, IDM_PRINT, 0); else if (Dest_SaveAsDialog == type) PostMessage(owner->hwndFrame, WM_COMMAND, IDM_SAVEAS, 0); else if (Dest_ZoomToDialog == type) PostMessage(owner->hwndFrame, WM_COMMAND, IDM_ZOOM_CUSTOM, 0); else CrashIf(Dest_None != type);}
开发者ID:miau,项目名称:sumatrapdf,代码行数:79,
示例22: Postvoid Post(UITask *task){ CrashIf(!task); lf("posting %s", task->name); PostMessage(gTaskDispatchHwnd, WM_EXECUTE_TASK, 0, (LPARAM)task);}
开发者ID:Erls-Corporation,项目名称:SumatraPDF-2.2.1,代码行数:6,
示例23: CrashIfBaseEngine *CreateEngine(bool enableEbookEngines, const WCHAR *filePath, PasswordUI *pwdUI, DocType *typeOut){ CrashIf(!filePath); BaseEngine *engine = NULL; DocType engineType = Engine_None; bool sniff = false;RetrySniffing: if (PdfEngine::IsSupportedFile(filePath, sniff) && engineType != Engine_PDF) { engine = PdfEngine::CreateFromFile(filePath, pwdUI); engineType = Engine_PDF; } else if (XpsEngine::IsSupportedFile(filePath, sniff) && engineType != Engine_XPS) { engine = XpsEngine::CreateFromFile(filePath); engineType = Engine_XPS; } else if (DjVuEngine::IsSupportedFile(filePath, sniff) && engineType != Engine_DjVu) { engine = DjVuEngine::CreateFromFile(filePath); engineType = Engine_DjVu; } else if (ImageEngine::IsSupportedFile(filePath, sniff) && engineType != Engine_Image) { engine = ImageEngine::CreateFromFile(filePath); engineType = Engine_Image; } else if (ImageDirEngine::IsSupportedFile(filePath, sniff) && engineType != Engine_ImageDir) { engine = ImageDirEngine::CreateFromFile(filePath); engineType = Engine_ImageDir; } else if (CbxEngine::IsSupportedFile(filePath, sniff) && engineType != Engine_ComicBook) { engine = CbxEngine::CreateFromFile(filePath); engineType = Engine_ComicBook; } else if (PsEngine::IsSupportedFile(filePath, sniff) && engineType != Engine_PS) { engine = PsEngine::CreateFromFile(filePath); engineType = Engine_PS; } else if (ChmEngine::IsSupportedFile(filePath, sniff) && engineType != Engine_Chm) { engine = ChmEngine::CreateFromFile(filePath); engineType = Engine_Chm; } else if (!enableEbookEngines) { // don't try to create any of the below ebook engines } else if (EpubEngine::IsSupportedFile(filePath, sniff) && engineType != Engine_Epub) { engine = EpubEngine::CreateFromFile(filePath); engineType = Engine_Epub; } else if (Fb2Engine::IsSupportedFile(filePath, sniff) && engineType != Engine_Fb2) { engine = Fb2Engine::CreateFromFile(filePath); engineType = Engine_Fb2; } else if (MobiEngine::IsSupportedFile(filePath, sniff) && engineType != Engine_Mobi) { engine = MobiEngine::CreateFromFile(filePath); engineType = Engine_Mobi; } else if (PdbEngine::IsSupportedFile(filePath, sniff) && engineType != Engine_Pdb) { engine = PdbEngine::CreateFromFile(filePath); engineType = Engine_Pdb; } else if (Chm2Engine::IsSupportedFile(filePath, sniff) && engineType != Engine_Chm2) { engine = Chm2Engine::CreateFromFile(filePath); engineType = Engine_Chm2; } else if (TcrEngine::IsSupportedFile(filePath, sniff) && engineType != Engine_Tcr) { engine = TcrEngine::CreateFromFile(filePath); engineType = Engine_Tcr; } else if (HtmlEngine::IsSupportedFile(filePath, sniff) && engineType != Engine_Html) { engine = HtmlEngine::CreateFromFile(filePath); engineType = Engine_Html; } else if (TxtEngine::IsSupportedFile(filePath, sniff) && engineType != Engine_Txt) { engine = TxtEngine::CreateFromFile(filePath); engineType = Engine_Txt; } if (!engine && !sniff) { // try sniffing the file instead sniff = true; goto RetrySniffing; } CrashIf(engine && !IsSupportedFile(enableEbookEngines, filePath, sniff)); if (typeOut) *typeOut = engine ? engineType : Engine_None; return engine;}
开发者ID:Erls-Corporation,项目名称:SumatraPDF-2.2.1,代码行数:71,
示例24: OnMenuPrintvoid OnMenuPrint(WindowInfo *win, bool waitForCompletion){ // we remember some printer settings per process static ScopedMem<DEVMODE> defaultDevMode; static PrintScaleAdv defaultScaleAdv = PrintScaleShrink; static bool defaultAsImage = false; static bool hasDefaults = false; if (!hasDefaults) { hasDefaults = true; defaultAsImage = gGlobalPrefs->printerDefaults.printAsImage; if (str::EqI(gGlobalPrefs->printerDefaults.printScale, "fit")) defaultScaleAdv = PrintScaleFit; else if (str::EqI(gGlobalPrefs->printerDefaults.printScale, "none")) defaultScaleAdv = PrintScaleNone; } bool printSelection = false; Vec<PRINTPAGERANGE> ranges; PRINTER_INFO_2 printerInfo = { 0 }; if (!HasPermission(Perm_PrinterAccess)) return; if (win->AsChm()) { // the Print dialog allows access to the file system, so fall back // to printing the entire document without dialog if that isn't desired bool showUI = HasPermission(Perm_DiskAccess); win->AsChm()->PrintCurrentPage(showUI); return; } if (win->AsEbook()) { // TODO: use EbookEngine for printing? return; } CrashIf(!win->AsFixed()); if (!win->AsFixed()) return; DisplayModel *dm = win->AsFixed();#ifndef DISABLE_DOCUMENT_RESTRICTIONS if (!dm->engine()->AllowsPrinting()) return;#endif if (win->printThread) { int res = MessageBox(win->hwndFrame, _TR("Printing is still in progress. Abort and start over?"), _TR("Printing in progress."), MB_ICONEXCLAMATION | MB_YESNO | MbRtlReadingMaybe()); if (res == IDNO) return; } AbortPrinting(win); // the Print dialog allows access to the file system, so fall back // to printing the entire document without dialog if that isn't desired if (!HasPermission(Perm_DiskAccess)) { PrintFile(dm->engine()); return; } PRINTDLGEX pd; ZeroMemory(&pd, sizeof(PRINTDLGEX)); pd.lStructSize = sizeof(PRINTDLGEX); pd.hwndOwner = win->hwndFrame; pd.Flags = PD_USEDEVMODECOPIESANDCOLLATE | PD_COLLATE; if (!win->selectionOnPage) pd.Flags |= PD_NOSELECTION; pd.nCopies = 1; /* by default print all pages */ pd.nPageRanges = 1; 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 *///.........这里部分代码省略.........
开发者ID:RazvanB,项目名称:sumatrapdf,代码行数:101,
示例25: FreeMemBmpTextRenderGdi::~TextRenderGdi() { FreeMemBmp(); DeleteDC(memHdc); ReleaseDC(nullptr, hdcForTextMeasure); CrashIf(hdcGfxLocked); // hasn't been Unlock()ed}
开发者ID:qingzhengzhuma,项目名称:sumatrapdf,代码行数:6,
注:本文中的CrashIf函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CreateBase函数代码示例 C++ CrashError函数代码示例 |