const gchar * get_annot_type (PopplerAnnot *poppler_annot) { switch (poppler_annot_get_annot_type (poppler_annot)) { case POPPLER_ANNOT_TEXT: return "Text"; case POPPLER_ANNOT_LINK: return "Link"; case POPPLER_ANNOT_FREE_TEXT: return "Free Text"; case POPPLER_ANNOT_LINE: return "Line"; case POPPLER_ANNOT_SQUARE: return "Square"; case POPPLER_ANNOT_CIRCLE: return "Circle"; case POPPLER_ANNOT_POLYGON: return "Polygon"; case POPPLER_ANNOT_POLY_LINE: return "Poly Line"; case POPPLER_ANNOT_HIGHLIGHT: return "Highlight"; case POPPLER_ANNOT_UNDERLINE: return "Underline"; case POPPLER_ANNOT_SQUIGGLY: return "Squiggly"; case POPPLER_ANNOT_STRIKE_OUT: return "Strike Out"; case POPPLER_ANNOT_STAMP: return "Stamp"; case POPPLER_ANNOT_CARET: return "Caret"; case POPPLER_ANNOT_INK: return "Ink"; case POPPLER_ANNOT_POPUP: return "Popup"; case POPPLER_ANNOT_FILE_ATTACHMENT: return "File Attachment"; case POPPLER_ANNOT_SOUND: return "Sound"; case POPPLER_ANNOT_MOVIE: return "Movie"; case POPPLER_ANNOT_WIDGET: return "Widget"; case POPPLER_ANNOT_SCREEN: return "Screen"; case POPPLER_ANNOT_PRINTER_MARK: return "Printer Mark"; case POPPLER_ANNOT_TRAP_NET: return "Trap Net"; case POPPLER_ANNOT_WATERMARK: return "Watermark"; case POPPLER_ANNOT_3D: return "3D"; default: break; } return "Unknown"; }
static void pgd_annot_view_set_annot (PgdAnnotsDemo *demo, PopplerAnnot *annot) { GtkWidget *alignment; GtkWidget *table; gint row = 0; gchar *text; time_t timet; PopplerRectangle rect; alignment = gtk_bin_get_child (GTK_BIN (demo->annot_view)); if (alignment) { gtk_container_remove (GTK_CONTAINER (demo->annot_view), alignment); } alignment = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 5, 5, 8, 5); gtk_container_add (GTK_CONTAINER (demo->annot_view), alignment); gtk_widget_show (alignment); if (!annot) return; table = gtk_grid_new (); gtk_grid_set_column_spacing (GTK_GRID (table), 6); gtk_grid_set_row_spacing (GTK_GRID (table), 6); text = poppler_annot_get_contents (annot); pgd_table_add_property (GTK_GRID (table), "<b>Contents:</b>", text, &row); g_free (text); text = poppler_annot_get_name (annot); pgd_table_add_property (GTK_GRID (table), "<b>Name:</b>", text, &row); g_free (text); text = poppler_annot_get_modified (annot); if (poppler_date_parse (text, &timet)) { g_free (text); text = pgd_format_date (timet); } pgd_table_add_property (GTK_GRID (table), "<b>Modified:</b>", text, &row); g_free (text); poppler_annot_get_rectangle (annot, &rect); text = g_strdup_printf ("(%.2f;%.2f) (%.2f;%.2f)", rect.x1, rect.y1, rect.x2, rect.y2); pgd_table_add_property (GTK_GRID (table), "<b>Coords:</b>", text, &row); g_free (text); if (POPPLER_IS_ANNOT_MARKUP (annot)) pgd_annot_view_set_annot_markup (table, POPPLER_ANNOT_MARKUP (annot), &row); switch (poppler_annot_get_annot_type (annot)) { case POPPLER_ANNOT_TEXT: pgd_annot_view_set_annot_text (table, POPPLER_ANNOT_TEXT (annot), &row); break; case POPPLER_ANNOT_HIGHLIGHT: case POPPLER_ANNOT_UNDERLINE: case POPPLER_ANNOT_SQUIGGLY: case POPPLER_ANNOT_STRIKE_OUT: pgd_annot_view_set_annot_text_markup (table, POPPLER_ANNOT_TEXT_MARKUP (annot), &row); break; case POPPLER_ANNOT_FREE_TEXT: pgd_annot_view_set_annot_free_text (table, POPPLER_ANNOT_FREE_TEXT (annot), &row); break; case POPPLER_ANNOT_FILE_ATTACHMENT: pgd_annot_view_set_annot_file_attachment (table, POPPLER_ANNOT_FILE_ATTACHMENT (annot), &row); break; case POPPLER_ANNOT_MOVIE: pgd_annot_view_set_annot_movie (table, POPPLER_ANNOT_MOVIE (annot), &row); break; case POPPLER_ANNOT_SCREEN: pgd_annot_view_set_annot_screen (table, POPPLER_ANNOT_SCREEN (annot), &row); break; default: break; } gtk_container_add (GTK_CONTAINER (alignment), table); gtk_widget_show (table); }
static VALUE annot_get_annot_type(VALUE self) { return TYPE2RVAL(poppler_annot_get_annot_type(SELF(self))); }