Fix activate-control
parent
25de6273b3
commit
555e2c9964
|
@ -70,8 +70,12 @@ M: gadget model-changed 2drop ;
|
||||||
>r <gadget> r> construct-delegate ; inline
|
>r <gadget> r> construct-delegate ; inline
|
||||||
|
|
||||||
: activate-control ( gadget -- )
|
: activate-control ( gadget -- )
|
||||||
dup gadget-model dup [ 2dup add-connection ] when drop
|
dup gadget-model dup [
|
||||||
dup gadget-model swap model-changed ;
|
2dup add-connection
|
||||||
|
swap model-changed
|
||||||
|
] [
|
||||||
|
2drop
|
||||||
|
] if ;
|
||||||
|
|
||||||
: deactivate-control ( gadget -- )
|
: deactivate-control ( gadget -- )
|
||||||
dup gadget-model dup [ 2dup remove-connection ] when 2drop ;
|
dup gadget-model dup [ 2dup remove-connection ] when 2drop ;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
! Copyright (C) 2005, 2007 Slava Pestov.
|
! Copyright (C) 2005, 2007 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: io kernel math namespaces math.vectors ui.gadgets ;
|
USING: io kernel math namespaces math.vectors ui.gadgets
|
||||||
|
dlists ;
|
||||||
IN: ui.gadgets.incremental
|
IN: ui.gadgets.incremental
|
||||||
|
|
||||||
! Incremental layout allows adding lines to panes to be O(1).
|
! Incremental layout allows adding lines to panes to be O(1).
|
||||||
|
@ -14,12 +15,14 @@ IN: ui.gadgets.incremental
|
||||||
! New gadgets are added at
|
! New gadgets are added at
|
||||||
! incremental-cursor gadget-orientation v*
|
! incremental-cursor gadget-orientation v*
|
||||||
|
|
||||||
TUPLE: incremental cursor ;
|
TUPLE: incremental cursor queue ;
|
||||||
|
|
||||||
: <incremental> ( pack -- incremental )
|
: <incremental> ( pack -- incremental )
|
||||||
dup pref-dim
|
dup pref-dim <dlist> {
|
||||||
{ set-gadget-delegate set-incremental-cursor }
|
set-gadget-delegate
|
||||||
incremental construct ;
|
set-incremental-cursor
|
||||||
|
set-incremental-queue
|
||||||
|
} incremental construct ;
|
||||||
|
|
||||||
M: incremental pref-dim*
|
M: incremental pref-dim*
|
||||||
dup gadget-layout-state [
|
dup gadget-layout-state [
|
||||||
|
@ -40,17 +43,17 @@ M: incremental pref-dim*
|
||||||
swap set-rect-loc ;
|
swap set-rect-loc ;
|
||||||
|
|
||||||
: prefer-incremental ( gadget -- )
|
: prefer-incremental ( gadget -- )
|
||||||
dup forget-pref-dim dup pref-dim over set-rect-dim
|
dup forget-pref-dim dup pref-dim swap set-rect-dim ;
|
||||||
layout ;
|
|
||||||
|
|
||||||
: add-incremental ( gadget incremental -- )
|
: add-incremental ( gadget incremental -- )
|
||||||
not-in-layout
|
not-in-layout
|
||||||
2dup (add-gadget)
|
2dup incremental-queue push-front
|
||||||
over prefer-incremental
|
add-gadget ;
|
||||||
|
|
||||||
|
: (add-incremental) ( gadget incremental -- )
|
||||||
2dup incremental-loc
|
2dup incremental-loc
|
||||||
tuck update-cursor
|
tuck update-cursor
|
||||||
dup prefer-incremental
|
prefer-incremental ;
|
||||||
gadget-parent [ invalidate* ] when* ;
|
|
||||||
|
|
||||||
: clear-incremental ( incremental -- )
|
: clear-incremental ( incremental -- )
|
||||||
not-in-layout
|
not-in-layout
|
||||||
|
|
Loading…
Reference in New Issue