mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
/tmp/cvstVO9bC
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/branches/gnucash-gnome2-dev@9214 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -26,7 +26,11 @@
|
||||
|
||||
#include <gnome.h>
|
||||
#include <libgnomeprint/gnome-font.h>
|
||||
#if GNOME_PRINT_VER == 2
|
||||
#include <libgnomeprintui/gnome-print-job-preview.h>
|
||||
#else
|
||||
#include <libgnomeprintui/gnome-print-master-preview.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
||||
#include "gnc-ui.h"
|
||||
@@ -36,13 +40,19 @@
|
||||
|
||||
|
||||
PrintSession *
|
||||
gnc_print_session_create(gboolean hand_built_pages) {
|
||||
gnc_print_session_create(gboolean hand_built_pages)
|
||||
{
|
||||
PrintSession * ps = g_new0(PrintSession, 1);
|
||||
GnomePrintConfig *config;
|
||||
|
||||
/* this is about the most basic we can get */
|
||||
#if GNOME_PRINT_VER==2
|
||||
ps->master = gnome_print_job_new(NULL);
|
||||
config = gnome_print_job_get_config(ps->master);
|
||||
#else
|
||||
ps->master = gnome_print_master_new();
|
||||
config = gnome_print_master_get_config(ps->master);
|
||||
#endif
|
||||
ps->meta = gnome_print_context_new(config);
|
||||
ps->default_font = gnome_font_find("Courier", 12);
|
||||
|
||||
@@ -57,7 +67,8 @@ gnc_print_session_create(gboolean hand_built_pages) {
|
||||
}
|
||||
|
||||
void
|
||||
gnc_print_session_destroy(PrintSession * ps) {
|
||||
gnc_print_session_destroy(PrintSession * ps)
|
||||
{
|
||||
g_object_unref(ps->meta);
|
||||
g_object_unref(ps->master);
|
||||
g_object_unref(ps->default_font);
|
||||
@@ -66,19 +77,22 @@ gnc_print_session_destroy(PrintSession * ps) {
|
||||
}
|
||||
|
||||
void
|
||||
gnc_print_session_moveto(PrintSession * ps, double x, double y) {
|
||||
gnc_print_session_moveto(PrintSession * ps, double x, double y)
|
||||
{
|
||||
gnome_print_moveto(GNOME_PRINT_CONTEXT(ps->meta), x, y);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gnc_print_session_text(PrintSession * ps, const char * text) {
|
||||
gnc_print_session_text(PrintSession * ps, const char * text)
|
||||
{
|
||||
gnome_print_show(GNOME_PRINT_CONTEXT(ps->meta), text);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gnc_print_session_done(PrintSession * ps, gboolean hand_built_pages) {
|
||||
gnc_print_session_done(PrintSession * ps, gboolean hand_built_pages)
|
||||
{
|
||||
if (hand_built_pages) {
|
||||
gnome_print_showpage(GNOME_PRINT_CONTEXT(ps->meta));
|
||||
}
|
||||
@@ -111,9 +125,15 @@ gnc_print_session_grestore(PrintSession *ps)
|
||||
}
|
||||
|
||||
void
|
||||
gnc_print_session_print(PrintSession * ps) {
|
||||
gnc_print_session_print(PrintSession * ps)
|
||||
{
|
||||
#if GNOME_PRINT_VER==2
|
||||
GtkWidget * dialog =
|
||||
gnome_print_dialog_new(ps->master,_("Print GnuCash Document"), 0);
|
||||
#else
|
||||
GtkWidget * dialog =
|
||||
gnome_print_dialog_new(_("Print GnuCash Document"), 0);
|
||||
#endif
|
||||
int button = gnome_dialog_run(GNOME_DIALOG(dialog));
|
||||
GnomePrintConfig *config;
|
||||
|
||||
@@ -125,7 +145,11 @@ gnc_print_session_print(PrintSession * ps) {
|
||||
ps->master = NULL;
|
||||
}
|
||||
config = gnome_print_dialog_get_config (GNOME_PRINT_DIALOG (dialog));
|
||||
ps->master = gnome_print_master_new_from_config (config);
|
||||
#if GNOME_PRINT_VER==2
|
||||
ps->master = gnome_print_job_new(config);
|
||||
#else
|
||||
ps->master = gnome_print_master_new_from_config(config);
|
||||
#endif
|
||||
gnome_dialog_close(GNOME_DIALOG(dialog));
|
||||
gnc_print_session_render(ps);
|
||||
break;
|
||||
@@ -136,7 +160,11 @@ gnc_print_session_print(PrintSession * ps) {
|
||||
ps->master = NULL;
|
||||
}
|
||||
config = gnome_print_dialog_get_config (GNOME_PRINT_DIALOG (dialog));
|
||||
ps->master = gnome_print_master_new_from_config (config);
|
||||
#if GNOME_PRINT_VER==2
|
||||
ps->master = gnome_print_job_new(config);
|
||||
#else
|
||||
ps->master = gnome_print_master_new_from_config(config);
|
||||
#endif
|
||||
gnome_dialog_close(GNOME_DIALOG(dialog));
|
||||
gnc_print_session_preview(ps);
|
||||
break;
|
||||
@@ -149,18 +177,31 @@ gnc_print_session_print(PrintSession * ps) {
|
||||
|
||||
|
||||
void
|
||||
gnc_print_session_render(PrintSession * ps) {
|
||||
gnc_print_session_render(PrintSession * ps)
|
||||
{
|
||||
#if GNOME_PRINT_VER==2
|
||||
gnome_print_job_render (ps->master, ps->meta);
|
||||
gnome_print_job_close (ps->master);
|
||||
gnome_print_job_print(ps->master);
|
||||
#else
|
||||
gnome_print_master_render (ps->master, ps->meta);
|
||||
gnome_print_master_close (ps->master);
|
||||
gnome_print_master_print(ps->master);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
gnc_print_session_preview(PrintSession * ps) {
|
||||
gnc_print_session_preview(PrintSession * ps)
|
||||
{
|
||||
GtkWidget * preview;
|
||||
|
||||
#if GNOME_PRINT_VER==2
|
||||
gnome_print_job_render (ps->master, ps->meta);
|
||||
gnome_print_job_close (ps->master);
|
||||
preview = gnome_print_job_preview_new(ps->master, _("Print Preview"));
|
||||
#else
|
||||
gnome_print_master_render (ps->master, ps->meta);
|
||||
gnome_print_master_close (ps->master);
|
||||
preview = gnome_print_master_preview_new(ps->master, _("Print Preview"));
|
||||
#endif
|
||||
gtk_widget_show_all(preview);
|
||||
}
|
||||
|
||||
@@ -28,13 +28,22 @@
|
||||
|
||||
#include <gnome.h>
|
||||
#include <libgnomeprint/gnome-print.h>
|
||||
|
||||
#if GNOME_PRINT_VER==2
|
||||
#include <libgnomeprint/gnome-print-job.h>
|
||||
#else
|
||||
#include <libgnomeprint/gnome-print-master.h>
|
||||
#endif
|
||||
|
||||
#include <libgnomeprintui/gnome-print-dialog.h>
|
||||
#include <libgnomeprintui/gnome-print-preview.h>
|
||||
|
||||
typedef struct {
|
||||
#if GNOME_PRINT_VER==2
|
||||
GnomePrintJob * master;
|
||||
#else
|
||||
GnomePrintMaster * master;
|
||||
#endif
|
||||
GnomePrintContext * meta;
|
||||
GnomeFont * default_font;
|
||||
GnomePrintPaper * paper;
|
||||
|
||||
Reference in New Issue
Block a user