db4
Slava Pestov 2008-11-19 21:13:50 -06:00
parent 825ad4e59d
commit 8f0b335f4b
1 changed files with 14 additions and 15 deletions

View File

@ -11,16 +11,16 @@ TUPLE: frame < grid ;
: <frame-grid> ( -- grid ) 9 [ <gadget> ] replicate 3 group ;
: @center 1 1 ;
: @left 0 1 ;
: @right 2 1 ;
: @top 1 0 ;
: @bottom 1 2 ;
: @center 1 1 ; inline
: @left 0 1 ; inline
: @right 2 1 ; inline
: @top 1 0 ; inline
: @bottom 1 2 ; inline
: @top-left 0 0 ;
: @top-right 2 0 ;
: @bottom-left 0 2 ;
: @bottom-right 2 2 ;
: @top-left 0 0 ; inline
: @top-right 2 0 ; inline
: @bottom-left 0 2 ; inline
: @bottom-right 2 2 ; inline
: new-frame ( class -- frame )
<frame-grid> swap new-grid ; inline
@ -28,13 +28,12 @@ TUPLE: frame < grid ;
: <frame> ( -- frame )
frame new-frame ;
: (fill-center) ( vec n -- )
over first pick third v+ [v-] 1 rot set-nth ;
: (fill-center) ( n vec -- )
[ [ first ] [ third ] bi v+ [v-] ] keep set-second ;
: fill-center ( horiz vert dim -- )
tuck (fill-center) (fill-center) ;
: fill-center ( dim horiz vert -- )
[ over ] dip [ (fill-center) ] 2bi@ ;
M: frame layout*
dup compute-grid
[ rot rect-dim fill-center ] 3keep
grid-layout ;
[ [ rect-dim ] 2dip fill-center ] [ grid-layout ] 3bi ;