-(define (round-filled-box breapth width depth height blot-diameter)
- ;; FIXME: no rounded corners on rectangle...
- ;; FIXME: blot?
- (draw-rectangle (- breapth) depth width (- height) "black" blot-diameter))
-
-(define (pango-font-name font)
- (cond
- ((equal? (ly:font-name font) "GNU-LilyPond-feta-20")
- "lilypond-feta, regular 32")
- (else
- "ecrm12")))
- ;;(ly:font-name font))))
- ;;(ly:font-filename font))))
-
-(define (pango-font-size font)
- (let* ((designsize (ly:font-design-size font))
- (magnification (* (ly:font-magnification font)))
-
- ;; experimental sizing:
- ;; where does factor come from?
- ;;
- ;; 0.435 * (12 / 20) = 0.261
- ;; 2.8346456692913/ 0.261 = 10.86071137659501915708
- ;;(ops (* 0.435 (/ 12 20) (* output-scale pixels-per-unit)))
- ;; for size-points
- (ops 2.61)
-
- (scaling (* ops magnification designsize)))
- (stderr "OPS:~S\n" ops)
- (stderr "scaling:~S\n" scaling)
- (stderr "magnification:~S\n" magnification)
- (stderr "design:~S\n" designsize)
-
- scaling))
-
-;;font-name: "GNU-LilyPond-feta-20"
-;;font-filename: "feta20"
-;;pango-font-name: "lilypond-feta, regular 32"
-;;OPS:2.61
-;;scaling:29.7046771653543
-;;magnification:0.569055118110236
-;;design:20.0
-
-(define (text font string)
- (stderr "font-name: ~S\n" (ly:font-name font))
- ;; TODO s/filename/file-name/
- (stderr "font-filename: ~S\n" (ly:font-filename font))
-
- (stderr "pango-font-name: ~S\n" (pango-font-name font))
- (stderr "pango-font-size: ~S\n" (pango-font-size font))
- (let ((item
- (make <gnome-canvas-text>
- #:parent (root (canvas global-go))
-
- ;; experimental text placement corrections.
- ;; UGHR? What happened to tex offsets? south-west?
- ;; is pango doing something 'smart' wrt baseline ?
- #:anchor 'south-west
- #:x 0.003 #:y 0.123
-
- ;;
- ;;#:anchor 'west
- ;;#:x 0.015 #:y -3.71
-
- #:font (pango-font-name font)
-
- #:size-points (pango-font-size font)
- ;;#:size ...
- #:size-set #t
-
- ;;apparently no effect :-(
- ;;#:scale 1.0
- ;;#:scale-set #t
-
- #:fill-color "black"
- #:text string)))
- (set! (text-items global-go) (cons item (text-items global-go)))
- item))
-
-(define (filledbox a b c d)
- (round-filled-box a b c d 0.001))
-
-;; WTF is this in every backend?
-(define (horizontal-line x1 x2 thickness)
- ;;(let ((thickness 2))
- (filledbox (- x1) (- x2 x1) (* .5 thickness) (* .5 thickness)))
-
-;; origin -- bad name
-(define (define-origin file line col)
- ;; ughr, why is this not passed as [part of] stencil object
- (set! (location global-go) (if (procedure? point-and-click)
- ;; duh, only silly string append
- ;; (point-and-click line col file)
- (list line col file)
- #f)))
-
-
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;; gnome stuff --- move to framework-gnome
-;;(define (dump-page (go <gnome-outputter>) number)
-
-
-
-(define SCROLLBAR-SIZE 20)
-(define BUTTON-HEIGHT 25)
-(define PANELS-HEIGHT 80)
-
-(define PIXELS-PER-UNIT 2)
-(define OUTPUT-SCALE (* 2.5 PIXELS-PER-UNIT))
-
-;; helper functions -- sort this out
-(define (stderr string . rest)
- ;; debugging
- (if #t
- (begin
- (apply format (cons (current-error-port) (cons string rest)))
- (force-output (current-error-port)))))
-
-
-;; Hmm, actually, the only vars really needed by output-gnome are
-;; * (root (canvas go))
-;; * location
-;; * item-locations
-;; * pixels-per-unit
-;; * text-items
-;;
-;; so this class could be split in two parts / records?
-(define-class <gnome-outputter> ()
- (page-stencils ;;#:init-value '#()
- #:init-keyword #:page-stencils #:accessor page-stencils)
- (window #:init-value (make <gtk-window> #:type 'toplevel) #:accessor window)
- (scrolled #:init-value (make <gtk-scrolled-window>) #:accessor scrolled)
- (canvas #:init-value #f #:accessor canvas)
- (page-number #:init-value 0 #:accessor page-number)
- (pixels-per-unit #:init-value PIXELS-PER-UNIT #:accessor pixels-per-unit)
- (text-items #:init-value '() #:accessor text-items)
- (location #:init-value #:f #:accessor location)
- (item-locations #:init-value (make-hash-table 31) #:accessor item-locations)
- (window-width #:init-keyword #:window-width #:accessor window-width)
- (window-height #:init-keyword #:window-height #:accessor window-height)
- (canvas-width #:init-keyword #:canvas-width #:accessor canvas-width)
- (canvas-height #:init-keyword #:canvas-height #:accessor canvas-height))
-
-;;(define-method (initialize (go <gnome-outputter>))
-;; )
-
-
-(define (gnome-main book)
- (let* ((book-paper (ly:paper-book-book-paper book))
- (hsize (ly:output-def-lookup book-paper 'hsize))
- (vsize (ly:output-def-lookup book-paper 'vsize))
- (page-width (inexact->exact (ceiling (* OUTPUT-SCALE hsize))))
- (page-height (inexact->exact (ceiling (* OUTPUT-SCALE vsize))))
- ;;(page-width (inexact->exact (ceiling hsize)))
- ;;(page-height (inexact->exact (ceiling vsize)))
-
- (screen-width (gdk-screen-width))
- (screen-height (gdk-screen-height))
- (desktop-height (- screen-height PANELS-HEIGHT))
-
- (go (make <gnome-outputter>
- #:page-stencils (list->vector (ly:paper-book-pages book))
- #:canvas-width page-width
- #:canvas-height page-height
- #:window-width
- ;; huh, *2 -- pixels-per-unit?
- (min (+ SCROLLBAR-SIZE (* page-width 2)) screen-width)
- #:window-height
- (min (+ BUTTON-HEIGHT SCROLLBAR-SIZE (* page-height 2))
- desktop-height))))
-
- (setup go)
- (dump-page go 0)
- (gtk-main)))
-
-(define (setup go)
- (let* ((button (make <gtk-button> #:label "Exit"))
- (next (make <gtk-button> #:label "Next"))
- (prev (make <gtk-button> #:label "Previous"))
- (vbox (make <gtk-vbox> #:homogeneous #f))
- (hbox (make <gtk-hbox> #:homogeneous #f)))
-
- (set-size-request (window go) (window-width go) (window-height go))
-
- (new-canvas go)
-
- (add (window go) vbox)
- (add vbox (scrolled go))