1 ;;;; output-gnome.scm -- implement GNOME canvas output
3 ;;;; source file of the GNU LilyPond music typesetter
5 ;;;; (c) 2004 Jan Nieuwenhuizen <janneke@gnu.org>
8 ;;; HIP -- hack in progress
11 ## install gnome-devel
13 ## use guile-1.6 for g-wrap/guile-gnome
17 tla register-archive http://people.debian.org/~rotty/arch/guile-gnome-devel@gnu.org/2004/4 || true
20 tla get a.rottmann@gmx.at--2004-main/g-wrap--tng gw-pristine
23 AUTOMAKE=automake-1.8 AUTOCONF=autoconf2.50 sh autogen.sh --noconfigure
26 ../configure --prefix=$HOME/usr/pkg/g-wrap
33 tla get a.rottmann@gmx.at--2004-main/guile-gnome-dists--dev gg-pristine
35 tla build-config -r configs/gnu.org/dev
37 AUTOMAKE=automake-1.8 AUTOCONF=autoconf2.50 sh autogen.sh --noconfigure
41 export GUILE_LOAD_PATH=$HOME/usr/pkg/g-wrap/share/guile/site:$GUILE_LOAD_PATH
42 export LD_LIBRARY_PATH=$HOME/usr/pkg/g-wrap/lib:$LD_LIBRARY_PATH
43 export PKG_CONFIG_PATH=$HOME/usr/pkg/g-wrap/lib/pkgconfig:$PKG_CONFIG_PATH
45 ../src/configure --prefix=$HOME/usr/pkg/guile-gnome
47 G_WRAP_MODULE_DIR=$HOME/usr/pkg/g-wrap/share/guile/site make install
49 (cd $HOME/usr/pkg/guile-gnome/share/guile/gnome && mv gtk/g[dt]k.scm gw)
51 export GUILE_LOAD_PATH=$HOME/usr/pkg/guile-gnome/share/guile:$GUILE_LOAD_PATH
52 export LD_LIBRARY_PATH=$HOME/usr/pkg/guile-gnome/lib:$LD_LIBRARY_PATH
53 guile -s ../src/gtk/examples/hello.scm
56 lilypond-bin -fgnome input/simple-song.ly
63 (debug-enable 'backtrace)
65 (define-module (scm output-gnome))
66 (define this-module (current-module))
74 ;;; Lily output interface --- fix silly names and docme
77 The output interface has functions for
78 * formatting stencils, and
94 The Bare minimum interface for \score { \notes c } } should
97 INTERFACE-output-expression
102 and should intercept:
105 (define (dummy . foo) #f)
107 ;; minimal intercept list:
108 (define output-interface-intercept
124 (map (lambda (x) (module-define! this-module x dummy))
125 output-interface-intercept)
127 (define-public (gnome-output-expression expr port)
128 (display (dispatch expr) port))
130 (define (dispatch expr)
131 (let ((keyword (car expr)))
133 ((eq? keyword 'some-func) "")
134 ;;((eq? keyword 'placebox) (dispatch (cadddr expr)))
136 (if (module-defined? this-module keyword)
137 (apply (eval keyword this-module) (cdr expr))
140 (string-append "undefined: " (symbol->string keyword) "\n"))
145 (define main-window #f)
146 (define the-canvas #f)
148 (define output-scale (* 2 2.83464566929134))
150 (define line-thickness 0.001)
153 (define (char font i)
156 (define (placebox x y expr)
159 ;; gnome_canvas_item_new (gnome_canvas_root (canvas),
160 ;; gnome_canvas_rect_get_type (),
161 ;; "x1", (double) x1,
162 ;; "y1", (double) y1,
163 ;; "x2", (double) x2,
164 ;; "y2", (double) y2,
165 ;; "fill_color", "black",
166 ;; "outline_color", "black",
167 ;; "width_units", 1.0,
170 (define (round-filled-box breapth width depth height blot-diameter)
171 (let* ((x . ,(number->string (* output-scale (- 0 breapth))))
172 (y . ,(number->string (* output-scale (- 0 height))))
173 (width . ,(number->string (* output-scale (+ breapth width))))
174 (height . ,(number->string (* output-scale (+ depth height))))
175 (ry . ,(number->string (/ blot-diameter 2)))
176 ;;(item (make <canvas-item>
177 ;; #:type 'GnomeCanvasLine
178 ;; #:points '(x y width height))
182 (define (fontify font expr)
188 (define (header . rest)
189 (let* ((window (make <gtk-window> #:type 'toplevel))
190 ;;(canvas (make <canvas>))
191 ;;(canvas (make <gnome-canvas>))
192 (button (make <gtk-button> #:label "Hello, World!")))
194 (gtk-container-set-border-width window 10)
195 (gtk-container-add window button)
197 (gtype-instance-signal-connect button 'clicked
198 (lambda (b) (gtk-main-quit)))
200 (gtk-widget-show-all window)
201 (set! main-window window)
202 ;;(set! the-canvas canvas))
205 (define (text . rest)
208 (define (filledbox a b c d)
209 (round-filled-box a b c d 0.001))
211 ;; WTF is this in every backend?
212 (define (horizontal-line x1 x2 th)
213 (filledbox (- x1) (- x2 x1) (* .5 th) (* .5 th)))