X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;ds=sidebyside;f=pdf%2Fxpdf%2Fgpdf.cc;h=aea6586e70f202a8046a15003f48d89f4da29fc0;hb=3da3c2213362ae1c553de577579023d37692d554;hp=147222b409aefcbbf3c6f700a18cdd07180137ba;hpb=1e2eb7dcec367363483987cfe528dbb49497579d;p=evince.git diff --git a/pdf/xpdf/gpdf.cc b/pdf/xpdf/gpdf.cc index 147222b4..aea6586e 100644 --- a/pdf/xpdf/gpdf.cc +++ b/pdf/xpdf/gpdf.cc @@ -38,7 +38,7 @@ #include "config.h" GBool printCommands = gFalse; -gint gpdf_debug; +gint gpdf_debug=1; poptContext ctx; #define DOC_ROOT_MAGIC 0xad3f556d @@ -102,21 +102,39 @@ doc_config_event (GtkWidget *widget, void *ugly) widget->allocation.height, -1); + printf ("Creating pixmap of size %d %d\n", + widget->allocation.width, widget->allocation.height); gdk_color_white (gtk_widget_get_default_colormap(), &doc->paper); doc->out = new GOutputDev (doc->pixmap, doc->paper); -/* gdk_draw_rectangle (doc->pixmap, - widget->style->white_gc, - TRUE, - 0, 0, - widget->allocation.width, - widget->allocation.height);*/ - printf ("Configured...\n"); + + { + GdkGCValues gcValues; + GdkGC *strokeGC; + + gdk_color_white (gtk_widget_get_default_colormap (), &gcValues.foreground); + gdk_color_black (gtk_widget_get_default_colormap (), &gcValues.background); + gcValues.line_width = 1; + gcValues.line_style = GDK_LINE_SOLID; + strokeGC = gdk_gc_new_with_values ( + doc->pixmap, &gcValues, + (enum GdkGCValuesMask)(GDK_GC_FOREGROUND | GDK_GC_BACKGROUND | GDK_GC_LINE_WIDTH | GDK_GC_LINE_STYLE)); + + gdk_draw_rectangle (doc->pixmap, + strokeGC, + TRUE, + 0, 0, + widget->allocation.width, + widget->allocation.height); + } return TRUE; } +GdkFont *magic_font; +GdkGC *magic_black; + static gint -doc_redraw_event (GtkWidget *widget, void *ugly) +doc_redraw_event (GtkWidget *widget, GdkEventExpose *event) { DOC_ROOT *doc = hack_global; @@ -124,17 +142,25 @@ doc_redraw_event (GtkWidget *widget, void *ugly) g_return_val_if_fail (doc->magic == DOC_ROOT_MAGIC, FALSE); if (doc->out && doc->pdf) { + GtkStyle *style = gtk_widget_get_default_style(); printf ("There are %d pages\n", doc->pdf->getNumPages()); - doc->pdf->displayPage(doc->out, 1, 72, 0, gTrue); - gdk_draw_pixmap (widget->window, - widget->style->white_gc, - doc->pixmap, - 0, 0, - 0, 0, - widget->allocation.width, - widget->allocation.height); - + magic_font = widget->style->font; + magic_black = widget->style->black_gc; + gdk_draw_line (doc->pixmap, + widget->style->black_gc, + event->area.x, event->area.y, + event->area.width, event->area.height); + doc->pdf->displayPage(doc->out, 1, 86, 0, gTrue); /* 86 zoom */ + printf ("Draw pixmap %p\n", doc->pixmap); + gdk_draw_string (doc->pixmap, magic_font, magic_black, + 300, 300, "Hello"); + gdk_draw_pixmap(widget->window, + widget->style->fg_gc[GTK_WIDGET_STATE (widget)], + doc->pixmap, + 0, 0, + event->area.x, event->area.y, + event->area.width, event->area.height); } else printf ("Null pointer error %p %p\n", doc->out, doc->pdf); @@ -235,6 +261,8 @@ main (int argc, char *argv []) gnome_init_with_popt_table ( "gpdf", "0.1", argc, argv, gpdf_popt_options, 0, &ctx); + + errorInit(); initParams (xpdfConfigFile); /* Init font path */