[poppler] poppler/test: Makefile.am, 1.1.1.1, 1.2 pdf-inspector.cc, NONE, 1.1 pdf-inspector.glade, NONE, 1.1 pdf-operators.c, NONE, 1.1

Jonathan Blandford jrb at freedesktop.org
Tue Aug 23 11:20:47 PDT 2005


Update of /cvs/poppler/poppler/test
In directory gabe:/tmp/cvs-serv7475/test

Modified Files:
	Makefile.am 
Added Files:
	pdf-inspector.cc pdf-inspector.glade pdf-operators.c 
Log Message:
Tue Aug 23 13:38:01 2005  Jonathan Blandford  <jrb at redhat.com>

        * configure.ac:
        * poppler/Gfx.cc:
        * poppler/Gfx.h:
        * poppler/GlobalParams.cc:
        * poppler/GlobalParams.h:
        * poppler/Makefile.am:
        * poppler/OutputDev.cc:
        * poppler/OutputDev.h:
        * poppler/ProfileData.cc:
        * poppler/ProfileData.h:
        * test/Makefile.am:
        * test/pdf-inspector.cc:
        * test/pdf-inspector.glade:
        * test/pdf-operators.c: Initial cut at a pdf inspector.  This
        should help us look at PDF files.



Index: Makefile.am
===================================================================
RCS file: /cvs/poppler/poppler/test/Makefile.am,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- Makefile.am	3 Mar 2005 19:46:04 -0000	1.1.1.1
+++ Makefile.am	23 Aug 2005 18:20:45 -0000	1.2
@@ -15,6 +15,9 @@
 gtk_cairo_test =				\
 	gtk-cairo-test
 
+pdf_inspector =				\
+	pdf_inspector
+
 cairo_includes =				\
 	$(CAIRO_CFLAGS)
 
@@ -30,7 +33,7 @@
 	$(GTK_TEST_CFLAGS)			\
 	-DDATADIR=\""$(datadir)"\"
 
-noinst_PROGRAMS = $(gtk_splash_test) $(gtk_cairo_test)
+noinst_PROGRAMS = $(gtk_splash_test) $(gtk_cairo_test) $(pdf_inspector)
 
 gtk_splash_test_SOURCES =			\
        gtk-splash-test.cc
@@ -46,3 +49,11 @@
 	$(top_builddir)/poppler/libpoppler.la	\
 	$(CAIRO_LIBS)				\
 	$(GTK_TEST_LIBS)
+
+pdf_inspector_SOURCES =			\
+       pdf-inspector.cc
+
+pdf_inspector_LDADD =				\
+	$(top_builddir)/poppler/libpoppler.la	\
+	$(CAIRO_LIBS)				\
+	$(GTK_TEST_LIBS)

--- NEW FILE: pdf-inspector.cc ---
//========================================================================
//
// GDKSplashOutputDev.cc
//
// Copyright 2003 Glyph & Cog, LLC
// Copyright 2004 Red Hat, Inc. (GDK port)
//
//========================================================================

#include <config.h>

#ifdef USE_GCC_PRAGMAS
#pragma implementation
#endif

#include <goo/gmem.h>
#include <goo/GooHash.h>
#include <goo/GooTimer.h>
#include <splash/SplashTypes.h>
#include <splash/SplashBitmap.h>
#include "Object.h"
#include "ProfileData.h"
#include "GfxState.h"

#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include "CairoOutputDev.h"
#include <cairo-xlib.h>
#include <X11/Xutil.h>

#include "PDFDoc.h"
#include "GlobalParams.h"
#include "ErrorCodes.h"
#include <gtk/gtk.h>
#include <glade/glade.h>


// Mapping
#include "pdf-operators.c"

enum {
  OP_STRING,
  OP_COUNT,
  OP_TOTAL,
  OP_MIN,
  OP_MAX,
  N_COLUMNS,
};

class PdfInspector {
public:

