Random Bits of Open Code

Check-in [e00c2f28be]
Login

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

Overview
Comment:Trying out vg for help graphics
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:e00c2f28be95e97f6e38b89e6d60af5e3d3a4f43
User & Date: matt 2018-07-31 05:58:27
Context
2018-08-01
05:44
Added big arrow polygon generator check-in: 6915e3fe7e user: matt tags: trunk
2018-07-31
05:58
Trying out vg for help graphics check-in: e00c2f28be user: matt tags: trunk
2018-07-30
04:39
Added template for help drawing. check-in: cd8d29c34c user: matt tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

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

1
2
3
4
5
6
7
8
..
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
(use canvas-draw iup foof-loop)
(import canvas-draw-iup)
(import canvas-draw-client)

;; (load "vg.scm")
(use vgcanvas)
(use vg) ;; (prefix vg vg:))
(use (prefix geolib geolib:))
................................................................................
 ;;  ;; vg:grow-rect
 ;;  vg:get-extents-for-objs
 ;;  vg:components-get-extents
 ;;  vg:instances-get-extents
 ;;  vg:get-extents-for-two-rects
 ;;  canvas-line!)

(define help-drawing (make-drawing))
(define help-lib     (make-lib))

(define help-learn   (make-comp))
(define help-teach   (make-comp))







(add-objs-to-comp help-learn

		  (rectangle 0 0 100 20 text: "Learn Something!"))
(add-comp-to-lib help-lib "help-learn" help-learn) ;; add component help-learn to library help-lib
(add-lib help-drawing "help-lib" help-lib)         ;; add library help-lib to drawing
(instantiate help-drawing "help-lib" "help-learn" "help1" 20 20)  ;; instantiate component help-learn from library help-lib 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)
   (canvas-clear! c)
   (draw dwg #t)))

(let ((c (drawing-init help-drawing)))
  (print "c:   " c)
  (show
   (dialog
    (vbox
     #:expand "YES"
     (label "The drawing")
     c))))




;; (define d1 (make-drawing))
;; (define l1 (make-lib))
;; (define c1 (make-comp))
;; (define c2 (make-comp))
;; (define c3 (make-comp))
;; (define bt1 (rectangle 10 40 20 50 text: "A long piece of text" font: "Helvetica, -10"))
|







 







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

|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
>







1
2
3
4
5
6
7
8
..
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
(use canvas-draw iup foof-loop srfi-18)
(import canvas-draw-iup)
(import canvas-draw-client)

;; (load "vg.scm")
(use vgcanvas)
(use vg) ;; (prefix vg vg:))
(use (prefix geolib geolib:))
................................................................................
 ;;  ;; vg:grow-rect
 ;;  vg:get-extents-for-objs
 ;;  vg:components-get-extents
 ;;  vg:instances-get-extents
 ;;  vg:get-extents-for-two-rects
 ;;  canvas-line!)

(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
  (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"))
  (add-comp-to-lib hlib "title" title) ;; add component help-learn to library help-lib

  ;; add objects to subjects tree sketch
  (add-objs-to-comp
   subjects
   (rectangle 0 80 80 200)



   (line 10 190 20 190)
   (line 20 190 20 150)
   (line 20 180 30 180)
   (text 31 178 "unix" font: "Helvetica, -20")
   (line 40 178 40 170)
   (text 32 162 "11:00" font: "Helvetica, -20")
   )
  (add-comp-to-lib hlib "subj" subjects)
  
  (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)
     (canvas-clear! c)
     (draw dwg #t)))
  
  (let ((c (drawing-init help-drawing)))
    (print "c:   " c)
    (show
     (dialog
      (vbox
       #:expand "YES"
       (label "The drawing")
       c))))
  
  (main-loop))


;; (define d1 (make-drawing))
;; (define l1 (make-lib))
;; (define c1 (make-comp))
;; (define c2 (make-comp))
;; (define c3 (make-comp))
;; (define bt1 (rectangle 10 40 20 50 text: "A long piece of text" font: "Helvetica, -10"))