Evince
Evince is a document viewer capable of displaying multiple and single page document formats like PDF and Postscript.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ev-page-cache.h File Reference
#include <glib-object.h>
#include <gdk/gdk.h>
#include <evince-document.h>
#include <evince-view.h>
+ Include dependency graph for ev-page-cache.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define EV_TYPE_PAGE_CACHE   (ev_page_cache_get_type ())
 
#define EV_PAGE_CACHE(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), EV_TYPE_PAGE_CACHE, EvPageCache))
 
#define EV_IS_PAGE_CACHE(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EV_TYPE_PAGE_CACHE))
 
#define EV_PAGE_CACHE_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), EV_TYPE_PAGE_CACHE, EvPageCacheClass))
 
#define EV_IS_PAGE_CACHE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), EV_TYPE_PAGE_CACHE))
 
#define EV_PAGE_CACHE_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), EV_TYPE_PAGE_CACHE, EvPageCacheClass))
 

Typedefs

typedef struct _EvPageCache EvPageCache
 
typedef struct _EvPageCacheClass EvPageCacheClass
 

Functions

GType ev_page_cache_get_type (void) G_GNUC_CONST
 
EvPageCacheev_page_cache_new (EvDocument *document)
 
void ev_page_cache_set_page_range (EvPageCache *cache, gint start, gint end)
 
EvJobPageDataFlags ev_page_cache_get_flags (EvPageCache *cache)
 
void ev_page_cache_set_flags (EvPageCache *cache, EvJobPageDataFlags flags)
 
void ev_page_cache_mark_dirty (EvPageCache *cache, gint page, EvJobPageDataFlags flags)
 
EvMappingListev_page_cache_get_link_mapping (EvPageCache *cache, gint page)
 
EvMappingListev_page_cache_get_image_mapping (EvPageCache *cache, gint page)
 
EvMappingListev_page_cache_get_form_field_mapping (EvPageCache *cache, gint page)
 
EvMappingListev_page_cache_get_annot_mapping (EvPageCache *cache, gint page)
 
EvMappingListev_page_cache_get_media_mapping (EvPageCache *cache, gint page)
 
cairo_region_t * ev_page_cache_get_text_mapping (EvPageCache *cache, gint page)
 
const gchar * ev_page_cache_get_text (EvPageCache *cache, gint page)
 
gboolean ev_page_cache_get_text_layout (EvPageCache *cache, gint page, EvRectangle **areas, guint *n_areas)
 
PangoAttrList * ev_page_cache_get_text_attrs (EvPageCache *cache, gint page)
 
gboolean ev_page_cache_get_text_log_attrs (EvPageCache *cache, gint page, PangoLogAttr **log_attrs, gulong *n_attrs)
 
void ev_page_cache_ensure_page (EvPageCache *cache, gint page)
 
gboolean ev_page_cache_is_page_cached (EvPageCache *cache, gint page)
 

Macro Definition Documentation

#define EV_IS_PAGE_CACHE (   obj)    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EV_TYPE_PAGE_CACHE))

Definition at line 36 of file ev-page-cache.h.

#define EV_IS_PAGE_CACHE_CLASS (   klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), EV_TYPE_PAGE_CACHE))

Definition at line 38 of file ev-page-cache.h.

#define EV_PAGE_CACHE (   obj)    (G_TYPE_CHECK_INSTANCE_CAST ((obj), EV_TYPE_PAGE_CACHE, EvPageCache))

Definition at line 35 of file ev-page-cache.h.

#define EV_PAGE_CACHE_CLASS (   klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), EV_TYPE_PAGE_CACHE, EvPageCacheClass))

Definition at line 37 of file ev-page-cache.h.

#define EV_PAGE_CACHE_GET_CLASS (   obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), EV_TYPE_PAGE_CACHE, EvPageCacheClass))

Definition at line 39 of file ev-page-cache.h.

#define EV_TYPE_PAGE_CACHE   (ev_page_cache_get_type ())

Definition at line 34 of file ev-page-cache.h.

Typedef Documentation

typedef struct _EvPageCache EvPageCache

Definition at line 41 of file ev-page-cache.h.

Definition at line 42 of file ev-page-cache.h.

Function Documentation

void ev_page_cache_ensure_page ( EvPageCache cache,
gint  page 
)

Definition at line 750 of file ev-page-cache.c.

752 {
753  g_return_if_fail (EV_IS_PAGE_CACHE (cache));
754  g_return_if_fail (page >= 0 && page < cache->n_pages);
755 
757 }

