|
|
1.1 root 1: % from Lucasfilm Ltd.
2:
3: slidedemo = proc ()
4: nbounce = 33
5: bwidth: int := int$parse(xdemo_default("slide", "BorderWidth"))
6: except when not_found, overflow, bad_format: bwidth := 2 end
7: back: x_pixmap := x_display$white()
8: bdr: x_pixmap := x_display$black()
9: plane: int := 1
10: if x_display$cells() > 2
11: then begin
12: r, g, b: int := x_parse_color(xdemo_default("slide", "Border"))
13: bdr := x_pixmap$tile(x_display$alloc_color(r, g, b))
14: end except when not_found: end
15: cback: string := xdemo_default("slide", "Background")
16: except when not_found: cback := "" end
17: cfore: string := xdemo_default("slide", "Foreground")
18: except when not_found: cfore := "" end
19: if string$empty(cback) cand string$empty(cfore)
20: then exit done end
21: pixs: pixellist
22: pixs, plane := x_display$alloc_cells(1, 1, false)
23: back := x_pixmap$tile(pixs[1])
24: r, g, b: int
25: if string$empty(cback)
26: then r, g, b := x_display$query_color(WhitePixel)
27: else r, g, b := x_parse_color(cback)
28: end
29: x_display$store_color(pixs[1], r, g, b)
30: if string$empty(cfore)
31: then r, g, b := x_display$query_color(BlackPixel)
32: else r, g, b := x_parse_color(cfore)
33: end
34: x_display$store_color(pixs[1] + plane, r, g, b)
35: end except when done: end
36: w: x_window, wid0, hgt0: int := x_cons("slide", back, bdr,
37: xdemo_geometry(), "=405x305+1+1",
38: 40, 40, bwidth)
39: w.name := "slide"
40: w.input := UnmapWindow
41: x_window$map(w)
42: w.input := ExposeWindow + UnmapWindow
43: ev: event := x_input$empty_event()
44: nobit: x_bitmap := x_bitmap$none()
45: while true do
46: x_window$clear(w)
47: sx, sy, width, height, bw, ms, wk: int, iw: x_window := x_window$query(w)
48: width := width - nbounce
49: height := height - nbounce
50: if width <= 0 cor height <= 0
51: then x_window$destroy(w)
52: return
53: end
54: x: int := 0
55: y: int := 0
56: xinc: int := 1
57: yinc: int := 1
58: count: int := 0
59: while count ~= 0 cor ~x_input$pending() do
60: if count = 10
61: then count := 0
62: else count := count + 1
63: end
64: x_window$pix_fill(w, 0, nobit, x, y, nbounce, nbounce,
65: GXinvert, plane)
66: x := x + xinc
67: if x = width cor x = 0
68: then xinc := -xinc end
69: y := y + yinc
70: if y = height cor y = 0
71: then yinc := -yinc end
72: end
73: x_input$deq(ev)
74: if ev.kind = UnmapWindow
75: then x_input$deq(ev) end
76: end
77: end slidedemo
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.