Fix tables and word wrap
parent
5564691c27
commit
409f9030d4
|
@ -6,7 +6,6 @@
|
|||
- outliners don't work
|
||||
- browser responder doesn't work
|
||||
- tests in a loop runs out of memory eventually
|
||||
- fix word wrap with tables in panes
|
||||
|
||||
- fix this:
|
||||
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
USING: help inspector parser prettyprint ;
|
||||
|
||||
ARTICLE: "handbook" "Factor documentation"
|
||||
"Factor is a dynamically-typed stack based language. I hope you like it."
|
||||
{ $subsection "changes" }
|
||||
{ $heading "Survival guide" }
|
||||
{ $list
|
||||
{ "Load source files using " { $link run-file } ":" }
|
||||
{ $code "\"contrib/httpd/load.factor\" run-file" }
|
||||
{ "Load source files using " { $link run-file } ":"
|
||||
{ $code "\"contrib/httpd/load.factor\" run-file" } }
|
||||
{ { $link .s } " prints the contents of the stack." }
|
||||
{ { $link . } " prints the object at the top of the stack." }
|
||||
}
|
||||
|
|
|
@ -157,7 +157,8 @@ M: f >link <link> ;
|
|||
: $see-also ( content -- )
|
||||
"See also" $heading $links ;
|
||||
|
||||
: $table ( content -- ) [ print-element ] tabular-output ;
|
||||
: $table ( content -- )
|
||||
[ [ print-element ] tabular-output ] ($block) ;
|
||||
|
||||
: $values ( content -- )
|
||||
"Arguments and values" $heading
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
! Copyright (C) 2005, 2006 Slava Pestov
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
IN: gadgets
|
||||
USING: arrays gadgets-labels generic kernel math
|
||||
IN: gadgets-paragraphs
|
||||
USING: arrays gadgets gadgets-labels generic kernel math
|
||||
namespaces sequences ;
|
||||
|
||||
! A word break gadget
|
||||
|
@ -20,22 +20,30 @@ SYMBOL: x SYMBOL: max-x
|
|||
|
||||
SYMBOL: y SYMBOL: max-y
|
||||
|
||||
SYMBOL: line-height
|
||||
|
||||
SYMBOL: margin
|
||||
|
||||
: overrun? ( width -- ? ) x get + margin get >= ;
|
||||
|
||||
: wrap-line ( height -- ) 0 x set y [ + ] change ;
|
||||
: wrap-line ( -- )
|
||||
line-height get y +@
|
||||
0 { x line-height } [ set ] each-with ;
|
||||
|
||||
: wrap-pos ( -- pos ) x get y get 0 3array ;
|
||||
|
||||
: advance-x ( x -- ) x [ + dup ] change max-x [ max ] change ;
|
||||
: advance-x ( x -- )
|
||||
x +@
|
||||
x get max-x [ max ] change ;
|
||||
|
||||
: advance-y ( y -- ) y get + max-y [ max ] change ;
|
||||
: advance-y ( y -- )
|
||||
dup line-height [ max ] change
|
||||
y get + max-y [ max ] change ;
|
||||
|
||||
: wrap-step ( quot child -- | quot: pos child -- )
|
||||
dup pref-dim [
|
||||
over word-break-gadget? [
|
||||
dup first overrun? [ dup second wrap-line ] when
|
||||
dup first overrun? [ wrap-line ] when
|
||||
] unless drop wrap-pos rot call
|
||||
] keep first2 advance-y advance-x ; inline
|
||||
|
||||
|
@ -43,7 +51,7 @@ SYMBOL: margin
|
|||
|
||||
: init-wrap ( paragraph -- )
|
||||
paragraph-margin margin set
|
||||
0 { x max-x y max-y } [ set ] each-with ;
|
||||
0 { x max-x y max-y line-height } [ set ] each-with ;
|
||||
|
||||
: do-wrap ( paragraph quot -- dim | quot: pos child -- )
|
||||
[
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
! Copyright (C) 2005, 2006 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
IN: gadgets-presentations
|
||||
USING: arrays gadgets gadgets-borders
|
||||
gadgets-buttons gadgets-labels gadgets-outliner
|
||||
gadgets-panes generic hashtables inspector io kernel prettyprint
|
||||
sequences strings styles words ;
|
||||
USING: arrays gadgets gadgets-borders gadgets-buttons
|
||||
gadgets-labels gadgets-outliner gadgets-panes gadgets-paragraphs
|
||||
generic hashtables inspector io kernel prettyprint sequences
|
||||
strings styles words ;
|
||||
|
||||
! Clickable objects
|
||||
TUPLE: object-button object ;
|
||||
|
|
|
@ -27,11 +27,8 @@ GENERIC: tick ( ms object -- )
|
|||
[ timer-last [-] ] 2keep set-timer-last ;
|
||||
|
||||
: do-timer ( ms timer -- )
|
||||
dup next-time pick <= [
|
||||
[ advance-timer ] keep timer-object tick
|
||||
] [
|
||||
2drop
|
||||
] if ;
|
||||
dup next-time pick <=
|
||||
[ [ advance-timer ] keep timer-object tick ] [ 2drop ] if ;
|
||||
|
||||
: do-timers ( -- )
|
||||
millis timers hash-values [ do-timer ] each-with ;
|
||||
|
|
Loading…
Reference in New Issue