Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | A bit more work on widgets |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
5bd0eda37ca37b9987491f1ac1a2a755 |
User & Date: | bernd 2014-03-23 16:25:20.178 |
Context
2014-03-23
| ||
22:58 | A bit more work on widgets check-in: 54488cc3f0 user: bernd tags: trunk | |
16:25 | A bit more work on widgets check-in: 5bd0eda37c user: bernd tags: trunk | |
2014-03-22
| ||
21:01 | More work on boxes&glues check-in: 0d5c34deb0 user: bernd tags: trunk | |
Changes
Changes to gles2/widgets-test.fs.
︙ | ︙ | |||
11 12 13 14 15 16 17 | frame new value f5 frame new value f6 text new value f7 text new value f8 : !f1 ( -- ) f1 >o | | | | | | | | 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 | frame new value f5 frame new value f6 text new value f7 text new value f8 : !f1 ( -- ) f1 >o 0 0 dpy-w @ 4 / 0 dpy-h @ 2/ resize 32 border ! $FFFFFFFF frame-color ! button2 o> ; : !f2 ( -- ) f2 >o dpy-w @ 2/ 0 dpy-w @ 2/ 0 dpy-h @ 19 20 */ resize 32 border ! $FF7FFFFF frame-color ! button3 o> ; : !f3 ( -- ) f3 >o 0 dpy-h @ 2/ dpy-w @ 2/ 0 dpy-h @ 2/ 2/ resize 16 border ! $FFFF7FFF frame-color ! button1 o> ; : !f4 ( -- ) f4 >o 0 dpy-h @ 3 4 */ dpy-w @ 4 / 0 dpy-h @ 5 / resize 32 border ! $FF7F7FFF frame-color ! button1 o> ; : !f5 ( -- ) f5 >o dpy-w @ 4 / dpy-h @ 3 4 */ dpy-w @ 4 / 0 dpy-h @ 5 / resize 8 border ! $7FFF7FFF frame-color ! button1 o> ; : !f6 ( -- ) f6 >o dpy-w @ 4 / 0 dpy-w @ 4 / 0 dpy-h @ 2/ resize 16 border ! $7FFFFFFF frame-color ! button2 o> ; also freetype-gl 48e FConstant fontsize# atlas [IFDEF] android "/system/fonts/DroidSans.ttf\0" drop [ELSE] "/usr/share/fonts/truetype/LiberationSans-Regular.ttf\0" drop |
︙ | ︙ |
Changes to gles2/widgets.fs.
︙ | ︙ | |||
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | method dglue ( -- typ sub add ) method vglue ( -- typ sub add ) method hglue@ ( -- typ sub add ) \ cached variant method dglue@ ( -- typ sub add ) \ cached variant method vglue@ ( -- typ sub add ) \ cached variant method xywh ( -- x0 y0 w h ) method xywhd ( -- x y w h d ) method !size \ set your own size end-class widget :noname x @ y @ h @ - w @ h @ d @ + ; widget to xywh :noname x @ y @ w @ h @ d @ ; widget to xywhd ' noop widget to !size :noname w @ 0 0 ; widget to hglue :noname h @ 0 0 ; widget to vglue :noname d @ 0 0 ; widget to dglue ' hglue widget to hglue@ ' vglue widget to vglue@ ' dglue widget to dglue@ tex: style-tex \ 8 x 8 subimages, each sized 128x128 style-tex 1024 dup rgba-newtex | > > | 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 | method dglue ( -- typ sub add ) method vglue ( -- typ sub add ) method hglue@ ( -- typ sub add ) \ cached variant method dglue@ ( -- typ sub add ) \ cached variant method vglue@ ( -- typ sub add ) \ cached variant method xywh ( -- x0 y0 w h ) method xywhd ( -- x y w h d ) method resize ( x y w h d -- ) method !size \ set your own size end-class widget :noname x @ y @ h @ - w @ h @ d @ + ; widget to xywh :noname x @ y @ w @ h @ d @ ; widget to xywhd ' noop widget to !size :noname w @ 0 0 ; widget to hglue :noname h @ 0 0 ; widget to vglue :noname d @ 0 0 ; widget to dglue :noname d ! h ! w ! y ! x ! ; widget to resize ' hglue widget to hglue@ ' vglue widget to vglue@ ' dglue widget to dglue@ tex: style-tex \ 8 x 8 subimages, each sized 128x128 style-tex 1024 dup rgba-newtex |
︙ | ︙ | |||
217 218 219 220 221 222 223 224 225 226 227 228 229 230 | :noname ( -- ) ['] draw do-childs ; box to draw : +child ( o -- ) child-w @ over >o next-w ! o> child-w ! ; : +childs ( o1 .. on n -- ) 0 +DO +child LOOP ; \ glue arithmetics : 0glue ( -- t s a ) 0 0 0 ; : 1glue ( -- t s a ) 0 0 [ -1 1 rshift ]L ; : g3>2 ( t s a -- min a ) over + >r - r> ; : glue+ { t1 s1 a1 t2 s2 a2 -- t3 s3 a3 } t1 t2 + s1 s2 + a1 a2 + ; | > > > > > > | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | :noname ( -- ) ['] draw do-childs ; box to draw : +child ( o -- ) child-w @ over >o next-w ! o> child-w ! ; : +childs ( o1 .. on n -- ) 0 +DO +child LOOP ; \ glue arithmetics box class end-class hbox \ horizontal alignment box class field: baseline \ minimun skip per line end-class vbox \ vertical alignment box class end-class zbox \ overlay alignment : 0glue ( -- t s a ) 0 0 0 ; : 1glue ( -- t s a ) 0 0 [ -1 1 rshift ]L ; : g3>2 ( t s a -- min a ) over + >r - r> ; : glue+ { t1 s1 a1 t2 s2 a2 -- t3 s3 a3 } t1 t2 + s1 s2 + a1 a2 + ; |
︙ | ︙ | |||
241 242 243 244 245 246 247 | : vglue+ 0glue 0glue [: vglue@ glue+ baseglue glue* glue+ dglue@ ;] do-childs glue-drop ; : hglue* 1glue [: hglue@ glue* ;] do-childs ; : dglue* 1glue [: dglue@ glue* ;] do-childs ; : vglue* 1glue [: vglue@ glue* ;] do-childs ; | < < < < < < | 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | : vglue+ 0glue 0glue [: vglue@ glue+ baseglue glue* glue+ dglue@ ;] do-childs glue-drop ; : hglue* 1glue [: hglue@ glue* ;] do-childs ; : dglue* 1glue [: dglue@ glue* ;] do-childs ; : vglue* 1glue [: vglue@ glue* ;] do-childs ; ' hglue+ hbox is hglue ' dglue* hbox is dglue ' vglue* hbox is vglue ' hglue* vbox is hglue ' dglue+ vbox is dglue ' vglue+ vbox is vglue |
︙ | ︙ |
Changes to widgets-test.fs.
︙ | ︙ | |||
11 12 13 14 15 16 17 | frame new value f5 frame new value f6 text new value f7 text new value f8 : !f1 ( -- ) f1 >o | | | | | | | | 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 | frame new value f5 frame new value f6 text new value f7 text new value f8 : !f1 ( -- ) f1 >o 0 0 dpy-w @ 4 / 0 dpy-h @ 2/ resize 32 border ! $FFFFFFFF frame-color ! button2 o> ; : !f2 ( -- ) f2 >o dpy-w @ 2/ 0 dpy-w @ 2/ 0 dpy-h @ 19 20 */ resize 32 border ! $FF7FFFFF frame-color ! button3 o> ; : !f3 ( -- ) f3 >o 0 dpy-h @ 2/ dpy-w @ 2/ 0 dpy-h @ 2/ 2/ resize 16 border ! $FFFF7FFF frame-color ! button1 o> ; : !f4 ( -- ) f4 >o 0 dpy-h @ 3 4 */ dpy-w @ 4 / 0 dpy-h @ 5 / resize 32 border ! $FF7F7FFF frame-color ! button1 o> ; : !f5 ( -- ) f5 >o dpy-w @ 4 / dpy-h @ 3 4 */ dpy-w @ 4 / 0 dpy-h @ 5 / resize 8 border ! $7FFF7FFF frame-color ! button1 o> ; : !f6 ( -- ) f6 >o dpy-w @ 4 / 0 dpy-w @ 4 / 0 dpy-h @ 2/ resize 16 border ! $7FFFFFFF frame-color ! button2 o> ; also freetype-gl 48e FConstant fontsize# atlas [IFDEF] android "/system/fonts/DroidSans.ttf\0" drop [ELSE] "/usr/share/fonts/truetype/LiberationSans-Regular.ttf\0" drop |
︙ | ︙ |
Changes to widgets.fs.
︙ | ︙ | |||
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | method dglue ( -- typ sub add ) method vglue ( -- typ sub add ) method hglue@ ( -- typ sub add ) \ cached variant method dglue@ ( -- typ sub add ) \ cached variant method vglue@ ( -- typ sub add ) \ cached variant method xywh ( -- x0 y0 w h ) method xywhd ( -- x y w h d ) method !size \ set your own size end-class widget :noname x @ y @ h @ - w @ h @ d @ + ; widget to xywh :noname x @ y @ w @ h @ d @ ; widget to xywhd ' noop widget to !size :noname w @ 0 0 ; widget to hglue :noname h @ 0 0 ; widget to vglue :noname d @ 0 0 ; widget to dglue ' hglue widget to hglue@ ' vglue widget to vglue@ ' dglue widget to dglue@ tex: style-tex \ 8 x 8 subimages, each sized 128x128 style-tex 1024 dup rgba-newtex | > > | 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 | method dglue ( -- typ sub add ) method vglue ( -- typ sub add ) method hglue@ ( -- typ sub add ) \ cached variant method dglue@ ( -- typ sub add ) \ cached variant method vglue@ ( -- typ sub add ) \ cached variant method xywh ( -- x0 y0 w h ) method xywhd ( -- x y w h d ) method resize ( x y w h d -- ) method !size \ set your own size end-class widget :noname x @ y @ h @ - w @ h @ d @ + ; widget to xywh :noname x @ y @ w @ h @ d @ ; widget to xywhd ' noop widget to !size :noname w @ 0 0 ; widget to hglue :noname h @ 0 0 ; widget to vglue :noname d @ 0 0 ; widget to dglue :noname d ! h ! w ! y ! x ! ; widget to resize ' hglue widget to hglue@ ' vglue widget to vglue@ ' dglue widget to dglue@ tex: style-tex \ 8 x 8 subimages, each sized 128x128 style-tex 1024 dup rgba-newtex |
︙ | ︙ | |||
217 218 219 220 221 222 223 224 225 226 227 228 229 230 | :noname ( -- ) ['] draw do-childs ; box to draw : +child ( o -- ) child-w @ over >o next-w ! o> child-w ! ; : +childs ( o1 .. on n -- ) 0 +DO +child LOOP ; \ glue arithmetics : 0glue ( -- t s a ) 0 0 0 ; : 1glue ( -- t s a ) 0 0 [ -1 1 rshift ]L ; : g3>2 ( t s a -- min a ) over + >r - r> ; : glue+ { t1 s1 a1 t2 s2 a2 -- t3 s3 a3 } t1 t2 + s1 s2 + a1 a2 + ; | > > > > > > | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | :noname ( -- ) ['] draw do-childs ; box to draw : +child ( o -- ) child-w @ over >o next-w ! o> child-w ! ; : +childs ( o1 .. on n -- ) 0 +DO +child LOOP ; \ glue arithmetics box class end-class hbox \ horizontal alignment box class field: baseline \ minimun skip per line end-class vbox \ vertical alignment box class end-class zbox \ overlay alignment : 0glue ( -- t s a ) 0 0 0 ; : 1glue ( -- t s a ) 0 0 [ -1 1 rshift ]L ; : g3>2 ( t s a -- min a ) over + >r - r> ; : glue+ { t1 s1 a1 t2 s2 a2 -- t3 s3 a3 } t1 t2 + s1 s2 + a1 a2 + ; |
︙ | ︙ | |||
241 242 243 244 245 246 247 | : vglue+ 0glue 0glue [: vglue@ glue+ baseglue glue* glue+ dglue@ ;] do-childs glue-drop ; : hglue* 1glue [: hglue@ glue* ;] do-childs ; : dglue* 1glue [: dglue@ glue* ;] do-childs ; : vglue* 1glue [: vglue@ glue* ;] do-childs ; | < < < < < < | 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | : vglue+ 0glue 0glue [: vglue@ glue+ baseglue glue* glue+ dglue@ ;] do-childs glue-drop ; : hglue* 1glue [: hglue@ glue* ;] do-childs ; : dglue* 1glue [: dglue@ glue* ;] do-childs ; : vglue* 1glue [: vglue@ glue* ;] do-childs ; ' hglue+ hbox is hglue ' dglue* hbox is dglue ' vglue* hbox is vglue ' hglue* vbox is hglue ' dglue+ vbox is dglue ' vglue+ vbox is vglue |
︙ | ︙ |