From 9fa09dca79ef41ff3e713203b6abde1d32b45723 Mon Sep 17 00:00:00 2001 From: Ludovic Court`es Date: Mon, 23 Oct 2006 17:22:10 +0000 Subject: Lout engine: Implemented `slide-embed'. * src/guile/skribilo/engine/lout.scm (lout-definitions): Renamed `@SkribeMark' to `@SkribiloMark'. Added `@SkribiloEmbed'. * src/guile/skribilo/package/slide/lout.scm: No longer use `define-skribe-module'. (slide-embed): Use `@SkribiloEmbed' (works fine). git-archimport-id: lcourtes@laas.fr--2005-libre/skribilo--devo--1.2--patch-67 --- src/guile/skribilo/engine/lout.scm | 32 ++++++++++++++++--- src/guile/skribilo/package/slide/lout.scm | 53 ++++++++++++++++++------------- 2 files changed, 58 insertions(+), 27 deletions(-) (limited to 'src/guile') diff --git a/src/guile/skribilo/engine/lout.scm b/src/guile/skribilo/engine/lout.scm index 82e98d7..d40f36a 100644 --- a/src/guile/skribilo/engine/lout.scm +++ b/src/guile/skribilo/engine/lout.scm @@ -378,9 +378,9 @@ (let ((leader (engine-custom engine 'toc-leader)) (leader-space (engine-custom engine 'toc-leader-space))) (apply string-append - `("# @SkribeMark implements Skribe's marks " + `("# @SkribiloMark implements Skribe's marks " "(i.e. cross-references)\n" - "def @SkribeMark\n" + "def @SkribiloMark\n" " right @Tag\n" "{\n" " @PageMark @Tag\n" @@ -389,7 +389,29 @@ "# @SkribiloLeaders is used in `toc'\n" "# (this is mostly copied from the expert's guide)\n" "def @SkribiloLeaders { " - ,leader " |" ,leader-space " @SkribiloLeaders }\n\n")))) + ,leader " |" ,leader-space " @SkribiloLeaders }\n\n" + + "# Embedding an application in PDF (``Launch'' actions)\n" + "# (tested with XPdf 3.1 and Evince 0.4.0)\n" + "def @SkribiloEmbed\n" + " left command\n" + " import @PSLengths\n" + " named borderwidth { 1p }\n" + " right body\n" + "{\n" + " {\n" + " \"[ /Rect [0 0 xsize ysize]\"\n" + " \" /Color [0 0 1]\"\n" + " \" /Border [ 0 0 \" borderwidth \" ]\"\n" + " \" /Action /Launch\"\n" + " \" /File (\" command \")\"\n" + " \" /Subtype /Link\"\n" + " \"/ANN\"\n" + " \"pdfmark\"\n" + " }\n" + " @Graphic body\n" + "}\n\n")))) + (define (lout-make-doc-cover-sheet doc engine) ;; Create a cover sheet for node `doc' which is a doc-style Lout document. @@ -1319,7 +1341,7 @@ ;; Lout markup) (display "\n//1.8vx\n@B { ") (output title e) - (display " }\n@SkribeMark { ") + (display " }\n@SkribiloMark { ") (display (lout-tagify ident)) (display " }\n//0.8vx\n\n")) (begin @@ -2382,7 +2404,7 @@ :action (lambda (n e) (if (markup-ident n) (begin - (display "{ @SkribeMark { ") + (display "{ @SkribiloMark { ") (display (lout-tagify (markup-ident n))) (display " } }")) (skribe-error 'lout "mark: Node has no identifier" n)))) diff --git a/src/guile/skribilo/package/slide/lout.scm b/src/guile/skribilo/package/slide/lout.scm index d53cff1..f3c9a61 100644 --- a/src/guile/skribilo/package/slide/lout.scm +++ b/src/guile/skribilo/package/slide/lout.scm @@ -18,9 +18,17 @@ ;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, ;;; USA. -(define-skribe-module (skribilo package slide lout) +(define-module (skribilo package slide lout) :use-module (skribilo utils syntax) + :autoload (skribilo utils strings) (make-string-replace) + :use-module (skribilo engine) + :use-module (skribilo writer) + :autoload (skribilo output) (output) + :use-module (skribilo ast) + + :use-module (srfi srfi-13) ;; `string-join' + ;; XXX: If changing the following `autoload' to `use-module' doesn't work, ;; then you need to fix your Guile. See this thread about ;; `make-autoload-interface': @@ -34,6 +42,7 @@ (fluid-set! current-reader %skribilo-module-reader) + ;;; TODO: ;;; ;;; Make some more PS/PDF trickery. @@ -83,7 +92,7 @@ (and (pair? (markup-body n)) (number? (car (markup-body n))))) :action (lambda (n e) - (printf "\n//~a~a # slide-vspace\n" + (format #t "\n//~a~a # slide-vspace\n" (car (markup-body n)) (case (markup-option n :unit) ((cm) "c") @@ -94,6 +103,25 @@ "Unknown vspace unit" (markup-option n :unit))))))) + (markup-writer 'slide-embed le + :options '(:command :arguments :alt :geometry :geometry-opt) + :action (lambda (n e) + (let ((command (markup-option n :command)) + (args (markup-option n :arguments)) + (alt (markup-option n :alt)) + (geometry (markup-option n :geometry)) + (geometry-opt (markup-option n :geometry-opt)) + (filter (make-string-replace lout-verbatim-encoding))) + (format #t "~%\"~a\" @SkribiloEmbed { " + (string-append command " " + (if (and geometry-opt geometry) + (string-append geometry-opt " " + geometry " ") + "") + (string-join args " "))) + (output alt e) + (format #t " }\n")))) + (markup-writer 'slide-pause le ;; FIXME: Use a `pdfmark' custom action and a PDF transition action. ;; << /Type /Action @@ -109,26 +137,7 @@ ;; For movies, see ;; http://www.tug.org/tex-archive/macros/latex/contrib/movie15/movie15.sty . - (markup-writer 'slide-embed le - :options '(:alt :geometry :rgeometry :geometry-opt :command) - ;; FIXME: `pdfmark'. - ;; << /Type /Action /S /Launch - :action (lambda (n e) - (let ((command (markup-option n :command)) - (filter (make-string-replace lout-verbatim-encoding)) - (pdfmark "[ /Rect [ 0 ysize xsize 0 ] -/Name /Comment -/Contents (This is an embedded application) -/ANN pdfmark - -[ /Type /Action -/S /Launch -/F (~a) -/OBJ pdfmark")) - (display (string-append - "4c @Wide 3c @High " - (lout-embedded-postscript-code - (filter (format #f pdfmark command))))))))) + ) -- cgit v1.2.3