Random Bits of Open Code

Check-in [01ff80395e]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Couple tweaks to not-yet-finished help view.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:01ff80395e26c10dd8689513c335c90698ec8476
User & Date: mrwellan 2018-08-03 00:01:02
Context
2018-08-03
06:10
Added help to first tab check-in: 3b13ca7aa9 user: matt tags: trunk
00:01
Couple tweaks to not-yet-finished help view. check-in: 01ff80395e user: mrwellan tags: trunk
2018-08-02
00:39
Dunno check-in: 237f2b7191 user: mrwellan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to multiapp/src/learn-teach-help.scm.

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
79
80
81
82
83



84
85
86
87
88
89
90
91
92
93
94

95
96

97
98
99


100








101
102
103
104
105
106
107

108










109


110




111
112
113
114
115
116
117
118
119
120
 ;; (trace 
 ;;  ;; vg:draw-rect
 ;;  ;; vg:grow-rect
 ;;  vg:get-extents-for-objs
 ;;  vg:components-get-extents
 ;;  vg:instances-get-extents
 ;;  vg:get-extents-for-two-rects
 ;;  canvas-line!)


;; make a big arrow outline (will add fill later
;;  l = length base to tip
;;  t = base thickness. tip is 1.5t long and 1.5t wide
;;  a = angle from vertical
;;  returns a list of points `( x0 y0 x1 y1 x2 y2 ... xn yn )
;;
(define (big-arrow l t angle)
  (let* ((t/2    (/ t 2))
	 (t/4    (/ t 4))
	 (hl     (* 1.5 t))       ;; arrow head length
	 (l-h    (- l hl))        ;; length of arrow body
	 (a      `(,(- t/2) 0))
	 (b      `(,(- t/2) ,l-h))
	 (c      `(,(- 0 t/2 t/4) ,l-h))
	 (d      `(0  ,l))
	 (e      `(,(+ t/2 t/4) ,l-h))
	 (f      `(,t/2 ,l-h))
	 (g      `(,t/2 0))
	 (all    (map (lambda (pt)
			(print "pt: " pt " (car pt): " (car pt) " (cadr pt): " (cadr pt))
			(geolib:rotate-pt angle (car pt)(cadr pt)))
		      (list a b c d e f g)))





	 (flat   (apply append all)))
    flat))

