[evince] pdf: Add support for adding other types of annotations



commit 320d10f2bdc757efee275a9ff92d7f4a31e04922
Author: Giselle Machado <gisellemnr src gnome org>
Date:   Thu Jul 24 10:38:59 2014 +0200

    pdf: Add support for adding other types of annotations
    
    Implementing switch/case to support new annotations as they are implemented.

 backend/pdf/ev-poppler.cc |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/backend/pdf/ev-poppler.cc b/backend/pdf/ev-poppler.cc
index f418191..3ef778a 100644
--- a/backend/pdf/ev-poppler.cc
+++ b/backend/pdf/ev-poppler.cc
@@ -3117,7 +3117,22 @@ pdf_document_annotations_add_annotation (EvDocumentAnnotations *document_annotat
        poppler_rect.x2 = rect->x2;
        poppler_rect.y1 = height - rect->y2;
        poppler_rect.y2 = height - rect->y1;
-       poppler_annot = poppler_annot_text_new (pdf_document->document, &poppler_rect);
+
+       switch (ev_annotation_get_annotation_type (annot)) {
+               case EV_ANNOTATION_TYPE_TEXT: {
+                       EvAnnotationText    *text = EV_ANNOTATION_TEXT (annot);
+                       EvAnnotationTextIcon icon;
+
+                       poppler_annot = poppler_annot_text_new (pdf_document->document, &poppler_rect);
+
+                       icon = ev_annotation_text_get_icon (text);
+                       poppler_annot_text_set_icon (POPPLER_ANNOT_TEXT (poppler_annot),
+                                                    get_poppler_annot_text_icon (icon));
+                       }
+                       break;
+               default:
+                       g_assert_not_reached ();
+       }
 
        ev_annotation_get_color (annot, &color);
        poppler_color.red = color.red;
@@ -3147,14 +3162,6 @@ pdf_document_annotations_add_annotation (EvDocumentAnnotations *document_annotat
                        poppler_annot_markup_set_label (POPPLER_ANNOT_MARKUP (poppler_annot), label);
        }
 
-       if (EV_IS_ANNOTATION_TEXT (annot)) {
-               EvAnnotationText    *text = EV_ANNOTATION_TEXT (annot);
-               EvAnnotationTextIcon icon;
-
-               icon = ev_annotation_text_get_icon (text);
-               poppler_annot_text_set_icon (POPPLER_ANNOT_TEXT (poppler_annot),
-                                            get_poppler_annot_text_icon (icon));
-       }
        poppler_page_add_annot (poppler_page, poppler_annot);
 
        annot_mapping = g_new (EvMapping, 1);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]