  PdfInspector(void);

  void set_file_name (const char *file_name);
  void load (const char *file_name);
  void run (void);
  void error_dialog (const char *error_message);
  void analyze_page (int page);

private:
  static void on_file_activated (GtkWidget *widget, PdfInspector *inspector);
  static void on_selection_changed (GtkTreeSelection *selection, PdfInspector *inspector);
  static void on_analyze_clicked (GtkWidget *widget, PdfInspector *inspector);

  GladeXML *xml;
  GtkTreeModel *model;
  PDFDoc *doc;
  CairoOutputDev *output;
};



PdfInspector::PdfInspector(void)
{
  GtkWidget *widget;

  xml = glade_xml_new ("./pdf-inspector.glade", NULL, NULL);

  widget = glade_xml_get_widget (xml, "pdf_file_chooser_button");
  g_signal_connect (widget, "selection-changed", G_CALLBACK (on_file_activated), this);

  widget = glade_xml_get_widget (xml, "analyze_button");
  g_signal_connect (widget, "clicked", G_CALLBACK (on_analyze_clicked), this);

  // setup the TreeView 
  widget = glade_xml_get_widget (xml, "pdf_tree_view");
  g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (widget)),
		    "changed", G_CALLBACK (on_selection_changed), this);
  model = (GtkTreeModel *)gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_INT,
					      G_TYPE_DOUBLE, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
  gtk_tree_view_set_model (GTK_TREE_VIEW (widget), model);
  gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (widget),
					       0, "Operation", 
					       gtk_cell_renderer_text_new (),
					       "text", OP_STRING,
					       NULL);

  gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (widget),
					       1, "Count", 
					       gtk_cell_renderer_text_new (),
					       "text", OP_COUNT,
					       NULL);

  gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (widget),
					       2, "Elapsed", 
					       gtk_cell_renderer_text_new (),
					       "text", OP_TOTAL,
					       NULL);

  gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (widget),
					       3, "Min", 
					       gtk_cell_renderer_text_new (),
					       "text", OP_MIN,
					       NULL);

  gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (widget),
					       4, "Max", 
					       gtk_cell_renderer_text_new (),
					       "text", OP_MAX,
					       NULL);

  for (int i = 0; i < N_COLUMNS; i++)
    {
      GtkTreeViewColumn *column;
      
      column = gtk_tree_view_get_column (GTK_TREE_VIEW (widget), i);
      gtk_tree_view_column_set_sort_column_id (column, i);
    }
  doc = NULL;
  output = new CairoOutputDev ();

  // set up initial widgets
  load (NULL);
}
    
void
PdfInspector::set_file_name(const char *file_name)
{
  GtkWidget *widget;

  widget = glade_xml_get_widget (xml, "pdf_file_chooser_button");
  gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (widget), file_name);
}

void
PdfInspector::on_file_activated (GtkWidget *widget, PdfInspector *inspector)
{
  gchar *file_name;

  file_name = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (widget));
  if (file_name)
    inspector->load (file_name);

  g_free (file_name);
}

void
PdfInspector::on_selection_changed (GtkTreeSelection *selection, PdfInspector *inspector)
{
  GtkWidget *label;
  int i;
  GtkTreeModel *model;
  GtkTreeIter iter;
  gchar *op = NULL;

  label = glade_xml_get_widget (inspector->xml, "description_label");
  gtk_label_set_markup (GTK_LABEL (label), "<i>No Description</i>");

  if (gtk_tree_selection_get_selected (selection, &model, &iter))
    {
      gtk_tree_model_get (model, &iter,
			  OP_STRING, &op,
			  -1);

    }

  if (op == NULL)
    return;

  for (i = 0; i < G_N_ELEMENTS (op_mapping); i++)
    {

      if (!strcmp (op, op_mapping[i].op))
	{
	  gchar *text;
	  text = g_strdup_printf ("<i>%s</i>", op_mapping[i].description);
	  gtk_label_set_markup (GTK_LABEL (label), text);
	  g_free (text);
	  break;
	}
    }

  g_free (op);  
}