+ Here is the caller graph for this function:

EvMappingList* ev_page_cache_get_annot_mapping ( EvPageCache cache,
gint  page 
)

Definition at line 554 of file ev-page-cache.c.

556 {
557  EvPageCacheData *data;
558 
559  g_return_val_if_fail (EV_IS_PAGE_CACHE (cache), NULL);
560  g_return_val_if_fail (page >= 0 && page < cache->n_pages, NULL);
561 
562  if (!(cache->flags & EV_PAGE_DATA_INCLUDE_ANNOTS))
563  return NULL;
564 
565  data = &cache->page_list[page];
566  if (data->done)
567  return data->annot_mapping;
568 
569  if (data->job)
570  return EV_JOB_PAGE_DATA (data->job)->annot_mapping;
571 
572  return data->annot_mapping;
573 }

+ Here is the caller graph for this function:

EvJobPageDataFlags ev_page_cache_get_flags ( EvPageCache cache)

Definition at line 419 of file ev-page-cache.c.

420 {
421  return cache->flags;
422 }

+ Here is the caller graph for this function:

EvMappingList* ev_page_cache_get_form_field_mapping ( EvPageCache cache,
gint  page 
)

Definition at line 532 of file ev-page-cache.c.

534 {
535  EvPageCacheData *data;
536 
537  g_return_val_if_fail (EV_IS_PAGE_CACHE (cache), NULL);
538  g_return_val_if_fail (page >= 0 && page < cache->n_pages, NULL);
539 
540  if (!(cache->flags & EV_PAGE_DATA_INCLUDE_FORMS))
541  return NULL;
542 
543  data = &cache->page_list[page];
544  if (data->done)
545  return data->form_field_mapping;
546 
547  if (data->job)
548  return EV_JOB_PAGE_DATA (data->job)->form_field_mapping;
549 
550  return data->form_field_mapping;
551 }

+ Here is the caller graph for this function:

EvMappingList* ev_page_cache_get_image_mapping ( EvPageCache cache,
gint  page 
)

Definition at line 510 of file ev-page-cache.c.

512 {
513  EvPageCacheData *data;
514 
515  g_return_val_if_fail (EV_IS_PAGE_CACHE (cache), NULL);
516  g_return_val_if_fail (page >= 0 && page < cache->n_pages, NULL);
517 
518  if (!(cache->flags & EV_PAGE_DATA_INCLUDE_IMAGES))
519  return NULL;
520 
521  data = &cache->page_list[page];
522  if (data->done)
523  return data->image_mapping;
524 
525  if (data->job)
526  return EV_JOB_PAGE_DATA (data->job)->image_mapping;
527 
528  return data->image_mapping;
529 }

+ Here is the caller graph for this function:

EvMappingList* ev_page_cache_get_link_mapping ( EvPageCache cache,
gint  page 
)

Definition at line 488 of file ev-page-cache.c.

490 {
491  EvPageCacheData *data;
492 
493  g_return_val_if_fail (EV_IS_PAGE_CACHE (cache), NULL);
494  g_return_val_if_fail (page >= 0 && page < cache->n_pages, NULL);
495 
496  if (!(cache->flags & EV_PAGE_DATA_INCLUDE_LINKS))
497  return NULL;
498 
499  data = &cache->page_list[page];
500  if (data->done)
501  return data->link_mapping;
502 
503  if (data->job)
504  return EV_JOB_PAGE_DATA (data->job)->link_mapping;
505 
506  return data->link_mapping;
507 }

+ Here is the caller graph for this function:

EvMappingList* ev_page_cache_get_media_mapping ( EvPageCache cache,
gint  page 
)

Definition at line 576 of file ev-page-cache.c.

578 {
579  EvPageCacheData *data;
580 
581  g_return_val_if_fail (EV_IS_PAGE_CACHE (cache), NULL);
582  g_return_val_if_fail (page >= 0 && page < cache->n_pages, NULL);
583 
584  if (!(cache->flags & EV_PAGE_DATA_INCLUDE_MEDIA))
585  return NULL;
586 
587  data = &cache->page_list[page];
588  if (data->done)
589  return data->media_mapping;
590 
591  if (data->job)
592  return EV_JOB_PAGE_DATA (data->job)->media_mapping;
593 
594  return data->media_mapping;
595 }

+ Here is the caller graph for this function:

const gchar* ev_page_cache_get_text ( EvPageCache cache,
gint  page 
)

Definition at line 620 of file ev-page-cache.c.

