X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-output-window.c;h=658d36a4669f7d9aecb236a25214678ead7f4444;hb=8dfe93d6dde6f5a500c5c4f0dccb067fe647904c;hp=0dacd134bc2c1eddb7aaf0631bb70302907c0e05;hpb=4eac86bdd50377578553ca2aa2eb87199dbb0aa1;p=pspp-builds.git diff --git a/src/ui/gui/psppire-output-window.c b/src/ui/gui/psppire-output-window.c index 0dacd134..658d36a4 100644 --- a/src/ui/gui/psppire-output-window.c +++ b/src/ui/gui/psppire-output-window.c @@ -109,7 +109,8 @@ psppire_output_window_dispose (GObject *obj) viewer->items = NULL; viewer->n_items = viewer->allocated_items = 0; - g_object_unref (viewer->print_settings); + if (viewer->print_settings != NULL) + g_object_unref (viewer->print_settings); /* Chain up to the parent class */ G_OBJECT_CLASS (parent_class)->dispose (obj); @@ -148,6 +149,7 @@ struct psppire_output_driver struct output_driver driver; PsppireOutputWindow *viewer; struct xr_driver *xr; + int font_height; }; static struct output_driver_class psppire_output_class; @@ -221,8 +223,10 @@ psppire_output_submit (struct output_driver *this, { const GtkStyle *style = gtk_widget_get_style (GTK_WIDGET (viewer)); struct string_map options = STRING_MAP_INITIALIZER (options); + struct text_item *text_item; PangoFontDescription *font_desc; char *font_name; + int font_width; /* Use GTK+ default font as proportional font. */ font_name = pango_font_description_to_string (style->font_desc); @@ -243,7 +247,6 @@ psppire_output_submit (struct output_driver *this, it is already close enough to INT_MAX when expressed as thousands of a point.) */ string_map_insert (&options, "paper-size", "300x200000mm"); - string_map_insert (&options, "headers", "off"); string_map_insert (&options, "left-margin", "0"); string_map_insert (&options, "right-margin", "0"); string_map_insert (&options, "top-margin", "0"); @@ -252,7 +255,15 @@ psppire_output_submit (struct output_driver *this, pod->xr = xr_driver_create (cr, &options); string_map_destroy (&options); + + text_item = text_item_create (TEXT_ITEM_PARAGRAPH, "X"); + r = xr_rendering_create (pod->xr, text_item_super (text_item), cr); + xr_rendering_measure (r, &font_width, &pod->font_height); + /* xr_rendering_destroy (r); */ + text_item_unref (text_item); } + else + pod->viewer->y += pod->font_height / 2; r = xr_rendering_create (pod->xr, item, cr); if (r == NULL) @@ -453,7 +464,7 @@ enum #define N_EXTENTIONS (n_FT - 1) struct file_types ft[n_FT] = { - {N_("Infer file type from extention"), NULL}, + {N_("Infer file type from extension"), NULL}, {N_("PDF (*.pdf)"), ".pdf"}, {N_("HTML (*.html)"), ".html"}, {N_("OpenDocument (*.odt)"), ".odt"}, @@ -1044,7 +1055,8 @@ GtkWidget* psppire_output_window_new (void) { return GTK_WIDGET (g_object_new (psppire_output_window_get_type (), - "filename", "Output", + /* TRANSLATORS: This will form a filename. Please avoid whitespace. */ + "filename", _("Output"), "description", _("Output Viewer"), NULL)); }