void
PdfInspector::on_analyze_clicked (GtkWidget *widget, PdfInspector *inspector)
{
  GtkWidget *spin;
  int page;

  spin = glade_xml_get_widget (inspector->xml, "pdf_spin");

  page = (int) gtk_spin_button_get_value (GTK_SPIN_BUTTON (spin));

  inspector->analyze_page (page);

}

void
PdfInspector::analyze_page (int page)
{
  GooHashIter *iter;
  GooHash *hash;
  GooString *key;
  ProfileData *data_p;
  GtkWidget *label;
  char *text;

  label = glade_xml_get_widget (xml, "pdf_total_label");

  output->startProfile ();
  gtk_list_store_clear (GTK_LIST_STORE (model));

  GooTimer timer;
  doc->displayPage (output, page + 1, 72, 72, 0, gTrue, gTrue);

  // Total time;
  text = g_strdup_printf ("%g", timer.getElapsed ());
  gtk_label_set_text (GTK_LABEL (label), text);
  g_free (text);

  // Individual times;
  hash = output->endProfile ();
  hash->startIter(&iter);
  while (hash->getNext(&iter, &key, (void**) &data_p))
    {
      GtkTreeIter tree_iter;
      
      gtk_list_store_append (GTK_LIST_STORE (model), &tree_iter);
      gtk_list_store_set (GTK_LIST_STORE (model), &tree_iter,
			  OP_STRING, key->getCString(),
			  OP_COUNT, data_p->getCount (),
			  OP_TOTAL, data_p->getTotal (),
			  OP_MIN, data_p->getMin (),
			  OP_MAX, data_p->getMax (),
			  -1);
    }
  hash->killIter(&iter);
  deleteGooHash (hash, ProfileData);
}
 
void
PdfInspector::load(const char *file_name)
{
  GtkWidget *spin;
  GtkWidget *button;
  GtkWidget *label;

  // kill the old PDF file
  if (doc != NULL)
    {
      delete doc;
      doc = NULL;
    }

  // load the new file
  if (file_name)
    {
      GooString *filename_g;

      filename_g = new GooString (file_name);
      doc = new PDFDoc(filename_g, 0, 0);
      delete filename_g;
    }
  
  if (doc && !doc->isOk())
    {
      this->error_dialog ("Failed to load file.");
      delete doc;
      doc = NULL;
    }

  spin = glade_xml_get_widget (xml, "pdf_spin");
  button = glade_xml_get_widget (xml, "analyze_button");
  label = glade_xml_get_widget (xml, "pdf_total_label");
  gtk_label_set_text (GTK_LABEL (label), "");

  if (doc)
    {
      gtk_widget_set_sensitive (spin, TRUE);
      gtk_widget_set_sensitive (button, TRUE);
      gtk_widget_set_sensitive (label, TRUE);
      gtk_spin_button_set_range (GTK_SPIN_BUTTON (spin), 0, doc->getNumPages());
      gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), 0);

      output->startDoc (doc->getXRef());
    }
  else
    {      
      gtk_widget_set_sensitive (spin, FALSE);
      gtk_widget_set_sensitive (button, FALSE);
      gtk_widget_set_sensitive (label, FALSE);
    }
}

void
PdfInspector::error_dialog (const char *error_message)
{
  g_warning (error_message);
}

void
PdfInspector::run()
{
  GtkWidget *dialog;

  dialog = glade_xml_get_widget (xml, "pdf_dialog");

  gtk_dialog_run (GTK_DIALOG (dialog));
}



