Commit bbf2fe75 authored by Kristian Høgsberg's avatar Kristian Høgsberg

2005-06-20 Kristian Høgsberg <krh@redhat.com>

        * glib/poppler-page.cc:
        * glib/poppler-page.h:
        * glib/poppler.h: Clean up glib rotation implementation and add a
        getter for rotation.  Patch from Marco.
parent c264d8a9
2005-06-20 Kristian Høgsberg <krh@redhat.com>
* glib/poppler-page.cc:
* glib/poppler-page.h:
* glib/poppler.h: Clean up glib rotation implementation and add a
getter for rotation. Patch from Marco.
2005-06-20 Kristian Høgsberg <krh@redhat.com>
* glib/poppler-document.cc:
......
......@@ -46,27 +46,6 @@ struct _PopplerPageClass
G_DEFINE_TYPE (PopplerPage, poppler_page, G_TYPE_OBJECT);
PopplerPage *
_poppler_page_new (PopplerDocument *document, Page *page, int index)
{
PopplerPage *poppler_page;
g_return_val_if_fail (POPPLER_IS_DOCUMENT (document), NULL);
poppler_page = (PopplerPage *) g_object_new (POPPLER_TYPE_PAGE, NULL);
poppler_page->document = document;
poppler_page->page = page;
poppler_page->index = index;
return poppler_page;
}
static void
poppler_page_finalize (GObject *object)
{
/* page->page is owned by the document */
}
static PopplerOrientation
get_document_orientation (PopplerPage *page)
{
......@@ -90,6 +69,28 @@ get_document_orientation (PopplerPage *page)
return orientation;
}
PopplerPage *
_poppler_page_new (PopplerDocument *document, Page *page, int index)
{
PopplerPage *poppler_page;
g_return_val_if_fail (POPPLER_IS_DOCUMENT (document), NULL);
poppler_page = (PopplerPage *) g_object_new (POPPLER_TYPE_PAGE, NULL);
poppler_page->document = document;
poppler_page->page = page;
poppler_page->index = index;
poppler_page->orientation = get_document_orientation (poppler_page);
return poppler_page;
}
static void
poppler_page_finalize (GObject *object)
{
/* page->page is owned by the document */
}
static int
poppler_page_get_rotate (PopplerPage *page)
{
......@@ -120,18 +121,11 @@ poppler_page_get_size (PopplerPage *page,
double *width,
double *height)
{
PopplerOrientation orientation;
double page_width, page_height;
g_return_if_fail (POPPLER_IS_PAGE (page));
if (page->orientation == POPPLER_ORIENTATION_DOCUMENT) {
orientation = get_document_orientation (page);
} else {
orientation = page->orientation;
}
switch (orientation) {
switch (page->orientation) {
case POPPLER_ORIENTATION_PORTRAIT:
case POPPLER_ORIENTATION_UPSIDEDOWN:
page_width = page->page->getWidth ();
......@@ -544,7 +538,6 @@ poppler_page_class_init (PopplerPageClass *klass)
static void
poppler_page_init (PopplerPage *page)
{
page->orientation = POPPLER_ORIENTATION_DOCUMENT;
}
......@@ -643,6 +636,22 @@ poppler_page_set_orientation (PopplerPage *page,
page->orientation = orientation;
}
/**
* poppler_page_get_orientation:
* @page: a #PopplerPage
* @orientation: a #PopplerOrientation
*
* Return the orientation of the specified page
*
* Return value: a #PopplerOrientation
**/
PopplerOrientation
poppler_page_get_orientation (PopplerPage *page)
{
g_return_val_if_fail (POPPLER_IS_PAGE (page), POPPLER_ORIENTATION_PORTRAIT);
return page->orientation;
}
/* PopplerRectangle type */
GType
......
......@@ -45,6 +45,7 @@ void poppler_page_render_to_pixbuf (PopplerPage *page,
void poppler_page_get_size (PopplerPage *page,
double *width,
double *height);
PopplerOrientation poppler_page_get_orientation (PopplerPage *page);
void poppler_page_set_orientation (PopplerPage *page,
PopplerOrientation orientation);
int poppler_page_get_index (PopplerPage *page);
......
......@@ -36,7 +36,6 @@ typedef enum
typedef enum
{
POPPLER_ORIENTATION_DOCUMENT,
POPPLER_ORIENTATION_PORTRAIT,
POPPLER_ORIENTATION_LANDSCAPE,
POPPLER_ORIENTATION_UPSIDEDOWN,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment