-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path23_translation_simple.scm
executable file
·79 lines (56 loc) · 1.99 KB
/
23_translation_simple.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/guile -s
!#
;;Руссификация вывода для кодировки utf-8
(define stdout (current-output-port))
(set-port-encoding! stdout "utf-8")
;;если cairo грузить после gnome-2 грузиться не тот cairo!!!! и программа не работает!
(use-modules ((cairo) #:prefix CAI:))
(use-modules (srfi srfi-1))
(use-modules (gnome-2))
(use-modules (oop goops)
(gnome gtk)
(gnome gw gdk)
(gnome gobject)
)
(define pi (* 2 (acos 0)))
(define (do-draw cr widget)
;;(display "Drawing with cairo\n")
(CAI:cairo-set-source-rgb cr 0.2 0.3 0.8)
(CAI:cairo-rectangle cr 10 10 30 30)
(CAI:cairo-fill cr)
(CAI:cairo-translate cr 20 20)
(CAI:cairo-set-source-rgb cr 0.8 0.3 0.2)
(CAI:cairo-rectangle cr 0 0 30 30)
(CAI:cairo-fill cr)
(CAI:cairo-translate cr 30 30)
(CAI:cairo-set-source-rgb cr 0.8 0.8 0.2)
(CAI:cairo-rectangle cr 0 0 30 30)
(CAI:cairo-fill cr)
(CAI:cairo-translate cr 40 40)
(CAI:cairo-set-source-rgb cr 0.3 0.8 0.8)
(CAI:cairo-rectangle cr 0 0 30 30)
(CAI:cairo-fill cr)
)
(define (event-draw w event)
(let ([cr (gdk-cairo-create (gobject:get-property w 'window))])
(do-draw cr w)
(CAI:cairo-destroy cr))
#f)
(define (event-destroy window)
(display "Destroy window.\n")
(gtk-main-quit)
#f)
(define (main args)
(let* ([window (make <gtk-window> #:type 'toplevel)]
[da (gtk-drawing-area-new)])
(gtk-container-add window da)
(connect window 'destroy event-destroy)
(connect da 'event event-draw)
(gtk-window-set-position window 'center)
(gtk-window-set-default-size window 300 200)
(gtk-window-set-title window "Translation")
;;(gtk-widget-set-app-paintable window #t)
(show-all window)
(gtk-main)
(display "Done!\n")))
(main (command-line))