From c1e9268a452660b17940c51e88ec2d29f90e4173 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Sun, 13 Jul 2008 16:26:13 -0500 Subject: [PATCH 1/9] ui.gadgets.buttons: Rewrite to not use 'gadget,' --- extra/ui/gadgets/buttons/buttons.factor | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/extra/ui/gadgets/buttons/buttons.factor b/extra/ui/gadgets/buttons/buttons.factor index a855a6d93e..5cc27f47b6 100755 --- a/extra/ui/gadgets/buttons/buttons.factor +++ b/extra/ui/gadgets/buttons/buttons.factor @@ -187,9 +187,9 @@ M: radio-control model-changed over set-button-selected? relayout-1 ; -: ( model assoc quot -- ) - #! quot has stack effect ( value model label -- ) - swapd [ swapd call gadget, ] 2curry assoc-each ; inline +: ( parent model assoc quot -- parent ) + #! quot has stack effect ( value model label -- ) + swapd [ swapd call add-gadget ] 2curry assoc-each ; inline : radio-button-theme ( gadget -- gadget ) { 5 5 } >>gap @@ -202,14 +202,18 @@ M: radio-control model-changed { 5 5 } >>gap drop ; : ( model assoc -- gadget ) - [ [ ] ] make-filled-pile - dup radio-buttons-theme ; + + -rot + [ ] + dup radio-buttons-theme ; : ( value model label -- gadget ) bevel-button-theme ; : ( model assoc -- gadget ) - [ [ ] ] make-shelf ; + + -rot + [ ] ; : command-button-quot ( target command -- quot ) [ invoke-command drop ] 2curry ; @@ -221,9 +225,9 @@ M: radio-control model-changed ; : ( target -- toolbar ) - [ - "toolbar" over class command-map commands>> swap - [ -rot gadget, ] curry assoc-each - ] make-shelf ; + + swap + "toolbar" over class command-map commands>> swap + [ -rot add-gadget ] curry assoc-each ; : toolbar, ( -- ) g f track, ; From 16fbd3c3a619405c8e6596a9657999e78faf8ff8 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Sun, 13 Jul 2008 16:27:11 -0500 Subject: [PATCH 2/9] ui.gadgets.buttons: minor change --- extra/ui/gadgets/buttons/buttons.factor | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/extra/ui/gadgets/buttons/buttons.factor b/extra/ui/gadgets/buttons/buttons.factor index 5cc27f47b6..4c4efec20f 100755 --- a/extra/ui/gadgets/buttons/buttons.factor +++ b/extra/ui/gadgets/buttons/buttons.factor @@ -1,12 +1,13 @@ ! Copyright (C) 2005, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: accessors arrays kernel math models namespaces sequences -strings quotations assocs combinators classes colors -classes.tuple opengl math.vectors -ui.commands ui.gadgets ui.gadgets.borders -ui.gadgets.labels ui.gadgets.theme -ui.gadgets.tracks ui.gadgets.packs ui.gadgets.worlds ui.gestures -ui.render math.geometry.rect ; + strings quotations assocs combinators classes colors + classes.tuple opengl math.vectors + ui.commands ui.gadgets ui.gadgets.borders + ui.gadgets.labels ui.gadgets.theme + ui.gadgets.tracks ui.gadgets.packs ui.gadgets.worlds ui.gestures + ui.render math.geometry.rect ; + IN: ui.gadgets.buttons TUPLE: button < border pressed? selected? quot ; From 1d8f7c5a89dc48b92100d38106588f6c34933c45 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Sun, 13 Jul 2008 16:36:23 -0500 Subject: [PATCH 3/9] ui.gadgets.menus: rewrite to not use 'gadget,' --- extra/ui/gadgets/menus/menus.factor | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/extra/ui/gadgets/menus/menus.factor b/extra/ui/gadgets/menus/menus.factor index 4f815bc33d..2d7af47396 100644 --- a/extra/ui/gadgets/menus/menus.factor +++ b/extra/ui/gadgets/menus/menus.factor @@ -48,6 +48,7 @@ M: menu-glass layout* gadget-child prefer ; faint-boundary ; : ( hook target commands -- gadget ) - [ - [ >r 2dup r> gadget, ] each 2drop - ] make-filled-pile 5 menu-theme ; + + -roll + [ add-gadget ] with with each + 5 menu-theme ; From 41bca4ab20edfadf71e1962a2435b160e8a252b0 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Sun, 13 Jul 2008 16:40:05 -0500 Subject: [PATCH 4/9] nehe: rewrite to not use 'gadget,' --- extra/nehe/nehe.factor | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/extra/nehe/nehe.factor b/extra/nehe/nehe.factor index b074e85f3b..a96c024683 100644 --- a/extra/nehe/nehe.factor +++ b/extra/nehe/nehe.factor @@ -4,12 +4,12 @@ IN: nehe : nehe-window ( -- ) [ - [ - "Nehe 2" [ drop run2 ] gadget, - "Nehe 3" [ drop run3 ] gadget, - "Nehe 4" [ drop run4 ] gadget, - "Nehe 5" [ drop run5 ] gadget, - ] make-filled-pile "Nehe examples" open-window + + "Nehe 2" [ drop run2 ] add-gadget + "Nehe 3" [ drop run3 ] add-gadget + "Nehe 4" [ drop run4 ] add-gadget + "Nehe 5" [ drop run5 ] add-gadget + "Nehe examples" open-window ] with-ui ; MAIN: nehe-window From dc71e50dc4419728ece37f3b281ff13bd9409297 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Sun, 13 Jul 2008 17:09:03 -0500 Subject: [PATCH 5/9] lsys.ui: Rewrite to not use 'gadget,' --- extra/lsys/ui/ui.factor | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/extra/lsys/ui/ui.factor b/extra/lsys/ui/ui.factor index 8f9513ff2a..f7ec181f61 100644 --- a/extra/lsys/ui/ui.factor +++ b/extra/lsys/ui/ui.factor @@ -17,7 +17,7 @@ USING: kernel namespaces threads math math.order math.vectors self pos ori turtle opengl.camera lsys.tortoise lsys.tortoise.graphics lsys.strings.rewrite lsys.strings.interpret - combinators.short-circuit ; + combinators.short-circuit accessors ; ! lsys.strings ! lsys.strings.rewrite @@ -99,6 +99,8 @@ DEFER: empty-model : lsys-controller ( -- ) + + { [ "Load"