From 718b6113285ae4d2ff3aa77a84aa384f063c1388 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 27 Feb 2005 15:59:40 +0000 Subject: [PATCH] * ps/music-drawing-routines.ps (mark_file_line): Switch Action based on pdf-viewer setting. * scm/framework-ps.scm (write-preamble): Find and set preferred pdf-viewer. --- ChangeLog | 8 ++++++++ ps/music-drawing-routines.ps | 29 ++++++++++++++++++----------- scm/framework-ps.scm | 12 +++++++++++- 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 82b9b511e6..bda00eb12b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-02-27 Jan Nieuwenhuizen + + * ps/music-drawing-routines.ps (mark_file_line): Switch Action + based on pdf-viewer setting. + + * scm/framework-ps.scm (write-preamble): Find and set preferred + pdf-viewer. + 2005-02-27 Han-Wen Nienhuys * scripts/lilypond-pdfpc-helper.py: new file. Invoke different diff --git a/ps/music-drawing-routines.ps b/ps/music-drawing-routines.ps index d15141a199..0c5c3ce9b7 100644 --- a/ps/music-drawing-routines.ps +++ b/ps/music-drawing-routines.ps @@ -19,23 +19,30 @@ /Rect [ llx lly urx ury ] /Border [ 0 0 0 0 ] - %% following for xpdf -% /Action /Launch -% /File command - - %% following for acroread - /Action << - /Subtype /URI - /URI command - >> - + pdf-viewer (acroread) eq + { + /Action + << + /Subtype /URI + /URI command + >> + } + { + % xpdf. FIXME: gpdf, kpdf etc? + /Action + << + /Launch + /File command + >> + } ifelse /Subtype /Link /ANN pdfmark } bind def -/set_tex_dimen { +/set_tex_dimen +{ cvr def } bind def diff --git a/scm/framework-ps.scm b/scm/framework-ps.scm index b6d06bb479..620042278d 100644 --- a/scm/framework-ps.scm +++ b/scm/framework-ps.scm @@ -241,8 +241,18 @@ "")))) (filter string? font-names)))) pfas)) - + ;; FIXME: user preference, somehow? + (define (pdf-viewer) + (define (find-alternative path lst) + (let ((command (search-path path (car lst)))) + (if (or command (null? lst)) command + (find-alternative path (cdr lst))))) + (let ((path (parse-path (getenv "PATH"))) + (pdf-viewers '("acroread" "gpdf" "kpdf" "xpdf" "gv" "echo"))) + (find-alternative path pdf-viewers))) + + (format port "/pdf-viewer (~a) def\n" (basename (pdf-viewer))) (display (procset "music-drawing-routines.ps") port) (display (procset "lilyponddefs.ps") port) (if load-fonts? -- 2.39.2