Track fixes

slava 2006-05-30 22:57:34 +00:00
parent 9073128871
commit ee6f94a9a1
4 changed files with 35 additions and 11 deletions

View File

@ -11,10 +11,10 @@
- browser responder doesn't work
- code walker & exceptions -- test and debug problems
- another i/o bug: on factorcode eventually all i/o times out
- bug in pound?
- x11 title bars are funny
- if the listener is running a command when the image is saved, it
restores to an unresponsive gadget
- track: don't allow negative dimensions
- fix top level window positioning
- services do not launch if factor not running
- when scrolling wheel, or moving mouse out of window, rollover is not

View File

@ -16,7 +16,9 @@ sequences strings styles words ;
} [ declaration. ] each-with ;
: in. ( word -- )
<block \ IN: pprint-word word-vocabulary text block; ;
word-vocabulary [
<block \ IN: pprint-word text block;
] when* ;
: (synopsis) ( word -- )
dup in. dup definer pprint-word pprint-word ;

View File

@ -49,21 +49,43 @@ M: track pref-dim* ( track -- dim )
drag-loc over track-dim { 1 1 1 } vmax v/
swap gadget-orientation v. ;
: +nth ( delta n seq -- ) swap [ + ] change-nth ;
: save-sizes ( track -- )
dup track-sizes clone swap set-track-saved-sizes ;
: restore-sizes ( track -- )
dup track-saved-sizes clone swap set-track-sizes ;
: set-nth-0 ( n seq -- old ) 2dup nth >r 0 -rot set-nth r> ;
: +nth ( delta n seq -- ) swap [ + ] change-nth ;
: clamp-nth ( i j sizes -- ) [ set-nth-0 swap ] keep +nth ;
: clamp-up? ( delta n sizes -- ? ) nth + 0 < ;
: clamp-down? ( delta n sizes -- ? ) >r 1+ r> nth swap - 0 < ;
: change-last-size ( delta n sizes -- )
#! Its a bit simpler to resize the last divider since we
#! don't have to adjust the next one.
3dup clamp-up? [ set-nth-0 2drop ] [ +nth ] if ;
: change-inner-size ( delta n sizes -- )
#! When changing a divider which isn't the last, we have to
#! resize the next area, too.
{
{ [ 3dup clamp-up? ] [ >r dup 1+ swap r> clamp-nth drop ] }
{ [ 3dup clamp-down? ] [ >r dup 1+ r> clamp-nth drop ] }
{ [ t ] [ pick neg pick 1+ pick +nth +nth ] }
} cond ;
: change-size ( delta n sizes -- )
over 1+ over length =
[ change-last-size ] [ change-inner-size ] if ;
: change-divider ( delta n track -- )
[
dup restore-sizes
track-sizes
[ +nth ] 3keep
>r 1+ >r neg r> r> 2dup length = [ 3drop ] [ +nth ] if
] keep relayout-1 ;
[ dup restore-sizes track-sizes change-size ] keep
relayout-1 ;
: divider-motion ( divider -- )
dup gadget-parent divider-delta

View File

@ -88,7 +88,7 @@ DEFER: show-vocab
browser-vocab-track showing-asset? ;
: show-vocab ( vocab browser -- )
browser-vocab-track show-asset ;
over [ browser-vocab-track show-asset ] [ 2drop ] if ;
: hide-vocab-words ( vocab browser -- )
[