int
main (int argc, char *argv [])
{
  const char *file_name = NULL;
  PdfInspector *inspector;
  
  gtk_init (&argc, &argv);
  
  globalParams = new GlobalParams("/etc/xpdfrc");
  globalParams->setProfileCommands (true);

  if (argc == 2)
    file_name = argv[1];
  else if (argc > 2)
    {
      fprintf (stderr, "usage: %s [PDF-FILE]\n", argv[0]);
      return -1;
    }

  inspector = new PdfInspector ();

  if (file_name)
    inspector->set_file_name (file_name);

  inspector->run ();

  delete inspector;
  delete globalParams;
  
  return 0;
}



--- NEW FILE: pdf-inspector.glade ---
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">

<glade-interface>

<widget class="GtkDialog" id="pdf_dialog">
  <property name="border_width">6</property>
  <property name="visible">True</property>
  <property name="title" translatable="yes">PDF Inspector</property>
  <property name="type">GTK_WINDOW_TOPLEVEL</property>
  <property name="window_position">GTK_WIN_POS_NONE</property>
  <property name="modal">False</property>
  <property name="default_width">600</property>
  <property name="default_height">400</property>
  <property name="resizable">True</property>
  <property name="destroy_with_parent">False</property>
  <property name="decorated">True</property>
  <property name="skip_taskbar_hint">False</property>
  <property name="skip_pager_hint">False</property>
  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
  <property name="focus_on_map">True</property>
  <property name="has_separator">False</property>

  <child internal-child="vbox">
    <widget class="GtkVBox" id="dialog-vbox1">
      <property name="visible">True</property>
      <property name="homogeneous">False</property>
      <property name="spacing">12</property>

      <child internal-child="action_area">
	<widget class="GtkHButtonBox" id="dialog-action_area1">
	  <property name="visible">True</property>
	  <property name="layout_style">GTK_BUTTONBOX_END</property>

	  <child>
	    <widget class="GtkButton" id="closebutton1">
	      <property name="visible">True</property>
	      <property name="can_default">True</property>
	      <property name="can_focus">True</property>
	      <property name="label">gtk-close</property>
	      <property name="use_stock">True</property>
	      <property name="relief">GTK_RELIEF_NORMAL</property>
	      <property name="focus_on_click">True</property>
	      <property name="response_id">-7</property>
	    </widget>
	  </child>
	</widget>
	<packing>
	  <property name="padding">0</property>
	  <property name="expand">False</property>
	  <property name="fill">True</property>
	  <property name="pack_type">GTK_PACK_END</property>
	</packing>
      </child>

      <child>
	<widget class="GtkVBox" id="vbox1">
	  <property name="border_width">6</property>
	  <property name="visible">True</property>
	  <property name="homogeneous">False</property>
	  <property name="spacing">12</property>

	  <child>
	    <widget class="GtkTable" id="table1">
	      <property name="visible">True</property>
	      <property name="n_rows">2</property>
	      <property name="n_columns">2</property>
	      <property name="homogeneous">False</property>
	      <property name="row_spacing">6</property>
	      <property name="column_spacing">12</property>

	      <child>
		<widget class="GtkLabel" id="label2">
		  <property name="visible">True</property>
		  <property name="label" translatable="yes">_File:</property>
		  <property name="use_underline">True</property>
		  <property name="use_markup">False</property>
		  <property name="justify">GTK_JUSTIFY_LEFT</property>
		  <property name="wrap">False</property>
		  <property name="selectable">False</property>
		  <property name="xalign">0</property>
		  <property name="yalign">0.5</property>
		  <property name="xpad">0</property>
		  <property name="ypad">0</property>
		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
		  <property name="width_chars">-1</property>
		  <property name="single_line_mode">False</property>
		  <property name="angle">0</property>
		</widget>
		<packing>
		  <property name="left_attach">0</property>
		  <property name="right_attach">1</property>
		  <property name="top_attach">0</property>
		  <property name="bottom_attach">1</property>
		  <property name="x_options">fill</property>
		  <property name="y_options"></property>
		</packing>
	      </child>

	      <child>
		<widget class="GtkLabel" id="label3">
		  <property name="visible">True</property>
		  <property name="label" translatable="yes">Page Number</property>
		  <property name="use_underline">False</property>
		  <property name="use_markup">False</property>
		  <property name="justify">GTK_JUSTIFY_LEFT</property>
		  <property name="wrap">False</property>
		  <property name="selectable">False</property>
		  <property name="xalign">0</property>
		  <property name="yalign">0.5</property>
		  <property name="xpad">0</property>
		  <property name="ypad">0</property>
		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
		  <property name="width_chars">-1</property>
		  <property name="single_line_mode">False</property>
		  <property name="angle">0</property>
		</widget>
		<packing>
		  <property name="left_attach">0</property>
		  <property name="right_attach">1</property>
		  <property name="top_attach">1</property>
		  <property name="bottom_attach">2</property>
		  <property name="x_options">fill</property>
		  <property name="y_options"></property>
		</packing>
	      </child>

	      <child>
		<widget class="GtkFileChooserButton" id="pdf_file_chooser_button">
		  <property name="visible">True</property>
		  <property name="title" translatable="yes">Select A File</property>
		  <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
		  <property name="local_only">True</property>
		  <property name="show_hidden">False</property>
		  <property name="width_chars">-1</property>
		</widget>
		<packing>
		  <property name="left_attach">1</property>
		  <property name="right_attach">2</property>
		  <property name="top_attach">0</property>
		  <property name="bottom_attach">1</property>
		  <property name="y_options">fill</property>
		</packing>
	      </child>

	      <child>
		<widget class="GtkSpinButton" id="pdf_spin">
		  <property name="visible">True</property>
		  <property name="can_focus">True</property>
		  <property name="climb_rate">1</property>
		  <property name="digits">0</property>
		  <property name="numeric">False</property>
		  <property name="update_policy">GTK_UPDATE_ALWAYS</property>
		  <property name="snap_to_ticks">False</property>
		  <property name="wrap">False</property>
		  <property name="adjustment">1 0 100 1 10 10</property>
		</widget>
		<packing>
		  <property name="left_attach">1</property>
		  <property name="right_attach">2</property>
		  <property name="top_attach">1</property>
		  <property name="bottom_attach">2</property>
		  <property name="y_options"></property>
		</packing>
	      </child>
	    </widget>
	    <packing>
	      <property name="padding">0</property>
	      <property name="expand">False</property>
	      <property name="fill">True</property>
	    </packing>
	  </child>

	  <child>
	    <widget class="GtkFrame" id="frame1">
	      <property name="visible">True</property>
	      <property name="label_xalign">0</property>
	      <property name="label_yalign">0.5</property>
	      <property name="shadow_type">GTK_SHADOW_NONE</property>

	      <child>
		<widget class="GtkAlignment" id="alignment1">
		  <property name="visible">True</property>
		  <property name="xalign">0.5</property>
		  <property name="yalign">0.5</property>
		  <property name="xscale">1</property>
		  <property name="yscale">1</property>
		  <property name="top_padding">0</property>
		  <property name="bottom_padding">0</property>
		  <property name="left_padding">12</property>
		  <property name="right_padding">0</property>

		  <child>
		    <widget class="GtkVBox" id="vbox3">
		      <property name="visible">True</property>
		      <property name="homogeneous">False</property>
		      <property name="spacing">6</property>

		      <child>
			<widget class="GtkScrolledWindow" id="scrolledwindow1">
			  <property name="visible">True</property>
			  <property name="can_focus">True</property>
			  <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
			  <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
			  <property name="shadow_type">GTK_SHADOW_IN</property>
			  <property name="window_placement">GTK_CORNER_TOP_LEFT</property>

			  <child>
			    <widget class="GtkTreeView" id="pdf_tree_view">
			      <property name="visible">True</property>
			      <property name="can_focus">True</property>
			      <property name="headers_visible">True</property>
			      <property name="rules_hint">False</property>
			      <property name="reorderable">False</property>
			      <property name="enable_search">True</property>
			      <property name="fixed_height_mode">False</property>
			      <property name="hover_selection">False</property>
			      <property name="hover_expand">False</property>
			    </widget>
			  </child>
			</widget>
			<packing>
			  <property name="padding">0</property>
			  <property name="expand">True</property>
			  <property name="fill">True</property>
			</packing>
		      </child>

		      <child>
			<widget class="GtkTable" id="table2">
			  <property name="visible">True</property>
			  <property name="n_rows">2</property>
			  <property name="n_columns">3</property>
			  <property name="homogeneous">False</property>
			  <property name="row_spacing">6</property>
			  <property name="column_spacing">12</property>

			  <child>
			    <widget class="GtkLabel" id="label6">
			      <property name="visible">True</property>
			      <property name="label" translatable="yes">Total time elapsed:</property>
			      <property name="use_underline">False</property>
			      <property name="use_markup">True</property>
			      <property name="justify">GTK_JUSTIFY_LEFT</property>
			      <property name="wrap">False</property>
			      <property name="selectable">False</property>
			      <property name="xalign">0</property>
			      <property name="yalign">0.5</property>
			      <property name="xpad">0</property>
			      <property name="ypad">0</property>
			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
			      <property name="width_chars">-1</property>
			      <property name="single_line_mode">False</property>
			      <property name="angle">0</property>
			    </widget>
			    <packing>
			      <property name="left_attach">0</property>
			      <property name="right_attach">1</property>
			      <property name="top_attach">1</property>
			      <property name="bottom_attach">2</property>
			      <property name="x_options">fill</property>
			      <property name="y_options"></property>
			    </packing>
			  </child>

			  <child>
			    <widget class="GtkLabel" id="pdf_total_label">
			      <property name="visible">True</property>
			      <property name="label" translatable="yes"></property>
			      <property name="use_underline">False</property>
			      <property name="use_markup">True</property>
			      <property name="justify">GTK_JUSTIFY_LEFT</property>
			      <property name="wrap">False</property>
			      <property name="selectable">False</property>
			      <property name="xalign">0</property>
			      <property name="yalign">0.5</property>
			      <property name="xpad">0</property>
			      <property name="ypad">0</property>
			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
			      <property name="width_chars">-1</property>
			      <property name="single_line_mode">False</property>
			      <property name="angle">0</property>
			    </widget>
			    <packing>
			      <property name="left_attach">1</property>
			      <property name="right_attach">3</property>
			      <property name="top_attach">1</property>
			      <property name="bottom_attach">2</property>
			      <property name="x_options">fill</property>
			      <property name="y_options"></property>
			    </packing>
			  </child>

			  <child>
			    <widget class="GtkLabel" id="label5">
			      <property name="visible">True</property>
			      <property name="label" translatable="yes">Description:</property>
			      <property name="use_underline">False</property>
			      <property name="use_markup">False</property>
			      <property name="justify">GTK_JUSTIFY_LEFT</property>
			      <property name="wrap">False</property>
			      <property name="selectable">False</property>
			      <property name="xalign">0</property>
			      <property name="yalign">0</property>
			      <property name="xpad">0</property>
			      <property name="ypad">0</property>
			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
			      <property name="width_chars">-1</property>
			      <property name="single_line_mode">False</property>
			      <property name="angle">0</property>
			    </widget>
			    <packing>
			      <property name="left_attach">0</property>
			      <property name="right_attach">1</property>
			      <property name="top_attach">0</property>
			      <property name="bottom_attach">1</property>
			      <property name="x_options">fill</property>
			      <property name="y_options">fill</property>
			    </packing>
			  </child>

			  <child>
			    <widget class="GtkLabel" id="description_label">
			      <property name="visible">True</property>
			      <property name="label" translatable="yes">&lt;i&gt;No Description&lt;/i&gt;</property>
			      <property name="use_underline">False</property>
			      <property name="use_markup">True</property>
			      <property name="justify">GTK_JUSTIFY_LEFT</property>
			      <property name="wrap">True</property>
			      <property name="selectable">False</property>
			      <property name="xalign">0</property>
			      <property name="yalign">0</property>
			      <property name="xpad">0</property>
			      <property name="ypad">0</property>
			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
			      <property name="width_chars">-1</property>
			      <property name="single_line_mode">False</property>
			      <property name="angle">0</property>
			    </widget>
			    <packing>
			      <property name="left_attach">1</property>
			      <property name="right_attach">2</property>
			      <property name="top_attach">0</property>
			      <property name="bottom_attach">1</property>
			      <property name="y_options">fill</property>
			    </packing>
			  </child>

			  <child>
			    <widget class="GtkAlignment" id="alignment2">
			      <property name="visible">True</property>
			      <property name="xalign">0.5</property>
			      <property name="yalign">0</property>
			      <property name="xscale">0.0</property>
			      <property name="yscale">0.0</property>
			      <property name="top_padding">0</property>
			      <property name="bottom_padding">0</property>
			      <property name="left_padding">0</property>
			      <property name="right_padding">0</property>

			      <child>
				<widget class="GtkButton" id="analyze_button">
				  <property name="visible">True</property>
				  <property name="can_focus">True</property>
				  <property name="label" translatable="yes">_Analyze</property>
				  <property name="use_underline">True</property>
				  <property name="relief">GTK_RELIEF_NORMAL</property>
				  <property name="focus_on_click">True</property>
				</widget>
			      </child>
			    </widget>
			    <packing>
			      <property name="left_attach">2</property>
			      <property name="right_attach">3</property>
			      <property name="top_attach">0</property>
			      <property name="bottom_attach">1</property>
			      <property name="x_options">fill</property>
			      <property name="y_options">fill</property>
			    </packing>
			  </child>
			</widget>
			<packing>
			  <property name="padding">0</property>
			  <property name="expand">False</property>
			  <property name="fill">True</property>
			</packing>
		      </child>
		    </widget>
		  </child>
		</widget>
	      </child>

	      <child>
		<widget class="GtkLabel" id="label4">
		  <property name="visible">True</property>
		  <property name="label" translatable="yes">&lt;b&gt;PDF Instructions&lt;/b&gt;</property>
		  <property name="use_underline">False</property>
		  <property name="use_markup">True</property>
		  <property name="justify">GTK_JUSTIFY_LEFT</property>
		  <property name="wrap">False</property>
		  <property name="selectable">False</property>
		  <property name="xalign">0.5</property>
		  <property name="yalign">0.5</property>
		  <property name="xpad">0</property>
		  <property name="ypad">0</property>
		  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
		  <property name="width_chars">-1</property>
		  <property name="single_line_mode">False</property>
		  <property name="angle">0</property>
		</widget>
		<packing>
		  <property name="type">label_item</property>
		</packing>
	      </child>
	    </widget>
	    <packing>
	      <property name="padding">0</property>
	      <property name="expand">True</property>
	      <property name="fill">True</property>
	    </packing>
	  </child>
	</widget>
	<packing>
	  <property name="padding">0</property>
	  <property name="expand">True</property>
	  <property name="fill">True</property>
	</packing>
      </child>
    </widget>
  </child>
