#include <config.h>
-#include <gnome.h>
-#include <math.h>
+#include <glib/gi18n.h>
#include "gsdefaults.h"
-#include <gconf/gconf-client.h>
-
-static void gtk_gs_defaults_changed (GConfClient * client, guint cnxn_id,
- GConfEntry * entry, gpointer user_data);
-
-/**
- * defaults for GtkGS widgets
- **/
-
-static GConfClient *gconf_client;
-
-/* Default values to pass to gtk_gs_init */
-typedef struct _GtkGSDefaults {
- gboolean antialiased;
- gboolean override_size;
- gint default_size;
- gboolean override_orientation;
- gboolean respect_eof;
- gboolean show_scroll_rect;
- gint fallback_orientation;
- gfloat zoom_factor;
- gfloat scroll_step;
- gchar *interpreter_cmd;
- gchar *alpha_params;
- gchar *dsc_cmd;
- gchar *convert_pdf_cmd;
- gchar *ungzip_cmd;
- gchar *unbzip2_cmd;
- GtkGSZoomMode zoom_mode;
-} GtkGSDefaults;
-
-static GtkGSDefaults gtk_gs_defaults = {
- TRUE, FALSE, 8, FALSE, TRUE, TRUE,
- 0, 1.0, 0.25, NULL, NULL, NULL, NULL, NULL, NULL,
- GTK_GS_ZOOM_ABSOLUTE
-};
-
GtkGSPaperSize gtk_gs_paper_sizes[] = {
{N_("BBox"), 0, 0},
{N_("Letter"), 612, 792,},
{NULL, 0, 0}
};
-void
-gtk_gs_defaults_set_scroll_step(gfloat step)
-{
- if(fabs(gtk_gs_defaults.scroll_step - step) > 0.001) {
- gtk_gs_defaults.scroll_step = step;
- gconf_client_set_float(gconf_client,
- "/apps/ggv/gtkgs/scrollstep",
- gtk_gs_defaults_get_scroll_step(), NULL);
- }
-}
-
-gfloat
-gtk_gs_defaults_get_scroll_step()
-{
- return gtk_gs_defaults.scroll_step;
-}
-
-void
-gtk_gs_defaults_set_size(gint iNewPageSize)
-{
- if(gtk_gs_defaults.default_size != iNewPageSize) {
- gtk_gs_defaults.default_size = iNewPageSize;
- gconf_client_set_int(gconf_client, "/apps/ggv/gtkgs/size",
- gtk_gs_defaults_get_size(), NULL);
- }
-}
-
-gint
-gtk_gs_defaults_get_size()
-{
- return gtk_gs_defaults.default_size;
-}
-
-void
-gtk_gs_defaults_set_override_size(gboolean bOverrSize)
-{
- if(gtk_gs_defaults.override_size != bOverrSize) {
- gtk_gs_defaults.override_size = bOverrSize;
- gconf_client_set_bool(gconf_client,
- "/apps/ggv/gtkgs/override_size",
- gtk_gs_defaults_get_override_size(), NULL);
- }
-}
-
-gboolean
-gtk_gs_defaults_get_override_size()
-{
- return gtk_gs_defaults.override_size;
-}
-
-void
-gtk_gs_defaults_set_override_orientation(gboolean bOverOrien)
-{
- if(gtk_gs_defaults.override_orientation != bOverOrien) {
- gtk_gs_defaults.override_orientation = bOverOrien;
- gconf_client_set_bool(gconf_client,
- "/apps/ggv/gtkgs/override_orientation",
- gtk_gs_defaults_get_override_orientation(), NULL);
- }
-}
-
-gboolean
-gtk_gs_defaults_get_override_orientation()
-{
- return gtk_gs_defaults.override_orientation;
-}
-
-void
-gtk_gs_defaults_set_antialiased(gint iNewAntialiased)
-{
- if(gtk_gs_defaults.antialiased != iNewAntialiased) {
- gtk_gs_defaults.antialiased = iNewAntialiased;
- gconf_client_set_bool(gconf_client,
- "/apps/ggv/gtkgs/antialiasing",
- gtk_gs_defaults_get_antialiased(), NULL);
- }
-}
-
-gboolean
-gtk_gs_defaults_get_antialiased()
-{
- return gtk_gs_defaults.antialiased;
-}
-
-void
-gtk_gs_defaults_set_zoom_factor(gfloat fZoom)
-{
- fZoom = MIN(fZoom, 30.0);
- fZoom = MAX(0.05, fZoom);
- if(fabs(gtk_gs_defaults.zoom_factor - fZoom) > 0.001) {
- gtk_gs_defaults.zoom_factor = fZoom;
- gconf_client_set_float(gconf_client, "/apps/ggv/gtkgs/zoom",
- gtk_gs_defaults_get_zoom_factor(), NULL);
- }
-}
-
-gfloat
-gtk_gs_defaults_get_zoom_factor()
-{
- return gtk_gs_defaults.zoom_factor;
-}
-
-void
-gtk_gs_defaults_set_orientation(gint iNewOrientation)
-{
- g_assert((iNewOrientation == GTK_GS_ORIENTATION_PORTRAIT) ||
- (iNewOrientation == GTK_GS_ORIENTATION_LANDSCAPE) ||
- (iNewOrientation == GTK_GS_ORIENTATION_UPSIDEDOWN) ||
- (iNewOrientation == GTK_GS_ORIENTATION_SEASCAPE));
- if(gtk_gs_defaults.fallback_orientation != iNewOrientation) {
- gtk_gs_defaults.fallback_orientation = iNewOrientation;
- gconf_client_set_int(gconf_client,
- "/apps/ggv/gtkgs/orientation",
- gtk_gs_defaults_get_orientation(), NULL);
- }
-}
-
-gint
-gtk_gs_defaults_get_orientation()
-{
- return gtk_gs_defaults.fallback_orientation;
-}
-
-void
-gtk_gs_defaults_set_respect_eof(gboolean resp)
-{
- if(gtk_gs_defaults.respect_eof != resp) {
- gtk_gs_defaults.respect_eof = resp;
- gconf_client_set_bool(gconf_client,
- "/apps/ggv/gtkgs/respect_eof",
- gtk_gs_defaults_get_respect_eof(), NULL);
- }
-}
-
-gboolean
-gtk_gs_defaults_get_respect_eof()
-{
- return gtk_gs_defaults.respect_eof;
-}
-
GtkGSPaperSize *
gtk_gs_defaults_get_paper_sizes()
{
return gtk_gs_paper_sizes;
}
-gboolean
-gtk_gs_defaults_get_show_scroll_rect()
-{
- return gtk_gs_defaults.show_scroll_rect;
-}
-
-void
-gtk_gs_defaults_set_show_scroll_rect(gboolean f)
-{
- if(gtk_gs_defaults.show_scroll_rect != f) {
- gtk_gs_defaults.show_scroll_rect = f;
- gconf_client_set_bool(gconf_client,
- "/apps/ggv/gtkgs/show_scroll_rect",
- gtk_gs_defaults_get_show_scroll_rect(), NULL);
- }
-}
-
const gchar *
gtk_gs_defaults_get_interpreter_cmd()
{
- if(!gtk_gs_defaults.interpreter_cmd)
return GS_PATH;
- return gtk_gs_defaults.interpreter_cmd;
-}
-
-const gchar *
-gtk_gs_defaults_get_alpha_parameters()
-{
- if(!gtk_gs_defaults.alpha_params)
- return ALPHA_PARAMS;
- return gtk_gs_defaults.alpha_params;
}
const gchar *
-gtk_gs_defaults_get_convert_pdf_cmd()
+gtk_gs_defaults_get_alpha_parameters (void)
{
- if(!gtk_gs_defaults.convert_pdf_cmd)
- return GS_PATH
- " -q -dNOPAUSE -dBATCH -dSAFER"
- " -dQUIET -sDEVICE=pswrite" " -sOutputFile=%s -c save pop -f %s";
- return gtk_gs_defaults.convert_pdf_cmd;
+ return ALPHA_PARAMS;
}
const gchar *
-gtk_gs_defaults_get_dsc_cmd()
+gtk_gs_defaults_get_ungzip_cmd (void)
{
- if(!gtk_gs_defaults.dsc_cmd)
- return GS_PATH
- " -q -dNODISPLAY -dSAFER -dDELAYSAFER"
- " -sDSCname=%s -sPDFname=%s pdf2dsc.ps" " -c quit";
- return gtk_gs_defaults.dsc_cmd;
+ return "gzip -cd";
}
const gchar *
-gtk_gs_defaults_get_ungzip_cmd()
-{
- if(!gtk_gs_defaults.ungzip_cmd)
- return "gzip -cd";
- return gtk_gs_defaults.ungzip_cmd;
-}
-
-const gchar *
-gtk_gs_defaults_get_unbzip2_cmd()
-{
- if(!gtk_gs_defaults.unbzip2_cmd)
- return "bzip2 -cd";
- return gtk_gs_defaults.unbzip2_cmd;
-}
-
-void
-gtk_gs_defaults_set_interpreter_cmd(gchar * cmd)
-{
- if((NULL == gtk_gs_defaults.interpreter_cmd) ||
- strcmp(gtk_gs_defaults.interpreter_cmd, cmd)) {
- if(gtk_gs_defaults.interpreter_cmd)
- g_free(gtk_gs_defaults.interpreter_cmd);
- gtk_gs_defaults.interpreter_cmd = cmd;
- gconf_client_set_string(gconf_client,
- "/apps/ggv/gtkgs/interpreter",
- gtk_gs_defaults_get_interpreter_cmd(), NULL);
- }
-}
-
-void
-gtk_gs_defaults_set_alpha_parameters(gchar * par)
-{
- if((NULL == gtk_gs_defaults.alpha_params) ||
- strcmp(gtk_gs_defaults.alpha_params, par)) {
- if(gtk_gs_defaults.alpha_params)
- g_free(gtk_gs_defaults.alpha_params);
- gtk_gs_defaults.alpha_params = par;
- gconf_client_set_string(gconf_client,
- "/apps/ggv/gtkgs/alphaparams",
- gtk_gs_defaults_get_alpha_parameters(), NULL);
- }
-}
-
-void
-gtk_gs_defaults_set_convert_pdf_cmd(gchar * cmd)
-{
- if((NULL == gtk_gs_defaults.convert_pdf_cmd) ||
- strcmp(gtk_gs_defaults.convert_pdf_cmd, cmd)) {
- if(gtk_gs_defaults.convert_pdf_cmd)
- g_free(gtk_gs_defaults.convert_pdf_cmd);
- gtk_gs_defaults.convert_pdf_cmd = cmd;
- gconf_client_set_string(gconf_client,
- "/apps/ggv/gtkgs/convertpdf",
- gtk_gs_defaults_get_convert_pdf_cmd(), NULL);
- }
-}
-
-void
-gtk_gs_defaults_set_dsc_cmd(gchar * cmd)
-{
- if((NULL == gtk_gs_defaults.dsc_cmd) || strcmp(gtk_gs_defaults.dsc_cmd, cmd)) {
- if(gtk_gs_defaults.dsc_cmd)
- g_free(gtk_gs_defaults.dsc_cmd);
- gtk_gs_defaults.dsc_cmd = cmd;
- gconf_client_set_string(gconf_client,
- "/apps/ggv/gtkgs/pdf2dsc",
- gtk_gs_defaults_get_dsc_cmd(), NULL);
- }
-}
-
-void
-gtk_gs_defaults_set_ungzip_cmd(gchar * cmd)
-{
- if((NULL == gtk_gs_defaults.ungzip_cmd) ||
- strcmp(gtk_gs_defaults.ungzip_cmd, cmd)) {
- if(gtk_gs_defaults.ungzip_cmd)
- g_free(gtk_gs_defaults.ungzip_cmd);
- gtk_gs_defaults.ungzip_cmd = cmd;
- gconf_client_set_string(gconf_client,
- "/apps/ggv/gtkgs/ungzip",
- gtk_gs_defaults_get_ungzip_cmd(), NULL);
- }
-}
-
-void
-gtk_gs_defaults_set_unbzip2_cmd(gchar * cmd)
-{
- if((NULL == gtk_gs_defaults.unbzip2_cmd) ||
- strcmp(gtk_gs_defaults.unbzip2_cmd, cmd)) {
- if(gtk_gs_defaults.unbzip2_cmd)
- g_free(gtk_gs_defaults.unbzip2_cmd);
- gtk_gs_defaults.unbzip2_cmd = cmd;
- gconf_client_set_string(gconf_client,
- "/apps/ggv/gtkgs/unbzip2",
- gtk_gs_defaults_get_unbzip2_cmd(), NULL);
- }
-}
-
-GtkGSZoomMode
-gtk_gs_defaults_get_zoom_mode()
-{
- return gtk_gs_defaults.zoom_mode;
-}
-
-void
-gtk_gs_defaults_set_zoom_mode(GtkGSZoomMode zoom_mode)
-{
- if(gtk_gs_defaults.zoom_mode != zoom_mode) {
- gtk_gs_defaults.zoom_mode = zoom_mode;
- gconf_client_set_int(gconf_client, "/apps/ggv/gtkgs/zoommode",
- gtk_gs_defaults_get_zoom_mode(), NULL);
- }
-}
-
-static GConfClient *
-gtk_gs_defaults_gconf_client()
-{
- if(!gconf_client) {
- g_assert(gconf_is_initialized());
- gconf_client = gconf_client_get_default();
- g_assert(gconf_client != NULL);
- gconf_client_add_dir(gconf_client, "/apps/ggv/gtkgs",
- GCONF_CLIENT_PRELOAD_RECURSIVE, NULL);
- gconf_client_notify_add(gconf_client,
- "/apps/ggv/gtkgs", (GConfClientNotifyFunc)
- gtk_gs_defaults_changed, NULL, NULL, NULL);
- }
-
- return gconf_client;
-}
-
-void
-gtk_gs_defaults_load()
-{
- gtk_gs_defaults_gconf_client();
-
- gtk_gs_defaults.respect_eof =
- (gconf_client_get_bool(gconf_client, "/apps/ggv/gtkgs/respect_eof", NULL));
- gtk_gs_defaults.override_size =
- (gconf_client_get_bool(gconf_client, "/apps/ggv/gtkgs/override_size",
- NULL));
- gtk_gs_defaults.override_orientation =
- (gconf_client_get_bool
- (gconf_client, "/apps/ggv/gtkgs/override_orientation", NULL));
- gtk_gs_defaults.antialiased =
- (gconf_client_get_bool(gconf_client, "/apps/ggv/gtkgs/antialiasing", NULL));
- gtk_gs_defaults.default_size =
- (gconf_client_get_int(gconf_client, "/apps/ggv/gtkgs/size", NULL));
- gtk_gs_defaults.zoom_factor =
- (gconf_client_get_float(gconf_client, "/apps/ggv/gtkgs/zoom", NULL));
- gtk_gs_defaults.fallback_orientation =
- (gconf_client_get_int(gconf_client, "/apps/ggv/gtkgs/orientation", NULL));
- gtk_gs_defaults.interpreter_cmd =
- (gconf_client_get_string
- (gconf_client, "/apps/ggv/gtkgs/interpreter", NULL));
- gtk_gs_defaults.alpha_params =
- (gconf_client_get_string
- (gconf_client, "/apps/ggv/gtkgs/alphaparams", NULL));
- gtk_gs_defaults.convert_pdf_cmd =
- (gconf_client_get_string(gconf_client, "/apps/ggv/gtkgs/convertpdf", NULL));
- gtk_gs_defaults.dsc_cmd =
- (gconf_client_get_string(gconf_client, "/apps/ggv/gtkgs/pdf2dsc", NULL));
- gtk_gs_defaults.ungzip_cmd =
- (gconf_client_get_string(gconf_client, "/apps/ggv/gtkgs/ungzip", NULL));
- gtk_gs_defaults.unbzip2_cmd =
- (gconf_client_get_string(gconf_client, "/apps/ggv/gtkgs/unbzip2", NULL));
- gtk_gs_defaults.show_scroll_rect =
- (gconf_client_get_bool
- (gconf_client, "/apps/ggv/gtkgs/show_scroll_rect", NULL));
- gtk_gs_defaults.scroll_step =
- (gconf_client_get_float(gconf_client, "/apps/ggv/gtkgs/scrollstep", NULL));
- gtk_gs_defaults.zoom_mode =
- (gconf_client_get_int(gconf_client, "/apps/ggv/gtkgs/zoommode", NULL));
-}
-
-static void
-gtk_gs_defaults_changed(GConfClient * client, guint cnxn_id,
- GConfEntry * entry, gpointer user_data)
+gtk_gs_defaults_get_unbzip2_cmd (void)
{
- if(!strcmp(entry->key, "/apps/ggv/gtkgs/respect_eof"))
- gtk_gs_defaults_set_respect_eof
- (gconf_client_get_bool(client, "/apps/ggv/gtkgs/respect_eof", NULL));
- else if(!strcmp(entry->key, "/apps/ggv/gtkgs/override_orientation"))
- gtk_gs_defaults_set_override_orientation
- (gconf_client_get_bool(client, "/apps/ggv/gtkgs/override_orientation",
- NULL));
- else if(!strcmp(entry->key, "/apps/ggv/gtkgs/orientation"))
- gtk_gs_defaults_set_orientation
- (gconf_client_get_int(client, "/apps/ggv/gtkgs/orientation", NULL));
- else if(!strcmp(entry->key, "/apps/ggv/gtkgs/zoom"))
- gtk_gs_defaults_set_zoom_factor
- (gconf_client_get_float(client, "/apps/ggv/gtkgs/zoom", NULL));
- else if(!strcmp(entry->key, "/apps/ggv/gtkgs/size"))
- gtk_gs_defaults_set_size
- (gconf_client_get_int(client, "/apps/ggv/gtkgs/size", NULL));
- else if(!strcmp(entry->key, "/apps/ggv/gtkgs/antialiasing"))
- gtk_gs_defaults_set_antialiased
- (gconf_client_get_bool(client, "/apps/ggv/gtkgs/antialiasing", NULL));
- else if(!strcmp(entry->key, "/apps/ggv/gtkgs/override_size"))
- gtk_gs_defaults_set_override_size
- (gconf_client_get_bool(client, "/apps/ggv/gtkgs/override_size", NULL));
- else if(!strcmp(entry->key, "/apps/ggv/gtkgs/show_scroll_rect"))
- gtk_gs_defaults_set_show_scroll_rect
- (gconf_client_get_bool(client, "/apps/ggv/gtkgs/show_scroll_rect", NULL));
- else if(!strcmp(entry->key, "/apps/ggv/gtkgs/interpreter"))
- gtk_gs_defaults_set_interpreter_cmd
- (gconf_client_get_string(client, "/apps/ggv/gtkgs/interpreter", NULL));
- else if(!strcmp(entry->key, "/apps/ggv/gtkgs/alphaparams"))
- gtk_gs_defaults_set_alpha_parameters
- (gconf_client_get_string(client, "/apps/ggv/gtkgs/alphaparams", NULL));
- else if(!strcmp(entry->key, "/apps/ggv/gtkgs/convertpdf"))
- gtk_gs_defaults_set_convert_pdf_cmd
- (gconf_client_get_string(client, "/apps/ggv/gtkgs/convertpdf", NULL));
- else if(!strcmp(entry->key, "/apps/ggv/gtkgs/pdf2dsc"))
- gtk_gs_defaults_set_dsc_cmd
- (gconf_client_get_string(client, "/apps/ggv/gtkgs/pdf2dsc", NULL));
- else if(!strcmp(entry->key, "/apps/ggv/gtkgs/ungzip"))
- gtk_gs_defaults_set_ungzip_cmd
- (gconf_client_get_string(client, "/apps/ggv/gtkgs/ungzip", NULL));
- else if(!strcmp(entry->key, "/apps/ggv/gtkgs/unbzip2"))
- gtk_gs_defaults_set_unbzip2_cmd
- (gconf_client_get_string(client, "/apps/ggv/gtkgs/unbzip2", NULL));
- else if(!strcmp(entry->key, "/apps/ggv/gtkgs/zoommode"))
- gtk_gs_defaults_set_zoom_mode
- (gconf_client_get_int(client, "/apps/ggv/gtkgs/zoommode", NULL));
- else if(!strcmp(entry->key, "/apps/ggv/gtkgs/scrollstep"))
- gtk_gs_defaults_set_scroll_step
- (gconf_client_get_float(client, "/apps/ggv/gtkgs/scrollstep", NULL));
+ return "bzip2 -cd";
}
gs->page_y_offset = 0;
/* Set user defined defaults */
- gs->override_orientation = gtk_gs_defaults_get_override_orientation();
- gs->fallback_orientation = gtk_gs_defaults_get_orientation();
- gs->zoom_factor = gtk_gs_defaults_get_zoom_factor();
- gs->default_size = gtk_gs_defaults_get_size();
- gs->antialiased = gtk_gs_defaults_get_antialiased();
- gs->override_size = gtk_gs_defaults_get_override_size();
- gs->respect_eof = gtk_gs_defaults_get_respect_eof();
- gs->zoom_mode = gtk_gs_defaults_get_zoom_mode();
+ gs->fallback_orientation = GTK_GS_ORIENTATION_PORTRAIT;
+ gs->zoom_factor = 1.0;
+ gs->default_size = 1;
+ gs->antialiased = TRUE;
+ gs->respect_eof = TRUE;
gs->gs_status = _("No document loaded.");
}
klass->page_atom = gdk_atom_intern("PAGE", FALSE);
klass->string_atom = gdk_atom_intern("STRING", FALSE);
- gtk_gs_defaults_load();
-
g_object_class_override_property (object_class, PROP_TITLE, "title");
}
gs->real_orientation = gs->doc->orientation;
}
- if(gs->override_orientation ||
- gs->real_orientation == GTK_GS_ORIENTATION_NONE)
+ if(gs->real_orientation == GTK_GS_ORIENTATION_NONE)
return gs->fallback_orientation;
else
return gs->real_orientation;
return filename_unc;
}
-/*
- * Check if gs->gs_filename or gs->gs_filename_unc is a pdf file and scan
- * pdf file if necessary.
- * Set gs->filename_dsc to the name of the dsc file or NULL.
- * Error reporting via signal 'interpreter_message'.
- */
-static gchar *
-check_pdf(PSDocument * gs)
-{
- FILE *file;
- gchar buf[1024], *filename;
- int fd;
-
- /* use uncompressed file as input if necessary */
- filename = (gs->gs_filename_unc ? gs->gs_filename_unc : gs->gs_filename);
-
- if((file = fopen(filename, "r"))
- && (fread(buf, sizeof(char), 5, file) == 5)
- && (strncmp(buf, "%PDF-", 5) == 0)) {
- /* we found a PDF file */
- gchar *fname, *filename_dsc, *filename_err, *cmd, *cmdline;
- filename_dsc = g_strconcat(g_get_tmp_dir(), "/ggvXXXXXX", NULL);
- if((fd = mkstemp(filename_dsc)) < 0) {
- return NULL;
- }
- close(fd);
- filename_err = g_strconcat(g_get_tmp_dir(), "/ggvXXXXXX", NULL);
- if((fd = mkstemp(filename_err)) < 0) {
- g_free(filename_dsc);
- return NULL;
- }
- close(fd);
- fname = g_shell_quote(filename);
- cmd = g_strdup_printf(gtk_gs_defaults_get_dsc_cmd(), filename_dsc, fname);
- g_free(fname);
- /* this command (sometimes?) prints error messages to stdout! */
- cmdline = g_strdup_printf("%s >%s 2>&1", cmd, filename_err);
- g_free(cmd);
-
- if((system(cmdline) == 0) && file_readable(filename_dsc)) {
-
- /* success */
- filename = gs->gs_filename_dsc = filename_dsc;
-
- if(file_length(filename_err) > 0) {
- gchar *err_msg = " ";
- GtkWidget *dialog;
- FILE *err;
- GdkColor color;
-
- if((err = fopen(filename_err, "r"))) {
-
- /* print the content of the file to a message box */
- while(fgets(buf, 1024, err))
- err_msg = g_strconcat(err_msg, buf, NULL);
-
- /* FIXME The dialog is not yet set to modal, difficult to
- * get the parent of the dialog box here
- */
-
- dialog = gtk_message_dialog_new(NULL,
- GTK_DIALOG_MODAL,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_OK,
- ("There was an error while scaning the file: %s \n%s"),
- gs->gs_filename, err_msg);
-
- gdk_color_parse("white", &color);
- gtk_widget_modify_bg(GTK_WIDGET(dialog), GTK_STATE_NORMAL, &color);
-
- g_signal_connect(G_OBJECT(dialog), "response",
- G_CALLBACK(gtk_widget_destroy), NULL);
-
- gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
- gtk_widget_show(dialog);
- g_free(err_msg);
- }
- }
-
- }
- else {
- /* report error */
- g_snprintf(buf, 1024,
- _("Error while converting pdf file %s:\n"), filename);
- ps_document_emit_error_msg(gs, buf);
-
- if(file_length(filename_err) > 0) {
- FILE *err;
- if((err = fopen(filename_err, "r"))) {
- /* print file to message window */
- while(fgets(buf, 1024, err))
- ps_document_emit_error_msg(gs, buf);
- }
- }
- unlink(filename_dsc);
- g_free(filename_dsc);
- filename = NULL;
- }
- unlink(filename_err);
- g_free(filename_err);
- g_free(cmdline);
- }
- if(NULL != file)
- fclose(file);
- return filename;
-}
-
#ifdef BROKEN_XINERAMA_PATCH_THAT_SHOULD_NOT_BE_USED
/* never mind this patch: a properly working X server should take care of
calculating the proper values. */
}
else {
filename = check_filecompressed(gs);
- if(filename)
- filename = check_pdf(gs);
}
if(!filename || (gs->gs_psfile = fopen(filename, "r")) == NULL) {
}
/* We have to set up the orientation of the document */
-
-
- /* orientation can only be portrait, and landscape or none.
- This is the document default. A document can have
- pages in landscape and some in portrait */
- if(gs->override_orientation) {
- /* If the orientation should be override...
- then gs->orientation has already the correct
- value (it was set when the widget was created */
- /* So do nothing */
-
- }
- else {
- /* Otherwise, set the proper orientation for the doc */
- gs->real_orientation = gs->doc->orientation;
- }
+ gs->real_orientation = gs->doc->orientation;
}
ps_document_set_page_size(gs, -1, gs->current_page);
gs->loaded = TRUE;
gs->current_page = page;
if(gs->doc->pages[page].orientation != NONE &&
- !gs->override_orientation &&
gs->doc->pages[page].orientation != gs->real_orientation) {
gs->real_orientation = gs->doc->pages[page].orientation;
gs->changed = TRUE;
if(new_pagesize == -1) {
if(gs->default_size > 0)
new_pagesize = gs->default_size;
- if(!gs->override_size && gs->doc) {
+ if(gs->doc) {
/* If we have a document:
We use -- the page size (if specified)
or the doc. size (if specified)
}
/* Compute bounding box */
- if(gs->doc && ((gs->doc->epsf && !gs->override_size) || new_pagesize == -1)) { /* epsf or bbox */
+ if(gs->doc && (gs->doc->epsf || new_pagesize == -1)) { /* epsf or bbox */
if((pageid >= 0) &&
(gs->doc->pages) &&
(gs->doc->pages[pageid].boundingbox[URX] >
if(new_pagesize < 0)
new_pagesize = gs->default_size;
new_llx = new_lly = 0;
- if(gs->doc && !gs->override_size && gs->doc->size &&
+ if(gs->doc && gs->doc->size &&
(new_pagesize < gs->doc->numsizes)) {
new_urx = gs->doc->size[new_pagesize].width;
new_ury = gs->doc->size[new_pagesize].height;