]> git.donarmstrong.com Git - lilypond.git/blob - scm/output-socket.scm
Remove obsolete backend code
[lilypond.git] / scm / output-socket.scm
1
2 (define-module (scm output-socket)
3   #:re-export (quote)
4   )
5
6 (use-modules (guile)
7              (srfi srfi-1)
8              (srfi srfi-13)
9              (lily))
10
11
12 (define-public (draw-line thick x1 y1 x2 y2)
13   (format "drawline ~a ~a ~a ~a ~a"
14           thick x1 y2 x2 y2))
15
16 (define-public (polygon xy-coords blot do-fill)
17   (format "polygon ~a ~a ~a"
18           blot
19           (if do-fill "True" "False")
20           (string-join
21            (map number->string xy-coords))
22   ))
23
24 (define-public (named-glyph font glyph)
25   (format "glyphshow ~a \"~a\" ~a \"~a\""
26           (ly:font-glyph-name-to-charcode font glyph)
27           (ly:font-name font)
28           (modified-font-metric-font-scaling font)
29           glyph
30           ))
31
32 (define-public (placebox x y s) 
33   (format "at ~a ~a ~a\n" x y s))
34
35 (define-public (round-filled-box  breapth width depth height blot-diameter)
36   (format "draw_round_box ~a ~a ~a ~a ~a"
37           breapth width depth height blot-diameter
38           ))
39
40 (define (event-cause grob)
41   (let*
42       ((cause (ly:grob-property  grob 'cause)))
43
44     (cond
45      ((ly:stream-event? cause) cause)
46      (else
47       #f))))
48
49 (define (grob-bbox grob offset)
50   (let*
51       ((x-ext (ly:grob-extent grob grob X))
52        (y-ext (ly:grob-extent grob grob Y))
53        (x (car offset))
54        (y (cdr offset)))
55
56     (if (interval-empty? x-ext)
57         (set! x-ext '(0 . 0)))
58
59     (if (interval-empty? y-ext)
60         (set! y-ext '(0 . 0)))
61     
62     (list (+ x (car x-ext))
63           (+ y (car y-ext))
64           (+ x (cdr x-ext))
65           (+ y (cdr y-ext))
66           )))
67
68 (define-public (no-origin)
69   "nocause\n")
70
71 (define-public (grob-cause offset grob)
72   (let*
73       ((cause (event-cause grob))
74        (tag (if (and cause (integer? (ly:event-property cause 'input-tag)))
75                 (ly:event-property cause 'input-tag)
76                 -1))
77        (name (cdr (assoc 'name (ly:grob-property grob 'meta))))
78        )
79     
80     (apply format
81            (append (list "cause ~a \"~a\" ~a ~a ~a ~a\n"
82                          tag name)
83            
84                    (grob-bbox grob offset))
85           )))
86
87
88 (define (escape-string str)
89   (string-regexp-substitute
90    " " "\\040" 
91    (string-regexp-substitute "\"" "\\\"" str)))
92   
93 (define-public (utf-8-string
94                 descr
95                 string)
96   
97   (format "utf-8 \"~a\" \"~a\""
98           (escape-string descr)
99
100           ;; don't want unescaped spaces.
101           (escape-string string)
102           ))
103
104
105 (define (bezier-sandwich lst thick)
106   (format
107    #f
108    "bezier_sandwich ~a [~a]"
109    thick
110    (string-append 
111     (string-join (map (lambda (x) (format "(~a,~a)" (car x) (cdr x)))
112                       lst) ","))))