</widget>

</glade-interface>

--- NEW FILE: pdf-operators.c ---
typedef struct
{
  char *op;
  char *description;
} OperatorMapping;

OperatorMapping op_mapping[] = {
  { "b", "Close, fill, and stroke path using nonzero winding number rule" },
  { "B", "Fill and stroke path using nonzero winding number rule" },
  { "b*", "Close, fill, and stroke path using even-odd rule" },
  { "B*", "Fill and stroke path using even-odd rule" },
  { "BDC", "(PDF 1.2) Begin marked-content sequence with property list" },
  { "BI", "Begin inline image object" },
  { "BMC", "(PDF 1.2) Begin marked-content sequence" },
  { "BT", "Begin text object" },
  { "BX", "(PDF 1.1) Begin compatibility section" },
  { "c", "Append curved segment to path (three control points)" },
  { "cm", "Concatenate matrix to current transformation matrix" },
  { "CS", "(PDF 1.1) Set color space for stroking operations" },
  { "cs", "(PDF 1.1) Set color space for nonstroking operations" },
  { "d", "Set line dash pattern" },
  { "d0", "Set glyph width in Type 3 font" },
  { "d1", "Set glyph width and bounding box in Type 3 font" },
  { "Do", "Invoke named XObject" },
  { "DP", "(PDF 1.2) Define marked-content point with property list" },
  { "EI", "End inline image object" },
  { "EMC", "(PDF 1.2) End marked-content sequence" },
  { "ET", "End text object" },
  { "EX", "(PDF 1.1) End compatibility section" },
  { "f", "Fill path using nonzero winding number rule" },
  { "F", "Fill path using nonzero winding number rule (obsolete)" },
  { "f*", "Fill path using even-odd rule" },
  { "G", "Set gray level for stroking operations" },
  { "g", "Set gray level for nonstroking operations" },
  { "gs", "(PDF 1.2) Set parameters from graphics state parameter dictionary" },
  { "h", "Close subpath" },
  { "i", "Set flatness tolerance" },
  { "ID", "Begin inline image data" },
  { "j", "Set line join style" },
  { "J", "Set line cap style" },
  { "K", "Set CMYK color for stroking operations" },
  { "k", "Set CMYK color for nonstroking operations" },
  { "l", "Append straight line segment to path" },
  { "m", "Begin new subpath" },
  { "M", "Set miter limit" },
  { "MP", "(PDF 1.2) Define marked-content point" },
  { "n", "End path without filling or stroking" },
  { "q", "Save graphics state" },
  { "Q", "Restore graphics state" },
  { "re", "Append rectangle to path" },
  { "RG", "Set RGB color for stroking operations" },
  { "rg", "Set RGB color for nonstroking operations" },
  { "ri", "Set color rendering intent" },
  { "s", "Close and stroke path" },
  { "S", "Stroke path" },
  { "SC", "(PDF 1.1) Set color for stroking operations" },
  { "sc", "(PDF 1.1) Set color for nonstroking operations" },
  { "SCN", "(PDF 1.2) Set color for stroking operations (ICCBased and special color spaces)" },
  { "scn", "(PDF 1.2) Set color for nonstroking operations (ICCBased and special color spaces)" },
  { "sh", "(PDF 1.3) Paint area defined by shading pattern" },
  { "T*", "Move to start of next text line" },
  { "Tc", "Set character spacing" },
  { "Td", "Move text position" },
  { "TD", "Move text position and set leading" },
  { "Tf", "Set text font and size" },
  { "Tj", "Show text" },
  { "TJ", "Show text, allowing individual glyph positioning" },
  { "TL", "Set text leading" },
  { "Tm", "Set text matrix and text line matrix" },
  { "Tr", "Set text rendering mode" },
  { "Ts", "Set text rise" },
  { "Tw", "Set word spacing" },
  { "Tz", "Set horizontal text scaling" },
  { "v", "Append curved segment to path (initial point replicated)" },
  { "w", "Set line width" },
  { "W", "Set clipping path using nonzero winding number rule" },
  { "W*", "Set clipping path using even-odd rule" },
  { "y", "Append curved segment to path (final point replicated)" },
  { "'", "Move to next line and show text" },
  { "\"", "Set word and character spacing, move to next line, and show text" },
};



More information about the poppler mailing list