Merge branch 'master' of git://factorcode.org/git/factor

db4
Slava Pestov 2008-07-22 04:45:18 -05:00
commit 19f1621862
9 changed files with 9 additions and 16 deletions

View File

@ -50,7 +50,7 @@ IN: slides
<gadget> <gadget>
T{ gradient f { { 0.25 0.25 0.25 1.0 } { 1.0 1.0 1.0 0.0 } } } T{ gradient f { { 0.25 0.25 0.25 1.0 } { 1.0 1.0 1.0 0.0 } } }
over set-gadget-interior over set-gadget-interior
{ 800 10 } over set-gadget-dim { 800 10 } over (>>dim)
{ 1 0 } over set-gadget-orientation { 1 0 } over set-gadget-orientation
gadget. gadget.
] ($block) ; ] ($block) ;

View File

@ -338,7 +338,7 @@ CLASS: {
{ "updateFactorGadgetSize:" "void" { "id" "SEL" "id" } { "updateFactorGadgetSize:" "void" { "id" "SEL" "id" }
[ [
[ [
2drop dup view-dim swap window set-gadget-dim yield 2drop dup view-dim swap window (>>dim) yield
] ui-try ] ui-try
] ]
} }

View File

@ -126,7 +126,7 @@ M: checkmark-paint draw-interior
: <checkmark> ( -- gadget ) : <checkmark> ( -- gadget )
<gadget> <gadget>
dup checkmark-theme dup checkmark-theme
{ 14 14 } over set-gadget-dim ; { 14 14 } over (>>dim) ;
: toggle-model ( model -- ) : toggle-model ( model -- )
[ not ] change-model ; [ not ] change-model ;
@ -172,7 +172,7 @@ M: radio-paint draw-boundary
: <radio-knob> ( -- gadget ) : <radio-knob> ( -- gadget )
<gadget> <gadget>
dup radio-knob-theme dup radio-knob-theme
{ 16 16 } over set-gadget-dim ; { 16 16 } over (>>dim) ;
TUPLE: radio-control < button value ; TUPLE: radio-control < button value ;

View File

@ -65,10 +65,6 @@ HELP: relayout-1
{ relayout relayout-1 } related-words { relayout relayout-1 } related-words
HELP: set-gadget-dim
{ $values { "dim" "a pair of integers" } { "gadget" gadget } }
{ $description "Resizes and relayouts a gadget before the next iteration of the event loop." } ;
HELP: pref-dim* HELP: pref-dim*
{ $values { "gadget" gadget } { "dim" "a pair of integers" } } { $values { "gadget" gadget } { "dim" "a pair of integers" } }
{ $contract "Outputs the preferred dimensions of the gadget, possibly computing them from the preferred dimensions of the gadget's children." } { $contract "Outputs the preferred dimensions of the gadget, possibly computing them from the preferred dimensions of the gadget's children." }

View File

@ -176,8 +176,6 @@ M: gadget (>>dim) ( dim gadget -- )
[ tuck call-next-method do-invalidate drop ] [ tuck call-next-method do-invalidate drop ]
if ; if ;
: set-gadget-dim ( dim gadget -- ) (>>dim) ;
GENERIC: pref-dim* ( gadget -- dim ) GENERIC: pref-dim* ( gadget -- dim )
: ?set-gadget-pref-dim ( dim gadget -- ) : ?set-gadget-pref-dim ( dim gadget -- )

View File

@ -236,8 +236,7 @@ $nl
ARTICLE: "ui-null-layout" "Manual layouts" ARTICLE: "ui-null-layout" "Manual layouts"
"When automatic layout is not appropriate, gadgets can be added to a parent with no layout policy, and then positioned and sized manually:" "When automatic layout is not appropriate, gadgets can be added to a parent with no layout policy, and then positioned and sized manually:"
{ $subsection set-rect-loc } { $subsection set-rect-loc } ;
{ $subsection set-gadget-dim } ;
ARTICLE: "ui-layout-impl" "Implementing layout gadgets" ARTICLE: "ui-layout-impl" "Implementing layout gadgets"
"The relayout process proceeds top-down, with parents laying out their children, which in turn lay out their children. Custom layout policy is implemented by defining a method on a generic word:" "The relayout process proceeds top-down, with parents laying out their children, which in turn lay out their children. Custom layout policy is implemented by defining a method on a generic word:"

View File

@ -4,7 +4,7 @@ USING: arrays assocs io kernel math models namespaces
prettyprint dlists dequeues sequences threads sequences words prettyprint dlists dequeues sequences threads sequences words
debugger ui.gadgets ui.gadgets.worlds ui.gadgets.tracks debugger ui.gadgets ui.gadgets.worlds ui.gadgets.tracks
ui.gestures ui.backend ui.render continuations init combinators ui.gestures ui.backend ui.render continuations init combinators
hashtables concurrency.flags sets ; hashtables concurrency.flags sets accessors ;
IN: ui IN: ui
! Assoc mapping aliens to gadgets ! Assoc mapping aliens to gadgets
@ -172,7 +172,7 @@ SYMBOL: ui-thread
"UI update" spawn drop ; "UI update" spawn drop ;
: open-world-window ( world -- ) : open-world-window ( world -- )
dup pref-dim over set-gadget-dim dup relayout graft ; dup pref-dim over (>>dim) dup relayout graft ;
: open-window ( gadget title -- ) : open-window ( gadget title -- )
f <world> open-world-window ; f <world> open-world-window ;

View File

@ -93,7 +93,7 @@ SYMBOLS: msg-obj class-name-ptr mouse-captured ;
: handle-wm-size ( hWnd uMsg wParam lParam -- ) : handle-wm-size ( hWnd uMsg wParam lParam -- )
2nip 2nip
[ lo-word ] keep hi-word 2array [ lo-word ] keep hi-word 2array
dup { 0 0 } = [ 2drop ] [ swap window set-gadget-dim ] if ; dup { 0 0 } = [ 2drop ] [ swap window (>>dim) ] if ;
: handle-wm-move ( hWnd uMsg wParam lParam -- ) : handle-wm-move ( hWnd uMsg wParam lParam -- )
2nip 2nip

View File

@ -22,7 +22,7 @@ M: world expose-event nip relayout ;
M: world configure-event M: world configure-event
over configured-loc over (>>window-loc) over configured-loc over (>>window-loc)
swap configured-dim over set-gadget-dim swap configured-dim over (>>dim)
! In case dimensions didn't change ! In case dimensions didn't change
relayout-1 ; relayout-1 ;