"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xpdf/PDFCore.cc" between
xpdf-4.01.01.tar.gz and xpdf-4.02.tar.gz

About: Xpdf is a PDF viewer for X.

PDFCore.cc  (xpdf-4.01.01):PDFCore.cc  (xpdf-4.02)
skipping to change at line 42 skipping to change at line 42
#include "TileCache.h" #include "TileCache.h"
#include "TileCompositor.h" #include "TileCompositor.h"
#include "PDFCore.h" #include "PDFCore.h"
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// PDFCore // PDFCore
//------------------------------------------------------------------------ //------------------------------------------------------------------------
PDFCore::PDFCore(SplashColorMode colorMode, int bitmapRowPad, PDFCore::PDFCore(SplashColorMode colorMode, int bitmapRowPad,
GBool reverseVideo, SplashColorPtr paperColor) { GBool reverseVideo, SplashColorPtr paperColor) {
GString *initialZoom; GString *initialZoom, *initialDisplayMode;
int z, i; int z, i;
doc = NULL; doc = NULL;
linksPage = 0; linksPage = 0;
links = NULL; links = NULL;
annotsPage = 0; annotsPage = 0;
annots = NULL; annots = NULL;
skipping to change at line 84 skipping to change at line 84
} else if (!initialZoom->cmp("width")) { } else if (!initialZoom->cmp("width")) {
state->setZoom(zoomWidth); state->setZoom(zoomWidth);
} else { } else {
z = atoi(initialZoom->getCString()); z = atoi(initialZoom->getCString());
if (z <= 0) { if (z <= 0) {
z = zoomWidth; z = zoomWidth;
} }
state->setZoom(z); state->setZoom(z);
} }
delete initialZoom; delete initialZoom;
initialDisplayMode = globalParams->getInitialDisplayMode();
if (!initialDisplayMode->cmp("single")) {
state->setDisplayMode(displaySingle);
} else if (!initialDisplayMode->cmp("sideBySideSingle")) {
state->setDisplayMode(displaySideBySideSingle);
} else if (!initialDisplayMode->cmp("sideBySideContinuous")) {
state->setDisplayMode(displaySideBySideContinuous);
} else if (!initialDisplayMode->cmp("horizontalContinuous")) {
state->setDisplayMode(displayHorizontalContinuous);
} else {
state->setDisplayMode(displayContinuous);
}
delete initialDisplayMode;
selectMode = selectModeBlock; selectMode = selectModeBlock;
selectPage = 0; selectPage = 0;
selectStartX = selectStartY = 0; selectStartX = selectStartY = 0;
historyCur = pdfHistorySize - 1; historyCur = pdfHistorySize - 1;
historyBLen = historyFLen = 0; historyBLen = historyFLen = 0;
for (i = 0; i < pdfHistorySize; ++i) { for (i = 0; i < pdfHistorySize; ++i) {
history[i].fileName = NULL; history[i].fileName = NULL;
history[i].page = 0; history[i].page = 0;
skipping to change at line 618 skipping to change at line 631
} }
void PDFCore::scrollLeft(int nCols) { void PDFCore::scrollLeft(int nCols) {
scrollTo(state->getScrollX() - nCols, state->getScrollY()); scrollTo(state->getScrollX() - nCols, state->getScrollY());
} }
void PDFCore::scrollRight(int nCols) { void PDFCore::scrollRight(int nCols) {
scrollTo(state->getScrollX() + nCols, state->getScrollY()); scrollTo(state->getScrollX() + nCols, state->getScrollY());
} }
void PDFCore::scrollUp(int nLines) { void PDFCore::scrollUp(int nLines, GBool snapToPage) {
scrollTo(state->getScrollX(), state->getScrollY() - nLines); scrollTo(state->getScrollX(), state->getScrollY() - nLines, snapToPage);
} }
void PDFCore::scrollUpPrevPage(int nLines) { void PDFCore::scrollUpPrevPage(int nLines) {
if (!state->displayModeIsContinuous() && if (!state->displayModeIsContinuous() &&
state->getScrollY() == 0) { state->getScrollY() == 0) {
gotoPrevPage(1, gFalse, gTrue); gotoPrevPage(1, gFalse, gTrue);
} else { } else {
scrollUp(nLines); scrollUp(nLines, gTrue);
} }
} }
void PDFCore::scrollDown(int nLines) { void PDFCore::scrollDown(int nLines, GBool snapToPage) {
scrollTo(state->getScrollX(), state->getScrollY() + nLines); scrollTo(state->getScrollX(), state->getScrollY() + nLines, snapToPage);
} }
void PDFCore::scrollDownNextPage(int nLines) { void PDFCore::scrollDownNextPage(int nLines) {
int horizMax, vertMax; int horizMax, vertMax;
if (!state->displayModeIsContinuous()) { if (!state->displayModeIsContinuous()) {
tileMap->getScrollLimits(&horizMax, &vertMax); tileMap->getScrollLimits(&horizMax, &vertMax);
if (state->getScrollY() >= vertMax - state->getWinH()) { if (state->getScrollY() >= vertMax - state->getWinH()) {
gotoNextPage(1, gTrue); gotoNextPage(1, gTrue);
} else { } else {
scrollDown(nLines); scrollDown(nLines);
} }
} else { } else {
scrollDown(nLines); scrollDown(nLines, gTrue);
} }
} }
void PDFCore::scrollPageUp() { void PDFCore::scrollPageUp() {
scrollUpPrevPage(state->getWinH()); scrollUpPrevPage(state->getWinH());
} }
void PDFCore::scrollPageDown() { void PDFCore::scrollPageDown() {
scrollDownNextPage(state->getWinH()); scrollDownNextPage(state->getWinH());
} }
void PDFCore::scrollTo(int x, int y) { void PDFCore::scrollTo(int x, int y, GBool snapToPage) {
int next, topPage, topPageY, sy, dy;
startUpdate(); startUpdate();
state->setScrollPosition(state->getScrollPage(), x, y); state->setScrollPosition(state->getScrollPage(), x, y);
if (snapToPage) {
if (state->getDisplayMode() == displayContinuous ||
state->getDisplayMode() == displaySideBySideContinuous) {
next = state->getDisplayMode() == displaySideBySideContinuous ? 2 : 1;
topPage = tileMap->getFirstPage();
topPageY = tileMap->getPageTopY(topPage);
sy = state->getScrollY();
dy = sy - topPageY;
// note: dy can be negative here if the inter-page gap is at the
// top of the window
if (-16 < dy && dy < 16) {
state->setScrollPosition(state->getScrollPage(), x, topPageY);
} else if (topPage + next <= doc->getNumPages()) {
topPage += next;
topPageY = tileMap->getPageTopY(topPage);
dy = sy - topPageY;
if (-16 < dy && dy < 0) {
state->setScrollPosition(state->getScrollPage(), x, topPageY);
}
}
}
}
finishUpdate(gTrue, gTrue); finishUpdate(gTrue, gTrue);
} }
void PDFCore::scrollToLeftEdge() { void PDFCore::scrollToLeftEdge() {
scrollTo(0, state->getScrollY()); scrollTo(0, state->getScrollY());
} }
void PDFCore::scrollToRightEdge() { void PDFCore::scrollToRightEdge() {
int horizMax, vertMax; int horizMax, vertMax;
 End of changes. 8 change blocks. 
8 lines changed or deleted 47 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)