forked from disconcision/fructure
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlayout-demos.rkt
More file actions
170 lines (138 loc) · 4.13 KB
/
Copy pathlayout-demos.rkt
File metadata and controls
170 lines (138 loc) · 4.13 KB
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
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
#lang racket
(require 2htdp/image
"../shared/slash-patterns/slash-patterns.rkt"
; only for div in add-dynamic. TODO: refactor
"../src/common.rkt"
"../src/layout/layout.rkt"
"layout-demos-data.rkt")
; TODO: rework as default settings?
(define test-settings-init
(hash 'text-size 34
'typeface "Iosevka, Light"
'max-menu-length 3
'max-menu-length-chars 1
'transform-template-only #f
'popout-transform? #t
'popout-menu? #t
'custom-menu-selector? #t
'simple-menu? #f
'force-horizontal-layout? #f
'length-conditional-layout? #t
'length-conditional-cutoff 14
'dodge-enabled? #t
'implicit-forms '(ref num app)
'line-spacing 0 ; 1
'char-padding-vertical 0 ; 5
'show-parens? #f
'hole-bottom-color (color 252 225 62)
'hole-side-color (color 193 115 23)
'background-block-color (color 25 80 84)
'transform-tint-color (color 160 0 0) ; selected-color
'selected-atom-color (color 255 255 255)
'menu-bkg-color (color 112 112 112)
'form-color (color 0 130 214)
'literal-color (color 228 150 34)
'grey-one (color 230 230 230)
'grey-two (color 215 215 215)
'identifier-color (color 0 0 0)
'selected-color (color 230 0 0)
'+hole-color (color 25 80 84)
'transform-arrow-color (color 255 255 255)
'bkg-color (color 0 47 54)
'pattern-bkg-color (color 230 230 230)
'pattern-grey-one (color 17 39 46)#;(color 76 76 76)
'pattern-grey-two (color 110 110 110)
'menu-secondary-color (color 40 40 40)
))
; COPIED from fructure.rkt TODO REFACTOR
(define (add-dynamic-settings layout)
(define-from layout
text-size typeface
char-padding-vertical)
(define (div-integer x y)
(inexact->exact (round (div x y))))
(define space-image
(text/font " " text-size "black"
typeface 'modern 'normal 'normal #f))
(hash-set* layout
'radius (sub1 (div-integer text-size 2))
'margin (div-integer text-size 5)
'unit-width (image-width space-image)
'unit-height (+ char-padding-vertical (image-height space-image))))
; add dynamic settings to layout
(define test-settings (add-dynamic-settings test-settings-init))
#;(second
(render
data-0
test-settings))
#;(second
(render
data-1
test-settings))
#;(second
(render
data-2
test-settings))
; THIS IS THE ONE WE WERE TESTING UNITL 2019.jan31
#;(second
(render
data-3
test-settings))
#;(second
(render
data-4
test-settings))
#;(second
(render
data-5
test-settings))
#;(second
(render
(match data-6
[(/ a/ a)
(/ [display-box `(800 240)]
[display-offset `(0 0)]
a/ a)])
test-settings))
#;(draw-outlines-abs
(augment-absolute-offsets
(first (render (match data-6
[(/ a/ a)
(/ [display-box `(800 240)]
[display-offset `(0 0)]
a/ a)])
test-settings))))
#;(second
(fructure-layout data-7 test-settings))
(draw-outlines-abs (first (fructure-layout data-8 test-settings))
(second (fructure-layout data-8 test-settings)))
(second
(fructure-layout data-8 test-settings))
(second
(fructure-layout data-9 test-settings))
(second
(fructure-layout data-10 test-settings))
(second
(render data-11 test-settings))
(second
(render data-12 test-settings))
(second
(fructure-layout data-13 test-settings))
(second
(fructure-layout data-14 test-settings))
(second
(fructure-layout data-15 test-settings))
(second
(fructure-layout data-16 test-settings))
(second
(fructure-layout transforming-λ-dog-dog-dog-to-hole
test-settings))
(second
(fructure-layout transforming-three-liner-to-hole
test-settings))
(second
(fructure-layout transforming-3-line-to-4-line
test-settings))
(second
(fructure-layout transforming-hole-to-2-line
test-settings))