UI bootstrapped in
parent
662a2c9125
commit
7df9b774e9
|
@ -28,9 +28,9 @@
|
||||||
|
|
||||||
+ ui/help:
|
+ ui/help:
|
||||||
|
|
||||||
|
- unregister notifications in dealloc
|
||||||
- segfault when closing window
|
- segfault when closing window
|
||||||
- wheel mouse is a bit funny
|
- wheel mouse is a bit funny
|
||||||
- bootstrap in the ui
|
|
||||||
- changelog in the UI
|
- changelog in the UI
|
||||||
- make the UI look better, something like this:
|
- make the UI look better, something like this:
|
||||||
http://twb.ath.cx/~twb/darcs/OBSOLETE/factor/final.html
|
http://twb.ath.cx/~twb/darcs/OBSOLETE/factor/final.html
|
||||||
|
|
|
@ -10,6 +10,7 @@ USING: compiler io parser sequences words ;
|
||||||
"/library/cocoa/application-utils.factor"
|
"/library/cocoa/application-utils.factor"
|
||||||
"/library/cocoa/window-utils.factor"
|
"/library/cocoa/window-utils.factor"
|
||||||
"/library/cocoa/view-utils.factor"
|
"/library/cocoa/view-utils.factor"
|
||||||
|
"/library/cocoa/ui.factor"
|
||||||
} [
|
} [
|
||||||
run-resource
|
run-resource
|
||||||
] each
|
] each
|
||||||
|
|
|
@ -2,19 +2,11 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
IN: objc
|
IN: objc
|
||||||
USING: alien arrays compiler hashtables kernel kernel-internals
|
USING: alien arrays compiler hashtables kernel kernel-internals
|
||||||
libc math namespaces sequences strings ;
|
libc math namespaces sequences strings words ;
|
||||||
|
|
||||||
: encode-types ( return types -- encoding )
|
|
||||||
>r 1array r> append
|
|
||||||
[ [ alien>objc-types get hash % CHAR: 0 , ] each ] "" make ;
|
|
||||||
|
|
||||||
: prepare-method ( { name return types quot } -- sel type imp )
|
|
||||||
[ first3 encode-types ] keep
|
|
||||||
[ 1 swap tail % \ alien-callback , ] [ ] make ;
|
|
||||||
|
|
||||||
: init-method ( method alien -- )
|
: init-method ( method alien -- )
|
||||||
>r prepare-method r>
|
>r first3 r>
|
||||||
[ >r compile-1 r> set-objc-method-imp ] keep
|
[ >r execute r> set-objc-method-imp ] keep
|
||||||
[ >r <malloc-string> r> set-objc-method-types ] keep
|
[ >r <malloc-string> r> set-objc-method-types ] keep
|
||||||
>r sel_registerName r> set-objc-method-name ;
|
>r sel_registerName r> set-objc-method-name ;
|
||||||
|
|
||||||
|
@ -68,7 +60,20 @@ libc math namespaces sequences strings ;
|
||||||
>r objc-class r> [ <meta-class> ] 2keep <new-class>
|
>r objc-class r> [ <meta-class> ] 2keep <new-class>
|
||||||
objc_addClass ;
|
objc_addClass ;
|
||||||
|
|
||||||
|
: encode-types ( return types -- encoding )
|
||||||
|
>r 1array r> append
|
||||||
|
[ [ alien>objc-types get hash % CHAR: 0 , ] each ] "" make ;
|
||||||
|
|
||||||
|
: prepare-method ( { name ret types quot } -- { name type imp } )
|
||||||
|
[ first3 encode-types ] keep
|
||||||
|
[ 1 swap tail % \ alien-callback , ] [ ] make compile-quot
|
||||||
|
3array ;
|
||||||
|
|
||||||
|
: prepare-methods ( methods -- methods )
|
||||||
|
[ prepare-method ] map ;
|
||||||
|
|
||||||
: define-objc-class ( superclass name imeth cmeth -- )
|
: define-objc-class ( superclass name imeth cmeth -- )
|
||||||
pick >r
|
pick >r
|
||||||
|
[ prepare-methods ] 2apply
|
||||||
[ 2array % 2array % \ (define-objc-class) , ] [ ] make
|
[ 2array % 2array % \ (define-objc-class) , ] [ ] make
|
||||||
r> swap import-objc-class ;
|
r> swap import-objc-class ;
|
||||||
|
|
|
@ -39,10 +39,8 @@ sequences words ;
|
||||||
|
|
||||||
: recompile ( word -- ) dup update-xt compile ;
|
: recompile ( word -- ) dup update-xt compile ;
|
||||||
|
|
||||||
: compile-1 ( quot -- )
|
: compile-quot ( quot -- word )
|
||||||
#! Compute and call a quotation.
|
gensym [ swap define-compound ] keep
|
||||||
"compile" get [
|
"compile" get [ dup compile ] when ;
|
||||||
gensym [ swap define-compound ] keep dup compile execute
|
|
||||||
] [
|
: compile-1 ( quot -- ) compile-quot execute ;
|
||||||
call
|
|
||||||
] if ;
|
|
||||||
|
|
Loading…
Reference in New Issue