UI bootstrapped in

release
slava 2006-03-15 20:58:22 +00:00
parent 662a2c9125
commit 7df9b774e9
5 changed files with 27 additions and 23 deletions

View File

@ -28,9 +28,9 @@
+ ui/help:
- unregister notifications in dealloc
- segfault when closing window
- wheel mouse is a bit funny
- bootstrap in the ui
- changelog in the UI
- make the UI look better, something like this:
http://twb.ath.cx/~twb/darcs/OBSOLETE/factor/final.html

View File

@ -10,6 +10,7 @@ USING: compiler io parser sequences words ;
"/library/cocoa/application-utils.factor"
"/library/cocoa/window-utils.factor"
"/library/cocoa/view-utils.factor"
"/library/cocoa/ui.factor"
} [
run-resource
] each

View File

@ -2,19 +2,11 @@
! See http://factorcode.org/license.txt for BSD license.
IN: objc
USING: alien arrays compiler hashtables kernel kernel-internals
libc math namespaces sequences strings ;
: 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 ;
libc math namespaces sequences strings words ;
: init-method ( method alien -- )
>r prepare-method r>
[ >r compile-1 r> set-objc-method-imp ] keep
>r first3 r>
[ >r execute r> set-objc-method-imp ] keep
[ >r <malloc-string> r> set-objc-method-types ] keep
>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>
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 -- )
pick >r
[ prepare-methods ] 2apply
[ 2array % 2array % \ (define-objc-class) , ] [ ] make
r> swap import-objc-class ;

View File

@ -157,13 +157,13 @@ IN: shells
[
[
init-world
world get ui-title <FactorWindow>
listener-application
NSApplication [sharedApplication] [finishLaunching]
event-loop
] with-cocoa
] with-freetype ;

View File

@ -39,10 +39,8 @@ sequences words ;
: recompile ( word -- ) dup update-xt compile ;
: compile-1 ( quot -- )
#! Compute and call a quotation.
"compile" get [
gensym [ swap define-compound ] keep dup compile execute
] [
call
] if ;
: compile-quot ( quot -- word )
gensym [ swap define-compound ] keep
"compile" get [ dup compile ] when ;
: compile-1 ( quot -- ) compile-quot execute ;