root/trunk/examples/sumatrapdf/rev623.diff
| Revision 11, 40.1 kB (checked in by bobef, 4 years ago) |
|---|
-
sumatrapdf.vcproj
old new 1 1 <?xml version="1.0" encoding="Windows-1252"?> 2 2 <VisualStudioProject 3 3 ProjectType="Visual C++" 4 Version="8 .00"4 Version="8,00" 5 5 Name="SumatraPDF" 6 6 ProjectGUID="{836D470A-7050-4423-B938-0ADB24BFA581}" 7 7 RootNamespace="sumatrapdf" … … 107 107 Name="Release|Win32" 108 108 OutputDirectory="$(SolutionDir)$(ConfigurationName)" 109 109 IntermediateDirectory="$(ConfigurationName)" 110 ConfigurationType=" 1"110 ConfigurationType="2" 111 111 CharacterSet="0" 112 112 WholeProgramOptimization="0" 113 113 > … … 143 143 UsePrecompiledHeader="0" 144 144 WarningLevel="3" 145 145 Detect64BitPortabilityProblems="false" 146 DebugInformationFormat=" 3"146 DebugInformationFormat="0" 147 147 CompileAs="0" 148 148 DisableSpecificWarnings="4996;4244;4267;4995" 149 149 EnablePREfast="false" … … 160 160 /> 161 161 <Tool 162 162 Name="VCLinkerTool" 163 AdditionalDependencies=" freetype231mt.lib comctl32.lib zlib_s.lib jpeg_s.lib winspool.lib Msimg32.lib wininet.lib"163 AdditionalDependencies="shell32.lib comdlg32.lib advapi32.lib ole32.lib comctl32.lib user32.lib gdi32.lib oleaut32.lib kernel32.lib freetype231mt.lib comctl32.lib zlib_s.lib jpeg_s.lib winspool.lib Msimg32.lib wininet.lib" 164 164 LinkIncremental="1" 165 165 AdditionalLibraryDirectories=""$(ProjectDir)ext\freetype231";"$(ProjectDir)ext\zlib";"$(ProjectDir)ext\jpeg"" 166 166 IgnoreDefaultLibraryNames="" 167 GenerateDebugInformation=" true"167 GenerateDebugInformation="false" 168 168 SubSystem="2" 169 169 StackReserveSize="2097152" 170 170 OptimizeReferences="2" … … 199 199 /> 200 200 <Tool 201 201 Name="VCPostBuildEventTool" 202 CommandLine="copy /y release\sumatrapdf.dll ..\..\sumatrapdf.dll" 202 203 /> 203 204 </Configuration> 204 205 </Configurations> -
fitz/include/fitz/stm_buffer.h
old new 30 30 int eof; 31 31 }; 32 32 33 fz_error *fz_newbuffer(fz_buffer **bufp, int size);34 fz_error *fz_newbufferwithmemory(fz_buffer **bufp, unsigned char *data, int size);33 fz_error *fz_newbuffer(fz_buffer **bufp, unsigned int size); 34 fz_error *fz_newbufferwithmemory(fz_buffer **bufp, unsigned char *data, unsigned int size); 35 35 36 36 fz_error *fz_rewindbuffer(fz_buffer *buf); 37 fz_error *fz_rewindbuffer2(fz_buffer *buf); 37 38 fz_error *fz_growbuffer(fz_buffer *buf); 38 39 39 40 fz_buffer *fz_keepbuffer(fz_buffer *buf); -
fitz/include/fitz/stm_stream.h
old new 31 31 fz_error *fz_openafile(fz_stream **stmp, char *filename); 32 32 33 33 /* write to memory buffers! */ 34 fz_error *fz_openrmemory(fz_stream **stmp, char *buf, int len);34 fz_error *fz_openrmemory(fz_stream **stmp, char *buf, unsigned int len); 35 35 fz_error *fz_openrbuffer(fz_stream **stmp, fz_buffer *buf); 36 36 fz_error *fz_openwbuffer(fz_stream **stmp, fz_buffer *buf); 37 37 -
fitz/include/mupdf/xref.h
old new 39 39 40 40 fz_error *pdf_newxref(pdf_xref **); 41 41 fz_error *pdf_repairxref(pdf_xref *, char *filename); 42 fz_error *pdf_loadxref(pdf_xref *, char *filename );42 fz_error *pdf_loadxref(pdf_xref *, char *filename,unsigned int size); 43 43 fz_error *pdf_initxref(pdf_xref *); 44 44 45 45 fz_error *pdf_openpdf(pdf_xref **, char *filename); -
fitz/mupdf/pdf_open.c
old new 40 40 int i; 41 41 42 42 t = fz_seek(xref->file, 0, 2); 43 43 44 if (t == -1) 44 45 return fz_ioerror(xref->file); 45 46 … … 186 187 { 187 188 int n; 188 189 int c; 189 190 190 191 n = fz_seek(xref->file, xref->startxref, 0); 191 192 if (n < 0) 192 193 return fz_ioerror(xref->file); … … 546 547 */ 547 548 548 549 fz_error * 549 pdf_loadxref(pdf_xref *xref, char *filename )550 pdf_loadxref(pdf_xref *xref, char *filename,unsigned int len) 550 551 { 551 552 fz_error *error; 552 553 fz_obj *size; … … 555 556 556 557 char buf[65536]; /* yeowch! */ 557 558 558 pdf_logxref("loadxref '%s' %p\n", filename, xref);559 //pdf_logxref("loadxref '%s' %p\n", filename, xref); 559 560 560 error = fz_openrfile(&xref->file, filename);561 error = len==0?fz_openrfile(&xref->file, filename):fz_openrmemory(&xref->file, filename, len); 561 562 if (error) 562 563 return error; 563 564 -
fitz/stream/stm_buffer.c
old new 2 2 #include "fitz-stream.h" 3 3 4 4 fz_error * 5 fz_newbuffer(fz_buffer **bp, int size)5 fz_newbuffer(fz_buffer **bp, unsigned int size) 6 6 { 7 7 fz_buffer *b; 8 8 … … 23 23 } 24 24 25 25 fz_error * 26 fz_newbufferwithmemory(fz_buffer **bp, unsigned char *data, int size)26 fz_newbufferwithmemory(fz_buffer **bp, unsigned char *data, unsigned int size) 27 27 { 28 28 fz_buffer *b; 29 29 … … 82 82 return nil; 83 83 } 84 84 85 fz_error * 86 fz_rewindbuffer(fz_buffer *buf) 85 fz_error * fz_rewindbuffer(fz_buffer *buf) 87 86 { 88 87 assert(buf->ownsdata); 89 88 memmove(buf->bp, buf->rp, buf->wp - buf->rp); … … 92 91 return nil; 93 92 } 94 93 94 fz_error * fz_rewindbuffer2(fz_buffer *buf) 95 { 96 assert(buf->ownsdata); 97 memmove(buf->bp, buf->rp, buf->wp - buf->rp); 98 //buf->wp = buf->bp + (buf->wp - buf->rp); 99 buf->rp = buf->bp; 100 return nil; 101 } 102 -
fitz/stream/stm_open.c
old new 205 205 return openbuffer(stmp, buf, FZ_SWRITE); 206 206 } 207 207 208 fz_error * fz_openrmemory(fz_stream **stmp, char *mem, int len)208 fz_error * fz_openrmemory(fz_stream **stmp, char *mem, unsigned int len) 209 209 { 210 210 fz_error *error; 211 211 fz_buffer *buf; -
fitz/stream/stm_read.c
old new 23 23 if (buf->eof) 24 24 return 0; 25 25 26 error = fz_rewindbuffer(buf);26 error = stm->kind==FZ_SBUFFER?fz_rewindbuffer2(buf):fz_rewindbuffer(buf); 27 27 if (error) 28 28 goto cleanup; 29 29 30 if ( buf->ep - buf->wp == 0)30 if (stm->kind!=FZ_SBUFFER && buf->ep - buf->wp == 0) 31 31 { 32 32 error = fz_growbuffer(buf); 33 33 if (error) -
src/DisplayModel.cc
old new 217 217 return &(_pagesInfo[pageNo-1]); 218 218 } 219 219 220 bool DisplayModel::load(const char *fileName, int startPage, WindowInfo *win )220 bool DisplayModel::load(const char *fileName, int startPage, WindowInfo *win, unsigned int size) 221 221 { 222 222 assert(fileName); 223 if (!_pdfEngine->load(fileName, win ))223 if (!_pdfEngine->load(fileName, win, size)) 224 224 return false; 225 225 226 226 if (validPageNo(startPage)) -
src/DisplayModel.h
old new 163 163 164 164 /* number of pages in PDF document */ 165 165 int pageCount() const { return _pdfEngine->pageCount(); } 166 bool load(const char *fileName, int startPage, WindowInfo *win );166 bool load(const char *fileName, int startPage, WindowInfo *win, unsigned int size = 0); 167 167 bool validPageNo(int pageNo) const { return _pdfEngine->validPageNo(pageNo); } 168 168 bool hasTocTree() { return _pdfEngine->hasTocTree(); } 169 169 PdfTocItem *getTocTree() { return _pdfEngine->getTocTree(); } -
src/DisplayModelFitz.cc
old new 20 20 21 21 DisplayModelFitz *DisplayModelFitz_CreateFromFileName( 22 22 const char *fileName, 23 unsigned int size, 23 24 SizeD totalDrawAreaSize, 24 25 int scrollbarXDy, int scrollbarYDx, 25 26 DisplayMode displayMode, int startPage, … … 31 32 if (!dm) 32 33 goto Error; 33 34 34 if (!dm->load(fileName, startPage, win ))35 if (!dm->load(fileName, startPage, win, size)) 35 36 goto Error; 36 37 37 38 dm->setScrollbarsSize(scrollbarXDy, scrollbarYDx); -
src/DisplayModelFitz.h
old new 26 26 27 27 DisplayModelFitz *DisplayModelFitz_CreateFromFileName( 28 28 const char *fileName, 29 unsigned int size, 29 30 SizeD totalDrawAreaSize, 30 31 int scrollbarXDy, int scrollbarYDx, 31 32 DisplayMode displayMode, int startPage, -
src/DisplayModelSplash.cc
old new 337 337 */ 338 338 DisplayModelSplash *DisplayModelSplash_CreateFromFileName( 339 339 const char *fileName, 340 unsigned int size, 340 341 SizeD totalDrawAreaSize, 341 342 int scrollbarXDy, int scrollbarYDx, 342 343 DisplayMode displayMode, int startPage, … … 346 347 if (!dm) 347 348 goto Error; 348 349 349 if (!dm->load(fileName, startPage, win ))350 if (!dm->load(fileName, startPage, win, size)) 350 351 goto Error; 351 352 352 353 dm->setScrollbarsSize(scrollbarXDy, scrollbarYDx); -
src/DisplayModelSplash.h
old new 69 69 }; 70 70 71 71 DisplayModelSplash *DisplayModelSplash_CreateFromFileName(const char *fileName, 72 unsigned int size, 72 73 SizeD totalDrawAreaSize, 73 74 int scrollbarXDy, int scrollbarYDx, 74 75 DisplayMode displayMode, int startPage, -
src/PdfEngine.cc
old new 221 221 free(_linksForPage); 222 222 } 223 223 224 bool PdfEnginePoppler::load(const char *fileName, WindowInfo *win )224 bool PdfEnginePoppler::load(const char *fileName, WindowInfo *win, unsigned int size) 225 225 { 226 setFileName(fileName);226 MemStream *ms = NULL; 227 227 _windowInfo = win; 228 228 /* note: don't delete fileNameStr since PDFDoc takes ownership and deletes them itself */ 229 GooString *fileNameStr = new GooString(fileName);230 if (!fileNameStr) return false;231 229 232 _pdfDoc = new PDFDoc(fileNameStr, NULL, NULL, (void*)win); 230 if(size==0) 231 { 232 setFileName(fileName); 233 GooString *fileNameStr = new GooString(fileName); 234 if (!fileNameStr) return false; 235 _pdfDoc = new PDFDoc(fileNameStr, NULL, NULL, (void*)win); 236 } 237 else 238 { 239 Object obj; 240 obj.initNull(); 241 setFileName("memory stream"); 242 ms=new MemStream((char*)fileName,0,size,&obj); 243 _pdfDoc = new PDFDoc(ms,NULL,NULL,(void*)win); 244 } 233 245 if (!_pdfDoc->isOk()) { 246 if(ms) delete ms; 234 247 return false; 235 248 } 236 249 _pageCount = _pdfDoc->getNumPages(); … … 235 248 } 236 249 _pageCount = _pdfDoc->getNumPages(); 237 250 _linksForPage = (Links**)malloc(_pageCount * sizeof(Links*)); 238 if (!_linksForPage) return false; 251 if (!_linksForPage) 252 { 253 if(ms) delete ms; 254 return false; 255 } 239 256 for (int i=0; i < _pageCount; i++) 240 257 _linksForPage[i] = NULL; 258 if(ms) delete ms; 241 259 return true; 242 260 } 243 261 … … 474 492 delete _popplerEngine; 475 493 } 476 494 477 bool PdfEngineFitz::load(const char *fileName, WindowInfo *win )495 bool PdfEngineFitz::load(const char *fileName, WindowInfo *win, unsigned int size) 478 496 { 479 497 assert(!_popplerEngine); 480 498 _windowInfo = win; 481 setFileName(fileName); 499 if(size>0) setFileName(fileName); 500 else setFileName("memory stream"); 482 501 fz_error *error = pdf_newxref(&_xref); 483 502 if (error) 484 503 goto Error; … … 483 502 if (error) 484 503 goto Error; 485 504 486 error = pdf_loadxref(_xref, (char*)fileName );505 error = pdf_loadxref(_xref, (char*)fileName,size); 487 506 if (error) { 488 507 if (!strncmp(error->msg, "ioerror", 7)) 489 508 goto Error; -
src/PdfEngine.h
old new 156 156 157 157 int pageCount(void) const { return _pageCount; } 158 158 159 virtual bool load(const char *fileName, WindowInfo *windowInfo ) = 0;159 virtual bool load(const char *fileName, WindowInfo *windowInfo, unsigned int size = 0) = 0; 160 160 virtual int pageRotation(int pageNo) = 0; 161 161 virtual SizeD pageSize(int pageNo) = 0; 162 162 virtual RenderedBitmap *renderBitmap(int pageNo, double zoomReal, int rotation, … … 187 187 public: 188 188 PdfEnginePoppler(); 189 189 virtual ~PdfEnginePoppler(); 190 virtual bool load(const char *fileName, WindowInfo* windowInfo );190 virtual bool load(const char *fileName, WindowInfo* windowInfo, unsigned int size = 0); 191 191 virtual int pageRotation(int pageNo); 192 192 virtual SizeD pageSize(int pageNo); 193 193 virtual RenderedBitmap *renderBitmap(int pageNo, double zoomReal, int rotation, … … 215 215 public: 216 216 PdfEngineFitz(); 217 217 virtual ~PdfEngineFitz(); 218 virtual bool load(const char *fileName, WindowInfo* windowInfo );218 virtual bool load(const char *fileName, WindowInfo* windowInfo, unsigned int size = 0); 219 219 virtual int pageRotation(int pageNo); 220 220 virtual SizeD pageSize(int pageNo); 221 221 virtual RenderedBitmap *renderBitmap(int pageNo, double zoomReal, int rotation, -
src/SumatraPDF.cpp
old new 166 166 167 167 #ifdef _WINDLL 168 168 static bool gRunningDLL = true; 169 SUMATRA_CREATE_PARAMS gCreateParams; 169 170 #else 170 171 static bool gRunningDLL = false; 171 172 #endif … … 395 396 NULL 396 397 }; 397 398 399 void debugOut(char* str) 400 { 401 fwrite(str,1,strlen(str),stdout); 402 fflush(stdout); 403 } 404 398 405 #define LANGS_COUNT dimof(g_langs) 399 406 400 407 const char* CurrLangNameGet() { … … 1417 1424 } 1418 1425 1419 1426 static WindowInfo *WindowInfo_New(HWND hwndFrame) { 1420 WindowInfo * win = WindowInfo_FindByHwnd(hwndFrame);1427 WindowInfo * win = hwndFrame?WindowInfo_FindByHwnd(hwndFrame):NULL; 1421 1428 assert(!win); 1422 1429 1423 win = new WindowInfo(); ;1430 win = new WindowInfo(); 1424 1431 if (!win) 1425 1432 return NULL; 1426 1433 … … 1873 1880 } 1874 1881 1875 1882 if (gGlobalPrefs.m_useFitz) { 1876 win->dm = DisplayModelFitz_CreateFromFileName(fileName, 1883 win->dm = DisplayModelFitz_CreateFromFileName(fileName, 0, 1877 1884 totalDrawAreaSize, scrollbarYDx, scrollbarXDy, displayMode, startPage, win); 1878 1885 } else { 1879 win->dm = DisplayModelSplash_CreateFromFileName(fileName, 1886 win->dm = DisplayModelSplash_CreateFromFileName(fileName, 0, 1880 1887 totalDrawAreaSize, scrollbarYDx, scrollbarXDy, displayMode, startPage, win); 1881 1888 } 1882 1889 … … 1990 1997 assert(win); 1991 1998 if (!win) return; 1992 1999 2000 if(gCreateParams.cbPageChanged!=NULL && gCreateParams.cbPageChanged(win)) return; 2001 if(gRunningDLL) return; 2002 1993 2003 #if 0 1994 2004 if (!win->dmSplash->pdfDoc) 1995 2005 return; … … 2012 2022 { 2013 2023 assert(win); 2014 2024 if (!win) return; 2025 if(win->hwndCanvas) 2026 { 2015 2027 if (delayed) 2016 2028 PostMessage(win->hwndCanvas, WM_APP_REPAINT_DELAYED, 0, 0); 2017 2029 else … … 2016 2028 PostMessage(win->hwndCanvas, WM_APP_REPAINT_DELAYED, 0, 0); 2017 2029 else 2018 2030 PostMessage(win->hwndCanvas, WM_APP_REPAINT_NOW, 0, 0); 2031 } 2032 else if(gCreateParams.cbRepaint!=NULL) gCreateParams.cbRepaint(win,!delayed); 2019 2033 } 2020 2034 2021 2035 static void triggerRepaintDisplayNow(WindowInfo* win) … … 2055 2069 si.nMax = canvasDx-1; 2056 2070 si.nPage = drawAreaDx; 2057 2071 } 2058 SetScrollInfo(win->hwndCanvas, SB_HORZ, &si, TRUE); 2072 if (gCreateParams.cbSetScrollbarsSize!=NULL) gCreateParams.cbSetScrollbarsSize(win,1,si.nPos,si.nMin,si.nMax,si.nPage); 2073 if (win->hwndCanvas) SetScrollInfo(win->hwndCanvas, SB_HORZ, &si, TRUE); 2059 2074 2060 2075 if (drawAreaDy >= canvasDy) { 2061 2076 si.nMin = 0; … … 2075 2090 si.nMax = canvasDy-1; 2076 2091 si.nPage = drawAreaDy; 2077 2092 } 2078 SetScrollInfo(win->hwndCanvas, SB_VERT, &si, TRUE); 2093 if (gCreateParams.cbSetScrollbarsSize!=NULL) gCreateParams.cbSetScrollbarsSize(win,2,si.nPos,si.nMin,si.nMax,si.nPage); 2094 if (win->hwndCanvas) SetScrollInfo(win->hwndCanvas, SB_VERT, &si, TRUE); 2079 2095 } 2080 2096 2081 2097 static void WindowInfo_ResizeToWindow(WindowInfo *win) … … 2638 2654 } 2639 2655 } 2640 2656 2657 void Sumatra_Render(WindowInfo *win, HDC hdc,int x,int y,int w,int h) 2658 { 2659 RECT bounds; 2660 RenderedBitmap * renderedBmp = NULL; 2661 2662 assert(win); 2663 if (!win) return; 2664 DisplayModel* dm = win->dm; 2665 assert(dm); 2666 if (!dm) return; 2667 #if 0 // TODO: write the equivalent dm->isOk() ? 2668 assert(dm->pdfDoc); 2669 if (!dm->pdfDoc) return; 2670 #endif 2671 2672 //assert(win->hdcToDraw); 2673 //hdc = win->hdcToDraw; 2674 /*RECT rct; 2675 rct.left=x; 2676 rct.top=y; 2677 rct.bottom=y+h; 2678 rct.right=x+w; 2679 FillRect(hdc, &rct, gBrushBg);*/ 2680 2681 DBG_OUT("WindowInfo_Paint() "); 2682 for (int pageNo = 1; pageNo <= dm->pageCount(); ++pageNo) { 2683 PdfPageInfo *pageInfo = dm->getPageInfo(pageNo); 2684 if (!pageInfo->visible) 2685 continue; 2686 assert(pageInfo->shown); 2687 if (!pageInfo->shown) 2688 continue; 2689 2690 //BitmapCacheEntry *entry = BitmapCache_Find(dm, pageNo, dm->zoomReal(), dm->rotation()); 2691 BitmapCacheEntry *entry = BitmapCache_Find(dm, pageNo); 2692 2693 if (entry) 2694 renderedBmp = entry->bitmap; 2695 2696 if (!renderedBmp) 2697 DBG_OUT(" missing bitmap on visible page %d\n", pageNo); 2698 2699 int xSrc = (int)pageInfo->bitmapX; 2700 int ySrc = (int)pageInfo->bitmapY; 2701 int bmpDx = (int)pageInfo->bitmapDx; 2702 int bmpDy = (int)pageInfo->bitmapDy; 2703 int xDest = (int)pageInfo->screenX+x; 2704 int yDest = (int)pageInfo->screenY+y; 2705 2706 if (!entry) { 2707 /* TODO: assert is queued for rendering ? */ 2708 HFONT fontRightTxt = Win32_Font_GetSimple(hdc, "Tahoma", 14); 2709 HFONT origFont = (HFONT)SelectObject(hdc, fontRightTxt); /* Just to remember the orig font */ 2710 bounds.left = xDest; 2711 bounds.top = yDest; 2712 bounds.right = xDest + bmpDx; 2713 bounds.bottom = yDest + bmpDy; 2714 FillRect(hdc, &bounds, gBrushWhite); 2715 DrawCenteredText(hdc, &bounds, "Please wait - rendering..."); 2716 DBG_OUT("drawing empty %d ", pageNo); 2717 if (origFont) 2718 SelectObject(hdc, origFont); 2719 Win32_Font_Delete(fontRightTxt); 2720 continue; 2721 } 2722 2723 if (BITMAP_CANNOT_RENDER == renderedBmp) { 2724 bounds.left = xDest; 2725 bounds.top = yDest; 2726 bounds.right = xDest + bmpDx; 2727 bounds.bottom = yDest + bmpDy; 2728 FillRect(hdc, &bounds, gBrushWhite); 2729 DrawCenteredText(hdc, &bounds, "Couldn't render the page"); 2730 continue; 2731 } 2732 2733 DBG_OUT("page %d ", pageNo); 2734 2735 int renderedBmpDx = renderedBmp->dx(); 2736 int renderedBmpDy = renderedBmp->dy(); 2737 int currPageDx = pageInfo->currDx; 2738 int currPageDy = pageInfo->currDy; 2739 HBITMAP hbmp = renderedBmp->createDIBitmap(hdc); 2740 if (!hbmp) 2741 continue; 2742 2743 // Frame info 2744 int fx = xDest, fy = yDest, fw = bmpDx - 4, fh = bmpDy - 4; 2745 // Shadow info 2746 int sx = fx + 4, sy = fy + 4, sw = fw, sh = fh; 2747 // Adjust frame/shadow info base on page/bitmap size 2748 if (bmpDy < currPageDy) { 2749 if (yDest <= 0) { 2750 sy = fy; 2751 sh = sh + 4; 2752 fy = fy - 1; 2753 if (yDest + bmpDy < currPageDy) { 2754 sh = sh + 5; 2755 fh = fh + 6; 2756 } 2757 } 2758 else { 2759 sh = sh + 4; 2760 fh = fh + 6; 2761 } 2762 } 2763 if (bmpDx < currPageDx) { 2764 fw = sw = bmpDx + 1; 2765 if (xDest <= 0) { 2766 fx = fx - 1; 2767 } 2768 } 2769 // Draw shadow 2770 RECT rc; 2771 HBRUSH br = CreateSolidBrush(RGB(0x44, 0x44, 0x44)); 2772 rect_set(&rc, sx, sy, sw, sh); 2773 FillRect(hdc, &rc, br); 2774 DeleteBrush(br); 2775 2776 // Draw frame 2777 HPEN pe = CreatePen(PS_SOLID, 1, RGB(0x88, 0x88, 0x88)); 2778 SelectObject(hdc, pe); 2779 DrawLineSimple(hdc, fx, fy, fx+fw-1, fy); 2780 DrawLineSimple(hdc, fx, fy, fx, fy+fh-1); 2781 DrawLineSimple(hdc, fx+fw-1, fy, fx+fw-1, fy+fh-1); 2782 DrawLineSimple(hdc, fx, fy+fh-1, fx+fw-1, fy+fh-1); 2783 DeletePen(pe); 2784 2785 HDC bmpDC = CreateCompatibleDC(hdc); 2786 if (bmpDC) { 2787 SelectObject(bmpDC, hbmp); 2788 if ((renderedBmpDx < currPageDx) || (renderedBmpDy < currPageDy)) 2789 StretchBlt(hdc, fx+1, fy+1, fw-2, fh-2, bmpDC, xSrc, ySrc, renderedBmpDx, renderedBmpDy, SRCCOPY); 2790 else 2791 BitBlt(hdc, fx+1, fy+1, fw-2, fh-2, bmpDC, xSrc, ySrc, SRCCOPY); 2792 DeleteDC(bmpDC); 2793 } 2794 DeleteObject(hbmp); 2795 } 2796 2797 if (win->showSelection) 2798 PaintSelection(win, hdc); 2799 2800 DBG_OUT("\n"); 2801 if (!gDebugShowLinks) 2802 return; 2803 2804 RectI drawAreaRect; 2805 /* debug code to visualize links */ 2806 drawAreaRect.x = (int)dm->areaOffset.x; 2807 drawAreaRect.y = (int)dm->areaOffset.y; 2808 drawAreaRect.dx = dm->drawAreaSize.dxI(); 2809 drawAreaRect.dy = dm->drawAreaSize.dyI(); 2810 2811 for (int linkNo = 0; linkNo < dm->linkCount(); ++linkNo) { 2812 PdfLink *pdfLink = dm->link(linkNo); 2813 2814 RectI rectLink, intersect; 2815 rectLink.x = pdfLink->rectCanvas.x; 2816 rectLink.y = pdfLink->rectCanvas.y; 2817 rectLink.dx = pdfLink->rectCanvas.dx; 2818 rectLink.dy = pdfLink->rectCanvas.dy; 2819 2820 if (RectI_Intersect(&rectLink, &drawAreaRect, &intersect)) { 2821 RECT rectScreen; 2822 rectScreen.left = (LONG) ((double)intersect.x - dm->areaOffset.x); 2823 rectScreen.top = (LONG) ((double)intersect.y - dm->areaOffset.y); 2824 rectScreen.right = rectScreen.left + rectLink.dx; 2825 rectScreen.bottom = rectScreen.top + rectLink.dy; 2826 FillRect(hdc, &rectScreen, gBrushLinkDebug); 2827 DBG_OUT(" link on screen rotate=%d, (x=%d, y=%d, dx=%d, dy=%d)\n", 2828 dm->rotation() + dm->pagesInfo[pdfLink->pageNo-1].rotation, 2829 rectScreen.left, rectScreen.top, rect_dx(&rectScreen), rect_dy(&rectScreen)); 2830 } 2831 } 2832 } 2833 2641 2834 /* TODO: change the name to DrawAbout. 2642 2835 Draws the about screen a remember some state for hyperlinking. 2643 2836 It transcribes the design I did in graphics software - hopeless … … 2729 2922 2730 2923 static void DrawAbout(HWND hwnd, HDC hdc, PAINTSTRUCT *ps) 2731 2924 { 2925 //no disrespect, but about is inappropriate for embedded usage 2926 if(gRunningDLL) 2927 { 2928 RECT rc; 2929 GetClientRect(hwnd, &rc); 2930 HBRUSH brushBg = CreateSolidBrush(0xffffff); 2931 FillRect(hdc, &rc, brushBg); 2932 DeleteObject(brushBg); 2933 return; 2934 } 2935 2732 2936 RECT rcTmp; 2733 2937 SIZE txtSize; 2734 2938 int totalDx, totalDy; … … 3015 3219 win->linkOnLastButtonDown = win->dm->linkAtPosition(x, y); 3016 3220 /* dragging mode only starts when we're not on a link */ 3017 3221 if (!win->linkOnLastButtonDown) { 3018 SetCapture(win->hwndCanvas);3222 if(win->hwndCanvas) SetCapture(win->hwndCanvas); 3019 3223 win->mouseAction = MA_DRAGGING; 3020 3224 win->dragPrevPosX = x; 3021 3225 win->dragPrevPosY = y; 3022 SetCursor(gCursorDrag); 3226 if(win->hwndCanvas) SetCursor(gCursorDrag); 3227 else if(gCreateParams.cbSetCursor!=NULL) gCreateParams.cbSetCursor(win,3); 3023 3228 DBG_OUT(" dragging start, x=%d, y=%d\n", x, y); 3024 3229 } 3025 3230 } … … 3039 3244 assert(win->dm); 3040 3245 if (!win->dm) return; 3041 3246 3042 if (win->mouseAction == MA_DRAGGING && ( GetCapture() == win->hwndCanvas)) {3247 if (win->mouseAction == MA_DRAGGING && (win->hwndCanvas==NULL || (GetCapture() == win->hwndCanvas))) { 3043 3248 dragDx = 0; dragDy = 0; 3044 3249 dragDx = x - win->dragPrevPosX; 3045 3250 dragDy = y - win->dragPrevPosY; … … 3048 3253 WinMoveDocBy(win, dragDx, -dragDy*2); 3049 3254 win->dragPrevPosX = x; 3050 3255 win->dragPrevPosY = y; 3051 SetCursor(gCursorArrow); 3052 ReleaseCapture(); 3256 if(win->hwndCanvas) 3257 { 3258 SetCursor(gCursorArrow); 3259 ReleaseCapture(); 3260 } 3261 else if(gCreateParams.cbSetCursor!=NULL) gCreateParams.cbSetCursor(win,1); 3053 3262 return; 3054 3263 } 3055 3264 … … 3075 3284 assert(win->dm); 3076 3285 if (!win->dm) return; 3077 3286 if (win->mouseAction == MA_SELECTING) { 3078 SetCursor(gCursorArrow); 3287 if(win->hwndCanvas) SetCursor(gCursorArrow); 3288 else if(gCreateParams.cbSetCursor!=NULL) gCreateParams.cbSetCursor(win,1); 3079 3289 win->selectionRect.dx = x - win->selectionRect.x; 3080 3290 win->selectionRect.dy = y - win->selectionRect.y; 3081 3291 triggerRepaintDisplayNow(win); … … 3091 3301 return; 3092 3302 } 3093 3303 link = win->dm->linkAtPosition(x, y); 3094 if (link) 3095 SetCursor(gCursorHand); 3096 else 3097 SetCursor(gCursorArrow); 3304 //this is lame. why not checking if the the cursor is actually changed instead of wasting cpu? 3305 if(win->hwndCanvas) 3306 { 3307 if (link) 3308 SetCursor(gCursorHand); 3309 else 3310 SetCursor(gCursorArrow); 3311 } 3312 else if(gCreateParams.cbSetCursor!=NULL) 3313 { 3314 if (link) 3315 gCreateParams.cbSetCursor(win,2); 3316 else 3317 gCreateParams.cbSetCursor(win,1); 3318 } 3098 3319 } 3099 3320 } else if (WS_ABOUT == win->state) { 3100 3321 url = AboutGetLink(win, x, y); … … 3161 3382 return; 3162 3383 } 3163 3384 3164 if ((key & MK_CONTROL) != 0 )3385 if ((key & MK_CONTROL) != 0 && (!gRunningDLL || gCreateParams.bSelection)) 3165 3386 OnSelectionStart(win, x, y); 3166 3387 else 3167 3388 OnDraggingStart(win, x, y); … … 3180 3401 return; 3181 3402 } 3182 3403 3183 if ((key & MK_CONTROL) != 0 )3404 if ((key & MK_CONTROL) != 0 && (!gRunningDLL || gCreateParams.bSelection)) 3184 3405 OnSelectionStop(win, x, y); 3185 3406 else 3186 3407 OnDraggingStop(win, x, y); … … 3362 3583 win->HideTocBox(); 3363 3584 MenuUpdateBookmarksStateForWindow(win); 3364 3585 } 3365 win->ClearTocBox();3586 if(!gRunningDLL) win->ClearTocBox(); 3366 3587 delete win->dm; 3367 3588 win->dm = NULL; 3368 WindowInfo_RedrawAll(win); 3369 WindowInfo_UpdateFindbox(win); 3589 if(!gRunningDLL) 3590 { 3591 WindowInfo_RedrawAll(win); 3592 WindowInfo_UpdateFindbox(win); 3593 } 3370 3594 DeleteOldSelectionInfo(win); 3371 3595 } else { 3372 HWND hwndToDestroy = win->hwndFrame; 3596 HWND hwndToDestroy; 3597 hwndToDestroy = win->hwndFrame; 3373 3598 WindowInfoList_Remove(win); 3374 3599 WindowInfo_Delete(win); 3375 3600 DragAcceptFiles(hwndToDestroy, FALSE); … … 4996 5221 return WM_HSCROLL_HANDLED; 4997 5222 4998 5223 case WM_MOUSELEAVE: 4999 win->hwndTracker = NULL;5224 if(win) win->hwndTracker = NULL; 5000 5225 return 0; 5001 5226 5002 5227 case WM_MOUSEMOVE: 5003 win->TrackMouse(hwnd);5004 5228 if (win) 5229 { 5230 win->TrackMouse(hwnd); 5005 5231 OnMouseMove(win, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), wParam); 5232 } 5006 5233 break; 5007 5234 5008 5235 case WM_LBUTTONDOWN: … … 5829 6056 gGlobalPrefs.m_bgColor = col; 5830 6057 } 5831 6058 6059 #ifndef _WINDLL 5832 6060 int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) 5833 6061 { 5834 6062 StrList * argListRoot; … … 6041 6269 //histDump(); 6042 6270 return (int) msg.wParam; 6043 6271 } 6272 #endif 6044 6273 6045 6274 // Code for DLL interace 6046 6275 static WindowInfo* CreateEmpty(HWND parentHandle) { 6047 WindowInfo* pdfWin ;6048 HWND hwndCanvas ;6276 WindowInfo* pdfWin = NULL; 6277 HWND hwndCanvas = NULL; 6049 6278 pdfWin = WindowInfo_New(parentHandle); 6050 hwndCanvas = CreateWindow(6279 if(parentHandle) hwndCanvas = CreateWindow( 6051 6280 CANVAS_CLASS_NAME, NULL, 6052 6281 WS_CHILD | WS_HSCROLL | WS_VSCROLL, 6053 6282 CW_USEDEFAULT, CW_USEDEFAULT, … … 6059 6288 return pdfWin; 6060 6289 } 6061 6290 6062 static void OpenPdf(WindowInfo* pdfWin,const char *fileName, HWND parentHandle)6291 static void OpenPdf(WindowInfo* pdfWin,const char *fileName, unsigned int size, HWND parentHandle) 6063 6292 { 6064 6293 assert(fileName); 6065 6294 if (!fileName) return; … … 6066 6295 assert(pdfWin); 6067 6296 if (!pdfWin) return; 6068 6297 6069 pdfWin->GetCanvasSize();6070 SizeI maxCanvasSize = GetMaxCanvasSize(pdfWin);6071 6298 SizeD totalDrawAreaSize(pdfWin->winSize()); 6072 6299 DisplayMode displayMode = DEFAULT_DISPLAY_MODE; 6073 6300 int offsetX = 0; … … 6077 6304 int scrollbarXDy = 0; 6078 6305 6079 6306 if (gGlobalPrefs.m_useFitz) { 6080 pdfWin->dm = DisplayModelFitz_CreateFromFileName(fileName, 6307 pdfWin->dm = DisplayModelFitz_CreateFromFileName(fileName, size, 6081 6308 totalDrawAreaSize, scrollbarYDx, scrollbarXDy, displayMode, startPage, pdfWin); 6082 6309 } 6083 6310 else { 6084 pdfWin->dm = DisplayModelSplash_CreateFromFileName(fileName, 6311 pdfWin->dm = DisplayModelSplash_CreateFromFileName(fileName, size, 6085 6312 totalDrawAreaSize, scrollbarYDx, scrollbarXDy, displayMode, startPage, pdfWin); 6086 6313 } 6087 6314 … … 6090 6317 double zoomVirtual = DEFAULT_ZOOM; 6091 6318 int rotation = DEFAULT_ROTATION; 6092 6319 6093 UINT menuId = MenuIdFromVirtualZoom(zoomVirtual); 6094 ZoomMenuItemCheck(GetMenu(pdfWin->hwndFrame), menuId); 6320 if(!gRunningDLL) //running from DLL, so don't look for Sumatra's UI 6321 { 6322 UINT menuId = MenuIdFromVirtualZoom(zoomVirtual); 6323 ZoomMenuItemCheck(GetMenu(pdfWin->hwndFrame), menuId); 6324 } 6095 6325 6096 6326 pdfWin->dm->relayout(zoomVirtual, rotation); 6097 6327 if (!pdfWin->dm->validPageNo(startPage)) … … 6097 6327 if (!pdfWin->dm->validPageNo(startPage)) 6098 6328 startPage = 1; 6099 6329 offsetY = 0; 6330 6100 6331 pdfWin->dm->goToPage(startPage, offsetY, offsetX); 6101 WindowInfo_ResizeToPage(pdfWin, startPage); 6102 WindowInfoList_Add(pdfWin); 6332 6333 if(!gRunningDLL) //running from DLL, so let the embedder handle the canvas size as he pleases 6334 { 6335 WindowInfo_ResizeToPage(pdfWin, startPage); 6336 WindowInfoList_Add(pdfWin); 6103 6337 6104 RECT rect;6105 if (GetWindowRect(pdfWin->hwndFrame , &rect) != 0)6106 {6107 int nWidth = rect_dx(&rect);6108 int nHeight = rect_dy(&rect);6109 WinResizeClientArea(pdfWin->hwndCanvas, nWidth, nHeight);6110 }6338 RECT rect; 6339 if (GetWindowRect(pdfWin->hwndFrame , &rect) != 0) 6340 { 6341 int nWidth = rect_dx(&rect); 6342 int nHeight = rect_dy(&rect); 6343 WinResizeClientArea(pdfWin->hwndCanvas, nWidth, nHeight); 6344 } 6111 6345 6112 ShowWindow(pdfWin->hwndFrame, SW_SHOW); 6113 ShowWindow(pdfWin->hwndCanvas, SW_SHOW); 6114 UpdateWindow(pdfWin->hwndFrame); 6115 UpdateWindow(pdfWin->hwndCanvas); 6346 ShowWindow(pdfWin->hwndFrame, SW_SHOW); 6347 ShowWindow(pdfWin->hwndCanvas, SW_SHOW); 6348 UpdateWindow(pdfWin->hwndFrame); 6349 UpdateWindow(pdfWin->hwndCanvas); 6350 } 6351 else if(pdfWin->hwndCanvas) ShowWindow(pdfWin->hwndCanvas, SW_HIDE); 6116 6352 } 6117 6353 6118 void Sumatra_LoadPDF(WindowInfo* pdfWin, const char *pdfFile )6354 void Sumatra_LoadPDF(WindowInfo* pdfWin, const char *pdfFile, unsigned int size) 6119 6355 { 6120 6356 int pdfOpened = 0; 6121 OpenPdf(pdfWin, pdfFile, pdfWin->hwndFrame);6357 OpenPdf(pdfWin, pdfFile, size, pdfWin->hwndFrame); 6122 6358 ++pdfOpened; 6123 if (pdfWin)6124 ShowWindow(pdfWin->hwndFrame, SW_SHOWNORMAL);6125 6359 } 6126 6360 6127 6361 void Sumatra_PrintPDF(WindowInfo* pdfWin, const char *pdfFile, long showOptionWindow) … … 6146 6380 SwitchToDisplayMode(pdfWin, (DisplayMode)displayMode); 6147 6381 } 6148 6382 6383 long Sumatra_GetDisplayMode(WindowInfo* pdfWin) 6384 { 6385 if (WindowInfo_PdfLoaded(pdfWin)) return pdfWin->dm->displayMode(); 6386 else return -1; 6387 } 6388 6389 6149 6390 long Sumatra_GoToNextPage(WindowInfo* pdfWin) 6150 6391 { 6151 6392 if (!WindowInfo_PdfLoaded(pdfWin)) … … 6238 6479 return (long)zoomLevel; 6239 6480 } 6240 6481 6241 void Sumatra_Resize(WindowInfo* pdfWin )6482 void Sumatra_Resize(WindowInfo* pdfWin, int nWidth, int nHeight) 6242 6483 { 6243 RECT rect; 6244 if (GetWindowRect(pdfWin->hwndFrame , &rect) != 0) 6245 { 6246 int nWidth = rect_dx(&rect); 6247 int nHeight = rect_dy(&rect); 6248 WinResizeClientArea(pdfWin->hwndCanvas, nWidth, nHeight); 6249 } 6484 if (WindowInfo_PdfLoaded(pdfWin)) 6485 { 6486 if(pdfWin->hwndCanvas) WinResizeClientArea(pdfWin->hwndCanvas, nWidth, nHeight); 6487 else pdfWin->dm->changeTotalDrawAreaSize(SizeI(nWidth,nHeight)); 6488 } 6250 6489 } 6251 6490 6252 6491 void Sumatra_ClosePdf(WindowInfo* pdfWin) … … 6255 6494 CloseWindow(pdfWin, FALSE); 6256 6495 } 6257 6496 6258 WindowInfo* Sumatra_Init(HWND pHandle) 6497 void Sumatra_ScrollY(WindowInfo *win,int type,int pos) 6498 { 6499 if (WindowInfo_PdfLoaded(win)) 6500 { 6501 if (DM_SINGLE_PAGE == win->dm->displayMode() && ZOOM_FIT_PAGE == win->dm->zoomVirtual()) 6502 { 6503 if(type==1) win->dm->goToPage(pos + 1, 0); 6504 else 6505 { 6506 int pageNumber = win->dm->currentPageNo()+pos+(pos>0?1:-1); 6507 if (win->dm->validPageNo(pageNumber)) 6508 win->dm->goToPage(pageNumber, 0); 6509 } 6510 } 6511 else 6512 { 6513 if(type==1) win->dm->scrollYTo(pos); 6514 else win->dm->scrollYBy(pos,true); 6515 } 6516 } 6517 } 6518 6519 void Sumatra_ScrollX(WindowInfo *win,int type,int pos) 6520 { 6521 if (WindowInfo_PdfLoaded(win)) 6522 { 6523 if(type==1) win->dm->scrollXTo(pos); 6524 else win->dm->scrollXBy(pos); 6525 } 6526 } 6527 6528 void Sumatra_MouseMove(WindowInfo *win,int x,int y,unsigned int flags) 6529 { 6530 if(win) OnMouseMove(win,x,y,flags); 6531 } 6532 6533 void Sumatra_MouseLeftDown(WindowInfo *win,int x,int y,unsigned int flags) 6534 { 6535 if(win) OnMouseLeftButtonDown(win,x,y,flags); 6536 } 6537 6538 void Sumatra_MouseLeftUp(WindowInfo *win,int x,int y,unsigned int flags) 6539 { 6540 if(win) OnMouseLeftButtonUp(win,x,y,flags); 6541 } 6542 6543 WindowInfo* Sumatra_Init(SUMATRA_CREATE_PARAMS* params) 6259 6544 { 6260 6545 WindowInfo* pdfWin; 6261 6546 gRunningDLL = true; … … 6261 6546 gRunningDLL = true; 6262 6547 HINSTANCE hInstance = NULL; 6263 6548 HINSTANCE hPrevInstance = NULL; 6264 int nCmdShow = 0; 6549 int nCmdShow = 0; 6550 bool windowless=params && params->pHandle == NULL; 6265 6551 6266 StrList * argListRoot = NULL; 6267 StrList * currArg = NULL; 6268 MSG msg = {0}; 6269 bool exitOnPrint = false; 6270 bool printToDefaultPrinter = false; 6552 memset(&gCreateParams,0,sizeof(SUMATRA_CREATE_PARAMS)); 6553 if(params) 6554 { 6555 gCreateParams.pHandle=params->pHandle; 6556 gCreateParams.bSelection=params->bSelection; 6557 gCreateParams.cbRepaint=params->cbRepaint; 6558 gCreateParams.cbPageChanged=params->cbPageChanged; 6559 gCreateParams.cbSetScrollbarsSize=params->cbSetScrollbarsSize; 6560 gCreateParams.cbSetCursor=params->cbSetCursor; 6561 } 6271 6562 6272 6563 SerializableGlobalPrefs_Init(); 6273 6564 … … 6275 6566 6276 6567 u_DoAllTests(); 6277 6568 6278 INITCOMMONCONTROLSEX cex; 6279 cex.dwSize = sizeof(INITCOMMONCONTROLSEX); 6280 cex.dwICC = ICC_WIN95_CLASSES | ICC_DATE_CLASSES | ICC_USEREX_CLASSES | ICC_COOL_CLASSES; 6281 InitCommonControlsEx(&cex); 6282 argListRoot = NULL; 6569 //INITCOMMONCONTROLSEX cex; 6570 //cex.dwSize = sizeof(INITCOMMONCONTROLSEX); 6571 //cex.dwICC = ICC_WIN95_CLASSES | ICC_DATE_CLASSES | ICC_USEREX_CLASSES | ICC_COOL_CLASSES; 6572 //InitCommonControlsEx(&cex); 6283 6573 6284 LoadString(hInstance, IDS_APP_TITLE, windowTitle, MAX_LOADSTRING); 6285 6286 if (!RegisterWinClass(hInstance)) 6287 Sumatra_Exit(); 6574 if(!windowless && !RegisterWinClass(hInstance)) Sumatra_Exit(); 6288 6575 6289 6576 CaptionPens_Create(); 6290 6577 6291 if (!InstanceInit(hInstance, nCmdShow)) 6292 Sumatra_Exit(); 6578 if (!InstanceInit(hInstance, nCmdShow)) Sumatra_Exit(); 6293 6579 6294 6580 CreatePageRenderThread(); 6295 6581 6296 bool reuseExistingWindow = false; 6297 6298 if (pHandle == 0 ) 6299 pHandle = NULL; 6582 pdfWin = CreateEmpty(params?params->pHandle:NULL); 6300 6583 6301 pdfWin = CreateEmpty(pHandle); 6584 //add to list now, otherwise crashes occur if no page is loaded 6585 if(!windowless) WindowInfoList_Add(pdfWin); 6302 6586 6303 6587 return pdfWin; 6304 6588 } … … 6312 6596 DeleteObject(gBrushLinkDebug); 6313 6597 delete globalParams; 6314 6598 } 6599 6600 HWND Sumatra_GetHwndCanvas(WindowInfo* pdfWin) 6601 {return pdfWin->hwndCanvas;} -
src/SumatraPDF.h
old new 107 107 memzero(&animState, sizeof(animState)); 108 108 memzero(&selectionRect, sizeof(selectionRect)); 109 109 } 110 void GetCanvasSize() {111 GetClientRect(hwndCanvas, &m_canvasRc);110 void GetCanvasSize() { 111 if(hwndCanvas) GetClientRect(hwndCanvas, &m_canvasRc); 112 112 } 113 113 int winDx() { return rect_dx(&m_canvasRc); } 114 114 int winDy() { return rect_dy(&m_canvasRc); } … … 189 189 RECT m_frameRc; 190 190 RECT m_canvasRc; 191 191 }; 192 #endif 192 193 typedef struct { 194 HWND pHandle; //parent. NULL means windowless mode 195 int bSelection; //allow selection 196 int (CALLBACK *cbPageChanged)(WindowInfo*); //notify our DLL when page is changed instead of doing the normal logic 197 void (CALLBACK *cbRepaint)(WindowInfo*,int now); //the display needs to be repainted 198 void (CALLBACK *cbSetScrollbarsSize)(WindowInfo*,int,int,int,int,unsigned int); //this is for windowless mode 199 void (CALLBACK *cbSetCursor)(WindowInfo*,int); //1: arrow, 2: hand, 3: drag 200 //todo: CALLBACK cbHandleLink 201 } SUMATRA_CREATE_PARAMS; 193 202 194 203 #define SUMATRAPDF_API __declspec(dllexport) 195 204 extern "C" { 196 SUMATRAPDF_API void Sumatra_LoadPDF(WindowInfo* pdfWin, const char *pdfFile );205 SUMATRAPDF_API void Sumatra_LoadPDF(WindowInfo* pdfWin, const char *pdfFile, unsigned int size); 197 206 SUMATRAPDF_API void Sumatra_Print(WindowInfo* pdfWin); 198 207 SUMATRAPDF_API void Sumatra_PrintPDF(WindowInfo* pdfWin, const char *pdfFile, long showOptionWindow); 199 208 SUMATRAPDF_API void Sumatra_SetDisplayMode(WindowInfo* pdfWin, long displayMode); 209 SUMATRAPDF_API long Sumatra_GetDisplayMode(WindowInfo* pdfWin); 200 210 SUMATRAPDF_API long Sumatra_GoToNextPage(WindowInfo* pdfWin); 201 211 SUMATRAPDF_API long Sumatra_GoToPreviousPage(WindowInfo* pdfWin); 202 212 SUMATRAPDF_API long Sumatra_GoToFirstPage(WindowInfo* pdfWin); … … 208 218 SUMATRAPDF_API long Sumatra_ZoomOut(WindowInfo* pdfWin); 209 219 SUMATRAPDF_API long Sumatra_SetZoom(WindowInfo* pdfWin, long zoomValue); 210 220 SUMATRAPDF_API long Sumatra_GetCurrentZoom(WindowInfo* pdfWin); 211 SUMATRAPDF_API void Sumatra_Resize(WindowInfo* pdfWin );221 SUMATRAPDF_API void Sumatra_Resize(WindowInfo* pdfWin, int nWidth, int nHeight); 212 222 SUMATRAPDF_API void Sumatra_ClosePdf(WindowInfo* pdfWin); 213 223 SUMATRAPDF_API void Sumatra_ShowPrintDialog(WindowInfo* pdfWin); 214 SUMATRAPDF_API WindowInfo* Sumatra_Init( HWND parentHandle);224 SUMATRAPDF_API WindowInfo* Sumatra_Init(SUMATRA_CREATE_PARAMS*); 215 225 SUMATRAPDF_API void Sumatra_Exit(); 226 SUMATRAPDF_API HWND Sumatra_GetHwndCanvas(WindowInfo* pdfWin); 227 SUMATRAPDF_API void Sumatra_Render(WindowInfo *win, HDC hdc,int x,int y,int w,int h); 228 SUMATRAPDF_API void Sumatra_ScrollY(WindowInfo *win,int type,int pos); 229 SUMATRAPDF_API void Sumatra_ScrollX(WindowInfo *win,int type,int pos); 230 SUMATRAPDF_API void Sumatra_MouseMove(WindowInfo *win,int x,int y,unsigned int flags); 231 SUMATRAPDF_API void Sumatra_MouseLeftDown(WindowInfo *win,int x,int y,unsigned int flags); 232 SUMATRAPDF_API void Sumatra_MouseLeftUp(WindowInfo *win,int x,int y,unsigned int flags); 216 233 } 234 235 #endif
Note: See TracBrowser for help on using the browser.
