slava 2006-03-21 06:43:03 +00:00
parent 58c0337d10
commit b87d1b1973
4 changed files with 23 additions and 25 deletions

View File

@ -21,12 +21,6 @@
- yield in a loop starves i/o - yield in a loop starves i/o
- "localhost" 50 <client> won't fail - "localhost" 50 <client> won't fail
+ objective C/cocoa:
- super message sends
super-> [foo]...
- core foundation should use unicode strings
+ ui/help: + ui/help:
- speed up ideas: - speed up ideas:
@ -39,7 +33,6 @@
- hang with multiple windows - hang with multiple windows
- incremental layout flicker - incremental layout flicker
- expired aliens in view hash - expired aliens in view hash
- unregister notifications and the view in dealloc
- 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
@ -57,6 +50,7 @@
+ compiler/ffi: + compiler/ffi:
- core foundation should use unicode strings
- improve callback efficiency - improve callback efficiency
- alien>utf16-string, utf16-string>alien words - alien>utf16-string, utf16-string>alien words
- float intrinsics - float intrinsics

View File

@ -39,6 +39,10 @@ objc-NSNotificationCenter objc-NSObject objc-NSView threads ;
>r >r >r >r NSNotificationCenter [defaultCenter] r> r> >r >r >r >r NSNotificationCenter [defaultCenter] r> r>
sel_registerName r> r> [addObserver:selector:name:object:] ; sel_registerName r> r> [addObserver:selector:name:object:] ;
: remove-observer ( observer -- )
>r NSNotificationCenter [defaultCenter] r>
[removeObserver:] ;
: finish-launching ( -- ) : finish-launching ( -- )
NSApplication [sharedApplication] [finishLaunching] ; NSApplication [sharedApplication] [finishLaunching] ;

View File

@ -1,5 +1,8 @@
! Copyright (C) 2006 Slava Pestov. ! Copyright (C) 2006 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
IN: objc-FactorView
DEFER: FactorView
USING: arrays cocoa errors freetype gadgets gadgets-launchpad USING: arrays cocoa errors freetype gadgets gadgets-launchpad
gadgets-layouts gadgets-listener gadgets-panes hashtables kernel gadgets-layouts gadgets-listener gadgets-panes hashtables kernel
lists math namespaces objc objc-NSApplication objc-NSEvent lists math namespaces objc objc-NSApplication objc-NSEvent
@ -8,9 +11,6 @@ sequences threads ;
! Cocoa backend for Factor UI ! Cocoa backend for Factor UI
IN: objc-FactorView
DEFER: FactorView
IN: gadgets-cocoa IN: gadgets-cocoa
! Hash mapping aliens to gadgets ! Hash mapping aliens to gadgets
@ -18,12 +18,6 @@ SYMBOL: views
H{ } clone views set-global H{ } clone views set-global
: register-view ( world -- )
dup world-handle views get set-hash ;
: unregister-view ( world -- )
world-handle views get remove-hash ;
: view ( handle -- world ) views get hash ; : view ( handle -- world ) views get hash ;
: mouse-location ( view event -- loc ) : mouse-location ( view event -- loc )
@ -140,19 +134,30 @@ H{ } clone views set-global
[ 2drop 1 ] [ 2drop 1 ]
} }
{ "init" "id" { "id" "SEL" }
[
drop
SUPER-> [init]
dup "updateFactorGadgetSize:" add-resize-observer
]
}
{ "dealloc" "void" { "id" "SEL" } { "dealloc" "void" { "id" "SEL" }
[ [
drop drop
dup view dup remove-notify free-fonts dup view close-world
dup views get remove-hash dup views get remove-hash
dup remove-observer
SUPER-> [dealloc] SUPER-> [dealloc]
] ]
} }
} { } define-objc-class } { } define-objc-class
: register-view ( world -- )
dup world-handle views get set-hash ;
: <FactorView> ( gadget -- view ) : <FactorView> ( gadget -- view )
FactorView over rect-dim <GLView> FactorView over rect-dim <GLView>
dup "updateFactorGadgetSize:" add-resize-observer
[ over set-world-handle dup add-notify register-view ] keep ; [ over set-world-handle dup add-notify register-view ] keep ;
: <FactorWindow> ( gadget title -- window ) : <FactorWindow> ( gadget title -- window )

View File

@ -88,7 +88,7 @@ V{ } clone hand-buttons set-global
#! Show a message in the status bar. #! Show a message in the status bar.
world-status [ set-label-text* ] [ drop ] if* ; world-status [ set-label-text* ] [ drop ] if* ;
: update-help ( -- string ) : update-help ( -- )
#! Update mouse-over help message. #! Update mouse-over help message.
hand-gadget get-global parents [ relevant-help ] keep hand-gadget get-global parents [ relevant-help ] keep
dup empty? [ 2drop ] [ peek show-message ] if ; dup empty? [ 2drop ] [ peek show-message ] if ;
@ -107,11 +107,6 @@ V{ } clone hand-buttons set-global
#! Called when a gadget is removed or added. #! Called when a gadget is removed or added.
hand-loc get-global swap move-hand ; hand-loc get-global swap move-hand ;
: layout-done ( gadget -- )
find-world [
dup update-hand world-handle repaint-handle
] when* ;
: layout-queued ( -- ) : layout-queued ( -- )
invalid dup queue-empty? invalid dup queue-empty?
[ drop ] [ deque dup layout layout-done layout-queued ] if ; [ drop ] [ deque dup layout repaint layout-queued ] if ;