(define c1 #f)
(define
  cnv
  (let* ((help-drawing (make-drawing))
	 (hlib         (make-lib))
	 ;; components
	 (title        (make-comp))    ;; title block
	 (subjects     (make-comp))    ;; subjects tree
	 (active       (make-comp))   ;; most active sessions
	 (active       (make-comp))    ;; most active sessions
	 (arrow        (make-comp)))
    (add-lib help-drawing "hlib" hlib) ;; add library hlib to drawing
    ;; build up the title
    (add-objs-to-comp title ;; (rectangle 0 0 158 18 text: "Learn Something!" font: "Helvetica, -40"))








		      (text 0 0 "Learn Something!" font: "Helvetica, -40"))






























    (add-comp-to-lib hlib "title" title) ;; add component help-learn to library help-lib


    ;; add objects to subjects tree sketch

    (let* ((idelta 10)
	   (x1 10)
	   (y1 190)          ;; top line
	   (x2 (+ x1 5))
	   (y2 (- y1 10))    ;; second line
	   (x3 (+ x1 20))
	   (y3 150)          ;; bottom of drawing ...
	   (x4 (+ x3 5))
	   (x5 (+ x3 20))
	   (y4 (- y2 5))     ;; 175)
	   (y5 150)
	   (y6 (- y4 5))
	   (x6 (+ x5 5))
	   (font "Helvetica, -20"))
      (add-objs-to-comp
       subjects



       ;; this is the subject selection stuff
       (rectangle 0 140 90 200) ;; bounding box
       (line x1 y1 x2 y1)      ;; first h-line
       (text (+ x2 2)(- y1 2) "category" font: font)
       (line x3 (- y1 3 ) x3 y3)
       (line x3 y2 x4 y2)
       (text (+ x4 2)(- y2 2) "subject" font: font)
       (line x5 y4 x5 y5)      ;; vertical line
       (line x5 y6 x6 y6)
       (rectangle (- x6 2)(- y6 3)(+ x6 30)(+ y6 6)
		  fill-color: (rgb->number 0 250 0))

       (text (+ x6 2) (- y6 2) "time" font: font)
       (text 0 (- y6 55) "Select a \"session\", a" font: font)

       (text 0 (- y6 65) "combination of subject" font: font)
       (text 0 (- y6 75) "and time." font: font)
       ;; this is the vote box


       (rectangle 90 180 140 140)








       )
      (add-comp-to-lib hlib "subj" subjects)
      (add-objs-to-comp
       arrow
       (polygon (big-arrow 35 8 (geolib:deg->rad 0))))
      (add-comp-to-lib hlib "arrow1" arrow)
      (instantiate help-drawing "hlib" "arrow1" "a1" (+ x6 40)(- y6 34))

      










      )


    




    
    (instantiate help-drawing "hlib" "title" "t1" 20 220)  ;; instantiate component title from library hlib in drawing help-drawing
    (instantiate help-drawing "hlib" "subj"  "s1" 20 10) ;; instantiate component subj  from library hlib in drawing help-drawing
    (drawing-scalex-set! help-drawing 1.5)
    (drawing-scaley-set! help-drawing 1.5)
    
    (drawing-update-proc-set!
     help-drawing
     (lambda (dwg c xadj yadj)
       (set! c1 c)







|
>







|












|


>
>
>
>
>
|


<
|
<
<
<
<
|
|
|
|
|
|
|
|
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>

<
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
>
>
>
|
|
|
|
|
|
|
|
|
|
|
>
|
<
>
|
|
|
>
>
|
>
>
>
>
>
>
>
>
|
<
<
<
<
|
<
>
|
>
>
>
>
>
>
>
>
>
>
|
>
>
|
>
>
>
>

<
<







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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106

107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122

123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138

139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154




155

156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176


177
178
179
180
181
182
183
 ;; (trace 
 ;;  ;; vg:draw-rect
 ;;  ;; vg:grow-rect
 ;;  vg:get-extents-for-objs
 ;;  vg:components-get-extents
 ;;  vg:instances-get-extents
 ;;  vg:get-extents-for-two-rects
;;  canvas-line!)


;; make a big arrow outline (will add fill later
;;  l = length base to tip
;;  t = base thickness. tip is 1.5t long and 1.5t wide
;;  a = angle from vertical
;;  returns a list of points `( x0 y0 x1 y1 x2 y2 ... xn yn )
;;
(define (big-arrow l t angle #!key (xoff 0)(yoff 0))
  (let* ((t/2    (/ t 2))
	 (t/4    (/ t 4))
	 (hl     (* 1.5 t))       ;; arrow head length
	 (l-h    (- l hl))        ;; length of arrow body
	 (a      `(,(- t/2) 0))
	 (b      `(,(- t/2) ,l-h))
	 (c      `(,(- 0 t/2 t/4) ,l-h))
	 (d      `(0  ,l))
	 (e      `(,(+ t/2 t/4) ,l-h))
	 (f      `(,t/2 ,l-h))
	 (g      `(,t/2 0))
	 (all    (map (lambda (pt)
			;; (print "pt: " pt " (car pt): " (car pt) " (cadr pt): " (cadr pt))
			(geolib:rotate-pt angle (car pt)(cadr pt)))
		      (list a b c d e f g)))
	 (allofs (map (lambda (pt)
			(let* ((newx (+ xoff (car pt)))
			       (newy (+ yoff (cadr pt))))
			  (list newx newy)))
		      all))
	 (flat   (apply append allofs)))
    flat))


(define (add-learn learn)




  (let* ((idelta 10)
	 (x1 10)
	 (y1 190)          ;; top line
	 (x2 (+ x1 5))
	 (y2 (- y1 10))    ;; second line
	 (x3 (+ x1 20))
	 (y3 150)          ;; bottom of drawing ...
	 (x4 (+ x3 5))
	 (x5 (+ x3 20))
	 (y4 (- y2 5))     ;; 175)
	 (y5 150)
	 (y6 (- y4 5))
	 (x6 (+ x5 5))
	 (font "Helvetica, -20"))
    (add-objs-to-comp
     learn
     (text 20 210 "Learn Something!" font: "Helvetica, -40")
     (polygon (big-arrow 20 8 (geolib:deg->rad 90) xoff: 18 yoff: 216))
     ;; this is the subject selection stuff
     (rectangle 0 140 90 200) ;; bounding box
     (line x1 y1 x2 y1)      ;; first h-line
     (text (+ x2 2)(- y1 2) "category" font: font)
     (line x3 (- y1 3 ) x3 y3)
     (line x3 y2 x4 y2)
     (text (+ x4 2)(- y2 2) "subject" font: font)
     (line x5 y4 x5 y5)      ;; vertical line
     (line x5 y6 x6 y6)
     (rectangle (- x6 2)(- y6 3)(+ x6 30)(+ y6 6)
		fill-color: (rgb->number 100 250 100))
     (text (+ x6 2) (- y6
		       2) "time" font: font)
     (text 0 (- y6 55) "(1) Select a \"session\" (a" font: font)
     (text 0 (- y6 65) "combination of subject" font: font)
     (text 0 (- y6 75) "and time)" font: font)
     ;; this is the vote box
     (rectangle 91 140 140 180) ;; bounding box
     (text 92 143 "Vote:  Yes")
     (rectangle 115 142 133 152)
     ;; this is the message for the second arrow
     (text 115 (- y6 55) "(2) Click the \"Yes\" to" font: font)
     (text 115 (- y6 65) "indicate you are interested" font: font)
     (text 115 (- y6 75) "in this session" font: font)
     ;; arrow 1
     (polygon (big-arrow 37 6 (geolib:deg->rad -5) xoff: (+ x6 0) yoff: (- y6 44)))
     ;; arrow 2
     (polygon (big-arrow 15 4 (geolib:deg->rad 5) xoff: (+ x6 75) yoff: (- y6 44)))
     )
    (add-comp-to-lib hlib "learn" learn)
    ))