622 {
623  EvPageCacheData *data;
624 
625  g_return_val_if_fail (EV_IS_PAGE_CACHE (cache), NULL);
626  g_return_val_if_fail (page >= 0 && page < cache->n_pages, NULL);
627 
628  if (!(cache->flags & EV_PAGE_DATA_INCLUDE_TEXT))
629  return NULL;
630 
631  data = &cache->page_list[page];
632  if (data->done)
633  return data->text;
634 
635  if (data->job)
636  return EV_JOB_PAGE_DATA (data->job)->text;
637 
638  return data->text;
639 }

+ Here is the caller graph for this function:

PangoAttrList* ev_page_cache_get_text_attrs ( EvPageCache cache,
gint  page 
)

Definition at line 683 of file ev-page-cache.c.

685 {
686  EvPageCacheData *data;
687 
688  g_return_val_if_fail (EV_IS_PAGE_CACHE (cache), NULL);
689  g_return_val_if_fail (page >= 0 && page < cache->n_pages, NULL);
690 
691  if (!(cache->flags & EV_PAGE_DATA_INCLUDE_TEXT_ATTRS))
692  return NULL;
693 
694  data = &cache->page_list[page];
695  if (data->done)
696  return data->text_attrs;
697 
698  if (data->job)
699  return EV_JOB_PAGE_DATA(data->job)->text_attrs;
700 
701  return data->text_attrs;
702 }

+ Here is the caller graph for this function:

gboolean ev_page_cache_get_text_layout ( EvPageCache cache,
gint  page,
EvRectangle **  areas,
guint *  n_areas 
)

Definition at line 642 of file ev-page-cache.c.

646 {
647  EvPageCacheData *data;
648 
649  g_return_val_if_fail (EV_IS_PAGE_CACHE (cache), FALSE);
650  g_return_val_if_fail (page >= 0 && page < cache->n_pages, FALSE);
651 
652  if (!(cache->flags & EV_PAGE_DATA_INCLUDE_TEXT_LAYOUT))
653  return FALSE;
654 
655  data = &cache->page_list[page];
656  if (data->done) {
657  *areas = data->text_layout;
658  *n_areas = data->text_layout_length;
659 
660  return TRUE;
661  }
662 
663  if (data->job) {
664  *areas = EV_JOB_PAGE_DATA (data->job)->text_layout;
665  *n_areas = EV_JOB_PAGE_DATA (data->job)->text_layout_length;
666 
667  return TRUE;
668  }
669 
670  return FALSE;
671 }

+ Here is the caller graph for this function:

gboolean ev_page_cache_get_text_log_attrs ( EvPageCache cache,
gint  page,
PangoLogAttr **  log_attrs,
gulong *  n_attrs 
)

Definition at line 718 of file ev-page-cache.c.

722 {
723  EvPageCacheData *data;
724 
725  g_return_val_if_fail (EV_IS_PAGE_CACHE (cache), FALSE);
726  g_return_val_if_fail (page >= 0 && page < cache->n_pages, FALSE);
727 
729  return FALSE;
730 
731  data = &cache->page_list[page];
732  if (data->done) {
733  *log_attrs = data->text_log_attrs;
734  *n_attrs = data->text_log_attrs_length;
735 
736  return TRUE;
737  }
738 
739  if (data->job) {
740  *log_attrs = EV_JOB_PAGE_DATA (data->job)->text_log_attrs;
741  *n_attrs = EV_JOB_PAGE_DATA (data->job)->text_log_attrs_length;
742 
743  return TRUE;
744  }
745 
746  return FALSE;
747 }

+ Here is the caller graph for this function:

cairo_region_t* ev_page_cache_get_text_mapping ( EvPageCache cache,
gint  page 
)

Definition at line 598 of file ev-page-cache.c.

600 {
601  EvPageCacheData *data;
602 
603  g_return_val_if_fail (EV_IS_PAGE_CACHE (cache), NULL);
604  g_return_val_if_fail (page >= 0 && page < cache->n_pages, NULL);
605 
607  return NULL;
608 
609  data = &cache->page_list[page];
610  if (data->done)
611  return data->text_mapping;
612 
613  if (data->job)
614  return EV_JOB_PAGE_DATA (data->job)->text_mapping;
615 
616  return data->text_mapping;
617 }

+ Here is the caller graph for this function:

GType ev_page_cache_get_type ( void  )
gboolean ev_page_cache_is_page_cached ( EvPageCache cache,
gint  page 
)

Definition at line 760 of file ev-page-cache.c.

