From 613055b55895fc513d7b9acca6593414c3f0e41e Mon Sep 17 00:00:00 2001 From: Derek Atkins Date: Mon, 19 May 2003 23:46:56 +0000 Subject: [PATCH] * src/gnome-utils/print-session.[ch]: added gnucash wrappers around gnome-print's rotate, translate, gsave, and grestore APIs. All to allow sideways printing (by rotating the image). * src/gnome-utils/gw-gnome-utils-spec.scm: wrap the new print-session apis. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@8343 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 6 +++++ src/gnome-utils/gw-gnome-utils-spec.scm | 32 +++++++++++++++++++++++++ src/gnome-utils/print-session.c | 23 ++++++++++++++++++ src/gnome-utils/print-session.h | 6 +++++ 4 files changed, 67 insertions(+) diff --git a/ChangeLog b/ChangeLog index 4910ea777a..0b966093f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,6 +25,12 @@ to actually include the Due Date of the invoice. * src/business/business-gnome/gw-business-gnome-spec.scm: change the int to a double on the bills-due api + + * src/gnome-utils/print-session.[ch]: added gnucash wrappers + around gnome-print's rotate, translate, gsave, and grestore + APIs. All to allow sideways printing (by rotating the image). + * src/gnome-utils/gw-gnome-utils-spec.scm: wrap the new print-session + apis. 2003-05-18 Derek Atkins diff --git a/src/gnome-utils/gw-gnome-utils-spec.scm b/src/gnome-utils/gw-gnome-utils-spec.scm index f8b678a246..89978e42b4 100644 --- a/src/gnome-utils/gw-gnome-utils-spec.scm +++ b/src/gnome-utils/gw-gnome-utils-spec.scm @@ -194,6 +194,38 @@ '(( p) (( caller-owned const) text)) "Show some text in Courier 16") + (gw:wrap-function + ws + 'gnc:print-session-rotate + ' + "gnc_print_session_rotate" + '(( p) ( theta_in_degrees)) + "Rotate the image by X degrees") + + (gw:wrap-function + ws + 'gnc:print-session-translate + ' + "gnc_print_session_translate" + '(( p) ( x) ( y)) + "Translate the image to point x,y") + + (gw:wrap-function + ws + 'gnc:print-session-gsave + ' + "gnc_print_session_gsave" + '(( p)) + "Save the current print-session state") + + (gw:wrap-function + ws + 'gnc:print-session-grestore + ' + "gnc_print_session_grestore" + '(( p)) + "Restore the current print-session state") + (gw:wrap-function ws 'gnc:print-session-done diff --git a/src/gnome-utils/print-session.c b/src/gnome-utils/print-session.c index ba296bbbe9..533c16051f 100644 --- a/src/gnome-utils/print-session.c +++ b/src/gnome-utils/print-session.c @@ -82,6 +82,29 @@ gnc_print_session_done(PrintSession * ps, gboolean hand_built_pages) { } +void +gnc_print_session_rotate(PrintSession *ps, double theta_in_degrees) +{ + gnome_print_rotate(GNOME_PRINT_CONTEXT(ps->meta), theta_in_degrees); +} + +void +gnc_print_session_translate(PrintSession *ps, double x, double y) +{ + gnome_print_translate(GNOME_PRINT_CONTEXT(ps->meta), x, y); +} + +void +gnc_print_session_gsave(PrintSession *ps) +{ + gnome_print_gsave(GNOME_PRINT_CONTEXT(ps->meta)); +} + +void +gnc_print_session_grestore(PrintSession *ps) +{ + gnome_print_grestore(GNOME_PRINT_CONTEXT(ps->meta)); +} void gnc_print_session_print(PrintSession * ps) { diff --git a/src/gnome-utils/print-session.h b/src/gnome-utils/print-session.h index dd9b65c370..f86597359a 100644 --- a/src/gnome-utils/print-session.h +++ b/src/gnome-utils/print-session.h @@ -87,6 +87,12 @@ void gnc_print_session_moveto(PrintSession * ps, double x, double y); void gnc_print_session_text(PrintSession * ps, const char * text); void gnc_print_session_done(PrintSession * ps, gboolean); +void gnc_print_session_rotate(PrintSession *ps, double theta_in_degrees); +void gnc_print_session_translate(PrintSession *ps, double x, double y); + +void gnc_print_session_gsave(PrintSession *ps); +void gnc_print_session_grestore(PrintSession *ps); + void gnc_print_session_preview(PrintSession * ps); void gnc_print_session_print(PrintSession * ps); void gnc_print_session_render(PrintSession * ps);