(define (add-teach learn)
  (let* ((idelta 10)
	 (x1 10)
	 (y1 190)          ;; top line
	 (x2 (+ x1 5))
	 (y2 (- y1 10))    ;; second line
	 (x3 (+ x1 20))
	 (y3 150)          ;; bottom of drawing ...
	 (x4 (+ x3 5))
	 (x5 (+ x3 20))
	 (y4 (- y2 5))     ;; 175)
	 (y5 150)
	 (y6 (- y4 5))
	 (x6 (+ x5 5))
	 (font "Helvetica, -20"))
    (add-objs-to-comp

     teach
     (text 20 210 "Learn Something!" font: "Helvetica, -40")
     (polygon (big-arrow 20 8 (geolib:deg->rad 90) xoff: 18 yoff: 216))
     ;; this is the subject selection stuff
     (rectangle 0 140 90 200) ;; bounding box
     (line x1 y1 x2 y1)      ;; first h-line
     (text (+ x2 2)(- y1 2) "category" font: font)
     (line x3 (- y1 3 ) x3 y3)
     (line x3 y2 x4 y2)
     (text (+ x4 2)(- y2 2) "subject" font: font)
     (line x5 y4 x5 y5)      ;; vertical line
     (line x5 y6 x6 y6)
     (rectangle (- x6 2)(- y6 3)(+ x6 30)(+ y6 6)
		fill-color: (rgb->number 100 250 100))
     (text (+ x6 2) (- y6
		       2) "time" font: font)

     (text 0 (- y6 55) "(1) Select a \"session\" (a" font: font)
     (text 0 (- y6 65) "combination of subject" font: font)
     (text 0 (- y6 75) "and time)" font: font)
     ;; this is the vote box
     (rectangle 91 140 140 180) ;; bounding box
     (text 92 143 "Vote:  Yes")
     (rectangle 115 142 133 152)
     ;; this is the message for the second arrow
     (text 115 (- y6 55) "(2) Click the \"Yes\" to" font: font)
     (text 115 (- y6 65) "indicate you are interested" font: font)
     (text 115 (- y6 75) "in this session" font: font)
     ;; arrow 1
     (polygon (big-arrow 37 6 (geolib:deg->rad -5) xoff: (+ x6 0) yoff: (- y6 44)))
     ;; arrow 2
     (polygon (big-arrow 15 4 (geolib:deg->rad 5) xoff: (+ x6 75) yoff: (- y6 44)))
     )




    (add-comp-to-lib hlib "teach" teach)

    ))

(define c1 #f)
(define
  cnv
  (let* ((help-drawing (make-drawing))
	 (hlib         (make-lib))
	 ;; components
	 (learn     (make-comp))
	 (teach     (make-comp)))
    (add-lib help-drawing "hlib" hlib) ;; add library hlib to drawing
    ;; add objects to learn tree sketch

    (add-learn learn)
    (add-teach teach)

    ;; instantiate component teach from library hlib in drawing help-drawing
    (instantiate help-drawing "hlib" "learn" "s1" 20 40)
    ;; instantiate component learn from library hlib in drawing help-drawing
    (instantiate help-drawing "hlib" "teach" "s1" 20 40)
    


    (drawing-scalex-set! help-drawing 1.5)
    (drawing-scaley-set! help-drawing 1.5)
    
    (drawing-update-proc-set!
     help-drawing
     (lambda (dwg c xadj yadj)
       (set! c1 c)