762 {
763  EvPageCacheData *data;
764 
765  g_return_val_if_fail (EV_IS_PAGE_CACHE (cache), FALSE);
766  g_return_val_if_fail (page >= 0 && page < cache->n_pages, FALSE);
767 
768  data = &cache->page_list[page];
769 
770  return data->done;
771 }

+ Here is the caller graph for this function:

void ev_page_cache_mark_dirty ( EvPageCache cache,
gint  page,
EvJobPageDataFlags  flags 
)

Definition at line 438 of file ev-page-cache.c.

441 {
442  EvPageCacheData *data;
443 
444  g_return_if_fail (EV_IS_PAGE_CACHE (cache));
445 
446  data = &cache->page_list[page];
447  data->dirty = TRUE;
448 
449  if (flags & EV_PAGE_DATA_INCLUDE_LINKS)
450  g_clear_pointer (&data->link_mapping, ev_mapping_list_unref);
451 
452  if (flags & EV_PAGE_DATA_INCLUDE_IMAGES)
453  g_clear_pointer (&data->image_mapping, ev_mapping_list_unref);
454 
455  if (flags & EV_PAGE_DATA_INCLUDE_FORMS)
456  g_clear_pointer (&data->form_field_mapping, ev_mapping_list_unref);
457 
458  if (flags & EV_PAGE_DATA_INCLUDE_ANNOTS)
459  g_clear_pointer (&data->annot_mapping, ev_mapping_list_unref);
460 
461  if (flags & EV_PAGE_DATA_INCLUDE_MEDIA)
462  g_clear_pointer (&data->media_mapping, ev_mapping_list_unref);
463 
465  g_clear_pointer (&data->text_mapping, cairo_region_destroy);
466 
467  if (flags & EV_PAGE_DATA_INCLUDE_TEXT)
468  g_clear_pointer (&data->text, g_free);
469 
470  if (flags & EV_PAGE_DATA_INCLUDE_TEXT_LAYOUT) {
471  g_clear_pointer (&data->text_layout, g_free);
472  data->text_layout_length = 0;
473  }
474 
476  g_clear_pointer (&data->text_attrs, pango_attr_list_unref);
477 
479  g_clear_pointer (&data->text_log_attrs, g_free);
480  data->text_log_attrs_length = 0;
481  }
482 
483  /* Update the current range */
484  ev_page_cache_set_page_range (cache, cache->start_page, cache->end_page);
485 }

+ Here is the caller graph for this function:

EvPageCache* ev_page_cache_new ( EvDocument document)

Definition at line 290 of file ev-page-cache.c.

291 {
292  EvPageCache *cache;
293 
294  g_return_val_if_fail (EV_IS_DOCUMENT (document), NULL);
295 
296  cache = EV_PAGE_CACHE (g_object_new (EV_TYPE_PAGE_CACHE, NULL));
297  cache->document = g_object_ref (document);
298  cache->n_pages = ev_document_get_n_pages (document);
300  cache->page_list = g_new0 (EvPageCacheData, cache->n_pages);
301 
302  return cache;
303 }

+ Here is the caller graph for this function:

void ev_page_cache_set_flags ( EvPageCache cache,
EvJobPageDataFlags  flags 
)

Definition at line 425 of file ev-page-cache.c.

427 {
428  if (cache->flags == flags)
429  return;
430 
431  cache->flags = flags;
432 
433  /* Update the current range for new flags */
434  ev_page_cache_set_page_range (cache, cache->start_page, cache->end_page);
435 }

+ Here is the caller graph for this function:

void ev_page_cache_set_page_range ( EvPageCache cache,
gint  start,
gint  end 
)

Definition at line 384 of file ev-page-cache.c.

387 {
388  gint i;
389  gint pages_to_pre_cache;
390 
391  if (cache->flags == EV_PAGE_DATA_INCLUDE_NONE)
392  return;
393 
394  for (i = start; i <= end; i++)
396 
397  cache->start_page = start;
398  cache->end_page = end;
399 
400  i = 1;
401  pages_to_pre_cache = PRE_CACHE_SIZE * 2;
402  while ((start - i > 0) || (end + i < cache->n_pages)) {
403  if (end + i < cache->n_pages) {
404  ev_page_cache_schedule_job_if_needed (cache, end + i);
405  if (--pages_to_pre_cache == 0)
406  break;
407  }
408 
409  if (start - i > 0) {
410  ev_page_cache_schedule_job_if_needed (cache, start - i);
411  if (--pages_to_pre_cache == 0)
412  break;
413  }
414  i++;
415  }
416 }

+ Here is the caller graph for this function: