#include "pdf-document.h"
#include "ev-ps-exporter.h"
#include "ev-document-find.h"
+#include "ev-document-misc.h"
#include "gpdf-g-switch.h"
#include "ev-document-links.h"
-#include "ev-document-misc.h"
#include "ev-document-security.h"
#include "ev-document-thumbnails.h"
UnicodeMap *umap;
gchar *password;
- gboolean page_valid;
PdfDocumentSearch *search;
};
obj.free ();
}
-static gboolean
-document_validate_page (PdfDocument *pdf_document)
+static void
+document_display_page (PdfDocument *pdf_document)
{
- if (!pdf_document->page_valid) {
- pdf_document->doc->displayPage (pdf_document->out, pdf_document->page,
- 72 * pdf_document->scale,
- 72 * pdf_document->scale,
- 0, gTrue, gTrue);
-
- document_init_links (pdf_document);
+ pdf_document->doc->displayPage (pdf_document->out, pdf_document->page,
+ 72 * pdf_document->scale,
+ 72 * pdf_document->scale,
+ 0, gTrue, gTrue);
- pdf_document->page_valid = TRUE;
+ document_init_links (pdf_document);
- ev_document_changed (EV_DOCUMENT (pdf_document));
-
- /* Update the search results available to the app since
- * we only provide full results on the current page
- */
- if (pdf_document->search)
- pdf_document_search_page_changed (pdf_document->search);
- }
-
- return pdf_document->page_valid;
+ /* Update the search results available to the app since
+ * we only provide full results on the current page
+ */
+ if (pdf_document->search)
+ pdf_document_search_page_changed (pdf_document->search);
}
static gboolean
if (pdf_document->out)
pdf_document->out->startDoc(pdf_document->doc->getXRef());
- pdf_document->page_valid = FALSE;
-
g_object_notify (G_OBJECT (pdf_document), "title");
return TRUE;
if (page != pdf_document->page) {
pdf_document->page = page;
- pdf_document->page_valid = FALSE;
+ document_display_page (pdf_document);
+ ev_document_page_changed (EV_DOCUMENT (pdf_document));
}
}
}
- pdf_document->page_valid = FALSE;
+ /* FIXME we need to regenerate pages */
}
}
if (pdf_document->scale != scale) {
pdf_document->scale = scale;
- pdf_document->page_valid = FALSE;
+ document_display_page (pdf_document);
+ ev_document_scale_changed (EV_DOCUMENT (pdf_document));
}
}
if (height)
*height = 1;
-
- if (page == -1 && document_validate_page (pdf_document)) {
- if (width)
- *width = pdf_document->out->getBitmapWidth();
- if (height)
- *height = pdf_document->out->getBitmapHeight();
- return;
- }
+ if (page == -1)
+ page = pdf_document->page;
the_page = pdf_document->doc->getCatalog ()->getPage (page);
if (the_page) {
- *width = (int) the_page->getWidth ();
- *height = (int) the_page->getHeight ();
+ *width = (int) ((the_page->getWidth () * pdf_document->scale) + 0.5);
+ *height = (int) ((the_page->getHeight () * pdf_document->scale) + 0.5);
}
}
GdkRectangle page;
GdkRectangle draw;
- if (!document_validate_page (pdf_document) || !pdf_document->target)
+ if (!pdf_document->target)
return;
page.x = pdf_document->page_x_offset;
current_page = pdf_document->page;
- if (!pdf_document->page_valid) {
- /* we can't do anything until displayPage() */
- search->current_page = -1;
- return;
- }
-
if (search->current_page == current_page)
return;
if (link_action == NULL) {
link = ev_link_new_title (title);
+ } else if (link_action->getKind () == actionGoToR) {
+ g_warning ("actionGoToR links not implemented");
+ } else if (link_action->getKind () == actionLaunch) {
+ g_warning ("actionLaunch links not implemented");
+ } else if (link_action->getKind () == actionNamed) {
+ g_warning ("actionNamed links not implemented");
+ } else if (link_action->getKind () == actionMovie) {
+ g_warning ("actionMovie links not implemented");
} else if (link_action->getKind () == actionGoTo) {
LinkDest *link_dest;
LinkGoTo *link_goto;
link_uri = dynamic_cast <LinkURI *> (link_action);
link = ev_link_new_external
(title, link_uri->getURI()->getCString());
- } else if (link_action->getKind () == actionNamed) {
- /*Skip, for now */
+ } else if (link_action->getKind () == actionUnknown) {
+ LinkUnknown *link_unknown;
+
+ link_unknown = dynamic_cast <LinkUnknown *> (link_action);
+
+ g_warning ("Unknown link type %s",
+ link_unknown->getAction()->getCString());
}
return link;
const char *text;
int x1, y1, x2, y2;
- x1 = rect->x + pdf_document->page_x_offset;
- y1 = rect->y + pdf_document->page_y_offset;
- x2 = x1 + rect->width + pdf_document->page_x_offset;
- y2 = y1 + rect->height + pdf_document->page_y_offset;
+ x1 = rect->x - pdf_document->page_x_offset;
+ y1 = rect->y - pdf_document->page_y_offset;
+ x2 = x1 + rect->width;
+ y2 = y1 + rect->height;
sel_text = pdf_document->out->getText (x1, y1, x2, y2);
text = sel_text->getCString ();
pdf_document->page_y_offset = 0;
pdf_document->scale = 1.;
- pdf_document->page_valid = FALSE;
pdf_document->password = NULL;
}