#include "ev-document-misc.h"
#include "ev-file-helpers.h"
#include "ev-document-fonts.h"
-#include "ev-selection.h"
#include "ev-async-renderer.h"
-#include "ev-file-exporter.h"
-#include "ev-window.h"
#include <glib/gstdio.h>
#include <unistd.h>
static void ev_job_print_init (EvJobPrint *job);
static void ev_job_print_class_init (EvJobPrintClass *class);
-enum
-{
+enum {
FINISHED,
LAST_SIGNAL
};
+enum {
+ PAGE_READY,
+ RENDER_LAST_SIGNAL
+};
+
static guint job_signals[LAST_SIGNAL] = { 0 };
+static guint job_render_signals[RENDER_LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (EvJob, ev_job, G_TYPE_OBJECT)
G_DEFINE_TYPE (EvJobLinks, ev_job_links, EV_TYPE_JOB)
oclass = G_OBJECT_CLASS (class);
+ job_render_signals [PAGE_READY] =
+ g_signal_new ("page-ready",
+ EV_TYPE_JOB_RENDER,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EvJobRenderClass, page_ready),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
oclass->dispose = ev_job_render_dispose;
}
gint width,
gint height,
EvRectangle *selection_points,
+ EvSelectionStyle selection_style,
GdkColor *text,
GdkColor *base,
gboolean include_forms,
job->rc = g_object_ref (rc);
job->target_width = width;
job->target_height = height;
+ job->selection_style = selection_style;
job->text = *text;
job->base = *base;
job->include_forms = include_forms;
/* FIXME: ps backend should be ported to cairo */
job->surface = ev_document_misc_surface_from_pixbuf (pixbuf);
+ job->page_ready = TRUE;
+ g_signal_emit (job, job_render_signals[PAGE_READY], 0);
EV_JOB (job)->finished = TRUE;
ev_job_finished (EV_JOB (job));
}
+static gboolean
+notify_page_ready (EvJobRender *job)
+{
+ g_signal_emit (job, job_render_signals[PAGE_READY], 0);
+
+ return FALSE;
+}
+
+static void
+ev_job_render_page_ready (EvJobRender *job)
+{
+ job->page_ready = TRUE;
+ g_idle_add_full (G_PRIORITY_HIGH_IDLE,
+ (GSourceFunc)notify_page_ready,
+ g_object_ref (job),
+ (GDestroyNotify)g_object_unref);
+}
+
void
ev_job_render_run (EvJobRender *job)
{
ev_document_fc_mutex_lock ();
job->surface = ev_document_render (EV_JOB (job)->document, job->rc);
-
- if (job->include_links && EV_IS_DOCUMENT_LINKS (EV_JOB (job)->document))
- job->link_mapping =
- ev_document_links_get_links (EV_DOCUMENT_LINKS (EV_JOB (job)->document),
- job->rc->page);
- if (job->include_images && EV_IS_DOCUMENT_IMAGES (EV_JOB (job)->document))
- job->image_mapping =
- ev_document_images_get_images (EV_DOCUMENT_IMAGES (EV_JOB (job)->document),
- job->rc->page);
- if (job->include_forms && EV_IS_DOCUMENT_FORMS (EV_JOB (job)->document))
- job->form_field_mapping =
- ev_document_forms_get_form_fields (EV_DOCUMENT_FORMS (EV_JOB(job)->document),
- job->rc->page);
- if (job->include_text && EV_IS_SELECTION (EV_JOB (job)->document))
- job->text_mapping =
- ev_selection_get_selection_map (EV_SELECTION (EV_JOB (job)->document),
- job->rc);
if (job->include_selection && EV_IS_SELECTION (EV_JOB (job)->document)) {
ev_selection_render_selection (EV_SELECTION (EV_JOB (job)->document),
job->rc,
&(job->selection),
&(job->selection_points),
NULL,
+ job->selection_style,
&(job->text), &(job->base));
job->selection_region =
ev_selection_get_selection_region (EV_SELECTION (EV_JOB (job)->document),
job->rc,
+ job->selection_style,
&(job->selection_points));
}
+
+ ev_job_render_page_ready (job);
ev_document_fc_mutex_unlock ();
+
+ if (job->include_text && EV_IS_SELECTION (EV_JOB (job)->document))
+ job->text_mapping =
+ ev_selection_get_selection_map (EV_SELECTION (EV_JOB (job)->document),
+ job->rc);
+ if (job->include_links && EV_IS_DOCUMENT_LINKS (EV_JOB (job)->document))
+ job->link_mapping =
+ ev_document_links_get_links (EV_DOCUMENT_LINKS (EV_JOB (job)->document),
+ job->rc->page);
+ if (job->include_forms && EV_IS_DOCUMENT_FORMS (EV_JOB (job)->document))
+ job->form_field_mapping =
+ ev_document_forms_get_form_fields (EV_DOCUMENT_FORMS (EV_JOB(job)->document),
+ job->rc->page);
+ if (job->include_images && EV_IS_DOCUMENT_IMAGES (EV_JOB (job)->document))
+ job->image_mapping =
+ ev_document_images_get_images (EV_DOCUMENT_IMAGES (EV_JOB (job)->document),
+ job->rc->page);
EV_JOB (job)->finished = TRUE;
}
const gchar *format,
gdouble width,
gdouble height,
+ EvFileExporterOrientation orientation,
EvPrintRange *ranges,
gint n_ranges,
EvPrintPageSet page_set,
+ gint pages_per_sheet,
gint copies,
gdouble collate,
gdouble reverse)
job->width = width;
job->height = height;
+ job->orientation = orientation;
job->ranges = ranges;
job->n_ranges = n_ranges;
job->page_set = page_set;
+
+ job->pages_per_sheet = pages_per_sheet;
job->copies = copies;
job->collate = collate;
fc.last_page = MAX (first_page, last_page);
fc.paper_width = job->width;
fc.paper_height = job->height;
+ fc.orientation = job->orientation;
fc.duplex = FALSE;
+ fc.pages_per_sheet = MAX (1, job->pages_per_sheet);
ev_document_doc_mutex_lock ();
ev_file_exporter_begin (EV_FILE_EXPORTER (document), &fc);