[poppler] 2 commits - glib/demo glib/poppler-annot.cc glib/poppler-annot.h poppler/Annot.cc poppler/Annot.h
Inigo Martinez
inigomartinez at kemper.freedesktop.org
Fri Apr 4 14:48:00 PDT 2008
glib/demo/annots.c | 32 +++++---------------------------
glib/poppler-annot.cc | 27 +++++----------------------
glib/poppler-annot.h | 13 +------------
poppler/Annot.cc | 25 ++++++-------------------
poppler/Annot.h | 15 +++------------
5 files changed, 20 insertions(+), 92 deletions(-)
New commits:
commit 97be4332818bcf58461816be995d88926809a4e5
Author: Iñigo MartÃnez <inigomartinez at gmail.com>
Date: Fri Apr 4 23:49:12 2008 +0200
Updated glib bindings.
Signed-off-by: Iñigo MartÃnez <inigomartinez at gmail.com>
diff --git a/glib/demo/annots.c b/glib/demo/annots.c
index a0fdcb3..fb3ffcf 100644
--- a/glib/demo/annots.c
+++ b/glib/demo/annots.c
@@ -278,32 +278,6 @@ get_markup_external_data (PopplerAnnotMarkup *poppler_annot)
}
const gchar *
-get_text_icon (PopplerAnnotText *poppler_annot)
-{
- switch (poppler_annot_text_get_icon (poppler_annot))
- {
- case POPPLER_ANNOT_TEXT_ICON_COMMENT:
- return "Icon Comment";
- case POPPLER_ANNOT_TEXT_ICON_KEY:
- return "Icon Key";
- case POPPLER_ANNOT_TEXT_ICON_NOTE:
- return "Icon Note";
- case POPPLER_ANNOT_TEXT_ICON_HELP:
- return "Icon Help";
- case POPPLER_ANNOT_TEXT_ICON_NEW_PARAGRAPH:
- return "Icon New Paragraph";
- case POPPLER_ANNOT_TEXT_ICON_PARAGRAPH:
- return "Icon Paragraph";
- case POPPLER_ANNOT_TEXT_ICON_INSERT:
- return "Icon Insert";
- default:
- break;
- }
-
- return "Unknown";
-}
-
-const gchar *
get_text_state (PopplerAnnotText *poppler_annot)
{
switch (poppler_annot_text_get_state (poppler_annot))
@@ -408,10 +382,14 @@ pgd_annot_view_set_annot_text (GtkWidget *table,
PopplerAnnotText *annot,
gint *row)
{
+ gchar *text;
+
pgd_table_add_property (GTK_TABLE (table), "<b>Is open:</b>",
poppler_annot_text_get_is_open (annot) ? "Yes" : "No", row);
- pgd_table_add_property (GTK_TABLE (table), "<b>Icon:</b>", get_text_icon (annot), row);
+ text = poppler_annot_text_get_icon (annot);
+ pgd_table_add_property (GTK_TABLE (table), "<b>Icon:</b>", text, row);
+ g_free (text);
pgd_table_add_property (GTK_TABLE (table), "<b>State:</b>", get_text_state (annot), row);
}
diff --git a/glib/poppler-annot.cc b/glib/poppler-annot.cc
index 7424045..b7e5819 100644
--- a/glib/poppler-annot.cc
+++ b/glib/poppler-annot.cc
@@ -562,36 +562,19 @@ poppler_annot_text_get_is_open (PopplerAnnotText *poppler_annot)
*
* Return value: #PopplerAnnotTextIcon of @poppler_annot.
**/
-PopplerAnnotTextIcon
+gchar *
poppler_annot_text_get_icon (PopplerAnnotText *poppler_annot)
{
AnnotText *annot;
+ GooString *text;
- g_return_val_if_fail (POPPLER_IS_ANNOT_TEXT (poppler_annot), POPPLER_ANNOT_TEXT_ICON_NOTE);
+ g_return_val_if_fail (POPPLER_IS_ANNOT_TEXT (poppler_annot), NULL);
annot = static_cast<AnnotText *>(POPPLER_ANNOT (poppler_annot)->annot);
- switch (annot->getIcon ())
- {
- case AnnotText::iconComment:
- return POPPLER_ANNOT_TEXT_ICON_COMMENT;
- case AnnotText::iconKey:
- return POPPLER_ANNOT_TEXT_ICON_KEY;
- case AnnotText::iconNote:
- return POPPLER_ANNOT_TEXT_ICON_NOTE;
- case AnnotText::iconHelp:
- return POPPLER_ANNOT_TEXT_ICON_HELP;
- case AnnotText::iconNewParagraph:
- return POPPLER_ANNOT_TEXT_ICON_NEW_PARAGRAPH;
- case AnnotText::iconParagraph:
- return POPPLER_ANNOT_TEXT_ICON_PARAGRAPH;
- case AnnotText::iconInsert:
- return POPPLER_ANNOT_TEXT_ICON_INSERT;
- default:
- g_warning ("Unsupported Annot Text Icon");
- }
+ text = annot->getIcon ();
- return POPPLER_ANNOT_TEXT_ICON_NOTE;
+ return text ? _poppler_goo_string_to_utf8 (text) : NULL;
}
/**
diff --git a/glib/poppler-annot.h b/glib/poppler-annot.h
index b11ebbd..3e38975 100644
--- a/glib/poppler-annot.h
+++ b/glib/poppler-annot.h
@@ -102,17 +102,6 @@ typedef enum
typedef enum
{
- POPPLER_ANNOT_TEXT_ICON_COMMENT,
- POPPLER_ANNOT_TEXT_ICON_KEY,
- POPPLER_ANNOT_TEXT_ICON_NOTE,
- POPPLER_ANNOT_TEXT_ICON_HELP,
- POPPLER_ANNOT_TEXT_ICON_NEW_PARAGRAPH,
- POPPLER_ANNOT_TEXT_ICON_PARAGRAPH,
- POPPLER_ANNOT_TEXT_ICON_INSERT
-} PopplerAnnotTextIcon;
-
-typedef enum
-{
POPPLER_ANNOT_TEXT_STATE_MARKED,
POPPLER_ANNOT_TEXT_STATE_UNMARKED,
POPPLER_ANNOT_TEXT_STATE_ACCEPTED,
@@ -162,7 +151,7 @@ PopplerAnnotExternalDataType poppler_annot_markup_get_external_data (
/* PopplerAnnotText */
GType poppler_annot_text_get_type (void) G_GNUC_CONST;
gboolean poppler_annot_text_get_is_open (PopplerAnnotText *poppler_annot);
-PopplerAnnotTextIcon poppler_annot_text_get_icon (PopplerAnnotText *poppler_annot);
+gchar *poppler_annot_text_get_icon (PopplerAnnotText *poppler_annot);
PopplerAnnotTextState poppler_annot_text_get_state (PopplerAnnotText *poppler_annot);
/* PopplerAnnotFreeText */
commit 5caac407cdaf58621ac27e5561b31a995404ccb3
Author: Iñigo MartÃnez <inigomartinez at gmail.com>
Date: Fri Apr 4 23:36:46 2008 +0200
Fixed icon name in AnnotText.
Signed-off-by: Iñigo MartÃnez <inigomartinez at gmail.com>
diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index e6eb087..a92ebd6 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -1180,6 +1180,10 @@ AnnotText::AnnotText(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj) :
initialize (xrefA, catalog, dict);
}
+AnnotText::~AnnotText() {
+ delete icon;
+}
+
void AnnotText::setModified(GooString *date) {
if (date) {
delete modified;
@@ -1197,26 +1201,9 @@ void AnnotText::initialize(XRef *xrefA, Catalog *catalog, Dict *dict) {
obj1.free();
if (dict->lookup("Name", &obj1)->isName()) {
- GooString *iconName = new GooString(obj1.getName());
-
- if (!iconName->cmp("Comment")) {
- icon = iconComment;
- } else if (!iconName->cmp("Key")) {
- icon = iconKey;
- } else if (!iconName->cmp("Help")) {
- icon = iconHelp;
- } else if (!iconName->cmp("NewParagraph")) {
- icon = iconNewParagraph;
- } else if (!iconName->cmp("Paragraph")) {
- icon = iconParagraph;
- } else if (!iconName->cmp("Insert")) {
- icon = iconInsert;
- } else {
- icon = iconNote;
- }
- delete iconName;
+ icon = new GooString(obj1.getName());
} else {
- icon = iconNote;
+ icon = new GooString("Note");
}
obj1.free();
diff --git a/poppler/Annot.h b/poppler/Annot.h
index fc58f27..dbe1d52 100644
--- a/poppler/Annot.h
+++ b/poppler/Annot.h
@@ -583,16 +583,6 @@ private:
class AnnotText: public AnnotMarkup {
public:
- enum AnnotTextIcon {
- iconComment, // Comment
- iconKey, // Key
- iconNote, // Note
- iconHelp, // Help
- iconNewParagraph, // NewParagraph
- iconParagraph, // Paragraph
- iconInsert // Insert
- };
-
enum AnnotTextState {
stateUnknown,
// Marked state model
@@ -607,10 +597,11 @@ public:
};
AnnotText(XRef *xrefA, Dict *dict, Catalog *catalog, Object *obj);
+ ~AnnotText();
// getters
GBool getOpen() const { return open; }
- AnnotTextIcon getIcon() const { return icon; }
+ GooString *getIcon() const { return icon; }
AnnotTextState getState() const { return state; }
// setters
@@ -621,7 +612,7 @@ private:
void initialize(XRef *xrefA, Catalog *catalog, Dict *dict);
GBool open; // Open (Default false)
- AnnotTextIcon icon; // Name (Default Note)
+ GooString *icon; // Name (Default Note)
AnnotTextState state; // State (Default Umarked if
// StateModel Marked
// None if StareModel Review)
More information about the poppler
mailing list